diff --git a/src/main/java/de/richardliebscher/mdf4/extract/impl/RecordReaderFactory.java b/src/main/java/de/richardliebscher/mdf4/extract/impl/RecordReaderFactory.java index cff2d1d..f8431a4 100644 --- a/src/main/java/de/richardliebscher/mdf4/extract/impl/RecordReaderFactory.java +++ b/src/main/java/de/richardliebscher/mdf4/extract/impl/RecordReaderFactory.java @@ -122,15 +122,16 @@ private static ValueReadFactory createChannelReaderFactory( .resolve(ChannelConversionBlock.TYPE, input); if (channelConversion.isPresent()) { final var cc = channelConversion.get(); + final var vals = cc.getVals(); switch (cc.getType()) { case IDENTITY: converted = rawValue; break; case LINEAR: - converted = (in, scope) -> new LinearConversion(cc, rawValue.build(in, scope)); + converted = (in, scope) -> new LinearConversion(vals, rawValue.build(in, scope)); break; case RATIONAL: - converted = (in, scope) -> new RationalConversion(cc, rawValue.build(in, scope)); + converted = (in, scope) -> new RationalConversion(vals, rawValue.build(in, scope)); break; case ALGEBRAIC: case INTERPOLATED_VALUE_TABLE: @@ -1055,7 +1056,7 @@ private static Pair>, List> buildExtract dataGroupBlock, channelGroupBlock, ch.getBlock(), input); channels.add(ch); channelReaders.add((in, scope) -> - new ReadIntoImpl<>(deserializeInto, channelReaderFactory.build(input, scope))); + new ReadIntoImpl<>(deserializeInto, channelReaderFactory.build(in, scope))); } } catch (NotImplementedFeatureException exception) { log.warning("Ignoring channel '" + ch.getName() + "': " + exception.getMessage()); diff --git a/src/main/java/de/richardliebscher/mdf4/extract/read/LinearConversion.java b/src/main/java/de/richardliebscher/mdf4/extract/read/LinearConversion.java index e739940..f272bc2 100644 --- a/src/main/java/de/richardliebscher/mdf4/extract/read/LinearConversion.java +++ b/src/main/java/de/richardliebscher/mdf4/extract/read/LinearConversion.java @@ -5,7 +5,6 @@ package de.richardliebscher.mdf4.extract.read; -import de.richardliebscher.mdf4.blocks.ChannelConversionBlock; import de.richardliebscher.mdf4.extract.de.UnsignedLong; import de.richardliebscher.mdf4.extract.de.Visitor; import java.io.IOException; @@ -16,9 +15,9 @@ public class LinearConversion implements ValueRead { private final double p2; private final ValueRead inner; - public LinearConversion(ChannelConversionBlock cc, ValueRead valueRead) { - this.p1 = Double.longBitsToDouble(cc.getVals()[0]); - this.p2 = Double.longBitsToDouble(cc.getVals()[1]); + public LinearConversion(long[] ccVals, ValueRead valueRead) { + this.p1 = Double.longBitsToDouble(ccVals[0]); + this.p2 = Double.longBitsToDouble(ccVals[1]); this.inner = valueRead; } diff --git a/src/main/java/de/richardliebscher/mdf4/extract/read/RationalConversion.java b/src/main/java/de/richardliebscher/mdf4/extract/read/RationalConversion.java index 7493674..b166602 100644 --- a/src/main/java/de/richardliebscher/mdf4/extract/read/RationalConversion.java +++ b/src/main/java/de/richardliebscher/mdf4/extract/read/RationalConversion.java @@ -5,7 +5,6 @@ package de.richardliebscher.mdf4.extract.read; -import de.richardliebscher.mdf4.blocks.ChannelConversionBlock; import de.richardliebscher.mdf4.extract.de.UnsignedLong; import de.richardliebscher.mdf4.extract.de.Visitor; import java.io.IOException; @@ -20,8 +19,7 @@ public class RationalConversion implements ValueRead { private final double p6; private final ValueRead inner; - public RationalConversion(ChannelConversionBlock cc, ValueRead valueRead) { - final var vals = cc.getVals(); + public RationalConversion(long[] vals, ValueRead valueRead) { this.p1 = Double.longBitsToDouble(vals[0]); this.p2 = Double.longBitsToDouble(vals[1]); this.p3 = Double.longBitsToDouble(vals[2]);