java.util.Stack.capacity()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(196)

本文整理了Java中java.util.Stack.capacity()方法的一些代码示例,展示了Stack.capacity()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Stack.capacity()方法的具体详情如下:
包路径:java.util.Stack
类名称:Stack
方法名:capacity

Stack.capacity介绍

暂无

代码示例

代码示例来源:origin: Rajawali/Rajawali

  1. public void setFrames(Stack<IAnimationFrame> frames) {
  2. mFrames = frames;
  3. frames.trimToSize();
  4. mNumFrames = frames.capacity();
  5. }

代码示例来源:origin: hankcs/HanLP

  1. /**
  2. * Calculates the length of the the sub-path in a _transition path, that is used only by a given string.
  3. *
  4. * @param str a String corresponding to a _transition path from sourceNode
  5. * @return an int denoting the size of the sub-path in the _transition path
  6. * corresponding to {@code str} that is only used by {@code str}
  7. */
  8. private int calculateSoleTransitionPathLength(String str)
  9. {
  10. Stack<MDAGNode> transitionPathNodeStack = sourceNode.getTransitionPathNodes(str);
  11. transitionPathNodeStack.pop(); //The MDAGNode at the top of the stack is not needed
  12. //(we are processing the outgoing transitions of nodes inside str's _transition path,
  13. //the outgoing transitions of the MDAGNode at the top of the stack are outside this path)
  14. transitionPathNodeStack.trimToSize();
  15. //Process each node in transitionPathNodeStack, using each to determine whether the
  16. //_transition path corresponding to str is only used by str. This is true if and only if
  17. //each node in the _transition path has a single outgoing _transition and is not an accept state.
  18. while (!transitionPathNodeStack.isEmpty())
  19. {
  20. MDAGNode currentNode = transitionPathNodeStack.peek();
  21. if (currentNode.getOutgoingTransitions().size() <= 1 && !currentNode.isAcceptNode())
  22. transitionPathNodeStack.pop();
  23. else
  24. break;
  25. }
  26. /////
  27. return (transitionPathNodeStack.capacity() - transitionPathNodeStack.size());
  28. }

代码示例来源:origin: pondurii/vrVideo

  1. public void setFrames(Stack<IAnimationFrame> frames) {
  2. mFrames = frames;
  3. frames.trimToSize();
  4. mNumFrames = frames.capacity();
  5. }

代码示例来源:origin: sea-boat/TextAnalyzer

  1. /**
  2. * Calculates the length of the the sub-path in a transition path, that is used only by a given string.
  3. * @param str a String corresponding to a transition path from sourceNode
  4. * @return an int denoting the size of the sub-path in the transition path
  5. * corresponding to {@code str} that is only used by {@code str}
  6. */
  7. private int calculateSoleTransitionPathLength(String str) {
  8. Stack<MDAGNode> transitionPathNodeStack = sourceNode.getTransitionPathNodes(str);
  9. transitionPathNodeStack.pop(); //The MDAGNode at the top of the stack is not needed
  10. //(we are processing the outgoing transitions of nodes inside str's transition path,
  11. //the outgoing transitions of the MDAGNode at the top of the stack are outside this path)
  12. transitionPathNodeStack.trimToSize();
  13. //Process each node in transitionPathNodeStack, using each to determine whether the
  14. //transition path corresponding to str is only used by str. This is true if and only if
  15. //each node in the transition path has a single outgoing transition and is not an accept state.
  16. while (!transitionPathNodeStack.isEmpty()) {
  17. MDAGNode currentNode = transitionPathNodeStack.peek();
  18. if (currentNode.getOutgoingTransitions().size() <= 1 && !currentNode.isAcceptNode())
  19. transitionPathNodeStack.pop();
  20. else
  21. break;
  22. }
  23. /////
  24. return (transitionPathNodeStack.capacity() - transitionPathNodeStack.size());
  25. }

代码示例来源:origin: com.hankcs/hanlp

  1. /**
  2. * Calculates the length of the the sub-path in a _transition path, that is used only by a given string.
  3. *
  4. * @param str a String corresponding to a _transition path from sourceNode
  5. * @return an int denoting the size of the sub-path in the _transition path
  6. * corresponding to {@code str} that is only used by {@code str}
  7. */
  8. private int calculateSoleTransitionPathLength(String str)
  9. {
  10. Stack<MDAGNode> transitionPathNodeStack = sourceNode.getTransitionPathNodes(str);
  11. transitionPathNodeStack.pop(); //The MDAGNode at the top of the stack is not needed
  12. //(we are processing the outgoing transitions of nodes inside str's _transition path,
  13. //the outgoing transitions of the MDAGNode at the top of the stack are outside this path)
  14. transitionPathNodeStack.trimToSize();
  15. //Process each node in transitionPathNodeStack, using each to determine whether the
  16. //_transition path corresponding to str is only used by str. This is true if and only if
  17. //each node in the _transition path has a single outgoing _transition and is not an accept state.
  18. while (!transitionPathNodeStack.isEmpty())
  19. {
  20. MDAGNode currentNode = transitionPathNodeStack.peek();
  21. if (currentNode.getOutgoingTransitions().size() <= 1 && !currentNode.isAcceptNode())
  22. transitionPathNodeStack.pop();
  23. else
  24. break;
  25. }
  26. /////
  27. return (transitionPathNodeStack.capacity() - transitionPathNodeStack.size());
  28. }

相关文章