|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.util.bfs.AnnotationModel
public class AnnotationModel
A model container for BFS annotation files. This class is primarily intended to be used when parsing small annotation files. It is not recommended to use this class with large files since it may use too much memory.
Data may be retreived by either column name or index and by row id or index. Lookup by index is a lot faster than by name or id.
Field Summary | |
---|---|
private Map<String,Integer> |
columnIndex
|
private List<String[]> |
data
|
private String[] |
headers
|
private Map<Integer,Integer> |
rowIndex
|
Constructor Summary | |
---|---|
AnnotationModel()
Create a new annotation model. |
Method Summary | ||
---|---|---|
void |
addRow(String... row)
Add a row of data to the model. |
|
int |
getColumnCount()
Get the number of column. |
|
int |
getColumnIndex(String header)
Get the column index for a given header. |
|
String |
getData(int rowIndex,
int colIndex)
Get the data element at a given row and column index. |
|
String |
getData(int rowId,
String header)
Get the data element at a given row and column. |
|
String |
getHeader(int colIndex)
Get the column header for a given column index. |
|
String[] |
getHeaders()
Get all column headers. |
|
String[] |
getRowById(int rowId)
|
|
String[] |
getRowByIndex(int rowIndex)
|
|
int |
getRowCount()
Get the number of rows. |
|
int |
getRowId(int rowIndex)
Get the row id for a given row. |
|
int |
getRowIndex(int rowId)
Get the row index for a given row id. |
|
|
handleEvent(EventType<T> eventType,
T eventData,
BfsParser parser)
The method is called by the parser when it has found something interesting in a BFS file. |
|
void |
setHeaders(String... headers)
Set the column headers. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private String[] headers
private List<String[]> data
private Map<String,Integer> columnIndex
private Map<Integer,Integer> rowIndex
Constructor Detail |
---|
public AnnotationModel()
Method Detail |
---|
public <T> void handleEvent(EventType<T> eventType, T eventData, BfsParser parser)
EventHandler
It is recommended that event handlers ignore event types they don't know about.
handleEvent
in interface EventHandler
eventType
- The type of event. See the parser documentation
for more information about the event types it generateseventData
- The data that is associated with the eventparser
- The parser that is resposible for parsing the filepublic void setHeaders(String... headers)
headers
- An array with the column headerspublic String[] getHeaders()
public void addRow(String... row)
public int getColumnCount()
public int getRowCount()
public int getColumnIndex(String header)
header
- The column header
public String getHeader(int colIndex)
colIndex
- The index of the column, a value between
0 and getColumnCount()
-1
public int getRowIndex(int rowId)
rowId
- The row id
public int getRowId(int rowIndex)
rowIndex
- The index of the row, a value between 0 and
getRowCount()
-1
public String getData(int rowIndex, int colIndex)
rowIndex
- The row index, a value between 0 and
getRowCount()
-1colIndex
- The column index, a value between
0 and getColumnCount()
-1
public String getData(int rowId, String header)
getData(int, int)
.
rowId
- The row idheader
- The column header
public String[] getRowById(int rowId)
public String[] getRowByIndex(int rowIndex)
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |