namespace Chernobyl.Calculator
{
///
/// A version of an ICalculator that can perform
/// calculations on ints.
///
public struct IntCalculator : ICalculator
{
///
/// Adds one int to another.
///
/// The left side of the addition operation.
/// The right side of the addition operation.
/// The result of the addition.
public int Add(int left, int right)
{
return left + right;
}
///
/// Subtracts one int from another.
///
/// The left side of the subtraction operation.
/// The right side of the subtraction operation.
/// The result of the subtraction.
public int Subtract(int left, int right)
{
return left - right;
}
///
/// Divides two ints.
///
/// The dividend.
/// The divisor.
/// The result of the divide.
public int Divide(int dividend, int divisor)
{
return dividend / divisor;
}
///
/// Multiplies two ints together.
///
/// The left side of the multiplication operation.
/// The right side of the multiplication operation.
/// The result of the multiplication.
public int Multiply(int left, int right)
{
return left * right;
}
///
/// Negates a int.
///
/// The int to negate.
/// The result of the negation.
public int Negate(int item)
{
return -item;
}
///
/// Compares two ints.
///
/// The left side of the comparison operation.
/// The right side of the comparison operation.
/// True if the two are the same, false if otherwise.
public bool Compare(int left, int right)
{
return (left == right);
}
}
}