m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java
diff options
context:
space:
mode:
authorMagdalena Grodzińska <mag.grodzinska@gmail.com>2020-01-13 20:56:41 +0100
committerMagdalena Grodzińska <mag.grodzinska@gmail.com>2020-01-13 20:56:41 +0100
commit23b8714b29816b608cb3aa330b6e93610e107126 (patch)
tree4cb9bf4d64ec1d2987ec4b44692fdd42280ab91d /src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java
parent81d1abbbad1f1e9c7774c7162b23fc804f7989a3 (diff)
Create simple query data structure so that RMI doesn't blow up
Diffstat (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java')
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java9
1 files changed, 9 insertions, 0 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 6839e4c..ece50b5 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java
@@ -6,6 +6,7 @@ import pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Program;
import pl.edu.mimuw.cloudatlas.interpreter.query.parser;
import pl.edu.mimuw.cloudatlas.interpreter.query.Yylex;
import pl.edu.mimuw.cloudatlas.model.Value;
+import pl.edu.mimuw.cloudatlas.querysigner.QueryData;
/**
* A class that holds a CloudAtlas query.
@@ -41,6 +42,14 @@ public class ValueQuery extends Value {
this.timestamp = System.currentTimeMillis();
}
+ public ValueQuery(QueryData queryData) throws Exception {
+ this.code = queryData.getCode();
+ Yylex lex = new Yylex(new ByteArrayInputStream(queryData.getCode().getBytes()));
+ this.query = (new parser(lex)).pProgram();
+ this.signature = queryData.getSignature();
+ this.timestamp = System.currentTimeMillis();
+ }
+
private ValueQuery() {
this.code = null;
this.query = null;