1 11 package org.eclipse.jdt.internal.debug.eval.ast.instructions; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.jdt.debug.core.IJavaPrimitiveValue; 15 import org.eclipse.jdt.debug.core.IJavaVariable; 16 17 public class PostfixPlusPlusOperator extends XfixOperator { 18 19 public PostfixPlusPlusOperator(int variableTypeId, int start) { 20 super(variableTypeId, start); 21 } 22 23 26 public void execute() throws CoreException { 27 IJavaVariable variable = (IJavaVariable) pop(); 28 push(variable.getValue()); 29 30 switch (fVariableTypeId) { 31 case T_byte : 32 variable.setValue(newValue((byte)(((IJavaPrimitiveValue)variable.getValue()).getByteValue() + 1))); 33 break; 34 case T_short : 35 variable.setValue(newValue((short)(((IJavaPrimitiveValue)variable.getValue()).getShortValue() + 1))); 36 break; 37 case T_char : 38 variable.setValue(newValue((char)(((IJavaPrimitiveValue)variable.getValue()).getCharValue() + 1))); 39 break; 40 case T_int : 41 variable.setValue(newValue(((IJavaPrimitiveValue)variable.getValue()).getIntValue() + 1)); 42 break; 43 case T_long : 44 variable.setValue(newValue(((IJavaPrimitiveValue)variable.getValue()).getLongValue() + 1)); 45 break; 46 case T_float : 47 variable.setValue(newValue(((IJavaPrimitiveValue)variable.getValue()).getFloatValue() + 1)); 48 break; 49 case T_double : 50 variable.setValue(newValue(((IJavaPrimitiveValue)variable.getValue()).getDoubleValue() + 1)); 51 break; 52 } 53 } 54 55 public String toString() { 56 return InstructionsEvaluationMessages.PostfixPlusPlusOperator_postfix________operator_1; 57 } 58 59 } 60 | Popular Tags |