public class LargeDefinitionSet extends ArrayList<IDefinition> implements IMutableDefinitionSet
IMutableDefinitionSet
that can hold an arbitrary number of definitions.
It simply extends ArrayList<IDefinition>
.
95% of definition sets contain only a single definition,
which is why DefinitionBase
implements IDefinitionSet
to make a single definition act as a set of size 1.
Most of the other 5% of definition sets contain only two
definitions, typically for a getter/setter pair;
SmallDefinitionSet
is for them.
Less than 1% of definitions sets contain more than 2 definitions
and must use this class.
modCount
Constructor and Description |
---|
LargeDefinitionSet()
Constructor
|
LargeDefinitionSet(IDefinitionSet other)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addDefinition(IDefinition definition)
Adds a definition to this set.
|
IDefinition |
getDefinition(int i)
Gets a definition in this set, by index.
|
int |
getMaxSize() |
int |
getSize() |
void |
removeDefinition(IDefinition definition)
Removes a definition from this set.
|
void |
replaceDefinition(int i,
IDefinition newDefinition)
Replaces the
IDefinition at the specified index with a new
definition. |
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeRange, retainAll, set, size, subList, toArray, toArray, trimToSize
equals, hashCode
containsAll, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
isEmpty
containsAll, equals, hashCode
public LargeDefinitionSet()
public LargeDefinitionSet(IDefinitionSet other)
public int getSize()
getSize
in interface IDefinitionSet
public int getMaxSize()
getMaxSize
in interface IDefinitionSet
public IDefinition getDefinition(int i)
IDefinitionSet
getDefinition
in interface IDefinitionSet
i
- The index of the definition.IDefinition
for the definition.public void addDefinition(IDefinition definition)
IMutableDefinitionSet
addDefinition
in interface IMutableDefinitionSet
definition
- The IDefinition
to add.public void removeDefinition(IDefinition definition)
IMutableDefinitionSet
removeDefinition
in interface IMutableDefinitionSet
definition
- The IDefinitionNode
to remove.public void replaceDefinition(int i, IDefinition newDefinition)
IMutableDefinitionSet
IDefinition
at the specified index with a new
definition.replaceDefinition
in interface IMutableDefinitionSet
i
- The index of the IDefinition
to replace.newDefinition
- The new IDefinition
to store in the set.Copyright © 2016 The Apache Software Foundation. All rights reserved.