mr3d
Class PointArrayTable

java.lang.Object
  extended bymr3d.debug.ErrorHandling
      extended bymr3d.PointArrayTable
All Implemented Interfaces:
Debugable

public class PointArrayTable
extends ErrorHandling
implements Debugable

The point array table manages the 3D-points of a 3D-scene. It is a collection of 3D-points. It also is an administrative object that ensures that 3D-points are only stored once and it gives all classes an interface to access the points.

PointArrayTable is a Singleton.

Since:
MR3Dv1.0
Version:
10-2004
Author:
Manuel Ruelke

Field Summary
private static PointArrayTable instance
          Reference to the only instance of the class.
private static int nrOfInstances
          Stores the number of instances of ObjectArray.
private  java.util.Vector points
          vector containing all 3D-points of the scene
 
Fields inherited from class mr3d.debug.ErrorHandling
 
Fields inherited from interface mr3d.debug.Debugable
ERROR_INT, ERROR_STRING
 
Constructor Summary
private PointArrayTable()
          Creates a new PointArrayTable.
 
Method Summary
 void addPoint(Point3D newPoint)
          Adds a 3D-point to the point vector.
 void clearPoints()
          Clears out the point array table.
static PointArrayTable createInstance()
          Creates one instance of the PointArrayTable.
 Point3D getPoint(int index)
          Returns the 3D-point at the specified index
 int size()
          Returns the number of points in the point array table.
 void toConsole()
          Prints the contents of the object to the Java console.
 void toConsole(java.lang.String msgString)
          Prints the contents of the object to the Java console together with an information string.
 
Methods inherited from class mr3d.debug.ErrorHandling
getErrMsg, notifyError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

private static PointArrayTable instance
Reference to the only instance of the class.


nrOfInstances

private static int nrOfInstances
Stores the number of instances of ObjectArray. This is neccessary to make sure there is only one instance.


points

private java.util.Vector points
vector containing all 3D-points of the scene

Constructor Detail

PointArrayTable

private PointArrayTable()
Creates a new PointArrayTable. The constructor is private for PointArrayTable is a Singleton.

Method Detail

addPoint

public void addPoint(Point3D newPoint)
Adds a 3D-point to the point vector.

Parameters:
newPoint - point to be added

clearPoints

public void clearPoints()
Clears out the point array table. This is needed when a new scene should be loaded.


createInstance

public static PointArrayTable createInstance()
Creates one instance of the PointArrayTable. This method checks the nrOfInstances value to ensure only one instance is running. If nrOfIntances is greater then 0 the instance referenced in instance is returned.

Returns:
an instance of PointArrayTable

getPoint

public Point3D getPoint(int index)
Returns the 3D-point at the specified index

Parameters:
index - point array index of the point

size

public int size()
Returns the number of points in the point array table.


toConsole

public void toConsole()
Description copied from interface: Debugable
Prints the contents of the object to the Java console. How the information will be displayed depends on what data the object contains. Depending on structure and contents every implementation of this function produces a different result on the console.

Specified by:
toConsole in interface Debugable

toConsole

public void toConsole(java.lang.String msgString)
Description copied from interface: Debugable
Prints the contents of the object to the Java console together with an information string. How the information will be displayed depends on what data the object contains. Depending on structure and contents every implementation of this function produces a different result on the console.

Specified by:
toConsole in interface Debugable