package jetbrains.mps.lang.migration.pluginSolution.plugin; /*Generated by MPS */ import jetbrains.mps.refactoring.participant.RefactoringParticipant; import org.jetbrains.mps.openapi.model.SNode; public class SerializingParticipantState<I, F, IP, FP> { private RefactoringParticipant<I, F, IP, FP> myParticipant; private RefactoringParticipant.PersistentRefactoringParticipant<I, F, IP, FP> myPersistentParticipant; public static <I, F, IP, FP> SerializingParticipantState<I, F, IP, FP> create(RefactoringParticipant<I, F, IP, FP> participant) { if (!(participant instanceof RefactoringParticipant.PersistentRefactoringParticipant)) { return null; } return new SerializingParticipantState<I, F, IP, FP>(participant, (RefactoringParticipant.PersistentRefactoringParticipant<I, F, IP, FP>) participant); } public SerializingParticipantState(RefactoringParticipant<I, F, IP, FP> participant, RefactoringParticipant.PersistentRefactoringParticipant<I, F, IP, FP> participantPersistence) { myParticipant = participant; myPersistentParticipant = participantPersistence; } public RefactoringParticipant.PersistentRefactoringParticipant<I, F, IP, FP> getParticipant() { return myPersistentParticipant; } public SNode getSerializedInitial(IP initialPoint) { I initialState = myParticipant.getDataCollector().beforeMove(initialPoint); if (initialState == null) { return null; } return myPersistentParticipant.serializeInitialState(initialState); } public SNode getSerializedFinal(FP finalPoint) { F finalState = myParticipant.getDataCollector().afterMove(finalPoint); if (finalState == null) { return null; } return myPersistentParticipant.serializeFinalState(finalState); } }