Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
simcaq-node
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
simcaq
simcaq-node
Commits
9d567436
There was a problem fetching the pipeline summary.
Commit
9d567436
authored
8 years ago
by
Rudolf Copi Eckelberg
Browse files
Options
Downloads
Patches
Plain Diff
Extending locations and simulations...
parent
a6f63136
No related branches found
No related tags found
2 merge requests
!116
Release v1.0.0
,
!25
Auth
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/libs/models/locations.js
+8
-3
8 additions, 3 deletions
src/libs/models/locations.js
src/libs/models/simulation.js
+25
-1
25 additions, 1 deletion
src/libs/models/simulation.js
with
33 additions
and
4 deletions
src/libs/models/locations.js
+
8
−
3
View file @
9d567436
/* These classes are defined to allow checking of location type with the
instanceof operator. */
class
Location
// Location types
// Location types
class
City
{
class
City
extends
Location
{
constructor
(
id
)
{
constructor
(
id
)
{
this
.
id
=
id
;
this
.
id
=
id
;
}
}
}
}
class
State
{
class
State
extends
Location
{
constructor
(
id
)
{
constructor
(
id
)
{
this
.
id
=
id
;
this
.
id
=
id
;
}
}
}
}
class
Region
{
class
Region
extends
Location
{
constructor
(
id
)
{
constructor
(
id
)
{
this
.
id
=
id
;
this
.
id
=
id
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/libs/models/simulation.js
+
25
−
1
View file @
9d567436
...
@@ -3,12 +3,16 @@ const log = require(`${libs}/log`)(module);
...
@@ -3,12 +3,16 @@ const log = require(`${libs}/log`)(module);
const
locations
=
require
(
`
${
libs
}
/models/locations`
);
const
locations
=
require
(
`
${
libs
}
/models/locations`
);
// Should define this somewhere else
const
MAX_SIMULATION_TIME
=
10
;
class
Simulation
{
class
Simulation
{
/* Simulation object to manage parameters and storing */
/* Simulation object to manage parameters and storing */
constructor
(
in_object
=
null
)
{
constructor
(
in_object
=
null
)
{
this
.
name
=
null
;
this
.
name
=
null
;
this
.
location
=
null
;
this
.
location
=
null
;
this
.
sim_
time
=
null
;
this
.
time
=
null
;
this
.
goals
=
{
this
.
goals
=
{
care
:
null
,
care
:
null
,
inclusion
:
null
,
inclusion
:
null
,
...
@@ -20,6 +24,26 @@ class Simulation {
...
@@ -20,6 +24,26 @@ class Simulation {
}
}
}
}
}
}
setTime
(
t
)
{
t
=
parseInt
(
t
,
10
);
if
(
t
>
MAX_SIMULATION_TIME
){
// Throw an error?
return
;
}
this
.
time
=
t
;
}
setLocation
(
l
)
{
// Should sanitize
this
.
location
=
l
;
}
setCareGoals
(
g
)
{
// Should sanitize
this
.
goals
.
care
=
g
;
}
setInclusionGoals
(
g
)
{
// Should sanitize
this
.
goals
.
inclusion
=
g
;
}
run
()
{
run
()
{
/* Runs the Simulation with given parameters */
/* Runs the Simulation with given parameters */
// if (!this.name || !this.location || !this.time) {
// if (!this.name || !this.location || !this.time) {
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment