%TrivialPartitioner
% A mapping from keys to reduce task IDs that sets everything to a single
% ID

%   Copyright 2014-2016 The MathWorks, Inc.

classdef (Sealed, Hidden) TrivialPartitioner < handle
    properties (GetAccess = private, SetAccess = immutable)
        ReduceTaskID; % The reduce task ID
    end
    
    methods
        function obj = TrivialPartitioner(reduceTaskID)
            assert(isnumeric(reduceTaskID) && isscalar(reduceTaskID));
            obj.ReduceTaskID = reduceTaskID;
        end
        
        % Map the given keys to the corresponding reduce task buckets.
        function reduceTaskIDs = partition(obj, keys)
            reduceTaskIDs = ones(size(keys))*obj.ReduceTaskID;
        end
    end
end
