function self = subsasgn(self, s, val)
% Subscripted assignment for object dynaload
% overloading subscripted reference for objects
% Dot Notation vs. Function Notation
%
% $Id$

switch (length(s))
  case 3
    switch s(3).type
      case '.'
        h = get(self, s(1).subs);
        if isempty(h)
          
        end
        t = get(h, s(2).subs);
        t.(s(3).subs) = val;
        h = put(h, s(2).subs, t);
        self = put(self, s(1).subs, h);
      otherwise
        error('Invalid type.')
    end
  case 2
    switch s(1).type
      case '.'
        h = get(self, s(1).subs);
        h = put(h, s(2).subs, val);
        self = put(self, s(1).subs, h);
      otherwise
        error('Invalid type.')
    end
  case 1
    switch s.type
      case '()'
        if (length(s.subs) ~= 1)
          error('Only single indexing is supported.');
        end
        self = put(self, s.subs{1}, val);
      case '.'
        self = put(self, s.subs, val);
      otherwise
        error('Invalid type.')
    end
end
end