*| [JavaECS](../../README.md) | [docs](../overview.md) | [component](./dir.md) | ComponentArray[]().md*
# Component Array
| **In this Section** |
|-|
| [About](#about) |
| [Implementation](#implementation) |
| [Constructors](#constructors) |
| [Methods](#methods) |
| [Fields](#fields) |
| [Examples](#examples)|
| [Notes](#notes)|
## About
The `ComponentArray` class defines the a common structure that all component data is stored in.
## Implementation
Associatively maps an entity to the index position of its component data.
See [ComponentArray.java](/BrychanD/JavaECS/src/branch/master/javaecs/src/main/java/nz/ac/massey/javaecs/ComponentArray.java) for the full implementation.
## Constructors
Default constructor
``` java
public ComponentArray(){}
```
## Methods
### getData
``` java
protected Object getData(int entity);
```
Gets the data Object associated with the entity. Returns `null` if the object was not found.
### insertData
``` java
protected boolean insertData(int entity, Object component);
```
Inserts the specified `component` and associates it with the entity. If the entity alread has data associated to it, then returns `false`, without adding data.
### moveData
``` java
protected int moveData(int sourceEntity, int destinationEntity);
```
'Moves' data from the `sourceEntity` to the `destinationEntity`. Actual implementation copies the data Object associated with the key, and inserts it associated with the new entity.
Returns `0` if the operation succeeded, `-1` if the object data was null, `-2` if a `NullPointerException` occurred, and `-3` if inserting the new data failed.
### removeData
``` java
protected boolean removeData(int entity);
```
Returns `true` if it removed the specified entity's data. If the entity does not exist (data isn't mapped to that entity), then returns `false`.
## Fields
### componentArray
``` java
private List