jbarrier

edu.bonn.cs.net.jbarrier.barrier
Class IntTournamentReduction

java.lang.Object
  extended by edu.bonn.cs.net.jbarrier.barrier.AbstractBarrier
      extended by edu.bonn.cs.net.jbarrier.barrier.TournamentBarrier
          extended by edu.bonn.cs.net.jbarrier.barrier.IntTournamentReduction
All Implemented Interfaces:
Barrier, IntReduction

public class IntTournamentReduction
extends TournamentBarrier
implements IntReduction

Implementation of a tournament barrier algorithm including a int reduction.

Version:
1.0
Author:
Patrick Peschlow, Ivan Castilla Rodriguez

Nested Class Summary
 
Nested classes/interfaces inherited from class edu.bonn.cs.net.jbarrier.barrier.TournamentBarrier
TournamentBarrier.Role, TournamentBarrier.Round, TournamentBarrier.TournamentBarrierParty
 
Field Summary
 
Fields inherited from class edu.bonn.cs.net.jbarrier.barrier.TournamentBarrier
flagOut_, numRounds_
 
Fields inherited from class edu.bonn.cs.net.jbarrier.barrier.AbstractBarrier
action_, genericReductor_, numParties_
 
Constructor Summary
IntTournamentReduction(int numParties, ReductionOperator reductor)
          Constructor.
IntTournamentReduction(int numParties, java.lang.Runnable barrierAction, ReductionOperator reductor)
          Constructor.
 
Method Summary
 int await(int threadId, int value)
          Called by a party that reaches the barrier.
protected  void setUpParties()
          Sets up the parties array required for this reduction subclass.
 
Methods inherited from class edu.bonn.cs.net.jbarrier.barrier.TournamentBarrier
await
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntTournamentReduction

public IntTournamentReduction(int numParties,
                              java.lang.Runnable barrierAction,
                              ReductionOperator reductor)
Constructor.

Parameters:
numParties - the number of parties that must reach the barrier before the barrier is tripped
barrierAction - the command to execute when the barrier is tripped, or null if there is no action
reductor - the reduction operator to use

IntTournamentReduction

public IntTournamentReduction(int numParties,
                              ReductionOperator reductor)
Constructor.

Parameters:
numParties - the number of parties that must reach the barrier before the barrier is tripped
reductor - the reduction operator to use
Method Detail

setUpParties

protected void setUpParties()
Sets up the parties array required for this reduction subclass.

Overrides:
setUpParties in class TournamentBarrier

await

public int await(int threadId,
                 int value)
Called by a party that reaches the barrier.

Specified by:
await in interface IntReduction
Parameters:
threadId - the ID of the party
value - the value subject to the reduction
Returns:
the result of the reduction

jbarrier

Copyright 2010 Patrick Peschlow