public class DoubleArray extends Object implements NumberArrayAdapter<Double,DoubleArray>
Modifier and Type | Field and Description |
---|---|
double[] |
data
(Reused) store for numerical attributes.
|
int |
size
Number of numerical attributes.
|
Constructor and Description |
---|
DoubleArray()
Constructor.
|
DoubleArray(DoubleArray existing)
Constructor from an existing array.
|
DoubleArray(int initialsize)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
add(double attribute)
Add a numeric attribute value.
|
void |
clear()
Reset the numeric attribute counter.
|
Double |
get(DoubleArray array,
int off)
Get the off'th item from the array.
|
double |
get(int pos)
Get the value at this position.
|
byte |
getByte(DoubleArray array,
int off)
Get the off'th item from the array as byte.
|
double |
getDouble(DoubleArray array,
int off)
Get the off'th item from the array as double.
|
float |
getFloat(DoubleArray array,
int off)
Get the off'th item from the array as float.
|
int |
getInteger(DoubleArray array,
int off)
Get the off'th item from the array as integer.
|
long |
getLong(DoubleArray array,
int off)
Get the off'th item from the array as long.
|
short |
getShort(DoubleArray array,
int off)
Get the off'th item from the array as short.
|
void |
insert(int pos,
double val)
Insert a value at the given position.
|
void |
remove(int start,
int len)
Remove a range from the array.
|
void |
set(int pos,
double value)
Set the value at this position.
|
int |
size()
Get the size of the array.
|
int |
size(DoubleArray array)
Get the size of the array.
|
void |
sort()
Sort the contents.
|
double[] |
toArray()
Return a copy of the contents as array.
|
public double[] data
public int size
public DoubleArray()
public DoubleArray(int initialsize)
initialsize
- Initial size.public DoubleArray(DoubleArray existing)
existing
- Existing arraypublic void clear()
public void add(double attribute)
attribute
- Attribute value.public double get(int pos)
pos
- Positionpublic void set(int pos, double value)
pos
- Positionvalue
- Valuepublic void remove(int start, int len)
start
- Startlen
- Lengthpublic void insert(int pos, double val)
pos
- Insert positionval
- Value to insertpublic int size()
public void sort()
public int size(DoubleArray array)
ArrayAdapter
size
in interface ArrayAdapter<Double,DoubleArray>
size
in interface NumberArrayAdapter<Double,DoubleArray>
array
- Array-like thingpublic Double get(DoubleArray array, int off) throws IndexOutOfBoundsException
ArrayAdapter
get
in interface ArrayAdapter<Double,DoubleArray>
get
in interface NumberArrayAdapter<Double,DoubleArray>
array
- Array to get fromoff
- OffsetIndexOutOfBoundsException
- for an invalid index.public double getDouble(DoubleArray array, int off) throws IndexOutOfBoundsException
NumberArrayAdapter
getDouble
in interface NumberArrayAdapter<Double,DoubleArray>
array
- Array to get fromoff
- OffsetIndexOutOfBoundsException
- for an invalid index.public float getFloat(DoubleArray array, int off) throws IndexOutOfBoundsException
NumberArrayAdapter
getFloat
in interface NumberArrayAdapter<Double,DoubleArray>
array
- Array to get fromoff
- OffsetIndexOutOfBoundsException
- for an invalid index.public int getInteger(DoubleArray array, int off) throws IndexOutOfBoundsException
NumberArrayAdapter
getInteger
in interface NumberArrayAdapter<Double,DoubleArray>
array
- Array to get fromoff
- OffsetIndexOutOfBoundsException
- for an invalid index.public short getShort(DoubleArray array, int off) throws IndexOutOfBoundsException
NumberArrayAdapter
getShort
in interface NumberArrayAdapter<Double,DoubleArray>
array
- Array to get fromoff
- OffsetIndexOutOfBoundsException
- for an invalid index.public long getLong(DoubleArray array, int off) throws IndexOutOfBoundsException
NumberArrayAdapter
getLong
in interface NumberArrayAdapter<Double,DoubleArray>
array
- Array to get fromoff
- OffsetIndexOutOfBoundsException
- for an invalid index.public byte getByte(DoubleArray array, int off) throws IndexOutOfBoundsException
NumberArrayAdapter
getByte
in interface NumberArrayAdapter<Double,DoubleArray>
array
- Array to get fromoff
- OffsetIndexOutOfBoundsException
- for an invalid index.public double[] toArray()
Copyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.