Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_service_time(self, clss):
"""
Returns a service time for the given customer class
"""
return Decimal(str(self.simulation.service_times[self.id_number][clss]._sample(self.simulation.current_time)))
def get_now(self):
"""
Gets the current time
"""
return Decimal(self.simulation.current_time)
class ExactArrivalNode(ArrivalNode):
"""
Inherits from the ArrivalNode class, implements a
more precise version of addition to fix discrepencies
with floating point numbers.
"""
def increment_time(self, original, increment):
"""
Increments the original time by the increment
"""
return Decimal(str(original)) + Decimal(str(increment))
def inter_arrival(self, nd, clss):
"""
Samples the inter-arrival time for next class and node.
"""
return Decimal(str(self.simulation.inter_arrival_times[nd][clss]._sample(self.simulation.current_time)))
def set_classes(self, node_class, arrival_node_class):
"""
Sets the type of ArrivalNode and Node classes being used
in the Simulation model (if customer classes are used.)
"""
if arrival_node_class is not None:
self.ArrivalNodeType = arrival_node_class
else:
self.ArrivalNodeType = ArrivalNode
if node_class is not None:
self.NodeType = node_class
else:
self.NodeType = Node