hmi.physics.assembler
Class PhysicalHumanoidAssembler

java.lang.Object
  extended by hmi.xml.XMLStructureAdapter
      extended by hmi.physics.assembler.PhysicalHumanoidAssembler
All Implemented Interfaces:
XMLStructure

public class PhysicalHumanoidAssembler
extends XMLStructureAdapter

Sets up PhysicalHumanoid and its connection to the VObject that is steered by the PhysicalHumanoid

Author:
welberge

Field Summary
private  VJoint human
           
private  PhysicalHumanoid ph
           
 PhysicalSegmentAssembler rootAssembler
           
 ArrayList<PhysicalSegmentAssembler> segmentAssemblers
           
 
Fields inherited from class hmi.xml.XMLStructureAdapter
ATTRIBUTE_TOKEN_DELIMITERS, COMMA_SEPARATOR, DECODEDARRAYSIZE, DEFAULT_RECOVER_MODE, NEWLINE, SYSTEMNEWLINE, TAB, TAB_STRING
 
Constructor Summary
PhysicalHumanoidAssembler(VJoint h, PhysicalHumanoid p)
          Constructor
 
Method Summary
 void addPhysicalSegmentAssembler(PhysicalSegmentAssembler psa)
          Adds a new PhysicalSegmentAssembler, assumes psa has a valid segment attached
 StringBuilder appendAttributeString(StringBuilder buf)
          Appends a String to buf that encodes the attributes for the XML encoding.
 StringBuilder appendContent(StringBuilder buf, XMLFormatting fmt)
          Appends a String to buf that encodes the contents for the XML encoding.
 void clear()
          Set to 'empty' state, remove all segments etc
 void createFromGNode(GNode node, String[] segments, String[] endSegments, String rootSegment, JointType[] types, float[] axes, float[] limits1, float[] limits2, float[] limits3)
           
 boolean decodeAttribute(String attrName, String attrValue)
          decodes the value from an attribute value String returns true if succesful, returns false for attribute names that are not recognized.
 boolean decodeAttribute(String attrName, String attrValue, XMLTokenizer tokenizer)
          decodes the value from an attribute value String returns true if succesful, returns false for attribute names that are not recognized.
 void decodeContent(XMLTokenizer tokenizer)
          decodes the XML contents, i.e. the XML between the STag and ETag of the encoding.
 PhysicalHumanoid getPhysicalHumanoid()
           
 String getXMLTag()
          returns the XML tag that is used to encode this type of XMLStructure.
 void removePhysicalSegmentAssembler(PhysicalSegmentAssembler psa)
           
private  void setJoints()
           
 void setRootSegmentAssembler(PhysicalSegmentAssembler psa)
          Sets the root assembler
 void setupJoints(String rootJoint)
          Create the PhysicalSegments and PhysicalJoints
 void setupStartJointOffset(PhysicalSegmentAssembler psa)
           
 
Methods inherited from class hmi.xml.XMLStructureAdapter
appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttributes, appendAttributes, appendAttributeString, appendBooleans, appendCloseEmptyTag, appendCloseSTag, appendComment, appendContent, appendDoubleElement, appendEmptyTag, appendEmptyTag, appendEmptyTag, appendEmptyTag, appendEmptyTag, appendEmptyTag, appendETag, appendETag, appendFloatArrayElement, appendFloatElement, appendFloats, appendIntArrayElement, appendIntElement, appendInts, appendLongElement, appendNewLine, appendNewLine, appendNewLine, appendOpenSTag, appendOptionalDoubleElement, appendOptionalFloatElement, appendOptionalIntElement, appendOptionalLongElement, appendSpaces, appendSpaces, appendSTag, appendSTag, appendSTag, appendStringArrayElement, appendStrings, appendSystemNewLine, appendTab, appendTextElement, appendXML, appendXML, appendXML, appendXML, appendXML, appendXMLStructure, appendXMLStructureList, appendXMLTextElementList, countTokens, countTokens, decodeAttributes, decodeBoolean, decodeBooleanArray, decodeBooleanArray, decodeBooleanArray, decodeBooleanArray, decodeDouble, decodeDoubleArray, decodeDoubleArray, decodeDoubleArray, decodeDoubleArray, decodeFloat, decodeFloatArray, decodeFloatArray, decodeFloatArray, decodeFloatArray, decodeInt, decodeIntArray, decodeIntArray, decodeIntArray, decodeIntArray, decodeLong, decodeStringArray, decodeStringArray, decodeStringArray, decodeStringArray, decodeXMLStructureList, decodeXMLValueElement, getNamespace, getOptionalAttribute, getOptionalAttribute, getOptionalBooleanAttribute, getOptionalDoubleAttribute, getOptionalFloatAttribute, getOptionalIntAttribute, getOptionalLongAttribute, getRequiredAttribute, getRequiredBooleanAttribute, getRequiredDoubleAttribute, getRequiredFloatAttribute, getRequiredIntAttribute, getRequiredLongAttribute, getTagLine, hasContent, parseXMLElement, postProcess, preProcess, readXML, readXML, readXML, setConsoleAttributeEnabled, setDefaultRecoverMode, setRecoverMode, spaces, toString, toXMLString, toXMLString, toXMLString, toXMLString, toXMLString, toXMLString, writeXML, writeXML, writeXML, writeXML, xmlTag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

human

private VJoint human

ph

private PhysicalHumanoid ph

rootAssembler

public PhysicalSegmentAssembler rootAssembler

segmentAssemblers

public ArrayList<PhysicalSegmentAssembler> segmentAssemblers
Constructor Detail

PhysicalHumanoidAssembler

public PhysicalHumanoidAssembler(VJoint h,
                                 PhysicalHumanoid p)
Constructor

Parameters:
h - the visualization humanoid
p - the PhysicalHumanoid
Method Detail

createFromGNode

public void createFromGNode(GNode node,
                            String[] segments,
                            String[] endSegments,
                            String rootSegment,
                            JointType[] types,
                            float[] axes,
                            float[] limits1,
                            float[] limits2,
                            float[] limits3)

setupStartJointOffset

public void setupStartJointOffset(PhysicalSegmentAssembler psa)

setupJoints

public void setupJoints(String rootJoint)
Create the PhysicalSegments and PhysicalJoints


setJoints

private void setJoints()

clear

public void clear()
Set to 'empty' state, remove all segments etc


addPhysicalSegmentAssembler

public void addPhysicalSegmentAssembler(PhysicalSegmentAssembler psa)
Adds a new PhysicalSegmentAssembler, assumes psa has a valid segment attached


removePhysicalSegmentAssembler

public void removePhysicalSegmentAssembler(PhysicalSegmentAssembler psa)

setRootSegmentAssembler

public void setRootSegmentAssembler(PhysicalSegmentAssembler psa)
Sets the root assembler


decodeAttribute

public boolean decodeAttribute(String attrName,
                               String attrValue)
decodes the value from an attribute value String returns true if succesful, returns false for attribute names that are not recognized. Might throw a RuntimeException when an attribute has been recognized, but is ill formatted.

Overrides:
decodeAttribute in class XMLStructureAdapter

decodeAttribute

public boolean decodeAttribute(String attrName,
                               String attrValue,
                               XMLTokenizer tokenizer)
decodes the value from an attribute value String returns true if succesful, returns false for attribute names that are not recognized. Might throw a RuntimeException when an attribute has been recognized, but is ill formatted. Moreover, an XMLTokenizer reference is available which can be queried for attributes, like getTokenLine() or getTokenCharPos(), which might be helpful to produce error messages referring to lines/positions within the XML document

Overrides:
decodeAttribute in class XMLStructureAdapter

decodeContent

public void decodeContent(XMLTokenizer tokenizer)
                   throws IOException
decodes the XML contents, i.e. the XML between the STag and ETag of the encoding.

Overrides:
decodeContent in class XMLStructureAdapter
Throws:
IOException

appendContent

public StringBuilder appendContent(StringBuilder buf,
                                   XMLFormatting fmt)
Appends a String to buf that encodes the contents for the XML encoding. The encoding should start on a new line, using indentation equal to tab. There should be no newline after the encoding.

Overrides:
appendContent in class XMLStructureAdapter

appendAttributeString

public StringBuilder appendAttributeString(StringBuilder buf)
Appends a String to buf that encodes the attributes for the XML encoding. When non empty, the attribute string should start with a space character. Hint: call the appendAttribute(StringBuffer buf, String attrName, String attrValue) for every relevant attribute; this takes care of the leading space as well as spaces in between the attributes) The encoding should preferably not add newline characters.

Overrides:
appendAttributeString in class XMLStructureAdapter

getXMLTag

public String getXMLTag()
returns the XML tag that is used to encode this type of XMLStructure.

Specified by:
getXMLTag in interface XMLStructure
Overrides:
getXMLTag in class XMLStructureAdapter

getPhysicalHumanoid

public PhysicalHumanoid getPhysicalHumanoid()