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.
-
extracted
- whether obj is a raw string, or has been "extracted" and
converted into a real DigInfObj.
-
NO_CAN_DO
-
-
obj
- either an object of class classID or a string from which such an object
can be extracted.
-
OK
- return values of methods of this class
-
UNKNOWN_CLASS
-
-
WtdEntireObj(BufferedReader, Debug)
- method description: this constructor will create a WtdEntireObj
object from the specified stream
-
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):
-
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):
-
getDocument()
- return the (extracted) Document object.
-
getRawObj()
- return the raw string of the document this object represents.
-
setDocument(Document)
- set the entire object to (a clone of) an extracted object.
-
setRawObj(String)
- set this to a (non-extracted) String representation of the entire object.
-
toStream(PrintWriter)
- print the contents of this object to the specified stream.
obj
protected Object obj
- either an object of class classID or a string from which such an object
can be extracted.
extracted
protected boolean extracted
- whether obj is a raw string, or has been "extracted" and
converted into a real DigInfObj.
OK
public static final int OK
- return values of methods of this class
UNKNOWN_CLASS
public static final int UNKNOWN_CLASS
NO_CAN_DO
public static final int NO_CAN_DO
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
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
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
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
getRawObj
public String getRawObj()
- return the raw string of the document this object represents.
- Returns:
- this document as a string
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.
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
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