VersionRange { public boolean matches(Version version) { boolean result; if (this.getMaximumVersion() == null) { result = this.getMinimumVersion().compareTo(version) <= 0; } else { int minN = this.isMinimumExclusive() ? 0 : 1; int maxN = this.isMaximumExclusive() ? 0 : 1; result = (this.getMinimumVersion().compareTo(version) < minN) && (version.compareTo(this.getMaximumVersion()) < maxN); } return result; } VersionRange(String version);  VersionRange(String version, boolean exactVersion); private  VersionRange(Version maximumVersion,
                         boolean maximumExclusive,
                         Version minimumVersion,
                         boolean minimumExclusive); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object other); Version getExactVersion(); Version getMaximumVersion(); Version getMinimumVersion(); boolean isMaximumExclusive(); boolean isMaximumUnbounded(); boolean isMinimumExclusive(); boolean matches(Version version); boolean isExactVersion(); VersionRange intersect(VersionRange r); static VersionRange parseVersionRange(String s); static VersionRange parseVersionRange(String s, boolean exactVersion);  }
@Test public void testMatches() { VersionRange vr = new VersionRange("[1.0.0, 2.0.0]"); assertFalse(vr.matches(new Version(0,9,0))); assertFalse(vr.matches(new Version(2,1,0))); assertTrue(vr.matches(new Version(2,0,0))); assertTrue(vr.matches(new Version(1,0,0))); assertTrue(vr.matches(new Version(1,5,0))); vr = new VersionRange("[1.0.0, 2.0.0)"); assertFalse(vr.matches(new Version(0,9,0))); assertFalse(vr.matches(new Version(2,1,0))); assertFalse(vr.matches(new Version(2,0,0))); assertTrue(vr.matches(new Version(1,0,0))); assertTrue(vr.matches(new Version(1,5,0))); vr = new VersionRange("(1.0.0, 2.0.0)"); assertFalse(vr.matches(new Version(0,9,0))); assertFalse(vr.matches(new Version(2,1,0))); assertFalse(vr.matches(new Version(2,0,0))); assertFalse(vr.matches(new Version(1,0,0))); assertTrue(vr.matches(new Version(1,5,0))); vr = new VersionRange("[1.0.0, 1.0.0]"); assertFalse(vr.matches(new Version(0,9,0))); assertFalse(vr.matches(new Version(2,0,0))); assertTrue(vr.matches(new Version(1,0,0))); assertFalse(vr.matches(new Version(1,5,0))); assertFalse(vr.matches(new Version(1,9,9))); }