All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class edu.vt.marian.common.WtdEntireObj

java.lang.Object
   |
   +----edu.vt.marian.common.FullID
           |
           +----edu.vt.marian.common.WtdObj
                   |
                   +----edu.vt.marian.common.WtdEntireObj

public class WtdEntireObj
extends WtdObj
A Weighted Object that actually includes the full object! Unlike the class WtdObj, which only includes a FullID, a WtdEntireObj also includes a Java Object which is the actual instance selected by the FullID.

We actually use WtEntireObjs in two ways. In what might be thought of as the paradigmatic use, the Object is a digital information object and implements some sub-interface of DigInfObj. At several levels of MARIAN, however, this is overkill, and we simply need to more the raw object around, in the form of an unanalyzed string or stream, without creating a DigInfObj instance from it.


Variable Index

 o extracted
whether obj is a raw string, or has been "extracted" and converted into a real DigInfObj.
 o NO_CAN_DO
 o obj
either an object of class classID or a string from which such an object can be extracted.
 o OK
return values of methods of this class
 o UNKNOWN_CLASS

Constructor Index

 o WtdEntireObj(BufferedReader, Debug)
method description: this constructor will create a WtdEntireObj object from the specified stream
 o WtdEntireObj(FullID, Weight, Document, Debug)
method description: this constructor will create a WtdEntireObj from the specified id, weight and document string

uses the services of class(es):

 o WtdEntireObj(FullID, Weight, String, Debug)
method description: this constructor will create a WtdEntireObj from the specified id, weight and document string

uses the services of class(es):

Method Index

 o getDocument()
return the (extracted) Document object.
 o getRawObj()
return the raw string of the document this object represents.
 o setDocument(Document)
set the entire object to (a clone of) an extracted object.
 o setRawObj(String)
set this to a (non-extracted) String representation of the entire object.
 o toStream(PrintWriter)
print the contents of this object to the specified stream.

Variables

 o obj
 protected Object obj
either an object of class classID or a string from which such an object can be extracted.

 o extracted
 protected boolean extracted
whether obj is a raw string, or has been "extracted" and converted into a real DigInfObj.

 o OK
 public static final int OK
return values of methods of this class

 o UNKNOWN_CLASS
 public static final int UNKNOWN_CLASS
 o NO_CAN_DO
 public static final int NO_CAN_DO

Constructors

 o WtdEntireObj
 public WtdEntireObj(BufferedReader br,
                     Debug debug)
method description: this constructor will create a WtdEntireObj object from the specified stream

Parameters:
br - the stream to read out this document
debug - used for debugging
 o WtdEntireObj
 public WtdEntireObj(FullID id,
                     Weight w,
                     Document o,
                     Debug debug)
method description: this constructor will create a WtdEntireObj from the specified id, weight and document string

uses the services of class(es):

Parameters:
id - this will be the id of this document
w - this will be the weight at which this document corresponds to a query
o - the Object that id stands for.
debug - used for debugging
 o WtdEntireObj
 public WtdEntireObj(FullID id,
                     Weight w,
                     String rawObj,
                     Debug debug)
method description: this constructor will create a WtdEntireObj from the specified id, weight and document string

uses the services of class(es):

Parameters:
id - this will be the id of this document
w - this will be the weight at which this document corresponds to a query
o - the document that id stands for in raw (String) form.
debug - used for debugging

Methods

 o toStream
 public int toStream(PrintWriter pw)
print the contents of this object to the specified stream.

Parameters:
pw - the stream to write this object
Returns:
OK -- this object has been written to the stream correctly
NULL_STREAM -- the parameter stream is null
Overrides:
toStream in class WtdObj
 o getRawObj
 public String getRawObj()
return the raw string of the document this object represents.

Returns:
this document as a string
 o setRawObj
 public int setRawObj(String objectAsString)
set this to a (non-extracted) String representation of the entire object.

Parameters:
objectAsString - a String from which the entire object can be built.
Returns:
OK -- the new raw marc record has been set correctly
BAD_PARAMS -- the parameter is null

NOTE: What if this is of class String? Then you should use setEntireObj() instead of setRaw() to avoid confusion.

 o setDocument
 public int setDocument(Document o)
set the entire object to (a clone of) an extracted object.

Parameters:
o - the object corresponding to this.id.
Returns:
OK -- the new object has been set correctly
BAD_PARAMS -- the parameter is null
 o getDocument
 public Document getDocument()
return the (extracted) Document object.

Returns:
(a reference to) an object implementing Document.

All Packages  Class Hierarchy  This Package  Previous  Next  Index