Changeset 6142 for trunk


Ignore:
Timestamp:
2003-12-08T14:15:44+13:00 (20 years ago)
Author:
jmt12
Message:

Added a new method for determining if the given element is extracted or not

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/msm/ElementWrapper.java

    r6051 r6142  
    4747import org.greenstone.gatherer.msm.MSMUtils;
    4848import org.greenstone.gatherer.util.StaticStrings;
     49import org.greenstone.gatherer.util.Troolean;
    4950import org.greenstone.gatherer.util.Utility;
    5051import org.w3c.dom.*;
     
    6061    /** A string prefix identifying the metadata set namespace. */
    6162    private String namespace = "";
     63
     64    private Troolean is_extracted = new Troolean();
    6265    /** Constructor for elements with no namespace necessary.
    6366     * @param element The DOM <strong>Element</strong> this is to be based on.
     
    184187    public void inc() {
    185188    MSMUtils.setOccurance(element, 1);
     189    }
     190
     191    public boolean isExtracted() {
     192    if(!is_extracted.isDecided()) {
     193        String raw_namespace = namespace;
     194        if(raw_namespace != null && raw_namespace.length() > 0 && !raw_namespace.endsWith(StaticStrings.STOP_CHARACTER)) {
     195        raw_namespace = raw_namespace + StaticStrings.STOP_CHARACTER;
     196        }
     197        is_extracted.set(raw_namespace == null || raw_namespace.equals(StaticStrings.EMPTY_STR) || raw_namespace.equals(StaticStrings.EXTRACTED_NAMESPACE));
     198    }
     199    return is_extracted.isTrue();
    186200    }
    187201
Note: See TracChangeset for help on using the changeset viewer.