congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
BufferUtils.reallocateBuffer
Code IndexAdd Tabnine to your IDE (free)

How to use
reallocateBuffer
method
in
org.jbox2d.common.BufferUtils

Best Java code snippets using org.jbox2d.common.BufferUtils.reallocateBuffer (Showing top 20 results out of 315)

origin: libgdx/libgdx

static int[] reallocateBuffer(ParticleBufferInt buffer, int oldCapacity, int newCapacity,
  boolean deferred) {
 assert (newCapacity > oldCapacity);
 return BufferUtils.reallocateBuffer(buffer.data, buffer.userSuppliedCapacity, oldCapacity,
   newCapacity, deferred);
}
origin: libgdx/libgdx

static <T> T[] reallocateBuffer(ParticleBuffer<T> buffer, int oldCapacity, int newCapacity,
  boolean deferred) {
 assert (newCapacity > oldCapacity);
 return BufferUtils.reallocateBuffer(buffer.dataClass, buffer.data, buffer.userSuppliedCapacity,
   oldCapacity, newCapacity, deferred);
}
origin: libgdx/libgdx

/**
 * Reallocate a buffer. A 'deferred' buffer is reallocated only if it is not NULL. If
 * 'userSuppliedCapacity' is not zero, buffer is user supplied and must be kept.
 */
public static <T> T[] reallocateBuffer(Class<T> klass, T[] buffer, int userSuppliedCapacity,
  int oldCapacity, int newCapacity, boolean deferred) {
 assert (newCapacity > oldCapacity);
 assert (userSuppliedCapacity == 0 || newCapacity <= userSuppliedCapacity);
 if ((!deferred || buffer != null) && userSuppliedCapacity == 0) {
  buffer = reallocateBuffer(klass, buffer, oldCapacity, newCapacity);
 }
 return buffer;
}
origin: libgdx/libgdx

/**
 * Reallocate a float buffer. A 'deferred' buffer is reallocated only if it is not NULL. If
 * 'userSuppliedCapacity' is not zero, buffer is user supplied and must be kept.
 */
public static float[] reallocateBuffer(float[] buffer, int userSuppliedCapacity, int oldCapacity,
  int newCapacity, boolean deferred) {
 assert (newCapacity > oldCapacity);
 assert (userSuppliedCapacity == 0 || newCapacity <= userSuppliedCapacity);
 if ((!deferred || buffer != null) && userSuppliedCapacity == 0) {
  buffer = reallocateBuffer(buffer, oldCapacity, newCapacity);
 }
 return buffer;
}
origin: libgdx/libgdx

/**
 * Reallocate an int buffer. A 'deferred' buffer is reallocated only if it is not NULL. If
 * 'userSuppliedCapacity' is not zero, buffer is user supplied and must be kept.
 */
public static int[] reallocateBuffer(int[] buffer, int userSuppliedCapacity, int oldCapacity,
  int newCapacity, boolean deferred) {
 assert (newCapacity > oldCapacity);
 assert (userSuppliedCapacity == 0 || newCapacity <= userSuppliedCapacity);
 if ((!deferred || buffer != null) && userSuppliedCapacity == 0) {
  buffer = reallocateBuffer(buffer, oldCapacity, newCapacity);
 }
 return buffer;
}
origin: libgdx/libgdx

private void expandBuffers(int oldSize, int newSize) {
 m_aabb = BufferUtils.reallocateBuffer(AABB.class, m_aabb, oldSize, newSize);
 m_userData = BufferUtils.reallocateBuffer(Object.class, m_userData, oldSize, newSize);
 m_parent = BufferUtils.reallocateBuffer(m_parent, oldSize, newSize);
 m_child1 = BufferUtils.reallocateBuffer(m_child1, oldSize, newSize);
 m_child2 = BufferUtils.reallocateBuffer(m_child2, oldSize, newSize);
 m_height = BufferUtils.reallocateBuffer(m_height, oldSize, newSize);
 // Build a linked list for the free list.
 for (int i = oldSize; i < newSize; i++) {
  m_aabb[i] = new AABB();
  m_parent[i] = (i == newSize - 1) ? NULL_NODE : i + 1;
  m_height[i] = -1;
  m_child1[i] = -1;
  m_child2[i] = -1;
 }
 m_freeList = oldSize;
}
origin: libgdx/libgdx

 public void addContact(int a, int b) {
  assert(a != b);
  Vec2 pa = m_positionBuffer.data[a];
  Vec2 pb = m_positionBuffer.data[b];
  float dx = pb.x - pa.x;
  float dy = pb.y - pa.y;
  float d2 = dx * dx + dy * dy;
//    assert(d2 != 0);
  if (d2 < m_squaredDiameter) {
   if (m_contactCount >= m_contactCapacity) {
    int oldCapacity = m_contactCapacity;
    int newCapacity =
      m_contactCount != 0 ? 2 * m_contactCount : Settings.minParticleBufferCapacity;
    m_contactBuffer =
      BufferUtils.reallocateBuffer(ParticleContact.class, m_contactBuffer, oldCapacity,
        newCapacity);
    m_contactCapacity = newCapacity;
   }
   float invD = d2 != 0 ? MathUtils.sqrt(1 / d2) : Float.MAX_VALUE;
   ParticleContact contact = m_contactBuffer[m_contactCount];
   contact.indexA = a;
   contact.indexB = b;
   contact.flags = m_flagsBuffer.data[a] | m_flagsBuffer.data[b];
   contact.weight = 1 - d2 * invD * m_inverseDiameter;
   contact.normal.x = invD * dx;
   contact.normal.y = invD * dy;
   m_contactCount++;
  }
 }

origin: libgdx/libgdx

@Override
public final void query(TreeCallback callback, AABB aabb) {
 nodeStackIndex = 0;
 nodeStack[nodeStackIndex++] = m_root;
 while (nodeStackIndex > 0) {
  int node = nodeStack[--nodeStackIndex];
  if (node == NULL_NODE) {
   continue;
  }
  if (AABB.testOverlap(m_aabb[node], aabb)) {
   int child1 = m_child1[node];
   if (child1 == NULL_NODE) {
    boolean proceed = callback.treeCallback(node);
    if (!proceed) {
     return;
    }
   } else {
    if (nodeStack.length - nodeStackIndex - 2 <= 0) {
     nodeStack =
       BufferUtils.reallocateBuffer(nodeStack, nodeStack.length, nodeStack.length * 2);
    }
    nodeStack[nodeStackIndex++] = child1;
    nodeStack[nodeStackIndex++] = m_child2[node];
   }
  }
 }
}
origin: libgdx/libgdx

    : Settings.minParticleBufferCapacity;
system.m_triadBuffer =
  BufferUtils.reallocateBuffer(Triad.class, system.m_triadBuffer, oldCapacity,
    newCapacity);
system.m_triadCapacity = newCapacity;
origin: libgdx/libgdx

   reallocateBuffer(m_velocityBuffer, m_internalAllocatedCapacity, capacity, false);
 m_accumulationBuffer =
   BufferUtils.reallocateBuffer(m_accumulationBuffer, 0, m_internalAllocatedCapacity,
     capacity, false);
 m_accumulation2Buffer =
   BufferUtils.reallocateBuffer(Vec2.class, m_accumulation2Buffer, 0,
     m_internalAllocatedCapacity, capacity, true);
 m_depthBuffer =
   BufferUtils.reallocateBuffer(m_depthBuffer, 0, m_internalAllocatedCapacity, capacity,
     true);
 m_colorBuffer.data =
   reallocateBuffer(m_colorBuffer, m_internalAllocatedCapacity, capacity, true);
 m_groupBuffer =
   BufferUtils.reallocateBuffer(ParticleGroup.class, m_groupBuffer, 0,
     m_internalAllocatedCapacity, capacity, false);
 m_userDataBuffer.data =
int newCapacity = m_proxyCount != 0 ? 2 * m_proxyCount : Settings.minParticleBufferCapacity;
m_proxyBuffer =
  BufferUtils.reallocateBuffer(Proxy.class, m_proxyBuffer, oldCapacity, newCapacity);
m_proxyCapacity = newCapacity;
origin: libgdx/libgdx

    : Settings.minParticleBufferCapacity;
system.m_triadBuffer =
  BufferUtils.reallocateBuffer(Triad.class, system.m_triadBuffer, oldCapacity,
    newCapacity);
system.m_triadCapacity = newCapacity;
origin: jbox2d/jbox2d

static <T> T[] reallocateBuffer(ParticleBuffer<T> buffer, int oldCapacity, int newCapacity,
  boolean deferred) {
 assert (newCapacity > oldCapacity);
 return BufferUtils.reallocateBuffer(buffer.dataClass, buffer.data, buffer.userSuppliedCapacity,
   oldCapacity, newCapacity, deferred);
}
origin: jbox2d/jbox2d

static int[] reallocateBuffer(ParticleBufferInt buffer, int oldCapacity, int newCapacity,
  boolean deferred) {
 assert (newCapacity > oldCapacity);
 return BufferUtils.reallocateBuffer(buffer.data, buffer.userSuppliedCapacity, oldCapacity,
   newCapacity, deferred);
}
origin: jbox2d/jbox2d

/**
 * Reallocate an int buffer. A 'deferred' buffer is reallocated only if it is not NULL. If
 * 'userSuppliedCapacity' is not zero, buffer is user supplied and must be kept.
 */
public static int[] reallocateBuffer(int[] buffer, int userSuppliedCapacity, int oldCapacity,
  int newCapacity, boolean deferred) {
 assert (newCapacity > oldCapacity);
 assert (userSuppliedCapacity == 0 || newCapacity <= userSuppliedCapacity);
 if ((!deferred || buffer != null) && userSuppliedCapacity == 0) {
  buffer = reallocateBuffer(buffer, oldCapacity, newCapacity);
 }
 return buffer;
}
origin: jbox2d/jbox2d

/**
 * Reallocate a float buffer. A 'deferred' buffer is reallocated only if it is not NULL. If
 * 'userSuppliedCapacity' is not zero, buffer is user supplied and must be kept.
 */
public static float[] reallocateBuffer(float[] buffer, int userSuppliedCapacity, int oldCapacity,
  int newCapacity, boolean deferred) {
 assert (newCapacity > oldCapacity);
 assert (userSuppliedCapacity == 0 || newCapacity <= userSuppliedCapacity);
 if ((!deferred || buffer != null) && userSuppliedCapacity == 0) {
  buffer = reallocateBuffer(buffer, oldCapacity, newCapacity);
 }
 return buffer;
}
origin: jbox2d/jbox2d

/**
 * Reallocate a buffer. A 'deferred' buffer is reallocated only if it is not NULL. If
 * 'userSuppliedCapacity' is not zero, buffer is user supplied and must be kept.
 */
public static <T> T[] reallocateBuffer(Class<T> klass, T[] buffer, int userSuppliedCapacity,
  int oldCapacity, int newCapacity, boolean deferred) {
 assert (newCapacity > oldCapacity);
 assert (userSuppliedCapacity == 0 || newCapacity <= userSuppliedCapacity);
 if ((!deferred || buffer != null) && userSuppliedCapacity == 0) {
  buffer = reallocateBuffer(klass, buffer, oldCapacity, newCapacity);
 }
 return buffer;
}
origin: jbox2d/jbox2d

private void expandBuffers(int oldSize, int newSize) {
 m_aabb = BufferUtils.reallocateBuffer(AABB.class, m_aabb, oldSize, newSize);
 m_userData = BufferUtils.reallocateBuffer(Object.class, m_userData, oldSize, newSize);
 m_parent = BufferUtils.reallocateBuffer(m_parent, oldSize, newSize);
 m_child1 = BufferUtils.reallocateBuffer(m_child1, oldSize, newSize);
 m_child2 = BufferUtils.reallocateBuffer(m_child2, oldSize, newSize);
 m_height = BufferUtils.reallocateBuffer(m_height, oldSize, newSize);
 // Build a linked list for the free list.
 for (int i = oldSize; i < newSize; i++) {
  m_aabb[i] = new AABB();
  m_parent[i] = (i == newSize - 1) ? NULL_NODE : i + 1;
  m_height[i] = -1;
  m_child1[i] = -1;
  m_child2[i] = -1;
 }
 m_freeList = oldSize;
}
origin: libgdx/libgdx

  m_pairCount != 0 ? 2 * m_pairCount : Settings.minParticleBufferCapacity;
m_pairBuffer =
  BufferUtils.reallocateBuffer(Pair.class, m_pairBuffer, oldCapacity, newCapacity);
m_pairCapacity = newCapacity;
origin: libgdx/libgdx

    : Settings.minParticleBufferCapacity;
system.m_bodyContactBuffer =
  BufferUtils.reallocateBuffer(ParticleBodyContact.class,
    system.m_bodyContactBuffer, oldCapacity, newCapacity);
system.m_bodyContactCapacity = newCapacity;
origin: libgdx/libgdx

  m_pairCount != 0 ? 2 * m_pairCount : Settings.minParticleBufferCapacity;
m_pairBuffer =
  BufferUtils.reallocateBuffer(Pair.class, m_pairBuffer, oldCapacity, newCapacity);
m_pairCapacity = newCapacity;
org.jbox2d.commonBufferUtilsreallocateBuffer

Javadoc

Reallocate a buffer.

Popular methods of BufferUtils

  • rotate
    Rotate an array, see std::rotate

Popular in Java

  • Start an intent from android
  • findViewById (Activity)
  • putExtra (Intent)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • Top Vim plugins
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