List of usage examples for java.lang Character toString
public static String toString(int codePoint)
From source file:org.fenixedu.spaces.ui.services.OccupationService.java
public String exportConfig(Occupation occupation) { ExplicitConfigWithSettings config = (ExplicitConfigWithSettings) occupation.getConfig(); JsonObject jsonConfig = new JsonObject(); jsonConfig.addProperty("start", config.getStart().toString(datetimeFormatter)); jsonConfig.addProperty("end", config.getEnd().toString(datetimeFormatter)); String jsonFrequency = Character.toString(config.getFrequency().name().toLowerCase().charAt(0)); jsonConfig.addProperty("frequency", jsonFrequency); jsonConfig.addProperty("isAllDay", config.getAllDay() != null && config.getAllDay()); switch (jsonFrequency) { case "d": jsonConfig.addProperty("repeatsevery", config.getRepeatsevery()); break;//from www . j a va2 s.c o m case "w": jsonConfig.addProperty("repeatsevery", config.getRepeatsevery()); jsonConfig.add("weekdays", new Gson().toJsonTree(config.getWeekdays())); break; case "m": jsonConfig.addProperty("repeatsevery", config.getRepeatsevery()); jsonConfig.addProperty("monthlyType", config.getMonthlyType().equals(MonthlyType.DAY_OF_MONTH) ? "dayofmonth" : "dayofweek"); break; case "y": jsonConfig.addProperty("repeatsevery", config.getRepeatsevery()); break; } return jsonConfig.toString(); }
From source file:org.waarp.openr66.protocol.localhandler.packet.RequestPacket.java
@Override public void createMiddle(LocalChannelReference lcr) throws OpenR66ProtocolPacketException { if (filename == null) { throw new OpenR66ProtocolPacketException("Not enough data"); }//from w ww .j av a2s . c o m byte[] away = new byte[1]; away[0] = way; if (lcr.getPartner() != null && lcr.getPartner().useJson()) { logger.debug("Request will use JSON " + lcr.getPartner().toString()); ObjectNode node = JsonHandler.createObjectNode(); JsonHandler.setValue(node, FIELDS.filename, filename); JsonHandler.setValue(node, FIELDS.block, blocksize); JsonHandler.setValue(node, FIELDS.rank, rank); JsonHandler.setValue(node, FIELDS.id, specialId); JsonHandler.setValue(node, FIELDS.code, code); JsonHandler.setValue(node, FIELDS.length, originalSize); middle = Unpooled.wrappedBuffer(away, JsonHandler.writeAsString(node).getBytes()); } else { middle = Unpooled.wrappedBuffer(away, filename.getBytes(), this.separator.getBytes(), Integer.toString(blocksize).getBytes(), this.separator.getBytes(), Integer.toString(rank).getBytes(), this.separator.getBytes(), Long.toString(specialId).getBytes(), this.separator.getBytes(), Character.toString(code).getBytes(), this.separator.getBytes(), Long.toString(originalSize).getBytes()); } }
From source file:com.pari.ic.ICManager.java
public static String createICKey(int customerId, String identifier) { String icKey = null;/*w w w. j a v a 2 s. co m*/ if (customerId != ICEntity.ALL_CUSTOMER_ID) { icKey = Character.toString('c') + customerId + "$" + identifier; } else { icKey = identifier; } return icKey; }
From source file:com.webcohesion.enunciate.modules.php_json_client.PHPJSONClientModule.java
protected String packageToNamespace(String pckg) { if (pckg == null) { return null; } else {/* ww w. j a v a 2s. com*/ StringBuilder ns = new StringBuilder(); for (StringTokenizer toks = new StringTokenizer(pckg, "."); toks.hasMoreTokens();) { String tok = toks.nextToken(); ns.append(Character.toString(tok.charAt(0)).toUpperCase()); if (tok.length() > 1) { ns.append(tok.substring(1)); } if (toks.hasMoreTokens()) { ns.append("\\"); } } return ns.toString(); } }
From source file:com.aurel.track.lucene.util.StringUtil.java
public static boolean startsWith(String s, char begin) { return startsWith(s, Character.toString(begin)); }
From source file:com.albert.javatest.JavaTestExample.java
private boolean isOENVerificationPassed(String oen) { if (Integer.parseInt(oen) < MIN_OEN) { return false; }// www. jav a 2 s . com int maskValue = 0; int checkDigit = 0; String oenNumber = oen; String[] oenGroup = null; oenGroup = oenNumber.split("(?<=\\G.{2})"); for (int i = 0; i < 4; i++) { maskValue = maskValue + Integer.parseInt(Character.toString(OEN_MASK.charAt((Integer.parseInt(oenGroup[i]))))); } checkDigit = ((maskValue / 10 + 1) * 10) - maskValue; if (checkDigit == 10) { checkDigit = 0; } return (Integer.parseInt(oenGroup[oenGroup.length - 1]) == checkDigit); }
From source file:com.vuze.android.remote.adapter.TorrentListAdapter.java
public boolean constraintCheck(CharSequence constraint, long torrentID, HashSet<String> setLetters, String charAfter, boolean compactDigits, boolean compactNonLetters, boolean compactPunctuation) { if (setLetters == null && (constraint == null || constraint.length() == 0)) { return true; }/*ww w . jav a2 s. c o m*/ Map<?, ?> map = sessionInfo.getTorrent(torrentID); if (map == null) { return false; } String name = MapUtils.getMapString(map, TransmissionVars.FIELD_TORRENT_NAME, "").toUpperCase(Locale.US); if (setLetters != null) { int nameLength = name.length(); if (charAfter.length() > 0) { int pos = name.indexOf(charAfter); while (pos >= 0) { int end = pos + charAfter.length(); if (end < nameLength) { char c = name.charAt(end); boolean isDigit = Character.isDigit(c); if (compactDigits && isDigit) { setLetters.add(TorrentListFragment.LETTERS_NUMBERS); } else if (compactPunctuation && isStandardPuncuation(c)) { setLetters.add(TorrentListFragment.LETTERS_PUNCTUATION); } else if (compactNonLetters && !isDigit && !isAlphabetic(c) && !isStandardPuncuation(c)) { setLetters.add(TorrentListFragment.LETTERS_NON); } else { setLetters.add(Character.toString(c)); } } pos = name.indexOf(charAfter, pos + 1); } } else { for (int i = 0; i < nameLength; i++) { char c = name.charAt(i); boolean isDigit = Character.isDigit(c); if (compactDigits && isDigit) { setLetters.add(TorrentListFragment.LETTERS_NUMBERS); } else if (compactPunctuation && isStandardPuncuation(c)) { setLetters.add(TorrentListFragment.LETTERS_PUNCTUATION); } else if (compactNonLetters && !isDigit && !isAlphabetic(c) && !isStandardPuncuation(c)) { setLetters.add(TorrentListFragment.LETTERS_NON); } else { setLetters.add(Character.toString(c)); } } } } if (constraint == null || constraint.length() == 0) { return true; } return name.contains(constraint); }
From source file:org.eclipse.wb.internal.swt.model.property.editor.AcceleratorPropertyEditor.java
/** * Prepares {@link Map}'s for key code/name conversion. *//*w w w.jav a2 s. c om*/ private static void prepareKeyMaps() { if (m_keyCodeToName == null) { m_keyFields = Lists.newArrayList(); m_keyCodeToName = Maps.newTreeMap(); m_keyNameToCode = Maps.newTreeMap(); // add fields ExecutionUtils.runLog(new RunnableEx() { public void run() throws Exception { // add key codes from SWT for (Field field : SWT.class.getFields()) { String fieldName = field.getName(); int fieldValue = field.getInt(null); if (hasBits(fieldValue, SWT.KEYCODE_BIT)) { m_keyFields.add(fieldName); m_keyCodeToName.put(fieldValue, fieldName); m_keyNameToCode.put(fieldName, fieldValue); } } // add numbers for (char c = '0'; c < '9'; c++) { String charName = Character.toString(c); int charValue = c; m_keyFields.add(charName); m_keyCodeToName.put(charValue, charName); m_keyNameToCode.put(charName, charValue); } // add characters for (char c = 'A'; c < 'Z'; c++) { String charName = Character.toString(c); int charValue = c; m_keyFields.add(charName); m_keyCodeToName.put(charValue, charName); m_keyNameToCode.put(charName, charValue); } } }); } }
From source file:forms.frDados.java
/** * Recebe uma sentena, checa seu tipo e atualiza a poro do form correspondente. * @param obj A sentena NMEA mapeada para um objeto. */// w w w .j a v a 2s .c o m public void atualizarForm(GPSentence obj) { if (obj instanceof GPRMC) { GPRMC objC = (GPRMC) obj; txtTime.setText(objC.getUtcTime().toString()); txtLatitude.setText(objC.getLatitude() + " " + Character.toString(objC.getLatiChar())); txtLongitude.setText(objC.getLongitude() + " " + Character.toString(objC.getLongChar())); txtVelox.setText(objC.getSpeed()); txtDir.setText(objC.getDirecao()); lblEstadoPosit.setText(objC.getDescricaoPosicao()); jCalendarData.getDayChooser().setDay(Integer.parseInt(objC.getData().getDia())); jCalendarData.getMonthChooser().setMonth(Integer.parseInt(objC.getData().getMes()) - 1); jCalendarData.getYearChooser().setYear(Integer.parseInt(objC.getData().getAno())); pnl3DMapFX.setLatitude(Util.getLatitudeDegrees(objC.getLatitude(), objC.getLatiChar())); pnl3DMapFX.setLongitude(Util.getLongitudeDegrees(objC.getLongitude(), objC.getLongChar())); updateVeloxChart(objC); } else if (obj instanceof GPGSV) { //A sentena GSV e tratada pelo mtodo updateSatInfo //da interface ISatInfoListener //GPGSV objEsp = (GPGSV)obj; //((SateliteModel)tabSats.getModel()).setDados(sats); } }
From source file:net.sf.jabref.importer.fetcher.GVKParser.java
private BibEntry parseEntry(Element e) { String author = null;//from w ww .j a va2s . c o m String editor = null; String title = null; String publisher = null; String year = null; String address = null; String series = null; String edition = null; String isbn = null; String issn = null; String number = null; String pagetotal = null; String volume = null; String pages = null; String journal = null; String ppn = null; String booktitle = null; String url = null; String note = null; String quelle = ""; String mak = ""; String subtitle = ""; String entryType = "book"; // Default // Alle relevanten Informationen einsammeln List<Element> datafields = getChildren("datafield", e); for (Element datafield : datafields) { String tag = datafield.getAttribute("tag"); LOGGER.debug("tag: " + tag); // mak if ("002@".equals(tag)) { mak = getSubfield("0", datafield); if (mak == null) { mak = ""; } } //ppn if ("003@".equals(tag)) { ppn = getSubfield("0", datafield); } //author if ("028A".equals(tag)) { String vorname = getSubfield("d", datafield); String nachname = getSubfield("a", datafield); if (author == null) { author = ""; } else { author = author.concat(" and "); } author = author.concat(vorname + " " + nachname); } //author (weiterer) if ("028B".equals(tag)) { String vorname = getSubfield("d", datafield); String nachname = getSubfield("a", datafield); if (author == null) { author = ""; } else { author = author.concat(" and "); } author = author.concat(vorname + " " + nachname); } //editor if ("028C".equals(tag)) { String vorname = getSubfield("d", datafield); String nachname = getSubfield("a", datafield); if (editor == null) { editor = ""; } else { editor = editor.concat(" and "); } editor = editor.concat(vorname + " " + nachname); } //title and subtitle if ("021A".equals(tag)) { title = getSubfield("a", datafield); subtitle = getSubfield("d", datafield); } //publisher and address if ("033A".equals(tag)) { publisher = getSubfield("n", datafield); address = getSubfield("p", datafield); } //year if ("011@".equals(tag)) { year = getSubfield("a", datafield); } //year, volume, number, pages (year bei Zeitschriften (evtl. redundant mit 011@)) if ("031A".equals(tag)) { year = getSubfield("j", datafield); volume = getSubfield("e", datafield); number = getSubfield("a", datafield); pages = getSubfield("h", datafield); } // 036D seems to contain more information than the other fields // overwrite information using that field // 036D also contains information normally found in 036E if ("036D".equals(tag)) { // 021 might have been present if (title != null) { // convert old title (contained in "a" of 021A) to volume if (title.startsWith("@")) { // "@" indicates a number title = title.substring(1); } else { // we nevertheless keep the old title data } number = title; } //title and subtitle title = getSubfield("a", datafield); subtitle = getSubfield("d", datafield); volume = getSubfield("l", datafield); } //series and number if ("036E".equals(tag)) { series = getSubfield("a", datafield); number = getSubfield("l", datafield); String kor = getSubfield("b", datafield); if (kor != null) { series = series + " / " + kor; } } //note if ("037A".equals(tag)) { note = getSubfield("a", datafield); } //edition if ("032@".equals(tag)) { edition = getSubfield("a", datafield); } //isbn if ("004A".equals(tag)) { final String isbn10 = getSubfield("0", datafield); final String isbn13 = getSubfield("A", datafield); if (isbn10 != null) { isbn = isbn10; } if (isbn13 != null) { isbn = isbn13; } } // Hochschulschriftenvermerk // Bei einer Verlagsdissertation ist der Ort schon eingetragen if ("037C".equals(tag)) { if (address == null) { address = getSubfield("b", datafield); if (address != null) { address = removeSortCharacters(address); } } String st = getSubfield("a", datafield); if ((st != null) && st.contains("Diss")) { entryType = "phdthesis"; } } //journal oder booktitle /* Problematiken hier: Sowohl fr Artikel in * Zeitschriften als fr Beitrge in Bchern * wird 027D verwendet. Der Titel mu je nach * Fall booktitle oder journal zugeordnet * werden. Auch bei Zeitschriften werden hier * ggf. Verlag und Ort angegeben (sind dann * eigentlich berflssig), whrend bei * Buchbeitrgen Verlag und Ort wichtig sind * (sonst in Kategorie 033A). */ if ("027D".equals(tag)) { journal = getSubfield("a", datafield); booktitle = getSubfield("a", datafield); address = getSubfield("p", datafield); publisher = getSubfield("n", datafield); } //pagetotal if ("034D".equals(tag)) { pagetotal = getSubfield("a", datafield); if (pagetotal != null) { // S, S. etc. entfernen pagetotal = pagetotal.replaceAll(" S\\.?$", ""); } } // Behandlung von Konferenzen if ("030F".equals(tag)) { address = getSubfield("k", datafield); if (!"proceedings".equals(entryType)) { subtitle = getSubfield("a", datafield); } entryType = "proceedings"; } // Wenn eine Verlagsdiss vorliegt if ("phdthesis".equals(entryType) && (isbn != null)) { entryType = "book"; } //Hilfskategorien zur Entscheidung @article //oder @incollection; hier knnte man auch die //ISBN herausparsen als Erleichterung fr das //Auffinden der Quelle, die ber die //SRU-Schnittstelle gelieferten Daten zur //Quelle unvollstndig sind (z.B. nicht Serie //und Nummer angegeben werden) if ("039B".equals(tag)) { quelle = getSubfield("8", datafield); } if ("046R".equals(tag) && ((quelle == null) || quelle.isEmpty())) { quelle = getSubfield("a", datafield); } // URLs behandeln if ("009P".equals(tag) && ("03".equals(datafield.getAttribute("occurrence")) || "05".equals(datafield.getAttribute("occurrence"))) && (url == null)) { url = getSubfield("a", datafield); } } // Abfangen von Nulleintraegen if (quelle == null) { quelle = ""; } // Nichtsortierzeichen entfernen if (author != null) { author = removeSortCharacters(author); } if (editor != null) { editor = removeSortCharacters(editor); } if (title != null) { title = removeSortCharacters(title); } if (subtitle != null) { subtitle = removeSortCharacters(subtitle); } // Dokumenttyp bestimmen und Eintrag anlegen if (mak.startsWith("As")) { entryType = "misc"; if (quelle.contains("ISBN")) { entryType = "incollection"; } if (quelle.contains("ZDB-ID")) { entryType = "article"; } } else if (mak.isEmpty()) { entryType = "misc"; } else if (mak.startsWith("O")) { entryType = "misc"; // FIXME: online only available in Biblatex //entryType = "online"; } /* * Wahrscheinlichkeit, dass ZDB-ID * vorhanden ist, ist grer als ISBN bei * Buchbeitrgen. Daher bei As?-Stzen am besten immer * dann @incollection annehmen, wenn weder ISBN noch * ZDB-ID vorhanden sind. */ BibEntry result = new BibEntry(IdGenerator.next(), entryType); // Zuordnung der Felder in Abhngigkeit vom Dokumenttyp if (author != null) { result.setField(FieldName.AUTHOR, author); } if (editor != null) { result.setField(FieldName.EDITOR, editor); } if (title != null) { result.setField(FieldName.TITLE, title); } if (!Strings.isNullOrEmpty(subtitle)) { // ensure that first letter is an upper case letter // there could be the edge case that the string is only one character long, therefore, this special treatment // this is Apache commons lang StringUtils.capitalize (https://commons.apache.org/proper/commons-lang/javadocs/api-release/org/apache/commons/lang3/StringUtils.html#capitalize%28java.lang.String%29), but we don't want to add an additional dependency ('org.apache.commons:commons-lang3:3.4') StringBuilder newSubtitle = new StringBuilder( Character.toString(Character.toUpperCase(subtitle.charAt(0)))); if (subtitle.length() > 1) { newSubtitle.append(subtitle.substring(1)); } result.setField("subtitle", newSubtitle.toString()); } if (publisher != null) { result.setField(FieldName.PUBLISHER, publisher); } if (year != null) { result.setField(FieldName.YEAR, year); } if (address != null) { result.setField("address", address); } if (series != null) { result.setField("series", series); } if (edition != null) { result.setField("edition", edition); } if (isbn != null) { result.setField(FieldName.ISBN, isbn); } if (issn != null) { result.setField(FieldName.ISSN, issn); } if (number != null) { result.setField(FieldName.NUMBER, number); } if (pagetotal != null) { result.setField("pagetotal", pagetotal); } if (pages != null) { result.setField(FieldName.PAGES, pages); } if (volume != null) { result.setField(FieldName.VOLUME, volume); } if (journal != null) { result.setField(FieldName.JOURNAL, journal); } if (ppn != null) { result.setField("ppn_GVK", ppn); } if (url != null) { result.setField(FieldName.URL, url); } if (note != null) { result.setField("note", note); } if ("article".equals(entryType) && (journal != null)) { result.setField(FieldName.JOURNAL, journal); } else if ("incollection".equals(entryType) && (booktitle != null)) { result.setField("booktitle", booktitle); } return result; }