@Override
  public int getClausesCount() {
    int theCount = 0;
    for (EventCondition theCondition : getConditions()) {
      theCount += theCondition.getClausesCount();
    }

    return theCount;
  }
  /**
   * Create the PredictorServiceDescription object, which defines the offerings of the service to
   * any clients.
   */
  private void generatePredictorServiceDescription() {
    desc =
        new PredictorServiceDescription(
            "Community Analysis Predictor Service",
            "1.3",
            "A Predictor Service for that makes predictions on events based on the Community Analysis tool");
    desc.setUuid(UUID.fromString("89344cd0-893b-4bee-a484-e5b69e320745"));

    // event
    Event evt = new Event("Community Health Event", "Description");
    EventCondition evtCond =
        new EventCondition(
            ParameterValueType.FLOAT,
            "Health Indicator Threshold",
            "The threshold the event should fire at",
            "");
    evtCond.setValuesAllowedType(ValuesAllowedType.SINGLE);
    evtCond.addValueConstraint("0.3", ValueConstraintType.DEFAULT);
    evtCond.addValueConstraint("0", ValueConstraintType.MIN);
    evtCond.addValueConstraint("1", ValueConstraintType.MAX);
    evt.setEventCondition(evtCond);

    Parameter featureParam =
        new Parameter(
            ParameterValueType.STRING,
            "Health indicator",
            "Select which health indicator to use",
            "");
    featureParam.addValueConstraint("Popularity", ValueConstraintType.DEFAULT);
    featureParam.addValueConstraint("In-Degree", ValueConstraintType.VALUESALLOWED); // 1
    featureParam.addValueConstraint("Out-Degree", ValueConstraintType.VALUESALLOWED); // 2
    featureParam.addValueConstraint("Popularity", ValueConstraintType.VALUESALLOWED); // 3
    featureParam.addValueConstraint("Reciprocity", ValueConstraintType.VALUESALLOWED); // 4
    featureParam.addValueConstraint("Activity", ValueConstraintType.VALUESALLOWED); // 5

    evt.addConfigParam(featureParam);
    desc.addEvent(evt);

    // forecast period
    Parameter forecastPeriod =
        new Parameter(
            ParameterValueType.INT,
            "Forecast period",
            "The available forecast period options",
            "days");
    forecastPeriod.addValueConstraint("7", ValueConstraintType.DEFAULT);
    forecastPeriod.addValueConstraint("7", ValueConstraintType.MIN);
    forecastPeriod.addValueConstraint("28", ValueConstraintType.MAX);
    forecastPeriod.addValueConstraint("7", ValueConstraintType.STEP);
    desc.setForecastPeriod(forecastPeriod);

    // no general configuration parameters...
  }
  @Override
  protected String toString(int aIndent) {
    StringBuilder theBuilder = new StringBuilder();
    Utils.indentln(theBuilder, aIndent);
    theBuilder.append(getClass().getSimpleName());

    for (EventCondition theCondition : getConditions()) {
      Utils.indentln(theBuilder, aIndent + 2);
      theBuilder.append(theCondition.toString(aIndent + 2));
    }

    theBuilder.append('\n');
    return theBuilder.toString();
  }