public class ModelImpl extends Object implements Model
Model. Use a factory to create a model.| Modifier and Type | Field and Description |
|---|---|
protected Map<String,BioPAXElement> |
idMap |
| Modifier | Constructor and Description |
|---|---|
protected |
ModelImpl() |
|
ModelImpl(BioPAXFactory factory) |
protected |
ModelImpl(BioPAXLevel level) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(BioPAXElement aBioPAXElement)
This method adds the given object to this model.
|
<T extends BioPAXElement> |
addNew(Class<T> c,
String id)
This method creates a new object using the model's factory, adds it
to the model and returns it.
|
boolean |
contains(BioPAXElement aBioPAXElement)
This method returns true if given element
is the same object ("==") as the object stored in the model
usually (for self-consistent models) but not necessarily under the element's ID.
|
boolean |
containsID(String id)
This method checks for the biopax element with the given id,
returns true if the object with the given id exists.
|
BioPAXElement |
getByID(String id)
This method returns the biopax element with the given id,
returns null if the object with the given id does not exist
in this model.
|
BioPAXLevel |
getLevel()
This method returns the level of the objects that are
contained within this model.
|
String |
getName()
URI of this BioPAX Model.
|
Map<String,String> |
getNameSpacePrefixMap()
This method returns a map of name space prefixes.
|
Set<BioPAXElement> |
getObjects()
This method returns a set of objects in the model.
|
<T extends BioPAXElement> |
getObjects(Class<T> filterBy)
This method returns a set of objects in the model of the given class.
|
String |
getUri()
URI of this BioPAX Model.
|
String |
getXmlBase()
Gets the model's xml:base (URI prefix/namespace), which
normally the majority of the BioPAX object's absolute URIs
in the model begin with.
|
boolean |
isAddDependencies()
When addDependencies is false, the model will not check for the dependent
objects of a newly added object.
|
void |
merge(Model source)
This is default implementation that uses the
id-based merging (
SimpleMerger.merge(Model, Model...))
NOTE: some applications, such as those dealing with persistence/transactions
or advanced BioPAX alignment/comparison algorithms (like the Patch),
may have to implement and use a more specific method instead. |
void |
remove(BioPAXElement aBioPAXElement)
This method removes the given BioPAX Element from the model.
|
void |
repair()
This implementation "repairs" the model
without unnecessarily copying objects:
- recursively adds lost "children" (not null object property values
for which
Model.contains(BioPAXElement) returns False)
- updates object properties (should refer to model's elements) |
void |
replace(BioPAXElement existing,
BioPAXElement replacement)
It does not automatically replace or clean up the old
element's object properties, therefore, some child
elements may become "dangling" if they were used by
the replaced element only.
|
void |
setAddDependencies(boolean value)
When set to false, the model will not check for the dependent
objects of a newly added object.
|
void |
setFactory(BioPAXFactory factory)
This method sets the factory this model will use for creating
BioPAX objects.
|
void |
setName(String modelName) |
void |
setUri(String modelUri) |
void |
setXmlBase(String base)
Sets the xml:base to use when exporting a BioPAX model.
|
protected final Map<String,BioPAXElement> idMap
protected ModelImpl()
protected ModelImpl(BioPAXLevel level)
public ModelImpl(BioPAXFactory factory)
public boolean containsID(String id)
ModelcontainsID in interface Modelid - of the object to be retrieved.public BioPAXElement getByID(String id)
Modelpublic Map<String,String> getNameSpacePrefixMap()
ModelgetNameSpacePrefixMap in interface Modelpublic void setFactory(BioPAXFactory factory)
ModelModel.addNew(Class, String) method
uses this factory.setFactory in interface Modelfactory - this model will use for creating
BioPAX objects.public Set<BioPAXElement> getObjects()
ModelgetObjects in interface Modelpublic <T extends BioPAXElement> Set<T> getObjects(Class<T> filterBy)
ModelgetObjects in interface ModelT - a BioPAX typefilterBy - class to be used as a filter.public void remove(BioPAXElement aBioPAXElement)
Modelpublic <T extends BioPAXElement> T addNew(Class<T> c, String id)
Modelpublic boolean contains(BioPAXElement aBioPAXElement)
contains in interface ModelaBioPAXElement - BioPAX object (individual)Model.containsID(String)public String getUri()
Modelpublic String getName()
ModelModel.getUri().public void add(BioPAXElement aBioPAXElement)
ModelIllegalBioPAXArgumentExceptionpublic BioPAXLevel getLevel()
Modelpublic void setAddDependencies(boolean value)
ModelsetAddDependencies in interface Modelvalue - defining the dependency adding behaviourpublic boolean isAddDependencies()
ModelisAddDependencies in interface Modelpublic void replace(BioPAXElement existing, BioPAXElement replacement)
public void merge(Model source)
SimpleMerger.merge(Model, Model...))
NOTE: some applications, such as those dealing with persistence/transactions
or advanced BioPAX alignment/comparison algorithms (like the Patch),
may have to implement and use a more specific method instead.merge in interface Modelsource - a model to mergeSimpleMerger,
Model.merge(Model)public void repair()
Model.contains(BioPAXElement) returns False)
- updates object properties (should refer to model's elements)public void setXmlBase(String base)
ModelsetXmlBase in interface Modelbase - a URI prefix or null.public String getXmlBase()
ModelgetXmlBase in interface ModelCopyright © 2018 BioPAX. All rights reserved.