KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > monitorenter > gui > chart > rangepolicies > RangePolicyFixedViewport


1 /*
2  * RangePolicyFixedViewport.java, <enter purpose here>.
3  * Copyright (C) 2006 Achim Westermann, Achim.Westermann@gmx.de
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * If you modify or optimize the code in a useful way please let me know.
20  * Achim.Westermann@gmx.de
21  */

22 package info.monitorenter.gui.chart.rangepolicies;
23
24 import info.monitorenter.util.Range;
25
26 /**
27  * <p>
28  * A range policy that forces the chart only to display the bounds of the
29  * internal range regardless of the actual bounds of the traces within the
30  * chart.
31  * </p>
32  *
33  * @author <a HREF="mailto:Achim.Westermann@gmx.de">Achim Westermann </a>
34  *
35  * @version $Revision: 1.1 $
36  *
37  */

38 public final class RangePolicyFixedViewport extends ARangePolicy {
39   /**
40    * Creates a range policy with an unconfigured range ({@link Range#RANGE_UNBOUNDED}).
41    * <p>
42    */

43   public RangePolicyFixedViewport() {
44     super();
45   }
46
47   /**
48    * Creates a range policy backed by the given range.
49    * <p>
50    *
51    * @param range
52    * the range that may be used to decide about the policy of
53    * displaying the range.
54    */

55   public RangePolicyFixedViewport(final Range range) {
56     super(range);
57   }
58
59   /**
60    * Returns the fixed maximum of the internal range.
61    * <p>
62    *
63    * @param chartMax
64    * ignored.
65    *
66    * @param chartMin
67    * ignored.
68    *
69    * @return the fixed maximum of the internal range.
70    *
71    * @see info.monitorenter.gui.chart.IRangePolicy#getMax(double, double)
72    */

73   public double getMax(final double chartMin, final double chartMax) {
74     return this.getRange().getMax();
75   }
76
77   /**
78    * Returns the fixed minimum of the internal range.
79    * <p>
80    *
81    * @param chartMin
82    * ignored.
83    *
84    * @param chartMax
85    * ignored.
86    *
87    * @return the fixed minimum of the internal range.
88    *
89    * @see info.monitorenter.gui.chart.IRangePolicy#getMin(double, double)
90    */

91   public double getMin(final double chartMin, final double chartMax) {
92     return this.getRange().getMin();
93   }
94
95 }
96
Popular Tags