Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.greenstone.gatherer.cdm
Class Classifier  view Classifier download Classifier.java

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byjava.util.ArrayList
              extended byorg.greenstone.gatherer.cdm.Classifier
All Implemented Interfaces:
ArgumentContainer, java.lang.Cloneable, java.util.Collection, java.lang.Comparable, DOMProxyListEntry, java.util.List, java.util.RandomAccess, java.io.Serializable

public class Classifier
extends java.util.ArrayList
implements ArgumentContainer, java.lang.Comparable, DOMProxyListEntry, java.io.Serializable

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.

Version:
2.3

Nested Class Summary
 
Nested classes inherited from class java.util.AbstractList
 
Field Summary
static java.lang.String CLASSIFIER_PREFIX
           
private  java.lang.String description
          A description of this classifier.
private  org.w3c.dom.Element element
          The element this classifier is based upon.
private  boolean is_abstract
           
private  java.lang.String name
          The name of the classifier as it would appear in the collect.cfg file.
private  java.lang.String old_position_string
          This string is filled out the first time this classifier is created, and remains unchanged there-after.
private  Classifier super_classifier
          A reference to the classifier that this one inherits from.
 
Fields inherited from class java.util.ArrayList
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
Classifier()
          Constructor used only in DOMProxyListModel initializations.
Classifier(org.w3c.dom.Element element, Classifier base_classifier)
           
Classifier(java.lang.String name, java.lang.String description, Classifier super_classifier)
          Constructor.
 
Method Summary
 void addArgument(Argument argument)
          Method to add an argument to this classifier.
 int compareTo(java.lang.Object object)
          Method to compare two classifiers for ordering.
 DOMProxyListEntry create(org.w3c.dom.Element element)
          The assigned classifier constructor.
 boolean equals(java.lang.Object object)
          Method to determine if two classifiers are equal.
 Argument getArgument(java.lang.String name)
          Method to retrieve an argument by its name.
 java.util.ArrayList getArguments(boolean include_normal, boolean include_custom)
          Retrieve all of the arguments available to this base classifier, including its super classifiers arguments.
 java.lang.String getCustom()
          Method to retrieve a classifiers custom argument information.
 java.lang.String getDescription()
           
 org.w3c.dom.Element getElement()
           
 java.lang.String getName()
          Method to retrieve a classifiers name.
 java.lang.String getPositionString()
          Generate the string showing this classifiers position.
 boolean isAbstract()
           
 boolean isAssigned()
           
 void setAssigned(boolean assigned)
           
 void setCustom(java.lang.String custom_str)
          Set the custom arguments.
 void setDescription(java.lang.String description)
          Method to set the value of desc.
 void setElement(org.w3c.dom.Element element)
           
 void setIsAbstract(boolean is_abstract)
           
 void setName(java.lang.String name)
          Method to set the value of name.
 void setSuper(Classifier super_classifier)
          Method to set the value of the super_classifier.
 java.lang.String toString()
          Method to print out this classifier as it would appear to the user in the interface
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, remove, removeAll, retainAll
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, hashCode, iterator, listIterator, listIterator, remove, removeAll, retainAll, subList
 

Field Detail

CLASSIFIER_PREFIX

public static final java.lang.String CLASSIFIER_PREFIX
See Also:
Constant Field Values

is_abstract

private boolean is_abstract

super_classifier

private Classifier super_classifier
A reference to the classifier that this one inherits from.


element

private org.w3c.dom.Element element
The element this classifier is based upon.


description

private java.lang.String description
A description of this classifier.


name

private java.lang.String name
The name of the classifier as it would appear in the collect.cfg file.


old_position_string

private java.lang.String old_position_string
This string is filled out the first time this classifier is created, and remains unchanged there-after. It is used to match up with Format commands that may not yet have been instantiated (and thus only have offline references along the lines of 'CL1' to figure out what Classifier they want.)

Constructor Detail

Classifier

public Classifier()
Constructor used only in DOMProxyListModel initializations.


Classifier

public Classifier(org.w3c.dom.Element element,
                  Classifier base_classifier)

Classifier

public Classifier(java.lang.String name,
                  java.lang.String description,
                  Classifier super_classifier)
Constructor.

Method Detail

addArgument

public void addArgument(Argument argument)
Method to add an argument to this classifier. Only adds the argument if it isn't already present.


compareTo

public int compareTo(java.lang.Object object)
Method to compare two classifiers for ordering.

Specified by:
compareTo in interface java.lang.Comparable

create

public DOMProxyListEntry create(org.w3c.dom.Element element)
The assigned classifier constructor.

Specified by:
create in interface DOMProxyListEntry

equals

public boolean equals(java.lang.Object object)
Method to determine if two classifiers are equal.

Specified by:
equals in interface java.util.List

getArgument

public Argument getArgument(java.lang.String name)
Method to retrieve an argument by its name.


getArguments

public java.util.ArrayList getArguments(boolean include_normal,
                                        boolean include_custom)
Retrieve all of the arguments available to this base classifier, including its super classifiers arguments. Some complexity is added by allowing the caller to choose whether they want normal arguments, custom arguments, or both.

Specified by:
getArguments in interface ArgumentContainer

getCustom

public java.lang.String getCustom()
Method to retrieve a classifiers custom argument information. Custom arguments are defined to be those that have not got matching arguments in the base reference classifier from the library. Of course if there is no base classifier then all arguments are considered to be custom.

Specified by:
getCustom in interface ArgumentContainer

getDescription

public java.lang.String getDescription()

getElement

public org.w3c.dom.Element getElement()
Specified by:
getElement in interface DOMProxyListEntry

getName

public java.lang.String getName()
Method to retrieve a classifiers name.

Specified by:
getName in interface ArgumentContainer

getPositionString

public java.lang.String getPositionString()
Generate the string showing this classifiers position.


isAbstract

public boolean isAbstract()

isAssigned

public boolean isAssigned()
Specified by:
isAssigned in interface DOMProxyListEntry

setAssigned

public void setAssigned(boolean assigned)
Specified by:
setAssigned in interface DOMProxyListEntry

setCustom

public void setCustom(java.lang.String custom_str)
Set the custom arguments. This turns out to be quite tricky. We must parse in the string, searching for arguments (for that we use a handy method in CollectionConfiguration). Next, for each argument, we check if we already know about it. If so we update its value, otherwise we create a new argument and assign it (must assign!).

Specified by:
setCustom in interface ArgumentContainer

setDescription

public void setDescription(java.lang.String description)
Method to set the value of desc.


setElement

public void setElement(org.w3c.dom.Element element)
Specified by:
setElement in interface DOMProxyListEntry

setIsAbstract

public void setIsAbstract(boolean is_abstract)

setName

public void setName(java.lang.String name)
Method to set the value of name.


setSuper

public void setSuper(Classifier super_classifier)
Method to set the value of the super_classifier.


toString

public java.lang.String toString()
Method to print out this classifier as it would appear to the user in the interface