Ignore:
Timestamp:
09/10/13 21:11:41 (11 years ago)
Author:
psniegowski
Message:

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:
1 edited

Legend:

Unmodified
Added
Removed
  • java/main/src/main/java/com/framsticks/params/PropertiesAccess.java

    r101 r105  
    11package com.framsticks.params;
    2 
    3 import java.util.HashMap;
    4 import java.util.Map;
    52
    63import com.framsticks.params.types.EventParam;
    74import com.framsticks.params.types.ProcedureParam;
    8 
    95
    106/**
     
    1814public class PropertiesAccess extends SimpleAbstractAccess {
    1915
    20         public Map<String, Object> properties;
     16        protected PropertiesObject properties;
    2117
    2218        @Override
    23         public Map<String, Object> createAccessee() {
    24                 return PropertiesAccess.createPropertiesMap();
    25         }
    26 
    27         public static Map<String, Object> createPropertiesMap() {
    28                 return new HashMap<String, Object>();
     19        public PropertiesObject createAccessee() {
     20                return new PropertiesObject(framsClass.getId());
    2921        }
    3022
     
    4335                assert properties != null;
    4436                assert param != null;
    45                 Object object = properties.get(param.getId());
    46                 if (object != null) {
    47                         try {
    48                                 return type.cast(object);
    49                         } catch (ClassCastException e) {
    50                                 throw (ClassCastException) new ClassCastException("property " + param + " type is " + object.getClass().getName() + ", not " + type.getName()).initCause(e);
    51                         }
     37                Object object = properties.get(param.getId(), Object.class);
     38                if (object == null) {
     39                        return null;
    5240                }
    5341                try {
    54                         return param.getDef(type);
     42                        return type.cast(object);
    5543                } catch (ClassCastException e) {
    56                         throw (ClassCastException) new ClassCastException("default value of property " + param + " is not of type " + type.getName()).initCause(e);
     44                        throw (ClassCastException) new ClassCastException("property " + param + " type is " + object.getClass().getName() + ", not " + type.getName()).initCause(e);
    5745                }
    58 
    5946        }
    6047
    6148        @Override
    6249        protected <T> void internalSet(ValueParam param, T value) {
    63                 properties.put(param.getId(), value);
     50                properties.set(param.getId(), value);
    6451        }
    6552
     
    7360         *            the properties with parameters values
    7461         */
    75         @SuppressWarnings("unchecked")
    7662        @Override
    7763        public PropertiesAccess select(Object object) {
    78                 properties = ParamsUtil.selectObjectForAccess(this, object, Map.class);
     64                properties = ParamsUtil.selectObjectForAccess(this, object, PropertiesObject.class);
    7965                return this;
    8066        }
     
    8268        /** covariant */
    8369        @Override
    84         public Map<String, Object> getSelected() {
     70        public PropertiesObject getSelected() {
    8571                return properties;
    8672        }
     
    9783
    9884        @Override
    99         public Object call(String id, Object[] arguments) {
     85        public Object call(String id, Object... arguments) {
    10086                throw new InvalidOperationException().msg("properties access does not support calling methods").arg("id", id);
    10187        }
    10288
    10389        @Override
    104         public Object call(ProcedureParam param, Object[] arguments) {
     90        public Object call(ProcedureParam param, Object... arguments) {
    10591                throw new InvalidOperationException().msg("properties access does not support calling methods").arg("param", param);
    10692        }
Note: See TracChangeset for help on using the changeset viewer.