00001 00018 package com.microsoft.z3; 00019 00020 import java.math.BigInteger; 00021 00025 public class RatNum extends RealExpr 00026 { 00030 public IntNum getNumerator() 00031 { 00032 return new IntNum(getContext(), Native.getNumerator(getContext().nCtx(), 00033 getNativeObject())); 00034 } 00035 00039 public IntNum getDenominator() 00040 { 00041 return new IntNum(getContext(), Native.getDenominator(getContext().nCtx(), 00042 getNativeObject())); 00043 } 00044 00048 public BigInteger getBigIntNumerator() 00049 { 00050 IntNum n = getNumerator(); 00051 return new BigInteger(n.toString()); 00052 } 00053 00057 public BigInteger getBigIntDenominator() 00058 { 00059 IntNum n = getDenominator(); 00060 return new BigInteger(n.toString()); 00061 } 00062 00068 public String toDecimalString(int precision) 00069 { 00070 return Native.getNumeralDecimalString(getContext().nCtx(), getNativeObject(), 00071 precision); 00072 } 00073 00077 public String toString() 00078 { 00079 try 00080 { 00081 return Native.getNumeralString(getContext().nCtx(), getNativeObject()); 00082 } catch (Z3Exception e) 00083 { 00084 return "Z3Exception: " + e.getMessage(); 00085 } 00086 } 00087 00088 RatNum(Context ctx, long obj) 00089 { 00090 super(ctx, obj); 00091 } 00092 }
1.7.6.1