public final class DependencyTypeSet extends Object implements Iterable<DependencyType>
The APIs of this class are similar to that of EnumSet<DependencyType>.
Instead of using an EnumSet, we use this smaller
class which stores the dependencies as bitflags in a int field.
This class was originally designed to handle the fact that we shouldn't need to keep track of each type of dependency on each edge: if an edge has a more important dependency type we should be able to ignore the fact that it also has a less important dependency type. The idea was that this would reduce the size of the SWC catalog.
The add() was originally a bottleneck which added a dependency type
to the set, and then cleaned up the set by removing lesser dependency types that
are trumped by greater ones. (SIGNATURE trumped EXPRESSION;
INHERITANCE trumped all others.) But this meant that APIs like
allOf() didn't actually create a set that contained all the types,
Although everything seemed to work, it seemed too dangerous given the way that
sets are used for filtering of edges.
Therefore that "trumping" logic has moved to the SWC catalog writer and this class is merely a optimization.
| Modifier and Type | Method and Description |
|---|---|
void |
add(DependencyType dependencyType)
Adds a dependency type to the set.
|
void |
addAll(DependencyTypeSet otherSet)
Adds the dependencies in another set to this set.
|
static DependencyTypeSet |
allOf()
Constructs a new set with each type of dependency.
|
boolean |
contains(DependencyType dependencyType)
Determines whether this set contains the specified
dependency type.
|
static DependencyTypeSet |
copyOf(Collection<DependencyType> dependencyTypeCollection)
Constructs a new set with the specified collection of dependency
types in it.
|
static DependencyTypeSet |
copyOf(DependencyTypeSet otherTypeSet)
Constructs a copy of another
DependencyTypeSet. |
boolean |
isEmpty()
Determines if the set is empty.
|
Iterator<DependencyType> |
iterator() |
static DependencyTypeSet |
noneOf()
Constructs a new empty set.
|
static DependencyTypeSet |
of(DependencyType... types)
Constructs a new set with the specified dependency types in it.
|
String |
toString()
For debugging only.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic static DependencyTypeSet noneOf()
DependencyTypeSet.public static DependencyTypeSet allOf()
DependencyTypeSet.public static DependencyTypeSet of(DependencyType... types)
types - Zero or more parameters, each of which is a DependencyType.DependencyTypeSet.public static DependencyTypeSet copyOf(Collection<DependencyType> dependencyTypeCollection)
dependencyTypeCollection - A collection of DependencyTypes.DependencyTypeSet.public static DependencyTypeSet copyOf(DependencyTypeSet otherTypeSet)
DependencyTypeSet.otherTypeSet - The DependencyTypeSet to copy.DependencyTypeSet.public Iterator<DependencyType> iterator()
iterator in interface Iterable<DependencyType>public boolean isEmpty()
true if the set is empty.public void add(DependencyType dependencyType)
dependencyType - The DependencyType to be
added to the set.public void addAll(DependencyTypeSet otherSet)
otherSet - The other DependencyTypeSet.public boolean contains(DependencyType dependencyType)
dependencyType - A DependencyType.true if this set contains
that dependency type.Copyright © 2023 The Apache Software Foundation. All rights reserved.