repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
JadiraOrg/jadira | cloning/src/main/java/org/jadira/reflection/access/unsafe/UnsafeOperations.java | UnsafeOperations.deepCopyArrayField | public final void deepCopyArrayField(Object obj, Object copy, Field field, IdentityHashMap<Object, Object> referencesToReuse) {
"""
Copies the array of the specified type from the given field in the source object
to the same field in the copy, visiting the array during the copy so that its contents are also copied
@param obj The object to copy from
@param copy The target object
@param field Field to be copied
@param referencesToReuse An identity map of references to reuse - this is further populated as the copy progresses.
The key is the original object reference - the value is the copied instance for that original.
"""
deepCopyArrayAtOffset(obj, copy, field.getType(), getObjectFieldOffset(field), referencesToReuse);
} | java | public final void deepCopyArrayField(Object obj, Object copy, Field field, IdentityHashMap<Object, Object> referencesToReuse) {
deepCopyArrayAtOffset(obj, copy, field.getType(), getObjectFieldOffset(field), referencesToReuse);
} | [
"public",
"final",
"void",
"deepCopyArrayField",
"(",
"Object",
"obj",
",",
"Object",
"copy",
",",
"Field",
"field",
",",
"IdentityHashMap",
"<",
"Object",
",",
"Object",
">",
"referencesToReuse",
")",
"{",
"deepCopyArrayAtOffset",
"(",
"obj",
",",
"copy",
","... | Copies the array of the specified type from the given field in the source object
to the same field in the copy, visiting the array during the copy so that its contents are also copied
@param obj The object to copy from
@param copy The target object
@param field Field to be copied
@param referencesToReuse An identity map of references to reuse - this is further populated as the copy progresses.
The key is the original object reference - the value is the copied instance for that original. | [
"Copies",
"the",
"array",
"of",
"the",
"specified",
"type",
"from",
"the",
"given",
"field",
"in",
"the",
"source",
"object",
"to",
"the",
"same",
"field",
"in",
"the",
"copy",
"visiting",
"the",
"array",
"during",
"the",
"copy",
"so",
"that",
"its",
"co... | train | https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/cloning/src/main/java/org/jadira/reflection/access/unsafe/UnsafeOperations.java#L491-L494 |
jfinal/jfinal | src/main/java/com/jfinal/plugin/activerecord/Model.java | Model.findFirstByCache | public M findFirstByCache(String cacheName, Object key, String sql, Object... paras) {
"""
Find first model by cache. I recommend add "limit 1" in your sql.
@see #findFirst(String, Object...)
@param cacheName the cache name
@param key the key used to get data from cache
@param sql an SQL statement that may contain one or more '?' IN parameter placeholders
@param paras the parameters of sql
"""
ICache cache = _getConfig().getCache();
M result = cache.get(cacheName, key);
if (result == null) {
result = findFirst(sql, paras);
cache.put(cacheName, key, result);
}
return result;
} | java | public M findFirstByCache(String cacheName, Object key, String sql, Object... paras) {
ICache cache = _getConfig().getCache();
M result = cache.get(cacheName, key);
if (result == null) {
result = findFirst(sql, paras);
cache.put(cacheName, key, result);
}
return result;
} | [
"public",
"M",
"findFirstByCache",
"(",
"String",
"cacheName",
",",
"Object",
"key",
",",
"String",
"sql",
",",
"Object",
"...",
"paras",
")",
"{",
"ICache",
"cache",
"=",
"_getConfig",
"(",
")",
".",
"getCache",
"(",
")",
";",
"M",
"result",
"=",
"cac... | Find first model by cache. I recommend add "limit 1" in your sql.
@see #findFirst(String, Object...)
@param cacheName the cache name
@param key the key used to get data from cache
@param sql an SQL statement that may contain one or more '?' IN parameter placeholders
@param paras the parameters of sql | [
"Find",
"first",
"model",
"by",
"cache",
".",
"I",
"recommend",
"add",
"limit",
"1",
"in",
"your",
"sql",
"."
] | train | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/Model.java#L967-L975 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java | TrainingsImpl.deleteTagAsync | public Observable<Void> deleteTagAsync(UUID projectId, UUID tagId) {
"""
Delete a tag from the project.
@param projectId The project id
@param tagId Id of the tag to be deleted
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful.
"""
return deleteTagWithServiceResponseAsync(projectId, tagId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> deleteTagAsync(UUID projectId, UUID tagId) {
return deleteTagWithServiceResponseAsync(projectId, tagId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"deleteTagAsync",
"(",
"UUID",
"projectId",
",",
"UUID",
"tagId",
")",
"{",
"return",
"deleteTagWithServiceResponseAsync",
"(",
"projectId",
",",
"tagId",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"... | Delete a tag from the project.
@param projectId The project id
@param tagId Id of the tag to be deleted
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Delete",
"a",
"tag",
"from",
"the",
"project",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L717-L724 |
alkacon/opencms-core | src/org/opencms/ui/apps/user/CmsImportExportUserDialog.java | CmsImportExportUserDialog.getExportUserDialogForGroup | public static CmsImportExportUserDialog getExportUserDialogForGroup(
CmsUUID groupID,
String ou,
Window window,
boolean allowTechnicalFieldsExport) {
"""
Gets an dialog instance for fixed group.<p>
@param groupID id
@param ou ou name
@param window window
@param allowTechnicalFieldsExport flag indicates if technical field export option should be available
@return an instance of this class
"""
CmsImportExportUserDialog res = new CmsImportExportUserDialog(ou, groupID, window, allowTechnicalFieldsExport);
return res;
} | java | public static CmsImportExportUserDialog getExportUserDialogForGroup(
CmsUUID groupID,
String ou,
Window window,
boolean allowTechnicalFieldsExport) {
CmsImportExportUserDialog res = new CmsImportExportUserDialog(ou, groupID, window, allowTechnicalFieldsExport);
return res;
} | [
"public",
"static",
"CmsImportExportUserDialog",
"getExportUserDialogForGroup",
"(",
"CmsUUID",
"groupID",
",",
"String",
"ou",
",",
"Window",
"window",
",",
"boolean",
"allowTechnicalFieldsExport",
")",
"{",
"CmsImportExportUserDialog",
"res",
"=",
"new",
"CmsImportExpor... | Gets an dialog instance for fixed group.<p>
@param groupID id
@param ou ou name
@param window window
@param allowTechnicalFieldsExport flag indicates if technical field export option should be available
@return an instance of this class | [
"Gets",
"an",
"dialog",
"instance",
"for",
"fixed",
"group",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsImportExportUserDialog.java#L453-L461 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/ResourceManager.java | ResourceManager.closeJobManagerConnection | protected void closeJobManagerConnection(JobID jobId, Exception cause) {
"""
This method should be called by the framework once it detects that a currently registered
job manager has failed.
@param jobId identifying the job whose leader shall be disconnected.
@param cause The exception which cause the JobManager failed.
"""
JobManagerRegistration jobManagerRegistration = jobManagerRegistrations.remove(jobId);
if (jobManagerRegistration != null) {
final ResourceID jobManagerResourceId = jobManagerRegistration.getJobManagerResourceID();
final JobMasterGateway jobMasterGateway = jobManagerRegistration.getJobManagerGateway();
final JobMasterId jobMasterId = jobManagerRegistration.getJobMasterId();
log.info("Disconnect job manager {}@{} for job {} from the resource manager.",
jobMasterId,
jobMasterGateway.getAddress(),
jobId);
jobManagerHeartbeatManager.unmonitorTarget(jobManagerResourceId);
jmResourceIdRegistrations.remove(jobManagerResourceId);
// tell the job manager about the disconnect
jobMasterGateway.disconnectResourceManager(getFencingToken(), cause);
} else {
log.debug("There was no registered job manager for job {}.", jobId);
}
} | java | protected void closeJobManagerConnection(JobID jobId, Exception cause) {
JobManagerRegistration jobManagerRegistration = jobManagerRegistrations.remove(jobId);
if (jobManagerRegistration != null) {
final ResourceID jobManagerResourceId = jobManagerRegistration.getJobManagerResourceID();
final JobMasterGateway jobMasterGateway = jobManagerRegistration.getJobManagerGateway();
final JobMasterId jobMasterId = jobManagerRegistration.getJobMasterId();
log.info("Disconnect job manager {}@{} for job {} from the resource manager.",
jobMasterId,
jobMasterGateway.getAddress(),
jobId);
jobManagerHeartbeatManager.unmonitorTarget(jobManagerResourceId);
jmResourceIdRegistrations.remove(jobManagerResourceId);
// tell the job manager about the disconnect
jobMasterGateway.disconnectResourceManager(getFencingToken(), cause);
} else {
log.debug("There was no registered job manager for job {}.", jobId);
}
} | [
"protected",
"void",
"closeJobManagerConnection",
"(",
"JobID",
"jobId",
",",
"Exception",
"cause",
")",
"{",
"JobManagerRegistration",
"jobManagerRegistration",
"=",
"jobManagerRegistrations",
".",
"remove",
"(",
"jobId",
")",
";",
"if",
"(",
"jobManagerRegistration",
... | This method should be called by the framework once it detects that a currently registered
job manager has failed.
@param jobId identifying the job whose leader shall be disconnected.
@param cause The exception which cause the JobManager failed. | [
"This",
"method",
"should",
"be",
"called",
"by",
"the",
"framework",
"once",
"it",
"detects",
"that",
"a",
"currently",
"registered",
"job",
"manager",
"has",
"failed",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/ResourceManager.java#L763-L785 |
walkmod/walkmod-core | src/main/java/org/walkmod/WalkModFacade.java | WalkModFacade.removeModules | public void removeModules(List<String> modules) throws Exception {
"""
Removes the module list from the configuration file
@param modules
Module names to remove
@throws Exception
if the walkmod configuration file can't be read.
"""
long startTime = System.currentTimeMillis();
Exception exception = null;
if (!cfg.exists()) {
init();
}
userDir = new File(System.getProperty("user.dir")).getAbsolutePath();
System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath());
try {
ConfigurationManager manager = new ConfigurationManager(cfg, false);
ProjectConfigurationProvider cfgProvider = manager.getProjectConfigurationProvider();
cfgProvider.removeModules(modules);
} catch (Exception e) {
exception = e;
} finally {
System.setProperty("user.dir", userDir);
updateMsg(startTime, exception);
}
} | java | public void removeModules(List<String> modules) throws Exception {
long startTime = System.currentTimeMillis();
Exception exception = null;
if (!cfg.exists()) {
init();
}
userDir = new File(System.getProperty("user.dir")).getAbsolutePath();
System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath());
try {
ConfigurationManager manager = new ConfigurationManager(cfg, false);
ProjectConfigurationProvider cfgProvider = manager.getProjectConfigurationProvider();
cfgProvider.removeModules(modules);
} catch (Exception e) {
exception = e;
} finally {
System.setProperty("user.dir", userDir);
updateMsg(startTime, exception);
}
} | [
"public",
"void",
"removeModules",
"(",
"List",
"<",
"String",
">",
"modules",
")",
"throws",
"Exception",
"{",
"long",
"startTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"Exception",
"exception",
"=",
"null",
";",
"if",
"(",
"!",
"cfg",
... | Removes the module list from the configuration file
@param modules
Module names to remove
@throws Exception
if the walkmod configuration file can't be read. | [
"Removes",
"the",
"module",
"list",
"from",
"the",
"configuration",
"file"
] | train | https://github.com/walkmod/walkmod-core/blob/fa79b836894fa00ca4b3e2bd26326a44b778f46f/src/main/java/org/walkmod/WalkModFacade.java#L870-L889 |
lessthanoptimal/ddogleg | src/org/ddogleg/solver/PolynomialSolver.java | PolynomialSolver.createRootFinder | public static PolynomialRoots createRootFinder( RootFinderType type , int maxDegree ) {
"""
Creates a generic polynomial root finding class which will return all real or all real and complex roots
depending on the algorithm selected.
@param type Which algorithm is to be returned.
@param maxDegree Maximum degree of the polynomial being considered.
@return Root finding algorithm.
"""
switch ( type ) {
case EVD:
return new RootFinderCompanion();
case STURM:
FindRealRootsSturm sturm = new FindRealRootsSturm(maxDegree,-1,1e-10,30,20);
return new WrapRealRootsSturm(sturm);
}
throw new IllegalArgumentException("Unknown type");
} | java | public static PolynomialRoots createRootFinder( RootFinderType type , int maxDegree ) {
switch ( type ) {
case EVD:
return new RootFinderCompanion();
case STURM:
FindRealRootsSturm sturm = new FindRealRootsSturm(maxDegree,-1,1e-10,30,20);
return new WrapRealRootsSturm(sturm);
}
throw new IllegalArgumentException("Unknown type");
} | [
"public",
"static",
"PolynomialRoots",
"createRootFinder",
"(",
"RootFinderType",
"type",
",",
"int",
"maxDegree",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"EVD",
":",
"return",
"new",
"RootFinderCompanion",
"(",
")",
";",
"case",
"STURM",
":",
"Fi... | Creates a generic polynomial root finding class which will return all real or all real and complex roots
depending on the algorithm selected.
@param type Which algorithm is to be returned.
@param maxDegree Maximum degree of the polynomial being considered.
@return Root finding algorithm. | [
"Creates",
"a",
"generic",
"polynomial",
"root",
"finding",
"class",
"which",
"will",
"return",
"all",
"real",
"or",
"all",
"real",
"and",
"complex",
"roots",
"depending",
"on",
"the",
"algorithm",
"selected",
"."
] | train | https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/solver/PolynomialSolver.java#L44-L55 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/util/JvmShutdownSafeguard.java | JvmShutdownSafeguard.installAsShutdownHook | public static void installAsShutdownHook(Logger logger, long delayMillis) {
"""
Installs the safeguard shutdown hook. The maximum time that the JVM is allowed to spend
on shutdown before being killed is the given number of milliseconds.
@param logger The logger to log errors to.
@param delayMillis The delay (in milliseconds) to wait after clean shutdown was stared,
before forcibly terminating the JVM.
"""
checkArgument(delayMillis >= 0, "delay must be >= 0");
// install the blocking shutdown hook
Thread shutdownHook = new JvmShutdownSafeguard(delayMillis);
ShutdownHookUtil.addShutdownHookThread(shutdownHook, JvmShutdownSafeguard.class.getSimpleName(), logger);
} | java | public static void installAsShutdownHook(Logger logger, long delayMillis) {
checkArgument(delayMillis >= 0, "delay must be >= 0");
// install the blocking shutdown hook
Thread shutdownHook = new JvmShutdownSafeguard(delayMillis);
ShutdownHookUtil.addShutdownHookThread(shutdownHook, JvmShutdownSafeguard.class.getSimpleName(), logger);
} | [
"public",
"static",
"void",
"installAsShutdownHook",
"(",
"Logger",
"logger",
",",
"long",
"delayMillis",
")",
"{",
"checkArgument",
"(",
"delayMillis",
">=",
"0",
",",
"\"delay must be >= 0\"",
")",
";",
"// install the blocking shutdown hook",
"Thread",
"shutdownHook"... | Installs the safeguard shutdown hook. The maximum time that the JVM is allowed to spend
on shutdown before being killed is the given number of milliseconds.
@param logger The logger to log errors to.
@param delayMillis The delay (in milliseconds) to wait after clean shutdown was stared,
before forcibly terminating the JVM. | [
"Installs",
"the",
"safeguard",
"shutdown",
"hook",
".",
"The",
"maximum",
"time",
"that",
"the",
"JVM",
"is",
"allowed",
"to",
"spend",
"on",
"shutdown",
"before",
"being",
"killed",
"is",
"the",
"given",
"number",
"of",
"milliseconds",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/util/JvmShutdownSafeguard.java#L112-L118 |
f2prateek/dart | dart/src/main/java/dart/Dart.java | Dart.bindNavigationModel | public static void bindNavigationModel(Object target, Activity source) {
"""
Inject fields annotated with {@link BindExtra} in the specified {@code target} using the {@code
source} {@link android.app.Activity}.
@param target Target class for field binding.
@param source Activity on which IDs will be looked up.
@throws Dart.UnableToInjectException if binding could not be performed.
@see android.content.Intent#getExtras()
"""
bindNavigationModel(target, source, Finder.ACTIVITY);
} | java | public static void bindNavigationModel(Object target, Activity source) {
bindNavigationModel(target, source, Finder.ACTIVITY);
} | [
"public",
"static",
"void",
"bindNavigationModel",
"(",
"Object",
"target",
",",
"Activity",
"source",
")",
"{",
"bindNavigationModel",
"(",
"target",
",",
"source",
",",
"Finder",
".",
"ACTIVITY",
")",
";",
"}"
] | Inject fields annotated with {@link BindExtra} in the specified {@code target} using the {@code
source} {@link android.app.Activity}.
@param target Target class for field binding.
@param source Activity on which IDs will be looked up.
@throws Dart.UnableToInjectException if binding could not be performed.
@see android.content.Intent#getExtras() | [
"Inject",
"fields",
"annotated",
"with",
"{",
"@link",
"BindExtra",
"}",
"in",
"the",
"specified",
"{",
"@code",
"target",
"}",
"using",
"the",
"{",
"@code",
"source",
"}",
"{",
"@link",
"android",
".",
"app",
".",
"Activity",
"}",
"."
] | train | https://github.com/f2prateek/dart/blob/7163b1b148e5141817975ae7dad99d58a8589aeb/dart/src/main/java/dart/Dart.java#L92-L94 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.ip_mitigation_POST | public OvhMitigationIp ip_mitigation_POST(String ip, String ipOnMitigation) throws IOException {
"""
AntiDDOS option. Add new IP on permanent mitigation
REST: POST /ip/{ip}/mitigation
@param ipOnMitigation [required]
@param ip [required]
"""
String qPath = "/ip/{ip}/mitigation";
StringBuilder sb = path(qPath, ip);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "ipOnMitigation", ipOnMitigation);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhMitigationIp.class);
} | java | public OvhMitigationIp ip_mitigation_POST(String ip, String ipOnMitigation) throws IOException {
String qPath = "/ip/{ip}/mitigation";
StringBuilder sb = path(qPath, ip);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "ipOnMitigation", ipOnMitigation);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhMitigationIp.class);
} | [
"public",
"OvhMitigationIp",
"ip_mitigation_POST",
"(",
"String",
"ip",
",",
"String",
"ipOnMitigation",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/{ip}/mitigation\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"ip",
")",
... | AntiDDOS option. Add new IP on permanent mitigation
REST: POST /ip/{ip}/mitigation
@param ipOnMitigation [required]
@param ip [required] | [
"AntiDDOS",
"option",
".",
"Add",
"new",
"IP",
"on",
"permanent",
"mitigation"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L795-L802 |
operasoftware/operaprestodriver | src/com/opera/core/systems/OperaDesktopDriver.java | OperaDesktopDriver.findWidgetByPosition | public QuickWidget findWidgetByPosition(QuickWidgetType type, int windowId, int row, int column) {
"""
Finds widget by specified position. Used for widgets that have a position only, e.g.
treeviewitems and tabs.
@param windowId id of parent window
@param row row of widget within its parent
@param column column of widget within its parent
@return QuickWidget matching, or null if no matching widget is found
"""
return desktopWindowManager.getQuickWidgetByPos(type, windowId, row, column);
} | java | public QuickWidget findWidgetByPosition(QuickWidgetType type, int windowId, int row, int column) {
return desktopWindowManager.getQuickWidgetByPos(type, windowId, row, column);
} | [
"public",
"QuickWidget",
"findWidgetByPosition",
"(",
"QuickWidgetType",
"type",
",",
"int",
"windowId",
",",
"int",
"row",
",",
"int",
"column",
")",
"{",
"return",
"desktopWindowManager",
".",
"getQuickWidgetByPos",
"(",
"type",
",",
"windowId",
",",
"row",
",... | Finds widget by specified position. Used for widgets that have a position only, e.g.
treeviewitems and tabs.
@param windowId id of parent window
@param row row of widget within its parent
@param column column of widget within its parent
@return QuickWidget matching, or null if no matching widget is found | [
"Finds",
"widget",
"by",
"specified",
"position",
".",
"Used",
"for",
"widgets",
"that",
"have",
"a",
"position",
"only",
"e",
".",
"g",
".",
"treeviewitems",
"and",
"tabs",
"."
] | train | https://github.com/operasoftware/operaprestodriver/blob/1ccceda80f1c1a0489171d17dcaa6e7b18fb4c01/src/com/opera/core/systems/OperaDesktopDriver.java#L408-L410 |
io7m/jregions | com.io7m.jregions.generators/src/main/java/com/io7m/jregions/generators/PAreaSizeBDGenerator.java | PAreaSizeBDGenerator.create | public static <S> PAreaSizeBDGenerator<S> create() {
"""
@param <S> A phantom type parameter indicating the coordinate space of the
area
@return A generator initialized with useful defaults
"""
final LongGenerator gen = new LongGenerator(0L, Long.MAX_VALUE);
return new PAreaSizeBDGenerator<>(() -> new BigDecimal(gen.next().toString()));
} | java | public static <S> PAreaSizeBDGenerator<S> create()
{
final LongGenerator gen = new LongGenerator(0L, Long.MAX_VALUE);
return new PAreaSizeBDGenerator<>(() -> new BigDecimal(gen.next().toString()));
} | [
"public",
"static",
"<",
"S",
">",
"PAreaSizeBDGenerator",
"<",
"S",
">",
"create",
"(",
")",
"{",
"final",
"LongGenerator",
"gen",
"=",
"new",
"LongGenerator",
"(",
"0L",
",",
"Long",
".",
"MAX_VALUE",
")",
";",
"return",
"new",
"PAreaSizeBDGenerator",
"<... | @param <S> A phantom type parameter indicating the coordinate space of the
area
@return A generator initialized with useful defaults | [
"@param",
"<S",
">",
"A",
"phantom",
"type",
"parameter",
"indicating",
"the",
"coordinate",
"space",
"of",
"the",
"area"
] | train | https://github.com/io7m/jregions/blob/ae03850b5fa2a5fcbd8788953fba7897d4a88d7c/com.io7m.jregions.generators/src/main/java/com/io7m/jregions/generators/PAreaSizeBDGenerator.java#L56-L60 |
pravega/pravega | controller/src/main/java/io/pravega/controller/metrics/StreamMetrics.java | StreamMetrics.createStreamFailed | public void createStreamFailed(String scope, String streamName) {
"""
This method increments the global counter of failed Stream creations in the system as well as the failed creation
attempts for this specific Stream.
@param scope Scope.
@param streamName Name of the Stream.
"""
DYNAMIC_LOGGER.incCounterValue(globalMetricName(CREATE_STREAM_FAILED), 1);
DYNAMIC_LOGGER.incCounterValue(CREATE_STREAM_FAILED, 1, streamTags(scope, streamName));
} | java | public void createStreamFailed(String scope, String streamName) {
DYNAMIC_LOGGER.incCounterValue(globalMetricName(CREATE_STREAM_FAILED), 1);
DYNAMIC_LOGGER.incCounterValue(CREATE_STREAM_FAILED, 1, streamTags(scope, streamName));
} | [
"public",
"void",
"createStreamFailed",
"(",
"String",
"scope",
",",
"String",
"streamName",
")",
"{",
"DYNAMIC_LOGGER",
".",
"incCounterValue",
"(",
"globalMetricName",
"(",
"CREATE_STREAM_FAILED",
")",
",",
"1",
")",
";",
"DYNAMIC_LOGGER",
".",
"incCounterValue",
... | This method increments the global counter of failed Stream creations in the system as well as the failed creation
attempts for this specific Stream.
@param scope Scope.
@param streamName Name of the Stream. | [
"This",
"method",
"increments",
"the",
"global",
"counter",
"of",
"failed",
"Stream",
"creations",
"in",
"the",
"system",
"as",
"well",
"as",
"the",
"failed",
"creation",
"attempts",
"for",
"this",
"specific",
"Stream",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/metrics/StreamMetrics.java#L75-L78 |
apereo/cas | support/cas-server-support-saml-core-api/src/main/java/org/apereo/cas/support/saml/util/AbstractSaml20ObjectBuilder.java | AbstractSaml20ObjectBuilder.newSubject | public Subject newSubject(final String nameIdFormat, final String nameIdValue,
final String recipient, final ZonedDateTime notOnOrAfter,
final String inResponseTo, final ZonedDateTime notBefore) {
"""
New subject subject.
@param nameIdFormat the name id format
@param nameIdValue the name id value
@param recipient the recipient
@param notOnOrAfter the not on or after
@param inResponseTo the in response to
@param notBefore the not before
@return the subject
"""
val nameID = getNameID(nameIdFormat, nameIdValue);
return newSubject(nameID, null, recipient, notOnOrAfter, inResponseTo, notBefore);
} | java | public Subject newSubject(final String nameIdFormat, final String nameIdValue,
final String recipient, final ZonedDateTime notOnOrAfter,
final String inResponseTo, final ZonedDateTime notBefore) {
val nameID = getNameID(nameIdFormat, nameIdValue);
return newSubject(nameID, null, recipient, notOnOrAfter, inResponseTo, notBefore);
} | [
"public",
"Subject",
"newSubject",
"(",
"final",
"String",
"nameIdFormat",
",",
"final",
"String",
"nameIdValue",
",",
"final",
"String",
"recipient",
",",
"final",
"ZonedDateTime",
"notOnOrAfter",
",",
"final",
"String",
"inResponseTo",
",",
"final",
"ZonedDateTime... | New subject subject.
@param nameIdFormat the name id format
@param nameIdValue the name id value
@param recipient the recipient
@param notOnOrAfter the not on or after
@param inResponseTo the in response to
@param notBefore the not before
@return the subject | [
"New",
"subject",
"subject",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-core-api/src/main/java/org/apereo/cas/support/saml/util/AbstractSaml20ObjectBuilder.java#L410-L415 |
ontop/ontop | core/model/src/main/java/it/unibz/inf/ontop/substitution/impl/UnifierUtilities.java | UnifierUtilities.getMGU | public Substitution getMGU(Function first, Function second) {
"""
Computes the Most General Unifier (MGU) for two n-ary atoms.
<p/>
IMPORTANT: Function terms are supported as long as they are not nested.
<p/>
IMPORTANT: handling of AnonymousVariables is questionable --
much is left to UnifierUtilities.apply (and only one version handles them)
@param first
@param second
@return the substitution corresponding to this unification.
"""
SubstitutionImpl mgu = new SubstitutionImpl(termFactory);
if (mgu.composeFunctions(first, second))
return mgu;
return null;
} | java | public Substitution getMGU(Function first, Function second) {
SubstitutionImpl mgu = new SubstitutionImpl(termFactory);
if (mgu.composeFunctions(first, second))
return mgu;
return null;
} | [
"public",
"Substitution",
"getMGU",
"(",
"Function",
"first",
",",
"Function",
"second",
")",
"{",
"SubstitutionImpl",
"mgu",
"=",
"new",
"SubstitutionImpl",
"(",
"termFactory",
")",
";",
"if",
"(",
"mgu",
".",
"composeFunctions",
"(",
"first",
",",
"second",
... | Computes the Most General Unifier (MGU) for two n-ary atoms.
<p/>
IMPORTANT: Function terms are supported as long as they are not nested.
<p/>
IMPORTANT: handling of AnonymousVariables is questionable --
much is left to UnifierUtilities.apply (and only one version handles them)
@param first
@param second
@return the substitution corresponding to this unification. | [
"Computes",
"the",
"Most",
"General",
"Unifier",
"(",
"MGU",
")",
"for",
"two",
"n",
"-",
"ary",
"atoms",
".",
"<p",
"/",
">",
"IMPORTANT",
":",
"Function",
"terms",
"are",
"supported",
"as",
"long",
"as",
"they",
"are",
"not",
"nested",
".",
"<p",
"... | train | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/core/model/src/main/java/it/unibz/inf/ontop/substitution/impl/UnifierUtilities.java#L72-L77 |
pryzach/midao | midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/MappingUtils.java | MappingUtils.objectAssignableTo | public static boolean objectAssignableTo(Object object, String className) throws MjdbcException {
"""
Checks if instance can be cast to specified Class
@param object Instance which would be checked
@param className Class name with which it would be checked
@return true if Instance can be cast to specified class
@throws org.midao.jdbc.core.exception.MjdbcException
"""
AssertUtils.assertNotNull(object);
boolean result = false;
Class clazz = null;
try {
clazz = Class.forName(className);
} catch (ClassNotFoundException ex) {
throw new MjdbcException(ex);
}
result = clazz.isAssignableFrom(object.getClass());
return result;
} | java | public static boolean objectAssignableTo(Object object, String className) throws MjdbcException {
AssertUtils.assertNotNull(object);
boolean result = false;
Class clazz = null;
try {
clazz = Class.forName(className);
} catch (ClassNotFoundException ex) {
throw new MjdbcException(ex);
}
result = clazz.isAssignableFrom(object.getClass());
return result;
} | [
"public",
"static",
"boolean",
"objectAssignableTo",
"(",
"Object",
"object",
",",
"String",
"className",
")",
"throws",
"MjdbcException",
"{",
"AssertUtils",
".",
"assertNotNull",
"(",
"object",
")",
";",
"boolean",
"result",
"=",
"false",
";",
"Class",
"clazz"... | Checks if instance can be cast to specified Class
@param object Instance which would be checked
@param className Class name with which it would be checked
@return true if Instance can be cast to specified class
@throws org.midao.jdbc.core.exception.MjdbcException | [
"Checks",
"if",
"instance",
"can",
"be",
"cast",
"to",
"specified",
"Class"
] | train | https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/MappingUtils.java#L400-L415 |
apache/incubator-heron | heron/api/src/java/org/apache/heron/api/topology/TopologyBuilder.java | TopologyBuilder.setBolt | public BoltDeclarer setBolt(String id, IWindowedBolt bolt, Number parallelismHint) throws
IllegalArgumentException {
"""
Define a new bolt in this topology. This defines a windowed bolt, intended
for windowing operations. The {@link IWindowedBolt#execute(TupleWindow)} method
is triggered for each window interval with the list of current events in the window.
@param id the id of this component. This id is referenced by other components that want to
consume this bolt's outputs.
@param bolt the windowed bolt
@param parallelismHint the number of tasks that should be assigned to execute this bolt.
Each task will run on a thread in a process somwehere around the cluster.
@return use the returned object to declare the inputs to this component
@throws IllegalArgumentException if {@code parallelismHint} is not positive
"""
return setBolt(id, new WindowedBoltExecutor(bolt), parallelismHint);
} | java | public BoltDeclarer setBolt(String id, IWindowedBolt bolt, Number parallelismHint) throws
IllegalArgumentException {
return setBolt(id, new WindowedBoltExecutor(bolt), parallelismHint);
} | [
"public",
"BoltDeclarer",
"setBolt",
"(",
"String",
"id",
",",
"IWindowedBolt",
"bolt",
",",
"Number",
"parallelismHint",
")",
"throws",
"IllegalArgumentException",
"{",
"return",
"setBolt",
"(",
"id",
",",
"new",
"WindowedBoltExecutor",
"(",
"bolt",
")",
",",
"... | Define a new bolt in this topology. This defines a windowed bolt, intended
for windowing operations. The {@link IWindowedBolt#execute(TupleWindow)} method
is triggered for each window interval with the list of current events in the window.
@param id the id of this component. This id is referenced by other components that want to
consume this bolt's outputs.
@param bolt the windowed bolt
@param parallelismHint the number of tasks that should be assigned to execute this bolt.
Each task will run on a thread in a process somwehere around the cluster.
@return use the returned object to declare the inputs to this component
@throws IllegalArgumentException if {@code parallelismHint} is not positive | [
"Define",
"a",
"new",
"bolt",
"in",
"this",
"topology",
".",
"This",
"defines",
"a",
"windowed",
"bolt",
"intended",
"for",
"windowing",
"operations",
".",
"The",
"{",
"@link",
"IWindowedBolt#execute",
"(",
"TupleWindow",
")",
"}",
"method",
"is",
"triggered",... | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/api/src/java/org/apache/heron/api/topology/TopologyBuilder.java#L191-L194 |
unbescape/unbescape | src/main/java/org/unbescape/properties/PropertiesEscape.java | PropertiesEscape.escapePropertiesKey | public static void escapePropertiesKey(final Reader reader, final Writer writer)
throws IOException {
"""
<p>
Perform a Java Properties Key level 2 (basic set and all non-ASCII chars) <strong>escape</strong> operation
on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>.
</p>
<p>
<em>Level 2</em> means this method will escape:
</p>
<ul>
<li>The Java Properties Key basic escape set:
<ul>
<li>The <em>Single Escape Characters</em>:
<tt>\t</tt> (<tt>U+0009</tt>),
<tt>\n</tt> (<tt>U+000A</tt>),
<tt>\f</tt> (<tt>U+000C</tt>),
<tt>\r</tt> (<tt>U+000D</tt>),
<tt>\ </tt> (<tt>U+0020</tt>),
<tt>\:</tt> (<tt>U+003A</tt>),
<tt>\=</tt> (<tt>U+003D</tt>) and
<tt>\\</tt> (<tt>U+005C</tt>).
</li>
<li>
Two ranges of non-displayable, control characters (some of which are already part of the
<em>single escape characters</em> list): <tt>U+0000</tt> to <tt>U+001F</tt>
and <tt>U+007F</tt> to <tt>U+009F</tt>.
</li>
</ul>
</li>
<li>All non ASCII characters.</li>
</ul>
<p>
This escape will be performed by using the Single Escape Chars whenever possible. For escaped
characters that do not have an associated SEC, default to <tt>\uFFFF</tt>
Hexadecimal Escapes.
</p>
<p>
This method calls {@link #escapePropertiesKey(Reader, Writer, PropertiesKeyEscapeLevel)}
with the following preconfigured values:
</p>
<ul>
<li><tt>level</tt>:
{@link PropertiesKeyEscapeLevel#LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET}</li>
</ul>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param reader the <tt>Reader</tt> reading the text to be escaped.
@param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@throws IOException if an input/output exception occurs
"""
escapePropertiesKey(reader, writer, PropertiesKeyEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET);
} | java | public static void escapePropertiesKey(final Reader reader, final Writer writer)
throws IOException {
escapePropertiesKey(reader, writer, PropertiesKeyEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET);
} | [
"public",
"static",
"void",
"escapePropertiesKey",
"(",
"final",
"Reader",
"reader",
",",
"final",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"escapePropertiesKey",
"(",
"reader",
",",
"writer",
",",
"PropertiesKeyEscapeLevel",
".",
"LEVEL_2_ALL_NON_ASCII_... | <p>
Perform a Java Properties Key level 2 (basic set and all non-ASCII chars) <strong>escape</strong> operation
on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>.
</p>
<p>
<em>Level 2</em> means this method will escape:
</p>
<ul>
<li>The Java Properties Key basic escape set:
<ul>
<li>The <em>Single Escape Characters</em>:
<tt>\t</tt> (<tt>U+0009</tt>),
<tt>\n</tt> (<tt>U+000A</tt>),
<tt>\f</tt> (<tt>U+000C</tt>),
<tt>\r</tt> (<tt>U+000D</tt>),
<tt>\ </tt> (<tt>U+0020</tt>),
<tt>\:</tt> (<tt>U+003A</tt>),
<tt>\=</tt> (<tt>U+003D</tt>) and
<tt>\\</tt> (<tt>U+005C</tt>).
</li>
<li>
Two ranges of non-displayable, control characters (some of which are already part of the
<em>single escape characters</em> list): <tt>U+0000</tt> to <tt>U+001F</tt>
and <tt>U+007F</tt> to <tt>U+009F</tt>.
</li>
</ul>
</li>
<li>All non ASCII characters.</li>
</ul>
<p>
This escape will be performed by using the Single Escape Chars whenever possible. For escaped
characters that do not have an associated SEC, default to <tt>\uFFFF</tt>
Hexadecimal Escapes.
</p>
<p>
This method calls {@link #escapePropertiesKey(Reader, Writer, PropertiesKeyEscapeLevel)}
with the following preconfigured values:
</p>
<ul>
<li><tt>level</tt>:
{@link PropertiesKeyEscapeLevel#LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET}</li>
</ul>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param reader the <tt>Reader</tt> reading the text to be escaped.
@param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@throws IOException if an input/output exception occurs | [
"<p",
">",
"Perform",
"a",
"Java",
"Properties",
"Key",
"level",
"2",
"(",
"basic",
"set",
"and",
"all",
"non",
"-",
"ASCII",
"chars",
")",
"<strong",
">",
"escape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"Reader<",
"/",
"tt",
">",
... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/properties/PropertiesEscape.java#L1140-L1143 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jndi/src/com/ibm/ws/jndi/internal/JNDIURLEntry.java | JNDIURLEntry.activate | protected void activate(BundleContext context, Map<String, Object> props) {
"""
Registers the JNDI service for the supplied properties as long as the jndiName and value are set
@param context
@param props The properties containing values for <code>"jndiName"</code> and <code>"value"</code>
"""
final String jndiName = (String) props.get("jndiName");
final String urlValue = (String) props.get("value");
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Registering JNDIURLEntry with value " + urlValue + " and JNDI name " + jndiName);
}
if (jndiName == null || jndiName.isEmpty() || urlValue == null || urlValue.isEmpty()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Unable to register JNDIURLEntry with jndiName [" + jndiName + "] and value [" + urlValue + "] because both must be set");
}
return;
}
// Test that the URL is valid
// creating a url should be a protected action
createURL(jndiName, urlValue);
Dictionary<String, Object> propertiesForJndiService = new Hashtable<String, Object>();
propertiesForJndiService.put("osgi.jndi.service.name", jndiName);
propertiesForJndiService.put(Constants.OBJECTCLASS, Reference.class);
Reference ref = new Reference(URL.class.getName(), this.getClass().getName(), null);
ref.add(new RefAddr("JndiURLEntry") {
private static final long serialVersionUID = 5168161341101144689L;
@Override
public Object getContent() {
return urlValue;
}
});
this.serviceRegistration = context.registerService(Reference.class, ref, propertiesForJndiService);
} | java | protected void activate(BundleContext context, Map<String, Object> props) {
final String jndiName = (String) props.get("jndiName");
final String urlValue = (String) props.get("value");
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Registering JNDIURLEntry with value " + urlValue + " and JNDI name " + jndiName);
}
if (jndiName == null || jndiName.isEmpty() || urlValue == null || urlValue.isEmpty()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Unable to register JNDIURLEntry with jndiName [" + jndiName + "] and value [" + urlValue + "] because both must be set");
}
return;
}
// Test that the URL is valid
// creating a url should be a protected action
createURL(jndiName, urlValue);
Dictionary<String, Object> propertiesForJndiService = new Hashtable<String, Object>();
propertiesForJndiService.put("osgi.jndi.service.name", jndiName);
propertiesForJndiService.put(Constants.OBJECTCLASS, Reference.class);
Reference ref = new Reference(URL.class.getName(), this.getClass().getName(), null);
ref.add(new RefAddr("JndiURLEntry") {
private static final long serialVersionUID = 5168161341101144689L;
@Override
public Object getContent() {
return urlValue;
}
});
this.serviceRegistration = context.registerService(Reference.class, ref, propertiesForJndiService);
} | [
"protected",
"void",
"activate",
"(",
"BundleContext",
"context",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"props",
")",
"{",
"final",
"String",
"jndiName",
"=",
"(",
"String",
")",
"props",
".",
"get",
"(",
"\"jndiName\"",
")",
";",
"final",
"Stri... | Registers the JNDI service for the supplied properties as long as the jndiName and value are set
@param context
@param props The properties containing values for <code>"jndiName"</code> and <code>"value"</code> | [
"Registers",
"the",
"JNDI",
"service",
"for",
"the",
"supplied",
"properties",
"as",
"long",
"as",
"the",
"jndiName",
"and",
"value",
"are",
"set"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jndi/src/com/ibm/ws/jndi/internal/JNDIURLEntry.java#L81-L115 |
Activiti/Activiti | activiti-engine/src/main/java/org/activiti/engine/impl/util/json/CDL.java | CDL.toJSONArray | public static JSONArray toJSONArray(JSONArray names, String string) throws JSONException {
"""
Produce a JSONArray of JSONObjects from a comma delimited text string using a supplied JSONArray as the source of element names.
@param names
A JSONArray of strings.
@param string
The comma delimited text.
@return A JSONArray of JSONObjects.
@throws JSONException
"""
return toJSONArray(names, new JSONTokener(string));
} | java | public static JSONArray toJSONArray(JSONArray names, String string) throws JSONException {
return toJSONArray(names, new JSONTokener(string));
} | [
"public",
"static",
"JSONArray",
"toJSONArray",
"(",
"JSONArray",
"names",
",",
"String",
"string",
")",
"throws",
"JSONException",
"{",
"return",
"toJSONArray",
"(",
"names",
",",
"new",
"JSONTokener",
"(",
"string",
")",
")",
";",
"}"
] | Produce a JSONArray of JSONObjects from a comma delimited text string using a supplied JSONArray as the source of element names.
@param names
A JSONArray of strings.
@param string
The comma delimited text.
@return A JSONArray of JSONObjects.
@throws JSONException | [
"Produce",
"a",
"JSONArray",
"of",
"JSONObjects",
"from",
"a",
"comma",
"delimited",
"text",
"string",
"using",
"a",
"supplied",
"JSONArray",
"as",
"the",
"source",
"of",
"element",
"names",
"."
] | train | https://github.com/Activiti/Activiti/blob/82e2b2cd2083b2f734ca0efc7815389c0f2517d9/activiti-engine/src/main/java/org/activiti/engine/impl/util/json/CDL.java#L167-L169 |
jruby/yecht | src/main/org/yecht/DefaultYAMLParser.java | DefaultYAMLParser.yyparse | public Object yyparse (yyInput yyLex, Object yydebug)
throws java.io.IOException {
"""
the generated parser, with debugging messages.
Maintains a dynamic state and value stack.
@param yyLex scanner.
@param yydebug debug message writer implementing <tt>yyDebug</tt>, or <tt>null</tt>.
@return result of the last reduction, if any.
"""
//t this.yydebug = (jay.yydebug.yyDebug)yydebug;
return yyparse(yyLex);
} | java | public Object yyparse (yyInput yyLex, Object yydebug)
throws java.io.IOException {
//t this.yydebug = (jay.yydebug.yyDebug)yydebug;
return yyparse(yyLex);
} | [
"public",
"Object",
"yyparse",
"(",
"yyInput",
"yyLex",
",",
"Object",
"yydebug",
")",
"throws",
"java",
".",
"io",
".",
"IOException",
"{",
"//t this.yydebug = (jay.yydebug.yyDebug)yydebug;",
"return",
"yyparse",
"(",
"yyLex",
")",
";",
"}"
] | the generated parser, with debugging messages.
Maintains a dynamic state and value stack.
@param yyLex scanner.
@param yydebug debug message writer implementing <tt>yyDebug</tt>, or <tt>null</tt>.
@return result of the last reduction, if any. | [
"the",
"generated",
"parser",
"with",
"debugging",
"messages",
".",
"Maintains",
"a",
"dynamic",
"state",
"and",
"value",
"stack",
"."
] | train | https://github.com/jruby/yecht/blob/d745f62de8c10556b8964d78a07d436b65eeb8a9/src/main/org/yecht/DefaultYAMLParser.java#L262-L266 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/cloud/PointCloudUtils.java | PointCloudUtils.statistics | public static void statistics( List<Point3D_F64> cloud , Point3D_F64 mean , Point3D_F64 stdev ) {
"""
Computes the mean and standard deviation of each axis in the point cloud computed in dependently
@param cloud (Input) Cloud
@param mean (Output) mean of each axis
@param stdev (Output) standard deviation of each axis
"""
final int N = cloud.size();
for (int i = 0; i < N; i++) {
Point3D_F64 p = cloud.get(i);
mean.x += p.x / N;
mean.y += p.y / N;
mean.z += p.z / N;
}
for (int i = 0; i < N; i++) {
Point3D_F64 p = cloud.get(i);
double dx = p.x-mean.x;
double dy = p.y-mean.y;
double dz = p.z-mean.z;
stdev.x += dx*dx/N;
stdev.y += dy*dy/N;
stdev.z += dz*dz/N;
}
stdev.x = Math.sqrt(stdev.x);
stdev.y = Math.sqrt(stdev.y);
stdev.z = Math.sqrt(stdev.z);
} | java | public static void statistics( List<Point3D_F64> cloud , Point3D_F64 mean , Point3D_F64 stdev ) {
final int N = cloud.size();
for (int i = 0; i < N; i++) {
Point3D_F64 p = cloud.get(i);
mean.x += p.x / N;
mean.y += p.y / N;
mean.z += p.z / N;
}
for (int i = 0; i < N; i++) {
Point3D_F64 p = cloud.get(i);
double dx = p.x-mean.x;
double dy = p.y-mean.y;
double dz = p.z-mean.z;
stdev.x += dx*dx/N;
stdev.y += dy*dy/N;
stdev.z += dz*dz/N;
}
stdev.x = Math.sqrt(stdev.x);
stdev.y = Math.sqrt(stdev.y);
stdev.z = Math.sqrt(stdev.z);
} | [
"public",
"static",
"void",
"statistics",
"(",
"List",
"<",
"Point3D_F64",
">",
"cloud",
",",
"Point3D_F64",
"mean",
",",
"Point3D_F64",
"stdev",
")",
"{",
"final",
"int",
"N",
"=",
"cloud",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0... | Computes the mean and standard deviation of each axis in the point cloud computed in dependently
@param cloud (Input) Cloud
@param mean (Output) mean of each axis
@param stdev (Output) standard deviation of each axis | [
"Computes",
"the",
"mean",
"and",
"standard",
"deviation",
"of",
"each",
"axis",
"in",
"the",
"point",
"cloud",
"computed",
"in",
"dependently"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/cloud/PointCloudUtils.java#L65-L87 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java | ApiOvhEmailexchange.organizationName_service_exchangeService_mailingList_POST | public OvhTask organizationName_service_exchangeService_mailingList_POST(String organizationName, String exchangeService, OvhMailingListDepartRestrictionEnum departRestriction, String displayName, Boolean hiddenFromGAL, OvhMailingListJoinRestrictionEnum joinRestriction, String mailingListAddress, Long maxReceiveSize, Long maxSendSize, Boolean senderAuthentification) throws IOException {
"""
Add mailing list
REST: POST /email/exchange/{organizationName}/service/{exchangeService}/mailingList
@param senderAuthentification [required] If true sender has to authenticate
@param hiddenFromGAL [required] If true mailing list is hiddend in Global Address List
@param departRestriction [required] Depart restriction policy
@param maxSendSize [required] Maximum send email size in MB
@param joinRestriction [required] Join restriction policy
@param mailingListAddress [required] The mailing list address
@param maxReceiveSize [required] Maximum receive email size in MB
@param displayName [required] Name displayed in Global Access List
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service
"""
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/mailingList";
StringBuilder sb = path(qPath, organizationName, exchangeService);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "departRestriction", departRestriction);
addBody(o, "displayName", displayName);
addBody(o, "hiddenFromGAL", hiddenFromGAL);
addBody(o, "joinRestriction", joinRestriction);
addBody(o, "mailingListAddress", mailingListAddress);
addBody(o, "maxReceiveSize", maxReceiveSize);
addBody(o, "maxSendSize", maxSendSize);
addBody(o, "senderAuthentification", senderAuthentification);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask organizationName_service_exchangeService_mailingList_POST(String organizationName, String exchangeService, OvhMailingListDepartRestrictionEnum departRestriction, String displayName, Boolean hiddenFromGAL, OvhMailingListJoinRestrictionEnum joinRestriction, String mailingListAddress, Long maxReceiveSize, Long maxSendSize, Boolean senderAuthentification) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/mailingList";
StringBuilder sb = path(qPath, organizationName, exchangeService);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "departRestriction", departRestriction);
addBody(o, "displayName", displayName);
addBody(o, "hiddenFromGAL", hiddenFromGAL);
addBody(o, "joinRestriction", joinRestriction);
addBody(o, "mailingListAddress", mailingListAddress);
addBody(o, "maxReceiveSize", maxReceiveSize);
addBody(o, "maxSendSize", maxSendSize);
addBody(o, "senderAuthentification", senderAuthentification);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"organizationName_service_exchangeService_mailingList_POST",
"(",
"String",
"organizationName",
",",
"String",
"exchangeService",
",",
"OvhMailingListDepartRestrictionEnum",
"departRestriction",
",",
"String",
"displayName",
",",
"Boolean",
"hiddenFromGAL",
"... | Add mailing list
REST: POST /email/exchange/{organizationName}/service/{exchangeService}/mailingList
@param senderAuthentification [required] If true sender has to authenticate
@param hiddenFromGAL [required] If true mailing list is hiddend in Global Address List
@param departRestriction [required] Depart restriction policy
@param maxSendSize [required] Maximum send email size in MB
@param joinRestriction [required] Join restriction policy
@param mailingListAddress [required] The mailing list address
@param maxReceiveSize [required] Maximum receive email size in MB
@param displayName [required] Name displayed in Global Access List
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service | [
"Add",
"mailing",
"list"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L1522-L1536 |
btrplace/scheduler | api/src/main/java/org/btrplace/plan/event/Action.java | Action.addEvent | public boolean addEvent(Hook k, Event n) {
"""
Add an event to the action.
The moment the event will be executed depends on its hook.
@param k the hook
@param n the event to attach
@return {@code true} iff the event was added
"""
Set<Event> l = events.get(k);
if (l == null) {
l = new HashSet<>();
events.put(k, l);
}
return l.add(n);
} | java | public boolean addEvent(Hook k, Event n) {
Set<Event> l = events.get(k);
if (l == null) {
l = new HashSet<>();
events.put(k, l);
}
return l.add(n);
} | [
"public",
"boolean",
"addEvent",
"(",
"Hook",
"k",
",",
"Event",
"n",
")",
"{",
"Set",
"<",
"Event",
">",
"l",
"=",
"events",
".",
"get",
"(",
"k",
")",
";",
"if",
"(",
"l",
"==",
"null",
")",
"{",
"l",
"=",
"new",
"HashSet",
"<>",
"(",
")",
... | Add an event to the action.
The moment the event will be executed depends on its hook.
@param k the hook
@param n the event to attach
@return {@code true} iff the event was added | [
"Add",
"an",
"event",
"to",
"the",
"action",
".",
"The",
"moment",
"the",
"event",
"will",
"be",
"executed",
"depends",
"on",
"its",
"hook",
"."
] | train | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/api/src/main/java/org/btrplace/plan/event/Action.java#L151-L158 |
querydsl/querydsl | querydsl-sql/src/main/java/com/querydsl/sql/oracle/AbstractOracleQuery.java | AbstractOracleQuery.connectByNocyclePrior | @WithBridgeMethods(value = OracleQuery.class, castRequired = true)
public C connectByNocyclePrior(Predicate cond) {
"""
CONNECT BY specifies the relationship between parent rows and child rows of the hierarchy.
@param cond condition
@return the current object
"""
return addFlag(Position.BEFORE_ORDER, CONNECT_BY_NOCYCLE_PRIOR, cond);
} | java | @WithBridgeMethods(value = OracleQuery.class, castRequired = true)
public C connectByNocyclePrior(Predicate cond) {
return addFlag(Position.BEFORE_ORDER, CONNECT_BY_NOCYCLE_PRIOR, cond);
} | [
"@",
"WithBridgeMethods",
"(",
"value",
"=",
"OracleQuery",
".",
"class",
",",
"castRequired",
"=",
"true",
")",
"public",
"C",
"connectByNocyclePrior",
"(",
"Predicate",
"cond",
")",
"{",
"return",
"addFlag",
"(",
"Position",
".",
"BEFORE_ORDER",
",",
"CONNEC... | CONNECT BY specifies the relationship between parent rows and child rows of the hierarchy.
@param cond condition
@return the current object | [
"CONNECT",
"BY",
"specifies",
"the",
"relationship",
"between",
"parent",
"rows",
"and",
"child",
"rows",
"of",
"the",
"hierarchy",
"."
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/oracle/AbstractOracleQuery.java#L83-L86 |
morimekta/providence | providence-core/src/main/java-gen/net/morimekta/providence/util/Any.java | Any.wrapMessage | public static <M extends net.morimekta.providence.PMessage<M, F>, F extends net.morimekta.providence.descriptor.PField>
Any wrapMessage(@javax.annotation.Nonnull M message) {
"""
Wrap a message into an <code>Any</code> wrapper message. This
will serialize the message using the default binary serializer.
@param message Wrap this message.
@param <M> The message type
@param <F> The message field type
@return The wrapped message.
"""
return wrapMessage(message, new net.morimekta.providence.serializer.BinarySerializer());
} | java | public static <M extends net.morimekta.providence.PMessage<M, F>, F extends net.morimekta.providence.descriptor.PField>
Any wrapMessage(@javax.annotation.Nonnull M message) {
return wrapMessage(message, new net.morimekta.providence.serializer.BinarySerializer());
} | [
"public",
"static",
"<",
"M",
"extends",
"net",
".",
"morimekta",
".",
"providence",
".",
"PMessage",
"<",
"M",
",",
"F",
">",
",",
"F",
"extends",
"net",
".",
"morimekta",
".",
"providence",
".",
"descriptor",
".",
"PField",
">",
"Any",
"wrapMessage",
... | Wrap a message into an <code>Any</code> wrapper message. This
will serialize the message using the default binary serializer.
@param message Wrap this message.
@param <M> The message type
@param <F> The message field type
@return The wrapped message. | [
"Wrap",
"a",
"message",
"into",
"an",
"<code",
">",
"Any<",
"/",
"code",
">",
"wrapper",
"message",
".",
"This",
"will",
"serialize",
"the",
"message",
"using",
"the",
"default",
"binary",
"serializer",
"."
] | train | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-core/src/main/java-gen/net/morimekta/providence/util/Any.java#L530-L533 |
apache/incubator-gobblin | gobblin-runtime/src/main/java/org/apache/gobblin/runtime/std/FilteredJobLifecycleListener.java | FilteredJobLifecycleListener.onDeleteJob | @Override public void onDeleteJob(URI deletedJobURI, String deletedJobVersion) {
"""
{@inheritDoc}
NOTE: For this callback only conditions on the URI and version will be used.
"""
JobSpec fakeJobSpec = JobSpec.builder(deletedJobURI).withVersion(deletedJobVersion).build();
if (this.filter.apply(fakeJobSpec)) {
this.delegate.onDeleteJob(deletedJobURI, deletedJobVersion);
}
} | java | @Override public void onDeleteJob(URI deletedJobURI, String deletedJobVersion) {
JobSpec fakeJobSpec = JobSpec.builder(deletedJobURI).withVersion(deletedJobVersion).build();
if (this.filter.apply(fakeJobSpec)) {
this.delegate.onDeleteJob(deletedJobURI, deletedJobVersion);
}
} | [
"@",
"Override",
"public",
"void",
"onDeleteJob",
"(",
"URI",
"deletedJobURI",
",",
"String",
"deletedJobVersion",
")",
"{",
"JobSpec",
"fakeJobSpec",
"=",
"JobSpec",
".",
"builder",
"(",
"deletedJobURI",
")",
".",
"withVersion",
"(",
"deletedJobVersion",
")",
"... | {@inheritDoc}
NOTE: For this callback only conditions on the URI and version will be used. | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/std/FilteredJobLifecycleListener.java#L54-L59 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java | WebAppSecurityCollaboratorImpl.checkPrecludedAccess | @Override
public WebReply checkPrecludedAccess(WebRequest webRequest, String uriName) {
"""
Access precluded explicitly specified in the security constraints or
by the usage of the com.ibm.ws.webcontainer.security.checkdefaultmethod attribute.
This attribute is set by the web container in ServletWrapper.startRequest() with the
intent of blocking hackers from crafting an HTTP HEAD method to bypass security constraints.
See PK83258 for full details.
This method also checks for uncovered HTTP methods
"""
WebReply webReply = null;
if (webRequest.isAccessPrecluded()) {
webReply = new DenyReply("Access is precluded because security constraints are specified, but the required roles are empty.");
} else if (MatchResponse.DENY_MATCH_RESPONSE.equals(webRequest.getMatchResponse())) {
webReply = new DenyReply("Http uncovered method found, denying reply.");
} else {
HttpServletRequest req = webRequest.getHttpServletRequest();
List<String> requiredRoles = webRequest.getRequiredRoles();
String defaultMethod = (String) req.getAttribute("com.ibm.ws.webcontainer.security.checkdefaultmethod");
if ("TRACE".equals(defaultMethod) && requiredRoles.isEmpty()) {
webReply = new DenyReply("Illegal request. Default implementation of TRACE not allowed.");
}
}
return webReply;
} | java | @Override
public WebReply checkPrecludedAccess(WebRequest webRequest, String uriName) {
WebReply webReply = null;
if (webRequest.isAccessPrecluded()) {
webReply = new DenyReply("Access is precluded because security constraints are specified, but the required roles are empty.");
} else if (MatchResponse.DENY_MATCH_RESPONSE.equals(webRequest.getMatchResponse())) {
webReply = new DenyReply("Http uncovered method found, denying reply.");
} else {
HttpServletRequest req = webRequest.getHttpServletRequest();
List<String> requiredRoles = webRequest.getRequiredRoles();
String defaultMethod = (String) req.getAttribute("com.ibm.ws.webcontainer.security.checkdefaultmethod");
if ("TRACE".equals(defaultMethod) && requiredRoles.isEmpty()) {
webReply = new DenyReply("Illegal request. Default implementation of TRACE not allowed.");
}
}
return webReply;
} | [
"@",
"Override",
"public",
"WebReply",
"checkPrecludedAccess",
"(",
"WebRequest",
"webRequest",
",",
"String",
"uriName",
")",
"{",
"WebReply",
"webReply",
"=",
"null",
";",
"if",
"(",
"webRequest",
".",
"isAccessPrecluded",
"(",
")",
")",
"{",
"webReply",
"="... | Access precluded explicitly specified in the security constraints or
by the usage of the com.ibm.ws.webcontainer.security.checkdefaultmethod attribute.
This attribute is set by the web container in ServletWrapper.startRequest() with the
intent of blocking hackers from crafting an HTTP HEAD method to bypass security constraints.
See PK83258 for full details.
This method also checks for uncovered HTTP methods | [
"Access",
"precluded",
"explicitly",
"specified",
"in",
"the",
"security",
"constraints",
"or",
"by",
"the",
"usage",
"of",
"the",
"com",
".",
"ibm",
".",
"ws",
".",
"webcontainer",
".",
"security",
".",
"checkdefaultmethod",
"attribute",
".",
"This",
"attribu... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java#L1601-L1618 |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection/src/com/ibm/ws/injectionengine/osgi/internal/ResAutoLinkReferenceFactoryImpl.java | ResAutoLinkReferenceFactoryImpl.getBindingName | public static String getBindingName(String name) {
"""
Determine the binding name that will be used for a reference name. This
implements basically the same algorithm as "default bindings" in traditional WAS.
"""
// For "java:" names, come up with a reasonable binding name by removing
// "java:" and if possible, the scope (e.g., "global") and "env".
if (name.startsWith("java:")) {
int begin = "java:".length();
int index = name.indexOf('/', begin);
if (index != -1) {
begin = index + 1;
}
if (begin + "env/".length() <= name.length() && name.regionMatches(begin, "env/", 0, "env/".length())) {
begin += "env/".length();
}
return name.substring(begin);
}
return name;
} | java | public static String getBindingName(String name) {
// For "java:" names, come up with a reasonable binding name by removing
// "java:" and if possible, the scope (e.g., "global") and "env".
if (name.startsWith("java:")) {
int begin = "java:".length();
int index = name.indexOf('/', begin);
if (index != -1) {
begin = index + 1;
}
if (begin + "env/".length() <= name.length() && name.regionMatches(begin, "env/", 0, "env/".length())) {
begin += "env/".length();
}
return name.substring(begin);
}
return name;
} | [
"public",
"static",
"String",
"getBindingName",
"(",
"String",
"name",
")",
"{",
"// For \"java:\" names, come up with a reasonable binding name by removing",
"// \"java:\" and if possible, the scope (e.g., \"global\") and \"env\".",
"if",
"(",
"name",
".",
"startsWith",
"(",
"\"ja... | Determine the binding name that will be used for a reference name. This
implements basically the same algorithm as "default bindings" in traditional WAS. | [
"Determine",
"the",
"binding",
"name",
"that",
"will",
"be",
"used",
"for",
"a",
"reference",
"name",
".",
"This",
"implements",
"basically",
"the",
"same",
"algorithm",
"as",
"default",
"bindings",
"in",
"traditional",
"WAS",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection/src/com/ibm/ws/injectionengine/osgi/internal/ResAutoLinkReferenceFactoryImpl.java#L65-L84 |
m-m-m/util | resource/src/main/java/net/sf/mmm/util/resource/impl/ClasspathScannerImpl.java | ClasspathScannerImpl.initCache | private synchronized void initCache() {
"""
Scans the entire classpath and initializes the {@link #getReflectionUtil() root}.
"""
if (this.cache == null) {
ClasspathFolder rootFolder = new ClasspathFolder(null, "");
Set<String> resourceNames = this.reflectionUtil.findResourceNames("", true, ConstantFilter.getInstance(true));
List<ClasspathFile> fileList = new ArrayList<>(resourceNames.size());
for (String resource : resourceNames) {
ResourcePathNode<Void> path = ResourcePathNode.create(resource);
ClasspathFolder parent = createFolderRecursive(path.getParent(), rootFolder);
ClasspathFile file = new ClasspathFile(parent, path.getName());
parent.children.add(file);
fileList.add(file);
}
this.cache = new Cache(rootFolder, fileList);
}
} | java | private synchronized void initCache() {
if (this.cache == null) {
ClasspathFolder rootFolder = new ClasspathFolder(null, "");
Set<String> resourceNames = this.reflectionUtil.findResourceNames("", true, ConstantFilter.getInstance(true));
List<ClasspathFile> fileList = new ArrayList<>(resourceNames.size());
for (String resource : resourceNames) {
ResourcePathNode<Void> path = ResourcePathNode.create(resource);
ClasspathFolder parent = createFolderRecursive(path.getParent(), rootFolder);
ClasspathFile file = new ClasspathFile(parent, path.getName());
parent.children.add(file);
fileList.add(file);
}
this.cache = new Cache(rootFolder, fileList);
}
} | [
"private",
"synchronized",
"void",
"initCache",
"(",
")",
"{",
"if",
"(",
"this",
".",
"cache",
"==",
"null",
")",
"{",
"ClasspathFolder",
"rootFolder",
"=",
"new",
"ClasspathFolder",
"(",
"null",
",",
"\"\"",
")",
";",
"Set",
"<",
"String",
">",
"resour... | Scans the entire classpath and initializes the {@link #getReflectionUtil() root}. | [
"Scans",
"the",
"entire",
"classpath",
"and",
"initializes",
"the",
"{"
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/resource/src/main/java/net/sf/mmm/util/resource/impl/ClasspathScannerImpl.java#L84-L99 |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/model/Query.java | Query.adding | public Query adding( Column... columns ) {
"""
Create a copy of this query, but that returns results that include the columns specified by this query as well as the
supplied columns.
@param columns the additional columns that should be included in the the results; may not be null
@return the copy of the query returning the supplied result columns; never null
"""
List<Column> newColumns = null;
if (this.columns != null) {
newColumns = new ArrayList<Column>(this.columns);
for (Column column : columns) {
newColumns.add(column);
}
} else {
newColumns = Arrays.asList(columns);
}
return new Query(source, constraint, orderings(), newColumns, getLimits(), distinct);
} | java | public Query adding( Column... columns ) {
List<Column> newColumns = null;
if (this.columns != null) {
newColumns = new ArrayList<Column>(this.columns);
for (Column column : columns) {
newColumns.add(column);
}
} else {
newColumns = Arrays.asList(columns);
}
return new Query(source, constraint, orderings(), newColumns, getLimits(), distinct);
} | [
"public",
"Query",
"adding",
"(",
"Column",
"...",
"columns",
")",
"{",
"List",
"<",
"Column",
">",
"newColumns",
"=",
"null",
";",
"if",
"(",
"this",
".",
"columns",
"!=",
"null",
")",
"{",
"newColumns",
"=",
"new",
"ArrayList",
"<",
"Column",
">",
... | Create a copy of this query, but that returns results that include the columns specified by this query as well as the
supplied columns.
@param columns the additional columns that should be included in the the results; may not be null
@return the copy of the query returning the supplied result columns; never null | [
"Create",
"a",
"copy",
"of",
"this",
"query",
"but",
"that",
"returns",
"results",
"that",
"include",
"the",
"columns",
"specified",
"by",
"this",
"query",
"as",
"well",
"as",
"the",
"supplied",
"columns",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/model/Query.java#L240-L251 |
fcrepo3/fcrepo | fcrepo-security/fcrepo-security-pdp/src/main/java/org/fcrepo/server/security/xacml/pdp/data/DbXmlPolicyIndex.java | DbXmlPolicyIndex.createQuery | private String createQuery(Map<String, Collection<AttributeBean>> attributeMap) {
"""
Given a set of attributes this method generates a DBXML XPath query based
on those attributes to extract a subset of policies from the database.
@param attributeMap
the Map of Attributes from which to generate the query
@param r
the number of components in the resource id
@return the query as a String
"""
StringBuilder sb = new StringBuilder(256);
sb.append("collection('");
sb.append(m_dbXmlManager.CONTAINER);
sb.append("')");
getXpath(attributeMap, sb);
return sb.toString();
} | java | private String createQuery(Map<String, Collection<AttributeBean>> attributeMap) {
StringBuilder sb = new StringBuilder(256);
sb.append("collection('");
sb.append(m_dbXmlManager.CONTAINER);
sb.append("')");
getXpath(attributeMap, sb);
return sb.toString();
} | [
"private",
"String",
"createQuery",
"(",
"Map",
"<",
"String",
",",
"Collection",
"<",
"AttributeBean",
">",
">",
"attributeMap",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"256",
")",
";",
"sb",
".",
"append",
"(",
"\"collection('\""... | Given a set of attributes this method generates a DBXML XPath query based
on those attributes to extract a subset of policies from the database.
@param attributeMap
the Map of Attributes from which to generate the query
@param r
the number of components in the resource id
@return the query as a String | [
"Given",
"a",
"set",
"of",
"attributes",
"this",
"method",
"generates",
"a",
"DBXML",
"XPath",
"query",
"based",
"on",
"those",
"attributes",
"to",
"extract",
"a",
"subset",
"of",
"policies",
"from",
"the",
"database",
"."
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-security/fcrepo-security-pdp/src/main/java/org/fcrepo/server/security/xacml/pdp/data/DbXmlPolicyIndex.java#L262-L269 |
mygreen/excel-cellformatter | src/main/java/com/github/mygreen/cellformatter/lang/ExcelDateUtils.java | ExcelDateUtils.parseDate | public static Date parseDate(final String str) {
"""
文字列を日時形式を{@literal yyyy-MM-dd HH:mm:ss.SSS}のパースする。
<p>ただし、タイムゾーンは、標準時間の{@literal GMT-00:00}で処理する。
@param str パース対象の文字列
@return パースした日付。
@throws IllegalArgumentException str is empty.
@throws IllegalStateException fail parsing.
"""
ArgUtils.notEmpty(str, str);
try {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
format.setTimeZone(TimeZone.getTimeZone("GMT-00:00"));
return format.parse(str);
} catch (ParseException e) {
throw new IllegalStateException(String.format("fail parse to Data from '%s',", str), e);
}
} | java | public static Date parseDate(final String str) {
ArgUtils.notEmpty(str, str);
try {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
format.setTimeZone(TimeZone.getTimeZone("GMT-00:00"));
return format.parse(str);
} catch (ParseException e) {
throw new IllegalStateException(String.format("fail parse to Data from '%s',", str), e);
}
} | [
"public",
"static",
"Date",
"parseDate",
"(",
"final",
"String",
"str",
")",
"{",
"ArgUtils",
".",
"notEmpty",
"(",
"str",
",",
"str",
")",
";",
"try",
"{",
"SimpleDateFormat",
"format",
"=",
"new",
"SimpleDateFormat",
"(",
"\"yyyy-MM-dd HH:mm:ss.SSS\"",
")",
... | 文字列を日時形式を{@literal yyyy-MM-dd HH:mm:ss.SSS}のパースする。
<p>ただし、タイムゾーンは、標準時間の{@literal GMT-00:00}で処理する。
@param str パース対象の文字列
@return パースした日付。
@throws IllegalArgumentException str is empty.
@throws IllegalStateException fail parsing. | [
"文字列を日時形式を",
"{"
] | train | https://github.com/mygreen/excel-cellformatter/blob/e802af273d49889500591e03799c9262cbf29185/src/main/java/com/github/mygreen/cellformatter/lang/ExcelDateUtils.java#L196-L207 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java | URLUtil.getReader | public static BufferedReader getReader(URL url, Charset charset) {
"""
获得Reader
@param url {@link URL}
@param charset 编码
@return {@link BufferedReader}
@since 3.2.1
"""
return IoUtil.getReader(getStream(url), charset);
} | java | public static BufferedReader getReader(URL url, Charset charset) {
return IoUtil.getReader(getStream(url), charset);
} | [
"public",
"static",
"BufferedReader",
"getReader",
"(",
"URL",
"url",
",",
"Charset",
"charset",
")",
"{",
"return",
"IoUtil",
".",
"getReader",
"(",
"getStream",
"(",
"url",
")",
",",
"charset",
")",
";",
"}"
] | 获得Reader
@param url {@link URL}
@param charset 编码
@return {@link BufferedReader}
@since 3.2.1 | [
"获得Reader"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java#L523-L525 |
js-lib-com/commons | src/main/java/js/util/Classes.java | Classes.getPackageResource | public static String getPackageResource(Class<?> type, String resourceName) {
"""
Get resource name qualified with the package of a given class. Given a resource with simple name
<code>pdf-view-fop.xconf</code> and class <code>js.fop.PdfView</code> this method returns
<code>js/fop/pdf-view-fop.xconf</code>.
@param type class to infer package on which resource reside,
@param resourceName simple resource name.
@return qualified resource name.
"""
StringBuilder builder = new StringBuilder();
builder.append(type.getPackage().getName().replace('.', '/'));
if(resourceName.charAt(0) != '/') {
builder.append('/');
}
builder.append(resourceName);
return builder.toString();
} | java | public static String getPackageResource(Class<?> type, String resourceName)
{
StringBuilder builder = new StringBuilder();
builder.append(type.getPackage().getName().replace('.', '/'));
if(resourceName.charAt(0) != '/') {
builder.append('/');
}
builder.append(resourceName);
return builder.toString();
} | [
"public",
"static",
"String",
"getPackageResource",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"String",
"resourceName",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"builder",
".",
"append",
"(",
"type",
".",
"getPackage"... | Get resource name qualified with the package of a given class. Given a resource with simple name
<code>pdf-view-fop.xconf</code> and class <code>js.fop.PdfView</code> this method returns
<code>js/fop/pdf-view-fop.xconf</code>.
@param type class to infer package on which resource reside,
@param resourceName simple resource name.
@return qualified resource name. | [
"Get",
"resource",
"name",
"qualified",
"with",
"the",
"package",
"of",
"a",
"given",
"class",
".",
"Given",
"a",
"resource",
"with",
"simple",
"name",
"<code",
">",
"pdf",
"-",
"view",
"-",
"fop",
".",
"xconf<",
"/",
"code",
">",
"and",
"class",
"<cod... | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L949-L958 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalWriter.java | JournalWriter.writeFileArgument | private void writeFileArgument(String key, File file, XMLEventWriter writer)
throws XMLStreamException, JournalException {
"""
An InputStream argument must be written as a Base64-encoded String. It is
read from the temp file in segments. Each segment is encoded and written
to the XML writer as a series of character events.
"""
try {
putStartTag(writer, QNAME_TAG_ARGUMENT);
putAttribute(writer, QNAME_ATTR_NAME, key);
putAttribute(writer, QNAME_ATTR_TYPE, ARGUMENT_TYPE_STREAM);
EncodingBase64InputStream encoder =
new EncodingBase64InputStream(new BufferedInputStream(new FileInputStream(file)));
String encodedChunk;
while (null != (encodedChunk = encoder.read(1000))) {
putCharacters(writer, encodedChunk);
}
encoder.close();
putEndTag(writer, QNAME_TAG_ARGUMENT);
} catch (IOException e) {
throw new JournalException("IO Exception on temp file", e);
}
} | java | private void writeFileArgument(String key, File file, XMLEventWriter writer)
throws XMLStreamException, JournalException {
try {
putStartTag(writer, QNAME_TAG_ARGUMENT);
putAttribute(writer, QNAME_ATTR_NAME, key);
putAttribute(writer, QNAME_ATTR_TYPE, ARGUMENT_TYPE_STREAM);
EncodingBase64InputStream encoder =
new EncodingBase64InputStream(new BufferedInputStream(new FileInputStream(file)));
String encodedChunk;
while (null != (encodedChunk = encoder.read(1000))) {
putCharacters(writer, encodedChunk);
}
encoder.close();
putEndTag(writer, QNAME_TAG_ARGUMENT);
} catch (IOException e) {
throw new JournalException("IO Exception on temp file", e);
}
} | [
"private",
"void",
"writeFileArgument",
"(",
"String",
"key",
",",
"File",
"file",
",",
"XMLEventWriter",
"writer",
")",
"throws",
"XMLStreamException",
",",
"JournalException",
"{",
"try",
"{",
"putStartTag",
"(",
"writer",
",",
"QNAME_TAG_ARGUMENT",
")",
";",
... | An InputStream argument must be written as a Base64-encoded String. It is
read from the temp file in segments. Each segment is encoded and written
to the XML writer as a series of character events. | [
"An",
"InputStream",
"argument",
"must",
"be",
"written",
"as",
"a",
"Base64",
"-",
"encoded",
"String",
".",
"It",
"is",
"read",
"from",
"the",
"temp",
"file",
"in",
"segments",
".",
"Each",
"segment",
"is",
"encoded",
"and",
"written",
"to",
"the",
"XM... | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalWriter.java#L327-L345 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClient.java | BigtableTableAdminClient.getTableAsync | @SuppressWarnings("WeakerAccess")
public ApiFuture<Table> getTableAsync(String tableId) {
"""
Asynchronously gets the table metadata by tableId.
<p>Sample code:
<pre>{@code
ApiFuture<Table> tableFuture = client.getTableAsync("my-table");
ApiFutures.addCallback(
tableFuture,
new ApiFutureCallback<Table>() {
public void onSuccess(Table table) {
System.out.println("Got metadata for table: " + table.getId());
System.out.println("Column families:");
for (ColumnFamily cf : table.getColumnFamilies()) {
System.out.println(cf.getId());
}
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor()
);
}</pre>
"""
return getTableAsync(tableId, com.google.bigtable.admin.v2.Table.View.SCHEMA_VIEW);
} | java | @SuppressWarnings("WeakerAccess")
public ApiFuture<Table> getTableAsync(String tableId) {
return getTableAsync(tableId, com.google.bigtable.admin.v2.Table.View.SCHEMA_VIEW);
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"ApiFuture",
"<",
"Table",
">",
"getTableAsync",
"(",
"String",
"tableId",
")",
"{",
"return",
"getTableAsync",
"(",
"tableId",
",",
"com",
".",
"google",
".",
"bigtable",
".",
"admin",
".",
"v... | Asynchronously gets the table metadata by tableId.
<p>Sample code:
<pre>{@code
ApiFuture<Table> tableFuture = client.getTableAsync("my-table");
ApiFutures.addCallback(
tableFuture,
new ApiFutureCallback<Table>() {
public void onSuccess(Table table) {
System.out.println("Got metadata for table: " + table.getId());
System.out.println("Column families:");
for (ColumnFamily cf : table.getColumnFamilies()) {
System.out.println(cf.getId());
}
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor()
);
}</pre> | [
"Asynchronously",
"gets",
"the",
"table",
"metadata",
"by",
"tableId",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClient.java#L484-L487 |
diirt/util | src/main/java/org/epics/util/stats/Ranges.java | Ranges.contains | public static boolean contains(Range range, double value) {
"""
Determines whether the value is contained by the range or not.
@param range a range
@param value a value
@return true if the value is within the range
"""
return value >= range.getMinimum().doubleValue() && value <= range.getMaximum().doubleValue();
} | java | public static boolean contains(Range range, double value) {
return value >= range.getMinimum().doubleValue() && value <= range.getMaximum().doubleValue();
} | [
"public",
"static",
"boolean",
"contains",
"(",
"Range",
"range",
",",
"double",
"value",
")",
"{",
"return",
"value",
">=",
"range",
".",
"getMinimum",
"(",
")",
".",
"doubleValue",
"(",
")",
"&&",
"value",
"<=",
"range",
".",
"getMaximum",
"(",
")",
... | Determines whether the value is contained by the range or not.
@param range a range
@param value a value
@return true if the value is within the range | [
"Determines",
"whether",
"the",
"value",
"is",
"contained",
"by",
"the",
"range",
"or",
"not",
"."
] | train | https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/stats/Ranges.java#L135-L137 |
haifengl/smile | math/src/main/java/smile/stat/distribution/HyperGeometricDistribution.java | HyperGeometricDistribution.rand | @Override
public double rand() {
"""
Uses inversion by chop-down search from the mode when the mean < 20
and the patchwork-rejection method when the mean > 20.
"""
int mm = m;
int nn = n;
if (mm > N / 2) {
// invert mm
mm = N - mm;
}
if (nn > N / 2) {
// invert nn
nn = N - nn;
}
if (nn > mm) {
// swap nn and mm
int swap = nn;
nn = mm;
mm = swap;
}
if (rng == null) {
if ((double) nn * mm >= 20 * N) {
// use ratio-of-uniforms method
rng = new Patchwork(N, mm, nn);
} else {
// inversion method, using chop-down search from mode
rng = new Inversion(N, mm, nn);
}
}
return rng.rand();
} | java | @Override
public double rand() {
int mm = m;
int nn = n;
if (mm > N / 2) {
// invert mm
mm = N - mm;
}
if (nn > N / 2) {
// invert nn
nn = N - nn;
}
if (nn > mm) {
// swap nn and mm
int swap = nn;
nn = mm;
mm = swap;
}
if (rng == null) {
if ((double) nn * mm >= 20 * N) {
// use ratio-of-uniforms method
rng = new Patchwork(N, mm, nn);
} else {
// inversion method, using chop-down search from mode
rng = new Inversion(N, mm, nn);
}
}
return rng.rand();
} | [
"@",
"Override",
"public",
"double",
"rand",
"(",
")",
"{",
"int",
"mm",
"=",
"m",
";",
"int",
"nn",
"=",
"n",
";",
"if",
"(",
"mm",
">",
"N",
"/",
"2",
")",
"{",
"// invert mm",
"mm",
"=",
"N",
"-",
"mm",
";",
"}",
"if",
"(",
"nn",
">",
... | Uses inversion by chop-down search from the mode when the mean < 20
and the patchwork-rejection method when the mean > 20. | [
"Uses",
"inversion",
"by",
"chop",
"-",
"down",
"search",
"from",
"the",
"mode",
"when",
"the",
"mean",
"<",
";",
"20",
"and",
"the",
"patchwork",
"-",
"rejection",
"method",
"when",
"the",
"mean",
">",
";",
"20",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/stat/distribution/HyperGeometricDistribution.java#L179-L212 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java | ArrayFunctions.arrayContains | public static Expression arrayContains(Expression expression, Expression value) {
"""
Returned expression results in true if the array contains value.
"""
return x("ARRAY_CONTAINS(" + expression.toString() + ", " + value.toString() + ")");
} | java | public static Expression arrayContains(Expression expression, Expression value) {
return x("ARRAY_CONTAINS(" + expression.toString() + ", " + value.toString() + ")");
} | [
"public",
"static",
"Expression",
"arrayContains",
"(",
"Expression",
"expression",
",",
"Expression",
"value",
")",
"{",
"return",
"x",
"(",
"\"ARRAY_CONTAINS(\"",
"+",
"expression",
".",
"toString",
"(",
")",
"+",
"\", \"",
"+",
"value",
".",
"toString",
"("... | Returned expression results in true if the array contains value. | [
"Returned",
"expression",
"results",
"in",
"true",
"if",
"the",
"array",
"contains",
"value",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java#L111-L113 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/send/authentication/ed25519/math/GroupElement.java | GroupElement.cmov | org.mariadb.jdbc.internal.com.send.authentication.ed25519.math.GroupElement cmov(
final org.mariadb.jdbc.internal.com.send.authentication.ed25519.math.GroupElement u, final int b) {
"""
Constant-time conditional move.
<p>
Replaces this with $u$ if $b == 1$.<br> Replaces this with this if $b == 0$.
<p>
Method is package private only so that tests run.
@param u The group element to return if $b == 1$.
@param b in $\{0, 1\}$
@return $u$ if $b == 1$; this if $b == 0$. Results undefined if $b$ is not in $\{0, 1\}$.
"""
return precomp(curve, X.cmov(u.X, b), Y.cmov(u.Y, b), Z.cmov(u.Z, b));
} | java | org.mariadb.jdbc.internal.com.send.authentication.ed25519.math.GroupElement cmov(
final org.mariadb.jdbc.internal.com.send.authentication.ed25519.math.GroupElement u, final int b) {
return precomp(curve, X.cmov(u.X, b), Y.cmov(u.Y, b), Z.cmov(u.Z, b));
} | [
"org",
".",
"mariadb",
".",
"jdbc",
".",
"internal",
".",
"com",
".",
"send",
".",
"authentication",
".",
"ed25519",
".",
"math",
".",
"GroupElement",
"cmov",
"(",
"final",
"org",
".",
"mariadb",
".",
"jdbc",
".",
"internal",
".",
"com",
".",
"send",
... | Constant-time conditional move.
<p>
Replaces this with $u$ if $b == 1$.<br> Replaces this with this if $b == 0$.
<p>
Method is package private only so that tests run.
@param u The group element to return if $b == 1$.
@param b in $\{0, 1\}$
@return $u$ if $b == 1$; this if $b == 0$. Results undefined if $b$ is not in $\{0, 1\}$. | [
"Constant",
"-",
"time",
"conditional",
"move",
".",
"<p",
">",
"Replaces",
"this",
"with",
"$u$",
"if",
"$b",
"==",
"1$",
".",
"<br",
">",
"Replaces",
"this",
"with",
"this",
"if",
"$b",
"==",
"0$",
".",
"<p",
">",
"Method",
"is",
"package",
"privat... | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/send/authentication/ed25519/math/GroupElement.java#L868-L871 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/collect/Maps.java | Maps.newTreeMap | public static <K extends Comparable, V> TreeMap<K, V> newTreeMap() {
"""
Creates a <i>mutable</i>, empty {@code TreeMap} instance using the natural
ordering of its elements.
<p><b>Note:</b> if mutability is not required, use {@link
ImmutableSortedMap#of()} instead.
<p><b>Note for Java 7 and later:</b> this method is now unnecessary and
should be treated as deprecated. Instead, use the {@code TreeMap}
constructor directly, taking advantage of the new
<a href="http://goo.gl/iz2Wi">"diamond" syntax</a>.
@return a new, empty {@code TreeMap}
"""
return new TreeMap<K, V>();
} | java | public static <K extends Comparable, V> TreeMap<K, V> newTreeMap() {
return new TreeMap<K, V>();
} | [
"public",
"static",
"<",
"K",
"extends",
"Comparable",
",",
"V",
">",
"TreeMap",
"<",
"K",
",",
"V",
">",
"newTreeMap",
"(",
")",
"{",
"return",
"new",
"TreeMap",
"<",
"K",
",",
"V",
">",
"(",
")",
";",
"}"
] | Creates a <i>mutable</i>, empty {@code TreeMap} instance using the natural
ordering of its elements.
<p><b>Note:</b> if mutability is not required, use {@link
ImmutableSortedMap#of()} instead.
<p><b>Note for Java 7 and later:</b> this method is now unnecessary and
should be treated as deprecated. Instead, use the {@code TreeMap}
constructor directly, taking advantage of the new
<a href="http://goo.gl/iz2Wi">"diamond" syntax</a>.
@return a new, empty {@code TreeMap} | [
"Creates",
"a",
"<i",
">",
"mutable<",
"/",
"i",
">",
"empty",
"{",
"@code",
"TreeMap",
"}",
"instance",
"using",
"the",
"natural",
"ordering",
"of",
"its",
"elements",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/collect/Maps.java#L320-L322 |
RestComm/media-core | rtp/src/main/java/org/restcomm/media/core/rtp/channels/MediaChannel.java | MediaChannel.enableDTLS | public void enableDTLS(String hashFunction, String remoteFingerprint) {
"""
Enables DTLS on the channel. RTP and RTCP packets flowing through this
channel will be secured.
<p>
This method is used in <b>inbound</b> calls where the remote fingerprint is known.
</p>
@param remoteFingerprint
The DTLS finger print of the remote peer.
"""
if (!this.dtls) {
this.rtpChannel.enableSRTP(hashFunction, remoteFingerprint);
if (!this.rtcpMux) {
rtcpChannel.enableSRTCP(hashFunction, remoteFingerprint);
}
this.dtls = true;
if (logger.isDebugEnabled()) {
logger.debug(this.mediaType + " channel " + this.ssrc + " enabled DTLS");
}
}
} | java | public void enableDTLS(String hashFunction, String remoteFingerprint) {
if (!this.dtls) {
this.rtpChannel.enableSRTP(hashFunction, remoteFingerprint);
if (!this.rtcpMux) {
rtcpChannel.enableSRTCP(hashFunction, remoteFingerprint);
}
this.dtls = true;
if (logger.isDebugEnabled()) {
logger.debug(this.mediaType + " channel " + this.ssrc + " enabled DTLS");
}
}
} | [
"public",
"void",
"enableDTLS",
"(",
"String",
"hashFunction",
",",
"String",
"remoteFingerprint",
")",
"{",
"if",
"(",
"!",
"this",
".",
"dtls",
")",
"{",
"this",
".",
"rtpChannel",
".",
"enableSRTP",
"(",
"hashFunction",
",",
"remoteFingerprint",
")",
";",... | Enables DTLS on the channel. RTP and RTCP packets flowing through this
channel will be secured.
<p>
This method is used in <b>inbound</b> calls where the remote fingerprint is known.
</p>
@param remoteFingerprint
The DTLS finger print of the remote peer. | [
"Enables",
"DTLS",
"on",
"the",
"channel",
".",
"RTP",
"and",
"RTCP",
"packets",
"flowing",
"through",
"this",
"channel",
"will",
"be",
"secured",
"."
] | train | https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/rtp/src/main/java/org/restcomm/media/core/rtp/channels/MediaChannel.java#L801-L813 |
alkacon/opencms-core | src/org/opencms/synchronize/CmsSynchronize.java | CmsSynchronize.importToVfs | private void importToVfs(File fsFile, String resName, String folder) throws CmsException {
"""
Imports a new resource from the FS into the VFS and updates the
synchronization lists.<p>
@param fsFile the file in the FS
@param resName the name of the resource in the VFS
@param folder the folder to import the file into
@throws CmsException if something goes wrong
"""
try {
// get the content of the FS file
byte[] content = CmsFileUtil.readFile(fsFile);
// create the file
String filename = translate(fsFile.getName());
m_report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_SUCCESSION_1,
String.valueOf(m_count++)),
I_CmsReport.FORMAT_NOTE);
if (fsFile.isFile()) {
m_report.print(Messages.get().container(Messages.RPT_IMPORT_FILE_0), I_CmsReport.FORMAT_NOTE);
} else {
m_report.print(Messages.get().container(Messages.RPT_IMPORT_FOLDER_0), I_CmsReport.FORMAT_NOTE);
}
m_report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_ARGUMENT_1,
fsFile.getAbsolutePath().replace('\\', '/')));
m_report.print(Messages.get().container(Messages.RPT_FROM_FS_TO_0), I_CmsReport.FORMAT_NOTE);
// get the file type of the FS file
int resType = OpenCms.getResourceManager().getDefaultTypeForName(resName).getTypeId();
CmsResource newFile = m_cms.createResource(
translate(folder) + filename,
resType,
content,
new ArrayList<CmsProperty>());
m_report.print(org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_ARGUMENT_1,
m_cms.getSitePath(newFile)));
m_report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0));
// now check if there is some external method to be called which
// should modify the imported resource in the VFS
Iterator<I_CmsSynchronizeModification> i = m_synchronizeModifications.iterator();
while (i.hasNext()) {
try {
i.next().modifyVfs(m_cms, newFile, fsFile);
} catch (CmsSynchronizeException e) {
break;
}
}
// we have to read the new resource again, to get the correct timestamp
m_cms.setDateLastModified(m_cms.getSitePath(newFile), fsFile.lastModified(), false);
CmsResource newRes = m_cms.readResource(m_cms.getSitePath(newFile));
// add resource to synchronization list
CmsSynchronizeList syncList = new CmsSynchronizeList(
resName,
translate(resName),
newRes.getDateLastModified(),
fsFile.lastModified());
m_newSyncList.put(translate(resName), syncList);
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
} catch (IOException e) {
throw new CmsSynchronizeException(
Messages.get().container(Messages.ERR_READING_FILE_1, fsFile.getName()),
e);
}
} | java | private void importToVfs(File fsFile, String resName, String folder) throws CmsException {
try {
// get the content of the FS file
byte[] content = CmsFileUtil.readFile(fsFile);
// create the file
String filename = translate(fsFile.getName());
m_report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_SUCCESSION_1,
String.valueOf(m_count++)),
I_CmsReport.FORMAT_NOTE);
if (fsFile.isFile()) {
m_report.print(Messages.get().container(Messages.RPT_IMPORT_FILE_0), I_CmsReport.FORMAT_NOTE);
} else {
m_report.print(Messages.get().container(Messages.RPT_IMPORT_FOLDER_0), I_CmsReport.FORMAT_NOTE);
}
m_report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_ARGUMENT_1,
fsFile.getAbsolutePath().replace('\\', '/')));
m_report.print(Messages.get().container(Messages.RPT_FROM_FS_TO_0), I_CmsReport.FORMAT_NOTE);
// get the file type of the FS file
int resType = OpenCms.getResourceManager().getDefaultTypeForName(resName).getTypeId();
CmsResource newFile = m_cms.createResource(
translate(folder) + filename,
resType,
content,
new ArrayList<CmsProperty>());
m_report.print(org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_ARGUMENT_1,
m_cms.getSitePath(newFile)));
m_report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0));
// now check if there is some external method to be called which
// should modify the imported resource in the VFS
Iterator<I_CmsSynchronizeModification> i = m_synchronizeModifications.iterator();
while (i.hasNext()) {
try {
i.next().modifyVfs(m_cms, newFile, fsFile);
} catch (CmsSynchronizeException e) {
break;
}
}
// we have to read the new resource again, to get the correct timestamp
m_cms.setDateLastModified(m_cms.getSitePath(newFile), fsFile.lastModified(), false);
CmsResource newRes = m_cms.readResource(m_cms.getSitePath(newFile));
// add resource to synchronization list
CmsSynchronizeList syncList = new CmsSynchronizeList(
resName,
translate(resName),
newRes.getDateLastModified(),
fsFile.lastModified());
m_newSyncList.put(translate(resName), syncList);
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
} catch (IOException e) {
throw new CmsSynchronizeException(
Messages.get().container(Messages.ERR_READING_FILE_1, fsFile.getName()),
e);
}
} | [
"private",
"void",
"importToVfs",
"(",
"File",
"fsFile",
",",
"String",
"resName",
",",
"String",
"folder",
")",
"throws",
"CmsException",
"{",
"try",
"{",
"// get the content of the FS file",
"byte",
"[",
"]",
"content",
"=",
"CmsFileUtil",
".",
"readFile",
"("... | Imports a new resource from the FS into the VFS and updates the
synchronization lists.<p>
@param fsFile the file in the FS
@param resName the name of the resource in the VFS
@param folder the folder to import the file into
@throws CmsException if something goes wrong | [
"Imports",
"a",
"new",
"resource",
"from",
"the",
"FS",
"into",
"the",
"VFS",
"and",
"updates",
"the",
"synchronization",
"lists",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/synchronize/CmsSynchronize.java#L528-L596 |
EdwardRaff/JSAT | JSAT/src/jsat/linear/distancemetrics/TrainableDistanceMetric.java | TrainableDistanceMetric.trainIfNeeded | public static void trainIfNeeded(DistanceMetric dm, DataSet dataset, ExecutorService threadpool) {
"""
Static helper method for training a distance metric only if it is needed.
This method can be safely called for any Distance Metric.
@param dm the distance metric to train
@param dataset the data set to train from
@param threadpool the source of threads for parallel training. May be
<tt>null</tt>, in which case {@link #trainIfNeeded(jsat.linear.distancemetrics.DistanceMetric, jsat.DataSet) }
is used instead.
@deprecated I WILL DELETE THIS METHOD SOON
"""
//TODO I WILL DELETE, JUST STUBBING FOR NOW TO MAKE LIFE EASY AS I DO ONE CODE SECTION AT A TIME
trainIfNeeded(dm, dataset);
} | java | public static void trainIfNeeded(DistanceMetric dm, DataSet dataset, ExecutorService threadpool)
{
//TODO I WILL DELETE, JUST STUBBING FOR NOW TO MAKE LIFE EASY AS I DO ONE CODE SECTION AT A TIME
trainIfNeeded(dm, dataset);
} | [
"public",
"static",
"void",
"trainIfNeeded",
"(",
"DistanceMetric",
"dm",
",",
"DataSet",
"dataset",
",",
"ExecutorService",
"threadpool",
")",
"{",
"//TODO I WILL DELETE, JUST STUBBING FOR NOW TO MAKE LIFE EASY AS I DO ONE CODE SECTION AT A TIME",
"trainIfNeeded",
"(",
"dm",
"... | Static helper method for training a distance metric only if it is needed.
This method can be safely called for any Distance Metric.
@param dm the distance metric to train
@param dataset the data set to train from
@param threadpool the source of threads for parallel training. May be
<tt>null</tt>, in which case {@link #trainIfNeeded(jsat.linear.distancemetrics.DistanceMetric, jsat.DataSet) }
is used instead.
@deprecated I WILL DELETE THIS METHOD SOON | [
"Static",
"helper",
"method",
"for",
"training",
"a",
"distance",
"metric",
"only",
"if",
"it",
"is",
"needed",
".",
"This",
"method",
"can",
"be",
"safely",
"called",
"for",
"any",
"Distance",
"Metric",
"."
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/distancemetrics/TrainableDistanceMetric.java#L186-L190 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java | ProfileSummaryBuilder.buildPackageSummary | public void buildPackageSummary(XMLNode node, Content summaryContentTree) {
"""
Build the profile package summary.
@param node the XML element that specifies which components to document
@param summaryContentTree the content tree to which the summaries will
be added
"""
PackageDoc[] packages = configuration.profilePackages.get(profile.name);
for (int i = 0; i < packages.length; i++) {
this.pkg = packages[i];
Content packageSummaryContentTree = profileWriter.getPackageSummaryHeader(this.pkg);
buildChildren(node, packageSummaryContentTree);
summaryContentTree.addContent(profileWriter.getPackageSummaryTree(
packageSummaryContentTree));
}
} | java | public void buildPackageSummary(XMLNode node, Content summaryContentTree) {
PackageDoc[] packages = configuration.profilePackages.get(profile.name);
for (int i = 0; i < packages.length; i++) {
this.pkg = packages[i];
Content packageSummaryContentTree = profileWriter.getPackageSummaryHeader(this.pkg);
buildChildren(node, packageSummaryContentTree);
summaryContentTree.addContent(profileWriter.getPackageSummaryTree(
packageSummaryContentTree));
}
} | [
"public",
"void",
"buildPackageSummary",
"(",
"XMLNode",
"node",
",",
"Content",
"summaryContentTree",
")",
"{",
"PackageDoc",
"[",
"]",
"packages",
"=",
"configuration",
".",
"profilePackages",
".",
"get",
"(",
"profile",
".",
"name",
")",
";",
"for",
"(",
... | Build the profile package summary.
@param node the XML element that specifies which components to document
@param summaryContentTree the content tree to which the summaries will
be added | [
"Build",
"the",
"profile",
"package",
"summary",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java#L167-L176 |
alkacon/opencms-core | src/org/opencms/file/CmsLinkRewriter.java | CmsLinkRewriter.rewriteContentString | protected String rewriteContentString(String originalContent) {
"""
Replaces structure ids of resources in the source subtree with the structure ids of the corresponding
resources in the target subtree inside a content string.<p>
@param originalContent the original content
@return the content with the new structure ids
"""
Pattern uuidPattern = Pattern.compile(CmsUUID.UUID_REGEX);
I_CmsRegexSubstitution substitution = new I_CmsRegexSubstitution() {
public String substituteMatch(String text, Matcher matcher) {
String uuidString = text.substring(matcher.start(), matcher.end());
CmsUUID uuid = new CmsUUID(uuidString);
String result = uuidString;
if (m_translationsById.containsKey(uuid)) {
result = m_translationsById.get(uuid).getStructureId().toString();
}
return result;
}
};
return CmsStringUtil.substitute(uuidPattern, originalContent, substitution);
} | java | protected String rewriteContentString(String originalContent) {
Pattern uuidPattern = Pattern.compile(CmsUUID.UUID_REGEX);
I_CmsRegexSubstitution substitution = new I_CmsRegexSubstitution() {
public String substituteMatch(String text, Matcher matcher) {
String uuidString = text.substring(matcher.start(), matcher.end());
CmsUUID uuid = new CmsUUID(uuidString);
String result = uuidString;
if (m_translationsById.containsKey(uuid)) {
result = m_translationsById.get(uuid).getStructureId().toString();
}
return result;
}
};
return CmsStringUtil.substitute(uuidPattern, originalContent, substitution);
} | [
"protected",
"String",
"rewriteContentString",
"(",
"String",
"originalContent",
")",
"{",
"Pattern",
"uuidPattern",
"=",
"Pattern",
".",
"compile",
"(",
"CmsUUID",
".",
"UUID_REGEX",
")",
";",
"I_CmsRegexSubstitution",
"substitution",
"=",
"new",
"I_CmsRegexSubstitut... | Replaces structure ids of resources in the source subtree with the structure ids of the corresponding
resources in the target subtree inside a content string.<p>
@param originalContent the original content
@return the content with the new structure ids | [
"Replaces",
"structure",
"ids",
"of",
"resources",
"in",
"the",
"source",
"subtree",
"with",
"the",
"structure",
"ids",
"of",
"the",
"corresponding",
"resources",
"in",
"the",
"target",
"subtree",
"inside",
"a",
"content",
"string",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsLinkRewriter.java#L654-L671 |
baasbox/Android-SDK | library/src/main/java/com/baasbox/android/BaasAsset.java | BaasAsset.streamImageAsset | public static <R> RequestToken streamImageAsset(String id, int size, int flags, DataStreamHandler<R> data, BaasHandler<R> handler) {
"""
Streams the file using the provided data stream handler.
@param id the name of the asset to download
@param size a size spec to specify the resize of an image asset
@param flags {@link RequestOptions}
@param data the data stream handler {@link com.baasbox.android.DataStreamHandler}
@param handler the completion handler
@param <R> the type to transform the bytes to.
@return a request token to handle the request
"""
return BaasAsset.doStreamAsset(id, null, size, flags, data, handler);
} | java | public static <R> RequestToken streamImageAsset(String id, int size, int flags, DataStreamHandler<R> data, BaasHandler<R> handler) {
return BaasAsset.doStreamAsset(id, null, size, flags, data, handler);
} | [
"public",
"static",
"<",
"R",
">",
"RequestToken",
"streamImageAsset",
"(",
"String",
"id",
",",
"int",
"size",
",",
"int",
"flags",
",",
"DataStreamHandler",
"<",
"R",
">",
"data",
",",
"BaasHandler",
"<",
"R",
">",
"handler",
")",
"{",
"return",
"BaasA... | Streams the file using the provided data stream handler.
@param id the name of the asset to download
@param size a size spec to specify the resize of an image asset
@param flags {@link RequestOptions}
@param data the data stream handler {@link com.baasbox.android.DataStreamHandler}
@param handler the completion handler
@param <R> the type to transform the bytes to.
@return a request token to handle the request | [
"Streams",
"the",
"file",
"using",
"the",
"provided",
"data",
"stream",
"handler",
"."
] | train | https://github.com/baasbox/Android-SDK/blob/6bb2203246b885b2ad63a7bfaf37c83caf15e0d8/library/src/main/java/com/baasbox/android/BaasAsset.java#L141-L143 |
RestComm/sipunit | src/main/java/org/cafesip/sipunit/SipPhone.java | SipPhone.addBuddy | public PresenceSubscriber addBuddy(String uri, int duration, long timeout) {
"""
This method is the same as addBuddy(uri, duration, eventId, timeout) except that no event "id"
parameter will be included.
@param uri the URI (ie, sip:bob@nist.gov) of the buddy to be added to the list.
@param duration the duration in seconds to put in the SUBSCRIBE message. If 0, this is
equivalent to a fetch except that the buddy stays in the buddy list even though the
subscription won't be active.
@param timeout The maximum amount of time to wait for a SUBSCRIBE response, in milliseconds.
Use a value of 0 to wait indefinitely.
@return PresenceSubscriber object representing the buddy if the operation is successful so far,
null otherwise.
"""
return addBuddy(uri, duration, null, timeout);
} | java | public PresenceSubscriber addBuddy(String uri, int duration, long timeout) {
return addBuddy(uri, duration, null, timeout);
} | [
"public",
"PresenceSubscriber",
"addBuddy",
"(",
"String",
"uri",
",",
"int",
"duration",
",",
"long",
"timeout",
")",
"{",
"return",
"addBuddy",
"(",
"uri",
",",
"duration",
",",
"null",
",",
"timeout",
")",
";",
"}"
] | This method is the same as addBuddy(uri, duration, eventId, timeout) except that no event "id"
parameter will be included.
@param uri the URI (ie, sip:bob@nist.gov) of the buddy to be added to the list.
@param duration the duration in seconds to put in the SUBSCRIBE message. If 0, this is
equivalent to a fetch except that the buddy stays in the buddy list even though the
subscription won't be active.
@param timeout The maximum amount of time to wait for a SUBSCRIBE response, in milliseconds.
Use a value of 0 to wait indefinitely.
@return PresenceSubscriber object representing the buddy if the operation is successful so far,
null otherwise. | [
"This",
"method",
"is",
"the",
"same",
"as",
"addBuddy",
"(",
"uri",
"duration",
"eventId",
"timeout",
")",
"except",
"that",
"no",
"event",
"id",
"parameter",
"will",
"be",
"included",
"."
] | train | https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipPhone.java#L1458-L1460 |
roboconf/roboconf-platform | core/roboconf-dm/src/main/java/net/roboconf/dm/internal/utils/ConfigurationUtils.java | ConfigurationUtils.findIcon | public static File findIcon( String name, String qualifier, File configurationDirectory ) {
"""
Finds the icon associated with an application template.
@param name the application or template name
@param qualifier the template qualifier or <code>null</code> for an application
@param configurationDirectory the DM's configuration directory
@return an existing file, or null if no icon was found
"""
// Deal with an invalid directory
if( configurationDirectory == null )
return null;
// Find the root directory
File root;
if( ! Utils.isEmptyOrWhitespaces( qualifier )) {
ApplicationTemplate tpl = new ApplicationTemplate( name ).version( qualifier );
root = ConfigurationUtils.findTemplateDirectory( tpl, configurationDirectory );
} else {
root = ConfigurationUtils.findApplicationDirectory( name, configurationDirectory );
}
// Find an icon in the directory
return IconUtils.findIcon( root );
} | java | public static File findIcon( String name, String qualifier, File configurationDirectory ) {
// Deal with an invalid directory
if( configurationDirectory == null )
return null;
// Find the root directory
File root;
if( ! Utils.isEmptyOrWhitespaces( qualifier )) {
ApplicationTemplate tpl = new ApplicationTemplate( name ).version( qualifier );
root = ConfigurationUtils.findTemplateDirectory( tpl, configurationDirectory );
} else {
root = ConfigurationUtils.findApplicationDirectory( name, configurationDirectory );
}
// Find an icon in the directory
return IconUtils.findIcon( root );
} | [
"public",
"static",
"File",
"findIcon",
"(",
"String",
"name",
",",
"String",
"qualifier",
",",
"File",
"configurationDirectory",
")",
"{",
"// Deal with an invalid directory",
"if",
"(",
"configurationDirectory",
"==",
"null",
")",
"return",
"null",
";",
"// Find t... | Finds the icon associated with an application template.
@param name the application or template name
@param qualifier the template qualifier or <code>null</code> for an application
@param configurationDirectory the DM's configuration directory
@return an existing file, or null if no icon was found | [
"Finds",
"the",
"icon",
"associated",
"with",
"an",
"application",
"template",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-dm/src/main/java/net/roboconf/dm/internal/utils/ConfigurationUtils.java#L156-L173 |
rollbar/rollbar-java | rollbar-java/src/main/java/com/rollbar/Rollbar.java | Rollbar.handleUncaughtErrors | public void handleUncaughtErrors(Thread thread) {
"""
Handle all uncaught errors on {@code thread} with this `Rollbar`.
@param thread the thread to handle errors on
"""
final Rollbar rollbar = this;
thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
public void uncaughtException(Thread t, Throwable e) {
rollbar.log(e, null, null, null, true);
}
});
} | java | public void handleUncaughtErrors(Thread thread) {
final Rollbar rollbar = this;
thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
public void uncaughtException(Thread t, Throwable e) {
rollbar.log(e, null, null, null, true);
}
});
} | [
"public",
"void",
"handleUncaughtErrors",
"(",
"Thread",
"thread",
")",
"{",
"final",
"Rollbar",
"rollbar",
"=",
"this",
";",
"thread",
".",
"setUncaughtExceptionHandler",
"(",
"new",
"Thread",
".",
"UncaughtExceptionHandler",
"(",
")",
"{",
"public",
"void",
"u... | Handle all uncaught errors on {@code thread} with this `Rollbar`.
@param thread the thread to handle errors on | [
"Handle",
"all",
"uncaught",
"errors",
"on",
"{"
] | train | https://github.com/rollbar/rollbar-java/blob/5eb4537d1363722b51cfcce55b427cbd8489f17b/rollbar-java/src/main/java/com/rollbar/Rollbar.java#L142-L149 |
hyperledger/fabric-chaincode-java | fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/ext/sbe/impl/StateBasedEndorsementUtils.java | StateBasedEndorsementUtils.signedByFabricEntity | static SignaturePolicyEnvelope signedByFabricEntity(String mspId, MSPRoleType role) {
"""
Creates a {@link SignaturePolicyEnvelope}
requiring 1 signature from any fabric entity, having the passed role, of the specified MSP
@param mspId
@param role
@return
"""
// specify the principal: it's a member of the msp we just found
MSPPrincipal principal = MSPPrincipal
.newBuilder()
.setPrincipalClassification(Classification.ROLE)
.setPrincipal(MSPRole
.newBuilder()
.setMspIdentifier(mspId)
.setRole(role)
.build().toByteString())
.build();
// create the policy: it requires exactly 1 signature from the first (and only) principal
return SignaturePolicyEnvelope
.newBuilder()
.setVersion(0)
.setRule(nOutOf(1, Arrays.asList(signedBy(0))))
.addIdentities(principal)
.build();
} | java | static SignaturePolicyEnvelope signedByFabricEntity(String mspId, MSPRoleType role) {
// specify the principal: it's a member of the msp we just found
MSPPrincipal principal = MSPPrincipal
.newBuilder()
.setPrincipalClassification(Classification.ROLE)
.setPrincipal(MSPRole
.newBuilder()
.setMspIdentifier(mspId)
.setRole(role)
.build().toByteString())
.build();
// create the policy: it requires exactly 1 signature from the first (and only) principal
return SignaturePolicyEnvelope
.newBuilder()
.setVersion(0)
.setRule(nOutOf(1, Arrays.asList(signedBy(0))))
.addIdentities(principal)
.build();
} | [
"static",
"SignaturePolicyEnvelope",
"signedByFabricEntity",
"(",
"String",
"mspId",
",",
"MSPRoleType",
"role",
")",
"{",
"// specify the principal: it's a member of the msp we just found",
"MSPPrincipal",
"principal",
"=",
"MSPPrincipal",
".",
"newBuilder",
"(",
")",
".",
... | Creates a {@link SignaturePolicyEnvelope}
requiring 1 signature from any fabric entity, having the passed role, of the specified MSP
@param mspId
@param role
@return | [
"Creates",
"a",
"{",
"@link",
"SignaturePolicyEnvelope",
"}",
"requiring",
"1",
"signature",
"from",
"any",
"fabric",
"entity",
"having",
"the",
"passed",
"role",
"of",
"the",
"specified",
"MSP"
] | train | https://github.com/hyperledger/fabric-chaincode-java/blob/1c688a3c7824758448fec31daaf0a1410a427e91/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/ext/sbe/impl/StateBasedEndorsementUtils.java#L60-L80 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/util/ValidationUtils.java | ValidationUtils.assertAllAreNull | public static void assertAllAreNull(String messageIfNull, Object... objects) throws IllegalArgumentException {
"""
Asserts that all of the objects are null.
@throws IllegalArgumentException
if any object provided was NOT null.
"""
for (Object object : objects) {
if (object != null) {
throw new IllegalArgumentException(messageIfNull);
}
}
} | java | public static void assertAllAreNull(String messageIfNull, Object... objects) throws IllegalArgumentException {
for (Object object : objects) {
if (object != null) {
throw new IllegalArgumentException(messageIfNull);
}
}
} | [
"public",
"static",
"void",
"assertAllAreNull",
"(",
"String",
"messageIfNull",
",",
"Object",
"...",
"objects",
")",
"throws",
"IllegalArgumentException",
"{",
"for",
"(",
"Object",
"object",
":",
"objects",
")",
"{",
"if",
"(",
"object",
"!=",
"null",
")",
... | Asserts that all of the objects are null.
@throws IllegalArgumentException
if any object provided was NOT null. | [
"Asserts",
"that",
"all",
"of",
"the",
"objects",
"are",
"null",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/ValidationUtils.java#L48-L54 |
lightbend/config | config/src/main/java/com/typesafe/config/ConfigFactory.java | ConfigFactory.parseReader | public static Config parseReader(Reader reader, ConfigParseOptions options) {
"""
Parses a Reader into a Config instance. Does not call
{@link Config#resolve} or merge the parsed stream with any
other configuration; this method parses a single stream and
does nothing else. It does process "include" statements in
the parsed stream, and may end up doing other IO due to those
statements.
@param reader
the reader to parse
@param options
parse options to control how the reader is interpreted
@return the parsed configuration
@throws ConfigException on IO or parse errors
"""
return Parseable.newReader(reader, options).parse().toConfig();
} | java | public static Config parseReader(Reader reader, ConfigParseOptions options) {
return Parseable.newReader(reader, options).parse().toConfig();
} | [
"public",
"static",
"Config",
"parseReader",
"(",
"Reader",
"reader",
",",
"ConfigParseOptions",
"options",
")",
"{",
"return",
"Parseable",
".",
"newReader",
"(",
"reader",
",",
"options",
")",
".",
"parse",
"(",
")",
".",
"toConfig",
"(",
")",
";",
"}"
] | Parses a Reader into a Config instance. Does not call
{@link Config#resolve} or merge the parsed stream with any
other configuration; this method parses a single stream and
does nothing else. It does process "include" statements in
the parsed stream, and may end up doing other IO due to those
statements.
@param reader
the reader to parse
@param options
parse options to control how the reader is interpreted
@return the parsed configuration
@throws ConfigException on IO or parse errors | [
"Parses",
"a",
"Reader",
"into",
"a",
"Config",
"instance",
".",
"Does",
"not",
"call",
"{",
"@link",
"Config#resolve",
"}",
"or",
"merge",
"the",
"parsed",
"stream",
"with",
"any",
"other",
"configuration",
";",
"this",
"method",
"parses",
"a",
"single",
... | train | https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/ConfigFactory.java#L672-L674 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/convolution/OldConvolution.java | OldConvolution.col2im | public static INDArray col2im(INDArray col, int sy, int sx, int ph, int pw, int h, int w) {
"""
Rearrange matrix
columns into blocks
@param col the column
transposed image to convert
@param sy stride y
@param sx stride x
@param ph padding height
@param pw padding width
@param h height
@param w width
@return
"""
//number of images
long n = col.size(0);
//number of columns
long c = col.size(1);
//kernel height
long kh = col.size(2);
//kernel width
long kw = col.size(3);
//out height
long outH = col.size(4);
//out width
long outW = col.size(5);
INDArray img = Nd4j.create(n, c, h + 2 * ph + sy - 1, w + 2 * pw + sx - 1);
for (int i = 0; i < kh; i++) {
//iterate over the kernel rows
long iLim = i + sy * outH;
for (int j = 0; j < kw; j++) {
//iterate over the kernel columns
long jLim = j + sx * outW;
INDArrayIndex[] indices = new INDArrayIndex[] {NDArrayIndex.all(), NDArrayIndex.all(),
NDArrayIndex.interval(i, sy, iLim), NDArrayIndex.interval(j, sx, jLim)};
INDArray get = img.get(indices);
INDArray colAdd = col.get(NDArrayIndex.all(), NDArrayIndex.all(), NDArrayIndex.point(i),
NDArrayIndex.point(j), NDArrayIndex.all(), NDArrayIndex.all());
get.addi(colAdd);
img.put(indices, get);
}
}
//return the subset of the padded image relative to the height/width of the image and the padding width/height
return img.get(NDArrayIndex.all(), NDArrayIndex.all(), NDArrayIndex.interval(ph, ph + h),
NDArrayIndex.interval(pw, pw + w));
} | java | public static INDArray col2im(INDArray col, int sy, int sx, int ph, int pw, int h, int w) {
//number of images
long n = col.size(0);
//number of columns
long c = col.size(1);
//kernel height
long kh = col.size(2);
//kernel width
long kw = col.size(3);
//out height
long outH = col.size(4);
//out width
long outW = col.size(5);
INDArray img = Nd4j.create(n, c, h + 2 * ph + sy - 1, w + 2 * pw + sx - 1);
for (int i = 0; i < kh; i++) {
//iterate over the kernel rows
long iLim = i + sy * outH;
for (int j = 0; j < kw; j++) {
//iterate over the kernel columns
long jLim = j + sx * outW;
INDArrayIndex[] indices = new INDArrayIndex[] {NDArrayIndex.all(), NDArrayIndex.all(),
NDArrayIndex.interval(i, sy, iLim), NDArrayIndex.interval(j, sx, jLim)};
INDArray get = img.get(indices);
INDArray colAdd = col.get(NDArrayIndex.all(), NDArrayIndex.all(), NDArrayIndex.point(i),
NDArrayIndex.point(j), NDArrayIndex.all(), NDArrayIndex.all());
get.addi(colAdd);
img.put(indices, get);
}
}
//return the subset of the padded image relative to the height/width of the image and the padding width/height
return img.get(NDArrayIndex.all(), NDArrayIndex.all(), NDArrayIndex.interval(ph, ph + h),
NDArrayIndex.interval(pw, pw + w));
} | [
"public",
"static",
"INDArray",
"col2im",
"(",
"INDArray",
"col",
",",
"int",
"sy",
",",
"int",
"sx",
",",
"int",
"ph",
",",
"int",
"pw",
",",
"int",
"h",
",",
"int",
"w",
")",
"{",
"//number of images",
"long",
"n",
"=",
"col",
".",
"size",
"(",
... | Rearrange matrix
columns into blocks
@param col the column
transposed image to convert
@param sy stride y
@param sx stride x
@param ph padding height
@param pw padding width
@param h height
@param w width
@return | [
"Rearrange",
"matrix",
"columns",
"into",
"blocks"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/convolution/OldConvolution.java#L55-L92 |
marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClientImpl.java | MarkLogicClientImpl.performGraphQuery | public InputStream performGraphQuery(String queryString, SPARQLQueryBindingSet bindings, Transaction tx, boolean includeInferred, String baseURI) throws JsonProcessingException {
"""
executes GraphQuery
@param queryString
@param bindings
@param tx
@param includeInferred
@param baseURI
@return
@throws JsonProcessingException
"""
return performGraphQuery(queryString, bindings, new InputStreamHandle(), tx, includeInferred, baseURI);
} | java | public InputStream performGraphQuery(String queryString, SPARQLQueryBindingSet bindings, Transaction tx, boolean includeInferred, String baseURI) throws JsonProcessingException {
return performGraphQuery(queryString, bindings, new InputStreamHandle(), tx, includeInferred, baseURI);
} | [
"public",
"InputStream",
"performGraphQuery",
"(",
"String",
"queryString",
",",
"SPARQLQueryBindingSet",
"bindings",
",",
"Transaction",
"tx",
",",
"boolean",
"includeInferred",
",",
"String",
"baseURI",
")",
"throws",
"JsonProcessingException",
"{",
"return",
"perform... | executes GraphQuery
@param queryString
@param bindings
@param tx
@param includeInferred
@param baseURI
@return
@throws JsonProcessingException | [
"executes",
"GraphQuery"
] | train | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClientImpl.java#L185-L187 |
sarl/sarl | main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/MavenHelper.java | MavenHelper.getPluginDependencyVersion | public String getPluginDependencyVersion(String groupId, String artifactId) throws MojoExecutionException {
"""
Replies the version of the given plugin that is specified in the POM of the
plugin in which this mojo is located.
@param groupId the identifier of the group.
@param artifactId thidentifier of the artifact.
@return the version, never <code>null</code>
@throws MojoExecutionException if the plugin was not found.
"""
final Map<String, Dependency> deps = getPluginDependencies();
final String key = ArtifactUtils.versionlessKey(groupId, artifactId);
this.log.debug("COMPONENT DEPENDENCIES(getPluginVersionFromDependencies):"); //$NON-NLS-1$
this.log.debug(deps.toString());
final Dependency dep = deps.get(key);
if (dep != null) {
final String version = dep.getVersion();
if (version != null && !version.isEmpty()) {
return version;
}
throw new MojoExecutionException(MessageFormat.format(Messages.MavenHelper_2, key));
}
throw new MojoExecutionException(MessageFormat.format(Messages.MavenHelper_3, key, deps));
} | java | public String getPluginDependencyVersion(String groupId, String artifactId) throws MojoExecutionException {
final Map<String, Dependency> deps = getPluginDependencies();
final String key = ArtifactUtils.versionlessKey(groupId, artifactId);
this.log.debug("COMPONENT DEPENDENCIES(getPluginVersionFromDependencies):"); //$NON-NLS-1$
this.log.debug(deps.toString());
final Dependency dep = deps.get(key);
if (dep != null) {
final String version = dep.getVersion();
if (version != null && !version.isEmpty()) {
return version;
}
throw new MojoExecutionException(MessageFormat.format(Messages.MavenHelper_2, key));
}
throw new MojoExecutionException(MessageFormat.format(Messages.MavenHelper_3, key, deps));
} | [
"public",
"String",
"getPluginDependencyVersion",
"(",
"String",
"groupId",
",",
"String",
"artifactId",
")",
"throws",
"MojoExecutionException",
"{",
"final",
"Map",
"<",
"String",
",",
"Dependency",
">",
"deps",
"=",
"getPluginDependencies",
"(",
")",
";",
"fina... | Replies the version of the given plugin that is specified in the POM of the
plugin in which this mojo is located.
@param groupId the identifier of the group.
@param artifactId thidentifier of the artifact.
@return the version, never <code>null</code>
@throws MojoExecutionException if the plugin was not found. | [
"Replies",
"the",
"version",
"of",
"the",
"given",
"plugin",
"that",
"is",
"specified",
"in",
"the",
"POM",
"of",
"the",
"plugin",
"in",
"which",
"this",
"mojo",
"is",
"located",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/MavenHelper.java#L349-L363 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-classloader/xwiki-commons-classloader-protocols/xwiki-commons-classloader-protocol-jar/src/main/java/org/xwiki/classloader/internal/protocol/jar/JarURLConnection.java | JarURLConnection.parseSpecs | private void parseSpecs(URL url) throws MalformedURLException {
"""
/*
get the specs for a given url out of the cache, and compute and cache them if they're not there.
"""
String spec = url.getFile();
int separator = spec.indexOf('!');
/*
* REMIND: we don't handle nested JAR URLs
*/
if (separator == -1) {
throw new MalformedURLException("no ! found in url spec:" + spec);
}
// Get the protocol
String protocol = spec.substring(0, spec.indexOf(":"));
// This is the important part: we use a URL Stream Handler Factory to find the URL Stream handler to use for
// the nested protocol.
this.jarFileURL =
new URL(null, spec.substring(0, separator++), this.handlerFactory.createURLStreamHandler(protocol));
this.entryName = null;
/* if ! is the last letter of the innerURL, entryName is null */
if (++separator != spec.length()) {
this.entryName = spec.substring(separator, spec.length());
try {
// Note: we decode using UTF8 since it's the W3C recommendation.
// See http://www.w3.org/TR/html40/appendix/notes.html#non-ascii-chars
this.entryName = URLDecoder.decode(this.entryName, "UTF-8");
} catch (UnsupportedEncodingException e) {
// Not supporting UTF-8 as a valid encoding for some reasons. We consider XWiki cannot work
// without that encoding.
throw new RuntimeException("Failed to URL decode [" + this.entryName + "] using UTF-8.", e);
}
}
} | java | private void parseSpecs(URL url) throws MalformedURLException
{
String spec = url.getFile();
int separator = spec.indexOf('!');
/*
* REMIND: we don't handle nested JAR URLs
*/
if (separator == -1) {
throw new MalformedURLException("no ! found in url spec:" + spec);
}
// Get the protocol
String protocol = spec.substring(0, spec.indexOf(":"));
// This is the important part: we use a URL Stream Handler Factory to find the URL Stream handler to use for
// the nested protocol.
this.jarFileURL =
new URL(null, spec.substring(0, separator++), this.handlerFactory.createURLStreamHandler(protocol));
this.entryName = null;
/* if ! is the last letter of the innerURL, entryName is null */
if (++separator != spec.length()) {
this.entryName = spec.substring(separator, spec.length());
try {
// Note: we decode using UTF8 since it's the W3C recommendation.
// See http://www.w3.org/TR/html40/appendix/notes.html#non-ascii-chars
this.entryName = URLDecoder.decode(this.entryName, "UTF-8");
} catch (UnsupportedEncodingException e) {
// Not supporting UTF-8 as a valid encoding for some reasons. We consider XWiki cannot work
// without that encoding.
throw new RuntimeException("Failed to URL decode [" + this.entryName + "] using UTF-8.", e);
}
}
} | [
"private",
"void",
"parseSpecs",
"(",
"URL",
"url",
")",
"throws",
"MalformedURLException",
"{",
"String",
"spec",
"=",
"url",
".",
"getFile",
"(",
")",
";",
"int",
"separator",
"=",
"spec",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"/*\n * REMIND: ... | /*
get the specs for a given url out of the cache, and compute and cache them if they're not there. | [
"/",
"*",
"get",
"the",
"specs",
"for",
"a",
"given",
"url",
"out",
"of",
"the",
"cache",
"and",
"compute",
"and",
"cache",
"them",
"if",
"they",
"re",
"not",
"there",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-classloader/xwiki-commons-classloader-protocols/xwiki-commons-classloader-protocol-jar/src/main/java/org/xwiki/classloader/internal/protocol/jar/JarURLConnection.java#L120-L154 |
appium/java-client | src/main/java/io/appium/java_client/imagecomparison/FeaturesMatchingResult.java | FeaturesMatchingResult.getPoints2 | public List<Point> getPoints2() {
"""
Returns a list of matching points on the second image.
@return The list of matching points on the second image.
"""
verifyPropertyPresence(POINTS2);
//noinspection unchecked
return ((List<Map<String, Object>>) getCommandResult().get(POINTS2)).stream()
.map(ComparisonResult::mapToPoint)
.collect(Collectors.toList());
} | java | public List<Point> getPoints2() {
verifyPropertyPresence(POINTS2);
//noinspection unchecked
return ((List<Map<String, Object>>) getCommandResult().get(POINTS2)).stream()
.map(ComparisonResult::mapToPoint)
.collect(Collectors.toList());
} | [
"public",
"List",
"<",
"Point",
">",
"getPoints2",
"(",
")",
"{",
"verifyPropertyPresence",
"(",
"POINTS2",
")",
";",
"//noinspection unchecked",
"return",
"(",
"(",
"List",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
")",
"getCommandResult",
"(",
... | Returns a list of matching points on the second image.
@return The list of matching points on the second image. | [
"Returns",
"a",
"list",
"of",
"matching",
"points",
"on",
"the",
"second",
"image",
"."
] | train | https://github.com/appium/java-client/blob/5a17759b05d6fda8ef425b3ab6e766c73ed2e8df/src/main/java/io/appium/java_client/imagecomparison/FeaturesMatchingResult.java#L91-L97 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java | NetworkInterfacesInner.listEffectiveNetworkSecurityGroups | public EffectiveNetworkSecurityGroupListResultInner listEffectiveNetworkSecurityGroups(String resourceGroupName, String networkInterfaceName) {
"""
Gets all network security groups applied to a network interface.
@param resourceGroupName The name of the resource group.
@param networkInterfaceName The name of the network interface.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the EffectiveNetworkSecurityGroupListResultInner object if successful.
"""
return listEffectiveNetworkSecurityGroupsWithServiceResponseAsync(resourceGroupName, networkInterfaceName).toBlocking().last().body();
} | java | public EffectiveNetworkSecurityGroupListResultInner listEffectiveNetworkSecurityGroups(String resourceGroupName, String networkInterfaceName) {
return listEffectiveNetworkSecurityGroupsWithServiceResponseAsync(resourceGroupName, networkInterfaceName).toBlocking().last().body();
} | [
"public",
"EffectiveNetworkSecurityGroupListResultInner",
"listEffectiveNetworkSecurityGroups",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkInterfaceName",
")",
"{",
"return",
"listEffectiveNetworkSecurityGroupsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
... | Gets all network security groups applied to a network interface.
@param resourceGroupName The name of the resource group.
@param networkInterfaceName The name of the network interface.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the EffectiveNetworkSecurityGroupListResultInner object if successful. | [
"Gets",
"all",
"network",
"security",
"groups",
"applied",
"to",
"a",
"network",
"interface",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java#L1344-L1346 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/BlockVector.java | BlockVector.removeElementsAt | public final void removeElementsAt(int firstindex, int count) {
"""
Deletes the components in [firstindex, firstindex+ count-1]. Each component in
this vector with an index greater than firstindex+count-1
is shifted downward.
The firstindex+count-1 must be a value less than the current size of the vector.
@exception ArrayIndexOutOfBoundsException if the indices was invalid.
"""
if (tc.isEntryEnabled())
SibTr.entry(
tc,
"removeElementsAt",
new Object[] { new Integer(firstindex), new Integer(count)});
removeRange(firstindex, firstindex + count);
if (tc.isEntryEnabled())
SibTr.exit(tc, "removeElementsAt");
} | java | public final void removeElementsAt(int firstindex, int count)
{
if (tc.isEntryEnabled())
SibTr.entry(
tc,
"removeElementsAt",
new Object[] { new Integer(firstindex), new Integer(count)});
removeRange(firstindex, firstindex + count);
if (tc.isEntryEnabled())
SibTr.exit(tc, "removeElementsAt");
} | [
"public",
"final",
"void",
"removeElementsAt",
"(",
"int",
"firstindex",
",",
"int",
"count",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"removeElementsAt\"",
",",
"new",
"Object",
"[",
"]",
... | Deletes the components in [firstindex, firstindex+ count-1]. Each component in
this vector with an index greater than firstindex+count-1
is shifted downward.
The firstindex+count-1 must be a value less than the current size of the vector.
@exception ArrayIndexOutOfBoundsException if the indices was invalid. | [
"Deletes",
"the",
"components",
"in",
"[",
"firstindex",
"firstindex",
"+",
"count",
"-",
"1",
"]",
".",
"Each",
"component",
"in",
"this",
"vector",
"with",
"an",
"index",
"greater",
"than",
"firstindex",
"+",
"count",
"-",
"1",
"is",
"shifted",
"downward... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/BlockVector.java#L42-L54 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/journal/xmlhelpers/ContextXmlReader.java | ContextXmlReader.storeInMultiMap | private void storeInMultiMap(MultiValueMap<String> map, String key, String[] values)
throws JournalException {
"""
This method is just to guard against the totally bogus Exception
declaration in MultiValueMap.set()
"""
try {
map.set(key, values);
} catch (Exception e) {
// totally bogus Exception here.
throw new JournalException(e);
}
} | java | private void storeInMultiMap(MultiValueMap<String> map, String key, String[] values)
throws JournalException {
try {
map.set(key, values);
} catch (Exception e) {
// totally bogus Exception here.
throw new JournalException(e);
}
} | [
"private",
"void",
"storeInMultiMap",
"(",
"MultiValueMap",
"<",
"String",
">",
"map",
",",
"String",
"key",
",",
"String",
"[",
"]",
"values",
")",
"throws",
"JournalException",
"{",
"try",
"{",
"map",
".",
"set",
"(",
"key",
",",
"values",
")",
";",
... | This method is just to guard against the totally bogus Exception
declaration in MultiValueMap.set() | [
"This",
"method",
"is",
"just",
"to",
"guard",
"against",
"the",
"totally",
"bogus",
"Exception",
"declaration",
"in",
"MultiValueMap",
".",
"set",
"()"
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/xmlhelpers/ContextXmlReader.java#L197-L205 |
coopernurse/barrister-java | src/main/java/com/bitmechanic/barrister/Server.java | Server.addHandler | public synchronized void addHandler(Class iface, Object handler) {
"""
Associates the handler instance with the given IDL interface. Replaces
an existing handler for this iface if one was previously registered.
@param iface Interface class that this handler implements. This is usually
an Idl2Java generated interface Class
@param handler Object that implements iface. Generally one of your application classes
@throws IllegalArgumentException if iface is not an interface on this Server's Contract
or if handler cannot be cast to iface
"""
try {
iface.cast(handler);
}
catch (Exception e) {
throw new IllegalArgumentException("Handler: " + handler.getClass().getName() +
" does not implement: " + iface.getName());
}
if (contract.getInterfaces().get(iface.getSimpleName()) == null) {
throw new IllegalArgumentException("Interface: " + iface.getName() +
" is not a part of this Contract");
}
if (contract.getPackage() == null) {
setContractPackage(iface);
}
handlers.put(iface.getSimpleName(), handler);
} | java | public synchronized void addHandler(Class iface, Object handler) {
try {
iface.cast(handler);
}
catch (Exception e) {
throw new IllegalArgumentException("Handler: " + handler.getClass().getName() +
" does not implement: " + iface.getName());
}
if (contract.getInterfaces().get(iface.getSimpleName()) == null) {
throw new IllegalArgumentException("Interface: " + iface.getName() +
" is not a part of this Contract");
}
if (contract.getPackage() == null) {
setContractPackage(iface);
}
handlers.put(iface.getSimpleName(), handler);
} | [
"public",
"synchronized",
"void",
"addHandler",
"(",
"Class",
"iface",
",",
"Object",
"handler",
")",
"{",
"try",
"{",
"iface",
".",
"cast",
"(",
"handler",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"IllegalArgumentException"... | Associates the handler instance with the given IDL interface. Replaces
an existing handler for this iface if one was previously registered.
@param iface Interface class that this handler implements. This is usually
an Idl2Java generated interface Class
@param handler Object that implements iface. Generally one of your application classes
@throws IllegalArgumentException if iface is not an interface on this Server's Contract
or if handler cannot be cast to iface | [
"Associates",
"the",
"handler",
"instance",
"with",
"the",
"given",
"IDL",
"interface",
".",
"Replaces",
"an",
"existing",
"handler",
"for",
"this",
"iface",
"if",
"one",
"was",
"previously",
"registered",
"."
] | train | https://github.com/coopernurse/barrister-java/blob/c2b639634c88a25002b66d1fb4a8f5fb51ade6a2/src/main/java/com/bitmechanic/barrister/Server.java#L76-L95 |
apache/incubator-gobblin | gobblin-core-base/src/main/java/org/apache/gobblin/converter/AsyncConverter1to1.java | AsyncConverter1to1.processStream | @Override
public RecordStreamWithMetadata<DO, SO> processStream(RecordStreamWithMetadata<DI, SI> inputStream,
WorkUnitState workUnitState) throws SchemaConversionException {
"""
Return a {@link RecordStreamWithMetadata} with the appropriate modifications.
@param inputStream
@param workUnitState
@return
@throws SchemaConversionException
@implNote this processStream does not handle {@link org.apache.gobblin.stream.MetadataUpdateControlMessage}s
"""
int maxConcurrentAsyncConversions = workUnitState.getPropAsInt(MAX_CONCURRENT_ASYNC_CONVERSIONS_KEY,
DEFAULT_MAX_CONCURRENT_ASYNC_CONVERSIONS);
SO outputSchema = convertSchema(inputStream.getGlobalMetadata().getSchema(), workUnitState);
Flowable<StreamEntity<DO>> outputStream =
inputStream.getRecordStream()
.flatMapSingle(in -> {
if (in instanceof ControlMessage) {
getMessageHandler().handleMessage((ControlMessage) in);
return Single.just((ControlMessage<DO>) in);
} else if (in instanceof RecordEnvelope) {
RecordEnvelope<DI> recordEnvelope = (RecordEnvelope<DI>) in;
return new SingleAsync(recordEnvelope, convertRecordAsync(outputSchema, recordEnvelope.getRecord(), workUnitState));
} else {
throw new IllegalStateException("Expected ControlMessage or RecordEnvelope.");
}
}, false, maxConcurrentAsyncConversions);
return inputStream.withRecordStream(outputStream, GlobalMetadata.<SI, SO>builderWithInput(inputStream.getGlobalMetadata(),
Optional.fromNullable(outputSchema)).build());
} | java | @Override
public RecordStreamWithMetadata<DO, SO> processStream(RecordStreamWithMetadata<DI, SI> inputStream,
WorkUnitState workUnitState) throws SchemaConversionException {
int maxConcurrentAsyncConversions = workUnitState.getPropAsInt(MAX_CONCURRENT_ASYNC_CONVERSIONS_KEY,
DEFAULT_MAX_CONCURRENT_ASYNC_CONVERSIONS);
SO outputSchema = convertSchema(inputStream.getGlobalMetadata().getSchema(), workUnitState);
Flowable<StreamEntity<DO>> outputStream =
inputStream.getRecordStream()
.flatMapSingle(in -> {
if (in instanceof ControlMessage) {
getMessageHandler().handleMessage((ControlMessage) in);
return Single.just((ControlMessage<DO>) in);
} else if (in instanceof RecordEnvelope) {
RecordEnvelope<DI> recordEnvelope = (RecordEnvelope<DI>) in;
return new SingleAsync(recordEnvelope, convertRecordAsync(outputSchema, recordEnvelope.getRecord(), workUnitState));
} else {
throw new IllegalStateException("Expected ControlMessage or RecordEnvelope.");
}
}, false, maxConcurrentAsyncConversions);
return inputStream.withRecordStream(outputStream, GlobalMetadata.<SI, SO>builderWithInput(inputStream.getGlobalMetadata(),
Optional.fromNullable(outputSchema)).build());
} | [
"@",
"Override",
"public",
"RecordStreamWithMetadata",
"<",
"DO",
",",
"SO",
">",
"processStream",
"(",
"RecordStreamWithMetadata",
"<",
"DI",
",",
"SI",
">",
"inputStream",
",",
"WorkUnitState",
"workUnitState",
")",
"throws",
"SchemaConversionException",
"{",
"int... | Return a {@link RecordStreamWithMetadata} with the appropriate modifications.
@param inputStream
@param workUnitState
@return
@throws SchemaConversionException
@implNote this processStream does not handle {@link org.apache.gobblin.stream.MetadataUpdateControlMessage}s | [
"Return",
"a",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core-base/src/main/java/org/apache/gobblin/converter/AsyncConverter1to1.java#L78-L99 |
agentgt/jirm | jirm-core/src/main/java/co/jirm/core/util/ResourceUtils.java | ResourceUtils.resolveName | private static String resolveName(Class<?> c, String name) {
"""
/*
Add a package name prefix if the name is not absolute Remove leading "/"
if name is absolute
"""
if (name == null) {
return name;
}
if (!name.startsWith("/")) {
while (c.isArray()) {
c = c.getComponentType();
}
String baseName = c.getName();
int index = baseName.lastIndexOf('.');
if (index != -1) {
name = baseName.substring(0, index).replace('.', '/')
+"/"+name;
}
} else {
name = name.substring(1);
}
return name;
} | java | private static String resolveName(Class<?> c, String name) {
if (name == null) {
return name;
}
if (!name.startsWith("/")) {
while (c.isArray()) {
c = c.getComponentType();
}
String baseName = c.getName();
int index = baseName.lastIndexOf('.');
if (index != -1) {
name = baseName.substring(0, index).replace('.', '/')
+"/"+name;
}
} else {
name = name.substring(1);
}
return name;
} | [
"private",
"static",
"String",
"resolveName",
"(",
"Class",
"<",
"?",
">",
"c",
",",
"String",
"name",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"return",
"name",
";",
"}",
"if",
"(",
"!",
"name",
".",
"startsWith",
"(",
"\"/\"",
")",
... | /*
Add a package name prefix if the name is not absolute Remove leading "/"
if name is absolute | [
"/",
"*",
"Add",
"a",
"package",
"name",
"prefix",
"if",
"the",
"name",
"is",
"not",
"absolute",
"Remove",
"leading",
"/",
"if",
"name",
"is",
"absolute"
] | train | https://github.com/agentgt/jirm/blob/95a2fcdef4121c439053524407af3d4ce8035722/jirm-core/src/main/java/co/jirm/core/util/ResourceUtils.java#L102-L120 |
aws/aws-sdk-java | aws-java-sdk-sns/src/main/java/com/amazonaws/services/sns/model/CreatePlatformEndpointRequest.java | CreatePlatformEndpointRequest.getAttributes | public java.util.Map<String, String> getAttributes() {
"""
<p>
For a list of attributes, see <a
href="https://docs.aws.amazon.com/sns/latest/api/API_SetEndpointAttributes.html">SetEndpointAttributes</a>.
</p>
@return For a list of attributes, see <a
href="https://docs.aws.amazon.com/sns/latest/api/API_SetEndpointAttributes.html"
>SetEndpointAttributes</a>.
"""
if (attributes == null) {
attributes = new com.amazonaws.internal.SdkInternalMap<String, String>();
}
return attributes;
} | java | public java.util.Map<String, String> getAttributes() {
if (attributes == null) {
attributes = new com.amazonaws.internal.SdkInternalMap<String, String>();
}
return attributes;
} | [
"public",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"getAttributes",
"(",
")",
"{",
"if",
"(",
"attributes",
"==",
"null",
")",
"{",
"attributes",
"=",
"new",
"com",
".",
"amazonaws",
".",
"internal",
".",
"SdkInternalMap",
"<... | <p>
For a list of attributes, see <a
href="https://docs.aws.amazon.com/sns/latest/api/API_SetEndpointAttributes.html">SetEndpointAttributes</a>.
</p>
@return For a list of attributes, see <a
href="https://docs.aws.amazon.com/sns/latest/api/API_SetEndpointAttributes.html"
>SetEndpointAttributes</a>. | [
"<p",
">",
"For",
"a",
"list",
"of",
"attributes",
"see",
"<a",
"href",
"=",
"https",
":",
"//",
"docs",
".",
"aws",
".",
"amazon",
".",
"com",
"/",
"sns",
"/",
"latest",
"/",
"api",
"/",
"API_SetEndpointAttributes",
".",
"html",
">",
"SetEndpointAttri... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-sns/src/main/java/com/amazonaws/services/sns/model/CreatePlatformEndpointRequest.java#L216-L221 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.authorization.jacc.web/src/com/ibm/ws/security/authorization/jacc/web/impl/WebSecurityPropagatorImpl.java | WebSecurityPropagatorImpl.isUnqualified | private boolean isUnqualified(String url, String urlPattern) {
"""
***********************************************************************
Any pattern, qualified by a pattern that matches it, is overridden and
made irrelevant (in the translation) by the qualifying pattern.
Specifically, all extension patterns and the default pattern are made
irrelevant by the presence of the path prefix pattern "/*" in a
deployment descriptor.
************************************************************************
"""
boolean unqualified = false;
if (urlPattern.indexOf(":") != -1) {
int idx = urlPattern.indexOf(":");
StringTokenizer st = new StringTokenizer(urlPattern.substring(idx + 1), ":");
while (st.hasMoreTokens()) {
if (urlPatternMatch(st.nextToken(), url)) {
unqualified = true;
break;
}
}
}
return unqualified;
} | java | private boolean isUnqualified(String url, String urlPattern) {
boolean unqualified = false;
if (urlPattern.indexOf(":") != -1) {
int idx = urlPattern.indexOf(":");
StringTokenizer st = new StringTokenizer(urlPattern.substring(idx + 1), ":");
while (st.hasMoreTokens()) {
if (urlPatternMatch(st.nextToken(), url)) {
unqualified = true;
break;
}
}
}
return unqualified;
} | [
"private",
"boolean",
"isUnqualified",
"(",
"String",
"url",
",",
"String",
"urlPattern",
")",
"{",
"boolean",
"unqualified",
"=",
"false",
";",
"if",
"(",
"urlPattern",
".",
"indexOf",
"(",
"\":\"",
")",
"!=",
"-",
"1",
")",
"{",
"int",
"idx",
"=",
"u... | ***********************************************************************
Any pattern, qualified by a pattern that matches it, is overridden and
made irrelevant (in the translation) by the qualifying pattern.
Specifically, all extension patterns and the default pattern are made
irrelevant by the presence of the path prefix pattern "/*" in a
deployment descriptor.
************************************************************************ | [
"***********************************************************************",
"Any",
"pattern",
"qualified",
"by",
"a",
"pattern",
"that",
"matches",
"it",
"is",
"overridden",
"and",
"made",
"irrelevant",
"(",
"in",
"the",
"translation",
")",
"by",
"the",
"qualifying",
"pa... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authorization.jacc.web/src/com/ibm/ws/security/authorization/jacc/web/impl/WebSecurityPropagatorImpl.java#L462-L475 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbDatabaseMetaData.java | MariaDbDatabaseMetaData.patternCond | private String patternCond(String columnName, String tableName) {
"""
Helper to generate information schema queries with "like" or "equals" condition (typically on table name)
"""
if (tableName == null) {
return "(1 = 1)";
}
String predicate =
(tableName.indexOf('%') == -1 && tableName.indexOf('_') == -1) ? "=" : "LIKE";
return "(" + columnName + " " + predicate + " '" + Utils.escapeString(tableName, true) + "')";
} | java | private String patternCond(String columnName, String tableName) {
if (tableName == null) {
return "(1 = 1)";
}
String predicate =
(tableName.indexOf('%') == -1 && tableName.indexOf('_') == -1) ? "=" : "LIKE";
return "(" + columnName + " " + predicate + " '" + Utils.escapeString(tableName, true) + "')";
} | [
"private",
"String",
"patternCond",
"(",
"String",
"columnName",
",",
"String",
"tableName",
")",
"{",
"if",
"(",
"tableName",
"==",
"null",
")",
"{",
"return",
"\"(1 = 1)\"",
";",
"}",
"String",
"predicate",
"=",
"(",
"tableName",
".",
"indexOf",
"(",
"'"... | Helper to generate information schema queries with "like" or "equals" condition (typically on table name) | [
"Helper",
"to",
"generate",
"information",
"schema",
"queries",
"with",
"like",
"or",
"equals",
"condition",
"(",
"typically",
"on",
"table",
"name",
")"
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbDatabaseMetaData.java#L518-L525 |
UrielCh/ovh-java-sdk | ovh-java-sdk-store/src/main/java/net/minidev/ovh/api/ApiOvhStore.java | ApiOvhStore.partner_partnerId_product_GET | public ArrayList<OvhEditResponse> partner_partnerId_product_GET(String partnerId) throws IOException {
"""
List partner's products
REST: GET /store/partner/{partnerId}/product
@param partnerId [required] Id of the partner
API beta
"""
String qPath = "/store/partner/{partnerId}/product";
StringBuilder sb = path(qPath, partnerId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t5);
} | java | public ArrayList<OvhEditResponse> partner_partnerId_product_GET(String partnerId) throws IOException {
String qPath = "/store/partner/{partnerId}/product";
StringBuilder sb = path(qPath, partnerId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t5);
} | [
"public",
"ArrayList",
"<",
"OvhEditResponse",
">",
"partner_partnerId_product_GET",
"(",
"String",
"partnerId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/store/partner/{partnerId}/product\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
... | List partner's products
REST: GET /store/partner/{partnerId}/product
@param partnerId [required] Id of the partner
API beta | [
"List",
"partner",
"s",
"products"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-store/src/main/java/net/minidev/ovh/api/ApiOvhStore.java#L528-L533 |
line/armeria | core/src/main/java/com/linecorp/armeria/client/Clients.java | Clients.withHttpHeader | public static SafeCloseable withHttpHeader(AsciiString name, String value) {
"""
Sets the specified HTTP header in a thread-local variable so that the header is sent by the client call
made from the current thread. Use the `try-with-resources` block with the returned
{@link SafeCloseable} to unset the thread-local variable automatically:
<pre>{@code
import static com.linecorp.armeria.common.HttpHeaderNames.AUTHORIZATION;
try (SafeCloseable ignored = withHttpHeader(AUTHORIZATION, myCredential)) {
client.executeSomething(..);
}
}</pre>
You can also nest the header manipulation:
<pre>{@code
import static com.linecorp.armeria.common.HttpHeaderNames.AUTHORIZATION;
import static com.linecorp.armeria.common.HttpHeaderNames.USER_AGENT;
try (SafeCloseable ignored = withHttpHeader(USER_AGENT, myAgent)) {
for (String secret : secrets) {
try (SafeCloseable ignored2 = withHttpHeader(AUTHORIZATION, secret)) {
// Both USER_AGENT and AUTHORIZATION will be set.
client.executeSomething(..);
}
}
}
}</pre>
@see #withHttpHeaders(Function)
"""
requireNonNull(name, "name");
requireNonNull(value, "value");
return withHttpHeaders(headers -> headers.set(name, value));
} | java | public static SafeCloseable withHttpHeader(AsciiString name, String value) {
requireNonNull(name, "name");
requireNonNull(value, "value");
return withHttpHeaders(headers -> headers.set(name, value));
} | [
"public",
"static",
"SafeCloseable",
"withHttpHeader",
"(",
"AsciiString",
"name",
",",
"String",
"value",
")",
"{",
"requireNonNull",
"(",
"name",
",",
"\"name\"",
")",
";",
"requireNonNull",
"(",
"value",
",",
"\"value\"",
")",
";",
"return",
"withHttpHeaders"... | Sets the specified HTTP header in a thread-local variable so that the header is sent by the client call
made from the current thread. Use the `try-with-resources` block with the returned
{@link SafeCloseable} to unset the thread-local variable automatically:
<pre>{@code
import static com.linecorp.armeria.common.HttpHeaderNames.AUTHORIZATION;
try (SafeCloseable ignored = withHttpHeader(AUTHORIZATION, myCredential)) {
client.executeSomething(..);
}
}</pre>
You can also nest the header manipulation:
<pre>{@code
import static com.linecorp.armeria.common.HttpHeaderNames.AUTHORIZATION;
import static com.linecorp.armeria.common.HttpHeaderNames.USER_AGENT;
try (SafeCloseable ignored = withHttpHeader(USER_AGENT, myAgent)) {
for (String secret : secrets) {
try (SafeCloseable ignored2 = withHttpHeader(AUTHORIZATION, secret)) {
// Both USER_AGENT and AUTHORIZATION will be set.
client.executeSomething(..);
}
}
}
}</pre>
@see #withHttpHeaders(Function) | [
"Sets",
"the",
"specified",
"HTTP",
"header",
"in",
"a",
"thread",
"-",
"local",
"variable",
"so",
"that",
"the",
"header",
"is",
"sent",
"by",
"the",
"client",
"call",
"made",
"from",
"the",
"current",
"thread",
".",
"Use",
"the",
"try",
"-",
"with",
... | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/Clients.java#L291-L295 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/ListWidget.java | ListWidget.getViewFromAdapter | protected Widget getViewFromAdapter(final int index, ListItemHostWidget host) {
"""
Get view displays the data at the specified position in the {@link Adapter}
@param index - item index in {@link Adapter}
@param host - view using as a host for the adapter view
@return view displays the data at the specified position
"""
return mAdapter == null ? null : mAdapter.getView(index, host.getGuest(), host);
} | java | protected Widget getViewFromAdapter(final int index, ListItemHostWidget host) {
return mAdapter == null ? null : mAdapter.getView(index, host.getGuest(), host);
} | [
"protected",
"Widget",
"getViewFromAdapter",
"(",
"final",
"int",
"index",
",",
"ListItemHostWidget",
"host",
")",
"{",
"return",
"mAdapter",
"==",
"null",
"?",
"null",
":",
"mAdapter",
".",
"getView",
"(",
"index",
",",
"host",
".",
"getGuest",
"(",
")",
... | Get view displays the data at the specified position in the {@link Adapter}
@param index - item index in {@link Adapter}
@param host - view using as a host for the adapter view
@return view displays the data at the specified position | [
"Get",
"view",
"displays",
"the",
"data",
"at",
"the",
"specified",
"position",
"in",
"the",
"{"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/ListWidget.java#L951-L953 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/opengl/CursorLoader.java | CursorLoader.getCursor | public Cursor getCursor(ImageData imageData,int x,int y) throws IOException, LWJGLException {
"""
Get a cursor based on a set of image data
@param imageData The data from which the cursor can read it's contents
@param x The x-coordinate of the cursor hotspot (left -> right)
@param y The y-coordinate of the cursor hotspot (bottom -> top)
@return The create cursor
@throws IOException Indicates a failure to load the image
@throws LWJGLException Indicates a failure to create the hardware cursor
"""
ByteBuffer buf = imageData.getImageBufferData();
for (int i=0;i<buf.limit();i+=4) {
byte red = buf.get(i);
byte green = buf.get(i+1);
byte blue = buf.get(i+2);
byte alpha = buf.get(i+3);
buf.put(i+2, red);
buf.put(i+1, green);
buf.put(i, blue);
buf.put(i+3, alpha);
}
try {
int yspot = imageData.getHeight() - y - 1;
if (yspot < 0) {
yspot = 0;
}
return new Cursor(imageData.getTexWidth(), imageData.getTexHeight(), x, yspot, 1, buf.asIntBuffer(), null);
} catch (Throwable e) {
Log.info("Chances are you cursor is too small for this platform");
throw new LWJGLException(e);
}
} | java | public Cursor getCursor(ImageData imageData,int x,int y) throws IOException, LWJGLException {
ByteBuffer buf = imageData.getImageBufferData();
for (int i=0;i<buf.limit();i+=4) {
byte red = buf.get(i);
byte green = buf.get(i+1);
byte blue = buf.get(i+2);
byte alpha = buf.get(i+3);
buf.put(i+2, red);
buf.put(i+1, green);
buf.put(i, blue);
buf.put(i+3, alpha);
}
try {
int yspot = imageData.getHeight() - y - 1;
if (yspot < 0) {
yspot = 0;
}
return new Cursor(imageData.getTexWidth(), imageData.getTexHeight(), x, yspot, 1, buf.asIntBuffer(), null);
} catch (Throwable e) {
Log.info("Chances are you cursor is too small for this platform");
throw new LWJGLException(e);
}
} | [
"public",
"Cursor",
"getCursor",
"(",
"ImageData",
"imageData",
",",
"int",
"x",
",",
"int",
"y",
")",
"throws",
"IOException",
",",
"LWJGLException",
"{",
"ByteBuffer",
"buf",
"=",
"imageData",
".",
"getImageBufferData",
"(",
")",
";",
"for",
"(",
"int",
... | Get a cursor based on a set of image data
@param imageData The data from which the cursor can read it's contents
@param x The x-coordinate of the cursor hotspot (left -> right)
@param y The y-coordinate of the cursor hotspot (bottom -> top)
@return The create cursor
@throws IOException Indicates a failure to load the image
@throws LWJGLException Indicates a failure to create the hardware cursor | [
"Get",
"a",
"cursor",
"based",
"on",
"a",
"set",
"of",
"image",
"data"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/opengl/CursorLoader.java#L129-L153 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java | MutableURI.setOpaque | public void setOpaque( String scheme, String schemeSpecificPart ) {
"""
Sets the URI to be opaque using the given scheme and
schemeSpecificPart.
<p> From {@link URI}: "A URI is opaque if, and only
if, it is absolute and its scheme-specific part does not begin with
a slash character ('/'). An opaque URI has a scheme, a
scheme-specific part, and possibly a fragment; all other components
are undefined." </p>
@param scheme the scheme component of this URI
@param schemeSpecificPart the scheme-specific part of this URI
"""
if ( scheme == null || scheme.length() == 0
|| schemeSpecificPart == null
|| schemeSpecificPart.length() == 0
|| schemeSpecificPart.indexOf( '/' ) > 0 )
{
throw new IllegalArgumentException( "Not a proper opaque URI." );
}
_opaque = true;
setScheme( scheme );
setSchemeSpecificPart( schemeSpecificPart );
setUserInfo( null );
setHost( null );
setPort( UNDEFINED_PORT );
setPath( null );
setQuery( null );
} | java | public void setOpaque( String scheme, String schemeSpecificPart )
{
if ( scheme == null || scheme.length() == 0
|| schemeSpecificPart == null
|| schemeSpecificPart.length() == 0
|| schemeSpecificPart.indexOf( '/' ) > 0 )
{
throw new IllegalArgumentException( "Not a proper opaque URI." );
}
_opaque = true;
setScheme( scheme );
setSchemeSpecificPart( schemeSpecificPart );
setUserInfo( null );
setHost( null );
setPort( UNDEFINED_PORT );
setPath( null );
setQuery( null );
} | [
"public",
"void",
"setOpaque",
"(",
"String",
"scheme",
",",
"String",
"schemeSpecificPart",
")",
"{",
"if",
"(",
"scheme",
"==",
"null",
"||",
"scheme",
".",
"length",
"(",
")",
"==",
"0",
"||",
"schemeSpecificPart",
"==",
"null",
"||",
"schemeSpecificPart"... | Sets the URI to be opaque using the given scheme and
schemeSpecificPart.
<p> From {@link URI}: "A URI is opaque if, and only
if, it is absolute and its scheme-specific part does not begin with
a slash character ('/'). An opaque URI has a scheme, a
scheme-specific part, and possibly a fragment; all other components
are undefined." </p>
@param scheme the scheme component of this URI
@param schemeSpecificPart the scheme-specific part of this URI | [
"Sets",
"the",
"URI",
"to",
"be",
"opaque",
"using",
"the",
"given",
"scheme",
"and",
"schemeSpecificPart",
".",
"<p",
">",
"From",
"{",
"@link",
"URI",
"}",
":",
""",
";",
"A",
"URI",
"is",
"opaque",
"if",
"and",
"only",
"if",
"it",
"is",
"absol... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java#L799-L817 |
OrienteerBAP/wicket-orientdb | wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/OSchemaHelper.java | OSchemaHelper.oClass | public OSchemaHelper oClass(String className, String... superClasses) {
"""
Create if required {@link OClass}
@param className name of a class to create
@param superClasses list of superclasses
@return this helper
"""
return oClass(className, false, superClasses);
} | java | public OSchemaHelper oClass(String className, String... superClasses)
{
return oClass(className, false, superClasses);
} | [
"public",
"OSchemaHelper",
"oClass",
"(",
"String",
"className",
",",
"String",
"...",
"superClasses",
")",
"{",
"return",
"oClass",
"(",
"className",
",",
"false",
",",
"superClasses",
")",
";",
"}"
] | Create if required {@link OClass}
@param className name of a class to create
@param superClasses list of superclasses
@return this helper | [
"Create",
"if",
"required",
"{"
] | train | https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/OSchemaHelper.java#L65-L68 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineImagesInner.java | VirtualMachineImagesInner.listOffersAsync | public Observable<List<VirtualMachineImageResourceInner>> listOffersAsync(String location, String publisherName) {
"""
Gets a list of virtual machine image offers for the specified location and publisher.
@param location The name of a supported Azure region.
@param publisherName A valid image publisher.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<VirtualMachineImageResourceInner> object
"""
return listOffersWithServiceResponseAsync(location, publisherName).map(new Func1<ServiceResponse<List<VirtualMachineImageResourceInner>>, List<VirtualMachineImageResourceInner>>() {
@Override
public List<VirtualMachineImageResourceInner> call(ServiceResponse<List<VirtualMachineImageResourceInner>> response) {
return response.body();
}
});
} | java | public Observable<List<VirtualMachineImageResourceInner>> listOffersAsync(String location, String publisherName) {
return listOffersWithServiceResponseAsync(location, publisherName).map(new Func1<ServiceResponse<List<VirtualMachineImageResourceInner>>, List<VirtualMachineImageResourceInner>>() {
@Override
public List<VirtualMachineImageResourceInner> call(ServiceResponse<List<VirtualMachineImageResourceInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"VirtualMachineImageResourceInner",
">",
">",
"listOffersAsync",
"(",
"String",
"location",
",",
"String",
"publisherName",
")",
"{",
"return",
"listOffersWithServiceResponseAsync",
"(",
"location",
",",
"publisherName",
")",
... | Gets a list of virtual machine image offers for the specified location and publisher.
@param location The name of a supported Azure region.
@param publisherName A valid image publisher.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<VirtualMachineImageResourceInner> object | [
"Gets",
"a",
"list",
"of",
"virtual",
"machine",
"image",
"offers",
"for",
"the",
"specified",
"location",
"and",
"publisher",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineImagesInner.java#L427-L434 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java | SqlQueryStatement.appendNullCriteria | private void appendNullCriteria(TableAlias alias, PathInfo pathInfo, NullCriteria c, StringBuffer buf) {
"""
Answer the SQL-Clause for a NullCriteria
@param alias
@param pathInfo
@param c NullCriteria
@param buf
"""
appendColName(alias, pathInfo, c.isTranslateAttribute(), buf);
buf.append(c.getClause());
} | java | private void appendNullCriteria(TableAlias alias, PathInfo pathInfo, NullCriteria c, StringBuffer buf)
{
appendColName(alias, pathInfo, c.isTranslateAttribute(), buf);
buf.append(c.getClause());
} | [
"private",
"void",
"appendNullCriteria",
"(",
"TableAlias",
"alias",
",",
"PathInfo",
"pathInfo",
",",
"NullCriteria",
"c",
",",
"StringBuffer",
"buf",
")",
"{",
"appendColName",
"(",
"alias",
",",
"pathInfo",
",",
"c",
".",
"isTranslateAttribute",
"(",
")",
"... | Answer the SQL-Clause for a NullCriteria
@param alias
@param pathInfo
@param c NullCriteria
@param buf | [
"Answer",
"the",
"SQL",
"-",
"Clause",
"for",
"a",
"NullCriteria"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java#L799-L803 |
diffplug/durian | src/com/diffplug/common/base/TreeComparison.java | TreeComparison.assertEqualMappedBy | public void assertEqualMappedBy(Function<? super E, ?> expectedMapper, Function<? super A, ?> actualMapper) {
"""
Asserts that the trees are equal, by calling {@link Objects#equals(Object, Object)} on the results of both mappers.
@see #isEqualMappedBy(Function, Function)
"""
if (!isEqualMappedBy(expectedMapper, actualMapper)) {
throwAssertionError();
}
} | java | public void assertEqualMappedBy(Function<? super E, ?> expectedMapper, Function<? super A, ?> actualMapper) {
if (!isEqualMappedBy(expectedMapper, actualMapper)) {
throwAssertionError();
}
} | [
"public",
"void",
"assertEqualMappedBy",
"(",
"Function",
"<",
"?",
"super",
"E",
",",
"?",
">",
"expectedMapper",
",",
"Function",
"<",
"?",
"super",
"A",
",",
"?",
">",
"actualMapper",
")",
"{",
"if",
"(",
"!",
"isEqualMappedBy",
"(",
"expectedMapper",
... | Asserts that the trees are equal, by calling {@link Objects#equals(Object, Object)} on the results of both mappers.
@see #isEqualMappedBy(Function, Function) | [
"Asserts",
"that",
"the",
"trees",
"are",
"equal",
"by",
"calling",
"{",
"@link",
"Objects#equals",
"(",
"Object",
"Object",
")",
"}",
"on",
"the",
"results",
"of",
"both",
"mappers",
"."
] | train | https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/TreeComparison.java#L84-L88 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/CredentialsInner.java | CredentialsInner.createOrUpdateAsync | public Observable<CredentialInner> createOrUpdateAsync(String resourceGroupName, String automationAccountName, String credentialName, CredentialCreateOrUpdateParameters parameters) {
"""
Create a credential.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param credentialName The parameters supplied to the create or update credential operation.
@param parameters The parameters supplied to the create or update credential operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the CredentialInner object
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, credentialName, parameters).map(new Func1<ServiceResponse<CredentialInner>, CredentialInner>() {
@Override
public CredentialInner call(ServiceResponse<CredentialInner> response) {
return response.body();
}
});
} | java | public Observable<CredentialInner> createOrUpdateAsync(String resourceGroupName, String automationAccountName, String credentialName, CredentialCreateOrUpdateParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, credentialName, parameters).map(new Func1<ServiceResponse<CredentialInner>, CredentialInner>() {
@Override
public CredentialInner call(ServiceResponse<CredentialInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"CredentialInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"String",
"credentialName",
",",
"CredentialCreateOrUpdateParameters",
"parameters",
")",
"{",
"return",
"createOrUpd... | Create a credential.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param credentialName The parameters supplied to the create or update credential operation.
@param parameters The parameters supplied to the create or update credential operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the CredentialInner object | [
"Create",
"a",
"credential",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/CredentialsInner.java#L316-L323 |
Azure/azure-sdk-for-java | datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/ComputePoliciesInner.java | ComputePoliciesInner.getAsync | public Observable<ComputePolicyInner> getAsync(String resourceGroupName, String accountName, String computePolicyName) {
"""
Gets the specified Data Lake Analytics compute policy.
@param resourceGroupName The name of the Azure resource group.
@param accountName The name of the Data Lake Analytics account.
@param computePolicyName The name of the compute policy to retrieve.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ComputePolicyInner object
"""
return getWithServiceResponseAsync(resourceGroupName, accountName, computePolicyName).map(new Func1<ServiceResponse<ComputePolicyInner>, ComputePolicyInner>() {
@Override
public ComputePolicyInner call(ServiceResponse<ComputePolicyInner> response) {
return response.body();
}
});
} | java | public Observable<ComputePolicyInner> getAsync(String resourceGroupName, String accountName, String computePolicyName) {
return getWithServiceResponseAsync(resourceGroupName, accountName, computePolicyName).map(new Func1<ServiceResponse<ComputePolicyInner>, ComputePolicyInner>() {
@Override
public ComputePolicyInner call(ServiceResponse<ComputePolicyInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ComputePolicyInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"computePolicyName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
","... | Gets the specified Data Lake Analytics compute policy.
@param resourceGroupName The name of the Azure resource group.
@param accountName The name of the Data Lake Analytics account.
@param computePolicyName The name of the compute policy to retrieve.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ComputePolicyInner object | [
"Gets",
"the",
"specified",
"Data",
"Lake",
"Analytics",
"compute",
"policy",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/ComputePoliciesInner.java#L355-L362 |
rythmengine/rythmengine | src/main/java/org/rythmengine/utils/IO.java | IO.writeContent | public static void writeContent(CharSequence content, File file, String encoding) {
"""
Write String content to a file (always use utf-8)
@param content The content to write
@param file The file to write
"""
OutputStream os = null;
try {
os = new FileOutputStream(file);
PrintWriter printWriter = new PrintWriter(new OutputStreamWriter(os, encoding));
printWriter.println(content);
printWriter.flush();
os.flush();
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
try {
if (os != null) os.close();
} catch (Exception e) {
//
}
}
} | java | public static void writeContent(CharSequence content, File file, String encoding) {
OutputStream os = null;
try {
os = new FileOutputStream(file);
PrintWriter printWriter = new PrintWriter(new OutputStreamWriter(os, encoding));
printWriter.println(content);
printWriter.flush();
os.flush();
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
try {
if (os != null) os.close();
} catch (Exception e) {
//
}
}
} | [
"public",
"static",
"void",
"writeContent",
"(",
"CharSequence",
"content",
",",
"File",
"file",
",",
"String",
"encoding",
")",
"{",
"OutputStream",
"os",
"=",
"null",
";",
"try",
"{",
"os",
"=",
"new",
"FileOutputStream",
"(",
"file",
")",
";",
"PrintWri... | Write String content to a file (always use utf-8)
@param content The content to write
@param file The file to write | [
"Write",
"String",
"content",
"to",
"a",
"file",
"(",
"always",
"use",
"utf",
"-",
"8",
")"
] | train | https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/utils/IO.java#L113-L130 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java | ReflectUtil.getMethodByNameIgnoreCase | public static Method getMethodByNameIgnoreCase(Class<?> clazz, String methodName) throws SecurityException {
"""
按照方法名查找指定方法名的方法,只返回匹配到的第一个方法,如果找不到对应的方法则返回<code>null</code>
<p>
此方法只检查方法名是否一致(忽略大小写),并不检查参数的一致性。
</p>
@param clazz 类,如果为{@code null}返回{@code null}
@param methodName 方法名,如果为空字符串返回{@code null}
@return 方法
@throws SecurityException 无权访问抛出异常
@since 4.3.2
"""
return getMethodByName(clazz, true, methodName);
} | java | public static Method getMethodByNameIgnoreCase(Class<?> clazz, String methodName) throws SecurityException {
return getMethodByName(clazz, true, methodName);
} | [
"public",
"static",
"Method",
"getMethodByNameIgnoreCase",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"methodName",
")",
"throws",
"SecurityException",
"{",
"return",
"getMethodByName",
"(",
"clazz",
",",
"true",
",",
"methodName",
")",
";",
"}"
] | 按照方法名查找指定方法名的方法,只返回匹配到的第一个方法,如果找不到对应的方法则返回<code>null</code>
<p>
此方法只检查方法名是否一致(忽略大小写),并不检查参数的一致性。
</p>
@param clazz 类,如果为{@code null}返回{@code null}
@param methodName 方法名,如果为空字符串返回{@code null}
@return 方法
@throws SecurityException 无权访问抛出异常
@since 4.3.2 | [
"按照方法名查找指定方法名的方法,只返回匹配到的第一个方法,如果找不到对应的方法则返回<code",
">",
"null<",
"/",
"code",
">"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L498-L500 |
spring-projects/spring-data-solr | src/main/java/org/springframework/data/solr/core/query/FacetOptions.java | FacetOptions.addFacetByRange | public final FacetOptions addFacetByRange(FieldWithRangeParameters<?, ?, ?> field) {
"""
Append additional field for range faceting
@param field the {@link Field} to be appended to range faceting fields
@return this
@since 1.5
"""
Assert.notNull(field, "Cannot range facet on null field.");
Assert.hasText(field.getName(), "Cannot range facet on field with null/empty fieldname.");
this.facetRangeOnFields.add(field);
return this;
} | java | public final FacetOptions addFacetByRange(FieldWithRangeParameters<?, ?, ?> field) {
Assert.notNull(field, "Cannot range facet on null field.");
Assert.hasText(field.getName(), "Cannot range facet on field with null/empty fieldname.");
this.facetRangeOnFields.add(field);
return this;
} | [
"public",
"final",
"FacetOptions",
"addFacetByRange",
"(",
"FieldWithRangeParameters",
"<",
"?",
",",
"?",
",",
"?",
">",
"field",
")",
"{",
"Assert",
".",
"notNull",
"(",
"field",
",",
"\"Cannot range facet on null field.\"",
")",
";",
"Assert",
".",
"hasText",... | Append additional field for range faceting
@param field the {@link Field} to be appended to range faceting fields
@return this
@since 1.5 | [
"Append",
"additional",
"field",
"for",
"range",
"faceting"
] | train | https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/query/FacetOptions.java#L132-L138 |
js-lib-com/net-client | src/main/java/js/net/client/ConnectionFactory.java | ConnectionFactory.isSecure | private static boolean isSecure(String protocol) throws BugError {
"""
Predicate to test if given protocol is secure.
@param protocol protocol to test if secure.
@return true it given <code>protocol</code> is secure.
@throws BugError if given protocol is not supported.
"""
if (HTTP.equalsIgnoreCase(protocol)) {
return false;
} else if (HTTPS.equalsIgnoreCase(protocol)) {
return true;
} else {
throw new BugError("Unsupported protocol |%s| for HTTP transaction.", protocol);
}
} | java | private static boolean isSecure(String protocol) throws BugError {
if (HTTP.equalsIgnoreCase(protocol)) {
return false;
} else if (HTTPS.equalsIgnoreCase(protocol)) {
return true;
} else {
throw new BugError("Unsupported protocol |%s| for HTTP transaction.", protocol);
}
} | [
"private",
"static",
"boolean",
"isSecure",
"(",
"String",
"protocol",
")",
"throws",
"BugError",
"{",
"if",
"(",
"HTTP",
".",
"equalsIgnoreCase",
"(",
"protocol",
")",
")",
"{",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"HTTPS",
".",
"equalsIgnoreCa... | Predicate to test if given protocol is secure.
@param protocol protocol to test if secure.
@return true it given <code>protocol</code> is secure.
@throws BugError if given protocol is not supported. | [
"Predicate",
"to",
"test",
"if",
"given",
"protocol",
"is",
"secure",
"."
] | train | https://github.com/js-lib-com/net-client/blob/0489f85d8baa1be1ff115aa79929e0cf05d4c72d/src/main/java/js/net/client/ConnectionFactory.java#L167-L175 |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/SchedulerUtils.java | SchedulerUtils.createJobDetail | public static JobDetail createJobDetail(String identity, String groupName, Class<? extends Job> clazz) {
"""
Creates a new quartz scheduler JobDetail, which can be used to
schedule a new job by passing it into {@link io.mangoo.scheduler.Scheduler#schedule(JobDetail, Trigger) schedule}
@param identity The name of the job
@param groupName The name of the job Group
@param clazz The class where the actual execution takes place
@return A new JobDetail object
"""
Objects.requireNonNull(identity, Required.IDENTITY.toString());
Objects.requireNonNull(groupName, Required.GROUP_NAME.toString());
Objects.requireNonNull(clazz, Required.CLASS.toString());
return newJob(clazz)
.withIdentity(identity, groupName)
.build();
} | java | public static JobDetail createJobDetail(String identity, String groupName, Class<? extends Job> clazz) {
Objects.requireNonNull(identity, Required.IDENTITY.toString());
Objects.requireNonNull(groupName, Required.GROUP_NAME.toString());
Objects.requireNonNull(clazz, Required.CLASS.toString());
return newJob(clazz)
.withIdentity(identity, groupName)
.build();
} | [
"public",
"static",
"JobDetail",
"createJobDetail",
"(",
"String",
"identity",
",",
"String",
"groupName",
",",
"Class",
"<",
"?",
"extends",
"Job",
">",
"clazz",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"identity",
",",
"Required",
".",
"IDENTITY",
... | Creates a new quartz scheduler JobDetail, which can be used to
schedule a new job by passing it into {@link io.mangoo.scheduler.Scheduler#schedule(JobDetail, Trigger) schedule}
@param identity The name of the job
@param groupName The name of the job Group
@param clazz The class where the actual execution takes place
@return A new JobDetail object | [
"Creates",
"a",
"new",
"quartz",
"scheduler",
"JobDetail",
"which",
"can",
"be",
"used",
"to",
"schedule",
"a",
"new",
"job",
"by",
"passing",
"it",
"into",
"{",
"@link",
"io",
".",
"mangoo",
".",
"scheduler",
".",
"Scheduler#schedule",
"(",
"JobDetail",
"... | train | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/SchedulerUtils.java#L62-L70 |
exoplatform/jcr | applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupConsole.java | BackupConsole.getRepoWS | private static String getRepoWS(String[] args, int curArg) {
"""
Get parameter from argument list, check it and return as valid path to repository and
workspace.
@param args
list of arguments.
@param curArg
argument index.
@return String valid path.
"""
if (curArg == args.length)
{
System.out.println(INCORRECT_PARAM + "There is no path to workspace parameter."); //NOSONAR
return null;
}
// make correct path
String repWS = args[curArg];
repWS = repWS.replaceAll("\\\\", "/");
if ( !repWS.matches("[/][^/]+") && !repWS.matches("[/][^/]+[/][^/]+"))
{
System.out.println(INCORRECT_PARAM + "There is incorrect path to workspace parameter: " + repWS); //NOSONAR
return null;
}
else
{
return repWS;
}
} | java | private static String getRepoWS(String[] args, int curArg)
{
if (curArg == args.length)
{
System.out.println(INCORRECT_PARAM + "There is no path to workspace parameter."); //NOSONAR
return null;
}
// make correct path
String repWS = args[curArg];
repWS = repWS.replaceAll("\\\\", "/");
if ( !repWS.matches("[/][^/]+") && !repWS.matches("[/][^/]+[/][^/]+"))
{
System.out.println(INCORRECT_PARAM + "There is incorrect path to workspace parameter: " + repWS); //NOSONAR
return null;
}
else
{
return repWS;
}
} | [
"private",
"static",
"String",
"getRepoWS",
"(",
"String",
"[",
"]",
"args",
",",
"int",
"curArg",
")",
"{",
"if",
"(",
"curArg",
"==",
"args",
".",
"length",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"INCORRECT_PARAM",
"+",
"\"There is no pat... | Get parameter from argument list, check it and return as valid path to repository and
workspace.
@param args
list of arguments.
@param curArg
argument index.
@return String valid path. | [
"Get",
"parameter",
"from",
"argument",
"list",
"check",
"it",
"and",
"return",
"as",
"valid",
"path",
"to",
"repository",
"and",
"workspace",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupConsole.java#L688-L708 |
undera/jmeter-plugins | plugins/functions/src/main/java/kg/apc/jmeter/functions/CaseFormat.java | CaseFormat.changeCase | protected String changeCase(String originalString, String mode) {
"""
Change case options
@param originalString
@param mode
@return string after change case
"""
String targetString = originalString;
// mode is case insensitive, allow upper for example
CaseFormatMode changeCaseMode = CaseFormatMode.get(mode.toUpperCase());
if (changeCaseMode != null) {
switch (changeCaseMode) {
case LOWER_CAMEL_CASE:
targetString = camelFormat(originalString, false);
break;
case UPPER_CAMEL_CASE:
targetString = camelFormat(originalString, true);
break;
case SNAKE_CASE:
case LOWER_UNDERSCORE:
targetString = caseFormatWithDelimiter(originalString, UNDERSCORE, false, true);
break;
case KEBAB_CASE:
case LISP_CASE:
case SPINAL_CASE:
case LOWER_HYPHEN:
targetString = caseFormatWithDelimiter(originalString, HYPHEN_MINUS, false, true);
break;
case TRAIN_CASE:
targetString = caseFormatWithDelimiter(originalString, HYPHEN_MINUS, true, false);
break;
case UPPER_UNDERSCORE:
targetString = caseFormatWithDelimiter(originalString, UNDERSCORE, true, false);
break;
default:
// default not doing nothing to originalString
}
} else {
LOGGER.error("Unknown mode {}, returning {} unchanged", mode, targetString);
}
return targetString;
} | java | protected String changeCase(String originalString, String mode) {
String targetString = originalString;
// mode is case insensitive, allow upper for example
CaseFormatMode changeCaseMode = CaseFormatMode.get(mode.toUpperCase());
if (changeCaseMode != null) {
switch (changeCaseMode) {
case LOWER_CAMEL_CASE:
targetString = camelFormat(originalString, false);
break;
case UPPER_CAMEL_CASE:
targetString = camelFormat(originalString, true);
break;
case SNAKE_CASE:
case LOWER_UNDERSCORE:
targetString = caseFormatWithDelimiter(originalString, UNDERSCORE, false, true);
break;
case KEBAB_CASE:
case LISP_CASE:
case SPINAL_CASE:
case LOWER_HYPHEN:
targetString = caseFormatWithDelimiter(originalString, HYPHEN_MINUS, false, true);
break;
case TRAIN_CASE:
targetString = caseFormatWithDelimiter(originalString, HYPHEN_MINUS, true, false);
break;
case UPPER_UNDERSCORE:
targetString = caseFormatWithDelimiter(originalString, UNDERSCORE, true, false);
break;
default:
// default not doing nothing to originalString
}
} else {
LOGGER.error("Unknown mode {}, returning {} unchanged", mode, targetString);
}
return targetString;
} | [
"protected",
"String",
"changeCase",
"(",
"String",
"originalString",
",",
"String",
"mode",
")",
"{",
"String",
"targetString",
"=",
"originalString",
";",
"// mode is case insensitive, allow upper for example",
"CaseFormatMode",
"changeCaseMode",
"=",
"CaseFormatMode",
".... | Change case options
@param originalString
@param mode
@return string after change case | [
"Change",
"case",
"options"
] | train | https://github.com/undera/jmeter-plugins/blob/416d2a77249ab921c7e4134c3e6a9639901ef7e8/plugins/functions/src/main/java/kg/apc/jmeter/functions/CaseFormat.java#L95-L130 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/olap/ParsedQuery.java | ParsedQuery.getBoolean | public boolean getBoolean(String key, boolean defaultValue) {
"""
Returns a boolean value by the key specified or defaultValue if the key was not provided
"""
String value = get(key);
if(value == null) return defaultValue;
return XType.getBoolean(value);
} | java | public boolean getBoolean(String key, boolean defaultValue) {
String value = get(key);
if(value == null) return defaultValue;
return XType.getBoolean(value);
} | [
"public",
"boolean",
"getBoolean",
"(",
"String",
"key",
",",
"boolean",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"get",
"(",
"key",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"return",
"defaultValue",
";",
"return",
"XType",
".",
"getBool... | Returns a boolean value by the key specified or defaultValue if the key was not provided | [
"Returns",
"a",
"boolean",
"value",
"by",
"the",
"key",
"specified",
"or",
"defaultValue",
"if",
"the",
"key",
"was",
"not",
"provided"
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/olap/ParsedQuery.java#L136-L140 |
alkacon/opencms-core | src/org/opencms/workplace/editors/CmsWorkplaceEditorConfiguration.java | CmsWorkplaceEditorConfiguration.setResourceTypes | private void setResourceTypes(Map<String, String[]> types) {
"""
Sets the valid resource types of the editor.<p>
@param types the valid resource types of the editor
"""
if ((types == null) || (types.size() == 0)) {
setValidConfiguration(false);
LOG.error(Messages.get().getBundle().key(Messages.LOG_NO_RESOURCE_TYPES_0));
}
m_resTypes = types;
} | java | private void setResourceTypes(Map<String, String[]> types) {
if ((types == null) || (types.size() == 0)) {
setValidConfiguration(false);
LOG.error(Messages.get().getBundle().key(Messages.LOG_NO_RESOURCE_TYPES_0));
}
m_resTypes = types;
} | [
"private",
"void",
"setResourceTypes",
"(",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"types",
")",
"{",
"if",
"(",
"(",
"types",
"==",
"null",
")",
"||",
"(",
"types",
".",
"size",
"(",
")",
"==",
"0",
")",
")",
"{",
"setValidConfigurati... | Sets the valid resource types of the editor.<p>
@param types the valid resource types of the editor | [
"Sets",
"the",
"valid",
"resource",
"types",
"of",
"the",
"editor",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/editors/CmsWorkplaceEditorConfiguration.java#L508-L515 |
icode/ameba-utils | src/main/java/ameba/util/Cookies.java | Cookies.newHttpOnlyCookie | public static NewCookie newHttpOnlyCookie(String name, String value) {
"""
<p>newHttpOnlyCookie.</p>
@param name a {@link java.lang.String} object.
@param value a {@link java.lang.String} object.
@return a {@link javax.ws.rs.core.NewCookie} object.
"""
/**
* Create a new instance.
*
* @param name the name of the cookie
* @param value the value of the cookie
* @param path the URI path for which the cookie is valid
* @param domain the host domain for which the cookie is valid
* @param version the version of the specification to which the cookie complies
* @param comment the comment
* @param maxAge the maximum age of the cookie in seconds
* @param expiry the cookie expiry date.
* @param secure specifies whether the cookie will only be sent over a secure connection
* @param httpOnly if {@code true} make the cookie HTTP only, i.e. only visible as part of an HTTP request.
* @throws IllegalArgumentException if name is {@code null}.
* @since 2.0
*/
return new NewCookie(name, value, null, null, Cookie.DEFAULT_VERSION, null, -1, null, false, true);
} | java | public static NewCookie newHttpOnlyCookie(String name, String value) {
/**
* Create a new instance.
*
* @param name the name of the cookie
* @param value the value of the cookie
* @param path the URI path for which the cookie is valid
* @param domain the host domain for which the cookie is valid
* @param version the version of the specification to which the cookie complies
* @param comment the comment
* @param maxAge the maximum age of the cookie in seconds
* @param expiry the cookie expiry date.
* @param secure specifies whether the cookie will only be sent over a secure connection
* @param httpOnly if {@code true} make the cookie HTTP only, i.e. only visible as part of an HTTP request.
* @throws IllegalArgumentException if name is {@code null}.
* @since 2.0
*/
return new NewCookie(name, value, null, null, Cookie.DEFAULT_VERSION, null, -1, null, false, true);
} | [
"public",
"static",
"NewCookie",
"newHttpOnlyCookie",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"/**\n * Create a new instance.\n *\n * @param name the name of the cookie\n * @param value the value of the cookie\n * @param path ... | <p>newHttpOnlyCookie.</p>
@param name a {@link java.lang.String} object.
@param value a {@link java.lang.String} object.
@return a {@link javax.ws.rs.core.NewCookie} object. | [
"<p",
">",
"newHttpOnlyCookie",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba-utils/blob/1aad5317a22e546c83dfe2dc0c80a1dc1fa0ea35/src/main/java/ameba/util/Cookies.java#L56-L74 |
Azure/azure-sdk-for-java | policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/implementation/PolicySetDefinitionsInner.java | PolicySetDefinitionsInner.getAtManagementGroup | public PolicySetDefinitionInner getAtManagementGroup(String policySetDefinitionName, String managementGroupId) {
"""
Retrieves a policy set definition.
This operation retrieves the policy set definition in the given management group with the given name.
@param policySetDefinitionName The name of the policy set definition to get.
@param managementGroupId The ID of the management group.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the PolicySetDefinitionInner object if successful.
"""
return getAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId).toBlocking().single().body();
} | java | public PolicySetDefinitionInner getAtManagementGroup(String policySetDefinitionName, String managementGroupId) {
return getAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId).toBlocking().single().body();
} | [
"public",
"PolicySetDefinitionInner",
"getAtManagementGroup",
"(",
"String",
"policySetDefinitionName",
",",
"String",
"managementGroupId",
")",
"{",
"return",
"getAtManagementGroupWithServiceResponseAsync",
"(",
"policySetDefinitionName",
",",
"managementGroupId",
")",
".",
"t... | Retrieves a policy set definition.
This operation retrieves the policy set definition in the given management group with the given name.
@param policySetDefinitionName The name of the policy set definition to get.
@param managementGroupId The ID of the management group.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the PolicySetDefinitionInner object if successful. | [
"Retrieves",
"a",
"policy",
"set",
"definition",
".",
"This",
"operation",
"retrieves",
"the",
"policy",
"set",
"definition",
"in",
"the",
"given",
"management",
"group",
"with",
"the",
"given",
"name",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/implementation/PolicySetDefinitionsInner.java#L871-L873 |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/schemageneration/XsdGeneratorHelper.java | XsdGeneratorHelper.parseXmlStream | public static Document parseXmlStream(final Reader xmlStream) {
"""
Parses the provided InputStream to create a dom Document.
@param xmlStream An InputStream connected to an XML document.
@return A DOM Document created from the contents of the provided stream.
"""
// Build a DOM model of the provided xmlFileStream.
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
try {
return factory.newDocumentBuilder().parse(new InputSource(xmlStream));
} catch (Exception e) {
throw new IllegalArgumentException("Could not acquire DOM Document", e);
}
} | java | public static Document parseXmlStream(final Reader xmlStream) {
// Build a DOM model of the provided xmlFileStream.
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
try {
return factory.newDocumentBuilder().parse(new InputSource(xmlStream));
} catch (Exception e) {
throw new IllegalArgumentException("Could not acquire DOM Document", e);
}
} | [
"public",
"static",
"Document",
"parseXmlStream",
"(",
"final",
"Reader",
"xmlStream",
")",
"{",
"// Build a DOM model of the provided xmlFileStream.\r",
"final",
"DocumentBuilderFactory",
"factory",
"=",
"DocumentBuilderFactory",
".",
"newInstance",
"(",
")",
";",
"factory... | Parses the provided InputStream to create a dom Document.
@param xmlStream An InputStream connected to an XML document.
@return A DOM Document created from the contents of the provided stream. | [
"Parses",
"the",
"provided",
"InputStream",
"to",
"create",
"a",
"dom",
"Document",
"."
] | train | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/schemageneration/XsdGeneratorHelper.java#L431-L442 |
wdullaer/SwipeActionAdapter | library/src/main/java/com/wdullaer/swipeactionadapter/SwipeViewGroup.java | SwipeViewGroup.addBackground | public SwipeViewGroup addBackground(View background, SwipeDirection direction) {
"""
Add a View to the background of the Layout. The background should have the same height
as the contentView
@param background The View to be added to the Layout
@param direction The key to be used to find it again
@return A reference to the a layout so commands can be chained
"""
if(mBackgroundMap.get(direction) != null) removeView(mBackgroundMap.get(direction));
background.setVisibility(View.INVISIBLE);
mBackgroundMap.put(direction, background);
addView(background);
return this;
} | java | public SwipeViewGroup addBackground(View background, SwipeDirection direction){
if(mBackgroundMap.get(direction) != null) removeView(mBackgroundMap.get(direction));
background.setVisibility(View.INVISIBLE);
mBackgroundMap.put(direction, background);
addView(background);
return this;
} | [
"public",
"SwipeViewGroup",
"addBackground",
"(",
"View",
"background",
",",
"SwipeDirection",
"direction",
")",
"{",
"if",
"(",
"mBackgroundMap",
".",
"get",
"(",
"direction",
")",
"!=",
"null",
")",
"removeView",
"(",
"mBackgroundMap",
".",
"get",
"(",
"dire... | Add a View to the background of the Layout. The background should have the same height
as the contentView
@param background The View to be added to the Layout
@param direction The key to be used to find it again
@return A reference to the a layout so commands can be chained | [
"Add",
"a",
"View",
"to",
"the",
"background",
"of",
"the",
"Layout",
".",
"The",
"background",
"should",
"have",
"the",
"same",
"height",
"as",
"the",
"contentView"
] | train | https://github.com/wdullaer/SwipeActionAdapter/blob/24a7e2ed953ac11ea0d8875d375bba571ffeba55/library/src/main/java/com/wdullaer/swipeactionadapter/SwipeViewGroup.java#L76-L83 |
UrielCh/ovh-java-sdk | ovh-java-sdk-kube/src/main/java/net/minidev/ovh/api/ApiOvhKube.java | ApiOvhKube.serviceName_publiccloud_node_nodeId_DELETE | public void serviceName_publiccloud_node_nodeId_DELETE(String serviceName, String nodeId) throws IOException {
"""
Delete a node on your cluster
REST: DELETE /kube/{serviceName}/publiccloud/node/{nodeId}
@param nodeId [required] Node ID
@param serviceName [required] Cluster ID
API beta
"""
String qPath = "/kube/{serviceName}/publiccloud/node/{nodeId}";
StringBuilder sb = path(qPath, serviceName, nodeId);
exec(qPath, "DELETE", sb.toString(), null);
} | java | public void serviceName_publiccloud_node_nodeId_DELETE(String serviceName, String nodeId) throws IOException {
String qPath = "/kube/{serviceName}/publiccloud/node/{nodeId}";
StringBuilder sb = path(qPath, serviceName, nodeId);
exec(qPath, "DELETE", sb.toString(), null);
} | [
"public",
"void",
"serviceName_publiccloud_node_nodeId_DELETE",
"(",
"String",
"serviceName",
",",
"String",
"nodeId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/kube/{serviceName}/publiccloud/node/{nodeId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
... | Delete a node on your cluster
REST: DELETE /kube/{serviceName}/publiccloud/node/{nodeId}
@param nodeId [required] Node ID
@param serviceName [required] Cluster ID
API beta | [
"Delete",
"a",
"node",
"on",
"your",
"cluster"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-kube/src/main/java/net/minidev/ovh/api/ApiOvhKube.java#L218-L222 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/inject/writer/AbstractClassFileWriter.java | AbstractClassFileWriter.getTypeDescriptor | protected static String getTypeDescriptor(Object type) {
"""
Returns the descriptor corresponding to the given class.
@param type The type
@return The descriptor for the class
"""
if (type instanceof Class) {
return Type.getDescriptor((Class) type);
} else if (type instanceof Type) {
return ((Type) type).getDescriptor();
} else {
String className = type.toString();
return getTypeDescriptor(className, new String[0]);
}
} | java | protected static String getTypeDescriptor(Object type) {
if (type instanceof Class) {
return Type.getDescriptor((Class) type);
} else if (type instanceof Type) {
return ((Type) type).getDescriptor();
} else {
String className = type.toString();
return getTypeDescriptor(className, new String[0]);
}
} | [
"protected",
"static",
"String",
"getTypeDescriptor",
"(",
"Object",
"type",
")",
"{",
"if",
"(",
"type",
"instanceof",
"Class",
")",
"{",
"return",
"Type",
".",
"getDescriptor",
"(",
"(",
"Class",
")",
"type",
")",
";",
"}",
"else",
"if",
"(",
"type",
... | Returns the descriptor corresponding to the given class.
@param type The type
@return The descriptor for the class | [
"Returns",
"the",
"descriptor",
"corresponding",
"to",
"the",
"given",
"class",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/inject/writer/AbstractClassFileWriter.java#L386-L395 |
windup/windup | config/api/src/main/java/org/jboss/windup/config/metadata/MetadataBuilder.java | MetadataBuilder.forProvider | public static MetadataBuilder forProvider(Class<? extends RuleProvider> implementationType) {
"""
Create a new {@link RuleProviderMetadata} builder instance for the given {@link RuleProvider} type, using the provided parameters and
{@link RulesetMetadata} to seed sensible defaults.
"""
String id = implementationType.getSimpleName();
RuleMetadata metadata = Annotations.getAnnotation(implementationType, RuleMetadata.class);
if (metadata != null && !metadata.id().isEmpty())
id = metadata.id();
return forProvider(implementationType, id);
} | java | public static MetadataBuilder forProvider(Class<? extends RuleProvider> implementationType)
{
String id = implementationType.getSimpleName();
RuleMetadata metadata = Annotations.getAnnotation(implementationType, RuleMetadata.class);
if (metadata != null && !metadata.id().isEmpty())
id = metadata.id();
return forProvider(implementationType, id);
} | [
"public",
"static",
"MetadataBuilder",
"forProvider",
"(",
"Class",
"<",
"?",
"extends",
"RuleProvider",
">",
"implementationType",
")",
"{",
"String",
"id",
"=",
"implementationType",
".",
"getSimpleName",
"(",
")",
";",
"RuleMetadata",
"metadata",
"=",
"Annotati... | Create a new {@link RuleProviderMetadata} builder instance for the given {@link RuleProvider} type, using the provided parameters and
{@link RulesetMetadata} to seed sensible defaults. | [
"Create",
"a",
"new",
"{"
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/config/api/src/main/java/org/jboss/windup/config/metadata/MetadataBuilder.java#L70-L79 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-core/src/main/java/org/deeplearning4j/util/ModelGuesser.java | ModelGuesser.loadModelGuess | public static Model loadModelGuess(InputStream stream, File tempDirectory) throws Exception {
"""
As per {@link #loadModelGuess(InputStream)} but (optionally) allows copying to the specified temporary directory
@param stream Stream of the model file
@param tempDirectory Temporary/working directory. May be null.
"""
//Currently (Nov 2017): KerasModelImport doesn't support loading from input streams
//Simplest solution here: write to a temporary file
File f;
if(tempDirectory == null){
f = DL4JFileUtils.createTempFile("loadModelGuess",".bin");
} else {
f = File.createTempFile("loadModelGuess", ".bin", tempDirectory);
}
f.deleteOnExit();
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(f))) {
IOUtils.copy(stream, os);
os.flush();
return loadModelGuess(f.getAbsolutePath());
} catch (ModelGuesserException e){
throw new ModelGuesserException("Unable to load model from input stream (invalid model file not a known model type)");
} finally {
f.delete();
}
} | java | public static Model loadModelGuess(InputStream stream, File tempDirectory) throws Exception {
//Currently (Nov 2017): KerasModelImport doesn't support loading from input streams
//Simplest solution here: write to a temporary file
File f;
if(tempDirectory == null){
f = DL4JFileUtils.createTempFile("loadModelGuess",".bin");
} else {
f = File.createTempFile("loadModelGuess", ".bin", tempDirectory);
}
f.deleteOnExit();
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(f))) {
IOUtils.copy(stream, os);
os.flush();
return loadModelGuess(f.getAbsolutePath());
} catch (ModelGuesserException e){
throw new ModelGuesserException("Unable to load model from input stream (invalid model file not a known model type)");
} finally {
f.delete();
}
} | [
"public",
"static",
"Model",
"loadModelGuess",
"(",
"InputStream",
"stream",
",",
"File",
"tempDirectory",
")",
"throws",
"Exception",
"{",
"//Currently (Nov 2017): KerasModelImport doesn't support loading from input streams",
"//Simplest solution here: write to a temporary file",
"F... | As per {@link #loadModelGuess(InputStream)} but (optionally) allows copying to the specified temporary directory
@param stream Stream of the model file
@param tempDirectory Temporary/working directory. May be null. | [
"As",
"per",
"{"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-core/src/main/java/org/deeplearning4j/util/ModelGuesser.java#L188-L209 |
amaembo/streamex | src/main/java/one/util/streamex/StreamEx.java | StreamEx.toNavigableMap | public <K, V> NavigableMap<K, V> toNavigableMap(Function<? super T, ? extends K> keyMapper,
Function<? super T, ? extends V> valMapper, BinaryOperator<V> mergeFunction) {
"""
Returns a {@link NavigableMap} whose keys and values are the result of
applying the provided mapping functions to the input elements.
<p>
This is a <a href="package-summary.html#StreamOps">terminal</a>
operation.
<p>
If the mapped keys contains duplicates (according to
{@link Object#equals(Object)}), the value mapping function is applied to
each equal element, and the results are merged using the provided merging
function.
<p>
Returned {@code NavigableMap} is guaranteed to be modifiable.
@param <K> the output type of the key mapping function
@param <V> the output type of the value mapping function
@param keyMapper a mapping function to produce keys
@param valMapper a mapping function to produce values
@param mergeFunction a merge function, used to resolve collisions between
values associated with the same key, as supplied to
{@link Map#merge(Object, Object, BiFunction)}
@return a {@code NavigableMap} whose keys are the result of applying a key
mapping function to the input elements, and whose values are the
result of applying a value mapping function to all input elements
equal to the key and combining them using the merge function
@see Collectors#toMap(Function, Function, BinaryOperator)
@see Collectors#toConcurrentMap(Function, Function, BinaryOperator)
@see #toNavigableMap(Function, Function)
@since 0.6.5
"""
return rawCollect(Collectors.toMap(keyMapper, valMapper, mergeFunction, TreeMap::new));
} | java | public <K, V> NavigableMap<K, V> toNavigableMap(Function<? super T, ? extends K> keyMapper,
Function<? super T, ? extends V> valMapper, BinaryOperator<V> mergeFunction) {
return rawCollect(Collectors.toMap(keyMapper, valMapper, mergeFunction, TreeMap::new));
} | [
"public",
"<",
"K",
",",
"V",
">",
"NavigableMap",
"<",
"K",
",",
"V",
">",
"toNavigableMap",
"(",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"K",
">",
"keyMapper",
",",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"V",
... | Returns a {@link NavigableMap} whose keys and values are the result of
applying the provided mapping functions to the input elements.
<p>
This is a <a href="package-summary.html#StreamOps">terminal</a>
operation.
<p>
If the mapped keys contains duplicates (according to
{@link Object#equals(Object)}), the value mapping function is applied to
each equal element, and the results are merged using the provided merging
function.
<p>
Returned {@code NavigableMap} is guaranteed to be modifiable.
@param <K> the output type of the key mapping function
@param <V> the output type of the value mapping function
@param keyMapper a mapping function to produce keys
@param valMapper a mapping function to produce values
@param mergeFunction a merge function, used to resolve collisions between
values associated with the same key, as supplied to
{@link Map#merge(Object, Object, BiFunction)}
@return a {@code NavigableMap} whose keys are the result of applying a key
mapping function to the input elements, and whose values are the
result of applying a value mapping function to all input elements
equal to the key and combining them using the merge function
@see Collectors#toMap(Function, Function, BinaryOperator)
@see Collectors#toConcurrentMap(Function, Function, BinaryOperator)
@see #toNavigableMap(Function, Function)
@since 0.6.5 | [
"Returns",
"a",
"{",
"@link",
"NavigableMap",
"}",
"whose",
"keys",
"and",
"values",
"are",
"the",
"result",
"of",
"applying",
"the",
"provided",
"mapping",
"functions",
"to",
"the",
"input",
"elements",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L1258-L1261 |
pravega/pravega | controller/src/main/java/io/pravega/controller/server/eventProcessor/requesthandlers/CommitRequestHandler.java | CommitRequestHandler.copyTxnEpochSegmentsAndCommitTxns | private CompletableFuture<Void> copyTxnEpochSegmentsAndCommitTxns(String scope, String stream, List<UUID> transactionsToCommit,
List<Long> segmentIds) {
"""
This method is called in the rolling transaction flow.
This method creates duplicate segments for transaction epoch. It then merges all transactions from the list into
those duplicate segments.
"""
// 1. create duplicate segments
// 2. merge transactions in those segments
// 3. seal txn epoch segments
String delegationToken = streamMetadataTasks.retrieveDelegationToken();
CompletableFuture<Void> createSegmentsFuture = Futures.allOf(segmentIds.stream().map(segment -> {
// Use fixed scaling policy for these segments as they are created, merged into and sealed and are not
// supposed to auto scale.
return streamMetadataTasks.notifyNewSegment(scope, stream, segment, ScalingPolicy.fixed(1), delegationToken);
}).collect(Collectors.toList()));
return createSegmentsFuture
.thenCompose(v -> {
log.debug("Rolling transaction, successfully created duplicate txn epoch {} for stream {}/{}", segmentIds, scope, stream);
// now commit transactions into these newly created segments
return commitTransactions(scope, stream, segmentIds, transactionsToCommit);
})
.thenCompose(v -> streamMetadataTasks.notifySealedSegments(scope, stream, segmentIds, delegationToken));
} | java | private CompletableFuture<Void> copyTxnEpochSegmentsAndCommitTxns(String scope, String stream, List<UUID> transactionsToCommit,
List<Long> segmentIds) {
// 1. create duplicate segments
// 2. merge transactions in those segments
// 3. seal txn epoch segments
String delegationToken = streamMetadataTasks.retrieveDelegationToken();
CompletableFuture<Void> createSegmentsFuture = Futures.allOf(segmentIds.stream().map(segment -> {
// Use fixed scaling policy for these segments as they are created, merged into and sealed and are not
// supposed to auto scale.
return streamMetadataTasks.notifyNewSegment(scope, stream, segment, ScalingPolicy.fixed(1), delegationToken);
}).collect(Collectors.toList()));
return createSegmentsFuture
.thenCompose(v -> {
log.debug("Rolling transaction, successfully created duplicate txn epoch {} for stream {}/{}", segmentIds, scope, stream);
// now commit transactions into these newly created segments
return commitTransactions(scope, stream, segmentIds, transactionsToCommit);
})
.thenCompose(v -> streamMetadataTasks.notifySealedSegments(scope, stream, segmentIds, delegationToken));
} | [
"private",
"CompletableFuture",
"<",
"Void",
">",
"copyTxnEpochSegmentsAndCommitTxns",
"(",
"String",
"scope",
",",
"String",
"stream",
",",
"List",
"<",
"UUID",
">",
"transactionsToCommit",
",",
"List",
"<",
"Long",
">",
"segmentIds",
")",
"{",
"// 1. create dupl... | This method is called in the rolling transaction flow.
This method creates duplicate segments for transaction epoch. It then merges all transactions from the list into
those duplicate segments. | [
"This",
"method",
"is",
"called",
"in",
"the",
"rolling",
"transaction",
"flow",
".",
"This",
"method",
"creates",
"duplicate",
"segments",
"for",
"transaction",
"epoch",
".",
"It",
"then",
"merges",
"all",
"transactions",
"from",
"the",
"list",
"into",
"those... | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/server/eventProcessor/requesthandlers/CommitRequestHandler.java#L253-L272 |
code4everything/util | src/main/java/com/zhazhapan/util/NetUtils.java | NetUtils.getCookie | public static Cookie getCookie(String name, Cookie[] cookies) {
"""
通过名称获取Cookie
@param name Cookie名
@param cookies cookie数组
@return {@link Cookie}
"""
if (Checker.isNotEmpty(cookies)) {
for (Cookie cookie : cookies) {
if (name.equals(cookie.getName())) {
return cookie;
}
}
}
return null;
} | java | public static Cookie getCookie(String name, Cookie[] cookies) {
if (Checker.isNotEmpty(cookies)) {
for (Cookie cookie : cookies) {
if (name.equals(cookie.getName())) {
return cookie;
}
}
}
return null;
} | [
"public",
"static",
"Cookie",
"getCookie",
"(",
"String",
"name",
",",
"Cookie",
"[",
"]",
"cookies",
")",
"{",
"if",
"(",
"Checker",
".",
"isNotEmpty",
"(",
"cookies",
")",
")",
"{",
"for",
"(",
"Cookie",
"cookie",
":",
"cookies",
")",
"{",
"if",
"(... | 通过名称获取Cookie
@param name Cookie名
@param cookies cookie数组
@return {@link Cookie} | [
"通过名称获取Cookie"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/NetUtils.java#L641-L650 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java | ApiOvhDbaaslogs.serviceName_output_elasticsearch_alias_aliasId_PUT | public OvhOperation serviceName_output_elasticsearch_alias_aliasId_PUT(String serviceName, String aliasId, String description, String optionId) throws IOException {
"""
Update specified elasticsearch alias
REST: PUT /dbaas/logs/{serviceName}/output/elasticsearch/alias/{aliasId}
@param serviceName [required] Service name
@param aliasId [required] Alias ID
@param optionId [required] Option ID
@param description [required] Description
"""
String qPath = "/dbaas/logs/{serviceName}/output/elasticsearch/alias/{aliasId}";
StringBuilder sb = path(qPath, serviceName, aliasId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "description", description);
addBody(o, "optionId", optionId);
String resp = exec(qPath, "PUT", sb.toString(), o);
return convertTo(resp, OvhOperation.class);
} | java | public OvhOperation serviceName_output_elasticsearch_alias_aliasId_PUT(String serviceName, String aliasId, String description, String optionId) throws IOException {
String qPath = "/dbaas/logs/{serviceName}/output/elasticsearch/alias/{aliasId}";
StringBuilder sb = path(qPath, serviceName, aliasId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "description", description);
addBody(o, "optionId", optionId);
String resp = exec(qPath, "PUT", sb.toString(), o);
return convertTo(resp, OvhOperation.class);
} | [
"public",
"OvhOperation",
"serviceName_output_elasticsearch_alias_aliasId_PUT",
"(",
"String",
"serviceName",
",",
"String",
"aliasId",
",",
"String",
"description",
",",
"String",
"optionId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dbaas/logs/{serv... | Update specified elasticsearch alias
REST: PUT /dbaas/logs/{serviceName}/output/elasticsearch/alias/{aliasId}
@param serviceName [required] Service name
@param aliasId [required] Alias ID
@param optionId [required] Option ID
@param description [required] Description | [
"Update",
"specified",
"elasticsearch",
"alias"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L1718-L1726 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.