Changeset 8156


Ignore:
Timestamp:
2004-09-27T10:29:45+12:00 (20 years ago)
Author:
mdewsnip
Message:

Tidied up the toString() function.

File:
1 edited

Legend:

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

    r6770 r8156  
    387387    }
    388388
     389
    389390    /** Method to print out this classifier as it would appear to the user in the interface
    390391     * @return A <strong>String</strong> containing a single classifier command.
    391392     */
    392     public String toString() {
    393     if(element != null) {
    394         if(name == null) {
    395         name = element.getAttribute(StaticStrings.TYPE_ATTRIBUTE);
    396         }
    397         StringBuffer text = new StringBuffer(StaticStrings.CLASSIFY_STR);
    398         text.append(" ");
    399         text.append(name);
    400         text.append(" ");
    401         ArrayList arguments = getArguments(true, true);
    402         int arguments_size = arguments.size();
    403         for(int i = 0; i < arguments_size; i++) {
    404         Argument argument = (Argument)arguments.get(i);
    405         if(argument.isAssigned()) {
    406             text.append(argument.toString());
    407             text.append(" ");
    408         }
    409         }
    410         return text.substring(0, text.length() - 1);
    411     }
    412     else {
     393    public String toString()
     394    {
     395    if (element == null) {
    413396        return name;
    414397    }
     398
     399    if (name == null) {
     400        name = element.getAttribute(StaticStrings.TYPE_ATTRIBUTE);
     401    }
     402
     403    StringBuffer text = new StringBuffer(StaticStrings.CLASSIFY_STR);
     404    text.append(" ");
     405    text.append(name);
     406
     407    ArrayList arguments = getArguments(true, true);
     408    for (int i = 0; i < arguments.size(); i++) {
     409        Argument argument = (Argument) arguments.get(i);
     410        if (argument.isAssigned()) {
     411        text.append(" ");
     412        text.append(argument.toString());
     413        }
     414    }
     415
     416    return text.toString();
    415417    }
    416418}
Note: See TracChangeset for help on using the changeset viewer.