com.hedgehog.geo
Class PolygonType

java.lang.Object
  extended by com.hedgehog.HObject
      extended by com.hedgehog.geo.PolygonType
All Implemented Interfaces:
java.lang.Comparable, java.util.Comparator

public class PolygonType
extends HObject

Title: PolygonType - indicates the type of a polygon.

Description: Stores the type of a polygon, such as CONVEX.

Copyright: Copyright (c) Hedgehog Software 2007-2009.

Company: Hedgehog Software

Since:
1.0
Version:
1.1

Field Summary
static int CONCAVE
          Indicates a concave polygon.
static int CONVEX
          Indicates a convex polygon.
static int CONVEX_QUADRILATERAL
          Indicates a convex quadrilateral.
protected  int mPolygonType
          Polygon type.
static int QUADRILATERAL
          Indicates a quadrilateral.
static int REGULAR
          Indicates a regular polygon.
static int TRIANGLE
          Indicates a triangle.
static int UNKNOWN
          Indicates an unknown polygon type.
 
Fields inherited from class com.hedgehog.HObject
mID, mName
 
Constructor Summary
PolygonType()
          Default constructor.
PolygonType(int polygonType)
          Constructor.
PolygonType(PolygonType object)
          Copy constuctor.
 
Method Summary
 int getPolygonType()
          Returns the polygon type.
 boolean isConcave()
          Tests whether or not the polygon type is concave.
 boolean isConvex()
          Tests whether or not the polygon type is convex.
 boolean isConvexQuadrilateral()
          Tests whether or not the polygon type is a convex quadrilateral.
 boolean isQuadrilateral()
          Tests whether or not the polygon type is a quadrilateral.
 boolean isRegular()
          Tests whether or not the polygon type is a regular polygon.
 boolean isTriangle()
          Tests whether or not the polygon type is a triangle.
static boolean isValid(int polygonType)
          Tests whether or not the specified type is valid.
static java.lang.String polygonTypeString(int polygonType)
          Returns a String equivalent of the specified polygon type.
 boolean setPolygonType(int polygonType)
          Sets the polygon type.
 java.lang.String toString()
          Returns a String representation of a PolygonType object.
 
Methods inherited from class com.hedgehog.HObject
clone, compare, compareTo, copy, equals, getID, getName, hashCode, hasID, hasName, setID, setName
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

mPolygonType

protected int mPolygonType
Polygon type.


CONVEX

public static final int CONVEX
Indicates a convex polygon.

See Also:
Constant Field Values

CONCAVE

public static final int CONCAVE
Indicates a concave polygon.

See Also:
Constant Field Values

TRIANGLE

public static final int TRIANGLE
Indicates a triangle.

See Also:
Constant Field Values

QUADRILATERAL

public static final int QUADRILATERAL
Indicates a quadrilateral.

See Also:
Constant Field Values

CONVEX_QUADRILATERAL

public static final int CONVEX_QUADRILATERAL
Indicates a convex quadrilateral.

See Also:
Constant Field Values

REGULAR

public static final int REGULAR
Indicates a regular polygon.

See Also:
Constant Field Values

UNKNOWN

public static final int UNKNOWN
Indicates an unknown polygon type.

See Also:
Constant Field Values
Constructor Detail

PolygonType

public PolygonType()
Default constructor. Sets the polygon type to UNKNOWN.


PolygonType

public PolygonType(int polygonType)
            throws java.lang.IllegalArgumentException
Constructor. Sets the polygon type to the specified value.

Parameters:
polygonType - Polygon type.
Throws:
java.lang.IllegalArgumentException - Thrown if the specified polygon type is invalid.

PolygonType

public PolygonType(PolygonType object)
Copy constuctor.

Parameters:
object - Object to copy.
Method Detail

getPolygonType

public int getPolygonType()
Returns the polygon type.

Returns:
Polygon type.

setPolygonType

public boolean setPolygonType(int polygonType)
Sets the polygon type.

Parameters:
polygonType - Polygon type.
Returns:
Logical-true if the polygon type is set, else logical-false.

isConvex

public boolean isConvex()
Tests whether or not the polygon type is convex.

Returns:
Logical-true if the polygon type is convex, else logial-false.

isConcave

public boolean isConcave()
Tests whether or not the polygon type is concave.

Returns:
Logical-true if the polygon type is concave, else logial-false.

isTriangle

public boolean isTriangle()
Tests whether or not the polygon type is a triangle.

Returns:
Logical-true if the polygon type is a triangle, else logial-false.

isQuadrilateral

public boolean isQuadrilateral()
Tests whether or not the polygon type is a quadrilateral.

Returns:
Logical-true if the polygon type is a quadrilateral, else logial-false.

isConvexQuadrilateral

public boolean isConvexQuadrilateral()
Tests whether or not the polygon type is a convex quadrilateral.

Returns:
Logical-true if the polygon type is a convex quadrilateral, else logial-false.

isRegular

public boolean isRegular()
Tests whether or not the polygon type is a regular polygon.

Returns:
Logical-true if the polygon type is a regular polygon, else logial-false.

toString

public java.lang.String toString()
Returns a String representation of a PolygonType object.

Overrides:
toString in class java.lang.Object
Returns:
A String representation of a PolygonType object.

isValid

public static boolean isValid(int polygonType)
Tests whether or not the specified type is valid. Note: Type UNKNOWN is considered valid.

Parameters:
polygonType - Polygon type.
Returns:
Logical-true if the specified type is valid, else logical-false.

polygonTypeString

public static java.lang.String polygonTypeString(int polygonType)
Returns a String equivalent of the specified polygon type.

Parameters:
polygonType - Regular polygon type.
Returns:
String equivalent of the polygon type.