summaryrefslogtreecommitdiffstats
path: root/aspectj-attic/testing-src/org/aspectj/testing/compare/adapters/package.html
blob: c2d839ed16e750453b260d34fa8e3e229bdac5f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<html>
<body>
These adapters facilitate using the GenericTreeNode
comparison utilities on different types of trees.
The classes currently in this package support Swing
<code>TreeNode</code> and AspectJ compiler <code>StructureNode</code>.

<p>
<code>Structure</code> supports a command-line interface for
compiling <code>StructureNode</code> trees using 
<code>AspectJCompiler</code> and saving 
or loading them using serialization.  Once loaded, two trees
can be compared using the <code>GenericTreeNode.traverse(..)</code> 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.)

<p>
If you want to support new trees,
<code>GenericTreeNodeFactoryI</code> is the interface to implement.
It specifies a factory to provide a <code>Comparator</code> 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 <code>Comparator.</code>
<p>
The <code>SubTypeComparator</code> implements a <code>Comparator</code>
container that acts as a <code>Comparator</code> by delegating to
contained <code>Comparator</code>s registered along with the class of the input
they accept.  This permits you to write type-specific
<code>Comparator</code>s for heterogeneous trees.  It does require
both members of the comparison be assignable to the
target class.

<p> 
<code>StructureGenericTreeNodeFactory</code> is an implementation of
<code>GenericTreeNodeFactoryI</code> for StructureNode trees.  It
contains comparator classes for <code>RelationNode</code>, <code>LinkNode,</code>
and <code>ProgramElementNode</code>, 
combined using a <code>SubTypeComparator.</code>
<p> 
<code>JTreeNodeGenericTreeNodeFactory</code> is an implementation of
<code>GenericTreeNodeFactoryI</code>  for Swing <code>TreeNode</code>'s, done only
for testing purposes.
</body>
</html>