blob: 4bf1d2324b76bde3238b0065da7495fcc0f6a6da [file] [log] [blame]
Harald Mackamulca6c8b62019-02-14 16:41:16 +01001/**
2 * *******************************************************************************
3 * Copyright (c) 2019 Robert Bosch GmbH and others.
4 *
5 * This program and the accompanying materials are made
6 * available under the terms of the Eclipse Public License 2.0
7 * which is available at https://www.eclipse.org/legal/epl-2.0/
8 *
9 * SPDX-License-Identifier: EPL-2.0
10 *
11 * Contributors:
12 * Robert Bosch GmbH - initial API and implementation
13 * *******************************************************************************
14 */
15
Harald Mackamulf5d17b62019-02-14 14:57:58 +010016package templates.m2m.utils
Zakir Meerc3b605a2019-02-12 12:28:40 +010017
Zakir Meerc3b605a2019-02-12 12:28:40 +010018import com.inchron.realtime.root.model.FrequencyUnit
Harald Mackamul505789c2019-02-14 14:28:17 +010019import org.eclipse.app4mc.amalthea.model.Frequency
20import templates.AbstractAmaltheaInchronTransformer
Sebastian Reiserd2cae8b2019-04-03 13:39:33 +020021import com.google.inject.Singleton
Zakir Meerc3b605a2019-02-12 12:28:40 +010022
Sebastian Reiserd2cae8b2019-04-03 13:39:33 +020023@Singleton
Harald Mackamul505789c2019-02-14 14:28:17 +010024class FrequencyTransformer extends AbstractAmaltheaInchronTransformer {
25
Harald Mackamulf5d17b62019-02-14 14:57:58 +010026 def create inchronModelFactory.createFrequency createFrequency(Frequency amltFrequency) {
Harald Mackamul505789c2019-02-14 14:28:17 +010027
Harald Mackamulf5d17b62019-02-14 14:57:58 +010028 it.value = if(amltFrequency !== null) amltFrequency.value.floatValue else 0
Harald Mackamul505789c2019-02-14 14:28:17 +010029
30 it.unit = FrequencyUnit.getByName(amltFrequency?.unit.getName)
Harald Mackamul505789c2019-02-14 14:28:17 +010031 }
32
33}