blog
Interface ObjectSet

All Superinterfaces:
java.util.Collection, java.lang.Iterable, java.util.Set
All Known Implementing Classes:
AbstractObjectSet, DefaultObjectSet, POPAppBasedSet

public interface ObjectSet
extends java.util.Set

Interface for sets of objects in a partial world. Each ObjectSet is backed by a particular partial world. It extends the Java Set interface in several ways:


Field Summary
static ObjectSet EMPTY_OBJECT_SET
           
static ObjectSet UNDETERMINED_SET
           
 
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.
 ObjectSet getExplicitVersion()
          Returns a version of this set that no longer reflects changes to the partial world or evaluation context.
 int indexOf(java.lang.Object o)
          Returns the number which, when passed to sample, will yield the given element of this set.
 ObjectIterator iterator(java.util.Set externallyDistinguished)
          Returns an ObjectIterator whose skipIndistinguishable method treats all of the given objects as distinguishable from all other objects, even if they are indistinguishable in the underlying partial world.
 java.lang.Object sample(int n)
          Returns an object sampled uniformly at random from this set, assuming that the given number n is sampled uniformly from the numbers 0, ..., size - 1 (where size is the size of this set).
 
Methods inherited from interface java.util.Set
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Field Detail

EMPTY_OBJECT_SET

static final ObjectSet EMPTY_OBJECT_SET

UNDETERMINED_SET

static final ObjectSet UNDETERMINED_SET
Method Detail

sample

java.lang.Object sample(int n)
Returns an object sampled uniformly at random from this set, assuming that the given number n is sampled uniformly from the numbers 0, ..., size - 1 (where size is the size of this set).

If the underlying partial world is not complete enough to fully define this set, this method returns null.

Throws:
java.lang.IllegalArgumentException - if n is less than 0 or greater than or equal to the size of this set

indexOf

int indexOf(java.lang.Object o)
Returns the number which, when passed to sample, will yield the given element of this set. If the given object is not in this set, returns -1.

If the underlying partial world is not complete enough to fully define this set, this method returns -1.


iterator

ObjectIterator iterator(java.util.Set externallyDistinguished)
Returns an ObjectIterator whose skipIndistinguishable method treats all of the given objects as distinguishable from all other objects, even if they are indistinguishable in the underlying partial world. These externally distinguishable objects are typically the values of logical variables in the current scope -- the point is that even if the partial world makes the same assertions about two objects, these objects may satisfy different formulas if one is the value of a currently bound variable and one is not.


canDetermineIsEmpty

boolean canDetermineIsEmpty()
Returns true if the underlying partial world is complete enough to determine whether this set is empty.


canDetermineSize

boolean canDetermineSize()
Returns true if the underlying partial world is complete enough to determine the size of this set.


canDetermineContains

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.


canDetermineElements

boolean canDetermineElements()
Returns true if the underlying partial world is complete enough to determine all the elements of this set.


getExplicitVersion

ObjectSet getExplicitVersion()
Returns a version of this set that no longer reflects changes to the partial world or evaluation context. It may still be backed by a world's POP application satisfier sets (so that new identifiers are added properly), but other than that, its methods will not call any methods on the underlying partial world.

This method returns null if the underlying partial world is not complete enough to construct an explicit version of this set.