Lines Matching refs:Id2
81 bool identical(NodeId Id1, NodeId Id2) const;
84 bool isMatchingPossible(NodeId Id1, NodeId Id2) const;
87 bool haveSameParents(const Mapping &M, NodeId Id1, NodeId Id2) const;
91 void addOptimalMapping(Mapping &M, NodeId Id1, NodeId Id2) const;
95 double getJaccardSimilarity(const Mapping &M, NodeId Id1, NodeId Id2) const;
567 const SyntaxTree::Impl &T2, NodeId Id1, NodeId Id2) in ZhangShashaMatcher() argument
568 : DiffImpl(DiffImpl), S1(T1, Id1), S2(T2, Id2) { in ZhangShashaMatcher()
619 NodeId Id2 = S2.getIdInRoot(Col); in getMatchingNodes() local
620 assert(DiffImpl.isMatchingPossible(Id1, Id2) && in getMatchingNodes()
622 Matches.emplace_back(Id1, Id2); in getMatchingNodes()
645 double getUpdateCost(SNodeId Id1, SNodeId Id2) { in getUpdateCost() argument
646 if (!DiffImpl.isMatchingPossible(S1.getIdInRoot(Id1), S2.getIdInRoot(Id2))) in getUpdateCost()
648 return S1.getNodeValue(Id1) != S2.getNodeValue(Id2); in getUpdateCost()
653 for (SNodeId Id2 : S2.KeyRoots) in computeTreeDist() local
654 computeForestDist(Id1, Id2); in computeTreeDist()
657 void computeForestDist(SNodeId Id1, SNodeId Id2) { in computeForestDist() argument
658 assert(Id1 > 0 && Id2 > 0 && "Expecting offsets greater than 0."); in computeForestDist()
660 SNodeId LMD2 = S2.getLeftMostDescendant(Id2); in computeForestDist()
665 for (SNodeId D2 = LMD2 + 1; D2 <= Id2; ++D2) { in computeForestDist()
712 bool operator()(NodeId Id1, NodeId Id2) const { in operator ()()
713 return Tree.getNode(Id1).Height < Tree.getNode(Id2).Height; in operator ()()
757 bool ASTDiff::Impl::identical(NodeId Id1, NodeId Id2) const { in identical()
759 const Node &N2 = T2.getNode(Id2); in identical()
761 !isMatchingPossible(Id1, Id2) || in identical()
762 T1.getNodeValue(Id1) != T2.getNodeValue(Id2)) in identical()
770 bool ASTDiff::Impl::isMatchingPossible(NodeId Id1, NodeId Id2) const { in isMatchingPossible()
771 return Options.isMatchingAllowed(T1.getNode(Id1), T2.getNode(Id2)); in isMatchingPossible()
775 NodeId Id2) const { in haveSameParents()
777 NodeId P2 = T2.getNode(Id2).Parent; in haveSameParents()
783 NodeId Id2) const { in addOptimalMapping()
784 if (std::max(T1.getNumberOfDescendants(Id1), T2.getNumberOfDescendants(Id2)) > in addOptimalMapping()
787 ZhangShashaMatcher Matcher(*this, T1, T2, Id1, Id2); in addOptimalMapping()
798 NodeId Id2) const { in getJaccardSimilarity()
804 CommonDescendants += int(Dst.isValid() && T2.isInSubtree(Dst, Id2)); in getJaccardSimilarity()
808 T2.getNumberOfDescendants(Id2) - 1 - CommonDescendants; in getJaccardSimilarity()
819 for (NodeId Id2 : T2) { in findCandidate() local
820 if (!isMatchingPossible(Id1, Id2)) in findCandidate()
822 if (M.hasDst(Id2)) in findCandidate()
824 double Similarity = getJaccardSimilarity(M, Id1, Id2); in findCandidate()
827 Candidate = Id2; in findCandidate()
850 NodeId Id2 = findCandidate(M, Id1); in matchBottomUp() local
851 if (Id2.isValid()) { in matchBottomUp()
852 M.link(Id1, Id2); in matchBottomUp()
853 addOptimalMapping(M, Id1, Id2); in matchBottomUp()
884 for (NodeId Id2 : H2) { in matchTopDown() local
885 if (identical(Id1, Id2) && !M.hasSrc(Id1) && !M.hasDst(Id2)) { in matchTopDown()
887 M.link(Id1 + I, Id2 + I); in matchTopDown()
895 for (NodeId Id2 : H2) { in matchTopDown() local
896 if (!M.hasDst(Id2)) in matchTopDown()
897 L2.open(Id2); in matchTopDown()
924 for (NodeId Id2 : T2) { in computeChangeKinds() local
925 if (!M.hasDst(Id2)) { in computeChangeKinds()
926 T2.getMutableNode(Id2).Change = Insert; in computeChangeKinds()
927 T2.getMutableNode(Id2).Shift -= 1; in computeChangeKinds()
931 NodeId Id2 = M.getDst(Id1); in computeChangeKinds() local
932 if (Id2.isInvalid()) in computeChangeKinds()
934 if (!haveSameParents(M, Id1, Id2) || in computeChangeKinds()
936 T2.findPositionInParent(Id2, true)) { in computeChangeKinds()
938 T2.getMutableNode(Id2).Shift -= 1; in computeChangeKinds()
941 for (NodeId Id2 : T2.NodesBfs) { in computeChangeKinds() local
942 NodeId Id1 = M.getSrc(Id2); in computeChangeKinds()
946 Node &N2 = T2.getMutableNode(Id2); in computeChangeKinds()
949 if (!haveSameParents(M, Id1, Id2) || in computeChangeKinds()
951 T2.findPositionInParent(Id2, true)) { in computeChangeKinds()
954 if (T1.getNodeValue(Id1) != T2.getNodeValue(Id2)) { in computeChangeKinds()