001/** 002 * AbstractCharacterPrimitive.java 003 * 004 * Copyright (c) 2004-2012, Nicole C. Tedesco. All rights reserved. 005 * 006 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 007 * use this file except in compliance with the License. You may obtain a copy of 008 * the License at: 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 014 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 015 * License for the specific language governing permissions and limitations under 016 * the License. 017 */ 018 019package net.sf.jaccumulator.characters; 020 021import java.math.BigDecimal; 022import java.math.BigInteger; 023import java.util.NoSuchElementException; 024 025import net.sf.jaccumulator.lex.To; 026import net.sf.jaccumulator.primitives.AbstractNumericPrimitive; 027import net.sf.jaccumulator.primitives.Constant; 028import net.sf.jaccumulator.primitives.Primitive; 029import net.sf.jaccumulator.primitives.SealedPrimitive; 030import net.sf.jaccumulator.reals.Real; 031import net.sf.jaccumulator.reals.SealedReal; 032import net.sf.jaccumulator.scalars.NumericPrecision; 033import net.sf.jaccumulator.scalars.RoundingStrategy; 034import net.sf.jaccumulator.scalars.Scalar; 035import net.sf.jaccumulator.scalars.SealedScalar; 036 037/** 038 * Abstract {@code char} precision {@link Primitive primitive} implementation 039 * 040 * @param <PRIMITIVE> 041 * this primitive type (used to facilitate operation chaining on write 042 * operations) 043 * @since JAccumulator 4.0 044 * @author Nicole Tedesco (<a 045 * href="mailto:Nicole@NicoleTedesco.com">Nicole@NicoleTedesco.com</a>) 046 */ 047public abstract class AbstractCharacterPrimitive<PRIMITIVE extends Primitive<PRIMITIVE>> 048 extends 049 AbstractNumericPrimitive<PRIMITIVE> 050{ 051 private static final long serialVersionUID = -541923041007370532L; 052 053 public AbstractCharacterPrimitive() 054 { 055 super(NumericPrecision.CHARACTER); 056 } 057 058 @Override 059 @SuppressWarnings( "unchecked" ) 060 public final PRIMITIVE absoluteValue() 061 throws UnsupportedOperationException, 062 ArithmeticException, 063 IllegalArgumentException 064 { 065 return (PRIMITIVE)this; 066 } 067 068 @Override 069 public final PRIMITIVE and( final boolean aValue ) 070 throws UnsupportedOperationException, 071 IllegalArgumentException, 072 ArithmeticException 073 { 074 return this.and(To.charValue(aValue)); 075 } 076 077 @Override 078 public final PRIMITIVE and( final byte aValue ) 079 throws UnsupportedOperationException, 080 IllegalArgumentException, 081 ArithmeticException 082 { 083 return this.setScalar(this.charValue() & aValue); 084 } 085 086 @Override 087 public final PRIMITIVE and( final short aValue ) 088 throws UnsupportedOperationException, 089 IllegalArgumentException, 090 ArithmeticException 091 { 092 return this.setScalar(this.charValue() & aValue); 093 } 094 095 @Override 096 public final boolean booleanPostDecrement() 097 throws UnsupportedOperationException, 098 ArithmeticException, 099 IllegalArgumentException 100 { 101 return To.booleanValue(this.charPostDecrement()); 102 } 103 104 @Override 105 public final boolean booleanPostIncrement() 106 throws UnsupportedOperationException, 107 ArithmeticException, 108 IllegalArgumentException 109 { 110 return To.booleanValue(this.charPostIncrement()); 111 } 112 113 @Override 114 public final boolean booleanValue() 115 { 116 return To.booleanValue(this.charValue()); 117 } 118 119 @Override 120 public final byte bytePostDecrement() 121 throws UnsupportedOperationException, 122 ArithmeticException, 123 IllegalArgumentException 124 { 125 return (byte)this.charPostDecrement(); 126 } 127 128 @Override 129 public final byte bytePostIncrement() 130 throws UnsupportedOperationException, 131 ArithmeticException, 132 IllegalArgumentException 133 { 134 return (byte)this.charPostIncrement(); 135 } 136 137 @Override 138 public final byte byteValue() 139 { 140 return (byte)this.charValue(); 141 } 142 143 @Override 144 public PRIMITIVE copyUsing( final BigDecimal aValue ) 145 { 146 return this.copyUsing((char)aValue.intValue()); 147 } 148 149 @Override 150 public PRIMITIVE copyUsing( final BigInteger aValue ) 151 { 152 return this.copyUsing((char)aValue.intValue()); 153 } 154 155 @Override 156 public PRIMITIVE copyUsing( final boolean aValue ) 157 { 158 return this.copyUsing(To.charValue(aValue)); 159 } 160 161 @Override 162 public PRIMITIVE copyUsing( final byte aValue ) 163 { 164 return this.copyUsing((char)aValue); 165 } 166 167 @Override 168 public PRIMITIVE copyUsing( final double aValue ) 169 { 170 return this.copyUsing((char)aValue); 171 } 172 173 @Override 174 public PRIMITIVE copyUsing( final float aValue ) 175 { 176 return this.copyUsing((char)aValue); 177 } 178 179 @Override 180 public PRIMITIVE copyUsing( final int aValue ) 181 { 182 return this.copyUsing((char)aValue); 183 } 184 185 @Override 186 public PRIMITIVE copyUsing( final long aValue ) 187 { 188 return this.copyUsing((char)aValue); 189 } 190 191 @Override 192 public PRIMITIVE copyUsing( final short aValue ) 193 { 194 return this.copyUsing((char)aValue); 195 } 196 197 @Override 198 public PRIMITIVE copyUsingPrimitive( final SealedPrimitive<?> aValue ) 199 { 200 return this.copyUsing(aValue.charValue()); 201 } 202 203 @Override 204 public PRIMITIVE copyUsingReal( final SealedReal<?> aValue ) 205 { 206 return this.copyUsing(aValue.charValue()); 207 } 208 209 @Override 210 public PRIMITIVE copyUsingScalar( final SealedScalar<?> aValue ) 211 { 212 return this.copyUsing(aValue.charValue()); 213 } 214 215 @Override 216 public PRIMITIVE copyUsingText( final CharSequence aValue ) 217 { 218 return this.copyUsing(firstChar(aValue)); 219 } 220 221 @Override 222 public final PRIMITIVE cube() 223 throws UnsupportedOperationException, 224 IllegalArgumentException, 225 ArithmeticException 226 { 227 final char myValue = this.charValue(); 228 return this.setScalar(myValue * myValue * myValue); 229 } 230 231 @Override 232 public final PRIMITIVE difference( final boolean aValue ) 233 throws UnsupportedOperationException, 234 IllegalArgumentException, 235 ArithmeticException 236 { 237 return this.difference(To.charValue(aValue)); 238 } 239 240 @Override 241 public final PRIMITIVE difference( final byte aValue ) 242 throws UnsupportedOperationException, 243 IllegalArgumentException, 244 ArithmeticException 245 { 246 return this.setScalar(this.charValue() - aValue); 247 } 248 249 @Override 250 public final PRIMITIVE difference( final short aValue ) 251 throws UnsupportedOperationException, 252 IllegalArgumentException, 253 ArithmeticException 254 { 255 return this.setScalar(this.charValue() - aValue); 256 } 257 258 @Override 259 public final double doublePostDecrement() 260 throws UnsupportedOperationException, 261 ArithmeticException, 262 IllegalArgumentException 263 { 264 return this.charPostDecrement(); 265 } 266 267 @Override 268 public final double doublePostIncrement() 269 throws UnsupportedOperationException, 270 ArithmeticException, 271 IllegalArgumentException 272 { 273 return this.charPostIncrement(); 274 } 275 276 @Override 277 public final double doubleValue() 278 { 279 return this.charValue(); 280 } 281 282 @Override 283 public final float floatPostDecrement() 284 throws UnsupportedOperationException, 285 ArithmeticException, 286 IllegalArgumentException 287 { 288 return this.charPostDecrement(); 289 } 290 291 @Override 292 public final float floatPostIncrement() 293 throws UnsupportedOperationException, 294 ArithmeticException, 295 IllegalArgumentException 296 { 297 return this.charPostIncrement(); 298 } 299 300 @Override 301 public final float floatValue() 302 { 303 return this.charValue(); 304 } 305 306 @Override 307 public final int hashCode() 308 { 309 return hashCode(this.charValue()); 310 } 311 312 @Override 313 @SuppressWarnings( "unchecked" ) 314 public final <S extends Scalar<?>> S inducePostDecrement( final S aTarget ) 315 throws NullPointerException, 316 NoSuchElementException, 317 UnsupportedOperationException, 318 IllegalStateException 319 { 320 return (S)aTarget.setScalar(this.charPostDecrement()); 321 } 322 323 @Override 324 @SuppressWarnings( "unchecked" ) 325 public final <S extends Scalar<?>> S inducePostIncrement( final S aTarget ) 326 throws NullPointerException, 327 NoSuchElementException, 328 UnsupportedOperationException, 329 IllegalStateException 330 { 331 return (S)aTarget.setScalar(this.charPostIncrement()); 332 } 333 334 @Override 335 public final <REAL extends Real<?>> REAL induceRealMaximum( 336 final REAL aTarget ) 337 throws NullPointerException, 338 NoSuchElementException, 339 UnsupportedOperationException, 340 IllegalStateException 341 { 342 return this.induceScalarMaximum(aTarget); 343 } 344 345 @Override 346 public final <REAL extends Real<?>> REAL induceRealMinimum( 347 final REAL aTarget ) 348 throws NullPointerException, 349 NoSuchElementException, 350 UnsupportedOperationException, 351 IllegalStateException 352 { 353 return this.induceScalarMinimum(aTarget); 354 } 355 356 @Override 357 public final <REAL extends Real<?>> REAL induceRealValue( final REAL aTarget ) 358 throws NullPointerException, 359 NoSuchElementException, 360 UnsupportedOperationException, 361 IllegalStateException 362 { 363 return this.induceScalarValue(aTarget); 364 } 365 366 @Override 367 @SuppressWarnings( "unchecked" ) 368 public final <S extends Scalar<?>> S induceScalarMaximum( final S aTarget ) 369 { 370 return (S)aTarget.setScalar(Character.MAX_VALUE); 371 } 372 373 @Override 374 @SuppressWarnings( "unchecked" ) 375 public final <S extends Scalar<?>> S induceScalarMinimum( final S aTarget ) 376 { 377 return (S)aTarget.setScalar(Character.MIN_VALUE); 378 } 379 380 @Override 381 @SuppressWarnings( "unchecked" ) 382 public final <S extends Scalar<?>> S induceScalarValue( final S aTarget ) 383 { 384 return (S)aTarget.setScalar(this.charValue()); 385 } 386 387 @Override 388 public final int intPostDecrement() 389 throws UnsupportedOperationException, 390 ArithmeticException, 391 IllegalArgumentException 392 { 393 return this.charPostDecrement(); 394 } 395 396 @Override 397 public final int intPostIncrement() 398 throws UnsupportedOperationException, 399 ArithmeticException, 400 IllegalArgumentException 401 { 402 return this.charPostIncrement(); 403 } 404 405 @Override 406 public final int intValue() 407 { 408 return this.charValue(); 409 } 410 411 @Override 412 public final PRIMITIVE inverse() 413 throws UnsupportedOperationException, 414 ArithmeticException, 415 IllegalArgumentException 416 { 417 if (this.isZero()) return this.quotient(0); 418 return this.setUnity(); 419 } 420 421 @Override 422 public final boolean isDigit() 423 { 424 return Character.isDigit(this.charValue()); 425 } 426 427 @Override 428 public final boolean isFinite() 429 { 430 return true; 431 } 432 433 @Override 434 public final boolean isIdentifierIgnorable() 435 { 436 return Character.isIdentifierIgnorable(this.charValue()); 437 } 438 439 @Override 440 public final boolean isInfinity() 441 { 442 return false; 443 } 444 445 @Override 446 public final boolean isInvalid() 447 { 448 return false; 449 } 450 451 @Override 452 public final boolean isISOControl() 453 { 454 return Character.isISOControl(this.charValue()); 455 } 456 457 @Override 458 public final boolean isJavaIdentifierPart() 459 { 460 return Character.isJavaIdentifierPart(this.charValue()); 461 } 462 463 @Override 464 public final boolean isJavaIdentifierStart() 465 { 466 return Character.isJavaIdentifierStart(this.charValue()); 467 } 468 469 @Override 470 public final boolean isLetter() 471 { 472 return Character.isLetter(this.charValue()); 473 } 474 475 @Override 476 public final boolean isLetterOrDigit() 477 { 478 return Character.isLetterOrDigit(this.charValue()); 479 } 480 481 @Override 482 public final boolean isLowerCase() 483 { 484 return Character.isLowerCase(this.charValue()); 485 } 486 487 @Override 488 public final boolean isMaximum() 489 { 490 return this.charValue() == Character.MAX_VALUE; 491 } 492 493 @Override 494 public final boolean isMinimum() 495 { 496 return this.charValue() == Character.MIN_VALUE; 497 } 498 499 @Override 500 public final boolean isMirrored() 501 { 502 return Character.isMirrored(this.charValue()); 503 } 504 505 @Override 506 public final boolean isModulo() 507 { 508 return false; 509 } 510 511 @Override 512 public final boolean isNegative() 513 { 514 return false; 515 } 516 517 @Override 518 public final boolean isNegativeFinite() 519 { 520 return false; 521 } 522 523 @Override 524 public final boolean isNegativeInfinity() 525 { 526 return false; 527 } 528 529 @Override 530 public final boolean isPositive() 531 { 532 return this.charValue() != '\0'; 533 } 534 535 @Override 536 public final boolean isPositiveFinite() 537 { 538 return this.isPositive(); 539 } 540 541 @Override 542 public final boolean isPositiveInfinity() 543 { 544 return false; 545 } 546 547 @Override 548 public final boolean isReal() 549 { 550 return true; 551 } 552 553 @Override 554 public final boolean isTitleCase() 555 { 556 return Character.isTitleCase(this.charValue()); 557 } 558 559 @Override 560 public final boolean isUnicode() 561 { 562 return Character.isDefined(this.charValue()); 563 } 564 565 @Override 566 public final boolean isUnicodeIdentifierPart() 567 { 568 return Character.isUnicodeIdentifierPart(this.charValue()); 569 } 570 571 @Override 572 public final boolean isUnicodeIdentifierStart() 573 { 574 return Character.isUnicodeIdentifierStart(this.charValue()); 575 } 576 577 @Override 578 public final boolean isUnity() 579 { 580 return this.charValue() == '\1'; 581 } 582 583 @Override 584 public final boolean isUpperCase() 585 { 586 return Character.isUpperCase(this.charValue()); 587 } 588 589 @Override 590 public final boolean isWhitespace() 591 { 592 return Character.isWhitespace(this.charValue()); 593 } 594 595 @Override 596 public final boolean isZero() 597 { 598 return this.charValue() == '\0'; 599 } 600 601 @Override 602 public final long longPostDecrement() 603 throws UnsupportedOperationException, 604 ArithmeticException, 605 IllegalArgumentException 606 { 607 return this.charPostDecrement(); 608 } 609 610 @Override 611 public final long longPostIncrement() 612 throws UnsupportedOperationException, 613 ArithmeticException, 614 IllegalArgumentException 615 { 616 return this.charPostIncrement(); 617 } 618 619 @Override 620 public final long longValue() 621 { 622 return this.charValue(); 623 } 624 625 @Override 626 public final PRIMITIVE lowerCase() 627 { 628 return this.setScalar(Character.toLowerCase(this.charValue())); 629 } 630 631 @Override 632 @SuppressWarnings( "unchecked" ) 633 public final PRIMITIVE negate() 634 throws UnsupportedOperationException, 635 ArithmeticException, 636 IllegalArgumentException 637 { 638 return (PRIMITIVE)this; 639 } 640 641 @Override 642 public final PRIMITIVE or( final boolean aValue ) 643 throws UnsupportedOperationException, 644 IllegalArgumentException, 645 ArithmeticException 646 { 647 return this.or(To.charValue(aValue)); 648 } 649 650 @Override 651 public final PRIMITIVE or( final byte aValue ) 652 throws UnsupportedOperationException, 653 IllegalArgumentException, 654 ArithmeticException 655 { 656 return this.setScalar(this.charValue() | aValue); 657 } 658 659 @Override 660 public final PRIMITIVE or( final short aValue ) 661 throws UnsupportedOperationException, 662 IllegalArgumentException, 663 ArithmeticException 664 { 665 return this.setScalar(this.charValue() | aValue); 666 } 667 668 @Override 669 public final PRIMITIVE product( final boolean aValue ) 670 throws UnsupportedOperationException, 671 IllegalArgumentException, 672 ArithmeticException 673 { 674 return this.product(To.charValue(aValue)); 675 } 676 677 @Override 678 public final PRIMITIVE product( final byte aValue ) 679 throws UnsupportedOperationException, 680 IllegalArgumentException, 681 ArithmeticException 682 { 683 return this.setScalar(this.charValue() * aValue); 684 } 685 686 @Override 687 public final PRIMITIVE product( final short aValue ) 688 throws UnsupportedOperationException, 689 IllegalArgumentException, 690 ArithmeticException 691 { 692 return this.setScalar(this.charValue() * aValue); 693 } 694 695 @Override 696 public final PRIMITIVE quotient( final boolean aValue ) 697 throws UnsupportedOperationException, 698 IllegalArgumentException, 699 ArithmeticException 700 { 701 return this.quotient(To.charValue(aValue)); 702 } 703 704 @Override 705 public final PRIMITIVE quotient( final byte aValue ) 706 throws UnsupportedOperationException, 707 IllegalArgumentException, 708 ArithmeticException 709 { 710 return this.setScalar(this.charValue() / aValue); 711 } 712 713 @Override 714 public final PRIMITIVE quotient( final short aValue ) 715 throws UnsupportedOperationException, 716 IllegalArgumentException, 717 ArithmeticException 718 { 719 return this.setScalar(this.charValue() / aValue); 720 } 721 722 @Override 723 @SuppressWarnings( "unchecked" ) 724 public final PRIMITIVE round( final RoundingStrategy aRoundingStrategy ) 725 throws UnsupportedOperationException, 726 IllegalArgumentException, 727 ArithmeticException, 728 NullPointerException 729 { 730 return (PRIMITIVE)this; 731 } 732 733 @Override 734 public final PRIMITIVE setMaximum() 735 throws UnsupportedOperationException, 736 ArithmeticException, 737 IllegalArgumentException 738 { 739 return this.setScalar(Character.MAX_VALUE); 740 } 741 742 @Override 743 public final PRIMITIVE setMinimum() 744 throws UnsupportedOperationException, 745 ArithmeticException, 746 IllegalArgumentException 747 { 748 return this.setScalar(Character.MIN_VALUE); 749 } 750 751 @Override 752 public final PRIMITIVE setNumber( final Number aValue ) 753 throws UnsupportedOperationException, 754 IllegalArgumentException, 755 ArithmeticException, 756 NullPointerException 757 { 758 return this.setScalar(aValue.intValue()); 759 } 760 761 @Override 762 public final PRIMITIVE setPrimitive( final SealedPrimitive<?> aValue ) 763 throws UnsupportedOperationException, 764 IllegalArgumentException, 765 ArithmeticException, 766 NullPointerException 767 { 768 return this.setScalar(aValue.charValue()); 769 } 770 771 @Override 772 public final PRIMITIVE setReal( final BigDecimal aValue ) 773 throws UnsupportedOperationException, 774 IllegalArgumentException, 775 ArithmeticException, 776 NullPointerException 777 { 778 return this.setScalar((char)aValue.intValue()); 779 } 780 781 @Override 782 public final PRIMITIVE setReal( final BigInteger aValue ) 783 throws UnsupportedOperationException, 784 IllegalArgumentException, 785 ArithmeticException, 786 NullPointerException 787 { 788 return this.setScalar((char)aValue.intValue()); 789 } 790 791 @Override 792 public final PRIMITIVE setReal( final SealedReal<?> aValue ) 793 throws UnsupportedOperationException, 794 IllegalArgumentException, 795 ArithmeticException, 796 NullPointerException 797 { 798 return this.setScalar(aValue.charValue()); 799 } 800 801 @Override 802 public final PRIMITIVE setScalar( final boolean aValue ) 803 throws UnsupportedOperationException, 804 IllegalArgumentException, 805 ArithmeticException 806 { 807 return this.setScalar(To.charValue(aValue)); 808 } 809 810 @Override 811 public final PRIMITIVE setScalar( final byte aValue ) 812 throws UnsupportedOperationException, 813 IllegalArgumentException, 814 ArithmeticException 815 { 816 return this.setScalar((char)aValue); 817 } 818 819 @Override 820 public final PRIMITIVE setScalar( final double aValue ) 821 throws UnsupportedOperationException, 822 IllegalArgumentException, 823 ArithmeticException 824 { 825 return this.setScalar((char)aValue); 826 } 827 828 @Override 829 public final PRIMITIVE setScalar( final float aValue ) 830 throws UnsupportedOperationException, 831 IllegalArgumentException, 832 ArithmeticException 833 { 834 return this.setScalar((char)aValue); 835 } 836 837 @Override 838 public final PRIMITIVE setScalar( final int aValue ) 839 throws UnsupportedOperationException, 840 IllegalArgumentException, 841 ArithmeticException 842 { 843 return this.setScalar((char)aValue); 844 } 845 846 @Override 847 public final PRIMITIVE setScalar( final long aValue ) 848 throws UnsupportedOperationException, 849 IllegalArgumentException, 850 ArithmeticException 851 { 852 return this.setScalar((char)aValue); 853 } 854 855 @Override 856 public final PRIMITIVE setScalar( final SealedScalar<?> aValue ) 857 throws UnsupportedOperationException, 858 IllegalArgumentException, 859 ArithmeticException, 860 NullPointerException 861 { 862 return this.setScalar(aValue.charValue()); 863 } 864 865 @Override 866 public final PRIMITIVE setScalar( final short aValue ) 867 throws UnsupportedOperationException, 868 IllegalArgumentException, 869 ArithmeticException 870 { 871 return this.setScalar((char)aValue); 872 } 873 874 @Override 875 public final PRIMITIVE setUnity() 876 throws UnsupportedOperationException, 877 IllegalArgumentException, 878 ArithmeticException 879 { 880 return this.setScalar('\1'); 881 } 882 883 @Override 884 public final PRIMITIVE setZero() 885 throws UnsupportedOperationException, 886 IllegalArgumentException, 887 ArithmeticException 888 { 889 return this.setScalar('\0'); 890 } 891 892 @Override 893 public final short shortPostDecrement() 894 throws UnsupportedOperationException, 895 ArithmeticException, 896 IllegalArgumentException 897 { 898 return (short)this.charPostDecrement(); 899 } 900 901 @Override 902 public final short shortPostIncrement() 903 throws UnsupportedOperationException, 904 ArithmeticException, 905 IllegalArgumentException 906 { 907 return (short)this.charPostIncrement(); 908 } 909 910 @Override 911 public final short shortValue() 912 { 913 return (short)this.charValue(); 914 } 915 916 @Override 917 public final PRIMITIVE square() 918 throws UnsupportedOperationException, 919 IllegalArgumentException, 920 ArithmeticException 921 { 922 final char myValue = this.charValue(); 923 return this.setScalar(myValue * myValue); 924 } 925 926 @Override 927 public final PRIMITIVE sum( final boolean aValue ) 928 throws UnsupportedOperationException, 929 IllegalArgumentException, 930 ArithmeticException 931 { 932 return this.sum(To.charValue(aValue)); 933 } 934 935 @Override 936 public final PRIMITIVE sum( final byte aValue ) 937 throws UnsupportedOperationException, 938 IllegalArgumentException, 939 ArithmeticException 940 { 941 return this.setScalar(this.charValue() + aValue); 942 } 943 944 @Override 945 public final PRIMITIVE sum( final short aValue ) 946 throws UnsupportedOperationException, 947 IllegalArgumentException, 948 ArithmeticException 949 { 950 return this.setScalar(this.charValue() + aValue); 951 } 952 953 @Override 954 public final PRIMITIVE swapPrimitives( final Primitive<?> aPrimitive ) 955 { 956 final char myValue = this.charValue(); 957 final char aValue = aPrimitive.charValue(); 958 aPrimitive.setScalar(myValue); 959 return this.setScalar(aValue); 960 } 961 962 @Override 963 public final PRIMITIVE titleCase() 964 { 965 return this.setScalar(Character.toTitleCase(this.charValue())); 966 } 967 968 @Override 969 public final Number toNumber() 970 { 971 return Integer.valueOf(this.intValue()); 972 } 973 974 @Override 975 public final String toString() 976 { 977 return String.valueOf(this.charValue()); 978 } 979 980 @Override 981 public final BigDecimal toUnlimitedDecimal() 982 { 983 return Constant.toUnlimitedDecimal(this.intValue()); 984 } 985 986 @Override 987 public final BigInteger toUnlimitedInteger() 988 { 989 return BigInteger.valueOf(this.longValue()); 990 } 991 992 @Override 993 public final BigDecimal unlimitedDecimalPostDecrement() 994 throws UnsupportedOperationException, 995 ArithmeticException, 996 IllegalArgumentException 997 { 998 return Constant.toUnlimitedDecimal(this.charPostDecrement()); 999 } 1000 1001 @Override 1002 public final BigDecimal unlimitedDecimalPostIncrement() 1003 throws UnsupportedOperationException, 1004 ArithmeticException, 1005 IllegalArgumentException 1006 { 1007 return Constant.toUnlimitedDecimal(this.charPostIncrement()); 1008 } 1009 1010 @Override 1011 public final BigInteger unlimitedIntegerPostDecrement() 1012 throws UnsupportedOperationException, 1013 ArithmeticException, 1014 IllegalArgumentException 1015 { 1016 return Constant.toUnlimitedInteger(this.charPostDecrement()); 1017 } 1018 1019 @Override 1020 public final BigInteger unlimitedIntegerPostIncrement() 1021 throws UnsupportedOperationException, 1022 ArithmeticException, 1023 IllegalArgumentException 1024 { 1025 return Constant.toUnlimitedInteger(this.charPostIncrement()); 1026 } 1027 1028 @Override 1029 public final PRIMITIVE upperCase() 1030 { 1031 return this.setScalar(Character.toUpperCase(this.charValue())); 1032 } 1033 1034 @Override 1035 public final PRIMITIVE xor( final boolean aValue ) 1036 throws UnsupportedOperationException, 1037 IllegalArgumentException, 1038 ArithmeticException 1039 { 1040 return this.xor(To.charValue(aValue)); 1041 } 1042 1043 @Override 1044 public final PRIMITIVE xor( final byte aValue ) 1045 throws UnsupportedOperationException, 1046 IllegalArgumentException, 1047 ArithmeticException 1048 { 1049 return this.setScalar(this.charValue() ^ aValue); 1050 } 1051 1052 @Override 1053 public final PRIMITIVE xor( final short aValue ) 1054 throws UnsupportedOperationException, 1055 IllegalArgumentException, 1056 ArithmeticException 1057 { 1058 return this.setScalar(this.charValue() ^ aValue); 1059 } 1060 1061 public static final char firstChar( final CharSequence p0 ) 1062 { 1063 if (p0.length() == 0) return '\0'; 1064 return p0.charAt(0); 1065 } 1066}