diff --git a/base/src/main/java/de/staropensource/sosengine/base/types/dependency/DependencyResolvedDependencyVector.java b/base/src/main/java/de/staropensource/sosengine/base/types/dependency/DependencyResolvedDependencyVector.java deleted file mode 100644 index 79e40ba..0000000 --- a/base/src/main/java/de/staropensource/sosengine/base/types/dependency/DependencyResolvedDependencyVector.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * STAROPENSOURCE ENGINE SOURCE FILE - * Copyright (c) 2024 The StarOpenSource Engine Contributors - * Licensed under the GNU Affero General Public License v3 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.staropensource.sosengine.base.types.dependency; - -import lombok.Getter; - -import java.util.List; - -/** - * Represents a dependency vector with resolved dependencies, used for dependency management. - * - * @since 1-alpha1 - */ -@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" }) -@Getter -public class DependencyResolvedDependencyVector extends DependencyVector { - /** - * Contains all resolved dependencies. - * - * @since v1-alpha1 - * - * -- GETTER -- - * Returns all resolved dependencies. - * - * @return resolved dependencies - * @since 1-alpha1 - */ - private final List resolvedDependencies; - - public DependencyResolvedDependencyVector(DependencyVector vector, List resolvedDependencies) { - super(vector.getIdentifier(), vector.getVersioningSystem(), vector.getVersion(), vector.getDependencies()); - this.resolvedDependencies = resolvedDependencies; - } -} diff --git a/base/src/main/java/de/staropensource/sosengine/base/types/dependency/DependencySubsystemVector.java b/base/src/main/java/de/staropensource/sosengine/base/types/dependency/DependencySubsystemVector.java new file mode 100644 index 0000000..ed20696 --- /dev/null +++ b/base/src/main/java/de/staropensource/sosengine/base/types/dependency/DependencySubsystemVector.java @@ -0,0 +1,92 @@ +/* + * STAROPENSOURCE ENGINE SOURCE FILE + * Copyright (c) 2024 The StarOpenSource Engine Contributors + * Licensed under the GNU Affero General Public License v3 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.staropensource.sosengine.base.types.dependency; + +import de.staropensource.sosengine.base.classes.SubsystemMainClass; +import de.staropensource.sosengine.base.types.versioning.VersioningSystem; +import lombok.Getter; +import org.jetbrains.annotations.NotNull; + +import java.util.List; + +/** + * Represents a dependency vector with an additional {@code mainClass} field. + * Used during the subsystem initialization process to easily determine the initialization order + * without much extra code and performance loss. + * + * @since 1-alpha1 + */ +@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" }) +@Getter +public class DependencySubsystemVector extends DependencyVector { + /** + * Contains the associated {@link SubsystemMainClass}. + * + * @since v1-alpha1 + * + * -- GETTER -- + * Returns the associated {@link SubsystemMainClass}. + * + * @return associated {@link SubsystemMainClass} + * @since 1-alpha1 + */ + private final SubsystemMainClass mainClass; + + /** + * Creates a new dependency vector. + * + * @param vector existing dependency vector to use + * @param mainClass {@link SubsystemMainClass} to associate + * @since 1-alpha1 + */ + public DependencySubsystemVector(@NotNull DependencyVector vector, @NotNull SubsystemMainClass mainClass) { + super(vector.getIdentifier(), vector.getVersioningSystem(), vector.getVersion(), vector.getDependencies()); + this.mainClass = mainClass; + } + + /** + * Creates a new dependency vector. + * + * @param identifier identifier + * @param versioningSystem versioning system to use + * @param version version + * @param dependencies dependencies in the usual format ({@code dependencyA}, {@code dependencyB=5.1}, {@code dependencyC>3.1}, {@code dependencyD<6.1}) + * @param mainClass {@link SubsystemMainClass} to associate + * @since 1-alpha1 + */ + public DependencySubsystemVector(@NotNull String identifier, @NotNull Class versioningSystem, @NotNull String version, @NotNull List<@NotNull String> dependencies, @NotNull SubsystemMainClass mainClass) { + super(identifier, versioningSystem, version, dependencies); + this.mainClass = mainClass; + } + + /** + * Creates a new dependency vector. + * + * @param identifier identifier + * @param versioningSystem versioning system to use + * @param version version + * @param mainClass {@link SubsystemMainClass} to associate + * @since 1-alpha1 + */ + public DependencySubsystemVector(@NotNull String identifier, @NotNull Class versioningSystem, @NotNull String version, @NotNull SubsystemMainClass mainClass) { + super(identifier, versioningSystem, version); + this.mainClass = mainClass; + } +}