|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.jstacs.AnnotatedEntityList<T>
T
- an extension of AnnotatedEntity
public class AnnotatedEntityList<T extends AnnotatedEntity>
Class for a list of AnnotatedEntity
s where
elements can be accessed either by index or by the name
of the AnnotatedEntity
.
Constructor Summary | |
---|---|
AnnotatedEntityList()
Creates a new AnnotatedEntityList with an initial
capacity of 10. |
|
AnnotatedEntityList(int initialCapacity)
Creates a new AnnotatedEntityList with given initial
capacity. |
Method Summary | ||
---|---|---|
void |
add(int idx,
T entity)
Adds the AnnotatedEntity entity
at index idx to the list. |
|
void |
add(T... entities)
Adds all AnnotatedEntity s in entities
to the list. |
|
void |
addAll(Collection<? extends T> entities)
Adds all AnnotatedEntity s in entities
to the list. |
|
T |
get(int index)
Returns the AnnotatedEntity at index index
in the list. |
|
T |
get(String name)
Returns the AnnotatedEntity with name name
in the list. |
|
String[] |
getNames()
Returns the names of all AnnotatedEntity s in the list. |
|
T |
remove(int idx)
Removes and returns the AnnotatedEntity at index idx . |
|
void |
set(int idx,
T entity)
Replaces the AnnotatedEntity at index idx with
the AnnotatedEntity entity/code> |
|
int |
size()
Returns the number of AnnotatedEntity s (not the capacity)
in the AnnotatedEntityList . |
|
|
toArray(E[] ar)
Returns the AnnotatedEntity s in this list
as an array. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AnnotatedEntityList()
AnnotatedEntityList
with an initial
capacity of 10.
public AnnotatedEntityList(int initialCapacity)
AnnotatedEntityList
with given initial
capacity.
initialCapacity
- the initial capacityMethod Detail |
---|
public void set(int idx, T entity)
AnnotatedEntity
at index idx
with
the AnnotatedEntity
entity/code>
- Parameters:
idx
- the indexentity
- the new AnnotatedEntity
at index idx
public T remove(int idx)
AnnotatedEntity
at index idx
.
idx
- the index of the AnnotatedEntity
to be removed
AnnotatedEntity
that has been at index idx
public void add(int idx, T entity)
AnnotatedEntity
entity
at index idx
to the list. If entities
contains AnnotatedEntity
s with duplicate names,
or an AnnotatedEntity
with identical name already exists in the list,
an IllegalArgumentException
is thrown.
idx
- the indexentity
- the added AnnotatedEntity
List.add(int, Object)
public void add(T... entities)
AnnotatedEntity
s in entities
to the list. If entities
contains AnnotatedEntity
s with duplicate names,
or an AnnotatedEntity
with identical name already exists in the list,
an IllegalArgumentException
is thrown.
entities
- the added AnnotatedEntity
public void addAll(Collection<? extends T> entities)
AnnotatedEntity
s in entities
to the list. If entities
contains AnnotatedEntity
s with duplicate names,
or an AnnotatedEntity
with identical name already exists in the list,
an IllegalArgumentException
is thrown.
entities
- the added AnnotatedEntity
public T get(int index)
AnnotatedEntity
at index index
in the list.
index
- the index
AnnotatedEntity
at index
public T get(String name)
AnnotatedEntity
with name name
in the list.
name
- the name
AnnotatedEntity
with name name
AnnotatedEntity.getName()
public int size()
AnnotatedEntity
s (not the capacity)
in the AnnotatedEntityList
.
AnnotatedEntity
spublic String[] getNames()
AnnotatedEntity
s in the list.
AnnotatedEntity.getName()
public <E extends T> E[] toArray(E[] ar)
AnnotatedEntity
s in this list
as an array. This method behaves exactly like ArrayList.toArray(Object[])
.
E
- a sub-type of AnnotatedEntity
ar
- an array of the desired type
AnnotatedEntity
s in this list as an array
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |