KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfree > chart > IntervalMarker


1 /* ======================================
2  * JFreeChart : a free Java chart library
3  * ======================================
4  *
5  * Project Info: http://www.jfree.org/jfreechart/index.html
6  * Project Lead: David Gilbert (david.gilbert@object-refinery.com);
7  *
8  * (C) Copyright 2000-2002, by Object Refinery Limited and Contributors.
9  *
10  * This library is free software; you can redistribute it and/or modify it under the terms
11  * of the GNU Lesser General Public License as published by the Free Software Foundation;
12  * either version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
15  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License along with this
19  * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20  * Boston, MA 02111-1307, USA.
21  *
22  * -------------------
23  * IntervalMarker.java
24  * -------------------
25  * (C) Copyright 2002, 2003, by Object Refinery Limited.
26  *
27  * Original Author: David Gilbert (for Object Refinery Limited);
28  * Contributor(s): -;
29  *
30  * $Id: IntervalMarker.java,v 1.3 2003/09/18 13:12:44 mungady Exp $
31  *
32  * Changes (since 20-Aug-2002)
33  * --------------------------
34  * 20-Aug-2002 : Added stroke to constructor in Marker class (DG);
35  * 02-Oct-2002 : Fixed errors reported by Checkstyle (DG);
36  * 26-Mar-2003 : Implemented Serializable (DG);
37  *
38  */

39
40 package org.jfree.chart;
41
42 import java.awt.Color JavaDoc;
43 import java.awt.Paint JavaDoc;
44 import java.awt.Stroke JavaDoc;
45 import java.io.Serializable JavaDoc;
46
47 /**
48  * Represents an interval to be highlighted in some way.
49  *
50  * @author David Gilbert
51  */

52 public class IntervalMarker extends Marker implements Cloneable JavaDoc, Serializable JavaDoc {
53
54     /** The start value. */
55     private double startValue;
56
57     /** The end value. */
58     private double endValue;
59
60     /** The label. */
61     private String JavaDoc label;
62
63     /**
64      * Constructs an interval marker.
65      *
66      * @param start the start of the interval.
67      * @param end the end of the interval.
68      */

69     public IntervalMarker(double start, double end) {
70
71         this(start, end, null, Color.gray, new java.awt.BasicStroke JavaDoc(0.5f), Color.blue, 0.8f);
72     }
73
74     /**
75      * Constructs an interval marker.
76      *
77      * @param start the start of the interval.
78      * @param end the end of the interval.
79      * @param label the interval label (null permitted).
80      * @param outlinePaint the outline paint.
81      * @param outlineStroke the outline stroke.
82      * @param paint the fill paint.
83      * @param alpha the alpha transparency.
84      */

85     public IntervalMarker(double start, double end, String JavaDoc label,
86                           Paint JavaDoc outlinePaint, Stroke JavaDoc outlineStroke, Paint JavaDoc paint, float alpha) {
87
88         super((start + end) / 2, outlinePaint, outlineStroke, paint, alpha);
89         this.startValue = start;
90         this.endValue = end;
91         this.label = label;
92     }
93
94     /**
95      * Returns the start value for the interval.
96      *
97      * @return The start value.
98      */

99     public double getStartValue() {
100         return this.startValue;
101     }
102
103     /**
104      * Returns the end value for the interval.
105      *
106      * @return The end value.
107      */

108     public double getEndValue() {
109         return this.endValue;
110     }
111
112     /**
113      * Returns the label for the interval (possibly null).
114      *
115      * @return The label.
116      */

117     public String JavaDoc getLabel() {
118         return this.label;
119     }
120     
121     /**
122      * Returns a clone of the marker.
123      *
124      * @return A clone.
125      *
126      * @throws CloneNotSupportedException Not thrown by this class, but the exception is declared
127      * for the use of subclasses.
128      */

129     public Object JavaDoc clone() throws CloneNotSupportedException JavaDoc {
130         return super.clone();
131     }
132         
133
134 }
135
Popular Tags