Package ca.uqac.lif.cep.fol
Class Interpretation
- java.lang.Object
-
- ca.uqac.lif.cep.fol.Interpretation
-
public class Interpretation extends java.lang.Object
A context in which predicates can be evaluated.An Interpretation implements the corresponding concept from first-order logic. It defines sets of values, each associated with a name, called the domains. It also defines a set of predicates, each.
- Author:
- Sylvain Hallé
-
-
Constructor Summary
Constructors Constructor Description Interpretation()
Creates a new empty interpretationInterpretation(Interpretation inter)
Creates a copy of an interpretationInterpretation(java.util.Map<java.lang.String,java.util.Set<java.lang.Object>> domains, java.util.Map<java.lang.String,Predicate> predicates)
Creates a new interpretation
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPredicate(Predicate p)
Adds a new predicate to this interpretationvoid
addPredicateTuple(PredicateTuple tuple)
Adds a new predicate tuple to the definition of some predicate.void
addToDomain(java.lang.String domain_name, java.lang.Object value)
Adds a new value to a domainvoid
clear()
Clears this interpretation of all predicate and domain definitionsboolean
containsPredicate(java.lang.String name)
Checks if this interpretation contains a predicate with given namejava.util.Set<java.lang.Object>
getDomain(java.lang.String domain_name)
Gets the set of values of the given domainPredicate
getPredicate(java.lang.String name)
Gets the predicate instance of given name
-
-
-
Constructor Detail
-
Interpretation
public Interpretation()
Creates a new empty interpretation
-
Interpretation
public Interpretation(java.util.Map<java.lang.String,java.util.Set<java.lang.Object>> domains, java.util.Map<java.lang.String,Predicate> predicates)
Creates a new interpretation- Parameters:
domains
- The domains defined for this interpretation. The key of this map is the name of each domain, and the corresponding value is the set of values in this domain.predicates
- The predicates defined for this interpretation. The key of this map is the name of each predicate, and the value is the correspondingPredicate
object.
-
Interpretation
public Interpretation(Interpretation inter)
Creates a copy of an interpretation- Parameters:
inter
- The interpretation to copy
-
-
Method Detail
-
getDomain
public java.util.Set<java.lang.Object> getDomain(java.lang.String domain_name)
Gets the set of values of the given domain- Parameters:
domain_name
- The name of the domain- Returns:
- The set of values. An empty set is returned if no
domain with given name exists, or if
domain_name
is null.
-
addToDomain
public void addToDomain(java.lang.String domain_name, java.lang.Object value)
Adds a new value to a domain- Parameters:
domain_name
- The name of the domainvalue
- The value to add
-
addPredicateTuple
public void addPredicateTuple(PredicateTuple tuple)
Adds a new predicate tuple to the definition of some predicate. This also updates the domains- Parameters:
tuple
- The tuple to add
-
addPredicate
public void addPredicate(Predicate p)
Adds a new predicate to this interpretation- Parameters:
p
- The predicate to add
-
clear
public void clear()
Clears this interpretation of all predicate and domain definitions
-
containsPredicate
public boolean containsPredicate(java.lang.String name)
Checks if this interpretation contains a predicate with given name- Parameters:
name
- The predicate name- Returns:
true
if the interpretation contains such a predicate,false
otherwise
-
getPredicate
public Predicate getPredicate(java.lang.String name)
Gets the predicate instance of given name- Parameters:
name
- The predicate name- Returns:
- The predicate, or
null
if no predicate exists with this name
-
-