Package srsim.domain

Examples of srsim.domain.IController


public class ControllerTest {

  @Test
  public void testAttachingSensors() throws SimulationConfigurationException {
    IController controller = new HeatingController();
    ISensor sensor = new TemperatureSensor();
    IActuator actuator = new HeatingActuator();
    controller.attachSensor(sensor);
    controller.attachActuator(actuator);
  }
View Full Code Here


    }
    JsonArray controllers = roomDescription.getJsonArray("controllers");
    if (controllers != null) {
      for (JsonObject controllerDescription : controllers
          .getValuesAs(JsonObject.class)) {
        IController controller = (IController) Class.forName(
            controllerDescription.getString("class")).newInstance();
        controller.setId(controllerDescription.getJsonNumber("id")
            .longValue());
        JsonArray sensorArray = controllerDescription
            .getJsonArray("sensors");
        if (sensorArray != null) {
          for (JsonNumber sensorId : sensorArray
              .getValuesAs(JsonNumber.class)) {
            controller.attachSensor(sensorMap.get(sensorId
                .intValue()));
          }
        }
        JsonArray actuatorArray = controllerDescription
            .getJsonArray("actuators");
        if (actuatorArray != null) {
          for (JsonNumber actuatorId : actuatorArray
              .getValuesAs(JsonNumber.class)) {
            controller.attachActuator(actuatorMap.get(actuatorId
                .intValue()));
          }
        }
        room.addController(controller);
      }
View Full Code Here

TOP

Related Classes of srsim.domain.IController

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.