Skip to main content

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.

Jump to: navigation, search

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

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.

  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