KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > eval > ast > instructions > XorOperator


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.debug.eval.ast.instructions;
12
13 import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
14 import org.eclipse.jdt.debug.core.IJavaValue;
15
16 public class XorOperator extends BinaryOperator {
17     public XorOperator(int resultId, int leftTypeId, int rightTypeId, int start) {
18         this(resultId, leftTypeId, rightTypeId, false, start);
19     }
20
21     public XorOperator(int resultId, int leftTypeId, int rightTypeId, boolean isAssignmentOperator, int start) {
22         super(resultId, leftTypeId, rightTypeId, isAssignmentOperator, start);
23     }
24
25     /*
26      * @see BinaryOperator#getBooleanResult(IJavaValue, IJavaValue)
27      */

28     protected boolean getBooleanResult(IJavaValue leftOperand, IJavaValue rightOperand) {
29         return ((IJavaPrimitiveValue) leftOperand).getBooleanValue() ^ ((IJavaPrimitiveValue) rightOperand).getBooleanValue();
30     }
31
32     /*
33      * @see BinaryOperator#getDoubleResult(IJavaValue, IJavaValue)
34      */

35     protected double getDoubleResult(IJavaValue leftOperand, IJavaValue rightOperand) {
36         return 0;
37     }
38
39     /*
40      * @see BinaryOperator#getFloatResult(IJavaValue, IJavaValue)
41      */

42     protected float getFloatResult(IJavaValue leftOperand, IJavaValue rightOperand) {
43         return 0;
44     }
45
46     /*
47      * @see BinaryOperator#getIntResult(IJavaValue, IJavaValue)
48      */

49     protected int getIntResult(IJavaValue leftOperand, IJavaValue rightOperand) {
50         return ((IJavaPrimitiveValue) leftOperand).getIntValue() ^ ((IJavaPrimitiveValue) rightOperand).getIntValue();
51     }
52
53     /*
54      * @see BinaryOperator#getLongResult(IJavaValue, IJavaValue)
55      */

56     protected long getLongResult(IJavaValue leftOperand, IJavaValue rightOperand) {
57         return ((IJavaPrimitiveValue) leftOperand).getLongValue() ^ ((IJavaPrimitiveValue) rightOperand).getLongValue();
58     }
59
60     /*
61      * @see BinaryOperator#getStringResult(IJavaValue, IJavaValue)
62      */

63     protected String JavaDoc getStringResult(IJavaValue leftOperand, IJavaValue rightOperand) {
64         return null;
65     }
66
67     public String JavaDoc toString() {
68         return InstructionsEvaluationMessages.XorOperator______operator_1;
69     }
70
71 }
72
Popular Tags