1 | package com.framsticks.model; |
---|
2 | |
---|
3 | import com.framsticks.params.annotations.FramsClassAnnotation; |
---|
4 | import com.framsticks.params.annotations.ParamAnnotation; |
---|
5 | |
---|
6 | import java.util.ArrayList; |
---|
7 | import java.util.List; |
---|
8 | |
---|
9 | /** |
---|
10 | * Author: Piotr Śniegowski |
---|
11 | */ |
---|
12 | @FramsClassAnnotation(id = "m") |
---|
13 | public class Model implements ModelComponent { |
---|
14 | |
---|
15 | @ParamAnnotation(id = "se") |
---|
16 | public double startingEnergy; |
---|
17 | |
---|
18 | @ParamAnnotation |
---|
19 | public double getEnerg0() { return startingEnergy; } |
---|
20 | @ParamAnnotation |
---|
21 | public void setEnerg0(double energ0) { startingEnergy = energ0; } |
---|
22 | |
---|
23 | |
---|
24 | @ParamAnnotation(id = "Vstyle") |
---|
25 | public String visualizationStyle; |
---|
26 | |
---|
27 | @ParamAnnotation |
---|
28 | public final List<Part> parts = new ArrayList<Part>(); |
---|
29 | |
---|
30 | @ParamAnnotation |
---|
31 | public final List<Joint> joints = new ArrayList<Joint>(); |
---|
32 | |
---|
33 | @ParamAnnotation(id = "neurodefs") |
---|
34 | public final List<NeuroDefinition> neuroDefinitions = new ArrayList<NeuroDefinition>(); |
---|
35 | |
---|
36 | @ParamAnnotation(id = "neuroconns") |
---|
37 | public final List<NeuroConnection> neuroConnections = new ArrayList<NeuroConnection>(); |
---|
38 | |
---|
39 | /** Those methods accept doubles to keep consistency with Framsticks server.*/ |
---|
40 | @ParamAnnotation |
---|
41 | public double getNumparts() { return (double)parts.size(); } |
---|
42 | @ParamAnnotation |
---|
43 | public double getNumjoints() { return (double)joints.size(); } |
---|
44 | @ParamAnnotation |
---|
45 | public double getNumneurons() { return (double)neuroDefinitions.size(); } |
---|
46 | |
---|
47 | //this is impossible to use, because numparts field is marked as readonly |
---|
48 | @ParamAnnotation |
---|
49 | public void setNumparts(double numparts) {} |
---|
50 | @ParamAnnotation |
---|
51 | public void setNumjoints(double numjoints) {} |
---|
52 | @ParamAnnotation |
---|
53 | public void setNumneurons(double numneurons) {} |
---|
54 | |
---|
55 | public List<Part> getParts() { return parts; } |
---|
56 | public List<Joint> getJoints() { return joints; } |
---|
57 | public List<NeuroDefinition> getNeuroDefinitions() { return neuroDefinitions; } |
---|
58 | public List<NeuroConnection> getNeuroConnections() { return neuroConnections; } |
---|
59 | |
---|
60 | @Override |
---|
61 | public String toString() { |
---|
62 | return "Model{" + parts.size() + ":" + joints.size() + ":" + neuroDefinitions.size() + ":" + neuroConnections.size() + "}"; |
---|
63 | |
---|
64 | } |
---|
65 | |
---|
66 | } |
---|