Semantic MediaWiki and related extensions
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
Lingo\Tree Class Reference

Public Member Functions

 addTerm (&$term, $definition)
 
 getMinTermLength ()
 
 getTermList ()
 
 findNextTerm (&$lexemes, $index, $countLexemes)
 
 findNextTermNoSkip (Array &$tree, &$lexemes, $index, $countLexemes)
 

Public Attributes

const TREE_VERSION = 2
 

Protected Member Functions

addElement (Array &$path, &$term, &$definition)
 

Detailed Description

The Lingo class.

Vocabulary: Term - The term as a normal string Definition - Its definition (any object) Element - An element (leaf) in the glossary tree Path - The path in the tree to the leaf representing a term

The glossary is organized as a tree (nested arrays) where the path to the definition of a term is the lexemes of the term followed by -1 as the end marker.

Example: The path to the definition of the term "foo bar baz" would be 'foo'.' '.'bar'.' '.'baz'.'-1'. It could thus be accessed as $mTree['foo'][' ']['bar'][' ']['baz'][-1]

Member Function Documentation

& Lingo\Tree::addElement ( Array &  $path,
$term,
$definition 
)
protected

Adds an element to the Lingo Tree

Parameters
array$pathAn array containing the constituing lexemes of the term
String$term
String$definition
Returns
Array the tree node the element was stored in
Lingo\Tree::addTerm ( $term,
  $definition 
)

Adds a string to the Lingo Tree

Parameters
String$term
Lingo\Tree::findNextTerm ( $lexemes,
  $index,
  $countLexemes 
)
Lingo\Tree::findNextTermNoSkip ( Array &  $tree,
$lexemes,
  $index,
  $countLexemes 
)
Lingo\Tree::getMinTermLength ( )
Lingo\Tree::getTermList ( )

Member Data Documentation

const Lingo\Tree::TREE_VERSION = 2

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