Ignore:
Timestamp:
07/16/13 23:31:35 (11 years ago)
Author:
psniegowski
Message:

HIGHLIGHTS:

for Joinables running

CHANGELOG:
Add WorkPackageLogic? and classes representing prime experiment state.

Add classes for PrimeExperiment? state.

Extract single netload routine in Simulator.

Working netload with dummy content in PrimeExperiment?.

More development with NetLoadSaveLogic? and PrimeExperiment?.

Improvement around prime.

Improve BufferedDispatcher?.isActive logic.

Add prime-all.xml configuration.

Manual connecting to existing simulators from GUI.

Guard in SimulatorConnector? against expdef mismatch.

Guard against empty target dispatcher in BufferedDispatcher?.

Make BufferedDispatcher? a Dispatcher (and Joinable).

Minor improvements.

Done StackedJoinable?, improve Experiment.

Develop StackedJoinable?.

Add StackedJoinable? utility joinables controller.

Add dependency on apache-commons-lang.

Add ready ListChange? on Simulators.

Improve hints in ListChange?.

Several improvements.

Found bug with dispatching in Experiment.

Minor improvements.

Fix bug with early finishing Server.

Many changes in Dispatching.

Fix bug with connection.

Do not obfuscate log with socket related exceptions.

Add SocketClosedException?.

Add SimulatorConnector?.

Work out conception of experiment composing of logics building blocks.

Rename SinkInterface? to Sink.

Move saving of Accesses into AccessOperations?.

Some improvements to Experiment.

Improve joinables.

Fix issue with joinables closing.

Add direct and managed consoles to popup menu.

File:
1 edited

Legend:

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

    r100 r102  
    11package com.framsticks.core;
     2
     3import java.util.Arrays;
     4import java.util.Set;
     5import java.util.TreeSet;
     6
     7import org.apache.commons.lang.StringUtils;
    28
    39import com.framsticks.params.annotations.FramsClassAnnotation;
     
    915 * @author Piotr Sniegowski
    1016 */
    11 @FramsClassAnnotation(order = {"type", "pos", "id"})
     17@FramsClassAnnotation(order = {"type", "pos", "id", "hint"})
    1218public class ListChange {
    1319
     20        public static enum Action {
     21                Add,
     22                Remove,
     23                Modify
     24        }
    1425
    15         /**
    16          * @param action
    17          */
    18         public ListChange(Action action, Integer position, String identifier) {
     26
     27        public ListChange(Action action, Integer position, String identifier, Object... hints) {
    1928                this.action = action;
    2029                this.position = position;
    2130                this.identifier = identifier;
     31                if (hints.length != 0) {
     32                        this.hints = new TreeSet<>();
     33                        for (Object h : hints) {
     34                                this.hints.add(h.toString());
     35                        }
     36                }
    2237        }
    2338
     
    4055        }
    4156
    42         public static enum Action {
    43                 Add,
    44                 Remove,
    45                 Modify
    46                 // Add(0),
    47                 // Remove(1),
    48                 // Modify(2);
    4957
    50                 // public final int value;
     58        public boolean hasHint(String hint) {
     59                if (hints == null) {
     60                        return false;
     61                }
     62                return hints.contains(hint);
     63        }
    5164
    52                 // /**
    53                 //  * @param value
    54                 //  */
    55                 // Action(int value) {
    56                 //      this.value = value;
    57                 // }
    58 
    59         }
    6065
    6166        public Action action = Action.Add;
     
    6469        @ParamAnnotation(id = "id")
    6570        public String identifier;
     71
     72        protected Set<String> hints;
     73
     74        @ParamAnnotation
     75        public String getHints() {
     76                return StringUtils.join(hints, ",");
     77        }
     78
     79        @ParamAnnotation
     80        public void setHints(String hints) {
     81                if (!Strings.notEmpty(hints)) {
     82                        this.hints = null;
     83                        return;
     84                }
     85                this.hints = new TreeSet<>();
     86                this.hints.addAll(Arrays.asList(StringUtils.split(hints, ",")));
     87        }
    6688
    6789        @ParamAnnotation
     
    79101        @Override
    80102        public String toString() {
    81                 return action + " " + identifier + " " + position;
     103                StringBuilder b = new StringBuilder();
     104                b.append(action).append(" ").append(identifier).append(" ").append(position);
     105                if (hints != null && !hints.isEmpty()) {
     106                        b.append(" ").append(getHints());
     107                }
     108                return b.toString();
    82109        }
    83110
     
    86113                if (object instanceof ListChange) {
    87114                        ListChange r = (ListChange) object;
    88                         return Misc.equals(action, r.action) && Misc.equals(position, r.position) && Misc.equals(identifier, r.identifier);
     115                        return Misc.equals(action, r.action) && Misc.equals(position, r.position) && Misc.equals(identifier, r.identifier) && Misc.equals(hints, r.hints);
    89116                }
    90117                return false;
Note: See TracChangeset for help on using the changeset viewer.