|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.jhu.tmaj.beans.masks.color.CircleRange
public final class CircleRange
Represents a range on a circle. This is similar to a linear, straight line, numerical range like 10 - 50, except for one thing, a circular range can "wrap" around 0. So for example, if the maxValue is 255, a circular range might go from 220 to 5. So, values 220-255 and values 0 - 5 would be included in the range. Everything from 6 to 219 would be excluded. The range has 2 end points, which are represented by a start angle and a end angle. -- Adding Points -- The user adds points on this circle, and this class tries to keep the range as small as possible. So if the circle ranges from points 0 to 255, and the current range is from 10 to 20, and the user adds point 8, the new range will be from 8 to 20. If the user were to add point 25 instead of 8, the new range would be from 10 to 25. The range will "wrap" around 0. For example, if the current range is 0 to 10, and a user adds 253, the new range will be 253 - 10. This is why we represent the range as a circle. -- Resets -- The range will generally start off as being called "reset". A reset range by definition contains nothing. The values returned for a reset range will be 0 to 0. However, that does not mean the user can't set this class to actually represent the range 0 to 0. (That range would only include the value 0.) So, a reset range will always have the values 0 to 0 (and not include 0, or any other number.). A 0 to 0 range, however, may actually be reset or not-reset. If if weren't reset, it WOULD include the number 0.
Field Summary | |
---|---|
static int |
RESET_MAX_VALUE
|
static int |
RESET_MIN_VALUE
|
Method Summary | |
---|---|
boolean |
containsPosition(int position)
Returns true if the current range contains the given position. |
void |
ensureRangeContains(int position)
Ensures that the given position is in current given range; if necessary, the range is expanded. |
static CircleRange |
getDefinedRange(int startValue,
int endValue)
|
int |
getEndPosition()
Gets the position of where the range ends. |
static CircleRange |
getResetRange()
|
int |
getStartPosition()
Gets the position of where the range starts. |
boolean |
isReset()
|
boolean |
isWrapping()
Returns true if the range "wraps" around 0. |
static void |
main(java.lang.String[] args)
Performs a test of this class. |
void |
reset()
Resets this range so that no numbers are included. |
void |
setRange(CircleRange circleRange)
|
void |
setRange(int startPosition,
int endPosition)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int RESET_MIN_VALUE
public static final int RESET_MAX_VALUE
Method Detail |
---|
public static void main(java.lang.String[] args)
public static CircleRange getResetRange()
public static CircleRange getDefinedRange(int startValue, int endValue)
public void ensureRangeContains(int position)
public void reset()
public boolean isReset()
public void setRange(int startPosition, int endPosition)
public void setRange(CircleRange circleRange)
public int getStartPosition()
public int getEndPosition()
public boolean containsPosition(int position)
public boolean isWrapping()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |