Package cpw.mods.fml.common.versioning

Examples of cpw.mods.fml.common.versioning.Restriction


      if (index < 0) {
        throw new InvalidVersionSpecificationException("Unbounded range: " + spec);
      }

      Restriction restriction = parseRestriction(label, process.substring(0, index + 1));
      if (lowerBound == null) {
        lowerBound = restriction.getLowerBound();
      }
      if (upperBound != null) {
        if (restriction.getLowerBound() == null || restriction.getLowerBound().compareTo(upperBound) < 0) {
          throw new InvalidVersionSpecificationException("Ranges overlap: " + spec);
        }
      }
      restrictions.add(restriction);
      upperBound = restriction.getUpperBound();

      process = process.substring(index + 1).trim();

      if (process.length() > 0 && process.startsWith(",")) {
        process = process.substring(1).trim();
View Full Code Here


    boolean lowerBoundInclusive = spec.startsWith("[");
    boolean upperBoundInclusive = spec.endsWith("]");

    String process = spec.substring(1, spec.length() - 1).trim();

    Restriction restriction;

    int index = process.indexOf(',');

    if (index < 0) {
      if (!lowerBoundInclusive | !upperBoundInclusive) {
        throw new InvalidVersionSpecificationException("Single version must be surrounded by []: " + spec);
      }

      ArtifactVersion version = getArtifactVersion(label, process);

      restriction = new Restriction(version, lowerBoundInclusive, version, upperBoundInclusive);
    } else {
      String lowerBound = process.substring(0, index).trim();
      String upperBound = process.substring(index + 1).trim();
      if (lowerBound.equals(upperBound)) {
        throw new InvalidVersionSpecificationException("Range cannot have identical boundaries: " + spec);
      }

      ArtifactVersion lowerVersion = null;
      if (lowerBound.length() > 0) {
        lowerVersion = getArtifactVersion(label, lowerBound);
      }
      ArtifactVersion upperVersion = null;
      if (upperBound.length() > 0) {
        upperVersion = getArtifactVersion(label, upperBound);
      }

      if (upperVersion != null & lowerVersion != null && upperVersion.compareTo(lowerVersion) < 0) {
        throw new InvalidVersionSpecificationException("Range defies version ordering: " + spec);
      }

      restriction = new Restriction(lowerVersion, lowerBoundInclusive, upperVersion, upperBoundInclusive);
    }

    return restriction;
  }
View Full Code Here

TOP

Related Classes of cpw.mods.fml.common.versioning.Restriction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.