All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.microsoft.azure.arm.dag.PostRunTaskCollection Maven / Gradle / Ivy

There is a newer version: 1.7.14
Show newest version
/**
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See License.txt in the project root for
 * license information.
 */

package com.microsoft.azure.arm.dag;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * A collection of "Post Run" tasks.
 */
public final class PostRunTaskCollection {
    private final List collection;
    private final TaskGroup dependsOnTaskGroup;

    /**
     * Creates PostRunTaskCollection.
     *
     * @param dependsOnTaskGroup the task group in which "Post Run" tasks in the collection depends on
     */
    public PostRunTaskCollection(final TaskGroup dependsOnTaskGroup) {
        Objects.requireNonNull(dependsOnTaskGroup);
        this.collection = new ArrayList<>();
        this.dependsOnTaskGroup = dependsOnTaskGroup;
    }

    /**
     * Adds a "Post Run" task to the collection.
     *
     * @param taskItem the "Post Run" task
     */
    public void add(final IndexableTaskItem taskItem) {
        this.dependsOnTaskGroup.addPostRunDependentTaskGroup(taskItem.taskGroup());
        this.collection.add(taskItem);
    }

    /**
     * Adds a "Post Run" task to the collection.
     *
     * @param taskItem the "Post Run" task
     */
    public void add(final FunctionalTaskItem taskItem) {
        add(IndexableTaskItem.create(taskItem));
    }

    /**
     * Clears the result produced by all "Post Run" tasks in the collection.
     */
    public void clear() {
        for (IndexableTaskItem item : collection) {
            item.clear();
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy