leftinputadapternode.java

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

JAVA
57
字号
package org.drools.reteoo;

import org.drools.FactException;
import org.drools.spi.PropagationContext;

public class LeftInputAdapterNode extends TupleSource
    implements
    ObjectSink
{
    private final ObjectSource objectSource;
    
    private final int          column;

    public LeftInputAdapterNode(int id,
                                int column,
                                ObjectSource source)
    {
        super( id  );
        this.column = column;
        this.objectSource = source;
    }

    public void attach()
    {
        this.objectSource.addObjectSink( this );
    }

    public void assertObject(Object object,
                             FactHandleImpl handle,
                             PropagationContext context, 
                             WorkingMemoryImpl workingMemory) throws FactException
    {
        ReteTuple tuple = new ReteTuple( this.column ,
                                         handle,
                                         workingMemory );
        propagateAssertTuple( tuple,
                              context,
                              workingMemory );
    }

    public void retractObject(FactHandleImpl handle,
                              PropagationContext context, 
                              WorkingMemoryImpl workingMemory) throws FactException
    {
        TupleKey key = new TupleKey( this.column ,
                                     handle );
        propagateRetractTuples( key,
                                context,
                                workingMemory );
    }

    public int getId()
    {
        return id;
    }
}

⌨️ 快捷键说明

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