il.ac.tau.cs.software1.set
Class SimpleSortedSet

java.lang.Object
  extended by il.ac.tau.cs.software1.set.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)
          Returns true if this set contains the specified element.
 java.lang.Integer getMaximum()
          Returns the maximal (highest) element in this set.
 java.lang.Integer getMinimum()
          Returns the minimal (lowest) element in this set.
 boolean isEmpty()
          Returns true if this set contains no elements.
 SortedIterator<java.lang.Integer> iterator()
          Returns an iterator over the elements of this set.
static void main(java.lang.String[] args)
           
 int size()
          Returns 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
Returns 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
Returns 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
Returns 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
Returns 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
Returns 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
Returns 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)