1 //===- llvm/ADT/SuffixTreeNode.cpp - Nodes for SuffixTrees --------*- C++
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 //===----------------------------------------------------------------------===//
10 // This file defines nodes for use within a SuffixTree.
12 //===----------------------------------------------------------------------===//
14 #include "llvm/Support/SuffixTreeNode.h"
15 #include "llvm/Support/Casting.h"
19 unsigned SuffixTreeNode::getStartIdx() const { return StartIdx
; }
20 void SuffixTreeNode::incrementStartIdx(unsigned Inc
) { StartIdx
+= Inc
; }
21 void SuffixTreeNode::setConcatLen(unsigned Len
) { ConcatLen
= Len
; }
22 unsigned SuffixTreeNode::getConcatLen() const { return ConcatLen
; }
24 bool SuffixTreeInternalNode::isRoot() const {
25 return getStartIdx() == EmptyIdx
;
27 unsigned SuffixTreeInternalNode::getEndIdx() const { return EndIdx
; }
28 void SuffixTreeInternalNode::setLink(SuffixTreeInternalNode
*L
) {
29 assert(L
&& "Cannot set a null link?");
32 SuffixTreeInternalNode
*SuffixTreeInternalNode::getLink() const { return Link
; }
34 unsigned SuffixTreeLeafNode::getEndIdx() const {
35 assert(EndIdx
&& "EndIdx is empty?");
39 unsigned SuffixTreeLeafNode::getSuffixIdx() const { return SuffixIdx
; }
40 void SuffixTreeLeafNode::setSuffixIdx(unsigned Idx
) { SuffixIdx
= Idx
; }