public void cleanDataStructures()
 {
     unityASPVariationNames    = new Dictionary <string, string>();
     floatingPointProperties   = new Dictionary <string, double>();
     unsignedIntegerProperties = new Dictionary <string, ulong>();
     signedIntegerProperties   = new Dictionary <string, long>();
     boolProperties            = new Dictionary <string, bool>();
     stringProperties          = new Dictionary <string, string>();
     charProperties            = new Dictionary <string, char>();
     //enumProperties = new Dictionary<string, Enum>();
     dictionaryPerType = new Dictionary <Type, IDictionary>();
     foreach (Type t in ReflectionExecutor.SignedIntegerTypes())
     {
         dictionaryPerType.Add(t, signedIntegerProperties);
     }
     foreach (Type t in ReflectionExecutor.UnsignedIntegerTypes())
     {
         dictionaryPerType.Add(t, unsignedIntegerProperties);
     }
     foreach (Type t in ReflectionExecutor.FloatingPointTypes())
     {
         dictionaryPerType.Add(t, floatingPointProperties);
     }
     dictionaryPerType.Add(typeof(bool), boolProperties);
     dictionaryPerType.Add(typeof(string), stringProperties);
     // dictionaryPerType.Add(typeof(Enum), enumProperties);
     dictionaryPerType.Add(typeof(char), charProperties);
 }
Exemplo n.º 2
0
 static SensorsUtility()
 {
     actualMonoBehaviourSensor = new Dictionary <Type, Type>();
     foreach (Type t in ReflectionExecutor.GetAvailableBasicTypes())
     {
         if (ReflectionExecutor.SignedIntegerTypes().Contains(t))
         {
             actualMonoBehaviourSensor.Add(t, typeof(MonoBehaviourSignedIntegerSensor));
         }
         else if (ReflectionExecutor.UnsignedIntegerTypes().Contains(t))
         {
             actualMonoBehaviourSensor.Add(t, typeof(MonoBehaviourUnsignedIntegerSensor));
         }
         else if (ReflectionExecutor.FloatingPointTypes().Contains(t))
         {
             actualMonoBehaviourSensor.Add(t, typeof(MonoBehaviourFloatingPointSensor));
         }
         else if (t == typeof(bool))
         {
             actualMonoBehaviourSensor.Add(t, typeof(MonoBehaviourBoolSensor));
         }
         else if (t == typeof(char))
         {
             actualMonoBehaviourSensor.Add(t, typeof(MonoBehaviourCharSensor));
         }
         else if (t == typeof(Enum))
         {
             actualMonoBehaviourSensor.Add(t, typeof(MonoBehaviourEnumSensor));
         }
         else if (t == typeof(string))
         {
             actualMonoBehaviourSensor.Add(t, typeof(MonoBehaviourStringSensor));
         }
     }
 }
Exemplo n.º 3
0
        internal static void avg()
        {
            Type valuesType = values.GetType().GetGenericArguments()[0];

            if (ReflectionExecutor.SignedIntegerTypes().Contains(valuesType))
            {
                longAvg();
            }
            else if (ReflectionExecutor.FloatingPointTypes().Contains(valuesType))
            {
                doubleAvg();
            }
            else if (ReflectionExecutor.UnsignedIntegerTypes().Contains(valuesType))
            {
                unsignedAvg();
            }
        }
Exemplo n.º 4
0
 static Operation()
 {
     operationsPerType  = new Dictionary <Type, Type>();
     actionPerOperation = new Dictionary <Type, Dictionary <int, Action> >();
     operationsPerType.Add(typeof(bool), typeof(boolOperations));
     operationsPerType.Add(typeof(string), typeof(stringOperations));
     foreach (Type t in ReflectionExecutor.SignedIntegerTypes())
     {
         operationsPerType.Add(t, typeof(numericOperations));
     }
     foreach (Type t in ReflectionExecutor.UnsignedIntegerTypes())
     {
         operationsPerType.Add(t, typeof(numericOperations));
     }
     foreach (Type t in ReflectionExecutor.FloatingPointTypes())
     {
         operationsPerType.Add(t, typeof(numericOperations));
     }
     operationsPerType.Add(typeof(Enum), typeof(stringOperations));
     operationsPerType.Add(typeof(char), typeof(stringOperations));
     actionPerOperation.Add(typeof(stringOperations), new Dictionary <int, Action>());
     actionPerOperation.Add(typeof(boolOperations), new Dictionary <int, Action>());
     actionPerOperation.Add(typeof(numericOperations), new Dictionary <int, Action>());
     actionPerOperation.Add(typeof(matrixOperations), new Dictionary <int, Action>());
     actionPerOperation[typeof(numericOperations)].Add(0, newest);
     actionPerOperation[typeof(numericOperations)].Add(1, oldest);
     actionPerOperation[typeof(numericOperations)].Add(2, specificValue);
     actionPerOperation[typeof(numericOperations)].Add(3, max);
     actionPerOperation[typeof(numericOperations)].Add(4, min);
     actionPerOperation[typeof(numericOperations)].Add(5, avg);
     actionPerOperation[typeof(matrixOperations)].Add(0, allMatrix);
     actionPerOperation[typeof(boolOperations)].Add(0, newest);
     actionPerOperation[typeof(boolOperations)].Add(1, oldest);
     actionPerOperation[typeof(boolOperations)].Add(2, specificValue);
     actionPerOperation[typeof(boolOperations)].Add(3, conjunction);
     actionPerOperation[typeof(boolOperations)].Add(4, disjunction);
     actionPerOperation[typeof(stringOperations)].Add(0, newest);
     actionPerOperation[typeof(stringOperations)].Add(1, oldest);
     actionPerOperation[typeof(stringOperations)].Add(2, specificValue);
 }
 public void populate()
 {
     mappers.Add(typeof(SimpleSensor), ASPSimpleSensorMapper.getInstance());
     mappers.Add(typeof(AdvancedSensor), ASPAdvancedSensorMapper.getInstance());
     mappers.Add(typeof(SimpleActuator), ASPActuatorMapper.getInstance());
     mappers.Add(typeof(bool), ASPBoolMapper.getInstance());
     foreach (Type t in ReflectionExecutor.SignedIntegerTypes())
     {
         mappers.Add(t, ASPSignedIntegerMapper.getInstance());
     }
     foreach (Type t in ReflectionExecutor.UnsignedIntegerTypes())
     {
         mappers.Add(t, ASPUnsignedIntegerMapper.getInstance());
     }
     foreach (Type t in ReflectionExecutor.FloatingPointTypes())
     {
         mappers.Add(t, ASPFloatingPointMapper.getInstance());
     }
     mappers.Add(typeof(string), ASPStringMapper.getInstance());
     mappers.Add(typeof(Enum), ASPEnumMapper.getInstance());
     mappers.Add(typeof(char), ASPCharMapper.getInstance());
 }