Ignore:
Timestamp:
2003-05-27T15:57:37+12:00 (21 years ago)
Author:
kjdon
Message:

re-tabbed the code for java

File:
1 edited

Legend:

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

    r4293 r4366  
    6060*/
    6161public class SubIndex
    62     extends Vector
    63     implements Comparable {
    64     /** Default Constructor.
    65       */
    66     public SubIndex() {
    67           super();
    68     }
    69     /** Copy Constructor.
     62    extends Vector
     63    implements Comparable {
     64    /** Default Constructor.
     65     */
     66    public SubIndex() {
     67    super();
     68    }
     69    /** Copy Constructor.
    7070      * @param original The <strong>Vector</strong> used to initially fill the SubIndex.
    7171      */
    72     public SubIndex(Vector original) {
    73           super(original);
    74     }
    75     /** Parsed data Constructor.
     72    public SubIndex(Vector original) {
     73    super(original);
     74    }
     75    /** Parsed data Constructor.
    7676      * @param raw A <strong>String</strong> containing a comma separated list of subcollection names.
    7777      * @param manager A reference to the <strong>SubcollectionManager</strong> via which we retrieve the required Subcollections.
    7878      */
    79     public SubIndex(String raw, SubcollectionManager manager) {
    80           super();
    81           StringTokenizer tokenizer = new StringTokenizer(raw, ",");
    82           while(tokenizer.hasMoreTokens()) {
    83                 String name = tokenizer.nextToken();
    84                 Subcollection sub = manager.getSubcollection(name);
    85                 if(sub != null) {
    86                      add(sub);
    87                 }
    88           }
    89     }
    90     /** Method to compare two subindexes.
     79    public SubIndex(String raw, SubcollectionManager manager) {
     80    super();
     81    StringTokenizer tokenizer = new StringTokenizer(raw, ",");
     82    while(tokenizer.hasMoreTokens()) {
     83        String name = tokenizer.nextToken();
     84        Subcollection sub = manager.getSubcollection(name);
     85        if(sub != null) {
     86        add(sub);
     87        }
     88    }
     89    }
     90    /** Method to compare two subindexes.
    9191      * @param object The other subindex to compare to, as an <strong>Object</strong>.
    9292      * @return An <i>int</i> which is greater than, equal to or less than zero if the this object is before, equal to, or after the target object respectively.
    9393      */
    94     public int compareTo(Object object) {
    95           SubIndex index = (SubIndex) object;
    96           return toString().compareTo(index.toString());
    97     }
    98     /** Method to determine if this subindex contains a certain subcollection.
     94    public int compareTo(Object object) {
     95    SubIndex index = (SubIndex) object;
     96    return toString().compareTo(index.toString());
     97    }
     98    /** Method to determine if this subindex contains a certain subcollection.
    9999      * @param name The name, as a <strong>String</strong>, of the subcollection you are checking for.
    100100      * @return A <i>boolean</i> which is <i>true</i> if this index contains the named subcollection, <i>false</i> otherwise.
    101101      */
    102     public boolean containsSubcollection(String name) {
    103           for(int i = 0; i < size(); i++) {
    104                 Subcollection sub = (Subcollection) get(i);
    105                 if(sub.getName().equals(name)) {
    106                      return true;
    107                 }
    108           }
    109           return false;
    110     }
    111     /** Method to check two subindexes for equality.
     102    public boolean containsSubcollection(String name) {
     103    for(int i = 0; i < size(); i++) {
     104        Subcollection sub = (Subcollection) get(i);
     105        if(sub.getName().equals(name)) {
     106        return true;
     107        }
     108    }
     109    return false;
     110    }
     111    /** Method to check two subindexes for equality.
    112112      * @param object The other subindex to compare to, as an <strong>Object</strong>.
    113113      * @return A <i>boolean</i> which is <i>true</i> if the subindexes are equal, <i>false</i> otherwise.
    114114      */
    115     public boolean equals(Object object) {
    116           if(compareTo(object) == 0) {
    117                 return true;
    118           }
    119           return false;
    120     }
    121     /** Method to generate a comma separated list from a subindex vector.
     115    public boolean equals(Object object) {
     116    if(compareTo(object) == 0) {
     117        return true;
     118    }
     119    return false;
     120    }
     121    /** Method to generate a comma separated list from a subindex vector.
    122122      * @return A <strong>String</strong> representing this subindex.
    123123      */
    124     public String toString() {
    125           String text = "";
    126           for(int i = 0; i < size(); i++) {
    127                 Object object = get(i);
    128                 Subcollection sub = (Subcollection) get(i);
    129                 text = text + sub.getName();
    130                 if(i < size() - 1) {
    131                           text = text + ",";
    132                 }
    133           }
    134           return text;
    135     }
     124    public String toString() {
     125    String text = "";
     126    for(int i = 0; i < size(); i++) {
     127        Object object = get(i);
     128        Subcollection sub = (Subcollection) get(i);
     129        text = text + sub.getName();
     130        if(i < size() - 1) {
     131        text = text + ",";
     132        }
     133    }
     134    return text;
     135    }
    136136}
Note: See TracChangeset for help on using the changeset viewer.