Function attaching a neighbors callback iterator method to the Graph prototype.

@param {function} Class       - Target class.
@param {object}   description - Method description.
492234
function attachNeighborIteratorCreator(Class, description) {
  const {
    name,
    type,
    direction
  } = description;

  const iteratorName = name.slice(0, -1) + 'Entries';

  /**
   * Function returning an iterator over all the relevant neighbors.
   *
   * @param  {any}      node     - Target node.
   * @return {Iterator}
   *
   * @throws {Error} - Will throw if there are too many arguments.
   */
  Class.prototype[iteratorName] = function(node) {

    // Early termination
    if (type !== 'mixed' && this.type !== 'mixed' && type !== this.type)
      return Iterator.empty();

    node = '' + node;

    const nodeData = this._nodes.get(node);

    if (typeof nodeData === 'undefined')
      throw new NotFoundGraphError(`Graph.${iteratorName}: could not find the "${node}" node in the graph.`);

    // Here, we want to iterate over a node's relevant neighbors
    return createNeighborIterator(
      type === 'mixed' ? this.type : type,
      direction,
      nodeData
    );
  };
}
1335109
function debuggerDecorator(target, name, descriptor) {
	const layoutDebug = this;

	if (!descriptor) {
		return layoutDebug.debug.bind(layoutDebug);
	}

	const oldFunction = descriptor.value;

	descriptor.value = function () {
		return oldFunction.bind(this)(layoutDebug.debug.bind(layoutDebug));
	};

	return descriptor;
}
1367501
function defineMethods(svc) {
    AWS.util.each(svc.prototype.api.operations, function iterator(method) {
      if (svc.prototype[method]) return;
      var operation = svc.prototype.api.operations[method];
      if (operation.authtype === 'none') {
        svc.prototype[method] = function (params, callback) {
          return this.makeUnauthenticatedRequest(method, params, callback);
        };
      } else {
        svc.prototype[method] = function (params, callback) {
          return this.makeRequest(method, params, callback);
        };
      }
    });
  }
1358416
function _addGraphEdges(db, graph, callback) {

  // Counters
  let done = 0;
  let count = graph.vertexCount();

  // Loop through each Vertex in the Graph
  for ( let [stopId, stop] of graph ) {

    // Get the Edges for the Vertex
    _getStopEdges(db, stopId, function(err, edges) {

      // Database Query Error
      if ( err ) {
        return callback(err);
      }

      // Add each edge to the Graph
      for ( let i = 0; i < edges.length; i++ ) {
        graph.ensureEdge(stopId, edges[i]);
        graph.ensureEdge(edges[i], stopId);
      }

      // Finish the Vertex
      _finish();

    });

  }

  // Keep track of finished vertices
  function _finish() {
    done++;
    if ( done === count ) {
      return callback(null, graph);
    }
  }

}
672315
function(class_data) {

		var prototype = {},
			skeleton = class_data.skeleton,
			serialized_value,
			constructor_actions = [],
			name,
			source,
			constructor,
			object_properties,
			uses_references = false,
			is_monomorphic = class_data.is_monomorphic;

		for (name in skeleton) {

			switch (skeleton[name].type) {
				case this.MEMBER_TYPES.STRING:
					if (is_monomorphic) {
						serialized_value = Firestorm.String.quote(skeleton[name].value);
					} else {
						prototype[name] = skeleton[name].value;
					}
					break;
				case this.MEMBER_TYPES.PRIMITIVE: // null, boolean, number
					if (is_monomorphic) {
						serialized_value = skeleton[name].value + '';
					} else {
						prototype[name] = skeleton[name].value;
					}
					break;
				case this.MEMBER_TYPES.EMPTY_ARRAY:
					serialized_value = "[]";
					break;
				case this.MEMBER_TYPES.INLINE_ARRAY:
					serialized_value = this._serializeInlineArray(skeleton[name].value);
					break;
				case this.MEMBER_TYPES.REGEXP:
				case this.MEMBER_TYPES.FUNCTION:
					prototype[name] = class_data.references[skeleton[name].index];
					break;
				case this.MEMBER_TYPES.SLICE_ARRAY:
					serialized_value = 'r[' + skeleton[name].index + '].slice()';
					uses_references = true;
					break;
				case this.MEMBER_TYPES.OBJECT:
					object_properties = [];
					if (this._serializeSkeleton(skeleton[name].skeleton, class_data, "\t", object_properties)) {
						uses_references = true;
					}
					serialized_value = object_properties.length
						? "{\n\t" + object_properties.join(",\n\t") + "\n}"
						: "{}";
					break;
				default:
					Lava.t("[_buildRealConstructor] unknown property descriptor type: " + skeleton[name].type);
			}

			if (serialized_value) {

				if (Lava.VALID_PROPERTY_NAME_REGEX.test(name)) {

					constructor_actions.push('this.' + name + ' = ' + serialized_value);

				} else {

					constructor_actions.push('this[' + Firestorm.String.quote(name) + '] = ' + serialized_value);

				}

				serialized_value = null;

			}

		}

		for (name in class_data.shared) {

			prototype[name] = class_data.shared[name];

		}

		prototype.Class = class_data;

		source = (uses_references ? ("var r=this.Class.references;\n") : '')
			+ constructor_actions.join(";\n")
			+ ";";

		if (class_data.skeleton.init) {

			source += "\nthis.init.apply(this, arguments);";

		}

		constructor = new Function(source);
		// for Chrome we could assign prototype object directly,
		// but in Firefox this will result in performance degradation
		Firestorm.extend(constructor.prototype, prototype);
		return constructor;

	}
472966
function Line( graph ) {

	// INSTANCE ATTRIBUTES //

	this._parent = graph;
	this._root = undefined;
	this._children = {};
	this._config = {
		"type": "line",
		"interpolation": {
			"mode": "linear",
			"tension": 0.7
		},
		"labels": []
	};

	// DATA //

	this._data = graph._data;

	// TRANSFORMS //

	this._transforms = {
		'x': function X( d ) {
			return graph._xScale( d[ 0 ] );
		},
		'y': function Y( d ) {
			return graph._yScale( d[ 1 ] );
		}
	};

	// GENERATOR //

	this._path = this.path()
		.x( this._transforms.x )
		.y( this._transforms.y )
		.interpolate( this._config.interpolation.mode )
		.tension( this._config.interpolation.tension );

	// REGISTER //
	if ( graph._config.hasOwnProperty( 'marks' ) ) {
		graph._config.marks.push( this._config );
	} else {
		graph._config.marks = [ this._config ];
	}
	if ( graph._children.hasOwnProperty( 'marks' ) ) {
		graph._children.marks.push( this );
	} else {
		graph._children.marks = [ this ];
	}

	return this;
}
793608
function toElem(shapes, callback) {
			var typeofShape;
			var txt = null;
			var k = 0;
			for (var i = 0; i < shapes.length; i++) {
						typeofShape = shapes[i].type;
						if (typeofShape == "text") {
									txt = shapes[i].txt;
									delete shapes[i].txt;
						}
						if (shapes[i].class) {
									shapes[i].className = shapes[i].class;
									delete shapes[i].class;
						}
						delete shapes[i].type;
						shapes[i].key = shapes[i].key || k++;
						if (callback) shapes[i].onClick = callback.bind(null, shapes[i].key); // Replace this by null for React
						shapes[i] = React.createElement(typeofShape, shapes[i], txt);
			}
			return shapes;
}
1110448
function Iterator(iterator) {

    if (Array.isArray(iterator) || typeof iterator == "string")
        return Iterator.iterate(iterator);

    iterator = Object(iterator);

    if (!(this instanceof Iterator))
        return new Iterator(iterator);

    this.next = this.send =
        iterator.send || iterator.next || iterator;

    if (
        Object.prototype.toString.call(this.next) !=
        "[object Function]"
    )
        throw new TypeError();

}
20837
function registerElementPatch(_global) {
    if (!isBrowser || !('registerElement' in _global.document)) {
        return;
    }
    var _registerElement = document.registerElement;
    var callbacks = ['createdCallback', 'attachedCallback', 'detachedCallback', 'attributeChangedCallback'];
    document.registerElement = function (name, opts) {
        if (opts && opts.prototype) {
            callbacks.forEach(function (callback) {
                var source = 'Document.registerElement::' + callback;
                if (opts.prototype.hasOwnProperty(callback)) {
                    var descriptor = Object.getOwnPropertyDescriptor(opts.prototype, callback);
                    if (descriptor && descriptor.value) {
                        descriptor.value = Zone.current.wrap(descriptor.value, source);
                        _redefineProperty(opts.prototype, callback, descriptor);
                    }
                    else {
                        opts.prototype[callback] = Zone.current.wrap(opts.prototype[callback], source);
                    }
                }
                else if (opts.prototype[callback]) {
                    opts.prototype[callback] = Zone.current.wrap(opts.prototype[callback], source);
                }
            });
        }
        return _registerElement.apply(document, [name, opts]);
    };
}
1239161
function iterator ()
            {
                for (var i=0; i<obj.data.length; ++i) {
                    
                    // This produces a very slight easing effect
                    obj.data[i] = data[i] * RG.Effects.getEasingMultiplier(frames, numFrame);
                }
                
                RGraph.clear(obj.canvas);
                RGraph.redrawCanvas(obj.canvas);
    
                if (++numFrame < frames) {
                    RGraph.Effects.updateCanvas(iterator);
                } else {
                    callback(obj);
                }
            }
1260234
function addRelToGraph(node){
    var children = [];
    for (var prop in node){
        if(node.hasOwnProperty(prop)){
            if (typeof node[prop] === 'object') {

                var linkedNodes = node[prop];
                // same for links
                if (colorsByLinkType[prop] == null) {
                    colorsByLinkType[prop] = getRandomColor();
                }
                
                for (var i = 0; i < linkedNodes.length; i++) {
                    //find node by id in the array (using jQuery)
                    const linkedNode = linkedNodes[i];
                    var nodeResult = getNodeFromId(linkedNode);
                    gChildrenNodes.push(nodeResult);
                    children.push(nodeResult);
                    //if the node is displayed, we add a link otherwise we will need to add it later
                    if (contains(gNodesDisplayed, nodeResult)){
                        g.addLink(node._id, nodeResult._id, prop);
                    } else {
                        nodesToBeLinked[nodeResult._id] = delayLinkCreation(node._id, nodeResult._id, prop);
                    }


                }
            }
        }
    }
    gNodesWithChildren[node._id] = children;
}
557290
private void appendBehaviorMembersToBlock(final PolymerClassDefinition cls, Node block) {
    String qualifiedPath = cls.target.getQualifiedName() + ".prototype.";
    Map<String, Node> nameToExprResult = new HashMap<>();
    for (BehaviorDefinition behavior : cls.behaviors) {
      for (MemberDefinition behaviorFunction : behavior.functionsToCopy) {
        String fnName = behaviorFunction.name.getString();
        // Don't copy functions already defined by the element itself.
        if (NodeUtil.getFirstPropMatchingKey(cls.descriptor, fnName) != null) {
          continue;
        }

        // Avoid copying over the same function twice. The last definition always wins.
        if (nameToExprResult.containsKey(fnName)) {
          block.removeChild(nameToExprResult.get(fnName));
        }

        Node fnValue = behaviorFunction.value.cloneTree();
        NodeUtil.markNewScopesChanged(fnValue, compiler);
        Node exprResult =
            IR.exprResult(IR.assign(NodeUtil.newQName(compiler, qualifiedPath + fnName), fnValue));
        exprResult.useSourceInfoIfMissingFromForTree(behaviorFunction.name);
        JSDocInfoBuilder info = JSDocInfoBuilder.maybeCopyFrom(behaviorFunction.info);
        // Uses of private members that come from behaviors are not recognized correctly,
        // so just suppress that warning.
        info.addSuppression("unusedPrivateMembers");

        // If the function in the behavior is @protected, switch it to @public so that
        // we don't get a visibility warning. This is a bit of a hack but easier than
        // making the type system understand that methods are "inherited" from behaviors.
        if (behaviorFunction.info != null
            && behaviorFunction.info.getVisibility() == Visibility.PROTECTED) {
          info.overwriteVisibility(Visibility.PUBLIC);
        }

        // Behaviors whose declarations are not in the global scope may contain references to
        // symbols which do not exist in the element's scope. Only copy a function stub.
        if (!behavior.isGlobalDeclaration) {
          NodeUtil.getFunctionBody(fnValue).removeChildren();
        }

        exprResult.getFirstChild().setJSDocInfo(info.build());
        block.addChildToBack(exprResult);
        nameToExprResult.put(fnName, exprResult);
      }

      // Copy other members.
      for (MemberDefinition behaviorProp : behavior.nonPropertyMembersToCopy) {
        String propName = behaviorProp.name.getString();
        if (nameToExprResult.containsKey(propName)) {
          block.removeChild(nameToExprResult.get(propName));
        }

        Node exprResult = IR.exprResult(NodeUtil.newQName(compiler, qualifiedPath + propName));
        exprResult.useSourceInfoFromForTree(behaviorProp.name);
        JSDocInfoBuilder info = JSDocInfoBuilder.maybeCopyFrom(behaviorProp.info);

        if (behaviorProp.name.isGetterDef()) {
          info = new JSDocInfoBuilder(true);
          if (behaviorProp.info != null && behaviorProp.info.getReturnType() != null) {
            info.recordType(behaviorProp.info.getReturnType());
          }
        }

        exprResult.getFirstChild().setJSDocInfo(info.build());
        block.addChildToBack(exprResult);
        nameToExprResult.put(propName, exprResult);
      }
    }
  }
1295748
function (node) {
                _addResult(node);
                ASTWalker.simple(node, {
                    /*
                        class <className> () {
                            <methodName> () {
                            
                            }
                        }
                    */
                    MethodDefinition: function (methodNode) {
                        _addResult(methodNode, methodNode.key.start, node.id.name);
                    }
                });
            }
488642
function topologicalSort(graph) {
    var processed = [],
        unprocessed = [],
        queue = [];

    /**
     *
     * @param arr
     * @param callback
     * @this {Object}
     */
    function each(arr, callback) {
        var i = void 0;

        // if Array, then process as array
        if (arr instanceof Array) {
            for (i = 0; i < arr.length; i++) {
                callback.call(arr[i], i);
            }
        }

        // if object, iterate over property/keys
        else {
                for (i in arr) {
                    if (arr.hasOwnProperty(i)) {
                        callback.call(arr[i], i);
                    }
                }
            }
    }

    function processStartingPoint(node) {
        if (node === undefined) {
            throw 'You have a cycle!!';
        }
        each(node.edges, function () {
            node.sortImportance--;
        });
        processed.push(node);
    }

    var populateIndegreesAndUnprocessed = function populateIndegreesAndUnprocessed() {
        each(graph.nodes, function () {
            var self = this;
            unprocessed.push(this);
            if (!Object.prototype.hasOwnProperty.call(self, 'sortImportance')) {
                self.sortImportance = 0;
            }

            each(self.edges, function () {
                self.sortImportance++;
            });
        });
    };

    populateIndegreesAndUnprocessed();

    while (unprocessed.length > 0) {
        for (var i = 0; i < unprocessed.length; i++) {
            var node = unprocessed[i];
            if (node.sortImportance === 0) {
                queue.push(node);
                unprocessed.splice(i, 1); // Remove this node, its all done.
                i--; // decrement i since we just removed that index from the iterated list;
            } else {
                node.sortImportance--;
            }
        }

        if (queue.length > 0) {
            processStartingPoint(queue.shift());
        }
    }

    return processed;
}
974994
function attachStaticFromMethod(Class) {

  /**
   * Builds a graph from serialized data or another graph's data.
   *
   * @param  {Graph|SerializedGraph} data      - Hydratation data.
   * @param  {object}                [options] - Options.
   * @return {Class}
   */
  Class.from = function(data, options) {
    const instance = new Class(options);
    instance.import(data);

    return instance;
  };
}
716461
function addDescriptorToStatic(target, key, descriptor, inherit) {

		if (inherit == null) {
			inherit = true;
		}

		if (inherit) {
			addToStaticChain(target, key, descriptor);
		}

		Object.defineProperty(target, key, descriptor);
	}
7095
public void print(ProjectModel project, Writer w, boolean includeClasses) {
		PrintWriter out = new PrintWriter(w);

		out.println("digraph ModuleGraph {");
		if (includeClasses) {
			out.println("ratio=1;");
		} else {
			out.println("overlap=false;");
			out.println("spline=true;");
		}

		if (layoutHorizontal) {
			out.println("rankdir=\"LR\";");
		}

		int i = 0;
		// print nodes
		for (ModuleModel module : project.getModules().values()) {
			if (module.isHideFromDependencyGraphOutput()) {
				continue;
			}

			if (includeClasses) {
				out.printf("subgraph cluster%d {\n", i++);
			}

			out.printf(
					"  \"MODULE$%s\" [label=\"%s\", shape=box, tooltip=\"%s\"%s];\n",
					module.getQualifiedNameOfRepresentingClass(),
					module.getIdentification(),
					(module.getDescription() != null && !module
							.getDescription().isEmpty()) ? module
							.getDescription() : "No Description",
					includeClasses ? ", color=green" : "");

			if (includeClasses) {
				for (ClassModel clazz : module.getClasses()) {
					out.printf("  \"CLASS$%s\" [label=\"%s\"];\n",
							clazz.getQualifiedName(), clazz.getSimpleName());
				}
			}

			if (includeClasses) {
				out.printf("}\n");
			}
		}

		// print edges

		for (ModuleModel module : project.getModules().values()) {
			if (module.isHideFromDependencyGraphOutput()) {
				continue;
			}
			for (ModuleModel imported : module.getImportedModules()) {
				if (imported.isHideFromDependencyGraphOutput()) {
					continue;
				}
				out.printf("\"MODULE$%s\"->\"MODULE$%s\"%s;\n",
						module.getQualifiedNameOfRepresentingClass(),
						imported.getQualifiedNameOfRepresentingClass(),
						includeClasses ? " [color=green]" : "");
			}
			for (ModuleModel exported : module.getExportedModules()) {
				if (exported.isHideFromDependencyGraphOutput()) {
					continue;
				}
				out.printf("\"MODULE$%s\"->\"MODULE$%s\" [color=green];\n",
						module.getQualifiedNameOfRepresentingClass(),
						exported.getQualifiedNameOfRepresentingClass());
			}

		}

		if (includeClasses) {
			for (ClassModel clazz : project.getClasses().values()) {
				for (ClassModel used : clazz.getUsesClasses()) {
					if (used.equals(clazz)) {
						continue;
					}
					out.printf("\"CLASS$%s\"->\"CLASS$%s\";\n",
							clazz.getQualifiedName(), used.getQualifiedName());
				}
			}
		}

		out.println("}");
		out.flush();
	}