private static Semver extrapolateVersion ( Semver semver ) { StringBuilder sb = new StringBuilder ( ) . append ( semver . getMajor ( ) ) . append ( "." ) . append ( semver . getMinor ( ) == null ? 0 : semver . getMinor ( ) ) . append ( "." ) . append ( semver . getPatch ( ) == null ? 0 : semver . getPatch ( ) ) ; boolean first = true ; for ( int i = 0 ; i < semver . getSuffixTokens ( ) . length ; i ++ ) { if ( first ) { sb . append ( "-" ) ; first = false ; } else { sb . append ( "." ) ; } sb . append ( semver . getSuffixTokens ( ) [ i ] ) ; } if ( semver . getBuild ( ) != null ) { sb . append ( "+" ) . append ( semver . getBuild ( ) ) ; } return new Semver ( sb . toString ( ) , semver . getType ( ) ) ; }
Extrapolates the optional minor and patch numbers . - 1 = 1 . 0 . 0 - 1 . 2 = 1 . 2 . 0 - 1 . 2 . 3 = 1 . 2 . 3