public static String execute(RuleBasicContentInfo contentInfo, int offset) { detectCurrentVariables(contentInfo); return execute(contentInfo.getContent(), offset); }
@Override protected AssistantOption bindVariable(RuleBasicContentInfo contentInfo) { if (contentInfo==null) return null; if (!contentInfo.getType().equals(DRLContentTypeEnum.RULE_LHS_LINE)) return null; String response = VariableBinding.execute(contentInfo, offset-contentInfo.getOffset()); if (response.equals(contentInfo.getContent())) return null; return new ReplaceAssistantOption("assign to variable", response, contentInfo.getOffset(), contentInfo.getContentLength(), offset); }
@Override protected AssistantOption bindVariable(RuleBasicContentInfo contentInfo) { if (contentInfo==null) return null; if (!contentInfo.getType().equals(DRLContentTypeEnum.RULE_LHS_LINE)) return null; String response = VariableBinding.execute(contentInfo, offset-contentInfo.getOffset()); if (response.equals(contentInfo.getContent())) return null; return new ReplaceAssistantOption("assign to variable", response, contentInfo.getOffset(), contentInfo.getContentLength(), offset); }
public static String execute(RuleBasicContentInfo contentInfo, int offset) { detectCurrentVariables(contentInfo); return execute(contentInfo.getContent(), offset); }
public static String isPossible(RuleBasicContentInfo contentInfo, int offset) { String line = contentInfo.getContent(); int offsetStart = detectVariableOffsetStart(line, offset); if (offsetStart==-1) return null; String right = line.substring(offsetStart); String variableName = detectVariableToReplace(right); if (variableName==null) return null; RuleDRLContentInfo ruleContentInfo = ((RuleLineContentInfo)contentInfo).getRule(); String allRule = getAllRuleLines(ruleContentInfo); return hasMoreVariableToReplace(allRule, variableName)?variableName:null; }
public static String isPossible(RuleBasicContentInfo contentInfo, int offset) { String line = contentInfo.getContent(); int offsetStart = detectVariableOffsetStart(line, offset); if (offsetStart==-1) return null; String right = line.substring(offsetStart); String variableName = detectVariableToReplace(right); if (variableName==null) return null; RuleDRLContentInfo ruleContentInfo = ((RuleLineContentInfo)contentInfo).getRule(); String allRule = getAllRuleLines(ruleContentInfo); return hasMoreVariableToReplace(allRule, variableName)?variableName:null; }
assertEquals(DRLContentTypeEnum.RULE_LHS_LINE, content.getType()); assertEquals("rule \"Hello World\"", ((RuleLineContentInfo)content).getRule().getRuleName()); assertEquals("\t\tPrueba()", content.getContent()); assertEquals(DRLContentTypeEnum.RULE_LHS_LINE, content.getType()); assertEquals("rule \"GoodBye World\"", ((RuleLineContentInfo)content).getRule().getRuleName()); assertEquals("\twhen", content.getContent());