source: trunk/gli/src/org/greenstone/gatherer/cdm/DefaultSubIndex.java@ 4293

Last change on this file since 4293 was 4293, checked in by jmt12, 21 years ago

Initial revision

  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 KB
Line 
1/**
2 *#########################################################################
3 *
4 * A component of the Gatherer application, part of the Greenstone digital
5 * library suite from the New Zealand Digital Library Project at the
6 * University of Waikato, New Zealand.
7 *
8 * <BR><BR>
9 *
10 * Author: John Thompson, Greenstone Digital Library, University of Waikato
11 *
12 * <BR><BR>
13 *
14 * Copyright (C) 1999 New Zealand Digital Library Project
15 *
16 * <BR><BR>
17 *
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
22 *
23 * <BR><BR>
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
29 *
30 * <BR><BR>
31 *
32 * You should have received a copy of the GNU General Public License
33 * along with this program; if not, write to the Free Software
34 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
35 *########################################################################
36 */
37
38
39
40
41
42
43/* GPL_HEADER */
44package org.greenstone.gatherer.cdm;
45/**************************************************************************************
46 * Title: Gatherer
47 * Description: The Gatherer: a tool for gathering and enriching a digital collection.
48 * Company: The University of Waikato
49 * Written: 03/05/02
50 * Revised: 03/10/02 - Commented
51 **************************************************************************************/
52import java.util.Collections;
53import java.util.StringTokenizer;
54import java.util.Vector;
55import org.greenstone.gatherer.cdm.Subcollection;
56import org.greenstone.gatherer.cdm.SubIndex;
57/** The DefaultSubIndex contains a single subcollection which is used as the default index.
58 * @author John Thompson, Greenstone Digital Library, University of Waikato
59 * @version 2.3
60 */
61public class DefaultSubIndex
62 extends SubIndex {
63 /** Copy constructor.
64 * @param subindex The <strong>SubIndex</strong> we are copying.
65 */
66 public DefaultSubIndex(SubIndex subindex) {
67 for(int i = 0; i < subindex.size(); i++) {
68 add(subindex.get(i));
69 }
70 }
71 /** Parsed data Constructor.
72 * @param raw A <strong>String</strong> containing a comma separated list of subcollection names.
73 * @param manager A reference to the <strong>SubcollectionManager</strong> via which we retrieve the required <strong>Subcollection</strong>s.
74 */
75 public DefaultSubIndex(String raw, SubcollectionManager manager) {
76 super(raw, manager);
77 }
78 /** Method to extract just the subindex information from this class.
79 * @return A <strong>SubIndex</strong> based on the information in this class.
80 */
81 public SubIndex getSubIndex() {
82 return new SubIndex(this);
83 }
84 /** Method to produce this class as a string much like you'd find in the collection configuration file.
85 * @return A <strong>String</string> with the default index entry.
86 */
87 public String toString() {
88 String text = "defaultsubcollection ";
89 for(int i = 0; i < size(); i++) {
90 Object object = get(i);
91 Subcollection sub = (Subcollection) get(i);
92 text = text + sub.getName();
93 if(i < size() - 1) {
94 text = text + ",";
95 }
96 }
97 text = text + "\n";
98 return text;
99 }
100}
101
Note: See TracBrowser for help on using the repository browser.