public class GradientBase extends SBase
The base class implements common structures to both gradient classes. Both gradients have an id attribute which is used to reference a gradient within other render extension constructs. The id of a gradient can be used to define the fill style of 2D objects like e.g. rectangles.
Further both gradient classes have a ListOfGradientStop objects which holds
the GradientStop objects that define the gradient and bothe classes have an
attribute called spreadMethod which defines how a gradient is applied to an
object.
| Modifier and Type | Field and Description |
|---|---|
static int |
INVALID  |
static int |
PAD  |
static int |
REFLECT  |
static int |
REPEAT  |
| Modifier and Type | Method and Description |
|---|---|
int |
addGradientStop(GradientStop pStop)
Adds a copy of the given
GradientStop object to the end
of the list of gradient stops. |
SBase |
cloneObject()
Creates and returns a deep copy of this
SBase object. |
void |
connectToChild()  |
GradientStop |
createGradientStop()
Creates a new
GradientStop. |
void |
delete()
Explicitly deletes the underlying native object.
|
java.lang.String |
getElementName()
Returns the XML element name of this object.
|
GradientStop |
getGradientStop(long i)
Returns a pointer to the gradient stop with the given index or null
if the index is invalid.
|
java.lang.String |
getId()
Returns the value of the 'id' attribute of this SBML object, if it has one,
or the 'variable' attribute of a
Rule, or the 'symbol' attribute of
an InitialAssignment. |
ListOfGradientStops |
getListOfGradientStops()
Returns a pointer to the gradient stop vector.
|
java.lang.String |
getName()
Returns the value of the 'name' attribute of this SBML object.
|
long |
getNumGradientStops()
Returns the number of gradient stops.
|
int |
getSpreadMethod()
Returns the spreadmethod of the gradient.
|
boolean |
isSetId()
Predicate returning
true if a call to getId() returns a
non-empty string. |
boolean |
isSetName()
Predicate returning
true if this
object's 'name' attribute is set. |
int |
setId(java.lang.String id)
Sets the value of the 'id' attribute of this SBML object.
|
int |
setName(java.lang.String name)
Sets the value of the 'name' attribute of this SBML object.
|
void |
setSpreadMethod(int method)
Sets the spread method.
|
XMLNode |
toXML()
|
int |
unsetId()
Unsets the value of the 'id' attribute of this SBML object.
|
int |
unsetName()
Unsets the value of the 'name' attribute of this SBML object.
|
addCVTerm, addCVTerm, appendAnnotation, appendAnnotation, appendNotes, appendNotes, deleteDisabledPlugins, deleteDisabledPlugins, disablePackage, enablePackage, equals, getAncestorOfType, getAncestorOfType, getAnnotation, getAnnotationString, getColumn, getCVTerm, getCVTerms, getDisabledPlugin, getElementByMetaId, getElementBySId, getIdAttribute, getLevel, getLine, getListOfAllElements, getListOfAllElements, getListOfAllElementsFromPlugins, getListOfAllElementsFromPlugins, getMetaId, getModel, getModelHistory, getNamespaces, getNotes, getNotesString, getNumCVTerms, getNumDisabledPlugins, getNumPlugins, getPackageCoreVersion, getPackageName, getPackageVersion, getParentSBMLObject, getPlugin, getPlugin, getPrefix, getResourceBiologicalQualifier, getResourceModelQualifier, getSBMLDocument, getSBOTerm, getSBOTermAsURL, getSBOTermID, getTypeCode, getURI, getVersion, hashCode, hasValidLevelVersionNamespaceCombination, isPackageEnabled, isPackageURIEnabled, isPkgEnabled, isPkgURIEnabled, isSetAnnotation, isSetIdAttribute, isSetMetaId, isSetModelHistory, isSetNotes, isSetSBOTerm, isSetUserData, matchesRequiredSBMLNamespacesForAddition, matchesSBMLNamespaces, removeFromParentAndDelete, removeTopLevelAnnotationElement, removeTopLevelAnnotationElement, removeTopLevelAnnotationElement, renameMetaIdRefs, renameSIdRefs, renameUnitSIdRefs, replaceTopLevelAnnotationElement, replaceTopLevelAnnotationElement, setAnnotation, setAnnotation, setIdAttribute, setMetaId, setModelHistory, setNamespaces, setNotes, setNotes, setNotes, setSBOTerm, setSBOTerm, toSBML, toXMLNode, unsetAnnotation, unsetCVTerms, unsetIdAttribute, unsetMetaId, unsetModelHistory, unsetNotes, unsetSBOTerm, unsetUserDatapublic static final int PAD
public static final int REFLECT
public static final int REPEAT
public static final int INVALID
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 GradientBase.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 GradientBase.delete() themselves.
public int getSpreadMethod()
public void setSpreadMethod(int method)
method - The new spread method for the gradient.public long getNumGradientStops()
public ListOfGradientStops getListOfGradientStops()
ListOfGradientStops object
for the gradient.public GradientStop getGradientStop(long i)
i - index of the gradient stop to be returned. The index has to be between 0 and
getNumGradientStops() - 1.
public GradientStop createGradientStop()
GradientStop. The new GradientStop object is automatically
added to the gradient and the gradient own the object-
GradientStop.public int addGradientStop(GradientStop pStop)
GradientStop object to the end
of the list of gradient stops.
pStop - a pointer to the new gradient stop
GradientBase.createGradientStop()GradientBase. Changes made to the original object
instance (such as resetting attribute values) will not affect the
instance in the GradientBase. In addition, the caller should make
sure to free the original object if it is no longer being used, or
else a memory leak will result. Please see GradientBase.createGradientStop()
for a method that does not lead to these issues.
public SBase cloneObject()
SBase object.
cloneObject in class SBaseSBase object.public java.lang.String getElementName()
This is overridden by subclasses to return a string appropriate to the
SBML component. For example, Model defines it as returning
'model', CompartmentType defines it as returning 'compartmentType',
and so on.
getElementName in class SBasepublic void connectToChild()
connectToChild in class SBasepublic java.lang.String getId()
Rule, or the 'symbol' attribute of
an InitialAssignment.
getId in class SBaseRule, or the 'symbol' if the object is an InitialAssignment.
SBase.getIdAttribute(),
SBase.setIdAttribute(String sid),
SBase.isSetIdAttribute(),
SBase.unsetIdAttribute()
The identifier given by an object's 'id' attribute value
is used to identify the object within the SBML model definition.
Other objects can refer to the component using this identifier. The
data type of 'id' is always SId or a type derived
from that, such as UnitSId, depending on the object in
question. All data types are defined as follows:
letter .= 'a'..'z','A'..'Z' digit .= '0'..'9' idChar .= letter | digit | '_' SId .= ( letter | '_' ) idChar*
The characters ( and ) are used for grouping, the
character * 'zero or more times', and the character
| indicates logical 'or'. The equality of SBML identifiers is
determined by an exact character sequence match i.e., comparisons must be
performed in a case-sensitive manner. This applies to all uses of SId,
SIdRef, and derived types.
In SBML Level 3 Version 2, the 'id' and 'name' attributes were
moved to SBase directly, instead of being defined individually for many
(but not all) objects. Libsbml has for a long time provided functions
defined on SBase itself to get, set, check, and unset those attributes, which
would fail or otherwise return empty strings if executed on any object
for which those attributes were not defined. Now that all SBase objects
define those attributes, those functions now succeed for any object with
the appropriate level and version.
The exception to this rule is that for InitialAssignment, EventAssignment,
AssignmentRule, and RateRule objects, the getId() function and the isSetId()
functions (though not the setId() or unsetId() functions) would instead
reference the value of the 'variable' attribute (for the rules and event
assignments) or the 'symbol' attribute (for initial assignments).
The AlgebraicRule fell into this category as well, though because it
contained neither a 'variable' nor a 'symbol' attribute, getId() would
always return an empty string, and isSetId() would always return false.
For this reason, four new functions are now provided
(getIdAttribute(), setIdAttribute(String),
isSetIdAttribute(), and unsetIdAttribute()) that will always
act on the actual 'id' attribute, regardless of the object's type. The
new functions should be used instead of the old ones unless the old behavior
is somehow necessary.
Regardless of the level and version of the SBML, these functions allow client applications to use more generalized code in some situations (for instance, when manipulating objects that are all known to have identifiers). If the object in question does not posess an 'id' attribute according to the SBML specification for the Level and Version in use, libSBML will not allow the identifier to be set, nor will it read or write 'id' attributes for those objects.
public boolean isSetId()
true if a call to getId() returns a
non-empty string. This means that for most objects, this
function will return true if its 'id' attribute is set, and
false if it is not, or if the object has no 'id' attribute
at all. However, for an EventAssignment or a Rule, isSetId()
checks whether the 'variable' attribute is set, and for an
InitialAssignment, it checks whether the 'symbol' attribute
is set. Because those elements will also have an 'id'
attribute in SBML Level 3 Version 2 which isSetId()
will not check, the function itself is deprecated, and it
is recommended to use isSetIdAttribute() in all cases where
one needs to know whether the 'id' attribute is set, and
to use EventAssignment.isSetVariable(), Rule.isSetVariable()
and InitialAssignment.isSetSymbol() when the status of the
'variable' or 'symbol' attributes need to be checked.
isSetId in class SBasetrue if the 'id' attribute of this SBML object is
set, false otherwise.
SBase.getIdAttribute(),
SBase.setIdAttribute(String sid),
SBase.unsetIdAttribute(),
SBase.isSetIdAttribute()
The identifier given by an object's 'id' attribute value
is used to identify the object within the SBML model definition.
Other objects can refer to the component using this identifier. The
data type of 'id' is always SId or a type derived
from that, such as UnitSId, depending on the object in
question. All data types are defined as follows:
letter .= 'a'..'z','A'..'Z' digit .= '0'..'9' idChar .= letter | digit | '_' SId .= ( letter | '_' ) idChar*
The characters ( and ) are used for grouping, the
character * 'zero or more times', and the character
| indicates logical 'or'. The equality of SBML identifiers is
determined by an exact character sequence match i.e., comparisons must be
performed in a case-sensitive manner. This applies to all uses of SId,
SIdRef, and derived types.
In SBML Level 3 Version 2, the 'id' and 'name' attributes were
moved to SBase directly, instead of being defined individually for many
(but not all) objects. Libsbml has for a long time provided functions
defined on SBase itself to get, set, check, and unset those attributes, which
would fail or otherwise return empty strings if executed on any object
for which those attributes were not defined. Now that all SBase objects
define those attributes, those functions now succeed for any object with
the appropriate level and version.
The exception to this rule is that for InitialAssignment, EventAssignment,
AssignmentRule, and RateRule objects, the getId() function and the isSetId()
functions (though not the setId() or unsetId() functions) would instead
reference the value of the 'variable' attribute (for the rules and event
assignments) or the 'symbol' attribute (for initial assignments).
The AlgebraicRule fell into this category as well, though because it
contained neither a 'variable' nor a 'symbol' attribute, getId() would
always return an empty string, and isSetId() would always return false.
For this reason, four new functions are now provided
(getIdAttribute(), setIdAttribute(String),
isSetIdAttribute(), and unsetIdAttribute()) that will always
act on the actual 'id' attribute, regardless of the object's type. The
new functions should be used instead of the old ones unless the old behavior
is somehow necessary.
Regardless of the level and version of the SBML, these functions allow client applications to use more generalized code in some situations (for instance, when manipulating objects that are all known to have identifiers). If the object in question does not posess an 'id' attribute according to the SBML specification for the Level and Version in use, libSBML will not allow the identifier to be set, nor will it read or write 'id' attributes for those objects.
public int setId(java.lang.String id)
The string sid is copied.
The identifier given by an object's 'id' attribute value
is used to identify the object within the SBML model definition.
Other objects can refer to the component using this identifier. The
data type of 'id' is always SId or a type derived
from that, such as UnitSId, depending on the object in
question. All data types are defined as follows:
letter .= 'a'..'z','A'..'Z' digit .= '0'..'9' idChar .= letter | digit | '_' SId .= ( letter | '_' ) idChar*
The characters ( and ) are used for grouping, the
character * 'zero or more times', and the character
| indicates logical 'or'. The equality of SBML identifiers is
determined by an exact character sequence match i.e., comparisons must be
performed in a case-sensitive manner. This applies to all uses of SId,
SIdRef, and derived types.
In SBML Level 3 Version 2, the 'id' and 'name' attributes were
moved to SBase directly, instead of being defined individually for many
(but not all) objects. Libsbml has for a long time provided functions
defined on SBase itself to get, set, check, and unset those attributes, which
would fail or otherwise return empty strings if executed on any object
for which those attributes were not defined. Now that all SBase objects
define those attributes, those functions now succeed for any object with
the appropriate level and version.
The exception to this rule is that for InitialAssignment, EventAssignment,
AssignmentRule, and RateRule objects, the getId() function and the isSetId()
functions (though not the setId() or unsetId() functions) would instead
reference the value of the 'variable' attribute (for the rules and event
assignments) or the 'symbol' attribute (for initial assignments).
The AlgebraicRule fell into this category as well, though because it
contained neither a 'variable' nor a 'symbol' attribute, getId() would
always return an empty string, and isSetId() would always return false.
For this reason, four new functions are now provided
(getIdAttribute(), setIdAttribute(String),
isSetIdAttribute(), and unsetIdAttribute()) that will always
act on the actual 'id' attribute, regardless of the object's type. The
new functions should be used instead of the old ones unless the old behavior
is somehow necessary.
Regardless of the level and version of the SBML, these functions allow client applications to use more generalized code in some situations (for instance, when manipulating objects that are all known to have identifiers). If the object in question does not posess an 'id' attribute according to the SBML specification for the Level and Version in use, libSBML will not allow the identifier to be set, nor will it read or write 'id' attributes for those objects.
setId in class SBasesid - the string to use as the identifier of this object.
SBase.getIdAttribute(),
SBase.setIdAttribute(String sid),
SBase.isSetIdAttribute(),
SBase.unsetIdAttribute()public int unsetId()
The identifier given by an object's 'id' attribute value
is used to identify the object within the SBML model definition.
Other objects can refer to the component using this identifier. The
data type of 'id' is always SId or a type derived
from that, such as UnitSId, depending on the object in
question. All data types are defined as follows:
letter .= 'a'..'z','A'..'Z' digit .= '0'..'9' idChar .= letter | digit | '_' SId .= ( letter | '_' ) idChar*
The characters ( and ) are used for grouping, the
character * 'zero or more times', and the character
| indicates logical 'or'. The equality of SBML identifiers is
determined by an exact character sequence match i.e., comparisons must be
performed in a case-sensitive manner. This applies to all uses of SId,
SIdRef, and derived types.
In SBML Level 3 Version 2, the 'id' and 'name' attributes were
moved to SBase directly, instead of being defined individually for many
(but not all) objects. Libsbml has for a long time provided functions
defined on SBase itself to get, set, check, and unset those attributes, which
would fail or otherwise return empty strings if executed on any object
for which those attributes were not defined. Now that all SBase objects
define those attributes, those functions now succeed for any object with
the appropriate level and version.
The exception to this rule is that for InitialAssignment, EventAssignment,
AssignmentRule, and RateRule objects, the getId() function and the isSetId()
functions (though not the setId() or unsetId() functions) would instead
reference the value of the 'variable' attribute (for the rules and event
assignments) or the 'symbol' attribute (for initial assignments).
The AlgebraicRule fell into this category as well, though because it
contained neither a 'variable' nor a 'symbol' attribute, getId() would
always return an empty string, and isSetId() would always return false.
For this reason, four new functions are now provided
(getIdAttribute(), setIdAttribute(String),
isSetIdAttribute(), and unsetIdAttribute()) that will always
act on the actual 'id' attribute, regardless of the object's type. The
new functions should be used instead of the old ones unless the old behavior
is somehow necessary.
Regardless of the level and version of the SBML, these functions allow client applications to use more generalized code in some situations (for instance, when manipulating objects that are all known to have identifiers). If the object in question does not posess an 'id' attribute according to the SBML specification for the Level and Version in use, libSBML will not allow the identifier to be set, nor will it read or write 'id' attributes for those objects.
unsetId in class SBaseSBase.getIdAttribute(),
SBase.setIdAttribute(String sid),
SBase.isSetIdAttribute(),
SBase.unsetIdAttribute()public java.lang.String getName()
In SBML Level 3 Version 2, the 'id' and 'name' attributes were
moved to SBase directly, instead of being defined individually for many
(but not all) objects. Libsbml has for a long time provided functions
defined on SBase itself to get, set, and unset those attributes, which
would fail or otherwise return empty strings if executed on any object
for which those attributes were not defined. Now that all SBase objects
define those attributes, those functions now succeed for any object with
the appropriate level and version.
The 'name' attribute is
optional and is not intended to be used for cross-referencing purposes
within a model. Its purpose instead is to provide a human-readable
label for the component. The data type of 'name' is the type
string defined in XML Schema. SBML imposes no
restrictions as to the content of 'name' attributes beyond those
restrictions defined by the string type in XML Schema.
The recommended practice for handling 'name' is as follows. If a software tool has the capability for displaying the content of 'name' attributes, it should display this content to the user as a component's label instead of the component's 'id'. If the user interface does not have this capability (e.g., because it cannot display or use special characters in symbol names), or if the 'name' attribute is missing on a given component, then the user interface should display the value of the 'id' attribute instead. (Script language interpreters are especially likely to display 'id' instead of 'name'.)
As a consequence of the above, authors of systems that automatically generate the values of 'id' attributes should be aware some systems may display the 'id''s to the user. Authors therefore may wish to take some care to have their software create 'id' values that are: (a) reasonably easy for humans to type and read and (b) likely to be meaningful, for example by making the 'id' attribute be an abbreviated form of the name attribute value.
An additional point worth mentioning is although there are restrictions on the uniqueness of 'id' values, there are no restrictions on the uniqueness of 'name' values in a model. This allows software applications leeway in assigning component identifiers.
Regardless of the level and version of the SBML, these functions allow client applications to use more generalized code in some situations (for instance, when manipulating objects that are all known to have names). If the object in question does not posess a 'name' attribute according to the SBML specification for the Level and Version in use, libSBML will not allow the name to be set, nor will it read or write 'name' attributes for those objects.
getName in class SBaseSBase.getIdAttribute(),
GradientBase.isSetName(),
GradientBase.setName(String sid),
GradientBase.unsetName()public boolean isSetName()
true if this
object's 'name' attribute is set.
In SBML Level 3 Version 2, the 'id' and 'name' attributes were
moved to SBase directly, instead of being defined individually for many
(but not all) objects. Libsbml has for a long time provided functions
defined on SBase itself to get, set, and unset those attributes, which
would fail or otherwise return empty strings if executed on any object
for which those attributes were not defined. Now that all SBase objects
define those attributes, those functions now succeed for any object with
the appropriate level and version.
The 'name' attribute is
optional and is not intended to be used for cross-referencing purposes
within a model. Its purpose instead is to provide a human-readable
label for the component. The data type of 'name' is the type
string defined in XML Schema. SBML imposes no
restrictions as to the content of 'name' attributes beyond those
restrictions defined by the string type in XML Schema.
The recommended practice for handling 'name' is as follows. If a software tool has the capability for displaying the content of 'name' attributes, it should display this content to the user as a component's label instead of the component's 'id'. If the user interface does not have this capability (e.g., because it cannot display or use special characters in symbol names), or if the 'name' attribute is missing on a given component, then the user interface should display the value of the 'id' attribute instead. (Script language interpreters are especially likely to display 'id' instead of 'name'.)
As a consequence of the above, authors of systems that automatically generate the values of 'id' attributes should be aware some systems may display the 'id''s to the user. Authors therefore may wish to take some care to have their software create 'id' values that are: (a) reasonably easy for humans to type and read and (b) likely to be meaningful, for example by making the 'id' attribute be an abbreviated form of the name attribute value.
An additional point worth mentioning is although there are restrictions on the uniqueness of 'id' values, there are no restrictions on the uniqueness of 'name' values in a model. This allows software applications leeway in assigning component identifiers.
Regardless of the level and version of the SBML, these functions allow client applications to use more generalized code in some situations (for instance, when manipulating objects that are all known to have names). If the object in question does not posess a 'name' attribute according to the SBML specification for the Level and Version in use, libSBML will not allow the name to be set, nor will it read or write 'name' attributes for those objects.
isSetName in class SBasetrue if the 'name' attribute of this SBML object is
set, false otherwise.
GradientBase.getName(),
GradientBase.setName(String sid),
GradientBase.unsetName()public int setName(java.lang.String name)
The string in name is copied.
public int unsetName()
In SBML Level 3 Version 2, the 'id' and 'name' attributes were
moved to SBase directly, instead of being defined individually for many
(but not all) objects. Libsbml has for a long time provided functions
defined on SBase itself to get, set, and unset those attributes, which
would fail or otherwise return empty strings if executed on any object
for which those attributes were not defined. Now that all SBase objects
define those attributes, those functions now succeed for any object with
the appropriate level and version.
The 'name' attribute is
optional and is not intended to be used for cross-referencing purposes
within a model. Its purpose instead is to provide a human-readable
label for the component. The data type of 'name' is the type
string defined in XML Schema. SBML imposes no
restrictions as to the content of 'name' attributes beyond those
restrictions defined by the string type in XML Schema.
The recommended practice for handling 'name' is as follows. If a software tool has the capability for displaying the content of 'name' attributes, it should display this content to the user as a component's label instead of the component's 'id'. If the user interface does not have this capability (e.g., because it cannot display or use special characters in symbol names), or if the 'name' attribute is missing on a given component, then the user interface should display the value of the 'id' attribute instead. (Script language interpreters are especially likely to display 'id' instead of 'name'.)
As a consequence of the above, authors of systems that automatically generate the values of 'id' attributes should be aware some systems may display the 'id''s to the user. Authors therefore may wish to take some care to have their software create 'id' values that are: (a) reasonably easy for humans to type and read and (b) likely to be meaningful, for example by making the 'id' attribute be an abbreviated form of the name attribute value.
An additional point worth mentioning is although there are restrictions on the uniqueness of 'id' values, there are no restrictions on the uniqueness of 'name' values in a model. This allows software applications leeway in assigning component identifiers.
Regardless of the level and version of the SBML, these functions allow client applications to use more generalized code in some situations (for instance, when manipulating objects that are all known to have names). If the object in question does not posess a 'name' attribute according to the SBML specification for the Level and Version in use, libSBML will not allow the name to be set, nor will it read or write 'name' attributes for those objects.
unsetName in class SBaseGradientBase.getName(),
GradientBase.setName(String sid),
GradientBase.isSetName()