Example usage for java.util Locale GERMANY

List of usage examples for java.util Locale GERMANY

Introduction

In this page you can find the example usage for java.util Locale GERMANY.

Prototype

Locale GERMANY

To view the source code for java.util Locale GERMANY.

Click Source Link

Document

Useful constant for country.

Usage

From source file:com.octo.captcha.engine.bufferedengine.manager.QuartzBufferedEngineManagerTest.java

public void testRemoveLocaleRatio() {
    manager.setLocaleRatio(Locale.GERMANY.getDisplayName(), 0.2);

    manager.removeLocaleRatio(Locale.GERMANY.getDisplayName());

    assertEquals(null, manager.getLocaleRatio().get(Locale.GERMANY.getDisplayName()));
}

From source file:org.polymap.rhei.field.DateTimeFormField.java

public void store() throws Exception {
    if (datetime.getYear() != 9996) {
        Calendar cal = Calendar.getInstance(Locale.GERMANY);
        cal.set(datetime.getYear(), datetime.getMonth(), datetime.getDay(), datetime.getHours(),
                datetime.getMinutes(), datetime.getSeconds());
        site.setFieldValue(cal.getTime());
    }//w  w w  .ja  va  2 s  . co  m
}

From source file:hudson.UtilTest.java

@Test
public void testTimeSpanString() {
    // Check that amounts less than 365 days are not rounded up to a whole year.
    // In the previous implementation there were 360 days in a year.
    // We're still working on the assumption that a month is 30 days, so there will
    // be 5 days at the end of the year that will be "12 months" but not "1 year".
    // First check 359 days.
    assertEquals(Messages.Util_month(11), Util.getTimeSpanString(31017600000L));
    // And 362 days.
    assertEquals(Messages.Util_month(12), Util.getTimeSpanString(31276800000L));

    // 11.25 years - Check that if the first unit has 2 or more digits, a second unit isn't used.
    assertEquals(Messages.Util_year(11), Util.getTimeSpanString(354780000000L));
    // 9.25 years - Check that if the first unit has only 1 digit, a second unit is used.
    assertEquals(Messages.Util_year(9) + " " + Messages.Util_month(3), Util.getTimeSpanString(291708000000L));
    // 67 seconds
    assertEquals(Messages.Util_minute(1) + " " + Messages.Util_second(7), Util.getTimeSpanString(67000L));
    // 17 seconds - Check that times less than a minute only use seconds.
    assertEquals(Messages.Util_second(17), Util.getTimeSpanString(17000L));
    // 1712ms -> 1.7sec
    assertEquals(Messages.Util_second(1.7), Util.getTimeSpanString(1712L));
    // 171ms -> 0.17sec
    assertEquals(Messages.Util_second(0.17), Util.getTimeSpanString(171L));
    // 101ms -> 0.10sec
    assertEquals(Messages.Util_second(0.1), Util.getTimeSpanString(101L));
    // 17ms/*from w  w w.  j a  v a 2s  . co  m*/
    assertEquals(Messages.Util_millisecond(17), Util.getTimeSpanString(17L));
    // 1ms
    assertEquals(Messages.Util_millisecond(1), Util.getTimeSpanString(1L));
    // Test HUDSON-2843 (locale with comma as fraction separator got exception for <10 sec)
    Locale saveLocale = Locale.getDefault();
    Locale.setDefault(Locale.GERMANY);
    try {
        // Just verifying no exception is thrown:
        assertNotNull("German locale", Util.getTimeSpanString(1234));
        assertNotNull("German locale <1 sec", Util.getTimeSpanString(123));
    } finally {
        Locale.setDefault(saveLocale);
    }
}

From source file:org.openestate.io.examples.OpenImmoWritingExample.java

/**
 * Create an {@link Immobilie} with some example data.
 *
 * @return/*  w  w w .ja v  a  2  s.  c  o m*/
 * created example object
 */
protected static Immobilie createImmobilie() {
    // create an example real estate
    Immobilie immobilie = FACTORY.createImmobilie();

    // add some administrative informations
    immobilie.setVerwaltungTechn(FACTORY.createVerwaltungTechn());
    immobilie.getVerwaltungTechn().setAktion(FACTORY.createAktion());
    immobilie.getVerwaltungTechn().getAktion().setAktionart(Aktion.AktionArt.CHANGE);
    immobilie.getVerwaltungTechn().setObjektnrIntern(RandomStringUtils.randomNumeric(10));

    // set categorization
    immobilie.setObjektkategorie(FACTORY.createObjektkategorie());
    immobilie.getObjektkategorie().setNutzungsart(FACTORY.createNutzungsart());
    immobilie.getObjektkategorie().getNutzungsart().setANLAGE(RandomUtils.nextInt(0, 2) == 1);
    immobilie.getObjektkategorie().getNutzungsart().setGEWERBE(RandomUtils.nextInt(0, 2) == 1);
    immobilie.getObjektkategorie().getNutzungsart().setWAZ(RandomUtils.nextInt(0, 2) == 1);
    immobilie.getObjektkategorie().getNutzungsart().setWOHNEN(RandomUtils.nextInt(0, 2) == 1);
    immobilie.getObjektkategorie().setVermarktungsart(FACTORY.createVermarktungsart());
    immobilie.getObjektkategorie().getVermarktungsart().setKAUF(true);
    immobilie.getObjektkategorie().setObjektart(FACTORY.createObjektart());

    Haus singleFamilyHouse = FACTORY.createHaus();
    singleFamilyHouse.setHaustyp(Haus.Haustyp.EINFAMILIENHAUS);
    immobilie.getObjektkategorie().getObjektart().getHaus().add(singleFamilyHouse);

    // add some informations about the location
    immobilie.setGeo(FACTORY.createGeo());
    immobilie.getGeo().setPlz(RandomStringUtils.randomNumeric(5));
    immobilie.getGeo().setOrt("Berlin");
    immobilie.getGeo().setLand(FACTORY.createLand());
    immobilie.getGeo().getLand().setIsoLand(Locale.GERMANY.getISO3Country());

    // add some informations about prices
    immobilie.setPreise(FACTORY.createPreise());
    immobilie.getPreise().setHeizkosten(new BigDecimal("456.0"));
    immobilie.getPreise().setKaufpreis(FACTORY.createKaufpreis());
    immobilie.getPreise().getKaufpreis().setAufAnfrage(false);
    immobilie.getPreise().getKaufpreis().setValue(new BigDecimal("123456.79"));

    // add some informations about features
    immobilie.setAusstattung(FACTORY.createAusstattung());
    immobilie.getAusstattung().setGaestewc(true);
    immobilie.getAusstattung().setGartennutzung(true);
    immobilie.getAusstattung().setHeizungsart(FACTORY.createHeizungsart());
    immobilie.getAusstattung().getHeizungsart().setZENTRAL(true);
    immobilie.getAusstattung().getHeizungsart().setFUSSBODEN(true);

    // add some descriptions
    immobilie.setFreitexte(FACTORY.createFreitexte());
    immobilie.getFreitexte().setObjekttitel("A title for the property.");
    immobilie.getFreitexte().setObjektbeschreibung("Some longer descriptive text about the property.");

    // set the contact person
    immobilie.setKontaktperson(FACTORY.createKontaktperson());
    immobilie.getKontaktperson().setName("Max Mustermann");
    immobilie.getKontaktperson().setEmailFeedback("max@mustermann.org");
    immobilie.getKontaktperson().setTelDurchw("030/123456789");
    immobilie.getKontaktperson().setPlz(RandomStringUtils.randomNumeric(5));
    immobilie.getKontaktperson().setOrt("Berlin");
    immobilie.getKontaktperson().setLand(FACTORY.createLand());
    immobilie.getKontaktperson().getLand().setIsoLand(Locale.GERMANY.getISO3Country());

    return immobilie;
}

From source file:com.artur.softwareproject.SensorDataListAdapter.java

@Override
@NonNull//  ww w.  ja v a  2s.  c  om
public View getView(int position, View convertView, @NonNull ViewGroup parent) {

    SensorViewHolder mViewHolder;

    if (convertView == null) {
        mViewHolder = new SensorViewHolder();

        LayoutInflater ListInflater = LayoutInflater.from(getContext());

        convertView = ListInflater.inflate(R.layout.sensordata_list_pattern, parent, false);

        mViewHolder.dataItemName = (TextView) convertView.findViewById(R.id.dataItemName);
        mViewHolder.dataItemType = (TextView) convertView.findViewById(R.id.dataItemType);
        mViewHolder.dataItemValue = (TextView) convertView.findViewById(R.id.dataItemValue);

        convertView.setTag(mViewHolder);
    } else {
        mViewHolder = (SensorViewHolder) convertView.getTag();
    }

    dataValues[0] = Math.floor(temperature * 100) / 100;
    dataValues[1] = Math.floor(humidity * 100) / 100;
    dataValues[2] = Math.floor(illuminance * 100) / 100;
    dataValues[3] = Math.floor(xPos * 100) / 100;
    dataValues[4] = Math.floor(yPos * 100) / 100;
    dataValues[5] = Math.floor(zPos * 100) / 100;

    if (position == 0 || position == 1 || position == 2) {
        mViewHolder.dataItemName.setText(dataTypes[position]);
        mViewHolder.dataItemType.setText(dataUnits[position]);
        mViewHolder.dataItemValue.setText(String.format(Locale.GERMANY, "%1$, .2f", dataValues[position]));//Double.toString(dataValues[position]));
    } else if (position == 3) {
        mViewHolder.dataItemName.setText(dataTypes[3]);

        mViewHolder.dataItemValue.setText("X : " + Double.toString(dataValues[3]) + " " + dataUnits[3] + "\n"
                + "Y : " + Double.toString(dataValues[4]) + " " + dataUnits[3] + "\n" + "Z : "
                + Double.toString(dataValues[5]) + " " + dataUnits[3]);
    }

    return convertView;
}

From source file:de.jfachwert.bank.Waehrung.java

/**
 * Ermittelt die Waehrung. Urspruenglich wurde die Default-Currency ueber
 * <pre>/* ww w  . j  av a2s  .  co m*/
 *     Currency.getInstance(Locale.getDefault())
 * </pre>
 * ermittelt. Dies fuehrte aber auf der Sun zu Problemen, da dort
 * die Currency fuer die Default-Locale folgende Exception hervorrief:
 * <pre>
 * java.lang.IllegalArgumentException
 *     at java.util.Currency.getInstance(Currency.java:384)
 *     at de.jfachwert.bank.Geldbetrag.&lt;clinit&gt;
 *     ...
 * </pre>
 *
 * @return normalerweise die deutsche Currency
 */
private static Currency getDefaultCurrency() {
    Locale[] locales = { Locale.getDefault(), Locale.GERMANY, Locale.GERMAN };
    for (Locale loc : locales) {
        try {
            return Currency.getInstance(loc);
        } catch (IllegalArgumentException iae) {
            LOG.log(Level.INFO,
                    "No currency for locale '" + loc + "' available on this machine - will try next one.", iae);
        }
    }
    return Currency.getAvailableCurrencies().iterator().next();
}

From source file:org.jfree.data.time.MinuteTest.java

/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 *//*www  . ja va 2  s .  c o  m*/
@Test
public void testGetFirstMillisecondWithCalendar() {
    Minute m = new Minute(40, 2, 15, 4, 2000);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(955766400000L, m.getFirstMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        m.getFirstMillisecond((Calendar) null);
    } catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}

From source file:org.jfree.data.time.SecondTest.java

/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 *///from   w  ww  .j ava  2  s  . c  o m
@Test
public void testGetFirstMillisecondWithCalendar() {
    Second s = new Second(55, 40, 2, 15, 4, 2000);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(955766455000L, s.getFirstMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        s.getFirstMillisecond((Calendar) null);
    } catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}

From source file:sernet.verinice.search.JsonBuilder.java

private static String getNullValue() {
    if (Locale.GERMAN.equals(Locale.getDefault()) || Locale.GERMANY.equals(Locale.getDefault())) {
        return "unbearbeitet";
    } else {//from   w  w w  . j av  a2s  .c  om
        return "unedited";
    }
}

From source file:com.bjorsond.android.timeline.utilities.Utilities.java

public static Date getFirstDayOfWeek(Date dateInWeek) {
    Calendar cal1 = Calendar.getInstance(TimeZone.getTimeZone("Europe/Paris"), Locale.GERMANY);
    cal1.setTime(dateInWeek);/*from   w w w  . j  av  a 2s  . co m*/
    int week = cal1.get(Calendar.WEEK_OF_YEAR);
    int year = cal1.get(Calendar.YEAR);
    cal1.clear();
    cal1.set(Calendar.WEEK_OF_YEAR, week);
    cal1.set(Calendar.YEAR, year);
    //      cal1.add(Calendar.DATE, 1);//To make the week start on monday. Not needed when locale is set as above?

    return cal1.getTime();
}