Changeset 8673


Ignore:
Timestamp:
2004-11-25T15:40:13+13:00 (19 years ago)
Author:
kjdon
Message:

a little bit of code formatting, renamed somemethods so that oid is always OID, and added extlink2OID method

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gdbm/GDBMWrapper.java

    r4876 r8673  
    129129    // yes I think so.
    130130    /** converts a greenstone OID to internal docnum */
    131     public long oid2Docnum(String OID) {
     131    public long OID2Docnum(String OID) {
    132132    DBInfo info = getInfo(OID);
    133133    long real_num = Long.parseLong(info.getInfo("docnum"));
     
    135135    }
    136136    /** converts a docnum to greenstone OID */
    137     public String docnum2Oid(long docnum) {
     137    public String docnum2OID(long docnum) {
    138138    DBInfo info = getInfo(Long.toString(docnum));
    139139    String oid = info.getInfo("section");
     
    141141    }
    142142
    143     /** translates oids containing .pr, .fc, .lc, .ns, .ps into proper oids
     143    /** converts a docnum to greenstone OID */
     144    public String extlink2OID(String extlink) {
     145    DBInfo info = getInfo(extlink);
     146    String oid = info.getInfo("section");
     147    return oid;
     148    }
     149    /** translates relative oids into proper oids:
     150     * .pr (parent), .rt (root) .fc (first child), .lc (last child),
     151     * .ns (next sibling), .ps (previous sibling)
    144152     * a suffix is expected to be present so test before using
    145153     * TODO: fc, lc, ns, ps, .rt .ss*/
     
    177185        return top;
    178186        }
     187
     188
     189        /** ATTACK OF THE RANDOM BLARG!!!! **/
     190        /** All your code are belong to me! **/
     191
    179192        String contains = info.getInfo("contains");
    180         contains.replaceAll("\"", doc_id);
    181193        if (contains.equals("")) {
    182194        // something is wrong
     
    203215       
    204216        if (suff.equals("ns")) {
    205             if (i==children.length-1)return children[i];
     217            if (i==children.length-1) {
     218            return children[i];
     219            }
    206220            return children[i+1];
    207221        } else if (suff.equals("ps")) {
    208             if (i==0) return children[i];
     222            if (i==0) {
     223            return children[i];
     224            }
    209225            return children[i-1];
    210226        }
Note: See TracChangeset for help on using the changeset viewer.