public boolean containsVersion( ArtifactVersion version ) { if ( lowerBound != null ) { int comparison = lowerBound.compareTo( version ); if ( ( comparison == 0 ) && !lowerBoundInclusive ) { return false; } if ( comparison > 0 ) { return false; } } if ( upperBound != null ) { int comparison = upperBound.compareTo( version ); if ( ( comparison == 0 ) && !upperBoundInclusive ) { return false; } if ( comparison < 0 ) { return false; } } return true; }
public boolean containsVersion( ArtifactVersion version ) { if ( lowerBound != null ) { int comparison = lowerBound.compareTo( version ); if ( ( comparison == 0 ) && !lowerBoundInclusive ) { return false; } if ( comparison > 0 ) { return false; } } if ( upperBound != null ) { int comparison = upperBound.compareTo( version ); if ( ( comparison == 0 ) && !upperBoundInclusive ) { return false; } if ( comparison < 0 ) { return false; } } return true; }
public ArtifactVersion matchVersion( List<ArtifactVersion> versions ) { // TODO could be more efficient by sorting the list and then moving along the restrictions in order? ArtifactVersion matched = null; for ( ArtifactVersion version : versions ) { if ( containsVersion( version ) ) { // valid - check if it is greater than the currently matched version if ( matched == null || version.compareTo( matched ) > 0 ) { matched = version; } } } return matched; }
public ArtifactVersion matchVersion( List<ArtifactVersion> versions ) { // TODO could be more efficient by sorting the list and then moving along the restrictions in order? ArtifactVersion matched = null; for ( ArtifactVersion version : versions ) { if ( containsVersion( version ) ) { // valid - check if it is greater than the currently matched version if ( matched == null || version.compareTo( matched ) > 0 ) { matched = version; } } } return matched; }
if ( upperVersion != null && lowerVersion != null && upperVersion.compareTo( lowerVersion ) < 0 )
if ( upperVersion != null && lowerVersion != null && upperVersion.compareTo( lowerVersion ) < 0 )
public MetadataGraphEdge apply( MetadataGraphEdge e1, MetadataGraphEdge e2 ) { int depth1 = e1.getDepth(); int depth2 = e2.getDepth(); if ( depth1 == depth2 ) { ArtifactVersion v1 = new DefaultArtifactVersion( e1.getVersion() ); ArtifactVersion v2 = new DefaultArtifactVersion( e2.getVersion() ); if ( newerFirst ) { return v1.compareTo( v2 ) > 0 ? e1 : e2; } return v1.compareTo( v2 ) > 0 ? e2 : e1; } if ( closerFirst ) { return depth1 < depth2 ? e1 : e2; } return depth1 < depth2 ? e2 : e1; }
public ResolutionNode resolveConflict( ResolutionNode node1, ResolutionNode node2 ) { try { ArtifactVersion version1 = node1.getArtifact().getSelectedVersion(); ArtifactVersion version2 = node2.getArtifact().getSelectedVersion(); return version1.compareTo( version2 ) <= 0 ? node1 : node2; } catch ( OverConstrainedVersionException exception ) { // TODO log message or throw exception? return null; } } }
if ( restriction.getLowerBound() == null || restriction.getLowerBound().compareTo( upperBound ) < 0 )
public ResolutionNode resolveConflict( ResolutionNode node1, ResolutionNode node2 ) { try { ArtifactVersion version1 = node1.getArtifact().getSelectedVersion(); ArtifactVersion version2 = node2.getArtifact().getSelectedVersion(); return version1.compareTo( version2 ) > 0 ? node1 : node2; } catch ( OverConstrainedVersionException exception ) { // TODO log message or throw exception? return null; } } }
if ( restriction.getLowerBound() == null || restriction.getLowerBound().compareTo( upperBound ) < 0 )
@Override public boolean matches( String requirement ) { try { VersionRange range = VersionRange.createFromVersionSpec( requirement ); if ( range.hasRestrictions() ) { return range.containsVersion( version ); } else { return range.getRecommendedVersion().compareTo( version ) == 0; } } catch ( InvalidVersionSpecificationException ex ) { //TODO error reporting ex.printStackTrace(); return false; } }
|| res1.getLowerBound().compareTo( res2.getUpperBound() ) <= 0 ) || res1.getUpperBound().compareTo( res2.getLowerBound() ) >= 0 ) int comparison = res1.getLowerBound().compareTo( res2.getLowerBound() ); if ( comparison < 0 ) int comparison = res1.getUpperBound().compareTo( res2.getUpperBound() ); if ( comparison < 0 ) if ( lower == null || upper == null || lower.compareTo( upper ) != 0 )
|| res1.getLowerBound().compareTo( res2.getUpperBound() ) <= 0 ) || res1.getUpperBound().compareTo( res2.getLowerBound() ) >= 0 ) int comparison = res1.getLowerBound().compareTo( res2.getLowerBound() ); if ( comparison < 0 ) int comparison = res1.getUpperBound().compareTo( res2.getUpperBound() ); if ( comparison < 0 ) if ( lower == null || upper == null || lower.compareTo( upper ) != 0 )
public boolean isNewerThan(DependencyDescriptor o) { int comparison = artifactVersion.compareTo(o.artifactVersion); return comparison > 0 || ( comparison == 0 && artifactTimestamp > o.artifactTimestamp ); } }
@SuppressWarnings( "unchecked" ) private static int compare( ArtifactVersion a, ArtifactVersion b ) { return a.compareTo( b ); } }
@SuppressWarnings( "unchecked" ) private static int compare( ArtifactVersion a, ArtifactVersion b ) { return a.compareTo( b ); } }
/** * {@inheritDoc} */ public int compare( ArtifactVersion o1, ArtifactVersion o2 ) { return o1.compareTo( o2 ); }
public boolean isNewerThan(DependencyDescriptor o) { int comparison = artifactVersion.compareTo(o.artifactVersion); return comparison > 0 || ( comparison == 0 && artifactTimestamp > o.artifactTimestamp ); } }
private void validateHasThisSomeVersion() throws IOException { String updateJsonUrlFile = String.format("%1$s/update.json", urlApp); RemoteNewVersion remoteNewVersion = new RemoteNewVersion(updateJsonUrlFile, remoteNewVersionTimeout); String remoteVersionString = remoteNewVersion.getVersion(); if (remoteVersionString != null) { ArtifactVersion remoteVersion = new DefaultArtifactVersion(remoteVersionString); ArtifactVersion newVersion = new DefaultArtifactVersion(this.newVersion); if ((newVersion.compareTo(remoteVersion) < 0 || newVersion.compareTo(remoteVersion) == 0) && !forceUpload) { throw new IOException("New version is less or equal from remote version. Try set `forceUpdate` to true."); } } }