id stringlengths 7 14 | text stringlengths 1 37.2k |
|---|---|
9812178_36 | public static Schooljaar parse(String value)
{
Pattern[] patterns = new Pattern[] {officieel, kort};
for (Pattern pattern : patterns)
{
Matcher matcher = pattern.matcher(value);
if (!matcher.matches())
{
continue;
}
String startJaar = matcher.group(1);
if (startJaar == null)
return null;
TimeU... |
9818626_1 | @DescribeResult(name = "layerName", description = "Name of the new featuretype, with workspace")
public String execute(
@DescribeParameter(name = "features", min = 0, description = "Input feature collection") SimpleFeatureCollection features,
@DescribeParameter(name = "coverage", min = 0, description = ... |
9821876_552 | @Override
public Double convert(String value, Class<? extends Double> type) {
if (isNullOrEmpty(value)) {
return null;
}
try {
return getNumberFormat().parse(value).doubleValue();
} catch (ParseException e) {
throw new ConversionException(new ConversionMessage(INVALID_MESSAGE_KEY, value));
}
} |
9854553_37 | public static String determineQualifiedName(String className) {
String readableClassName = StringUtils.removeWhitespace(className);
if (readableClassName == null) {
throw new IllegalArgumentException("readableClassName must not be null.");
} else if (readableClassName.endsWith("[]")) {
S... |
9882334_4 | public HttpRequestBuilder post() {
return new RB(Method.POST);
} |
9884445_95 | @Override
public void handle(EntityMetaData metaData, Annotation annotation, Method method) {
Class<?> elementType = getElementType(method.getGenericReturnType());
CollectionMetaData collectionMetaData = new CollectionMetaData(metaData.getEntityClass(), getGetterName(method, false),
elementType, method.getReturnT... |
9897034_1 | public Beer findBeerById(final long id) {
return beerRepository.findOne(id);
} |
9909566_12 | public void write(final RpslObject object, final List<Tag> tags) throws IOException {
if (exportFilter.shouldExport(object)) {
final String filename = filenameStrategy.getFilename(object.getType());
if (filename != null) {
final Writer writer = getWriter(filename);
final Rps... |
9910980_2 | public void execute() throws MojoExecutionException {
getLog().info("Running BPMN-MIWG test suite...");
if (!outputDirectory.exists()) {
outputDirectory.mkdirs();
}
try {
Collection<String> inputFolders = new LinkedList<String>();
if (!resources.isEmpty()) {
for (Resource resource : resources) {
Stri... |
9917257_48 | @Override
public Cluster create(CassandraServiceInfo serviceInfo,
ServiceConnectorConfig serviceConnectorConfig) {
Builder builder = Cluster.builder()
.addContactPoints(serviceInfo.getContactPoints().toArray(new String[0]))
.withPort(serviceInfo.getPort());
if (StringUtils.hasText(serviceInfo.getUsername())... |
9922054_3 | public void loadDataFromRpc() {
MyServiceAsync service = GWT.create(MyService.class);
service.getData(new AsyncCallback<String>() {
@Override
public void onSuccess(String result) {
data.setText(result);
}
@Override
public void onFailure(Throwable caught) {}
});
} |
9922058_6 | void writeDoBindEventHandlers(JClassType target, SourceWriter writer, TypeOracle typeOracle)
throws UnableToCompleteException {
writeBindMethodHeader(writer, target.getQualifiedSourceName());
for (JMethod method : target.getInheritableMethods()) {
EventHandler annotation = method.getAnnotation(EventHandler.... |
9941578_49 | NetworkStatus retrieveNetworkStatus() {
if (merlinsBeard.isConnected()) {
return NetworkStatus.newAvailableInstance();
} else {
return NetworkStatus.newUnavailableInstance();
}
} |
9949199_0 | @NotNull
@Override
public AuthorScore score(BookImportContext context) {
try {
File file = context.getFile();
String dirName = file.getParentFile().getName();
String[] rawTokens = splitAuthorPairTokens(dirName);
String[] tokens = trim(rawTokens);
List<Author> authors = new A... |
9965237_0 | public static Buffer decompress(byte[] in) {
return decompress(in, 0, in.length, null);
} |
10016717_11 | @PreAuthorize("hasPermission(#spanner, 'owner')")
public void update(Spanner spanner) {
restTemplate.put("/{0}", spanner, spanner.getId());
} |
10035739_213 | public Sql[] generateSql(CreateTableStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
StringBuffer buffer = new StringBuffer();
buffer.append("CREATE TABLE ").append(database.escapeTableName(statement.getSchemaName(), statement.getTableName())).append(" ");
buffer.append("("... |
10040960_712 | public ListenableFuture<Image> createImage(final ImageTemplate template) {
ListenableFuture<Image> future = delegate.createImage(template);
// Populate the default image credentials, if missing
future = Futures.transform(future, new Function<Image, Image>() {
@Override
public Image apply(Image inp... |
10057936_5 | @NonNull @Override public Request transformRequest(@NonNull Request request) {
if (request.resourceId != 0) {
return request; // Don't transform resource requests.
}
Uri uri = request.uri;
if (uri == null) {
throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName());
}
... |
10062583_26 | public static Key.Builder makeKey(Object... elements) {
Key.Builder key = Key.newBuilder();
PartitionId partitionId = null;
for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) {
PathElement.Builder pathElement = PathElement.newBuilder();
Object element = elements[pathIndex];
if (elem... |
10064418_31 | public static Builder builder() {
return new Builder();
} |
10065023_0 | public int execute(FlowContext ctx) throws FlowExecutionException {
String name = (String) ctx.get(IN_NAME);
String message = "Hello World! ";
if (name != null) {
message += name;
}
logger.debug("Message: {}", message);
ctx.put(OUT_MESSAGE, message);
return NEXT;
} |
10075325_3 | public void updateStatusError(String errorMessage) {
StatusType status = StatusType.Factory.newInstance();
net.opengis.ows.x11.ExceptionReportDocument.ExceptionReport excRep = status
.addNewProcessFailed().addNewExceptionReport();
excRep.setVersion("1.0.0");
ExceptionType excType = excRep.addNewException();
exc... |
10079780_0 | public static ShellMode from(String... arguments) {
if (runInBatchMode(arguments)) {
return new BatchMode(extractCommand(arguments));
}
return new InteractiveMode();
} |
10081109_107 | public Rollup getRollup() {
return rollup;
} |
10085184_0 | public static List<RemoteRepository> getRemoteRepositories(MavenContainer container, Settings settings)
{
Set<RemoteRepository> remoteRepos = new HashSet<>();
remoteRepos.addAll(container.getEnabledRepositoriesFromProfile(settings));
// central repository is added if there is no central mirror
String centr... |
10113030_56 | public GoogleMap getMap() {
return mMap;
} |
10116915_0 | @SuppressWarnings("unchecked")
public void setFirst(@Nonnull ExternalTaskExecutionInfo task) {
insertElementAt(task, 0);
for (int i = 1; i < size(); i++) {
if (task.equals(getElementAt(i))) {
remove(i);
break;
}
}
ensureSize(ExternalSystemConstants.RECENT_TASKS_NUMBER);
} |
10144081_34 | public <T> T nextObject(final Class<T> type) {
return doPopulateBean(type, new RandomizationContext(type, parameters));
} |
10172073_6 | @Override
public boolean isCounterExample(A hypothesis, Iterable<? extends I> inputs, @Nullable D output) {
return EmptinessOracle.super.isCounterExample(hypothesis, inputs, output);
} |
10189028_10 | public List<ConsistentReportDO> queryConsistentReport(Map params) {
return consistentReportDao.queryConsistentReport(params);
} |
10192655_5 | public static SushiEvent generateEventFromXML(String filePath) throws XMLParsingException {
Document doc = readXMLDocument(filePath);
return generateEvent(doc, null);
} |
10195984_2 | public static <A extends Annotation,I> Index<A,I> load(Class<A> annotation, Class<I> instanceType) throws IllegalArgumentException {
return load(annotation, instanceType, Thread.currentThread().getContextClassLoader());
} |
10227537_1 | public static void configureAuthentication(String role) {
Collection<GrantedAuthority> authorities = AuthorityUtils.createAuthorityList(role);
Authentication authentication = new UsernamePasswordAuthenticationToken(
USERNAME,
role,
authorities
);
SecurityContextHolder... |
10230369_33 | public static <T> ImmutableList<T> load(Class<? extends T> service, ClassLoader loader) {
String resourceName = "META-INF/services/" + service.getName();
List<URL> resourceUrls;
try {
resourceUrls = Collections.list(loader.getResources(resourceName));
} catch (IOException e) {
throw new ServiceConfigura... |
10262572_39 | @Nullable
public static String getCleanContentType (@Nullable final String sContentType)
{
final ContentType aCT = parseContentType (sContentType);
return aCT != null ? aCT.toString () : null;
} |
10264172_22 | @Override
public double evaluate(final double[] x) {
if (x.length > 1) {
throw new AIFHError("The inverse squared link function can only accept one parameter.");
}
return -Math.pow(x[0], -2);
} |
10269178_27 | public ScenarioDiffInfo compare(final String baseUseCaseName, final String baseScenarioName) {
this.baseUseCaseName = baseUseCaseName;
this.baseScenarioName = baseScenarioName;
final List<Step> baseSteps = loadSteps(parameters.getBaseBranchName(), parameters.getBaseBuildName());
this.comparisonSteps = loadSteps(p... |
10277647_3 | static void parse(final String instructions,
final Set<PosixFilePermission> toAdd,
final Set<PosixFilePermission> toRemove) {
for (final String instruction : COMMA.split(instructions)) {
parseOne(instruction, toAdd, toRemove);
}
} |
10285025_16 | public static Class<?> getElementsClassOf(Class<?> clazz) {
if (clazz.isArray()) {
return clazz.getComponentType();
}
if (Collection.class.isAssignableFrom(clazz)) {
// TODO check for annotation
logger.warn("In Java its not possible to discover de Generic type of a collection like: {... |
10288113_13 | public boolean hasBackupDB() {
return dbProvider.getDBFile() != null;
} |
10288749_43 | public static void notEmpty(String string, String errorMessage) {
if (string.isEmpty()) {
throw new IllegalArgumentException(errorMessage);
}
} |
10294926_3 | void entryptPassword(User user, String plainPassword) {
byte[] salt = Digests.generateSalt(SALT_SIZE);
user.setSalt(Encodes.encodeHex(salt));
byte[] hashPassword = Digests.sha1(plainPassword.getBytes(), salt, HASH_INTERATIONS);
user.setPassword(Encodes.encodeHex(hashPassword));
} |
10300045_0 | @Override
public int compare(EventAdapter.Item event1, EventAdapter.Item event2) {
if (event1.getEvent().getStart() == null) {
if (event2.getEvent().getStart() == null) {
return 0;
} else {
return 1;
}
} else if (event2.getEvent().getStart() == null) {
ret... |
10311319_20 | @Override
public synchronized void close() throws IOException {
if (this.fileChannel.isOpen()) {
long start = System.nanoTime();
this.fileChannel.close();
this.fileLifecycleListener.onEvent(EventType.CLOSE, this.path, System.nanoTime() - start);
}
} |
10325227_3 | public void handle(ServiceDescriptorProto service) throws IOException {
ImmutableList.Builder<ServiceHandlerData.Method> methods = ImmutableList.builder();
for (MethodDescriptorProto method : service.getMethodList()) {
ServiceHandlerData.Method methodData = new ServiceHandlerData.Method(
method.getName(... |
10329015_9 | public static PointArray newInstance(final long length) {
return StructuredArray.newInstance(PointArray.class, Point.class, length);
} |
10329619_35 | public static Map<String, String> decodeOAuthHeader(String header) {
Map<String, String> headerValues = new HashMap<String, String>();
if (header != null) {
Matcher m = OAUTH_HEADER.matcher(header);
if (m.matches()) {
if (AUTH_SCHEME.equalsIgnoreCase(m.group(1))) {
fo... |
10354997_2 | @Override
public DetectedLanguage classify(CharSequence str, boolean normalizeConfidence) {
// Compute the features and apply NB
reset();
append(str);
return classify(normalizeConfidence);
} |
10359213_76 | public String getHttpEndpoint() {
return "http://" + getMyHostname() + ":" + httpPort;
} |
10361643_1246 | @Override
public String nameFromSimpleTypeRestriction(final QName simpleType, final QName base) {
return nameFromSchemaTypeName(simpleType).concat(" restricts ").concat(nameFromSchemaTypeName(base));
} |
10367500_9 | public final String getPortfolioReview() {
final StringBuilder sb = new StringBuilder();
sb.append("<table class=\"shareValueTableDetails\">");
for (final Equity equity : getEquities()) {
sb.append("<tr><td width=200px><b>")
.append(equity.getCurrentName())
.append("</b></td><td width=180px>")
.append(equ... |
10385460_0 | @Override
public Integer getObject() {
try {
int time = new java.util.Date().hashCode();
int ipAddress = InetAddress.getLocalHost().hashCode();
int rand = metaPrng.nextInt();
int seed = (ipAddress & 0xffff) |
((time & 0x00ff) << 32) | (rand & 0x0f000000);
logger.info("seed = " + seed);
return seed;
... |
10400052_81 | public static boolean empty(Object[] array) {
return array == null || array.length == 0;
} |
10410163_2 | public static Offset at(HorizontalOffset horizontal, VerticalOffset vertical) {
return new InternalOffsets.OffsetImpl(horizontal, vertical);
} |
10422484_9 | public static Map<String,String> processResults(String responseBody) {
JSONParser parser = new JSONParser(JSONParser.MODE_RFC4627);
try {
JSONObject object = (JSONObject)parser.parse(responseBody);
Object results = object.get("docs");
if(results!=null && results instanceof JSONArray) {
... |
10429628_1 | @Override
public int nextInt(int n) {
if (n == 5) {
return getNextValueOf(fives, indexInFives++);
} else if (n == 9) {
return getNextValueOf(nines, indexInNines++);
}
throw new UnsupportedOperationException("not expected invocation of nextInt(" + n + ")");
} |
10445803_57 | public static boolean empty(String[] arr) {
if (arr == null || arr.length == 0) {
return true;
}
for (String s : arr) {
if (s != null && !"".equals(s)) {
return false;
}
}
return true;
} |
10448161_121 | public static float[] scale(float[] a1, float b) {
validateArray(a1);
float[] mul = new float[a1.length];
for (int i = 0; i < a1.length; i++) {
mul[i] = a1[i] * b;
}
return mul;
} |
10455939_33 | public double getNDGC() {
if (observations.isEmpty()) {
return 0.0;
}
TIntDoubleMap actual = new TIntDoubleHashMap();
for (KnownSim ks : known.getMostSimilar()) {
actual.put(ks.wpId2, ks.similarity);
}
int ranks[] = new int[observations.size()];
double scores[] = new double[o... |
10472733_48 | public Encounter getEncounterEntity(Date encounterDateTime,String formUuid,String providerId, int locationId, String userSystemId, Patient patient, String formDataUuid) {
Encounter encounter = new Encounter();
encounter.setProvider(getDummyProvider(providerId));
encounter.setUuid(getEncounterUUID());
e... |
10472781_49 | public static Method extractPossiblyGenericMethod(Class<?> clazz, Method sourceMethod)
{
Method exactMethod = extractMethod(clazz, sourceMethod);
if (exactMethod == null)
{
String methodName = sourceMethod.getName();
Class<?>[] parameterTypes = sourceMethod.getParameterTypes();
for (... |
10476504_0 | public CompletableFuture<Response> register(Long userId, PluginReqisterQuery pluginReqisterQuery, PluginUpdate pluginUpdate,
String authorization) {
validateSubscription(pluginReqisterQuery);
checkAuthServiceAvailable();
return persistPlugin(pluginUpdate, plugin... |
10503489_2 | @Override
public void run(TaskMonitor taskMonitor) throws Exception {
taskMonitor.setTitle("Loading InCites Network ...");
this.locationMap = new IncitesInstitutionLocationMap();
OPCPackage pkg;
try {
MonitoredFileInputStream fileInputStream = new MonitoredFileInputStream(file, taskMo... |
10514209_0 | public static boolean isOdd(int number) {
return number % 2 == 1;
} |
10522064_9 | @Override
public ServiceResponse[] getRaw(String attribute)
throws AttributeNotSupportedException, ServiceNotAvailableException, ServiceException {
if (!this.isConnected()) {
throw new ServiceNotAvailableException();
}
// Retrieve attribute from service
AttributeMap attributeMap = new AttributeMap();
String... |
10522120_5116 | @Override
public boolean accepts(final Diagram diagram) {
return this.definitionSetId.equals(diagram.getMetadata().getDefinitionSetId());
} |
10532531_3 | @Override
public GuacamoleInstruction readInstruction() throws GuacamoleException {
GuacamoleInstruction filteredInstruction;
// Read and filter instructions until no instructions are dropped
do {
// Read next instruction
GuacamoleInstruction unfilteredInstruction = reader.readInstruction... |
10548179_61 | public double computeRangeResolution(double pixel) {
return ((rsr2x / 2.) / rangeBandwidth) * (computeDeltaRange(pixel) / mlRg);
} |
10550221_4 | @Override
public int value()
{
if (mFlag != Notification.DEFAULT_VIBRATE && mFlag != Notification.DEFAULT_SOUND && mFlag != Notification.DEFAULT_LIGHTS)
{
throw new IllegalArgumentException("Notification signal flag is not valid: " + mFlag);
}
return mEnable ? addFlag(mOriginal.value(), mFlag) :... |
10553586_1 | public boolean isEmpty() {
return this.connection == null && this.developerConnection == null && this.tag == null && this.url == null;
} |
10564509_25 | } |
10597460_1979 | public static void registerMBeans(
net.sf.ehcache.CacheManager cacheManager,
MBeanServer mBeanServer,
boolean registerCacheManager,
boolean registerCaches,
boolean registerCacheConfigurations,
boolean registerCacheStatistics) throws CacheException {
ManagementService... |
10605000_6 | public T getContent() {
return content;
} |
10609316_42 | @Override
public String getResourceType() {
return "reportUnit";
} |
10609318_30 | @Override
public Map<String, String> getStreamMetadata() {
if(!closed) {
throw new IllegalStateException("Stream must be closed before getting metadata");
}
Map<String,String> metadata = new HashMap<String, String>();
long compSize = compressedSize.getByteCount();
long uncompSize =... |
10610797_3 | public static String getPrimitiveTypeNameFromWrapper(Class<?> type) {
return wrapperTypes.get(type);
} |
10617959_1 | static int positionToChapterIndex(int position) throws IllegalArgumentException {
if (position < 0) {
throw new IllegalArgumentException("Invalid position: " + position);
}
final int bookCount = Bible.getBookCount();
for (int bookIndex = 0; bookIndex < bookCount; ++bookIndex) {
final in... |
10624930_17 | public Criteria getCriteria() {
return criteria;
} |
10637895_21 | public static Builder newBuilder(String keyClassName, String valueClassName,
String partitionerClassName, Configuration partitionerConf) {
return new Builder(keyClassName, valueClassName, partitionerClassName, partitionerConf);
} |
10646587_49 | public void onOpen(final SockJsSessionContext session) {
setState(State.OPEN);
service.onOpen(session);
updateTimestamp();
} |
10663360_43 | public byte[] getAndClear() {
writeLock.lock();
try {
size = 0;
return poolDigest.digest();
} finally {
writeLock.unlock();
}
} |
10667695_14 | public static BuildFromFile file() {
return new DatasetBuilder().new BuildFromFile();
} |
10676833_32 | public XQDataSource getDataSource() throws Exception {
XQueryDataSourceType dataSourceType = config.getDataSourceType();
XQDataSource dataSource = getXQDataSource(dataSourceType, config);
if (dataSourceType.connectionPropertiesAreSupported()) {
if (config.getHost() != null && config.getHost().length... |
10692925_14 | public static String status() {
StringBuilder sb = new StringBuilder(512);
sb.append("\r\nreading_mcq(yangwm,true):\t");
sb.append(IS_ALL_READ.get());
return sb.toString();
} |
10711220_16 | public Request clearIndexAsync(@Nullable CompletionHandler completionHandler) {
return clearIndexAsync(/* requestOptions: */ null, completionHandler);
} |
10726093_2 | private String getRootProjectName(String name){
f(name.contains("--")){
String type = null;
if(name.endsWith("column"))
type = "column";
else if(name.endsWith("row"))
type = "row";
String subset = name.substring(name.indexOf("--"), name.length()-type.length());
name = name.replace(subset, "");
eturn name;
} |
10737956_21 | public void init() throws InternalServiceException {
sensorPluginLoader = ServiceLoader.load(SensorInstanceFactory.class);
if (isMissingRepository()) {
throw new IllegalStateException("SensorInstanceProvider misses a repository.");
}
Iterable<SensorConfiguration> configs = sensorConfigurationRep... |
10741477_39 | public final SortedSet<Long> getTimestamps() {
SortedSet<Long> result = new TreeSet<>(bucketList.keySet());
return result;
} |
10746583_101 | public static RoaringBitmap xor(RoaringBitmap... bitmaps) {
return groupByKey(bitmaps)
.entrySet()
.parallelStream()
.collect(XOR);
} |
10761704_2 | public static Matcher<DateTime> onDayOfMonth(Matcher<Integer> dayMatcher)
{
return new DayOfMonthMatcher(dayMatcher);
} |
10762348_1 | @NotNull
@Override
public Set<Entry<K, V>> entrySet() {
return new EntrySet();
} |
10772221_0 | @Deprecated
public static void export(Module module, List<Class<?>> classesToConvert) {
new StaticFieldExporter(module, null).export(classesToConvert);
} |
10785687_16 | public boolean isSimpleNumber() {
return isSimpleNumber;
} |
10806441_91 | public boolean isHotReloadMode() {
return hotReloadMode;
} |
10820374_12 | public Result getMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress,
@Attribute("userId") @DbId final Long userId, final Context context)
{
return performAction(userId, mailboxAddress, context, mailbox -> {
final MailboxData mailboxData = new MailboxData(mailbox... |
10828921_31 | @Override
public Optional<String> getRequestApiClientHostname() {
return Optional.ofNullable(this.requestApiClientHostname);
} |
10837431_9 | public int getPlace_id() {
return place_id;
} |
10856630_69 | public void addTemplateRootDir(File file) {
templateRootDirs.add(file);
} |
10866521_11 | public PropertyStore ff4jStore() {
if (ff4jStore == null) {
throw new IllegalStateException("Cannot load property from store as not initialized please set 'ff4jStore' property");
}
return getFf4jStore();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.