org.sbml.jsbml.xml
public class XMLAttributes extends java.lang.Object
This class of objects is defined by jsbml 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.
Modifier and Type | Field and Description |
---|---|
(package private) java.util.ArrayList<XMLTriple> |
attributeNames |
(package private) java.util.ArrayList<java.lang.String> |
attributeValues |
Constructor and Description |
---|
XMLAttributes()
Creates a new empty
XMLAttributes set. |
XMLAttributes(XMLAttributes orig)
Copy constructor; creates a copy of this
XMLAttributes set. |
Modifier and Type | Method and Description |
---|---|
int |
add(java.lang.String name,
java.lang.String value)
Adds an attribute (a name/value pair) to this
XMLAttributes set optionally
with a prefix and URI defining a namespace. |
int |
add(java.lang.String name,
java.lang.String value,
java.lang.String namespaceURI)
Adds an attribute (a name/value pair) to this
XMLAttributes set optionally
with a prefix and URI defining a namespace. |
int |
add(java.lang.String name,
java.lang.String value,
java.lang.String namespaceURI,
java.lang.String prefix)
Adds an attribute (a name/value pair) to this
XMLAttributes set optionally
with a prefix and URI defining a namespace. |
int |
add(XMLTriple triple,
java.lang.String value)
Adds an attribute with the given
XMLTriple /value pair to this XMLAttributes set. |
int |
clear()
Clears (deletes) all attributes in this
XMLAttributes object. |
XMLAttributes |
clone()
Creates and returns a deep copy of this
XMLAttributes set. |
boolean |
equals(java.lang.Object sb)
Equality comparison method for XMLAttributes.
|
int |
getIndex(java.lang.String name)
Returns the index of an attribute with the given name.
|
int |
getIndex(java.lang.String name,
java.lang.String uri)
Returns the index of an attribute with the given local name and namespace URI.
|
int |
getIndex(XMLTriple triple)
Returns the index of an attribute with the given
XMLTriple . |
int |
getLength()
Returns the number of attributes in the set.
|
java.lang.String |
getName(int index)
Returns the local name of an attribute in this
XMLAttributes set (by position). |
java.lang.String |
getPrefix(int index)
Returns the prefix of an attribute in this
XMLAttributes set (by position). |
java.lang.String |
getPrefixedName(int index)
Returns the prefixed name of an attribute in this
XMLAttributes set (by position). |
java.lang.String |
getURI(int index)
Returns the namespace URI of an attribute in this
XMLAttributes set (by position). |
java.lang.String |
getValue(int index)
Returns the value of an attribute in this
XMLAttributes set (by position). |
java.lang.String |
getValue(java.lang.String name)
Returns an attribute's value by name.
|
java.lang.String |
getValue(java.lang.String name,
java.lang.String uri)
Returns a value of an attribute with the given local name and namespace URI.
|
java.lang.String |
getValue(XMLTriple triple)
Returns a value of an attribute with the given
XMLTriple . |
boolean |
hasAttribute(int index)
Returns
true or false depending on whether
an attribute with the given index exists in this XMLAttributes . |
boolean |
hasAttribute(java.lang.String name)
Returns
true or false depending on whether
an attribute with the given local name exists in this
XMLAttributes . |
boolean |
hasAttribute(java.lang.String name,
java.lang.String uri)
Returns
true or false depending on whether
an attribute with the given local name and namespace URI exists in this
XMLAttributes . |
boolean |
hasAttribute(XMLTriple triple)
Returns
true or false depending on whether
an attribute with the given XML triple exists in this XMLAttributes . |
int |
hashCode()
Returns a hashcode for this XMLAttributes object.
|
boolean |
isEmpty()
|
int |
remove(int n)
Removes an attribute with the given index from this
XMLAttributes set. |
int |
remove(java.lang.String name)
Removes an attribute with the given local name from
this
XMLAttributes set. |
int |
remove(java.lang.String name,
java.lang.String uri)
Removes an attribute with the given local name and namespace URI from
this
XMLAttributes set. |
int |
remove(XMLTriple triple)
Removes an attribute with the given
XMLTriple from this XMLAttributes set. |
int |
removeResource(int n)
Removes an attribute with the given index from this
XMLAttributes set. |
java.lang.String |
toString() |
java.util.ArrayList<XMLTriple> attributeNames
java.util.ArrayList<java.lang.String> attributeValues
public XMLAttributes()
XMLAttributes
set.public XMLAttributes(XMLAttributes orig)
XMLAttributes
set.public boolean equals(java.lang.Object sb)
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 XMLAttributes clone()
XMLAttributes
set.
clone
in class java.lang.Object
XMLAttributes
set.public int add(java.lang.String name, java.lang.String value, java.lang.String namespaceURI, java.lang.String prefix)
XMLAttributes
set optionally
with a prefix and URI defining a namespace.
name
- a string, the local name of the attribute.value
- a string, the value of the attribute.namespaceURI
- a string, the namespace URI of the attribute.prefix
- a string, the prefix of the namespace
public int add(java.lang.String name, java.lang.String value, java.lang.String namespaceURI)
XMLAttributes
set optionally
with a prefix and URI defining a namespace.
name
- a string, the local name of the attribute.value
- a string, the value of the attribute.namespaceURI
- a string, the namespace URI of the attribute.
public int add(java.lang.String name, java.lang.String value)
XMLAttributes
set optionally
with a prefix and URI defining a namespace.
name
- a string, the local name of the attribute.value
- a string, the value of the attribute.
public int add(XMLTriple triple, java.lang.String value)
XMLTriple
/value pair to this XMLAttributes
set.
triple
- an XMLTriple
, the XML triple of the attribute.value
- a string, the value of the attribute.
public int removeResource(int n)
XMLAttributes
set.
n
- an integer the index of the resource to be deletedpublic int remove(int n)
XMLAttributes
set.
(This function is an alias of XMLAttributes.removeResource() ).
n
- an integer the index of the resource to be deleted
public int remove(java.lang.String name, java.lang.String uri)
XMLAttributes
set.
name
- a string, the local name of the attribute.uri
- a string, the namespace URI of the attribute.
public int remove(java.lang.String name)
XMLAttributes
set.
name
- a string, the local name of the attribute.
public int remove(XMLTriple triple)
XMLTriple
from this XMLAttributes
set.
triple
- an XMLTriple
, the XML triple of the attribute.
public int clear()
XMLAttributes
object.
public int getIndex(java.lang.String name)
name
- a string, the local name of the attribute for which the
index is required.
public int getIndex(java.lang.String name, java.lang.String uri)
name
- a string, the local name of the attribute.uri
- a string, the namespace URI of the attribute.
public int getIndex(XMLTriple triple)
XMLTriple
.
public int getLength()
XMLAttributes
set.public java.lang.String getName(int index)
XMLAttributes
set (by position).
index
- an integer, the position of the attribute whose local name is
required.
public java.lang.String getPrefix(int index)
XMLAttributes
set (by position).
index
- an integer, the position of the attribute whose prefix is
required.
public java.lang.String getPrefixedName(int index)
XMLAttributes
set (by position).
index
- an integer, the position of the attribute whose prefixed
name is required.
public java.lang.String getURI(int index)
XMLAttributes
set (by position).
index
- an integer, the position of the attribute whose namespace URI is
required.
public java.lang.String getValue(int index)
XMLAttributes
set (by position).
index
- an integer, the position of the attribute whose value is
required.
public java.lang.String getValue(java.lang.String name)
name
- a string, the local name of the attribute whose value is required.
public java.lang.String getValue(java.lang.String name, java.lang.String uri)
name
- a string, the local name of the attribute whose value is required.uri
- a string, the namespace URI of the attribute.
public java.lang.String getValue(XMLTriple triple)
XMLTriple
.
triple
- an XMLTriple
, the XML triple of the attribute whose
value is required.
public boolean hasAttribute(int index)
true
or false
depending on whether
an attribute with the given index exists in this XMLAttributes
.
index
- an integer, the position of the attribute.
true
if an attribute with the given index exists in this
XMLAttributes
, false
otherwise.public boolean hasAttribute(java.lang.String name, java.lang.String uri)
true
or false
depending on whether
an attribute with the given local name and namespace URI exists in this
XMLAttributes
.
name
- a string, the local name of the attribute.uri
- a string, the namespace URI of the attribute.
true
if an attribute with the given local name and namespace
URI exists in this XMLAttributes
, false
otherwise.public boolean hasAttribute(java.lang.String name)
true
or false
depending on whether
an attribute with the given local name exists in this
XMLAttributes
.
name
- a string, the local name of the attribute.
true
if an attribute with the given local name
exists in this XMLAttributes
, false
otherwise.public boolean hasAttribute(XMLTriple triple)
true
or false
depending on whether
an attribute with the given XML triple exists in this XMLAttributes
.
triple
- an XMLTriple
, the XML triple of the attribute
true
if an attribute with the given XML triple exists in this
XMLAttributes
, false
otherwise.
public boolean isEmpty()
true
if this XMLAttributes
set is empty, false
otherwise.public java.lang.String toString()
toString
in class java.lang.Object