1 #import <Foundation/Foundation.h>
2 #import "CPTDefinitions.h"
3 
4 /// @file
5 
6 /**	@brief Enumeration of possible results of a plot range comparison.
7  **/
8 typedef enum _CPTPlotRangeComparisonResult {
9     CPTPlotRangeComparisonResultNumberBelowRange,	///< Number is below the range.
10     CPTPlotRangeComparisonResultNumberInRange,		///< Number is in the range.
11     CPTPlotRangeComparisonResultNumberAboveRange		///< Number is above the range.
12 } CPTPlotRangeComparisonResult;
13 
14 @interface CPTPlotRange : NSObject <NSCoding, NSCopying> {
15 	@private
16 	NSDecimal location;
17 	NSDecimal length;
18     double locationDouble;
19 	double lengthDouble;
20 }
21 
22 /// @name Range Limits
23 /// @{
24 @property (nonatomic, readwrite) NSDecimal location;
25 @property (nonatomic, readwrite) NSDecimal length;
26 @property (nonatomic, readonly) NSDecimal end;
27 @property (nonatomic, readonly) double locationDouble;
28 @property (nonatomic, readonly) double lengthDouble;
29 @property (nonatomic, readonly) double endDouble;
30 
31 @property (nonatomic, readonly) NSDecimal minLimit;
32 @property (nonatomic, readonly) NSDecimal midPoint;
33 @property (nonatomic, readonly) NSDecimal maxLimit;
34 @property (nonatomic, readonly) double minLimitDouble;
35 @property (nonatomic, readonly) double midPointDouble;
36 @property (nonatomic, readonly) double maxLimitDouble;
37 ///	@}
38 
39 /// @name Factory Methods
40 /// @{
41 +(CPTPlotRange *)plotRangeWithLocation:(NSDecimal)loc length:(NSDecimal)len;
42 ///	@}
43 
44 /// @name Initialization
45 /// @{
46 -(id)initWithLocation:(NSDecimal)loc length:(NSDecimal)len;
47 ///	@}
48 
49 /// @name Checking Ranges
50 /// @{
51 -(BOOL)contains:(NSDecimal)number;
52 -(BOOL)containsDouble:(double)number;
53 -(BOOL)isEqualToRange:(CPTPlotRange *)otherRange;
54 ///	@}
55 
56 /// @name Combining Ranges
57 /// @{
58 -(void)unionPlotRange:(CPTPlotRange *)otherRange;
59 -(void)intersectionPlotRange:(CPTPlotRange *)otherRange;
60 ///	@}
61 
62 /// @name Shifting Ranges
63 /// @{
64 -(void)shiftLocationToFitInRange:(CPTPlotRange *)otherRange;
65 -(void)shiftEndToFitInRange:(CPTPlotRange *)otherRange;
66 ///	@}
67 
68 /// @name Expanding/Contracting Ranges
69 /// @{
70 -(void)expandRangeByFactor:(NSDecimal)factor;
71 ///	@}
72 
73 /// @name Range Comparison
74 /// @{
75 -(CPTPlotRangeComparisonResult)compareToNumber:(NSNumber *)number;
76 -(CPTPlotRangeComparisonResult)compareToDecimal:(NSDecimal)number;
77 -(CPTPlotRangeComparisonResult)compareToDouble:(double)number;
78 ///	@}
79 
80 @end
81