id stringlengths 7 14 | text stringlengths 1 37.2k |
|---|---|
49763242_868 | public static Options options(Configuration conf) {
return new Options(conf);
} |
49778000_0 | @Override
public View getView(int position, View convertView, ViewGroup parent)
{
// Get the data item for this position
Budget item = getItem(position);
ViewHolder holder;
// Check if an existing view is being reused, otherwise inflate the view
if (convertView == null)
{
convertView ... |
49798885_186 | @Override
public void setSize(int ysize, int xsize) {
resize(ysize, xsize, false);
} |
49818800_19 | public static CacheResponse createJavaCacheResponse(final Response response) {
final Headers headers = response.headers();
final ResponseBody body = response.body();
if (response.request().isHttps()) {
final Handshake handshake = response.handshake();
return new SecureCacheResponse() {
@Override
... |
49850704_12 | public static <T, S> T copy(S source, T target, String... ignore) {
return copy(source, target, DEFAULT_CONVERT, ignore);
} |
49871069_0 | @VisibleForTesting
static Flowable<Integer> detect(Flowable<Integer> clicks, final long maxIntervalMillis,
final int minComboTimesCared) {
return clicks.timestamp()
.scan((lastOne, thisOne) -> {
if (thisOne.time() - lastOne.time() <= maxIntervalMillis) {
retur... |
49876476_740 | private Map<String, ColumnMetaData> getColumns(final Collection<ColumnMetaData> columnMetaDataList) {
Map<String, ColumnMetaData> result = new LinkedHashMap<>(columnMetaDataList.size(), 1);
for (ColumnMetaData each : columnMetaDataList) {
String lowerColumnName = each.getName().toLowerCase();
co... |
49894985_0 | HashSet<Locale> fetchAvailableLocales(int stringId) {
DisplayMetrics dm = mContext.getResources().getDisplayMetrics();
Configuration conf = mContext.getResources().getConfiguration();
Locale originalLocale = conf.locale;
Locale baseLocale = LocalesUtils.getBaseLocale();
conf.locale = baseLocale;
... |
49896881_40 | @Override
public boolean isServerVersionValid(String versionString) {
try{
Versions.MarkLogicVersion serverVersion = versions.getMLVersion(versionString);
if (!(serverVersion.getMajor() == 9 || serverVersion.getMajor() == 10)) {
return false;
}
if(serverVersion.isNightly(... |
49904163_6 | public City getCityByCrime(City c)
{
this.city = c;
String name = c.getName();
name = name.replace("\'", "\'\'");
queryCityData = "SELECT * FROM Cities WHERE city=\'" + name + "\' AND state=\'" + states.get(c.getState()) + "\';";
queryHousingData = "SELECT id, place_name, place_id, period, index_nsa, index_s... |
49929380_213 | protected synchronized void writeRoundTripToFile(RoundTrip roundTrip) {
logger.info("Writing round trip to result file: " + roundTrip);
String resultString = roundTrip.getResults() + "\n";
try {
Files.write(Paths.get(outputFile), resultString.getBytes(), StandardOpenOption.APPEND, StandardOpenOptio... |
49950879_41 | @Override
public Token nextToken() {
LOGGER.trace("Entering nextToken()");
if (!heap.isEmpty()) {
return heap.poll();
}
while (true) {
getNextToken();
switch (currToken.getType()) {
case PreprocessorParser.AMPIF:
preproIf();
return heap.poll();
case PreprocessorParser... |
49961489_23 | public final double getPriceValue() {
if (priceValue == null) {
priceValue = getPriceValue(priceName);
}
return priceValue;
} |
49979053_5 | public void parse(String query) throws BadRequestResponseException {
this.deviceGuid = null;
this.locationGuid = null;
this.channel = null;
this.startingTimestamp = null;
this.endTimestamp = null;
if (!StringUtils.hasText(query)) {
return;
}
String filters[] = query.split(" ")... |
50041690_6 | public synchronized static String RgbToAnsi(String rgb, ColorSetting colorSetting) {
switch(colorSetting) {
case OFF:
return "";
case ON:
return getClosestTerminalCode(colors.get(rgb), ansiColorsToTerminalCodes);
case EXTENDED:
return getClosestTerminalCod... |
50056934_79 | @Override
public void updateLogSegment(Transaction<Object> txn, LogSegmentMetadata segment) {
byte[] finalisedData = segment.getFinalisedData().getBytes(UTF_8);
Op updateOp = Op.setData(segment.getZkPath(), finalisedData, -1);
txn.addOp(DefaultZKOp.of(updateOp));
} |
50068565_2 | @Override
public double getFrequency(NoteName name) {
return notes.get(name);
} |
50092217_4 | @Transactional(readOnly = false)
public void insert(City city){
cityAnnationDao.insert(city);
} |
50104552_0 | public float getFontSize() {
return fontSize;
} |
50105719_75 | public static int kmp(ByteBuffer buf, byte[] sought) {
if (sought == null || sought.length == 0) {
return -1;
}
if (sought.length == 1) {
int i = buf.position();
while (buf.hasRemaining()) {
if (buf.get(i) == sought[0]) {
return i;
}
... |
50109129_2 | public void setAccountOnFile(AccountOnFile accountOnFile) {
if (accountOnFile == null) {
throw new InvalidParameterException("Error setting accountOnFile, accountOnFile may not be null");
}
this.accountOnFile = accountOnFile;
} |
50118546_8 | @VisibleForTesting
PipelineInterpreter.State reload() {
return reloadAndSave();
} |
50140860_2 | public ObjectMapperModule registerModule(Module module)
{
modulesToAdd.add(module);
return this;
} |
50151956_0 | @RequestMapping("/message")
String getMessage() {
return this.message;
} |
50154902_18 | @Override
public int getItemCount() {
if (getObserverCount() > 0) {
return mItemCount;
}
return getItemCount(super.getItemCount());
} |
50179515_11 | public MasterPrivateKeyBTC getMasterPrivateKey(String seedMnemonicSeparatedBySpaces, String password, String cryptoCurrency, int standard){
if (password == null) {
password = "";
}
List<String> split = ImmutableList.copyOf(Splitter.on(" ").omitEmptyStrings().split(seedMnemonicSeparatedBySpaces));
... |
50185885_14 | @Override public void subscribe(FlowableEmitter<LoginResult> emitter) throws Exception {
mCallback = new FacebookCallback<LoginResult>() {
@Override public void onSuccess(LoginResult result) {
if (!emitter.isCancelled()) {
emitter.onNext(result);
emitter.onComplet... |
50244301_3 | @NotNull
@Override
public Object[] toArray() {
Object[] array = new Object[cardinality()];
int i = 0;
for (Integer bitIndex : this) {
array[i++] = bitIndex;
}
return array;
} |
50276657_1 | @Override
public Response handle(Request request) {
Result result = null;
Call call = request.getCall();
try {
Object resObj = serviceInvoker.invoke(call.getService(), call.getGroup(), call.getMethod(),
call.getTimeout(), call.getParams(), call.getParamTypes());
result = new Resu... |
50300127_2 | public float calculatePrice(List<String> books) {
NormalizeBasket normalizeBasket = new NormalizeBasket();
normalizeBasket.addBooks(books);
float amount = 0.0f;
for (SetCollection collection : normalizeBasket.getCollections()) {
int numBooks = collection.numBooks();
float discount = calculateDiscount(... |
50309640_18 | public boolean register(
final String applicationScheme, final int applicationPort, final int adminPort) {
return register(applicationScheme, applicationPort, adminPort, null);
} |
50326811_11 | @Override
public boolean add(T t) {
if (contains(t)) return false;
backing.add(t);
this.sort();
return true;
} |
50371312_4 | @Override
public Execution executeRecipe(TestRecipe recipe) {
applyRecipeFilters(recipe);
return postRecipe(recipe, false);
} |
50380775_9 | public Activity getActivity() {
return activity;
} |
50406544_3 | public Long hset(final String key, final String field, final byte[] value) {
final byte[] keyByte = SafeEncoder.encode(key);
return new JedisClusterCommand<Long>(connectionHandler, maxRedirections) {
public Long execute(Jedis connection) {
return connection.hset(keyByte, SafeEncoder.encode(f... |
50436236_104 | CopyNumberChange(@NotNull final List<StructuralVariantLegPloidy> structuralVariants) {
assert (!structuralVariants.isEmpty());
final StructuralVariantLegPloidy template = structuralVariants.get(0);
double copyNumberDifference = copyNumberDifference(template);
int upCount = 0;
int downCount = 0;
... |
50446559_84 | public static Statement newInstance(boolean debug, BoltNeo4jConnectionImpl connection, int... rsParams) {
Statement statement = new BoltNeo4jStatement(connection, rsParams);
((Neo4jStatement) statement).setDebug(debug);
return (Statement) Proxy.newProxyInstance(BoltNeo4jStatement.class.getClassLoader(), new Class[] ... |
50459141_8 | @RequestMapping(value="/job/{id}", method=RequestMethod.DELETE)
public @ResponseBody Response deleteJob(@PathVariable("id") Long id)
throws NotFoundException {
JobSpec aJob = getJob(id);
jobDao.deleteJob(aJob.getId());
return SUCCESS;
} |
50502309_1 | @Override
public String transform(String documentKey, String documentType, String jsonDocument) {
String returnMessage = "JSON successfully transformed";
try {
transformJson2Cypher(documentKey, documentType, jsonDocument);
} catch (IOException e) {
returnMessage = "Error during JSON transformation";
LOGGER... |
50552134_4 | public static JarFile toJarFile(URL jarURL) throws IOException {
JarFile jarFile = null;
final String jarAbsolutePath = resolveJarAbsolutePath(jarURL);
if (jarAbsolutePath == null)
return null;
jarFile = new JarFile(jarAbsolutePath);
return jarFile;
} |
50560378_1 | public List<Post> findByKeyword(String keyword) {
return stream().filter(p -> p.getTitle().contains(keyword) || p.getContent().contains(keyword))
.collect(toList());
} |
50571610_0 | public void setHeaderName(String headerName) {
this.headerName = headerName;
} |
50579018_38 | @Override
public Object getValue() {
return value;
} |
50594316_20 | public synchronized void merge(GTSEncoder encoder) throws IOException {
if (this.readonly) {
throw new RuntimeException("Encoder is read-only.");
}
//
// If the current encoder is empty and the base timestamps and wrapping
// keys match, simply reset 'this' with 'encoder'
//
if (0 == this.size() &... |
50600325_6 | @RequestMapping(
method = POST,
produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<WidgetConfigResource> createWidget(
@PathVariable String slug, @RequestBody WidgetConfigResource widgetConfigResource) {
Dashboard dashboard = dashboardServi... |
50632308_5 | public Observable<Professor> getProfessor(final Parameter params) {
Observable<Professor> professorFromClient = mRMPClient.findProfessor(params)
//Since this is first in the chain, don't try an error just yet.
.onErrorResumeNext(Observable.<Professor>empty())
.subscribeOn(Schedul... |
50677285_8 | @Override
public final double value(double x) {
return this.sign * (FastMath.pow(1.0-FastMath.pow(x,2.0),m/2.0) * legendre.value(x));
} |
50679300_6 | @Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
String jwt = resolveToken(httpServletRequest);
if (StringUtils.hasTe... |
50718765_3 | public HttpInvokeResult get(String addr, String uri, long timeoutMillis) {
return get(addr, uri, null, timeoutMillis);
} |
50726401_0 | public static Long rfc3339ToMills(String dateInString) {
Calendar cal = Calendar.getInstance();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss.SSSSSS", Locale.getDefault());
try {
cal.setTime(simpleDateFormat.parse(dateInString
.replace("Z", "")
... |
50726840_5 | public static String sanitize(final String input, final String tag) {
Pattern p = Pattern.compile("<" + tag + ">(.+?)</" + tag + ">", Pattern.DOTALL);
if (BuildConfig.DEBUG) Log.d(TAG, "sanitize(): Using pattern \"" + p.pattern() + "\"");
Matcher m = p.matcher(input);
StringBuffer sb = new StringBuffer(... |
50753889_0 | @Override
public void onBackPressed() {
if (barcodeIsFullscreen)
{
setFullscreen(false);
return;
}
super.onBackPressed();
return;
} |
50834437_9 | public Port getPort() {
return port;
} |
50842364_180 | @Override
public int size(Query<T, SerializablePredicate<T>> query) {
SortOrders so = createSortOrder(query);
FilterConverter<T> converter = getFilterConverter();
Filter filter = converter.convert(query.getFilter().orElse(null));
if (getMaxResults() != null) {
Long count = getService().count(f... |
50850904_183 | public static void register(
final int type,
@NotNull
final SegmentReader reader) {
final SegmentReader previous = readers.putIfAbsent(type, reader);
if (previous != null) {
throw new IllegalArgumentException(
"Duplicate segment readers with type " + type);
}
... |
50876997_0 | public void tokenize(String input) {
input = input.trim();
tokens.clear();
while (!input.isEmpty()) {
boolean match = false;
for (Lexem info : grammar.getLexems()) {
Matcher matcher = info.regex.matcher(input);
if (matcher.find()) {
match = true;
... |
50882844_11 | public double getMeanAngularMotion() {
return MathUtils.TWO_PI / getPeriod();
} |
50887250_48 | @Override
public void purchase(Activity activity, Product product, String developerPayload,
PurchaseListener listener) {
if (activity == null || product == null || listener == null) {
throw new IllegalArgumentException("Activity, product, or listener is null");
}
throwIfUninitialized();
... |
50904245_1917 | @Override
public List<String> readFilesWithRetries(Sleeper sleeper, BackOff backOff)
throws IOException, InterruptedException {
IOException lastException = null;
do {
try {
Collection<Metadata> files = FileSystems.match(filePattern).metadata();
LOG.debug(
"Found file(s) {} by matching... |
50950973_17 | @SuppressWarnings("unchecked")
public ListAttribute<LayoutRegion> getLayoutRegions() {
return (ListAttribute<LayoutRegion>) attributes.get(AttributeKey.LAYOUT_REGION.key());
} |
50951613_2 | public static int map(float value, float fromLow, float fromHigh, int toLow, int toHigh) {
return map(value, fromLow, fromHigh, toLow, toHigh, DEFAULT_MAP_CONSTRAIN);
} |
50961051_0 | public static IndicatorMatcher build() {
return unused -> true;
} |
50999206_4 | @Override
public boolean verify(char[] password, String hashedPassword) {
EncodedPasswordHash encodedPasswordHash = new EncodedPasswordHash(hashedPassword);
byte[] hashToVerify = pbkdf2(
password,
encodedPasswordHash.getSalt(),
encodedPasswordHash.getAlgorithm(),
... |
51015648_148 | public static <T> Mono<T> singleToMono(Single<T> source) {
return new SingleAsMono<>(source);
} |
51016215_1 | @Override
public void marshal(Object graph, Result result) throws XmlMappingException, IOException {
RewardConfirmation rewardConfirmation = (RewardConfirmation) graph;
Assert.hasText(rewardConfirmation.getDiningTransactionId(),
"'diningTransactionId' is missing from reward confirmation");
Document doc;
try {
... |
51074108_36 | public void registerNewState(Long version,
String name, String description,
String hookIdentifier, String taskIdentifier,
Long retryCount, Long timeout,
List<EventDefinition> dependencySet, EventDefinitio... |
51074728_33 | @Override
public List<IViolation> evaluate(
IAgreement agreement, IGuaranteeTerm term, List<IMonitoringMetric> metrics, Date now) {
logger.debug("evaluate(agreement={}, term={}, servicelevel={})",
agreement.getAgreementId(), term.getKpiName(), term.getServiceLevel());
/*
* throws NullPointerException if not ... |
51083005_0 | public OutputPort<String> getOutputPort() {
return this.outputPort;
} |
51113763_8 | @Override
public int deleteAccount(Long id) {
accountMap.remove(id);
return 1;
} |
51161341_58 | @Override
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
WordCap wordCap = (WordCap) o;
if (isCapitalized != wordCap.isCapitalized) {
return false;
}
return word.equals(wordCap.word);
} |
51247796_1 | public Identity getClientIdentity(byte[] serviceTicket){
try {
DerValue APREQ = extractAPREQ(serviceTicket);
Ticket authenticationTicket = extractAuthenticationTicketFromAPREQ(APREQ.toDerInputStream(), APREQ.length());
Identity identity = decryptAuthenticationTicket(authenticationTicket);
return identity;
} c... |
51291746_15 | public <T> T getBeanDefinition(File configFile, Project project, String id, Class<T> type) {
LSParser parser = XMLUtils.createLSParser();
GetSpringBeanFilter filter = new GetSpringBeanFilter(id, type);
parser.setFilter(filter);
List<File> configFiles = new ArrayList<>();
configFiles.add(configFile... |
51293539_6 | void validateParticipants(Participant[] participants) throws InternalLogicException {
Map<String, Participant> participantsById = new HashMap<>();
//participant validation
if (participants == null || participants.length == 0)
throw new InternalLogicException("validateAndMapParticipants failed. parti... |
51307016_350 | public static List<Entry> readAll(final Path path) throws IOException {
Objects.requireNonNull(path);
try (Reader reader = Files.newBufferedReader(path, StandardCharsets.US_ASCII)) {
return readAll(reader);
}
} |
51307359_6 | private static Map<String, String> validate(@NotNull Map<String, String> runnerParams, boolean runtime) {
final Map<String, String> invalids = new HashMap<String, String>();
invalids.putAll(AWSCommonParams.validate(runnerParams, !runtime));
boolean uploadStepEnabled = false;
boolean registerStepEnabled = fals... |
51357073_11 | @Override
public Runner runnerForClass(Class<?> testClass) throws Exception {
for (Class<?> currentTestClass = testClass; currentTestClass != null;
currentTestClass = getEnclosingClassForNonStaticMemberClass(currentTestClass)) {
RunWith annotation = currentTestClass.getAnnotation(RunWith.class);
... |
51379345_108 | public static PreparationResult prepareAndValidate(File patchFile,
File toDir,
UpdaterUI ui) throws IOException, OperationCancelledException {
Patch patch;
ZipFile zipFile = new ZipFile(patchFile);
try {
In... |
51437409_1 | @Override
public TokenizedSource convert() {
LightLexerWorker worker = new LightLexerWorker(this);
return worker.convert();
} |
51441531_1 | public boolean checkSecretAnswer(String answer)
throws InvalidKeySpecException, NoSuchAlgorithmException {
if (answer == null)
return false;
byte[] salt = Base64.decodeBase64(this.secretAnswerSalt);
KeySpec spec = new PBEKeySpec(answer.toCharArray(), salt, 65536, 128);
SecretKeyFactor... |
51447395_22 | public String getUsername() {
return user.getLogin();
} |
51451752_7 | public List<AdapterCommand> diff(@NonNull List<T> newList) {
if (newList == null) {
throw new NullPointerException("newList == null");
}
int newSize = newList.size();
// first time called
if (oldList == null) {
oldList = new ArrayList<>();
oldList.addAll(newList);
List<AdapterCommand> comma... |
51498833_0 | public static void sign(FIXMessage message, String secret) {
StringBuilder presign = new StringBuilder();
appendField(message, SendingTime, "SendingTime(52)", presign);
presign.append(SOH);
presign.append(Logon);
presign.append(SOH);
appendField(message, MsgSeqNum, "MsgSeqNum(34)", presign);
... |
51501760_1 | public long sendNoTone(AnalogPin analogPin) throws IOException {
return extractId(newAwaiter().waitForResponse(
delegate.sendNoTone(analogPin)));
} |
51536707_3 | @Contract("null -> null")
public PresentationStripe transform(final @Nullable DomainStripe domainStripe) {
PresentationStripe ret = null;
if (domainStripe != null) {
ret = new PresentationStripe();
ret.setAlt(domainStripe.getAlt());
ret.setDay(domainStripe.getDay());
ret.setImg(domainStripe.getImg(... |
51575637_10 | public void onErrorCancel() {
getViewState().hideError();
} |
51592804_5 | @Override
public Extension getExtension(final URI uri) {
return new JenaExtension(uri);
} |
51621524_2 | public static String formatWeiAsEther(long wei) {
double ether = (double) wei / 1000000000000000000L;
return String.format(Locale.getDefault(), "%.2f" + "ETH", ether);
} |
51650903_1 | public void getCats(List<Cat> cats) {
checkViewAttached();
mSubscription = mDataManager.getCats(cats)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe(new SingleSubscriber<List<Cat>>() {
@Override
public void... |
51677030_11 | public void onDownloadClicked() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
contextHelper.openDictionariesActivity();
controller.onDownloadClicked();
}else {
contextHelper.startDownload(Constants.WORDNET);
}
} |
51719162_1 | public static <A, B, R> Func1<A, Func1<B, R>> curry(final Func2<A, B, R> func) {
return new Func1<A, Func1<B, R>>() {
@Override
public Func1<B, R> call(final A a) {
return new Func1<B, R>() {
@Override
public R call(final B b) {
return ... |
51724669_1 | @Override
public <T> Optional<Class<T>> compileJavaClass( ClassLoaderContext classLoaderContext,
String qualifiedName,
String code,
PrintStream writer ) {
OsgiaasJavaCompil... |
51744006_40 | public ListenableFuture<String[]> bulkRegister(BulkRegisterRequest bulkRegisterRequest) {
return adapt(request(HttpMethod.POST, UriComponentsBuilder.fromHttpUrl(baseURL).path("v2/op/register").toUriString(), bulkRegisterRequest, String[].class));
} |
51754367_9 | public T getValue() {
return value;
} |
51787752_4 | String getPrefixKey(BackupRestoreContext ctx) throws URISyntaxException {
URI uri = new URI(ctx.getExternalLocation());
String[] segments = uri.getPath().split("/");
int startIndex = uri.getScheme().equals(AmazonS3Client.S3_SERVICE_NAME) ? 1 : 2;
String prefixKey = "";
for (int i=startIndex; i<segm... |
51848128_26 | public boolean matches(String value)
{
return compliedPattern.matcher(value).matches();
} |
51858172_86 | @Override
public T doPost(final String url, final Object data, final Class<T> toMap, final Map<String, String> headers,
final Map<String, String> queryParams, final String accept, final String type,
final int expectedStatus) {
return makeRequest(POST, url, data, toMap, headers, query... |
51861689_5 | public List<String> get() {
return Lists.newArrayList(this.config.clusters().trim().split(","))
.stream()
.filter(cluster -> !cluster.isEmpty())
.collect(Collectors.toList());
} |
51906847_3 | public final void process(HttpServletRequest request, HttpServletResponse response,
Exception exception, String templateLocation) throws Exception {
Exception cause = getRootCause(exception);
if (supports(cause.getClass())) {
processInternal(request, response, cause, templateLo... |
51909350_89 | public HttpHeaders getRequestHeaders() {
HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.setContentType(MediaType.APPLICATION_XML);
requestHeaders.setAccept(Collections.singletonList(MediaType.APPLICATION_XML));
return requestHeaders;
} |
51920891_21 | @Override
public String apply(File f) {
return this.workingDir.toURI().relativize(f.toURI()).toString();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.