Interface BuyerOperations


  • public interface BuyerOperations
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int createBuyer​(java.lang.String name, int cityId)
      Creates new buyer with 0 credit.
      int createOrder​(int buyerId)
      Creates empty order.
      int getCity​(int buyerId)
      Gets city for buyer.
      java.math.BigDecimal getCredit​(int buyerId)
      Gets credit for buyer.
      java.util.List<java.lang.Integer> getOrders​(int buyerId)
      Gets all orders for buyer
      java.math.BigDecimal increaseCredit​(int buyerId, java.math.BigDecimal credit)
      Increases buyer's credit.
      int setCity​(int buyerId, int cityId)
      Changes city for buyer.
    • Method Detail

      • createBuyer

        int createBuyer​(java.lang.String name,
                        int cityId)
        Creates new buyer with 0 credit.
        Parameters:
        name - name of the buyer
        cityId - id of the city
        Returns:
        buyer's id, or -1 if failure
      • setCity

        int setCity​(int buyerId,
                    int cityId)
        Changes city for buyer.
        Parameters:
        buyerId - id of the buyer
        cityId - id of the city
        Returns:
        1 if success, -1 if failure
      • getCity

        int getCity​(int buyerId)
        Gets city for buyer.
        Parameters:
        buyerId - buyer's id
        Returns:
        city's id, -1 if failure
      • increaseCredit

        java.math.BigDecimal increaseCredit​(int buyerId,
                                            java.math.BigDecimal credit)
        Increases buyer's credit.
        Parameters:
        buyerId - id of the buyer
        credit - credit
        Returns:
        credit after addition
      • createOrder

        int createOrder​(int buyerId)
        Creates empty order.
        Parameters:
        buyerId - buyer id
        Returns:
        id of the order, -1 in failure
      • getOrders

        java.util.List<java.lang.Integer> getOrders​(int buyerId)
        Gets all orders for buyer
        Parameters:
        buyerId - buyer id
        Returns:
        list of order's ids for buyer
      • getCredit

        java.math.BigDecimal getCredit​(int buyerId)
        Gets credit for buyer.
        Parameters:
        buyerId - buyer's id
        Returns:
        credit for buyer