/** @basic */
 public final int getNbOccurrences(RealBeed<?> argument) {
   int count = 0;
   for (RealBeed<?> a : $arguments) {
     if (a.equals(argument)) {
       count++;
     }
   }
   return count;
 }
 @Override
 public void toString(StringBuffer sb, int level) {
   super.toString(sb, level);
   sb.append(indent(level + 1) + "value: " + getDouble() + "\n");
   sb.append(
       indent(level + 1) + "number of " + argumentsToString() + ": " + $arguments.size() + "\n");
   for (RealBeed<?> argument : $arguments) {
     argument.toString(sb, level + 2);
     sb.append(indent(level + 2) + "nr of occurences: " + getNbOccurrences(argument) + "\n");
   }
 }
 /**
  * The value of this beed is recalculated. This is done by iterating over the arguments. When
  * there are no terms, the result is equal to {@link #initialValue()}. When one of the terms is
  * null, the result is null. When all terms are effective, the result is dependent on the specific
  * subclass.
  */
 private final void recalculate() {
   $value = initialValue();
   for (RealBeed<?> argument : $arguments) {
     if (!argument.isEffective()) {
       assignEffective(false);
       return;
     }
     $value = operation($value, argument.getdouble());
   }
   assignEffective(true);
 }
 public final void toStringDepth(StringBuffer sb, int depth, NumberFormat numberFormat) {
   Iterator<RealBeed<?>> i = $arguments.iterator();
   while (i.hasNext()) {
     RealBeed<?> argument = i.next();
     sb.append("(");
     if (depth == 1) {
       sb.append(numberFormat.format(argument.getdouble()));
     } else {
       argument.toStringDepth(sb, depth - 1, numberFormat);
     }
     sb.append(")" + getNbOccurrencesOperatorString() + getNbOccurrences(argument));
     if (i.hasNext()) {
       sb.append(getOperatorString());
     }
   }
 }
 /**
  * @pre argument != null;
  * @post new.getNbOccurrences(argument) == getNbOccurrences(argument) + 1;
  */
 public final void addArgument(RealBeed<?> argument) {
   assert argument != null;
   addUpdateSource(argument);
   $arguments.add(argument);
   // recalculate(); optimization
   if ($effective) {
     double oldValue = $value;
     if (!argument.isEffective()) {
       assignEffective(false);
     } else {
       assert argument.isEffective();
       if (argument.getdouble() != initialValue()) {
         $value = operation($value, argument.getdouble());
       }
     }
     if ((!$effective) || !MathUtil.equalPrimitiveValue(oldValue, $value)) {
       updateDependents(new ActualDoubleEvent(this, oldValue, $effective ? $value : null, null));
     }
   }
   // otherwise, there is an existing null argument; the new argument cannot change null value
 }
 @Override
 protected Double valueFrom(RealBeed<?> operandBeed) {
   return operandBeed.getDouble();
 }