GrammarScope  4.0.0
Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Static Private Member Functions | List of all members
grammarscope.io.print.TreePrinter< T extends ITreeNode< T > Class Template Reference
Collaboration diagram for grammarscope.io.print.TreePrinter< T extends ITreeNode< T >:
Collaboration graph
[legend]

Public Member Functions

String print (final T tree, final long format)
 

Static Public Attributes

static final char NODE_TAG1 = '@'
 
static final char NODE_TAG2 = '#'
 
static final char LEAF_TAG1 = '['
 
static final char LEAF_TAG2 = ']'
 
static final char SCORE_TAG1 = '|'
 
static final char SCORE_TAG2 = '|'
 
static final NumberFormat SCORE_FORMAT = new DecimalFormat("0.000")
 
static final long WORD = 0x00000001
 
static final long VALUE = 0x00000002
 
static final long INDEX = 0x00000004
 
static final long ANNOTATIONS = 0x00000008
 
static final long ALL_ANNOTATIONS = 0x00000010
 
static final long SCORE = 0x10000000
 
static final long COLLAPSE = 0x20000000
 
static final long TAG_LEAVES = 0x40000000
 
static final long TAG_NODES = 0x80000000
 
static final long FULL = VALUE | INDEX | ANNOTATIONS | SCORE
 

Protected Member Functions

StringBuffer appendNode (final StringBuffer sb, final T tree, final long format)
 
StringBuffer appendLabel (final StringBuffer sb, final ILabel l, final boolean isLeaf, final long format)
 
StringBuffer appendAnnotations (final StringBuffer sb, final ILabel l)
 
StringBuffer appendAnnotationsFull (final StringBuffer sb, final ILabel l)
 
StringBuffer appendScore (final StringBuffer sb, final T tree)
 
boolean isLeaf (final T t)
 

Private Member Functions

StringBuffer appendTree (final StringBuffer sb, final T tree, final int indentLevel, final boolean parentLabelNull, final boolean firstSibling, final boolean leftSiblingPreTerminal, final boolean topLevel, final long format)
 
StringBuffer appendTree1 (final StringBuffer sb, final T t, final long format)
 
boolean isPreTerminal (final T t)
 

Static Private Member Functions

static StringBuffer appendIndex (final StringBuffer sb, final ILabel l)
 
static StringBuffer indent (final StringBuffer sb, final int n)
 

Detailed Description

Common utilities

Author
Stanford
Bernard Bou [1313o.nosp@m.u@gm.nosp@m.ail.c.nosp@m.om]

Member Function Documentation

◆ appendAnnotations()

StringBuffer grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.appendAnnotations ( final StringBuffer  sb,
final ILabel  l 
)
protected

Append annotations to string buffer

Parameters
sbstring buffer
llabel
Returns
input string sb

◆ appendAnnotationsFull()

StringBuffer grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.appendAnnotationsFull ( final StringBuffer  sb,
final ILabel  l 
)
protected

Append all annotations to string buffer

Parameters
sbstring buffer
llabel
Returns
input string sb

◆ appendIndex()

static StringBuffer grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.appendIndex ( final StringBuffer  sb,
final ILabel  l 
)
staticprivate

Append index to string buffer

Parameters
sbstring buffer
llabel
Returns
input string sb

◆ appendLabel()

StringBuffer grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.appendLabel ( final StringBuffer  sb,
final ILabel  l,
final boolean  isLeaf,
final long  format 
)
protected

Append label to string buffer as per format

Parameters
sbstring buffer
llabel
isLeafwhether it is leaf
formatformat
Returns
input string sb

◆ appendNode()

StringBuffer grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.appendNode ( final StringBuffer  sb,
final T  tree,
final long  format 
)
protected

Append label to string buffer as per format

Parameters
sbstring buffer
treetree
formatformat
Returns
input string sb

◆ appendScore()

StringBuffer grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.appendScore ( final StringBuffer  sb,
final T  tree 
)
protected

Append score to string buffer

Parameters
sbstring buffer
treetree
Returns
input string sb

◆ appendTree()

StringBuffer grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.appendTree ( final StringBuffer  sb,
final T  tree,
final int  indentLevel,
final boolean  parentLabelNull,
final boolean  firstSibling,
final boolean  leftSiblingPreTerminal,
final boolean  topLevel,
final long  format 
)
private

Append node to string buffer, implementing Penn Treebank style layout

Parameters
sbstring buffer
treetree
indentLevelindent level
parentLabelNullwhether parent label is null
firstSiblingwhether tree is first sibling
leftSiblingPreTerminalwhether tree is left sibling preterminal
topLevelwhether tree is top level
formatformat guidelines
Returns
sb author Stanford Parser authors author Bernard Bou for revision

◆ appendTree1()

StringBuffer grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.appendTree1 ( final StringBuffer  sb,
final T  t,
final long  format 
)
private

Append tree to string buffer (no line break)

Parameters
sbstring buffer
ttree
formatformat guidelines
Returns
sb

◆ indent()

static StringBuffer grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.indent ( final StringBuffer  sb,
final int  n 
)
staticprivate

Indent

Parameters
sbstring buffer
nnumber of indents
Returns
sb

◆ isLeaf()

boolean grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.isLeaf ( final T  t)
protected

Is leaf

Parameters
ttree
Returns
true if tree is leaf

◆ isPreTerminal()

boolean grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.isPreTerminal ( final T  t)
private

Is preterminal

Parameters
ttree
Returns
true if tree is preterminal

◆ print()

String grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.print ( final T  tree,
final long  format 
)

String for treegraph

Parameters
treetreegraph
formatformat
Returns
treegraph string

Member Data Documentation

◆ ALL_ANNOTATIONS

final long grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.ALL_ANNOTATIONS = 0x00000010
static

◆ ANNOTATIONS

final long grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.ANNOTATIONS = 0x00000008
static

◆ COLLAPSE

final long grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.COLLAPSE = 0x20000000
static

◆ FULL

final long grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.FULL = VALUE | INDEX | ANNOTATIONS | SCORE
static

◆ INDEX

final long grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.INDEX = 0x00000004
static

◆ LEAF_TAG1

final char grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.LEAF_TAG1 = '['
static

◆ LEAF_TAG2

final char grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.LEAF_TAG2 = ']'
static

◆ NODE_TAG1

final char grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.NODE_TAG1 = '@'
static

◆ NODE_TAG2

final char grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.NODE_TAG2 = '#'
static

◆ SCORE

final long grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.SCORE = 0x10000000
static

◆ SCORE_FORMAT

final NumberFormat grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.SCORE_FORMAT = new DecimalFormat("0.000")
static

◆ SCORE_TAG1

final char grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.SCORE_TAG1 = '|'
static

◆ SCORE_TAG2

final char grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.SCORE_TAG2 = '|'
static

◆ TAG_LEAVES

final long grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.TAG_LEAVES = 0x40000000
static

◆ TAG_NODES

final long grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.TAG_NODES = 0x80000000
static

◆ VALUE

final long grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.VALUE = 0x00000002
static

◆ WORD

final long grammarscope.io.print.TreePrinter< T extends ITreeNode< T >.WORD = 0x00000001
static

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