baobab.bio.permutation
Class ReversalBlock

java.lang.Object
  extended by baobab.bio.permutation.ReversalBlock
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
SignedReversalBlock

public class ReversalBlock
extends java.lang.Object
implements java.lang.Comparable

The ReversalBlock class represents an elementary block of a permutation, given by its start and end points, which can be used as the breakpoints of a reversal

Version:
1.0, May 2006
Author:
Marilia D. V. Braga

Constructor Summary
ReversalBlock(Permutation permutation, int start, int end)
          Creates a new block
ReversalBlock(Permutation permutation, Point start, Point end)
          Creates a new block
 
Method Summary
 int compareTo(java.lang.Object object)
          Compares this block to another block
 Point getEndPoint()
          Gets the end point of this block in the permutation
 int getEndPosition()
          Gets the end position of this block in the permutation
 Permutation getPermutation()
          Gets the permutation to which this element belongs
 Point getStartPoint()
          Gets the start point of this block in the permutation
 int getStartPosition()
          Gets the start position of this block in the permutation
 boolean isAdjacency()
          Tests whether this block is an adjacency
 int length()
          Gets the length of the block (the number of values of the permutation between its start and end points)
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReversalBlock

public ReversalBlock(Permutation permutation,
                     Point start,
                     Point end)
              throws PermutationException
Creates a new block

Parameters:
permutation - the permutation to which this block belongs
start - the start Point of this block in the permutation
end - the end Point of this block in the permutation
Throws:
PermutationException

ReversalBlock

public ReversalBlock(Permutation permutation,
                     int start,
                     int end)
Creates a new block

Parameters:
permutation - the permutation to which this block belongs
start - the start position of this block in the permutation
end - the end position of this block in the permutation
Method Detail

length

public int length()
Gets the length of the block (the number of values of the permutation between its start and end points)

Returns:
the length

isAdjacency

public boolean isAdjacency()
Tests whether this block is an adjacency

Returns:
true/false

getStartPoint

public Point getStartPoint()
Gets the start point of this block in the permutation

Returns:
the start point

getEndPoint

public Point getEndPoint()
Gets the end point of this block in the permutation

Returns:
the end point

getStartPosition

public int getStartPosition()
Gets the start position of this block in the permutation

Returns:
the start position

getEndPosition

public int getEndPosition()
Gets the end position of this block in the permutation

Returns:
the end position

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

compareTo

public int compareTo(java.lang.Object object)
Compares this block to another block

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
object - the other block
Returns:
the result of the comparison, as an int

getPermutation

public Permutation getPermutation()
Gets the permutation to which this element belongs

Returns:
the permutation to which this element belongs