Class Node
-
- All Implemented Interfaces:
-
java.io.Serializable
,jline.lang.Copyable
public class Node extends NetworkElement implements Serializable
Superclass for a node element within a Network model
-
-
Field Summary
Fields Modifier and Type Field Description public final NodeAttribute
attribute
public Network
model
protected InputSection
input
protected OutputSection
output
protected ServiceSection
server
protected DropStrategy
dropStrategy
protected int
statefulIdx
protected int
nodeIndex
protected int
stationIdx
protected Matrix
state
protected String
name
-
Method Summary
Modifier and Type Method Description NodeAttribute
getAttribute()
Gets the attribute object containing additional metadata for this node. double
getCap()
Returns the total capacity limit for this node. double
getClassCap(JobClass jobClass)
Returns the capacity limit for a specific job class at this node. DropStrategy
getDropStrategy()
Gets the drop strategy used by this node when capacity limits are exceeded. InputSection
getInput()
Gets the input section that handles incoming jobs to this node. Network
getModel()
Returns the network model containing this node. void
setModel(Network model)
Sets the network model containing this node. int
getNodeIndex()
Gets the index of this node in the network's node collection. void
setNodeIdx(int index)
Sets the index of this node in the network's node collection. OutputSection
getOutput()
Gets the output section that handles job routing from this node. List<OutputStrategy>
getOutputStrategies()
Returns the list of output strategies configured for this node. RoutingStrategy
getRoutingStrategy(JobClass jobClass)
Returns the routing strategy configured for a specific job class. List<Section>
getSections()
Gets all sections (input, server, output) that compose this node. ServiceSection
getServer()
Gets the service section that handles job processing at this node. int
getStatefulIdx()
Gets the index of this node in the network's stateful node collection. int
getStationIdx()
Gets the index of this node in the network's station collection. void
setStationIdx(int index)
Sets the index of this node in the network's station collection. boolean
isReferenceStation()
Checks if this node is a reference station. boolean
isStateful()
Checks if this node maintains state between job visits. void
setState(Matrix state)
Sets the state of this node. Matrix
getState()
Gets the current state of this node. void
printSummary()
Prints a summary of this node's configuration to the console. void
reset()
Resets the internal state of this node. void
resetRouting()
Resets all routing configurations for this node. void
setProbRouting(JobClass jobClass, Node destination, double probability)
Sets probabilistic routing for a job class to a specific destination. void
setRouting(JobClass jobClass, RoutingStrategy routingStrategy)
Sets the routing strategy for a specific job class. void
setRouting(JobClass jobClass, RoutingStrategy routingStrategy, Node destination, double probability)
Sets the routing strategy with destination and probability for a job class. -
-
Constructor Detail
-
Node
Node(String nodeName)
Creates a new node with the specified name.- Parameters:
nodeName
- the name for this node
-
-
Method Detail
-
getAttribute
NodeAttribute getAttribute()
Gets the attribute object containing additional metadata for this node.
- Returns:
the node attribute object
-
getCap
double getCap()
Returns the total capacity limit for this node. Default implementation returns infinite capacity.
- Returns:
the total capacity limit
-
getClassCap
double getClassCap(JobClass jobClass)
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
DropStrategy getDropStrategy()
Gets the drop strategy used by this node when capacity limits are exceeded.
- Returns:
the drop strategy
-
getInput
InputSection getInput()
Gets the input section that handles incoming jobs to this node.
- Returns:
the input section
-
getModel
Network getModel()
Returns the network model containing this node.
- Returns:
the parent network model
-
setModel
void setModel(Network model)
Sets the network model containing this node.
- Parameters:
model
- the parent network model
-
getNodeIndex
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
void setNodeIdx(int index)
Sets the index of this node in the network's node collection.
- Parameters:
index
- the node index to set
-
getOutput
OutputSection getOutput()
Gets the output section that handles job routing from this node.
- Returns:
the output section
-
getOutputStrategies
List<OutputStrategy> getOutputStrategies()
Returns the list of output strategies configured for this node.
- Returns:
list of output routing strategies
-
getRoutingStrategy
RoutingStrategy getRoutingStrategy(JobClass jobClass)
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
List<Section> getSections()
Gets all sections (input, server, output) that compose this node.
- Returns:
list containing all node sections
-
getServer
ServiceSection getServer()
Gets the service section that handles job processing at this node.
- Returns:
the service section
-
getStatefulIdx
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
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
void setStationIdx(int index)
Sets the index of this node in the network's station collection.
- Parameters:
index
- the station index to set
-
isReferenceStation
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
boolean isStateful()
Checks if this node maintains state between job visits.
- Returns:
true if this node is stateful, false otherwise
-
setState
void setState(Matrix state)
Sets the state of this node.
- Parameters:
state
- the state matrix to set
-
printSummary
void printSummary()
Prints a summary of this node's configuration to the console.
-
reset
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
void resetRouting()
Resets all routing configurations for this node.
-
setProbRouting
void setProbRouting(JobClass jobClass, Node destination, double probability)
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.
-
setRouting
void setRouting(JobClass jobClass, RoutingStrategy routingStrategy)
Sets the routing strategy for a specific job class.
- Parameters:
jobClass
- the job class to configure routing forroutingStrategy
- the routing strategy to use
-
setRouting
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
-
-
-
-