Line | |
---|
1 | package {
|
---|
2 |
|
---|
3 | public class Range
|
---|
4 | {
|
---|
5 | public var min:Number;
|
---|
6 | public var max:Number;
|
---|
7 | public var step:Number;
|
---|
8 | public var offset:Boolean;
|
---|
9 |
|
---|
10 | public function Range( min:Number, max:Number, step:Number, offset:Boolean )
|
---|
11 | {
|
---|
12 | this.min = min;
|
---|
13 | this.max = max;
|
---|
14 | this.step = step;
|
---|
15 | this.offset = offset;
|
---|
16 | }
|
---|
17 |
|
---|
18 | public function count():Number {
|
---|
19 | //
|
---|
20 | // range, 5 - 10 = 10 - 5 = 5
|
---|
21 | // range -5 - 5 = 5 - -5 = 10
|
---|
22 | //
|
---|
23 | //
|
---|
24 | // x_offset:
|
---|
25 | //
|
---|
26 | // False True
|
---|
27 | //
|
---|
28 | // | |
|
---|
29 | // | |
|
---|
30 | // | |
|
---|
31 | // +--+--+--+ |-+--+--+--+-+
|
---|
32 | // 0 1 2 3 0 1 2 3
|
---|
33 | //
|
---|
34 | // Don't forget this is also used in radar axis
|
---|
35 | //
|
---|
36 | if( this.offset )
|
---|
37 | return (this.max - this.min) + 1;
|
---|
38 | else
|
---|
39 | return this.max - this.min;
|
---|
40 | }
|
---|
41 |
|
---|
42 | public function toString():String {
|
---|
43 | return 'Range : ' + this.min +', ' + this.max;
|
---|
44 | }
|
---|
45 | }
|
---|
46 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.