Renamed classes/main/ to main/classes/ + added FuseFeature, an upcoming feature
[core.git] / inc / main / interfaces / criteria / class_Criteria.php
1 <?php
2 /**
3  * An interface for criterias
4  *
5  * @author              Roland Haeder <webmaster@shipsimu.org>
6  * @version             0.0.0
7  * @copyright   Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
8  * @license             GNU GPL 3.0 or any newer version
9  * @link                http://www.shipsimu.org
10  *
11  * This program is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <http://www.gnu.org/licenses/>.
23  */
24 interface Criteria extends FrameworkInterface {
25         /**
26          * Setter for wrapper class name
27          *
28          * @param       $wrapperConfigEntry             Configuration entry which hold the wrapper class' name
29          * @return      void
30          */
31         function setWrapperConfigEntry ($wrapperConfigEntry);
32
33         /**
34          * Getter for wrapper class name
35          *
36          * @return      $wrapperConfigEntry             Configuration entry which hold the wrapper class' name
37          */
38         function getWrapperConfigEntry ();
39
40         /**
41          * Checks whether given key is set
42          *
43          * @param       $criteriaType   Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude'
44          * @param       $criteriaKey    Criteria key
45          * @return      $isSet                  Whether key is set
46          */
47         function isKeySet ($criteriaType, $criteriaKey);
48
49         /**
50          * Checks whether given key is set for 'choice' type
51          *
52          * @param       $criteriaKey    Criteria key
53          * @return      $isSet                  Whether key is set
54          */
55         function isChoiceKeySet ($criteriaKey);
56
57         /**
58          * Checks whether given key is set for 'exclude' type
59          *
60          * @param       $criteriaKey    Criteria key
61          * @return      $isSet                  Whether key is set
62          */
63         function isExcludeKeySet ($criteriaKey);
64
65         /**
66          * Getter for criteria array
67          *
68          * @param       $criteriaType   Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude'
69          * @return      $criteria
70          */
71         function getCriteriaArray ($criteriaType = 'default');
72
73         /**
74          * Getter for criteria array 'choice' type
75          *
76          * @return      $criteria
77          */
78         function getCriteriaChoiceArray ();
79
80         /**
81          * Getter for criteria array 'exclude' type
82          *
83          * @return      $criteria
84          */
85         function getCriteriaExcludeArray ();
86
87         /**
88          * Unsets a criteria key from all criteria types
89          *
90          * @param       $criteriaKey    Criteria key to unset
91          * @return      void
92          */
93         function unsetCriteria ($criteriaKey);
94
95         /**
96          * Add criteria, this method converts dashes to underscores because dashes
97          * are not valid for criteria keys.
98          *
99          * @param       $criteriaKey    Criteria key
100          * @param       $criteriaValue  Criteria value
101          * @param       $criteriaType   Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude'
102          * @return      void
103          */
104         function addCriteria ($criteriaKey, $criteriaValue, $criteriaType = 'default');
105
106         /**
107          * Sets criteria, this method converts dashes to underscores because dashes
108          * are not valid for criteria keys.
109          *
110          * @param       $criteriaKey    Criteria key
111          * @param       $criteriaValue  Criteria value
112          * @param       $criteriaType   Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude'
113          * @return      void
114          */
115         function setCriteria ($criteriaKey, $criteriaValue, $criteriaType = 'default');
116
117         /**
118          * Add "choice" criteria, this method converts dashes to underscores because
119          * dashes are not valid for criteria keys.
120          *
121          * @param       $criteriaKey    Criteria key
122          * @param       $criteriaValue  Criteria value
123          * @return      void
124          */
125         function addChoiceCriteria ($criteriaKey, $criteriaValue);
126
127         /**
128          * Add "exclude" criteria, this method converts dashes to underscores because
129          * dashes are not valid for criteria keys.
130          *
131          * @param       $criteriaKey    Criteria key
132          * @param       $criteriaValue  Criteria value
133          * @return      void
134          */
135         function addExcludeCriteria ($criteriaKey, $criteriaValue);
136
137         /**
138          * Add configured criteria
139          *
140          * @param       $criteriaKey    Criteria key
141          * @param       $configEntry    Configuration entry
142          * @param       $criteriaType   Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude'
143          * @return      void
144          */
145         function addConfiguredCriteria ($criteriaKey, $configEntry, $criteriaType = 'default');
146
147         /**
148          * Get criteria element or FALSE if not found
149          *
150          * @param       $criteriaKey    The requested criteria key
151          * @param       $criteriaType   Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude'
152          * @return      $value                  Whether the value of the critera or FALSE
153          */
154         function getCriteriaElemnent ($criteriaKey, $criteriaType = 'default');
155
156         /**
157          * Get criteria element or FALSE if not found for 'choice' type
158          *
159          * @param       $criteriaKey    The requested criteria key
160          * @return      $value                  Whether the value of the critera or FALSE
161          */
162         function getCriteriaChoiceElemnent ($criteriaKey);
163
164         /**
165          * Get criteria element or FALSE if not found for 'exclude' type
166          *
167          * @param       $criteriaKey    The requested criteria key
168          * @return      $value                  Whether the value of the critera or FALSE
169          */
170         function getCriteriaExcludeElemnent ($criteriaKey);
171
172         /**
173          * Checks whether given array entry matches
174          *
175          * @param       $entryArray             Array with the entries to find
176          * @param       $criteriaType   Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude'
177          * @return      $matches                Whether the entry matches or not
178          */
179         function ifEntryMatches (array $entryArray, $criteriaType = 'default');
180
181         /**
182          * Checks whether given array 'choice' entry matches
183          *
184          * @param       $entryArray             Array with the entries to find
185          * @return      $matches                Whether the entry matches or not
186          */
187         function ifChoiceMatches (array $entryArray);
188
189         /**
190          * Checks whether given array 'exclude' entry matches
191          *
192          * @param       $entryArray             Array with the entries to find
193          * @return      $matches                Whether the entry matches or not
194          */
195         function ifExcludeMatches (array $entryArray);
196
197         /**
198          * "Getter" for a cache key
199          *
200          * @param       $onlyKeys       Only use these keys for a cache key
201          * @param       $criteriaType   Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude'
202          * @return      $cacheKey       The key suitable for the cache system
203          */
204         function getCacheKey ($onlyKeys = array(), $criteriaType = 'default');
205
206         /**
207          * "Getter" for a cache key ('choice' type)
208          *
209          * @param       $onlyKeys       Only use these keys for a cache key
210          * @return      $cacheKey       The key suitable for the cache system
211          */
212         function getCacheKeyChoice ($onlyKeys = array());
213
214         /**
215          * "Getter" for a cache key ('exclude' type)
216          *
217          * @param       $onlyKeys       Only use these keys for a cache key
218          * @return      $cacheKey       The key suitable for the cache system
219          */
220         function getCacheKeyExclude ($onlyKeys = array());
221
222         /**
223          * Count the criteria, e.g. useful to find out if a database query has no
224          * limitation (search criteria).
225          *
226          * @param       $criteriaType   Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude'
227          * @return      $count  Count of all criteria entries
228          */
229         function count ($criteriaType = 'default');
230
231         /**
232          * Count 'choice' criteria, e.g. useful to find out if a database query
233          * has no limitation (search criteria).
234          *
235          * @return      $count  Count of all criteria entries
236          */
237         function countChoice ();
238
239         /**
240          * Count 'exclude' criteria, e.g. useful to find out if a database query
241          * has no limitation (search criteria).
242          *
243          * @return      $count  Count of all criteria entries
244          */
245         function countExclude ();
246 }
247
248 // [EOF]
249 ?>