StateSumming
Keywords: net.corda.finance.contracts.utils.StateSumming class
Date: 2023-09-18

net.corda.finance.contracts.utils

## Class StateSumming

- net.corda.finance.contracts.utils.StateSumming

-     public class StateSumming

- - ### Constructor Detail

    - #### StateSumming

          public StateSumming()

  - ### Method Detail

    - #### sumCashBy

          @NotNull
          public static Amount<net.corda.core.contracts.Issued> sumCashBy(@NotNull
                                                                                   java.lang.Iterable<? extends net.corda.core.contracts.ContractState> $this$sumCashBy,
                                                                                   @NotNull
                                                                                   AbstractParty owner)

      Sums the cash states in the list belonging to a single owner, throwing an exception if there are none, or if any of the cash states cannot be added together (i.e. are different currencies or issuers).

    - #### sumCash

          @NotNull
          public static Amount<net.corda.core.contracts.Issued> sumCash(@NotNull
                                                                                 java.lang.Iterable<? extends net.corda.core.contracts.ContractState> $this$sumCash)

      Sums the cash states in the list, throwing an exception if there are none, or if any of the cash states cannot be added together (i.e. are different currencies or issuers).

    - #### sumCashOrNull

          @Nullable
          public static Amount<net.corda.core.contracts.Issued> sumCashOrNull(@NotNull
                                                                                        java.lang.Iterable<? extends net.corda.core.contracts.ContractState> $this$sumCashOrNull)

      Sums the cash states in the list, returning null if there are none.

    - #### sumCashOrZero

          @NotNull
          public static Amount<net.corda.core.contracts.Issued> sumCashOrZero(@NotNull
                                                                                       java.lang.Iterable<? extends net.corda.core.contracts.ContractState> $this$sumCashOrZero,
                                                                                       @NotNull
                                                                                       Issued<java.util.Currency> currency)

      Sums the cash states in the list, returning zero of the given currency+issuer if there are none.

    - #### sumFungibleOrNull

          @Nullable
          public static <T> Amount<net.corda.core.contracts.Issued> sumFungibleOrNull(@NotNull
                                                                                                java.lang.Iterable<? extends net.corda.core.contracts.ContractState> $this$sumFungibleOrNull)

      Sums the asset states in the list, returning null if there are none.

    - #### sumFungibleOrZero

          @NotNull
          public static <T> Amount<net.corda.core.contracts.Issued> sumFungibleOrZero(@NotNull
                                                                                               java.lang.Iterable<? extends net.corda.core.contracts.ContractState> $this$sumFungibleOrZero,
                                                                                               @NotNull
                                                                                               Issued<? extends T> token)

      Sums the asset states in the list, returning zero of the given token if there are none.

    - #### sumObligations

          @NotNull
          public static <P> Amount<net.corda.core.contracts.Issued> sumObligations(@NotNull
                                                                                            java.lang.Iterable<? extends net.corda.core.contracts.ContractState> $this$sumObligations)

      Sums the obligation states in the list, throwing an exception if there are none. All state objects in the list are presumed to be nettable.

    - #### sumObligationsOrNull

          @Nullable
          public static <P> Amount<net.corda.core.contracts.Issued> sumObligationsOrNull(@NotNull
                                                                                                   java.lang.Iterable<? extends net.corda.core.contracts.ContractState> $this$sumObligationsOrNull)

      Sums the obligation states in the list, returning null if there are none.

    - #### sumObligationsOrZero

          @NotNull
          public static <P> Amount<net.corda.core.contracts.Issued> sumObligationsOrZero(@NotNull
                                                                                                  java.lang.Iterable<? extends net.corda.core.contracts.ContractState> $this$sumObligationsOrZero,
                                                                                                  @NotNull
                                                                                                  Issued<net.corda.finance.contracts.asset.Obligation.Terms> issuanceDef)

      Sums the obligation states in the list, returning zero of the given product if there are none.