Example #1
   * Calculates the length of the the sub-path in a _transition path, that is used only by a given
   * string.
   * @param str a String corresponding to a _transition path from sourceNode
   * @return an int denoting the size of the sub-path in the _transition path corresponding to
   *     {@code str} that is only used by {@code str}
  private int calculateSoleTransitionPathLength(String str) {
    Stack<MDAGNode> transitionPathNodeStack = sourceNode.getTransitionPathNodes(str);
    transitionPathNodeStack.pop(); // The MDAGNode at the top of the stack is not needed
    // (we are processing the outgoing transitions of nodes inside str's _transition path,
    // the outgoing transitions of the MDAGNode at the top of the stack are outside this path)


    // Process each node in transitionPathNodeStack, using each to determine whether the
    // _transition path corresponding to str is only used by str.  This is true if and only if
    // each node in the _transition path has a single outgoing _transition and is not an accept
    // state.
    while (!transitionPathNodeStack.isEmpty()) {
      MDAGNode currentNode = transitionPathNodeStack.peek();
      if (currentNode.getOutgoingTransitions().size() <= 1 && !currentNode.isAcceptNode())
      else break;

    return (transitionPathNodeStack.capacity() - transitionPathNodeStack.size());
 public void setFrames(Stack<IAnimationFrame> frames) {
   mFrames = frames;
   mNumFrames = frames.capacity();