org.eclipse.jst.jsf.common.sets
Class ConcreteAxiomaticSet

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by java.util.HashSet
              extended by org.eclipse.jst.jsf.common.sets.ConcreteAxiomaticSet
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.Set, AxiomaticSet

public class ConcreteAxiomaticSet
extends java.util.HashSet
implements AxiomaticSet

Implements a simple axiomatic set based on a hashset

Provisional API - subject to change

See Also:
Serialized Form

Constructor Summary
ConcreteAxiomaticSet()
           
 
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 class java.util.HashSet
add, clear, clone, contains, isEmpty, iterator, remove, size
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Constructor Detail

ConcreteAxiomaticSet

public ConcreteAxiomaticSet()
Method Detail

intersect

public AxiomaticSet intersect(AxiomaticSet set)
Specified by:
intersect in interface AxiomaticSet
Returns:
the axiomatic intersection of this set with set

isEquivalent

public boolean isEquivalent(AxiomaticSet toSet)
Description copied from interface: AxiomaticSet
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.

Specified by:
isEquivalent in interface AxiomaticSet
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

public AxiomaticSet union(AxiomaticSet set)
Specified by:
union in interface AxiomaticSet
Returns:
the axiomatic union of this set with set

isDisjoint

public boolean isDisjoint(AxiomaticSet set)
Specified by:
isDisjoint in interface AxiomaticSet
Returns:
convenience method that must be equivalent to (this.intersect(set).isEmpty())

getFirstElement

public java.lang.Object getFirstElement()
Specified by:
getFirstElement in interface AxiomaticSet
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.

subtract

public AxiomaticSet subtract(AxiomaticSet set)
Description copied from interface: AxiomaticSet
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

Specified by:
subtract in interface AxiomaticSet
Returns:
the relative complement or theoretic difference of set from this