m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMagdalena Grodzińska <mag.grodzinska@gmail.com>2020-01-12 22:57:43 +0100
committerMagdalena Grodzińska <mag.grodzinska@gmail.com>2020-01-12 22:57:43 +0100
commit36cf47fd63352c67a5fdeea7a922c16f0856e9aa (patch)
treecd3dda075faef7464117ccf0e8b5d047bb448eb8 /src
parentc97540a2640bc2d8ecffedb0e85f2d1e3d517eb0 (diff)
Add new fields to value query
Diffstat (limited to 'src')
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java39
1 files 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;