예제 #1
0
        /// <inheritdoc/>
        public void Append(InlineTrigger inlineTrigger)
        {
#if DEBUG
            //Log($"inlineTrigger = {inlineTrigger}");
#endif

            AnnotatedItemHelper.CheckAndFillUpHolder(inlineTrigger, _realStorageContext.MainStorageContext.CommonNamesStorage);

            inlineTrigger.CheckDirty();

            var kind = inlineTrigger.Kind;

            switch (kind)
            {
            case KindOfInlineTrigger.SystemEvent:
                AppendSystemEvent(inlineTrigger);
                break;

            case KindOfInlineTrigger.LogicConditional:
                AppendLogicConditional(inlineTrigger);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(kind), kind, null);
            }
        }
예제 #2
0
        /// <inheritdoc/>
        public void AppendDefaultOperator(FuzzyLogicOperator fuzzyLogicOperator)
        {
            AnnotatedItemHelper.CheckAndFillUpHolder(fuzzyLogicOperator, _commonNamesStorage);

            lock (_lockObj)
            {
                _defaultOperatorsDict[fuzzyLogicOperator.Name] = fuzzyLogicOperator;
            }
        }
예제 #3
0
        /// <inheritdoc/>
        public void Append(LinguisticVariable linguisticVariable)
        {
            AnnotatedItemHelper.CheckAndFillUpHolder(linguisticVariable, _commonNamesStorage);

            lock (_lockObj)
            {
#if DEBUG
                //Log($"linguisticVariable = {linguisticVariable}");

                //if(linguisticVariable.Name.NameValue == "age")
                //{
                //var constraintItem = new LinguisticVariableConstraintItem();
                //constraintItem.Kind = KindOfLinguisticVariableСonstraintItem.Inheritance;

                //Log($"constraintItem.ToDbgString() = {constraintItem.ToDbgString()}");

                //linguisticVariable.Constraint.Items.Add(constraintItem);

                //constraintItem = new LinguisticVariableConstraintItem();
                //constraintItem.Kind = KindOfLinguisticVariableСonstraintItem.Relation;
                //constraintItem.RelationName = NameHelper.CreateName("age");

                //Log($"constraintItem.ToDbgString() = {constraintItem.ToDbgString()}");

                //linguisticVariable.Constraint.Items.Add(constraintItem);

                //Log($"linguisticVariable (2) = {linguisticVariable}");
                //}
#endif

                linguisticVariable.CheckDirty();

#if DEBUG
                //if (linguisticVariable.Name.NameValue == "age")
                //{
                //    Log($"linguisticVariable (3) = {linguisticVariable}");

                //    //throw new NotImplementedException();
                //}
#endif

                var holder = linguisticVariable.Holder;

                foreach (var fuzzyValue in linguisticVariable.Values)
                {
                    AnnotatedItemHelper.CheckAndFillUpHolder(fuzzyValue, _commonNamesStorage);

                    NAppendValue(fuzzyValue, holder);
                }
            }
        }
예제 #4
0
        /// <inheritdoc/>
        public void Append(NamedFunction namedFunction)
        {
            lock (_lockObj)
            {
#if DEBUG
                //Log($"namedFunction = {namedFunction}");
#endif

                AnnotatedItemHelper.CheckAndFillUpHolder(namedFunction, _realStorageContext.MainStorageContext.CommonNamesStorage);

                namedFunction.CheckDirty();

                var namedFunctionName = namedFunction.Name;

                var paramsCountList = GetParamsCountList(namedFunction);

#if DEBUG
                //Log($"paramsCountList = {paramsCountList.WritePODListToString()}");
#endif

                var targetDict = GetDictByParamsCount(namedFunction);

                foreach (var count in paramsCountList)
                {
                    List <NamedFunction> targetList = null;

                    if (targetDict.ContainsKey(count))
                    {
                        targetList = targetDict[count];
                    }
                    else
                    {
                        targetList        = new List <NamedFunction>();
                        targetDict[count] = targetList;
                    }

                    if (!targetList.Contains(namedFunction))
                    {
                        targetList.Add(namedFunction);
                    }
                }
            }
        }
예제 #5
0
        /// <inheritdoc/>
        public void Append(Channel channel)
        {
            AnnotatedItemHelper.CheckAndFillUpHolder(channel, _realStorageContext.MainStorageContext.CommonNamesStorage);

            lock (_lockObj)
            {
#if DEBUG
                //Log($"channel = {channel}");
#endif

                channel.CheckDirty();

                var name = channel.Name;

                var holder = channel.Holder;

                if (_nonIndexedInfo.ContainsKey(name))
                {
                    var dict = _nonIndexedInfo[name];

                    if (dict.ContainsKey(holder))
                    {
                        var targetList = dict[holder];

#if DEBUG
                        Log($"dict[holder].Count = {dict[holder].Count}");
                        Log($"targetList = {targetList.WriteListToString()}");
#endif
                        var targetLongConditionalHashCode = channel.GetLongConditionalHashCode();

#if DEBUG
                        Log($"targetLongConditionalHashCode = {targetLongConditionalHashCode}");
#endif

                        var itemsWithTheSameLongConditionalHashCodeList = targetList.Where(p => p.GetLongConditionalHashCode() == targetLongConditionalHashCode).ToList();

#if DEBUG
                        Log($"itemsWithTheSameLongConditionalHashCodeList = {itemsWithTheSameLongConditionalHashCodeList.WriteListToString()}");
#endif

                        foreach (var itemWithTheSameLongConditionalHashCode in itemsWithTheSameLongConditionalHashCodeList)
                        {
                            targetList.Remove(itemWithTheSameLongConditionalHashCode);
                        }

                        targetList.Add(channel);
                    }
                    else
                    {
                        dict[holder] = new List <Channel>()
                        {
                            channel
                        };
                    }
                }
                else
                {
                    _nonIndexedInfo[name] = new Dictionary <StrongIdentifierValue, List <Channel> >()
                    {
                        { holder, new List <Channel>()
                          {
                              channel
                          } }
                    };
                }
            }
        }
예제 #6
0
        /// <inheritdoc/>
        public void Append(Operator op)
        {
#if DEBUG
            //Log($"op = {op}");
#endif

            AnnotatedItemHelper.CheckAndFillUpHolder(op, _realStorageContext.MainStorageContext.CommonNamesStorage);

            lock (_lockObj)
            {
                var kindOfOperator = op.KindOfOperator;

                if (_nonIndexedInfo.ContainsKey(kindOfOperator))
                {
                    var dict = _nonIndexedInfo[kindOfOperator];

                    if (dict.ContainsKey(op.Holder))
                    {
                        var targetList = dict[op.Holder];

#if DEBUG
                        Log($"dict[superName].Count = {dict[op.Holder].Count}");
                        Log($"targetList = {targetList.WriteListToString()}");
#endif
                        var targetLongConditionalHashCode = op.GetLongConditionalHashCode();

#if DEBUG
                        Log($"targetLongConditionalHashCode = {targetLongConditionalHashCode}");
#endif

                        var itemsWithTheSameLongConditionalHashCodeList = targetList.Where(p => p.GetLongConditionalHashCode() == targetLongConditionalHashCode).ToList();

#if DEBUG
                        Log($"itemsWithTheSameLongConditionalHashCodeList = {itemsWithTheSameLongConditionalHashCodeList.WriteListToString()}");
#endif

                        foreach (var itemWithTheSameLongConditionalHashCode in itemsWithTheSameLongConditionalHashCodeList)
                        {
                            targetList.Remove(itemWithTheSameLongConditionalHashCode);
                        }

                        targetList.Add(op);
                    }
                    else
                    {
                        dict[op.Holder] = new List <Operator>()
                        {
                            op
                        };
                    }
                }
                else
                {
                    _nonIndexedInfo[kindOfOperator] = new Dictionary <StrongIdentifierValue, List <Operator> >()
                    {
                        { op.Holder, new List <Operator>()
                          {
                              op
                          } }
                    };
                }
            }
        }