/* (non-Javadoc)
   * @see java.lang.Comparable#compareTo(java.lang.Object)
   */
  @Override
  public int compareTo(RoutingProcessorConfiguration o) {
    CompareToBuilder builder =
        (new CompareToBuilder())
            .append(getRoutingInstances().size(), o.getRoutingInstances().size());

    if (builder.toComparison() == 0) {
      Iterator<RoutingInstanceConfiguration> lit = getRoutingInstances().iterator();
      Iterator<RoutingInstanceConfiguration> rit = o.getRoutingInstances().iterator();

      while (lit.hasNext()) builder.append(lit.next(), rit.next());
    }

    return builder.toComparison();
  }
  /* (non-Javadoc)
   * @see java.lang.Object#equals(java.lang.Object)
   */
  @Override
  public boolean equals(Object obj) {
    if (!(obj instanceof RoutingProcessorConfiguration)) return false;

    RoutingProcessorConfiguration o = (RoutingProcessorConfiguration) obj;

    EqualsBuilder builder =
        (new EqualsBuilder()).append(getRoutingInstances().size(), o.getRoutingInstances().size());

    if (builder.isEquals()) {
      Iterator<RoutingInstanceConfiguration> lit = getRoutingInstances().iterator();
      Iterator<RoutingInstanceConfiguration> rit = o.getRoutingInstances().iterator();

      while (lit.hasNext()) builder.append(lit.next(), rit.next());
    }

    return builder.isEquals();
  }