Browse Source

Change visibility of some classes/methods in the param package to allow use from outside the package (and fix broken build).

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@9004 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 12 years ago
parent
commit
06c914a476
  1. 40
      prism/src/param/DagFunction.java
  2. 10
      prism/src/param/JasFunction.java
  3. 8
      prism/src/param/ParamModelChecker.java

40
prism/src/param/DagFunction.java

@ -30,7 +30,7 @@ package param;
* TODO implement completely * TODO implement completely
* @author Ernst Moritz Hahn <emhahn@cs.ox.ac.uk> (University of Oxford) * @author Ernst Moritz Hahn <emhahn@cs.ox.ac.uk> (University of Oxford)
*/ */
class DagFunction extends Function {
public class DagFunction extends Function {
private DagFunctionFactory dagFactory; private DagFunctionFactory dagFactory;
private DagOperator num; private DagOperator num;
private DagOperator den; private DagOperator den;
@ -40,7 +40,7 @@ class DagFunction extends Function {
final static int MINF = 2; final static int MINF = 2;
final static int NAN = 3; final static int NAN = 3;
DagFunction(FunctionFactory factory, DagOperator num, DagOperator den) {
public DagFunction(FunctionFactory factory, DagOperator num, DagOperator den) {
super(factory); super(factory);
dagFactory = (DagFunctionFactory) factory; dagFactory = (DagFunctionFactory) factory;
this.num = num; this.num = num;
@ -48,18 +48,18 @@ class DagFunction extends Function {
this.type = NORMAL; this.type = NORMAL;
} }
DagFunction(FunctionFactory factory, int type) {
public DagFunction(FunctionFactory factory, int type) {
super(factory); super(factory);
this.type = type; this.type = type;
num = null; num = null;
den = null; den = null;
} }
DagOperator getNum() {
public DagOperator getNum() {
return num; return num;
} }
DagOperator getDen() {
public DagOperator getDen() {
return den; return den;
} }
@ -92,73 +92,73 @@ class DagFunction extends Function {
@Override @Override
Function add(Function other) {
public Function add(Function other) {
return dagFactory.add(this, (DagFunction) other); return dagFactory.add(this, (DagFunction) other);
} }
@Override @Override
Function negate() {
public Function negate() {
return dagFactory.negate(this); return dagFactory.negate(this);
} }
@Override @Override
Function subtract(Function other) {
public Function subtract(Function other) {
return dagFactory.subtract(this, (DagFunction) other); return dagFactory.subtract(this, (DagFunction) other);
} }
@Override @Override
Function multiply(Function other) {
public Function multiply(Function other) {
return dagFactory.multiply(this, (DagFunction) other); return dagFactory.multiply(this, (DagFunction) other);
} }
@Override @Override
Function divide(Function other) {
public Function divide(Function other) {
return dagFactory.divide(this, (DagFunction) other); return dagFactory.divide(this, (DagFunction) other);
} }
@Override @Override
Function star() {
public Function star() {
return dagFactory.star(this); return dagFactory.star(this);
} }
@Override @Override
Function toConstraint() {
public Function toConstraint() {
return dagFactory.toConstraint(this); return dagFactory.toConstraint(this);
} }
@Override @Override
BigRational evaluate(Point point, boolean cancel) {
public BigRational evaluate(Point point, boolean cancel) {
BigRational result = dagFactory.evaluate(this, point, cancel); BigRational result = dagFactory.evaluate(this, point, cancel);
return result; return result;
} }
@Override @Override
BigRational asBigRational() {
public BigRational asBigRational() {
return dagFactory.asBigRational(this); return dagFactory.asBigRational(this);
} }
@Override @Override
boolean isNaN() {
public boolean isNaN() {
return type == NAN; return type == NAN;
} }
@Override @Override
boolean isInf() {
public boolean isInf() {
return type == INF; return type == INF;
} }
@Override @Override
boolean isMInf() {
public boolean isMInf() {
return type == MINF; return type == MINF;
} }
@Override @Override
boolean isOne() {
public boolean isOne() {
return dagFactory.isOne(this); return dagFactory.isOne(this);
} }
@Override @Override
boolean isZero() {
public boolean isZero() {
return dagFactory.isZero(this); return dagFactory.isZero(this);
} }
@ -167,7 +167,7 @@ class DagFunction extends Function {
return dagFactory.toString(this); return dagFactory.toString(this);
} }
int getType() {
public int getType() {
return type; return type;
} }
} }

10
prism/src/param/JasFunction.java

@ -182,6 +182,16 @@ final class JasFunction extends Function {
if (this.isNaN() || other.isNaN()) { if (this.isNaN() || other.isNaN()) {
return factory.getNaN(); return factory.getNaN();
} }
if (other.isZero()) {
if (this.isZero()) {
return factory.getNaN();
} else {
return factory.getInf();
}
}
if (this.isZero()) {
return factory.getZero();
}
return new JasFunction((JasFunctionFactory) factory, jas.divide(((JasFunction) other).jas), NORMAL); return new JasFunction((JasFunctionFactory) factory, jas.divide(((JasFunction) other).jas), NORMAL);
} }

8
prism/src/param/ParamModelChecker.java

@ -241,6 +241,14 @@ final public class ParamModelChecker extends PrismComponent
BitSet needStates = new BitSet(model.getNumStates()); BitSet needStates = new BitSet(model.getNumStates());
needStates.set(0, model.getNumStates()); needStates.set(0, model.getNumStates());
RegionValues vals = checkExpression(paramModel, expr, needStates); RegionValues vals = checkExpression(paramModel, expr, needStates);
mainLog.println(vals);
Function f = vals.getResult(0).getInitStateValueAsFunction();
int n = 100;
String s = "";
for (int i = 0; i < n; i++) {
BigRational br = f.evaluate(new param.Point(new BigRational[] {new BigRational(i, n)}));
s += " " + br.doubleValue();
}
timer = System.currentTimeMillis() - timer; timer = System.currentTimeMillis() - timer;
mainLog.println("\nTime for model checking: " + timer / 1000.0 + " seconds."); mainLog.println("\nTime for model checking: " + timer / 1000.0 + " seconds.");

Loading…
Cancel
Save