# MCFFactory Example

The following is an example of creating an MCFFactory, then traversing the branches to reach elements from different points. It is the loops that are importantâ€”any code within the loops is just an example of retrieval.

``````&testMCFFactory = create MCFFactory(100); /* set a maximum number of tasks in a task  list to 100 */

Local integer &i, &j, &k;
&i = 1;
&j = 1;
&k = 1;
&l = 1;
&m = 1;
&n = 1;

While &j < &testMCFFactory.LogicalQueue.Len + 1
/*looping through the logical queues*/
While &i < &testMCFFactory.LogicalQueue [&j].PhysicalQueue.Len + 1
/*looping through the physical queues*/

/*  e.g. Tasklists by physical queues*/
&PhysQID = &testMCFFactory.LogicalQueue [&j].PhysicalQueue [&i].PhysicalQueueID;

While &k < &testMCFFactory.LogicalQueue [&j].PhysicalQueue [&i].OverFlowedTaskList.Total + 1
/*looping through the Tasklist on physical queues*/

/*  e.g. Tasks by physical queues*/

&k = &k + 1;
End-While; /* &k loop */
/*Task List by Agents on a Physical Queue */
While &l < &testMCFFactory.LogicalQueue [&j].PhysicalQueue [&i].TotalAgents + 1
While &m < &testMCFFactory.LogicalQueue [&j].PhysicalQueue [&i].Agent [&l].TotalPhysicalQueues + 1
/*  e.g. Workload of agents on physical queues.  NOTE: &m  and &i are not the same value for the same physical queue.*/
/* e.g. tasks on Agent's accepted list  NOTE: &m  and &i are not the same value for the same physical queue.*/
&n = &n + 1;
End-While; /* &n Loop - tasks on Phys Q of Agents  */
&n = 1;
&m = &m + 1;
End-While; /* &m loop - Phys Q of Agents  - convoluted*/
&m = 1;
&l = &l + 1;
End-While; /* &l loop - Agents on Phys Q */
&i = &i + 1;
&k = 1;
End-While; /* &i loop- Physical Queues*/
&j = &j + 1;
&i = 1;
End-While; /* &j loop - Logical Queues*/``````