/*
 * Copyright (C) 2017-2017 DataStax Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.datastax.oss.driver.internal.core.metadata;

import com.datastax.oss.driver.api.core.loadbalancing.NodeDistance;
import java.util.Objects;

/** Fired when the load balancing policy assigns a new distance to a host. */
public class DistanceEvent {
  public final NodeDistance distance;
  public final DefaultNode node;

  public DistanceEvent(NodeDistance distance, DefaultNode node) {
    this.distance = distance;
    this.node = node;
  }

  @Override
  public boolean equals(Object other) {
    if (other == this) {
      return true;
    } else if (other instanceof DistanceEvent) {
      DistanceEvent that = (DistanceEvent) other;
      return this.distance == that.distance
          && Objects.equals(this.node.getConnectAddress(), that.node.getConnectAddress());
    } else {
      return false;
    }
  }

  @Override
  public int hashCode() {
    return Objects.hash(this.distance, this.node.getConnectAddress());
  }

  @Override
  public String toString() {
    return "DistanceEvent(" + distance + ", " + node.getConnectAddress() + ")";
  }
}

@@ -720,16 +720,71 @@
 stance;%0A
+import com.datastax.oss.driver.api.core.metadata.Node;%0A
 import j
@@ -809,19 +809,26 @@
 %0A/**
- Fired when
+%0A * Indicates that
  the
@@ -854,15 +854,20 @@
 icy 
+has 
 assign
-s
+ed
  a n
@@ -888,16 +888,203 @@
  a host.
+%0A *%0A * %3Cp%3EThis is informational only: firing this event manually does %3Cb%3Enot%3C/b%3E change the distance.%0A * For that, see %7B@link LoadBalancingPolicyWrapper#setDistance(Node, NodeDistance)%7D.%0A
  */%0Apubl

Improve NodeDistance javadoc