|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ObjectSet
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:
sample
method
that returns an element sampled uniformly at random. This may be
faster than iterating over the set until the Nth element is
reached (for a random N).
iterator
method
on an ObjectSet returns an ObjectIterator
,
which has a special method for skipping objects that are
indistinguishable (in the underlying partial world) from the last
object returned. There is also an iterator method that takes a set of
externally distinguished objects (typically the values of
logical variables in the current scope), which are treated as
distinguishable from all other objects.
isEmpty
) but
not complete enough to define the set fully. Thus, the ObjectSet
interface includes methods canDetermineIsEmpty
,
canDetermineSize
, canDetermineContains
and canDetermineElements
. If one of these methods
returns false, then the behavior of the corresponding Set interface
method(s) is undefined.
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 |
Methods inherited from interface java.util.Set |
---|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
Field Detail |
---|
static final ObjectSet EMPTY_OBJECT_SET
static final ObjectSet UNDETERMINED_SET
Method Detail |
---|
java.lang.Object sample(int n)
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
int indexOf(java.lang.Object o)
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.
ObjectIterator iterator(java.util.Set externallyDistinguished)
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.
boolean canDetermineIsEmpty()
boolean canDetermineSize()
boolean canDetermineContains(java.lang.Object obj)
boolean canDetermineElements()
ObjectSet getExplicitVersion()
This method returns null if the underlying partial world is not complete enough to construct an explicit version of this set.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |