/* Expand array only when necessary, pointed out by Florian Loitsch
  * March 08, 2002
  */
 public void add(Object e) {
   /* Expand only if necessary! and removes one if too:) */
   // Add element
   if (!contains(e)) {
     // Expand array if necessary
     if (numElements == maxElements) doubleCapacity();
     elements[numElements++] = e;
   }
 }
  public void copy(FlowSet destFlow) {
    if (sameType(destFlow)) {
      ArraySparseSet dest = (ArraySparseSet) destFlow;

      while (dest.maxElements < this.maxElements) dest.doubleCapacity();

      dest.numElements = this.numElements;

      System.arraycopy(this.elements, 0, dest.elements, 0, this.numElements);
    } else super.copy(destFlow);
  }