Changeset 79 for java/main/src/main/java/com/framsticks
- Timestamp:
- 01/09/13 13:00:20 (11 years ago)
- Location:
- java/main/src/main/java/com/framsticks
- Files:
-
- 1 added
- 2 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
java/main/src/main/java/com/framsticks/examples/GenotypeBrowser.java
r78 r79 37 37 38 38 registry.putInfoIntoCache(new FramsClass("ModelBuilderRoot", "ModelBuilderRoot", null) 39 .append(new ParamBuilder().setType("o Model").setId("f0genotype").setName("f0genotype").build()) 40 .append(new ParamBuilder().setType("o F0Model").setId("f0model").setName("f0model").build()) 39 .append(new ParamBuilder().setType("o Model").setId("model").setName("model").build()) 41 40 ); 42 41 root = new Node((CompositeParam)new ParamBuilder().setType("o ModelBuilderRoot").setId(name).setName("Instance").build(), PropertiesAccess.createPropertiesMap()); … … 50 49 List<AccessInterface> accesses = new F0Parser(schema, GenotypeBrowser.class.getResourceAsStream("/examples/f0_example.txt")).parse(); 51 50 List<Object> objects = Util.stripAccessInterface(accesses); 52 F0Genotype f0Genotype = F0Genotype.build(objects); 53 F0Model f0Model = F0Model.build(f0Genotype); 51 Model model = Model.build(objects); 54 52 55 for (String n : new String[] {"MechPart", "MechJoint", "Neuro"}) {56 registry.putInfoIntoCache(FramsClass.readFromStream(GenotypeBrowser.class.getResourceAsStream("/info/" + n + ".info")));57 }58 53 AccessInterface rootAccess = bindAccess(new Path(this, "/")); 59 54 60 rootAccess.set("f0genotype", f0Genotype); 61 rootAccess.set("f0model", f0Model); 55 rootAccess.set("model", model); 62 56 63 57 } catch (Exception e) { -
java/main/src/main/java/com/framsticks/model/BasePart.java
r78 r79 1 1 package com.framsticks.model; 2 2 3 import com.framsticks.util.Orientation; 3 4 import com.framsticks.util.Point3d; 4 5 … … 29 30 30 31 32 public double oxx, oxy, oxz, oyx, oyy, oyz, ozx, ozy, ozz; 33 34 public Orientation getOrientation() { return new Orientation(new Point3d(oxx, oxy, oxz), new Point3d(oyx, oyy, oyz), new Point3d(ozx, ozy, ozz)); } 35 36 public void setOrientation(Orientation o) { 37 oxx = o.x.x; 38 oxy = o.x.y; 39 oxz = o.x.z; 40 oyx = o.y.x; 41 oyy = o.y.y; 42 oyz = o.y.z; 43 ozx = o.z.x; 44 ozy = o.z.y; 45 ozz = o.z.z; 46 } 47 31 48 public void copyFrom(BasePart p) { 32 49 setPosition(p.getPosition()); 50 setOrientation(p.getOrientation()); 33 51 mass = p.mass; 34 52 size = p.size; -
java/main/src/main/java/com/framsticks/model/Creature.java
r78 r79 8 8 import java.util.List; 9 9 10 public class Creature extends F0Model{10 public class Creature { 11 11 public String name; 12 12 … … 147 147 public final List<NeuroDef> neurodefs = new ArrayList<NeuroDef>(); 148 148 149 150 151 149 public final List<Part> getParts() { return parts; } 152 150 public final List<Joint> getJoints() { return joints; } 153 151 public final List<NeuroDef> getNeuroDefs() { return neurodefs; } 152 153 public final List<MechPart> mechparts = new ArrayList<MechPart>(); 154 public final List<MechJoint> mechjoints = new ArrayList<MechJoint>(); 155 public final List<Neuro> neurons = new ArrayList<Neuro>(); 156 157 public final List<MechPart> getMechParts() { return mechparts; } 158 public final List<MechJoint> getMechJoints() { return mechjoints; } 159 public final List<Neuro> getNeurons() { return neurons; } 154 160 155 161 … … 160 166 constructor.field("joints"); 161 167 constructor.field("neurodefs"); 168 constructor.field("mechparts"); 169 constructor.field("mechjoints"); 170 constructor.field("neurons"); 162 171 } 163 172 -
java/main/src/main/java/com/framsticks/model/Genotype.java
r78 r79 4 4 import org.apache.log4j.Logger; 5 5 6 public class Genotype extends F0Genotype{6 public class Genotype extends Model { 7 7 private final static Logger LOGGER = Logger.getLogger(Genotype.class); 8 8 -
java/main/src/main/java/com/framsticks/model/MechPart.java
r78 r79 19 19 public void setVelocity(Point3d v) { vx = v.x; vy = v.y; vz = v.z; } 20 20 21 public double oxx, oxy, oxz, oyx, oyy, oyz, ozx, ozy, ozz;22 23 public Orientation getOrientation() { return new Orientation(new Point3d(oxx, oxy, oxz), new Point3d(oyx, oyy, oyz), new Point3d(ozx, ozy, ozz)); }24 25 public void setOrientation(Orientation o) {26 oxx = o.x.x;27 oxy = o.x.y;28 oxz = o.x.z;29 oyx = o.y.x;30 oyy = o.y.y;31 oyz = o.y.z;32 ozx = o.z.x;33 ozy = o.z.y;34 ozz = o.z.z;35 }36 21 37 22 } -
java/main/src/main/java/com/framsticks/model/Package.java
r78 r79 17 17 registry.registerReflectedClass("NeuroDef", "n", "com.framsticks.model.NeuroDef"); 18 18 registry.registerReflectedClass("Part", "p", "com.framsticks.model.Part"); 19 registry.registerReflectedClass("Model", "m", "com.framsticks.model.F0Genotype"); 20 registry.registerReflectedClass("F0Model", null, "com.framsticks.model.F0Model"); 21 registry.registerReflectedClass("F0Genotype", null, "com.framsticks.model.F0Genotype"); 19 registry.registerReflectedClass("Model", "m", "com.framsticks.model.Model"); 22 20 registry.registerReflectedClass("Creature", null, "com.framsticks.model.Creature"); 23 21 registry.registerReflectedClass("Genotype", null, "com.framsticks.model.Genotype"); 24 22 25 registry.putInfoIntoCache(new FramsClass.Constructor(F0Model.class, "F0Model").getResult());26 23 } 27 24 } -
java/main/src/main/java/com/framsticks/model/Part.java
r78 r79 33 33 public void setDn(Double dn) { density = dn; } 34 34 35 36 35 public Double getIng() { return ingestion; } 37 36 public void setIng(Double ing) { ingestion = ing; } -
java/main/src/main/java/com/framsticks/parsers/F0Parser.java
r78 r79 9 9 import java.util.List; 10 10 11 import com.framsticks.model. F0Genotype;11 import com.framsticks.model.Model; 12 12 import static com.framsticks.params.SimpleAbstractAccess.*; 13 13 … … 109 109 110 110 /** If no 'm' (Model) line was found, than simulate it on the beginning of the result.*/ 111 if (result.isEmpty() || !(result.get(0) instanceof F0Genotype)) {111 if (result.isEmpty() || !(result.get(0) instanceof Model)) { 112 112 result.add(0, processLine("m:")); 113 113 }
Note: See TracChangeset
for help on using the changeset viewer.