Ignore:
Timestamp:
07/02/13 16:20:07 (11 years ago)
Author:
psniegowski
Message:

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

Legend:

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

    r86 r90  
    33import com.framsticks.params.annotations.FramsClassAnnotation;
    44import com.framsticks.params.annotations.ParamAnnotation;
    5 import com.framsticks.util.lang.Casting;
    65import com.framsticks.util.lang.Containers;
    7 import com.framsticks.util.lang.IterableIterator;
    8 import com.framsticks.util.math.Orientation;
    9 import org.apache.log4j.Logger;
    106
    117import java.util.ArrayList;
    12 import java.util.Iterator;
    138import java.util.List;
    149
     
    1712 */
    1813@FramsClassAnnotation(id = "m")
    19 public class Model {
    20 
    21         private final static Logger log = Logger.getLogger(Model.class);
     14public class Model implements ModelComponent {
    2215
    2316        @ParamAnnotation(id = "se")
     
    3932        public final List<Joint> joints = new ArrayList<Joint>();
    4033
    41         @ParamAnnotation
    42         public final List<NeuroDef> neurodefs = new ArrayList<NeuroDef>();
     34        @ParamAnnotation(id = "neurodefs")
     35        public final List<NeuroDefinition> neuroDefinitions = new ArrayList<NeuroDefinition>();
     36
     37        @ParamAnnotation(id = "neuroconns")
     38        public final List<NeuroConnection> neuroConnections = new ArrayList<NeuroConnection>();
    4339
    4440        //TODO: why those methods returns and accepts doubles?
     
    4844        public double getNumjoints() { return (double)joints.size(); }
    4945        @ParamAnnotation
    50         public double getNumneurons() { return (double)neurodefs.size(); }
     46        public double getNumneurons() { return (double)neuroDefinitions.size(); }
    5147
    5248        //this is impossible to use, because numparts field is marked as readonly
     
    5652        public void setNumjoints(double numjoints) { Containers.resizeList(joints, (int)(double)numjoints); }
    5753        @ParamAnnotation
    58         public void setNumneurons(double numneurons) { Containers.resizeList(neurodefs, (int)(double)numneurons); }
     54        public void setNumneurons(double numneurons) { Containers.resizeList(neuroDefinitions, (int)(double)numneurons); }
    5955
    6056        public List<Part> getParts() { return parts; }
    6157        public List<Joint> getJoints() { return joints; }
    62         public List<NeuroDef> getNeuroDefs() { return neurodefs; }
     58        public List<NeuroDefinition> getNeuroDefinitions() { return neuroDefinitions; }
     59        public List<NeuroConnection> getNeuroConnections() { return neuroConnections; }
    6360
    64         public static Model build(List<Object> objects) {
    65                 Iterator<Object> i = objects.iterator();
    66                 if (!i.hasNext()) {
    67                         return null;
    68                 }
    69                 Model f0Genotype = Casting.tryCast(Model.class, i.next());
    70                 if (f0Genotype == null) {
    71                         log.fatal("first object is not a Model");
    72                         return null;
    73                 }
    74                 for (Object object : new IterableIterator<Object>(i)) {
    75                         if (object instanceof Joint) {
    76                                 f0Genotype.joints.add((Joint)object);
    77                                 continue;
    78                         }
    79                         if (object instanceof Part) {
    80                                 f0Genotype.parts.add((Part)object);
    81                                 continue;
    82                         }
    83                         if (object instanceof NeuroDef) {
    84                                 f0Genotype.neurodefs.add((NeuroDef) object);
    85                                 continue;
    86                         }
    87                         log.error("invalid class: " + object.getClass().getCanonicalName());
    88                 }
    89 
    90                 for (Part p : f0Genotype.getParts()) {
    91                         p.setOrientation(new Orientation().rotate(p.getRotation()));
    92                 }
    93                 for (Joint j : f0Genotype.getJoints()) {
    94                         /** based on c++ Joint::attachToParts*/
    95                         Part p1 = f0Genotype.parts.get(j.part1);
    96                         Part p2 = f0Genotype.parts.get(j.part2);
    97                         assert p1 != null && p2 != null;
    98                         Orientation o = new Orientation().rotate(j.getRotation());
    99                         p2.setOrientation(p1.getOrientation().transform(o));
    100                         p2.setPosition(p2.getOrientation().transform(j.getDelta()).add(p1.getPosition()));
    101                 }
    102                 return f0Genotype;
    103         }
    10461}
Note: See TracChangeset for help on using the changeset viewer.