DependencyReso...ctor -> DependencySubsystemVector

This commit is contained in:
JeremyStar™ 2024-07-08 14:27:49 +02:00
parent 9aba2e6281
commit 0afe18d857
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
2 changed files with 92 additions and 51 deletions

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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<DependencyVector> resolvedDependencies;
public DependencyResolvedDependencyVector(DependencyVector vector, List<DependencyVector> resolvedDependencies) {
super(vector.getIdentifier(), vector.getVersioningSystem(), vector.getVersion(), vector.getDependencies());
this.resolvedDependencies = resolvedDependencies;
}
}

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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<? extends VersioningSystem> 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<? extends VersioningSystem> versioningSystem, @NotNull String version, @NotNull SubsystemMainClass mainClass) {
super(identifier, versioningSystem, version);
this.mainClass = mainClass;
}
}