Skip to content

Commit

Permalink
Fix comment 2
Browse files Browse the repository at this point in the history
  • Loading branch information
lucamolteni committed Aug 9, 2023
1 parent f072360 commit b28d8ae
Show file tree
Hide file tree
Showing 20 changed files with 66 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1027,8 +1027,8 @@ private static void correctMemoryOnSplitsChanged(LeftTupleNode splitStart, Inter

/**
* Populates the SegmentMemory with staged LeftTuples. If the parent is not a Beta or From node, it iterates up to find the first node with memory. If necessary
* It traverses to the LiaNode's ObjectTypeNode. It then iterates the AbstractLeftTuple chains, where an existing AbstractLeftTuple is staged
* as delete. Or a new AbstractLeftTuple is created and staged as an insert.
* It traverses to the LiaNode's ObjectTypeNode. It then iterates the LeftTuple chains, where an existing LeftTuple is staged
* as delete. Or a new LeftTuple is created and staged as an insert.
*/
private static void processLeftTuples(LeftTupleNode node, boolean insert, TerminalNode tn, Collection<InternalWorkingMemory> wms) {
for (InternalWorkingMemory wm : wms) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -793,8 +793,8 @@ private static void unlinkRightTuples(RightTuple rightTuple) {

/**
* Populates the SegmentMemory with staged LeftTuples. If the parent is not a Beta or From node, it iterates up to find the first node with memory. If necessary
* It traverses to the LiaNode's ObjectTypeNode. It then iterates the AbstractLeftTuple chains, where an existing AbstractLeftTuple is staged
* as delete. Or a new AbstractLeftTuple is created and staged as an insert.
* It traverses to the LiaNode's ObjectTypeNode. It then iterates the LeftTuple chains, where an existing LeftTuple is staged
* as delete. Or a new LeftTuple is created and staged as an insert.
*/
private static void processLeftTuples(LeftTupleNode node, InternalWorkingMemory wm, boolean insert, Rule rule) {
// *** if you make a fix here, it most likely needs to be in PhreakActivationIteratorToo ***
Expand Down Expand Up @@ -825,7 +825,7 @@ private static void processLeftTuples(LeftTupleNode node, InternalWorkingMemory
Tuple lt = BetaNode.getFirstTuple(bm.getLeftTupleMemory(), it);
for (; lt != null; lt = (LeftTuple) it.next(lt)) {
AccumulateContext accctx = (AccumulateContext) lt.getContextObject();
visitChild((LeftTuple) accctx.getResultLeftTuple(), insert, wm, rule);
visitChild( (LeftTuple) accctx.getResultLeftTuple(), insert, wm, rule);
}
} else if (NodeTypeEnums.ExistsNode == node.getType() && !node.isRightInputIsRiaNode()) { // do not process exists with subnetworks
// If there is a subnetwork, then there is no populated RTM, but the LTM is populated,
Expand Down Expand Up @@ -943,7 +943,7 @@ private static void visitChild(LeftTuple lt, boolean insert, InternalWorkingMemo
}
}

private static void insertPeerRightTuple(LeftTuple lt, InternalWorkingMemory wm, Rule rule, boolean insert ) {
private static void insertPeerRightTuple( LeftTuple lt, InternalWorkingMemory wm, Rule rule, boolean insert ) {
// There's a shared RightInputAdaterNode, so check if one of its sinks is associated only to the new rule
LeftTuple prevLt = null;
RightInputAdapterNode rian = (RightInputAdapterNode) lt.getTupleSink();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public void doNode(AccumulateNode accNode,

Accumulate accumulate = accNode.getAccumulate();
// we do not need collect retracts. RightTuple retracts end up as updates for lefttuples.
// AbstractLeftTuple retracts are already on the trgLeftTuples
// LeftTuple retracts are already on the trgLeftTuples
for (LeftTuple leftTuple = tempLeftTuples.getInsertFirst(); leftTuple != null; ) {
LeftTuple next = leftTuple.getStagedNext();
evaluateResultConstraints(accNode, sink, accumulate, leftTuple, leftTuple.getPropagationContext(),
Expand Down Expand Up @@ -244,7 +244,7 @@ private void doRightInserts(AccumulateNode accNode,

FastIterator leftIt = accNode.getLeftIterator( ltm );

for ( LeftTuple leftTuple = accNode.getFirstLeftTuple(rightTuple, ltm, leftIt ); leftTuple != null; leftTuple = (LeftTuple) leftIt.next(leftTuple ) ) {
for ( LeftTuple leftTuple = accNode.getFirstLeftTuple( rightTuple, ltm, leftIt ); leftTuple != null; leftTuple = (LeftTuple) leftIt.next( leftTuple ) ) {
if ( constraints.isAllowedCachedRight( contextEntry,
leftTuple ) ) {
final BaseAccumulation accctx = (BaseAccumulation) leftTuple.getContextObject();
Expand Down Expand Up @@ -420,7 +420,7 @@ private void doRightUpdates(AccumulateNode accNode,
LeftTuple childLeftTuple = rightTuple.getFirstChild();

FastIterator leftIt = accNode.getLeftIterator( ltm );
LeftTuple leftTuple = accNode.getFirstLeftTuple(rightTuple, ltm, leftIt );
LeftTuple leftTuple = accNode.getFirstLeftTuple( rightTuple, ltm, leftIt );

constraints.updateFromFactHandle( contextEntry,
reteEvaluator,
Expand Down Expand Up @@ -523,7 +523,7 @@ private void doRightUpdatesProcessChildren(AccumulateNode accNode,

LeftTuple temp = childLeftTuple.getRightParentNext();
final BaseAccumulation accctx = (BaseAccumulation) leftTuple.getContextObject();
// FIXME This will be really slow, if it re-accumulates on the same AbstractLeftTuple (MDP)
// FIXME This will be really slow, if it re-accumulates on the same LeftTuple (MDP)
// remove the match
removeMatch(accNode,
accumulate,
Expand Down Expand Up @@ -571,7 +571,7 @@ private void doLeftDeletes(AccumulateNode accNode,
}
}

protected void propagateDelete(TupleSets<LeftTuple> trgLeftTuples, TupleSets<LeftTuple> stagedLeftTuples, Object accPropCtx ) {
protected void propagateDelete( TupleSets<LeftTuple> trgLeftTuples, TupleSets<LeftTuple> stagedLeftTuples, Object accPropCtx ) {
AccumulateContextEntry entry = (AccumulateContextEntry) accPropCtx;
if ( entry.isPropagated() ) {
normalizeStagedTuples( stagedLeftTuples, (LeftTuple) entry.getResultLeftTuple() );
Expand Down Expand Up @@ -601,7 +601,7 @@ private void doRightDeletes(AccumulateNode accNode,

LeftTuple leftTuple = match.getLeftParent();
final BaseAccumulation accctx = (BaseAccumulation) leftTuple.getContextObject();
// FIXME This will be really slow, if it re-accumulates on the same AbstractLeftTuple (MDP)
// FIXME This will be really slow, if it re-accumulates on the same LeftTuple (MDP)
removeMatch(accNode, accumulate, rightTuple, match, reteEvaluator, am, accctx, true);

if (leftTuple.getStagedType() == LeftTuple.NONE) {
Expand Down Expand Up @@ -736,7 +736,7 @@ private void addMatch(final AccumulateNode accNode,
// linking left and right by creating a new left tuple
LeftTuple match = accNode.createLeftTuple(leftTuple, rightTuple,
currentLeftChild, currentRightChild,
accNode, true);
accNode,true);

postAccumulate(accNode, accctx, match);

Expand Down Expand Up @@ -814,7 +814,7 @@ protected void reaccumulateForLeftTuple(final AccumulateNode accNode,
for (LeftTuple childMatch = leftParent.getFirstChild(); childMatch != null; childMatch = childMatch.getHandleNext()) {
RightTuple rightTuple = childMatch.getRightParent();
FactHandle childHandle = rightTuple.getFactHandle();
LeftTuple tuple = leftParent;
LeftTuple tuple = leftParent;
if (accNode.isRightInputIsRiaNode()) {
// if there is a subnetwork, handle must be unwrapped
tuple = (LeftTuple) rightTuple;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ private BranchTuples getBranchTuples(LeftTupleSink sink, LeftTuple leftTuple) {
BranchTuples branchTuples = new BranchTuples();
LeftTuple child = leftTuple.getFirstChild();
if ( child != null ) {
// assigns the correct main or rtn AbstractLeftTuple based on the identified sink
// assigns the correct main or rtn LeftTuple based on the identified sink
if ( child.getTupleSink() == sink ) {
branchTuples.mainLeftTuple = child;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public void doLeftInserts(ExistsNode existsNode,
// tuple is not blocked to propagate
insertChildLeftTuple( sink, trgLeftTuples, leftTuple, leftTuple.getBlocker().getPropagationContext(),useLeftMemory );
} else if (useLeftMemory) {
// AbstractLeftTuple is not blocked, so add to memory so other RightTuples can match
// LeftTuple is not blocked, so add to memory so other RightTuples can match
ltm.add(leftTuple);
}
leftTuple.clearStaged();
Expand Down Expand Up @@ -261,7 +261,7 @@ public void doLeftUpdates(ExistsNode existsNode,
ltm.add(leftTuple); // add to memory so other fact handles can attempt to match

if (leftTuple.getFirstChild() != null) {
// no need to update pctx, as no right available, and pctx will exist on a parent AbstractLeftTuple anyway
// no need to update pctx, as no right available, and pctx will exist on a parent LeftTuple anyway
RuleNetworkEvaluator.unlinkAndDeleteChildLeftTuple( leftTuple.getFirstChild(), trgLeftTuples, stagedLeftTuples );
}
// with no previous children. do nothing.
Expand Down Expand Up @@ -426,7 +426,7 @@ public void doLeftDeletes(BetaMemory bm,
}
} else {
if (leftTuple.getFirstChild() != null) {
// no need to update pctx, as no right available, and pctx will exist on a parent AbstractLeftTuple anyway
// no need to update pctx, as no right available, and pctx will exist on a parent LeftTuple anyway
RuleNetworkEvaluator.unlinkAndDeleteChildLeftTuple( leftTuple.getFirstChild(), trgLeftTuples, stagedLeftTuples );
}
blocker.removeBlocked(leftTuple);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ public void doLeftDeletes(BetaMemory bm,

if (childLeftTuple != null) { // NotNode only has one child
childLeftTuple.setPropagationContext(leftTuple.getPropagationContext());
RuleNetworkEvaluator.unlinkAndDeleteChildLeftTuple( childLeftTuple, trgLeftTuples, stagedLeftTuples ); // no need to update pctx, as no right available, and pctx will exist on a parent AbstractLeftTuple anyway
RuleNetworkEvaluator.unlinkAndDeleteChildLeftTuple( childLeftTuple, trgLeftTuples, stagedLeftTuples ); // no need to update pctx, as no right available, and pctx will exist on a parent LeftTuple anyway
}
} else {
blocker.removeBlocked(leftTuple);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public static void doLeftTupleUpdate(TerminalNode rtnNode, RuleExecutor executor
boolean blocked = false;
if( executor.isDeclarativeAgendaEnabled() ) {
if ( rtnLeftTuple.hasBlockers() ) {
blocked = true; // declarativeAgenda still blocking AbstractLeftTuple, so don't add back ot list
blocked = true; // declarativeAgenda still blocking LeftTuple, so don't add back ot list
}
} else {
blocked = rtnNode.getRule().isNoLoop() && rtnNode.equals(pctx.getTerminalNodeOrigin());
Expand Down Expand Up @@ -220,7 +220,7 @@ public static void doLeftTupleUpdate(TerminalNode rtnNode, RuleExecutor executor
}

} else {
// AbstractLeftTuple is blocked, and thus not queued, so just update it's values
// LeftTuple is blocked, and thus not queued, so just update it's values
rtnLeftTuple.update(salienceInt, pctx);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ public EvalNodeLeftTuple(final LeftTuple leftTuple,
}

/* (non-Javadoc)
* @see org.kie.reteoo.AbstractLeftTuple#unlinkFromLeftParent()
* @see org.kie.reteoo.LeftTuple#unlinkFromLeftParent()
*/
public void unlinkFromLeftParent() {
super.unlinkFromLeftParent();
this.blocker = null;
}

/* (non-Javadoc)
* @see org.kie.reteoo.AbstractLeftTuple#unlinkFromRightParent()
* @see org.kie.reteoo.LeftTuple#unlinkFromRightParent()
*/
public void unlinkFromRightParent() {
super.unlinkFromRightParent();
Expand All @@ -117,42 +117,42 @@ public void clearBlocker() {
}

/* (non-Javadoc)
* @see org.kie.reteoo.AbstractLeftTuple#setBlocker(org.kie.reteoo.RightTuple)
* @see org.kie.reteoo.LeftTuple#setBlocker(org.kie.reteoo.RightTuple)
*/
public void setBlocker(RightTuple blocker) {
this.blocker = blocker;
}

/* (non-Javadoc)
* @see org.kie.reteoo.AbstractLeftTuple#getBlocker()
* @see org.kie.reteoo.LeftTuple#getBlocker()
*/
public RightTuple getBlocker() {
return this.blocker;
}

/* (non-Javadoc)
* @see org.kie.reteoo.AbstractLeftTuple#getBlockedPrevious()
* @see org.kie.reteoo.LeftTuple#getBlockedPrevious()
*/
public LeftTuple getBlockedPrevious() {
return this.blockedPrevious;
}

/* (non-Javadoc)
* @see org.kie.reteoo.AbstractLeftTuple#setBlockedPrevious(org.kie.reteoo.AbstractLeftTuple)
* @see org.kie.reteoo.LeftTuple#setBlockedPrevious(org.kie.reteoo.LeftTuple)
*/
public void setBlockedPrevious(LeftTuple blockerPrevious) {
this.blockedPrevious = blockerPrevious;
}

/* (non-Javadoc)
* @see org.kie.reteoo.AbstractLeftTuple#getBlockedNext()
* @see org.kie.reteoo.LeftTuple#getBlockedNext()
*/
public LeftTuple getBlockedNext() {
return this.blockedNext;
}

/* (non-Javadoc)
* @see org.kie.reteoo.AbstractLeftTuple#setBlockedNext(org.kie.reteoo.AbstractLeftTuple)
* @see org.kie.reteoo.LeftTuple#setBlockedNext(org.kie.reteoo.LeftTuple)
*/
public void setBlockedNext(LeftTuple blockerNext) {
this.blockedNext = blockerNext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ private static void doUpdateSegmentMemory(LeftTuple leftTuple, PropagationContex
return;
}

// if AbstractLeftTuple is already staged, leave it there
// if LeftTuple is already staged, leave it there
boolean stagedUpdateWasEmpty = leftTuples.addUpdate(leftTuple);

if ( stagedUpdateWasEmpty && linkOrNotify ) {
Expand Down
12 changes: 6 additions & 6 deletions drools-core/src/main/java/org/drools/core/reteoo/LeftTuple.java
Original file line number Diff line number Diff line change
Expand Up @@ -219,16 +219,16 @@ public void reAdd() {
}

public void reAddLeft() {
// The parent can never be the FactHandle (root AbstractLeftTuple) as that is handled by reAdd()
// The parent can never be the FactHandle (root LeftTuple) as that is handled by reAdd()
// make sure we aren't already at the end
if ( this.handleNext != null ) {
if ( this.handlePrevious != null ) {
// remove the current AbstractLeftTuple from the middle of the chain
// remove the current LeftTuple from the middle of the chain
this.handlePrevious.setHandleNext( this.handleNext );
this.handleNext.setHandlePrevious( this.handlePrevious );
} else {
if( this.leftParent.getFirstChild() == this ) {
// remove the current AbstractLeftTuple from start start of the chain
// remove the current LeftTuple from start start of the chain
this.leftParent.setFirstChild( getHandleNext() );
}
this.handleNext.setHandlePrevious( null );
Expand All @@ -245,12 +245,12 @@ public void reAddRight() {
// make sure we aren't already at the end
if ( this.rightParentNext != null ) {
if ( this.rightParentPrevious != null ) {
// remove the current AbstractLeftTuple from the middle of the chain
// remove the current LeftTuple from the middle of the chain
this.rightParentPrevious.setRightParentNext( this.rightParentNext );
this.rightParentNext.setRightParentPrevious( this.rightParentPrevious );
} else {
if( this.rightParent.getFirstChild() == this ) {
// remove the current AbstractLeftTuple from the start of the chain
// remove the current LeftTuple from the start of the chain
this.rightParent.setFirstChild( this.rightParentNext );
}
this.rightParentNext.setRightParentPrevious( null );
Expand Down Expand Up @@ -497,7 +497,7 @@ public boolean equals(Object object) {

LeftTuple other = ( (LeftTuple) object );

// A AbstractLeftTuple is only the same if it has the same hashCode, factId and parent
// A LeftTuple is only the same if it has the same hashCode, factId and parent
if ( this.hashCode() != other.hashCode() || getFactHandle() != other.getFactHandle() ) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ public NotNodeLeftTuple(final LeftTuple leftTuple,
}

/* (non-Javadoc)
* @see org.kie.reteoo.AbstractLeftTuple#unlinkFromLeftParent()
* @see org.kie.reteoo.LeftTuple#unlinkFromLeftParent()
*/
public void unlinkFromLeftParent() {
super.unlinkFromLeftParent();
}

/* (non-Javadoc)
* @see org.kie.reteoo.AbstractLeftTuple#unlinkFromRightParent()
* @see org.kie.reteoo.LeftTuple#unlinkFromRightParent()
*/
public void unlinkFromRightParent() {
super.unlinkFromRightParent();
Expand All @@ -122,42 +122,42 @@ public void clearBlocker() {
}

/* (non-Javadoc)
* @see org.kie.reteoo.AbstractLeftTuple#setBlocker(org.kie.reteoo.RightTuple)
* @see org.kie.reteoo.LeftTuple#setBlocker(org.kie.reteoo.RightTuple)
*/
public void setBlocker(RightTuple blocker) {
this.blocker = blocker;
}

/* (non-Javadoc)
* @see org.kie.reteoo.AbstractLeftTuple#getBlocker()
* @see org.kie.reteoo.LeftTuple#getBlocker()
*/
public RightTuple getBlocker() {
return this.blocker;
}

/* (non-Javadoc)
* @see org.kie.reteoo.AbstractLeftTuple#getBlockedPrevious()
* @see org.kie.reteoo.LeftTuple#getBlockedPrevious()
*/
public LeftTuple getBlockedPrevious() {
return this.blockedPrevious;
}

/* (non-Javadoc)
* @see org.kie.reteoo.AbstractLeftTuple#setBlockedPrevious(org.kie.reteoo.AbstractLeftTuple)
* @see org.kie.reteoo.LeftTuple#setBlockedPrevious(org.kie.reteoo.LeftTuple)
*/
public void setBlockedPrevious(LeftTuple blockerPrevious) {
this.blockedPrevious = blockerPrevious;
}

/* (non-Javadoc)
* @see org.kie.reteoo.AbstractLeftTuple#getBlockedNext()
* @see org.kie.reteoo.LeftTuple#getBlockedNext()
*/
public LeftTuple getBlockedNext() {
return this.blockedNext;
}

/* (non-Javadoc)
* @see org.kie.reteoo.AbstractLeftTuple#setBlockedNext(org.kie.reteoo.AbstractLeftTuple)
* @see org.kie.reteoo.LeftTuple#setBlockedNext(org.kie.reteoo.LeftTuple)
*/
public void setBlockedNext(LeftTuple blockerNext) {
this.blockedNext = blockerNext;
Expand Down
Loading

0 comments on commit b28d8ae

Please sign in to comment.