src/core/net/sf/basedb/util/basefile/BaseFileSectionParser.java

Code
Comments
Other
Rev Date Author Line
5093 10 Sep 09 nicklas 1 /**
5093 10 Sep 09 nicklas 2   $Id$
5093 10 Sep 09 nicklas 3
5093 10 Sep 09 nicklas 4   Copyright (C) 2009 Nicklas Nordborg
5093 10 Sep 09 nicklas 5
5093 10 Sep 09 nicklas 6   This file is part of BASE - BioArray Software Environment.
5093 10 Sep 09 nicklas 7   Available at http://base.thep.lu.se/
5093 10 Sep 09 nicklas 8
5093 10 Sep 09 nicklas 9   BASE is free software; you can redistribute it and/or
5093 10 Sep 09 nicklas 10   modify it under the terms of the GNU General Public License
5093 10 Sep 09 nicklas 11   as published by the Free Software Foundation; either version 3
5093 10 Sep 09 nicklas 12   of the License, or (at your option) any later version.
5093 10 Sep 09 nicklas 13
5093 10 Sep 09 nicklas 14   BASE is distributed in the hope that it will be useful,
5093 10 Sep 09 nicklas 15   but WITHOUT ANY WARRANTY; without even the implied warranty of
5093 10 Sep 09 nicklas 16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
5093 10 Sep 09 nicklas 17   GNU General Public License for more details.
5093 10 Sep 09 nicklas 18
5093 10 Sep 09 nicklas 19   You should have received a copy of the GNU General Public License
5093 10 Sep 09 nicklas 20   along with BASE. If not, see <http://www.gnu.org/licenses/>.
5093 10 Sep 09 nicklas 21 */
5093 10 Sep 09 nicklas 22 package net.sf.basedb.util.basefile;
5093 10 Sep 09 nicklas 23
5093 10 Sep 09 nicklas 24 import java.io.IOException;
5093 10 Sep 09 nicklas 25
5590 16 Mar 11 nicklas 26 import net.sf.basedb.core.signal.ThreadSignalHandler;
5093 10 Sep 09 nicklas 27 import net.sf.basedb.util.parser.FlatFileParser;
5093 10 Sep 09 nicklas 28
5093 10 Sep 09 nicklas 29 /**
5093 10 Sep 09 nicklas 30   A section parser is responsible for parsing and collecting data
5093 10 Sep 09 nicklas 31   that is found in a section in a serial or matrix BASEfile. A
5093 10 Sep 09 nicklas 32   section parser should check for user abort by calling {@link 
5590 16 Mar 11 nicklas 33   ThreadSignalHandler#checkInterrupted()} at regular intervals. The parser
5093 10 Sep 09 nicklas 34   should also update progress by calling {@link BaseFileParser#setProgress(long, String)}.
5093 10 Sep 09 nicklas 35   Note that progress should be reported as the number of bytes parsed,
5093 10 Sep 09 nicklas 36   which can simply can be retreived by calling {@link FlatFileParser#getParsedBytes()}.
5093 10 Sep 09 nicklas 37
5093 10 Sep 09 nicklas 38   @author Nicklas
5093 10 Sep 09 nicklas 39   @version 2.14
5093 10 Sep 09 nicklas 40   @base.modified $Date$
5093 10 Sep 09 nicklas 41 */
5093 10 Sep 09 nicklas 42 public interface BaseFileSectionParser
5093 10 Sep 09 nicklas 43 {
5093 10 Sep 09 nicklas 44   /**
5093 10 Sep 09 nicklas 45     Parse the current section. The current parse position is right
5093 10 Sep 09 nicklas 46     after the section marker. If the section contains headers the
5093 10 Sep 09 nicklas 47     {@link FlatFileParser#parseHeaders()} must be called. Use 
5093 10 Sep 09 nicklas 48     {@link FlatFileParser#nextData()} to parse data lines.
5093 10 Sep 09 nicklas 49     
5093 10 Sep 09 nicklas 50     @param parser The master BASEfile parser (can be used for
5093 10 Sep 09 nicklas 51       reporting progress, checking for interrupts, etc.)
5093 10 Sep 09 nicklas 52     @param ffp The actual file parser, use this to get the data
5093 10 Sep 09 nicklas 53     @throws IOException If there is a problem reading the data
5093 10 Sep 09 nicklas 54   */
5093 10 Sep 09 nicklas 55   public void parseSection(BaseFileParser parser, FlatFileParser ffp)
5093 10 Sep 09 nicklas 56     throws IOException;
5093 10 Sep 09 nicklas 57   
5093 10 Sep 09 nicklas 58 }