001/* 002 * BioJava development code 003 * 004 * This code may be freely distributed and modified under the 005 * terms of the GNU Lesser General Public Licence. This should 006 * be distributed with the code. If you do not have a copy, 007 * see: 008 * 009 * http://www.gnu.org/copyleft/lesser.html 010 * 011 * Copyright for this code is held jointly by the individual 012 * authors. These should be listed in @author doc comments. 013 * 014 * For more information on the BioJava project and its aims, 015 * or to join the biojava-l mailing list, visit the home page 016 * at: 017 * 018 * http://www.biojava.org/ 019 * 020 */ 021 022package org.biojava.bio.program.tagvalue; 023 024import org.biojava.utils.ParserException; 025 026/** 027 * <p> 028 * Tokenize single records (lines of text, objects) into a tag and a value. 029 * </p> 030 * 031 * <p> 032 * TagValueParser instances may be stateful, that is they may remember 033 * previous values of tags or values, and return different TagValue responses 034 * accordingly. 035 * </p> 036 * 037 * @author Matthew Pocock 038 * @author Keith James 039 * @since 1.2 040 */ 041public interface TagValueParser { 042 /** 043 * <p><code>EMPTY_LINE_EOR</code> is a special EOR value which 044 * allows an empty line to be used as a record separator. Normally 045 * this is not possible as the empty line will be swallowed by the 046 * preceding tag or value. Use this as an argument to the 047 * <code>setEndOfRecord</code> method.</p> 048 * 049 * <p>An empty line is defined as a line which contains nothing 050 * between the start and the following system-defined line 051 * separator. Therefore lines which contain only whitespace are 052 * not considererd to be empty.</p> 053 */ 054 public static final String EMPTY_LINE_EOR = ""; 055 056 public TagValue parse(Object record) 057 throws ParserException; 058}