org.eclipse.jst.jsf.common.sets
Interface AxiomaticSet

All Superinterfaces:
java.util.Collection, java.lang.Iterable, java.util.Set
All Known Implementing Classes:
ConcreteAxiomaticSet, NodeSet

public interface AxiomaticSet
extends java.util.Set

A java.util.Set with the basic mathematic set axioms of extensionality (equality), union, intersection, relative complement (set subtraction) and empty (already supported by Set).

Provisional API - subject to change


Method Summary
 java.lang.Object getFirstElement()
           
 AxiomaticSet intersect(AxiomaticSet set)
           
 boolean isDisjoint(AxiomaticSet set)
           
 boolean isEquivalent(AxiomaticSet toSet)
          Implementations should aim to provide O(mn) time cost where n is the number of elements in this set and m is the cost to check membership of an element in this set in toSet.
 AxiomaticSet subtract(AxiomaticSet set)
          The set constructed by the removing the intersection of this with set from this.
 AxiomaticSet union(AxiomaticSet set)
           
 
Methods inherited from interface java.util.Set
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Method Detail

isEquivalent

boolean isEquivalent(AxiomaticSet toSet)
Implementations should aim to provide O(mn) time cost where n is the number of elements in this set and m is the cost to check membership of an element in this set in toSet. When a set is itself a member of a set, the implementation must call isEquivalent on those subsets recursively.

Parameters:
toSet -
Returns:
true iff this set is equivalent toSet. Note that extensionality holds that two sets are equivalent if and only if they contain exactly the same elements.

union

AxiomaticSet union(AxiomaticSet set)
Parameters:
set -
Returns:
the axiomatic union of this set with set

intersect

AxiomaticSet intersect(AxiomaticSet set)
Parameters:
set -
Returns:
the axiomatic intersection of this set with set

isDisjoint

boolean isDisjoint(AxiomaticSet set)
Parameters:
set -
Returns:
convenience method that must be equivalent to (this.intersect(set).isEmpty())

subtract

AxiomaticSet subtract(AxiomaticSet set)
The set constructed by the removing the intersection of this with set from this. The set will contain all elements in this that are not in set. Eqivalence: this - set

Parameters:
set -
Returns:
the relative complement or theoretic difference of set from this

getFirstElement

java.lang.Object getFirstElement()
Returns:
the first element in the set. There is no guarantee which element will be chosen, but the call should always return the same element of the set for multiple invocations on the same set. Generally this is a convience method for when the set only contains one element.
Throws:
java.util.NoSuchElementException - if the set is empty.