Java Code Examples for joptsimple.internal.Strings#join()
The following examples show how to use
joptsimple.internal.Strings#join() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClueScrollPlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
@Subscribe public void onCommandExecuted(CommandExecuted commandExecuted) { if (commandExecuted.getCommand().equals("clue")) { String text = Strings.join(commandExecuted.getArguments(), " "); if (text.isEmpty()) { resetClue(true); } else { ClueScroll clueScroll = findClueScroll(text); log.debug("Found clue scroll for '{}': {}", text, clueScroll); updateClue(clueScroll); } } }
Example 2
Source File: ClueScrollPlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
@Subscribe public void onCommandExecuted(CommandExecuted commandExecuted) { if (developerMode && commandExecuted.getCommand().equals("clue")) { String text = Strings.join(commandExecuted.getArguments(), " "); if (text.isEmpty()) { resetClue(true); } else { ClueScroll clueScroll = findClueScroll(text); log.debug("Found clue scroll for '{}': {}", text, clueScroll); updateClue(clueScroll); } } }
Example 3
Source File: EmojiPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
@Nullable String updateMessage(final String message) { final String[] messageWords = WHITESPACE_REGEXP.split(message); boolean editedMessage = false; for (int i = 0; i < messageWords.length; i++) { // Remove tags except for <lt> and <gt> final String trigger = Text.removeFormattingTags(messageWords[i]); final Emoji emoji = Emoji.getEmoji(trigger); if (emoji == null) { continue; } final int emojiId = modIconsStart + emoji.ordinal(); messageWords[i] = messageWords[i].replace(trigger, "<img=" + emojiId + ">"); editedMessage = true; } // If we haven't edited the message any, don't update it. if (!editedMessage) { return null; } return Strings.join(messageWords, " "); }
Example 4
Source File: EmojiPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Nullable String updateMessage(final String message) { final String[] messageWords = WHITESPACE_REGEXP.split(message); boolean editedMessage = false; for (int i = 0; i < messageWords.length; i++) { // Remove tags except for <lt> and <gt> final String trigger = Text.removeFormattingTags(messageWords[i]); final Emoji emoji = Emoji.getEmoji(trigger); if (emoji == null) { continue; } final int emojiId = modIconsStart + emoji.ordinal(); messageWords[i] = messageWords[i].replace(trigger, "<img=" + emojiId + ">"); editedMessage = true; } // If we haven't edited the message any, don't update it. if (!editedMessage) { return null; } return Strings.join(messageWords, " "); }
Example 5
Source File: VisageHandler.java From Visage with MIT License | 5 votes |
public VisageHandler(VisageDistributor distributor) { this.distributor = distributor; List<String> debug = distributor.config.getStringList("debug"); rendererHeader = debug.contains("renderer"); cacheHeader = debug.contains("cache"); reportExceptions = debug.contains("error"); if (rendererHeader || cacheHeader) { Visage.log.warning("Visage is set to include debugging information in HTTP headers. This should be disabled in production."); } if (reportExceptions) { Visage.log.warning("Visage is set to include exception stack traces in failed requests. This can expose internal system information such as authentication information."); } usernames = distributor.config.getBoolean("lookup-names"); minSize = distributor.config.getInt("render.min-size"); defaultSize = distributor.config.getInt("render.default-size"); maxSize = distributor.config.getInt("render.max-size"); maxAttempts = distributor.config.getInt("render.tries"); granularity = distributor.config.getInt("render.size-granularity"); resolverTtlMillis = distributor.config.getDuration("redis.resolver-ttl", TimeUnit.MILLISECONDS); skinTtlMillis = distributor.config.getDuration("redis.skin-ttl", TimeUnit.MILLISECONDS); baseUrl = distributor.config.getString("base-url"); List<String> modes = distributor.config.getStringList("modes"); for (String s : modes) { try { allowedModes.add(RenderMode.valueOf(s.toUpperCase())); } catch (IllegalArgumentException ignore) {} } allowedModesS = Strings.join(modes, ", "); }
Example 6
Source File: SegmentRecord.java From skywalking with Apache License 2.0 | 5 votes |
@Override public Map<String, Object> data2Map(SegmentRecord storageData) { storageData.statement = Strings.join(new String[] { storageData.endpointName, storageData.traceId }, " - "); Map<String, Object> map = new HashMap<>(); map.put(SEGMENT_ID, storageData.getSegmentId()); map.put(TRACE_ID, storageData.getTraceId()); map.put(TopN.STATEMENT, storageData.getStatement()); map.put(SERVICE_ID, storageData.getServiceId()); map.put(SERVICE_INSTANCE_ID, storageData.getServiceInstanceId()); map.put(ENDPOINT_NAME, storageData.getEndpointName()); map.put(ENDPOINT_ID, storageData.getEndpointId()); map.put(START_TIME, storageData.getStartTime()); map.put(END_TIME, storageData.getEndTime()); map.put(LATENCY, storageData.getLatency()); map.put(IS_ERROR, storageData.getIsError()); map.put(TIME_BUCKET, storageData.getTimeBucket()); if (CollectionUtils.isEmpty(storageData.getDataBinary())) { map.put(DATA_BINARY, Const.EMPTY_STRING); } else { map.put(DATA_BINARY, new String(Base64.getEncoder().encode(storageData.getDataBinary()))); } map.put(VERSION, storageData.getVersion()); return map; }
Example 7
Source File: RyaCommands.java From rya with Apache License 2.0 | 5 votes |
private String formatLine(final BindingSet bs, final List<String> bindings) { final List<String> bindingValues = new ArrayList<>(); for(final String bindingName : bindings) { bindingValues.add(bs.getBinding(bindingName).getValue().toString()); } return Strings.join(bindingValues, ","); }
Example 8
Source File: CommandHelper.java From ForgeHax with MIT License | 4 votes |
public static String join(String[] args, String separator, int startIndex, int endIndex) { return Strings.join( Arrays.copyOfRange(args, startIndex, endIndex), com.google.common.base.Strings.nullToEmpty(separator)); }
Example 9
Source File: Path.java From gatk-protected with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public String toString() { final String joinedPath = Strings.join(getVertices().stream().map(v -> v.getSequenceString()).collect(Collectors.toList()), "->"); return String.format("Path{score=%d, path=%s}", totalScore, joinedPath); }
Example 10
Source File: Path.java From gatk with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public String toString() { final String joinedPath = Strings.join(getVertices().stream().map(v -> v.getSequenceString()).collect(Collectors.toList()), "->"); return String.format("Path{path=%s}", joinedPath); }
Example 11
Source File: DistinctCountThetaSketchTest.java From incubator-pinot with Apache License 2.0 | 4 votes |
private void testThetaSketches(boolean groupBy, boolean sql) { String tsQuery, distinctQuery; String thetaSketchParams = "nominalEntries=1001"; List<String> predicateStrings = Collections.singletonList("colA = 1"); String whereClause = Strings.join(predicateStrings, " or "); tsQuery = buildQuery(whereClause, thetaSketchParams, predicateStrings, whereClause, groupBy, false); distinctQuery = buildQuery(whereClause, null, null, null, groupBy, false); testQuery(tsQuery, distinctQuery, groupBy, sql, false); tsQuery = buildQuery(whereClause, thetaSketchParams, predicateStrings, whereClause, groupBy, true); testQuery(tsQuery, distinctQuery, groupBy, sql, true); // Test Intersection (AND) predicateStrings = Arrays.asList("colA = 1", "colB >= 2.0", "colC <> 'colC_1'"); whereClause = Strings.join(predicateStrings, " and "); tsQuery = buildQuery(whereClause, thetaSketchParams, predicateStrings, whereClause, groupBy, false); distinctQuery = buildQuery(whereClause, null, null, null, groupBy, false); testQuery(tsQuery, distinctQuery, groupBy, sql, false); tsQuery = buildQuery(whereClause, thetaSketchParams, predicateStrings, whereClause, groupBy, true); testQuery(tsQuery, distinctQuery, groupBy, sql, true); // Test Union (OR) predicateStrings = Arrays.asList("colA = 1", "colB = 1.9"); whereClause = Strings.join(predicateStrings, " or "); tsQuery = buildQuery(whereClause, thetaSketchParams, predicateStrings, whereClause, groupBy, false); distinctQuery = buildQuery(whereClause, null, null, null, groupBy, false); testQuery(tsQuery, distinctQuery, groupBy, sql, false); tsQuery = buildQuery(whereClause, thetaSketchParams, predicateStrings, whereClause, groupBy, true); testQuery(tsQuery, distinctQuery, groupBy, sql, true); // Test complex predicates predicateStrings = Arrays.asList("colA in (1, 2)", "colB not in (3.0)", "colC between 'colC_1' and 'colC_5'"); whereClause = predicateStrings.get(0) + " and " + predicateStrings.get(1) + " or " + predicateStrings.get(0) + " and " + predicateStrings.get(2); tsQuery = buildQuery(whereClause, thetaSketchParams, predicateStrings, whereClause, groupBy, false); distinctQuery = buildQuery(whereClause, null, null, null, groupBy, false); testQuery(tsQuery, distinctQuery, groupBy, sql, false); tsQuery = buildQuery(whereClause, thetaSketchParams, predicateStrings, whereClause, groupBy, true); testQuery(tsQuery, distinctQuery, groupBy, sql, true); // Test without predicate arguments whereClause = predicateStrings.get(0) + " and " + predicateStrings.get(1) + " or " + predicateStrings.get(0) + " and " + predicateStrings.get(2); tsQuery = buildQuery(whereClause, thetaSketchParams, Collections.emptyList(), whereClause, groupBy, false); distinctQuery = buildQuery(whereClause, null, null, null, groupBy, false); testQuery(tsQuery, distinctQuery, groupBy, sql, false); tsQuery = buildQuery(whereClause, thetaSketchParams, predicateStrings, whereClause, groupBy, true); testQuery(tsQuery, distinctQuery, groupBy, sql, true); }