SFS2X Objective-C API
1.7.13
iOS / macOS / tvOS
|
#import <MatchExpression.h>
Inherits NSObject.
Instance Methods | |
(id) | - initWithVarName:condition:value: |
(MatchExpression *) | - and:condition:value: |
(MatchExpression *) | - or:condition:value: |
(BOOL) | - hasNext |
(MatchExpression *) | - rewind |
(NSString *) | - asString |
(id< ISFSArray >) | - toSFSArray |
(id< ISFSArray >) | - expressionAsSFSArray |
Class Methods | |
(id) | + expressionWithVarName:condition:value: |
Properties | |
NSString * | varName |
id< IMatcher > | condition |
id | value |
LogicOperator * | logicOp |
MatchExpression * | parent |
MatchExpression * | next |
Match Expressions are built like "if" conditions in any common programming language.
They work like queries in a database and can be used to search for Rooms or Users using custom criteria. These expressions are extremely easy to create and concatenate and they can be used for many different filtering operations within the SFS2X framework.
This is a quick example:
Expressions are made of three elements:
Additionally any number of expressions can be linked together with a logical AND / OR operator, just like in regular code. In the above example we have created an expression that will check for a rank value > 5 and a country value == "Italy".
The search options are not just limited to User/Room Variables name. In fact the Matching engine provides two extra classes, RoomProperties and UserProperties, where you can access many specific attributes of the Room and User class.
- (MatchExpression *) and: | (NSString *) | varName | |
condition: | (id <IMatcher>) | condition | |
value: | (id) | value | |
Concatenate the current expression with a new one using the logical AND operator
varName | name of the variable/property to match |
condition | the match condition |
value | the value to match against |
return a new MatchExpression
+ (id) expressionWithVarName: | (NSString *) | varName | |
condition: | (id <IMatcher>) | condition | |
value: | (id) | value | |
varName | name of the variable/property to match |
condition | the match condition |
value | the value to match against |
- (BOOL) hasNext |
Check if the current expression is concatenated to another one via a logic operator
- (MatchExpression *) or: | (NSString *) | varName | |
condition: | (id <IMatcher>) | condition | |
value: | (id) | value | |
Concatenate the current expression with a new one using the logical OR operator
varName | name of the variable/property to match |
condition | the match condition |
value | the value to match against |
return a new MatchExpression
- (MatchExpression *) rewind |
Rewinds the cursor to the first expression in the chain and return the MatchExpression at the top of the chain of expressions
|
readwritenonatomicstrong |
Get the condition used for matching
|
readwritenonatomicstrong |
Get the current logic operator, could be null if the expression has no other concatenated expressions
|
readwritenonatomicstrong |
Get the next expression chained to the current one.
|
readwritenonatomicstrong |
The value used to test the condition in the expression
|
readwritenonatomicstrong |
Get the name of the variable or property that is being matched.
This can be the name of a User/Room variable or a property from the classes listed below.