|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| Range.java | - | 0% | 0% | 0% |
|
||||||||||||||
| 1 |
/*
|
|
| 2 |
* EJTools, the Enterprise Java Tools
|
|
| 3 |
*
|
|
| 4 |
* Distributable under LGPL license.
|
|
| 5 |
* See terms of license at www.gnu.org.
|
|
| 6 |
*/
|
|
| 7 |
package org.ejtools.graph;
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
/**
|
|
| 11 |
* Description of the Class
|
|
| 12 |
*
|
|
| 13 |
* @author Laurent Etiemble
|
|
| 14 |
* @version $Revision: 1.7 $
|
|
| 15 |
* @todo Javadoc to complete
|
|
| 16 |
*/
|
|
| 17 |
public class Range |
|
| 18 |
{
|
|
| 19 |
/** Description of the Field */
|
|
| 20 |
protected double max = 0.0f; |
|
| 21 |
/** Description of the Field */
|
|
| 22 |
protected double min = 0.0f; |
|
| 23 |
/** Description of the Field */
|
|
| 24 |
public final static int X_AXIS = 0; |
|
| 25 |
/** Description of the Field */
|
|
| 26 |
public final static int Y_AXIS = 1; |
|
| 27 |
|
|
| 28 |
|
|
| 29 |
/**
|
|
| 30 |
*Constructor for the Range object
|
|
| 31 |
*
|
|
| 32 |
* @param min Description of the Parameter
|
|
| 33 |
* @param max Description of the Parameter
|
|
| 34 |
*/
|
|
| 35 | 0 |
public Range(double min, double max) |
| 36 |
{
|
|
| 37 | 0 |
this.min = (double) min; |
| 38 | 0 |
this.max = (double) max; |
| 39 |
} |
|
| 40 |
|
|
| 41 |
|
|
| 42 |
/**
|
|
| 43 |
* Description of the Method
|
|
| 44 |
*
|
|
| 45 |
* @param range Description of the Parameter
|
|
| 46 |
* @return Description of the Return Value
|
|
| 47 |
*/
|
|
| 48 | 0 |
public Range compose(Range range)
|
| 49 |
{
|
|
| 50 | 0 |
double nmin = Math.min(this.min, range.min); |
| 51 | 0 |
double nmax = Math.max(this.max, range.max); |
| 52 |
|
|
| 53 | 0 |
return new Range(nmin, nmax); |
| 54 |
} |
|
| 55 |
|
|
| 56 |
|
|
| 57 |
/**
|
|
| 58 |
* Gets the max attribute of the Range object
|
|
| 59 |
*
|
|
| 60 |
* @return The max value
|
|
| 61 |
*/
|
|
| 62 | 0 |
public double getMax() |
| 63 |
{
|
|
| 64 | 0 |
return this.max; |
| 65 |
} |
|
| 66 |
|
|
| 67 |
|
|
| 68 |
/**
|
|
| 69 |
* Gets the min attribute of the Range object
|
|
| 70 |
*
|
|
| 71 |
* @return The min value
|
|
| 72 |
*/
|
|
| 73 | 0 |
public double getMin() |
| 74 |
{
|
|
| 75 | 0 |
return this.min; |
| 76 |
} |
|
| 77 |
|
|
| 78 |
|
|
| 79 |
/**
|
|
| 80 |
* Description of the Method
|
|
| 81 |
*
|
|
| 82 |
* @param value Description of the Parameter
|
|
| 83 |
*/
|
|
| 84 | 0 |
public synchronized void put(double value) |
| 85 |
{
|
|
| 86 | 0 |
this.min = Math.min(this.min, value); |
| 87 | 0 |
this.max = Math.max(this.max, value); |
| 88 |
} |
|
| 89 |
|
|
| 90 |
|
|
| 91 |
/**
|
|
| 92 |
* Sets the max.
|
|
| 93 |
*
|
|
| 94 |
* @param max The max to set
|
|
| 95 |
*/
|
|
| 96 | 0 |
public void setMax(double max) |
| 97 |
{
|
|
| 98 | 0 |
this.max = max;
|
| 99 |
} |
|
| 100 |
|
|
| 101 |
|
|
| 102 |
/**
|
|
| 103 |
* Sets the min.
|
|
| 104 |
*
|
|
| 105 |
* @param min The min to set
|
|
| 106 |
*/
|
|
| 107 | 0 |
public void setMin(double min) |
| 108 |
{
|
|
| 109 | 0 |
this.min = min;
|
| 110 |
} |
|
| 111 |
|
|
| 112 |
|
|
| 113 |
/**
|
|
| 114 |
* Description of the Method
|
|
| 115 |
*
|
|
| 116 |
* @return Description of the Return Value
|
|
| 117 |
*/
|
|
| 118 | 0 |
public String toString()
|
| 119 |
{
|
|
| 120 | 0 |
return "[" + getMin() + " to " + getMax() + "]"; |
| 121 |
} |
|
| 122 |
} |
|
| 123 |
|
|
||||||||||