private bool less(OclUnlimitedNatural u) { if (IsUnlimited) { return(false); } else if (u.IsUnlimited) { return(true); } else { return(ToInt() < u.ToInt()); } }
/// <summary> /// Compute modulo of two unlimited naturals. /// </summary> /// <param name="u">The second operand.</param> /// <returns>The remainder.</returns> /// <exception cref="UnlimitedValueException">If either of the operands is unlimited.</exception> /// <exception cref="DivideByZeroException">If the second operator is zero.</exception> public OclUnlimitedNatural mod(OclUnlimitedNatural u) { return(ValueOf(ToInt() % u.ToInt())); }
/// <summary> /// Divide two unlimited naturals. /// </summary> /// <param name="u">The second operand.</param> /// <returns>The quotient.</returns> /// <exception cref="UnlimitedValueException">If either of the operands is unlimited.</exception> /// <exception cref="DivideByZeroException">If the second operator is zero.</exception> public OclUnlimitedNatural div(OclUnlimitedNatural u) { return(ValueOf(ToInt() / u.ToInt())); }
/// <summary> /// Multiply two unlimited naturals. /// </summary> /// <param name="u">The second operand.</param> /// <returns>The product.</returns> /// <exception cref="UnlimitedValueException">If either of the operands is unlimited.</exception> public OclUnlimitedNatural op_Multiply(OclUnlimitedNatural u) { return(ValueOf(ToInt() * u.ToInt())); }
/// <summary> /// Add two unlimited naturals. /// </summary> /// <param name="u">The second operand.</param> /// <returns>The sum.</returns> /// <exception cref="UnlimitedValueException">If either of the operands is unlimited.</exception> public OclUnlimitedNatural op_Addition(OclUnlimitedNatural u) { return(ValueOf(ToInt() + u.ToInt())); }