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
(Created page with "= 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. <syntaxhighlight l...") |
m (Adds line numbers) |
||
(One intermediate revision by the same user not shown) | |||
Line 4: | Line 4: | ||
− | <syntaxhighlight lang="java" style="margin-left: 4em"> | + | 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" line> | ||
/** | /** | ||
* Oven containing a heater and a temperature sensor | * Oven containing a heater and a temperature sensor | ||
Line 17: | Line 19: | ||
− | <syntaxhighlight lang="java" style="margin-left: 4em"> | + | |
+ | The oven stub is used during the example. | ||
+ | |||
+ | <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;
}
}