blog
Class AbstractObjectSet

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet
          extended by blog.AbstractObjectSet
All Implemented Interfaces:
ObjectSet, java.lang.Iterable, java.util.Collection, java.util.Set
Direct Known Subclasses:
DefaultObjectSet, POPAppBasedSet

public abstract class AbstractObjectSet
extends java.util.AbstractSet
implements ObjectSet

Abstract implementation of the ObjectSet interface. It includes protected methods isEmptyInternal, sizeInternal, and containsInternal that return Boolean and Integer objects rather than primitive data types. Null return values indicate that the corresponding Set interface method should throw an IllegalStateException and the corresponding canDetermine method should return false.


Field Summary
 
Fields inherited from interface blog.ObjectSet
EMPTY_OBJECT_SET, UNDETERMINED_SET
 
Constructor Summary
AbstractObjectSet()
           
 
Method Summary
 boolean canDetermineContains(java.lang.Object obj)
          Returns true if the underlying partial world is complete enough to determine whether the given object is in this set.
 boolean canDetermineElements()
          Returns true if the underlying partial world is complete enough to determine all the elements of this set.
 boolean canDetermineIsEmpty()
          Returns true if the underlying partial world is complete enough to determine whether this set is empty.
 boolean canDetermineSize()
          Returns true if the underlying partial world is complete enough to determine the size of this set.
 boolean contains(java.lang.Object obj)
           
protected abstract  java.lang.Boolean containsInternal(java.lang.Object obj)
          Returns Boolean.TRUE if this set contains obj, Boolean.FALSE if this set does not contain obj, and null if the underlying partial world is not complete enough to make the distinction.
 boolean isEmpty()
           
protected  java.lang.Boolean isEmptyInternal()
          Returns Boolean.TRUE if this set is empty, Boolean.FALSE if it is not empty, and null if the underlying partial world is not complete enough to determine whether the set is empty.
 java.util.Iterator iterator()
          Returns the iterator obtained by calling iterator(Collections.EMPTY_SET): that is, an iterator that recognizes no externally distinguished objects.
static ObjectSet singleton(java.lang.Object element)
           
 int size()
           
protected abstract  java.lang.Integer sizeInternal()
          Returns the size of this set, or null if the underlying partial world is not complete enough to determine the size.
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
add, addAll, clear, containsAll, remove, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface blog.ObjectSet
getExplicitVersion, indexOf, iterator, sample
 
Methods inherited from interface java.util.Set
add, addAll, clear, containsAll, equals, hashCode, remove, removeAll, retainAll, toArray, toArray
 

Constructor Detail

AbstractObjectSet

public AbstractObjectSet()
Method Detail

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection
Specified by:
isEmpty in interface java.util.Set
Overrides:
isEmpty in class java.util.AbstractCollection

canDetermineIsEmpty

public boolean canDetermineIsEmpty()
Description copied from interface: ObjectSet
Returns true if the underlying partial world is complete enough to determine whether this set is empty.

Specified by:
canDetermineIsEmpty in interface ObjectSet

size

public int size()
Specified by:
size in interface java.util.Collection
Specified by:
size in interface java.util.Set
Specified by:
size in class java.util.AbstractCollection

canDetermineSize

public boolean canDetermineSize()
Description copied from interface: ObjectSet
Returns true if the underlying partial world is complete enough to determine the size of this set.

Specified by:
canDetermineSize in interface ObjectSet

contains

public boolean contains(java.lang.Object obj)
Specified by:
contains in interface java.util.Collection
Specified by:
contains in interface java.util.Set
Overrides:
contains in class java.util.AbstractCollection

canDetermineContains

public boolean canDetermineContains(java.lang.Object obj)
Description copied from interface: ObjectSet
Returns true if the underlying partial world is complete enough to determine whether the given object is in this set.

Specified by:
canDetermineContains in interface ObjectSet

iterator

public java.util.Iterator iterator()
Returns the iterator obtained by calling iterator(Collections.EMPTY_SET): that is, an iterator that recognizes no externally distinguished objects.

Specified by:
iterator in interface java.lang.Iterable
Specified by:
iterator in interface java.util.Collection
Specified by:
iterator in interface java.util.Set
Specified by:
iterator in class java.util.AbstractCollection

canDetermineElements

public boolean canDetermineElements()
Description copied from interface: ObjectSet
Returns true if the underlying partial world is complete enough to determine all the elements of this set.

Specified by:
canDetermineElements in interface ObjectSet

isEmptyInternal

protected java.lang.Boolean isEmptyInternal()
Returns Boolean.TRUE if this set is empty, Boolean.FALSE if it is not empty, and null if the underlying partial world is not complete enough to determine whether the set is empty.

The default implementation just uses the result of sizeInternal.


sizeInternal

protected abstract java.lang.Integer sizeInternal()
Returns the size of this set, or null if the underlying partial world is not complete enough to determine the size.


containsInternal

protected abstract java.lang.Boolean containsInternal(java.lang.Object obj)
Returns Boolean.TRUE if this set contains obj, Boolean.FALSE if this set does not contain obj, and null if the underlying partial world is not complete enough to make the distinction.


singleton

public static ObjectSet singleton(java.lang.Object element)