view
Class PaintChart

java.lang.Object
  extended by view.PaintChart

public class PaintChart
extends java.lang.Object

Title: Bioinformatics Project

Description: Genomes Comparacent

Copyright: Copyright (c) 2005-2006

PaintChart is the class that draws the computated table into a chart.

Version:
1.0
Author:
Shadi Ibrahem.

Field Summary
(package private)  org.eclipse.swt.graphics.Color blue
          Canvas colors, red for the scale.
private  org.eclipse.swt.graphics.Rectangle bounds
          The chart group bounds from the reults tab.
(package private)  org.eclipse.swt.widgets.Canvas canvas
          Chart canvas.
private  org.eclipse.swt.widgets.Composite comp
          Data view shell, in order to view with it the canvas.
(package private)  org.eclipse.swt.graphics.Color red
          Canvas colors, red for the scale.
private  int tableLineNumber
          Used for statistics.
 
Constructor Summary
PaintChart(org.eclipse.swt.widgets.Composite sh, org.eclipse.swt.graphics.Rectangle rec)
          C'tor, initiates the chart variables.
 
Method Summary
 void drawChart(java.util.Vector vec, long length1, long length2, org.eclipse.swt.widgets.ProgressBar pb)
          Draws the whole chart in the canvas, uses the method PaintLineInChart in order to draw each line extracted from the line vector.
 void drawScale(long length1, long length2)
          Draws the scale of the canvas according to the genome lengths.
private  int getDigNum(long num)
          Returns number of the digits in a given number.
private  double getLastDig(double num, int digitNum)
          Converts a number of regular digits number to 1 digit multiplyed with 10^number of the rest of the digits.
 java.lang.String getTableLineNumber()
          Returns number of the lines in the given vector.
private  void PaintLineInChart(Line line, long length1, long length2)
          Paints a single given line in the chart, its "resizes" the line according to the chart scale (genomes length).
private  int pow(int i, int j)
          Calculates regular power function : i^j.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

canvas

org.eclipse.swt.widgets.Canvas canvas
Chart canvas.


red

org.eclipse.swt.graphics.Color red
Canvas colors, red for the scale.


blue

org.eclipse.swt.graphics.Color blue
Canvas colors, red for the scale.


comp

private org.eclipse.swt.widgets.Composite comp
Data view shell, in order to view with it the canvas.


bounds

private org.eclipse.swt.graphics.Rectangle bounds
The chart group bounds from the reults tab.


tableLineNumber

private int tableLineNumber
Used for statistics.

Constructor Detail

PaintChart

public PaintChart(org.eclipse.swt.widgets.Composite sh,
                  org.eclipse.swt.graphics.Rectangle rec)
C'tor, initiates the chart variables.

Parameters:
sh -
rec -
Method Detail

PaintLineInChart

private void PaintLineInChart(Line line,
                              long length1,
                              long length2)
Paints a single given line in the chart, its "resizes" the line according to the chart scale (genomes length).

Parameters:
line - Line: given line.
length1 - long: 1st genome length.
length2 - long: 2nd genome length.

drawChart

public void drawChart(java.util.Vector vec,
                      long length1,
                      long length2,
                      org.eclipse.swt.widgets.ProgressBar pb)
Draws the whole chart in the canvas, uses the method PaintLineInChart in order to draw each line extracted from the line vector.

Parameters:
vec - Vector: give lines vector.
length1 - long: 1st genome length.
length2 - long: 2nd genome length.
pb - ProgressBar: results tab progress bar in order to update it accordingly.

getDigNum

private int getDigNum(long num)
Returns number of the digits in a given number.

Parameters:
num - long: given number.
Returns:
int: the number of num digits.

getLastDig

private double getLastDig(double num,
                          int digitNum)
Converts a number of regular digits number to 1 digit multiplyed with 10^number of the rest of the digits. for example, if digits number is 8 it converts: 32252345 to 0.3*10^7 if digits number is 7 it converts: 32252345 to 3.2*10^6

Parameters:
num - int: given number.
digitNum - int: given number digits.
Returns:
double: of the required form.

pow

private int pow(int i,
                int j)
Calculates regular power function : i^j.

Parameters:
i - int: base number.
j - int: power.
Returns:
int: i^j.

drawScale

public void drawScale(long length1,
                      long length2)
Draws the scale of the canvas according to the genome lengths.

Parameters:
length1 - long: 1st genome length.
length2 - long: 2nd genome length.

getTableLineNumber

public java.lang.String getTableLineNumber()
Returns number of the lines in the given vector.

Returns:
String: string value of lines number.