Class GraphName

java.lang.Object
org.ros.namespace.GraphName

public class GraphName extends Object
ROS graph resource name.
Author:
damonkohler@google.com (Damon Kohler)
See Also:
  • Method Details

    • newAnonymous

      public static GraphName newAnonymous()
      Creates an anonymous GraphName.
      Returns:
      a new GraphName suitable for creating an anonymous node
    • root

      public static GraphName root()
      Returns:
      a GraphName representing the root namespace
    • empty

      public static GraphName empty()
      Returns:
      an empty GraphName
    • of

      public static GraphName of(String name)
      Returns a new GraphName of the specified name.
      Parameters:
      name - the name of this resource
      Returns:
      a new GraphName for name
    • isGlobal

      public boolean isGlobal()
      Is this a /global/name?
      • If node node1 in the global / namespace accesses the resource /bar, that will resolve to the name /bar.
      • If node node2 in the /wg/ namespace accesses the resource /foo, that will resolve to the name /foo.
      • If node node3 in the /wg/ namespace accesses the resource /foo/bar, that will resolve to the name /foo/bar.
      Returns:
      true if this name is a global name, false otherwise
    • isRoot

      public boolean isRoot()
      Returns:
      true if this GraphName represents the root namespace, false otherwise
    • isEmpty

      public boolean isEmpty()
      Returns:
      true if this GraphName is empty, false otherwise
    • isPrivate

      public boolean isPrivate()
      Is this a ~private/name?
      • If node node1 in the global / namespace accesses the resource ~bar, that will resolve to the name /node1/bar.
      • If node node2 in the /wg/ namespace accesses the resource ~foo, that will resolve to the name /wg/node2/foo.
      • If node node3 in the /wg/ namespace accesses the resource ~foo/bar, that will resolve to the name /wg/node3/foo/bar.
      Returns:
      true if the name is a private name, false otherwise
    • isRelative

      public boolean isRelative()
      Is this a relative/name?
      • If node node1 in the global / namespace accesses the resource ~bar, that will resolve to the name /node1/bar.
      • If node node2 in the /wg/ namespace accesses the resource ~foo, that will resolve to the name /wg/node2/foo.
      • If node node3 in the /wg/ namespace accesses the resource ~foo/bar, that will resolve to the name /wg/node3/foo/bar.
      Returns:
      true if the name is a relative name.
    • getParent

      public GraphName getParent()
      Returns:
      the parent of this GraphName in its canonical representation or an empty GraphName if there is no parent
    • getBasename

      public GraphName getBasename()
      Returns:
      a GraphName without the leading parent namespace
    • toRelative

      public GraphName toRelative()
      Convert name to a relative name representation. This does not take any namespace into account; it simply strips any preceding characters for global or private name representation.
      Returns:
      a relative GraphName
    • toGlobal

      public GraphName toGlobal()
      Convert name to a global name representation. This does not take any namespace into account; it simply adds in the global prefix "/" if missing.
      Returns:
      a global GraphName
    • join

      public GraphName join(GraphName other)
      Join this GraphName with another.
      Parameters:
      other - the GraphName to join with, if other is global, this will return other
      Returns:
      a GraphName representing the concatenation of this GraphName and other
    • join

      public GraphName join(String other)
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object