algo
Class Point

java.lang.Object
  extended by algo.Point
All Implemented Interfaces:
java.io.Serializable

public class Point
extends java.lang.Object
implements java.io.Serializable

A Point in a 2d Graph. Defined by an x- and y-coordinate and given a number.

Author:
Heinz Kredel.
See Also:
Serialized Form

Field Summary
 int n
           
 double x
           
 double y
           
 
Constructor Summary
Point(int n, double x, double y)
           
 
Method Summary
static Point random(int n, java.util.Random r, double m)
           
static Point scaleTo(Point p, double scale)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

n

public final int n

x

public final double x

y

public final double y
Constructor Detail

Point

public Point(int n,
             double x,
             double y)
Parameters:
n - the number of the point
x - coordinate.
y - coordinate.
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

random

public static Point random(int n,
                           java.util.Random r,
                           double m)
Parameters:
n - the number of the point
r - a random number generator.
m - maximal coordinate range.
Returns:
point with random x- and y-coordinates less than m.

scaleTo

public static Point scaleTo(Point p,
                            double scale)
Parameters:
p - a Point to be scaled.
scale - a scale factor.
Returns:
a point with x- and y-coordinates multiplied by scale.