hmi.graphics.collada
Class ColladaElement

java.lang.Object
  extended by hmi.xml.XMLStructureAdapter
      extended by hmi.graphics.collada.ColladaElement
All Implemented Interfaces:
XMLStructure
Direct Known Subclasses:
Accessor, Alpha, Animation, AnimationClip, Annotate, Argument, Asset, Bind, BindMaterial, BindVertexInput, BoolArray, Box, Camera, Capsule, Channel, Code, Collada, ColladaFloat, ColladaFloatVector, ColladaImage, ColladaVertexWeights, ColorClear, ColorTarget, CommonColorOrTextureType, CommonFloatOrParamType, CommonTexture, CompilerOptions, CompilerTarget, ConnectParam, Contributor, Controller, ControlVertices, Data, DepthClear, DepthTarget, Directional, Draw, Effect, Extra, FColladaBump, FColladaProfile, FixedFunctionShader, FloatArray, ForceField, FormatHint, FXAll, Generator, Geometry, H, HalfExtends, Height, IDREFArray, Imager, Include, InitFrom, InitVolume, Input, InstanceAnimation, InstanceCamera, InstanceController, InstanceEffect, InstanceGeometry, InstanceLight, InstanceMaterial, InstanceNode, InstanceVisualScene, IntArray, Joints, Library, Light, Material, Max3DHelper, Max3DProfile, MayaProfile, Mesh, Modifier, Morph, Name, NameArray, Newparam, Node, Optics, Orthographic, P, Param, ParamArray, ParamValue, Pass, Perspective, PH, PhysicsMaterial, PhysicsModel, PhysicsScene, Point, Primitive, PrimitiveMeshElement, ProfileCOMMON, Radius, RenderMonkeyProfile, RenderState, RGB, Sampler, Sampler1D, Sampler2D, Sampler3D, SamplerCUBE, SamplerDEPTH, SamplerRECT, SamplerState, Scene, Semantic, Setparam, Shader, ShaderInclude, Shape, Skeleton, Skin, Source, Sphere, Spline, Spot, StencilClear, StencilTarget, Surface, Targets, TechniqueCommon, TechniqueCommonBindMaterial, TechniqueCommonLight, TechniqueCommonSource, TechniqueCore, TechniqueFX, TechniqueHint, Texcombiner, Texenv, TexturePipeline, TextureUnit, TransformNode, Usertype, V, ValueType, VCount, Vertices, VisualScene

public class ColladaElement
extends XMLStructureAdapter

An extension of XMLStructureAdapter, used as base class for all COLLADA elements. It deals with a few attributes like id, sid, name, that are common to many Collada elements. It also deals with child nodes in the parse tree.

Author:
Job Zwiers

Field Summary
private  List<ColladaElement> childNodes
           
private  Collada collada
           
static String COLLADANAMESPACE
           
private  String id
           
private  Map<String,ColladaElement> idMap
           
private  Set<String> ids
           
private  String name
           
private  String sid
           
 
Fields inherited from class hmi.xml.XMLStructureAdapter
ATTRIBUTE_TOKEN_DELIMITERS, COMMA_SEPARATOR, DECODEDARRAYSIZE, DEFAULT_RECOVER_MODE, NEWLINE, SYSTEMNEWLINE, TAB, TAB_STRING
 
Constructor Summary
ColladaElement()
          Default constructor.
ColladaElement(Collada collada)
          Constructor that keeps track of the Collada environment
 
Method Summary
 void addColladaNode(ColladaElement nod)
          Adds some other ColladaElement as a child node.
 void addColladaNodes(List<? extends ColladaElement> nods)
          Adds other ColladaElements as child nodes.
 Map<String,ColladaElement> addToIdMap(Map<String,ColladaElement> idMap)
          Adds the id of this ColladaElement, and recursively, of the id's of all of its children, to the Id-To-ColladaElement Map provided as input parameter.
 StringBuilder appendAttributes(StringBuilder buf)
          appends the id and sid XML attributes to buf.
 void decodeAttributes(HashMap<String,String> attrMap, XMLTokenizer tokenizer)
          decodes the id and sid XML attributes.
 Collada getCollada()
          returns the getCollada() attribute
 List<ColladaElement> getColladaNodes()
          Returns (direct) child nodes.
 String getId()
          Returns the id attribute, which could be null.
 Map<String,ColladaElement> getIdMap()
          Returns the Map that maps Collada Id's to ColladaNodes.
 String getIdOrName()
          returns the id, if non-null, else returns the name.
 Set<String> getIds()
          Returns the Set containing the defined Collada Id's for this node.
 String getName()
          Returns the name attribute, which could be null.
 String getNamespace()
          Returns the (full, unabbreviated) namespace string for this XMLStructure Class
 List<ColladaElement> getRecursiveColladaNodes()
          Returns all direct or indirect (i.e. recursive) child nodes.
 List<ColladaElement> getRecursiveColladaNodes(List<ColladaElement> nodeList)
          Returns all direct or indirect child nodes, added to the node list provided as input parameter (Basically, this is an auxiliary method, to implement getRecursiveColladaNodes())
 Resources getResources()
           
 String getSid()
          Returns the sid attribute, which could be null.
 void report(String reportType)
          Calls reportNode for this ColladaElement, as well as all child nodes.
 void reportNode(String reportType)
          Method that should be overwritten in classes that extend from ColladaElement: the intention is that (depending on the reportType parameter) they will "report" by printing to the Console.
 void setCollada(Collada collada)
          Sets the getCollada() attribute
 void setId(String id)
          Sets the id of the element
 void setName(String name)
          Sets the name of the element
 void setSid(String sid)
          Sets the sid of the element
 String urlToId(String url)
          Assuming that url is a fragment of the form #id, urlToId returns the id part, i.e. without the sharp character.
 
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, appendAttributeString, appendAttributeString, appendBooleans, appendCloseEmptyTag, appendCloseSTag, appendComment, appendContent, 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, decodeAttribute, decodeAttribute, decodeBoolean, decodeBooleanArray, decodeBooleanArray, decodeBooleanArray, decodeBooleanArray, decodeContent, decodeDouble, decodeDoubleArray, decodeDoubleArray, decodeDoubleArray, decodeDoubleArray, decodeFloat, decodeFloatArray, decodeFloatArray, decodeFloatArray, decodeFloatArray, decodeInt, decodeIntArray, decodeIntArray, decodeIntArray, decodeIntArray, decodeLong, decodeStringArray, decodeStringArray, decodeStringArray, decodeStringArray, decodeXMLStructureList, decodeXMLValueElement, getOptionalAttribute, getOptionalAttribute, getOptionalBooleanAttribute, getOptionalDoubleAttribute, getOptionalFloatAttribute, getOptionalIntAttribute, getOptionalLongAttribute, getRequiredAttribute, getRequiredBooleanAttribute, getRequiredDoubleAttribute, getRequiredFloatAttribute, getRequiredIntAttribute, getRequiredLongAttribute, getTagLine, getXMLTag, 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

id

private String id

sid

private String sid

name

private String name

childNodes

private List<ColladaElement> childNodes

idMap

private Map<String,ColladaElement> idMap

ids

private Set<String> ids

collada

private Collada collada

COLLADANAMESPACE

public static final String COLLADANAMESPACE
See Also:
Constant Field Values
Constructor Detail

ColladaElement

public ColladaElement()
Default constructor.


ColladaElement

public ColladaElement(Collada collada)
Constructor that keeps track of the Collada environment

Method Detail

getNamespace

public String getNamespace()
Description copied from class: XMLStructureAdapter
Returns the (full, unabbreviated) namespace string for this XMLStructure Class

Overrides:
getNamespace in class XMLStructureAdapter

getId

public String getId()
Returns the id attribute, which could be null.


getSid

public String getSid()
Returns the sid attribute, which could be null.


getName

public String getName()
Returns the name attribute, which could be null.


getIdOrName

public String getIdOrName()
returns the id, if non-null, else returns the name. (which could be null also).


setId

public void setId(String id)
Sets the id of the element


setSid

public void setSid(String sid)
Sets the sid of the element


setName

public void setName(String name)
Sets the name of the element


getCollada

public Collada getCollada()
returns the getCollada() attribute


setCollada

public void setCollada(Collada collada)
Sets the getCollada() attribute


addColladaNode

public void addColladaNode(ColladaElement nod)
Adds some other ColladaElement as a child node.


addColladaNodes

public void addColladaNodes(List<? extends ColladaElement> nods)
Adds other ColladaElements as child nodes.


getColladaNodes

public List<ColladaElement> getColladaNodes()
Returns (direct) child nodes.


getRecursiveColladaNodes

public List<ColladaElement> getRecursiveColladaNodes()
Returns all direct or indirect (i.e. recursive) child nodes.


getRecursiveColladaNodes

public List<ColladaElement> getRecursiveColladaNodes(List<ColladaElement> nodeList)
Returns all direct or indirect child nodes, added to the node list provided as input parameter (Basically, this is an auxiliary method, to implement getRecursiveColladaNodes())


reportNode

public void reportNode(String reportType)
Method that should be overwritten in classes that extend from ColladaElement: the intention is that (depending on the reportType parameter) they will "report" by printing to the Console.


report

public void report(String reportType)
Calls reportNode for this ColladaElement, as well as all child nodes.


getIdMap

public Map<String,ColladaElement> getIdMap()
Returns the Map that maps Collada Id's to ColladaNodes. The first request actually allocates and fills the map, before it is returned.


addToIdMap

public Map<String,ColladaElement> addToIdMap(Map<String,ColladaElement> idMap)
Adds the id of this ColladaElement, and recursively, of the id's of all of its children, to the Id-To-ColladaElement Map provided as input parameter. The extended Map is returned. Null id's are ignored.


getIds

public Set<String> getIds()
Returns the Set containing the defined Collada Id's for this node.


urlToId

public String urlToId(String url)
Assuming that url is a fragment of the form #id, urlToId returns the id part, i.e. without the sharp character.


getResources

public Resources getResources()

appendAttributes

public StringBuilder appendAttributes(StringBuilder buf)
appends the id and sid XML attributes to buf.

Overrides:
appendAttributes in class XMLStructureAdapter

decodeAttributes

public void decodeAttributes(HashMap<String,String> attrMap,
                             XMLTokenizer tokenizer)
decodes the id and sid XML attributes.

Overrides:
decodeAttributes in class XMLStructureAdapter