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