Ignore:
Timestamp:
07/14/13 23:20:04 (11 years ago)
Author:
psniegowski
Message:

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

Legend:

Unmodified
Added
Removed
  • java/main/src/main/java/com/framsticks/core/TreeOperations.java

    r100 r101  
    11package com.framsticks.core;
    2 
    32
    43import java.util.HashSet;
     
    2221import com.framsticks.params.PropertiesAccess;
    2322import com.framsticks.params.UniqueListAccess;
    24 import com.framsticks.params.Util;
     23import com.framsticks.params.ParamsUtil;
    2524import com.framsticks.params.types.EventParam;
    2625import com.framsticks.params.types.ObjectParam;
     
    4342        }
    4443
    45         public static final Object FETCHED_MARK = new Object();
    46 
    47         public static @Nonnull FramsClass processFetchedInfo(Tree tree, File file) {
     44        public static final SideNoteKey<Boolean> FETCHED_MARK = SideNoteKey.make(Boolean.class);
     45
     46        public static @Nonnull
     47        FramsClass processFetchedInfo(Tree tree, File file) {
    4848                assert tree.isActive();
    4949                FramsClass framsClass = Loaders.loadFramsClass(file.getContent());
     
    8080                assert path.isTheSame(files.get(0).getPath());
    8181
    82 
    8382                try {
    8483                        log.debug("process fetched values: {}", path);
     
    9897                                        if (path.getTop().getParam() instanceof ObjectParam) {
    9998                                                assert results.size() == 1;
    100                                                 Util.takeAllNonNullValues(bindAccess(result), parsingAccess.select(results.get(0)));
     99                                                ParamsUtil.takeAllNonNullValues(bindAccess(result), parsingAccess.select(results.get(0)));
    101100                                                mark(result.getTree(), result.getTopObject(), FETCHED_MARK, true);
    102101                                                future.pass(result);
    103102                                                return;
    104103                                        }
    105 
    106104
    107105                                        final ListAccess listAccess = (ListAccess) access;
     
    139137
    140138                                                targetAccess.select(childTo);
    141                                                 Util.takeAllNonNullValues(targetAccess, parsingAccess);
     139                                                ParamsUtil.takeAllNonNullValues(targetAccess, parsingAccess);
    142140                                                if (newOne) {
    143141                                                        listAccess.set(id, childTo);
     
    188186        }
    189187
    190 
    191         public static @Nonnull Access bindAccessFromSideNote(Tree tree, Object object) {
    192                 CompositeParam param = tree.getSideNote(object, CompositeParam.class, CompositeParam.class);
     188        public static @Nonnull
     189        Access bindAccessFromSideNote(Tree tree, Object object) {
     190                CompositeParam param = tree.getSideNote(object, Path.OBJECT_PARAM_KEY);
    193191                if (param == null) {
    194192                        throw new FramsticksException().msg("failed to bind access from side node").arg("tree", tree).arg("object", object).arg("type", object.getClass());
     
    197195        }
    198196
    199         public static @Nonnull Access bindAccess(Tree tree, String path) {
     197        public static @Nonnull
     198        Access bindAccess(Tree tree, String path) {
    200199                log.debug("bind access for textual: {} in {}", path, tree);
    201200                return bindAccess(Path.to(tree, path));
    202201        }
    203202
    204         public static @Nonnull Access bindAccess(Node node) {
     203        public static @Nonnull
     204        Access bindAccess(Node node) {
    205205                Tree tree = node.getTree();
    206206                assert tree.isActive();
     
    209209                try {
    210210                        Access access = tree.prepareAccess(node.getParam());
    211                         tree.putSideNote(node.getObject(), CompositeParam.class, node.getParam());
     211                        tree.putSideNote(node.getObject(), Path.OBJECT_PARAM_KEY, node.getParam());
    212212
    213213                        return access.select(node.getObject());
     
    218218        }
    219219
    220         public static @Nonnull Access bindAccess(Path path) {
     220        public static @Nonnull
     221        Access bindAccess(Path path) {
    221222                assert path.getTree().isActive();
    222223                path.assureResolved();
     
    280281                });
    281282        }
    282 
    283283
    284284        /**
     
    323323        public static Object createAccessee(Tree tree, CompositeParam param) {
    324324                Object object = tree.prepareAccess(param).createAccessee();
    325                 tree.putSideNote(object, CompositeParam.class, param);
     325                tree.putSideNote(object, Path.OBJECT_PARAM_KEY, param);
    326326                return object;
    327327        }
     
    329329        public static Object createAccessee(Tree tree, Access access) {
    330330                Object object = access.createAccessee();
    331                 tree.putSideNote(object, CompositeParam.class, access.buildParam(new ParamBuilder()).finish(CompositeParam.class));
     331                tree.putSideNote(object, Path.OBJECT_PARAM_KEY, access.buildParam(new ParamBuilder()).finish(CompositeParam.class));
    332332                return object;
    333333        }
    334334
    335         public static boolean isMarked(Tree tree, Object object, Object mark, boolean defValue) {
    336                 assert tree.isActive();
    337                 Boolean v = tree.getSideNote(object, mark, Boolean.class);
     335        public static boolean isMarked(Tree tree, Object object, SideNoteKey<Boolean> mark, boolean defValue) {
     336                assert tree.isActive();
     337                Boolean v = tree.getSideNote(object, mark);
    338338                return (v != null ? v : defValue);
    339339        }
    340340
    341         public static void mark(Tree tree, Object object, Object mark, boolean value) {
     341        public static void mark(Tree tree, Object object, SideNoteKey<Boolean> mark, boolean value) {
    342342                assert tree.isActive();
    343343                tree.putSideNote(object, mark, value);
     
    348348        }
    349349
     350        public static <T extends Param> T getParam(Path path, String id, Class<T> type) {
     351                return getFramsClass(path).getParamEntry(id, type);
     352        }
     353
     354        public static <T> T getOrCreateSideNote(Tree tree, Object object, SideNoteKey<T> key) {
     355                T result = tree.getSideNote(object, key);
     356                if (result == null) {
     357                        result = key.newValue();
     358                        tree.putSideNote(object, key, result);
     359                }
     360                return result;
     361        }
     362
     363        public static <T> boolean hasSideNotes(Tree tree, Object object, SideNoteKey<T> key) {
     364                return tree.getSideNote(object, key) != null;
     365        }
     366
     367        public static <T> boolean hasSideNote(Path path, SideNoteKey<T> key) {
     368                return path.getTree().getSideNote(path.getTopObject(), key) != null;
     369        }
     370
     371        public static <T> T getSideNote(Path path, SideNoteKey<T> key) {
     372                assert path.isResolved();
     373                return path.getTree().getSideNote(path.getTopObject(), key);
     374        }
     375
     376        public static <T> void putSideNote(Path path, SideNoteKey<T> key, T value) {
     377                path.getTree().putSideNote(path.getTopObject(), key, value);
     378        }
     379
     380        public static boolean removeSideNote(Path path, SideNoteKey<?> key) {
     381                assert path.isResolved();
     382                return path.getTree().removeSideNote(path.getTopObject(), key);
     383        }
     384
    350385}
Note: See TracChangeset for help on using the changeset viewer.