plugins/base1/se.lu.onk/trunk/BaseFile_deprecated/src/basefile/BASEFileSection.java

Code
Comments
Other
Rev Date Author Line
6 10 Oct 05 enell 1 /*
6 10 Oct 05 enell 2  * (non-javadoc) BASEFileSection.java is part of BASEFile.
6 10 Oct 05 enell 3  * 
6 10 Oct 05 enell 4  * BASEFile is free software; you can redistribute it and/or modify it under
6 10 Oct 05 enell 5  * the terms of the GNU General Public License as published by the Free
6 10 Oct 05 enell 6  * Software Foundation; either version 2 of the License, or (at your option)
6 10 Oct 05 enell 7  * any later version.
6 10 Oct 05 enell 8  * 
6 10 Oct 05 enell 9  * BASEFile is distributed in the hope that it will be useful, but WITHOUT ANY
6 10 Oct 05 enell 10  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
6 10 Oct 05 enell 11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
6 10 Oct 05 enell 12  * details.
6 10 Oct 05 enell 13  * 
6 10 Oct 05 enell 14  * You should have received a copy of the GNU General Public License along with
6 10 Oct 05 enell 15  * BASEFile; if not, write to the Free Software Foundation, Inc., 59 Temple
6 10 Oct 05 enell 16  * Place, Suite 330, Boston, MA 02111-1307 USA
6 10 Oct 05 enell 17  * 
6 10 Oct 05 enell 18  * johan.enell@onk.lu.se Johan Enell, Dept Oncology, Lund University, S-221 85
6 10 Oct 05 enell 19  * Lund, Sweden
6 10 Oct 05 enell 20  */
6 10 Oct 05 enell 21 package basefile;
6 10 Oct 05 enell 22
6 10 Oct 05 enell 23 import java.util.ArrayList;
6 10 Oct 05 enell 24 import java.util.Arrays;
248 28 Mar 07 enell 25 import java.util.Collections;
6 10 Oct 05 enell 26 import java.util.HashMap;
6 10 Oct 05 enell 27 import java.util.List;
248 28 Mar 07 enell 28 import java.util.Map;
6 10 Oct 05 enell 29
6 10 Oct 05 enell 30 /**
6 10 Oct 05 enell 31  * This class describes a section in a baseFile created from the BASE database.
6 10 Oct 05 enell 32  * 
6 10 Oct 05 enell 33  * @author Johan Enell
6 10 Oct 05 enell 34  */
6 10 Oct 05 enell 35 /**
6 10 Oct 05 enell 36  * 
6 10 Oct 05 enell 37  * @author Johan Enell, johan.enell@onk.lu.se, Dept Oncology, Lund University,
6 10 Oct 05 enell 38  *         S-221 85 Lund, Sweden
6 10 Oct 05 enell 39  */
6 10 Oct 05 enell 40 public class BASEFileSection
6 10 Oct 05 enell 41 {
6 10 Oct 05 enell 42
6 10 Oct 05 enell 43   /**
6 10 Oct 05 enell 44    * The line number in the inputstream were the section starts
6 10 Oct 05 enell 45    */
97 20 Apr 06 enell 46   private int startLine;
6 10 Oct 05 enell 47
6 10 Oct 05 enell 48   /**
6 10 Oct 05 enell 49    * The line number in the inpustream were the data in the section starts
6 10 Oct 05 enell 50    */
97 20 Apr 06 enell 51   private int dataStartLine;
6 10 Oct 05 enell 52
6 10 Oct 05 enell 53   /**
6 10 Oct 05 enell 54    * The headers in the section put in a HashMap with the parameternames as
6 10 Oct 05 enell 55    * keys.
6 10 Oct 05 enell 56    */
185 12 Oct 06 enell 57   private final HashMap<String, String> headers = new HashMap<String, String>();
6 10 Oct 05 enell 58
6 10 Oct 05 enell 59   /**
248 28 Mar 07 enell 60    * The type of this section. 
248 28 Mar 07 enell 61    */
248 28 Mar 07 enell 62   private String type;
248 28 Mar 07 enell 63
250 30 Mar 07 enell 64   private boolean init = false;
248 28 Mar 07 enell 65
248 28 Mar 07 enell 66   /**
6 10 Oct 05 enell 67    * Creates a new BASEFileSection.
6 10 Oct 05 enell 68    */
250 30 Mar 07 enell 69   @Deprecated
6 10 Oct 05 enell 70   public BASEFileSection()
6 10 Oct 05 enell 71   {
6 10 Oct 05 enell 72     startLine = -1;
6 10 Oct 05 enell 73     dataStartLine = -1;
248 28 Mar 07 enell 74     type = "";
6 10 Oct 05 enell 75   }
6 10 Oct 05 enell 76
250 30 Mar 07 enell 77   /**
250 30 Mar 07 enell 78    * Creates a new BASEFileSection.
250 30 Mar 07 enell 79    */
250 30 Mar 07 enell 80   public BASEFileSection(String type)
250 30 Mar 07 enell 81   {
250 30 Mar 07 enell 82     startLine = -1;
250 30 Mar 07 enell 83     dataStartLine = -1;
250 30 Mar 07 enell 84     this.type = type;
250 30 Mar 07 enell 85   }
250 30 Mar 07 enell 86   
248 28 Mar 07 enell 87   public BASEFileSection(BASEFileSection bfs) throws BASEFileException
248 28 Mar 07 enell 88   {
248 28 Mar 07 enell 89     if (bfs == null)
248 28 Mar 07 enell 90     {
248 28 Mar 07 enell 91       throw new BASEFileException("Can't initiate an assay section with a null section.");
248 28 Mar 07 enell 92     }
248 28 Mar 07 enell 93     startLine = bfs.getStartLine();
248 28 Mar 07 enell 94     dataStartLine = bfs.getDataStartLine();
248 28 Mar 07 enell 95     type = bfs.getType();
248 28 Mar 07 enell 96     setHeaders(bfs.getHeaders());
248 28 Mar 07 enell 97   }
248 28 Mar 07 enell 98
6 10 Oct 05 enell 99   /**
6 10 Oct 05 enell 100    * Find the specified header from the headers and return it as an int.
6 10 Oct 05 enell 101    * 
6 10 Oct 05 enell 102    * @param name
6 10 Oct 05 enell 103    *            The name of the header
6 10 Oct 05 enell 104    * @return the option value as an int
6 10 Oct 05 enell 105    * @throws NumberFormatException
6 10 Oct 05 enell 106    *             If the option is not an integer
6 10 Oct 05 enell 107    */
105 02 Jun 06 enell 108   public final Integer findIntOpt(String name)
105 02 Jun 06 enell 109     throws NumberFormatException
6 10 Oct 05 enell 110   {
6 10 Oct 05 enell 111     String ret = headers.get(name);
6 10 Oct 05 enell 112     try
6 10 Oct 05 enell 113     {
105 02 Jun 06 enell 114       return new Integer(ret);
6 10 Oct 05 enell 115     }
6 10 Oct 05 enell 116     catch (NumberFormatException e)
6 10 Oct 05 enell 117     {
264 27 Apr 07 enell 118       throw new NumberFormatException("The value of parameter '" + name + "' is not an int: " + ret);
6 10 Oct 05 enell 119     }
6 10 Oct 05 enell 120   }
6 10 Oct 05 enell 121
6 10 Oct 05 enell 122   /**
6 10 Oct 05 enell 123    * Find the specified header from the headers and return it as a float.
6 10 Oct 05 enell 124    * 
6 10 Oct 05 enell 125    * @param name
6 10 Oct 05 enell 126    *            The name of the header
6 10 Oct 05 enell 127    * @return the option value as a float
6 10 Oct 05 enell 128    * @throws NumberFormatException
6 10 Oct 05 enell 129    *             If the option is not a float
6 10 Oct 05 enell 130    */
105 02 Jun 06 enell 131   public Float findFloatOpt(String name)
105 02 Jun 06 enell 132     throws NumberFormatException
6 10 Oct 05 enell 133   {
6 10 Oct 05 enell 134     String ret = headers.get(name);
105 02 Jun 06 enell 135     return new Float(ret);
6 10 Oct 05 enell 136   }
6 10 Oct 05 enell 137
6 10 Oct 05 enell 138   /**
6 10 Oct 05 enell 139    * Find the specified header from the headers and return it as a String.
6 10 Oct 05 enell 140    * 
6 10 Oct 05 enell 141    * @param name
6 10 Oct 05 enell 142    *            The name of the header
6 10 Oct 05 enell 143    * @return the option value as a String
6 10 Oct 05 enell 144    */
97 20 Apr 06 enell 145   public final String findStringOpt(String name)
6 10 Oct 05 enell 146   {
6 10 Oct 05 enell 147     String ret = headers.get(name);
6 10 Oct 05 enell 148     return ret;
6 10 Oct 05 enell 149   }
6 10 Oct 05 enell 150
6 10 Oct 05 enell 151   /**
6 10 Oct 05 enell 152    * Find the specified header from the headers and return it as a String[].
6 10 Oct 05 enell 153    * The values is separated by the tab (\u0009) character.
6 10 Oct 05 enell 154    * 
6 10 Oct 05 enell 155    * @param name
6 10 Oct 05 enell 156    *            The name of the header
6 10 Oct 05 enell 157    * @return the option value as a String
6 10 Oct 05 enell 158    */
97 20 Apr 06 enell 159   public final String[] findStringOpts(String name)
6 10 Oct 05 enell 160   {
106 13 Jun 06 enell 161     return findStringOpts(name, "\t");
6 10 Oct 05 enell 162   }
106 13 Jun 06 enell 163   
106 13 Jun 06 enell 164   /**
106 13 Jun 06 enell 165    * Find the specified header from the headers and return it as a String[].
106 13 Jun 06 enell 166    * The values is separated by the del String.
106 13 Jun 06 enell 167    * 
106 13 Jun 06 enell 168    * @param name The name of the header
106 13 Jun 06 enell 169    * @param del The string that splits the value. Using the method String.split()
106 13 Jun 06 enell 170    * @return the option value as a String or null if name isnt found in the headers
106 13 Jun 06 enell 171    */
106 13 Jun 06 enell 172   public final String[] findStringOpts(String name, String del)
106 13 Jun 06 enell 173   {
106 13 Jun 06 enell 174     String value = headers.get(name);
106 13 Jun 06 enell 175     if (value != null)
106 13 Jun 06 enell 176     {
106 13 Jun 06 enell 177       return value.split(del);
106 13 Jun 06 enell 178     }
106 13 Jun 06 enell 179     return null;
106 13 Jun 06 enell 180   }
6 10 Oct 05 enell 181
6 10 Oct 05 enell 182   /**
6 10 Oct 05 enell 183    * Find the specified header from the headers and return it as a boolean.
6 10 Oct 05 enell 184    * 
6 10 Oct 05 enell 185    * @param name
6 10 Oct 05 enell 186    *            The name of the header
6 10 Oct 05 enell 187    * @return the option value as a boolean
6 10 Oct 05 enell 188    * @throws NumberFormatException
6 10 Oct 05 enell 189    *             If the option is not a boolean
6 10 Oct 05 enell 190    */
97 20 Apr 06 enell 191   public final boolean findBooleanOpt(String name)
6 10 Oct 05 enell 192   {
6 10 Oct 05 enell 193     String ret = headers.get(name);
6 10 Oct 05 enell 194
6 10 Oct 05 enell 195     boolean value = false;
6 10 Oct 05 enell 196     try
6 10 Oct 05 enell 197     {
6 10 Oct 05 enell 198       value = Boolean.valueOf(ret).booleanValue();
6 10 Oct 05 enell 199     }
6 10 Oct 05 enell 200     catch (NumberFormatException e)
6 10 Oct 05 enell 201     {
6 10 Oct 05 enell 202       throw new NumberFormatException("The value of parameter " + name + " is not a boolean: " + ret);
6 10 Oct 05 enell 203     }
6 10 Oct 05 enell 204     return value;
6 10 Oct 05 enell 205   }
6 10 Oct 05 enell 206
6 10 Oct 05 enell 207   /**
6 10 Oct 05 enell 208    * Used to get the values from a header as a {@link java.util.List<String>}. 
6 10 Oct 05 enell 209    * The order is the same as in the basefile if the user hasent changed it.
6 10 Oct 05 enell 210    * 
6 10 Oct 05 enell 211    * @param name
6 10 Oct 05 enell 212    *            The name of the header
6 10 Oct 05 enell 213    * @return A list of the values.
6 10 Oct 05 enell 214    */
97 20 Apr 06 enell 215   public final List<String> findFieldList(String name)
6 10 Oct 05 enell 216   {
6 10 Oct 05 enell 217     String s = headers.get(name);
6 10 Oct 05 enell 218     if (s == null) return null;
269 15 May 07 enell 219     if (s.equals("")) return new ArrayList<String>();
6 10 Oct 05 enell 220     return new ArrayList<String>(Arrays.asList(s.split("\\t")));
6 10 Oct 05 enell 221
6 10 Oct 05 enell 222   }
6 10 Oct 05 enell 223
6 10 Oct 05 enell 224   /**
94 05 Apr 06 enell 225    * Used to get the values from a header as a {@link java.util.List<Integer>}. 
94 05 Apr 06 enell 226    * The order is the same as in the basefile if the user hasent changed it.
94 05 Apr 06 enell 227    * 
94 05 Apr 06 enell 228    * @param name
94 05 Apr 06 enell 229    *            The name of the header
94 05 Apr 06 enell 230    * @return A list of the values.
94 05 Apr 06 enell 231    */
97 20 Apr 06 enell 232   public final List<Integer> findFieldIntList(String name)
94 05 Apr 06 enell 233   {
269 15 May 07 enell 234     List<String> stringList = this.findFieldList(name);
269 15 May 07 enell 235     if (stringList == null) return null;
94 05 Apr 06 enell 236     ArrayList<Integer> ret = new ArrayList<Integer>();
269 15 May 07 enell 237     for (String assay : stringList)
94 05 Apr 06 enell 238     {
94 05 Apr 06 enell 239       ret.add(new Integer(assay));
94 05 Apr 06 enell 240     }
94 05 Apr 06 enell 241     return ret;
94 05 Apr 06 enell 242   }
94 05 Apr 06 enell 243
94 05 Apr 06 enell 244   /**
6 10 Oct 05 enell 245    * Puts a header in the header map. The header is stored as a String using
6 10 Oct 05 enell 246    * the Object.toString() method. If the map previously contained a mapping
6 10 Oct 05 enell 247    * for this key, the old value is replaced.
6 10 Oct 05 enell 248    * 
6 10 Oct 05 enell 249    * @param key
6 10 Oct 05 enell 250    *            key with which the specified value is to be associated.
6 10 Oct 05 enell 251    * @param value
6 10 Oct 05 enell 252    *            value to be associated with the specified key.
6 10 Oct 05 enell 253    * @return previous value associated with specified key, or null if there
6 10 Oct 05 enell 254    *         was no mapping for key. A null return can also indicate that the
6 10 Oct 05 enell 255    *         HashMap previously associated null with the specified key.
6 10 Oct 05 enell 256    */
97 20 Apr 06 enell 257   public final String setHeader(Object key, Object value)
6 10 Oct 05 enell 258   {
248 28 Mar 07 enell 259     String ret = "";
248 28 Mar 07 enell 260     if ("section".equals(key))
248 28 Mar 07 enell 261     {
248 28 Mar 07 enell 262       ret = this.getType();
248 28 Mar 07 enell 263       this.setType(value.toString());
248 28 Mar 07 enell 264     }
248 28 Mar 07 enell 265     else
248 28 Mar 07 enell 266     {
248 28 Mar 07 enell 267       ret = headers.put(key.toString(), value.toString());
248 28 Mar 07 enell 268     }
248 28 Mar 07 enell 269     return ret;
6 10 Oct 05 enell 270   }
6 10 Oct 05 enell 271
6 10 Oct 05 enell 272   /**
6 10 Oct 05 enell 273    * Puts a header in the header map. The header is stored as a String using
6 10 Oct 05 enell 274    * the Object.toString() method. All the Object in the array is conbined the
6 10 Oct 05 enell 275    * with a tabulation character '\t'. If the map previously contained a
6 10 Oct 05 enell 276    * mapping for this key, the old value is replaced.
6 10 Oct 05 enell 277    * 
6 10 Oct 05 enell 278    * @param key
6 10 Oct 05 enell 279    *            key with which the specified value is to be associated.
6 10 Oct 05 enell 280    * @param value
6 10 Oct 05 enell 281    *            values to be associated with the specified key.
6 10 Oct 05 enell 282    * @return previous value associated with specified key, or null if there
6 10 Oct 05 enell 283    *         was no mapping for key. A null return can also indicate that the
6 10 Oct 05 enell 284    *         HashMap previously associated null with the specified key.
6 10 Oct 05 enell 285    */
97 20 Apr 06 enell 286   public final String setHeader(Object key, Object... value)
6 10 Oct 05 enell 287   {
25 21 Oct 05 enell 288     return this.setHeader(key, '\t', value);
6 10 Oct 05 enell 289   }
6 10 Oct 05 enell 290
6 10 Oct 05 enell 291   /**
6 10 Oct 05 enell 292    * Puts a header in the header map. The header is stored as a String using
6 10 Oct 05 enell 293    * the Object.toString() method. All the Object in the array is conbined the
6 10 Oct 05 enell 294    * with the character c. If the map previously contained a mapping for this
6 10 Oct 05 enell 295    * key, the old value is replaced.
6 10 Oct 05 enell 296    * 
6 10 Oct 05 enell 297    * @param key
6 10 Oct 05 enell 298    *            key with which the specified value is to be associated.
25 21 Oct 05 enell 299    * @param c
25 21 Oct 05 enell 300    *            the character used to combine the value array.
6 10 Oct 05 enell 301    * @param value
6 10 Oct 05 enell 302    *            values to be associated with the specified key.
6 10 Oct 05 enell 303    * @return previous value associated with specified key, or null if there
6 10 Oct 05 enell 304    *         was no mapping for key. A null return can also indicate that the
6 10 Oct 05 enell 305    *         HashMap previously associated null with the specified key.
6 10 Oct 05 enell 306    */
97 20 Apr 06 enell 307   public final String setHeader(Object key, char c, Object... value)
6 10 Oct 05 enell 308   {
6 10 Oct 05 enell 309     StringBuffer s = new StringBuffer("");
6 10 Oct 05 enell 310     if (value.length > 0)
6 10 Oct 05 enell 311     {
6 10 Oct 05 enell 312       s = new StringBuffer(value[0].toString());
6 10 Oct 05 enell 313       for (int i = 1; i < value.length; i++)
6 10 Oct 05 enell 314       {
6 10 Oct 05 enell 315         s.append(c);
6 10 Oct 05 enell 316         s.append(value[i]);
6 10 Oct 05 enell 317       }
6 10 Oct 05 enell 318     }
6 10 Oct 05 enell 319     return this.setHeader(key, s);
6 10 Oct 05 enell 320   }
6 10 Oct 05 enell 321
97 20 Apr 06 enell 322   public final String getHeader(Object key)
6 10 Oct 05 enell 323   {
6 10 Oct 05 enell 324     return this.headers.get(key.toString());
6 10 Oct 05 enell 325   }
248 28 Mar 07 enell 326   
248 28 Mar 07 enell 327   public final Map<String, String> getHeaders()
248 28 Mar 07 enell 328   {
248 28 Mar 07 enell 329     return Collections.unmodifiableMap(this.headers);
248 28 Mar 07 enell 330   }
6 10 Oct 05 enell 331
97 20 Apr 06 enell 332   public final String removeHeader(Object key)
6 10 Oct 05 enell 333   {
18 18 Oct 05 enell 334     if (key.equals("section"))
18 18 Oct 05 enell 335     {
18 18 Oct 05 enell 336       return "";
18 18 Oct 05 enell 337     }
6 10 Oct 05 enell 338     return headers.remove(key.toString());
6 10 Oct 05 enell 339   }
6 10 Oct 05 enell 340
248 28 Mar 07 enell 341   final boolean setHeaders(Map<String, String> headers)
97 20 Apr 06 enell 342   {
185 12 Oct 06 enell 343     if (headers == null)
185 12 Oct 06 enell 344     {
185 12 Oct 06 enell 345       return false;
185 12 Oct 06 enell 346     }
185 12 Oct 06 enell 347     this.headers.clear();
185 12 Oct 06 enell 348     for (String key : headers.keySet())
185 12 Oct 06 enell 349     {
248 28 Mar 07 enell 350       this.setHeader(key, headers.get(key));
185 12 Oct 06 enell 351     }
97 20 Apr 06 enell 352     return true;
97 20 Apr 06 enell 353   }
248 28 Mar 07 enell 354   
248 28 Mar 07 enell 355   public int getColIndex(String header, String col) throws BASEFileException
248 28 Mar 07 enell 356   {
248 28 Mar 07 enell 357     List<String> l = this.findFieldList(header);
248 28 Mar 07 enell 358     if (l == null) throw new BASEFileException("Can't find header "+header);
248 28 Mar 07 enell 359     int index = l.indexOf(col);
248 28 Mar 07 enell 360     if (index == -1) throw new BASEFileException("Can't find column "+col+" in header "+header);
248 28 Mar 07 enell 361     return index;
248 28 Mar 07 enell 362   }
97 20 Apr 06 enell 363
6 10 Oct 05 enell 364   /**
97 20 Apr 06 enell 365    * Get the type of the section.
6 10 Oct 05 enell 366    * 
97 20 Apr 06 enell 367    * @return The value of the header 'section'
6 10 Oct 05 enell 368    */
97 20 Apr 06 enell 369   public final String getType()
6 10 Oct 05 enell 370   {
248 28 Mar 07 enell 371     return type;
6 10 Oct 05 enell 372   }
250 30 Mar 07 enell 373   
250 30 Mar 07 enell 374   protected boolean isInitiated()
250 30 Mar 07 enell 375   {
250 30 Mar 07 enell 376     return init;
250 30 Mar 07 enell 377   }
6 10 Oct 05 enell 378
97 20 Apr 06 enell 379   /**
248 28 Mar 07 enell 380    * Checks the type of this section.
248 28 Mar 07 enell 381    * 
248 28 Mar 07 enell 382    * @param string the type to test
248 28 Mar 07 enell 383    * @return true if type matches string
97 20 Apr 06 enell 384    */
97 20 Apr 06 enell 385   public final boolean isType(String string)
97 20 Apr 06 enell 386   {
97 20 Apr 06 enell 387     return getType().equals(string);
97 20 Apr 06 enell 388   }
248 28 Mar 07 enell 389   
248 28 Mar 07 enell 390   /**
248 28 Mar 07 enell 391    * Sets the type of this section.
248 28 Mar 07 enell 392    * 
248 28 Mar 07 enell 393    * @return the new type
248 28 Mar 07 enell 394    */
250 30 Mar 07 enell 395   @Deprecated
248 28 Mar 07 enell 396   public final void setType(String type)
248 28 Mar 07 enell 397   {
248 28 Mar 07 enell 398     this.type = type;
248 28 Mar 07 enell 399   }
105 02 Jun 06 enell 400
97 20 Apr 06 enell 401   public final int getDataStartLine()
97 20 Apr 06 enell 402   {
97 20 Apr 06 enell 403     return dataStartLine;
97 20 Apr 06 enell 404   }
97 20 Apr 06 enell 405
248 28 Mar 07 enell 406   @Deprecated
97 20 Apr 06 enell 407   public final void setDataStartLine(int dataStartLine)
97 20 Apr 06 enell 408   {
97 20 Apr 06 enell 409     this.dataStartLine = dataStartLine;
97 20 Apr 06 enell 410   }
97 20 Apr 06 enell 411   public final int getStartLine()
97 20 Apr 06 enell 412   {
97 20 Apr 06 enell 413     return startLine;
97 20 Apr 06 enell 414   }
248 28 Mar 07 enell 415   
97 20 Apr 06 enell 416   public final void setStartLine(int startLine)
97 20 Apr 06 enell 417   {
97 20 Apr 06 enell 418     this.startLine = startLine;
97 20 Apr 06 enell 419   }
97 20 Apr 06 enell 420
103 01 Jun 06 enell 421   public void clear()
103 01 Jun 06 enell 422   {
103 01 Jun 06 enell 423     this.headers.clear();
103 01 Jun 06 enell 424     startLine = -1;
103 01 Jun 06 enell 425     dataStartLine = -1;
103 01 Jun 06 enell 426   }
103 01 Jun 06 enell 427
31 08 Nov 05 enell 428   @Override
6 10 Oct 05 enell 429   public String toString()
6 10 Oct 05 enell 430   {
6 10 Oct 05 enell 431     String ret = "section\t" + this.getType() + "\n";
6 10 Oct 05 enell 432
6 10 Oct 05 enell 433     for (String key : headers.keySet())
6 10 Oct 05 enell 434     {
248 28 Mar 07 enell 435       ret += key + "\t" + headers.get(key) + "\n";
6 10 Oct 05 enell 436     }
6 10 Oct 05 enell 437     ret += "%";
6 10 Oct 05 enell 438
6 10 Oct 05 enell 439     return ret;
6 10 Oct 05 enell 440   }
250 30 Mar 07 enell 441
250 30 Mar 07 enell 442   protected void init() throws BASEFileException
250 30 Mar 07 enell 443   {
250 30 Mar 07 enell 444     if (init)
250 30 Mar 07 enell 445     {
250 30 Mar 07 enell 446       throw new BASEFileException("This section has already been initiated");
250 30 Mar 07 enell 447     }
250 30 Mar 07 enell 448     init  = true;
250 30 Mar 07 enell 449   }
250 30 Mar 07 enell 450
250 30 Mar 07 enell 451   public void validate() throws BASEFileException
250 30 Mar 07 enell 452   {}
6 10 Oct 05 enell 453 }