public class ConnectionNetState
extends Object
Important: Users only should use this class only for queries via
getX()
methods, since kernel is in charge of modifying the network
state using the events (CACEvent
)
scheduled by the event generator (see IConnectionEventGenerator
)
and the actions (see CACAction
)
provided by the event processor (see ICACAlgorithm
).
Constructor and Description |
---|
ConnectionNetState(NetPlan netPlan)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
NetPlan |
convertToNetPlan()
Converts the current network state to a network plan.
|
ConnectionNetState |
copy()
Returns a deep copy of the network state
|
double |
getConnectionArrivalTime(int connectionId)
Returns the arrival time of the specified connection.
|
double |
getConnectionCurrentTrafficInErlangs(int connectionId)
Returns the current traffic volume for a given connection.
|
double[] |
getConnectionCurrentTrafficInErlangsVector()
Returns a vector with the carried traffic per connection.
|
int |
getConnectionDemand(int connectionId)
Returns the demand identifier for a given connection.
|
double |
getConnectionDuration(int connectionId)
Returns the duration of the specified connection.
|
int[] |
getConnectionIds()
Returns the set of active connection identifiers.
|
double |
getConnectionRequestedTrafficInErlangs(int connectionId)
Returns the requested traffic volume for a given connection.
|
double[] |
getConnectionRequestedTrafficInErlangsVector()
Returns a vector with the requested traffic per connection.
|
int |
getConnectionRoute(int connectionId)
Returns the route identifier associated to the connection.
|
int[] |
getConnectionSequenceOfLinks(int connectionId)
Returns the list of links traversed by the connection.
|
int[] |
getDemandConnections(int demandId)
Returns the set of connection ids associated to a given demand.
|
double[] |
getDemandCurrentCarriedTrafficInErlangsVector()
Returns a vector with the carried traffic per demand.
|
double[] |
getDemandCurrentOfferedTrafficInErlangsVector()
Returns a vector with the offered traffic per demand.
|
int[] |
getDemandNumberOfConnectionsVector()
Returns the number of current active connections per each demand.
|
double[] |
getLinkCurrentCarriedTrafficInErlangsVector()
Returns a vector with the carried traffic per link.
|
int[] |
getLinkNumberOfTraversingConnectionsVector()
Returns the number of current traversing connections per each link.
|
double[] |
getLinkSpareCapacityInErlangsVector()
Returns a vector with the spare capacity per link.
|
int[] |
getLinkTraversingConnections(int linkId)
Returns the list of connections which are traversed by a given link.
|
double[] |
getNodeEgressTrafficInErlangsVector()
Returns the current egress traffic from each node.
|
double[] |
getNodeIngressTrafficInErlangsVector()
Returns the current ingress traffic to each node.
|
double[] |
getNodeTraversingTrafficInErlangsVector()
Returns the current traffic traversing each node.
|
int |
getNumberOfActiveConnections()
Returns the number of active connections in the network.
|
boolean |
hasConnections()
Returns
true if the network has at least one active connection. |
boolean |
isActiveConnection(int connId)
Returns
true if the given connection is active. |
void |
removeConnection(int connectionId)
Removes the connection given by the identifier
|
void |
setConnectionState(int connectionId,
double currentTrafficVolume,
int[] sequenceOfLinks)
Modifies the state of the specified connection.
|
ConnectionNetState |
unmodifiableView()
Returns an unmodifiable view of the network state.
|
int |
update(CACEvent event,
List<CACAction> actions)
Updates the current network state according to an event and its corresponding actions.
|
public ConnectionNetState(NetPlan netPlan)
netPlan
- Complete network design (including traffic demands)public boolean isActiveConnection(int connId)
true
if the given connection is active.connId
- Connection identifiertrue
if the given connection is active, false
otherwisepublic void setConnectionState(int connectionId, double currentTrafficVolume, int[] sequenceOfLinks)
connectionId
- Connection identifiercurrentTrafficVolume
- New carried traffic by this connection measured in Erlangs. It must be greater or equal than zerosequenceOfLinks
- New sequence of links for this connectionUnsupportedOperationException
- If network state is not modifiablepublic int update(CACEvent event, List<CACAction> actions)
event
- CAC event (connection request or release)actions
- Actions (accept/block request, modify connection, release connection)UnsupportedOperationException
- If network state is not modifiablepublic ConnectionNetState copy()
public ConnectionNetState unmodifiableView()
public double[] getConnectionCurrentTrafficInErlangsVector()
public double[] getConnectionRequestedTrafficInErlangsVector()
public int[] getLinkTraversingConnections(int linkId)
linkId
- Link identifierpublic int[] getLinkNumberOfTraversingConnectionsVector()
public boolean hasConnections()
true
if the network has at least one active connection. It is equivalent to getNumberOfActiveConnections()
> 0
.true
if there are active connections in the network, and false
otherwisepublic void removeConnection(int connectionId)
connectionId
- Connection identifierUnsupportedOperationException
- If network state is not modifiablepublic int[] getConnectionSequenceOfLinks(int connectionId)
connectionId
- Connection identifierpublic double[] getNodeEgressTrafficInErlangsVector()
public double[] getNodeIngressTrafficInErlangsVector()
public double[] getNodeTraversingTrafficInErlangsVector()
public int getConnectionDemand(int connectionId)
connectionId
- Connection identifierpublic int[] getConnectionIds()
public int[] getDemandConnections(int demandId)
demandId
- Demand identifierpublic int[] getDemandNumberOfConnectionsVector()
public double[] getDemandCurrentOfferedTrafficInErlangsVector()
public double[] getDemandCurrentCarriedTrafficInErlangsVector()
public double getConnectionCurrentTrafficInErlangs(int connectionId)
connectionId
- Connection identifierpublic double getConnectionRequestedTrafficInErlangs(int connectionId)
connectionId
- Connection identifierpublic int getConnectionRoute(int connectionId)
connectionId
- Connection identifierpublic NetPlan convertToNetPlan()
public double[] getLinkSpareCapacityInErlangsVector()
public double[] getLinkCurrentCarriedTrafficInErlangsVector()
public int getNumberOfActiveConnections()
public double getConnectionArrivalTime(int connectionId)
connectionId
- Connection identifierpublic double getConnectionDuration(int connectionId)
connectionId
- Connection identifier