Skip to content

Commit 898f7cd

Browse files
committed
Added some new coffee recipes
1 parent ddcb1a8 commit 898f7cd

5 files changed

Lines changed: 127 additions & 2 deletions

File tree

nbproject/configs/Raspberry_Pi.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ $target.profile=profile-remote
44
$target.run=run-remote
55
compile.on.save.unsupported.remote.platform=true
66
debug-transport=dt_socket
7-
platform.runtime=Raspberry_Pi
7+
platform.runtime=CoffeePi

src/com/nighthacking/recipe/CommandLineReciperRunner.java renamed to src/com/nighthacking/recipe/CommandLineRecipeRunner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/**
66
* @author Stephen Chin <steveonjava@gmail.com>
77
*/
8-
public class CommandLineReciperRunner extends RecipeRunner {
8+
public class CommandLineRecipeRunner extends RecipeRunner {
99

1010
private final Display display = new CommandLineDisplay();
1111

src/com/nighthacking/recipe/Step.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ public static Step waitFor(Ingredient ingredient, double margin) {
6464
return new Step(e -> e.getScale().waitForStable(w -> Math.abs(w - ingredient.getWeight()) < margin));
6565
}
6666

67+
public static Step waitForAtLeast(Ingredient ingredient) {
68+
return waitForAtLeast(ingredient, ingredient.getWeight() / 10);
69+
}
70+
71+
public static Step waitForAtLeast(Ingredient ingredient, double margin) {
72+
return new Step(e -> e.getScale().waitFor(w -> w > ingredient.getWeight() - margin / 2));
73+
}
74+
6775
public static Step countdown(int seconds) {
6876
return new Step(e -> e.getDisplay().countdown(seconds));
6977
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package com.nighthacking.recipes;
2+
3+
import com.nighthacking.recipe.Step;
4+
import com.nighthacking.recipe.Ingredient;
5+
import com.nighthacking.recipe.Recipe;
6+
7+
/**
8+
* @author Stephen Chin <steveonjava@gmail.com>
9+
*/
10+
public class CleverCoffeeDripper implements Recipe {
11+
12+
private static final double CUP_SIZE = 300; // grams
13+
private final Ingredient beans;
14+
private final Ingredient water;
15+
16+
public CleverCoffeeDripper(double strength) {
17+
beans = Ingredient.byWeight(CoffeeCalculator.grindWeight(strength, CUP_SIZE), "Graos de Cafe");
18+
water = Ingredient.byWeight(CUP_SIZE, "Agua");
19+
}
20+
21+
@Override
22+
public String name() {
23+
return "Clever Coffee Dripper";
24+
}
25+
26+
@Override
27+
public String description() {
28+
return "Preparacao precisa de uma caneca de cafe usando "
29+
+ " um coador de cafe e uma balanca.";
30+
}
31+
32+
@Override
33+
public Ingredient[] ingredients() {
34+
return new Ingredient[]{beans, water};
35+
}
36+
37+
@Override
38+
public Step[] steps() {
39+
return new Step[]{
40+
Step.say("Adicione " + beans),
41+
Step.waitFor(beans),
42+
Step.say("Otimo, agora tire os graos de cafe da balanca."),
43+
Step.waitForClear(),
44+
Step.say("Hora do trabalho pesado! Moa os graos de cafe!!!"),
45+
Step.say("Coloque o filtro no coador de cafe e jogue o cafe moido dentro"),
46+
Step.waitForContents(),
47+
Step.tare(),
48+
Step.say("Coloque " + water + " a 97oC"),
49+
Step.waitForAtLeast(water),
50+
Step.countdown(60),
51+
Step.say("Pronto! Coloque o coador de cafe em cima da caneca."),
52+
Step.waitForClear(),
53+
Step.say("Experimente o seu Java cafe agora!")
54+
};
55+
}
56+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package com.nighthacking.recipes;
2+
3+
import com.nighthacking.recipe.Step;
4+
import com.nighthacking.recipe.Ingredient;
5+
import com.nighthacking.recipe.Recipe;
6+
7+
/**
8+
* @author Stephen Chin <steveonjava@gmail.com>
9+
*/
10+
public class PourOverCoffee implements Recipe {
11+
12+
private static final double CUP_SIZE = 200; // grams
13+
private static final double BREW_RATIO = .15; // beans / water
14+
private final Ingredient beans;
15+
private final Ingredient brewingWater;
16+
private final Ingredient extraWater;
17+
18+
public PourOverCoffee(double strength) {
19+
beans = Ingredient.byWeight(CoffeeCalculator.grindWeight(strength, CUP_SIZE), "Coffee Beans");
20+
brewingWater = Ingredient.byWeight(CUP_SIZE * BREW_RATIO, "Water");
21+
extraWater = Ingredient.byWeight(CUP_SIZE - brewingWater.getWeight(), "Water");
22+
}
23+
24+
@Override
25+
public String name() {
26+
return "Pout Over Coffee";
27+
}
28+
29+
@Override
30+
public String description() {
31+
return "Precisely brews 1 cup of coffee using a pour over method and a scale.";
32+
}
33+
34+
@Override
35+
public Ingredient[] ingredients() {
36+
return new Ingredient[]{beans, brewingWater, extraWater};
37+
}
38+
39+
@Override
40+
public Step[] steps() {
41+
return new Step[]{
42+
Step.say("Add " + beans),
43+
Step.waitFor(beans),
44+
Step.say("Great, take your beans off the scale now."),
45+
Step.waitForClear(),
46+
Step.say("Put your cup, dripper, filter, and grinds on"),
47+
Step.waitForContents(),
48+
Step.tare(),
49+
Step.say("Pour " + brewingWater + " at 200F"),
50+
Step.waitForAtLeast(brewingWater),
51+
Step.tare(),
52+
Step.countdown(30),
53+
Step.say("Pour an additional " + extraWater),
54+
Step.waitForAtLeast(extraWater),
55+
Step.countdown(60),
56+
Step.say("Done! Take your coffee off the scale."),
57+
Step.waitForClear(),
58+
Step.say("Enjoy your Java brew!")
59+
};
60+
}
61+
}

0 commit comments

Comments
 (0)