com.tensegrity.graphics
Class Size

java.lang.Object
  extended bycom.tensegrity.graphics.Size

public class Size
extends java.lang.Object

The Size class represents the extension of an object. The Size class is not restricted to have a fixed amount of components such that a Size can have any number of dimensions. The Size class stores the components of the extend it represents in an integer array. In order to work with the Size class in an performant manner this array has public visibility. It is strongly recommended to be aware of what you are doing with this array, because you have full excess and do everything with it. This implies that you can harm it! The indices of the single extensions within this array are defined through X_EXTENSION, Y_EXTENSION and Z_EXTENSION for 2D space and 3D space.

Notice that it is really necessary to work as fast as fast can be with the Size class repectively with its single extensions. To get fast access to the single extensions it is recommended to declared a local variable as explained below. This also increases the guarantee that the extensions array will not be harmed!

 Size size = anObject.getSize();
 final int[] extensions = size.extensions;
 
 extensions[Size.X_EXTENSION] = 100;
 extensions[Size.Y_EXTENSION] = 100;
 

Version:
$Id: Size.java,v 1.10 2005/04/01 15:42:39 MichaelKegel Exp $
Author:
MichaelKegel

Field Summary
 int[] extensions
          instance variable for the single components of the size
static int X_EXTENSION
          constant that tells about the indices of the size's components
static int Y_EXTENSION
          constant that tells about the indices of the size's components
static int Z_EXTENSION
          constant that tells about the indices of the size's components
 
Constructor Summary
Size()
          Default constructor for Size that initializes it for 2D space.
Size(int[] extensions)
          Constructor for Size with array of extensions given extensions for a non fixed number of dimensions.
Size(int dx, int dy)
          Constructor for Size with given extensions for the x axis and the y axis.
Size(int dx, int dy, int dz)
          Constructor for Size with given extensions for the x axis, y axis and the z axis.
Size(Size size)
          Copy constructor for Size.
 
Method Summary
 int getDimensions()
          Returns the number of dimensions this Size consist of.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

X_EXTENSION

public static final int X_EXTENSION
constant that tells about the indices of the size's components

See Also:
Constant Field Values

Y_EXTENSION

public static final int Y_EXTENSION
constant that tells about the indices of the size's components

See Also:
Constant Field Values

Z_EXTENSION

public static final int Z_EXTENSION
constant that tells about the indices of the size's components

See Also:
Constant Field Values

extensions

public int[] extensions
instance variable for the single components of the size

Constructor Detail

Size

public Size()
Default constructor for Size that initializes it for 2D space.


Size

public Size(int dx,
            int dy)
Constructor for Size with given extensions for the x axis and the y axis.

Parameters:
dx - the extension on the x axis
dy - the extension on the y axis

Size

public Size(int dx,
            int dy,
            int dz)
Constructor for Size with given extensions for the x axis, y axis and the z axis.

Parameters:
dx - the extension on the x axis
dy - the extension on the y axis
dz - the extension on the z axis

Size

public Size(int[] extensions)
Constructor for Size with array of extensions given extensions for a non fixed number of dimensions.

Parameters:
extensions - the extensions on the different axes

Size

public Size(Size size)
Copy constructor for Size.

Parameters:
size - the Size instance to create a copy of
Method Detail

getDimensions

public int getDimensions()
Returns the number of dimensions this Size consist of.

Returns:
int the number of dimension

toString

public java.lang.String toString()


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.