Exemple #1
0
        protected virtual ulong CalculateLongHashCode()
        {
            ulong result = 0;

            if (!WhereSection.IsNullOrEmpty())
            {
                foreach (var item in WhereSection)
                {
                    result ^= LongHashCodeWeights.BaseModalityWeight ^ item.GetLongHashCode();
                }
            }

            if (Holder != null)
            {
                result ^= LongHashCodeWeights.BaseModalityWeight ^ Holder.GetLongHashCode();
            }

            if (!Annotations.IsNullOrEmpty())
            {
                foreach (var item in Annotations)
                {
                    result ^= LongHashCodeWeights.BaseModalityWeight ^ item.GetLongHashCode();
                }
            }

            return(result);
        }
Exemple #2
0
        public virtual void DiscoverAllAnnotations(IList <RuleInstance> result)
        {
            if (!Annotations.IsNullOrEmpty())
            {
                foreach (var annotation in Annotations)
                {
                    result.Add(annotation);

                    annotation.DiscoverAllAnnotations(result);
                }
            }

            if (!WhereSection.IsNullOrEmpty())
            {
                foreach (var item in WhereSection)
                {
                    item.DiscoverAllAnnotations(result);
                }
            }

            if (Holder != null)
            {
                Holder.DiscoverAllAnnotations(result);
            }
        }
Exemple #3
0
        protected virtual void CalculateLongConditionalHashCode()
        {
            ulong result = 0;

            if (!WhereSection.IsNullOrEmpty())
            {
                foreach (var whereItem in WhereSection)
                {
                    result ^= whereItem.GetLongHashCode();
                }
            }

            _longConditionalHashCode = result;
        }
        /// <summary>
        /// Clones the instance using special context and returns cloned instance.
        /// </summary>
        /// <param name="context">Special context for providing references continuity.</param>
        /// <returns>Cloned instance.</returns>
        public DefaultSettingsOfCodeEntity Clone(Dictionary <object, object> context)
        {
            if (context.ContainsKey(this))
            {
                return((DefaultSettingsOfCodeEntity)context[this]);
            }

            var result = new DefaultSettingsOfCodeEntity();

            context[this] = result;

            result.WhereSection = WhereSection?.Select(p => p.CloneValue(context)).ToList();
            result.Holder       = Holder?.Clone(context);

            return(result);
        }