add

add(value: MemberType);

The add method of the Set class adds the object specified in the value parameter to a set; for example:

displayHierarchy() updating;
vars
    es           : EmployeeSet;
    emp          : Employee;
    count, level : Integer;
begin
    listOrg.clear;
    create es transient;
    foreach emp in app.myCompany.allEmployees do
        if emp.myManager = null then
            es.add(emp);
        endif;
    endforeach;
    if es.size = 0 then
        listOrg.addItem ("No root for chart");
    else
        foreach emp in es do
            displayEmployees(emp, 1);
        endforeach;
    endif;
    count := 1;
    while count < listOrg.listCount do
        listOrg.itemExpanded [count] := true;
        count := count + 1;
    endwhile;
end;

foreach emp in app.myCompany.allEmployees do
    if emp.myManager = null then
        empSet.add(emp);
    endif;
endforeach;

If the set already contains the object, an exception is raised.