public LeftTuple( final LeftTuple leftTuple, final RightTuple rightTuple, LeftTupleSink sink, boolean leftTupleMemoryEnabled) { this.handle = rightTuple.getFactHandle(); this.index = leftTuple.index + 1; this.parent = leftTuple; this.recency = leftTuple.recency + this.handle.getRecency(); this.hashCode = leftTuple.hashCode ^ (handle.hashCode() * 31); if (leftTupleMemoryEnabled) { this.rightParent = rightTuple; this.rightParentNext = this.rightParent.getBetaChildren(); if (this.rightParentNext != null) { this.rightParentNext.rightParentPrevious = this; } this.rightParent.setBetaChildren(this); this.leftParent = leftTuple; this.leftParentNext = leftTuple.children; if (this.leftParentNext != null) { this.leftParentNext.leftParentPrevious = this; } this.leftParent.children = this; } this.sink = sink; }
// ------------------------------------------------------------ // Constructors // ------------------------------------------------------------ public LeftTuple( final InternalFactHandle factHandle, LeftTupleSink sink, boolean leftTupleMemoryEnabled) { this.handle = factHandle; this.recency = factHandle.getRecency(); this.hashCode = handle.hashCode(); if (leftTupleMemoryEnabled) { LeftTuple currentFirst = handle.getLeftTuple(); if (currentFirst != null) { currentFirst.leftParentPrevious = this; this.leftParentNext = currentFirst; } handle.setLeftTuple(this); } this.sink = sink; }