Browse Source

Added unbounded check to Zone classes (+ API tweak).

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@2216 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 15 years ago
parent
commit
93d028bde5
  1. 27
      prism/src/pta/DBM.java
  2. 36
      prism/src/pta/DBMList.java
  3. 14
      prism/src/pta/Zone.java

27
prism/src/pta/DBM.java

@ -292,7 +292,7 @@ public class DBM extends Zone
/**
* Get the minimum value of a clock.
*/
public int getMin(int x)
public int getClockMin(int x)
{
return -DB.getSignedDiff(d[0][x]);
}
@ -300,11 +300,34 @@ public class DBM extends Zone
/**
* Get the maximum value of a clock.
*/
public int getMax(int x)
public int getClockMax(int x)
{
return DB.getSignedDiff(d[x][0]);
}
/**
* Check if a clock is unbounded (can be infinite).
*/
public boolean clockIsUnbounded(int x)
{
return DB.isInfty(d[x][0]);
}
/**
* Check if all clocks are unbounded (can be infinite).
*/
public boolean allClocksAreUnbounded()
{
int i, n;
n = pta.numClocks;
for (i = 0; i < n + 1; i++) {
if (!DB.isInfty(d[i][0])) {
return false;
}
}
return true;
}
// Misc
/**

36
prism/src/pta/DBMList.java

@ -310,12 +310,12 @@ public class DBMList extends NCZone
/**
* Get the minimum value of a clock.
*/
public int getMin(int x)
public int getClockMin(int x)
{
// Take min across all DBMs
int min = Integer.MAX_VALUE;
for (DBM dbm : list) {
min = Math.min(min, dbm.getMin(x));
min = Math.min(min, dbm.getClockMin(x));
}
return min;
}
@ -323,16 +323,44 @@ public class DBMList extends NCZone
/**
* Get the maximum value of a clock.
*/
public int getMax(int x)
public int getClockMax(int x)
{
// Take max across all DBMs
int max = Integer.MIN_VALUE;
for (DBM dbm : list) {
max = Math.max(max, dbm.getMax(x));
max = Math.max(max, dbm.getClockMax(x));
}
return max;
}
/**
* Check if a clock is unbounded (can be infinite).
*/
public boolean clockIsUnbounded(int x)
{
// Clock is unbounded if is in any DBM
for (DBM dbm : list) {
if (dbm.clockIsUnbounded(x))
return true;
}
return false;
}
/**
* Check if all clocks are unbounded (can be infinite).
*/
public boolean allClocksAreUnbounded()
{
int i, n;
n = pta.numClocks;
for (i = 0; i < n + 1; i++) {
if (!clockIsUnbounded(i)) {
return false;
}
}
return true;
}
// Methods required for NCZone interface
/**

14
prism/src/pta/Zone.java

@ -131,12 +131,22 @@ public abstract class Zone
/**
* Get the minimum value of a clock.
*/
public abstract int getMin(int x);
public abstract int getClockMin(int x);
/**
* Get the maximum value of a clock.
*/
public abstract int getMax(int x);
public abstract int getClockMax(int x);
/**
* Check if a clock is unbounded (can be infinite).
*/
public abstract boolean clockIsUnbounded(int x);
/**
* Check if all clocks are unbounded (can be infinite).
*/
public abstract boolean allClocksAreUnbounded();
// Misc

Loading…
Cancel
Save