% Static helper class for defining MJS and parallel pool port information.
% This class duplicates some information in
% com.mathworks.toolbox.distcomp.control.PortConfig. Until both use a 
% common data source, any changes here should be reflected there.

% Copyright 2020-2021 The MathWorks, Inc.

classdef PortConfig
    
    properties (Constant, Access = private)
        % Default base port
        DefaultBasePort = 27350;
        
        % Port offset from base port to connect to exchange with
        ExchangePortOffset = 6;
        
        % Communication prototcol used by exchange
        ExchangeProtocol = 'tcp'

        % Offset range for ports used by parpool
        ParpoolPortOffsetRange = [21, 999];
    end
    
    methods (Static)
        function port = getDefaultBasePort()
            import parallel.internal.cluster.PortConfig;
            port = PortConfig.DefaultBasePort;
        end
        
        function offset = getExchangePortOffset()
            import parallel.internal.cluster.PortConfig;
            offset = PortConfig.ExchangePortOffset;
        end
        
        function protocol = getExchangeProtocol()
            import parallel.internal.cluster.PortConfig;
            protocol = PortConfig.ExchangeProtocol;
        end

        function range = getParpoolPortOffsetRange()
            import parallel.internal.cluster.PortConfig;
            range = PortConfig.ParpoolPortOffsetRange;
        end
    end
end

