Пример #1
0
        public int CompareTo(KCombo other)
        {
            int comp = key.CompareTo(other.key);

            if (comp != 0)
            {
                return(comp);
            }
            if (modifiers != null && other.modifiers != null)
            {
                for (int i = 0; i < modifiers.Length && i < other.modifiers.Length; ++i)
                {
                    if (i >= other.modifiers.Length)
                    {
                        return(-1);
                    }
                    if (i >= modifiers.Length)
                    {
                        return(1);
                    }
                    comp = modifiers[i].CompareTo(other.modifiers[i]);                    //modifiers[i].key.CompareTo(other.modifiers[i].key);
                    if (comp != 0)
                    {
                        return(comp);
                    }
                }
            }
            else
            {
                int selfScore  = modifiers != null?modifiers.Length : 0;
                int otherScore = other.modifiers != null? other.modifiers.Length : 0;
                return(-selfScore.CompareTo(otherScore));                // the more complex ComplexKeyPress should be first
            }
            return(0);
        }
Пример #2
0
 public int CompareTo(Modifier other)
 {
     return(key.CompareTo(other.key));
 }