List of usage examples for java.lang Character toString
public static String toString(int codePoint)
From source file:io.wcm.handler.url.suffix.impl.UrlSuffixUtil.java
/** * Decode value//from www . ja va 2s . c om * @param suffixPart Suffix part * @return Decoded value */ public static String decodeValue(String suffixPart) { // value is the part *after* KEY_VALUE_DELIMITER String value = StringUtils.substringAfter(suffixPart, Character.toString(KEY_VALUE_DELIMITER)); // un-escape special chars for (Map.Entry<String, String> entry : SPECIAL_CHARS_ESCAPEMAP.entrySet()) { value = StringUtils.replace(value, entry.getValue(), entry.getKey()); } return value; }
From source file:org.rivetlogic.utils.IntegrationUtils.java
public static String encodePath(String alfPath) { StringBuilder pathBuilder = new StringBuilder(100); StringTokenizer tokenizer = new StringTokenizer(alfPath, Character.toString(File.separatorChar)); while (tokenizer.hasMoreElements()) { String pStr = tokenizer.nextElement().toString(); if (!pStr.startsWith("/")) { for (String prefix : IntegrationConstants.NAMESPACE_PREFIX_RESOLVER.getPrefixes()) { if (pStr.startsWith(prefix)) { pStr = pStr.substring(0, prefix.length() + 1) + ISO9075.encode(pStr.substring(prefix.length() + 1)); }/* w w w .ja v a2 s .co m*/ } pathBuilder.append(File.separatorChar); pathBuilder.append(pStr); } } return pathBuilder.toString(); }
From source file:ml.shifu.core.di.builtin.binning.AbstractBinning.java
/** * convert @AbstractBinning to String/*from w w w . ja va2 s .co m*/ * * @return */ protected void stringToObj(String objValStr) { String[] objStrArr = objValStr.split(Character.toString(FIELD_SEPARATOR), -1); if (objStrArr.length < 4) { throw new IllegalArgumentException("The size of argument is incorrect"); } missingValCnt = Integer.parseInt(StringUtils.trim(objStrArr[0])); invalidValCnt = Integer.parseInt(StringUtils.trim(objStrArr[1])); expectedBinningNum = Integer.parseInt(StringUtils.trim(objStrArr[2])); if (missingValSet == null) { missingValSet = new HashSet<String>(); } else { missingValSet.clear(); } String[] elements = objStrArr[3].split(Character.toString(SETLIST_SEPARATOR), -1); for (String element : elements) { missingValSet.add(element); } }
From source file:ml.shifu.shifu.core.binning.EqualIntervalBinning.java
public void stringToObj(String objValStr) { super.stringToObj(objValStr); String[] objStrArr = objValStr.split(Character.toString(FIELD_SEPARATOR), -1); maxVal = Double.parseDouble(objStrArr[4]); minVal = Double.parseDouble(objStrArr[5]); }
From source file:org.culturegraph.mf.stream.converter.JsonEncoder.java
/** * By default JSON output does only have escaping where it is strictly * necessary. This is recommended in the most cases. Nevertheless it can * be sometimes useful to have some more escaping. With this method it is * possible to use {@link StringEscapeUtils#escapeJavaScript(String)}. * * @param escapeCharacters an array which defines which characters should be * escaped and how it will be done. See * {@link CharacterEscapes}. In most cases this should * be null. Use like this: * <pre>{@code int[] esc = CharacterEscapes.standardAsciiEscapesForJSON(); * // and force escaping of a few others: * esc['\''] = CharacterEscapes.ESCAPE_STANDARD; * JsonEncoder.useEscapeJavaScript(esc); * }</pre> */// w w w . j a v a 2 s .com public void setJavaScriptEscapeChars(final int[] escapeCharacters) { final CharacterEscapes ce = new CharacterEscapes() { private static final long serialVersionUID = 1L; @Override public int[] getEscapeCodesForAscii() { if (escapeCharacters == null) { return CharacterEscapes.standardAsciiEscapesForJSON(); } return escapeCharacters; } @Override public SerializableString getEscapeSequence(final int ch) { final String chString = Character.toString((char) ch); final String jsEscaped = StringEscapeUtils.escapeJavaScript(chString); return new SerializedString(jsEscaped); } }; jsonGenerator.setCharacterEscapes(ce); }
From source file:com.evolveum.midpoint.repo.sql.query.QueryContext.java
private String createAlias(Definition def, QName qname) { String prefix;//from ww w. j ava2s . c om if (def != null) { //we want to skip 'R' prefix for entity definition names int prefixIndex = (def instanceof EntityDefinition) ? 1 : 0; prefix = Character.toString(def.getJpaName().charAt(prefixIndex)).toLowerCase(); } else { prefix = Character.toString(qname.getLocalPart().charAt(0)).toLowerCase(); } int index = 1; String alias = prefix; while (hasAlias(alias)) { alias = prefix + Integer.toString(index); index++; if (index > 5) { throw new IllegalStateException("Alias index for definition '" + def + "' is more than 5? This probably should not happen."); } } return alias; }
From source file:com.liveneo.plat.utils.StringUtil.java
public static String escapeSpecial(String inputString) { if (inputString == null) return null; StringBuffer buf = new StringBuffer((int) (inputString.length() * 1.1)); int stringLength = inputString.length(); String specialStr = "[^\\:\\!\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\-\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\\\\\]\\^\\_\\`\\{\\|\\}\\~]*"; Pattern pattern = Pattern.compile(specialStr); for (int i = 0; i < stringLength; ++i) { char c = inputString.charAt(i); String str = Character.toString(c); Matcher matcher = pattern.matcher(str); if (matcher.matches() == false) { buf.append("\\"); buf.append(c);/* w w w .ja v a 2 s . co m*/ } else { buf.append(c); } } return buf.toString(); }
From source file:org.caleydo.view.enroute.correlation.wilcoxon.WilcoxonUtil.java
public static List<WilcoxonResult> calcAllWilcoxonCombinations(DataCellInfo sourceInfo, DataCellInfo targetInfo) {/*from ww w .ja va 2 s .c o m*/ List<WilcoxonResult> results = new ArrayList<>(); Object description = sourceInfo.dataDomain.getDataClassSpecificDescription(sourceInfo.rowIDType, sourceInfo.rowID, sourceInfo.columnPerspective.getIdType(), sourceInfo.columnPerspective.getVirtualArray().get(0)); if (description == null || description instanceof NumericalProperties) { List<Double> values = getSampleValues(sourceInfo, new HashSet<Object>(sourceInfo.columnPerspective.getVirtualArray().getIDs())); Collections.sort(values); for (Double threshold : values) { NumericalDataClassifier classifier = new NumericalDataClassifier(threshold.floatValue(), WilcoxonRankSumTestWizard.CLASSIFICATION_COLORS_1.getFirst(), WilcoxonRankSumTestWizard.CLASSIFICATION_COLORS_1.getSecond(), Character.toString((char) 0x2264) + " " + threshold, "> " + threshold); WilcoxonResult result = calcWilcoxonRankSumTest(sourceInfo, classifier, targetInfo); if (result != null) { results.add(result); } } } else { CategoricalClassDescription<?> classDesc = (CategoricalClassDescription<?>) description; Set<Object> allCategories = new LinkedHashSet<>(classDesc.size()); for (CategoryProperty<?> property : classDesc.getCategoryProperties()) { allCategories.add(property.getCategory()); } Set<Set<Object>> combinations = new HashSet<>(); calcCategoryCombinations(combinations, new HashSet<>(), allCategories); Set<Set<Object>> usedClass1s = new HashSet<>(); for (Set<Object> class1 : combinations) { Set<Object> class2 = Sets.symmetricDifference(class1, allCategories); if (!class2.isEmpty() && !containsSet(usedClass1s, class2)) { usedClass1s.add(class1); CategoricalDataClassifier classifier = new CategoricalDataClassifier(class1, class2, WilcoxonRankSumTestWizard.CLASSIFICATION_COLORS_1.getFirst(), WilcoxonRankSumTestWizard.CLASSIFICATION_COLORS_1.getSecond(), getCategoryName(class1, classDesc), getCategoryName(class2, classDesc), classDesc); WilcoxonResult result = calcWilcoxonRankSumTest(sourceInfo, classifier, targetInfo); if (result != null) { results.add(result); } } } } return results; }
From source file:nl.knaw.huygens.timbuctoo.config.Configuration.java
private String concatenatePaths(String part1, String part2) { part2 = Character.toString(part2.charAt(0)).equals("/") ? part2 : "/" + part2; return part1 + part2; }
From source file:ml.shifu.shifu.core.binning.CategoricalBinning.java
public String objToString() { return super.objToString() + Character.toString(FIELD_SEPARATOR) + Boolean.toString(isValid) + Character.toString(FIELD_SEPARATOR) + StringUtils.join(categoricalVals, SETLIST_SEPARATOR); }