Modifier and Type | Method and Description |
---|---|
static ContextSerializerSLF |
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 .slf files.
|
void |
write(Context context,
BufferedWriter file)
Write a context to a file.
|
public static ContextSerializerSLF getINSTANCE()
Return the singleton INSTANCE of this class.
public static void register()
Register this class for reading and writing .slf files.
public void read(Context context, BufferedReader file) throws IOException
Read a context from a file.
The following format is respected:
The number of objects and observation on two separated lines The list of objects on seprated lines The list of attributes on separated lines
then, for each observations, the list of its intent on a line, written like 0 1 0
[Lattice]
2
3
[Objects]
1 2
[Attributes]
a b c
[relation]
0 1 0
1 1 0
read
in interface Reader<Context>
context
- a context to readfile
- a fileIOException
- When an IOException occurs
use StreamTokenizer
public void write(Context context, BufferedWriter file) throws IOException
Write a context to a file.
The Standard Lattice Format SLF format file is respected :
The following format is respected:
The number of objects and observation on two separated lines The list of objects on seprated lines The list of attributes on separated lines
then, for each observations, the list of its intent on a line, written like 0 1 0
[Lattice]
2
3
[Objects]
1
2
[Attributes]
a
b
c
[relation]
0 1 0
1 1 0
write
in interface Writer<Context>
context
- a context to writefile
- a fileIOException
- When an IOException occursCopyright © 2010–2016 The Galactic Organization. All rights reserved.