Prototype Implementations

As mentioned earlier, we have implemented prototypes of the language and transformations between various existing algorithm animation languages. In the following sections, we will briefly describe these prototypes and discuss the advantages and disadvantages of the different solutions, as well as state the level of XAAL features supported.

XAAL Objects and XAAL Parser

The center of the XAAL implementation is XAAL Objects (XO). This is a collection of Java classes that correspond to the different elements and attributes in XAAL documents. The XO hierarchy is essentially a mapping of the XML elements into Java objects. For most of the elements in the XML specification there is a corresponding Java class. This class has methods for setting and getting all the values of the attributes specified for the XML element. It also has similar methods for setting and getting sub-elements. For elements that can appear multiple times as child elements, there are methods to add and list the elements. The figure below gives an example how the create element is mapped to Java class xaal.objects.animation.CreateOperation.

Fixme (Ville)
Add the figure.

The XAAL objects hierarchy can be generated in multiple ways, the most natural of which is the XAAL parser. The parser we have implemented is a SAX content handler. Thus, the methods of the content handler are notified based on the logical content of an XML document. The main functionality of the parser is essentially in the following methods:

  • start/endElement - Methods called whenever an element in an XML document is started and ended. The startElement method gets, for example, the name and the attributes of the element as attributes.
  • start/endDocument Methods called whenever a document is started or ended.
  • characters Method called when character content of elements is encountered.

The XAAL objects and XAAL parser prototype implementations support most of the elements and functionality specified in the language. However, one major feature still unimplemented is the graphical primitive animation. In addition, the current parser does not behave well when the source document is not well-formed XML. We should also make the parser modular in the same way as the schemas. This would allow a developer to change or reuse a part of the XAAL parser.

Adapters and Generators

An important part of the implementation is the generator that allows the generation of XAAL Objects from MatrixPro animations. The implementation of the structure export is done by visiting all the visualizations of MatrixPro and producing a XO hierarchy of them. Graphical primitive information is added by taking advantage of the existing graphical primitive export functionality of MatrixPro.

For the data structure operations to be identifiable, we decided to annotate the visualizations of MatrixPro and thus add the required information. This solution is not ideal, since it makes it impossible, for example, to generate XAAL from animations generated through an algorithm that operates with the underlying data structures instead of the visualizations. However, this solution allowed us to implement the XAAL export with minimal changes to MatrixPro. In addition, the creation of new visualizations is rarely done. And even for new layouts, there is no need to annotate the visualizations for XAAL export to work. However, in the future, this approach should be reconsidered.

In the implementation, another unsolved problem arose with the need to bind together the visualizations, data structures, and the underlying memory structures of MatrixPro. This made it impossible to bind certain memory structures to their corresponding visualizations.

The adapter implementation allows us to adapt XO hierarchies to be used in MatrixPro. It essentially generates a MatrixPro animation sequence from the XAAL objects hierarchy. The adapter supports the data structures and data structure operations of XAAL. The implementation relies heavily on the Polymorph interface of MatrixPro. This interface is intended for transforming data structures to other structures, for example, a tree to graph or vice versa. In practice, the interface allows us to add new nodes and edges to the existing structures. As part of the implementation of the adapter, we have added the Polymorph support to most of the structures in MatrixPro.

XSL Stylesheets

In this thesis, we have implemented the XSL solution to translate XAAL documents to ANIMALSCRIPT, JAWAA, and SVG. These implementations are only prototypes, and do not cover the whole range of features in the languages. In the following, we will briefly describe the implementations.

The ANIMALSCRIPT transformation implementation is a simple XSL stylesheet with templates to support currently only the graphical primitives of XAAL. It can, however, transform the graphical information of data structures and thus these can also be transformed into ANIMALSCRIPT. The only requirement is for the XAAL animation to include the graphical information about the structures. Data structures without the graphical information cannot be transformed, since ANIMALSCRIPT has no support for data structures. A possible solution for this problem is to use a system like MatrixPro to add the graphical representation. As graphical primitive transformations are not implemented, this ANIMALSCRIPT transformation does not support any animation. Also, stylesheet inheritance is not supported by the implementation.

The JAWAA transformation implementation is highly similar to the ANIMALSCRIPT implementation. The XSL stylesheets are almost identical, only the names and the order of different elements are different. Thus, the JAWAA transformation implementation has the same features as the ANIMALSCRIPT implementation.

SVG support into XAAL tools is implemented in both directions: from SVG to XAAL and from XAAL to SVG. The fact that SVG is an XML format made it easy to transform SVG using an XSL stylesheet. The current implementations support, like all the prototypes, only basic graphical primitives without animation. Since SVG has many features that XAAL does not support, only fraction of SVG elements is currently transformed to XAAL. For example, all scripting and filtering is ignored.