XMT-O Reference Software

xmto2xmta
Class Xmto2Xmta

java.lang.Object
  |
  +--xmto2xmta.Xmto2Xmta

public class Xmto2Xmta
extends java.lang.Object

This is the Java source code for default mapping of XMT-omega to XMT-A authoring constructs.

NOTE: this java program is based on ISO/IEC 14496-1 (N2501 + DCOR1) and XMT WD 3.0

History:

NOTE: TBD color animator still needs some work. When color animates when another obj is clicked we need to set the touch sensor up correctly. We need toget the id from the begin value. search for node with this id and insert a TouchSensor to it. Thus we shouldn't be attaching it to the targetNode but thenode indicated by the beginValue.


Field Summary
private  java.util.Hashtable convertIndexTable_
          The prime number 89 was chosen as the hash table initialize size because it was mentioned as a better starting hash size for optimization than the default 101.
private  XMTO convertTreeRoot_
           
private static boolean debug_
          Whether debug information is to be printed to the console.
private static boolean debugPrintTree_
           
private static java.lang.String[][] element2ClassMappings_
           
private  java.util.Hashtable element2ClassMapTable_
          Hash table to map XMT-O element names to classes.
private  EventModel eventModel_
           
private  javax.swing.event.EventListenerList listenerList_
          List of listeners.
private  java.lang.String packagePrefix_
           
private  TimeScheduler timeScheduler_
           
private  org.w3c.dom.Document xmtADoc_
           
private  java.util.Hashtable xmtaIds_
          The prime number 89 was chosen as the hash table initialize size because it was mentioned as a better starting hash size for optimization than the default 101.
private  java.util.ResourceBundle xmto2XmtaRes_
           
private  org.w3c.dom.Document xmtODoc_
           
private  java.lang.String xmtODocPath_
           
private  java.util.Hashtable xmtoIds_
          The prime number 89 was chosen as the hash table initialize size because it was mentioned as a better starting hash size for optimization than the default 101.
 
Constructor Summary
Xmto2Xmta()
           
 
Method Summary
 void addErrorListener(ErrorListener errorListener)
          addErrrorListener method comment.
 void convert(org.w3c.dom.Document xmto, org.w3c.dom.Document xmta)
          Convert the passed XMT-O document into and XMT-A document.
private  ConvertElement createElement(org.w3c.dom.Element element)
          Create an Convert element for the specified XMT-O element.
private  void createTree()
          Create the convert tree with the Convert element for the specified XMT-O elements.
private  void doInsertIntoXmtaTree(ConvertElement element)
          Call Validate on the convert element and traverse through the children.
private  void doValidateSyntax(ConvertElement element)
          Call Validate on the convert element and traverse through the children.
 void fireErrorEvent(ErrorEvent e)
          Forward the given notification event to all ErrorListeners that registered themselves as listeners for this converter.
private  XMTO getConvertTreeRoot()
          Create the convert tree with the Convert element for the specified XMT-O elements.
 EventModel getEventModel()
           
 TimeScheduler getTimeScheduler()
           
 java.lang.String getXmtODocPath()
          The path name of the XMTO document file.
private  void performPasses()
          Go through convert tree performing the various passes on the different elements.
private  void printInfo()
          Create an Convert element for the specified XMT-O element.
private  void printTree(ConvertElement element, int nestingLevel)
          Call Validate on the convert element and traverse through the children.
private  void printTreeWithTimings(ConvertElement element, int nestingLevel)
          Call Validate on the convert element and traverse through the children.
 void removeErrorListener(ErrorListener errorListener)
          removeErrorListener method comment.
static void setDebug(boolean debug)
          Enable debugging information to be printed to the console.
 void setXmtODocPath(java.lang.String xmtODocPath)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

debug_

private static boolean debug_
Whether debug information is to be printed to the console. default is not have debug information printed (false).

debugPrintTree_

private static final boolean debugPrintTree_

xmtADoc_

private org.w3c.dom.Document xmtADoc_

xmtODoc_

private org.w3c.dom.Document xmtODoc_

convertTreeRoot_

private XMTO convertTreeRoot_

element2ClassMapTable_

private java.util.Hashtable element2ClassMapTable_
Hash table to map XMT-O element names to classes. Some XMT-O element names are invalid names for java classes, thus they need to be mapped to class names which can be created. For example switch and XMT-O can't be class names and thus must be mapped to valid names. The prime number 89 was chosen as the hash table initialize size because it was mentioned as a better starting hash size for optimization than the default 101. The element2ClassMapTable_ table is composed of (key, data) The key is the XMT-O element name. The data is the java class name which maps to the element.

packagePrefix_

private java.lang.String packagePrefix_

element2ClassMappings_

private static final java.lang.String[][] element2ClassMappings_

xmtoIds_

private java.util.Hashtable xmtoIds_
The prime number 89 was chosen as the hash table initialize size because it was mentioned as a better starting hash size for optimization than the default 101.

xmtaIds_

private java.util.Hashtable xmtaIds_
The prime number 89 was chosen as the hash table initialize size because it was mentioned as a better starting hash size for optimization than the default 101.

convertIndexTable_

private java.util.Hashtable convertIndexTable_
The prime number 89 was chosen as the hash table initialize size because it was mentioned as a better starting hash size for optimization than the default 101.

timeScheduler_

private TimeScheduler timeScheduler_

eventModel_

private EventModel eventModel_

listenerList_

private javax.swing.event.EventListenerList listenerList_
List of listeners. to listen to error messages.

xmto2XmtaRes_

private java.util.ResourceBundle xmto2XmtaRes_

xmtODocPath_

private java.lang.String xmtODocPath_
Constructor Detail

Xmto2Xmta

public Xmto2Xmta()
Method Detail

getXmtODocPath

public java.lang.String getXmtODocPath()
The path name of the XMTO document file.

setXmtODocPath

public void setXmtODocPath(java.lang.String xmtODocPath)

addErrorListener

public void addErrorListener(ErrorListener errorListener)
addErrrorListener method comment.

convert

public void convert(org.w3c.dom.Document xmto,
                    org.w3c.dom.Document xmta)
             throws java.lang.Exception
Convert the passed XMT-O document into and XMT-A document. The XMT-O document should be validated before calling this routine. The XMT-A document should only contain the root element. XMT-A document is as follows:
 <XMT-A>
 </XMT-A>
 

createElement

private ConvertElement createElement(org.w3c.dom.Element element)
Create an Convert element for the specified XMT-O element.
Parameters:
element - XMT-O element which needs to have a convert element created.
Returns:
the created Convert element.

createTree

private void createTree()
                 throws java.lang.Exception
Create the convert tree with the Convert element for the specified XMT-O elements.

doInsertIntoXmtaTree

private void doInsertIntoXmtaTree(ConvertElement element)
Call Validate on the convert element and traverse through the children.

doValidateSyntax

private void doValidateSyntax(ConvertElement element)
Call Validate on the convert element and traverse through the children.

fireErrorEvent

public void fireErrorEvent(ErrorEvent e)
Forward the given notification event to all ErrorListeners that registered themselves as listeners for this converter.
See Also:
addErrorListener(xmto2xmta.ErrorListener), ErrorEvent, EventListenerList

getConvertTreeRoot

private XMTO getConvertTreeRoot()
Create the convert tree with the Convert element for the specified XMT-O elements.

getEventModel

public EventModel getEventModel()

getTimeScheduler

public TimeScheduler getTimeScheduler()

performPasses

private void performPasses()
Go through convert tree performing the various passes on the different elements.

printInfo

private void printInfo()
Create an Convert element for the specified XMT-O element.
Parameters:
element - XMT-O element which needs to have a convert element created.
Returns:
the created Convert element.

printTree

private void printTree(ConvertElement element,
                       int nestingLevel)
Call Validate on the convert element and traverse through the children.

printTreeWithTimings

private void printTreeWithTimings(ConvertElement element,
                                  int nestingLevel)
Call Validate on the convert element and traverse through the children.

removeErrorListener

public void removeErrorListener(ErrorListener errorListener)
removeErrorListener method comment.

setDebug

public static void setDebug(boolean debug)
Enable debugging information to be printed to the console.
Parameters:
debug - sets debug information is printed

XMT-O Reference Software