function Groups = getGroups(h)
%GETGROUPS - returns a vector of Group labels used by this object

%   Copyright 2017-2019 The MathWorks, Inc.

bArgGroups   = get(h.BuildArgs,'Group');
tokenGroups  = get(h.Tokens,'Group');
optionGroups = h.Options.getGroups();
srcGroups    = h.Src.getGroups();
incGroups    = h.Inc.getGroups();

linkObjGroups = {};
for i=1:length(h.LinkObj)
    linkObjGroups = [linkObjGroups; h.LinkObj(i).getGroups];
end

ModelRefsGroups = {};
for i=1:length(h.ModelRefs)
    ModelRefsGroups = [ModelRefsGroups; h.ModelRefs(i).getGroups];
end


Groups = RTW.unique([rtwprivate('convertToCell',bArgGroups);...
                    rtwprivate('convertToCell',tokenGroups);...
                    rtwprivate('convertToCell',optionGroups);...
                    rtwprivate('convertToCell',srcGroups);...
                    rtwprivate('convertToCell',incGroups);...
                    rtwprivate('convertToCell',linkObjGroups);...
                    rtwprivate('convertToCell',ModelRefsGroups)]);
