Skip to content

Commit 63bb1ec

Browse files
authored
Merge pull request #54 from wytseoortwijn/relprev_and_relnext
#52 Renamed `relprevRestricted` to `relprevIntersection` and likewise for `relnextRestricted`
2 parents 101c1cc + 08b299d commit 63bb1ec

File tree

3 files changed

+60
-60
lines changed

3 files changed

+60
-60
lines changed

src/main/java/com/github/javabdd/BDD.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ public BDD relprod(BDD that, BDDVarSet var) {
611611
* relnext} for further details.
612612
* @return The BDD representing the restricted set of successor states from {@code states}.
613613
*/
614-
public abstract BDD relnextRestricted(BDD states, BDD restriction, BDDVarSet vars);
614+
public abstract BDD relnextIntersection(BDD states, BDD restriction, BDDVarSet vars);
615615

616616
/**
617617
* Computes the BDD that represents the set of predecessor states from {@code states}, i.e., the ones reachable by
@@ -638,7 +638,7 @@ public BDD relprod(BDD that, BDDVarSet var) {
638638
* relprev} for further details.
639639
* @return The BDD representing the restricted set of predecessor states from {@code states}.
640640
*/
641-
public abstract BDD relprevRestricted(BDD states, BDD restriction, BDDVarSet vars);
641+
public abstract BDD relprevIntersection(BDD states, BDD restriction, BDDVarSet vars);
642642

643643
/**
644644
* Finds all satisfying variable assignments.

src/main/java/com/github/javabdd/BDDFactoryIntImpl.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,12 @@ public abstract class BDDFactoryIntImpl extends BDDFactory {
8888

8989
protected abstract /* bdd */int relnext_impl(/* bdd */int states, /* bdd */int relation, /* bdd */int vars);
9090

91-
protected abstract /* bdd */int relnextRestricted_impl(/* bdd */int states, /* bdd */int relation,
91+
protected abstract /* bdd */int relnextIntersection_impl(/* bdd */int states, /* bdd */int relation,
9292
/* bdd */int restriction, /* bdd */int vars);
9393

9494
protected abstract /* bdd */int relprev_impl(/* bdd */int relation, /* bdd */int states, /* bdd */int vars);
9595

96-
protected abstract /* bdd */int relprevRestricted_impl(/* bdd */int relation, /* bdd */int states,
96+
protected abstract /* bdd */int relprevIntersection_impl(/* bdd */int relation, /* bdd */int states,
9797
/* bdd */int restriction, /* bdd */int vars);
9898

9999
protected abstract int nodeCount_impl(/* bdd */int v);
@@ -342,8 +342,8 @@ public BDD relnext(BDD states, BDDVarSet vars) {
342342
}
343343

344344
@Override
345-
public BDD relnextRestricted(BDD states, BDD restriction, BDDVarSet vars) {
346-
return makeBDD(relnextRestricted_impl(unwrap(states), v, unwrap(restriction), unwrap(vars)));
345+
public BDD relnextIntersection(BDD states, BDD restriction, BDDVarSet vars) {
346+
return makeBDD(relnextIntersection_impl(unwrap(states), v, unwrap(restriction), unwrap(vars)));
347347
}
348348

349349
@Override
@@ -352,8 +352,8 @@ public BDD relprev(BDD states, BDDVarSet vars) {
352352
}
353353

354354
@Override
355-
public BDD relprevRestricted(BDD states, BDD restriction, BDDVarSet vars) {
356-
return makeBDD(relprevRestricted_impl(v, unwrap(states), unwrap(restriction), unwrap(vars)));
355+
public BDD relprevIntersection(BDD states, BDD restriction, BDDVarSet vars) {
356+
return makeBDD(relprevIntersection_impl(v, unwrap(states), unwrap(restriction), unwrap(vars)));
357357
}
358358
}
359359

src/main/java/com/github/javabdd/JFactory.java

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,8 @@ protected int relnext_impl(int states, int relation, int vars) {
337337
}
338338

339339
@Override
340-
protected int relnextRestricted_impl(int states, int relation, int restriction, int vars) {
341-
return bdd_relnextRestricted(states, relation, restriction, vars);
340+
protected int relnextIntersection_impl(int states, int relation, int restriction, int vars) {
341+
return bdd_relnextIntersection(states, relation, restriction, vars);
342342
}
343343

344344
@Override
@@ -347,8 +347,8 @@ protected int relprev_impl(int relation, int states, int vars) {
347347
}
348348

349349
@Override
350-
protected int relprevRestricted_impl(int relation, int states, int restriction, int vars) {
351-
return bdd_relprevRestricted(relation, states, restriction, vars);
350+
protected int relprevIntersection_impl(int relation, int states, int restriction, int vars) {
351+
return bdd_relprevIntersection(relation, states, restriction, vars);
352352
}
353353

354354
// More redirection functions.
@@ -1398,9 +1398,9 @@ final boolean INSVARSET(int a) {
13981398

13991399
static final int bddop_relprev = 14;
14001400

1401-
static final int bddop_relnextRestricted = 15;
1401+
static final int bddop_relnextIntersection = 15;
14021402

1403-
static final int bddop_relprevRestricted = 16;
1403+
static final int bddop_relprevIntersection = 16;
14041404

14051405
int bdd_not(int r) {
14061406
int res;
@@ -2643,7 +2643,7 @@ int relnext_rec(int states, int relation, int vars) {
26432643
return result;
26442644
}
26452645

2646-
int bdd_relnextRestricted(int states, int relation, int restriction, int vars) {
2646+
int bdd_relnextIntersection(int states, int relation, int restriction, int vars) {
26472647
// Check validity of BDD nodes.
26482648
CHECKa(states);
26492649
CHECKa(relation);
@@ -2658,7 +2658,7 @@ int bdd_relnextRestricted(int states, int relation, int restriction, int vars) {
26582658
itecache = BddCacheI_init(cachesize);
26592659
}
26602660

2661-
// We may also apply the AND and OR operation while computing 'relnextRestricted'.
2661+
// We may also apply the AND and OR operation while computing 'relnextIntersection'.
26622662
// Let's configure the OR operation as the default.
26632663
applyop = bddop_or;
26642664

@@ -2673,7 +2673,7 @@ int bdd_relnextRestricted(int states, int relation, int restriction, int vars) {
26732673
if (numReorder == 0) {
26742674
bdd_disable_reorder();
26752675
}
2676-
result = relnextRestricted_rec(states, relation, restriction, vars);
2676+
result = relnextIntersection_rec(states, relation, restriction, vars);
26772677

26782678
if (numReorder == 0) {
26792679
bdd_enable_reorder();
@@ -2690,7 +2690,7 @@ int bdd_relnextRestricted(int states, int relation, int restriction, int vars) {
26902690
return result;
26912691
}
26922692

2693-
int relnextRestricted_rec(int states, int relation, int restriction, int vars) {
2693+
int relnextIntersection_rec(int states, int relation, int restriction, int vars) {
26942694
if (VERIFY_ASSERTIONS) {
26952695
_assert(!ZDD);
26962696
}
@@ -2748,10 +2748,10 @@ int relnextRestricted_rec(int states, int relation, int restriction, int vars) {
27482748

27492749
// Consult the operation cache.
27502750
BddCacheDataI entry = BddCache_lookupI(itecache,
2751-
QUINTUPLE(states, relation, restriction, vars, bddop_relnextRestricted));
2751+
QUINTUPLE(states, relation, restriction, vars, bddop_relnextIntersection));
27522752

27532753
if (entry.a == states && entry.b == relation && entry.c == restriction && entry.d == vars
2754-
&& entry.e == bddop_relnextRestricted)
2754+
&& entry.e == bddop_relnextIntersection)
27552755
{
27562756
if (cachestats.enabled) {
27572757
cachestats.opHit++;
@@ -2769,8 +2769,8 @@ int relnextRestricted_rec(int states, int relation, int restriction, int vars) {
27692769
int level_restriction = LEVEL(restriction);
27702770

27712771
if (level_restriction < (level & (~1))) {
2772-
PUSHREF(relnextRestricted_rec(states, relation, LOW(restriction), vars));
2773-
PUSHREF(relnextRestricted_rec(states, relation, HIGH(restriction), vars));
2772+
PUSHREF(relnextIntersection_rec(states, relation, LOW(restriction), vars));
2773+
PUSHREF(relnextIntersection_rec(states, relation, HIGH(restriction), vars));
27742774
result = bdd_makenode(level_restriction, READREF(2), READREF(1));
27752775
POPREF(2);
27762776
} else if (sameHeight) {
@@ -2818,22 +2818,22 @@ int relnextRestricted_rec(int states, int relation, int restriction, int vars) {
28182818

28192819
if (LEVEL(vars) == level_newvar || LEVEL(nextVars) == level_newvar) {
28202820
// We are considering the new-state variable, so apply both the conjunction and quantification.
2821-
PUSHREF(relnextRestricted_rec(s0, r00, u0, nextVars));
2822-
PUSHREF(relnextRestricted_rec(s1, r10, u0, nextVars));
2821+
PUSHREF(relnextIntersection_rec(s0, r00, u0, nextVars));
2822+
PUSHREF(relnextIntersection_rec(s1, r10, u0, nextVars));
28232823
int result0 = or_rec(READREF(2), READREF(1));
28242824
POPREF(2);
28252825
PUSHREF(result0);
2826-
PUSHREF(relnextRestricted_rec(s0, r01, u1, nextVars));
2827-
PUSHREF(relnextRestricted_rec(s1, r11, u1, nextVars));
2826+
PUSHREF(relnextIntersection_rec(s0, r01, u1, nextVars));
2827+
PUSHREF(relnextIntersection_rec(s1, r11, u1, nextVars));
28282828
int result1 = or_rec(READREF(2), READREF(1));
28292829
POPREF(2);
28302830
PUSHREF(result1);
28312831
result = bdd_makenode(level_oldvar, result0, result1);
28322832
POPREF(2);
28332833
} else {
28342834
// We are not considering the new-state variable, so do not quantify.
2835-
PUSHREF(relnextRestricted_rec(s0, r00, u0, nextVars));
2836-
PUSHREF(relnextRestricted_rec(s1, r11, u1, nextVars));
2835+
PUSHREF(relnextIntersection_rec(s0, r00, u0, nextVars));
2836+
PUSHREF(relnextIntersection_rec(s1, r11, u1, nextVars));
28372837
result = bdd_makenode(level_oldvar, READREF(2), READREF(1));
28382838
POPREF(2);
28392839
}
@@ -2863,27 +2863,27 @@ int relnextRestricted_rec(int states, int relation, int restriction, int vars) {
28632863

28642864
if (r0 != r1) {
28652865
if (s0 != s1) {
2866-
PUSHREF(relnextRestricted_rec(s0, r0, u0, vars));
2867-
PUSHREF(relnextRestricted_rec(s0, r1, u0, vars));
2866+
PUSHREF(relnextIntersection_rec(s0, r0, u0, vars));
2867+
PUSHREF(relnextIntersection_rec(s0, r1, u0, vars));
28682868
int result0 = or_rec(READREF(2), READREF(1));
28692869
POPREF(2);
28702870
PUSHREF(result0);
2871-
PUSHREF(relnextRestricted_rec(s1, r0, u1, vars));
2872-
PUSHREF(relnextRestricted_rec(s1, r1, u1, vars));
2871+
PUSHREF(relnextIntersection_rec(s1, r0, u1, vars));
2872+
PUSHREF(relnextIntersection_rec(s1, r1, u1, vars));
28732873
int result1 = or_rec(READREF(2), READREF(1));
28742874
POPREF(2);
28752875
PUSHREF(result1);
28762876
result = bdd_makenode(level, result0, result1);
28772877
POPREF(2);
28782878
} else {
2879-
PUSHREF(relnextRestricted_rec(s0, r0, u0, vars));
2880-
PUSHREF(relnextRestricted_rec(s1, r1, u1, vars));
2879+
PUSHREF(relnextIntersection_rec(s0, r0, u0, vars));
2880+
PUSHREF(relnextIntersection_rec(s1, r1, u1, vars));
28812881
result = or_rec(READREF(2), READREF(1));
28822882
POPREF(2);
28832883
}
28842884
} else {
2885-
PUSHREF(relnextRestricted_rec(s0, r0, u0, vars));
2886-
PUSHREF(relnextRestricted_rec(s1, r1, u1, vars));
2885+
PUSHREF(relnextIntersection_rec(s0, r0, u0, vars));
2886+
PUSHREF(relnextIntersection_rec(s1, r1, u1, vars));
28872887
result = bdd_makenode(level, READREF(2), READREF(1));
28882888
POPREF(2);
28892889
}
@@ -2894,7 +2894,7 @@ int relnextRestricted_rec(int states, int relation, int restriction, int vars) {
28942894
entry.b = relation;
28952895
entry.c = restriction;
28962896
entry.d = vars;
2897-
entry.e = bddop_relnextRestricted;
2897+
entry.e = bddop_relnextIntersection;
28982898
entry.res = result;
28992899

29002900
return result;
@@ -3128,7 +3128,7 @@ int relprev_rec(int relation, int states, int vars) {
31283128
return result;
31293129
}
31303130

3131-
int bdd_relprevRestricted(int relation, int states, int restriction, int vars) {
3131+
int bdd_relprevIntersection(int relation, int states, int restriction, int vars) {
31323132
// Check validity of BDD nodes.
31333133
CHECKa(relation);
31343134
CHECKa(states);
@@ -3143,7 +3143,7 @@ int bdd_relprevRestricted(int relation, int states, int restriction, int vars) {
31433143
itecache = BddCacheI_init(cachesize);
31443144
}
31453145

3146-
// We may also apply the AND and OR operation while computing 'relprevRestricted'.
3146+
// We may also apply the AND and OR operation while computing 'relprevIntersection'.
31473147
// Let's configure the OR operation as the default.
31483148
applyop = bddop_or;
31493149

@@ -3158,7 +3158,7 @@ int bdd_relprevRestricted(int relation, int states, int restriction, int vars) {
31583158
if (numReorder == 0) {
31593159
bdd_disable_reorder();
31603160
}
3161-
result = relprevRestricted_rec(relation, states, restriction, vars);
3161+
result = relprevIntersection_rec(relation, states, restriction, vars);
31623162

31633163
if (numReorder == 0) {
31643164
bdd_enable_reorder();
@@ -3175,7 +3175,7 @@ int bdd_relprevRestricted(int relation, int states, int restriction, int vars) {
31753175
return result;
31763176
}
31773177

3178-
int relprevRestricted_rec(int relation, int states, int restriction, int vars) {
3178+
int relprevIntersection_rec(int relation, int states, int restriction, int vars) {
31793179
if (VERIFY_ASSERTIONS) {
31803180
_assert(!ZDD);
31813181
}
@@ -3234,10 +3234,10 @@ int relprevRestricted_rec(int relation, int states, int restriction, int vars) {
32343234

32353235
// Consult the operation cache.
32363236
BddCacheDataI entry = BddCache_lookupI(itecache,
3237-
QUINTUPLE(relation, states, restriction, vars, bddop_relprevRestricted));
3237+
QUINTUPLE(relation, states, restriction, vars, bddop_relprevIntersection));
32383238

32393239
if (entry.a == relation && entry.b == states && entry.c == restriction && entry.d == vars
3240-
&& entry.e == bddop_relprevRestricted)
3240+
&& entry.e == bddop_relprevIntersection)
32413241
{
32423242
if (cachestats.enabled) {
32433243
cachestats.opHit++;
@@ -3255,8 +3255,8 @@ int relprevRestricted_rec(int relation, int states, int restriction, int vars) {
32553255
int level_restriction = LEVEL(restriction);
32563256

32573257
if (level_restriction < (level & (~1))) {
3258-
PUSHREF(relprevRestricted_rec(relation, states, LOW(restriction), vars));
3259-
PUSHREF(relprevRestricted_rec(relation, states, HIGH(restriction), vars));
3258+
PUSHREF(relprevIntersection_rec(relation, states, LOW(restriction), vars));
3259+
PUSHREF(relprevIntersection_rec(relation, states, HIGH(restriction), vars));
32603260
result = bdd_makenode(level_restriction, READREF(2), READREF(1));
32613261
POPREF(2);
32623262
} else if (sameHeight) {
@@ -3310,22 +3310,22 @@ int relprevRestricted_rec(int relation, int states, int restriction, int vars) {
33103310

33113311
if (quantify) {
33123312
// We are considering the new-state variable, so apply both the conjunction and quantification.
3313-
PUSHREF(relprevRestricted_rec(r00, s0, u0, nextVars));
3314-
PUSHREF(relprevRestricted_rec(r01, s1, u0, nextVars));
3313+
PUSHREF(relprevIntersection_rec(r00, s0, u0, nextVars));
3314+
PUSHREF(relprevIntersection_rec(r01, s1, u0, nextVars));
33153315
int result0 = or_rec(READREF(2), READREF(1));
33163316
POPREF(2);
33173317
PUSHREF(result0);
3318-
PUSHREF(relprevRestricted_rec(r10, s0, u1, nextVars));
3319-
PUSHREF(relprevRestricted_rec(r11, s1, u1, nextVars));
3318+
PUSHREF(relprevIntersection_rec(r10, s0, u1, nextVars));
3319+
PUSHREF(relprevIntersection_rec(r11, s1, u1, nextVars));
33203320
int result1 = or_rec(READREF(2), READREF(1));
33213321
POPREF(2);
33223322
PUSHREF(result1);
33233323
result = bdd_makenode(level_oldvar, result0, result1);
33243324
POPREF(2);
33253325
} else {
33263326
// We are not considering the new-state variable, so do not quantify.
3327-
PUSHREF(relprevRestricted_rec(r00, s0, u0, nextVars));
3328-
PUSHREF(relprevRestricted_rec(r11, s1, u1, nextVars));
3327+
PUSHREF(relprevIntersection_rec(r00, s0, u0, nextVars));
3328+
PUSHREF(relprevIntersection_rec(r11, s1, u1, nextVars));
33293329
result = bdd_makenode(level_oldvar, READREF(2), READREF(1));
33303330
POPREF(2);
33313331
}
@@ -3355,27 +3355,27 @@ int relprevRestricted_rec(int relation, int states, int restriction, int vars) {
33553355

33563356
if (r0 != r1) {
33573357
if (s0 != s1) {
3358-
PUSHREF(relprevRestricted_rec(r0, s0, u0, vars));
3359-
PUSHREF(relprevRestricted_rec(r1, s0, u0, vars));
3358+
PUSHREF(relprevIntersection_rec(r0, s0, u0, vars));
3359+
PUSHREF(relprevIntersection_rec(r1, s0, u0, vars));
33603360
int result0 = or_rec(READREF(2), READREF(1));
33613361
POPREF(2);
33623362
PUSHREF(result0);
3363-
PUSHREF(relprevRestricted_rec(r0, s1, u1, vars));
3364-
PUSHREF(relprevRestricted_rec(r1, s1, u1, vars));
3363+
PUSHREF(relprevIntersection_rec(r0, s1, u1, vars));
3364+
PUSHREF(relprevIntersection_rec(r1, s1, u1, vars));
33653365
int result1 = or_rec(READREF(2), READREF(1));
33663366
POPREF(2);
33673367
PUSHREF(result1);
33683368
result = bdd_makenode(level, result0, result1);
33693369
POPREF(2);
33703370
} else {
3371-
PUSHREF(relprevRestricted_rec(r0, s0, u0, vars));
3372-
PUSHREF(relprevRestricted_rec(r1, s1, u1, vars));
3371+
PUSHREF(relprevIntersection_rec(r0, s0, u0, vars));
3372+
PUSHREF(relprevIntersection_rec(r1, s1, u1, vars));
33733373
result = or_rec(READREF(2), READREF(1));
33743374
POPREF(2);
33753375
}
33763376
} else {
3377-
PUSHREF(relprevRestricted_rec(r0, s0, u0, vars));
3378-
PUSHREF(relprevRestricted_rec(r1, s1, u1, vars));
3377+
PUSHREF(relprevIntersection_rec(r0, s0, u0, vars));
3378+
PUSHREF(relprevIntersection_rec(r1, s1, u1, vars));
33793379
result = bdd_makenode(level, READREF(2), READREF(1));
33803380
POPREF(2);
33813381
}
@@ -3386,7 +3386,7 @@ int relprevRestricted_rec(int relation, int states, int restriction, int vars) {
33863386
entry.b = states;
33873387
entry.c = restriction;
33883388
entry.d = vars;
3389-
entry.e = bddop_relprevRestricted;
3389+
entry.e = bddop_relprevIntersection;
33903390
entry.res = result;
33913391

33923392
return result;

0 commit comments

Comments
 (0)