clang-tools 20.0.0git
Public Types | Public Member Functions | Protected Member Functions | Friends | List of all members
clang::clangd::dex::Iterator Class Referenceabstract

Iterator is the interface for Query Tree node. More...

#include <Iterator.h>

Public Types

enum class  Kind {
  And , Or , True , False ,
  Other
}
 Inspect iterator type, used internally for optimizing query trees. More...
 

Public Member Functions

virtual bool reachedEnd () const =0
 Returns true if all valid DocIDs were processed and hence the iterator is exhausted.
 
virtual void advance ()=0
 Moves to next valid DocID.
 
virtual void advanceTo (DocID ID)=0
 Moves to the first valid DocID which is equal or higher than given ID.
 
virtual DocID peek () const =0
 Returns the current element this iterator points to.
 
virtual float consume ()=0
 Informs the iterator that the current document was consumed, and returns its boost.
 
virtual size_t estimateSize () const =0
 Returns an estimate of advance() calls before the iterator is exhausted.
 
virtual ~Iterator ()
 
Kind kind () const
 

Protected Member Functions

 Iterator (Kind MyKind=Kind::Other)
 

Friends

llvm::raw_ostream & operator<< (llvm::raw_ostream &OS, const Iterator &Iterator)
 Prints a convenient human-readable iterator representation by recursively dumping iterators in the following format:
 

Detailed Description

Iterator is the interface for Query Tree node.

The simplest type of Iterator is DocumentIterator which is simply a wrapper around PostingList iterator and serves as the Query Tree leaf. More sophisticated examples of iterators can manage intersection, union of the elements produced by other iterators (their children) to form a multi-level Query Tree. The interface is designed to be extensible in order to support multiple types of iterators.

Definition at line 53 of file Iterator.h.

Member Enumeration Documentation

◆ Kind

Inspect iterator type, used internally for optimizing query trees.

Enumerator
And 
Or 
True 
False 
Other 

Definition at line 100 of file Iterator.h.

Constructor & Destructor Documentation

◆ ~Iterator()

virtual clang::clangd::dex::Iterator::~Iterator ( )
inlinevirtual

Definition at line 83 of file Iterator.h.

◆ Iterator()

clang::clangd::dex::Iterator::Iterator ( Kind  MyKind = Kind::Other)
inlineprotected

Definition at line 104 of file Iterator.h.

Member Function Documentation

◆ advance()

virtual void clang::clangd::dex::Iterator::advance ( )
pure virtual

Moves to next valid DocID.

If it doesn't exist, the iterator is exhausted and proceeds to the END.

Note: reachedEnd() must be false.

Referenced by clang::clangd::dex::consume().

◆ advanceTo()

virtual void clang::clangd::dex::Iterator::advanceTo ( DocID  ID)
pure virtual

Moves to the first valid DocID which is equal or higher than given ID.

If it doesn't exist, the iterator is exhausted and proceeds to the END.

Note: reachedEnd() must be false.

◆ consume()

virtual float clang::clangd::dex::Iterator::consume ( )
pure virtual

Informs the iterator that the current document was consumed, and returns its boost.

Note: If this iterator has any child iterators that contain the document, consume() should be called on those and their boosts incorporated. consume() must not be called on children that don't contain the current doc.

Referenced by clang::clangd::dex::consume().

◆ estimateSize()

virtual size_t clang::clangd::dex::Iterator::estimateSize ( ) const
pure virtual

Returns an estimate of advance() calls before the iterator is exhausted.

◆ kind()

Kind clang::clangd::dex::Iterator::kind ( ) const
inline

Definition at line 101 of file Iterator.h.

◆ peek()

virtual DocID clang::clangd::dex::Iterator::peek ( ) const
pure virtual

Returns the current element this iterator points to.

Note: reachedEnd() must be false.

Referenced by clang::clangd::dex::consume().

◆ reachedEnd()

virtual bool clang::clangd::dex::Iterator::reachedEnd ( ) const
pure virtual

Returns true if all valid DocIDs were processed and hence the iterator is exhausted.

Referenced by clang::clangd::dex::consume().

Friends And Related Function Documentation

◆ operator<<

llvm::raw_ostream & operator<< ( llvm::raw_ostream &  OS,
const Iterator Iterator 
)
friend

Prints a convenient human-readable iterator representation by recursively dumping iterators in the following format:

(Type Child1 Child2 ...)

Where Type is the iterator type representation: "&" for And, "|" for Or, ChildN is N-th iterator child. Raw iterators over PostingList are represented as "[... CurID ...]" where CurID is the current PostingList entry being inspected.

Definition at line 94 of file Iterator.h.


The documentation for this class was generated from the following file: