final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
if ( !memory.getFactHandleMemory().remove( handle ) ) {
return;
}
final Iterator it = memory.getTupleMemory().iterator( handle );
this.constraints.updateFromFactHandle( memory.getContext(),
workingMemory,
handle );
for ( ReteTuple tuple = (ReteTuple) it.next(); tuple != null; tuple = (ReteTuple) it.next() ) {
if ( this.constraints.isAllowedCachedRight( memory.getContext(),
tuple ) ) {
if ( tuple.getMatch() == handle ) {
// reset the match
tuple.setMatch( null );
// find next match, remember it and break.
final Iterator tupleIt = memory.getFactHandleMemory().iterator( tuple );
this.constraints.updateFromTuple( memory.getContext(),
workingMemory, tuple );
for ( FactEntry entry = (FactEntry) tupleIt.next(); entry != null; entry = (FactEntry) tupleIt.next() ) {
final InternalFactHandle rightHandle = entry.getFactHandle();
if ( this.constraints.isAllowedCachedLeft( memory.getContext(),
rightHandle.getObject() ) ) {
tuple.setMatch( rightHandle );
break;