Package java.util

Examples of java.util.Stack.peek()


    synchronized(_context) {
      Stack stack = (Stack)_context.get(Thread.currentThread());
      if (stack == null || stack.isEmpty()) {
        throw new RuntimeException("Context is missing for thread: " + Thread.currentThread());
      }
      return (Context)stack.peek();
    }
  }
 
 
  public static final void dumpStacks(PrintStream out)
View Full Code Here


    synchronized(_context) {
      Stack stack = (Stack)_context.get(Thread.currentThread());
      if (stack == null || stack.isEmpty()) {
        return null;
      } else {
        return (Context)stack.peek();
      }
    }
  } 
 
 
View Full Code Here

      if (stack == null || stack.isEmpty()) {
        Context context = new Context(zone);
        putInstance(thread, context);
        return context;
      }
      return (Context)stack.peek();
    }
  }


View Full Code Here

    synchronized(_context) {
      Stack stack = (Stack)_context.get(thread);
      if (stack == null || stack.isEmpty()) {
        throw new RuntimeException("Context is missing for thread: " + thread);
      }
      return (Context)stack.peek();
    }
  }
 
 
  public static final void putInstance(Thread thread, Context context)
View Full Code Here

    }

    public Object peek () {
      Object obj = null;
      Stack stack = (Stack)get();
      if (!stack.empty()) obj = stack.peek();
      return obj;
    }
   
    public void push (Object obj) {
      Stack stack = (Stack)get();
View Full Code Here

      return obj;
    }
   
    public void push (Object obj) {
      Stack stack = (Stack)get();
      if (!stack.empty() && obj == stack.peek()) throw new RuntimeException(obj.toString());
      stack.push(obj);
    }
   
    public Object pop () {
      Stack stack = (Stack)get();
View Full Code Here

                // if we pushed an error handler, pop it from the fault stack
                // before we exit normally without an exception
                if (errorHandlerMediator != null) {
                    Stack faultStack = synCtx.getFaultStack();
                    if (faultStack != null && !faultStack.isEmpty()) {
                        Object o = faultStack.peek();

                        if (o instanceof MediatorFaultHandler &&
                                errorHandlerMediator.equals(
                                        ((MediatorFaultHandler) o).getFaultMediator())) {
                            faultStack.pop();
View Full Code Here

  // Get the stack that contains URIs for the specified prefix
  if ((stack = (Stack)_namespaces.get(prefix)) == null) {
      _namespaces.put(prefix, stack = new Stack());
  }

  if (!stack.empty() && uri.equals(stack.peek())) {
      return false;
  }

  stack.push(uri);
  _prefixStack.push(prefix);
View Full Code Here

    /**
     * Use a namespace prefix to lookup a namespace URI
     */
    protected String lookupNamespace(String prefix) {
        final Stack stack = (Stack)_namespaces.get(prefix);
        return stack != null && !stack.isEmpty() ? (String)stack.peek() : null;
    }

    /**
     * Returns the local name of a qualified name. If the name has
     * no prefix, then it works as the identity (SAX2).
View Full Code Here

   * Returns the namespace URI that a prefix currently maps to
   */
  private String getNamespaceURI(String prefix) {
      // Get the stack associated with this namespace prefix
      final Stack stack = (Stack)_nsPrefixes.get(prefix);
      return (stack != null && !stack.empty()) ? (String) stack.peek()
    : EMPTYSTRING;
  }

  /**
   * Call this when an xml:space attribute is encountered to
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.