source: trunk/gli/src/org/greenstone/gatherer/cdm/Classifier.java@ 12253

Last change on this file since 12253 was 12247, checked in by kjdon, 18 years ago

made ArgumentContainer a base class instead of an interface and moved all the shared code from Plugin and Classifier into it (ie most of these two classes). also removed custom stuff from classifier and plugin - no more custom ones allowed

  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 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 * Author: John Thompson, Greenstone Digital Library, University of Waikato
9 *
10 * Copyright (C) 1999 New Zealand Digital Library Project
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 *########################################################################
26 */
27package org.greenstone.gatherer.cdm;
28
29/**************************************************************************************
30 * Written: 01/05/02
31 * Revised: 16/08/02 Optimized and Commented.
32 * 11/07/03 DOM support
33 **************************************************************************************/
34import java.io.*;
35import java.util.*;
36import org.greenstone.gatherer.util.StaticStrings;
37import org.greenstone.gatherer.util.Utility;
38import org.w3c.dom.*;
39
40/** This class is responsible for storing information from a parsed classinfo.pl call in such a way that it allows easy access to parsed details for the purposes of user design and specification of classifiers.
41 * @author John Thompson, Greenstone Digital Library, University of Waikato
42 * @version 2.3
43 */
44public class Classifier
45 extends ArgumentContainer {
46
47
48 static final public String CLASSIFIER_PREFIX = "CL";
49
50 /** Constructor used only in DOMProxyListModel initializations.
51 */
52 public Classifier() {
53 }
54
55 public Classifier(Element element, Classifier base_classifier) {
56 super(element, base_classifier);
57 }
58
59 /** The assigned classifier constructor.
60 * @param element the DOM Element this classifier is based upon
61 */
62 public DOMProxyListEntry create(Element element) {
63 String classifier_name = element.getAttribute(StaticStrings.TYPE_ATTRIBUTE);
64 // Determine the base classifier from the classifier name
65 Classifier base_classifier = CollectionDesignManager.classifier_manager.getBaseClassifier(classifier_name);
66 Classifier classifier = new Classifier(element, base_classifier);
67 if (base_classifier == null) {
68 // this is kind of a place holder classifier for one which is invalid. It won't get written out to the config file when its next saved.
69 classifier.setAssigned(false);
70 }
71 base_classifier = null;
72 classifier_name = null;
73 return classifier;
74 }
75
76 /** Generate the string showing this classifiers position. */
77 public String getPositionString() {
78 String position_string = CLASSIFIER_PREFIX;
79 if(element != null) {
80 // Determine our place in the collect.cfg file
81 int position_int = CollectionDesignManager.classifier_manager.indexOf(this) + 1;
82 if(position_int != -1) {
83 position_string = position_string + position_int;
84 }
85 }
86 return position_string;
87 }
88
89}
Note: See TracBrowser for help on using the repository browser.