source: java/main/src/main/java/com/framsticks/model/f0/Schema.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: 2.6 KB
Line 
1package com.framsticks.model.f0;
2
3import java.io.InputStream;
4import java.util.Set;
5
6import com.framsticks.params.*;
7import com.framsticks.params.annotations.AutoAppendAnnotation;
8import com.framsticks.params.annotations.FramsClassAnnotation;
9import com.framsticks.params.annotations.ParamAnnotation;
10import com.framsticks.util.lang.Casting;
11
12
13/**
14 * The Class Schema, which represent f0 schema (it contains all the possible
15 * classes definitions that can be used in f0 representation). Definitions are
16 * loaded from XML stream.
17 *
18 * @author Jarek Szymczak <name.surname@gmail.com>
19 * (please replace name and surname with my personal data)
20 */
21@FramsClassAnnotation(id = "f0classes", name = "f0classes")
22public class Schema {
23
24        protected final Registry registry = new Registry();
25
26        /** The neuro classes (classess representing different types of neurons). */
27        private final Registry framsClasses = new Registry();
28        private final Registry neuroClasses = new Registry();
29        // private DoubleMap<String, FramsClass> framsClasses = new DoubleMap<>();
30        // private DoubleMap<String, NeuroClass> neuroClasses = new DoubleMap<>();
31
32        public static InputStream getDefaultDefinitionAsStream() {
33                //return new FileInputStream(new File(Schema.class.getResource("/parsers/f0def.xml").getPath()));
34                return Schema.class.getResourceAsStream("/parsers/f0def.xml");
35        }
36
37        protected static Schema defaultSchema;
38
39        public synchronized static Schema getDefaultSchema() {
40                if (defaultSchema == null) {
41                        defaultSchema = new SchemaBuilder().stream(getDefaultDefinitionAsStream()).finish();
42                }
43                return defaultSchema;
44        }
45
46        public Schema() {
47        }
48
49        @AutoAppendAnnotation
50        public void addClass(FramsClass framsClass) {
51                registry.putFramsClass(framsClass);
52                if (framsClass instanceof NeuroClass) {
53                        neuroClasses.putFramsClass(framsClass);
54                        return;
55                }
56                framsClasses.putFramsClass(framsClass);
57        }
58
59        @AutoAppendAnnotation
60        public void addClass(FramsClassBuilder builder) {
61                addClass(builder.finish());
62        }
63
64        public Set<FramsClass> getNeuroClasses() {
65                return neuroClasses.getFramsClasses();
66        }
67
68        public Set<FramsClass> getFramsClasses() {
69                return framsClasses.getFramsClasses();
70        }
71
72        public NeuroClass getNeuroClass(String identifier) {
73                return Casting.throwCast(NeuroClass.class, neuroClasses.getFramsClass(identifier));
74        }
75
76        public FramsClass getFramsClass(String identifier) {
77                return framsClasses.getFramsClass(identifier);
78        }
79
80        @ParamAnnotation
81        public final Registry getRegistry() {
82                return registry;
83        }
84
85        @ParamAnnotation
86        public final Registry getFramsRegistry() {
87                return framsClasses;
88        }
89
90        @ParamAnnotation
91        public final Registry getNeurosRegistry() {
92                return neuroClasses;
93        }
94
95
96}
Note: See TracBrowser for help on using the repository browser.