FrameName.java
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2013 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.rosjava_geometry;
00018 
00019 import java.lang.String;
00020 
00028 public class FrameName {
00029     private static final String LEGACY_SEPARATOR = "/";
00030     private String name;
00031 
00032     public static FrameName of(String name) {
00033         return new FrameName(name);
00034     }
00035 
00036     private FrameName(String name) {
00037         this.name = stripLeadingSlash(name);
00038     }
00039 
00043     private static String stripLeadingSlash(String name) {
00044         return name.replaceFirst("^/", "");
00045     }
00046 
00047     public String toString() {
00048         return name;
00049     }
00050 
00051     public int hashCode() {
00052         return name.hashCode();
00053     }
00054 
00055     public boolean equals(Object obj) {
00056         if (this == obj)
00057             return true;
00058         if (obj == null)
00059             return false;
00060         if (getClass() != obj.getClass())
00061             return false;
00062         FrameName other = (FrameName) obj;
00063         if (name == null) {
00064             if (other.name != null)
00065                 return false;
00066         } else if (!name.equals(other.name)) {
00067             return false;
00068         }
00069         return true;
00070     }
00071 
00072 }


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