Package psidev.psi.mi.jami.xml.cache
Class InMemoryLightIdentityObjectCache
- java.lang.Object
-
- psidev.psi.mi.jami.xml.cache.InMemoryLightIdentityObjectCache
-
- All Implemented Interfaces:
PsiXmlObjectCache
public class InMemoryLightIdentityObjectCache 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. It will only keep experiments, interactions, features and participants in memory. It will ignore interactors and availability- Since:
19/11/13
- Version:
- $Id$
- Author:
- Marine Dumousseau (marine@ebi.ac.uk)
-
-
Constructor Summary
Constructors Constructor Description InMemoryLightIdentityObjectCache()
Constructor for InMemoryLightIdentityObjectCache.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
clear.Set<ModelledInteraction>
clearRegisteredSubComplexes()
This method will return all registered complexes and clear them from the indexvoid
close()
Close cacheboolean
contains(Object o)
True if it contains this objectint
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 registeredint
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 registeredint
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 registeredint
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 registeredint
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 registeredint
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 registeredint
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 registeredint
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 registeredint
getLastGeneratedId()
getLastGeneratedId.boolean
hasRegisteredSubComplexes()
hasRegisteredSubComplexes.void
registerSubComplex(ModelledInteraction c)
This method will register a complex that is used as an interactorvoid
removeObject(Object o)
removeObject.void
resetLastGeneratedIdTo(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:
extractIdForAvailability
in interfacePsiXmlObjectCache
- Parameters:
av
- aString
object.- 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:
extractIdForExperiment
in interfacePsiXmlObjectCache
- Parameters:
o
- aExperiment
object.- 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:
extractIdForInteractor
in interfacePsiXmlObjectCache
- Parameters:
o
- aInteractor
object.- 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:
extractIdForInteraction
in interfacePsiXmlObjectCache
- Parameters:
o
- aInteraction
object.- 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:
extractIdForParticipant
in interfacePsiXmlObjectCache
- Parameters:
o
- aEntity
object.- 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:
extractIdForFeature
in interfacePsiXmlObjectCache
- Parameters:
o
- aFeature
object.- 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:
extractIdForVariableParameterValue
in interfacePsiXmlObjectCache
- Parameters:
o
- aVariableParameterValue
object.- 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:
extractIdForComplex
in interfacePsiXmlObjectCache
- Parameters:
o
- aComplex
object.- Returns:
- the id assigned to this object
-
clear
public void clear()
clear.
- Specified by:
clear
in interfacePsiXmlObjectCache
-
close
public void close()
Close cache- Specified by:
close
in interfacePsiXmlObjectCache
-
contains
public boolean contains(Object o)
True if it contains this object- Specified by:
contains
in interfacePsiXmlObjectCache
- Parameters:
o
- aObject
object.- Returns:
- a boolean.
-
registerSubComplex
public void registerSubComplex(ModelledInteraction c)
This method will register a complex that is used as an interactor- Specified by:
registerSubComplex
in interfacePsiXmlObjectCache
- Parameters:
c
- aModelledInteraction
object.
-
clearRegisteredSubComplexes
public Set<ModelledInteraction> clearRegisteredSubComplexes()
This method will return all registered complexes and clear them from the index- Specified by:
clearRegisteredSubComplexes
in interfacePsiXmlObjectCache
- Returns:
- a
Set
object.
-
hasRegisteredSubComplexes
public boolean hasRegisteredSubComplexes()
hasRegisteredSubComplexes.
- Specified by:
hasRegisteredSubComplexes
in interfacePsiXmlObjectCache
- Returns:
- true if the index has registered som sub complexes, fasle otherwise
-
removeObject
public void removeObject(Object o)
removeObject.
- Specified by:
removeObject
in interfacePsiXmlObjectCache
- Parameters:
o
- aObject
object.
-
getLastGeneratedId
public int getLastGeneratedId()
getLastGeneratedId.
- Specified by:
getLastGeneratedId
in interfacePsiXmlObjectCache
- Returns:
- the last generated id
-
resetLastGeneratedIdTo
public void resetLastGeneratedIdTo(int id)
Reset the last generated id to a specific value- Specified by:
resetLastGeneratedIdTo
in interfacePsiXmlObjectCache
- Parameters:
id
- a int.
-
-