|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.talvi.puffinplot.Util
public class Util
This class collects miscellaneous, general-purpose utility functions which are useful to PuffinPlot.
| Constructor Summary | |
|---|---|
Util()
|
|
| Method Summary | |
|---|---|
static java.awt.geom.Line2D |
clipLineToRectangle(java.awt.geom.Line2D line,
java.awt.geom.Rectangle2D r)
Clips a line to a supplied rectangle. |
static java.awt.geom.Rectangle2D |
envelope(java.util.Collection<java.awt.geom.Point2D> points)
Returns the rectangular envelope for the supplied points. |
static java.util.BitSet |
numberRangeStringToBitSet(java.lang.String input,
int limit)
Converts a string specification of number ranges to a corresponding BitSet. |
static java.awt.geom.Line2D |
scaleLine(java.awt.geom.Line2D line,
double scale)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Util()
| Method Detail |
|---|
public static java.util.BitSet numberRangeStringToBitSet(java.lang.String input,
int limit)
Converts a string specification of number ranges to a corresponding
BitSet. The specification is of the form commonly encountered
in Print dialog boxes: a sequence of comma-separated units. Each unit
can be either an integer (meaning that the corresponding item should
be selected) or two integers separated by a hyphen (-) character
(meaning that all items in the corresponding range should be
selected). Example inputs and outputs are shown below.
| 1 | 1 |
| 1,3 | 101 |
| 4-6 | 000111 |
| 4-6,8-10,10,11,15-16 | 0001110111100011 |
| 1-4,3-5,10,12-14,17 | 11111000010111001 |
Note that the range specifications are one-based (the first
item is specified by 1, not 0) but the BitSet output
is zero-based.
Since an error in the specification string might result in an impractically large bitset, this method also takes a limit argument; no bits will be set beyond the specified limit.
input - a specification stringlimit - upper limit for bits to set; limit-1 will be the
highest possible set bit
public static java.awt.geom.Line2D clipLineToRectangle(java.awt.geom.Line2D line,
java.awt.geom.Rectangle2D r)
line - a liner - a clipping rectangle
public static java.awt.geom.Rectangle2D envelope(java.util.Collection<java.awt.geom.Point2D> points)
points - a set of points
public static java.awt.geom.Line2D scaleLine(java.awt.geom.Line2D line,
double scale)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||