KickJava   Java API By Example, From Geeks To Geeks.

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


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
17 public class OrOperator extends BinaryOperator {
18     public OrOperator(int resultId, int leftTypeId, int rightTypeId, int start) {
19         this(resultId, leftTypeId, rightTypeId, false, start);
20     }
21
22     protected OrOperator(int resultId, int leftTypeId, int rightTypeId, boolean isAssignmentOperator, int start) {
23         super(resultId, leftTypeId, rightTypeId, isAssignmentOperator, start);
24     }
25
26     /*
27      * @see BinaryOperator#getBooleanResult(IJavaValue, IJavaValue)
28      */

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

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

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

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

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

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