MergingAnnotationDB (biojava-legacy 1.9.5 API)
- java.lang.Object
-
- org.biojava.bio.annodb.MergingAnnotationDB
-
- All Implemented Interfaces:
AnnotationDB
public class MergingAnnotationDB extends Object implements AnnotationDB
An AnnotationDB that provides a merged view of a list of underlying DBs.
- Since:
- 1.3
- Author:
- Matthew Pocock
-
-
Field Summary
-
Fields inherited from interface org.biojava.bio.annodb.AnnotationDB
EMPTY
-
-
Constructor Summary
Constructors Constructor Description MergingAnnotationDB(String name)Create a new MergingAnnotationDB with a name and no DBs to merge.
MergingAnnotationDB(String name, List merged)Create a new MergingAnnotationDB with a name and a list of DBs to merge.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAnnotationDB(AnnotationDB toAdd)Add a DB to be merged in this view.
AnnotationDBfilter(AnnotationType at)Find all Annotation instances in this DB that are of a particular type.
ListgetMerged()Return a list of merged DBs.
StringgetName()The name of this AnnotationDB.
AnnotationTypegetSchema()Get an AnnotationType that accepts all Annotation instances in this DB.
Iteratoriterator()Loop over each Annotation in this db.
voidremoveAnnotationDB(AnnotationDB toRemove)Remove a DB from this view.
AnnotationDBsearch(AnnotationType at)Find all Annotation instances in this DB and any Annotations that are child properties of these that match an AnnotationType.
intsize()The number of Annotation instances in the DB.
-
-
-
Constructor Detail
-
MergingAnnotationDB
public MergingAnnotationDB(String name)
Create a new MergingAnnotationDB with a name and no DBs to merge.
- Parameters:
name- the name of this DB
-
MergingAnnotationDB
public MergingAnnotationDB(String name, List merged)
Create a new MergingAnnotationDB with a name and a list of DBs to merge.
- Parameters:
name- the name of this DBmerged- a list of DBs to merge
-
-
Method Detail
-
addAnnotationDB
public void addAnnotationDB(AnnotationDB toAdd)
Add a DB to be merged in this view.
- Parameters:
toAdd- the AnnotationDB to add
-
removeAnnotationDB
public void removeAnnotationDB(AnnotationDB toRemove)
Remove a DB from this view.
- Parameters:
toRemove- the AnnotationDB to remove
-
getMerged
public List getMerged()
Return a list of merged DBs. This can be modified independantly of this DB.
- Returns:
- a List of merged DBs
-
getName
public String getName()
The name of this AnnotationDB.
- Specified by:
getNamein interfaceAnnotationDB- Returns:
- the name of this AnnotationDB
-
getSchema
public AnnotationType getSchema()
Get an AnnotationType that accepts all Annotation instances in this DB.
The schema should accept all Annotations in the DB. However, it may hit other Annotations. So, AnnotationType.ALL is always a valid schema. Obviously, the more retrictive it is, the more usefull it becomes for introspection.
- Specified by:
getSchemain interfaceAnnotationDB- Returns:
- the schema AnnotationType
-
iterator
public Iterator iterator()
Loop over each Annotation in this db.
- Specified by:
iteratorin interfaceAnnotationDB- Returns:
- an Iterator over each item in the DB
-
size
public int size()
The number of Annotation instances in the DB.
- Specified by:
sizein interfaceAnnotationDB- Returns:
- the size of this DB
-
filter
public AnnotationDB filter(AnnotationType at)
Find all Annotation instances in this DB that are of a particular type.
- Specified by:
filterin interfaceAnnotationDB- Parameters:
at- the AnnotationType to match- Returns:
- an AnnotationDB with all matching Annotation instances
-
search
public AnnotationDB search(AnnotationType at)
Find all Annotation instances in this DB and any Annotations that are child properties of these that match an AnnotationType.
- Specified by:
searchin interfaceAnnotationDB- Parameters:
at- the AnnotationType to search with- Returns:
- an AnnotationDB with all matching Annotation instances, irregardless of how deep in the hieracy they are
-
-