source: java/main/src/main/java/com/framsticks/model/Genotype.java @ 86

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

HIGHLIGHTS:

  • use java annotations to mark classes and fields to be used when:
    • using java classes with ReflectionAccess? to represent remote objects with FramsClass? description found by "info ..." requests
    • to build up FramsClass? representation of objects not present at remote server
  • allow using primitive types (instead of wraping counterparts) in reflected classes
  • rework FramsClass? creation process (add FramsClassBuilder?)
  • add more tests

CHANGELOG:
Prepare model.World class.

Minor change.

Use primitive types for Genotype and Creature classes.

Use primitive types in model.Neuro* classes.

Use primitive types in model.Joint* classes.

Use primitive types in model.Part* classes.

Fix primitive values.

Extract FramsClassBuilder?.

Add tests of Model classes.

More fixes.

Refactorize out ParamCandidate?.

Several fixes.

Fix all regressions after introducing annotations.

Use annotations throughout the project.

Add exception classes.

Improve creation of FramsClass?.

More changes.

Many changes regarding annotations.

Annotate classes in com.framsticks.model package.

Remove manual FramsClass? constructor.

Construct FramsClass? for Creature. Add test.

Add default values to the ParamAnnotation?.

Add ParamBuilderTest? and ParamAnnotation?.

Add FramsClassAnnotation?.

File size: 2.6 KB
Line 
1package com.framsticks.model;
2
3import com.framsticks.params.annotations.FramsClassAnnotation;
4import com.framsticks.params.annotations.ParamAnnotation;
5
6
7// import org.apache.log4j.Logger;
8
9@FramsClassAnnotation
10public class Genotype extends Model {
11        // private final static Logger log = Logger.getLogger(Genotype.class);
12
13        @ParamAnnotation
14        public String name;
15
16        @ParamAnnotation
17        public String genotype;
18
19        @ParamAnnotation
20        public String info;
21
22        @ParamAnnotation(id = "simi")
23        public double similarity;
24
25        @ParamAnnotation(id = "numconnections")
26        public double brainConnections;
27
28        @ParamAnnotation(id = "num")
29        public int ordinalNumber;
30
31        @ParamAnnotation(id = "gnum")
32        public int generation;
33
34        @ParamAnnotation
35        public int instances;
36
37        @ParamAnnotation(id = "lifespan")
38        public double lifeSpan;
39
40        @ParamAnnotation
41        public double velocity;
42
43        @ParamAnnotation
44        public double distance;
45
46        @ParamAnnotation(id = "vertvel")
47        public double verticalVelocity;
48
49        @ParamAnnotation(id = "vertpos")
50        public double verticalPosition;
51
52        @ParamAnnotation(id = "fit")
53        public double fitness;
54
55        @ParamAnnotation(id = "fit2")
56        public double finalFitness;
57
58        @ParamAnnotation(id = "f0genotype")
59        public String genotypeInF0;
60
61        @ParamAnnotation(id = "convtrace1")
62        public String conversionBacktrace;
63
64        @ParamAnnotation
65        public boolean isValid;
66
67        public Object[] userFields = new Object[3];
68        @ParamAnnotation
69        public Object getUser1() { return userFields[0]; }
70        @ParamAnnotation
71        public void setUser1(Object user1) { userFields[0] = user1; }
72
73        @ParamAnnotation
74        public Object getUser2() { return userFields[1]; }
75        @ParamAnnotation
76        public void setUser2(Object user2) { userFields[1] = user2; }
77
78        @ParamAnnotation
79        public Object getUser3() { return userFields[2]; }
80        @ParamAnnotation
81        public void setUser3(Object user3) { userFields[2] = user3; }
82
83        @ParamAnnotation
84        public String uid;
85
86        @ParamAnnotation
87        public double getStrsiz() { return getNumparts(); }
88        @ParamAnnotation
89        public void setStrsiz(double strsiz) { setNumparts(strsiz); }
90
91
92        @ParamAnnotation
93        public double getStrjoints() { return getNumjoints(); }
94        @ParamAnnotation
95        public void setStrjoints(double strjoints) { setNumjoints(strjoints); }
96
97
98        @ParamAnnotation
99        public double getNnsiz() { return getNumneurons(); }
100        @ParamAnnotation
101        public void setNnsiz(double nnsiz) { setNumneurons(nnsiz); }
102
103
104        @ParamAnnotation
105        public double getNncon() { return brainConnections; }
106        @ParamAnnotation
107        public void setNncon(double nncon) { this.brainConnections = nncon; }
108
109        @ParamAnnotation
110        public int getPopsiz() { return instances; }
111        @ParamAnnotation
112        public void setPopsiz(int popsiz) { this.instances = popsiz; }
113
114
115}
116
Note: See TracBrowser for help on using the repository browser.