[7] | 1 | package tudelft.mentalhealth.perfectfit;
|
---|
| 2 |
|
---|
| 3 | import java.io.IOException;
|
---|
| 4 |
|
---|
| 5 | /**
|
---|
| 6 | * Contains a single goal line from the goals database.
|
---|
| 7 | */
|
---|
| 8 | public class GoalLine {
|
---|
| 9 | private final int id;
|
---|
| 10 | private final String introduction;
|
---|
| 11 | private final String goal;
|
---|
| 12 | private final String how;
|
---|
| 13 |
|
---|
| 14 | private final Characteristics characteristics;
|
---|
| 15 |
|
---|
| 16 | /**
|
---|
| 17 | * @param data list of string with values for id introduction goal how
|
---|
| 18 | * godin_activity exercise_se exercise_identity extraversion
|
---|
| 19 | * ttm_pa openness_to_experiences sitting_weekend age
|
---|
| 20 | * household_income household_size. All values are assumed
|
---|
| 21 | * normalized.
|
---|
| 22 | * @throws IOException
|
---|
| 23 | */
|
---|
| 24 | public GoalLine(String[] data) throws IOException {
|
---|
| 25 | this.id = Integer.valueOf(data[0]);
|
---|
| 26 | this.introduction = data[1];
|
---|
| 27 | this.goal = data[2];
|
---|
| 28 | this.how = data[3];
|
---|
| 29 | this.characteristics = new Characteristics(num(data[4]), num(data[5]),
|
---|
| 30 | num(data[6]), num(data[7]), num(data[8]), num(data[9]),
|
---|
| 31 | num(data[10]), num(data[11]), num(data[12]), num(data[13]));
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | private double num(String string) {
|
---|
| 35 | return Double.valueOf(string);
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | @Override
|
---|
| 39 | public String toString() {
|
---|
| 40 | return "[" + id + ":" + introduction + " " + goal + " " + how + ","
|
---|
| 41 | + characteristics + "]\n";
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | public int getId() {
|
---|
| 45 | return id;
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | public String getIntro() {
|
---|
| 49 | return introduction;
|
---|
| 50 | }
|
---|
| 51 |
|
---|
| 52 | public String getGoal() {
|
---|
| 53 | return goal;
|
---|
| 54 | }
|
---|
| 55 |
|
---|
| 56 | public String getHow() {
|
---|
| 57 | return how;
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | public Characteristics characteristics() {
|
---|
| 61 | return characteristics;
|
---|
| 62 | }
|
---|
| 63 | }
|
---|