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 java.lang.ObjectRepresents a location with dependent locations (to be considered while loading a model).- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<ModelLocations.Location>dependentprivate java.io.Filelocation
-
Constructor Summary
Constructors Modifier Constructor Description privateLocation(java.io.File location)Creates a new location.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDependentLocation(ModelLocations.Location location)Adds a dependent location.private booleancontains(java.io.File file)Returns whether this location contains the givenfile(based on name inclusion).private intcountFilesInLocations(java.util.Set<java.io.File> excludedLocations, java.util.Set<ModelLocations.Location> done)Counts the files in this and dependent locations.ModelLocations.LocationgetDependentLocation(int index)The specified dependent locations.intgetDependentLocationCount()Returns the number of dependent locations.java.io.FilegetLocation()Returns the file location represented by this instance.private booleanisDependentLocation(ModelLocations.Location location, java.util.Set<ModelLocations.Location> processed)Returns whetherlocationis a dependent location.private voidremoveFromDependentLocations(ModelLocations.Location location, java.util.Set<ModelLocations.Location> processed)Removeslocationfrom the dependent locations.java.lang.StringtoString()
-
-
-
Field Detail
-
location
private java.io.File location
-
dependent
private java.util.List<ModelLocations.Location> dependent
-
-
Constructor Detail
-
Location
private Location(java.io.File location)
Creates a new location. This constructor is not visible asModelLocationsacts 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 thatindex < 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 considereddone- 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 givenfile(based on name inclusion).- Parameters:
file- the file to check for- Returns:
trueiffileis contained in this location,falseelse
-
removeFromDependentLocations
private void removeFromDependentLocations(ModelLocations.Location location, java.util.Set<ModelLocations.Location> processed)
Removeslocationfrom the dependent locations.- Parameters:
location- the location to be removedprocessed- the already processed locations (in order to avoid loops)
-
isDependentLocation
private boolean isDependentLocation(ModelLocations.Location location, java.util.Set<ModelLocations.Location> processed)
Returns whetherlocationis a dependent location.- Parameters:
location- the location to be searched forprocessed- the already processed locations (in order to avoid loops)- Returns:
trueiflocatoinis a dependent location,falseelse
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-