From c4513b4817ec623d026fa35682b4934a211e1b8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Tue, 14 Jan 2020 21:54:11 +0100 Subject: Some small fixes --- .../java/pl/edu/mimuw/cloudatlas/agent/modules/Stanik.java | 4 ++-- src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Stanik.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Stanik.java index 9e2a603..79728b5 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Stanik.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Stanik.java @@ -215,8 +215,8 @@ public class Stanik extends Module { Attribute attribute = entry.getKey(); ValueTime timestamp = new ValueTime(entry.getValue().getTimestamp()); ValueQuery currentTimestampedQuery = queries.get(attribute); - ValueTime currentQueryTimestamp = new ValueTime(currentTimestampedQuery.getTimestamp()); - if (currentQueryTimestamp == null || ValueUtils.valueLower(currentQueryTimestamp, timestamp)) { + if (currentTimestampedQuery == null || + ValueUtils.valueLower(new ValueTime(currentTimestampedQuery.getTimestamp()), timestamp)) { queries.put(entry.getKey(), entry.getValue()); } } diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java b/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java index 3edda69..f049603 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java @@ -56,6 +56,16 @@ public class ValueQuery extends Value { this.timestamp = System.currentTimeMillis(); } + public ValueQuery(String query, long timestamp) throws Exception { + this.code = query; + if (!query.isEmpty()) { + Yylex lex = new Yylex(new ByteArrayInputStream(query.getBytes())); + this.query = (new parser(lex)).pProgram(); + } + this.signature = null; + this.timestamp = timestamp; + } + private ValueQuery() { this.code = null; this.query = null; -- cgit v1.2.3