Changeset 5231


Ignore:
Timestamp:
2003-08-21T11:05:44+12:00 (21 years ago)
Author:
jmt12
Message:

Added method so we no longer have to create a Format object just to figure out what its name is. Also ensured creation of a format strips off enclosing speech marks

File:
1 edited

Legend:

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

    r4932 r5231  
    5454    }
    5555
     56    static public String generateName(Object feature, String part) {
     57    if(feature instanceof Classifier) {
     58        return ((Classifier)feature).getPositionString() + part;
     59    }
     60    else {
     61        return feature.toString() + part;
     62    }
     63    }
     64
    5665    static public boolean isParamType(String name) {
    5766    return (name.equalsIgnoreCase(DEFAULT_FEATURES[1]) || name.equalsIgnoreCase(DEFAULT_FEATURES[3]) || name.equalsIgnoreCase(DEFAULT_FEATURES[5]) || name.equalsIgnoreCase(DEFAULT_FEATURES[7]));
     
    276285    public void setValue(String value) {
    277286    if(element != null) {
     287        // Strip off any enclosing speech marks
     288        if(value.startsWith(CollectionConfiguration.SPEECH_CHARACTER) && value.startsWith(CollectionConfiguration.SPEECH_CHARACTER)) {
     289        value = value.substring(1, value.length() - 1);
     290        }
     291        // Encode
     292
     293        // Store in DOM
    278294        MSMUtils.setValue(element, value);
    279295        text = null;
Note: See TracChangeset for help on using the changeset viewer.