|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object controller.DataHandler
public class DataHandler
Title: Bioinformatics Project
Description: Genomes Comparacent
Copyright: Copyright (c) 2005-2006
DataHandler is the controller of the system. DataHandler holds the data view, which events it handles, and an interface of the database, which it manipulates.
Field Summary | |
---|---|
(package private) java.util.LinkedList |
genomeArray
A List containing genomes-objects (which contains genome information). |
private boolean |
isComplex
True if the language encoding is Right-to-Left |
private java.util.ResourceBundle |
message
The Bundle which translates keys into strings of the chosen language. |
private IDataManager |
model_
The database - model |
private DataView |
view_
The data view |
Constructor Summary | |
---|---|
DataHandler(IDataManager dm,
java.lang.String[] args)
Creates a controller of the model and the view, it creats the view and takes the model as a parameter. |
Method Summary | |
---|---|
long |
checkField(java.lang.String str,
org.eclipse.swt.widgets.Shell shell)
Returns true if the given string includes only numbers |
boolean |
checkPath(java.lang.String text)
Returns true if the given path is legal and does exist. |
void |
CopyFile(java.lang.String file1,
java.lang.String file2)
Copy file given by the path "from" to the file given by path "to" |
java.lang.String |
CreateDir(java.lang.String dir,
java.lang.String Gen1,
java.lang.String Gen2,
java.lang.String phase)
Creates a new history directory containing the mapping/preprocessing results. |
void |
deleteFileOrDirectory(java.lang.String para)
Deletes a file or a Directory recursively. |
void |
deleteRowsinTable(SWTTable HistoryTable,
int[] selectedIndices,
java.lang.String chosenDir,
java.lang.String ChosenPart)
Deletes Rows from given table which indices are in selectedIndices. |
void |
deleteRowsinTable(SWTTable historyTable,
int itemCount,
java.lang.String chosenDir,
java.lang.String ChosenPart)
Deletes ALL Rows from given table. |
org.eclipse.swt.widgets.Display |
getDisplay()
Returns view display, for asynchronious execution of runnables that updates the shell. |
private Genome |
getGenome(java.lang.String SymbolName)
Returns the genome object containing information about the genome that its short name is given. |
long |
getGenomeLength(java.lang.String gen1)
Lookup given genome by symbolic name and returns it length. |
java.lang.String |
getGenomeName(java.lang.String SymbolName)
Finds genome by symbolic (short) name and returns it full name. |
java.lang.String[] |
getGenomeNames()
Returns an array containing genomes full names. |
java.lang.String |
getGenomeProp(java.lang.String gen)
Returns the genome "prop" file path. |
java.lang.String |
getGenomeSymbolName(java.lang.String RealName)
Finds genome by real (Full) name and returns it symbolic name. |
java.lang.String |
getInputDirectory()
Returns the input directory. |
java.lang.String[] |
getMapParameters(SWTTable table1,
SWTTable table2,
SWTTable table3)
Put the parameters taken from the mapping parameters table into an array of strings. |
java.util.ResourceBundle |
getMessageLang()
Returns the message bundle. |
private java.lang.String |
getNum(java.lang.String str)
Removes the last char' of a string value of a number if it's not digit. |
private java.lang.String |
getNumber(java.lang.String text)
Cuts the tail of a string which contains charactars other than digits, for extracting the only number. |
java.lang.String |
getOutputDirectory()
Returns the output directory. |
void |
getParametersINI(java.lang.String para,
SWTTable[] table)
Loads parameters from a settings.ini file into given array of tables. |
java.lang.String[] |
getPreParameters(SWTTable table1,
SWTTable table2,
SWTTable table3)
Put the parameters taken from the pre-processing parameters table into an array of strings. |
java.lang.String |
getProcessState(java.lang.String string)
Returns a number between 0-100 from the trace file. |
private long |
getRowsNumber(java.io.FileReader fr)
Returns number of rows in a file. |
int |
getSelectedLang()
Returns the index of the chosen language. |
java.util.Vector |
getVectorFromFile(java.lang.String file,
long length,
long length2,
boolean HEADLINE)
The Method take a file path as a parameter passes it to the model throught the data IDataManager interface. |
boolean |
isComplex()
Returns true if the language encoding is Right-to-left. |
java.lang.String |
ReadLine(java.io.FileReader fileR,
char[] c)
Reads a line from the file. |
void |
removeGenome(java.lang.String name)
Removes a genome input directory. |
int |
runMappingProcess(java.lang.String dir,
java.lang.String gen1,
java.lang.String gen2,
java.lang.String out,
java.lang.String g1prop,
java.lang.String g2prop,
java.lang.String[] prm)
Runs the mapping process. |
void |
runPreProcessing(java.lang.String gen1,
java.lang.String gen2,
java.lang.String outDir,
java.lang.String[] str,
boolean mapping,
GRunTab parent,
java.lang.String MapoutDir,
java.lang.String[] strM)
Runs the pre-processing phase in a NEW PROCESS outside of VM. |
void |
setGenomes(java.lang.String OrgDir)
Sets the controller genome array with genome information taken from the files in the directory |
void |
setLanguage(int selectionIndex)
Sets Language according to and index. |
void |
setMessageLang()
Sets the language from the view/database. |
void |
setParametersINI(java.lang.String OutputIni,
SWTTable[] table)
Stores parameters in a settings.ini file (taken from given array of tables). |
void |
setView(DataView view)
Sets the controller reference to the logical view. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
java.util.LinkedList genomeArray
private IDataManager model_
private DataView view_
private java.util.ResourceBundle message
private boolean isComplex
Constructor Detail |
---|
public DataHandler(IDataManager dm, java.lang.String[] args)
dm
- IDataManager: the model's inteface.args
- String[] user's run-time arguments.Method Detail |
---|
public java.util.Vector getVectorFromFile(java.lang.String file, long length, long length2, boolean HEADLINE)
IDataHandler
getVectorFromFile
in interface IDataHandler
file
- String the output file path.length
- long second genome length.length2
- long first genome length.
public int runMappingProcess(java.lang.String dir, java.lang.String gen1, java.lang.String gen2, java.lang.String out, java.lang.String g1prop, java.lang.String g2prop, java.lang.String[] prm)
IDataHandler
runMappingProcess
in interface IDataHandler
dir
- String : the directory including the pre-processing output.gen1
- String : 1st genome name.gen2
- String : 2nd genome name.out
- String : the directory that will include the mappping output.g1prop
- String : 1st genome prop file.g2prop
- String : 2nd genome prop file.prm
- String[] : The mapping parameters.
public void runPreProcessing(java.lang.String gen1, java.lang.String gen2, java.lang.String outDir, java.lang.String[] str, boolean mapping, GRunTab parent, java.lang.String MapoutDir, java.lang.String[] strM) throws java.io.FileNotFoundException
IDataHandler
runPreProcessing
in interface IDataHandler
gen1
- String: 1st genome full name.gen2
- String: 2nd genome full name.outDir
- String: the pre-processing output directory.str
- String[]: pre-processing parameters.mapping
- boolean: indicating if it should run the preparent
- GRunTab: refernece to the view component that invoked pre-processing.MapoutDir
- String: mapping output directory.strM
- String[]: mapping parameters.
java.io.FileNotFoundException
private long getRowsNumber(java.io.FileReader fr)
fr
- FileReader: opened file.
public void setView(DataView view)
IDataHandler
setView
in interface IDataHandler
view
- DataView : MAGIC logical view object.public void deleteRowsinTable(SWTTable HistoryTable, int[] selectedIndices, java.lang.String chosenDir, java.lang.String ChosenPart) throws java.io.IOException
IDataHandler
deleteRowsinTable
in interface IDataHandler
HistoryTable
- SWTTable :given table.selectedIndices
- int[] :and array of integer which contain the indices.chosenDir
- String : the dirctory which includes the history that will removed. (PreOutput/MapoutPut).ChosenPart
- String: "MAP"/"PRE" to determine how to find the related histoy.
java.io.IOException
public void deleteRowsinTable(SWTTable historyTable, int itemCount, java.lang.String chosenDir, java.lang.String ChosenPart) throws java.io.IOException
IDataHandler
deleteRowsinTable
in interface IDataHandler
historyTable
- SWTTable :given table.itemCount
- int: the number of rows in the given table.chosenDir
- String : the dirctory which includes the history that will removed. (PreOutput/MapoutPut).ChosenPart
- String : "MAP"/"PRE" to determine how to find the related histoy.
java.io.IOException
public void deleteFileOrDirectory(java.lang.String para) throws java.io.IOException
IDataHandler
deleteFileOrDirectory
in interface IDataHandler
para
- String: the file/directory path.
java.io.IOException
- in case of deletion faliure.public boolean checkPath(java.lang.String text)
IDataHandler
checkPath
in interface IDataHandler
text
- String: given string.
public java.lang.String getOutputDirectory()
IDataHandler
getOutputDirectory
in interface IDataHandler
public java.lang.String getInputDirectory()
IDataHandler
getInputDirectory
in interface IDataHandler
public void getParametersINI(java.lang.String para, SWTTable[] table)
IDataHandler
getParametersINI
in interface IDataHandler
para
- String: the settings.ini file path.table
- SWTTable[]: an array including 6 tables for the parameters.public java.lang.String ReadLine(java.io.FileReader fileR, char[] c)
fileR
- FileReader: opened file.c
- char[]: buffer.
public java.lang.String[] getGenomeNames()
IDataHandler
getGenomeNames
in interface IDataHandler
public void setGenomes(java.lang.String OrgDir)
IDataHandler
setGenomes
in interface IDataHandler
OrgDir
- String: a dircetory including the organizimspublic java.lang.String getGenomeName(java.lang.String SymbolName)
IDataHandler
getGenomeName
in interface IDataHandler
SymbolName
- String: genome short name.
public java.lang.String getGenomeSymbolName(java.lang.String RealName)
IDataHandler
getGenomeSymbolName
in interface IDataHandler
RealName
- String: genome full name.
private Genome getGenome(java.lang.String SymbolName)
SymbolName
- String: genome short name.
public java.lang.String CreateDir(java.lang.String dir, java.lang.String Gen1, java.lang.String Gen2, java.lang.String phase)
IDataHandler
CreateDir
in interface IDataHandler
dir
- String:Gen1
- String: 1st genome symbolic name.Gen2
- String: 2nd genome symbolic name.phase
- String: "MAP"/"PRE".
public void setParametersINI(java.lang.String OutputIni, SWTTable[] table)
IDataHandler
setParametersINI
in interface IDataHandler
OutputIni
- String: the settings.ini file path.table
- SWTTable[]: an array including 6 tables for the parameters.private java.lang.String getNum(java.lang.String str)
str
- String: given string value of a number.
public long getGenomeLength(java.lang.String gen1)
IDataHandler
getGenomeLength
in interface IDataHandler
gen1
- String: genome symbolic name.
public java.lang.String getProcessState(java.lang.String string)
IDataHandler
getProcessState
in interface IDataHandler
string
- String: a path to a trace file.
public void setMessageLang()
IDataHandler
setMessageLang
in interface IDataHandler
public java.util.ResourceBundle getMessageLang()
IDataHandler
getMessageLang
in interface IDataHandler
public int getSelectedLang()
getSelectedLang
in interface IDataHandler
public void setLanguage(int selectionIndex)
IDataHandler
setLanguage
in interface IDataHandler
selectionIndex
- int: the language index.public boolean isComplex()
IDataHandler
isComplex
in interface IDataHandler
public long checkField(java.lang.String str, org.eclipse.swt.widgets.Shell shell)
IDataHandler
checkField
in interface IDataHandler
str
- String : given string.shell
- Shell : Current shell.
public void CopyFile(java.lang.String file1, java.lang.String file2)
IDataHandler
CopyFile
in interface IDataHandler
file1
- String: source path.file2
- String: destination path.public java.lang.String getGenomeProp(java.lang.String gen)
IDataHandler
getGenomeProp
in interface IDataHandler
gen
- String: the genome symbolic name.
public java.lang.String[] getMapParameters(SWTTable table1, SWTTable table2, SWTTable table3)
IDataHandler
getMapParameters
in interface IDataHandler
table1
- SWTTable: 1st mapping parameters table.table2
- SWTTable: 2nd mapping parameters table.table3
- SWTTable: 3rd mapping parameters table.
private java.lang.String getNumber(java.lang.String text)
text
- String: given string.
public java.lang.String[] getPreParameters(SWTTable table1, SWTTable table2, SWTTable table3)
IDataHandler
getPreParameters
in interface IDataHandler
table1
- SWTTable: 1st mapping parameters table.table2
- SWTTable: 2nd mapping parameters table.table3
- SWTTable: 3rd mapping parameters table.
public org.eclipse.swt.widgets.Display getDisplay()
IDataHandler
getDisplay
in interface IDataHandler
public void removeGenome(java.lang.String name)
IDataHandler
removeGenome
in interface IDataHandler
name
- String: genome input path.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |