id
stringlengths
7
14
text
stringlengths
1
37.2k
47892183_0
public static <T> Action1<T> act(final Action1<T> action1, final Action1<T> action2) { return new Action1<T>() { @Override public void call(T t) { action1.call(t); action2.call(t); } }; }
47921185_83
@SuppressWarnings("ConstantConditions") public static ExternalResources initialize( @NonNull Context context, Url url) { if (null == context) { throw new IllegalArgumentException("Context must not be null."); } if (null == url) { throw new IllegalArgumentException("Path must not be null."); } sy...
47923936_0
public static <T> String serialize(T object) { return mGson.toJson(object); }
47929285_3
@Override public void save(OutputStream outputStream) throws IOException { final List<String> toEncrypt = new ArrayList<>(); if (keePassFile.getMeta().getMemoryProtection().getProtectTitle()) { toEncrypt.add(org.linguafranca.pwdb.Entry.STANDARD_PROPERTY_NAME_TITLE); } if (keePassFile.getMeta().g...
47973088_1111
@Override public void preExecute(final OperationChain<?> opChain, final Context context) { if (null != opChain) { for (final Operation operation : opChain.getOperations()) { authorise(operation, context.getUser()); } authorise(opChain, context.getUser()); } }
48046454_134
@Nonnull public static <T> AggregateOperation1<T, PriorityQueue<T>, List<T>> bottomN( int n, @Nonnull ComparatorEx<? super T> comparator ) { return topN(n, comparator.reversed()); }
48056143_0
@Override public void populateDAG(DAG dag, Configuration configuration) { redisServer = configuration.get("dt.application.AppWithDCWithoutDe.redisServer"); DefaultOutputPort<DimensionTuple> upstreamOutput = populateUpstreamDAG(dag, configuration); //populateHardCodedDimensionsDAG(dag, configuration, generateO...
48155157_2
public static Logger.Builder tag(String tag) { return new Logger.Builder().tag(tag); }
48174668_2
public void export() throws DocxWriterException { if (!checkDirectory(workingDirectory)) { throw new DocxWriterException("Working directory could not be checked"); } if (!checkFile(exportFile)) { throw new DocxWriterException("Export File could not be checked"); } if (exporter == ...
48183909_30
public static String getElementTitle(CnATreeElement element) { if (element instanceof Safeguard) { Safeguard safeguard = (Safeguard) element; return createTitleForElementWithSecurityLevel(safeguard.getIdentifier(), safeguard.getSecurityLevel(), safeguard.getTitle()); } else if (e...
48203032_52
public static CreateServiceInstanceBindingRequestBuilder builder() { return new CreateServiceInstanceBindingRequestBuilder(); }
48234412_15
public <T> T select(T defaultValue, List<T> options) { return select(defaultValue, options, null); }
48260005_6
@NotNull static String fixLineBreaks(String text) { return text.replaceAll("\r\n", "\n").replace('\r', '\n').replaceAll("\n", "\r\n"); }
48295629_35
public static BinaryInject injectionCarrier(ByteBuffer buffer) { return new BinaryInjectAdapter(buffer); }
48305884_0
public void setRootLocalName(String rootName) { this.rootLocalName = rootName; }
48360594_494
public static char[] replacePatternCharacter(Integer codePointToReplace, Random random) { for (CharPattern charPattern : CharPattern.values()) { if (charPattern.getReplaceChar().charValue() == codePointToReplace) { int length = charPattern.getCodePointSize(); int position = random.ne...
48363025_0
@RequestMapping(value = "/createdEvent", method = RequestMethod.POST) public ResponseEntity<String> publishCreatedEvent(@RequestBody(required = true) UserCreatedEvent userCreatedEvent, HttpServletResponse response) { log.debug("Adding User [{}] '{}'", userCreatedEvent.getId(), userCreatedEvent.getE...
48394219_4
@Override public List<VKontakteProfile> get() { requireAuthorization(); Properties props = new Properties(); props.put("fields", "uid,first_name,last_name,photo,photo_medium,photo_big,contacts,bdate"); URI uri = URIBuilder.fromUri(makeOperationURL("friends.get", props)).build(); VKontakteProfiles ...
48401967_4
public FocusPreserveExtension getFocusPreserveExtension() { return componentGridDecorator.getFocusPreserveExtension(); }
48402328_30
public boolean equalsIgnoreCharacter(TerminalCharacter that) { return style.equals(that.style) && color.equals(that.color); }
48418599_0
public NewCommandSourceHandler getHandler(final String entity, final String action) { Preconditions.checkArgument(StringUtils.isNoneEmpty(entity), "An entity must be given!"); Preconditions.checkArgument(StringUtils.isNoneEmpty(action), "An action must be given!"); final String key = entity + "|" + action;...
48427914_2
public static long parseContentLengthFromContentRange(String contentRange) { if (contentRange == null || contentRange.length() == 0) return -1; final String pattern = "bytes (\\d+)-(\\d+)/\\d+"; try { final Pattern r = Pattern.compile(pattern); final Matcher m = r.matcher(contentRange); ...
48430544_5
@Override public Verticle createVerticle(String verticleName, ClassLoader classLoader) throws Exception { verticleName = VerticleFactory.removePrefix(verticleName); Class clazz; if (verticleName.endsWith(".java")) { CompilingClassLoader compilingLoader = new CompilingClassLoader(classLoader, vertic...
48443654_15
public static String getISO8601StringForTime(long time) { return ISO8601Utils.format(new Date(time), true); }
48446680_4
public static void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults, @NonNull Object... receivers) { // Make a collection of...
48451041_1
@Override public void export(final RDFHandler handler, final Resource... c) throws RepositoryException, RDFHandlerException { exportStatements(null, null, null, true, handler, c); }
48454315_0
@Override public byte[] transform(final ClassLoader loader, final String className, final Class<?> classBeingRedefined, final ProtectionDomain protectionDomain, final byte[] classfileBuffer) throws IllegalClassFormatException { try { if (className != null && className.startsWith("java")) { ...
48461129_4
public int getValue(final int x, final int y){ return this.data[y*this.width + x]; }
48485491_32
@Override public ServiceResponse<T> decode(HttpResponse httpResponse) throws Exception { Map<String, String> headers = getHeaders(httpResponse); collectedHeaders.forEach((k, v) -> Optional.ofNullable(localCollectedHeaders.get(k)).ifPresent(v::addAll)); int statusCode = httpResponse.getStatusLine().getStatus...
48500629_64
public FieldDescriptors generateDocumentation(Type baseType, TypeFactory typeFactory) throws JsonMappingException { JavaType javaBaseType = typeFactory.constructType(baseType); List<JavaType> types = resolveAllTypes(javaBaseType, typeFactory, typeMapping); FieldDescriptors result = new FieldDescript...
48520201_2
public static float angle(float x1, float y1, float x2, float y2) { return (float) Math.toDegrees(Math.atan2(x2 - x1, y2 - y1)); }
48524181_1
public String get(String key) { init(); return json.optString(key); }
48536970_0
public static <T, U> Map<T, U> createMap(SimpleEntry<T, U>... entries) { return Stream.of(entries).collect(toMap(SimpleEntry::getKey, SimpleEntry::getValue)); }
48556027_3
public static String getOautHeaderString(Credentials credentials, String method, String baseUrl, Map<String, String> params) { String nonce = UUID.randomUUID().toString(); int time = Math.round(System.currentTimeMillis()/1000L); return getOautHeaderString(credentials, method, baseUrl, params, nonce, time); ...
48577594_47
public void signalReady(String stackName, String resourceName) { Preconditions.checkArgument(stackName != null && !stackName.isEmpty()); Preconditions.checkArgument(resourceName != null && !resourceName.isEmpty()); SignalResourceRequest req = new SignalResourceRequest(); req.setLogicalResourceId(resourc...
48581176_1
public static Map<EventEnum, Map<String, Integer>> parseEvent(File file){ if(null==file || !file.exists()) return null; System.out.println(file.getName()+"==========================="); LOGGER.debug("开始处理文件:{}", file.getName()); LineProcessor<Map<EventEnum, Map<String, Integer>>> linePorcessor = new ...
48583116_1
public final String getNote() { return mNote; }
48584989_70
public Users get(String id) { Session session = sessionFactory.openSession(); session.beginTransaction(); Users users = (Users) session.get(Users.class, id); session.getTransaction().commit(); session.close(); return users; }
48614879_15
public final int compress(Brotli.Parameter parameter, byte[] in, byte[] out) throws BrotliException { return compress(parameter, in, 0, in.length, out, 0, out.length); }
48641480_0
public String doSomething() { if (restService.executeServerCall()) { return "Hello world"; } else { throw new RuntimeException("Error!"); } }
48675485_89
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { Map<String, String> attachments = invocation.getAttachments(); if (attachments != null) { attachments = new HashMap<String, String>(attachments); attachments.remove(Constants.PATH_KEY); attachments.remo...
48688246_1
static String findLastFileStartLeTimestamp(long targetTimestamp, List<String> binlogFiles, ExtractValidBeginTimestampFunction beginTimestampFunction) { int max = binlogFiles.size() - 1; // 先尝试最后一个文件,最后一个文件的第一个事件时间le目标时间,则返回最后一个文件 if (beginTimestampFunction.extract(binlogFiles.get(max)) <= targetTi...
48699616_1
public static boolean isPrime(int n) { for (int i = 2; i < n; i++) { if (n % i == 0) { return false; } } return true; }
48709314_5
public static boolean startsWith(@NonNull StringBuilder stringBuilder, @NonNull String start) { return stringBuilder.indexOf(start) == 0; }
48773112_13
@Override public void apply(Project project) { this.project = project; OkHttpPlugin okHttpPlugin = project.getPlugins().apply(OkHttpPlugin.class); project.getTasks().withType(Javadoc.class) .configureEach(javadoc -> { OkHttpClient okHttpClient = okHttpPlugin.getOkHttpClient(); ...
48788415_0
public Finnegan() { this( new String[]{ "a", "a", "a", "a", "o", "o", "o", "e", "e", "e", "e", "e", "i", "i", "i", "i", "u", "a", "a", "a", "a", "o", "o", "o", "e", "e", "e", "e", "e", "i", "i", "i", "i", "u", "a", "a", "a", "o", "o", "e", "e",...
48789405_0
@Override public void createTracking(TrackingEntity trackingEntity) { log.debug("createTracking : TrackingEntity: {}", trackingEntity); trackingDao.createTracking(trackingEntity); }
48789600_2
public BootstrapResponse bootstrap(final Identity sender, final BootstrapRequest request) { final String endpoint = request.getEndpointName(); // Start session, checking the BS credentials final BootstrapSession bsSession = this.bsSessionManager.begin(endpoint, sender); if (!bsSession.isAuthorized()) ...
48804926_31
@Override public Agent[] route(Request request) { String requestText = request.getText().toLowerCase(); String[] tokens = tokenizer.tokenize(requestText); if (tokens.length == 0) { return new Agent[0]; } Set<Agent> agents = new HashSet<Agent>(); for (String token : tokens) { if ...
48812966_0
@SuppressWarnings("unchecked") public <RESP> CompletableFuture<RESP> runRequest(Supplier<CompletableFuture<RESP>> processor) { long countId = counter.getAndIncrement(); long time = System.currentTimeMillis(); CompletableFuture<RESP> future = new CompletableFuture<RESP>(); queue.add(new QueuedRequest<RESP>(future, ...
48849114_4
@Nonnull blic static Source getDefault() { final String value = System.getProperty(PROP_DEFAULT_SOURCE, ""); final Source defaultSource = DEFAULT_MAP.get(value); if (defaultSource == null) { throw new IllegalArgumentException(String.format("Invalid value for %s: %s", PROP_DEFAULT_SOURCE, value)); }...
48864005_1
public static <T> Builder<T> builder() { return new Builder<T>(); }
48878116_0
public void updateAllSync(List<Session> sessions) { speakerRelation().deleter().execute(); categoryRelation().deleter().execute(); placeRelation().deleter().execute(); for (Session session : sessions) { insertSpeaker(session.speaker); insertCategory(session.category); insertPlac...
48887503_15
@Override public void validate(String parameterName, Integer value) throws ValidationException { if (!range.contains(value)) { throw new ValidationException( "Expected value in " + range.toString() + " for parameter '" + parameterName + "' but value is " + value); } }
48891106_15
public void process(ScoreChart scorechart, User user, InetAddress source, char direction, InodeHandleInterface file, RemoteSlave sourceSlave) { boolean validPath = _negateExpr != _p.matcher(file.getPath()).matches(); if (validPath) { AssignSlave.addScoresToChart(_assigns, scorechart)...
48911497_1
public static Long extractLongIdFromUniqueId(String uniqueId) { String[] uniqueIdArray = uniqueId.split("_"); Long longId = Long.valueOf(uniqueIdArray[1]); return longId; }
48961876_0
public int getPosition() { return position; }
48992377_0
public static void validate(AuthenticationInfo info) { LOGGER.info("--- Validating authentication information ---"); LOGGER.info("Authentication information provided: {}", info); if (info == null) { String message = "AuthenticationInfo cannot be null."; LOGGER.error(message); throw new AuthenticationInfoValida...
49018474_0
@Override public <T> T getResource(Class<T> resourceClass) { T teamcityServerResource = JAXRSClientFactory.fromClient(client, resourceClass); return teamcityServerResource; }
49018889_0
public Set<Integer> findPeriod(String symbol, String interval) { String key = (symbol + interval).toLowerCase(); if (!periods.containsKey(key)) { Node<String> n1 = periodsTree.getOtherwiseChild(symbol, "*"); if (n1 == null) throw new IllegalArgumentException("No period configuration found for symbo...
49031895_62
public boolean equip(ToolType type) { if (!this.canEquip(type)) { return false; } Map<String, String> attributes; switch (type.displayName()) { case "Axe": createNewResource(); attributes = this.getToolResource(type).getAttributes(); tool = new Axe(get...
49057615_42
@Override public Future<Void> start() { if (dockerPull) { return pullImage().compose(x -> prepareContainer()); } return prepareContainer(); }
49067019_7
public static long getNextOccurrence(long now, DayOfWeek dayOfWeek, int hour, int minute) { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(now); calendar.set(Calendar.HOUR_OF_DAY, hour); calendar.set(Calendar.MINUTE, minute); if (calendar.getTimeInMillis() <= now) { c...
49071798_21
@Override public boolean test(ExplanationOfBenefit eob) { ClaimType claimType = TransformerUtils.getClaimType(eob); if (claimType == ClaimType.CARRIER) { return testCarrierOrDmeClaim(eob); } else if (claimType == ClaimType.DME) { return testCarrierOrDmeClaim(eob); } else if (claimType == ClaimType.HHA) { retu...
49078733_0
@Override public void detachView() { super.detachView(); getBlogPosts.unsubscribe(); }
49115109_23
public void get() throws UnsupportedEncodingException { HttpClient client = new HttpClient(); String APIKEY = "4b441cb500f431adc6cc0cb650b4a5d0"; String INFO =new URLCodec().encode("who are you","utf-8"); String requesturl = "http://www.tuling123.com/openapi/api?key=" + APIKEY + "&info=" + INFO; Ge...
49126308_11
@Override public DatabaseScrolling withScrollSize(final int size) { search.setSize(size); return this; }
49135503_26
int forwards(final int currentPosition){ if (currentPosition == buffer.length-1){ return 0; }else{ return currentPosition + 1; } }
49206166_56
@Override public String[] tokenize(String input) { String[] result = tokenizeWithRegExp(input); if(trimValues) { result = StringUtils.trimAllElements(result); } return result; }
49230474_2
public static void markAsBusy(@NonNull Object object) { markAsBusy(nameOf(object)); }
49235392_12
@Override public void setTitle(String title) { crime.setTitle(title); }
49250409_4
public void setLoading(@Nullable String path) { if (!isLoaded(path)) { loadState = LoadState.LOADING; this.path = path; } }
49317403_22
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); this.view.initSlotsList(scheduleDay.getSlots()); }
49339629_39
@Override public void init() throws Exception { Configuration configuration = getConfiguration(); SocketAddress la = Util. computeLocalEndpoint( configuration.getNetworkInterface(), configuration.getLocalInetAddress(), configuration.getLo...
49354052_361
@Override public String toString() { return StringUtil.simpleClassName(this) + '(' + contentToString() + ')'; }
49359743_2
@Nullable public static <T> T fromCursor(@NonNull Cursor cursor, @NonNull Class<T> entity, int position) { return fromCursor(cursor, entity, position, true); }
49362377_10
public synchronized HandleStatus handleReport(Intent intent) { HandleStatus status = HandleStatus.HANDLED; boolean isOnline = mNetworkManager.isOnline() && canUseNetwork(); try { if (null == intent.getExtras()) return status; int event = intent.getIntExtra(ReportIntent.EXTRA_SDK_EVENT, SdkEv...
49384652_18
@Override public synchronized void saveJobSummary(MasterSlaveJobSummary masterSlaveJobSummary) { MasterSlaveJobData masterSlaveJobData = masterSlaveApiFactory.jobApi().getJob(masterSlaveJobSummary.getGroupName(), masterSlaveJobSummary.getJobName()); MasterSlaveJobData.Data data; if (masterSlaveJobData == nu...
49391150_4
ConfigProvider processMethod(Method method, Object[] objectsMethod) { ConfigProvider prev = loadConfigProviderMethod(method); ConfigProvider configProvider = new ConfigProvider(prev.getProviderKey(), null, prev.getLifeTimeMillis(), prev.requiredDetailedResponse(), prev.isExpirable(), prev.isEncrypted()...
49420416_0
public Fetcher skipNulls() { this.skipNulls = true; return this; }
49429638_0
public static String getSystemLocale() { String language = Locale.getDefault().getLanguage(); return LanguageCodeConverter.convert(language); }
49445030_0
public static int log10(long unsigned) { if (unsigned != 0) { int digits = maxLog10ForLeadingZeros[Long.numberOfLeadingZeros(unsigned)]; return digits + (unsigned >= powersOf10[digits] ? 1 : 0); } else { return 1; } }
49461308_5
@Override public UserFederationSyncResult syncChangedUsers(KeycloakSessionFactory sessionFactory, String realmId, UserFederationProviderModel model, Date lastSync) { throw new UnsupportedOperationException("This federation provider doesn't support syncChangedUsers()"); }
49472222_0
List<String> parseCorsAllowedOrigins(String corsAllowedOriginsStr) { List<String> resultList = new ArrayList<>(); corsAllowedOriginsStr = StringUtils.trimToNull(corsAllowedOriginsStr); String[] originArray = StringUtils.split(corsAllowedOriginsStr, ";"); if(originArray == null || originArray.length == 0){ return ...
49473421_2
}
49493793_5
static void bind(SQLiteStmt stmt, int index, Object value) { if (value == null) { stmt.bindNull(index); } else if (value instanceof Integer || value instanceof Long || value instanceof Short) { stmt.bindLong(index, ((Number) value).longValue()); } else if (value insta...
49517364_2
public void receive(String token) throws JSONException { Log.d(TAG, "Received token for " + platformType.toString() + ": " + token); SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); String cachedId = preferences.getString(sharedPreferencesKey(appKey), null); if (ca...
49529486_102
@Override public void start() { definePaymentMethodsExclusions(); retrievePaymentMethods(); if (showBankDeals && isViewAttached()) { getView().showBankDeals(); } }
49564270_0
@RateLimiter(base = RateLimiter.Base.General, permits = 2, timeUnit = TimeUnit.MINUTES) @PermitAll @GET @Path("/world/{id}") @Produces("application/json") public Response helloworld(@Context HttpHeaders headers) throws Exception { long t = System.currentTimeMillis(); if (t % 2 == 0) { Helloworld hw = new Helloworld...
49574503_10
public static <L, R> Either<L, R> right(R value) { return new Right<>(value); }
49610798_1
public void addAll(List<String> buttonNames) { buttonNames.forEach(name -> super.add(new KeyboardButton(name))); }
49632464_3
@Override public void validate(AbstractJobIdRequest request) throws OwsExceptionReport { JobId jobId = request.getJobId(); if (jobId == null || jobId.getValue() == null || jobId.getValue().isEmpty()) { throw new MissingParameterValueException(JOB_ID); } if (!getEngine().hasJob(jobId)) { ...
49656131_127
public void launchCreateDeckFlow(Activity activity, NewDeckContext newDeckContext) { Intent createIntent = new Intent(activity, GetStartedDeckActivity.class); createIntent.putExtra(AddDeckActivity.INTENT_KEY_DECK, newDeckContext); activity.startActivityForResult(createIntent, Router.REQUEST_CODE_CREATE_DECK...
49670957_523
@Override public Literal evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException { if (args.length < 2 || args.length > 3) { throw new ValueExprEvaluationException("Incorrect number of arguments for SUBSTR: " + args.length); } Value argValue = args[0]; Value startIndexValue = args[...
49671662_1
public static List<WifiNetwork> parse(InputStream in) throws XmlPullParserException, IOException { List<WifiNetwork> wifiNetworks = new ArrayList<>(); try { XmlPullParser parser = Xml.newPullParser(); parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false); parser.set...
49678622_1
public UniversalId getUniversalId() { return UniversalId.createFromAccountAndLocalId(accountId, getLocalId()); }
49730727_2
@SuppressWarnings("PMD.AvoidCatchingGenericException") public void shallIPass(Context context, final GandalfCallback gandalfCallback) { LoggerUtil.logD("Fetching bootstrap"); new BootstrapApi(context, okHttpClient, bootstrapUrl, customDeserializer, callbackExecutor) .fetchBootstrap(new BootstrapCa...
49733838_82
@Scheduled(fixedDelay = 2000, initialDelay = 500) public void checkExecutors() { for (Executor executor : executors) { checkExecutor(executor); } startExecutions(); }
49742019_4
public DatasetModel createDataset(Path path, CallContext context, DatasetModel dsReq, Set<DatasetOption> options) throws IOException{ if(dsReq == null){ throw new IOException("Not enough information to create create a Dataset node or view"); } DcFile dsParent = resolveFile(path.getPa...
49743270_13
public static Predicate<Throwable> markAllExceptions() { return new AnyThrowable(); }