java.lang.Object
org.cyclops.integrateddynamics.core.evaluate.variable.ValueBase
All Implemented Interfaces:
IValue
Direct Known Subclasses:
ValueObjectTypeEntity.ValueEntity, ValueObjectTypeFluidStack.ValueFluidStack, ValueObjectTypeItemStack.ValueItemStack, ValueOptionalBase, ValueTypeBoolean.ValueBoolean, ValueTypeDouble.ValueDouble, ValueTypeInteger.ValueInteger, ValueTypeList.ValueList, ValueTypeLong.ValueLong, ValueTypeOperator.ValueOperator, ValueTypeString.ValueString

public abstract class ValueBase extends Object implements IValue
Base implementation of a variable.
  • Constructor Details

    • ValueBase

      protected ValueBase(IValueType type)
  • Method Details

    • getType

      public IValueType getType()
      Specified by:
      getType in interface IValue
      Returns:
      The type of this variable.
    • getValueCastRegistry

      protected IValueCastRegistry getValueCastRegistry()
    • cast

      public <V extends IValue> V cast(IValueType<V> valueType) throws IValueCastRegistry.ValueCastException
      Description copied from interface: IValue
      Safely downcast this value.
      Specified by:
      cast in interface IValue
      Type Parameters:
      V - The actual value type.
      Parameters:
      valueType - The type of value to cast to.
      Returns:
      The downcasted value.
      Throws:
      IValueCastRegistry.ValueCastException - If this value could not be cast to the given type.
    • canCast

      public <V extends IValue> boolean canCast(IValueType<V> valueType)
      Description copied from interface: IValue
      Safely downcast this value.
      Specified by:
      canCast in interface IValue
      Type Parameters:
      V - The actual value type.
      Parameters:
      valueType - The type of value to cast to.
      Returns:
      If this value can be casted to the target type.