    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class JSci.maths.DiscreteSet

    java.lang.Object
       |
       +----JSci.maths.DiscreteSet

public class DiscreteSet
extends Object
implements MathSet

The DiscreteSet class provides an encapsulation for discrete sets.

##

elements
  The set elements.

##

DiscreteSet(String)
  Constructs a discrete set.
DiscreteSet(String, Object[])
  Constructs a discrete set.

##

equals(Object)
  Compares two sets for equality.
getElement(int)
  Returns an element from within the set.
intersect(MathSet)
  Performs the intersection of this set with another.
size()
  Returns the number of elements in the set.
toString()
  Returns a string representing this set.
union(MathSet)
  Performs the union of this set with another.

##

elements

     protected Object elements[]

  The set elements.

##

DiscreteSet

     protected DiscreteSet(String aLabel)

  Constructs a discrete set.

  Parameters:
    aLabel - a label that identifies this set

DiscreteSet

     public DiscreteSet(String aLabel,
                        Object array[])

  Constructs a discrete set.

  Parameters:
    aLabel - a label that identifies this set
    array - an array containing the set elements

##

equals

     public boolean equals(Object s)

  Compares two sets for equality.

  Overrides:
    equals in class Object

toString

     public final String toString()

  Returns a string representing this set.

  Overrides:
    toString in class Object

size

     public final int size()

  Returns the number of elements in the set.

getElement

     public final Object getElement(int n)

  Returns an element from within the set.

  Parameters:
    n - index of the element

union

     public MathSet union(MathSet set)

  Performs the union of this set with another.

  Parameters:
    set - a discrete set
  Returns:
    the union of the two sets

intersect

     public MathSet intersect(MathSet set)

  Performs the intersection of this set with another.

  Parameters:
    set - a discrete set
  Returns:
    the intersection of the two sets

    All Packages  Class Hierarchy  This Package  Previous  Next  Index