org.mulgara.mrg
Class Uri

java.lang.Object
  extended by org.mulgara.mrg.Uri
All Implemented Interfaces:
Comparable<Node>, Node, ObjectNode, PredicateNode, SubjectNode

public class Uri
extends Object
implements SubjectNode, PredicateNode, ObjectNode

A wrapper for a URI. This allows the use of URI as a Node. TODO: create Uri with factory from the graph. If a uri string is already internal (u == u.intern()) then it is already in the graph, and we want to find it with the existing indexes so that we can reuse the object.


Field Summary
static int TYPE_ID
          The type identifier for Uri
 
Constructor Summary
Uri(String u)
          Convenience to a new URI.
Uri(URI uri)
          Create a new URI.
 
Method Summary
 int compareTo(Node o)
          Compares this object with the specified object for order.
static Uri create(String u)
          Safe creation of a URI.
 boolean equals(Object o)
          Equality method.
 int getTypeId()
          A type identifier to distinguish from the other types of Node.
 URI getURI()
          Gets the wrapped URI.
 int hashCode()
          The hashcode, based on the uri.
 String toString()
          Represents this node as a string.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_ID

public static final int TYPE_ID
The type identifier for Uri

See Also:
Constant Field Values
Constructor Detail

Uri

public Uri(String u)
    throws URISyntaxException
Convenience to a new URI.

Parameters:
u - The string form of the URI to wrap.
Throws:
URISyntaxException

Uri

public Uri(URI uri)
Create a new URI.

Parameters:
uri - The URI to wrap.
Method Detail

create

public static Uri create(String u)
Safe creation of a URI. This should only be used for valid constants.

Parameters:
u - The string form of the URI to wrap.

getURI

public URI getURI()
Gets the wrapped URI.


getTypeId

public int getTypeId()
A type identifier to distinguish from the other types of Node.

Specified by:
getTypeId in interface Node

equals

public boolean equals(Object o)
Equality method. Based on the wrapped URI.

Overrides:
equals in class Object

hashCode

public int hashCode()
The hashcode, based on the uri.

Overrides:
hashCode in class Object

compareTo

public int compareTo(Node o)
Compares this object with the specified object for order.

Specified by:
compareTo in interface Comparable<Node>
Parameters:
o - the object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

toString

public String toString()
Represents this node as a string.

Overrides:
toString in class Object


Copyright © 2011. All Rights Reserved.