org.sc3d.apt.sss.v3
Class NDFA.Transition

java.lang.Object
  extended by org.sc3d.apt.sss.v3.NDFA.Transition
Enclosing class:
NDFA

public static class NDFA.Transition
extends java.lang.Object

Represents a transition of an NDFA. Instances are immutable, except for the 'ndfa' field which should be filled in by the caller when it is first needed.


Field Summary
 Grammar g
          A Grammar describing the Tree that is constructed by following this Transition, or 'null'.
 NDFA ndfa
          An NDFA describing the grammar of the contents of the bracket, if this is a 'bracket shift' Transition and its NDFA has already been calculated, or 'null' if this is not a 'bracket shift' Transition or the value has not yet been calculated.
 Grammar.Production p
          A Grammar.Production to apply when following this 'reduce' Transition, or 'null' if this is not a 'reduce' Transition.
 NDFA.State to
          The State to which this Transition leads.
 
Constructor Summary
NDFA.Transition(NDFA.State to)
          Constructs a 'no-op' Transition, given values for its non-null fields.
NDFA.Transition(NDFA.State to, Grammar.NonTerminal g)
          Constructs an 'open' Transition, given values for its non-null fields.
NDFA.Transition(NDFA.State to, Grammar.Production p)
          Constructs a 'reduce' Transition, given values for its non-null fields.
NDFA.Transition(NDFA.State to, Grammar.Terminal g)
          Constructs a 'shift' Transition (bracket or otherwise), given values for its non-null fields.
 
Method Summary
 java.lang.String toString()
          Returns a brief decription of this Transition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

to

public final NDFA.State to
The State to which this Transition leads. This field is never null.


g

public final Grammar g
A Grammar describing the Tree that is constructed by following this Transition, or 'null'. Specifically:


p

public final Grammar.Production p
A Grammar.Production to apply when following this 'reduce' Transition, or 'null' if this is not a 'reduce' Transition.


ndfa

public NDFA ndfa
An NDFA describing the grammar of the contents of the bracket, if this is a 'bracket shift' Transition and its NDFA has already been calculated, or 'null' if this is not a 'bracket shift' Transition or the value has not yet been calculated. Calculating the NDFA is the caller's responsibility, but it involves nothing more complicated than calling 'make()'.

Constructor Detail

NDFA.Transition

public NDFA.Transition(NDFA.State to)
Constructs a 'no-op' Transition, given values for its non-null fields.


NDFA.Transition

public NDFA.Transition(NDFA.State to,
                       Grammar.Terminal g)
Constructs a 'shift' Transition (bracket or otherwise), given values for its non-null fields.


NDFA.Transition

public NDFA.Transition(NDFA.State to,
                       Grammar.NonTerminal g)
Constructs an 'open' Transition, given values for its non-null fields.


NDFA.Transition

public NDFA.Transition(NDFA.State to,
                       Grammar.Production p)
Constructs a 'reduce' Transition, given values for its non-null fields.

Method Detail

toString

public java.lang.String toString()
Returns a brief decription of this Transition. Specifically, returns "No-op" or "Open", or "Shift[x]" where "x" is 'g.toString()', or "Reduce[x]" where "x" is 'p.name'.

Overrides:
toString in class java.lang.Object