Class BasicLineMapParser<K,T>

java.lang.Object
ubic.gemma.core.loader.util.parser.BasicLineMapParser<K,T>
All Implemented Interfaces:
LineParser<T>, Parser<T>
Direct Known Subclasses:
AffyProbeReader, IlluminaProbeReader, LineMapParser, NcbiGeneEnsemblFileParser, NcbiGeneHistoryParser, NcbiGeneInfoParser, ProbeSequenceParser, TaxonParser

public abstract class BasicLineMapParser<K,T> extends Object implements LineParser<T>
A line parser that produces a Map instead of a Collection. Subclasses must provide a method to generate keys, which is generated from the values. A typical use case of this is when the keys are also known to another class that needs the data provided by the parser; to locate the data it uses the key.
Author:
pavlidis
  • Field Details

    • COMMENT_MARK

      protected static final String COMMENT_MARK
      Lines starting with this will be ignored.
      See Also:
    • log

      protected final org.apache.commons.logging.Log log
  • Constructor Details

    • BasicLineMapParser

      public BasicLineMapParser()
  • Method Details

    • containsKey

      public abstract boolean containsKey(K key)
    • get

      public abstract T get(K key)
    • getKeySet

      public abstract Collection<K> getKeySet()
    • getResults

      public abstract Collection<T> getResults()
      Specified by:
      getResults in interface Parser<K>
      Returns:
      the results of the parse.
    • parse

      public void parse(File file) throws IOException
      Description copied from interface: Parser
      Parse a File
      Specified by:
      parse in interface Parser<K>
      Parameters:
      file - file
      Throws:
      IOException - if there is a problem while manipulating the file
    • parse

      public void parse(InputStream is) throws IOException
      Description copied from interface: Parser
      Parse a InputStream.
      Specified by:
      parse in interface Parser<K>
      Parameters:
      is - input stream
      Throws:
      IOException - if there is a problem while manipulating the file
    • parse

      public void parse(String filename) throws IOException
      Description copied from interface: Parser
      Parse a file identified by its path.
      Specified by:
      parse in interface Parser<K>
      Parameters:
      filename - Absolute path to the file
      Throws:
      IOException - if there is a problem while manipulating the file
    • parseOneLine

      public abstract T parseOneLine(String line)
      Description copied from interface: LineParser
      Handle the parsing of a single line from the input.
      Specified by:
      parseOneLine in interface LineParser<K>
      Parameters:
      line - line to parse
      Returns:
      parsed object
    • getKey

      protected abstract K getKey(T newItem)
    • put

      protected abstract void put(K key, T value)