Store

public class Store

Manages entities of a specific ECS type. A store is the main container for entities, providing entity creation and deletion, component attachment and retrieval, archetype-based entity organization, thread-safe command buffer for batch operations, and resource storage and access.

java.lang.Object > Store

Field Summary

shutdown

private boolean shutdown

Field shutdown.

entitiesSize

private int entitiesSize

Field entitiesSize.

refs

private Ref[] refs

Field refs.

entityToArchetypeChunk

private int[] entityToArchetypeChunk

Field entityToArchetypeChunk.

entityChunkIndex

private int[] entityChunkIndex

Field entityChunkIndex.

systemIndexToArchetypeChunkIndexes

private BitSet[] systemIndexToArchetypeChunkIndexes

Field systemIndexToArchetypeChunkIndexes.

archetypeChunkIndexesToSystemIndex

private BitSet[] archetypeChunkIndexesToSystemIndex

Field archetypeChunkIndexesToSystemIndex.

archetypeSize

private int archetypeSize

Field archetypeSize.

archetypeChunks

private ArchetypeChunk[] archetypeChunks

Field archetypeChunks.

resources

private Resource[] resources

Field resources.

systemMetrics

private HistoricMetric[] systemMetrics

Field systemMetrics.

disableProcessingAssert

private boolean disableProcessingAssert

Field disableProcessingAssert.

buffer

final CommandBuffer buffer

Field buffer.

resourceSize

final int resourceSize

Field resourceSize.

systemIndexes

final BitSet systemIndexes

Field systemIndexes.

futures

final CompletableFuture[] futures

Field futures.

archetypeChunk

final ArchetypeChunk archetypeChunk

Field archetypeChunk.

exactQuery

final ExactArchetypeQuery exactQuery

Field exactQuery.

archetypeIndex2

final int archetypeIndex2

Field archetypeIndex2.

indexes

final BitSet indexes

Field indexes.

result

final ObjectArrayList result

Field result.

chunk

final ArchetypeChunk chunk

Field chunk.

archetype

final Archetype archetype

Field archetype.

componentTypeNames

final String[] componentTypeNames

Field componentTypeNames.

data

final ComponentRegistry.Data data

Field data.

commandBuffer

final CommandBuffer commandBuffer

Field commandBuffer.

system

final HolderSystem system

Field system.

entityIndex

final int entityIndex

Field entityIndex.

oldLength

final int oldLength

Field oldLength.

newLength

final int newLength

Field newLength.

archetypeIndex

final int archetypeIndex

Field archetypeIndex.

chunkEntityRef

final int chunkEntityRef

Field chunkEntityRef.

systemIndexes2

final BitSet systemIndexes2

Field systemIndexes2.

entityProcessedBySystemIndexes

final BitSet entityProcessedBySystemIndexes

Field entityProcessedBySystemIndexes.

system2

final RefSystem system2

Field system2.

oldDisableProcessingAssert

final boolean oldDisableProcessingAssert

Field oldDisableProcessingAssert.

holderEnd

final int holderEnd

Field holderEnd.

ref

final Ref ref

Field ref.

firstIndex

final int firstIndex

Field firstIndex.

ref2

final Ref ref2

Field ref2.

holder

final Holder holder

Field holder.

ref3

final Ref ref3

Field ref3.

remaining

final int remaining

Field remaining.

refIndex

final int refIndex

Field refIndex.

lastIndex

final int lastIndex

Field lastIndex.

lastEntityRef

final Ref lastEntityRef

Field lastEntityRef.

lastSelfEntityRef

final int lastSelfEntityRef

Field lastSelfEntityRef.

lastEntityChunkIndex

final int lastEntityChunkIndex

Field lastEntityChunkIndex.

holders

final Holder[] holders

Field holders.

refEnd

final int refEnd

Field refEnd.

component

final T component

Field component.

oldComponent

final T oldComponent

Field oldComponent.

fromArchetypeIndex

final int fromArchetypeIndex

Field fromArchetypeIndex.

fromArchetypeChunk

final ArchetypeChunk fromArchetypeChunk

Field fromArchetypeChunk.

toArchetypeIndex

final int toArchetypeIndex

Field toArchetypeIndex.

toArchetypeChunk

final ArchetypeChunk toArchetypeChunk

Field toArchetypeChunk.

size

final int size

Field size.

systemTask

final ParallelRangeTask> systemTask

Field systemTask.

archetypeChunkSize

final int archetypeChunkSize

Field archetypeChunkSize.

index

final int index

Field index.

tickingSystem

final Tickable tickingSystem

Field tickingSystem.

start

final long start

Field start.

end

final long end

Field end.

dataChange

final DataChange dataChange

Field dataChange.

oldSystemMetrics

final HistoricMetric[] oldSystemMetrics

Field oldSystemMetrics.

oldSystemIndex

final int oldSystemIndex

Field oldSystemIndex.

systemChange

final SystemChange systemChange

Field systemChange.

componentId

final String componentId

Field componentId.

componentCodec

final Codec> componentCodec

Field componentCodec.

tempInternalEntityHolder

final Holder tempInternalEntityHolder

Field tempInternalEntityHolder.

newArchetype

final Archetype newArchetype

Field newArchetype.

unknownComponents

final UnknownComponents unknownComponents

Field unknownComponents.

unknownComponents2

final UnknownComponents unknownComponents2

Field unknownComponents2.

oldArchetypeSize

final int oldArchetypeSize

Field oldArchetypeSize.

component2

final Component component2

Field component2.

highestUsedIndex

final int highestUsedIndex

Field highestUsedIndex.

archetypeChunkSystem

final ArchetypeChunkSystem archetypeChunkSystem

Field archetypeChunkSystem.

archetypeChunk2

final ArchetypeChunk archetypeChunk2

Field archetypeChunk2.

systemSize

final int systemSize

Field systemSize.

archetypeChunkIndexes

final BitSet archetypeChunkIndexes

Field archetypeChunkIndexes.

currentThread

final Thread currentThread

Field currentThread.

oldChunkEntityRef

final int oldChunkEntityRef

Field oldChunkEntityRef.

archetypeChunkToSystemIndex

final BitSet archetypeChunkToSystemIndex

Field archetypeChunkToSystemIndex.

count

private int count

Field count.

Method Detail

takeCommandBuffer

public CommandBuffer takeCommandBuffer ()

Method takeCommandBuffer.

storeCommandBuffer

public void storeCommandBuffer (@Nonnull final CommandBuffer commandBuffer)

Method storeCommandBuffer.

Parameters:
@Nonnull final CommandBuffer commandBuffer

getStoreIndex

public int getStoreIndex ()

Method getStoreIndex.

getRegistry

public ComponentRegistry getRegistry ()

Method getRegistry.

getExternalData

public ECS_TYPE getExternalData ()

Method getExternalData.

getResourceStorage

public IResourceStorage getResourceStorage ()

Method getResourceStorage.

getParallelTask

public ParallelTask> getParallelTask ()

Method getParallelTask.

getFetchTask

public > getFetchTask ()

Method getFetchTask.

getSystemMetrics

public HistoricMetric[] getSystemMetrics ()

Method getSystemMetrics.

isShutdown

public boolean isShutdown ()

Method isShutdown.

onAdd

public void onAdd (@Nonnull final ComponentRegistry.Data data)

Method onAdd.

Parameters:
@Nonnull final ComponentRegistry.Data data

shutdown

public void shutdown ()

Method shutdown.

shutdown0

public void shutdown0 (@Nonnull final ComponentRegistry.Data data)

Method shutdown0.

Parameters:
@Nonnull final ComponentRegistry.Data data

saveAllResources

public CompletableFuture saveAllResources ()

Method saveAllResources.

saveAllResources0

private CompletableFuture saveAllResources0 (@Nonnull final ComponentRegistry.Data data)

Method saveAllResources0.

Parameters:
@Nonnull final ComponentRegistry.Data data

getEntityCount

public int getEntityCount ()

Method getEntityCount.

getEntityCountFor

public int getEntityCountFor (@Nonnull final Query query)

Method getEntityCountFor.

Parameters:
@Nonnull final Query query

getArchetypeChunkCount

public int getArchetypeChunkCount ()

Method getArchetypeChunkCount.

collectArchetypeChunkData

public ArchetypeChunkData[] collectArchetypeChunkData ()

Method collectArchetypeChunkData.

ArchetypeChunkData

public new ArchetypeChunkData (componentTypeNames, chunk.size()

Method ArchetypeChunkData.

Parameters:
componentTypeNames componentTypeNames
chunk.size( chunk.size(

getArchetypeChunkCountFor

public int getArchetypeChunkCountFor (final int systemIndex)

Method getArchetypeChunkCountFor.

Parameters:
final int systemIndex

setEntityChunkIndex

protected void setEntityChunkIndex (@Nonnull final Ref ref, final int newEntityChunkIndex)

Method setEntityChunkIndex.

Parameters:
@Nonnull final Ref ref
final int newEntityChunkIndex

addEntity

public Ref addEntity (@Nonnull final Archetype archetype, @Nonnull final AddReason reason)

Method addEntity.

Parameters:
@Nonnull final Archetype archetype
@Nonnull final AddReason reason

addEntities

public Ref[] addEntities (@Nonnull final Holder[] holders, @Nonnull final AddReason reason)

Method addEntities.

Parameters:
@Nonnull final Holder[] holders
@Nonnull final AddReason reason

copyEntity

public Holder copyEntity (@Nonnull final Ref ref)

Method copyEntity.

Parameters:
@Nonnull final Ref ref

copySerializableEntity

public Holder copySerializableEntity (@Nonnull final Ref ref)

Method copySerializableEntity.

Parameters:
@Nonnull final Ref ref

getArchetype

public Archetype getArchetype (@Nonnull final Ref ref)

Method getArchetype.

Parameters:
@Nonnull final Ref ref

__internal_getArchetype

protected Archetype __internal_getArchetype (@Nonnull final Ref ref)

Method __internal_getArchetype.

Parameters:
@Nonnull final Ref ref

removeEntity

public Holder removeEntity (@Nonnull final Ref ref, @Nonnull final RemoveReason reason)

Method removeEntity.

Parameters:
@Nonnull final Ref ref
@Nonnull final RemoveReason reason

removeEntities

public Holder[] removeEntities (@Nonnull final Ref[] refs, @Nonnull final RemoveReason reason)

Method removeEntities.

Parameters:
@Nonnull final Ref[] refs
@Nonnull final RemoveReason reason

ensureComponent

public void ensureComponent (@Nonnull final Ref ref, @Nonnull final ComponentType componentType)

Method ensureComponent.

Parameters:
@Nonnull final Ref ref
@Nonnull final ComponentType componentType

ensureAndGetComponent

public T ensureAndGetComponent (@Nonnull final Ref ref, @Nonnull final ComponentType componentType)

Method ensureAndGetComponent.

Parameters:
@Nonnull final Ref ref
@Nonnull final ComponentType componentType

addComponent

public T addComponent (@Nonnull final Ref ref, @Nonnull final ComponentType componentType)

Method addComponent.

Parameters:
@Nonnull final Ref ref
@Nonnull final ComponentType componentType

replaceComponent

public void replaceComponent (@Nonnull final Ref ref, @Nonnull final ComponentType componentType, @Nonnull final T component)

Method replaceComponent.

Parameters:
@Nonnull final Ref ref
@Nonnull final ComponentType componentType
@Nonnull final T component

putComponent

public void putComponent (@Nonnull final Ref ref, @Nonnull final ComponentType componentType, @Nonnull final T component)

Method putComponent.

Parameters:
@Nonnull final Ref ref
@Nonnull final ComponentType componentType
@Nonnull final T component

getComponent

public T getComponent (@Nonnull final Ref ref, @Nonnull final ComponentType componentType)

Method getComponent.

Parameters:
@Nonnull final Ref ref
@Nonnull final ComponentType componentType

__internal_getComponent

public T __internal_getComponent (@Nonnull final Ref ref, @Nonnull final ComponentType componentType)

Method __internal_getComponent.

Parameters:
@Nonnull final Ref ref
@Nonnull final ComponentType componentType

removeComponent

public void removeComponent (@Nonnull final Ref ref, @Nonnull final ComponentType componentType)

Method removeComponent.

Parameters:
@Nonnull final Ref ref
@Nonnull final ComponentType componentType

tryRemoveComponent

public void tryRemoveComponent (@Nonnull final Ref ref, @Nonnull final ComponentType componentType)

Method tryRemoveComponent.

Parameters:
@Nonnull final Ref ref
@Nonnull final ComponentType componentType

removeComponentIfExists

public boolean removeComponentIfExists (@Nonnull final Ref ref, @Nonnull final ComponentType componentType)

Method removeComponentIfExists.

Parameters:
@Nonnull final Ref ref
@Nonnull final ComponentType componentType

replaceResource

public void replaceResource (@Nonnull final ResourceType resourceType, @Nonnull final T resource)

Method replaceResource.

Parameters:
@Nonnull final ResourceType resourceType
@Nonnull final T resource

getResource

public T getResource (@Nonnull final ResourceType resourceType)

Method getResource.

Parameters:
@Nonnull final ResourceType resourceType

__internal_getResource

public T __internal_getResource (@Nonnull final ResourceType resourceType)

Method __internal_getResource.

Parameters:
@Nonnull final ResourceType resourceType

forEachChunk

public void forEachChunk (@Nonnull final BiConsumer, CommandBuffer> consumer)

Method forEachChunk.

Parameters:
@Nonnull final BiConsumer, CommandBuffer> consumer

forEachEntityParallel

public void forEachEntityParallel (final IntBiObjectConsumer, CommandBuffer> consumer)

Method forEachEntityParallel.

Parameters:
final IntBiObjectConsumer, CommandBuffer> consumer

fetch

public void fetch (@Nonnull final SystemType systemType, final Q query, @Nonnull final List results)

Method fetch.

Parameters:
@Nonnull final SystemType systemType
final Q query
@Nonnull final List results

invoke

public void invoke (@Nonnull final Ref ref, @Nonnull final Event param)

Method invoke.

Parameters:
@Nonnull final Ref ref
@Nonnull final Event param

internal_invoke

protected void internal_invoke (final CommandBuffer sourceCommandBuffer, final Ref ref, final Event param)

Method internal_invoke.

Parameters:
final CommandBuffer sourceCommandBuffer
final Ref ref
final Event param

tick

public void tick (final float dt)

Method tick.

Parameters:
final float dt

pausedTick

public void pausedTick (final float dt)

Method pausedTick.

Parameters:
final float dt

tickInternal

public void tickInternal (final float dt, final SystemType tickingSystemType)

Method tickInternal.

Parameters:
final float dt
final SystemType tickingSystemType

updateData

public void updateData (@Nonnull final ComponentRegistry.Data oldData, @Nonnull final ComponentRegistry.Data data)

Method updateData.

Parameters:
@Nonnull final ComponentRegistry.Data oldData
@Nonnull final ComponentRegistry.Data data

if

public else if (this.resources[index] != null && resourceType == null)

Method if.

Parameters:
this.resources[index] != null && resourceType == null

updateData0

private void updateData0 (@Nonnull final ComponentRegistry.Data oldData, @Nonnull final ComponentRegistry.Data newData, final DataChange dataChange)

Method updateData0.

Parameters:
@Nonnull final ComponentRegistry.Data oldData
@Nonnull final ComponentRegistry.Data newData
final DataChange dataChange

updateArchetypeIndexes

private void updateArchetypeIndexes (@Nonnull final ComponentRegistry.Data data)

Method updateArchetypeIndexes.

Parameters:
@Nonnull final ComponentRegistry.Data data

assertWriteProcessing

public void assertWriteProcessing ()

Method assertWriteProcessing.

isProcessing

public boolean isProcessing ()

Method isProcessing.

assertThread

public void assertThread ()

Method assertThread.

isInThread

public boolean isInThread ()

Method isInThread.

isAliveInDifferentThread

public boolean isAliveInDifferentThread ()

Method isAliveInDifferentThread.

toString

public String toString ()

Method toString.

datachunk_addComponent

public void datachunk_addComponent (@Nonnull final Ref ref, final int fromArchetypeIndex, @Nonnull final ComponentType componentType, @Nonnull final T component, @Nonnull final CommandBuffer commandBuffer)

Method datachunk_addComponent.

Parameters:
@Nonnull final Ref ref
final int fromArchetypeIndex
@Nonnull final ComponentType componentType
@Nonnull final T component
@Nonnull final CommandBuffer commandBuffer

findOrCreateArchetypeChunk

private int findOrCreateArchetypeChunk (@Nonnull final Archetype archetype)

Method findOrCreateArchetypeChunk.

Parameters:
@Nonnull final Archetype archetype

removeArchetypeChunk

private void removeArchetypeChunk (final int archetypeIndex)

Method removeArchetypeChunk.

Parameters:
final int archetypeIndex

isHeld

public boolean isHeld ()

Method isHeld.

lock

public void lock ()

Method lock.

lockInterruptibly

public void lockInterruptibly ()

Method lockInterruptibly.

UnsupportedOperationException

public new UnsupportedOperationException ("lockInterruptibly()

Method UnsupportedOperationException.

Parameters:
"lockInterruptibly( "lockInterruptibly(

tryLock

public boolean tryLock ()

Method tryLock.

unlock

public void unlock ()

Method unlock.

newCondition

public Condition newCondition ()

Method newCondition.

See Also: