View Javadoc

1   package uk.ac.ebi.intenz.tools.sib.writer;
2   
3   /**
4    * Defines a method to retrieve the next line wrapping position.
5    * <p/>
6    * Unfortunately the line wrapping "rules" applied manually are sometimes following the sole rule:
7    * <p/>
8    * <center><b><code>if (looks nice) then wrap();</code></b></center>
9    * <p/>which makes it impossible to create an identical flat file in an
10   * automated way.<br/>
11   * Therefore the wrapping classes implementing this interface should try to cover all manual line wrapping rules which
12   * do not follow this rule.
13   * <p>
14   * The line wrapping rules are defined in the following PDF file:<p/>
15   * &nbsp;&nbsp;&nbsp;&bull;&nbsp;&nbsp;<a href="../../../../../../../pdf/enzyme_LW_rules.pdf">enzyme_LW_rules.pdf</a> (preliminary version,
16   * i.e. not approved by Amos)
17   *
18   * @author Michael Darsow
19   * @version $Revision: 1.2 $ $Date: 2008/01/28 11:43:23 $
20   */
21  public interface LineWrapper {
22    /**
23     * Returns the next position in the line where the wrapping should be performed.
24     * <p/>
25     * This method is supposed to be used by a {@link LineFormatter LineFormatter} implementation within
26     * a loop as long as the text does not fit into one line.
27     *  
28     * @param text The text to be wrapped.
29     * @param netLineWidth Net line width (w/o line header in the begining).
30     * @return athe line break position.
31     * @throws EnzymeFlatFileWriteException if an error occured during this process.
32     */
33    int findPosition(String text, int netLineWidth) throws EnzymeFlatFileWriteException;
34  }