Debian Codegraph @

src/com/jidesoft/range/Range.java

raw
1 /*
2 * @(#)Range.java
3 *
4 * 2002 - 2012 JIDE Software Incorporated. All rights reserved.
5 * Copyright (c) 2005 - 2012 Catalysoft Limited. All rights reserved.
6 */
7
8 package com.jidesoft.range;
9
10 import java.beans.PropertyChangeListener;
11
12 /**
13 * @author Simon White ([email protected])
14 */
15 public interface Range<T> {
16 /**
17 * The name of the minimum property. Used when firing property change events
18 */
19 public static final String PROPERTY_MIN = "min";
20
21 /**
22 * The name of the maximum property. Used when firing property change events
23 */
24 public static final String PROPERTY_MAX = "max";
25
26 /**
27 * @return the smallest value of the range
28 */
29 public T lower();
30
31 /**
32 * @return the largest value of the range
33 */
34 public T upper();
35
36 /**
37 * Adjusts the range.
38 *
39 * @param lower the new smallest value of the range
40 * @param upper the new largest value of the range
41 */
42 void adjust(T lower, T upper);
43
44 /**
45 * This may be the numeric representation of lower() or it may be rounded down.
46 *
47 * @return the numeric value of the smallest value to include in the range.
48 */
49 public double minimum();
50
51 /**
52 * This may be the numeric representation of upper() or it may be rounded up.
53 *
54 * @return The numeric value of the largest value to include in the range.
55 */
56 public double maximum();
57
58 /**
59 * Compute the size of the range
60 */
61 public double size();
62
63 /**
64 * Determines whether the supplied point lies within this range. For continuous ranges this is interpreted as a pair
65 * of inequalities on the supplied value (i.e., min <= x <= max), but for discrete ranges the
66 * <code>contains()</code> method is more like a set membership test.
67 *
68 * @param x
69 * @return a boolean to indicate whether the supplied point lies within the range
70 */
71 public boolean contains(T x);
72
73 /**
74 * You can add a property change listener if you are interested to know when the range changes
75 *
76 * @param listener the new property change listener
77 */
78 public void addPropertyChangeListener(PropertyChangeListener listener);
79
80 /**
81 * Remove a property change listener
82 *
83 * @param listener the <code>PropertyChangeListener</code> to remove
84 */
85 public void removePropertyChangeListener(PropertyChangeListener listener);
86
87 /**
88 * Gets the registered property change listeners.
89 *
90 * @return the registered property change listeners.
91 */
92 public PropertyChangeListener[] getPropertyChangeListeners();
93
94 /**
95 * Gets the registered property change listeners for a property.
96 *
97 * @return the registered property change listeners for a property.
98 */
99 public PropertyChangeListener[] getPropertyChangeListeners(String propertyName);
100
101 }