com.sap.ip.me.api.services
Interface MeTreeSet


public interface MeTreeSet

This class guarantees that the sorted set will be in ascending element order, sorted according to the natural order of the elements (see Comparable ), or by the comparator provided at set creation time, depending on which constructor is used.

This implementation provides guaranteed log(n) time cost for the basic operations (add ).

Note that the ordering maintained by a set (whether or not an explicit comparator is provided) must be consistent with equals if it is to correctly implement the Set interface. (See Comparable or Comparator for a precise definition of consistent with equals .) This is so because the Set interface is defined in terms of the equals operation, but a TreeSet instance performs all key comparisons using its compareTo (or compare ) method, so two keys that are deemed equal by this method are, from the standpoint of the set, equal. The behavior of a set is well-defined even if its ordering is inconsistent with equals; it just fails to obey the general contract of the Set interface.

Note that this implementation is not synchronized. If multiple threads access a set concurrently, and at least one of the threads modifies the set, it must be synchronized externally. This is typically accomplished by synchronizing on some object that naturally encapsulates the set.

Author:
d021419

Method Summary
 void add(MeIterator iterator)
          Adds all elements of the specified iterator to this set.
 void add(java.lang.Object object)
          Adds the specified element to this set.
 MeComparator comparator()
          Returns the comparator used to order this sorted set.
 MeIterator iterator()
          Returns an iterator over the elements in this set.
 int size()
          Returns the number of elements in this set (its cardinality).
 

Method Detail

add

public void add(java.lang.Object object)
Adds the specified element to this set.

Parameters:
object - Description of the Parameter
Throws:
java.lang.ClassCastException - if the specified object cannot be compared with the elements currently in the set.

size

public int size()
Returns the number of elements in this set (its cardinality).

Returns:
the number of elements in this set (its cardinality).

add

public void add(MeIterator iterator)
Adds all elements of the specified iterator to this set.

Parameters:
iterator - Description of the Parameter
Throws:
java.lang.ClassCastException - if the specified object cannot be compared with the elements currently in the set.

iterator

public MeIterator iterator()
Returns an iterator over the elements in this set. The elements are returned in ascending order (according to its comparator instance).

Returns:
an iterator over the elements in this set.

comparator

public MeComparator comparator()
Returns the comparator used to order this sorted set.

Returns:
the comparator used to order this sorted set.


Copyright © 2005 SAP AG. All Rights Reserved.