Skip to content

Commit

Permalink
remove commented lazy logic
Browse files Browse the repository at this point in the history
  • Loading branch information
shueja committed Jan 12, 2024
1 parent 5f438b0 commit 3b216c8
Showing 1 changed file with 20 additions and 112 deletions.
132 changes: 20 additions & 112 deletions monologue/src/generate/java/NTLogger.java.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -88,29 +88,11 @@ class NTLogger extends GenericLogger {
{%endif%}
LongConsumer consumer;
{%if t.TypeName == 'IntegerArray'%}
// if (this.isLazy()) {
// consumer = new LongConsumer() {
// private long[] lastValue = new long[] {};
// @Override
// public void accept(long timestamp) {
// var intarr = valueSupplier.get();
// if (intarr == null) { return;}
// var value = toLongArray(valueSupplier.get());
// if (!(Arrays.equals(value, lastValue))) {
// entry.set(value, timestamp);
// lastValue = value;
// }


// }
// };
// } else {
consumer = (timestamp) -> {
var value = valueSupplier.get();
if (value == null) { return;}
entry.set(toLongArray(value), timestamp);
};
// }
consumer = (timestamp) -> {
var value = valueSupplier.get();
if (value == null) { return;}
entry.set(toLongArray(value), timestamp);
};

addField(
entryName,
Expand All @@ -124,54 +106,12 @@ class NTLogger extends GenericLogger {
entry::unpublish
);
{%else%}
{%if t.java.IsArray == true%}
// if (this.isLazy()) {
// consumer = new LongConsumer() {
// private {{t.java.ValueType}} lastValue = new {{t.java.ValueType}} {};
// @Override
// public void accept(long timestamp) {
// var value = valueSupplier.get();
// if (value == null) { return;}
// {%if t.TypeName == 'StringArray'%}
// if (!(Arrays.deepEquals(value, lastValue))) {
// {%else%}
// if (!(Arrays.equals(value, lastValue))) {
// {%endif%}
// entry.set(value, timestamp);
// lastValue = value;
// }
// }
// };
// } else {
consumer = (timestamp) -> {
var value = valueSupplier.get();
if (value != null) {
entry.set(value, timestamp);
}
};
// }
{%else%}
// if (this.isLazy()) {
// consumer = new LongConsumer() {
// private {{t.java.ValueType}} lastValue = {{t.java.EmptyValue}};
// @Override
// public void accept(long timestamp) {

// var value = valueSupplier.get();
// if (value == null) { return; }
// if (value != lastValue) {
// entry.set(value, timestamp);
// lastValue = value;
// }
// }
// };
// } else {
consumer = (timestamp) -> {
var value = valueSupplier.get();
if (value == null) { return; }
consumer = (timestamp) -> {
var value = valueSupplier.get();
if (value != null) {
entry.set(value, timestamp);
};
// }
}
};
{%endif%}

addField(
Expand All @@ -195,28 +135,11 @@ class NTLogger extends GenericLogger {
var publisher = topic.publish();

LongConsumer consumer;

// if (this.isLazy()) {
// consumer = new LongConsumer() {
// private R lastValue = null;
// @Override
// public void accept(long timestamp) {

// var value = valueSupplier.get();
// if (value == null) { return;}
// if (!(value.equals(lastValue))) {
// publisher.set(value, timestamp);
// lastValue = value;
// }
// }
// };
// } else {
consumer = (timestamp) -> {
var value = valueSupplier.get();
if (value == null) { return;}
publisher.set(value, timestamp);
};
// }
consumer = (timestamp) -> {
var value = valueSupplier.get();
if (value == null) { return;}
publisher.set(value, timestamp);
};

addField(
entryName,
Expand All @@ -238,26 +161,11 @@ class NTLogger extends GenericLogger {

LongConsumer consumer;

// if (this.isLazy()) {
// consumer = new LongConsumer() {
// private R[] lastValue = null;
// @Override
// public void accept(long timestamp) {
// var value = (R[]) valueSupplier.get();
// if (value == null) {return;}
// if (!(Arrays.deepEquals(value, lastValue))) {
// publisher.set(value, timestamp);
// lastValue = value;
// }
// }
// };
// } else {
consumer = (timestamp) -> {
var value = valueSupplier.get();
if (value == null) {return;}
publisher.set(value, timestamp);
};
// }
consumer = (timestamp) -> {
var value = valueSupplier.get();
if (value == null) {return;}
publisher.set(value, timestamp);
};

addField(
entryName,
Expand Down

0 comments on commit 3b216c8

Please sign in to comment.