RequestList
Date: 2016-02-29

de.zib.scalaris

## Class RequestList

- java.lang.Object
- - de.zib.scalaris.RequestList

- Direct Known Subclasses:
    Transaction.RequestList, TransactionSingleOp.RequestList

      public abstract class RequestList
      extends Object

  Generic request list.
  Since:
    3.5
  Version:
    3.18
  Author:
    Nico Kruber, kruber@zib.de

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `RequestList` | `addAddDelOnList(OtpErlangString key, OtpErlangList toAdd, OtpErlangList toRemove)` Deprecated.
    `<T> RequestList` | `addAddDelOnList(String key, List<T> toAdd, List<T> toRemove)` Deprecated.
    `RequestList` | `addAddOnNr(OtpErlangString key, OtpErlangDouble toAdd)` Deprecated.
    `RequestList` | `addAddOnNr(OtpErlangString key, OtpErlangLong toAdd)` Deprecated.
    `RequestList` | `addAddOnNr(String key, Double toAdd)` Deprecated.
    `<T extends Number> RequestList` | `addAddOnNr(String key, T toAdd)` Deprecated.
    `RequestList` | `addCommit()` Adds a commit operation to the list of requests.
    `RequestList` | `addOp(Operation op)` Adds a generic operation to the list of requests.
    `RequestList` | `addRead(OtpErlangString key)` Deprecated.
    `RequestList` | `addRead(String key)` Deprecated.
    `RequestList` | `addTestAndSet(OtpErlangString key, OtpErlangObject oldValue, OtpErlangObject newValue)` Deprecated.
    `<OldT,NewT> RequestList` | `addTestAndSet(String key, OldT oldValue, NewT newValue)` Deprecated.
    `RequestList` | `addWrite(OtpErlangString key, OtpErlangObject value)` Deprecated.
    `<T> RequestList` | `addWrite(String key, T value)` Deprecated.
    `CommitOp` | `getCommit()` Returns the commit operation (if present).
    `List<Operation>` | `getRequests()` Gets all operations of the request list.
    `boolean` | `isCommit()` Returns whether the transactions contains a commit or not.
    `boolean` | `isEmpty()` Checks whether the request list is empty.
    `int` | `size()` Gets the number of requests in the list.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### addOp

          public RequestList addOp(Operation op)
                            throws UnsupportedOperationException

      Adds a generic operation to the list of requests.
      Parameters:
        `op` - the operation to add
      Returns:
        this `RequestList` object
      Throws:
        `UnsupportedOperationException` - if the operation is unsupported, e.g. there may only be one "commit" in a request list and no request after that

    - #### addRead

          @Deprecated
          public RequestList addRead(OtpErlangString key)
                              throws UnsupportedOperationException

      Deprecated.
      Adds a read operation to the list of requests.
      Parameters:
        `key` - the key to read
      Returns:
        this `RequestList` object
      Throws:
        `UnsupportedOperationException` - if the operation is unsupported, e.g. there may only be one "commit" in a request list and no request after that

    - #### addRead

          @Deprecated
          public RequestList addRead(String key)
                              throws UnsupportedOperationException

      Deprecated.
      Adds a read operation to the list of requests.
      Parameters:
        `key` - the key to read
      Returns:
        this `RequestList` object
      Throws:
        `UnsupportedOperationException` - if the operation is unsupported, e.g. there may only be one "commit" in a request list and no request after that

    - #### addWrite

          @Deprecated
          public RequestList addWrite(OtpErlangString key,
                                        OtpErlangObject value)
                               throws UnsupportedOperationException

      Deprecated.
      Adds a write operation to the list of requests.
      Parameters:
        `key` - the key to write the value to
        `value` - the value to write
      Returns:
        this `RequestList` object
      Throws:
        `UnsupportedOperationException` - if the operation is unsupported, e.g. there may only be one "commit" in a request list and no request after that

    - #### addWrite

          @Deprecated
          public <T> RequestList addWrite(String key,
                                            T value)
                               throws UnsupportedOperationException

      Deprecated.
      Adds a write operation to the list of requests.
      Type Parameters:
        `T` - type of the value to write
      Parameters:
        `key` - the key to write the value to
        `value` - the value to write
      Returns:
        this `RequestList` object
      Throws:
        `UnsupportedOperationException` - if the operation is unsupported, e.g. there may only be one "commit" in a request list and no request after that

    - #### addAddDelOnList

          @Deprecated
          public RequestList addAddDelOnList(OtpErlangString key,
                                               OtpErlangList toAdd,
                                               OtpErlangList toRemove)
                                      throws UnsupportedOperationException

      Deprecated.
      Adds a add_del_on_list operation to the list of requests.
      Parameters:
        `key` - the key to write the value to
        `toAdd` - a list of values to add to a list
        `toRemove` - a list of values to remove from a list
      Returns:
        this `RequestList` object
      Throws:
        `UnsupportedOperationException` - if the operation is unsupported, e.g. there may only be one "commit" in a request list and no request after that
      Since:
        3.9

    - #### addAddDelOnList

          @Deprecated
          public <T> RequestList addAddDelOnList(String key,
                                                   List<T> toAdd,
                                                   List<T> toRemove)
                                      throws UnsupportedOperationException

      Deprecated.
      Adds a add_del_on_list operation to the list of requests.
      Type Parameters:
        `T` - type of the value to write
      Parameters:
        `key` - the key to write the value to
        `toAdd` - a list of values to add to a list
        `toRemove` - a list of values to remove from a list
      Returns:
        this `RequestList` object
      Throws:
        `UnsupportedOperationException` - if the operation is unsupported, e.g. there may only be one "commit" in a request list and no request after that
      Since:
        3.9

    - #### addAddOnNr

          @Deprecated
          public RequestList addAddOnNr(OtpErlangString key,
                                          OtpErlangLong toAdd)
                                 throws UnsupportedOperationException

      Deprecated.
      Adds an add_on_nr operation to the list of requests.
      Parameters:
        `key` - the key to write the value to
        `toAdd` - the number to add to the number stored at key
      Returns:
        this `RequestList` object
      Throws:
        `UnsupportedOperationException` - if the operation is unsupported, e.g. there may only be one "commit" in a request list and no request after that
      Since:
        3.9

    - #### addAddOnNr

          @Deprecated
          public RequestList addAddOnNr(OtpErlangString key,
                                          OtpErlangDouble toAdd)
                                 throws UnsupportedOperationException

      Deprecated.
      Adds an add_on_nr operation to the list of requests.
      Parameters:
        `key` - the key to write the value to
        `toAdd` - the number to add to the number stored at key
      Returns:
        this `RequestList` object
      Throws:
        `UnsupportedOperationException` - if the operation is unsupported, e.g. there may only be one "commit" in a request list and no request after that
      Since:
        3.9

    - #### addAddOnNr

          @Deprecated
          public <T extends Number> RequestList addAddOnNr(String key,
                                                             T toAdd)
                                 throws UnsupportedOperationException

      Deprecated.
      Adds an add_on_nr operation to the list of requests.
      Type Parameters:
        `T` - type of the value to write; WARNING: the actual supported types only include `Integer`, `Long`, `BigInteger` and `Double` - see `ErlangValue.convertToErlang(Object)`.
      Parameters:
        `key` - the key to write the value to
        `toAdd` - the number to add to the number stored at key
      Returns:
        this `RequestList` object
      Throws:
        `UnsupportedOperationException` - if the operation is unsupported, e.g. there may only be one "commit" in a request list and no request after that
      Since:
        3.9

    - #### addAddOnNr

          @Deprecated
          public RequestList addAddOnNr(String key,
                                          Double toAdd)
                                 throws UnsupportedOperationException

      Deprecated.
      Adds an add_on_nr operation to the list of requests.
      Parameters:
        `key` - the key to write the value to
        `toAdd` - the number to add to the number stored at key
      Returns:
        this `RequestList` object
      Throws:
        `UnsupportedOperationException` - if the operation is unsupported, e.g. there may only be one "commit" in a request list and no request after that
      Since:
        3.9

    - #### addTestAndSet

          @Deprecated
          public RequestList addTestAndSet(OtpErlangString key,
                                             OtpErlangObject oldValue,
                                             OtpErlangObject newValue)
                                    throws UnsupportedOperationException

      Deprecated.
      Adds a test_and_set operation to the list of requests (`newValue` is only written if the currently stored value is `oldValue`).
      Parameters:
        `key` - the key to write the value to
        `oldValue` - the old value to verify
        `newValue` - the new value to write of oldValue is correct
      Returns:
        this `RequestList` object
      Throws:
        `UnsupportedOperationException` - if the operation is unsupported, e.g. there may only be one "commit" in a request list and no request after that
      Since:
        3.8

    - #### addTestAndSet

          @Deprecated
          public <OldT,NewT> RequestList addTestAndSet(String key,
                                                         OldT oldValue,
                                                         NewT newValue)
                                    throws UnsupportedOperationException

      Deprecated.
      Adds a test_and_set operation to the list of requests (`newValue` is only written if the currently stored value is `oldValue`).
      Type Parameters:
        `OldT` - the type of the stored (old) value. See `ErlangValue` for a list of supported types.
        `NewT` - the type of the (new) value to store. See `ErlangValue` for a list of supported types.
      Parameters:
        `key` - the key to write the value to
        `oldValue` - the old value to verify
        `newValue` - the new value to write of oldValue is correct
      Returns:
        this `RequestList` object
      Throws:
        `UnsupportedOperationException` - if the operation is unsupported, e.g. there may only be one "commit" in a request list and no request after that
      Since:
        3.8

    - #### addCommit

          public RequestList addCommit()
                                throws UnsupportedOperationException

      Adds a commit operation to the list of requests.
      Returns:
        this `RequestList` object
      Throws:
        `UnsupportedOperationException` - if the operation is unsupported, e.g. there may only be one "commit" in a request list and no request after that

    - #### isCommit

          public boolean isCommit()

      Returns whether the transactions contains a commit or not.
      Returns:
        `true` if the operation contains a commit, `false` otherwise

    - #### getCommit

          public CommitOp getCommit()

      Returns the commit operation (if present).
      Returns:
        the commit operation or `null` if there is none

    - #### isEmpty

          public boolean isEmpty()

      Checks whether the request list is empty.
      Returns:
        `true` is empty, `false` otherwise

    - #### size

          public int size()

      Gets the number of requests in the list.
      Returns:
        number of requests

    - #### getRequests

          public List<Operation> getRequests()

      Gets all operations of the request list.
      Returns:
        the requests
      Since:
        3.14

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`