Class CalcRouteBuilder
- java.lang.Object
-
- io.patriot_framework.network.simulator.api.builder.CalcRouteBuilder
-
public class CalcRouteBuilder extends Object
The type Calc route builder.
-
-
Constructor Summary
Constructors Constructor Description CalcRouteBuilder(int destNetwork)
CalcRouteBuilder(NetworkBuilder networkBuilder)
Instantiates a new Calc route builder.CalcRouteBuilder(TopologyBuilder topologyBuilder)
Instantiates a new Calc route builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CalcRouteBuilder
addRoute()
Create route with opposite direction and add both routes into their positions in calcRoutesLists in networks.TopologyBuilder
buildRoutes()
Complete routes by route which point to themselves (N1 -> N1) and returns topology builder updated by added routes.CalcRoute
createCalcRoute()
Creates route.CalcRouteBuilder
viaRouter(Router router)
Adds router attribute.CalcRouteBuilder
viaRouter(String routerName)
Finds router based on it`s name and sets it as router attribute.CalcRouteBuilder
withCost(Integer cost)
Adds cost attribute.CalcRouteBuilder
withDestNetwork(Integer targetNetworkIndex)
With dest network calc route builder.CalcRouteBuilder
withDestNetwork(String targetNetworkName)
Adds destination network attribute.CalcRouteBuilder
withSourceNetwork(Integer sourceNetwork)
With source network calc route builder.CalcRouteBuilder
withSourceNetwork(String sourceNetworkName)
Adds source network attribute.
-
-
-
Constructor Detail
-
CalcRouteBuilder
public CalcRouteBuilder(int destNetwork)
-
CalcRouteBuilder
public CalcRouteBuilder(TopologyBuilder topologyBuilder)
Instantiates a new Calc route builder. This CalcRouteBuilder is used to describe all routes in network topology with just one calcRoutes build. Provides auto completing of routes (route ws -> internet will be auto completed with route internet -> ws) which saves a lot of time.- Parameters:
topologyBuilder
- the topology builder
-
CalcRouteBuilder
public CalcRouteBuilder(NetworkBuilder networkBuilder)
Instantiates a new Calc route builder. This CalcRouteBuilder is used to describe CalculatedRoutes just for one network without auto complete etc...- Parameters:
networkBuilder
- the network builder
-
-
Method Detail
-
viaRouter
public CalcRouteBuilder viaRouter(String routerName)
Finds router based on it`s name and sets it as router attribute.- Parameters:
routerName
- the router name- Returns:
- the calc route builder
-
viaRouter
public CalcRouteBuilder viaRouter(Router router)
Adds router attribute.- Parameters:
router
- Router- Returns:
- the calc route builder
-
withCost
public CalcRouteBuilder withCost(Integer cost)
Adds cost attribute.- Parameters:
cost
- the cost- Returns:
- the calc route builder
-
withDestNetwork
public CalcRouteBuilder withDestNetwork(String targetNetworkName)
Adds destination network attribute. Identified by name. This method has to be used with topology builder, not with network builder.- Parameters:
targetNetworkName
- the target network name- Returns:
- the calc route builder
-
withDestNetwork
public CalcRouteBuilder withDestNetwork(Integer targetNetworkIndex)
With dest network calc route builder. Method has to be used with network builder.- Parameters:
targetNetworkIndex
- the target network index- Returns:
- the calc route builder
-
withSourceNetwork
public CalcRouteBuilder withSourceNetwork(String sourceNetworkName)
Adds source network attribute. Identified by name. This method has to be used with topology builder, not with network builder.- Parameters:
sourceNetworkName
- the source network name- Returns:
- the calc route builder
-
withSourceNetwork
public CalcRouteBuilder withSourceNetwork(Integer sourceNetwork)
With source network calc route builder.- Parameters:
sourceNetwork
- the source network- Returns:
- the calc route builder
-
addRoute
public CalcRouteBuilder addRoute()
Create route with opposite direction and add both routes into their positions in calcRoutesLists in networks.- Returns:
- the calc route builder
-
buildRoutes
public TopologyBuilder buildRoutes()
Complete routes by route which point to themselves (N1 -> N1) and returns topology builder updated by added routes.- Returns:
- the topology builder
-
createCalcRoute
public CalcRoute createCalcRoute()
Creates route.- Returns:
- calcRoute
-
-