Class AbstractElementsTreeMatcher
java.lang.Object
com._1c.g5.v8.dt.compare.matching.AbstractElementsTreeMatcher
- All Implemented Interfaces:
IElementsTreeMatcher
- Direct Known Subclasses:
FormElementsMatcher,PredefinedMdObjectMatcher
Abstract implementation of matcher of elements tree.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractElementsTreeMatcher(IComparisonSession session, MergeRule mergeRule, org.eclipse.emf.ecore.EObject main, org.eclipse.emf.ecore.EObject other, org.eclipse.emf.ecore.EObject ancestor) Creates matcher instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected final ComparedObjectPathbuildPath(ComparedObjectPath parentPath, org.eclipse.emf.ecore.EObject matchedObject, org.eclipse.emf.ecore.EStructuralFeature feature) Builds path for the specified single feature.protected final ComparedObjectPathbuildPath(ComparedObjectPath parentPath, org.eclipse.emf.ecore.EObject matchedObject, org.eclipse.emf.ecore.EStructuralFeature feature, int position) Builds path for the specified many-feature.protected abstract ObjectcreateItemId(org.eclipse.emf.ecore.EObject item) Creates unique identifier of the given item.protected final ObjectcreateItemId(org.eclipse.emf.ecore.EObject main, org.eclipse.emf.ecore.EObject other, org.eclipse.emf.ecore.EObject ancestor) Creates unique identifier for elements matched earlier.getMatchedChildren(org.eclipse.emf.ecore.EObject main, org.eclipse.emf.ecore.EObject other, org.eclipse.emf.ecore.EObject ancestor) Returns children (without sub-children) of the given elements in a result matched tree.getMatchedElement(org.eclipse.emf.ecore.EObject forItem) Returns matched compared element for the given input element.protected abstract ComparedObjectPathgetRootPath(org.eclipse.emf.ecore.EObject rootItem) Returns the path for the root item.protected abstract voidmatchElements(org.eclipse.emf.ecore.EObject container, ComparedObjectPath containerPath, ComparisonSide side) Matches child items of the given container and puts them by calling#putElement(EObject, ComparisonSide)method.protected voidputMatchedElement(org.eclipse.emf.ecore.EObject item, ComparedObjectPath path, ComparisonSide side) Stores matched element for the given comparison side.
-
Constructor Details
-
AbstractElementsTreeMatcher
protected AbstractElementsTreeMatcher(IComparisonSession session, MergeRule mergeRule, org.eclipse.emf.ecore.EObject main, org.eclipse.emf.ecore.EObject other, org.eclipse.emf.ecore.EObject ancestor) Creates matcher instance. At least one of input elements must not benull.- Parameters:
session- the comparison session, cannot benullmergeRule- the merge rule to apply when merging elements tree, cannot benullmain- main element to compareother- other element to compareancestor- ancestor element to compare
-
-
Method Details
-
getMatchedElement
Description copied from interface:IElementsTreeMatcherReturns matched compared element for the given input element.- Specified by:
getMatchedElementin interfaceIElementsTreeMatcher- Parameters:
forItem- the element from any of trees (main/other/ancestor) for which to get the compared element- Returns:
- compared element found or
nullif the given input element is not matched
-
getMatchedChildren
public List<MatchedEmfObjects> getMatchedChildren(org.eclipse.emf.ecore.EObject main, org.eclipse.emf.ecore.EObject other, org.eclipse.emf.ecore.EObject ancestor) Description copied from interface:IElementsTreeMatcherReturns children (without sub-children) of the given elements in a result matched tree.- Specified by:
getMatchedChildrenin interfaceIElementsTreeMatcher- Parameters:
main- comparing element in main treeother- comparing element in other treeancestor- comparing element in ancestor ancestor- Returns:
- list of children in a matched tree, can be empty, never
null
-
matchElements
protected abstract void matchElements(org.eclipse.emf.ecore.EObject container, ComparedObjectPath containerPath, ComparisonSide side) Matches child items of the given container and puts them by calling#putElement(EObject, ComparisonSide)method.- Parameters:
container- the container to matchcontainerPath- the path for the container, nevernullside- the comparison side, nevernull
-
createItemId
Creates unique identifier of the given item.- Parameters:
item- the item for which to create identifier, nevernull- Returns:
- the identifier created, never
null
-
getRootPath
Returns the path for the root item.- Parameters:
item- the root item, can benull- Returns:
- the path built
-
createItemId
protected final Object createItemId(org.eclipse.emf.ecore.EObject main, org.eclipse.emf.ecore.EObject other, org.eclipse.emf.ecore.EObject ancestor) Creates unique identifier for elements matched earlier. At least one of input element must not benull.- Parameters:
main- element in main treeother- element in other treeancestor- element in ancestor tree- Returns:
- the identifier created, never
null
-
buildPath
protected final ComparedObjectPath buildPath(ComparedObjectPath parentPath, org.eclipse.emf.ecore.EObject matchedObject, org.eclipse.emf.ecore.EStructuralFeature feature) Builds path for the specified single feature.- Parameters:
parentPath- parent object's path, notnullmatchedObject- the matched object, can benullfeature- the feature to build path for, notnull- Returns:
- the built path, never
null
-
buildPath
protected final ComparedObjectPath buildPath(ComparedObjectPath parentPath, org.eclipse.emf.ecore.EObject matchedObject, org.eclipse.emf.ecore.EStructuralFeature feature, int position) Builds path for the specified many-feature.- Parameters:
parentPath- parent object's path, notnullmatchedObject- the matched object, can benullfeature- the feature to build path for, notnullposition- the object's position in the many-feature array- Returns:
- the built path, never
null
-
putMatchedElement
protected void putMatchedElement(org.eclipse.emf.ecore.EObject item, ComparedObjectPath path, ComparisonSide side) Stores matched element for the given comparison side.- Parameters:
item- the item matched, cannot benullpath- the item's path, cannot benullside- the comparison side, cannot benull
-