protected static Requirement hyphenRequirement ( String lowerVersion , String upperVersion , Semver . SemverType type ) { if ( type != Semver . SemverType . NPM ) { throw new SemverException ( "The hyphen requirements are only compatible with NPM." ) ; } Semver lower = extrapolateVersion ( new Semver ( lowerVersion , type ) ) ; Semver upper = new Semver ( upperVersion , type ) ; Range . RangeOperator upperOperator = Range . RangeOperator . LTE ; if ( upper . getMinor ( ) == null || upper . getPatch ( ) == null ) { upperOperator = Range . RangeOperator . LT ; if ( upper . getMinor ( ) == null ) { upper = extrapolateVersion ( upper ) . withIncMajor ( ) ; } else { upper = extrapolateVersion ( upper ) . withIncMinor ( ) ; } } Requirement req1 = new Requirement ( new Range ( lower , Range . RangeOperator . GTE ) , null , null , null ) ; Requirement req2 = new Requirement ( new Range ( upper , upperOperator ) , null , null , null ) ; return new Requirement ( null , req1 , RequirementOperator . AND , req2 ) ; }
Creates a requirement that satisfies x1 . y1 . z1 - x2 . y2 . z2 .