Merge branch 'release/2.16.1'
This commit is contained in:
commit
3a931d59d5
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
|
|
@ -78,24 +78,24 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
|||
return streams;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canLoad(File inputFile) {
|
||||
if (!inputFile.isDirectory() && inputFile.exists()) {
|
||||
try(InputStream stream = new FileInputStream(inputFile)){
|
||||
byte[] buffer = new byte[x.length];
|
||||
int readCnt = stream.read(buffer, 0, x.length);
|
||||
if (readCnt == x.length) {
|
||||
for (int i = 0; i < x.length; i++)
|
||||
if (buffer[i] != x[i])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// @Override
|
||||
// public boolean canLoad(File inputFile) {
|
||||
// if (!inputFile.isDirectory() && inputFile.exists()) {
|
||||
// try(InputStream stream = new FileInputStream(inputFile)){
|
||||
// byte[] buffer = new byte[x.length];
|
||||
// int readCnt = stream.read(buffer, 0, x.length);
|
||||
// if (readCnt == x.length) {
|
||||
// for (int i = 0; i < x.length; i++)
|
||||
// if (buffer[i] != x[i])
|
||||
// return false;
|
||||
// }
|
||||
// return true;
|
||||
// } catch (Exception e) {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void load(IWaveformDb db, File file) throws InputFormatException {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
|
|
@ -185,46 +185,25 @@ public class TextDbLoader implements IWaveformDbLoader {
|
|||
return relationTypes.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* Can load.
|
||||
*
|
||||
* @param inputFile the input file
|
||||
* @return true, if successful
|
||||
*/
|
||||
@Override
|
||||
public boolean canLoad(File inputFile) {
|
||||
if (!inputFile.isDirectory() && inputFile.exists()) {
|
||||
FileType fType = getFileType(inputFile);
|
||||
try(InputStream stream = fType==FileType.GZIP ? new GZIPInputStream(new FileInputStream(inputFile)) :
|
||||
fType==FileType.LZ4? new FramedLZ4CompressorInputStream(new FileInputStream(inputFile)) : new FileInputStream(inputFile)){
|
||||
byte[] buffer = new byte[x.length];
|
||||
int readCnt = stream.read(buffer, 0, x.length);
|
||||
if (readCnt == x.length) {
|
||||
for (int i = 0; i < x.length; i++)
|
||||
if (buffer[i] != x[i])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is gzipped.
|
||||
*
|
||||
* @param f the f
|
||||
* @return true, if is gzipped
|
||||
*/
|
||||
private static FileType getFileType(File f) {
|
||||
static FileType getFileType(File f) {
|
||||
try (InputStream is = new FileInputStream(f)) {
|
||||
byte[] signature = new byte[4];
|
||||
int nread = is.read(signature); // read the gzip signature
|
||||
if(nread > 2 && signature[0] == (byte) 0x1f && signature[1] == (byte) 0x8b)
|
||||
if(nread >= 2 &&
|
||||
signature[0] == (byte) 0x1f &&
|
||||
signature[1] == (byte) 0x8b)
|
||||
return FileType.GZIP;
|
||||
else if(nread>4 && signature[0] == (byte) 0x04 && signature[1] == (byte) 0x22 && signature[2] == (byte) 0x4d && signature[3] == (byte) 0x18)
|
||||
else if(nread>=4 &&
|
||||
signature[0] == (byte) 0x04 &&
|
||||
signature[1] == (byte) 0x22 &&
|
||||
signature[2] == (byte) 0x4d &&
|
||||
signature[3] == (byte) 0x18)
|
||||
return FileType.LZ4;
|
||||
else
|
||||
return FileType.PLAIN;
|
||||
|
@ -268,10 +247,11 @@ public class TextDbLoader implements IWaveformDbLoader {
|
|||
parser.txSink = mapDb.hashMap("transactions", Serializer.LONG, Serializer.JAVA).create();
|
||||
InputStream is = new BufferedInputStream(new FileInputStream(file));
|
||||
parser.parseInput(fType==FileType.GZIP ? new GZIPInputStream(is) : fType==FileType.LZ4? new FramedLZ4CompressorInputStream(is) : is);
|
||||
transactions = parser.txSink;
|
||||
} catch (IllegalArgumentException | ArrayIndexOutOfBoundsException e) {
|
||||
} catch (Exception e) {
|
||||
throw new InputFormatException(e.toString());
|
||||
} finally {
|
||||
transactions = parser.txSink;
|
||||
}
|
||||
txStreams.values().parallelStream().forEach(TxStream::calculateConcurrency);
|
||||
}
|
||||
|
@ -351,20 +331,22 @@ public class TextDbLoader implements IWaveformDbLoader {
|
|||
* @throws IOException Signals that an I/O exception has occurred.
|
||||
* @throws InputFormatException Signals that the input format is wrong
|
||||
*/
|
||||
void parseInput(InputStream inputStream) throws IOException, InputFormatException {
|
||||
reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
|
||||
String curLine = reader.readLine();
|
||||
String nextLine = null;
|
||||
while ((nextLine = reader.readLine()) != null && curLine != null) {
|
||||
curLine = parseLine(curLine, nextLine, false);
|
||||
}
|
||||
if (curLine != null)
|
||||
parseLine(curLine, nextLine, true);
|
||||
for(Entry<Long, ScvTx> e: transactionById.entrySet()) {
|
||||
ScvTx scvTx = e.getValue();
|
||||
scvTx.endTime=loader.maxTime;
|
||||
txSink.put(e.getKey(), scvTx);
|
||||
}
|
||||
void parseInput(InputStream inputStream) throws InputFormatException {
|
||||
try {
|
||||
reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
|
||||
String curLine = reader.readLine();
|
||||
String nextLine = null;
|
||||
while ((nextLine = reader.readLine()) != null && curLine != null) {
|
||||
curLine = parseLine(curLine, nextLine, false);
|
||||
}
|
||||
if (curLine != null)
|
||||
parseLine(curLine, nextLine, true);
|
||||
for(Entry<Long, ScvTx> e: transactionById.entrySet()) {
|
||||
ScvTx scvTx = e.getValue();
|
||||
scvTx.endTime=loader.maxTime;
|
||||
txSink.put(e.getKey(), scvTx);
|
||||
}
|
||||
} catch(IOException e) {}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -397,80 +379,86 @@ public class TextDbLoader implements IWaveformDbLoader {
|
|||
* @throws InputFormatException Signals that the input format is wrong
|
||||
*/
|
||||
private String parseLine(String curLine, String nextLine, boolean last) throws IOException, InputFormatException {
|
||||
String[] tokens = curLine.split("\\s+");
|
||||
if ("tx_record_attribute".equals(tokens[0]) && tokens.length>4) {
|
||||
Long id = Long.parseLong(tokens[1]);
|
||||
String name = tokens[2].substring(1, tokens[2].length()-1);
|
||||
DataType type = DataType.valueOf(tokens[3]);
|
||||
String remaining = tokens.length > 5 ? String.join(" ", Arrays.copyOfRange(tokens, 5, tokens.length)) : "";
|
||||
TxAttributeType attrType = getAttrType(name, type, AssociationType.RECORD);
|
||||
transactionById.get(id).attributes.add(new TxAttribute(attrType, getAttrString(attrType, remaining)));
|
||||
} else if ("tx_begin".equals(tokens[0]) && tokens.length>4) {
|
||||
Long id = Long.parseLong(tokens[1]);
|
||||
Long genId = Long.parseLong(tokens[2]);
|
||||
TxGenerator gen = loader.txGenerators.get(genId);
|
||||
ScvTx scvTx = new ScvTx(id, gen.stream.getId(), genId,
|
||||
Long.parseLong(tokens[3]) * stringToScale(tokens[4]));
|
||||
loader.maxTime = loader.maxTime > scvTx.beginTime ? loader.maxTime : scvTx.beginTime;
|
||||
if (nextLine != null && nextLine.charAt(0) == 'a') {
|
||||
int idx = 0;
|
||||
while (nextLine != null && nextLine.charAt(0) == 'a') {
|
||||
String[] attrTokens = nextLine.split("\\s+");
|
||||
TxAttributeType attrType = gen.beginAttrs.get(idx);
|
||||
TxAttribute attr = new TxAttribute(attrType, getAttrString(attrType, attrTokens[1]));
|
||||
scvTx.attributes.add(attr);
|
||||
idx++;
|
||||
nextLine = reader.readLine();
|
||||
if(curLine.charAt(0)=='t') {
|
||||
String[] tokens = curLine.split(" ");
|
||||
//if ("tx_record_attribute".equals(tokens[0]) && tokens.length>4) {
|
||||
if (curLine.charAt(5)=='c' && tokens.length>4) {
|
||||
Long id = Long.parseLong(tokens[1]);
|
||||
String name = tokens[2].substring(1, tokens[2].length()-1);
|
||||
DataType type = DataType.valueOf(tokens[3]);
|
||||
String remaining = tokens.length > 5 ? String.join(" ", Arrays.copyOfRange(tokens, 5, tokens.length)) : "";
|
||||
TxAttributeType attrType = getAttrType(name, type, AssociationType.RECORD);
|
||||
transactionById.get(id).attributes.add(new TxAttribute(attrType, getAttrString(attrType, remaining)));
|
||||
//} else if ("tx_begin".equals(tokens[0]) && tokens.length>4) {
|
||||
} else if (curLine.charAt(3)=='b' && tokens.length>4) {
|
||||
Long id = Long.parseLong(tokens[1]);
|
||||
Long genId = Long.parseLong(tokens[2]);
|
||||
TxGenerator gen = loader.txGenerators.get(genId);
|
||||
ScvTx scvTx = new ScvTx(id, gen.stream.getId(), genId,
|
||||
Long.parseLong(tokens[3]) * stringToScale(tokens[4]));
|
||||
loader.maxTime = loader.maxTime > scvTx.beginTime ? loader.maxTime : scvTx.beginTime;
|
||||
if (nextLine != null && nextLine.charAt(0) == 'a') {
|
||||
int idx = 0;
|
||||
while (nextLine != null && nextLine.charAt(0) == 'a') {
|
||||
String[] attrTokens = nextLine.split("\\s+");
|
||||
TxAttributeType attrType = gen.beginAttrs.get(idx);
|
||||
TxAttribute attr = new TxAttribute(attrType, getAttrString(attrType, attrTokens[1]));
|
||||
scvTx.attributes.add(attr);
|
||||
idx++;
|
||||
nextLine = reader.readLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
transactionById.put(id, scvTx);
|
||||
} else if ("tx_end".equals(tokens[0]) && tokens.length>4) {
|
||||
Long id = Long.parseLong(tokens[1]);
|
||||
ScvTx scvTx = transactionById.get(id);
|
||||
assert Long.parseLong(tokens[2]) == scvTx.generatorId;
|
||||
scvTx.endTime = Long.parseLong(tokens[3]) * stringToScale(tokens[4]);
|
||||
loader.maxTime = loader.maxTime > scvTx.endTime ? loader.maxTime : scvTx.endTime;
|
||||
TxGenerator gen = loader.txGenerators.get(scvTx.generatorId);
|
||||
TxStream stream = loader.txStreams.get(gen.stream.getId());
|
||||
if (scvTx.beginTime == scvTx.endTime) {
|
||||
stream.addEvent(new TxEvent(loader, EventKind.SINGLE, id, scvTx.beginTime));
|
||||
gen.addEvent(new TxEvent(loader, EventKind.SINGLE, id, scvTx.beginTime));
|
||||
} else {
|
||||
stream.addEvent(new TxEvent(loader, EventKind.BEGIN, id, scvTx.beginTime));
|
||||
gen.addEvent(new TxEvent(loader, EventKind.BEGIN, id, scvTx.beginTime));
|
||||
stream.addEvent(new TxEvent(loader, EventKind.END, id, scvTx.endTime));
|
||||
gen.addEvent(new TxEvent(loader, EventKind.END, id, scvTx.endTime));
|
||||
}
|
||||
if (nextLine != null && nextLine.charAt(0) == 'a') {
|
||||
int idx = 0;
|
||||
while (nextLine != null && nextLine.charAt(0) == 'a') {
|
||||
String[] attrTokens = nextLine.split("\\s+");
|
||||
TxAttributeType attrType = gen.endAttrs.get(idx);
|
||||
TxAttribute attr = new TxAttribute(attrType, getAttrString(attrType, attrTokens[1]));
|
||||
scvTx.attributes.add(attr);
|
||||
idx++;
|
||||
nextLine = reader.readLine();
|
||||
transactionById.put(id, scvTx);
|
||||
//} else if ("tx_end".equals(tokens[0]) && tokens.length>4) {
|
||||
} else if (curLine.charAt(3)=='e' && tokens.length>4) {
|
||||
Long id = Long.parseLong(tokens[1]);
|
||||
ScvTx scvTx = transactionById.get(id);
|
||||
assert Long.parseLong(tokens[2]) == scvTx.generatorId;
|
||||
scvTx.endTime = Long.parseLong(tokens[3]) * stringToScale(tokens[4]);
|
||||
loader.maxTime = loader.maxTime > scvTx.endTime ? loader.maxTime : scvTx.endTime;
|
||||
TxGenerator gen = loader.txGenerators.get(scvTx.generatorId);
|
||||
TxStream stream = loader.txStreams.get(gen.stream.getId());
|
||||
if (scvTx.beginTime == scvTx.endTime) {
|
||||
stream.addEvent(new TxEvent(loader, EventKind.SINGLE, id, scvTx.beginTime));
|
||||
gen.addEvent(new TxEvent(loader, EventKind.SINGLE, id, scvTx.beginTime));
|
||||
} else {
|
||||
stream.addEvent(new TxEvent(loader, EventKind.BEGIN, id, scvTx.beginTime));
|
||||
gen.addEvent(new TxEvent(loader, EventKind.BEGIN, id, scvTx.beginTime));
|
||||
stream.addEvent(new TxEvent(loader, EventKind.END, id, scvTx.endTime));
|
||||
gen.addEvent(new TxEvent(loader, EventKind.END, id, scvTx.endTime));
|
||||
}
|
||||
if (nextLine != null && nextLine.charAt(0) == 'a') {
|
||||
int idx = 0;
|
||||
while (nextLine != null && nextLine.charAt(0) == 'a') {
|
||||
String[] attrTokens = nextLine.split("\\s+");
|
||||
TxAttributeType attrType = gen.endAttrs.get(idx);
|
||||
TxAttribute attr = new TxAttribute(attrType, getAttrString(attrType, attrTokens[1]));
|
||||
scvTx.attributes.add(attr);
|
||||
idx++;
|
||||
nextLine = reader.readLine();
|
||||
}
|
||||
}
|
||||
txSink.put(scvTx.getId(), scvTx);
|
||||
transactionById.remove(id);
|
||||
//} else if ("tx_relation".equals(tokens[0]) && tokens.length>3) {
|
||||
} else if (curLine.charAt(5)=='l' && tokens.length>3) {
|
||||
Long tr2 = Long.parseLong(tokens[2]);
|
||||
Long tr1 = Long.parseLong(tokens[3]);
|
||||
String relType = tokens[1].substring(1, tokens[1].length() - 1);
|
||||
if (!loader.relationTypes.containsKey(relType))
|
||||
loader.relationTypes.put(relType, RelationTypeFactory.create(relType));
|
||||
ScvRelation rel = new ScvRelation(loader.relationTypes.get(relType), tr1, tr2);
|
||||
loader.relationsOut.put(tr1, rel);
|
||||
loader.relationsIn.put(tr2, rel);
|
||||
}
|
||||
txSink.put(scvTx.getId(), scvTx);
|
||||
transactionById.remove(id);
|
||||
} else if ("tx_relation".equals(tokens[0]) && tokens.length>3) {
|
||||
Long tr2 = Long.parseLong(tokens[2]);
|
||||
Long tr1 = Long.parseLong(tokens[3]);
|
||||
String relType = tokens[1].substring(1, tokens[1].length() - 1);
|
||||
if (!loader.relationTypes.containsKey(relType))
|
||||
loader.relationTypes.put(relType, RelationTypeFactory.create(relType));
|
||||
ScvRelation rel = new ScvRelation(loader.relationTypes.get(relType), tr1, tr2);
|
||||
loader.relationsOut.put(tr1, rel);
|
||||
loader.relationsIn.put(tr2, rel);
|
||||
} else if ("scv_tr_stream".equals(tokens[0])) {
|
||||
} else if (curLine.length()>13 && "scv_tr_stream".equals(curLine.substring(0, 13))) {
|
||||
Matcher matcher = scv_tr_stream.matcher(curLine);
|
||||
if (matcher.matches()) {
|
||||
Long id = Long.parseLong(matcher.group(1));
|
||||
TxStream stream = new TxStream(loader, id, matcher.group(2), matcher.group(3));
|
||||
add(id, stream);
|
||||
}
|
||||
} else if ("scv_tr_generator".equals(tokens[0])) {
|
||||
} else if (curLine.length()>16 && "scv_tr_generator".equals(curLine.substring(0, 16))) {
|
||||
Matcher matcher = scv_tr_generator.matcher(curLine);
|
||||
if ((matcher.matches())) {
|
||||
Long id = Long.parseLong(matcher.group(1));
|
||||
|
@ -478,21 +466,21 @@ public class TextDbLoader implements IWaveformDbLoader {
|
|||
generator = new TxGenerator(loader, id, matcher.group(2), stream);
|
||||
add(id, generator);
|
||||
}
|
||||
} else if ("begin_attribute".equals(tokens[0])) {
|
||||
} else if (curLine.length()>15 && "begin_attribute".equals(curLine.substring(0, 15))) {
|
||||
Matcher matcher = begin_attribute.matcher(curLine);
|
||||
if ((matcher.matches())) {
|
||||
TxAttributeType attrType = getAttrType(matcher.group(2), DataType.valueOf(matcher.group(3)),
|
||||
AssociationType.BEGIN);
|
||||
generator.beginAttrs.add(attrType);
|
||||
}
|
||||
} else if ("end_attribute".equals(tokens[0])) {
|
||||
} else if (curLine.length()>13 && "end_attribute".equals(curLine.substring(0, 13))) {
|
||||
Matcher matcher = end_attribute.matcher(curLine);
|
||||
if ((matcher.matches())) {
|
||||
TxAttributeType attrType = getAttrType(matcher.group(2), DataType.valueOf(matcher.group(3)),
|
||||
AssociationType.END);
|
||||
generator.endAttrs.add(attrType);
|
||||
}
|
||||
} else if (")".equals(tokens[0])) {
|
||||
} else if (curLine.charAt(0) == ')') {
|
||||
generator = null;
|
||||
} else if(!last)
|
||||
throw new InputFormatException("Don't know what to do with: '" + curLine + "'");
|
||||
|
|
|
@ -11,14 +11,18 @@
|
|||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.text;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
import org.apache.commons.compress.compressors.lz4.FramedLZ4CompressorInputStream;
|
||||
|
||||
import com.minres.scviewer.database.IWaveformDbLoader;
|
||||
import com.minres.scviewer.database.IWaveformDbLoaderFactory;
|
||||
import com.minres.scviewer.database.text.TextDbLoader.FileType;
|
||||
|
||||
/**
|
||||
* The Class TextDbLoader.
|
||||
|
@ -52,21 +56,17 @@ public class TextDbLoaderFactory implements IWaveformDbLoaderFactory {
|
|||
*/
|
||||
@Override
|
||||
public boolean canLoad(File inputFile) {
|
||||
if (!inputFile.isDirectory() && inputFile.exists()) {
|
||||
boolean gzipped = isGzipped(inputFile);
|
||||
try(InputStream stream = gzipped ? new GZIPInputStream(new FileInputStream(inputFile)) : new FileInputStream(inputFile)){
|
||||
byte[] buffer = new byte[x.length];
|
||||
int readCnt = stream.read(buffer, 0, x.length);
|
||||
if (readCnt == x.length) {
|
||||
for (int i = 0; i < x.length; i++)
|
||||
if (buffer[i] != x[i])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
FileType fType = TextDbLoader.getFileType(inputFile);
|
||||
try (InputStream is = new FileInputStream(inputFile)) {
|
||||
InputStream plainIs = fType==FileType.GZIP ? new GZIPInputStream(is) : fType==FileType.LZ4? new FramedLZ4CompressorInputStream(is) : is;
|
||||
byte[] buffer = new byte[x.length];
|
||||
int readCnt = plainIs.read(buffer, 0, x.length);
|
||||
if (readCnt == x.length) {
|
||||
for (int i = 0; i < x.length; i++)
|
||||
if (buffer[i] != x[i]) return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} catch (IOException e) {}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<version>4.0.0-SNAPSHOT</version>
|
||||
|
|
|
@ -356,7 +356,7 @@ public class SignalPainter extends TrackPainter {
|
|||
public RealStencil(IEventList entries, Object left, boolean continous) {
|
||||
this.continous=continous;
|
||||
Collection<EventEntry> values = entries.entrySet();
|
||||
minVal=(Double) left;
|
||||
minVal=((DoubleVal) left).value;
|
||||
range=2.0;
|
||||
if(!values.isEmpty()) {
|
||||
double maxVal=minVal;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
|
|
@ -66,34 +66,6 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Can load.
|
||||
*
|
||||
* @param inputFile the input file
|
||||
* @return true, if successful
|
||||
*/
|
||||
@Override
|
||||
public boolean canLoad(File inputFile) {
|
||||
if(!inputFile.isDirectory() || inputFile.exists()) {
|
||||
String name = inputFile.getName();
|
||||
if(!(name.endsWith(".vcd") ||
|
||||
name.endsWith(".vcdz") ||
|
||||
name.endsWith(".vcdgz") ||
|
||||
name.endsWith(".vcd.gz")) )
|
||||
return false;
|
||||
boolean gzipped = isGzipped(inputFile);
|
||||
try(InputStream stream = gzipped ? new GZIPInputStream(new FileInputStream(inputFile)) : new FileInputStream(inputFile)){
|
||||
byte[] buffer = new byte[8];
|
||||
if (stream.read(buffer, 0, buffer.length) == buffer.length) {
|
||||
return buffer[0]=='$';
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.minres.scviewer.database.ITrDb#load(java.io.File)
|
||||
*/
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
|
|
@ -48,13 +48,6 @@ public interface IWaveformDbLoader {
|
|||
*/
|
||||
public void removePropertyChangeListener(PropertyChangeListener l) ;
|
||||
|
||||
/**
|
||||
* Can load the given file.
|
||||
*
|
||||
* @param inputFile the input file
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean canLoad(File inputFile);
|
||||
/**
|
||||
* Load.
|
||||
*
|
||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: SCViewer Help
|
||||
Bundle-SymbolicName: com.minres.scviewer.e4.application.help;singleton:=true
|
||||
Bundle-Version: 2.16.0
|
||||
Bundle-Version: 2.16.1
|
||||
Bundle-Vendor: MINRES Technologies GmbH
|
||||
Automatic-Module-Name: com.minres.scviewer.e4.application.help
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %Bundle-Name
|
||||
Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true
|
||||
Bundle-Version: 2.16.0
|
||||
Bundle-Version: 2.16.1
|
||||
Bundle-Vendor: %Bundle-Vendor
|
||||
Require-Bundle: javax.inject;bundle-version="1.0.0",
|
||||
org.eclipse.core.runtime;bundle-version="3.11.1",
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
|
4
pom.xml
4
pom.xml
|
@ -4,7 +4,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>releng/com.minres.scviewer.target</module>
|
||||
|
@ -69,7 +69,7 @@
|
|||
<artifact>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.target</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
</artifact>
|
||||
</target>
|
||||
<executionEnvironment>org.eclipse.justj.openjdk.hotspot.jre.minimal-15</executionEnvironment>
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<artifactId>com.minres.scviewer.e4.product</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<packaging>eclipse-repository</packaging>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<build>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?pde version="3.5"?>
|
||||
|
||||
<product name="SCViewer" uid="scviewer" id="com.minres.scviewer.e4.application.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="2.16.0" useFeatures="true" includeLaunchers="true">
|
||||
<product name="SCViewer" uid="scviewer" id="com.minres.scviewer.e4.application.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="2.16.1" useFeatures="true" includeLaunchers="true">
|
||||
|
||||
<configIni use="default">
|
||||
</configIni>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<build>
|
||||
|
@ -67,9 +67,9 @@
|
|||
<appArgLine>-application org.eclipse.ant.core.antRunner -buildfile packaging-p2-composite.ant p2.composite.add -Dsite.label="SCViewer Software Repository" -Dproject.build.directory=${project.build.directory} -DunqualifiedVersion=${unqualifiedVersion} -Dsoftware.download.area="${software.download.area}/SCViewer-GHP/repository"</appArgLine>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>2020-03</id>
|
||||
<id>2021-12</id>
|
||||
<layout>p2</layout>
|
||||
<url>http://download.eclipse.org/releases/2020-03/</url>
|
||||
<url>http://download.eclipse.org/releases/2021-12/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
#Written by SCViewer
|
||||
#Mon Jan 03 21:01:50 CET 2022
|
||||
SHOWN_WAVEFORM0=duv.addr_ack
|
||||
SHOWN_WAVEFORM11.VALUE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM2=duv.bus_addr[7\:0]
|
||||
SHOWN_WAVEFORM1=duv.addr_req
|
||||
SHOWN_WAVEFORM8=tr.addr_req
|
||||
SHOWN_WAVEFORM7=tr.addr_ack
|
||||
SHOWN_WAVEFORM9=tr.addr_stream
|
||||
SHOWN_WAVEFORM4=duv.clk
|
||||
SHOWN_WAVEFORM16.VALUE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM3=duv.bus_data[7\:0]
|
||||
SHOWN_WAVEFORM14.WAVEFORM_SELECTED=FALSE
|
||||
SHOWN_WAVEFORM6=duv.rw
|
||||
SHOWN_WAVEFORM5=duv.data_rdy
|
||||
SHOWN_WAVEFORM8.VALUE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM3.WAVE_DISPLAY=DEFAULT
|
||||
SHOWN_CURSOR1=100000000
|
||||
SHOWN_CURSOR0=10000000
|
||||
SHOWN_WAVEFORM12.WAVEFORM_SELECTED=FALSE
|
||||
SHOWN_WAVEFORM5.VALUE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM11.WAVE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM0.VALUE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM12.WAVE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM16.WAVE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORMS=17
|
||||
SHOWN_WAVEFORM15.WAVE_DISPLAY=DEFAULT
|
||||
SCALING_FACTOR=1000000
|
||||
SHOWN_CURSORS=2
|
||||
SHOWN_WAVEFORM14.VALUE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM13.WAVEFORM_SELECTED=FALSE
|
||||
SHOWN_WAVEFORM0.WAVEFORM_SELECTED=TRUE
|
||||
SHOWN_WAVEFORM7.WAVEFORM_SELECTED=FALSE
|
||||
SHOWN_WAVEFORM13.VALUE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM6.VALUE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM15.WAVEFORM_SELECTED=FALSE
|
||||
SHOWN_WAVEFORM2.WAVEFORM_SELECTED=TRUE
|
||||
DATABASE_FILE1=C\:\\Users\\eyck\\git\\SCViewer\\tests\\com.minres.scviewer.database.test\\inputs\\my_db.txlog
|
||||
DATABASE_FILE0=C\:\\Users\\eyck\\git\\SCViewer\\tests\\com.minres.scviewer.database.test\\inputs\\my_db.vcd
|
||||
SHOWN_WAVEFORM9.WAVEFORM_SELECTED=FALSE
|
||||
SHOWN_WAVEFORM7.WAVE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM9.WAVE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM7.VALUE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM12.VALUE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM10.WAVEFORM_SELECTED=FALSE
|
||||
SHOWN_WAVEFORM9.VALUE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM4.WAVEFORM_SELECTED=TRUE
|
||||
SHOWN_WAVEFORM5.WAVE_DISPLAY=DEFAULT
|
||||
DATABASE_FILES=2
|
||||
SHOWN_WAVEFORM1.WAVE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM4.VALUE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM13.WAVE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM10.VALUE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM5.WAVEFORM_SELECTED=TRUE
|
||||
SHOWN_WAVEFORM14.WAVE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM15.VALUE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM6.WAVEFORM_SELECTED=TRUE
|
||||
SHOWN_WAVEFORM1.WAVEFORM_SELECTED=TRUE
|
||||
SHOWN_WAVEFORM16=tr.rw
|
||||
SHOWN_WAVEFORM11.WAVEFORM_SELECTED=FALSE
|
||||
SHOWN_WAVEFORM4.WAVE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM1.VALUE_DISPLAY=DEFAULT
|
||||
TX_DETAILS_SHOWN=false
|
||||
SHOWN_WAVEFORM2.VALUE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM2.WAVE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM11=tr.bus_data[7\:0]
|
||||
SHOWN_WAVEFORM10=tr.bus_addr[7\:0]
|
||||
SHOWN_WAVEFORM15=tr.pipelined_stream
|
||||
SHOWN_WAVEFORM0.WAVE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM14=tr.data_stream
|
||||
SHOWN_WAVEFORM13=tr.data_rdy
|
||||
SHOWN_WAVEFORM12=tr.clk
|
||||
SHOWN_WAVEFORM10.WAVE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM8.WAVEFORM_SELECTED=FALSE
|
||||
SHOWN_WAVEFORM3.VALUE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM6.WAVE_DISPLAY=DEFAULT
|
||||
BASE_LINE_TIME=0
|
||||
SHOWN_WAVEFORM16.WAVEFORM_SELECTED=FALSE
|
||||
SHOWN_WAVEFORM8.WAVE_DISPLAY=DEFAULT
|
||||
SHOWN_WAVEFORM3.WAVEFORM_SELECTED=TRUE
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-test-plugin</packaging>
|
||||
|
|
Loading…
Reference in New Issue