java.util.EmptyStackException Java Examples
The following examples show how to use
java.util.EmptyStackException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ArrayStack.java From Tomcat8-Source-Read with MIT License | 6 votes |
/** * Returns the top item off of this stack without removing it. * * @return the top item on the stack * @throws EmptyStackException if the stack is empty */ public E peek() throws EmptyStackException { int n = size(); if (n <= 0) { throw new EmptyStackException(); } else { return get(n - 1); } }
Example #2
Source File: FunctionContentBuilder.java From fuzzyc2cpg with GNU Lesser General Public License v3.0 | 6 votes |
private void introduceCalleeNode() { CallExpression expr; try { expr = (CallExpression) stack.peek(); } catch (EmptyStackException ex) { return; } AstNode child = expr.getChild(0); if (child == null) { return; } Callee callee = new Callee(); callee.addChild(child); expr.replaceFirstChild(callee); }
Example #3
Source File: Digester.java From Tomcat8-Source-Read with MIT License | 6 votes |
/** * Process notification that a namespace prefix is going out of scope. * * @param prefix Prefix that is going out of scope * * @exception SAXException if a parsing error is to be reported */ @Override public void endPrefixMapping(String prefix) throws SAXException { if (saxLog.isDebugEnabled()) { saxLog.debug("endPrefixMapping(" + prefix + ")"); } // Deregister this prefix mapping ArrayStack<String> stack = namespaces.get(prefix); if (stack == null) { return; } try { stack.pop(); if (stack.empty()) namespaces.remove(prefix); } catch (EmptyStackException e) { throw createSAXException("endPrefixMapping popped too many times"); } }
Example #4
Source File: SystemLogHandler.java From Tomcat8-Source-Read with MIT License | 6 votes |
/** * Start capturing thread's output. */ public static void startCapture() { CaptureLog log = null; if (!reuse.isEmpty()) { try { log = reuse.pop(); } catch (EmptyStackException e) { log = new CaptureLog(); } } else { log = new CaptureLog(); } Stack<CaptureLog> stack = logs.get(); if (stack == null) { stack = new Stack<>(); logs.set(stack); } stack.push(log); }
Example #5
Source File: ObjectStack.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Sets an object at a the top of the statck * * * @param val object to set at the top * @throws EmptyStackException if this stack is empty. */ public void setTop(Object val) { try { m_map[m_firstFree - 1] = val; } catch (ArrayIndexOutOfBoundsException e) { throw new EmptyStackException(); } }
Example #6
Source File: IntStack.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * Looks at the object at the position the stack counting down n items. * * @param n The number of items down, indexed from zero. * @return the object at n items down. * @throws EmptyStackException if this stack is empty. */ public int peek(int n) { try { return m_map[m_firstFree-(1+n)]; } catch (ArrayIndexOutOfBoundsException e) { throw new EmptyStackException(); } }
Example #7
Source File: IntStack.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Sets an object at a the top of the statck * * * @param val object to set at the top * @throws EmptyStackException if this stack is empty. */ public void setTop(int val) { try { m_map[m_firstFree - 1] = val; } catch (ArrayIndexOutOfBoundsException e) { throw new EmptyStackException(); } }
Example #8
Source File: IntStack.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Looks at the object at the top of this stack without removing it * from the stack. * * @return the object at the top of this stack. * @throws EmptyStackException if this stack is empty. */ public final int peek() { try { return m_map[m_firstFree - 1]; } catch (ArrayIndexOutOfBoundsException e) { throw new EmptyStackException(); } }
Example #9
Source File: ObjectStack.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Looks at the object at the position the stack counting down n items. * * @param n The number of items down, indexed from zero. * @return the object at n items down. * @throws EmptyStackException if this stack is empty. */ public Object peek(int n) { try { return m_map[m_firstFree-(1+n)]; } catch (ArrayIndexOutOfBoundsException e) { throw new EmptyStackException(); } }
Example #10
Source File: IntStack.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Looks at the object at the position the stack counting down n items. * * @param n The number of items down, indexed from zero. * @return the object at n items down. * @throws EmptyStackException if this stack is empty. */ public int peek(int n) { try { return m_map[m_firstFree-(1+n)]; } catch (ArrayIndexOutOfBoundsException e) { throw new EmptyStackException(); } }
Example #11
Source File: DelegateImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public POA poa(Servant self) { try { return (POA)orb.peekInvocationInfo().oa(); } catch (EmptyStackException exception){ POA returnValue = factory.lookupPOA(self); if (returnValue != null) { return returnValue; } throw wrapper.noContext( exception ) ; } }
Example #12
Source File: DelegateImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public byte[] object_id(Servant self) { try{ return orb.peekInvocationInfo().id(); } catch (EmptyStackException exception){ throw wrapper.noContext(exception) ; } }
Example #13
Source File: DelegateImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public boolean non_existent(Servant self) { //REVISIT try{ byte[] oid = orb.peekInvocationInfo().id(); if( oid == null) return true; else return false; } catch (EmptyStackException exception){ throw wrapper.noContext(exception) ; } }
Example #14
Source File: ObjectStack.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Sets an object at a the top of the statck * * * @param val object to set at the top * @throws EmptyStackException if this stack is empty. */ public void setTop(Object val) { try { m_map[m_firstFree - 1] = val; } catch (ArrayIndexOutOfBoundsException e) { throw new EmptyStackException(); } }
Example #15
Source File: RepositoryIdCache.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public final synchronized RepositoryId popId() { try { return (RepositoryId)super.pop(); } catch(EmptyStackException e) { increasePool(5); return (RepositoryId)super.pop(); } }
Example #16
Source File: ObjectStack.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Looks at the object at the position the stack counting down n items. * * @param n The number of items down, indexed from zero. * @return the object at n items down. * @throws EmptyStackException if this stack is empty. */ public Object peek(int n) { try { return m_map[m_firstFree-(1+n)]; } catch (ArrayIndexOutOfBoundsException e) { throw new EmptyStackException(); } }
Example #17
Source File: RepositoryIdCache.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public final synchronized RepositoryId popId() { try { return (RepositoryId)super.pop(); } catch(EmptyStackException e) { increasePool(5); return (RepositoryId)super.pop(); } }
Example #18
Source File: ObjectStack.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Looks at the object at the top of this stack without removing it * from the stack. * * @return the object at the top of this stack. * @throws EmptyStackException if this stack is empty. */ public Object peek() { try { return m_map[m_firstFree - 1]; } catch (ArrayIndexOutOfBoundsException e) { throw new EmptyStackException(); } }
Example #19
Source File: SofaTracerThreadLocalTraceContext.java From sofa-tracer with Apache License 2.0 | 5 votes |
@Override public SofaTracerSpan getCurrentSpan() throws EmptyStackException { if (this.isEmpty()) { return null; } return threadLocal.get(); }
Example #20
Source File: ObjectStack.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Looks at the object at the top of this stack without removing it * from the stack. * * @return the object at the top of this stack. * @throws EmptyStackException if this stack is empty. */ public Object peek() { try { return m_map[m_firstFree - 1]; } catch (ArrayIndexOutOfBoundsException e) { throw new EmptyStackException(); } }
Example #21
Source File: ObjectStack.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Looks at the object at the position the stack counting down n items. * * @param n The number of items down, indexed from zero. * @return the object at n items down. * @throws EmptyStackException if this stack is empty. */ public Object peek(int n) { try { return m_map[m_firstFree-(1+n)]; } catch (ArrayIndexOutOfBoundsException e) { throw new EmptyStackException(); } }
Example #22
Source File: IntStack.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Looks at the object at the top of this stack without removing it * from the stack. * * @return the object at the top of this stack. * @throws EmptyStackException if this stack is empty. */ public final int peek() { try { return m_map[m_firstFree - 1]; } catch (ArrayIndexOutOfBoundsException e) { throw new EmptyStackException(); } }
Example #23
Source File: IntStack.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Looks at the object at the position the stack counting down n items. * * @param n The number of items down, indexed from zero. * @return the object at n items down. * @throws EmptyStackException if this stack is empty. */ public int peek(int n) { try { return m_map[m_firstFree-(1+n)]; } catch (ArrayIndexOutOfBoundsException e) { throw new EmptyStackException(); } }
Example #24
Source File: IntStack.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Sets an object at a the top of the statck * * * @param val object to set at the top * @throws EmptyStackException if this stack is empty. */ public void setTop(int val) { try { m_map[m_firstFree - 1] = val; } catch (ArrayIndexOutOfBoundsException e) { throw new EmptyStackException(); } }
Example #25
Source File: ArrayStack.java From Penetration_Testing_POC with Apache License 2.0 | 5 votes |
/** * Returns the top item off of this stack without removing it. * * @return the top item on the stack * @throws EmptyStackException if the stack is empty */ public Object peek() throws EmptyStackException { int n = size(); if (n <= 0) { throw new EmptyStackException(); } else { return get(n - 1); } }
Example #26
Source File: RepositoryIdCache.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public final synchronized RepositoryId popId() { try { return (RepositoryId)super.pop(); } catch(EmptyStackException e) { increasePool(5); return (RepositoryId)super.pop(); } }
Example #27
Source File: SofaTracerThreadLocalTraceContext.java From sofa-tracer with Apache License 2.0 | 5 votes |
@Override public SofaTracerSpan pop() throws EmptyStackException { if (this.isEmpty()) { return null; } SofaTracerSpan sofaTracerSpan = threadLocal.get(); //remove this.clear(); return sofaTracerSpan; }
Example #28
Source File: DelegateImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public boolean non_existent(Servant self) { //REVISIT try{ byte[] oid = orb.peekInvocationInfo().id(); if( oid == null) return true; else return false; } catch (EmptyStackException exception){ throw wrapper.noContext(exception) ; } }
Example #29
Source File: CallStack.java From ehacks-pro with GNU General Public License v3.0 | 5 votes |
public NameSpace pop() { try { return stack.pop(); } catch (EmptyStackException e) { throw new InterpreterError("pop on empty CallStack"); } }
Example #30
Source File: DelegateImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public byte[] object_id(Servant self) { try{ return orb.peekInvocationInfo().id(); } catch (EmptyStackException exception){ throw wrapper.noContext(exception) ; } }