Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import kotlin.math.abs
* Entry class for the BarChart. (especially stacked bars)
*/
@SuppressLint("ParcelCreator")
class BarEntry : Entry {
open class BarEntry : Entry {
/**
* Returns the stacked values this BarEntry represents, or null, if only a single value is represented (then, use
* getY()).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import android.graphics.drawable.Drawable

abstract class BaseEntry {

protected var _y: Float = 0f
protected var yBase: Float = 0f
open var y: Float
get() = _y
get() = yBase
set(value) {
_y = value
yBase = value
}

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

constructor(y: Float) {
this._y = y
this.yBase = y
}

constructor(y: Float, data: Any?) : this(y) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ protected void copy(DataSet dataSet) {
super.copy(dataSet);
}

@Override
@Override
public String toString() {
StringBuilder buffer = new StringBuilder();
buffer.append(toSimpleString());
Expand All @@ -184,11 +184,12 @@ public String toString() {
* the number of Entries.
*/
public String toSimpleString() {
StringBuilder buffer = new StringBuilder();
buffer.append("DataSet, label: " + (getLabel() == null ? "" : getLabel()) + ", entries: " + mEntries.size() +
"\n");
return buffer.toString();
}
return "DataSet, label: " +
(getLabel() == null ? "" : getLabel()) +
", entries: " +
mEntries.size() +
"\n";
}

@Override
public float getYMin() {
Expand All @@ -210,11 +211,8 @@ public float getXMax() {
return mXMax;
}

@Override
public void addEntryOrdered(T entry) {

if (entry == null)
return;
@Override
public void addEntryOrdered(T entry) {

if (mEntries == null) {
mEntries = new ArrayList<>();
Expand All @@ -236,28 +234,21 @@ public void clear() {
notifyDataSetChanged();
}

@Override
public boolean addEntry(T entry) {

if (entry == null)
return false;

List<T> values = getEntries();
if (values == null) {
values = new ArrayList<>();
}
@Override
public boolean addEntry(T entry) {
List<T> values = getEntries();
if (values == null) {
values = new ArrayList<>();
}

calcMinMax(entry);

// add the entry
return values.add(entry);
}

@Override
public boolean removeEntry(T entry) {

if (entry == null)
return false;
@Override
public boolean removeEntry(T entry) {

if (mEntries == null)
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ open class Entry : BaseEntry, Parcelable, Serializable {

protected constructor(`in`: Parcel) {
this._x = `in`.readFloat()
this._y = `in`.readFloat()
this.yBase = `in`.readFloat()
if (`in`.readInt() == 1) {
this.data = `in`.readParcelable(Any::class.java.classLoader)
}
Expand Down
Loading