public class FactSet extends Object
The facts are stored as SimpleSentence
in a Map
sorted by
name.
Modifier and Type | Field and Description |
---|---|
private Map<String,List<SimpleSentence>> |
facts |
Constructor and Description |
---|
FactSet(Map<String,List<SimpleSentence>> facts)
Constructor of the class.
|
FactSet(SimpleSentence... facts)
Constructor of the class.
|
Modifier and Type | Method and Description |
---|---|
void |
addFact(SimpleSentence fact)
Adds the specified fact to the set, if the fact is not already true
according to the method
isTrue() . |
List<SimpleSentence> |
getFact(String name)
Gets the facts corresponding to the name of the parameter.
|
Map<String,List<SimpleSentence>> |
getFacts()
Gets the facts.
|
boolean |
isTrue(Unifiable fact)
Checks if the specified fact can be made true in the set.
|
void |
removeFacts(Unifiable fact)
Removes the fact specified in the parameter.
|
RuleSet |
toRuleSet()
Creates a
RuleSet object containing the facts as its rules. |
String |
toString()
Returns the set in the form of:
"Facts: {factName=[factsOfThisName], otherName=[othersFacts]}".
|
private Map<String,List<SimpleSentence>> facts
public FactSet(SimpleSentence... facts)
facts
- an array of the facts to be stored in the set or each fact as
a parameter.public FactSet(Map<String,List<SimpleSentence>> facts)
facts
- an array of the facts to be stored in the set or each fact as
a parameter.public Map<String,List<SimpleSentence>> getFacts()
Map
containing all the facts.public List<SimpleSentence> getFact(String name)
name
- the name of the facts to get.List
of the facts of the name name
existing in the set.public void removeFacts(Unifiable fact)
fact
- the fact to remove.public boolean isTrue(Unifiable fact)
The test is done thanks to the
equal()
function.
fact
- that is checked if it is true in the set.public void addFact(SimpleSentence fact)
isTrue()
.fact
- to add in the set.public RuleSet toRuleSet()
RuleSet
object containing the facts as its rules.RuleSet
containing the facts.public String toString()
toString
in class Object
Object.toString()