vec_math
Class AssignedVariable

java.lang.Object
  extended by vec_math.AssignedVariable
All Implemented Interfaces:
Serializable, Variable
Direct Known Subclasses:
BoundedVariable

public class AssignedVariable
extends Object
implements Variable, Serializable

A simple named variable with error, name and unit.

See Also:
Serialized Form

Field Summary
private  double error
          Error of parameter.
private  String name
          Name of parameter.
private  String unit
          Parameter unit or empty.
private  double value
          Value of parameter.
 
Constructor Summary
AssignedVariable(String n, double v)
          Defaults to no unit and NaN as error.
AssignedVariable(String n, double v, double err)
          Defautls to no unit.
AssignedVariable(String n, double v, double err, String u)
          All parameter properties known.
 
Method Summary
static List<Variable> asList(String[] names, double[] vals, double[] errs, String[] units)
          For convenienve, we can transform an array of String names, values, errors and units to a list of model parameters.
 boolean equals(Object that)
          To variables are equal if they have the same name, value, error and unit.
 double getError()
          Getter method of private variable.
 String getName()
          Getter method of private variable.
 String getUnit()
          Getter method of private variable.
 double getValue()
          Getter method of private variable.
 int hashCode()
          Has from variable name.
static NumberFormat significant(Variable v)
          From the error we estimate a formatter that round to significant digits.
static NumberFormat significant(Variable v, int extra)
          From the error we estimate a formatter that round to significant digits.
 String toString()
          Name plus value, if error is NaN append with PM sign.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

private String name
Name of parameter.


value

private double value
Value of parameter.


error

private double error
Error of parameter.


unit

private String unit
Parameter unit or empty.

Constructor Detail

AssignedVariable

public AssignedVariable(String n,
                        double v)
Defaults to no unit and NaN as error.


AssignedVariable

public AssignedVariable(String n,
                        double v,
                        double err)
Defautls to no unit.


AssignedVariable

public AssignedVariable(String n,
                        double v,
                        double err,
                        String u)
All parameter properties known.

Method Detail

getName

public String getName()
Getter method of private variable.

Specified by:
getName in interface Variable

getValue

public double getValue()
Getter method of private variable.

Specified by:
getValue in interface Variable

getError

public double getError()
Getter method of private variable.

Specified by:
getError in interface Variable

getUnit

public String getUnit()
Getter method of private variable.

Specified by:
getUnit in interface Variable

equals

public boolean equals(Object that)
To variables are equal if they have the same name, value, error and unit.

Overrides:
equals in class Object

hashCode

public int hashCode()
Has from variable name.

Overrides:
hashCode in class Object

toString

public String toString()
Name plus value, if error is NaN append with PM sign.

Overrides:
toString in class Object

significant

public static NumberFormat significant(Variable v)
From the error we estimate a formatter that round to significant digits.


significant

public static NumberFormat significant(Variable v,
                                       int extra)
From the error we estimate a formatter that round to significant digits.


asList

public static List<Variable> asList(String[] names,
                                    double[] vals,
                                    double[] errs,
                                    String[] units)
For convenienve, we can transform an array of String names, values, errors and units to a list of model parameters. Note that the names and vals arrays must be defined.