Package net.sf.tweety.arg.dung.parser
Class AbstractDungParser
- java.lang.Object
-
- net.sf.tweety.commons.Parser<DungTheory,net.sf.tweety.commons.Formula>
-
- net.sf.tweety.arg.dung.parser.AbstractDungParser
-
public abstract class AbstractDungParser extends net.sf.tweety.commons.Parser<DungTheory,net.sf.tweety.commons.Formula>
This abstract class gives a template for parsers of files representing abstract argumentation frameworks. The file is parsed into the Tweety format for abstract argumentation frameworks.- Author:
- Matthias Thimm
-
-
Constructor Summary
Constructors Constructor Description AbstractDungParser()
-
Method Summary
Modifier and Type Method Description static AbstractDungParsergetParser(FileFormat f)Retrieves the parser for the given file format.abstract DungTheoryparse(Reader reader)Parses the given file into an abstract argumentation frameworkstatic ExtensionparseArgumentList(String s)Returns a collection view of the given set of argumentsDungTheoryparseBeliefBase(Reader reader)static booleanparseBoolean(String s)Parses the given string (either "YES" or "NO") to a boolean value.static Collection<Collection<Argument>>parseExtensionList(String s)Returns a collection view of the given set of extensions (=sets of arguments)net.sf.tweety.commons.FormulaparseFormula(Reader reader)static LabelingparseLabeling(String s)Returns a labeling parsed from the given stringstatic Collection<Labeling>parseLabelingList(String s)Returns a collection view of the given set of labelings
-
-
-
Method Detail
-
getParser
public static AbstractDungParser getParser(FileFormat f)
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
public DungTheory parseBeliefBase(Reader reader) throws IOException, net.sf.tweety.commons.ParserException
- Specified by:
parseBeliefBasein classnet.sf.tweety.commons.Parser<DungTheory,net.sf.tweety.commons.Formula>- Throws:
IOExceptionnet.sf.tweety.commons.ParserException
-
parseFormula
public net.sf.tweety.commons.Formula parseFormula(Reader reader) throws IOException, net.sf.tweety.commons.ParserException
- Specified by:
parseFormulain classnet.sf.tweety.commons.Parser<DungTheory,net.sf.tweety.commons.Formula>- Throws:
IOExceptionnet.sf.tweety.commons.ParserException
-
parseArgumentList
public static Extension parseArgumentList(String s)
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
public static Collection<Collection<Argument>> parseExtensionList(String s)
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
public static Collection<Labeling> parseLabelingList(String s)
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
public static boolean parseBoolean(String s)
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
public static Labeling parseLabeling(String s)
Returns a labeling parsed from the given string- Parameters:
s- some string in the format [[IN1,...,INM],[OUT1,...,OUTN],[UNDEC1,...,UNDECM]]- Returns:
- a labeling.
-
parse
public abstract DungTheory parse(Reader reader) throws IOException
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.
-
-