baobab.bio.permutation
Class Cycle

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

public class Cycle
extends java.lang.Object

The Cycle class represents a cycle of points of the breakpoint graph of a permutation

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

Method Summary
static java.util.Vector<int[]> blocksToIntArrays(java.util.Collection blocks)
          Transforms the collection of blocks to a collection of arrays of int (with length = 2)
 int compareTo(java.lang.Object object)
          Compares this block to another block
 java.util.SortedSet<Point> getBreakpoints()
          Gets the breakpoint list of this cycle
 Point getEndPoint()
          Gets the end point of this cycle in the permutation
 int getNumber()
          Gets the cycle number (each cycle of a permutation is identified by a number)
 CyclePartition getPartition(int id)
          Gets a partition of this cycle, given its id
 Permutation getPermutation()
          Gets the permutation to which this element belongs
 java.util.SortedSet<Point> getPoints()
          Gets the points of this cycle sorted in ascendant order
 java.util.Iterator<Point> getPointsAsCycle()
          Gets the points of this cycle ordered as a cycle
 Point getStartPoint()
          Gets the start point of this cycle 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)
 int size()
          Gets the number of points in this cycle
 int[] toIntArray()
          Gets a representation of the block as an array of int, with size 2, representing its start and end positions
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getStartPoint

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

Returns:
the start point

getEndPoint

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

Returns:
the end point

getNumber

public int getNumber()
Gets the cycle number (each cycle of a permutation is identified by a number)

Returns:
the cycle number

size

public int size()
Gets the number of points in this cycle

Returns:
the number of points

getBreakpoints

public java.util.SortedSet<Point> getBreakpoints()
Gets the breakpoint list of this cycle

Returns:
a Collection with the list of breakpoints (each breakpoint is represented by a Point)

getPointsAsCycle

public java.util.Iterator<Point> getPointsAsCycle()
Gets the points of this cycle ordered as a cycle

Returns:
an Iterator with the ordered points

getPoints

public java.util.SortedSet<Point> getPoints()
Gets the points of this cycle sorted in ascendant order

Returns:
a SortedSet with the sorted points

getPartition

public CyclePartition getPartition(int id)
Gets a partition of this cycle, given its id

Parameters:
id - the partition id
Returns:
the corresponding cycle partition

toString

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

isAdjacency

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

Returns:
true/false

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

toIntArray

public int[] toIntArray()
Gets a representation of the block as an array of int, with size 2, representing its start 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
Parameters:
object - the other block
Returns:
the result of the comparison, as an int

blocksToIntArrays

public static java.util.Vector<int[]> blocksToIntArrays(java.util.Collection blocks)
Transforms the collection of blocks to a collection of arrays of int (with length = 2)

Parameters:
blocks - a collection of blocks
Returns:
a collection containing the blocks as arrays of int

getPermutation

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

Returns:
the permutation to which this element belongs