Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.jstacs
Class AnnotatedEntityList<T extends AnnotatedEntity>

    java.lang.Object
      de.jstacs.AnnotatedEntityList<T>

Type Parameters:
  `T` - an extension of `AnnotatedEntity`

Direct Known Subclasses:
  ParameterSet.ParameterList

    public class AnnotatedEntityList<T extends AnnotatedEntity>

extends Object

Class for a list of `AnnotatedEntity`s where elements can be accessed either by index or by the name of the `AnnotatedEntity`.

Author:
  Jan Grau, Jens Keilwagen

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`.
`
`<E extends T> E[]`
` | `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

### AnnotatedEntityList

    public AnnotatedEntityList()

  Creates a new `AnnotatedEntityList` with an initial capacity of 10.

### AnnotatedEntityList

    public AnnotatedEntityList(int initialCapacity)

  Creates a new `AnnotatedEntityList` with given initial capacity.

  Parameters:
    `initialCapacity` - the initial capacity

Method Detail

### set

    public void set(int idx,
                    T entity)

  Replaces the `AnnotatedEntity` at index `idx` with the `AnnotatedEntity` `entity/code>

  `
  Parameters:
    `idx` - the index
    `entity` - the new `AnnotatedEntity` at index `idx`

### remove

    public T remove(int idx)

  Removes and returns the `AnnotatedEntity` at index `idx`.

  Parameters:
    `idx` - the index of the `AnnotatedEntity` to be removed
  Returns:
    the `AnnotatedEntity` that has been at index `idx`

### add

    public void add(int idx,
                    T entity)

  Adds the `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.

  Parameters:
    `idx` - the index
    `entity` - the added `AnnotatedEntity`
  See Also:
    `List.add(int, Object)`

### add

    public void add(T... entities)

  Adds all `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.

  Parameters:
    `entities` - the added `AnnotatedEntity`

### addAll

    public void addAll(Collection<? extends T> entities)

  Adds all `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.

  Parameters:
    `entities` - the added `AnnotatedEntity`

### get

    public T get(int index)

  Returns the `AnnotatedEntity` at index `index` in the list.

  Parameters:
    `index` - the index
  Returns:
    the `AnnotatedEntity` at `index`

### get

    public T get(String name)

  Returns the `AnnotatedEntity` with name `name` in the list.

  Parameters:
    `name` - the name
  Returns:
    the `AnnotatedEntity` with name `name`
  See Also:
    `AnnotatedEntity.getName()`

### size

    public int size()

  Returns the number of `AnnotatedEntity`s (not the capacity) in the `AnnotatedEntityList`.

  Returns:
    the number of `AnnotatedEntity`s

### getNames

    public String[] getNames()

  Returns the names of all `AnnotatedEntity`s in the list.

  Returns:
    the names
  See Also:
    `AnnotatedEntity.getName()`

### toArray

    public <E extends T> E[] toArray(E[] ar)

  Returns the `AnnotatedEntity`s in this list as an array. This method behaves exactly like `ArrayList.toArray(Object[])`.

  Type Parameters:
    `E` - a sub-type of `AnnotatedEntity`
  Parameters:
    `ar` - an array of the desired type
  Returns:
    the `AnnotatedEntity`s in this list as an array

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD