Ejemplo n.º 1
0
        /// <summary>
        /// Initializes the cube. If preallocating, note that the AppendIndex is -1 and the setter will blow
        /// unless one uses Append() or MoveAppendIndex() to AllocatedSlots for example.
        /// </summary>
        /// <param name="slots">To preallocate. If not 0, the min value is SIDE.</param>
        /// <param name="countNotNulls">Can be set only here.</param>
        /// <param name="expansion">A callback that must return the desired AllocatedSlots count.</param>
        public Tesseract(int slots, bool countNotNulls, TesseractExpansion expansion = null)
        {
            if (slots > 0 && slots < SIDE)
            {
                slots = SIDE;
            }

            CountNotNulls  = countNotNulls;
            this.Expansion = expansion;
            blocks         = new T[SIDE / 2][][][];
            i[DRIVE]       = 1;
            i[SLOTS]       = alloc(slots, 0);
            i[INDEX]       = -1;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Inits a hypercube with a SIDE number of slots.
 /// </summary>
 /// <param name="expansion">If not set DEF_EXP is used.</param>
 public Tesseract(TesseractExpansion expansion = null) : this(SIDE, true, expansion)
 {
 }