protected static int comparePrefix(UnitNRShape a,UnitNRShape b){
  int minLevel=Math.min(a.getLevel(),b.getLevel());
  for (int level=1; level <= minLevel; level++) {
    int diff=a.getValAtLevel(level) - b.getValAtLevel(level);
    if (diff != 0)     return diff;
  }
  return 0;
}

protected static int comparePrefix ( UnitNRShape a , UnitNRShape b ) { int minLevel = Math . min ( a . getLevel ( ) , b . getLevel ( ) ) ; for ( int level = 1 ; level <= minLevel ; level ++ ) { int diff = a . getValAtLevel ( level ) - b . getValAtLevel ( level ) ; if ( diff != 0 ) return diff ; } return 0 ; }
compares a to b , returning less than 0 , 0 , or greater than 0 , if a is less than , equal to , or greater than b , respectively , up to their common prefix ( i . e . only min ( a . levels , b . levels ) are compared ) .
