Package com.stata.sfi

Class LabelValue

java.lang.Object
com.stata.sfi.LabelValue
All Implemented Interfaces:
Comparable<LabelValue>

public class LabelValue extends Object implements Comparable<LabelValue>
This class encapsulates a Stata value-label value.
  • Constructor Details

    • LabelValue

      public LabelValue(double value)
      Construct a new LabelValue from a double. This can be used directly with values returned by Data.getNum(int, long).
      Parameters:
      value - The value.
    • LabelValue

      public LabelValue(Integer value)
      Convenience constructor for integer types. For extended-missing values, use either LabelValue(double) with Missing.getMissing(double) or LabelValue(Missing.Extended).
      Parameters:
      value - The value.
    • LabelValue

      public LabelValue(Missing.Extended missingValue)
      Convenience constructor for extended-missing values. Note that Missing.Extended._sys is not supported.
      Parameters:
      missingValue - The extended missing value.
  • Method Details

    • compareTo

      public int compareTo(LabelValue anotherValue)
      Compares two LabelValue objects numerically.
      Specified by:
      compareTo in interface Comparable<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

      public Integer getValue()
      Returns the value of this LabelValue as an Integer.
      Returns:
      The numeric value represented by this object.
    • toString

      public String toString()
      Returns a String object representing this LabelValue's value; missing values are converted to their Stata string equivalents.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value of this object.