id
stringlengths
7
14
text
stringlengths
1
37.2k
44013219_19
public static PreInitEvent preInit(ProcessEngineConfigurationImpl processEngineConfiguration) { return new PreInitEvent(processEngineConfiguration); }
44013289_4
public static boolean equals(@Nullable Object left, @Nullable Object right) { if (left == right) { return true; } if (left == null || right == null) { return false; } // handle arrays on both sides as special case for efficiency Class<?> leftClass = left.getClass(); Class<?> rightClass = right.getC...
44064037_42
@Override public void execute() { byte registerValue = z80.get8BitRegisterValue(Register.A); int address = z80.get16BitRegisterValue(Register.HL); mmu.writeByte(address, registerValue); z80.setLastInstructionExecutionTime(2); }
44124366_61
@Override public Map<String, FilterExpression> parseTypedExpression(String path, MultivaluedMap<String, String> filterParams) throws ParseException { Map<String, FilterExpression> expressionMap = new HashMap<>(); List<FilterPredicate> filterPredicates = extractPredicates(filterParams); for (FilterP...
44130574_4
public EtcdResponse put(final String key, final String value) throws EtcdException { UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(KEYSPACE); builder.pathSegment(key); MultiValueMap<String, String> payload = new LinkedMultiValueMap<>(1); payload.set("value", value); return execute(builder, Ht...
44133514_1
public static boolean equals(Bundle left, Bundle right) { if (left == right) { return true; } if (left == null || right == null) { return false; } final Set<String> leftSet = left.keySet(); final Set<String> rightSet = right.keySet(); if (leftSet.size() != ...
44167878_7
public static String trimPreffix(String s, String preffix) { if (Strings.isNullOrEmpty(preffix)) return s; return s.startsWith(preffix) ? s.substring(preffix.length()) : s; }
44169642_22
public TimeBatchWindow(long keepTime) { super(keepTime); TimeService timeservice = new TimeService(keepTime, this); setTimeservice(timeservice); }
44190749_14
@RequestMapping(value = TgolKeyStore.EDIT_USER_URL, method = RequestMethod.POST) @Secured(TgolKeyStore.ROLE_ADMIN_KEY) protected String submitEditUserForm( @ModelAttribute(TgolKeyStore.CREATE_USER_COMMAND_KEY) CreateUserCommand createUserCommand, BindingResult result, HttpServletRequest request,...
44196774_1
public void loadPostsFromAPI() { postsAPI.getPostsObservable().retryWhen(new Function<Observable<? extends Throwable>, Observable<?>>() { @Override public Observable<?> apply(Observable<? extends Throwable> errorNotification) { return errorNotification .zipWith(O...
44212362_0
public static <Left, Right> Either<Left, Right> left(@Nonnull Left left) { return (Either<Left, Right>) new Either(checkNotNull(left, "left"), false); }
44250608_23
@Override public void doFilter(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) throws IOException, ServletException { flow.readFrom(request::getHeader); if (isLegacyRequest(request)) { flow.writeTo(response::setHeader); } chain.doFilter(requ...
44253742_143
@Override public AcceptRejectResponse rollback(RollbackMessage message) throws NomadException { return server.rollback(message); }
44253783_1032
private int getValue(String key, AdaptrisMessage msg) { if (!msg.headersContainsKey(key)) { return 0; } return Integer.parseInt(msg.getMetadataValue(key)); }
44263579_1
public InventoryCategory getCategory(String name) { (name == null) { eturn null; turn inventoryRepository.findByName(name); }
44293742_1
String encrypt(String randomStr, String text) throws AesException { ByteGroup byteCollector = new ByteGroup(); byte[] randomStrBytes = randomStr.getBytes(CHARSET); byte[] textBytes = text.getBytes(CHARSET); byte[] networkBytesOrder = getNetworkBytesOrder(textBytes.length); byte[] corpidBytes = corpId.getBytes(CHAR...
44308560_186
static Map<String, String> ensureOrderedMapOfStringsToStrings(final Map<?, ?> map) { final Map<String, String> result = new LinkedHashMap<>(); map.forEach((key, value) -> result.put((String) key, (String) value)); return result; }
44331166_0
public List<String> getQueries() { return Lists.newArrayList(this.getQuery()); }
44336879_2
protected File getWorkaroundLibFile(final Context context, final String library, final String version) { final String libName = libraryLoader.mapLibraryName(library); if (TextUtils.isEmpty(version)) { return new File(getWorkaroundL...
44343498_11
public static Translator buildTranslator() throws ToolkitException { return buildTranslator(null, null); }
44411821_1
@Override public <E extends TaggedLogAPIEntity> ModifyResult<String> create(List<E> entities, EntityDefinition entityDefinition) throws IOException { ModifyResult<String> result = new ModifyResult<>(); try { GenericEntityWriter entityWriter = new GenericEntityWriter(entityDefinition); result.set...
44431868_10
@Deprecated public Observable<AuthToken> getToken(final Context context, final String email, final String scope) { return Observable.create(new Observable.OnSubscribe<AuthToken>() { @Override public void call(Subscriber<? super AuthToken> observer) { try { String token = ...
44431891_7
public int getAutoRefreshInterval() { return Integer.valueOf(mSettingsPref.getString(mResources.getString(R.string.preferences_settings_key_auto_refresh_interval), "3")); }
44437701_4
@SuppressWarnings("unchecked") public static <T extends Singleton> T getInstance(Class<T> clazz) { Singleton singleton; Lock lock; (lock = GLOBAL_LOCK.readLock()).lock(); //1st locking try { singleton = CACHE.get(clazz); //1st reading } finally { lock.unlock(); } if...
44453405_2
public static Vote parse(String[] arguments) { return parse(arguments, null); }
44461272_0
@Override public String toString() { return "UserInfo{" + "userid='" + userid + '\'' + ", username='" + username + '\'' + ", password='" + password + '\'' + ", nickname='" + nickname + '\'' + ", signuptime='" + signuptime + '\'' + '}'; }
44465166_89
@Override public Set<Feature> getWordFeatures(TextAnnotation ta, int wordPosition) throws EdisonException { if (data.size() == 0) loadDataFromClassPath(); String lemma = WordHelpers.getLemma(ta, wordPosition); Set<Feature> features = new LinkedHashSet<>(); if (data.containsKey(lemma)) { ...
44516886_5
public void validate(final Class<?> clazz) throws ControllerValidationException { Assert.requireNonNull(clazz, "Controller class"); if(!isClassAnnotatedWithDolhinController(clazz)){ throw new ControllerValidationException("Dolphin Controller " + clazz.getName() + " must be must be annotated with @Remo...
44519815_18
@Override public void reset() { super.reset(); m_lastValues.clear(); }
44525387_28
public final ModelNode value() { return get(Constants.RESULT); }
44565647_8
;
44586882_134
@Override public @NonNull String mergeTemplateIntoString(final @NonNull String templateReference, final @NonNull Map<String, Object> model) throws IOException, TemplateException { final String trimmedTemplateReference = templateReference.trim(); checkArgument(!isNullOrEmpt...
44603117_13
@PreAuthorize("hasAuthority(#datasourceName+'_MANAGE') or hasAuthority('SYS_MANAGE_DATASOURCE')") public int deleteDataSource(String datasourceName) { checkNotNull(datasourceName); if(isStaticDataSource(datasourceName)) return 0; DBDataSource datasourceCondition = new DBDataSource(); datasourceCondition.setName(da...
44624009_28
@SafeVarargs public final <Result, Progress> Promise<Result, Progress> sequentiallyUntilFirstDone(final Task<Result, Progress>... tasks) { return sequentiallyUntilFirstDone(Arrays.asList(tasks)); }
44646140_1
public static void checkNotNull(@Nullable Object object, @NonNull String message) { if (object == null) { throw new NullPointerException(message); } }
44676582_3
public static <T, R> Method getReferencedMethod(Class<T> clazz, ReadMethodRef<T, R> methodRef) { return findReferencedMethod(clazz, methodRef::call); }
44723874_1
public int getTrafficStatsTag() { return mDefaultTrafficStatsTag; }
44750616_34
public void responseBodyCompleted() { responseBodyCompleted = timeProvider.currentTimeInMillis(); }
44764619_1
public static ExecuteResult runOnMaster(String executable, String... arguments) throws ExecuteException, IOException { return runOnMaster(ExecExceptionHandling.THROW_EXCEPTION_IF_EXIT_CODE_NOT_0, executable, arguments); }
44796698_17
;
44804216_0
static LinkedHashSet<CharSequence> extractUrls(String text) { StringBuilder regex_sb = new StringBuilder(); regex_sb.append("("); // Begin first matching group. regex_sb.append("(?:"); // Begin scheme group. regex_sb.append("dav|"); // The D...
44820217_1
public static <F, T> List<T> transform(List<F> fromList, Function<? super F, ? extends T> function) { return (fromList instanceof RandomAccess) ? new TransformingRandomAccessList<>(fromList, function) : new TransformingSequentialList<>(fromList, function); }
44829848_4
@Override public Response get(RouterNanoHTTPD.UriResource uriResource, Map<String, String> map, NanoHTTPD.IHTTPSession ihttpSession) { return ResponseGenerator.generateMethodNotAllowedResponse(); }
44838366_3
@CheckResult @NonNull public static Single<Palette> generate(@NonNull final Bitmap bitmap) { return Single.fromCallable(new Callable<Palette>() { @Override public Palette call() throws Exception { return Palette.from(bitmap).generate(); } }); }
44839265_2
public String fixWhitespace(String source, String target) { final Matcher source_matcher = regexPatternTokens.matcher(source); final Matcher target_matcher = regexPatternTokens.matcher(target); final int leftCaptureGroup = config.getLeftCaptureGroup(); final int leftIgnoreCaptureGroup = config.getLeftI...
44871316_100
protected static void checkRangeType(String where, Type type, String bus) { checkNotNull(where, "invalid null value: [where]"); checkNotNull(type, "invalid null value: [type]"); checkNotNull(bus, "invalid null value: [bus]"); checkArgument(where.length() >= 1 && where.length() <= 2, "invalid length [1-2...
44872273_23
@SuppressWarnings("WeakerAccess") public SnackbarBuilder appendMessage(CharSequence message) { initialiseAppendMessages(); appendMessages.append(message); return this; }
44934002_1
protected Deallocator deallocator() { return deallocator; }
44944683_0
String getKey() { if (contentInputBean != null) { return contentInputBean.getKey(); } return null; }
44976376_0
Observable<ActivityResult> startActivityForResult( final Action3<Intent, Integer, Bundle> launchActivityAction, final Intent intent, final int requestCode, final Bundle options) { final PublishSubject<ActivityResult> subject = createSubjectIfNotExist(requestCode, /*hasTrigger=*/false); try { ...
44987877_19
@Override public AnalysisResult analyse(final String text, final String name) { List<String> lines = splitToList(text); Map<String, WordUse> map = IntStream.range(0, lines.size()) .parallel() .boxed() .flatMap(i -> lineRecords(lines, i)) .collect(groupingBy(AnalysisRecord::getNor...
45011586_7
public void securityAdvisoriesSeveritySeverityFirstpublishedGet(String severity, LocalDate startDate, LocalDate endDate) throws ApiException { securityAdvisoriesSeveritySeverityFirstpublishedGetWithHttpInfo(severity, startDate, endDate); }
45028592_110
void train(final InstanceList instList, final Pipe myPipe) { final long s1 = System.currentTimeMillis(); // set up model model = new CRF(myPipe, null); model.addStatesForLabelsConnectedAsIn(instList); // get trainer final CRFTrainerByLabelLikelihood crfTrainer = new CRFTrainerByLabelLikelihood( model); // ...
45078096_2
public void setSaveManifestPath(String pPath) { if (isSaveManifestPathEnabled()) { mSaveManifestPath = pPath; } }
45120221_14
@Override public ResultMessage delete(String ID) { try { return account.delete(ID); } catch (RemoteException e) { if (ExceptionHandler.myExceptionHandler(myType, this)) { return delete(ID); } } return ResultMessage.FAIL; }
45165644_119
public String getDetails(Integer id, String... fields) throws Exception { if (fields.length == 0) { return videos.get(id).toString(); } return fieldJsonMapper.toJson(videos.get(id), fields); }
45222397_6
public static <T extends Parcelable> void assertThatObjectParcelable(T object) { if (object == null) { throw new NullPointerException("object == null"); } final Parcel parcel = Parcel.obtain(); try { object.writeToParcel(parcel, 0); parcel.setDataPosition(0); final Par...
45225736_44
public static <K> ScrapConsumerLoader<K> byConveyorName(String name) { return Conveyor.byName(name).scrapConsumer(); }
45239946_67
public List<Record> perform(String query, boolean explain) throws SQLException { QueryProcessor queryProcessor = new QueryProcessor(context); QueryProcessor queryProcessor = new QueryProcessor(context, knowledgeCache, introspectCache); QueryParser queryParser = new QueryParser(context, query); query...
45254631_24
public void entityHasAttributeWithValue(String expectedAttr, String expectedValue) { Attribute actualAttr = getNotNullAttribute(expectedAttr); List<String> attributesList = new ArrayList<>(); for (int i = 0; i < actualAttr.size(); i++) { try { attributesList.add(toString(actualAttr.get(i...
45257264_47
public void installGit(SshConnection connection, SystemSpecification os) throws IOException { if (isGitInstalled(connection)) { return; } if (!SystemSpecification.UBUNTU.equals(os.getDistributionName())) { throw new UnsupportedOperationException( "Only ubuntu is supported for git installation at the moment"...
45304947_10
@Override public String name() { return "VideoUploadedEvent Codec"; }
45334811_21
@Override public void postDelete(T t, PostDeleteContext<T> context) { this.eventPublisher.publishEvent(new PostDeleteEvent<>(t, context)); }
45340108_21
@Override public String newInstance(int uniqueId) { return AddressUtils.longToIpv4(longFactory.newInstance(uniqueId)); }
45357290_0
@Override public void process(final HttpRequest request, final HttpContext context) throws HttpException, IOException { if (!authEnabled) { return; } final long start = System.nanoTime(); final Header authorization = authScheme.authenticate( this.credentials, request, contex...
45384078_1
public static void serialize(final double value, final JsonWriter sw) { sw.writeDouble(value); }
45396840_8
public synchronized boolean updateList(UUID uuid, GroceryList updatedList) { updatedList.setId(uuid); groceryLists.replaceAll(list -> uuid.equals(list.getId()) ? updatedList : list); save(); return groceryLists.contains(updatedList); }
45433519_67
@Override public void onAppRatingSelected(AppRatingSelected event) { final App appToRate = event.getApp(); appUserService.rateApp(appToRate, event.getScore(), new RateAppCallback(appToRate, eventBus)); }
45471150_4
@Override public VisibleMonths create(Date month, int rows) { Calendar calendar = setToFirstDayOf(month); List<Day> lastMonth = calculateLastMonth(calendar); List<Day> currentMonth = calculateCurrentMonth(calendar); List<Day> nextMonth = calculateNextMonth(rows, lastMonth, currentMonth); List<String...
45477569_4
@RequestMapping(value = "account/testLogin", method = {RequestMethod.POST}) public Result<Void> testLogin(ExampleAccount account) throws Exception { return Result.createSuccess(); }
45489191_6
@VisibleForTesting protected static boolean notAllowedStrategy(DockerSlaveTemplate template) { if (isNull(template)) { LOG.debug("Skipping DockerProvisioningStrategy because: template is null"); return true; } final RetentionStrategy retentionStrategy = template.getRetentionStrategy(); ...
45489240_10
@NonNull public static GeoPoint parse(@NonNull String input) throws IllegalArgumentException { Result result = parseWithResult(input); return result.coordinates; }
45502729_34
public static boolean empty( String value ) { return value == null || "".equals(value); }
45506720_9
public static <RESPONSE_T> RESPONSE_T getOne(String url, Class<RESPONSE_T> responseType) throws Exception { String responseStr = HttpUtil.get(url); return JsonUtil.toBean(responseStr, responseType); }
45510398_66
private void mergeConfigsFromClasspath() throws IOException { List<String> dirs = Arrays.asList( "META-INF/flexovm/" + os + "/" + sliceArch, "META-INF/flexovm/" + os); // The algorithm below preserves the order of config data from the // classpath. Last the config from this object i...
45519303_4
public void onClickButtonRecyclerView() { attachedActivity.startActivity(AndroidVersionsActivity.class); }
45526710_11
public static BufferedImage loadEmbeddedBase64Image(String imageDataUri) { try { byte[] buffer = getEmbeddedBase64Image(imageDataUri); if (buffer != null) { return ImageIO.read(new ByteArrayInputStream(buffer)); } } catch (IOException ex) { XRLog.log(Level.WARNING, Lo...
45527579_10
@Override public boolean isApproved(AuthorizationRequest authorizationRequest, Authentication userAuthentication) { //by default, we don't show the consent screen as EB just did this return true; }
45600354_1
public static SimpleBeanPropertyFilter filterOutAllExcept(Class<?> clazz, String... propertyArray) { return new NestedBeanPropertyFilter(clazz, propertyArray); }
45610821_3
public static boolean verify(byte[] password, String argon2Hash) throws IOException { Argon2Hash input = Argon2Hash.parse(argon2Hash); // Convert algorithm name to algorithm ID int algorithmId = Argon2Parameters.ARGON2_i; for (Map.Entry<Integer, String> entry: ALGORITHM_NAME_MAP.entrySet()) { if...
45615254_2
public byte[] getKey(int messageNum) { return keys.get(messageNum % uniqueKeys); }
45634035_17
public void updateFileTransfer(DataTransfer transfer, Interaction.InteractionStatus eventCode) { DataTransfer dataTransfer = (DataTransfer) findConversationElement(transfer.getId()); if (dataTransfer != null) { dataTransfer.setStatus(eventCode); updatedElementSubject.onNext(new Tuple<>(dataTrans...
45639972_1
public <T> T getProperty(@NonNull final String key, final T defaultValue) throws RuntimeException { T value = defaultValue; if (!TextUtils.isEmpty(key) && properties != null) { Object property = properties.get(key); if (property == null) { value = defaultValue; } else { ...
45644056_5
@Override public void drop() { metrics.drop(); super.drop(); }
45681674_2
public static SourceFile scanSingleFile(File file, SquidAstVisitor<SwiftGrammar>... visitors) { if (!file.isFile()) { throw new IllegalArgumentException("File '" + file + "' not found."); } AstScanner<SwiftGrammar> scanner = create(new SwiftConfiguration(), visitors); scanner.scanFile(file); ...
45682878_0
public void deleteNote(int row, int col, int value) { GameCell c = gameBoard.getCell(row,col); c.deleteNote(value); //notifyListeners(); }
45692123_0
public static String parseCharset(String target){ Matcher matcher = charsetPattern.matcher(target); if (matcher.find()){ return matcher.group(1); } return ""; }
45700808_1
private void put(String key, Map<String, Object> map, WritableMap into) { if (map == null || map.isEmpty()) { return; } final WritableMap writableMap = Arguments.createMap(); for (Map.Entry<String, Object> entry: map.entrySet()) { put(entry.getKey(), entry.getValue(), writableMap); ...
45705189_1
public static GeoLocation centralLocation(List<GeoLocation> geoLocations) { Objects.requireNonNull(geoLocations); if (geoLocations.isEmpty()) { return null; } int locationCount = geoLocations.size(); if (locationCount == 1) { return geoLocations.iterator().next(); } double x = 0; double y = 0; double z =...
45721011_231
@Override public List<RemoteInstance> queryRemoteNodes() { List<RemoteInstance> result = new ArrayList<>(); try { List<Instance> instances = namingService.selectInstances(config.getServiceName(), true); if (CollectionUtils.isNotEmpty(instances)) { instances.forEach(instance -> { ...
45732211_6
public static void main(String[] args) throws IOException, UIMAException { String inputDir = args.length > 0 ? args[0] : DEFAULT_SOURCE; CollectionReaderDescription reader = createReaderDescription(TextReader.class, TextReader.PARAM_SOURCE_LOCATION, inputDir, TextReader.PARAM_LA...
45780307_43
@Override public Number[] getMetricSums(StarTreeQuery query) { return doQuery(query).getMetricSums(); }
45805061_3198
@ExternalFunction public static double price(final double spot, final double strike, final double timeToExpiry, final double lognormalVol, final double interestRate, final double costOfCarry, final boolean isCall) { ArgumentChecker.isTrue(spot >= 0.0, "negative/NaN spot; have {}", spot); ArgumentChecker.isTrue(stri...
45824158_11
public RestUri withoutPath() { try { URI parsedUri = new URI(uri); return new RestUri(parsedUri.getScheme() + "://" + parsedUri.getHost() + ((parsedUri.getPort() > -1) ? ":" + parsedUri.getPort() : "") + "/"); } catch (URISyntaxException e) { log.warn("Could not parse uri " + uri, e); ...
45832751_0
public int compare(final JsonNode o1, final JsonNode o2) { final int r = orderValue(o1) - orderValue(o2); if (r != 0) return r; final JsonNodeType type = o1 != null ? o1.getNodeType() : null; if (type == null || type == JsonNodeType.MISSING || type == JsonNodeType.NULL) return 0; if (type == JsonNodeType.BOO...
45860898_137
public static void validateDuration(final String duration) { try { if (StringUtils.hasText(duration)) { convertDurationToLocalTime(duration); } } catch (final DateTimeParseException e) { throw new InvalidMaintenanceScheduleException("Provided duration is not valid", e, e.getE...
45931737_32
@Override public AuthorizationResponse requestAuthorizationCode(final URI authorizationEndpoint, final URI redirectUri) throws AuthorizationException { interceptingBrowser.sendRequest(authorizationEndpoint, redirectUri); return interceptingBrowser.waitForResponse(); }
45932568_14
public VerifyTopicState verifySupportTopic( KafkaZkClient zkClient, String topic, int expPartitions, int expReplication ) { Objects.requireNonNull(zkClient, "zkClient must not be null"); if (topic == null || topic.isEmpty()) { throw new IllegalArgumentException("topic must not be null or empty"...
45953328_0
public void mock() { }
45970905_0
public String getElementContent(String tagName) { // suche erstes Element mit tagName int startIndex = this.result.indexOf(tagName); String content = ""; if (startIndex > -1) { // für jedes nachfolgende Element for (int i = startIndex+1; i < this.result.size(); i++) { //falls in...