Example #1
0
 private bool less(OclUnlimitedNatural u)
 {
     if (IsUnlimited)
     {
         return(false);
     }
     else if (u.IsUnlimited)
     {
         return(true);
     }
     else
     {
         return(ToInt() < u.ToInt());
     }
 }
Example #2
0
 public static OclInteger ValueOf(int?l)
 {
     if (l == null)
     {
         return(null);
     }
     if (l < 0)
     {
         return(new OclProperInteger((int)l));
     }
     else
     {
         return(OclUnlimitedNatural.ValueOf(l));
     }
 }
Example #3
0
 public OclUnlimitedNatural min(OclUnlimitedNatural u)
 {
     return(less(u) ? this : u);
 }
Example #4
0
 public OclUnlimitedNatural max(OclUnlimitedNatural u)
 {
     return(less(u) ? u : this);
 }
Example #5
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()));
 }
Example #6
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()));
 }
Example #7
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 OclReal op_Divide(OclUnlimitedNatural u)
 {
     return(OclReal.valueOf(toDouble() / u.toDouble()));
 }
Example #8
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()));
 }
Example #9
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()));
 }
Example #10
0
 public OclBoolean op_GreaterThanOrEqual(OclUnlimitedNatural u)
 {
     return((OclBoolean) !less(u));
 }
Example #11
0
 public OclBoolean op_LessThanOrEqual(OclUnlimitedNatural u)
 {
     return((OclBoolean) !u.less(this));
 }
Example #12
0
 public OclBoolean op_GreaterThan(OclUnlimitedNatural u)
 {
     return((OclBoolean)u.less(this));
 }
Example #13
0
 public OclBoolean op_LessThan(OclUnlimitedNatural u)
 {
     return((OclBoolean)less(u));
 }