Package psidev.psi.mi.jami.xml.cache
Class InMemoryIdentityObjectCache
- java.lang.Object
-
- psidev.psi.mi.jami.xml.cache.InMemoryIdentityObjectCache
-
- All Implemented Interfaces:
PsiXmlObjectCache
public class InMemoryIdentityObjectCache extends Object implements PsiXmlObjectCache
It keeps a in memory cache of objects having an id. The cache is based on a in memory Identity map.- Since:
12/11/13
- Version:
- $Id$
- Author:
- Marine Dumousseau (marine@ebi.ac.uk)
-
-
Constructor Summary
Constructors Constructor Description InMemoryIdentityObjectCache()Constructor for InMemoryIdentityObjectCache.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()clear.Set<ModelledInteraction>clearRegisteredSubComplexes()This method will return all registered complexes and clear them from the indexvoidclose()Close cachebooleancontains(Object o)True if it contains this objectintextractIdForAvailability(String av)This method will extract the id for this object if it is already registered, assign an id and register the object if not already registeredintextractIdForComplex(Complex o)This method will extract the id for this object if it is already registered, assign an id and register the object if not already registeredintextractIdForExperiment(Experiment o)This method will extract the id for this object if it is already registered, assign an id and register the object if not already registeredintextractIdForFeature(Feature o)This method will extract the id for this object if it is already registered, assign an id and register the object if not already registeredintextractIdForInteraction(Interaction o)This method will extract the id for this object if it is already registered, assign an id and register the object if not already registeredintextractIdForInteractor(Interactor o)This method will extract the id for this object if it is already registered, assign an id and register the object if not already registeredintextractIdForParticipant(Entity o)This method will extract the id for this object if it is already registered, assign an id and register the object if not already registeredintextractIdForVariableParameterValue(VariableParameterValue o)This method will extract the id for this object if it is already registered, assign an id and register the object if not already registeredintgetLastGeneratedId()getLastGeneratedId.booleanhasRegisteredSubComplexes()hasRegisteredSubComplexes.voidregisterSubComplex(ModelledInteraction c)This method will register a complex that is used as an interactorvoidremoveObject(Object o)removeObject.voidresetLastGeneratedIdTo(int id)Reset the last generated id to a specific value
-
-
-
Method Detail
-
extractIdForAvailability
public int extractIdForAvailability(String av)
This method will extract the id for this object if it is already registered, assign an id and register the object if not already registered- Specified by:
extractIdForAvailabilityin interfacePsiXmlObjectCache- Parameters:
av- aStringobject.- Returns:
- the id assigned to this object
-
extractIdForExperiment
public int extractIdForExperiment(Experiment o)
This method will extract the id for this object if it is already registered, assign an id and register the object if not already registered- Specified by:
extractIdForExperimentin interfacePsiXmlObjectCache- Parameters:
o- aExperimentobject.- Returns:
- the id assigned to this object
-
extractIdForInteractor
public int extractIdForInteractor(Interactor o)
This method will extract the id for this object if it is already registered, assign an id and register the object if not already registered- Specified by:
extractIdForInteractorin interfacePsiXmlObjectCache- Parameters:
o- aInteractorobject.- Returns:
- the id assigned to this object
-
extractIdForInteraction
public int extractIdForInteraction(Interaction o)
This method will extract the id for this object if it is already registered, assign an id and register the object if not already registered- Specified by:
extractIdForInteractionin interfacePsiXmlObjectCache- Parameters:
o- aInteractionobject.- Returns:
- the id assigned to this object
-
extractIdForParticipant
public int extractIdForParticipant(Entity o)
This method will extract the id for this object if it is already registered, assign an id and register the object if not already registered- Specified by:
extractIdForParticipantin interfacePsiXmlObjectCache- Parameters:
o- aEntityobject.- Returns:
- the id assigned to this object
-
extractIdForVariableParameterValue
public int extractIdForVariableParameterValue(VariableParameterValue o)
This method will extract the id for this object if it is already registered, assign an id and register the object if not already registered- Specified by:
extractIdForVariableParameterValuein interfacePsiXmlObjectCache- Parameters:
o- aVariableParameterValueobject.- Returns:
- the id assigned to this object
-
extractIdForFeature
public int extractIdForFeature(Feature o)
This method will extract the id for this object if it is already registered, assign an id and register the object if not already registered- Specified by:
extractIdForFeaturein interfacePsiXmlObjectCache- Parameters:
o- aFeatureobject.- Returns:
- the id assigned to this object
-
extractIdForComplex
public int extractIdForComplex(Complex o)
This method will extract the id for this object if it is already registered, assign an id and register the object if not already registered- Specified by:
extractIdForComplexin interfacePsiXmlObjectCache- Parameters:
o- aComplexobject.- Returns:
- the id assigned to this object
-
clear
public void clear()
clear.
- Specified by:
clearin interfacePsiXmlObjectCache
-
close
public void close()
Close cache- Specified by:
closein interfacePsiXmlObjectCache
-
contains
public boolean contains(Object o)
True if it contains this object- Specified by:
containsin interfacePsiXmlObjectCache- Parameters:
o- aObjectobject.- Returns:
- a boolean.
-
registerSubComplex
public void registerSubComplex(ModelledInteraction c)
This method will register a complex that is used as an interactor- Specified by:
registerSubComplexin interfacePsiXmlObjectCache- Parameters:
c- aModelledInteractionobject.
-
clearRegisteredSubComplexes
public Set<ModelledInteraction> clearRegisteredSubComplexes()
This method will return all registered complexes and clear them from the index- Specified by:
clearRegisteredSubComplexesin interfacePsiXmlObjectCache- Returns:
- a
Setobject.
-
hasRegisteredSubComplexes
public boolean hasRegisteredSubComplexes()
hasRegisteredSubComplexes.
- Specified by:
hasRegisteredSubComplexesin interfacePsiXmlObjectCache- Returns:
- true if the index has registered som sub complexes, fasle otherwise
-
removeObject
public void removeObject(Object o)
removeObject.
- Specified by:
removeObjectin interfacePsiXmlObjectCache- Parameters:
o- aObjectobject.
-
getLastGeneratedId
public int getLastGeneratedId()
getLastGeneratedId.
- Specified by:
getLastGeneratedIdin interfacePsiXmlObjectCache- Returns:
- the last generated id
-
resetLastGeneratedIdTo
public void resetLastGeneratedIdTo(int id)
Reset the last generated id to a specific value- Specified by:
resetLastGeneratedIdToin interfacePsiXmlObjectCache- Parameters:
id- a int.
-
-