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 |
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.
|
ListOfGradientStops |
getListOfGradientStops()
Returns a pointer to the gradient stop vector.
|
long |
getNumGradientStops()
Returns the number of gradient stops.
|
int |
getSpreadMethod()
Returns the spreadmethod of the gradient.
|
void |
setSpreadMethod(int method)
Sets the spread method.
|
XMLNode |
toXML()
|
int |
unsetId()
Unsets the value of the 'id' 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, getLevel, getLine, getListOfAllElements, getListOfAllElements, getListOfAllElementsFromPlugins, getListOfAllElementsFromPlugins, getMetaId, getModel, getModelHistory, getNamespaces, getNotes, getNotesString, getNumCVTerms, getNumDisabledPlugins, getNumPlugins, getPackageName, getPackageVersion, getParentSBMLObject, getPlugin, getPlugin, getPrefix, getResourceBiologicalQualifier, getResourceModelQualifier, getSBMLDocument, getSBOTerm, getSBOTermAsURL, getSBOTermID, getTypeCode, getURI, getVersion, hashCode, hasValidLevelVersionNamespaceCombination, isPackageEnabled, isPackageURIEnabled, isPkgEnabled, isPkgURIEnabled, isSetAnnotation, isSetMetaId, isSetModelHistory, isSetNotes, isSetSBOTerm, isSetUserData, matchesRequiredSBMLNamespacesForAddition, matchesSBMLNamespaces, removeFromParentAndDelete, removeTopLevelAnnotationElement, removeTopLevelAnnotationElement, removeTopLevelAnnotationElement, renameMetaIdRefs, renameSIdRefs, renameUnitSIdRefs, replaceTopLevelAnnotationElement, replaceTopLevelAnnotationElement, setAnnotation, setAnnotation, setMetaId, setModelHistory, setNamespaces, setNotes, setNotes, setNotes, setSBOTerm, setSBOTerm, toSBML, toXMLNode, unsetAnnotation, unsetCVTerms, unsetMetaId, unsetModelHistory, unsetName, unsetNotes, unsetSBOTerm, unsetUserData
public static final int PAD
public static final int REFLECT
public static final int REPEAT
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 SBase
SBase
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 SBase
public void connectToChild()
connectToChild
 in class SBase
public int unsetId()
Most (but not all) objects in SBML include two common attributes: 'id' and 'name'. 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.