1 20 package org.apache.mina.transport.vmpipe; 21 22 import java.net.SocketAddress ; 23 24 30 public class VmPipeAddress extends SocketAddress implements Comparable { 31 private static final long serialVersionUID = 3257844376976830515L; 32 33 private final int port; 34 35 38 public VmPipeAddress(int port) { 39 this.port = port; 40 } 41 42 45 public int getPort() { 46 return port; 47 } 48 49 public int hashCode() { 50 return port; 51 } 52 53 public boolean equals(Object o) { 54 if (o == null) 55 return false; 56 if (this == o) 57 return true; 58 if (o instanceof VmPipeAddress) { 59 VmPipeAddress that = (VmPipeAddress) o; 60 return this.port == that.port; 61 } 62 63 return false; 64 } 65 66 public int compareTo(Object o) { 67 return this.port - ((VmPipeAddress) o).port; 68 } 69 70 public String toString() { 71 return "vm:" + port; 72 } 73 } | Popular Tags |