List of usage examples for java.util Locale PRC
Locale PRC
To view the source code for java.util Locale PRC.
Click Source Link
From source file:Main.java
public static void main(String[] args) { Locale locale = Locale.PRC; System.out.println("Locale1:" + locale); // print the country of this locale System.out.println("Country:" + locale.getCountry()); }
From source file:hk.idv.kenson.jrconsole.Console.java
/** * //from www . j a va 2 s . com * @param localeString * @return */ private static Locale getLocale(String localeString) { if ("default".equals(localeString)) return Locale.getDefault(); if ("canada".equals(localeString)) return Locale.CANADA; if ("canada_french".equals(localeString)) return Locale.CANADA_FRENCH; if ("china".equals(localeString)) return Locale.CHINA; if ("chinese".equals(localeString)) return Locale.CHINESE; if ("english".equals(localeString)) return Locale.ENGLISH; if ("franch".equals(localeString)) return Locale.FRANCE; if ("german".equals(localeString)) return Locale.GERMAN; if ("germany".equals(localeString)) return Locale.GERMANY; if ("italian".equals(localeString)) return Locale.ITALIAN; if ("italy".equals(localeString)) return Locale.ITALY; if ("japan".equals(localeString)) return Locale.JAPAN; if ("japanese".equals(localeString)) return Locale.JAPANESE; if ("korea".equals(localeString)) return Locale.KOREA; if ("korean".equals(localeString)) return Locale.KOREAN; if ("prc".equals(localeString)) return Locale.PRC; if ("simplified_chinese".equals(localeString)) return Locale.SIMPLIFIED_CHINESE; if ("taiwan".equals(localeString)) return Locale.TAIWAN; if ("traditional_chinese".equals(localeString)) return Locale.TRADITIONAL_CHINESE; if ("uk".equals(localeString)) return Locale.UK; if ("us".equals(localeString)) return Locale.US; String parts[] = localeString.split("_", -1); if (parts.length == 1) return new Locale(parts[0]); else if (parts.length == 2) return new Locale(parts[0], parts[1]); else return new Locale(parts[0], parts[1], parts[2]); }
From source file:org.kalypso.mapserver.utils.MapFileUtilities.java
/** * This function creates the contents of the layer. * * @param wmsURL//from w ww.j a v a 2 s . c om * @param mapFile * @param layerName * Used for naming the layer and the wms layer. * @paramd data * @param geoemtryType * @param envelope * @param sourceCRS * @param otherCRSs * @return The contents of the layer. */ public static Layer createLayerForShape(final String wmsURL, final File mapFile, final String layerName, final String data, final QName geoemtryType, final GM_Envelope envelope, final String sourceCRS, final String[] otherCRSs) throws MapServerException { String shapeType = "POLYGON"; //$NON-NLS-1$ if (GM_Point.POINT_ELEMENT.equals(geoemtryType) || GM_MultiPoint.MULTI_POINT_ELEMENT.equals(geoemtryType)) shapeType = "POINT"; //$NON-NLS-1$ else if (GM_Curve.CURVE_ELEMENT.equals(geoemtryType) || GM_MultiCurve.MULTI_CURVE_ELEMENT.equals(geoemtryType)) shapeType = "LINE"; //$NON-NLS-1$ else if (GM_Polygon.POLYGON_ELEMENT.equals(geoemtryType) || GMLConstants.QN_MULTI_POLYGON.equals(geoemtryType)) shapeType = "POLYGON"; //$NON-NLS-1$ /* Create the layer element. */ final Layer layer = OF.createLayer(); layer.setName(layerName); layer.setType(shapeType); layer.setStatus("ON"); //$NON-NLS-1$ layer.setData(data); layer.setTemplate("getfeatureinfo.html"); //$NON-NLS-1$ /* Fill the projection element. */ layer.getProjection().add("init=" + sourceCRS); //$NON-NLS-1$ /* Create the item element. */ final String resource = String.format("%s?map=%s&", wmsURL, mapFile.getAbsolutePath().replace("\\", "/")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ final ItemType item = OF.createItemType(); item.getItem().add(createItem("wms_title", layerName)); //$NON-NLS-1$ item.getItem().add(createItem("wms_onlineresource", resource)); //$NON-NLS-1$ item.getItem() .add(createItem("wms_srs", String.format("%s %s", sourceCRS, StringUtils.join(otherCRSs, " ")))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ item.getItem().add(createItem("wms_extent", String.format(Locale.PRC, "%f %f %f %f", envelope.getMinX(), //$NON-NLS-1$//$NON-NLS-2$ envelope.getMinY(), envelope.getMaxX(), envelope.getMaxY()))); layer.setMetadata(item); /* Create the class element. */ final Class clazz = createClass("Standard", null, null, new RGB(0, 0, 0)); //$NON-NLS-1$ /* Fill the class element. */ layer.getClazz().add(clazz); return layer; }
From source file:org.kalypso.mapserver.utils.MapFileUtilities.java
/** * This function creates the contents of the layer without any classes. * * @param wmsURL// w ww . j a v a 2s .c om * @param mapFile * @param layerName * Used for naming the layer and the wms layer. * @param opacity * @param data * @param bigMin * @param bigMax * @param envelope * @param sourceCRS * @param otherCRSs * @return The contents of the layer. */ public static Layer createLayerForRaster(final String wmsURL, final File mapFile, final String layerName, final String opacity, final String data, final BigDecimal bigMin, final BigDecimal bigMax, final GM_Envelope envelope, final String sourceCRS, final String[] otherCRSs) { /* Create the layer element. */ final Layer layer = OF.createLayer(); layer.setName(layerName); layer.setType("RASTER"); //$NON-NLS-1$ layer.setStatus("ON"); //$NON-NLS-1$ layer.setOpacity(opacity); layer.setData(data); layer.setTemplate("getfeatureinfo.html"); //$NON-NLS-1$ /* Fill the processing element. */ double min = -Double.MAX_VALUE; if (bigMin != null) min = bigMin.doubleValue(); double max = Double.MAX_VALUE; if (bigMax != null) max = bigMax.doubleValue(); double buckets = Math.floor((max - min) / 0.05); if (buckets < 2.0) buckets = 2.0; final List<String> processing = layer.getProcessing(); processing.add(String.format(Locale.PRC, "SCALE=%.2f %.2f", min, max)); //$NON-NLS-1$ processing.add(String.format(Locale.PRC, "SCALE_BUCKETS=%d", (int) buckets)); //$NON-NLS-1$ processing.add("RESAMPLE=BILINEAR"); //$NON-NLS-1$ /* Fill the projection element. */ layer.getProjection().add("init=" + sourceCRS); //$NON-NLS-1$ /* Create the item element. */ final String resource = String.format("%s?map=%s&", wmsURL, mapFile.getAbsolutePath().replace("\\", "/")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ final ItemType item = OF.createItemType(); item.getItem().add(createItem("wms_title", layerName)); //$NON-NLS-1$ item.getItem().add(createItem("wms_onlineresource", resource)); //$NON-NLS-1$ item.getItem() .add(createItem("wms_srs", String.format("%s %s", sourceCRS, StringUtils.join(otherCRSs, " ")))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ item.getItem().add(createItem("wms_extent", String.format(Locale.PRC, "%f %f %f %f", envelope.getMinX(), //$NON-NLS-1$//$NON-NLS-2$ envelope.getMinY(), envelope.getMaxX(), envelope.getMaxY()))); layer.setMetadata(item); return layer; }
From source file:org.kalypso.model.hydrology.util.cm.CatchmentHelper.java
/** * This function creates a hash from the catchment.<br/> * <br/>//from w ww .j a v a 2 s .com * A hash is generated from the catchment. It takes the factors/timeseries into account. An equal combination of * factors and timeseries creates the same hash. * * @param catchment * The catchment. * @return The hash. */ public static String buildHash(final ICatchment catchment) { /* Memory for the single values. */ final List<String> values = new ArrayList<>(); /* Build the hash. */ final IFeatureBindingCollection<IFactorizedTimeseries> factorizedTimeseries = catchment .getFactorizedTimeseries(); for (final IFactorizedTimeseries timeseries : factorizedTimeseries) { final BigDecimal factor = timeseries.getFactor(); final ZmlLink link = timeseries.getTimeseriesLink(); values.add(String.format(Locale.PRC, "%s_%s", factor.toPlainString(), link.getHref())); //$NON-NLS-1$ } /* Join the values. */ return StringUtils.join(values.toArray(new String[] {}), ";"); //$NON-NLS-1$ }
From source file:org.kalypso.model.wspm.pdb.internal.wspm.BridgeIdHelper.java
public static String findFreeId(final BuildingBruecke bridge, final Set<String> usedIds) { final String brueckeId = bridge.getBrueckeId(); if (!StringUtils.isEmpty(brueckeId)) return brueckeId; int cnt = 1;// w w w . j a va 2s .com String freeId = String.format(Locale.PRC, "bridge_%d", cnt++); //$NON-NLS-1$ while (usedIds.contains(freeId)) freeId = String.format(Locale.PRC, "bridge_%d", cnt++); //$NON-NLS-1$ return freeId; }
From source file:org.kalypso.model.wspm.pdb.ui.internal.gaf.BwpWriter.java
private void writeVetegationClass(final IVegetationClass vegetationClass, final PrintWriter writer) { /* Create the line. */ final StringBuilder builder = new StringBuilder(); builder.append("%s\t"); //$NON-NLS-1$ builder.append("%s\t"); //$NON-NLS-1$ builder.append("%s\t"); //$NON-NLS-1$ builder.append("%s\t"); //$NON-NLS-1$ builder.append("\"%s\""); //$NON-NLS-1$ /* Get the data to write. */ final String name = vegetationClass.getName(); String dp = "-1"; //$NON-NLS-1$ final BigDecimal dp1 = vegetationClass.getDp(); if (dp1 != null) dp = String.format(Locale.PRC, "%.3f", dp1.doubleValue()); //$NON-NLS-1$ String ax = "-1"; //$NON-NLS-1$ final BigDecimal ax1 = vegetationClass.getAx(); if (ax1 != null) ax = String.format(Locale.PRC, "%.3f", ax1.doubleValue()); //$NON-NLS-1$ String ay = "-1"; //$NON-NLS-1$ final BigDecimal ay1 = vegetationClass.getAy(); if (ay1 != null) ay = String.format(Locale.PRC, "%.3f", ay1.doubleValue()); //$NON-NLS-1$ String comment = ""; //$NON-NLS-1$ final String comment1 = vegetationClass.getComment(); if (comment1 != null) comment = comment1;//from ww w .j a v a 2s . c om /* Write the line. */ writer.format(Locale.PRC, builder.toString(), name, dp, ax, ay, comment); writer.println(); }
From source file:org.kalypso.model.wspm.pdb.ui.internal.gaf.GafWriter.java
private void writePoint(final GafKind kind, final Point point, final PrintWriter writer) { /* Get the data to write. */ final CrossSection crossSection = point.getCrossSectionPart().getCrossSection(); final double station = crossSection.getStation().doubleValue(); final String id = point.getName(); String y = "-1"; //$NON-NLS-1$ final BigDecimal width = point.getWidth(); if (width != null) y = String.format("%.4f", width.doubleValue()); //$NON-NLS-1$ String z = "-1"; //$NON-NLS-1$ final BigDecimal height = point.getHeight(); if (height != null) z = String.format("%.4f", height.doubleValue()); //$NON-NLS-1$ final Roughness roughness = point.getRoughness(); final Vegetation vegetation = point.getVegetation(); final int rk = Integer.parseInt(roughness.getId().getName()); final int bk = Integer.parseInt(vegetation.getId().getName()); /* geo location */ final com.vividsolutions.jts.geom.Point location = point.getLocation(); final Double hw = location == null ? null : location.getY(); final Double rw = location == null ? null : location.getX(); final String hwStr = hw == null ? StringUtils.EMPTY : String.format("%.4f", hw); //$NON-NLS-1$ final String rwStr = rw == null ? StringUtils.EMPTY : String.format("%.4f", rw); //$NON-NLS-1$ final String code = point.getCode(); final String hyk = StringUtils.isBlank(point.getHyk()) ? EMPTY_HYK_CODE : point.getHyk(); /* the gaf writer might produce multiple hyk codes, we need to write one line per single code */ final String[] hyks = StringUtils.split(hyk, IGafConstants.HYK_CODE_SEPARATOR); /* depending on the export mode, the code/hyk gets tweaked; first tweak than count lines, because tweak may reduce codes to normal lines */ final Pair<String, String>[] tweakedCodes = tweakHyks(kind, code, hyks); int count = 0; for (final Pair<String, String> tweakedPair : tweakedCodes) { final String tweakedCode = tweakedPair.getLeft(); final String tweakedHyk = tweakedPair.getRight(); final String line = String.format(Locale.PRC, GAF_LINE, station, id, y, z, tweakedCode, rk, bk, hwStr, rwStr, tweakedHyk);// w ww. j a v a2 s. c o m // REMARK: store first line in file, additional hyk lines are stored in separate file // IMPORTANT: order of lines is given by order of hyk codes made by the PPPartBuilder (PA,PE, LU,RU, LBOK,RBOK) if (count++ == 0) writer.append(line).println(); else m_additionalLines.add(line); } }
From source file:org.kalypso.model.wspm.pdb.ui.internal.gaf.KstWriter.java
private void writeRoughnessClass(final IRoughnessClass roughnessClass, final PrintWriter writer) { /* Create the line. */ final StringBuilder builder = new StringBuilder(); builder.append("%s\t"); //$NON-NLS-1$ builder.append("%s\t"); //$NON-NLS-1$ builder.append("%s\t"); //$NON-NLS-1$ builder.append("\"%s\""); //$NON-NLS-1$ /* Get the data to write. */ final String name = roughnessClass.getName(); String ksValue = "-1"; //$NON-NLS-1$ final BigDecimal ksValue1 = roughnessClass.getKsValue(); if (ksValue1 != null) ksValue = String.format(Locale.PRC, "%.3f", ksValue1.doubleValue()); //$NON-NLS-1$ String kstValue = "-1"; //$NON-NLS-1$ final BigDecimal kstValue1 = roughnessClass.getKstValue(); if (kstValue1 != null) kstValue = String.format(Locale.PRC, "%.1f", kstValue1.doubleValue()); //$NON-NLS-1$ String comment = ""; //$NON-NLS-1$ final String comment1 = roughnessClass.getComment(); if (comment1 != null) comment = comment1;/*from w ww . ja v a 2 s. c o m*/ /* Write the line. */ writer.format(Locale.PRC, builder.toString(), name, ksValue, kstValue, comment); writer.println(); }
From source file:org.kalypso.model.wspm.tuhh.schema.simulation.PolynomeProcessor.java
private void prepareSteuerpoly() throws SimulationException { final File steuerFile = new File(m_tmpDir, "steuerpoly.ini"); //$NON-NLS-1$ try {//from www. ja v a 2 s . c om final double startStation = m_calculation.getStartStation().doubleValue(); final double endStation = m_calculation.getStartStation().doubleValue(); /* Polynomial Parameters */ final PolynomeProperties pps = m_calculation.getPolynomeProperties(); final int polynomialDeegree = pps.getDeegree(); final boolean ignoreOutlier = pps.getIgnoreOutlier(); final boolean isTripleForAll = pps.getTripleForAll(); final BigDecimal alphaLimit = pps.getAlphaLimit(); final TripleMode tripleMode = pps.getTripleMode(); final boolean autoSlopeDetection = tripleMode == TripleMode.slopeChange; final BigDecimal runoffSlope = pps.getRunoffSlope(); final BigDecimal areaSlope = pps.getAreaSlope(); final BigDecimal alphaSlope = pps.getAlphaSlope(); final BigDecimal weightSplinePoint = pps.getWeightSplinePoint(); // Programming Language C (PRC) locale in order to format with decimal '.' final Formatter formatter = new Formatter(steuerFile, Charset.defaultCharset().name(), Locale.PRC); formatter.format("Steuerdatei fuer die Polynomfunktionen je Profil%n"); //$NON-NLS-1$ formatter.format("-------------------------------------------------%n"); //$NON-NLS-1$ formatter.format("02 Lngsschnitt(Pfad) 01Eingang\\%s%n", QLANG_FILE_NAME); //$NON-NLS-1$ formatter.format("03 PolyGrad(2,3,4) %d%n", polynomialDeegree); //$NON-NLS-1$ formatter.format("04 DreiTeil(J/N) %1s%n", isTripleForAll ? "J" : "N"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ formatter.format("05 PolyReduce(J/N) J%n"); //$NON-NLS-1$ formatter.format("06 ProfIntervall(J/N) N%n"); //$NON-NLS-1$ formatter.format("07 StartProf(0000.0000) %.4f%n", startStation); //$NON-NLS-1$ formatter.format("08 EndProf(0000.0000) %.4f%n", endStation); //$NON-NLS-1$ formatter.format("09 AusgabeJeFunktion(J/N) J%n"); //$NON-NLS-1$ formatter.format("10 AusgabeWspWerte(J/N) J%n"); //$NON-NLS-1$ formatter.format("11 AusgabeKontrolle(J/N) J%n"); //$NON-NLS-1$ formatter.format("12 AusgabeFile(Pfad) 02Ausgang\\%n"); //$NON-NLS-1$ formatter.format("13 Ausreisser(J/N) %1s%n", ignoreOutlier ? "J" : "N"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ formatter.format("14 Impulsstrom(00.0000) %.4f%n", alphaLimit); //$NON-NLS-1$ formatter.format("15 AutoSteigung(J/N) %1s%n", autoSlopeDetection ? "J" : "N"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ formatter.format("16 Q_Steigung(00.0000) %.4f%n", runoffSlope); //$NON-NLS-1$ formatter.format("17 A_Steigung(00.0000) %.4f%n", areaSlope); //$NON-NLS-1$ formatter.format("18 Alp_Steigung(00.0000) %.4f%n", alphaSlope); //$NON-NLS-1$ formatter.format("19 WichtungSplinePkt(0000.00) %.2f%n", weightSplinePoint); //$NON-NLS-1$ formatter.close(); FormatterUtils.checkIoException(formatter); } catch (final IOException e) { throw new SimulationException( Messages.getString("org.kalypso.model.wspm.tuhh.schema.simulation.PolynomeProcessor.16"), e); //$NON-NLS-1$ } finally { } }