Class AbstractDungParser

  • Direct Known Subclasses:
    ApxParser, CnfParser, TgfParser

    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 Detail

      • AbstractDungParser

        public AbstractDungParser()
    • 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:
        parseBeliefBase in class net.sf.tweety.commons.Parser<DungTheory,​net.sf.tweety.commons.Formula>
        Throws:
        IOException
        net.sf.tweety.commons.ParserException
      • parseFormula

        public net.sf.tweety.commons.Formula parseFormula​(Reader reader)
                                                   throws IOException,
                                                          net.sf.tweety.commons.ParserException
        Specified by:
        parseFormula in class net.sf.tweety.commons.Parser<DungTheory,​net.sf.tweety.commons.Formula>
        Throws:
        IOException
        net.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.