Interpreter.Sexp.Utils
Class SexpStack

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.Vector
                    |
                    +--java.util.Stack
                          |
                          +--Interpreter.Sexp.Utils.SexpStack

public class SexpStack
extends java.util.Stack

Un oggetto SexpStack realizza uno stack per le s-expressions.

See Also:
Serialized Form

Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
SexpStack()
           
 
Method Summary
 NumToken popNum()
          Fa una pop dallo stack controllando che sia un NumToken e lo restituisce.
 Sexp popSexp()
          Toglie la Sexp che si trova in cima allo stack e la restituisce.
 Sexp pushSexp(Sexp s)
          Aggiunge la Sexp specificata in cima allo stack.
 
Methods inherited from class java.util.Stack
empty, peek, pop, push, search
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SexpStack

public SexpStack()
Method Detail

pushSexp

public Sexp pushSexp(Sexp s)
Aggiunge la Sexp specificata in cima allo stack.
Parameters:
s - oggetto della classe Sexp che viene aggiunto allo stack.
Returns:
la Sexp aggiunta allo stack.

popSexp

public Sexp popSexp()
             throws InterpreterException
Toglie la Sexp che si trova in cima allo stack e la restituisce.
Se l'oggetto lo stack è vuoto viene generata una InterpreterException con commento "SexpStack vuoto".
Returns:
la Sexp che è stata tolta dalla cima allo stack.

popNum

public NumToken popNum()
                throws InterpreterException
Fa una pop dallo stack controllando che sia un NumToken e lo restituisce.
Se l'oggetto al top dello stack non è un NumToken viene generata una InterpreterException con commento "Domain error: expected number".
Returns:
il NumToken al top dello stack.


Codice realizzato da Francesco Geri & Marco Tamanti