Search this API

y.view
Class Util

java.lang.Object
  extended by y.view.Util

public final class Util
extends java.lang.Object

This class provides some static convenience methods and temporary scratch variables.
Note that this is inherently flawed if used in multi-threaded environments! If used inside a single Thread, this might be ok. The alias(Graphics2D) and unalias(Graphics2D) are thread-safe - however the use of the fields is not!

 

Field Summary
static double[] DOUBLE2
          Deprecated. Do not use (Threading issues)
static double EPSILON
          A reasonable small value ( 0.000001 ) useful for approximating 0.0.
static float[] FLOAT2
          Deprecated. Do not use (Threading issues)
static float[] FLOAT6
          Deprecated. Do not use (Threading issues)
static java.awt.geom.Point2D POINT2D
          Deprecated. Do not use (Threading issues)
static java.awt.geom.AffineTransform TRANSFORM
          Deprecated. Do not use (Threading issues)
 
Method Summary
static void alias(java.awt.Graphics2D g)
          Puts a graphics context in anti-aliasing mode.
static java.lang.ThreadLocal getSharedThreadLocal()
          Returns a ThreadLocal instance that is used internally as a cache for various shared helper objects.
static void unalias(java.awt.Graphics2D g)
          Turns off anti-aliasing mode of a graphics context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FLOAT2

public static float[] FLOAT2
Deprecated. Do not use (Threading issues)
A 2-dimensional float array that may be used as temporary scratch variable.


FLOAT6

public static float[] FLOAT6
Deprecated. Do not use (Threading issues)
A six-dimensional float array that may be used as temporary scratch variable, e.g. when working with PathIterators.


DOUBLE2

public static double[] DOUBLE2
Deprecated. Do not use (Threading issues)
A 2-dimensional double array that may be used as temporary scratch variable.


POINT2D

public static java.awt.geom.Point2D POINT2D
Deprecated. Do not use (Threading issues)
A Point2D in double precision that may be used as temporary scratch variable.


TRANSFORM

public static java.awt.geom.AffineTransform TRANSFORM
Deprecated. Do not use (Threading issues)
An Affine Transform that may be used as temporary scratch variable.


EPSILON

public static final double EPSILON
A reasonable small value ( 0.000001 ) useful for approximating 0.0.

See Also:
Constant Field Values
Method Detail

alias

public static void alias(java.awt.Graphics2D g)
Puts a graphics context in anti-aliasing mode. This method keeps track of a counter for each graphics context. The counter is increased each time this method is called. The counter is zero initially, whenever the counter gets positive, the rendering hint will be set.


unalias

public static void unalias(java.awt.Graphics2D g)
Turns off anti-aliasing mode of a graphics context. This method keeps track of a counter for each graphics context. The counter is decreased each time this method is called. The counter is zero initially, whenever the counter gets non-positive, the rendering hint will be reset.


getSharedThreadLocal

public static java.lang.ThreadLocal getSharedThreadLocal()
Returns a ThreadLocal instance that is used internally as a cache for various shared helper objects. The cache is intended to reduce the number of object creations in performance critical loops.

This method exists for the sole purpose of allowing access to Java 1.5 method ThreadLocal.remove() that can be used by client code to prevent the cache from polluting long running threads in multi-threaded environments such as web servers that use thread pools.

Do not use this method to access and/or modify the cached data in any other way.


© Copyright 2000-2021,
yWorks GmbH.
All rights reserved.