Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 package org.ros.internal.node.service;
00018
00019 import com.google.common.base.Preconditions;
00020
00021 import org.ros.namespace.GraphName;
00022
00023 import java.net.URI;
00024
00028 public class ServiceIdentifier {
00029
00030 private final GraphName name;
00031 private final URI uri;
00032
00033 public ServiceIdentifier(GraphName name, URI uri) {
00034 Preconditions.checkNotNull(name);
00035 Preconditions.checkArgument(name.isGlobal());
00036 this.name = name;
00037 this.uri = uri;
00038 }
00039
00040 public GraphName getName() {
00041 return name;
00042 }
00043
00044 public URI getUri() {
00045 return uri;
00046 }
00047
00048 @Override
00049 public String toString() {
00050 return "ServiceIdentifier<" + name + ", " + uri + ">";
00051 }
00052
00053 @Override
00054 public int hashCode() {
00055 final int prime = 31;
00056 int result = 1;
00057 result = prime * result + ((name == null) ? 0 : name.hashCode());
00058 result = prime * result + ((uri == null) ? 0 : uri.hashCode());
00059 return result;
00060 }
00061
00062 @Override
00063 public boolean equals(Object obj) {
00064 if (this == obj)
00065 return true;
00066 if (obj == null)
00067 return false;
00068 if (getClass() != obj.getClass())
00069 return false;
00070 ServiceIdentifier other = (ServiceIdentifier) obj;
00071 if (name == null) {
00072 if (other.name != null)
00073 return false;
00074 } else if (!name.equals(other.name))
00075 return false;
00076 if (uri == null) {
00077 if (other.uri != null)
00078 return false;
00079 } else if (!uri.equals(other.uri))
00080 return false;
00081 return true;
00082 }
00083
00084 }