Package org.moeaframework.core
Interface Stateful
- All Known Subinterfaces:
Algorithm
,EpsilonBoxEvolutionaryAlgorithm
,EvolutionaryAlgorithm
- All Known Implementing Classes:
AbstractAlgorithm
,AbstractEvolutionaryAlgorithm
,AbstractPSOAlgorithm
,AbstractSimulatedAnnealingAlgorithm
,AdaptiveGridArchive
,AdaptiveTimeContinuation
,AdaptiveTimeContinuationExtension
,AGEMOEAII
,AlgorithmWrapper
,AMOSA
,CheckpointExtension
,Checkpoints
,CMAES
,DBEA
,DifferentialEvolution
,EpsilonBoxDominanceArchive
,EpsilonMOEA
,EpsilonNSGAII
,EpsilonProgressContinuation
,EpsilonProgressContinuationExtension
,EvolutionStrategy
,Extensions
,FitnessBasedArchive
,GDE3
,GeneticAlgorithm
,IBEA
,InstrumentedAlgorithm
,InstrumentedExtension
,MOEAD
,MSOPS
,MSOPSRankedPopulation
,NondominatedPopulation
,NondominatedSortingPopulation
,NSGAII
,NSGAIII
,OMOPSO
,PAES
,PeriodicAction
,PeriodicExtension
,PESA2
,Population
,RandomSearch
,ReferencePointNondominatedSortingPopulation
,ReferenceVectorGuidedPopulation
,RepeatedSingleObjective
,RuntimeCollectorExtension
,RVEA
,SimulatedAnnealing
,SingleObjectiveEvolutionaryAlgorithm
,SMPSO
,SMSEMOA
,SPEA2
,UNSGAIII
,VEGA
public interface Stateful
Interface for objects that can save and load their state.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkTypeSafety
(ObjectInputStream stream, Object object) Validates the type safety information embedded in the object stream.default void
loadState
(ObjectInputStream stream) Loads the state of this object from the stream.default void
saveState
(ObjectOutputStream stream) Writes the state of this object to the stream.static void
writeTypeSafety
(ObjectOutputStream stream, Object object) Writes a field into the object stream that can be validated usingcheckTypeSafety(ObjectInputStream, Object)
.
-
Method Details
-
saveState
Writes the state of this object to the stream. The order that objects are written to the stream is important. We recommend first callingsuper.saveState(stream)
followed by writing each field.- Parameters:
stream
- the stream- Throws:
IOException
- if an I/O error occurred
-
loadState
Loads the state of this object from the stream. The order for reading objects from the stream must match the order they are written to the stream insaveState(ObjectOutputStream)
.- Parameters:
stream
- the stream- Throws:
IOException
- if an I/O error occurredClassNotFoundException
- if the stream referenced a class that is not defined
-
writeTypeSafety
Writes a field into the object stream that can be validated usingcheckTypeSafety(ObjectInputStream, Object)
.- Parameters:
stream
- the streamobject
- the stateful object- Throws:
IOException
- if an I/O error occurred
-
checkTypeSafety
static void checkTypeSafety(ObjectInputStream stream, Object object) throws IOException, ClassNotFoundException Validates the type safety information embedded in the object stream.- Parameters:
stream
- the streamobject
- the stateful object- Throws:
IOException
- if an I/O error occurred or the type safety check failedClassNotFoundException
- if the stream referenced a class that is not defined
-