src/java.desktop/share/classes/sun/java2d/StateTrackableDelegate.java

Print this page




  27 
  28 import sun.java2d.StateTrackable.State;
  29 import static sun.java2d.StateTrackable.State.*;
  30 
  31 /**
  32  * This class provides a basic pre-packaged implementation of the
  33  * complete {@link StateTrackable} interface with implementations
  34  * of the required methods in the interface and methods to manage
  35  * transitions in the state of the object.
  36  * Classes which wish to implement StateTrackable could create an
  37  * instance of this class and delegate all of their implementations
  38  * for {@code StateTrackable} methods to the corresponding methods
  39  * of this class.
  40  */
  41 public final class StateTrackableDelegate implements StateTrackable {
  42     /**
  43      * The {@code UNTRACKABLE_DELEGATE} provides an implementation
  44      * of the StateTrackable interface that is permanently in the
  45      * {@link State#UNTRACKABLE UNTRACKABLE} state.
  46      */
  47     public final static StateTrackableDelegate UNTRACKABLE_DELEGATE =
  48         new StateTrackableDelegate(UNTRACKABLE);
  49 
  50     /**
  51      * The {@code IMMUTABLE_DELEGATE} provides an implementation
  52      * of the StateTrackable interface that is permanently in the
  53      * {@link State#IMMUTABLE IMMUTABLE} state.
  54      */
  55     public final static StateTrackableDelegate IMMUTABLE_DELEGATE =
  56         new StateTrackableDelegate(IMMUTABLE);
  57 
  58     /**
  59      * Returns a {@code StateTrackableDelegate} instance with the
  60      * specified initial {@link State State}.
  61      * If the specified {@code State} is
  62      * {@link State#UNTRACKABLE UNTRACKABLE} or
  63      * {@link State#IMMUTABLE IMMUTABLE}
  64      * then the approprirate static instance
  65      * {@link #UNTRACKABLE_DELEGATE} or {@link #IMMUTABLE_DELEGATE}
  66      * is returned.
  67      */
  68     public static StateTrackableDelegate createInstance(State state) {
  69         switch (state) {
  70         case UNTRACKABLE:
  71             return UNTRACKABLE_DELEGATE;
  72         case STABLE:
  73             return new StateTrackableDelegate(STABLE);
  74         case DYNAMIC:
  75             return new StateTrackableDelegate(DYNAMIC);




  27 
  28 import sun.java2d.StateTrackable.State;
  29 import static sun.java2d.StateTrackable.State.*;
  30 
  31 /**
  32  * This class provides a basic pre-packaged implementation of the
  33  * complete {@link StateTrackable} interface with implementations
  34  * of the required methods in the interface and methods to manage
  35  * transitions in the state of the object.
  36  * Classes which wish to implement StateTrackable could create an
  37  * instance of this class and delegate all of their implementations
  38  * for {@code StateTrackable} methods to the corresponding methods
  39  * of this class.
  40  */
  41 public final class StateTrackableDelegate implements StateTrackable {
  42     /**
  43      * The {@code UNTRACKABLE_DELEGATE} provides an implementation
  44      * of the StateTrackable interface that is permanently in the
  45      * {@link State#UNTRACKABLE UNTRACKABLE} state.
  46      */
  47     public static final StateTrackableDelegate UNTRACKABLE_DELEGATE =
  48         new StateTrackableDelegate(UNTRACKABLE);
  49 
  50     /**
  51      * The {@code IMMUTABLE_DELEGATE} provides an implementation
  52      * of the StateTrackable interface that is permanently in the
  53      * {@link State#IMMUTABLE IMMUTABLE} state.
  54      */
  55     public static final StateTrackableDelegate IMMUTABLE_DELEGATE =
  56         new StateTrackableDelegate(IMMUTABLE);
  57 
  58     /**
  59      * Returns a {@code StateTrackableDelegate} instance with the
  60      * specified initial {@link State State}.
  61      * If the specified {@code State} is
  62      * {@link State#UNTRACKABLE UNTRACKABLE} or
  63      * {@link State#IMMUTABLE IMMUTABLE}
  64      * then the approprirate static instance
  65      * {@link #UNTRACKABLE_DELEGATE} or {@link #IMMUTABLE_DELEGATE}
  66      * is returned.
  67      */
  68     public static StateTrackableDelegate createInstance(State state) {
  69         switch (state) {
  70         case UNTRACKABLE:
  71             return UNTRACKABLE_DELEGATE;
  72         case STABLE:
  73             return new StateTrackableDelegate(STABLE);
  74         case DYNAMIC:
  75             return new StateTrackableDelegate(DYNAMIC);