Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
AbstractSimpleVariable |
|
| 0.0;0 |
1 | /* | |
2 | * Copyright 2008 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.*; | |
30 | ||
31 | /** | |
32 | * Base class for lower-footprint Location implementations that have support only for dependencies, not triggers | |
33 | * | |
34 | * @author Brian Goetz | |
35 | */ | |
36 | 0 | public abstract class AbstractSimpleVariable implements Location { |
37 | protected List<WeakReference<Location>> dependencies; | |
38 | ||
39 | protected void notifyDependencies() { | |
40 | 0 | if (dependencies != null) { |
41 | 0 | for (Iterator<WeakReference<Location>> iterator = dependencies.iterator(); iterator.hasNext();) { |
42 | 0 | WeakReference<Location> lr = iterator.next(); |
43 | 0 | Location loc = lr.get(); |
44 | 0 | if (loc == null) |
45 | 0 | iterator.remove(); |
46 | else | |
47 | 0 | loc.invalidate(); |
48 | 0 | } |
49 | } | |
50 | 0 | } |
51 | ||
52 | public boolean isValid() { | |
53 | 0 | return true; |
54 | } | |
55 | ||
56 | public boolean isMutable() { | |
57 | 0 | return true; |
58 | } | |
59 | ||
60 | public boolean isNull() { | |
61 | 0 | return false; |
62 | } | |
63 | ||
64 | public void addDependentLocation(final WeakReference<Location> location) { | |
65 | 0 | if (dependencies == null) |
66 | 0 | dependencies = new ArrayList<WeakReference<Location>>(); |
67 | 0 | dependencies.add(location); |
68 | 0 | } |
69 | ||
70 | public void invalidate() { | |
71 | 0 | throw new UnsupportedOperationException(); |
72 | } | |
73 | ||
74 | public void update() { | |
75 | 0 | throw new UnsupportedOperationException(); |
76 | } | |
77 | ||
78 | public void addChangeListener(ChangeListener listener) { | |
79 | 0 | throw new UnsupportedOperationException(); |
80 | } | |
81 | ||
82 | public void addWeakListener(ChangeListener listener) { | |
83 | 0 | throw new UnsupportedOperationException(); |
84 | } | |
85 | ||
86 | public Collection<ChangeListener> getListeners() { | |
87 | 0 | return Collections.emptyList(); |
88 | } | |
89 | ||
90 | public void addDependencies(Location... location) { | |
91 | 0 | throw new UnsupportedOperationException(); |
92 | } | |
93 | ||
94 | public void addDynamicDependency(Location location) { | |
95 | 0 | throw new UnsupportedOperationException(); |
96 | } | |
97 | ||
98 | public void clearDynamicDependencies() { | |
99 | 0 | throw new UnsupportedOperationException(); |
100 | } | |
101 | } |