Package geomss.geom
Class AbstractGeomElement<T extends AbstractGeomElement>
- java.lang.Object
-
- geomss.geom.AbstractGeomElement<T>
-
- Type Parameters:
T
- The sub-type of this AbstractGeomElement element.
- All Implemented Interfaces:
GeomElement<T>
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable
,javolution.lang.Reusable
,javolution.xml.XMLSerializable
- Direct Known Subclasses:
AbstractCurve
,AbstractGeomList
,AbstractNote
,AbstractSurface
,GeomPlane
,GeomPoint
,GeomTriangle
,GeomVector
public abstract class AbstractGeomElement<T extends AbstractGeomElement> extends java.lang.Object implements GeomElement<T>, javolution.lang.Reusable
A partial implementation of theGeomElement
interface.Modified by: Joseph A. Huwaldt
- Version:
- January 30, 2017
- Author:
- Joseph A. Huwaldt, Date: March 31, 2000
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.ResourceBundle
RESOURCES
The resource bundle for this package.
-
Constructor Summary
Constructors Constructor Description AbstractGeomElement()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChangeListener(javax.swing.event.ChangeListener listener)
Add a listener that is notified of changes to the state of this element.java.lang.Object
clone()
Returns a copy of this GeomElement instanceallocated
by the calling thread (possibly on the stack).int
compareTo(java.lang.Object otherElement)
Compares this geometry element with the specified element for order (where order is determined by the element's name).boolean
equals(java.lang.Object obj)
Compares the specified object with this object for equality.java.util.Map<java.lang.Object,java.lang.Object>
getAllUserData()
Returns a new Map containing all the user objects associated with this geometry element.long
getID()
Return the unique ID number of this geometry element.java.lang.String
getName()
Return the name of this geometry element.java.lang.Object
getUserData(java.lang.Object key)
Return any user defined object associated with this geometry element and the specified key.int
hashCode()
Returns the hash code for thisAbstractGeomElement
.void
putAllUserData(java.util.Map data)
Add all the user defined data in the supplied Map to this objects map of user defined data.void
putUserData(java.lang.Object key, java.lang.Object value)
Set the user defined object associated with this geometry element and the specified key.void
removeChangeListener(javax.swing.event.ChangeListener listener)
Remove a listener from receiving notifications of changes to the state of this element.void
removeUserData(java.lang.Object key)
Removes the entry for the specified user object key if present.void
reset()
Resets the internal state of this object to its default values.void
setName(java.lang.String name)
Change the name of this geometry element to the specified name (may benull
to clear the name and make it undefined).java.lang.String
toString()
Returns a string representation of this geometry element.javolution.text.Text
toText()
Returns the text representation of this geometry element.-
Methods inherited from interface geomss.geom.GeomElement
copy, copyToReal, getBoundsMax, getBoundsMin, getLimitPoint, getParDimension, getPhyDimension, getUnit, isValid, size, to, toDimension
-
-
-
-
Field Detail
-
RESOURCES
public static final java.util.ResourceBundle RESOURCES
The resource bundle for this package.
-
-
Constructor Detail
-
AbstractGeomElement
public AbstractGeomElement()
-
-
Method Detail
-
getID
public long getID()
Return the unique ID number of this geometry element.- Specified by:
getID
in interfaceGeomElement<T extends AbstractGeomElement>
- Returns:
- The unique ID of this geometry element.
-
getName
public java.lang.String getName()
Return the name of this geometry element. If the name is not defined, thennull
is returned.- Specified by:
getName
in interfaceGeomElement<T extends AbstractGeomElement>
- Returns:
- The name of this geometry element.
-
setName
public void setName(java.lang.String name)
Change the name of this geometry element to the specified name (may benull
to clear the name and make it undefined).- Specified by:
setName
in interfaceGeomElement<T extends AbstractGeomElement>
- Parameters:
name
- The name of this geometry element.
-
addChangeListener
public void addChangeListener(javax.swing.event.ChangeListener listener)
Add a listener that is notified of changes to the state of this element.- Specified by:
addChangeListener
in interfaceGeomElement<T extends AbstractGeomElement>
- Parameters:
listener
- The listener to be notified of changes to the state of this element.
-
removeChangeListener
public void removeChangeListener(javax.swing.event.ChangeListener listener)
Remove a listener from receiving notifications of changes to the state of this element.- Specified by:
removeChangeListener
in interfaceGeomElement<T extends AbstractGeomElement>
- Parameters:
listener
- The listener to be removed from those being notified of changes to the state of this element.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
Returns a copy of this GeomElement instanceallocated
by the calling thread (possibly on the stack).- Returns:
- an identical and independent copy of this geometry element.
- Throws:
java.lang.CloneNotSupportedException
- Never thrown.- See Also:
GeomElement.copy()
-
equals
public boolean equals(java.lang.Object obj)
Compares the specified object with this object for equality. Returns true if and only if both AbstractGeomElement objects have the same name.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- the object to compare with.- Returns:
true
if this object is identical to that object;false
otherwise.
-
hashCode
public int hashCode()
Returns the hash code for thisAbstractGeomElement
.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- the hash code value.
-
toText
public javolution.text.Text toText()
Returns the text representation of this geometry element.- Specified by:
toText
in interfaceGeomElement<T extends AbstractGeomElement>
- Returns:
- The text representation of this geometry element.
-
toString
public java.lang.String toString()
Returns a string representation of this geometry element.- Overrides:
toString
in classjava.lang.Object
-
compareTo
public int compareTo(java.lang.Object otherElement)
Compares this geometry element with the specified element for order (where order is determined by the element's name). Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. This method delegates to the String.compareTo() method using the string representation of this element.- Specified by:
compareTo
in interfacejava.lang.Comparable<T extends AbstractGeomElement>
- Parameters:
otherElement
- The geometry element this one is being compared to.
-
getUserData
public java.lang.Object getUserData(java.lang.Object key)
Return any user defined object associated with this geometry element and the specified key. If there is no user data with the specified key, thennull
is returned.- Specified by:
getUserData
in interfaceGeomElement<T extends AbstractGeomElement>
- Parameters:
key
- the key whose associated value is to be returned. May not be null.- Returns:
- The user data associated with "key" or null if the specified key could not be found.
-
getAllUserData
public java.util.Map<java.lang.Object,java.lang.Object> getAllUserData()
Returns a new Map containing all the user objects associated with this geometry element.- Specified by:
getAllUserData
in interfaceGeomElement<T extends AbstractGeomElement>
- Returns:
- A new Map containing all the user objects associated with this geometry element.
-
putUserData
public void putUserData(java.lang.Object key, java.lang.Object value)
Set the user defined object associated with this geometry element and the specified key. This can be used to store any type of information with a geometry element that could be useful.- Specified by:
putUserData
in interfaceGeomElement<T extends AbstractGeomElement>
- Parameters:
key
- the key with which the specified value is to be associated. May not be null.value
- the value to be associated with the specified key. May not be null.
-
putAllUserData
public void putAllUserData(java.util.Map data)
Add all the user defined data in the supplied Map to this objects map of user defined data.- Specified by:
putAllUserData
in interfaceGeomElement<T extends AbstractGeomElement>
- Parameters:
data
- The Map of user defined data to be added to this object's map of user defined data.
-
removeUserData
public void removeUserData(java.lang.Object key)
Removes the entry for the specified user object key if present.- Specified by:
removeUserData
in interfaceGeomElement<T extends AbstractGeomElement>
- Parameters:
key
- the key whose mapping is to be removed from the map. May not be null.
-
reset
public void reset()
Resets the internal state of this object to its default values. Subclasses that override this method must callsuper.reset();
to ensure that the state is reset properly.- Specified by:
reset
in interfacejavolution.lang.Reusable
-
-