diff options
Diffstat (limited to 'org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/RemainderOperator.java')
-rw-r--r-- | org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/RemainderOperator.java | 59 |
1 files changed, 44 insertions, 15 deletions
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/RemainderOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/RemainderOperator.java index be99d14bb..79ee27acc 100644 --- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/RemainderOperator.java +++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/RemainderOperator.java @@ -18,42 +18,60 @@ import org.eclipse.jdt.debug.core.IJavaValue; import org.eclipse.jdt.internal.debug.core.JDIDebugPlugin; public class RemainderOperator extends BinaryOperator { - public RemainderOperator(int resultId, int leftTypeId, int rightTypeId, int start) { + public RemainderOperator(int resultId, int leftTypeId, int rightTypeId, + int start) { this(resultId, leftTypeId, rightTypeId, false, start); } - protected RemainderOperator(int resultId, int leftTypeId, int rightTypeId, boolean isAssignmentOperator, int start) { + protected RemainderOperator(int resultId, int leftTypeId, int rightTypeId, + boolean isAssignmentOperator, int start) { super(resultId, leftTypeId, rightTypeId, isAssignmentOperator, start); } /* * @see BinaryOperator#getBooleanResult(IJavaValue, IJavaValue) */ - protected boolean getBooleanResult(IJavaValue leftOperand, IJavaValue rightOperand) { + @Override + protected boolean getBooleanResult(IJavaValue leftOperand, + IJavaValue rightOperand) { return false; } /* * @see BinaryOperator#getDoubleResult(IJavaValue, IJavaValue) */ - protected double getDoubleResult(IJavaValue leftOperand, IJavaValue rightOperand) { - return ((IJavaPrimitiveValue) leftOperand).getDoubleValue() % ((IJavaPrimitiveValue) rightOperand).getDoubleValue(); + @Override + protected double getDoubleResult(IJavaValue leftOperand, + IJavaValue rightOperand) { + return ((IJavaPrimitiveValue) leftOperand).getDoubleValue() + % ((IJavaPrimitiveValue) rightOperand).getDoubleValue(); } /* * @see BinaryOperator#getFloatResult(IJavaValue, IJavaValue) */ - protected float getFloatResult(IJavaValue leftOperand, IJavaValue rightOperand) { - return ((IJavaPrimitiveValue) leftOperand).getFloatValue() % ((IJavaPrimitiveValue) rightOperand).getFloatValue(); + @Override + protected float getFloatResult(IJavaValue leftOperand, + IJavaValue rightOperand) { + return ((IJavaPrimitiveValue) leftOperand).getFloatValue() + % ((IJavaPrimitiveValue) rightOperand).getFloatValue(); } /* * @see BinaryOperator#getIntResult(IJavaValue, IJavaValue) */ - protected int getIntResult(IJavaValue leftOperand, IJavaValue rightOperand) throws CoreException { - int divisor= ((IJavaPrimitiveValue) rightOperand).getIntValue(); + @Override + protected int getIntResult(IJavaValue leftOperand, IJavaValue rightOperand) + throws CoreException { + int divisor = ((IJavaPrimitiveValue) rightOperand).getIntValue(); if (divisor == 0) { - throw new CoreException(new Status(IStatus.ERROR, JDIDebugPlugin.getUniqueIdentifier(), IStatus.OK, InstructionsEvaluationMessages.RemainderOperator_Divide_by_zero_1, null)); + throw new CoreException( + new Status( + IStatus.ERROR, + JDIDebugPlugin.getUniqueIdentifier(), + IStatus.OK, + InstructionsEvaluationMessages.RemainderOperator_Divide_by_zero_1, + null)); } return ((IJavaPrimitiveValue) leftOperand).getIntValue() % divisor; } @@ -61,10 +79,18 @@ public class RemainderOperator extends BinaryOperator { /* * @see BinaryOperator#getLongResult(IJavaValue, IJavaValue) */ - protected long getLongResult(IJavaValue leftOperand, IJavaValue rightOperand) throws CoreException { - long divisor= ((IJavaPrimitiveValue) rightOperand).getLongValue(); + @Override + protected long getLongResult(IJavaValue leftOperand, IJavaValue rightOperand) + throws CoreException { + long divisor = ((IJavaPrimitiveValue) rightOperand).getLongValue(); if (divisor == 0) { - throw new CoreException(new Status(IStatus.ERROR, JDIDebugPlugin.getUniqueIdentifier(), IStatus.OK, InstructionsEvaluationMessages.RemainderOperator_Divide_by_zero_2, null)); + throw new CoreException( + new Status( + IStatus.ERROR, + JDIDebugPlugin.getUniqueIdentifier(), + IStatus.OK, + InstructionsEvaluationMessages.RemainderOperator_Divide_by_zero_2, + null)); } return ((IJavaPrimitiveValue) leftOperand).getLongValue() % divisor; } @@ -72,12 +98,15 @@ public class RemainderOperator extends BinaryOperator { /* * @see BinaryOperator#getStringResult(IJavaValue, IJavaValue) */ - protected String getStringResult(IJavaValue leftOperand, IJavaValue rightOperand) { + @Override + protected String getStringResult(IJavaValue leftOperand, + IJavaValue rightOperand) { return null; } + @Override public String toString() { - return InstructionsEvaluationMessages.RemainderOperator______operator_3; + return InstructionsEvaluationMessages.RemainderOperator______operator_3; } } |