package Ġtr uffle stg . data Ċ Ċ import Ġcom . oracle . tr uffle . api . Compiler Directives . Tr uffle Boundary Ċ import Ġcom . oracle . tr uffle . api . Compiler Directives . ValueType Ċ import Ġcom . oracle . tr uffle . api . interop . Interop Library Ċ import Ġcom . oracle . tr uffle . api . interop . Tr uffle Object Ċ import Ġcom . oracle . tr uffle . api . interop . Unsupported Message Exception Ċ import Ġcom . oracle . tr uffle . api . library . Export Library Ċ import Ġcom . oracle . tr uffle . api . library . Export Message Ċ import Ġjava . math . BigInteger Ċ Ċ private Ġconst Ġval ĠLONG _ MAX _ SAFE _ DOUBLE Ġ= Ġ 9 0 0 7 1 9 9 2 5 4 7 4 0 9 9 1 L Ġ// Ġ 2 Ġ** Ġ 5 3 Ġ- Ġ 1 Ċ private Ġconst Ġval ĠINT _ MAX _ SAFE _ FLOAT Ġ= Ġ 1 6 7 7 7 2 1 5 Ġ// Ġ 2 Ġ** Ġ 2 4 Ġ- Ġ 1 Ċ Ċ private Ġfun Ġin Safe Double Range ( l : ĠLong ): ĠBoolean Ġ= ĊĠ Ġl Ġ>= Ġ- LONG _ MAX _ SAFE _ DOUBLE Ġ&& Ġl Ġ<= ĠLONG _ MAX _ SAFE _ DOUBLE Ċ Ċ private Ġfun Ġin Safe Float Range ( i : ĠInt ): ĠBoolean Ġ= ĊĠ Ġi Ġ>= Ġ- INT _ MAX _ SAFE _ FLOAT Ġ&& Ġi Ġ<= ĠINT _ MAX _ SAFE _ FLOAT Ċ Ċ @ ValueType Ċ @ Export Library ( Interop Library :: class ) Ċ class ĠBigInt ( val Ġvalue : ĠBigInteger ) Ġ: ĠTr uffle Object , ĠComparable < BigInt > Ġ{ ĊĠ Ġconstructor ( value : ĠLong ) Ġ: Ġthis ( BigInteger . valueOf ( value )) ĊĊĠ Ġ@ Export Message ĊĠ Ġ@ Tr uffle Boundary ĊĠ Ġfun Ġis Number () Ġ= Ġfits In Long () ĊĊĠ Ġfun Ġis Natural () Ġ= Ġvalue Ġ>= ĠBigInteger . ZERO ĊĊĠ Ġ@ Tr uffle Boundary ĊĠ Ġoverride Ġfun Ġcompare To ( other : ĠBigInt ) Ġ= Ġvalue . compareTo ( other . value ) ĊĊĠ Ġ@ Tr uffle Boundary ĊĠ Ġoverride Ġfun ĠtoString () Ġ= Ġvalue . toString () ĊĊĠ Ġoverride Ġfun ĠhashCode () Ġ= Ġvalue . hashCode () ĊĊĠ Ġ@ Tr uffle Boundary ĊĠ Ġoverride Ġfun Ġequals ( other : ĠAny ?) Ġ= Ġother Ġis ĠBigInt Ġ&& Ġvalue Ġ== Ġother . value ĊĊĠ Ġ@ Export Message ĊĠ Ġ@ Tr uffle Boundary ĊĠ Ġfun Ġfits In Byte () Ġ= Ġvalue . bit Length () Ġ< Ġ 8 ĊĊĠ Ġ@ Export Message ĊĠ Ġ@ Tr uffle Boundary ĊĠ Ġfun Ġfits In Short () Ġ= Ġvalue . bit Length () Ġ< Ġ 1 6 ĊĊĠ Ġ@ Export Message ĊĠ Ġ@ Tr uffle Boundary ĊĠ Ġfun Ġfits In Int () Ġ= Ġvalue . bit Length () Ġ< Ġ 3 2 ĊĊĠ Ġ@ Export Message ĊĠ Ġ@ Tr uffle Boundary ĊĠ Ġfun Ġfits In Long () Ġ= Ġvalue . bit Length () Ġ< Ġ 6 4 ĊĊĠ Ġ@ Export Message ĊĠ Ġ@ Tr uffle Boundary ĊĠ Ġfun Ġfits In Float () Ġ= Ġfits In Int () Ġ&& Ġin Safe Float Range ( value . toInt ()) ĊĊĠ Ġ@ Export Message ĊĠ Ġ@ Tr uffle Boundary ĊĠ Ġfun Ġfits In Double () Ġ= Ġfits In Long () Ġ&& Ġin Safe Double Range ( value . to Long ()) ĊĊĠ Ġ@ Export Message ĊĠ Ġ@ Tr uffle Boundary ĊĠ Ġ@ Throws ( Unsupported Message Exception :: class ) ĊĠ Ġfun Ġas Byte () Ġ= Ġif Ġ( fits In Byte ()) Ġvalue . to Byte () Ġelse Ġthrow ĠUnsupported Message Exception . create () ĊĊĠ Ġ@ Export Message ĊĠ Ġ@ Tr uffle Boundary ĊĠ Ġ@ Throws ( Unsupported Message Exception :: class ) ĊĠ Ġfun Ġas Short () Ġ= Ġif Ġ( fits In Short ()) Ġvalue . to Short () Ġelse Ġthrow ĠUnsupported Message Exception . create () ĊĊĠ Ġ@ Export Message ĊĠ Ġ@ Tr uffle Boundary ĊĠ Ġ@ Throws ( Unsupported Message Exception :: class ) ĊĠ Ġfun Ġas Int () Ġ= Ġif Ġ( fits In Int ()) Ġvalue . toInt () Ġelse Ġthrow ĠUnsupported Message Exception . create () ĊĊĠ Ġ@ Export Message ĊĠ Ġ@ Tr uffle Boundary ĊĠ Ġ@ Throws ( Unsupported Message Exception :: class ) ĊĠ Ġfun Ġas Long () Ġ= Ġif Ġ( fits In Long ()) Ġvalue . to Long () Ġelse Ġthrow ĠUnsupported Message Exception . create () ĊĊĠ Ġ@ Export Message ĊĠ Ġ@ Tr uffle Boundary ĊĠ Ġ@ Throws ( Unsupported Message Exception :: class ) ĊĠ Ġfun Ġas Float () Ġ= Ġif Ġ( fits In Float ()) Ġvalue . toFloat () Ġelse Ġthrow ĠUnsupported Message Exception . create () ĊĊĠ Ġ@ Export Message ĊĠ Ġ@ Tr uffle Boundary ĊĠ Ġ@ Throws ( Unsupported Message Exception :: class ) ĊĠ Ġfun Ġas Double () Ġ= Ġif Ġ( fits In Double ()) Ġvalue . toDouble () Ġelse Ġthrow ĠUnsupported Message Exception . create () Ċ } Ċ