|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.vt.marian.common.Weight
The weight of an object in some approximate context (e.g., match to a query).
designer(s): Jianxin Zhao (jxzhao@csgrad.cs.vt.edu)
implementator(s): Jianxin Zhao, Robert France
JDK version: 1.1.5
Field Summary | |
static Weight |
bottomWt
|
static int |
EQUAL
the methods' return values. |
static int |
HIGHER
|
static int |
LOWER
|
static int |
NOT_APPLY
|
static int |
NULL_STREAM
|
static Weight |
topWt
Public versions of the bounds for reasonable values. |
Constructor Summary | |
Weight(java.io.BufferedReader br,
Debug debug)
Create a Weight object from an input stream. |
|
Weight(Debug debug)
Create an invalid Weight object. |
|
Weight(double f,
Debug debug)
Create a Weight object based on a specified value. |
|
Weight(int i,
Debug debug)
Create a Weight object based on a specified value. |
|
Weight(Weight w)
Create a Weight object based on another Weight object. |
Method Summary | |
void |
accum(double f)
"Add" a float between 0..1 to this object. |
void |
accum(Weight w)
"Add" one Weight to another. |
int |
compare(Weight w)
Return the result of the comparision between this Weight object and the parameter Weight object. |
int |
getUnderlyingValue()
|
double |
getValue()
Return the value of this Weight object. |
boolean |
isValid()
Tell whether or not this Weight object is valid. |
int |
readPacked(java.io.ByteArrayInputStream bis)
Read this out of compact storage in a byte array. |
void |
scale(double f)
method description: Scale one Weight by a real constant. |
void |
scale(Weight w)
Scale one Weight by another. |
void |
set(Weight w)
|
int |
toStream(java.io.PrintWriter pw)
Print the content of this object to a specified stream. |
int |
writePacked(java.io.ByteArrayOutputStream bos)
Pack this into a byte array for compact storage. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final Weight topWt
public static final Weight bottomWt
public static final int EQUAL
public static final int HIGHER
public static final int LOWER
public static final int NOT_APPLY
public static final int NULL_STREAM
Constructor Detail |
public Weight(Debug debug)
debug
- used for debuggingpublic Weight(int i, Debug debug)
i
- the underlying value for this Weight objectdebug
- used for debuggingpublic Weight(double f, Debug debug)
f
- the value of this Weight object;debug
- used for debuggingpublic Weight(Weight w)
w
- the Weight object to copy.public Weight(java.io.BufferedReader br, Debug debug)
br
- the stream to read out this objectdebug
- used for debuggingMethod Detail |
public boolean isValid()
public int compare(Weight w)
w
- the Weight object used to compared with this objectpublic void scale(Weight w)
w
- the Weight object used to scale this object.
NOTE: We are using the integer values lower_limit..upper_limit to mimic the real number interval 0..1. As long as lower_limit == 0) we need only adjust to keep values proportionally under upper_limit, which we treat both as the top value and as multiplicative identity. We achieve this by multiplying the two "value" fields, then shifting the result right by 15 bits (effectively dividing by 2**15).
public void scale(double f)
f
- the double precision value used to scale this object.public void accum(Weight w)
w
- the Weight object to be accumulated into this object.public void accum(double f)
f
- -- the double precision value to be accumulated into this object.public double getValue()
public int getUnderlyingValue()
public void set(Weight w)
public int writePacked(java.io.ByteArrayOutputStream bos)
bos
- a ByteArrayOutputStream into which to pack this.public int readPacked(java.io.ByteArrayInputStream bis)
bis
- a ByteArrayInputStream from which to unpack this.public int toStream(java.io.PrintWriter pw)
pw
- -- the stream to write this object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |