001/**
002 * AbstractConstant.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.primitives;
020
021import java.math.BigDecimal;
022import java.math.BigInteger;
023import java.util.NoSuchElementException;
024
025import net.sf.jaccumulator.ConcurrencyStrategy;
026import net.sf.jaccumulator.Domain;
027import net.sf.jaccumulator.reals.Real;
028import net.sf.jaccumulator.scalars.NumericPrecision;
029import net.sf.jaccumulator.scalars.RoundingStrategy;
030import net.sf.jaccumulator.scalars.Scalar;
031
032/**
033 * A sealed {@link Primitive primitive} whose modification functions are shunted
034 * and which will produce {@link UnsupportedOperationException
035 * UnsupportedOperationExceptions} upon access
036 * 
037 * @param <PRIMITIVE>
038 *        this primitive type (used to facilitate operation chaining on write
039 *        operations)
040 * @since JCXell 1.0
041 * @author Nicole Tedesco (<a
042 *         href="mailto:Nicole@NicoleTedesco.com">Nicole@NicoleTedesco.com</a>)
043 */
044public abstract class AbstractConstant<PRIMITIVE extends Primitive<PRIMITIVE>>
045    extends
046        AbstractNumericPrimitive<PRIMITIVE>
047{
048    private static final long serialVersionUID = 5381445320761784L;
049
050    public AbstractConstant()
051    {
052        super();
053    }
054
055    public AbstractConstant(
056        final Domain aDomain,
057        final NumericPrecision aPrecision )
058    {
059        super(aDomain, aPrecision);
060    }
061
062    public AbstractConstant( final NumericPrecision aPrecision )
063    {
064        super(aPrecision);
065    }
066
067    @Override
068    public final PRIMITIVE append( final boolean aValue )
069        throws UnsupportedOperationException
070    {
071        throw new UnsupportedOperationException();
072    }
073
074    @Override
075    public final PRIMITIVE append( final char c )
076        throws UnsupportedOperationException
077    {
078        throw new UnsupportedOperationException();
079    }
080
081    @Override
082    public final PRIMITIVE append( final char[] content )
083        throws UnsupportedOperationException
084    {
085        throw new UnsupportedOperationException();
086    }
087
088    @Override
089    public final PRIMITIVE append(
090        final char[] content,
091        final int contentIndex,
092        final int contentLength ) throws UnsupportedOperationException
093    {
094        throw new UnsupportedOperationException();
095    }
096
097    @Override
098    public final PRIMITIVE append( final CharSequence s )
099        throws UnsupportedOperationException
100    {
101        throw new UnsupportedOperationException();
102    }
103
104    @Override
105    public final PRIMITIVE append(
106        final CharSequence s,
107        final int start,
108        final int end ) throws UnsupportedOperationException
109    {
110        throw new UnsupportedOperationException();
111    }
112
113    @Override
114    public final PRIMITIVE append( final double aValue )
115        throws UnsupportedOperationException
116    {
117        throw new UnsupportedOperationException();
118    }
119
120    @Override
121    public final PRIMITIVE append( final float aValue )
122        throws UnsupportedOperationException
123    {
124        throw new UnsupportedOperationException();
125    }
126
127    @Override
128    public final PRIMITIVE append( final int aValue )
129        throws UnsupportedOperationException
130    {
131        throw new UnsupportedOperationException();
132    }
133
134    @Override
135    public final PRIMITIVE append( final long aValue )
136        throws UnsupportedOperationException
137    {
138        throw new UnsupportedOperationException();
139    }
140
141    @Override
142    public final PRIMITIVE append( final Object aValue )
143        throws UnsupportedOperationException
144    {
145        throw new UnsupportedOperationException();
146    }
147
148    @Override
149    public final PRIMITIVE append( final StringBuffer sb )
150        throws UnsupportedOperationException
151    {
152        throw new UnsupportedOperationException();
153    }
154
155    @Override
156    public final PRIMITIVE appendCodePoint( final int codePoint )
157        throws UnsupportedOperationException
158    {
159        throw new UnsupportedOperationException();
160    }
161
162    @Override
163    public final boolean booleanPostDecrement()
164        throws UnsupportedOperationException,
165            ArithmeticException,
166            IllegalArgumentException
167    {
168        throw new UnsupportedOperationException();
169    }
170
171    @Override
172    public final boolean booleanPostIncrement()
173        throws UnsupportedOperationException,
174            ArithmeticException,
175            IllegalArgumentException
176    {
177        throw new UnsupportedOperationException();
178    }
179
180    @Override
181    public final byte bytePostDecrement()
182        throws UnsupportedOperationException,
183            ArithmeticException,
184            IllegalArgumentException
185    {
186        throw new UnsupportedOperationException();
187    }
188
189    @Override
190    public final byte bytePostIncrement()
191        throws UnsupportedOperationException,
192            ArithmeticException,
193            IllegalArgumentException
194    {
195        throw new UnsupportedOperationException();
196    }
197
198    @Override
199    public final char charPostDecrement()
200        throws UnsupportedOperationException,
201            ArithmeticException,
202            IllegalArgumentException
203    {
204        throw new UnsupportedOperationException();
205    }
206
207    @Override
208    public final char charPostIncrement()
209        throws UnsupportedOperationException,
210            ArithmeticException,
211            IllegalArgumentException
212    {
213        throw new UnsupportedOperationException();
214    }
215
216    @Override
217    public final void clear()
218    {
219        throw new UnsupportedOperationException();
220    }
221
222    @Override
223    @SuppressWarnings( "unchecked" )
224    public final PRIMITIVE copy()
225    {
226        return (PRIMITIVE)this;
227    }
228
229    @Override
230    public final PRIMITIVE cube()
231        throws UnsupportedOperationException,
232            IllegalArgumentException,
233            ArithmeticException
234    {
235        throw new UnsupportedOperationException();
236    }
237
238    @Override
239    public final PRIMITIVE decrement()
240        throws UnsupportedOperationException,
241            IllegalArgumentException,
242            ArithmeticException
243    {
244        throw new UnsupportedOperationException();
245    }
246
247    @Override
248    public final PRIMITIVE delete( final int start, final int end )
249        throws UnsupportedOperationException
250    {
251        throw new UnsupportedOperationException();
252    }
253
254    @Override
255    public final PRIMITIVE deleteCharAt( final int anIndex )
256        throws UnsupportedOperationException
257    {
258        throw new UnsupportedOperationException();
259    }
260
261    @Override
262    public final double doublePostDecrement()
263        throws UnsupportedOperationException,
264            ArithmeticException,
265            IllegalArgumentException
266    {
267        throw new UnsupportedOperationException();
268    }
269
270    @Override
271    public final double doublePostIncrement()
272        throws UnsupportedOperationException,
273            ArithmeticException,
274            IllegalArgumentException
275    {
276        throw new UnsupportedOperationException();
277    }
278
279    @Override
280    public final float floatPostDecrement()
281        throws UnsupportedOperationException,
282            ArithmeticException,
283            IllegalArgumentException
284    {
285        throw new UnsupportedOperationException();
286    }
287
288    @Override
289    public final float floatPostIncrement()
290        throws UnsupportedOperationException,
291            ArithmeticException,
292            IllegalArgumentException
293    {
294        throw new UnsupportedOperationException();
295    }
296
297    @Override
298    public final ConcurrencyStrategy getConcurrency()
299    {
300        return ConcurrencyStrategy.CONCURRENT;
301    }
302
303    @Override
304    public final PRIMITIVE increment()
305        throws UnsupportedOperationException,
306            ArithmeticException,
307            IllegalArgumentException
308    {
309        throw new UnsupportedOperationException();
310    }
311
312    @Override
313    public final <P extends Primitive<?>> P inducePostDecrement( final P aTarget )
314        throws NullPointerException,
315            NoSuchElementException,
316            UnsupportedOperationException,
317            IllegalStateException
318    {
319        throw new UnsupportedOperationException();
320    }
321
322    @Override
323    public final <R extends Real<?>> R inducePostDecrement( final R aTarget )
324        throws NullPointerException,
325            NoSuchElementException,
326            UnsupportedOperationException,
327            IllegalStateException
328    {
329        throw new UnsupportedOperationException();
330    }
331
332    @Override
333    public final <S extends Scalar<?>> S inducePostDecrement( final S aTarget )
334        throws NullPointerException,
335            NoSuchElementException,
336            UnsupportedOperationException,
337            IllegalStateException
338    {
339        throw new UnsupportedOperationException();
340    }
341
342    @Override
343    public final <P extends Primitive<?>> P inducePostIncrement( final P aTarget )
344        throws NullPointerException,
345            NoSuchElementException,
346            UnsupportedOperationException,
347            IllegalStateException
348    {
349        throw new UnsupportedOperationException();
350    }
351
352    @Override
353    public final <R extends Real<?>> R inducePostIncrement( final R aTarget )
354        throws NullPointerException,
355            NoSuchElementException,
356            UnsupportedOperationException,
357            IllegalStateException
358    {
359        throw new UnsupportedOperationException();
360    }
361
362    @Override
363    public final <S extends Scalar<?>> S inducePostIncrement( final S aTarget )
364        throws NullPointerException,
365            NoSuchElementException,
366            UnsupportedOperationException,
367            IllegalStateException
368    {
369        throw new UnsupportedOperationException();
370    }
371
372    @Override
373    public <R extends Real<?>> R induceRealMaximum( final R aTarget )
374    {
375        switch (this.getPrecision()) {
376        case BIT:
377            aTarget.setScalar(true);
378            break;
379        case BYTE:
380            aTarget.setScalar(Byte.MAX_VALUE);
381            break;
382        case SHORT:
383            aTarget.setScalar(Short.MAX_VALUE);
384            break;
385        case CHARACTER:
386            aTarget.setScalar(Character.MAX_VALUE);
387            break;
388        case INTEGER:
389            aTarget.setScalar(Integer.MAX_VALUE);
390            break;
391        case LONG:
392            aTarget.setScalar(Long.MAX_VALUE);
393            break;
394        case FLOAT:
395            aTarget.setScalar(Float.MAX_VALUE);
396            break;
397        case UNLIMITED_INTEGER:
398            aTarget.setScalar(Long.MAX_VALUE);
399            break;
400        case UNLIMITED_DECIMAL:
401            aTarget.setScalar(Double.MAX_VALUE);
402            break;
403        default:
404            aTarget.setScalar(Double.MAX_VALUE);
405            break;
406        }
407        return aTarget;
408    }
409
410    @Override
411    public <R extends Real<?>> R induceRealMinimum( final R aTarget )
412    {
413        switch (this.getPrecision()) {
414        case BIT:
415            aTarget.setScalar(true);
416            break;
417        case BYTE:
418            aTarget.setScalar(Byte.MIN_VALUE);
419            break;
420        case SHORT:
421            aTarget.setScalar(Short.MIN_VALUE);
422            break;
423        case CHARACTER:
424            aTarget.setScalar(Character.MIN_VALUE);
425            break;
426        case INTEGER:
427            aTarget.setScalar(Integer.MIN_VALUE);
428            break;
429        case LONG:
430            aTarget.setScalar(Long.MIN_VALUE);
431            break;
432        case FLOAT:
433            aTarget.setScalar(Float.MIN_VALUE);
434            break;
435        case UNLIMITED_INTEGER:
436            aTarget.setScalar(Long.MIN_VALUE);
437            break;
438        case UNLIMITED_DECIMAL:
439            aTarget.setScalar(Double.MIN_VALUE);
440            break;
441        default:
442            aTarget.setScalar(Double.MIN_VALUE);
443            break;
444        }
445        return aTarget;
446    }
447
448    @Override
449    public <R extends Real<?>> R induceRealValue( final R aTarget )
450    {
451        switch (this.getPrecision()) {
452        case BIT:
453            aTarget.setScalar(this.booleanValue());
454            break;
455        case BYTE:
456            aTarget.setScalar(this.byteValue());
457            break;
458        case SHORT:
459            aTarget.setScalar(this.shortValue());
460            break;
461        case CHARACTER:
462            aTarget.setScalar(this.charValue());
463            break;
464        case INTEGER:
465            aTarget.setScalar(this.intValue());
466            break;
467        case LONG:
468            aTarget.setScalar(this.longValue());
469            break;
470        case FLOAT:
471            aTarget.setScalar(this.floatValue());
472            break;
473        case UNLIMITED_INTEGER:
474            aTarget.setReal(this.toUnlimitedInteger());
475            break;
476        case UNLIMITED_DECIMAL:
477            aTarget.setReal(this.toUnlimitedDecimal());
478            break;
479        default:
480            aTarget.setScalar(this.doubleValue());
481            break;
482        }
483        return aTarget;
484    }
485
486    @Override
487    public <S extends Scalar<?>> S induceScalarMaximum( final S aTarget )
488    {
489        switch (this.getPrecision()) {
490        case BIT:
491            aTarget.setScalar(true);
492            break;
493        case BYTE:
494            aTarget.setScalar(Byte.MAX_VALUE);
495            break;
496        case SHORT:
497            aTarget.setScalar(Short.MAX_VALUE);
498            break;
499        case CHARACTER:
500            aTarget.setScalar(Character.MAX_VALUE);
501            break;
502        case INTEGER:
503            aTarget.setScalar(Integer.MAX_VALUE);
504            break;
505        case LONG:
506            aTarget.setScalar(Long.MAX_VALUE);
507            break;
508        case FLOAT:
509            aTarget.setScalar(Float.MAX_VALUE);
510            break;
511        default:
512            aTarget.setScalar(Double.MAX_VALUE);
513            break;
514        }
515        return aTarget;
516    }
517
518    @Override
519    public <S extends Scalar<?>> S induceScalarMinimum( final S aTarget )
520    {
521        switch (this.getPrecision()) {
522        case BIT:
523            aTarget.setScalar(true);
524            break;
525        case BYTE:
526            aTarget.setScalar(Byte.MIN_VALUE);
527            break;
528        case SHORT:
529            aTarget.setScalar(Short.MIN_VALUE);
530            break;
531        case CHARACTER:
532            aTarget.setScalar(Character.MIN_VALUE);
533            break;
534        case INTEGER:
535            aTarget.setScalar(Integer.MIN_VALUE);
536            break;
537        case LONG:
538            aTarget.setScalar(Long.MIN_VALUE);
539            break;
540        case FLOAT:
541            aTarget.setScalar(Float.MIN_VALUE);
542            break;
543        default:
544            aTarget.setScalar(Double.MIN_VALUE);
545            break;
546        }
547        return aTarget;
548    }
549
550    @Override
551    public <S extends Scalar<?>> S induceScalarValue( final S aTarget )
552    {
553        switch (this.getPrecision()) {
554        case BIT:
555            aTarget.setScalar(this.booleanValue());
556            break;
557        case BYTE:
558            aTarget.setScalar(this.byteValue());
559            break;
560        case SHORT:
561            aTarget.setScalar(this.shortValue());
562            break;
563        case CHARACTER:
564            aTarget.setScalar(this.charValue());
565            break;
566        case INTEGER:
567            aTarget.setScalar(this.intValue());
568            break;
569        case LONG:
570            aTarget.setScalar(this.longValue());
571            break;
572        case FLOAT:
573            aTarget.setScalar(this.floatValue());
574            break;
575        default:
576            aTarget.setScalar(this.doubleValue());
577            break;
578        }
579        return aTarget;
580    }
581
582    @Override
583    public final PRIMITIVE insert( final int anIndex, final boolean aValue )
584        throws UnsupportedOperationException
585    {
586        throw new UnsupportedOperationException();
587    }
588
589    @Override
590    public final PRIMITIVE insert( final int anIndex, final char aValue )
591        throws UnsupportedOperationException
592    {
593        throw new UnsupportedOperationException();
594    }
595
596    @Override
597    public final PRIMITIVE insert( final int anIndex, final char[] content )
598        throws UnsupportedOperationException
599    {
600        throw new UnsupportedOperationException();
601    }
602
603    @Override
604    public final PRIMITIVE insert(
605        final int targetIndex,
606        final char[] content,
607        final int contentIndex,
608        final int contentLength ) throws UnsupportedOperationException
609    {
610        throw new UnsupportedOperationException();
611    }
612
613    @Override
614    public final PRIMITIVE insert( final int anIndex, final CharSequence content )
615        throws UnsupportedOperationException
616    {
617        throw new UnsupportedOperationException();
618    }
619
620    @Override
621    public final PRIMITIVE insert(
622        final int targetIndex,
623        final CharSequence content,
624        final int contentIndex ) throws UnsupportedOperationException
625    {
626        throw new UnsupportedOperationException();
627    }
628
629    @Override
630    public final PRIMITIVE insert(
631        final int targetIndex,
632        final CharSequence content,
633        final int contentStartIndex,
634        final int contentEndIndexPlusOne ) throws UnsupportedOperationException
635    {
636        throw new UnsupportedOperationException();
637    }
638
639    @Override
640    public final PRIMITIVE insert( final int anIndex, final double aValue )
641        throws UnsupportedOperationException
642    {
643        throw new UnsupportedOperationException();
644    }
645
646    @Override
647    public final PRIMITIVE insert( final int anIndex, final float aValue )
648        throws UnsupportedOperationException
649    {
650        throw new UnsupportedOperationException();
651    }
652
653    @Override
654    public final PRIMITIVE insert( final int anIndex, final int aValue )
655        throws UnsupportedOperationException
656    {
657        throw new UnsupportedOperationException();
658    }
659
660    @Override
661    public final PRIMITIVE insert( final int anIndex, final long aValue )
662        throws UnsupportedOperationException
663    {
664        throw new UnsupportedOperationException();
665    }
666
667    @Override
668    public final PRIMITIVE insert( final int anIndex, final Object aValue )
669        throws UnsupportedOperationException
670    {
671        throw new UnsupportedOperationException();
672    }
673
674    @Override
675    public final int intPostDecrement()
676        throws UnsupportedOperationException,
677            ArithmeticException,
678            IllegalArgumentException
679    {
680        throw new UnsupportedOperationException();
681    }
682
683    @Override
684    public final int intPostIncrement()
685        throws UnsupportedOperationException,
686            ArithmeticException,
687            IllegalArgumentException
688    {
689        throw new UnsupportedOperationException();
690    }
691
692    @Override
693    public final PRIMITIVE inverse()
694        throws UnsupportedOperationException,
695            ArithmeticException,
696            IllegalArgumentException
697    {
698        throw new UnsupportedOperationException();
699    }
700
701    @Override
702    public final boolean isConfigurable()
703    {
704        return false;
705    }
706
707    @Override
708    public final boolean isDigit()
709    {
710        // This is assumed not to be frequently called; instead of impacting the
711        // start-up time of each Constant, we will perform this test upon demand
712        //
713        switch (this.getPrecision()) {
714        case NULL:
715        case BIT:
716        case BYTE:
717        case SHORT:
718        case CHARACTER:
719        case UNKNOWN:
720            return Character.isDigit(this.charValue());
721        }
722        return Character.isDigit(this.intValue());
723    }
724
725    /**
726     * Scalar representations are hardware-driven and not scalable.
727     */
728    @Override
729    public final boolean isElastic()
730    {
731        return false;
732    }
733
734    /**
735     * Scalar representations are hardware-driven and not scalable.
736     */
737    @Override
738    public final boolean isExpandable()
739    {
740        return false;
741    }
742
743    @Override
744    public final boolean isIdentifierIgnorable()
745    {
746        // This is assumed not to be frequently called; instead of impacting the
747        // start-up time of each Constant, we will perform this test upon demand
748        //
749        switch (this.getPrecision()) {
750        case NULL:
751        case BIT:
752        case BYTE:
753        case SHORT:
754        case CHARACTER:
755        case UNKNOWN:
756            return Character.isIdentifierIgnorable(this.charValue());
757        }
758        return Character.isIdentifierIgnorable(this.intValue());
759    }
760
761    @Override
762    public final boolean isISOControl()
763    {
764        // This is assumed not to be frequently called; instead of impacting the
765        // start-up time of each Constant, we will perform this test upon demand
766        //
767        switch (this.getPrecision()) {
768        case NULL:
769        case BIT:
770        case BYTE:
771        case SHORT:
772        case CHARACTER:
773        case UNKNOWN:
774            return Character.isISOControl(this.charValue());
775        }
776        return Character.isISOControl(this.intValue());
777    }
778
779    @Override
780    public final boolean isJavaIdentifierPart()
781    {
782        // This is assumed not to be frequently called; instead of impacting the
783        // start-up time of each Constant, we will perform this test upon demand
784        //
785        switch (this.getPrecision()) {
786        case NULL:
787        case BIT:
788        case BYTE:
789        case SHORT:
790        case CHARACTER:
791        case UNKNOWN:
792            return Character.isJavaIdentifierPart(this.charValue());
793        }
794        return Character.isJavaIdentifierPart(this.intValue());
795    }
796
797    @Override
798    public final boolean isJavaIdentifierStart()
799    {
800        // This is assumed not to be frequently called; instead of impacting the
801        // start-up time of each Constant, we will perform this test upon demand
802        //
803        switch (this.getPrecision()) {
804        case NULL:
805        case BIT:
806        case BYTE:
807        case SHORT:
808        case CHARACTER:
809        case UNKNOWN:
810            return Character.isJavaIdentifierStart(this.charValue());
811        }
812        return Character.isJavaIdentifierStart(this.intValue());
813    }
814
815    @Override
816    public final boolean isLetter()
817    {
818        // This is assumed not to be frequently called; instead of impacting the
819        // start-up time of each Constant, we will perform this test upon demand
820        //
821        switch (this.getPrecision()) {
822        case NULL:
823        case BIT:
824        case BYTE:
825        case SHORT:
826        case CHARACTER:
827        case UNKNOWN:
828            return Character.isLetter(this.charValue());
829        }
830        return Character.isLetter(this.intValue());
831    }
832
833    @Override
834    public final boolean isLetterOrDigit()
835    {
836        // This is assumed not to be frequently called; instead of impacting the
837        // start-up time of each Constant, we will perform this test upon demand
838        //
839        switch (this.getPrecision()) {
840        case NULL:
841        case BIT:
842        case BYTE:
843        case SHORT:
844        case CHARACTER:
845        case UNKNOWN:
846            return Character.isLetterOrDigit(this.charValue());
847        }
848        return Character.isLetterOrDigit(this.intValue());
849    }
850
851    @Override
852    public final boolean isLowerCase()
853    {
854        // This is assumed not to be frequently called; instead of impacting the
855        // start-up time of each Constant, we will perform this test upon demand
856        //
857        switch (this.getPrecision()) {
858        case NULL:
859        case BIT:
860        case BYTE:
861        case SHORT:
862        case CHARACTER:
863        case UNKNOWN:
864            return Character.isLowerCase(this.charValue());
865        }
866        return Character.isLowerCase(this.intValue());
867    }
868
869    @Override
870    public final boolean isMirrored()
871    {
872        // This is assumed not to be frequently called; instead of impacting the
873        // start-up time of each Constant, we will perform this test upon demand
874        //
875        switch (this.getPrecision()) {
876        case NULL:
877        case BIT:
878        case BYTE:
879        case SHORT:
880        case CHARACTER:
881        case UNKNOWN:
882            return Character.isMirrored(this.charValue());
883        }
884        return Character.isMirrored(this.intValue());
885    }
886
887    @Override
888    public final boolean isModulo()
889    {
890        return this.getDomain() == Domain.MODULO;
891    }
892
893    @Override
894    public final boolean isReal()
895    {
896        switch (this.getDomain()) {
897        case REAL:
898        case MODULO:
899            return true;
900        }
901        return false;
902    }
903
904    /**
905     * Scalar representations are hardware-driven and not scalable.
906     */
907    @Override
908    public final boolean isReducible()
909    {
910        return false;
911    }
912
913    @Override
914    public boolean isText()
915    {
916        return this.getDomain() == Domain.TEXT;
917    }
918
919    @Override
920    public final boolean isTitleCase()
921    {
922        // This is assumed not to be frequently called; instead of impacting the
923        // start-up time of each Constant, we will perform this test upon demand
924        //
925        switch (this.getPrecision()) {
926        case NULL:
927        case BIT:
928        case BYTE:
929        case SHORT:
930        case CHARACTER:
931        case UNKNOWN:
932            return Character.isTitleCase(this.charValue());
933        }
934        return Character.isTitleCase(this.intValue());
935    }
936
937    @Override
938    public final int toCodePoint()
939    {
940        // This is assumed not to be frequently called; instead of impacting the
941        // start-up time of each Constant, we will perform this test upon demand
942        //
943        switch (this.getPrecision()) {
944        case UNKNOWN: {
945            switch (this.size()) {
946            case 0:
947                return 0;
948            case 1:
949                return this.charAt(0);
950            }
951            final char high = this.charAt(0);
952            if (Character.isHighSurrogate(high))
953                return Character.toCodePoint(high, this.charAt(1));
954            return high;
955        }
956        }
957        return this.intValue();
958    }
959
960    @Override
961    public final boolean isUnicode()
962    {
963        // This is assumed not to be frequently called; instead of impacting the
964        // start-up time of each Constant, we will perform this test upon demand
965        //
966        switch (this.getPrecision()) {
967        case NULL:
968        case BIT:
969        case BYTE:
970        case SHORT:
971        case CHARACTER:
972        case UNKNOWN:
973            return Character.isDefined(this.charValue());
974        }
975        return Character.isDefined(this.intValue());
976    }
977
978    @Override
979    public final boolean isUnicodeIdentifierPart()
980    {
981        // This is assumed not to be frequently called; instead of impacting the
982        // start-up time of each Constant, we will perform this test upon demand
983        //
984        switch (this.getPrecision()) {
985        case NULL:
986        case BIT:
987        case BYTE:
988        case SHORT:
989        case CHARACTER:
990        case UNKNOWN:
991            return Character.isUnicodeIdentifierPart(this.charValue());
992        }
993        return Character.isUnicodeIdentifierPart(this.intValue());
994    }
995
996    @Override
997    public final boolean isUnicodeIdentifierStart()
998    {
999        // This is assumed not to be frequently called; instead of impacting the
1000        // start-up time of each Constant, we will perform this test upon demand
1001        //
1002        switch (this.getPrecision()) {
1003        case NULL:
1004        case BIT:
1005        case BYTE:
1006        case SHORT:
1007        case CHARACTER:
1008        case UNKNOWN:
1009            return Character.isUnicodeIdentifierStart(this.charValue());
1010        }
1011        return Character.isUnicodeIdentifierStart(this.intValue());
1012    }
1013
1014    @Override
1015    public final boolean isUpperCase()
1016    {
1017        // This is assumed not to be frequently called; instead of impacting the
1018        // start-up time of each Constant, we will perform this test upon demand
1019        //
1020        switch (this.getPrecision()) {
1021        case NULL:
1022        case BIT:
1023        case BYTE:
1024        case SHORT:
1025        case CHARACTER:
1026        case UNKNOWN:
1027            return Character.isUpperCase(this.charValue());
1028        }
1029        return Character.isUpperCase(this.intValue());
1030    }
1031
1032    @Override
1033    public final boolean isWhitespace()
1034    {
1035        // This is assumed not to be frequently called; instead of impacting the
1036        // start-up time of each Constant, we will perform this test upon demand
1037        //
1038        switch (this.getPrecision()) {
1039        case NULL:
1040        case BIT:
1041        case BYTE:
1042        case SHORT:
1043        case CHARACTER:
1044        case UNKNOWN:
1045            return Character.isWhitespace(this.charValue());
1046        }
1047        return Character.isWhitespace(this.intValue());
1048    }
1049
1050    @Override
1051    public final long longPostDecrement()
1052        throws UnsupportedOperationException,
1053            ArithmeticException,
1054            IllegalArgumentException
1055    {
1056        throw new UnsupportedOperationException();
1057    }
1058
1059    @Override
1060    public final long longPostIncrement()
1061        throws UnsupportedOperationException,
1062            ArithmeticException,
1063            IllegalArgumentException
1064    {
1065        throw new UnsupportedOperationException();
1066    }
1067
1068    @Override
1069    public final PRIMITIVE lowerCase()
1070    {
1071        throw new UnsupportedOperationException();
1072    }
1073
1074    @Override
1075    public final PRIMITIVE negate()
1076        throws UnsupportedOperationException,
1077            ArithmeticException,
1078            IllegalArgumentException
1079    {
1080        throw new UnsupportedOperationException();
1081    }
1082
1083    @Override
1084    public final PRIMITIVE not()
1085        throws UnsupportedOperationException,
1086            IllegalArgumentException,
1087            ArithmeticException
1088    {
1089        throw new UnsupportedOperationException();
1090    }
1091
1092    @Override
1093    public final PRIMITIVE replace(
1094        final CharSequence target,
1095        final CharSequence replacement )
1096    {
1097        throw new UnsupportedOperationException();
1098    }
1099
1100    @Override
1101    public final PRIMITIVE replace(
1102        final int start,
1103        final int end,
1104        final String str ) throws UnsupportedOperationException
1105    {
1106        throw new UnsupportedOperationException();
1107    }
1108
1109    @Override
1110    public final PRIMITIVE replaceAll(
1111        final String regex,
1112        final String replacement )
1113    {
1114        throw new UnsupportedOperationException();
1115    }
1116
1117    @Override
1118    public final PRIMITIVE replaceCharacter(
1119        final char oldChar,
1120        final char newChar )
1121    {
1122        throw new UnsupportedOperationException();
1123    }
1124
1125    @Override
1126    public final PRIMITIVE replaceFirst(
1127        final String regex,
1128        final String replacement )
1129    {
1130        throw new UnsupportedOperationException();
1131    }
1132
1133    @Override
1134    public final PRIMITIVE reverse() throws UnsupportedOperationException
1135    {
1136        throw new UnsupportedOperationException();
1137    }
1138
1139    @Override
1140    public final PRIMITIVE round( final RoundingStrategy aRoundingStrategy )
1141        throws UnsupportedOperationException,
1142            IllegalArgumentException,
1143            ArithmeticException,
1144            NullPointerException
1145    {
1146        throw new UnsupportedOperationException();
1147    }
1148
1149    @Override
1150    public PRIMITIVE setCharAt( final int index, final char ch )
1151        throws UnsupportedOperationException
1152    {
1153        throw new UnsupportedOperationException();
1154    }
1155
1156    @Override
1157    public final <E extends Enum<E>> PRIMITIVE setEnumeration( final E aValue )
1158        throws UnsupportedOperationException,
1159            ArithmeticException,
1160            IllegalArgumentException,
1161            NullPointerException
1162    {
1163        throw new UnsupportedOperationException();
1164    }
1165
1166    @Override
1167    public final PRIMITIVE setLength( final int newLength )
1168        throws UnsupportedOperationException
1169    {
1170        throw new UnsupportedOperationException();
1171    }
1172
1173    @Override
1174    public final PRIMITIVE setMaximum()
1175        throws UnsupportedOperationException,
1176            ArithmeticException,
1177            IllegalArgumentException
1178    {
1179        throw new UnsupportedOperationException();
1180    }
1181
1182    @Override
1183    public final PRIMITIVE setMinimum()
1184        throws UnsupportedOperationException,
1185            ArithmeticException,
1186            IllegalArgumentException
1187    {
1188        throw new UnsupportedOperationException();
1189    }
1190
1191    @Override
1192    public final PRIMITIVE setNegativeInfinity()
1193        throws UnsupportedOperationException,
1194            ArithmeticException,
1195            IllegalArgumentException
1196    {
1197        throw new UnsupportedOperationException();
1198    }
1199
1200    @Override
1201    public final PRIMITIVE setPositiveInfinity()
1202        throws UnsupportedOperationException,
1203            IllegalArgumentException,
1204            ArithmeticException
1205    {
1206        throw new UnsupportedOperationException();
1207    }
1208
1209    @Override
1210    public final PRIMITIVE setReal( final BigDecimal aValue )
1211        throws UnsupportedOperationException,
1212            IllegalArgumentException,
1213            ArithmeticException,
1214            NullPointerException
1215    {
1216        throw new UnsupportedOperationException();
1217    }
1218
1219    @Override
1220    public final PRIMITIVE setReal( final BigInteger aValue )
1221        throws UnsupportedOperationException,
1222            IllegalArgumentException,
1223            ArithmeticException,
1224            NullPointerException
1225    {
1226        throw new UnsupportedOperationException();
1227    }
1228
1229    @Override
1230    public final PRIMITIVE setScalar( final boolean aValue )
1231        throws UnsupportedOperationException,
1232            IllegalArgumentException,
1233            ArithmeticException
1234    {
1235        throw new UnsupportedOperationException();
1236    }
1237
1238    @Override
1239    public final PRIMITIVE setScalar( final byte aValue )
1240        throws UnsupportedOperationException,
1241            IllegalArgumentException,
1242            ArithmeticException
1243    {
1244        throw new UnsupportedOperationException();
1245    }
1246
1247    @Override
1248    public final PRIMITIVE setScalar( final char aValue )
1249        throws UnsupportedOperationException,
1250            IllegalArgumentException,
1251            ArithmeticException
1252    {
1253        throw new UnsupportedOperationException();
1254    }
1255
1256    @Override
1257    public final PRIMITIVE setScalar( final double aValue )
1258        throws UnsupportedOperationException,
1259            IllegalArgumentException,
1260            ArithmeticException
1261    {
1262        throw new UnsupportedOperationException();
1263    }
1264
1265    @Override
1266    public final PRIMITIVE setScalar( final float aValue )
1267        throws UnsupportedOperationException,
1268            IllegalArgumentException,
1269            ArithmeticException
1270    {
1271        throw new UnsupportedOperationException();
1272    }
1273
1274    @Override
1275    public final PRIMITIVE setScalar( final int aValue )
1276        throws UnsupportedOperationException,
1277            IllegalArgumentException,
1278            ArithmeticException
1279    {
1280        throw new UnsupportedOperationException();
1281    }
1282
1283    @Override
1284    public final PRIMITIVE setScalar( final long aValue )
1285        throws UnsupportedOperationException,
1286            IllegalArgumentException,
1287            ArithmeticException
1288    {
1289        throw new UnsupportedOperationException();
1290    }
1291
1292    @Override
1293    public final PRIMITIVE setScalar( final short aValue )
1294        throws UnsupportedOperationException,
1295            IllegalArgumentException,
1296            ArithmeticException
1297    {
1298        throw new UnsupportedOperationException();
1299    }
1300
1301    @Override
1302    public final PRIMITIVE setText( final CharSequence content )
1303        throws UnsupportedOperationException,
1304            IllegalArgumentException,
1305            NullPointerException
1306    {
1307        throw new UnsupportedOperationException();
1308    }
1309
1310    @Override
1311    public final PRIMITIVE shiftLeft( final int count )
1312        throws UnsupportedOperationException,
1313            IllegalArgumentException,
1314            ArithmeticException
1315    {
1316        throw new UnsupportedOperationException();
1317    }
1318
1319    @Override
1320    public final PRIMITIVE shiftRight( final int count )
1321        throws UnsupportedOperationException,
1322            IllegalArgumentException,
1323            ArithmeticException
1324    {
1325        throw new UnsupportedOperationException();
1326    }
1327
1328    @Override
1329    public final PRIMITIVE shiftRightExtendZero( final int count )
1330        throws UnsupportedOperationException,
1331            IllegalArgumentException,
1332            ArithmeticException
1333    {
1334        throw new UnsupportedOperationException();
1335    }
1336
1337    @Override
1338    public final short shortPostDecrement()
1339        throws UnsupportedOperationException,
1340            ArithmeticException,
1341            IllegalArgumentException
1342    {
1343        throw new UnsupportedOperationException();
1344    }
1345
1346    @Override
1347    public final short shortPostIncrement()
1348        throws UnsupportedOperationException,
1349            ArithmeticException,
1350            IllegalArgumentException
1351    {
1352        throw new UnsupportedOperationException();
1353    }
1354
1355    @Override
1356    public final PRIMITIVE square()
1357        throws UnsupportedOperationException,
1358            IllegalArgumentException,
1359            ArithmeticException
1360    {
1361        throw new UnsupportedOperationException();
1362    }
1363
1364    @Override
1365    public final PRIMITIVE swapPrimitives( final Primitive<?> aPrimitive )
1366    {
1367        throw new UnsupportedOperationException();
1368    }
1369
1370    @Override
1371    public final String textPostDecrement()
1372        throws UnsupportedOperationException,
1373            ArithmeticException,
1374            IllegalArgumentException
1375    {
1376        throw new UnsupportedOperationException();
1377    }
1378
1379    @Override
1380    public final String textPostIncrement()
1381        throws UnsupportedOperationException,
1382            ArithmeticException,
1383            IllegalArgumentException
1384    {
1385        throw new UnsupportedOperationException();
1386    }
1387
1388    @Override
1389    public final PRIMITIVE titleCase()
1390    {
1391        throw new UnsupportedOperationException();
1392    }
1393
1394    @Override
1395    public final PRIMITIVE trim()
1396    {
1397        throw new UnsupportedOperationException();
1398    }
1399
1400    @Override
1401    public final BigDecimal unlimitedDecimalPostDecrement()
1402        throws UnsupportedOperationException,
1403            ArithmeticException,
1404            IllegalArgumentException
1405    {
1406        throw new UnsupportedOperationException();
1407    }
1408
1409    @Override
1410    public final BigDecimal unlimitedDecimalPostIncrement()
1411        throws UnsupportedOperationException,
1412            ArithmeticException,
1413            IllegalArgumentException
1414    {
1415        throw new UnsupportedOperationException();
1416    }
1417
1418    @Override
1419    public final BigInteger unlimitedIntegerPostDecrement()
1420        throws UnsupportedOperationException,
1421            ArithmeticException,
1422            IllegalArgumentException
1423    {
1424        throw new UnsupportedOperationException();
1425    }
1426
1427    @Override
1428    public final BigInteger unlimitedIntegerPostIncrement()
1429        throws UnsupportedOperationException,
1430            ArithmeticException,
1431            IllegalArgumentException
1432    {
1433        throw new UnsupportedOperationException();
1434    }
1435
1436    @Override
1437    public final PRIMITIVE upperCase()
1438    {
1439        throw new UnsupportedOperationException();
1440    }
1441}