@@ -11,7 +11,7 @@ import kotlin.math.abs
1111 * LineChart, or the values of a specific group of bars in the BarChart).
1212 */
1313abstract class DataSet <T : Entry >(
14- protected var mEntries : MutableList <T >,
14+ protected var entriesInternal : MutableList <T >,
1515 label : String = " "
1616) : BaseDataSet<T>(label), Serializable {
1717 /* *
@@ -53,11 +53,11 @@ abstract class DataSet<T : Entry>(
5353 this .xMax = - Float .MAX_VALUE
5454 this .xMin = Float .MAX_VALUE
5555
56- if (mEntries .isEmpty()) {
56+ if (entriesInternal .isEmpty()) {
5757 return
5858 }
5959
60- for (e in mEntries ) {
60+ for (e in entriesInternal ) {
6161 calcMinMax(e)
6262 }
6363 }
@@ -66,7 +66,7 @@ abstract class DataSet<T : Entry>(
6666 this .yMax = - Float .MAX_VALUE
6767 this .yMin = Float .MAX_VALUE
6868
69- if (mEntries .isEmpty()) {
69+ if (entriesInternal .isEmpty()) {
7070 return
7171 }
7272
@@ -80,7 +80,7 @@ abstract class DataSet<T : Entry>(
8080 for (i in indexFrom.. indexTo) {
8181 // only recalculate y
8282
83- calcMinMaxY(mEntries [i])
83+ calcMinMaxY(entriesInternal [i])
8484 }
8585 }
8686
@@ -113,15 +113,15 @@ abstract class DataSet<T : Entry>(
113113 }
114114
115115 override val entryCount: Int
116- get() = mEntries .size
116+ get() = entriesInternal .size
117117
118118 /* *
119119 * Returns the array of entries that this DataSet represents.
120120 */
121121 var entries: MutableList <T >
122- get() = mEntries
122+ get() = entriesInternal
123123 set(entries) {
124- mEntries = entries
124+ entriesInternal = entries
125125 notifyDataChanged()
126126 }
127127
@@ -137,30 +137,30 @@ abstract class DataSet<T : Entry>(
137137 override fun toString (): String {
138138 val buffer = StringBuilder ()
139139 buffer.append(toSimpleString())
140- for (i in mEntries .indices) {
141- buffer.append(mEntries [i].toString()).append(" " )
140+ for (i in entriesInternal .indices) {
141+ buffer.append(entriesInternal [i].toString()).append(" " )
142142 }
143143 return buffer.toString()
144144 }
145145
146146 /* *
147147 * Returns a simple string representation of the DataSet with the type and the number of Entries.
148148 */
149- fun toSimpleString () = " DataSet, label: $label , entries: ${mEntries .size} "
149+ fun toSimpleString () = " DataSet, label: $label , entries: ${entriesInternal .size} "
150150
151151 override fun addEntryOrdered (entry : T ) {
152152 calcMinMax(entry)
153153
154- if (! mEntries .isEmpty() && mEntries[mEntries .size - 1 ].x > entry.x) {
154+ if (! entriesInternal .isEmpty() && entriesInternal[entriesInternal .size - 1 ].x > entry.x) {
155155 val closestIndex = getEntryIndex(entry.x, entry.y, Rounding .UP )
156- mEntries .add(closestIndex, entry)
156+ entriesInternal .add(closestIndex, entry)
157157 } else {
158- mEntries .add(entry)
158+ entriesInternal .add(entry)
159159 }
160160 }
161161
162162 override fun clear () {
163- mEntries .clear()
163+ entriesInternal .clear()
164164 notifyDataChanged()
165165 }
166166
@@ -171,7 +171,7 @@ abstract class DataSet<T : Entry>(
171171 }
172172
173173 override fun removeEntry (entry : T ): Boolean {
174- val removed = mEntries .remove(entry)
174+ val removed = entriesInternal .remove(entry)
175175
176176 if (removed) {
177177 calcMinMax()
@@ -180,14 +180,14 @@ abstract class DataSet<T : Entry>(
180180 }
181181
182182 override fun getEntryIndex (entry : T ): Int {
183- return mEntries .indexOf(entry)
183+ return entriesInternal .indexOf(entry)
184184 }
185185
186186
187187 override fun getEntryForXValue (xValue : Float , closestToY : Float , rounding : Rounding ? ): T ? {
188188 val index = getEntryIndex(xValue, closestToY, rounding)
189189 if (index > - 1 ) {
190- return mEntries [index]
190+ return entriesInternal [index]
191191 }
192192 return null
193193 }
@@ -200,28 +200,28 @@ abstract class DataSet<T : Entry>(
200200 if (index < 0 ) {
201201 Timber .e(" index $index is < 0 for getEntryForIndex" )
202202 return null
203- } else if (index >= mEntries .size) {
204- Timber .e(" index $index / ${mEntries .size} is out of range for getEntryForIndex" )
203+ } else if (index >= entriesInternal .size) {
204+ Timber .e(" index $index / ${entriesInternal .size} is out of range for getEntryForIndex" )
205205 return null
206206 }
207- return mEntries [index]
207+ return entriesInternal [index]
208208 }
209209
210210 override fun getEntryIndex (xValue : Float , closestToY : Float , rounding : Rounding ? ): Int {
211- if (mEntries .isEmpty()) {
211+ if (entriesInternal .isEmpty()) {
212212 return - 1
213213 }
214214
215215 var low = 0
216- var high = mEntries .size - 1
216+ var high = entriesInternal .size - 1
217217 var closest = high
218218
219219 while (low < high) {
220220 val m = low + (high - low) / 2
221221
222- val currentEntry: Entry = mEntries [m]
222+ val currentEntry: Entry = entriesInternal [m]
223223
224- val nextEntry: Entry = mEntries [m + 1 ]
224+ val nextEntry: Entry = entriesInternal [m + 1 ]
225225
226226 val d1 = currentEntry.x - xValue
227227 val d2 = nextEntry.x - xValue
@@ -230,7 +230,7 @@ abstract class DataSet<T : Entry>(
230230
231231 if (ad2 < ad1) {
232232 // [m + 1] is closer to xValue
233- // Search in an higher place
233+ // Search in a higher place
234234 low = m + 1
235235 } else if (ad1 < ad2) {
236236 // [m] is closer to xValue
@@ -243,19 +243,19 @@ abstract class DataSet<T : Entry>(
243243 // Search in a lower place
244244 high = m
245245 } else if (d1 < 0.0 ) {
246- // Search in an higher place
246+ // Search in a higher place
247247 low = m + 1
248248 }
249249 }
250250
251251 closest = high
252252 }
253253
254- val closestEntry: Entry = mEntries [closest]
254+ val closestEntry: Entry = entriesInternal [closest]
255255 val closestXValue = closestEntry.x
256256 if (rounding == Rounding .UP ) {
257257 // If rounding up, and found x-value is lower than specified x, and we can go upper...
258- if (closestXValue < xValue && closest < mEntries .size - 1 ) {
258+ if (closestXValue < xValue && closest < entriesInternal .size - 1 ) {
259259 ++ closest
260260 }
261261 } else if (rounding == Rounding .DOWN ) {
@@ -267,7 +267,7 @@ abstract class DataSet<T : Entry>(
267267
268268 // Search by closest to y-value
269269 if (! closestToY.isNaN()) {
270- while (closest > 0 && mEntries [closest - 1 ].x == closestXValue) {
270+ while (closest > 0 && entriesInternal [closest - 1 ].x == closestXValue) {
271271 closest - = 1
272272 }
273273
@@ -276,11 +276,11 @@ abstract class DataSet<T : Entry>(
276276
277277 while (true ) {
278278 closest + = 1
279- if (closest >= mEntries .size) {
279+ if (closest >= entriesInternal .size) {
280280 break
281281 }
282282
283- val value: T = mEntries [closest]
283+ val value: T = entriesInternal [closest]
284284
285285 if (value.x != closestXValue) {
286286 break
@@ -301,23 +301,23 @@ abstract class DataSet<T : Entry>(
301301 val entries: MutableList <T > = mutableListOf ()
302302
303303 var low = 0
304- var high = mEntries .size - 1
304+ var high = entriesInternal .size - 1
305305
306306 while (low <= high) {
307307 var m = (high + low) / 2
308- var entry = mEntries [m]
308+ var entry = entriesInternal [m]
309309
310310 // if we have a match
311311 if (xValue == entry.x) {
312- while (m > 0 && mEntries [m - 1 ].x == xValue) {
312+ while (m > 0 && entriesInternal [m - 1 ].x == xValue) {
313313 m--
314314 }
315315
316- high = mEntries .size
316+ high = entriesInternal .size
317317
318318 // loop over all "equal" entries
319319 while (m < high) {
320- entry = mEntries [m]
320+ entry = entriesInternal [m]
321321 if (entry.x == xValue) {
322322 entries.add(entry)
323323 } else {
0 commit comments