/src/main/java/com/googlecode/charts4j/AbstractMarker.java

http://charts4j.googlecode.com/ · Java · 95 lines · 24 code · 10 blank · 61 comment · 0 complexity · 7eda102b5d34ef2119b8e32b41b42fb9 MD5 · raw file

  1. /**
  2. *
  3. * The MIT License
  4. *
  5. * Copyright (c) 2011 the original author or authors.
  6. *
  7. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8. * of this software and associated documentation files (the "Software"), to deal
  9. * in the Software without restriction, including without limitation the rights
  10. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. * copies of the Software, and to permit persons to whom the Software is
  12. * furnished to do so, subject to the following conditions:
  13. * The above copyright notice and this permission notice shall be included in
  14. * all copies or substantial portions of the Software.
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. * THE SOFTWARE.
  22. */
  23. package com.googlecode.charts4j;
  24. import static com.googlecode.charts4j.collect.Preconditions.*;
  25. /**
  26. * Abstract type that contains code common to text and shape markers.
  27. *
  28. * @author Julien Chastang (julien.c.chastang at gmail dot com)
  29. *
  30. */
  31. abstract class AbstractMarker implements Marker {
  32. /** Marker color. **/
  33. private final Color color;
  34. /** Marker size. **/
  35. private final int size;
  36. /** Marker priority. **/
  37. private final Priority priority;
  38. /**
  39. * Create a marker.
  40. *
  41. * @param color
  42. * Color of marker. Cannot be null.
  43. *
  44. * @param size
  45. * The size of the shape marker. Must be > 0.
  46. *
  47. * @param priority
  48. * The priority to set. Cannot be null.
  49. *
  50. */
  51. AbstractMarker(final Color color, final int size, final Priority priority) {
  52. checkNotNull(color);
  53. checkNotNull(priority);
  54. checkArgument(size > 0);
  55. this.color = color;
  56. this.size = size;
  57. this.priority = priority;
  58. }
  59. /**
  60. * Get the marker color.
  61. *
  62. * @return color
  63. */
  64. public Color getColor() {
  65. return color;
  66. }
  67. /**
  68. * Get the marker size.
  69. *
  70. * @return size
  71. */
  72. public int getSize() {
  73. return size;
  74. }
  75. /**
  76. * Get the marker priority.
  77. *
  78. * @return priority
  79. */
  80. public Priority getPriority() {
  81. return priority;
  82. }
  83. }