Class ArithmeticEngine

java.lang.Object
at.petrak.hexcasting.api.casting.arithmetic.engine.ArithmeticEngine

public class ArithmeticEngine extends Object
This is the class responsible for managing the various Arithmetics that are in use, deciding based on the current stack which Operator should be called, etc.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final Arithmetic[]
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Iterable<at.petrak.hexcasting.api.casting.math.HexPattern>
     
    at.petrak.hexcasting.api.casting.eval.OperationResult
    run(at.petrak.hexcasting.api.casting.math.HexPattern pattern, CastingEnvironment env, at.petrak.hexcasting.api.casting.eval.vm.CastingImage image, at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation continuation)
    Runs one of the contained Operators assigned to the given pattern, modifying the passed stack of iotas.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • arithmetics

      public final Arithmetic[] arithmetics
  • Constructor Details

    • ArithmeticEngine

      public ArithmeticEngine(List<Arithmetic> arithmetics)
  • Method Details

    • operatorSyms

      public Iterable<at.petrak.hexcasting.api.casting.math.HexPattern> operatorSyms()
    • run

      public at.petrak.hexcasting.api.casting.eval.OperationResult run(at.petrak.hexcasting.api.casting.math.HexPattern pattern, CastingEnvironment env, at.petrak.hexcasting.api.casting.eval.vm.CastingImage image, at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation continuation) throws at.petrak.hexcasting.api.casting.mishaps.Mishap
      Runs one of the contained Operators assigned to the given pattern, modifying the passed stack of iotas.
      Parameters:
      pattern - The pattern that was drawn, used to determine which operators are candidates.
      env - The casting environment.
      image - The casting image.
      continuation - The current continuation.
      Returns:
      The iotas to be added to the stack.
      Throws:
      at.petrak.hexcasting.api.casting.mishaps.Mishap - mishaps if invalid input to the operators is given by the caster.