Tabnine Logo
BitVector.cardinality
Code IndexAdd Tabnine to your IDE (free)

How to use
cardinality
method
in
com.artemis.utils.BitVector

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

origin: net.onedaybeard.artemis/artemis-odb

  @Override
  public String toString() {
    int cardinality = cardinality();
    int end = Math.min(128, cardinality);
    int count = 0;

    StringBuilder sb = new StringBuilder();
    sb.append("BitVector[").append(cardinality);
    if (cardinality > 0) {
      sb.append(": {");
      for (int i = nextSetBit(0); end > count && i != -1; i = nextSetBit(i + 1)) {
        if (count != 0)
          sb.append(", ");

        sb.append(i);
        count++;
      }

      if (cardinality > end)
        sb.append(" ...");

      sb.append("}");
    }
    sb.append("]");
    return sb.toString();
  }
}
origin: junkdog/artemis-odb

  @Override
  public String toString() {
    int cardinality = cardinality();
    int end = Math.min(128, cardinality);
    int count = 0;

    StringBuilder sb = new StringBuilder();
    sb.append("BitVector[").append(cardinality);
    if (cardinality > 0) {
      sb.append(": {");
      for (int i = nextSetBit(0); end > count && i != -1; i = nextSetBit(i + 1)) {
        if (count != 0)
          sb.append(", ");

        sb.append(i);
        count++;
      }

      if (cardinality > end)
        sb.append(" ...");

      sb.append("}");
    }
    sb.append("]");
    return sb.toString();
  }
}
origin: junkdog/artemis-odb

private int prepareBag(IntBag out, int elementsPerEntry) {
  int count = elementsPerEntry * cardinality();
  out.ensureCapacity(count);
  out.setSize(count);
  return count;
}
origin: net.onedaybeard.artemis/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

/**
 * <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

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

  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;
  }
}
origin: net.onedaybeard.artemis/artemis-odb

  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;
  }
}
com.artemis.utilsBitVectorcardinality

Popular methods of BitVector

  • get
  • clear
  • nextSetBit
    Returns the index of the first bit that is set to true that occurs on or after the specified startin
  • set
  • <init>
  • equals
  • intersects
    Returns true if the specified BitVector has any bits set to true that are also set to true in this B
  • isEmpty
  • length
    Returns the "logical size" of this bitset: the index of the highest set bit in the bitset plus one.
  • or
    Performs a logical OR of this bit set with the bit set argument. This bit set is modified so that a
  • toIntBag
    Decodes the set bits as integers. The destination IntBag is reset before the bits are transposed.
  • unsafeGet
  • toIntBag,
  • unsafeGet,
  • andNot,
  • bitIndex,
  • bitOffset,
  • checkCapacity,
  • checkIndex,
  • checkRange,
  • clone

Popular in Java

  • Updating database using SQL prepared statement
  • requestLocationUpdates (LocationManager)
  • startActivity (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Notification (javax.management)
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • CodeWhisperer alternatives
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