Skip to content

Commit f5d5f6a

Browse files
committed
Code format
1 parent 3b808d0 commit f5d5f6a

File tree

2 files changed

+172
-183
lines changed

2 files changed

+172
-183
lines changed

MPChartLib/src/main/java/com/github/mikephil/charting/matrix/Vector3.java

Lines changed: 125 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -5,132 +5,130 @@
55
* Simple 3D vector class. Handles basic vector math for 3D vectors.
66
*/
77
public final class Vector3 {
8-
public float x;
9-
public float y;
10-
public float z;
11-
12-
public static final Vector3 ZERO = new Vector3(0, 0, 0);
13-
public static final Vector3 UNIT_X = new Vector3(1, 0, 0);
14-
public static final Vector3 UNIT_Y = new Vector3(0, 1, 0);
15-
public static final Vector3 UNIT_Z = new Vector3(0, 0, 1);
16-
17-
public Vector3() {
18-
}
19-
20-
public Vector3(float[] array)
21-
{
22-
set(array[0], array[1], array[2]);
23-
}
24-
25-
public Vector3(float xValue, float yValue, float zValue) {
26-
set(xValue, yValue, zValue);
27-
}
28-
29-
public Vector3(Vector3 other) {
30-
set(other);
31-
}
32-
33-
public final void add(Vector3 other) {
34-
x += other.x;
35-
y += other.y;
36-
z += other.z;
37-
}
38-
39-
public final void add(float otherX, float otherY, float otherZ) {
40-
x += otherX;
41-
y += otherY;
42-
z += otherZ;
43-
}
44-
45-
public final void subtract(Vector3 other) {
46-
x -= other.x;
47-
y -= other.y;
48-
z -= other.z;
49-
}
50-
51-
public final void subtractMultiple(Vector3 other, float multiplicator)
52-
{
53-
x -= other.x * multiplicator;
54-
y -= other.y * multiplicator;
55-
z -= other.z * multiplicator;
56-
}
57-
58-
public final void multiply(float magnitude) {
59-
x *= magnitude;
60-
y *= magnitude;
61-
z *= magnitude;
62-
}
63-
64-
public final void multiply(Vector3 other) {
65-
x *= other.x;
66-
y *= other.y;
67-
z *= other.z;
68-
}
69-
70-
public final void divide(float magnitude) {
71-
if (magnitude != 0.0f) {
72-
x /= magnitude;
73-
y /= magnitude;
74-
z /= magnitude;
75-
}
76-
}
77-
78-
public final void set(Vector3 other) {
79-
x = other.x;
80-
y = other.y;
81-
z = other.z;
82-
}
83-
84-
public final void set(float xValue, float yValue, float zValue) {
85-
x = xValue;
86-
y = yValue;
87-
z = zValue;
88-
}
89-
90-
public final float dot(Vector3 other) {
91-
return (x * other.x) + (y * other.y) + (z * other.z);
92-
}
93-
94-
public final Vector3 cross(Vector3 other) {
95-
return new Vector3(y * other.z - z * other.y,
96-
z * other.x - x * other.z,
97-
x * other.y - y * other.x);
98-
}
99-
100-
public final float length() {
101-
return (float) Math.sqrt(length2());
102-
}
103-
104-
public final float length2() {
105-
return (x * x) + (y * y) + (z * z);
106-
}
107-
108-
public final float distance2(Vector3 other) {
109-
float dx = x - other.x;
110-
float dy = y - other.y;
111-
float dz = z - other.z;
112-
return (dx * dx) + (dy * dy) + (dz * dz);
113-
}
114-
115-
public final float normalize() {
116-
final float magnitude = length();
117-
118-
// TODO: I'm choosing safety over speed here.
119-
if (magnitude != 0.0f) {
120-
x /= magnitude;
121-
y /= magnitude;
122-
z /= magnitude;
123-
}
124-
125-
return magnitude;
126-
}
127-
128-
public final void zero() {
129-
set(0.0f, 0.0f, 0.0f);
130-
}
131-
132-
public final boolean pointsInSameDirection(Vector3 other) {
133-
return this.dot(other) > 0;
134-
}
8+
public float x;
9+
public float y;
10+
public float z;
11+
12+
public static final Vector3 ZERO = new Vector3(0, 0, 0);
13+
public static final Vector3 UNIT_X = new Vector3(1, 0, 0);
14+
public static final Vector3 UNIT_Y = new Vector3(0, 1, 0);
15+
public static final Vector3 UNIT_Z = new Vector3(0, 0, 1);
16+
17+
public Vector3() {
18+
}
19+
20+
public Vector3(float[] array) {
21+
set(array[0], array[1], array[2]);
22+
}
23+
24+
public Vector3(float xValue, float yValue, float zValue) {
25+
set(xValue, yValue, zValue);
26+
}
27+
28+
public Vector3(Vector3 other) {
29+
set(other);
30+
}
31+
32+
public final void add(Vector3 other) {
33+
x += other.x;
34+
y += other.y;
35+
z += other.z;
36+
}
37+
38+
public final void add(float otherX, float otherY, float otherZ) {
39+
x += otherX;
40+
y += otherY;
41+
z += otherZ;
42+
}
43+
44+
public final void subtract(Vector3 other) {
45+
x -= other.x;
46+
y -= other.y;
47+
z -= other.z;
48+
}
49+
50+
public final void subtractMultiple(Vector3 other, float multiplicator) {
51+
x -= other.x * multiplicator;
52+
y -= other.y * multiplicator;
53+
z -= other.z * multiplicator;
54+
}
55+
56+
public final void multiply(float magnitude) {
57+
x *= magnitude;
58+
y *= magnitude;
59+
z *= magnitude;
60+
}
61+
62+
public final void multiply(Vector3 other) {
63+
x *= other.x;
64+
y *= other.y;
65+
z *= other.z;
66+
}
67+
68+
public final void divide(float magnitude) {
69+
if (magnitude != 0.0f) {
70+
x /= magnitude;
71+
y /= magnitude;
72+
z /= magnitude;
73+
}
74+
}
75+
76+
public final void set(Vector3 other) {
77+
x = other.x;
78+
y = other.y;
79+
z = other.z;
80+
}
81+
82+
public final void set(float xValue, float yValue, float zValue) {
83+
x = xValue;
84+
y = yValue;
85+
z = zValue;
86+
}
87+
88+
public final float dot(Vector3 other) {
89+
return (x * other.x) + (y * other.y) + (z * other.z);
90+
}
91+
92+
public final Vector3 cross(Vector3 other) {
93+
return new Vector3(y * other.z - z * other.y,
94+
z * other.x - x * other.z,
95+
x * other.y - y * other.x);
96+
}
97+
98+
public final float length() {
99+
return (float) Math.sqrt(length2());
100+
}
101+
102+
public final float length2() {
103+
return (x * x) + (y * y) + (z * z);
104+
}
105+
106+
public final float distance2(Vector3 other) {
107+
float dx = x - other.x;
108+
float dy = y - other.y;
109+
float dz = z - other.z;
110+
return (dx * dx) + (dy * dy) + (dz * dz);
111+
}
112+
113+
public final float normalize() {
114+
final float magnitude = length();
115+
116+
// TODO: I'm choosing safety over speed here.
117+
if (magnitude != 0.0f) {
118+
x /= magnitude;
119+
y /= magnitude;
120+
z /= magnitude;
121+
}
122+
123+
return magnitude;
124+
}
125+
126+
public final void zero() {
127+
set(0.0f, 0.0f, 0.0f);
128+
}
129+
130+
public final boolean pointsInSameDirection(Vector3 other) {
131+
return this.dot(other) > 0;
132+
}
135133

136134
}

MPChartLib/src/main/java/com/github/mikephil/charting/model/GradientColor.java

Lines changed: 47 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -6,64 +6,55 @@
66
* Deprecated. Use `Fill`
77
*/
88
@Deprecated
9-
public class GradientColor extends Fill
10-
{
11-
/**
12-
* Deprecated. Use `Fill.getGradientColors()`
13-
*/
14-
@Deprecated
15-
public int getStartColor()
16-
{
17-
return getGradientColors()[0];
18-
}
9+
public class GradientColor extends Fill {
10+
/**
11+
* Deprecated. Use `Fill.getGradientColors()`
12+
*/
13+
@Deprecated
14+
public int getStartColor() {
15+
return getGradientColors()[0];
16+
}
1917

20-
/**
21-
* Deprecated. Use `Fill.setGradientColors(...)`
22-
*/
23-
@Deprecated
24-
public void setStartColor(int startColor)
25-
{
26-
if (getGradientColors() == null || getGradientColors().length != 2)
27-
{
28-
setGradientColors(new int[]{
29-
startColor,
30-
getGradientColors() != null && getGradientColors().length > 1
31-
? getGradientColors()[1]
32-
: 0
33-
});
34-
} else
35-
{
36-
getGradientColors()[0] = startColor;
37-
}
38-
}
18+
/**
19+
* Deprecated. Use `Fill.setGradientColors(...)`
20+
*/
21+
@Deprecated
22+
public void setStartColor(int startColor) {
23+
if (getGradientColors() == null || getGradientColors().length != 2) {
24+
setGradientColors(new int[]{
25+
startColor,
26+
getGradientColors() != null && getGradientColors().length > 1
27+
? getGradientColors()[1]
28+
: 0
29+
});
30+
} else {
31+
getGradientColors()[0] = startColor;
32+
}
33+
}
3934

40-
/**
41-
* Deprecated. Use `Fill.getGradientColors()`
42-
*/
43-
@Deprecated
44-
public int getEndColor()
45-
{
46-
return getGradientColors()[1];
47-
}
35+
/**
36+
* Deprecated. Use `Fill.getGradientColors()`
37+
*/
38+
@Deprecated
39+
public int getEndColor() {
40+
return getGradientColors()[1];
41+
}
4842

49-
/**
50-
* Deprecated. Use `Fill.setGradientColors(...)`
51-
*/
52-
@Deprecated
53-
public void setEndColor(int endColor)
54-
{
55-
if (getGradientColors() == null || getGradientColors().length != 2)
56-
{
57-
setGradientColors(new int[]{
58-
getGradientColors() != null && getGradientColors().length > 0
59-
? getGradientColors()[0]
60-
: 0,
61-
endColor
62-
});
63-
} else
64-
{
65-
getGradientColors()[1] = endColor;
66-
}
67-
}
43+
/**
44+
* Deprecated. Use `Fill.setGradientColors(...)`
45+
*/
46+
@Deprecated
47+
public void setEndColor(int endColor) {
48+
if (getGradientColors() == null || getGradientColors().length != 2) {
49+
setGradientColors(new int[]{
50+
getGradientColors() != null && getGradientColors().length > 0
51+
? getGradientColors()[0]
52+
: 0,
53+
endColor
54+
});
55+
} else {
56+
getGradientColors()[1] = endColor;
57+
}
58+
}
6859

6960
}

0 commit comments

Comments
 (0)