Generic Interpreter 0.9
Private API

gi
Class Lexicon.Set

java.lang.Object
  |
  +--gi.Lexicon.Set
Enclosing class:
Lexicon

static class Lexicon.Set
extends Object

This class implements a Set.

Version:
0.9
Author:
© 1999-2000 Craig A. Rich <carich@acm.org>

Field Summary
(package private)  Object[] elements
          The elements in this Set.
private  boolean exclude
          The null exclusion indicator.
(package private)  int size
          The size of this Set.
 
Constructor Summary
(package private) Lexicon.Set(int capacity)
          Constructs a Set with an initial capacity.
 
Method Summary
(package private)  boolean add(Lexicon.Set from, int start)
          Adds a Set of elements to this Set.
(package private)  boolean add(Object object)
          Adds an element to this Set.
(package private)  boolean append(Object object)
          Appends an element to this Set.
(package private)  boolean contains(Object object)
          Indicates if an element occurs in this Set.
 String toString()
          Returns a string representation of this Set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

elements

Object[] elements

The elements in this Set.


exclude

private final boolean exclude

The null exclusion indicator. If true, add methods will not add null to this Set.


size

int size

The size of this Set.

Constructor Detail

Lexicon.Set

Lexicon.Set(int capacity)

Constructs a Set with an initial capacity.

Parameters:
capacity - the initial capacity. The magnitude of capacity is the initial capacity. The null exclusion indicator is set to true if capacity is negative.
Method Detail

add

boolean add(Lexicon.Set from,
            int start)

Adds a Set of elements to this Set. An element 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:
from - the Set to be added.
start - the index in from beyond which elements are added.
Returns:
true if this Set is changed; false otherwise.

add

boolean add(Object object)

Adds an element to this Set. The element 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 element to be added.
Returns:
true if this Set is changed; false otherwise.

append

boolean append(Object object)

Appends an element to this Set. The element is always appended, without regard for the null exclusion indicator or whether it occurs in this Set. The capacity is expanded by 50% if necessary.

Parameters:
object - the element to be appended.
Returns:
true since this Set is changed.

contains

boolean contains(Object object)

Indicates if an element occurs in this Set.

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

toString

public String toString()

Returns a string representation of this Set.

Overrides:
toString in class Object

 

© 1999-2000 Craig A. Rich <carich@acm.org>