org.ros.namespace
Class GraphName

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

public class GraphName
extends java.lang.Object

ROS graph resource name.

See Also:
Names documentation

Constructor Summary
GraphName(java.lang.String name)
          Constructs a new canonical GraphName.
 
Method Summary
static java.lang.String canonicalize(java.lang.String name)
          Convert name into canonical representation.
 boolean equals(java.lang.Object obj)
           
 GraphName getBasename()
           
 GraphName getParent()
           
 int hashCode()
           
 boolean isEmpty()
           
 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.
 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.
 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.
 boolean isRoot()
           
 GraphName join(GraphName other)
          Join this GraphName with another.
static GraphName newAnonymous()
          Creates an anonymous GraphName.
static GraphName newRoot()
           
 GraphName toGlobal()
          Convert name to a global name representation.
 GraphName toRelative()
          Convert name to a relative name representation.
 java.lang.String toString()
           
static boolean validate(java.lang.String name)
          Returns true if the supplied String can be used to construct a GraphName.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GraphName

public GraphName(java.lang.String name)
Constructs a new canonical GraphName.

Parameters:
name - the name of this resource
Method Detail

newAnonymous

public static GraphName newAnonymous()
Creates an anonymous GraphName.

Returns:
a new GraphName suitable for creating an anonymous node

newRoot

public static GraphName newRoot()
Returns:
a new GraphName representing the root namespace

validate

public static boolean validate(java.lang.String name)
Returns true if the supplied String can be used to construct a GraphName.

Parameters:
name - the String representation of a GraphName to validate
Returns:
true if the supplied name is can be used to construct a GraphName

canonicalize

public static java.lang.String canonicalize(java.lang.String name)
Convert name into canonical representation. Canonical representation has no trailing slashes. Canonical names can be global, private, or relative.

Parameters:
name -
Returns:
the canonical name for this GraphName

isGlobal

public boolean isGlobal()
Is this a /global/name?

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?

Returns:
true if the name is a private name, false otherwise

isRelative

public boolean isRelative()
Is this a relative/name?

Returns:
true if the name is a relative name.

getParent

public GraphName getParent()
Returns:
Gets the parent of this name in canonical representation. This may return an empty name 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

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object