classdef am_terminator < atomic
  %% Description
  %  counts assembled parts
  %% Ports
  %  inputs:
  %    in       incoming entities
  %  outputs: none
  %% States
  %  ni: counter for incoming entities
  %% System Parameters
  %  none

  methods
    function obj = am_terminator(name)
      if nargin == 1
        x = {'in'};  % create one input port
        y = {};      % no output ports
        s = {'ni'};   % counter for incoming jobs
        sysparams = {};
      else
        error('mistake at constructor method for class am_terminator');
      end
      obj = obj@atomic(name, x, y, s, 0, sysparams); % call parent
      obj.s.ni = 0;  % initialize the state
    end
        
    function ta = tafun(obj) %#ok<MANU>
      ta = inf;   % no internal events
    end
       
    function deltaconffun(obj,gt) %#ok<INUSD>
      % empty, because no internal events
    end
        
    function deltaextfun(obj,gt) %#ok<INUSD>
      % count the job from input port in
      obj.s.ni = obj.s.ni + 1;
    end
       
    function deltaintfun(obj) %#ok<MANU>
      % no internal events
    end
              
    function lambdafun(obj) %#ok<MANU>
      % lambdafun is never called, since there are no internal events
    end
       
  end  % methods
end   % classdef
