baobab.bio.permutation
Class PermutationFormatter

java.lang.Object
  extended by baobab.bio.permutation.PermutationFormatter

public class PermutationFormatter
extends java.lang.Object

The PermutationFormatter class transforms a permutation to formatted strings

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

Method Summary
 java.lang.String getHighlightedString(int start, int end)
          Generates a two-lines string representation of a permutation
 java.lang.String getHighlightedString(int start, int middle, int end)
          Generates a two-lines string representation of a permutation
 java.lang.String getIndexedCycledString()
          Generates a four-lines string representation of a permutation.
 java.lang.String getIndexedHighlightedCycledString(int start, int end)
          Generates a five-lines string representation of a permutation.
 java.lang.String getIndexedHighlightedCycledString(int start, int middle, int end)
          Generates a five-lines string representation of a permutation.
 java.lang.String getIndexedHighlightedString(int start, int end)
          Generates a three-lines string representation of a permutation
 java.lang.String getIndexedHighlightedString(int start, int middle, int end)
          Generates a three-lines string representation of a permutation
 java.lang.String getIndexedString()
          Generates a two-lines string representation of a permutation
 Permutation getPermutation()
           
 java.lang.String getSimpleMappedString()
          Generates a one-line string representation of a permutation with its (mapped) values
 java.lang.String getString()
          Generates a one-line string representation of a permutation
 java.lang.String reversalToString(int start, int end)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPermutation

public Permutation getPermutation()

reversalToString

public java.lang.String reversalToString(int start,
                                         int end)

getString

public java.lang.String getString()
Generates a one-line string representation of a permutation

Example: for the permutation -4,-3,12,-11,-8,9,7,-6,-5,2,-1, we have

 :: -04 -03 +12 -11 -08 +10 +09 +07 -06 -05 +02 -01  :: 5 cycles

Returns:
a string representation

getIndexedString

public java.lang.String getIndexedString()
Generates a two-lines string representation of a permutation

Example: for the permutation -4,-3,12,-11,-8,9,7,-6,-5,2,-1, we have

   01. 02. 03. 04. 05. 06. 07. 08. 09. 10. 11. 12. 13.             (position index)
 :: -04 -03 +12 -11 -08 +10 +09 +07 -06 -05 +02 -01  :: 5 cycles

Returns:
a string representation

getHighlightedString

public java.lang.String getHighlightedString(int start,
                                             int end)
Generates a two-lines string representation of a permutation

Example: for the permutation -4,-3,12,-11,-8,9,7,-6,-5,2,-1, highlighting positions from 9 to 11 makes:

          
 :: -04 -03 +12 -11 -08 +10 +09 +07 -06 -05 +02 -01  :: 5 cycles
                                    --------             (from [9] to [11])
                                     
   01. 02. 03. 04. 05. 06. 07. 08. 09. 10. 11. 12. 13.   (position index, only as reference)                                     

Parameters:
start - the beggining of the block to be highlighted
end - the end of the block to be highlighted
Returns:
a string representation

getHighlightedString

public java.lang.String getHighlightedString(int start,
                                             int middle,
                                             int end)
Generates a two-lines string representation of a permutation

Example: for the permutation -4,-3,12,-11,-8,9,7,-6,-5,2,-1, highlighting positions from 1 to 5, with middle at position 2 makes:

 :: -04 -03 +12 -11 -08 +10 +09 +07 -06 -05 +02 -01  :: 5 cycles
    ---|------------                                     (from [1] to [2] to [5])
 
   01. 02. 03. 04. 05. 06. 07. 08. 09. 10. 11. 12. 13.   (position index, only as reference)

Parameters:
start - the beggining of the block to be highlighted
middle - the middle of the block to be highlighted
end - the end of the block to be highlighted
Returns:
a string representation

getIndexedHighlightedString

public java.lang.String getIndexedHighlightedString(int start,
                                                    int end)
Generates a three-lines string representation of a permutation

Example: for the permutation -4,-3,12,-11,-8,9,7,-6,-5,2,-1, highlighting positions from 9 to 11 makes:

          
   01. 02. 03. 04. 05. 06. 07. 08. 09. 10. 11. 12. 13.                      (position index)
 :: -04 -03 +12 -11 -08 +10 +09 +07 -06 -05 +02 -01  :: 5 cycles
                                    --------             (from [9] to [11])

Parameters:
start - the beggining of the block to be highlighted
end - the end of the block to be highlighted
Returns:
a string representation

getIndexedHighlightedCycledString

public java.lang.String getIndexedHighlightedCycledString(int start,
                                                          int end)
Generates a five-lines string representation of a permutation. The second and the third lines represent the cycles of the breakpoint graph of the permutation. (... represents an adjacency)

Example: for the permutation -4,-3,12,-11,-8,9,7,-6,-5,2,-1, highlighting positions from 9 to 11 makes:

          
   01. 02. 03. 04. 05. 06. 07. 08. 09. 10. 11. 12. 13.                       (position index)
   01> ... 01> <01 03> <02 <03 <02 02> ... 01> <01 <01                       (the cycle numbers, with black edge directions)
   :13 ... :12 :03 :07 :09 :05 :06 :08 ... :01 :11 :04                       (each cycle tour in an arbitrary direction)
 :: -04 -03 +12 -11 -08 +10 +09 +07 -06 -05 +02 -01  :: 5 cycles
                                    --------             (from [9] to [11])

Parameters:
start - the beggining of the block to be highlighted
end - the end of the block to be highlighted
Returns:
a string representation

getIndexedHighlightedString

public java.lang.String getIndexedHighlightedString(int start,
                                                    int middle,
                                                    int end)
Generates a three-lines string representation of a permutation

Example: for the permutation -4,-3,12,-11,-8,9,7,-6,-5,2,-1, highlighting positions from 1 to 5, with middle at position 2 makes:

   01. 02. 03. 04. 05. 06. 07. 08. 09. 10. 11. 12. 13.                            (position index)
 :: -04 -03 +12 -11 -08 +10 +09 +07 -06 -05 +02 -01  :: 5 cycles
    ---|------------                                     (from [1] to [2] to [5])

Parameters:
start - the beggining of the block to be highlighted
middle - the middle of the block to be highlighted
end - the end of the block to be highlighted
Returns:
a string representation

getIndexedHighlightedCycledString

public java.lang.String getIndexedHighlightedCycledString(int start,
                                                          int middle,
                                                          int end)
Generates a five-lines string representation of a permutation. The second and the third lines represent the cycles of the breakpoint graph of the permutation. (... represents an adjacency)

Example: for the permutation -4,-3,12,-11,-8,9,7,-6,-5,2,-1, highlighting positions from 1 to 5, with middle at position 2 makes:

          
   01. 02. 03. 04. 05. 06. 07. 08. 09. 10. 11. 12. 13.                             (position index)
   01> ... 01> <01 03> <02 <03 <02 02> ... 01> <01 <01                             (the cycle numbers, with black edge directions)
   :13 ... :12 :03 :07 :09 :05 :06 :08 ... :01 :11 :04                             (each cycle tour in an arbitrary direction)
 :: -04 -03 +12 -11 -08 +10 +09 +07 -06 -05 +02 -01  :: 5 cycles
    ---|------------                                     (from [1] to [2] to [5])

Parameters:
start - the beggining of the block to be highlighted
middle - the middle of the block to be highlighted
end - the end of the block to be highlighted
Returns:
a string representation

getIndexedCycledString

public java.lang.String getIndexedCycledString()
Generates a four-lines string representation of a permutation. The second and the third lines represent the cycles of the breakpoint graph of the permutation. (... represents an adjacency)

Example: for the permutation -4,-3,12,-11,-8,9,7,-6,-5,2,-1, we have

   01. 02. 03. 04. 05. 06. 07. 08. 09. 10. 11. 12. 13.               (index)
   01> ... 01> <01 03> <02 <03 <02 02> ... 01> <01 <01               (the cycle numbers, with black edge directions)
   :13 ... :12 :03 :07 :09 :05 :06 :08 ... :01 :11 :04               (each cycle tour in an arbitrary direction)
 :: -04 -03 +12 -11 -08 +10 +09 +07 -06 -05 +02 -01  :: 5 cycles

Returns:
a string representation

getSimpleMappedString

public java.lang.String getSimpleMappedString()
Generates a one-line string representation of a permutation with its (mapped) values

Example: for the permutation -4,-3,12,-11,-8,9,7,-6,-5,2,-1, we have

 -4.-3.12.-11.-8.10.9.7.-6.-5.2.-1

Returns:
a string representation