| package templates.m2m.utils; |
| |
| import org.eclipse.app4mc.amalthea.model.Time |
| import templates.AbstractAmaltheaInchronTransformer |
| |
| class TimeTransformer extends AbstractAmaltheaInchronTransformer { |
| |
| def create inchronModelFactory.createTime createTime(Time amltTime) { |
| |
| val amltValue = amltTime?.value |
| it.value = if(amltValue !== null) amltValue.longValue else 0; |
| |
| switch (amltTime?.unit) { |
| case S: |
| it.unit = com.inchron.realtime.root.model.TimeUnit.S |
| case MS: |
| it.unit = com.inchron.realtime.root.model.TimeUnit.MS |
| case US: |
| it.unit = com.inchron.realtime.root.model.TimeUnit.US |
| case NS: |
| it.unit = com.inchron.realtime.root.model.TimeUnit.NS |
| case PS: |
| it.unit = com.inchron.realtime.root.model.TimeUnit.PS |
| case _UNDEFINED_: |
| it.unit = com.inchron.realtime.root.model.TimeUnit.PS |
| } |
| } |
| |
| } |