Lines Matching refs:NodeId

39     SrcToDst = std::make_unique<NodeId[]>(Size);  in Mapping()
40 DstToSrc = std::make_unique<NodeId[]>(Size); in Mapping()
43 void link(NodeId Src, NodeId Dst) { in link()
47 NodeId getDst(NodeId Src) const { return SrcToDst[Src]; } in getDst()
48 NodeId getSrc(NodeId Dst) const { return DstToSrc[Dst]; } in getSrc()
49 bool hasSrc(NodeId Src) const { return getDst(Src).isValid(); } in hasSrc()
50 bool hasDst(NodeId Dst) const { return getSrc(Dst).isValid(); } in hasDst()
53 std::unique_ptr<NodeId[]> SrcToDst, DstToSrc;
71 NodeId getMapped(const std::unique_ptr<SyntaxTree::Impl> &Tree, in getMapped()
72 NodeId Id) const { in getMapped()
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;
98 NodeId findCandidate(const Mapping &M, NodeId Id1) const;
134 std::vector<NodeId> Leaves;
137 std::vector<NodeId> NodesBfs;
140 NodeId getRootId() const { return 0; } in getRootId()
144 const Node &getNode(NodeId Id) const { return Nodes[Id]; } in getNode()
145 Node &getMutableNode(NodeId Id) { return Nodes[Id]; } in getMutableNode()
146 bool isValidNodeId(NodeId Id) const { return Id >= 0 && Id < getSize(); } in isValidNodeId()
148 int getNumberOfDescendants(NodeId Id) const;
149 bool isInSubtree(NodeId Id, NodeId SubtreeRoot) const;
150 int findPositionInParent(NodeId Id, bool Shifted = false) const;
156 std::string getNodeValue(NodeId Id) const;
192 NodeId Parent;
197 template <class T> std::tuple<NodeId, NodeId> PreTraverse(T *ASTNode) { in PreTraverse()
198 NodeId MyId = Id; in PreTraverse()
215 void PostTraverse(std::tuple<NodeId, NodeId> State) { in PostTraverse()
216 NodeId MyId, PreviousParent; in PostTraverse()
229 for (NodeId Child : N.Children) in PostTraverse()
281 static std::vector<NodeId> getSubtreePostorder(const SyntaxTree::Impl &Tree, in getSubtreePostorder()
282 NodeId Root) { in getSubtreePostorder()
283 std::vector<NodeId> Postorder; in getSubtreePostorder()
284 std::function<void(NodeId)> Traverse = [&](NodeId Id) { in getSubtreePostorder()
286 for (NodeId Child : N.Children) in getSubtreePostorder()
294 static std::vector<NodeId> getSubtreeBfs(const SyntaxTree::Impl &Tree, in getSubtreeBfs()
295 NodeId Root) { in getSubtreeBfs()
296 std::vector<NodeId> Ids; in getSubtreeBfs()
300 for (NodeId Child : Tree.getNode(Ids[Expanded++]).Children) in getSubtreeBfs()
309 std::function<void(NodeId)> PostorderTraverse = [&](NodeId Id) { in initTree()
310 for (NodeId Child : getNode(Id).Children) in initTree()
320 for (NodeId Leaf : Leaves) { in setLeftMostDescendants()
322 NodeId Parent, Cur = Leaf; in setLeftMostDescendants()
331 int SyntaxTree::Impl::getNumberOfDescendants(NodeId Id) const { in getNumberOfDescendants()
335 bool SyntaxTree::Impl::isInSubtree(NodeId Id, NodeId SubtreeRoot) const { in isInSubtree()
339 int SyntaxTree::Impl::findPositionInParent(NodeId Id, bool Shifted) const { in findPositionInParent()
340 NodeId Parent = getNode(Id).Parent; in findPositionInParent()
409 std::string SyntaxTree::Impl::getNodeValue(NodeId Id) const { in getNodeValue()
491 std::vector<NodeId> RootIds;
498 Subtree(const SyntaxTree::Impl &Tree, NodeId SubtreeRoot) : Tree(Tree) { in Subtree()
504 NodeId getIdInRoot(SNodeId Id) const { in getIdInRoot()
516 NodeId getPostorderOffset() const { in getPostorderOffset()
567 const SyntaxTree::Impl &T2, NodeId Id1, NodeId Id2) in ZhangShashaMatcher()
579 std::vector<std::pair<NodeId, NodeId>> getMatchingNodes() { in getMatchingNodes()
580 std::vector<std::pair<NodeId, NodeId>> Matches; in getMatchingNodes()
618 NodeId Id1 = S1.getIdInRoot(Row); in getMatchingNodes()
619 NodeId Id2 = S2.getIdInRoot(Col); in getMatchingNodes()
712 bool operator()(NodeId Id1, NodeId Id2) const { in operator ()()
723 std::vector<NodeId> Container;
724 PriorityQueue<NodeId, std::vector<NodeId>, HeightLess> List;
730 void push(NodeId id) { List.push(id); } in push()
732 std::vector<NodeId> pop() { in pop()
734 std::vector<NodeId> Result; in pop()
750 void open(NodeId Id) { in open()
751 for (NodeId Child : Tree.getNode(Id).Children) in open()
757 bool ASTDiff::Impl::identical(NodeId Id1, NodeId Id2) const { in identical()
770 bool ASTDiff::Impl::isMatchingPossible(NodeId Id1, NodeId Id2) const { in isMatchingPossible()
774 bool ASTDiff::Impl::haveSameParents(const Mapping &M, NodeId Id1, in haveSameParents()
775 NodeId Id2) const { in haveSameParents()
776 NodeId P1 = T1.getNode(Id1).Parent; in haveSameParents()
777 NodeId P2 = T2.getNode(Id2).Parent; in haveSameParents()
782 void ASTDiff::Impl::addOptimalMapping(Mapping &M, NodeId Id1, in addOptimalMapping()
783 NodeId Id2) const { in addOptimalMapping()
788 std::vector<std::pair<NodeId, NodeId>> R = Matcher.getMatchingNodes(); in addOptimalMapping()
790 NodeId Src = Tuple.first; in addOptimalMapping()
791 NodeId Dst = Tuple.second; in addOptimalMapping()
797 double ASTDiff::Impl::getJaccardSimilarity(const Mapping &M, NodeId Id1, in getJaccardSimilarity()
798 NodeId Id2) const { in getJaccardSimilarity()
802 for (NodeId Src = Id1 + 1; Src <= N1.RightMostDescendant; ++Src) { in getJaccardSimilarity()
803 NodeId Dst = M.getDst(Src); in getJaccardSimilarity()
816 NodeId ASTDiff::Impl::findCandidate(const Mapping &M, NodeId Id1) const { in findCandidate()
817 NodeId Candidate; in findCandidate()
819 for (NodeId Id2 : T2) { in findCandidate()
834 std::vector<NodeId> Postorder = getSubtreePostorder(T1, T1.getRootId()); in matchBottomUp()
835 for (NodeId Id1 : Postorder) { in matchBottomUp()
847 N1.Children, [&](NodeId Child) { return M.hasSrc(Child); }); in matchBottomUp()
850 NodeId Id2 = findCandidate(M, Id1); in matchBottomUp()
871 for (NodeId Id : L1.pop()) in matchTopDown()
876 for (NodeId Id : L2.pop()) in matchTopDown()
880 std::vector<NodeId> H1, H2; in matchTopDown()
883 for (NodeId Id1 : H1) { in matchTopDown()
884 for (NodeId Id2 : H2) { in matchTopDown()
891 for (NodeId Id1 : H1) { in matchTopDown()
895 for (NodeId Id2 : H2) { in matchTopDown()
918 for (NodeId Id1 : T1) { in computeChangeKinds()
924 for (NodeId Id2 : T2) { in computeChangeKinds()
930 for (NodeId Id1 : T1.NodesBfs) { in computeChangeKinds()
931 NodeId Id2 = M.getDst(Id1); in computeChangeKinds()
941 for (NodeId Id2 : T2.NodesBfs) { in computeChangeKinds()
942 NodeId Id1 = M.getSrc(Id2); in computeChangeKinds()
966 NodeId ASTDiff::getMapped(const SyntaxTree &SourceTree, NodeId Id) const { in getMapped()
978 const Node &SyntaxTree::getNode(NodeId Id) const { in getNode()
983 NodeId SyntaxTree::getRootId() const { return TreeImpl->getRootId(); } in getRootId()
989 int SyntaxTree::findPositionInParent(NodeId Id) const { in findPositionInParent()
1009 std::string SyntaxTree::getNodeValue(NodeId Id) const { in getNodeValue()