Class EquipmentCapacityStrategyRegistry

java.lang.Object
neqsim.process.equipment.capacity.EquipmentCapacityStrategyRegistry

public class EquipmentCapacityStrategyRegistry extends Object
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 Details

  • Constructor Details

    • EquipmentCapacityStrategyRegistry

      private EquipmentCapacityStrategyRegistry()
      Private constructor for singleton pattern.
  • Method Details

    • getInstance

      public static EquipmentCapacityStrategyRegistry 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

      public void register(EquipmentCapacityStrategy strategy)
      Registers a capacity strategy.

      If a strategy with the same name already exists, it will be replaced.

      Parameters:
      strategy - the strategy to register
    • unregister

      public boolean unregister(String strategyName)
      Unregisters a capacity strategy by name.
      Parameters:
      strategyName - the name of the strategy to remove
      Returns:
      true if a strategy was removed
    • findStrategy

      public EquipmentCapacityStrategy findStrategy(ProcessEquipmentInterface equipment)
      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

      public List<EquipmentCapacityStrategy> 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

      public double evaluateCapacity(ProcessEquipmentInterface equipment)
      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

      public Map<String, CapacityConstraint> getConstraints(ProcessEquipmentInterface equipment)
      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

      public boolean isWithinHardLimits(ProcessEquipmentInterface equipment)
      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