Esempio n. 1
0
        }       //	inSlot

        /*************************************************************************/

        /**
         * Compares its two arguments for order.  Returns a negative integer,
         * zero, or a positive integer as the first argument is less than, equal
         * to, or greater than the second.
         *
         * @param obj the first object to be compared.
         * @param o2 the second object to be compared.
         * @return a negative integer, zero, or a positive integer as the
         *         first argument is less than, equal to, or greater than the
         *	       second.
         * @throws ClassCastException if the arguments' types prevent them from
         *         being compared by this Comparator.
         */
        public int CompareTo(Object obj)
        {
            MAssignmentSlot slot = (MAssignmentSlot)obj;

            //	Start Date
            int result = GetStartTime().Value.CompareTo(slot.GetStartTime());

            if (result != 0)
            {
                return(result);
            }
            //	Status
            result = slot.GetStatus() - GetStatus();
            if (result != 0)
            {
                return(result);
            }
            //	End Date
            result = GetEndTime().Value.CompareTo(slot.GetEndTime());
            if (result != 0)
            {
                return(result);
            }
            //	Name
            result = GetName().CompareTo(slot.GetName());
            if (result != 0)
            {
                return(result);
            }
            //	Description
            return(GetDescription().CompareTo(slot.GetDescription()));
        }       //	compare
Esempio n. 2
0
        }       //	compare

        /**
         * Indicates whether some other object is "equal to" this
         * Comparator.
         * @param   obj   the reference object with which to compare.
         * @return  <code>true</code> only if the specified object is also
         *		a comparator and it imposes the same ordering as this
         *		comparator.
         * @see     java.lang.Object#equals(java.lang.Object)
         * @see java.lang.Object#hashCode()
         */
        public override bool Equals(Object obj)
        {
            if (obj is MAssignmentSlot)
            {
                MAssignmentSlot cmp = (MAssignmentSlot)obj;
                if (_startTime.Equals(cmp.GetStartTime()) &&
                    _endTime.Equals(cmp.GetEndTime()) &&
                    _status == cmp.GetStatus() &&
                    _name.Equals(cmp.GetName()) &&
                    _description.Equals(cmp.GetDescription()))
                {
                    return(true);
                }
            }
            return(false);
        }       //	equals