edu.udo.cs.ie.cowbots.elpParser.dlp
Class DLPRule

Package class diagram package DLPRule
java.lang.Object
  extended by edu.udo.cs.ie.cowbots.logic.ELPRule
      extended by edu.udo.cs.ie.cowbots.elpParser.dlp.DLPRule

public class DLPRule
extends ELPRule

this class extends from its father class ELPRule. stand by parsing

See Also:
ELPRule

Field Summary
(package private)  java.util.ArrayList<DLPLiteral> body
           
(package private)  java.util.ArrayList<DLPLiteral> head
           
 
Constructor Summary
DLPRule()
          Create a default rule.
DLPRule(DLPRule other)
          creates new rule which prepare to change its content, based on a existed rule.
DLPRule(int maxHead, int maxBody)
          An user defined rule with prospective body and head length.
 
Method Summary
 void addBodies(java.util.Collection<DLPLiteral> lits)
           
 void addBody(DLPLiteral l)
          add a literal to body
 void addHead(DLPLiteral l)
          add a literal to head
protected  java.lang.String dumpLiteralList(java.util.ArrayList<DLPLiteral> ll, java.lang.String sep)
          internal helper function to dump a list of literals
 java.util.ArrayList<DLPLiteral> getBodies()
           
 DLPLiteral getBody(int i)
          returns the i-literal in Body
 DLPLiteral getHead(int i)
          returns the i-literal in head
 boolean isConjunctive()
          indicated whether there is one more literals in the read of the rule.
 boolean isConstraint()
          returns true if the rule is a constraint (no head literals) and at least one literal(it is indifferently true or negative or strict negative)
 boolean isDisjunctive()
          indicated whether there is one more literals in the read of the rule.
 boolean isFact()
          returns true whether the rule has only one or more literal for head and they are facts, but no body literals.
 boolean isRule()
          returns true if it is a complete rule what means at least one literal for body and one for head
 int nBody()
          returns the size of body, including arithmetical expressions.
 int nHead()
          returns the size of head
 void resolve()
          overview during parse.
 void resolvedConstraint()
           
 void resolvedFact()
           
 void resolvedRule()
           
protected  java.lang.String toDlpString()
           
 
Methods inherited from class edu.udo.cs.ie.cowbots.logic.ELPRule
addBody, addBody, addHead, dumpLitList, getBody, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

head

java.util.ArrayList<DLPLiteral> head

body

java.util.ArrayList<DLPLiteral> body
Constructor Detail

DLPRule

public DLPRule()
Create a default rule.

See Also:
DLPRule

DLPRule

public DLPRule(int maxHead,
               int maxBody)
An user defined rule with prospective body and head length.

Parameters:
maxHead - Integer
maxBody - Integer
See Also:
DLPRule

DLPRule

public DLPRule(DLPRule other)
creates new rule which prepare to change its content, based on a existed rule.

Parameters:
other - rule to copy DLPRule
Method Detail

isFact

public boolean isFact()
returns true whether the rule has only one or more literal for head and they are facts, but no body literals.

Overrides:
isFact in class ELPRule
Returns:
Boolean DLPLiteral

isConstraint

public boolean isConstraint()
returns true if the rule is a constraint (no head literals) and at least one literal(it is indifferently true or negative or strict negative)

Overrides:
isConstraint in class ELPRule
Returns:
Boolean

isRule

public boolean isRule()
returns true if it is a complete rule what means at least one literal for body and one for head

Returns:
Boolean

isDisjunctive

public boolean isDisjunctive()
indicated whether there is one more literals in the read of the rule.

Overrides:
isDisjunctive in class ELPRule
Returns:
Boolean

isConjunctive

public boolean isConjunctive()
indicated whether there is one more literals in the read of the rule.

Returns:
Boolean

addHead

public void addHead(DLPLiteral l)
add a literal to head

Parameters:
l - DLPLiteral

addBody

public void addBody(DLPLiteral l)
add a literal to body

Parameters:
l - DLPLiteral

getBodies

public java.util.ArrayList<DLPLiteral> getBodies()

addBodies

public void addBodies(java.util.Collection<DLPLiteral> lits)

resolve

public void resolve()
overview during parse.


resolvedFact

public void resolvedFact()
See Also:
DLPRule#resolve()}

resolvedConstraint

public void resolvedConstraint()
See Also:
DLPRule#resolve()}

resolvedRule

public void resolvedRule()
See Also:
DLPRule#resolve()}

toDlpString

protected java.lang.String toDlpString()
See Also:
ELPRule#toString()}

dumpLiteralList

protected java.lang.String dumpLiteralList(java.util.ArrayList<DLPLiteral> ll,
                                           java.lang.String sep)
internal helper function to dump a list of literals

Parameters:
ll - list of literals
sep - literal separator string
Returns:
present one line rule string

nHead

public int nHead()
returns the size of head

Overrides:
nHead in class ELPRule
Returns:
number of head literals

nBody

public int nBody()
returns the size of body, including arithmetical expressions.

Overrides:
nBody in class ELPRule
Returns:
number of body literals Integer

getHead

public DLPLiteral getHead(int i)
returns the i-literal in head

Overrides:
getHead in class ELPRule
Parameters:
literal - index Integer
Returns:
i-literal in head DLPLiteral

getBody

public DLPLiteral getBody(int i)
returns the i-literal in Body

Overrides:
getBody in class ELPRule
Parameters:
literal - index Integer
Returns:
i-literal in body DLPLiteral