Skip to content

Commit c9527bf

Browse files
committed
Rename subset to subsetof
1 parent 32adc12 commit c9527bf

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Filters are logical expressions used to filter arrays. A typical filter would be
101101
| =~ | left matches regular expression [?(@.name =~ /foo.*?/i)] |
102102
| in | left exists in right [?(@.size in ['S', 'M'])] |
103103
| nin | left does not exists in right |
104-
| subset | left is a subset of right [?(@.sizes subset ['S', 'M', 'L'])] |
104+
| subsetof | left is a subset of right [?(@.sizes subsetof ['S', 'M', 'L'])] |
105105
| size | size of left (array or string) should match right |
106106
| empty | left (array or string) should be empty |
107107

json-path/src/main/java/com/jayway/jsonpath/Criteria.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,28 +268,28 @@ public Criteria nin(Collection<?> c) {
268268
}
269269

270270
/**
271-
* The <code>subset</code> operator selects objects for which the specified field is
271+
* The <code>subsetof</code> operator selects objects for which the specified field is
272272
* an array whose elements comprise a subset of the set comprised by the elements of
273273
* the specified array.
274274
*
275275
* @param o the values to match against
276276
* @return the criteria
277277
*/
278-
public Criteria subset(Object... o) {
279-
return subset(Arrays.asList(o));
278+
public Criteria subsetof(Object... o) {
279+
return subsetof(Arrays.asList(o));
280280
}
281281

282282
/**
283-
* The <code>subset</code> operator selects objects for which the specified field is
283+
* The <code>subsetof</code> operator selects objects for which the specified field is
284284
* an array whose elements comprise a subset of the set comprised by the elements of
285285
* the specified array.
286286
*
287287
* @param c the values to match against
288288
* @return the criteria
289289
*/
290-
public Criteria subset(Collection<?> c) {
290+
public Criteria subsetof(Collection<?> c) {
291291
notNull(c, "collection can not be null");
292-
this.criteriaType = RelationalOperator.SUBSET;
292+
this.criteriaType = RelationalOperator.SUBSETOF;
293293
this.right = new ValueNode.ValueListNode(c);
294294
return this;
295295
}

json-path/src/main/java/com/jayway/jsonpath/internal/filter/EvaluatorFactory.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class EvaluatorFactory {
2929
evaluators.put(RelationalOperator.CONTAINS, new ContainsEvaluator());
3030
evaluators.put(RelationalOperator.MATCHES, new PredicateMatchEvaluator());
3131
evaluators.put(RelationalOperator.TYPE, new TypeEvaluator());
32-
evaluators.put(RelationalOperator.SUBSET, new SubsetEvaluator());
32+
evaluators.put(RelationalOperator.SUBSETOF, new SubsetOfEvaluator());
3333
}
3434

3535
public static Evaluator createEvaluator(RelationalOperator operator){
@@ -266,7 +266,7 @@ private String getInput(ValueNode valueNode) {
266266
}
267267
}
268268

269-
private static class SubsetEvaluator implements Evaluator {
269+
private static class SubsetOfEvaluator implements Evaluator {
270270
@Override
271271
public boolean evaluate(ValueNode left, ValueNode right, Predicate.PredicateContext ctx) {
272272
ValueNode.ValueListNode rightValueListNode;
@@ -291,7 +291,7 @@ public boolean evaluate(ValueNode left, ValueNode right, Predicate.PredicateCont
291291
} else {
292292
leftValueListNode = left.asValueListNode();
293293
}
294-
return leftValueListNode.subset(rightValueListNode);
294+
return leftValueListNode.subsetof(rightValueListNode);
295295
}
296296
}
297297

json-path/src/main/java/com/jayway/jsonpath/internal/filter/RelationalOperator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public enum RelationalOperator {
3030
TYPE("TYPE"),
3131
MATCHES("MATCHES"),
3232
EMPTY("EMPTY"),
33-
SUBSET("SUBSET");
33+
SUBSETOF("SUBSETOF");
3434

3535
private final String operatorString;
3636

json-path/src/main/java/com/jayway/jsonpath/internal/filter/ValueNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ public boolean contains(ValueNode node){
714714
return nodes.contains(node);
715715
}
716716

717-
public boolean subset(ValueListNode right) {
717+
public boolean subsetof(ValueListNode right) {
718718
for (ValueNode leftNode : nodes) {
719719
if (!right.nodes.contains(leftNode)) {
720720
return false;

0 commit comments

Comments
 (0)