public interface Property
T get(int)
and
void set(int, T)
to get and set values at a particular index. To support
primitives without boxing, they are not part of the interface definition but are
required. The exposed get() and set() methods, and potentially a bulk accessor (such as
returning the underlying array) are the supported methods for manipulating decorated
property values.
Property instances are carefully managed by an EntitySystem. There is ever only one
property instance per defined property in a component type for a system. Property
instances are created by PropertyFactories
. Every concrete
Property class must be annotated with Factory
to specify the PropertyFactory
class that constructs it. That PropertyFactory must expose a no-argument constructor,
or a constructor that takes an Attributes
instance as its only argument.Modifier and Type | Method and Description |
---|---|
int |
getCapacity()
Get the current capacity of the property.
|
void |
setCapacity(int size)
Resize the internal storage to support indexed lookups from 0 to
size -
1 . |
void |
swap(int indexA,
int indexB)
Swap the value at indexA with indexB.
|
void setCapacity(int size)
size -
1
. If >size is less than the current capacity, all previous
values with an index less than size must be preserved, and the remainder
are discarded. If size is greater than the current capacity, all
previous indexed values must be preserved and the new values can be undefined.
This is for internal use only to manage, and should not be called on decorated
properties returned by EntitySystem.decorate(Class,
PropertyFactory)
.size
- The new capacity, will be at least 1int getCapacity()
EntitySystem.decorate(Class,
PropertyFactory)
.void swap(int indexA, int indexB)
EntitySystem.decorate(Class,
PropertyFactory)
.indexA
- The index of the first valueindexB
- The index of the second valueCopyright © 2013. All Rights Reserved.