Class AnswerSet
- java.lang.Object
 - 
- org.tweetyproject.commons.AbstractInterpretation<B,S>
 - 
- org.tweetyproject.commons.InterpretationSet<ASPLiteral,Program,ASPRule>
 - 
- org.tweetyproject.lp.asp.semantics.AnswerSet
 
 
 
 
- 
- All Implemented Interfaces:
 java.lang.Iterable<ASPLiteral>,java.util.Collection<ASPLiteral>,Interpretation<Program,ASPRule>
public class AnswerSet extends InterpretationSet<ASPLiteral,Program,ASPRule>
An answer set is a belief set which only contains literals and represents the deductive belief set of an extended logic program under the answer set semantic.- Author:
 - Thomas Vengels, Tim Janus, Anna Gessler
 
 
- 
- 
Constructor Summary
Constructors Constructor Description AnswerSet()Creates a new empty AnswerSet.AnswerSet(java.util.Collection<ASPLiteral> lits, int level, int weight)Creates a new empty AnswerSet with the given level and weight.AnswerSet(AnswerSet other)Copy-Constructor 
- 
Method Summary
Modifier and Type Method Description java.lang.Objectclone()java.util.Set<ASPLiteral>getLiteralsWithName(java.lang.String name)Returns all literals of a given name in the AnswerSet.booleansatisfies(ASPRule formula)Checks whether this interpretation satisfies the given formula.booleansatisfies(Program beliefBase)Checks whether this interpretation satisfies the given knowledge base.java.lang.StringtoString()- 
Methods inherited from class org.tweetyproject.commons.InterpretationSet
add, add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray 
- 
Methods inherited from class org.tweetyproject.commons.AbstractInterpretation
satisfies 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
AnswerSet
public AnswerSet()
Creates a new empty AnswerSet. 
- 
AnswerSet
public AnswerSet(java.util.Collection<ASPLiteral> lits, int level, int weight)
Creates a new empty AnswerSet with the given level and weight.- Parameters:
 lits- the literalslevel- the levelweight- the weight
 
- 
AnswerSet
public AnswerSet(AnswerSet other)
Copy-Constructor- Parameters:
 other- another answer set
 
 - 
 
- 
Method Detail
- 
getLiteralsWithName
public java.util.Set<ASPLiteral> getLiteralsWithName(java.lang.String name)
Returns all literals of a given name in the AnswerSet.- Parameters:
 name- the name of the literal- Returns:
 - set of literals
 
 
- 
toString
public java.lang.String toString()
- Overrides:
 toStringin classInterpretationSet<ASPLiteral,Program,ASPRule>
 
- 
clone
public java.lang.Object clone()
 
- 
satisfies
public boolean satisfies(Program beliefBase) throws java.lang.IllegalArgumentException
Description copied from interface:InterpretationChecks whether this interpretation satisfies the given knowledge base.- Parameters:
 beliefBase- a knowledge base.- Returns:
 - "true" if this interpretation satisfies the given knowledge base.
 - Throws:
 java.lang.IllegalArgumentException- IllegalArgumentException if the knowledgebase does not correspond to the expected language.
 
- 
satisfies
public boolean satisfies(ASPRule formula) throws java.lang.IllegalArgumentException
Description copied from interface:InterpretationChecks whether this interpretation satisfies the given formula.- Parameters:
 formula- a formula .- Returns:
 - "true" if this interpretation satisfies the given formula.
 - Throws:
 java.lang.IllegalArgumentException- if the formula does not correspond to the expected language.
 
 - 
 
 -