Package org.pathvisio.libgpml.model
Class PathwayElement
java.lang.Object
org.pathvisio.libgpml.model.PathwayObject
org.pathvisio.libgpml.model.PathwayElement
- All Implemented Interfaces:
java.lang.Cloneable
,Referenceable
,Referenceable.Annotatable
,Referenceable.Citable
,Referenceable.Evidenceable
- Direct Known Subclasses:
LineElement
,Pathway
,ShapedElement
public abstract class PathwayElement extends PathwayObject implements java.lang.Cloneable, Referenceable.Annotatable, Referenceable.Citable, Referenceable.Evidenceable
Abstract class of pathway elements which are part of a pathway, have an
elementId, have Comment,
Children: DataNode, State, Interaction, GraphicalLine, Label, Shape, Group.
- Author:
- unknown, AP20070508, finterly
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
PathwayElement.AnnotationRef
This class stores information for an AnnotationRef with sourceAnnotation
, targetReferenceable.Annotatable
, and a list ofPathwayElement.CitationRef
and/orPathwayElement.EvidenceRef
.class
PathwayElement.CitationRef
This class stores information for a CitationRef with sourceCitation
, targetReferenceable.Citable
, and a list ofPathwayElement.AnnotationRef
.class
PathwayElement.Comment
This class stores all information relevant to a Comment.class
PathwayElement.EvidenceRef
This class stores information for a EvidenceRef which references anEvidence
.class
PathwayElement.InfoRef
Abstract class ofPathwayElement.AnnotationRef
,PathwayElement.CitationRef
, andPathwayElement.EvidenceRef
.Nested classes/interfaces inherited from interface org.pathvisio.libgpml.model.Referenceable
Referenceable.Annotatable, Referenceable.Citable, Referenceable.Evidenceable
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<PathwayElement.AnnotationRef>
annotationRefs
private java.util.List<PathwayElement.CitationRef>
citationRefs
private java.util.List<PathwayElement.Comment>
comments
private java.util.Map<java.lang.String,java.lang.String>
dynamicProperties
Map for storing dynamic properties.private java.util.List<PathwayElement.EvidenceRef>
evidenceRefs
Fields inherited from class org.pathvisio.libgpml.model.PathwayObject
noFire, pathwayModel
-
Constructor Summary
Constructors Constructor Description PathwayElement()
Instantiates a pathway element with meta data information. -
Method Summary
Modifier and Type Method Description PathwayElement.AnnotationRef
addAnnotation(java.lang.String elementId, java.lang.String value, AnnotationType type, org.bridgedb.Xref xref, java.lang.String urlLink)
Creates a annotation with given properties, and adds annotation to pathway model.PathwayElement.AnnotationRef
addAnnotation(java.lang.String value, AnnotationType type, org.bridgedb.Xref xref, java.lang.String urlLink)
Creates a annotation with given properties, and adds annotation to pathway model.PathwayElement.AnnotationRef
addAnnotation(Annotation annotation)
Creates and adds an annotationRef to annotationRefs list.PathwayElement.CitationRef
addCitation(java.lang.String elementId, org.bridgedb.Xref xref, java.lang.String urlLink)
Creates a citation with given xref and urlLink, and adds citation to pathway model.PathwayElement.CitationRef
addCitation(org.bridgedb.Xref xref, java.lang.String urlLink)
Creates a citation with given xref and urlLink, and adds citation to pathway model.PathwayElement.CitationRef
addCitation(Citation citation)
Creates and adds an citationRef to citationRefs list.PathwayElement.Comment
addComment(java.lang.String commentText, java.lang.String source)
Creates a comment with given properties and adds to comments list.void
addComment(PathwayElement.Comment comment)
Adds given comment to comments list.PathwayElement.EvidenceRef
addEvidence(java.lang.String elementId, java.lang.String value, org.bridgedb.Xref xref, java.lang.String urlLink)
Creates an evidence with given properties, and adds evidence to pathway model.PathwayElement.EvidenceRef
addEvidence(java.lang.String value, org.bridgedb.Xref xref, java.lang.String urlLink)
Creates an evidence with given properties, and adds evidence to pathway model.PathwayElement.EvidenceRef
addEvidence(Evidence evidence)
Creates and adds an evidenceRef to evidenceRefs list.abstract CopyElement
copy()
Copies this pathway element.private void
copyAnnotationRefs(java.util.List<PathwayElement.AnnotationRef> annotationRefs)
Copies annotationRefs and nested citationRefs and evidenceRefs if applicable.private void
copyCitationRefs(java.util.List<PathwayElement.CitationRef> citationRefs)
Copies citationsRefs and nested annotationRefs if applicable.private void
copyEvidenceRefs(java.util.List<PathwayElement.EvidenceRef> evidenceRefs)
Copies evidenceRefs.void
copyReferencesFrom(PathwayElement srcElement)
Copies references from the given source pathway element.void
copyValuesFrom(PathwayElement src)
Copies values from the given source pathway element.java.lang.String
findComment(java.lang.String source)
Finds the first comment with a specific source.java.util.List<PathwayElement.AnnotationRef>
getAnnotationRefs()
Returns the list of annotation references.java.util.List<PathwayElement.CitationRef>
getCitationRefs()
Returns the list of citation references.java.util.List<PathwayElement.Comment>
getComments()
java.util.Map<java.lang.String,java.lang.String>
getDynamicProperties()
Returns the map of dynamic properties.java.lang.String
getDynamicProperty(java.lang.String key)
Returns a dynamic property string value.java.util.Set<java.lang.String>
getDynamicPropertyKeys()
Returns a set of all dynamic property keys.java.util.List<PathwayElement.EvidenceRef>
getEvidenceRefs()
Returns the list of evidence references.java.lang.Object
getPropertyEx(java.lang.Object key)
Returns property of given key.java.util.Set<java.lang.Object>
getPropertyKeys()
Returns keys of available static properties and dynamic properties as an object listjava.lang.Object
getStaticProperty(StaticProperty key)
Returns static property value for given key.java.util.Set<StaticProperty>
getStaticPropertyKeys()
Returns all static properties for this pathway object.boolean
hasAnnotationRef(PathwayElement.AnnotationRef annotationRef)
Checks whether annotationRefs has the given annotationRef.boolean
hasCitationRef(PathwayElement.CitationRef citationRef)
Checks whether citationRefs has the given citationRef.boolean
hasEvidenceRef(PathwayElement.EvidenceRef evidenceRef)
Checks whether evidenceRefs has the given evidenceRef.void
removeAnnotationRef(PathwayElement.AnnotationRef annotationRef)
Removes given annotationRef from annotationRefs list.void
removeAnnotationRefs()
Removes all annotationRefs from annotationRefs list.void
removeCitationRef(PathwayElement.CitationRef citationRef)
Removes given citationRef from citationRefs list.void
removeCitationRefs()
Removes all citationRef from citationRefs list.void
removeComment(PathwayElement.Comment comment)
Removes given comment from comments list.void
removeEvidenceRef(PathwayElement.EvidenceRef evidenceRef)
Removes given evidenceRef from evidenceRefs list.void
removeEvidenceRefs()
Removes all evidenceRefs from evidenceRefs list.void
setComments(java.util.List<PathwayElement.Comment> value)
Sets comments to the given comments list.void
setDynamicProperty(java.lang.String key, java.lang.String value)
Sets a dynamic property.void
setPropertyEx(java.lang.Object key, java.lang.Object value)
Sets dynamic or static properties at the same time.void
setStaticProperty(StaticProperty key, java.lang.Object value)
This works so that o.setNotes(x) is the equivalent of o.setProperty("Notes", x); Value may be null in some cases, e.g.protected void
terminate()
Terminates this pathway element.Methods inherited from class org.pathvisio.libgpml.model.PathwayObject
addListener, dontFireEvents, fireObjectModifiedEvent, getElementId, getListeners, getObjectType, getPathwayModel, hasPathwayModel, removeListener, setElementId, setGeneratedElementId, setPathwayModel, setPathwayModelTo, unsetPathwayModel
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
comments
-
dynamicProperties
private java.util.Map<java.lang.String,java.lang.String> dynamicPropertiesMap for storing dynamic properties. Dynamic properties can have any String as key and value of type String. If a value is set to null the key should be removed. -
annotationRefs
-
citationRefs
-
evidenceRefs
-
-
Constructor Details
-
PathwayElement
public PathwayElement()Instantiates a pathway element with meta data information.
-
-
Method Details
-
getComments
-
addComment
Adds given comment to comments list.- Parameters:
comment
- the comment to be added.
-
addComment
Creates a comment with given properties and adds to comments list. CallsaddComment(Comment comment)
.- Parameters:
commentText
- the text of the comment, between Comment tags in GPML.source
- the source of this comment.- Returns:
- the created comment.
-
removeComment
Removes given comment from comments list.- Parameters:
comment
- the comment to be removed.
-
setComments
Sets comments to the given comments list.- Parameters:
value
- the given comment list.
-
findComment
public java.lang.String findComment(java.lang.String source)Finds the first comment with a specific source.- Parameters:
source
- the source of the comment to be found.- Returns:
- the comment content with a given source.
-
getDynamicProperties
public java.util.Map<java.lang.String,java.lang.String> getDynamicProperties()Returns the map of dynamic properties.- Returns:
- dynamicProperties the map of dynamic properties.
-
getDynamicPropertyKeys
public java.util.Set<java.lang.String> getDynamicPropertyKeys()Returns a set of all dynamic property keys.- Returns:
- a set of all dynamic property keys.
-
getDynamicProperty
public java.lang.String getDynamicProperty(java.lang.String key)Returns a dynamic property string value.- Parameters:
key
- the key of a key value pair.- Returns:
- the value or dynamic property.
-
setDynamicProperty
public void setDynamicProperty(java.lang.String key, java.lang.String value)Sets a dynamic property. Setting to null means removing this dynamic property altogether.- Parameters:
key
- the key of a key value pair.value
- the value of a key value pair.
-
getAnnotationRefs
Returns the list of annotation references.- Specified by:
getAnnotationRefs
in interfaceReferenceable.Annotatable
- Returns:
- annotationRefs the list of annotation references, an empty list if no properties are defined.
-
hasAnnotationRef
Checks whether annotationRefs has the given annotationRef.- Specified by:
hasAnnotationRef
in interfaceReferenceable.Annotatable
- Parameters:
annotationRef
- the annotationRef to look for.- Returns:
- true if has annotationRef, false otherwise.
-
addAnnotation
Creates and adds an annotationRef to annotationRefs list. Sets annotable for the given annotationRef.- Specified by:
addAnnotation
in interfaceReferenceable.Annotatable
- Parameters:
annotation
- the annotation for annotationRef.- Returns:
- the annotationRef of added annotation.
-
addAnnotation
public PathwayElement.AnnotationRef addAnnotation(java.lang.String value, AnnotationType type, org.bridgedb.Xref xref, java.lang.String urlLink)Creates a annotation with given properties, and adds annotation to pathway model. Creates a annotationRef for annotation, and adds to annotationRefs list for this annotatable. CallsaddAnnotation(Annotation annotation)
.- Specified by:
addAnnotation
in interfaceReferenceable.Annotatable
- Parameters:
value
- the name, term, or text of the annotation.type
- the type of the annotation, e.g. ontology.xref
- the annotation xref.urlLink
- the url link of the annotation.- Returns:
- the annotationRef of added annotation.
-
addAnnotation
public PathwayElement.AnnotationRef addAnnotation(java.lang.String elementId, java.lang.String value, AnnotationType type, org.bridgedb.Xref xref, java.lang.String urlLink)Creates a annotation with given properties, and adds annotation to pathway model. Creates a annotationRef for annotation, and adds to annotationRefs list for this annotatable. Sets elementId for annotation. This method is used when reading gpml. CallsaddAnnotation(Annotation annotation)
.- Specified by:
addAnnotation
in interfaceReferenceable.Annotatable
- Parameters:
elementId
- the elementId to set.value
- the name, term, or text of the annotation.type
- the type of the annotation, e.g. ontology.xref
- the annotation xref.urlLink
- the url link of the annotation.- Returns:
- the annotationRef of added annotation.
-
removeAnnotationRef
Removes given annotationRef from annotationRefs list. The annotationRef ceases to exist and is terminated.- Specified by:
removeAnnotationRef
in interfaceReferenceable.Annotatable
- Parameters:
annotationRef
- the annotationRef to be removed.
-
removeAnnotationRefs
public void removeAnnotationRefs()Removes all annotationRefs from annotationRefs list.- Specified by:
removeAnnotationRefs
in interfaceReferenceable.Annotatable
-
getCitationRefs
Returns the list of citation references.- Specified by:
getCitationRefs
in interfaceReferenceable.Citable
- Returns:
- citationRefs the list of citations referenced, an empty list if no properties are defined.
-
hasCitationRef
Checks whether citationRefs has the given citationRef.- Specified by:
hasCitationRef
in interfaceReferenceable.Citable
- Parameters:
citationRef
- the citationRef to look for.- Returns:
- true if has citationRef, false otherwise.
-
addCitation
Creates and adds an citationRef to citationRefs list. Sets citable for the given citationRef.- Specified by:
addCitation
in interfaceReferenceable.Citable
- Parameters:
citation
- the citation for citationRef.- Returns:
- the citationRef of added citation.
-
addCitation
Creates a citation with given xref and urlLink, and adds citation to pathway model. Creates a citationRef for citation, and adds to citationRefs list for this citable.CallsaddCitation(Citation citation)
.- Specified by:
addCitation
in interfaceReferenceable.Citable
- Parameters:
xref
- the citation xref.urlLink
- the url link and description (optional) for a web address.- Returns:
- the citationRef of added citation.
-
addCitation
public PathwayElement.CitationRef addCitation(java.lang.String elementId, org.bridgedb.Xref xref, java.lang.String urlLink)Creates a citation with given xref and urlLink, and adds citation to pathway model. Creates a citationRef for citation, and adds to citationRefs list for this citable. Sets elementId for citation. This method is used when reading gpml. CallsaddCitation(Citation citation)
.- Specified by:
addCitation
in interfaceReferenceable.Citable
- Parameters:
elementId
- the elementId to set.xref
- the citation xref.urlLink
- the url link and description (optional) for a web address.- Returns:
- the citationRef of added citation.
-
removeCitationRef
Removes given citationRef from citationRefs list. The citationRef ceases to exist and is terminated.- Specified by:
removeCitationRef
in interfaceReferenceable.Citable
- Parameters:
citationRef
- the citationRef to be removed.
-
removeCitationRefs
public void removeCitationRefs()Removes all citationRef from citationRefs list.- Specified by:
removeCitationRefs
in interfaceReferenceable.Citable
-
getEvidenceRefs
Returns the list of evidence references.- Specified by:
getEvidenceRefs
in interfaceReferenceable.Evidenceable
- Returns:
- evidenceRefs the list of evidences referenced, an empty list if no properties are defined.
-
hasEvidenceRef
Checks whether evidenceRefs has the given evidenceRef.- Specified by:
hasEvidenceRef
in interfaceReferenceable.Evidenceable
- Parameters:
evidenceRef
- the evidenceRef to look for.- Returns:
- true if has evidenceRef, false otherwise.
-
addEvidence
Creates and adds an evidenceRef to evidenceRefs list. Sets evidenceable for the given evidenceRef.- Specified by:
addEvidence
in interfaceReferenceable.Evidenceable
- Parameters:
evidence
- the evidenceRef for evidenceRef.- Returns:
- the evidenceRef of added evidence.
-
addEvidence
public PathwayElement.EvidenceRef addEvidence(java.lang.String value, org.bridgedb.Xref xref, java.lang.String urlLink)Creates an evidence with given properties, and adds evidence to pathway model. Creates a evidenceRef for evidence, and adds to evidenceRefs list for this evidenceable. CallsaddEvidence(Evidence evidence)
.- Specified by:
addEvidence
in interfaceReferenceable.Evidenceable
- Parameters:
value
- the name, term, or text of the evidence.xref
- the evidence xref.urlLink
- the url link and description (optional) for a web address.- Returns:
- the evidenceRef of added evidence.
-
addEvidence
public PathwayElement.EvidenceRef addEvidence(java.lang.String elementId, java.lang.String value, org.bridgedb.Xref xref, java.lang.String urlLink)Creates an evidence with given properties, and adds evidence to pathway model. Creates a evidenceRef for evidence, and adds to evidenceRefs list for this evidenceable. Sets elementId for evidence. This method is used when reading gpml. CallsaddEvidence(Evidence evidence)
.- Specified by:
addEvidence
in interfaceReferenceable.Evidenceable
- Parameters:
elementId
- the elementId to set.value
- the name, term, or text of the evidence.xref
- the evidence xref.urlLink
- the url link and description (optional) for a web address.- Returns:
- the evidenceRef of added evidence.
-
removeEvidenceRef
Removes given evidenceRef from evidenceRefs list. The evidenceRef ceases to exist and is terminated.- Specified by:
removeEvidenceRef
in interfaceReferenceable.Evidenceable
- Parameters:
evidenceRef
- the evidenceRef to be removed.
-
removeEvidenceRefs
public void removeEvidenceRefs()Removes all evidenceRefs from evidenceRefs list.- Specified by:
removeEvidenceRefs
in interfaceReferenceable.Evidenceable
-
terminate
protected void terminate()Terminates this pathway element. The pathway model, if any, is unset from this pathway element. Links to all annotationRefs, citationRefs, and evidenceRefs are removed from this data node.- Overrides:
terminate
in classPathwayObject
-
copyValuesFrom
Copies values from the given source pathway element.NB:
- Doesn't change parent, only fields
- Used by UndoAction.
- AnnotationRefs, citationRefs, and evidenceRefs are copied later using
copyReferencesFrom(org.pathvisio.libgpml.model.PathwayElement)
.
- Parameters:
src
- the source pathway element.
-
copy
Copies this pathway element.- Returns:
- the copyElement for the new pathway element and this source pathway element.
-
copyReferencesFrom
Copies references from the given source pathway element.NB:
- To be called after new pathway element is added to a pathway model.
- The srcElement may be the immediate copy element source of the new pathway element, or an older source.
- Parameters:
srcElement
- the source element to copy references from.
-
copyCitationRefs
Copies citationsRefs and nested annotationRefs if applicable.- Parameters:
citationRefs
- the citationsRefs list.
-
copyAnnotationRefs
Copies annotationRefs and nested citationRefs and evidenceRefs if applicable.- Parameters:
annotationRefs
- the annotationRefs list.
-
copyEvidenceRefs
Copies evidenceRefs.- Parameters:
evidenceRefs
- the evidenceRefs list.
-
getPropertyKeys
public java.util.Set<java.lang.Object> getPropertyKeys()Returns keys of available static properties and dynamic properties as an object list- Overrides:
getPropertyKeys
in classPathwayObject
- Returns:
- keys the keys of available properties.
-
getStaticPropertyKeys
Returns all static properties for this pathway object.- Overrides:
getStaticPropertyKeys
in classPathwayObject
- Returns:
- result the set of static property for this pathway object.
-
getPropertyEx
public java.lang.Object getPropertyEx(java.lang.Object key)Returns property of given key.- Overrides:
getPropertyEx
in classPathwayObject
- Parameters:
key
- the key.- Returns:
- the property of given key.
-
setPropertyEx
public void setPropertyEx(java.lang.Object key, java.lang.Object value)Sets dynamic or static properties at the same time.- Overrides:
setPropertyEx
in classPathwayObject
- Parameters:
key
- the key for the property to set.value
- the value for the property to set.
-
getStaticProperty
Returns static property value for given key.- Overrides:
getStaticProperty
in classPathwayObject
- Parameters:
key
- the key.- Returns:
- the static property value.
-
setStaticProperty
This works so that o.setNotes(x) is the equivalent of o.setProperty("Notes", x); Value may be null in some cases, e.g. graphRef- Overrides:
setStaticProperty
in classPathwayObject
- Parameters:
key
- the key.value
- the property value.
-