Skip to content

Commit b76453f

Browse files
authored
Merge pull request #466 from AppDevNext/CodeCosmetic
Code cosmetic
2 parents 623304a + 66b3fd2 commit b76453f

File tree

4 files changed

+23
-32
lines changed

4 files changed

+23
-32
lines changed

MPChartLib/src/main/java/com/github/mikephil/charting/data/BarEntry.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import kotlin.math.abs
99
* Entry class for the BarChart. (especially stacked bars)
1010
*/
1111
@SuppressLint("ParcelCreator")
12-
class BarEntry : Entry {
12+
open class BarEntry : Entry {
1313
/**
1414
* Returns the stacked values this BarEntry represents, or null, if only a single value is represented (then, use
1515
* getY()).

MPChartLib/src/main/java/com/github/mikephil/charting/data/BaseEntry.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import android.graphics.drawable.Drawable
44

55
abstract class BaseEntry {
66

7-
protected var _y: Float = 0f
7+
protected var yBase: Float = 0f
88
open var y: Float
9-
get() = _y
9+
get() = yBase
1010
set(value) {
11-
_y = value
11+
yBase = value
1212
}
1313

1414
var data: Any? = null
@@ -18,7 +18,7 @@ abstract class BaseEntry {
1818
constructor()
1919

2020
constructor(y: Float) {
21-
this._y = y
21+
this.yBase = y
2222
}
2323

2424
constructor(y: Float, data: Any?) : this(y) {

MPChartLib/src/main/java/com/github/mikephil/charting/data/DataSet.java

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ protected void copy(DataSet dataSet) {
169169
super.copy(dataSet);
170170
}
171171

172-
@Override
172+
@Override
173173
public String toString() {
174174
StringBuilder buffer = new StringBuilder();
175175
buffer.append(toSimpleString());
@@ -184,11 +184,12 @@ public String toString() {
184184
* the number of Entries.
185185
*/
186186
public String toSimpleString() {
187-
StringBuilder buffer = new StringBuilder();
188-
buffer.append("DataSet, label: " + (getLabel() == null ? "" : getLabel()) + ", entries: " + mEntries.size() +
189-
"\n");
190-
return buffer.toString();
191-
}
187+
return "DataSet, label: " +
188+
(getLabel() == null ? "" : getLabel()) +
189+
", entries: " +
190+
mEntries.size() +
191+
"\n";
192+
}
192193

193194
@Override
194195
public float getYMin() {
@@ -210,11 +211,8 @@ public float getXMax() {
210211
return mXMax;
211212
}
212213

213-
@Override
214-
public void addEntryOrdered(T entry) {
215-
216-
if (entry == null)
217-
return;
214+
@Override
215+
public void addEntryOrdered(T entry) {
218216

219217
if (mEntries == null) {
220218
mEntries = new ArrayList<>();
@@ -236,28 +234,21 @@ public void clear() {
236234
notifyDataSetChanged();
237235
}
238236

239-
@Override
240-
public boolean addEntry(T entry) {
241-
242-
if (entry == null)
243-
return false;
244-
245-
List<T> values = getEntries();
246-
if (values == null) {
247-
values = new ArrayList<>();
248-
}
237+
@Override
238+
public boolean addEntry(T entry) {
239+
List<T> values = getEntries();
240+
if (values == null) {
241+
values = new ArrayList<>();
242+
}
249243

250244
calcMinMax(entry);
251245

252246
// add the entry
253247
return values.add(entry);
254248
}
255249

256-
@Override
257-
public boolean removeEntry(T entry) {
258-
259-
if (entry == null)
260-
return false;
250+
@Override
251+
public boolean removeEntry(T entry) {
261252

262253
if (mEntries == null)
263254
return false;

MPChartLib/src/main/java/com/github/mikephil/charting/data/Entry.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ open class Entry : BaseEntry, Parcelable, Serializable {
125125

126126
protected constructor(`in`: Parcel) {
127127
this._x = `in`.readFloat()
128-
this._y = `in`.readFloat()
128+
this.yBase = `in`.readFloat()
129129
if (`in`.readInt() == 1) {
130130
this.data = `in`.readParcelable(Any::class.java.classLoader)
131131
}

0 commit comments

Comments
 (0)