Exemplo n.º 1
0
        private static TreeElement instantiateBlueprintTreeRecursive(OperatorBlueprint.TreeElement treeElement)
        {
            TreeElement resultTreeElement;

            resultTreeElement = new TreeElement();
            resultTreeElement.apearsInParentParameterInstances = treeElement.apearsInParentParameterInstances;

            resultTreeElement.operatorInstance           = treeElement.operatorToInstanciate.createOperatorInstance();
            resultTreeElement.operatorInstance.constants = treeElement.constantsForOperatorInstance;

            if (treeElement.isBranch())
            {
                resultTreeElement.type = TreeElement.EnumType.BRANCH;
            }
            else
            {
                resultTreeElement.type = TreeElement.EnumType.LEAF;
            }

            if (treeElement.isBranch())
            {
                resultTreeElement.childrens = new List <TreeElement>();

                foreach (OperatorBlueprint.TreeElement iteratorChildTreeElement in treeElement.childrens)
                {
                    resultTreeElement.childrens.Add(instantiateBlueprintTreeRecursive(iteratorChildTreeElement));
                }
            }

            return(resultTreeElement);
        }
Exemplo n.º 2
0
        private static int countDummiesOfTreeRecursive(OperatorBlueprint.TreeElement treeElement)
        {
            if (treeElement.isLeaf())
            {
                if (treeElement.isDummy())
                {
                    return(1);
                }

                return(0);
            }
            else
            {
                int count;

                count = 0;

                foreach (OperatorBlueprint.TreeElement iteratorTree in treeElement.childrens)
                {
                    count += countDummiesOfTreeRecursive(iteratorTree);
                }

                return(count);
            }
        }