21 |
PureNodeFunction f; |
PureNodeFunction f; |
22 |
Object placeHolder; |
Object placeHolder; |
23 |
Background background; |
Background background; |
24 |
Obs recalcObs; |
ObjObs recalcObs; |
25 |
|
|
26 |
/** Create a new SuperLazyPureNodeFunction. |
/** Create a new SuperLazyPureNodeFunction. |
27 |
* @param n The number of cache entries to use |
* @param n The number of cache entries to use |
37 |
ConstGraph g, PureNodeFunction f, |
ConstGraph g, PureNodeFunction f, |
38 |
Object placeHolder, |
Object placeHolder, |
39 |
Background background, |
Background background, |
40 |
Obs recalcObs |
ObjObs recalcObs |
41 |
) { |
) { |
42 |
cache = new CachingMap(n); |
cache = new CachingMap(n); |
43 |
this.ourGraph = g; |
this.ourGraph = g; |
48 |
} |
} |
49 |
|
|
50 |
private class SuperLazyNodeFunctionCacheEntry |
private class SuperLazyNodeFunctionCacheEntry |
51 |
extends NodeFunctionCacheEntry |
extends FunctionCacheEntry |
52 |
implements Runnable { |
implements Runnable { |
53 |
public SuperLazyNodeFunctionCacheEntry(Object node) { |
public SuperLazyNodeFunctionCacheEntry(Object input) { |
54 |
super(node); |
super(input); |
55 |
} |
} |
56 |
|
|
57 |
public void schedule() { |
public void schedule() { |
60 |
|
|
61 |
public void run() { |
public void run() { |
62 |
synchronized(this) { |
synchronized(this) { |
63 |
ConstGraph og = (ourGraph == null ? |
ConstGraph og = (ourGraph == null ? |
64 |
null : ourGraph.getObservedConstGraph(this)); |
null : ourGraph.getObservedConstGraph(this)); |
65 |
this.value = f.f(og, node); |
this.value = f.f(og, this.input); |
66 |
if(og != null) og.close(); |
if(og != null) og.close(); |
67 |
} |
} |
68 |
recalcObs.chg(); |
if(recalcObs != null) |
69 |
|
recalcObs.chg(this.input); |
70 |
} |
} |
71 |
|
|
72 |
} |
} |