source: java/main/src/main/java/com/framsticks/params/Param.java @ 101

Last change on this file since 101 was 101, checked in by psniegowski, 11 years ago

HIGHLIGHTS:

  • improve tree side notes
  • improve GUI layout
  • add foldable list of occured events to EventControl?
  • improve automatic type conversion in proxy listeners
  • implement several Access functionalities as algorithms independent of Access type
  • introduce draft base classes for distributed experiments
  • automatically register dependant Java classes to FramsClass? registry
  • add testing prime experiment and configuration
  • simplify and improve task dispatching

CHANGELOG:
Improve task dispatching in RemoteTree?.

GUI no longer hangs on connection problems.

Make all dispatchers joinables.

Refactorize Thread dispatcher.

Remove Task and PeriodicTask?.

Use Java utilities in those situations.

Reworking tasks dispatching.

Fix bug in EventControl? listener dispatching.

Minor improvements.

Add testing configuration for ExternalProcess? in GUI.

More improvement to prime.

Support for USERREADONLY in GUI.

Add that flag to various params in Java classes.

Remove redundant register clauses from several FramsClassAnnotations?.

Automatically gather and register dependant classes.

Add configuration for prime.

Improve Simulator class.

Add prime.xml configuration.

Introduce draft Experiment and Simulator classes.

Add prime experiment tests.

Enclose typical map with listeners into SimpleUniqueList?.

Needfile works in GUI.

Improve needfile handling in Browser.

More improvement with NeedFile?.

Implementing needfile.

Update test.

Rename ChangeEvent? to TestChangeEvent?.

Automatic argument type search in RemoteTree? listeners.

MultiParamLoader? uses AccessProvider?. By default old implementation
enclosed in AccessStash? or Registry.

Minor changes.

Rename SourceInterface? to Source.

Also improve toString of File and ListSource?.

Remove unused SimpleSource? class.

Add clearing in HistoryControl?.

Show entries in table at EventControl?.

Improve EventControl?.

Add listeners registration to EventControl?.

Add foldable table to HistoryControl?.

Add control row to Procedure and Event controls.

Improve layout of controls.

Another minor change to gui layout.

Minor improvement in the SliderControl?.

Minor changes.

Move ReflectionAccess?.Backend to separate file.

It was to cluttered.

Cleanup in ReflectionAccess?.

Move setMin, setMax, setDef to AccessOperations?.

Extract loading operation into AccessOperations?.

Append Framsticks to name of UnsupportedOperationException?.

The java.lang.UnsupportedOperationException? was shadowing this class.

Rename params.Util to params.ParamsUtil?.

Several improvements.

Minor changes.

Implement revert functionality.

Improve local changes management.

Minor improvement.

Remove methods rendered superfluous after SideNoteKey? improvement.

Improve SideNoteKey?.

It is now generic type, so explicit type specification at
call site is no more needed.

Introduce SideNoteKey? interface.

Only Objects implementing that key may be used as side note keys.

Minor improvements.

Use strings instead of ValueControls? in several gui mappings.

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", order = {"id", "name", "type", "flags", "help", "group", "extra"})
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 int flags;
36
37        //TODO
38        /** The variable determining whether the parameter is an extra parameter. */
39        protected final int 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(def = "0")
71        public Integer getFlags() {
72                return flags;
73        }
74
75        @ParamAnnotation(id = "type")
76        public abstract String getFramsTypeName();
77
78        @ParamAnnotation
79        public Integer getExtra() {
80                return extra;
81        }
82
83        @Override
84        public String toString() {
85                return getId() + ":" + this.getClass().getSimpleName();
86        }
87
88        public boolean isNumeric() {
89                return false;
90        }
91
92        public abstract Class<?> getStorageType();
93
94        public boolean hasFlag(int flag) {
95                return (flags & flag) != 0;
96        }
97
98        public static ParamBuilder build() {
99                return new ParamBuilder();
100        }
101
102        public static ParamBuilder build(FramsClassBuilder builder) {
103                return new ParamBuilder(builder);
104        }
105
106}
Note: See TracBrowser for help on using the repository browser.