Ejemplo n.º 1
0
        /// <summary>Returns true if this command can be aggregated with another command.</summary>
        /// <param name="otherCommand">The other command to aggregate.</param>
        /// <returns>True if both commands can be aggregated.</returns>
        public override bool CanAggregateWith(AggregableCommand otherCommand)
        {
            RotateTopOfStackCommand otherRotateCommand = otherCommand as RotateTopOfStackCommand;

            if (otherRotateCommand == null)
            {
                return(false);
            }
            if (pieces.Length != otherRotateCommand.pieces.Length)
            {
                return(false);
            }
            else
            {
                for (int i = 0; i < pieces.Length; ++i)
                {
                    if (pieces[i] != otherRotateCommand.pieces[i])
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Ejemplo n.º 2
0
 /// <summary>Aggregate two commands and store the result in this command.</summary>
 /// <param name="otherCommand">Another command to aggregate.</param>
 public override void AggregateWith(AggregableCommand otherCommand)
 {
     Debug.Assert(CanAggregateWith(otherCommand));
     rotationIncrements += ((RotatePieceCommand)otherCommand).rotationIncrements;
 }
Ejemplo n.º 3
0
        /// <summary>Returns true if this command can be aggregated with another command.</summary>
        /// <param name="otherCommand">The other command to aggregate.</param>
        /// <returns>True if both commands can be aggregated.</returns>
        public override bool CanAggregateWith(AggregableCommand otherCommand)
        {
            RotatePieceCommand otherRotateCommand = otherCommand as RotatePieceCommand;

            return(otherRotateCommand != null && otherRotateCommand.piece == piece);
        }
Ejemplo n.º 4
0
 /// <summary>Aggregate two commands and store the result in this command.</summary>
 /// <param name="otherCommand">Another command to aggregate.</param>
 public abstract void AggregateWith(AggregableCommand otherCommand);
Ejemplo n.º 5
0
 /// <summary>Returns true if this command can be aggregated with another command.</summary>
 /// <param name="otherCommand">The other command to aggregate.</param>
 /// <returns>True if both commands can be aggregated.</returns>
 public abstract bool CanAggregateWith(AggregableCommand otherCommand);