ROSE
0.11.96.11
|
Edit distance analysis.
Analyzes two ASTs to determine the edit distance between them using the following algorithm:
NodeType
and append it to a list. Definition at line 104 of file LinearEditDistance.h.
#include <LinearEditDistance.h>
Public Member Functions | |
Analysis () | |
Constructs an analysis object with no associated trees. | |
size_t | cost () const |
Edit distance. More... | |
double | relativeCost () const |
Relative edit distance. More... | |
Analysis & | setTree1 (SgNode *ast, SgFile *file=NULL, size_t minDepth=0, size_t maxDepth=size_t(-1)) |
Associate an AST with this analysis. More... | |
Analysis & | setTree2 (SgNode *ast, SgFile *file=NULL, size_t minDepth=0, size_t maxDepth=size_t(-1)) |
Associate an AST with this analysis. More... | |
Analysis & | compute (SgNode *source, SgNode *target, SgFile *sourceFile=NULL, SgFile *targetFile=NULL) |
Compute edit distance. More... | |
Analysis & | compute (SgNode *target, SgFile *targetFile=NULL) |
Compute edit distance. More... | |
Analysis & | compute () |
Compute edit distance. More... | |
|
inline |
Associate an AST with this analysis.
The setTree1 sets the source AST and setTree2 sets the target AST. It does so by forgetting any previous source or target list nodes, traversing the specified tree to select new source or target nodes, creating a list of NodeType nodes, and storing the list in this analysis.
During traversal, AST nodes whose tree depth is between minDepth
and maxDepth
, inclusive are added to the list. However, if a file
is specified then the node must also belong to the specified file.
Definition at line 122 of file LinearEditDistance.h.
Referenced by Rose::EditDistance::LinearEditDistance::Analysis< NodeType >::compute().
|
inline |
Associate an AST with this analysis.
The setTree1 sets the source AST and setTree2 sets the target AST. It does so by forgetting any previous source or target list nodes, traversing the specified tree to select new source or target nodes, creating a list of NodeType nodes, and storing the list in this analysis.
During traversal, AST nodes whose tree depth is between minDepth
and maxDepth
, inclusive are added to the list. However, if a file
is specified then the node must also belong to the specified file.
Definition at line 125 of file LinearEditDistance.h.
Referenced by Rose::EditDistance::LinearEditDistance::Analysis< NodeType >::compute().
|
inline |
Compute edit distance.
The no-argument version computes edit distance over the source and target ASTs that have been previously added to this analysis object. The other versions call setTree2 and/or setTree1 before doing the computation.
Returns this analysis object so that a query method can be chained:
Definition at line 142 of file LinearEditDistance.h.
References Rose::EditDistance::LinearEditDistance::Analysis< NodeType >::compute(), and Rose::EditDistance::LinearEditDistance::Analysis< NodeType >::setTree1().
|
inline |
Compute edit distance.
The no-argument version computes edit distance over the source and target ASTs that have been previously added to this analysis object. The other versions call setTree2 and/or setTree1 before doing the computation.
Returns this analysis object so that a query method can be chained:
Definition at line 146 of file LinearEditDistance.h.
References Rose::EditDistance::LinearEditDistance::Analysis< NodeType >::compute(), and Rose::EditDistance::LinearEditDistance::Analysis< NodeType >::setTree2().
|
inline |
Compute edit distance.
The no-argument version computes edit distance over the source and target ASTs that have been previously added to this analysis object. The other versions call setTree2 and/or setTree1 before doing the computation.
Returns this analysis object so that a query method can be chained:
Definition at line 150 of file LinearEditDistance.h.
References Rose::EditDistance::levenshteinDistance().
Referenced by Rose::EditDistance::LinearEditDistance::Analysis< NodeType >::compute().
|
inline |
Edit distance.
Returns the edit distance previously computed. The compute method must be called first, otherwise zero is returned.
Definition at line 160 of file LinearEditDistance.h.
|
inline |
Relative edit distance.
Returns an edit distance relative to the size of the ASTs. A relative edit distance is the absolute edit distance divided by the size of the larger tree. Only nodes actually selected from the tree (those satisfying the constraints used by setTree1 and setTree2) are counted in the size.
Definition at line 169 of file LinearEditDistance.h.