KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfree > chart > renderer > RangeType


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-2003, 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  * RangeType.java
24  * --------------
25  * (C) Copyright 2003 by Object Refinery Limited.
26  *
27  * Original Author: David Gilbert (for Object Refinery Limited);
28  * Contributor(s): -;
29  *
30  * $Id: RangeType.java,v 1.4 2003/10/21 10:50:18 mungady Exp $
31  *
32  * Changes:
33  * --------
34  * 07-May-2003 : Version 1 (DG);
35  *
36  */

37
38 package org.jfree.chart.renderer;
39
40 /**
41  * An enumeration of the 'range types' for a renderer. This is used when calculating the axis
42  * range required to display all the data in a dataset...the result will depend on whether the
43  * renderer plots the values directly (STANDARD) or stacks them (STACKED).
44  *
45  * @author David Gilbert
46  */

47 public class RangeType {
48
49     /**
50      * The overall range is determined by looking at the individual values.
51      */

52     public static final RangeType STANDARD = new RangeType("RangeType.STANDARD");
53
54     /**
55      * The overall range is determined by looking at the sums of the values within each
56      * category.
57      */

58     public static final RangeType STACKED = new RangeType("RangeType.STACKED");
59     
60     /**
61      * The overall range is determined by looking at the running total within each series.
62      */

63     public static final RangeType SERIES_CUMULATIVE = new RangeType("RangeType.SERIES_CUMULATIVE");
64
65     /** The name. */
66     private String JavaDoc name;
67
68     /**
69      * Private constructor.
70      *
71      * @param name the name.
72      */

73     private RangeType(String JavaDoc name) {
74         this.name = name;
75     }
76
77     /**
78      * Returns a string representing the object.
79      *
80      * @return The string.
81      */

82     public String JavaDoc toString() {
83         return this.name;
84     }
85
86     /**
87      * Returns <code>true</code> if this object is equal to the specified object, and
88      * <code>false</code> otherwise.
89      *
90      * @param o the other object.
91      *
92      * @return A boolean.
93      */

94     public boolean equals(Object JavaDoc o) {
95
96         if (this == o) {
97             return true;
98         }
99         if (!(o instanceof RangeType)) {
100             return false;
101         }
102
103         final RangeType order = (RangeType) o;
104         if (!this.name.equals(order.toString())) {
105             return false;
106         }
107
108         return true;
109
110     }
111
112 }
113
Popular Tags