src/main/java/org/iota/ict/ixi/GraphModule.java
public Bundle serialize(Pair<String, List<TransactionBuilder>>... finalizedVertexPair) {

        // put all transactions in a collection
        List<TransactionBuilder> collection = new ArrayList<>();
        for (Pair<String, List<TransactionBuilder>> pair : finalizedVertexPair)
            collection.addAll(pair.value);

        // sort transactions
        Collections.reverse(collection);

        // build bundle
        BundleBuilder bundleBuilder = new BundleBuilder();
        bundleBuilder.append(collection);
        Bundle bundle = bundleBuilder.build();

        // get bundle transactions
        List<Transaction> bundleTransactions = bundle.getTransactions();

        // map serialized vertex tail with virtual vertex tail
        for (Pair<String, List<TransactionBuilder>> pair : finalizedVertexPair) {

            // get virtual vertex tail
            String virtualTail = pair.key;

            // get transaction count
            int count = pair.value.size();

            // get serialized vertex tail
            String serializedTail = bundleTransactions.get(0).hash;

            // map virtual tail with serialized tail
            graph.addSerializedTail(virtualTail, serializedTail);

            // skip to next vertex
            bundleTransactions = bundleTransactions.subList(count, bundleTransactions.size());

        }

        return bundle;

    }
/**
     * Serializes bundle fragments ready to attach to the Tangle.
     * @param finalizedVertexPair the bundle fragments mapped with the virtual vertex tail to serialize
     * @return the bundle ready to attach to the Tangle
     */
Serializes bundle fragments ready to attach to the Tangle.
@param finalizedVertexPair the bundle fragments mapped with the virtual vertex tail to serialize
@return the bundle ready to attach to the Tangle
Serializes bundle fragments ready to attach to the Tangle . @param finalizedVertexPair the bundle fragments mapped with the virtual vertex tail to serialize @return the bundle ready to attach to the Tangle
public Bundle serialize(Pair<String, List<TransactionBuilder>>... finalizedVertexPair) {
        List<TransactionBuilder> collection = new ArrayList<>();
        for (Pair<String, List<TransactionBuilder>> pair : finalizedVertexPair)
            collection.addAll(pair.value);
        Collections.reverse(collection);
        BundleBuilder bundleBuilder = new BundleBuilder();
        bundleBuilder.append(collection);
        Bundle bundle = bundleBuilder.build();
        List<Transaction> bundleTransactions = bundle.getTransactions();
        for (Pair<String, List<TransactionBuilder>> pair : finalizedVertexPair) {
            String virtualTail = pair.key;
            int count = pair.value.size();
            String serializedTail = bundleTransactions.get(0).hash;
            graph.addSerializedTail(virtualTail, serializedTail);
            bundleTransactions = bundleTransactions.subList(count, bundleTransactions.size());
        }
        return bundle;
    }
public Bundle serialize ( Pair < String , List < TransactionBuilder > > ... finalizedVertexPair ) { List < TransactionBuilder > collection = new ArrayList < > ( ) ; for ( Pair < String , List < TransactionBuilder > > pair : finalizedVertexPair ) collection . addAll ( pair . value ) ; Collections . reverse ( collection ) ; BundleBuilder bundleBuilder = new BundleBuilder ( ) ; bundleBuilder . append ( collection ) ; Bundle bundle = bundleBuilder . build ( ) ; List < Transaction > bundleTransactions = bundle . getTransactions ( ) ; for ( Pair < String , List < TransactionBuilder > > pair : finalizedVertexPair ) { String virtualTail = pair . key ; int count = pair . value . size ( ) ; String serializedTail = bundleTransactions . get ( 0 ) . hash ; graph . addSerializedTail ( virtualTail , serializedTail ) ; bundleTransactions = bundleTransactions . subList ( count , bundleTransactions . size ( ) ) ; } return bundle ; }
Serializes bundle fragments ready to attach to the Tangle.
Serializes bundle fragments ready to attach to the Tangle .
// put all transactions in a collection // sort transactions // build bundle // get bundle transactions // map serialized vertex tail with virtual vertex tail // get virtual vertex tail // get transaction count // get serialized vertex tail // map virtual tail with serialized tail // skip to next vertex