Class EquipmentCapacityStrategyRegistry
java.lang.Object
neqsim.process.equipment.capacity.EquipmentCapacityStrategyRegistry
Registry for equipment capacity strategies.
This registry maintains a collection of EquipmentCapacityStrategy implementations and
provides lookup functionality to find the appropriate strategy for any given equipment. The
registry uses a priority-based selection when multiple strategies support the same equipment.
Usage
// Get the singleton instance
EquipmentCapacityStrategyRegistry registry = EquipmentCapacityStrategyRegistry.getInstance();
// Register a custom strategy
registry.register(new MyCustomCompressorStrategy());
// Find strategy for equipment
EquipmentCapacityStrategy strategy = registry.findStrategy(myCompressor);
if (strategy != null) {
double utilization = strategy.evaluateCapacity(myCompressor);
}
- Version:
- 1.0
- Author:
- NeqSim Development Team
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static EquipmentCapacityStrategyRegistrySingleton instance.private final List<EquipmentCapacityStrategy> Registered strategies.private final Map<Class<?>, EquipmentCapacityStrategy> Cache for equipment class to strategy mapping. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivatePrivate constructor for singleton pattern. -
Method Summary
Modifier and TypeMethodDescriptiondoubleevaluateCapacity(ProcessEquipmentInterface equipment) Evaluates capacity for equipment using the appropriate strategy.findStrategy(ProcessEquipmentInterface equipment) Finds the best strategy for the given equipment.Gets all registered strategies.getConstraints(ProcessEquipmentInterface equipment) Gets all constraints for equipment using the appropriate strategy.Gets the singleton instance of the registry.intGets the number of registered strategies.booleanisWithinHardLimits(ProcessEquipmentInterface equipment) Checks if equipment is within all hard limits using the appropriate strategy.voidregister(EquipmentCapacityStrategy strategy) Registers a capacity strategy.private voidRegisters the default strategies for common equipment types.voidreset()Clears all registered strategies and resets to defaults.booleanunregister(String strategyName) Unregisters a capacity strategy by name.
-
Field Details
-
instance
Singleton instance. -
strategies
Registered strategies. -
strategyCache
Cache for equipment class to strategy mapping.
-
-
Constructor Details
-
EquipmentCapacityStrategyRegistry
private EquipmentCapacityStrategyRegistry()Private constructor for singleton pattern.
-
-
Method Details
-
getInstance
Gets the singleton instance of the registry.- Returns:
- the registry instance
-
registerDefaultStrategies
private void registerDefaultStrategies()Registers the default strategies for common equipment types. -
register
Registers a capacity strategy.If a strategy with the same name already exists, it will be replaced.
- Parameters:
strategy- the strategy to register
-
unregister
Unregisters a capacity strategy by name.- Parameters:
strategyName- the name of the strategy to remove- Returns:
- true if a strategy was removed
-
findStrategy
Finds the best strategy for the given equipment.Searches through registered strategies in priority order and returns the first one that supports the equipment.
- Parameters:
equipment- the equipment to find a strategy for- Returns:
- the best matching strategy, or null if none found
-
getAllStrategies
Gets all registered strategies.- Returns:
- unmodifiable list of strategies
-
getStrategyCount
public int getStrategyCount()Gets the number of registered strategies.- Returns:
- strategy count
-
reset
public void reset()Clears all registered strategies and resets to defaults. -
evaluateCapacity
Evaluates capacity for equipment using the appropriate strategy.Convenience method that finds the strategy and evaluates capacity in one call.
- Parameters:
equipment- the equipment to evaluate- Returns:
- capacity utilization, or -1 if no strategy found
-
getConstraints
Gets all constraints for equipment using the appropriate strategy.- Parameters:
equipment- the equipment to get constraints for- Returns:
- map of constraints, or empty map if no strategy found
-
isWithinHardLimits
Checks if equipment is within all hard limits using the appropriate strategy.- Parameters:
equipment- the equipment to check- Returns:
- true if within limits or no strategy found
-