controller
Interface IDataHandler

All Known Implementing Classes:
DataHandler

public interface IDataHandler

Title: Bioinformatics Project

Description: Genomes Comparacent

Copyright: Copyright (c) 2005-2006

IDataHandler is an interface of the controller, which handles the events in the data view.

Version:
1.0
Author:
Shadi Ibrahem.

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 path)
          Returns true if the given path is legal and does exist.
 void CopyFile(java.lang.String from, java.lang.String to)
          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 path)
          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.
 long getGenomeLength(java.lang.String gen)
          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.
 java.lang.String getOutputDirectory()
          Returns the output directory.
 void getParametersINI(java.lang.String settings, 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 trace)
          Returns a number between 0-100 from the trace file.
 int getSelectedLang()
          Returns the language index.
 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.
 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 outDir2, 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 settings, 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.
 

Method Detail

getVectorFromFile

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.

Parameters:
file - String the output file path.
length2 - long first genome length.
length - long second genome length.
Returns:
Vector of lines with includes the Genomes coordinates

runMappingProcess

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.

Parameters:
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.
Returns:
int: a number indicating the errors in mapping in case they happen.

setView

void setView(DataView view)
Sets the controller reference to the logical view.

Parameters:
view - DataView : MAGIC logical view object.

deleteRowsinTable

void deleteRowsinTable(SWTTable historyTable,
                       int[] selectedIndices,
                       java.lang.String chosenDir,
                       java.lang.String ChosenPart)
                       throws java.io.IOException
Deletes Rows from given table which indices are in selectedIndices. Chosen Part/Dir are to indicate if its the mapping history table or the pre processing table.

Parameters:
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.
Throws:
java.io.IOException - in case of a termentated pre-processing process.

deleteRowsinTable

void deleteRowsinTable(SWTTable historyTable,
                       int itemCount,
                       java.lang.String chosenDir,
                       java.lang.String ChosenPart)
                       throws java.io.IOException
Deletes ALL Rows from given table. Chosen Part/Dir are to indicate if its the mapping history table or the pre processing table.

Parameters:
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.
Throws:
java.io.IOException - in case of deletion faliure.

getParametersINI

void getParametersINI(java.lang.String settings,
                      SWTTable[] table)
Loads parameters from a settings.ini file into given array of tables.

Parameters:
settings - String: the settings.ini file path.
table - SWTTable[]: an array including 6 tables for the parameters.

setGenomes

void setGenomes(java.lang.String OrgDir)
Sets the controller genome array with genome information taken from the files in the directory

Parameters:
OrgDir - String: a dircetory including the organizims

getGenomeNames

java.lang.String[] getGenomeNames()
Returns an array containing genomes full names.

Returns:
Returns an array containing genomes full names.

getGenomeName

java.lang.String getGenomeName(java.lang.String SymbolName)
Finds genome by symbolic (short) name and returns it full name.

Parameters:
SymbolName - String: genome short name.
Returns:
Genome full name.

getGenomeSymbolName

java.lang.String getGenomeSymbolName(java.lang.String RealName)
Finds genome by real (Full) name and returns it symbolic name.

Parameters:
RealName - String: genome full name.
Returns:
Genome symbolic name name.

CreateDir

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.

Parameters:
dir - String:
Gen1 - String: 1st genome symbolic name.
Gen2 - String: 2nd genome symbolic name.
Phase - String: "MAP"/"PRE".
Returns:
the new directory path.

setParametersINI

void setParametersINI(java.lang.String settings,
                      SWTTable[] table)
Stores parameters in a settings.ini file (taken from given array of tables).

Parameters:
settings - String: the settings.ini file path.
table - SWTTable[]: an array including 6 tables for the parameters.

getGenomeLength

long getGenomeLength(java.lang.String gen)
Lookup given genome by symbolic name and returns it length.

Parameters:
gen - String: genome symbolic name.
Returns:
Genome Length.

getInputDirectory

java.lang.String getInputDirectory()
Returns the input directory.

Returns:
input directory.

getOutputDirectory

java.lang.String getOutputDirectory()
Returns the output directory.

Returns:
output directory.

getProcessState

java.lang.String getProcessState(java.lang.String trace)
Returns a number between 0-100 from the trace file.

Parameters:
trace - String: a path to a trace file.
Returns:
the read value.

setMessageLang

void setMessageLang()
Sets the language from the view/database.


getMessageLang

java.util.ResourceBundle getMessageLang()
Returns the message bundle.

Returns:
ResourceBundle.

getSelectedLang

int getSelectedLang()
Returns the language index. English - 0; Russian - 1; Hebrew - 2; Arabic - 4

Returns:
Language index.

setLanguage

void setLanguage(int selectionIndex)
Sets Language according to and index.

Parameters:
selectionIndex - int: the language index.

isComplex

boolean isComplex()
Returns true if the language encoding is Right-to-left.

Returns:
true if the language encoding is Right-to-Left other wise false.

checkField

long checkField(java.lang.String str,
                org.eclipse.swt.widgets.Shell shell)
Returns true if the given string includes only numbers

Parameters:
str - String : given string.
shell - Shell : Current shell.
Returns:
true if the given string includes only numbers, false otherwise.

checkPath

boolean checkPath(java.lang.String path)
Returns true if the given path is legal and does exist.

Parameters:
path - String: given string.
Returns:
true if the given path is legal, false otherwise.

CopyFile

void CopyFile(java.lang.String from,
              java.lang.String to)
Copy file given by the path "from" to the file given by path "to"

Parameters:
from - String: source path.
to - String: destination path.

getGenomeProp

java.lang.String getGenomeProp(java.lang.String gen)
Returns the genome "prop" file path.

Parameters:
gen - String: the genome symbolic name.
Returns:
genome prop file path.

getMapParameters

java.lang.String[] getMapParameters(SWTTable table1,
                                    SWTTable table2,
                                    SWTTable table3)
Put the parameters taken from the mapping parameters table into an array of strings.

Parameters:
table1 - SWTTable: 1st mapping parameters table.
table2 - SWTTable: 2nd mapping parameters table.
table3 - SWTTable: 3rd mapping parameters table.
Returns:
String[]: an array of Strings.

getPreParameters

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.

Parameters:
table1 - SWTTable: 1st mapping parameters table.
table2 - SWTTable: 2nd mapping parameters table.
table3 - SWTTable: 3rd mapping parameters table.
Returns:
String[]: an array of Strings.

runPreProcessing

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 outDir2,
                      java.lang.String[] strM)
                      throws java.io.FileNotFoundException
Runs the pre-processing phase in a NEW PROCESS outside of VM.

Parameters:
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 pre
parent - GRunTab: refernece to the view component that invoked pre-processing.
outDir2 - String: mapping output directory.
strM - String[]: mapping parameters.
Throws:
java.io.FileNotFoundException

getDisplay

org.eclipse.swt.widgets.Display getDisplay()
Returns view display, for asynchronious execution of runnables that updates the shell.

Returns:
view's display.

deleteFileOrDirectory

void deleteFileOrDirectory(java.lang.String path)
                           throws java.io.IOException
Deletes a file or a Directory recursively.

Parameters:
path - String: the file/directory path.
Throws:
java.io.IOException - in case of deletion faliure.

removeGenome

void removeGenome(java.lang.String name)
Removes a genome input directory.

Parameters:
name - String: genome input path.