com.hedgehog
Class HObject

java.lang.Object
  extended by com.hedgehog.HObject
All Implemented Interfaces:
java.lang.Comparable, java.util.Comparator
Direct Known Subclasses:
AbsoluteTimer, AbstractLighting3D, Animation, AnimationManager, Animator, Appearance, ApproximateConvexHull2D, AreaCoordinateSystem2D, AreaPoint2D, Attribute, AttributeDatabaseExporter, AttributeDatabaseImporter, AttributeManager, Attributes, AttributeType, BackgroundGridCell2D, BackgroundGridCell3D, BalancedBinaryTree, BalancedBinaryTreeNode, Card, CardHand, ClockwiseAnticlockwise, Coin, Colour, ColourScale, ColourTable, Complex, ConvexHullMethod, CoordinatePlane, CoordinatePlaneType, CoordinateSystem2D, CoordinateSystem3D, Curve3DFactory, CurveType, Database, DatabaseImportExport, DatabaseType, DateUtilities, DayOfWeek, DegreesMinutesSeconds, DelaunayTriangulation2D, Dice, Die, DifferenceType, Direction, Ellipse2DEllipse2DIntersection, Epitrochoid2D, Equation, EquationsOfMotion, FacePosition, FFT, FillProperties, FloatingPointJavaSparseColumnVector, FloatingPointJavaSparseRowVector, FloatingPointSparseMatrixStorage, FloatingPointVector, FontStyle, Function, GaussDistribution, GeometricObject, GeometricObjectsType, Graph, GraphTreeArc, GraphTreeNode, GraphTreePath, GridEdge, GridPoint, GridPointCollection, GridPolygon, HDate, Homogeneity, HoursMinutesSeconds, HQueue, HSet, HStack, Hypotrochoid2D, IDManager, IDSetManager, IncrementalConvexHull2D, IndexObject, InOutOn, IntegerSet, IntegerVector, InterpolationOrder, InterpolatorType, Intersection, IntersectionType, Interval, JOGLObject, KeplerEquation, Key, KMeansPoint2D, KMeansPoint3D, LatitudeLongitude, LeastSquaresFit, LennardJones1, LennardJonesCircleLinear, Lighting3D, LineProperties, Loading, LoadingManager3D, Loadings, LoadingType, Lottery, Material, Material, MaterialManager, Matrix, Matrix2x2, Matrix3x3, Matrix4x4, MechanicsMaterial, MechanicsObject, MechanicsObjectLoadingManager, Mesh3D, MilkyWay, MinCircle2D, MinMaxInflexion, MinMaxInteger, MinSphere3D, Model, ModelAttributeMapping, ModelBoolean, ModelByte, ModelDatabaseExporter, ModelDatabaseImporter, ModelDatabaseManager, ModelDouble, ModelInteger, ModelObjectAnimationManager, ModelObjectAttributeManager, ModelObjectMapping, ModelPersistenceType, ModelsManager, ModelState, ModelString, ModelX3DExporter, ModelXMLExporter, ModelXMLImporter, NVariablePolynomial, NVariableTerm, OneVariableBisectionOptimiser, Packing2D, Packing3D, PackOfCards, Pair, PairDouble, PairIntDouble, PairInteger, PairPQ, ParametricPair, ParametricRectangle, ParametricSegment, ParametricTriangle, ParametricTriple, ParametricVariable, ParticlePosition, Particles2D, Particles3D, ParticleState, Permutations, PiecewiseLinearInterpolation, PlayBackTimer, PointProximity, Polygon2DTriangulation, PolygonType, PolyhedronType, ProfileType, Projection, ProjectionType, Projector, QuadraticCurveFit, QuadraticShape2D, Quadruple, QuadrupleDouble, QuadrupleInteger, Quaternion, RegularPolygonType, RightAscensionDeclination, RiseSetAltitudes, SampleAnalysisDouble, SampleAnalysisInt, SimultaneousPolynomials, SparseMatrixStorageType, SparseVector, StressState, Suit, SunTracker, SurfaceFeatures, TensorNx1, TensorNxN, Text, Texture, TextureTransform, Time, TimeIntegrator, TrianglePointProximity, TriangleQualityType, TriangleType, TriangulationMethod, Triple, TripleDouble, TripleDoubleIntInt, TripleFunctionCurveFit, TripleIntDoubleDouble, TripleInteger, TriplePQR, Trochoid2D, TwoVariableBisectionOptimiser, Unit, UnitManager, UTM, Vector2D, Vector3D, VerticesEdgesFaces, VolumeCoordinateSystem3D, VolumePoint3D, WeibullDistribution, World, X3DField, X3DImportExport, X3DMetadataObject, X3DNode, X3DObject, XMLDOMUtilities, XMLImportExport, XMLUtilities

public class HObject
extends java.lang.Object
implements java.util.Comparator, java.lang.Comparable

Title: HObject - base class of Hedgehog objects, extending directly from Java's Object.

Description: HObject Hedgehog Object class. Extends Java's Object class by appending both a string name and ID.

Implements Comparator and Comparable.

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

Company: Hedgehog Software.

Since:
1.0
Version:
1.1

Field Summary
protected  ID mID
          Object ID.
protected  java.lang.String mName
          Object name.
 
Constructor Summary
HObject()
          Default constructor.
HObject(HObject object)
          Copy constructor.
HObject(ID id)
          Constructor.
HObject(java.lang.String name)
          Constructor.
HObject(java.lang.String name, ID id)
          Constructor.
 
Method Summary
 java.lang.Object clone()
          Returns a clone of this object.
 int compare(java.lang.Object obj1, java.lang.Object obj2)
          Overrides the Comparator.compareTo() method.
 int compareTo(java.lang.Object obj)
          Overrides the Comparabler.compare() method.
 HObject copy()
          Returns a copy of this object.
 boolean equals(java.lang.Object obj)
          Tests whether or not the specified object is equal to this object.
 ID getID()
          Returns the object ID.
 java.lang.String getName()
          Returns the object name.
 int hashCode()
          Returns the hash code of this object.
 boolean hasID()
          Tests whether or not this object has a non-null ID.
 boolean hasName()
          Tests whether or not this object has a non-null and non-empty name.
 void setID(ID id)
          Sets the object ID.
 void setName(java.lang.String name)
          Sets the object name.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mName

protected java.lang.String mName
Object name.


mID

protected ID mID
Object ID.

Constructor Detail

HObject

public HObject()
Default constructor. Sets the name to a non-null but empty string. Sets the ID to a non-null default ID object.


HObject

public HObject(java.lang.String name)
Constructor. Sets the name to the specified string and sets the ID to the non-null default ID object.

Parameters:
name -

HObject

public HObject(ID id)
Constructor. Sets the ID to the specfied object. Sets the name to a non-null but empty string.

Parameters:
id - Object ID.

HObject

public HObject(java.lang.String name,
               ID id)
Constructor. Sets the name and ID to the specfied objects.

Parameters:
name - Object name.
id - Object ID.

HObject

public HObject(HObject object)
Copy constructor.

Parameters:
object - Object to copy.
Method Detail

getName

public java.lang.String getName()
Returns the object name.

Returns:
The object name.

getID

public ID getID()
Returns the object ID.

Returns:
The object ID.

setName

public void setName(java.lang.String name)
Sets the object name.

Parameters:
name - New object name.

setID

public void setID(ID id)
Sets the object ID.

Parameters:
id - New object ID.

hasID

public boolean hasID()
Tests whether or not this object has a non-null ID.

Returns:
Logical-true if this object has a non-null ID.

hasName

public boolean hasName()
Tests whether or not this object has a non-null and non-empty name.

Returns:
Logical-true if this object has a non-null and non-empty name.

copy

public HObject copy()
Returns a copy of this object.

Returns:
A copy of this object.

clone

public java.lang.Object clone()
Returns a clone of this object.

Overrides:
clone in class java.lang.Object
Returns:
A clone of this object.

equals

public boolean equals(java.lang.Object obj)
Tests whether or not the specified object is equal to this object.

Specified by:
equals in interface java.util.Comparator
Overrides:
equals in class java.lang.Object
Parameters:
obj - Object to compare.
Returns:
Logical-true if the specified object is equal (same name and ID) as this object, else logical-false.

hashCode

public int hashCode()
Returns the hash code of this object. Returns Object.hashCode().

Overrides:
hashCode in class java.lang.Object
Returns:
Hash code.

compare

public int compare(java.lang.Object obj1,
                   java.lang.Object obj2)
Overrides the Comparator.compareTo() method. Compares the object IDs against each other.

Specified by:
compare in interface java.util.Comparator
Parameters:
obj1 - Object 1.
obj2 - Object 2.
Returns:
0 if obj1==obj2, -1 if obj1obj2.

compareTo

public int compareTo(java.lang.Object obj)
Overrides the Comparabler.compare() method. Compares the object IDs against each other.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
obj - Object to compare against this object.
Returns:
0 if obj1==obj2, -1 if obj1obj2.