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

## lp.trans
Class EvolpSolver.Decoder

    java.lang.Object
      java.io.Reader
          lp.trans.EvolpSolver.Decoder

All Implemented Interfaces:
  Closeable, Readable

Enclosing class:
  EvolpSolver

    private static class EvolpSolver.Decoder

extends Reader

A filtering reader that decodes logic programming constructs previously encoded by `LpEncoder`. Decoding means replacing each occurence of

- 'L' with '('
- 'R' with ')'
- 'C' with ','
- 'A' with "<-"
- 'D' with '.'
- '_N' with "not "
- "_l" with 'L',
- "_r" with 'R',
- "_c" with 'C',
- "_a" with 'A' and
- "_d" with 'D'.

Field Summary
`private char[]` | `buffer` A small buffer used in case a single character in the original input corresponds to more characters after the decoding filter is applied.
`private Reader` | `in` The underlying `Reader`.
`private int` | `top` Position in the buffer.

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

Constructor Summary
`EvolpSolver.Decoder(Reader in)` Creates a new instance of `Decoder` that filters the contents of `in`.

Method Summary
`void` | `close()` Closes the underlying `Reader`.
`int` | `read()` Returns the next character after applying the filter to the original input.
`int` | `read(char[] cbuf, int off, int len)` Reads to a character buffer.

Methods inherited from class java.io.Reader
`mark, markSupported, read, read, ready, reset, skip`

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

Field Detail

### in

    private final Reader in

  The underlying `Reader`.

### buffer

    private final char[] buffer

  A small buffer used in case a single character in the original input corresponds to more characters after the decoding filter is applied.

### top

    private int top

  Position in the buffer.

Constructor Detail

### EvolpSolver.Decoder

    public EvolpSolver.Decoder(Reader in)

  Creates a new instance of `Decoder` that filters the contents of `in`.

  Parameters:
    `in` - the underlying `Reader`

Method Detail

### read

    public int read()
             throws IOException

  Returns the next character after applying the filter to the original input.

  Overrides:
    `read` in class `Reader`
  Returns:
    the next character or -1 if the end has been reached
  Throws:
    `IOException` - if an I/O error occurs while reading from the underlying `Reader`

### read

    public int read(char[] cbuf,
                    int off,
                    int len)
             throws IOException

  Reads to a character buffer.

  Specified by:
    `read` in class `Reader`
  Parameters:
    `cbuf` - destination buffer
    `off` - offset at which to start storing characters
    `len` - maximum number of characters to read
  Returns:
    the number of characters read, or -1 if the end of the stream has been reached
  Throws:
    `IOException` - if an I/O error occurs while reading from the underlying `Reader`

### close

    public void close()
               throws IOException

  Closes the underlying `Reader`.

  Specified by:
    `close` in interface `Closeable`
  Specified by:
    `close` in class `Reader`
  Throws:
    `IOException` - if an I/O error occurs

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