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 PrefixPlusPlusOperator extends XfixOperator { 18 19 public PrefixPlusPlusOperator(int variableTypeId, int start) { 20 super(variableTypeId, start); 21 } 22 23 26 public void execute() throws CoreException { 27 IJavaVariable variable = (IJavaVariable) pop(); 28 29 switch (fVariableTypeId) { 30 case T_byte : 31 variable.setValue(newValue((byte)(((IJavaPrimitiveValue)variable.getValue()).getByteValue() + 1))); 32 break; 33 case T_short : 34 variable.setValue(newValue((short)(((IJavaPrimitiveValue)variable.getValue()).getShortValue() + 1))); 35 break; 36 case T_char : 37 variable.setValue(newValue((char)(((IJavaPrimitiveValue)variable.getValue()).getCharValue() + 1))); 38 break; 39 case T_int : 40 variable.setValue(newValue(((IJavaPrimitiveValue)variable.getValue()).getIntValue() + 1)); 41 break; 42 case T_long : 43 variable.setValue(newValue(((IJavaPrimitiveValue)variable.getValue()).getLongValue() + 1)); 44 break; 45 case T_float : 46 variable.setValue(newValue(((IJavaPrimitiveValue)variable.getValue()).getFloatValue() + 1)); 47 break; 48 case T_double : 49 variable.setValue(newValue(((IJavaPrimitiveValue)variable.getValue()).getDoubleValue() + 1)); 50 break; 51 } 52 53 push(variable.getValue()); 54 } 55 56 public String toString() { 57 return InstructionsEvaluationMessages.PrefixPlusPlusOperator_prefix________operator_1; 58 } 59 60 } 61 | Popular Tags |