Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| GNU Prolog for Java
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## gnu.prolog.io
Class TermWriter

    java.lang.Object
      java.io.Writer
          java.io.PrintWriter
              gnu.prolog.io.TermWriter

All Implemented Interfaces:
  Closeable, Flushable, Appendable

    public class TermWriter

extends PrintWriter

This class is intendent for printing terms.

Version:
  0.0.1
Author:
  Constantine A. Plotnikov.

Field Summary
`protected static CompoundTermTag` | `curly1Tag`
`protected static OperatorSet` | `defaultOperatorSet`
`protected static WriteOptions` | `defaultWriteOptions`
`protected static CompoundTermTag` | `numbervarsTag`

Fields inherited from class java.io.PrintWriter
`out`

Fields inherited from class java.io.Writer
`lock`

Constructor Summary
`TermWriter(Writer w)` create term writer over other writer.

Method Summary
`protected static void` | `appendQuotedChar(StringBuffer buf, char ch, char quote)` append quoted char to string buffer.
`protected void` | `displayAtom(WriteOptions options, AtomTerm atom)` display atom.
`protected void` | `displayCompound(WriteOptions options, int priority, CompoundTerm term)` display compound term
`protected void` | `displayFloat(WriteOptions options, FloatTerm term)` display float term
`protected void` | `displayInteger(WriteOptions options, IntegerTerm term)` display integer term
`protected void` | `displayJavaObject(WriteOptions options, JavaObjectTerm term)`
`protected void` | `displayList(WriteOptions options, CompoundTerm term)` display list
`protected void` | `displayTerm(WriteOptions options, int priority, Term term)` display term
`protected void` | `displayVariable(WriteOptions options, VariableTerm variable)` display variable term
`protected static String` | `getSingleQuoted(String s)` get single quoted string.
`protected static boolean` | `isAtomChar(char c)` check if character is valid continuation of atom.
`protected static boolean` | `isAtomStartChar(char c)` check if character is valid start of atom.
`protected static boolean` | `isGraphicsChar(char ch)` check if character is graphics char.
`protected static boolean` | `isOperator(OperatorSet set, AtomTerm term)`
`protected static boolean` | `isSoloChar(char c)` check if character is solo char.
`protected static boolean` | `needBeQuoted(String s)` check if the string is needed to be quoted .
`void` | `print(OperatorSet opSet, Term term)` print term using default write options and specified operator set
`void` | `print(Term term)` print term using default write options
`void` | `print(WriteOptions options, Term term)` print term using specified write options
`static String` | `toString(Term term)` convert term passed as argument to string
`static String` | `toString(Term term, WriteOptions options)` convert term passed as argument to string

Methods inherited from class java.io.PrintWriter
`append, append, append, checkError, clearError, close, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, println, setError, write, write, write, write, write`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### numbervarsTag

    protected static final CompoundTermTag numbervarsTag

### curly1Tag

    protected static final CompoundTermTag curly1Tag

### defaultOperatorSet

    protected static final OperatorSet defaultOperatorSet

### defaultWriteOptions

    protected static final WriteOptions defaultWriteOptions

Constructor Detail

### TermWriter

    public TermWriter(Writer w)

  create term writer over other writer.

  Parameters:
    `w` - underlying writer

Method Detail

### toString

    public static String toString(Term term)

  convert term passed as argument to string

  Parameters:
    `term` - a term to convert
  Returns:
    String representation of the term

### toString

    public static String toString(Term term,
                                  WriteOptions options)

  convert term passed as argument to string

  Parameters:
    `term` - a term to convert
    `options` - the WriteOptions to use for converting the term to a String
  Returns:
    String representation of the term

### print

    public void print(WriteOptions options,
                      Term term)

  print term using specified write options

  Parameters:
    `options` - write options
    `term` - term to print

### print

    public void print(Term term)

  print term using default write options

  Parameters:
    `term` - term to print

### print

    public void print(OperatorSet opSet,
                      Term term)

  print term using default write options and specified operator set

  Parameters:
    `opSet` - operator set to use
    `term` - term to print

### displayTerm

    protected void displayTerm(WriteOptions options,
                               int priority,
                               Term term)

  display term

  Parameters:
    `options` - current write options
    `priority` - priority of nearest operation, this variable is only defined if ignoreOps is false.
    `term` - term to write

### displayCompound

    protected void displayCompound(WriteOptions options,
                                   int priority,
                                   CompoundTerm term)

  display compound term

  Parameters:
    `options` - current write options
    `priority` - priority of nearest operation, this variable is only defined if ignoreOps is false.
    `term` - compound term to write

### displayList

    protected void displayList(WriteOptions options,
                               CompoundTerm term)

  display list

  Parameters:
    `options` - current write options
    `term` - list term to write

### displayFloat

    protected void displayFloat(WriteOptions options,
                                FloatTerm term)

  display float term

  Parameters:
    `options` - current write options
    `term` - fload term to write

### displayInteger

    protected void displayInteger(WriteOptions options,
                                  IntegerTerm term)

  display integer term

  Parameters:
    `options` - current write options
    `term` - integer term to write

### displayVariable

    protected void displayVariable(WriteOptions options,
                                   VariableTerm variable)

  display variable term

  Parameters:
    `options` - current write options
    `variable` - variable to display

### displayJavaObject

    protected void displayJavaObject(WriteOptions options,
                                     JavaObjectTerm term)

### isOperator

    protected static boolean isOperator(OperatorSet set,
                                        AtomTerm term)

### displayAtom

    protected void displayAtom(WriteOptions options,
                               AtomTerm atom)

  display atom.

  Parameters:
    `options` - current write options
    `atom` - atom to display

### getSingleQuoted

    protected static String getSingleQuoted(String s)

  get single quoted string.

  Parameters:
    `s` - string to quote
  Returns:
    single quoted string

### needBeQuoted

    protected static boolean needBeQuoted(String s)

  check if the string is needed to be quoted .

  Parameters:
    `s` - string to test
  Returns:
    true if string need to quoted in displayq

### isSoloChar

    protected static boolean isSoloChar(char c)

  check if character is solo char.

  Parameters:
    `c` - character to test
  Returns:
    true if character is solo char

### isGraphicsChar

    protected static boolean isGraphicsChar(char ch)

  check if character is graphics char.

  Parameters:
    `ch` - character to test
  Returns:
    true if character is graphics char

### isAtomStartChar

    protected static boolean isAtomStartChar(char c)

  check if character is valid start of atom.

  Parameters:
    `c` - character to test
  Returns:
    true if character is valid start of atom.

### isAtomChar

    protected static boolean isAtomChar(char c)

  check if character is valid continuation of atom.

  Parameters:
    `c` - character to test
  Returns:
    true if character is valid continuation of atom.

### appendQuotedChar

    protected static void appendQuotedChar(StringBuffer buf,
                                           char ch,
                                           char quote)

  append quoted char to string buffer.

  Parameters:
    `buf` - buffer to which character is added
    `ch` - character to add
    `quote` - a quote of string

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| GNU Prolog for Java
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD