ServiceIdentifier.java
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2011 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.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 }


rosjava_core
Author(s):
autogenerated on Wed Aug 26 2015 16:06:49