Package psidev.psi.mi.jami.xml.cache
Class PsiXmlFileIndexCache
- java.lang.Object
-
- psidev.psi.mi.jami.xml.cache.PsiXmlFileIndexCache
-
- All Implemented Interfaces:
PsiXmlIdCache
public class PsiXmlFileIndexCache extends Object implements PsiXmlIdCache
Cache using a file and a weak map to cache the objects- Since:
25/06/14
- Version:
- $Id$
- Author:
- Marine Dumousseau (marine@ebi.ac.uk)
-
-
Constructor Summary
Constructors Constructor Description PsiXmlFileIndexCache(File file, javax.xml.bind.Unmarshaller unmarshaller, PsiXmlVersion version)
Constructor for PsiXmlFileIndexCache.PsiXmlFileIndexCache(File file, PsiXmlVersion version, InteractionCategory category)
Constructor for PsiXmlFileIndexCache.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
buildPositionIndex(File f)
Indexes references component of the given file.void
clear()
Clear all existing recordsvoid
close()
Close cacheboolean
containsAvailability(int id)
To know if it contains a specific idboolean
containsComplex(int id)
To know if it contains a specific idboolean
containsComplexFeature(int id)
To know if it contains a specific idboolean
containsComplexParticipant(int id)
To know if it contains a specific idboolean
containsExperiment(int id)
To know if it contains a specific idboolean
containsFeature(int id)
To know if it contains a specific idboolean
containsInteraction(int id)
To know if it contains a specific idboolean
containsInteractor(int id)
To know if it contains a specific idboolean
containsParticipant(int id)
To know if it contains a specific idboolean
containsVariableParameter(int id)
To know if it contains a specific idAbstractAvailability
getAvailability(int id)
getAvailability.Complex
getComplex(int id)
getComplex.ModelledFeature
getComplexFeature(int id)
getComplexFeature.ModelledEntity
getComplexParticipant(int id)
getComplexParticipant.Experiment
getExperiment(int id)
getExperiment.Feature
getFeature(int id)
getFeature.Interaction
getInteraction(int id)
getInteraction.Interactor
getInteractor(int id)
getInteractor.Entity
getParticipant(int id)
getParticipant.VariableParameterValue
getVariableParameterValue(int id)
getVariableParameterValue.void
registerAvailability(int id, AbstractAvailability object)
Register an availability with an idvoid
registerComplex(int id, Complex object)
Register a complex with an idvoid
registerComplexFeature(int id, ModelledFeature object)
Register a complex feature with an idComplex
registerComplexLoadedFrom(Interaction f)
registerComplexLoadedFrom.void
registerComplexParticipant(int id, ModelledEntity object)
Register a participant involved in a complex with an idvoid
registerExperiment(int id, Experiment object)
Register an experiment with an idvoid
registerFeature(int id, Feature object)
Register a feature with an idvoid
registerInteraction(int id, Interaction object)
Register an interaction with an idvoid
registerInteractor(int id, Interactor object)
Register an interactor with an idModelledFeature
registerModelledFeatureLoadedFrom(Feature f)
registerModelledFeatureLoadedFrom.ModelledEntity
registerModelledParticipantLoadedFrom(Entity f)
registerModelledParticipantLoadedFrom.void
registerParticipant(int id, Entity object)
Register a participant with an idvoid
registerVariableParameterValue(int id, VariableParameterValue object)
Register a variable parameter value with an id
-
-
-
Constructor Detail
-
PsiXmlFileIndexCache
public PsiXmlFileIndexCache(File file, javax.xml.bind.Unmarshaller unmarshaller, PsiXmlVersion version) throws IOException
Constructor for PsiXmlFileIndexCache.
- Parameters:
file
- aFile
object.unmarshaller
- aUnmarshaller
object.version
- aPsiXmlVersion
object.- Throws:
IOException
- if any.
-
PsiXmlFileIndexCache
public PsiXmlFileIndexCache(File file, PsiXmlVersion version, InteractionCategory category) throws IOException, javax.xml.bind.JAXBException
Constructor for PsiXmlFileIndexCache.
- Parameters:
file
- aFile
object.version
- aPsiXmlVersion
object.category
- aInteractionCategory
object.- Throws:
IOException
- if any.javax.xml.bind.JAXBException
- if any.
-
-
Method Detail
-
registerAvailability
public void registerAvailability(int id, AbstractAvailability object)
Register an availability with an id- Specified by:
registerAvailability
in interfacePsiXmlIdCache
- Parameters:
id
- a int.object
- aAbstractAvailability
object.
-
getAvailability
public AbstractAvailability getAvailability(int id)
getAvailability.
- Specified by:
getAvailability
in interfacePsiXmlIdCache
- Parameters:
id
- a int.- Returns:
- the availability registered with this id, null if it does not exist
-
registerExperiment
public void registerExperiment(int id, Experiment object)
Register an experiment with an id- Specified by:
registerExperiment
in interfacePsiXmlIdCache
- Parameters:
id
- a int.object
- aExperiment
object.
-
getExperiment
public Experiment getExperiment(int id)
getExperiment.
- Specified by:
getExperiment
in interfacePsiXmlIdCache
- Parameters:
id
- a int.- Returns:
- the experiment registered with this id, null if it does not exist
-
registerInteraction
public void registerInteraction(int id, Interaction object)
Register an interaction with an id- Specified by:
registerInteraction
in interfacePsiXmlIdCache
- Parameters:
id
- a int.object
- aInteraction
object.
-
getInteraction
public Interaction getInteraction(int id)
getInteraction.
- Specified by:
getInteraction
in interfacePsiXmlIdCache
- Parameters:
id
- a int.- Returns:
- the interaction registered with this id, null if it does not exist
-
registerInteractor
public void registerInteractor(int id, Interactor object)
Register an interactor with an id- Specified by:
registerInteractor
in interfacePsiXmlIdCache
- Parameters:
id
- a int.object
- aInteractor
object.
-
getInteractor
public Interactor getInteractor(int id)
getInteractor.
- Specified by:
getInteractor
in interfacePsiXmlIdCache
- Parameters:
id
- a int.- Returns:
- the interactor registered with this id, null if it does not exist
-
registerParticipant
public void registerParticipant(int id, Entity object)
Register a participant with an id- Specified by:
registerParticipant
in interfacePsiXmlIdCache
- Parameters:
id
- a int.object
- aEntity
object.
-
getParticipant
public Entity getParticipant(int id)
getParticipant.
- Specified by:
getParticipant
in interfacePsiXmlIdCache
- Parameters:
id
- a int.- Returns:
- the participant registered with this id, null if it does not exist
-
registerFeature
public void registerFeature(int id, Feature object)
Register a feature with an id- Specified by:
registerFeature
in interfacePsiXmlIdCache
- Parameters:
id
- a int.object
- aFeature
object.
-
getFeature
public Feature getFeature(int id)
getFeature.
- Specified by:
getFeature
in interfacePsiXmlIdCache
- Parameters:
id
- a int.- Returns:
- the feature registered with this id, null if it does not exist
-
registerComplexParticipant
public void registerComplexParticipant(int id, ModelledEntity object)
Register a participant involved in a complex with an id- Specified by:
registerComplexParticipant
in interfacePsiXmlIdCache
- Parameters:
id
- a int.object
- aModelledEntity
object.
-
getComplexParticipant
public ModelledEntity getComplexParticipant(int id)
getComplexParticipant.
- Specified by:
getComplexParticipant
in interfacePsiXmlIdCache
- Parameters:
id
- a int.- Returns:
- the participant registered with this id, null if it does not exist
-
registerComplexFeature
public void registerComplexFeature(int id, ModelledFeature object)
Register a complex feature with an id- Specified by:
registerComplexFeature
in interfacePsiXmlIdCache
- Parameters:
id
- a int.object
- aModelledFeature
object.
-
getComplexFeature
public ModelledFeature getComplexFeature(int id)
getComplexFeature.
- Specified by:
getComplexFeature
in interfacePsiXmlIdCache
- Parameters:
id
- a int.- Returns:
- the feature registered with this id, null if it does not exist
-
registerComplex
public void registerComplex(int id, Complex object)
Register a complex with an id- Specified by:
registerComplex
in interfacePsiXmlIdCache
- Parameters:
id
- a int.object
- aComplex
object.
-
getComplex
public Complex getComplex(int id)
getComplex.
- Specified by:
getComplex
in interfacePsiXmlIdCache
- Parameters:
id
- a int.- Returns:
- the complex registered with this id, null if it does not exist
-
registerVariableParameterValue
public void registerVariableParameterValue(int id, VariableParameterValue object)
Register a variable parameter value with an id- Specified by:
registerVariableParameterValue
in interfacePsiXmlIdCache
- Parameters:
id
- a int.object
- aVariableParameterValue
object.
-
getVariableParameterValue
public VariableParameterValue getVariableParameterValue(int id)
getVariableParameterValue.
- Specified by:
getVariableParameterValue
in interfacePsiXmlIdCache
- Parameters:
id
- a int.- Returns:
- the variable parameter value registered with this id, null if it does not exist
-
clear
public void clear()
Clear all existing records- Specified by:
clear
in interfacePsiXmlIdCache
-
close
public void close()
Close cache- Specified by:
close
in interfacePsiXmlIdCache
-
containsExperiment
public boolean containsExperiment(int id)
To know if it contains a specific id- Specified by:
containsExperiment
in interfacePsiXmlIdCache
- Parameters:
id
- a int.- Returns:
- a boolean.
-
containsAvailability
public boolean containsAvailability(int id)
To know if it contains a specific id- Specified by:
containsAvailability
in interfacePsiXmlIdCache
- Parameters:
id
- a int.- Returns:
- a boolean.
-
containsInteraction
public boolean containsInteraction(int id)
To know if it contains a specific id- Specified by:
containsInteraction
in interfacePsiXmlIdCache
- Parameters:
id
- a int.- Returns:
- a boolean.
-
containsInteractor
public boolean containsInteractor(int id)
To know if it contains a specific id- Specified by:
containsInteractor
in interfacePsiXmlIdCache
- Parameters:
id
- a int.- Returns:
- a boolean.
-
containsParticipant
public boolean containsParticipant(int id)
To know if it contains a specific id- Specified by:
containsParticipant
in interfacePsiXmlIdCache
- Parameters:
id
- a int.- Returns:
- a boolean.
-
containsFeature
public boolean containsFeature(int id)
To know if it contains a specific id- Specified by:
containsFeature
in interfacePsiXmlIdCache
- Parameters:
id
- a int.- Returns:
- a boolean.
-
containsVariableParameter
public boolean containsVariableParameter(int id)
To know if it contains a specific id- Specified by:
containsVariableParameter
in interfacePsiXmlIdCache
- Parameters:
id
- a int.- Returns:
- a boolean.
-
containsComplex
public boolean containsComplex(int id)
To know if it contains a specific id- Specified by:
containsComplex
in interfacePsiXmlIdCache
- Parameters:
id
- a int.- Returns:
- a boolean.
-
containsComplexParticipant
public boolean containsComplexParticipant(int id)
To know if it contains a specific id- Specified by:
containsComplexParticipant
in interfacePsiXmlIdCache
- Parameters:
id
- a int.- Returns:
- a boolean.
-
containsComplexFeature
public boolean containsComplexFeature(int id)
To know if it contains a specific id- Specified by:
containsComplexFeature
in interfacePsiXmlIdCache
- Parameters:
id
- a int.- Returns:
- a boolean.
-
registerModelledFeatureLoadedFrom
public ModelledFeature registerModelledFeatureLoadedFrom(Feature f)
registerModelledFeatureLoadedFrom.
- Specified by:
registerModelledFeatureLoadedFrom
in interfacePsiXmlIdCache
- Parameters:
f
- : the loaded feature- Returns:
- the converted and registered modelled feature
-
registerModelledParticipantLoadedFrom
public ModelledEntity registerModelledParticipantLoadedFrom(Entity f)
registerModelledParticipantLoadedFrom.
- Specified by:
registerModelledParticipantLoadedFrom
in interfacePsiXmlIdCache
- Parameters:
f
- : the loaded participant- Returns:
- the converted and registered modelled participant
-
registerComplexLoadedFrom
public Complex registerComplexLoadedFrom(Interaction f)
registerComplexLoadedFrom.
- Specified by:
registerComplexLoadedFrom
in interfacePsiXmlIdCache
- Parameters:
f
- : the loaded interaction- Returns:
- the converted and registered complex
-
buildPositionIndex
public void buildPositionIndex(File f) throws IOException
Indexes references component of the given file. that is experiments, interaction, interactor, feature and participant so that we know where they are in the file and we can jump in the right position should we want to extract one of them.- Parameters:
f
- the file to index.- Throws:
IOException
- if any.
-
-