Search in sources :

Example 1 with Pattern

use of org.drools.verifier.core.index.model.Pattern in project drools by kiegroup.

the class RuleInspector method makePatternsInspectors.

private void makePatternsInspectors() {
    for (final Pattern pattern : rule.getPatterns().where(Pattern.uuid().any()).select().all()) {
        final PatternInspector patternInspector = new PatternInspector(pattern, new RuleInspectorUpdater() {

            @Override
            public void resetActionsInspectors() {
                actionsInspectors = null;
            }

            @Override
            public void resetConditionsInspectors() {
                conditionsInspectors = null;
            }
        }, configuration);
        patternInspectorList.add(patternInspector);
    }
}
Also used : Pattern(org.drools.verifier.core.index.model.Pattern)

Example 2 with Pattern

use of org.drools.verifier.core.index.model.Pattern in project drools by kiegroup.

the class PatternInspectorTest method testSubsumpt02.

@Test
public void testSubsumpt02() throws Exception {
    final PatternInspector x = new PatternInspector(new Pattern("x", new ObjectType("org.Address", configurationMock), configurationMock), mock(RuleInspectorUpdater.class), mock(AnalyzerConfiguration.class));
    assertFalse(x.subsumes(b));
    assertFalse(b.subsumes(x));
}
Also used : Pattern(org.drools.verifier.core.index.model.Pattern) ObjectType(org.drools.verifier.core.index.model.ObjectType) AnalyzerConfiguration(org.drools.verifier.core.configuration.AnalyzerConfiguration) Test(org.junit.Test)

Example 3 with Pattern

use of org.drools.verifier.core.index.model.Pattern in project drools by kiegroup.

the class PatternInspectorTest method testRedundancy02.

@Test
public void testRedundancy02() throws Exception {
    final PatternInspector x = new PatternInspector(new Pattern("x", new ObjectType("org.Address", configurationMock), configurationMock), mock(RuleInspectorUpdater.class), mock(AnalyzerConfiguration.class));
    assertFalse(x.isRedundant(b));
    assertFalse(b.isRedundant(x));
}
Also used : Pattern(org.drools.verifier.core.index.model.Pattern) ObjectType(org.drools.verifier.core.index.model.ObjectType) AnalyzerConfiguration(org.drools.verifier.core.configuration.AnalyzerConfiguration) Test(org.junit.Test)

Example 4 with Pattern

use of org.drools.verifier.core.index.model.Pattern in project drools by kiegroup.

the class PatternInspectorTest method setUp.

@Before
public void setUp() throws Exception {
    configurationMock = new AnalyzerConfigurationMock();
    a = new PatternInspector(new Pattern("a", new ObjectType("org.Person", configurationMock), configurationMock), mock(RuleInspectorUpdater.class), mock(AnalyzerConfiguration.class));
    b = new PatternInspector(new Pattern("b", new ObjectType("org.Person", configurationMock), configurationMock), mock(RuleInspectorUpdater.class), mock(AnalyzerConfiguration.class));
}
Also used : Pattern(org.drools.verifier.core.index.model.Pattern) ObjectType(org.drools.verifier.core.index.model.ObjectType) AnalyzerConfigurationMock(org.drools.verifier.core.AnalyzerConfigurationMock) Before(org.junit.Before)

Example 5 with Pattern

use of org.drools.verifier.core.index.model.Pattern in project drools-wb by kiegroup.

the class ConditionBuilder method build.

public Condition build() throws BuildException {
    PortablePreconditions.checkNotNull("conditionCol52", conditionCol52);
    PortablePreconditions.checkNotNull("columnIndex", columnIndex);
    PortablePreconditions.checkNotNull("row", row);
    if (conditionCol52 instanceof BRLConditionVariableColumn) {
        return builderFactory.getBRLConditionBuilder().with((BRLConditionVariableColumn) conditionCol52).with(row.get(columnIndex)).with(columnIndex).build();
    } else {
        PortablePreconditions.checkNotNull("rule", rule);
        final Pattern pattern = builderFactory.getPatternResolver().with(rule).with(columnIndex).resolve();
        return builderFactory.getFieldConditionsBuilder().with(pattern).with(conditionCol52).with(getRealCellValue(conditionCol52, row.get(columnIndex))).with(columnIndex).build();
    }
}
Also used : Pattern(org.drools.verifier.core.index.model.Pattern) BRLConditionVariableColumn(org.drools.workbench.models.guided.dtable.shared.model.BRLConditionVariableColumn)

Aggregations

Pattern (org.drools.verifier.core.index.model.Pattern)6 ObjectType (org.drools.verifier.core.index.model.ObjectType)3 AnalyzerConfiguration (org.drools.verifier.core.configuration.AnalyzerConfiguration)2 Test (org.junit.Test)2 AnalyzerConfigurationMock (org.drools.verifier.core.AnalyzerConfigurationMock)1 BRLConditionVariableColumn (org.drools.workbench.models.guided.dtable.shared.model.BRLConditionVariableColumn)1 Before (org.junit.Before)1