NASA World Wind

gov.nasa.worldwind.ogc.collada
Class ColladaLibrary<T>

java.lang.Object
  extended by gov.nasa.worldwind.util.xml.AbstractXMLEventParser
      extended by gov.nasa.worldwind.ogc.collada.ColladaAbstractObject
          extended by gov.nasa.worldwind.ogc.collada.ColladaLibrary<T>
All Implemented Interfaces:
XMLEventParser

public class ColladaLibrary<T>
extends ColladaAbstractObject

Represents the COLLADA Library element and provides access to its contents. This class can be used for any library element (library_nodes, library_effects, etc.) by specifying a generic parameter that defines the parser for the elements in the library. For example new ColladaLibrary<ColladaNode>(ns) creates a library of ColladaNodes.


Field Summary
protected  String elementName
          Local name of the elements in the library.
protected  List<T> elements
          Elements in the library.
 
Fields inherited from class gov.nasa.worldwind.util.xml.AbstractXMLEventParser
CHARACTERS_CONTENT, fields, namespaceURI, parent
 
Constructor Summary
ColladaLibrary(String ns)
          Construct an instance.
 
Method Summary
protected  String getElementName(String libraryName)
           
 List<T> getElements()
          Indicates the elements in the library.
 Object parse(XMLEventParserContext context, XMLEvent event, Object... args)
          Parse the event and initialize the parser's values to those found in the event.
 void setField(String keyName, Object value)
          
 
Methods inherited from class gov.nasa.worldwind.ogc.collada.ColladaAbstractObject
getLocalExtent, getRoot
 
Methods inherited from class gov.nasa.worldwind.util.xml.AbstractXMLEventParser
allocate, doAddCharacters, doAddEventAttribute, doAddEventContent, doParseEventAttributes, doParseEventContent, freeResources, getAConstructor, getCharacters, getField, getField, getFields, getNamespaceURI, getParent, hasField, hasField, hasFields, mergeFields, newInstance, overrideFields, parseCharacterContent, removeField, setField, setFields, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

elementName

protected String elementName
Local name of the elements in the library. This is determined from the name of the library element. For example, if the library element is "library_nodes" then the element name is "node".


elements

protected List<T> elements
Elements in the library.

Constructor Detail

ColladaLibrary

public ColladaLibrary(String ns)
Construct an instance.

Parameters:
ns - the qualifying namespace URI. May be null to indicate no namespace qualification.
Method Detail

getElementName

protected String getElementName(String libraryName)

getElements

public List<T> getElements()
Indicates the elements in the library.

Returns:
Elements in the library. Returns an empty list if the library is empty.

parse

public Object parse(XMLEventParserContext context,
                    XMLEvent event,
                    Object... args)
             throws XMLStreamException
Parse the event and initialize the parser's values to those found in the event.

Specified by:
parse in interface XMLEventParser
Overrides:
parse in class AbstractXMLEventParser
Parameters:
context - a current parser context.
event - the event to parse.
args - an optional list of arguments that may by used by subclasses.
Returns:
if parsing is successful, returns this, otherwise returns null.
Throws:
XMLStreamException - if an exception occurs during event-stream reading.

setField

public void setField(String keyName,
                     Object value)

Overrides:
setField in class AbstractXMLEventParser

NASA World Wind