public class Values
extends java.lang.Object
implements java.lang.Iterable<java.lang.Double>
As a style sheet may express values in several different units. This class purpose is to pack the value and the units it is expressed in into a single object.
Modifier and Type | Field and Description |
---|---|
StyleConstants.Units |
units
The values units.
|
java.util.ArrayList<java.lang.Double> |
values
The value.
|
Constructor and Description |
---|
Values(StyleConstants.Units units,
double... values)
New value set with one initial value.
|
Values(Value value)
New set of one value.
|
Values(Values other)
New copy of another value set.
|
Modifier and Type | Method and Description |
---|---|
void |
addValues(double... values)
Append the given set of values at the end of this set.
|
void |
copy(Values values)
Copy the given values to this set.
|
boolean |
equals(java.lang.Object o) |
double |
get(int i)
The i-th value of this set.
|
StyleConstants.Units |
getUnits()
Values units.
|
int |
getValueCount()
Number of values in this set.
|
void |
insertValue(int i,
double value)
Insert the given value at the given index.
|
java.util.Iterator<java.lang.Double> |
iterator() |
void |
removeValue(int i)
Remove the i-th value.
|
void |
setUnits(StyleConstants.Units units)
Change the values units.
|
void |
setValue(int i,
double value)
Change the i-th value.
|
int |
size()
Number of values in this set.
|
java.lang.String |
toString() |
public java.util.ArrayList<java.lang.Double> values
public StyleConstants.Units units
public Values(StyleConstants.Units units, double... values)
units
- The values units.values
- A variable count of values.public Values(Values other)
other
- The other values to copy.public Values(Value value)
value
- The value to copy with its units.public int size()
public int getValueCount()
public double get(int i)
i
- The value index.public StyleConstants.Units getUnits()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.util.Iterator<java.lang.Double> iterator()
iterator
in interface java.lang.Iterable<java.lang.Double>
public java.lang.String toString()
toString
in class java.lang.Object
public void copy(Values values)
values
- The values to copy.public void addValues(double... values)
values
- The value set to append.public void insertValue(int i, double value)
i
- Where to insert the value.value
- The value to insert.public void setValue(int i, double value)
i
- The value index.value
- The value to put.public void removeValue(int i)
i
- The index at which the value is to be removed.public void setUnits(StyleConstants.Units units)
units
- The units.