diff --git a/domino/app/src/main/java/io/quarkus/domino/cli/repo/BaseDependencyTreeProcessScheduler.java b/domino/api/src/main/java/io/quarkus/domino/tree/BaseDependencyTreeProcessScheduler.java similarity index 72% rename from domino/app/src/main/java/io/quarkus/domino/cli/repo/BaseDependencyTreeProcessScheduler.java rename to domino/api/src/main/java/io/quarkus/domino/tree/BaseDependencyTreeProcessScheduler.java index 4ea1dc5d..c6e48d02 100644 --- a/domino/app/src/main/java/io/quarkus/domino/cli/repo/BaseDependencyTreeProcessScheduler.java +++ b/domino/api/src/main/java/io/quarkus/domino/tree/BaseDependencyTreeProcessScheduler.java @@ -1,11 +1,10 @@ -package io.quarkus.domino.cli.repo; +package io.quarkus.domino.tree; import io.quarkus.devtools.messagewriter.MessageWriter; import java.util.ArrayList; import java.util.Formatter; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicLong; import org.eclipse.aether.artifact.Artifact; abstract class BaseDependencyTreeProcessScheduler implements DependencyTreeVisitScheduler { @@ -138,63 +137,4 @@ protected String getResolvedTreeMessage(Artifact a) { @formatter:on */ return sb.append(a.getVersion()).toString(); } - - public static void main(String[] args) throws Exception { - - double[] x1 = { 2, 3, 4, 5, 6, 7, 8, 9 }; - double[] y1 = { 4, 8, 16, 32, 64, 128, 256, 512 }; - double[] x2 = { 10 }; - - for (int i = 0; i < x2.length; i++) { - System.out.println("Value: " + x2[i] + " => extrapolation: " + extraPolate(x1, y1, x2[i])); - } - - var e = new Extrapolator(); - e.pushSample(2); - e.pushSample(4); - e.pushSample(8); - e.pushSample(16); - e.pushSample(32); - e.pushSample(64); - e.pushSample(128); - e.pushSample(256); - e.pushSample(512); - - System.out.println(e.extrapolate()); - } - - static double extraPolate(double[] x, double[] y, double x2) { - var lowIndex = 2; - return y[y.length - 1] + (x2 - x[x.length - lowIndex]) / (x[x.length - 1] - x[x.length - lowIndex]) - * (y[y.length - 1] - y[y.length - lowIndex]); - } - - private static class Extrapolator { - - private static final int MAX_SAMPLES = 6; - private static final int LOW_INDEX = 1; - private final AtomicLong[] samples = new AtomicLong[MAX_SAMPLES]; - private final AtomicInteger sampleCounter = new AtomicInteger(-1); - - public Extrapolator() { - for (int i = 0; i < MAX_SAMPLES; ++i) { - samples[i] = new AtomicLong(); - } - } - - public void pushSample(long sample) { - var sampleIndex = sampleCounter.incrementAndGet(); - samples[sampleIndex % MAX_SAMPLES].set(sample); - } - - public long extrapolate() { - var sampleCounter = this.sampleCounter.get(); - var sampleIndex = sampleCounter % MAX_SAMPLES; - var lastSample = samples[sampleIndex].get(); - var lowSample = samples[(MAX_SAMPLES + sampleIndex - LOW_INDEX) % MAX_SAMPLES].get(); - return lastSample - + (sampleCounter + 1 - (sampleCounter - LOW_INDEX)) / (sampleCounter - (sampleCounter - LOW_INDEX)) - * (lastSample - lowSample); - } - } } diff --git a/domino/app/src/main/java/io/quarkus/domino/cli/repo/DefaultTreeProcessingContext.java b/domino/api/src/main/java/io/quarkus/domino/tree/DefaultTreeProcessingContext.java similarity index 95% rename from domino/app/src/main/java/io/quarkus/domino/cli/repo/DefaultTreeProcessingContext.java rename to domino/api/src/main/java/io/quarkus/domino/tree/DefaultTreeProcessingContext.java index c81fa899..987e95c4 100644 --- a/domino/app/src/main/java/io/quarkus/domino/cli/repo/DefaultTreeProcessingContext.java +++ b/domino/api/src/main/java/io/quarkus/domino/tree/DefaultTreeProcessingContext.java @@ -1,4 +1,4 @@ -package io.quarkus.domino.cli.repo; +package io.quarkus.domino.tree; import io.quarkus.devtools.messagewriter.MessageWriter; import java.util.Objects; diff --git a/domino/app/src/main/java/io/quarkus/domino/cli/repo/DependencyTreeBuilder.java b/domino/api/src/main/java/io/quarkus/domino/tree/DependencyTreeBuilder.java similarity index 98% rename from domino/app/src/main/java/io/quarkus/domino/cli/repo/DependencyTreeBuilder.java rename to domino/api/src/main/java/io/quarkus/domino/tree/DependencyTreeBuilder.java index ad4bf36a..5ee0fe3f 100644 --- a/domino/app/src/main/java/io/quarkus/domino/cli/repo/DependencyTreeBuilder.java +++ b/domino/api/src/main/java/io/quarkus/domino/tree/DependencyTreeBuilder.java @@ -1,4 +1,4 @@ -package io.quarkus.domino.cli.repo; +package io.quarkus.domino.tree; import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver; import java.util.List; diff --git a/domino/app/src/main/java/io/quarkus/domino/cli/DependencyTreeProcessor.java b/domino/api/src/main/java/io/quarkus/domino/tree/DependencyTreeProcessor.java similarity index 95% rename from domino/app/src/main/java/io/quarkus/domino/cli/DependencyTreeProcessor.java rename to domino/api/src/main/java/io/quarkus/domino/tree/DependencyTreeProcessor.java index 816a7e00..56841d26 100644 --- a/domino/app/src/main/java/io/quarkus/domino/cli/DependencyTreeProcessor.java +++ b/domino/api/src/main/java/io/quarkus/domino/tree/DependencyTreeProcessor.java @@ -1,14 +1,10 @@ -package io.quarkus.domino.cli; +package io.quarkus.domino.tree; import io.quarkus.bootstrap.resolver.maven.BootstrapMavenContext; import io.quarkus.bootstrap.resolver.maven.BootstrapMavenException; import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver; import io.quarkus.bootstrap.resolver.maven.options.BootstrapMavenOptions; import io.quarkus.devtools.messagewriter.MessageWriter; -import io.quarkus.domino.cli.repo.DependencyTreeBuilder; -import io.quarkus.domino.cli.repo.DependencyTreeRoot; -import io.quarkus.domino.cli.repo.DependencyTreeVisitScheduler; -import io.quarkus.domino.cli.repo.DependencyTreeVisitor; import java.io.File; import java.util.ArrayList; import java.util.Collection; diff --git a/domino/app/src/main/java/io/quarkus/domino/cli/repo/DependencyTreeRoot.java b/domino/api/src/main/java/io/quarkus/domino/tree/DependencyTreeRoot.java similarity index 95% rename from domino/app/src/main/java/io/quarkus/domino/cli/repo/DependencyTreeRoot.java rename to domino/api/src/main/java/io/quarkus/domino/tree/DependencyTreeRoot.java index 301b9521..6f16199b 100644 --- a/domino/app/src/main/java/io/quarkus/domino/cli/repo/DependencyTreeRoot.java +++ b/domino/api/src/main/java/io/quarkus/domino/tree/DependencyTreeRoot.java @@ -1,4 +1,4 @@ -package io.quarkus.domino.cli.repo; +package io.quarkus.domino.tree; import java.util.Collection; import java.util.List; diff --git a/domino/app/src/main/java/io/quarkus/domino/cli/repo/DependencyTreeVisitScheduler.java b/domino/api/src/main/java/io/quarkus/domino/tree/DependencyTreeVisitScheduler.java similarity index 97% rename from domino/app/src/main/java/io/quarkus/domino/cli/repo/DependencyTreeVisitScheduler.java rename to domino/api/src/main/java/io/quarkus/domino/tree/DependencyTreeVisitScheduler.java index 91507e21..bd62dc67 100644 --- a/domino/app/src/main/java/io/quarkus/domino/cli/repo/DependencyTreeVisitScheduler.java +++ b/domino/api/src/main/java/io/quarkus/domino/tree/DependencyTreeVisitScheduler.java @@ -1,4 +1,4 @@ -package io.quarkus.domino.cli.repo; +package io.quarkus.domino.tree; import io.quarkus.devtools.messagewriter.MessageWriter; import io.quarkus.domino.processor.ExecutionContext; @@ -47,7 +47,7 @@ static DependencyTreeVisitScheduler parallel(DependencyTreeBuilder treeBuild MessageWriter log, int treesTotal) { - return new BaseDependencyTreeProcessScheduler(processor, log, treesTotal) { + return new BaseDependencyTreeProcessScheduler<>(processor, log, treesTotal) { final ParallelTreeProcessor treeProcessor = ParallelTreeProcessor .with(new NodeProcessor<>() { diff --git a/domino/app/src/main/java/io/quarkus/domino/cli/repo/DependencyTreeVisitor.java b/domino/api/src/main/java/io/quarkus/domino/tree/DependencyTreeVisitor.java similarity index 93% rename from domino/app/src/main/java/io/quarkus/domino/cli/repo/DependencyTreeVisitor.java rename to domino/api/src/main/java/io/quarkus/domino/tree/DependencyTreeVisitor.java index 38f3e169..6bc8ef3e 100644 --- a/domino/app/src/main/java/io/quarkus/domino/cli/repo/DependencyTreeVisitor.java +++ b/domino/api/src/main/java/io/quarkus/domino/tree/DependencyTreeVisitor.java @@ -1,4 +1,4 @@ -package io.quarkus.domino.cli.repo; +package io.quarkus.domino.tree; import io.quarkus.devtools.messagewriter.MessageWriter; import java.util.Collection; diff --git a/domino/app/src/main/java/io/quarkus/domino/cli/repo/NonResolvingDependencyTreeBuilder.java b/domino/api/src/main/java/io/quarkus/domino/tree/NonResolvingDependencyTreeBuilder.java similarity index 95% rename from domino/app/src/main/java/io/quarkus/domino/cli/repo/NonResolvingDependencyTreeBuilder.java rename to domino/api/src/main/java/io/quarkus/domino/tree/NonResolvingDependencyTreeBuilder.java index c4e43fca..4992db3e 100644 --- a/domino/app/src/main/java/io/quarkus/domino/cli/repo/NonResolvingDependencyTreeBuilder.java +++ b/domino/api/src/main/java/io/quarkus/domino/tree/NonResolvingDependencyTreeBuilder.java @@ -1,4 +1,4 @@ -package io.quarkus.domino.cli.repo; +package io.quarkus.domino.tree; import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver; import org.eclipse.aether.collection.DependencyCollectionException; diff --git a/domino/app/src/main/java/io/quarkus/domino/cli/repo/ResolvingDependencyTreeBuilder.java b/domino/api/src/main/java/io/quarkus/domino/tree/ResolvingDependencyTreeBuilder.java similarity index 96% rename from domino/app/src/main/java/io/quarkus/domino/cli/repo/ResolvingDependencyTreeBuilder.java rename to domino/api/src/main/java/io/quarkus/domino/tree/ResolvingDependencyTreeBuilder.java index 282b568f..a9d148bd 100644 --- a/domino/app/src/main/java/io/quarkus/domino/cli/repo/ResolvingDependencyTreeBuilder.java +++ b/domino/api/src/main/java/io/quarkus/domino/tree/ResolvingDependencyTreeBuilder.java @@ -1,4 +1,4 @@ -package io.quarkus.domino.cli.repo; +package io.quarkus.domino.tree; import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver; import org.eclipse.aether.graph.DependencyNode; diff --git a/domino/app/src/main/java/io/quarkus/domino/cli/Dependency.java b/domino/app/src/main/java/io/quarkus/domino/cli/Dependency.java index a714b956..7c1ac9b4 100644 --- a/domino/app/src/main/java/io/quarkus/domino/cli/Dependency.java +++ b/domino/app/src/main/java/io/quarkus/domino/cli/Dependency.java @@ -6,7 +6,8 @@ import io.quarkus.bootstrap.resolver.maven.options.BootstrapMavenOptions; import io.quarkus.devtools.messagewriter.MessageWriter; import io.quarkus.domino.ArtifactSet; -import io.quarkus.domino.cli.repo.DependencyTreeVisitor; +import io.quarkus.domino.tree.DependencyTreeProcessor; +import io.quarkus.domino.tree.DependencyTreeVisitor; import io.quarkus.maven.dependency.ArtifactCoords; import io.quarkus.util.GlobUtil; import java.io.BufferedWriter;