Search in sources :

Example 1 with VariableType

use of com.opensimulationplatform.modeldescription.xml.model.VariableType in project osp-validator by open-simulation-platform.

the class LinearVelocityTypeConverter method convert.

@Override
public LinearVelocity convert(LinearVelocityType linearVelocityType) {
    LinearVelocity linearVelocity = new LinearVelocity();
    linearVelocity.setName(linearVelocityType.getName());
    List<VariableType> variableTypes = linearVelocityType.getVariable();
    List<Variable> variables = variableTypes.stream().map(context.variableTypeConverter::convert).collect(Collectors.toList());
    linearVelocity.setVariables(variables);
    return linearVelocity;
}
Also used : LinearVelocity(com.opensimulationplatform.core.model.modeldescription.variablegroup.linearvelocity.LinearVelocity) Variable(com.opensimulationplatform.core.model.modeldescription.Variable) VariableType(com.opensimulationplatform.modeldescription.xml.model.VariableType)

Example 2 with VariableType

use of com.opensimulationplatform.modeldescription.xml.model.VariableType in project osp-validator by open-simulation-platform.

the class NmeaGgaFixTypeConverter method convert.

@Override
public NmeaGgaFix convert(NmeaGgaFixType nmeaGgaFixType) {
    NmeaGgaFix nmeaGgaFix = new NmeaGgaFix();
    nmeaGgaFix.setName(nmeaGgaFixType.getName());
    List<VariableType> variableTypes = nmeaGgaFixType.getVariable();
    List<Variable> variables = variableTypes.stream().map(context.variableTypeConverter::convert).collect(Collectors.toList());
    nmeaGgaFix.setVariables(variables);
    return nmeaGgaFix;
}
Also used : Variable(com.opensimulationplatform.core.model.modeldescription.Variable) VariableType(com.opensimulationplatform.modeldescription.xml.model.VariableType) NmeaGgaFix(com.opensimulationplatform.core.model.modeldescription.variablegroup.nmeaggafix.NmeaGgaFix)

Example 3 with VariableType

use of com.opensimulationplatform.modeldescription.xml.model.VariableType in project osp-validator by open-simulation-platform.

the class NmeaGgaLatitudeLongitudeTypeConverter method convert.

@Override
public NmeaGgaLatitudeLongitude convert(NmeaGgaLatitudeLongitudeType nmeaGgaLatitudeLongitudeType) {
    NmeaGgaLatitudeLongitude nmeaGgaLatitudeLongitude = new NmeaGgaLatitudeLongitude();
    nmeaGgaLatitudeLongitude.setName(nmeaGgaLatitudeLongitudeType.getName());
    List<VariableType> variableTypes = nmeaGgaLatitudeLongitudeType.getVariable();
    List<Variable> variables = variableTypes.stream().map(context.variableTypeConverter::convert).collect(Collectors.toList());
    nmeaGgaLatitudeLongitude.setVariables(variables);
    return nmeaGgaLatitudeLongitude;
}
Also used : NmeaGgaLatitudeLongitude(com.opensimulationplatform.core.model.modeldescription.variablegroup.nmeaggalatitudelongitude.NmeaGgaLatitudeLongitude) Variable(com.opensimulationplatform.core.model.modeldescription.Variable) VariableType(com.opensimulationplatform.modeldescription.xml.model.VariableType)

Example 4 with VariableType

use of com.opensimulationplatform.modeldescription.xml.model.VariableType in project osp-validator by open-simulation-platform.

the class NmeaGstEllipseTypeConverter method convert.

@Override
public NmeaGstEllipse convert(NmeaGstEllipseType nmeaGstEllipseType) {
    NmeaGstEllipse nmeaGstEllipse = new NmeaGstEllipse();
    nmeaGstEllipse.setName(nmeaGstEllipseType.getName());
    List<VariableType> variableTypes = nmeaGstEllipseType.getVariable();
    List<Variable> variables = variableTypes.stream().map(context.variableTypeConverter::convert).collect(Collectors.toList());
    nmeaGstEllipse.setVariables(variables);
    return nmeaGstEllipse;
}
Also used : Variable(com.opensimulationplatform.core.model.modeldescription.Variable) VariableType(com.opensimulationplatform.modeldescription.xml.model.VariableType) NmeaGstEllipse(com.opensimulationplatform.core.model.modeldescription.variablegroup.nmeagstellipse.NmeaGstEllipse)

Example 5 with VariableType

use of com.opensimulationplatform.modeldescription.xml.model.VariableType in project osp-validator by open-simulation-platform.

the class VariableTypeConverterTest method canConvert.

@Test
public void canConvert() {
    ConverterContext converterContext = new ConverterContext();
    Variable v = new Variable();
    v.setName("variableName");
    converterContext.modelDescription.getVariables().add(v);
    Unit u = new Unit();
    u.setName("unitName");
    converterContext.modelDescription.getUnits().add(u);
    VariableType variableType = new VariableType();
    variableType.setRef(v.getName().get());
    variableType.setUnit(u.getName().get());
    VariableTypeConverter variableTypeConverter = new VariableTypeConverter(converterContext);
    Variable variable = variableTypeConverter.convert(variableType);
    assertEquals(v, variable);
    assertEquals(u, variable.getUnit());
}
Also used : ConverterContext(com.opensimulationplatform.modeldescription.xml.converter.ConverterContext) Variable(com.opensimulationplatform.core.model.modeldescription.Variable) VariableType(com.opensimulationplatform.modeldescription.xml.model.VariableType) Unit(com.opensimulationplatform.core.model.modeldescription.Unit) Test(org.junit.Test)

Aggregations

Variable (com.opensimulationplatform.core.model.modeldescription.Variable)17 VariableType (com.opensimulationplatform.modeldescription.xml.model.VariableType)17 Unit (com.opensimulationplatform.core.model.modeldescription.Unit)1 AngularDisplacement (com.opensimulationplatform.core.model.modeldescription.variablegroup.angulardisplacement.AngularDisplacement)1 AngularVelocity (com.opensimulationplatform.core.model.modeldescription.variablegroup.angularvelocity.AngularVelocity)1 Charge (com.opensimulationplatform.core.model.modeldescription.variablegroup.charge.Charge)1 Current (com.opensimulationplatform.core.model.modeldescription.variablegroup.current.Current)1 Force (com.opensimulationplatform.core.model.modeldescription.variablegroup.force.Force)1 LinearDisplacement (com.opensimulationplatform.core.model.modeldescription.variablegroup.lineardisplacement.LinearDisplacement)1 LinearVelocity (com.opensimulationplatform.core.model.modeldescription.variablegroup.linearvelocity.LinearVelocity)1 NmeaGgaFix (com.opensimulationplatform.core.model.modeldescription.variablegroup.nmeaggafix.NmeaGgaFix)1 NmeaGgaLatitudeLongitude (com.opensimulationplatform.core.model.modeldescription.variablegroup.nmeaggalatitudelongitude.NmeaGgaLatitudeLongitude)1 NmeaGstEllipse (com.opensimulationplatform.core.model.modeldescription.variablegroup.nmeagstellipse.NmeaGstEllipse)1 NmeaGstPositionError (com.opensimulationplatform.core.model.modeldescription.variablegroup.nmeagstpositionerror.NmeaGstPositionError)1 Pressure (com.opensimulationplatform.core.model.modeldescription.variablegroup.pressure.Pressure)1 Torque (com.opensimulationplatform.core.model.modeldescription.variablegroup.torque.Torque)1 Voltage (com.opensimulationplatform.core.model.modeldescription.variablegroup.voltage.Voltage)1 Volume (com.opensimulationplatform.core.model.modeldescription.variablegroup.volume.Volume)1 VolumeFlowRate (com.opensimulationplatform.core.model.modeldescription.variablegroup.volumeflowrate.VolumeFlowRate)1 ConverterContext (com.opensimulationplatform.modeldescription.xml.converter.ConverterContext)1