id stringlengths 7 14 | text stringlengths 1 37.2k |
|---|---|
17517521_312 | @Override
public Map<String, Object> asMap() throws JWTDecodeException {
return null;
} |
17547888_0 | public int getMaxRows() {
return packedValues.length;
} |
17559168_4 | public static int fromString(String s) throws IllegalArgumentException
{
char[] ca = s.toCharArray();
if (ca.length != 4) {
throw new IllegalArgumentException();
}
int res = 0;
for (int i = 0; i < 4; i++) {
int c = ca[i];
if (c > 0xff) {
throw new IllegalArgument... |
17575379_17 | public static String join(final Collection<String> elements,
final String joinSeparator) {
String separator = ",";
if (elements == null) {
return null;
}
if (joinSeparator != null) {
separator = joinSeparator;
}
StringBuilder buffer = new StringBuilder();
boolean isFirst = true;
for (String element : elem... |
17592978_1 | public PaypalResponse completePayment(PaperightCreditTransaction transaction, String token, String payerId) {
Profile user = new BaseProfile.Builder(apiUser, apiPassword).signature(apiSignature).build();
/* create new instance of paypal nvp */
Environment environment;
if (sandbox) {
environment = Environment.SAND... |
17612803_365 | @Override
public void tick() {
Set<Player> die = new HashSet<>();
heroesGo();
die.addAll(getDied());
enemiesGo();
die.addAll(getDied());
die.addAll(bricksGo());
for (Player player : die) {
player.event(Events.KILL_HERO);
}
} |
17621324_2 | public HttpHeaders create() {
log.debug("Create new order: {}", model);
ordersService.save(model);
return new DefaultHttpHeaders("success")
.setLocationId(model.getId());
} |
17626803_1 | public ActionPossibility canCreate(ApplicationUser user) {
boolean possible = user != null && user.getName() != null && !user.getName().isEmpty();
return new ActionPossibility(possible, "Anonymous user cannot create complex measurement", HttpStatus.UNAUTHORIZED);
} |
17627721_1 | public Iterable<ConceptBreakdown> getChildBreakdownInfos() {
return childBreakdown;
} |
17651735_19 | public static float entropy(float[] c) {
float e = 0.0f;
for(int i=0;i<c.length;i++){
if(c[i]!=0.0&&c[i]!=1){
e -= c[i]*Math.log(c[i]);
}
}
return e;
} |
17662022_131 | public void editOpenOfferStart(OpenOffer openOffer,
ResultHandler resultHandler,
ErrorMessageHandler errorMessageHandler) {
if (offersToBeEdited.containsKey(openOffer.getId())) {
log.warn("editOpenOfferStart called for an offer which is already i... |
17670446_25 | @Override
public Variant convert(VcfSliceProtos.VcfRecord vcfRecord) {
return convert(vcfRecord, "0", 0);
} |
17684716_10 | @Override
public String getItemAsString(Properties props) throws XQException {
if (closed) {
throw new XQException(ex_item_closed);
}
if (value == null) {
throw new XQException("Value is not accessible");
}
props = checkOutputProperties(props);
return xqProcessor.convertToString(value, props);
} |
17705626_1 | @Override
public TagNames fromString(String value) {
String[] tokens = value.split(",", -1);
Set<String> names = Arrays.stream(tokens).map(token -> {
if (token.trim().isEmpty()) {
throw new IllegalArgumentException("Invalid tag list:" + value);
}
String[] parts = token.split(... |
17714013_2 | @Override
public TransferRuleDescriptor convert(IDataSet source) {
Collection<RecodeRule> result = new ArrayList<>();
try {
for (String tableName : source.getTableNames()) {
ITable table = source.getTable(tableName);
int columnCount = table.getTableMetaData().getColumns().length;... |
17717497_57 | public String getPassword() {
return password;
} |
17759402_25 | public String aHex() {
String first = translate(this.bits.substring(0, 4));
String second = translate(this.bits.substring(4, 8));
return first + second;
} |
17775087_4 | @Override
public NetworkResponse performRequest(Request<?> request) throws VolleyError {
long requestStart = SystemClock.elapsedRealtime();
while (true) {
HttpResponse httpResponse = null;
byte[] responseContents = null;
Map<String, String> responseHeaders = Collections.emptyMap();
... |
17787462_1 | @Override
protected Lyrics doInBackground(String... strings) {
String url = strings[0];
String artist;
String track;
if (url == null)
return new Lyrics(ERROR);
if (url.contains("//www.soundhound.com/")) {
try { // todo switch to Jsoup
String html = getUrlAsString(url);
... |
17794452_0 | public static String hello() {
return "Hello World";
} |
17801020_1 | public byte[] toByteArray() {
byte[] bytes = new byte[size + filled];
int off = 0;
for (Link l : link) {
System.arraycopy(l.buffer, l.offset, bytes, off, l.size);
off += l.size;
}
if (filled > 0) {
System.arraycopy(buffer, 0, bytes, off, filled);
}
return bytes;
} |
17835696_31 | protected boolean isValidEndpointPath(String endpointName) {
char[] charArray = endpointName.toCharArray();
for (int i = 0; i < charArray.length; i++) {
char c = charArray[i];
if (i == 0) {
if (c != '/') {
return false;
}
continue;
}
... |
17856644_12 | public static Class detectClass(String json) {
Objects.requireNonNull(json);
Preconditions.checkArgument(StringUtils.isNotEmpty(json));
ObjectNode objectNode;
try {
objectNode = (ObjectNode) mapper.readTree(json);
} catch (IOException ex) {
ex.printStackTrace();
return null;
}
if (objectNode... |
17895094_359 | @Override
public boolean hasPermission(Authentication authentication, RegionWidget regionWidget, Permission permission) {
return hasPermission(authentication, regionWidget, permission, false);
} |
17905830_5 | String parse(String wikiOrigText, WikiIDTitlePair id_title, boolean csvOrReadable) throws CompilerException,
LinkTargetException, EngineException {
WikiConfig config = DefaultConfigEn.generate();
WtEngineImpl engine = new WtEngineImpl(config);
// Retrieve a page
PageTitle pageTitle = PageTitle.make(config, id_t... |
17912611_38 | private T get(int msecs) throws ExecutionException, TimeoutException {
try {
return Objects.uncheckedCast(qiFutureCallGet(_fut, msecs));
}
catch (Exception exception) {
Throwable throwable = exception;
while (throwable != null) {
if (throwable instanceof CancellationExce... |
17919097_179 | TaskDag createTaskDag() {
long start = System.currentTimeMillis();
TaskDag taskDag = new TaskDag();
List<ProvisionerAction> actionOrder = actions.getActionOrder().get(clusterAction);
for (Node node : nodeMap.values()) {
if (!shouldPlanNode(node.getId())) {
continue;
}
for (Service service : n... |
17939962_0 | static byte[] adaptArray(byte[] ftdiData)
{
int length = ftdiData.length;
if(length > 64)
{
int n = 1;
int p = 64;
// Precalculate length without FTDI headers
while(p < length)
{
n++;
p = n*64;
}
int realLength = length - n*2;
... |
17953190_20 | public Map<V, Set<V>> getSuccessors() {
return successors;
} |
17959249_7 | public String parse() {
Map<String, ClassConstraints> classNameToValidationRulesMap = new HashMap<>();
for (Class clazz : classpathScanner.findClassesToParse()) {
if (clazz != null) {
ClassConstraints classValidationRules = new AnnotatedClass(clazz, options.getExcludedFields(),
allRelevantAnnotat... |
17959600_0 | public void increment(NumerusRollingNumberEvent type, Boolean doNotBlock) {
Bucket lastBucket = getCurrentBucket(doNotBlock);
if (lastBucket == null)
return;
lastBucket.getAdder(type).increment();
} |
17971137_149 | public LogicalPlan createPlan(Expr expr) throws PlanningException {
return createPlan(expr, false);
} |
17971138_20 | @Override
public boolean equals(Object obj) {
if (obj instanceof Tuple) {
Tuple other = (Tuple) obj;
return Arrays.equals(getValues(), other.getValues());
}
return false;
} |
17971683_0 | @Override
public Book addBook(Book book) {
sessionFactory.getCurrentSession().persist(book);
return book;
} |
17987394_23 | @Override public JsonElement serialize(JSON.Location src, Type typeOfSrc,
JsonSerializationContext context) {
JsonObject jsonObject = (JsonObject) new GsonBuilder().create().toJsonTree(src);
if (src.heading < 0 || src.heading >= 360) {
jsonObject.remove("heading");
}
return jsonObject;
} |
17988451_2 | @Override
public void write(List<? extends IndexQuery> items) throws Exception {
if(isActualTransactionActive()) {
addToBuffer(items);
}else {
writeItems(items);
}
} |
17990464_3 | static <T> Iterator<T> advancePast(@NonNull Iterator<T> iterator, @NonNull T element) {
Preconditions.checkNotNull(iterator);
Preconditions.checkNotNull(element);
while (iterator.hasNext()) {
if (iterator.next() == element) {
break;
}
}
Preconditions.checkArgument(iterator.hasNext());
retur... |
17994739_3 | public static void adjustMinMax(AdaptationSetType adaptationSetType, Function<RepresentationType, Long> get, ObjLongConsumer<AdaptationSetType> setMin, ObjLongConsumer<AdaptationSetType> setMax) {
List<RepresentationType> representations = adaptationSetType.getRepresentation();
long min = Integer.MAX_VALUE, max... |
18023059_2 | @PostConstruct
public void init() {
rn = new SecureRandom();
} |
18035587_2 | @Override
public boolean match(String className, String pattern) {
return matchExactlyFullQualifiedClassName(className, pattern) ||
matchFullQualifiedPackageNameAndItsSubPackage(className, pattern) ||
matchFullQualifiedPackageName(className, pattern);
} |
18093759_63 | static Connection createCustomDriverConnection(OracleDriverConnectionInfo connInfo,
ConnectorMessages cm) {
try {
return SQLUtil.getDriverMangerConnection(connInfo.getDriver(), connInfo.getUrl(),
connInfo.getUser(), connInfo.getPassword());
} catch (RuntimeException e) {
... |
18106767_0 | public void getData() {
WebClient webClient = WebClient.create(url);
webClient = null;
} |
18114836_20 | public static String getPropertyFromX500Principal(X509Certificate cert, String propertyName) {
String propertyValue = null;
String principalName = cert.getSubjectX500Principal().getName();
log.debug("Found principalName = {}", principalName);
Pattern pattern = createPattern(propertyName);
Matcher matcher = pa... |
18133301_36 | public E getMode() {
return mode;
} |
18143415_0 | public void clear()
{
m_string = "";
} |
18150497_4 | public static String confirmationMethodHashS256(String certificateAsPem) {
if (org.apache.commons.lang.StringUtils.isBlank(certificateAsPem)) {
return "";
}
try {
certificateAsPem = org.apache.commons.lang.StringUtils.remove(certificateAsPem, "-----BEGIN CERTIFICATE-----");
certifica... |
18167513_0 | public void selectionChanged(IAction action, ISelection selection) {
_selection = selection;
} |
18188420_0 | public static void extractArchive (Path archivePath, Path extractToDirectory)
throws IOException, CompressorException, ArchiveException {
try (InputStream jdkInputStream = new BufferedInputStream(Files.newInputStream(archivePath))) {
String compressorType = null;
try {
compressorType = CompressorStreamFactor... |
18194625_9 | public static TransientObject getBack(OfyObject ofyObject) {
TempObject beo = new TempObject(); // gonna get over written anyways
beo.setMaps(ofyObject.user_data,ofyObject.meta_data);
return beo;
} |
18202815_119 | public String convert(Integer target) {
return target.toString();
} |
18208577_2 | @Override
public int getColumnIndex(final String columnName) {
final String column = applyAlias(columnName);
return mFieldAccessor.getFieldIndexByName(column);
} |
18227906_9 | public static boolean validFontPackFolder(String path) {
final File folder = new File(path);
if (!folder.exists() || !folder.isDirectory()) return false;
final String[] fileList = folder.list();
if (fileList == null) return false;
final Set<String> fileNameSet = new HashSet<>(Arrays.asList(fileList));
retur... |
18249859_0 | public static String createHash(String password) {
Args.notBlank(password, "password");
return createHash(StringUtil.toUtf8Bytes(password));
} |
18259368_4 | public static <T> Chain<T> chain(final List<T> list) {
return new Chaining.Chain<T>(list);
} |
18259510_3 | @Override
public <T> TypeAdapter<T> create(final Gson gson, final TypeToken<T> type) {
Class incoming = type.getRawType();
if (subClasses != null) {
boolean matched = false;
for (Class<? extends B> subClass : subClasses) {
if (incoming == subClass) {
matched = true;
break;
}
... |
18269132_9 | @NonNull
public static String appendPath(@NonNull String first,
@NonNull String second) {
String result = first + SEP + second;
while (result.contains("//")) {
result = result.replaceAll("//", "/");
}
if (result.length() > 1 && result.endsWith(SEP)) {
re... |
18288221_2 | protected GlobalSummary getGlobalSummary(Project project) {
GlobalSummary globalSummary = null;
String localJtlPath = getLocalJtlFilePath(project);
String projectName = project.getName();
try {
if (!StringUtils.isBlank(localJtlPath)) {
// Get report parsing local jtl file
LOG.info("Getting J... |
18298933_24 | @Override
public Single<List<Alumno>> getListaAlumnos() {
return Single.<List<Alumno>>error(new Throwable("No se pudo acceder"));
return Single.just(Arrays.asList(
new Alumno("Baldomero", "Su casa", "http://lorempixel.com/100/100/sports/1/"),
new Alumno("Germán Ginés", "Su casita", "ht... |
18322758_65 | public static void main(String[] args) throws Exception{
int nContinuousAttributes=4;
int nDiscreteAttributes=0;
String names[] = {"SEQUENCE_ID", "TIME_ID","Income","Expenses","Balance","TotalCredit"};
String path = "datasets/simulated/";
int nSamples=1000;
//Generate random dynamic data
... |
18338023_11 | public static <T> BodyReader<T> json(Class<T> type) {
return INSTANCE.reader(type);
} |
18339070_0 | public String toString() {
StringBuilder sb = new StringBuilder("\n---------\n");
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
sb.append("|").append(board[i][j]).append("|");
}
sb.append("\n---------\n");
}
return sb.toString();
} |
18345774_2 | @Override public Response intercept(Chain chain) throws IOException {
if (requestHandler != null) {
return modifyRequest(chain);
}
return chain.proceed(chain.request());
} |
18347965_3 | @Override
public <T extends Annotation> Optional<T> getAnnotation(Class<T> annotationType) {
Class castClass = Cast.toClass(input);
return (Optional<T>) Optional.fromNullable(castClass.getAnnotation(annotationType));
} |
18355892_3 | public void onFinished(List<String> items) {
if (mainView != null) {
mainView.setItems(items);
mainView.hideProgress();
}
} |
18358222_9 | public List<Message> getMessagesMatchingFilter(MessageFilter filter) {
Date calcFromDate = Optional.ofNullable(filter.getFromDate()).orElse(startOfDay());
Date calcToDate = Optional.ofNullable(filter.getFromDate()).orElse(endOfDay());
Integer calcPage = Optional.ofNullable(filter.getPageNumber()).orElse(0);... |
18367810_2 | public static double getVectorDotProduct(Vector v1, Vector v2) {
double dotProduct = 0d;
for (Integer key : v1.getVector().keySet()) {
if (v2.getVector().containsKey(key)) {
dotProduct += v1.getVector().get(key) * v2.getVector().get(key);
}
}
return dotProduct;
} |
18369808_1 | public byte[] getBytes() {
return Arrays.copyOf(britWalletId, britWalletId.length);
} |
18369848_20 | public List<List<Double>> distribute(final List<SectionData> sectionDataList) {
final List<LayerData> layerList = groupSectionsByZ(sectionDataList);
Collections.sort(layerList); // sort layers by tile count
bucketList = bucketLayers(layerList);
final List<List<Double>> distributedZValues = new ArrayL... |
18373842_53 | @Override
public String rewrite(String query, Configuration conf, HiveConf metastoreConf) throws LensException {
this.query = query;
StringBuilder mergedQuery;
rewrittenQuery.setLength(0);
String queryReplacedUdf;
reset();
try {
String finalRewrittenQuery;
if (query.toLowerCase().matches("(.*)union... |
18375032_21 | public static <T> AnnotatedListBinderBuilder<T> build(Binder binder, Class<T> type) {
return build(binder, TypeLiteral.get(type));
} |
18379456_33 | public DnssecQueryResult queryDnssec(CharSequence name, TYPE type) throws IOException {
Question q = new Question(name, type, CLASS.IN);
return queryDnssec(q);
} |
18394987_39 | protected JtwigModel createModel(AbstractTestDataEntity abstractTestDataEntity) {
JtwigModel model = JtwigModel.newModel()
.with(TEST_DATA_ENTITY.getName(), abstractTestDataEntity)
.with(SAKULI_PROPERTIES.getName(), sakuliProperties);
if (getSpecificModelEntities() != null) {
get... |
18403266_0 | private static void runPipeline(S4Endpoints s4Endpoint, String apiKeyId, String apiPassword, String rawTextFilePath, String xmiDir, String descriptorDir, String generateTypeSystemFlag)
throws Exception {
ComponentConfigurationParameters readerParameters = ComponentConfigurationParameters.newInstance()
... |
18409234_18 | public static String format(long timestampMillis) {
return FORMATTER.format(LocalTime.ofNanoOfDay(timestampMillis % (24 * 60 * 60 * 1000) * 1_000_000));
} |
18415532_0 | public void setTiltSensitivity(float tiltSensitivity) {
if (tiltSensitivity <= 0) {
throw new IllegalArgumentException("Tilt sensitivity must be positive");
}
mTiltSensitivity = tiltSensitivity;
} |
18419894_75 | public <T extends AstRegion> T parseWithStrategy(String input, ScriptParseStrategy<T> strategy)
throws ScriptParseException {
T result = null;
int newStart = 0;
int newEnd = input.length();
CharStream ais = CharStreams.fromString(input);
RobotLexer lexer = new RobotLexer(ais);
CommonTo... |
18433849_10 | public void chooseBox(View view){
String boxIdString = getResources().getResourceEntryName(view.getId());
int boxId = Integer.parseInt(boxIdString.substring(boxIdString.length() - 1));
ToeStrategy strategy = new ToeStrategyExplicit(boxId, toeGame.getTurn());
toeGame.chooseBox(getContentResolver(), stra... |
18451768_22 | public boolean isConnecting() {
return serviceConnectionManager.isConnecting();
} |
18463354_0 | Object coerce(String string, Class<?> cls) {
try {
if(cls == String.class) {
return string;
}
final Constructor<?> stringConstructor = cls.getConstructor(String.class);
if(stringConstructor != null) {
return stringConstructor.newInstance(string);
}
... |
18473213_0 | protected static <T> T unmarshallResponse(String responseBody, Class<T> clazz) {
try {
JAXBContext context = JAXBContext.newInstance(clazz);
Unmarshaller unmarshaller = context.createUnmarshaller();
Source source = new StreamSource(new ByteArrayInputStream(responseBody.getBytes()));
return unmarshalle... |
18490225_12 | @Override
public String toString() {
String message = "[pid=" + pid + ", applicationName=" + applicationName
+ ", clientTime=" + clientTime + ", clientIp=" + inetAddress
+ "]";
String signedMessage = message + getHMAC(message);
return signedMessage;
} |
18495485_110 | public List<SourceDocumentReferenceMetaInfo> retrieveMetaInfo(final Collection<String> sourceDocumentReferenceIds) {
if (null == sourceDocumentReferenceIds || sourceDocumentReferenceIds.isEmpty()) {
return Collections.EMPTY_LIST;
}
LOG.debug(LoggingComponent.appendAppFields(LoggingComponent.Migrator... |
18499671_0 | void collectBindingUrisFromArtifact(File file, List<URI> bindingUris) throws MojoExecutionException {
try (JarFile jarFile = new JarFile(file))
{
final Enumeration<JarEntry> jarFileEntries = jarFile.entries();
while (jarFileEntries.hasMoreElements()) {
JarEntry entry = jarFileEntries.nextElement();
if (entr... |
18500436_4 | public UserModule user() {
if (userModule == null) {
throw new IllegalStateException("User module not loaded. Call YtsClient.Builder.withUser() ");
}
return userModule;
} |
18506893_7 | @Override
public void execute(Project project) {
if (!project.getPlugins().hasPlugin("java")) {
return;
}
configureCompileJJTreeTask(project);
configureCompileJavaccTask(project);
} |
18511687_47 | public String getPlugin() {
return plugin;
} |
18512985_3 | public static WordSequence asWordSequence(final Dictionary dictionary,
String... words) {
Word[] dictWords = new Word[words.length];
for (int i = 0; i < words.length; i++) {
dictWords[i] = dictionary.getWord(words[i]);
}
return new WordSequence(dictWords);
} |
18516668_30 | protected ConnectionSpec newConnectionSpecInstance(final Class<?> connectionSpecClass,
final Class<?>[] constructorParameterTypes,
final Object[] constructorArguments) {
Object connSpecImpl = null;
try {
... |
18525371_10 | public static synchronized CryptoKey getSecretKey() {
if (secretKey == null) {
initSecret();
}
U.notNull(secretKey, "secret key");
return secretKey;
} |
18532549_1 | public int receive() throws IOException {
int bytes = channel.read(rxBuffer);
if (bytes <= 0)
return bytes;
rxBuffer.flip();
while (parse());
rxBuffer.compact();
receivedData();
return bytes;
} |
18559877_1 | public void parseChallengeTitle(
String responseHtml,
CaptchaInfo captchaInfo
) throws CaptchaNoJsV2ParsingError {
Matcher matcher = challengeTitlePattern.matcher(responseHtml);
if (!matcher.find()) {
throw new CaptchaNoJsV2ParsingError("Could not parse challenge title " + responseHtml);... |
18560435_15 | @Override
public String getSyntaxString() {
log.trace("syntax string of variable {} will be retrieved", variable);
return variable.getSyntaxString();
} |
18568629_13 | public List<DataSourceContainer> getDatasetList(String providerId, int offset, int number)
throws InvalidArgumentsException, DoesNotExistException {
WebTarget target =
client.target(restUrl + "/" + DatasetOptionListContainer.DATASETS)
.queryParam(DatasetOptionListContainer.PROVIDERID, providerId)
... |
18610267_4 | public EventHandlerStatus dispatchEvent(HttpServletRequest httpRequest) {
ApiContext apiContext = new MozuApiContext(httpRequest);
Event event = null;
// get the event from the request and validate
try {
String body = IOUtils.toString(httpRequest.getInputStream());
logger.debug("Event b... |
18627126_85 | @Override
public boolean applyPolicy( PolicyOption policySetting, Properties request, StorageAsset localFile, Exception exception,
Map<String, Exception> previousExceptions )
throws PolicyConfigurationException
{
if ( !options.contains( policySetting ) )
{
// Not a valid ... |
18627258_3 | @Override
public void submit(String metricName, double value) {
if (TransactionSynchronizationManager.isSynchronizationActive()) {
initializeMetricContainerAndRegisterTransactionSynchronizationIfNecessary();
metricContainer.get().metrics.add(Pair.of(metricName, value));
} else {
set(metricName, value);
}
} |
18641766_9 | public static void writeInt(OutputStream output, int value) throws IOException {
byte[] writeBuffer = new byte[4];
writeBuffer[0] = (byte) (value & 0xFF);
writeBuffer[1] = (byte) ((value>>8) & 0xFF);
writeBuffer[2] = (byte) ((value>>16) & 0xFF);
writeBuffer[3] = (byte) ((value>>24) & 0xFF);
output.write(writeBuff... |
18644701_181 | public void setTimezone(final String timezone) {
this.timezone = timezone;
} |
18672634_8 | @GET
@Path("{productId}")
public ProductDto getProduct(@PathParam("productId") String productId) {
Product product = productRepository.getProduct(productId);
if (product == null) {
throw new IllegalArgumentException("No such product: " + productId);
}
logger.info("Returning product with id [{}]", product.pr... |
18693684_0 | public String buildCondensed() {
String title = "";
if(validNotificationsResponse() && validInboxResponse()) {
title = resources.getString(R.string.message_condensed, inboxResponse.count);
title += " ";
title += resources.getString(R.string.updates_condensed, notificationResponse.count);... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.