org.graphstream.ui.graphicGraph.stylesheet
Class Values

java.lang.Object
  extended by org.graphstream.ui.graphicGraph.stylesheet.Values
All Implemented Interfaces:
Iterable<Double>

public class Values
extends Object
implements Iterable<Double>

Several values and the units of these values.

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.


Field Summary
 StyleConstants.Units units
          The values units.
 ArrayList<Double> values
          The value.
 
Constructor Summary
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.
 
Method Summary
 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(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.
 Iterator<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.
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

values

public ArrayList<Double> values
The value.


units

public StyleConstants.Units units
The values units.

Constructor Detail

Values

public Values(StyleConstants.Units units,
              double... values)
New value set with one initial value.

Parameters:
units - The values units.
values - A variable count of values.

Values

public Values(Values other)
New copy of another value set.

Parameters:
other - The other values to copy.

Values

public Values(Value value)
New set of one value.

Parameters:
value - The value to copy with its units.
Method Detail

size

public int size()
Number of values in this set.

Returns:
The number of values.

getValueCount

public int getValueCount()
Number of values in this set.

Returns:
The number of values.

get

public double get(int i)
The i-th value of this set. If the index is less than zero, the first value is given, if the index if greater or equal to the number of values, the last value is given.

Parameters:
i - The value index.
Returns:
The corresponding value.

getUnits

public StyleConstants.Units getUnits()
Values units.

Returns:
The units used for each value.

equals

public boolean equals(Object o)
Overrides:
equals in class Object

iterator

public Iterator<Double> iterator()
Specified by:
iterator in interface Iterable<Double>

toString

public String toString()
Overrides:
toString in class Object

copy

public void copy(Values values)
Copy the given values to this set. The units are also copied.

Parameters:
values - The values to copy.

addValues

public void addValues(double... values)
Append the given set of values at the end of this set.

Parameters:
values - The value set to append.

insertValue

public void insertValue(int i,
                        double value)
Insert the given value at the given index.

Parameters:
i - Where to insert the value.
value - The value to insert.

setValue

public void setValue(int i,
                     double value)
Change the i-th value.

Parameters:
i - The value index.
value - The value to put.

removeValue

public void removeValue(int i)
Remove the i-th value.

Parameters:
i - The index at which the value is to be removed.

setUnits

public void setUnits(StyleConstants.Units units)
Change the values units.

Parameters:
units - The units.


Copyright © 2011. All Rights Reserved.