Package jline.lang.nodes
Class Node
java.lang.Object
jline.lang.Element
jline.lang.NetworkElement
jline.lang.nodes.Node
- All Implemented Interfaces:
Serializable,Cloneable,Copyable
- Direct Known Subclasses:
ClassSwitch,Fork,Logger,Sink,StatefulNode
Superclass for a node element within a Network model
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DropStrategyprotected InputSectionprotected intprotected OutputSectionprotected Map<JobClass,StateDepRouting> Declared Krzesinski state-dependent routing structures, one per job class.protected ServiceSectionprotected Matrixprotected intint -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends Copyable>
Tcopy()Returns a copy of this node.protected NodeReturns a copy of this node, twin of the MATLABNode.copyElement: every field is copied shallowly, then the three sections are copied so the clone can be re-wired without disturbing the original.Gets the attribute object containing additional metadata for this node.doublegetCap()Returns the total capacity limit for this node.doublegetClassCap(JobClass jobClass) Returns the capacity limit for a specific job class at this node.Gets the drop strategy used by this node when capacity limits are exceeded.getInput()Gets the input section that handles incoming jobs to this node.getModel()Returns the network model containing this node.intGets the index of this node in the network's node collection.Gets the output section that handles job routing from this node.Returns the list of output strategies configured for this node.getRoutingStrategy(JobClass jobClass) Returns the routing strategy configured for a specific job class.Gets all sections (input, server, output) that compose this node.Gets the service section that handles job processing at this node.getState()Gets the current state of this node.getStateDepRouting(JobClass jobClass) Returns the state-dependent routing structure declared for a job class.intGets the index of this node in the network's stateful node collection.intGets the index of this node in the network's station collection.booleanChecks whether this node switches the class of the jobs traversing it.booleanChecks if this node is a reference station.booleanChecks if this node maintains state between job visits.booleanChecks whether this node is a station, i.e.Links this node to another one in the model it belongs to.voidPrints a summary of this node's configuration to the console.voidremoveJobClass(JobClass jobClass) Removes all per-class configuration referencing the given job class from this node.voidreset()Resets the internal state of this node.voidResets all routing configurations for this node.voidSets the network model containing this node.voidsetNodeIdx(int index) Sets the index of this node in the network's node collection.voidsetProbRouting(JobClass jobClass, Node destination, double probability) Sets probabilistic routing for a job class to a specific destination.voidsetRouting(JobClass jobClass, RoutingStrategy routingStrategy) Sets the routing strategy for a specific job class.voidsetRouting(JobClass jobClass, RoutingStrategy routingStrategy, Object param) Sets a routing strategy taking a single parameter, twin of the MATLABsetRouting(class, strategy, par1)call.voidsetRouting(JobClass jobClass, RoutingStrategy routingStrategy, Node destination, double probability) Sets the routing strategy with destination and probability for a job class.voidsetSQRouting(JobClass jobClass, int d) Configures power-of-K-choices routing for a job class.voidSets the state of this node.voidsetStateDepRouting(JobClass jobClass, Node departure, List<List<Node>> branches, int[] level, double[] C, double[][] d) Declares this node the entry center e of a subnetwork Q(V,V) served by the product-form state-dependent routing of Krzesinski (1987), "Multiclass Queueing Networks with State-Dependent Routing", Performance Evaluation 7(2):125-143.voidsetStationIdx(int index) Sets the index of this node in the network's station collection.voidsummary()Prints the one-line node summary, twin of MATLABNode.summary.
-
Field Details
-
model
-
input
-
output
-
server
-
dropStrategy
-
statefulIdx
protected int statefulIdx -
nodeIndex
protected int nodeIndex -
stationIdx
public int stationIdx -
state
-
sdrDeclarations
Declared Krzesinski state-dependent routing structures, one per job class.
-
-
Constructor Details
-
Node
Creates a new node with the specified name. Initializes default routing and service configurations.- Parameters:
nodeName- the name for this node
-
-
Method Details
-
getAttribute
Gets the attribute object containing additional metadata for this node.- Returns:
- the node attribute object
-
getCap
public double getCap()Returns the total capacity limit for this node. Default implementation returns infinite capacity.- Returns:
- the total capacity limit
-
getClassCap
Returns the capacity limit for a specific job class at this node. Default implementation returns infinite capacity.- Parameters:
jobClass- the job class to query- Returns:
- the capacity limit for the job class
-
getDropStrategy
Gets the drop strategy used by this node when capacity limits are exceeded.- Returns:
- the drop strategy
-
getInput
Gets the input section that handles incoming jobs to this node.- Returns:
- the input section
-
getModel
Returns the network model containing this node.- Returns:
- the parent network model
-
setModel
Sets the network model containing this node.- Parameters:
model- the parent network model
-
getNodeIndex
public int getNodeIndex()Gets the index of this node in the network's node collection. The index is lazily computed if not already set.- Returns:
- the node index
-
setNodeIdx
public void setNodeIdx(int index) Sets the index of this node in the network's node collection.- Parameters:
index- the node index to set
-
getOutput
Gets the output section that handles job routing from this node.- Returns:
- the output section
-
getOutputStrategies
Returns the list of output strategies configured for this node.- Returns:
- list of output routing strategies
-
removeJobClass
Removes all per-class configuration referencing the given job class from this node. The base implementation drops the class's output (routing) strategies; subclasses extend it to drop service, capacity, arrival and class-switching configuration. Called byNetwork.removeClass(jline.lang.JobClass).- Parameters:
jobClass- the job class being removed from the model
-
getRoutingStrategy
Returns the routing strategy configured for a specific job class.- Parameters:
jobClass- the job class to query- Returns:
- the routing strategy, or RAND if none specified
-
getSections
Gets all sections (input, server, output) that compose this node.- Returns:
- list containing all node sections
-
getServer
Gets the service section that handles job processing at this node.- Returns:
- the service section
-
getStatefulIdx
public int getStatefulIdx()Gets the index of this node in the network's stateful node collection. Returns -1 if this node is not stateful.- Returns:
- the stateful node index, or -1 if not stateful
-
getStationIdx
public int getStationIdx()Gets the index of this node in the network's station collection. The index is lazily computed if not already set.- Returns:
- the station index
-
setStationIdx
public void setStationIdx(int index) Sets the index of this node in the network's station collection.- Parameters:
index- the station index to set
-
isReferenceStation
public boolean isReferenceStation()Checks if this node is a reference station. Default implementation returns false; override in subclasses as needed.- Returns:
- true if this is a reference station, false otherwise
-
isStateful
public boolean isStateful()Checks if this node maintains state between job visits.- Returns:
- true if this node is stateful, false otherwise
-
setState
Sets the state of this node.- Parameters:
state- the state matrix to set
-
getState
Gets the current state of this node.- Returns:
- the current state matrix
-
printSummary
public void printSummary()Prints a summary of this node's configuration to the console. -
reset
public void reset()Resets the internal state of this node. Called when the network model is reset. Default implementation is no-op; override in subclasses as needed. -
resetRouting
public void resetRouting()Resets all routing configurations for this node. -
setProbRouting
Sets probabilistic routing for a job class to a specific destination.- Parameters:
jobClass- the job class to configure routing fordestination- the destination nodeprobability- the routing probability (0.0 to 1.0)
-
setRouting
Sets the routing strategy for a specific job class.- Parameters:
jobClass- the job class to configure routing forroutingStrategy- the routing strategy to use
-
setStateDepRouting
public void setStateDepRouting(JobClass jobClass, Node departure, List<List<Node>> branches, int[] level, double[] C, double[][] d) Declares this node the entry center e of a subnetwork Q(V,V) served by the product-form state-dependent routing of Krzesinski (1987), "Multiclass Queueing Networks with State-Dependent Routing", Performance Evaluation 7(2):125-143.The departure center may be this node itself in a central server model. Branches follow the paper's own indexing: index 0 of the list is the unused complement M-V and must be null or empty, and entry b lists the nodes of branch b with its entry center first and its departure center last. A single-center branch is a one-element list. level[b] is the index t of the subnetwork with B_b in V_t - V_{t+1}, and level[0] is ignored.
Negative C_t and positive d_tb make the routing prefer the least congested branches and impose the population bounds m_b <= d_tb/(-C_t) and v_t <= D_tt/(-C_t).
- Parameters:
jobClass- the job class routed by this subnetworkdeparture- the departure center d of Q(V,V)branches- branch node lists, index 0 unusedlevel- branch levels, index 0 unusedC- coefficients C_t, length Td- coefficients d_tb, T rows by B columns
-
getStateDepRouting
Returns the state-dependent routing structure declared for a job class.- Parameters:
jobClass- the job class- Returns:
- the declared structure, or null when the class is not routed by SDR
-
setSQRouting
Configures power-of-K-choices routing for a job class.- Parameters:
jobClass- the job classd- number of randomly sampled destinations (must be >= 1)
-
setRouting
public void setRouting(JobClass jobClass, RoutingStrategy routingStrategy, Node destination, double probability) Sets the routing strategy with destination and probability for a job class.- Parameters:
jobClass- the job class to configure routing forroutingStrategy- the routing strategy to usedestination- the destination nodeprobability- the routing probability to this destination
-
setRouting
Sets a routing strategy taking a single parameter, twin of the MATLABsetRouting(class, strategy, par1)call. SQ reads the parameter as the number d of sampled destinations; every other strategy takes none, so the parameter is ignored and the strategy is declared as insetRouting(JobClass, RoutingStrategy).- Parameters:
jobClass- the job class to configure routing forroutingStrategy- the routing strategy to useparam- the strategy parameter
-
hasClassSwitching
public boolean hasClassSwitching()Checks whether this node switches the class of the jobs traversing it.- Returns:
- true when the service section is a class switcher
-
isStation
public boolean isStation()Checks whether this node is a station, i.e. a node holding jobs in a queue or in service.- Returns:
- true if this node is a Station
-
link
Links this node to another one in the model it belongs to.- Parameters:
nodeTo- the destination node- Returns:
- this node, so calls can be chained
-
summary
public void summary()Prints the one-line node summary, twin of MATLABNode.summary. -
copyElement
Returns a copy of this node, twin of the MATLABNode.copyElement: every field is copied shallowly, then the three sections are copied so the clone can be re-wired without disturbing the original. The model handle stays shared, as it does in MATLAB.- Returns:
- a copy of this node
-
copy
Returns a copy of this node. Overrides the serialization-basedCopyable.copy()because that one would also clone the Network reached throughmodel; MATLAB shares the model handle instead, andcopyElement()reproduces that.
-