mod関数を追加しました #39

Merged n-nitta merged 2 commits into nitta-lab:master from nitta-lab:Shinji_0511 on 14 May 2022
Showing 2 changed files
View
41
AlgebraicDataflowArchitectureModel/models/JumpGame.model
out force(f:Pair, gravity(y:Double)) == pair(0.0, y)
out time(t:Double, gravity(y)) == t + 0.01
}
channel CIO2 {
out move(v:Pair, moveX(x:Double)) == pair(x, right(v))
out move(v, moveY(y:Double)) == pair(left(v), y)
out movex(x:Double, run(x2:Double)) == x2
}
channel CIO3 {
out movey(y:Double, jump(y2:Double)) == y2
}
channel CIO4 {
out mass(m:Double, setMass(x:Double)) == x
}
channel CIO4 {
channel CIO5 {
out ground(g:Bool, openHole) == false
out ground(g, closeHole) == true
}
channel C1 {
pair(left(v) + 0.01 * left(a2), 0.0),
pair(left(v) + 0.01 * left(a2), right(v) + 0.01 * right(a2)))
}
channel C3 {
ref onground(o, update4(m2, o))
in move(m, update4(m2, o)) == m2
out velocity(v:Pair, update4(m2, o)) == if(and(o, ge(right(m2), 0.0)), m2, v)
ref onground(o, update4(x2, o))
in movex(x, update4(x2, o)) == x2
out velocity(v:Pair, update4(x2, o)) == if(o, pair(x2, right(v)), v)
}
channel C4 {
in velocity(v, update5(v2, g)) == v2
ref ground(g, update5(v2, g))
out position(p:Pair, update5(v2, g)) == if(and(eq(g, true), lt(right(p) + 0.01 * right(v2), 0.0)),
ref onground(o, update5(x2, o))
in movey(y, update5(y2, o)) == y2
out velocity(v:Pair, update5(y2, o)) == if(o, pair(left(v), y2), v)
}
channel C5 {
in velocity(v, update6(v2, g)) == v2
ref ground(g, update6(v2, g))
out position(p:Pair, update6(v2, g)) == if(and(eq(g, true), lt(right(p) + 0.01 * right(v2), 0.0)),
pair(left(p) + 0.01 * left(v2), 0.0),
pair(left(p) + 0.01 * left(v2), right(p) + 0.01 * right(v2)))
}
channel C5 {
channel C6 {
in position(p, update2(p2, g2)) == p2
in ground(g, update2(p2, g2)) == g2
out onground(o:Bool, update2(p2, g2)) == and(eq(g2, true), le(right(p2), 0.0))
}
channel C6 {
in position(p, update6(p2)) == p2
out clear(c:Bool, update6(p2)) == if(gt(left(p2), 100.0), true, false)
out gameover(go:Bool, update6(p2)) == if(lt(right(p2), -1.0), true, false)
channel C7 {
in position(p, update7(p2)) == p2
out clear(c:Bool, update7(p2)) == if(gt(left(p2), 100.0), true, false)
out gameover(go:Bool, update7(p2)) == if(lt(right(p2), -1.0), true, false)
}
View
3
■■
AlgebraicDataflowArchitectureModel/src/models/dataConstraintModel/DataConstraintModel.java
count[0]++;
return temp;
}
});
public static final Symbol mod = new Symbol("mod", 2, Symbol.Type.PREFIX, "%", Symbol.Type.INFIX);
public static final Symbol eq = new Symbol("eq", 2, Symbol.Type.PREFIX, "==", Symbol.Type.INFIX);
public static final Symbol neq = new Symbol("neq", 2, Symbol.Type.PREFIX, "!=", Symbol.Type.INFIX);
public static final Symbol gt = new Symbol("gt", 2, Symbol.Type.PREFIX, ">", Symbol.Type.INFIX);
public static final Symbol lt = new Symbol("lt", 2, Symbol.Type.PREFIX, "<", Symbol.Type.INFIX);
cons.setSignature(new Type[] {typeList, null, typeList});
contains.setSignature(new Type[] {typeBoolean, typeList, null});
get.setSignature(new Type[] {null, typeList, typeInt});
set.setSignature(new Type[] {typeList, typeList, typeInt, null});
mod.setSignature(new Type[] {null, null, typeInt});
eq.setSignature(new Type[] {null, null, typeBoolean});
neq.setSignature(new Type[] {null, null, typeBoolean});
gt.setSignature(new Type[] {null, null, typeBoolean});
lt.setSignature(new Type[] {null, null, typeBoolean});
addSymbol(get);
addSymbol(set);
addSymbol(nil);
addSymbol(cond);
addSymbol(mod);
addSymbol(eq);
addSymbol(neq);
addSymbol(gt);
addSymbol(lt);