Changeset 8000


Ignore:
Timestamp:
2004-08-18T17:16:31+12:00 (20 years ago)
Author:
mdewsnip
Message:

Removed some dead code.

File:
1 edited

Legend:

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

    r7260 r8000  
    136136     * @return <i>true</i> if the two trees are equal, <i>false</i> otherwise.
    137137     */
    138     static final public boolean assignedValuesEqual(Node avt, Node bvt) {
     138    static final private boolean assignedValuesEqual(Node avt, Node bvt) {
    139139    if(avt == null && bvt == null) {
    140140        return true; // Both are null so both are equal.
     
    186186    }
    187187
    188     /** Method to determine if a certain path of elements can be found in another tree. This method tests by comparing node names, and finally the #text node past the leaf end of the path.
    189      * @param tree The root <strong>Node</strong> of the tree to be searched.
    190      * @param path The <strong>Node[]</strong> path to be found.
    191      * @return <i>true</i> if the path was found (including matching #text elements at the leaf), or <i>false</i> otherwise.
    192      */
    193     /* static final private boolean containsPath(Node tree, Node path[]) {
    194     // If there is no tree then there are no values.
    195     if(tree == null) {
    196         return false;
    197     }
    198     // Ensure we are comparing equivent things.
    199     if(tree.getNodeName().equals("AssignedValues") && path[0].getNodeName().equals("AssignedValues")) {
    200         int index = 1;
    201         while(index < path.length && tree != null) {
    202         Node next = null;
    203         for(Node n = tree.getFirstChild(); n != null && next == null; n = n.getNextSibling()) {
    204             if(n.getNodeName().equals(path[index].getNodeName())) {
    205             next = n;
    206             index++;
    207             }
    208             tree = next;
    209         }
    210         }
    211                 // Tree may now be pointing at the same node as
    212                 // path[path.length - 1] so we should test their child text nodes.
    213         if(tree != null) {
    214         Node tree_text = tree.getFirstChild();
    215         Node path_text = path[path.length - 1].getFirstChild();
    216         if(tree_text.getNodeValue().equals(path_text.getNodeValue())) {
    217             // Path found!
    218             return true;
    219         }
    220         }
    221     }
    222     return false;       
    223     } */
    224188    /** Method to compare two metadata elements (of type Element, which is bound to get more than a bit confusing) for equality. This test may only check the structural (ie pretty much unchanging) consistancy, or may include the AssignedValue tree as well (which will be different for each collection I'd imagine).
    225189     * @param a_set The <strong>MetadataSet</strong> a comes from.
     
    365329     * @return An <i>int</i> which is the number of attribute nodes.
    366330     */
    367     static final public int getAttributeCount(Node element) {
     331    static final private int getAttributeCount(Node element) {
    368332    int count = 0;
    369333    for(Node n = element.getFirstChild(); n != null;
     
    374338    }
    375339    return count;
    376     }
    377 
    378     /*************************************************************************/
    379     /** This method is a slight variation on getNodeNamed in that it is especially written to retrieve the attribute Nodes of a certain name present under the given element. Note that this method is language specific.
    380      * @param element The target element <strong>Node</strong>.
    381      * @param name The name of the attribute you wish to return.
    382      * @return An <strong>Element[]</strong> containing the attributes you requested, or <i>null</i> if no such attributes exists.
    383      */
    384     static final public Element getAttributeNodeNamed(Node element, String name) {
    385     Element attribute = null;
    386     String language_code = Gatherer.config.getLanguage();
    387     for(Node n = element.getFirstChild(); n != null; n = n.getNextSibling()) {
    388         if(n.getNodeName().equals("Attribute")) {
    389         Element e = (Element)n;
    390         if(e.getAttribute("name").equals(name)) {
    391             if(e.getAttribute("language").equalsIgnoreCase(language_code)) {
    392             return e;
    393             }
    394             else if(e.getAttribute("language").equalsIgnoreCase("en")) {
    395             attribute = e;
    396             }
    397             else if(attribute == null) {
    398             attribute = e;
    399             }
    400         }
    401         e = null;
    402         }
    403     }
    404     return attribute;
    405340    }
    406341
     
    468403     * @see org.greenstone.gatherer.util.StaticStrings#NAME_ATTRIBUTE
    469404     */
    470     static public String getElementAttribute(Element element_element, String attribute_name_str, String language_code_str) {
     405    static private String getElementAttribute(Element element_element, String attribute_name_str, String language_code_str) {
    471406    boolean found = false;
    472407    String result = StaticStrings.EMPTY_STR;
     
    646581    }
    647582
    648     /** This method traces the path between the 'root' node given and the target node. This path is returned starting at the root.
    649      * @param root The root <strong>Node</strong> to start this path at.
    650      * @param target The final <strong>Node</strong> to end up at.
    651      * @return A <strong>Node[]</strong> that contains the sequence of nodes from root to target.
    652      */
    653     static final public Node[] getPath(Node root, Node target) {
    654     if(root == target) {
    655         return ArrayTools.add(null, root);
    656     }
    657     else {
    658         return ArrayTools.add(getPath(root, target.getParentNode()), target);
    659     }
    660     }
    661583
    662584    /** This method extracts the structural details from a certain element and stores them in an array, all ready for passing to the <strong>Dictionary</strong>.
     
    724646     * @param values A <strong>Hashtable</strong> containing the mapping discovered so far in our tree traversal.
    725647     */
    726     static final public void getValueMappings(Node current, String prefix, Hashtable values) {
     648    static final private void getValueMappings(Node current, String prefix, Hashtable values) {
    727649    if(current != null) {
    728650        String name = current.getNodeName();
    729651        String new_prefix = prefix;
    730                 // If we've found the outer layer of a new value, add it to our
    731                 // mapping.
     652        // If we've found the outer layer of a new value, add it to our mapping
    732653        if(name.equals("Subject")) {
    733654        Node value_node = getNodeFromNamed(current, "Value");
     
    761682     * @see org.greenstone.gatherer.util.StaticStrings#LANGUAGEDEPENDANT_ATTRIBUTE
    762683     */
    763     static public boolean isAttributeLanguageDependant(Document document, String attribute_name_str) {
     684    static private boolean isAttributeLanguageDependant(Document document, String attribute_name_str) {
    764685    String language_specific_attributes = document.getDocumentElement().getAttribute(StaticStrings.LANGUAGEDEPENDANT_ATTRIBUTE).toLowerCase();
    765686    return language_specific_attributes.indexOf(attribute_name_str) != -1;
     
    772693     * @see org.greenstone.gatherer.util.StaticStrings#EMPTY_STR
    773694     */
    774     static public boolean isLegacyMDS(Document document) {
     695    static private boolean isLegacyMDS(Document document) {
    775696    ///ystem.err.println("isLegacyMDS(): l_d = " + document.getDocumentElement().getAttribute(StaticStrings.LANGUAGEDEPENDANT_ATTRIBUTE));
    776697    return (document.getDocumentElement().getAttribute(StaticStrings.LANGUAGEDEPENDANT_ATTRIBUTE)).equals(StaticStrings.EMPTY_STR);
     
    783704     * TODO Implementation
    784705     */
    785     static final public boolean optionListsEqual(Node al, Node bl) {
     706    static final private boolean optionListsEqual(Node al, Node bl) {
    786707    // Compare the 'restricted' attribute of the two lists.
    787708    Element ae = (Element) al;
     
    1056977     * @return A <i>boolean</i> which is <i>true</i> if the two value nodes are equal, <i>false</i> otherwise.
    1057978     */
    1058     static final public boolean valuesEqual(Node av, Node bv) {
     979    static final private boolean valuesEqual(Node av, Node bv) {
    1059980    // Check we are comparing apples and apples...
    1060981    if(av.getNodeName().equals("Value") &&
Note: See TracChangeset for help on using the changeset viewer.