Class AbstractDungParser

java.lang.Object
org.tweetyproject.commons.Parser<DungTheory,Formula>
org.tweetyproject.arg.dung.parser.AbstractDungParser
Direct Known Subclasses:
ApxParser, CnfParser, Iccma23Parser, 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 TweetyProject format for abstract argumentation frameworks.
Author:
Matthias Thimm
  • Constructor Details

    • AbstractDungParser

      public AbstractDungParser()
  • Method Details

    • 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, 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:
      IOException - if some IO issue occurred.
      ParserException - some parsing exceptions may be added here.
    • parseFormula

      public Formula parseFormula(Reader reader) throws 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:
      IOException - if some IO issue occurred.
      ParserException - some parsing exceptions may be added here.
    • 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.
    • parseJavaStringRepresentation

      public static DungTheory parseJavaStringRepresentation(String str)
      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

      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.