Class AbstractMdObjectMatcher<T>
- java.lang.Object
-
- com._1c.g5.v8.dt.md.compare.matching.AbstractMdObjectMatcher<T>
-
- Type Parameters:
T
- the type of objects to match
- Direct Known Subclasses:
ChildMdObjectMatcher
,TopObjectMatcher
public abstract class AbstractMdObjectMatcher<T> extends Object
An abstract matcher of objects representing MD objects, capable of creating comparison result nodes.
-
-
Constructor Summary
Constructors Constructor Description AbstractMdObjectMatcher(IComparisonSession session, ComparisonTreeNode parentNode, List<T> mainObjects, List<T> otherObjects, List<T> ancestorObjects)
Constructs a matcher.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected boolean
checkReordering()
Tells whether to check reordering of model objects.protected RelatedFeature
createRelatedFeature(org.eclipse.emf.ecore.EReference reference)
Creates related feature from given reference.protected abstract MdObjectComparisonNode
createResultNode(ComparisonTreeNode parent, T main, T other, T ancestor)
Creates a comparison result node.protected void
fillOrder(List<MdObjectComparisonNode> matchedNodes)
Fills the side order to matched nodes.protected abstract String
getName(T object)
Returns the name of the matched object.protected ComparisonTreeNode
getParentNode()
Gets the parent node.protected IComparisonSession
getSession()
Returns the comparison session.protected abstract String
getSymlink(T object)
Returns the symbolic link of the matched object.protected abstract UUID
getUuid(T object)
Returns the UUID of the matched object.List<MdObjectComparisonNode>
match()
Matches the specified collections and returns the result as a list of created child model nodes.
-
-
-
Constructor Detail
-
AbstractMdObjectMatcher
public AbstractMdObjectMatcher(IComparisonSession session, ComparisonTreeNode parentNode, List<T> mainObjects, List<T> otherObjects, List<T> ancestorObjects)
Constructs a matcher.- Parameters:
session
- the comparison session, cannot benull
parentNode
- the parent model node, cannot benull
mainObjects
- the main objects to be matched, cannot benull
otherObjects
- the other objects to be matched, cannot benull
ancestorObjects
- the ancestor objects to be matched, may benull
in case of two-way comparison
-
-
Method Detail
-
match
public List<MdObjectComparisonNode> match()
Matches the specified collections and returns the result as a list of created child model nodes.- Returns:
- a list of created child nodes corresponding to matched objects, never
null
-
getParentNode
protected ComparisonTreeNode getParentNode()
Gets the parent node.- Returns:
- The parent node.
-
getName
protected abstract String getName(T object)
Returns the name of the matched object.- Returns:
- the name
-
getUuid
protected abstract UUID getUuid(T object)
Returns the UUID of the matched object.- Returns:
- the UUID
-
getSymlink
protected abstract String getSymlink(T object)
Returns the symbolic link of the matched object.- Returns:
- the symbolic link
-
createResultNode
protected abstract MdObjectComparisonNode createResultNode(ComparisonTreeNode parent, T main, T other, T ancestor)
Creates a comparison result node. Its comparison object must be anMdObjectComparisonObject
.- Parameters:
main
- the main objectother
- the other objectancestor
- the common ancestor object- Returns:
- a new comparison result node
-
getSession
protected IComparisonSession getSession()
Returns the comparison session.- Returns:
- the comparison session instance, never
null
-
fillOrder
protected void fillOrder(List<MdObjectComparisonNode> matchedNodes)
Fills the side order to matched nodes. By default takes order from the initial list of model objects.- Parameters:
matchedNodes
- the matched nodes to fill order for, cannot benull
-
checkReordering
protected boolean checkReordering()
Tells whether to check reordering of model objects.- Returns:
true
if need to check reordering of model objects,false
otherwise
-
createRelatedFeature
protected RelatedFeature createRelatedFeature(org.eclipse.emf.ecore.EReference reference)
Creates related feature from given reference.- Parameters:
reference
-EReference
to create related feature from, cannot benull
- Returns:
- related feature from given reference
-
-