From 36cf47fd63352c67a5fdeea7a922c16f0856e9aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Sun, 12 Jan 2020 22:57:43 +0100 Subject: Add new fields to value query --- .../pl/edu/mimuw/cloudatlas/model/ValueQuery.java | 39 ++++++++++++---------- 1 file changed, 22 insertions(+), 17 deletions(-) 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 d203e99..26a5fbb 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java @@ -15,23 +15,6 @@ public class ValueQuery extends Value { private String code; // Parsed query private Program query; - - public byte[] getSignature() { - return signature; - } - - public void setSignature(byte[] signature) { - this.signature = signature; - } - - public long getTimestamp() { - return timestamp; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - // Query signature private byte[] signature; // Query signing timestamp @@ -47,17 +30,39 @@ public class ValueQuery extends Value { this.code = query; Yylex lex = new Yylex(new ByteArrayInputStream(query.getBytes())); this.query = (new parser(lex)).pProgram(); + this.signature = null; + this.timestamp = System.currentTimeMillis(); + } + + public ValueQuery(String query, byte[] querySignature) throws Exception { + this.code = query; + Yylex lex = new Yylex(new ByteArrayInputStream(query.getBytes())); + this.query = (new parser(lex)).pProgram(); + this.signature = querySignature; + this.timestamp = System.currentTimeMillis(); } private ValueQuery() { this.code = null; this.query = null; + this.signature = null; + this.timestamp = System.currentTimeMillis(); } public Program getQuery() { return query; } + public byte[] getSignature() { return signature; } + + public long getTimestamp() { return timestamp; } + + public void setTimestamp(long timestamp) { this.timestamp = timestamp; } + + public String getCode() { + return code; + } + @Override public Type getType() { return TypePrimitive.QUERY; -- cgit v1.2.3