java.lang.Object
org.cyclops.integrateddynamics.core.evaluate.operator.OperatorBase
All Implemented Interfaces:
IOperator
Direct Known Subclasses:
CastOperator, CombinedOperator, CompositionalOperator, GeneralOperator, ParseOperator, PositionedOperator, PredicateOperator

public abstract class OperatorBase extends Object implements IOperator
A basic abstract implementation of an operator.
  • Constructor Details

  • Method Details

    • constructInputVariables

      public static IValueType[] constructInputVariables(int length, IValueType defaultType)
    • getUnlocalizedType

      protected abstract String getUnlocalizedType()
    • getFunction

      protected OperatorBase.IFunction getFunction()
    • getUniqueName

      public net.minecraft.resources.ResourceLocation getUniqueName()
      Specified by:
      getUniqueName in interface IOperator
      Returns:
      The unique name for this operator, only used for internal storage.
    • getInteractName

      public String getInteractName()
      Specified by:
      getInteractName in interface IOperator
      Returns:
      The unique interact name for this operator, when interacting with this operator using external contexts, such as Integrated Scripting.
    • getGlobalInteractNamePrefix

      @Nullable public String getGlobalInteractNamePrefix()
      Specified by:
      getGlobalInteractNamePrefix in interface IOperator
      Returns:
      Override for the default global interact name prefix.
    • shouldAlsoPrefixLocalScope

      public boolean shouldAlsoPrefixLocalScope()
      Specified by:
      shouldAlsoPrefixLocalScope in interface IOperator
      Returns:
      If the global interact name prefix should also be used for local scopes.
    • getTranslationKey

      public String getTranslationKey()
      Specified by:
      getTranslationKey in interface IOperator
      Returns:
      The unique unlocalized name for this operator.
    • getUnlocalizedCategoryName

      public String getUnlocalizedCategoryName()
      Specified by:
      getUnlocalizedCategoryName in interface IOperator
      Returns:
      The unique unlocalized category name for this operator.
    • getLocalizedNameFull

      public net.minecraft.network.chat.MutableComponent getLocalizedNameFull()
      Specified by:
      getLocalizedNameFull in interface IOperator
      Returns:
      The localized full name for this operator, includes category name
    • getUnlocalizedPrefix

      protected String getUnlocalizedPrefix()
    • getUnlocalizedCategoryPrefix

      protected String getUnlocalizedCategoryPrefix()
    • getOperatorName

      protected String getOperatorName()
    • getSymbol

      public String getSymbol()
      Specified by:
      getSymbol in interface IOperator
      Returns:
      The unique name of this operator that will also be used for display.
    • loadTooltip

      public void loadTooltip(List<net.minecraft.network.chat.Component> lines, boolean appendOptionalInfo)
      Description copied from interface: IOperator
      Add tooltip lines for this aspect when hovered in a gui.
      Specified by:
      loadTooltip in interface IOperator
      Parameters:
      lines - The list to add lines to.
      appendOptionalInfo - If shift-to-show info should be added.
    • getInputTypes

      public IValueType[] getInputTypes()
      Specified by:
      getInputTypes in interface IOperator
      Returns:
      The ordered types of values that are used as input for this operator.
    • getOutputType

      public IValueType getOutputType()
      Specified by:
      getOutputType in interface IOperator
      Returns:
      The type of value that is achieved when this operator is executed.
    • getConditionalOutputType

      public IValueType getConditionalOutputType(IVariable[] input)
      Description copied from interface: IOperator
      Get the output value type depending on the active input of the operator.
      Specified by:
      getConditionalOutputType in interface IOperator
      Parameters:
      input - The input that would be given during evaluation.
      Returns:
      The type of value that is achieved when this operator is executed.
    • evaluate

      public IValue evaluate(IVariable... input) throws EvaluationException
      Description copied from interface: IOperator
      Evaluate the given input values for this operator.
      Specified by:
      evaluate in interface IOperator
      Parameters:
      input - The ordered input values.
      Returns:
      The output value.
      Throws:
      EvaluationException - When something went wrong while evaluating.
    • getRequiredInputLength

      public int getRequiredInputLength()
      Specified by:
      getRequiredInputLength in interface IOperator
      Returns:
      The required input length.
    • validateTypes

      public net.minecraft.network.chat.MutableComponent validateTypes(IValueType[] input)
      Description copied from interface: IOperator
      Check the given input value types for this operator.
      Specified by:
      validateTypes in interface IOperator
      Parameters:
      input - The ordered input value types.
      Returns:
      An error or null if valid.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getModId

      protected String getModId()
    • getRenderPattern

      @Nullable public IConfigRenderPattern getRenderPattern()
      Specified by:
      getRenderPattern in interface IOperator
      Returns:
      The render pattern for this operator inside the logic programmer.
    • materialize

      public IOperator materialize() throws EvaluationException
      Description copied from interface: IOperator
      Materialize this operator so that it can exist without any external references.
      Specified by:
      materialize in interface IOperator
      Returns:
      The materialized operator.
      Throws:
      EvaluationException - if materialization fails because of a variable evaluation.