Example #1
0
 public Device(string did, string type, Node[] nodes)
 {
     CurrentNode = 0;
     DeviceID = did;
     DeviceType = type;
     Nodes = nodes;
 }
Example #2
0
        public void addNode(Node node)
        {
            if (CurrentNode == MAX_NODES - 1)
            {
                throw new System.ArgumentException("Nodes at full capacity");
            }

            Nodes[CurrentNode] = node;
            CurrentNode++;
        }
Example #3
0
        public void setNode(int index, Node node)
        {
            if (CurrentNode == MAX_NODES - 1)
            {
                throw new System.ArgumentException("Nodes at full capacity");
            }

            if(index > CurrentNode)
            {
                throw new System.ArgumentException("No Node in that index");
            }

            for(int i = 0; i < MAX_NODES; i++)
            {
                if(i == index)
                {
                    Nodes[i] = node;
                }
            }
        }