All Packages Class Hierarchy This Package Previous Next Index
Class edu.vt.marian.common.Weight
java.lang.Object
|
+----edu.vt.marian.common.Weight
- public class Weight
- extends Object
- implements Sortable
The weight of an object in some approximate context (e.g., match to
a query).
-
bottomWt
-
-
EQUAL
- the methods' return values.
-
HIGHER
-
-
LOWER
-
-
NOT_APPLY
-
-
NULL_STREAM
-
-
topWt
- Public versions of the bounds for reasonable values.
-
Weight(BufferedReader, Debug)
- Create a Weight object from an input stream.
-
Weight(Debug)
- Create an invalid Weight object.
-
Weight(double, Debug)
- Create a Weight object based on a specified value.
-
Weight(int, Debug)
- Create a Weight object based on a specified value.
-
Weight(Weight)
- Create a Weight object based on another Weight object.
-
accum(double)
- "Add" a float between 0..1 to this object.
-
accum(Weight)
- "Add" one Weight to another.
-
compare(Object)
-
-
compare(Weight)
- Return the result of the comparision between this Weight object
and the parameter Weight object.
-
getUnderlyingValue()
-
-
getValue()
- Return the value of this Weight object.
-
isValid()
- Tell whether or not this Weight object is valid.
-
readPacked(ByteArrayInputStream)
- Read this out of compact storage in a byte array.
-
scale(double)
- Scale one Weight by a real constant.
-
scale(Weight)
- Scale one Weight by another.
-
set(Weight)
-
-
toStream(PrintWriter)
- Print the content of this object to a specified stream.
-
writePacked(ByteArrayOutputStream)
- Pack this into a byte array for compact storage.
topWt
public static final Weight topWt
- Public versions of the bounds for reasonable values.
bottomWt
public static final Weight bottomWt
EQUAL
public static final int EQUAL
- the methods' return values.
HIGHER
public static final int HIGHER
LOWER
public static final int LOWER
NOT_APPLY
public static final int NOT_APPLY
NULL_STREAM
public static final int NULL_STREAM
Weight
public Weight(Debug debug)
- Create an invalid Weight object.
- Parameters:
- debug - used for debugging
Weight
public Weight(int i,
Debug debug)
- Create a Weight object based on a specified value.
- Parameters:
- i - the underlying value for this Weight object
- debug - used for debugging
Weight
public Weight(double f,
Debug debug)
- Create a Weight object based on a specified value.
- Parameters:
- f - the value of this Weight object;
- debug - used for debugging
Weight
public Weight(Weight w)
- Create a Weight object based on another Weight object.
- Parameters:
- w - the Weight object to copy.
Weight
public Weight(BufferedReader br,
Debug debug)
- Create a Weight object from an input stream.
- Parameters:
- br - the stream to read out this object
- debug - used for debugging
isValid
public boolean isValid()
- Tell whether or not this Weight object is valid.
- Returns:
- true if this weight has a valid value set; false otherwise.
compare
public int compare(Weight w)
- Return the result of the comparision between this Weight object
and the parameter Weight object.
- Parameters:
- w - the Weight object used to compared with this object
- Returns:
- EQUAL -- their values are equal;
HIGHER -- the value of this object is higher than the parameter object;
LOWER -- the value of this object is lower than the parameter object.
compare
public int compare(Object obj)
scale
public void scale(Weight w)
- Scale one Weight by another.
- Parameters:
- 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 16 bits (effectively
dividing by 2**16).
scale
public void scale(double f)
- Scale one Weight by a real constant.
- Parameters:
- f - the double precision value used to scale this object.
accum
public void accum(Weight w)
- "Add" one Weight to another.
- Parameters:
- w - the Weight object to be accumulated into this object.
accum
public void accum(double f)
- "Add" a float between 0..1 to this object.
- Parameters:
- f - the double precision value to be accumulated into
this object.
getValue
public double getValue()
- Return the value of this Weight object.
- Returns:
- the value of this Weight object as a double.
getUnderlyingValue
public int getUnderlyingValue()
set
public void set(Weight w)
writePacked
public int writePacked(ByteArrayOutputStream bos)
- Pack this into a byte array for compact storage.
- Parameters:
- bos - a ByteArrayOutputStream into which to pack this.
- Returns:
- OK -- all jake; NULL_STREAM -- could not write.
readPacked
public int readPacked(ByteArrayInputStream bis)
- Read this out of compact storage in a byte array.
- Parameters:
- bis - a ByteArrayInputStream from which to unpack this.
- Returns:
- OK -- all jake; NULL_STREAM -- could not read.
toStream
public int toStream(PrintWriter pw)
- Print the content of this object to a specified stream.
- Parameters:
- pw - the stream to write this object
- Returns:
- OK -- the object has been written to the stream correctly;
NULL_STREAM -- the parameter stream is null
All Packages Class Hierarchy This Package Previous Next Index