[Native][25/11/2013][Add]Adding BigInteger class
[platform/framework/native/appfw.git] / inc / FBaseBigInteger.h
1 //
2 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 /**
18  * @file        FBaseBigInteger.h
19  * @brief       This is the header file for the %BigInteger class.
20  *
21  * @since 3.0
22  * @final       This class is not intended for extension.
23  *
24  * This header file contains the declarations of the %BigInteger class.
25  */
26
27 #ifndef _FBASE_BIG_INTEGER_H_
28 #define _FBASE_BIG_INTEGER_H_
29
30 #include <FBaseObject.h>
31
32
33 namespace Tizen { namespace Base { namespace Collection
34 {
35         class ArrayList;
36 }}}
37
38
39 namespace Tizen { namespace Base
40 {
41 class ImmutableString;
42 class _BigIntegerImpl;
43 class BigInteger;
44
45 class _OSP_EXPORT_ BigInteger
46         : public Object
47 {
48 public:
49         enum PrimeNumberResult
50         {
51                 DEFINITELY_COMPOSITE = 0,
52                 PROBABLY_PRIME = 1,
53                 DEFINITELY_PRIME = 2
54         };
55
56         struct QuotientAndRemainder
57         {
58                 BigInteger* quotient;
59                 BigInteger* remainder;
60         };
61
62 public:
63         /**
64          * Initializes %BigInteger instance with a random value in the range 0 to 2^numBits - 1.
65          *
66          * @since 3.0
67          *
68          * @param[in]   numBits Number of bits
69          *
70          */
71         explicit BigInteger(int numBits);
72
73         /**
74          * Initializes %BigInteger instance with @signed @long @long value.
75          *
76          * @since 3.0
77          *
78          * @param[in]   value   64-bit @signed @long @long value
79          *
80          */
81         explicit BigInteger(int64_t value);
82
83         /**
84          * Initializes %BigInteger instance with null-terminated C string representing a numeric value.
85          *
86          * @since 3.0
87          *
88          * @param[in]   value   Null-terminated C string representing a numeric value.
89          *
90          * @remarks     -This method accepts only string representing integer value. Decimal separators are not allowed in the input string.
91          *              -This method accepts binary, decimal, hexadecimal, and octal numbers given by the following grammar.
92          *
93          * @code
94          *
95          *      Sign[opt] DecimalNumeral
96          *      Sign[opt] 0b BinaryDigits
97          *      Sign[opt] 0B BinaryDigits
98          *      Sign[opt] 0 OctalDigits
99          *      Sign[opt] 0x HexDigits
100          *      Sign[opt] 0X HexDigits
101          *
102          * @endcode
103          *              -The object is not fully constructed if the input string is not parseable. It sets the exception.
104          *              -GetLastResult() should be called to retrieve the last set exception
105          *              -The behavior of this constructor is not  dependent on the system default locale setting.
106          *
107          * @exception   E_SUCCESS       The method is successful.
108          * @exception   E_NUM_FORMAT    The specified string does not represent valid binary, octal, decimal or hexadecimal number, or
109          *                              The specified string contains decimal separator which represent a floating point number.
110          */
111         explicit BigInteger(const char* pStr);
112
113         /**
114          * Initializes %BigInteger instance with null-terminated C string with given radix
115          *
116          * @since 3.0
117          *
118          * @param[in]   value   Null-terminated C string representing a numeric value.
119          * @param[in]   radix   The radix of the string representing a numeric value @n
120          *                      Radix value range is from 2 to 36.
121          *
122          * @remarks     -This method accepts only string representing integer value. Decimal separators are not allowed in the input string.
123          *
124          * Following examples explains the string representation for some of the radix
125          *
126          * @code
127          *
128          *      BigInteger bigInt1("101010100", 2); // Radix 2 representation of decimal number 340
129          *
130          *      BigInteger bigInt2("20112", 3); // Radix 3 representation of decimal number 176
131          *
132          *      BigInteger bigInt3("1230321", 4); // Radix 4 representation of decimal number 6969
133          *
134          *      BigInteger bigInt4("4231034", 5); // Radix 5 representation of decimal number 70769
135          *
136          * @endcode
137          *
138          *              -The object is not fully constructed if the input string is not parseable. It sets the exception.
139          *              -GetLastResult() should be called to retrieve the last set exception
140          *              -The behavior of this constructor is not  dependent on the system default locale setting.
141          *
142          * @exception   E_SUCCESS       The method is successful.
143          * @exception   E_NUM_FORMAT    The specified string does not represent valid binary, octal, decimal or hexadecimal number, or
144          *                              The specified string contains decimal separator which represent a floating point number.
145          * @exception   E_OUT_OF_RANGE  The specified radix is not in between 2 to 36.
146          */
147         BigInteger(const char* pStr, int radix);
148
149         /**
150          * Initializes %BigInteger instance with String representing a numeric value.
151          *
152          * @since 3.0
153          *
154          * @param[in]   value   String representing a numeric value.
155          *
156          * @remarks     -This method accepts only string representing integer value. Decimal separators are not allowed in the input string.
157          *              -This method accepts decimal, hexadecimal, and octal numbers given by the following grammar.
158          *              -The behavior of this constructor is not  dependent on the system default locale setting.
159          *
160          * @code
161          *
162          *      Sign[opt] DecimalNumeral
163          *      Sign[opt] 0b BinaryDigits
164          *      Sign[opt] 0B BinaryDigits
165          *      Sign[opt] 0 OctalDigits
166          *      Sign[opt] 0x HexDigits
167          *      Sign[opt] 0X HexDigits
168          *
169          * @endcode
170          *
171          *              -The object is not fully constructed if the input string is not parseable. It sets the exception.
172          *              -GetLastResult() should be called to retrieve the last set exception
173          *
174          * @exception   E_SUCCESS       The method is successful.
175          * @exception   E_NUM_FORMAT    The specified string does not represent valid binary, octal, decimal or hexadecimal number, or
176          *                              The specified string contains decimal separator which represent a floating point number.
177          */
178         explicit BigInteger(const ImmutableString& str);
179
180         /**
181          * Initializes %BigInteger instance with String with given radix
182          *
183          * @since 3.0
184          *
185          * @param[in]   value   String representing a numeric value.
186          * @param[in]   radix   The radix of the string representing a numeric value @n
187          *                      Radix value range is from 2 to 36.
188          *
189          * @remarks     -This method accepts only string representing integer value. Decimal separators are not allowed in the input string.
190          *              -The behavior of this constructor is not  dependent on the system default locale setting.
191          *
192          * Following examples explains the string representation for some of the radix
193          *
194          * @code
195          *
196          *      ImmutableString str1(L"CD14");
197          *      BigInteger bigInt1(str1, 16); // Radix 16 representation of decimal number 52500
198          *
199          *      ImmutableString str2(L"53214");
200          *      BigInteger bigInt2(str1, 6); // Radix 6 representation of decimal number 7210
201          *
202          *      ImmutableString str3(L"632456");
203          *      BigInteger bigInt3(str1, 7); // Radix 7 representation of decimal number 108968
204          *
205          *      ImmutableString str4(L"5746321");
206          *      BigInteger bigInt4(str1, 8); // Radix 8 representation of decimal number 1559761
207          *
208          * @endcode
209          *
210          *              -The object is not fully constructed if the input string is not parseable. It sets the exception.
211          *              -GetLastResult() should be called to retrieve the last set exception
212          *
213          * @exception   E_SUCCESS       The method is successful.
214          * @exception   E_NUM_FORMAT    The specified string does not represent valid binary, octal, decimal or hexadecimal number, or
215          *                              The specified string contains decimal separator which represent a floating point number.
216          * @exception   E_OUT_OF_RANGE  The specified radix is not in between 2 to 36.
217          */
218         BigInteger(const ImmutableString& str, int radix);
219
220         /*
221          * Copying of objects using this copy constructor is allowed.
222          *
223          * @since 3.0
224          *
225          * @param[in]   value   An instance of %BigInteger
226          */
227         BigInteger(const BigInteger& bigInt);
228
229         /**
230          * This destructor overrides Tizen::Base::Object::~Object().
231          *
232          * @since 3.0
233          *
234          * @remarks     The internally allocated memory block is freed when the instance is destroyed.
235          */
236         virtual ~BigInteger();
237
238         /**
239          * Calculates absolute value of the calling %BigInteger instance and returns a new %BigInteger instance containing absolute value.
240          *
241          * @since 3.0
242          *
243          * @return      New %BigInteger instance.
244          *
245          */
246         BigInteger Absolute(void) const;
247
248         /**
249          * Adds value of the calling %BigInteger instance with value of specified %BigInteger rhs instance
250          * and returns a new %BigInteger instance whose value is this + rhs.
251          *
252          * @since 3.0
253          *
254          * @param[in]   rhs     Value to add with calling %BigInteger instance.
255          *
256          * @return      A new %BigInteger instance containing this + rhs value.
257          *
258          */
259         BigInteger Add(const BigInteger& rhs) const;
260
261         /**
262          * Performs binary And of value of the calling %BigInteger instance with value of specified %BigInteger rhs instance
263          * and returns a new %BigInteger instance whose value is this & rhs.
264          *
265          * @since 3.0
266          *
267          * @param[in]   rhs     Value to and with calling %BigInteger instance.
268          *
269          * @return      A new %BigInteger instance containing this & rhs value.
270          *
271          */
272         BigInteger And(const BigInteger& rhs) const;
273
274         /**
275          * Performs binary complement of value of specified %BigInteger rhs instance and And'ed with value of calling %BigInteger instance
276          * and returns a new %BigInteger instance whose value is this & ~rhs.
277          *
278          * @since 3.0
279          *
280          * @param[in]   rhs     Value is complemented and AND with calling %BigInteger instance.
281          *
282          * @return      A new %BigInteger instance containing this & ~rhs value.
283          *
284          */
285         BigInteger AndNot(const BigInteger& rhs) const;
286
287         /**
288          * Clears bit at a specified position in the calling %BigInteger instance and returns a new %BigInteger instance.
289          *
290          * @since 3.0
291          *
292          * @param[in]   bitIndex        Position where the bit has to be cleared.
293          *
294          * @return      A new %BigInteger instance.
295          *
296          * @remarks     -If the bitIndex is invalid it sets the exception.
297          *              -GetLastResult() should be called to retrieve the last set exception
298          *
299          * @exception   E_SUCCESS       The method is successful.
300          * @exception   E_OUT_OF_RANGE  The specified bitIndex is less than 0 or grater than bit length of number in binary representation.
301          */
302         BigInteger ClearBit(int bitIndex) const;
303
304         /**
305          * Compares value of calling %BigInteger instance with value of specified %BigInteger instance.
306          *
307          * @since 3.0
308          *
309          * @param[in]   value   Value to compare with calling %BigInteger instance..
310          *
311          * @return      Comparision value.
312          * @remarks
313          * 1            -If the calling %BigInteger instance value is greater than value
314          * 0            -If the calling %BigInteger instance value is equal to value
315          * -1           -If the calling %BigInteger instance value is less than value
316          *
317          */
318         int CompareTo(const BigInteger& value) const;
319
320         /**
321          * Divides value of the calling %BigInteger instance with value of specified %BigInteger rhs instance
322          * and returns a new %BigInteger instance whose value is this / rhs.
323          *
324          * @since 3.0
325          *
326          * @param[in]   rhs     Divisor,value which divides the calling %BigInteger instance.
327          *
328          * @return      A new %BigInteger instance containing this / rhs value.
329          *
330          * @remarks     -If the rhs represents a number 0 it sets the exception.
331          *              -GetLastResult() should be called to retrieve the last set exception
332          *
333          * @exception   E_SUCCESS       The method is successful.
334          * @exception   E_INVALID_ARG   The specified rhs represents number 0.
335          */
336         BigInteger Divide(const BigInteger& rhs) const;
337
338         /**
339          * Divides value of the calling %BigInteger instance with value of specified %BigInteger rhs instance
340          * and returns a struct QuotientAndRemainder containing the quotient and remainder.
341          *
342          * @since 3.0
343          *
344          * @param[in]   rhs     Divisor,value which divides the calling %BigInteger instance.
345          *
346          * @return      QuotientAndRemainder containing quotient and reminder.
347          *
348          *
349          * @remarks     -If the rhs represents a number 0 it sets the exception.
350          *              -GetLastResult() should be called to retrieve the last set exception
351          *              - User should free the memory allocated to QuotientAndRemainder member variables
352          *
353          * @exception   E_SUCCESS       The method is successful.
354          * @exception   E_INVALID_ARG   The specified rhs represents number 0.
355          *
356          */
357         QuotientAndRemainder DivideAndRemainderN(const BigInteger& rhs) const;
358
359         /**
360          * Compares whether the value of the calling %BigInteger instance is  equal to the specified object.
361          *
362          * @since 3.0
363          *
364          * @param[in]   obj     An instance of object to compare.
365          *
366          * @return      @c true if the values are equal else @c false
367          *
368          */
369         bool Equals(const Object& obj) const;
370
371         /**
372          * Flips bit at a specified position in the calling %BigInteger instance and returns a new %BigInteger instance.
373          *
374          * @since 3.0
375          *
376          * @param[in]   bitIndex        Position where the bit is flipped.
377          *
378          * @return      A new %BigInteger instance.
379          *
380          * @remarks     -If the bitIndex is invalid it sets the exception.
381          *              -GetLastResult() should be called to retrieve the last set exception
382          *
383          * @exception   E_SUCCESS       The method is successful.
384          * @exception   E_OUT_OF_RANGE  The specified bitIndex is less than 0 or grater than bit length of number in binary representation.
385          */
386         BigInteger FlipBit(int bitIndex) const;
387
388         /**
389          * Gets the number of bits set to 1 in the value of the calling %BigInteger instance.
390          *
391          * @since 3.0
392          *
393          * @return Number of bits set to 1.
394          */
395         int GetSetBitCount(void) const;
396
397         /**
398          * Gets the number of bits in the binary representation value of the calling %BigInteger instance.
399          *
400          * @since 3.0
401          *
402          * @return Number of bits in the binary representation value of %BigInteger instance.
403          */
404         int GetBitLength(void) const;
405
406         /**
407          * Gets the hash value of the calling %BigInteger instance.
408          *
409          * @since 3.0
410          *
411          * @return      The hash value of the current instance.
412          */
413         int GetHashCode(void) const;
414
415         /**
416          * Gets the lowest bit set value of the calling %BigInteger instance.
417          *
418          * @since 3.0
419          *
420          * @return      The position of the lowest bit set.
421          */
422         int GetLowestSetBit(void) const;
423
424         /**
425          * Gets the sign of the value of the calling %BigInteger instance.
426          *
427          * @since 3.0
428          *
429          * @return      The sign of the value.
430          *
431          * @remarks
432          * -1   -If the value < 0
433          * 0    -If the value == 0
434          * 1    -If the value > 0
435          */
436         int GetSign(void) const;
437
438         /**
439          * Gets the greater common divisor of the value of calling %BigInteger instance and value of the specified %BigInteger instance
440          * and returns a new %BigInteger instance containing value of the greater common divisor.
441          *
442          * @since 3.0
443          *
444          * @param[in]   value   Value with which the greater common divisor is computed
445          *
446          * @return      A new %BigInteger instance containing value of greater common divisor.
447          *
448          * @remarks
449          * Zero is returned if the value of calling %BigInteger instance is 0 or value of the specified %BigInteger instance is 0
450          *
451          */
452         BigInteger GreaterCommonDivisor(const BigInteger& value) const;
453
454         /**
455          * Checks whether the bit at specified index in the value of calling %BigInteger instance is set.
456          *
457          * @since 3.0
458          *
459          * @param[in]   bitIndex        Position of the bit whose value is checked whether it is set.
460          *
461          * @return      A new %BigInteger instance containing value of greater common divisor.
462          *
463          * @remarks     -If the bitIndex is invalid it sets the exception.
464          *              -GetLastResult() should be called to retrieve the last set exception
465          *
466          * @exception   E_SUCCESS       The method is successful.
467          * @exception   E_OUT_OF_RANGE  The specified bitIndex is less than 0 or grater than bit length of number in binary representation.
468          */
469         bool IsBitSet(int bitIndex) const;
470
471         /**
472          * Checks whether the value of calling %BigInteger instance is probably prime.
473          *
474          * @since 3.0
475          *
476          *
477          * @return      @c true if the value if prime else @c false
478          *
479          * @remarks
480          * -returns PROBABLY_PRIME if probably prime.
481          * -returns DEFINITELY_PRIME if definitely prime.
482          * -returns DEFINITELY_COMPOSITE if definitely composite.
483          */
484         PrimeNumberResult IsProbablePrimeNumber(void) const;
485
486         /**
487          * Finds the maximum between value of the calling %BigInteger instance with value of specified %BigInteger rhs instance
488          * and returns  new %BigInteger instance containing maximum value.
489          *
490          * @since 3.0
491          *
492          * @param[in]   rhs     Value to compute the maximum with calling %BigInteger instance.
493          *
494          * @return      A new %BigInteger instance containing maximum value.
495          *
496          */
497         BigInteger Maximum(const BigInteger& rhs) const;
498
499         /**
500          * Finds the minimum between value of the calling %BigInteger instance with value of specified %BigInteger rhs instance
501          * and returns  new %BigInteger instance containing minimum value.
502          *
503          * @since 3.0
504          *
505          * @param[in]   rhs     Value to compute the minimum with calling %BigInteger instance.
506          *
507          * @return      A new %BigInteger instance containing minimum value.
508          *
509          */
510         BigInteger Minimum(const BigInteger& rhs) const;
511
512         /**
513          * Performs modulus of value of the calling %BigInteger instance and value of specified %BigInteger instance
514          * and returns a new %BigInteger instance whose value is this mod value.
515          *
516          * @since 3.0
517          *
518          * @param[in]   value   The modulas.
519          *
520          * @return      A new %BigInteger instance containing this mod value.
521          *
522          * @remarks     -If the value represents a number 0 it sets the exception.
523          *              -GetLastResult() should be called to retrieve the last set exception
524          *
525          * @exception   E_SUCCESS       The method is successful.
526          * @exception   E_INVALID_ARG   The specified value represents number 0 or number is negative.
527          *
528          * The modulus value must be positive.
529          * The result is always positive.
530          *
531          */
532         BigInteger Modulus(const BigInteger& value) const;
533
534         /**
535          * Performs 1 divided by of value of the calling %BigInteger instance and modulus with value of specified %BigInteger instance
536          * and returns a new %BigInteger instance whose value is 1/this mod value.
537          *
538          * @since 3.0
539          *
540          * @param[in]   value   The modulus.
541          *
542          * @return      A new %BigInteger instance containing 1/this mod value.
543          *
544          * @remarks     -If the value represents a number 0 it sets the exception.
545          *              -GetLastResult() should be called to retrieve the last set exception
546          *
547          * @exception   E_SUCCESS       The method is successful.
548          * @exception   E_INVALID_ARG   The specified value represents number 0 or number is negative.
549          *
550          * The modulas value must be positive.
551          * The result is always positive.
552          *
553          */
554         BigInteger ModulusInverse(const BigInteger& value) const;
555
556         /**
557          * Calculates power of value of the calling %BigInteger instance and exponent specified in value of specified %BigInteger instance
558          * and the result is moded with value specified in the modulo %BigInteger instance.
559          *
560          * @since 3.0
561          *
562          * @param[in]   exponent        The exponent.
563          * @param[in]   modulo          The modulas.
564          *
565          * @return      A new %BigInteger instance containing pow(this, exponent) mod modulo.
566          *
567          * @remarks     -If the modulo represents a number 0 it sets the exception.
568          *              -GetLastResult() should be called to retrieve the last set exception
569          *
570          * @exception   E_SUCCESS       The method is successful.
571          * @exception   E_INVALID_ARG   The specified modulo represents number 0 or modulo is negative.
572          */
573         BigInteger ModulusPower(const BigInteger& exponent, const BigInteger& modulo) const;
574
575
576         /**
577          * Multiplies value of the calling %BigInteger instance with value of specified %BigInteger rhs instance
578          * and returns a new %BigInteger instance whose value is this * rhs.
579          *
580          * @since 3.0
581          *
582          * @param[in]   rhs     Value to multiply with calling %BigInteger instance.
583          *
584          * @return      A new %BigInteger instance.
585          *
586          */
587
588         BigInteger Multiply(const BigInteger& rhs) const;
589
590         /**
591          * Negates value of the calling %BigInteger instance and returns a new %BigInteger instance whose value is -this.
592          *
593          * @since 3.0
594          *
595          * @return      A new %BigInteger instance.
596          *
597          */
598         BigInteger Negate(void) const;
599
600         /**
601          * Gets the next probable prime number from the calling %BigInteger instance
602          * and returns a new %BigInteger instance which contains next probable prime number value is -this.
603          *
604          * @since 3.0
605          *
606          * @return      A new %BigInteger instance containing next probable prime number.
607          *
608          */
609         BigInteger NextProbablePrimeNumber(void) const;
610
611
612         /**
613          * Complements, performs logical negation on each bit in the value of calling %BigInteger instance
614          * and returns a new %BigInteger instance which contains complement value.
615          *
616          * @since 3.0
617          *
618          * @return      A new %BigInteger instance containing complement value.
619          *
620          */
621         BigInteger Not(void) const;
622
623         /**
624          * Performs binary Or of value of the calling %BigInteger instance with value of specified %BigInteger rhs instance
625          * and returns a new %BigInteger instance whose value is this | rhs.
626          *
627          * @since 3.0
628          *
629          * @param[in]   rhs     Value to Or with calling %BigInteger instance.
630          *
631          * @return      A new %BigInteger instance containing this | rhs.
632          *
633          */
634         BigInteger Or(const BigInteger& rhs) const;
635
636         /**
637          * Raises value of the calling %BigInteger instance to the power of specified %BigInteger rhs instance
638          * and returns a new %BigInteger instance whose value is pow(this, exponent).
639          *
640          * @since 3.0
641          *
642          * @param[in]   exponent        Exponent value.
643          *
644          * @return      A new %BigInteger instance containing pow(this, exponent) value.
645          *
646          * @remarks     -If the exponent is negative it sets the exception.
647          *              -GetLastResult() should be called to retrieve the last set exception
648          *
649          * @exception   E_SUCCESS       The method is successful.
650          * @exception   E_INVALID_ARG   The specified exponent value is negative.
651          */
652         BigInteger Power(int exponent) const;
653
654         /**
655          * Divides value of the calling %BigInteger instance with value of specified %BigInteger rhs instance
656          * and returns a new %BigInteger instance whose value is this % rhs.
657          *
658          * @since 3.0
659          *
660          * @param[in]   rhs     Divisor,value which divides the calling %BigInteger instance.
661          *
662          * @return      A new %BigInteger instance containing this % rhs value.
663          *
664          * @remarks     -If the divisor represents a number 0 it sets the exception.
665          *              -GetLastResult() should be called to retrieve the last set exception
666          *
667          * @exception   E_SUCCESS       The method is successful.
668          * @exception   E_INVALID_ARG   The specified divisor represents number 0.
669          */
670         BigInteger Remainder(const BigInteger& divisor) const;
671
672         /**
673          * Sets bit at a specified position in the calling %BigInteger instance and returns a new %BigInteger instance.
674          *
675          * @since 3.0
676          *
677          * @param[in]   bitIndex        Position where the bit has to be set.
678          *
679          * @return      A new %BigInteger instance.
680          *
681          * @remarks     -If the bitIndex is invalid it sets the exception.
682          *              -GetLastResult() should be called to retrieve the last set exception
683          *
684          * @exception   E_SUCCESS       The method is successful.
685          * @exception   E_OUT_OF_RANGE  The specified bitIndex is less than 0 or grater than bit length of number in binary representation.
686          */
687         BigInteger SetBit(int bitIndex) const;
688
689         /**
690          * Performs Shift left of value of the calling %BigInteger instance with specified shift distance
691          * and returns a new %BigInteger instance whose value is this << shiftDistance.
692          *
693          * @since 3.0
694          *
695          * @param[in]   shiftDistance   Shift distance.
696          *
697          * @return      A new %BigInteger instance.
698          *
699          * @remarks     -If the shiftDistance is invalid it sets the exception.
700          *              -GetLastResult() should be called to retrieve the last set exception
701          *
702          * @exception   E_SUCCESS       The method is successful.
703          * @exception   E_OUT_OF_RANGE  The specified shiftDistance is less than 0 or grater than bit length of number in binary representation.
704          */
705         BigInteger ShiftLeft(int shiftDistance) const;
706
707         /**
708          * Performs Shift right of value of the calling %BigInteger instance with specified shift distance
709          * and returns a new %BigInteger instance whose value is this >> shiftDistance.
710          *
711          * @since 3.0
712          *
713          * @param[in]   shiftDistance   Shift distance.
714          *
715          * @return      A new %BigInteger instance.
716          *
717          * @remarks     -If the shiftDistance is invalid it sets the exception.
718          *              -GetLastResult() should be called to retrieve the last set exception
719          *
720          * @exception   E_SUCCESS       The method is successful.
721          * @exception   E_OUT_OF_RANGE  The specified shiftDistance is less than 0 or grater than bit length of number in binary representation.
722          */
723         BigInteger ShiftRight(int shiftDistance) const;
724
725         /**
726          * Subtracts value of the calling %BigInteger instance with value of specified %BigInteger rhs instance
727          * and returns a new %BigInteger instance whose value is this - rhs.
728          *
729          * @since 3.0
730          *
731          * @param[in]   rhs     Value to subtract with calling %BigInteger instance.
732          *
733          * @return      A new %BigInteger instance.
734          *
735          */
736         BigInteger Subtract(const BigInteger& rhs) const;
737
738         /**
739          * Gets the @c double equivalent of the current instance of %BigInteger.
740          *
741          * @since 3.0
742          *
743          * @return      The @c double equivalent of the current instance
744          *
745          * @remarks     -If the value is not in double range it sets the exception.
746          *              -When exception occurs value is set to DBL_MAX if the number is grater than 0.
747          *              -When exception occurs value is set to DBL_MIN if the number is less than 0.
748          *              -GetLastResult() should be called to retrieve the last set exception
749          *
750          * @exception   E_SUCCESS       The method is successful.
751          * @exception   E_OUT_OF_RANGE  The @cdouble value is not in between DBL_MAX and DBL_MIN range.
752          */
753         double ToDouble(void) const;
754
755         /**
756          * Gets the @c int64_t equivalent of the current instance of %BigInteger.
757          *
758          * @since 3.0
759          *
760          * @return      The @c int64_t equivalent of the current instance
761          *
762          * @remarks     -If the value is not in long long range it sets the exception.
763          *              -When exception occurs value is set to LongLong::VALUE_MAX if the number is grater than 0.
764          *              -When exception occurs value is set to LongLong::VALUE_MIN if the number is less than 0.
765          *              -GetLastResult() should be called to retrieve the last set exception
766          *
767          * @exception   E_SUCCESS       The method is successful.
768          * @exception   E_OUT_OF_RANGE  The @cint64_t value is not in between LongLong::VALUE_MAX and LongLong::VALUE_MIN range.
769          */
770         int64_t ToInt64(void) const;
771
772         /**
773          * Converts value of the calling %BigInteger instance to string representation in decimal form.
774          *
775          * @since 3.0
776          *
777          * @return      String containing the value in decimal form.
778          *
779          */
780         ImmutableString ToString(void) const;
781
782         /**
783          * Converts value of the calling %BigInteger instance to string representation in specified radix.
784          *
785          * @since 3.0
786          *
787          * @param[in]   radix   Radix used for the string representation.
788          *
789          * @return      String containing the value in specified radix.
790          *
791          * @remarks     -If radix is invalid it sets the exception.
792          *              -GetLastResult() should be called to retrieve the last set exception
793          *
794          * @exception   E_SUCCESS       The method is successful.
795          * @exception   E_OUT_OF_RANGE  The specified radix is not in between 2 to 36.
796          */
797         ImmutableString ToString(int radix) const;
798
799         /**
800          * Performs binary Xor of value of the calling %BigInteger instance with value of specified %BigInteger rhs instance
801          * and returns a new %BigInteger instance whose value is this ^ rhs.
802          *
803          * @since 3.0
804          *
805          * @param[in]   rhs     Value to Xor with calling %BigInteger instance.
806          *
807          * @return      A new %BigInteger instance containing this ^ rhs value.
808          *
809          */
810         BigInteger Xor(const BigInteger& rhs) const;
811
812
813 private:
814         //
815         // This constructor is intentionally declared as private so that only the platform can create an instance.
816         //
817         // @param[in]   bigInt  An instance of %BigInteger class to copy from
818         //
819         BigInteger();
820
821         //
822         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
823         //
824         // @param[in]   list    An instance of %BigInteger
825         //
826         BigInteger& operator =(const BigInteger& bigInt);
827
828         //
829         // Overloaded constructor
830         //
831         BigInteger(_BigIntegerImpl* pImpl);
832
833 private:
834         friend class _BigIntegerImpl;
835         class _BigIntegerImpl* __pImpl;
836 };
837 }} // Tizen::Base
838 #endif //_FBASE_BIG_INTEGER_H_