Modifier and Type | Method and Description |
---|---|
static ContextSerializerText |
getInstance()
Return the singleton instance of this class.
|
void |
read(Context context,
BufferedReader file)
Read a context from a file.
|
static void |
register()
Register this class for reading and writing .txt files.
|
void |
write(Context context,
BufferedWriter file)
Write a context to a file.
|
public static ContextSerializerText getInstance()
Return the singleton instance of this class.
public static void register()
Register this class for reading and writing .txt files.
public void read(Context context, BufferedReader file) throws IOException
Read a context from a file.
The following format is respected:
The list of observations separated by a space on the first line ; the list of attrbutes separated by a space on the second line ; then, for each observations o, the list of its intent on a line, written like o a1 a2 …
Observations: 1 2 3
Attributes: a b c d e
1: a c
2: a b
3: b d e
4: c e
read
in interface Reader<Context>
context
- a context to readfile
- a fileIOException
- When an IOException occurspublic void write(Context context, BufferedWriter file) throws IOException
Write a context to a file.
The following format is respected:
The list of observations separated by a space on the first line ; the list of attrbutes separated by a space on the second line ; then, for each observations o, the list of its intent on a line, written like o a1 a2 …
Observations: 1 2 3
Attributes: a b c d e
1: a c
2: a b
3: b d e
4: c e
write
in interface Writer<Context>
context
- a context to writefile
- a fileIOException
- When an IOException occursCopyright © 2010–2016 The Galactic Organization. All rights reserved.