// 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.*;
                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);
            case MessageType.INTERACT:
                Log.i(TAG, "Returning Interact");
                return gson.fromJson(jsonString, InteractReply.class);
            case MessageType.SAGE_CLEAR:
                Log.i(TAG, "Returning Sage Clear");
                return gson.fromJson(jsonString, SageClearReply.class);
            case MessageType.HTML_FILES:
                Log.i(TAG, "Returning an HTML Reply");
                return gson.fromJson(jsonString, HtmlReply.class);
            case MessageType.IMAGE_FILENAME:
                Log.i(TAG, "Returning Image Reply");
                return gson.fromJson(jsonString, ImageReply.class);
            default:
                throw new Exception("Unknown Message Type");
        }
    }

    private static void saveStatus(StatusReply statusReply) {
// 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.*;

                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);
            case MessageType.INTERACT:
                Log.i(TAG, "Returning Interact");
                return gson.fromJson(jsonString, InteractReply.class);
            case MessageType.SAGE_CLEAR:
                Log.i(TAG, "Returning Sage Clear");
                return gson.fromJson(jsonString, SageClearReply.class);
            case MessageType.HTML_FILES:
                Log.i(TAG, "Returning an HTML Reply");
                return gson.fromJson(jsonString, HtmlReply.class);
            case MessageType.IMAGE_FILENAME:
                Log.i(TAG, "Returning Image Reply");
                return gson.fromJson(jsonString, ImageReply.class);
            default:
                throw new Exception("Unknown Message Type");
        }
    }

    private static void saveStatus(StatusReply statusReply) {
        if (statusReply.getContent().getExecutionState() == ExecutionState.DEAD) {