|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.peace_tools.data.DataStore
public class DataStore
A helper class to load and maintain data files. This class is a helper class that is used to load and maintain information about ESTs, MSTs, and Cluster data files. This class maintains references to currently loaded entries so that various data files can be shared and reused. The information is maintained in a weak hash map. Therefore, if an entry is not used (at least for some time) then it will be automatically garbage collected and needs to be reloaded.
Note: This class is not meant to be directly instantiated to preserve singleton property. Use the static get() method to obtain a reference to the globally unique instance of this class.
Field Summary | |
---|---|
private java.util.WeakHashMap<java.lang.String,java.lang.Object> |
cache
A weak hash map that serves as a cache to hold MST, EST, and cluster data file entries in it. |
private static DataStore |
dataStore
The globally unique singleton instance of this class that is shared by all the other classes that require data files to be loaded. |
private static java.lang.String |
LOW_MEMORY_MSG
Message to be displayed to the user to indicate that there is a low memory situation when loading a file. |
private static java.lang.String |
MEM_USAGE
Memory statistics to be displayed to the user after formatting (to fill in the necessary information). |
private static java.lang.String |
MEM_USAGE_LOG
A simple log message that is cut just before the memory checks are performed by the memoryCheck() method in this class. |
Constructor Summary | |
---|---|
private |
DataStore()
The constructor. |
Method Summary | |
---|---|
static DataStore |
get()
Obtain reference to the globally unique singleton instance. |
ClusterFile |
getClusterData(java.lang.String fileName,
java.awt.Component parent)
Method to load/get a given cluster file. |
ESTList |
getFASTA(java.lang.String fileName,
java.awt.Component parent)
Method to load/get a given FASTA file. |
MST |
getMSTData(java.lang.String fileName,
java.awt.Component parent)
Method to load/get a given cluster file. |
void |
memoryCheck(java.io.File fileToBeLoaded,
java.awt.Component parent)
Helper method to ensure there is sufficient memory to load data. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final java.util.WeakHashMap<java.lang.String,java.lang.Object> cache
private static final java.lang.String LOW_MEMORY_MSG
private static final java.lang.String MEM_USAGE
private static final java.lang.String MEM_USAGE_LOG
private static final DataStore dataStore
Constructor Detail |
---|
private DataStore()
Method Detail |
---|
public static DataStore get()
public void memoryCheck(java.io.File fileToBeLoaded, java.awt.Component parent) throws LowMemoryException
fileToBeLoaded
- The file that is going to be loaded into
memory.parent
- The parent component based on which any warning
dialog boxes are to be displayed.
This
- method throws a LowMemoryException if the memory is low
and the user chooses to cancel a file loading operation.
LowMemoryException
public ESTList getFASTA(java.lang.String fileName, java.awt.Component parent) throws java.lang.Exception
fileName
- The FASTA file containing ESTs to be loaded.parent
- If this parameter is not null then this method
displays a progress monitor.
java.lang.Exception
- This method throws exceptions if the
specified file could not be loaded due to various reasons.public ClusterFile getClusterData(java.lang.String fileName, java.awt.Component parent) throws java.lang.Exception
fileName
- The cluster file containing the data to be loaded.parent
- If this parameter is not null then this method
displays a progress monitor.
java.lang.Exception
- This method throws exceptions if the
specified file could not be loaded due to various reasons.public MST getMSTData(java.lang.String fileName, java.awt.Component parent) throws java.lang.Exception
fileName
- The cluster file containing the data to be loaded.parent
- If this parameter is not null then this method
displays a progress monitor.
java.lang.Exception
- This method throws exceptions if the
specified file could not be loaded due to various reasons.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |