1 /* Copyright (c) 2012-2014, 2016. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
9 public class Contact implements Comparable<Object> {
13 public Contact(int id, int distance) {
15 this.distance = distance;
22 public int getDistance() {
27 public boolean equals(Object x) {
28 return (x == null) ? false : x.equals(id) ;
32 public int hashCode() {
34 hash = hash * 17 + id;
35 hash = hash * 31 + distance;
40 public int compareTo(Object o) {
41 Contact c = (Contact)o;
42 if (distance < c.distance) {
45 else if (distance == c.distance) {
54 public String toString() {
55 return "Contact [id=" + id + ", distance=" + distance + "]";