public class TableReader extends GraphReader
Modifier and Type | Field and Description |
---|---|
static int |
BLANK
class/type flag: blank character
|
static int |
COMMENT
class/type flag: comment character
|
static int |
FLDSEP
class/type flag: field separator
|
static int |
RECSEP
class/type flag: record separator
|
Constructor and Description |
---|
TableReader(java.io.Reader reader,
int mode,
Notation ntn)
Create a table reader with default character flags.
|
Modifier and Type | Method and Description |
---|---|
Graph |
getGraph()
Get the current graph or substructure.
|
int |
getTypes(char c)
Get the classes/types of a given character.
|
boolean |
isType(int type,
char c)
Check whether a given character is in a given class
or of a given type.
|
static void |
main(java.lang.String[] args)
Main function for testing basic functionality.
|
boolean |
readGraph()
Read the next graph description.
|
boolean |
readHeader()
Read an (optional) table header.
|
java.lang.String |
rno()
Get a string stating the current record number.
|
java.lang.String |
rno(int offset)
Get a string stating the current record number.
|
void |
setChars(int type,
java.lang.String chars)
Set the characters for a specific type/class.
|
void |
setChars(java.lang.String recseps,
java.lang.String fldseps,
java.lang.String blanks,
java.lang.String comment)
Set the characters for all types.
|
createReader, getAbsCompl, getAbsSupp, getDesc, getEdgeCount, getMode, getName, getNodeCount, getNotation, getRelCompl, getRelSupp, getValue
public static final int RECSEP
public static final int FLDSEP
public static final int BLANK
public static final int COMMENT
public TableReader(java.io.Reader reader, int mode, Notation ntn)
By default the following character settings are used:
record separators: "\n", field separators: " \t", blanks: " \r\t",
comment characters: "#".
reader
- the reader to work onmode
- the read modentn
- the notation of the graphspublic void setChars(int type, java.lang.String chars)
type
- the type/class of the characters to set;
must be one of the constants RECSEP
,
FLDSEP
, BLANK
, or
COMMENT
(or a combination of these,
by binary or)chars
- the characters to setpublic void setChars(java.lang.String recseps, java.lang.String fldseps, java.lang.String blanks, java.lang.String comment)
If a parameter is null
, the corresponding
character flags are maintained.
recseps
- the record separatorsfldseps
- the field separatorsblanks
- the blank characterscomment
- the comment characterspublic boolean isType(int type, char c)
type
- the type/class for which to query;
must be one of the constants RECSEP
,
FLDSEP
, BLANK
, or
COMMENT
c
- the character to querypublic int getTypes(char c)
c
- the character to queryRECSEP
, FLDSEP
,
BLANK
, or COMMENT
public java.lang.String rno()
public java.lang.String rno(int offset)
Useful for error reporting.
offset
- the offset to add to the record numberpublic boolean readHeader() throws java.io.IOException
readHeader
in class GraphReader
java.io.IOException
- if an i/o error occurspublic boolean readGraph() throws java.io.IOException
The next graph description is read and split into the graph
name/identifier, the graph description, the associated value
(only in mode GRAPHS
), and the support information
(only in mode SUBS
).
getName(), getDesc()
,
getValue()
etc.
readGraph
in class GraphReader
java.io.IOException
- if an i/o error occurspublic Graph getGraph() throws java.io.IOException
getGraph
in class GraphReader
java.io.IOException
- if a parse error occurspublic static void main(java.lang.String[] args)
args
- the command line arguments