private static bool match(Version a, Version b) { if (a.segments().sz() > b.segments().sz()) return false; for (int i=0; i<a.segments().sz(); ++i) if (a.segment(i) != b.segment(i)) return false; return true; }
public bool match(Version v) { for (int i=0; i<m_constraints.Length; i++) { Constraint c = m_constraints[i]; if (c.isPlus) { // versionPlus if (c.version.compare(v) <= 0) return true; } else if (c.endVersion != null) { // versionRange if (c.version.compare(v) <= 0 && (c.endVersion.compare(v) >= 0 || match(c.endVersion, v))) return true; } else { // versionSimple if (match(c.version, v)) return true; } } return false; }