id
stringlengths
7
14
text
stringlengths
1
37.2k
61826847_14
public static String getTooltipText(GraphEntity entity) { Map<String, Object> properties = entity.getPropertyContainer().getProperties(); String start = "<p width=\"" + LABEL_TEXT_WIDTH + "px\"><b>"; String typesRepresentation = entity.isTypesSingle() ? entity.getTypes().get(0) : entity.getTypes().toString...
61857466_53
public InstallStatusStatus itemCount(Integer itemCount) { this.itemCount = itemCount; return this; }
61872305_0
@Override public boolean contains(@NonNull String id) throws IOException { return local.contains(id) || remote.contains(id); }
61882336_7
@RequestMapping(value = "/grid-data", method = RequestMethod.GET) public @ResponseBody List<GridRowDTO> getGrid() { LOGGER.info("get data for grid view", DemoController.class); List<GridRowDTO> gridRowDTOs = new ArrayList<GridRowDTO>(); gridRowDTOs.add(new GridRowDTO(1, "Barbarian Queen", "Neutral Evil"));...
61942185_0
static WechatPrepayResponseDto getPrepay(WechatPrepayData prepayData, String hostEndpoint) throws Exception { Assert.isNotNull(hostEndpoint); WechatPrepayRequestDto prepayDto = new WechatPrepayRequestDto( prepayData.getAppId(), prepayData.getMchId(), prepayData.getMchSecret()); prepayDto.setNon...
61947614_6
public synchronized void addMessage(Peer sourcePeer, int messageType, int dependencyId, ByteBuf content) { if (checkDependency(dependencyId)) { byte[] contentBytes = new byte[content.readableBytes()]; content.readBytes(contentBytes); messageQueue.add(new IncomingEnvelope(sourcePeer, message...
61968968_2
public static SimpleVector nearestPoint(SimpleVector[] line, SimpleVector point) { SimpleVector a = new SimpleVector(line[0]); a.sub(point); SimpleVector b = new SimpleVector(line[1]); b.sub(line[0]); float top = a.calcDot(b); double t = - top / Math.pow(line[1].distance(line[0]),2.0); r...
61971175_2
void record(Record record) { MutableSpan span = spanMap.get(record.traceId()); if (span == null) { MutableSpan newSpan = new MutableSpan(record.traceId(), Time$.MODULE$.now()); MutableSpan prev = spanMap.putIfAbsent(record.traceId(), newSpan); span = prev != null ? prev : newSpan; } append(record, ...
62021204_1
@Override public Map<Class<?>, Set<EventHandler>> findAllHandlers(Object listener) { Map<Class<?>, Set<EventHandler>> methodsInListener = new HashMap<Class<?>, Set<EventHandler>>(); Class clazz = listener.getClass(); Type[] types = clazz.getGenericInterfaces(); for(Type type : types) { if(type i...
62054952_6
public List<com.nilhcem.droidconat.data.app.model.Speaker> toAppSpeakers(@Nullable List<Speaker> from) { if (from == null) { return null; } return stream(from).map(speaker -> new com.nilhcem.droidconat.data.app.model.Speaker( speaker.getId(), speaker.getName(), speaker.getTitle(), ...
62079412_11
public static <T> T checkNotNull(final T reference) { if (reference == null) { throw new NullPointerException(); } return reference; }
62104898_5
@Override public Result search(Query query) { return search(query, 1); }
62117812_546
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append('{'); final AtomicBoolean first = new AtomicBoolean(true); longPairSets.forEach((key, longPairSet) -> { longPairSet.forEach((item1, item2) -> { if (!first.getAndSet(false)) { sb.app...
62138020_46
@Override public void validatePMode (@Nonnull final IPMode aPMode, @Nonnull final ErrorList aErrorList) { ValueEnforcer.isTrue (aErrorList.isEmpty (), () -> "Errors in global PMode validation: " + aErrorList.toString ()); try { MetaAS4Manager.getPModeMgr ().validatePMode (aPMode); } catch (final PModeVal...
62155865_1
@ImmutableExecutorDecorator Task provideTask(final Task task) { return new TaskDecorator(new DummyExecutor(), task); }
62156481_25
@Override public boolean rename(Path src, Path dst) throws IOException { // Copy key material first so the encrypted file always has key material in the key store even if the // put or rename fails KeyMaterial keyMaterial = keyStore.get(src.toString()); keyStore.put(dst.toString(), keyMaterial); boo...
62161266_1
public boolean validateToken(String authToken) { try { Jwts.parser().setSigningKey(key).parseClaimsJws(authToken); return true; } catch (io.jsonwebtoken.security.SecurityException | MalformedJwtException e) { log.info("Invalid JWT signature."); log.trace("Invalid JWT signature tr...
62177795_129
public static cern.c2mon.server.common.metadata.Metadata parseMetadataConfiguration(Properties properties, cern.c2mon.server.common.metadata.Metadata currentMetadata) { return Optional.ofNullable(properties.getProperty("metadata")) .map(Metadata::fromJSON) .map(newMetadata -> parseNewMetadataConfiguration...
62209334_34
public Path extractStopsFile() throws IOException { return extractFile(STOPS_FILE_NAME); }
62244807_3
public long value() { return version; }
62246133_145
@NonNull public TokenRequest addHeader(@NonNull String name, @NonNull String value) { request.addHeader(name, value); return this; }
62250821_122
public UdrSpecificationBuilder addSiblingQueryObject(QueryConditionEnum condition) { if (queryObjectStack.size() <= 1) { throw new RuntimeException( "UdrSpecificationBuilder.addSiblingQueryObject() - Cannot add sibling to Root Query Object. Stack size =" + queryObjectStack.size()); } // first add the pre...
62262439_6
public int getTypeId() { return typeId; }
62282525_18
@Override public void ensureValid(String setting, Object value) { if (value instanceof String) { String s = (String) value; validatePattern(setting, s); } else if (value instanceof List) { List<String> list = (List<String>) value; for (String s : list) { validatePattern(setting, s); } } ...
62303580_13
public static ConfigStrategy get() { return new YamlConfig(); }
62313135_1
@Override public void execute(int characterId, Callback callback) { this.characterId = characterId; this.callback = callback; this.threadExecutor.execute(this); }
62384018_0
public static String getContentType(final File file) { String contentType = URLConnection.guessContentTypeFromName(file.getName()); if (StringUtil.isNotEmpty(contentType)) { return contentType; } if (PROBE_CONTENT_TYPE_METHOD != null && FILE_TO_PATH_METHOD != null) { try { final Object result = PR...
62391407_13
@Override public Object run() { RequestContext ctx = RequestContext.getCurrentContext(); HttpServletRequest request = ctx.getRequest(); log.info(String.format("%s request to %s", request.getMethod(), request.getRequestURL().toString())); return null; }
62422842_38
public Future execute (CompletionCallback <Object> callback) { if (callback == null) throw new IllegalArgumentException ("Callback cannot be null"); TaskManagerImpl taskManager = new TaskManagerImpl ( this.executor_, this.cond_, this.task_, callback); this.execu...
62535317_13
public BigDecimal getGrossAmount() { return this.grossAmount; }
62553999_134
public static boolean equals(@Nullable CharSequence a, @Nullable CharSequence b) { if (a == b) { return true; } int length; if (a != null && b != null && (length = a.length()) == b.length()) { if (a instanceof String && b instanceof String) { return a.equals(b); } el...
62569629_43
public static String cleanupDeviceBrandName(String deviceBrand, String deviceName) { deviceName = replaceString(deviceName, "'", " "); deviceName = replaceString(deviceName, "_", " "); deviceName = DEVICE_CLEANUP_PATTERN_1.matcher(deviceName).replaceAll("-"); deviceName = DEVICE_CLEANUP_PATTERN_2.match...
62607150_1
public static boolean isThoughtWorkEmail(String email) { return THOUGHT_WORKS_EMAIL_PATTERN.matcher(email).matches(); }
62612367_64
public PrinceOfVersionsCancelable checkForUpdates(String url, UpdaterCallback callback) { return checkForUpdates(new PrinceOfVersionsDefaultExecutor(), new NetworkLoader(url), callback); }
62614262_0
public String httpClientGet(String url) { String result = ""; HttpGet httpGet = new HttpGet(url); try { HttpResponse httpResponse = getHttpClient().execute(httpGet); if (httpResponse.getStatusLine().getStatusCode() == 200) { result = EntityUtils.toString(httpResponse.getEntity())...
62635030_0
public void loadRandomData(String url) { setLoad.showProgress(); if (!TextUtils.isEmpty(url)) { if (url != null && url.length() > 0) { loadData.loadRandomData(url, new ILoadListener() { @Override public void loadSuccess(final List<RandomData.ResultsBean> randomData) { ...
62638166_5
public static SourceFile scanSingleFile(File file, List<FlowCheck> flowChecks, List<SquidAstVisitor<Grammar>> metrics) { if (!file.isFile()) { throw new IllegalArgumentException("File '" + file + "' not found."); } AstScanner<Grammar> scanner = create(new FlowConfiguration(Charsets.UTF_8), flowChecks, ...
62640065_41
@Override public String resolveStringJson(String requestJsonOrAnyString, String scenarioStateJson) { String resolvedFromTemplate = resolveKnownTokensAndProperties(requestJsonOrAnyString); String resolvedJson = resolveJsonPaths(resolvedFromTemplate, scenarioStateJson); return resolveFieldTypes(resolvedJson);...
62640701_32
public Long createDependencyWithinArchitecture(final Long architectureId, final Long serviceId, final Long dependsOnServiceId) { final Architecture architecture = architectureRepository.findOne(architectureId); final Service service = serviceRepository.findOne(serviceId); final Service dependsOnService = se...
62695979_5
Object initComponent(String scopeName, Object component) { if (componentMap.get(scopeName) != null && !replaceExisting) { logger.d("Existing component for scope: '" + scopeName + "' present. " + "Returning existing instance"); return componentMap.get(scopeName); } put(scopeNa...
62711375_6
@Override public Promise<Collection<Repository>, Throwable, Void> repositories(final String organization) { return deferredManager.when(() -> { Response<List<Repository>> response = api.repositories(organization).execute(); if (response.isSuccessful()) { return response.body(); } throw new I...
62793144_17
@Override protected Result processFinalizer(AddressSpace addressSpace) { log.info("Processing realm finalizer for {}/{}", addressSpace.getMetadata().getNamespace(), addressSpace.getMetadata().getName()); final String realmName = addressSpace.getAnnotation(AnnotationKeys.REALM_NAME); if (realmName != null) ...
62823867_3
public void match(Handler handler) { matcher.reset(); while (matcher.find()) { handler.handle(matcher.group(1), matcher.group(2)); } }
62839192_13
@Override public Set<SymbolInformation> getFilteredSymbols(String query) { checkNotNull(query, "query must not be null"); Pattern pattern = getQueryPattern(query); return indexer.getFileSymbols().values().stream().flatMap(Collection::stream) .filter(symbol -> pattern.matcher(symbol.getName()).ma...
62872951_20
public static ExchangeLogType toModel(ExchangeLog entity) { ExchangeLogType model = new ExchangeLogType(); LogType logType = entity.getType(); if (logType.equals(LogType.RECEIVE_MOVEMENT)) { ReceiveMovementType type = new ReceiveMovementType(); type.setSource(entity.getSource()); ty...
62914175_43
@Override @SneakyThrows public void execute(TaskContext taskContext) { val testedDonorCount = resolveTotalSsmTestedDonorCount(taskContext); val releaseName = taskContext.getJobContext().getReleaseName(); val fastaFile = resolveFastaFile(); val header = getVCFHeaderRDD(testedDonorCount, releaseName, fastaFile, ...
62945885_1
public Contact getContact(String nodeID) { String requestUrl = storjApiContacts + "/" + nodeID; return getBuilder(requestUrl).get(Contact.class); }
62959750_0
@NonNull public static <T> Observable<T> toObservable(@NonNull final ObservableField<T> field) { return Observable.create(new ObservableOnSubscribe<T>() { @Override public void subscribe(final ObservableEmitter<T> e) throws Exception { T initialValue = field.get(); if (initi...
62970529_3
@VisibleForTesting String readZNodeData(String path) { //TODO: throw exceptions instead of returning null try { Stat stat = curatorClient.checkExists().forPath(path); if(stat == null) return null; // path does not exist String zNodeData = new String(curatorClient.getData().forPath(path)...
63055881_32
public static ModuleSpec simple(final Class<? extends NativeModule> type) { return new ModuleSpec(type, new ConstructorProvider(type, EMPTY_SIGNATURE) { @Override public NativeModule get() { try { return getConstructor(type, EMPTY_SIGNATURE).newInstance(); } catch (Exception e) { t...
63061526_4
@Override public SystemDefaultRoutePlanner proxy() { // implement? return null; }
63085918_54
public boolean isKeyword(final String name) { return this.keywords.contains(name); }
63096822_93
@Override public String ofStreamsInScope(String scopeName) { return ofScope(scopeName); }
63107687_36
@Example({"Set(HashRange(3,7),Add(15L))", "create a set between 3 and 7 elements of Long values"}) public Set(LongToIntFunction sizeFunc, LongFunction<Object> valueFunc) { this.sizeFunc = sizeFunc; this.valueFunc = valueFunc; }
63135578_3
@Override protected SimpleFeatureType buildFeatureType() { ISOSimpleFeatureTypeBuilder featureBuilder = createBuilder(csvFileState); // For WKT strategy, we need to make sure the wktField is recognized as a Geometry AttributeDescriptor descriptor = featureBuilder.get(wktField); if( descriptor != null ){ ...
63163400_0
@Override public List<Long> predict(Item item, Long domainID, Integer numberOfRequestedResults) { boolean dirtyItem = false; List<Long> result = new ArrayList<>(); if (item == null || item.getItemID() == null) { item = new BasicItem(0L, 0L); dirtyItem = true; } if (numberOfRequestedR...
63173414_8
@Override public Observable onLegalMock(final Object mock, final Metadata<RxRetrofit> metadata) { checkReturnMethodTypeIsObservable(metadata); checkTypeMockIsNotObservableNeitherResponse(metadata, mock); NetworkBehavior networkBehavior = networkBehaviour(metadata); return callAdapter.adapt(metadata.getMethod()...
63226307_0
public void analyzeWithHandler(String sentence, EojeolInfoHandler handler) throws IOException { if(sentence == null || sentence.length() == 0){ return; } char[] chars = sentence.toCharArray(); int length = chars.length; analyzeWithHandler(chars, length, handler); }
63251000_28
public Optional<ProcessDefinition> find(ProcessDefinitionSpec spec) { ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery(); add(processDefinitionQuery, ProcessDefinitionQuery::processDefinitionKey, spec.getProcessDefinitionKey()); add(processDefinitionQuery, ProcessDef...
63251719_15
@Override public ExecResult exec(String... command) { MiscApi api = cloudProvider.getMiscApi(); ExecCreateParams execCreateParams = ExecCreateParams.builder().attachStderr(true).attachStdout(true) .cmd(Arrays.asList(command)).build(); Exec exec = api.execCreate(initialNodeMetadata.getId(), execC...
63270256_0
@Override public Void handleRequest(final I input, final Context context) { super.handleRequest(input, context); return null; }
63353944_0
public ErrorHandler skipDefaults() { if (localContext != null) { localContext.get().skipDefaults = true; } return this; }
63372616_304
@Override public boolean test(TypeSupplier<?> typeReference) { Type type = typeReference.get(); if (ParameterizedType.class.isInstance(type)) { ParameterizedType parameterizedType = ParameterizedType.class.cast(type); Type collectionType = parameterizedType.getRawType(); Type elementTyp...
63377572_5
public static SchemaRegistration create( ServiceDiscovery discovery, ServiceDiscoveryOptions options, Record record, SchemaDefinition schemaDefinition, MessageConsumer<JsonObject> serviceConsumer) { return new SchemaRegistration(discovery, options, record, schemaDefinition, serviceConsumer); }
63380093_0
public void index(File sourceCodeDirectory) throws IOException { System.out.println("Indexing source code in " + sourceCodeDirectory.getAbsolutePath() + " into " + getDatabasePath(databaseDirectory)); databaseInitializer.initDatabase(); Collection<File> files = listFiles(sourceCodeDirectory, new String[]{"...
63394793_9
@Override public void onConnectionSuspended(int i) { // Method's body left empty as we deem it's the best behavior. // // http://stackoverflow.com/a/27350444/972721 // onConnectionSuspended() is called for example when a user intentionally disables or // uninstalls Google Play Services. // /...
63414254_4
public boolean getBoolean(String name) { try { return Boolean.valueOf(get(name)); } catch (PropertyMissingException ex) { throw ex; } catch (Exception ex) { throw new PropertyTypeException(name, Boolean.class, ex); } }
63452341_16
CharacterIndices getCharacterIndices(char start, char end, TickerView.ScrollingDirection direction) { int startIndex = getIndexOfChar(start); int endIndex = getIndexOfChar(end); if (startIndex < 0 || endIndex < 0) { return null; } switch (direction) { case DOWN: if (end...
63468727_7
@Slow public Collection<Island> disclaim(@NotNull ChunkPos chunk, boolean createIslands) throws IllegalStateException, IllegalArgumentException, DataSourceException { if(invalid) throw new IllegalStateException(); if(islands.size() == 1 && getChunkCount() == 1) throw new IllegalStateExc...
63481746_1
@NonNull public Observable<Bun> getBunStream() { return mDataModel.getBunStream(); }
63499588_6
public void setOverallHighscorer(final String overallHighscorer) { this.overallHighscorer = overallHighscorer; }
63527700_1
public String formattedTime() { return formatWithPadding(time.hour()) + COLON + formatWithPadding(time.minutes()); }
63534520_26
@XmlElement public Date getCreated() { return created; }
63553502_20
@Nonnull public static String getPathInWorkspace(@Nonnull final String absoluteFilePath, @Nonnull FilePath workspace) { boolean windows = FileUtils.isWindows(workspace); final String workspaceRemote = workspace.getRemote(); String sanitizedAbsoluteFilePath; String sanitizedWorkspaceRemote; if (win...
63583663_2
public static String toJson(Object value) { try { //enum转换为数值 / mapper.configure(SerializationFeature.WRITE_ENUMS_USING_INDEX,true); return mapper.writeValueAsString(value); } catch (Exception e) { e.printStackTrace(); } return null; }
63602831_2
@Override public void cancelOrderRequest(CancelOrderRequest cor) { ocr.sender(cor.target()) .target(cor.sender()) .symbol(cor.symbol()) .clOrdID(cor.clOrdID()) .sendingTime(cor.sendingTime()) .reason("No such order"); out.orderCancelReject(ocr); }
63689332_0
public BPMNProcess convertTreeToModel(final EventTree<Object> tree) { this.tree = tree; final BPMNStartEvent startEvent = new BPMNStartEvent(this.createID(), "Start", null); this.process.addBPMNElement(startEvent); final BPMNEndEvent endEvent = new BPMNEndEvent(this.createID(), "End", null); this.process.addBPMNEl...
63693352_17
@Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { User user = repository.findOne(username); if (user == null) { throw new UsernameNotFoundException(username); } return user; }
63707572_2
public static Set<Instance> getInstances(final Context context) { if (!SystemResolver.get().isReadCalendarPermitted(context)) { return new HashSet<>(); } return readAllInstances(context); }
63749548_5
public Collection<URI> endpoints() { return Collections.unmodifiableCollection(this.endpoints); }
63796401_11
@Override public boolean isPayDate(LocalDate date) { return isDayOfWeek(date, PAYDAY_DAY_OF_WEEK); }
63800550_0
public PartitionAwareJmsSendingMessageHandler build(TopicPartitionRegistrar destinations) { template.setPubSubDomain(true); PartitionAwareJmsSendingMessageHandler handler = new PartitionAwareJmsSendingMessageHandler( this.template, destinations, headerMapper); handler.setApplicationContext(this.applicationC...
63837927_17
public boolean runProcess() { final AgentRunnerBuildParametersModel model = helper.createModel(runnerParametersMap); AmazonS3 s3Client = createClient(model.getPublicKey(), model.getPrivateKey(), model.getBucketRegion(), model.getHttpProxy()); emptyBucketIfNeeded(model.getBucketName(), s3Client, model.isEm...
63881913_4
public String tokenOpen(Map<String, String> paramMap,Map<String, String> customerInfo){ return UnionPayConfig.getInstance().tokenOpen(paramMap,customerInfo); }
63894475_22
void updateDataKeyVariable(DelegateExecution delegateExecution, ResponseEntity<Object> serviceResponse) { Object value = null; if (serviceResponse != null) value = serviceResponse.getBody(); setProcessVariable(delegateExecution, DATA_KEY, value); }
63895649_23
static public boolean containsHyperlink(String s) { return startsWithNetworkProtocol(s) || HYPERLINK.matcher(s).find(); }
63898559_0
public PluginMessageHandlingResult onCommand(Command command) { if (command.getCommand().equalsIgnoreCase("template")) { if (Objects.equals(command.getArgs().get(0), "topic")) { final String template = command.getArgs().subList(1, command.getArgs().size()).stream().collect(Collectors.joining(" "...
63931184_186
@Override public AppendOnlyStreamWriter getAppendOnlyStreamWriter() throws IOException { return impl.getAppendOnlyStreamWriter(); }
63947141_375
@Override public void executeAsync(EndpointCallCallback<EndpointResponse<T>> callback) { new CompletionStageAsyncEndpointCall<>(doExecuteAsync(), executor) .executeAsync(callback); }
63972047_1
public static String getParentMediaID(@NonNull String mediaID) { String[] hierarchy = getHierarchy(mediaID); if (!isBrowseable(mediaID)) { return createMediaID(null, hierarchy); } if (hierarchy.length <= 1) { return MEDIA_ID_ROOT; } String[] parentHierarchy = Arrays.copyOf(hierar...
64025178_6
@Override public boolean addItem(@Nonnull ItemStack stack) { return addItem(stack, null); }
64067562_4
@NonNull Student parseStudent(@NonNull String loginJson, @NonNull String attendanceJson) throws InvalidCredentialsException, InvalidResponseException { Student student = processLogin(loginJson); try { student.subjects.putAll(processAttendance(attendanceJson)); } catch (InvalidResponseExcepti...
64095208_18
ItemDetails get(IInAppBillingService service, String itemType, ArrayList<String> itemIds) throws BillingException { ItemDetails itemDetails = new ItemDetails(); List<ArrayList<String>> splitItemIdList = new ArrayList<>(); // There reason why it splits the item ids per reque...
64177091_38
public @Nullable NotificationCenter getNotificationCenter() { if (isValid()) { return optimizely.notificationCenter; } else { logger.warn("Optimizely is not initialized, could not get the notification listener"); } return null; }
64185596_146
public DalConnection getNewConnection(DalHints hints, boolean useMaster, DalEventEnum operation) throws SQLException { DalConnection connHolder = null; String realDbName = logicDbName; try { if(DalStatusManager.getDatabaseSetStatus(logicDbName).isMarkdown()) throw new DalException(ErrorCode.MarkdownLogicDb, ...
64193956_151
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { if (data != null && data.moveToLast()) { Task task = Task.from(data); mAddTaskView.setDescription(task.getDescription()); mAddTaskView.setTitle(task.getTitle()); } else { // NO-OP, add mode. } }
64203431_21
public List<Listener> listeners(String event) { ConcurrentLinkedQueue<Listener> callbacks = this.callbacks.get(event); return callbacks != null ? new ArrayList<Listener>(callbacks) : new ArrayList<Listener>(0); }
64210266_4
public static Optional<String> extractDirectory(InputStream stream, String frameworkId, String executorId, String containerId) throws IOException { // TODO: prepare corresponding object type instead of using java.util.Map // Search path: {frameworks|complated_fram...
64226557_15
@Override public Config get() { return config; }
64257587_220
@Override public ProjectConfig parseProjectConfig(@Nonnull String json) throws ConfigParseException { try { JSONParser parser = new JSONParser(); JSONObject rootObject = (JSONObject) parser.parse(json); String accountId = (String) rootObject.get("accountId"); String projectId = (Str...