Class AvgHandle
-
- All Implemented Interfaces:
public class AvgHandle
Handle for managing performance metrics organized by station and job class.
AvgHandle provides a structured way to store and access performance metrics (such as throughput, utilization, queue length, response time) that are computed by LINE solvers. The metrics are organized in a two-level hierarchy: first by station (queue, delay, etc.) and then by job class.
This class acts as a container that maps each (station, job class) pair to its corresponding performance metric. It provides methods for storing, retrieving, and managing these metrics efficiently.
Example usage:
AvgHandle handle = new AvgHandle(); handle.put(queue1, classA, new Metric(MetricType.Throughput, 2.5)); Metric throughput = handle.get(queue1, classA);
-
-
Constructor Summary
Constructors Constructor Description AvgHandle()
Constructs an empty AvgHandle.
-
Method Summary
Modifier and Type Method Description Metric
get(Station station, JobClass jobClass)
Retrieves the metric for a specific station and job class. Map<JobClass, Metric>
get(Station station)
Retrieves all metrics for a specific station across all job classes. Map<Station, Map<JobClass, Metric>>
get()
Retrieves the complete data structure containing all metrics. boolean
hasMetric(Station station, JobClass jobClass)
Checks if a metric exists for the specified station and job class. boolean
isEmpty()
Checks if this handle contains no metrics. Set<Station>
keySet()
Returns the set of all stations that have metrics stored. void
put(Station station, JobClass jobClass, Metric metric)
Stores a metric for a specific station and job class. void
remove(Station station, JobClass jobClass)
Removes the metric for a specific station and job class. -
-
Method Detail
-
get
Metric get(Station station, JobClass jobClass)
Retrieves the metric for a specific station and job class.
- Parameters:
station
- the station to queryjobClass
- the job class to query- Returns:
the metric for the given station and job class, or null if not found
-
get
Map<JobClass, Metric> get(Station station)
Retrieves all metrics for a specific station across all job classes.
- Parameters:
station
- the station to query- Returns:
a map from job class to metric for the given station, empty if station not found
-
get
Map<Station, Map<JobClass, Metric>> get()
Retrieves the complete data structure containing all metrics.
- Returns:
the full nested map: Station -> JobClass -> Metric
-
hasMetric
boolean hasMetric(Station station, JobClass jobClass)
Checks if a metric exists for the specified station and job class.
- Parameters:
station
- the station to checkjobClass
- the job class to check- Returns:
true if a metric exists for the given station and job class, false otherwise
-
isEmpty
boolean isEmpty()
Checks if this handle contains no metrics.
- Returns:
true if no metrics are stored, false otherwise
-
keySet
Set<Station> keySet()
Returns the set of all stations that have metrics stored.
- Returns:
a set containing all stations with stored metrics
-
put
void put(Station station, JobClass jobClass, Metric metric)
Stores a metric for a specific station and job class.
- Parameters:
station
- the station associated with the metricjobClass
- the job class associated with the metricmetric
- the metric value to store
-
remove
void remove(Station station, JobClass jobClass)
Removes the metric for a specific station and job class.
If this removal leaves the station with no job classes, the station entry is also removed from the data structure.
- Parameters:
station
- the station to remove fromjobClass
- the job class to remove
-
-
-
-