public int compareTo ( BaseSingleFieldPeriod other ) { if ( other . getClass ( ) != getClass ( ) ) { throw new ClassCastException ( getClass ( ) + " cannot be compared to " + other . getClass ( ) ) ; } int otherValue = other . getValue ( ) ; int thisValue = getValue ( ) ; if ( thisValue > otherValue ) { return 1 ; } if ( thisValue < otherValue ) { return - 1 ; } return 0 ; }
Compares this period to another object of the same class .