Beispiel #1
0
        public void PushToVariable(VariableInstance variable, TyonHydrater hydrater)
        {
            Type log_type           = GetLogSystemType(hydrater);
            Variable_IndexedLog log = Variable_IndexedLog.New(log_type);

            if (variable.GetContents() != null)
            {
                int index = 0;
                foreach (object old_element in variable.GetContents().Convert <IEnumerable>())
                {
                    log.CreateStrongInstance(index++).SetContents(old_element);
                }
            }

            GetTyonValueList().IfNotNull(l => l.PushToLogVariable(log, hydrater));

            hydrater.DeferProcess(delegate() {
                List <object> values = log.GetValues()
                                       .Truncate(GetNumberTyonValues())
                                       .ToList();

                Type final_type = IsExplicitlyTyped().ConvertBool(
                    () => log_type,
                    () => values.Convert(v => v.GetTypeEX()).GetCommonAncestor()
                    );

                variable.SetContents(values.ToArrayOfType(final_type));
            });
        }
Beispiel #2
0
        public object InstanceSystemObject(TyonHydrater hydrater)
        {
            object system_object = null;

            if (GetTyonValueList() != null)
            {
                Variable_IndexedLog log = Variable_IndexedLog.New(typeof(object));

                GetTyonValueList().PushToLogVariable(log, hydrater);

                system_object = GetTyonType().InstanceSystemObject(hydrater, log.GetValues().ToArray());
            }
            else
            {
                system_object = GetTyonType().InstanceSystemObject(hydrater);
            }

            return(system_object.ChainIfNotNull(o => PushToSystemObject(o, hydrater)));
        }