Package net.sf.tweety.arg.dung.parser
Class AbstractDungParser
- java.lang.Object
-
- net.sf.tweety.commons.Parser<DungTheory,Formula>
-
- net.sf.tweety.arg.dung.parser.AbstractDungParser
-
public abstract class AbstractDungParser extends Parser<DungTheory,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(java.io.Reader reader)Parses the given file into an abstract argumentation frameworkstatic ExtensionparseArgumentList(java.lang.String s)Returns a collection view of the given set of argumentsDungTheoryparseBeliefBase(java.io.Reader reader)Parses the given reader into a belief base of the given type.static booleanparseBoolean(java.lang.String s)Parses the given string (either "YES" or "NO") to a boolean value.static java.util.Collection<java.util.Collection<Argument>>parseExtensionList(java.lang.String s)Returns a collection view of the given set of extensions (=sets of arguments)FormulaparseFormula(java.io.Reader reader)Parses the given reader into a formula of the given type.static LabelingparseLabeling(java.lang.String s)Returns a labeling parsed from the given stringstatic java.util.Collection<Labeling>parseLabelingList(java.lang.String s)Returns a collection view of the given set of labelings-
Methods inherited from class net.sf.tweety.commons.Parser
isNumeric, parseBeliefBase, parseBeliefBaseFromFile, parseFormula, parseFormulaFromFile
-
-
-
-
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(java.io.Reader reader) throws java.io.IOException, ParserException
Description copied from class:ParserParses the given reader into a belief base of the given type.- Specified by:
parseBeliefBasein classParser<DungTheory,Formula>- Parameters:
reader- a reader- Returns:
- a belief base
- Throws:
java.io.IOException- if some IO issue occurred.ParserException- some parsing exceptions may be added here.
-
parseFormula
public Formula parseFormula(java.io.Reader reader) throws java.io.IOException, ParserException
Description copied from class:ParserParses the given reader into a formula of the given type.- Specified by:
parseFormulain classParser<DungTheory,Formula>- Parameters:
reader- a reader- Returns:
- a formula
- Throws:
java.io.IOException- if some IO issue occurred.ParserException- some parsing exceptions may be added here.
-
parseArgumentList
public static Extension parseArgumentList(java.lang.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 java.util.Collection<java.util.Collection<Argument>> parseExtensionList(java.lang.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 java.util.Collection<Labeling> parseLabelingList(java.lang.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(java.lang.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(java.lang.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(java.io.Reader reader) throws java.io.IOException
Parses the given file into an abstract argumentation framework- Parameters:
reader- some reader- Returns:
- an abstract argumentation framework
- Throws:
java.io.IOException- for all errors concerning file reading.
-
-