|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlp.trans.Grounder<LogicProgram>
lp.trans.LpGrounder
public class LpGrounder
Creates a grounded version of a normal logic program. This means that
the resulting program output
has the same stable models as the
original program and output.isGround()
returns true
.
The transformation is performed using LparseWrapper
and can be
executed by calling the Grounder.ground(Object)
method.
Lparse warnings (see LparseWrapper.getWarnings()
) issued during
the grounding process are translated into GrounderMessage
s and can be
retrieved through the Grounder.getWarnings()
method.
LparseWrapper
,
LpSolver
Field Summary | |
---|---|
private LpParser |
parser
Used to parse lparse's output. |
private LpPrinter<Writer> |
pp
An instance of LpPrettyPrinter that is used to create the lparse
input with the original (non-ground) program. |
Constructor Summary | |
---|---|
LpGrounder()
Creates a new instance of LpGrounder that creates its own
LparseWrapper instance using its default constructors. |
|
LpGrounder(LparseWrapper wrapper)
Creates a new instance of LpGrounder that uses the given object
to invoke lparse and process its output. |
Method Summary | |
---|---|
protected GrounderMessage |
makeGrounderMessage(LparseMessage message,
LogicProgram inputProgram)
Creates an error message based on lparseMessage from lparse and
the input program. |
protected LogicProgram |
parseOutput(String program)
Parses the given lparse output and returns the grounded program. |
protected void |
printProgram(LogicProgram inputProgram,
Writer writer)
Prints inputProgram in a form that is groundable by lparse (as
long as the programmer didn't break the constraints imposed by lparse). |
Methods inherited from class lp.trans.Grounder |
---|
getWarnings, ground, setLparsePath |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final LpPrinter<Writer> pp
LpPrettyPrinter
that is used to create the lparse
input with the original (non-ground) program.
private final LpParser parser
Constructor Detail |
---|
public LpGrounder()
LpGrounder
that creates its own
LparseWrapper
instance using its default constructors.
public LpGrounder(LparseWrapper wrapper)
LpGrounder
that uses the given object
to invoke lparse and process its output.
wrapper
- the object used to execute lparse, parse its warnings
and/or errors and create corresponding LparseMessage objectsMethod Detail |
---|
protected void printProgram(LogicProgram inputProgram, Writer writer)
inputProgram
in a form that is groundable by lparse (as
long as the programmer didn't break the constraints imposed by lparse).
printProgram
in class Grounder<LogicProgram>
inputProgram
- the (ungrounded) input programwriter
- a Writer
to write toprotected GrounderMessage makeGrounderMessage(LparseMessage message, LogicProgram inputProgram)
lparseMessage
from lparse and
the input program.
makeGrounderMessage
in class Grounder<LogicProgram>
message
- the error or warning message issued by lparseinputProgram
- the input program
protected LogicProgram parseOutput(String program)
parseOutput
in class Grounder<LogicProgram>
program
- the lparse output
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |