com.ximpleware
Class FastLongBuffer

java.lang.Object
  extended by com.ximpleware.FastLongBuffer
All Implemented Interfaces:
ILongBuffer

public class FastLongBuffer
extends Object
implements ILongBuffer

A fast, unsynchronized, chunk-based long buffer for storing LCs and VTD. Creation date: (7/17/03 6:07:46 PM)


Field Summary
protected  int size
          Total number of integers in the IntBuffer
 
Constructor Summary
FastLongBuffer()
          FastLongBuffer constructor comment.
FastLongBuffer(int e)
          Construct a FastLongBuffer instance with specified page size
FastLongBuffer(int e, int c)
          Construct a FastLongBuffer instance with specified page size
 
Method Summary
 void append(long i)
          Append an integer to the end of this array buffer
 void append(long[] long_array)
          Append single long to the end of array buffer.
 void clear()
          set teh size of long buffer to zero, capacity untouched so long buffer can be reused without any unnecessary and additional allocation
 int getCapacity()
          Get the capacity of the buffer.
 long[] getLongArray(int startingOffset, int len)
          Return a selected chuck of long buffer as a long array.
 int getPageSize()
          Get the buffer page size.
 long longAt(int index)
          Get the long val at given index value.
 int lower32At(int index)
          Get the lower 32 bit of the integer at the given index.
 void modifyEntry(int index, long newValue)
          Modify the value at the index to a new val.
 boolean resize(int newSz)
          Set the size of FastLongBuffer to newSz if newSz is less than the capacity, otherwise return false
 int size()
          Get the total number of longs in the buffer.
 long[] toLongArray()
          Convert all longs into a long array.
 int upper32At(int index)
          Return the upper 32 bit of the long at the index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

size

protected int size
Total number of integers in the IntBuffer

Constructor Detail

FastLongBuffer

public FastLongBuffer()
FastLongBuffer constructor comment.


FastLongBuffer

public FastLongBuffer(int e)
Construct a FastLongBuffer instance with specified page size

Parameters:
e - int (so that pageSize = (1<

FastLongBuffer

public FastLongBuffer(int e,
                      int c)
Construct a FastLongBuffer instance with specified page size

Parameters:
e - int (so that pageSize = (1<c - int (suggest initial capacity of ArrayList
Method Detail

append

public void append(long[] long_array)
Append single long to the end of array buffer.

Parameters:
long_array - long[]

append

public final void append(long i)
Append an integer to the end of this array buffer

Parameters:
i - long

getCapacity

public final int getCapacity()
Get the capacity of the buffer.

Returns:
int

getLongArray

public long[] getLongArray(int startingOffset,
                           int len)
Return a selected chuck of long buffer as a long array.

Parameters:
startingOffset - int
len - int
Returns:
long[]

getPageSize

public final int getPageSize()
Get the buffer page size.

Returns:
int

longAt

public final long longAt(int index)
Get the long val at given index value.

Specified by:
longAt in interface ILongBuffer
Parameters:
index - int
Returns:
long

lower32At

public final int lower32At(int index)
Get the lower 32 bit of the integer at the given index.

Specified by:
lower32At in interface ILongBuffer
Parameters:
index - int
Returns:
int

modifyEntry

public final void modifyEntry(int index,
                              long newValue)
Modify the value at the index to a new val.

Specified by:
modifyEntry in interface ILongBuffer
Parameters:
index - int
newValue - long

size

public final int size()
Get the total number of longs in the buffer.

Specified by:
size in interface ILongBuffer
Returns:
int

toLongArray

public long[] toLongArray()
Convert all longs into a long array.

Returns:
long[]

upper32At

public final int upper32At(int index)
Return the upper 32 bit of the long at the index.

Specified by:
upper32At in interface ILongBuffer
Parameters:
index - int
Returns:
int

clear

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


resize

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

Parameters:
newSz -
Returns:
status of resize


Copyright © 2013. All Rights Reserved.