public ExpressionItem toExpressionItem() throws IllegalStateException {
ArchetypeElementVO archetypeElementVO = getArchetypeElementRuleLineElement().getArchetypeElementVO();
if (archetypeElementVO != null) {
String gtCode =
getArchetypeElementRuleLineElement().getValue().getValue();
if (getSecondArchetypeElementRuleLineElement().getValue() == null) {
throw new IllegalStateException("No expression set");
}
String secondGtCode =
getSecondArchetypeElementRuleLineElement().getValue().getValue();
OperatorKind operatorKind =
getComparisonOperatorRuleLineElement().getValue();
if (operatorKind == null) {
throw new IllegalStateException("No operator kind set");
}
String name = getArchetypeManager().getArchetypeElements().getText(archetypeElementVO, getLanguage());
return new BinaryExpression(
new Variable(gtCode, null, name),
new Variable(secondGtCode),
operatorKind);
} else {
throw new IllegalStateException("Invalid rule line: " + getArchetypeElementRuleLineElement());
}
}
}