Package ru.curs.celesta.score
Class NamedElementHolder<T extends NamedElement>
java.lang.Object
ru.curs.celesta.score.NamedElementHolder<T>
- Type Parameters:
T- type of named elements in the collection.
- All Implemented Interfaces:
Iterable<T>,Collection<T>
public abstract class NamedElementHolder<T extends NamedElement>
extends Object
implements Collection<T>
A collection of named elements that may only contain one element per each name.
Provides uniqueness of names and access by name. For example these may be tables
in a grain, fields in a key etc.
The implementation of interface Collection is done only for the purpose of
ObjectAid utility to correctly build a UML diagram (taking a field of
NamedElementHolder type as a multi-reference).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanDeprecated.final booleanaddAll(Collection<? extends T> c) final voidaddElement(T element) Adds a named element.final voidclear()final booleanfinal booleancontainsAll(Collection<?> c) final TReturns element by name.Returns a copy of elements map only for reading.final intReturns index of element by name.final booleanisEmpty()iterator()final booleanfinal booleanremoveAll(Collection<?> c) final booleanretainAll(Collection<?> c) final intsize()final Object[]toArray()final <A> A[]toArray(A[] a) Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
Constructor Details
-
NamedElementHolder
public NamedElementHolder()
-
-
Method Details
-
getElements
Returns a copy of elements map only for reading.- Returns:
-
addElement
Adds a named element.- Parameters:
element- element to add- Throws:
ParseException- if an element with the same name already exists.
-
get
Returns element by name.- Parameters:
name- element name (identifier)- Returns:
-
getIndex
Returns index of element by name.- Parameters:
name- element name (identifier)- Returns:
-
isEmpty
public final boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<T extends NamedElement>
-
iterator
- Specified by:
iteratorin interfaceCollection<T extends NamedElement>- Specified by:
iteratorin interfaceIterable<T extends NamedElement>
-
size
public final int size()- Specified by:
sizein interfaceCollection<T extends NamedElement>
-
contains
- Specified by:
containsin interfaceCollection<T extends NamedElement>
-
toArray
- Specified by:
toArrayin interfaceCollection<T extends NamedElement>
-
toArray
public final <A> A[] toArray(A[] a) - Specified by:
toArrayin interfaceCollection<T extends NamedElement>
-
add
Deprecated.- Specified by:
addin interfaceCollection<T extends NamedElement>
-
remove
- Specified by:
removein interfaceCollection<T extends NamedElement>
-
containsAll
- Specified by:
containsAllin interfaceCollection<T extends NamedElement>
-
addAll
- Specified by:
addAllin interfaceCollection<T extends NamedElement>
-
removeAll
- Specified by:
removeAllin interfaceCollection<T extends NamedElement>
-
retainAll
- Specified by:
retainAllin interfaceCollection<T extends NamedElement>
-
clear
public final void clear()- Specified by:
clearin interfaceCollection<T extends NamedElement>
-