id
stringlengths
7
14
text
stringlengths
1
37.2k
94803952_27
@Override public boolean evaluate() throws QueryEvaluationException { try { sync(); return getMarkLogicClient().sendBooleanQuery(getQueryString(), getBindings(), getIncludeInferred(),getBaseURI()); }catch (RepositoryException e) { throw new QueryEvaluationException(e.getMessage(), e); ...
94876336_0
public static String getHelloWorld() { return "Hello from Java!"; }
94876874_1
@NonNull static <T> T checkNotNull(@Nullable final T reference, final String message) { if (reference == null) { throw new IllegalArgumentException(message); } return reference; }
94914141_3
public LiveboardType getLiveboardType() { return mType; }
94987426_0
public static String encode(byte[] input) { byte b; int symbol; int carry = 0; int shift = 3; StringBuilder sb = new StringBuilder(); for (byte value : input) { b = value; symbol = carry | (b >> shift); sb.append(BASE32_CHARS[symbol & 0x1f]); if (shift > 5) { ...
95187094_29
@Override public String toString() { return "HttpStubAuthenticatorConfig [uri: " + uri + ", poolSize: " + poolSize + ", timeoutMillis: " + timeoutMillis + "]"; }
95211078_2
public static boolean isMatchingXsdSchema(byte[] xmlAsBytes, @Nonnull String pathToXsd) { try (ByteArrayInputStream xmlAsStream = new ByteArrayInputStream(xmlAsBytes); InputStream xsdAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(pathToXsd)) { SchemaFactory factory = SchemaFactory....
95222532_3
protected static int run(String[] args) { final IExecutionExceptionHandler exceptionHandler = (ex, commandLine, parseResult) -> { commandLine.getErr().println(commandLine.getColorScheme().errorText(ex.getMessage())); if (getRootLogger().isInfoEnabled()) { commandLine.getErr().println("Ex...
95247186_80
@Override public ResponseEntity<Runtime> getRuntime(String workspaceNamespace) { String firecloudWorkspaceName = lookupWorkspace(workspaceNamespace).getFirecloudName(); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( workspaceNamespace, firecloudWorkspaceName, WorkspaceAccessLevel.WRITER)...
95247959_322
public static <T, B> Builder<T, B> builder(Class<T> itemClass, Class<B> builderClass) { return new Builder<>(itemClass, builderClass); }
95282920_2
@GetMapping("/hello/data/{name}") public Hello sayHi(@PathVariable String name) { Optional<Person> person = personRepository.findByFirstName(name); String message = person.map(person1 -> String.format("Hello %s", person1.getFirstName())) .orElse("...
95342834_0
@NonNull @Override protected final View onCreateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container) { U view = createView(inflater, container); view.setController(getThis()); return view; }
95357887_71
@Override public void completeTask(@NonNull Task completedTask) { checkNotNull(completedTask, "completedTask cannot be null!"); mTasksRepository.completeTask(completedTask); mTasksView.showTaskMarkedComplete(); loadTasks(false, false); }
95374722_0
public void push(byte[] src) { push(src, 0, src.length); }
95380855_2
public static String getFormattedIssueTitle(String volume, int number) { return String.format(Locale.US, "%s #%d", volume, number); }
95448925_5
public SparkVerifier withMaxGroupSize(int maxGroupSize) { this.maxGroupSize = maxGroupSize; return this; }
95459293_16
public static String toString(Object obj) { return (obj == null) ? null : obj.toString(); }
95525322_1
@Override public Object transform(List<RowMetaData> rowMetaDataList) { return groovyShellDataTransformer.transform(rowMetaDataList); }
95534270_328
static File getPlatformRootPath(CliBootstrapEnvironment env) { // make sure APPNG_HOME is set and valid File appngHome = env.getFileFromEnv(APPNG_HOME); return checkFile(APPNG_HOME, appngHome, true); }
95563905_4
static List<Range> join(List<Range> ranges) { RangeOverlapMerger calculator = new RangeOverlapMerger(ranges); return calculator.joinOverlappingRanges(); }
95591183_2
@Override public void stop() { super.stop(); if (!networkActivityDisposable.isDisposed()) { networkActivityDisposable.dispose(); logger.d(TAG, "stop: disposed networkActivityDisposable"); } }
95603001_3
@Override public Observable<Article> get(int id) { if(!cacheStore.isInCache(id)) { if (isNetworkConnection()) { return remoteSource.get(id) .doOnNext(this::saveToLocal) .map(mapper::map) .doOnNext(this::saveInCache); } r...
95646670_0
public String getWikidataId(String language, String title) throws JSONException, IOException { if(title.contains("#")) return null; String url = "https://"+ language+ ".wikipedia.org/w/api.php?action=query&titles="+title+"&ppprop=wikibase_item&prop=pageprops&format=json&redirects"; System.out.println(url); ...
95657746_0
public static String format(final String format, final Object... args) { String retVal = format; for (final Object current : args) { retVal = retVal.replaceFirst("[%][s]", current.toString()); } return retVal; }
95752629_38
public void setHttpProxyHost(String httpProxyHost) { this.httpProxyHost = httpProxyHost; }
95896976_5
@Override public PairwiseRankingLearningModel train(IDataset<?, ?, ?> dataset) throws TrainModelsFailedException { return (PairwiseRankingLearningModel) super.train(dataset); }
95924484_0
@GetMapping(path = "/{id}") public SnippetEntity getSnippet(@PathVariable("id") String id) { return snippetService.getSnippet(id); }
95946882_10
public Total getAccountBalance(Currency toCurrency, long accountId) { WhereFilter filter = selectedAccountOnly(this.filter, accountId); return getBalanceInHomeCurrency(V_BLOTTER_FOR_ACCOUNT_WITH_SPLITS, toCurrency, filter); }
95958400_35
public double getCharge(Date date, double quantity) { double charge; if (date.before(SUMMER_START) || date.after(SUMMER_END)) charge = quantity * winterRate + winterServiceCharge; else charge = quantity * summerRate; return charge; }
95959338_3
public static void render(@NonNull Bitmap in, @NonNull Bitmap out, @NonNull PixelateLayer... layers) { render(in, null, out, layers); }
96021764_6
public static Matcher parse(String cron) throws InvalidCronException { return new CronParser(cron).parse(); }
96048740_17
@Override public void handleMessage(Message message) { super.handleMessage(message); if (listener != null) { listener.onMessageReceived(message); } }
96060769_12
@Override public ObjectInspector getMapValueObjectInspector(){ return valueObjectInspector; }
96066104_1
public static <U> Promise <U> race (Promise <U>... promises) { return race (Arrays.asList (promises)); }
96094840_5
public <T> T toBean(Class<T> clazz) { return toBean(clazz, false); }
96114330_134
public static Builder<RuleBuilder, DecisionTreeRule> creator() { return Builder.instanceOf(RuleBuilder.create(), RuleBuilder.validate(), RuleBuilder::builds); }
96121797_109
@Override public Future<Boolean> bulkInsert( String index, List<Map<String, Object>> dataList, RequestContext context) { long startTime = System.currentTimeMillis(); logger.info( context, "ElasticSearchRestHighImpl:bulkInsert: method started at ==" + startTime + " for Index " ...
96123627_156
@SuppressWarnings("unchecked") public static void validateUpdateContent(Request contentRequestDto) { List<Map<String, Object>> list = (List<Map<String, Object>>) (contentRequestDto.getRequest().get(JsonKey.CONTENTS)); if(CollectionUtils.isNotEmpty(list)) { for (Map<String, Object> map : list) { ...
96242277_10
public List<InternetRadioSource> getInternetRadioSources(InternetRadio radio) { List<InternetRadioSource> sources; if (cachedSources.containsKey(radio.getId())) { LOG.debug("Got cached sources for internet radio {}!", radio.getStreamUrl()); sources = cachedSources.get(radio.getId()); } else ...
96331237_57
@Override public Optional<Transformation> getTransformation(String platformId) { Transformation t = transformations.get(platformId); return Optional.ofNullable(t); }
96367327_165
@Nonnull @Override public ObserverInfo asObserverInfo( @Nonnull final Observer observer ) { return observer.asInfo(); }
96423563_0
@Override public void writeRefactoringsInTextForm(List<RefactoringTextRepresentation> refactorings, Path refactoringsPath) throws IOException { Files.write(refactoringsPath, getRefactoringsInJMoveFormat(refactorings)); }
96455695_1
@EventListener @Transactional public void initialize(ApplicationReadyEvent event) { synchronizeRepositories(); synchronizePackageMetadata(); }
96467418_0
@Override public MultivaluedMap<String, String> update(MultivaluedMap<String, String> incomingHeaders, MultivaluedMap<String, String> clientOutgoingHeaders) { if (LOG.isLoggable(Level.FINER)) { LOG.entering(CLASS_NAME, "update", new Object[]{incomingHeaders, cli...
96480746_9
public String disableDebugging(String sourceCode) throws IOException { int index = sourceCode.indexOf(DEBUG_POSTFIX); if (index == -1) { return sourceCode; } int pos = index + DEBUG_POSTFIX.length(); String data = sourceCode.substring(pos); if (data.startsWith("\n")) { /* in thi...
96503957_5
public static KDTree unmodifiableKDTree(KDTree tree) { UnmodifiableKDTree kdTree = new KDTreeTool.UnmodifiableKDTree(2); kdTree.setKdTree(tree); return kdTree; }
96507559_18
@Override public void update(WxCpUser user) throws WxErrorException { String url = "https://qyapi.weixin.qq.com/cgi-bin/user/update"; this.mainService.post(url, user.toJson()); }
96516195_12
@Override public void searchProducts(SearchProductsRequest request, StreamObserver<SearchProductsResponse> responseObserver) { try { responseObserver.onNext(productDao.searchProducts(request)); responseObserver.onCompleted(); counter.labels("searchProducts", "success"); } catch (Exception e) { log.e...
96517640_0
public void login(String email, String password) { setIsLoading(true); getCompositeDisposable().add(getDataManager() .doServerLoginApiCall(new LoginRequest.ServerLoginRequest(email, password)) .doOnSuccess(response -> getDataManager() .updateUserInfo( ...
96553293_2
@SuppressWarnings("WeakerAccess, unused") public String convertToSwagger(String raml) { return convertToSwagger(raml, null); }
96556232_64
@Override public void close() { // Do not interrupt, it's not our executor scheduledFuture.cancel(false); }
96556656_626
@Override protected void configure() { install(ConfigurationModule.create()); // Inject non-dependency configuration requestInjection(VppConfigAttributes.class); bind(VppStatusListener.class).toInstance(new VppStatusListener()); bind(JVppRegistry.class).toProvider(JVppRegistryProvider.class).in(Si...
96573099_91
public List<List<IdentifierMatcher>> parse() throws ParseException { eatSeparators(); while (!atEnd()) { List<IdentifierMatcher> list = new ArrayList<>(); while (!atEnd()) { if (current() == '/') { list.add(parseRegex()); } else { list.add(...
96577896_6
@Override public DataSetRefs analyze(AnalysisContext context, ProvenanceEventRecord event) { final URI uri = parseUri(event.getTransitUri()); final String clusterName = context.getClusterResolver().fromHostname(uri.getHost()); final DataSetRefs refs = new DataSetRefs(event.getComponentId()); final Ref...
96755147_0
@RequestMapping(value = "/{targetId}", method = RequestMethod.GET) @ApiOperation(value = "按照发信人或收信人的id以及发信状态", notes = "target是指定按照收信人还是发信人查询,可选值是sender和receiver;如果是按照收信人查询,那么必须指定mail_status,可选值为ALL、NOT_VIEWED、VIEWED;如果是按照发信人查询,则不需要给出该参数", response = PageInfo.class) @ApiResponses(value = { @ApiResponse(code = 4...
96760451_0
@Override protected List<NamedPattern> getRegexes(SpanCollection spanCollection, String lang) { return Collections.singletonList(new NamedPattern(URL, URL_PATTERN)); }
96831864_10
@CheckResult public static Denbun get(@NonNull String id) { checkInitialized(); DenbunId denbunId = DenbunId.of(id); if (presetAdjuster.containsKey(denbunId)) { return get(denbunId, presetAdjuster.get(denbunId)); } else { return get(denbunId, Denbun.DEFAULT_FREQUENCY_ADJUSTER); } }
96845301_0
@Override public Object run() { RequestContext context = getCurrentRequestContext(); HttpServletRequest request = context.getRequest(); Long remainingLimit = null; for (RateLimitCheck<HttpServletRequest> rl : filterConfig.getRateLimitChecks()) { ConsumptionProbeHolder probeHolder = rl.rateLimit(request, fa...
96905440_32
@Override public void setAwaitTerminationSeconds(int awaitTerminationSeconds) { delegate.setAwaitTerminationSeconds(awaitTerminationSeconds); }
96914273_3
public static Props props() { return Props.create(Worker.class); }
96925861_0
public LiveData<User> getUser(String email) { MutableLiveData<User> liveData = new MutableLiveData<>(); userDao.loadUser(email) .compose(transformers.applySchedulersToFlowable()) .subscribe(liveData::setValue, Timber::d); userApi.getUser(email) .compose(transformers.app...
96952895_12
@Override public Worker createWorker() { final Worker delegateWorker = delegate.createWorker(); return new Worker() { private final CompositeSubscription subscriptions = new CompositeSubscription(delegateWorker); @Override public Subscription schedule(Action0 action) { if (subscriptions.isUnsubscribe...
96973263_25
public Trie findNode(final FocusString string) { if (terminator) { // Match achieved - and we're at a domain boundary. This is important, because // we don't want to return on partial domain matches. (E.g. if the trie node is bar.com, // and the search string is foo-bar.com, we shouldn't mat...
97025950_3
public static <T extends Comparable<T>> T findMostPopularElement( List<T> list) { Preconditions.checkNotNull(list, "The list cannot be null"); Collections.sort(list); T previous = list.get(0); T popular = list.get(0); int count = 1; int maxCount = 1; for (int i = 1; i < list.size(); i++) { if (list.get(i)...
97029141_10
@Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException { response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized"); }
97034221_41
public static List<String> allTokens(String input, String startDelimiter, String endDelimiter) { final List<String> tokens = new ArrayList<>(); Optional<String> token = firstToken(input, startDelimiter, endDelimiter); while(token.isPresent()) { final String tokenValue = token.get(); tokens.add(tokenValue); in...
97047427_10
@VisibleForTesting List<String> buildMinikubeCommand() { List<String> execString = new ArrayList<>(); execString.add(minikube); execString.add(getCommand()); if (flags != null) { execString.addAll(flags); } execString.addAll(getMoreFlags()); return execString; }
97106222_97
@Override public String toString() { return name; }
97111736_1
@Override public void handleRequest(InputStream input, OutputStream output, Context context) throws IOException { I inputObject = deserializeEventJson(input, getInputType()); O handlerResult = handleRequest(inputObject, context); serializeOutput(output, handlerResult); }
97115482_19
public Queue<Packet> restorePacketForOffLineUser( XMPPResourceConnection conn, MsgRepositoryIfc repo ) throws UserNotFoundException, NotAuthorizedException { Queue<Element> elems = repo.loadMessagesToJID( conn, true ); if ( elems != null ){ LinkedList<Packet> pacs = new LinkedList<Packet...
97231654_23
public Queue<Token> parse(String text) { final Queue<Token> tokens = new ArrayDeque<>(); if (text != null) { text = text.trim(); if (!text.isEmpty()) { boolean matchFound = false; for (InfoWrapper iw : infos) { final Matcher matcher = iw.pattern.matcher(t...
97286202_0
public void addAuthor(Author author) { authors.add(createAuthorRef(author)); }
97291552_29
@Override public void encode( @NotNull WriterContext context ) throws IOException { assert context.getType().getFamily() == Family.BIT_STRING; assert context.getValue().getKind() == Kind.BYTE_ARRAY; ByteArrayValue arrayValue = context.getValue().toByteArrayValue(); boolean hasNamedValues = !context.getType().getNam...
97306203_11
public void mint(List<Token> tokens) throws ExecutionException, InterruptedException { for(Token token:tokens) { if(modumToken == null) { LOG.error("no modum token bean created"); } else { Future<TransactionReceipt> receipt = modumToken.mint(new Address(token.getWalletAddress...
97442158_13
@Bean @ConditionalOnMissingBean public WeChatMpController weChatMpController(final WeChatMpClient weChatMpClient, final ApplicationEventPublisher publisher) { return new WeChatMpController(this.weChatMpProperties, weChatMpClient, publisher); }
97484669_19
@Override public int decode(InputStream is) throws IOException { return decode(is, true); }
97490945_457
@Override @Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME) public GetFileMetadataResult get_file_metadata(GetFileMetadataRequest req) throws TException { return getPrimaryClient().get_file_metadata(req); }
97492141_16
public void addRulesByRuleKey(NewRepository repository, List<String> ruleKeys) { for (String ruleKey : ruleKeys) { addRuleByRuleKey(repository, ruleKey); } }
97518356_346
public static Prel apply(PlannerSettings settings, Prel input){ if(!settings.isTrivialSingularOptimized() || settings.isLeafLimitsEnabled()) { return input; } if(input.accept(new Identifier(), false)){ return input.accept(new AllExchangeRemover(), null); } return input; }
97570753_0
public static ThriftyConverterFactory create(ProtocolType protocolType) { return new ThriftyConverterFactory(protocolType); }
97580115_12
@Nullable public T get() { synchronized (lock) { T item = queue.poll(); if (item != null) { activeCount++; // poll decreases, this fixes LOG.v("GET - Reusing recycled item.", this); return item; } if (isEmpty()) { LOG.v("GET - Returnin...
97598061_24
public boolean isParallelismSelected() { return isParallelSuites() || isParallelClasses() || isParallelMethods(); }
97621321_1155
public SmartRegisterClients applyFilter(final FilterOption villageFilter, final ServiceModeOption serviceModeOption, final FilterOption searchFilter, SortOption sortOption) { SmartRegisterClients results = new SmartRegisterClients(); Iterables.addAll(results, Iterables.filter(this, new Predicate<SmartRegisterCl...
97621363_0
public static int profileImageResourceByGender(String gender) { if (StringUtils.isNotBlank(gender)) { if (gender.equalsIgnoreCase(PathConstants.GENDER.MALE)) { return R.drawable.child_boy_infant; } else if (gender.equalsIgnoreCase(PathConstants.GENDER.FEMALE)) { return R.draw...
97638785_4
public boolean isAtScrollEnd() { RecyclerView.LayoutManager layoutManager = recyclerViewScrollEvent.view().getLayoutManager(); if (layoutManager instanceof LinearLayoutManager) { LinearLayoutManager linearLayoutManager = (LinearLayoutManager) layoutManager; int totalItemCount = line...
97664518_9
CalendarEvent getCalendarEvent() { return mCalendarEvent; }
97805491_0
public String getValue(String key) { return this.map.get(key); }
97935002_3
@Override public Greeting sayHello(Person person) { String firstName = person.getFirstName(); LOGGER.info("firstName={}", firstName); String lasttName = person.getLastName(); LOGGER.info("lastName={}", lasttName); ObjectFactory factory = new ObjectFactory(); Greeting response = factory.createGreeting(); ...
98013453_9
@Override public Map<Object, Object> createDefaultValue() { Map<Object, Object> ret = new HashMap<>(); Object key = keyType.createDefaultValue(); if ( key != null) { ret.put(key, valueType.createDefaultValue()); } return ret; }
98026470_1
public static Event create() { return Event.builder().build(); }
98080471_0
@RequestMapping(method = RequestMethod.PUT) @ResponseBody public GetDatasourceResponse put(@PathVariable("tenant") String tenantId, @PathVariable("datasource") String dataSourceId, @RequestParam(value = "validate", required = false) Boolean validate, @Valid @RequestBody RestDataSourceDefinition ...
98085592_14
public static <O extends Ontology<?, ?>> Set<TermId> parentsOf(TermId termId, O ontology) { Set<TermId> result = new HashSet<>(); visitParentsOf(termId, ontology, new TermVisitor<O>() { @Override public boolean visit(O ontology, TermId termId) { result.add(termId); return true; } }); r...
98171786_53
static Map<String, String> getMetaAttributes(Class<?> clazz) { requireNonNull(clazz, "clazz cannot be null"); return attributesByTypeCache.computeIfAbsent(clazz, c -> getMetaAttributes(getAnnotations(c))); }
98175571_291
public void showTimeFields(final ViewDefinitionState view) { orderService.changeFieldState(view, REASON_NEEDED_WHEN_DELAYED_EFFECTIVE_DATE_FROM, DELAYED_EFFECTIVE_DATE_FROM_TIME); orderService.changeFieldState(view, REASON_NEEDED_WHEN_EARLIER_EFFECTIVE_DATE_FROM, EARLIER_EFFECTIVE_DATE_FROM_TIME); orderServ...
98184950_2
public void save(String source) throws IOException { final String digest = calculate(source); final File file = new File(source + "." + HASH_NAME); if (file.exists()) { if (!file.delete()) { throw new IOException("Unable to delete an existent file: " + file.getPath(...
98204210_5
@GetMapping(value = "/{id}") public Mono<Post> get(@PathVariable(value = "id") Long id) { return this.posts.findById(id); }
98391407_31
public static void requestSMSCode(String phone, AVSMSOption smsOption) throws AVException { requestSMSCodeInBackground(phone, smsOption, true, new RequestMobileCodeCallback() { @Override public void done(AVException e) { if (e != null) { AVExceptionHolder.add(e); } } ...
98396630_0
public boolean isEmpty() { return mSnackbarViews == null || mSnackbarViews.size() == 0; }
98410891_42
public static void shutdown(ExecutorService threadPool, String name) { shutdown(threadPool, name, DEFAULT_WAIT_DOWN_SECONDS); }
98480042_5
public MetaProto.StringListType listDatabases() { MetaProto.NoneType none = MetaProto.NoneType.newBuilder().build(); MetaProto.StringListType stringList; try { stringList = metaBlockingStub.listDatabases(none); } catch (StatusRuntimeException e) { logger.warn("RPC failed: " + e.getSt...