id stringlengths 7 14 | text stringlengths 1 37.2k |
|---|---|
36096924_12 | public static boolean isSSL(String urlString) {
Preconditions.checkArgument(StringUtils.isNotEmpty(urlString));
return urlString.startsWith("https://");
} |
36107965_0 | @Override
public boolean check(String clearText, String cryptedText)
{
return cryptedText.equals(digest(clearText));
} |
36122396_6 | void doHandshake() throws IOException
{
checkEngine();
_engine.beginHandshake();
performHandshake();
} |
36161058_0 | private static android.widget.Toast createOrUpdateToastFromToastBean(android.widget.Toast toast, @NonNull ToastBean bean) {
int duration;
if (bean.mDuration == android.widget.Toast.LENGTH_SHORT) {
duration = android.widget.Toast.LENGTH_SHORT;
} else {
duration = android.widget.Toast.LENGTH_L... |
36174393_1 | public static MvcGraph graph() {
if (graph == null) {
graph = new MvcGraph();
try {
graph.getRootComponent().register(new Object() {
@Provides
@EventBusC
public EventBus eventBusC() {
return new EventBusImpl();
... |
36211133_1357 | public static double logGamma(double x) {
double ret;
if (Double.isNaN(x) || (x <= 0.0)) {
ret = Double.NaN;
} else if (x < 0.5) {
return logGamma1p(x) - FastMath.log(x);
} else if (x <= 2.5) {
return logGamma1p((x - 0.5) - 0.5);
} else if (x <= 8.0) {
final int n = ... |
36250547_9 | @Override
public boolean equals(final Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TrailStatisticsImpl other = (TrailStatisticsImpl) obj;
return Objects.equals(this.time, other.getTimeDifferenceSummary())
&& Objects.equals(this.dist... |
36268631_0 | @RequestMapping("/{payloadType}/count")
public ReceiveCount findReceiveCount(@PathVariable("payloadType") PayloadType payloadType) {
return receiveCountService.findReceiveCount(payloadType);
} |
36283221_43 | @Override
public PrefixFunction getInstance(String pattern) {
final int[] prefixes = new int[pattern.length()];
prefixes[0] = 0;
int length = 0;
for (int i = 1; i < pattern.length(); i++) {
final char character = pattern.charAt(i);
while (length > 0 && character != pattern.charAt(length)... |
36284770_2 | @Override
public Long getObjectId(String identifier) {
DigitalObject object = digitalObjectDao.getDigitalObject(identifier);
if (object != null) {
return object.getId();
}
return null;
} |
36288389_95 | @Override
public Map<String, Object> getParameters(final EducationType entity, final Map<String, Object> parameters) {
addParameter(entity.getName(), "name", parameters);
addParameter(entity.getAbbrName(), "abbrName", parameters);
return parameters;
} |
36297446_3 | @Override
public <T> T getBean(Class<T> beanType) {
return getBean(beanType, null);
} |
36303657_32 | @Override
public List<InventoryVector> getMissing(List<InventoryVector> offer, long... streams) {
for (long stream : streams) {
offer.removeAll(getCache(stream).keySet());
}
return offer;
} |
36345024_7 | ; |
36352008_10 | public static @SwtThread <T> RxBox<Optional<T>> singleSelection(StructuredViewer viewer) {
RxBox<Optional<T>> box = RxBox.of(Optional.empty());
singleSelection(viewer, box);
return box;
} |
36370530_3 | @Override
public boolean shouldInclude(PropertySource<?> source, String name) {
if (isIncludeAll()) {
return true;
}
if (isMatch(source.getName(), excludeSourceNames) || isMatch(name, excludePropertyNames)) {
return false;
}
return isIncludeUnset() || isMatch(source.getName(), incl... |
36371585_4 | Collection<String> getPermissions() {
return permissions;
} |
36378766_2 | String getConnection() {
return connectionName;
} |
36404681_0 | protected GraphDatabaseFactory createGraphDatabaseFactory(Map<String, String> config) {
if (config != null && config.containsKey("ha.server_id")) return new HighlyAvailableGraphDatabaseFactory();
return new GraphDatabaseFactory();
} |
36419249_0 | @SuppressWarnings("unchecked")
protected void releaseData(final D data) {
if (async instanceof Releaser) {
((Releaser<D>) async).release(data);
}
} |
36429443_19 | public static Optional<String> getAccessTokenFromSecurityContext() {
SecurityContext securityContext = SecurityContextHolder.getContext();
Authentication authentication = securityContext.getAuthentication();
if (authentication instanceof OAuth2Authentication) {
Object userDetails = ((OAuth2Authenti... |
36456716_250 | public void step(Program program) {
if (CONFIG.vmTrace()) {
program.saveOpTrace();
}
try {
OpCode op = OpCode.code(program.getCurrentOp());
if (op == null) {
throw Program.Exception.invalidOpCode(program.getCurrentOp());
}
program.setLastOp(op.val());
... |
36461471_5 | boolean edgePropagatesSignal(Edge edge) throws KeySelectorException {
// returns true if the given node has a signal that should be passed along the given edge
// assuming single-step weight-threshold-gate drain
// check if src node has enough potential to traverse edge
try {
int edgeMagnitude =... |
36476378_1 | public static Set<Path> listFiles(FileSystem hdfs, Path path, boolean recurse, boolean filterMetaData)
throws IOException {
Set<Path> files = new HashSet<>();
try {
RemoteIterator<LocatedFileStatus> filesIterator = hdfs.listFiles(path, recurse);
while (filesIterator.hasNext()) {
Path file = filesIte... |
36483902_22 | public DateRange rounded(long interval) {
if (interval <= 0) {
return this;
}
return new DateRange(start - start % interval, end - (end % interval));
} |
36487440_42 | @Override
public String name() {
return AUTHENTICATION_HANDLER_NAME;
} |
36490910_0 | public void setWeight(float weight) {
if (weight < 0 )
throw new IllegalArgumentException("weight value should be positive");
this.weight = weight;
} |
36518071_10 | @Override
@Transactional(rollbackFor = Throwable.class)
public User createUser(User userTemplate) throws FieldValidationException {
Preconditions.checkArgument(userTemplate != null, "userTemplate is required");
validateUser(userTemplate);
User userToCreate = new User();
userToCreate.setDisplayName(userTemplate.ge... |
36524737_0 | static <T, A extends BindingCollectionAdapter<T>> WeakReference<A> createRef(A adapter, ObservableList<T> items, ObservableList.OnListChangedCallback callback) {
if (thread == null || !thread.isAlive()) {
thread = new PollReferenceThread();
thread.start();
}
return new AdapterRef<>(adapter, ... |
36564453_7 | void onCredentialsRetrieved(final Activity activity, final Credential credential) {
Log.v(TAG, "Credentials : " + credential.getName());
String email = credential.getId();
String password = credential.getPassword();
getAPIClient().login(email, password, getAuthenticationParameters(), new Authentication... |
36572522_0 | @Override
public void writeToParcel(Parcel dest, int flags) {
Postman.writeToParcel(this, dest);
} |
36600590_10 | public int receive() throws IOException {
int bytes = channel.read(rxBuffer);
if (bytes <= 0)
return bytes;
rxBuffer.flip();
while (parse());
rxBuffer.compact();
if (rxBuffer.position() == rxBuffer.capacity())
throw new ITCHException("Packet length exceeds buffer capacity");... |
36603494_1 | public PagingControls getPagingControls() {
return pagingControls;
} |
36614714_5 | public static byte[] getReadPumpCommand(final byte[] serial) {
byte[] data = new byte[]{
0x01, // head
0x00, // head
(byte) 0xA7, // 167
0x01, // 1
0x00, // Serial
0x00, // Serial
0x00, // Serial
(byte) 0x80, // 128
... |
36649267_29 | public static boolean validateBag(File dir) throws Exception {
boolean isValid = false;
Bag bag = new BagReader().read(dir.toPath());
BagVerifier bv = new BagVerifier();
try {
bv.isValid(bag, false);
isValid = true;
}
catch(IOException | CorruptChecksumException | InvalidBag... |
36657331_1 | protected static Person personFromRequest(String json)
{
AddPersonRequest apr = JsonUtils.getAPRFromJson(json);
Person p = AddPersonRequest.toPerson(apr);
return p;
} |
36658493_40 | public static <V> Pow2LengthBitSetRangeFactory<V> create(List<Integer> elementLengths) {
return new Pow2LengthBitSetRangeFactory<V>(elementLengths);
} |
36664864_9 | @VisibleForTesting
@SuppressWarnings("checkstyle:designforextension")
protected URI getUri() throws URISyntaxException {
String baseURL = config.baseURL;
if (!baseURL.endsWith("/")) {
baseURL += "/";
}
String url = baseURL + config.sourceID;
URI uri = new URIBuilder(url).setPort(config.port... |
36765917_1 | public Map<String, Long> extract(String text, List<String> keywords) {
Map<String, Long> result = Maps.newHashMap();
keywords.forEach(new Consumer<String>() {
@Override
public void accept(String keyword) {
if (text.contains(keyword)) {
result.put(keyword, 1L);
... |
36781255_0 | public void sendPodcastAdditionConfirmation(final String name, final String email, final String podcastUrl) {
MimeMessagePreparator preparator = new MimeMessagePreparator() {
@SuppressWarnings({ "rawtypes", "unchecked" })
public void prepare(MimeMessage mimeMessage) throws Exception {
MimeMessageHelper mess... |
36793280_136 | public static <T> RetryTransformer<T> of(Retry retry) {
return new RetryTransformer<>(retry);
} |
36807893_16 | public static int parseGeneratorId(byte[] id) {
assertNotNullEightBytes(id);
return parseGeneratorIdNoChecks(id);
} |
36812061_1 | @Override
public HttpRequest transformRequest(HttpRequest request, ServiceInstance instance) {
Map<String, String> metadata = instance.getMetadata();
if (metadata.containsKey(CF_APP_GUID) && metadata.containsKey(CF_INSTANCE_INDEX)) {
final String headerValue = String.format("%s:%s", metadata.get(CF_APP_GUID),
m... |
36816840_5 | public static String removeNonNumeric(String text) {
return text.replaceAll("[^0-9]", "");
} |
36817565_0 | public static List<ApiImplementor> getAllImplementors() {
List<ApiImplementor> imps = new ArrayList<>();
ApiImplementor api;
imps.add(new AlertAPI(null));
api = new AntiCsrfAPI(null);
api.addApiOptions(new AntiCsrfParam());
imps.add(api);
imps.add(new PassiveScanAPI(null));
imps.add(... |
36819131_4 | public int getTotalFailures() {
return totalFailures;
} |
36827833_5 | @Override
public void process(final Exchange exchange) throws Exception {
final Message msg = exchange.getIn();
final StringBuffer pwmBatch = new StringBuffer();
final String[] batchLines = msg.getBody(String.class).split("\n");
final Object smoothChangeHeader = msg.getHeader(SMOOTH_SET_HEADER);
boolean... |
36840131_11 | public String toString() {
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < tokenList.size(); i++) {
Object o = tokenList.get(i);
if (o instanceof STRING) {
buffer.append(this.startBrace).append(o).append(this.endBrace);
} else {
buffer.append(o);
}
}
return buffer.toString();
} |
36854237_278 | @Override
public ByteBuf readBytes(int length) {
checkReadableBytes(length);
if (length == 0) {
return Unpooled.EMPTY_BUFFER;
}
// Use an unpooled heap buffer because there's no way to mandate a user to free the returned buffer.
ByteBuf buf = Unpooled.buffer(length, maxCapacity);
buf.wr... |
36857422_14 | void onLoginClick(@Nullable FABProgressCircle fabCircle) {
if (!isSiteValid()) {
return;
}
if (fabCircle != null) {
fabCircle.show();
}
triggerLogin();
} |
36873773_585 | public String getFirstHeader(final ResponseHeader responseHeader) {
for (final Header header : mHeaders) {
if (header.getName().equalsIgnoreCase(responseHeader.getKey())) {
return header.getValue();
}
}
return null;
} |
36882032_1 | @Override
public int hashCode() {
return authority.hashCode();
} |
36906356_32 | @Override
public String render(CukedoctorDocumentBuilder docBuilder, I18nLoader i18n, DocumentAttributes documentAttributes) {
final FeatureRenderer renderer = FeatureSection.featureRenderer.get();
renderer.setI18n(i18n);
renderer.setDocumentAttributes(documentAttributes);
return renderer.renderFeature(... |
36953044_19 | public <R> R reduce(R initial, Func2<R, T, R> accumulator) {
R value = initial;
for (T anIt : this)
value = accumulator.call(value, anIt);
return value;
} |
36960637_540 | @VisibleForTesting
static void registerTimestampForTracking(
Clock clock, MetricsManager metricsManager, String shortName, Supplier<Long> supplier) {
metricsManager.registerMetric(
TimestampTracker.class,
shortName,
TrackerUtils.createCachingMonotonicIncreasingGauge(log, ... |
37007492_11 | @Override
public Long next() {
return range(1)[0];
} |
37063452_115 | public static String toText(String string) {
boolean escaped = false;
StringBuilder sb = new StringBuilder();
int i;
// Remove the trailing and starting quotes.
string = removeQuotes(string);
// Decode
for (i = 0; i < string.length(); ++i) {
char c = string.charAt(i);
if (escaped) {
escap... |
37063524_6 | public void onNewConfigsFromScheduler(List<LogstashConfig> hostInfo,
List<LogstashConfig> dockerInfo) {
LOGGER.info("onNewConfigsFromScheduler, {}\n-------\n{}", dockerInfo, hostInfo);
this.dockerInfo = dockerInfo;
this.hostInfo = hostInfo;
LOGGER.info("New configuration received. Reconfiguring...")... |
37125392_45 | @Override
public DeepExperimentBuilder preprocessing(AnalysisEngineDescription preprocessing) {
super.preprocessing(preprocessing);
return this;
} |
37128954_67 | public synchronized void stopListeningForIncomingConnections() {
if (mServerThread != null) {
Log.i(TAG, "stopListeningForIncomingConnections: Stopping...");
mIsStoppingServer = true; // So that we don't automatically restart
mServerThread.shutdown();
mServerThread = null;
}
} |
37136454_16 | public static void main(String[] args) {
B.methodNoLongerStatic();
} |
37147644_29 | @Override
public void write(Object value, OutputStream outputStream) throws IOException {
write(value, outputStream, Locale.getDefault());
} |
37148584_2 | public boolean clientSendsToken() {
return true;
} |
37149914_1 | public void prettify(ActionRequest request, ActionResponse response)
throws IOException, PortletException {
String prettyProperties = prettify(request);
request.setAttribute("portalPrettyProperties", prettyProperties);
} |
37181308_9 | public static String toJSONString(Object bean) {
return getJsonable().toJSONString(bean);
} |
37256706_12 | @Override
public boolean containsKey(Object key)
{
return map.containsKey(key);
} |
37286678_3 | String getUri() {
return uri;
} |
37293168_20 | @Override
public void onPointDetected(float px, float py, float x, float y) {
int cellX = (int) (x / CELL_SIZE);
int cellY = (int) (y / CELL_SIZE);
if (cellX >= 0 && cellX < gameOfLifeAutomata.getWidth()
&& cellY >= 0 && cellY < gameOfLifeAutomata.getHeight()) {
gameOfLifeAutomata.getCe... |
37299113_0 | public void add(TimeEntry entry) {
entries.add(entry);
} |
37310376_0 | public IscrollJsGenerator(final IscrollSettings settings, final String componentId)
{
super(settings);
setMethodName("IScroll");
setComponentId(Args.notNull(componentId, "componentId"));
setWithComponentId(true);
} |
37318294_19 | @Override
public boolean validate(String cc) {
cc = NON_DIGIT.matcher(cc).replaceAll("");
if (isRepeated(cc)) {
return false;
}
int sum = 0;
boolean odd = false;
for (int index = cc.length() - 1; index >= 0; index--) {
int n = Integer.parseInt(cc.substring(index, index + 1));
... |
37418050_9 | public FROM FROM(@NonNull String tableName) {
return new FROM(this, tableName);
} |
37421395_11 | public static BisectStep getNextStep(BisectStep step, boolean isSuccess) {
return isSuccess ? later(step.getLeft(), step.getRight()) : earlier(step.getLeft(), step.getRight());
} |
37428038_3 | public UnsafeCopier build(Unsafe unsafe)
throws IllegalAccessException, InstantiationException, NoSuchMethodException,
InvocationTargetException {
checkArgument(offset >= 0, "Offset must be set");
checkArgument(length >= 0, "Length must be set");
checkNotNull(unsafe);
Class<?> dynamicType = new ByteBu... |
37447498_36 | public String colorFromReading(double reading) {
if (reading < HYPO_LIMIT) {
// hypo limit 70
return "purple";
} else if (reading > HYPER_LIMIT) {
// hyper limit 200
return "red";
} else if (reading < userMin) {
// low limit
return "blue";
} else if (read... |
37462781_28 | public final T getInitialValue() {
return this.initialValue.orNull();
} |
37475020_14 | public static boolean doubleEquals(final double a, final double b, final double epsilon)
{
final double diff = Math.abs(a - b);
return diff < epsilon
|| (Double.isNaN(diff) && a == b); // Handle the case where a = b = Double.POSITIVE_INFINITY or a = b = Double.NEGATIVE_INFINITY.
} |
37485046_17 | public int getNumFeatures() {
return model.numFeatures;
} |
37507175_40 | @Bean
@ConditionalOnMissingBean(ProcessEngineConfigurationImpl.class)
public ProcessEngineConfigurationImpl processEngineConfigurationImpl(List<ProcessEnginePlugin> processEnginePlugins) {
final SpringProcessEngineConfiguration configuration = CamundaSpringBootUtil.springProcessEngineConfiguration();
configuration.... |
37523659_1 | public void loadBooks(final boolean pullToRefresh) {
if(isViewAttached()) {
getView().showLoading(pullToRefresh);
}
dataFetcher.getBooks(new DataCallback<Book[]>() {
@Override
public void onSuccess(Book[] books) {
if (isViewAttached()) {
getView().setDa... |
37629393_2 | private ConfigFieldsDefiner(
int classWriterFlags,
String className,
ConfigClassScanner configScanner,
Map<String, ?> config) {
super(classWriterFlags, className);
this.configScanner = configScanner;
this.config = config;
} |
37632768_1 | public SearchResult search(String term) {
if (term == null || term.trim().isEmpty()) {
LOGGER.debug("No query term supplied, returning empty results.");
return new SearchResult();
}
THROTTLE.acquire();
String normalizedTerm = term.toLowerCase();
final List<ConferenceSession> conten... |
37656718_2 | @Override
public void setConfigProperties(Object client, String configFile, String configName) {
Class<?> clazz = !(client instanceof Dispatch) ? client.getClass() : null;
ClientConfig config = readConfig(configFile, configName, clazz, (BindingProvider) client);
setConfigProperties(client, config);
} |
37672572_3 | public static void clearUnwalkableTriangles(Context ctx, float walkableSlopeAngle, float[] verts, int nv,
int[] tris, int nt, int[] areas) {
float walkableThr = (float) Math.cos(walkableSlopeAngle / 180.0f * Math.PI);
float norm[] = new float[3];
for (int i = 0; i < nt; ++i) {
int tri = i ... |
37712296_2 | public boolean detectPotentiallyDangerousApps() {
return detectPotentiallyDangerousApps(null);
} |
37720965_35 | public Subscription convert(SubscriptionEntity subscriptionEntity) {
final Subscription subscriptionItem = new Subscription();
subscriptionItem.setId(subscriptionEntity.getId());
subscriptionItem.setApi(subscriptionEntity.getApi());
subscriptionItem.setApplication(subscriptionEntity.getApplication());
... |
37728390_15 | public Bag getObjectsWithinDistance(final Geometry g, final double dist)
{
Bag nearbyObjects = new Bag();
Envelope e = g.getEnvelopeInternal();
e.expandBy(dist);
List<?> gList = spatialIndex.query(e);
// However, the JTS QuadTree query is a little sloppy, which means it
// may return objects t... |
37775708_0 | public static String removeNonPrintableChars(@Nullable final String s) {
if (null == s || s.isEmpty()) return "";
StringBuilder newString = new StringBuilder(s.length());
for (int offset = 0; offset < s.length(); ) {
int codePoint = s.codePointAt(offset);
offset += Character.charCount(codeP... |
37788075_21 | @Override
public IntervalIterator<PartitionedLatency<T>> intervals() {
return rolling.intervalsWithDefault(noOpLatency);
} |
37791069_1 | public static SDPScheme parse(String sdp) {
SDPReader reader = new SDPReader(sdp);
SDPRawRecord record;
//
// Session
//
int version = reader.readVersion();
String originator = reader.readRecord('o').getValue();
String sessionName = reader.readRecord('s').getValue();
SDPSession sess... |
37796696_56 | public DataTable subTable(int fromRow, int fromColumn) {
return subTable(fromRow, fromColumn, height(), width());
} |
37816257_153 | public DataSource createDataSourceProxy(DataSource dataSource) {
return createDataSourceProxy(null, dataSource);
} |
37826137_0 | public void updateNotificationsFromServer(UpdatePolicy updatePolicy, final NotificationLoaderFinishListener listener) {
if (updatePolicy == null) {
throw new IllegalArgumentException("updatePolicy must not be null");
}
Date date = preferenceStore.getLastServerUpdate();
boolean shouldUpdate = up... |
37853715_0 | public void assertIsNone() {
if (!actual.isNone()) {
throw fail("Option was not None");
}
} |
37879810_24 | @Override
public String getContextValue()
{
return value;
} |
37930526_39 | @Override
public MarkLogicRepositoryConnection getConnection()
throws RepositoryException {
if (!isInitialized()) {
throw new RepositoryException("MarkLogicRepository not initialized.");
}
return new MarkLogicRepositoryConnection(this, getMarkLogicClient(), quadMode);
} |
37984143_69 | @Override
public void remove ()
{
if (currentElement == null)
{
throw new IllegalStateException ();
}
result = result.subList (index, result.size ());
index = 0;
pageable.delete (currentElement);
currentElement = null;
skip--;
} |
37987555_8 | @Override
public UndirectedGraph<String, UnorderedPair<String>> getUndirectedGraph()
throws SenseInventoryException, UnsupportedOperationException
{
if (undirectedGnetGraph != null) {
return undirectedGnetGraph;
}
logger.info("Creating sense graph for " + gnet.numLexUnits()
+ " lexi... |
38044291_0 | @Override
public Signature sign(final byte[] data) {
if (!this.getKeyPair().hasPrivateKey()) {
throw new CryptoException("cannot sign without private key");
}
// Hash the private key to improve randomness.
final byte[] hash = Hashes.sha3_512(ArrayUtils.toByteArray(this.getKeyPair().getPrivateKey().getRaw(), 32))... |
38080174_77 | @Nullable
@Override
public RpcSender createSender(RpcClientConnectionPool pool) {
List<RpcSender> subSenders = list.listOfNullableSenders(pool);
int activeSenders = 0;
for (RpcSender subSender : subSenders) {
if (subSender != null) {
activeSenders++;
}
}
if (activeSenders < minActiveSubStrategies)
return ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.