SimpleIndex (BioJava-1.5-beta API)
Keywords: org.biojava.bio.seq.db.SimpleIndex class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.biojava.bio.seq.db
Class SimpleIndex

    java.lang.Object
      org.biojava.bio.seq.db.SimpleIndex

All Implemented Interfaces:
  Index

    public class SimpleIndex

extends Object
implements Index

This is a no-frills implementation of the Index interface.

The file, start and ID are explicitly maintained as immutable properties of the index. This implementation should be appropriate for many indexing schemes. However, some schemes may wish to implement this interface as a wrapper around a simple file offset, or an array index.

Author:
  Matthew Pocock

Constructor Summary
`SimpleIndex(File file, long start, int length, String id)` Build the index using the given file, start and id

Method Summary
`File` | `getFile()` The file to retrieve from.
`String` | `getID()` The ID of the sequence at this position in this file.
`int` | `getLength()` The entry can be slurped out of the file by grabbing length bytes from start.
`long` | `getStart()` Skipping this number of bytes through the file should put the file pointer to the first byte of the sequence.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SimpleIndex

    public SimpleIndex(File file,
                       long start,
                       int length,
                       String id)

  Build the index using the given file, start and id

  Parameters:
    `file` - the File this sequence is in
    `start` - how many bytes to skip to reach the first byte of the sequence
    `length` - how many bytes can be pulled out of the file to grab the record
    `id` - the ID of the sequence

Method Detail

### getFile

    public File getFile()

  Description copied from interface: `Index`
  The file to retrieve from.

  Specified by:
    `getFile` in interface `Index`
  Returns:
    the File containing this Sequence

### getStart

    public long getStart()

  Description copied from interface: `Index`
  Skipping this number of bytes through the file should put the file pointer to the first byte of the sequence.

  Specified by:
    `getStart` in interface `Index`
  Returns:
    the offset within the file

### getLength

    public int getLength()

  Description copied from interface: `Index`
  The entry can be slurped out of the file by grabbing length bytes from start. If the length can't be read from a store then this method should return -1.

  Specified by:
    `getLength` in interface `Index`
  Returns:
    the length in bytes of this indexed entry

### getID

    public String getID()

  Description copied from interface: `Index`
  The ID of the sequence at this position in this file.

  Specified by:
    `getID` in interface `Index`
  Returns:
    the ID of the indexed Sequence

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD