Class AbstractDungParser
java.lang.Object
org.tweetyproject.commons.Parser<DungTheory,Formula>
org.tweetyproject.arg.dung.parser.AbstractDungParser
- Direct Known Subclasses:
ApxParser
,CnfParser
,Iccma23Parser
,TgfParser
This abstract class gives a template for parsers of files representing
abstract argumentation frameworks. The file is parsed into the TweetyProject format
for abstract argumentation frameworks.
- Author:
- Matthias Thimm
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic AbstractDungParser
Retrieves the parser for the given file format.abstract DungTheory
Parses the given file into an abstract argumentation frameworkstatic Extension
Returns a collection view of the given set of argumentsparseBeliefBase
(Reader reader) Parses the given reader into a belief base of the given type.static boolean
Parses the given string (either "YES" or "NO") to a boolean value.static Collection<Collection<Argument>>
Returns a collection view of the given set of extensions (=sets of arguments)parseFormula
(Reader reader) Parses the given reader into a formula of the given type.static DungTheory
Parses a representation of the form "\lt; {a,b,c},[(a,b),(b,c)]\gt;" which is given by DungTheory.toString();static Labeling
Returns a labeling parsed from the given stringstatic Collection<Labeling>
Returns a collection view of the given set of labelingsMethods inherited from class org.tweetyproject.commons.Parser
isNumeric, parseBeliefBase, parseBeliefBaseFromFile, parseFormula, parseFormulaFromFile, parseListOfBeliefBases, parseListOfBeliefBases, parseListOfBeliefBasesFromFile, parseListOfBeliefBasesFromFile
-
Constructor Details
-
AbstractDungParser
public AbstractDungParser()Default constructor
-
-
Method Details
-
getParser
Retrieves the parser for the given file format.- Parameters:
f
- some file format- Returns:
- a parser or null if the format is not supported.
-
parseBeliefBase
Description copied from class:Parser
Parses the given reader into a belief base of the given type.- Specified by:
parseBeliefBase
in classParser<DungTheory,
Formula> - Parameters:
reader
- a reader- Returns:
- a belief base
- Throws:
IOException
- if some IO issue occurred.ParserException
- some parsing exceptions may be added here.
-
parseFormula
Description copied from class:Parser
Parses the given reader into a formula of the given type.- Specified by:
parseFormula
in classParser<DungTheory,
Formula> - Parameters:
reader
- a reader- Returns:
- a formula
- Throws:
IOException
- if some IO issue occurred.ParserException
- some parsing exceptions may be added here.
-
parseArgumentList
Returns a collection view of the given set of arguments- Parameters:
s
- some string in the format "[arg1,...,argn]".- Returns:
- a collection view of the given arguments
-
parseExtensionList
Returns a collection view of the given set of extensions (=sets of arguments)- Parameters:
s
- some string in the format "[[arg1,...,argn],...,[arg1,...,argn]]".- Returns:
- a collection view of the given set of extensions
-
parseLabelingList
Returns a collection view of the given set of labelings- Parameters:
s
- some string in the format "[[IN1,...,INM],[OUT1,...,OUTN],[UNDEC1,...,UNDECM]]\n...[[IN1,...,INM],[OUT1,...,OUTN],[UNDEC1,...,UNDECM]]".- Returns:
- a collection view of the given set of labelings
-
parseBoolean
Parses the given string (either "YES" or "NO") to a boolean value.- Parameters:
s
- some string (either "YES" or "NO")- Returns:
- a boolean representing the string.
-
parseLabeling
Returns a labeling parsed from the given string- Parameters:
s
- some string in the format [[IN1,...,INM],[OUT1,...,OUTN],[UNDEC1,...,UNDECM]]- Returns:
- a labeling.
-
parseJavaStringRepresentation
Parses a representation of the form "\lt; {a,b,c},[(a,b),(b,c)]\gt;" which is given by DungTheory.toString();- Parameters:
str
- some String- Returns:
- the Dung theory represented by str
-
parse
Parses the given file into an abstract argumentation framework- Parameters:
reader
- some reader- Returns:
- an abstract argumentation framework
- Throws:
IOException
- for all errors concerning file reading.
-