blob: 1877846bcdf06c9e619ab909618738c9fa43faa8 [file] [log] [blame]
genia.likes.science@gmail.comb91b577a2013-06-13 14:36:06 -07001function AsterixDBConnection(configuration) {
2 this._properties = {};
3 this._properties["dataverse"] = "";
4 this._properties["mode"] = "synchronous";
5
6 var configuration = arguments || {};
7
8 for (var key in configuration) {
9 this._properties[key] = configuration[key];
10 }
11
12 return this;
13}
14
15
16AsterixDBConnection.prototype.dataverse = function(dataverseName) {
17 this._properties["dataverse"] = dataverseName;
18
19 return this;
20};
21
22
23AsterixDBConnection.prototype.run = function(statements, successFn) {
24
25 var success_fn = successFn;
26
27 if ( typeof statements === 'string') {
28 statements = [ statements ];
29 }
30
31 var query = "use dataverse " + this._properties["dataverse"] + "\n;" + statements.join("\n");
32 var mode = this._properties["mode"];
33
34 $.ajax({
35 type : 'GET',
36 url : "http://localhost:19002/query",
37 data : {
38 "query" : query,
39 "mode" : mode
40 },
41 dataType : "json",
42 success : function(data) {
43 success_fn(data);
44 },
45 error: function(r) {
genia.likes.science@gmail.comf8cca192013-06-13 15:45:53 -070046 //alert("AsterixSDK ERROR\n" + JSON.stringify(r));
genia.likes.science@gmail.comb91b577a2013-06-13 14:36:06 -070047 }
48 });
49
50 return this;
51};
52
53
54// Asterix Expressions
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -070055function AExpression () {
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070056 this._properties = {};
57 this._success = function() {};
58
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070059 return this;
60}
61
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -070062
63AExpression.prototype.bind = function(options) {
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070064 var options = options || {};
65
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070066 if (options.hasOwnProperty("success")) {
67 this._success = options["success"];
68 }
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -070069
70 if (options.hasOwnProperty("return")) {
71 this._properties["return"] = " return " + options["return"].val();
72 }
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070073};
74
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070075
genia.likes.science@gmail.com18f3bf22013-06-12 07:45:02 -070076AExpression.prototype.run = function(successFn) {
77 var success_fn = successFn;
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070078
79 $.ajax({
80 type : 'GET',
genia.likes.science@gmail.comfc5f5092013-06-12 00:49:46 -070081 url : "http://localhost:19002/query",
genia.likes.science@gmail.com18f3bf22013-06-12 07:45:02 -070082 data : {"query" : "use dataverse TinySocial;\n" + this.val()},
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070083 dataType : "json",
84 success : function(data) {
85 success_fn(data);
genia.likes.science@gmail.com5f425342013-06-13 13:51:26 -070086 },
87 error: function(r) {
88 //alert(JSON.stringify(r));
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070089 }
90 });
91
92 return this;
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -070093};
94
95
96AExpression.prototype.val = function() {
97
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -070098 var value = "";
99
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -0700100 // If there is a dataverse defined, provide it.
101 if (this._properties.hasOwnProperty("dataverse")) {
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -0700102 value += "use dataverse " + this._properties["dataverse"] + ";\n";
103 };
104
105 if (this._properties.hasOwnProperty("value")) {
106 value += this._properties["value"];
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -0700107 }
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -0700108
109 return value;
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700110};
111
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -0700112// @param expressionValue [String]
113AExpression.prototype.set = function(expressionValue) {
114 this._properties["value"] = expressionValue;
115 return this;
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700116};
117
genia.likes.science@gmail.com73dcc702013-05-28 04:21:28 -0700118
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -0700119// FunctionExpression
120// Parent: AsterixExpression
121//
122// @param options [Various],
123// @key function [String], a function to be applid to the expression
genia.likes.science@gmail.com18f3bf22013-06-12 07:45:02 -0700124// @key expression [AsterixExpression or AQLClause] an AsterixExpression/Clause to which the fn will be applied
125function FunctionExpression() {
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -0700126
127 // Initialize superclass
128 AExpression.call(this);
genia.likes.science@gmail.com18f3bf22013-06-12 07:45:02 -0700129
130 this._properties["function"] = "";
131 this._properties["expression"] = new AExpression().set("");
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -0700132
genia.likes.science@gmail.com18f3bf22013-06-12 07:45:02 -0700133 // Check for fn/expression input
134 if (arguments.length == 2 && typeof arguments[0] == "string" &&
135 (arguments[1] instanceof AExpression || arguments[1] instanceof AQLClause)) {
136
137 this._properties["function"] = arguments[0];
138 this._properties["expression"] = arguments[1];
139
140 }
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -0700141
142 // Return object
143 return this;
144}
145
146
147FunctionExpression.prototype = Object.create(AExpression.prototype);
148FunctionExpression.prototype.constructor = FunctionExpression;
149
150
genia.likes.science@gmail.com18f3bf22013-06-12 07:45:02 -0700151FunctionExpression.prototype.fn = function(fnName) {
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -0700152
genia.likes.science@gmail.com18f3bf22013-06-12 07:45:02 -0700153 if (typeof fnName == "string") {
154 this._properties["function"] = fnName;
155 }
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -0700156
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -0700157 return this;
158};
159
genia.likes.science@gmail.com18f3bf22013-06-12 07:45:02 -0700160
161FunctionExpression.prototype.expression = function(expression) {
162 if (expression instanceof AExpression || expression instanceof AQLClause) {
163 this._properties["expression"] = expression;
164 }
165
166 return this;
167};
168
169
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -0700170FunctionExpression.prototype.val = function () {
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -0700171 return this._properties["function"] + "(" + this._properties["expression"].val() + ")";
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -0700172};
173
genia.likes.science@gmail.com73dcc702013-05-28 04:21:28 -0700174
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700175// FLWOGRExpression
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -0700176//
177// FLWOGRExpression ::= ( ForClause | LetClause ) ( Clause )* "return" Expression
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700178function FLWOGRExpression (options) {
179 // Initialize superclass
180 AExpression.call(this);
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -0700181
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700182 this._properties["clauses"] = [];
genia.likes.science@gmail.com79e603a2013-05-31 10:03:23 -0700183 this._properties["minSize"] = 0;
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700184
185 // Bind options and return
186 this.bind(options);
187 return this;
genia.likes.science@gmail.com90d08722013-05-28 04:40:12 -0700188}
189
190
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700191FLWOGRExpression.prototype = Object.create(AExpression.prototype);
192FLWOGRExpression.prototype.constructor = FLWOGRExpression;
193
194
195FLWOGRExpression.prototype.bind = function(options) {
196 AExpression.prototype.bind.call(this, options);
197
198 var options = options || {};
199
genia.likes.science@gmail.com79e603a2013-05-31 10:03:23 -0700200 if (options instanceof SetStatement) {
201 this._properties["clauses"].push(options);
202 this._properties["minSize"] += 1;
203 }
204
205 if (this._properties["clauses"].length <= this._properties["minSize"]) {
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700206 // Needs to start with for or let clause
207 if (options instanceof ForClause || options instanceof LetClause) {
208 this._properties["clauses"].push(options);
209 }
210 } else {
211 if (options instanceof AQLClause) {
212 this._properties["clauses"].push(options);
213 }
214 }
215
216 return this;
217};
218
219
220FLWOGRExpression.prototype.val = function() {
221 var value = AExpression.prototype.val.call(this);
222
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -0700223 var clauseValues = [];
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700224 for (var c in this._properties["clauses"]) {
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -0700225 clauseValues.push(this._properties["clauses"][c].val());
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700226 }
227
genia.likes.science@gmail.com79e603a2013-05-31 10:03:23 -0700228 return value + clauseValues.join("\n");// + ";";
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700229};
230
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -0700231
genia.likes.science@gmail.com5f425342013-06-13 13:51:26 -0700232FLWOGRExpression.prototype.ReturnClause = function(expression) {
233 return this.bind(new ReturnClause(expression));
234};
235
genia.likes.science@gmail.com73dcc702013-05-28 04:21:28 -0700236// AQLClause
237//
238// Base Clause ::= ForClause | LetClause | WhereClause | OrderbyClause | GroupClause | LimitClause | DistinctClause
239function AQLClause() {
240 this._properties = {};
241 this._properties["clause"] = "";
242}
243
244AQLClause.prototype.val = function() {
245 var value = this._properties["clause"];
genia.likes.science@gmail.com73dcc702013-05-28 04:21:28 -0700246
247 return value;
248};
249
250AQLClause.prototype.bind = function(options) {
genia.likes.science@gmail.com73dcc702013-05-28 04:21:28 -0700251
genia.likes.science@gmail.com18f3bf22013-06-12 07:45:02 -0700252 if (options instanceof AQLClause) {
253 this._properties["clause"] += " " + options.val();
genia.likes.science@gmail.com73dcc702013-05-28 04:21:28 -0700254 }
255
256 return this;
257};
258
genia.likes.science@gmail.com39578302013-05-31 04:42:26 -0700259AQLClause.prototype.set = function(value) {
260 this._properties["clause"] = value;
261 return this;
262};
263
genia.likes.science@gmail.com73dcc702013-05-28 04:21:28 -0700264
265// ForClause
266//
267// Grammar:
268// "for" Variable ( "at" Variable )? "in" ( Expression )
269//
270// @param for_variable [String], REQUIRED, first variable in clause
271// @param at_variable [String], NOT REQUIRED, first variable in clause
272// @param expression [AsterixExpression], REQUIRED, expression to evaluate
273//
274// TODO Error Checking
275function ForClause(for_variable, at_variable, expression) {
276 AQLClause.call(this);
277
genia.likes.science@gmail.comf8cca192013-06-13 15:45:53 -0700278 this._properties["clause"] = "for $" + arguments[0];
279
280 if (arguments.length == 3) {
281 this._properties["clause"] += " at $" + arguments[1];
282 this._properties["clause"] += " in " + arguments[2].val();
283 } else if (arguments.length == 2) {
284 this._properties["clause"] += " in " + arguments[1].val();
genia.likes.science@gmail.com73dcc702013-05-28 04:21:28 -0700285 }
genia.likes.science@gmail.comf8cca192013-06-13 15:45:53 -0700286
genia.likes.science@gmail.com73dcc702013-05-28 04:21:28 -0700287 return this;
288}
289
290ForClause.prototype = Object.create(AQLClause.prototype);
291ForClause.prototype.constructor = ForClause;
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700292
293
294// LetClause
295//
296// Grammar:
297// LetClause ::= "let" Variable ":=" Expression
298//
299// @param let_variable [String]
300// @param expression [AExpression]
301//
302// TODO Vigorous error checking
303function LetClause(let_variable, expression) {
304 AQLClause.call(this);
305
306 this._properties["clause"] = "let $" + let_variable + " := ";
307 this._properties["clause"] += expression.val();
308
309 return this;
310}
311
312LetClause.prototype = Object.create(AQLClause.prototype);
313LetClause.prototype.constructor = LetClause;
314
315
genia.likes.science@gmail.com5ca104c2013-05-29 05:39:26 -0700316// ReturnClause
317//
318// Grammar:
319// return [AQLExpression]
320function ReturnClause(expression) {
321 AQLClause.call(this);
322
323 this._properties["clause"] = "return ";
genia.likes.science@gmail.com5749ef92013-06-12 07:59:25 -0700324
genia.likes.science@gmail.com79e603a2013-05-31 10:03:23 -0700325 if (expression instanceof AExpression || expression instanceof AQLClause) {
genia.likes.science@gmail.com5ca104c2013-05-29 05:39:26 -0700326 this._properties["clause"] += expression.val();
genia.likes.science@gmail.com5749ef92013-06-12 07:59:25 -0700327
328 } else if ( typeof expression == "object" && Object.getPrototypeOf( expression ) === Object.prototype ) {
329
330 // TODO Null object check
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -0700331
332 this._properties["clause"] += "{";
333 var returnStatements = [];
334 for (returnValue in expression) {
335
336 if (expression[returnValue] instanceof AExpression) {
genia.likes.science@gmail.comfba7cc82013-05-31 04:04:08 -0700337 returnStatements.push('"' + returnValue + '" ' + " : " + expression[returnValue].val());
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -0700338 } else if (typeof expression[returnValue] == "string") {
genia.likes.science@gmail.comfba7cc82013-05-31 04:04:08 -0700339 returnStatements.push('"' + returnValue + '" ' + " : " + expression[returnValue]);
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -0700340 }
341 }
342 this._properties["clause"] += returnStatements.join(",\n");
genia.likes.science@gmail.comf7929d82013-06-12 11:30:01 -0700343 this._properties["clause"] += "\n}";
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -0700344
genia.likes.science@gmail.com5ca104c2013-05-29 05:39:26 -0700345 } else {
genia.likes.science@gmail.com5749ef92013-06-12 07:59:25 -0700346 this._properties["clause"] += new AQLClause().set(expression).val();
genia.likes.science@gmail.com5ca104c2013-05-29 05:39:26 -0700347 }
348
349 return this;
350}
351
genia.likes.science@gmail.com5749ef92013-06-12 07:59:25 -0700352
genia.likes.science@gmail.com5ca104c2013-05-29 05:39:26 -0700353ReturnClause.prototype = Object.create(AQLClause.prototype);
354ReturnClause.prototype.constructor = ReturnClause;
355
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -0700356
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700357// WhereClause
358//
359// Grammar:
360// ::= "where" Expression
361//
362// @param expression [BooleanExpression], pushes this expression onto the stack
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700363function WhereClause(expression) {
364 AQLClause.call(this);
365
366 this._properties["stack"] = [];
367
368 this.bind(expression);
369
370 return this;
371}
372
373
374WhereClause.prototype = Object.create(AQLClause.prototype);
375WhereClause.prototype.constructor = WhereClause;
376
377
378WhereClause.prototype.bind = function(expression) {
genia.likes.science@gmail.com64ca88e2013-05-31 10:40:39 -0700379 if (expression instanceof AExpression) {
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700380 this._properties["stack"].push(expression);
381 }
382};
383
384
385WhereClause.prototype.val = function() {
386 var value = "where ";
387
388 var count = this._properties["stack"].length - 1;
389 while (count >= 0) {
390 value += this._properties["stack"][count].val() + " ";
391 count -= 1;
392 }
393
394 return value;
genia.likes.science@gmail.com64ca88e2013-05-31 10:40:39 -0700395};
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -0700396
397
genia.likes.science@gmail.comd2f753e2013-06-12 13:51:03 -0700398WhereClause.prototype.and = function() {
399
400 var andClauses = [];
401 for (var expression in arguments) {
402
403 if (arguments[expression] instanceof AExpression) {
404 andClauses.push(arguments[expression].val());
405 }
406 }
407
408 if (andClauses.length > 0) {
409 this._properties["stack"].push(new AExpression().set(andClauses.join(" and ")));
410 }
411
412 return this;
413};
414
415
416WhereClause.prototype.or = function() {
417 var orClauses = [];
418 for (var expression in arguments) {
419
420 if (arguments[expression] instanceof AExpression) {
421 orClauses.push(arguments[expression].val());
422 }
423 }
424
425 if (andClauses.length > 0) {
426 this._properties["stack"].push(new AExpression().set(orClauses.join(" and ")));
427 }
428
429 return this;
430};
431
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -0700432// LimitClause
433// Grammar:
434// LimitClause ::= "limit" Expression ( "offset" Expression )?
435//
436// @param limitExpression [REQUIRED, AQLExpression]
437// @param offsetExpression [OPTIONAL, AQLExpression]
438function LimitClause(limitExpression, offsetExpression) {
439
440 AQLClause.call(this);
441
442 // limitExpression required
443 this._properties["clause"] = "limit " + limitExpression.val();
444
445 // Optional: Offset
446 var offset = typeof offsetExpression ? offsetExpression : null;
447 if (offset != null) {
448 this._properties["clause"] += " offset " + offsetExpression.val();
449 }
450
451 return this;
452}
453
454LimitClause.prototype = Object.create(AQLClause.prototype);
455LimitClause.prototype.constructor = LimitClause;
456
457
458// OrderbyClause
459//
460// Grammar:
461// OrderbyClause ::= "order" "by" Expression ( ( "asc" ) | ( "desc" ) )? ( "," Expression ( ( "asc" ) | ( "desc" ) )? )*
462//
463// @params AQLExpressions and asc/desc strings, in any quantity. At least one required.
464function OrderbyClause() {
465
466 AQLClause.call(this);
467
468 // At least one argument expression is required, and first should be expression
469 if (arguments.length == 0 || !(arguments[0] instanceof AExpression)) {
genia.likes.science@gmail.com18f3bf22013-06-12 07:45:02 -0700470
genia.likes.science@gmail.com2ba32242013-05-31 03:10:48 -0700471 // TODO Not sure which error to throw for an empty OrderBy but this should fail.
472 alert("Order By Error");
473 this._properties["clause"] = null;
474 return this;
475 }
476
477 var expc = 0;
478 var expressions = [];
479
480 while (expc < arguments.length) {
481
482 var expression = "";
483
484 if (arguments[expc] instanceof AExpression) {
485 expression += arguments[expc].val();
486 }
487
488 var next = expc + 1;
489 if (next < arguments.length && (arguments[next] == "asc" || arguments[next] == "desc")) {
490 expc++;
491 expression += " " + arguments[expc];
492 }
493
494 expressions.push(expression);
495
496 expc++;
497 }
498
499 this._properties["clause"] = "order by " + expressions.join(", ");
500 return this;
501}
502
503OrderbyClause.prototype = Object.create(AQLClause.prototype);
504OrderbyClause.prototype.constructor = OrderbyClause;
505
506
genia.likes.science@gmail.com6e392912013-05-31 03:46:59 -0700507// GroupClause
508//
509// Grammar:
510// GroupClause ::= "group" "by" ( Variable ":=" )? Expression ( "," ( Variable ":=" )? Expression )* ( "decor" Variable ":=" Expression ( "," "decor" Variable ":=" Expression )* )? "with" VariableRef ( "," VariableRef )*
511function GroupClause() {
512 AQLClause.call(this);
513
514 if (arguments.length == 0) {
515 // TODO Not sure which error to throw for an empty GroupBy but this should fail.
516 alert("Group Error");
517 this._properties["clause"] = null;
518 return this;
519 }
520
521 var expc = 0;
522 var expressions = [];
523 var variableRefs = [];
524 var isDecor = false;
genia.likes.science@gmail.com5f425342013-06-13 13:51:26 -0700525
genia.likes.science@gmail.com6e392912013-05-31 03:46:59 -0700526 while (expc < arguments.length) {
527
528 if (arguments[expc] instanceof AExpression) {
529
530 isDecor = false;
531 expressions.push(arguments[expc].val());
532
533 } else if (typeof arguments[expc] == "string") {
534
535 // Special keywords, decor & with
536 if (arguments[expc] == "decor") {
537 isDecor = true;
538 } else if (arguments[expc] == "with") {
539 isDecor = false;
540 expc++;
541 while (expc < arguments.length) {
542 variableRefs.push("$" + arguments[expc]);
543 expc++;
544 }
545
546 // Variables and variable refs
547 } else {
548
549 var nextc = expc + 1;
550 var expression = "";
551
552 if (isDecor) {
553 expression += "decor ";
554 isDecor = false;
555 }
556
557 expression += "$" + arguments[expc] + " := " + arguments[nextc].val();
558 expressions.push(expression);
559 expc++;
560 }
561 }
562
563 expc++;
564 }
565
566 this._properties["clause"] = "group by " + expressions.join(", ") + " with " + variableRefs.join(", ");
567 return this;
568}
569
570GroupClause.prototype = Object.create(AQLClause.prototype);
571GroupClause.prototype.constructor = GroupClause;
572
genia.likes.science@gmail.com79e603a2013-05-31 10:03:23 -0700573
574// SetStatement
575//
576// Grammar
577// "set" Identifier StringLiteral
578function SetStatement (identifier, stringLiteral) {
579 AExpression.call(this);
580
581 var statement = "set " + identifier + ' "' + stringLiteral + '";';
582
583 AExpression.prototype.set.call(this, statement);
584
585 return this;
586}
587
588SetStatement.prototype = Object.create(AExpression.prototype);
589SetStatement.prototype.constructor = SetStatement;
genia.likes.science@gmail.come34c57b2013-05-31 10:15:49 -0700590
591
592// Quantified Expression
593//
594// Grammar
595// QuantifiedExpression ::= ( ( "some" ) | ( "every" ) ) Variable "in" Expression ( "," Variable "in" Expression )* "satisfies" Expression
596//
597// @param String some/every
598// @param [AExpression]
599// @param [Aexpression] satisfiesExpression
600function QuantifiedExpression (keyword, expressions, satisfiesExpression) {
601 AExpression.call(this);
602
603 var expression = keyword + " ";
604 var varsInExpressions = [];
605
606 for (var varInExpression in expressions) {
607 varsInExpressions.push(varInExpression + " in " + expressions[varInExpression].val());
608 }
609 expression += varsInExpressions.join(", ") + " satisfies " + satisfiesExpression.val();
610
611 AExpression.prototype.set.call(this, expression);
612
613 return this;
614}
615
616QuantifiedExpression.prototype = Object.create(AExpression.prototype);
617QuantifiedExpression.prototype.constructor = QuantifiedExpression;
genia.likes.science@gmail.com64ca88e2013-05-31 10:40:39 -0700618
619QuantifiedExpression.prototype.val = function() {
620 var value = AExpression.prototype.val.call(this);
621 return "(" + value + ")";
622};