svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.expressionevaluator / org.gvsig.expressionevaluator.lib / org.gvsig.expressionevaluator.lib.impl / src / main / java / org / gvsig / expressionevaluator / impl / function / operator / OrOperator.java @ 44198
History | View | Annotate | Download (835 Bytes)
1 | 43512 | jjdelcerro | package org.gvsig.expressionevaluator.impl.function.operator; |
---|---|---|---|
2 | |||
3 | 43521 | jjdelcerro | import org.gvsig.expressionevaluator.Function; |
4 | import org.gvsig.expressionevaluator.Interpreter; |
||
5 | |||
6 | 43512 | jjdelcerro | public class OrOperator extends AbstractBinaryOperator { |
7 | |||
8 | 44139 | jjdelcerro | public static final String NAME = "OR"; |
9 | |||
10 | 43512 | jjdelcerro | public OrOperator() {
|
11 | 44139 | jjdelcerro | super(Function.GROUP_BOOLEAN,NAME);
|
12 | // this.addAlias("||");
|
||
13 | 43512 | jjdelcerro | } |
14 | |||
15 | @Override
|
||
16 | 44009 | jjdelcerro | public boolean allowConstantFolding() { |
17 | return true; |
||
18 | } |
||
19 | |||
20 | @Override
|
||
21 | 43521 | jjdelcerro | public Object call(Interpreter interpreter, Object op1, Object op2) { |
22 | 43512 | jjdelcerro | if( op1 instanceof Boolean && op2 instanceof Boolean ) { |
23 | boolean value = ((Boolean) op1) || ((Boolean) op2); |
||
24 | return value;
|
||
25 | } |
||
26 | throw new IllegalArgumentException("Types not allowed in '"+name()+"' operand."); |
||
27 | } |
||
28 | |||
29 | |||
30 | } |