All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sageserpent.americium.generation.Decision.scala Maven / Gradle / Ivy

package com.sageserpent.americium.generation
import io.circe.generic.auto.*
import io.circe.parser.decode
import io.circe.syntax.*

sealed trait Decision

object Decision {
  type DecisionStages = List[Decision]

  def parseDecisionIndices(recipe: String): DecisionStages = {
    decode[DecisionStages](
      recipe
    ).toTry.get // Just throw the exception, the callers are written in Java style.
  }

  def json(decisionStages: DecisionStages) = decisionStages.asJson.spaces4
  def compressedJson(decisionStages: DecisionStages) =
    decisionStages.asJson.noSpaces
}

case class ChoiceOf(index: Int) extends Decision

case class FactoryInputOf(input: BigInt) extends Decision




© 2015 - 2024 Weber Informatics LLC | Privacy Policy