Class NpdaTransition

java.lang.Object
  extended by NpdaTransition

public class NpdaTransition
extends java.lang.Object

An NpdaTransition object models a transition in the transition graph of an npda. Please see the documentation of the Npda class for additional information about npdas.


Constructor Summary
NpdaTransition(NpdaVertex source, NpdaVertex dest, char readSymbol, char popSymbol, java.lang.String pushSymbols)
          Create a new transition with the given properties.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 NpdaVertex getDest()
           
 char getPopSymbol()
           
 java.lang.String getPushSymbols()
           
 char getReadSymbol()
           
 NpdaVertex getSource()
           
 int hashCode()
           
 boolean isValid(char readSymbol, char popSymbol)
          Determine whether this NpdaTransition is valid for the given readSymbol and popSymbol.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NpdaTransition

public NpdaTransition(NpdaVertex source,
                      NpdaVertex dest,
                      char readSymbol,
                      char popSymbol,
                      java.lang.String pushSymbols)
Create a new transition with the given properties.

Parameters:
source - the vertex from which this transition begins
dest - vertex into which this transition moves the npda
readSymbol - the symbol that must be read from the input string for this transition to be valid
popSymbol - the symbol that must be popped from the stack for this transition to the valid
pushSymbols - the symbols that will be pushed onto the stack after this transition is performed. The rightmost symbol is pushed first, and so on.
Method Detail

getSource

public NpdaVertex getSource()
Returns:
the vertex from which this transition begins

getDest

public NpdaVertex getDest()
Returns:
vertex into which this transition moves the npda

getReadSymbol

public char getReadSymbol()
Returns:
the symbol that must be read from the input string for this transition to be valid

getPopSymbol

public char getPopSymbol()
Returns:
the symbol that must be popped from the stack for this transition to the valid

getPushSymbols

public java.lang.String getPushSymbols()
Returns:
the symbols that will be pushed onto the stack after this transition is performed. The rightmost symbol is pushed first, and so on.

isValid

public boolean isValid(char readSymbol,
                       char popSymbol)
Determine whether this NpdaTransition is valid for the given readSymbol and popSymbol. That is, are we permitted to follow this transition? The answer is yes if the transition's readSymbol and popSymbol match the given parameters, except that if this is a lambda-transition, we don't require the readSymbol to match.

Parameters:
readSymbol - a symbol that has just being read from the input string
popSymbol - a symbol that has just been popped from the stack
Returns:
true if this NpdaTransition is valid for the given readSymbol and popSymbol

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object