de.zib.scalaris.executor
Class ScalarisIncrementOp2<T extends Number>

java.lang.Object
  extended by de.zib.scalaris.executor.ScalarisIncrementOp2<T>
Type Parameters:
T - the type of the value to write
All Implemented Interfaces:
ScalarisOp

public class ScalarisIncrementOp2<T extends Number>
extends Object
implements ScalarisOp

Implements an increment operation using the increment operation of Scalaris.

Since:
3.13
Version:
3.13
Author:
Nico Kruber, kruber@zib.de

Constructor Summary
ScalarisIncrementOp2(String key, T value)
          Creates a write operation.
 
Method Summary
 int doPhase(int phase, int firstOp, ResultList results, RequestList requests)
          Executes the given phase.
 T getIncValue()
          Gets the value to increment by.
 String getKey()
          Gets the key to write to.
 String toString()
           
 int workPhases()
          Gets the number of work phases needed by this operation (not including the final result verification phase).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScalarisIncrementOp2

public ScalarisIncrementOp2(String key,
                            T value)
Creates a write operation.

Parameters:
key - the key to write to
value - the value to write
Method Detail

workPhases

public int workPhases()
Description copied from interface: ScalarisOp
Gets the number of work phases needed by this operation (not including the final result verification phase).

Specified by:
workPhases in interface ScalarisOp
Returns:
number of required phases

doPhase

public final int doPhase(int phase,
                         int firstOp,
                         ResultList results,
                         RequestList requests)
                  throws OtpErlangException,
                         UnknownException,
                         IllegalArgumentException
Description copied from interface: ScalarisOp
Executes the given phase.

Specified by:
doPhase in interface ScalarisOp
Parameters:
phase - the number of the current phase
firstOp - the current operation's index in the result list
results - the results from the previous operations (may be null if there was none)
requests - the requests for the next operations (may be null if there are none, i.e. in the verification phase)
Returns:
the number of processed operations from the results list
Throws:
OtpErlangException - if an error occured verifying a result from previous operations
UnknownException - if an error occured verifying a result from previous operations
IllegalArgumentException - if the given work phase is not supported
See Also:
ScalarisOp.workPhases()

toString

public String toString()
Specified by:
toString in interface ScalarisOp
Overrides:
toString in class Object

getKey

public String getKey()
Gets the key to write to.

Returns:
the key

getIncValue

public T getIncValue()
Gets the value to increment by.

Returns:
the value