/** * This adds a new connective. */ @Override public void addNewConnective() { String factType = getExpressionLeftSide().getPreviousGenericType(); if ( factType == null ) { factType = getExpressionLeftSide().getGenericType(); } String fieldName = getExpressionLeftSide().getFieldName(); String fieldType = getExpressionLeftSide().getGenericType(); if ( this.getConnectives() == null ) { this.setConnectives( new ConnectiveConstraint[]{ new ConnectiveConstraint( factType, fieldName, fieldType ) } ); } else { final ConnectiveConstraint[] newList = new ConnectiveConstraint[ this.getConnectives().length + 1 ]; for ( int i = 0; i < this.getConnectives().length; i++ ) { newList[ i ] = this.getConnectives()[ i ]; } newList[ this.getConnectives().length ] = new ConnectiveConstraint( factType, fieldName, fieldType ); this.setConnectives( newList ); } }
private SingleFieldConstraintEBLeftSide visitSingleFieldConstraint(SingleFieldConstraintEBLeftSide sfexp) { SingleFieldConstraintEBLeftSide clone = new SingleFieldConstraintEBLeftSide(); clone.setConstraintValueType(sfexp.getConstraintValueType()); clone.setExpressionLeftSide((ExpressionFormLine) visit(sfexp.getExpressionLeftSide())); clone.setExpressionValue((ExpressionFormLine) visit(sfexp.getExpressionValue())); clone.setFactType(sfexp.getFactType()); // skip setting fieldBinding, fieldName and fieldType, these are computed from expressionLeftSide clone.setId(sfexp.getId()); clone.setOperator(sfexp.getOperator()); for (Map.Entry<String, String> entry : sfexp.getParameters().entrySet()) { clone.setParameter(entry.getKey(), entry.getValue()); } clone.setParent(sfexp.getParent()); clone.setValue(sfexp.getValue()); if (sfexp.getConnectives() != null) { clone.setConnectives(new ConnectiveConstraint[sfexp.getConnectives().length]); for (int i = 0; i < sfexp.getConnectives().length; i++) { clone.getConnectives()[i] = (ConnectiveConstraint) visit(sfexp.getConnectives()[i]); } } return clone; } }
private SingleFieldConstraintEBLeftSide visitSingleFieldConstraint(SingleFieldConstraintEBLeftSide sfexp) { SingleFieldConstraintEBLeftSide clone = new SingleFieldConstraintEBLeftSide(); clone.setConstraintValueType(sfexp.getConstraintValueType()); clone.setExpressionLeftSide((ExpressionFormLine) visit(sfexp.getExpressionLeftSide())); clone.setExpressionValue((ExpressionFormLine) visit(sfexp.getExpressionValue())); clone.setFactType(sfexp.getFactType()); // skip setting fieldBinding, fieldName and fieldType, these are computed from expressionLeftSide clone.setId(sfexp.getId()); clone.setOperator(sfexp.getOperator()); for (Map.Entry<String, String> entry : sfexp.getParameters().entrySet()) { clone.setParameter(entry.getKey(), entry.getValue()); } clone.setParent(sfexp.getParent()); clone.setValue(sfexp.getValue()); if (sfexp.getConnectives() != null) { clone.setConnectives(new ConnectiveConstraint[sfexp.getConnectives().length]); for (int i = 0; i < sfexp.getConnectives().length; i++) { clone.getConnectives()[i] = (ConnectiveConstraint) visit(sfexp.getConnectives()[i]); } } return clone; } }