Skip to content

Commit

Permalink
Importing MashProfiles will no longer auto-calculate by default.
Browse files Browse the repository at this point in the history
  • Loading branch information
caseydavenport committed Jun 21, 2015
1 parent e89e1a3 commit 7c62191
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 25 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ buildscript {
apply plugin: 'com.android.application'

dependencies {
compile 'com.android.support:support-v4:20.0+'
compile 'com.android.support:support-v4:22.2.0'
}

android {
Expand Down
2 changes: 1 addition & 1 deletion local.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Sat May 16 16:49:09 BST 2015
#Sun Jun 21 15:20:29 PDT 2015
sdk.dir=C\:\\Users\\Casey\\AppData\\Local\\Android\\sdk
79 changes: 56 additions & 23 deletions src/com/biermacht/brews/xml/RecipeXmlReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,62 @@ public class RecipeXmlReader extends DefaultHandler {

// Use a stringBuilder to store the characters read by the parser. When the end of the
// element is reached, they are converted to a String and stored in currentValue.
String currentValue = null;
StringBuilder stringBuilder;
private String currentValue;
private StringBuilder stringBuilder;

// Lists to store all the objects created from the parsed XML.
ArrayList<Recipe> list = new ArrayList<Recipe>();
ArrayList<Ingredient> fermList = new ArrayList<Ingredient>();
ArrayList<Ingredient> hopList = new ArrayList<Ingredient>();
ArrayList<Ingredient> yeastList = new ArrayList<Ingredient>();
ArrayList<Ingredient> miscList = new ArrayList<Ingredient>();
ArrayList<BeerStyle> beerStyleList = new ArrayList<BeerStyle>();
ArrayList<MashProfile> mashProfileList = new ArrayList<MashProfile>();
ArrayList<MashStep> mashStepList = new ArrayList<MashStep>();
private ArrayList<Recipe> list;
private ArrayList<Ingredient> fermList;
private ArrayList<Ingredient> hopList;
private ArrayList<Ingredient> yeastList;
private ArrayList<Ingredient> miscList;
private ArrayList<BeerStyle> beerStyleList;
private ArrayList<MashProfile> mashProfileList;
private ArrayList<MashStep> mashStepList;

// Objects for each type of thing
Recipe r = new Recipe("");
Fermentable f = new Fermentable("");
Hop h = new Hop("");
Yeast y = new Yeast("");
Misc misc = new Misc("");
BeerStyle style = new BeerStyle("");
MashProfile profile = new MashProfile(r);
MashStep mashStep = new MashStep(r);

// How we know what thing we're looking at
Stack thingTypeStack = new Stack();
private Recipe r;
private Fermentable f;
private Hop h;
private Yeast y;
private Misc misc;
private BeerStyle style;
private MashProfile profile;
private MashStep mashStep;

// How we know what thing we're looking at.
private Stack thingTypeStack;

public RecipeXmlReader() {

// Lists to store all the objects created from the parsed XML.
this.list = new ArrayList<Recipe>();
this.fermList = new ArrayList<Ingredient>();
this.hopList = new ArrayList<Ingredient>();
this.yeastList = new ArrayList<Ingredient>();
this.miscList = new ArrayList<Ingredient>();
this.beerStyleList = new ArrayList<BeerStyle>();
this.mashProfileList = new ArrayList<MashProfile>();
this.mashStepList = new ArrayList<MashStep>();

// Objects for each type of thing
this.r = new Recipe();
this.f = new Fermentable("");
this.h = new Hop("");
this.y = new Yeast("");
this.misc = new Misc("");
this.style = new BeerStyle("");
this.profile = new MashProfile(r);

// Mash steps should not perform auto-calculation, and should instead use any
// values read from the XML file.
this.mashStep = new MashStep(r);
this.mashStep.setAutoCalcInfuseAmt(false);
this.mashStep.setAutoCalcInfuseTemp(false);

// How we know what thing we're looking at
this.thingTypeStack = new Stack();
}

/**
* The return methods that will return lists of all of the elements that have been parsed in the
Expand Down Expand Up @@ -191,8 +222,10 @@ public void startElement(String uri, String localName, String qName, Attributes

// Encounter new mash step
if (qName.equalsIgnoreCase("MASH_STEP")) {
thingTypeStack.push(qName);
mashStep = new MashStep(r);
this.thingTypeStack.push(qName);
this.mashStep = new MashStep(r);
this.mashStep.setAutoCalcInfuseAmt(false);
this.mashStep.setAutoCalcInfuseTemp(false);
}

// Encounter new mash step list
Expand Down

0 comments on commit 7c62191

Please sign in to comment.