/*
 * Bach - Java Shell Builder
 * Copyright (C) 2020 Christian Stein
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package de.sormuras.bach.project;

import java.util.Map;

/** A modular project structure. */
public final class Structure {

  /**
   * Return a new {@code Structure} instance with default component values.
   *
   * @return A new default structure object
   */
  public static Structure of() {
    return new Structure(Base.of(), Map.of());
  }

  private final Base base;
  private final Map<String, Locator> locators;

  /**
   * Initializes a new structure instance with the given component values.
   *
   * @param base The base instance
   * @param locators The locator map
   */
  public Structure(Base base, Map<String, Locator> locators) {
    this.base = base;
    this.locators = Map.copyOf(locators);
  }

  /**
   * Return the {@code Base} instance of this project.
   *
   * @return A base object
   */
  public Base base() {
    return base;
  }

  /**
   * Return the locators map of this project.
   *
   * @return A map of locator
   */
  public Map<String, Locator> locators() {
    return locators;
  }

}

@@ -683,16 +683,38 @@
 til.Map;
+%0Aimport java.util.Set;
 %0A%0A/** A 
@@ -980,16 +980,26 @@
 se.of(),
+ Set.of(),
  Map.of(
@@ -1034,16 +1034,54 @@
 e base;%0A
+  private final Set%3CString%3E requires;%0A
   privat
@@ -1241,16 +1241,67 @@
 nstance%0A
+   * @param requires The names of required modules%0A
    * @pa
@@ -1364,16 +1364,38 @@
 se base,
+ Set%3CString%3E requires,
  Map%3CStr
@@ -1442,16 +1442,58 @@
 = base;%0A
+    this.requires = Set.copyOf(requires);%0A
     this
@@ -1671,24 +1671,229 @@
  base;%0A  %7D%0A%0A
+  /**%0A   * Return the names of additionally required modules.%0A   *%0A   * @return A set of strings representing the name of required modules%0A   */%0A  public Set%3CString%3E requires() %7B%0A    return requires;%0A  %7D%0A%0A
   /**%0A   * R
@@ -2041,11 +2041,10 @@
 rs;%0A  %7D%0A
-%0A
 %7D%0A

Extend structure with set of required module names