Generic Interpreter 1.2
Private API

gi
Class LR0_Grammar.Contexts

java.lang.Object
  extended bygi.Lexicon.Stack
      extended bygi.Lexicon.Set
          extended bygi.LR0_Grammar.Contexts
Direct Known Subclasses:
LR1_Grammar.Contexts
Enclosing class:
LR0_Grammar

static class LR0_Grammar.Contexts
extends Lexicon.Set

This class implements a set of LR(0) Contexts.

Version:
1.2
Author:
© 1999-2004 Craig A. Rich <carich@csupomona.edu>

Field Summary
(package private)  Object[] get
          The objects on this Stack.
(package private)  int size
          The number of objects on this Stack.
 
Constructor Summary
(package private) LR0_Grammar.Contexts()
          Constructs an empty set of LR(0) contexts.
 
Method Summary
private  void add(Grammar.Production p, int lookahead)
          Adds an LR(0) Context to this set of LR(0) Contexts.
(package private)  boolean add(Lexicon.Set S)
          Adds a Set of objects to this Set.
(package private)  boolean add(Lexicon.Set S, int start)
          Adds a Set of objects to this Set.
(package private)  boolean add(Object object)
          Adds an object to this Set.
(package private)  boolean contains(Object object)
          Indicates whether an object occurs in this Set.
(package private)  Object pop()
          Pops and returns the top object of this Stack.
private  void push(Grammar.Production p, int lookahead)
          Pushes an LR(0) Context onto this set of LR(0) Contexts.
(package private)  boolean push(Object object)
          Pushes an object onto this Stack.
(package private)  Object top()
          Returns the top object of this Stack.
 String toString()
          Returns the string representation of this set of LR(0) Contexts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

get

Object[] get

The objects on this Stack.


size

int size

The number of objects on this Stack.

Constructor Detail

LR0_Grammar.Contexts

LR0_Grammar.Contexts()

Constructs an empty set of LR(0) contexts.

Method Detail

add

private void add(Grammar.Production p,
                 int lookahead)

Adds an LR(0) Context to this set of LR(0) Contexts. The capacity is expanded if necessary.

Parameters:
p - the Production in the Context added.
lookahead - the lookahead position in the Context added.

push

private void push(Grammar.Production p,
                  int lookahead)

Pushes an LR(0) Context onto this set of LR(0) Contexts. The capacity is expanded by 100 if necessary.

Parameters:
p - the Production in the Context pushed.
lookahead - the lookahead position in the Context pushed.

toString

public String toString()

Returns the string representation of this set of LR(0) Contexts.

Overrides:
toString in class Lexicon.Stack
Returns:
the string representation of this set of LR(0) Contexts.

add

boolean add(Lexicon.Set S)

Adds a Set of objects to this Set. An object is not added if it occurs in this Set or it is null and the null exclusion indicator is true. The capacity is expanded if necessary.

Parameters:
S - the Set to add to this Set.
Returns:
true if this Set is changed; false otherwise.

add

boolean add(Lexicon.Set S,
            int start)

Adds a Set of objects to this Set. An object is not added if it occurs in this Set or it is null and the null exclusion indicator is true. The capacity is expanded if necessary.

Parameters:
S - the Set to add to this Set.
start - the index in S beyond which objects are added.
Returns:
true if this Set is changed; false otherwise.

add

boolean add(Object object)

Adds an object to this Set. The object is not added if it occurs in this Set or it is null and the null exclusion indicator is true. The capacity is expanded if necessary.

Parameters:
object - the object to add to this Set.
Returns:
true if this Set is changed; false otherwise.

contains

boolean contains(Object object)

Indicates whether an object occurs in this Set.

Parameters:
object - the object whose membership if requested.
Returns:
true if o occurs in this Set; false otherwise.

pop

Object pop()

Pops and returns the top object of this Stack.

Returns:
the top object of this Stack.

push

boolean push(Object object)

Pushes an object onto this Stack. The capacity is expanded by 50% if necessary.

Parameters:
object - the object to push onto this Stack.
Returns:
true indicates this Stack is changed.

top

Object top()

Returns the top object of this Stack.

Returns:
the top object of this Stack.

 

© 1999-2004 Craig A. Rich <carich@csupomona.edu>