public int compareTo ( @ Nonnull final Version rhs ) { ValueEnforcer . notNull ( rhs , "Rhs" ) ; // compare major version int ret = m_nMajor - rhs . m_nMajor ; if ( ret == 0 ) { // compare minor version ret = m_nMinor - rhs . m_nMinor ; if ( ret == 0 ) { // compare micro version ret = m_nMicro - rhs . m_nMicro ; if ( ret == 0 ) { // check qualifier if ( m_sQualifier != null ) { if ( rhs . m_sQualifier != null ) { ret = m_sQualifier . compareTo ( rhs . m_sQualifier ) ; // convert to -1/0/+1 if ( ret < 0 ) ret = - 1 ; else if ( ret > 0 ) ret = + 1 ; } else ret = 1 ; } else if ( rhs . m_sQualifier != null ) { // only this qualifier == null ret = - 1 ; } else { // both qualifier are null ret = 0 ; } } } } return ret ; }
Compares two Version objects .