Class ModelLocations.Location

  • Enclosing class:
    ModelLocations<M extends IModel>

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

      • Location

        private Location​(java.io.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 Detail

      • getLocation

        public java.io.File getLocation()
        Returns the file location represented by this instance.
        Returns:
        the file location
      • 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:
        java.lang.IndexOutOfBoundsException - in case that index < 0 || index >=getDependentLocationCount()
      • addDependentLocation

        public void addDependentLocation​(ModelLocations.Location location)
        Adds a dependent location.
        Parameters:
        location - the location to be added
      • countFilesInLocations

        private int countFilesInLocations​(java.util.Set<java.io.File> excludedLocations,
                                          java.util.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​(java.io.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,
                                                  java.util.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,
                                            java.util.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 locatoin is a dependent location, false else
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object