com.unitesk.atp.tree.generation
Class TextGeneratorServer

java.lang.Object
  extended by com.unitesk.atp.text.generation.BasicGenerator
      extended by com.unitesk.atp.tree.generation.TextGeneratorServer
All Implemented Interfaces:
PatternFilter.ParameterProcessor, Generator, TextGenerator

public class TextGeneratorServer
extends BasicGenerator
implements TextGenerator

Text Generator Server implements TextGenerator functionality.

Version:
$Id: TextGeneratorServer.java,v 1.1 2004/10/09 06:28:48 all-x Exp $
Author:
Alexey Demakov

Field Summary
protected  IndentFilter indentFilter
          Indent manager filter.
protected  LineSplitFilter lineSplitFilter
          Line splitter.
protected  TextReceiver out
          Client receiving results of text generation.
 
Fields inherited from class com.unitesk.atp.text.generation.BasicGenerator
client, name_to_func, name_to_var, pattern_filter, variable_map
 
Fields inherited from interface com.unitesk.atp.tree.generation.TextGenerator
endl
 
Fields inherited from interface com.unitesk.atp.text.generation.Generator
DEFAULT_NAME
 
Constructor Summary
TextGeneratorServer(TextReceiver client)
          Constructs Text Generator Server with the given client and default indent step.
TextGeneratorServer(TextReceiver client, int indentStep)
          Constructs Text Generator Server with the given client and indent step.
 
Method Summary
 void decIndent()
          Decreases indent level at one indent step.
 int getIndent()
          Returns the current indent level.
 Node getNode()
          Returns current node.
 void incIndent()
          Increases indent level at one indent step.
 void list(String index, int start, int end, String str, String separator)
          Prints list of strings.
 void nl()
          Starts a new line of text.
 void popIndent()
          Restores previous indent level.
 void popNode()
          Restore previous node.
 void pushIndent(int indent)
          Makes indent current indent level.
 void pushNode(Node node)
          Sets default node for all operations with attributes.
 void txtAsIs(String str)
          Print string as is, don't treat it as pattern and don't split lines.
 
Methods inherited from class com.unitesk.atp.text.generation.BasicGenerator
getFunction, getVariable, mustBeID, param, setFunction, setVariable, txt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.unitesk.atp.text.generation.Generator
getFunction, getVariable, setFunction, setVariable, txt
 

Field Detail

lineSplitFilter

protected LineSplitFilter lineSplitFilter
Line splitter.


indentFilter

protected IndentFilter indentFilter
Indent manager filter. Client of lineSplitFilter


out

protected TextReceiver out
Client receiving results of text generation. Client of indentFilter

Constructor Detail

TextGeneratorServer

public TextGeneratorServer(TextReceiver client)
Constructs Text Generator Server with the given client and default indent step.

Parameters:
client - The client receiving results of text generation.

TextGeneratorServer

public TextGeneratorServer(TextReceiver client,
                           int indentStep)
Constructs Text Generator Server with the given client and indent step.

Parameters:
client - The client receiving results of text generation.
indentStep - Indent step.
Method Detail

pushNode

public void pushNode(Node node)
Sets default node for all operations with attributes.

Specified by:
pushNode in interface TextGenerator
Parameters:
node - The new default node.

getNode

public Node getNode()
Returns current node.

Specified by:
getNode in interface TextGenerator
Returns:
The current node.

popNode

public void popNode()
Restore previous node.

Specified by:
popNode in interface TextGenerator

pushIndent

public void pushIndent(int indent)
Makes indent current indent level. The previous indent level can be restored by TextGenerator.popIndent()

Specified by:
pushIndent in interface TextGenerator
Parameters:
indent - the new indent level

getIndent

public int getIndent()
Returns the current indent level.

Specified by:
getIndent in interface TextGenerator
Returns:
The current indent level.

incIndent

public void incIndent()
Increases indent level at one indent step. The previous indent level can be restored by TextGenerator.popIndent()

Specified by:
incIndent in interface TextGenerator

decIndent

public void decIndent()
Decreases indent level at one indent step. The previous indent level can be restored by TextGenerator.popIndent()

Specified by:
decIndent in interface TextGenerator

popIndent

public void popIndent()
Restores previous indent level.

Specified by:
popIndent in interface TextGenerator
See Also:
TextGenerator.pushIndent(int), TextGenerator.incIndent(), TextGenerator.decIndent()

list

public void list(String index,
                 int start,
                 int end,
                 String str,
                 String separator)
Prints list of strings.

Specified by:
list in interface TextGenerator
Parameters:
index - The variable name to store current index of list element.
start - The starting value of an index
end - if start < end then
  index is increased by 1 from start to end - 1
if start > end then
  index is decreased by 1 from start - 1 to end
if start == end then
  no actions
str - The string to print for each list element using txt( str )
separator - The separator to print between strings for list elements using txt( str )

nl

public void nl()
Starts a new line of text.

Specified by:
nl in interface TextGenerator

txtAsIs

public void txtAsIs(String str)
Print string as is, don't treat it as pattern and don't split lines. This method is used for printing values of parameters.

Specified by:
txtAsIs in interface Generator
Overrides:
txtAsIs in class BasicGenerator
Parameters:
str - The string to pass as is.


Copyright © 2001-2006 ISP RAS, RedVerst Group. All Rights Reserved.