1/* 2 * PostalRetrievalStrategy.java 3 * Copyright (C) 2006 Amin Ahmad 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 */ 19package org.ahmadsoft.postal; 20 21import java.io.File; 22import java.net.URL; 23import java.util.List; 24 25 26/** 27 * Encapsulates a strategy for retrieving postal 28 * codes. 29 * @author Amin Ahmad 30 */ 31public interface PostalRetrievalStrategy { 32 33 /** 34 * Initializes the retrieval strategy with the 35 * postal code index and data files. 36 * 37 * @param indexFile 38 * @param dataFile 39 */ 40 void initialize(File indexFile, File dataFile) throws Exception; 41 42 void dispose() throws Exception; 43 44 /** 45 * Retrieves a list of candidate cities for a 46 * specified postal code. 47 * 48 * @param postalCode the postal code. 49 * @return a list of candidate cities. 50 */ 51 List getCandidates(int postalCode); 52} 53