org.crwth.systems.systems1d
Class Vector1d

java.lang.Object
  |
  +--org.crwth.systems.Vector
        |
        +--org.crwth.systems.systems1d.Vector1d
Direct Known Subclasses:
Vector2d

public class Vector1d
extends Vector


Field Summary
protected  double epsilon
           
protected  double X
           
 
Constructor Summary
Vector1d()
           
Vector1d(double x)
           
Vector1d(Vector vector)
           
Vector1d(Vector1d vector)
           
 
Method Summary
 void add(Vector vector)
          Adds a Vector to this Vector.
 void add(Vector1d vector)
          Adds one Vector to another.
 boolean equals(Vector vector)
          Returns whether two Vectors are equal.
 boolean equals(Vector1d vector)
          A refined implementation of equals().
 int getDimension()
          Returns the dimension of the object -- 1.
 double getDistance(Vector vector)
          Returns the distance to a Vector.
 double getDistance(Vector1d vector)
          A refined implementation of getDistance().
 Vector getInverse()
          Returns a Vector that is inverted along all axes to this object, maintaining the same magnitude.
 double getMagnitude()
          Returns the magnitude of the object.
 Vector getNormal()
          Returns a normal Vector to this Vector; that is, a Vector of magnitude 1 in the same direction as the object.
 Vector getVector(Vector vector)
          Returns a Vector from the object to the endpoint of vector.
 Vector getVector(Vector1d vector)
          A refined implementation of getVector().
 double getX()
          Returns the X coordinate of the object.
 void invert()
          Inverts the object along all axes.
 void normalize()
          Sets the object's magnitude to 1.
 void setMagnitude(double magnitude)
          Sets the magnitude of the object.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

X

protected double X

epsilon

protected double epsilon
Constructor Detail

Vector1d

public Vector1d()

Vector1d

public Vector1d(double x)

Vector1d

public Vector1d(Vector vector)
         throws WrongDimensionException

Vector1d

public Vector1d(Vector1d vector)
Method Detail

add

public void add(Vector vector)
         throws WrongDimensionException
Adds a Vector to this Vector. The equivalent of adding two vectors, each from the origin to the Vectors, and then taking the new vector's endpoint Vector.

Specified by:
add in class Vector
Parameters:
vector - the Vector to add to the object.
Throws:
WrongDimensionException - if vector has a mismatched dimension.

add

public void add(Vector1d vector)
Adds one Vector to another.

Parameters:
vector - the Vector to add to the object.

getDimension

public int getDimension()
Returns the dimension of the object -- 1.

Specified by:
getDimension in class Vector
Returns:
1.

getDistance

public double getDistance(Vector vector)
                   throws WrongDimensionException
Returns the distance to a Vector.

Specified by:
getDistance in class Vector
Parameters:
vector - the vector.
Returns:
the distance to the object vector
Throws:
WrongDimensionException - if vector has a mismatched dimension.

getDistance

public double getDistance(Vector1d vector)
A refined implementation of getDistance().

Parameters:
vector - the other vector.
Returns:
the distance to the object vector

invert

public void invert()
Inverts the object along all axes. Maintains magnitude.

Specified by:
invert in class Vector

getInverse

public Vector getInverse()
Returns a Vector that is inverted along all axes to this object, maintaining the same magnitude.

Specified by:
getInverse in class Vector
Returns:
an inverted Vector.

setMagnitude

public void setMagnitude(double magnitude)
Sets the magnitude of the object.

Specified by:
setMagnitude in class Vector
Parameters:
magnitude - the new magnitude.

getMagnitude

public double getMagnitude()
Returns the magnitude of the object.

Specified by:
getMagnitude in class Vector
Returns:
the object's magnitude.

normalize

public void normalize()
Sets the object's magnitude to 1. Equivalent to setMagnitude(1.0).

Specified by:
normalize in class Vector

getNormal

public Vector getNormal()
Returns a normal Vector to this Vector; that is, a Vector of magnitude 1 in the same direction as the object.

Specified by:
getNormal in class Vector
Returns:
a Vector of magnitude 1.

getVector

public Vector getVector(Vector vector)
                 throws WrongDimensionException
Returns a Vector from the object to the endpoint of vector.

Specified by:
getVector in class Vector
Parameters:
vector - the Vector to calculate to.
Returns:
the Vector from the object to vector.
Throws:
WrongDimensionException - if vector has a mismatched dimension.

getVector

public Vector getVector(Vector1d vector)
A refined implementation of getVector().

Parameters:
vector - the Vector to calculate to.
Returns:
the Vector from the object to vector.

getX

public double getX()
Returns the X coordinate of the object.

Returns:
the object's X coordinate.

equals

public boolean equals(Vector vector)
               throws WrongDimensionException
Returns whether two Vectors are equal.

Specified by:
equals in class Vector
Parameters:
vector - the Vector to compare this object to.
Returns:
true if the vector is equal to the object.
Throws:
WrongDimensionException - if vector has the wrong dimension.

equals

public boolean equals(Vector1d vector)
A refined implementation of equals().

Parameters:
vector - the Vector to compare this object to.
Returns:
true if the vector is equal to the object.

toString

public String toString()
Overrides:
toString in class Vector