Changed descriptions for most files
Brought in-line to the docstrings
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
| [Notes](#notes)|
|
||||
|
||||
## About
|
||||
Controls adding and removing entities, and registration and deregistration of components to specific entities.
|
||||
Controls adding and removing entities, and registration and unregistration of components to specific entities.
|
||||
|
||||
## Implementation
|
||||
Before attempting to use a system, it must be registered.
|
||||
@@ -22,14 +22,14 @@ See [EntityManager.java](/BrychanD/JaveECS/src/branch/master/javaecs/src/main/ja
|
||||
|
||||
## Constructors
|
||||
``` java
|
||||
public EntityManager(){}
|
||||
protected EntityManager(){}
|
||||
```
|
||||
The default constructor initialises [unusedEntities](#unusedEntities) to a new queue containing `1024` unique integers.
|
||||
The default constructor initialises [unusedEntities](#unusedEntities) to a new queue containing [maxSize](#maxSize) (`1024`) unique integers.
|
||||
|
||||
<br>
|
||||
|
||||
``` java
|
||||
public EntityManager(int maxEntities){}
|
||||
protected EntityManager(int maxEntities){}
|
||||
```
|
||||
Initialises [unusedEntities](#unusedEntities) to a new queue containing `maxEntities` unique integers.
|
||||
|
||||
@@ -38,7 +38,7 @@ Initialises [unusedEntities](#unusedEntities) to a new queue containing `maxEnti
|
||||
## Methods
|
||||
### addEntity
|
||||
``` java
|
||||
public Integer addEntity();
|
||||
protected Integer addEntity();
|
||||
```
|
||||
Pops the next available entity index off the queue, and returns its value.
|
||||
|
||||
@@ -46,17 +46,27 @@ Returns `-1` if there is no remaining unused entities.
|
||||
|
||||
<br>
|
||||
|
||||
### getMaxSize
|
||||
``` java
|
||||
protected Integer getMaxSize();
|
||||
```
|
||||
Gets the current maximum entity count.
|
||||
|
||||
<br>
|
||||
|
||||
### getRegistrations
|
||||
``` java
|
||||
public BitSet getRegistrations(int entity);
|
||||
protected BitSet getRegistrations(int entity);
|
||||
```
|
||||
Returns the `BitSet` of registrations the `entity` has
|
||||
Returns the `BitSet` of registrations the `entity` has.
|
||||
|
||||
If the call results in an `IndexOutOfBoundsError`, then returns a new BitSet();
|
||||
|
||||
<br>
|
||||
|
||||
### registerComponent
|
||||
``` java
|
||||
public void registerComponent(int component, int entity);
|
||||
protected void registerComponent(int component, int entity);
|
||||
```
|
||||
Sets the bit `component` in [entityRegistrations](#entityRegistrations) for `entity` to `true`.
|
||||
|
||||
@@ -64,7 +74,7 @@ Sets the bit `component` in [entityRegistrations](#entityRegistrations) for `ent
|
||||
|
||||
### removeEntity
|
||||
``` java
|
||||
public void removeEntity(int entity);
|
||||
protected void removeEntity(int entity);
|
||||
```
|
||||
Adds the entity's index back to the unused queue, and clears the assigned registration bits
|
||||
#### Note
|
||||
@@ -72,12 +82,32 @@ Adds the entity's index back to the unused queue, and clears the assigned regist
|
||||
|
||||
<br>
|
||||
|
||||
### resize
|
||||
``` java
|
||||
protected boolean resize(int newSize, SystemManager systemManager, ComponentManager componentManager);
|
||||
```
|
||||
Resizes the currentSize of the entity manager. Moves elements above `newSize` if space is available.
|
||||
|
||||
If the current defined elements won't fit, the operation returns `false` and the previous state is maintained.
|
||||
|
||||
<br>
|
||||
|
||||
### setRegistrations
|
||||
``` java
|
||||
protected void setRegistrations(int entity, BitSet registrations);
|
||||
```
|
||||
Sets the entity's registrations to the provided BitSet
|
||||
|
||||
<br>
|
||||
|
||||
### unregisterComponent
|
||||
``` java
|
||||
public void unregisterComponent(int component, int entity);
|
||||
protected void unregisterComponent(int component, int entity);
|
||||
```
|
||||
Sets the bit `component` in [entityRegistrations](#entityRegistrations) for `entity` to `false`.
|
||||
|
||||
Returns `true` if successful.
|
||||
|
||||
<br>
|
||||
|
||||
## Fields
|
||||
@@ -85,14 +115,22 @@ Sets the bit `component` in [entityRegistrations](#entityRegistrations) for `ent
|
||||
``` java
|
||||
List<BitSet> entityRegistrations;
|
||||
```
|
||||
The BitSet of registrations for each entity
|
||||
|
||||
<br>
|
||||
|
||||
### maxSize
|
||||
``` java
|
||||
private int maxSize = 1024;
|
||||
```
|
||||
The current maximum entity count.
|
||||
|
||||
Default `1024`
|
||||
|
||||
|
||||
### unusedEntities
|
||||
``` java
|
||||
Queue<Integer> unusedEntities;
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
The queue of unused entity values
|
||||
|
||||
|
||||
+5
-2
@@ -1,5 +1,8 @@
|
||||
*| [JavaECS](../README.md) | [docs](../overview.md) | entity*
|
||||
# Overview
|
||||
### In this folder
|
||||
*[Entity.md](./Entity.md)
|
||||
*[EntityManager.md](./EntityManager.md)
|
||||
* [Entity.md](./Entity.md)
|
||||
* [EntityManager.md](./EntityManager.md)
|
||||
|
||||
### See source file:
|
||||
* [EntityManager.java](/BrychanD/JavaECS/src/branch/master/javaecs/src/main/java/nz/ac/massey/javaecs/EntityManager.java)
|
||||
Reference in New Issue
Block a user