final BRLConditionVariableColumn variableColumn = column.getChildColumns().get( 0 ); final int index = allColumns.indexOf( variableColumn ); final DTCellValue52 dcv = row.get( index ); if ( dcv != null && dcv.getBooleanValue() ) { for ( IPattern pattern : column.getDefinition() ) { patterns.add( pattern ); for ( IPattern pattern : column.getDefinition() ) {
/** * Check is the model uses DSLSentences and hence requires expansion * * @return true if any BRLColumn's contain DSLSentence's */ public boolean hasDSLSentences() { for ( CompositeColumn< ? extends BaseColumn> column : this.conditionPatterns ) { if ( column instanceof BRLConditionColumn ) { BRLConditionColumn brlColumn = (BRLConditionColumn) column; for ( IPattern pattern : brlColumn.getDefinition() ) { if ( pattern instanceof DSLSentence ) { return true; } } } } for ( ActionCol52 column : this.actionCols ) { if ( column instanceof BRLActionColumn ) { BRLActionColumn brlColumn = (BRLActionColumn) column; for ( IAction action : brlColumn.getDefinition() ) { if ( action instanceof DSLSentence ) { return true; } } } } return false; }
BRLConditionColumn brl1 = new BRLConditionColumn(); brl1.setDefinition( brl1Definition ); brl1.getChildColumns().add( brl1Variable1 );
dt.getConditions().add( p1 ); BRLConditionColumn brlCondition = new BRLConditionColumn(); FactPattern fp = new FactPattern( "Driver" ); fp.setBoundName( "$brl1" ); brlCondition.getDefinition().add( fp ); dt.getConditions().add( brlCondition );
public BRLConditionColumn getBRLColumn(BRLConditionVariableColumn col) { for ( CompositeColumn< ? > cc : conditionPatterns ) { if ( cc instanceof BRLConditionColumn ) { BRLConditionColumn brl = (BRLConditionColumn) cc; if ( brl.getChildColumns().contains( col ) ) { return brl; } } } throw new IllegalStateException( "col is not a child of any of the defined BRLColumns." ); }
/** * Check is the model uses DSLSentences and hence requires expansion * * @return true if any BRLColumn's contain DSLSentence's */ public boolean hasDSLSentences() { for ( CompositeColumn< ? extends BaseColumn> column : this.conditionPatterns ) { if ( column instanceof BRLConditionColumn ) { BRLConditionColumn brlColumn = (BRLConditionColumn) column; for ( IPattern pattern : brlColumn.getDefinition() ) { if ( pattern instanceof DSLSentence ) { return true; } } } } for ( ActionCol52 column : this.actionCols ) { if ( column instanceof BRLActionColumn ) { BRLActionColumn brlColumn = (BRLActionColumn) column; for ( IAction action : brlColumn.getDefinition() ) { if ( action instanceof DSLSentence ) { return true; } } } } return false; }
BRLConditionColumn brl1 = new BRLConditionColumn(); brl1.setDefinition( brl1Definition ); "Person", "name" ); brl1.getChildColumns().add( brl1Variable1 ); BRLConditionVariableColumn brl1Variable2 = new BRLConditionVariableColumn( "$age", SuggestionCompletionEngine.TYPE_NUMERIC_INTEGER, "Person", "age" ); brl1.getChildColumns().add( brl1Variable2 );
dt.getConditions().add( p1 ); BRLConditionColumn brlCondition = new BRLConditionColumn(); FactPattern fp = new FactPattern( "Driver" ); fp.setBoundName( "$brl1" ); brlCondition.getDefinition().add( fp ); dt.getConditions().add( brlCondition );
public BRLConditionColumn getBRLColumn(BRLConditionVariableColumn col) { for ( CompositeColumn< ? > cc : conditionPatterns ) { if ( cc instanceof BRLConditionColumn ) { BRLConditionColumn brl = (BRLConditionColumn) cc; if ( brl.getChildColumns().contains( col ) ) { return brl; } } } throw new IllegalStateException( "col is not a child of any of the defined BRLColumns." ); }
private boolean hasVariables(BRLConditionColumn column) { Map<InterpolationVariable, Integer> ivs = new HashMap<InterpolationVariable, Integer>(); RuleModel rm = new RuleModel(); for ( IPattern pattern : column.getDefinition() ) { rm.addLhsItem( pattern ); } RuleModelVisitor rmv = new RuleModelVisitor( ivs ); rmv.visit( rm ); return ivs.size() > 0; }
BRLConditionColumn brl1 = new BRLConditionColumn(); brl1.setDefinition( brl1Definition ); "Person", "name" ); brl1.getChildColumns().add( brl1Variable1 ); BRLConditionVariableColumn brl1Variable2 = new BRLConditionVariableColumn( "$age", SuggestionCompletionEngine.TYPE_NUMERIC_INTEGER, "Person", "age" ); brl1.getChildColumns().add( brl1Variable2 );
final BRLConditionVariableColumn variableColumn = column.getChildColumns().get( 0 ); final int index = allColumns.indexOf( variableColumn ); final DTCellValue52 dcv = row.get( index ); if ( dcv != null && dcv.getBooleanValue() ) { for ( IPattern pattern : column.getDefinition() ) { patterns.add( pattern ); for ( IPattern pattern : column.getDefinition() ) {
dt.getConditions().add( p1 ); BRLConditionColumn brlCondition = new BRLConditionColumn(); FactPattern fp = new FactPattern( "Driver" ); fp.setBoundName( "$brl1" ); brlCondition.getDefinition().add( fp ); dt.getConditions().add( brlCondition );
public BRLColumn< ? , ? > getBRLColumn(BRLVariableColumn col) { for ( CompositeColumn< ? > cc : conditionPatterns ) { if ( cc instanceof BRLConditionColumn ) { BRLConditionColumn brl = (BRLConditionColumn) cc; if ( brl.getChildColumns().contains( col ) ) { return brl; } } } for ( ActionCol52 ac : actionCols ) { if ( ac instanceof BRLActionColumn ) { BRLActionColumn brl = (BRLActionColumn) ac; if ( brl.getChildColumns().contains( col ) ) { return brl; } } } throw new IllegalStateException( "col is not a child of any of the defined BRLColumns." ); }
private boolean hasVariables(BRLConditionColumn column) { Map<InterpolationVariable, Integer> ivs = new HashMap<InterpolationVariable, Integer>(); RuleModel rm = new RuleModel(); for ( IPattern pattern : column.getDefinition() ) { rm.addLhsItem( pattern ); } RuleModelVisitor rmv = new RuleModelVisitor( ivs ); rmv.visit( rm ); return ivs.size() > 0; }
BRLConditionColumn brl1 = new BRLConditionColumn(); brl1.setDefinition( brl1Definition ); "Person", "name" ); brl1.getChildColumns().add( brl1Variable1 ); BRLConditionVariableColumn brl1Variable2 = new BRLConditionVariableColumn( "$age", SuggestionCompletionEngine.TYPE_NUMERIC_INTEGER, "Person", "age" ); brl1.getChildColumns().add( brl1Variable2 );
dt.getConditions().add( p1 ); BRLConditionColumn brlCondition = new BRLConditionColumn(); FactPattern fp1 = new FactPattern( "Driver" ); fp1.setBoundName( "$brl1" ); brlCondition.getDefinition().add( fp1 ); dt.getConditions().add( brlCondition );
public BRLColumn< ? , ? > getBRLColumn(BRLVariableColumn col) { for ( CompositeColumn< ? > cc : conditionPatterns ) { if ( cc instanceof BRLConditionColumn ) { BRLConditionColumn brl = (BRLConditionColumn) cc; if ( brl.getChildColumns().contains( col ) ) { return brl; } } } for ( ActionCol52 ac : actionCols ) { if ( ac instanceof BRLActionColumn ) { BRLActionColumn brl = (BRLActionColumn) ac; if ( brl.getChildColumns().contains( col ) ) { return brl; } } } throw new IllegalStateException( "col is not a child of any of the defined BRLColumns." ); }
@Override public List<String> getBoundVariablesInScope(BaseSingleFieldConstraint con) { Set<String> variables = new HashSet<String>(); for ( CompositeColumn< ? extends BaseColumn> col : dtable.getConditions() ) { if ( col instanceof Pattern52 ) { Pattern52 p = (Pattern52) col; if ( p.isBound() ) { variables.add( p.getBoundName() ); } for ( ConditionCol52 cc : p.getChildColumns() ) { if ( cc.isBound() ) { variables.add( cc.getBinding() ); } } } else if ( col instanceof BRLConditionColumn ) { //Delegate to super class's implementation RuleModel rm = new RuleModel(); BRLConditionColumn brl = (BRLConditionColumn) col; rm.lhs = brl.getDefinition().toArray( new IPattern[brl.getDefinition().size()] ); variables.addAll( rm.getBoundVariablesInScope( con ) ); } } variables.addAll( super.getBoundVariablesInScope( con ) ); return new ArrayList<String>( variables ); }
@Override public List<String> getBoundVariablesInScope(BaseSingleFieldConstraint con) { Set<String> variables = new HashSet<String>(); for ( CompositeColumn< ? extends BaseColumn> col : dtable.getConditions() ) { if ( col instanceof Pattern52 ) { Pattern52 p = (Pattern52) col; if ( p.isBound() ) { variables.add( p.getBoundName() ); } for ( ConditionCol52 cc : p.getChildColumns() ) { if ( cc.isBound() ) { variables.add( cc.getBinding() ); } } } else if ( col instanceof BRLConditionColumn ) { //Delegate to super class's implementation RuleModel rm = new RuleModel(); BRLConditionColumn brl = (BRLConditionColumn) col; rm.lhs = brl.getDefinition().toArray( new IPattern[brl.getDefinition().size()] ); variables.addAll( rm.getBoundVariablesInScope( con ) ); } } variables.addAll( super.getBoundVariablesInScope( con ) ); return new ArrayList<String>( variables ); }