jdk/src/java.desktop/share/classes/sun/java2d/StateTrackable.java
author lbourges
Mon, 23 Nov 2015 15:02:19 -0800
changeset 34419 14108cfd0823
parent 25859 3317bb8137f4
child 35667 ed476aba94de
permissions -rw-r--r--
8143849: Integrate Marlin renderer per JEP 265 Reviewed-by: flar, prr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.java2d;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * This interface is implemented by classes which contain complex state
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * so that other objects can track whether or not their state has changed
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * since earlier interactions with the object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * The suggested usage pattern for code that manages some trackable data
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * is as follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * class Trackable implements StateTrackable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 *     TrackedInfo data;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 *     State curState = STABLE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 *     StateTracker curTracker = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *     // Hypothetical method to return a static piece of our tracked data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 *     // Assume that Datum is either a copy of some piece of the tracked
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 *     // data or that it is itself immutable.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *     public Datum getSomeDatum(int key) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *         // No need to modify the state for this type of "get" call.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *         return data.getDatum(key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *     // Hypothetical method to return a raw reference to our tracked data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 *     public TrackedInfo getRawHandleToInfo() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 *         // Since we are returning a raw reference to our tracked
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 *         // data and since we can not track what the caller will
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *         // do with that reference, we can no longer track the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 *         // state of this data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 *         synchronized (this) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 *             // Note: modifying both curState and curTracker requires
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 *             // synchronization against the getStateTracker method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 *             curState = UNTRACKABLE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 *             curTracker = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 *         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 *         return data;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 *     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 *     // Hypothetical method to set a single piece of data to some
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 *     // new static value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 *     public void setSomeDatum(int key, Datum datum) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 *         data.setDatum(key, datum);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 *         // We do not need to change state for this, we simply
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 *         // invalidate the outstanding StateTracker objects.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 *         // Note: setting curTracker to null requires no synchronization.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 *         curTracker = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 *     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 *     // getStateTracker must be synchronized against any code that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 *     // changes the State.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 *     public synchronized StateTracker getStateTracker() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 *         StateTracker st = curTracker;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 *         if (st == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 *             switch (curState) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 *                 case IMMUTABLE:   st = StateTracker.ALWAYS_CURRENT; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 *                 case STABLE:      st = new Tracker(this); break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 *                 case DYNAMIC:     st = StateTracker.NEVER_CURRENT; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 *                 case UNTRACKABLE: st = StateTracker.NEVER_CURRENT; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 *             }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 *             curTracker = st;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 *         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 *         return st;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 *     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 *     static class Tracker implements StateTracker {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 *         Trackable theTrackable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 *         public Tracker(Trackable t) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 *             theTrackable = t;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 *         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 *         public boolean isCurrent() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 *             return (theTrackable.curTracker == this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 *         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 *     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 * }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * Note that the mechanism shown above for invalidating outstanding
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 * StateTracker objects is not the most theoretically conservative
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 * way to implement state tracking in a "set" method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 * There is a small window of opportunity after the data has changed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 * before the outstanding StateTracker objects are invalidated and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
 * where they will indicate that the data is still the same as when
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
 * they were instantiated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
 * While this is technically inaccurate, it is acceptable since the more
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
 * conservative approaches to state management are much more complex and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
 * cost much more in terms of performance for a very small gain in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
 * correctness.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
 * For example:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
 * The most conservative approach would be to synchronize all accesses
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
 * and all modifications to the data, including its State.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
 * This would require synchronized blocks around some potentially large
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
 * bodies of code which would impact the multi-threaded scalability of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
 * the implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
 * Further, if data is to be coordinated or transferred between two
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
 * trackable objects then both would need to be synchronized raising
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
 * the possibility of deadlock unless some strict rules of priority
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
 * for the locking of the objects were established and followed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
 * religiously.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
 * Either or both of these drawbacks makes such an implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
 * infeasible.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
 * A less conservative approach would be to change the state of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
 * trackable object to DYNAMIC during all modifications of the data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
 * and then to change it back to STABLE after those modifications
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
 * are complete.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
 * While this state transition more accurately reflects the temporary
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
 * loss of tracking during the modification phase, in reality the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
 * time period of the modifications would be small in most cases
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
 * and the 2 changes of state would each require synchronization.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
 * In comparison the act of setting the <code>curTracker</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
 * reference to null in the usage pattern above effectively invalidates
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
 * all outstanding <code>Tracker</code> objects as soon as possible
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
 * after the change to the data and requires very little code and no
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
 * synchronization to implement.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
 * In the end it is up to the implementor of a StateTrackable object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
 * how fine the granularity of State updates should be managed based
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
 * on the frequency and atomicity of the modifications and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
 * consequences of returning an inaccurate State for a particularly
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
 * small window of opportunity.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
 * Most implementations are likely to follow the liberal, but efficient
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
 * guidelines found in the usage pattern proposed above.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
 * @since 1.7
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
public interface StateTrackable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * An enumeration describing the current state of a trackable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * These values describe how often the complex data contained
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * in a trackable object can be changed and whether or not it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * makes sense to try to track the data in its current state.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * @see StateTrackable#getState
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * @since 1.7
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    public enum State {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
         * The complex data will never change again.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
         * Information related to the current contents of the complex
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
         * data can be calculated and cached indefinitely with no
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
         * further checks to see if the information is stale.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        IMMUTABLE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
         * The complex data is currently stable, but could change at
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
         * some point in the future.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
         * Information related to the current contents of the complex
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
         * data can be calculated and cached, but a StateTracker should
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
         * be used to verify the freshness of such precalculated data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
         * before each future use.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        STABLE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
         * The complex data is currently in flux and is frequently
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
         * changing.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
         * While information related to the current contents of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
         * complex data could be calculated and cached, there is a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
         * reasonably high probability that the cached information
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
         * would be found to be out of date by the next time it is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
         * used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
         * It may also be the case that the current contents are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
         * temporarily untrackable, but that they may become trackable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
         * again in the future.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        DYNAMIC,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
         * The complex data can currently be changed by external
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
         * references and agents in a way that cannot be tracked.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
         * If any information about the current contents of the complex
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
         * data were to be cached, there would be no way to determine
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
         * whether or not that cached information was out of date.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        UNTRACKABLE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     * Returns the general state of the complex data held by this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * This return value can be used to determine if it makes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * strategic sense to try and cache information about the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * contents of this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * The StateTracker returned from the getStateTracker() method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     * will further aid in determining when the data has been
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * changed so that the caches can be verified upon future uses.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * @return the current state of trackability of the complex
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * data stored in this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * @see #getStateTracker
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * @since 1.7
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    public State getState();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * Returns an object which can track future changes to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * complex data stored in this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * If an external agent caches information about the complex
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * data of this object, it should first get a StateTracker
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * object from this method so that it can check if such
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * information is current upon future uses.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     * Note that a valid StateTracker will always be returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * regardless of the return value of getState(), but in some
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * cases the StateTracker may be a trivial implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     * which always returns the same value from its
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * {@link StateTracker#isCurrent isCurrent} method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     * <li>If the current state is {@link State#IMMUTABLE IMMUTABLE},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * this StateTracker and any future StateTracker objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * returned from this method will always indicate that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * the state has not changed.</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * <li>If the current state is {@link State#UNTRACKABLE UNTRACKABLE},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * this StateTracker and any future StateTracker objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * returned from this method will always indicate that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * the state has changed.</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * <li>If the current state is {@link State#DYNAMIC DYNAMIC},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * this StateTracker may always indicate that the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * state has changed, but another StateTracker returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * from this method in the future when the state has changed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * to {@link State#STABLE STABLE} will correctly track changes.</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * <li>Otherwise the current state is {@link State#STABLE STABLE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * and this StateTracker will indicate whether or not the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * data has changed since the time at which it was fetched
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     * from the object.</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     * @return an object implementing the StateTracker interface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     * that tracks whether changes have been made to the complex
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * contents of this object since it was returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     * @see State
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * @see #getState
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * @since 1.7
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    public StateTracker getStateTracker();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
}