/// <summary>
        /// The Add.
        /// </summary>
        /// <param name="x">The x<see cref="int"/>.</param>
        public override void Add(int x)
        {
            if ((min == x) || (max == x))
            {
                return;
            }

            if (x < min)
            {
                int tmp = x;
                x   = min;
                min = tmp;
            }

            if (size != MINIMUM_UNIVERSE_SIZE_U4)
            {
                int x_highest = highest(x);

                //--- sigmaScopes common for all sigmaNode scopes ---->
                BaseSpectrum sigmaScopesItem;

                int sigmaScopesKey =
                    levels[level].Scopes[nodeId].IndexOffset
                    + levels[level].Scopes[nodeId].NodeSize
                    * registryId
                    + x_highest;
                //<-----sigmaNode key --- global


                if (!sigmaScopes.TryGet(sigmaScopesKey, out sigmaScopesItem))
                {
                    if (parentSqrt == MINIMUM_UNIVERSE_SIZE_U4)
                    {
                        if (sigmaNode == null)
                        {
                            sigmaNode = new TetraValue(-1);
                            sigmaNode.FirstAdd(x_highest);
                        }
                        else
                        {
                            sigmaNode.Add(x_highest);
                        }

                        //--- sigmaScopes common for all sigmaNode scopes ---->
                        sigmaScopesItem = new TetraValue(-1);
                        sigmaScopes.Add(sigmaScopesKey, sigmaScopesItem);
                        sigmaScopesItem.FirstAdd(lowest(x));
                        //<-----sigmaNode key --- global
                    }
                    else //create new branch
                    {
                        if (sigmaNode == null)
                        {
                            sigmaNode = new ScopeValue(parentSqrt, scopes, sigmaScopes, levels, (byte)(level + 1), (byte)(2 * nodeId), registryId);
                            sigmaNode.FirstAdd(x_highest);
                        }
                        else
                        {
                            sigmaNode.Add(x_highest);
                        }

                        //--- sigmaScopes common for all sigmaNode scopes ---->
                        sigmaScopesItem = new ScopeValue(parentSqrt, scopes, sigmaScopes, levels, (byte)(level + 1), (byte)(2 * nodeId + 1),
                                                         registryId * levels[level].Scopes[nodeId].NodeSize + x_highest);
                        sigmaScopes.Add(sigmaScopesKey, sigmaScopesItem);
                        sigmaScopesItem.FirstAdd(lowest(x));
                        //<-----sigmaNode key --- global
                    }
                }
                else
                {
                    //--- sigmaScopes common for all sigmaNode scopes ---->
                    sigmaScopesItem.Add(lowest(x));
                    //<-----sigmaNode key --- global
                }
            }

            if (max < x)
            {
                max = x;
            }
        }
        /// <summary>
        /// The Add.
        /// </summary>
        /// <param name="offsetBase">The offsetBase<see cref="int"/>.</param>
        /// <param name="offsetFactor">The offsetFactor<see cref="int"/>.</param>
        /// <param name="indexOffset">The indexOffset<see cref="int"/>.</param>
        /// <param name="x">The x<see cref="int"/>.</param>
        public override void Add(int offsetBase, int offsetFactor, int indexOffset, int x)
        {
            if ((min == x) || (max == x))
            {
                return;
            }

            if (min == NULL_KEY)
            {
                FirstAdd(offsetBase + offsetFactor * parentSqrt, offsetFactor * parentSqrt, indexOffset * parentSqrt + highest(x), x);
                return;
            }

            if (x < min)
            {
                int tmp = x;
                x   = min;
                min = tmp;
            }

            if (size != MINIMUM_UNIVERSE_SIZE_U4)
            {
                BaseSpectrum scopesItem;
                int          x_highest = highest(x);

                int scopesKey = offsetBase + indexOffset * parentSqrt + x_highest;

                if (!scopes.TryGet(scopesKey, out scopesItem))
                {
                    if (parentSqrt == MINIMUM_UNIVERSE_SIZE_U4)
                    {
                        if (sigmaNode == null)    //sigmaNode of the current level (u>4, e.g., u=16)
                        {
                            sigmaNode = new TetraValue(-1);
                            sigmaNode.FirstAdd(x_highest);
                        }
                        else
                        {
                            sigmaNode.Add(x_highest); //tutaj zrobic else
                        }
                        scopesItem = new TetraValue(-1);
                        scopes.Add(scopesKey, scopesItem);
                        scopesItem.FirstAdd(lowest(x));
                    }
                    else //create new node (add next level)
                    {
                        if (sigmaNode == null)
                        {
                            sigmaNode = new ScopeValue(parentSqrt, scopes, sigmaScopes, levels, (byte)(level + 1), (byte)(2 * nodeId), registryId);
                            sigmaNode.FirstAdd(x_highest);
                        }
                        else
                        {
                            sigmaNode.Add(x_highest); //tutaj zrobic else
                        }

                        scopesItem = new ScopeValue(parentSqrt, scopes, sigmaScopes, levels, (byte)(level + 1), (byte)(2 * nodeId + 1),
                                                    registryId * levels[level].Scopes[nodeId].NodeSize + x_highest);
                        scopes.Add(scopesKey, scopesItem);
                        scopesItem.FirstAdd(offsetBase + offsetFactor * parentSqrt, offsetFactor * parentSqrt, indexOffset * parentSqrt + x_highest, lowest(x));
                    }
                }
                else
                {
                    scopesItem.Add(offsetBase + offsetFactor * parentSqrt, offsetFactor * parentSqrt, indexOffset * parentSqrt + x_highest, lowest(x));
                }
            }

            if (max < x)
            {
                max = x;
            }
        }