00001 /* 00002 * Copyright (C) 2012 Google Inc. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 00005 * use this file except in compliance with the License. You may obtain a copy of 00006 * the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 00012 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 00013 * License for the specific language governing permissions and limitations under 00014 * the License. 00015 */ 00016 00017 package org.ros.internal.node.server.master; 00018 00019 import org.ros.namespace.GraphName; 00020 00021 import java.net.URI; 00022 00028 public class ServiceRegistrationInfo { 00029 00033 private final GraphName serviceName; 00034 00038 private final URI serviceUri; 00039 00043 private final NodeRegistrationInfo node; 00044 00045 public ServiceRegistrationInfo(GraphName serviceName, URI serviceUri, NodeRegistrationInfo node) { 00046 this.serviceName = serviceName; 00047 this.serviceUri = serviceUri; 00048 this.node = node; 00049 } 00050 00056 public GraphName getServiceName() { 00057 return serviceName; 00058 } 00059 00065 public URI getServiceUri() { 00066 return serviceUri; 00067 } 00068 00074 public NodeRegistrationInfo getNode() { 00075 return node; 00076 } 00077 00078 @Override 00079 public int hashCode() { 00080 final int prime = 31; 00081 int result = 1; 00082 result = prime * result + serviceName.hashCode(); 00083 return result; 00084 } 00085 00086 @Override 00087 public boolean equals(Object obj) { 00088 if (this == obj) 00089 return true; 00090 if (obj == null) 00091 return false; 00092 if (getClass() != obj.getClass()) 00093 return false; 00094 ServiceRegistrationInfo other = (ServiceRegistrationInfo) obj; 00095 if (!serviceName.equals(other.serviceName)) 00096 return false; 00097 return true; 00098 } 00099 }