lp.struct.util
Class LpGroundDecider

java.lang.Object
  extended by lp.struct.util.LpGroundDecider
All Implemented Interfaces:
LpStructureUnitVisitor

public class LpGroundDecider
extends Object
implements LpStructureUnitVisitor

Decides whether a LpStructureUnit is ground, i.e. if it "contains" a variable (represented by a LpVariable instance) or not. Accesses the LpStructureUnit instances by implementing the LpStructureUnitVisitor interface.

Version:
1.0.0
Author:
Martin Slota

Field Summary
private  boolean ground
          Is used to remember the current state between the calls of visit() methods.
 
Constructor Summary
LpGroundDecider()
          Creates a new instance of LpGroundDecider.
 
Method Summary
 boolean isGround(LpStructureUnit unit)
          Returns true iff unit doesn't contain a variable represented by a LpVariable instance.
 void visit(LpAtom atom)
          Used internally, shouldn't be called directly.
 void visit(LpCompoundTerm term)
          Used internally, shouldn't be called directly.
 void visit(LpConstant con)
          Used internally, shouldn't be called directly.
 void visit(LpFunction fun)
          Used internally, shouldn't be called directly.
 void visit(LpLiteral lit)
          Used internally, shouldn't be called directly.
 void visit(LpPredicate pred)
          Used internally, shouldn't be called directly.
 void visit(LpRule rule)
          Used internally, shouldn't be called directly.
 void visit(LpVariable var)
          Used internally, shouldn't be called directly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ground

private boolean ground
Is used to remember the current state between the calls of visit() methods. If it gets false, the execution of the current visit() method terminates and isGround(LpStructureUnit) returns false. If it stays true, isGround(LpStructureUnit) also returns true.

Constructor Detail

LpGroundDecider

public LpGroundDecider()
Creates a new instance of LpGroundDecider.

Method Detail

isGround

public boolean isGround(LpStructureUnit unit)
Returns true iff unit doesn't contain a variable represented by a LpVariable instance.

Parameters:
unit - the LpStructureUnit instance to examine
Returns:
true if unit is ground, and false otherwise

visit

public void visit(LpConstant con)
Used internally, shouldn't be called directly.

Specified by:
visit in interface LpStructureUnitVisitor
Parameters:
con - the LpConstant to visit
See Also:
LpStructureUnitVisitor.visit(LpConstant)

visit

public void visit(LpVariable var)
Used internally, shouldn't be called directly.

Specified by:
visit in interface LpStructureUnitVisitor
Parameters:
var - the LpVariable to visit
See Also:
LpStructureUnitVisitor.visit(LpVariable)

visit

public void visit(LpFunction fun)
Used internally, shouldn't be called directly.

Specified by:
visit in interface LpStructureUnitVisitor
Parameters:
fun - the LpFunction to visit
See Also:
LpStructureUnitVisitor.visit(LpFunction)

visit

public void visit(LpCompoundTerm term)
Used internally, shouldn't be called directly.

Specified by:
visit in interface LpStructureUnitVisitor
Parameters:
term - the LpCompoundTerm to visit
See Also:
LpStructureUnitVisitor.visit(LpCompoundTerm)

visit

public void visit(LpPredicate pred)
Used internally, shouldn't be called directly.

Specified by:
visit in interface LpStructureUnitVisitor
Parameters:
pred - the LpPredicate to visit
See Also:
LpStructureUnitVisitor.visit(LpPredicate)

visit

public void visit(LpAtom atom)
Used internally, shouldn't be called directly.

Specified by:
visit in interface LpStructureUnitVisitor
Parameters:
atom - the LpAtom to visit
See Also:
LpStructureUnitVisitor.visit(LpAtom)

visit

public void visit(LpLiteral lit)
Used internally, shouldn't be called directly.

Specified by:
visit in interface LpStructureUnitVisitor
Parameters:
lit - the LpLiteral to visit
See Also:
LpStructureUnitVisitor.visit(LpLiteral)

visit

public void visit(LpRule rule)
Used internally, shouldn't be called directly.

Specified by:
visit in interface LpStructureUnitVisitor
Parameters:
rule - the LpRule to visit
See Also:
LpStructureUnitVisitor.visit(LpRule)