Selaa lähdekoodia

Class javadoc

master
Chris Smith 14 vuotta sitten
vanhempi
commit
28338879a8

+ 7
- 0
code/Common/Aggregator.java Näytä tiedosto

@@ -26,6 +26,13 @@ import java.util.HashMap;
26 26
 import java.util.Map;
27 27
 
28 28
 /**
29
+ * Aggregates a stream of classifications and performs averaging in order to
30
+ * smooth out results. Each classification supplied to the aggregator is used
31
+ * to alter the 'probabilities' of that classification holding. These
32
+ * probabilities are calculated hierarchically, and the aggregator can in some
33
+ * cases produce a result that is not in itself a normal activity because of
34
+ * this (for example, it may classify unclear data as
35
+ * <code>CLASSIFIED/VEHICLE</code>, rather than as a sub-type as expected).
29 36
  *
30 37
  * @author chris
31 38
  */

+ 2
- 0
code/Common/BaseFactory.java Näytä tiedosto

@@ -25,6 +25,8 @@ package uk.co.md87.android.common;
25 25
 import android.os.Build;
26 26
 
27 27
 /**
28
+ * Base class for sensor factory which facilitates switching to fake sources
29
+ * when running from an emulator.
28 30
  *
29 31
  * @author chris
30 32
  */

+ 5
- 1
code/Common/Classifier.java Näytä tiedosto

@@ -27,7 +27,11 @@ import java.util.Map.Entry;
27 27
 import java.util.Set;
28 28
 
29 29
 /**
30
- *
30
+ * Extracts basic features and applies a K-Nearest Network algorithm to an
31
+ * array of data in order to determine the classification. The data consists
32
+ * of two interleaved data sets, and each set has two features extracted -
33
+ * the range and the mean.
34
+ * 
31 35
  * @author chris
32 36
  */
33 37
 public class Classifier {

+ 4
- 7
code/Common/ExceptionHandler.java Näytä tiedosto

@@ -38,6 +38,8 @@ import org.apache.http.message.BasicNameValuePair;
38 38
 import org.apache.http.protocol.HTTP;
39 39
 
40 40
 /**
41
+ * An exception handler which reports any uncaught exceptions to the context
42
+ * API's website, in order to facilitate remote diagnostics of user errors.
41 43
  *
42 44
  * @author chris
43 45
  */
@@ -47,10 +49,6 @@ public class ExceptionHandler implements UncaughtExceptionHandler {
47 49
 
48 50
     private String appname, url, version, imei;
49 51
 
50
-    /*
51
-     * if any of the parameters is null, the respective functionality
52
-     * will not be used
53
-     */
54 52
     public ExceptionHandler(String appname, String url, String version, String imei) {
55 53
         this.appname = appname;
56 54
         this.url = url;
@@ -85,11 +83,10 @@ public class ExceptionHandler implements UncaughtExceptionHandler {
85 83
         nvps.add(new BasicNameValuePair("filename", filename));
86 84
         nvps.add(new BasicNameValuePair("stacktrace", stacktrace));
87 85
         try {
88
-            httpPost.setEntity(
89
-                    new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
86
+            httpPost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
90 87
             httpClient.execute(httpPost);
91 88
         } catch (IOException e) {
92
-            e.printStackTrace();
89
+            // Do nothing
93 90
         }
94 91
     }
95 92
 }

+ 2
- 0
code/Common/ModelReader.java Näytä tiedosto

@@ -30,6 +30,8 @@ import java.io.ObjectInputStream;
30 30
 import java.util.Map;
31 31
 
32 32
 /**
33
+ * Provides a static method to read model data stored in a 'raw' resource
34
+ * as a serialised map.
33 35
  *
34 36
  * @author chris
35 37
  */

+ 2
- 1
code/Common/accel/AccelReader.java Näytä tiedosto

@@ -23,7 +23,8 @@
23 23
 package uk.co.md87.android.common.accel;
24 24
 
25 25
 /**
26
- *
26
+ * Interface implemented by classes which can sample accelerometer data.
27
+ * 
27 28
  * @author chris
28 29
  */
29 30
 public interface AccelReader {

+ 1
- 0
code/Common/accel/AccelReaderFactory.java Näytä tiedosto

@@ -25,6 +25,7 @@ package uk.co.md87.android.common.accel;
25 25
 import android.content.Context;
26 26
 
27 27
 /**
28
+ * A factory which can produce an appropriate {@link AccelReader}.
28 29
  *
29 30
  * @author chris
30 31
  */

+ 2
- 0
code/Common/accel/RealAccelReader.java Näytä tiedosto

@@ -30,6 +30,8 @@ import android.hardware.SensorManager;
30 30
 import android.os.PowerManager;
31 31
 
32 32
 /**
33
+ * An accelerometer reader which reads real data from the device's
34
+ * accelerometer.
33 35
  *
34 36
  * @author chris
35 37
  */

+ 4
- 0
code/Common/accel/Sampler.java Näytä tiedosto

@@ -25,6 +25,10 @@ package uk.co.md87.android.common.accel;
25 25
 import android.os.Handler;
26 26
 
27 27
 /**
28
+ * A utility class which handles sampling accelerometer data from an
29
+ * {@link AccelReader}. The Sampler takes 128 samples with a 50ms delay between
30
+ * each sample. When the Sampler has finished, it executes a runnable so that
31
+ * the data may be retrieved and analysed.
28 32
  *
29 33
  * @author chris
30 34
  */

+ 2
- 1
code/Common/geo/FakeLocationMonitor.java Näytä tiedosto

@@ -23,7 +23,8 @@
23 23
 package uk.co.md87.android.common.geo;
24 24
 
25 25
 /**
26
- *
26
+ * A dummy location monitor for use in emulator testing.
27
+ * 
27 28
  * @author chris
28 29
  */
29 30
 public class FakeLocationMonitor implements LocationMonitor {

+ 2
- 1
code/Common/geo/LocationMonitor.java Näytä tiedosto

@@ -23,7 +23,8 @@
23 23
 package uk.co.md87.android.common.geo;
24 24
 
25 25
 /**
26
- *
26
+ * Interface implemented by classes which can monitor the user's location.
27
+ * 
27 28
  * @author chris
28 29
  */
29 30
 public interface LocationMonitor {

+ 2
- 1
code/Common/geo/LocationMonitorFactory.java Näytä tiedosto

@@ -26,7 +26,8 @@ import android.content.Context;
26 26
 import uk.co.md87.android.common.BaseFactory;
27 27
 
28 28
 /**
29
- *
29
+ * A factory which can create relevant {@link LocationMonitor} instances.
30
+ * 
30 31
  * @author chris
31 32
  */
32 33
 public class LocationMonitorFactory extends BaseFactory {

+ 2
- 0
code/Common/geo/RealLocationMonitor.java Näytä tiedosto

@@ -29,6 +29,8 @@ import android.location.LocationManager;
29 29
 import android.os.Bundle;
30 30
 
31 31
 /**
32
+ * A {@link LocationMonitor} implementation that uses the device's coarse
33
+ * (network) location provider as a data source.
32 34
  *
33 35
  * @author chris
34 36
  */

+ 3
- 0
code/ContextAnalyser/src/uk/co/md87/android/contextanalyser/ContextAnalyserService.java Näytä tiedosto

@@ -46,6 +46,9 @@ import uk.co.md87.android.common.geo.LocationMonitor;
46 46
 import uk.co.md87.android.common.geo.LocationMonitorFactory;
47 47
 
48 48
 /**
49
+ * Background service which monitors and aggregates various sources of
50
+ * contextual information, including current activity and place. Changes in
51
+ * activity or other context cause the service to emit a broadcast Intent.
49 52
  *
50 53
  * @author chris
51 54
  */

+ 1
- 0
code/ContextAnalyser/src/uk/co/md87/android/contextanalyser/DataHelper.java Näytä tiedosto

@@ -34,6 +34,7 @@ import java.util.HashMap;
34 34
 import java.util.Map;
35 35
 
36 36
 /**
37
+ * Facilitates accessing the SQLite database used for storing places.
37 38
  *
38 39
  * @author chris
39 40
  */

+ 3
- 1
code/ContextAnalyser/src/uk/co/md87/android/contextanalyser/Place.java Näytä tiedosto

@@ -23,7 +23,9 @@
23 23
 package uk.co.md87.android.contextanalyser;
24 24
 
25 25
 /**
26
- *
26
+ * A place is a named location which has some significance for the user. Most
27
+ * places come about when the user remains stationary for a period of time.
28
+ * 
27 29
  * @author chris
28 30
  */
29 31
 public class Place {

Loading…
Peruuta
Tallenna