Skip to content

Commit

Permalink
#27 - Converted GoalSpec attribute names to follow convention of
Browse files Browse the repository at this point in the history
employing lower case for the first letter.
  • Loading branch information
John Wolfe committed Jul 11, 2014
1 parent cbd5850 commit 7feca7d
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ INSERT INTO O_TFR
// create and relate this goal to the specification
// and to the singleton workout session.
select any goalSpec from instances of GoalSpec
where ( selected.SequenceNumber == param.sequenceNumber );
where ( selected.sequenceNumber == param.sequenceNumber );
create object instance goal of Goal;
relate goal to goalSpec across R9.''specified by'';
select any session from instances of WorkoutSession;
Expand Down Expand Up @@ -62,11 +62,11 @@ INSERT INTO O_TFR
'// Based on the span type for this goal, calculate and
// store the value of the start attribute.
select one goalSpec related by self->GoalSpec[R9.''specified by''];
if ( goalSpec.SpanType == GoalSpan::Time )
if ( goalSpec.spanType == GoalSpan::Time )
select one workoutTimer related by
self->WorkoutSession[R11.''is currently executing within'']->WorkoutTimer[R8.''is timed by''];
self.start = workoutTimer.time;
elif ( goalSpec.SpanType == GoalSpan::Distance )
elif ( goalSpec.spanType == GoalSpan::Distance )
select one session related by self->WorkoutSession[R11.''is currently executing within''];
self.start = session.accumulatedDistance;
else
Expand All @@ -93,19 +93,19 @@ select one session related by self->WorkoutSession[R11.''is currently executing
// Based on the goal criteria type, get the appropriate current value
// for comparison against the criteria (minimum and maximum).
currentValue = 0.0; // Explicit declaration
if ( goalSpec.CriteriaType == GoalCriteria::HeartRate )
if ( goalSpec.criteriaType == GoalCriteria::HeartRate )
currentValue = session.currentHeartRate;
elif ( goalSpec.CriteriaType == GoalCriteria::Pace )
elif ( goalSpec.criteriaType == GoalCriteria::Pace )
currentValue = session.currentPace;
else
LOG::LogFailure( message: "Goal.evaluateAchievement: Unknown Goal Criteria Type." );
end if;

// Compare the current value against the criteria to calculate the return value.
goalDisposition = GoalDisposition::Achieving;
if ( currentValue < goalSpec.Minimum )
if ( currentValue < goalSpec.minimum )
goalDisposition = GoalDisposition::Increase;
elif ( currentValue > goalSpec.Maximum )
elif ( currentValue > goalSpec.maximum )
goalDisposition = GoalDisposition::Decrease;
end if;

Expand Down Expand Up @@ -137,10 +137,10 @@ select one goalSpec related by self->GoalSpec[R9.''specified by''];
// Based on the span type for the goal, get the elapsed span
// for comparison against the specified span for the goal.
elapsedSpan = 0.0; // Explicit declaration
if ( goalSpec.SpanType == GoalSpan::Distance )
if ( goalSpec.spanType == GoalSpan::Distance )
select one session related by self->WorkoutSession[R11.''is currently executing within''];
elapsedSpan = session.accumulatedDistance - self.start;
elif ( goalSpec.SpanType == GoalSpan::Time )
elif ( goalSpec.spanType == GoalSpan::Time )
select one workoutTimer related by
self->WorkoutSession[R11.''is currently executing within'']->WorkoutTimer[R8.''is timed by''];
elapsedSpan = workoutTimer.time - self.start;
Expand All @@ -150,7 +150,7 @@ end if;

// Compare the current value against the specified span to determine
// whether the execution of this workout goal is complete.
if ( elapsedSpan >= goalSpec.Span )
if ( elapsedSpan >= goalSpec.span )
select one openAchievement related by self->Achievement[R14.''has open''];
if ( not empty openAchievement )
openAchievement.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ unrelate self from session across R11.''is currently executing within'';
select one currentGoalSpec related by self->GoalSpec[R9.''specified by''];

select any nextGoalSpec related by session->GoalSpec[R10.''includes'']
where ( selected.SequenceNumber == (currentGoalSpec.SequenceNumber + 1) );
where ( selected.sequenceNumber == (currentGoalSpec.sequenceNumber + 1) );

if ( not empty nextGoalSpec )
Goal::create( sequenceNumber: nextGoalSpec.SequenceNumber );
Goal::create( sequenceNumber: nextGoalSpec.sequenceNumber );
end if;
',
'');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,10 @@ INSERT INTO O_OBJ
'GoalSpec',
8,
'GoalSpec',
'Each instance specifies one particular workout goal. The actual execution of the goal
along with evaluation of whether it is currently being achieved is handled by another
'Each instance specifies one particular workout goal. The actual execution of the goal
along with evaluation of whether it is currently being achieved is handled by another
class, not this one.',
"00000000-0000-0000-0000-000000000000");
INSERT INTO O_NBATTR
VALUES ("f568c69e-b0ba-41ee-aef1-25eb2c07142f",
"be6ddd8b-37a5-4534-961b-772bb1d940ac");
INSERT INTO O_BATTR
VALUES ("f568c69e-b0ba-41ee-aef1-25eb2c07142f",
"be6ddd8b-37a5-4534-961b-772bb1d940ac");
INSERT INTO O_ATTR
VALUES ("f568c69e-b0ba-41ee-aef1-25eb2c07142f",
"be6ddd8b-37a5-4534-961b-772bb1d940ac",
"00000000-0000-0000-0000-000000000000",
'SequenceNumber',
'Workout goals are sequenced according to a number specified by the user when the goal
is specified. This attribute represents that user-specified number. ',
'',
'SequenceNumber',
0,
"ba5eda7a-def5-0000-0000-000000000002",
'',
'');
INSERT INTO O_NBATTR
VALUES ("a0ebe4b4-e0e7-422f-a981-574f075629d3",
"be6ddd8b-37a5-4534-961b-772bb1d940ac");
Expand All @@ -38,14 +19,14 @@ INSERT INTO O_ATTR
VALUES ("a0ebe4b4-e0e7-422f-a981-574f075629d3",
"be6ddd8b-37a5-4534-961b-772bb1d940ac",
"f568c69e-b0ba-41ee-aef1-25eb2c07142f",
'Minimum',
'The minimum value for the quantity associated with the goal.
For example, a minimum heart rate to be maintained.
The units (e.g., beats per minute or minutes per km) for this
attribute are determined by another attribute indicating the
'minimum',
'The minimum value for the quantity associated with the goal.
For example, a minimum heart rate to be maintained.
The units (e.g., beats per minute or minutes per km) for this
attribute are determined by another attribute indicating the
type of criteria for this goal.',
'',
'Minimum',
'minimum',
0,
"ba5eda7a-def5-0000-0000-000000000003",
'',
Expand All @@ -60,14 +41,14 @@ INSERT INTO O_ATTR
VALUES ("1fb4cc85-9e90-4738-8de1-2abd6505cb8c",
"be6ddd8b-37a5-4534-961b-772bb1d940ac",
"a0ebe4b4-e0e7-422f-a981-574f075629d3",
'Maximum',
'The maximum value for the quantity associated with the goal.
For example, a maximum pace to be maintained.
The units (e.g., beats per minute or minutes per km) for this
attribute are determined by another attribute indicating the
'maximum',
'The maximum value for the quantity associated with the goal.
For example, a maximum pace to be maintained.
The units (e.g., beats per minute or minutes per km) for this
attribute are determined by another attribute indicating the
type of criteria for this goal.',
'',
'Maximum',
'maximum',
0,
"ba5eda7a-def5-0000-0000-000000000003",
'',
Expand All @@ -82,14 +63,14 @@ INSERT INTO O_ATTR
VALUES ("1b9ff6a6-df69-4c3f-acfc-6dc3554b1098",
"be6ddd8b-37a5-4534-961b-772bb1d940ac",
"1fb4cc85-9e90-4738-8de1-2abd6505cb8c",
'Span',
'The span of the goal. For example, a time-based goal specifies a span
as a duration or length of time, while a distance-based goal uses specifies
a distance. The units for this attribute (e.g., seconds or km) are specified
by another attribute indicating the type of span.
'span',
'The span of the goal. For example, a time-based goal specifies a span
as a duration or length of time, while a distance-based goal uses specifies
a distance. The units for this attribute (e.g., seconds or km) are specified
by another attribute indicating the type of span.
',
'',
'Span',
'span',
0,
"ba5eda7a-def5-0000-0000-000000000003",
'',
Expand All @@ -104,10 +85,10 @@ INSERT INTO O_ATTR
VALUES ("dbe9b50c-a53f-4c36-951b-baea959bb4e7",
"be6ddd8b-37a5-4534-961b-772bb1d940ac",
"1b9ff6a6-df69-4c3f-acfc-6dc3554b1098",
'CriteriaType',
'criteriaType',
'',
'',
'CriteriaType',
'criteriaType',
0,
"75257d0c-74e6-4444-9cf1-38d5d764c999",
'',
Expand All @@ -129,10 +110,10 @@ INSERT INTO O_ATTR
VALUES ("1d622105-74c9-41c3-8547-4323b5540107",
"be6ddd8b-37a5-4534-961b-772bb1d940ac",
"dbe9b50c-a53f-4c36-951b-baea959bb4e7",
'SpanType',
'spanType',
'',
'',
'SpanType',
'spanType',
0,
"1f8a26c0-7ed5-45b6-9d79-279b0e19b00f",
'',
Expand All @@ -144,14 +125,33 @@ INSERT INTO S_DT_PROXY
'',
'',
'../../TrackingDataTypes/TrackingDataTypes.xtuml');
INSERT INTO O_NBATTR
VALUES ("f568c69e-b0ba-41ee-aef1-25eb2c07142f",
"be6ddd8b-37a5-4534-961b-772bb1d940ac");
INSERT INTO O_BATTR
VALUES ("f568c69e-b0ba-41ee-aef1-25eb2c07142f",
"be6ddd8b-37a5-4534-961b-772bb1d940ac");
INSERT INTO O_ATTR
VALUES ("f568c69e-b0ba-41ee-aef1-25eb2c07142f",
"be6ddd8b-37a5-4534-961b-772bb1d940ac",
"00000000-0000-0000-0000-000000000000",
'sequenceNumber',
'Workout goals are sequenced according to a number specified by the user when the goal
is specified. This attribute represents that user-specified number. ',
'',
'sequenceNumber',
0,
"ba5eda7a-def5-0000-0000-000000000002",
'',
'');
INSERT INTO O_ID
VALUES (0,
"be6ddd8b-37a5-4534-961b-772bb1d940ac");
INSERT INTO O_OIDA
VALUES ("f568c69e-b0ba-41ee-aef1-25eb2c07142f",
"be6ddd8b-37a5-4534-961b-772bb1d940ac",
0,
'SequenceNumber');
'sequenceNumber');
INSERT INTO O_ID
VALUES (1,
"be6ddd8b-37a5-4534-961b-772bb1d940ac");
Expand Down

0 comments on commit 7feca7d

Please sign in to comment.