Example usage for java.util Locale UK

List of usage examples for java.util Locale UK

Introduction

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

Prototype

Locale UK

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

Click Source Link

Document

Useful constant for country.

Usage

From source file:org.powertac.producer.pvfarm.IrradianceModelTest.java

@Test
public void dataYearIrradiance() throws IOException {

    File file = new File("data/dataYearIrradiance.txt");
    file.createNewFile();/*w  w  w . ja va 2 s.  c  o m*/
    PrintWriter pw = new PrintWriter(new File("data/dataYearIrradiance.txt"));

    double panelLatitude = 45;
    for (int day = 1; day <= 365; day += 1) {
        double outsum = 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 = dir + dif;
                // if(inci <= 90){
                // res = IrradianceModel.getIrradiancOnTiltedPlane(dir, dif,
                // inci, sunaltitude, tilt, 0.2);
                // }else{
                // res = IrradianceModel.getIrradiancOnTiltedPlane(0, dif,
                // inci, sunaltitude, tilt, 0.2);
                // }

                outsum = outsum + res / 1000;

            }
        }
        pw.printf(Locale.UK, "%d,%f%n", day, outsum);

    }
    pw.close();
}

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

/**
 * Some checks for the getFirstMillisecond() method.
 *///from   w  w  w.  ja va 2 s  .  c  om
@Test
public void testGetFirstMillisecond() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    TimeZone savedZone = TimeZone.getDefault();
    TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));
    Week w = new Week(3, 1970);
    assertEquals(946800000L, w.getFirstMillisecond());
    Locale.setDefault(saved);
    TimeZone.setDefault(savedZone);
}

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

/**
 * Some checks for the getLastMillisecond() method.
 *///from w  w w. j av  a  2 s .  c  om
public void testGetLastMillisecond() {
    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(7772399999L, m.getLastMillisecond());
    Locale.setDefault(saved);
    TimeZone.setDefault(savedZone);
}

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

/**
 * Some checks for the getLastMillisecond() method.
 *///www. j av a 2  s.com
public void testGetLastMillisecond() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    TimeZone savedZone = TimeZone.getDefault();
    TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));
    Day d = new Day(1, 1, 1970);
    assertEquals(82799999L, d.getLastMillisecond());
    Locale.setDefault(saved);
    TimeZone.setDefault(savedZone);
}

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 */// w  w  w .j a  v a2  s.  c  o  m
@Test
public void testGetLastMillisecondWithCalendar() {

    Day d = new Day(4, 5, 2001);
    Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("Europe/London"), Locale.UK);
    assertEquals(989017199999L, d.getLastMillisecond(calendar));

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

From source file:org.csstudio.opibuilder.validation.Application.java

/**
 * Checks the given file. If the file is a directory all its children are checked. A file is only checked if it is
 * an opi file.//ww w . j a v  a2  s  . c om
 *
 * @param verifier the verifier to use for checking
 * @param file the file to check
 * @throws IllegalStateException
 * @throws IOException
 */
private void check(SchemaVerifier verifier, File file) throws IllegalStateException, IOException {
    if (file.isDirectory()) {
        if (skipTargetFolder && isTargetFolder(file)) {
            return;
        }
        File[] files = file.listFiles();
        if (files != null) {
            for (File f : files) {
                check(verifier, f);
            }
        }
    } else if (file.getAbsolutePath().toLowerCase(Locale.UK).endsWith(".opi")) {
        System.out.println("Validating file: " + file.getAbsolutePath());
        verifier.validate(new Path(file.getAbsolutePath()));
    }
}

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

/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 *///from  ww  w  .java2  s . c  o m
public void testGetLastMillisecondWithCalendar() {

    Day d = new Day(4, 5, 2001);
    Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("Europe/London"), Locale.UK);
    assertEquals(989017199999L, d.getLastMillisecond(calendar));

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

From source file:com.ibm.xsp.webdav.DavXMLResponsePlain.java

public void dateTagForCreateDate(String TagName, Date date) {
    if (date == null) {
        return;/*from  w  ww  .ja va 2 s . c om*/
    }

    // "2005-08-10T10:19:24Z";
    /*
     * String[] dateParsed=date.toString().split(" "); String
     * timeZone=dateParsed[dateParsed.length-2];
     * if(timeZone.equals("EET")||timeZone.equals("EEST")){ timeZone="GMT";
     * }
     */
    String creatFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'";
    SimpleDateFormat fmt = new SimpleDateFormat(creatFormat, Locale.UK);
    String datestring = fmt.format(date);
    this.simpleTag(TagName, datestring);
}

From source file:dk.magenta.ldap.LDAPMultiBaseUserRegistry.java

/**
 * Sets the timestamp format. Unfortunately, this varies between directory servers.
 *
 * @param timestampFormat// w  w w  . ja  va 2 s  . c  o m
 *            the timestamp format
 *            <ul>
 *            <li>OpenLDAP: "yyyyMMddHHmmss'Z'"
 *            <li>Active Directory: "yyyyMMddHHmmss'.0Z'"
 *            </ul>
 */
public void setTimestampFormat(String timestampFormat) {
    this.timestampFormat = new SimpleDateFormat(timestampFormat, Locale.UK);
    this.timestampFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
}

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

/**
 * Some checks for the getLastMillisecond() method.
 *///from   w w w . j av a  2s  .co m
@Test
public void testGetLastMillisecond() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    TimeZone savedZone = TimeZone.getDefault();
    TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));
    Week w = new Week(31, 1970);
    assertEquals(18485999999L, w.getLastMillisecond());
    Locale.setDefault(saved);
    TimeZone.setDefault(savedZone);
}