All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dk.alexandra.fresco.lib.generic.InsecureBroadcastProtocol Maven / Gradle / Ivy

package dk.alexandra.fresco.lib.generic;

import dk.alexandra.fresco.framework.NativeProtocol;
import dk.alexandra.fresco.framework.network.Network;
import dk.alexandra.fresco.framework.sce.resources.ResourcePool;
import java.util.List;

/**
 * Generic native protocol implementing insecure broadcast. 

Used as a building block in {@link * BroadcastComputation}.

*/ public class InsecureBroadcastProtocol implements NativeProtocol, ResourcePoolT> { private final byte[] input; private List result; /** * Creates new {@link InsecureBroadcastProtocol}. * * @param input own input to broadcast */ public InsecureBroadcastProtocol(byte[] input) { this.input = input; } @Override public List out() { return result; } @Override public EvaluationStatus evaluate(int round, ResourcePoolT resourcePool, Network network) { if (round == 0) { network.sendToAll(input.clone()); return EvaluationStatus.HAS_MORE_ROUNDS; } else { result = network.receiveFromAll(); return EvaluationStatus.IS_DONE; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy