private boolean isBoundVariableApplicable( String boundFactType, String boundFieldType ) { //Fields of the same type as the bound variable can be compared if ( boundFactType != null && boundFactType.equals( this.fieldType ) ) { return true; } //'this' can be compared to bound facts of the same type if ( this.fieldName.equals( DataType.TYPE_THIS ) ) { if ( boundFactType != null && boundFactType.equals( this.factType ) ) { return true; } } //For collection, present the list of possible bound variable String factCollectionType = sce.getParametricFieldType( this.factType, this.fieldName ); if ( boundFactType != null && factCollectionType != null && boundFactType.equals( factCollectionType ) ) { return true; } return isBoundVariableApplicable( boundFieldType ); }
private boolean isLHSFactTypeEquivalent( String boundVariable ) { String boundFactType = model.getLHSBoundFact( boundVariable ).getFactType(); String boundFieldType = model.getLHSBindingType( boundVariable ); //If the types are SuggestionCompletionEngine.TYPE_COMPARABLE check the enums are equivalent if ( boundFactType.equals( DataType.TYPE_COMPARABLE ) ) { if ( !this.fieldType.equals( DataType.TYPE_COMPARABLE ) ) { return false; } String[] dd = this.sce.getEnumValues( boundFactType, this.fieldName ); return isEnumEquivalent( dd ); } return isBoundVariableApplicable( boundFactType, boundFieldType ); }
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 ); }