Create a simple price graduation that contains one item with the minimum
quantity of 1.

@param aPrice
The price to use. May not be <code>null</code>.
@return Never <code>null</code>.
549687
@Nonnull
  public static IMutablePriceGraduation createSimple (@Nonnull final IMutablePrice aPrice)
  {
    final PriceGraduation ret = new PriceGraduation (aPrice.getCurrency ());
    ret.addItem (new PriceGraduationItem (1, aPrice.getNetAmount ().getValue ()));
    return ret;
  }
746231
@Override
	public boolean offer(E e) {
		if (sizeLimit > 0 && size() >= sizeLimit){
			return false;
		}else{
			return queue.offer(e);
		}
	}
834406
@Override
	public CommerceOrderItem create(long commerceOrderItemId) {
		CommerceOrderItem commerceOrderItem = new CommerceOrderItemImpl();

		commerceOrderItem.setNew(true);
		commerceOrderItem.setPrimaryKey(commerceOrderItemId);

		commerceOrderItem.setCompanyId(companyProvider.getCompanyId());

		return commerceOrderItem;
	}
974550
public ExpiryPolicyBuilder<K, V> create(Duration create) {
    Objects.requireNonNull(create, "Create duration cannot be null");
    if (create.isNegative()) {
      throw new IllegalArgumentException("Create duration must be positive");
    }
    return create((a, b) -> create);
  }
880364
@Override
	public CommercePriceList create(long commercePriceListId) {
		CommercePriceList commercePriceList = new CommercePriceListImpl();

		commercePriceList.setNew(true);
		commercePriceList.setPrimaryKey(commercePriceListId);

		String uuid = PortalUUIDUtil.generate();

		commercePriceList.setUuid(uuid);

		commercePriceList.setCompanyId(companyProvider.getCompanyId());

		return commercePriceList;
	}
440965
@Override
	public CommerceOrderPayment create(long commerceOrderPaymentId) {
		CommerceOrderPayment commerceOrderPayment = new CommerceOrderPaymentImpl();

		commerceOrderPayment.setNew(true);
		commerceOrderPayment.setPrimaryKey(commerceOrderPaymentId);

		commerceOrderPayment.setCompanyId(companyProvider.getCompanyId());

		return commerceOrderPayment;
	}
127176
public function createNewProductPriceForCurrency(
        ProductInterface $product,
        $priceValue,
        $minimumQuantity = 0.0,
        $currencyId = null
    ) {
        // Fetch currency.
        if (!$currencyId) {
            $currency = $this->currencyRepository->findByCode($this->defaultCurrency);
        } else {
            $currency = $this->currencyRepository->find($currencyId);
        }

        if (!$currency) {
            throw new ProductDependencyNotFoundException($this->currencyRepository->getClassName(), $currencyId);
        }

        $productPrice = new ProductPrice();
        $productPrice->setMinimumQuantity($minimumQuantity);
        $productPrice->setPrice($priceValue);
        $productPrice->setProduct($product);
        $productPrice->setCurrency($currency);
        $product->addPrice($productPrice);

        return $productPrice;
    }
213750
public Try<T> orElse(Supplier<Try<T>> defaultValue) {
    try {
      return isSuccess() ? this : defaultValue.get();
    } catch (RuntimeException e) {
      return new Failure<>(e);
    }
  }
810352
function Amount(value, unit) {
  if (!(this instanceof Amount))
    return new Amount(value, unit);

  this.value = 0;
  this.unit = null;

  if (value != null)
    this.fromOptions(value, unit);
}
1333494
public static Optional<Double> avg (List<Object> args) {
        double sum = 0d;
        int count = 0;
        for(Object arg: args) {
            Optional<? extends Number> numberOptional = Objects.toNumber( arg );
            if(numberOptional.isPresent()) {
                sum = sum + numberOptional.get().doubleValue();
                count = count + 1;
            }
        }
        return  count == 0 ? Optional.<Double>empty() : Optional.of( sum / count );
    }
973019
@Override
	public CommerceShipmentItem create(long commerceShipmentItemId) {
		CommerceShipmentItem commerceShipmentItem = new CommerceShipmentItemImpl();

		commerceShipmentItem.setNew(true);
		commerceShipmentItem.setPrimaryKey(commerceShipmentItemId);

		commerceShipmentItem.setCompanyId(companyProvider.getCompanyId());

		return commerceShipmentItem;
	}
290802
@Override
  public final void setItem(final ServiceToSale pService) {
    this.item = pService;
    if (this.itsId == null) {
      this.itsId = new ServicePriceId();
    }
    this.itsId.setItem(this.item);
  }
532643
protected function updatePrice(ProductPrice $price, $matchedEntry)
    {
        if (isset($matchedEntry['minimumQuantity'])) {
            $price->getEntity()->setMinimumQuantity($matchedEntry['minimumQuantity']);
        }
        if (isset($matchedEntry['price'])) {
            $price->setPrice($matchedEntry['price']);
        }
        if (isset($matchedEntry['priceInfo'])) {
            $price->getEntity()->setPriceInfo($matchedEntry['priceInfo']);
        }
        if (isset($matchedEntry['currency'])) {
            $currency = $this->currencyRepository->find($matchedEntry['currency']['id']);
            if (!$currency) {
                throw new ProductDependencyNotFoundException(
                    self::$productPriceEntityName,
                    $matchedEntry['currency']['id']
                );
            }
            $price->getEntity()->setCurrency($currency);
        }

        return true;
    }
1016804
@Nonnull
  public static <DATATYPE> SuccessWithValue <DATATYPE> createFailure (@Nullable final DATATYPE aValue)
  {
    return new SuccessWithValue <> (ESuccess.FAILURE, aValue);
  }
446282
public static QueryCouponStockResult mmpaymkttransfersQuery_coupon_stock(QueryCouponStock queryCouponStock,String key){
		Map<String,String> map = MapUtil.objectToMap( queryCouponStock);
		String sign = SignatureUtil.generateSign(map,queryCouponStock.getSign_type(),key);
		queryCouponStock.setSign(sign);
		String secapiPayRefundXML = XMLConverUtil.convertToXML( queryCouponStock);
		HttpUriRequest httpUriRequest = RequestBuilder.post()
				.setHeader(xmlHeader)
				.setUri(baseURI()+ "/mmpaymkttransfers/query_coupon_stock")
				.setEntity(new StringEntity(secapiPayRefundXML,Charset.forName("utf-8")))
				.build();
		return LocalHttpClient.executeXmlResult(httpUriRequest,QueryCouponStockResult.class,queryCouponStock.getSign_type(),key);
	}
546645
public static Predicate<MonetaryAmount> isBetween(MonetaryAmount min, MonetaryAmount max){
        return isLessThanOrEqualTo(max).and(isGreaterThanOrEqualTo(min));
    }
843786
def set_min_price(self, min_price):
        

        if not isinstance(min_price, int):
            raise DaftException("Min price should be an integer.")

        self._min_price = str(min_price)
        self._price += str(QueryParam.MIN_PRICE) + self._min_price