Commit 920e6fb1 authored by Arthur Bit-Monnot's avatar Arthur Bit-Monnot

[anml] Minor rewording

parent 78ee70ce
......@@ -143,10 +143,10 @@ package object core {
sealed trait IntExpr
object IntExpr {
def apply(lit: Int): IntExpr = VarIntExpr(IntLiteral(lit))
def apply(lit: Int): IntExpr = IntTerm(IntLiteral(lit))
}
final case class VarIntExpr(e: Term) extends IntExpr {
require(e.typ == Type.Integers)
final case class IntTerm(e: Term) extends IntExpr {
require(e.typ.isSubtypeOf(Type.Integers))
override def toString: String = e.toString
}
......@@ -160,7 +160,7 @@ package object core {
override def toString: String =
id.toString + (delay match {
case VarIntExpr(IntLiteral(d)) =>
case IntTerm(IntLiteral(d)) =>
if(d == 0) ""
else if(d > 0) s"+$d"
else s"-${-d}"
......
......@@ -47,7 +47,7 @@ object FullToCore {
case full.GenIntExpr(e) =>
for {
v <- f2c(e)
} yield core.VarIntExpr(v)
} yield core.IntTerm(v)
case full.Minus(e) =>
for {
......
......@@ -55,8 +55,8 @@ case class ProblemContext(intTag: BoxedInt[Literal],
def encode(ie: IntExpr)(implicit argRewrite: Arg => Tentative[Literal]): Tentative[Int] =
ie match {
case VarIntExpr(IntLiteral(d)) => Cst(d)
case VarIntExpr(v: Var) =>
case IntTerm(IntLiteral(d)) => Cst(d)
case IntTerm(v: Var) =>
assert(v.typ == Type.Integers)
val variable = encode(v)
variable.typ match {
......@@ -69,11 +69,11 @@ case class ProblemContext(intTag: BoxedInt[Literal],
}
def encode(tp: TPRef)(implicit argRewrite: Arg => Tentative[Literal]): Tentative[Int] = tp match {
case TPRef(id, VarIntExpr(IntLiteral(0))) if id.toString == "start" =>
case TPRef(id, IntTerm(IntLiteral(0))) if id.toString == "start" =>
temporalOrigin // TODO: match by string....
case TPRef(id, VarIntExpr(IntLiteral(0))) if id.toString == "end" =>
case TPRef(id, IntTerm(IntLiteral(0))) if id.toString == "end" =>
temporalHorizon // TODO: match by string....
case TPRef(id, VarIntExpr(IntLiteral(0))) =>
case TPRef(id, IntTerm(IntLiteral(0))) =>
Input[Int](Ident(id)).subjectTo(tp => temporalOrigin <= tp && tp <= temporalHorizon)
case TPRef(id, delay) => encode(TPRef(id)) + encode(delay)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment