Browse Source

Code tidy.

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@6228 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 13 years ago
parent
commit
466d6ab21f
  1. 36
      prism/src/prism/TileList.java

36
prism/src/prism/TileList.java

@ -26,22 +26,19 @@
package prism; package prism;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet;
import java.util.List; import java.util.List;
import parser.ast.Expression; import parser.ast.Expression;
/** /**
* This class represent a list of tiles which have corners in Pareto points, * This class represent a list of tiles which have corners in Pareto points,
* and which represent an underapproximation of the Pareto curve.
* and which represent an under-approximation of the Pareto curve.
*/ */
public class TileList public class TileList
{ {
/** /**
* Threshold for approximation of the pareto curve.
* Threshold for approximation of the Pareto curve.
*/ */
private double tolerance; private double tolerance;
@ -52,7 +49,8 @@ public class TileList
*/ */
private OpsAndBoundsList opsAndBoundsList; private OpsAndBoundsList opsAndBoundsList;
public OpsAndBoundsList getOpsAndBoundsList() {
public OpsAndBoundsList getOpsAndBoundsList()
{
return this.opsAndBoundsList; return this.opsAndBoundsList;
} }
@ -62,29 +60,33 @@ public class TileList
* returned in any reasonable way. * returned in any reasonable way.
* *
* To ensure correct concurrent behaviour, object accessing any stored tile lists * To ensure correct concurrent behaviour, object accessing any stored tile lists
* or elements should synchronize on this object;
* or elements should synchronise on this object;
*/ */
protected static List<TileList> storedTileLists; protected static List<TileList> storedTileLists;
public static List<TileList> getStoredTileLists() public static List<TileList> getStoredTileLists()
{ {
return storedTileLists; return storedTileLists;
} }
/** /**
* Formulas for X and Y axes (or multiobj formulas) of the corresponding
* Formulas for X and Y axes (or multi-obj formulas) of the corresponding
* elements of storedTileLists. * elements of storedTileLists.
*/ */
protected static List<Expression> storedFormulasX; protected static List<Expression> storedFormulasX;
protected static List<Expression> storedFormulasY; protected static List<Expression> storedFormulasY;
protected static List<Expression> storedFormulas; protected static List<Expression> storedFormulas;
public static List<Expression> getStoredFormulasX() public static List<Expression> getStoredFormulasX()
{ {
return storedFormulasX; return storedFormulasX;
} }
public static List<Expression> getStoredFormulasY() public static List<Expression> getStoredFormulasY()
{ {
return storedFormulasY; return storedFormulasY;
} }
public static List<Expression> getStoredFormulas() public static List<Expression> getStoredFormulas()
{ {
return storedFormulas; return storedFormulas;
@ -99,8 +101,7 @@ public class TileList
TileList.storedTileLists.clear(); TileList.storedTileLists.clear();
} }
static
{
static {
storedFormulasX = new ArrayList<Expression>(); storedFormulasX = new ArrayList<Expression>();
storedFormulasY = new ArrayList<Expression>(); storedFormulasY = new ArrayList<Expression>();
storedFormulas = new ArrayList<Expression>(); storedFormulas = new ArrayList<Expression>();
@ -145,7 +146,8 @@ public class TileList
} }
@Override @Override
public String toString() {
public String toString()
{
String s = "["; String s = "[";
boolean first = true; boolean first = true;
for (int j = 0; j < this.list.size(); j++) { for (int j = 0; j < this.list.size(); j++) {
@ -194,8 +196,7 @@ public class TileList
//we have to exhaust the boundaries first //we have to exhaust the boundaries first
while (this.currentProjectionIndex < this.dim) { while (this.currentProjectionIndex < this.dim) {
for (Tile t : list) { for (Tile t : list) {
if (!t.isUpperBound(this.currentProjectionIndex)
&& t.liesOnBoundary(this.currentProjectionIndex)) {
if (!t.isUpperBound(this.currentProjectionIndex) && t.liesOnBoundary(this.currentProjectionIndex)) {
t.hyperplaneSuggested = true; t.hyperplaneSuggested = true;
//System.out.println("fresh candidate hyperplane:" + t + "with weight " + Tile.getWeightsForTile(t)); //System.out.println("fresh candidate hyperplane:" + t + "with weight " + Tile.getWeightsForTile(t));
Point ret = Tile.getWeightsForTile(t); Point ret = Tile.getWeightsForTile(t);
@ -232,7 +233,7 @@ public class TileList
/** /**
* Returns the number of different points that form the tiles of this * Returns the number of different points that form the tiles of this
* TileList. The implementation is rather inefficient and is intended * TileList. The implementation is rather inefficient and is intended
* only for debugging pusposes.
* only for debugging purposes.
*/ */
public int getNumberOfDifferentPoints() public int getNumberOfDifferentPoints()
{ {
@ -263,14 +264,11 @@ public class TileList
public void addNewPoint(Point point) throws PrismException public void addNewPoint(Point point) throws PrismException
{ {
//first create the projection to the boundary //first create the projection to the boundary
if (this.currentProjectionIndex < this.dim &&
point.getCoord(this.currentProjectionIndex) > 0.0) {
if (this.currentProjectionIndex < this.dim && point.getCoord(this.currentProjectionIndex) > 0.0) {
Point projectionPoint = point.clone(); Point projectionPoint = point.clone();
projectionPoint.setCoord(this.currentProjectionIndex, 0.0); projectionPoint.setCoord(this.currentProjectionIndex, 0.0);
splitTilesByPoint(projectionPoint, false); splitTilesByPoint(projectionPoint, false);
}
else
{
} else {
splitTilesByPoint(point, this.currentProjectionIndex == dim); splitTilesByPoint(point, this.currentProjectionIndex == dim);
} }
} }

Loading…
Cancel
Save