il.ac.tau.cs.sw1.sortedset
Class SimpleSortedSet

java.lang.Object
  extended by il.ac.tau.cs.sw1.sortedset.SimpleSortedSet
All Implemented Interfaces:
SortedSet<java.lang.Integer>

public class SimpleSortedSet
extends java.lang.Object
implements SortedSet<java.lang.Integer>

A simple implementation of a sorted set. This class is provided as an example and for testing purposes.


Constructor Summary
SimpleSortedSet(int[] values)
          Constructs a new SimpleSortedSet with the given int array as elements of the set the elements of the set are all of type Integer, and are determined at construction of the set.
 
Method Summary
 boolean contains(java.lang.Integer element)
          Return true if this set contains the specified element.
 java.lang.Integer getMaximum()
          Return the maximal (highest) element in this set.
 java.lang.Integer getMinimum()
          Return the minimal (lowest) element in this set.
 boolean isEmpty()
          Return true if this set contains no elements.
 SortedIterator<java.lang.Integer> iterator()
          Return an iterator over the elements of this set.
static void main(java.lang.String[] args)
           
 int size()
          Return the number of elements in this set (its cardinality).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleSortedSet

public SimpleSortedSet(int[] values)
Constructs a new SimpleSortedSet with the given int array as elements of the set the elements of the set are all of type Integer, and are determined at construction of the set.

Method Detail

size

public int size()
Description copied from interface: SortedSet
Return the number of elements in this set (its cardinality).

Specified by:
size in interface SortedSet<java.lang.Integer>
Returns:
the number of elements in this set (its cardinality)

contains

public boolean contains(java.lang.Integer element)
Description copied from interface: SortedSet
Return true if this set contains the specified element.

Specified by:
contains in interface SortedSet<java.lang.Integer>
Returns:
true if this set contains the specified element

isEmpty

public boolean isEmpty()
Description copied from interface: SortedSet
Return true if this set contains no elements.

Specified by:
isEmpty in interface SortedSet<java.lang.Integer>
Returns:
true if this set contains no elements

getMinimum

public java.lang.Integer getMinimum()
Description copied from interface: SortedSet
Return the minimal (lowest) element in this set.

Specified by:
getMinimum in interface SortedSet<java.lang.Integer>
Returns:
the minimal (lowest) element in this set

getMaximum

public java.lang.Integer getMaximum()
Description copied from interface: SortedSet
Return the maximal (highest) element in this set.

Specified by:
getMaximum in interface SortedSet<java.lang.Integer>
Returns:
the maximal (highest) element in this set

iterator

public SortedIterator<java.lang.Integer> iterator()
Description copied from interface: SortedSet
Return an iterator over the elements of this set. The elements are returned in ascending order.

Specified by:
iterator in interface SortedSet<java.lang.Integer>
Returns:
an iterator over the elements in this set

main

public static void main(java.lang.String[] args)