model
Class ImportedTableFile

java.lang.Object
  extended by model.ImportedTableFile

public class ImportedTableFile
extends java.lang.Object

Title: Bioinformatics Project

Description: Genomes Comparacent

Copyright: Copyright (c) 2005-2006

ImportedTableFile is the class that import a file into a vector of lines.

Version:
1.0
Author:
Shadi Ibrahem.

Field Summary
private  java.io.BufferedReader BufReader
          file descriptor.
private  boolean flag
          A flag that indicates that the file can be opened successfuly.
private  long LineCount
          Line number in the file.
private  java.util.Vector LineVector
          Vector containing the lines as imported from the file.
private  boolean VecIsImported
          Indicates the file lines has been imported successfuly.
private  long xScale
          Default settings, to be deleted in the future.
private  long yScale
          Default settings, to be deleted in the future.
 
Constructor Summary
ImportedTableFile(java.lang.String file)
          Opens a file
 
Method Summary
 Line getLineAt(int indx)
          Returns a vector item(coordinates-line)
 java.util.Vector getLineVector()
          Returns the ImportedTable data base
private  boolean IsFileImported()
          Returns a flag that indicates whether the file has been imported into lines-vector
private  void setLineInVector(long x1, long y1, long x2, long y2, char sign)
          The genomes length(xScale/yScale) is set to be the range of canvas.
 void setLineVector(boolean HEADLINE)
          Sets the table lines into coordinates-Lines and then insert it into a the ImportedFileTable vector
 void setRegularTableFileConfiguration(long length, long length2, boolean HEADLINE)
          Sets the ImportedFileTable Default configurations.
private  int skipSpaces(java.lang.String str, int i)
          Return the updated index which is used to read a string after skipping spaces.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LineVector

private java.util.Vector LineVector
Vector containing the lines as imported from the file.


BufReader

private java.io.BufferedReader BufReader
file descriptor.


flag

private boolean flag
A flag that indicates that the file can be opened successfuly.


LineCount

private long LineCount
Line number in the file.


VecIsImported

private boolean VecIsImported
Indicates the file lines has been imported successfuly.


xScale

private long xScale
Default settings, to be deleted in the future.


yScale

private long yScale
Default settings, to be deleted in the future.

Constructor Detail

ImportedTableFile

public ImportedTableFile(java.lang.String file)
Opens a file

Parameters:
file - String : given file path.
Method Detail

IsFileImported

private boolean IsFileImported()
Returns a flag that indicates whether the file has been imported into lines-vector

Returns:
true if the file has been imported.

setLineVector

public void setLineVector(boolean HEADLINE)
                   throws java.io.IOException
Sets the table lines into coordinates-Lines and then insert it into a the ImportedFileTable vector

Throws:
java.io.IOException

skipSpaces

private int skipSpaces(java.lang.String str,
                       int i)
Return the updated index which is used to read a string after skipping spaces.

Parameters:
str - String given string.
i - int the index to begin with.
Returns:
int - the updated index.

getLineAt

public Line getLineAt(int indx)
Returns a vector item(coordinates-line)

Parameters:
indx - int the line index.
Returns:
Line a coordinates-line.

setRegularTableFileConfiguration

public void setRegularTableFileConfiguration(long length,
                                             long length2,
                                             boolean HEADLINE)
Sets the ImportedFileTable Default configurations.

Parameters:
length2 -
length -
HEADLINE -

getLineVector

public java.util.Vector getLineVector()
Returns the ImportedTable data base

Returns:
Vector - coordinates-line-vector.

setLineInVector

private void setLineInVector(long x1,
                             long y1,
                             long x2,
                             long y2,
                             char sign)
The genomes length(xScale/yScale) is set to be the range of canvas. This method checks if the line is out of the given range (circularity) and assigns new line accordingly; if all of the line is inside the range it insert it in the line vector as it gets it, otherwise it cuts it into 2 or three part and changes the coordinates of each part.

Parameters:
x1 - long: the sigment start point coordinates.
y1 - long: the sigment start point coordinates.
x2 - long: the sigment end point coordinates.
y2 - long: the sigment end point coordinates.
sign - char: the sigment sign.