vec_math
Class PairError

java.lang.Object
  extended by vec_math.PairError

public class PairError
extends Object

A simple class that collects a double pair (x,y) and their errors (dx,dy). Both, the value pair and the errors are stored as Vector2D.


Field Summary
private  Vector2D error
          The errors to the values.
private  Vector2D value
          The value pair.
 
Constructor Summary
PairError()
          Constructs a new valuer/error pair.
PairError(double x, double y, double dx, double dy)
          Constructs a valid value/error pair.
PairError(Vector2D val, Vector2D err)
          Constructs a valid value/error pair.
 
Method Summary
 boolean equals(Object that)
          Checks for equality.
 double getErrorX()
          Returns the x-error.
 double getErrorY()
          Returns the y-error.
 double getValueX()
          Returns the x-value.
 double getValueY()
          Returns the y-value.
 void setError(double dx, double dy)
          Sets the error pair.
 void setValue(double x, double y)
          Sets the value pair.
 String toString()
          Convert the value/error pair to a string.
private  String valueError(int index)
          Takes the coordinate of the given index of the value and the error part and returns them combined with a plus/minus sign.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

value

private Vector2D value
The value pair.


error

private Vector2D error
The errors to the values.

Constructor Detail

PairError

public PairError()
Constructs a new valuer/error pair.


PairError

public PairError(Vector2D val,
                 Vector2D err)
Constructs a valid value/error pair. The values of the two-dimensional vectors are cloned, so changing the values of the arguments does not change the value of this value/error pair after construction.

Parameters:
val - Value, x and y.
err - Error, error of x and y.

PairError

public PairError(double x,
                 double y,
                 double dx,
                 double dy)
Constructs a valid value/error pair.

Parameters:
x - The x-value.
y - The y-value.
dx - The error of the x-value.
dy - The error of the y-value.
Method Detail

getValueX

public double getValueX()
Returns the x-value.


getValueY

public double getValueY()
Returns the y-value.


getErrorX

public double getErrorX()
Returns the x-error.


getErrorY

public double getErrorY()
Returns the y-error.


setValue

public void setValue(double x,
                     double y)
Sets the value pair. This method copies into the pre-constructed Vector2D.

Parameters:
x - The x-value.
y - The y-value.

setError

public void setError(double dx,
                     double dy)
Sets the error pair. This method copies into the pre-constructed Vector2D.

Parameters:
dx - The error of the x-value.
dy - The error of the y-value.

equals

public boolean equals(Object that)
Checks for equality. Two value/error pairs are equal if the Vector2D representing the value and the error are equal.

Overrides:
equals in class Object

toString

public String toString()
Convert the value/error pair to a string. A paranthesis at start, followed by the x-value, a plus/minus sign, then the x-error, a comma and the same procedure for y.

Overrides:
toString in class Object

valueError

private String valueError(int index)
Takes the coordinate of the given index of the value and the error part and returns them combined with a plus/minus sign.