mr3d
Class ObjectArray

java.lang.Object
  extended bymr3d.debug.ErrorHandling
      extended bymr3d.ObjectArray

public class ObjectArray
extends ErrorHandling

The class ObjectArray is a collection of all 3D-objects needed for the scene. It gives the SceneManager an interface to access all the objects in a 3D scene. ObjectArray is a Singleton.

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

Field Summary
private static ObjectArray instance
          Reference to the only instance of the class.
private static int nrOfInstances
          Stores the numbers of instances of ObjectArray.
private  java.util.Vector objects
          Contains all objects of a scene.
 
Fields inherited from class mr3d.debug.ErrorHandling
 
Constructor Summary
private ObjectArray()
          Creates a new object array.
 
Method Summary
 int addObject(TriangleBased3DObject newObject)
          Adds a new 3D-object to the object array.
 void clearObjectArray()
          Delete all content from the object array.
static ObjectArray createInstance()
          Creates one instance of the ObjectArray.
 TriangleBased3DObject getObject(int index)
          Returns the 3D-object at the specified position.
 void recalculate()
          Starts a recalculation process for all objects.
 int size()
          Returns the number of 3D-bjects in objects.
 void toConsole()
           
 void toConsole(java.lang.String msgString)
           
 
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 ObjectArray instance
Reference to the only instance of the class.


nrOfInstances

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


objects

private java.util.Vector objects
Contains all objects of a scene.

Constructor Detail

ObjectArray

private ObjectArray()
Creates a new object array.

Method Detail

addObject

public int addObject(TriangleBased3DObject newObject)
Adds a new 3D-object to the object array.

Parameters:
newObject - the new 3D object to be added to the scene
Returns:
Object Array index, that serves as object handle in the calling program section

clearObjectArray

public void clearObjectArray()
Delete all content from the object array.


createInstance

public static ObjectArray createInstance()
Creates one instance of the ObjectArray. This method checks the nrOfInstances value to ensure that only one instance is running.

Returns:
an instance of ObjectArray

getObject

public TriangleBased3DObject getObject(int index)
Returns the 3D-object at the specified position. If the position index is out of bounds the method returns null.

Parameters:
index - object array index
Returns:
3D object at the specified positon

recalculate

public void recalculate()
Starts a recalculation process for all objects.


size

public int size()
Returns the number of 3D-bjects in objects.


toConsole

public void toConsole()

toConsole

public void toConsole(java.lang.String msgString)