private void addConditionColumns() { for ( Pattern52 p : model.getPatterns() ) { addColumn( p ); } }
@Override public void prepareView() { //Setup the available patterns, that could have changed each time this page is visited view.setAvailablePatterns( this.model.getPatterns() ); }
@Override public void prepareView() { //Setup the available patterns, that could have changed each time this page is visited view.setAvailablePatterns( model.getPatterns() ); }
private String getFactType( String boundName ) { for ( Pattern52 p : model.getPatterns() ) { if ( p.getBoundName().equals( boundName ) ) { return p.getFactType(); } } return ""; }
private ListBox loadBoundFacts() { Set<String> facts = new HashSet<String>(); for ( Pattern52 p : model.getPatterns() ) { if ( !p.isNegated() ) { facts.add( p.getBoundName() ); } } ListBox box = new ListBox(); for ( Iterator<String> iterator = facts.iterator(); iterator.hasNext(); ) { String b = (String) iterator.next(); box.addItem( b ); } String[] globs = this.oracle.getGlobalVariables(); for ( int i = 0; i < globs.length; i++ ) { box.addItem( globs[ i ] ); } return box; }
private boolean isBindingUnique( String binding ) { for ( Pattern52 p : model.getPatterns() ) { if ( p.getBoundName().equals( binding ) ) { return false; } for ( ConditionCol52 c : p.getChildColumns() ) { if ( c.isBound() ) { if ( c.getBinding().equals( binding ) ) { return false; } } } } return true; }
public Set<String> getBindings( String className ) { //For some reason, Fact Pattern data-types use the leaf name of the fully qualified Class Name //whereas Fields use the fully qualified Class Name. We don't use the generic fieldType (see //SuggestionCompletionEngine.TYPE) as we can't distinguish between different numeric types String simpleClassName = className; if ( simpleClassName != null && simpleClassName.lastIndexOf( "." ) > 0 ) { simpleClassName = simpleClassName.substring( simpleClassName.lastIndexOf( "." ) + 1 ); } Set<String> bindings = new HashSet<String>(); for ( Pattern52 p : this.model.getPatterns() ) { if ( className == null || p.getFactType().equals( simpleClassName ) ) { String binding = p.getBoundName(); if ( !( binding == null || "".equals( binding ) ) ) { bindings.add( binding ); } } for ( ConditionCol52 c : p.getChildColumns() ) { if ( c.isBound() ) { String fieldDataType = oracle.getFieldClassName( p.getFactType(), c.getFactField() ); if ( fieldDataType.equals( className ) ) { bindings.add( c.getBinding() ); } } } } return bindings; }
@Override public boolean isComplete() { //Have all patterns conditions been defined? boolean areConditionsDefined = true; for ( Pattern52 p : model.getPatterns() ) { for ( ConditionCol52 c : p.getChildColumns() ) { if ( !getValidator().isConditionValid( c ) ) { areConditionsDefined = false; break; } } } //Signal Condition definitions to other pages final ConditionsDefinedEvent event = new ConditionsDefinedEvent( areConditionsDefined ); conditionsDefinedEvent.fire( event ); return areConditionsDefined; }
private List<ConditionCol52> findAvailableColumnsToExpand() { final List<ConditionCol52> availableColumns = new ArrayList<ConditionCol52>(); for ( CompositeColumn<?> cc : model.getPatterns() ) { if ( cc instanceof Pattern52 ) { final Pattern52 p = (Pattern52) cc; for ( ConditionCol52 c : p.getChildColumns() ) { switch ( model.getTableFormat() ) { case EXTENDED_ENTRY: if ( modelUtils.hasValueList( c ) ) { final String[] values = modelUtils.getValueList( c ); if ( values != null && values.length > 1 ) { availableColumns.add( c ); } } else if ( oracle.hasEnums( p.getFactType(), c.getFactField() ) ) { availableColumns.add( c ); } break; case LIMITED_ENTRY: availableColumns.add( c ); } } } } return availableColumns; }
private ListBox loadPatterns() { Set<String> vars = new HashSet<String>(); ListBox patterns = new ListBox(); for ( Pattern52 p : model.getPatterns() ) { if ( !vars.contains( p.getBoundName() ) ) { patterns.addItem( ( p.isNegated() ? Constants.INSTANCE.negatedPattern() + " " : "" ) + p.getFactType() + " [" + p.getBoundName() + "]", p.getFactType() + " " + p.getBoundName() + " " + p.isNegated() ); vars.add( p.getBoundName() ); } } return patterns; }
@Override public void makeResult( final GuidedDecisionTable52 model ) { //Ensure every Pattern is bound int fi = 1; for ( Pattern52 p : model.getPatterns() ) { if ( !getValidator().isPatternValid( p ) ) { String binding = NEW_FACT_PREFIX + ( fi++ ); p.setBoundName( binding ); while ( !getValidator().isPatternBindingUnique( p ) ) { binding = NEW_FACT_PREFIX + ( fi++ ); p.setBoundName( binding ); } } } }
final Integer rowNumber = ( (Integer) row.get( 0 ).getNumericValue() ) - 1; RowDetector rowDetector = new RowDetector( rowNumber ); for ( Pattern52 pattern : model.getPatterns() ) { for ( ConditionCol52 conditionCol : pattern.getChildColumns() ) { int columnIndex = model.getExpandedColumns().indexOf( conditionCol );