|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.android.activityminer.persistence.DBAdapter
public final class DBAdapter
The database adapter class does wrap the direct Android database access.
Nested Class Summary | |
---|---|
private static class |
DBAdapter.DatabaseHelper
The internal SQLite helper class. |
static class |
DBAdapter.RecordingStates
Types for possible recording states. |
Field Summary | |
---|---|
private static String |
ADD_COLUMN
Add column table statement |
private static String |
ALTER_TABLE
Alter table statement |
private static String |
AND
The and pattern. |
private static String |
COUNT_FIELD
The count pattern. |
private static String |
COUNT_RECORDING_ID
Constant for count recording id |
private static String |
CREATE_INDEX_IF_NOT_EXISTS
Create index if not exists statement |
static String |
CREATE_TABLE
Create table statement |
private SQLiteDatabase |
db
The database |
private static String |
DB_ACTIVITY_TABLE
The table name for the activity table to store activity labels and parent relations. |
private static String |
DB_CONGIG_TABLE
The table name for configuration table |
private static String |
DB_COPY_RECORDINGS_WITH_ACTIVITY_REFERENCE
The copy statement for upgrade from version 3 to 4(5). |
private static String |
DB_CREATE_ACITIVITY_TABLE
The table creation statement for the activity label table. |
private static String |
DB_CREATE_FEATURE_VECTOR_TABLE
The table creation statement for the feature vector table. |
private static String |
DB_CREATE_INDEX2
The state index creation statement. |
private static String |
DB_CREATE_INDEX3
The sequence identifier index creation statement. |
private static String |
DB_CREATE_RECORDING_TABLE
The table creation statement for the recording table. |
private static String |
DB_DROP_FEATURE_VECTOR_TABLE
The drop statement for upgrade from version 3 to 4. |
private static String |
DB_DROP_INDEX1
The activity label index drop statement for upgrade to version 4. |
private static String |
DB_DROP_OLD_RECORDING_TABLE
The drop statement for upgrade from version 2 to 3. |
private static String |
DB_FEATURE_VECTOR_TABLE
The table name for the table with the feature vectors extracted from the overlapping windows for saved recordings data. |
private static String |
DB_FILL_IN_ACTIVITIES
The activity insertion statement for upgrade from version 3 to 4. |
static String |
DB_INDEX1
The activity label index name. |
static String |
DB_INDEX2
The processing state index name. |
static String |
DB_INDEX3
The sequence identifier index name. |
private static String |
DB_RECORDING_TABLE
The recording table name. |
private static String |
DB_RECREATE_INDEX1
The new activity label index creation statement. |
private static String |
DB_RENAME_RECORDING_TABLE
The renaming statement for upgrades. |
private static String |
DB_SEQUENCE_NEXT_ID_TABLE
The recording sequences last id table name. |
private static int |
DB_VERSION
The database version. |
private DBAdapter.DatabaseHelper |
dbHelper
The SQLite helper |
private String |
dbName
The database name. |
private static String |
DROP_INDEX_IF_EXISTS
Drop index if exists statement |
private static String |
DROP_TABLE
Drop table statement |
private static String |
FIELD_EQUALS
The equals pattern. |
private static String |
IN
The in pattern. |
private static String |
INSERT_INTO
Insert into statement |
static int |
INVALID_ID
Constant for invalid id's |
private static String |
KEY_CFG_BACKUP
Configuration backup column |
private static String |
KEY_DURATION
The duration column name, for the time the recording was saved. |
private static String |
KEY_FEATURE_VECTOR
The feature vector column. |
private static String |
KEY_FEATURE_VECTOR_ID
The feature vector and row identifier column name. |
private static String |
KEY_FRAME_DATA
The recording data column name. |
private static String |
KEY_FVEC_COUNT
The feature vector count column name. |
private static String |
KEY_LABEL
The recording activity label column name. |
private static String |
KEY_LABEL_ID
The recording activity label identifier column name. |
private static String |
KEY_PARENT_ID
The column name for a parent activity reference |
private static String |
KEY_REC_COUNT
The recording count column name. |
private static String |
KEY_RECORDING_ID
The recording and row identifier column name. |
private static String |
KEY_SAMPLERATE
Sample rate column |
private static String |
KEY_SEQUENCE_ID
The sequence identifier column name |
private static String |
KEY_STATE
The recording processing state flag column name. |
static String |
KEY_TS
The recording time stamp column name, for the recording start time. |
private static String |
KEY_UUID
UUID column |
private static String |
LENGTH_RECORDING_DATA
Constant for length of the recording data field |
private static int |
MAX_DATA
Equals statement pattern. |
private static String |
ON
On statement |
private static String |
ORDER_BY_FEATURE_VEC_ID_ASC
Constant for ascending order by feature vector id |
private static String |
ORDER_BY_RECORDING_ID_ASC
Constant for ascending order by recording id |
private static String |
ORDER_BY_SEQUENCE_ID_ASC
Constant for ascending order by continuous recording sequence id |
private static String |
ORDER_BY_SEQUENCE_ID_RECORDING_ID_ASC
Order by clause for the recording statistics functions |
private static String |
PLACE_HOLDER
The place holder pattern. |
private static String |
QUERY_FEATURE_VECTOR_COUNT_FOR_LABEL_ID
Query to count feature vectors for labels |
private static String |
QUERY_LABEL_IDS_WITH_EXTRACTED_FEATURE_VECTORS
Query to find activity labels with extracted feature vectors |
private static String |
RENAME_TO
Rename to statement |
private static String |
SUBSTR_RECORDING_DATA_FROM_POS
Constant for substring of the recording data field |
private static String |
TMP_ALIAS
temporary result filed alias |
private static String |
TMP_TABLE_NAME
The backup table name for upgrade from version 2 to 3. |
private static String |
UPDATE_ACTIVITY_REC_COUNT_WHERE_LABEL_ID_EQUALS
Update statement for record count in the activity table |
private static String |
UPDATE_NEXT_SEQUENCE_ID
Update statement for the configuration table ( version 8 ) |
private static String |
UPDATE_RECORDING_FVEC_COUNT_WHERE_RECORDING_ID_EQUALS
Update statement for feature vector count in the recording table |
private static String |
UPDATE_RECORDING_TABLE_SET_SID_TO_RECID
Update statement for the recording table ( version 8 ) |
private static String |
WHERE_FEATURE_VEC_ID_EQUALS
Constant for where feature vector id equals value |
private static String |
WHERE_LABEL_EQUALS
Constant for where label equals value |
private static String |
WHERE_LABEL_ID_EQUALS
Constant for where label id equals value |
private static String |
WHERE_RECORDING_ID_EQUALS
Constant for where recording id equals value |
private static String |
WHERE_SEQUENCE_ID_EQUALS
Constant for where sequence id equals value |
private static String |
WHERE_STATE_EQUALS
Constant for where state equals value |
Constructor Summary | |
---|---|
DBAdapter(String dbName,
Context context)
Constructor |
|
DBAdapter(String dbName,
long maxDBSize,
Context context)
Constructor |
Method Summary | |
---|---|
void |
close()
Method to close the database |
private String |
createInStatement(String column,
int cntValues)
Does create an in statement for a given value list |
private String[] |
createStringArray(List<? extends Object> list)
Does create a string array representation of a list of objects |
void |
deleteActivityLabelId(long activityLabelId)
Does delete the activity table entry for a given activity label |
boolean |
deleteAllFeatureVectors()
Method to delete all stored feature vectors at once. |
protected static boolean |
deleteAllFeatureVectors(SQLiteDatabase db)
Method to delete all stored feature vectors at once. |
boolean |
deleteAllRecordings()
Method to delete all stored recordings at once, together with related feature vectors. |
int |
deleteFeatureVectors(Long recordingId)
Method to delete all stored feature vectors for a given recording |
void |
deleteFeatureVectorsForLabels(List<Long> activityLabelIds)
Method to delete all stored feature vectors for a set of labels |
int |
deleteRecording(long recordingId)
Does delete the recording with the given identifier and all related features. |
int |
deleteRecordings(List<Long> recordingIds)
Does delete the recordings with the given identifiers and all related features. |
int |
deleteRecordingsWithActivityLabel(ActivityLabel activityLabel)
Does delete the recording with the given label. |
int |
deleteSequence(long sId)
Does delete all recordings with the given sequence identifier |
private DBFeatureVector |
featureVectorFromCursor(Cursor cursor)
Does create a recording from the current cursor position. |
long |
getActivityCount()
Method to get the current activity count. |
private Long |
getActivityIdForLabelName(String activityLabelName)
Does get the activity label identifier for a given name |
private long |
getActivityLabelIdForRecordingId(long recordingId)
Getter for the activity label identifier of a recording. |
private long |
getActivityLabelIdForSequenceId(long sid)
Getter for the activity label identifier of a sequence. |
List<Long> |
getActivityLabelIdsWithSamplesIgnoreDependecies()
Getter for all activity labels with extracted training samples. |
String |
getActivityLabelNameForId(long activityLabelId)
Does get the activity label name for a given identifier |
private Cursor |
getActivityLabels()
Method to get the current activity label count from the activity table. |
private static Set<Long> |
getAffectedActivityLabelNames(ActivityLabelMap mapActivityLabels,
long activityLabelId)
Method to extract successor activities for a given activity label identifier |
ActivityLabelMap |
getAvailableActivityLabels()
Getter for a map with all available activity labels. |
List<Long> |
getAvailableFeatureVectorIds()
Getter for all available feature vector identifiers. |
List<Long> |
getAvailableFeatureVectorIdsForActivityLabelId(long activityId)
Getter for all available feature vector identifiers. |
List<Long> |
getAvailableFeatureVectorIdsForRecording(long recordingId)
Getter for all available feature vector identifiers for a given recoding identifier. |
List<Long> |
getAvailableRecordingIds()
Getter for all available recording identifiers. |
List<Long> |
getAvailableRecordingIds(DBAdapter.RecordingStates state)
Getter for all available recording identifiers for a given processing state. |
private List<Long> |
getAvailableRecordingIds(DBAdapter.RecordingStates state,
List<Long> activityLabelIds)
Getter for all available recording identifiers for a given processing state an optional subset of labels. |
List<Long> |
getAvailableRecordingIdsForActivityLabelId(long activityLabelId)
Getter for all available recording identifiers for a given activity label |
private List<Long> |
getAvailableRecordingIdsForActivityNames(Set<Long> activityLabelIds)
Getter for all available recording identifiers for a given set of activity identifiers |
List<Long> |
getAvailableSequenceIds()
Getter for all available recording identifiers. |
String |
getConfigurationFromDB()
Does get the sample rate from an sqlite database |
private Cursor |
getCursorForAvailableFeatureVectorIds()
Getter for all available feature vector identifiers |
private Cursor |
getCursorForAvailableFeatureVectorIds(long recordingId)
Getter for a cursor for available feature vector identifiers for a given recording identifier. |
String |
getDatabaseName()
Getter for the database name. |
DBStatistic |
getDBStatistic(boolean recordingsWithSamplesOnly,
boolean skipSampleCounts)
Getter for statistics about the stored feature vectors per activity label. |
private DBStatistic |
getDBStatistics(boolean activitiesWithSamplesOnly,
boolean skipSampleCounts,
ActivityLabelMap mapActivityLabels)
Getter for statistics about the stored feature vectors and recordings per activity label. |
DBFeatureVector |
getFeatureVector(Long id)
Method to retrieve a feature vector by its id. |
private Cursor |
getFeatureVectorById(Long id)
Getter for a feature vector by its unique identifier. |
long |
getFeatureVectorCount()
Method to get the current count of stored feature vector. |
private long |
getFeatureVectorCountForActivityLabelId(long activityLabelId)
Method to get the current feature vector count for given activity label. |
long |
getFeatureVectorCountForRecoding(long recordingId)
Method to get the feature vector count for a given recording identifier. |
private Cursor |
getLabelSequenceStateAndTimesForRecording(Long recordingId)
Getter for a recording by its unique identifier. |
long |
getMaximumDatabaseSize()
Getter for the maximum database size |
List<Long> |
getNewSequenceIdentifiers()
Getter for all available new continuous recording sequence identifiers. |
long |
getNextRecordingSequenceId()
Does determine the next unique sequence identifier |
long |
getPageSize()
Getter for the current database page size in bytes |
protected static Cursor |
getPartialRecordingData(SQLiteDatabase db,
Long recordingId,
int pos,
int cnt)
Access to substrings from recording data |
DBRecording |
getRecording(Long recordingId)
Method to retrieve a recordings by its id. |
long |
getRecordingCount()
Method to get the current recording count. |
long |
getRecordingCountForActivityLabelId(long activityId)
Method to get the current recording count for given activity id. |
long |
getRecordingCountForState(DBAdapter.RecordingStates state)
Method to get the current recording count for a given state. |
private long |
getRecordingCountForStateAndActivityLabelIds(DBAdapter.RecordingStates state,
List<Long> listActivityLabelIds)
Method to get the current recording count for a given state and an optional subset of label identifiers. |
private static String |
getRecordingData(SQLiteDatabase db,
Long recordingId)
Getter for the recording data by its unique identifier. |
private Cursor |
getRecordingIdsForActivityLabel(Long activityId)
Getter for available recording identifiers for a given activity label |
private Cursor |
getRecordingIdsForForStateAndActivityLabelIds(DBAdapter.RecordingStates state,
List<Long> activityLabelIds)
Getter for available recording identifiers for a given state. |
List<Long> |
getRecordingIdsForSequenceId(long sid)
Does look up the recording identifiers of a given sequence identifier |
protected static int |
getRecordingSize(SQLiteDatabase db,
Long recordingId)
Getter for the size of the recording data field |
DBRecordingStatistic |
getRecordingStatistics()
Getter for statistics about the stored recordings. |
long |
getSampleRate()
Does get the sample rate |
static long |
getSampleRateFromDB(SQLiteDatabase db)
Does get the sample rate from an sqlite database |
List<DBSampleStatistic> |
getSampleStatistics(long[] activityLabelIds)
Method to get sample and recording statistics for the given activity labels |
private Cursor |
getSequenceIdentifiersForNewRecordings()
Getter for new continuous recording sequence identifiers (by searching for unprocessed recordings). |
String |
getUuid()
Does get the sample rate from an sqlite database |
static int |
getVersion()
Getter for the supported database version |
boolean |
insertActivityLabelByName(String newActivityLabel)
Does insert an activity table entry for a new activity label |
private Long |
insertActivityLabelIfNotExists(ActivityLabel activitylabel)
Method to insert a new activity label into the database. |
long |
insertFeatureVector(DBFeatureVector vector,
Long idRecording)
Method to insert an extracted feature vector for a given recording. |
Long |
insertRecording(DBRecording recording)
Method to insert a labeled time series frame into the database. |
DBAdapter |
open()
Method to open the database for write access |
DBAdapter |
openForRead()
Method to open the database for read access |
boolean |
renameSequence(long sid,
Long activityLabelId)
Does update the activity assignment for all recordings with the given sequence identifier |
boolean |
requiresRawDataUpgrade()
Test method for the requirement of an upgrade of the raw time series data (for compatibility of older DB versions) |
long |
setMaximumDatabaseSize(long size)
Setter for the maximum database size |
protected void |
storeConfigurationToDB(String config)
Method to update the stored configuration |
boolean |
updateActivityLabel(ActivityLabel activityLabel)
Does update the activity table entry for an existing activity label. |
boolean |
updateAllRecordingStates(DBAdapter.RecordingStates state)
Method to update the processing state for all existing recordings. |
protected void |
updateFeatureVectorCountInRecordingTable(SQLiteDatabase db,
Long recordingId,
int featureVecCountUpdateValue)
Does update the feature vector count for a given recording identifier |
protected void |
updateRecordingCountInActivityTable(SQLiteDatabase db,
long activityId,
int recCountUpdateValue)
Does update the recording count for a given activity identifier |
boolean |
updateRecordingData(DBRecording recording)
Method to update the recording data. |
boolean |
updateRecordingState(Long recordingId,
DBAdapter.RecordingStates state)
Method to update the processing state for an existing recoding. |
void |
updateSampleRate(long sampleRate)
Method to update the sample rate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int INVALID_ID
private static final String TMP_ALIAS
private static final String RENAME_TO
private static final String ALTER_TABLE
private static final String ADD_COLUMN
private static final String INSERT_INTO
private static final String DROP_TABLE
public static final String CREATE_TABLE
private static final String ON
private static final String CREATE_INDEX_IF_NOT_EXISTS
private static final String DROP_INDEX_IF_EXISTS
private static final String AND
private static final String COUNT_FIELD
private static final String FIELD_EQUALS
private static final String IN
private static final String PLACE_HOLDER
private static final int MAX_DATA
private static final String KEY_RECORDING_ID
private static final String KEY_SEQUENCE_ID
private static final String KEY_FRAME_DATA
private static final String KEY_LABEL_ID
private static final String KEY_LABEL
private static final String KEY_REC_COUNT
private static final String KEY_FVEC_COUNT
public static final String KEY_TS
private static final String KEY_DURATION
private static final String KEY_STATE
private static final String KEY_FEATURE_VECTOR_ID
private static final String KEY_PARENT_ID
private static final String KEY_FEATURE_VECTOR
private static final String KEY_SAMPLERATE
private static final String KEY_UUID
private static final String KEY_CFG_BACKUP
private static final String ORDER_BY_SEQUENCE_ID_RECORDING_ID_ASC
private static final String ORDER_BY_RECORDING_ID_ASC
private static final String ORDER_BY_SEQUENCE_ID_ASC
private static final String ORDER_BY_FEATURE_VEC_ID_ASC
private static final String WHERE_LABEL_ID_EQUALS
private static final String WHERE_LABEL_EQUALS
private static final String WHERE_STATE_EQUALS
private static final String LENGTH_RECORDING_DATA
private static final String SUBSTR_RECORDING_DATA_FROM_POS
private static final String WHERE_RECORDING_ID_EQUALS
private static final String WHERE_SEQUENCE_ID_EQUALS
private static final String COUNT_RECORDING_ID
private static final String WHERE_FEATURE_VEC_ID_EQUALS
private static final String DB_RECORDING_TABLE
private static final String DB_SEQUENCE_NEXT_ID_TABLE
private static final String DB_FEATURE_VECTOR_TABLE
private static final String DB_ACTIVITY_TABLE
private static final String DB_CONGIG_TABLE
private static final String QUERY_FEATURE_VECTOR_COUNT_FOR_LABEL_ID
private static final String QUERY_LABEL_IDS_WITH_EXTRACTED_FEATURE_VECTORS
private static final String UPDATE_ACTIVITY_REC_COUNT_WHERE_LABEL_ID_EQUALS
private static final String UPDATE_RECORDING_FVEC_COUNT_WHERE_RECORDING_ID_EQUALS
private static final String UPDATE_RECORDING_TABLE_SET_SID_TO_RECID
private static final String UPDATE_NEXT_SEQUENCE_ID
public static final String DB_INDEX1
public static final String DB_INDEX2
public static final String DB_INDEX3
private static final int DB_VERSION
private static final String DB_CREATE_ACITIVITY_TABLE
private static final String DB_CREATE_RECORDING_TABLE
private static final String DB_FILL_IN_ACTIVITIES
private static final String TMP_TABLE_NAME
private static final String DB_RENAME_RECORDING_TABLE
private static final String DB_COPY_RECORDINGS_WITH_ACTIVITY_REFERENCE
private static final String DB_DROP_OLD_RECORDING_TABLE
private static final String DB_DROP_FEATURE_VECTOR_TABLE
private static final String DB_CREATE_FEATURE_VECTOR_TABLE
private static final String DB_DROP_INDEX1
private static final String DB_RECREATE_INDEX1
private static final String DB_CREATE_INDEX2
private static final String DB_CREATE_INDEX3
private final DBAdapter.DatabaseHelper dbHelper
private SQLiteDatabase db
private String dbName
Constructor Detail |
---|
public DBAdapter(String dbName, Context context)
dbName
- the database namecontext
- the application contextpublic DBAdapter(String dbName, long maxDBSize, Context context)
dbName
- the database namemaxDBSize
- the maximum database sizecontext
- the application contextMethod Detail |
---|
public final DBAdapter open() throws SQLiteException
SQLiteException
- if unable to open the databasepublic final DBAdapter openForRead() throws SQLiteException
SQLiteException
- if unable to open the databasepublic final void close()
public final long setMaximumDatabaseSize(long size)
size
- the maximum database size
public final long getMaximumDatabaseSize()
public final long getPageSize()
public static final long getSampleRateFromDB(SQLiteDatabase db)
db
- the database to query
public final void updateSampleRate(long sampleRate)
sampleRate
- the sample rate to updatepublic final long getSampleRate()
public final String getConfigurationFromDB()
public final String getUuid()
protected final void storeConfigurationToDB(String config)
config
- the XML representation of the configuration to storepublic final long getNextRecordingSequenceId()
public final void deleteActivityLabelId(long activityLabelId)
activityLabelId
- the activity label identifier to delete activity forpublic final int deleteSequence(long sId)
sId
- the unique identifier of the recording to delete
public final boolean renameSequence(long sid, Long activityLabelId)
sid
- the unique identifier of the recording to deleteactivityLabelId
- the new activity label id
public final boolean deleteAllRecordings()
public final int deleteRecording(long recordingId)
recordingId
- the unique identifier of the recording to delete
public final int deleteRecordings(List<Long> recordingIds)
recordingIds
- s list with unique identifiers of the recordings to delete
protected void updateRecordingCountInActivityTable(SQLiteDatabase db, long activityId, int recCountUpdateValue)
db
- the databaserecCountUpdateValue
- the value to update recording count with, can be negative for
deleted recordingsactivityId
- the activity identifierpublic final int deleteRecordingsWithActivityLabel(ActivityLabel activityLabel)
activityLabel
- the activity label
protected static final boolean deleteAllFeatureVectors(SQLiteDatabase db)
db
- the database to use
public final boolean deleteAllFeatureVectors()
public final void deleteFeatureVectorsForLabels(List<Long> activityLabelIds)
activityLabelIds
- the list with the activity label identifierspublic final int deleteFeatureVectors(Long recordingId)
recordingId
- the recording identifier
protected void updateFeatureVectorCountInRecordingTable(SQLiteDatabase db, Long recordingId, int featureVecCountUpdateValue)
db
- the databaserecordingId
- the recording identifierfeatureVecCountUpdateValue
- the value to update feature vector count with, can be negative for
deleted samplespublic final long insertFeatureVector(DBFeatureVector vector, Long idRecording) throws Exception
vector
- the feature vector to insertidRecording
- the unique identifier of the recording, this feature vector
is associated with
Exception
- in case of SQL or serialization errorsprivate final Long insertActivityLabelIfNotExists(ActivityLabel activitylabel) throws Exception
activitylabel
- the activity label to insert.
Exception
- in case of SQL or serialization errorspublic final boolean insertActivityLabelByName(String newActivityLabel)
newActivityLabel
- the new activity label to insert
public final boolean updateActivityLabel(ActivityLabel activityLabel)
activityLabel
- the activity label to update
public final Long insertRecording(DBRecording recording) throws Exception
recording
- the recording to insert.
Exception
- in case of SQL or serialization errorspublic final long getFeatureVectorCount()
public final long getFeatureVectorCountForRecoding(long recordingId)
recordingId
- the feature vector count for a given recording identifier
private final Cursor getCursorForAvailableFeatureVectorIds(long recordingId)
recordingId
- the recording identifier
private final Cursor getCursorForAvailableFeatureVectorIds()
public final List<Long> getAvailableFeatureVectorIds()
public final List<Long> getAvailableFeatureVectorIdsForRecording(long recordingId)
recordingId
- the recording identifier
public final List<Long> getAvailableFeatureVectorIdsForActivityLabelId(long activityId)
activityId
- the activity label identifier to get feature vector
identifiers for
private final Cursor getFeatureVectorById(Long id)
id
- the recording identifier
private final DBFeatureVector featureVectorFromCursor(Cursor cursor) throws Exception
cursor
- the database cursor
Exception
public final DBFeatureVector getFeatureVector(Long id) throws Exception
id
- the feature vector identifier
Exception
public final List<Long> getActivityLabelIdsWithSamplesIgnoreDependecies()
public final DBRecordingStatistic getRecordingStatistics()
private final DBStatistic getDBStatistics(boolean activitiesWithSamplesOnly, boolean skipSampleCounts, ActivityLabelMap mapActivityLabels)
activitiesWithSamplesOnly
- if true, activities without samples will be ignoredskipSampleCounts
- flag if sample count calculation shall be skippedmapActivityLabels
- the activity label map to use
public final DBStatistic getDBStatistic(boolean recordingsWithSamplesOnly, boolean skipSampleCounts)
recordingsWithSamplesOnly
- if true, recordings without samples will be ignoredskipSampleCounts
- flag if sample count calculation shall be skipped
public List<DBSampleStatistic> getSampleStatistics(long[] activityLabelIds)
activityLabelIds
- the activity labels identifier to get sample statistics for
public final long getActivityCount()
public final long getRecordingCount()
public final long getRecordingCountForState(DBAdapter.RecordingStates state)
state
- the processing state
private final long getRecordingCountForStateAndActivityLabelIds(DBAdapter.RecordingStates state, List<Long> listActivityLabelIds)
state
- the processing statelistActivityLabelIds
- a list with the activity label identifiers to get recordings for,
null or an empty list will give records for any activity label
public final long getRecordingCountForActivityLabelId(long activityId)
activityId
- the unique activity id
private final long getFeatureVectorCountForActivityLabelId(long activityLabelId)
activityLabelId
- the activity label
private final long getActivityLabelIdForSequenceId(long sid)
sid
- the sequence identifier
private final long getActivityLabelIdForRecordingId(long recordingId)
recordingId
- the recoding identifier
private final Cursor getActivityLabels()
public final ActivityLabelMap getAvailableActivityLabels()
private final Cursor getRecordingIdsForActivityLabel(Long activityId)
activityId
- the activity identifier
private final Cursor getRecordingIdsForForStateAndActivityLabelIds(DBAdapter.RecordingStates state, List<Long> activityLabelIds)
state
- the recording stateactivityLabelIds
- a set with the activity label identifiers to get
recordings for, null or an empty set will return records for any
activity label
private final Cursor getSequenceIdentifiersForNewRecordings()
private final String createInStatement(String column, int cntValues)
column
- the column to refer tocntValues
- the count of values
public final List<Long> getAvailableSequenceIds()
public final List<Long> getAvailableRecordingIds()
public final List<Long> getAvailableRecordingIds(DBAdapter.RecordingStates state)
state
- the state of the recordings
public final List<Long> getNewSequenceIdentifiers()
private static final Set<Long> getAffectedActivityLabelNames(ActivityLabelMap mapActivityLabels, long activityLabelId)
mapActivityLabels
- an actual map with all activitiesactivityLabelId
- a list with activity label identifiers, to determine all
successors for
private final List<Long> getAvailableRecordingIds(DBAdapter.RecordingStates state, List<Long> activityLabelIds)
state
- the state of the recordingsactivityLabelIds
- the list with the activity label identifiers, can be null
to get records for any activity label
public final List<Long> getAvailableRecordingIdsForActivityLabelId(long activityLabelId)
activityLabelId
- the activity label identifier
private final List<Long> getAvailableRecordingIdsForActivityNames(Set<Long> activityLabelIds)
activityLabelIds
- the activity identifier set
private final Cursor getLabelSequenceStateAndTimesForRecording(Long recordingId)
recordingId
- the recording identifier
protected static final Cursor getPartialRecordingData(SQLiteDatabase db, Long recordingId, int pos, int cnt)
db
- the databaserecordingId
- the recording identifierpos
- the data start positioncnt
- the data end position
protected static final int getRecordingSize(SQLiteDatabase db, Long recordingId)
db
- the databaserecordingId
- the recording identifier
private static final String getRecordingData(SQLiteDatabase db, Long recordingId)
db
- the databaserecordingId
- the recording identifier
public final List<Long> getRecordingIdsForSequenceId(long sid)
sid
- the sequence identifier
public final DBRecording getRecording(Long recordingId)
recordingId
- the recording identifier
public final String getActivityLabelNameForId(long activityLabelId)
activityLabelId
- the activity label identifier
private final Long getActivityIdForLabelName(String activityLabelName)
activityLabelName
- the activity label name
public final boolean updateRecordingState(Long recordingId, DBAdapter.RecordingStates state)
recordingId
- the unique recording identifierstate
- the new processing state
public final boolean updateRecordingData(DBRecording recording)
recording
- the recording data
private String[] createStringArray(List<? extends Object> list)
list
- the list to create a string array from
public final boolean updateAllRecordingStates(DBAdapter.RecordingStates state)
state
- the new processing state
public final String getDatabaseName()
public static final int getVersion()
public boolean requiresRawDataUpgrade()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |