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:org.jfree.data.time.junit.HourTest.java

/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 *//*from ww w  .jav  a 2 s  .c  o  m*/
public void testGetFirstMillisecondWithCalendar() {
    Hour h = new Hour(2, 15, 4, 2000);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(955764000000L, h.getFirstMillisecond(calendar));

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

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

/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 *//*from w w  w. j  av  a  2  s. co  m*/
@Test
public void testGetFirstMillisecondWithCalendar() {
    Quarter q = new Quarter(1, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(978307200000L, q.getFirstMillisecond(calendar));

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

From source file:de.skubware.opentraining.activity.create_workout.ExerciseTypeListFragment.java

/**
 * Filters the list of exercises for the search query. 
 * /* w w  w .jav a 2s.  c om*/
 * Do not forget to call {@link #filterExercisesForMusclesAndEquipment()} 
 * before.
 * 
 */
private void filterExercisesForSearchQuery() {
    Log.d(TAG, "filterExercisesForSearchQuery() mSearchEquery=" + mSearchQuery);

    if (mSearchQuery == null)
        mSearchQuery = "";

    // quit if the user did not search for anything
    if (mSearchQuery.equals("") || mSearchQuery.replaceAll(" ", "").equals(""))
        return;

    for (ExerciseType ex : new ArrayList<ExerciseType>(mExerciseList)) {
        boolean accepted = false;

        for (String name : ex.getAlternativeNames()) {
            name = name.toLowerCase(Locale.GERMANY);
            if (name.contains(mSearchQuery.toLowerCase(Locale.GERMANY))) {
                accepted = true;
                continue;
            }
        }

        if (!accepted) {
            mExerciseList.remove(ex);
        }
    }

    setListAdapter(new ExerciseTypeListAdapter(getActivity(), android.R.layout.simple_list_item_single_choice,
            android.R.id.text1, mExerciseList));
}

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *///from w ww .  jav  a 2s . c om
@Test
public void testGetLastMillisecondWithCalendar() {
    Millisecond m = new Millisecond(250, 50, 45, 21, 21, 4, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(987889550250L, m.getLastMillisecond(calendar));

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

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *///  w  w w  . j  a v a  2s  .c o m
public void testGetLastMillisecondWithCalendar() {
    Minute m = new Minute(45, 21, 21, 4, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(987889559999L, m.getLastMillisecond(calendar));

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

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *///  w  w w.  ja v a2  s. c o  m
public void testGetLastMillisecondWithCalendar() {
    Second s = new Second(50, 45, 21, 21, 4, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(987889550999L, s.getLastMillisecond(calendar));

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

From source file:org.talend.dataquality.statistics.datetime.CustomDateTimePatternManagerTest.java

@Test
public void testDateWithLocaleDE() {
    // simulate a JVM
    Locale.setDefault(Locale.GERMANY);

    final List<String> pattern = Collections.<String>singletonList("MMMM d ?? yyyy");
    final String[] dates = new String[] { "January 9 ?? 1970", // EN
            "janvier 9 ?? 1970", // FR
            "Januar 9 ?? 1970", // DE
            " 9 ?? 1970", // CN
    };//from  ww w.j  ava 2 s .  c o  m
    final boolean[] EXPECTED_IS_DATE_DEFAULT = new boolean[] { true, false, false, false };
    final boolean[] EXPECTED_IS_DATE_US = new boolean[] { true, false, false, false };
    final boolean[] EXPECTED_IS_DATE_FR = new boolean[] { true, true, false, false };
    final boolean[] EXPECTED_IS_DATE_DE = new boolean[] { true, false, true, false };
    final boolean[] EXPECTED_IS_DATE_CN = new boolean[] { true, false, false, true };
    // final String[] EXPECTED_PATTERN_STRING = new String[] { "", };

    StringBuilder sb = new StringBuilder("\n");
    sb.append("-------------- JVM Locale: " + Locale.getDefault().toString() + " ------\n");
    sb.append("Input \\ UserLocale\tN/A\tEN\tFR\tDE\tCN\n");
    for (int i = 0; i < dates.length; i++) {
        sb.append(dates[i]).append("   \t");
        sb.append(CustomDateTimePatternManager.isDate(dates[i], pattern)).append("\t");
        sb.append(CustomDateTimePatternManager.isDate(dates[i], pattern, Locale.US)).append("\t");
        sb.append(CustomDateTimePatternManager.isDate(dates[i], pattern, Locale.FRANCE)).append("\t");
        sb.append(CustomDateTimePatternManager.isDate(dates[i], pattern, Locale.GERMANY)).append("\t");
        sb.append(CustomDateTimePatternManager.isDate(dates[i], pattern, Locale.CHINA)).append("\t");
        sb.append("\n");

        assertEquals(EXPECTED_IS_DATE_DEFAULT[i], CustomDateTimePatternManager.isDate(dates[i], pattern));
        assertEquals(EXPECTED_IS_DATE_US[i], CustomDateTimePatternManager.isDate(dates[i], pattern, Locale.US));
        assertEquals(EXPECTED_IS_DATE_FR[i],
                CustomDateTimePatternManager.isDate(dates[i], pattern, Locale.FRANCE));
        assertEquals(EXPECTED_IS_DATE_DE[i],
                CustomDateTimePatternManager.isDate(dates[i], pattern, Locale.GERMANY));
        assertEquals(EXPECTED_IS_DATE_CN[i],
                CustomDateTimePatternManager.isDate(dates[i], pattern, Locale.CHINA));
    }

    LOGGER.info(sb.toString());
}

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *//*from w w  w  .j  av  a  2 s  .co m*/
@Test
public void testGetLastMillisecondWithCalendar() {
    Hour h = new Hour(21, 21, 4, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(987890399999L, h.getLastMillisecond(calendar));

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

From source file:org.openestate.io.trovit.TrovitUtils.java

public static BigDecimal parsePriceValue(String value) {
    Number number = NumberUtils.parseNumber(value, Locale.ENGLISH, Locale.GERMANY);
    if (number == null)
        throw new IllegalArgumentException("Can't parse price value '" + value + "'!");
    return BigDecimal.valueOf(number.doubleValue());
}

From source file:org.nuclos.common2.LangUtils.java

/**
 * @return the default <code>Collator</code> for <code>Locale.GERMANY</code>.
 * This "modern" collation is compatible with DIN 5007 (which is very similar to the collation proposed by the "Duden").
 * This can be used wherever <code>String</code>s must be sorted according to German rules.
 * For name directories (eg. address books or phonebooks), the traditional german collation can be used as an alternative.
 * @see #getTraditionalGermanCollator()/* w w w.j a v  a 2s . c  om*/
 */
public static Collator getModernGermanCollator() {
    return Collator.getInstance(Locale.GERMANY);
}