Package org.apfloat.internal
Class IntMemoryArrayAccess
- java.lang.Object
-
- org.apfloat.spi.ArrayAccess
-
- org.apfloat.internal.IntMemoryArrayAccess
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.AutoCloseable
- Direct Known Subclasses:
IntDiskDataStorage.IntDiskArrayAccess
,IntDiskDataStorage.MemoryArrayAccess
,IntDiskDataStorage.TransposedMemoryArrayAccess
public class IntMemoryArrayAccess extends ArrayAccess
Array access class based on aint[]
.- Version:
- 1.6.3
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private int[]
data
private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description IntMemoryArrayAccess(int[] data, int offset, int length)
Create an array access.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.int[]
getIntData()
Returns the array of this array access as anint[]
.ArrayAccess
subsequence(int offset, int length)
Create a sub-sequence view of this array access.-
Methods inherited from class org.apfloat.spi.ArrayAccess
getDoubleData, getFloatData, getLength, getLongData, getOffset
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
data
private int[] data
-
-
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 classArrayAccess
- Parameters:
offset
- The sub-sequence starting offset within this ArrayAccess.length
- The sub-sequence length.- Returns:
- The sub-sequence array access.
-
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 classArrayAccess
- Returns:
- The backing array of this array access.
-
getIntData
public int[] getIntData()
Description copied from class:ArrayAccess
Returns the array of this array access as anint[]
.- Overrides:
getIntData
in classArrayAccess
- 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 theArrayAccess
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 interfacejava.lang.AutoCloseable
- Specified by:
close
in classArrayAccess
- Throws:
ApfloatRuntimeException
-
-