From 6a4d24f95534d05aa526eb4b057397edcfc05067 Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Sat, 5 Mar 2011 00:25:23 +0000 Subject: Rough Addition of P2P code. --- src/alden/PeerInformation.java | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/alden/PeerInformation.java (limited to 'src/alden/PeerInformation.java') diff --git a/src/alden/PeerInformation.java b/src/alden/PeerInformation.java new file mode 100644 index 0000000..3d94f11 --- /dev/null +++ b/src/alden/PeerInformation.java @@ -0,0 +1,39 @@ +package alden; +import java.io.*; +import java.net.*; + +public class PeerInformation implements Serializable { + private static final long serialVersionUID = 3667108226485766929L; + public static final String DEFAULT_ID = "something unique"; + + public InetAddress address; + public int port; + public PeerCoordinates location; + public String id; + + public PeerInformation() { + id = DEFAULT_ID; + } + + public PeerInformation(PeerInformation other) { + this(other.address, other.port, other.location); + } + + public PeerInformation(InetAddress address, int port, PeerCoordinates location) { + this(); + this.address = address; + this.port = port; + this.location = location; + } + + public String toString() { + return address + ":" + port + " @ " + location; + } + + public boolean equals(Object other) { + if (!(other instanceof PeerInformation)) + return false; + + return location.equals(((PeerInformation)other).location); + } +} -- cgit v1.2.3