mockcondition.java

来自「drools 一个开放源码的规则引擎」· Java 代码 · 共 42 行

JAVA
42
字号
package org.drools.spi;

import org.drools.rule.Declaration;

public class MockCondition
    implements
    Condition
{
    
    private Declaration[] declarations;
    private boolean       isAllowed;
    
    private boolean testException;
    
    public MockCondition(Declaration[] declarations,
                         boolean isAllowed)
    {
        this.declarations = declarations;
        this.isAllowed = isAllowed;
    }

    public Declaration[] getRequiredTupleMembers()
    {
        return this.declarations;
    }

    public boolean isAllowed(Tuple tuple) throws TestException
    {
        if ( this.testException )
        {
            throw new TestException();
        }
        return this.isAllowed;
    }
    
    public void setTestException( boolean testException )
    {
        this.testException = testException;
    }

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?