Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "BaSyx / Introductory Examples / Java / Example Oven"

(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 one other 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.

  1. /**
  2.  * Oven containing a heater and a temperature sensor
  3.  */
  4. public interface IOven {
  5.  
  6. 	public Heater getHeater();
  7.  
  8. 	public TemperatureSensor getSensor();
  9. }


The oven stub is used during the example.

  1. /**
  2.  * Oven containing a heater and a temperature sensor
  3.  */
  4. public class Oven implements IOven {
  5. 	private Heater heater;
  6. 	private TemperatureSensor sensor;
  7.  
  8.  
  9. 	public Oven() {
  10. 		heater = new Heater();
  11. 		sensor = new TemperatureSensor(heater);
  12. 	}
  13.  
  14. 	public Heater getHeater() {
  15. 		return heater;
  16. 	}
  17.  
  18. 	public TemperatureSensor getSensor() {
  19. 		return sensor;
  20. 	}
  21. }

Back to the top