org.apfloat.internal
Class DoubleMemoryArrayAccess

java.lang.Object
  extended byorg.apfloat.spi.ArrayAccess
      extended byorg.apfloat.internal.DoubleMemoryArrayAccess

public class DoubleMemoryArrayAccess
extends ArrayAccess

Array access class based on a double[].

Version:
1.0
Author:
Mikko Tommila

Constructor Summary
DoubleMemoryArrayAccess(double[] data, int offset, int length)
          Create an array access.
 
Method Summary
 void close()
          Close this array access and commit any changes to the underlying data storage if applicable.
 java.lang.Object getData()
          Returns the array of this array access.
 double[] getDoubleData()
          Returns the array of this array access as a double[].
 ArrayAccess subsequence(int offset, int length)
          Create a sub-sequence view of this array access.
 
Methods inherited from class org.apfloat.spi.ArrayAccess
getFloatData, getIntData, getLength, getLongData, getOffset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DoubleMemoryArrayAccess

public DoubleMemoryArrayAccess(double[] data,
                               int offset,
                               int length)
Create an array access.

Parameters:
data - The underlying array.
offset - The offset of the access segment within the array.
length - The access segment.
Method Detail

subsequence

public ArrayAccess subsequence(int offset,
                               int length)
Description copied from class: ArrayAccess
Create a sub-sequence view of this array access.

Note that the changes done to the sub-sequence array are not necessarily committed to the underlying data storage when the sub-sequence is closed (with ArrayAccess.close()), but only when the "base" ArrayAccess is closed.

Specified by:
subsequence in class ArrayAccess
Parameters:
offset - The sub-sequence starting offset within this ArrayAccess.
length - The sub-sequence length.

getData

public java.lang.Object getData()
Description copied from class: ArrayAccess
Returns the array of this array access. This is an array of a primitive type, depending on the implementation class.

Specified by:
getData in class ArrayAccess
Returns:
The backing array of this array access.

getDoubleData

public double[] getDoubleData()
Description copied from class: ArrayAccess
Returns the array of this array access as a double[].

Overrides:
getDoubleData in class ArrayAccess
Returns:
The backing array of this array access.

close

public void close()
           throws ApfloatRuntimeException
Description copied from class: ArrayAccess
Close this array access and commit any changes to the underlying data storage if applicable.

If the ArrayAccess was obtained in write mode, the changes are saved to the data storage. Note that even if the ArrayAccess was obtained for reading only, any changes made to the array data may still be committed to the data storage.

Note that changes done to a sub-sequence array are not necessarily committed to the underlying data storage when the sub-sequence is closed, but only when the "base" ArrayAccess is closed.

Specified by:
close in class ArrayAccess
Throws:
ApfloatRuntimeException