|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectDatabase
public class Database
In-memory implementation of a database of rows and named columns, supporting basic creation and deletion actions, as well as file output in CSV format.
| Field Summary | |
|---|---|
private static org.slf4j.Logger |
_log
|
private TreeMap<String,LinkedList<String>> |
columns
|
private String |
name
|
| Constructor Summary | |
|---|---|
Database(String name)
Constructor. |
|
| Method Summary | |
|---|---|
void |
addField(String name)
Add column (field) to the Database. |
void |
addValue(String name,
String value)
Add row (value) to a column (field) of the Database. |
void |
flush()
Flushes the Database by clearing all the columns. |
void |
init()
Initializes the Database by creating the necessary data structures. |
void |
removeField(String name)
Remove column (field) from the Database. |
void |
removeValue(String name,
String value)
Remove row (value) from a column (field) of the Database. |
void |
saveToFile(String path,
String file,
String ext)
Save Database to a CSV formatted file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private String name
private TreeMap<String,LinkedList<String>> columns
private static org.slf4j.Logger _log
| Constructor Detail |
|---|
public Database(String name)
name - Name of the Database.| Method Detail |
|---|
public void init()
Database by creating the necessary data structures.
public void flush()
Database by clearing all the columns.
public void addField(String name)
Database.
name - Name of field to be added.public void removeField(String name)
Database.
name - Name of field to be removed.
public void addValue(String name,
String value)
Database.
name - Name of field to be updated.value - Value to be added.
public void removeValue(String name,
String value)
Database.
name - Name of field to be updated.value - Value to be removed.
public void saveToFile(String path,
String file,
String ext)
Database to a CSV formatted file.
path - Output folder name (relative paths are allowed).file - Output file name (without extension).ext - Output file extension (preferably .csv).
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||