@@ -63,16 +63,20 @@ class ZAddCommand extends KeyCommand {
63
63
private final boolean upsert ;
64
64
private final boolean returnTotalChanged ;
65
65
private final boolean incr ;
66
+ private final boolean gt ;
67
+ private final boolean lt ;
66
68
67
69
private ZAddCommand (@ Nullable ByteBuffer key , List <Tuple > tuples , boolean upsert , boolean returnTotalChanged ,
68
- boolean incr ) {
70
+ boolean incr , boolean gt , boolean lt ) {
69
71
70
72
super (key );
71
73
72
74
this .tuples = tuples ;
73
75
this .upsert = upsert ;
74
76
this .returnTotalChanged = returnTotalChanged ;
75
77
this .incr = incr ;
78
+ this .gt = gt ;
79
+ this .lt = lt ;
76
80
}
77
81
78
82
/**
@@ -98,7 +102,7 @@ public static ZAddCommand tuples(Collection<? extends Tuple> tuples) {
98
102
99
103
Assert .notNull (tuples , "Tuples must not be null!" );
100
104
101
- return new ZAddCommand (null , new ArrayList <>(tuples ), false , false , false );
105
+ return new ZAddCommand (null , new ArrayList <>(tuples ), false , false , false , false , false );
102
106
}
103
107
104
108
/**
@@ -111,7 +115,7 @@ public ZAddCommand to(ByteBuffer key) {
111
115
112
116
Assert .notNull (key , "Key must not be null!" );
113
117
114
- return new ZAddCommand (key , tuples , upsert , returnTotalChanged , incr );
118
+ return new ZAddCommand (key , tuples , upsert , returnTotalChanged , incr , gt , lt );
115
119
}
116
120
117
121
/**
@@ -121,7 +125,7 @@ public ZAddCommand to(ByteBuffer key) {
121
125
* @return a new {@link ZAddCommand} with {@literal xx} applied.
122
126
*/
123
127
public ZAddCommand xx () {
124
- return new ZAddCommand (getKey (), tuples , false , returnTotalChanged , incr );
128
+ return new ZAddCommand (getKey (), tuples , false , returnTotalChanged , incr , gt , lt );
125
129
}
126
130
127
131
/**
@@ -131,7 +135,7 @@ public ZAddCommand xx() {
131
135
* @return a new {@link ZAddCommand} with {@literal nx} applied.
132
136
*/
133
137
public ZAddCommand nx () {
134
- return new ZAddCommand (getKey (), tuples , true , returnTotalChanged , incr );
138
+ return new ZAddCommand (getKey (), tuples , true , returnTotalChanged , incr , gt , lt );
135
139
}
136
140
137
141
/**
@@ -141,7 +145,7 @@ public ZAddCommand nx() {
141
145
* @return a new {@link ZAddCommand} with {@literal ch} applied.
142
146
*/
143
147
public ZAddCommand ch () {
144
- return new ZAddCommand (getKey (), tuples , upsert , true , incr );
148
+ return new ZAddCommand (getKey (), tuples , upsert , true , incr , gt , lt );
145
149
}
146
150
147
151
/**
@@ -151,7 +155,29 @@ public ZAddCommand ch() {
151
155
* @return a new {@link ZAddCommand} with {@literal incr} applied.
152
156
*/
153
157
public ZAddCommand incr () {
154
- return new ZAddCommand (getKey (), tuples , upsert , upsert , true );
158
+ return new ZAddCommand (getKey (), tuples , upsert , upsert , true , gt , lt );
159
+ }
160
+
161
+ /**
162
+ * Applies {@literal GT} mode. Constructs a new command
163
+ * instance with all previously configured properties.
164
+ *
165
+ * @return a new {@link ZAddCommand} with {@literal incr} applied.
166
+ * @since 2.5
167
+ */
168
+ public ZAddCommand gt () {
169
+ return new ZAddCommand (getKey (), tuples , upsert , upsert , incr , true , lt );
170
+ }
171
+
172
+ /**
173
+ * Applies {@literal LT} mode. Constructs a new command
174
+ * instance with all previously configured properties.
175
+ *
176
+ * @return a new {@link ZAddCommand} with {@literal incr} applied.
177
+ * @since 2.5
178
+ */
179
+ public ZAddCommand lt () {
180
+ return new ZAddCommand (getKey (), tuples , upsert , upsert , incr , gt , true );
155
181
}
156
182
157
183
/**
@@ -175,6 +201,23 @@ public boolean isIncr() {
175
201
return incr ;
176
202
}
177
203
204
+ /**
205
+ *
206
+ * @return {@literal true} if {@literal GT} is set.
207
+ * @since 2.5
208
+ */
209
+ public boolean isGt () {
210
+ return gt ;
211
+ }
212
+
213
+ /**
214
+ * @return {@literal true} if {@literal LT} is set.
215
+ * @since 2.5
216
+ */
217
+ public boolean isLt () {
218
+ return lt ;
219
+ }
220
+
178
221
/**
179
222
* @return
180
223
*/
0 commit comments