Changeset 12088


Ignore:
Timestamp:
2006-07-07T13:06:01+12:00 (18 years ago)
Author:
kjdon
Message:

some changes that I am not sure what for :-). Also added SearchTypes to the list of commands

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/cdm/Format.java

    r10421 r12088  
    4141
    4242    /** The default features (not all of these are in the Greenstone Developer's Guide). */
    43     static final public String DEFAULT_FEATURES[] = { "", "AllowExtendedOptions", "Document", "DocumentArrowsBottom", "DocumentArrowsTop", "DocumentButtons", "DocumentContents", "DocumentHeading", "DocumentImages", "DocumentText", "DocumentTitles", "DocumentUseHTML", "RelatedDocuments", "Search" };
     43    static final public String DEFAULT_FEATURES[] = { "", "AllowExtendedOptions", "Document", "DocumentArrowsBottom", "DocumentArrowsTop", "DocumentButtons", "DocumentContents", "DocumentHeading", "DocumentImages", "DocumentText", "DocumentTitles", "DocumentUseHTML", "RelatedDocuments", "Search", "SearchTypes" };
    4444    /** The list of known feature parts. */
    4545    static final public String DEFAULT_PARTS[] = { "", "DateList", "HList", "VList" };
     
    7676    /** We keep a copy of the part because its slightly more computationally tricky to calculate. */
    7777    private String part = null;
     78    /** We keep a copy of the feature name */
     79    private String feature_name = null;
    7880    /** Cached result of toString. */
    7981    private String text = null;
     
    166168    }
    167169    else if(element != null) {
    168         String name = element.getAttribute(CollectionConfiguration.NAME_ATTRIBUTE);
    169         // Remove part
    170         String part = getPart();
    171         String feature;
    172         if(part != null) {
    173         feature = name.substring(0, name.length() - part.length());
    174         }
    175         else {
    176         feature = name;
    177         }
    178         part = null;
    179         name = null;
     170        String feature = getFeatureName();
    180171        // If the feature now refers to a classifier, retrieve it.
    181172        if(feature.toUpperCase().startsWith(Classifier.CLASSIFIER_PREFIX)) {
     
    197188    }
    198189
     190    public String getFeatureName() {
     191    if (feature_name == null) {
     192        String name = element.getAttribute(CollectionConfiguration.NAME_ATTRIBUTE);
     193        // Remove part
     194        String part = getPart();
     195        if(part != null) {
     196        feature_name = name.substring(0, name.length() - part.length());
     197        }
     198        else {
     199        feature_name = name;
     200        }
     201        part = null;
     202        name = null;
     203    }
     204    return feature_name;
     205       
     206    }
    199207    public String getName() {
    200208    if(element != null) {
     
    273281        if(feature instanceof Classifier) {
    274282        classifier = (Classifier) feature;
     283        feature_name = classifier.getPositionString();
    275284        element.setAttribute(CollectionConfiguration.NAME_ATTRIBUTE, classifier.getPositionString() + part);
    276285        }
    277286        else {
     287        feature_name = feature.toString();
    278288        element.setAttribute(CollectionConfiguration.NAME_ATTRIBUTE, feature.toString() + part);
    279289        }
     
    344354    if(classifier != null) {
    345355        element.setAttribute(CollectionConfiguration.NAME_ATTRIBUTE, classifier.getPositionString() + getPart());
     356        feature_name = classifier.getPositionString();
    346357        text = null;
    347358    }
Note: See TracChangeset for help on using the changeset viewer.