com.ximpleware
Class FastIntBuffer

java.lang.Object
  extended by com.ximpleware.FastIntBuffer
All Implemented Interfaces:
IIntBuffer

public class FastIntBuffer
extends Object
implements IIntBuffer

A fast, unsynchronized, chunk-based int buffer


Field Summary
static int ASCENDING
           
static int DESCENDING
           
protected  int size
          Total number of integers in the IntBuffer
 
Constructor Summary
FastIntBuffer()
          FastIntBuffer constructor comment.
FastIntBuffer(int e)
          Constructor with adjustable buffer page size of the value bfz The actually page size is 1<
 
Method Summary
 void append(int i)
          Append a single int to the end of this buffer Instance
 void append(int[] int_array)
          Append an int array to the end of this buffer instance
 void clear()
          set the size of int buffer to zero, capacity untouched so int buffer can be reused without any unnecessary and additional allocation
 int getCapacity()
          Returns the total allocated capacity of this buffer instance.
 int[] getIntArray(int startingOffset, int len)
          Returns a single int array representing every int in this buffer instance
 int getPageSize()
          Returns the page size of this buffer instance.
 int intAt(int index)
          Get the int at the location specified by index.
 void modifyEntry(int index, int newValue)
          Assigns a new int value to location index of the buffer instance.
 boolean resize(int newSz)
          Set the size of FastIntBuffer to newSz if newSz is less than the capacity, otherwise return false
 int size()
          Returns the total number of int values in the buffer instance
 void sort(int order)
          Sort the integers in the buffer
 int[] toIntArray()
          Returns the int array corresponding to all int values in this buffer instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ASCENDING

public static final int ASCENDING
See Also:
Constant Field Values

DESCENDING

public static final int DESCENDING
See Also:
Constant Field Values

size

protected int size
Total number of integers in the IntBuffer

Constructor Detail

FastIntBuffer

public FastIntBuffer()
FastIntBuffer constructor comment.


FastIntBuffer

public FastIntBuffer(int e)
Constructor with adjustable buffer page size of the value bfz The actually page size is 1<
Parameters:
e - int is the size of the internal buffer
Method Detail

append

public final void append(int[] int_array)
Append an int array to the end of this buffer instance

Parameters:
int_array - int[]

append

public final void append(int i)
Append a single int to the end of this buffer Instance

Parameters:
i - int

getCapacity

public final int getCapacity()
Returns the total allocated capacity of this buffer instance.

Returns:
int

getIntArray

public int[] getIntArray(int startingOffset,
                         int len)
Returns a single int array representing every int in this buffer instance

Parameters:
startingOffset - int
len - int
Returns:
int[] (null if there isn't anything left in the buffer

getPageSize

public final int getPageSize()
Returns the page size of this buffer instance. Creation date: (7/17/03 6:38:02 PM)

Returns:
int

intAt

public final int intAt(int index)
Get the int at the location specified by index.

Specified by:
intAt in interface IIntBuffer
Parameters:
index - int
Returns:
int

modifyEntry

public final void modifyEntry(int index,
                              int newValue)
Assigns a new int value to location index of the buffer instance.

Specified by:
modifyEntry in interface IIntBuffer
Parameters:
index - int
newValue - int

size

public final int size()
Returns the total number of int values in the buffer instance

Specified by:
size in interface IIntBuffer
Returns:
int

toIntArray

public int[] toIntArray()
Returns the int array corresponding to all int values in this buffer instance

Returns:
int[] (null if the buffer is empty)

clear

public final void clear()
set the size of int buffer to zero, capacity untouched so int buffer can be reused without any unnecessary and additional allocation


resize

public final boolean resize(int newSz)
Set the size of FastIntBuffer to newSz if newSz is less than the capacity, otherwise return false

Parameters:
newSz -
Returns:
status of resize

sort

public void sort(int order)
Sort the integers in the buffer

Parameters:
order - (as of version 2.9) it can be either ASCENDING or DESCENDING


Copyright © 2013. All Rights Reserved.