Package org.planit.network
Interface InfrastructureLayers
-
- All Superinterfaces:
Iterable<InfrastructureLayer>
- All Known Implementing Classes:
InfraStructureLayersImpl
public interface InfrastructureLayers extends Iterable<InfrastructureLayer>
interface to manage infrastructure layers. Currently we only support macroscopic infrastructure layers so every instance created through this class will return aMacroscopicPhysicalNetwork. In future versions the user can choose which type is to be created.- Author:
- markr
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description MacroscopicPhysicalNetworkcreateNew()Create a new infrastructure layer (without registering on this class).InfrastructureLayerget(long id)Find a entity by its idInfrastructureLayerget(Mode mode)Find the layer that supports the passed in mode.default InfrastructureLayergetFirst()collect the first layer present based on the iteratordefault booleanisEachLayerEmpty()check if each layer itself is emptydefault booleanisNoLayers()When there are no layers the instance is considered emptyInfrastructureLayerregister(InfrastructureLayer entity)Add to the containerMacroscopicPhysicalNetworkregisterNew()Create a new infrastructure layer and registering on this class.InfrastructureLayerremove(long id)Remove by idInfrastructureLayerremove(InfrastructureLayer entity)Removeintsize()Return number of registered entity-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
-
-
-
Method Detail
-
remove
InfrastructureLayer remove(InfrastructureLayer entity)
Remove- Parameters:
entity- to remove- Returns:
- removed instance (if any), otherwise null
-
remove
InfrastructureLayer remove(long id)
Remove by id- Parameters:
id- to remove entity for- Returns:
- removed instance (if any), otherwise null
-
createNew
MacroscopicPhysicalNetwork createNew()
Create a new infrastructure layer (without registering on this class). Currently we only support macroscopic infrastructure layers so the returned type is the derived classMacroscopicPhysicalNetwork. In future versions the user can choose which type is to be created- Returns:
- created infrastructure layer
-
registerNew
MacroscopicPhysicalNetwork registerNew()
Create a new infrastructure layer and registering on this class. Currently we only support macroscopic infrastructure layers so the returned type is the derived classMacroscopicPhysicalNetwork. In future versions the user can choose which type is to be created- Returns:
- created infrastructure layer
-
register
InfrastructureLayer register(InfrastructureLayer entity)
Add to the container- Parameters:
entity- to be registered in this network- Returns:
- entity, in case it overrides an existing entry, the removed entry is returned
-
size
int size()
Return number of registered entity- Returns:
- number of registered entity
-
isNoLayers
default boolean isNoLayers()
When there are no layers the instance is considered empty- Returns:
- true when no layers exist yet, false otherwise
-
isEachLayerEmpty
default boolean isEachLayerEmpty()
check if each layer itself is empty- Returns:
- true when all empty false otherwise
-
get
InfrastructureLayer get(long id)
Find a entity by its id- Parameters:
id- Id of entity- Returns:
- retrieved entity
-
get
InfrastructureLayer get(Mode mode)
Find the layer that supports the passed in mode. Since a mode is only allowed to be supported by a single layer, this should yield the correct result. If multiple layers support the same mode for some reason, this method returns the first layer that supports the mode- Parameters:
mode- to find the layer for- Returns:
- first matching layer
-
getFirst
default InfrastructureLayer getFirst()
collect the first layer present based on the iterator- Returns:
- first available layer, null if no layers are present
-
-