private List<String> getApplicableBindingsInScope( List<String> bindingsInScope ) { List<String> applicableBindingsInScope = new ArrayList<String>(); //Examine LHS Fact and Field bindings and RHS (new) Fact bindings for ( String v : bindingsInScope ) { //LHS FactPattern FactPattern fp = model.getLHSBoundFact( v ); if ( fp != null ) { if ( isLHSFactTypeEquivalent( v ) ) { applicableBindingsInScope.add( v ); } } //LHS FieldConstraint FieldConstraint fc = model.getLHSBoundField( v ); if ( fc != null ) { if ( isLHSFieldTypeEquivalent( v ) ) { applicableBindingsInScope.add( v ); } } } return applicableBindingsInScope; }
private boolean isLHSFieldTypeEquivalent( String boundVariable ) { String boundFieldType = this.model.getLHSBindingType( boundVariable ); //If the fieldTypes are SuggestionCompletionEngine.TYPE_COMPARABLE check the enums are equivalent if ( boundFieldType.equals( DataType.TYPE_COMPARABLE ) ) { if ( !this.fieldType.equals( DataType.TYPE_COMPARABLE ) ) { return false; } FieldConstraint fc = this.model.getLHSBoundField( boundVariable ); if ( fc instanceof SingleFieldConstraint ) { String fieldName = ( (SingleFieldConstraint) fc ).getFieldName(); String parentFactTypeForBinding = this.model.getLHSParentFactPatternForBinding( boundVariable ).getFactType(); String[] dd = this.sce.getEnumValues( parentFactTypeForBinding, fieldName ); return isEnumEquivalent( dd ); } return false; } return isBoundVariableApplicable( boundFieldType ); }
private List<String> getApplicableBindings() { List<String> bindings = new ArrayList<String>(); //Examine LHS Fact and Field bindings and RHS (new) Fact bindings for ( String v : modeller.getModel().getAllVariables() ) { //LHS FactPattern FactPattern fp = modeller.getModel().getLHSBoundFact( v ); if ( fp != null ) { if ( isLHSFactTypeEquivalent( v ) ) { bindings.add( v ); } } //LHS FieldConstraint FieldConstraint fc = modeller.getModel().getLHSBoundField( v ); if ( fc != null ) { if ( isLHSFieldTypeEquivalent( v ) ) { bindings.add( v ); } } //RHS ActionInsertFact ActionInsertFact aif = modeller.getModel().getRHSBoundFact( v ); if ( aif != null ) { if ( isRHSFieldTypeEquivalent( v ) ) { bindings.add( v ); } } } return bindings; }
private boolean isLHSFieldTypeEquivalent( String boundVariable ) { String boundFieldType = modeller.getModel().getLHSBindingType( boundVariable ); //If the fieldTypes are SuggestionCompletionEngine.TYPE_COMPARABLE check the enums are equivalent if ( boundFieldType.equals( DataType.TYPE_COMPARABLE ) ) { if ( !this.variableType.equals( DataType.TYPE_COMPARABLE ) ) { return false; } FieldConstraint fc = this.modeller.getModel().getLHSBoundField( boundVariable ); if ( fc instanceof SingleFieldConstraint ) { String fieldName = ( (SingleFieldConstraint) fc ).getFieldName(); String parentFactTypeForBinding = this.modeller.getModel().getLHSParentFactPatternForBinding( boundVariable ).getFactType(); String[] dd = this.modeller.getSuggestionCompletions().getEnumValues( parentFactTypeForBinding, fieldName ); return isEnumEquivalent( dd ); } return false; } //If the fieldTypes are identical (and not SuggestionCompletionEngine.TYPE_COMPARABLE) then return true if ( boundFieldType.equals( this.variableType ) ) { return true; } return false; }
model.getLHSBoundField( "a" ) );