001/* 002 * #%L 003 * Netarchivesuite - common 004 * %% 005 * Copyright (C) 2005 - 2014 The Royal Danish Library, the Danish State and University Library, 006 * the National Library of France and the Austrian National Library. 007 * %% 008 * This program is free software: you can redistribute it and/or modify 009 * it under the terms of the GNU Lesser General Public License as 010 * published by the Free Software Foundation, either version 2.1 of the 011 * License, or (at your option) any later version. 012 * 013 * This program is distributed in the hope that it will be useful, 014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 016 * GNU General Lesser Public License for more details. 017 * 018 * You should have received a copy of the GNU General Lesser Public 019 * License along with this program. If not, see 020 * <http://www.gnu.org/licenses/lgpl-2.1.html>. 021 * #L% 022 */ 023package dk.netarkivet.common.distribute.indexserver; 024 025import java.io.File; 026 027import dk.netarkivet.common.exceptions.ArgumentNotValid; 028 029/** 030 * An immutable pair if an index and the set this is an index for. 031 * 032 * @param <I> The type of set, this is an index for. 033 */ 034public class Index<I> { 035 036 /** The file containing the index over the set. */ 037 private final File indexFile; 038 /** The set this is an index for. */ 039 private final I indexSet; 040 041 /** 042 * Initialise the set. 043 * 044 * @param indexFile The index file. 045 * @param indexSet The set this is an index for. Can be null TODO Should the indexSet be allowed to be null? 046 * @throws ArgumentNotValid if indexFile is null. 047 */ 048 public Index(File indexFile, I indexSet) { 049 ArgumentNotValid.checkNotNull(indexFile, "File indexFile"); 050 this.indexFile = indexFile; 051 this.indexSet = indexSet; 052 } 053 054 /** 055 * Get the index file. 056 * 057 * @return The index file. 058 */ 059 public File getIndexFile() { 060 return indexFile; 061 } 062 063 /** 064 * Get the set this is an index for. 065 * 066 * @return The set this is an index for. 067 */ 068 public I getIndexSet() { 069 return indexSet; 070 } 071 072}