public int compare ( Alternative ab ) { if ( production != ab . production ) { throw new IllegalArgumentException ( ) ; } // TODO: compare two ups if ( resultOfs != - 1 || ab . resultOfs != - 1 ) { return NE ; } if ( argsOfs . size ( ) == 0 && ab . argsOfs . size ( ) == 0 ) { return EQ ; } if ( argsOfs . size ( ) == 0 || ab . argsOfs . size ( ) == 0 ) { return ALT ; } if ( max ( argsOfs ) < min ( ab . argsOfs ) ) { return LT ; } if ( min ( argsOfs ) > max ( ab . argsOfs ) ) { return GT ; } if ( argsOfs . size ( ) != 1 || ab . argsOfs . size ( ) != 1 ) { return NE ; } else { if ( argsOfs . get ( 0 ) != ab . argsOfs . get ( 0 ) ) { throw new IllegalStateException ( ) ; } return EQ ; } }
Compares functions .