java.lang.Object
gov.nih.mipav.view.renderer.WildMagic.Poisson.Octree.Allocator<T>

public class Allocator<T> extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) int
     
    (package private) int
     
     
    (package private) int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    This method returns the memory state of the allocator.
    T[]
    newElements(int elements)
    This method returns a pointer to an array of elements objects.
    (package private) void
    This method is the allocators destructor.
    void
    This method rolls back the allocator so that it makes all of the memory previously allocated available for re-allocation.
    void
    This method rolls back the allocator to the previous memory state and makes all of the memory previously allocated available for re-allocation.
    void
    set(int blockSize)
    This method initiallizes the constructor and the blockSize variable specifies the the number of objects that should be pre-allocated at a time.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • blockSize

      int blockSize
    • index

      int index
    • remains

      int remains
    • memory

      public Vector<T[]> memory
  • Constructor Details

    • Allocator

      public Allocator()
  • Method Details

    • dispose

      public void dispose()
    • reset

      void reset()
      This method is the allocators destructor. It frees up any of the memory that it has allocated.
    • getState

      public AllocatorState getState()
      This method returns the memory state of the allocator.
    • rollBack

      public void rollBack()
      This method rolls back the allocator so that it makes all of the memory previously allocated available for re-allocation. Note that it does it not call the constructor again, so after this method has been called, assumptions about the state of the values in memory are no longer valid.
    • rollBack

      public void rollBack(AllocatorState state)
      This method rolls back the allocator to the previous memory state and makes all of the memory previously allocated available for re-allocation. Note that it does it not call the constructor again, so after this method has been called, assumptions about the state of the values in memory are no longer valid.
    • set

      public void set(int blockSize)
      This method initiallizes the constructor and the blockSize variable specifies the the number of objects that should be pre-allocated at a time.
    • newElements

      public T[] newElements(int elements)
      This method returns a pointer to an array of elements objects. If there is left over pre-allocated memory, this method simply returns a pointer to the next free piece of memory, otherwise it pre-allocates more memory. Note that if the number of objects requested is larger than the value blockSize with which the allocator was initialized, the request for memory will fail.