class EntityState {
final _componentProviderByType = new Bag<ComponentProvider>();
final _indicesP = new Set<int>();
final modifiers = new List<ComponentModifier>();
void add(ComponentProvider provider) {
int index = provider.type.id;
_componentProviderByType[index] = provider;
_indicesP.add(index);
}
void forEach(void f(ComponentProvider)) {
_indicesP.forEach((index) => f(_componentProviderByType[index]));
}
ComponentProvider getByType(ComponentType type) => _componentProviderByType[type.id];
}