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

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

HIGHLIGHTS:

  • import refactorization: move Tree, Path, etc.

from core to structure package

  • initial serialization implementation
  • improve PrimeExperiment? test
  • many organizational changes and convenience improvements

CHANGELOG:
Make registry in AbstractTree? final.

Move most classes from core to structure package.

Minor changes.

Switch names of Future and FutureHandler?.

Rename ExceptionResultHandler? to ExceptionHandler?.

Rename ExceptionHandler? to ExceptionDispatcherHandler?.

Fix bug in ParamCandidate? cache.

Add missing synchronization to the BufferedDispatcher?.

Develop @Serialized support.

Rework serialization further.

Add serialization/deserialization interface to ValueParam?.

Move getStorageType and isNumeric from Param down to params hierarchy.

Minor changes.

Improve param type induction.

Add TestSerializedClass? for testing new serialization.

Add info files gor GenePool? and Population.

Add standard.expt exemplary netfile.

Add type name field to PropertiesObject?.

Use PropertiesObject? for PropertiesAccess? instead of ordinary map.

Hide getFramsClass is several more places.

More unification accross FramsClass?, Access and Path.

Add ParamCollection?.

Simplify interface for getting params from FramsClass?, Access
or Path.

Make Access.call() interface variadic.

Add arguments(args) convenience wrapper around new Object[] {args}.

Upgrade to apache.commons.lang version 3.1

Minor improvement with Response constructors.

Develop proper result printing in ClientAtServer?.

Add experimentNetsave to PrimeExperiment?.

File size: 2.1 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        /** The variable determining whether the parameter is an extra parameter. */
38        protected final int extra;
39
40        public Param(ParamBuilder builder) {
41                id = builder.getId();
42                name = builder.getName();
43                help = builder.getHelp();
44                group = builder.getGroup();
45                flags = builder.getFlags();
46                extra = builder.getExtra();
47        }
48
49        @ParamAnnotation
50        public String getId() {
51                return id;
52        }
53
54        @ParamAnnotation
55        public String getName() {
56                return name;
57        }
58
59        @ParamAnnotation
60        public String getHelp() {
61                return help;
62        }
63
64        @ParamAnnotation
65        public Integer getGroup() {
66                return group;
67        }
68
69        @ParamAnnotation(def = "0")
70        public Integer getFlags() {
71                return flags;
72        }
73
74        @ParamAnnotation(id = "type")
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 hasFlag(int flag) {
88                return (flags & flag) != 0;
89        }
90
91        public static ParamBuilder build() {
92                return new ParamBuilder();
93        }
94
95        public static ParamBuilder build(FramsClassBuilder builder) {
96                return new ParamBuilder(builder);
97        }
98
99}
Note: See TracBrowser for help on using the repository browser.