Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "BaSyx / Introductory Examples / Java / Example Oven"
< BaSyx | Introductory Examples
m (→Oven stub) |
m (Adds line numbers) |
||
Line 6: | Line 6: | ||
The oven interface defines common interface functions to access to oven heater function and the oven temperature sensor function. It illustrates the ability to define generic interfaces for common aspects of assets. | The oven interface defines common interface functions to access to oven heater function and the oven temperature sensor function. It illustrates the ability to define generic interfaces for common aspects of assets. | ||
− | <syntaxhighlight lang="java" style="margin-left: 4em"> | + | <syntaxhighlight lang="java" style="margin-left: 4em" line> |
/** | /** | ||
* Oven containing a heater and a temperature sensor | * Oven containing a heater and a temperature sensor | ||
Line 22: | Line 22: | ||
The oven stub is used during the example. | The oven stub is used during the example. | ||
− | <syntaxhighlight lang="java" style="margin-left: 4em"> | + | <syntaxhighlight lang="java" style="margin-left: 4em" line> |
/** | /** | ||
* Oven containing a heater and a temperature sensor | * Oven containing a heater and a temperature sensor |
Latest revision as of 08:56, 23 August 2021
Oven stub
This stub code realizes an interface to an oven and a dummy implementation for the example code that can be executed without any hardware.
The oven interface defines common interface functions to access to oven heater function and the oven temperature sensor function. It illustrates the ability to define generic interfaces for common aspects of assets.
/**
* Oven containing a heater and a temperature sensor
*/
public interface IOven {
public Heater getHeater();
public TemperatureSensor getSensor();
}
The oven stub is used during the example.
/**
* Oven containing a heater and a temperature sensor
*/
public class Oven implements IOven {
private Heater heater;
private TemperatureSensor sensor;
public Oven() {
heater = new Heater();
sensor = new TemperatureSensor(heater);
}
public Heater getHeater() {
return heater;
}
public TemperatureSensor getSensor() {
return sensor;
}
}