edu.vt.marian.search
Class WtdObjDoubleLink

java.lang.Object
  |
  +--edu.vt.marian.common.FullID
        |
        +--edu.vt.marian.common.WtdObj
              |
              +--edu.vt.marian.search.WtdObjSingleLink
                    |
                    +--edu.vt.marian.search.WtdObjDoubleLink

public class WtdObjDoubleLink
extends WtdObjSingleLink

This class augments singly-linked weighted objects with a "pointer" to a "previous" FullID key. This is to enable the creation of weighted object tables which are "threaded" like a doubly-linked list. The purpose of such a table is to allow O(1) ("direct") access to any point in the logical list, but thereafter to "follow" the entries in the list from that point forwards or backwards.

See Also:
WtdObj, FullID, Debug

Field Summary
protected  edu.vt.marian.common.FullID previous
          "Pointer" to the previous "list" entry
 
Fields inherited from class edu.vt.marian.search.WtdObjSingleLink
next
 
Fields inherited from class edu.vt.marian.common.WtdObj
INVALID, weight
 
Fields inherited from class edu.vt.marian.common.FullID
BAD_PARAMS, classID, debug, instanceID, MAX_CLASS_ID, MAX_INSTANCE_ID, NULL_STREAM, OK
 
Constructor Summary
WtdObjDoubleLink(edu.vt.marian.common.Debug debug)
          Create a doubly-linked weighted object given only a debug object.
WtdObjDoubleLink(edu.vt.marian.common.WtdObj w, edu.vt.marian.common.Debug debug)
          Create a doubly-linked weighted object given a weighted object and a debug object.
WtdObjDoubleLink(edu.vt.marian.common.WtdObj w, edu.vt.marian.common.FullID next, edu.vt.marian.common.Debug debug)
          Create a doubly-linked weighted object given a weighted object, a FullID pointing to the "next" list item, and a debug object.
WtdObjDoubleLink(edu.vt.marian.common.WtdObj w, edu.vt.marian.common.FullID next, edu.vt.marian.common.FullID prev, edu.vt.marian.common.Debug debug)
          Create a doubly-linked weighted object given a weighted object, a FullID pointing to the "next" list item, and a debug object.
 
Method Summary
 edu.vt.marian.common.FullID getPrevious()
          Return the FullID key of the previous item pointed to in this ordering.
 java.lang.String toString()
          Convert this WtdObjDoubleLink to a string representation.
 
Methods inherited from class edu.vt.marian.search.WtdObjSingleLink
getNext, setNext
 
Methods inherited from class edu.vt.marian.common.WtdObj
accum, accum, compare, compare, getID, getWeight, isValid, readPacked, scale, scale, toStream, writePacked
 
Methods inherited from class edu.vt.marian.common.FullID
equals, getClassID, getInstanceID, hashCode, setClassID, setInstanceID
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

previous

protected edu.vt.marian.common.FullID previous
"Pointer" to the previous "list" entry
Constructor Detail

WtdObjDoubleLink

public WtdObjDoubleLink(edu.vt.marian.common.Debug debug)
Create a doubly-linked weighted object given only a debug object. The resultant object will have its weighted object set to a newly-created WtdObj and its previous and next "pointers" set to newly-created---and invalid---FullIDs.
Parameters:
debug - debug object

WtdObjDoubleLink

public WtdObjDoubleLink(edu.vt.marian.common.WtdObj w,
                        edu.vt.marian.common.Debug debug)
Create a doubly-linked weighted object given a weighted object and a debug object. The resultant object will have its next and previous "pointers" set to newly-created---and invalid---FullIDs.
Parameters:
w - weighted object
debug - debug object

WtdObjDoubleLink

public WtdObjDoubleLink(edu.vt.marian.common.WtdObj w,
                        edu.vt.marian.common.FullID next,
                        edu.vt.marian.common.Debug debug)
Create a doubly-linked weighted object given a weighted object, a FullID pointing to the "next" list item, and a debug object. The resultant object will have its next "pointer" set to the one given, and its "previous" pointer to a newly-created---and invalid---FullID.
Parameters:
w - weighted object
next - key of next element in this list
debug - debug object

WtdObjDoubleLink

public WtdObjDoubleLink(edu.vt.marian.common.WtdObj w,
                        edu.vt.marian.common.FullID next,
                        edu.vt.marian.common.FullID prev,
                        edu.vt.marian.common.Debug debug)
Create a doubly-linked weighted object given a weighted object, a FullID pointing to the "next" list item, and a debug object. The resultant object will have its next "pointer" set to the one given, and its "previous" pointer to a newly-created---and invalid---FullID.
Parameters:
w - weighted object
next - key of next element in this list
prev - key of previous element in this list
debug - debug object
Method Detail

getPrevious

public edu.vt.marian.common.FullID getPrevious()
Return the FullID key of the previous item pointed to in this ordering.
Returns:
key of the next weighted object in this ordering

toString

public java.lang.String toString()
Convert this WtdObjDoubleLink to a string representation. The printable form is "WtdObjSingleLink(FullID)", where WtdObjSingleLink is the string representation of the singly-linked weighted object portion of this object, and the FullIDs are the string representations of the FullID "next" and "previous" pointers of this object respectively.
Returns:
string containing printable representation of object data
Overrides:
toString in class WtdObjSingleLink
See Also:
WtdObjSingleLink.toString(), FullID.toString()