only:random code reuse
This commit is contained in:
parent
3a38f1ebdd
commit
27bc7ea56c
|
@ -3,6 +3,9 @@ package com.rusefi;
|
|||
import com.rusefi.core.Pair;
|
||||
import com.rusefi.output.ConfigStructure;
|
||||
|
||||
import static com.rusefi.output.ConfigStructureImpl.ALIGNMENT_FILL_AT;
|
||||
import static com.rusefi.output.DataLogConsumer.UNUSED;
|
||||
|
||||
public interface ConfigField {
|
||||
ConfigField VOID = new ConfigField() {
|
||||
@Override
|
||||
|
@ -155,6 +158,10 @@ public interface ConfigField {
|
|||
}
|
||||
};
|
||||
|
||||
default boolean isUnusedField() {
|
||||
return getName().contains(UNUSED) || getName().contains(ALIGNMENT_FILL_AT);
|
||||
}
|
||||
|
||||
default String getOriginalArrayName() {
|
||||
if (isFromIterate()) {
|
||||
return getIterateOriginalName() + "[" + (getIterateIndex() - 1) + "]";
|
||||
|
|
|
@ -31,7 +31,7 @@ public class FragmentDialogConsumer implements ConfigurationConsumer {
|
|||
int writeOneField(FieldIterator iterator, String prefix, int tsPosition) {
|
||||
ConfigField configField = iterator.cf;
|
||||
|
||||
if (configField.getName().startsWith(ConfigStructureImpl.ALIGNMENT_FILL_AT))
|
||||
if (configField.isUnusedField())
|
||||
return 0;
|
||||
|
||||
ConfigStructure cs = configField.getStructureType();
|
||||
|
@ -40,9 +40,6 @@ public class FragmentDialogConsumer implements ConfigurationConsumer {
|
|||
return writeFields(cs.getTsFields(), prefix + extraPrefix, tsPosition);
|
||||
}
|
||||
|
||||
if (configField.getName().startsWith(ConfigStructureImpl.UNUSED_BIT_PREFIX))
|
||||
return 0;
|
||||
|
||||
if (configField.isBit()) {
|
||||
if (!hasIndicators) {
|
||||
hasIndicators = true;
|
||||
|
|
|
@ -92,7 +92,7 @@ public class GetConfigValueConsumer implements ConfigurationConsumer {
|
|||
}
|
||||
|
||||
private String processConfig(ConfigField cf, String prefix) {
|
||||
if (cf.getName().contains(UNUSED) || cf.getName().contains(ALIGNMENT_FILL_AT))
|
||||
if (cf.isUnusedField())
|
||||
return "";
|
||||
|
||||
if (cf.isArray() || cf.isFromIterate() || cf.isDirective())
|
||||
|
|
|
@ -13,8 +13,6 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static com.rusefi.output.ConfigStructureImpl.ALIGNMENT_FILL_AT;
|
||||
import static com.rusefi.output.DataLogConsumer.UNUSED;
|
||||
import static com.rusefi.output.GetConfigValueConsumer.getCompareName;
|
||||
|
||||
/**
|
||||
|
@ -49,7 +47,7 @@ public class GetOutputValueConsumer implements ConfigurationConsumer {
|
|||
}
|
||||
|
||||
private String processOutput(ConfigField cf, String prefix) {
|
||||
if (cf.getName().contains(UNUSED) || cf.getName().contains(ALIGNMENT_FILL_AT))
|
||||
if (cf.isUnusedField())
|
||||
return "";
|
||||
|
||||
if (cf.isArray() || cf.isFromIterate() || cf.isDirective())
|
||||
|
|
|
@ -54,9 +54,7 @@ public class SdCardFieldsContent {
|
|||
}
|
||||
|
||||
private String processOutput(ConfigField configField, String prefix) {
|
||||
if (configField.getName().startsWith(ConfigStructureImpl.ALIGNMENT_FILL_AT))
|
||||
return "";
|
||||
if (configField.getName().startsWith(ConfigStructure.UNUSED_ANYTHING_PREFIX))
|
||||
if (configField.isUnusedField())
|
||||
return "";
|
||||
if (configField.isBit())
|
||||
return "";
|
||||
|
|
|
@ -55,11 +55,11 @@ public class TsOutput {
|
|||
*/
|
||||
if (!usedNames.add(nameWithPrefix)
|
||||
&& !isConstantsSection
|
||||
&& !configField.getName().startsWith(ConfigStructureImpl.ALIGNMENT_FILL_AT)
|
||||
&& !configField.getName().startsWith(ConfigStructure.UNUSED_ANYTHING_PREFIX)) {
|
||||
&& !configField.isUnusedField()) {
|
||||
throw new IllegalStateException(nameWithPrefix + " already present: " + configField);
|
||||
}
|
||||
|
||||
// note that we need to handle account for unused bits size below!
|
||||
if (configField.getName().startsWith(ConfigStructureImpl.ALIGNMENT_FILL_AT)) {
|
||||
tsPosition += configField.getSize(next);
|
||||
return tsPosition;
|
||||
|
|
Loading…
Reference in New Issue