/
NikolayIvkin
/
MPAndroidChart1
Обзор
Документация
Войти
/
NikolayIvkin
/
MPAndroidChart1
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
MPChartLib/src/main/java/com/github/mikephil/charting/utils/MPPointD.java
52 строки
1 KB
Philipp Jahoda
Rename PointD to MPPointD
02 июл 2016, 13:36
02 июл 2016, 13:36
6d21817
Код
Авторство
О чём код?
package com.github.mikephil.charting.utils; import java.util.List; /** * Point encapsulating two double values. * * @author Philipp Jahoda */ public class MPPointD extends ObjectPool.Poolable { private static ObjectPool<MPPointD> pool; static { pool = ObjectPool.create(64, new MPPointD(0,0)); pool.setReplenishPercentage(0.5f); } public static MPPointD getInstance(double x, double y){ MPPointD result = pool.get(); result.x = x; result.y = y; return result; } public static void recycleInstance(MPPointD instance){ pool.recycle(instance); } public static void recycleInstances(List<MPPointD> instances){ pool.recycle(instances); } public double x; public double y; protected ObjectPool.Poolable instantiate(){ return new MPPointD(0,0); } private MPPointD(double x, double y) { this.x = x; this.y = y; } /** * returns a string representation of the object */ public String toString() { return "MPPointD, x: " + x + ", y: " + y; } }