Package psidev.psi.mi.jami.json.nary
Class AbstractMIJsonWriter<I extends Interaction>
- java.lang.Object
-
- psidev.psi.mi.jami.json.nary.AbstractMIJsonWriter<I>
-
- All Implemented Interfaces:
InteractionWriter<I>
- Direct Known Subclasses:
AbstractMIJsonBinaryWriter,LightMIJsonWriter,MIJsonEvidenceWriter,MIJsonModelledWriter,MIJsonWriter
public abstract class AbstractMIJsonWriter<I extends Interaction> extends Object implements InteractionWriter<I>
Abstract JSON writer for interactions (n-ary json format)- Since:
03/07/13
- Version:
- $Id$
- Author:
- Marine Dumousseau (marine@ebi.ac.uk)
-
-
Constructor Summary
Constructors Modifier Constructor Description AbstractMIJsonWriter()Constructor for AbstractMIJsonWriter.AbstractMIJsonWriter(File file, OntologyTermFetcher fetcher)Constructor for AbstractMIJsonWriter.AbstractMIJsonWriter(OutputStream output, OntologyTermFetcher fetcher)Constructor for AbstractMIJsonWriter.AbstractMIJsonWriter(Writer writer, OntologyTermFetcher fetcher)Constructor for AbstractMIJsonWriter.protectedAbstractMIJsonWriter(Writer writer, OntologyTermFetcher fetcher, Map<String,String> processedInteractors, Map<Feature,Integer> processedFeatures, Map<Entity,Integer> processedParticipants, IncrementalIdGenerator idGenerator)Constructor for AbstractMIJsonWriter.protectedAbstractMIJsonWriter(Map<String,String> processedInteractors, Map<Feature,Integer> processedFeatures, Map<Entity,Integer> processedParticipants, IncrementalIdGenerator idGenerator)Constructor for AbstractMIJsonWriter.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclear()clear.voidclose()close.voidend()end.voidflush()flush.protected OntologyTermFetchergetFetcher()Getter for the fieldfetcher.protected IncrementalIdGeneratorgetIdGenerator()Getter for the fieldidGenerator.JsonElementWriter<I>getInteractionWriter()Getter for the fieldinteractionWriter.JsonElementWriter<Interactor>getInteractorWriter()Getter for the fieldinteractorWriter.protected Map<Feature,Integer>getProcessedFeatures()Getter for the fieldprocessedFeatures.protected Map<String,String>getProcessedInteractors()Getter for the fieldprocessedInteractors.protected Map<Entity,Integer>getProcessedParticipants()Getter for the fieldprocessedParticipants.protected WritergetWriter()Getter for the fieldwriter.voidinitialiseContext(Map<String,Object> options)Initialise the context of the InteractionWriter given a map of optionsprotected abstract voidinitialiseInteractionWriter()initialiseInteractionWriter.protected voidregisterAndWriteInteractor(Participant participant)registerAndWriteInteractor.voidreset()reset.protected voidsetFetcher(OntologyTermFetcher fetcher)Setter for the fieldfetcher.protected voidsetInteractionWriter(JsonElementWriter<I> interactionWriter)Setter for the fieldinteractionWriter.voidstart()start.voidwrite(I interaction)write.voidwrite(Collection<? extends I> interactions)write.voidwrite(Iterator<? extends I> interactions)Writes Interaction objects using iteratorprotected abstract voidwriteComplex(Complex complex)writeComplex.protected voidwriteEnd()writeEnd.protected voidwriteStart()writeStart.
-
-
-
Constructor Detail
-
AbstractMIJsonWriter
public AbstractMIJsonWriter()
Constructor for AbstractMIJsonWriter.
-
AbstractMIJsonWriter
public AbstractMIJsonWriter(File file, OntologyTermFetcher fetcher) throws IOException
Constructor for AbstractMIJsonWriter.
- Parameters:
file- aFileobject.fetcher- aOntologyTermFetcherobject.- Throws:
IOException- if any.
-
AbstractMIJsonWriter
public AbstractMIJsonWriter(OutputStream output, OntologyTermFetcher fetcher)
Constructor for AbstractMIJsonWriter.
- Parameters:
output- aOutputStreamobject.fetcher- aOntologyTermFetcherobject.
-
AbstractMIJsonWriter
public AbstractMIJsonWriter(Writer writer, OntologyTermFetcher fetcher)
Constructor for AbstractMIJsonWriter.
- Parameters:
writer- aWriterobject.fetcher- aOntologyTermFetcherobject.
-
AbstractMIJsonWriter
protected AbstractMIJsonWriter(Writer writer, OntologyTermFetcher fetcher, Map<String,String> processedInteractors, Map<Feature,Integer> processedFeatures, Map<Entity,Integer> processedParticipants, IncrementalIdGenerator idGenerator)
Constructor for AbstractMIJsonWriter.
- Parameters:
writer- aWriterobject.fetcher- aOntologyTermFetcherobject.processedInteractors- aMapobject.processedFeatures- aMapobject.processedParticipants- aMapobject.idGenerator- aIncrementalIdGeneratorobject.
-
AbstractMIJsonWriter
protected AbstractMIJsonWriter(Map<String,String> processedInteractors, Map<Feature,Integer> processedFeatures, Map<Entity,Integer> processedParticipants, IncrementalIdGenerator idGenerator)
Constructor for AbstractMIJsonWriter.
- Parameters:
processedInteractors- aMapobject.processedFeatures- aMapobject.processedParticipants- aMapobject.idGenerator- aIncrementalIdGeneratorobject.
-
-
Method Detail
-
initialiseContext
public void initialiseContext(Map<String,Object> options)
Initialise the context of the InteractionWriter given a map of options- Specified by:
initialiseContextin interfaceInteractionWriter<I extends Interaction>- Parameters:
options- : the options given by the user
-
start
public void start() throws MIIOExceptionstart.
- Specified by:
startin interfaceInteractionWriter<I extends Interaction>- Throws:
MIIOException- if any.
-
end
public void end() throws MIIOExceptionend.
- Specified by:
endin interfaceInteractionWriter<I extends Interaction>- Throws:
MIIOException- if any.
-
write
public void write(I interaction) throws MIIOException
write.
- Specified by:
writein interfaceInteractionWriter<I extends Interaction>- Parameters:
interaction- a I object.- Throws:
MIIOException- if any.
-
write
public void write(Collection<? extends I> interactions) throws MIIOException
write.
- Specified by:
writein interfaceInteractionWriter<I extends Interaction>- Parameters:
interactions- aCollectionobject.- Throws:
MIIOException- if any.
-
write
public void write(Iterator<? extends I> interactions) throws MIIOException
Writes Interaction objects using iterator- Specified by:
writein interfaceInteractionWriter<I extends Interaction>- Parameters:
interactions- : the iterator of interactions to write- Throws:
MIIOException- : if cannot write
-
flush
public void flush() throws MIIOExceptionflush.
- Specified by:
flushin interfaceInteractionWriter<I extends Interaction>- Throws:
MIIOException- if any.
-
close
public void close() throws MIIOExceptionclose.
- Specified by:
closein interfaceInteractionWriter<I extends Interaction>- Throws:
MIIOException- if any.
-
clear
public void clear()
clear.
-
reset
public void reset() throws MIIOExceptionreset.
- Specified by:
resetin interfaceInteractionWriter<I extends Interaction>- Throws:
MIIOException- if any.
-
writeComplex
protected abstract void writeComplex(Complex complex)
writeComplex.
- Parameters:
complex- aComplexobject.
-
registerAndWriteInteractor
protected void registerAndWriteInteractor(Participant participant) throws IOException
registerAndWriteInteractor.
- Parameters:
participant- aParticipantobject.- Throws:
IOException- if any.
-
writeStart
protected void writeStart() throws IOExceptionwriteStart.
- Throws:
IOException- if any.
-
writeEnd
protected void writeEnd() throws IOExceptionwriteEnd.
- Throws:
IOException- if any.
-
getFetcher
protected OntologyTermFetcher getFetcher()
Getter for the field
fetcher.- Returns:
- a
OntologyTermFetcherobject.
-
getInteractorWriter
public JsonElementWriter<Interactor> getInteractorWriter()
Getter for the field
interactorWriter.- Returns:
- a
JsonElementWriterobject.
-
getInteractionWriter
public JsonElementWriter<I> getInteractionWriter()
Getter for the field
interactionWriter.- Returns:
- a
JsonElementWriterobject.
-
initialiseInteractionWriter
protected abstract void initialiseInteractionWriter()
initialiseInteractionWriter.
-
setInteractionWriter
protected void setInteractionWriter(JsonElementWriter<I> interactionWriter)
Setter for the field
interactionWriter.- Parameters:
interactionWriter- aJsonElementWriterobject.
-
getProcessedInteractors
protected Map<String,String> getProcessedInteractors()
Getter for the field
processedInteractors.- Returns:
- a
Mapobject.
-
getProcessedFeatures
protected Map<Feature,Integer> getProcessedFeatures()
Getter for the field
processedFeatures.- Returns:
- a
Mapobject.
-
getProcessedParticipants
protected Map<Entity,Integer> getProcessedParticipants()
Getter for the field
processedParticipants.- Returns:
- a
Mapobject.
-
getIdGenerator
protected IncrementalIdGenerator getIdGenerator()
Getter for the field
idGenerator.- Returns:
- a
IncrementalIdGeneratorobject.
-
setFetcher
protected void setFetcher(OntologyTermFetcher fetcher)
Setter for the field
fetcher.- Parameters:
fetcher- aOntologyTermFetcherobject.
-
-