/** * Add listener interested in changes to the subscription. * * @param listener listener to add. */ public void addSubscriptionListener(SubscriptionListener listener) { extra.listeners.add(listener); }
/** * Adds a {@link FieldResolver} to this handler. Resolvers added first, will be used first for resolving fields, * so the order of add operations is significant. * * @param fieldResolver is added to this FieldHandler fieldresolver-list */ public final void addFieldResolver(FieldResolver fieldResolver) { fieldResolvers.add(fieldResolver); }
/** * Add listener interested in changes to the subscription. * * @param listener listener to add. */ public void addSubscriptionListener(SubscriptionListener listener) { extra.listeners.add(listener); }
/** Subscribe listener to events. */ @Override public void register( EventListener listener ) { if ( !listeners.contains(listener) ) { listeners.add(listener); sortDirty =true; } }
public void setAll() { array.add("array"); bag.add("bag"); hashSet.add("hashSet"); arrayList.add("arrayList"); list.add("list"); hashMap.put("key", "map"); intBag.add(1); map.put("lock", "unlocked"); objectMap.put("obj", "map"); }
@Override public Bag read(Json json, JsonValue jsonData, Class type) { Bag<Entity> result = new Bag<Entity>(); for (JsonValue child = jsonData.child; child != null; child = child.next) result.add(json.readValue(Entity.class, child)); return result; } }
/** * Add all items into this bag. * * @param items * bag with items to add */ public void addAll(ImmutableBag<E> items) { for(int i = 0, s = items.size(); s > i; i++) { add(items.get(i)); } }
@Override public Bag read(Json json, JsonValue jsonData, Class type) { Bag<Entity> result = new Bag<Entity>(); for (JsonValue child = jsonData.child; child != null; child = child.next) result.add(json.readValue(Entity.class, child)); return result; } }
/** * Add new plugins. */ private void addPlugins(ArtemisPlugin[] plugins) { for (ArtemisPlugin plugin : plugins) { if (containsType(this.plugins, plugin.getClass())) { throw new WorldConfigurationException("Plugin of type " + plugin.getClass() + " registered twice. Only once allowed."); } this.plugins.add(ConfigurationElement.of(plugin)); } }
/** * Add all items into this bag. * * @param items * bag with items to add */ public void addAll(ImmutableBag<E> items) { for(int i = 0, s = items.size(); s > i; i++) { add(items.get(i)); } }
Bag<Class<? extends Component>> getAdditions(Bag<Class<? extends Component>> out) { for (int i = 0, s = additions.length; s > i; i++) { out.add(additions[i].getType().getType()); } return out; }
private EntitySubscription createSubscription(Aspect.Builder builder) { EntitySubscription entitySubscription = new EntitySubscription(world, builder); subscriptionMap.put(builder, entitySubscription); subscriptions.add(entitySubscription); world.getComponentManager().synchronize(entitySubscription); return entitySubscription; }
protected void dependsOnSystem(int priority, Class<? extends BaseSystem> type) throws ReflectionException { if (!containsType(systems, type)) { this.systems.add(ConfigurationElement.of(ClassReflection.newInstance(type), priority)); } }
int allocateIdentity(BitVector componentBits, ComponentManager cm) { Bag<ComponentMapper> mappers = new Bag<ComponentMapper>(ComponentMapper.class, componentBits.cardinality()); ComponentTypeFactory tf = cm.getTypeFactory(); for (int i = componentBits.nextSetBit(0); i >= 0; i = componentBits.nextSetBit(i + 1)) { mappers.add(cm.getMapper(tf.getTypeFor(i).getType())); } compositionMappers.add(mappers); compositionBits.add(new BitVector(componentBits)); return compositionBits.size() - 1; } }
@Override public ArchetypeMapper.TransmuterEntry read(Json json, JsonValue jsonData, Class type) { Bag components = new Bag(); for (JsonValue child = jsonData.child; child != null; child = child.next) components.add(identifiers.getType(json.readValue(String.class, child))); return new ArchetypeMapper.TransmuterEntry(components); } }
@Override public void onCreated(ComponentType type) { Bag<LinkSite> links = linkFactory.create(type); if (links.isEmpty()) return; for (int i = 0, s = links.size(); s > i; i++) { elm.linkSites.add(links.get(i)); } } }
private void dependsOnPlugin(Class<? extends ArtemisPlugin> type) throws ReflectionException { if (ClassReflection.isAbstractClass(type)) { if (!anyAssignableTo(plugins, type)) { throw new WorldConfigurationException("Implementation of " + type + " expected but not found. Did you forget to include a plugin? (for example: logging-libgdx for logging-api)"); } } else { if (!containsType(plugins, type)) { this.plugins.add(ConfigurationElement.of(ClassReflection.newInstance(type))); } } }
private Bag<ComponentMapper> getAdditions(BitVector origin) { ComponentTypeFactory tf = cm.typeFactory; Bag<ComponentMapper> types = new Bag(ComponentMapper.class); for (int i = additions.nextSetBit(0); i >= 0; i = additions.nextSetBit(i + 1)) { if (!origin.get(i)) types.add(cm.getMapper(tf.getTypeFor(i).getType())); } return types; }
private Bag<ComponentMapper> getRemovals(BitVector origin) { ComponentTypeFactory tf = cm.typeFactory; Bag<ComponentMapper> types = new Bag(ComponentMapper.class); for (int i = removals.nextSetBit(0); i >= 0; i = removals.nextSetBit(i + 1)) { if (origin.get(i)) types.add(cm.getMapper(tf.getTypeFor(i).getType())); } return types; } }