X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=inc%2Fclasses%2Finterfaces%2Fcriteria%2Fclass_Criteria.php;h=86d9b36fd03ecb3179c4209d104f22dc7a735d16;hp=2ba12f0e094fbe5abf366019bbab3ccc5fc169cd;hb=29fdfbe1fcc8f3644360c02e36007b21c05513a4;hpb=c3106ae537f1d46274988826a070632a439e2c49 diff --git a/inc/classes/interfaces/criteria/class_Criteria.php b/inc/classes/interfaces/criteria/class_Criteria.php index 2ba12f0e..86d9b36f 100644 --- a/inc/classes/interfaces/criteria/class_Criteria.php +++ b/inc/classes/interfaces/criteria/class_Criteria.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -23,22 +23,166 @@ */ interface Criteria extends FrameworkInterface { /** - * Add criteria + * Setter for wrapper class name + * + * @param $wrapperConfigEntry Configuration entry which hold the wrapper class' name + * @return void + */ + function setWrapperConfigEntry ($wrapperConfigEntry); + + /** + * Getter for wrapper class name + * + * @return $wrapperConfigEntry Configuration entry which hold the wrapper class' name + */ + function getWrapperConfigEntry (); + + /** + * Getter for criteria array + * + * @param $criteriaType Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude' + * @return $criteria + */ + function getCriteriaArray ($criteriaType = 'default'); + + /** + * Getter for criteria array 'choice' type + * + * @return $criteria + */ + function getCriteriaChoiceArray (); + + /** + * Getter for criteria array 'exclude' type + * + * @return $criteria + */ + function getCriteriaExcludeArray (); + + /** + * Add criteria, this method converts dashes to underscores because dashes + * are not valid for criteria keys. + * + * @param $criteriaKey Criteria key + * @param $criteriaValue Criteria value + * @param $criteriaType Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude' + * @return void + */ + function addCriteria ($criteriaKey, $criteriaValue, $criteriaType = 'default'); + + /** + * Add "choice" criteria, this method converts dashes to underscores because + * dashes are not valid for criteria keys. * * @param $criteriaKey Criteria key * @param $criteriaValue Criteria value * @return void */ - function addCriteria ($criteriaKey, $criteriaValue); + function addChoiceCriteria ($criteriaKey, $criteriaValue); + + /** + * Add "exclude" criteria, this method converts dashes to underscores because + * dashes are not valid for criteria keys. + * + * @param $criteriaKey Criteria key + * @param $criteriaValue Criteria value + * @return void + */ + function addExcludeCriteria ($criteriaKey, $criteriaValue); /** * Add configured criteria * * @param $criteriaKey Criteria key * @param $configEntry Configuration entry + * @param $criteriaType Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude' * @return void */ - function addConfiguredCriteria ($criteriaKey, $configEntry); + function addConfiguredCriteria ($criteriaKey, $configEntry, $criteriaType = 'default'); + + /** + * Get criteria element or null if not found + * + * @param $criteriaKey The requested criteria key + * @param $criteriaType Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude' + * @return $value Whether the value of the critera or null + */ + function getCriteriaElemnent ($criteriaKey, $criteriaType = 'default'); + + /** + * Checks whether given array entry matches + * + * @param $entryArray Array with the entries to find + * @param $criteriaType Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude' + * @return $matches Whether the entry matches or not + */ + function ifEntryMatches (array $entryArray, $criteriaType = 'default'); + + /** + * Checks whether given array 'choice' entry matches + * + * @param $entryArray Array with the entries to find + * @return $matches Whether the entry matches or not + */ + function ifChoiceMatches (array $entryArray); + + /** + * Checks whether given array 'exclude' entry matches + * + * @param $entryArray Array with the entries to find + * @return $matches Whether the entry matches or not + */ + function ifExcludeMatches (array $entryArray); + + /** + * "Getter" for a cache key + * + * @param $onlyKeys Only use these keys for a cache key + * @param $criteriaType Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude' + * @return $cacheKey The key suitable for the cache system + */ + function getCacheKey ($onlyKeys = array(), $criteriaType = 'default'); + + /** + * "Getter" for a cache key ('choice' type) + * + * @param $onlyKeys Only use these keys for a cache key + * @return $cacheKey The key suitable for the cache system + */ + function getCacheKeyChoice ($onlyKeys = array()); + + /** + * "Getter" for a cache key ('exclude' type) + * + * @param $onlyKeys Only use these keys for a cache key + * @return $cacheKey The key suitable for the cache system + */ + function getCacheKeyExclude ($onlyKeys = array()); + + /** + * Count the criteria, e.g. useful to find out if a database query has no + * limitation (search criteria). + * + * @param $criteriaType Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude' + * @return $count Count of all criteria entries + */ + function count ($criteriaType = 'default'); + + /** + * Count 'choice' criteria, e.g. useful to find out if a database query + * has no limitation (search criteria). + * + * @return $count Count of all criteria entries + */ + function countChoice (); + + /** + * Count 'exclude' criteria, e.g. useful to find out if a database query + * has no limitation (search criteria). + * + * @return $count Count of all criteria entries + */ + function countExclude (); } // [EOF]