1 19 20 package jode.expr; 21 import jode.type.Type; 22 import jode.decompiler.Options; 23 import jode.decompiler.TabbedPrintWriter; 24 25 public class UnaryOperator extends Operator { 26 public UnaryOperator(Type type, int op) { 27 super(type, op); 28 initOperands(1); 29 } 30 31 public int getPriority() { 32 return 700; 33 } 34 35 public Expression negate() { 36 if (getOperatorIndex() == LOG_NOT_OP) { 37 if (subExpressions != null) 38 return subExpressions[0]; 39 else 40 return new NopOperator(Type.tBoolean); 41 } 42 return super.negate(); 43 } 44 45 public void updateSubTypes() { 46 subExpressions[0].setType(Type.tSubType(type)); 47 } 48 49 public void updateType() { 50 updateParentType(Type.tSuperType(subExpressions[0].getType())); 51 } 52 53 public boolean opEquals(Operator o) { 54 return (o instanceof UnaryOperator) 55 && o.operatorIndex == operatorIndex; 56 } 57 58 public void dumpExpression(TabbedPrintWriter writer) 59 throws java.io.IOException { 60 writer.print(getOperatorString()); 61 if ((Options.outputStyle & Options.GNU_SPACING) != 0) 62 writer.print(" "); 63 subExpressions[0].dumpExpression(writer, 700); 64 } 65 } 66 | Popular Tags |