Interface MCValueFunction

All Superinterfaces:
MCValue
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface MCValueFunction extends MCValue
A value that is an executable function.
  • Method Details

    • execute

      MCValue execute(MCValue[] arguments)
    • execute

      default MCValue execute(List<MCValue> arguments)
    • isFunction

      default boolean isFunction()
      Specified by:
      isFunction in interface MCValue
    • asFunction

      default MCValueFunction asFunction()
      Specified by:
      asFunction in interface MCValue
    • asNativeObject

      default MCValueFunction 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.
    • checkEqualityOperator

      default boolean checkEqualityOperator(MCValue other)
      Technically, functions don't have an identity or the identity is (near) non-computable (depending on interpretation). But for simplicity of the MIValue interface, a somewhat reasonable implementation is given.
      Specified by:
      checkEqualityOperator in interface MCValue
      Parameters:
      other - the value to check against this
      Returns:
      whether they are the same function _pointer_
    • printType

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

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