diff options
author | 2021-08-03 18:42:39 +0900 | |
---|---|---|
committer | 2021-08-06 19:32:38 +0900 | |
commit | be4f78978faba3d3ceb88df02a7f93a2e09ff1e0 (patch) | |
tree | 1f3f1a96251ac4f655c8a96fc33d5d4ee779cd06 /rba.model.core/src/rba/core/generator/util/value/EqualToOperatorEvaluator.java | |
parent | 71ca7c6cab863767ef30c8bd05b2bbfda8731cb5 (diff) |
Initial commit
Bug-AGL: SPEC-4033
Signed-off-by: Kenji Hosokawa <khosokawa@jp.adit-jv.com>
Diffstat (limited to 'rba.model.core/src/rba/core/generator/util/value/EqualToOperatorEvaluator.java')
-rw-r--r-- | rba.model.core/src/rba/core/generator/util/value/EqualToOperatorEvaluator.java | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/rba.model.core/src/rba/core/generator/util/value/EqualToOperatorEvaluator.java b/rba.model.core/src/rba/core/generator/util/value/EqualToOperatorEvaluator.java new file mode 100644 index 0000000..bb20773 --- /dev/null +++ b/rba.model.core/src/rba/core/generator/util/value/EqualToOperatorEvaluator.java @@ -0,0 +1,51 @@ +package rba.core.generator.util.value; + +import org.eclipse.emf.common.util.EList; + +import rba.core.ComparisonOperator; +import rba.core.EqualToOperator; +import rba.core.Expression; +import rba.core.LetStatement; +import rba.core.ObjectReference; +import rba.core.RuleObject; +import rba.core.ThatOfOperator; +import rba.core.ValueExpression; + +public class EqualToOperatorEvaluator<T extends RuleObject> extends ComparisonOperatorEvaluator<T> implements EqualToOperator { + + protected EqualToOperatorEvaluator(ComparisonOperator o) { + super(o); + } + + @Override + public boolean evaluate(ValueSortedList<T> list) { + // TODO Auto-generated method stub + return false; + } + + @Override + public int suggestIndex(ValueSortedList<T> list) { + Expression operand = operator.getOperand().get(0); + if (operand instanceof ThatOfOperator) { + Expression target = ((ThatOfOperator) operand).getOperand().get(0); + + if (target instanceof ObjectReference) { + T object = (T) ((ObjectReference) target).getRefObject(); + return list.getGroupIndexOf(object); + } + + } else if (operand instanceof ValueExpression) { + int i = list.getGroupIndexOf(((ValueExpression) operand).getExpression()); + return i; + } + + throw new RuntimeException("Unsupported expression [" + operator.getExpression() + "]"); + } + + @Override + public EList<LetStatement> getLetStatements() { + // TODO Auto-generated method stub + return null; + } + +} |