// Path: src/main/java/com/tinkerpop/furnace/algorithms/vertexcentric/GraphMemory.java
// public interface GraphMemory {
// 
//     public <R> R get(final String key);
// 
//     public void setIfAbsent(String key, Object value);
// 
//     public long increment(String key, long delta);
// 
//     public long decrement(String key, long delta);
// 
//     public int getIteration();
// 
//     public long getRuntime();
// 
//     public boolean isInitialIteration();
// 
//     /*public void min(String key, double value);
// 
//     public void max(String key, double value);
// 
//     public void avg(String key, double value);
// 
//     public <V> void update(String key, Function<V, V> update, V defaultValue);*/
// 
//     // public Map<String, Object> getCurrentState();
// }
// 
// Path: src/main/java/com/tinkerpop/furnace/algorithms/vertexcentric/programs/AbstractVertexProgram.java
// public abstract class AbstractVertexProgram implements VertexProgram {
// 
//     protected final Map<String, KeyType> computeKeys = new HashMap<String, KeyType>();
// 
//     public Map<String, KeyType> getComputeKeys() {
//         return computeKeys;
//     }
// 
//     public void setup(final GraphMemory graphMemory) {
// 
//     }
// 
//     public String toString() {
//         return this.getClass().getSimpleName() + "[" + computeKeys.keySet() + "]";
//     }
// }


import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.furnace.algorithms.vertexcentric.GraphMemory;
import com.tinkerpop.furnace.algorithms.vertexcentric.programs.AbstractVertexProgram;
import java.util.HashMap;
import java.util.Map;
package com.tinkerpop.furnace.algorithms.vertexcentric.programs.swarm;



/**
 * @author Marko A. Rodriguez (http://markorodriguez.com)
 */
public class SwarmProgram extends AbstractVertexProgram {

    private Map<Particle, Long> startParticles = new HashMap<Particle, Long>();

    public static final String PARTICLES = SwarmProgram.class.getName() + ".particles";

    protected SwarmProgram() {
    }

    private void setComputeKeys() {
        this.computeKeys.put(PARTICLES, KeyType.VARIABLE);
        for (final Particle particle : this.startParticles.keySet()) {
            this.computeKeys.putAll(particle.getComputeKeys());
        }
    }

// Path: src/main/java/com/tinkerpop/furnace/algorithms/vertexcentric/GraphMemory.java
// public interface GraphMemory {
// 
//     public <R> R get(final String key);
// 
//     public void setIfAbsent(String key, Object value);
// 
//     public long increment(String key, long delta);
// 
//     public long decrement(String key, long delta);
// 
//     public int getIteration();
// 
//     public long getRuntime();
// 
//     public boolean isInitialIteration();
// 
//     /*public void min(String key, double value);
// 
//     public void max(String key, double value);
// 
//     public void avg(String key, double value);
// 
//     public <V> void update(String key, Function<V, V> update, V defaultValue);*/
// 
//     // public Map<String, Object> getCurrentState();
// }
// 
// Path: src/main/java/com/tinkerpop/furnace/algorithms/vertexcentric/programs/AbstractVertexProgram.java
// public abstract class AbstractVertexProgram implements VertexProgram {
// 
//     protected final Map<String, KeyType> computeKeys = new HashMap<String, KeyType>();
// 
//     public Map<String, KeyType> getComputeKeys() {
//         return computeKeys;
//     }
// 
//     public void setup(final GraphMemory graphMemory) {
// 
//     }
// 
//     public String toString() {
//         return this.getClass().getSimpleName() + "[" + computeKeys.keySet() + "]";
//     }
// }


// Path: src/main/java/com/tinkerpop/furnace/algorithms/vertexcentric/programs/swarm/SwarmProgram.java
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.furnace.algorithms.vertexcentric.GraphMemory;
import com.tinkerpop.furnace.algorithms.vertexcentric.programs.AbstractVertexProgram;
import java.util.HashMap;
import java.util.Map;

package com.tinkerpop.furnace.algorithms.vertexcentric.programs.swarm;



/**
 * @author Marko A. Rodriguez (http://markorodriguez.com)
 */
public class SwarmProgram extends AbstractVertexProgram {

    private Map<Particle, Long> startParticles = new HashMap<Particle, Long>();

    public static final String PARTICLES = SwarmProgram.class.getName() + ".particles";

    protected SwarmProgram() {
    }

    private void setComputeKeys() {
        this.computeKeys.put(PARTICLES, KeyType.VARIABLE);
        for (final Particle particle : this.startParticles.keySet()) {
            this.computeKeys.putAll(particle.getComputeKeys());
        }
    }

    public void execute(final Vertex vertex, final GraphMemory graphMemory) {