src/main/java/org/iota/ict/ixi/GraphModule.java
public String[] deserializeAndStore(List<Transaction> bundle) {

        // Dissociate vertices from bundle
        List<List<Transaction>> vertices = new ArrayList<>();

        boolean vertexFragmentStart = false;
        List<Transaction> vertexFragment = new ArrayList<>();
        for (Transaction t : bundle) {

            if (InputValidator.hasVertexStartFlagSet(t))
                vertexFragmentStart = true;

            if(vertexFragmentStart)
                vertexFragment.add(t);

            if (InputValidator.hasVertexEndFlagSet(t))
                if (vertexFragmentStart) {
                    vertices.add(vertexFragment);
                    vertexFragmentStart = false;
                    vertexFragment = new ArrayList<>();
                }

        }

        List<String> tails = new ArrayList<>();

        // Get all edges of found vertices
        for (List<Transaction> vertex : vertices) {

            List<String> edges = new ArrayList<>();
            for (Transaction t : vertex) {
                for (String edge : t.signatureFragments().split("(?<=\\G.{81})"))
                    if (!edge.equals(Trytes.NULL_HASH))
                        edges.add(edge);
            }

            String data = vertex.get(0).extraDataDigest();
            Collections.reverse(edges);

            String tail = graph.createVertex(data, edges.toArray(new String[edges.size()]));
            tails.add(tail);
            graph.addSerializedTail(tail, vertex.get(0).hash);

        }

        return tails.toArray(new String[tails.size()]);

    }
/**
     * Deserializes and adds all vertices of a bundle fragment to the graph.
     * @param bundle the bundle to deserialize
     * @return to tails of the added vertices
     */
Deserializes and adds all vertices of a bundle fragment to the graph.
@param bundle the bundle to deserialize
@return to tails of the added vertices
Deserializes and adds all vertices of a bundle fragment to the graph . @param bundle the bundle to deserialize @return to tails of the added vertices
public String[] deserializeAndStore(List<Transaction> bundle) {
        List<List<Transaction>> vertices = new ArrayList<>();
        boolean vertexFragmentStart = false;
        List<Transaction> vertexFragment = new ArrayList<>();
        for (Transaction t : bundle) {
            if (InputValidator.hasVertexStartFlagSet(t))
                vertexFragmentStart = true;
            if(vertexFragmentStart)
                vertexFragment.add(t);
            if (InputValidator.hasVertexEndFlagSet(t))
                if (vertexFragmentStart) {
                    vertices.add(vertexFragment);
                    vertexFragmentStart = false;
                    vertexFragment = new ArrayList<>();
                }
        }
        List<String> tails = new ArrayList<>();
        for (List<Transaction> vertex : vertices) {
            List<String> edges = new ArrayList<>();
            for (Transaction t : vertex) {
                for (String edge : t.signatureFragments().split("(?<=\\G.{81})"))
                    if (!edge.equals(Trytes.NULL_HASH))
                        edges.add(edge);
            }
            String data = vertex.get(0).extraDataDigest();
            Collections.reverse(edges);
            String tail = graph.createVertex(data, edges.toArray(new String[edges.size()]));
            tails.add(tail);
            graph.addSerializedTail(tail, vertex.get(0).hash);
        }
        return tails.toArray(new String[tails.size()]);
    }
public String [ ] deserializeAndStore ( List < Transaction > bundle ) { List < List < Transaction > > vertices = new ArrayList < > ( ) ; boolean vertexFragmentStart = false ; List < Transaction > vertexFragment = new ArrayList < > ( ) ; for ( Transaction t : bundle ) { if ( InputValidator . hasVertexStartFlagSet ( t ) ) vertexFragmentStart = true ; if ( vertexFragmentStart ) vertexFragment . add ( t ) ; if ( InputValidator . hasVertexEndFlagSet ( t ) ) if ( vertexFragmentStart ) { vertices . add ( vertexFragment ) ; vertexFragmentStart = false ; vertexFragment = new ArrayList < > ( ) ; } } List < String > tails = new ArrayList < > ( ) ; for ( List < Transaction > vertex : vertices ) { List < String > edges = new ArrayList < > ( ) ; for ( Transaction t : vertex ) { for ( String edge : t . signatureFragments ( ) . split ( "(?<=\\G.{81})" ) ) if ( ! edge . equals ( Trytes . NULL_HASH ) ) edges . add ( edge ) ; } String data = vertex . get ( 0 ) . extraDataDigest ( ) ; Collections . reverse ( edges ) ; String tail = graph . createVertex ( data , edges . toArray ( new String [ edges . size ( ) ] ) ) ; tails . add ( tail ) ; graph . addSerializedTail ( tail , vertex . get ( 0 ) . hash ) ; } return tails . toArray ( new String [ tails . size ( ) ] ) ; }
Deserializes and adds all vertices of a bundle fragment to the graph.
Deserializes and adds all vertices of a bundle fragment to the graph .
// Dissociate vertices from bundle // Get all edges of found vertices