using System; using System.Collections.Generic; using Christie_net.annotation; using Christie_net.codegear; using Christie_net.topology.manager; namespace Christie_net.topology.manager { public class ParentManager { private int maxChildren; private int position = 0; private LinkedList list; public ParentManager(int hasChildren){ list = new LinkedList(); maxChildren = hasChildren; } public String getMyParent() { checkChildNumber(); return list.get(position).getName(); } public int getMyNumber() { checkChildNumber(); int num = list.get(position).children(); list.get(position).increment(); return num; } private void checkChildNumber() { for (;;next()) { if (list.get(position).children() < maxChildren) break; } } public void register(String name) { Parent p = new Parent(name); list.AddLast(p); } public void next() { position++; } public void previous() { position--; } public void replaceAndRemove(String remove, String replace) { Parent removeNode = find(remove); Remove(replace); removeNode.setName(replace); } public void remove(String remove) { Parent removeNode = find(remove); list.Remove(removeNode); } public Parent find(String name) { Boolean found = false; int i = 0; for (;i getList() { return list; } } }