Class AbstractElementsTreeMatcher
- java.lang.Object
- 
- com._1c.g5.v8.dt.compare.matching.AbstractElementsTreeMatcher
 
- 
- All Implemented Interfaces:
- IElementsTreeMatcher
 - Direct Known Subclasses:
- PredefinedMdObjectMatcher
 
 public abstract class AbstractElementsTreeMatcher extends Object implements IElementsTreeMatcher Abstract implementation of matcher of elements tree.
- 
- 
Constructor SummaryConstructors Modifier Constructor Description protectedAbstractElementsTreeMatcher(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 SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected ComparedObjectPathbuildPath(ComparedObjectPath parentPath, org.eclipse.emf.ecore.EObject matchedObject, org.eclipse.emf.ecore.EStructuralFeature feature)Builds path for the specified single feature.protected 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 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.List<MatchedEmfObjects>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.MatchedEmfObjectsgetMatchedElement(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 Detail- 
AbstractElementsTreeMatcherprotected 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 be- null
- mergeRule- the merge rule to apply when merging elements tree, cannot be- null
- main- main element to compare
- other- other element to compare
- ancestor- ancestor element to compare
 
 
- 
 - 
Method Detail- 
getMatchedElementpublic MatchedEmfObjects getMatchedElement(org.eclipse.emf.ecore.EObject forItem) Description copied from interface:IElementsTreeMatcherReturns matched compared element for the given input element.- Specified by:
- getMatchedElementin interface- IElementsTreeMatcher
- 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
 
 - 
getMatchedChildrenpublic 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 interface- IElementsTreeMatcher
- Parameters:
- main- comparing element in main tree
- other- comparing element in other tree
- ancestor- comparing element in ancestor ancestor
- Returns:
- list of children in a matched tree, can be empty, never null
 
 - 
matchElementsprotected 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 match
- containerPath- the path for the container, never- null
- side- the comparison side, never- null
 
 - 
createItemIdprotected abstract Object createItemId(org.eclipse.emf.ecore.EObject item) Creates unique identifier of the given item.- Parameters:
- item- the item for which to create identifier, never- null
- Returns:
- the identifier created, never null
 
 - 
getRootPathprotected abstract ComparedObjectPath getRootPath(org.eclipse.emf.ecore.EObject rootItem) Returns the path for the root item.- Parameters:
- item- the root item, can be- null
- Returns:
- the path built
 
 - 
createItemIdprotected 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 tree
- other- element in other tree
- ancestor- element in ancestor tree
- Returns:
- the identifier created, never null
 
 - 
buildPathprotected 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, not- null
- matchedObject- the matched object, can be- null
- feature- the feature to build path for, not- null
- Returns:
- the built path, never null
 
 - 
buildPathprotected 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, not- null
- matchedObject- the matched object, can be- null
- feature- the feature to build path for, not- null
- position- the object's position in the many-feature array
- Returns:
- the built path, never null
 
 - 
putMatchedElementprotected 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 be- null
- path- the item's path, cannot be- null
- side- the comparison side, cannot be- null
 
 
- 
 
-