예제 #1
0
 private bool less(OclUnlimitedNatural u)
 {
     if (IsUnlimited)
     {
         return(false);
     }
     else if (u.IsUnlimited)
     {
         return(true);
     }
     else
     {
         return(ToInt() < u.ToInt());
     }
 }
예제 #2
0
 /// <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()));
 }
예제 #3
0
 /// <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()));
 }
예제 #4
0
 /// <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()));
 }
예제 #5
0
 /// <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()));
 }