Package net.sf.tweety.arg.aba.parser
Class AbaParser<T extends Formula>
- java.lang.Object
-
- net.sf.tweety.commons.Parser<AbaTheory<T>,Formula>
-
- net.sf.tweety.arg.aba.parser.AbaParser<T>
-
- Type Parameters:
T- the type of formulas (language) that the ABA theory ranges over
public class AbaParser<T extends Formula> extends Parser<AbaTheory<T>,Formula>
Parses a Assumption Based Argumentation System out of an input text. With standard symbols, every line contains one of the following:
<rule> ::= <head> '<-' <body>?
<head> ::= <word>
<body> ::= 'true' | <word> (',' <word>)*
<assumption> ::= <word>
<assumptions> ::= '{' <assumption> (',' <assumption>)* '}'
with <word> in the theory's language.- Author:
- Nils Geilen
-
-
Field Summary
Fields Modifier and Type Field Description private Parser<? extends BeliefBase,? extends Formula>formulaparserUsed to parse formulaeprivate java.lang.StringsymbolArrowSymbols used for parsing rules.private java.lang.StringsymbolCommaSymbols used for parsing rules.private java.lang.StringsymbolTrueSymbols used for parsing rules.
-
Constructor Summary
Constructors Constructor Description AbaParser(Parser<? extends BeliefBase,? extends Formula> formulaparser)Creates a new ABA parser
-
Method Summary
Modifier and Type Method Description java.lang.StringgetSymbolArrow()java.lang.StringgetSymbolComma()java.lang.StringgetSymbolTrue()AbaTheory<T>parseBeliefBase(java.io.Reader reader)Parses the given reader into a belief base of the given type.FormulaparseFormula(java.io.Reader reader)Parses the given reader into a formula of the given type.voidsetSymbolArrow(java.lang.String symbolArrow)voidsetSymbolComma(java.lang.String symbolComma)voidsetSymbolTrue(java.lang.String symbolTrue)-
Methods inherited from class net.sf.tweety.commons.Parser
isNumeric, parseBeliefBase, parseBeliefBaseFromFile, parseFormula, parseFormulaFromFile
-
-
-
-
Field Detail
-
formulaparser
private final Parser<? extends BeliefBase,? extends Formula> formulaparser
Used to parse formulae
-
symbolTrue
private java.lang.String symbolTrue
Symbols used for parsing rules. Note: symbolComma is used for separating assumption declarations. When using a fol-based parser, use a different symbolComma because otherwise the commas in fol formulas will cause errors.
-
symbolArrow
private java.lang.String symbolArrow
Symbols used for parsing rules. Note: symbolComma is used for separating assumption declarations. When using a fol-based parser, use a different symbolComma because otherwise the commas in fol formulas will cause errors.
-
symbolComma
private java.lang.String symbolComma
Symbols used for parsing rules. Note: symbolComma is used for separating assumption declarations. When using a fol-based parser, use a different symbolComma because otherwise the commas in fol formulas will cause errors.
-
-
Constructor Detail
-
AbaParser
public AbaParser(Parser<? extends BeliefBase,? extends Formula> formulaparser)
Creates a new ABA parser- Parameters:
formulaparser- parses formulae of the language
-
-
Method Detail
-
parseBeliefBase
public AbaTheory<T> 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<AbaTheory<T extends Formula>,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<AbaTheory<T extends Formula>,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.
-
getSymbolTrue
public java.lang.String getSymbolTrue()
- Returns:
- the symbolTrue
-
setSymbolTrue
public void setSymbolTrue(java.lang.String symbolTrue)
- Parameters:
symbolTrue- the symbolTrue to set
-
getSymbolArrow
public java.lang.String getSymbolArrow()
- Returns:
- the symbolArrow
-
setSymbolArrow
public void setSymbolArrow(java.lang.String symbolArrow)
- Parameters:
symbolArrow- the symbolArrow to set
-
getSymbolComma
public java.lang.String getSymbolComma()
- Returns:
- the symbolComma
-
setSymbolComma
public void setSymbolComma(java.lang.String symbolComma)
- Parameters:
symbolComma- the symbolComma to set
-
-