refactoring
This commit is contained in:
parent
a5e80d05ba
commit
256738680f
|
@ -0,0 +1,14 @@
|
|||
package com.rusefi.output;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public abstract class AbstractConfigurationConsumer implements ConfigurationConsumer {
|
||||
|
||||
@Override
|
||||
public void startFile() throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endFile() throws IOException {
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ import com.rusefi.*;
|
|||
|
||||
import static com.rusefi.ToolUtil.EOL;
|
||||
|
||||
public abstract class BaseCHeaderConsumer implements ConfigurationConsumer {
|
||||
public abstract class BaseCHeaderConsumer extends AbstractConfigurationConsumer {
|
||||
private static final String BOOLEAN_TYPE = "bool";
|
||||
private final StringBuilder content = new StringBuilder();
|
||||
|
||||
|
@ -63,8 +63,4 @@ public abstract class BaseCHeaderConsumer implements ConfigurationConsumer {
|
|||
public StringBuilder getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startFile() {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import java.util.TreeSet;
|
|||
import static com.rusefi.ConfigField.unquote;
|
||||
import static org.abego.treelayout.internal.util.java.lang.string.StringUtil.quote;
|
||||
|
||||
public class DataLogConsumer implements ConfigurationConsumer {
|
||||
public class DataLogConsumer extends AbstractConfigurationConsumer {
|
||||
private final String fileName;
|
||||
private final ReaderState state;
|
||||
private final CharArrayWriter tsWriter = new CharArrayWriter();
|
||||
|
@ -25,18 +25,6 @@ public class DataLogConsumer implements ConfigurationConsumer {
|
|||
this.state = state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startFile() throws IOException {
|
||||
System.out.println("startFile");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endFile() throws IOException {
|
||||
System.out.println("endFile");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleEndStruct(ConfigStructure structure) throws IOException {
|
||||
if (state.stack.isEmpty()) {
|
||||
|
|
|
@ -10,7 +10,7 @@ import java.io.IOException;
|
|||
import static com.rusefi.output.DataLogConsumer.getComment;
|
||||
import static org.abego.treelayout.internal.util.java.lang.string.StringUtil.quote;
|
||||
|
||||
public class GaugeConsumer implements ConfigurationConsumer {
|
||||
public class GaugeConsumer extends AbstractConfigurationConsumer {
|
||||
private final String fileName;
|
||||
private final ReaderState state;
|
||||
private final CharArrayWriter charArrayWriter = new CharArrayWriter();
|
||||
|
@ -20,18 +20,6 @@ public class GaugeConsumer implements ConfigurationConsumer {
|
|||
this.state = state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startFile() throws IOException {
|
||||
System.out.println("startFile");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endFile() throws IOException {
|
||||
System.out.println("endFile");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleEndStruct(ConfigStructure structure) throws IOException {
|
||||
if (state.stack.isEmpty()) {
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.rusefi.ReaderState;
|
|||
|
||||
import java.io.*;
|
||||
|
||||
public class OutputsSectionConsumer implements ConfigurationConsumer {
|
||||
public class OutputsSectionConsumer extends AbstractConfigurationConsumer {
|
||||
private final String tsOutputsSectionFileName;
|
||||
private final TsOutput tsOutput;
|
||||
private final ReaderState state;
|
||||
|
@ -16,18 +16,10 @@ public class OutputsSectionConsumer implements ConfigurationConsumer {
|
|||
this.state = state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startFile() throws IOException {
|
||||
}
|
||||
|
||||
public CharArrayWriter getTsWriter() {
|
||||
return tsWriter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endFile() throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleEndStruct(ConfigStructure structure) throws IOException {
|
||||
System.out.println("handleEndStruct");
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.io.IOException;
|
|||
/**
|
||||
* Configuration consumer which writes Signature header file
|
||||
*/
|
||||
public class SignatureConsumer implements ConfigurationConsumer {
|
||||
public class SignatureConsumer extends AbstractConfigurationConsumer {
|
||||
private final String destHeader;
|
||||
VariableRegistry registry;
|
||||
|
||||
|
@ -18,16 +18,8 @@ public class SignatureConsumer implements ConfigurationConsumer {
|
|||
this.registry = vregistry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startFile() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleEndStruct(ConfigStructure structure) throws IOException {
|
||||
ConfigDefinition.writeDefinesToFile(registry, destHeader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endFile() throws IOException {
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue