Пример #1
0
        public void addSensor(Sensor sensor)
        {
            if (CurrentSensor == MAX_SENSORS - 1)
            {
                throw new System.ArgumentException("Sensors at full capacity");
            }

            _sensors[CurrentSensor] = sensor;
            CurrentSensor++;
        }
Пример #2
0
        public void setSensor(int index, Sensor sensor)
        {
            if (CurrentSensor == MAX_SENSORS - 1)
            {
                throw new System.ArgumentException("Sensors at full capacity");
            }

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

            for (int i = 0; i < MAX_SENSORS; i++)
            {
                if (i == index)
                {
                    _sensors[i] = sensor;
                }
            }
        }
Пример #3
0
 public Node(string id, string type, Sensor[] sensors)
 {
     NodeID = id;
     NodeType = type;
     _sensors = sensors;
 }