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 MacroscopicPhysicalNetwork
createNew()
Create a new infrastructure layer (without registering on this class).InfrastructureLayer
get(long id)
Find a entity by its idInfrastructureLayer
get(Mode mode)
Find the layer that supports the passed in mode.default InfrastructureLayer
getFirst()
collect the first layer present based on the iteratordefault boolean
isEachLayerEmpty()
check if each layer itself is emptydefault boolean
isNoLayers()
When there are no layers the instance is considered emptyInfrastructureLayer
register(InfrastructureLayer entity)
Add to the containerMacroscopicPhysicalNetwork
registerNew()
Create a new infrastructure layer and registering on this class.InfrastructureLayer
remove(long id)
Remove by idInfrastructureLayer
remove(InfrastructureLayer entity)
Removeint
size()
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
-
-