public CEPWindow getWindow() { if ( this.window == null ) { this.window = new CEPWindow(); } return this.window; }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; FactPattern that = (FactPattern) o; if (isNegated != that.isNegated) return false; if (boundName != null ? !boundName.equals(that.boundName) : that.boundName != null) return false; if (constraintList != null ? !constraintList.equals(that.constraintList) : that.constraintList != null) return false; if (factType != null ? !factType.equals(that.factType) : that.factType != null) return false; if (window != null ? !window.equals(that.window) : that.window != null) return false; return true; }
private Map<String, String> cloneCEPWindowParameters(CEPWindow window) { Map<String, String> clone = new HashMap<String, String>(); for (Map.Entry<String, String> entry : window.getParameters().entrySet()) { clone.put(entry.getKey(), entry.getValue()); } return clone; }
private FactPattern visitFactPattern(FactPattern pattern) { FactPattern clone = new FactPattern(); clone.setBoundName(pattern.getBoundName()); clone.setFactType(pattern.getFactType()); clone.setNegated(pattern.isNegated()); CEPWindow cloneCEPWindow = new CEPWindow(); cloneCEPWindow.setOperator(pattern.getWindow().getOperator()); cloneCEPWindow.setParameters(cloneCEPWindowParameters(pattern.getWindow())); clone.setWindow(cloneCEPWindow); for (FieldConstraint fc : pattern.getFieldConstraints()) { clone.addConstraint((FieldConstraint) visit(fc)); } return clone; }
CEPWindow window = new CEPWindow(); window.setOperator("over window:" + behavior.getSubType()); window.setParameter("org.drools.workbench.models.commons.backend.rule.operatorParameterGenerator", "org.drools.workbench.models.commons.backend.rule.CEPWindowOperatorParameterDRLBuilder"); List<String> params = behavior.getParameters(); int i = 1; for (String param : params) { window.setParameter("" + i++, param);
@Test public void testDiffWindow() { CEPWindow window1 = new CEPWindow(); window1.setOperator("dummyOp1"); column1.setWindow(window1); CEPWindow window2 = new CEPWindow(); window2.setOperator("dummyOp2"); column2.setWindow(window2); checkSingleDiff(FIELD_WINDOW, window1, window2, column1, column2); }
private void generateFactPattern(final FactPattern pattern, final LHSGeneratorContext gctx) { if (pattern.isNegated()) { buf.append("not "); } else if (pattern.isBound()) { bindingsPatterns.put(pattern.getBoundName(), pattern); buf.append(pattern.getBoundName()); buf.append(" : "); } if (pattern.getFactType() != null) { buf.append(pattern.getFactType()); } buf.append("( "); // top level constraints if (pattern.getConstraintList() != null) { generateConstraints(pattern, gctx); } buf.append(")"); //Add CEP window definition CEPWindow window = pattern.getWindow(); if (window.isDefined()) { buf.append(" "); buf.append(window.getOperator()); buf.append(buildOperatorParameterDRL(window.getParameters())); } }
@Override public void onValueChange(final ValueChangeEvent<OperatorSelection> event) { if (chosenPatternSelection == null) { return; } OperatorSelection selection = event.getValue(); String selected = selection.getValue(); chosenPatternSelection.getWindow().setOperator(selected); } });
return nodes; if (fp.getWindow().getOperator() != null) { messages.add(new UnsupportedIPatternParserMessage()); return nodes;
private void initialiseTextBox( AbstractRestrictedEntryTextBox txt ) { String key = String.valueOf( 1 ); String value = hcw.getWindow().getParameter( key ); if ( value == null ) { value = ""; hcw.getWindow().setParameter( key, value ); } if ( !txt.isValidValue( value, false ) ) { value = ""; hcw.getWindow().setParameter( key, value ); } txt.setText( value ); txt.setEnabled( !isReadOnly ); parametersContainer.add( txt ); parametersContainer.setVisible( true ); hcw.getWindow().setParameter( SharedConstants.OPERATOR_PARAMETER_GENERATOR, CEP_OPERATOR_PARAMETER_GENERATOR ); }
@Override public int hashCode() { int result = factType != null ? factType.hashCode() : 0; result=~~result; result = 31 * result + (boundName != null ? boundName.hashCode() : 0); result=~~result; result = 31 * result + (isNegated ? 1 : 0); result=~~result; result = 31 * result + (conditions != null ? conditions.hashCode() : 0); result=~~result; result = 31 * result + (window != null ? window.hashCode() : 0); result=~~result; result = 31 * result + (entryPointName != null ? entryPointName.hashCode() : 0); result=~~result; return result; } }
private FactPattern visitFactPattern(FactPattern pattern) { FactPattern clone = new FactPattern(); clone.setBoundName(pattern.getBoundName()); clone.setFactType(pattern.getFactType()); clone.setNegated(pattern.isNegated()); CEPWindow cloneCEPWindow = new CEPWindow(); cloneCEPWindow.setOperator(pattern.getWindow().getOperator()); cloneCEPWindow.setParameters(cloneCEPWindowParameters(pattern.getWindow())); clone.setWindow(cloneCEPWindow); for (FieldConstraint fc : pattern.getFieldConstraints()) { clone.addConstraint((FieldConstraint) visit(fc)); } return clone; }
private static FactPattern buildFactPattern() { FactPattern fp = new FactPattern(); fp.setBoundName( "$f" ); fp.setFactType( "FactType" ); fp.setNegated( true ); CEPWindow win = new CEPWindow(); win.setOperator( "winOp" ); win.setParameter( "winKey", "winPar" ); fp.setWindow( win ); fp.addConstraint( buildSingleFieldConstraint() ); return fp; }
column1.setBoundName("$var1"); column1.setNegated(false); CEPWindow window1 = new CEPWindow(); window1.setOperator("dummyOp1"); column1.setWindow(window1); column1.setEntryPointName("entryPoint1"); column2.setBoundName("$var2"); column2.setNegated(true); CEPWindow window2 = new CEPWindow(); window2.setOperator("dummyOp2"); column2.setWindow(window2); column2.setEntryPointName("entryPoint2");
@Override public void onValueChange(final ValueChangeEvent<OperatorSelection> event) { if (chosenPatternSelection == null) { return; } OperatorSelection selection = event.getValue(); String selected = selection.getValue(); chosenPatternSelection.getWindow().setOperator(selected); } });
box.addItem( HumanReadable.getOperatorDisplayName( op ), op ); if ( op.equals( hcw.getWindow().getOperator() ) ) { selected = op; selectedText = HumanReadable.getOperatorDisplayName( op ); selectItem( hcw.getWindow().getOperator() );
private void initialiseTextBox( AbstractRestrictedEntryTextBox txt ) { String key = String.valueOf( 1 ); String value = hcw.getWindow().getParameter( key ); if ( value == null ) { value = ""; hcw.getWindow().setParameter( key, value ); } if ( !txt.isValidValue( value, false ) ) { value = ""; hcw.getWindow().setParameter( key, value ); } txt.setText( value ); txt.setEnabled( !isReadOnly ); parametersContainer.add( txt ); parametersContainer.setVisible( true ); hcw.getWindow().setParameter( SharedConstants.OPERATOR_PARAMETER_GENERATOR, CEP_OPERATOR_PARAMETER_GENERATOR ); }
@Override public int hashCode() { int result = constraintList != null ? constraintList.hashCode() : 0; result = ~~result; result = 31 * result + (factType != null ? factType.hashCode() : 0); result = ~~result; result = 31 * result + (boundName != null ? boundName.hashCode() : 0); result = ~~result; result = 31 * result + (isNegated ? 1 : 0); result = ~~result; result = 31 * result + (window != null ? window.hashCode() : 0); result = ~~result; return result; } }
public CEPWindow getWindow() { if ( this.window == null ) { this.window = new CEPWindow(); } return this.window; }
private CEPWindowOperatorsDropdown newCEPWindowOperatorsDropdown() { final Pattern52 editingPattern = editingPattern(); return new CEPWindowOperatorsDropdown(editingPattern, false) {{ addValueChangeHandler(event -> { final CEPWindow cepWindow = editingPattern.getWindow(); final String operator = event.getValue().getValue(); cepWindow.setOperator(operator); }); }}; }