These adapters facilitate using the GenericTreeNode comparison utilities on different types of trees. The classes currently in this package support Swing TreeNode and AspectJ compiler StructureNode.

Structure supports a command-line interface for compiling StructureNode trees using AspectJCompiler and saving or loading them using serialization. Once loaded, two trees can be compared using the GenericTreeNode.traverse(..) method, providing it the appropriate visitors and comparators to implement a comparison of the expected and actual structure trees and report on any differences. (This is used to validate that changes to the structure tree are backwards compatible with trees from previous compiles, since the structure tree is effectively exported from the compiler to the IDE tools.)

If you want to support new trees, GenericTreeNodeFactoryI is the interface to implement. It specifies a factory to provide a Comparator based on a given pair to be compared. This means that you can use (or generate) comparators based on specific pairs. Usually you will implement only for the target type, so your factory may be final and always return a singleton Comparator.

The SubTypeComparator implements a Comparator container that acts as a Comparator by delegating to contained Comparators registered along with the class of the input they accept. This permits you to write type-specific Comparators for heterogeneous trees. It does require both members of the comparison be assignable to the target class.

StructureGenericTreeNodeFactory is an implementation of GenericTreeNodeFactoryI for StructureNode trees. It contains comparator classes for RelationNode, LinkNode, and ProgramElementNode, combined using a SubTypeComparator.

JTreeNodeGenericTreeNodeFactory is an implementation of GenericTreeNodeFactoryI for Swing TreeNode's, done only for testing purposes.