// Path: src/main/java/org/neo4j/neode/interfaces/UpdateDataset.java
// public interface UpdateDataset<T>
// {
//     T update( Dataset dataset, int batchSize );
// 
//     T update( Dataset dataset );
// 
//     void updateNoReturn( Dataset dataset, int batchSize );
// 
//     void updateNoReturn( Dataset dataset );
// }


import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import java.util.Set;
import org.neo4j.graphdb.*;
import org.neo4j.neode.interfaces.UpdateDataset;
    public NodeCollection approxPercentage( int percentage )
    {
        if ( percentage < 1 || percentage > 100 )
        {
            throw new IllegalArgumentException( "Percent must be between 1 and 100" );
        }

        Random random = new Random();

        int arraySize = nodeIds.size() * ((percentage + 10) / 100);
        Set<Long> newNodeIds = new HashSet<Long>( arraySize );
        for ( Long nodeId : nodeIds )
        {
            int score = random.nextInt( 100 ) + 1;
            if ( score <= percentage )
            {
                newNodeIds.add( nodeId );
            }
        }
        return new NodeCollection( db, label, newNodeIds );
    }

    public NodeCollection combine( NodeCollection other )
    {
        Set<Long> newNodeIds = new HashSet<Long>( nodeIds.size() + other.nodeIds.size() );
        newNodeIds.addAll( nodeIds );
        newNodeIds.addAll( other.nodeIds );
        return new NodeCollection( db, label, newNodeIds );
    }

// Path: src/main/java/org/neo4j/neode/interfaces/UpdateDataset.java
// public interface UpdateDataset<T>
// {
//     T update( Dataset dataset, int batchSize );
// 
//     T update( Dataset dataset );
// 
//     void updateNoReturn( Dataset dataset, int batchSize );
// 
//     void updateNoReturn( Dataset dataset );
// }


// Path: src/main/java/org/neo4j/neode/NodeCollection.java
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import java.util.Set;
import org.neo4j.graphdb.*;
import org.neo4j.neode.interfaces.UpdateDataset;

    public NodeCollection approxPercentage( int percentage )
    {
        if ( percentage < 1 || percentage > 100 )
        {
            throw new IllegalArgumentException( "Percent must be between 1 and 100" );
        }

        Random random = new Random();

        int arraySize = nodeIds.size() * ((percentage + 10) / 100);
        Set<Long> newNodeIds = new HashSet<Long>( arraySize );
        for ( Long nodeId : nodeIds )
        {
            int score = random.nextInt( 100 ) + 1;
            if ( score <= percentage )
            {
                newNodeIds.add( nodeId );
            }
        }
        return new NodeCollection( db, label, newNodeIds );
    }

    public NodeCollection combine( NodeCollection other )
    {
        Set<Long> newNodeIds = new HashSet<Long>( nodeIds.size() + other.nodeIds.size() );
        newNodeIds.addAll( nodeIds );
        newNodeIds.addAll( other.nodeIds );
        return new NodeCollection( db, label, newNodeIds );
    }

    public UpdateDataset<NodeCollection> createRelationshipsTo( TargetNodesStrategy targetNodesStrategy )