Package com.stata.sfi
Class LabelValue
java.lang.Object
com.stata.sfi.LabelValue
- All Implemented Interfaces:
Comparable<LabelValue>
This class encapsulates a Stata value-label value.
-
Constructor Summary
ConstructorsConstructorDescriptionLabelValue(double value) Construct a new LabelValue from a double.LabelValue(Missing.Extended missingValue) Convenience constructor for extended-missing values.LabelValue(Integer value) Convenience constructor for integer types. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(LabelValue anotherValue) Compares two LabelValue objects numerically.getValue()Returns the value of this LabelValue as anInteger.toString()Returns a String object representing this LabelValue's value; missing values are converted to their Stata string equivalents.
-
Constructor Details
-
LabelValue
public LabelValue(double value) Construct a new LabelValue from a double. This can be used directly with values returned byData.getNum(int, long).- Parameters:
value- The value.
-
LabelValue
Convenience constructor for integer types. For extended-missing values, use eitherLabelValue(double)withMissing.getMissing(double)orLabelValue(Missing.Extended).- Parameters:
value- The value.
-
LabelValue
Convenience constructor for extended-missing values. Note that Missing.Extended._sys is not supported.- Parameters:
missingValue- The extended missing value.
-
-
Method Details
-
compareTo
Compares two LabelValue objects numerically.- Specified by:
compareToin interfaceComparable<LabelValue>- Parameters:
anotherValue- The LabelValue to be compared.- Returns:
- The value 0 if this LabelValue is equal to the argument LabelValue; a value less than 0 if this LabelValue is numerically less than the argument LabelValue; and a value greater than 0 if this LabelValue is numerically greater than the argument LabelValue.
-
getValue
Returns the value of this LabelValue as anInteger.- Returns:
- The numeric value represented by this object.
-
toString
Returns a String object representing this LabelValue's value; missing values are converted to their Stata string equivalents.
-