14 |
* Second, no function whose return value depends |
* Second, no function whose return value depends |
15 |
* on anything except the passed parameters |
* on anything except the passed parameters |
16 |
* (including the Graph) may be called. |
* (including the Graph) may be called. |
17 |
|
* <p> |
18 |
|
* As an aside, this class works completely also |
19 |
|
* without a graph, for caching constant functions. |
20 |
*/ |
*/ |
21 |
public class CachedNodeFunction implements NodeFunction { |
public class CachedNodeFunction implements NodeFunction { |
22 |
|
|
68 |
cache.put(node, cac); |
cache.put(node, cac); |
69 |
} |
} |
70 |
if(cac.value == DIRTY) { |
if(cac.value == DIRTY) { |
71 |
ConstGraph og = ourGraph.getObservedConstGraph(cac); |
ConstGraph og = (ourGraph == null ? |
72 |
|
null : ourGraph.getObservedConstGraph(cac)); |
73 |
cac.value = f.f(og, node); |
cac.value = f.f(og, node); |
74 |
og.close(); |
if(og != null) og.close(); |
75 |
} |
} |
76 |
if(o != null) |
if(o != null) |
77 |
cac.addObs(o); |
cac.addObs(o); |