id
stringlengths
7
14
text
stringlengths
1
37.2k
67075821_0
@Override public Response intercept(Chain chain) throws IOException { Request request = chain.request(); Request.Builder requestBuilder = request.newBuilder() .addHeader(AUTHORIZATION_HEADER, "Bearer " + clientToken) .addHeader(USER_AGENT_HEADER, USER_AGENT); request = requestBuilder...
67078673_4
CredentialsAction processArgs(String[] args) { CredentialsAction action = null; if (args.length < 2) { action = new PrintHelpAction(); return action; } String command = args[0]; String credentialsFile = args[1]; switch (command) { case "list": action = new Lis...
67109557_5
public static String[] getBeanNames() { return container.getBeanNames(); }
67114675_1
@ReactMethod /** * @param timeout value of 0 results in no timeout */ public void sendRequest( final ExecutorToken executorToken, String method, String url, final int requestId, ReadableArray headers, ReadableMap data, final String responseType, final boolean useIncrementalUpdates, ...
67148625_59
public static Resource rMapResource2Rdf4jResource(RMapResource rmapResource) { if (rmapResource==null) { return null; } Resource resource = null; if (rmapResource instanceof RMapBlankNode){ RMapBlankNode rb = (RMapBlankNode)rmapResource; BNode blank = rMapBlankNode2Rdf4jBNode(rb); resource = blank; } els...
67165904_19
public void setFooter(@NonNull Group footer) { if (footer == null) throw new NullPointerException("Footer can't be null. Please use removeFooter() instead!"); if (this.footer != null) { this.footer.unregisterGroupDataObserver(this); } int previousFooterItemCount = getFooterItemCount(); ...
67216543_10
@Override public void renderValue(StringBuilder sb, Object extractedValue, MagicFormatter formatter) { formatter.format(sb, extractedValue); }
67262828_7
public String convertMarkdownToHtml(String input) { input = urlMarkdownToHtml(input); input = boldMarkdownToHtml(input); return input; }
67281621_3
Message generateNewMessage() { return Message.builder() .message(getRandomPhrase()) .sender(SENDER) .timestamp(System.currentTimeMillis()) .build(); }
67328052_151
@Override public String generatePoetStringTypes() { StringBuilder symbolBuilder = new StringBuilder(); if (getMethodReturnType().equals(theContract)) { symbolBuilder.append("$L = $T."); } else { symbolBuilder.append("$T $L = $L."); } symbolBuilder .append(method.getName()...
67350976_21
@Override public Object get(String key) { try { return this.memcachedClient.get(key); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new MemcachedOperationException("Failed to get key", e); } catch (TimeoutException | MemcachedException e) { thro...
67392510_0
@ResponseBody public CodeMsg load(Integer id) throws Exception { Assert.notNull(id, CodeMsg.FAIL.msg("主键参数不能为空")); Role data = roleService.load(id); return isTrueNone(data != null, "没有对应的角色").data(data); }
67417531_10
public boolean hasEmptyPath() { return pathSegments.isEmpty(); }
67436705_35
@Override public synchronized boolean initializeConverter() { for (ButtonPressType buttonPressType : ButtonPressType.values()) { EventSpec eventSpec = parseEventSpec(channel.getProperties(), buttonPressType); if (eventSpec != null) { handledEvents.put(buttonPressType, eventSpec); ...
67458870_3
@Override public int getNBits() { return nBits; }
67473511_72
public static Result filter(String path, Collection<NumberedInclude> includes, Collection<String> excludes, boolean allowPartialMatches) { includes = (includes == null ? Collections.<NumberedInclude> emptyList() : includes); excludes = (excludes == null ? Collections.<String> emptyList() : excludes); if (i...
67497179_0
public int add(int a, int b) { return a + b; }
67498438_106
@Override blic double compare(String v1, String v2) { if (v1.equals(v2)) return 1.0; if (v1.length() + v2.length() > 20 && Levenshtein.distance(v1, v2) == 1) return 0.95; String[] t1 = StringUtils.split(v1); String[] t2 = StringUtils.split(v2); // t1 must always be the longest if (t1.length < t...
67579957_45
@Override public int read() { if (!buffer.hasRemaining()) { return -1; } return buffer.get() & 0xFF; }
67585201_231
public static boolean isBackboneStructure(Structure structure) { return structure.getAllAminoAcids().stream() .map(LeafSubstructure::getAllAtoms) .flatMap(Collection::stream) .noneMatch(StructuralEntityFilter.AtomFilter.isBackbone().negate() .and(StructuralEnt...
67639251_2
@Override public Observable<Post.PostBuilder> fetchPostsSinceObservable(Date dSince, int numPosts) { return parsePosts("&since=" + String.valueOf(dSince.getTime() / 1000), numPosts); }
67680403_0
public int add(int op1, int op2) { return op1 + op2; }
67732760_12
@Override public <T> void live(DocumentQuery query, OrientDBLiveCallback<T> callBacks) { Objects.requireNonNull(query, "query is required"); Objects.requireNonNull(callBacks, "callBacks is required"); manager.get().live(query, bindCallbacks(callBacks)); }
67777101_16
public final int getItemPositionInSection(int adapterPosition) { if (adapterPosition < 0 || adapterPosition >= getItemCount()) { throw new IndexOutOfBoundsException("adapterPosition: " + adapterPosition + ", itemCount: " + getItemCount()); } if (sectionManager.isSectionSubheaderAtPosition(adapterPos...
67794596_14
@Override public Object execute() throws Exception { if (credentialStoreService.available() && !force) { System.err.println("Credential store is already configured. To replace the configuration, please use \"--force\" option."); return null; } if (algorithm == null || "".equals(algorithm.tr...
67827813_8
public List<Transformation> getTransformations() { return transformations; }
67836637_101
public static InstrumentedExecutorService newSingleThreadExecutor(MetricRegistry registry, String name) { return new InstrumentedExecutorService(Executors.newSingleThreadExecutor(), registry, name); }
67836913_6
@Override public void onStartup() { InputStream is = com.networknt.config.Config.getInstance().getInputStreamFromFile(CONFIG_NAME); Config config = null; if(is != null) { logger.info("customized hazelcast.xml is loaded from config."); config = new XmlConfigBuilder(is).build(); } else { ...
67904710_57
public @Nullable String getVisibility() { try { return (String) getDomObject().style.get(WXDomPropConstant.WX_VISIBILITY); } catch (Exception e) { return WXDomPropConstant.WX_VISIBILITY_VISIBLE; } }
67934497_5
public DataGetHandler() { try { connection = client.connect(new URI(apidHost), Http2Client.WORKER, Http2Client.SSL, Http2Client.BUFFER_POOL, OptionMap.create(UndertowOptions.ENABLE_HTTP2, true)).get(); } catch (Exception e) { logger.error("Exeption:", e); } }
68019127_31
public boolean isUsedSinceLastCheck() { boolean used = false; long callCount = totalStatistics.getCallCount(); if( callCount > markedCallCount ) { used = true; markedCallCount = callCount; } return used; }
68020885_0
public Future<Void> asyncSendMessages(final List<byte[]> messages, final Map<String, Object> msgProperties) { final MultiThreadedTx localTransaction = this.getMultiThreadedTm().getLocalTransaction(); if (async) { return futureXaResource.executeOnResourceThread(new Callable<Void>() { ...
68029136_222
public boolean hasErrors() { if(!propertyValidationExceptions.isEmpty()){ return true; } for (GenerationUnitGenerationResult result : applicationServerResults) { if(!result.isSuccess()){ return true; } } for (ApplicationGenerationResult result : applicationResults) { if(result.hasErrors()){ return tr...
68036856_6
public Banana findOne(Long id) { if(Objects.isNull(id)) { return null; } return bananas .stream() .filter(b -> id.equals(b.getId())) .findFirst() .orElse(null); }
68042196_5
@ModelAttribute("shoppingCartModel") public ShowShoppingCartModel createShoppingCartModel(@ModelAttribute(ShoppingCart.SHOPPING_CART_KEY) ShoppingCart shoppingCart) { shoppingCart.clear(); return new ShowShoppingCartModel(shoppingCart.getItems(), REQUEST_MAPPING); }
68100331_22
public Iterable<Column> getColumns() { List<Column> values = new ArrayList<>(columns.size()); values.addAll(columns.values()); return values; }
68100913_3
@Override public void loadMore(String date) { mBeforeDailyStoriesUsecase.setDate(date); Subscription subscription = mBeforeDailyStoriesUsecase.execute() .subscribeOn(Schedulers.io()) .onErrorReturn(new Func1<Throwable, DailyStories>() { @Override public Da...
68118219_2
public static GtIdSet buildFromString(String str) { if (StringUtils.isEmpty(str)) { return null; } GtIdSet gtIdSet = new GtIdSet(); String[] gtIdStrs = StringUtils.split(str, StringPool.Symbol.SEMICOLON); for (String gtIdStr : gtIdStrs) { gtIdSet.getGtIdList().add(GtId.buildFromStrin...
68199747_4
@Override public Observable<Task> getTask(@NonNull final String taskId) { checkNotNull(taskId); final Task cachedTask = getTaskWithId(taskId); // Respond immediately with cache if available if (cachedTask != null) { return Observable.just(cachedTask); } // Load from server/persisted i...
68204996_18
@Override public List<TwitterProfile> findAll() { return repository.findAll(); }
68246414_0
public Map<String, Object> toChildMap() { return toChildMap(false); }
68253152_55
public List<Pair<String, List<String>>> getExtraResponseHeaders() { return extraResponseHeaders; }
68273151_109
public static int[] argrank(@Nonnull final int[] a) { return argsort(argsort(a)); }
68289398_0
@Override public int size() { return channels.size(); }
68379040_23
String applyCaseInsensitivity(String name) { return (name != null) ? isCaseSensitiveTableNames() ? name : isCaseInsensitiveStrategyLowerCase() ? name.toLowerCase(Locale.ENGLISH) : name.toUpperCase(Locale.ENGLISH) : null; }
68436985_7
public final boolean hasResult() { return (state.get() & STATE_HAS_RESULT) == STATE_HAS_RESULT; }
68459222_0
public static String getBasicHeader(String name, String password) { String str = Base64.encodeToString((name + ":" + password).getBytes(), Base64.NO_WRAP); return "Basic " + str; }
68501019_16
public Result invoke(final Invocation invocation) throws RpcException { checkWhetherDestroyed(); LoadBalance loadbalance; List<Invoker<T>> invokers = list(invocation); if (invokers != null && invokers.size() > 0) { loadbalance = ExtensionLoader.getExtensionLoader(LoadBalance.class).getExtens...
68539843_51
@Override protected List<String> doGetErrorMessages(WebApplicationException exception) { Response response = exception.getResponse(); if (StringUtils.isBlank(exception.getMessage())) { return Collections.singletonList(Responses.getErrorMessage(response)); } else { return Collections.singleto...
68581045_39
@Override public void addOrUpdate(String name) { Keyword k = (Keyword)this.queryObject("from Keyword where name=?", name); if(k==null) { k = new Keyword(); k.setName(name); k.setNameFullPy(PinyinUtil.str2Pinyin(name, null)); k.setNameShortPy(PinyinUtil.strFirst2Pinyin(name)); k.setTimes(1); this.add(k); ...
68586699_28
void performMatching(String dataContent, String correspontingHeadline){ if(isExactMatch(dataContent, correspontingHeadline)) { this.dataCellEvaluationStatus = DataCellEvaluationStatus.EXACT_MATCH; return; } if(isContainsMatch(dataContent, correspontingHeadline)){ this.dataCellEvaluat...
68590674_0
public static DateTime checkTime(LocalTime time) { return DateTimeUtils.checkTimeToNextDay(time); }
68602823_4
public Speaker fromAppSpeaker(@Nullable com.nilhcem.mobilization.data.app.model.Speaker from) { if (from == null) { return null; } return new Speaker(from.getId(), from.getName(), from.getTitle(), from.getBio(), from.getWebsite(), from.getTwitter(), from.getGithub(), from.getPhoto()); }
68614547_10
public synchronized void remove(Disposable disposable) { if (mDisposables2Stop == null && mDisposables2Destroy == null) { throw new IllegalStateException("remove should not be called after onDestroy"); } if (mDisposables2Stop != null) { mDisposables2Stop.remove(disposable); } if (mDi...
68626098_3
@Override public void onSkipQuestion() { // -1 denotes a skipped question that doesn't make it into the final score object // This behavior is configurable in settings recordScore(current, -1); current = getNextCountry(); view.showQuestion(current.asCountry()); }
68632639_4
@Override public CreateServiceInstanceBindingResponse createServiceInstanceBinding(CreateServiceInstanceBindingRequest request) { ServiceInstance instance = instanceService.getServiceInstance(request.getServiceInstanceId()); if (getBinding(request.getBindingId()) != null) { throw new ServiceInstanceBi...
68643971_5
@Override public List<User> getAllWhere(String... conditions) { List<User> persons = new ArrayList<>(); try (Connection con = DbConnector.getConnection(); Statement stm = con.createStatement() ) { String condition = String.join(" and ", conditions); ResultSet rs = stm.executeQuery(...
68648922_1
@VisibleForTesting void refresh() { mSubscription = mRepository .getReddits(mCategory) .subscribeOn(Schedulers.io()) .observeOn(mMainThreadScheduler) .doOnSubscribe(() -> errorText.set(null)) .doOnSubscribe(() -> isLoading.set(true)) .doOnTermi...
68664213_1
public BooleanProperty allSelectedProperty() { return allSelected; }
68676827_488
public PersonAttribute getAttribute(PersonAttributeType pat) { if (pat != null) { for (PersonAttribute attribute : getAttributes()) { if (pat.equals(attribute.getAttributeType()) && !attribute.isVoided()) { return attribute; } } } return null; }
68736330_0
public static File createTempFileInTempFolder(String fileName){ String name = new File(fileName).getName(); int indexOfDot = name.lastIndexOf("."); String prefix, suffix; if(indexOfDot != -1){ prefix = name.substring(0, indexOfDot); suffix = name.substring(indexOfDot); }else{ prefix = name; suffix = ""; ...
68739393_0
public OrderAggregate createOrder(CreateOrderRequest orderRequest) { EntityWithIdAndVersion<OrderAggregate> createdAggregate = Util.get(aggregateRepository.save(new CreateOrderCommand(orderRequest.getOrderStatus()))); // Save using JPA too OrderAggregate orderAggregate = createdAggregate.getAg...
68813569_2
public static void main(String[] arguments) throws Exception { DatagramCrusherMain main = new DatagramCrusherMain(); main.run(arguments); }
68883930_2
static BeanShade2 calculateDimentions(FrameModel frameModel, float width1, float height1, float width2, float height2){ WIDTH_1 = 0; WIDTH_2 = 0; HEIGHT_1 = 0; HEIGHT_2 = 0; BeanShade2 beanShade2 = new BeanShade2(); //width1 amount to required width float amountW1 = width1 / frameModel.getMaxContainerWi...
68901259_2
public static int computeMinEditDistance(String src, String dest, boolean shouldPrintMorphing) { char[] str1 = src.toCharArray(); char[] str2 = dest.toCharArray(); int editArr[][] = new int[str1.length + 1][str2.length + 1]; for (int i = 0; i < editArr[0].length; i++) { editArr[0][i] = i; }...
68967154_1206
public static void getSemanticPropsDualFromString(DualInputSemanticProperties result, String[] forwardedFirst, String[] forwardedSecond, String[] nonForwardedFirst, String[] nonForwardedSecond, String[] readFieldsFirst, String[] readFieldsSecond, TypeInformation<?> inType1, TypeInformation<?> inType2, TypeInfor...
68967191_6624
@Override public Path resolveSibling(Path other) { throw new UnsupportedOperationException(); }
69026532_22
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; User other = (User) obj; if (id != other.id) return false; return true; }
69044045_2
@Override public String compute(String url, WebContext context) { if (context instanceof JaxRsContext && url != null) { return ((JaxRsContext) context).getAbsolutePath(url, true); } return url; }
69047858_9
@Override public void restoreStateAndShowRepos(ReposByUsernameUI uiModel) { if (isViewAttached()) { if (uiModel != null) { this.uiModel = uiModel; view.showRepos(uiModel, false /*not going to top*/); } } }
69207015_4
public static FunctionDetails parseFunctionString(String paramString) throws IllegalArgumentException { // trim any whitespace String trimmedLine = paramString.trim(); // trimmed line is the data for the functions FunctionDetails functionDetails = new FunctionDetails(trimmedLine); try { // do we have ...
69237460_0
public static Selfie getInstance() { synchronized (Selfie.class) { if (singleton == null) { throw new IllegalStateException("Selfie not initialized."); } return singleton; } }
69239703_0
@Override public Observable<Boolean> login(LoginDataParams params) { if(params == null || isEmpty(params.getPhoneNumber()) || isEmpty(params.getPinNumber())) { return Observable.error(new VoteException(MessageType.EMPTY_CREDENTIALS)); } ApiDataSource apiDataSource = mDataSourceFactory.dataSource(pa...
69255078_4
@Override public Observable<Void> open(SfsVertx vertx) { final VolumeV1 _this = this; return Defer.aVoid() .doOnNext(aVoid -> Preconditions.checkState(volumeState.compareAndSet(Status.STOPPED, Status.STARTING))) .doOnNext(aVoid -> logger.info("Starting volume " + basePath.toString())) ...
69273058_41
@Override public boolean evaluate(Doc doc) { return conditions.stream().anyMatch(condition -> condition.evaluate(doc)); }
69277020_0
@JsonProperty("oAuthScopes") public List<String> getOAuthScopes() { return oAuthScopes; }
69284281_234
public static CommentDto convert(final Comment comment) { return convert(comment, comment.getParentMessage() != null ? MessageConverter.convert(comment.getParentMessage()) : null); }
69289646_19
@Override public void smoothScrollToPositionFromTop(int position, int i) { mRecyclerView.getLinearLayoutManager().scrollToPositionWithOffset(position, i); }
69335089_45
@Override public ExpressionMember ge(ExpressionMember expressionMember) throws ODataApplicationException { return expressionMember.le(this); }
69363264_27
Flow(String name, UseCase useCase) { super(name, useCase.getModel()); this.useCase = useCase; }
69365079_0
@Override public void initialize( AuthProviderOperations authProviderOperations ) { api = authProviderOperations; api.log().info( "initialized!" ); loadConfig(); }
69381318_1
@SuppressWarnings("unchecked") @Override public T deserialize(String topic, byte[] data) { LOGGER.debug("data to deserialize='{}'", DatatypeConverter.printHexBinary(data)); try { // get the schema Schema schema = targetType.newInstance().getSchema(); Injection<GenericRecord, byte[]> genericRecordInject...
69400326_689
@VisibleForTesting void startKsql(final KsqlConfig ksqlConfigWithPort) { waitForPreconditions(); initialize(ksqlConfigWithPort); }
69403823_0
public void show() { if (mIntent == null || mIntent.getAction() == null) { Log.e(TAG, "Cannot show the share screen - intent is missing or has no action."); return; } Intent materialShareIntent = new Intent(mContext, mActivityClass); materialShareIntent.putExtra(MaterialActivityChooserAc...
69468148_3
@Override public void run(HookEvaluateCommands jct) { try { HypervolumeCalculator hv = new HypervolumeCalculator(); File dir = new File(jct.directory); for (File file : dir.listFiles((directory, name) -> name.startsWith("FUN_"))) { hv.addParetoFront(file.getPath()); } ...
69469299_29
@Override public void send(OperationClientMessage message) { WebSocket socket = webSocket.get(); if (socket == null) { callback.onFailure(new IllegalStateException("Send attempted on closed connection")); return; } socket.send(message.toJsonString()); }
69571507_52
static void writeJson(Span span, Buffer buffer) throws IOException { JsonWriter writer = JsonWriter.of(buffer); writer.beginObject(); writer.name("trace_id"); writer.value(new Buffer() .writeByte('"') .writeByte('1') // version .writeByte('-') .writeUtf8(span.traceId(), 0, 8) // 32-bit e...
69595482_13
@Override public Collection<LinkedAccount> listLinkedAccounts(String userId) throws StorageException { logger.debug("Getting a list of all Linked Accounts for {}.", userId); try { return this.jdbi.withHandle( handle -> { String statement = sqlStatements.selectLinkedAccounts(); re...
69602447_2
private WekaScoringModel setModel( String modelFileName ) throws KettleException { // Load the model WekaScoringModel model = null; try { model = WekaScoringData.loadSerializedModel( modelFileName, getLogChannel(), this ); m_data.setModel( model ); if ( m_meta.getFileNameFromField() ) { m_last...
69664789_0
public String next() { StringBuilder sb = new StringBuilder(); Iterator<Map.Entry<Integer, FieldType>> keyFieldsIterator = keyFields.entrySet().iterator(); Iterator<Map.Entry<Integer, FieldType>> fieldsIterator = fields.entrySet().iterator(); while (keyFieldsIterator.hasNext()) { Map.Entry<Inte...
69671133_1
public void tokenize(String source, String sourceFile, PrintWriter out) { Writer debugWriter = null; try { Lexer lexer = (Lexer) language.lexerConstructor .newInstance(new ANTLRInputStream(source)); final CommonTokenStream tokens = new CommonTokenStream(lexer); tokens.fill(); if (log.isDebugEnabled()) { ...
69678968_0
public static String codeGT(Set<String> to, String from, SortedSet<String> altSet) { IntArrayList codedAlleles = new IntArrayList(); String result = ""; for (String allele : to) { if (from.equals(allele)) { codedAlleles.add(0); } int altIndex = 1; for (String alt...
69732850_2
public static ConfigProperties fromClasspathFile(String filename) { try (InputStream stream = ConfigProperties.class.getClassLoader().getResourceAsStream(filename)) { if (stream == null) { throw new IllegalArgumentException("Could not load classpath file [" + filename + "]"); } P...
69755813_0
@Override public Observable<OfferResponse> loadOffers(int page, String format, int applicationId, String userId, String locale, ...
69791298_0
public List<String> getPredictions(String query) { if (query.length() > 0) { int amountOfResults = 8; return generatePredictions(amountOfResults, query); } return new ArrayList<>(); }
69807495_8
public Single<Cart> addProduct(CartProduct cartProduct) { return cartDataSource.addProduct(cartProduct) .compose(cartPublisher()); }
69926042_13
public boolean hasSubContainers() { return (mContentContainers.size() != 0); }
70037033_23
public static String getWordPart(String wordAndAux) { int idx = getSeparatorIndex(wordAndAux); return idx == 0 ? " " : wordAndAux.substring(0, idx); }
70037034_10
public String[] leftMostDerivation(String... words) { ArrayList<String> expansion = new ArrayList<String>(words.length); assert words.length > 0 && startSymbol.equals(words[0]); for (String word : words) { expansion.addAll(getTerminals(word)); } return expansion.toArray(new String[expansion.size()]); }
70038531_27
@Override public void validate(AlertTemplate template) throws ValidationException { if (template.getDestination() == null || template.getDestination().trim().isEmpty()) { throw new ValidationException("Alert target can't be empty"); } if (template.getDestination().length() > MAX_LENGTH_ALERT_DESTINATION) { throw...