Class MCValueInt

java.lang.Object
de.monticore.values.MCValueInt
All Implemented Interfaces:
MCValue

public class MCValueInt extends Object implements MCValue
  • Field Details

    • value

      protected int value
  • Constructor Details

    • MCValueInt

      public MCValueInt(int value)
  • Method Details

    • isPrimitive

      public boolean isPrimitive()
      Specified by:
      isPrimitive in interface MCValue
    • isInt

      public boolean isInt()
      Specified by:
      isInt in interface MCValue
    • asByte

      public byte asByte()
      Specified by:
      asByte in interface MCValue
    • asShort

      public short asShort()
      Specified by:
      asShort in interface MCValue
    • asChar

      public char asChar()
      Specified by:
      asChar in interface MCValue
    • asInt

      public int asInt()
      Specified by:
      asInt in interface MCValue
    • asLong

      public long asLong()
      Specified by:
      asLong in interface MCValue
    • asFloat

      public float asFloat()
      Specified by:
      asFloat in interface MCValue
    • asDouble

      public double asDouble()
      Specified by:
      asDouble in interface MCValue
    • asNativeObject

      public Integer asNativeObject()
      Description copied from interface: MCValue
      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.

      Specified by:
      asNativeObject in interface MCValue
      Returns:
      The value as a Java native Object.
    • asString

      public String asString()
      Specified by:
      asString in interface MCValue
    • checkEqualityOperator

      public boolean checkEqualityOperator(MCValue other)
      Description copied from interface: MCValue
      basically implements ==
      Specified by:
      checkEqualityOperator in interface MCValue
      Parameters:
      other - the value to check against this
      Returns:
      whether they are considered equal
    • printType

      public String printType()
      Description copied from interface: MCValue
      Print the type of the MIValue in human-readable form
      Specified by:
      printType in interface MCValue
    • printValue

      public String printValue()
      Description copied from interface: MCValue
      Print the value in human-readable form
      Specified by:
      printValue in interface MCValue