Repository for the assignments of the course TDT4250 at NTNU
contains the source code and the model
src
contains the generated source codemodel
contains the ECore model, the generator model and a dynamic instance
contains the generated and the custom tests for the source code
- Install BndTools
- Import all projects starting with
no.tdt4250.conversion
into the eclipse workspace
no.tdt4250.conversion.api
: defines the API for all other components / projectsno.tdt4250.conversion.converter
: contains the used converter for converting the values (TransientConverter
, which can convert value transiently)no.tdt4250.conversion.gogo
: the service for commands for gogo consoleno.tdt4250.conversion.servlet
: the service to start a servlet for humand readble output of the conversionno.tdt4250.conversion.temperature
: contains basic temperature conversionsno.tdt4250.conversion.rest
: the rest service for converting values
Start project no.tdt.4250.conversion.rest
Make an http GET
-request to localhost:8080
with parameters:
value
(Double): the value that should be convertedfrom
(String): the unit of valueto
(String): the unit of the target converted value
For example: localhost:8080/convert?from=Fahrenheit&to=Kelvin&value=20
returns following:
{
"success": true,
"value": 20,
"converted": 266.4833333333333,
"unitFrom": {
"name": "Fahrenheit",
"symbol": "°F"
},
"unitTo": {
"name": "Kelvin",
"symbol": "K"
}
}
Commands:
list
: lists all available direct conversionsadd
: add a new conversion e.g.:add "Centimeter(cm) = Inch(in) * 0.393 + 0"
I simplified the model to the relevant data for Assignment 3
The model is transformated to .html
wih Acceleo M2T.
The package no.tdt4250.model.html.main
contains the transformation.
The output for the instance no.tdt4250.model/model/programmes.xmi
is here
It was generated by the Acceleo Java Standalone.
- Install the Eclipse Acceleo Plugin
- Run the
generateHTML.mtl
file as Acceleo Programm inno.tdt4250.model.html.main
.- specify the the instance with
no.tdt4250.model/model/programmes.xmi
and your desired target directory
- specify the the instance with