id
stringlengths
7
14
text
stringlengths
1
37.2k
148707832_1
public static String sha256hex(String input) { return DigestUtils.sha256Hex(input); }
148862443_2
public static SessionFactory getSessionFactory(@NonNull MetadataSources sources) { try { Metadata metadata = sources.getMetadataBuilder().build(); return metadata.getSessionFactoryBuilder().build(); } catch (Exception e) { if (sources.getServiceRegistry() != null) { StandardServiceRegistryBuilder....
148886237_185
public void execute(AdminCommandContext context) { final ActionReport report = context.getActionReport(); try { List<String> list = new ArrayList<String>(); Collection<MailResource> mailResources = domain.getResources().getResources(MailResource.class); for (MailResourc...
148915786_0
public static String run(String text) { if (text == null || text.length() == 0) { return ""; } String toReturn = ""; try { String normalizedText = normalize(text); normalizedText = normalizedText.replaceAll("[^\\w\\s\\-]", ""); normalizedText = normalizedText.replaceAll(...
148918310_11
static String flipName(String name) { int i = name.lastIndexOf('$'); if (i != -1) name = name.replace('$', '-'); else if ((i = name.lastIndexOf('-')) != -1) name = name.replace('-', '$'); else i = name.lastIndexOf('.'); return i == -1 ? Strings.flipFirstCap(name) : name.substring(0, i + 1) + Stri...
149088809_1
private Exchange(String name, boolean future, ZoneId zoneId, LocalTime[] marketTimes) { this.name = name; this.future = future; this.zoneId = zoneId; this.zoneOffset = LocalDateTime.now().atZone(zoneId).getOffset(); this.marketTimes = marketTimes; contracts = new HashMap<>(); for(ExchangeCon...
149123005_31
public void registerTask(final Runnable task, int startAt, TN fromNode) { Task<TN> sw = new Task<>(task); msgs.addMsg(new Envelope.SingleDestEnvelope<>(sw, fromNode, fromNode, time, startAt)); }
149263873_29
@Nonnull public static EntityDataStore<Object> getDataStore() { SchemaModifier schemaModifier = new SchemaModifier(configuration); schemaModifier.createTables(TableCreationMode.CREATE_NOT_EXISTS); return new EntityDataStore<>(configuration); }
149270308_1
void alignContent(double crossSize) { minCrossSize = 0; if (flexLines.size()==0)return; if (flexLines.size() <= 1) { if (flexLines.size() == 1) { minCrossSize = flexLines.get(0).getMinCrossSize(); } return; // nothing to do according to spec } for (Fl...
149281309_19
@Override QueryResponse execute() { QueryResponse response = new QueryResponse(); List<PartitionResponse> result = new ArrayList<>(); for (Endpoint endpoint : queryRequest.getEndpoints()) { String host = endpoint.getHost(); try { LOGGER.debug("Executing request for: " + host); ...
149347972_9
public Object getCurrentValue(String value) { Method[] methods = getClass().getDeclaredMethods(); Object result = null; boolean foundMethod = false; for (Method method : methods) { String getMethod = "get" + value.substring(0, 1).toUpperCase() + value.substring(1); String isMethod = ...
149351086_542
public Map<String, Long> getNonProdInfoByEnv(String assetGroup, String severitylevel) { Map<String, Long> nonProdInfo = new HashMap<>(); StringBuilder urlToQuery = new StringBuilder(esUrl).append("/").append(assetGroup); urlToQuery.append("/").append(SEARCH); StringBuilder requestBody = new StringBuilder( "{\"...
149579497_1
public boolean hasBody(final JCTree element) { Class bodyClass = JCTree.JCBlock.class; Class staClass = JCTree.JCStatement.class; Field[] declaredFields = element.getClass().getDeclaredFields(); return Arrays.stream(declaredFields) .filter(field -> field.getName().equals("body")) ...
149598464_0
public static String stringify(long byteNumber) { if (byteNumber / TB_IN_BYTES > 0) { return df.format((double) byteNumber / (double) TB_IN_BYTES) + "TB"; } else if (byteNumber / GB_IN_BYTES > 0) { return df.format((double) byteNumber / (double) GB_IN_BYTES) + "GB"; } else if (byteNumber / M...
149604731_6
@Override public List<List<ItemCatDto>> getRootCat(Integer catLimit, Integer itemLimit) { return Lists.partition(getItemCatWithItems("index", catLimit, itemLimit), 2); }
149607740_66
@Override public V get(K name) { return null; }
149641877_6
public void execute() throws MojoExecutionException { getLog().info("Starting Axway Publisher"); AxwayPublishingAdapter adapter = getAxwayPublishingAdapter(); PublicationReader publicationReader = getPublicationReader(); try { final Publication publication = publicationReader.read(getStageConfig...
149663208_4
@Override public void configure(Map<String, ?> configs, boolean isKey) { if (isKey) { throw new IllegalArgumentException("Cannot use CloudEventSerializer as key serializer"); } Object encodingConfig = configs.get(ENCODING_CONFIG); if (encodingConfig instanceof String) { this.encoding = E...
149708915_0
private void getAllPosts(ServerRequest serverRequest, ServerResponse serverResponse) { serverResponse.send(EntityUtils.toJsonArray(this.posts.all())); }
149714580_1
public Iterable<MetaDatabase> query(){ return metaDatabaseRepository.findAll(); }
149732116_0
public List<Integer> getDelayMinutes() { return IntStream.range(0, MAX_INTERVAL_PERIODS) .map(period -> (period + 1) * DELAY_INTERVAL_MINUTES) .filter(this::isShopOpenInMinutes) .boxed() .collect(Collectors.toList()); }
149815623_12
public int getNextRequestID() { return messageDispatcher.getNextRequestID(); }
149851179_1
public ArrayList<Format> getFormats() throws IOException, JSONException { ArrayList<Format> formats = new ArrayList<>(); JSONObject jsonFormats = mLocalFileHelper.getJSONFormatsFile(); JSONArray formatData = jsonFormats.getJSONArray("data"); for (int i = 0; i < formatData.length(); i++) { JSONOb...
149970281_4
public String getAnimeName() { return animeName; }
150186815_7
public static <K, C, E, A> InputStreams<K, C> addTopology(TopologyContext<K, C, E, A> ctx, final StreamsBuilder builder) { // Consume from topics final KStream<K, CommandRequest<K, C>> commandRequestStream = EventSourcedConsumer.commandRequestStream(ctx, builder); final KStream<K, CommandResponse<K>> comman...
150292534_4
@RabbitListener( bindings = @QueueBinding( exchange = @Exchange(value = RabbitMQConstant.NONE_EXCHANGE, type = ExchangeTypes.TOPIC), value = @Queue(value = RabbitMQConstant.NONE_QUEUE, durable = RabbitMQConstant.TURE_CONSTANT), key = RabbitMQConstant.NONE_KEY ), containerFactory = "c...
150308585_73
@Override public SimpleFacetQuery convert(HostLogFilesRequest request) { SimpleFacetQuery facetQuery = new SimpleFacetQuery(); facetQuery.addCriteria(new SimpleStringCriteria(String.format("%s:(%s)", HOST, request.getHostName()))); if (StringUtils.isNotEmpty(request.getComponentName())) { facetQuery.addCriter...
150309255_5
@GET @Produces({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) public AboutInfo about( @Context HttpServletRequest req, @Context HttpServletResponse res) { init(res); return new AboutInfo("AMS API"); }
150407753_2
public boolean collision(PaintView paintView) { return collision(paintView.getCircleX(), paintView.getCircleY(), paintView.getCircleRadius()); }
150411824_1
public static String[] parse(String path, ConfigOptions options) { return parse(path, options.getPathSeparator(), options.getKeyValidator()); }
150434337_86
public Map<Long, FMHMMNode> loopLoadForest(String cInputString) { Here: for (int i = StableData.INT_ZERO; i < cInputString.length(); i++) { if (linkedHashMap.containsKey(Long.valueOf(cInputString.charAt(i)))) { FMHMMNode fHHMMNode = linkedHashMap.get(Long.valueOf(cInputString.charAt(i))); linkedHashMap = ...
150470825_0
public void saveContainer(Container c) throws Exception { connection.saveContainer(c); }
150561722_0
public String parse(String src) { // 对文档进行分词处理 Tokens tokens=lexer.lex(src); // 解析Token return parser.parse(tokens); }
150573009_0
public static List<DataRecord> flattenJson(DataRecord dataRecord, String json, TargetModel targetModel) throws InvalidJSONException, ColumnFamilyNotFoundException, InvalidColumnException { List<DataRecord> dataRecordList = new ArrayList<>(); dataRecordList.add(dataRecord); boolean useParentKey = true; JsonElem...
150632370_4
public void ostaLounas(Matkakortti kortti) { kortti.osta(HINTA); myytyjaLounaita++; }
150673713_13
public T call(Callable<T> callable) { long startTime = System.currentTimeMillis(); long attemptNumbers = 0; while (true) { attemptNumbers++; final Attempt<T> attempt = attempt(callable, attemptNumbers, startTime); // on retry retryListeners.forEach(listener -> listener.accept(attempt)); // sho...
150677892_59
public OpenSessionOptionBuilder setCameraByIndex(final Integer cameraByIndex) { this.cameraByIndex = cameraByIndex; this.cameraBySerialNumber = null; return this; }
151120862_4
@RequestMapping("/label/{label}") public String viewLabel(@PathVariable("label") String label, Model model) throws IOException { List<StorageObject> objects = cuteImageService.listAll(); List<Image> images = new ArrayList<>(); for (StorageObject obj : objects) { Image image = new Image(getPublicUrl(cuteIm...
151122650_154
BackoffDelay calculateBackoff(IterationContext<T> retryContext, Instant timeoutInstant) { if (retryContext.iteration() > maxIterations) return RETRY_EXHAUSTED; BackoffDelay nextBackoff = backoff.apply(retryContext); Duration minBackoff = nextBackoff.min; Duration maxBackoff = nextBackoff.max; Duration backoff =...
151233646_40
public void parseFluxResponse(@Nonnull final BufferedSource bufferedSource, @Nonnull final Cancellable cancellable, @Nonnull final FluxResponseConsumer consumer) throws IOException { Arguments.checkNotNull(bufferedSource, "bufferedSource"); Reader re...
151258081_119
public static TiledMap parse (File tmxFile) throws TiledParserException { Objects.requireNonNull(tmxFile); if (!tmxFile.exists()) { throw new TiledParserException("tmx map file doesn't exists: " + tmxFile.getAbsolutePath()); } Document doc = null; try { doc = getDoc(tmxFile); ...
151435201_11
public String build() throws Exception { LOG.debug("Class building started for the class %s", fluent.getKlass().getSimpleName()); var list = fluent.getNodes(); if (list.size() == 0) { throw new GeciException("There are no actual calls in the fluent structure."); } LOG.debug("There are %d nod...
151471167_10
@Override public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { if (getArguments() == null) { setArguments(new Object[]{contribution, chunkContext}); } contribution.setExitStatus(mapResult(invokeDelegateMethod())); return RepeatStatus.FINISHED; }
151476055_6
public List<String> getAllMemberships() { Membership memberships = restService.makeCall(membershipServerUrl, membershipServerUri, Membership.class); memberships.getMemberships().replaceAll(String::toUpperCase); return memberships.getMemberships(); }
151583278_2
public void validateOrderDate( @XPath(value = "/order:order/order:date", namespaces = @NamespacePrefix(prefix = "order", uri = "http://org.jboss.fuse.quickstarts/examples/order/v7")) String date) throws OrderValidationException { final Calendar calendar = new GregorianCalendar(); try { calen...
151746922_0
static Acl mapPosixFilePermissionToCloudSearchAcl(Path pathToFile) throws IOException { // Id of the identity source for external user/group IDs. Shown here, // but may be omitted in the SDK as it is automatically applied // based on the `api.identitySourceId` configuration parameter. String identitySourceId = ...
151822173_0
public static <T extends Serializable> int getPositionInList(T[] list, T element) { for (int i = 0; i < list.length; i++) if(list[i].equals(element)) return i; return -1; }
152002724_0
public <S> Metadata load(Class<S> serviceProvider) throws IOException, SuselMetadataNullException { var module = serviceProvider.getModule(); var metadata = perModuleMetadataCache.get(module); if (metadata != null) { return metadata; } synchronized (LOCK) { // Check one mo...
152163398_0
public synchronized String getNow() { return sdf.format(new Date()); }
152242718_9
protected static List<String> getIPFromInputStream(BufferedReader reader) { if (reader != null) { Set<String> allLines = new LinkedHashSet<>(); String line = null; try { while ((line = reader.readLine()) != null) { Matcher matcher = kIPPattern.matcher(line); ...
152350105_3
protected static String getSignature(Param[] params, Account account) { String signature = ""; if (params != null) { // 排序 sortParams(params); // 拼接参数 String stitchParams = stitchParams(params); // 拼接privateKey stitchParams += account.getPrivateKey(); // 签...
152358305_7
public User userFromId(String id) { if (id == null) { return null; } User user = new User(); user.setId(id); return user; }
152415097_16
public static ConnectionProperties from(Properties properties) throws ConfigurationException { Class<? extends NativeConnectionProvider> nativeConnectionProviderClass = getClassOfType(properties, CONFIG_CONNECTION_NATIVE_CLASS, DEFAULT_CONNECTION_NATIVE_CLASS, NativeConnectionProvider.class); Class<? extends Jm...
152559710_128
@Override public void run() { // printuserorgan -u=1 -t=requests Optional<Client> client = manager.getClientByID(uid); if (!client.isPresent()) { outputStream.println("No client exists with that user ID"); return; } if ("requests".equals(type) || "donations".equals(type)) { o...
152655369_33
public static boolean isHttpOrHttps(String url) { if (TextUtils.isEmpty(url)) { return false; } return url.startsWith("http:") || url.startsWith("https:"); }
152871165_23
ClassLoader getLoader() { return loader; }
152877991_11
@SuppressWarnings("unchecked") public static <T extends Serializable> T getConfig(ConfigRefEnum key, @Nullable T defaultValue){ T result = (T) CONFIG.get(key); return result == null ? defaultValue : result; }
153022185_1
public static void inject(@NonNull Object target, @NonNull String fieldName, Object value) { Field field; try { field = target.getClass().getDeclaredField(fieldName); field.setAccessible(true); field.set(target, value); } catch (NoSuchFieldException e) { throw new FakegenExc...
153061118_9
@Deprecated public static org.apache.rocketmq.common.message.Message convertToRocketMessage( ObjectMapper objectMapper, String charset, String destination, org.springframework.messaging.Message message) { Object payloadObj = message.getPayload(); byte[] payloads; if (payloadObj instanceof String) {...
153085231_2
void registerAccount(String dlt, Account account) throws IllegalKeyException, EmptyAccountException { if (null == dlt) { throw new IllegalKeyException(); } else if (null == account) { throw new EmptyAccountException(); } if (null == this.accountMap) { this.accountMap = new HashMa...
153088484_15
@CmdAnnotation(cmd = "ac_updatePassword", version = 1.0, description = "根据原密码修改账户密码/Modify the account password by the original password") @Parameters(value = { @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链id"), @Parameter(parameterName = "addr...
153153932_0
public void commit() { this.committer.commit(); }
153224042_12
@Nullable static String calculateMd5(@NonNull InputStream inputStream) { MessageDigest digest; try { digest = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { VLog.w(e, "Exception while getting digest"); return null; } byte[] buffer = new byte[8192]; ...
153274035_4
public static Long valueAsLong(Headers headers, String key) { return asLong(value(headers, key)); }
153278268_6
public static PokerSell checkPokerType(List<Poker> pokers) { if(pokers != null && ! pokers.isEmpty()) { sortPoker(pokers); int[] levelTable = new int[20]; for(Poker poker: pokers) { levelTable[poker.getLevel().getLevel()] ++; } int startIndex = -1; int endIndex = -1; int count = 0; int singleCo...
153280357_3
@Override public void initializeSegment(TrackingToken token, String processorName, int segment) throws UnableToInitializeTokenException { try { AbstractTokenEntry<?> tokenEntry = new GenericTokenEntry<>(token, serializer, contentTyp...
153314760_9
@Override public <C> void send(Member destination, CommandMessage<? extends C> commandMessage) { shutdownLatch.ifShuttingDown("JGroupsConnector is shutting down, no new commands will be sent."); if (destination.local()) { localCommandBus.dispatch(commandMessage); } else { executor.execute(()...
153620926_0
@DbLog(resource = "demoResource", action = "demoAction") public void sayHello() { System.out.println("hello foo.\n"); }
153720290_4
@Override public ApiResponse apply(JdbcExecutor sender, String user, String password) { return apply(sender, JdbcJsonBuilder.buildAuthJson(user, password, "")); }
153720329_77
@Override public void release() { IoUtil.release(dataReader, lenReader, posReader); }
153881635_0
@Override public void setCurrentItem(int position) { mModel.setCurMainItem(position); }
153963082_3
public void sendHtmlInlinePhotoMail(String to, String subject, String content, String srcPath, String srcId) throws MessagingException { MimeMessage message = javaMailSender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(message, true); helper.setFrom(from); helper.setTo(to); ...
154016270_39
@Override public boolean shouldExecuteOnProject(Project project) { return (hasFilesToCheck(Type.MAIN, PmdConstants.REPOSITORY_KEY)) || (hasFilesToCheck(Type.TEST, PmdConstants.TEST_REPOSITORY_KEY)) || (hasFilesToCheck(Type.MAIN, PmdConstants.XML_REPOSITORY_KEY)); }
154099498_57
@WorkerThread @NonNull public <T> LineApiResponse<T> postWithJson( @NonNull Uri uri, @NonNull Map<String, String> requestHeaders, @NonNull String postData, @NonNull ResponseDataParser<T> responseDataParser) { return sendRequestWithJson(HttpMethod.POST, uri, requestHeaders, postData, ...
154137427_0
public static boolean dateIsBefore(String standDate, String desDate) { try { return YYYYMMDD_FORMAT.parse(desDate).before(YYYYMMDD_FORMAT.parse(standDate)); } catch (ParseException var3) { var3.printStackTrace(); return false; } }
154246246_56
public static Wallet importWalletFromMnemonic(Metadata metadata, @Nullable String accountName, String mnemonic, String path, @Nullable List<EOSKeystore.PermissionObject> permissions, String password, boolean overwrite) { if (metadata.getSource() == null) metadata.setSource(Metadata.FROM_MNEMONIC); IMTKeystore ...
154382730_14
@Override public Mono<Long> eventsCount(EventType type) { return repository.findByEventType(type) .map(r -> 1) .reduce(0L, Long::sum); }
154414016_5
public int find(int[] nums, int target) { if (nums == null || nums.length == 0) { throw new IllegalArgumentException("input array can not be null or empty!"); } if (!isOrdered(nums)) { throw new IllegalArgumentException("input array must be ordered!"); } int last = nums[nums.length - 1]; if (targe...
154510460_4
public double subtraction(double firstOperand, double secondOperand) { return firstOperand - secondOperand; }
154647700_15
@PostMapping(path = "/{service}/{method}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public ResponseEntity<String> serveVaadinService( @PathVariable("service") String serviceName, @PathVariable("method") String methodName, @RequestBody(required = false) ObjectNode body) { getLogger().debug("Servic...
154974836_3
public <F> @NonNull FunctionalProperty<T, F> field(final @NonNull String name) { final PropertyDescriptor descriptor = this.getPropertyDescriptor(name); return new FunctionalProperty<>(descriptor); }
155078306_3
protected static String map1stMatchingTagNames(SpanPack pack, String tagNames) { if (StringUtil.isEmpty(tagNames)) { return null; } return Arrays.stream(tagNames.split(",")) .map(tag -> pack.tags.getText(tag)) .filter(StringUtil::isNotEmpty) .findFirst().orElse(nu...
155195958_0
public boolean setTag(SongItem songItem) throws IOException, NotSupportedException { ID3v23Tag tag = new ID3v23Tag(); tag.setTitle(songItem.name); tag.setArtist(songItem.artist); tag.setAlbumArtist(songItem.artist); tag.setAlbum(songItem.album); mp3File.setId3v2Tag(tag); //写入临时文件 File tm...
155383451_87
protected void preparePath(N path, ApiDocPath<N> apiDocPath, ApiDocInfo apiDocInfo, String basePath, String originalEndpoint, String serviceId) { log.trace("Swagger Service Id: " + serviceId); log.trace("Original Endpoint: " + originalEndpoint); log.trace("Base Path: " + basePath); // Retrieve route wh...
155449545_1
@Override public void formatTo(Formatter formatter, int flags, int width, int precision) { formatter.format("%s-%s", value / 1000, value % 1000); }
155476310_2
public static String awsV4BuildCanonicalRequestString( HttpUriRequest httpMethod, String requestPayloadHexSha256Hash) { URI uri = httpMethod.getURI(); String httpRequestMethod = httpMethod.getMethod(); Map<String, String> headersMap = new HashMap<String, String>(); Header[] headers = httpMethod.get...
155618699_62
@Override public void handle(String optionValue, Options options) { Set<OutputFormat> formats = ImmutableSet.of(OutputFormat.STDOUT); if (!StringUtils.isBlank(optionValue)) { try { String[] formatStrings = optionValue.split(","); formats = Arrays.stream(formatStrings).map(String...
155675451_80
public ReleaseVersionResponse getReleaseVersion() throws ApiException { ApiResponse<ReleaseVersionResponse> resp = getReleaseVersionWithHttpInfo(); return resp.getData(); }
155886348_74
public boolean isArrivalEvent(@NonNull RouteProgress routeProgress, @NonNull Milestone milestone) { if (!(milestone instanceof BannerInstructionMilestone)) { return false; } boolean isValidArrivalManeuverType = upcomingStepIsArrivalManeuverType(routeProgress) || currentStepIsArrivalManeuverType(routeProgr...
155931552_1
@CustomFunctionResolver("DensityCustomFunctionResolver0") public static Double Density(List<Tuple> things) { if(things == null || things.size() == 0) return null; double sumDensity = 0.0; int numValidThings = 0; Double density = null; try { for(Tuple t : things) { if(!(...
155961075_0
@Override public Mono<ExecutionResult> invoke(GraphQLInvocationData invocationData, ServerWebExchange serverWebExchange) { ExecutionInput.Builder executionInputBuilder = ExecutionInput.newExecutionInput() .query(invocationData.getQuery()) .operationName(invocationData.getOperationName()) ...
156083116_0
private static byte a(char var0) { byte var1 = 0; if (var0 != 'c') { switch(var0) { case '0': break; case '1': return 1; case '2': return 2; case '3': return 3; case '4': return 4; case '5': return 5; case '6': ret...
156101856_17
public String generateDiagramText() throws ClassNotFoundException, IOException { resolvedClasses.clear(); // read all classes from directories or jars resolvedClasses.addAll(getAllDiagramClasses()); // sort all classes for a reliable sorted result Collections.sort(resolvedClasses, (o1, o2) -> o1.getName().compareT...
156245499_6
private void checkResult(List<?> collect) { for (Object o : collect) { System.out.println(o.toString()); } }
156298013_124
public static BigDecimal toSha(String number, Unit unit) { return toSha(new BigDecimal(number), unit); }
156317154_6
@Nullable public static LinearRange rangeOfMatch(String pattern, String str) { st<LinearRange> literalRanges = getLiteralRanges(pattern); t first = -1; t pos = 0; r (LinearRange literalRange: literalRanges) { tring literal = pattern.substring(literalRange.getFrom(), literalRange.getTo()); nt index = indexOf(str, liter...
156459372_14
static <A> List<A> reverse(final List<A> list) { return Lists.foldLeft(list, Collections.emptyList(), (reversedList, item) -> Lists.prepend(item, reversedList) ); }
156601203_7
public static void setRequestHeader(RequestHeader header) { threadLocal.get().setHeader(header); }
156606443_2
public static void sortUnsigned(long[] data) { sortUnsigned(data, 0, data.length); }
156613410_3
public static String addForInterface(String interfaceType) { if (interfaceType.contains("<")) { return null; } return shortName(interfaceType); }