public Result getResult() throws OlapException { // make result reproducable for testing purposes random.setSeed(123427); int cellCount = 1; for (int i = 0; i < axes.length; i++) cellCount *= axes[i].getPositions().size(); Locale locale = super.getLocale(); if (locale == null) locale = Locale.getDefault(); DecimalFormat fmt = (DecimalFormat) DecimalFormat.getInstance(locale); fmt.applyPattern("#,##0.00"); ArrayList cells = new ArrayList(); for (int i = 0; i < cellCount; i++) { CellImpl c = new CellImpl(); if (false) { c.setValue(new Integer(i)); c.setFormattedValue(Integer.toString(i)); } else { double value = random.nextGaussian() * 100 + 1000; c.setValue(new Double(value)); c.setFormattedValue(fmt.format(value)); } addProperties(c, i); cells.add(c); } ResultImpl res = new ResultImpl(); res.setAxes(axes); res.setCells(cells); res.setSlicer(slicer); return res; }
public static void addProperties(CellImpl c, int i) { Property[] props = new Property[1]; PropertyImpl p = new PropertyImpl(); props[0] = p; switch ((i / 2) % 10) { case 0: p.setName("arrow"); p.setValue("up"); break; case 1: p.setName("arrow"); p.setValue("down"); break; case 2: p.setName("arrow"); p.setValue("none"); break; case 4: p.setName("style"); p.setValue("red"); break; case 5: p.setName("style"); p.setValue("yellow"); break; case 6: p.setName("style"); p.setValue("green"); break; default: break; } p.setLabel(p.getName()); c.setProperties(props); }