uk.ac.man.bioinf.sequence.geom
Class SequenceAlignmentRectangle

java.lang.Object
  |
  +--uk.ac.man.bioinf.sequence.geom.SequenceAlignmentRectangle
All Implemented Interfaces:
Comparable, SequenceAlignmentShape

public class SequenceAlignmentRectangle
extends Object
implements SequenceAlignmentShape, Comparable

SequenceAlignmentRectangle.java Defines a rectangular region in a sequence alignment. NB: objects of this class perform no checks as to the validity of the region defined. Created: Mon Mar 27 12:41:18 2000

Version:
$Id: SequenceAlignmentRectangle.java,v 1.6 2001/04/11 17:04:43 lord Exp $
Author:
J Selley

Constructor Summary
SequenceAlignmentRectangle()
           
SequenceAlignmentRectangle(int x, int y, int width, int height)
           
SequenceAlignmentRectangle(int x, int y, SequenceAlignmentDimension dim)
           
SequenceAlignmentRectangle(SequenceAlignmentPoint point, int width, int height)
           
SequenceAlignmentRectangle(SequenceAlignmentRectangle rect)
           
 
Method Summary
 void add(int newx, int newy)
           
 void add(SequenceAlignmentPoint point)
           
 int compareTo(Object obj)
          Compares another rectangle to this one.
 boolean contains(int x, int y)
          Determines whether a point is contained in this region.
 boolean contains(SequenceAlignmentPoint point)
          Determines whether a point is contained in this region.
 boolean equals(Object obj)
          Compares two SARectangles for equality (ie: whether they have the same dimension and location).
 SequenceAlignmentRectangle getBounds()
          Returns the rectangle which defines the boundries of the region defined by this object.
 int getHeight()
           
 SequenceAlignmentPoint getLocation()
          Returns the location of the rectangle
 SequenceAlignmentDimension getSize()
          Returns the size of the rectangle.
 int getWidth()
           
 int getX()
           
 int getY()
           
 void setBounds(int x, int y, int width, int height)
          Sets the boundry defined by this region.
 void setBounds(SequenceAlignmentPoint point, SequenceAlignmentDimension dim)
          Sets the boundry defined by this region.
 void setBounds(SequenceAlignmentRectangle rect)
          Sets the boundry defined by this region.
 void setLocation(int x, int y)
          Sets the progom location of the rectangle.
 void setLocation(SequenceAlignmentPoint point)
          Sets the origin location of the rectangle.
 void setSize(int width, int height)
          Sets the size of the rectangle.
 void setSize(SequenceAlignmentDimension dim)
          Sets the size of the rectangle.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SequenceAlignmentRectangle

public SequenceAlignmentRectangle()

SequenceAlignmentRectangle

public SequenceAlignmentRectangle(int x,
                                  int y,
                                  int width,
                                  int height)

SequenceAlignmentRectangle

public SequenceAlignmentRectangle(SequenceAlignmentRectangle rect)

SequenceAlignmentRectangle

public SequenceAlignmentRectangle(int x,
                                  int y,
                                  SequenceAlignmentDimension dim)

SequenceAlignmentRectangle

public SequenceAlignmentRectangle(SequenceAlignmentPoint point,
                                  int width,
                                  int height)
Method Detail

contains

public boolean contains(int x,
                        int y)
Determines whether a point is contained in this region.

Parameters:
x - the position in the sequence
y - the sequence index in the alignment
Returns:
whether a point is contained in this region

contains

public boolean contains(SequenceAlignmentPoint point)
Determines whether a point is contained in this region.

Parameters:
point - the point
Returns:
whether a point is contained in this region

equals

public boolean equals(Object obj)
Compares two SARectangles for equality (ie: whether they have the same dimension and location).

Overrides:
equals in class Object
Parameters:
obj - the SARectangle for comparison
Returns:
the equality of the objects

compareTo

public int compareTo(Object obj)
Compares another rectangle to this one. Comparison is done by comparing the location point. If this is equal then the width, then the height are compared. Throws a class cast if obj is not a SequenceAlignmentRectangle

Specified by:
compareTo in interface Comparable

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Sets the boundry defined by this region.

Parameters:
x - the position in the sequence
y - the sequence index in the alignment
width - the width of the SARectangle
height - the height of the SARectangle

setBounds

public void setBounds(SequenceAlignmentPoint point,
                      SequenceAlignmentDimension dim)
Sets the boundry defined by this region.

Parameters:
point - the origin location of the new SARectangle
dim - the size of the new SARectangle

setBounds

public void setBounds(SequenceAlignmentRectangle rect)
Sets the boundry defined by this region.

Parameters:
rect - the rectangle

getBounds

public SequenceAlignmentRectangle getBounds()
Returns the rectangle which defines the boundries of the region defined by this object.

Specified by:
getBounds in interface SequenceAlignmentShape
Returns:
the rectangle
See Also:
SequenceAlignmentShape

setLocation

public void setLocation(int x,
                        int y)
Sets the progom location of the rectangle. X corresponds to the position in the sequence, and Y corresponds to the index of the sequence in the alignment.

Parameters:
x - the new X location of the rectangle
y - the new Y location of the rectangle

setLocation

public void setLocation(SequenceAlignmentPoint point)
Sets the origin location of the rectangle.

Parameters:
point - the new location

getLocation

public SequenceAlignmentPoint getLocation()
Returns the location of the rectangle

Returns:
the location

setSize

public void setSize(int width,
                    int height)
Sets the size of the rectangle.

Parameters:
width - the width of the new rectangle
height - the height of the new rectangle

setSize

public void setSize(SequenceAlignmentDimension dim)
Sets the size of the rectangle.

Parameters:
dim - the new dimension

getSize

public SequenceAlignmentDimension getSize()
Returns the size of the rectangle.

Returns:
the dimensions of the rectangle

getX

public int getX()

getY

public int getY()

getHeight

public int getHeight()

getWidth

public int getWidth()

add

public void add(SequenceAlignmentPoint point)

add

public void add(int newx,
                int newy)

toString

public String toString()
Overrides:
toString in class Object