예제 #1
0
 private bool less(OclUnlimitedNatural u)
 {
     if (IsUnlimited)
     {
         return(false);
     }
     else if (u.IsUnlimited)
     {
         return(true);
     }
     else
     {
         return(ToInt() < u.ToInt());
     }
 }
예제 #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));
     }
 }
예제 #3
0
 public OclUnlimitedNatural min(OclUnlimitedNatural u)
 {
     return(less(u) ? this : u);
 }
예제 #4
0
 public OclUnlimitedNatural max(OclUnlimitedNatural u)
 {
     return(less(u) ? u : this);
 }
예제 #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()));
 }
예제 #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()));
 }
예제 #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()));
 }
예제 #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()));
 }
예제 #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()));
 }
예제 #10
0
 public OclBoolean op_GreaterThanOrEqual(OclUnlimitedNatural u)
 {
     return((OclBoolean) !less(u));
 }
예제 #11
0
 public OclBoolean op_LessThanOrEqual(OclUnlimitedNatural u)
 {
     return((OclBoolean) !u.less(this));
 }
예제 #12
0
 public OclBoolean op_GreaterThan(OclUnlimitedNatural u)
 {
     return((OclBoolean)u.less(this));
 }
예제 #13
0
 public OclBoolean op_LessThan(OclUnlimitedNatural u)
 {
     return((OclBoolean)less(u));
 }