code: public static void pipeMagnitude( double[] magnitude, double[] whereDrain, IHMProgressMonitor pm ) {
  
          int count = 0;
  
          /* whereDrain Contiene gli indici degli stati riceventi. */
          /* magnitude Contiene la magnitude dei vari stati. */
  
          int length = magnitude.length;
          /* Per ogni stato */
          for( int i = 0; i < length; i++ ) {
              count = 0;
              /* la magnitude viene posta pari a 1 */
              magnitude[i]++;
              int k = i;
              /*
               * Si segue il percorso dell'acqua e si incrementa di 1 la mgnitude
               * di tutti gli stati attraversati prima di raggiungere l'uscita
               */
              while( whereDrain[k] != Constants.OUT_INDEX_PIPE && count < length ) {
                  k = (int) whereDrain[k];
                  magnitude[k]++;
                  count++;
              }
              if (count > length) {
                  pm.errorMessage(msg.message("trentoP.error.pipe"));
                  throw new IllegalArgumentException(msg.message("trentoP.error.pipe"));
              }
          }
  
      }
docs: Calculate the magnitudo of the several drainage area.
  
  <p>
  It begin from the first state, where the magnitudo is setted to 1, and
  then it follow the path of the water until the outlet.
  </p>
  <p>
  During this process the magnitudo of each through areas is incremented of
  1 units. This operation is done for every state, so any path of the water
  are analized, from the state where she is intercept until the outlet.
  <p>
  </p>
  
  @param magnitudo is the array where the magnitudo is stored.
  @param whereDrain array which contains where a pipe drains.
  @param pm the progerss monitor.
  @throw IllegalArgumentException if the water through a number of state
  which is greater than the state in the network.