blob: 5145e8b08de4ee2c5b7b9dcf17724622a53707e2 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2000, 2011 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
import org.eclipse.jdt.debug.core.IJavaValue;
public class MultiplyOperator extends BinaryOperator {
public MultiplyOperator(int resultId, int leftTypeId, int rightTypeId,
int start) {
this(resultId, leftTypeId, rightTypeId, false, start);
}
protected MultiplyOperator(int resultId, int leftTypeId, int rightTypeId,
boolean isAssignmentOperator, int start) {
super(resultId, leftTypeId, rightTypeId, isAssignmentOperator, start);
}
/*
* @see BinaryOperator#getBooleanResult(IJavaValue, IJavaValue)
*/
@Override
protected boolean getBooleanResult(IJavaValue leftOperand,
IJavaValue rightOperand) {
return false;
}
/*
* @see BinaryOperator#getDoubleResult(IJavaValue, IJavaValue)
*/
@Override
protected double getDoubleResult(IJavaValue leftOperand,
IJavaValue rightOperand) {
return ((IJavaPrimitiveValue) leftOperand).getDoubleValue()
* ((IJavaPrimitiveValue) rightOperand).getDoubleValue();
}
/*
* @see BinaryOperator#getFloatResult(IJavaValue, IJavaValue)
*/
@Override
protected float getFloatResult(IJavaValue leftOperand,
IJavaValue rightOperand) {
return ((IJavaPrimitiveValue) leftOperand).getFloatValue()
* ((IJavaPrimitiveValue) rightOperand).getFloatValue();
}
/*
* @see BinaryOperator#getIntResult(IJavaValue, IJavaValue)
*/
@Override
protected int getIntResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return ((IJavaPrimitiveValue) leftOperand).getIntValue()
* ((IJavaPrimitiveValue) rightOperand).getIntValue();
}
/*
* @see BinaryOperator#getLongResult(IJavaValue, IJavaValue)
*/
@Override
protected long getLongResult(IJavaValue leftOperand, IJavaValue rightOperand) {
return ((IJavaPrimitiveValue) leftOperand).getLongValue()
* ((IJavaPrimitiveValue) rightOperand).getLongValue();
}
/*
* @see BinaryOperator#getStringResult(IJavaValue, IJavaValue)
*/
@Override
protected String getStringResult(IJavaValue leftOperand,
IJavaValue rightOperand) {
return null;
}
@Override
public String toString() {
return InstructionsEvaluationMessages.MultiplyOperator______operator_1;
}
}