Beispiel #1
0
        private Robject(List <Rvariable> initializationParameters, ObjectData objectData, Rtype actualType, Rtype viewType)
        {
            if (actualType != null && actualType.IsViewType)
            {
                throw new CannotCreateRobjectException($"Cannot create object with a view type '{actualType}' given as the actual type");
            }

            if (actualType != null && !actualType.CanBe(viewType))
            {
                throw new CannotCreateRobjectException($"{actualType} cannot be {viewType}");
            }

            this.initializationParameters = initializationParameters;

            id = objectData?.Id;

            ActualType = actualType;
            ViewType   = viewType;

            datas = new Dictionary <string, DataValue>();

            if (!IsNull)
            {
                FillObject(objectData);
            }
        }
Beispiel #2
0
        public Rdata(DataModel model, Rtype type)
        {
            this.model = model;

            Type     = type;
            DataType = Application[model.ViewModelId];
        }
Beispiel #3
0
        protected Rparametric(string name, int groupCount, List <ParameterModel> parameterModels, List <string> marks, Rtype type)
        {
            Marks = new List <string>(marks);

            Type = type;

            parameters = new Dictionary <string, Rparameter>();
            Groups     = Enumerable.Range(0, groupCount).Select(_ => new List <Rparameter>()).ToList();

            foreach (var parameterModel in parameterModels)
            {
                parameters[parameterModel.Name] = new Rparameter(parameterModel, this);
            }

            foreach (var paramId in parameters.Keys)
            {
                var param = parameters[paramId];

                foreach (var group in param.Groups)
                {
                    if (group >= Groups.Count)
                    {
                        throw new InvalidOperationException(
                                  $"Parameter '{param.Name}' has a group '{group}' that does not exist on '{type.Name}.{name}'." +
                                  $"There are only {Groups.Count} groups."
                                  );
                    }

                    Groups[group].Add(param);
                }
            }
        }
Beispiel #4
0
        public Rparameter(ParameterModel model, Rparametric owner)
        {
            this.model = model;

            Owner = owner;

            ParameterType = Application[model.ViewModelId];
        }
Beispiel #5
0
        public Roperation(OperationModel model, Rtype type)
            : base(model.Name, model.GroupCount, model.Parameters, model.Marks, type)
        {
            this.model = model;

            ResultType = model.Result.IsVoid
                ? Rtype.Void
                : Application[model.Result.ViewModelId];
        }
 public Rinitializer(InitializerModel model, Rtype type)
     : base(Constants.INITIALIZER_ID, model.GroupCount, model.Parameters, model.Marks, type)
 {
     this.model = model;
 }
Beispiel #7
0
 internal Robject(ObjectData objectData, Rtype actualType, Rtype viewType) : this(null, objectData, actualType, viewType)
 {
 }
Beispiel #8
0
 internal Robject(ReferenceData referenceData, Rtype actualType, Rtype viewType, string value) : this(Od(referenceData, value), actualType, viewType)
 {
 }
Beispiel #9
0
 public Robject(string id, Rtype actualType, Rtype viewType) : this(Rd(id, actualType.Id, viewType.Id, id == null), actualType, viewType)
 {
 }
Beispiel #10
0
 public Robject(string id, Rtype type) : this(id, type, type)
 {
 }
Beispiel #11
0
 public Robject(IEnumerable <Rvariable> initializationParameters, Rtype type) : this(initializationParameters.ToList(), Od(Rd(null, type.Id, type.Id, false)), type, type)
 {
 }
Beispiel #12
0
 public Robject As(Rtype viewType) => Type.Get(Id, viewType);