32 |
import org.nongnu.libvob.vobs.*; |
import org.nongnu.libvob.vobs.*; |
33 |
|
|
34 |
/** This node function uses caching for nodes which aren't focused, |
/** This node function uses caching for nodes which aren't focused, |
35 |
* othervise uses noncached node functions. |
* othervise uses noncached node functions. Caching can be |
36 |
|
* reinitialized i.e., after loading a new state of graph. |
37 |
*/ |
*/ |
38 |
public class ContextNodeView implements NodeFunction { |
public class ContextNodeView implements NodeFunction { |
39 |
|
|
40 |
final NodeFunction cached, unCached; |
final private NodeFunction nodef; |
41 |
|
private NodeFunction cached, unCached; |
42 |
private ContextNodeView.Context context = null; |
private ContextNodeView.Context context = null; |
43 |
private NodeFunction current; |
private NodeFunction current; |
44 |
|
|
45 |
public ContextNodeView(NodeFunction cached, |
public ContextNodeView(NodeFunction nodef, ConstGraph graph, int n) { |
46 |
NodeFunction uncached) |
this.nodef = nodef; |
47 |
{ |
this.unCached = nodef; |
48 |
this.cached = cached; |
current = unCached; |
49 |
this.unCached = uncached; |
reinit(graph, n); |
|
current = unCached; |
|
50 |
} |
} |
51 |
|
|
52 |
|
public void reinit(ConstGraph graph, int n) { |
53 |
|
this.cached = new CachedNodeFunction(n, graph, nodef); |
54 |
|
} |
55 |
|
|
56 |
public void setContext(ContextNodeView.Context context) { |
public void setContext(ContextNodeView.Context context) { |
57 |
this.context = context; |
this.context = context; |
58 |
} |
} |