Ignore:
Timestamp:
06/26/13 13:27:31 (11 years ago)
Author:
psniegowski
Message:

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:
1 edited

Legend:

Unmodified
Added
Removed
  • java/main/src/main/java/com/framsticks/model/Genotype.java

    r84 r86  
    11package com.framsticks.model;
     2
     3import com.framsticks.params.annotations.FramsClassAnnotation;
     4import com.framsticks.params.annotations.ParamAnnotation;
    25
    36
    47// import org.apache.log4j.Logger;
    58
     9@FramsClassAnnotation
    610public class Genotype extends Model {
    711        // private final static Logger log = Logger.getLogger(Genotype.class);
    812
     13        @ParamAnnotation
    914        public String name;
     15
     16        @ParamAnnotation
    1017        public String genotype;
     18
     19        @ParamAnnotation
    1120        public String info;
    1221
    13         public Double similarity;
    14         public Double getSimi() { return similarity; }
    15         public void setSimi(Double simi) { similarity = simi; }
     22        @ParamAnnotation(id = "simi")
     23        public double similarity;
    1624
    17         public Double brainConnections;
    18         public Double getNumconnections() { return brainConnections; }
    19         public void setNumconnections(Double numconnections) { brainConnections = numconnections; }
     25        @ParamAnnotation(id = "numconnections")
     26        public double brainConnections;
    2027
    21     public Integer ordinalNumber;
    22         public Integer getNum() { return ordinalNumber; }
    23         public void setNum(Integer num) { ordinalNumber = num; }
     28        @ParamAnnotation(id = "num")
     29        public int ordinalNumber;
    2430
    25     public Integer generation;
    26         public Integer getGnum() { return generation; }
    27         public void setGnum(Integer gnum) { generation = gnum; }
     31        @ParamAnnotation(id = "gnum")
     32        public int generation;
    2833
    29         public Integer instances;
     34        @ParamAnnotation
     35        public int instances;
    3036
    31         public Integer lifeSpan;
    32         public Integer getLifespan() { return lifeSpan; }
    33         public void setLifespan(Integer lifespan) { lifeSpan = lifespan; }
     37        @ParamAnnotation(id = "lifespan")
     38        public double lifeSpan;
    3439
    35         public Double velocity;
    36         public Double distance;
     40        @ParamAnnotation
     41        public double velocity;
    3742
    38         public Double verticalVelocity;
    39         public Double getVertvel() { return verticalVelocity; }
    40         public void setVertvel(Double vertvel) { verticalVelocity = vertvel; }
     43        @ParamAnnotation
     44        public double distance;
    4145
    42         public Double verticalPosition;
    43         public Double getVertpos() { return verticalPosition; }
    44         public void setVertpos(Double vertpos) { verticalPosition = vertpos; }
     46        @ParamAnnotation(id = "vertvel")
     47        public double verticalVelocity;
    4548
    46         public Double fitness;
    47         public Double getFit() { return fitness; }
    48         public void setFit(Double fit) { fitness = fit; }
     49        @ParamAnnotation(id = "vertpos")
     50        public double verticalPosition;
    4951
    50         public Double finalFitness;
    51         public Double getFit2() { return finalFitness; }
    52         public void setFit2(Double fit2) { finalFitness = fit2; }
     52        @ParamAnnotation(id = "fit")
     53        public double fitness;
    5354
     55        @ParamAnnotation(id = "fit2")
     56        public double finalFitness;
     57
     58        @ParamAnnotation(id = "f0genotype")
    5459        public String genotypeInF0;
    55         public String getF0genotype() { return genotypeInF0; }
    56         public void setF0genotype(String f0genotype) { genotypeInF0 = f0genotype; }
    5760
     61        @ParamAnnotation(id = "convtrace1")
    5862        public String conversionBacktrace;
    59         public String getConvtrace1() { return conversionBacktrace; }
    60         public void setConvtrace1(String convtrace1) { conversionBacktrace = convtrace1; }
     63
     64        @ParamAnnotation
     65        public boolean isValid;
    6166
    6267        public Object[] userFields = new Object[3];
     68        @ParamAnnotation
    6369        public Object getUser1() { return userFields[0]; }
     70        @ParamAnnotation
    6471        public void setUser1(Object user1) { userFields[0] = user1; }
    6572
     73        @ParamAnnotation
    6674        public Object getUser2() { return userFields[1]; }
     75        @ParamAnnotation
    6776        public void setUser2(Object user2) { userFields[1] = user2; }
    6877
     78        @ParamAnnotation
    6979        public Object getUser3() { return userFields[2]; }
     80        @ParamAnnotation
    7081        public void setUser3(Object user3) { userFields[2] = user3; }
    7182
     83        @ParamAnnotation
    7284        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
    73114
    74115}
Note: See TracChangeset for help on using the changeset viewer.