blob: bce8419318f6e45be1b353106c236597b0173f09 (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
 | package com.mikemiller.gymlog;
import java.io.Serializable;
/**
 * Created by Mike on 3/29/14. COPYRIGHT OLIO.
 */
public class Activity implements Serializable {
    private String mName;
    private int mSets;
    private int mRepsLow;
    private int mRepsHigh;
    private int mWeightDecrement_percent;
    private int mRepIncrement;
    public Activity (String name, int sets, int repsLow, int repsHigh, int weightDecrement_percent, int repIncrement) {
        mName = name;
        mSets = sets;
        mRepsLow = repsLow;
        mRepsHigh = repsHigh;
        mWeightDecrement_percent = weightDecrement_percent;
        mRepIncrement = repIncrement;
    }
    public String getName() { return mName; }
    public int getSets() { return mSets; }
    public int getRepsLow() { return mRepsLow; }
    public int getRepsHigh() { return mRepsHigh; }
    public int getWeightForSet(int set, int setOneWeight) {
        double val =  (int)(setOneWeight - (set - 1) * setOneWeight * (mWeightDecrement_percent / 100.0));
        return (int) (5*(Math.round(val/5))); // Round to the nearest 5 lbs
    }
    public int getRepIncrement() { return mRepIncrement; }
    public String getSummary(int setOneWeight, int currentReps) {
        String summary = "";
        String reps = getRepsLow() + (getRepsLow() == getRepsHigh() ? "" : " - " + getRepsHigh());
        summary += reps + " reps ("+ currentReps + ")\n\n";
        for (int i = 1; i <= getSets(); i++) {
            summary += i + ": " + getWeightForSet(i, setOneWeight);
            if (i > 1 && getRepIncrement() > 0) summary += " (+" + getRepIncrement() + " rep)";
            if (i < getSets()) summary += "\n";
        }
        return summary;
    }
}
 |