baobab.bio.permutation
Class TranspositionBlock

java.lang.Object
  extended by baobab.bio.permutation.ReversalBlock
      extended by baobab.bio.permutation.TranspositionBlock
All Implemented Interfaces:
java.lang.Comparable

public class TranspositionBlock
extends ReversalBlock

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

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

Constructor Summary
TranspositionBlock(Permutation permutation, int start, int middle, int end)
          Creates a new block
TranspositionBlock(Permutation permutation, Point start, Point middle, Point end)
          Creates a new block
 
Method Summary
 int compareTo(java.lang.Object object)
          Compares this block to another block
 Point getMiddlePoint()
          Gets the middle point of this block
 int getMiddlePosition()
          Gets the middle point of this block
 Permutation getPermutation()
          Gets the permutation to which this element belongs
 int[] toIntArray()
          Gets a representation of the block as an array of int, with size 3, representing its start, middle and end positions
 
Methods inherited from class baobab.bio.permutation.ReversalBlock
getEndPoint, getEndPosition, getStartPoint, getStartPosition, isAdjacency, length, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TranspositionBlock

public TranspositionBlock(Permutation permutation,
                          Point start,
                          Point middle,
                          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

TranspositionBlock

public TranspositionBlock(Permutation permutation,
                          int start,
                          int middle,
                          int end)
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
Method Detail

getMiddlePoint

public Point getMiddlePoint()
Gets the middle point of this block

Returns:
the middle point

getMiddlePosition

public int getMiddlePosition()
Gets the middle point of this block

Returns:
the middle point

toIntArray

public int[] toIntArray()
Gets a representation of the block as an array of int, with size 3, representing its start, middle and end positions

Returns:
representation of the block as an array of int

compareTo

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

Specified by:
compareTo in interface java.lang.Comparable
Overrides:
compareTo in class ReversalBlock
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