示例#1
0
        public long CalculateDigit(long number)
        {
            long baseNumberPlus = LongIndexNode.CalculateBaseNumber((short)(this.Base + 1));
            long baseNumber     = LongIndexNode.CalculateBaseNumber(this.Base);

            return((number - ((number / baseNumberPlus) * baseNumberPlus)) / baseNumber);
        }
示例#2
0
        public void Add(long number)
        {
            switch (this.CalculateDigit(number))
            {
            case 0:
                if (this.Has0 == null)
                {
                    this.Has0 = LongIndexNode.CreateForBase((short)(this.Base - 1));
                }
                this.Has0.Add(number);
                break;

            case 1:
                if (this.Has1 == null)
                {
                    this.Has1 = LongIndexNode.CreateForBase((short)(this.Base - 1));
                }
                this.Has1.Add(number);
                break;

            case 2:
                if (this.Has2 == null)
                {
                    this.Has2 = LongIndexNode.CreateForBase((short)(this.Base - 1));
                }
                this.Has2.Add(number);
                break;

            case 3:
                if (this.Has3 == null)
                {
                    this.Has3 = LongIndexNode.CreateForBase((short)(this.Base - 1));
                }
                this.Has3.Add(number);
                break;

            case 4:
                if (this.Has4 == null)
                {
                    this.Has4 = LongIndexNode.CreateForBase((short)(this.Base - 1));
                }
                this.Has4.Add(number);
                break;

            case 5:
                if (this.Has5 == null)
                {
                    this.Has5 = LongIndexNode.CreateForBase((short)(this.Base - 1));
                }
                this.Has5.Add(number);
                break;

            case 6:
                if (this.Has6 == null)
                {
                    this.Has6 = LongIndexNode.CreateForBase((short)(this.Base - 1));
                }
                this.Has6.Add(number);
                break;

            case 7:
                if (this.Has7 == null)
                {
                    this.Has7 = LongIndexNode.CreateForBase((short)(this.Base - 1));
                }
                this.Has7.Add(number);
                break;

            case 8:
                if (this.Has8 == null)
                {
                    this.Has8 = LongIndexNode.CreateForBase((short)(this.Base - 1));
                }
                this.Has8.Add(number);
                break;

            case 9:
                if (this.Has9 == null)
                {
                    this.Has9 = LongIndexNode.CreateForBase((short)(this.Base - 1));
                }
                this.Has9.Add(number);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }