Class AbstractDungParser

  • Direct Known Subclasses:
    ApxParser, CnfParser, TgfParser

    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
    • Method Summary

      Modifier and Type Method Description
      static AbstractDungParser getParser​(FileFormat f)
      Retrieves the parser for the given file format.
      abstract DungTheory parse​(java.io.Reader reader)
      Parses the given file into an abstract argumentation framework
      static Extension parseArgumentList​(java.lang.String s)
      Returns a collection view of the given set of arguments
      DungTheory parseBeliefBase​(java.io.Reader reader)
      Parses the given reader into a belief base of the given type.
      static boolean parseBoolean​(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)
      Formula parseFormula​(java.io.Reader reader)
      Parses the given reader into a formula of the given type.
      static Labeling parseLabeling​(java.lang.String s)
      Returns a labeling parsed from the given string
      static java.util.Collection<Labeling> parseLabelingList​(java.lang.String s)
      Returns a collection view of the given set of labelings
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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​(java.io.Reader reader)
                                   throws java.io.IOException,
                                          ParserException
        Description copied from class: Parser
        Parses the given reader into a belief base of the given type.
        Specified by:
        parseBeliefBase in class Parser<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: Parser
        Parses the given reader into a formula of the given type.
        Specified by:
        parseFormula in class Parser<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.