public abstract class AbstractShape extends ICEObject implements IShape
Implements a number of operations shared between the components in the Shape composite pattern
iComponentVisitor
iComponentListener
Constructor and Description |
---|
AbstractShape()
Initializes the transformation matrix, creates the array containing the
key/value property pairs, and creates a listeners list
|
Modifier and Type | Method and Description |
---|---|
void |
accept(IComponentVisitor visitor)
This operation directs the Component to call back to an IComponentVisitor
so that the visitor can perform its required actions for the exact type
of the Component.
|
void |
copy(AbstractShape iceObject)
Copies the contents of a shape into the current object using a deep copy
|
boolean |
equals(java.lang.Object otherObject)
This operation is used to check equality between this shape and another
shape.
|
IShape |
getParent()
Returns the parent associated with this shape, or null if the shape does
not have a parent
|
java.lang.String |
getProperty(java.lang.String key)
Returns the value associated with the property key
|
Transformation |
getTransformation()
Returns a copy of the transformation matrix associated with this shape
node
|
int |
hashCode()
This operation returns the hashcode value of the shape.
|
boolean |
removeProperty(java.lang.String key)
Removes the value associated with the key in the properties list
|
boolean |
setProperty(java.lang.String key,
java.lang.String value)
Sets the property value associated with the key string
|
boolean |
setTransformation(Transformation transformation)
Replaces the transformation matrix with a copy of the given Matrix4x4
|
clone, copy, getDescription, getId, getName, register, setDescription, setId, setName, unregister, update
getClass, notify, notifyAll, toString, wait, wait, wait
acceptShapeVisitor
register, unregister, update
clone, getDescription, getId, getName, setDescription, setId, setName
public AbstractShape()
Initializes the transformation matrix, creates the array containing the key/value property pairs, and creates a listeners list
public Transformation getTransformation()
Returns a copy of the transformation matrix associated with this shape node
getTransformation
in interface IShape
The transformation matrix applied to this node in the CSG tree
public boolean setTransformation(Transformation transformation)
Replaces the transformation matrix with a copy of the given Matrix4x4
Returns whether the setting was successful
setTransformation
in interface IShape
transformation
- The transformation matrix to be applied to the shape
True if setting the transformation was successful, false otherwise
public java.lang.String getProperty(java.lang.String key)
Returns the value associated with the property key
If the key does not exist, this operation returns null.
getProperty
in interface IShape
key
- The key corresponding to the desired value
The value associated with the property key
public boolean setProperty(java.lang.String key, java.lang.String value)
Sets the property value associated with the key string
If the key does not yet exist, append the key/value pair to the end of the property list. If it exists, find and replace the property value with the new one.
setProperty
in interface IShape
key
- The new key
value
- The new value
True if the property setting is valid, false otherwise
public boolean removeProperty(java.lang.String key)
Removes the value associated with the key in the properties list
This operation returns whether the key was found and removed.
removeProperty
in interface IShape
key
- The key associated with the value to remove
True if the value was found and removed, false otherwise
public int hashCode()
This operation returns the hashcode value of the shape.
hashCode
in interface Identifiable
hashCode
in class ICEObject
The hashcode of the object
Identifiable.hashCode()
public boolean equals(java.lang.Object otherObject)
This operation is used to check equality between this shape and another shape. It returns true if the shape are equal and false if they are not.
equals
in interface Identifiable
equals
in class ICEObject
otherObject
- The other ICEObject that should be compared with this one.
True if the ICEObjects are equal, false otherwise.
Identifiable.equals(Object otherObject)
public void copy(AbstractShape iceObject)
Copies the contents of a shape into the current object using a deep copy
iceObject
- The ICEObject from which the values should be copied
public void accept(IComponentVisitor visitor)
This operation directs the Component to call back to an IComponentVisitor so that the visitor can perform its required actions for the exact type of the Component.