javoids
Class Shapes

java.lang.Object
  extended by javoids.Shapes
All Implemented Interfaces:
java.io.Serializable

public final class Shapes
extends java.lang.Object
implements java.io.Serializable

A class to represent the shapes in this game.

Author:
mallette
See Also:
Serialized Form

Nested Class Summary
static class Shapes.Shape
          An enum of available shapes.
 
Field Summary
private static java.util.HashMap<Shapes.Shape,java.util.Vector<java.awt.Color>> colorMap
          a mapping of shape names to colors that go with the areas of the shape
private static double cos30
          constant for cos(30 degrees)
private static double cos30_2
          constant for cos(30 degrees) / 2
private static double cos45
          constant for cos(45 degrees)
protected static int DEFAULT_SIZE
          the default size of a shape
protected static int MAX_SIZE
          the maximum size for a shape
protected static int MIN_SIZE
          the minimum size for a shape
private static long serialVersionUID
          This is the version used for serializing/deserializing (storing/retrieving) this object
private static java.util.HashMap<Shapes.Shape,java.util.Vector<java.awt.geom.Area>> shapeMap
          a mapping of shape names to areas that make up the shape
private static double sin30
          constant for sin(30 degrees)
private static double sin30_2
          constant for sin(30 degrees) / 2
private static double sin45
          constant for sin(45 degrees)
 
Constructor Summary
Shapes()
           
 
Method Summary
static java.util.Vector<java.awt.geom.Area> getAreas(Shapes.Shape shape, int _size, int maximumSize)
           
static java.util.Vector<java.awt.Color> getColors(Shapes.Shape shape)
           
static Shapes.Shape getShape(int number)
           
 java.lang.String toString()
          Provide a String representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
This is the version used for serializing/deserializing (storing/retrieving) this object

See Also:
Constant Field Values

sin30

private static final double sin30
constant for sin(30 degrees)


cos30

private static final double cos30
constant for cos(30 degrees)


sin30_2

private static final double sin30_2
constant for sin(30 degrees) / 2


cos30_2

private static final double cos30_2
constant for cos(30 degrees) / 2


sin45

private static final double sin45
constant for sin(45 degrees)


cos45

private static final double cos45
constant for cos(45 degrees)


MAX_SIZE

protected static final int MAX_SIZE
the maximum size for a shape

See Also:
Constant Field Values

MIN_SIZE

protected static final int MIN_SIZE
the minimum size for a shape

See Also:
Constant Field Values

DEFAULT_SIZE

protected static final int DEFAULT_SIZE
the default size of a shape

See Also:
Constant Field Values

shapeMap

private static java.util.HashMap<Shapes.Shape,java.util.Vector<java.awt.geom.Area>> shapeMap
a mapping of shape names to areas that make up the shape


colorMap

private static java.util.HashMap<Shapes.Shape,java.util.Vector<java.awt.Color>> colorMap
a mapping of shape names to colors that go with the areas of the shape

Constructor Detail

Shapes

public Shapes()
Method Detail

getShape

public static Shapes.Shape getShape(int number)
Parameters:
number - the integer representation of a shape (in order of the shape name appearing in the enum)
Returns:
the shape corresponding to the number, or no shape if the number is invalid

getAreas

public static java.util.Vector<java.awt.geom.Area> getAreas(Shapes.Shape shape,
                                                            int _size,
                                                            int maximumSize)
Parameters:
shape - the name of a shape
_size - the size of the areas used to represent this shape
maximumSize - the maximum size this shape can be
Returns:
the areas representing the shape

getColors

public static java.util.Vector<java.awt.Color> getColors(Shapes.Shape shape)
Parameters:
shape - the shape name
Returns:
the colors associated with each shape

toString

public java.lang.String toString()
Provide a String representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
String A representation of the object for debugging.