Coverage Report - com.sun.javafx.runtime.location.Location
 
Classes in this File Line Coverage Branch Coverage Complexity
Location
N/A
N/A
0
 
 1  
 /*
 2  
  * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
 3  
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 4  
  *
 5  
  * This code is free software; you can redistribute it and/or modify it
 6  
  * under the terms of the GNU General Public License version 2 only, as
 7  
  * published by the Free Software Foundation.  Sun designates this
 8  
  * particular file as subject to the "Classpath" exception as provided
 9  
  * by Sun in the LICENSE file that accompanied this code.
 10  
  *
 11  
  * This code is distributed in the hope that it will be useful, but WITHOUT
 12  
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13  
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14  
  * version 2 for more details (a copy is included in the LICENSE file that
 15  
  * accompanied this code).
 16  
  *
 17  
  * You should have received a copy of the GNU General Public License version
 18  
  * 2 along with this work; if not, write to the Free Software Foundation,
 19  
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20  
  *
 21  
  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
 22  
  * CA 95054 USA or visit www.sun.com if you need additional information or
 23  
  * have any questions.
 24  
  */
 25  
 
 26  
 package com.sun.javafx.runtime.location;
 27  
 
 28  
 import java.lang.ref.WeakReference;
 29  
 import java.util.Collection;
 30  
 
 31  
 /**
 32  
  * A Location represents any value on which another variable may express a dependency, including binding dependency
 33  
  * and change triggers.  The location is assumed to have a value, whose type is determined by the subinterfaces
 34  
  * IntLocation, ObjectLocation, SequenceLocation, etc.
 35  
  *
 36  
  * The value assocated with a location may be valid or invalid.  If the value is invalid, it will be updated either
 37  
  * when the update() method is called, or when the value is retrieved.
 38  
  *
 39  
  * Change listeners can be registered with a location, and are notified whenever the value associated with the location
 40  
  * changes.  Locations may be lazy; this means that change listeners will be notified when the value is invalidated,
 41  
  * but the new value will not be recomputed until it is asked for.
 42  
  *
 43  
  * @author Brian Goetz
 44  
  */
 45  
 public interface Location {
 46  
     /** Is the value associated with this location currently valid, or would it have to be recomputed? */
 47  
     public boolean isValid();
 48  
 
 49  
     /** Is the value assicated with this location null? */
 50  
     public boolean isNull();
 51  
 
 52  
     /** Can the value held by this location be changed by calling its mutative methods?  */
 53  
     public boolean isMutable();
 54  
 
 55  
     /** Invalidate the value associated with this location, and call all registered change listeners.  If the location
 56  
      * is lazy, the value is not immediately recomputed, otherwise it is.
 57  
      */
 58  
     public void invalidate();
 59  
 
 60  
     /** Recompute the current value */
 61  
     public void update();
 62  
 
 63  
     /** Register a change listener that will be notified whenever this location may have changed.  Locations are allowed
 64  
      * to notify change listeners spuriously.
 65  
      */
 66  
     public void addChangeListener(ChangeListener listener);
 67  
 
 68  
     /** Register a change listener that will be notified whenever this location may have changed, but use a weak
 69  
      * reference for the listener, so that the listener list does not pin the listener in memory after it otherwise
 70  
      * could be collected.
 71  
      */
 72  
     public void addWeakListener(ChangeListener listener);
 73  
 
 74  
     /** Record a location as depending on this location */
 75  
     public void addDependentLocation(WeakReference<Location> location);
 76  
 
 77  
     /** Return the collection of change listeners */
 78  
     public Collection<ChangeListener> getListeners();
 79  
 
 80  
     /** Add this location as a dependency of zero or more other Locations */
 81  
     public void addDependencies(Location... location);
 82  
 
 83  
     /** Add this location as a dynamic dependency of zero or more other Locations */
 84  
     public void addDynamicDependency(Location location);
 85  
 
 86  
     /** Remove this location as a dynamic dependency of any Location it was previously registered with */
 87  
     public void clearDynamicDependencies();
 88  
 }