1 //===- llvm/ADT/SuffixTreeNode.cpp - Nodes for SuffixTrees --------*- C++ 2 //-*-===// 3 // 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 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file defines nodes for use within a SuffixTree. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #include "llvm/Support/SuffixTreeNode.h" 15 #include "llvm/Support/Casting.h" 16 17 using namespace llvm; 18 getStartIdx() const19unsigned SuffixTreeNode::getStartIdx() const { return StartIdx; } incrementStartIdx(unsigned Inc)20void SuffixTreeNode::incrementStartIdx(unsigned Inc) { StartIdx += Inc; } setConcatLen(unsigned Len)21void SuffixTreeNode::setConcatLen(unsigned Len) { ConcatLen = Len; } getConcatLen() const22unsigned SuffixTreeNode::getConcatLen() const { return ConcatLen; } 23 isRoot() const24bool SuffixTreeInternalNode::isRoot() const { 25 return getStartIdx() == EmptyIdx; 26 } getEndIdx() const27unsigned SuffixTreeInternalNode::getEndIdx() const { return EndIdx; } setLink(SuffixTreeInternalNode * L)28void SuffixTreeInternalNode::setLink(SuffixTreeInternalNode *L) { 29 assert(L && "Cannot set a null link?"); 30 Link = L; 31 } getLink() const32SuffixTreeInternalNode *SuffixTreeInternalNode::getLink() const { return Link; } 33 getEndIdx() const34unsigned SuffixTreeLeafNode::getEndIdx() const { 35 assert(EndIdx && "EndIdx is empty?"); 36 return *EndIdx; 37 } 38 getSuffixIdx() const39unsigned SuffixTreeLeafNode::getSuffixIdx() const { return SuffixIdx; } setSuffixIdx(unsigned Idx)40void SuffixTreeLeafNode::setSuffixIdx(unsigned Idx) { SuffixIdx = Idx; } 41 getLeftLeafIdx() const42unsigned SuffixTreeNode::getLeftLeafIdx() const { return LeftLeafIdx; } getRightLeafIdx() const43unsigned SuffixTreeNode::getRightLeafIdx() const { return RightLeafIdx; } setLeftLeafIdx(unsigned Idx)44void SuffixTreeNode::setLeftLeafIdx(unsigned Idx) { LeftLeafIdx = Idx; } setRightLeafIdx(unsigned Idx)45void SuffixTreeNode::setRightLeafIdx(unsigned Idx) { RightLeafIdx = Idx; } 46