org.ahmadsoft.postal
Class ReadOnceStrategy
java.lang.Object
org.ahmadsoft.postal.ReadOnceStrategy
- All Implemented Interfaces:
- PostalRetrievalStrategy
public class ReadOnceStrategy
- extends java.lang.Object
- implements PostalRetrievalStrategy
A retrieval strategy that looks up from disk the first time
and subsequently reads from cache. The Read-Once strategy
is quite acceptable for day to day usage, its main problem
being that memory usage limits cannot be enforced.
- 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 |
ReadOnceStrategy
public ReadOnceStrategy()
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.