|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.vt.marian.common.FullID | +--edu.vt.marian.common.WtdObj
class name: WtdObj
class description: an object together with a weight (e.g., match to a query).
uses the services of class(es):
designer(s): Robert France (france@vt.edu)
implementator(s): Robert France
finished time:
known bugs:
JDK version: 1.1.5
side effects:
Field Summary | |
static int |
INVALID
the methods' return values |
protected Weight |
weight
the weight value for this object. |
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 | |
WtdObj(java.io.BufferedReader br,
Debug debug)
method description: Create a WtdObj from an input stream. |
|
WtdObj(Debug debug)
method description: Create an invalid WtdObj. |
|
WtdObj(FullID id,
Weight wt,
Debug debug)
method description: Create a WtdObj from a FullID and a Weight. |
|
WtdObj(int clID,
int instID,
Weight wt,
Debug debug)
method description: Create a WtdObj from atomic values. |
|
WtdObj(WtdObj w,
Debug debug)
method description: Create a WtdObj equal to another WtdObj in all ways. |
Method Summary | |
void |
accum(double f)
method description: "Add" a double between 0..1 to the weight of this WtdObj. |
void |
accum(Weight wt)
method description: "Add" a Weight to the weight of this WtdObj. |
int |
compare(Weight wt)
|
int |
compare(WtdObj w)
|
FullID |
getID()
method description: Return the id portion of this WtdObj. |
Weight |
getWeight()
method description: Return the weight of this WtdObj. |
boolean |
isValid()
method description: Indicate whether or not the this WtdObj is valid. |
int |
readPacked(java.io.ByteArrayInputStream s)
method description: Unpack a WtdObj from a Byte array of small, fixed size. |
void |
scale(double f)
method description: Scale the weight of this WtdObj by a double between 0..1. |
void |
scale(Weight wt)
method description: Scale the weight of this WtdObj by a Weight. |
int |
toStream(java.io.PrintWriter pw)
method description: Print the content of this object to a stream. |
java.lang.String |
toString()
method description: Create a human-readable string for this. |
int |
writePacked(java.io.ByteArrayOutputStream s)
method description: Pack a WtdObj into a Byte array of small, fixed size. |
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 |
protected Weight weight
public static final int INVALID
Constructor Detail |
public WtdObj(Debug debug)
uses the services of class(es): none
input parameter(s): debug -- used for debugging
output parameter(s): none
return value: none
public WtdObj(WtdObj w, Debug debug)
uses the services of class(es): none
input parameter(s): w -- the WtdObj to be copied debug -- used for debugging
output parameter(s): none
return value: none
public WtdObj(FullID id, Weight wt, Debug debug)
uses the services of class(es): none
input parameter(s): id -- the (full) ID of this object; wt -- the weight assigned to this object; debug -- used for debugging
output parameter(s): none
return value: none
public WtdObj(int clID, int instID, Weight wt, Debug debug)
uses the services of class(es): none
input parameter(s): clID -- the class ID of this object; instID -- the instance ID of this object; wt -- the weight assigned to this object; debug -- used for debugging
output parameter(s): none
return value: none
public WtdObj(java.io.BufferedReader br, Debug debug)
uses the services of class(es):
input parameter(s): br -- the stream from which to read out this object; debug -- used for debugging
output parameter(s): none
return value: none
Method Detail |
public boolean isValid()
uses the services of class(es): none
input parameter(s): none
output parameter(s): none
return value: true / false
public int compare(WtdObj w)
public int compare(Weight wt)
public void scale(Weight wt)
uses the services of class(es): none
input parameter(s): wt -- the value to scale by.
output parameter(s): none
return value: none
public void scale(double f)
uses the services of class(es): none
input parameter(s): f -- the value to scale by.
output parameter(s): none
return value: none
public void accum(Weight wt)
uses the services of class(es): none
input parameter(s): wt -- the value to scale by.
output parameter(s): none
return value: none
public void accum(double f)
uses the services of class(es): none
input parameter(s): f -- the value to scale by.
output parameter(s): none
return value: none
public Weight getWeight()
uses the services of class(es): none
input parameter(s): none
output parameter(s): none
return value: the value of this WtdObj as a (new) Weight.
public FullID getID()
uses the services of class(es): none
input parameter(s): none
output parameter(s): none
return value: the value of this WtdObj as a (new) FullID.
public int writePacked(java.io.ByteArrayOutputStream s)
uses the services of class(es): none
input parameter(s): s -- the ByteArrayOutputStream into which to pack this.
output parameter(s): s -- the ByteArrayOutputStream, with this packed in.
return value: OK or INVALID
FORMAT: classID and weight by design will each fit into two bytes. To minimize
allignment problems, we pack those two first and the four-byte instanceID
last.
public int readPacked(java.io.ByteArrayInputStream s)
uses the services of class(es): none
input parameter(s): s -- the ByteArrayInputStream from which to unpack this.
output parameter(s): none.
return value: OK, NULL_STREAM, or INVALID
FORMAT: see writePacked().
public int toStream(java.io.PrintWriter pw)
uses the services of class(es):
input parameter(s): pw -- the stream to write this object
output parameter(s): none
return value: OK -- the object has been written to the stream correctly NULL_STREAM -- the parameter stream is null
public java.lang.String toString()
uses the services of class(es):
input parameter(s): none
output parameter(s): none
return value: A string of the format #classID:instanceID:weight# for any valid object, or @null@ for an invalid one.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |