%SparkProperties Store configuration key-value pairs to be passed to Spark on submission.
%
%   SparkProperties is a map of key-value pairs to be passed to Spark on
%   submission via Spark. These properties override Spark configuration and
%   customize how the Spark job runs.
%
%   Values can be scalar numeric, text or logical. Key-value pairs can be
%   get or set with indexing by  parentheses into SparkProperties.
%
%   Example:
%
%   % Set Spark property "spark.executorEnv.MyEnv" to text "My Value":
%   myCluster.SparkProperties("spark.executorEnv.MyEnv") = "My Value";
%
%   % Set Spark property "spark.executors.instances" to numeric value 16:
%   myCluster.SparkProperties("spark.executors.instances") = 16;
%
%   % Get the value of "spark.executors.instances":
%   myCluster.SparkProperties("spark.executors.instances")
%

% Copyright 2023 The MathWorks, Inc.

classdef SparkProperties < parallel.internal.bigdata.ConfigurationProperties
    methods
        function tf = isKey(obj, key)
            %ISKEY Determine if Spark properties contains key.
            %
            %    tf = isKey(myCluster.SparkProperties,key) returns a
            %    logical 1 (true) if the Spark properties contains the
            %    specified key, and it returns a logical 0 (false) otherwise.
            %    If key is an array that specifies multiple keys, then tf
            %    is a logical array of the same size.
            tf = obj.doIsKey(key);
        end

        function n = numEntries(obj)
            %NUMENTRIES Return number of key-value pairs in SparkProperties.
            %
            %    n = numEntries(myCluster.SparkProperties) returns the
            %    number of key-value pairs stored in the Spark properties.
            n = doNumEntries(obj);
        end

        function k = keys(obj)
            %KEYS Return keys of SparkProperties.
            %
            %   k = keys(myCluster.SparkProperties) returns an array
            %   containing the keys of the Spark properties.
            k = doKeys(obj);
        end

        function v = values(obj)
            %VALUES Return values of SparkProperties.
            %
            %   v = values(myCluster.SparkProperties) returns an array
            %   containing the values of the Spark properties.
            v = doValues(obj);
        end

        function remove(obj, key)
            %REMOVE Remove key-value pairs from SparkProperties.
            %
            %   remove(myCluster.SparkProperties,key) removes the key-value
            %   pairs from the Spark properties matching key. If key is an
            %   array that specifies multiple keys, multiple key-value
            %   pairs will be removed.
            doRemove(obj, key);
        end
    end
end
