From 48b3181152646382f77753d555a8eeeb8b7d1ad4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Henning?= <soeren.henning@email.uni-kiel.de> Date: Wed, 24 Feb 2021 12:11:52 +0100 Subject: [PATCH] Add some JavaDoc --- .../commons/workloadgeneration/ClusterConfig.java | 9 +++++++++ .../commons/workloadgeneration/KeySpace.java | 12 ++++++++---- .../workloadgeneration/WorkloadDefinition.java | 8 ++++++++ 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/benchmarks/workload-generator-commons/src/main/java/theodolite/commons/workloadgeneration/ClusterConfig.java b/benchmarks/workload-generator-commons/src/main/java/theodolite/commons/workloadgeneration/ClusterConfig.java index c871f9a1a..e629a13bf 100644 --- a/benchmarks/workload-generator-commons/src/main/java/theodolite/commons/workloadgeneration/ClusterConfig.java +++ b/benchmarks/workload-generator-commons/src/main/java/theodolite/commons/workloadgeneration/ClusterConfig.java @@ -1,5 +1,8 @@ package theodolite.commons.workloadgeneration; +/** + * Configuration of a load generator cluster. + */ public class ClusterConfig { public static final String BOOTSTRAP_SERVER_DEFAULT = "localhost:5701"; public static final int PORT_DEFAULT = 5701; @@ -11,6 +14,9 @@ public class ClusterConfig { private final boolean portAutoIncrement; private final String clusterNamePrefix; + /** + * Create a new {@link ClusterConfig} with its default values. + */ public ClusterConfig() { this( BOOTSTRAP_SERVER_DEFAULT, @@ -19,6 +25,9 @@ public class ClusterConfig { CLUSTER_NAME_PREFIX_DEFAULT); } + /** + * Create a new {@link ClusterConfig} with the given parameter values. + */ public ClusterConfig(final String bootstrapServer, final int port, final boolean portAutoIncrement, final String clusterNamePrefix) { this.bootstrapServer = bootstrapServer; diff --git a/benchmarks/workload-generator-commons/src/main/java/theodolite/commons/workloadgeneration/KeySpace.java b/benchmarks/workload-generator-commons/src/main/java/theodolite/commons/workloadgeneration/KeySpace.java index 96073c940..51255d774 100644 --- a/benchmarks/workload-generator-commons/src/main/java/theodolite/commons/workloadgeneration/KeySpace.java +++ b/benchmarks/workload-generator-commons/src/main/java/theodolite/commons/workloadgeneration/KeySpace.java @@ -4,11 +4,9 @@ import java.io.Serializable; import java.util.Collection; import java.util.stream.Collectors; import java.util.stream.IntStream; -import theodolite.commons.workloadgeneration.generators.AbstractWorkloadGenerator; /** - * Wrapper class for the definition of the Keys that should be used by the - * {@link AbstractWorkloadGenerator}. + * A set of keys, where each key consists of a prefix and a number. */ public class KeySpace implements Serializable { @@ -20,7 +18,7 @@ public class KeySpace implements Serializable { /** * Create a new key space. All keys will have the prefix {@code prefix}. The remaining part of - * each key will be determined by a number of the interval ({@code min}, {@code max}-1). + * each key will be determined by a number of the interval ({@code min}, {@code max}). * * @param prefix the prefix to use for all keys * @param min the lower bound (inclusive) to start counting from @@ -50,10 +48,16 @@ public class KeySpace implements Serializable { return this.max; } + /** + * Get the amount of keys in this {@link KeySpace}. + */ public int getCount() { return this.getMax() - this.getMin() + 1; } + /** + * Get all keys in this {@link KeySpace}. + */ public Collection<String> getKeys() { return IntStream.rangeClosed(this.min, this.max) .mapToObj(id -> this.prefix + id) diff --git a/benchmarks/workload-generator-commons/src/main/java/theodolite/commons/workloadgeneration/WorkloadDefinition.java b/benchmarks/workload-generator-commons/src/main/java/theodolite/commons/workloadgeneration/WorkloadDefinition.java index 4060cca41..5795cad7a 100644 --- a/benchmarks/workload-generator-commons/src/main/java/theodolite/commons/workloadgeneration/WorkloadDefinition.java +++ b/benchmarks/workload-generator-commons/src/main/java/theodolite/commons/workloadgeneration/WorkloadDefinition.java @@ -6,6 +6,10 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.IntStream; +/** + * Definition of a workload consisting of a {@link KeySpace} and a period with which messages will + * be generated for key of that {@link KeySpace}. + */ public class WorkloadDefinition implements Serializable { private static final long serialVersionUID = -8337364281221817001L; // NOPMD @@ -33,6 +37,10 @@ public class WorkloadDefinition implements Serializable { return this.period; } + /** + * Divide this {@link WorkloadDefinition} into {@code parts} {@link WorkloadDefinition}s by + * distributing its {@link KeySpace} (almost) equally among all {@link WorkloadDefinition}s. + */ public Set<WorkloadDefinition> divide(final int parts) { final int effParts = Math.min(parts, this.keySpace.getCount()); final int minSize = this.keySpace.getCount() / effParts; -- GitLab