1 | <?php |
||
15 | abstract class AbstractNode implements NodeInterface |
||
16 | { |
||
17 | /** |
||
18 | * The id of the node. |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | private $id; |
||
23 | |||
24 | /** |
||
25 | * The parameters of this node. |
||
26 | * |
||
27 | * @var array |
||
28 | */ |
||
29 | private $parameters; |
||
30 | |||
31 | /** |
||
32 | * The sockets that this node has. |
||
33 | * |
||
34 | * @var Socket[] |
||
35 | */ |
||
36 | private $sockets; |
||
37 | |||
38 | /** |
||
39 | * The value of this node. |
||
40 | * |
||
41 | * @var mixed |
||
42 | */ |
||
43 | private $value; |
||
44 | |||
45 | /** |
||
46 | * Initializes a new instance of this class. |
||
47 | */ |
||
48 | public function __construct() |
||
53 | |||
54 | /** |
||
55 | * Gets the id of the node. |
||
56 | * |
||
57 | * @return string |
||
58 | */ |
||
59 | public function getId() |
||
66 | |||
67 | /** |
||
68 | * Activates the socket with the given index. |
||
69 | * |
||
70 | * @param string $socket The name of the socket to activate. |
||
71 | */ |
||
72 | protected function activate($socket) |
||
76 | |||
77 | /** |
||
78 | * Binds the given node to a socket. |
||
79 | * |
||
80 | * @param string $socketName The name of the socket to bind to. |
||
81 | * @param NodeInterface $node The node to bind to. |
||
82 | * @return int |
||
83 | */ |
||
84 | public function bind($socketName, NodeInterface $node) |
||
92 | |||
93 | /** |
||
94 | * Creates a socket with the given name. |
||
95 | * |
||
96 | * @param string $name The name of the scoket to create. |
||
97 | */ |
||
98 | protected function createSocket($name) |
||
106 | |||
107 | /** |
||
108 | * Gets the socket with the given index. |
||
109 | * |
||
110 | * @param string $name The name of the socket to get. |
||
111 | * @return Socket |
||
112 | */ |
||
113 | public function getSocket($name) |
||
121 | |||
122 | /** |
||
123 | * Gets a list with all sockets that exist for this node. |
||
124 | * |
||
125 | * @return Socket[] |
||
126 | */ |
||
127 | public function getSockets() |
||
131 | |||
132 | /** |
||
133 | * Checks if the node has a socket with the given name. |
||
134 | * |
||
135 | * @param string $name The name of the socket to check. |
||
136 | * @return bool |
||
137 | */ |
||
138 | public function hasSocket($name) |
||
142 | |||
143 | /** |
||
144 | * Gets the parameter with the given name. |
||
145 | * |
||
146 | * @param string $name The name of the parameter to get. |
||
147 | * @return string |
||
148 | */ |
||
149 | public function getParam($name) |
||
156 | |||
157 | /** |
||
158 | * Gets the parameters of this node. |
||
159 | * |
||
160 | * @return array |
||
161 | */ |
||
162 | public function getParams() |
||
166 | |||
167 | /** |
||
168 | * Sets the parameter with the given name. |
||
169 | * |
||
170 | * @param string $name The name of the parameter to get. |
||
171 | * @param mixed $value The value to set. |
||
172 | */ |
||
173 | public function setParam($name, $value) |
||
177 | |||
178 | /** |
||
179 | * Gets the value of this node. |
||
180 | * |
||
181 | * @return mixed |
||
182 | */ |
||
183 | public function getValue() |
||
187 | |||
188 | /** |
||
189 | * Sets the value of this node. |
||
190 | * |
||
191 | * @param mixed $value |
||
192 | */ |
||
193 | public function setValue($value) |
||
197 | } |
||
198 |