Class 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 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 be null
        parentNode - the parent model node, cannot be null
        mainObjects - the main objects to be matched, cannot be null
        otherObjects - the other objects to be matched, cannot be null
        ancestorObjects - the ancestor objects to be matched, may be null 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 an MdObjectComparisonObject.
        Parameters:
        main - the main object
        other - the other object
        ancestor - 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 be null
      • 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 be null
        Returns:
        related feature from given reference