/** * Create the array of branch choices and set the mode which forces the user to select from among * the branch choices. * * @param iBranchParent int Index which identifies the parent branch. * @param iBranchPoint int Index which identifies the point along the branch path where the * branching occurs for the choices. */ private void setupBranchChoices(int iBranchParent, int iBranchPoint) { // Get list of possible sub-branches for the parent. int[] aiBranchChildIndex = m_kFlyPathGraph.getBranchPointBranches(iBranchParent, iBranchPoint); // Get the information for the parent branch. BranchState kBranchStateParent = m_akBranchState[iBranchParent]; // Build the list of possible branches. // First branch choice is the parent branch, current direction // Last branch choice is the parent branch, reverse direction // Reset all of the sub-branches to their start state. m_akBranchChoice = new BranchState[2 + aiBranchChildIndex.length]; m_akBranchChoice[0] = kBranchStateParent.createCopy(); m_akBranchChoice[m_akBranchChoice.length - 1] = kBranchStateParent.createReverseCopy(); for (int i = 0; i < aiBranchChildIndex.length; i++) { int iBranchChild = aiBranchChildIndex[i]; m_akBranchState[iBranchChild].start(); m_akBranchChoice[i + 1] = m_akBranchState[iBranchChild].createCopy(); } m_bChooseBranch = true; m_iBranchChoiceIndex = -1; }
/** * Get the current state of traversing. * * @return BranchState */ public BranchState getBranchState() { return m_kBranchState.createCopy(); }