Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

javax.ide.net
Class URIPath  view URIPath download URIPath.java

java.lang.Object
  extended byjavax.ide.net.URIPath

public final class URIPath
extends java.lang.Object

An instance of URIPath represents a path that is made up entirely of java.net.URIs. This can be a class path, source path, doc path, etc.


Field Summary
private  java.util.ArrayList _entriesList
           
 
Constructor Summary
URIPath()
          Creates a URIPath that is initially empty.
URIPath(int initialCapacity)
          Creates an empty URIPath with the specified initial capacity.
URIPath(java.lang.String entries)
          Contructor for creating a URIPath instance based on a typical path string, such as that that is returned by System.getProperty( "java.class.path" ).
URIPath(java.net.URI entry)
          Creates a URIPath that initially contains the specified java.net.URI as its sole entry.
URIPath(java.net.URI[] entries)
          Creates a URIPath initialized with the specified array of java.net.URI objects.
URIPath(URIPath uriPath)
          Copy constructor.
 
Method Summary
 void add(java.net.URI entry)
          Adds the given java.net.URI to the end of the URIPath, if it is not already on the URIPath.
 void add(java.net.URI[] entries)
          Adds the given java.net.URI objects in order to the end of the URIPath.
 void add(URIPath uriPath)
          Adds the entries from the specified URIPath to this instance.
 boolean contains(java.net.URI entry)
          Returns true if the specified java.net.URI is currently on this URIPath.
 boolean equals(java.lang.Object o)
          Returns true if the specified object equals this URI path.
protected  boolean equalsImpl(URIPath uriPath)
          This is a helper method for equals(Object) 55 that can also be used by subclasses that implement equals(Object) 55 .
private  int findEntry(java.net.URI entry)
           
 java.net.URI[] getEntries()
          Returns the path represented by this URIPath instance as an array of java.net.URIs.
 int hashCode()
          Get a value that represents this Object, as uniquely as possible within the confines of an int.
 java.util.Iterator iterator()
          Returns an Iterator whose elements are all instances of java.net.URI.
private  java.net.URI pathToURI(java.lang.String pathname)
          Given a file path, create an URI representing that file.
 void remove(java.net.URI entry)
          Remove the specified entry.
 java.net.URI toQualifiedURI(java.lang.String relativePath)
          Given a relative spec, this method attempts to construct a fully qualified java.net.URI that points to the corresponding resource on this URIPath.
 java.lang.String toRelativePath(java.net.URI uri)
          Given an java.net.URI, this method attempts to derive its relative path with respect to this instance of URIPath.
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_entriesList

private final java.util.ArrayList _entriesList
Constructor Detail

URIPath

public URIPath()
Creates a URIPath that is initially empty.


URIPath

public URIPath(int initialCapacity)
Creates an empty URIPath with the specified initial capacity. Used to construct a URIPath whose contents are not initially known but where the number of entries can be estimated ahead of time.


URIPath

public URIPath(java.net.URI entry)
Creates a URIPath that initially contains the specified java.net.URI as its sole entry. If the entry is null, then the URIPath created is initially empty.


URIPath

public URIPath(java.net.URI[] entries)
Creates a URIPath initialized with the specified array of java.net.URI objects. If the entries array is null or empty, then the URIPath created is initially empty.


URIPath

public URIPath(URIPath uriPath)
Copy constructor.


URIPath

public URIPath(java.lang.String entries)
Contructor for creating a URIPath instance based on a typical path string, such as that that is returned by System.getProperty( "java.class.path" ). The exact format of the path string is platform-dependent, so the path string is tokenized using File.pathSeparator>File.pathSeparator 55 as the delimiter.

Relative paths are converted to absolute paths, and any path entries whose name ends in ".jar" or ".zip" will be created as jar java.net.URIs (i.e. an java.net.URI with the "jar" scheme).

Method Detail

add

public void add(java.net.URI entry)
Adds the given java.net.URI to the end of the URIPath, if it is not already on the URIPath. If the parameter is null, then this method returns without doing anything.


add

public void add(java.net.URI[] entries)
Adds the given java.net.URI objects in order to the end of the URIPath. Each java.net.URI is added only if it is not already on the URIPath. Any null entries are ignored. If the entries array itself is null, then this method returns without doing anything.


add

public void add(URIPath uriPath)
Adds the entries from the specified URIPath to this instance.


getEntries

public java.net.URI[] getEntries()
Returns the path represented by this URIPath instance as an array of java.net.URIs. If the URIPath is empty, then then this method returns an java.net.URI array of size 0.


contains

public boolean contains(java.net.URI entry)
Returns true if the specified java.net.URI is currently on this URIPath.


remove

public void remove(java.net.URI entry)
Remove the specified entry.


iterator

public java.util.Iterator iterator()
Returns an Iterator whose elements are all instances of java.net.URI. Calling the remove() method on the iterator will write through and change the URIPath.


toRelativePath

public java.lang.String toRelativePath(java.net.URI uri)
Given an java.net.URI, this method attempts to derive its relative path with respect to this instance of URIPath. If the specified java.net.URI does not point to a location that is on this URIPath, then null is returned.


toQualifiedURI

public java.net.URI toQualifiedURI(java.lang.String relativePath)
Given a relative spec, this method attempts to construct a fully qualified java.net.URI that points to the corresponding resource on this URIPath. If no matching java.net.URI can be constructed, then null is returned. An java.net.URI is deemed to match iff the java.net.URI points to an existing resource. In practical terms, it means that calling the method exists() on VirtualFileSystem returns true. Note that toQualifiedURI will generally return null if the desired resource only exists in memory (for example, if it is bound to an unsaved javax.ide.model.Document).


equals

public boolean equals(java.lang.Object o)
Returns true if the specified object equals this URI path.


equalsImpl

protected final boolean equalsImpl(URIPath uriPath)
This is a helper method for equals(Object) 55 that can also be used by subclasses that implement equals(Object) 55 . It assumes that the argument is not null.


toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


hashCode

public int hashCode()
Description copied from class: java.lang.Object
Get a value that represents this Object, as uniquely as possible within the confines of an int.

There are some requirements on this method which subclasses must follow:

  • Semantic equality implies identical hashcodes. In other words, if a.equals(b) is true, then a.hashCode() == b.hashCode() must be as well. However, the reverse is not necessarily true, and two objects may have the same hashcode without being equal.
  • It must be consistent. Whichever value o.hashCode() returns on the first invocation must be the value returned on all later invocations as long as the object exists. Notice, however, that the result of hashCode may change between separate executions of a Virtual Machine, because it is not invoked on the same object.

Notice that since hashCode is used in java.util.Hashtable and other hashing classes, a poor implementation will degrade the performance of hashing (so don't blindly implement it as returning a constant!). Also, if calculating the hash is time-consuming, a class may consider caching the results.

The default implementation returns System.identityHashCode(this)


findEntry

private int findEntry(java.net.URI entry)

pathToURI

private java.net.URI pathToURI(java.lang.String pathname)
Given a file path, create an URI representing that file.