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, trimToSizeequals, hashCodecontainsAll, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitisEmptycontainsAll, equals, hashCodepublic LargeDefinitionSet()
public LargeDefinitionSet(IDefinitionSet other)
public int getSize()
getSize in interface IDefinitionSetpublic int getMaxSize()
getMaxSize in interface IDefinitionSetpublic IDefinition getDefinition(int i)
IDefinitionSetgetDefinition in interface IDefinitionSeti - The index of the definition.IDefinition for the definition.public void addDefinition(IDefinition definition)
IMutableDefinitionSetaddDefinition in interface IMutableDefinitionSetdefinition - The IDefinition to add.public void removeDefinition(IDefinition definition)
IMutableDefinitionSetremoveDefinition in interface IMutableDefinitionSetdefinition - The IDefinitionNode to remove.public void replaceDefinition(int i,
IDefinition newDefinition)
IMutableDefinitionSetIDefinition at the specified index with a new
definition.replaceDefinition in interface IMutableDefinitionSeti - 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.