|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object polyglot.util.SubtypeSet
public class SubtypeSet
Class to implement sets containing 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
}. Similarily, 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.
Constructor Summary | |
---|---|
SubtypeSet(SubtypeSet s)
Creates a copy of the given SubtypeSet |
|
SubtypeSet(Type top)
|
|
SubtypeSet(Type top,
java.util.Collection c)
|
|
SubtypeSet(TypeSystem ts)
Creates an empty SubtypeSet |
|
SubtypeSet(TypeSystem ts,
java.util.Collection c)
|
Method Summary | |
---|---|
boolean |
add(java.lang.Object o)
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 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 |
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()
|
java.lang.Object[] |
toArray(java.lang.Object[] a)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Set |
---|
equals, hashCode |
Constructor Detail |
---|
public SubtypeSet(TypeSystem ts)
public SubtypeSet(Type top)
public SubtypeSet(SubtypeSet s)
public SubtypeSet(TypeSystem ts, java.util.Collection c)
public SubtypeSet(Type top, java.util.Collection c)
Method Detail |
---|
public boolean add(java.lang.Object o)
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
add
in interface java.util.Collection
add
in interface java.util.Set
o
- The element to add.public boolean addAll(java.util.Collection c)
addAll
in interface java.util.Collection
addAll
in interface java.util.Set
public void clear()
clear
in interface java.util.Collection
clear
in interface java.util.Set
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.
contains
in interface java.util.Collection
contains
in interface java.util.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)
containsAll
in interface java.util.Collection
containsAll
in interface java.util.Set
public boolean isEmpty()
isEmpty
in interface java.util.Collection
isEmpty
in interface java.util.Set
public java.util.Iterator iterator()
iterator
in interface java.lang.Iterable
iterator
in interface java.util.Collection
iterator
in interface java.util.Set
public boolean remove(java.lang.Object o)
s
in the set such that
s
decends from o
remove
in interface java.util.Collection
remove
in interface java.util.Set
public boolean removeAll(java.util.Collection c)
removeAll
in interface java.util.Collection
removeAll
in interface java.util.Set
public boolean retainAll(java.util.Collection c)
retainAll
in interface java.util.Collection
retainAll
in interface java.util.Set
public int size()
size
in interface java.util.Collection
size
in interface java.util.Set
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection
toArray
in interface java.util.Set
public java.lang.Object[] toArray(java.lang.Object[] a)
toArray
in interface java.util.Collection
toArray
in interface java.util.Set
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |