Ejemplo n.º 1
0
  /**
   * getChildrenDatas Scan currently opened group, to get all direct descendants' DataItem and
   * instrument informations (such as NXtechnical_data). Then return a list of DataItem.
   *
   * @throws NexusException
   */
  @SuppressWarnings("unchecked")
  protected Stack<DataItem> getChildrenDatas() throws NexusException {
    // Defining variables
    NexusNode node;
    ArrayList<NexusNode> alNodeList;
    Stack<DataItem> alDataItem = new Stack<DataItem>();

    // Parse children
    alNodeList = (ArrayList<NexusNode>) listChildren().clone();
    for (int iIndex = 0; iIndex < alNodeList.size(); iIndex++) {
      node = alNodeList.get(iIndex);
      if (!node.isGroup()) {
        openData(node.getNodeName());
        alDataItem.push(getDataItem());
        closeData();
      }
    }
    alDataItem.trimToSize();
    return alDataItem;
  }
Ejemplo n.º 2
0
  /**
   * 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)

    transitionPathNodeStack.trimToSize();

    // 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())
        transitionPathNodeStack.pop();
      else break;
    }
    /////

    return (transitionPathNodeStack.capacity() - transitionPathNodeStack.size());
  }
Ejemplo n.º 3
0
 public void setFrames(Stack<IAnimationFrame> frames) {
   mFrames = frames;
   frames.trimToSize();
   mNumFrames = frames.capacity();
 }