Skip to content

Commit

Permalink
Add documentation, rename a few methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
calvertdw committed Feb 4, 2025
1 parent d73bd60 commit a3d3d16
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public abstract class RDXLeafNode<S extends LeafNodeState<D>,
private final ImGuiFlashingColors isExecutingFlashingColor = new ImGuiFlashingColors(0.1, ImGuiTools.PURPLE, ImGuiTools.DARK_PURPLE);
private final ImGuiHollowArrowRenderer hollowArrowRenderer = new ImGuiHollowArrowRenderer();
private final ImGuiFlashingText flashingDescriptionColor = new ImGuiFlashingText(ImGuiTools.RED);
/** Used to trigger a UI notification when the action goes from !failed -> failed. */
private boolean wasFailed = false;

public RDXLeafNode(S state)
Expand Down Expand Up @@ -109,7 +110,7 @@ else if (definition.getExecuteAfterBeginning().getValue())
}
else
{
LeafNodeState<?> executeAfterNode = state.findExecuteAfterLeaf();
LeafNodeState<?> executeAfterNode = state.getExecuteAfterLeaf();
selectedText = executeAfterNode.getDefinition().getName();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ public void update()
int j = i - 1;
for (; j >= 0; j--)
{
int thisExecuteAfterLeafIndex = state.getOrderedLeaves().get(i).calculateExecuteAfterLeafIndex();
int executeAfterLeafIndexToCompare = state.getOrderedLeaves().get(j).calculateExecuteAfterLeafIndex();
int thisExecuteAfterLeafIndex = state.getOrderedLeaves().get(i).getExecuteAfterLeafIndex();
int executeAfterLeafIndexToCompare = state.getOrderedLeaves().get(j).getExecuteAfterLeafIndex();
if (thisExecuteAfterLeafIndex == executeAfterLeafIndexToCompare)
{
state.getOrderedLeaves().get(i).setConcurrencyRank(2);
Expand All @@ -88,7 +88,7 @@ else if (i == executionNextIndex)
{
state.getOrderedLeaves().get(i).setIsNextForExecution(true);
}
else if (state.getOrderedLeaves().get(i).calculateExecuteAfterLeafIndex() < executionNextIndex)
else if (state.getOrderedLeaves().get(i).getExecuteAfterLeafIndex() < executionNextIndex)
{
state.getOrderedLeaves().get(i).setIsNextForExecution(true);
}
Expand Down Expand Up @@ -283,7 +283,7 @@ private boolean shouldExecuteNextLeaf()

if (state.getConcurrencyEnabled())
{
int executeAfterLeafIndex = nextNodeToExecute.getState().calculateExecuteAfterLeafIndex();
int executeAfterLeafIndex = nextNodeToExecute.getState().getExecuteAfterLeafIndex();

if (executeAfterLeafIndex < 0) // Execute after beginning
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void update()

for (LeafNodeExecutor<?, ?> child : leafChildren)
{
if (child.getState().calculateExecuteAfterLeafIndex() < firstLeafIndex)
if (child.getState().getExecuteAfterLeafIndex() < firstLeafIndex)
{
tryLeaves.add(child);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public LeafNodeExecutor(S state)
this.state = state;
}

/** Message to print when {@link LeafNodeState#getCanExecute()} is false, to communicate the problem to the operator. */
public String getCantExecuteMessage()
{
return "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public void setLeafIndex(int leafIndex)
this.leafIndex = leafIndex;
}

/** The index of the leaf, depth first over the entire tree. The first leaf is 0. */
public int getLeafIndex()
{
return leafIndex;
Expand Down Expand Up @@ -186,15 +187,16 @@ public boolean getIsExecuting()
return isExecuting.getValue();
}

public int calculateExecuteAfterLeafIndex()
/** @return the index of the leaf to execute after as part of the concurrency system */
public int getExecuteAfterLeafIndex()
{
if (definition.getExecuteAfterBeginning().getValue())
{
return -1;
}
else if (!definition.getExecuteAfterPrevious().getValue())
{
LeafNodeState<?> executeAfterNode = findExecuteAfterLeaf();
LeafNodeState<?> executeAfterNode = getExecuteAfterLeaf();

if (executeAfterNode != null)
return executeAfterNode.getLeafIndex();
Expand All @@ -203,7 +205,8 @@ else if (!definition.getExecuteAfterPrevious().getValue())
return leafIndex - 1; // previous
}

public LeafNodeState<?> findExecuteAfterLeaf()
/** @return the leaf to execute after as part of the concurrency system */
public LeafNodeState<?> getExecuteAfterLeaf()
{
long executeAfterID = definition.getExecuteAfterNodeID().getValue();

Expand Down

0 comments on commit a3d3d16

Please sign in to comment.