Class CLaw
java.lang.Object
org.tweetyproject.action.description.syntax.CLaw
- Direct Known Subclasses:
DynamicLaw
,StaticLaw
The action description language C consists of two distinct expressions:
static laws and dynamic laws. Both share some common functionalities which
are implemented in this base class.
- Author:
- Sebastian Homann
-
Constructor Summary
ConstructorDescriptionCLaw()
Creates an empty causal law.CLaw
(FolFormula headFormula) Creates a causal law of the form "caused headFormula if True"CLaw
(FolFormula headFormula, Set<GroundingRequirement> requirements) Creates a causal law of the form "caused headFormula if True requires requirements"CLaw
(FolFormula headFormula, FolFormula ifFormula) Creates a causal law of the form "caused headFormula if ifFormula"CLaw
(FolFormula headFormula, FolFormula ifFormula, Set<GroundingRequirement> requirements) Creates a causal law of the form "caused headFormula if ifFormula requires requirements" -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a grounding requirement to this CLaw.Retrieves the set of all grounded instances of this causal law.getAtoms()
Retrieves the set of propositions (atoms) contained in all formulas within this law.abstract Set
<FolFormula> Returns the set of formulas contained in this causal law, e.g.Retrieves the head formula of this causal law.Retrieves the conditional (if) formula of this causal law.abstract Signature
Returns the signature of the language of this formula.abstract boolean
Returns true iff this law is definite.boolean
isGround()
Checks if the CLaw is ground, i.e., if all the atoms in the CLaw are ground.Returns an equivalent definite causal law.
-
Constructor Details
-
CLaw
public CLaw()Creates an empty causal law. -
CLaw
Creates a causal law of the form "caused headFormula if True"- Parameters:
headFormula
- some FOL formula
-
CLaw
Creates a causal law of the form "caused headFormula if True requires requirements"- Parameters:
headFormula
- some FOL formularequirements
- a set of requirements
-
CLaw
Creates a causal law of the form "caused headFormula if ifFormula requires requirements"- Parameters:
headFormula
- some FOL formulaifFormula
- some FOL formularequirements
- a set of requirements
-
CLaw
Creates a causal law of the form "caused headFormula if ifFormula"- Parameters:
headFormula
- some FOL formulaifFormula
- some FOL formula
-
-
Method Details
-
getSignature
Description copied from interface:Formula
Returns the signature of the language of this formula.- Specified by:
getSignature
in interfaceFormula
- Returns:
- the signature of the language of this formula.
-
isDefinite
public abstract boolean isDefinite()Returns true iff this law is definite. A causal law is definite if it's head is a literal or a contradiction and all formulas are conjunctions of literals.- Returns:
- true, if this law is definite, false otherwise.
-
toDefinite
Returns an equivalent definite causal law. A causal law is definite if it's head is a literal or a contradiction and all formulas are conjunctions of literals.- Returns:
- the equivalent definite causal law if one exists.
- Throws:
IllegalStateException
- when there is no equivalent definite causal law.
-
getAtoms
-
getFormulas
Returns the set of formulas contained in this causal law, e.g. in a static law, this contains the head formula and the if formula.- Returns:
- the set of formulas contained in this causal law.
-
addGroundingRequirement
Adds a grounding requirement to this CLaw.- Parameters:
c
- the grounding requirement to be added
-
getHeadFormula
Retrieves the head formula of this causal law.- Returns:
- the `FolFormula` that constitutes the head of this causal law.
-
getIfFormula
Retrieves the conditional (if) formula of this causal law.- Returns:
- the `FolFormula` that constitutes the condition (if clause) of this causal law.
-
isGround
public boolean isGround()Checks if the CLaw is ground, i.e., if all the atoms in the CLaw are ground.- Returns:
- true if the CLaw is ground, false otherwise.
-
getAllGrounded
-