|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.Writer
lp.struct.util.LpPrinter<W>
public abstract class LpPrinter<W extends Writer>
A base class for various printers of object representations of logic
programs. The implementing classes implement the methods from
LpStructureUnitVisitor
to customize the textual representation of
LpStructureUnit
s.
The class as a regular Writer
with the added
possibility to write/append a textual representation of a
LpStructureUnit
(see the append(LpStructureUnit)
and
write(LpStructureUnit)
methods).
LpStructureUnitVisitor
Field Summary | |
---|---|
private W |
out
The underlying Writer into which the class writes. |
Fields inherited from class java.io.Writer |
---|
lock |
Constructor Summary | |
---|---|
protected |
LpPrinter(W out)
Creates a new instance that writes everything into W . |
Method Summary | |
---|---|
LpPrinter |
append(char c)
Appends a single character to the underlying Writer . |
LpPrinter |
append(CharSequence csq)
Appends a character sequence to the underlying Writer . |
LpPrinter |
append(CharSequence csq,
int start,
int end)
Appends a portion of a character sequence to the underlying Writer . |
LpPrinter |
append(LpStructureUnit unit)
Appends a textual representation of unit to this
LpPrinter . |
void |
close()
Closes the underlying Writer . |
void |
flush()
Flushes the underlying Writer . |
W |
getOut()
Returns the underlying Writer into which this writes the
output. |
void |
setOut(W out)
Sets the underlying Writer into which this writes the
output. |
void |
write(char[] cbuf)
Writes a character array to the underlying Writer . |
void |
write(char[] cbuf,
int off,
int len)
Writes a portion of a character array to the underlying Writer
instance. |
void |
write(int c)
Writes a single character to the underlying Writer . |
void |
write(LpStructureUnit unit)
Writes a textual representation of unit to this
LpPrinter . |
void |
write(String str)
Writes a string to the underlying Writer . |
void |
write(String str,
int off,
int len)
Writes a string to the underlying Writer . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface lp.struct.LpStructureUnitVisitor |
---|
visit, visit, visit, visit, visit, visit, visit, visit |
Field Detail |
---|
private W extends Writer out
Writer
into which the class writes.
Constructor Detail |
---|
protected LpPrinter(W out)
W
.
out
- the Writer
into which this instance will writeMethod Detail |
---|
public W getOut()
Writer
into which this writes the
output.
Writer
into which this writes the
outputsetOut(Writer)
public void setOut(W out)
Writer
into which this writes the
output.
out
- the new Writer
into which this
LpPrinter
writes its outputgetOut()
public LpPrinter append(LpStructureUnit unit)
unit
to this
LpPrinter
. The string is constructed in the #visit()
methods. If unit
is null
, the string "null" is appended.
unit
- the LpStructureUnit
that should be represented
as a string and appended to the underlying Writer
IOException
- (wrapped in an ExceptionAdapter
) in
case an I/O exception occurs while writing to the underlying
Writer
public void write(LpStructureUnit unit)
unit
to this
LpPrinter
. The string is constructed in the #visit()
methods.
unit
- the LpStructureUnit
that should be represented
as a string and appended to the underlying Writer
IllegalArgumentException
- if unit
is null
IOException
- (wrapped in an ExceptionAdapter
) in
case an I/O exception occurs while writing to the underlying
Writer
public void write(int c)
Writer
.
write
in class Writer
c
- int specifying a character to be written
IOException
- (wrapped in an ExceptionAdapter
) in
case an I/O exception occurs while writing to the underlying
Writer
public void write(char[] cbuf)
Writer
.
write
in class Writer
cbuf
- array of characters to be written
IOException
- (wrapped in an ExceptionAdapter
) in
case an I/O exception occurs while writing to the underlying
Writer
public void write(char[] cbuf, int off, int len)
Writer
instance.
write
in class Writer
cbuf
- array of characters to be writtenoff
- offset from which to start writing characterslen
- number of characters to write
IOException
- (wrapped in an ExceptionAdapter
) in
case an I/O exception occurs while writing to the underlying
Writer
public void write(String str)
Writer
.
write
in class Writer
str
- string to be written
IOException
- (wrapped in an ExceptionAdapter
) in
case an I/O exception occurs while writing to the underlying
Writer
public void write(String str, int off, int len)
Writer
.
write
in class Writer
str
- string to be writtenoff
- offset from which to start writing characterslen
- number of characters to write
IOException
- (wrapped in an ExceptionAdapter
) in
case an I/O exception occurs while writing to the underlying
Writer
public LpPrinter append(CharSequence csq)
Writer
.
append
in interface Appendable
append
in class Writer
csq
- character sequence to be written
IOException
- (wrapped in an ExceptionAdapter
) in
case an I/O exception occurs while writing to the underlying
Writer
public LpPrinter append(CharSequence csq, int start, int end)
Writer
.
append
in interface Appendable
append
in class Writer
csq
- character sequence to be writtenstart
- the index of the first character in the subsequenceend
- the index of the character following the last character in the
subsequence
IOException
- (wrapped in an ExceptionAdapter
) in
case an I/O exception occurs while writing to the underlying
Writer
public LpPrinter append(char c)
Writer
.
append
in interface Appendable
append
in class Writer
c
- character to be written
IOException
- (wrapped in an ExceptionAdapter
) in
case an I/O exception occurs while writing to the underlying
Writer
public void flush()
Writer
.
flush
in interface Flushable
flush
in class Writer
IOException
- (wrapped in an ExceptionAdapter
) in
case an I/O exception occurs while flushing the underlying Writer
instancepublic void close()
Writer
.
close
in interface Closeable
close
in class Writer
IOException
- (wrapped in an ExceptionAdapter
) in
case an I/O exception occurs while closing the underlying Writer
instance
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |