|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectai.krr.NameSpace
public class NameSpace
This class implements a table of Symbol
s that belong to this
NameSpace
. Effectively, it is a hash table that associates the
name of a symbol with the symbol itself. Since NamedSymbol
s have to
belong to a NameSpace
and do not provide a public constructor,
this class provides a simple method (getNamedSymbol(java.lang.String)
) to create and
retrieve these symbols.
Method Summary | |
---|---|
protected java.lang.Object |
clone()
This class does not support cloning and an Exception will be thrown if this method is called. |
int |
compareTo(NameSpace ns)
This function compares this NameSpace to the given NameSpace. |
java.util.Collection<NamedSymbol> |
getAllSymbols()
This function can be used to retrieve all the NamedSymbol s that
are currently defined in this NameSpace. |
NamedSymbol |
getNamedSymbol(java.lang.String aName)
This function must be used to get hold of NamedSymbol s with the
given name. |
static NameSpace |
getNameSpace(java.net.URI uri)
This function must be used to obtain a new or the existing NameSpace that is associated with the given URI. |
java.net.URI |
getNameSpaceURI()
This function returns the URI with which this NameSpace is associated. |
java.lang.String |
getProxy()
This function returns a potentially previously assigned short prefix for this NameSpace. |
int |
hashCode()
This function returns a hash value for this NameSpace. |
void |
setProxy(java.lang.String name)
This function can be used to assign a short prefix to this NameSpace. |
int |
size()
This function returns the number of symbols currently stored in this NameSpace. |
java.lang.String |
toString()
This function returns a String representation of this NameSpace, which is the same as the String representing its URI. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
This class does not support cloning and an Exception will be thrown if this method is called.
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
- will be thrownpublic int compareTo(NameSpace ns)
This function compares this NameSpace to the given NameSpace. The order between NameSpaces is the order of their URIs.
compareTo
in interface java.lang.Comparable<NameSpace>
ns
- the NameSpace to which this NameSpace is to be compared
public final java.net.URI getNameSpaceURI()
This function returns the URI with which this NameSpace is associated. Note that there can only be one NameSpace for this URI.
public void setProxy(java.lang.String name)
This function can be used to assign a short prefix to this NameSpace. This is useful, for example, when generating XML documents in which the use of standard prefixes make a document more readable. The given String must not be null or the empty String. Also, care should be taken when this prefix is overwritten as it maybe used as was elsewhere.
name
- a String that may be used as a short name for this NameSpacepublic java.lang.String getProxy()
This function returns a potentially previously assigned short prefix for this NameSpace. It returns null if no such prefix was assigned.
public int size()
This function returns the number of symbols currently stored in this NameSpace.
public NamedSymbol getNamedSymbol(java.lang.String aName)
This function must be used to get hold of NamedSymbol
s with the
given name. For example:
NamedSymbol mySy = ns.getNamedSymbol("Foo");
will return a NamedSymbol that belongs to this NameSpace and has the name "Foo". If a NamedSymbol with the given name exists in this NameSpace, this very NamedSymbol will be returned. Otherwise this function will use the protected constructor to create the new NamedSymbol.
aName
- the name of the sought NamedSymbol (in this NameSpace)
public java.util.Collection<NamedSymbol> getAllSymbols()
This function can be used to retrieve all the NamedSymbol
s that
are currently defined in this NameSpace.
public final int hashCode()
This function returns a hash value for this NameSpace.
hashCode
in class java.lang.Object
public java.lang.String toString()
This function returns a String representation of this NameSpace, which is the same as the String representing its URI.
toString
in class java.lang.Object
public static NameSpace getNameSpace(java.net.URI uri)
This function must be used to obtain a new or the existing NameSpace that is associated with the given URI. Note: the given URI must not be null.
uri
- the URI that uniquely identifies the NameSpace
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |