source: java/main/src/main/java/com/framsticks/params/Param.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.2 KB
Line 
1package com.framsticks.params;
2
3
4import javax.annotation.concurrent.Immutable;
5
6import com.framsticks.params.annotations.FramsClassAnnotation;
7import com.framsticks.params.annotations.ParamAnnotation;
8
9/**
10 * Based on c++ struct ParamEntry located in cpp/gdk/param.h
11 * Here  it is a root of Param hierarchy.
12 *
13 * @author Jarek Szymczak <name.surname@gmail.com>, Mateusz Jarus
14 * (please replace name and surname with my personal data)
15 *
16 * @author Piotr Śniegowski
17 */
18@Immutable
19@FramsClassAnnotation(id = "prop", name = "prop")
20public abstract class Param {
21
22        /** The parameter id. */
23        protected final String id;
24
25        /** The parameter name. */
26        protected final String name;
27
28        /** The help (description) concerning parameter. */
29        protected final String help;
30
31        /** The number of group, that parameter belongs to. */
32        protected final Integer group;
33
34        /** The getFlags stored as a bit sum. */
35        protected final Integer flags;
36
37        //TODO
38        /** The variable determining whether the parameter is an extra parameter. */
39        protected final Integer extra;
40
41        public Param(ParamBuilder builder) {
42                id = builder.getId();
43                name = builder.getName();
44                help = builder.getHelp();
45                group = builder.getGroup();
46                flags = builder.getFlags();
47                extra = builder.getExtra();
48        }
49
50        @ParamAnnotation
51        public String getId() {
52                return id;
53        }
54
55        @ParamAnnotation
56        public String getName() {
57                return name;
58        }
59
60        @ParamAnnotation
61        public String getHelp() {
62                return help;
63        }
64
65        @ParamAnnotation
66        public Integer getGroup() {
67                return group;
68        }
69
70        @ParamAnnotation
71        public Integer getFlags() {
72                return flags;
73        }
74
75        public abstract String getFramsTypeName();
76
77        @ParamAnnotation
78        public Integer getExtra() {
79                return extra;
80        }
81
82        @Override
83        public String toString() {
84                return getId() + ":" + this.getClass().getSimpleName();
85        }
86
87        public boolean isNumeric() {
88                return false;
89        }
90
91        public abstract Class<?> getStorageType();
92
93        public boolean hasFlag(int flag) {
94                return flags != null && (flags & flag) != 0;
95        }
96
97        public boolean isUserHidden() {
98                return (flags & Flags.USERHIDDEN) != 0;
99        }
100
101        public static ParamBuilder build() {
102                return new ParamBuilder();
103        }
104
105        public static ParamBuilder build(FramsClassBuilder builder) {
106                return new ParamBuilder(builder);
107        }
108
109}
Note: See TracBrowser for help on using the repository browser.