Skip to content

Commit

Permalink
INTERNAL: remove reverse local variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
brido4125 committed Dec 20, 2024
1 parent ae6878e commit ba7a4f4
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions src/main/java/net/spy/memcached/ArcusClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -2504,33 +2504,25 @@ public void gotData(String bkey, int flags, byte[] data, byte[] eflag) {
@Override
public CollectionFuture<Map<Integer, Element<Object>>> asyncBopGetByPosition(
String key, BTreeOrder order, int pos) {
BTreeGetByPosition get = new BTreeGetByPosition(order, pos);
boolean reverse = false;
return asyncBopGetByPosition(key, get, reverse, collectionTranscoder);
return asyncBopGetByPosition(key, new BTreeGetByPosition(order, pos), collectionTranscoder);
}

@Override
public <T> CollectionFuture<Map<Integer, Element<T>>> asyncBopGetByPosition(
String key, BTreeOrder order, int pos, Transcoder<T> tc) {
BTreeGetByPosition get = new BTreeGetByPosition(order, pos);
boolean reverse = false;
return asyncBopGetByPosition(key, get, reverse, tc);
return asyncBopGetByPosition(key, new BTreeGetByPosition(order, pos), tc);
}

@Override
public CollectionFuture<Map<Integer, Element<Object>>> asyncBopGetByPosition(
String key, BTreeOrder order, int from, int to) {
BTreeGetByPosition get = new BTreeGetByPosition(order, from, to);
boolean reverse = from > to;
return asyncBopGetByPosition(key, get, reverse, collectionTranscoder);
return asyncBopGetByPosition(key, new BTreeGetByPosition(order, from, to), collectionTranscoder);
}

@Override
public <T> CollectionFuture<Map<Integer, Element<T>>> asyncBopGetByPosition(
String key, BTreeOrder order, int from, int to, Transcoder<T> tc) {
BTreeGetByPosition get = new BTreeGetByPosition(order, from, to);
boolean reverse = from > to;
return asyncBopGetByPosition(key, get, reverse, tc);
return asyncBopGetByPosition(key, new BTreeGetByPosition(order, from, to), tc);
}

/**
Expand All @@ -2539,13 +2531,11 @@ public <T> CollectionFuture<Map<Integer, Element<T>>> asyncBopGetByPosition(
*
* @param k b+tree item's key
* @param get operation parameters (element position and so on)
* @param reverse forward or backward
* @param tc transcoder to serialize and unserialize value
* @return future holding the map of the fetched element and its position
*/
private <T> CollectionFuture<Map<Integer, Element<T>>> asyncBopGetByPosition(
final String k, final BTreeGetByPosition get,
final boolean reverse, final Transcoder<T> tc) {
final String k, final BTreeGetByPosition get, final Transcoder<T> tc) {
// Check for invalid arguments (not to get CLIENT_ERROR)
if (get.getOrder() == null) {
throw new IllegalArgumentException("BTreeOrder must not be null.");
Expand All @@ -2562,7 +2552,7 @@ private <T> CollectionFuture<Map<Integer, Element<T>>> asyncBopGetByPosition(
private final HashMap<Integer, Entry<BKeyObject, CachedData>> cachedDataMap =
new HashMap<>();
private final GetResult<Map<Integer, Element<T>>> result =
new BopGetByPositionResultImpl<>(cachedDataMap, reverse, tc);
new BopGetByPositionResultImpl<>(cachedDataMap, get.isReversed(), tc);

public void receivedStatus(OperationStatus status) {
CollectionOperationStatus cstatus;
Expand Down

0 comments on commit ba7a4f4

Please sign in to comment.