Top Description Fields Constructors Methods
java_cup

public Class terminal_set

extends Object
Class Inheritance
Imports
java.util.BitSet

A set of terminals implemented as a bitset.
Author
Scott Hudson
Version
last updated: 11/25/95

Field Summary

Modifier and TypeField and Description
protected BitSet
_elements

Bitset to implement the actual set.

public static final terminal_set
EMPTY

Constant for the empty set.

Constructor Summary

AccessConstructor and Description
public
terminal_set()

Constructor for an empty set.

public
terminal_set(terminal_set
the set we are cloning from.
other
)

Constructor for cloning from another set.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if this changes the set.
add
(terminal
the terminal being added.
sym
)

Add a single terminal to the set.

public boolean

Returns:

true if this changes the set.
add
(terminal_set
the set being added.
other
)

Add (union) in a complete set.

public boolean
contains(terminal
the terminal symbol we are looking for.
sym
)

Determine if the set contains a particular terminal.

public boolean
contains(int
the index of the terminal in question.
indx
)

Given its index determine if the set contains a particular terminal.

public boolean
empty()

Determine if the set is empty.

public boolean
equals(terminal_set other)

Equality comparison.

public boolean
equals(Object
the reference object with which to compare.
other
)

Overrides java.lang.Object.equals.

Generic equality comparison.
public boolean
intersects(terminal_set
the other set in question.
other
)

Determine if this set intersects another.

public boolean
is_subset_of(terminal_set
the set we are testing against.
other
)

Determine if this set is an (improper) subset of another.

public boolean
is_superset_of(terminal_set
the set we are testing against.
other
)

Determine if this set is an (improper) superset of another.

protected void
not_null(Object
the object we are testing.
obj
)

Helper function to test for a null object and throw an exception if one is found.

public void
remove(terminal
the terminal being removed.
sym
)

Remove a terminal if it is in the set.

public String
toString()

Overrides java.lang.Object.toString.

Convert to string.
Inherited from java.lang.Object:
clonefinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

_elementsback to summary
protected BitSet _elements

Bitset to implement the actual set.

EMPTYback to summary
public static final terminal_set EMPTY

Constant for the empty set.

Constructor Detail

terminal_setback to summary
public terminal_set()

Constructor for an empty set.

terminal_setback to summary
public terminal_set(terminal_set other) throws internal_error

Constructor for cloning from another set.

Parameters
other:terminal_set

the set we are cloning from.

Method Detail

addback to summary
public boolean add(terminal sym) throws internal_error

Add a single terminal to the set.

Parameters
sym:terminal

the terminal being added.

Returns:boolean

true if this changes the set.

addback to summary
public boolean add(terminal_set other) throws internal_error

Add (union) in a complete set.

Parameters
other:terminal_set

the set being added.

Returns:boolean

true if this changes the set.

containsback to summary
public boolean contains(terminal sym) throws internal_error

Determine if the set contains a particular terminal.

Parameters
sym:terminal

the terminal symbol we are looking for.

containsback to summary
public boolean contains(int indx)

Given its index determine if the set contains a particular terminal.

Parameters
indx:int

the index of the terminal in question.

emptyback to summary
public boolean empty()

Determine if the set is empty.

equalsback to summary
public boolean equals(terminal_set other)

Equality comparison.

equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

Generic equality comparison.

Parameters
other:Object

Doc from java.lang.Object.equals.

the reference object with which to compare.

Returns:boolean

Doc from java.lang.Object.equals.

true if this object is the same as the obj argument; false otherwise.

intersectsback to summary
public boolean intersects(terminal_set other) throws internal_error

Determine if this set intersects another.

Parameters
other:terminal_set

the other set in question.

is_subset_ofback to summary
public boolean is_subset_of(terminal_set other) throws internal_error

Determine if this set is an (improper) subset of another.

Parameters
other:terminal_set

the set we are testing against.

is_superset_ofback to summary
public boolean is_superset_of(terminal_set other) throws internal_error

Determine if this set is an (improper) superset of another.

Parameters
other:terminal_set

the set we are testing against.

not_nullback to summary
protected void not_null(Object obj) throws internal_error

Helper function to test for a null object and throw an exception if one is found.

Parameters
obj:Object

the object we are testing.

removeback to summary
public void remove(terminal sym) throws internal_error

Remove a terminal if it is in the set.

Parameters
sym:terminal

the terminal being removed.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Convert to string.

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object.