@Override
    public void restore(JSONObject obj) throws JSONException {

	countOfState = obj.getInt(COUNT_OF_STATES);
	// timeInState = JSONParser.parseVector(tree.get(Time_in_state));
	// chastotaNastypleniya = JSONParser.parseVector(tree.get(Lambda));
	// changeStateMatrix = JSONParser.parseMatrix(tree.get(Inf_matrix));

	for (int i = 0; i < countOfState; i++) {
	    double summ = 0;
	    for (int j = 0; j < countOfState; j++)
		if (i != j)
		    summ += changeStateMatrix[i][j];
	    for (int j = 0; j < countOfState; j++)
		if (i != j)
		    changeStateMatrix[i][j] = changeStateMatrix[i][j] / summ;
	}
	event = new ArrayList<RandomExponentialValue>(countOfState);
	timeInCurrentState = new ArrayList<RandomExponentialValue>(countOfState);
	for (int i = 0; i < countOfState; i++) {
	    event.add(new RandomExponentialValue(chastotaNastypleniya[i]));
	    timeInCurrentState.add(new RandomExponentialValue(timeInState[i]));
	}
	stateSelector = new RandomBasicValue();

	double summ = 0;
	for (int i = 0; i < countOfState; i++)
	    summ += timeInState[i];
	for (int i = 0; i < countOfState; i++)
	    timeInState[i] = timeInState[i] / summ;
	selectState();

    }