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/params/FramsClassBuilder.java

    r100 r101  
    55import java.lang.reflect.Member;
    66import java.lang.reflect.Method;
    7 import java.lang.reflect.ParameterizedType;
    8 import java.lang.reflect.Type;
    97import java.util.ArrayList;
    108import java.util.Collections;
     
    4038        }
    4139
    42         public static ParamBuilder induceParamType(ParamBuilder builder, Type type) {
    43                 // if (type.equals(Void.TYPE)) {
    44                 //      throw new ConstructionException().msg("void is not a valid type");
    45                 // }
    46 
    47                 if (type instanceof ParameterizedType) {
    48                         ParameterizedType p = (ParameterizedType) type;
    49                         Type rawType = p.getRawType();
    50                         Type containedType = null;
    51                         //TODO make implementation here
    52                         boolean map = false;
    53                         StringBuilder b = new StringBuilder();
    54                         if (rawType.equals(Map.class)) {
    55                                 containedType = p.getActualTypeArguments()[1];
    56                                 map = true;
    57                                 b.append("l");
    58                         } else if (rawType.equals(List.class)) {
    59                                 containedType = p.getActualTypeArguments()[0];
    60                                 b.append("l");
    61                         } else if (rawType.equals(EventListener.class)) {
    62                                 containedType = p.getActualTypeArguments()[0];
    63                                 b.append("e");
    64                         }
    65                         if (!(containedType instanceof Class)) {
    66                                 return builder;
    67                         }
    68                         b.append(" ");
    69 
    70                         Class<?> containedClass = (Class<?>) containedType;
    71                         FramsClassAnnotation fca = containedClass.getAnnotation(FramsClassAnnotation.class);
    72                         if (fca == null) {
    73                                 throw new ConstructionException().msg("the contained class is not annotated").arg("class", containedClass);
    74                         }
    75                         b.append(getName(fca, containedClass));
    76                         //TODO parametrize this
    77                         if (map) {
    78                                 b.append(" uid");
    79                         }
    80 
    81                         builder.type(b.toString());
    82                         return builder;
    83                 }
    84 
    85                 if (type instanceof Class) {
    86 
    87                         Class<?> cl = (Class<?>) type;
    88 
    89                         // TODO: future support for enum
    90                         // if (cl.isEnum()) {
    91                         //      Class<? extends Enum<?>> enumType = (Class<? extends Enum<?>>) cl;
    92                         //      Enum<?>[] enums = enumType.getEnumConstants();
    93                         //      StringBuilder b = new StringBuilder();
    94 
    95                         //      b.append("d 0 ").append(enums.length - 1).append(" 0 ");
    96                         //      for (Enum<?> e : enums) {
    97                         //              b.append("~").append(e.name());
    98                         //      }
    99                         //      return b.toString();
    100                         // }
    101                         if (cl.equals(Integer.class) || cl.equals(int.class)) {
    102                                 builder.type("d");
    103                                 return builder;
    104                         }
    105                         if (cl.equals(String.class)) {
    106                                 builder.type("s");
    107                                 return builder;
    108                         }
    109                         if (cl.equals(Double.class) || cl.equals(double.class)) {
    110                                 builder.type("f");
    111                                 return builder;
    112                         }
    113                         if (cl.equals(Boolean.class) || cl.equals(boolean.class)) {
    114                                 builder.type( "d 0 1");
    115                                 return builder;
    116                         }
    117                         if (cl.equals(Object.class)) {
    118                                 builder.type("x");
    119                                 return builder;
    120                         }
    121 
    122 
    123                         // builder.type("o " + (cl).getCanonicalName());
    124                         builder.type("o " + cl.getSimpleName());
    125                         builder.fillStorageType(cl);
    126                         return builder;
    127                 }
    128 
    129                 throw new ConstructionException().msg("failed to find framsticks for native type").arg("type", type);
    130         }
    131 
    132 
    133         public static ParamBuilder induceParamType(ParamBuilder builder, ParamCandidate candidate) {
    134                 Method method = candidate.getCaller();
    135                 if (method == null) {
    136                         return induceParamType(builder, candidate.getType());
    137                 }
    138 
    139                 if (!method.getReturnType().equals(Void.TYPE)) {
    140                         builder.resultType(induceParamType(Param.build(), method.getGenericReturnType()).finish(ValueParam.class));
    141                 }
    142 
    143                 List<ValueParam> arguments = new ArrayList<>();
    144                 int number = 0;
    145                 for (Type arg : method.getGenericParameterTypes()) {
    146                         arguments.add(induceParamType(Param.build(), arg).idAndName("arg" + (number++)).finish(ValueParam.class));
    147                 }
    148                 builder.argumentsType(arguments);
    149 
    150                 return builder;
    151         }
    15240
    15341        public static final String GENERATE_HELP_PREFIX = "automatically generated from: ";
     
    238126                        ParamBuilder builder = Param.build().id(pc.getId()).name(pc.getName()).flags(pc.getFlags());
    239127
    240                         induceParamType(builder, pc);
     128                        pc.induceParamType(builder);
    241129
    242130                        for (ParamAnnotation pa : pc.getAnnotations()) {
     
    365253        }
    366254
     255
     256
    367257}
Note: See TracChangeset for help on using the changeset viewer.