public abstract class DefaultEvalSet extends EvalSet
Modifier and Type | Class and Description |
---|---|
static class |
DefaultEvalSet.SubsetIterator<E>
Filters the master iterator, returning only those
elements that are members of the slave set.
|
Modifier and Type | Field and Description |
---|---|
protected List<net.sourceforge.czt.z.ast.Expr> |
memberList_
The list of known members so far.
|
INFINITE_SIZE, UNKNOWN_SIZE
Constructor and Description |
---|
DefaultEvalSet() |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Object expr)
Tests for membership of the set.
|
boolean |
equals(Object s2)
Tests for the equality of any two sets.
|
double |
estSubsetSize(Envir env,
net.sourceforge.czt.z.ast.ZName elem)
Estimate the size of {x:this | x=elem} in a given environment.
|
protected void |
evaluateFully()
This ensures that the set is completely evaluated and
stored in the memberSet_ data structure.
|
BigInteger |
getLower()
The lower bound on numeric elements, if any, else null.
|
BigInteger |
getUpper()
The upper bound on numeric elements, if any, else null.
|
int |
hashCode()
This hashCode implementation returns a constant!
The semantics of EvalSet is that its value depends only
upon its members, but we do not want to have to evaluate
all the members before calculating the hashCode, and
it is not very useful (or desirable) to evaluate just
a few members.
|
boolean |
isEmpty() |
Iterator<net.sourceforge.czt.z.ast.Expr> |
iterator()
Enumerates the members of the set.
|
ListIterator<net.sourceforge.czt.z.ast.Expr> |
listIterator()
Iterate forwards/backwards through all members of the set.
|
BigInteger |
maxSize()
The maximum size of the set in the default environment.
|
protected abstract net.sourceforge.czt.z.ast.Expr |
nextMember()
Returns the next expression in the set.
|
protected void |
resetResult()
This resets any cached results.
|
int |
size()
Returns the exact size (cardinality) of the set.
|
Iterator<net.sourceforge.czt.z.ast.Expr> |
sortedIterator()
Iterate through all members of the set in sorted order.
|
Iterator<net.sourceforge.czt.z.ast.Expr> |
subsetIterator(EvalSet otherSet)
Iterate through the intersection of this set
and the 'other' set.
|
Object[] |
toArray()
Returns an array containing all of the elements in this set.
|
<T> T[] |
toArray(T[] a)
Returns an array containing all of the elements in this set.
|
accept, add, addAll, clear, containsAll, estSize, getAnn, getAnns, matchIterator, remove, removeAll, retainAll, toString
create, getChildren
annsSize, getFactory, hasAnn, hasAnn, removeAnn, removeAnn
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
spliterator
parallelStream, removeIf, stream
protected List<net.sourceforge.czt.z.ast.Expr> memberList_
public BigInteger getLower()
FlatEvalSet provides a default implementation that always returns null.
public BigInteger getUpper()
EvalSet provides a default implementation that always returns null.
public BigInteger maxSize()
EvalSet provides a default implementation that always returns null.
public double estSubsetSize(Envir env, net.sourceforge.czt.z.ast.ZName elem)
EvalSet provides a default implementation that just calls estSize().
estSubsetSize
in class EvalSet
public int size()
public Iterator<net.sourceforge.czt.z.ast.Expr> iterator()
iterator
in interface Iterable<net.sourceforge.czt.z.ast.Expr>
iterator
in interface Collection<net.sourceforge.czt.z.ast.Expr>
iterator
in interface Set<net.sourceforge.czt.z.ast.Expr>
iterator
in class EvalSet
public Iterator<net.sourceforge.czt.z.ast.Expr> sortedIterator()
EvalSet
sortedIterator
in class EvalSet
public ListIterator<net.sourceforge.czt.z.ast.Expr> listIterator()
EvalSet
listIterator
in class EvalSet
public Iterator<net.sourceforge.czt.z.ast.Expr> subsetIterator(EvalSet otherSet)
EvalSet
EvalSet provides a default implementation that it iterates through the smaller of the two sets and checks membership in the other. TODO: add unit tests for this.
subsetIterator
in class EvalSet
public boolean contains(Object expr)
expr
- The fully evaluated expression.public boolean isEmpty()
public boolean equals(Object s2)
public int hashCode()
protected abstract net.sourceforge.czt.z.ast.Expr nextMember()
memberSet_
.protected void evaluateFully()
protected void resetResult()
public Object[] toArray()
public <T> T[] toArray(T[] a)
Copyright © 2003–2016 Community Z Tools Project. All rights reserved.