Creates a stream.
@param <T>
@param root
@param edges
@return
503597
public static <T> Stream<T> stream(T root, Function<? super T, ? extends Stream<T>> edges)
    {
        return StreamSupport.stream(spliterator(root, edges), false);
    }
901719
@Override
	public InputStream createResourceAsStream(GeneratorContext context) {

		String path = context.getPath();
		return rd.getResourceAsStream(path);
	}
382487
public void initDownstream()
	{
		for (Interaction inter : getDownstreamInteractions(pe.getParticipantOf()))
		{
			AbstractNode node = (AbstractNode) graph.getGraphObject(inter);

			if (node == null) continue;

			if (inter instanceof Conversion)
			{
				Conversion conv = (Conversion) inter;
				ConversionWrapper conW = (ConversionWrapper) node;
				if (conv.getConversionDirection() == ConversionDirectionType.REVERSIBLE &&
					conv.getRight().contains(pe))
				{
					node = conW.getReverse();
				}
			}

			Edge edge = new EdgeL3(this, node, graph);
			this.getDownstreamNoInit().add(edge);
			node.getUpstreamNoInit().add(edge);
		}
	}
194623
protected void createRootNode() {
		final Node<K, V> node = createLeafNode();
		node.allocId();
		rootIdx = node.id;
		height = 1;
		elements = 0;
		putNode(node);
	}
409881
@javax.annotation.Nonnull
  public PipedInputStream newInputStream() throws IOException {
    @javax.annotation.Nonnull final com.simiacryptus.util.io.TeeOutputStream outTee = this;
    @javax.annotation.Nonnull final AtomicReference<Runnable> onClose = new AtomicReference<>();
    @javax.annotation.Nonnull final PipedOutputStream outPipe = new PipedOutputStream();
    @javax.annotation.Nonnull final PipedInputStream in = new PipedInputStream() {
      @Override
      public void close() throws IOException {
        outPipe.close();
        super.close();
      }
    };
    outPipe.connect(in);
    @javax.annotation.Nonnull final OutputStream outAsync = new AsyncOutputStream(outPipe);
    new Thread(() -> {
      try {
        if (null != heapBuffer) {
          outAsync.write(heapBuffer.toByteArray());
          outAsync.flush();
        }
        outTee.branches.add(outAsync);
      } catch (@javax.annotation.Nonnull final IOException e) {
        e.printStackTrace();
      }
    }).start();
    onClose.set(() -> {
      outTee.branches.remove(outAsync);
      System.err.println("END HTTP Session");
    });
    return in;
  }
521349
public static <T> Link<T> make(Link<T> root, T object) {
        Link<T> link = new Link<>(object);

        if (root == null) {
            root = link;
        } else if (root.last == null) {
            root.next = link;
        } else {
            root.last.next = link;
        }
        root.last = link;
        return root;
    }
351818
@Override
	public void initDownstream()
	{
		for (Process prc : ctrl.getControlled())
		{
			if (prc instanceof Conversion ||
				prc instanceof Control ||
				prc instanceof TemplateReaction)
			{
				AbstractNode node = (AbstractNode) graph.getGraphObject(prc);

				if (node != null)
				{
					Edge edge = new EdgeL3(this, node, graph);
					node.getUpstreamNoInit().add(edge);
					getDownstreamNoInit().add(edge);
				}
			}
		}
	}
1002417
public static void generateEdgeLine(StringWriter sw, ObjectMapper mapper, EdgeBean eBean) throws JsonGenerationException, JsonMappingException, IOException {
        sw.getBuffer().setLength(0);
        
        sw.append('E'); // Record type
        sw.append('=');
        
        mapper.writeValue(sw, eBean);
        
        sw.append('#');
        
        int hashCode = sw.toString().hashCode(); 
        sw.append(toHex(hashCode));
        sw.append('\n');
    }
1038557
@Override
    public EdgeIteratorState edge(int nodeA, int nodeB) {
        if (isFrozen())
            throw new IllegalStateException("Cannot create edge if graph is already frozen");

        ensureNodeIndex(Math.max(nodeA, nodeB));
        int edgeId = edgeAccess.internalEdgeAdd(nextEdgeId(), nodeA, nodeB);
        EdgeIterable iter = new EdgeIterable(this, edgeAccess, EdgeFilter.ALL_EDGES);
        boolean ret = iter.init(edgeId, nodeB);
        assert ret;
        if (extStorage.isRequireEdgeField())
            iter.setAdditionalField(extStorage.getDefaultEdgeFieldValue());

        return iter;
    }
1130321
@Direct
  @Override
  public void getStream(RowCursor cursor, 
                        Result<GetStreamResult> result)
  {
    long version = cursor.getVersion();
    
    PageLeafImpl leaf = getLeafByCursor(cursor);
    
    if (leaf == null) {
      result.ok(new GetStreamResult(false, null));
      return;
    }
    
    if (! leaf.get(cursor)) {
      result.ok(new GetStreamResult(false, null));
      return;
    }

    if (version == cursor.getVersion()) {
      result.ok(new GetStreamResult(true, null));
      return;
    }
    
    StreamSource ss = leaf.getStream(cursor, this);
    
    boolean isFound = ss != null;

    result.ok(new GetStreamResult(isFound, ss));
  }
1163023
Stream<Casting> castingsInstance() {
        return vertex().getEdgesOfType(Direction.IN, Schema.EdgeLabel.ROLE_PLAYER).
                map(edge -> Casting.withThing(edge, this));
    }
71502
public JimfsPath createRoot(Name root) {
    return createPath(checkNotNull(root), ImmutableList.<Name>of());
  }
877537
public static <K, EV> Graph<K, NullValue, EV> fromCollection(Collection<Edge<K, EV>> edges,
			ExecutionEnvironment context) {

		return fromDataSet(context.fromCollection(edges), context);
	}
85613
public void write(Graph<? extends Edge> g, File gexfFile) 
            throws IOException {
        write(g, gexfFile, null);
    }
509879
public static RasterData load(Xml root, String color)
    {
        final Xml node = root.getChild(color);
        final double force = node.readDouble(ATT_FORCE);
        final int amplitude = node.readInteger(ATT_AMPLITUDE);
        final int offset = node.readInteger(ATT_OFFSET);
        final int type = node.readInteger(ATT_TYPE);

        return new RasterData(force, amplitude, offset, type);
    }
754675
public <T> T read(final InputStream input, Class<T> rootType) {
        try {
            try {
                reader = factory().createXMLEventReader(input);
                return read(rootType);
            } finally {
                if (reader != null) {
                    reader.close();
                }
            }
        } catch (RuntimeException ex) {
            throw ex;
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
    }
641583
public static <T> Spliterator<T> spliterator(T root, Function<? super T, ? extends Stream<T>> edges)
    {
        DiGraphIterator dgi = new DiGraphIterator(root, edges);
        return Spliterators.spliteratorUnknownSize(dgi, 0);
    }