use of eu.esdihumboldt.hale.common.align.model.transformation.tree.context.ContextMatcher in project hale by halestudio.
the class TransformationTreeContentProvider method createInstanceTree.
/**
* Create a transformation tree based on a source instance.
*
* @param instance the source instance
* @param typeCell the type cell
* @param alignment the alignment
* @return the transformation tree or <code>null</code>
*/
private TransformationTree createInstanceTree(Instance instance, Cell typeCell, Alignment alignment) {
TransformationTree tree = new TransformationTreeImpl(alignment, typeCell);
ReportLog<TransformationMessage> reporter = new DefaultTransformationReporter("Transformation tree", true);
TransformationLog log = new CellLog(reporter, typeCell);
// context matching
// XXX instead through service/extension point?
ContextMatcher matcher = new AsDeepAsPossible(null);
matcher.findMatches(tree);
// process and annotate the tree
InstanceVisitor visitor = new InstanceVisitor(new FamilyInstanceImpl(instance), tree, log);
tree.accept(visitor);
// duplicate subtree as necessary
DuplicationVisitor duplicationVisitor = new DuplicationVisitor(tree, log);
tree.accept(duplicationVisitor);
duplicationVisitor.doAugmentationTrackback();
return tree;
}
Aggregations