BaseEntry.java 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. package com.github.mikephil.charting.data;
  2. import android.graphics.drawable.Drawable;
  3. /**
  4. * Created by Philipp Jahoda on 02/06/16.
  5. */
  6. public abstract class BaseEntry {
  7. /** the y value */
  8. private float y = 0f;
  9. /** optional spot for additional data this Entry represents */
  10. private Object mData = null;
  11. /** optional icon image */
  12. private Drawable mIcon = null;
  13. public BaseEntry() {
  14. }
  15. public BaseEntry(float y) {
  16. this.y = y;
  17. }
  18. public BaseEntry(float y, Object data) {
  19. this(y);
  20. this.mData = data;
  21. }
  22. public BaseEntry(float y, Drawable icon) {
  23. this(y);
  24. this.mIcon = icon;
  25. }
  26. public BaseEntry(float y, Drawable icon, Object data) {
  27. this(y);
  28. this.mIcon = icon;
  29. this.mData = data;
  30. }
  31. /**
  32. * Returns the y value of this Entry.
  33. *
  34. * @return
  35. */
  36. public float getY() {
  37. return y;
  38. }
  39. /**
  40. * Sets the icon drawable
  41. *
  42. * @param icon
  43. */
  44. public void setIcon(Drawable icon) {
  45. this.mIcon = icon;
  46. }
  47. /**
  48. * Returns the icon of this Entry.
  49. *
  50. * @return
  51. */
  52. public Drawable getIcon() {
  53. return mIcon;
  54. }
  55. /**
  56. * Sets the y-value for the Entry.
  57. *
  58. * @param y
  59. */
  60. public void setY(float y) {
  61. this.y = y;
  62. }
  63. /**
  64. * Returns the data, additional information that this Entry represents, or
  65. * null, if no data has been specified.
  66. *
  67. * @return
  68. */
  69. public Object getData() {
  70. return mData;
  71. }
  72. /**
  73. * Sets additional data this Entry should represent.
  74. *
  75. * @param data
  76. */
  77. public void setData(Object data) {
  78. this.mData = data;
  79. }
  80. }