X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=application%2Fhub%2Fmain%2Fclass_BaseHubSystem.php;h=bb5df64688ba06a950efd2bbacc5dde81603b7b9;hb=eedbbb80ac6f49f2d43e3ae9a18008a25cfdc16e;hp=62eb1304b7f998636d3a0ce21bc8562c1dc72227;hpb=ecfe3c8077fa94964dfab3423e189db81b721a74;p=hub.git diff --git a/application/hub/main/class_BaseHubSystem.php b/application/hub/main/class_BaseHubSystem.php index 62eb1304b..bb5df6468 100644 --- a/application/hub/main/class_BaseHubSystem.php +++ b/application/hub/main/class_BaseHubSystem.php @@ -27,6 +27,11 @@ class BaseHubSystem extends BaseFrameworkSystem { */ private $nodeInstance = null; + /** + * An instance of a cruncher + */ + private $cruncherInstance = null; + /** * Listener instance */ @@ -37,6 +42,11 @@ class BaseHubSystem extends BaseFrameworkSystem { */ private $packageInstance = null; + /** + * State instance + */ + private $stateInstance = null; + /** * Protected constructor * @@ -49,41 +59,60 @@ class BaseHubSystem extends BaseFrameworkSystem { } /** - * Setter for listener instance + * Getter for node instance * - * @param $listenerInstance A Listenable instance + * @return $nodeInstance An instance of a node node + */ + public final function getNodeInstance () { + return $this->nodeInstance; + } + + /** + * Setter for node instance + * + * @param $nodeInstance An instance of a node node * @return void */ - protected final function setListenerInstance (Listenable $listenerInstance) { - $this->listenerInstance = $listenerInstance; + protected final function setNodeInstance (NodeHelper $nodeInstance) { + $this->nodeInstance = $nodeInstance; } /** - * Getter for listener instance + * Getter for cruncher instance * - * @return $listenerInstance A Listenable instance + * @return $cruncherInstance An instance of a cruncher cruncher */ - protected final function getListenerInstance () { - return $this->listenerInstance; + public final function getCruncherInstance () { + return $this->cruncherInstance; } /** - * Setter for node instance + * Setter for cruncher instance * - * @param $nodeInstance An instance of a node node + * @param $cruncherInstance An instance of a cruncher cruncher * @return void */ - protected final function setNodeInstance (NodeHelper $nodeInstance) { - $this->nodeInstance = $nodeInstance; + protected final function setCruncherInstance (CruncherHelper $cruncherInstance) { + $this->cruncherInstance = $cruncherInstance; } /** - * Getter for node instance + * Setter for listener instance * - * @return $nodeInstance An instance of a node node + * @param $listenerInstance A Listenable instance + * @return void */ - public final function getNodeInstance () { - return $this->nodeInstance; + protected final function setListenerInstance (Listenable $listenerInstance) { + $this->listenerInstance = $listenerInstance; + } + + /** + * Getter for listener instance + * + * @return $listenerInstance A Listenable instance + */ + protected final function getListenerInstance () { + return $this->listenerInstance; } /** @@ -105,6 +134,25 @@ class BaseHubSystem extends BaseFrameworkSystem { return $this->packageInstance; } + /** + * Setter for state instance + * + * @param $stateInstance A Stateable instance + * @return void + */ + public final function setStateInstance (Stateable $stateInstance) { + $this->stateInstance = $stateInstance; + } + + /** + * Getter for state instance + * + * @return $stateInstance A Stateable instance + */ + public final function getStateInstance () { + return $this->stateInstance; + } + /** * Shuts down a given socket resource. This method does only ease calling * the right visitor. @@ -125,6 +173,28 @@ class BaseHubSystem extends BaseFrameworkSystem { // Call the visitor $this->accept($visitorInstance); } + + /** + * "Getter" for a printable state name + * + * @return $stateName Name of the node's state in a printable format + */ + public final function getPrintableState () { + // Default is 'null' + $stateName = 'null'; + + // Get the state instance + $stateInstance = $this->getStateInstance(); + + // Is it an instance of Stateable? + if ($stateInstance instanceof Stateable) { + // Then use that state name + $stateName = $stateInstance->getStateName(); + } // END - if + + // Return result + return $stateName; + } } // [EOF]