
/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 **/

"use strict";

const runner = require("./runner");

function Visitor () {};

Visitor.prototype.eval = function (skeleton, params, skeleton_type, callback) {
	switch (skeleton_type) {
		case "seq": 
			this.eval_seq(skeleton, params, callback); 
			break;
		case "map": 
			this.eval_map(skeleton, params, callback);
			break;
	}
};

Visitor.prototype.eval_seq = function (skeleton, params, callback) {
	runner.serial_run(skeleton.execute, params, callback);
};


Visitor.prototype.eval_map = function (skeleton, params, callback) {
	runner.parallel_run(skeleton.execute, params, callback);
};

exports.Visitor = function () {
	return new Visitor();
};

@@ -877,19 +877,55 @@
 isitor (
-) %7B
+callback) %7B%0A%09this.callback = callback;%0A
 %7D;%0A%0AVisi
@@ -938,20 +938,24 @@
 ototype.
-eval
+get_type
  = funct
@@ -963,150 +963,141 @@
 on (
-skeleton, params, skeleton_type, callback) %7B%0A%09switch (skeleton_type) %7B%0A%09%09case %22seq%22: %0A%09%09%09this.eval_seq(skeleton, params, callback); %0A%09%09%09break;
+item) %7B%0A%09return item.constructor.name;%0A%7D;%0A%0AVisitor.prototype.eval = function (skeleton, params) %7B%0A%09switch (this.get_type(skeleton)) %7B
 %0A%09%09c
@@ -1101,19 +1101,19 @@
 %09%09case %22
-map
+Seq
 %22: %0A%09%09%09t
@@ -1121,19 +1121,19 @@
 is.eval_
-map
+seq
 (skeleto
@@ -1141,28 +1141,19 @@
 , params
-, callback
 );
+ 
 %0A%09%09%09brea
@@ -1189,16 +1189,17 @@
 val_seq 
+ 
 = functi
@@ -1214,34 +1214,24 @@
 eton, params
-, callback
 ) %7B%0A%09runner.
@@ -1238,14 +1238,10 @@
 seri
-al_run
+es
 (ske
@@ -1267,140 +1267,13 @@
 ms, 
-callback);%0A%7D;%0A%0A%0AVisitor.prototype.eval_map = function (skeleton, params, callback) %7B%0A%09runner.parallel_run(skeleton.execute, params, 
+this.
 call
@@ -1311,16 +1311,24 @@
 nction (
+callback
 ) %7B%0A%09ret
@@ -1343,14 +1343,22 @@
 Visitor(
+callback
 );%0A%7D;%0A

Update visitor.js