Package de.monticore.values
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 Summary
Modifier and TypeMethodDescriptiondefault booleandefault byteasByte()default charasChar()default doubleasDouble()default StringasError()default floatasFloat()default MCValueFunctiondefault intasInt()default longasLong()Used to pass the value to native Java classes and similar, e.g., collections.default MCValueObjectasObject()cf.default shortasShort()default StringasString()booleancheckEqualityOperator(MCValue other) basically implements==default booleandefault booleanisByte()default booleanisChar()default booleanisDouble()default booleanisError()default booleanisFloat()default booleandefault booleanisInt()default booleanisLong()default booleanisObject()default booleandefault booleanisShort()default booleanisSIUnit()default booleanisString()helper for String specificallydefault booleanisVoid()Print the type of the MIValue in human-readable formPrint the value in human-readable form
-
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
-
asObject
cf.asNativeObject().- Returns:
- The value as an
MCValueObject, iff it is one.
-
asString
-
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
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
-