Package edu.wpi.first.hal
Class HALValue
- java.lang.Object
-
- edu.wpi.first.hal.HALValue
-
public final class HALValue extends Object
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static HALValuefromNative(int type, long value1, double value2)Build a HAL value from its native components.booleangetBoolean()Get the value as a boolean.doublegetDouble()Get the value as a double.longgetLong()Get the value as a long.doublegetNativeDouble()Get the native double value.longgetNativeLong()Get the native long value.intgetType()Get the type of the value.static HALValuemakeBoolean(boolean value)Build a HAL boolean value.static HALValuemakeDouble(double value)Build a HAL double value.static HALValuemakeEnum(int value)Build a HAL enum value.static HALValuemakeInt(int value)Build a HAL integer value.static HALValuemakeLong(long value)Build a HAL long value.static HALValuemakeUnassigned()
-
-
-
Field Detail
-
kUnassigned
public static final int kUnassigned
- See Also:
- Constant Field Values
-
kBoolean
public static final int kBoolean
- See Also:
- Constant Field Values
-
kDouble
public static final int kDouble
- See Also:
- Constant Field Values
-
kEnum
public static final int kEnum
- See Also:
- Constant Field Values
-
kInt
public static final int kInt
- See Also:
- Constant Field Values
-
kLong
public static final int kLong
- See Also:
- Constant Field Values
-
-
Method Detail
-
getType
public int getType()
Get the type of the value.- Returns:
- Type (e.g. kBoolean).
-
getBoolean
public boolean getBoolean()
Get the value as a boolean. Does not perform type checking.- Returns:
- value contents
-
getLong
public long getLong()
Get the value as a long. Does not perform type checking.- Returns:
- value contents
-
getDouble
public double getDouble()
Get the value as a double. Does not perform type checking.- Returns:
- value contents
-
getNativeLong
public long getNativeLong()
Get the native long value. Does not perform type checking.- Returns:
- value contents
-
getNativeDouble
public double getNativeDouble()
Get the native double value. Does not perform type checking.- Returns:
- value contents
-
makeBoolean
public static HALValue makeBoolean(boolean value)
Build a HAL boolean value.- Parameters:
value- value- Returns:
- HAL value
-
makeEnum
public static HALValue makeEnum(int value)
Build a HAL enum value.- Parameters:
value- value- Returns:
- HAL value
-
makeInt
public static HALValue makeInt(int value)
Build a HAL integer value.- Parameters:
value- value- Returns:
- HAL value
-
makeLong
public static HALValue makeLong(long value)
Build a HAL long value.- Parameters:
value- value- Returns:
- HAL value
-
makeDouble
public static HALValue makeDouble(double value)
Build a HAL double value.- Parameters:
value- value- Returns:
- HAL value
-
makeUnassigned
public static HALValue makeUnassigned()
-
fromNative
public static HALValue fromNative(int type, long value1, double value2)
Build a HAL value from its native components.- Parameters:
type- typevalue1- long value (all except double)value2- double value (for double only)- Returns:
- HAL value
-
-