Last change
on this file was 1, checked in by Wouter Pasman, 6 years ago |
Initial import : Genius 9.0.0
|
File size:
777 bytes
|
Line | |
---|
1 | /*
|
---|
2 | * Author: Max W. Y. Lam (Aug 1 2015)
|
---|
3 | * Version: Milestone 1
|
---|
4 | *
|
---|
5 | * */
|
---|
6 |
|
---|
7 | package agents.anac.y2016.maxoops;
|
---|
8 |
|
---|
9 | import java.util.HashMap;
|
---|
10 | import java.util.Random;
|
---|
11 |
|
---|
12 | public class AgentParameters {
|
---|
13 |
|
---|
14 | Random rand = null;
|
---|
15 | HashMap<String, Double> list = null;
|
---|
16 |
|
---|
17 | public AgentParameters() {
|
---|
18 | this.rand = new Random();
|
---|
19 | this.list = new HashMap<String, Double>();
|
---|
20 | }
|
---|
21 |
|
---|
22 | public void addParam(String paramName, double paramVal) {
|
---|
23 | this.list.put(paramName, paramVal);
|
---|
24 | }
|
---|
25 |
|
---|
26 | public void addParam(String paramName, double upperBound, double lowerBound) {
|
---|
27 | double paramVal = this.rand.nextDouble();
|
---|
28 | paramVal = paramVal * (upperBound - lowerBound) + lowerBound;
|
---|
29 | this.list.put(paramName, paramVal);
|
---|
30 | }
|
---|
31 |
|
---|
32 | public double getParam(String paramName) {
|
---|
33 | return this.list.get(paramName);
|
---|
34 | }
|
---|
35 |
|
---|
36 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.