Search in sources :

Example 1 with Pattern

use of org.drools.workbench.services.verifier.api.client.index.Pattern in project drools-wb 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.workbench.services.verifier.api.client.index.Pattern) ObjectType(org.drools.workbench.services.verifier.api.client.index.ObjectType) AnalyzerConfiguration(org.drools.workbench.services.verifier.api.client.configuration.AnalyzerConfiguration) Test(org.junit.Test)

Example 2 with Pattern

use of org.drools.workbench.services.verifier.api.client.index.Pattern in project drools-wb 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.workbench.services.verifier.api.client.index.Pattern) ObjectType(org.drools.workbench.services.verifier.api.client.index.ObjectType) AnalyzerConfigurationMock(org.drools.workbench.services.verifier.core.checks.AnalyzerConfigurationMock) Before(org.junit.Before)

Example 3 with Pattern

use of org.drools.workbench.services.verifier.api.client.index.Pattern in project drools-wb 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.workbench.services.verifier.api.client.index.Pattern) ObjectType(org.drools.workbench.services.verifier.api.client.index.ObjectType) AnalyzerConfiguration(org.drools.workbench.services.verifier.api.client.configuration.AnalyzerConfiguration) Test(org.junit.Test)

Example 4 with Pattern

use of org.drools.workbench.services.verifier.api.client.index.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.workbench.services.verifier.api.client.index.Pattern) BRLConditionVariableColumn(org.drools.workbench.models.guided.dtable.shared.model.BRLConditionVariableColumn)

Example 5 with Pattern

use of org.drools.workbench.services.verifier.api.client.index.Pattern in project drools-wb by kiegroup.

the class PatternResolver method resolve.

public Pattern resolve() {
    PortablePreconditions.checkNotNull("rule", rule);
    final Pattern pattern = rule.getPatterns().where(Pattern.boundName().is(getBoundName())).select().first();
    if (pattern == null) {
        final Pattern build = new Pattern(getBoundName(), resolveObjectType(getFactType()), configuration);
        rule.getPatterns().add(build);
        return build;
    } else {
        return pattern;
    }
}
Also used : Pattern(org.drools.workbench.services.verifier.api.client.index.Pattern)

Aggregations

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