public final class Utilities
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static DateTime |
advance(DateTime time,
int steps,
TimeUnit unit)
Advances the specified time with the specified number
of units according to the underlying resolution.
|
static void |
drawLine(java.awt.Graphics2D graphics,
Pen pen,
double x1,
double y1,
double x2,
double y2) |
static void |
drawPolygon(java.awt.Graphics2D graphics,
Pen pen,
java.awt.geom.Point2D.Double[] points) |
static void |
fillPolygon(java.awt.Graphics2D graphics,
Brush brush,
java.awt.geom.Point2D.Double[] points) |
static ScrollEvent |
fromAwtAdjustmentEvent(java.awt.event.AdjustmentEvent value)
Converts the specified
AdjustmentEvent object
to its ScrollEvent equivalent. |
static DayOfWeek |
fromJavaDayOfWeek(int value)
Converts the specified
Calendar constant to its
DayOfWeek equivalent. |
static java.lang.reflect.Constructor<? extends ItemViewer> |
getCustomItemViewerConstructor(java.lang.Class<? extends Item> itemType) |
static java.awt.geom.Rectangle2D |
inflate(java.awt.geom.Rectangle2D rect,
double margin) |
static java.awt.geom.Rectangle2D |
inflate(java.awt.geom.Rectangle2D rect,
double width,
double height) |
static java.awt.geom.Rectangle2D |
inflate(java.awt.geom.Rectangle2D rect,
double left,
double top,
double right,
double bottom) |
static java.awt.Rectangle |
inflate(java.awt.Rectangle rect,
int margin) |
static java.awt.Rectangle |
inflate(java.awt.Rectangle rect,
int width,
int height) |
static java.awt.geom.Rectangle2D |
inflateBottom(java.awt.geom.Rectangle2D rect,
double value)
Inflates the bottom side of the current rectangle with the specified amount
and returns a new
Rectangle2D object representing the result. |
static java.awt.Rectangle |
inflateBottom(java.awt.Rectangle rect,
int value)
Inflates the bottom side of the current rectangle with the specified amount
and returns a new Rectangle object representing the result.
|
static java.awt.geom.Rectangle2D |
inflateLeft(java.awt.geom.Rectangle2D rect,
double value)
Inflates the left side of the current rectangle with the specified amount
and returns a new
Rectangle2D object representing the result. |
static java.awt.Rectangle |
inflateLeft(java.awt.Rectangle rect,
int value)
Inflates the left side of the current rectangle with the specified amount
and returns a new Rectangle object representing the result.
|
static java.awt.Rectangle |
inflateRectangleMaxHalf(java.awt.Rectangle rect,
int left,
int top,
int right,
int bottom)
Inflates the specified rectangle from each side.
|
static java.awt.geom.Rectangle2D |
inflateRight(java.awt.geom.Rectangle2D rect,
double value)
Inflates the right side of the current rectangle with the specified amount
and returns a new
Rectangle2D object representing the result. |
static java.awt.Rectangle |
inflateRight(java.awt.Rectangle rect,
int value)
Inflates the right side of the current rectangle with the specified amount
and returns a new Rectangle object representing the result.
|
static java.awt.geom.Rectangle2D |
inflateTop(java.awt.geom.Rectangle2D rect,
double value)
Inflates the top side of the current rectangle with the specified amount
and returns a new
Rectangle2D object representing the result. |
static java.awt.Rectangle |
inflateTop(java.awt.Rectangle rect,
int value)
Inflates the top side of the current rectangle with the specified amount
and returns a new Rectangle object representing the result.
|
static boolean |
intersect(Duration a1,
Duration b1,
Duration a2,
Duration b2)
Checks whether the specified time intervals intersect.
|
static <T> java.util.List<T> |
itemsOfType(java.lang.Iterable<?> collection,
java.lang.reflect.Type type,
java.lang.Class<T> resultType)
Returns the subset of items from the specified collection that have the specified type.
|
static DateTime |
max(DateTime a,
DateTime b)
Returns the later of two dates.
|
static DateTime |
min(DateTime a,
DateTime b)
Returns the former of two dates.
|
static java.awt.Point |
offset(java.awt.Point point,
int dx,
int dy) |
static java.awt.geom.Rectangle2D |
offset(java.awt.geom.Rectangle2D rect,
double dx,
double dy) |
static java.awt.Rectangle |
offset(java.awt.Rectangle rect,
int dx,
int dy) |
static <T> java.util.List<T> |
ofType(java.lang.Iterable<?> collection,
java.lang.reflect.Type type,
java.lang.Class<T> resultType)
Returns the subset of items from the specified collection that have the specified type.
|
static void |
raiseArgumentOutOfRangeException(java.lang.String argName,
java.lang.String getString) |
static int |
toAwtHorizontalAlignment(int alignment)
Converts the specified
HorizontalAlignment value to its SwingConstants equivalent. |
static int |
toJavaDayOfWeek(DayOfWeek value)
Converts the specified
DayOfWeek constant to its
Calendar equivalent. |
public static final ScrollEvent fromAwtAdjustmentEvent(java.awt.event.AdjustmentEvent value)
AdjustmentEvent
object
to its ScrollEvent
equivalent.public static final int toAwtHorizontalAlignment(int alignment)
HorizontalAlignment
value to its SwingConstants
equivalent.public static java.awt.Rectangle inflateRectangleMaxHalf(java.awt.Rectangle rect, int left, int top, int right, int bottom)
public static void raiseArgumentOutOfRangeException(java.lang.String argName, java.lang.String getString)
public static DateTime advance(DateTime time, int steps, TimeUnit unit)
public static int toJavaDayOfWeek(DayOfWeek value)
DayOfWeek
constant to its
Calendar
equivalent.public static DayOfWeek fromJavaDayOfWeek(int value)
Calendar
constant to its
DayOfWeek
equivalent.public static boolean intersect(Duration a1, Duration b1, Duration a2, Duration b2)
public static <T> java.util.List<T> ofType(java.lang.Iterable<?> collection, java.lang.reflect.Type type, java.lang.Class<T> resultType)
public static <T> java.util.List<T> itemsOfType(java.lang.Iterable<?> collection, java.lang.reflect.Type type, java.lang.Class<T> resultType)
public static java.lang.reflect.Constructor<? extends ItemViewer> getCustomItemViewerConstructor(java.lang.Class<? extends Item> itemType)
public static java.awt.Point offset(java.awt.Point point, int dx, int dy)
public static java.awt.Rectangle offset(java.awt.Rectangle rect, int dx, int dy)
public static java.awt.geom.Rectangle2D offset(java.awt.geom.Rectangle2D rect, double dx, double dy)
public static java.awt.Rectangle inflate(java.awt.Rectangle rect, int margin)
public static java.awt.Rectangle inflate(java.awt.Rectangle rect, int width, int height)
public static java.awt.geom.Rectangle2D inflate(java.awt.geom.Rectangle2D rect, double margin)
public static java.awt.geom.Rectangle2D inflate(java.awt.geom.Rectangle2D rect, double width, double height)
public static java.awt.geom.Rectangle2D inflate(java.awt.geom.Rectangle2D rect, double left, double top, double right, double bottom)
public static java.awt.Rectangle inflateLeft(java.awt.Rectangle rect, int value)
value
- The amount to inflate the left side of this rectangle.public static java.awt.Rectangle inflateTop(java.awt.Rectangle rect, int value)
value
- The amount to inflate the top side of this rectangle.public static java.awt.Rectangle inflateRight(java.awt.Rectangle rect, int value)
value
- The amount to inflate the right side of this rectangle.public static java.awt.Rectangle inflateBottom(java.awt.Rectangle rect, int value)
value
- The amount to inflate the bottom side of this rectangle.public static java.awt.geom.Rectangle2D inflateLeft(java.awt.geom.Rectangle2D rect, double value)
Rectangle2D
object representing the result.value
- The amount to inflate the left side of this rectangle.Rectangle2D
object.public static java.awt.geom.Rectangle2D inflateTop(java.awt.geom.Rectangle2D rect, double value)
Rectangle2D
object representing the result.value
- The amount to inflate the top side of this rectangle.Rectangle2D
object.public static java.awt.geom.Rectangle2D inflateRight(java.awt.geom.Rectangle2D rect, double value)
Rectangle2D
object representing the result.value
- The amount to inflate the right side of this rectangle.Rectangle2D
object.public static java.awt.geom.Rectangle2D inflateBottom(java.awt.geom.Rectangle2D rect, double value)
Rectangle2D
object representing the result.value
- The amount to inflate the bottom side of this rectangle.Rectangle2D
object.public static void fillPolygon(java.awt.Graphics2D graphics, Brush brush, java.awt.geom.Point2D.Double[] points)
public static void drawPolygon(java.awt.Graphics2D graphics, Pen pen, java.awt.geom.Point2D.Double[] points)
public static void drawLine(java.awt.Graphics2D graphics, Pen pen, double x1, double y1, double x2, double y2)