motor updates
This commit is contained in:
parent
7eca17a372
commit
bd8e82c1d2
@ -7,7 +7,6 @@ import net.sf.openrocket.motor.ThrustCurveMotor;
|
||||
import net.sf.openrocket.util.Coordinate;
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
import android.database.SQLException;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.util.Log;
|
||||
|
||||
@ -47,7 +46,9 @@ public class MotorDao {
|
||||
this.mDb = mDb;
|
||||
}
|
||||
|
||||
static String[] create() { return new String[] {CREATE_TABLE}; }
|
||||
static String[] create() {
|
||||
return new String[] { CREATE_TABLE };
|
||||
}
|
||||
|
||||
static String[] update(int oldVer, int newVer) {
|
||||
return new String[] { DROP_TABLE, CREATE_TABLE };
|
||||
@ -107,7 +108,7 @@ public class MotorDao {
|
||||
initialValues.put(BURN_TIME, tcm.getBurnTimeEstimate());
|
||||
initialValues.put(LENGTH, tcm.getLength());
|
||||
initialValues.put(CASE_INFO, mi.getCaseInfo());
|
||||
initialValues.put(TYPE, tcm.getMotorType().getName());
|
||||
initialValues.put(TYPE, tcm.getMotorType().name());
|
||||
initialValues.put(IMPULSE_CLASS, mi.getImpulseClass());
|
||||
initialValues.put(MANUFACTURER, tcm.getManufacturer().getSimpleName());
|
||||
initialValues.put(THRUST_DATA, ConversionUtils.serializeArrayOfDouble(tcm.getThrustPoints()));
|
||||
@ -200,7 +201,12 @@ public class MotorDao {
|
||||
double avgImpulse = mCursor.getDouble(mCursor.getColumnIndex(AVG_THRUST));
|
||||
double maxThrust = mCursor.getDouble(mCursor.getColumnIndex(MAX_THRUST));
|
||||
double length = mCursor.getDouble(mCursor.getColumnIndex(LENGTH));
|
||||
Motor.Type type = Motor.Type.fromName( mCursor.getString(mCursor.getColumnIndex(TYPE)));
|
||||
Motor.Type type;
|
||||
try {
|
||||
type = Enum.valueOf(Motor.Type.class, mCursor.getString(mCursor.getColumnIndex(TYPE)));
|
||||
} catch (IllegalArgumentException e) {
|
||||
type = Motor.Type.UNKNOWN;
|
||||
}
|
||||
Manufacturer manufacturer = Manufacturer.getManufacturer(mCursor.getString(mCursor.getColumnIndex(MANUFACTURER)));
|
||||
double[] thrustData = ConversionUtils.deserializeArrayOfDouble(mCursor.getBlob(mCursor.getColumnIndex(THRUST_DATA)));
|
||||
double[] timeData = ConversionUtils.deserializeArrayOfDouble(mCursor.getBlob(mCursor.getColumnIndex(TIME_DATA)));
|
||||
@ -241,8 +247,7 @@ public class MotorDao {
|
||||
}
|
||||
mCursor.moveToFirst();
|
||||
return hydrateMotor(mCursor);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
mCursor.close();
|
||||
}
|
||||
|
||||
@ -265,8 +270,7 @@ public class MotorDao {
|
||||
}
|
||||
mCursor.moveToFirst();
|
||||
return hydrateMotor(mCursor);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
mCursor.close();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user