27
27
28
28
package dr .geo .contouring ;
29
29
30
- import org .rosuda .JRI .REXP ;
31
- import org .rosuda .JRI .RVector ;
32
- import org .rosuda .JRI .Rengine ;
30
+ // import org.rosuda.JRI.REXP;
31
+ // import org.rosuda.JRI.RVector;
32
+ // import org.rosuda.JRI.Rengine;
33
33
34
34
/**
35
35
* @author Marc Suchard
@@ -42,26 +42,28 @@ public ContourWithR(final double[] xValues, final double[] yValues) {
42
42
}
43
43
44
44
public ContourWithR (final double [] xValues , final double [] yValues , int N ) {
45
- this .xValues = xValues ;
46
- this .yValues = yValues ;
47
- this .N = N ;
45
+ throw new UnsupportedOperationException ("R jnilib no longer supported" );
46
+ // this.xValues = xValues;
47
+ // this.yValues = yValues;
48
+ // this.N = N;
48
49
}
49
50
50
51
private final double [] xValues ;
51
52
private final double [] yValues ;
52
53
53
54
public ContourPath [] getContourPaths (double hpdValue ) {
54
- makeContour (xValues , yValues , hpdValue , N );
55
- if (contourList == null )
56
- return null ;
57
-
58
- ContourPath [] contourPaths = new ContourPath [getNumberContours ()];
59
-
60
- for (int i =0 ; i <getNumberContours (); i ++) {
61
- double [][] cont = getContour (i );
62
- contourPaths [i ] = new ContourPath (null ,1 ,cont [0 ],cont [1 ]);
63
- }
64
- return contourPaths ;
55
+ throw new UnsupportedOperationException ("R jnilib no longer supported" );
56
+ // makeContour(xValues, yValues, hpdValue, N);
57
+ // if (contourList == null)
58
+ // return null;
59
+ //
60
+ // ContourPath[] contourPaths = new ContourPath[getNumberContours()];
61
+ //
62
+ // for(int i=0; i<getNumberContours(); i++) {
63
+ // double[][] cont = getContour(i);
64
+ // contourPaths[i] = new ContourPath(null,1,cont[0],cont[1]);
65
+ // }
66
+ // return contourPaths;
65
67
}
66
68
67
69
@@ -70,43 +72,45 @@ public void makeContour(double[] xValues, double[] yValues, double hpd) {
70
72
}
71
73
72
74
public void makeContour (double [] xValues , double [] yValues , double hpd , int N ) {
73
-
74
-
75
- REXP x = rEngine .eval ("makeContour(" +
76
- makeRString (xValues ) + "," +
77
- makeRString (yValues ) + "," +
78
- hpd + "," +
79
- N + ")" );
80
- contourList = x .asVector ();
75
+ throw new UnsupportedOperationException ( "R jnilib no longer supported" );
76
+
77
+ // REXP x = rEngine.eval("makeContour(" +
78
+ // makeRString(xValues) + "," +
79
+ // makeRString(yValues) + "," +
80
+ // hpd + "," +
81
+ // N + ")");
82
+ // contourList = x.asVector();
81
83
}
82
84
83
85
public int getNumberContours () {
84
- if (contourList != null )
85
- return contourList .size ();
86
- return 0 ;
86
+ throw new UnsupportedOperationException ("R jnilib no longer supported" );
87
+ // if (contourList != null)
88
+ // return contourList.size();
89
+ // return 0;
87
90
}
88
91
89
92
90
93
91
94
92
95
public double [][] getContour (int whichContour ) {
93
-
94
- if (contourList != null ) {
95
- double [][] result = new double [2 ][];
96
- RVector oneContour = contourList .at (whichContour ).asVector ();
97
- result [0 ] = oneContour .at (1 ).asDoubleArray ();
98
- result [1 ] = oneContour .at (2 ).asDoubleArray ();
99
- return result ;
100
- }
101
- return null ;
96
+ throw new UnsupportedOperationException ("R jnilib no longer supported" );
97
+
98
+ // if (contourList != null) {
99
+ // double[][] result = new double[2][];
100
+ // RVector oneContour = contourList.at(whichContour).asVector();
101
+ // result[0] = oneContour.at(1).asDoubleArray();
102
+ // result[1] = oneContour.at(2).asDoubleArray();
103
+ // return result;
104
+ // }
105
+ // return null;
102
106
}
103
107
104
108
105
- private static Rengine rEngine = null ;
109
+ // private static Rengine rEngine = null;
106
110
private int N ;
107
111
108
112
109
- private RVector contourList = null ;
113
+ // private RVector contourList = null;
110
114
111
115
private static final String [] rArgs = {"--no-save" , "--max-vsize=1G" };
112
116
@@ -137,27 +141,27 @@ private String makeRString(double[] values) {
137
141
138
142
static public boolean processWithR = false ;
139
143
140
- static {
141
- try {
142
- System .loadLibrary ("jri" );
143
- processWithR = true ;
144
- System .err .println ("JRI loaded. Will process using R contouring." );
145
-
146
- // if (!Rengine.versionCheck()) {
147
- // throw new RuntimeException("JRI library version mismatch");
144
+ // static {
145
+ // try {
146
+ // System.loadLibrary("jri");
147
+ // processWithR = true;
148
+ // System.err.println("JRI loaded. Will process using R contouring.");
149
+ //
150
+ //// if (!Rengine.versionCheck()) {
151
+ //// throw new RuntimeException("JRI library version mismatch");
152
+ //// }
153
+ //
154
+ // rEngine = new Rengine(rArgs, false, null);
155
+ //
156
+ // if (!rEngine.waitForR()) {
157
+ // throw new RuntimeException("Cannot load R");
148
158
// }
149
-
150
- rEngine = new Rengine (rArgs , false , null );
151
-
152
- if (!rEngine .waitForR ()) {
153
- throw new RuntimeException ("Cannot load R" );
154
- }
155
-
156
- for (String command : rBootCommands ) {
157
- rEngine .eval (command );
158
- }
159
- } catch (UnsatisfiedLinkError e ) {
160
- System .err .println ("JRI not available. Will process using Java contouring." );
161
- }
162
- }
159
+ //
160
+ // for (String command : rBootCommands) {
161
+ // rEngine.eval(command);
162
+ // }
163
+ // } catch (UnsatisfiedLinkError e) {
164
+ // System.err.println("JRI not available. Will process using Java contouring.");
165
+ // }
166
+ // }
163
167
}
0 commit comments