Beispiel #1
0
  public void setEntity(EntityLocal entity) {
    super.setEntity(entity);

    for (Sensor source : sources) {
      subscribe(entity, source, this);
      if (source instanceof AttributeSensor) {
        Object value = entity.getAttribute((AttributeSensor) source);
        if (value != null) onEvent(new BasicSensorEvent(source, entity, value));
      }
    }
  }
  public void setEntity(EntityLocal entity) {
    super.setEntity(entity);
    if (producer == null) producer = entity;
    subscribe(producer, source, this);

    if (source instanceof AttributeSensor) {
      Object value = producer.getAttribute((AttributeSensor) source);
      // TODO Aled didn't you write a convenience to "subscribeAndRunIfSet" ? (-Alex)
      if (value != null) onEvent(new BasicSensorEvent(source, producer, value));
    }
  }