Base internal class for all sort keys. Inherits from IComparable, so that Array.Sort can perform comparison.
Inheritance: IComparable
        /// <summary>
        /// Append new sort key to the current run of sort keys.
        /// </summary>
        private void AppendSortKey(XmlSortKey key) {
            // Ensure that sort will be stable by setting index of key
            key.Priority = this.pos;

            if (this.keys[this.pos] == null)
                this.keys[this.pos] = key;
            else
                this.keys[this.pos].AddSortKey(key);
        }
 /// <summary>
 /// Finish creating the current run of sort keys and begin a new run.
 /// </summary>
 public void FinishSortKeys() {
     this.pos++;
     if (this.pos >= this.keys.Length) {
         XmlSortKey[] keysNew = new XmlSortKey[this.pos * 2];
         Array.Copy(this.keys, 0, keysNew, 0, this.keys.Length);
         this.keys = keysNew;
     }
     this.keys[this.pos] = null;
 }
        /// <summary>
        /// When two keys are compared and found to be equal, the tie must be broken.  If there is a secondary key,
        /// then use that to break the tie.  Otherwise, use the input ordering to break the tie.  Since every key
        /// has a unique index, this is guaranteed to always break the tie.
        /// </summary>
        protected int BreakSortingTie(XmlSortKey that) {
            if (this.nextKey != null) {
                // There are multiple keys, so break tie using next key
                Debug.Assert(this.nextKey != null && that.nextKey != null);
                return this.nextKey.CompareTo(that.nextKey);
            }

            Debug.Assert(this.priority != that.priority);
            return (this.priority < that.priority) ? -1 : 1;
        }
 /// <summary>
 /// Finish creating the current run of sort keys and begin a new run.
 /// </summary>
 public void FinishSortKeys()
 {
     _pos++;
     if (_pos >= _keys.Length)
     {
         XmlSortKey[] keysNew = new XmlSortKey[_pos * 2];
         Array.Copy(_keys, 0, keysNew, 0, _keys.Length);
         _keys = keysNew;
     }
     _keys[_pos] = null;
 }
 /// <summary>
 /// Finish creating the current run of sort keys and begin a new run.
 /// </summary>
 public void FinishSortKeys()
 {
     _pos++;
     if (_pos >= _keys.Length)
     {
         XmlSortKey[] keysNew = new XmlSortKey[_pos * 2];
         Array.Copy(_keys, keysNew, _keys.Length);
         _keys = keysNew;
     }
     _keys[_pos] = null;
 }
Exemple #6
0
 /// <summary>
 /// Finish creating the current run of sort keys and begin a new run.
 /// </summary>
 public void FinishSortKeys()
 {
     this.pos++;
     if (this.pos >= this.keys.Length)
     {
         XmlSortKey[] keysNew = new XmlSortKey[this.pos * 2];
         Array.Copy(this.keys, 0, keysNew, 0, this.keys.Length);
         this.keys = keysNew;
     }
     this.keys[this.pos] = null;
 }
        /// <summary>
        /// Sometimes a key is composed of multiple parts.  For example: (LastName, FirstName).  Multi-part
        /// keys are linked together in a list.  This method recursively adds a new key part to the end of the list.
        /// Returns the first (primary) key in the list.
        /// </summary>
        public XmlSortKey AddSortKey(XmlSortKey sortKey) {
            if (this.nextKey != null) {
                // Add to end of list--this is not it
                this.nextKey.AddSortKey(sortKey);
            }
            else {
                // This is the end of the list
                this.nextKey = sortKey;
            }

            return this;
        }
Exemple #8
0
        protected int BreakSortingTie(XmlSortKey that)
        {
            if (_nextKey != null)
            {
                // There are multiple keys, so break tie using next key
                Debug.Assert(_nextKey != null && that._nextKey != null);
                return(_nextKey.CompareTo(that._nextKey));
            }

            Debug.Assert(_priority != that._priority);
            return((_priority < that._priority) ? -1 : 1);
        }
        /// <summary>
        /// Append new sort key to the current run of sort keys.
        /// </summary>
        private void AppendSortKey(XmlSortKey key)
        {
            // Ensure that sort will be stable by setting index of key
            key.Priority = _pos;

            if (_keys[_pos] == null)
            {
                _keys[_pos] = key;
            }
            else
            {
                _keys[_pos] !.AddSortKey(key);
            }
        }
Exemple #10
0
        /// <summary>
        /// Append new sort key to the current run of sort keys.
        /// </summary>
        private void AppendSortKey(XmlSortKey key)
        {
            // Ensure that sort will be stable by setting index of key
            key.Priority = this.pos;

            if (this.keys[this.pos] == null)
            {
                this.keys[this.pos] = key;
            }
            else
            {
                this.keys[this.pos].AddSortKey(key);
            }
        }
Exemple #11
0
        public XmlSortKey AddSortKey(XmlSortKey sortKey)
        {
            if (_nextKey != null)
            {
                // Add to end of list--this is not it
                _nextKey.AddSortKey(sortKey);
            }
            else
            {
                // This is the end of the list
                _nextKey = sortKey;
            }

            return(this);
        }