com.artemis.utils.Bag.clear()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(142)

本文整理了Java中com.artemis.utils.Bag.clear()方法的一些代码示例,展示了Bag.clear()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bag.clear()方法的具体详情如下:
包路径:com.artemis.utils.Bag
类名称:Bag
方法名:clear

Bag.clear介绍

[英]Removes all of the elements from this bag.

The bag will be empty after this call returns.
[中]移除此包中的所有元素。
此呼叫返回后,行李将为空。

代码示例

代码示例来源:origin: DaanVanYperen/artemis-odb-contrib

/**
 * Clears entire pool.
 */
public void clear() {
  pool.clear();
}

代码示例来源:origin: net.mostlyoriginal.artemis-odb/contrib-core

/**
 * Clears entire pool.
 */
public void clear() {
  pool.clear();
}

代码示例来源:origin: junkdog/artemis-odb

private void clear() {
  referencingFields.clear();
  referencingTypes.clear();
  referenced.clear();
}

代码示例来源:origin: net.onedaybeard.artemis/artemis-odb-serializer

private void clear() {
  referencingFields.clear();
  referencingTypes.clear();
  referenced.clear();
}

代码示例来源:origin: junkdog/artemis-odb

void translate(Bag<Entity> translatedIds) {
  for (Component c : operations)
    fieldType.translate(c, field, translatedIds);
  operations.clear();
}

代码示例来源:origin: junkdog/artemis-odb

void translate(Bag<Entity> translations) {
  for (EntityReference ref : referenced) {
    ref.translate(translations);
  }
  translations.clear();
}

代码示例来源:origin: net.onedaybeard.artemis/artemis-odb-serializer

void translate(Bag<Entity> translations) {
  for (EntityReference ref : referenced) {
    ref.translate(translations);
  }
  translations.clear();
}

代码示例来源:origin: net.onedaybeard.artemis/artemis-odb-serializer

void translate(Bag<Entity> translatedIds) {
  for (Component c : operations)
    fieldType.translate(c, field, translatedIds);
  operations.clear();
}

代码示例来源:origin: junkdog/artemis-odb

public void clearAll() {
    array.clear();
    bag.clear();
    hashSet.clear();
    arrayList.clear();
    list.clear();
    hashMap.clear();
    intBag.clear();
    map.clear();
    objectMap.clear();
  }
}

代码示例来源:origin: junkdog/artemis-odb

public ArchetypeMapper(World world, IntBag toSave) {
  int[] ids = toSave.getData();
  Bag<Component> components = new Bag<Component>();
  Bag<Class<? extends Component>> types = new Bag<Class<? extends Component>>();
  for (int i = 0, s = toSave.size(); s > i; i++) {
    int compositionId = world.getEntity(ids[i]).getCompositionId();
    if (!compositionIdMapper.containsKey(compositionId)) {
      components.clear();
      types.clear();
      world.getComponentManager().getComponentsFor(ids[i], components);
      compositionIdMapper.put(compositionId,
        new TransmuterEntry(toClasses(components, types)));
    }
  }
}

代码示例来源:origin: net.onedaybeard.artemis/artemis-odb-serializer

public ArchetypeMapper(World world, IntBag toSave) {
  int[] ids = toSave.getData();
  Bag<Component> components = new Bag<Component>();
  Bag<Class<? extends Component>> types = new Bag<Class<? extends Component>>();
  for (int i = 0, s = toSave.size(); s > i; i++) {
    int compositionId = world.getEntity(ids[i]).getCompositionId();
    if (!compositionIdMapper.containsKey(compositionId)) {
      components.clear();
      types.clear();
      world.getComponentManager().getComponentsFor(ids[i], components);
      compositionIdMapper.put(compositionId,
        new TransmuterEntry(toClasses(components, types)));
    }
  }
}

代码示例来源:origin: net.mostlyoriginal.artemis-odb/contrib-eventbus

@Override
public void process() {
  Object[] eventsToDispatch = eventQueue.getData();
  int i = 0;
  int s = eventQueue.size();
  while (i < s) {
    for (; i < s; i++) {
      Event event = (Event) eventsToDispatch[i];
      super.dispatch(event);
    }
    // we may end up having more events to dispatch at this point
    //  - some event handlers could dispatch more events
    s = eventQueue.size();
  }
  
  eventQueue.clear();
}

代码示例来源:origin: DaanVanYperen/artemis-odb-contrib

@Override
public void process() {
  Object[] eventsToDispatch = eventQueue.getData();
  int i = 0;
  int s = eventQueue.size();
  while (i < s) {
    for (; i < s; i++) {
      Event event = (Event) eventsToDispatch[i];
      super.dispatch(event);
    }
    // we may end up having more events to dispatch at this point
    //  - some event handlers could dispatch more events
    s = eventQueue.size();
  }
  
  eventQueue.clear();
}

代码示例来源:origin: net.mostlyoriginal.artemis-odb/contrib-eventbus

@Override
public void process() {
  Object[] eventsToDispatch = eventQueue.getData();
  int i = 0;
  int s = eventQueue.size();
  while (i < s) {
    for (; i < s; i++) {
      Event event = (Event) eventsToDispatch[i];
      super.dispatch(event);
      pools.free(event);
    }
    // we may end up having more events to dispatch at this point
    //  - some event handlers could dispatch more events
    s = eventQueue.size();
  }
  eventQueue.clear();
}

代码示例来源:origin: DaanVanYperen/artemis-odb-contrib

@Override
public void process() {
  Object[] eventsToDispatch = eventQueue.getData();
  int i = 0;
  int s = eventQueue.size();
  while (i < s) {
    for (; i < s; i++) {
      Event event = (Event) eventsToDispatch[i];
      super.dispatch(event);
      pools.free(event);
    }
    // we may end up having more events to dispatch at this point
    //  - some event handlers could dispatch more events
    s = eventQueue.size();
  }
  eventQueue.clear();
}

代码示例来源:origin: junkdog/artemis-odb

/**
 * <p>If all entties have been deleted, resets the entity cache - with next entity
 * entity receiving id <code>0</code>. There mustn't be any active entities in
 * the world for this method to work. This method does nothing if it fails.</p>
 *
 * <p>For the reset to take effect, a new {@link World#process()} must initiate.</p>
 *
 * @return true if entity id was successfully reset.
 *
 */
public boolean reset() {
  int count = world.getAspectSubscriptionManager()
    .get(all())
    .getActiveEntityIds()
    .cardinality();
  if (count > 0)
    return false;
  limbo.clear();
  recycled.clear();
  entities.clear();
  nextId = 0;
  return true;
}

代码示例来源:origin: net.onedaybeard.artemis/artemis-odb

/**
 * <p>If all entties have been deleted, resets the entity cache - with next entity
 * entity receiving id <code>0</code>. There mustn't be any active entities in
 * the world for this method to work. This method does nothing if it fails.</p>
 *
 * <p>For the reset to take effect, a new {@link World#process()} must initiate.</p>
 *
 * @return true if entity id was successfully reset.
 *
 */
public boolean reset() {
  int count = world.getAspectSubscriptionManager()
    .get(all())
    .getActiveEntityIds()
    .cardinality();
  if (count > 0)
    return false;
  limbo.clear();
  recycled.clear();
  entities.clear();
  nextId = 0;
  return true;
}

代码示例来源:origin: junkdog/artemis-odb

json.writeObjectEnd();
components.clear();

代码示例来源:origin: junkdog/artemis-odb

Bag<LinkSite> create(ComponentType ct) {
  Class<?> type = ct.getType();
  Field[] fields = ClassReflection.getDeclaredFields(type);
  links.clear();
  for (int i = 0; fields.length > i; i++) {
    Field f = fields[i];
    int referenceTypeId = getReferenceTypeId(f);
    if (referenceTypeId != NULL_REFERENCE && (SKIP != getPolicy(f))) {
      if (SINGLE_REFERENCE == referenceTypeId) {
        UniLinkSite ls = new UniLinkSite(world, ct, f);
        if (!configureMutator(ls))
          reflexiveMutators.withMutator(ls);
        links.add(ls);
      } else if (MULTI_REFERENCE == referenceTypeId) {
        MultiLinkSite ls = new MultiLinkSite(world, ct, f);
        if (!configureMutator(ls))
          reflexiveMutators.withMutator(ls);
        links.add(ls);
      }
    }
  }
  return links;
}

代码示例来源:origin: net.onedaybeard.artemis/artemis-odb

Bag<LinkSite> create(ComponentType ct) {
  Class<?> type = ct.getType();
  Field[] fields = ClassReflection.getDeclaredFields(type);
  links.clear();
  for (int i = 0; fields.length > i; i++) {
    Field f = fields[i];
    int referenceTypeId = getReferenceTypeId(f);
    if (referenceTypeId != NULL_REFERENCE && (SKIP != getPolicy(f))) {
      if (SINGLE_REFERENCE == referenceTypeId) {
        UniLinkSite ls = new UniLinkSite(world, ct, f);
        if (!configureMutator(ls))
          reflexiveMutators.withMutator(ls);
        links.add(ls);
      } else if (MULTI_REFERENCE == referenceTypeId) {
        MultiLinkSite ls = new MultiLinkSite(world, ct, f);
        if (!configureMutator(ls))
          reflexiveMutators.withMutator(ls);
        links.add(ls);
      }
    }
  }
  return links;
}

相关文章