void setDefaults(List<Comparable<?>> segments) { Comparable<?> dflt = getDefaultValue(); if (dflt != null) { // A group default overrides any defaults within the // group fragments super.setDefaults(segments); } else { // Assign defaults for all fragments for (int idx = 0; idx < fragments.length; ++idx) fragments[idx].setDefaults(segments); } }
public void addAll(Collection<IInstallableUnit> toAdd) { for (IInstallableUnit unit : toAdd) { add(unit); } }
public synchronized static TranslationSupport getInstance() { if (instance == null) instance = new TranslationSupport(); return instance; }
boolean parseOne(List<Comparable<?>> segments, String version, int maxPos, TreeInfo info) { int pos = info.getPosition(); if (pos >= maxPos || version.charAt(pos) != 'p') return false; int[] position = new int[] {++pos}; Comparable<?> v = VersionParser.parseRawElement(version, position, maxPos); if (v == null) return false; if (!isIgnored()) info.setPadValue(v); info.setPosition(position[0]); return true; }
boolean parseOne(List<Comparable<?>> segments, String version, int maxPos, TreeInfo info) { int[] position = new int[] {info.getPosition()}; Comparable<?> v = VersionParser.parseRawElement(version, position, maxPos); if (v == null) return false; if (!isIgnored()) segments.add(v); info.setPosition(position[0]); return true; }
public boolean equals(Object object) { if (object == this) return true; if (!(object instanceof OSGiVersion)) { if (object instanceof BasicVersion) { BasicVersion ov = (BasicVersion) object; return VersionVector.equals(getVector(), null, ov.getVector(), ov.getPad()); } return false; } OSGiVersion other = (OSGiVersion) object; return micro == other.micro && minor == other.minor && major == other.major && qualifier.equals(other.qualifier); }
boolean parseOne(List<Comparable<?>> segments, String version, int maxPos, TreeInfo info) { int pos = info.getPosition(); if (pos < maxPos && isMatch(version, pos)) { // Just swallow, a delimiter does not contribute to the vector. // info.setPosition(pos + 1); return true; } return false; }
public Version parse(String version) { List<Comparable<?>> vector = parse(version, 0, version.length()); return (this == OSGI_FORMAT) ? OSGiVersion.fromVector(vector) : OmniVersion.fromVector(vector, this, version); }
static void rawToString(StringBuffer sb, boolean forRange, Comparable<?> e) { if (e instanceof String) { writeQuotedString(sb, forRange, (String) e, '\'', 0, false); } else if (e instanceof VersionVector) { sb.append('<'); ((VersionVector) e).toString(sb, forRange); sb.append('>'); } else if (e instanceof EnumDefinition.EnumSegment) ((EnumDefinition.EnumSegment) e).toString(sb); else sb.append(e); }
protected static IRequiredCapability toRequiredCapability(IRequirement requirement) { if (!(requirement instanceof IRequiredCapability)) { return null; } IRequiredCapability requiredCapability = (IRequiredCapability) requirement; if (!RequiredCapability.isVersionRangeRequirement(requiredCapability.getMatches())) { return null; } return requiredCapability; }
InstallableUnit unit() { if (unit == null) unit = new InstallableUnitFragment(); return unit; } }
/** * Append the string representation of this instance to the * <code>sb</code> buffer. * @param sb The buffer to append to * @param rangeSafe If <code>true</code>, the range delimiters will be escaped * with backslash. */ void toString(StringBuffer sb, boolean rangeSafe) { toString(sb, vector, padValue, rangeSafe); }
/** * Cache the translated property value to optimize future retrieval of the same value. * Currently we just cache on the installable unit object in memory. In future * we should push support for localized property retrieval into IInstallableUnit * so we aren't required to reach around the API here. */ private String cacheResult(IInstallableUnit iu, String localizedKey, String localizedValue) { if (iu instanceof InstallableUnit) ((InstallableUnit) iu).setLocalizedProperty(localizedKey, localizedValue); return localizedValue; }
private static int compareReminder(int idx, Comparable<?>[] vector, Comparable<?> padValue, Comparable<?> othersPad) { int cmp; for (cmp = 0; idx < vector.length && cmp == 0; ++idx) cmp = compareSegments(vector[idx], othersPad); if (cmp == 0) cmp = (padValue == null) ? -1 : compareSegments(padValue, othersPad); return cmp; }