|
|||||||||
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>
lp.struct.util.LpPrettyPrinter<W>
lp.trans.DlpGrounder.DlpTagger<W>
private static class DlpGrounder.DlpTagger<W extends Writer>
A special LpStructureUnit
printer that:
Field Summary | |
---|---|
private int |
tagNumber
Contains the current tag number used for adding the tagging literals. |
private boolean |
visitingHead
Indicates whether a rule's head or a body literal is being processed. |
Fields inherited from class lp.struct.util.LpPrettyPrinter |
---|
ARROW_STRING, SPACE_STRING |
Fields inherited from class java.io.Writer |
---|
lock |
Constructor Summary | |
---|---|
DlpGrounder.DlpTagger(W out)
Creates a new instance of TaggingPrettyPrinter . |
Method Summary | |
---|---|
void |
appendTagFacts()
Appends facts with all tagging literals used until now to this character sequence. |
void |
incTagNumber()
Increments the tag number used for adding the tagging literals. |
void |
reset()
|
void |
visit(LpLiteral lit)
Appends a textual form of a LpLiteral instance to this
character sequence. |
void |
visit(LpRule rule)
Appends a textual form of a LpRule instance to this character
sequence. |
Methods inherited from class lp.struct.util.LpPrettyPrinter |
---|
appendRuleNoDot, arrow, beginParen, comma, dot, endParen, getBuffer, getBuffer, literalPrefix, space, visit, visit, visit, visit, visit, visit, visitArgumentList |
Methods inherited from class lp.struct.util.LpPrinter |
---|
append, append, append, append, close, flush, getOut, setOut, write, 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 |
---|
private int tagNumber
private boolean visitingHead
Constructor Detail |
---|
public DlpGrounder.DlpTagger(W out)
TaggingPrettyPrinter
.
Method Detail |
---|
public void reset()
public void incTagNumber()
public void visit(LpRule rule)
LpRule
instance to this character
sequence. Shouldn't be called directly,
LpPrinter.append(LpStructureUnit)
should be used instead.
In case it has a negative literal in its head, it is output as a
positive literal, but "n_" is prepended to the predicate's name. In
case the head is a positive literal, "p_" is prepended to its head.
Polarity of body literals is not changed but the "p_" is always
prepended to their predicate names to recognize them from the tagging
literal (lparse changes the order of literals so this couldn't be
used). A tagging literal of the form "tag#" is added to each rule's
body. The # is substituted with the current tag number.
visit
in interface LpStructureUnitVisitor
visit
in class LpPrettyPrinter<W extends Writer>
rule
- the LpRule
instance whose textual
representation should be appended to this character sequence
NullPointerException
- if rule
is null
LpPrinter
,
LpStructureUnitVisitor.visit(LpRule)
public void visit(LpLiteral lit)
LpLiteral
instance to this
character sequence. Shouldn't be called directly,
LpPrinter.append(LpStructureUnit)
should be used instead.
The behaviour of this method depends on the context of the given
literal—whether it is a body literal or a head literal. See
visit(LpRule)
.
visit
in interface LpStructureUnitVisitor
visit
in class LpPrettyPrinter<W extends Writer>
lit
- the LpLiteral
instance whose textual
representation should be appended to this character sequence
NullPointerException
- if lit
is null
LpPrinter
,
LpStructureUnitVisitor.visit(LpLiteral)
public void appendTagFacts()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |