Interface MCValue

All Known Subinterfaces:
MCValueFunction
All Known Implementing Classes:
MCValueBoolean, MCValueDouble, MCValueError, MCValueInt, MCValueObject, MCValueVoid

public interface MCValue
Represents a value, e.g., of an expression.
  • Method Details

    • isPrimitive

      default boolean isPrimitive()
    • isBoolean

      default boolean isBoolean()
    • isByte

      default boolean isByte()
    • isChar

      default boolean isChar()
    • isShort

      default boolean isShort()
    • isInt

      default boolean isInt()
    • isLong

      default boolean isLong()
    • isFloat

      default boolean isFloat()
    • isDouble

      default boolean isDouble()
    • isObject

      default boolean isObject()
    • isString

      default boolean isString()
      helper for String specifically
    • isFunction

      default boolean isFunction()
    • isVoid

      default boolean isVoid()
    • isSIUnit

      default boolean isSIUnit()
    • isError

      default boolean isError()
    • asBoolean

      default boolean asBoolean()
    • asByte

      default byte asByte()
    • asChar

      default char asChar()
    • asShort

      default short asShort()
    • asInt

      default int asInt()
    • asLong

      default long asLong()
    • asFloat

      default float asFloat()
    • asDouble

      default double asDouble()
    • asFunction

      default MCValueFunction asFunction()
    • asObject

      default MCValueObject asObject()
      Returns:
      The value as an MCValueObject, iff it is one.
    • asString

      default String asString()
    • asError

      default String asError()
    • asNativeObject

      Object asNativeObject()
      Used to pass the value to native Java classes and similar, e.g., collections.

      Note: not all values can have a native representation, as such, their native version is the MIValue itself.

      Returns:
      The value as a Java native Object.
    • checkEqualityOperator

      boolean checkEqualityOperator(MCValue other)
      basically implements ==
      Parameters:
      other - the value to check against this
      Returns:
      whether they are considered equal
    • printType

      String printType()
      Print the type of the MIValue in human-readable form
    • printValue

      String printValue()
      Print the value in human-readable form