Skip to content

Commit 73caf44

Browse files
committed
Made all implementation class package-private
1 parent 4d4ab21 commit 73caf44

File tree

11 files changed

+43
-163
lines changed

11 files changed

+43
-163
lines changed

com/arrayfire/Algorithm.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.arrayfire;
22

3-
public class Algorithm extends ArrayFire {
3+
class Algorithm extends ArrayFire {
44

55
// Scalar return operations
66
private native static double sumAll(long a);

com/arrayfire/Arith.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.arrayfire;
22

3-
public class Arith extends ArrayFire {
3+
class Arith extends ArrayFire {
44

55
// Binary operations
66
private native static long add(long a, long b);

com/arrayfire/Array.java

Lines changed: 5 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,6 @@
11
package com.arrayfire;
22

3-
public class Array extends ArrayFire implements AutoCloseable {
4-
5-
public enum Type {
6-
Float(0),
7-
FloatComplex(1),
8-
Double(2),
9-
DoubleComplex(3),
10-
Boolean(4),
11-
Int(5);
12-
13-
private final int type;
14-
15-
private Type(int type) {
16-
this.type = type;
17-
}
18-
19-
public static Type fromInt(int type) throws IllegalArgumentException {
20-
switch (type) {
21-
case 0:
22-
return Type.Float;
23-
case 1:
24-
return Type.FloatComplex;
25-
case 2:
26-
return Type.Double;
27-
case 3:
28-
return Type.DoubleComplex;
29-
case 4:
30-
return Type.Boolean;
31-
case 5:
32-
return Type.Int;
33-
default:
34-
throw new IllegalArgumentException("Unknown type.");
35-
}
36-
}
37-
38-
public int getType() {
39-
return type;
40-
}
41-
42-
public Type f32() {
43-
return Type.Float;
44-
}
45-
46-
public Type f64() {
47-
return Type.Double;
48-
}
49-
50-
public Type int32() {
51-
return Type.Int;
52-
}
53-
54-
@Override
55-
public String toString() {
56-
return this.name();
57-
}
58-
}
3+
public class Array implements AutoCloseable {
594

605
private native static void destroyArray(long ref);
616

@@ -200,8 +145,8 @@ public int[] dims() {
200145
return getDims(ref);
201146
}
202147

203-
public Array.Type type() throws Exception {
204-
return Array.Type.fromInt(getType(ref));
148+
public ArrayFire.Type type() throws Exception {
149+
return ArrayFire.Type.fromInt(getType(ref));
205150
}
206151

207152
protected static int[] dim4(int[] dims) throws IllegalArgumentException {
@@ -217,9 +162,9 @@ protected static int[] dim4(int[] dims) throws IllegalArgumentException {
217162
return adims;
218163
}
219164

220-
protected void assertType(Array.Type ty) throws Exception {
165+
protected void assertType(ArrayFire.Type ty) throws Exception {
221166

222-
Type myType = type();
167+
ArrayFire.Type myType = type();
223168

224169
if (myType != ty) {
225170
String str = "Type mismatch: ";

com/arrayfire/ArrayFireException.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
import java.util.HashMap;
55
import java.util.Map;
66

7-
import com.util.JNIException;
87

9-
public class ArrayFireException extends JNIException {
8+
class ArrayFireException extends JNIException {
109
private static final Map<Integer, String> errorCodes;
1110

1211
static {

com/arrayfire/Data.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.arrayfire;
22

3-
public class Data extends ArrayFire {
3+
class Data extends ArrayFire {
44

55
private native static long createRanduArray(int[] dims, int type);
66

@@ -23,58 +23,58 @@ public class Data extends ArrayFire {
2323
private native static long createIdentityArray(int[] dims, int type);
2424

2525
public static float[] getFloatArray(Array A) throws Exception {
26-
A.assertType(Array.Type.Float);
26+
A.assertType(ArrayFire.Type.Float);
2727
return getFloatFromArray(A.ref);
2828
}
2929

3030
public static double[] getDoubleArray(Array A) throws Exception {
31-
A.assertType(Array.Type.Double);
31+
A.assertType(ArrayFire.Type.Double);
3232
return getDoubleFromArray(A.ref);
3333
}
3434

3535
public static FloatComplex[] getFloatComplexArray(Array A) throws Exception {
36-
A.assertType(Array.Type.FloatComplex);
36+
A.assertType(ArrayFire.Type.FloatComplex);
3737
return getFloatComplexFromArray(A.ref);
3838
}
3939

4040
public static DoubleComplex[] getDoubleComplexArray(Array A) throws Exception {
41-
A.assertType(Array.Type.DoubleComplex);
41+
A.assertType(ArrayFire.Type.DoubleComplex);
4242
return getDoubleComplexFromArray(A.ref);
4343
}
4444

4545
public static int[] getIntArray(Array A) throws Exception {
46-
A.assertType(Array.Type.Int);
46+
A.assertType(ArrayFire.Type.Int);
4747
return getIntFromArray(A.ref);
4848
}
4949

5050
public static boolean[] getBooleanArray(Array A) throws Exception {
51-
A.assertType(Array.Type.Boolean);
51+
A.assertType(ArrayFire.Type.Boolean);
5252
return getBooleanFromArray(A.ref);
5353
}
5454

5555
// Binary operations
56-
public static void randu(Array res, int[] dims, Array.Type type) throws Exception {
56+
public static void randu(Array res, int[] dims, ArrayFire.Type type) throws Exception {
5757
int[] adims = Array.dim4(dims);
5858
res.set(createRanduArray(adims, type.getType()));
5959
}
6060

61-
public static void randn(Array res, int[] dims, Array.Type type) throws Exception {
61+
public static void randn(Array res, int[] dims, ArrayFire.Type type) throws Exception {
6262
int[] adims = Array.dim4(dims);
6363
res.set(createRandnArray(adims, type.getType()));
6464
}
6565

66-
public static void constant(Array res, double val, int[] dims, Array.Type type) throws Exception {
66+
public static void constant(Array res, double val, int[] dims, ArrayFire.Type type) throws Exception {
6767
int[] adims = Array.dim4(dims);
6868
res.set(createConstantsArray(val, adims, type.getType()));
6969
}
7070

71-
public static void identity(Array res, int[] dims, Array.Type type) throws Exception {
71+
public static void identity(Array res, int[] dims, ArrayFire.Type type) throws Exception {
7272
int[] adims = Array.dim4(dims);
7373
res.set(createIdentityArray(adims, type.getType()));
7474
}
7575

7676
public static void identity(Array res, int[] dims) throws Exception {
77-
identity(res, dims, Array.Type.Float);
77+
identity(res, dims, ArrayFire.Type.Float);
7878
}
7979

8080
}

com/arrayfire/Graphics.java

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,6 @@
11
package com.arrayfire;
22

3-
class Graphics extends ArrayFire {
4-
5-
public enum ColorMap {
6-
DEFAULT(0),
7-
SPECTRUM(1),
8-
COLORS(2),
9-
RED(3),
10-
MOOD(4),
11-
HEAT(5),
12-
BLUE(6),
13-
INFERNO(7),
14-
MAGMA(8),
15-
PLASMA(9),
16-
VIRIDIS(10);
17-
18-
private final int map;
19-
20-
private ColorMap(int map) {
21-
this.map = map;
22-
}
23-
24-
public int getMap() {
25-
return map;
26-
}
27-
}
28-
29-
public enum MarkerType {
30-
NONE(0),
31-
POINT(1),
32-
CIRCLE(2),
33-
SQUARE(3),
34-
TRIANGLE(4),
35-
CROSS(5),
36-
PLUS(6),
37-
STAR(7);
38-
39-
private final int type;
40-
41-
private MarkerType(int type) {
42-
this.type = type;
43-
}
44-
45-
public int getType() {
46-
return type;
47-
}
48-
}
3+
class Graphics {
494

505
public static native long afInitWindow(int width, int height, String name);
516

com/arrayfire/Image.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.arrayfire;
22

3-
public class Image extends ArrayFire {
3+
class Image extends ArrayFire {
44

55
private native static long erode(long a, long b);
66

com/arrayfire/Signal.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.arrayfire;
22

3-
public class Signal extends ArrayFire {
3+
class Signal extends ArrayFire {
44

55
private native static long fft(long a, int dim0);
66

com/arrayfire/Statistics.java

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package com.arrayfire;
22

3-
public class Statistics extends ArrayFire {
3+
import static com.arrayfire.ArrayFire.*;
4+
5+
class Statistics {
46

57
static private native long afMean(long ref, int dim);
68

@@ -96,7 +98,7 @@ static public <T extends Number> T corrcoef(final Array x, final Array y, Class<
9698
return castResult(res, type);
9799
}
98100

99-
static public Array[] topk(final Array in, int k, int dim, TopkOrder order) throws Exception {
101+
static public Array[] topk(final Array in, int k, int dim, ArrayFire.TopkOrder order) throws Exception {
100102
long[] refs = afTopk(in.ref, k, dim, order.getOrder());
101103
return new Array[] {new Array(refs[0]), new Array(refs[1])};
102104
}
@@ -119,18 +121,4 @@ static public <T> T castResult(DoubleComplex res, Class<T> type) throws Exceptio
119121

120122
return type.cast(ret);
121123
}
122-
123-
public enum TopkOrder {
124-
DEFAULT(0), MIN(1), MAX(2);
125-
126-
private final int order;
127-
128-
TopkOrder(int order) {
129-
this.order = order;
130-
}
131-
132-
public int getOrder() {
133-
return order;
134-
}
135-
}
136124
}

com/arrayfire/Util.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.arrayfire;
22

3-
public class Util extends ArrayFire {
3+
class Util extends ArrayFire {
44

55
public native static void info();
66

0 commit comments

Comments
 (0)