/** * Creates a new complete constructor {@code AFieldNumberExp} node with the given nodes as children. * @deprecated This method should not be used, use AstFactory instead. * The basic child nodes are removed from their previous parents. * @param tuple_ the {@link PExp} node for the {@code tuple} child of this {@link AFieldNumberExp} node * @param field_ the {@link ILexIntegerToken} node for the {@code field} child of this {@link AFieldNumberExp} node */ public AFieldNumberExp(PType type_, ILexLocation location_, PExp tuple_, ILexIntegerToken field_) { super(type_,location_); this.setTuple(tuple_); this.setField(field_); }
/** * Creates a new tree field only constructor {@code AFieldNumberExp TAG=fieldNumber} node with the given nodes as children. * @deprecated This method should not be used, use AstFactory instead. * The basic child nodes are removed from their previous parents. * @param tuple_ the {@link PExp} node for the {@code tuple} child of this {@link AFieldNumberExp} node * @param field_ the {@link ILexIntegerToken} node for the {@code field} child of this {@link AFieldNumberExp} node */ public AFieldNumberExp(ILexLocation location_, PExp tuple_, ILexIntegerToken field_) { super(null,location_); this.setTuple(tuple_); this.setField(field_); }
public static PExp newAFieldNumberExp(PExp tuple, LexIntegerToken field) { AFieldNumberExp result = new AFieldNumberExp(); result.setLocation(tuple.getLocation()); result.setTuple(tuple); result.setField(field); result.getField().getLocation().executable(true); return result; }
private PExp buildStructuralLessThan(PExp left_exp, PExp right_exp, int tupleCounter, int recCounter) { // left.i AFieldNumberExp leftField_exp = new AFieldNumberExp(); leftField_exp.setTuple(left_exp.clone()); leftField_exp.setField(new LexIntegerToken(tupleCounter, null)); // right.i AFieldNumberExp rightField_exp = new AFieldNumberExp(); rightField_exp.setTuple(right_exp.clone()); rightField_exp.setField(new LexIntegerToken(tupleCounter, null)); if (recCounter == 1) { // last one. don't chain further ifs return AstExpressionFactory.newAGreaterNumericBinaryExp(leftField_exp, rightField_exp); } // left.i <> right.i ANotEqualBinaryExp notEquals_exp = AstExpressionFactory.newANotEqualBinaryExp(leftField_exp, rightField_exp); // if left.i <>right.i then left.i , right.i else [recurse] AGreaterNumericBinaryExp gt_exp = AstExpressionFactory.newAGreaterNumericBinaryExp(leftField_exp.clone(), rightField_exp.clone()); AIfExp if_exp = new AIfExp(); if_exp.setTest(notEquals_exp); if_exp.setThen(gt_exp); if_exp.setElse(buildStructuralLessThan(left_exp.clone(), right_exp.clone(), tupleCounter + 1, recCounter - 1)); return if_exp; }