List of usage examples for java.util Locale UK
Locale UK
To view the source code for java.util Locale UK.
Click Source Link
From source file:org.jfree.data.time.junit.MillisecondTest.java
/** * Some checks for the getFirstMillisecond() method. *//*w w w. j av a2 s . c o m*/ public void testGetFirstMillisecond() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Millisecond m = new Millisecond(500, 15, 43, 15, 1, 4, 2006); assertEquals(1143902595500L, m.getFirstMillisecond()); Locale.setDefault(saved); TimeZone.setDefault(savedZone); }
From source file:org.powertac.producer.pvfarm.IrradianceModelTest.java
@Test public void testDailyIrradianceOnTitledPlane() throws IOException { File file = new File("data/dataIrradianceOnTiltedPlane.txt"); file.createNewFile();/* w w w .jav a 2 s. c o m*/ File file2 = new File("data/dataIrradianceOnTiltedPlane2.txt"); file2.createNewFile(); PrintWriter pw = new PrintWriter(new File("data/dataIrradianceOnTiltedPlane.txt")); PrintWriter pw2 = new PrintWriter(new File("data/dataIrradianceOnTiltedPlane2.txt")); int day = 180; double panelLatitude = 60; for (double tilt = 0; tilt <= 90; tilt += 1) { double outsum = 0; double outsum2 = 0; for (double time = 0; time < 24; time += 1) { double sunaltitude = SolarModel.getSunAltitudeAngle(time, panelLatitude, day); if (sunaltitude >= 0) { double sunazimuth = SolarModel.getSunAzinuthAngle(sunaltitude, day, panelLatitude, time); double inci = SolarModel.getIncidenceAngle(sunaltitude, sunazimuth, 180, tilt); double airmass = IrradianceModel.getAirMass(sunaltitude); double T0 = IrradianceModel.getT0(airmass, 3); double Tr = IrradianceModel.getTr(airmass); double aw = IrradianceModel.getaw(airmass, 0.2, 300); double f = IrradianceModel.getf(sunaltitude); double dir = IrradianceModel.getDirectIrradiance(sunaltitude, 1367, T0, Tr, aw, 0.95); double dif = IrradianceModel.getDiffuseIrradiance(sunaltitude, 1367, T0, Tr, aw, 0.95, 0.95, f); dir = IrradianceModel.getCloudModifiedIrradiance(dir, 0, 0.2, 0.95, 0.33, -1.06, 0, 0); dif = IrradianceModel.getCloudModifiedIrradiance(dif, 0, 0.2, 0.95, 0.33, -1.06, 0, 0); double res; if (inci <= 90) { res = IrradianceModel.getIrradiancOnTiltedPlane(dir, dif, inci, sunaltitude, tilt, 0.2); } else { res = IrradianceModel.getIrradiancOnTiltedPlane(0, dif, inci, sunaltitude, tilt, 0.2); // System.out.println("Incidence:" + inci +"for tilt " + // tilt + " and hour " + time); // System.out.println("Sun's posistion: " + sunaltitude // + "," + sunazimuth); } outsum = outsum + res / 1000; outsum2 = outsum2 + (dir + dif) / 1000; pw2.printf(Locale.UK, "%f,%f%n", tilt * 24 + time, res); } else { pw2.printf(Locale.UK, "%f,%f%n", tilt * 24 + time, 0.0); } } pw.printf(Locale.UK, "%f,%f,%f%n", tilt, outsum, outsum2); } pw.close(); pw2.close(); }
From source file:Utils.GenericUtils.java
public static String getCurrentDate() { long startDate = System.currentTimeMillis(); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.UK); return dateFormat.format(startDate); }
From source file:org.jfree.data.time.MonthTest.java
/** * Some checks for the getFirstMillisecond() method. *//*from w w w .j av a 2 s . c o m*/ @Test public void testGetFirstMillisecond() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Month m = new Month(3, 1970); assertEquals(5094000000L, m.getFirstMillisecond()); Locale.setDefault(saved); TimeZone.setDefault(savedZone); }
From source file:org.jfree.data.time.junit.HourTest.java
/** * Some checks for the getFirstMillisecond() method. *///from ww w . j av a 2s . c o m public void testGetFirstMillisecond() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Hour h = new Hour(15, 1, 4, 2006); assertEquals(1143900000000L, h.getFirstMillisecond()); Locale.setDefault(saved); TimeZone.setDefault(savedZone); }
From source file:org.jfree.data.time.DayTest.java
/** * Some checks for the getFirstMillisecond() method. *//*from w ww.j a v a 2s . c o m*/ @Test public void testGetFirstMillisecond() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Day d = new Day(1, 3, 1970); assertEquals(5094000000L, d.getFirstMillisecond()); Locale.setDefault(saved); TimeZone.setDefault(savedZone); }
From source file:com.application.akscorp.yandextranslator2017.TranslateScreen.java
/** * Start component init(initialization)// w ww . java2 s . com */ private void StartInit() { //Init speech object SpeechEngine = new TextToSpeech(context, new TextToSpeech.OnInitListener() { @Override public void onInit(int status) { if (status != TextToSpeech.ERROR) { SpeechEngine.setLanguage(Locale.UK); } } }); ImageButton ExchangeBtn = (ImageButton) TranslateScreen.findViewById(R.id.exchange_languages); ExchangeBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ExchangeTranslateLanguages(); } }); CopyButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { CopyTextToClipBoard(GetTranslate()); } }); SpeakButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (SpeechEngine.isSpeaking()) SpeechEngine.stop(); else { try { TextToSpeech(GetTranslate(), new Locale(LangsCodeSpinner[ToLang])); } catch (Exception e) { Logs.SaveLog(context, e); Toast.makeText(context, LanguageWork.GetResourceString(context, "forbidden_option"), Toast.LENGTH_SHORT).show(); } } } }); editTextInputFrazeForTranslate = (EditTextWithButtons) TranslateScreen.findViewById(R.id.translate_input); AddToFavourite = (ImageButton) TranslateScreen.findViewById(R.id.add_favourite_button); TranslateAdapter = new TranslateListViewAdapter(context); TranslateList.setAdapter(TranslateAdapter); MyUtility.setListViewHeightBasedOnChildren(TranslateList); TranslateButtonController(); InitLanguagesTranslateList(); }
From source file:Utils.GenericUtils.java
public static Date getDate() { long startDate = System.currentTimeMillis(); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.UK); String curDate = dateFormat.format(startDate); try {/* w ww. j a va2s . c om*/ return dateFormat.parse(curDate); } catch (Exception e) { LogMe("GenericUtils:Date", "DateformatException " + e.getLocalizedMessage()); } return (new Date()); }
From source file:it.polimi.diceH2020.SPACE4CloudWS.solvers.solversImpl.MINLPSolver.MINLPDataFileBuilder.java
private <N extends Number> void printIndexedTable(int idx, Pair<Iterable<Integer>, Iterable<N>> pair) { String currentLine = String.format(" [%d, *] :=", idx); lines.add(currentLine);// w w w. j a v a 2 s .c om Iterator<Integer> first = pair.getKey().iterator(); Iterator<N> second = pair.getValue().iterator(); while (first.hasNext() && second.hasNext()) { Integer key = first.next(); N value = second.next(); if (value instanceof Double) { //UK to have . instead of , as separator currentLine = String.format(Locale.UK, " %d %f", key, value.doubleValue()); } else if (value instanceof Integer) { currentLine = String.format(" %d %d", key, value.intValue()); } lines.add(currentLine); } }
From source file:org.jfree.data.time.QuarterTest.java
/** * Some checks for the getFirstMillisecond() method. *//* w w w. ja v a2s . c o m*/ @Test public void testGetFirstMillisecond() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Quarter q = new Quarter(3, 1970); assertEquals(15634800000L, q.getFirstMillisecond()); Locale.setDefault(saved); TimeZone.setDefault(savedZone); }