PageRenderTime 21ms CodeModel.GetById 17ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/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
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 * THE SOFTWARE.
24 */
25
26package com.googlecode.charts4j;
27
28import static com.googlecode.charts4j.collect.Preconditions.*;
29
30/**
31 * Abstract type that contains code common to text and shape markers.
32 *
33 * @author Julien Chastang (julien.c.chastang at gmail dot com)
34 *
35 */
36abstract class AbstractMarker implements Marker {
37
38    /** Marker color.  **/
39    private final Color    color;
40
41    /** Marker size.  **/
42    private final int      size;
43
44    /** Marker priority.  **/
45    private final Priority priority;
46
47    /**
48     * Create a marker.
49     *
50     * @param color
51     *            Color of marker. Cannot be null.
52     *
53     * @param size
54     *            The size of the shape marker. Must be > 0.
55     *
56     * @param priority
57     *            The priority to set. Cannot be null.
58     *
59     */
60    AbstractMarker(final Color color, final int size, final Priority priority) {
61        checkNotNull(color);
62        checkNotNull(priority);
63        checkArgument(size > 0);
64        this.color = color;
65        this.size = size;
66        this.priority = priority;
67    }
68
69    /**
70     * Get the marker color.
71     *
72     * @return color
73     */
74    public Color getColor() {
75        return color;
76    }
77
78    /**
79     * Get the marker size.
80     *
81     * @return size
82     */
83    public int getSize() {
84        return size;
85    }
86
87    /**
88     * Get the marker priority.
89     *
90     * @return priority
91     */
92    public Priority getPriority() {
93        return priority;
94    }
95}