Continued:
authorRoland Häder <roland@mxchange.org>
Wed, 2 Dec 2020 00:21:38 +0000 (01:21 +0100)
committerRoland Häder <roland@mxchange.org>
Wed, 2 Dec 2020 00:21:38 +0000 (01:21 +0100)
- REFACTURING: added more traits from monolithic BaseFrameworkSystem class

Signed-off-by: Roland Häder <roland@mxchange.org>
framework/main/classes/class_BaseFrameworkSystem.php
framework/main/classes/handler/tasks/class_TaskHandler.php
framework/main/classes/index/class_BaseIndex.php
framework/main/classes/lists/class_BaseList.php
framework/main/classes/registry/class_BaseRegistry.php
framework/main/classes/stacker/file/class_BaseFileStack.php
framework/main/interfaces/lists/class_Listable.php
framework/main/traits/iterator/class_IteratorTrait.php [new file with mode: 0644]
framework/main/traits/stream/input/class_InputStreamTrait.php [new file with mode: 0644]
framework/main/traits/stream/output/class_OutputStreamTrait.php [new file with mode: 0644]

index 7195861e84f29f7bfc167c27de41413d186f91b8..15a9f5fbead9c47707308ca880164f4045f1b163 100644 (file)
@@ -19,15 +19,12 @@ use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Result\Database\CachedDatabaseResult;
 use Org\Mxchange\CoreFramework\State\Stateable;
-use Org\Mxchange\CoreFramework\Stream\Input\InputStream;
 use Org\Mxchange\CoreFramework\Stream\Output\OutputStreamer;
-use Org\Mxchange\CoreFramework\Stream\Output\OutputStream;
 use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
 
 // Import SPL stuff
 use \stdClass;
 use \InvalidArgumentException;
-use \Iterator;
 use \ReflectionClass;
 use \SplFileInfo;
 
@@ -70,21 +67,6 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac
         */
        private $realClass = __CLASS__;
 
-       /**
-        * Instance of an Iterator class
-        */
-       private $iteratorInstance = NULL;
-
-       /**
-        * An instance of a InputStream class
-        */
-       private $inputStreamInstance = NULL;
-
-       /**
-        * An instance of a OutputStream class
-        */
-       private $outputStreamInstance = NULL;
-
        /**
         * An instance of a database wrapper class
         */
@@ -475,63 +457,6 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac
                return $this->wrapperInstance;
        }
 
-       /**
-        * Getter for a InputStream instance
-        *
-        * @param       $inputStreamInstance    The InputStream instance
-        */
-       protected final function getInputStreamInstance () {
-               return $this->inputStreamInstance;
-       }
-
-       /**
-        * Setter for a InputStream instance
-        *
-        * @param       $inputStreamInstance    The InputStream instance
-        * @return      void
-        */
-       protected final function setInputStreamInstance (InputStream $inputStreamInstance) {
-               $this->inputStreamInstance = $inputStreamInstance;
-       }
-
-       /**
-        * Getter for a OutputStream instance
-        *
-        * @param       $outputStreamInstance   The OutputStream instance
-        */
-       protected final function getOutputStreamInstance () {
-               return $this->outputStreamInstance;
-       }
-
-       /**
-        * Setter for a OutputStream instance
-        *
-        * @param       $outputStreamInstance   The OutputStream instance
-        * @return      void
-        */
-       protected final function setOutputStreamInstance (OutputStream $outputStreamInstance) {
-               $this->outputStreamInstance = $outputStreamInstance;
-       }
-
-       /**
-        * Setter for Iterator instance
-        *
-        * @param       $iteratorInstance       An instance of an Iterator
-        * @return      void
-        */
-       protected final function setIteratorInstance (Iterator $iteratorInstance) {
-               $this->iteratorInstance = $iteratorInstance;
-       }
-
-       /**
-        * Getter for Iterator instance
-        *
-        * @return      $iteratorInstance       An instance of an Iterator
-        */
-       public final function getIteratorInstance () {
-               return $this->iteratorInstance;
-       }
-
        /**
         * Setter for state instance
         *
index 4c3eaaad4adbf54bf2440655c3e5b5eb644f0b7a..40badb6f069f3685c599b41cd0a8f8ad810cf90b 100644 (file)
@@ -9,6 +9,7 @@ use Org\Mxchange\CoreFramework\Handler\BaseHandler;
 use Org\Mxchange\CoreFramework\Lists\Listable;
 use Org\Mxchange\CoreFramework\Registry\Registerable;
 use Org\Mxchange\CoreFramework\Task\Taskable;
+use Org\Mxchange\CoreFramework\Traits\Iterator\IteratorTrait;
 use Org\Mxchange\CoreFramework\Visitor\Visitable;
 use Org\Mxchange\CoreFramework\Visitor\Visitor;
 
@@ -35,6 +36,9 @@ use Org\Mxchange\CoreFramework\Visitor\Visitor;
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 class TaskHandler extends BaseHandler implements Registerable, HandleableTask {
+       // Load traits
+       use IteratorTrait;
+
        // Exception constants
        const EXCEPTION_TASK_IS_INVALID = 0xb00;
 
index 2b3d13a55978c2864a980e06c261cc1e172ae18e..0e2c415c875f7a3bcc66fe2371268fb65f3f5cff 100644 (file)
@@ -9,6 +9,7 @@ use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
 use Org\Mxchange\CoreFramework\Iterator\Filesystem\SeekableWritableFileIterator;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
+use Org\Mxchange\CoreFramework\Traits\Iterator\IteratorTrait;
 
 // Import SPL stuff
 use \SplFileInfo;
@@ -37,6 +38,9 @@ use \UnexpectedValueException;
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 abstract class BaseIndex extends BaseFrameworkSystem {
+       // Load traits
+       use IteratorTrait;
+
        /**
         * Magic for this index
         */
index 08d60de88167a0d48da4e269b983e8dc52424830..b31350285775b6a942a698543f741fe1183f5a14 100644 (file)
@@ -6,6 +6,7 @@ namespace Org\Mxchange\CoreFramework\Lists;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
+use Org\Mxchange\CoreFramework\Traits\Iterator\IteratorTrait;
 use Org\Mxchange\CoreFramework\Visitor\Visitable;
 
 // Import SPL stuff
@@ -35,6 +36,9 @@ use \Countable;
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate, Countable {
+       // Load traits
+       use IteratorTrait;
+
        // Exception constants
        const EXCEPTION_GROUP_ALREADY_ADDED = 0xf20;
        const EXCEPTION_GROUP_NOT_FOUND     = 0xf21;
@@ -82,7 +86,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
 
                        // Set it here
                        $this->setIteratorInstance($iteratorInstance);
-               } // END - if
+               }
 
                // And return it
                return $iteratorInstance;
@@ -94,7 +98,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
         * @param       $groupName      Group to check if found in list
         * @return      $isset          Whether the group is valid
         */
-       public function isGroupSet ($groupName) {
+       public function isGroupSet (string $groupName) {
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName);
                return isset($this->listGroups[$groupName]);
        }
@@ -106,13 +110,13 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
         * @return      void
         * @throws      ListGroupAlreadyAddedException  If the given group is already added
         */
-       public function addGroup ($groupName) {
+       public function addGroup (string $groupName) {
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName . ' - CALLED!');
                // Is the group already added?
                if ($this->isGroupSet($groupName)) {
                        // Throw the exception here
                        throw new ListGroupAlreadyAddedException(array($this, $groupName), self::EXCEPTION_GROUP_ALREADY_ADDED);
-               } // END - if
+               }
 
                // Add the group which is a simple array
                $this->listGroups[$groupName] = ObjectFactory::createObjectByConfiguredName('list_group_class');
@@ -128,7 +132,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
         * @return      void
         * @throws      NoListGroupException    If the given group is not found
         */
-       public function addInstance ($groupName, $subGroup, Visitable $visitableInstance) {
+       public function addInstance (string $groupName, string $subGroup, Visitable $visitableInstance) {
                // Debug message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName  . ',subGroup=' . $subGroup . ',visitableInstance=' . $visitableInstance->__toString() . ' - CALLED!');
 
@@ -136,13 +140,13 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
                if (!$this->isGroupSet($groupName)) {
                        // Throw the exception here
                        throw new NoListGroupException(array($this, $groupName), self::EXCEPTION_GROUP_NOT_FOUND);
-               } // END - if
+               }
 
                // Is the sub group there?
                if (!$this->listGroups[$groupName]->isGroupSet($subGroup)) {
                        // Automatically add it
                        $this->listGroups[$groupName]->addGroup($subGroup);
-               } // END - if
+               }
 
                // Generate the hash
                $hash = $this->generateHash($groupName, $subGroup, $visitableInstance);
@@ -175,7 +179,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
                if ((!is_null($list)) && (!$this->isGroupSet($list))) {
                        // Throw the exception here
                        throw new NoListGroupException(array($this, $list), self::EXCEPTION_GROUP_NOT_FOUND);
-               } // END - if
+               }
 
                // Init array
                $array = [];
@@ -184,7 +188,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
                if (!is_null($list)) {
                        // Then get it as well
                        $array = $this->listGroups[$list]->getArrayFromList(NULL);
-               } // END - if
+               }
 
                // Walk through all entries
                foreach ($this->listIndex as $hash) {
@@ -196,8 +200,8 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
                                // Add it
                                array_push($array, $this->listEntries[$hash]);
                                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: hash=' . $hash . ',array(' . count($array) . ')=' . print_r($array, true) . ' - ADDED!');
-                       } // END - if
-               } // END - foreach
+                       }
+               }
 
                // Debug message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',list[' . gettype($list) . ']=' . $list . ',[]=' . count($array) . ' - EXIT!');
@@ -214,7 +218,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
         * @return      void
         * @throws      NoListGroupException    If the given group is not found
         */
-       public function addEntry ($groupName, $entry) {
+       public function addEntry (string $groupName, $entry) {
                // Debug message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName . ' - CALLED!');
 
@@ -222,7 +226,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
                if (!$this->isGroupSet($groupName)) {
                        // Throw the exception here
                        throw new NoListGroupException(array($this, $groupName), self::EXCEPTION_GROUP_NOT_FOUND);
-               } // END - if
+               }
 
                // Generate hash
                $hash = $this->generateHash($groupName, $groupName, $entry);
@@ -251,7 +255,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
         * @return      void
         * @throws      NoListGroupException    If the given group is not found
         */
-       public function removeEntry ($groupName, $entry) {
+       public function removeEntry (string $groupName, $entry) {
                // Debug message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LIST: this=' . $this->__toString() . ',groupName=' . $groupName . ' - CALLED!');
 
@@ -259,7 +263,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
                if (!$this->isGroupSet($groupName)) {
                        // Throw the exception here
                        throw new NoListGroupException(array($this, $groupName), self::EXCEPTION_GROUP_NOT_FOUND);
-               } // END - if
+               }
 
                // Generate hash
                $hash = $this->generateHash($groupName, $groupName, $entry);
@@ -285,7 +289,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
         * @param       $entry          An entry of any type
         * @return      $hash           The generated
         */
-       private function generateHash ($groupName, $subGroup, $entry) {
+       private function generateHash (string $groupName, string $subGroup, $entry) {
                // Created entry, 'null' is default
                $entry2 = 'null';
 
@@ -336,7 +340,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
                foreach ($groupNames as $groupName) {
                        // Clear this group
                        $this->clearGroup($groupName);
-               } // END - foreach
+               }
        }
 
        /**
@@ -345,12 +349,12 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
         * @param       $groupName      Name of an existing group to clear
         * @return      void
         */
-       protected function clearGroup ($groupName) {
+       protected function clearGroup (string $groupName) {
                // Does this group exist?
                if (!$this->isGroupSet($groupName)) {
                        // Throw the exception here
                        throw new NoListGroupException(array($this, $groupName), self::EXCEPTION_GROUP_NOT_FOUND);
-               } // END - if
+               }
 
                // Then clear this group list
                $this->listGroups[$groupName]->clearList();
@@ -412,7 +416,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
                if (!$this->isHashValid($hash)) {
                        // Throw an exception here
                        throw new InvalidListHashException(array($this, $hash, $hashIndex), self::EXCEPTION_INVALID_HASH);
-               } // END - if
+               }
 
                // Now copy the entry
                $entry = $this->listEntries[$hash];
@@ -428,12 +432,12 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
         * @return      $entries        The array with all entries
         * @throws      NoListGroupException    If the specified group is invalid
         */
-       public function getArrayFromProtocolInstance ($groupName) {
+       public function getArrayFromProtocolInstance (string $groupName) {
                // Is the group valid?
                if (!$this->isGroupSet($groupName)) {
                        // Throw the exception here
                        throw new NoListGroupException(array($this, $groupName), self::EXCEPTION_GROUP_NOT_FOUND);
-               } // END - if
+               }
 
                // Init the entries' array
                $entries = [];
@@ -460,7 +464,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
 
                        // Skip to next one
                        $iteratorInstance->next();
-               } // END - while
+               }
 
                // Return the list
                return $entries;
@@ -479,7 +483,7 @@ abstract class BaseList extends BaseFrameworkSystem implements IteratorAggregate
                if (!$this->isHashValid($hash)) {
                        // Throw an exception here, hashIndex is unknown at this point
                        throw new InvalidListHashException(array($this, $hash, -999), self::EXCEPTION_INVALID_HASH);
-               } // END - if
+               }
 
                // Set the entry
                $this->listEntries[$hash] = $entryArray;
index 4613bc1c778c13a45f947faab62a559be9fc997b..d784706376bfa19a72a089da3e76b359bc4038e8 100644 (file)
@@ -6,6 +6,7 @@ namespace Org\Mxchange\CoreFramework\Registry;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Generic\NullPointerException;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
+use Org\Mxchange\CoreFramework\Traits\Iterator\IteratorTrait;
 
 // Import SPL stuff
 use \IteratorAggregate;
@@ -33,16 +34,14 @@ use \IteratorAggregate;
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 abstract class BaseRegistry extends BaseFrameworkSystem implements Register, Registerable, IteratorAggregate {
+       // Load traits
+       use IteratorTrait;
+
        /**
         * Glue for generating a registry key
         */
        const REGISTRY_KEY_GLUE = '_';
 
-       /**
-        * Instance of this class
-        */
-       private static $registryInstance = NULL;
-
        /**
         * Protected constructor
         *
index 1960259d04732e4c089505674822aca946646acc..d313f16e941f6eab4714b1c1510d8cf037f096d7 100644 (file)
@@ -11,6 +11,7 @@ use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
 use Org\Mxchange\CoreFramework\Index\Indexable;
 use Org\Mxchange\CoreFramework\Iterator\Filesystem\SeekableWritableFileIterator;
 use Org\Mxchange\CoreFramework\Stacker\BaseStacker;
+use Org\Mxchange\CoreFramework\Traits\Iterator\IteratorTrait;
 use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
 
 // Import SPL stuff
@@ -40,6 +41,9 @@ use \UnexpectedValueException;
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 abstract class BaseFileStack extends BaseStacker {
+       // Load traits
+       use IteratorTrait;
+
        // Exception codes
        const EXCEPTION_BAD_MAGIC = 0xe100;
 
index 5eb15229b37a17e92df967ea1a1feb2deac18abf..4844d0a40fe8cb030832331eee9374d151ca5723 100644 (file)
@@ -38,7 +38,7 @@ interface Listable extends FrameworkInterface, IteratorAggregate {
         * @param       $groupName      Group to check if found in list
         * @return      $isset          Whether the group is valid
         */
-       function isGroupSet ($groupName);
+       function isGroupSet (string $groupName);
 
        /**
         * Adds the given group or if already added issues a ListGroupAlreadyAddedException
@@ -47,7 +47,7 @@ interface Listable extends FrameworkInterface, IteratorAggregate {
         * @return      void
         * @throws      ListGroupAlreadyAddedException  If the given group is already added
         */
-       function addGroup ($groupName);
+       function addGroup (string $groupName);
 
        /**
         * Adds the given instance to list group and sub group
@@ -58,7 +58,7 @@ interface Listable extends FrameworkInterface, IteratorAggregate {
         * @return      void
         * @throws      NoListGroupException    If the given group is not found
         */
-       function addInstance ($groupName, $subGroup, Visitable $visitableInstance);
+       function addInstance (string $groupName, string $subGroup, Visitable $visitableInstance);
 
        /**
         * Adds the given entry to list group
@@ -68,7 +68,7 @@ interface Listable extends FrameworkInterface, IteratorAggregate {
         * @return      void
         * @throws      NoListGroupException    If the given group is not found
         */
-       function addEntry ($groupName, $entry);
+       function addEntry (string $groupName, $entry);
 
        /**
         * Updates the given entry by hash with given array
diff --git a/framework/main/traits/iterator/class_IteratorTrait.php b/framework/main/traits/iterator/class_IteratorTrait.php
new file mode 100644 (file)
index 0000000..a5df6a6
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Traits\Iterator;
+
+// Import SPL stuff
+use \Iterator;
+
+/**
+ * A trait for iterators
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+trait IteratorTrait {
+       /**
+        * Instance of an Iterator class
+        */
+       private $iteratorInstance = NULL;
+
+       /**
+        * Setter for Iterator instance
+        *
+        * @param       $iteratorInstance       An instance of an Iterator
+        * @return      void
+        */
+       protected final function setIteratorInstance (Iterator $iteratorInstance) {
+               $this->iteratorInstance = $iteratorInstance;
+       }
+
+       /**
+        * Getter for Iterator instance
+        *
+        * @return      $iteratorInstance       An instance of an Iterator
+        */
+       public final function getIteratorInstance () {
+               return $this->iteratorInstance;
+       }
+
+}
diff --git a/framework/main/traits/stream/input/class_InputStreamTrait.php b/framework/main/traits/stream/input/class_InputStreamTrait.php
new file mode 100644 (file)
index 0000000..495bfa2
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Traits\Stream\Input;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Stream\Input\InputStream;
+
+/**
+ * A trait for input stream classes
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+trait InputStreamTrait {
+       /**
+        * An instance of a InputStream class
+        */
+       private $inputStreamInstance = NULL;
+
+       /**
+        * Getter for a InputStream instance
+        *
+        * @param       $inputStreamInstance    An instance of an InputStream class
+        */
+       protected final function getInputStreamInstance () {
+               return $this->inputStreamInstance;
+       }
+
+       /**
+        * Setter for a InputStream instance
+        *
+        * @param       $inputStreamInstance    An instance of an InputStream class
+        * @return      void
+        */
+       protected final function setInputStreamInstance (InputStream $inputStreamInstance) {
+               $this->inputStreamInstance = $inputStreamInstance;
+       }
+
+}
diff --git a/framework/main/traits/stream/output/class_OutputStreamTrait.php b/framework/main/traits/stream/output/class_OutputStreamTrait.php
new file mode 100644 (file)
index 0000000..87919c8
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Traits\Stream\Output;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Stream\Output\OutputStream;
+
+/**
+ * A trait for output stream classes
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+trait OutputStreamTrait {
+       /**
+        * An instance of a OutputStream class
+        */
+       private $outputStreamInstance = NULL;
+
+       /**
+        * Getter for a OutputStream instance
+        *
+        * @param       $outputStreamInstance   An instance of an OutputStream class
+        */
+       protected final function getOutputStreamInstance () {
+               return $this->outputStreamInstance;
+       }
+
+       /**
+        * Setter for a OutputStream instance
+        *
+        * @param       $outputStreamInstance   An instance of an OutputStream class
+        * @return      void
+        */
+       protected final function setOutputStreamInstance (OutputStream $outputStreamInstance) {
+               $this->outputStreamInstance = $outputStreamInstance;
+       }
+
+}