Skip to content

Commit

Permalink
add negation equivalent of (ERXKey|ERXQ).inObjects()
Browse files Browse the repository at this point in the history
  • Loading branch information
darkv committed Apr 25, 2012
1 parent b85e468 commit 53c3071
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -1689,6 +1689,18 @@ public ERXKeyValueQualifier isNotNull() {
public ERXOrQualifier inObjects(T... values) {
return ERXQ.inObjects(_key, values);
}

/**
* Equivalent to a new ERXAndQualifier of
* EONotQualifier(EOKeyValueQualifier) with key equals value for each value.
*
* @param values
* the values
* @return an ERXAndQualifier
*/
public ERXAndQualifier notInObjects(T... values) {
return ERXQ.notInObjects(_key, values);
}

/**
* Equivalent to a new ERXOrQualifier of EOKeyValueQualifier with key equals
Expand Down
22 changes: 22 additions & 0 deletions Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXQ.java
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,8 @@ public static ERXKeyValueQualifier has(String key, NSArray values) {
* the key
* @param values
* the values
* @param min
* the minimum number of objects from values to match
* @return an EOKeyValueQualifier
*/
public static ERXKeyValueQualifier hasAtLeast(String key, NSArray values, int min) {
Expand Down Expand Up @@ -630,6 +632,24 @@ public static ERXOrQualifier inObjects(String key, Object... values) {
}
return new ERXOrQualifier(qualifiers);
}

/**
* Equivalent to a new ERXAndQualifier of
* EONotQualifier(EOKeyValueQualifier) with key equals value for each value.
*
* @param key
* the key
* @param values
* the values
* @return an EOQualifier
*/
public static ERXAndQualifier notInObjects(String key, Object... values) {
NSMutableArray<EOQualifier> qualifiers = new NSMutableArray<EOQualifier>();
for (Object value : values) {
qualifiers.addObject(ERXQ.notEquals(key, value));
}
return new ERXAndQualifier(qualifiers);
}

/**
* Equivalent to a new ERXOrQualifier of EOKeyValueQualifier with key equals
Expand Down Expand Up @@ -700,6 +720,8 @@ public static EOQualifier between(String key, Object lowerBound, Object upperBou
* the lower bound value
* @param upperBound
* the upper bound value
* @param inclusive
* if the lowerBound and upperBound should be inclusive
* @return the qualifier
*/
public static EOQualifier between(String key, Object lowerBound, Object upperBound, boolean inclusive) {
Expand Down

0 comments on commit 53c3071

Please sign in to comment.