congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
com.wlqq.mavenversion
Code IndexAdd Tabnine to your IDE (free)

How to use com.wlqq.mavenversion

Best Java code snippets using com.wlqq.mavenversion (Showing top 20 results out of 315)

origin: ManbangGroup/Phantom

/**
 * Checks if this version is greater than the other version.
 *
 * @param other the other version to compare to
 * @return {@code true} if this version is greater than the other version
 * or {@code false} otherwise
 * @see #compareTo(Version other)
 */
public boolean greaterThan(Version other) {
  return compareTo(other) > 0;
}
origin: ManbangGroup/Phantom

private static Item parseItem(boolean isDigit, String buf) {
  return isDigit ? new IntegerItem(buf) : new StringItem(buf, false);
}
origin: ManbangGroup/Phantom

/**
 * Creates a new instance of {@code Version} as a
 * result of parsing the specified version string.
 *
 * @param version the version string to parse
 * @return a new instance of the {@code Version} class
 */
public Version(String version) {
  parseVersion(version);
}
origin: ManbangGroup/Phantom

/**
 * Check lib version satisfies lib version requirements
 *
 * @param versions     e.g. <code>{"junit:junit": "4.12", "com.android.support:support-v4": "25.3.1"}</code>
 * @param requirements e.g. <code>{"junit:junit": "4.12", "com.android.support:support-v4": ">=25"}</code>
 * @return verify result
 * @see Result
 */
public static Result satisfies(Map<String, String> versions, Map<String, String> requirements) {
  for (Map.Entry<String, String> entry : requirements.entrySet()) {
    final String lib = entry.getKey();
    final String requirement = entry.getValue();
    final String version = versions.get(lib);
    if (version == null) {
      // lib not exist
      return Result.createFailResult(lib, String.format(Locale.ENGLISH, "required lib [%s] not exist", lib));
    }
    if (!new Version(version).satisfies(requirement)) {
      // lib version requirement not satisfied
      return Result.createFailResult(lib, String.format(Locale.ENGLISH,
              "required lib [%s:%s] not satisfies [%s:%s]", lib, version, lib, requirement));
    }
  }
  return Result.createSuccessResult();
}
origin: ManbangGroup/Phantom

public int compareTo(Item item) {
  if (item == null) {
    if (size() == 0) {
      return 0; // 1-0 = 1- (normalize) = 1
    }
    Item first = get(0);
    return first.compareTo(null);
  }
  switch (item.getType()) {
    case INTEGER_ITEM:
      return -1; // 1-1 < 1.0.x
    case STRING_ITEM:
      return 1; // 1-1 > 1-sp
    case LIST_ITEM:
      Iterator<Item> left = iterator();
      Iterator<Item> right = ((ListItem) item).iterator();
      while (left.hasNext() || right.hasNext()) {
        Item l = left.hasNext() ? left.next() : null;
        Item r = right.hasNext() ? right.next() : null;
        // if this is shorter, then invert the compare and mul with -1
        int result = l == null ? -1 * r.compareTo(l) : l.compareTo(r);
        if (result != 0) {
          return result;
        }
      }
      return 0;
    default:
      throw new RuntimeException("invalid item: " + item.getClass());
  }
}
origin: ManbangGroup/Phantom

void normalize() {
  for (ListIterator<Item> iterator = listIterator(size()); iterator.hasPrevious(); ) {
    Item item = iterator.previous();
    if (item.isNull()) {
      iterator.remove(); // remove null trailing items: 0, "", empty list
    } else {
      break;
    }
  }
}
origin: ManbangGroup/Phantom

public int compareTo(Item item) {
  if (item == null) {
    // 1-rc < 1, 1-ga > 1
    return comparableQualifier(value).compareTo(RELEASE_VERSION_INDEX);
  }
  switch (item.getType()) {
    case INTEGER_ITEM:
      return -1; // 1.any < 1.1 ?
    case STRING_ITEM:
      return comparableQualifier(value).compareTo(comparableQualifier(((StringItem) item).value));
    case LIST_ITEM:
      return -1; // 1.any < 1-1
    default:
      throw new RuntimeException("invalid item: " + item.getClass());
  }
}
origin: ManbangGroup/Phantom

@Test
public void testCreateVersion() throws Exception {
  // org.infinispan:infinispan-directory-provider:9.2.0.Alpha2
  Version version = new Version("9.2.0.Alpha2");
  // junit:junit:4.12
  version = new Version("4.12");
  // org.json:json:20171018
  version = new Version("20171018");
  // io.reactivex.rxjava2:rxjava:2.1.6
  version = new Version("2.1.6");
  // io.reactivex.rxjava2:rxjava:2.1.6-SNAPSHOT
  version = new Version("2.1.6-SNAPSHOT");
}
origin: ManbangGroup/Phantom

  /**
   * Checks if the current version equals the parsed version.
   *
   * @param version the version to compare to, the left-hand
   *                operand of the "equal" operator
   * @return {@code true} if the version equals the
   *         parsed version or {@code false} otherwise
   */
  @Override
  public boolean interpret(Version version) {
    return version.equals(mParsedVersion);
  }
}
origin: ManbangGroup/Phantom

/**
 * Create success result; lib, message would be <code>null</code>
 * @return success result
 */
public static Result createSuccessResult() {
  return new Result(true, null, null);
}
origin: ManbangGroup/Phantom

public int compareTo(Version o) {
  return items.compareTo(o.items);
}
origin: ManbangGroup/Phantom

public boolean isNull() {
  return (size() == 0);
}
origin: ManbangGroup/Phantom

public boolean isNull() {
  return (comparableQualifier(value).compareTo(RELEASE_VERSION_INDEX) == 0);
}
origin: ManbangGroup/Phantom

  public String toString() {
    StringBuilder buffer = new StringBuilder("(");
    for (Iterator<Item> iter = iterator(); iter.hasNext(); ) {
      buffer.append(iter.next());
      if (iter.hasNext()) {
        buffer.append(',');
      }
    }
    buffer.append(')');
    return buffer.toString();
  }
}
origin: ManbangGroup/Phantom

public int compareTo(Item item) {
  if (item == null) {
    return BigInteger_ZERO.equals(value) ? 0 : 1; // 1.0 == 1, 1.1 > 1
  }
  switch (item.getType()) {
    case INTEGER_ITEM:
      return value.compareTo(((IntegerItem) item).value);
    case STRING_ITEM:
      return 1; // 1.1 > 1-sp
    case LIST_ITEM:
      return 1; // 1.1 > 1-1
    default:
      throw new RuntimeException("invalid item: " + item.getClass());
  }
}
origin: ManbangGroup/Phantom

/**
 * Checks if this version is less than or equal to the other version.
 *
 * @param other the other version to compare to
 * @return {@code true} if this version is less than or equal
 * to the other version or {@code false} otherwise
 * @see #compareTo(Version other)
 */
public boolean lessThanOrEqualTo(Version other) {
  return compareTo(other) <= 0;
}
origin: ManbangGroup/Phantom

/**
 * Create fail result
 * @param lib which lib requirement not satisfied
 * @param message detail fail message
 * @return fail result
 */
public static Result createFailResult(String lib, String message) {
  return new Result(false, lib, message);
}
origin: ManbangGroup/Phantom

/**
 * Checks if this version is greater than or equal to the other version.
 *
 * @param other the other version to compare to
 * @return {@code true} if this version is greater than or equal
 * to the other version or {@code false} otherwise
 * @see #compareTo(Version other)
 */
public boolean greaterThanOrEqualTo(Version other) {
  return compareTo(other) >= 0;
}
origin: ManbangGroup/Phantom

/**
 * Checks if this version is less than the other version.
 *
 * @param other the other version to compare to
 * @return {@code true} if this version is less than the other version
 * or {@code false} otherwise
 * @see #compareTo(Version other)
 */
public boolean lessThan(Version other) {
  return compareTo(other) < 0;
}
origin: ManbangGroup/Phantom

  /**
   * Checks if the current version is greater
   * than or equal to the parsed version.
   *
   * @param version the version to compare to, the left-hand operand
   *                of the "greater than or equal to" operator
   * @return {@code true} if the version is greater than or equal
   *         to the parsed version or {@code false} otherwise
   */
  @Override
  public boolean interpret(Version version) {
    return version.compareTo(mParsedVersion) >= 0;
  }
}
com.wlqq.mavenversion

Most used classes

  • Version
    Generic implementation of version comparison. Features: * mixing of '-' (hyphen) and '.' (dot) sep
  • ParseException
  • Version$IntegerItem
    Represents a numeric item in the version item list.
  • Version$Item
  • Version$ListItem
    Represents a version list item. This class is used both for the global item list and for sub-lists (
  • VersionVerifier$Result,
  • VersionVerifier,
  • Equal,
  • Expression,
  • ExpressionParser,
  • GreaterOrEqual
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now