/*
Helper function for iterating root-ward, starting
from (but not including) the provided `originRoute`.

Returns true if the last callback fired requested
to bubble upward.

@private
495749
function forEachRouteAbove(originRoute, transition, callback) {
    var handlerInfos = transition.state.handlerInfos;
    var originRouteFound = false;
    var handlerInfo, route;

    for (var i = handlerInfos.length - 1; i >= 0; --i) {
      handlerInfo = handlerInfos[i];
      route = handlerInfo.handler;

      if (!originRouteFound) {
        if (originRoute === route) {
          originRouteFound = true;
        }
        continue;
      }

      if (callback(route, handlerInfos[i + 1].handler) !== true) {
        return false;
      }
    }
    return true;
  }
566223
function callHook(vnode) {
		var original = vnode.state
		try {
			return this.apply(original, arguments)
		} finally {
			checkState(vnode, original)
		}
	}
1270391
function(router, path) {
    var parentState = get(this, 'parentState');

    // If we're at the root state, we're done
    if (parentState === router) {
      return;
    }

    path = path.replace(/^(?=[^\/])/, "/");
    var absolutePath = this.absoluteRoute(router);

    var route = get(this, 'route');

    // If the current path is empty, move up one state,
    // because the index ('/') state must be a leaf node.
    if (route !== '/') {
      // If the current path is a prefix of the path we're trying
      // to go to, we're done.
      var index = path.indexOf(absolutePath),
          next = path.charAt(absolutePath.length);

      if (index === 0 && (next === "/" || next === "")) {
        return;
      }
    }

    // Transition to the parent and call unroute again.
    router.enterState({
      exitStates: [this],
      enterStates: [],
      finalState: parentState
    });

    router.send('unroutePath', path);
  }
213672
public void onRootStopwatchStop(CallTree callTree, Split split) {
		callTreeLogTemplate.log(split, callTree);
		if (logThreshold != null && split.runningFor() > logThreshold) {
			split.getStopwatch().setAttribute(ATTR_NAME_LAST, callTree);
		}
		removeCallTree();
	}
522703
function onUpgrade (reverseProxy, proxySocket) {
    if (!reverseProxy) {
      proxySocket.end();
      socket.end();
      return;
    }

    //
    // Any incoming data on this WebSocket to the proxy target
    // will be written to the `reverseProxy` socket.
    //
    proxySocket.on('data', listeners.onIncoming = function (data) {
      if (reverseProxy.incoming.socket.writable) {
        try {
          self.emit('websocket:outgoing', req, socket, head, data);
          var flushed = reverseProxy.incoming.socket.write(data);
          if (!flushed) {
            proxySocket.pause();
            reverseProxy.incoming.socket.once('drain', function () {
              try { proxySocket.resume() }
              catch (er) { console.error("proxySocket.resume error: %s", er.message) }
            });

            //
            // Force the `drain` event in 100ms if it hasn't
            // happened on its own.
            //
            setTimeout(function () {
              reverseProxy.incoming.socket.emit('drain');
            }, 100);
          }
        }
        catch (ex) {
          detach();
        }
      }
    });

    //
    // Any outgoing data on this Websocket from the proxy target
    // will be written to the `proxySocket` socket.
    //
    reverseProxy.incoming.socket.on('data', listeners.onOutgoing = function (data) {
      try {
        self.emit('websocket:incoming', reverseProxy, reverseProxy.incoming, head, data);
        var flushed = proxySocket.write(data);
        if (!flushed) {
          reverseProxy.incoming.socket.pause();
          proxySocket.once('drain', function () {
            try { reverseProxy.incoming.socket.resume() }
            catch (er) { console.error("reverseProxy.incoming.socket.resume error: %s", er.message) }
          });

          //
          // Force the `drain` event in 100ms if it hasn't
          // happened on its own.
          //
          setTimeout(function () {
            proxySocket.emit('drain');
          }, 100);
        }
      }
      catch (ex) {
        detach();
      }
    });

    //
    // Helper function to detach all event listeners
    // from `reverseProxy` and `proxySocket`.
    //
    function detach() {
      proxySocket.destroySoon();
      proxySocket.removeListener('end', listeners.onIncomingClose);
      proxySocket.removeListener('data', listeners.onIncoming);
      reverseProxy.incoming.socket.destroySoon();
      reverseProxy.incoming.socket.removeListener('end', listeners.onOutgoingClose);
      reverseProxy.incoming.socket.removeListener('data', listeners.onOutgoing);
    }

    //
    // If the incoming `proxySocket` socket closes, then
    // detach all event listeners.
    //
    proxySocket.on('end', listeners.onIncomingClose = function() {
      detach();

      // Emit the `end` event now that we have completed proxying
      self.emit('websocket:end', req, socket, head);
    });

    //
    // If the `reverseProxy` socket closes, then detach all
    // event listeners.
    //
    reverseProxy.incoming.socket.on('end', listeners.onOutgoingClose = function() {
      detach();
    });
  }
133869
function()
	{
		var view = this;
		while(view.parentView)
		{
			view = view.parentView;
		}

		if(view.dispatcher !== null)
		{
			view.dispatcher.trigger({ type: 'refresh' });
			this._pendingRefreshRoot = false;
		}
	}
659903
function() {
            if (this.started) {
                logging.warn("routing history already started");
                return false;
            }

            var self = this;
            var $window = $(window);
            var rootUrl = document.location.protocol+'//'+(document.location.hostname||document.location.host);

            logging.log("start routing history");
            $window.bind('hashchange', _.bind(this._handleCurrentState, this));

            var ret = this._handleCurrentState();
            this.started = true;

            return ret;
        }
963727
private boolean _isRedirectTrueOnPreviousRequest(FacesContext facesContext)
    {
        ExternalContext externalContext = facesContext.getExternalContext();
        Map<String, Object> requestMap = externalContext.getRequestMap();
        Boolean redirect = (Boolean) requestMap.get(FLASH_PREVIOUS_REQUEST_REDIRECT);
        
        return Boolean.TRUE.equals(redirect);
    }
400715
public void traverse(Node root) {
    try {
      initTraversal(root);
      curNode = root;
      pushScope(root);
      // null parent ensures that the shallow callbacks will traverse root
      traverseBranch(root, null);
      popScope();
    } catch (Error | Exception unexpectedException) {
      throwUnexpectedException(unexpectedException);
    }
  }
1316977
function done() {
    // get the next route from the stack
    route = stack.pop()

    var callback
    // if the stack is not empty yet, i.e., if this is not
    // the last route part, the callback standard callback is provided
    if (stack.length) {
      callback = done
    }
    // otherwise a slightly modified callback is provided
    else {
      callback = function() {
        done.end()
      }
      callback.redirect = done.redirect
      callback.render = function() {
        res.render.apply(res, [req.app._currentRoute].concat(Array.prototype.slice.call(arguments), finalize))
      }
    }

    // exectue the route part
    route.execute(req.app, req, res, callback)
  }
461280
function oneShot(callback) {
  var done = false;
  return function (err) {
    if (!done) {
      done = true;
      return callback.apply(this, arguments);
    }
    if (err) console.error(err.stack);
  }
}
424796
function(data){
      if (this.delegate)
        return this.root.update(data);

      if (data)
      {
        var delta = {};
        var changed = false;

        for (var prop in data)
          if (this.data[prop] !== data[prop])
          {
            changed = true;
            delta[prop] = this.data[prop];
            this.data[prop] = data[prop];
          }

        if (changed)
        {
          this.emit_update(delta);
          return delta;
        }
      }

      return false;
    }
388348
function(callback) {
        if (this._isShuttingDown || this._isStartingUp) {
            return;
        }

        this._isShuttingDown = true;

        // See if the app is running.
        if (!this.processId() && !this.sideProcessId()) {
            this._isShuttingDown = false;
            // Nope, not running.
            if (callback) {
                callback();
            }

            return;
        }

        // Kill the app.
        clearTimeout(this._restartTimeout);
        this._appProcess.kill();
        if (this._sideProcess) {
            this._sideProcess.kill();
        }

        // Check on an interval to see if it's dead.
        var check = setInterval(_.bind(function() {
            if (this.processId() || this.sideProcessId()) {
                return;
            }

            clearInterval(check);
            logger.info('App shut down by force.');
            this._isShuttingDown = false;
            if (callback) {
                callback();
            }
        }, this), 250);
    }
457968
function traverseDepthFirstSync(rootNode, options) {
  options = extend({
    subnodesAccessor: function(node) { return node.subnodes; },
    userdataAccessor: function(node, userdata) { return userdata; },
    onNode: function(node, userdata) {},
    userdata: null
  }, options);

  var stack = [];
  stack.push([rootNode, options.userdata]);
  while (stack.length>0) {
    var top = stack.pop();
    var node = top[0];
    var data = top[1];

    options.onNode(node, data);

    var subnodeData = options.userdataAccessor(node, data);
    var subnodes = options.subnodesAccessor(node);
    for (var i=0; i<subnodes.length; i++)
      stack.push([subnodes[i], subnodeData]);
  }
  return rootNode;
}
953402
function(inSender, e) {
		// if a scroll event originated here, pass it to our strategy to handle
		if (this.$.strategy.domScroll && e.originator == this) {
			this.$.strategy.scroll(inSender, e);
		}
		this.doScroll(e);
		return true;
	}
1318401
function isAttachedToRoot() {
         if (this.root === true) {
           return true;
         } else {
           var ancestor = this.ancestor;

           while (ancestor) {
             if (ancestor.root === true) {
               return true;
             }

             ancestor = ancestor.ancestor;
           }

           return false;
         }
       }
300524
function traverseBreadthFirst(rootNode, options) {
  options = extend({
    subnodesAccessor: function(node) { return node.subnodes; },
    userdataAccessor: function(node, userdata) { return userdata; },
    onNode: function(node, callback, userdata) { callback(); },
    onComplete: function(rootNode) {},
    userdata: null
  }, options);

  var queue = [];
  queue.push([rootNode, options.userdata]);

  (function next() {
    if (queue.length == 0) {
      options.onComplete(rootNode);
      return;
    }

    var front = queue.shift();
    var node = front[0];
    var data = front[1];

    options.onNode(node, function() {
      var subnodeData = options.userdataAccessor(node, data);
      var subnodes = options.subnodesAccessor(node);
      async.eachSeries(subnodes,
        function(subnode, nextNode) {
          queue.push([subnode, subnodeData]);
          async.setImmediate(nextNode);
        },
        function() {
          async.setImmediate(next);
        }
      );
    },
    data);
  })();
}