1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
package Torello.Browser;

import java.util.*;
import javax.json.*;
import javax.json.stream.*;
import java.io.*;

import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import java.util.function.Function;

import Torello.Java.Additional.*;
import Torello.Java.JSON.*;

import static Torello.Java.JSON.JFlag.*;

import Torello.Java.StrCmpr;
import Torello.JavaDoc.StaticFunctional;
import Torello.JavaDoc.JDHeaderBackgroundImg;
import Torello.JavaDoc.Excuse;

/**
 * <SPAN CLASS=COPIEDJDK><B>The SystemInfo domain defines methods and events for querying low-level system information.</B></SPAN>
 * 
 * <EMBED CLASS='external-html' DATA-FILE-ID=CODE_GEN_NOTE>
 */
@StaticFunctional(Excused={"counter"}, Excuses={Excuse.CONFIGURATION})
@JDHeaderBackgroundImg(EmbedTagFileID="WOOD_PLANK_NOTE")
public class SystemInfo
{
    // ********************************************************************************************
    // ********************************************************************************************
    // Class Header Stuff
    // ********************************************************************************************
    // ********************************************************************************************


    // No Pubic Constructors
    private SystemInfo () { }

    // These two Vector's are used by all the "Methods" exported by this class.  java.lang.reflect
    // is used to generate the JSON String's.  It saves thousands of lines of Auto-Generated Code.
    private static final Map<String, Vector<String>>    parameterNames = new HashMap<>();
    private static final Map<String, Vector<Class<?>>>  parameterTypes = new HashMap<>();

    // Some Methods do not take any parameters - for instance all the "enable()" and "disable()"
    // I simply could not get ride of RAW-TYPES and UNCHECKED warnings... so there are now,
    // offically, two empty-vectors.  One for String's, and the other for Classes.

    private static final Vector<String>     EMPTY_VEC_STR = new Vector<>();
    private static final Vector<Class<?>>   EMPTY_VEC_CLASS = new Vector<>();

    static
    {
        for (Method m : SystemInfo.class.getMethods())
        {
            // This doesn't work!  The parameter names are all "arg0" ... "argN"
            // It works for java.lang.reflect.Field, BUT NOT java.lang.reflect.Parameter!
            //
            // Vector<String> parameterNamesList = new Vector<>(); -- NOPE!

            Vector<Class<?>> parameterTypesList = new Vector<>();
        
            for (Parameter p : m.getParameters()) parameterTypesList.add(p.getType());

            parameterTypes.put(
                m.getName(),
                (parameterTypesList.size() > 0) ? parameterTypesList : EMPTY_VEC_CLASS
            );
        }
    }

    static
    {
        Vector<String> v = null;

        parameterNames.put("getInfo", EMPTY_VEC_STR);

        parameterNames.put("getProcessInfo", EMPTY_VEC_STR);
    }


    // ********************************************************************************************
    // ********************************************************************************************
    // Types - Static Inner Classes
    // ********************************************************************************************
    // ********************************************************************************************

    /** YUV subsampling type of the pixels of a given image. */
    public static final String[] SubsamplingFormat =
    { "yuv420", "yuv422", "yuv444", };
    
    /** Image format of a given image. */
    public static final String[] ImageType =
    { "jpeg", "webp", "unknown", };
    
    /** Describes a single graphics processor (GPU). */
    public static class GPUDevice
        extends BaseType
        implements java.io.Serializable
    {
        /** For Object Serialization.  java.io.Serializable */
        protected static final long serialVersionUID = 1;
        
        public boolean[] optionals()
        { return new boolean[] { false, false, true, true, false, false, false, false, }; }
        
        /** PCI ID of the GPU vendor, if available; 0 otherwise. */
        public final Number vendorId;
        
        /** PCI ID of the GPU device, if available; 0 otherwise. */
        public final Number deviceId;
        
        /**
         * Sub sys ID of the GPU, only available on Windows.
         * <BR />
         * <BR /><B>OPTIONAL</B>
         */
        public final Number subSysId;
        
        /**
         * Revision of the GPU, only available on Windows.
         * <BR />
         * <BR /><B>OPTIONAL</B>
         */
        public final Number revision;
        
        /** String description of the GPU vendor, if the PCI ID is not available. */
        public final String vendorString;
        
        /** String description of the GPU device, if the PCI ID is not available. */
        public final String deviceString;
        
        /** String description of the GPU driver vendor. */
        public final String driverVendor;
        
        /** String description of the GPU driver version. */
        public final String driverVersion;
        
        /**
         * Constructor
         *
         * @param vendorId PCI ID of the GPU vendor, if available; 0 otherwise.
         * 
         * @param deviceId PCI ID of the GPU device, if available; 0 otherwise.
         * 
         * @param subSysId Sub sys ID of the GPU, only available on Windows.
         * <BR /><B>OPTIONAL</B>
         * 
         * @param revision Revision of the GPU, only available on Windows.
         * <BR /><B>OPTIONAL</B>
         * 
         * @param vendorString String description of the GPU vendor, if the PCI ID is not available.
         * 
         * @param deviceString String description of the GPU device, if the PCI ID is not available.
         * 
         * @param driverVendor String description of the GPU driver vendor.
         * 
         * @param driverVersion String description of the GPU driver version.
         */
        public GPUDevice(
                Number vendorId, Number deviceId, Number subSysId, Number revision, 
                String vendorString, String deviceString, String driverVendor, String driverVersion
            )
        {
            // Exception-Check(s) to ensure that if any parameters which are not declared as
            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
            
            if (vendorId == null)      BRDPC.throwNPE("vendorId");
            if (deviceId == null)      BRDPC.throwNPE("deviceId");
            if (vendorString == null)  BRDPC.throwNPE("vendorString");
            if (deviceString == null)  BRDPC.throwNPE("deviceString");
            if (driverVendor == null)  BRDPC.throwNPE("driverVendor");
            if (driverVersion == null) BRDPC.throwNPE("driverVersion");
            
            this.vendorId       = vendorId;
            this.deviceId       = deviceId;
            this.subSysId       = subSysId;
            this.revision       = revision;
            this.vendorString   = vendorString;
            this.deviceString   = deviceString;
            this.driverVendor   = driverVendor;
            this.driverVersion  = driverVersion;
        }
        
        /**
         * JSON Object Constructor
         * @param jo A Json-Object having data about an instance of {@code 'GPUDevice'}.
         */
        public GPUDevice (JsonObject jo)
        {
            this.vendorId       = ReadNumberJSON.get(jo, "vendorId", false, true);
            this.deviceId       = ReadNumberJSON.get(jo, "deviceId", false, true);
            this.subSysId       = ReadNumberJSON.get(jo, "subSysId", true, false);
            this.revision       = ReadNumberJSON.get(jo, "revision", true, false);
            this.vendorString   = ReadJSON.getString(jo, "vendorString", false, true);
            this.deviceString   = ReadJSON.getString(jo, "deviceString", false, true);
            this.driverVendor   = ReadJSON.getString(jo, "driverVendor", false, true);
            this.driverVersion  = ReadJSON.getString(jo, "driverVersion", false, true);
        }
        
        
        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
        public boolean equals(Object other)
        {
            if (other == null)                       return false;
            if (other.getClass() != this.getClass()) return false;
        
            GPUDevice o = (GPUDevice) other;
        
            return
                    Objects.equals(this.vendorId, o.vendorId)
                &&  Objects.equals(this.deviceId, o.deviceId)
                &&  Objects.equals(this.subSysId, o.subSysId)
                &&  Objects.equals(this.revision, o.revision)
                &&  Objects.equals(this.vendorString, o.vendorString)
                &&  Objects.equals(this.deviceString, o.deviceString)
                &&  Objects.equals(this.driverVendor, o.driverVendor)
                &&  Objects.equals(this.driverVersion, o.driverVersion);
        }
        
        /** Generates a Hash-Code for {@code 'this'} instance */
        public int hashCode()
        {
            return
                    Objects.hashCode(this.vendorId)
                +   Objects.hashCode(this.deviceId)
                +   Objects.hashCode(this.subSysId)
                +   Objects.hashCode(this.revision)
                +   Objects.hashCode(this.vendorString)
                +   Objects.hashCode(this.deviceString)
                +   Objects.hashCode(this.driverVendor)
                +   Objects.hashCode(this.driverVersion);
        }
    }
    
    /** Describes the width and height dimensions of an entity. */
    public static class Size
        extends BaseType
        implements java.io.Serializable
    {
        /** For Object Serialization.  java.io.Serializable */
        protected static final long serialVersionUID = 1;
        
        public boolean[] optionals()
        { return new boolean[] { false, false, }; }
        
        /** Width in pixels. */
        public final int width;
        
        /** Height in pixels. */
        public final int height;
        
        /**
         * Constructor
         *
         * @param width Width in pixels.
         * 
         * @param height Height in pixels.
         */
        public Size(int width, int height)
        {
            this.width   = width;
            this.height  = height;
        }
        
        /**
         * JSON Object Constructor
         * @param jo A Json-Object having data about an instance of {@code 'Size'}.
         */
        public Size (JsonObject jo)
        {
            this.width   = ReadPrimJSON.getInt(jo, "width");
            this.height  = ReadPrimJSON.getInt(jo, "height");
        }
        
        
        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
        public boolean equals(Object other)
        {
            if (other == null)                       return false;
            if (other.getClass() != this.getClass()) return false;
        
            Size o = (Size) other;
        
            return
                    (this.width == o.width)
                &&  (this.height == o.height);
        }
        
        /** Generates a Hash-Code for {@code 'this'} instance */
        public int hashCode()
        {
            return
                    this.width
                +   this.height;
        }
    }
    
    /**
     * Describes a supported video decoding profile with its associated minimum and
     * maximum resolutions.
     */
    public static class VideoDecodeAcceleratorCapability
        extends BaseType
        implements java.io.Serializable
    {
        /** For Object Serialization.  java.io.Serializable */
        protected static final long serialVersionUID = 1;
        
        public boolean[] optionals()
        { return new boolean[] { false, false, false, }; }
        
        /** Video codec profile that is supported, e.g. VP9 Profile 2. */
        public final String profile;
        
        /** Maximum video dimensions in pixels supported for this |profile|. */
        public final SystemInfo.Size maxResolution;
        
        /** Minimum video dimensions in pixels supported for this |profile|. */
        public final SystemInfo.Size minResolution;
        
        /**
         * Constructor
         *
         * @param profile Video codec profile that is supported, e.g. VP9 Profile 2.
         * 
         * @param maxResolution Maximum video dimensions in pixels supported for this |profile|.
         * 
         * @param minResolution Minimum video dimensions in pixels supported for this |profile|.
         */
        public VideoDecodeAcceleratorCapability
            (String profile, SystemInfo.Size maxResolution, SystemInfo.Size minResolution)
        {
            // Exception-Check(s) to ensure that if any parameters which are not declared as
            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
            
            if (profile == null)       BRDPC.throwNPE("profile");
            if (maxResolution == null) BRDPC.throwNPE("maxResolution");
            if (minResolution == null) BRDPC.throwNPE("minResolution");
            
            this.profile        = profile;
            this.maxResolution  = maxResolution;
            this.minResolution  = minResolution;
        }
        
        /**
         * JSON Object Constructor
         * @param jo A Json-Object having data about an instance of {@code 'VideoDecodeAcceleratorCapability'}.
         */
        public VideoDecodeAcceleratorCapability (JsonObject jo)
        {
            this.profile        = ReadJSON.getString(jo, "profile", false, true);
            this.maxResolution  = ReadJSON.getObject(jo, "maxResolution", SystemInfo.Size.class, false, true);
            this.minResolution  = ReadJSON.getObject(jo, "minResolution", SystemInfo.Size.class, false, true);
        }
        
        
        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
        public boolean equals(Object other)
        {
            if (other == null)                       return false;
            if (other.getClass() != this.getClass()) return false;
        
            VideoDecodeAcceleratorCapability o = (VideoDecodeAcceleratorCapability) other;
        
            return
                    Objects.equals(this.profile, o.profile)
                &&  Objects.equals(this.maxResolution, o.maxResolution)
                &&  Objects.equals(this.minResolution, o.minResolution);
        }
        
        /** Generates a Hash-Code for {@code 'this'} instance */
        public int hashCode()
        {
            return
                    Objects.hashCode(this.profile)
                +   this.maxResolution.hashCode()
                +   this.minResolution.hashCode();
        }
    }
    
    /**
     * Describes a supported video encoding profile with its associated maximum
     * resolution and maximum framerate.
     */
    public static class VideoEncodeAcceleratorCapability
        extends BaseType
        implements java.io.Serializable
    {
        /** For Object Serialization.  java.io.Serializable */
        protected static final long serialVersionUID = 1;
        
        public boolean[] optionals()
        { return new boolean[] { false, false, false, false, }; }
        
        /** Video codec profile that is supported, e.g H264 Main. */
        public final String profile;
        
        /** Maximum video dimensions in pixels supported for this |profile|. */
        public final SystemInfo.Size maxResolution;
        
        /**
         * Maximum encoding framerate in frames per second supported for this
         * |profile|, as fraction's numerator and denominator, e.g. 24/1 fps,
         * 24000/1001 fps, etc.
         */
        public final int maxFramerateNumerator;
        
        /** <CODE>[No Description Provided by Google]</CODE> */
        public final int maxFramerateDenominator;
        
        /**
         * Constructor
         *
         * @param profile Video codec profile that is supported, e.g H264 Main.
         * 
         * @param maxResolution Maximum video dimensions in pixels supported for this |profile|.
         * 
         * @param maxFramerateNumerator 
         * Maximum encoding framerate in frames per second supported for this
         * |profile|, as fraction's numerator and denominator, e.g. 24/1 fps,
         * 24000/1001 fps, etc.
         * 
         * @param maxFramerateDenominator -
         */
        public VideoEncodeAcceleratorCapability(
                String profile, SystemInfo.Size maxResolution, int maxFramerateNumerator, 
                int maxFramerateDenominator
            )
        {
            // Exception-Check(s) to ensure that if any parameters which are not declared as
            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
            
            if (profile == null)       BRDPC.throwNPE("profile");
            if (maxResolution == null) BRDPC.throwNPE("maxResolution");
            
            this.profile                  = profile;
            this.maxResolution            = maxResolution;
            this.maxFramerateNumerator    = maxFramerateNumerator;
            this.maxFramerateDenominator  = maxFramerateDenominator;
        }
        
        /**
         * JSON Object Constructor
         * @param jo A Json-Object having data about an instance of {@code 'VideoEncodeAcceleratorCapability'}.
         */
        public VideoEncodeAcceleratorCapability (JsonObject jo)
        {
            this.profile                  = ReadJSON.getString(jo, "profile", false, true);
            this.maxResolution            = ReadJSON.getObject(jo, "maxResolution", SystemInfo.Size.class, false, true);
            this.maxFramerateNumerator    = ReadPrimJSON.getInt(jo, "maxFramerateNumerator");
            this.maxFramerateDenominator  = ReadPrimJSON.getInt(jo, "maxFramerateDenominator");
        }
        
        
        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
        public boolean equals(Object other)
        {
            if (other == null)                       return false;
            if (other.getClass() != this.getClass()) return false;
        
            VideoEncodeAcceleratorCapability o = (VideoEncodeAcceleratorCapability) other;
        
            return
                    Objects.equals(this.profile, o.profile)
                &&  Objects.equals(this.maxResolution, o.maxResolution)
                &&  (this.maxFramerateNumerator == o.maxFramerateNumerator)
                &&  (this.maxFramerateDenominator == o.maxFramerateDenominator);
        }
        
        /** Generates a Hash-Code for {@code 'this'} instance */
        public int hashCode()
        {
            return
                    Objects.hashCode(this.profile)
                +   this.maxResolution.hashCode()
                +   this.maxFramerateNumerator
                +   this.maxFramerateDenominator;
        }
    }
    
    /**
     * Describes a supported image decoding profile with its associated minimum and
     * maximum resolutions and subsampling.
     */
    public static class ImageDecodeAcceleratorCapability
        extends BaseType
        implements java.io.Serializable
    {
        /** For Object Serialization.  java.io.Serializable */
        protected static final long serialVersionUID = 1;
        
        public boolean[] optionals()
        { return new boolean[] { false, false, false, false, }; }
        
        /** Image coded, e.g. Jpeg. */
        public final String imageType;
        
        /** Maximum supported dimensions of the image in pixels. */
        public final SystemInfo.Size maxDimensions;
        
        /** Minimum supported dimensions of the image in pixels. */
        public final SystemInfo.Size minDimensions;
        
        /** Optional array of supported subsampling formats, e.g. 4:2:0, if known. */
        public final String[] subsamplings;
        
        /**
         * Constructor
         *
         * @param imageType Image coded, e.g. Jpeg.
         * 
         * @param maxDimensions Maximum supported dimensions of the image in pixels.
         * 
         * @param minDimensions Minimum supported dimensions of the image in pixels.
         * 
         * @param subsamplings Optional array of supported subsampling formats, e.g. 4:2:0, if known.
         */
        public ImageDecodeAcceleratorCapability(
                String imageType, SystemInfo.Size maxDimensions, SystemInfo.Size minDimensions, 
                String[] subsamplings
            )
        {
            // Exception-Check(s) to ensure that if any parameters which are not declared as
            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
            
            if (imageType == null)     BRDPC.throwNPE("imageType");
            if (maxDimensions == null) BRDPC.throwNPE("maxDimensions");
            if (minDimensions == null) BRDPC.throwNPE("minDimensions");
            if (subsamplings == null)  BRDPC.throwNPE("subsamplings");
            
            // Exception-Check(s) to ensure that if any parameters which must adhere to a
            // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
            
            BRDPC.checkIAE("imageType", imageType, "SystemInfo.ImageType", SystemInfo.ImageType);
            
            this.imageType      = imageType;
            this.maxDimensions  = maxDimensions;
            this.minDimensions  = minDimensions;
            this.subsamplings   = subsamplings;
        }
        
        /**
         * JSON Object Constructor
         * @param jo A Json-Object having data about an instance of {@code 'ImageDecodeAcceleratorCapability'}.
         */
        public ImageDecodeAcceleratorCapability (JsonObject jo)
        {
            this.imageType      = ReadJSON.getString(jo, "imageType", false, true);
            this.maxDimensions  = ReadJSON.getObject(jo, "maxDimensions", SystemInfo.Size.class, false, true);
            this.minDimensions  = ReadJSON.getObject(jo, "minDimensions", SystemInfo.Size.class, false, true);
            this.subsamplings = (jo.getJsonArray("subsamplings") == null)
                ? null
                : ReadArrJSON.DimN.strArr(jo.getJsonArray("subsamplings"), null, 0, String[].class);
        
        }
        
        
        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
        public boolean equals(Object other)
        {
            if (other == null)                       return false;
            if (other.getClass() != this.getClass()) return false;
        
            ImageDecodeAcceleratorCapability o = (ImageDecodeAcceleratorCapability) other;
        
            return
                    Objects.equals(this.imageType, o.imageType)
                &&  Objects.equals(this.maxDimensions, o.maxDimensions)
                &&  Objects.equals(this.minDimensions, o.minDimensions)
                &&  Arrays.deepEquals(this.subsamplings, o.subsamplings);
        }
        
        /** Generates a Hash-Code for {@code 'this'} instance */
        public int hashCode()
        {
            return
                    Objects.hashCode(this.imageType)
                +   this.maxDimensions.hashCode()
                +   this.minDimensions.hashCode()
                +   Arrays.deepHashCode(this.subsamplings);
        }
    }
    
    /** Provides information about the GPU(s) on the system. */
    public static class GPUInfo
        extends BaseType
        implements java.io.Serializable
    {
        /** For Object Serialization.  java.io.Serializable */
        protected static final long serialVersionUID = 1;
        
        public boolean[] optionals()
        { return new boolean[] { false, true, true, false, false, false, false, }; }
        
        /** The graphics devices on the system. Element 0 is the primary GPU. */
        public final SystemInfo.GPUDevice[] devices;
        
        /**
         * An optional dictionary of additional GPU related attributes.
         * <BR />
         * <BR /><B>OPTIONAL</B>
         */
        public final JsonObject auxAttributes;
        
        /**
         * An optional dictionary of graphics features and their status.
         * <BR />
         * <BR /><B>OPTIONAL</B>
         */
        public final JsonObject featureStatus;
        
        /** An optional array of GPU driver bug workarounds. */
        public final String[] driverBugWorkarounds;
        
        /** Supported accelerated video decoding capabilities. */
        public final SystemInfo.VideoDecodeAcceleratorCapability[] videoDecoding;
        
        /** Supported accelerated video encoding capabilities. */
        public final SystemInfo.VideoEncodeAcceleratorCapability[] videoEncoding;
        
        /** Supported accelerated image decoding capabilities. */
        public final SystemInfo.ImageDecodeAcceleratorCapability[] imageDecoding;
        
        /**
         * Constructor
         *
         * @param devices The graphics devices on the system. Element 0 is the primary GPU.
         * 
         * @param auxAttributes An optional dictionary of additional GPU related attributes.
         * <BR /><B>OPTIONAL</B>
         * 
         * @param featureStatus An optional dictionary of graphics features and their status.
         * <BR /><B>OPTIONAL</B>
         * 
         * @param driverBugWorkarounds An optional array of GPU driver bug workarounds.
         * 
         * @param videoDecoding Supported accelerated video decoding capabilities.
         * 
         * @param videoEncoding Supported accelerated video encoding capabilities.
         * 
         * @param imageDecoding Supported accelerated image decoding capabilities.
         */
        public GPUInfo(
                SystemInfo.GPUDevice[] devices, JsonObject auxAttributes, JsonObject featureStatus, 
                String[] driverBugWorkarounds, 
                SystemInfo.VideoDecodeAcceleratorCapability[] videoDecoding, 
                SystemInfo.VideoEncodeAcceleratorCapability[] videoEncoding, 
                SystemInfo.ImageDecodeAcceleratorCapability[] imageDecoding
            )
        {
            // Exception-Check(s) to ensure that if any parameters which are not declared as
            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
            
            if (devices == null)              BRDPC.throwNPE("devices");
            if (driverBugWorkarounds == null) BRDPC.throwNPE("driverBugWorkarounds");
            if (videoDecoding == null)        BRDPC.throwNPE("videoDecoding");
            if (videoEncoding == null)        BRDPC.throwNPE("videoEncoding");
            if (imageDecoding == null)        BRDPC.throwNPE("imageDecoding");
            
            this.devices               = devices;
            this.auxAttributes         = auxAttributes;
            this.featureStatus         = featureStatus;
            this.driverBugWorkarounds  = driverBugWorkarounds;
            this.videoDecoding         = videoDecoding;
            this.videoEncoding         = videoEncoding;
            this.imageDecoding         = imageDecoding;
        }
        
        /**
         * JSON Object Constructor
         * @param jo A Json-Object having data about an instance of {@code 'GPUInfo'}.
         */
        public GPUInfo (JsonObject jo)
        {
            this.devices = (jo.getJsonArray("devices") == null)
                ? null
                : ReadArrJSON.DimN.objArr(jo.getJsonArray("devices"), null, 0, SystemInfo.GPUDevice[].class);
        
            this.auxAttributes         = jo.getJsonObject("auxAttributes");
            this.featureStatus         = jo.getJsonObject("featureStatus");
            this.driverBugWorkarounds = (jo.getJsonArray("driverBugWorkarounds") == null)
                ? null
                : ReadArrJSON.DimN.strArr(jo.getJsonArray("driverBugWorkarounds"), null, 0, String[].class);
        
            this.videoDecoding = (jo.getJsonArray("videoDecoding") == null)
                ? null
                : ReadArrJSON.DimN.objArr(jo.getJsonArray("videoDecoding"), null, 0, SystemInfo.VideoDecodeAcceleratorCapability[].class);
        
            this.videoEncoding = (jo.getJsonArray("videoEncoding") == null)
                ? null
                : ReadArrJSON.DimN.objArr(jo.getJsonArray("videoEncoding"), null, 0, SystemInfo.VideoEncodeAcceleratorCapability[].class);
        
            this.imageDecoding = (jo.getJsonArray("imageDecoding") == null)
                ? null
                : ReadArrJSON.DimN.objArr(jo.getJsonArray("imageDecoding"), null, 0, SystemInfo.ImageDecodeAcceleratorCapability[].class);
        
        }
        
        
        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
        public boolean equals(Object other)
        {
            if (other == null)                       return false;
            if (other.getClass() != this.getClass()) return false;
        
            GPUInfo o = (GPUInfo) other;
        
            return
                    Arrays.deepEquals(this.devices, o.devices)
                &&  Objects.equals(this.auxAttributes, o.auxAttributes)
                &&  Objects.equals(this.featureStatus, o.featureStatus)
                &&  Arrays.deepEquals(this.driverBugWorkarounds, o.driverBugWorkarounds)
                &&  Arrays.deepEquals(this.videoDecoding, o.videoDecoding)
                &&  Arrays.deepEquals(this.videoEncoding, o.videoEncoding)
                &&  Arrays.deepEquals(this.imageDecoding, o.imageDecoding);
        }
        
        /** Generates a Hash-Code for {@code 'this'} instance */
        public int hashCode()
        {
            return
                    Arrays.deepHashCode(this.devices)
                +   Objects.hashCode(this.auxAttributes)
                +   Objects.hashCode(this.featureStatus)
                +   Arrays.deepHashCode(this.driverBugWorkarounds)
                +   Arrays.deepHashCode(this.videoDecoding)
                +   Arrays.deepHashCode(this.videoEncoding)
                +   Arrays.deepHashCode(this.imageDecoding);
        }
    }
    
    /** Represents process info. */
    public static class ProcessInfo
        extends BaseType
        implements java.io.Serializable
    {
        /** For Object Serialization.  java.io.Serializable */
        protected static final long serialVersionUID = 1;
        
        public boolean[] optionals()
        { return new boolean[] { false, false, false, }; }
        
        /** Specifies process type. */
        public final String type;
        
        /** Specifies process id. */
        public final int id;
        
        /**
         * Specifies cumulative CPU usage in seconds across all threads of the
         * process since the process start.
         */
        public final Number cpuTime;
        
        /**
         * Constructor
         *
         * @param type Specifies process type.
         * 
         * @param id Specifies process id.
         * 
         * @param cpuTime 
         * Specifies cumulative CPU usage in seconds across all threads of the
         * process since the process start.
         */
        public ProcessInfo(String type, int id, Number cpuTime)
        {
            // Exception-Check(s) to ensure that if any parameters which are not declared as
            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
            
            if (type == null)    BRDPC.throwNPE("type");
            if (cpuTime == null) BRDPC.throwNPE("cpuTime");
            
            this.type     = type;
            this.id       = id;
            this.cpuTime  = cpuTime;
        }
        
        /**
         * JSON Object Constructor
         * @param jo A Json-Object having data about an instance of {@code 'ProcessInfo'}.
         */
        public ProcessInfo (JsonObject jo)
        {
            this.type     = ReadJSON.getString(jo, "type", false, true);
            this.id       = ReadPrimJSON.getInt(jo, "id");
            this.cpuTime  = ReadNumberJSON.get(jo, "cpuTime", false, true);
        }
        
        
        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
        public boolean equals(Object other)
        {
            if (other == null)                       return false;
            if (other.getClass() != this.getClass()) return false;
        
            ProcessInfo o = (ProcessInfo) other;
        
            return
                    Objects.equals(this.type, o.type)
                &&  (this.id == o.id)
                &&  Objects.equals(this.cpuTime, o.cpuTime);
        }
        
        /** Generates a Hash-Code for {@code 'this'} instance */
        public int hashCode()
        {
            return
                    Objects.hashCode(this.type)
                +   this.id
                +   Objects.hashCode(this.cpuTime);
        }
    }
    
    
    // Counter for keeping the WebSocket Request ID's distinct.
    private static int counter = 1;
    
    /**
     * Returns information about the system.
     * 
     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
     * {@link Ret4}&gt;</CODE>
     *
     * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 
     * {@link Script#exec()}), and a {@link Promise} returned.
     *
     * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B>
     * (using {@link Promise#await()}), the {@code Ret4} will subsequently
     * be returned from that call.
     * 
     * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated
     * in an instance of <B>{@link Ret4}</B>
     *
     * <BR /><BR /><UL CLASS=JDUL>
     * <LI><CODE><B>Ret4.a:</B> {@link SystemInfo.GPUInfo} (<B>gpu</B>)</CODE>
     *     <BR />Information about the GPUs on the system.
     *     <BR /><BR /></LI>
     * <LI><CODE><B>Ret4.b:</B> String (<B>modelName</B>)</CODE>
     *     <BR />A platform-dependent description of the model of the machine. On Mac OS, this is, for
     *     example, 'MacBookPro'. Will be the empty string if not supported.
     *     <BR /><BR /></LI>
     * <LI><CODE><B>Ret4.c:</B> String (<B>modelVersion</B>)</CODE>
     *     <BR />A platform-dependent description of the version of the machine. On Mac OS, this is, for
     *     example, '10.1'. Will be the empty string if not supported.
     *     <BR /><BR /></LI>
     * <LI><CODE><B>Ret4.d:</B> String (<B>commandLine</B>)</CODE>
     *     <BR />The command line string used to launch the browser. Will be the empty string if not
     *     supported.
     *     </LI>
     * </UL>
     */
    public static Script<String, JsonObject, Ret4<SystemInfo.GPUInfo, String, String, String>> getInfo()
    {
        final int          webSocketID = 38000000 + counter++;
        final boolean[]    optionals   = new boolean[0];
        
        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
        String requestJSON = WriteJSON.get(
            parameterTypes.get("getInfo"),
            parameterNames.get("getInfo"),
            optionals, webSocketID,
            "SystemInfo.getInfo"
        );
        
        // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret4'
        Function<JsonObject, Ret4<SystemInfo.GPUInfo, String, String, String>> 
            responseProcessor = (JsonObject jo) -> new Ret4<>(
                ReadJSON.getObject(jo, "gpu", SystemInfo.GPUInfo.class, false, true),
                ReadJSON.getString(jo, "modelName", false, true),
                ReadJSON.getString(jo, "modelVersion", false, true),
                ReadJSON.getString(jo, "commandLine", false, true)
            );
        
        // Pass the 'defaultSender' to Script-Constructor
        // The sender that is used can be changed before executing script.
        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
    }
    
    /**
     * Returns information about all running processes.
     * 
     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
     * {@link SystemInfo.ProcessInfo}[]&gt;</CODE>
     * 
     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
     * {@link SystemInfo.ProcessInfo}[]&gt;</CODE> will be returned.
     *
     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
      * may be retrieved.</I>
     *
     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
     * <BR /><BR /><UL CLASS=JDUL>
     * <LI><CODE>{@link SystemInfo.ProcessInfo}[] (<B>processInfo</B></CODE>)
     *     <BR />An array of process info blocks.
     * </LI>
     * </UL> */
    public static Script<String, JsonObject, SystemInfo.ProcessInfo[]> getProcessInfo()
    {
        final int          webSocketID = 38001000 + counter++;
        final boolean[]    optionals   = new boolean[0];
        
        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
        String requestJSON = WriteJSON.get(
            parameterTypes.get("getProcessInfo"),
            parameterNames.get("getProcessInfo"),
            optionals, webSocketID,
            "SystemInfo.getProcessInfo"
        );
        
        // 'JSON Binding' ... Converts Browser Response-JSON to 'SystemInfo.ProcessInfo[]'
        Function<JsonObject, SystemInfo.ProcessInfo[]> responseProcessor = (JsonObject jo) ->
            (jo.getJsonArray("processInfo") == null)
                ? null
                : ReadArrJSON.DimN.objArr(jo.getJsonArray("processInfo"), null, 0, SystemInfo.ProcessInfo[].class);
        
        // Pass the 'defaultSender' to Script-Constructor
        // The sender that is used can be changed before executing script.
        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
    }
    
}