org.micropsi.comp.world.objects
Class AbstractObjectPart

java.lang.Object
  extended byorg.micropsi.comp.world.objects.AbstractObjectPart
All Implemented Interfaces:
VisualFeatureIF, WorldMessageHandlerIF
Direct Known Subclasses:
AbstractObject, CrownObject, LeafObject, TreeTrunkObject

public class AbstractObjectPart
extends java.lang.Object
implements VisualFeatureIF, WorldMessageHandlerIF


Field Summary
protected  AbstractObjectPart containingPart
           
protected  long id
           
protected  java.lang.String objectClass
           
protected  java.util.Collection optionalProperties
           
protected  double orientationAngle
           
protected  int partHierarchyLevel
           
protected  Position position
           
protected  java.util.Collection requiredProperties
           
protected static java.text.NumberFormat sizeNumberFormat
           
protected  java.util.Set subParts
           
protected  World world
           
protected  double xSize
           
protected  double ySize
           
protected  double zSize
           
 
Constructor Summary
AbstractObjectPart(org.w3c.dom.Element configData, Logger logger)
           
AbstractObjectPart(java.lang.String objectClass, Position pos)
           
 
Method Summary
protected  void _handleMessage(AbstractWorldMessage m)
           
 void _remove()
           
protected  void _setSize(double x, double y, double z)
           
 void addLowLevePartsTo(java.util.Collection coll)
           
protected  void addOptionalProperty(AbstractPropertyAccessor prop)
           
protected  void addRequiredProperty(AbstractPropertyAccessor prop)
           
 AbstractObjectPart addSubPart(AbstractObjectPart obj)
           
 AbstractObjectPart addSubPartRelative(AbstractObjectPart obj)
           
protected  void addSubPartsToMTreeNode(MTreeNode node)
           
protected  void createPropertyCollection()
          Creates (empty) collections to store property accessors.
 AbstractObject getContainingObject()
           
 AbstractObjectPart getContainingPart()
           
protected  java.lang.String getDistinctSizes()
           
 long getId()
          Returns the id.
protected  Logger getLogger()
           
protected  long getNextObjectId()
           
 java.lang.String getObjectClass()
          Returns the objectClass.
protected  java.lang.String getObjectIdentification()
           
 ObjectProperties getOptionalProperties()
           
 double getOrientationAngle()
           
 int getPartHierarchyLevel()
           
 Position getPosition()
          Returns the position.
 ObjectProperties getProperties()
           
 double getSize()
           
 double getXSize()
           
 double getYSize()
           
 double getZSize()
           
 void handleMessage(AbstractWorldMessage m)
           
protected  void handleMessageAgentAction(AbstractWorldMessage m)
           
 boolean hasSubParts()
           
 void init(World world)
           
protected  void initObjectParameters()
           
protected  void initProperties()
           
protected  void initSubobjects()
           
 boolean isAlive()
           
 boolean isHighLevelObject()
           
 boolean isLowLevelPart()
           
 void moveBy(WorldVector vec)
           
 void moveTo(Position newPosition)
           
 boolean originatorsMatchSubParts(AbstractWorldMessage m)
           
 boolean originatorsMatchSubParts(AbstractWorldMessage m, int allowMissing)
           
 void removeSubPart(AbstractObjectPart obj)
           
 void rotateBy(double angle)
           
 void rotateToAngle(double angle)
           
 void scaleBy(double factor)
           
 void scaleBy(double xFactor, double yFactor, double zFactor)
           
protected  void scaleSubpartsBy(double xFactor, double yFactor, double zFactor)
           
protected  void setContainingPart(AbstractObjectPart owningObject)
           
protected  void setDistinctSizes(java.lang.String s)
           
protected  void setObjectClass(java.lang.String objectClass)
          Sets the objectClass.
 void setPartHierarchyLevel(int hierarchyLevel)
          Sets hierarchy level for object and all subobjects.
protected  void setPosition(Position position)
          Sets the position.
 boolean setProperties(ObjectProperties properties)
           
 boolean setProperty(ObjectProperty prop)
           
protected  void setRequiredProperties(ObjectProperties properties)
           
 void setSize(double newSize)
           
 void setSize(double x, double y, double z)
           
 MTreeNode toMTreeNode()
           
 java.lang.String toString()
           
protected  void triggerSubPartChanged()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sizeNumberFormat

protected static final java.text.NumberFormat sizeNumberFormat

world

protected World world

containingPart

protected AbstractObjectPart containingPart

subParts

protected java.util.Set subParts

partHierarchyLevel

protected int partHierarchyLevel

requiredProperties

protected java.util.Collection requiredProperties

optionalProperties

protected java.util.Collection optionalProperties

id

protected long id

objectClass

protected java.lang.String objectClass

position

protected Position position

orientationAngle

protected double orientationAngle

xSize

protected double xSize

ySize

protected double ySize

zSize

protected double zSize
Constructor Detail

AbstractObjectPart

public AbstractObjectPart(java.lang.String objectClass,
                          Position pos)
Parameters:
objectClass -
pos -

AbstractObjectPart

public AbstractObjectPart(org.w3c.dom.Element configData,
                          Logger logger)
                   throws MicropsiException
Parameters:
configData -
logger -
Throws:
MicropsiException
Method Detail

initProperties

protected void initProperties()

initSubobjects

protected void initSubobjects()

initObjectParameters

protected void initObjectParameters()

init

public void init(World world)

isAlive

public boolean isAlive()

getObjectClass

public java.lang.String getObjectClass()
Returns the objectClass.

Returns:
String

getPosition

public Position getPosition()
Returns the position.

Specified by:
getPosition in interface VisualFeatureIF
Returns:
Position

getProperties

public ObjectProperties getProperties()

getOptionalProperties

public ObjectProperties getOptionalProperties()
Returns:
all optional, none-redundant properties.

getSize

public double getSize()
Specified by:
getSize in interface VisualFeatureIF

getXSize

public double getXSize()
Specified by:
getXSize in interface VisualFeatureIF

getYSize

public double getYSize()
Specified by:
getYSize in interface VisualFeatureIF

getZSize

public double getZSize()
Specified by:
getZSize in interface VisualFeatureIF

isLowLevelPart

public boolean isLowLevelPart()

handleMessage

public final void handleMessage(AbstractWorldMessage m)
Specified by:
handleMessage in interface WorldMessageHandlerIF

getId

public long getId()
Returns the id.

Returns:
long

moveBy

public void moveBy(WorldVector vec)

moveTo

public void moveTo(Position newPosition)

setSize

public void setSize(double x,
                    double y,
                    double z)

scaleBy

public void scaleBy(double xFactor,
                    double yFactor,
                    double zFactor)

setProperties

public boolean setProperties(ObjectProperties properties)

setProperty

public boolean setProperty(ObjectProperty prop)

scaleBy

public void scaleBy(double factor)

toMTreeNode

public MTreeNode toMTreeNode()

toString

public java.lang.String toString()

isHighLevelObject

public boolean isHighLevelObject()

getContainingPart

public AbstractObjectPart getContainingPart()
Returns:
Returns the containingPart.

getContainingObject

public AbstractObject getContainingObject()

addLowLevePartsTo

public void addLowLevePartsTo(java.util.Collection coll)

addSubPart

public AbstractObjectPart addSubPart(AbstractObjectPart obj)

addSubPartRelative

public AbstractObjectPart addSubPartRelative(AbstractObjectPart obj)

removeSubPart

public void removeSubPart(AbstractObjectPart obj)

hasSubParts

public boolean hasSubParts()
Returns:

getPartHierarchyLevel

public int getPartHierarchyLevel()
Returns:
Returns the partHierarchyLevel.

setSize

public void setSize(double newSize)

originatorsMatchSubParts

public boolean originatorsMatchSubParts(AbstractWorldMessage m)

originatorsMatchSubParts

public boolean originatorsMatchSubParts(AbstractWorldMessage m,
                                        int allowMissing)

getOrientationAngle

public double getOrientationAngle()

rotateToAngle

public void rotateToAngle(double angle)

rotateBy

public void rotateBy(double angle)

_remove

public void _remove()

getObjectIdentification

protected java.lang.String getObjectIdentification()

_handleMessage

protected void _handleMessage(AbstractWorldMessage m)
Parameters:
m -

handleMessageAgentAction

protected void handleMessageAgentAction(AbstractWorldMessage m)
Parameters:
m -

getDistinctSizes

protected java.lang.String getDistinctSizes()
Returns:

getLogger

protected Logger getLogger()
Returns:

getNextObjectId

protected long getNextObjectId()

setDistinctSizes

protected void setDistinctSizes(java.lang.String s)

setObjectClass

protected void setObjectClass(java.lang.String objectClass)
Sets the objectClass.

Parameters:
objectClass - The objectClass to set

setPosition

protected void setPosition(Position position)
Sets the position.

Parameters:
position - The position to set

_setSize

protected void _setSize(double x,
                        double y,
                        double z)

scaleSubpartsBy

protected void scaleSubpartsBy(double xFactor,
                               double yFactor,
                               double zFactor)
Parameters:
xFactor -
yFactor -
zFactor -

addSubPartsToMTreeNode

protected void addSubPartsToMTreeNode(MTreeNode node)

setContainingPart

protected void setContainingPart(AbstractObjectPart owningObject)

setPartHierarchyLevel

public void setPartHierarchyLevel(int hierarchyLevel)
Sets hierarchy level for object and all subobjects. (Root objects have hierarchy level 0)


triggerSubPartChanged

protected void triggerSubPartChanged()

setRequiredProperties

protected void setRequiredProperties(ObjectProperties properties)
                              throws MicropsiException
Throws:
MicropsiException

createPropertyCollection

protected void createPropertyCollection()
Creates (empty) collections to store property accessors. Exists only to make it possible to overwrite initial sizes.


addRequiredProperty

protected void addRequiredProperty(AbstractPropertyAccessor prop)

addOptionalProperty

protected void addOptionalProperty(AbstractPropertyAccessor prop)

(c) by Micropsi Project: http://www.cognitive-agents.org

.