rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
ScalarCreator.m
1 classdef ScalarCreator < DataTree.CreatorDefault
2  % Simple DataTree.ICreator copying the original tree and applying a custom function to
3  % its leafs returning a scalar value.
4  %
5  % This creator is used by the INode.create_scalar_tree() method.
6 
7 
8  properties
9 
10  % function_handle to a custom function applied to all leaf elements
11  %
12  % The function synopsis is: 'ret = funcptr(arg_node)'
13  funcptr;
14  end
15 
16  methods
17  function sc = ScalarCreator(funcptr)
18  % function sc = ScalarCreator(funcptr)
19  % constructor of this creator
20  %
21  % Parameters:
22  % funcptr: function handle to a custom function applied to all leaf elements
23  sc.funcptr = funcptr;
24  end
25 
26  function node = create_leaf_node(this, arg_node, basepath, mu_cube, tslice)
27  % function node = create_leaf_node(this, arg_node, basepath, mu_cube, tslice)
28  % @copybrief DataTreeICreatorcreate_leaf_node()
29  %
30  % @copydetails DataTreeICreatorcreate_leaf_node()
31  svalue = this.funcptr(arg_node);
32  node = DataTree.DummyLeafNode(svalue);
33  end
34  end
35 end
Dummy implementation for a DataTree.ILeafNode that stores a single data.
Definition: DummyLeafNode.m:18
interface for a class used to create a new (sub-)tree from an old one with the DataTree.INode.creat...
Definition: ICreator.m:18
Definition: leaf.m:17
default implementation of the DataTree.ICreator interface
Simple DataTree.ICreator copying the original tree and applying a custom function to its leafs retur...
Definition: ScalarCreator.m:18