示例#1
0
        private static MetaOperatorPart Create(string guid, FunctionType type)
        {
            Func <Guid, OperatorPart.Function, bool, string, OperatorPart> createFunc = (id, defaultFunction, isMultiInput, name) =>
            {
                var opPart = Utilities.CreateValueOpPart(id, defaultFunction as Utilities.ValueFunction,
                                                         isMultiInput);
                opPart.Type = type;
                opPart.Name = name;
                return(opPart);
            };

            return(new MetaOperatorPart(Guid.Parse(guid))
            {
                CreateFunc = createFunc, Type = type
            });
        }
示例#2
0
        public MetaOperatorPart GetMetaOperatorPart(Guid id)
        {
            MetaOperatorPart metaOpPart;

            if (!_metaOpParts.TryGetValue(id, out metaOpPart))
            {
                Logger.Error("Part of operator definition not found ({0}). Trying to patch this part with a new generic definition...", id.ToString());

                var type = FunctionType.Generic;
                Func <Guid, OperatorPart.Function, bool, string, OperatorPart> createFunc = (lid, defaultFunction, isMultiInput, name) => {
                    var lopPart = Utilities.CreateValueOpPart(lid, null, isMultiInput);
                    lopPart.Type = type;
                    lopPart.Name = name;
                    return(lopPart);
                };
                metaOpPart = new MetaOperatorPart(id)
                {
                    CreateFunc = createFunc, Type = type
                };
                AddMetaOperatorPart(metaOpPart);
            }
            return(metaOpPart);
        }