constructor(tableId: TableId, types: TypeId[])
View sourceCreates an archetype for a table and component TypeId set.
Class
Represents one exact ECS component layout and its associated table ID.
Use Archetype#has for subset matching: every requested component
TypeId must be present, but the layout may contain additional components.
Use Archetype#hasOnly for exact-set matching. Both checks are
order-independent, and exact matching expects deduplicated TypeId lists.
The table ID identifies the table associated with this component layout.
const tableId = 0
const archetype = new Archetype(tableId, [positionTypeId, velocityTypeId])
archetype.has([positionTypeId]) // true: a required subset is present
archetype.hasOnly([positionTypeId]) // false: velocityTypeId is also present
archetype.hasOnly([velocityTypeId, positionTypeId]) // true: same set, new orderconstructor(tableId: TableId, types: TypeId[])Creates an archetype for a table and component TypeId set.
Component TypeIds that define this archetype’s layout.
Matching methods treat this collection as a set and do not depend on its order.
ID of the table associated with this archetype’s layout.
This is the table’s identity, not an ID assigned by an archetype registry.
has(typeids: TypeId[]): booleanChecks whether this layout contains every requested component TypeId.
This is subset matching. Extra component TypeIds in the layout do not affect the result.
hasOnly(typeIds: TypeId[]): booleanChecks whether this layout has exactly the requested component set.
The lists must have the same length and every requested TypeId must be present. Order does not matter, but callers should provide deduplicated TypeId lists because the check uses length plus membership.