public class Port extends SBaseRef
The Port
class was introduced by the SBML Level 3 Hierarchical Model Composition
(&ldquocomp&rdquo) package to allow a Model
to define a standard
interface between it and other models that might use it as a submodel. It
derives from the SBaseRef
class, and the elements defined there refer to
elements in the same parent Model
as the Port
object. A Port
object
instance therefore uses those attributes to define a port for a component
in a model. When other SBaseRef
or SBaseRef
-derived classes refer to a
Port
object using a 'portRef' attribute, the element being referenced is
the element the Port
object itself points to.
In the present formulation of the Hierarchical Model Composition package, the use of ports is not enforced, nor is there any mechanism to restrict which ports may be used in what ways&mdashthey are only an advisory construct. Future versions of this SBML package may provide additional functionality to support explicit restrictions on port use. For the present definition of Hierarchical Model Composition, users of models containing ports are encouraged to respect the modeler's intention in defining ports, and use the port definitions to interact with components through their ports (when they have ports defined) rather than interact directly with the components.
The required attribute 'id' is used to give an identifier to a
Port
object so that other objects can refer to it. The attribute has
type PortSId and is essentially identical to the SBML
primitive type SId, except that its namespace is limited to
the identifiers of Port
objects defined within a Model
object. In
parallel, the PortSId type has a companion type,
PortSIdRef, that corresponds to the SBML primitive type
SIdRef the value space of PortSIdRef is limited
to PortSId values.
Constructor and Description |
---|
Port()
Creates a new
Port with the given level, version, and package version. |
Port(CompPkgNamespaces compns)
Creates a new
Port with the given CompPkgNamespaces object. |
Port(long level)
Creates a new
Port with the given level, version, and package version. |
Port(long level,
long version)
Creates a new
Port with the given level, version, and package version. |
Port(long level,
long version,
long pkgVersion)
Creates a new
Port with the given level, version, and package version. |
Port(Port source)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
SBase |
cloneObject()
Creates and returns a deep copy of this
Port object. |
void |
delete()
Explicitly deletes the underlying native object.
|
java.lang.String |
getElementName()
Returns the XML element name of
this SBML object.
|
java.lang.String |
getId()
Returns the value of the 'id' attribute of this
Port . |
java.lang.String |
getName()
Returns the value of the 'name' attribute of this
Port . |
int |
getTypeCode()
Returns the libSBML type code of this object instance.
|
boolean |
hasRequiredAttributes()
Returns true if the 'id' attribute is set, and if exactly one of
the optional attributes of
SBaseRef (portRef, idRef, metaIdRef,
and unitRef)are set. |
boolean |
isSetId()
|
boolean |
isSetName()
|
void |
renameMetaIdRefs(java.lang.String oldid,
java.lang.String newid)
Replaces all uses of a given meta identifier attribute value with
another value.
|
void |
renameSIdRefs(java.lang.String oldid,
java.lang.String newid)
Replaces all uses of a given
SIdRef type attribute value with another
value. |
void |
renameUnitSIdRefs(java.lang.String oldid,
java.lang.String newid)
Replaces all uses of a given
UnitSIdRef type attribute value with
another value. |
int |
saveReferencedElement()
Finds and stores the referenced object by finding its
Model parent,
calling 'getReferencedElementFrom()' on that model, and storing the
result. |
int |
setId(java.lang.String id)
Sets the value of the 'id' attribute of this
Port . |
int |
setName(java.lang.String name)
Sets the value of the 'name' attribute of this
Port . |
int |
setPortRef(java.lang.String id)
Overrides SBaseRef.setPortRef to always fail, because
Port objects
themselves cannot refer to model elements by PortSId. |
int |
unsetId()
Unsets the value of the 'id' attribute of this
Port . |
int |
unsetName()
Unsets the value of the 'name' attribute of this
Port . |
clearReferencedElement, connectToChild, createSBaseRef, getElementByMetaId, getElementBySId, getIdRef, getMetaIdRef, getNumReferents, getPortRef, getReferencedElement, getReferencedElementFrom, getSBaseRef, getUnitRef, isSetIdRef, isSetMetaIdRef, isSetPortRef, isSetSBaseRef, isSetUnitRef, performDeletion, removeFromParentAndDelete, setIdRef, setMetaIdRef, setSBaseRef, setUnitRef, unsetIdRef, unsetMetaIdRef, unsetPortRef, unsetSBaseRef, unsetUnitRef
addCVTerm, addCVTerm, appendAnnotation, appendAnnotation, appendNotes, appendNotes, deleteDisabledPlugins, deleteDisabledPlugins, disablePackage, enablePackage, equals, getAncestorOfType, getAncestorOfType, getAnnotation, getAnnotationString, getColumn, getCVTerm, getCVTerms, getDisabledPlugin, 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, getURI, getVersion, hashCode, hasValidLevelVersionNamespaceCombination, isPackageEnabled, isPackageURIEnabled, isPkgEnabled, isPkgURIEnabled, isSetAnnotation, isSetMetaId, isSetModelHistory, isSetNotes, isSetSBOTerm, isSetUserData, matchesRequiredSBMLNamespacesForAddition, matchesSBMLNamespaces, removeTopLevelAnnotationElement, removeTopLevelAnnotationElement, removeTopLevelAnnotationElement, replaceTopLevelAnnotationElement, replaceTopLevelAnnotationElement, setAnnotation, setAnnotation, setMetaId, setModelHistory, setNamespaces, setNotes, setNotes, setNotes, setSBOTerm, setSBOTerm, toSBML, toXMLNode, unsetAnnotation, unsetCVTerms, unsetMetaId, unsetModelHistory, unsetNotes, unsetSBOTerm, unsetUserData
public Port(long level, long version, long pkgVersion) throws SBMLConstructorException
Port
with the given level, version, and package version.
level
- the SBML Levelversion
- the Version within the SBML LevelpkgVersion
- the version of the packageSBMLConstructorException
public Port(long level, long version) throws SBMLConstructorException
Port
with the given level, version, and package version.
level
- the SBML Levelversion
- the Version within the SBML LevelpkgVersion
- the version of the packageSBMLConstructorException
public Port(long level) throws SBMLConstructorException
Port
with the given level, version, and package version.
level
- the SBML Levelversion
- the Version within the SBML LevelpkgVersion
- the version of the packageSBMLConstructorException
public Port() throws SBMLConstructorException
Port
with the given level, version, and package version.
level
- the SBML Levelversion
- the Version within the SBML LevelpkgVersion
- the version of the packageSBMLConstructorException
public Port(CompPkgNamespaces compns) throws SBMLConstructorException
Port
with the given CompPkgNamespaces
object.
compns
- the namespace to useSBMLConstructorException
public Port(Port source) throws SBMLConstructorException
SBMLConstructorException
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 Port.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 Port.delete()
themselves.
public SBase cloneObject()
Port
object.
cloneObject
 in class SBaseRef
Port
objectpublic boolean isSetId()
public int setId(java.lang.String id)
Port
.
This method fails if the id
is not a valid syntax for an SId.
public int unsetId()
Port
.
public java.lang.String getName()
Port
.
public boolean isSetName()
public int setName(java.lang.String name)
Port
.
public int unsetName()
Port
.
public int setPortRef(java.lang.String id)
Port
objects
themselves cannot refer to model elements by PortSId.
setPortRef
 in class SBaseRef
id
- the identifier to set for the port reference
public boolean hasRequiredAttributes()
SBaseRef
(portRef, idRef, metaIdRef,
and unitRef)are set.
hasRequiredAttributes
 in class SBaseRef
public java.lang.String getElementName()
getElementName
 in class SBaseRef
public int getTypeCode()
LibSBML attaches an identifying code to every kind of SBML object. These
are integer constants known as SBML type codes. The names of all
the codes begin with the characters SBML_
.
In the Java language interface for libSBML, the
type codes are defined as static integer constants in the interface class
libsbmlConstants
. Note that different Level 3
package plug-ins may use overlapping type codes to identify the package
to which a given object belongs, call the getPackageName()
method on the object.
getTypeCode
 in class SBaseRef
SBML_COMP_PORT
Port.getElementName()
,
CompBase.getPackageName()
public int saveReferencedElement()
Model
parent,
calling 'getReferencedElementFrom()' on that model, and storing the
result.
saveReferencedElement
 in class SBaseRef
public void renameSIdRefs(java.lang.String oldid, java.lang.String newid)
Replaces all uses of a given SIdRef
type attribute value with another
value.
In SBML, object identifiers are of a data type called SId
.
In SBML Level 3, an explicit data type called SIdRef
was
introduced for attribute values that refer to SId
values in
previous Levels of SBML, this data type did not exist and attributes were
simply described to as 'referring to an identifier', but the effective
data type was the same as SIdRef
in Level 3. These and
other methods of libSBML refer to the type SIdRef
for all
Levels of SBML, even if the corresponding SBML specification did not
explicitly name the data type.
This method works by looking at all attributes and (if appropriate)
mathematical formulas in MathML content, comparing the referenced
identifiers to the value of oldid
. If any matches are found, the
matching values are replaced with newid
. The method does not
descend into child elements.
renameSIdRefs
 in class SBaseRef
oldid
- the old identifiernewid
- the new identifierpublic void renameUnitSIdRefs(java.lang.String oldid, java.lang.String newid)
Replaces all uses of a given UnitSIdRef
type attribute value with
another value.
In SBML, unit definitions have identifiers of type UnitSId
. In
SBML Level 3, an explicit data type called UnitSIdRef
was
introduced for attribute values that refer to UnitSId
values in
previous Levels of SBML, this data type did not exist and attributes were
simply described to as 'referring to a unit identifier', but the effective
data type was the same as UnitSIdRef
in Level 3. These and
other methods of libSBML refer to the type UnitSIdRef
for all
Levels of SBML, even if the corresponding SBML specification did not
explicitly name the data type.
This method works by looking at all unit identifier attribute values
(including, if appropriate, inside mathematical formulas), comparing the
referenced unit identifiers to the value of oldid
. If any matches
are found, the matching values are replaced with newid
. The method
does not descend into child elements.
renameUnitSIdRefs
 in class SBase
oldid
- the old identifiernewid
- the new identifierpublic void renameMetaIdRefs(java.lang.String oldid, java.lang.String newid)
Replaces all uses of a given meta identifier attribute value with another value.
In SBML, object 'meta' identifiers are of the XML data type ID
the SBML object attribute itself is typically named metaid
. All
attributes that hold values referring to values of type
ID
are of the XML data type IDREF
. They are also
sometimes informally referred to as 'metaid refs', in analogy to the
SBML-defined type SIdRef
.
This method works by looking at all meta-identifier attribute values,
comparing the identifiers to the value of oldid
. If any matches are
found, the matching identifiers are replaced with newid
. The method
does not descend into child elements.
renameMetaIdRefs
 in class SBase
oldid
- the old identifiernewid
- the new identifier