Class ModelLocations.Location
java.lang.Object
net.ssehub.easy.basics.modelManagement.ModelLocations.Location
- Enclosing class:
ModelLocations<M extends IModel>
Represents a location with dependent locations (to be considered while loading a model).
- Author:
- Holger Eichelberger
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate List<ModelLocations.Location> private ModelLocations.Locationprivate File -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDependentLocation(ModelLocations.Location location) Adds a dependent location, i.e., a related location also containing model files, usually for testing.private booleanReturns whether this location contains the givenfile(based on name inclusion).private intcountFilesInLocations(Set<File> excludedLocations, Set<ModelLocations.Location> done) Counts the files in this and dependent locations.getDependentLocation(int index) The specified dependent locations.intReturns the number of dependent locations.Returns the location this location is depending on.Returns the file location represented by this instance.booleanReturns whether this location is a default library location.private booleanisDependentLocation(ModelLocations.Location location, Set<ModelLocations.Location> processed) Returns whetherlocationis a dependent location.private voidremoveFromDependentLocations(ModelLocations.Location location, Set<ModelLocations.Location> processed) Removeslocationfrom the dependent locations.Turns this location into a default library location.toString()
-
Field Details
-
location
-
dependent
-
depending
-
defaultLibLocation
private boolean defaultLibLocation
-
-
Constructor Details
-
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 Details
-
getLocation
Returns the file location represented by this instance.- Returns:
- the file 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:
truefor default library location,falseelse
-
getDependentLocationCount
public int getDependentLocationCount()Returns the number of dependent locations.- Returns:
- the number of dependent locations
-
getDependentLocation
The specified dependent locations.- Parameters:
index- the index of the location to be returned- Returns:
- the dependent location
- Throws:
IndexOutOfBoundsException- in case thatindex < 0 || index >=getDependentLocationCount()
-
addDependentLocation
Adds a dependent location, i.e., a related location also containing model files, usually for testing.- Parameters:
location- the location to be added
-
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
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
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, 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, 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:
trueiflocationis a dependent location,falseelse
-
toString
-