File: PLStream.java

package info (click to toggle)
plplot 5.10.0%2Bdfsg2-0.4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 25,792 kB
  • ctags: 13,517
  • sloc: ansic: 83,001; xml: 27,081; ada: 18,878; cpp: 15,966; tcl: 11,651; python: 7,075; f90: 7,058; ml: 6,974; java: 6,665; perl: 5,029; sh: 2,208; makefile: 210; lisp: 75; sed: 25; fortran: 7
file content (1346 lines) | stat: -rw-r--r-- 41,699 bytes parent folder | download | duplicates (2)
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
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
//--------------------------------------------------------------------------
//
// Copyright (C) 2004  Andrew Ross
//
// This file is part of PLplot.
//
// PLplot is free software; you can redistribute it and/or modify
// it under the terms of the GNU Library General Public License as published
// by the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// PLplot is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public License
// along with PLplot; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
// This class provides a more object orientated wrapper to the PLplot library
// for java. It is currently very similar to the C++ plstream class.
// Each instance of the class corresponds to a plplot stream. Calling a
// method in the class will ensure the stream is correctly set before
// calling the underlying API function.
//

package plplot.core;

import java.io.*;

public class PLStream implements plplotjavacConstants {
// Class data.
    int        stream_id = -1;

    static int active_streams = 0;

// Constructor
    public PLStream()
    {
        int[] strm = new int[1];

        // If this is the first instance of the class we
        // need to load the C part of the bindings
        if ( active_streams == 0 )
        {
            openlib();
        }

        // Create stream and check it worked ok.
        plplotjavac.plmkstrm( strm );
        if ( strm[0] != -1 )
        {
            stream_id = strm[0];
            active_streams++;
        }
        else
        {
            System.err.println( "Error creating plplot stream" );
            stream_id = -1;
        }
    }

// Ensure this is the current stream
    public int set_stream()
    {
        if ( ( stream_id == -1 ) || ( active_streams == 0 ) )
        {
            System.err.println( "Error: This stream is not active" );
            return -1;
        }
        plplotjavac.plsstrm( stream_id );
        return 0;
    }

// Method to load the native C part of the java wrapper
    public void openlib()
    {
        File libname = null;

        try {
            String libdir = System.getProperty( "plplot.libdir" );
            libname = new File( libdir + File.separatorChar + plplot.core.config.libname );
            if ( !libname.exists() )
            {
                libname = null;
            }
        } catch ( Exception e ) {
        }
        if ( libname == null )
        {
            libname = new File( plplot.core.config.libdir + File.separatorChar + plplot.core.config.libname );
            if ( !libname.exists() )
            {
                libname = null;
            }
        }
        if ( libname != null )
        {
            try {
                System.load( libname.getAbsolutePath() );
            } catch ( UnsatisfiedLinkError e ) {
                System.err.println( "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e );
                System.exit( 1 );
            }
        }
        else
        {
            System.err.println( "Unable to find native code library.\n" );
            System.exit( 1 );
        }
    }

// The following are wrappers to the C API methods, or their derivatives

    public void setcontlabelformat( int lexp, int sigdig )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.pl_setcontlabelformat( lexp, sigdig );
    }

    public void setcontlabelparam( double offset, double size, double spacing, int active )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.pl_setcontlabelparam( offset, size, spacing, active );
    }

    public void adv( int page )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.pladv( page );
    }

    public void arc( double x, double y, double a, double b, double angle1, double angle2, double rotate, boolean fill )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plarc( x, y, a, b, angle1, angle2, rotate, fill );
    }

    public void axes( double x0, double y0, String xopt, double xtick, int nxsub,
                      String yopt, double ytick, int nysub )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plaxes( x0, y0, xopt, xtick, nxsub, yopt, ytick, nysub );
    }

    public void bin( double[] x, double[] y, int center )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plbin( x, y, center );
    }

    public void bop()
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plbop();
    }

    public void box( String xopt, double xtick, int nxsub,
                     String yopt, double ytick, int nysub )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plbox( xopt, xtick, nxsub, yopt, ytick, nysub );
    }

    public void box3( String xopt, String xlabel, double xtick, int nsubx,
                      String yopt, String ylabel, double ytick, int nsuby,
                      String zopt, String zlabel, double ztick, int nsubz )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plbox3( xopt, xlabel, xtick, nsubx, yopt, ylabel, ytick, nsuby,
            zopt, zlabel, ztick, nsubz );
    }

    public void btime( int year[], int month[], int day[], int hour[], int min[], double sec[], double ctime )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plbtime( year, month, day, hour, min, sec, ctime );
    }

    public void calc_world( double rx, double ry, double[] wx, double[] wy, int[] window )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plcalc_world( rx, ry, wx, wy, window );
    }

    public void clear()
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plclear();
    }

    public void col0( int icol0 )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plcol0( icol0 );
    }

    public void col1( double col1 )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plcol1( col1 );
    }

    public void configtime( double scale, double offset1, double offset2,
                            int ccontrol, boolean ifbtime_offset, int year,
                            int month, int day, int hour, int min,
                            double sec )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plconfigtime( scale, offset1, offset2, ccontrol, ifbtime_offset,
            year, month, day, hour, min, sec );
    }

    public void cont( double[][] f, int kx, int lx, int ky, int ly,
                      double[] clevel, double[][] pltr, double[][] OBJECT_DATA )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plcont( f, kx, lx, ky, ly, clevel, pltr, OBJECT_DATA );
    }

    public void cpstrm( PLStream pls, boolean flags )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plcpstrm( pls.stream_id, flags );
    }

    public void ctime( int year, int month, int day, int hour, int min, double sec, double ctime[] )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plctime( year, month, day, hour, min, sec, ctime );
    }

// The end / end1 functions have extra code in to keep track of the
// stream references in the class.
    public void end()
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plend();
        active_streams = 0;
        stream_id      = -1;
    }

    public void end1()
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plend1();

        active_streams--;
        stream_id = -1;
    }

    public void env( double xmin, double xmax, double ymin, double ymax, int just, int axis )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plenv( xmin, xmax, ymin, ymax, just, axis );
    }

    public void env0( double xmin, double xmax, double ymin, double ymax, int just, int axis )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plenv0( xmin, xmax, ymin, ymax, just, axis );
    }

    public void eop()
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.pleop();
    }

    public void errx( double[] xmin, double[] xmax, double[] y )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plerrx( xmin, xmax, y );
    }

    public void erry( double[] x, double[] ymin, double[] ymax )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plerry( x, ymin, ymax );
    }

    public void famadv()
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plfamadv();
    }

    public void fill( double[] x, double[] y )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plfill( x, y );
    }

    public void fill3( double[] x, double[] y, double[] z )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plfill3( x, y, z );
    }

    public void flush()
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plflush();
    }

    public void font( int ifont )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plfont( ifont );
    }

    public void fontld( int fnt )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plfontld( fnt );
    }

    public void gchr( double[] p_def, double[] p_ht )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plgchr( p_def, p_ht );
    }

    public void gcol0( int icol0, int[] r, int[] g, int[] b )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plgcol0( icol0, r, g, b );
    }

    public void gcol0a( int icol0, int[] r, int[] g, int[] b, double[] a )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plgcol0a( icol0, r, g, b, a );
    }

    public void gcolbg( int[] r, int[] g, int[] b )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plgcolbg( r, g, b );
    }

    public void gcolbga( int[] r, int[] g, int[] b, double[] a )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plgcolbga( r, g, b, a );
    }

    public void gcompression( int[] compression )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plgcompression( compression );
    }

    public void gdev( StringBuffer dev )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plgdev( dev );
    }

    public void gdidev( double[] mar, double[] aspect, double[] jx, double[] jy )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plgdidev( mar, aspect, jx, jy );
    }

    public void gdiori( double[] rot )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plgdiori( rot );
    }

    public void gdiplt( double[] xmin, double[] xmax, double[] ymin, double[] ymax )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plgdiplt( xmin, xmax, ymin, ymax );
    }

    public int getCursor( PLGraphicsIn gin )
    {
        if ( set_stream() == -1 ) return 0;
        return plplotjavac.plGetCursor( gin );
    }

    public void gfam( int[] fam, int[] num, int[]  bmax )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plgfam( fam, num, bmax );
    }

    public void gfci( long[] pfci )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plgfci( pfci );
    }

    public void gfnam( StringBuffer fnam )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plgfnam( fnam );
    }

    public void gfont( int[] family, int[] style, int[] weight )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plgfont( family, style, weight );
    }

    public void glevel( int[] p_level )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plglevel( p_level );
    }

    public void gpage( double[] xp, double[] yp, int[] xleng, int[] yleng, int[] xoff, int[] yoff )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plgpage( xp, yp, xleng, yleng, xoff, yoff );
    }

    public void gra()
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plgra();
    }

    public void gradient( double[] x, double[] y, double angle )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plgradient( x, y, angle );
    }

    public void griddata( double[] x, double[] y, double[] z, double[] xg,
                          double[] yg, double[][] zg, int type, double data )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plgriddata( x, y, z, xg, yg, zg, type, data );
    }

    public void gspa( double[] xmin, double[] xmax, double[] ymin, double[] ymax )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plgspa( xmin, xmax, ymin, ymax );
    }

// Note: The user should never need this in with this class
// since the stream is encapsulated in the class.
//public void gstrm(int[] p_strm) {
//    if (set_stream() == -1) return;
//    plplotjavac.plgstrm(p_strm);
//}

    public void gver( StringBuffer ver )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plgver( ver );
    }

    public void gvpd( double[] xmin, double[] xmax, double[] ymin, double[] ymax )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plgvpd( xmin, xmax, ymin, ymax );
    }

    public void gvpw( double[] xmin, double[] xmax, double[] ymin, double[] ymax )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plgvpw( xmin, xmax, ymin, ymax );
    }

    public void gxax( int[] digmax, int[] digits )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plgxax( digmax, digits );
    }

    public void gyax( int[] digmax, int[] digits )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plgyax( digmax, digits );
    }

    public void gzax( int[] digmax, int[] digits )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plgzax( digmax, digits );
    }

    public void hist( double[] data, double datmin, double datmax, int nbin, int oldwin )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plhist( data, datmin, datmax, nbin, oldwin );
    }

// Officially deprecated.
//public void hls(double h, double l, double s) {
//    if (set_stream() == -1) return;
//    plplotjavac.plhls(h, l, s);
//}

    public void image( double[][] data, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, double Dxmin, double Dxmax, double Dymin, double Dymax )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plimage( data, xmin, xmax, ymin, ymax, zmin, zmax, Dxmin, Dxmax, Dymin, Dymax );
    }

    public void imagefr( double[][] data, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, double valuemin, double valuemax, double[][] pltr_im, double[][] OBJECT_DATA_im )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plimagefr( data, xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax, pltr_im, OBJECT_DATA_im );
    }

    public void init()
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plinit();
    }

    public void join( double x1, double y1, double x2, double y2 )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.pljoin( x1, y1, x2, y2 );
    }

    public void lab( String xlabel, String ylabel, String tlabel )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.pllab( xlabel, ylabel, tlabel );
    }

    public void legend( double[] p_legend_width, double[] p_legend_height,
                        int opt, int position, double x, double y, double plot_width,
                        int bg_color, int bb_color, int bb_style,
                        int nrow, int ncolumn, int[] opt_array,
                        double text_offset, double text_scale,
                        double text_spacing, double text_justification,
                        int[] text_colors, String[] text,
                        int[] box_colors, int[] box_patterns,
                        double[] box_scales, double[] box_line_widths,
                        int[] line_colors, int[] line_styles,
                        double[] line_widths,
                        int[] symbol_colors, double[] symbol_scales,
                        int[] symbol_numbers, String[] symbols )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.pllegend( p_legend_width, p_legend_height,
            opt, position, x, y, plot_width, bg_color, bb_color,
            bb_style, nrow, ncolumn, opt_array,
            text_offset, text_scale, text_spacing,
            text_justification, text_colors, text,
            box_colors, box_patterns, box_scales,
            box_line_widths, line_colors, line_styles,
            line_widths, symbol_colors, symbol_scales,
            symbol_numbers, symbols );
    }


    public void colorbar( double[] p_colorbar_width,
                          double[] p_colorbar_height,
                          int opt, int position, double x, double y,
                          double x_length, double y_length,
                          int bg_color, int bb_color, int bb_style,
                          double low_cap_color, double high_cap_color,
                          int cont_color, double cont_width,
                          int[] label_opts, String[] labels,
                          String[] axis_opts,
                          double[] ticks, int[] sub_ticks,
                          int[] n_values, double[][] values )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plcolorbar( p_colorbar_width, p_colorbar_height,
            opt, position, x, y, x_length, y_length,
            bg_color, bb_color, bb_style,
            low_cap_color, high_cap_color,
            cont_color, cont_width,
            label_opts, labels, axis_opts,
            ticks, sub_ticks,
            n_values, values );
    }


    public void lightsource( double x, double y, double z )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.pllightsource( x, y, z );
    }

    public void line( double[] x, double[] y )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plline( x, y );
    }

    public void line3( double[] x, double[] y, double[] z )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plline3( x, y, z );
    }

    public void lsty( int lin )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.pllsty( lin );
    }

    public void map( PLCallbackMapform mapform, String type, double minlong, double maxlong, double minlat, double maxlat )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plmap( mapform, type, minlong, maxlong, minlat, maxlat );
    }

    public void meridians( PLCallbackMapform mapform, double dlong, double dlat, double minlong, double maxlong, double minlat, double maxlat )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plmeridians( mapform, dlong, dlat, minlong, maxlong, minlat, maxlat );
    }

    public void minMax2dGrid( double[][] f, double[] fmax, double[] fmin )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plMinMax2dGrid( f, fmax, fmin );
    }

    public void mesh( double[] x, double[] y, double[][] z, int opt )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plmesh( x, y, z, opt );
    }

    public void meshc( double[] x, double[] y, double[][] z, int opt, double[] clevel )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plmeshc( x, y, z, opt, clevel );
    }

// Don't need this in the OO approach - create a new object instead.
//public void mkstrm(int[] OUTPUT) {
//    if (set_stream() == -1) return;
//    plplotjavac.plmkstrm(int[] OUTPUT);
//}

    public void mtex( String side, double disp, double pos, double just, String text )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plmtex( side, disp, pos, just, text );
    }

    public void mtex3( String side, double disp, double pos, double just, String text )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plmtex3( side, disp, pos, just, text );
    }

    public void plot3d( double[] x, double[] y, double[][] z, int opt, boolean side )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plot3d( x, y, z, opt, side );
    }

    public void plot3dc( double[] x, double[] y, double[][] z, int opt, double[] clevel )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plot3dc( x, y, z, opt, clevel );
    }

    public void plot3dcl( double[] x, double[] y, double[][] z, int opt,
                          double[] clevel, int ixstart, int[] indexymin, int[] indexymax )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plot3dcl( x, y, z, opt, clevel, ixstart, indexymin, indexymax );
    }

    public void surf3d( double[] x, double[] y, double[][] z, int opt, double[] clevel )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plsurf3d( x, y, z, opt, clevel );
    }

    public void surf3dl( double[] x, double[] y, double[][] z, int opt,
                         double[] clevel, int ixstart, int[] indexymin, int[] indexymax )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plsurf3dl( x, y, z, opt, clevel, ixstart, indexymin, indexymax );
    }

    public void parseopts( String[] argv, int mode )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plparseopts( argv, mode );
    }

    public void pat( int[] inc, int[] del )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plpat( inc, del );
    }

    public void path( int n, double x1, double y1, double x2, double y2 )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plpath( n, x1, y1, x2, y2 );
    }

    public void poin( double[] x, double[] y, int code )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plpoin( x, y, code );
    }

    public void poin3( double[] x, double[] y, double[] z, int code )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plpoin3( x, y, z, code );
    }

    public void poly3( double[] x, double[] y, double[] z, boolean[] draw, boolean ifcc )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plpoly3( x, y, z, draw, ifcc );
    }

    public void prec( int setp, int prec )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plprec( setp, prec );
    }

    public void psty( int patt )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plpsty( patt );
    }

    public void ptex( double x, double y, double dx, double dy, double just, String text )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plptex( x, y, dx, dy, just, text );
    }

    public void ptex3( double x, double y, double z, double dx, double dy, double dz, double sx, double sy, double sz, double just, String text )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plptex3( x, y, z, dx, dy, dz, sx, sy, sz, just, text );
    }

    public double randd()
    {
        if ( set_stream() == -1 ) return 0.0;
        return plplotjavac.plrandd();
    }

    public void replot()
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plreplot();
    }

    public void schr( double def, double scale )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plschr( def, scale );
    }

    public void scmap0( int[] r, int[] g, int[] b )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plscmap0( r, g, b );
    }

    public void scmap0a( int[] r, int[] g, int[] b, double[] a )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plscmap0a( r, g, b, a );
    }

    public void scmap0n( int ncol0 )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plscmap0n( ncol0 );
    }

    public void scmap1( int[] r, int[] g, int[] b )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plscmap1( r, g, b );
    }

    public void scmap1a( int[] r, int[] g, int[] b, double[] a )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plscmap1a( r, g, b, a );
    }

    public void scmap1l( boolean itype, double[] intensity, double[] coord1,
                         double[] coord2, double[] coord3, boolean[] alt_hue_path )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plscmap1l( itype, intensity, coord1, coord2, coord3, alt_hue_path );
    }

    public void scmap1l( boolean itype, double[] intensity, double[] coord1,
                         double[] coord2, double[] coord3 )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plscmap1l( itype, intensity, coord1, coord2, coord3, null );
    }

    public void scmap1la( boolean itype, double[] intensity, double[] coord1,
                          double[] coord2, double[] coord3, double[] a, boolean[] alt_hue_path )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plscmap1la( itype, intensity, coord1, coord2, coord3, a, alt_hue_path );
    }

    public void scmap1la( boolean itype, double[] intensity, double[] coord1,
                          double[] coord2, double[] coord3, double[] a )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plscmap1la( itype, intensity, coord1, coord2, coord3, a, null );
    }

    public void scmap1n( int ncol1 )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plscmap1n( ncol1 );
    }

    public void scmap1_range( double min_color, double max_color )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plscmap1_range( min_color, max_color );
    }

    public void gcmap1_range( double[] min_color, double[] max_color )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plgcmap1_range( min_color, max_color );
    }

    public void scol0( int icol0, int r, int g, int b )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plscol0( icol0, r, g, b );
    }

    public void scol0a( int icol0, int r, int g, int b, double a )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plscol0a( icol0, r, g, b, a );
    }

    public void scolbg( int r, int g, int b )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plscolbg( r, g, b );
    }

    public void scolbga( int r, int g, int b, double a )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plscolbga( r, g, b, a );
    }

    public void scolor( int color )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plscolor( color );
    }

    public void scompression( int compression )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plscompression( compression );
    }

    public void sdev( String devname )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plsdev( devname );
    }

    public void sdidev( double mar, double aspect, double jx, double jy )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plsdidev( mar, aspect, jx, jy );
    }

    public void sdimap( int dimxmin, int dimxmax, int dimymin, int dimymax,
                        double dimxpmm, double dimypmm )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plsdimap( dimxmin, dimxmax, dimymin, dimymax, dimxpmm, dimypmm );
    }

    public void sdiori( double rot )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plsdiori( rot );
    }

    public void sdiplt( double xmin, double ymin, double xmax, double ymax )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plsdiplt( xmin, ymin, xmax, ymax );
    }

    public void sdiplz( double xmin, double ymin, double xmax, double ymax )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plsdiplz( xmin, ymin, xmax, ymax );
    }

    public void seed( long s )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plseed( s );
    }

    public void sesc( char esc )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plsesc( esc );
    }

    public void setopt( String opt, String optarg )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plsetopt( opt, optarg );
    }

    public void sfam( int fam, int num, int bmax )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plsfam( fam, num, bmax );
    }

    public void sfci( long fci )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plsfci( fci );
    }

    public void sfnam( String fnam )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plsfnam( fnam );
    }

    public void sfont( int family, int style, int weight )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plsfont( family, style, weight );
    }

    public void shades( double[][] a, double xmin, double xmax, double ymin,
                        double ymax, double[] clevel, double fill_width, int cont_color,
                        double cont_width, boolean rectangular,
                        double[][] pltr, double[][] OBJECT_DATA )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plshades( a, xmin, xmax, ymin, ymax, clevel, fill_width,
            cont_color, cont_width, rectangular, pltr, OBJECT_DATA );
    }

    public void shade( double[][] a, double left, double right, double bottom,
                       double top, double shade_min, double shade_max, int sh_cmap,
                       double sh_color, double sh_width, int min_color, double min_width,
                       int max_color, double max_width, boolean rectangular,
                       double[][] pltr, double[][] OBJECT_DATA )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plshade( a, left, right, bottom, top, shade_min, shade_max,
            sh_cmap, sh_color, sh_width, min_color, min_width,
            max_color, max_width, rectangular, pltr, OBJECT_DATA );
    }

    public void slabelfunc( PLCallbackLabel label, Object obj )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plslabelfunc( label, obj );
    }

    public void slabelfunc( PLCallbackLabel label )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plslabelfunc( label, null );
    }

    public void smaj( double def, double scale )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plsmaj( def, scale );
    }

    public void smin( double def, double scale )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plsmin( def, scale );
    }

    public void sori( int ori )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plsori( ori );
    }

    public void spage( double xp, double yp, int xleng, int yleng, int xoff, int yoff )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plspage( xp, yp, xleng, yleng, xoff, yoff );
    }

    public void spal0( String filename )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plspal0( filename );
    }

    public void spal1( String filename, boolean interpolate )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plspal1( filename, interpolate );
    }

    public void spause( boolean pause )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plspause( pause );
    }

    public void sstrm( int strm )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plsstrm( strm );
    }

    public void ssub( int nx, int ny )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plssub( nx, ny );
    }

    public void ssym( double def, double scale )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plssym( def, scale );
    }

    public void star( int nx, int ny )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plstar( nx, ny );
    }

    public void start( String devname, int nx, int ny )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plstart( devname, nx, ny );
    }

    public void stransform( PLCallbackCT coordTrans, Object data )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plstransform( coordTrans, data );
    }

    public void string( double[] x, double[] y, String string )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plstring( x, y, string );
    }

    public void string3( double[] x, double[] y, double[] z, String string )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plstring3( x, y, z, string );
    }

    public void stripa( int id, int pen, double x, double y )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plstripa( id, pen, x, y );
    }

    public void stripc( int[] id, String xspec, String yspec,
                        double xmin, double xmax, double xjump,
                        double ymin, double ymax, double xlpos, double ylpos,
                        boolean y_ascl, boolean acc, int colbox, int collab,
                        int[] colline, int[] styline, String[] legline,
                        String labx, String laby, String labtop )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plstripc( id, xspec, yspec, xmin, xmax, xjump, ymin, ymax,
            xlpos, ylpos, y_ascl, acc, colbox, collab, colline,
            styline, legline, labx, laby, labtop );
    }

    public void stripd( int id )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plstripd( id );
    }

    public void styl( int[] mark, int[] space )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plstyl( mark, space );
    }

    public void svect( double[] arrow_x, double[] arrow_y, boolean fill )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plsvect( arrow_x, arrow_y, fill );
    }

    public void svpa( double xmin, double xmax, double ymin, double ymax )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plsvpa( xmin, xmax, ymin, ymax );
    }

    public void sxax( int digmax, int digits )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plsxax( digmax, digits );
    }

    public void syax( int digmax, int digits )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plsyax( digmax, digits );
    }

    public void sym( double[] x, double[] y, int code )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plsym( x, y, code );
    }

    public void szax( int digmax, int digits )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plszax( digmax, digits );
    }

    public void text()
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.pltext();
    }

    public void timefmt( String fmt )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.pltimefmt( fmt );
    }

    public void vasp( double aspect )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plvasp( aspect );
    }

    public void vect( double[][] u, double[][] v, double scale, double[][] pltr, double[][] OBJECT_DATA )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plvect( u, v, scale, pltr, OBJECT_DATA );
    }

    public void vpas( double xmin, double xmax, double ymin, double ymax, double aspect )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plvpas( xmin, xmax, ymin, ymax, aspect );
    }

    public void vpor( double xmin, double xmax, double ymin, double ymax )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plvpor( xmin, xmax, ymin, ymax );
    }

    public void vsta()
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plvsta();
    }

    public void w3d( double basex, double basey, double height, double xmin0,
                     double xmax0, double ymin0, double ymax0, double zmin0,
                     double zmax0, double alt, double az )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plw3d( basex, basey, height, xmin0, xmax0, ymin0, ymax0,
            zmin0, zmax0, alt, az );
    }

    public void width( int width )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plwidth( width );
    }

    public void wind( double xmin, double xmax, double ymin, double ymax )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plwind( xmin, xmax, ymin, ymax );
    }

    public void xormod( boolean mode, boolean[] status )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plxormod( mode, status );
    }

    public void ClearOpts()
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plClearOpts();
    }

    public void ResetOpts()
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plResetOpts();
    }

    public void SetUsage( String program_string, String usage_string )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plSetUsage( program_string, usage_string );
    }

    public void OptUsage()
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plOptUsage();
    }

    public void hlsrgb( double h, double l, double s, double[] r, double[] g, double[] b )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plhlsrgb( h, l, s, r, g, b );
    }

    public void rgbhls( double r, double g, double b, double[] h, double[] l, double[] s )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plrgbhls( r, g, b, h, l, s );
    }

// Deprecated versions of methods which use int for a flag instead of
// boolean.
    public void cpstrm( int iplsr, int flags )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plcpstrm( iplsr, flags != 0 );
    }

    public void plot3d( double[] x, double[] y, double[][] z, int opt, int side )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plot3d( x, y, z, opt, side != 0 );
    }

    public void poly3( double[] x, double[] y, double[] z, int[] draw, int ifcc )
    {
        if ( set_stream() == -1 ) return;
        boolean [] loc_draw = new boolean[draw.length];
        for ( int i = 0; i < draw.length; i++ )
        {
            loc_draw[i] = ( draw[i] != 0 );
        }
        plplotjavac.plpoly3( x, y, z, loc_draw, ifcc != 0 );
    }

    public void scmap1l( int itype, double[] intensity, double[] coord1,
                         double[] coord2, double[] coord3, int[] alt_hue_path )
    {
        if ( set_stream() == -1 ) return;
        boolean [] loc_alt_hue_path = null;
        if ( alt_hue_path != null )
        {
            loc_alt_hue_path = new boolean[alt_hue_path.length];
            for ( int i = 0; i < alt_hue_path.length; i++ )
            {
                loc_alt_hue_path[i] = ( alt_hue_path[i] != 0 );
            }
        }
        plplotjavac.plscmap1l( itype != 0, intensity, coord1, coord2, coord3, loc_alt_hue_path );
    }

    public void shades( double[][] a, double xmin, double xmax, double ymin,
                        double ymax, double[] clevel, double fill_width, int cont_color,
                        double cont_width, int rectangular,
                        double[][] pltr, double[][] OBJECT_DATA )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plshades( a, xmin, xmax, ymin, ymax, clevel, fill_width,
            cont_color, cont_width, rectangular != 0, pltr, OBJECT_DATA );
    }

    public void shade( double[][] a, double left, double right, double bottom,
                       double top, double shade_min, double shade_max, int sh_cmap,
                       double sh_color, double sh_width, int min_color, double min_width,
                       int max_color, double max_width, int rectangular,
                       double[][] pltr, double[][] OBJECT_DATA )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plshade( a, left, right, bottom, top, shade_min, shade_max,
            sh_cmap, sh_color, sh_width, min_color, min_width,
            max_color, max_width, rectangular != 0, pltr, OBJECT_DATA );
    }

    public void spause( int pause )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plspause( pause != 0 );
    }

    public void stripc( int[] id, String xspec, String yspec,
                        double xmin, double xmax, double xjump,
                        double ymin, double ymax, double xlpos, double ylpos,
                        int y_ascl, int acc, int colbox, int collab,
                        int[] colline, int[] styline, String[] legline,
                        String labx, String laby, String labtop )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plstripc( id, xspec, yspec, xmin, xmax, xjump, ymin, ymax,
            xlpos, ylpos, y_ascl != 0, acc != 0, colbox, collab,
            colline, styline, legline, labx, laby, labtop );
    }

    public void svect( double[] arrow_x, double[] arrow_y, int fill )
    {
        if ( set_stream() == -1 ) return;
        plplotjavac.plsvect( arrow_x, arrow_y, fill != 0 );
    }

    public void xormod( int mode, int[] status )
    {
        if ( set_stream() == -1 ) return;
        boolean [] loc_status = new boolean[1];
        plplotjavac.plxormod( mode != 0, loc_status );
        status[0] = loc_status[0] ? 1 : 0;
    }
}