/** Is an analysis running */
 protected boolean isRunning() {
   return manager != null && manager.isRunning();
 }
  @Override
  protected void doUpdate(final AnalysisContextRisk context) {

    // The statistics builder
    final RiskEstimateBuilderInterruptible baseBuilder = getBuilder(context);

    // Enable/disable
    if (!this.isEnabled() || baseBuilder == null) {
      if (manager != null) {
        manager.stop();
      }
      this.setStatusEmpty();
      return;
    }

    // Create an analysis
    Analysis analysis =
        new Analysis() {

          private RiskEstimateBuilderInterruptible builder = baseBuilder;
          private boolean stopped = false;
          private double[] dataPitman;
          private double[] dataZayatz;
          private double[] dataSNB;
          private double[] dataDankar;
          private int idx;

          @Override
          public int getProgress() {
            return (int) Math.round(idx * 100d + (double) baseBuilder.getProgress())
                / POINTS.length;
          }

          @Override
          public void onError() {
            setStatusEmpty();
          }

          @Override
          public void onFinish() {

            if (stopped || !isEnabled()) {
              return;
            }

            // Update chart
            resetChart();

            ISeriesSet seriesSet = chart.getSeriesSet();
            if (showAllModels) {
              createSeries(
                  seriesSet,
                  dataPitman,
                  "Pitman",
                  PlotSymbolType.CIRCLE,
                  GUIHelper.COLOR_BLACK); // $NON-NLS-1$
              createSeries(
                  seriesSet,
                  dataZayatz,
                  "Zayatz",
                  PlotSymbolType.CROSS,
                  GUIHelper.COLOR_BLUE); // $NON-NLS-1$
              createSeries(
                  seriesSet,
                  dataSNB,
                  "SNB",
                  PlotSymbolType.DIAMOND,
                  GUIHelper.COLOR_RED); // $NON-NLS-1$
              createSeries(
                  seriesSet,
                  dataDankar,
                  "Dankar",
                  PlotSymbolType.SQUARE,
                  GUIHelper.COLOR_DARK_GRAY); // $NON-NLS-1$
              chart.getLegend().setVisible(true);
            } else {
              createSeries(
                  seriesSet,
                  dataDankar,
                  "Dankar",
                  PlotSymbolType.SQUARE,
                  GUIHelper.COLOR_BLACK); // $NON-NLS-1$
              chart.getLegend().setVisible(false);
            }

            IAxisSet axisSet = chart.getAxisSet();

            IAxis yAxis = axisSet.getYAxis(0);
            yAxis.setRange(new Range(0d, 1d));

            IAxis xAxis = axisSet.getXAxis(0);
            xAxis.setRange(new Range(0d, LABELS.length));
            xAxis.setCategorySeries(LABELS);

            chart.updateLayout();
            chart.update();
            updateCategories();
            chart.layout();
            chart.setRedraw(true);
            chart.redraw();

            setStatusDone();
          }

          @Override
          public void onInterrupt() {
            if (!isEnabled() || !isValid()) {
              setStatusEmpty();
            } else {
              setStatusWorking();
            }
          }

          @Override
          public void run() throws InterruptedException {

            // Timestamp
            long time = System.currentTimeMillis();

            // Perform work
            dataDankar = new double[POINTS.length];
            if (showAllModels) {
              dataPitman = new double[POINTS.length];
              dataZayatz = new double[POINTS.length];
              dataSNB = new double[POINTS.length];
            }
            for (idx = 0; idx < POINTS.length; idx++) {
              if (stopped) {
                throw new InterruptedException();
              }

              builder =
                  getBuilder(
                      context,
                      ARXPopulationModel.create(POINTS[idx]),
                      builder.getEquivalenceClassModel());

              if (idx == 0
                  && builder.getSampleBasedUniquenessRisk().getFractionOfUniqueTuples() == 0.0d) {
                Arrays.fill(dataDankar, 0.0d);
                if (showAllModels) {
                  Arrays.fill(dataPitman, 0.0d);
                  Arrays.fill(dataZayatz, 0.0d);
                  Arrays.fill(dataSNB, 0.0d);
                }
                break;
              }
              RiskModelPopulationUniqueness populationBasedModel =
                  builder.getPopulationBasedUniquenessRisk();
              dataDankar[idx] = populationBasedModel.getFractionOfUniqueTuplesDankar();
              if (showAllModels) {
                dataPitman[idx] = populationBasedModel.getFractionOfUniqueTuplesPitman();
                dataZayatz[idx] = populationBasedModel.getFractionOfUniqueTuplesZayatz();
                dataSNB[idx] = populationBasedModel.getFractionOfUniqueTuplesSNB();
              }
            }

            // Our users are patient
            while (System.currentTimeMillis() - time < MINIMAL_WORKING_TIME && !stopped) {
              Thread.sleep(10);
            }
          }

          @Override
          public void stop() {
            if (baseBuilder != null) baseBuilder.interrupt();
            this.stopped = true;
          }
        };

    this.manager.start(analysis);
  }