// Path: src/org/sagemath/droid/constants/ExecutionState.java
// public class ExecutionState {
//     public static final int ERROR = 0x000300;
//     public static final int IDLE = 0x000301;
//     public static final int BUSY = 0x000302;
//     public static final int DEAD = 0x000303;
//     public static final int OK = 0x000304;
// }
// 
// Path: src/org/sagemath/droid/constants/MessageType.java
// public class MessageType {
//     public static final int ERROR = 0x000100;
//     public static final int PYOUT = 0x000101;
//     public static final int PYIN = 0x000102;
//     public static final int STATUS = 0x000103;
//     public static final int DISPLAY_DATA = 0x000104;
//     public static final int STREAM = 0x000105;
//     public static final int PYERR = 0x000106;
//     public static final int EXECUTE_REQUEST = 0x000107;
//     public static final int EXECUTE_REPLY = 0x000108;
//     public static final int HTML_FILES = 0x000109;
//     public static final int INTERACT_PREPARE = 0x000110;
//     public static final int EXTENSION = 0x000111;
//     public static final int TEXT_FILENAME = 0x000112;
//     public static final int IMAGE_FILENAME = 0x000113;
//     public static final int INTERACT = 0x000114;
//     public static final int SAGE_CLEAR = 0x000115;
// }


import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import org.sagemath.droid.constants.ExecutionState;
import org.sagemath.droid.constants.MessageType;
import org.sagemath.droid.deserializers.*;
                .registerTypeAdapter(InteractReply.InteractContent.class, new InteractContentDeserializer())
                .registerTypeAdapter(InteractReply.InteractData.class, new InteractDataDeserializer())
                .registerTypeAdapter(InteractReply.SageInteract.class, new SageInteractDeserializer())
                .registerTypeAdapter(Values.class, new ValueDeserializer())
                .create();

        //Return the appropriate BaseReply
        BaseReply baseReply = gson.fromJson(jsonString, BaseReply.class);

        reply = baseReply;
        switch (baseReply.getMessageType()) {
            case MessageType.PYIN:
                Log.i(TAG, "Returning pyin");
                return gson.fromJson(jsonString, PythonInputReply.class);
            case MessageType.PYOUT:
                Log.i(TAG, "Returning pyout");
                return gson.fromJson(jsonString, PythonOutputReply.class);
            case MessageType.STATUS:
                Log.i(TAG, "Returning status");
                StatusReply statusReply = gson.fromJson(jsonString, StatusReply.class);
                saveStatus(statusReply);
                return statusReply;
            case MessageType.STREAM:
                Log.i(TAG, "Returning Stream");
                return gson.fromJson(jsonString, StreamReply.class);
            case MessageType.PYERR:
                Log.i(TAG, "Returning Pyerr");
                return gson.fromJson(jsonString, PythonErrorReply.class);
            case MessageType.EXECUTE_REPLY:
                Log.i(TAG, "Returning execute reply");
// Path: src/org/sagemath/droid/constants/ExecutionState.java
// public class ExecutionState {
//     public static final int ERROR = 0x000300;
//     public static final int IDLE = 0x000301;
//     public static final int BUSY = 0x000302;
//     public static final int DEAD = 0x000303;
//     public static final int OK = 0x000304;
// }
// 
// Path: src/org/sagemath/droid/constants/MessageType.java
// public class MessageType {
//     public static final int ERROR = 0x000100;
//     public static final int PYOUT = 0x000101;
//     public static final int PYIN = 0x000102;
//     public static final int STATUS = 0x000103;
//     public static final int DISPLAY_DATA = 0x000104;
//     public static final int STREAM = 0x000105;
//     public static final int PYERR = 0x000106;
//     public static final int EXECUTE_REQUEST = 0x000107;
//     public static final int EXECUTE_REPLY = 0x000108;
//     public static final int HTML_FILES = 0x000109;
//     public static final int INTERACT_PREPARE = 0x000110;
//     public static final int EXTENSION = 0x000111;
//     public static final int TEXT_FILENAME = 0x000112;
//     public static final int IMAGE_FILENAME = 0x000113;
//     public static final int INTERACT = 0x000114;
//     public static final int SAGE_CLEAR = 0x000115;
// }


// Path: src/org/sagemath/droid/models/gson/BaseReply.java
import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import org.sagemath.droid.constants.ExecutionState;
import org.sagemath.droid.constants.MessageType;
import org.sagemath.droid.deserializers.*;

                .registerTypeAdapter(InteractReply.InteractContent.class, new InteractContentDeserializer())
                .registerTypeAdapter(InteractReply.InteractData.class, new InteractDataDeserializer())
                .registerTypeAdapter(InteractReply.SageInteract.class, new SageInteractDeserializer())
                .registerTypeAdapter(Values.class, new ValueDeserializer())
                .create();

        //Return the appropriate BaseReply
        BaseReply baseReply = gson.fromJson(jsonString, BaseReply.class);

        reply = baseReply;
        switch (baseReply.getMessageType()) {
            case MessageType.PYIN:
                Log.i(TAG, "Returning pyin");
                return gson.fromJson(jsonString, PythonInputReply.class);
            case MessageType.PYOUT:
                Log.i(TAG, "Returning pyout");
                return gson.fromJson(jsonString, PythonOutputReply.class);
            case MessageType.STATUS:
                Log.i(TAG, "Returning status");
                StatusReply statusReply = gson.fromJson(jsonString, StatusReply.class);
                saveStatus(statusReply);
                return statusReply;
            case MessageType.STREAM:
                Log.i(TAG, "Returning Stream");
                return gson.fromJson(jsonString, StreamReply.class);
            case MessageType.PYERR:
                Log.i(TAG, "Returning Pyerr");
                return gson.fromJson(jsonString, PythonErrorReply.class);
            case MessageType.EXECUTE_REPLY:
                Log.i(TAG, "Returning execute reply");
                return gson.fromJson(jsonString, SageExecuteReply.class);