Tabnine Logo
com.artemis.utils
Code IndexAdd Tabnine to your IDE (free)

How to use com.artemis.utils

Best Java code snippets using com.artemis.utils (Showing top 20 results out of 315)

origin: stackoverflow.com

 Bag myBag = new HashBag();
myBag.add("Orange");
myBag.add("Apple", 4);
myBag.add("Apple");
myBag.remove("Apple", 2);
int apples = myBag.getCount("Apple");  // Should be 3.
int kumquats = myBag.getCount("Kumquat"); // Should be 0.
origin: stackoverflow.com

IntBag.prototype.size=0;
IntBag.prototype.clone = function() {
  var clone = new IntBag();
  this.each(function(i, count) {
    clone.add(i, count);
origin: junkdog/artemis-odb

/**
 * 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));
  }
}
origin: junkdog/artemis-odb

ComponentIdentityResolver() {
  compositionBits = new Bag(BitVector.class);
  compositionBits.add(new BitVector());
  compositionMappers = new Bag<Bag<ComponentMapper>>();
  compositionMappers.add(new Bag(ComponentMapper.class));
}
origin: junkdog/artemis-odb

/** Fetch unique identity for passed composition. */
int getIdentity(BitVector components) {
  Object[] bitsets = compositionBits.getData();
  int size = compositionBits.size();
  for (int i = NO_COMPONENTS; size > i; i++) { // want to start from 1 so that 0 can mean null
    if (components.equals(bitsets[i]))
      return i;
  }
  return -1;
}
origin: junkdog/artemis-odb

/** Get component composition of entity. */
BitVector componentBits(int entityId) {
  int identityIndex = entityToIdentity.get(entityId);
  return identityResolver.compositionBits.get(identityIndex);
}
origin: junkdog/artemis-odb

public static BitVector toBitVector(IntBag bag, BitVector out) {
  int[] data = bag.getData();
  for (int i = 0, s = bag.size(); s > i; i++) {
    out.set(data[i]);
  }
  return out;
}
origin: junkdog/artemis-odb

private void deletedAll(IntBag entities) {
  int[] ids = entities.getData();
  for (int i = 0, s = entities.size(); s > i; i++) {
    int id = ids[i];
    activeEntityIds.unsafeClear(id);
    removedIds.unsafeSet(id);
  }
}
origin: junkdog/artemis-odb

/**
 * generate error message
 */
private String getErrorMessage(final int indexVal) {
  final String message = "Tried accessing element: " + indexVal + "/" + indexEnd + "/" + intBag.size() + "/" + state.name();
  return message;
}
origin: junkdog/artemis-odb

private int prepareBag(IntBag out, int elementsPerEntry) {
  int count = elementsPerEntry * cardinality();
  out.ensureCapacity(count);
  out.setSize(count);
  return count;
}
origin: junkdog/artemis-odb

public void ensureCapacity(int newSize) {
  typeFactory.initialMapperCapacity = newSize;
  entityToIdentity.ensureCapacity(newSize);
  for (ComponentMapper mapper : mappers) {
    mapper.components.ensureCapacity(newSize);
  }
}
origin: junkdog/artemis-odb

  private void purgeNoPool() {
    for (int id = idBits.nextSetBit(0); id >= 0; id = idBits.nextSetBit(id + 1)) {
      components.unsafeSet(id, null);
    }
  }
}
origin: junkdog/artemis-odb

  private void free(int entityId) {
    limbo.add(entityId);
    recycled.unsafeSet(entityId);
  }
}
origin: junkdog/artemis-odb

ComponentIdentityResolver() {
  compositionBits = new Bag(BitVector.class);
  compositionBits.add(new BitVector());
  compositionMappers = new Bag<Bag<ComponentMapper>>();
  compositionMappers.add(new Bag(ComponentMapper.class));
}
origin: junkdog/artemis-odb

/**
 * 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));
  }
}

origin: junkdog/artemis-odb

/** Fetch unique identity for passed composition. */
int getIdentity(BitVector components) {
  BitVector[] bitsets = compositionBits.getData();
  int size = compositionBits.size();
  for (int i = NO_COMPONENTS; size > i; i++) { // want to start from 1 so that 0 can mean null
    if (components.equals(bitsets[i]))
      return i;
  }
  return -1;
}
origin: junkdog/artemis-odb

/** Get component composition of entity. */
BitVector componentBits(int entityId) {
  int identityIndex = entityToIdentity.get(entityId);
  return identityResolver.compositionBits.get(identityIndex);
}
origin: junkdog/artemis-odb

public void ensureCapacity(int newSize) {
  typeFactory.initialMapperCapacity = newSize;
  entityToIdentity.ensureCapacity(newSize);
  for (ComponentMapper mapper : mappers) {
    mapper.components.ensureCapacity(newSize);
  }
}
origin: junkdog/artemis-odb

/** Get component composition of entity. */
private Bag<ComponentMapper> componentMappers(int entityId) {
  int identityIndex = entityToIdentity.get(entityId);
  return identityResolver.compositionMappers.get(identityIndex);
}
origin: junkdog/artemis-odb

/** Get component composition of entity. */
private Bag<ComponentMapper> componentMappers(int entityId) {
  int identityIndex = entityToIdentity.get(entityId);
  return identityResolver.compositionMappers.get(identityIndex);
}
com.artemis.utils

Most used classes

  • Bag
    Collection type a bit like ArrayList but does not preserve the order of its entities, speedwise it i
  • IntBag
    Collection type a bit like ArrayList but does not preserve the order of its entities, speedwise it i
  • ClassReflection
    Utilities for Class reflection.
  • ImmutableBag
    A non-modifiable bag. A bag is a set that can also hold duplicates. Also known as multiset.
  • BitVector
    Performance optimized bitset implementation. Certain operations are prefixed with unsafe; these meth
  • Sort,
  • Annotation,
  • Field,
  • Method,
  • Bag$BagIterator,
  • EntityBuilder,
  • ShortBag,
  • ArrayReflection,
  • ReflectionException,
  • ComparableTimSort,
  • ConverterUtil,
  • IdentifierPool,
  • IntBagIterator$State,
  • IntBagIterator
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now