package org.csstudio.sds.components.ui.internal.figureparts;

/**
 * A range.
 */
public class Range {

    /** the lower value of range */
    public double lower;

    /** the upper value of range */
    public double upper;

    /**
     * Constructor.
     * 
     * @param start
     *            the start value of range
     * @param end
     *            the end value of range
     */
    public Range(double start, double end) {
    	if(end == start)
    		end = start + 1;
        this.lower = (end > start) ? start : end;
        this.upper = (end > start) ? end : start;
    }

    /**
     * Constructor.
     * 
     * @param range
     *            the range
     */
    public Range(Range range) {
        lower = (range.upper > range.lower) ? lower : upper;
        upper = (range.upper > range.lower) ? upper : lower;
    }

    /*
     * @see Object#toString()
     */
    @Override
    public String toString() {
        return "lower=" + lower + ", upper=" + upper;
    }
}

@@ -437,16 +437,18 @@
  %7B%0A    %09
+//
 if(end =
@@ -461,16 +461,18 @@
 t)%0A    %09
+//
 %09end = s
@@ -837,24 +837,687 @@
 wer;%0A    %7D%0A%0A
+    %0A    /**If a value in the range or not.%0A     * @param value%0A     * @param includeBoundary true if the boundary should be considered.%0A     * @return true if the value is in the range. Otherwise false.%0A     */%0A    public boolean inRange(double value, boolean includeBoundary)%7B%0A    %09if(includeBoundary)%0A    %09%09return (value %3E= lower && value %3C= upper);%0A    %09else%0A    %09%09return (value %3E lower && value %3C upper);%0A    %7D%0A    %0A    /**If a value in the range or not. The boundary is included.%0A     * @param value%0A     * @return true if the value is in the range. Otherwise false.%0A     */%0A    public boolean inRange(double value)%7B%0A    %09return inRange(value, true);%0A    %7D%0A
     /*%0A     

add inRange()