Changeset 7985


Ignore:
Timestamp:
2004-08-18T14:20:09+12:00 (20 years ago)
Author:
mdewsnip
Message:

Removed some dead code.

Location:
trunk/gli/src/org/greenstone/gatherer/util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/util/ArrayTools.java

    r7122 r7985  
    1414import javax.swing.filechooser.*;
    1515import org.greenstone.gatherer.file.FileNode;
    16 import org.greenstone.gatherer.msm.Metadata;
    1716import org.w3c.dom.*;
    1817
     
    176175    }
    177176    return false;
    178     }
    179     /** Remove the first element from an array, and return the remaining 'tail'.
    180      * @param a A <strong>FileNode[]</strong>.
    181      * @return The same <strong>FileNode[]</strong> sans its head element.
    182      */
    183     /* static final private FileNode[] tail(FileNode a[]) {
    184     if(a.length == 1) {
    185         return null;
    186     }
    187     FileNode b[] = new FileNode[a.length - 1];
    188     System.arraycopy(a, 1, b, 0, b.length);
    189     return b;
    190     } */
    191      
    192     /** Append a Metadata object onto an array of Metadata objects. */
    193     static public Metadata[] add(Metadata[] a, Metadata b) {
    194     Metadata[] c = null;
    195     if(a != null && b != null) {
    196         c = new Metadata[a.length + 1];
    197         System.arraycopy(a, 0, c, 0, a.length);
    198         c[c.length - 1] = b;
    199     }
    200     else if(a == null && b != null) {
    201         c = new Metadata[1];
    202         c[0] = b;
    203     }
    204     else if(a != null && b == null) {
    205         c = a;
    206     }
    207     return c;
    208     }
    209     /** Append a Metadata object array onto an array of Metadata objects. */
    210     static public Metadata[] add(Metadata[] a, Metadata[] b) {
    211     Metadata[] c = null;
    212     if(a != null && b != null) {
    213         c = new Metadata[a.length + b.length];
    214         System.arraycopy(a, 0, c, 0, a.length);
    215         System.arraycopy(b, 0, c, a.length, b.length);
    216     }
    217     else if(a == null && b != null) {
    218         c = b;
    219     }
    220     else if(a != null && b == null) {
    221         c = a;
    222     }
    223     return c;
    224     }
    225     /** Remove the Metadata object at the given index form the specified Metadata object array. */
    226     static public Metadata[] remove(Metadata[] a, int index) {
    227     Metadata[] c = null;
    228     if(a != null) {
    229         c = new Metadata[a.length - 1];
    230         System.arraycopy(a, 0, c, 0, index);
    231         System.arraycopy(a, index + 1, c, index, c.length - index);
    232     }
    233     return c;
    234177    }
    235178
     
    393336    }
    394337
    395     /** Remove the file at the given index from the array of files. */
    396     static public File[] remove(File[] files, int index) {
    397     if(files.length == 1) {
    398         return new File[0];
    399     }
    400     File[] temp = new File[files.length - 1];
    401     if(index > 0) {
    402         System.arraycopy(files, 0, temp, 0, index);
    403     }
    404     if(index < files.length - 1) {
    405         System.arraycopy(files, index + 1, temp, index, files.length - 1 - index);
    406     }
    407     return temp;
    408     }
    409 
    410338
    411339    /** Sorts an array of files, putting non-files first. Case insensitive.
  • trunk/gli/src/org/greenstone/gatherer/util/HashMap3D.java

    r5785 r7985  
    3333import java.util.HashMap;
    3434import java.util.Iterator;
    35 import org.greenstone.gatherer.msm.Metadata;
    3635
    3736/** Provides a HashMap implementation that indexes by two keys. Perfect for the storage of metadata references based on their metadata element and assigned value.
     
    5554    super();
    5655    }
    57     /** Constructor with a specific initial capacity, as we should already have a good idea based on the number of Metadata Elements.
     56    /** Constructor with a specific initial capacity.
    5857     * @param capacity The initial capacity as an <i>int</i>.
    5958     */
     
    120119    return result;
    121120    }
    122     /** -SPECIAL - Attempts to retrieve a previous instance of metadata with the same parameters as the given one. If such a metadata is found, it is returned, otherwise the given metadata is added then returned as being the first unique instance.
    123      * @param metadata The <strong>Metadata</strong> for whom we are trying to find the first unique instance.
    124      * @return The first unique instance of the target <strong>Metadata</strong> which may in fact be the same metadata given as a paramater.
    125      */
    126     /* private Metadata locate(Metadata metadata) {
    127     Metadata result = null;
    128     if(metadata != null) {
    129         // Locate the appropriate value->metadata hashmap.
    130         String element_name = metadata.getElement().toString();
    131         HashMap inner_mapping = (HashMap) get(element_name);
    132         if(inner_mapping == null) {
    133         inner_mapping = new HashMap(4); // Small initial capacity.
    134         put(element_name, inner_mapping);
    135         }
    136         element_name = null;
    137         // Locate the appropriate metadata
    138         String value_name = metadata.getValueNode().getFullPath(false);
    139         result = (Metadata) inner_mapping.get(value_name);
    140         if(result == null) {
    141         result = metadata;
    142         inner_mapping.put(value_name, metadata);
    143         }
    144         value_name = null;
    145         inner_mapping = null;
    146     }
    147     return result;
    148     } */
     121
    149122    /** Put an entry into this three dimensional hash mapping.
    150123     * @param key_one The first key, to store this value under, as an <strong>Object</strong>.
Note: See TracChangeset for help on using the changeset viewer.