You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
831 B
32 lines
831 B
package jode;
|
|
import sun.tools.java.Type;
|
|
|
|
public class CompareToIntOperator extends SimpleOperator {
|
|
public CompareToIntOperator(Type type, int lessGreater) {
|
|
super(Type.tInt, 0, 2);
|
|
operandTypes[0] = operandTypes[1] = type;
|
|
}
|
|
|
|
public int getPriority() {
|
|
return 499;
|
|
}
|
|
|
|
public int getOperandPriority(int i) {
|
|
return 550;
|
|
}
|
|
|
|
public void setOperandType(Type[] inputTypes) {
|
|
super.setOperandType(inputTypes);
|
|
Type operandType =
|
|
MyType.intersection(operandTypes[0],operandTypes[1]);
|
|
operandTypes[0] = operandTypes[1] = operandType;
|
|
}
|
|
|
|
public boolean equals(Object o) {
|
|
return (o instanceof CompareToIntOperator);
|
|
}
|
|
|
|
public String toString(String[] operands) {
|
|
return operands[0] + " <=> " + operands[1];
|
|
}
|
|
}
|
|
|