use of org.gridkit.jvmtool.event.SimpleTagCollection in project jvm-tools by aragozin.
the class StackTraceEventReaderV4 method readTagSet.
protected void readTagSet() throws IOException {
int n = StackTraceCodec.readVarInt(dis);
int base = StackTraceCodec.readVarInt(dis);
SimpleTagCollection ts = new SimpleTagCollection(tagDic.get(base));
readTagSetDelta(ts);
ensureSlot(tagDic, n);
tagDic.set(n, ts);
}
use of org.gridkit.jvmtool.event.SimpleTagCollection in project jvm-tools by aragozin.
the class StackTraceEventReaderV4 method readTagSetDelta.
protected void readTagSetDelta(SimpleTagCollection ts) throws IOException {
SimpleTagCollection ap = new SimpleTagCollection();
while (true) {
int btag = dis.readByte();
if (btag == 0) {
break;
} else if (btag == StackTraceCodec.DIC_ADD_TAG) {
String key = readString();
String tag = readDynString();
ap.put(key, tag);
continue;
} else if (btag == StackTraceCodec.DIC_SET_KEY) {
String key = readString();
String tag = readDynString();
ts.remove(key);
ap.put(key, tag);
continue;
} else if (btag == StackTraceCodec.DIC_ADD_KEY) {
String key = readString();
ap.put(key, "");
continue;
} else if (btag == StackTraceCodec.DIC_REMOVE_KEY) {
String key = readString();
ts.remove(key);
continue;
} else if (btag == StackTraceCodec.DIC_REMOVE_TAG) {
String key = readString();
String tag = readDynString();
ts.remove(key, tag);
continue;
} else {
throw new IOException("Unexpected tag '" + btag + "'");
}
}
ts.putAll(ap);
}
use of org.gridkit.jvmtool.event.SimpleTagCollection in project jvm-tools by aragozin.
the class SimpleTagCollectionTest method empty_collection.
@Test
public void empty_collection() {
SimpleTagCollection tags = new SimpleTagCollection();
assertThat(tags).isEmpty();
assertThat(tags.tagsFor("A")).isEmpty();
assertThat(tags.contains("A", "A")).isFalse();
}
Aggregations