Sets a preferred currency. Default is "EUR".
@param currency a 3-letter currency code
323262
public void setCurrency(String currency) {
		currency = StringUtils.upperCase(currency);
		if (!CurrencyUtils.getInstance().isValidCurrency(currency)) {
			currency = "EUR";
		}
		this.currency = currency;
	}
232300
public static function checkCurrency($country, $currency)
    {
        switch($country) {
        case KlarnaCountry::AT:
        case KlarnaCountry::DE:
        case KlarnaCountry::NL:
        case KlarnaCountry::FI:
            return ($currency === KlarnaCurrency::EUR);
        case KlarnaCountry::DK:
            return ($currency === KlarnaCurrency::DKK);
        case KlarnaCountry::NO:
            return ($currency === KlarnaCurrency::NOK);
        case KlarnaCountry::SE:
            return ($currency === KlarnaCurrency::SEK);
        default:
            //Country not yet supported by Klarna.
            return false;
        }
    }
648472
public void setExchangeRate(Currency otherCurrency, double amount) {
        Common.getInstance().getStorageHandler().getStorageEngine().setExchangeRate(this, otherCurrency, amount);
    }
190953
public void setCurrencyDigits(Integer currDigs)
   {
      if (currDigs == null)
      {
         currDigs = DEFAULT_CURRENCY_DIGITS;
      }
      set(ProjectField.CURRENCY_DIGITS, currDigs);
   }
12714
public void setNumericCollationDefault() {
        checkNotFrozen();
        CollationSettings defaultSettings = getDefaultSettings();
        if(settings.readOnly() == defaultSettings) { return; }
        CollationSettings ownedSettings = getOwnedSettings();
        ownedSettings.setFlagDefault(CollationSettings.NUMERIC, defaultSettings.options);
        setFastLatinOptions(ownedSettings);
    }
105536
public static void registerDefaults() throws BitfinexClientException {

		try {
			final URL url = new URL(SYMBOL_URL);
			final String symbolJson = Resources.toString(url, Charsets.UTF_8);
			final JSONArray jsonArray = new JSONArray(symbolJson);

			for(int i = 0; i < jsonArray.length(); i++) {
				final JSONObject currency = jsonArray.getJSONObject(i);
				final String pair = currency.getString("pair");

				if(pair.length() != 6) {
					throw new BitfinexClientException("The currency pair is not 6 chars long: " + pair);
				}

				final double minOrderSize = currency.getDouble("minimum_order_size");
				final String currency1 = pair.substring(0, 3).toUpperCase();
				final String currency2 = pair.substring(3, 6).toUpperCase();
				register(currency1, currency2, minOrderSize);
			}

		} catch (IOException e) {
			throw new BitfinexClientException(e);
		} 
	}
1053177
private void assignCurrencyPrivate(XAttributable element, String currency) {
		if (currency != null && currency.trim().length() > 0) {
			XAttributeLiteral attr = (XAttributeLiteral) ATTR_CURRENCY.clone();
			attr.setValue(currency);
			element.getAttributes().put(KEY_CURRENCY, attr);
		}
	}
1268295
public function setCurrency(string $currency): self
    {
        $this->isValidCurrency($currency);

        $this->currency = $currency;

        return $this;
    }
978281
public function setPricesCurrency($pricesCurrency = 'RON')
    {
        $pricesCurrency = strtoupper(trim($pricesCurrency));
        switch ($pricesCurrency) {
            case 'ROL':
                $this->pricesCurrency = 'ROL';
                break;

            case 'EUR':
                $this->pricesCurrency = 'EUR';
                break;

            case 'USD':
                $this->pricesCurrency = 'USD';
                break;

            case 'GBP':
                $this->pricesCurrency = 'GBP';
                break;

            case 'BGN':
                $this->pricesCurrency = 'BGN';
                break;

            case 'RON':
            default:
                $this->pricesCurrency = 'RON';
        }

        return true;
    }
1344468
public static String adaptCurrencyPair(CurrencyPair currencyPair) {
    return currencyPair.base.getCurrencyCode().toLowerCase()
        + currencyPair.counter.getCurrencyCode().toLowerCase();
  }
609379
function init(defaultLocale, defaultLocaleAssetUrl, defaultCurrency) {
    // Store default/initial settings.
    _defaultLocale = defaultLocale;
    _defaultLocaleAssetUrl = defaultLocaleAssetUrl;
    _defaultCurrency = defaultCurrency;

    // Store default currency against the Currency object.
    Currency.currentCurrency = _defaultCurrency;

    // See if we have a saved locale in our cookie that's different to our current one. If so, translate to it.
    var cookieLocale = localeCookie.read();
    if(cookieLocale && cookieLocale.length && (cookieLocale != _defaultLocale)) {
      translate(cookieLocale);
    }

    // See if we have a saved currency in our cookie that's different to our current one. If so, convert to it.
    var cookieCurrency = Currency.cookie.read();
    if(cookieCurrency && cookieCurrency.length && (cookieCurrency != _defaultCurrency)) {
      convert(cookieCurrency);
    }

    // Create event listeners.
    $(document).on('change', '[data-change="locale"]', localeChangedHandler);
    $(document).on('change', '[data-change="currency"]', currencyChangedHandler);
    $(document).on('click', '[data-toggle="currency"]', currencyToggledHandler);
  }
786825
public static CurrencyUnit registerCurrencyUnit(CurrencyUnit currencyUnit, Locale locale) {
        Objects.requireNonNull(locale);
        Objects.requireNonNull(currencyUnit);
        return ConfigurableCurrencyUnitProvider.currencyUnitsByLocale.put(locale, currencyUnit);
    }
119091
public function setCurrency($pricesCurrency = 'RON')
    {
        $pricesCurrency = strtoupper(trim($pricesCurrency));
        switch ($pricesCurrency) {
            case 'ROL':
                $this->currency = 'ROL';
                break;

            case 'EUR':
                $this->currency = 'EUR';
                break;

            case 'USD':
                $this->currency = 'USD';
                break;

            case 'GBP':
                $this->currency = 'GBP';
                break;

            case 'BGN':
                $this->currency = 'BGN';
                break;

            case 'RON':
            default:
                $this->currency = 'RON';
        }

        return true;
    }
277752
public void formatCurrency(
      BigDecimal n, CLDR.Currency currencyCode, StringBuilder destination, CurrencyFormatOptions options) {
    
    DigitBuffer dbuf = new DigitBuffer();
    CurrencyFormatStyle style = options.style();
    NumberFormatMode formatMode = orDefault(options.formatMode(), NumberFormatMode.DEFAULT);
    boolean grouping = orDefault(options.grouping(), true);
    int currencyDigits = getCurrencyDigits(currencyCode);

    switch (style) {
      case SYMBOL:
      case ACCOUNTING:
      {
        NumberPattern[] patterns = style == CurrencyFormatStyle.SYMBOL ? currencyStandard : currencyAccounting;
        NumberPattern pattern = select(n, patterns);
        String symbol = options.symbolWidth() == CurrencySymbolWidth.NARROW 
            ? getNarrowCurrencySymbol(currencyCode) : getCurrencySymbol(currencyCode);
        DigitBuffer other = new DigitBuffer();
        setup(params, pattern, n, other, options, symbol, formatMode, grouping, currencyDigits, -1, -1);
        format(pattern, other, dbuf, symbol, null);
        dbuf.appendTo(destination);
        break;
      }

      case SHORT:
      {
        NumberFormatContext ctx = new NumberFormatContext(options, SIGNIFICANT_MAXFRAC, currencyDigits);
        int nDigits = integerDigits(n);
        int nDivisor = getDivisor_CURRENCY_SHORT(nDigits);

        // Q1 is the number divided by the divisor (if any).
        BigDecimal q1 = n;
        if (nDivisor > 0) {
          q1 = n.movePointLeft(nDivisor).stripTrailingZeros();
        }
        int q1Digits = integerDigits(q1);

        // Select an initial pattern using the OTHER plural category.
        NumberPattern pattern = select(n, getPattern_CURRENCY_SHORT(nDigits, PluralCategory.OTHER));
        
        // Q2 is the number adjusted using the pattern and options.
        ctx.setCompact(pattern, q1Digits, nDivisor);
        BigDecimal q2 = ctx.adjust(q1);
        int q2Digits = integerDigits(q2);

        // Number rounded up, we need to select a new divisor and pattern.
        if (q2Digits > q1Digits) {
          // Bump the number of digits by 1 to select the next divisor/pattern.
          nDigits++;
          int divisor = getDivisor_CURRENCY_SHORT(nDigits);
          pattern = select(n, getPattern_CURRENCY_SHORT(nDigits, PluralCategory.OTHER));
          
          // If divisor changed, we need to divide and adjust again. 
          // Otherwise we just use Q2 as-is.
          if (divisor > nDivisor) {
            q1 = n.movePointLeft(divisor).stripTrailingZeros();
            ctx.setCompact(pattern, integerDigits(q1), divisor);
            q2 = ctx.adjust(q1);
          }
        }

        // Compute the plural category.
        NumberOperands operands = new NumberOperands(q2.toPlainString());
        PluralCategory category = PLURAL_RULES.evalCardinal(bundleId.language(), operands);

        // Select the final pluralized pattern.
        pattern = select(n, getPattern_CURRENCY_SHORT(nDigits, category));
        
        // Format the number into the buffer.
        String symbol = getCurrencySymbol(currencyCode);
        DigitBuffer number = new DigitBuffer();
        NumberFormattingUtils.format(q2, number, params, true, grouping, 
            pattern.format.minimumIntegerDigits,
            currencyStandard[0].format.primaryGroupingSize, 
            currencyStandard[0].format.secondaryGroupingSize);
        
        // Format the entire pattern and append to destination.
        format(pattern, number, dbuf, symbol, null);
        dbuf.appendTo(destination);
        break;
      }
      
      case NAME:
      case CODE:
      {
        // Format the number with generic formatter parameters and grouping off to get the plural category.
        NumberPattern pattern = select(n, decimalStandard);
        DigitBuffer number = new DigitBuffer();
        setup(GENERIC_PARAMS, pattern, n, number, options, null, formatMode, false, currencyDigits, -1, -1);
        
        // Set the operands and get the plural category.
        NumberOperands operands = new NumberOperands(number);
        PluralCategory category = PLURAL_RULES.evalCardinal(bundleId.language(), operands);
        number.reset();

        // Format the number
        setup(params, pattern, n, number, options, null, formatMode, grouping, currencyDigits, -1, -1);
        format(pattern, number, dbuf, null, null);
        
        // Wrap the result with the wrapper selected by the plural category.
        String unit = style == CurrencyFormatStyle.CODE 
            ? currencyCode.toString() 
            : getCurrencyPluralName(currencyCode, category);
        wrapUnits(category, dbuf, unit, destination);
        break;
      }
    }
  }
1275786
def setCurrency( self, currency ):
        
        self._currency = currency
        self.setValue(self.value())
1311360
@Override
    public WorkingWeek getWorkingWeek(final String currency) {
        final WorkingWeek workingWeek = workingWeeks.get(currency);
        return workingWeek != null ? workingWeek : WorkingWeek.DEFAULT;
    }
270221
public void setCurrencyAttribute(String name, String value) {
		ensureValue();
		Attribute attribute = new CurrencyAttribute(value);
		attribute.setEditable(isEditable(name));
		getValue().getAllAttributes().put(name, attribute);
	}