public class SubtypeSet extends java.lang.Object implements java.util.Set<Type>
polyglot.types.Type
.
Set membership is based on the subtype relationships. Thus, if
S
is a supertype of A
and B
, then
{ S
} union { A
, B
} =
{ S
}. Similarly, we remove elements from the set such
that if s
is an element of a set S
, then a
call to remove r
removes all s
s.t. r is a
a supertype of s.Modifier and Type | Field and Description |
---|---|
protected Type |
topType |
protected TypeSystem |
ts |
protected java.util.List<Type> |
v |
Constructor and Description |
---|
SubtypeSet(SubtypeSet s)
Creates a copy of the given SubtypeSet
|
SubtypeSet(Type top) |
SubtypeSet(Type top,
java.util.Collection<? extends Type> c) |
SubtypeSet(TypeSystem ts)
Creates an empty SubtypeSet
|
SubtypeSet(TypeSystem ts,
java.util.Collection<? extends Type> c) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(Type type)
Add an element of type
polyglot.types.Type to the set
only if it has no supertypes already in the set. |
boolean |
addAll(java.util.Collection<? extends Type> c)
Adds all elements from c into this set.
|
void |
clear()
Removes all elements from the set
|
boolean |
contains(java.lang.Object o)
Check whether object
o is in the set. |
boolean |
containsAll(java.util.Collection<?> c)
Checks whether all elements of the collection are in the set
|
boolean |
containsSubtype(Type type)
Check whether the type
t or a subtype is in the set. |
boolean |
isEmpty() |
java.util.Iterator<Type> |
iterator() |
boolean |
remove(java.lang.Object o)
Removes all elements
s in the set such that
s decends from o |
boolean |
removeAll(java.util.Collection<?> c) |
boolean |
retainAll(java.util.Collection<?> c) |
int |
size() |
java.lang.Object[] |
toArray() |
<U> U[] |
toArray(U[] a) |
java.lang.String |
toString() |
protected java.util.List<Type> v
protected TypeSystem ts
protected Type topType
public SubtypeSet(TypeSystem ts)
public SubtypeSet(Type top)
public SubtypeSet(SubtypeSet s)
public SubtypeSet(TypeSystem ts, java.util.Collection<? extends Type> c)
public boolean add(Type type)
polyglot.types.Type
to the set
only if it has no supertypes already in the set. If we do add it,
remove any subtypes of o
public boolean addAll(java.util.Collection<? extends Type> c)
public void clear()
public boolean contains(java.lang.Object o)
o
is in the set. Because of the
semantics of the subtype set, o
is in the set iff
it descends from (or is equal to) one of the elements in the set.public boolean containsSubtype(Type type)
t
or a subtype is in the set.
Returns true iff it descends from, is equal to, or is a super type of
one of the elements in the set.public boolean containsAll(java.util.Collection<?> c)
public boolean isEmpty()
public java.util.Iterator<Type> iterator()
public boolean remove(java.lang.Object o)
s
in the set such that
s
decends from o
public boolean removeAll(java.util.Collection<?> c)
public boolean retainAll(java.util.Collection<?> c)
public int size()
public java.lang.Object[] toArray()
public <U> U[] toArray(U[] a)
public java.lang.String toString()
toString
in class java.lang.Object