inc/classes/exceptions/result/class_ResultUpdateException.php -text
inc/classes/exceptions/socket/.htaccess -text
inc/classes/exceptions/socket/class_InvalidSocketException.php -text
+inc/classes/exceptions/stacker/.htaccess -text
+inc/classes/exceptions/stacker/class_AlreadyInitializedStackerException.php -text
+inc/classes/exceptions/stacker/class_EmptyStackerException.php -text
+inc/classes/exceptions/stacker/class_FullStackerException.php -text
+inc/classes/exceptions/stacker/class_NoStackerException.php -text
inc/classes/exceptions/state/.htaccess -text
inc/classes/exceptions/state/class_InvalidStateException.php -text
inc/classes/exceptions/state/class_InvalidStateInstanceException.php -text
inc/classes/interfaces/result/.htaccess -text
inc/classes/interfaces/result/class_SearchableResult.php -text
inc/classes/interfaces/result/class_UpdateableResult.php -text
+inc/classes/interfaces/stacker/.htaccess -text
+inc/classes/interfaces/stacker/class_Stackable.php -text
inc/classes/interfaces/state/.htaccess -text
inc/classes/interfaces/state/class_Stateable.php -text
inc/classes/interfaces/streams/.htaccess -text
inc/classes/main/result/class_DatabaseResult.php -text
inc/classes/main/rng/.htaccess -text
inc/classes/main/rng/class_RandomNumberGenerator.php -text
+inc/classes/main/stacker/.htaccess -text
+inc/classes/main/stacker/class_ -text
+inc/classes/main/stacker/class_BaseStacker.php -text
+inc/classes/main/stacker/fifo/.htaccess -text
+inc/classes/main/stacker/fifo/class_FiFoStacker.php -text
+inc/classes/main/stacker/filo/.htaccess -text
+inc/classes/main/stacker/filo/class_FiLoStacker.php -text
inc/classes/main/streams/.htaccess -text
inc/classes/main/streams/class_ -text
inc/classes/main/streams/class_BaseStream.php -text
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * Thrown if a stacker is already initialized
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.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/>.
+ */
+class AlreadyInitializedStackerException extends FrameworkException {
+ /**
+ * The super constructor for all exceptions
+ *
+ * @param $messageArray Error message array
+ * @param $code Error code
+ * @return void
+ */
+ public function __construct(array $messageArray, $code) {
+ // Construct message
+ $message = sprintf("[%s:%d] Stacker %s already initialized.",
+ $messageArray[0]->__toString(),
+ $this->getLine(0),
+ $messageArray[1]
+ );
+
+ // Call parent exception constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * Thrown if a stacker is empty
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.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/>.
+ */
+class EmptyStackerException extends FrameworkException {
+ /**
+ * The super constructor for all exceptions
+ *
+ * @param $messageArray Error message array
+ * @param $code Error code
+ * @return void
+ */
+ public function __construct(array $messageArray, $code) {
+ // Construct message
+ $message = sprintf("[%s:%d] Stacker %s is empty.",
+ $messageArray[0]->__toString(),
+ $this->getLine(0),
+ $messageArray[1]
+ );
+
+ // Call parent exception constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * Thrown if a stacker is full
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.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/>.
+ */
+class FullStackerException extends FrameworkException {
+ /**
+ * The super constructor for all exceptions
+ *
+ * @param $messageArray Error message array
+ * @param $code Error code
+ * @return void
+ */
+ public function __construct(array $messageArray, $code) {
+ // Construct message
+ $message = sprintf("[%s:%d] Stacker %s is full.",
+ $messageArray[0]->__toString(),
+ $this->getLine(0),
+ $messageArray[1]
+ );
+
+ // Call parent exception constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * Thrown if a stacker is empty
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.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/>.
+ */
+class NoStackerException extends FrameworkException {
+ /**
+ * The super constructor for all exceptions
+ *
+ * @param $messageArray Error message array
+ * @param $code Error code
+ * @return void
+ */
+ public function __construct(array $messageArray, $code) {
+ // Construct message
+ $message = sprintf("[%s:%d] Stacker %s is not intialized.",
+ $messageArray[0]->__toString(),
+ $this->getLine(0),
+ $messageArray[1]
+ );
+
+ // Call parent exception constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
function execute (Requestable $requestInstance, Responseable $responseInstance);
}
-//
+// [EOF]
?>
function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance);
}
-//
+// [EOF]
?>
function updateAuthData ();
}
-//
+// [EOF]
?>
function renderCode ();
}
-//
+// [EOF]
?>
interface ??? extends FrameworkInterface {
}
-//
+// [EOF]
?>
function hashCode ();
}
-//
+// [EOF]
?>
function handleRequest (Requestable $requestInstance, Responseable $responseInstance);
}
-//
+// [EOF]
?>
function addConfiguredCriteria ($criteriaKey, $configEntry);
}
-//
+// [EOF]
?>
interface LocalSearchCriteria extends Criteria {
}
-//
+// [EOF]
?>
interface LocalUpdateCriteria extends Criteria {
}
-//
+// [EOF]
?>
function updateDatabaseField ($fieldName, $fieldValue);
}
-//
+// [EOF]
?>
function doUpdateByResult (UpdateableResult $resultInstance);
}
-//
+// [EOF]
?>
function doUpdateByResult (UpdateableResult $resultInstance);
}
-//
+// [EOF]
?>
function outputStream ($output);
}
-//
+// [EOF]
?>
function addResultsToHelper (HelpableTemplate $helperInstance);
}
-//
+// [EOF]
?>
function execute (Requestable $requestInstance, Responseable $responseInstance);
}
-//
+// [EOF]
?>
function executeLogin (Responseable $responseInstance);
}
-//
+// [EOF]
?>
function flushContent ();
}
-//
+// [EOF]
?>
interface Streamable extends FrameworkInterface {
}
-//
+// [EOF]
?>
*
* @param $fqfn The file's FQFN we shall load
* @return $array An array containing all read lines
- * @throws InvalidArrayCountException If an array has not the
- * expected size
+ * @throws InvalidArrayCountException If an array has not the expected size
* @throws InvalidMD5ChecksumException If two MD5 hashes did not match
*/
function loadFileContents ($fqfn);
}
-//
+// [EOF]
?>
* external servers.
*
* @param $fileName The local file's name including full path
- * @param $dataArray Array containing the compressor's extension
- * and streamed data
+ * @param $dataArray Array containing the compressor's extension and streamed data
* @return void
*/
function saveFile ($fileName, $dataArray);
}
-//
+// [EOF]
?>
function output ($outStream = false);
}
-//
+// [EOF]
?>
* @return void
*/
function initLanguageStrings();
-} // END - class
+}
// [EOF]
?>
function doLogin (Requestable $requestInstance, Responseable $responseInstance);
}
-//
+// [EOF]
?>
function sendAdminNotification ();
}
-//
+// [EOF]
?>
function parseXmlContent ($content);
}
-//
+// [EOF]
?>
function addElementsToDataSet (StoreableCriteria $criteriaInstance);
}
-//
+// [EOF]
?>
function initializeReader();
}
-//
+// [EOF]
?>
function addElementsToDataSet (StoreableCriteria $criteriaInstance);
}
-//
+// [EOF]
?>
function readCookie ($cookieName);
}
-//
+// [EOF]
?>
function isActionValid ($actionName);
}
-//
+// [EOF]
?>
interface Resolver extends FrameworkInterface {
}
-//
+// [EOF]
?>
function isCommandValid ($commandName);
}
-//
+// [EOF]
?>
function resolveController ();
}
-//
+// [EOF]
?>
function isStateValid ($stateName);
}
-//
+// [EOF]
?>
function refreshCookie ($cookieName);
}
-//
+// [EOF]
?>
--- /dev/null
+Deny from all
+Deny from all
--- /dev/null
+<?php
+/**
+ * A Stackable interface
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.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/>.
+ */
+interface Stackable extends FrameworkInterface {
+ /**
+ * Pushs a value on a named stacker
+ *
+ * @param $stackerName Name of the stacker
+ * @param $value Value to push on it
+ * @return void
+ * @throws StackerFullException If the stacker is full
+ */
+ function pushNamed ($stackerName, $value);
+
+ /**
+ * 'Pops' a value from a named stacker
+ *
+ * @param $stackerName Name of the stacker
+ * @return void
+ * @throws NoStackerException If the named stacker was not found
+ * @throws EmptyStackerException If the named stacker is empty
+ */
+ function popNamed ($stackerName);
+
+ /**
+ * Get value from named stacker
+ *
+ * @param $stackerName Name of the stacker
+ * @return $value Value of last added value
+ * @throws NoStackerException If the named stacker was not found
+ * @throws EmptyStackerException If the named stacker is empty
+ */
+ function getNamed ($stackerName);
+}
+
+// [EOF]
+?>
+<?php
+/**
+ * A Stackable interface
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.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/>.
+ */
+interface Stackable extends FrameworkInterface {
+ /**
+ * Pushs a value on a named stacker
+ *
+ * @param $stackerName Name of the stacker
+ * @param $value Value to push on it
+ * @return void
+ * @throws StackerFullException If the stacker is full
+ */
+ function pushNamed ($stackerName, $value);
+
+ /**
+ * 'Pops' a value from a named stacker
+ *
+ * @param $stackerName Name of the stacker
+ * @return void
+ * @throws NoStackerException If the named stacker was not found
+ * @throws EmptyStackerException If the named stacker is empty
+ */
+ function popNamed ($stackerName);
+
+ /**
+ * Get value from named stacker
+ *
+ * @param $stackerName Name of the stacker
+ * @return $value Value of last added value
+ * @throws NoStackerException If the named stacker was not found
+ * @throws EmptyStackerException If the named stacker is empty
+ */
+ function getNamed ($stackerName);
+}
+
+// [EOF]
+?>
interface Stateable extends FrameworkInterface {
}
-//
+// [EOF]
?>
interface Streamable extends FrameworkInterface {
}
-//
+// [EOF]
?>
function decryptStream ($encrypted);
}
-//
+// [EOF]
?>
* @return void
*/
function output ();
-} // END - class
+}
// [EOF]
?>
function ifPasswordHashMatches (Requestable $requestInstance);
}
-//
+// [EOF]
?>
interface ManageableGuest extends ManageableAccount {
}
-//
+// [EOF]
?>
interface ManageableMember extends ManageableAccount {
}
-//
+// [EOF]
?>
*
* @param $appInstance A manageable application
* @return $///Instance An instance of !!!
+ */
public final static function create???!!! (ManageableApplication $appInstance) {
// Get a new instance
$///Instance = new ???!!!();
*/
private $imageInstance = null;
+ /**
+ * Instance of the stacker
+ */
+ private $stackerInstance = null;
+
/**
* The real class name
*/
public final function getImageInstance () {
return $this->imageInstance;
}
+
+ /**
+ * Setter for stacker instanxe
+ *
+ * @param $stackerInstance An instance of an stacker
+ * @return void
+ */
+ public final function setStackerInstance (Stackable $stackerInstance) {
+ $this->stackerInstance = $stackerInstance;
+ }
+
+ /**
+ * Getter for stacker instanxe
+ *
+ * @return $stackerInstance An instance of an stacker
+ */
+ public final function getStackerInstance () {
+ return $this->stackerInstance;
+ }
}
// [EOF]
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A ??? Stacker class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.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/>.
+ */
+class ???Stacker extends BaseStacker implements Stackable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of the class Stacker and prepares it for usage
+ *
+ * @param $appInstance A manageable application
+ * @return $stackerInstance An instance of ???Stacker
+ */
+ public final static function create???Stacker (ManageableApplication $appInstance) {
+ // Get a new instance
+ $stackerInstance = new ???Stacker();
+
+ // Init generic stacker
+ $stackerInstance->initStacker('generic');
+
+ // Return the prepared instance
+ return $stackerInstance;
+ }
+
+ /**
+ * Pushs a value on a named stacker
+ *
+ * @param $stackerName Name of the stack
+ * @param $value Value to push on it
+ * @return void
+ * @throws StackerFullException If the stack is full
+ */
+ public function pushNamed ($stackerName, $value) {
+ $this->partialStub('stackerName=' . $stackerName . ',value[' . gettype($value) . ']=' . $value);
+ }
+
+ /**
+ * 'Pops' a value from a named stacker
+ *
+ * @param $stackerName Name of the stack
+ * @return void
+ * @throws NoStackerException If the named stacker was not found
+ * @throws EmptyStackerException If the named stacker is empty
+ */
+ public function popNamed ($stackerName) {
+ $this->partialStub('stackerName=' . $stackerName);
+ }
+
+ /**
+ * Get value from named stacker
+ *
+ * @param $stackerName Name of the stack
+ * @return $value Value of last added value
+ * @throws NoStackerException If the named stacker was not found
+ * @throws EmptyStackerException If the named stacker is empty
+ */
+ public function getNamed ($stackerName) {
+ $this->partialStub('stackerName=' . $stackerName);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A general Stacker
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.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/>.
+ */
+class BaseStacker extends BaseFrameworkSystem {
+ // Exception codes
+ const EXCEPTION_STACKER_ALREADY_INITIALIZED = 0x050;
+ const EXCEPTION_STACKER_IS_FULL = 0x051;
+ const EXCEPTION_NO_STACKER_FOUND = 0x052;
+ const EXCEPTION_STACKER_IS_EMPTY = 0x053;
+
+ /**
+ * An array holding all stacks
+ */
+ private $stacks = array();
+
+ /**
+ * Protected constructor
+ *
+ * @param $className Name of the class
+ * @return void
+ */
+ protected function __construct ($className) {
+ // Call parent constructor
+ parent::__construct($className);
+ }
+
+ /**
+ * Initializes given stacker
+ *
+ * @param $stackerName Name of the stack
+ * @return void
+ * @throws AlreadyInitializedStackerException If the stack is already initialized
+ */
+ protected final function initStacker ($stackerName) {
+ // Is the stack already initialized?
+ if ($this->isStackInitialized($stackerName)) {
+ // Then throw the exception
+ throw new AlreadyInitializedStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_ALREADY_INITIALIZED);
+ } // END - if
+
+ // Initialize the given stack
+ $this->stacks[$stackerName] = array(
+ 'max_size' => $this->getConfigInstance()->getConfigEntry('stacker_' . $stackerName . '_max_size'),
+ 'entries' => array()
+ );
+ }
+
+ /**
+ * Checks wether the given stack is initialized (set in array $stackers)
+ *
+ * @param $stackerName Name of the stack
+ * @return $isInitialized Wether the stack is initialized
+ */
+ protected final function isStackInitialized ($stackerName) {
+ // Is is there?
+ $isInitialized = ((isset($this->stacks[$stackerName])) && (is_array($this->stacks[$stackerName])));
+
+ // Return result
+ return $isInitialized;
+ }
+
+ /**
+ * Checks wether the given stack is full
+ *
+ * @param $stackerName Name of the stack
+ * @return $isFull Wether the stack is full
+ * @throws NoStackerException If given stack is missing
+ */
+ protected final function isStackFull($stackerName) {
+ // Is the stack not yet initialized?
+ if (!$this->isStackInitialized($stackerName)) {
+ // Throw an exception
+ throw new NoStackerException(array($this, $stackerName), self::EXCEPTION_NO_STACKER_FOUND);
+ } // END - if
+
+ // So, is the stack full?
+ $isFull = (($this->getStackCount($stackerName)) == $this->getConfigInstance()->getConfigEntry('stacker_' . $stackerName . '_max_size'));
+
+ // Return result
+ return $isFull;
+ }
+
+ /**
+ * Checks wether the given stack is empty
+ *
+ * @param $stackerName Name of the stack
+ * @return $isEmpty Wether the stack is empty
+ * @throws NoStackerException If given stack is missing
+ */
+ protected final function isStackEmpty($stackerName) {
+ // Is the stack not yet initialized?
+ if (!$this->isStackInitialized($stackerName)) {
+ // Throw an exception
+ throw new NoStackerException(array($this, $stackerName), self::EXCEPTION_NO_STACKER_FOUND);
+ } // END - if
+
+ // So, is the stack full?
+ $isFull = (($this->getStackCount($stackerName)) == 0);
+
+ // Return result
+ return $isFull;
+ }
+
+ /**
+ * Getter for size of given stack (array count)
+ *
+ * @param $stackerName Name of the stack
+ * @return $count Size of stack (array count)
+ * @throws NoStackerException If given stack is missing
+ */
+ protected final function getStackCount ($stackerName) {
+ // Is the stack not yet initialized?
+ if (!$this->isStackInitialized($stackerName)) {
+ // Throw an exception
+ throw new NoStackerException(array($this, $stackerName), self::EXCEPTION_NO_STACKER_FOUND);
+ } // END - if
+
+ // Now, count the array of entries
+ $count = count($this->stacks[$stackerName]['entries']);
+
+ // Return result
+ return $count;
+ }
+
+ /**
+ * Adds a value to given stack
+ *
+ * @param $stackerName Name of the stack
+ * @param $value Value to add to this stacker
+ * @return void
+ * @throws FullStackerException Thrown if the stack is full
+ */
+ protected final function addValue ($stackerName, $value) {
+ // Is the stack not yet initialized or full?
+ if (!$this->isStackInitialized($stackerName)) {
+ // Then do it here
+ $this->initStacker($stackerName);
+ } elseif ($this->isStackFull($stackerName)) {
+ // Stacker is full
+ throw new FullStackerException(array($this, $stackerName, $value), self::EXCEPTION_STACKER_IS_FULL);
+ }
+
+ // Now add the value to the stack
+ array_push($this->stacks[$stackerName]['entries'], $value);
+ }
+
+ /**
+ * Get last value from named stacker
+ *
+ * @param $stackerName Name of the stack
+ * @return $value Value of last added value
+ * @throws NoStackerException If the named stacker was not found
+ * @throws EmptyStackerException If the named stacker is empty
+ */
+ protected final function getLastValue ($stackerName) {
+ // Is the stack not yet initialized or full?
+ if (!$this->isStackInitialized($stackerName)) {
+ // Throw an exception
+ throw new NoStackerException(array($this, $stackerName), self::EXCEPTION_NO_STACKER_FOUND);
+ } elseif ($this->isStackEmpty($stackerName)) {
+ //Throw an exception
+ throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
+ }
+
+ // Now get the last value
+ $value = $this->stacks[$stackerName]['entries'][$this->getStackCount($stackerName) - 1];
+
+ // Return it
+ return $value;
+ }
+
+ /**
+ * "Pops" last entry from stack
+ *
+ * @param $stackerName Name of the stack
+ * @return void
+ * @throws NoStackerException If the named stacker was not found
+ * @throws EmptyStackerException If the named stacker is empty
+ */
+ protected final function popLast ($stackerName) {
+ // Is the stack not yet initialized or full?
+ if (!$this->isStackInitialized($stackerName)) {
+ // Throw an exception
+ throw new NoStackerException(array($this, $stackerName), self::EXCEPTION_NO_STACKER_FOUND);
+ } elseif ($this->isStackEmpty($stackerName)) {
+ //Throw an exception
+ throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
+ }
+
+ // Now, remove the last entry, we don't care about the return value here, see elseif() block above
+ array_pop($this->stacks[$stackerName]['entries']);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A FiFo Stacker class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.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/>.
+ */
+class FiFoStacker extends BaseStacker implements Stackable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of the class Stacker and prepares it for usage
+ *
+ * @return $stackerInstance An instance of FiFoStacker
+ */
+ public final static function createFiFoStacker () {
+ // Get a new instance
+ $stackerInstance = new FiFoStacker();
+
+ // Init generic stacker
+ $stackerInstance->initStacker('generic');
+
+ // Return the prepared instance
+ return $stackerInstance;
+ }
+
+ /**
+ * Pushs a value on a named stacker
+ *
+ * @param $stackerName Name of the stack
+ * @param $value Value to push on it
+ * @return void
+ * @throws StackerFullException If the stack is full
+ */
+ public function pushNamed ($stackerName, $value) {
+ $this->partialStub('stackerName=' . $stackerName . ',value[' . gettype($value) . ']=' . $value);
+ }
+
+ /**
+ * 'Pops' a value from a named stacker
+ *
+ * @param $stackerName Name of the stack
+ * @return void
+ * @throws NoStackerException If the named stacker was not found
+ * @throws EmptyStackerException If the named stacker is empty
+ */
+ public function popNamed ($stackerName) {
+ $this->partialStub('stackerName=' . $stackerName);
+ }
+
+ /**
+ * Get value from named stacker
+ *
+ * @param $stackerName Name of the stack
+ * @return $value Value of last added value
+ * @throws NoStackerException If the named stacker was not found
+ * @throws EmptyStackerException If the named stacker is empty
+ */
+ public function getNamed ($stackerName) {
+ $this->partialStub('stackerName=' . $stackerName);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A FiLo Stacker class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.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/>.
+ */
+class FiLoStacker extends BaseStacker implements Stackable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of the class Stacker and prepares it for usage
+ *
+ * @return $stackerInstance An instance of FiLoStacker
+ */
+ public final static function createFiLoStacker () {
+ // Get a new instance
+ $stackerInstance = new FiLoStacker();
+
+ // Init the generic stacker
+ $stackerInstance->initStacker('generic');
+
+ // Return the prepared instance
+ return $stackerInstance;
+ }
+
+ /**
+ * Pushs a value on a named stacker
+ *
+ * @param $stackerName Name of the stack
+ * @param $value Value to push on it
+ * @return void
+ * @throws StackerFullException If the stack is full
+ */
+ public function pushNamed ($stackerName, $value) {
+ // Call the protected method
+ parent::addValue($stackerName, $value);
+ }
+
+ /**
+ * 'Pops' a value from a named stacker
+ *
+ * @param $stackerName Name of the stack
+ * @return void
+ * @throws NoStackerException If the named stacker was not found
+ * @throws EmptyStackerException If the named stacker is empty
+ */
+ public function popNamed ($stackerName) {
+ // Call the protected method
+ parent::popLast($stackerName);
+ }
+
+ /**
+ * Get value from named stacker
+ *
+ * @param $stackerName Name of the stack
+ * @return $value Value of last added value
+ * @throws NoStackerException If the named stacker was not found
+ * @throws EmptyStackerException If the named stacker is empty
+ */
+ public function getNamed ($stackerName) {
+ // Call the protected method
+ return parent::getLastValue($stackerName);
+ }
+}
+
+// [EOF]
+?>
// Set the menu instance
$tplInstance->setMenuInstance($menuInstance);
+ // Init a variable stacker
+ $stackerInstance = ObjectFactory::createObjectByConfiguredName('menu_stacker_class');
+
+ // Set it
+ $tplInstance->setStackerInstance($stackerInstance);
+
// Return the prepared instance
return $tplInstance;
}
return false;
} // END - if
- // Unfinished work!
- $this->partialStub('Handling extra characters is not yet supported! length='.strlen($characters));
+ // Assign the found characters to variable and use the last entry from
+ // stack as the name
+ parent::assignVariable($this->getStackerInstance()->getNamed('current_node'), $characters);
}
/**
$this->assignVariable('footer_end', $this->getTemplateInstance()->getRawTemplateData());
}
+ /**
+ * Starts the menu property 'block-list'
+ *
+ * @return void
+ */
+ private function startBlockList () {
+ // Push the node name on the stacker
+ $this->getStackerInstance()->pushNamed('current_node', 'block-list');
+ }
+
+ /**
+ * Starts the menu property 'block'
+ *
+ * @return void
+ */
+ private function startBlock () {
+ // Push the node name on the stacker
+ $this->getStackerInstance()->pushNamed('current_node', 'block');
+ }
+
/**
* Starts the menu property 'title'
*
* @return void
*/
private function startTitle () {
- $this->partialStub('Cleared due to XML rewrite.');
+ // Push the node name on the stacker
+ $this->getStackerInstance()->pushNamed('current_node', 'title');
+ }
+
+ /**
+ * Starts the menu property 'title-id'
+ *
+ * @return void
+ */
+ private function startTitleId () {
+ // Push the node name on the stacker
+ $this->getStackerInstance()->pushNamed('current_node', 'title-id');
+ }
+
+ /**
+ * Starts the menu property 'title-class'
+ *
+ * @return void
+ */
+ private function startTitleClass () {
+ // Push the node name on the stacker
+ $this->getStackerInstance()->pushNamed('current_node', 'title-class');
+ }
+
+ /**
+ * Starts the menu property 'title-text'
+ *
+ * @return void
+ */
+ private function startTitleText () {
+ // Push the node name on the stacker
+ $this->getStackerInstance()->pushNamed('current_node', 'title-text');
+ }
+
+ /**
+ * Starts the menu property 'entry'
+ *
+ * @return void
+ */
+ private function startEntry () {
+ // Push the node name on the stacker
+ $this->getStackerInstance()->pushNamed('current_node', 'entry');
+ }
+
+ /**
+ * Starts the menu property 'entry-id'
+ *
+ * @return void
+ */
+ private function startEntryId () {
+ // Push the node name on the stacker
+ $this->getStackerInstance()->pushNamed('current_node', 'entry-id');
+ }
+
+ /**
+ * Starts the menu property 'anchor'
+ *
+ * @return void
+ */
+ private function startAnchor () {
+ // Push the node name on the stacker
+ $this->getStackerInstance()->pushNamed('current_node', 'anchor');
+ }
+
+ /**
+ * Starts the menu property 'anchor-id'
+ *
+ * @return void
+ */
+ private function startAnchorId () {
+ // Push the node name on the stacker
+ $this->getStackerInstance()->pushNamed('current_node', 'anchor-id');
+ }
+
+ /**
+ * Starts the menu property 'anchor-text'
+ *
+ * @return void
+ */
+ private function startAnchorText () {
+ // Push the node name on the stacker
+ $this->getStackerInstance()->pushNamed('current_node', 'anchor-text');
+ }
+
+ /**
+ * Starts the menu property 'anchor-title'
+ *
+ * @return void
+ */
+ private function startAnchorTitle () {
+ // Push the node name on the stacker
+ $this->getStackerInstance()->pushNamed('current_node', 'anchor-title');
+ }
+
+ /**
+ * Starts the menu property 'anchor-href'
+ *
+ * @return void
+ */
+ private function startAnchorHref () {
+ // Push the node name on the stacker
+ $this->getStackerInstance()->pushNamed('current_node', 'anchor-href');
+ }
+
+ /**
+ * Starts the menu property 'footer-id'
+ *
+ * @return void
+ */
+ private function startFooterId () {
+ // Push the node name on the stacker
+ $this->getStackerInstance()->pushNamed('current_node', 'footer-id');
+ }
+
+ /**
+ * Starts the menu property 'footer-class'
+ *
+ * @return void
+ */
+ private function startFooterClass () {
+ // Push the node name on the stacker
+ $this->getStackerInstance()->pushNamed('current_node', 'footer-class');
+ }
+
+ /**
+ * Starts the menu property 'footer-text'
+ *
+ * @return void
+ */
+ private function startFooterText () {
+ // Push the node name on the stacker
+ $this->getStackerInstance()->pushNamed('current_node', 'footer-text');
}
/**
* @return void
*/
private function finishTitle () {
- $this->partialStub('Cleared due to XML rewrite.');
+ // Pop the last entry
+ $this->getStackerInstance()->popNamed('current_node');
}
/**
- * Starts the menu text
+ * Finishes the title-id node by
*
* @return void
*/
- private function startText () {
- // Do we have a template instance?
- if (is_null($this->getTemplateInstance())) {
- // Init template instance for underlaying web templates
- $templateInstance = ObjectFactory::createObjectByConfiguredName('web_template_class');
+ private function finishTitleId () {
+ // Pop the last entry
+ $this->getStackerInstance()->popNamed('current_node');
+ }
- // Set it in this template engine
- $this->setTemplateInstance($templateInstance);
- } // END - if
+ /**
+ * Finishes the title-class node
+ *
+ * @return void
+ */
+ private function finishTitleClass () {
+ // Pop the last entry
+ $this->getStackerInstance()->popNamed('current_node');
+ }
- // Load the text template for this page
- $this->getTemplateInstance()->loadCodeTemplate('menu_text_start');
+ /**
+ * Finishes the title-class node
+ *
+ * @return void
+ */
+ private function finishTitleText () {
+ // Pop the last entry
+ $this->getStackerInstance()->popNamed('current_node');
+ }
- // Set the variable group to page
- $this->setVariableGroup('menu');
+ /**
+ * Finishes the footer-text node
+ *
+ * @return void
+ */
+ private function finishFooterText () {
+ // Pop the last entry
+ $this->getStackerInstance()->popNamed('current_node');
+ }
- // Set its content in this template instance
- $this->assignVariable('text', $this->getTemplateInstance()->getRawTemplateData());
+ /**
+ * Finishes the footer-class node
+ *
+ * @return void
+ */
+ private function finishFooterClass () {
+ // Pop the last entry
+ $this->getStackerInstance()->popNamed('current_node');
}
/**
- * Finishes the menu text
+ * Finishes the footer-id node
*
* @return void
*/
- private function finishText () {
- // Load the text template for this page
- $this->getTemplateInstance()->loadCodeTemplate('menu_text_end');
+ private function finishFooterId () {
+ // Pop the last entry
+ $this->getStackerInstance()->popNamed('current_node');
+ }
- // Set the variable group to page
- $this->setVariableGroup('menu');
+ /**
+ * Finishes the anchor-href node
+ *
+ * @return void
+ */
+ private function finishAnchorHref () {
+ // Pop the last entry
+ $this->getStackerInstance()->popNamed('current_node');
+ }
- // Set its content in this template instance
- $this->assignVariable('text_end', $this->getTemplateInstance()->getRawTemplateData());
+ /**
+ * Finishes the anchor-title node
+ *
+ * @return void
+ */
+ private function finishAnchorTitle () {
+ // Pop the last entry
+ $this->getStackerInstance()->popNamed('current_node');
}
/**
- * Starts the menu property 'entry'
+ * Finishes the anchor-text node
*
* @return void
*/
- private function startEntry () {
- $this->partialStub('Cleared due to XML rewrite.');
+ private function finishAnchorText () {
+ // Pop the last entry
+ $this->getStackerInstance()->popNamed('current_node');
}
/**
- * Finishes the entry node by added another template to the menu
+ * Finishes the anchor-id node
+ *
+ * @return void
+ */
+ private function finishAnchorId () {
+ // Pop the last entry
+ $this->getStackerInstance()->popNamed('current_node');
+ }
+
+ /**
+ * Finishes the anchor node
+ *
+ * @return void
+ */
+ private function finishAnchor () {
+ // Pop the last entry
+ $this->getStackerInstance()->popNamed('current_node');
+ }
+
+ /**
+ * Finishes the entry-id node
+ *
+ * @return void
+ */
+ private function finishEntryId () {
+ // Pop the last entry
+ $this->getStackerInstance()->popNamed('current_node');
+ }
+
+ /**
+ * Finishes the entry node
*
* @return void
*/
private function finishEntry () {
- $this->partialStub('Cleared due to XML rewrite.');
+ // Pop the last entry
+ $this->getStackerInstance()->popNamed('current_node');
}
/**
- * Starts the menu property 'anchor'
+ * Finishes the block node
*
- * @param $id Id of the anchor
- * @param $link Link text of the anchor
- * @param $title Link title of the anchor
* @return void
*/
- private function startAnchor () {
- $this->partialStub('Please implement this method.');
+ private function finishBlock () {
+ // Pop the last entry
+ $this->getStackerInstance()->popNamed('current_node');
}
/**
- * Finishes the anchor node by added another template to the menu
+ * Finishes the block-list node
*
* @return void
*/
- private function finishAnchor () {
- $this->partialStub('Please implement this method.');
+ private function finishBlockList () {
+ // Pop the last entry
+ $this->getStackerInstance()->popNamed('current_node');
+ }
+
+ /**
+ * Starts the menu text
+ *
+ * @return void
+ */
+ private function startText () {
+ // Do we have a template instance?
+ if (is_null($this->getTemplateInstance())) {
+ // Init template instance for underlaying web templates
+ $templateInstance = ObjectFactory::createObjectByConfiguredName('web_template_class');
+
+ // Set it in this template engine
+ $this->setTemplateInstance($templateInstance);
+ } // END - if
+
+ // Load the text template for this page
+ $this->getTemplateInstance()->loadCodeTemplate('menu_text_start');
+
+ // Set the variable group to page
+ $this->setVariableGroup('menu');
+
+ // Set its content in this template instance
+ $this->assignVariable('text', $this->getTemplateInstance()->getRawTemplateData());
+ }
+
+ /**
+ * Finishes the menu text
+ *
+ * @return void
+ */
+ private function finishText () {
+ // Load the text template for this page
+ $this->getTemplateInstance()->loadCodeTemplate('menu_text_end');
+
+ // Set the variable group to page
+ $this->setVariableGroup('menu');
+
+ // Set its content in this template instance
+ $this->assignVariable('text_end', $this->getTemplateInstance()->getRawTemplateData());
}
/**
// CFG: DECIMALS
$cfg->setConfigEntry('decimals', 3);
+// CFG: STACKER-CLASS
+$cfg->setConfigEntry('menu_stacker_class', 'FiLoStacker');
+
+// CFG: STACKER-GENERIC-MAX-SIZE
+$cfg->setConfigEntry('stacker_generic_max_size', 100);
+
+// CFG: STACKER-CURRENT-NODE-MAX-SIZE
+$cfg->setConfigEntry('stacker_current_node_max_size', 20);
+
// [EOF]
?>