Exemplo n.º 1
0
        public int CompareTo(object obj)
        {
            var sensationResult = obj as SensationResult;

            if (sensationResult == null)
            {
                return(1);
            }
            if (Equals(sensationResult))
            {
                return(0);
            }
            if (SnapshotBefore == null || Action == null || SnapshotAfter == null)
            {
                return(-1);
            }

            if (!SnapshotBefore.Equals(sensationResult.SnapshotBefore))
            {
                return(((SensationSnapshot)SnapshotBefore).CompareTo(sensationResult.SnapshotBefore as SensationSnapshot));
            }
            if (!Action.Equals(sensationResult.Action))
            {
                return(((PuzzleAction)Action).CompareTo(sensationResult.Action as PuzzleAction));
            }
            if (!SnapshotAfter.Equals(sensationResult.SnapshotAfter))
            {
                return(((SensationSnapshot)SnapshotAfter).CompareTo(sensationResult.SnapshotAfter as SensationSnapshot));
            }
            return(FeedbackValue.CompareTo(sensationResult.FeedbackValue));
        }
Exemplo n.º 2
0
        public override bool Equals(object obj)
        {
            var sensationResult = obj as SensationResult;

            if (sensationResult == null)
            {
                return(false);
            }

            if (Id >= 0 && Id.Equals(sensationResult.Id))
            {
                return(true);
            }

            bool result = SnapshotBefore != null && SnapshotBefore.Equals(sensationResult.SnapshotBefore);

            result = result && Action.Equals(sensationResult.Action);
            result = result && SnapshotAfter.Equals(sensationResult.SnapshotAfter);
            result = result && FeedbackValue.Equals(sensationResult.FeedbackValue);
            return(result);
        }