Exemple #1
0
  /**
   * Inform subscribers of state changes.
   *
   * <p>Performs callbacks on registered instances of {@link
   * com.artemis.EntitySubscription.SubscriptionListener}.
   *
   * <p>Will run repeatedly until any state changes caused by subscribers have been handled.
   */
  void updateEntityStates() {
    // changed can be populated by EntityTransmuters and Archetypes,
    // bypassing the editPool.
    while (!changed.isEmpty() || editPool.processEntities()) am.process(changed, deleted);

    cm.clean();
  }
 /**
  * Retuns a list of all instanciated and registered KnowledgeSource
  *
  * @return Currently active knowledge sources.
  */
 public List<AbstractKnowledgeSource> getLiveKnowledgeSources() {
   List<AbstractKnowledgeSource> list = new ArrayList<AbstractKnowledgeSource>();
   for (AbstractComponent component : cm.getLiveComponents()) {
     if (component instanceof AbstractKnowledgeSource) {
       list.add((AbstractKnowledgeSource) component);
     }
   }
   return list;
 }
 /**
  * Retuns a list of all instanciated and registered LearningAlgorithm
  *
  * @return Currently active learning algorithms.
  */
 public List<AbstractCELA> getLiveLearningAlgorithms() {
   List<AbstractCELA> list = new ArrayList<AbstractCELA>();
   for (AbstractComponent component : cm.getLiveComponents()) {
     if (component instanceof AbstractCELA) {
       list.add((AbstractCELA) component);
     }
   }
   return list;
 }
Exemple #4
0
 /**
  * Retrieves a ComponentMapper instance for fast retrieval of components from entities.
  *
  * <p>Odb automatically injects component mappers into systems, calling this method is usually not
  * required.,
  *
  * @param <T> class type of the component
  * @param type type of component to get mapper for
  * @return mapper for specified component type
  */
 public <T extends Component> ComponentMapper<T> getMapper(Class<T> type) {
   return cm.getMapper(type);
 }
Exemple #5
0
 /**
  * Create and return an {@link Entity} wrapping a new or reused entity instance. Entity is
  * automatically added to the world.
  *
  * <p>Use {@link Entity#edit()} to set up your newly created entity.
  *
  * <p>You can also create entities using: - {@link com.artemis.utils.EntityBuilder} Convenient
  * entity creation. Not useful when pooling. - {@link com.artemis.Archetype} Fastest, low level,
  * no parameterized components. - {@link com.artemis.EntityFactory} Fast, clean and convenient.
  * For fixed composition entities. Requires some setup. Best choice for parameterizing pooled
  * components.
  *
  * @return assigned entity id
  */
 public int create(Archetype archetype) {
   int entityId = em.create(archetype);
   cm.addComponents(entityId, archetype);
   changed.set(entityId);
   return entityId;
 }
Exemple #6
0
 /**
  * Create and return an {@link Entity} wrapping a new or reused entity instance. Entity is
  * automatically added to the world.
  *
  * <p>Use {@link Entity#edit()} to set up your newly created entity.
  *
  * <p>You can also create entities using: - {@link com.artemis.utils.EntityBuilder} Convenient
  * entity creation. Not useful when pooling. - {@link com.artemis.Archetype} Fastest, low level,
  * no parameterized components. - {@link com.artemis.EntityFactory} Fast, clean and convenient.
  * For fixed composition entities. Requires some setup. Best choice for parameterizing pooled
  * components.
  *
  * @see #create(int) recommended alternative.
  * @return entity
  */
 public Entity createEntity(Archetype archetype) {
   Entity e = em.createEntityInstance(archetype);
   cm.addComponents(e.getId(), archetype);
   changed.set(e.getId());
   return e;
 }