Changeset 8844


Ignore:
Timestamp:
2004-12-17T14:51:50+13:00 (19 years ago)
Author:
mdewsnip
Message:

Tidied up getElementAt() a little and added debugging statement.

File:
1 edited

Legend:

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

    r8380 r8844  
    192192    }
    193193
    194     public synchronized Object getElementAt(int index) {
     194    public synchronized Object getElementAt(int index)
     195    {
    195196    Object object = cache.get(new Integer(index));
    196     if(object == null) {
    197         // Retrieve the required element
    198         Element element = (Element) children.item(index);
    199         // Now wrap it in the object of the users choice
    200         object = class_type.create(element);
    201         cache.put(new Integer(index), object);
    202     }
     197    if (object != null) {
     198        return object;
     199    }
     200
     201    // Retrieve the required element
     202    Element element = (Element) children.item(index);
     203    DebugStream.println("Element at index " + index + " not in cache: " + element);
     204
     205    // Now wrap it in the object of the users choice
     206    object = class_type.create(element);
     207    cache.put(new Integer(index), object);
    203208    return object;
    204209    }
Note: See TracChangeset for help on using the changeset viewer.