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 voidbuildPositionIndex(File f)Indexes references component of the given file.voidclear()Clear all existing recordsvoidclose()Close cachebooleancontainsAvailability(int id)To know if it contains a specific idbooleancontainsComplex(int id)To know if it contains a specific idbooleancontainsComplexFeature(int id)To know if it contains a specific idbooleancontainsComplexParticipant(int id)To know if it contains a specific idbooleancontainsExperiment(int id)To know if it contains a specific idbooleancontainsFeature(int id)To know if it contains a specific idbooleancontainsInteraction(int id)To know if it contains a specific idbooleancontainsInteractor(int id)To know if it contains a specific idbooleancontainsParticipant(int id)To know if it contains a specific idbooleancontainsVariableParameter(int id)To know if it contains a specific idAbstractAvailabilitygetAvailability(int id)getAvailability.ComplexgetComplex(int id)getComplex.ModelledFeaturegetComplexFeature(int id)getComplexFeature.ModelledEntitygetComplexParticipant(int id)getComplexParticipant.ExperimentgetExperiment(int id)getExperiment.FeaturegetFeature(int id)getFeature.InteractiongetInteraction(int id)getInteraction.InteractorgetInteractor(int id)getInteractor.EntitygetParticipant(int id)getParticipant.VariableParameterValuegetVariableParameterValue(int id)getVariableParameterValue.voidregisterAvailability(int id, AbstractAvailability object)Register an availability with an idvoidregisterComplex(int id, Complex object)Register a complex with an idvoidregisterComplexFeature(int id, ModelledFeature object)Register a complex feature with an idComplexregisterComplexLoadedFrom(Interaction f)registerComplexLoadedFrom.voidregisterComplexParticipant(int id, ModelledEntity object)Register a participant involved in a complex with an idvoidregisterExperiment(int id, Experiment object)Register an experiment with an idvoidregisterFeature(int id, Feature object)Register a feature with an idvoidregisterInteraction(int id, Interaction object)Register an interaction with an idvoidregisterInteractor(int id, Interactor object)Register an interactor with an idModelledFeatureregisterModelledFeatureLoadedFrom(Feature f)registerModelledFeatureLoadedFrom.ModelledEntityregisterModelledParticipantLoadedFrom(Entity f)registerModelledParticipantLoadedFrom.voidregisterParticipant(int id, Entity object)Register a participant with an idvoidregisterVariableParameterValue(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- aFileobject.unmarshaller- aUnmarshallerobject.version- aPsiXmlVersionobject.- Throws:
IOException- if any.
-
PsiXmlFileIndexCache
public PsiXmlFileIndexCache(File file, PsiXmlVersion version, InteractionCategory category) throws IOException, javax.xml.bind.JAXBException
Constructor for PsiXmlFileIndexCache.
- Parameters:
file- aFileobject.version- aPsiXmlVersionobject.category- aInteractionCategoryobject.- 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:
registerAvailabilityin interfacePsiXmlIdCache- Parameters:
id- a int.object- aAbstractAvailabilityobject.
-
getAvailability
public AbstractAvailability getAvailability(int id)
getAvailability.
- Specified by:
getAvailabilityin 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:
registerExperimentin interfacePsiXmlIdCache- Parameters:
id- a int.object- aExperimentobject.
-
getExperiment
public Experiment getExperiment(int id)
getExperiment.
- Specified by:
getExperimentin 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:
registerInteractionin interfacePsiXmlIdCache- Parameters:
id- a int.object- aInteractionobject.
-
getInteraction
public Interaction getInteraction(int id)
getInteraction.
- Specified by:
getInteractionin 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:
registerInteractorin interfacePsiXmlIdCache- Parameters:
id- a int.object- aInteractorobject.
-
getInteractor
public Interactor getInteractor(int id)
getInteractor.
- Specified by:
getInteractorin 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:
registerParticipantin interfacePsiXmlIdCache- Parameters:
id- a int.object- aEntityobject.
-
getParticipant
public Entity getParticipant(int id)
getParticipant.
- Specified by:
getParticipantin 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:
registerFeaturein interfacePsiXmlIdCache- Parameters:
id- a int.object- aFeatureobject.
-
getFeature
public Feature getFeature(int id)
getFeature.
- Specified by:
getFeaturein 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:
registerComplexParticipantin interfacePsiXmlIdCache- Parameters:
id- a int.object- aModelledEntityobject.
-
getComplexParticipant
public ModelledEntity getComplexParticipant(int id)
getComplexParticipant.
- Specified by:
getComplexParticipantin 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:
registerComplexFeaturein interfacePsiXmlIdCache- Parameters:
id- a int.object- aModelledFeatureobject.
-
getComplexFeature
public ModelledFeature getComplexFeature(int id)
getComplexFeature.
- Specified by:
getComplexFeaturein 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:
registerComplexin interfacePsiXmlIdCache- Parameters:
id- a int.object- aComplexobject.
-
getComplex
public Complex getComplex(int id)
getComplex.
- Specified by:
getComplexin 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:
registerVariableParameterValuein interfacePsiXmlIdCache- Parameters:
id- a int.object- aVariableParameterValueobject.
-
getVariableParameterValue
public VariableParameterValue getVariableParameterValue(int id)
getVariableParameterValue.
- Specified by:
getVariableParameterValuein 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:
clearin interfacePsiXmlIdCache
-
close
public void close()
Close cache- Specified by:
closein interfacePsiXmlIdCache
-
containsExperiment
public boolean containsExperiment(int id)
To know if it contains a specific id- Specified by:
containsExperimentin interfacePsiXmlIdCache- Parameters:
id- a int.- Returns:
- a boolean.
-
containsAvailability
public boolean containsAvailability(int id)
To know if it contains a specific id- Specified by:
containsAvailabilityin interfacePsiXmlIdCache- Parameters:
id- a int.- Returns:
- a boolean.
-
containsInteraction
public boolean containsInteraction(int id)
To know if it contains a specific id- Specified by:
containsInteractionin interfacePsiXmlIdCache- Parameters:
id- a int.- Returns:
- a boolean.
-
containsInteractor
public boolean containsInteractor(int id)
To know if it contains a specific id- Specified by:
containsInteractorin interfacePsiXmlIdCache- Parameters:
id- a int.- Returns:
- a boolean.
-
containsParticipant
public boolean containsParticipant(int id)
To know if it contains a specific id- Specified by:
containsParticipantin interfacePsiXmlIdCache- Parameters:
id- a int.- Returns:
- a boolean.
-
containsFeature
public boolean containsFeature(int id)
To know if it contains a specific id- Specified by:
containsFeaturein interfacePsiXmlIdCache- Parameters:
id- a int.- Returns:
- a boolean.
-
containsVariableParameter
public boolean containsVariableParameter(int id)
To know if it contains a specific id- Specified by:
containsVariableParameterin interfacePsiXmlIdCache- Parameters:
id- a int.- Returns:
- a boolean.
-
containsComplex
public boolean containsComplex(int id)
To know if it contains a specific id- Specified by:
containsComplexin interfacePsiXmlIdCache- Parameters:
id- a int.- Returns:
- a boolean.
-
containsComplexParticipant
public boolean containsComplexParticipant(int id)
To know if it contains a specific id- Specified by:
containsComplexParticipantin interfacePsiXmlIdCache- Parameters:
id- a int.- Returns:
- a boolean.
-
containsComplexFeature
public boolean containsComplexFeature(int id)
To know if it contains a specific id- Specified by:
containsComplexFeaturein interfacePsiXmlIdCache- Parameters:
id- a int.- Returns:
- a boolean.
-
registerModelledFeatureLoadedFrom
public ModelledFeature registerModelledFeatureLoadedFrom(Feature f)
registerModelledFeatureLoadedFrom.
- Specified by:
registerModelledFeatureLoadedFromin interfacePsiXmlIdCache- Parameters:
f- : the loaded feature- Returns:
- the converted and registered modelled feature
-
registerModelledParticipantLoadedFrom
public ModelledEntity registerModelledParticipantLoadedFrom(Entity f)
registerModelledParticipantLoadedFrom.
- Specified by:
registerModelledParticipantLoadedFromin interfacePsiXmlIdCache- Parameters:
f- : the loaded participant- Returns:
- the converted and registered modelled participant
-
registerComplexLoadedFrom
public Complex registerComplexLoadedFrom(Interaction f)
registerComplexLoadedFrom.
- Specified by:
registerComplexLoadedFromin 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.
-
-