@Override public String getLHSBindingType(String var) { return model.getLHSBindingType(var); }
@Override public String getLHSBindingType(String var) { return model.getLHSBindingType(var); }
/** * Get the data-type associated with the binding * * @param var * @return The data-type, or null if the binding could not be found */ public String getLHSBindingType(final String var) { if (this.lhs == null) { return null; } for (int i = 0; i < this.lhs.length; i++) { String type = getLHSBindingType(this.lhs[i], var); if (type != null) { return type; } } return null; }
private Optional<String> getType(final RuleModel ruleModel, final ActionFieldList actionFieldList) { if (actionFieldList instanceof ActionInsertFact) { return Optional.of(((ActionInsertFact) actionFieldList).getFactType()); } else if (actionFieldList instanceof ActionSetField) { final String var = ((ActionSetField) actionFieldList).getVariable(); return Optional.ofNullable(ruleModel.getLHSBindingType(var)); } return Optional.empty(); } }
private Optional<String> getType(final RuleModel ruleModel, final ActionFieldList actionFieldList) { if (actionFieldList instanceof ActionInsertFact) { return Optional.of(((ActionInsertFact) actionFieldList).getFactType()); } else if (actionFieldList instanceof ActionSetField) { final String var = ((ActionSetField) actionFieldList).getVariable(); return Optional.ofNullable(ruleModel.getLHSBindingType(var)); } return Optional.empty(); } }
private void getLHSFacTypes() { for (String variable : model.getModel().getAllLHSVariables()) { factTypesByVariables.put(variable, model.getModel().getLHSBindingType(variable)); } }
private void getLHSFacTypes() { for (String variable : model.getModel().getAllLHSVariables()) { factTypesByVariables.put(variable, model.getModel().getLHSBindingType(variable)); } }
private void visitActionFieldList(ActionSetField afl) { String factType = model.getLHSBindingType(afl.getVariable()); for (ActionFieldValue afv : afl.getFieldValues()) { InterpolationVariable var = new InterpolationVariable(afv.getValue(), afv.getType(), factType, afv.getField()); if (afv.getNature() == FieldNatureType.TYPE_TEMPLATE && !vars.containsKey(var)) { vars.put(var, vars.size()); } } }
private void visitActionFieldList(ActionUpdateField afl) { String factType = model.getLHSBindingType(afl.getVariable()); for (ActionFieldValue afv : afl.getFieldValues()) { InterpolationVariable var = new InterpolationVariable(afv.getValue(), afv.getType(), factType, afv.getField()); if (afv.getNature() == FieldNatureType.TYPE_TEMPLATE && !vars.containsKey(var)) { vars.put(var, vars.size()); } } }
private void visitActionFieldList(final ActionUpdateField afl) { String factType = model.getLHSBindingType(afl.getVariable()); for (ActionFieldValue afv : afl.getFieldValues()) { InterpolationVariable var = new InterpolationVariable(afv.getValue(), afv.getType(), factType, afv.getField()); if (afv.getNature() == FieldNatureType.TYPE_TEMPLATE && !vars.contains(var)) { vars.add(var); } else { hasNonTemplateOutput = true; } } }
private String getFactType(String variable) { if (modeller.getModel().getRHSBoundFacts().contains(variable) == false) { return modeller.getModel().getLHSBindingType(variable); } else { return modeller.getModel().getRHSBoundFact(variable).getFactType(); } }
private void visitActionFieldList(final ActionSetField afl) { String factType = model.getLHSBindingType(afl.getVariable()); for (ActionFieldValue afv : afl.getFieldValues()) { InterpolationVariable var = new InterpolationVariable(afv.getValue(), afv.getType(), factType, afv.getField()); if (afv.getNature() == FieldNatureType.TYPE_TEMPLATE && !vars.contains(var)) { vars.add(var); } else { hasNonTemplateOutput = true; } } }
private String getFactType(String variable) { if (modeller.getModel().getRHSBoundFacts().contains(variable) == false) { return modeller.getModel().getLHSBindingType(variable); } else { return modeller.getModel().getRHSBoundFact(variable).getFactType(); } }
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; } SingleFieldConstraint fc = this.modeller.getModel().getLHSBoundField(boundVariable); String fieldName = fc.getFieldName(); String parentFactTypeForBinding = this.modeller.getModel().getLHSParentFactPatternForBinding(boundVariable).getFactType(); String[] dd = this.modeller.getDataModelOracle().getEnumValues(parentFactTypeForBinding, fieldName); return isEnumEquivalent(dd); } //If the fieldTypes are identical (and not SuggestionCompletionEngine.TYPE_COMPARABLE) then return true if (boundFieldType.equals(this.variableType)) { return true; } return false; }
private void isLHSFieldTypeEquivalent(final String boundVariable, final Callback<Boolean> callback) { String boundFieldType = this.model.getLHSBindingType(boundVariable); //If the fieldTypes are SuggestionCompletionEngine.TYPE_COMPARABLE check the enums are equivalent if (Objects.equals(boundFieldType, DataType.TYPE_COMPARABLE)) { if (!Objects.equals(fieldType, DataType.TYPE_COMPARABLE)) { callback.callback(false); return; } SingleFieldConstraint fc = this.model.getLHSBoundField(boundVariable); String fieldName = fc.getFieldName(); String parentFactTypeForBinding = this.model.getLHSParentFactPatternForBinding(boundVariable).getFactType(); String[] dd = this.oracle.getEnumValues(parentFactTypeForBinding, fieldName); callback.callback(isEnumEquivalent(dd, dropDownData)); return; } isBoundVariableApplicableByFieldType(boundFieldType, callback); }
private void isLHSFieldTypeEquivalent(final String boundVariable, final Callback<Boolean> callback) { String boundFieldType = this.model.getLHSBindingType(boundVariable); //If the fieldTypes are SuggestionCompletionEngine.TYPE_COMPARABLE check the enums are equivalent if (Objects.equals(boundFieldType, DataType.TYPE_COMPARABLE)) { if (!Objects.equals(fieldType, DataType.TYPE_COMPARABLE)) { callback.callback(false); return; } SingleFieldConstraint fc = this.model.getLHSBoundField(boundVariable); String fieldName = fc.getFieldName(); String parentFactTypeForBinding = this.model.getLHSParentFactPatternForBinding(boundVariable).getFactType(); String[] dd = this.oracle.getEnumValues(parentFactTypeForBinding, fieldName); callback.callback(isEnumEquivalent(dd, dropDownData)); return; } isBoundVariableApplicableByFieldType(boundFieldType, callback); }
private Widget getSetterLabel() { ClickHandler clk = new ClickHandler() { public void onClick(ClickEvent event) { //Widget w = (Widget)event.getSource(); showAddFieldPopup(event); } }; String modifyType = "set"; if (this.model instanceof ActionUpdateField) { modifyType = "modify"; } String type = this.getModeller().getModel().getLHSBindingType(model.getVariable()); String descFact = (type != null) ? type + " <b>[" + model.getVariable() + "]</b>" : model.getVariable(); String sl = GuidedRuleEditorResources.CONSTANTS.setterLabel(HumanReadable.getActionDisplayName(modifyType), descFact); return new ClickableLabel(sl, clk, !this.readOnly);//HumanReadable.getActionDisplayName(modifyType) + " value of <b>[" + model.variable + "]</b>", clk); }
private Widget getSetterLabel() { ClickHandler clk = new ClickHandler() { public void onClick(ClickEvent event) { //Widget w = (Widget)event.getSource(); showAddFieldPopup(event); } }; String modifyType = "set"; if (this.model instanceof ActionUpdateField) { modifyType = "modify"; } String type = this.getModeller().getModel().getLHSBindingType(model.getVariable()); String descFact = (type != null) ? type + " <b>[" + model.getVariable() + "]</b>" : model.getVariable(); String sl = GuidedRuleEditorResources.CONSTANTS.setterLabel(HumanReadable.getActionDisplayName(modifyType), descFact); return new ClickableLabel(sl, clk, !this.readOnly);//HumanReadable.getActionDisplayName(modifyType) + " value of <b>[" + model.variable + "]</b>", clk); }
private String getVariableType() { String type; if (oracle.isGlobalVariable(this.model.getVariable())) { type = oracle.getGlobalVariable(this.model.getVariable()); } else { type = this.getModeller().getModel().getLHSBindingType(this.model.getVariable()); if (type == null) { type = this.getModeller().getModel().getRHSBoundFact(this.model.getVariable()).getFactType(); } } return type; }
private String getVariableType() { String type; if (oracle.isGlobalVariable(this.model.getVariable())) { type = oracle.getGlobalVariable(this.model.getVariable()); } else { type = this.getModeller().getModel().getLHSBindingType(this.model.getVariable()); if (type == null) { type = this.getModeller().getModel().getRHSBoundFact(this.model.getVariable()).getFactType(); } } return type; }