org.ahmadsoft.postal
Class DiskStrategy
java.lang.Object
org.ahmadsoft.postal.DiskStrategy
- All Implemented Interfaces:
- PostalRetrievalStrategy
public class DiskStrategy
- extends java.lang.Object
- implements PostalRetrievalStrategy
A retrieval strategy that looks up from disk every time. There is
almost no reason to use this strategy except in an interactive program
because, due to the fact that lookups are synchronized, and that every
lookup results in a disk access, its time characteristics are very poor.
However, its space requirements are constant.
- Author:
- Amin Ahmad
Method Summary |
void |
dispose()
|
java.util.List |
getCandidates(int postalCode)
Retrieves a list of candidate cities for a
specified postal code. |
void |
initialize(java.io.File _indexFile,
java.io.File _dataFile)
Initializes the retrieval strategy with the
postal code index and data files. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DiskStrategy
public DiskStrategy()
initialize
public void initialize(java.io.File _indexFile,
java.io.File _dataFile)
throws java.lang.Exception
- Description copied from interface:
PostalRetrievalStrategy
- Initializes the retrieval strategy with the
postal code index and data files.
- Specified by:
initialize
in interface PostalRetrievalStrategy
- Throws:
java.lang.Exception
getCandidates
public java.util.List getCandidates(int postalCode)
- Description copied from interface:
PostalRetrievalStrategy
- Retrieves a list of candidate cities for a
specified postal code.
- Specified by:
getCandidates
in interface PostalRetrievalStrategy
- Parameters:
postalCode
- the postal code.
- Returns:
- a list of candidate cities.
dispose
public void dispose()
throws java.lang.Exception
- Specified by:
dispose
in interface PostalRetrievalStrategy
- Throws:
java.lang.Exception
Copyright © 2006-2009 Ahmadsoft. All Rights Reserved.