U - Unit the unit for which this Vector will be createdpublic abstract class FloatVector<U extends Unit<U>> extends AbstractValue<U> implements FloatVectorInterface<U>, Serializable
Copyright (c) 2015-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License.
$LastChangedDate: 2016-05-28 14:25:52 +0200 (Sat, 28 May 2016) $, @version $Revision: 202 $, by $Author: averbraeck $,
initial version 30 Oct, 2015
| Modifier and Type | Class and Description |
|---|---|
static class |
FloatVector.Abs<U extends Unit<U>>
ABSOLUTE implementation of FloatVector.
|
static class |
FloatVector.Rel<U extends Unit<U>>
RELATIVE implementation of FloatVector.
|
| Modifier and Type | Field and Description |
|---|---|
protected FloatVectorData |
data
The stored data as an object, can be sparse or dense.
|
| Modifier | Constructor and Description |
|---|---|
protected |
FloatVector(U unit)
Construct a new Absolute Immutable FloatVector.
|
| Modifier and Type | Method and Description |
|---|---|
int |
cardinality()
Count the number of cells that have a non-zero value (ignores tolerance).
|
protected void |
checkIndex(int index)
Check that a provided index is valid.
|
protected void |
checkSize(float[] other)
Centralized size equality check.
|
protected void |
checkSize(FloatVector<?> other)
Centralized size equality check.
|
(package private) static <U extends Unit<U>> |
checkUnit(FloatScalar<U>[] dsArray)
Check that a provided array can be used to create some descendant of a FloatVector, and return the Unit.
|
(package private) static <U extends Unit<U>,S extends FloatScalar<U>> |
checkUnit(List<S> dsList)
Check that a provided list can be used to create some descendant of a FloatVector, and return the Unit.
|
(package private) static <U extends Unit<U>,S extends FloatScalar<U>> |
checkUnit(SortedMap<Integer,S> dsMap)
Check that a provided Map can be used to create some descendant of a FloatVector.
|
boolean |
equals(Object obj) |
protected FloatVectorData |
getData() |
float |
getInUnit(int index)
Retrieve the value stored at a specified position in the original unit.
|
float |
getInUnit(int index,
U targetUnit)
Retrieve the value stored at a specified position converted into a specified unit.
|
float |
getSI(int index)
Retrieve the value stored at a specified position in the standard SI unit.
|
StorageType |
getStorageType()
Return the StorageType (DENSE, SPARSE, etc.) for the stored Vector.
|
float[] |
getValuesInUnit()
Create a float[] array filled with the values in the original unit.
|
float[] |
getValuesInUnit(U targetUnit)
Create a float[] array filled with the values converted into a specified unit.
|
float[] |
getValuesSI()
Create a float[] array filled with the values in the standard SI unit.
|
int |
hashCode() |
(package private) static <U extends Unit<U>> |
instantiateAbs(FloatVectorData dvData,
U unit)
Instantiate a vector based on the type of data.
|
(package private) static <U extends Unit<U>> |
instantiateRel(FloatVectorData dvData,
U unit)
Instantiate a vector based on the type of data.
|
int |
size()
Retrieve the size of the vector.
|
String |
toString() |
String |
toString(boolean verbose,
boolean withUnit)
Print this FloatVector with optional type and unit information.
|
String |
toString(U displayUnit)
Print this FloatVector with the values expressed in the specified unit.
|
String |
toString(U displayUnit,
boolean verbose,
boolean withUnit)
Print this FloatVector with the values expressed in the specified unit.
|
float |
zSum()
Compute the sum of all values of this vector.
|
expressAsSIUnit, expressAsSpecifiedUnit, getUnit, isAbsolute, isRelativeclone, finalize, getClass, notify, notifyAll, wait, wait, waitget, mutable, toDense, toSparseprotected FloatVectorData data
protected FloatVector(U unit)
unit - U; the unit of the new Absolute Immutable FloatVectorprotected final FloatVectorData getData()
public final StorageType getStorageType()
static <U extends Unit<U>> U checkUnit(FloatScalar<U>[] dsArray) throws ValueException
U - the unitdsArray - the array to check and get the unit forValueException - when the array has length equal to 0static <U extends Unit<U>,S extends FloatScalar<U>> U checkUnit(List<S> dsList) throws ValueException
U - the unitS - the scalar in the listdsList - the list to check and get the unit forValueException - when the array has length equal to 0static <U extends Unit<U>,S extends FloatScalar<U>> U checkUnit(SortedMap<Integer,S> dsMap) throws ValueException
U - Unit; the unit of the FloatScalar listS - the scalar in the listdsMap - the provided mapValueException - when the list has size equal to 0static <U extends Unit<U>> FloatVector.Rel<U> instantiateRel(FloatVectorData dvData, U unit)
U - the unitdvData - the FloatVectorDataunit - the unit to usestatic <U extends Unit<U>> FloatVector.Abs<U> instantiateAbs(FloatVectorData dvData, U unit)
U - the unitdvData - the FloatVectorDataunit - the unit to usepublic final float[] getValuesSI()
getValuesSI in interface FloatVectorInterface<U extends Unit<U>>public final float[] getValuesInUnit()
getValuesInUnit in interface FloatVectorInterface<U extends Unit<U>>public final float[] getValuesInUnit(U targetUnit)
getValuesInUnit in interface FloatVectorInterface<U extends Unit<U>>targetUnit - U; the unit into which the values are converted for usepublic final int size()
size in interface FloatVectorInterface<U extends Unit<U>>protected final void checkIndex(int index)
throws ValueException
index - int; the value to checkValueException - when index is invalidpublic final float getSI(int index)
throws ValueException
getSI in interface FloatVectorInterface<U extends Unit<U>>index - int; index of the value to retrieveValueException - when index out of range (index < 0 or index >= size())public final float getInUnit(int index)
throws ValueException
getInUnit in interface FloatVectorInterface<U extends Unit<U>>index - int; index of the value to retrieveValueException - when index out of range (index < 0 or index >= size())public final float getInUnit(int index,
U targetUnit)
throws ValueException
getInUnit in interface FloatVectorInterface<U extends Unit<U>>index - int; index of the value to retrievetargetUnit - U; the unit for the resultValueException - when index out of range (index < 0 or index >= size())public final float zSum()
zSum in interface FloatVectorInterface<U extends Unit<U>>public final int cardinality()
cardinality in interface FloatVectorInterface<U extends Unit<U>>public final String toString()
public final String toString(U displayUnit)
toString in interface FloatVectorInterface<U extends Unit<U>>displayUnit - U; the unit into which the values are converted for displaypublic final String toString(boolean verbose, boolean withUnit)
toString in interface FloatVectorInterface<U extends Unit<U>>verbose - boolean; if true; include type info; if false; exclude type infowithUnit - boolean; if true; include the unit; of false; exclude the unitpublic final String toString(U displayUnit, boolean verbose, boolean withUnit)
toString in interface FloatVectorInterface<U extends Unit<U>>displayUnit - U; the unit into which the values are converted for displayverbose - boolean; if true; include type info; if false; exclude type infowithUnit - boolean; if true; include the unit; of false; exclude the unitprotected final void checkSize(FloatVector<?> other) throws ValueException
other - FloatVector<?>; other FloatVectorValueException - when other is null, or vectors have unequal sizeprotected final void checkSize(float[] other)
throws ValueException
other - float[]; array of floatValueException - when vectors have unequal sizeCopyright © 2015–2016 Delft University of Technology. All rights reserved.