public abstract class EvalSet extends EvalResult implements Set<net.sourceforge.czt.z.ast.Expr>
EvalSet provides default implementations of several of the Set methods.
Modifier and Type | Class and Description |
---|---|
static class |
EvalSet.SubsetIterator<E>
Filters the master iterator, returning only those
elements that are members of the slave set.
|
Modifier and Type | Field and Description |
---|---|
static double |
INFINITE_SIZE
Default estimate for the approximate size of an infinite set.
|
static double |
UNKNOWN_SIZE
Default estimate for the approximate size of an unknown set.
|
Constructor and Description |
---|
EvalSet() |
Modifier and Type | Method and Description |
---|---|
<R> R |
accept(net.sourceforge.czt.util.Visitor<R> visitor) |
boolean |
add(net.sourceforge.czt.z.ast.Expr o)
Throws UnsupportedOperationException.
|
boolean |
addAll(Collection<? extends net.sourceforge.czt.z.ast.Expr> c)
Throws UnsupportedOperationException.
|
void |
clear()
Throws UnsupportedOperationException.
|
boolean |
containsAll(Collection<?> c) |
boolean |
equals(Object s2)
Tests for the equality of any two sets.
|
double |
estSize()
Estimate the size of the set.
|
double |
estSubsetSize(Envir env,
net.sourceforge.czt.z.ast.ZName elem)
Estimate the size of {x:this | x=elem} in a given environment.
|
<T> T |
getAnn(Class<T> aClass)
A copy of the TermImpl implementation.
|
net.sourceforge.czt.base.ast.ListTerm<Object> |
getAnns()
A copy of the TermImpl implementation.
|
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.
|
abstract Iterator<net.sourceforge.czt.z.ast.Expr> |
iterator()
Iterate through all members of the set.
|
abstract ListIterator<net.sourceforge.czt.z.ast.Expr> |
listIterator()
Iterate forwards/backwards through all members of the set.
|
Iterator<net.sourceforge.czt.z.ast.Expr> |
matchIterator(Map<Object,net.sourceforge.czt.z.ast.Expr> args)
Iterate through the subset of this set that unifies with
the given substructures in args.
|
BigInteger |
maxSize()
The maximum size of the set in the default environment.
|
boolean |
remove(Object o)
Throws UnsupportedOperationException.
|
boolean |
removeAll(Collection<?> c)
Throws UnsupportedOperationException.
|
boolean |
retainAll(Collection<?> c)
Throws UnsupportedOperationException.
|
abstract 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.
|
abstract String |
toString()
Each subclass should implement a nice toString.
|
create, getChildren
annsSize, getFactory, hasAnn, hasAnn, removeAnn, removeAnn
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
contains, isEmpty, size, spliterator
parallelStream, removeIf, stream
public static final double UNKNOWN_SIZE
public static final double INFINITE_SIZE
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 estSize()
EvalSet provides a default implementation that is the same as maxSize(), but converted to a double. So maxSize()==null gives EvalSet.INFINITE_SIZE here.
public double estSubsetSize(Envir env, net.sourceforge.czt.z.ast.ZName elem)
EvalSet provides a default implementation that just calls estSize().
public abstract Iterator<net.sourceforge.czt.z.ast.Expr> iterator()
public abstract ListIterator<net.sourceforge.czt.z.ast.Expr> listIterator()
public abstract Iterator<net.sourceforge.czt.z.ast.Expr> sortedIterator()
public Iterator<net.sourceforge.czt.z.ast.Expr> subsetIterator(EvalSet otherSet)
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.
public Iterator<net.sourceforge.czt.z.ast.Expr> matchIterator(Map<Object,net.sourceforge.czt.z.ast.Expr> args)
This method is intended purely to reduce the number of elements visited, so implementations are free to ignore otherSet if they wish. The result will contain no duplicates.
EvalSet provides a default implementation that calls iterator().
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<net.sourceforge.czt.z.ast.Expr>
containsAll
in interface Set<net.sourceforge.czt.z.ast.Expr>
public boolean equals(Object s2)
equals
in interface Collection<net.sourceforge.czt.z.ast.Expr>
equals
in interface Set<net.sourceforge.czt.z.ast.Expr>
equals
in class net.sourceforge.czt.z.impl.ExprImpl
public int hashCode()
hashCode
in interface Collection<net.sourceforge.czt.z.ast.Expr>
hashCode
in interface Set<net.sourceforge.czt.z.ast.Expr>
hashCode
in class net.sourceforge.czt.z.impl.ExprImpl
public boolean add(net.sourceforge.czt.z.ast.Expr o)
add
in interface Collection<net.sourceforge.czt.z.ast.Expr>
add
in interface Set<net.sourceforge.czt.z.ast.Expr>
public boolean addAll(Collection<? extends net.sourceforge.czt.z.ast.Expr> c)
addAll
in interface Collection<net.sourceforge.czt.z.ast.Expr>
addAll
in interface Set<net.sourceforge.czt.z.ast.Expr>
public void clear()
clear
in interface Collection<net.sourceforge.czt.z.ast.Expr>
clear
in interface Set<net.sourceforge.czt.z.ast.Expr>
public boolean remove(Object o)
remove
in interface Collection<net.sourceforge.czt.z.ast.Expr>
remove
in interface Set<net.sourceforge.czt.z.ast.Expr>
public boolean removeAll(Collection<?> c)
removeAll
in interface Collection<net.sourceforge.czt.z.ast.Expr>
removeAll
in interface Set<net.sourceforge.czt.z.ast.Expr>
public boolean retainAll(Collection<?> c)
retainAll
in interface Collection<net.sourceforge.czt.z.ast.Expr>
retainAll
in interface Set<net.sourceforge.czt.z.ast.Expr>
public Object[] toArray()
toArray
in interface Collection<net.sourceforge.czt.z.ast.Expr>
toArray
in interface Set<net.sourceforge.czt.z.ast.Expr>
public <T> T[] toArray(T[] a)
toArray
in interface Collection<net.sourceforge.czt.z.ast.Expr>
toArray
in interface Set<net.sourceforge.czt.z.ast.Expr>
public net.sourceforge.czt.base.ast.ListTerm<Object> getAnns()
getAnns
in interface net.sourceforge.czt.base.ast.Term
getAnns
in class net.sourceforge.czt.base.impl.TermImpl
public <T> T getAnn(Class<T> aClass)
getAnn
in interface net.sourceforge.czt.base.ast.Term
getAnn
in class net.sourceforge.czt.base.impl.TermImpl
public <R> R accept(net.sourceforge.czt.util.Visitor<R> visitor)
accept
in interface net.sourceforge.czt.base.ast.Term
accept
in class net.sourceforge.czt.z.impl.ExprImpl
public abstract String toString()
toString
in class net.sourceforge.czt.base.impl.TermImpl
Copyright © 2003–2016 Community Z Tools Project. All rights reserved.