from 70f00190a01978781701913a2ee705293c1ba2ba
diff --git a/content/404.html b/content/404.html
index 050f5f6..c0a9cae 100644
--- a/content/404.html
+++ b/content/404.html
@@ -566,7 +566,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/algolia_search.json b/content/algolia_search.json
index f69973e..6cbc069 100644
--- a/content/algolia_search.json
+++ b/content/algolia_search.json
@@ -185,7 +185,7 @@
 "keywords": "",
 "url": "../recipes/recipe_different_processing_against_stream",
 "summary": "",
-"body": "In the previous [recipe](recipe_value_out_of_range), we learned how to filter a stream to obtain the interesting sensor readings and ignore the mundane data. Typically, a user scenario is more involved, where data is processed using different stream operations. Consider the following scenario, for example.Suppose a package delivery company would like to monitor the gas mileage of their delivery trucks using embedded sensors. They would like to apply different analytics to the sensor data that can be used to make more informed business decisions. For instance, if a truck is reporting consistently poor mileage readings, the company might want to consider replacing that truck to save on gas costs. Perhaps the company also wants to convert the sensor readings to JSON format in order to easily display the data on a web page. It may also be interested in determining the expected gallons of gas used based on the current mileage.In this instance, we can take the stream of mileage sensor readings and apply multiple types of processing against it so that we end up with streams that serve different purposes.## Setting up the applicationWe assume that the environment has been set up following the steps outlined in the [Getting started guide](../docs/quarks-getting-started). Let's begin by creating a `DirectProvider` and `Topology`. We choose a `DevelopmentProvider` so that we can view the topology graph using the console URL (refer to the [Application console](../docs/console) page for a more detailed explanation of this provider). The initial mileage value and the number of miles in a typical delivery route have also been defined.```java    import java.text.DecimalFormat;    import java.util.Random;    import java.util.concurrent.TimeUnit;    import com.google.gson.JsonObject;    import quarks.console.server.HttpServer;    import quarks.providers.development.DevelopmentProvider;    import quarks.providers.direct.DirectProvider;    import quarks.topology.TStream;    import quarks.topology.Topology;    public class ApplyDifferentProcessingAgainstStream {        /**         * Hypothetical values for the initial gas mileage and the         * number of miles in a typical delivery route         */        static double currentMileage = 10.5;        static double ROUTE_MILES = 80;        public static void main(String[] args) throws Exception {            DirectProvider dp = new DevelopmentProvider();            System.out.println(dp.getServices().getService(HttpServer.class).getConsoleUrl());            Topology top = dp.newTopology(\"TruckSensor\");            // The rest of the code pieces belong here        }    }```## Generating mileage sensor readingsThe next step is to simulate a stream of gas mileage readings. In our `main()`, we use the `poll()` method to generate a flow of tuples (readings), where each tuple arrives every second. We ensure that the generated reading is between 7.0 mpg and 14.0 mpg.```java    // Generate a stream of mileage sensor readings    DecimalFormat df = new DecimalFormat(\"#.#\");    Random r = new Random();    TStream mileage = top.poll(() -> {        // Change current mileage by some random amount between -0.4 and 0.4        while (true) {            double newMileage = -0.4 + (0.4 + 0.4) * r.nextDouble() + currentMileage;            // Ensure that new temperature is within [7.0, 14.0]            if (newMileage >= 7.0 && newMileage  poorMileage = mileage            .filter(mpg -> mpg  json = mileage            .map(mpg -> {                JsonObject jObj = new JsonObject();                jObj.addProperty(\"mileage\", mpg);                return jObj;            }).tag(\"mapped\");```In addition, we can calculate the estimated gallons of gas used based on the current mileage using `modify`.```java    // Modify mileage stream to obtain a stream containing the estimated gallons of gas used    TStream gallonsUsed = mileage            .modify(mpg -> Double.valueOf(df.format(ROUTE_MILES / mpg))).tag(\"modified\");```The three examples demonstrated here are a small subset of the many other possibilities of stream processing.With each of these resulting streams, the company can perform further analytics, but at this point, we terminate the streams by printing out the tuples on each stream.```java    // Terminate the streams    poorMileage.sink(mpg -> System.out.println(\"Poor mileage! \" + mpg + \" mpg\"));    json.sink(mpg -> System.out.println(\"JSON: \" + mpg));    gallonsUsed.sink(gas -> System.out.println(\"Gallons of gas: \" + gas + \"\\n\"));```We end our application by submitting the `Topology`.## Observing the outputWhen the final application is run, the output looks something like the following:```    JSON: {\"mileage\":9.5}    Gallons of gas: 8.4    JSON: {\"mileage\":9.2}    Gallons of gas: 8.7    Poor mileage! 9.0 mpg    JSON: {\"mileage\":9.0}    Gallons of gas: 8.9    Poor mileage! 8.8 mpg    JSON: {\"mileage\":8.8}    Gallons of gas: 9.1```## A look at the topology graphLet's see what the topology graph looks like. We can view it using the console URL that was printed to standard output at the start of the application. We see that original stream is fanned out to three separate streams, and the `filter`, `map`, and `modify` operations are applied.## The final application```java    import java.text.DecimalFormat;    import java.util.Random;    import java.util.concurrent.TimeUnit;    import com.google.gson.JsonObject;    import quarks.console.server.HttpServer;    import quarks.providers.development.DevelopmentProvider;    import quarks.providers.direct.DirectProvider;    import quarks.topology.TStream;    import quarks.topology.Topology;    /**     * Fan out stream and perform different analytics on the resulting streams.     */    public class ApplyDifferentProcessingAgainstStream {        /**         * Hypothetical values for the initial gas mileage and the         * number of miles in a typical delivery route         */        static double currentMileage = 10.5;        static double ROUTE_MILES = 80;        /**         * Polls a simulated delivery truck sensor to periodically obtain         * mileage readings (in miles/gallon). Feed the stream of sensor         * readings to different functions (filter, map, and modify).         */        public static void main(String[] args) throws Exception {            DirectProvider dp = new DevelopmentProvider();            System.out.println(dp.getServices().getService(HttpServer.class).getConsoleUrl());            Topology top = dp.newTopology(\"TruckSensor\");            // Generate a stream of mileage sensor readings            DecimalFormat df = new DecimalFormat(\"#.#\");            Random r = new Random();            TStream mileage = top.poll(() -> {                // Change current mileage by some random amount between -0.4 and 0.4                while (true) {                    double newMileage = -0.4 + (0.4 + 0.4) * r.nextDouble() + currentMileage;                    // Ensure that new temperature is within [7.0, 14.0]                    if (newMileage >= 7.0 && newMileage  poorMileage = mileage                    .filter(mpg -> mpg  json = mileage                    .map(mpg -> {                        JsonObject jObj = new JsonObject();                        jObj.addProperty(\"mileage\", mpg);                        return jObj;                    }).tag(\"mapped\");            // Modify mileage stream to obtain a stream containing the estimated gallons of gas used            TStream gallonsUsed = mileage                    .modify(mpg -> Double.valueOf(df.format(ROUTE_MILES / mpg))).tag(\"modified\");            // Terminate the streams            poorMileage.sink(mpg -> System.out.println(\"Poor mileage! \" + mpg + \" mpg\"));            json.sink(mpg -> System.out.println(\"JSON: \" + mpg));            gallonsUsed.sink(gas -> System.out.println(\"Gallons of gas: \" + gas + \"\\n\"));            dp.submit(top);        }    }```"
+"body": "In the previous [recipe](recipe_value_out_of_range), we learned how to filter a stream to obtain the interesting sensor readings and ignore the mundane data. Typically, a user scenario is more involved, where data is processed using different stream operations. Consider the following scenario, for example.Suppose a package delivery company would like to monitor the gas mileage of their delivery trucks using embedded sensors. They would like to apply different analytics to the sensor data that can be used to make more informed business decisions. For instance, if a truck is reporting consistently poor gas mileage readings, the company might want to consider replacing that truck to save on gas costs. Perhaps the company also wants to convert the sensor readings to JSON format in order to easily display the data on a web page. It may also be interested in determining the expected gallons of gas used based on the current gas mileage.In this instance, we can take the stream of gas mileage sensor readings and apply multiple types of processing against it so that we end up with streams that serve different purposes.## Setting up the applicationWe assume that the environment has been set up following the steps outlined in the [Getting started guide](../docs/quarks-getting-started). Let's begin by creating a `DirectProvider` and `Topology`. We choose a `DevelopmentProvider` so that we can view the topology graph using the console URL (refer to the [Application console](../docs/console) page for a more detailed explanation of this provider). The gas mileage bounds, initial gas mileage value, and the number of miles in a typical delivery route have also been defined.```java    import java.text.DecimalFormat;    import java.util.concurrent.TimeUnit;    import com.google.gson.JsonObject;    import quarks.analytics.sensors.Ranges;    import quarks.console.server.HttpServer;    import quarks.providers.development.DevelopmentProvider;    import quarks.providers.direct.DirectProvider;    import quarks.samples.utils.sensor.SimpleSimulatedSensor;    import quarks.topology.TStream;    import quarks.topology.Topology;    public class ApplyDifferentProcessingAgainstStream {        /**         * Gas mileage (in miles per gallon, or mpg) value bounds         */        static double MPG_LOW = 7.0;        static double MPG_HIGH = 14.0;        /**         * Initial gas mileage sensor value         */        static double INITIAL_MPG = 10.5;        /**         * Hypothetical value for the number of miles in a typical delivery route         */        static double ROUTE_MILES = 80;        public static void main(String[] args) throws Exception {            DirectProvider dp = new DevelopmentProvider();            System.out.println(dp.getServices().getService(HttpServer.class).getConsoleUrl());            Topology top = dp.newTopology(\"GasMileageSensor\");            // The rest of the code pieces belong here        }    }```## Generating gas mileage sensor readingsThe next step is to simulate a stream of gas mileage readings using [`SimpleSimulatedSensor`](https://github.com/apache/incubator-quarks/blob/master/samples/utils/src/main/java/quarks/samples/utils/sensor/SimpleSimulatedSensor.java). We set the initial gas mileage and delta factor in the first two arguments. The last argument ensures that the sensor reading falls in an acceptable range (between 7.0 mpg and 14.0 mpg). In our `main()`, we use the `poll()` method to generate a flow of tuples (readings), where each tuple arrives every second.```java    // Generate a stream of gas mileage sensor readings    SimpleSimulatedSensor mpgSensor = new SimpleSimulatedSensor(INITIAL_MPG,            0.4, Ranges.closed(MPG_LOW, MPG_HIGH));    TStream mpgReadings = top.poll(mpgSensor, 1, TimeUnit.SECONDS);```## Applying different processing to the streamThe company can now perform analytics on the `mpgReadings` stream and feed it to different functions.First, we can filter out gas mileage values that are considered poor and tag the resulting stream for easier viewing in the console.```java    // Filter out the poor gas mileage readings    TStream poorMpg = mpgReadings            .filter(mpg -> mpg  json = mpgReadings            .map(mpg -> {                JsonObject jObj = new JsonObject();                jObj.addProperty(\"gasMileage\", mpg);                return jObj;            }).tag(\"mapped\");```In addition, we can calculate the estimated gallons of gas used based on the current gas mileage using `modify`.```java    // Modify gas mileage stream to obtain a stream containing the estimated gallons of gas used    DecimalFormat df = new DecimalFormat(\"#.#\");    TStream gallonsUsed = mpgReadings            .modify(mpg -> Double.valueOf(df.format(ROUTE_MILES / mpg))).tag(\"modified\");```The three examples demonstrated here are a small subset of the many other possibilities of stream processing.With each of these resulting streams, the company can perform further analytics, but at this point, we terminate the streams by printing out the tuples on each stream.```java    // Terminate the streams    poorMpg.sink(mpg -> System.out.println(\"Poor gas mileage! \" + mpg + \" mpg\"));    json.sink(mpg -> System.out.println(\"JSON: \" + mpg));    gallonsUsed.sink(gas -> System.out.println(\"Gallons of gas: \" + gas + \"\\n\"));```We end our application by submitting the `Topology`.## Observing the outputWhen the final application is run, the output looks something like the following:```    JSON: {\"gasMileage\":9.5}    Gallons of gas: 8.4    JSON: {\"gasMileage\":9.2}    Gallons of gas: 8.7    Poor gas mileage! 9.0 mpg    JSON: {\"gasMileage\":9.0}    Gallons of gas: 8.9    Poor gas mileage! 8.8 mpg    JSON: {\"gasMileage\":8.8}    Gallons of gas: 9.1```## A look at the topology graphLet's see what the topology graph looks like. We can view it using the console URL that was printed to standard output at the start of the application. We see that original stream is fanned out to three separate streams, and the `filter`, `map`, and `modify` operations are applied.## The final application```java    import java.text.DecimalFormat;    import java.util.concurrent.TimeUnit;    import com.google.gson.JsonObject;    import quarks.analytics.sensors.Ranges;    import quarks.console.server.HttpServer;    import quarks.providers.development.DevelopmentProvider;    import quarks.providers.direct.DirectProvider;    import quarks.samples.utils.sensor.SimpleSimulatedSensor;    import quarks.topology.TStream;    import quarks.topology.Topology;     /**     * Fan out stream and perform different analytics on the resulting streams.     */    public class ApplyDifferentProcessingAgainstStream {        /**         * Gas mileage (in miles per gallon, or mpg) value bounds         */        static double MPG_LOW = 7.0;        static double MPG_HIGH = 14.0;        /**         * Initial gas mileage sensor value         */        static double INITIAL_MPG = 10.5;        /**         * Hypothetical value for the number of miles in a typical delivery route         */        static double ROUTE_MILES = 80;        /**         * Polls a simulated delivery truck sensor to periodically obtain         * gas mileage readings (in miles/gallon). Feed the stream of sensor         * readings to different functions (filter, map, and modify).         */        public static void main(String[] args) throws Exception {            DirectProvider dp = new DevelopmentProvider();            System.out.println(dp.getServices().getService(HttpServer.class).getConsoleUrl());            Topology top = dp.newTopology(\"GasMileageSensor\");            // Generate a stream of gas mileage sensor readings            SimpleSimulatedSensor mpgSensor = new SimpleSimulatedSensor(INITIAL_MPG,                    0.4, Ranges.closed(MPG_LOW, MPG_HIGH));            TStream mpgReadings = top.poll(mpgSensor, 1, TimeUnit.SECONDS);            // Filter out the poor gas mileage readings            TStream poorMpg = mpgReadings                    .filter(mpg -> mpg  json = mpgReadings                    .map(mpg -> {                        JsonObject jObj = new JsonObject();                        jObj.addProperty(\"gasMileage\", mpg);                        return jObj;                    }).tag(\"mapped\");            // Modify gas mileage stream to obtain a stream containing the estimated gallons of gas used            DecimalFormat df = new DecimalFormat(\"#.#\");            TStream gallonsUsed = mpgReadings                    .modify(mpg -> Double.valueOf(df.format(ROUTE_MILES / mpg))).tag(\"modified\");            // Terminate the streams            poorMpg.sink(mpg -> System.out.println(\"Poor gas mileage! \" + mpg + \" mpg\"));            json.sink(mpg -> System.out.println(\"JSON: \" + mpg));            gallonsUsed.sink(gas -> System.out.println(\"Gallons of gas: \" + gas + \"\\n\"));            dp.submit(top);        }    }```"
 
 },
 
@@ -237,7 +237,7 @@
 "keywords": "",
 "url": "../recipes/recipe_value_out_of_range",
 "summary": "",
-"body": "Oftentimes, a user expects a sensor value to fall within a particular range. If a reading is outside the accepted limits, the user may want to determine what caused the anomaly and/or take action to reduce the impact. For instance, consider the following scenario.Suppose a corn grower in the Midwestern United States would like to monitor the average temperature in his corn field using a sensor to improve his crop yield. The optimal temperatures for corn growth during daylight hours range between 77°F and 91°F. When the grower is alerted of a temperature value that is not in the optimal range, he may want to assess what can be done to mitigate the effect.In this instance, we can use a filter to detect out-of-range temperature values.## Setting up the applicationWe assume that the environment has been set up following the steps outlined in the [Getting started guide](../docs/quarks-getting-started). Let's begin by creating a `DirectProvider` and `Topology`. We also define the optimal temperature range and the initial temperature.```java    import static quarks.function.Functions.identity;    import java.text.DecimalFormat;    import java.util.Random;    import java.util.concurrent.TimeUnit;    import quarks.analytics.sensors.Filters;    import quarks.providers.direct.DirectProvider;    import quarks.topology.TStream;    import quarks.topology.Topology;    public class DetectValueOutOfRange {        /**         * Optimal temperatures (in Fahrenheit)         */        static double TEMP_LOW = 77.0;        static double TEMP_HIGH = 91.0;        static double currentTemp = 80.0;        public static void main(String[] args) throws Exception {            DirectProvider dp = new DirectProvider();            Topology top = dp.newTopology(\"TemperatureSensor\");            // The rest of the code pieces belong here        }    }```## Generating temperature sensor readingsThe next step is to simulate a stream of temperature readings. In our `main()`, we use the `poll()` method to generate a flow of tuples, where a new tuple (temperature reading) arrives every second. We ensure that the generated reading is between 28°F and 112°F.```java    // Generate a stream of temperature sensor readings    DecimalFormat df = new DecimalFormat(\"#.#\");    Random r = new Random();    TStream temp = top.poll(() -> {        // Change current temp by some random amount between -1 and 1        while (true) {            double newTemp = -1 + (1 + 1) * r.nextDouble() + currentTemp;            // Ensure that new temperature is within [28, 112]            if (newTemp >= 28 && newTemp  simpleFiltered = temp.filter(tuple ->            tuple  TEMP_HIGH);    simpleFiltered.sink(tuple -> System.out.println(\"Temperature is out of range! \"            + \"It is \" + tuple + \"\\u00b0F!\"));```## Deadband filterAlternatively, a deadband filter can be used to glean more information about temperature changes, such as extracting the in-range temperature immediately after a reported out-of-range temperature. For example, large temperature fluctuations could be investigated more thoroughly. The `deadband` filter is a part of the `quarks.analytics` package focused on handling sensor data. Let's look more closely at the method declaration below.```java    deadband(TStream stream, Function value, Predicate inBand)```The first parameter is the stream to the filtered, which is `temp` in our scenario. The second parameter is the value to examine. Here, we use the `identity()` method to return a tuple on the stream. The last parameter is the predicate that defines the optimal range, that is, between 77°F and 91°F. it is important to note that this differs from the `TStream` version of `filter` in which one must explicitly specify the values that are out of range. The code snippet below demonstrates how the method call is pieced together. The `deadbandFiltered` stream contains temperature readings that follow the rules as described in the [Javadoc](http://quarks-edge.github.io/quarks/docs/javadoc/quarks/analytics/sensors/Filters.html#deadband-quarks.topology.TStream-quarks.function.Function-quarks.function.Predicate-):- the value is outside of the optimal range (deadband)- the first value inside the optimal range after a period being outside it- the first tupleAs with the simple filter, the stream is terminated by printing out the warnings.```java    TStream deadbandFiltered = Filters.deadband(temp,            identity(), tuple -> tuple >= TEMP_LOW && tuple  System.out.println(\"Temperature may not be \"            + \"optimal! It is \" + tuple + \"\\u00b0F!\"));```We end our application by submitting the `Topology`.## Observing the outputTo see what the temperatures look like, we can print the stream to standard out.```java    temp.print();```When the final application is run, the output looks something like the following:```    Temperature may not be optimal! It is 79.1°F!    79.1    79.4    79.0    78.8    78.0    78.3    77.4    Temperature is out of range! It is 76.5°F!    Temperature may not be optimal! It is 76.5°F!    76.5    Temperature may not be optimal! It is 77.5°F!    77.5    77.1    ...```Note that the deadband filter outputs a warning message for the very first temperature reading of 79.1°F. When the temperature falls to 76.5°F (which is outside the optimal range), both the simple filter and deadband filter print out a warning message. However, when the temperature returns to normal at 77.5°F, only the deadband filter prints out a message as it is the first value inside the optimal range after a period of being outside it.## Range valuesFiltering against a range of values is such a common analytic activity that the ``quarks.analytics.sensors.Range`` class is provided to assist with that.Using a Range can simplify and clarify your application code and lessen mistakes that may occur when writing expressions to deal with ranges.Though not covered in this recipe, Ranges offer additional conveniences for creating applications with external range specifications and adaptable filters.In the above examples, a single Range can be used in place of the two different expressions for the same logical range:```java    static double TEMP_LOW = 77.0;    static double TEMP_HIGH = 91.0;    static Range optimalTempRange = Ranges.closed(TEMP_LOW, TEMP_HIGH);```Using ``optimalTempRange`` in the Simple filter example code:```java    TStream simpleFiltered = temp.filter(tuple ->             !optimalTempRange.contains(tuple));```Using ``optimalTempRange`` in the Deadband filter example code:```java    TStream deadbandFiltered = Filters.deadband(temp,            identity(), optimalTempRange);```## The final application```java    import static quarks.function.Functions.identity;    import java.text.DecimalFormat;    import java.util.Random;    import java.util.concurrent.TimeUnit;    import quarks.analytics.sensors.Filters;    import quarks.analytics.sensors.Range;    import quarks.analytics.sensors.Ranges;    import quarks.providers.direct.DirectProvider;    import quarks.topology.TStream;    import quarks.topology.Topology;    /**     * Detect a sensor value out of expected range.     */    public class DetectValueOutOfRange {        /**         * Optimal temperatures inclusive (in Fahrenheit)         */        static double TEMP_LOW = 77.0;        static double TEMP_HIGH = 91.0;        static Range optimalTempRange = Ranges.closed(TEMP_LOW, TEMP_HIGH);        static double currentTemp = 80.0;        /**         * Polls a simulated temperature sensor to periodically obtain         * temperature readings (in Fahrenheit). Use a simple filter         * and a deadband filter to determine when the temperature         * is out of the optimal range.         */        public static void main(String[] args) throws Exception {            DirectProvider dp = new DirectProvider();            Topology top = dp.newTopology(\"TemperatureSensor\");            // Generate a stream of temperature sensor readings            DecimalFormat df = new DecimalFormat(\"#.#\");            Random r = new Random();            TStream temp = top.poll(() -> {                // Change current temp by some random amount between -1 and 1                while (true) {                    double newTemp = -1 + (1 + 1) * r.nextDouble() + currentTemp;                    // Ensure that new temperature is within [28, 112]                    if (newTemp >= 28 && newTemp  simpleFiltered = temp.filter(tuple ->                    !optimalTempRange.contains(tuple));            simpleFiltered.sink(tuple -> System.out.println(\"Temperature is out of range! \"                    + \"It is \" + tuple + \"\\u00b0F!\"));            // Deadband filter: Perform analytics on sensor readings to            // output the first temperature, and to generate warnings            // when the temperature is out of the optimal range and            // when it returns to normal            TStream deadbandFiltered = Filters.deadband(temp,                    identity(), optimalTempRange);            deadbandFiltered.sink(tuple -> System.out.println(\"Temperature may not be \"                    + \"optimal! It is \" + tuple + \"\\u00b0F!\"));            // See what the temperatures look like            temp.print();            dp.submit(top);        }    }```"
+"body": "Oftentimes, a user expects a sensor value to fall within a particular range. If a reading is outside the accepted limits, the user may want to determine what caused the anomaly and/or take action to reduce the impact. For instance, consider the following scenario.Suppose a corn grower in the Midwestern United States would like to monitor the average temperature in his corn field using a sensor to improve his crop yield. The optimal temperatures for corn growth during daylight hours range between 77°F and 91°F. When the grower is alerted of a temperature value that is not in the optimal range, he may want to assess what can be done to mitigate the effect.In this instance, we can use a filter to detect out-of-range temperature values.## Setting up the applicationWe assume that the environment has been set up following the steps outlined in the [Getting started guide](../docs/quarks-getting-started). Let's begin by creating a `DirectProvider` and `Topology`. We also define the optimal temperature range.```java    import static quarks.function.Functions.identity;    import java.util.concurrent.TimeUnit;    import quarks.analytics.sensors.Filters;    import quarks.analytics.sensors.Range;    import quarks.analytics.sensors.Ranges;    import quarks.providers.direct.DirectProvider;    import quarks.samples.utils.sensor.SimulatedTemperatureSensor;    import quarks.topology.TStream;    import quarks.topology.Topology;    public class DetectValueOutOfRange {        /**         * Optimal temperature range (in Fahrenheit)         */        static double OPTIMAL_TEMP_LOW = 77.0;        static double OPTIMAL_TEMP_HIGH = 91.0;        static Range optimalTempRange = Ranges.closed(OPTIMAL_TEMP_LOW, OPTIMAL_TEMP_HIGH);        public static void main(String[] args) throws Exception {            DirectProvider dp = new DirectProvider();            Topology top = dp.newTopology(\"TemperatureSensor\");            // The rest of the code pieces belong here        }    }```## Generating temperature sensor readingsThe next step is to simulate a stream of temperature readings using [`SimulatedTemperatureSensor`](https://github.com/apache/incubator-quarks/blob/master/samples/utils/src/main/java/quarks/samples/utils/sensor/SimulatedTemperatureSensor.java). By default, the sensor sets the initial temperature to 80°F and ensures that new readings are between 28°F and 112°F. In our `main()`, we use the `poll()` method to generate a flow of tuples, where a new tuple (temperature reading) arrives every second.```java    // Generate a stream of temperature sensor readings    SimulatedTemperatureSensor tempSensor = new SimulatedTemperatureSensor();    TStream temp = top.poll(tempSensor, 1, TimeUnit.SECONDS);```## Simple filteringIf the corn grower is interested in determining when the temperature is strictly out of the optimal range of 77°F and 91°F, a simple filter can be used. The `filter` method can be applied to `TStream` objects, where a filter predicate determines which tuples to keep for further processing. For its method declaration, refer to the [Javadoc](http://quarks-edge.github.io/quarks/docs/javadoc/quarks/topology/TStream.html#filter-quarks.function.Predicate-).In this case, we want to keep temperatures below the lower range value *or* above the upper range value. This is expressed in the filter predicate, which follows Java's syntax for [lambda expressions](https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html#syntax). Then, we terminate the stream (using `sink`) by printing out the warning to standard out. Note that `\\u00b0` is the Unicode encoding for the degree (°) symbol.```java    TStream simpleFiltered = temp.filter(tuple ->            tuple  OPTIMAL_TEMP_HIGH);    simpleFiltered.sink(tuple -> System.out.println(\"Temperature is out of range! \"            + \"It is \" + tuple + \"\\u00b0F!\"));```## Deadband filterAlternatively, a deadband filter can be used to glean more information about temperature changes, such as extracting the in-range temperature immediately after a reported out-of-range temperature. For example, large temperature fluctuations could be investigated more thoroughly. The `deadband` filter is a part of the `quarks.analytics` package focused on handling sensor data. Let's look more closely at the method declaration below.```java    deadband(TStream stream, Function value, Predicate inBand)```The first parameter is the stream to the filtered, which is `temp` in our scenario. The second parameter is the value to examine. Here, we use the `identity()` method to return a tuple on the stream. The last parameter is the predicate that defines the optimal range, that is, between 77°F and 91°F. it is important to note that this differs from the `TStream` version of `filter` in which one must explicitly specify the values that are out of range. The code snippet below demonstrates how the method call is pieced together. The `deadbandFiltered` stream contains temperature readings that follow the rules as described in the [Javadoc](http://quarks-edge.github.io/quarks/docs/javadoc/quarks/analytics/sensors/Filters.html#deadband-quarks.topology.TStream-quarks.function.Function-quarks.function.Predicate-):- the value is outside of the optimal range (deadband)- the first value inside the optimal range after a period being outside it- the first tupleAs with the simple filter, the stream is terminated by printing out the warnings.```java    TStream deadbandFiltered = Filters.deadband(temp,            identity(), tuple -> tuple >= OPTIMAL_TEMP_LOW && tuple  System.out.println(\"Temperature may not be \"            + \"optimal! It is \" + tuple + \"\\u00b0F!\"));```We end our application by submitting the `Topology`.## Observing the outputTo see what the temperatures look like, we can print the stream to standard out.```java    temp.print();```When the final application is run, the output looks something like the following:```    Temperature may not be optimal! It is 79.1°F!    79.1    79.4    79.0    78.8    78.0    78.3    77.4    Temperature is out of range! It is 76.5°F!    Temperature may not be optimal! It is 76.5°F!    76.5    Temperature may not be optimal! It is 77.5°F!    77.5    77.1    ...```Note that the deadband filter outputs a warning message for the very first temperature reading of 79.1°F. When the temperature falls to 76.5°F (which is outside the optimal range), both the simple filter and deadband filter print out a warning message. However, when the temperature returns to normal at 77.5°F, only the deadband filter prints out a message as it is the first value inside the optimal range after a period of being outside it.## Range valuesFiltering against a range of values is such a common analytic activity that the ``quarks.analytics.sensors.Range`` class is provided to assist with that.Using a Range can simplify and clarify your application code and lessen mistakes that may occur when writing expressions to deal with ranges.Though not covered in this recipe, Ranges offer additional conveniences for creating applications with external range specifications and adaptable filters.In the above examples, a single Range can be used in place of the two different expressions for the same logical range:```java    static double OPTIMAL_TEMP_LOW = 77.0;    static double OPTIMAL_TEMP_HIGH = 91.0;    static Range optimalTempRange = Ranges.closed(OPTIMAL_TEMP_LOW, OPTIMAL_TEMP_HIGH);```Using ``optimalTempRange`` in the Simple filter example code:```java    TStream simpleFiltered = temp.filter(tuple ->             !optimalTempRange.contains(tuple));```Using ``optimalTempRange`` in the Deadband filter example code:```java    TStream deadbandFiltered = Filters.deadband(temp,            identity(), optimalTempRange);```## The final application```java    import static quarks.function.Functions.identity;    import java.util.concurrent.TimeUnit;    import quarks.analytics.sensors.Filters;    import quarks.analytics.sensors.Range;    import quarks.analytics.sensors.Ranges;    import quarks.providers.direct.DirectProvider;    import quarks.samples.utils.sensor.SimulatedTemperatureSensor;    import quarks.topology.TStream;    import quarks.topology.Topology;    /**     * Detect a sensor value out of expected range.     */    public class DetectValueOutOfRange {        /**         * Optimal temperature range (in Fahrenheit)         */        static double OPTIMAL_TEMP_LOW = 77.0;        static double OPTIMAL_TEMP_HIGH = 91.0;        static Range optimalTempRange = Ranges.closed(OPTIMAL_TEMP_LOW, OPTIMAL_TEMP_HIGH);        /**         * Polls a simulated temperature sensor to periodically obtain         * temperature readings (in Fahrenheit). Use a simple filter         * and a deadband filter to determine when the temperature         * is out of the optimal range.         */        public static void main(String[] args) throws Exception {            DirectProvider dp = new DirectProvider();            Topology top = dp.newTopology(\"TemperatureSensor\");            // Generate a stream of temperature sensor readings            SimulatedTemperatureSensor tempSensor = new SimulatedTemperatureSensor();            TStream temp = top.poll(tempSensor, 1, TimeUnit.SECONDS);            // Simple filter: Perform analytics on sensor readings to            // detect when the temperature is completely out of the            // optimal range and generate warnings            TStream simpleFiltered = temp.filter(tuple ->                    !optimalTempRange.contains(tuple));            simpleFiltered.sink(tuple -> System.out.println(\"Temperature is out of range! \"                    + \"It is \" + tuple + \"\\u00b0F!\"));            // Deadband filter: Perform analytics on sensor readings to            // output the first temperature, and to generate warnings            // when the temperature is out of the optimal range and            // when it returns to normal            TStream deadbandFiltered = Filters.deadband(temp,                    identity(), optimalTempRange);            deadbandFiltered.sink(tuple -> System.out.println(\"Temperature may not be \"                    + \"optimal! It is \" + tuple + \"\\u00b0F!\"));            // See what the temperatures look like            temp.print();            dp.submit(top);        }    }```"
 
 },
 
diff --git a/content/docs/committers.html b/content/docs/committers.html
index 977d832..debda3f 100644
--- a/content/docs/committers.html
+++ b/content/docs/committers.html
@@ -578,7 +578,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/docs/common-quarks-operations.html b/content/docs/common-quarks-operations.html
index 451831b..6a901c2 100644
--- a/content/docs/common-quarks-operations.html
+++ b/content/docs/common-quarks-operations.html
@@ -611,7 +611,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/docs/community.html b/content/docs/community.html
index b0a7c40..27297ed 100644
--- a/content/docs/community.html
+++ b/content/docs/community.html
@@ -634,7 +634,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/docs/console.html b/content/docs/console.html
index 7a9b6c6..75a67ab 100644
--- a/content/docs/console.html
+++ b/content/docs/console.html
@@ -1041,7 +1041,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/docs/faq.html b/content/docs/faq.html
index bef6933..282e22e 100644
--- a/content/docs/faq.html
+++ b/content/docs/faq.html
@@ -649,7 +649,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/docs/home.html b/content/docs/home.html
index 4414965..b65591d 100644
--- a/content/docs/home.html
+++ b/content/docs/home.html
@@ -654,7 +654,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/docs/overview.html b/content/docs/overview.html
index 4458fd0..c3e4901 100644
--- a/content/docs/overview.html
+++ b/content/docs/overview.html
@@ -638,7 +638,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/docs/quarks-getting-started.html b/content/docs/quarks-getting-started.html
index 8fd66b1..6fe184a 100644
--- a/content/docs/quarks-getting-started.html
+++ b/content/docs/quarks-getting-started.html
@@ -740,7 +740,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/docs/quarks_index.html b/content/docs/quarks_index.html
index 2451048..7a82cb3 100644
--- a/content/docs/quarks_index.html
+++ b/content/docs/quarks_index.html
@@ -596,7 +596,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/docs/quickstart.html b/content/docs/quickstart.html
index e6a2779..5910b51 100644
--- a/content/docs/quickstart.html
+++ b/content/docs/quickstart.html
@@ -615,7 +615,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/docs/samples.html b/content/docs/samples.html
index e1fd2e0..0eeedce 100644
--- a/content/docs/samples.html
+++ b/content/docs/samples.html
@@ -629,7 +629,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/docs/search.html b/content/docs/search.html
index 08d5383..ce2754d 100644
--- a/content/docs/search.html
+++ b/content/docs/search.html
@@ -556,7 +556,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/docs/tag_collaboration.html b/content/docs/tag_collaboration.html
index 8bdad07..f684e8f 100644
--- a/content/docs/tag_collaboration.html
+++ b/content/docs/tag_collaboration.html
@@ -647,7 +647,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/docs/tag_content_types.html b/content/docs/tag_content_types.html
index 3b9077b..7692e6f 100644
--- a/content/docs/tag_content_types.html
+++ b/content/docs/tag_content_types.html
@@ -647,7 +647,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/docs/tag_formatting.html b/content/docs/tag_formatting.html
index 514ea55..913959c 100644
--- a/content/docs/tag_formatting.html
+++ b/content/docs/tag_formatting.html
@@ -647,7 +647,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/docs/tag_getting_started.html b/content/docs/tag_getting_started.html
index 3f96ba7..4a2fc67 100644
--- a/content/docs/tag_getting_started.html
+++ b/content/docs/tag_getting_started.html
@@ -652,7 +652,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/docs/tag_mobile.html b/content/docs/tag_mobile.html
index b581f80..7628eee 100644
--- a/content/docs/tag_mobile.html
+++ b/content/docs/tag_mobile.html
@@ -647,7 +647,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/docs/tag_navigation.html b/content/docs/tag_navigation.html
index 4b11023..91f4e9a 100644
--- a/content/docs/tag_navigation.html
+++ b/content/docs/tag_navigation.html
@@ -647,7 +647,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/docs/tag_publishing.html b/content/docs/tag_publishing.html
index 98a5c0e..4dd2dd9 100644
--- a/content/docs/tag_publishing.html
+++ b/content/docs/tag_publishing.html
@@ -647,7 +647,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/docs/tag_single_sourcing.html b/content/docs/tag_single_sourcing.html
index 72caaaa..a655c53 100644
--- a/content/docs/tag_single_sourcing.html
+++ b/content/docs/tag_single_sourcing.html
@@ -647,7 +647,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/docs/tag_special_layouts.html b/content/docs/tag_special_layouts.html
index fa625f9..14cad76 100644
--- a/content/docs/tag_special_layouts.html
+++ b/content/docs/tag_special_layouts.html
@@ -647,7 +647,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/recipes/recipe_adaptable_filter_range.html b/content/recipes/recipe_adaptable_filter_range.html
index bba9470..edeec4c 100644
--- a/content/recipes/recipe_adaptable_filter_range.html
+++ b/content/recipes/recipe_adaptable_filter_range.html
@@ -674,7 +674,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/recipes/recipe_combining_streams_processing_results.html b/content/recipes/recipe_combining_streams_processing_results.html
index 19542f6..5f9c9ae 100644
--- a/content/recipes/recipe_combining_streams_processing_results.html
+++ b/content/recipes/recipe_combining_streams_processing_results.html
@@ -805,7 +805,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/recipes/recipe_different_processing_against_stream.html b/content/recipes/recipe_different_processing_against_stream.html
index 049ad2b..f23a61c 100644
--- a/content/recipes/recipe_different_processing_against_stream.html
+++ b/content/recipes/recipe_different_processing_against_stream.html
@@ -535,31 +535,39 @@
     
   <p>In the previous <a href="recipe_value_out_of_range">recipe</a>, we learned how to filter a stream to obtain the interesting sensor readings and ignore the mundane data. Typically, a user scenario is more involved, where data is processed using different stream operations. Consider the following scenario, for example.</p>
 
-<p>Suppose a package delivery company would like to monitor the gas mileage of their delivery trucks using embedded sensors. They would like to apply different analytics to the sensor data that can be used to make more informed business decisions. For instance, if a truck is reporting consistently poor mileage readings, the company might want to consider replacing that truck to save on gas costs. Perhaps the company also wants to convert the sensor readings to JSON format in order to easily display the data on a web page. It may also be interested in determining the expected gallons of gas used based on the current mileage.</p>
+<p>Suppose a package delivery company would like to monitor the gas mileage of their delivery trucks using embedded sensors. They would like to apply different analytics to the sensor data that can be used to make more informed business decisions. For instance, if a truck is reporting consistently poor gas mileage readings, the company might want to consider replacing that truck to save on gas costs. Perhaps the company also wants to convert the sensor readings to JSON format in order to easily display the data on a web page. It may also be interested in determining the expected gallons of gas used based on the current gas mileage.</p>
 
-<p>In this instance, we can take the stream of mileage sensor readings and apply multiple types of processing against it so that we end up with streams that serve different purposes.</p>
+<p>In this instance, we can take the stream of gas mileage sensor readings and apply multiple types of processing against it so that we end up with streams that serve different purposes.</p>
 
 <h2 id="setting-up-the-application">Setting up the application</h2>
 
-<p>We assume that the environment has been set up following the steps outlined in the <a href="../docs/quarks-getting-started">Getting started guide</a>. Let&#39;s begin by creating a <code>DirectProvider</code> and <code>Topology</code>. We choose a <code>DevelopmentProvider</code> so that we can view the topology graph using the console URL (refer to the <a href="../docs/console">Application console</a> page for a more detailed explanation of this provider). The initial mileage value and the number of miles in a typical delivery route have also been defined.</p>
+<p>We assume that the environment has been set up following the steps outlined in the <a href="../docs/quarks-getting-started">Getting started guide</a>. Let&#39;s begin by creating a <code>DirectProvider</code> and <code>Topology</code>. We choose a <code>DevelopmentProvider</code> so that we can view the topology graph using the console URL (refer to the <a href="../docs/console">Application console</a> page for a more detailed explanation of this provider). The gas mileage bounds, initial gas mileage value, and the number of miles in a typical delivery route have also been defined.</p>
 <div class="highlight"><pre><code class="language-java" data-lang="java">    <span class="kn">import</span> <span class="nn">java.text.DecimalFormat</span><span class="o">;</span>
-    <span class="kn">import</span> <span class="nn">java.util.Random</span><span class="o">;</span>
     <span class="kn">import</span> <span class="nn">java.util.concurrent.TimeUnit</span><span class="o">;</span>
 
     <span class="kn">import</span> <span class="nn">com.google.gson.JsonObject</span><span class="o">;</span>
 
+    <span class="kn">import</span> <span class="nn">quarks.analytics.sensors.Ranges</span><span class="o">;</span>
     <span class="kn">import</span> <span class="nn">quarks.console.server.HttpServer</span><span class="o">;</span>
     <span class="kn">import</span> <span class="nn">quarks.providers.development.DevelopmentProvider</span><span class="o">;</span>
     <span class="kn">import</span> <span class="nn">quarks.providers.direct.DirectProvider</span><span class="o">;</span>
+    <span class="kn">import</span> <span class="nn">quarks.samples.utils.sensor.SimpleSimulatedSensor</span><span class="o">;</span>
     <span class="kn">import</span> <span class="nn">quarks.topology.TStream</span><span class="o">;</span>
     <span class="kn">import</span> <span class="nn">quarks.topology.Topology</span><span class="o">;</span>
 
     <span class="kd">public</span> <span class="kd">class</span> <span class="nc">ApplyDifferentProcessingAgainstStream</span> <span class="o">{</span>
         <span class="cm">/**
-         * Hypothetical values for the initial gas mileage and the
-         * number of miles in a typical delivery route
+         * Gas mileage (in miles per gallon, or mpg) value bounds
          */</span>
-        <span class="kd">static</span> <span class="kt">double</span> <span class="n">currentMileage</span> <span class="o">=</span> <span class="mf">10.5</span><span class="o">;</span>
+        <span class="kd">static</span> <span class="kt">double</span> <span class="n">MPG_LOW</span> <span class="o">=</span> <span class="mf">7.0</span><span class="o">;</span>
+        <span class="kd">static</span> <span class="kt">double</span> <span class="n">MPG_HIGH</span> <span class="o">=</span> <span class="mf">14.0</span><span class="o">;</span>
+        <span class="cm">/**
+         * Initial gas mileage sensor value
+         */</span>
+        <span class="kd">static</span> <span class="kt">double</span> <span class="n">INITIAL_MPG</span> <span class="o">=</span> <span class="mf">10.5</span><span class="o">;</span>
+        <span class="cm">/**
+         * Hypothetical value for the number of miles in a typical delivery route
+         */</span>
         <span class="kd">static</span> <span class="kt">double</span> <span class="n">ROUTE_MILES</span> <span class="o">=</span> <span class="mi">80</span><span class="o">;</span>
 
         <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="n">main</span><span class="o">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">Exception</span> <span class="o">{</span>
@@ -568,61 +576,49 @@
 
             <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">dp</span><span class="o">.</span><span class="na">getServices</span><span class="o">().</span><span class="na">getService</span><span class="o">(</span><span class="n">HttpServer</span><span class="o">.</span><span class="na">class</span><span class="o">).</span><span class="na">getConsoleUrl</span><span class="o">());</span>
 
-            <span class="n">Topology</span> <span class="n">top</span> <span class="o">=</span> <span class="n">dp</span><span class="o">.</span><span class="na">newTopology</span><span class="o">(</span><span class="s">"TruckSensor"</span><span class="o">);</span>
+            <span class="n">Topology</span> <span class="n">top</span> <span class="o">=</span> <span class="n">dp</span><span class="o">.</span><span class="na">newTopology</span><span class="o">(</span><span class="s">"GasMileageSensor"</span><span class="o">);</span>
 
             <span class="c1">// The rest of the code pieces belong here</span>
         <span class="o">}</span>
     <span class="o">}</span>
 </code></pre></div>
-<h2 id="generating-mileage-sensor-readings">Generating mileage sensor readings</h2>
+<h2 id="generating-gas-mileage-sensor-readings">Generating gas mileage sensor readings</h2>
 
-<p>The next step is to simulate a stream of gas mileage readings. In our <code>main()</code>, we use the <code>poll()</code> method to generate a flow of tuples (readings), where each tuple arrives every second. We ensure that the generated reading is between 7.0 mpg and 14.0 mpg.</p>
-<div class="highlight"><pre><code class="language-java" data-lang="java">    <span class="c1">// Generate a stream of mileage sensor readings</span>
-    <span class="n">DecimalFormat</span> <span class="n">df</span> <span class="o">=</span> <span class="k">new</span> <span class="n">DecimalFormat</span><span class="o">(</span><span class="s">"#.#"</span><span class="o">);</span>
-    <span class="n">Random</span> <span class="n">r</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Random</span><span class="o">();</span>
-    <span class="n">TStream</span><span class="o">&lt;</span><span class="n">Double</span><span class="o">&gt;</span> <span class="n">mileage</span> <span class="o">=</span> <span class="n">top</span><span class="o">.</span><span class="na">poll</span><span class="o">(()</span> <span class="o">-&gt;</span> <span class="o">{</span>
-        <span class="c1">// Change current mileage by some random amount between -0.4 and 0.4</span>
-        <span class="k">while</span> <span class="o">(</span><span class="kc">true</span><span class="o">)</span> <span class="o">{</span>
-            <span class="kt">double</span> <span class="n">newMileage</span> <span class="o">=</span> <span class="o">-</span><span class="mf">0.4</span> <span class="o">+</span> <span class="o">(</span><span class="mf">0.4</span> <span class="o">+</span> <span class="mf">0.4</span><span class="o">)</span> <span class="o">*</span> <span class="n">r</span><span class="o">.</span><span class="na">nextDouble</span><span class="o">()</span> <span class="o">+</span> <span class="n">currentMileage</span><span class="o">;</span>
-            <span class="c1">// Ensure that new temperature is within [7.0, 14.0]</span>
-            <span class="k">if</span> <span class="o">(</span><span class="n">newMileage</span> <span class="o">&gt;=</span> <span class="mf">7.0</span> <span class="o">&amp;&amp;</span> <span class="n">newMileage</span> <span class="o">&lt;=</span> <span class="mf">14.0</span><span class="o">)</span> <span class="o">{</span>
-                <span class="n">currentMileage</span> <span class="o">=</span> <span class="n">Double</span><span class="o">.</span><span class="na">valueOf</span><span class="o">(</span><span class="n">df</span><span class="o">.</span><span class="na">format</span><span class="o">(</span><span class="n">newMileage</span><span class="o">));</span>
-                <span class="k">break</span><span class="o">;</span>
-            <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
-                <span class="k">continue</span><span class="o">;</span>
-            <span class="o">}</span>
-        <span class="o">}</span>
-        <span class="k">return</span> <span class="n">currentMileage</span><span class="o">;</span>
-    <span class="o">},</span> <span class="mi">1</span><span class="o">,</span> <span class="n">TimeUnit</span><span class="o">.</span><span class="na">SECONDS</span><span class="o">);</span>
+<p>The next step is to simulate a stream of gas mileage readings using <a href="https://github.com/apache/incubator-quarks/blob/master/samples/utils/src/main/java/quarks/samples/utils/sensor/SimpleSimulatedSensor.java"><code>SimpleSimulatedSensor</code></a>. We set the initial gas mileage and delta factor in the first two arguments. The last argument ensures that the sensor reading falls in an acceptable range (between 7.0 mpg and 14.0 mpg). In our <code>main()</code>, we use the <code>poll()</code> method to generate a flow of tuples (readings), where each tuple arrives every second.</p>
+<div class="highlight"><pre><code class="language-java" data-lang="java">    <span class="c1">// Generate a stream of gas mileage sensor readings</span>
+    <span class="n">SimpleSimulatedSensor</span> <span class="n">mpgSensor</span> <span class="o">=</span> <span class="k">new</span> <span class="n">SimpleSimulatedSensor</span><span class="o">(</span><span class="n">INITIAL_MPG</span><span class="o">,</span>
+            <span class="mf">0.4</span><span class="o">,</span> <span class="n">Ranges</span><span class="o">.</span><span class="na">closed</span><span class="o">(</span><span class="n">MPG_LOW</span><span class="o">,</span> <span class="n">MPG_HIGH</span><span class="o">));</span>
+    <span class="n">TStream</span><span class="o">&lt;</span><span class="n">Double</span><span class="o">&gt;</span> <span class="n">mpgReadings</span> <span class="o">=</span> <span class="n">top</span><span class="o">.</span><span class="na">poll</span><span class="o">(</span><span class="n">mpgSensor</span><span class="o">,</span> <span class="mi">1</span><span class="o">,</span> <span class="n">TimeUnit</span><span class="o">.</span><span class="na">SECONDS</span><span class="o">);</span>
 </code></pre></div>
 <h2 id="applying-different-processing-to-the-stream">Applying different processing to the stream</h2>
 
-<p>The company can now perform analytics on the <code>mileage</code> stream and feed it to different functions. </p>
+<p>The company can now perform analytics on the <code>mpgReadings</code> stream and feed it to different functions.</p>
 
-<p>First, we can filter out mileage values that are considered poor and tag the resulting stream for easier viewing in the console.</p>
+<p>First, we can filter out gas mileage values that are considered poor and tag the resulting stream for easier viewing in the console.</p>
 <div class="highlight"><pre><code class="language-java" data-lang="java">    <span class="c1">// Filter out the poor gas mileage readings</span>
-    <span class="n">TStream</span><span class="o">&lt;</span><span class="n">Double</span><span class="o">&gt;</span> <span class="n">poorMileage</span> <span class="o">=</span> <span class="n">mileage</span>
-            <span class="o">.</span><span class="na">filter</span><span class="o">(</span><span class="n">mpg</span> <span class="o">-&gt;</span> <span class="n">mpg</span> <span class="o">&lt;=</span> <span class="mi">9</span><span class="o">).</span><span class="na">tag</span><span class="o">(</span><span class="s">"filtered"</span><span class="o">);</span>
+    <span class="n">TStream</span><span class="o">&lt;</span><span class="n">Double</span><span class="o">&gt;</span> <span class="n">poorMpg</span> <span class="o">=</span> <span class="n">mpgReadings</span>
+            <span class="o">.</span><span class="na">filter</span><span class="o">(</span><span class="n">mpg</span> <span class="o">-&gt;</span> <span class="n">mpg</span> <span class="o">&lt;=</span> <span class="mf">9.0</span><span class="o">).</span><span class="na">tag</span><span class="o">(</span><span class="s">"filtered"</span><span class="o">);</span>
 </code></pre></div>
 <p>If the company also wants the readings to be in JSON, we can easily create a new stream and convert from type <code>Double</code> to <code>JsonObject</code>.</p>
 <div class="highlight"><pre><code class="language-java" data-lang="java">    <span class="c1">// Map Double to JsonObject</span>
-    <span class="n">TStream</span><span class="o">&lt;</span><span class="n">JsonObject</span><span class="o">&gt;</span> <span class="n">json</span> <span class="o">=</span> <span class="n">mileage</span>
+     <span class="n">TStream</span><span class="o">&lt;</span><span class="n">JsonObject</span><span class="o">&gt;</span> <span class="n">json</span> <span class="o">=</span> <span class="n">mpgReadings</span>
             <span class="o">.</span><span class="na">map</span><span class="o">(</span><span class="n">mpg</span> <span class="o">-&gt;</span> <span class="o">{</span>
                 <span class="n">JsonObject</span> <span class="n">jObj</span> <span class="o">=</span> <span class="k">new</span> <span class="n">JsonObject</span><span class="o">();</span>
-                <span class="n">jObj</span><span class="o">.</span><span class="na">addProperty</span><span class="o">(</span><span class="s">"mileage"</span><span class="o">,</span> <span class="n">mpg</span><span class="o">);</span>
+                <span class="n">jObj</span><span class="o">.</span><span class="na">addProperty</span><span class="o">(</span><span class="s">"gasMileage"</span><span class="o">,</span> <span class="n">mpg</span><span class="o">);</span>
                 <span class="k">return</span> <span class="n">jObj</span><span class="o">;</span>
             <span class="o">}).</span><span class="na">tag</span><span class="o">(</span><span class="s">"mapped"</span><span class="o">);</span>
 </code></pre></div>
-<p>In addition, we can calculate the estimated gallons of gas used based on the current mileage using <code>modify</code>.</p>
-<div class="highlight"><pre><code class="language-java" data-lang="java">    <span class="c1">// Modify mileage stream to obtain a stream containing the estimated gallons of gas used</span>
-    <span class="n">TStream</span><span class="o">&lt;</span><span class="n">Double</span><span class="o">&gt;</span> <span class="n">gallonsUsed</span> <span class="o">=</span> <span class="n">mileage</span>
+<p>In addition, we can calculate the estimated gallons of gas used based on the current gas mileage using <code>modify</code>.</p>
+<div class="highlight"><pre><code class="language-java" data-lang="java">    <span class="c1">// Modify gas mileage stream to obtain a stream containing the estimated gallons of gas used</span>
+    <span class="n">DecimalFormat</span> <span class="n">df</span> <span class="o">=</span> <span class="k">new</span> <span class="n">DecimalFormat</span><span class="o">(</span><span class="s">"#.#"</span><span class="o">);</span>
+    <span class="n">TStream</span><span class="o">&lt;</span><span class="n">Double</span><span class="o">&gt;</span> <span class="n">gallonsUsed</span> <span class="o">=</span> <span class="n">mpgReadings</span>
             <span class="o">.</span><span class="na">modify</span><span class="o">(</span><span class="n">mpg</span> <span class="o">-&gt;</span> <span class="n">Double</span><span class="o">.</span><span class="na">valueOf</span><span class="o">(</span><span class="n">df</span><span class="o">.</span><span class="na">format</span><span class="o">(</span><span class="n">ROUTE_MILES</span> <span class="o">/</span> <span class="n">mpg</span><span class="o">))).</span><span class="na">tag</span><span class="o">(</span><span class="s">"modified"</span><span class="o">);</span>
 </code></pre></div>
 <p>The three examples demonstrated here are a small subset of the many other possibilities of stream processing.</p>
 
 <p>With each of these resulting streams, the company can perform further analytics, but at this point, we terminate the streams by printing out the tuples on each stream.</p>
 <div class="highlight"><pre><code class="language-java" data-lang="java">    <span class="c1">// Terminate the streams</span>
-    <span class="n">poorMileage</span><span class="o">.</span><span class="na">sink</span><span class="o">(</span><span class="n">mpg</span> <span class="o">-&gt;</span> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Poor mileage! "</span> <span class="o">+</span> <span class="n">mpg</span> <span class="o">+</span> <span class="s">" mpg"</span><span class="o">));</span>
+    <span class="n">poorMpg</span><span class="o">.</span><span class="na">sink</span><span class="o">(</span><span class="n">mpg</span> <span class="o">-&gt;</span> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Poor gas mileage! "</span> <span class="o">+</span> <span class="n">mpg</span> <span class="o">+</span> <span class="s">" mpg"</span><span class="o">));</span>
     <span class="n">json</span><span class="o">.</span><span class="na">sink</span><span class="o">(</span><span class="n">mpg</span> <span class="o">-&gt;</span> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"JSON: "</span> <span class="o">+</span> <span class="n">mpg</span><span class="o">));</span>
     <span class="n">gallonsUsed</span><span class="o">.</span><span class="na">sink</span><span class="o">(</span><span class="n">gas</span> <span class="o">-&gt;</span> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Gallons of gas: "</span> <span class="o">+</span> <span class="n">gas</span> <span class="o">+</span> <span class="s">"\n"</span><span class="o">));</span>
 </code></pre></div>
@@ -631,18 +627,18 @@
 <h2 id="observing-the-output">Observing the output</h2>
 
 <p>When the final application is run, the output looks something like the following:</p>
-<div class="highlight"><pre><code class="language-" data-lang="">    JSON: {"mileage":9.5}
+<div class="highlight"><pre><code class="language-" data-lang="">    JSON: {"gasMileage":9.5}
     Gallons of gas: 8.4
 
-    JSON: {"mileage":9.2}
+    JSON: {"gasMileage":9.2}
     Gallons of gas: 8.7
 
-    Poor mileage! 9.0 mpg
-    JSON: {"mileage":9.0}
+    Poor gas mileage! 9.0 mpg
+    JSON: {"gasMileage":9.0}
     Gallons of gas: 8.9
 
-    Poor mileage! 8.8 mpg
-    JSON: {"mileage":8.8}
+    Poor gas mileage! 8.8 mpg
+    JSON: {"gasMileage":8.8}
     Gallons of gas: 9.1
 </code></pre></div>
 <h2 id="a-look-at-the-topology-graph">A look at the topology graph</h2>
@@ -653,31 +649,39 @@
 
 <h2 id="the-final-application">The final application</h2>
 <div class="highlight"><pre><code class="language-java" data-lang="java">    <span class="kn">import</span> <span class="nn">java.text.DecimalFormat</span><span class="o">;</span>
-    <span class="kn">import</span> <span class="nn">java.util.Random</span><span class="o">;</span>
     <span class="kn">import</span> <span class="nn">java.util.concurrent.TimeUnit</span><span class="o">;</span>
 
     <span class="kn">import</span> <span class="nn">com.google.gson.JsonObject</span><span class="o">;</span>
 
+    <span class="kn">import</span> <span class="nn">quarks.analytics.sensors.Ranges</span><span class="o">;</span>
     <span class="kn">import</span> <span class="nn">quarks.console.server.HttpServer</span><span class="o">;</span>
     <span class="kn">import</span> <span class="nn">quarks.providers.development.DevelopmentProvider</span><span class="o">;</span>
     <span class="kn">import</span> <span class="nn">quarks.providers.direct.DirectProvider</span><span class="o">;</span>
+    <span class="kn">import</span> <span class="nn">quarks.samples.utils.sensor.SimpleSimulatedSensor</span><span class="o">;</span>
     <span class="kn">import</span> <span class="nn">quarks.topology.TStream</span><span class="o">;</span>
     <span class="kn">import</span> <span class="nn">quarks.topology.Topology</span><span class="o">;</span>
 
-    <span class="cm">/**
+     <span class="cm">/**
      * Fan out stream and perform different analytics on the resulting streams.
      */</span>
     <span class="kd">public</span> <span class="kd">class</span> <span class="nc">ApplyDifferentProcessingAgainstStream</span> <span class="o">{</span>
         <span class="cm">/**
-         * Hypothetical values for the initial gas mileage and the
-         * number of miles in a typical delivery route
+         * Gas mileage (in miles per gallon, or mpg) value bounds
          */</span>
-        <span class="kd">static</span> <span class="kt">double</span> <span class="n">currentMileage</span> <span class="o">=</span> <span class="mf">10.5</span><span class="o">;</span>
+        <span class="kd">static</span> <span class="kt">double</span> <span class="n">MPG_LOW</span> <span class="o">=</span> <span class="mf">7.0</span><span class="o">;</span>
+        <span class="kd">static</span> <span class="kt">double</span> <span class="n">MPG_HIGH</span> <span class="o">=</span> <span class="mf">14.0</span><span class="o">;</span>
+        <span class="cm">/**
+         * Initial gas mileage sensor value
+         */</span>
+        <span class="kd">static</span> <span class="kt">double</span> <span class="n">INITIAL_MPG</span> <span class="o">=</span> <span class="mf">10.5</span><span class="o">;</span>
+        <span class="cm">/**
+         * Hypothetical value for the number of miles in a typical delivery route
+         */</span>
         <span class="kd">static</span> <span class="kt">double</span> <span class="n">ROUTE_MILES</span> <span class="o">=</span> <span class="mi">80</span><span class="o">;</span>
 
         <span class="cm">/**
          * Polls a simulated delivery truck sensor to periodically obtain
-         * mileage readings (in miles/gallon). Feed the stream of sensor
+         * gas mileage readings (in miles/gallon). Feed the stream of sensor
          * readings to different functions (filter, map, and modify).
          */</span>
         <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="n">main</span><span class="o">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">Exception</span> <span class="o">{</span>
@@ -686,44 +690,32 @@
 
             <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">dp</span><span class="o">.</span><span class="na">getServices</span><span class="o">().</span><span class="na">getService</span><span class="o">(</span><span class="n">HttpServer</span><span class="o">.</span><span class="na">class</span><span class="o">).</span><span class="na">getConsoleUrl</span><span class="o">());</span>
 
-            <span class="n">Topology</span> <span class="n">top</span> <span class="o">=</span> <span class="n">dp</span><span class="o">.</span><span class="na">newTopology</span><span class="o">(</span><span class="s">"TruckSensor"</span><span class="o">);</span>
+            <span class="n">Topology</span> <span class="n">top</span> <span class="o">=</span> <span class="n">dp</span><span class="o">.</span><span class="na">newTopology</span><span class="o">(</span><span class="s">"GasMileageSensor"</span><span class="o">);</span>
 
-            <span class="c1">// Generate a stream of mileage sensor readings</span>
-            <span class="n">DecimalFormat</span> <span class="n">df</span> <span class="o">=</span> <span class="k">new</span> <span class="n">DecimalFormat</span><span class="o">(</span><span class="s">"#.#"</span><span class="o">);</span>
-            <span class="n">Random</span> <span class="n">r</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Random</span><span class="o">();</span>
-            <span class="n">TStream</span><span class="o">&lt;</span><span class="n">Double</span><span class="o">&gt;</span> <span class="n">mileage</span> <span class="o">=</span> <span class="n">top</span><span class="o">.</span><span class="na">poll</span><span class="o">(()</span> <span class="o">-&gt;</span> <span class="o">{</span>
-                <span class="c1">// Change current mileage by some random amount between -0.4 and 0.4</span>
-                <span class="k">while</span> <span class="o">(</span><span class="kc">true</span><span class="o">)</span> <span class="o">{</span>
-                    <span class="kt">double</span> <span class="n">newMileage</span> <span class="o">=</span> <span class="o">-</span><span class="mf">0.4</span> <span class="o">+</span> <span class="o">(</span><span class="mf">0.4</span> <span class="o">+</span> <span class="mf">0.4</span><span class="o">)</span> <span class="o">*</span> <span class="n">r</span><span class="o">.</span><span class="na">nextDouble</span><span class="o">()</span> <span class="o">+</span> <span class="n">currentMileage</span><span class="o">;</span>
-                    <span class="c1">// Ensure that new temperature is within [7.0, 14.0]</span>
-                    <span class="k">if</span> <span class="o">(</span><span class="n">newMileage</span> <span class="o">&gt;=</span> <span class="mf">7.0</span> <span class="o">&amp;&amp;</span> <span class="n">newMileage</span> <span class="o">&lt;=</span> <span class="mf">14.0</span><span class="o">)</span> <span class="o">{</span>
-                        <span class="n">currentMileage</span> <span class="o">=</span> <span class="n">Double</span><span class="o">.</span><span class="na">valueOf</span><span class="o">(</span><span class="n">df</span><span class="o">.</span><span class="na">format</span><span class="o">(</span><span class="n">newMileage</span><span class="o">));</span>
-                        <span class="k">break</span><span class="o">;</span>
-                    <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
-                        <span class="k">continue</span><span class="o">;</span>
-                    <span class="o">}</span>
-                <span class="o">}</span>
-                <span class="k">return</span> <span class="n">currentMileage</span><span class="o">;</span>
-            <span class="o">},</span> <span class="mi">1</span><span class="o">,</span> <span class="n">TimeUnit</span><span class="o">.</span><span class="na">SECONDS</span><span class="o">);</span>
+            <span class="c1">// Generate a stream of gas mileage sensor readings</span>
+            <span class="n">SimpleSimulatedSensor</span> <span class="n">mpgSensor</span> <span class="o">=</span> <span class="k">new</span> <span class="n">SimpleSimulatedSensor</span><span class="o">(</span><span class="n">INITIAL_MPG</span><span class="o">,</span>
+                    <span class="mf">0.4</span><span class="o">,</span> <span class="n">Ranges</span><span class="o">.</span><span class="na">closed</span><span class="o">(</span><span class="n">MPG_LOW</span><span class="o">,</span> <span class="n">MPG_HIGH</span><span class="o">));</span>
+            <span class="n">TStream</span><span class="o">&lt;</span><span class="n">Double</span><span class="o">&gt;</span> <span class="n">mpgReadings</span> <span class="o">=</span> <span class="n">top</span><span class="o">.</span><span class="na">poll</span><span class="o">(</span><span class="n">mpgSensor</span><span class="o">,</span> <span class="mi">1</span><span class="o">,</span> <span class="n">TimeUnit</span><span class="o">.</span><span class="na">SECONDS</span><span class="o">);</span>
 
             <span class="c1">// Filter out the poor gas mileage readings</span>
-            <span class="n">TStream</span><span class="o">&lt;</span><span class="n">Double</span><span class="o">&gt;</span> <span class="n">poorMileage</span> <span class="o">=</span> <span class="n">mileage</span>
-                    <span class="o">.</span><span class="na">filter</span><span class="o">(</span><span class="n">mpg</span> <span class="o">-&gt;</span> <span class="n">mpg</span> <span class="o">&lt;=</span> <span class="mi">9</span><span class="o">).</span><span class="na">tag</span><span class="o">(</span><span class="s">"filtered"</span><span class="o">);</span>
+            <span class="n">TStream</span><span class="o">&lt;</span><span class="n">Double</span><span class="o">&gt;</span> <span class="n">poorMpg</span> <span class="o">=</span> <span class="n">mpgReadings</span>
+                    <span class="o">.</span><span class="na">filter</span><span class="o">(</span><span class="n">mpg</span> <span class="o">-&gt;</span> <span class="n">mpg</span> <span class="o">&lt;=</span> <span class="mf">9.0</span><span class="o">).</span><span class="na">tag</span><span class="o">(</span><span class="s">"filtered"</span><span class="o">);</span>
 
             <span class="c1">// Map Double to JsonObject</span>
-            <span class="n">TStream</span><span class="o">&lt;</span><span class="n">JsonObject</span><span class="o">&gt;</span> <span class="n">json</span> <span class="o">=</span> <span class="n">mileage</span>
+            <span class="n">TStream</span><span class="o">&lt;</span><span class="n">JsonObject</span><span class="o">&gt;</span> <span class="n">json</span> <span class="o">=</span> <span class="n">mpgReadings</span>
                     <span class="o">.</span><span class="na">map</span><span class="o">(</span><span class="n">mpg</span> <span class="o">-&gt;</span> <span class="o">{</span>
                         <span class="n">JsonObject</span> <span class="n">jObj</span> <span class="o">=</span> <span class="k">new</span> <span class="n">JsonObject</span><span class="o">();</span>
-                        <span class="n">jObj</span><span class="o">.</span><span class="na">addProperty</span><span class="o">(</span><span class="s">"mileage"</span><span class="o">,</span> <span class="n">mpg</span><span class="o">);</span>
+                        <span class="n">jObj</span><span class="o">.</span><span class="na">addProperty</span><span class="o">(</span><span class="s">"gasMileage"</span><span class="o">,</span> <span class="n">mpg</span><span class="o">);</span>
                         <span class="k">return</span> <span class="n">jObj</span><span class="o">;</span>
                     <span class="o">}).</span><span class="na">tag</span><span class="o">(</span><span class="s">"mapped"</span><span class="o">);</span>
 
-            <span class="c1">// Modify mileage stream to obtain a stream containing the estimated gallons of gas used</span>
-            <span class="n">TStream</span><span class="o">&lt;</span><span class="n">Double</span><span class="o">&gt;</span> <span class="n">gallonsUsed</span> <span class="o">=</span> <span class="n">mileage</span>
+            <span class="c1">// Modify gas mileage stream to obtain a stream containing the estimated gallons of gas used</span>
+            <span class="n">DecimalFormat</span> <span class="n">df</span> <span class="o">=</span> <span class="k">new</span> <span class="n">DecimalFormat</span><span class="o">(</span><span class="s">"#.#"</span><span class="o">);</span>
+            <span class="n">TStream</span><span class="o">&lt;</span><span class="n">Double</span><span class="o">&gt;</span> <span class="n">gallonsUsed</span> <span class="o">=</span> <span class="n">mpgReadings</span>
                     <span class="o">.</span><span class="na">modify</span><span class="o">(</span><span class="n">mpg</span> <span class="o">-&gt;</span> <span class="n">Double</span><span class="o">.</span><span class="na">valueOf</span><span class="o">(</span><span class="n">df</span><span class="o">.</span><span class="na">format</span><span class="o">(</span><span class="n">ROUTE_MILES</span> <span class="o">/</span> <span class="n">mpg</span><span class="o">))).</span><span class="na">tag</span><span class="o">(</span><span class="s">"modified"</span><span class="o">);</span>
 
             <span class="c1">// Terminate the streams</span>
-            <span class="n">poorMileage</span><span class="o">.</span><span class="na">sink</span><span class="o">(</span><span class="n">mpg</span> <span class="o">-&gt;</span> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Poor mileage! "</span> <span class="o">+</span> <span class="n">mpg</span> <span class="o">+</span> <span class="s">" mpg"</span><span class="o">));</span>
+            <span class="n">poorMpg</span><span class="o">.</span><span class="na">sink</span><span class="o">(</span><span class="n">mpg</span> <span class="o">-&gt;</span> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Poor gas mileage! "</span> <span class="o">+</span> <span class="n">mpg</span> <span class="o">+</span> <span class="s">" mpg"</span><span class="o">));</span>
             <span class="n">json</span><span class="o">.</span><span class="na">sink</span><span class="o">(</span><span class="n">mpg</span> <span class="o">-&gt;</span> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"JSON: "</span> <span class="o">+</span> <span class="n">mpg</span><span class="o">));</span>
             <span class="n">gallonsUsed</span><span class="o">.</span><span class="na">sink</span><span class="o">(</span><span class="n">gas</span> <span class="o">-&gt;</span> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Gallons of gas: "</span> <span class="o">+</span> <span class="n">gas</span> <span class="o">+</span> <span class="s">"\n"</span><span class="o">));</span>
 
@@ -762,7 +754,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/recipes/recipe_external_filter_range.html b/content/recipes/recipe_external_filter_range.html
index fbd5168..fbac592 100644
--- a/content/recipes/recipe_external_filter_range.html
+++ b/content/recipes/recipe_external_filter_range.html
@@ -670,7 +670,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/recipes/recipe_hello_quarks.html b/content/recipes/recipe_hello_quarks.html
index 6e56c9f..d06414e 100644
--- a/content/recipes/recipe_hello_quarks.html
+++ b/content/recipes/recipe_hello_quarks.html
@@ -622,7 +622,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/recipes/recipe_source_function.html b/content/recipes/recipe_source_function.html
index e9b17aa..f4c8590 100644
--- a/content/recipes/recipe_source_function.html
+++ b/content/recipes/recipe_source_function.html
@@ -635,7 +635,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/recipes/recipe_value_out_of_range.html b/content/recipes/recipe_value_out_of_range.html
index 1423da7..0d11bba 100644
--- a/content/recipes/recipe_value_out_of_range.html
+++ b/content/recipes/recipe_value_out_of_range.html
@@ -541,25 +541,26 @@
 
 <h2 id="setting-up-the-application">Setting up the application</h2>
 
-<p>We assume that the environment has been set up following the steps outlined in the <a href="../docs/quarks-getting-started">Getting started guide</a>. Let&#39;s begin by creating a <code>DirectProvider</code> and <code>Topology</code>. We also define the optimal temperature range and the initial temperature.</p>
+<p>We assume that the environment has been set up following the steps outlined in the <a href="../docs/quarks-getting-started">Getting started guide</a>. Let&#39;s begin by creating a <code>DirectProvider</code> and <code>Topology</code>. We also define the optimal temperature range.</p>
 <div class="highlight"><pre><code class="language-java" data-lang="java">    <span class="kn">import</span> <span class="nn">static</span> <span class="n">quarks</span><span class="o">.</span><span class="na">function</span><span class="o">.</span><span class="na">Functions</span><span class="o">.</span><span class="na">identity</span><span class="o">;</span>
 
-    <span class="kn">import</span> <span class="nn">java.text.DecimalFormat</span><span class="o">;</span>
-    <span class="kn">import</span> <span class="nn">java.util.Random</span><span class="o">;</span>
     <span class="kn">import</span> <span class="nn">java.util.concurrent.TimeUnit</span><span class="o">;</span>
 
     <span class="kn">import</span> <span class="nn">quarks.analytics.sensors.Filters</span><span class="o">;</span>
+    <span class="kn">import</span> <span class="nn">quarks.analytics.sensors.Range</span><span class="o">;</span>
+    <span class="kn">import</span> <span class="nn">quarks.analytics.sensors.Ranges</span><span class="o">;</span>
     <span class="kn">import</span> <span class="nn">quarks.providers.direct.DirectProvider</span><span class="o">;</span>
+    <span class="kn">import</span> <span class="nn">quarks.samples.utils.sensor.SimulatedTemperatureSensor</span><span class="o">;</span>
     <span class="kn">import</span> <span class="nn">quarks.topology.TStream</span><span class="o">;</span>
     <span class="kn">import</span> <span class="nn">quarks.topology.Topology</span><span class="o">;</span>
 
     <span class="kd">public</span> <span class="kd">class</span> <span class="nc">DetectValueOutOfRange</span> <span class="o">{</span>
         <span class="cm">/**
-         * Optimal temperatures (in Fahrenheit)
+         * Optimal temperature range (in Fahrenheit)
          */</span>
-        <span class="kd">static</span> <span class="kt">double</span> <span class="n">TEMP_LOW</span> <span class="o">=</span> <span class="mf">77.0</span><span class="o">;</span>
-        <span class="kd">static</span> <span class="kt">double</span> <span class="n">TEMP_HIGH</span> <span class="o">=</span> <span class="mf">91.0</span><span class="o">;</span>
-        <span class="kd">static</span> <span class="kt">double</span> <span class="n">currentTemp</span> <span class="o">=</span> <span class="mf">80.0</span><span class="o">;</span>
+        <span class="kd">static</span> <span class="kt">double</span> <span class="n">OPTIMAL_TEMP_LOW</span> <span class="o">=</span> <span class="mf">77.0</span><span class="o">;</span>
+        <span class="kd">static</span> <span class="kt">double</span> <span class="n">OPTIMAL_TEMP_HIGH</span> <span class="o">=</span> <span class="mf">91.0</span><span class="o">;</span>
+        <span class="kd">static</span> <span class="n">Range</span><span class="o">&lt;</span><span class="n">Double</span><span class="o">&gt;</span> <span class="n">optimalTempRange</span> <span class="o">=</span> <span class="n">Ranges</span><span class="o">.</span><span class="na">closed</span><span class="o">(</span><span class="n">OPTIMAL_TEMP_LOW</span><span class="o">,</span> <span class="n">OPTIMAL_TEMP_HIGH</span><span class="o">);</span>
 
         <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="n">main</span><span class="o">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">Exception</span> <span class="o">{</span>
 
@@ -573,24 +574,10 @@
 </code></pre></div>
 <h2 id="generating-temperature-sensor-readings">Generating temperature sensor readings</h2>
 
-<p>The next step is to simulate a stream of temperature readings. In our <code>main()</code>, we use the <code>poll()</code> method to generate a flow of tuples, where a new tuple (temperature reading) arrives every second. We ensure that the generated reading is between 28°F and 112°F.</p>
+<p>The next step is to simulate a stream of temperature readings using <a href="https://github.com/apache/incubator-quarks/blob/master/samples/utils/src/main/java/quarks/samples/utils/sensor/SimulatedTemperatureSensor.java"><code>SimulatedTemperatureSensor</code></a>. By default, the sensor sets the initial temperature to 80°F and ensures that new readings are between 28°F and 112°F. In our <code>main()</code>, we use the <code>poll()</code> method to generate a flow of tuples, where a new tuple (temperature reading) arrives every second.</p>
 <div class="highlight"><pre><code class="language-java" data-lang="java">    <span class="c1">// Generate a stream of temperature sensor readings</span>
-    <span class="n">DecimalFormat</span> <span class="n">df</span> <span class="o">=</span> <span class="k">new</span> <span class="n">DecimalFormat</span><span class="o">(</span><span class="s">"#.#"</span><span class="o">);</span>
-    <span class="n">Random</span> <span class="n">r</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Random</span><span class="o">();</span>
-    <span class="n">TStream</span><span class="o">&lt;</span><span class="n">Double</span><span class="o">&gt;</span> <span class="n">temp</span> <span class="o">=</span> <span class="n">top</span><span class="o">.</span><span class="na">poll</span><span class="o">(()</span> <span class="o">-&gt;</span> <span class="o">{</span>
-        <span class="c1">// Change current temp by some random amount between -1 and 1</span>
-        <span class="k">while</span> <span class="o">(</span><span class="kc">true</span><span class="o">)</span> <span class="o">{</span>
-            <span class="kt">double</span> <span class="n">newTemp</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span> <span class="o">+</span> <span class="o">(</span><span class="mi">1</span> <span class="o">+</span> <span class="mi">1</span><span class="o">)</span> <span class="o">*</span> <span class="n">r</span><span class="o">.</span><span class="na">nextDouble</span><span class="o">()</span> <span class="o">+</span> <span class="n">currentTemp</span><span class="o">;</span>
-            <span class="c1">// Ensure that new temperature is within [28, 112]</span>
-            <span class="k">if</span> <span class="o">(</span><span class="n">newTemp</span> <span class="o">&gt;=</span> <span class="mi">28</span> <span class="o">&amp;&amp;</span> <span class="n">newTemp</span> <span class="o">&lt;=</span> <span class="mi">112</span><span class="o">)</span> <span class="o">{</span>
-                <span class="n">currentTemp</span> <span class="o">=</span> <span class="n">Double</span><span class="o">.</span><span class="na">valueOf</span><span class="o">(</span><span class="n">df</span><span class="o">.</span><span class="na">format</span><span class="o">(</span><span class="n">newTemp</span><span class="o">));</span>
-                <span class="k">break</span><span class="o">;</span>
-            <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
-                <span class="k">continue</span><span class="o">;</span>
-            <span class="o">}</span>
-        <span class="o">}</span>
-        <span class="k">return</span> <span class="n">currentTemp</span><span class="o">;</span>
-    <span class="o">},</span> <span class="mi">1</span><span class="o">,</span> <span class="n">TimeUnit</span><span class="o">.</span><span class="na">SECONDS</span><span class="o">);</span>
+    <span class="n">SimulatedTemperatureSensor</span> <span class="n">tempSensor</span> <span class="o">=</span> <span class="k">new</span> <span class="n">SimulatedTemperatureSensor</span><span class="o">();</span>
+    <span class="n">TStream</span><span class="o">&lt;</span><span class="n">Double</span><span class="o">&gt;</span> <span class="n">temp</span> <span class="o">=</span> <span class="n">top</span><span class="o">.</span><span class="na">poll</span><span class="o">(</span><span class="n">tempSensor</span><span class="o">,</span> <span class="mi">1</span><span class="o">,</span> <span class="n">TimeUnit</span><span class="o">.</span><span class="na">SECONDS</span><span class="o">);</span>
 </code></pre></div>
 <h2 id="simple-filtering">Simple filtering</h2>
 
@@ -598,7 +585,7 @@
 
 <p>In this case, we want to keep temperatures below the lower range value <em>or</em> above the upper range value. This is expressed in the filter predicate, which follows Java&#39;s syntax for <a href="https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html#syntax">lambda expressions</a>. Then, we terminate the stream (using <code>sink</code>) by printing out the warning to standard out. Note that <code>\u00b0</code> is the Unicode encoding for the degree (°) symbol.</p>
 <div class="highlight"><pre><code class="language-java" data-lang="java">    <span class="n">TStream</span><span class="o">&lt;</span><span class="n">Double</span><span class="o">&gt;</span> <span class="n">simpleFiltered</span> <span class="o">=</span> <span class="n">temp</span><span class="o">.</span><span class="na">filter</span><span class="o">(</span><span class="n">tuple</span> <span class="o">-&gt;</span>
-            <span class="n">tuple</span> <span class="o">&lt;</span> <span class="n">TEMP_LOW</span> <span class="o">||</span> <span class="n">tuple</span> <span class="o">&gt;</span> <span class="n">TEMP_HIGH</span><span class="o">);</span>
+            <span class="n">tuple</span> <span class="o">&lt;</span> <span class="n">OPTIMAL_TEMP_LOW</span> <span class="o">||</span> <span class="n">tuple</span> <span class="o">&gt;</span> <span class="n">OPTIMAL_TEMP_HIGH</span><span class="o">);</span>
     <span class="n">simpleFiltered</span><span class="o">.</span><span class="na">sink</span><span class="o">(</span><span class="n">tuple</span> <span class="o">-&gt;</span> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Temperature is out of range! "</span>
             <span class="o">+</span> <span class="s">"It is "</span> <span class="o">+</span> <span class="n">tuple</span> <span class="o">+</span> <span class="s">"\u00b0F!"</span><span class="o">));</span>
 </code></pre></div>
@@ -619,7 +606,7 @@
 
 <p>As with the simple filter, the stream is terminated by printing out the warnings.</p>
 <div class="highlight"><pre><code class="language-java" data-lang="java">    <span class="n">TStream</span><span class="o">&lt;</span><span class="n">Double</span><span class="o">&gt;</span> <span class="n">deadbandFiltered</span> <span class="o">=</span> <span class="n">Filters</span><span class="o">.</span><span class="na">deadband</span><span class="o">(</span><span class="n">temp</span><span class="o">,</span>
-            <span class="n">identity</span><span class="o">(),</span> <span class="n">tuple</span> <span class="o">-&gt;</span> <span class="n">tuple</span> <span class="o">&gt;=</span> <span class="n">TEMP_LOW</span> <span class="o">&amp;&amp;</span> <span class="n">tuple</span> <span class="o">&lt;=</span> <span class="n">TEMP_HIGH</span><span class="o">);</span>
+            <span class="n">identity</span><span class="o">(),</span> <span class="n">tuple</span> <span class="o">-&gt;</span> <span class="n">tuple</span> <span class="o">&gt;=</span> <span class="n">OPTIMAL_TEMP_LOW</span> <span class="o">&amp;&amp;</span> <span class="n">tuple</span> <span class="o">&lt;=</span> <span class="n">OPTIMAL_TEMP_HIGH</span><span class="o">);</span>
     <span class="n">deadbandFiltered</span><span class="o">.</span><span class="na">sink</span><span class="o">(</span><span class="n">tuple</span> <span class="o">-&gt;</span> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Temperature may not be "</span>
             <span class="o">+</span> <span class="s">"optimal! It is "</span> <span class="o">+</span> <span class="n">tuple</span> <span class="o">+</span> <span class="s">"\u00b0F!"</span><span class="o">));</span>
 </code></pre></div>
@@ -657,9 +644,9 @@
 Though not covered in this recipe, Ranges offer additional conveniences for creating applications with external range specifications and adaptable filters.</p>
 
 <p>In the above examples, a single Range can be used in place of the two different expressions for the same logical range:</p>
-<div class="highlight"><pre><code class="language-java" data-lang="java">    <span class="kd">static</span> <span class="kt">double</span> <span class="n">TEMP_LOW</span> <span class="o">=</span> <span class="mf">77.0</span><span class="o">;</span>
-    <span class="kd">static</span> <span class="kt">double</span> <span class="n">TEMP_HIGH</span> <span class="o">=</span> <span class="mf">91.0</span><span class="o">;</span>
-    <span class="kd">static</span> <span class="n">Range</span><span class="o">&lt;</span><span class="n">Double</span><span class="o">&gt;</span> <span class="n">optimalTempRange</span> <span class="o">=</span> <span class="n">Ranges</span><span class="o">.</span><span class="na">closed</span><span class="o">(</span><span class="n">TEMP_LOW</span><span class="o">,</span> <span class="n">TEMP_HIGH</span><span class="o">);</span>
+<div class="highlight"><pre><code class="language-java" data-lang="java">    <span class="kd">static</span> <span class="kt">double</span> <span class="n">OPTIMAL_TEMP_LOW</span> <span class="o">=</span> <span class="mf">77.0</span><span class="o">;</span>
+    <span class="kd">static</span> <span class="kt">double</span> <span class="n">OPTIMAL_TEMP_HIGH</span> <span class="o">=</span> <span class="mf">91.0</span><span class="o">;</span>
+    <span class="kd">static</span> <span class="n">Range</span><span class="o">&lt;</span><span class="n">Double</span><span class="o">&gt;</span> <span class="n">optimalTempRange</span> <span class="o">=</span> <span class="n">Ranges</span><span class="o">.</span><span class="na">closed</span><span class="o">(</span><span class="n">OPTIMAL_TEMP_LOW</span><span class="o">,</span> <span class="n">OPTIMAL_TEMP_HIGH</span><span class="o">);</span>
 </code></pre></div>
 <p>Using <code>optimalTempRange</code> in the Simple filter example code:</p>
 <div class="highlight"><pre><code class="language-java" data-lang="java">    <span class="n">TStream</span><span class="o">&lt;</span><span class="n">Double</span><span class="o">&gt;</span> <span class="n">simpleFiltered</span> <span class="o">=</span> <span class="n">temp</span><span class="o">.</span><span class="na">filter</span><span class="o">(</span><span class="n">tuple</span> <span class="o">-&gt;</span> 
@@ -672,14 +659,13 @@
 <h2 id="the-final-application">The final application</h2>
 <div class="highlight"><pre><code class="language-java" data-lang="java">    <span class="kn">import</span> <span class="nn">static</span> <span class="n">quarks</span><span class="o">.</span><span class="na">function</span><span class="o">.</span><span class="na">Functions</span><span class="o">.</span><span class="na">identity</span><span class="o">;</span>
 
-    <span class="kn">import</span> <span class="nn">java.text.DecimalFormat</span><span class="o">;</span>
-    <span class="kn">import</span> <span class="nn">java.util.Random</span><span class="o">;</span>
     <span class="kn">import</span> <span class="nn">java.util.concurrent.TimeUnit</span><span class="o">;</span>
 
     <span class="kn">import</span> <span class="nn">quarks.analytics.sensors.Filters</span><span class="o">;</span>
     <span class="kn">import</span> <span class="nn">quarks.analytics.sensors.Range</span><span class="o">;</span>
     <span class="kn">import</span> <span class="nn">quarks.analytics.sensors.Ranges</span><span class="o">;</span>
     <span class="kn">import</span> <span class="nn">quarks.providers.direct.DirectProvider</span><span class="o">;</span>
+    <span class="kn">import</span> <span class="nn">quarks.samples.utils.sensor.SimulatedTemperatureSensor</span><span class="o">;</span>
     <span class="kn">import</span> <span class="nn">quarks.topology.TStream</span><span class="o">;</span>
     <span class="kn">import</span> <span class="nn">quarks.topology.Topology</span><span class="o">;</span>
 
@@ -688,12 +674,11 @@
      */</span>
     <span class="kd">public</span> <span class="kd">class</span> <span class="nc">DetectValueOutOfRange</span> <span class="o">{</span>
         <span class="cm">/**
-         * Optimal temperatures inclusive (in Fahrenheit)
+         * Optimal temperature range (in Fahrenheit)
          */</span>
-        <span class="kd">static</span> <span class="kt">double</span> <span class="n">TEMP_LOW</span> <span class="o">=</span> <span class="mf">77.0</span><span class="o">;</span>
-        <span class="kd">static</span> <span class="kt">double</span> <span class="n">TEMP_HIGH</span> <span class="o">=</span> <span class="mf">91.0</span><span class="o">;</span>
-        <span class="kd">static</span> <span class="n">Range</span><span class="o">&lt;</span><span class="n">Double</span><span class="o">&gt;</span> <span class="n">optimalTempRange</span> <span class="o">=</span> <span class="n">Ranges</span><span class="o">.</span><span class="na">closed</span><span class="o">(</span><span class="n">TEMP_LOW</span><span class="o">,</span> <span class="n">TEMP_HIGH</span><span class="o">);</span>
-        <span class="kd">static</span> <span class="kt">double</span> <span class="n">currentTemp</span> <span class="o">=</span> <span class="mf">80.0</span><span class="o">;</span>
+        <span class="kd">static</span> <span class="kt">double</span> <span class="n">OPTIMAL_TEMP_LOW</span> <span class="o">=</span> <span class="mf">77.0</span><span class="o">;</span>
+        <span class="kd">static</span> <span class="kt">double</span> <span class="n">OPTIMAL_TEMP_HIGH</span> <span class="o">=</span> <span class="mf">91.0</span><span class="o">;</span>
+        <span class="kd">static</span> <span class="n">Range</span><span class="o">&lt;</span><span class="n">Double</span><span class="o">&gt;</span> <span class="n">optimalTempRange</span> <span class="o">=</span> <span class="n">Ranges</span><span class="o">.</span><span class="na">closed</span><span class="o">(</span><span class="n">OPTIMAL_TEMP_LOW</span><span class="o">,</span> <span class="n">OPTIMAL_TEMP_HIGH</span><span class="o">);</span>
 
         <span class="cm">/**
          * Polls a simulated temperature sensor to periodically obtain
@@ -708,25 +693,12 @@
             <span class="n">Topology</span> <span class="n">top</span> <span class="o">=</span> <span class="n">dp</span><span class="o">.</span><span class="na">newTopology</span><span class="o">(</span><span class="s">"TemperatureSensor"</span><span class="o">);</span>
 
             <span class="c1">// Generate a stream of temperature sensor readings</span>
-            <span class="n">DecimalFormat</span> <span class="n">df</span> <span class="o">=</span> <span class="k">new</span> <span class="n">DecimalFormat</span><span class="o">(</span><span class="s">"#.#"</span><span class="o">);</span>
-            <span class="n">Random</span> <span class="n">r</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Random</span><span class="o">();</span>
-            <span class="n">TStream</span><span class="o">&lt;</span><span class="n">Double</span><span class="o">&gt;</span> <span class="n">temp</span> <span class="o">=</span> <span class="n">top</span><span class="o">.</span><span class="na">poll</span><span class="o">(()</span> <span class="o">-&gt;</span> <span class="o">{</span>
-                <span class="c1">// Change current temp by some random amount between -1 and 1</span>
-                <span class="k">while</span> <span class="o">(</span><span class="kc">true</span><span class="o">)</span> <span class="o">{</span>
-                    <span class="kt">double</span> <span class="n">newTemp</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span> <span class="o">+</span> <span class="o">(</span><span class="mi">1</span> <span class="o">+</span> <span class="mi">1</span><span class="o">)</span> <span class="o">*</span> <span class="n">r</span><span class="o">.</span><span class="na">nextDouble</span><span class="o">()</span> <span class="o">+</span> <span class="n">currentTemp</span><span class="o">;</span>
-                    <span class="c1">// Ensure that new temperature is within [28, 112]</span>
-                    <span class="k">if</span> <span class="o">(</span><span class="n">newTemp</span> <span class="o">&gt;=</span> <span class="mi">28</span> <span class="o">&amp;&amp;</span> <span class="n">newTemp</span> <span class="o">&lt;=</span> <span class="mi">112</span><span class="o">)</span> <span class="o">{</span>
-                        <span class="n">currentTemp</span> <span class="o">=</span> <span class="n">Double</span><span class="o">.</span><span class="na">valueOf</span><span class="o">(</span><span class="n">df</span><span class="o">.</span><span class="na">format</span><span class="o">(</span><span class="n">newTemp</span><span class="o">));</span>
-                        <span class="k">break</span><span class="o">;</span>
-                    <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
-                        <span class="k">continue</span><span class="o">;</span>
-                    <span class="o">}</span>
-                <span class="o">}</span>
-                <span class="k">return</span> <span class="n">currentTemp</span><span class="o">;</span>
-            <span class="o">},</span> <span class="mi">1</span><span class="o">,</span> <span class="n">TimeUnit</span><span class="o">.</span><span class="na">SECONDS</span><span class="o">);</span>
+            <span class="n">SimulatedTemperatureSensor</span> <span class="n">tempSensor</span> <span class="o">=</span> <span class="k">new</span> <span class="n">SimulatedTemperatureSensor</span><span class="o">();</span>
+            <span class="n">TStream</span><span class="o">&lt;</span><span class="n">Double</span><span class="o">&gt;</span> <span class="n">temp</span> <span class="o">=</span> <span class="n">top</span><span class="o">.</span><span class="na">poll</span><span class="o">(</span><span class="n">tempSensor</span><span class="o">,</span> <span class="mi">1</span><span class="o">,</span> <span class="n">TimeUnit</span><span class="o">.</span><span class="na">SECONDS</span><span class="o">);</span>
 
-            <span class="c1">// Simple filter: Perform analytics on sensor readings to detect when</span>
-            <span class="c1">// the temperature is out of the optimal range and generate warnings</span>
+            <span class="c1">// Simple filter: Perform analytics on sensor readings to</span>
+            <span class="c1">// detect when the temperature is completely out of the</span>
+            <span class="c1">// optimal range and generate warnings</span>
             <span class="n">TStream</span><span class="o">&lt;</span><span class="n">Double</span><span class="o">&gt;</span> <span class="n">simpleFiltered</span> <span class="o">=</span> <span class="n">temp</span><span class="o">.</span><span class="na">filter</span><span class="o">(</span><span class="n">tuple</span> <span class="o">-&gt;</span>
                     <span class="o">!</span><span class="n">optimalTempRange</span><span class="o">.</span><span class="na">contains</span><span class="o">(</span><span class="n">tuple</span><span class="o">));</span>
             <span class="n">simpleFiltered</span><span class="o">.</span><span class="na">sink</span><span class="o">(</span><span class="n">tuple</span> <span class="o">-&gt;</span> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Temperature is out of range! "</span>
@@ -779,7 +751,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/titlepage.html b/content/titlepage.html
index aef524c..02e2cb9 100644
--- a/content/titlepage.html
+++ b/content/titlepage.html
@@ -536,7 +536,7 @@
       <div class="printTitleArea">
         <div class="printTitle"></div>
         <div class="printSubtitle"></div>
-        <div class="lastGeneratedDate">Last generated: April 14, 2016</div>
+        <div class="lastGeneratedDate">Last generated: April 15, 2016</div>
         <hr />
 
         <div class="printTitleImage">
@@ -583,7 +583,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>
diff --git a/content/tocpage.html b/content/tocpage.html
index 3a54d80..49d149a 100644
--- a/content/tocpage.html
+++ b/content/tocpage.html
@@ -729,7 +729,7 @@
         <div class="col-lg-12 footer">
 
              Site last
-            generated: Apr 14, 2016 <br/>
+            generated: Apr 15, 2016 <br/>
 
         </div>
     </div>