![]() Any unit or location will match an empty filter like this one:.It’s a common error in WML to assume filters will select a single object. If our starting card packet is not a complete set (some cards were lost, a cheater introduced some more, or anything else), you’ll find one, none or many kings of spades. A human being would probably stop the search when finding a king of spades, but filters don’t. One can’t assume the result set of our filter will contain a single card ‘THE king of spades’. Result sets can contain any number of objects.But in WML, for some reasons we shall study later, order can be important. We could have searched the kings first, obtaining the four kings in our result set, and the card of color spade next. Criteria order is not important from a logical point of view.This is important when building or debugging filters, because complex ones can easily be reduced to a chain of simpler ones. In our example, we applied the filter « value=king » to the result set of filter « color=spades ». A complex filter can always be split into simpler filters applied in chain, each filter taking as starting set the result set of the former one.In other words, one only is enough for the object to match the filter. comma separated lists in a criterion are equivalent to ORed criteria.listed criteria are ANDed, in other words, they must all be true for the object to match the filter.They are not mandatory (like in some other languages), and this is a cool feature, but can be misleading in complex filters. and subtags are WML equivalents of parentheses. As in algebra, they mean their content must be evaluated prior to Or in natural speech: “is card (colour=spades OR colour=diamonds) AND value=king ?” Note WritingĮxplicitly the logical operators would give something like: In WML, you can do so, but most often, you’re not required to do so. In many languages, you must specify how criteria combine using the special keywords ‘OR’Īnd ‘AND’. ![]() Sense to state they should be ‘spades AND diamonds’, of course. The first expression will be true if a card colour is ‘spades OR diamonds’. Now, stating both criteria must be met is not the only way to combine them: Spades ? That’s how we must read the sentence: ‘colour=spades’. Criteria are expressions evaluating to true or false. This is an example of a twoĬriteria filter. If next we’re asked to find the king of spades, most probably, we will not restart from theīeginning but only scan the spades stack to find the right card. The spades cards are said to ‘match’ the filter. This is a very simple filter, where the criterion is « this card has spadesĬolour » and the result set is a card stack. One by one and create two stacks : one containing only the spades, and another containing the Given a set of cards, if one is asked to select the spades, (s)he will probably check the cards The examples givenīelow aren’t always the best way to do things: the goal here is understanding filtering, not toįiltering is narrowing a set of objects to a result set using criteria. Knowledge of the various WML filters, namely unit and location filters. But the goal is not to replace these pages, and we assume you have at least some Here, we shall try to explain how to use them with more details than in the reference 1.5 Filters uses: events actions and conditions.įilters are a very important part of WML language, and a fairly complex too for various.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |