org.haphazard.util
Class Dimension3D

java.lang.Object
  extended byorg.haphazard.util.Dimension3D

public class Dimension3D
extends java.lang.Object

A class for describing volume in three dimensions


Field Summary
 int height
          The height dimension; negative values can be used.
 int length
          The length dimension; negative values can be used.
 int width
          The width dimension; negative values can be used.
 
Constructor Summary
Dimension3D()
          Creates a new instance of Dimension3D
Dimension3D(int width, int height, int length)
          Creates a new instance of Dimension3D
 
Method Summary
 boolean envelopes(Dimension3D dimension)
          Checks if this dimension can completely envelope another dimension
 int getHeight()
          Gets the height
 int getLength()
          Gets the length
 int getWidth()
          Gets the width
 int getVolume()
          Gets the volume of this container, always positive
 void setSize(int width, int height)
          Sets the size in two dimensions
 void setSize(int width, int height, int length)
          Sets the size of all dimensions
 java.lang.String toXML(int indent)
          Transforms this object into an XML notation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

height

public int height
The height dimension; negative values can be used.


width

public int width
The width dimension; negative values can be used.


length

public int length
The length dimension; negative values can be used.

Constructor Detail

Dimension3D

public Dimension3D()
Creates a new instance of Dimension3D


Dimension3D

public Dimension3D(int width,
                   int height,
                   int length)
Creates a new instance of Dimension3D

Parameters:
width - The width
height - The height
length - The length
Method Detail

getHeight

public int getHeight()
Gets the height

Returns:
The height

getWidth

public int getWidth()
Gets the width

Returns:
The width

getLength

public int getLength()
Gets the length

Returns:
The length

getVolume

public int getVolume()
Gets the volume of this container, always positive

Returns:
The dimension

setSize

public void setSize(int width,
                    int height)
Sets the size in two dimensions

Parameters:
width - The width
height - The height

setSize

public void setSize(int width,
                    int height,
                    int length)
Sets the size of all dimensions

Parameters:
width - The width
height - The height
length - The length

envelopes

public boolean envelopes(Dimension3D dimension)
Checks if this dimension can completely envelope another dimension

Parameters:
dimension - The dimension to check against
Returns:
True if the other dimension is enveloped by this one

toXML

public java.lang.String toXML(int indent)
Transforms this object into an XML notation

Parameters:
indent - The indent level
Returns:
A string in XML notation