Class ModelLocations.Location

java.lang.Object
net.ssehub.easy.basics.modelManagement.ModelLocations.Location
Enclosing class:
ModelLocations<M extends IModel>

public static class ModelLocations.Location extends Object
Represents a location with dependent locations (to be considered while loading a model).
Author:
Holger Eichelberger
  • Field Details

  • Constructor Details

    • Location

      private Location(File location)
      Creates a new location. This constructor is not visible as ModelLocations acts as a factory for instances of this class.
      Parameters:
      location - the file location to be represented by this class
  • Method Details

    • getLocation

      public File getLocation()
      Returns the file location represented by this instance.
      Returns:
      the file location
    • toDefaultLibLocation

      public ModelLocations.Location toDefaultLibLocation()
      Turns this location into a default library location.
      Returns:
      this
    • isDefaultLibLocation

      public boolean isDefaultLibLocation()
      Returns whether this location is a default library location.
      Returns:
      true for default library location, false else
    • getDependentLocationCount

      public int getDependentLocationCount()
      Returns the number of dependent locations.
      Returns:
      the number of dependent locations
    • getDependentLocation

      public ModelLocations.Location getDependentLocation(int index)
      The specified dependent locations.
      Parameters:
      index - the index of the location to be returned
      Returns:
      the dependent location
      Throws:
      IndexOutOfBoundsException - in case that index < 0 || index >=getDependentLocationCount()
    • addDependentLocation

      public void addDependentLocation(ModelLocations.Location location)
      Adds a dependent location, i.e., a related location also containing model files, usually for testing.
      Parameters:
      location - the location to be added
    • getDepending

      public ModelLocations.Location getDepending()
      Returns the location this location is depending on.
      Returns:
      the depending location, may be null for none, else set if this location was added as a dependent location to the depending location
    • countFilesInLocations

      private int countFilesInLocations(Set<File> excludedLocations, Set<ModelLocations.Location> done)
      Counts the files in this and dependent locations.
      Parameters:
      excludedLocations - locations not to be considered
      done - already processed locations (required to excluded circles)
      Returns:
      the number of files in this and related locations (excluding given and already processed locations)
    • contains

      private boolean contains(File file)
      Returns whether this location contains the given file (based on name inclusion).
      Parameters:
      file - the file to check for
      Returns:
      true if file is contained in this location, false else
    • removeFromDependentLocations

      private void removeFromDependentLocations(ModelLocations.Location location, Set<ModelLocations.Location> processed)
      Removes location from the dependent locations.
      Parameters:
      location - the location to be removed
      processed - the already processed locations (in order to avoid loops)
    • isDependentLocation

      private boolean isDependentLocation(ModelLocations.Location location, Set<ModelLocations.Location> processed)
      Returns whether location is a dependent location.
      Parameters:
      location - the location to be searched for
      processed - the already processed locations (in order to avoid loops)
      Returns:
      true if location is a dependent location, false else
    • toString

      public String toString()
      Overrides:
      toString in class Object