ROSE
0.11.96.11
|
Analysis to determine how to make one AST look like another.
Actually editing one tree have the same shape as another is, in many cases, nonsensical but the edit distance metric is nonetheless useful to determine the similarity of two trees. See Analysis::compute for details about how this analysis is implemented.
The way the analysis is used is like this:
Or in one expression:
double cost = TreeEditDistance::Analysis() .substitutionCost(0.0) .compute(ast1, ast2) .cost();
The analysis object can be reused as many times as one likes by calling its compute
method with different trees. The query methods always return the same results until the next call to compute
.
Classes | |
class | Analysis |
Analysis object for tree edit distance. More... | |
struct | Edit |
A single edit operation. More... | |
class | SubstitutionPredicate |
Base class for substitution prediates. More... | |
Typedefs | |
typedef std::vector< Edit > | Edits |
List of edit operations. | |
Enumerations | |
enum | EditType { INSERT, DELETE, SUBSTITUTE } |
Type of edit operation. More... | |
Functions | |
std::ostream & | operator<< (std::ostream &, const TreeEditDistance::Edit &) |
Type of edit operation.
Enumerator | |
---|---|
INSERT | Insert a node from another tree. |
DELETE | Delete a node from this tree. |
SUBSTITUTE | Substitute a node; same as an insert-delete pair. |
Definition at line 60 of file TreeEditDistance.h.