Package net.sf.tweety.preferences.io
Class UPParser
- java.lang.Object
-
- net.sf.tweety.preferences.io.UPParser
-
- All Implemented Interfaces:
UPParserConstants
public class UPParser extends java.lang.Object implements UPParserConstants
Update Parser for reading updates for dynamic Preference Aggregation Please note: update file syntax changed from (index, operation, amount, element) e.g. (1, WEAKEN, 2, a) to (index, operation(amount), element) e.g. (1, -2, a) where -(/+) is equal to WEAKEN(/STRENGTHEN) and 2 is the amount
-
-
Field Summary
Fields Modifier and Type Field Description Token
jj_nt
Next token.Token
token
Current token.UPParserTokenManager
token_source
Generated Token Manager.-
Fields inherited from interface net.sf.tweety.preferences.io.UPParserConstants
DEFAULT, ELEMENT, EOF, EOL, INDEX, LBRA, OPERATION, RBRA, tokenImage
-
-
Constructor Summary
Constructors Constructor Description UPParser()
UPParser(java.io.InputStream stream)
Constructor with InputStream.UPParser(java.io.InputStream stream, java.lang.String encoding)
Constructor with InputStream and supplied encodingUPParser(java.io.Reader stream)
Constructor.UPParser(UPParserTokenManager tm)
Constructor with generated Token Manager.
-
Method Summary
Modifier and Type Method Description void
disable_tracing()
Disable tracing.void
enable_tracing()
Enable tracing.ParseException
generateParseException()
Generate ParseException.Token
getNextToken()
Get the next Token.Token
getToken(int index)
Get the specific Token.java.util.ArrayList<Update<java.lang.String>>
getUpdate()
static void
main(java.lang.String[] args)
static java.util.ArrayList<Update<java.lang.String>>
parse(java.lang.String updatefile)
void
ReInit(java.io.InputStream stream)
Reinitialise.void
ReInit(java.io.InputStream stream, java.lang.String encoding)
Reinitialise.void
ReInit(java.io.Reader stream)
Reinitialise.void
ReInit(UPParserTokenManager tm)
Reinitialise.
-
-
-
Field Detail
-
token_source
public UPParserTokenManager token_source
Generated Token Manager.
-
token
public Token token
Current token.
-
jj_nt
public Token jj_nt
Next token.
-
-
Constructor Detail
-
UPParser
public UPParser()
-
UPParser
public UPParser(java.io.InputStream stream)
Constructor with InputStream.
-
UPParser
public UPParser(java.io.InputStream stream, java.lang.String encoding)
Constructor with InputStream and supplied encoding
-
UPParser
public UPParser(java.io.Reader stream)
Constructor.
-
UPParser
public UPParser(UPParserTokenManager tm)
Constructor with generated Token Manager.
-
-
Method Detail
-
parse
public static java.util.ArrayList<Update<java.lang.String>> parse(java.lang.String updatefile) throws ParseException, java.io.FileNotFoundException
- Throws:
ParseException
java.io.FileNotFoundException
-
main
public static void main(java.lang.String[] args) throws ParseException
- Throws:
ParseException
-
getUpdate
public final java.util.ArrayList<Update<java.lang.String>> getUpdate() throws ParseException, java.io.FileNotFoundException
- Throws:
ParseException
java.io.FileNotFoundException
-
ReInit
public void ReInit(java.io.InputStream stream)
Reinitialise.
-
ReInit
public void ReInit(java.io.InputStream stream, java.lang.String encoding)
Reinitialise.
-
ReInit
public void ReInit(java.io.Reader stream)
Reinitialise.
-
ReInit
public void ReInit(UPParserTokenManager tm)
Reinitialise.
-
getNextToken
public final Token getNextToken()
Get the next Token.
-
getToken
public final Token getToken(int index)
Get the specific Token.
-
generateParseException
public ParseException generateParseException()
Generate ParseException.
-
enable_tracing
public final void enable_tracing()
Enable tracing.
-
disable_tracing
public final void disable_tracing()
Disable tracing.
-
-