/** * Method which determines the color that the place p, should get depending on its average waiting * time. This color is returned as String in dot-form * * @param p ExtendedPlace: the place to be colored * @return String */ private String determinePlaceColor(ExtendedPlace p) { String temp = "fillcolor="; // paint places according to their waiting time level: double bnd0 = 0, bnd1 = 0, wait = 0; Color col0, col1, col2; if (p.hasSettings()) { bnd0 = ((Double) p.getBounds().get(0)).doubleValue() * timeDivider; bnd1 = ((Double) p.getBounds().get(1)).doubleValue() * timeDivider; col0 = (Color) p.getColors().get(0); col1 = (Color) p.getColors().get(1); col2 = (Color) p.getColors().get(2); } else { bnd0 = ((Double) bounds.get(0)).doubleValue() * timeDivider; bnd1 = ((Double) bounds.get(1)).doubleValue() * timeDivider; col0 = (Color) levelColors.get(0); col1 = (Color) levelColors.get(1); col2 = (Color) levelColors.get(2); } try { p.calculateMetrics(currentlySelectedInstances, advancedSettings[1], failedInstances); wait = (p.getMeanWaitingTime()); } catch (Exception ex) { } // array to store HSB values in float[] hsb = new float[3]; if (wait <= bnd0) { Color.RGBtoHSB(col0.getRed(), col0.getGreen(), col0.getBlue(), hsb); temp += "\"" + hsb[0] + "," + hsb[1] + "," + hsb[2] + "\""; } else if (wait <= bnd1) { Color.RGBtoHSB(col1.getRed(), col1.getGreen(), col1.getBlue(), hsb); temp += "\"" + hsb[0] + "," + hsb[1] + "," + hsb[2] + "\""; } else if (wait > bnd1) { // final one Color.RGBtoHSB(col2.getRed(), col2.getGreen(), col2.getBlue(), hsb); temp += "\"" + hsb[0] + "," + hsb[1] + "," + hsb[2] + "\""; } else { Color.RGBtoHSB(col0.getRed(), col0.getGreen(), col0.getBlue(), hsb); temp += "\"" + hsb[0] + "," + hsb[1] + "," + hsb[2] + "\""; } return temp; }