jodd.util.buffer
Class FastDoubleBuffer

java.lang.Object
  extended by jodd.util.buffer.FastDoubleBuffer

public class FastDoubleBuffer
extends java.lang.Object

Fast, fast double buffer.


Constructor Summary
FastDoubleBuffer()
          Creates a new double buffer.
FastDoubleBuffer(int size)
          Creates a new double buffer, with a buffer capacity of the specified size, in bytes.
 
Method Summary
 FastDoubleBuffer append(double element)
          Appends single double to buffer.
 FastDoubleBuffer append(double[] array)
          Appends double array to buffer.
 FastDoubleBuffer append(double[] array, int off, int len)
          Appends double array to buffer.
 FastDoubleBuffer append(FastDoubleBuffer buff)
          Appends another fast buffer to this one.
 double[] array(int index)
          Returns double inner array chunk at given index.
 void clear()
          Resets the buffer content.
 double get(int index)
          Returns double element at given index.
 int index()
          Returns current index of inner double array chunk.
 boolean isEmpty()
          Tests if this buffer has no elements.
 int offset()
          Returns the offset of last used element in current inner array chunk.
 int size()
          Returns buffer size.
 double[] toArray()
          Creates double array from buffered content.
 double[] toArray(int start, int len)
          Creates double subarray from buffered content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FastDoubleBuffer

public FastDoubleBuffer()
Creates a new double buffer. The buffer capacity is initially 1024 bytes, though its size increases if necessary.


FastDoubleBuffer

public FastDoubleBuffer(int size)
Creates a new double buffer, with a buffer capacity of the specified size, in bytes.

Parameters:
size - the initial size.
Throws:
java.lang.IllegalArgumentException - if size is negative.
Method Detail

append

public FastDoubleBuffer append(double[] array,
                               int off,
                               int len)
Appends double array to buffer.


append

public FastDoubleBuffer append(double[] array)
Appends double array to buffer.


append

public FastDoubleBuffer append(double element)
Appends single double to buffer.


append

public FastDoubleBuffer append(FastDoubleBuffer buff)
Appends another fast buffer to this one.


size

public int size()
Returns buffer size.


isEmpty

public boolean isEmpty()
Tests if this buffer has no elements.


index

public int index()
Returns current index of inner double array chunk. Represents the index of last used inner array chunk.


offset

public int offset()
Returns the offset of last used element in current inner array chunk.


array

public double[] array(int index)
Returns double inner array chunk at given index. May be used for iterating inner chunks in fast manner.


clear

public void clear()
Resets the buffer content.


toArray

public double[] toArray()
Creates double array from buffered content.


toArray

public double[] toArray(int start,
                        int len)
Creates double subarray from buffered content.


get

public double get(int index)
Returns double element at given index.



Copyright © 2003-2012 Jodd Team