databionics.io
Class MapFile

java.lang.Object
  extended by databionics.io.BaseFile
      extended by databionics.io.ListFile
          extended by databionics.io.MapFile
Direct Known Subclasses:
BMFile, ClassmaskFile, ClsFile, NamesFile, PicturesFile

public abstract class MapFile
extends ListFile

Base class for files with lists that need fast access by index. This is done by an additional Map.


Field Summary
protected static org.apache.log4j.Logger log
          Log4j logging.
protected  java.util.Map map
          Hashtable with data.
 
Fields inherited from class databionics.io.ListFile
data
 
Fields inherited from class databionics.io.BaseFile
allowEmptyLines, comment, commentPrefix, delimiter, delimiters, file, header, headerPrefix, loc, nf
 
Constructor Summary
MapFile()
          Standard constructor
MapFile(java.lang.String filename)
          Constructor with a filename
 
Method Summary
 void add(DataItem item)
          Add item to list and map.
 java.util.Map getMap()
          Get the data in the map.
 void remove(DataItem item)
          Remove item from list and map.
 void remove(int index)
          Remove item by index from list and map.
 void setData(java.util.List data)
          Change the data in the list and the map.
 void setMap(java.util.Map map)
          Change the data in the map and the list.
 
Methods inherited from class databionics.io.ListFile
buildLine, getData, getSize
 
Methods inherited from class databionics.io.BaseFile
buildHeader, checkHeader, checkHeaderAgainstSize, getComment, getFile, getFilename, getHeader, getLocale, getNumberFormat, init, isHeader, isNaN, isNumber, load, load, parseError, parseHeader, parseLine, save, save, setComment, setFilename, setLocale, writeStringList, writeStringList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.log4j.Logger log
Log4j logging.


map

protected java.util.Map map
Hashtable with data.

Constructor Detail

MapFile

public MapFile()
Standard constructor


MapFile

public MapFile(java.lang.String filename)
Constructor with a filename

Parameters:
filename - Name of the file
Method Detail

getMap

public java.util.Map getMap()
Get the data in the map.


setMap

public void setMap(java.util.Map map)
Change the data in the map and the list.

Parameters:
map - Map with the data items

setData

public void setData(java.util.List data)
Change the data in the list and the map.

Overrides:
setData in class ListFile
Parameters:
data - List with the data items

remove

public void remove(DataItem item)
Remove item from list and map.

Parameters:
item - Item to remove

remove

public void remove(int index)
Remove item by index from list and map.

Parameters:
index - Index field of item

add

public void add(DataItem item)
Add item to list and map.

Parameters:
index - Item to add


Copyright © 2005-2006 Databionics Research Group. All Rights Reserved.