Class Point

java.lang.Object
  extended by Point

 class Point
extends Object

This class introduces points and enables basic operations with them. The coordinates are stored as a field of Fractions.

Since:
2014-04-01
Version:
1.0
Author:
Pavel Sikora

Constructor Summary
Point()
          Constructs a null point of dimension 0.
Point(Fraction[] A, int d)
          Constructs a point from a field of Fractions.
Point(int d)
          Constructs the origin.
Point(Point A, Vector V)
          Constructs a point from a point and a vector.
Point(Vector V)
          Constructs a point from a vector (from the origin).
 
Method Summary
(package private)  void copy(Point A)
          Copies another point onto this point.
(package private) static Point generateRandomPoint(int DIM)
          Generates a random point.
(package private)  Fraction get(int i)
          The getter of this class - returns the value of a given coordinate.
(package private)  int getDim()
          Gets the dimensions of the point.
(package private)  boolean isEqual(Point C)
          Checks if two points are equal.
(package private)  void set(Fraction F, int i)
          The setter of this class - sets given coordinate to a given value.
(package private)  Matrix toMatrixColumn()
          Converts the point to a 1-column matrix.
(package private)  Matrix toMatrixRow()
          Converts the point to a 1-row matrix.
(package private)  String toTeX()
          Prints this point formatted as TeX code.
(package private)  String toText()
          Prints this point formatted as text.
 
Methods inherited from class
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Point

Point()
Constructs a null point of dimension 0.


Point

Point(Fraction[] A,
      int d)
Constructs a point from a field of Fractions.

Parameters:
A - field of Fractions, containing the point's coordinates
d - dimension of the point, ie. number of its coordinates

Point

Point(int d)
Constructs the origin.

Parameters:
d - dimension of the point, ie. number of its coordinates

Point

Point(Point A,
      Vector V)
Constructs a point from a point and a vector.

Parameters:
A - initial point
V - vector
Throws:
UnsupportedOperationException - Throws an exception if the point and the vector don't have equal dimension.

Point

Point(Vector V)
Constructs a point from a vector (from the origin).

Parameters:
V - vector
Method Detail

copy

void copy(Point A)
Copies another point onto this point. This is the correct way of assigning points, not by =.

Parameters:
I - the image point

generateRandomPoint

static Point generateRandomPoint(int DIM)
Generates a random point.

Parameters:
DIM - dimension of the point (ie. a number of variables)

get

Fraction get(int i)
The getter of this class - returns the value of a given coordinate.

Parameters:
i - the index of desired coordinate
Returns:
the ith coordinate value (a Fraction)
Throws:
IndexOutOfBoundsException - Throws an exception if the index isn't of <1,dimension of the point>.

getDim

int getDim()
Gets the dimensions of the point.

Returns:
dimension of the point

isEqual

boolean isEqual(Point C)
Checks if two points are equal.

Parameters:
C - comparand point
Returns:
true if this point is equal to the comparand, false otherwise
Throws:
UnsupportedOperationException - Throws an exception if the point don't have equal dimension.

set

void set(Fraction F,
         int i)
The setter of this class - sets given coordinate to a given value.

Parameters:
F - the ith coordinate desired value (a Fraction)
i - the index of desired coordinate
Throws:
IndexOutOfBoundsException - Throws an exception if the index isn't of <1,dimension of the point>.

toMatrixColumn

Matrix toMatrixColumn()
Converts the point to a 1-column matrix.


toMatrixRow

Matrix toMatrixRow()
Converts the point to a 1-row matrix.


toTeX

String toTeX()
Prints this point formatted as TeX code.

Returns:
TeX code for this point

toText

String toText()
Prints this point formatted as text.

Returns:
plain text description of this point; it will begin with [ and end with ]