public class XMLTriple extends java.lang.Object
This class of objects is defined by libSBML only and has no direct equivalent in terms of SBML components. This class is not prescribed by the SBML specifications, although it is used to implement features defined in SBML.
A 'triple' in the libSBML XML layer encapsulates the notion of qualified
name, meaning an element name or an attribute name with an optional
namespace qualifier. Triples by themselves are not entities in an XML
stream&mdashthey are not, for example, elements or attributes rather,
XMLTriple
is used in libSBML to construct these other kinds of objects.
An XMLTriple
instance carries up to three data items:
mysim
and it appears on both the element
someelement
and the attribute attribA
. When
both the element and the attribute are stored as XMLTriple
objects,
their prefix is mysim
.
<mysim:someelement mysim:attribA='value' />
XMLTriple
objects are the lowest-level data item in the XML layer
of libSBML. Other objects such as XMLToken
make use of XMLTriple
objects.
XMLToken
,
XMLNode
,
XMLAttributes
,
XMLNamespaces
Constructor and Description |
---|
XMLTriple()
Creates a new, empty
XMLTriple object. |
XMLTriple(java.lang.String triplet)
Creates an
XMLTriple object by splitting a given string at a given
separator character. |
XMLTriple(java.lang.String triplet,
char sepchar)
Creates an
XMLTriple object by splitting a given string at a given
separator character. |
XMLTriple(java.lang.String name,
java.lang.String uri,
java.lang.String prefix)
|
XMLTriple(XMLTriple orig)
Copy constructor creates a copy of this
XMLTriple object. |
Modifier and Type | Method and Description |
---|---|
XMLTriple |
cloneObject()
Creates and returns a deep copy of this
XMLTriple object. |
void |
delete()
Explicitly deletes the underlying native object.
|
boolean |
equals(java.lang.Object sb)
Equality comparison method for XMLTriple.
|
java.lang.String |
getName()
Returns the name portion of this
XMLTriple object. |
java.lang.String |
getPrefix()
Returns the prefix portion of this
XMLTriple object. |
java.lang.String |
getPrefixedName()
Returns the prefixed name from this
XMLTriple . |
java.lang.String |
getURI()
Returns the URI portion of this
XMLTriple object. |
int |
hashCode()
Returns a hashcode for this XMLTriple object.
|
boolean |
isEmpty()
Returns
true if this XMLTriple object is empty. |
public XMLTriple(java.lang.String name, java.lang.String uri, java.lang.String prefix)
name
- a string, the name for the entity represented by this object.uri
- a string, the XML namespace URI associated with the prefix.prefix
- a string, the XML namespace prefix for this triple.public XMLTriple(java.lang.String triplet, char sepchar)
XMLTriple
object by splitting a given string at a given
separator character.
The 'triplet' in this case is a string that may be in one of the following three possible formats:
where x
represents the separator character, sepchar
.
triplet
- a string representing the triplet as shown above.sepchar
- a character, the sepchar used in the triplet.
public XMLTriple(java.lang.String triplet)
XMLTriple
object by splitting a given string at a given
separator character.
The 'triplet' in this case is a string that may be in one of the following three possible formats:
where x
represents the separator character, sepchar
.
triplet
- a string representing the triplet as shown above.sepchar
- a character, the sepchar used in the triplet.
public void delete()
In general, application software will not need to call this method directly. The Java language binding for libSBML is implemented as a language wrapper that provides a Java interface to libSBML's underlying C++/C code. Some of the Java methods return objects that are linked to objects created not by Java code, but by C++ code. The Java objects wrapped around them will be deleted when the garbage collector invokes the corresponding C++ finalize()
methods for the objects. The finalize()
methods in turn call the XMLTriple.delete()
method on the libSBML object.
This method is exposed in case calling programs want to ensure that the underlying object is freed immediately, and not at some arbitrary time determined by the Java garbage collector. In normal usage, callers do not need to invoke XMLTriple.delete()
themselves.
public boolean equals(java.lang.Object sb)
Because the Java methods for libSBML are actually wrappers around code
implemented in C++ and C, certain operations will not behave as
expected. Equality comparison is one such case. An instance of a
libSBML object class is actually a proxy object
wrapping the real underlying C/C++ object. The normal ==
equality operator in Java will only compare the Java proxy objects,
not the underlying native object. The result is almost never what you
want in practical situations. Unfortunately, Java does not provide a
way to override ==
.
The alternative that must be followed is to use the
equals()
method. The equals
method on this
class overrides the default java.lang.Object one, and performs an
intelligent comparison of instances of objects of this class. The
result is an assessment of whether two libSBML Java objects are truly
the same underlying native-code objects.
The use of this method in practice is the same as the use of any other
Java equals
method. For example,
a.equals(
b)
returns
true
if a and b are references to the
same underlying object.
equals
 in class java.lang.Object
sb
- a reference to an object to which the current object
instance will be comparedtrue
if sb
refers to the same underlying
native object as this one, false
otherwisepublic int hashCode()
hashCode
 in class java.lang.Object
public XMLTriple cloneObject()
XMLTriple
object.
XMLTriple
object.public java.lang.String getName()
XMLTriple
object.
XMLTriple
object.public java.lang.String getPrefix()
XMLTriple
object.
XMLTriple
object.public java.lang.String getURI()
XMLTriple
object.
XMLTriple
object.public java.lang.String getPrefixedName()
XMLTriple
.