From 20906dc62826a353d405e3c54433cb9815cdc94e Mon Sep 17 00:00:00 2001 From: Hellblazer Date: Mon, 4 Mar 2024 20:28:16 -0800 Subject: [PATCH] move to inner --- .../salesforce/apollo/context/Context.java | 7 +++++++ .../apollo/context/IterateResult.java | 8 ------- .../apollo/ring/RingCommunications.java | 21 +++++++++---------- 3 files changed, 17 insertions(+), 19 deletions(-) delete mode 100644 memberships/src/main/java/com/salesforce/apollo/context/IterateResult.java diff --git a/memberships/src/main/java/com/salesforce/apollo/context/Context.java b/memberships/src/main/java/com/salesforce/apollo/context/Context.java index 6ba67f4df..cf79f2c3c 100644 --- a/memberships/src/main/java/com/salesforce/apollo/context/Context.java +++ b/memberships/src/main/java/com/salesforce/apollo/context/Context.java @@ -503,6 +503,13 @@ default int toleranceLevel() { boolean validRing(int ring); + /** + * @author hal.hildebrand + **/ + enum IterateResult { + CONTINUE, FAIL, SUCCESS + } + /** * @author hal.hildebrand **/ diff --git a/memberships/src/main/java/com/salesforce/apollo/context/IterateResult.java b/memberships/src/main/java/com/salesforce/apollo/context/IterateResult.java deleted file mode 100644 index ec9d9e34f..000000000 --- a/memberships/src/main/java/com/salesforce/apollo/context/IterateResult.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.salesforce.apollo.context; - -/** - * @author hal.hildebrand - **/ -public enum IterateResult { - CONTINUE, FAIL, SUCCESS -} diff --git a/memberships/src/main/java/com/salesforce/apollo/ring/RingCommunications.java b/memberships/src/main/java/com/salesforce/apollo/ring/RingCommunications.java index 696df6c40..9c5231d49 100644 --- a/memberships/src/main/java/com/salesforce/apollo/ring/RingCommunications.java +++ b/memberships/src/main/java/com/salesforce/apollo/ring/RingCommunications.java @@ -9,7 +9,6 @@ import com.salesforce.apollo.archipelago.Link; import com.salesforce.apollo.archipelago.RouterImpl.CommonCommunications; import com.salesforce.apollo.context.Context; -import com.salesforce.apollo.context.IterateResult; import com.salesforce.apollo.cryptography.Digest; import com.salesforce.apollo.membership.Member; import com.salesforce.apollo.membership.SigningMember; @@ -100,16 +99,16 @@ List> calculateTraversal(Digest digest) { for (int ring = 0; ring < context.getRingCount(); ring++) { T successor = direction.retrieve(context, ring, digest, m -> { if (ignoreSelf && m.equals(member)) { - return IterateResult.CONTINUE; + return Context.IterateResult.CONTINUE; } if (noDuplicates) { if (traversed.add(m)) { - return IterateResult.SUCCESS; + return Context.IterateResult.SUCCESS; } else { - return IterateResult.CONTINUE; + return Context.IterateResult.CONTINUE; } } - return IterateResult.SUCCESS; + return Context.IterateResult.SUCCESS; }); traversal.add(new iteration<>(successor == null ? (T) member : successor, ring)); } @@ -181,34 +180,34 @@ public enum Direction { PREDECESSOR { @Override public T retrieve(Context context, int ring, Digest hash, - Function test) { + Function test) { return context.findPredecessor(ring, hash, test); } @Override public T retrieve(Context context, int ring, T member, - Function test) { + Function test) { return context.findPredecessor(ring, member, test); } }, SUCCESSOR { @Override public T retrieve(Context context, int ring, Digest hash, - Function test) { + Function test) { return context.findSuccessor(ring, hash, test); } @Override public T retrieve(Context context, int ring, T member, - Function test) { + Function test) { return context.findSuccessor(ring, member, test); } }; public abstract T retrieve(Context context, int ring, Digest hash, - Function test); + Function test); public abstract T retrieve(Context context, int ring, T member, - Function test); + Function test); } public record Destination(M member, Q link, int ring) {