public static Weight max ( Weight w1 , Weight w2 ) { if ( w1 == null ) { throw new IllegalArgumentException ( "Argument w1 cannot be null" ) ; } if ( w2 == null ) { throw new IllegalArgumentException ( "Argument w2 cannot be null" ) ; } if ( ( w1 . isInfinity && w1 . posOrNeg ) || ( w2 . isInfinity && ! w2 . posOrNeg ) ) { return w1 ; } else if ( ( w2 . isInfinity && w2 . posOrNeg ) || ( w1 . isInfinity && ! w1 . posOrNeg ) ) { return w2 ; } else if ( w1 . val >= w2 . val ) { return w1 ; } else { return w2 ; } }
Gets the larger of the two given weights .