private bool less(OclUnlimitedNatural u) { if (IsUnlimited) { return(false); } else if (u.IsUnlimited) { return(true); } else { return(ToInt() < u.ToInt()); } }
public static OclInteger ValueOf(int?l) { if (l == null) { return(null); } if (l < 0) { return(new OclProperInteger((int)l)); } else { return(OclUnlimitedNatural.ValueOf(l)); } }
public OclUnlimitedNatural min(OclUnlimitedNatural u) { return(less(u) ? this : u); }
public OclUnlimitedNatural max(OclUnlimitedNatural u) { return(less(u) ? u : this); }
/// <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> /// 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())); }
/// <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())); }
public OclBoolean op_GreaterThanOrEqual(OclUnlimitedNatural u) { return((OclBoolean) !less(u)); }
public OclBoolean op_LessThanOrEqual(OclUnlimitedNatural u) { return((OclBoolean) !u.less(this)); }
public OclBoolean op_GreaterThan(OclUnlimitedNatural u) { return((OclBoolean)u.less(this)); }
public OclBoolean op_LessThan(OclUnlimitedNatural u) { return((OclBoolean)less(u)); }