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

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

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

Stack.toString介绍

暂无

代码示例

代码示例来源:origin: magefree/mage

  1. @Override
  2. public void restoreState(int bookmark, String context) {
  3. if (!simulation && !this.hasEnded()) { // if player left or game is over no undo is possible - this could lead to wrong winner
  4. if (bookmark != 0) {
  5. if (!savedStates.contains(bookmark - 1)) {
  6. if (!savedStates.isEmpty()) { // empty if rollback to a turn was requested before, otherwise unclear why
  7. logger.error("It was not possible to do the requested undo operation (bookmark " + (bookmark - 1) + " does not exist) context: " + context);
  8. logger.info("Saved states: " + savedStates.toString());
  9. }
  10. } else {
  11. int stateNum = savedStates.get(bookmark - 1);
  12. removeBookmark(bookmark);
  13. GameState restore = gameStates.rollback(stateNum);
  14. if (restore != null) {
  15. state.restore(restore);
  16. playerList.setCurrent(state.getPlayerByOrderId());
  17. }
  18. }
  19. }
  20. }
  21. }

代码示例来源:origin: org.graphstream/gs-core

  1. /**
  2. * Returns a String description of the path.
  3. *
  4. * @return A String representation of the path.
  5. */
  6. @Override
  7. public String toString() {
  8. return nodePath.toString();
  9. }

代码示例来源:origin: graphstream/gs-core

  1. /**
  2. * Returns a String description of the path.
  3. *
  4. * @return A String representation of the path.
  5. */
  6. @Override
  7. public String toString() {
  8. return nodePath.toString();
  9. }

代码示例来源:origin: onyxbits/Raccoon

  1. @Override
  2. public String toString() {
  3. return rawModel.toString() + scopes.toString();
  4. }

代码示例来源:origin: com.floreysoft/jmte

  1. @Override
  2. public String toString() {
  3. return rawModel.toString() + scopes.toString();
  4. }

代码示例来源:origin: com.mockrunner/mockrunner-jdk1.3-j2ee1.3

  1. public String toString()
  2. {
  3. return this.getClass().getName() + ": " + data.toString();
  4. }
  5. }

代码示例来源:origin: com.mockrunner/mockrunner-jdk1.4-j2ee1.3

  1. public String toString()
  2. {
  3. return this.getClass().getName() + ": " + data.toString();
  4. }
  5. }

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

  1. public Problem createProblem(String sourceClassName,
  2. String bundleName,
  3. Severity severity,
  4. Object problemObject,
  5. String messageId,
  6. Object... messageParams) {
  7. return new ProblemImpl(sourceClassName, bundleName, severity, contextStack.toString(), problemObject, messageId, messageParams);
  8. }

代码示例来源:origin: org.apache.tuscany.sca/tuscany-monitor

  1. public Problem createProblem(String sourceClassName,
  2. String bundleName,
  3. Severity severity,
  4. Object problemObject,
  5. String messageId,
  6. Object... messageParams) {
  7. return new ProblemImpl(sourceClassName, bundleName, severity, contextStack.toString(), problemObject, messageId, messageParams);
  8. }

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

  1. public Problem createProblem(String sourceClassName,
  2. String bundleName,
  3. Severity severity,
  4. Object problemObject,
  5. String messageId,
  6. Throwable cause,
  7. Object... messageParams) {
  8. return new ProblemImpl(sourceClassName, bundleName, severity, contextStack.toString(), problemObject, messageId, cause, messageParams);
  9. }

代码示例来源:origin: org.apache.tuscany.sca/tuscany-monitor

  1. public Problem createProblem(String sourceClassName,
  2. String bundleName,
  3. Severity severity,
  4. Object problemObject,
  5. String messageId,
  6. Throwable cause,
  7. Object... messageParams) {
  8. return new ProblemImpl(sourceClassName, bundleName, severity, contextStack.toString(), problemObject, messageId, cause, messageParams);
  9. }

代码示例来源:origin: kloiasoft/eventapis

  1. public String generateContext(@Nullable String parentOpId, boolean preGenerated) {
  2. if (operationContext.get().size() > 1)
  3. throw new IllegalStateException("There is Already Parent Context: " + operationContext.get().toString());
  4. String opId = generateOpId();
  5. switchContext(opId, parentOpId, preGenerated);
  6. return opId;
  7. }

代码示例来源:origin: org.apache.clerezza/platform.documentation.viewer

  1. private Set<IRI> getAfterDocItems(Stack<DocumentationItem> stack) {
  2. if (!transitiveAfterDocItemsAdded) {
  3. Set<IRI> afterDocItemsClone = new HashSet<>(afterDocItems);
  4. Iterator<IRI> afterDocUrisIter = afterDocItemsClone.iterator();
  5. while (afterDocUrisIter.hasNext()) {
  6. IRI uriRef = afterDocUrisIter.next();
  7. DocumentationItem docItem = uri2docItemObj.get(uriRef);
  8. if (stack.contains(docItem)) {
  9. throw new RuntimeException("Documentation: cycle detected!\n"
  10. + stack.toString());
  11. }
  12. stack.add(docItem);
  13. afterDocItems.addAll(docItem.getAfterDocItems(stack));
  14. }
  15. transitiveAfterDocItemsAdded = true;
  16. }
  17. return afterDocItems;
  18. }

代码示例来源:origin: org.icepdf.os/icepdf-core

  1. public void test2() throws IOException {
  2. String test =
  3. "{2 index 1.000000 cvr exch sub 4 1 roll 1 index 1.000000 cvr exch sub \n" +
  4. "4 1 roll 0 index 1.000000 cvr exch sub 4 1 roll 1.000000 4 1 \n" +
  5. "roll 7 -1 roll 1.000000 cvr exch sub 7 1 roll 6 -1 roll 1.000000 \n" +
  6. "cvr exch sub 6 1 roll 5 -1 roll 1.000000 cvr exch sub 5 1 \n" +
  7. "roll 4 -1 roll 1.000000 cvr exch sub 4 1 roll pop pop pop }";
  8. InputStream function_4 = new ByteArrayInputStream(test.getBytes());
  9. Lexer lex = new Lexer();
  10. lex.setInputStream(function_4);
  11. lex.parse(new float[]{0.360779f, 0.094238274f, 0.00392151f});
  12. System.out.println("result: " + lex.getStack().toString());
  13. }

代码示例来源:origin: org.icepdf.os/icepdf-core

  1. public void test5() throws IOException {
  2. String test =
  3. "{2 index 1.000000 cvr exch sub 4 1 roll 1 index 1.000000 cvr exch sub \n" +
  4. "4 1 roll 0 index 1.000000 cvr exch sub 4 1 roll 1.000000 4 1 \n" +
  5. "roll 7 -1 roll 1.000000 cvr exch sub 7 1 roll 6 -1 roll 1.000000 \n" +
  6. "cvr exch sub 6 1 roll 5 -1 roll 1.000000 cvr exch sub 5 1 \n" +
  7. "roll 4 -1 roll 1.000000 cvr exch sub 4 1 roll pop pop pop }";
  8. InputStream function_4 = new ByteArrayInputStream(test.getBytes());
  9. Lexer lex = new Lexer();
  10. lex.setInputStream(function_4);
  11. lex.parse(new float[]{0.360779f, 0.094238274f, 0.00392151f});
  12. System.out.println("result: " + lex.getStack().toString());
  13. }

代码示例来源:origin: org.biopax.validator/biopax-rules

  1. @Override
  2. protected void visit(Object range, BioPAXElement domain, Model model,
  3. PropertyEditor editor) {
  4. assert range instanceof PhysicalEntity; // - because of filter and mul.cardinality
  5. if (thing.equals(range)) {
  6. error(thing, "cyclic.inclusion", false, getVisited().toString());
  7. } else if(range instanceof Complex) {
  8. traverse((Complex) range, model);
  9. }
  10. }
  11. };

代码示例来源:origin: org.biopax.validator/biopax-rules

  1. @Override
  2. protected void visit(Object range, BioPAXElement domain, Model model,
  3. PropertyEditor editor) {
  4. if (thing.equals(range)) {
  5. error(thing, "cyclic.inclusion", false, getVisited().toString());
  6. } else {
  7. traverse((BioPAXElement) range, model);
  8. }
  9. }
  10. };

代码示例来源:origin: org.icepdf.os/icepdf-core

  1. public void test1() throws IOException {
  2. String test =
  3. "{1.000000 3 1 roll 1.000000 3 1 roll 1.000000 3 1 roll 5 -1 roll \n" +
  4. "2 index -0.874500 mul 1.000000 add mul 1 index -0.098000 mul 1.000000 add mul 5 \n" +
  5. "1 roll 4 -1 roll 2 index -0.796100 mul 1.000000 add mul 1 index -0.247100 \n" +
  6. "mul 1.000000 add mul 4 1 roll 3 -1 roll 2 index -0.647100 mul 1.000000 \n" +
  7. "add mul 1 index -0.878400 mul 1.000000 add mul 3 1 roll pop pop }";
  8. ;
  9. InputStream function_4 = new ByteArrayInputStream(test.getBytes());
  10. Lexer lex = new Lexer();
  11. lex.setInputStream(function_4);
  12. lex.parse(new float[]{1.0f, 1.0f});
  13. System.out.println("result: " + lex.getStack().toString());
  14. }

代码示例来源:origin: Rsl1122/Plan-PlayerAnalytics

  1. private void testHtmlValidity(String html) {
  2. Stack<String> stack = new Stack<>();
  3. String[] split = html.split("<");
  4. for (String s : split) {
  5. if (s.startsWith("/")) {
  6. String expectedElement = stack.pop();
  7. assertTrue("Element not properly closed: " + expectedElement, s.startsWith("/" + expectedElement));
  8. } else {
  9. stack.push(s.split(" ", 2)[0].split(">", 2)[0]);
  10. }
  11. }
  12. stack.pop(); // Pop the empty string since the html string starts with <
  13. assertTrue("Stack was not empty: " + stack.toString(), stack.empty());
  14. }
  15. }

代码示例来源:origin: testIT-LivingDoc/livingdoc-core

  1. public String getMethodName() throws IllegalArgumentException, InvocationTargetException, IllegalAccessException,
  2. SystemUnderDevelopmentException {
  3. stack.clear();
  4. Message message = fixture.check(objectGraph);
  5. message.send();
  6. String s = stack.toString();
  7. return s.substring(1, s.length() - 1);
  8. }

相关文章