source: java/main/src/main/java/com/framsticks/model/Creature.java @ 90

Last change on this file since 90 was 90, checked in by psniegowski, 11 years ago

HIGHLIGHTS:

CHANGELOG:
Make ProcedureParam? hold only ValueParams?.

Use id instead of names when naming gui components internally.

Basic procedure calling in GUI.

The actual procedure call is currently only backed
by the ObjectInstance?.

Add UnimplementedException?.

Improve naming of various gui elements.

Allow easy navigating in FEST Swing testing.

Add optional explicit order attribute to FramsClassAnnotation?.

That's because java reflection does return declared members
in any specific order. That ordering is needed only for
classes that have no representation in framsticks and need
a deterministic ordering of params.

Add ControlOwner? interface.

Add test for procedure calling in Browser.

First version of ParamAnnotation? for procedures.

Development of ProcedureParam?.

Add draft version of ProcedureParam? implementation in ReflectionAccess?.

Allow viewing FramsClasses? in gui Browser.

Extract ResourceBuilder? from ModelBuilder?.

Remove internalId from Param.

It was currently completely not utilised. Whether it is still needed
after introduction of ParamAnnotation? is arguable.

Add remaining param attributes to ParamAnnotation?.

Change AutoBuilder? semantics.

AutoBuilder? returns list of objects that are to be appended
with methods @AutoAppendAnnotation?.

This allows to omit explicit addition of ModelPackage? to instance
if the instance uses ModelBuilder? (registration of ModelPackage? comes
from schema).

Fix params ordering problem in auto created FramsClasses?.

Improve ObjectInstance?.

Several fixes to ModelBuilder?.

Improve test for ObjectInstance? in Browser.

Make initialization of robot static.

With robot recreated for second browser test, the test hanged
deep in AWT.

Add base convenience base test for Browser tests.

More tests to ObjectInstance?.

Rename Dispatcher.invokeLater() to dispatch().

Add assertDispatch.

It allows assertions in other threads, than TestNGInvoker.
Assertions are gathered after each method invocation and rethrown.

Use timeOut annotation attribute for tests involving some waiting.

Remove firstTask method (merge with joinableStart).

Clean up leftovers.

Remove unused FavouritesXMLFactory (the reading part is already
completely done with generic XmlLoader?, and writing part will be done
based on the same approach if needed).
Move UserFavourite? to the com.framsticks.gui.configuration package.

Remove GenotypeBrowser? as to specific.

This functionality will be available in ObjectInstance?.

Add interface ParamsPackage?.

Package containing registration of Java classes meant to use with
ReflectionAccess? may be in Instance using configuration.

Minor changes.

Make Group immutable.

Add AutoBuilder? interface extending Builder - only those would
be used to automatically build from XML.

Fix groups in FramsClass?.

Minor naming cleanup in Registry.

Add ModelComponent? interface.

All class creating the Model are implementing that interface.

Extract Model.build into ModelBuilder?.

ModelBuilder? will be compatible with other builders
and allow using it from configuration.

Fix NeuroConnection?.

Add synchronous get operation for dispatchers.

Rename JoinableMonitor? to Monitor.

Add ObjectInstance?.

This class is mainly for demonstration
and testing purposes.

Improve FramsServer? runner.

  • improve ExternalProcess? runner,
  • runner can kill the server but also react properly, when the server exists on it's own,
  • set default path to search for framsticks server installation,
  • add LoggingOutputListener?.
File size: 4.5 KB
Line 
1package com.framsticks.model;
2
3import com.framsticks.params.annotations.FramsClassAnnotation;
4import com.framsticks.params.annotations.ParamAnnotation;
5import com.framsticks.util.math.Point3d;
6
7import java.util.ArrayList;
8import java.util.List;
9
10@FramsClassAnnotation
11public class Creature {
12
13        @ParamAnnotation
14        public String name;
15
16        @ParamAnnotation
17        public String genotype;
18
19        @ParamAnnotation
20        public String info;
21
22        @ParamAnnotation
23        public Object group;
24
25        @ParamAnnotation(id = "gnum")
26        public int generation;
27
28        @ParamAnnotation(id = "buildproblems")
29        public int buildProblems;
30
31        @ParamAnnotation(id = "energ0")
32        public double startingEnergy;
33
34        @ParamAnnotation(id = "idleen")
35        public double idlePowerConsumption;
36
37        @ParamAnnotation
38        public double energy;
39
40        @ParamAnnotation(id = "energy_p")
41        public double energyIncome;
42
43        @ParamAnnotation(id = "energy_m")
44        public double energyCosts;
45
46        @ParamAnnotation(id = "energy_b")
47        public double energyBalance;
48
49        @ParamAnnotation(id = "perf")
50        public int performanceCalculation;
51
52        @ParamAnnotation(id = "nnenabled")
53        public boolean neuralNetworkEnabled;
54
55        @ParamAnnotation(id = "bodysim")
56        public boolean bodySimulation;
57
58        @ParamAnnotation(id = "selfcol")
59        public boolean selfCollisions;
60
61        @ParamAnnotation(id = "lifespan")
62        public int lifeSpan;
63
64        @ParamAnnotation
65        public double distance;
66
67        @ParamAnnotation(id = "c_velocity")
68        public double currentVelocity;
69
70        @ParamAnnotation(id = "c_vertvelocity")
71        public double currentVerticalVelocity;
72
73        @ParamAnnotation(id = "c_vertpos")
74        public double currentVerticalPosition;
75
76        @ParamAnnotation(id = "velocity")
77        public double averageVelocity;
78
79        @ParamAnnotation(id = "vertvel")
80        public double averageVerticalVelocity;
81
82        @ParamAnnotation(id = "vertpos")
83        public double averageVerticalPosition;
84
85        @ParamAnnotation
86        public double pos_x, pos_y, pos_z;
87
88        public Point3d getPosition() { return new Point3d(pos_x, pos_y, pos_z) ; }
89        public void setPosition(Point3d pos) { pos_x = pos.x; pos_y = pos.y; pos_z = pos.z; }
90
91        @ParamAnnotation
92        public double size_x, size_y, size_z;
93
94        public Point3d getBoundingBox() { return new Point3d(size_x, size_y, size_z) ; }
95        public void setBoundingBox(Point3d size) { size_x = size.x; size_y = size.y; size_z = size.z; }
96
97
98        /** center_x, center_y, center_z*/
99        @ParamAnnotation
100        public double center_x, center_y, center_z;
101
102        public Point3d getCenter() { return new Point3d(center_x, center_y, center_z) ; }
103        public void setCenter(Point3d center) { center_x = center.x; center_y = center.y; center_z = center.z; }
104
105        @ParamAnnotation
106        public int getNumparts() { return parts.size(); }
107        @ParamAnnotation
108        public void setNumparts(int numparts) { }
109
110        @ParamAnnotation
111        public int getNumjoints() { return joints.size(); }
112        @ParamAnnotation
113        public void setNumjoints(int numjoints) { }
114
115        @ParamAnnotation
116        public int getNumneurons() { return neurons.size(); }
117        @ParamAnnotation
118        public void setNumneurons(int numneurons) { }
119
120        public Object[] userFields = new Object[3];
121        @ParamAnnotation
122        public Object getUser1() { return userFields[0]; }
123        @ParamAnnotation
124        public void setUser1(Object user1) { userFields[0] = user1; }
125
126        @ParamAnnotation
127        public Object getUser2() { return userFields[1]; }
128        @ParamAnnotation
129        public void setUser2(Object user2) { userFields[1] = user2; }
130
131        @ParamAnnotation
132        public Object getUser3() { return userFields[2]; }
133        @ParamAnnotation
134        public void setUser3(Object user3) { userFields[2] = user3; }
135
136        @ParamAnnotation(id = "selfmask")
137        public int selfCollisionMask;
138
139        @ParamAnnotation(id = "othermask")
140        public int otherCollisionMask;
141
142        @ParamAnnotation(id = "selfcolstate")
143        public boolean selfCollisionsState;
144
145        @ParamAnnotation
146        public String uid;
147
148        @ParamAnnotation
149        public int index;
150
151        @ParamAnnotation
152        public final List<Part> parts = new ArrayList<Part>();
153        @ParamAnnotation
154        public final List<Joint> joints = new ArrayList<Joint>();
155        @ParamAnnotation
156        public final List<NeuroDefinition> neurodefs = new ArrayList<NeuroDefinition>();
157
158        public final List<Part> getParts() { return parts; }
159        public final List<Joint> getJoints() { return joints; }
160        public final List<NeuroDefinition> getNeuroDefs() { return neurodefs; }
161
162        @ParamAnnotation
163        public final List<MechPart> mechparts = new ArrayList<MechPart>();
164        @ParamAnnotation
165        public final List<MechJoint> mechjoints = new ArrayList<MechJoint>();
166        @ParamAnnotation
167        public final List<Neuro> neurons = new ArrayList<Neuro>();
168
169        public final List<MechPart> getMechParts() { return mechparts; }
170        public final List<MechJoint> getMechJoints() { return mechjoints; }
171        public final List<Neuro> getNeurons() { return neurons; }
172
173}
Note: See TracBrowser for help on using the repository browser.