public class BasicMesh extends java.lang.Object implements IManagedUpdateableListener, IManagedUpdateable, IMesh
Constructor and Description |
---|
BasicMesh()
The default constructor
|
BasicMesh(java.util.ArrayList<IController> entities,
MeshType type)
A constructor which provides a set of child entities and a mesh type
|
BasicMesh(java.util.List<IController> entities)
A constructor which provides a set of child entities for the
MeshComponent.
|
BasicMesh(java.util.Map<java.lang.Object,java.lang.Object> input,
MeshType type)
A constructor taking a map of input to initialize the MeshComponent.
|
BasicMesh(MeshType type)
A constructor allowing the user to specify the mesh's type.
|
Modifier and Type | Method and Description |
---|---|
void |
addEntity(IController newEntity)
Add a new entity to the part.
|
void |
addEntityToCategory(IController newEntity,
IMeshCategory category)
Adds a new child entity under the given category.
|
java.lang.Object |
clone() |
void |
copy(IMesh otherObject)
Deep copies the contents of another AbstractMeshComponent into this one.
|
boolean |
equals(java.lang.Object otherObject) |
java.util.ArrayList<IController> |
getAllEntities()
Returns a list of all related entities.
|
IController |
getController()
Getter method for the controller.
|
java.util.Map<IMeshCategory,java.util.ArrayList<IController>> |
getEntities()
Get the entities map in the form of an array of map entries.
|
java.util.ArrayList<IController> |
getEntitiesFromCategory(IMeshCategory category)
Return all of the part's children entities of a given category.
|
<T extends IController> |
getEntitiesFromCategory(IMeshCategory category,
java.lang.Class<T> returnType)
Return all of the part's children entities of a given category cast to a
list of the specified return type.
|
java.util.Set<IMeshCategory> |
getEntityCategories()
Get the set of all categories in the mesh's entities map.
|
java.util.Map<IMeshProperty,java.lang.String> |
getProperties()
Get the properties map in the form of an array of map entries.
|
java.lang.String |
getProperty(IMeshProperty property)
Return the value of the given property
|
java.util.Map<IMeshProperty,java.lang.String> |
getPropertyMap()
Get the entire properties map for the mesh.
|
double[] |
getRotation()
Get the part's rotation in the x, y, and z directions
|
double[] |
getScale()
Get the part's scale in the x, y, and z directions.
|
double |
getSize()
Get the part's size.
|
double[] |
getSkew()
Get the part's skew in the x, y, and z directions
|
java.util.ArrayList<SubscriptionType> |
getSubscriptions(IManagedUpdateable source)
Polls the listener for a list of the types of events it wants to receive
from the given source.
|
Transformation |
getTransformation()
Getter function for the part's transformation.
|
double[] |
getTranslation()
Get the part's translation in the x, y, and z directions
|
MeshType |
getType()
Getter method for type.
|
int |
hashCode() |
void |
register(IManagedUpdateableListener listener)
Register a listener to receive managed updates.
|
void |
removeEntity(IController entity)
Removes the given entity from the part's children
|
void |
setController(IController controller)
Setter method for the controller.
|
void |
setEntities(java.util.Map<IMeshCategory,java.util.ArrayList<IController>> newEntities)
Set the mesh's map of entities to be equal to the provided map.
|
void |
setProperties(java.util.Map<IMeshProperty,java.lang.String> properties)
Set the mesh's properties according to the given map.
|
void |
setProperty(IMeshProperty property,
java.lang.String value)
Set the given property, creating it in the map if it is not already
present.
|
void |
setTransformation(Transformation newTransformation)
Setter function for the part's transformation.
|
void |
setType(MeshType type)
Setter method for the mesh's type
|
void |
unregister(IManagedUpdateableListener listener)
Remove a registered listener.
|
void |
update(IManagedUpdateable component,
SubscriptionType[] type)
Receive an update, including the source component and type of event that
triggered the update.
|
public BasicMesh()
public BasicMesh(MeshType type)
type
- The type of mesh this component models.public BasicMesh(java.util.List<IController> entities)
entities
- The list of initial entities.public BasicMesh(java.util.ArrayList<IController> entities, MeshType type)
entities
- The list of initial entitiestype
- The mesh's typepublic BasicMesh(java.util.Map<java.lang.Object,java.lang.Object> input, MeshType type)
input
- The map representing the child entities and their categories
or properties, according to the component's type.type
- The type of component the mesh represents.public Transformation getTransformation()
IMesh
getTransformation
in interface IMesh
public void setType(MeshType type)
IMesh
public java.util.ArrayList<IController> getAllEntities()
IMesh
getAllEntities
in interface IMesh
public java.util.ArrayList<IController> getEntitiesFromCategory(IMeshCategory category)
IMesh
getEntitiesFromCategory
in interface IMesh
category
- The category of entities to returnpublic <T extends IController> java.util.ArrayList<T> getEntitiesFromCategory(IMeshCategory category, java.lang.Class<T> returnType)
IMesh
getEntitiesFromCategory
in interface IMesh
category
- The category of entities to returnreturnType
- The class to which members of the category belong.public java.lang.String getProperty(IMeshProperty property)
IMesh
getProperty
in interface IMesh
public void setProperty(IMeshProperty property, java.lang.String value)
IMesh
setProperty
in interface IMesh
public java.util.Map<IMeshProperty,java.lang.String> getPropertyMap()
IMesh
getPropertyMap
in interface IMesh
public void addEntity(IController newEntity)
IMesh
public void removeEntity(IController entity)
IMesh
removeEntity
in interface IMesh
public void addEntityToCategory(IController newEntity, IMeshCategory category)
IMesh
addEntityToCategory
in interface IMesh
newEntity
- The new child entity to be addedcategory
- The new entity's categorypublic void unregister(IManagedUpdateableListener listener)
IManagedUpdateable
unregister
in interface IManagedUpdateable
listener
- The object which will no longer receive notifications from
thispublic void update(IManagedUpdateable component, SubscriptionType[] type)
IManagedUpdateableListener
update
in interface IManagedUpdateableListener
component
- The updateable component the update is coming fromtype
- The event type that of the updatepublic boolean equals(java.lang.Object otherObject)
equals
in class java.lang.Object
public java.lang.Object clone()
clone
in class java.lang.Object
public void copy(IMesh otherObject)
IMesh
public IController getController()
IMesh
getController
in interface IMesh
public void setController(IController controller)
IMesh
setController
in interface IMesh
controller
- The IController which manages this componentpublic void setTransformation(Transformation newTransformation)
IMesh
setTransformation
in interface IMesh
newTransformation
- The transformation to apply to this part.public void register(IManagedUpdateableListener listener)
IManagedUpdateable
register
in interface IManagedUpdateable
listener
- The object which will receive future updatespublic java.util.ArrayList<SubscriptionType> getSubscriptions(IManagedUpdateable source)
IManagedUpdateableListener
getSubscriptions
in interface IManagedUpdateableListener
source
- The object which this listener will listen topublic int hashCode()
hashCode
in class java.lang.Object
public java.util.Set<IMeshCategory> getEntityCategories()
IMesh
getEntityCategories
in interface IMesh
public java.util.Map<IMeshCategory,java.util.ArrayList<IController>> getEntities()
IMesh
getEntities
in interface IMesh
public java.util.Map<IMeshProperty,java.lang.String> getProperties()
IMesh
getProperties
in interface IMesh
public void setEntities(java.util.Map<IMeshCategory,java.util.ArrayList<IController>> newEntities)
IMesh
setEntities
in interface IMesh
public void setProperties(java.util.Map<IMeshProperty,java.lang.String> properties)
IMesh
setProperties
in interface IMesh
properties
- The new map of properties for the mesh.public double[] getRotation()
IMesh
getRotation
in interface IMesh
public double[] getScale()
IMesh
public double getSize()
IMesh
public double[] getSkew()
IMesh
public double[] getTranslation()
IMesh
getTranslation
in interface IMesh