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 add the given onject 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.
|
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 |
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 |
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)
Model
containsID
in interface Model
id
- of the object to be retrieved.public BioPAXElement getByID(String id)
Model
public Map<String,String> getNameSpacePrefixMap()
Model
getNameSpacePrefixMap
in interface Model
public void setFactory(BioPAXFactory factory)
Model
Model.addNew(Class, String)
method
uses this factory.setFactory
in interface Model
factory
- this model will use for creating
BioPAX objects.public Set<BioPAXElement> getObjects()
Model
getObjects
in interface Model
public <T extends BioPAXElement> Set<T> getObjects(Class<T> filterBy)
Model
getObjects
in interface Model
T
- a BioPAX typefilterBy
- class to be used as a filter.public void remove(BioPAXElement aBioPAXElement)
Model
public <T extends BioPAXElement> T addNew(Class<T> c, String id)
Model
public boolean contains(BioPAXElement aBioPAXElement)
contains
in interface Model
aBioPAXElement
- BioPAX object (individual)Model.containsID(String)
public void add(BioPAXElement aBioPAXElement)
Model
IllegalBioPAXArgumentException
public BioPAXLevel getLevel()
Model
public void setAddDependencies(boolean value)
Model
setAddDependencies
in interface Model
value
- defining the dependency adding behaviourpublic boolean isAddDependencies()
Model
isAddDependencies
in interface Model
public 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 Model
source
- 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)
Model
setXmlBase
in interface Model
base
- a URI prefix or null.public String getXmlBase()
Model
getXmlBase
in interface Model
Copyright © 2015 BioPAX. All rights reserved.