gusucode.com > bigdata 工具箱 matlab源码程序 > bigdata/+matlab/+bigdata/+internal/+lazyeval/Operation.m
%Operation % An interface that represents an operation. % Copyright 2015-2016 The MathWorks, Inc. classdef (Abstract) Operation < handle properties (SetAccess = immutable) % The number of inputs that the operation accepts. NumInputs; % The number of outputs that the operation returns. NumOutputs; % A flag that specifies if this operation supports preview. This is % true if and only if this operation can emit a small part of the output % based on only a small part of the input. This must be true if % DependsOnOnlyHead is true. SupportsPreview = false; % A flag that describes if this operation depends on only a small % number of slices that originate at the beginning. DependsOnOnlyHead = false; end methods % The main constructor. function obj = Operation(numInputs, numOutputs, supportsPreview, dependsOnlyOnHead) assert(isnumeric(numInputs) && isscalar(numInputs) && mod(numInputs,1) == 0 && numInputs >= 0); assert(isnumeric(numOutputs) && isscalar(numOutputs) && mod(numOutputs,1) == 0 && numOutputs >= 0); obj.NumInputs = numInputs; obj.NumOutputs = numOutputs; if nargin >= 3 assert(islogical(supportsPreview) && isscalar(supportsPreview)); obj.SupportsPreview = supportsPreview; end if nargin >= 4 assert(islogical(dependsOnlyOnHead) && isscalar(dependsOnlyOnHead)); if dependsOnlyOnHead assert(supportsPreview, 'The SupportsPreview property cannot be false if DependsOnOnlyHead is true.'); end obj.DependsOnOnlyHead = dependsOnlyOnHead; end end end methods (Abstract) % Create a list of ExecutionTask instances that represent this % operation when applied to taskDependencies. % % Inputs: % - taskDependencies: A list of ExecutionTask instances that represent % the direct upstream tasks whos output will be passed into this % operation. % - inputFutureMap: An object that represents a mapping from the % list of dependencies/taskDependencies to the list of operation inputs. % - isInputReplicated: A list of logicals that for each input to the % operation, describes whether that input has been replicated % across all partitions. tasks = createExecutionTasks(obj, taskDependencies, inputFutureMap, isInputReplicated) end end