Compare commits
No commits in common. "b08dd8cf72e61d861117dd421461067f984f8fa1" and "3e2f3fd5ebc848e1e619648ee222b95e5b11d441" have entirely different histories.
b08dd8cf72
...
3e2f3fd5eb
|
@ -1,6 +1,6 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
|
|
@ -11,14 +11,14 @@ public class ByteRateOfChangeReports {
|
|||
/**
|
||||
* sweet baby O(n^2)
|
||||
*/
|
||||
public static void compareEachReportAgainstAllOthers(String reportDestinationFolder, List<ByteRateOfChange.TraceReport> reports, CanMetaDataContext context) throws FileNotFoundException {
|
||||
public static void compareEachReportAgainstAllOthers(String reportDestinationFolder, List<ByteRateOfChange.TraceReport> reports, CanContext context) throws FileNotFoundException {
|
||||
for (int i = 0; i < reports.size(); i++) {
|
||||
for (int j = i + 1; j < reports.size(); j++)
|
||||
compareTwoReports(reportDestinationFolder, reports.get(i), reports.get(j), context);
|
||||
}
|
||||
}
|
||||
|
||||
private static void compareTwoReports(String reportDestinationFolder, ByteRateOfChange.TraceReport traceReport1, ByteRateOfChange.TraceReport traceReport2, CanMetaDataContext context) throws FileNotFoundException {
|
||||
private static void compareTwoReports(String reportDestinationFolder, ByteRateOfChange.TraceReport traceReport1, ByteRateOfChange.TraceReport traceReport2, CanContext context) throws FileNotFoundException {
|
||||
Set<ByteRateOfChange.ByteId> allKeys = new TreeSet<>();
|
||||
allKeys.addAll(traceReport1.getStatistics().keySet());
|
||||
allKeys.addAll(traceReport2.getStatistics().keySet());
|
||||
|
@ -92,7 +92,7 @@ public class ByteRateOfChangeReports {
|
|||
public static void scanInputFolder(String inputFolderName, String fileNameSuffix) throws IOException {
|
||||
String reportDestinationFolder = createOutputFolder(inputFolderName);
|
||||
|
||||
CanMetaDataContext context = CanMetaDataContext.read(inputFolderName);
|
||||
CanContext context = CanContext.read(inputFolderName);
|
||||
|
||||
List<ByteRateOfChange.TraceReport> reports = new ArrayList<>();
|
||||
|
||||
|
|
|
@ -7,13 +7,13 @@ import java.io.FileNotFoundException;
|
|||
import java.io.FileReader;
|
||||
import java.util.*;
|
||||
|
||||
public class CanMetaDataContext {
|
||||
public class CanContext {
|
||||
final Set<Integer> withChecksum = new HashSet<>();
|
||||
final Map<Integer, Map<Integer, Integer>> countersMap;
|
||||
|
||||
Set<ByteRateOfChange.ByteId> counterBytes = new HashSet<>();
|
||||
|
||||
private CanMetaDataContext(List<Integer> withChecksum, Map<Integer, Map<Integer, Integer>> countersMap) {
|
||||
private CanContext(List<Integer> withChecksum, Map<Integer, Map<Integer, Integer>> countersMap) {
|
||||
this.countersMap = countersMap;
|
||||
this.withChecksum.addAll(withChecksum);
|
||||
|
||||
|
@ -33,17 +33,17 @@ public class CanMetaDataContext {
|
|||
}
|
||||
}
|
||||
|
||||
public static CanMetaDataContext read(String inputFolderName) throws FileNotFoundException {
|
||||
public static CanContext read(String inputFolderName) throws FileNotFoundException {
|
||||
Yaml checksum = new Yaml();
|
||||
String checkSumFileName = inputFolderName + File.separator + ChecksumScanner.CHECKSUM_YAML;
|
||||
if (!new File(checkSumFileName).exists())
|
||||
return new CanMetaDataContext(new ArrayList<>(), new HashMap<>());
|
||||
return new CanContext(new ArrayList<>(), new HashMap<>());
|
||||
|
||||
List<Integer> withChecksum = checksum.load(new FileReader(checkSumFileName));
|
||||
|
||||
Yaml countersYaml = new Yaml();
|
||||
Map<Integer, Map<Integer, Integer>> countersMap = countersYaml.load(new FileReader(inputFolderName + File.separator + CounterScanner.COUNTERS_YAML));
|
||||
|
||||
return new CanMetaDataContext(withChecksum, countersMap);
|
||||
return new CanContext(withChecksum, countersMap);
|
||||
}
|
||||
}
|
|
@ -41,11 +41,7 @@ public interface CANLineReader {
|
|||
return readLine(line, "no-file-name");
|
||||
}
|
||||
|
||||
default CANPacket readLine(String line, String fileName) {
|
||||
return readLine(line, fileName, -1);
|
||||
}
|
||||
|
||||
CANPacket readLine(String line, String fileName, int lineIndex);
|
||||
CANPacket readLine(String line, String fileName);
|
||||
|
||||
default List<CANPacket> readFile(String fileName) throws IOException {
|
||||
return skipHeaderAndRead(fileName, 0);
|
||||
|
@ -61,7 +57,7 @@ public interface CANLineReader {
|
|||
public void accept(String s) {
|
||||
if (index++ < skipCount)
|
||||
return;
|
||||
CANPacket packet = readLine(s, fileName, index);
|
||||
CANPacket packet = readLine(s, fileName);
|
||||
if (packet != null)
|
||||
result.add(packet);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ public enum CANoeReader implements CANLineReader {
|
|||
INSTANCE;
|
||||
|
||||
@Override
|
||||
public CANPacket readLine(String line, String fileName, int lineIndex) {
|
||||
public CANPacket readLine(String line, String fileName) {
|
||||
if (line.contains("ErrorFrame"))
|
||||
return null;
|
||||
String[] tokens = line.trim().split("\\s+");
|
||||
|
|
|
@ -18,7 +18,7 @@ public enum CanHackerReader implements CANLineReader {
|
|||
INSTANCE;
|
||||
|
||||
@Override
|
||||
public CANPacket readLine(String line, String fileName, int lineIndex) {
|
||||
public CANPacket readLine(String line, String fileName) {
|
||||
line = line.trim();
|
||||
if (line.startsWith("@"))
|
||||
return null;
|
||||
|
|
|
@ -19,8 +19,8 @@ public class PcanAutoReader implements CANLineReader {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CANPacket readLine(String line, String fileName, int lineIndex) {
|
||||
return delegate.readLine(line, fileName, lineIndex);
|
||||
public CANPacket readLine(String line, String fileName) {
|
||||
return delegate.readLine(line, fileName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -13,15 +13,13 @@ public class PcanTrcReader1_1 implements CANLineReader {
|
|||
public static final CANLineReader INSTANCE = new PcanTrcReader1_1();
|
||||
|
||||
@Override
|
||||
public CANPacket readLine(String line, String fileName, int lineIndex) {
|
||||
public CANPacket readLine(String line, String fileName) {
|
||||
line = line.trim();
|
||||
if (line.startsWith(FILEVERSION) && !line.startsWith(FILEVERSION + "=1.1"))
|
||||
throw new IllegalStateException("Unexpected fileversion " + line);
|
||||
if (line.startsWith(";"))
|
||||
return null;
|
||||
String[] tokens = line.split("\\s+");
|
||||
if (tokens.length < 2)
|
||||
throw new IllegalStateException("Unexpected token count in " + fileName + "@" + lineIndex + ": [" + line + "]");
|
||||
double timeStamp = Double.parseDouble(tokens[1]);
|
||||
|
||||
int sid = Integer.parseInt(tokens[3], 16);
|
||||
|
|
|
@ -13,7 +13,7 @@ public enum PcanTrcReader2_0 implements CANLineReader {
|
|||
public static final String FILEVERSION = ";$FILEVERSION";
|
||||
|
||||
@Override
|
||||
public CANPacket readLine(String line, String fileName, int lineIndex) {
|
||||
public CANPacket readLine(String line, String fileName) {
|
||||
line = line.trim();
|
||||
if (line.startsWith(FILEVERSION) && !line.startsWith(FILEVERSION + "=2.0"))
|
||||
throw new IllegalStateException("Unexpected fileversion " + line + " in " + fileName);
|
||||
|
|
Loading…
Reference in New Issue