|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectde.unikassel.android.sdcframework.transmission.SampleGatheringController
public class SampleGatheringController
A class to realize a controller for the task to select samples from the database for transfer.
It does control the available sample count in database and calculates the
necessary wait time to reach the required minimum sample count.
The available count of samples for is limited by a configurable minimum and
maximum.
The wait time calculation does depend on the current sample rate and the
required minimum of samples.
| Field Summary | |
|---|---|
private static float |
AF
The amplification factor |
private AtomicLong |
availableSampleCount
The available sample count in database |
private long |
lastRecordCount
The last record count in database |
private AtomicLong |
lastTimeStamp
The internal time stamp of last wait time calculation |
private static long |
MAX_FREQUENCY
The upper limit for wait times in milliseconds |
private AtomicInteger |
maxSampleCount
The maximum sample count to transfer |
private static long |
MIN_FREQUENCY
The lower limit for wait times in milliseconds |
private AtomicInteger |
minSampleCount
The minimum sample count to transfer |
private static long |
SAMPLE_RATE_DELAY
The delay for sample rate calculation in case of a rate change |
private boolean |
sampleRateHasChanged
Flag indicating a sample rate change |
| Constructor Summary | |
|---|---|
SampleGatheringController()
Constructor |
|
| Method Summary | |
|---|---|
private long |
calculateNewWaitTime(long sampleIncrement,
long timeInterval)
Method to calculate an updated time to wait for samples |
long |
calculatetWaitTime(long currentRecordCount)
Does calculate the necessary wait time depending on the current record count in database |
void |
consumAvailableSamples()
Method to consume available samples |
long |
getAvailableSampleCount()
Getter for the count of available samples |
int |
getMaxSampleCount()
Getter for the maximum sample count to transfer |
int |
getMinSampleCount()
Getter for the minimum sample count to transfer |
long |
getMissingSampleCount()
Method to determine the current missing sample count |
void |
onSampleRateChanged()
Method to react on signaled sample rate changes |
void |
reset(long currentRecordCount)
Does reset all values |
void |
updateConfiguration(Context context,
TransmissionConfiguration config)
Method to update the component by a configuration |
private void |
updateFields(long currentRecordCount,
long timeStamp)
Method to calculate the available sample count for collecting task |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final float AF
private static final long MAX_FREQUENCY
private static final long MIN_FREQUENCY
private static final long SAMPLE_RATE_DELAY
private final AtomicLong lastTimeStamp
private final AtomicInteger minSampleCount
private final AtomicInteger maxSampleCount
private final AtomicLong availableSampleCount
private long lastRecordCount
private boolean sampleRateHasChanged
| Constructor Detail |
|---|
public SampleGatheringController()
| Method Detail |
|---|
public final void reset(long currentRecordCount)
currentRecordCount - the current record count in databasepublic final int getMinSampleCount()
public final int getMaxSampleCount()
public final long getAvailableSampleCount()
public final void consumAvailableSamples()
public final void updateConfiguration(Context context,
TransmissionConfiguration config)
UpdatableTransmissionComponent
updateConfiguration in interface UpdatableTransmissionComponent<TransmissionConfiguration>context - the application contextconfig - the configuration to update frompublic final long calculatetWaitTime(long currentRecordCount)
currentRecordCount - the current record count in database
private final long calculateNewWaitTime(long sampleIncrement,
long timeInterval)
sampleIncrement - the current sample incrementtimeInterval - the current time interval the current error
public final long getMissingSampleCount()
private final void updateFields(long currentRecordCount,
long timeStamp)
currentRecordCount - the current record count in databasetimeStamp - the current time stamppublic final void onSampleRateChanged()
SampleRateChangeResponder
onSampleRateChanged in interface SampleRateChangeResponder
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||