Browse Source

Make some classes/methods in the param package visible for external use.

accumulation-v4.7
Dave Parker 6 years ago
parent
commit
29e6e172b8
  1. 10
      prism/src/param/CachedFunctionFactory.java
  2. 16
      prism/src/param/DagFunctionFactory.java
  3. 28
      prism/src/param/Function.java
  4. 26
      prism/src/param/FunctionFactory.java
  5. 2
      prism/src/param/JasFunctionFactory.java

10
prism/src/param/CachedFunctionFactory.java

@ -114,7 +114,7 @@ final class CachedFunctionFactory extends FunctionFactory {
*
* @param context function factory to cache functions of
*/
CachedFunctionFactory(FunctionFactory context) {
public CachedFunctionFactory(FunctionFactory context) {
super(context.parameterNames, context.lowerBounds, context.upperBounds);
this.context = context;
functionToNumber = new HashMap<Function, Integer>();
@ -326,22 +326,22 @@ final class CachedFunctionFactory extends FunctionFactory {
}
@Override
Function getNaN() {
public Function getNaN() {
return makeUnique(context.getNaN());
}
@Override
Function getInf() {
public Function getInf() {
return makeUnique(context.getInf());
}
@Override
Function getMInf() {
public Function getMInf() {
return makeUnique(context.getMInf());
}
@Override
Function getVar(int var) {
public Function getVar(int var) {
return makeUnique(context.getVar(var));
}
}

16
prism/src/param/DagFunctionFactory.java

@ -139,7 +139,7 @@ class DagFunctionFactory extends FunctionFactory {
private HashMap<DagFunction,DagFunction> functions;
// private boolean negateToInner;
DagFunctionFactory(String[] parameterNames, BigRational[] lowerBounds, BigRational[] upperBounds, double maxProbWrong, boolean negateToInner) {
public DagFunctionFactory(String[] parameterNames, BigRational[] lowerBounds, BigRational[] upperBounds, double maxProbWrong, boolean negateToInner) {
super(parameterNames, lowerBounds, upperBounds);
Random random = new Random();
BigRational[] randomPosArr = new BigRational[parameterNames.length];
@ -177,27 +177,27 @@ class DagFunctionFactory extends FunctionFactory {
}
@Override
Function getZero() {
public Function getZero() {
return zero;
}
@Override
Function getOne() {
public Function getOne() {
return one;
}
@Override
Function getNaN() {
public Function getNaN() {
return nan;
}
@Override
Function getInf() {
public Function getInf() {
return inf;
}
@Override
Function getMInf() {
public Function getMInf() {
return minf;
}
@ -220,7 +220,7 @@ class DagFunctionFactory extends FunctionFactory {
}
@Override
Function fromBigRational(BigRational bigRat) {
public Function fromBigRational(BigRational bigRat) {
if (bigRat.isSpecial()) {
if (bigRat.isNaN()) {
return getNaN();
@ -243,7 +243,7 @@ class DagFunctionFactory extends FunctionFactory {
}
@Override
Function getVar(int var) {
public Function getVar(int var) {
return parameters[var];
}

28
prism/src/param/Function.java

@ -74,14 +74,14 @@ public abstract class Function extends StateValue
* @param other function to add to this function
* @return sum of {@code} this and {@other}
*/
abstract Function add(Function other);
public abstract Function add(Function other);
/**
* Negates this rational function.
*
* @return negated rational function.
*/
abstract Function negate();
public abstract Function negate();
/**
* Multiplies {@code other} with this function.
@ -89,7 +89,7 @@ public abstract class Function extends StateValue
* @param other function to multiply with this function
* @return product of {@code} this and {@other}
*/
abstract Function multiply(Function other);
public abstract Function multiply(Function other);
/**
* Divides this function by {@code other}.
@ -97,7 +97,7 @@ public abstract class Function extends StateValue
* @param other function to divide this function by
* @return {@code this} divided by {@other}
*/
abstract Function divide(Function other);
public abstract Function divide(Function other);
/**
* Performs the {@code star} operation with this function.
@ -108,7 +108,7 @@ public abstract class Function extends StateValue
*
* @return result of star operation
*/
abstract Function star();
public abstract Function star();
/**
* Returns a simplified version for constraint checking.
@ -121,7 +121,7 @@ public abstract class Function extends StateValue
*
* @return simplified form for constraint checking
*/
abstract Function toConstraint();
public abstract Function toConstraint();
/**
* Evaluate this function at a given point.
@ -133,7 +133,7 @@ public abstract class Function extends StateValue
* @param cancel whether result shall be enforced to be coprime
* @return value at the given parameter evaluation
*/
abstract BigRational evaluate(Point point, boolean cancel);
public abstract BigRational evaluate(Point point, boolean cancel);
/**
* Returns a BigRational representing the same number as this object.
@ -142,43 +142,43 @@ public abstract class Function extends StateValue
*
* @return BigRational representation of this function
*/
abstract BigRational asBigRational();
public abstract BigRational asBigRational();
/**
* Returns true iff this function represents not-a-number.
* @return true iff this function represents not-a-number
*/
abstract boolean isNaN();
public abstract boolean isNaN();
/**
* Returns true iff this function represents positive infinity.
* @return true iff this function represents positive infinity
*/
abstract boolean isInf();
public abstract boolean isInf();
/**
* Returns true iff this function represents negative infinity.
* @return true iff this function represents negative infinity
*/
abstract boolean isMInf();
public abstract boolean isMInf();
/**
* Returns true iff this function represents the number one.
* @return true iff this function represents the number one
*/
abstract boolean isOne();
public abstract boolean isOne();
/**
* Returns true iff this function represents the number zero.
* @return true iff this function represents the number zero
*/
abstract boolean isZero();
public abstract boolean isZero();
/**
* Returns true iff this function is guaranteed to return a constant value.
* @return true iff this function is guaranteed to return a constant value
*/
abstract public boolean isConstant();
public abstract boolean isConstant();
/**
* Multiplies {@code byNumber} with this function.

26
prism/src/param/FunctionFactory.java

@ -58,7 +58,7 @@ public abstract class FunctionFactory {
* @param lowerBounds lower bounds of parameters
* @param upperBounds upper bounds of parameters
*/
FunctionFactory(String[] parameterNames, BigRational[] lowerBounds, BigRational[] upperBounds) {
public FunctionFactory(String[] parameterNames, BigRational[] lowerBounds, BigRational[] upperBounds) {
this.parameterNames = parameterNames;
this.lowerBounds = lowerBounds;
this.upperBounds = upperBounds;
@ -72,31 +72,31 @@ public abstract class FunctionFactory {
* Returns a function representing the number one.
* @return function representing the number one
*/
abstract Function getOne();
public abstract Function getOne();
/**
* Returns a function representing the number zero.
* @return function representing the number zero
*/
abstract Function getZero();
public abstract Function getZero();
/**
* Returns a function representing not-a-number.
* @return function representing not-a-number
*/
abstract Function getNaN();
public abstract Function getNaN();
/**
* Returns a function representing positive infinity.
* @return function representing the positive infinity
*/
abstract Function getInf();
public abstract Function getInf();
/**
* Returns a function representing negative infinity.
* @return function representing the negative infinity
*/
abstract Function getMInf();
public abstract Function getMInf();
/**
* Returns a new function which represents the same value as the
@ -105,7 +105,7 @@ public abstract class FunctionFactory {
* @param bigRat value to create a function of
* @return function representing the same value as {@code bigRat}
*/
abstract Function fromBigRational(BigRational bigRat);
public abstract Function fromBigRational(BigRational bigRat);
/**
* Returns a function representing a single variable.
@ -113,7 +113,7 @@ public abstract class FunctionFactory {
* @param var the variable to create a function of
* @return function consisting only in one variable
*/
abstract Function getVar(int var);
public abstract Function getVar(int var);
/**
@ -122,7 +122,7 @@ public abstract class FunctionFactory {
* @param var name of the variable to create a function of
* @return function consisting only in one variable
*/
Function getVar(String var) {
public Function getVar(String var) {
return getVar(varnameToInt.get(var));
}
@ -132,7 +132,7 @@ public abstract class FunctionFactory {
* @param var index of the variable to obtain name of
* @return name of {@code var}
*/
String getParameterName(int var) {
public String getParameterName(int var) {
return parameterNames[var];
}
@ -142,7 +142,7 @@ public abstract class FunctionFactory {
* @param var index of the variable to obtain lower bound of
* @return lower bound of {@code var}
*/
BigRational getLowerBound(int var) {
public BigRational getLowerBound(int var) {
return lowerBounds[var];
}
@ -152,7 +152,7 @@ public abstract class FunctionFactory {
* @param var index of the variable to obtain upper bound of
* @return upper bound of {@code var}
*/
BigRational getUpperBound(int var) {
public BigRational getUpperBound(int var) {
return upperBounds[var];
}
@ -170,7 +170,7 @@ public abstract class FunctionFactory {
* @param from number to create function of
* @return function representing the number {@code from}
*/
Function fromLong(long from) {
public Function fromLong(long from) {
return fromBigRational(new BigRational(from));
}
}

2
prism/src/param/JasFunctionFactory.java

@ -152,7 +152,7 @@ final class JasFunctionFactory extends FunctionFactory {
}
@Override
Function getVar(int var) {
public Function getVar(int var) {
return parameters[var];
}
}
Loading…
Cancel
Save