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
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/collect/MapConstraints.java | MapConstraints.constrainedEntries | private static <K, V> Collection<Entry<K, V>> constrainedEntries(
Collection<Entry<K, V>> entries, MapConstraint<? super K, ? super V> constraint) {
"""
Returns a constrained view of the specified collection (or set) of entries,
using the specified constraint. The {@link Entry#setValue} operation will
be verified with the constraint, along with add operations on the returned
collection. The {@code add} and {@code addAll} operations simply forward to
the underlying collection, which throws an {@link
UnsupportedOperationException} per the map and multimap specification.
@param entries the entries to constrain
@param constraint the constraint for the entries
@return a constrained view of the specified entries
"""
if (entries instanceof Set) {
return constrainedEntrySet((Set<Entry<K, V>>) entries, constraint);
}
return new ConstrainedEntries<K, V>(entries, constraint);
} | java | private static <K, V> Collection<Entry<K, V>> constrainedEntries(
Collection<Entry<K, V>> entries, MapConstraint<? super K, ? super V> constraint) {
if (entries instanceof Set) {
return constrainedEntrySet((Set<Entry<K, V>>) entries, constraint);
}
return new ConstrainedEntries<K, V>(entries, constraint);
} | [
"private",
"static",
"<",
"K",
",",
"V",
">",
"Collection",
"<",
"Entry",
"<",
"K",
",",
"V",
">",
">",
"constrainedEntries",
"(",
"Collection",
"<",
"Entry",
"<",
"K",
",",
"V",
">",
">",
"entries",
",",
"MapConstraint",
"<",
"?",
"super",
"K",
",",
"?",
"super",
"V",
">",
"constraint",
")",
"{",
"if",
"(",
"entries",
"instanceof",
"Set",
")",
"{",
"return",
"constrainedEntrySet",
"(",
"(",
"Set",
"<",
"Entry",
"<",
"K",
",",
"V",
">",
">",
")",
"entries",
",",
"constraint",
")",
";",
"}",
"return",
"new",
"ConstrainedEntries",
"<",
"K",
",",
"V",
">",
"(",
"entries",
",",
"constraint",
")",
";",
"}"
] | Returns a constrained view of the specified collection (or set) of entries,
using the specified constraint. The {@link Entry#setValue} operation will
be verified with the constraint, along with add operations on the returned
collection. The {@code add} and {@code addAll} operations simply forward to
the underlying collection, which throws an {@link
UnsupportedOperationException} per the map and multimap specification.
@param entries the entries to constrain
@param constraint the constraint for the entries
@return a constrained view of the specified entries | [
"Returns",
"a",
"constrained",
"view",
"of",
"the",
"specified",
"collection",
"(",
"or",
"set",
")",
"of",
"entries",
"using",
"the",
"specified",
"constraint",
".",
"The",
"{",
"@link",
"Entry#setValue",
"}",
"operation",
"will",
"be",
"verified",
"with",
"the",
"constraint",
"along",
"with",
"add",
"operations",
"on",
"the",
"returned",
"collection",
".",
"The",
"{",
"@code",
"add",
"}",
"and",
"{",
"@code",
"addAll",
"}",
"operations",
"simply",
"forward",
"to",
"the",
"underlying",
"collection",
"which",
"throws",
"an",
"{",
"@link",
"UnsupportedOperationException",
"}",
"per",
"the",
"map",
"and",
"multimap",
"specification",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/collect/MapConstraints.java#L182-L188 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/utils/ObjectUtils.java | ObjectUtils.deepCopy | public static final Object deepCopy(Object source, final KunderaMetadata kunderaMetadata) {
"""
Deep copy.
@param source
the source
@param kunderaMetadata
the kundera metadata
@return the object
"""
Map<Object, Object> copiedObjectMap = new HashMap<Object, Object>();
Object target = deepCopyUsingMetadata(source, copiedObjectMap, kunderaMetadata);
copiedObjectMap.clear();
copiedObjectMap = null;
return target;
} | java | public static final Object deepCopy(Object source, final KunderaMetadata kunderaMetadata)
{
Map<Object, Object> copiedObjectMap = new HashMap<Object, Object>();
Object target = deepCopyUsingMetadata(source, copiedObjectMap, kunderaMetadata);
copiedObjectMap.clear();
copiedObjectMap = null;
return target;
} | [
"public",
"static",
"final",
"Object",
"deepCopy",
"(",
"Object",
"source",
",",
"final",
"KunderaMetadata",
"kunderaMetadata",
")",
"{",
"Map",
"<",
"Object",
",",
"Object",
">",
"copiedObjectMap",
"=",
"new",
"HashMap",
"<",
"Object",
",",
"Object",
">",
"(",
")",
";",
"Object",
"target",
"=",
"deepCopyUsingMetadata",
"(",
"source",
",",
"copiedObjectMap",
",",
"kunderaMetadata",
")",
";",
"copiedObjectMap",
".",
"clear",
"(",
")",
";",
"copiedObjectMap",
"=",
"null",
";",
"return",
"target",
";",
"}"
] | Deep copy.
@param source
the source
@param kunderaMetadata
the kundera metadata
@return the object | [
"Deep",
"copy",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/utils/ObjectUtils.java#L70-L80 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ClasspathUtility.java | ClasspathUtility.checkResource | private static void checkResource(final List<String> resources, final Pattern searchPattern, final String resourceName) {
"""
Check if the resource match the regex.
@param resources the list of found resources
@param searchPattern the regex pattern
@param resourceName the resource to check and to add
"""
if (searchPattern.matcher(resourceName).matches()) {
resources.add(resourceName);
}
} | java | private static void checkResource(final List<String> resources, final Pattern searchPattern, final String resourceName) {
if (searchPattern.matcher(resourceName).matches()) {
resources.add(resourceName);
}
} | [
"private",
"static",
"void",
"checkResource",
"(",
"final",
"List",
"<",
"String",
">",
"resources",
",",
"final",
"Pattern",
"searchPattern",
",",
"final",
"String",
"resourceName",
")",
"{",
"if",
"(",
"searchPattern",
".",
"matcher",
"(",
"resourceName",
")",
".",
"matches",
"(",
")",
")",
"{",
"resources",
".",
"add",
"(",
"resourceName",
")",
";",
"}",
"}"
] | Check if the resource match the regex.
@param resources the list of found resources
@param searchPattern the regex pattern
@param resourceName the resource to check and to add | [
"Check",
"if",
"the",
"resource",
"match",
"the",
"regex",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ClasspathUtility.java#L226-L230 |
dnsjava/dnsjava | org/xbill/DNS/ZoneTransferIn.java | ZoneTransferIn.newIXFR | public static ZoneTransferIn
newIXFR(Name zone, long serial, boolean fallback, String host, TSIG key)
throws UnknownHostException {
"""
Instantiates a ZoneTransferIn object to do an IXFR (incremental zone
transfer).
@param zone The zone to transfer.
@param serial The existing serial number.
@param fallback If true, fall back to AXFR if IXFR is not supported.
@param host The host from which to transfer the zone.
@param key The TSIG key used to authenticate the transfer, or null.
@return The ZoneTransferIn object.
@throws UnknownHostException The host does not exist.
"""
return newIXFR(zone, serial, fallback, host, 0, key);
} | java | public static ZoneTransferIn
newIXFR(Name zone, long serial, boolean fallback, String host, TSIG key)
throws UnknownHostException
{
return newIXFR(zone, serial, fallback, host, 0, key);
} | [
"public",
"static",
"ZoneTransferIn",
"newIXFR",
"(",
"Name",
"zone",
",",
"long",
"serial",
",",
"boolean",
"fallback",
",",
"String",
"host",
",",
"TSIG",
"key",
")",
"throws",
"UnknownHostException",
"{",
"return",
"newIXFR",
"(",
"zone",
",",
"serial",
",",
"fallback",
",",
"host",
",",
"0",
",",
"key",
")",
";",
"}"
] | Instantiates a ZoneTransferIn object to do an IXFR (incremental zone
transfer).
@param zone The zone to transfer.
@param serial The existing serial number.
@param fallback If true, fall back to AXFR if IXFR is not supported.
@param host The host from which to transfer the zone.
@param key The TSIG key used to authenticate the transfer, or null.
@return The ZoneTransferIn object.
@throws UnknownHostException The host does not exist. | [
"Instantiates",
"a",
"ZoneTransferIn",
"object",
"to",
"do",
"an",
"IXFR",
"(",
"incremental",
"zone",
"transfer",
")",
"."
] | train | https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/ZoneTransferIn.java#L290-L295 |
datumbox/lpsolve | src/main/java/lpsolve/LpSolve.java | LpSolve.putBbNodefunc | public void putBbNodefunc(BbListener listener, Object userhandle) throws LpSolveException {
"""
Register an <code>BbNodeListener</code> for callback.
@param listener the listener that should be called by lp_solve
@param userhandle an arbitrary object that is passed to the listener on call
"""
bbNodeListener = listener;
bbNodeUserhandle = (listener != null) ? userhandle : null;
addLp(this);
registerBbNodefunc();
} | java | public void putBbNodefunc(BbListener listener, Object userhandle) throws LpSolveException {
bbNodeListener = listener;
bbNodeUserhandle = (listener != null) ? userhandle : null;
addLp(this);
registerBbNodefunc();
} | [
"public",
"void",
"putBbNodefunc",
"(",
"BbListener",
"listener",
",",
"Object",
"userhandle",
")",
"throws",
"LpSolveException",
"{",
"bbNodeListener",
"=",
"listener",
";",
"bbNodeUserhandle",
"=",
"(",
"listener",
"!=",
"null",
")",
"?",
"userhandle",
":",
"null",
";",
"addLp",
"(",
"this",
")",
";",
"registerBbNodefunc",
"(",
")",
";",
"}"
] | Register an <code>BbNodeListener</code> for callback.
@param listener the listener that should be called by lp_solve
@param userhandle an arbitrary object that is passed to the listener on call | [
"Register",
"an",
"<code",
">",
"BbNodeListener<",
"/",
"code",
">",
"for",
"callback",
"."
] | train | https://github.com/datumbox/lpsolve/blob/201b3e99153d907bb99c189e5647bc71a3a1add6/src/main/java/lpsolve/LpSolve.java#L1667-L1672 |
SonarSource/sonarqube | server/sonar-server-common/src/main/java/org/sonar/server/log/ServerProcessLogging.java | ServerProcessLogging.configureDirectToConsoleLoggers | private void configureDirectToConsoleLoggers(LoggerContext context, String... loggerNames) {
"""
Setup one or more specified loggers to be non additive and to print to System.out which will be caught by the Main
Process and written to sonar.log.
"""
RootLoggerConfig config = newRootLoggerConfigBuilder()
.setProcessId(ProcessId.APP)
.setThreadIdFieldPattern("")
.build();
String logPattern = helper.buildLogPattern(config);
ConsoleAppender<ILoggingEvent> consoleAppender = helper.newConsoleAppender(context, "CONSOLE", logPattern);
for (String loggerName : loggerNames) {
Logger consoleLogger = context.getLogger(loggerName);
consoleLogger.setAdditive(false);
consoleLogger.addAppender(consoleAppender);
}
} | java | private void configureDirectToConsoleLoggers(LoggerContext context, String... loggerNames) {
RootLoggerConfig config = newRootLoggerConfigBuilder()
.setProcessId(ProcessId.APP)
.setThreadIdFieldPattern("")
.build();
String logPattern = helper.buildLogPattern(config);
ConsoleAppender<ILoggingEvent> consoleAppender = helper.newConsoleAppender(context, "CONSOLE", logPattern);
for (String loggerName : loggerNames) {
Logger consoleLogger = context.getLogger(loggerName);
consoleLogger.setAdditive(false);
consoleLogger.addAppender(consoleAppender);
}
} | [
"private",
"void",
"configureDirectToConsoleLoggers",
"(",
"LoggerContext",
"context",
",",
"String",
"...",
"loggerNames",
")",
"{",
"RootLoggerConfig",
"config",
"=",
"newRootLoggerConfigBuilder",
"(",
")",
".",
"setProcessId",
"(",
"ProcessId",
".",
"APP",
")",
".",
"setThreadIdFieldPattern",
"(",
"\"\"",
")",
".",
"build",
"(",
")",
";",
"String",
"logPattern",
"=",
"helper",
".",
"buildLogPattern",
"(",
"config",
")",
";",
"ConsoleAppender",
"<",
"ILoggingEvent",
">",
"consoleAppender",
"=",
"helper",
".",
"newConsoleAppender",
"(",
"context",
",",
"\"CONSOLE\"",
",",
"logPattern",
")",
";",
"for",
"(",
"String",
"loggerName",
":",
"loggerNames",
")",
"{",
"Logger",
"consoleLogger",
"=",
"context",
".",
"getLogger",
"(",
"loggerName",
")",
";",
"consoleLogger",
".",
"setAdditive",
"(",
"false",
")",
";",
"consoleLogger",
".",
"addAppender",
"(",
"consoleAppender",
")",
";",
"}",
"}"
] | Setup one or more specified loggers to be non additive and to print to System.out which will be caught by the Main
Process and written to sonar.log. | [
"Setup",
"one",
"or",
"more",
"specified",
"loggers",
"to",
"be",
"non",
"additive",
"and",
"to",
"print",
"to",
"System",
".",
"out",
"which",
"will",
"be",
"caught",
"by",
"the",
"Main",
"Process",
"and",
"written",
"to",
"sonar",
".",
"log",
"."
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server-common/src/main/java/org/sonar/server/log/ServerProcessLogging.java#L140-L153 |
gsi-upm/Shanks | shanks-core/src/main/java/es/upm/dit/gsi/shanks/ShanksSimulation2DGUI.java | ShanksSimulation2DGUI.addDisplay | public void addDisplay(String displayID, Display2D display)
throws ShanksException {
"""
Add a display to the simulation
@param displayID
@param display
@throws DuplictaedDisplayIDException
@throws DuplicatedPortrayalIDException
@throws ScenarioNotFoundException
"""
Scenario2DPortrayal scenarioPortrayal = (Scenario2DPortrayal) this
.getSimulation().getScenarioPortrayal();
HashMap<String, Display2D> displays = scenarioPortrayal.getDisplays();
if (!displays.containsKey(displayID)) {
displays.put(displayID, display);
} else {
throw new DuplictaedDisplayIDException(displayID);
}
} | java | public void addDisplay(String displayID, Display2D display)
throws ShanksException {
Scenario2DPortrayal scenarioPortrayal = (Scenario2DPortrayal) this
.getSimulation().getScenarioPortrayal();
HashMap<String, Display2D> displays = scenarioPortrayal.getDisplays();
if (!displays.containsKey(displayID)) {
displays.put(displayID, display);
} else {
throw new DuplictaedDisplayIDException(displayID);
}
} | [
"public",
"void",
"addDisplay",
"(",
"String",
"displayID",
",",
"Display2D",
"display",
")",
"throws",
"ShanksException",
"{",
"Scenario2DPortrayal",
"scenarioPortrayal",
"=",
"(",
"Scenario2DPortrayal",
")",
"this",
".",
"getSimulation",
"(",
")",
".",
"getScenarioPortrayal",
"(",
")",
";",
"HashMap",
"<",
"String",
",",
"Display2D",
">",
"displays",
"=",
"scenarioPortrayal",
".",
"getDisplays",
"(",
")",
";",
"if",
"(",
"!",
"displays",
".",
"containsKey",
"(",
"displayID",
")",
")",
"{",
"displays",
".",
"put",
"(",
"displayID",
",",
"display",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"DuplictaedDisplayIDException",
"(",
"displayID",
")",
";",
"}",
"}"
] | Add a display to the simulation
@param displayID
@param display
@throws DuplictaedDisplayIDException
@throws DuplicatedPortrayalIDException
@throws ScenarioNotFoundException | [
"Add",
"a",
"display",
"to",
"the",
"simulation"
] | train | https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/ShanksSimulation2DGUI.java#L320-L330 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_POST | public OvhOvhPabxDialplanExtension billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_POST(String billingAccount, String serviceName, Long dialplanId, Boolean enable, Long position, OvhSchedulerCategoryEnum schedulerCategory, OvhOvhPabxDialplanExtensionConditionScreenListTypeEnum screenListType) throws IOException {
"""
Create a new extension for a dialplan
REST: POST /telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension
@param enable [required] True to enable the extension
@param schedulerCategory [required] Additionnal conditions will be used from this chosen scheduler category
@param position [required] The position of the extension in the dialplan (the extensions are executed following this order)
@param screenListType [required] The type of the screenlist
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param dialplanId [required]
"""
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension";
StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "enable", enable);
addBody(o, "position", position);
addBody(o, "schedulerCategory", schedulerCategory);
addBody(o, "screenListType", screenListType);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOvhPabxDialplanExtension.class);
} | java | public OvhOvhPabxDialplanExtension billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_POST(String billingAccount, String serviceName, Long dialplanId, Boolean enable, Long position, OvhSchedulerCategoryEnum schedulerCategory, OvhOvhPabxDialplanExtensionConditionScreenListTypeEnum screenListType) throws IOException {
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension";
StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "enable", enable);
addBody(o, "position", position);
addBody(o, "schedulerCategory", schedulerCategory);
addBody(o, "screenListType", screenListType);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOvhPabxDialplanExtension.class);
} | [
"public",
"OvhOvhPabxDialplanExtension",
"billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_POST",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"dialplanId",
",",
"Boolean",
"enable",
",",
"Long",
"position",
",",
"OvhSchedulerCategoryEnum",
"schedulerCategory",
",",
"OvhOvhPabxDialplanExtensionConditionScreenListTypeEnum",
"screenListType",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"billingAccount",
",",
"serviceName",
",",
"dialplanId",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"enable\"",
",",
"enable",
")",
";",
"addBody",
"(",
"o",
",",
"\"position\"",
",",
"position",
")",
";",
"addBody",
"(",
"o",
",",
"\"schedulerCategory\"",
",",
"schedulerCategory",
")",
";",
"addBody",
"(",
"o",
",",
"\"screenListType\"",
",",
"screenListType",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhOvhPabxDialplanExtension",
".",
"class",
")",
";",
"}"
] | Create a new extension for a dialplan
REST: POST /telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension
@param enable [required] True to enable the extension
@param schedulerCategory [required] Additionnal conditions will be used from this chosen scheduler category
@param position [required] The position of the extension in the dialplan (the extensions are executed following this order)
@param screenListType [required] The type of the screenlist
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param dialplanId [required] | [
"Create",
"a",
"new",
"extension",
"for",
"a",
"dialplan"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L7351-L7361 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsInner.java | FailoverGroupsInner.beginForceFailoverAllowDataLossAsync | public Observable<FailoverGroupInner> beginForceFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String failoverGroupName) {
"""
Fails over from the current primary server to this server. This operation might result in data loss.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server containing the failover group.
@param failoverGroupName The name of the failover group.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the FailoverGroupInner object
"""
return beginForceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).map(new Func1<ServiceResponse<FailoverGroupInner>, FailoverGroupInner>() {
@Override
public FailoverGroupInner call(ServiceResponse<FailoverGroupInner> response) {
return response.body();
}
});
} | java | public Observable<FailoverGroupInner> beginForceFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String failoverGroupName) {
return beginForceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).map(new Func1<ServiceResponse<FailoverGroupInner>, FailoverGroupInner>() {
@Override
public FailoverGroupInner call(ServiceResponse<FailoverGroupInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"FailoverGroupInner",
">",
"beginForceFailoverAllowDataLossAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"failoverGroupName",
")",
"{",
"return",
"beginForceFailoverAllowDataLossWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
"failoverGroupName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"FailoverGroupInner",
">",
",",
"FailoverGroupInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"FailoverGroupInner",
"call",
"(",
"ServiceResponse",
"<",
"FailoverGroupInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Fails over from the current primary server to this server. This operation might result in data loss.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server containing the failover group.
@param failoverGroupName The name of the failover group.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the FailoverGroupInner object | [
"Fails",
"over",
"from",
"the",
"current",
"primary",
"server",
"to",
"this",
"server",
".",
"This",
"operation",
"might",
"result",
"in",
"data",
"loss",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsInner.java#L1163-L1170 |
centic9/commons-dost | src/main/java/org/dstadler/commons/net/UrlUtils.java | UrlUtils.retrieveDataPost | public static String retrieveDataPost(String sUrl, String encoding, String postRequestBody, String contentType, int timeout) throws IOException {
"""
Download data from an URL with a POST request, if necessary converting from a character encoding.
@param sUrl The full URL used to download the content.
@param encoding An encoding, e.g. UTF-8, ISO-8859-15. Can be null.
@param postRequestBody the body of the POST request, e.g. request parameters; must not be null
@param contentType the content-type of the POST request; may be null
@param timeout The timeout in milliseconds that is used for both connection timeout and read timeout.
@return The response from the HTTP POST call.
@throws IOException If accessing the resource fails.
"""
return retrieveStringInternalPost(sUrl, encoding, postRequestBody, contentType, timeout, null);
} | java | public static String retrieveDataPost(String sUrl, String encoding, String postRequestBody, String contentType, int timeout) throws IOException {
return retrieveStringInternalPost(sUrl, encoding, postRequestBody, contentType, timeout, null);
} | [
"public",
"static",
"String",
"retrieveDataPost",
"(",
"String",
"sUrl",
",",
"String",
"encoding",
",",
"String",
"postRequestBody",
",",
"String",
"contentType",
",",
"int",
"timeout",
")",
"throws",
"IOException",
"{",
"return",
"retrieveStringInternalPost",
"(",
"sUrl",
",",
"encoding",
",",
"postRequestBody",
",",
"contentType",
",",
"timeout",
",",
"null",
")",
";",
"}"
] | Download data from an URL with a POST request, if necessary converting from a character encoding.
@param sUrl The full URL used to download the content.
@param encoding An encoding, e.g. UTF-8, ISO-8859-15. Can be null.
@param postRequestBody the body of the POST request, e.g. request parameters; must not be null
@param contentType the content-type of the POST request; may be null
@param timeout The timeout in milliseconds that is used for both connection timeout and read timeout.
@return The response from the HTTP POST call.
@throws IOException If accessing the resource fails. | [
"Download",
"data",
"from",
"an",
"URL",
"with",
"a",
"POST",
"request",
"if",
"necessary",
"converting",
"from",
"a",
"character",
"encoding",
"."
] | train | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/net/UrlUtils.java#L188-L190 |
JadiraOrg/jadira | jms/src/main/java/org/jadira/jms/template/BatchedJmsTemplate.java | BatchedJmsTemplate.receiveBatch | public List<Message> receiveBatch(int batchSize) throws JmsException {
"""
Receive a batch of up to batchSize. Other than batching this method is the same as {@link JmsTemplate#receive()}
@return A list of {@link Message}
@param batchSize The batch size
@throws JmsException The {@link JmsException}
"""
Destination defaultDestination = getDefaultDestination();
if (defaultDestination != null) {
return receiveBatch(defaultDestination, batchSize);
} else {
return receiveBatch(getRequiredDefaultDestinationName(), batchSize);
}
} | java | public List<Message> receiveBatch(int batchSize) throws JmsException {
Destination defaultDestination = getDefaultDestination();
if (defaultDestination != null) {
return receiveBatch(defaultDestination, batchSize);
} else {
return receiveBatch(getRequiredDefaultDestinationName(), batchSize);
}
} | [
"public",
"List",
"<",
"Message",
">",
"receiveBatch",
"(",
"int",
"batchSize",
")",
"throws",
"JmsException",
"{",
"Destination",
"defaultDestination",
"=",
"getDefaultDestination",
"(",
")",
";",
"if",
"(",
"defaultDestination",
"!=",
"null",
")",
"{",
"return",
"receiveBatch",
"(",
"defaultDestination",
",",
"batchSize",
")",
";",
"}",
"else",
"{",
"return",
"receiveBatch",
"(",
"getRequiredDefaultDestinationName",
"(",
")",
",",
"batchSize",
")",
";",
"}",
"}"
] | Receive a batch of up to batchSize. Other than batching this method is the same as {@link JmsTemplate#receive()}
@return A list of {@link Message}
@param batchSize The batch size
@throws JmsException The {@link JmsException} | [
"Receive",
"a",
"batch",
"of",
"up",
"to",
"batchSize",
".",
"Other",
"than",
"batching",
"this",
"method",
"is",
"the",
"same",
"as",
"{"
] | train | https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/jms/src/main/java/org/jadira/jms/template/BatchedJmsTemplate.java#L121-L130 |
appium/java-client | src/main/java/io/appium/java_client/service/local/AppiumServiceBuilder.java | AppiumServiceBuilder.withArgument | public AppiumServiceBuilder withArgument(ServerArgument argument, String value) {
"""
Adds a server argument.
@param argument is an instance which contains the argument name.
@param value A non null string value. (Warn!!!) Boolean arguments have a special moment:
the presence of an arguments means "true". At this case an empty string
should be defined.
@return the self-reference.
"""
String argName = argument.getArgument().trim().toLowerCase();
if ("--port".equals(argName) || "-p".equals(argName)) {
usingPort(Integer.valueOf(value));
} else if ("--address".equals(argName) || "-a".equals(argName)) {
withIPAddress(value);
} else if ("--log".equals(argName) || "-g".equals(argName)) {
withLogFile(new File(value));
} else {
serverArguments.put(argName, value);
}
return this;
} | java | public AppiumServiceBuilder withArgument(ServerArgument argument, String value) {
String argName = argument.getArgument().trim().toLowerCase();
if ("--port".equals(argName) || "-p".equals(argName)) {
usingPort(Integer.valueOf(value));
} else if ("--address".equals(argName) || "-a".equals(argName)) {
withIPAddress(value);
} else if ("--log".equals(argName) || "-g".equals(argName)) {
withLogFile(new File(value));
} else {
serverArguments.put(argName, value);
}
return this;
} | [
"public",
"AppiumServiceBuilder",
"withArgument",
"(",
"ServerArgument",
"argument",
",",
"String",
"value",
")",
"{",
"String",
"argName",
"=",
"argument",
".",
"getArgument",
"(",
")",
".",
"trim",
"(",
")",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
"\"--port\"",
".",
"equals",
"(",
"argName",
")",
"||",
"\"-p\"",
".",
"equals",
"(",
"argName",
")",
")",
"{",
"usingPort",
"(",
"Integer",
".",
"valueOf",
"(",
"value",
")",
")",
";",
"}",
"else",
"if",
"(",
"\"--address\"",
".",
"equals",
"(",
"argName",
")",
"||",
"\"-a\"",
".",
"equals",
"(",
"argName",
")",
")",
"{",
"withIPAddress",
"(",
"value",
")",
";",
"}",
"else",
"if",
"(",
"\"--log\"",
".",
"equals",
"(",
"argName",
")",
"||",
"\"-g\"",
".",
"equals",
"(",
"argName",
")",
")",
"{",
"withLogFile",
"(",
"new",
"File",
"(",
"value",
")",
")",
";",
"}",
"else",
"{",
"serverArguments",
".",
"put",
"(",
"argName",
",",
"value",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Adds a server argument.
@param argument is an instance which contains the argument name.
@param value A non null string value. (Warn!!!) Boolean arguments have a special moment:
the presence of an arguments means "true". At this case an empty string
should be defined.
@return the self-reference. | [
"Adds",
"a",
"server",
"argument",
"."
] | train | https://github.com/appium/java-client/blob/5a17759b05d6fda8ef425b3ab6e766c73ed2e8df/src/main/java/io/appium/java_client/service/local/AppiumServiceBuilder.java#L265-L277 |
inkstand-io/scribble | scribble-jcr/src/main/java/io/inkstand/scribble/jcr/JCRAssert.java | JCRAssert.assertNodeExistById | public static void assertNodeExistById(final Session session, final String itemId) throws RepositoryException {
"""
Asserts that an item, identified by it's unique id, is found in the repository session.
@param session
the session to be searched
@param itemId
the item expected to be found
@throws RepositoryException
"""
try {
session.getNodeByIdentifier(itemId);
} catch (final ItemNotFoundException e) {
LOG.debug("Item with id {} does not exist", itemId, e);
fail(e.getMessage());
}
} | java | public static void assertNodeExistById(final Session session, final String itemId) throws RepositoryException {
try {
session.getNodeByIdentifier(itemId);
} catch (final ItemNotFoundException e) {
LOG.debug("Item with id {} does not exist", itemId, e);
fail(e.getMessage());
}
} | [
"public",
"static",
"void",
"assertNodeExistById",
"(",
"final",
"Session",
"session",
",",
"final",
"String",
"itemId",
")",
"throws",
"RepositoryException",
"{",
"try",
"{",
"session",
".",
"getNodeByIdentifier",
"(",
"itemId",
")",
";",
"}",
"catch",
"(",
"final",
"ItemNotFoundException",
"e",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Item with id {} does not exist\"",
",",
"itemId",
",",
"e",
")",
";",
"fail",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
] | Asserts that an item, identified by it's unique id, is found in the repository session.
@param session
the session to be searched
@param itemId
the item expected to be found
@throws RepositoryException | [
"Asserts",
"that",
"an",
"item",
"identified",
"by",
"it",
"s",
"unique",
"id",
"is",
"found",
"in",
"the",
"repository",
"session",
"."
] | train | https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/JCRAssert.java#L117-L124 |
paypal/SeLion | dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/XmlDataProviderImpl.java | XmlDataProviderImpl.getDataByKeys | @Override
public Object[][] getDataByKeys(String[] keys) {
"""
Generates a two dimensional array for TestNG DataProvider from the XML data representing a map of name value
collection filtered by keys.
A name value item should use the node name 'item' and a specific child structure since the implementation depends
on {@link KeyValuePair} class. The structure of an item in collection is shown below where 'key' and 'value' are
child nodes contained in a parent node named 'item':
<pre>
<items>
<item>
<key>k1</key>
<value>val1</value>
</item>
<item>
<key>k2</key>
<value>val2</value>
</item>
<item>
<key>k3</key>
<value>val3</value>
</item>
</items>
</pre>
@param keys
The string keys to filter the data.
@return A two dimensional object array.
"""
logger.entering(Arrays.toString(keys));
if (null == resource.getCls()) {
resource.setCls(KeyValueMap.class);
}
Object[][] objectArray;
try {
JAXBContext context = JAXBContext.newInstance(resource.getCls());
Unmarshaller unmarshaller = context.createUnmarshaller();
StreamSource xmlStreamSource = new StreamSource(resource.getInputStream());
Map<String, KeyValuePair> keyValueItems = unmarshaller
.unmarshal(xmlStreamSource, KeyValueMap.class).getValue().getMap();
objectArray = DataProviderHelper.getDataByKeys(keyValueItems, keys);
} catch (JAXBException excp) {
logger.exiting(excp.getMessage());
throw new DataProviderException("Error unmarshalling XML file.", excp);
}
// Passing no arguments to exiting() because implementation to print 2D array could be highly recursive.
logger.exiting();
return objectArray;
} | java | @Override
public Object[][] getDataByKeys(String[] keys) {
logger.entering(Arrays.toString(keys));
if (null == resource.getCls()) {
resource.setCls(KeyValueMap.class);
}
Object[][] objectArray;
try {
JAXBContext context = JAXBContext.newInstance(resource.getCls());
Unmarshaller unmarshaller = context.createUnmarshaller();
StreamSource xmlStreamSource = new StreamSource(resource.getInputStream());
Map<String, KeyValuePair> keyValueItems = unmarshaller
.unmarshal(xmlStreamSource, KeyValueMap.class).getValue().getMap();
objectArray = DataProviderHelper.getDataByKeys(keyValueItems, keys);
} catch (JAXBException excp) {
logger.exiting(excp.getMessage());
throw new DataProviderException("Error unmarshalling XML file.", excp);
}
// Passing no arguments to exiting() because implementation to print 2D array could be highly recursive.
logger.exiting();
return objectArray;
} | [
"@",
"Override",
"public",
"Object",
"[",
"]",
"[",
"]",
"getDataByKeys",
"(",
"String",
"[",
"]",
"keys",
")",
"{",
"logger",
".",
"entering",
"(",
"Arrays",
".",
"toString",
"(",
"keys",
")",
")",
";",
"if",
"(",
"null",
"==",
"resource",
".",
"getCls",
"(",
")",
")",
"{",
"resource",
".",
"setCls",
"(",
"KeyValueMap",
".",
"class",
")",
";",
"}",
"Object",
"[",
"]",
"[",
"]",
"objectArray",
";",
"try",
"{",
"JAXBContext",
"context",
"=",
"JAXBContext",
".",
"newInstance",
"(",
"resource",
".",
"getCls",
"(",
")",
")",
";",
"Unmarshaller",
"unmarshaller",
"=",
"context",
".",
"createUnmarshaller",
"(",
")",
";",
"StreamSource",
"xmlStreamSource",
"=",
"new",
"StreamSource",
"(",
"resource",
".",
"getInputStream",
"(",
")",
")",
";",
"Map",
"<",
"String",
",",
"KeyValuePair",
">",
"keyValueItems",
"=",
"unmarshaller",
".",
"unmarshal",
"(",
"xmlStreamSource",
",",
"KeyValueMap",
".",
"class",
")",
".",
"getValue",
"(",
")",
".",
"getMap",
"(",
")",
";",
"objectArray",
"=",
"DataProviderHelper",
".",
"getDataByKeys",
"(",
"keyValueItems",
",",
"keys",
")",
";",
"}",
"catch",
"(",
"JAXBException",
"excp",
")",
"{",
"logger",
".",
"exiting",
"(",
"excp",
".",
"getMessage",
"(",
")",
")",
";",
"throw",
"new",
"DataProviderException",
"(",
"\"Error unmarshalling XML file.\"",
",",
"excp",
")",
";",
"}",
"// Passing no arguments to exiting() because implementation to print 2D array could be highly recursive.",
"logger",
".",
"exiting",
"(",
")",
";",
"return",
"objectArray",
";",
"}"
] | Generates a two dimensional array for TestNG DataProvider from the XML data representing a map of name value
collection filtered by keys.
A name value item should use the node name 'item' and a specific child structure since the implementation depends
on {@link KeyValuePair} class. The structure of an item in collection is shown below where 'key' and 'value' are
child nodes contained in a parent node named 'item':
<pre>
<items>
<item>
<key>k1</key>
<value>val1</value>
</item>
<item>
<key>k2</key>
<value>val2</value>
</item>
<item>
<key>k3</key>
<value>val3</value>
</item>
</items>
</pre>
@param keys
The string keys to filter the data.
@return A two dimensional object array. | [
"Generates",
"a",
"two",
"dimensional",
"array",
"for",
"TestNG",
"DataProvider",
"from",
"the",
"XML",
"data",
"representing",
"a",
"map",
"of",
"name",
"value",
"collection",
"filtered",
"by",
"keys",
"."
] | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/XmlDataProviderImpl.java#L262-L285 |
apache/incubator-druid | sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidQuery.java | DruidQuery.computeAggregations | private static List<Aggregation> computeAggregations(
final PartialDruidQuery partialQuery,
final PlannerContext plannerContext,
final DruidQuerySignature querySignature,
final RexBuilder rexBuilder,
final boolean finalizeAggregations
) {
"""
Returns aggregations corresponding to {@code aggregate.getAggCallList()}, in the same order.
@param partialQuery partial query
@param plannerContext planner context
@param querySignature source row signature and re-usable virtual column references
@param rexBuilder calcite RexBuilder
@param finalizeAggregations true if this query should include explicit finalization for all of its
aggregators, where required. Useful for subqueries where Druid's native query layer
does not do this automatically.
@return aggregations
@throws CannotBuildQueryException if dimensions cannot be computed
"""
final Aggregate aggregate = Preconditions.checkNotNull(partialQuery.getAggregate());
final List<Aggregation> aggregations = new ArrayList<>();
final String outputNamePrefix = Calcites.findUnusedPrefix(
"a",
new TreeSet<>(querySignature.getRowSignature().getRowOrder())
);
for (int i = 0; i < aggregate.getAggCallList().size(); i++) {
final String aggName = outputNamePrefix + i;
final AggregateCall aggCall = aggregate.getAggCallList().get(i);
final Aggregation aggregation = GroupByRules.translateAggregateCall(
plannerContext,
querySignature,
rexBuilder,
partialQuery.getSelectProject(),
aggregations,
aggName,
aggCall,
finalizeAggregations
);
if (aggregation == null) {
throw new CannotBuildQueryException(aggregate, aggCall);
}
aggregations.add(aggregation);
}
return aggregations;
} | java | private static List<Aggregation> computeAggregations(
final PartialDruidQuery partialQuery,
final PlannerContext plannerContext,
final DruidQuerySignature querySignature,
final RexBuilder rexBuilder,
final boolean finalizeAggregations
)
{
final Aggregate aggregate = Preconditions.checkNotNull(partialQuery.getAggregate());
final List<Aggregation> aggregations = new ArrayList<>();
final String outputNamePrefix = Calcites.findUnusedPrefix(
"a",
new TreeSet<>(querySignature.getRowSignature().getRowOrder())
);
for (int i = 0; i < aggregate.getAggCallList().size(); i++) {
final String aggName = outputNamePrefix + i;
final AggregateCall aggCall = aggregate.getAggCallList().get(i);
final Aggregation aggregation = GroupByRules.translateAggregateCall(
plannerContext,
querySignature,
rexBuilder,
partialQuery.getSelectProject(),
aggregations,
aggName,
aggCall,
finalizeAggregations
);
if (aggregation == null) {
throw new CannotBuildQueryException(aggregate, aggCall);
}
aggregations.add(aggregation);
}
return aggregations;
} | [
"private",
"static",
"List",
"<",
"Aggregation",
">",
"computeAggregations",
"(",
"final",
"PartialDruidQuery",
"partialQuery",
",",
"final",
"PlannerContext",
"plannerContext",
",",
"final",
"DruidQuerySignature",
"querySignature",
",",
"final",
"RexBuilder",
"rexBuilder",
",",
"final",
"boolean",
"finalizeAggregations",
")",
"{",
"final",
"Aggregate",
"aggregate",
"=",
"Preconditions",
".",
"checkNotNull",
"(",
"partialQuery",
".",
"getAggregate",
"(",
")",
")",
";",
"final",
"List",
"<",
"Aggregation",
">",
"aggregations",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"final",
"String",
"outputNamePrefix",
"=",
"Calcites",
".",
"findUnusedPrefix",
"(",
"\"a\"",
",",
"new",
"TreeSet",
"<>",
"(",
"querySignature",
".",
"getRowSignature",
"(",
")",
".",
"getRowOrder",
"(",
")",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"aggregate",
".",
"getAggCallList",
"(",
")",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"final",
"String",
"aggName",
"=",
"outputNamePrefix",
"+",
"i",
";",
"final",
"AggregateCall",
"aggCall",
"=",
"aggregate",
".",
"getAggCallList",
"(",
")",
".",
"get",
"(",
"i",
")",
";",
"final",
"Aggregation",
"aggregation",
"=",
"GroupByRules",
".",
"translateAggregateCall",
"(",
"plannerContext",
",",
"querySignature",
",",
"rexBuilder",
",",
"partialQuery",
".",
"getSelectProject",
"(",
")",
",",
"aggregations",
",",
"aggName",
",",
"aggCall",
",",
"finalizeAggregations",
")",
";",
"if",
"(",
"aggregation",
"==",
"null",
")",
"{",
"throw",
"new",
"CannotBuildQueryException",
"(",
"aggregate",
",",
"aggCall",
")",
";",
"}",
"aggregations",
".",
"add",
"(",
"aggregation",
")",
";",
"}",
"return",
"aggregations",
";",
"}"
] | Returns aggregations corresponding to {@code aggregate.getAggCallList()}, in the same order.
@param partialQuery partial query
@param plannerContext planner context
@param querySignature source row signature and re-usable virtual column references
@param rexBuilder calcite RexBuilder
@param finalizeAggregations true if this query should include explicit finalization for all of its
aggregators, where required. Useful for subqueries where Druid's native query layer
does not do this automatically.
@return aggregations
@throws CannotBuildQueryException if dimensions cannot be computed | [
"Returns",
"aggregations",
"corresponding",
"to",
"{",
"@code",
"aggregate",
".",
"getAggCallList",
"()",
"}",
"in",
"the",
"same",
"order",
"."
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidQuery.java#L522-L559 |
leadware/jpersistence-tools | jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java | DAOValidatorHelper.isExpressionContainsFunction | public static boolean isExpressionContainsFunction(String expression) {
"""
Methode permettant de verifier si un chemin contient des Fonctions
@param expression Chaine a controler
@return Resultat de la verification
"""
// Si la chaine est vide : false
if(expression == null || expression.trim().length() == 0) {
// On retourne false
return false;
}
// On split
return isExpressionContainPattern(expression, FUNC_CHAIN_PATTERN);
} | java | public static boolean isExpressionContainsFunction(String expression) {
// Si la chaine est vide : false
if(expression == null || expression.trim().length() == 0) {
// On retourne false
return false;
}
// On split
return isExpressionContainPattern(expression, FUNC_CHAIN_PATTERN);
} | [
"public",
"static",
"boolean",
"isExpressionContainsFunction",
"(",
"String",
"expression",
")",
"{",
"// Si la chaine est vide : false\r",
"if",
"(",
"expression",
"==",
"null",
"||",
"expression",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"// On retourne false\r",
"return",
"false",
";",
"}",
"// On split\r",
"return",
"isExpressionContainPattern",
"(",
"expression",
",",
"FUNC_CHAIN_PATTERN",
")",
";",
"}"
] | Methode permettant de verifier si un chemin contient des Fonctions
@param expression Chaine a controler
@return Resultat de la verification | [
"Methode",
"permettant",
"de",
"verifier",
"si",
"un",
"chemin",
"contient",
"des",
"Fonctions"
] | train | https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java#L554-L565 |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/UIData.java | UIData.queueEvent | @Override
public void queueEvent(FacesEvent event) {
"""
Modify events queued for any child components so that the UIData state will be correctly configured before the
event's listeners are executed.
<p>
Child components or their renderers may register events against those child components. When the listener for
that event is eventually invoked, it may expect the uidata's rowData and rowIndex to be referring to the same
object that caused the event to fire.
<p>
The original queueEvent call against the child component has been forwarded up the chain of ancestors in the
standard way, making it possible here to wrap the event in a new event whose source is <i>this</i> component, not
the original one. When the event finally is executed, this component's broadcast method is invoked, which ensures
that the UIData is set to be at the correct row before executing the original event.
"""
if (event == null)
{
throw new NullPointerException("event");
}
super.queueEvent(new FacesEventWrapper(event, getRowIndex(), this));
} | java | @Override
public void queueEvent(FacesEvent event)
{
if (event == null)
{
throw new NullPointerException("event");
}
super.queueEvent(new FacesEventWrapper(event, getRowIndex(), this));
} | [
"@",
"Override",
"public",
"void",
"queueEvent",
"(",
"FacesEvent",
"event",
")",
"{",
"if",
"(",
"event",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"event\"",
")",
";",
"}",
"super",
".",
"queueEvent",
"(",
"new",
"FacesEventWrapper",
"(",
"event",
",",
"getRowIndex",
"(",
")",
",",
"this",
")",
")",
";",
"}"
] | Modify events queued for any child components so that the UIData state will be correctly configured before the
event's listeners are executed.
<p>
Child components or their renderers may register events against those child components. When the listener for
that event is eventually invoked, it may expect the uidata's rowData and rowIndex to be referring to the same
object that caused the event to fire.
<p>
The original queueEvent call against the child component has been forwarded up the chain of ancestors in the
standard way, making it possible here to wrap the event in a new event whose source is <i>this</i> component, not
the original one. When the event finally is executed, this component's broadcast method is invoked, which ensures
that the UIData is set to be at the correct row before executing the original event. | [
"Modify",
"events",
"queued",
"for",
"any",
"child",
"components",
"so",
"that",
"the",
"UIData",
"state",
"will",
"be",
"correctly",
"configured",
"before",
"the",
"event",
"s",
"listeners",
"are",
"executed",
".",
"<p",
">",
"Child",
"components",
"or",
"their",
"renderers",
"may",
"register",
"events",
"against",
"those",
"child",
"components",
".",
"When",
"the",
"listener",
"for",
"that",
"event",
"is",
"eventually",
"invoked",
"it",
"may",
"expect",
"the",
"uidata",
"s",
"rowData",
"and",
"rowIndex",
"to",
"be",
"referring",
"to",
"the",
"same",
"object",
"that",
"caused",
"the",
"event",
"to",
"fire",
".",
"<p",
">",
"The",
"original",
"queueEvent",
"call",
"against",
"the",
"child",
"component",
"has",
"been",
"forwarded",
"up",
"the",
"chain",
"of",
"ancestors",
"in",
"the",
"standard",
"way",
"making",
"it",
"possible",
"here",
"to",
"wrap",
"the",
"event",
"in",
"a",
"new",
"event",
"whose",
"source",
"is",
"<i",
">",
"this<",
"/",
"i",
">",
"component",
"not",
"the",
"original",
"one",
".",
"When",
"the",
"event",
"finally",
"is",
"executed",
"this",
"component",
"s",
"broadcast",
"method",
"is",
"invoked",
"which",
"ensures",
"that",
"the",
"UIData",
"is",
"set",
"to",
"be",
"at",
"the",
"correct",
"row",
"before",
"executing",
"the",
"original",
"event",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/UIData.java#L1657-L1665 |
james-hu/jabb-core | src/main/java/net/sf/jabb/util/web/WebApplicationConfiguration.java | WebApplicationConfiguration.cleanUpMenuTree | protected void cleanUpMenuTree(WebMenuItem root, String menuName) {
"""
Convert MenuItemExt to WebMenuItem, and clean up all data
@param root
"""
List<WebMenuItem> subMenu = root.getSubMenu();
List<WebMenuItem> rootBreadcrumbs = root.getBreadcrumbs();
if (subMenu != null && subMenu.size() > 0){
Collections.sort(subMenu);
for (int i = 0; i < subMenu.size(); i++){
WebMenuItem item = subMenu.get(i);
if (item instanceof MenuItemExt){
MenuItemExt itemExt = (MenuItemExt)item;
item = itemExt.toWebMenuItem();
subMenu.set(i, item);
menuItemPaths.get(menuName).put(itemExt.path, item);
}
item.breadcrumbs = new ArrayList<WebMenuItem>();
if (rootBreadcrumbs != null){
item.breadcrumbs.addAll(rootBreadcrumbs);
}
item.breadcrumbs.add(item);
cleanUpMenuTree(item, menuName);
}
}
} | java | protected void cleanUpMenuTree(WebMenuItem root, String menuName){
List<WebMenuItem> subMenu = root.getSubMenu();
List<WebMenuItem> rootBreadcrumbs = root.getBreadcrumbs();
if (subMenu != null && subMenu.size() > 0){
Collections.sort(subMenu);
for (int i = 0; i < subMenu.size(); i++){
WebMenuItem item = subMenu.get(i);
if (item instanceof MenuItemExt){
MenuItemExt itemExt = (MenuItemExt)item;
item = itemExt.toWebMenuItem();
subMenu.set(i, item);
menuItemPaths.get(menuName).put(itemExt.path, item);
}
item.breadcrumbs = new ArrayList<WebMenuItem>();
if (rootBreadcrumbs != null){
item.breadcrumbs.addAll(rootBreadcrumbs);
}
item.breadcrumbs.add(item);
cleanUpMenuTree(item, menuName);
}
}
} | [
"protected",
"void",
"cleanUpMenuTree",
"(",
"WebMenuItem",
"root",
",",
"String",
"menuName",
")",
"{",
"List",
"<",
"WebMenuItem",
">",
"subMenu",
"=",
"root",
".",
"getSubMenu",
"(",
")",
";",
"List",
"<",
"WebMenuItem",
">",
"rootBreadcrumbs",
"=",
"root",
".",
"getBreadcrumbs",
"(",
")",
";",
"if",
"(",
"subMenu",
"!=",
"null",
"&&",
"subMenu",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"Collections",
".",
"sort",
"(",
"subMenu",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"subMenu",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"WebMenuItem",
"item",
"=",
"subMenu",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"item",
"instanceof",
"MenuItemExt",
")",
"{",
"MenuItemExt",
"itemExt",
"=",
"(",
"MenuItemExt",
")",
"item",
";",
"item",
"=",
"itemExt",
".",
"toWebMenuItem",
"(",
")",
";",
"subMenu",
".",
"set",
"(",
"i",
",",
"item",
")",
";",
"menuItemPaths",
".",
"get",
"(",
"menuName",
")",
".",
"put",
"(",
"itemExt",
".",
"path",
",",
"item",
")",
";",
"}",
"item",
".",
"breadcrumbs",
"=",
"new",
"ArrayList",
"<",
"WebMenuItem",
">",
"(",
")",
";",
"if",
"(",
"rootBreadcrumbs",
"!=",
"null",
")",
"{",
"item",
".",
"breadcrumbs",
".",
"addAll",
"(",
"rootBreadcrumbs",
")",
";",
"}",
"item",
".",
"breadcrumbs",
".",
"add",
"(",
"item",
")",
";",
"cleanUpMenuTree",
"(",
"item",
",",
"menuName",
")",
";",
"}",
"}",
"}"
] | Convert MenuItemExt to WebMenuItem, and clean up all data
@param root | [
"Convert",
"MenuItemExt",
"to",
"WebMenuItem",
"and",
"clean",
"up",
"all",
"data"
] | train | https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/web/WebApplicationConfiguration.java#L165-L186 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/tracker/tld/TldTemplateMatching.java | TldTemplateMatching.computeConfidence | public double computeConfidence( int x0 , int y0 , int x1 , int y1 ) {
"""
Compute a value which indicates how confident the specified region is to be a member of the positive set.
The confidence value is from 0 to 1. 1 indicates 100% confidence.
Positive and negative templates are used to compute the confidence value. Only the point in each set
which is closest to the specified region are used in the calculation.
@return value from 0 to 1, where higher values are more confident
"""
computeNccDescriptor(observed,x0,y0,x1,y1);
// distance from each set of templates
if( templateNegative.size() > 0 && templatePositive.size() > 0 ) {
double distancePositive = distance(observed,templatePositive);
double distanceNegative = distance(observed,templateNegative);
return distanceNegative/(distanceNegative + distancePositive);
} else if( templatePositive.size() > 0 ) {
return 1.0-distance(observed,templatePositive);
} else {
return distance(observed,templateNegative);
}
} | java | public double computeConfidence( int x0 , int y0 , int x1 , int y1 ) {
computeNccDescriptor(observed,x0,y0,x1,y1);
// distance from each set of templates
if( templateNegative.size() > 0 && templatePositive.size() > 0 ) {
double distancePositive = distance(observed,templatePositive);
double distanceNegative = distance(observed,templateNegative);
return distanceNegative/(distanceNegative + distancePositive);
} else if( templatePositive.size() > 0 ) {
return 1.0-distance(observed,templatePositive);
} else {
return distance(observed,templateNegative);
}
} | [
"public",
"double",
"computeConfidence",
"(",
"int",
"x0",
",",
"int",
"y0",
",",
"int",
"x1",
",",
"int",
"y1",
")",
"{",
"computeNccDescriptor",
"(",
"observed",
",",
"x0",
",",
"y0",
",",
"x1",
",",
"y1",
")",
";",
"// distance from each set of templates",
"if",
"(",
"templateNegative",
".",
"size",
"(",
")",
">",
"0",
"&&",
"templatePositive",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"double",
"distancePositive",
"=",
"distance",
"(",
"observed",
",",
"templatePositive",
")",
";",
"double",
"distanceNegative",
"=",
"distance",
"(",
"observed",
",",
"templateNegative",
")",
";",
"return",
"distanceNegative",
"/",
"(",
"distanceNegative",
"+",
"distancePositive",
")",
";",
"}",
"else",
"if",
"(",
"templatePositive",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"return",
"1.0",
"-",
"distance",
"(",
"observed",
",",
"templatePositive",
")",
";",
"}",
"else",
"{",
"return",
"distance",
"(",
"observed",
",",
"templateNegative",
")",
";",
"}",
"}"
] | Compute a value which indicates how confident the specified region is to be a member of the positive set.
The confidence value is from 0 to 1. 1 indicates 100% confidence.
Positive and negative templates are used to compute the confidence value. Only the point in each set
which is closest to the specified region are used in the calculation.
@return value from 0 to 1, where higher values are more confident | [
"Compute",
"a",
"value",
"which",
"indicates",
"how",
"confident",
"the",
"specified",
"region",
"is",
"to",
"be",
"a",
"member",
"of",
"the",
"positive",
"set",
".",
"The",
"confidence",
"value",
"is",
"from",
"0",
"to",
"1",
".",
"1",
"indicates",
"100%",
"confidence",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/tld/TldTemplateMatching.java#L179-L194 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/OrdersInner.java | OrdersInner.createOrUpdate | public OrderInner createOrUpdate(String deviceName, String resourceGroupName, OrderInner order) {
"""
Creates or updates an order.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@param order The order to be created or updated.
@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 OrderInner object if successful.
"""
return createOrUpdateWithServiceResponseAsync(deviceName, resourceGroupName, order).toBlocking().last().body();
} | java | public OrderInner createOrUpdate(String deviceName, String resourceGroupName, OrderInner order) {
return createOrUpdateWithServiceResponseAsync(deviceName, resourceGroupName, order).toBlocking().last().body();
} | [
"public",
"OrderInner",
"createOrUpdate",
"(",
"String",
"deviceName",
",",
"String",
"resourceGroupName",
",",
"OrderInner",
"order",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"deviceName",
",",
"resourceGroupName",
",",
"order",
")",
".",
"toBlocking",
"(",
")",
".",
"last",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Creates or updates an order.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@param order The order to be created or updated.
@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 OrderInner object if successful. | [
"Creates",
"or",
"updates",
"an",
"order",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/OrdersInner.java#L315-L317 |
osiam/connector4java | src/main/java/org/osiam/client/OsiamConnector.java | OsiamConnector.createGroup | public Group createGroup(Group group, AccessToken accessToken) {
"""
saves the given {@link Group} to the OSIAM DB.
@param group group to be saved
@param accessToken the OSIAM access token from for the current session
@return the same group Object like the given but with filled metadata and a new valid id
@throws UnauthorizedException if the request could not be authorized.
@throws ConflictException if the Group could not be created
@throws ForbiddenException if the scope doesn't allow this request
@throws ConnectionInitializationException if the connection to the given OSIAM service could not be initialized
@throws IllegalStateException if OSIAM's endpoint(s) are not properly configured
"""
return getGroupService().createGroup(group, accessToken);
} | java | public Group createGroup(Group group, AccessToken accessToken) {
return getGroupService().createGroup(group, accessToken);
} | [
"public",
"Group",
"createGroup",
"(",
"Group",
"group",
",",
"AccessToken",
"accessToken",
")",
"{",
"return",
"getGroupService",
"(",
")",
".",
"createGroup",
"(",
"group",
",",
"accessToken",
")",
";",
"}"
] | saves the given {@link Group} to the OSIAM DB.
@param group group to be saved
@param accessToken the OSIAM access token from for the current session
@return the same group Object like the given but with filled metadata and a new valid id
@throws UnauthorizedException if the request could not be authorized.
@throws ConflictException if the Group could not be created
@throws ForbiddenException if the scope doesn't allow this request
@throws ConnectionInitializationException if the connection to the given OSIAM service could not be initialized
@throws IllegalStateException if OSIAM's endpoint(s) are not properly configured | [
"saves",
"the",
"given",
"{",
"@link",
"Group",
"}",
"to",
"the",
"OSIAM",
"DB",
"."
] | train | https://github.com/osiam/connector4java/blob/a5e6ae1e706f4889d662a069fe2f3bf8e3848d12/src/main/java/org/osiam/client/OsiamConnector.java#L470-L472 |
lucee/Lucee | core/src/main/java/lucee/commons/lang/ClassUtil.java | ClassUtil.loadInstance | public static Object loadInstance(Class clazz, Object[] args, Object defaultValue) {
"""
loads a class from a String classname
@param clazz class to load
@param args
@return matching Class
"""
if (args == null || args.length == 0) return loadInstance(clazz, defaultValue);
try {
Class[] cArgs = new Class[args.length];
for (int i = 0; i < args.length; i++) {
if (args[i] == null) cArgs[i] = Object.class;
else cArgs[i] = args[i].getClass();
}
Constructor c = clazz.getConstructor(cArgs);
return c.newInstance(args);
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
return defaultValue;
}
} | java | public static Object loadInstance(Class clazz, Object[] args, Object defaultValue) {
if (args == null || args.length == 0) return loadInstance(clazz, defaultValue);
try {
Class[] cArgs = new Class[args.length];
for (int i = 0; i < args.length; i++) {
if (args[i] == null) cArgs[i] = Object.class;
else cArgs[i] = args[i].getClass();
}
Constructor c = clazz.getConstructor(cArgs);
return c.newInstance(args);
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
return defaultValue;
}
} | [
"public",
"static",
"Object",
"loadInstance",
"(",
"Class",
"clazz",
",",
"Object",
"[",
"]",
"args",
",",
"Object",
"defaultValue",
")",
"{",
"if",
"(",
"args",
"==",
"null",
"||",
"args",
".",
"length",
"==",
"0",
")",
"return",
"loadInstance",
"(",
"clazz",
",",
"defaultValue",
")",
";",
"try",
"{",
"Class",
"[",
"]",
"cArgs",
"=",
"new",
"Class",
"[",
"args",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"args",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"args",
"[",
"i",
"]",
"==",
"null",
")",
"cArgs",
"[",
"i",
"]",
"=",
"Object",
".",
"class",
";",
"else",
"cArgs",
"[",
"i",
"]",
"=",
"args",
"[",
"i",
"]",
".",
"getClass",
"(",
")",
";",
"}",
"Constructor",
"c",
"=",
"clazz",
".",
"getConstructor",
"(",
"cArgs",
")",
";",
"return",
"c",
".",
"newInstance",
"(",
"args",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"ExceptionUtil",
".",
"rethrowIfNecessary",
"(",
"t",
")",
";",
"return",
"defaultValue",
";",
"}",
"}"
] | loads a class from a String classname
@param clazz class to load
@param args
@return matching Class | [
"loads",
"a",
"class",
"from",
"a",
"String",
"classname"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/ClassUtil.java#L485-L502 |
cdk/cdk | base/valencycheck/src/main/java/org/openscience/cdk/tools/SmilesValencyChecker.java | SmilesValencyChecker.couldMatchAtomType | public boolean couldMatchAtomType(IAtom atom, double bondOrderSum, IBond.Order maxBondOrder, IAtomType type) {
"""
Determines if the atom can be of type AtomType. That is, it sees if this
AtomType only differs in bond orders, or implicit hydrogen count.
"""
logger.debug("couldMatchAtomType: ... matching atom ", atom, " vs ", type);
int hcount = atom.getImplicitHydrogenCount();
int charge = atom.getFormalCharge();
if (charge == type.getFormalCharge()) {
logger.debug("couldMatchAtomType: formal charge matches...");
// if (atom.getHybridization() == type.getHybridization()) {
// logger.debug("couldMatchAtomType: hybridization is OK...");
if (bondOrderSum + hcount <= type.getBondOrderSum()) {
logger.debug("couldMatchAtomType: bond order sum is OK...");
if (!BondManipulator.isHigherOrder(maxBondOrder, type.getMaxBondOrder())) {
logger.debug("couldMatchAtomType: max bond order is OK... We have a match!");
return true;
}
} else {
logger.debug("couldMatchAtomType: no match", "" + (bondOrderSum + hcount), " > ",
"" + type.getBondOrderSum());
}
// }
} else {
logger.debug("couldMatchAtomType: formal charge does NOT match...");
}
logger.debug("couldMatchAtomType: No Match");
return false;
} | java | public boolean couldMatchAtomType(IAtom atom, double bondOrderSum, IBond.Order maxBondOrder, IAtomType type) {
logger.debug("couldMatchAtomType: ... matching atom ", atom, " vs ", type);
int hcount = atom.getImplicitHydrogenCount();
int charge = atom.getFormalCharge();
if (charge == type.getFormalCharge()) {
logger.debug("couldMatchAtomType: formal charge matches...");
// if (atom.getHybridization() == type.getHybridization()) {
// logger.debug("couldMatchAtomType: hybridization is OK...");
if (bondOrderSum + hcount <= type.getBondOrderSum()) {
logger.debug("couldMatchAtomType: bond order sum is OK...");
if (!BondManipulator.isHigherOrder(maxBondOrder, type.getMaxBondOrder())) {
logger.debug("couldMatchAtomType: max bond order is OK... We have a match!");
return true;
}
} else {
logger.debug("couldMatchAtomType: no match", "" + (bondOrderSum + hcount), " > ",
"" + type.getBondOrderSum());
}
// }
} else {
logger.debug("couldMatchAtomType: formal charge does NOT match...");
}
logger.debug("couldMatchAtomType: No Match");
return false;
} | [
"public",
"boolean",
"couldMatchAtomType",
"(",
"IAtom",
"atom",
",",
"double",
"bondOrderSum",
",",
"IBond",
".",
"Order",
"maxBondOrder",
",",
"IAtomType",
"type",
")",
"{",
"logger",
".",
"debug",
"(",
"\"couldMatchAtomType: ... matching atom \"",
",",
"atom",
",",
"\" vs \"",
",",
"type",
")",
";",
"int",
"hcount",
"=",
"atom",
".",
"getImplicitHydrogenCount",
"(",
")",
";",
"int",
"charge",
"=",
"atom",
".",
"getFormalCharge",
"(",
")",
";",
"if",
"(",
"charge",
"==",
"type",
".",
"getFormalCharge",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"couldMatchAtomType: formal charge matches...\"",
")",
";",
"// if (atom.getHybridization() == type.getHybridization()) {",
"// logger.debug(\"couldMatchAtomType: hybridization is OK...\");",
"if",
"(",
"bondOrderSum",
"+",
"hcount",
"<=",
"type",
".",
"getBondOrderSum",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"couldMatchAtomType: bond order sum is OK...\"",
")",
";",
"if",
"(",
"!",
"BondManipulator",
".",
"isHigherOrder",
"(",
"maxBondOrder",
",",
"type",
".",
"getMaxBondOrder",
"(",
")",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"couldMatchAtomType: max bond order is OK... We have a match!\"",
")",
";",
"return",
"true",
";",
"}",
"}",
"else",
"{",
"logger",
".",
"debug",
"(",
"\"couldMatchAtomType: no match\"",
",",
"\"\"",
"+",
"(",
"bondOrderSum",
"+",
"hcount",
")",
",",
"\" > \"",
",",
"\"\"",
"+",
"type",
".",
"getBondOrderSum",
"(",
")",
")",
";",
"}",
"// }",
"}",
"else",
"{",
"logger",
".",
"debug",
"(",
"\"couldMatchAtomType: formal charge does NOT match...\"",
")",
";",
"}",
"logger",
".",
"debug",
"(",
"\"couldMatchAtomType: No Match\"",
")",
";",
"return",
"false",
";",
"}"
] | Determines if the atom can be of type AtomType. That is, it sees if this
AtomType only differs in bond orders, or implicit hydrogen count. | [
"Determines",
"if",
"the",
"atom",
"can",
"be",
"of",
"type",
"AtomType",
".",
"That",
"is",
"it",
"sees",
"if",
"this",
"AtomType",
"only",
"differs",
"in",
"bond",
"orders",
"or",
"implicit",
"hydrogen",
"count",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/valencycheck/src/main/java/org/openscience/cdk/tools/SmilesValencyChecker.java#L232-L256 |
JOML-CI/JOML | src/org/joml/Vector3f.java | Vector3f.set | public Vector3f set(int index, FloatBuffer buffer) {
"""
Read this vector from the supplied {@link FloatBuffer} starting at the specified
absolute buffer position/index.
<p>
This method will not increment the position of the given FloatBuffer.
@param index
the absolute position into the FloatBuffer
@param buffer
values will be read in <code>x, y, z</code> order
@return this
"""
MemUtil.INSTANCE.get(this, index, buffer);
return this;
} | java | public Vector3f set(int index, FloatBuffer buffer) {
MemUtil.INSTANCE.get(this, index, buffer);
return this;
} | [
"public",
"Vector3f",
"set",
"(",
"int",
"index",
",",
"FloatBuffer",
"buffer",
")",
"{",
"MemUtil",
".",
"INSTANCE",
".",
"get",
"(",
"this",
",",
"index",
",",
"buffer",
")",
";",
"return",
"this",
";",
"}"
] | Read this vector from the supplied {@link FloatBuffer} starting at the specified
absolute buffer position/index.
<p>
This method will not increment the position of the given FloatBuffer.
@param index
the absolute position into the FloatBuffer
@param buffer
values will be read in <code>x, y, z</code> order
@return this | [
"Read",
"this",
"vector",
"from",
"the",
"supplied",
"{",
"@link",
"FloatBuffer",
"}",
"starting",
"at",
"the",
"specified",
"absolute",
"buffer",
"position",
"/",
"index",
".",
"<p",
">",
"This",
"method",
"will",
"not",
"increment",
"the",
"position",
"of",
"the",
"given",
"FloatBuffer",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector3f.java#L392-L395 |
Alluxio/alluxio | core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournalGarbageCollector.java | UfsJournalGarbageCollector.gcFileIfStale | private void gcFileIfStale(UfsJournalFile file, long checkpointSequenceNumber) {
"""
Garbage collects a file if necessary.
@param file the file
@param checkpointSequenceNumber the first sequence number that has not been checkpointed
"""
if (file.getEnd() > checkpointSequenceNumber && !file.isTmpCheckpoint()) {
return;
}
long lastModifiedTimeMs;
try {
lastModifiedTimeMs = mUfs.getFileStatus(file.getLocation().toString()).getLastModifiedTime();
} catch (IOException e) {
LOG.warn("Failed to get the last modified time for {}.", file.getLocation());
return;
}
long thresholdMs = file.isTmpCheckpoint()
? ServerConfiguration.getMs(PropertyKey.MASTER_JOURNAL_TEMPORARY_FILE_GC_THRESHOLD_MS)
: ServerConfiguration.getMs(PropertyKey.MASTER_JOURNAL_GC_THRESHOLD_MS);
if (System.currentTimeMillis() - lastModifiedTimeMs > thresholdMs) {
deleteNoException(file.getLocation());
}
} | java | private void gcFileIfStale(UfsJournalFile file, long checkpointSequenceNumber) {
if (file.getEnd() > checkpointSequenceNumber && !file.isTmpCheckpoint()) {
return;
}
long lastModifiedTimeMs;
try {
lastModifiedTimeMs = mUfs.getFileStatus(file.getLocation().toString()).getLastModifiedTime();
} catch (IOException e) {
LOG.warn("Failed to get the last modified time for {}.", file.getLocation());
return;
}
long thresholdMs = file.isTmpCheckpoint()
? ServerConfiguration.getMs(PropertyKey.MASTER_JOURNAL_TEMPORARY_FILE_GC_THRESHOLD_MS)
: ServerConfiguration.getMs(PropertyKey.MASTER_JOURNAL_GC_THRESHOLD_MS);
if (System.currentTimeMillis() - lastModifiedTimeMs > thresholdMs) {
deleteNoException(file.getLocation());
}
} | [
"private",
"void",
"gcFileIfStale",
"(",
"UfsJournalFile",
"file",
",",
"long",
"checkpointSequenceNumber",
")",
"{",
"if",
"(",
"file",
".",
"getEnd",
"(",
")",
">",
"checkpointSequenceNumber",
"&&",
"!",
"file",
".",
"isTmpCheckpoint",
"(",
")",
")",
"{",
"return",
";",
"}",
"long",
"lastModifiedTimeMs",
";",
"try",
"{",
"lastModifiedTimeMs",
"=",
"mUfs",
".",
"getFileStatus",
"(",
"file",
".",
"getLocation",
"(",
")",
".",
"toString",
"(",
")",
")",
".",
"getLastModifiedTime",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"Failed to get the last modified time for {}.\"",
",",
"file",
".",
"getLocation",
"(",
")",
")",
";",
"return",
";",
"}",
"long",
"thresholdMs",
"=",
"file",
".",
"isTmpCheckpoint",
"(",
")",
"?",
"ServerConfiguration",
".",
"getMs",
"(",
"PropertyKey",
".",
"MASTER_JOURNAL_TEMPORARY_FILE_GC_THRESHOLD_MS",
")",
":",
"ServerConfiguration",
".",
"getMs",
"(",
"PropertyKey",
".",
"MASTER_JOURNAL_GC_THRESHOLD_MS",
")",
";",
"if",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"lastModifiedTimeMs",
">",
"thresholdMs",
")",
"{",
"deleteNoException",
"(",
"file",
".",
"getLocation",
"(",
")",
")",
";",
"}",
"}"
] | Garbage collects a file if necessary.
@param file the file
@param checkpointSequenceNumber the first sequence number that has not been checkpointed | [
"Garbage",
"collects",
"a",
"file",
"if",
"necessary",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournalGarbageCollector.java#L118-L138 |
vlingo/vlingo-actors | src/main/java/io/vlingo/actors/Stage.java | Stage.allocateMailbox | private Mailbox allocateMailbox(final Definition definition, final Address address, final Mailbox maybeMailbox) {
"""
Answers a Mailbox for an Actor. If maybeMailbox is allocated answer it; otherwise
answer a newly allocated Mailbox. (INTERNAL ONLY)
@param definition the Definition of the newly created Actor
@param address the Address allocated to the Actor
@param maybeMailbox the possible Mailbox
@return Mailbox
"""
final Mailbox mailbox = maybeMailbox != null ?
maybeMailbox : ActorFactory.actorMailbox(this, address, definition);
return mailbox;
} | java | private Mailbox allocateMailbox(final Definition definition, final Address address, final Mailbox maybeMailbox) {
final Mailbox mailbox = maybeMailbox != null ?
maybeMailbox : ActorFactory.actorMailbox(this, address, definition);
return mailbox;
} | [
"private",
"Mailbox",
"allocateMailbox",
"(",
"final",
"Definition",
"definition",
",",
"final",
"Address",
"address",
",",
"final",
"Mailbox",
"maybeMailbox",
")",
"{",
"final",
"Mailbox",
"mailbox",
"=",
"maybeMailbox",
"!=",
"null",
"?",
"maybeMailbox",
":",
"ActorFactory",
".",
"actorMailbox",
"(",
"this",
",",
"address",
",",
"definition",
")",
";",
"return",
"mailbox",
";",
"}"
] | Answers a Mailbox for an Actor. If maybeMailbox is allocated answer it; otherwise
answer a newly allocated Mailbox. (INTERNAL ONLY)
@param definition the Definition of the newly created Actor
@param address the Address allocated to the Actor
@param maybeMailbox the possible Mailbox
@return Mailbox | [
"Answers",
"a",
"Mailbox",
"for",
"an",
"Actor",
".",
"If",
"maybeMailbox",
"is",
"allocated",
"answer",
"it",
";",
"otherwise",
"answer",
"a",
"newly",
"allocated",
"Mailbox",
".",
"(",
"INTERNAL",
"ONLY",
")"
] | train | https://github.com/vlingo/vlingo-actors/blob/c7d046fd139c0490cf0fd2588d7dc2f792f13493/src/main/java/io/vlingo/actors/Stage.java#L573-L577 |
jbehave/jbehave-core | jbehave-core/src/main/java/org/jbehave/core/embedder/StoryRunner.java | StoryRunner.storyOfPath | public Story storyOfPath(Configuration configuration, String storyPath) {
"""
Returns the parsed story from the given path
@param configuration the Configuration used to run story
@param storyPath the story path
@return The parsed Story
"""
String storyAsText = configuration.storyLoader().loadStoryAsText(storyPath);
return configuration.storyParser().parseStory(storyAsText, storyPath);
} | java | public Story storyOfPath(Configuration configuration, String storyPath) {
String storyAsText = configuration.storyLoader().loadStoryAsText(storyPath);
return configuration.storyParser().parseStory(storyAsText, storyPath);
} | [
"public",
"Story",
"storyOfPath",
"(",
"Configuration",
"configuration",
",",
"String",
"storyPath",
")",
"{",
"String",
"storyAsText",
"=",
"configuration",
".",
"storyLoader",
"(",
")",
".",
"loadStoryAsText",
"(",
"storyPath",
")",
";",
"return",
"configuration",
".",
"storyParser",
"(",
")",
".",
"parseStory",
"(",
"storyAsText",
",",
"storyPath",
")",
";",
"}"
] | Returns the parsed story from the given path
@param configuration the Configuration used to run story
@param storyPath the story path
@return The parsed Story | [
"Returns",
"the",
"parsed",
"story",
"from",
"the",
"given",
"path"
] | train | https://github.com/jbehave/jbehave-core/blob/bdd6a6199528df3c35087e72d4644870655b23e6/jbehave-core/src/main/java/org/jbehave/core/embedder/StoryRunner.java#L195-L198 |
leadware/jpersistence-tools | jpersistence-tools-api/src/main/java/net/leadware/persistence/tools/api/utils/RestrictionsContainer.java | RestrictionsContainer.addEq | public <Y extends Comparable<? super Y>> RestrictionsContainer addEq(String property, Y value) {
"""
Methode d'ajout de la restriction Eq
@param property Nom de la Propriete
@param value Valeur de la propriete
@param <Y> Type de valeur
@return Conteneur
"""
// Ajout de la restriction
restrictions.add(new Eq<Y>(property, value));
// On retourne le conteneur
return this;
} | java | public <Y extends Comparable<? super Y>> RestrictionsContainer addEq(String property, Y value) {
// Ajout de la restriction
restrictions.add(new Eq<Y>(property, value));
// On retourne le conteneur
return this;
} | [
"public",
"<",
"Y",
"extends",
"Comparable",
"<",
"?",
"super",
"Y",
">",
">",
"RestrictionsContainer",
"addEq",
"(",
"String",
"property",
",",
"Y",
"value",
")",
"{",
"// Ajout de la restriction\r",
"restrictions",
".",
"add",
"(",
"new",
"Eq",
"<",
"Y",
">",
"(",
"property",
",",
"value",
")",
")",
";",
"// On retourne le conteneur\r",
"return",
"this",
";",
"}"
] | Methode d'ajout de la restriction Eq
@param property Nom de la Propriete
@param value Valeur de la propriete
@param <Y> Type de valeur
@return Conteneur | [
"Methode",
"d",
"ajout",
"de",
"la",
"restriction",
"Eq"
] | train | https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-api/src/main/java/net/leadware/persistence/tools/api/utils/RestrictionsContainer.java#L89-L96 |
jlinn/quartz-redis-jobstore | src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java | AbstractRedisStorage.checkExists | public boolean checkExists(JobKey jobKey, T jedis) {
"""
Check if the job identified by the given key exists in storage
@param jobKey the key of the desired job
@param jedis a thread-safe Redis connection
@return true if the job exists; false otherwise
"""
return jedis.exists(redisSchema.jobHashKey(jobKey));
} | java | public boolean checkExists(JobKey jobKey, T jedis){
return jedis.exists(redisSchema.jobHashKey(jobKey));
} | [
"public",
"boolean",
"checkExists",
"(",
"JobKey",
"jobKey",
",",
"T",
"jedis",
")",
"{",
"return",
"jedis",
".",
"exists",
"(",
"redisSchema",
".",
"jobHashKey",
"(",
"jobKey",
")",
")",
";",
"}"
] | Check if the job identified by the given key exists in storage
@param jobKey the key of the desired job
@param jedis a thread-safe Redis connection
@return true if the job exists; false otherwise | [
"Check",
"if",
"the",
"job",
"identified",
"by",
"the",
"given",
"key",
"exists",
"in",
"storage"
] | train | https://github.com/jlinn/quartz-redis-jobstore/blob/be9a52ee776d8a09866fe99fd9718bc13a0cb992/src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java#L353-L355 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java | TransformersLogger.logAttributeWarning | public void logAttributeWarning(PathAddress address, ModelNode operation, String message, String attribute) {
"""
Log a warning for the given operation at the provided address for the given attribute, using the provided detail
message.
@param address where warning occurred
@param operation where which problem occurred
@param message custom error message to append
@param attribute attribute we that has problem
"""
messageQueue.add(new AttributeLogEntry(address, operation, message, attribute));
} | java | public void logAttributeWarning(PathAddress address, ModelNode operation, String message, String attribute) {
messageQueue.add(new AttributeLogEntry(address, operation, message, attribute));
} | [
"public",
"void",
"logAttributeWarning",
"(",
"PathAddress",
"address",
",",
"ModelNode",
"operation",
",",
"String",
"message",
",",
"String",
"attribute",
")",
"{",
"messageQueue",
".",
"add",
"(",
"new",
"AttributeLogEntry",
"(",
"address",
",",
"operation",
",",
"message",
",",
"attribute",
")",
")",
";",
"}"
] | Log a warning for the given operation at the provided address for the given attribute, using the provided detail
message.
@param address where warning occurred
@param operation where which problem occurred
@param message custom error message to append
@param attribute attribute we that has problem | [
"Log",
"a",
"warning",
"for",
"the",
"given",
"operation",
"at",
"the",
"provided",
"address",
"for",
"the",
"given",
"attribute",
"using",
"the",
"provided",
"detail",
"message",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java#L147-L149 |
aerogear/aerogear-android-pipe | library/src/main/java/org/jboss/aerogear/android/pipe/PipeManager.java | PipeManager.getPipe | public static LoaderPipe getPipe(String name, android.support.v4.app.Fragment fragment, Context applicationContext) {
"""
Look up for a pipe object. This will wrap the Pipe in a Loader.
@param name the name of the actual pipe
@param fragment the Fragment whose lifecycle the activity will follow
@param applicationContext the Context of the application.
@return the new created Pipe object
"""
Pipe pipe = pipes.get(name);
LoaderAdapter adapter = new LoaderAdapter(fragment, applicationContext, pipe, name);
adapter.setLoaderIds(loaderIdsForNamed);
return adapter;
} | java | public static LoaderPipe getPipe(String name, android.support.v4.app.Fragment fragment, Context applicationContext) {
Pipe pipe = pipes.get(name);
LoaderAdapter adapter = new LoaderAdapter(fragment, applicationContext, pipe, name);
adapter.setLoaderIds(loaderIdsForNamed);
return adapter;
} | [
"public",
"static",
"LoaderPipe",
"getPipe",
"(",
"String",
"name",
",",
"android",
".",
"support",
".",
"v4",
".",
"app",
".",
"Fragment",
"fragment",
",",
"Context",
"applicationContext",
")",
"{",
"Pipe",
"pipe",
"=",
"pipes",
".",
"get",
"(",
"name",
")",
";",
"LoaderAdapter",
"adapter",
"=",
"new",
"LoaderAdapter",
"(",
"fragment",
",",
"applicationContext",
",",
"pipe",
",",
"name",
")",
";",
"adapter",
".",
"setLoaderIds",
"(",
"loaderIdsForNamed",
")",
";",
"return",
"adapter",
";",
"}"
] | Look up for a pipe object. This will wrap the Pipe in a Loader.
@param name the name of the actual pipe
@param fragment the Fragment whose lifecycle the activity will follow
@param applicationContext the Context of the application.
@return the new created Pipe object | [
"Look",
"up",
"for",
"a",
"pipe",
"object",
".",
"This",
"will",
"wrap",
"the",
"Pipe",
"in",
"a",
"Loader",
"."
] | train | https://github.com/aerogear/aerogear-android-pipe/blob/ac747965c2d06d6ad46dd8abfbabf3d793f06fa5/library/src/main/java/org/jboss/aerogear/android/pipe/PipeManager.java#L152-L157 |
goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/util/dbextractor/MithraObjectGraphExtractor.java | MithraObjectGraphExtractor.addRelationshipFilter | public void addRelationshipFilter(RelatedFinder relatedFinder, Operation filter) {
"""
Add a filter to be applied to the result of a traversed relationship.
@param relatedFinder - the relationship to apply the filter to
@param filter - the filter to apply
"""
Operation existing = this.filters.get(relatedFinder);
this.filters.put(relatedFinder, existing == null ? filter : existing.or(filter));
} | java | public void addRelationshipFilter(RelatedFinder relatedFinder, Operation filter)
{
Operation existing = this.filters.get(relatedFinder);
this.filters.put(relatedFinder, existing == null ? filter : existing.or(filter));
} | [
"public",
"void",
"addRelationshipFilter",
"(",
"RelatedFinder",
"relatedFinder",
",",
"Operation",
"filter",
")",
"{",
"Operation",
"existing",
"=",
"this",
".",
"filters",
".",
"get",
"(",
"relatedFinder",
")",
";",
"this",
".",
"filters",
".",
"put",
"(",
"relatedFinder",
",",
"existing",
"==",
"null",
"?",
"filter",
":",
"existing",
".",
"or",
"(",
"filter",
")",
")",
";",
"}"
] | Add a filter to be applied to the result of a traversed relationship.
@param relatedFinder - the relationship to apply the filter to
@param filter - the filter to apply | [
"Add",
"a",
"filter",
"to",
"be",
"applied",
"to",
"the",
"result",
"of",
"a",
"traversed",
"relationship",
"."
] | train | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/util/dbextractor/MithraObjectGraphExtractor.java#L117-L121 |
groupon/odo | client/src/main/java/com/groupon/odo/client/PathValueClient.java | PathValueClient.setCustomResponse | public boolean setCustomResponse(String pathValue, String requestType, String customData) {
"""
Sets a custom response on an endpoint
@param pathValue path (endpoint) value
@param requestType path request type. "GET", "POST", etc
@param customData custom response data
@return true if success, false otherwise
"""
try {
JSONObject path = getPathFromEndpoint(pathValue, requestType);
if (path == null) {
String pathName = pathValue;
createPath(pathName, pathValue, requestType);
path = getPathFromEndpoint(pathValue, requestType);
}
String pathId = path.getString("pathId");
resetResponseOverride(pathId);
setCustomResponse(pathId, customData);
return toggleResponseOverride(pathId, true);
} catch (Exception e) {
e.printStackTrace();
}
return false;
} | java | public boolean setCustomResponse(String pathValue, String requestType, String customData) {
try {
JSONObject path = getPathFromEndpoint(pathValue, requestType);
if (path == null) {
String pathName = pathValue;
createPath(pathName, pathValue, requestType);
path = getPathFromEndpoint(pathValue, requestType);
}
String pathId = path.getString("pathId");
resetResponseOverride(pathId);
setCustomResponse(pathId, customData);
return toggleResponseOverride(pathId, true);
} catch (Exception e) {
e.printStackTrace();
}
return false;
} | [
"public",
"boolean",
"setCustomResponse",
"(",
"String",
"pathValue",
",",
"String",
"requestType",
",",
"String",
"customData",
")",
"{",
"try",
"{",
"JSONObject",
"path",
"=",
"getPathFromEndpoint",
"(",
"pathValue",
",",
"requestType",
")",
";",
"if",
"(",
"path",
"==",
"null",
")",
"{",
"String",
"pathName",
"=",
"pathValue",
";",
"createPath",
"(",
"pathName",
",",
"pathValue",
",",
"requestType",
")",
";",
"path",
"=",
"getPathFromEndpoint",
"(",
"pathValue",
",",
"requestType",
")",
";",
"}",
"String",
"pathId",
"=",
"path",
".",
"getString",
"(",
"\"pathId\"",
")",
";",
"resetResponseOverride",
"(",
"pathId",
")",
";",
"setCustomResponse",
"(",
"pathId",
",",
"customData",
")",
";",
"return",
"toggleResponseOverride",
"(",
"pathId",
",",
"true",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"false",
";",
"}"
] | Sets a custom response on an endpoint
@param pathValue path (endpoint) value
@param requestType path request type. "GET", "POST", etc
@param customData custom response data
@return true if success, false otherwise | [
"Sets",
"a",
"custom",
"response",
"on",
"an",
"endpoint"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/client/src/main/java/com/groupon/odo/client/PathValueClient.java#L125-L141 |
zackpollard/JavaTelegramBot-API | core/src/main/java/pro/zackpollard/telegrambot/api/TelegramBot.java | TelegramBot.editMessageText | public Message editMessageText(String chatId, Long messageId, String text, ParseMode parseMode, boolean disableWebPagePreview, InlineReplyMarkup inlineReplyMarkup) {
"""
This allows you to edit the text of a message you have already sent previously
@param chatId The chat ID of the chat containing the message you want to edit
@param messageId The message ID of the message you want to edit
@param text The new text you want to display
@param parseMode The ParseMode that should be used with this new text
@param disableWebPagePreview Whether any URLs should be displayed with a preview of their content
@param inlineReplyMarkup Any InlineReplyMarkup object you want to edit into the message
@return A new Message object representing the edited message
"""
if(chatId != null && messageId != null && text != null) {
JSONObject jsonResponse = this.editMessageText(chatId, messageId, null, text, parseMode, disableWebPagePreview, inlineReplyMarkup);
if (jsonResponse != null) {
return MessageImpl.createMessage(jsonResponse.getJSONObject("result"), this);
}
}
return null;
} | java | public Message editMessageText(String chatId, Long messageId, String text, ParseMode parseMode, boolean disableWebPagePreview, InlineReplyMarkup inlineReplyMarkup) {
if(chatId != null && messageId != null && text != null) {
JSONObject jsonResponse = this.editMessageText(chatId, messageId, null, text, parseMode, disableWebPagePreview, inlineReplyMarkup);
if (jsonResponse != null) {
return MessageImpl.createMessage(jsonResponse.getJSONObject("result"), this);
}
}
return null;
} | [
"public",
"Message",
"editMessageText",
"(",
"String",
"chatId",
",",
"Long",
"messageId",
",",
"String",
"text",
",",
"ParseMode",
"parseMode",
",",
"boolean",
"disableWebPagePreview",
",",
"InlineReplyMarkup",
"inlineReplyMarkup",
")",
"{",
"if",
"(",
"chatId",
"!=",
"null",
"&&",
"messageId",
"!=",
"null",
"&&",
"text",
"!=",
"null",
")",
"{",
"JSONObject",
"jsonResponse",
"=",
"this",
".",
"editMessageText",
"(",
"chatId",
",",
"messageId",
",",
"null",
",",
"text",
",",
"parseMode",
",",
"disableWebPagePreview",
",",
"inlineReplyMarkup",
")",
";",
"if",
"(",
"jsonResponse",
"!=",
"null",
")",
"{",
"return",
"MessageImpl",
".",
"createMessage",
"(",
"jsonResponse",
".",
"getJSONObject",
"(",
"\"result\"",
")",
",",
"this",
")",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | This allows you to edit the text of a message you have already sent previously
@param chatId The chat ID of the chat containing the message you want to edit
@param messageId The message ID of the message you want to edit
@param text The new text you want to display
@param parseMode The ParseMode that should be used with this new text
@param disableWebPagePreview Whether any URLs should be displayed with a preview of their content
@param inlineReplyMarkup Any InlineReplyMarkup object you want to edit into the message
@return A new Message object representing the edited message | [
"This",
"allows",
"you",
"to",
"edit",
"the",
"text",
"of",
"a",
"message",
"you",
"have",
"already",
"sent",
"previously"
] | train | https://github.com/zackpollard/JavaTelegramBot-API/blob/9d100f351824042ca5fc0ea735d1fa376a13e81d/core/src/main/java/pro/zackpollard/telegrambot/api/TelegramBot.java#L685-L698 |
andi12/msbuild-maven-plugin | msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/MojoHelper.java | MojoHelper.validateToolPath | public static void validateToolPath( File toolPath, String toolName, Log logger )
throws FileNotFoundException {
"""
Validates the path to a command-line tool.
@param toolPath the configured tool path from the POM
@param toolName the name of the tool, used for logging messages
@param logger a Log to write messages to
@throws FileNotFoundException if the tool cannot be found
"""
logger.debug( "Validating path for " + toolName );
if ( toolPath == null )
{
logger.error( "Missing " + toolName + " path" );
throw new FileNotFoundException();
}
if ( !toolPath.exists() || !toolPath.isFile() )
{
logger.error( "Could not find " + toolName + " at " + toolPath );
throw new FileNotFoundException( toolPath.getAbsolutePath() );
}
logger.debug( "Found " + toolName + " at " + toolPath );
} | java | public static void validateToolPath( File toolPath, String toolName, Log logger )
throws FileNotFoundException
{
logger.debug( "Validating path for " + toolName );
if ( toolPath == null )
{
logger.error( "Missing " + toolName + " path" );
throw new FileNotFoundException();
}
if ( !toolPath.exists() || !toolPath.isFile() )
{
logger.error( "Could not find " + toolName + " at " + toolPath );
throw new FileNotFoundException( toolPath.getAbsolutePath() );
}
logger.debug( "Found " + toolName + " at " + toolPath );
} | [
"public",
"static",
"void",
"validateToolPath",
"(",
"File",
"toolPath",
",",
"String",
"toolName",
",",
"Log",
"logger",
")",
"throws",
"FileNotFoundException",
"{",
"logger",
".",
"debug",
"(",
"\"Validating path for \"",
"+",
"toolName",
")",
";",
"if",
"(",
"toolPath",
"==",
"null",
")",
"{",
"logger",
".",
"error",
"(",
"\"Missing \"",
"+",
"toolName",
"+",
"\" path\"",
")",
";",
"throw",
"new",
"FileNotFoundException",
"(",
")",
";",
"}",
"if",
"(",
"!",
"toolPath",
".",
"exists",
"(",
")",
"||",
"!",
"toolPath",
".",
"isFile",
"(",
")",
")",
"{",
"logger",
".",
"error",
"(",
"\"Could not find \"",
"+",
"toolName",
"+",
"\" at \"",
"+",
"toolPath",
")",
";",
"throw",
"new",
"FileNotFoundException",
"(",
"toolPath",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}",
"logger",
".",
"debug",
"(",
"\"Found \"",
"+",
"toolName",
"+",
"\" at \"",
"+",
"toolPath",
")",
";",
"}"
] | Validates the path to a command-line tool.
@param toolPath the configured tool path from the POM
@param toolName the name of the tool, used for logging messages
@param logger a Log to write messages to
@throws FileNotFoundException if the tool cannot be found | [
"Validates",
"the",
"path",
"to",
"a",
"command",
"-",
"line",
"tool",
"."
] | train | https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/MojoHelper.java#L48-L66 |
google/closure-compiler | src/com/google/javascript/jscomp/parsing/parser/Parser.java | Parser.reportError | @FormatMethod
private void reportError(Token token, @FormatString String message, Object... arguments) {
"""
Reports an error message at a given token.
@param token The location to report the message at.
@param message The message to report in String.format style.
@param arguments The arguments to fill in the message format.
"""
if (token == null) {
reportError(message, arguments);
} else {
errorReporter.reportError(token.getStart(), message, arguments);
}
} | java | @FormatMethod
private void reportError(Token token, @FormatString String message, Object... arguments) {
if (token == null) {
reportError(message, arguments);
} else {
errorReporter.reportError(token.getStart(), message, arguments);
}
} | [
"@",
"FormatMethod",
"private",
"void",
"reportError",
"(",
"Token",
"token",
",",
"@",
"FormatString",
"String",
"message",
",",
"Object",
"...",
"arguments",
")",
"{",
"if",
"(",
"token",
"==",
"null",
")",
"{",
"reportError",
"(",
"message",
",",
"arguments",
")",
";",
"}",
"else",
"{",
"errorReporter",
".",
"reportError",
"(",
"token",
".",
"getStart",
"(",
")",
",",
"message",
",",
"arguments",
")",
";",
"}",
"}"
] | Reports an error message at a given token.
@param token The location to report the message at.
@param message The message to report in String.format style.
@param arguments The arguments to fill in the message format. | [
"Reports",
"an",
"error",
"message",
"at",
"a",
"given",
"token",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/parsing/parser/Parser.java#L4227-L4234 |
cdk/cdk | app/depict/src/main/java/org/openscience/cdk/depict/DepictionGenerator.java | DepictionGenerator.withAtomNumbers | public DepictionGenerator withAtomNumbers() {
"""
Display atom numbers on the molecule or reaction. The numbers are based on the
ordering of atoms in the molecule data structure and not a systematic system
such as IUPAC numbering.
Note: A depiction can not have both atom numbers and atom maps visible
(but this can be achieved by manually setting the annotation).
@return new generator for method chaining
@see #withAtomMapNumbers()
@see StandardGenerator#ANNOTATION_LABEL
"""
if (annotateAtomMap || annotateAtomVal)
throw new IllegalArgumentException("Can not annotated atom numbers, atom values or maps are already annotated");
DepictionGenerator copy = new DepictionGenerator(this);
copy.annotateAtomNum = true;
return copy;
} | java | public DepictionGenerator withAtomNumbers() {
if (annotateAtomMap || annotateAtomVal)
throw new IllegalArgumentException("Can not annotated atom numbers, atom values or maps are already annotated");
DepictionGenerator copy = new DepictionGenerator(this);
copy.annotateAtomNum = true;
return copy;
} | [
"public",
"DepictionGenerator",
"withAtomNumbers",
"(",
")",
"{",
"if",
"(",
"annotateAtomMap",
"||",
"annotateAtomVal",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Can not annotated atom numbers, atom values or maps are already annotated\"",
")",
";",
"DepictionGenerator",
"copy",
"=",
"new",
"DepictionGenerator",
"(",
"this",
")",
";",
"copy",
".",
"annotateAtomNum",
"=",
"true",
";",
"return",
"copy",
";",
"}"
] | Display atom numbers on the molecule or reaction. The numbers are based on the
ordering of atoms in the molecule data structure and not a systematic system
such as IUPAC numbering.
Note: A depiction can not have both atom numbers and atom maps visible
(but this can be achieved by manually setting the annotation).
@return new generator for method chaining
@see #withAtomMapNumbers()
@see StandardGenerator#ANNOTATION_LABEL | [
"Display",
"atom",
"numbers",
"on",
"the",
"molecule",
"or",
"reaction",
".",
"The",
"numbers",
"are",
"based",
"on",
"the",
"ordering",
"of",
"atoms",
"in",
"the",
"molecule",
"data",
"structure",
"and",
"not",
"a",
"systematic",
"system",
"such",
"as",
"IUPAC",
"numbering",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/app/depict/src/main/java/org/openscience/cdk/depict/DepictionGenerator.java#L771-L777 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/cli/CliClient.java | CliClient.columnNameAsBytes | private ByteBuffer columnNameAsBytes(String column, String columnFamily) {
"""
Converts column name into byte[] according to comparator type
@param column - column name from parser
@param columnFamily - column family name from parser
@return ByteBuffer - bytes into which column name was converted according to comparator type
"""
CfDef columnFamilyDef = getCfDef(columnFamily);
return columnNameAsBytes(column, columnFamilyDef);
} | java | private ByteBuffer columnNameAsBytes(String column, String columnFamily)
{
CfDef columnFamilyDef = getCfDef(columnFamily);
return columnNameAsBytes(column, columnFamilyDef);
} | [
"private",
"ByteBuffer",
"columnNameAsBytes",
"(",
"String",
"column",
",",
"String",
"columnFamily",
")",
"{",
"CfDef",
"columnFamilyDef",
"=",
"getCfDef",
"(",
"columnFamily",
")",
";",
"return",
"columnNameAsBytes",
"(",
"column",
",",
"columnFamilyDef",
")",
";",
"}"
] | Converts column name into byte[] according to comparator type
@param column - column name from parser
@param columnFamily - column family name from parser
@return ByteBuffer - bytes into which column name was converted according to comparator type | [
"Converts",
"column",
"name",
"into",
"byte",
"[]",
"according",
"to",
"comparator",
"type"
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/cli/CliClient.java#L2572-L2576 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/processing/JavacFiler.java | JavacFiler.closeFileObject | private void closeFileObject(String typeName, FileObject fileObject) {
"""
Upon close, register files opened by create{Source, Class}File
for annotation processing.
"""
/*
* If typeName is non-null, the file object was opened as a
* source or class file by the user. If a file was opened as
* a resource, typeName will be null and the file is *not*
* subject to annotation processing.
*/
if ((typeName != null)) {
if (!(fileObject instanceof JavaFileObject))
throw new AssertionError("JavaFileOject not found for " + fileObject);
JavaFileObject javaFileObject = (JavaFileObject)fileObject;
switch(javaFileObject.getKind()) {
case SOURCE:
generatedSourceNames.add(typeName);
generatedSourceFileObjects.add(javaFileObject);
openTypeNames.remove(typeName);
break;
case CLASS:
generatedClasses.put(typeName, javaFileObject);
openTypeNames.remove(typeName);
break;
default:
break;
}
}
} | java | private void closeFileObject(String typeName, FileObject fileObject) {
/*
* If typeName is non-null, the file object was opened as a
* source or class file by the user. If a file was opened as
* a resource, typeName will be null and the file is *not*
* subject to annotation processing.
*/
if ((typeName != null)) {
if (!(fileObject instanceof JavaFileObject))
throw new AssertionError("JavaFileOject not found for " + fileObject);
JavaFileObject javaFileObject = (JavaFileObject)fileObject;
switch(javaFileObject.getKind()) {
case SOURCE:
generatedSourceNames.add(typeName);
generatedSourceFileObjects.add(javaFileObject);
openTypeNames.remove(typeName);
break;
case CLASS:
generatedClasses.put(typeName, javaFileObject);
openTypeNames.remove(typeName);
break;
default:
break;
}
}
} | [
"private",
"void",
"closeFileObject",
"(",
"String",
"typeName",
",",
"FileObject",
"fileObject",
")",
"{",
"/*\n * If typeName is non-null, the file object was opened as a\n * source or class file by the user. If a file was opened as\n * a resource, typeName will be null and the file is *not*\n * subject to annotation processing.\n */",
"if",
"(",
"(",
"typeName",
"!=",
"null",
")",
")",
"{",
"if",
"(",
"!",
"(",
"fileObject",
"instanceof",
"JavaFileObject",
")",
")",
"throw",
"new",
"AssertionError",
"(",
"\"JavaFileOject not found for \"",
"+",
"fileObject",
")",
";",
"JavaFileObject",
"javaFileObject",
"=",
"(",
"JavaFileObject",
")",
"fileObject",
";",
"switch",
"(",
"javaFileObject",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"SOURCE",
":",
"generatedSourceNames",
".",
"add",
"(",
"typeName",
")",
";",
"generatedSourceFileObjects",
".",
"add",
"(",
"javaFileObject",
")",
";",
"openTypeNames",
".",
"remove",
"(",
"typeName",
")",
";",
"break",
";",
"case",
"CLASS",
":",
"generatedClasses",
".",
"put",
"(",
"typeName",
",",
"javaFileObject",
")",
";",
"openTypeNames",
".",
"remove",
"(",
"typeName",
")",
";",
"break",
";",
"default",
":",
"break",
";",
"}",
"}",
"}"
] | Upon close, register files opened by create{Source, Class}File
for annotation processing. | [
"Upon",
"close",
"register",
"files",
"opened",
"by",
"create",
"{",
"Source",
"Class",
"}",
"File",
"for",
"annotation",
"processing",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/processing/JavacFiler.java#L613-L640 |
google/closure-templates | java/src/com/google/template/soy/msgs/internal/IcuSyntaxUtils.java | IcuSyntaxUtils.getPluralOpenString | private static String getPluralOpenString(String varName, int offset) {
"""
Gets the opening (left) string for a plural statement.
@param varName The plural var name.
@param offset The offset.
@return the ICU syntax string for the plural opening string.
"""
StringBuilder openingPartSb = new StringBuilder();
openingPartSb.append('{').append(varName).append(",plural,");
if (offset != 0) {
openingPartSb.append("offset:").append(offset).append(' ');
}
return openingPartSb.toString();
} | java | private static String getPluralOpenString(String varName, int offset) {
StringBuilder openingPartSb = new StringBuilder();
openingPartSb.append('{').append(varName).append(",plural,");
if (offset != 0) {
openingPartSb.append("offset:").append(offset).append(' ');
}
return openingPartSb.toString();
} | [
"private",
"static",
"String",
"getPluralOpenString",
"(",
"String",
"varName",
",",
"int",
"offset",
")",
"{",
"StringBuilder",
"openingPartSb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"openingPartSb",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"varName",
")",
".",
"append",
"(",
"\",plural,\"",
")",
";",
"if",
"(",
"offset",
"!=",
"0",
")",
"{",
"openingPartSb",
".",
"append",
"(",
"\"offset:\"",
")",
".",
"append",
"(",
"offset",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"return",
"openingPartSb",
".",
"toString",
"(",
")",
";",
"}"
] | Gets the opening (left) string for a plural statement.
@param varName The plural var name.
@param offset The offset.
@return the ICU syntax string for the plural opening string. | [
"Gets",
"the",
"opening",
"(",
"left",
")",
"string",
"for",
"a",
"plural",
"statement",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/msgs/internal/IcuSyntaxUtils.java#L267-L274 |
alkacon/opencms-core | src/org/opencms/importexport/CmsExport.java | CmsExport.addRelationNode | protected void addRelationNode(Element relationsElement, String structureId, String sitePath, String relationType) {
"""
Adds a relation node to the <code>manifest.xml</code>.<p>
@param relationsElement the parent element to append the node to
@param structureId the structure id of the target relation
@param sitePath the site path of the target relation
@param relationType the type of the relation
"""
if ((structureId != null) && (sitePath != null) && (relationType != null)) {
Element relationElement = relationsElement.addElement(CmsImportVersion10.N_RELATION);
relationElement.addElement(CmsImportVersion10.N_ID).addText(structureId);
relationElement.addElement(CmsImportVersion10.N_PATH).addText(sitePath);
relationElement.addElement(CmsImportVersion10.N_TYPE).addText(relationType);
}
} | java | protected void addRelationNode(Element relationsElement, String structureId, String sitePath, String relationType) {
if ((structureId != null) && (sitePath != null) && (relationType != null)) {
Element relationElement = relationsElement.addElement(CmsImportVersion10.N_RELATION);
relationElement.addElement(CmsImportVersion10.N_ID).addText(structureId);
relationElement.addElement(CmsImportVersion10.N_PATH).addText(sitePath);
relationElement.addElement(CmsImportVersion10.N_TYPE).addText(relationType);
}
} | [
"protected",
"void",
"addRelationNode",
"(",
"Element",
"relationsElement",
",",
"String",
"structureId",
",",
"String",
"sitePath",
",",
"String",
"relationType",
")",
"{",
"if",
"(",
"(",
"structureId",
"!=",
"null",
")",
"&&",
"(",
"sitePath",
"!=",
"null",
")",
"&&",
"(",
"relationType",
"!=",
"null",
")",
")",
"{",
"Element",
"relationElement",
"=",
"relationsElement",
".",
"addElement",
"(",
"CmsImportVersion10",
".",
"N_RELATION",
")",
";",
"relationElement",
".",
"addElement",
"(",
"CmsImportVersion10",
".",
"N_ID",
")",
".",
"addText",
"(",
"structureId",
")",
";",
"relationElement",
".",
"addElement",
"(",
"CmsImportVersion10",
".",
"N_PATH",
")",
".",
"addText",
"(",
"sitePath",
")",
";",
"relationElement",
".",
"addElement",
"(",
"CmsImportVersion10",
".",
"N_TYPE",
")",
".",
"addText",
"(",
"relationType",
")",
";",
"}",
"}"
] | Adds a relation node to the <code>manifest.xml</code>.<p>
@param relationsElement the parent element to append the node to
@param structureId the structure id of the target relation
@param sitePath the site path of the target relation
@param relationType the type of the relation | [
"Adds",
"a",
"relation",
"node",
"to",
"the",
"<code",
">",
"manifest",
".",
"xml<",
"/",
"code",
">",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/CmsExport.java#L470-L479 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.dedicated_server_serviceName_firewall_duration_POST | public OvhOrder dedicated_server_serviceName_firewall_duration_POST(String serviceName, String duration, OvhFirewallModelEnum firewallModel) throws IOException {
"""
Create order
REST: POST /order/dedicated/server/{serviceName}/firewall/{duration}
@param firewallModel [required] Firewall type
@param serviceName [required] The internal name of your dedicated server
@param duration [required] Duration
"""
String qPath = "/order/dedicated/server/{serviceName}/firewall/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "firewallModel", firewallModel);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder dedicated_server_serviceName_firewall_duration_POST(String serviceName, String duration, OvhFirewallModelEnum firewallModel) throws IOException {
String qPath = "/order/dedicated/server/{serviceName}/firewall/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "firewallModel", firewallModel);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"dedicated_server_serviceName_firewall_duration_POST",
"(",
"String",
"serviceName",
",",
"String",
"duration",
",",
"OvhFirewallModelEnum",
"firewallModel",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/dedicated/server/{serviceName}/firewall/{duration}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"duration",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"firewallModel\"",
",",
"firewallModel",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhOrder",
".",
"class",
")",
";",
"}"
] | Create order
REST: POST /order/dedicated/server/{serviceName}/firewall/{duration}
@param firewallModel [required] Firewall type
@param serviceName [required] The internal name of your dedicated server
@param duration [required] Duration | [
"Create",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L2802-L2809 |
javalite/activejdbc | javalite-common/src/main/java/org/javalite/common/Templator.java | Templator.mergeFromTemplate | public static String mergeFromTemplate(String template, Map<String, ?> values) {
"""
Merges from string as template.
@param template template content, with placeholders like: {{name}}
@param values map with values to merge
"""
for (String param : values.keySet()) {
template = template.replace("{{" + param + "}}", values.get(param) == null ? "" : values.get(param).toString());
}
return template.replaceAll("\n|\r| ", "");
} | java | public static String mergeFromTemplate(String template, Map<String, ?> values) {
for (String param : values.keySet()) {
template = template.replace("{{" + param + "}}", values.get(param) == null ? "" : values.get(param).toString());
}
return template.replaceAll("\n|\r| ", "");
} | [
"public",
"static",
"String",
"mergeFromTemplate",
"(",
"String",
"template",
",",
"Map",
"<",
"String",
",",
"?",
">",
"values",
")",
"{",
"for",
"(",
"String",
"param",
":",
"values",
".",
"keySet",
"(",
")",
")",
"{",
"template",
"=",
"template",
".",
"replace",
"(",
"\"{{\"",
"+",
"param",
"+",
"\"}}\"",
",",
"values",
".",
"get",
"(",
"param",
")",
"==",
"null",
"?",
"\"\"",
":",
"values",
".",
"get",
"(",
"param",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"template",
".",
"replaceAll",
"(",
"\"\\n|\\r| \"",
",",
"\"\"",
")",
";",
"}"
] | Merges from string as template.
@param template template content, with placeholders like: {{name}}
@param values map with values to merge | [
"Merges",
"from",
"string",
"as",
"template",
"."
] | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Templator.java#L91-L96 |
teatrove/teatrove | teaservlet/src/main/java/org/teatrove/teaservlet/util/cluster/ClusterManager.java | ClusterManager.launchAuto | public void launchAuto(boolean active) {
"""
Allows the management thread to passively take part in the cluster
operations.
Other cluster members will not be made aware of this instance.
"""
killAuto();
if (mSock != null) {
try {
mAuto = new AutomaticClusterManagementThread(this, mCluster
.getClusterName(),
active);
}
catch (Exception e) {
mAuto = new AutomaticClusterManagementThread(this, active);
}
if (mAuto != null) {
mAuto.start();
}
}
} | java | public void launchAuto(boolean active) {
killAuto();
if (mSock != null) {
try {
mAuto = new AutomaticClusterManagementThread(this, mCluster
.getClusterName(),
active);
}
catch (Exception e) {
mAuto = new AutomaticClusterManagementThread(this, active);
}
if (mAuto != null) {
mAuto.start();
}
}
} | [
"public",
"void",
"launchAuto",
"(",
"boolean",
"active",
")",
"{",
"killAuto",
"(",
")",
";",
"if",
"(",
"mSock",
"!=",
"null",
")",
"{",
"try",
"{",
"mAuto",
"=",
"new",
"AutomaticClusterManagementThread",
"(",
"this",
",",
"mCluster",
".",
"getClusterName",
"(",
")",
",",
"active",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"mAuto",
"=",
"new",
"AutomaticClusterManagementThread",
"(",
"this",
",",
"active",
")",
";",
"}",
"if",
"(",
"mAuto",
"!=",
"null",
")",
"{",
"mAuto",
".",
"start",
"(",
")",
";",
"}",
"}",
"}"
] | Allows the management thread to passively take part in the cluster
operations.
Other cluster members will not be made aware of this instance. | [
"Allows",
"the",
"management",
"thread",
"to",
"passively",
"take",
"part",
"in",
"the",
"cluster",
"operations",
".",
"Other",
"cluster",
"members",
"will",
"not",
"be",
"made",
"aware",
"of",
"this",
"instance",
"."
] | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teaservlet/util/cluster/ClusterManager.java#L440-L455 |
zaproxy/zaproxy | src/org/apache/commons/httpclient/HttpMethodBase.java | HttpMethodBase.writeRequestHeaders | protected void writeRequestHeaders(HttpState state, HttpConnection conn)
throws IOException, HttpException {
"""
Writes the request headers to the given {@link HttpConnection connection}.
<p>
This implementation invokes {@link #addRequestHeaders(HttpState,HttpConnection)},
and then writes each header to the request stream.
</p>
<p>
Subclasses may want to override this method to to customize the
processing.
</p>
@param state the {@link HttpState state} information associated with this method
@param conn the {@link HttpConnection connection} used to execute
this HTTP method
@throws IOException if an I/O (transport) error occurs. Some transport exceptions
can be recovered from.
@throws HttpException if a protocol exception occurs. Usually protocol exceptions
cannot be recovered from.
@see #addRequestHeaders
@see #getRequestHeaders
"""
LOG.trace("enter HttpMethodBase.writeRequestHeaders(HttpState,"
+ "HttpConnection)");
addRequestHeaders(state, conn);
String charset = getParams().getHttpElementCharset();
Header[] headers = getRequestHeaders();
for (int i = 0; i < headers.length; i++) {
String s = headers[i].toExternalForm();
if (Wire.HEADER_WIRE.enabled()) {
Wire.HEADER_WIRE.output(s);
}
conn.print(s, charset);
}
} | java | protected void writeRequestHeaders(HttpState state, HttpConnection conn)
throws IOException, HttpException {
LOG.trace("enter HttpMethodBase.writeRequestHeaders(HttpState,"
+ "HttpConnection)");
addRequestHeaders(state, conn);
String charset = getParams().getHttpElementCharset();
Header[] headers = getRequestHeaders();
for (int i = 0; i < headers.length; i++) {
String s = headers[i].toExternalForm();
if (Wire.HEADER_WIRE.enabled()) {
Wire.HEADER_WIRE.output(s);
}
conn.print(s, charset);
}
} | [
"protected",
"void",
"writeRequestHeaders",
"(",
"HttpState",
"state",
",",
"HttpConnection",
"conn",
")",
"throws",
"IOException",
",",
"HttpException",
"{",
"LOG",
".",
"trace",
"(",
"\"enter HttpMethodBase.writeRequestHeaders(HttpState,\"",
"+",
"\"HttpConnection)\"",
")",
";",
"addRequestHeaders",
"(",
"state",
",",
"conn",
")",
";",
"String",
"charset",
"=",
"getParams",
"(",
")",
".",
"getHttpElementCharset",
"(",
")",
";",
"Header",
"[",
"]",
"headers",
"=",
"getRequestHeaders",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"headers",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"s",
"=",
"headers",
"[",
"i",
"]",
".",
"toExternalForm",
"(",
")",
";",
"if",
"(",
"Wire",
".",
"HEADER_WIRE",
".",
"enabled",
"(",
")",
")",
"{",
"Wire",
".",
"HEADER_WIRE",
".",
"output",
"(",
"s",
")",
";",
"}",
"conn",
".",
"print",
"(",
"s",
",",
"charset",
")",
";",
"}",
"}"
] | Writes the request headers to the given {@link HttpConnection connection}.
<p>
This implementation invokes {@link #addRequestHeaders(HttpState,HttpConnection)},
and then writes each header to the request stream.
</p>
<p>
Subclasses may want to override this method to to customize the
processing.
</p>
@param state the {@link HttpState state} information associated with this method
@param conn the {@link HttpConnection connection} used to execute
this HTTP method
@throws IOException if an I/O (transport) error occurs. Some transport exceptions
can be recovered from.
@throws HttpException if a protocol exception occurs. Usually protocol exceptions
cannot be recovered from.
@see #addRequestHeaders
@see #getRequestHeaders | [
"Writes",
"the",
"request",
"headers",
"to",
"the",
"given",
"{",
"@link",
"HttpConnection",
"connection",
"}",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/apache/commons/httpclient/HttpMethodBase.java#L2305-L2321 |
WiQuery/wiquery | wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/position/PositionAlignmentOptions.java | PositionAlignmentOptions.setVerticalAlignment | public PositionAlignmentOptions setVerticalAlignment(PositionRelation verticalAlignment, int offsetTop) {
"""
Set the verticalAlignment property with an offset. One of TOP, CENTER, BOTTOM.
@param verticalAlignment
@param offsetTop
@return the instance
"""
switch (verticalAlignment)
{
case TOP:
case CENTER:
case BOTTOM:
break;
default:
throw new IllegalArgumentException("Illegal value for the vertical alignment property");
}
this.verticalAlignment = verticalAlignment;
this.offsetTop = offsetTop;
return this;
} | java | public PositionAlignmentOptions setVerticalAlignment(PositionRelation verticalAlignment, int offsetTop)
{
switch (verticalAlignment)
{
case TOP:
case CENTER:
case BOTTOM:
break;
default:
throw new IllegalArgumentException("Illegal value for the vertical alignment property");
}
this.verticalAlignment = verticalAlignment;
this.offsetTop = offsetTop;
return this;
} | [
"public",
"PositionAlignmentOptions",
"setVerticalAlignment",
"(",
"PositionRelation",
"verticalAlignment",
",",
"int",
"offsetTop",
")",
"{",
"switch",
"(",
"verticalAlignment",
")",
"{",
"case",
"TOP",
":",
"case",
"CENTER",
":",
"case",
"BOTTOM",
":",
"break",
";",
"default",
":",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Illegal value for the vertical alignment property\"",
")",
";",
"}",
"this",
".",
"verticalAlignment",
"=",
"verticalAlignment",
";",
"this",
".",
"offsetTop",
"=",
"offsetTop",
";",
"return",
"this",
";",
"}"
] | Set the verticalAlignment property with an offset. One of TOP, CENTER, BOTTOM.
@param verticalAlignment
@param offsetTop
@return the instance | [
"Set",
"the",
"verticalAlignment",
"property",
"with",
"an",
"offset",
".",
"One",
"of",
"TOP",
"CENTER",
"BOTTOM",
"."
] | train | https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/position/PositionAlignmentOptions.java#L289-L304 |
PrashamTrivedi/SharedPreferenceInspector | sharedpreferenceinspector/src/main/java/com/ceelites/sharedpreferenceinspector/fragments/SharedPreferencesItem.java | SharedPreferencesItem.storeOriginal | private void storeOriginal(Pair<String, Object> keyValue) {
"""
Store original value before it's changed in test mode. It will take care not to over write if original value is already stored.
@param keyValue
: Pair of key and original value.
"""
String key = SharedPreferenceUtils.keyTestMode + keyValue.first;
if (!preferenceUtils.isValueExistForKey(key)) {
preferenceUtils.put(key, keyValue.second);
}
} | java | private void storeOriginal(Pair<String, Object> keyValue) {
String key = SharedPreferenceUtils.keyTestMode + keyValue.first;
if (!preferenceUtils.isValueExistForKey(key)) {
preferenceUtils.put(key, keyValue.second);
}
} | [
"private",
"void",
"storeOriginal",
"(",
"Pair",
"<",
"String",
",",
"Object",
">",
"keyValue",
")",
"{",
"String",
"key",
"=",
"SharedPreferenceUtils",
".",
"keyTestMode",
"+",
"keyValue",
".",
"first",
";",
"if",
"(",
"!",
"preferenceUtils",
".",
"isValueExistForKey",
"(",
"key",
")",
")",
"{",
"preferenceUtils",
".",
"put",
"(",
"key",
",",
"keyValue",
".",
"second",
")",
";",
"}",
"}"
] | Store original value before it's changed in test mode. It will take care not to over write if original value is already stored.
@param keyValue
: Pair of key and original value. | [
"Store",
"original",
"value",
"before",
"it",
"s",
"changed",
"in",
"test",
"mode",
".",
"It",
"will",
"take",
"care",
"not",
"to",
"over",
"write",
"if",
"original",
"value",
"is",
"already",
"stored",
"."
] | train | https://github.com/PrashamTrivedi/SharedPreferenceInspector/blob/c04d567c4d0fc5e0f8cda308ca85df19c6b3b838/sharedpreferenceinspector/src/main/java/com/ceelites/sharedpreferenceinspector/fragments/SharedPreferencesItem.java#L373-L380 |
ahome-it/lienzo-core | src/main/java/com/ait/lienzo/shared/core/types/Color.java | Color.rgbToBrowserHexColor | public static final String rgbToBrowserHexColor(final int r, final int g, final int b) {
"""
Converts RGB to hex browser-compliance color, e.g. "#1234EF"
@param r int between 0 and 255
@param g int between 0 and 255
@param b int between 0 and 255
@return String
"""
return "#" + toBrowserHexValue(r) + toBrowserHexValue(g) + toBrowserHexValue(b);
} | java | public static final String rgbToBrowserHexColor(final int r, final int g, final int b)
{
return "#" + toBrowserHexValue(r) + toBrowserHexValue(g) + toBrowserHexValue(b);
} | [
"public",
"static",
"final",
"String",
"rgbToBrowserHexColor",
"(",
"final",
"int",
"r",
",",
"final",
"int",
"g",
",",
"final",
"int",
"b",
")",
"{",
"return",
"\"#\"",
"+",
"toBrowserHexValue",
"(",
"r",
")",
"+",
"toBrowserHexValue",
"(",
"g",
")",
"+",
"toBrowserHexValue",
"(",
"b",
")",
";",
"}"
] | Converts RGB to hex browser-compliance color, e.g. "#1234EF"
@param r int between 0 and 255
@param g int between 0 and 255
@param b int between 0 and 255
@return String | [
"Converts",
"RGB",
"to",
"hex",
"browser",
"-",
"compliance",
"color",
"e",
".",
"g",
".",
"#1234EF"
] | train | https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/shared/core/types/Color.java#L511-L514 |
apache/incubator-heron | heron/packing/src/java/org/apache/heron/packing/roundrobin/RoundRobinPacking.java | RoundRobinPacking.getLargestContainerSize | private int getLargestContainerSize(Map<Integer, List<InstanceId>> allocation) {
"""
Get # of instances in the largest container
@param allocation the instances' allocation
@return # of instances in the largest container
"""
int max = 0;
for (List<InstanceId> instances : allocation.values()) {
if (instances.size() > max) {
max = instances.size();
}
}
return max;
} | java | private int getLargestContainerSize(Map<Integer, List<InstanceId>> allocation) {
int max = 0;
for (List<InstanceId> instances : allocation.values()) {
if (instances.size() > max) {
max = instances.size();
}
}
return max;
} | [
"private",
"int",
"getLargestContainerSize",
"(",
"Map",
"<",
"Integer",
",",
"List",
"<",
"InstanceId",
">",
">",
"allocation",
")",
"{",
"int",
"max",
"=",
"0",
";",
"for",
"(",
"List",
"<",
"InstanceId",
">",
"instances",
":",
"allocation",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"instances",
".",
"size",
"(",
")",
">",
"max",
")",
"{",
"max",
"=",
"instances",
".",
"size",
"(",
")",
";",
"}",
"}",
"return",
"max",
";",
"}"
] | Get # of instances in the largest container
@param allocation the instances' allocation
@return # of instances in the largest container | [
"Get",
"#",
"of",
"instances",
"in",
"the",
"largest",
"container"
] | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/packing/src/java/org/apache/heron/packing/roundrobin/RoundRobinPacking.java#L421-L429 |
thymeleaf/thymeleaf | src/main/java/org/thymeleaf/templateresolver/AbstractConfigurableTemplateResolver.java | AbstractConfigurableTemplateResolver.setTemplateAliases | public final void setTemplateAliases(final Map<String,String> templateAliases) {
"""
<p>
Sets all the new template aliases to be used.
</p>
<p>
Template aliases allow the use of several (and probably shorter)
names for templates.
</p>
<p>
Aliases are applied to template names <b>before</b> prefix/suffix.
</p>
@param templateAliases the new template aliases.
"""
if (templateAliases != null) {
this.templateAliases.putAll(templateAliases);
}
} | java | public final void setTemplateAliases(final Map<String,String> templateAliases) {
if (templateAliases != null) {
this.templateAliases.putAll(templateAliases);
}
} | [
"public",
"final",
"void",
"setTemplateAliases",
"(",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"templateAliases",
")",
"{",
"if",
"(",
"templateAliases",
"!=",
"null",
")",
"{",
"this",
".",
"templateAliases",
".",
"putAll",
"(",
"templateAliases",
")",
";",
"}",
"}"
] | <p>
Sets all the new template aliases to be used.
</p>
<p>
Template aliases allow the use of several (and probably shorter)
names for templates.
</p>
<p>
Aliases are applied to template names <b>before</b> prefix/suffix.
</p>
@param templateAliases the new template aliases. | [
"<p",
">",
"Sets",
"all",
"the",
"new",
"template",
"aliases",
"to",
"be",
"used",
".",
"<",
"/",
"p",
">",
"<p",
">",
"Template",
"aliases",
"allow",
"the",
"use",
"of",
"several",
"(",
"and",
"probably",
"shorter",
")",
"names",
"for",
"templates",
".",
"<",
"/",
"p",
">",
"<p",
">",
"Aliases",
"are",
"applied",
"to",
"template",
"names",
"<b",
">",
"before<",
"/",
"b",
">",
"prefix",
"/",
"suffix",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/thymeleaf/thymeleaf/blob/2b0e6d6d7571fbe638904b5fd222fc9e77188879/src/main/java/org/thymeleaf/templateresolver/AbstractConfigurableTemplateResolver.java#L482-L486 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/OrdersInner.java | OrdersInner.listByDataBoxEdgeDeviceAsync | public Observable<Page<OrderInner>> listByDataBoxEdgeDeviceAsync(final String deviceName, final String resourceGroupName) {
"""
Lists all the orders related to a data box edge/gateway device.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<OrderInner> object
"""
return listByDataBoxEdgeDeviceWithServiceResponseAsync(deviceName, resourceGroupName)
.map(new Func1<ServiceResponse<Page<OrderInner>>, Page<OrderInner>>() {
@Override
public Page<OrderInner> call(ServiceResponse<Page<OrderInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<OrderInner>> listByDataBoxEdgeDeviceAsync(final String deviceName, final String resourceGroupName) {
return listByDataBoxEdgeDeviceWithServiceResponseAsync(deviceName, resourceGroupName)
.map(new Func1<ServiceResponse<Page<OrderInner>>, Page<OrderInner>>() {
@Override
public Page<OrderInner> call(ServiceResponse<Page<OrderInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"OrderInner",
">",
">",
"listByDataBoxEdgeDeviceAsync",
"(",
"final",
"String",
"deviceName",
",",
"final",
"String",
"resourceGroupName",
")",
"{",
"return",
"listByDataBoxEdgeDeviceWithServiceResponseAsync",
"(",
"deviceName",
",",
"resourceGroupName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"OrderInner",
">",
">",
",",
"Page",
"<",
"OrderInner",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Page",
"<",
"OrderInner",
">",
"call",
"(",
"ServiceResponse",
"<",
"Page",
"<",
"OrderInner",
">",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Lists all the orders related to a data box edge/gateway device.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<OrderInner> object | [
"Lists",
"all",
"the",
"orders",
"related",
"to",
"a",
"data",
"box",
"edge",
"/",
"gateway",
"device",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/OrdersInner.java#L144-L152 |
peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java | BaseCrawler.start | private void start(final WebDriver webDriver, final boolean isResuming) {
"""
Performs initialization and runs the crawler.
@param isResuming indicates if a previously saved state is to be resumed
"""
try {
Validate.validState(isStopped, "The crawler is already running.");
this.webDriver = Validate.notNull(webDriver, "The webdriver cannot be null.");
// If the crawl delay strategy is set to adaptive, we check if the browser supports the
// Navigation Timing API or not. However HtmlUnit requires a page to be loaded first
// before executing JavaScript, so we load a blank page.
if (webDriver instanceof HtmlUnitDriver
&& config.getCrawlDelayStrategy().equals(CrawlDelayStrategy.ADAPTIVE)) {
webDriver.get(WebClient.ABOUT_BLANK);
}
if (!isResuming) {
crawlFrontier = new CrawlFrontier(config);
}
cookieStore = new BasicCookieStore();
httpClient = HttpClientBuilder.create()
.setDefaultCookieStore(cookieStore)
.useSystemProperties()
.build();
crawlDelayMechanism = createCrawlDelayMechanism();
isStopped = false;
run();
} finally {
HttpClientUtils.closeQuietly(httpClient);
if (this.webDriver != null) {
this.webDriver.quit();
}
isStopping = false;
isStopped = true;
}
} | java | private void start(final WebDriver webDriver, final boolean isResuming) {
try {
Validate.validState(isStopped, "The crawler is already running.");
this.webDriver = Validate.notNull(webDriver, "The webdriver cannot be null.");
// If the crawl delay strategy is set to adaptive, we check if the browser supports the
// Navigation Timing API or not. However HtmlUnit requires a page to be loaded first
// before executing JavaScript, so we load a blank page.
if (webDriver instanceof HtmlUnitDriver
&& config.getCrawlDelayStrategy().equals(CrawlDelayStrategy.ADAPTIVE)) {
webDriver.get(WebClient.ABOUT_BLANK);
}
if (!isResuming) {
crawlFrontier = new CrawlFrontier(config);
}
cookieStore = new BasicCookieStore();
httpClient = HttpClientBuilder.create()
.setDefaultCookieStore(cookieStore)
.useSystemProperties()
.build();
crawlDelayMechanism = createCrawlDelayMechanism();
isStopped = false;
run();
} finally {
HttpClientUtils.closeQuietly(httpClient);
if (this.webDriver != null) {
this.webDriver.quit();
}
isStopping = false;
isStopped = true;
}
} | [
"private",
"void",
"start",
"(",
"final",
"WebDriver",
"webDriver",
",",
"final",
"boolean",
"isResuming",
")",
"{",
"try",
"{",
"Validate",
".",
"validState",
"(",
"isStopped",
",",
"\"The crawler is already running.\"",
")",
";",
"this",
".",
"webDriver",
"=",
"Validate",
".",
"notNull",
"(",
"webDriver",
",",
"\"The webdriver cannot be null.\"",
")",
";",
"// If the crawl delay strategy is set to adaptive, we check if the browser supports the\r",
"// Navigation Timing API or not. However HtmlUnit requires a page to be loaded first\r",
"// before executing JavaScript, so we load a blank page.\r",
"if",
"(",
"webDriver",
"instanceof",
"HtmlUnitDriver",
"&&",
"config",
".",
"getCrawlDelayStrategy",
"(",
")",
".",
"equals",
"(",
"CrawlDelayStrategy",
".",
"ADAPTIVE",
")",
")",
"{",
"webDriver",
".",
"get",
"(",
"WebClient",
".",
"ABOUT_BLANK",
")",
";",
"}",
"if",
"(",
"!",
"isResuming",
")",
"{",
"crawlFrontier",
"=",
"new",
"CrawlFrontier",
"(",
"config",
")",
";",
"}",
"cookieStore",
"=",
"new",
"BasicCookieStore",
"(",
")",
";",
"httpClient",
"=",
"HttpClientBuilder",
".",
"create",
"(",
")",
".",
"setDefaultCookieStore",
"(",
"cookieStore",
")",
".",
"useSystemProperties",
"(",
")",
".",
"build",
"(",
")",
";",
"crawlDelayMechanism",
"=",
"createCrawlDelayMechanism",
"(",
")",
";",
"isStopped",
"=",
"false",
";",
"run",
"(",
")",
";",
"}",
"finally",
"{",
"HttpClientUtils",
".",
"closeQuietly",
"(",
"httpClient",
")",
";",
"if",
"(",
"this",
".",
"webDriver",
"!=",
"null",
")",
"{",
"this",
".",
"webDriver",
".",
"quit",
"(",
")",
";",
"}",
"isStopping",
"=",
"false",
";",
"isStopped",
"=",
"true",
";",
"}",
"}"
] | Performs initialization and runs the crawler.
@param isResuming indicates if a previously saved state is to be resumed | [
"Performs",
"initialization",
"and",
"runs",
"the",
"crawler",
"."
] | train | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java#L151-L187 |
imsweb/naaccr-xml | src/main/java/com/imsweb/naaccrxml/runtime/NaaccrStreamContext.java | NaaccrStreamContext.extractTag | public String extractTag(String tag) throws NaaccrIOException {
"""
Extracts the tag from the given raw tag (which might contain a namespace).
@param tag tag without any namespace
@return the tag without any namespace
@throws NaaccrIOException if anything goes wrong
"""
if (tag == null)
throw new NaaccrIOException("missing tag");
int idx = tag.indexOf(':');
if (idx != -1) {
String namespace = tag.substring(0, idx), cleanTag = tag.substring(idx + 1);
// check for the namespace only if the tag is a default one (Patient, Tumor, etc...) or if extensions are enabled
if (_configuration.getAllowedTagsForNamespacePrefix(null).contains(cleanTag) || !Boolean.TRUE.equals(_options.getIgnoreExtensions())) {
Set<String> allowedTags = _configuration.getAllowedTagsForNamespacePrefix(namespace);
if (allowedTags == null || !allowedTags.contains(cleanTag))
throw new NaaccrIOException("tag '" + cleanTag + "' is not allowed for namespace '" + namespace + "'");
}
return cleanTag;
}
else {
if (Boolean.TRUE.equals(_options.getUseStrictNamespaces()) && !_configuration.getAllowedTagsForNamespacePrefix(null).contains(tag))
throw new NaaccrIOException("tag '" + tag + "' needs to be defined within a namespace");
return tag;
}
} | java | public String extractTag(String tag) throws NaaccrIOException {
if (tag == null)
throw new NaaccrIOException("missing tag");
int idx = tag.indexOf(':');
if (idx != -1) {
String namespace = tag.substring(0, idx), cleanTag = tag.substring(idx + 1);
// check for the namespace only if the tag is a default one (Patient, Tumor, etc...) or if extensions are enabled
if (_configuration.getAllowedTagsForNamespacePrefix(null).contains(cleanTag) || !Boolean.TRUE.equals(_options.getIgnoreExtensions())) {
Set<String> allowedTags = _configuration.getAllowedTagsForNamespacePrefix(namespace);
if (allowedTags == null || !allowedTags.contains(cleanTag))
throw new NaaccrIOException("tag '" + cleanTag + "' is not allowed for namespace '" + namespace + "'");
}
return cleanTag;
}
else {
if (Boolean.TRUE.equals(_options.getUseStrictNamespaces()) && !_configuration.getAllowedTagsForNamespacePrefix(null).contains(tag))
throw new NaaccrIOException("tag '" + tag + "' needs to be defined within a namespace");
return tag;
}
} | [
"public",
"String",
"extractTag",
"(",
"String",
"tag",
")",
"throws",
"NaaccrIOException",
"{",
"if",
"(",
"tag",
"==",
"null",
")",
"throw",
"new",
"NaaccrIOException",
"(",
"\"missing tag\"",
")",
";",
"int",
"idx",
"=",
"tag",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"idx",
"!=",
"-",
"1",
")",
"{",
"String",
"namespace",
"=",
"tag",
".",
"substring",
"(",
"0",
",",
"idx",
")",
",",
"cleanTag",
"=",
"tag",
".",
"substring",
"(",
"idx",
"+",
"1",
")",
";",
"// check for the namespace only if the tag is a default one (Patient, Tumor, etc...) or if extensions are enabled",
"if",
"(",
"_configuration",
".",
"getAllowedTagsForNamespacePrefix",
"(",
"null",
")",
".",
"contains",
"(",
"cleanTag",
")",
"||",
"!",
"Boolean",
".",
"TRUE",
".",
"equals",
"(",
"_options",
".",
"getIgnoreExtensions",
"(",
")",
")",
")",
"{",
"Set",
"<",
"String",
">",
"allowedTags",
"=",
"_configuration",
".",
"getAllowedTagsForNamespacePrefix",
"(",
"namespace",
")",
";",
"if",
"(",
"allowedTags",
"==",
"null",
"||",
"!",
"allowedTags",
".",
"contains",
"(",
"cleanTag",
")",
")",
"throw",
"new",
"NaaccrIOException",
"(",
"\"tag '\"",
"+",
"cleanTag",
"+",
"\"' is not allowed for namespace '\"",
"+",
"namespace",
"+",
"\"'\"",
")",
";",
"}",
"return",
"cleanTag",
";",
"}",
"else",
"{",
"if",
"(",
"Boolean",
".",
"TRUE",
".",
"equals",
"(",
"_options",
".",
"getUseStrictNamespaces",
"(",
")",
")",
"&&",
"!",
"_configuration",
".",
"getAllowedTagsForNamespacePrefix",
"(",
"null",
")",
".",
"contains",
"(",
"tag",
")",
")",
"throw",
"new",
"NaaccrIOException",
"(",
"\"tag '\"",
"+",
"tag",
"+",
"\"' needs to be defined within a namespace\"",
")",
";",
"return",
"tag",
";",
"}",
"}"
] | Extracts the tag from the given raw tag (which might contain a namespace).
@param tag tag without any namespace
@return the tag without any namespace
@throws NaaccrIOException if anything goes wrong | [
"Extracts",
"the",
"tag",
"from",
"the",
"given",
"raw",
"tag",
"(",
"which",
"might",
"contain",
"a",
"namespace",
")",
"."
] | train | https://github.com/imsweb/naaccr-xml/blob/a3a501faa2a0c3411dd5248b2c1379f279131696/src/main/java/com/imsweb/naaccrxml/runtime/NaaccrStreamContext.java#L57-L76 |
ops4j/org.ops4j.base | ops4j-base-lang/src/main/java/org/ops4j/lang/PreConditionException.java | PreConditionException.validateEqualTo | public static void validateEqualTo( long value, long condition, String identifier )
throws PreConditionException {
"""
Validates that the value under test is a particular value.
<p/>
This method ensures that <code>value == condition</code>.
@param identifier The name of the object.
@param condition The condition value.
@param value The value to be tested.
@throws PreConditionException if the condition is not met.
"""
if( value == condition )
{
return;
}
throw new PreConditionException( identifier + " was not equal to " + condition + ". Was: " + value );
} | java | public static void validateEqualTo( long value, long condition, String identifier )
throws PreConditionException
{
if( value == condition )
{
return;
}
throw new PreConditionException( identifier + " was not equal to " + condition + ". Was: " + value );
} | [
"public",
"static",
"void",
"validateEqualTo",
"(",
"long",
"value",
",",
"long",
"condition",
",",
"String",
"identifier",
")",
"throws",
"PreConditionException",
"{",
"if",
"(",
"value",
"==",
"condition",
")",
"{",
"return",
";",
"}",
"throw",
"new",
"PreConditionException",
"(",
"identifier",
"+",
"\" was not equal to \"",
"+",
"condition",
"+",
"\". Was: \"",
"+",
"value",
")",
";",
"}"
] | Validates that the value under test is a particular value.
<p/>
This method ensures that <code>value == condition</code>.
@param identifier The name of the object.
@param condition The condition value.
@param value The value to be tested.
@throws PreConditionException if the condition is not met. | [
"Validates",
"that",
"the",
"value",
"under",
"test",
"is",
"a",
"particular",
"value",
".",
"<p",
"/",
">",
"This",
"method",
"ensures",
"that",
"<code",
">",
"value",
"==",
"condition<",
"/",
"code",
">",
"."
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-lang/src/main/java/org/ops4j/lang/PreConditionException.java#L211-L219 |
Azure/azure-sdk-for-java | servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java | ClientFactory.acceptSessionFromEntityPathAsync | public static CompletableFuture<IMessageSession> acceptSessionFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath, String sessionId, ReceiveMode receiveMode) {
"""
Asynchronously accepts a session from service bus using the client settings. Session Id can be null, if null, service will return the first available session.
@param messagingFactory messaging factory (which represents a connection) on which the session receiver needs to be created.
@param entityPath path of entity
@param sessionId session id, if null, service will return the first available session, otherwise, service will return specified session
@param receiveMode PeekLock or ReceiveAndDelete
@return a CompletableFuture representing the pending session accepting
"""
return acceptSessionFromEntityPathAsync(messagingFactory, entityPath, null, sessionId, receiveMode);
} | java | public static CompletableFuture<IMessageSession> acceptSessionFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath, String sessionId, ReceiveMode receiveMode) {
return acceptSessionFromEntityPathAsync(messagingFactory, entityPath, null, sessionId, receiveMode);
} | [
"public",
"static",
"CompletableFuture",
"<",
"IMessageSession",
">",
"acceptSessionFromEntityPathAsync",
"(",
"MessagingFactory",
"messagingFactory",
",",
"String",
"entityPath",
",",
"String",
"sessionId",
",",
"ReceiveMode",
"receiveMode",
")",
"{",
"return",
"acceptSessionFromEntityPathAsync",
"(",
"messagingFactory",
",",
"entityPath",
",",
"null",
",",
"sessionId",
",",
"receiveMode",
")",
";",
"}"
] | Asynchronously accepts a session from service bus using the client settings. Session Id can be null, if null, service will return the first available session.
@param messagingFactory messaging factory (which represents a connection) on which the session receiver needs to be created.
@param entityPath path of entity
@param sessionId session id, if null, service will return the first available session, otherwise, service will return specified session
@param receiveMode PeekLock or ReceiveAndDelete
@return a CompletableFuture representing the pending session accepting | [
"Asynchronously",
"accepts",
"a",
"session",
"from",
"service",
"bus",
"using",
"the",
"client",
"settings",
".",
"Session",
"Id",
"can",
"be",
"null",
"if",
"null",
"service",
"will",
"return",
"the",
"first",
"available",
"session",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java#L736-L738 |
redlink-gmbh/redlink-java-sdk | src/main/java/io/redlink/sdk/impl/analysis/model/Enhancements.java | Enhancements.getBestAnnotations | public Multimap<TextAnnotation, EntityAnnotation> getBestAnnotations() {
"""
Returns the best {@link EntityAnnotation}s (those with the highest confidence value) for each extracted {@link TextAnnotation}
@return best annotations
"""
Ordering<EntityAnnotation> o = new Ordering<EntityAnnotation>() {
@Override
public int compare(EntityAnnotation left, EntityAnnotation right) {
return Doubles.compare(left.confidence, right.confidence);
}
}.reverse();
Multimap<TextAnnotation, EntityAnnotation> result = ArrayListMultimap.create();
for (TextAnnotation ta : getTextAnnotations()) {
List<EntityAnnotation> eas = o.sortedCopy(getEntityAnnotations(ta));
if (!eas.isEmpty()) {
Collection<EntityAnnotation> highest = new HashSet<>();
Double confidence = eas.get(0).getConfidence();
for (EntityAnnotation ea : eas) {
if (ea.confidence < confidence) {
break;
} else {
highest.add(ea);
}
}
result.putAll(ta, highest);
}
}
return result;
} | java | public Multimap<TextAnnotation, EntityAnnotation> getBestAnnotations() {
Ordering<EntityAnnotation> o = new Ordering<EntityAnnotation>() {
@Override
public int compare(EntityAnnotation left, EntityAnnotation right) {
return Doubles.compare(left.confidence, right.confidence);
}
}.reverse();
Multimap<TextAnnotation, EntityAnnotation> result = ArrayListMultimap.create();
for (TextAnnotation ta : getTextAnnotations()) {
List<EntityAnnotation> eas = o.sortedCopy(getEntityAnnotations(ta));
if (!eas.isEmpty()) {
Collection<EntityAnnotation> highest = new HashSet<>();
Double confidence = eas.get(0).getConfidence();
for (EntityAnnotation ea : eas) {
if (ea.confidence < confidence) {
break;
} else {
highest.add(ea);
}
}
result.putAll(ta, highest);
}
}
return result;
} | [
"public",
"Multimap",
"<",
"TextAnnotation",
",",
"EntityAnnotation",
">",
"getBestAnnotations",
"(",
")",
"{",
"Ordering",
"<",
"EntityAnnotation",
">",
"o",
"=",
"new",
"Ordering",
"<",
"EntityAnnotation",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"compare",
"(",
"EntityAnnotation",
"left",
",",
"EntityAnnotation",
"right",
")",
"{",
"return",
"Doubles",
".",
"compare",
"(",
"left",
".",
"confidence",
",",
"right",
".",
"confidence",
")",
";",
"}",
"}",
".",
"reverse",
"(",
")",
";",
"Multimap",
"<",
"TextAnnotation",
",",
"EntityAnnotation",
">",
"result",
"=",
"ArrayListMultimap",
".",
"create",
"(",
")",
";",
"for",
"(",
"TextAnnotation",
"ta",
":",
"getTextAnnotations",
"(",
")",
")",
"{",
"List",
"<",
"EntityAnnotation",
">",
"eas",
"=",
"o",
".",
"sortedCopy",
"(",
"getEntityAnnotations",
"(",
"ta",
")",
")",
";",
"if",
"(",
"!",
"eas",
".",
"isEmpty",
"(",
")",
")",
"{",
"Collection",
"<",
"EntityAnnotation",
">",
"highest",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"Double",
"confidence",
"=",
"eas",
".",
"get",
"(",
"0",
")",
".",
"getConfidence",
"(",
")",
";",
"for",
"(",
"EntityAnnotation",
"ea",
":",
"eas",
")",
"{",
"if",
"(",
"ea",
".",
"confidence",
"<",
"confidence",
")",
"{",
"break",
";",
"}",
"else",
"{",
"highest",
".",
"add",
"(",
"ea",
")",
";",
"}",
"}",
"result",
".",
"putAll",
"(",
"ta",
",",
"highest",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] | Returns the best {@link EntityAnnotation}s (those with the highest confidence value) for each extracted {@link TextAnnotation}
@return best annotations | [
"Returns",
"the",
"best",
"{",
"@link",
"EntityAnnotation",
"}",
"s",
"(",
"those",
"with",
"the",
"highest",
"confidence",
"value",
")",
"for",
"each",
"extracted",
"{",
"@link",
"TextAnnotation",
"}"
] | train | https://github.com/redlink-gmbh/redlink-java-sdk/blob/c412ff11bd80da52ade09f2483ab29cdbff5a28a/src/main/java/io/redlink/sdk/impl/analysis/model/Enhancements.java#L292-L319 |
LableOrg/java-uniqueid | uniqueid-zookeeper/src/main/java/org/lable/oss/uniqueid/zookeeper/ZooKeeperHelper.java | ZooKeeperHelper.createIfNotThere | static void createIfNotThere(ZooKeeper zookeeper, String znode) throws KeeperException, InterruptedException {
"""
Create an empty normal (persistent) Znode. If the znode already exists, do nothing.
@param zookeeper ZooKeeper instance to work with.
@param znode Znode to create.
@throws KeeperException
@throws InterruptedException
"""
try {
create(zookeeper, znode);
} catch (KeeperException e) {
if (e.code() != KeeperException.Code.NODEEXISTS) {
// Rethrow all exceptions, except "node exists",
// because if the node exists, this method reached its goal.
throw e;
}
}
} | java | static void createIfNotThere(ZooKeeper zookeeper, String znode) throws KeeperException, InterruptedException {
try {
create(zookeeper, znode);
} catch (KeeperException e) {
if (e.code() != KeeperException.Code.NODEEXISTS) {
// Rethrow all exceptions, except "node exists",
// because if the node exists, this method reached its goal.
throw e;
}
}
} | [
"static",
"void",
"createIfNotThere",
"(",
"ZooKeeper",
"zookeeper",
",",
"String",
"znode",
")",
"throws",
"KeeperException",
",",
"InterruptedException",
"{",
"try",
"{",
"create",
"(",
"zookeeper",
",",
"znode",
")",
";",
"}",
"catch",
"(",
"KeeperException",
"e",
")",
"{",
"if",
"(",
"e",
".",
"code",
"(",
")",
"!=",
"KeeperException",
".",
"Code",
".",
"NODEEXISTS",
")",
"{",
"// Rethrow all exceptions, except \"node exists\",",
"// because if the node exists, this method reached its goal.",
"throw",
"e",
";",
"}",
"}",
"}"
] | Create an empty normal (persistent) Znode. If the znode already exists, do nothing.
@param zookeeper ZooKeeper instance to work with.
@param znode Znode to create.
@throws KeeperException
@throws InterruptedException | [
"Create",
"an",
"empty",
"normal",
"(",
"persistent",
")",
"Znode",
".",
"If",
"the",
"znode",
"already",
"exists",
"do",
"nothing",
"."
] | train | https://github.com/LableOrg/java-uniqueid/blob/554e30b2277765f365e7c7f598108de0ab5744f4/uniqueid-zookeeper/src/main/java/org/lable/oss/uniqueid/zookeeper/ZooKeeperHelper.java#L88-L98 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/osm/OSMTablesFactory.java | OSMTablesFactory.createRelationTable | public static PreparedStatement createRelationTable(Connection connection, String relationTable) throws SQLException {
"""
Create the relation table.
@param connection
@param relationTable
@return
@throws SQLException
"""
try (Statement stmt = connection.createStatement()) {
StringBuilder sb = new StringBuilder("CREATE TABLE ");
sb.append(relationTable);
sb.append("(ID_RELATION BIGINT PRIMARY KEY,"
+ "USER_NAME VARCHAR,"
+ "UID BIGINT,"
+ "VISIBLE BOOLEAN,"
+ "VERSION INTEGER,"
+ "CHANGESET INTEGER,"
+ "LAST_UPDATE TIMESTAMP);");
stmt.execute(sb.toString());
}
return connection.prepareStatement("INSERT INTO " + relationTable + " VALUES ( ?,?,?,?,?,?,?);");
} | java | public static PreparedStatement createRelationTable(Connection connection, String relationTable) throws SQLException {
try (Statement stmt = connection.createStatement()) {
StringBuilder sb = new StringBuilder("CREATE TABLE ");
sb.append(relationTable);
sb.append("(ID_RELATION BIGINT PRIMARY KEY,"
+ "USER_NAME VARCHAR,"
+ "UID BIGINT,"
+ "VISIBLE BOOLEAN,"
+ "VERSION INTEGER,"
+ "CHANGESET INTEGER,"
+ "LAST_UPDATE TIMESTAMP);");
stmt.execute(sb.toString());
}
return connection.prepareStatement("INSERT INTO " + relationTable + " VALUES ( ?,?,?,?,?,?,?);");
} | [
"public",
"static",
"PreparedStatement",
"createRelationTable",
"(",
"Connection",
"connection",
",",
"String",
"relationTable",
")",
"throws",
"SQLException",
"{",
"try",
"(",
"Statement",
"stmt",
"=",
"connection",
".",
"createStatement",
"(",
")",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"\"CREATE TABLE \"",
")",
";",
"sb",
".",
"append",
"(",
"relationTable",
")",
";",
"sb",
".",
"append",
"(",
"\"(ID_RELATION BIGINT PRIMARY KEY,\"",
"+",
"\"USER_NAME VARCHAR,\"",
"+",
"\"UID BIGINT,\"",
"+",
"\"VISIBLE BOOLEAN,\"",
"+",
"\"VERSION INTEGER,\"",
"+",
"\"CHANGESET INTEGER,\"",
"+",
"\"LAST_UPDATE TIMESTAMP);\"",
")",
";",
"stmt",
".",
"execute",
"(",
"sb",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"connection",
".",
"prepareStatement",
"(",
"\"INSERT INTO \"",
"+",
"relationTable",
"+",
"\" VALUES ( ?,?,?,?,?,?,?);\"",
")",
";",
"}"
] | Create the relation table.
@param connection
@param relationTable
@return
@throws SQLException | [
"Create",
"the",
"relation",
"table",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/osm/OSMTablesFactory.java#L223-L237 |
lucee/Lucee | core/src/main/java/lucee/runtime/config/XMLConfigAdmin.java | XMLConfigAdmin.removeMailServer | public void removeMailServer(String hostName, String username) throws SecurityException {
"""
removes a mailserver from system
@param hostName
@throws SecurityException
"""
checkWriteAccess();
Element mail = _getRootElement("mail");
Element[] children = XMLConfigWebFactory.getChildren(mail, "server");
String _hostName, _username;
if (children.length > 0) {
for (int i = 0; i < children.length; i++) {
Element el = children[i];
_hostName = el.getAttribute("smtp");
_username = el.getAttribute("username");
if (StringUtil.emptyIfNull(_hostName).equalsIgnoreCase(StringUtil.emptyIfNull(hostName))
&& StringUtil.emptyIfNull(_username).equalsIgnoreCase(StringUtil.emptyIfNull(username))) {
mail.removeChild(children[i]);
}
}
}
} | java | public void removeMailServer(String hostName, String username) throws SecurityException {
checkWriteAccess();
Element mail = _getRootElement("mail");
Element[] children = XMLConfigWebFactory.getChildren(mail, "server");
String _hostName, _username;
if (children.length > 0) {
for (int i = 0; i < children.length; i++) {
Element el = children[i];
_hostName = el.getAttribute("smtp");
_username = el.getAttribute("username");
if (StringUtil.emptyIfNull(_hostName).equalsIgnoreCase(StringUtil.emptyIfNull(hostName))
&& StringUtil.emptyIfNull(_username).equalsIgnoreCase(StringUtil.emptyIfNull(username))) {
mail.removeChild(children[i]);
}
}
}
} | [
"public",
"void",
"removeMailServer",
"(",
"String",
"hostName",
",",
"String",
"username",
")",
"throws",
"SecurityException",
"{",
"checkWriteAccess",
"(",
")",
";",
"Element",
"mail",
"=",
"_getRootElement",
"(",
"\"mail\"",
")",
";",
"Element",
"[",
"]",
"children",
"=",
"XMLConfigWebFactory",
".",
"getChildren",
"(",
"mail",
",",
"\"server\"",
")",
";",
"String",
"_hostName",
",",
"_username",
";",
"if",
"(",
"children",
".",
"length",
">",
"0",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"length",
";",
"i",
"++",
")",
"{",
"Element",
"el",
"=",
"children",
"[",
"i",
"]",
";",
"_hostName",
"=",
"el",
".",
"getAttribute",
"(",
"\"smtp\"",
")",
";",
"_username",
"=",
"el",
".",
"getAttribute",
"(",
"\"username\"",
")",
";",
"if",
"(",
"StringUtil",
".",
"emptyIfNull",
"(",
"_hostName",
")",
".",
"equalsIgnoreCase",
"(",
"StringUtil",
".",
"emptyIfNull",
"(",
"hostName",
")",
")",
"&&",
"StringUtil",
".",
"emptyIfNull",
"(",
"_username",
")",
".",
"equalsIgnoreCase",
"(",
"StringUtil",
".",
"emptyIfNull",
"(",
"username",
")",
")",
")",
"{",
"mail",
".",
"removeChild",
"(",
"children",
"[",
"i",
"]",
")",
";",
"}",
"}",
"}",
"}"
] | removes a mailserver from system
@param hostName
@throws SecurityException | [
"removes",
"a",
"mailserver",
"from",
"system"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/XMLConfigAdmin.java#L527-L544 |
xcesco/kripton | kripton/src/main/java/com/abubusoft/kripton/xml/XMLSerializer.java | XMLSerializer.writeEmptyElement | public void writeEmptyElement(String namespaceURI, String localName) throws Exception {
"""
Write empty element.
@param namespaceURI the namespace URI
@param localName the local name
@throws Exception the exception
"""
startTag(namespaceURI, localName);
endTag(namespaceURI, localName);
} | java | public void writeEmptyElement(String namespaceURI, String localName) throws Exception {
startTag(namespaceURI, localName);
endTag(namespaceURI, localName);
} | [
"public",
"void",
"writeEmptyElement",
"(",
"String",
"namespaceURI",
",",
"String",
"localName",
")",
"throws",
"Exception",
"{",
"startTag",
"(",
"namespaceURI",
",",
"localName",
")",
";",
"endTag",
"(",
"namespaceURI",
",",
"localName",
")",
";",
"}"
] | Write empty element.
@param namespaceURI the namespace URI
@param localName the local name
@throws Exception the exception | [
"Write",
"empty",
"element",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton/src/main/java/com/abubusoft/kripton/xml/XMLSerializer.java#L1719-L1723 |
UrielCh/ovh-java-sdk | ovh-java-sdk-router/src/main/java/net/minidev/ovh/api/ApiOvhRouter.java | ApiOvhRouter.serviceName_privateLink_peerServiceName_route_network_GET | public OvhPrivateLinkRoute serviceName_privateLink_peerServiceName_route_network_GET(String serviceName, String peerServiceName, String network) throws IOException {
"""
Get this object properties
REST: GET /router/{serviceName}/privateLink/{peerServiceName}/route/{network}
@param serviceName [required] The internal name of your Router offer
@param peerServiceName [required] Service name of the other side of this link
@param network [required] Network allowed to be routed outside
"""
String qPath = "/router/{serviceName}/privateLink/{peerServiceName}/route/{network}";
StringBuilder sb = path(qPath, serviceName, peerServiceName, network);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPrivateLinkRoute.class);
} | java | public OvhPrivateLinkRoute serviceName_privateLink_peerServiceName_route_network_GET(String serviceName, String peerServiceName, String network) throws IOException {
String qPath = "/router/{serviceName}/privateLink/{peerServiceName}/route/{network}";
StringBuilder sb = path(qPath, serviceName, peerServiceName, network);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPrivateLinkRoute.class);
} | [
"public",
"OvhPrivateLinkRoute",
"serviceName_privateLink_peerServiceName_route_network_GET",
"(",
"String",
"serviceName",
",",
"String",
"peerServiceName",
",",
"String",
"network",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/router/{serviceName}/privateLink/{peerServiceName}/route/{network}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"peerServiceName",
",",
"network",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhPrivateLinkRoute",
".",
"class",
")",
";",
"}"
] | Get this object properties
REST: GET /router/{serviceName}/privateLink/{peerServiceName}/route/{network}
@param serviceName [required] The internal name of your Router offer
@param peerServiceName [required] Service name of the other side of this link
@param network [required] Network allowed to be routed outside | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-router/src/main/java/net/minidev/ovh/api/ApiOvhRouter.java#L421-L426 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/store/StreamSegmentContainerRegistry.java | StreamSegmentContainerRegistry.startContainerInternal | private CompletableFuture<ContainerHandle> startContainerInternal(int containerId) {
"""
Creates a new Container and attempts to register it. This method works in an optimistic manner: it creates the
Container first and then attempts to register it, which should prevent us from having to lock on this entire method.
Creating new containers is cheap (we don't start them yet), so this operation should not take any extra resources.
@param containerId The Id of the Container to start.
@return A CompletableFuture which will be completed with a ContainerHandle once the container has been started.
"""
ContainerWithHandle newContainer = new ContainerWithHandle(this.factory.createStreamSegmentContainer(containerId),
new SegmentContainerHandle(containerId));
ContainerWithHandle existingContainer = this.containers.putIfAbsent(containerId, newContainer);
if (existingContainer != null) {
// We had multiple concurrent calls to start this Container and some other request beat us to it.
newContainer.container.close();
throw new IllegalArgumentException(String.format("Container %d is already registered.", containerId));
}
log.info("Registered SegmentContainer {}.", containerId);
// Attempt to Start the container, but first, attach a shutdown listener so we know to unregister it when it's stopped.
Services.onStop(
newContainer.container,
() -> unregisterContainer(newContainer),
ex -> handleContainerFailure(newContainer, ex),
this.executor);
return Services.startAsync(newContainer.container, this.executor)
.thenApply(v -> newContainer.handle);
} | java | private CompletableFuture<ContainerHandle> startContainerInternal(int containerId) {
ContainerWithHandle newContainer = new ContainerWithHandle(this.factory.createStreamSegmentContainer(containerId),
new SegmentContainerHandle(containerId));
ContainerWithHandle existingContainer = this.containers.putIfAbsent(containerId, newContainer);
if (existingContainer != null) {
// We had multiple concurrent calls to start this Container and some other request beat us to it.
newContainer.container.close();
throw new IllegalArgumentException(String.format("Container %d is already registered.", containerId));
}
log.info("Registered SegmentContainer {}.", containerId);
// Attempt to Start the container, but first, attach a shutdown listener so we know to unregister it when it's stopped.
Services.onStop(
newContainer.container,
() -> unregisterContainer(newContainer),
ex -> handleContainerFailure(newContainer, ex),
this.executor);
return Services.startAsync(newContainer.container, this.executor)
.thenApply(v -> newContainer.handle);
} | [
"private",
"CompletableFuture",
"<",
"ContainerHandle",
">",
"startContainerInternal",
"(",
"int",
"containerId",
")",
"{",
"ContainerWithHandle",
"newContainer",
"=",
"new",
"ContainerWithHandle",
"(",
"this",
".",
"factory",
".",
"createStreamSegmentContainer",
"(",
"containerId",
")",
",",
"new",
"SegmentContainerHandle",
"(",
"containerId",
")",
")",
";",
"ContainerWithHandle",
"existingContainer",
"=",
"this",
".",
"containers",
".",
"putIfAbsent",
"(",
"containerId",
",",
"newContainer",
")",
";",
"if",
"(",
"existingContainer",
"!=",
"null",
")",
"{",
"// We had multiple concurrent calls to start this Container and some other request beat us to it.",
"newContainer",
".",
"container",
".",
"close",
"(",
")",
";",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"Container %d is already registered.\"",
",",
"containerId",
")",
")",
";",
"}",
"log",
".",
"info",
"(",
"\"Registered SegmentContainer {}.\"",
",",
"containerId",
")",
";",
"// Attempt to Start the container, but first, attach a shutdown listener so we know to unregister it when it's stopped.",
"Services",
".",
"onStop",
"(",
"newContainer",
".",
"container",
",",
"(",
")",
"->",
"unregisterContainer",
"(",
"newContainer",
")",
",",
"ex",
"->",
"handleContainerFailure",
"(",
"newContainer",
",",
"ex",
")",
",",
"this",
".",
"executor",
")",
";",
"return",
"Services",
".",
"startAsync",
"(",
"newContainer",
".",
"container",
",",
"this",
".",
"executor",
")",
".",
"thenApply",
"(",
"v",
"->",
"newContainer",
".",
"handle",
")",
";",
"}"
] | Creates a new Container and attempts to register it. This method works in an optimistic manner: it creates the
Container first and then attempts to register it, which should prevent us from having to lock on this entire method.
Creating new containers is cheap (we don't start them yet), so this operation should not take any extra resources.
@param containerId The Id of the Container to start.
@return A CompletableFuture which will be completed with a ContainerHandle once the container has been started. | [
"Creates",
"a",
"new",
"Container",
"and",
"attempts",
"to",
"register",
"it",
".",
"This",
"method",
"works",
"in",
"an",
"optimistic",
"manner",
":",
"it",
"creates",
"the",
"Container",
"first",
"and",
"then",
"attempts",
"to",
"register",
"it",
"which",
"should",
"prevent",
"us",
"from",
"having",
"to",
"lock",
"on",
"this",
"entire",
"method",
".",
"Creating",
"new",
"containers",
"is",
"cheap",
"(",
"we",
"don",
"t",
"start",
"them",
"yet",
")",
"so",
"this",
"operation",
"should",
"not",
"take",
"any",
"extra",
"resources",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/store/StreamSegmentContainerRegistry.java#L147-L167 |
ModeShape/modeshape | web/modeshape-web-explorer/src/main/java/org/modeshape/web/server/JcrServiceImpl.java | JcrServiceImpl.values | private String values( PropertyDefinition pd, Property p ) throws RepositoryException {
"""
Displays property value as string
@param pd the property definition
@param p the property to display
@return property value as text string
@throws RepositoryException
"""
if (p == null) {
return "N/A";
}
if (pd.getRequiredType() == PropertyType.BINARY) {
return "BINARY";
}
if (!p.isMultiple()) {
return p.getString();
}
return multiValue(p);
} | java | private String values( PropertyDefinition pd, Property p ) throws RepositoryException {
if (p == null) {
return "N/A";
}
if (pd.getRequiredType() == PropertyType.BINARY) {
return "BINARY";
}
if (!p.isMultiple()) {
return p.getString();
}
return multiValue(p);
} | [
"private",
"String",
"values",
"(",
"PropertyDefinition",
"pd",
",",
"Property",
"p",
")",
"throws",
"RepositoryException",
"{",
"if",
"(",
"p",
"==",
"null",
")",
"{",
"return",
"\"N/A\"",
";",
"}",
"if",
"(",
"pd",
".",
"getRequiredType",
"(",
")",
"==",
"PropertyType",
".",
"BINARY",
")",
"{",
"return",
"\"BINARY\"",
";",
"}",
"if",
"(",
"!",
"p",
".",
"isMultiple",
"(",
")",
")",
"{",
"return",
"p",
".",
"getString",
"(",
")",
";",
"}",
"return",
"multiValue",
"(",
"p",
")",
";",
"}"
] | Displays property value as string
@param pd the property definition
@param p the property to display
@return property value as text string
@throws RepositoryException | [
"Displays",
"property",
"value",
"as",
"string"
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/web/modeshape-web-explorer/src/main/java/org/modeshape/web/server/JcrServiceImpl.java#L440-L454 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/utils/memory/MemoryUtil.java | MemoryUtil.getBytes | public static void getBytes(long address, byte[] buffer, int bufferOffset, int count) {
"""
Transfers count bytes from Memory starting at memoryOffset to buffer starting at bufferOffset
@param address start offset in the memory
@param buffer the data buffer
@param bufferOffset start offset of the buffer
@param count number of bytes to transfer
"""
if (buffer == null)
throw new NullPointerException();
else if (bufferOffset < 0 || count < 0 || count > buffer.length - bufferOffset)
throw new IndexOutOfBoundsException();
else if (count == 0)
return;
unsafe.copyMemory(null, address, buffer, BYTE_ARRAY_BASE_OFFSET + bufferOffset, count);
} | java | public static void getBytes(long address, byte[] buffer, int bufferOffset, int count)
{
if (buffer == null)
throw new NullPointerException();
else if (bufferOffset < 0 || count < 0 || count > buffer.length - bufferOffset)
throw new IndexOutOfBoundsException();
else if (count == 0)
return;
unsafe.copyMemory(null, address, buffer, BYTE_ARRAY_BASE_OFFSET + bufferOffset, count);
} | [
"public",
"static",
"void",
"getBytes",
"(",
"long",
"address",
",",
"byte",
"[",
"]",
"buffer",
",",
"int",
"bufferOffset",
",",
"int",
"count",
")",
"{",
"if",
"(",
"buffer",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"else",
"if",
"(",
"bufferOffset",
"<",
"0",
"||",
"count",
"<",
"0",
"||",
"count",
">",
"buffer",
".",
"length",
"-",
"bufferOffset",
")",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
")",
";",
"else",
"if",
"(",
"count",
"==",
"0",
")",
"return",
";",
"unsafe",
".",
"copyMemory",
"(",
"null",
",",
"address",
",",
"buffer",
",",
"BYTE_ARRAY_BASE_OFFSET",
"+",
"bufferOffset",
",",
"count",
")",
";",
"}"
] | Transfers count bytes from Memory starting at memoryOffset to buffer starting at bufferOffset
@param address start offset in the memory
@param buffer the data buffer
@param bufferOffset start offset of the buffer
@param count number of bytes to transfer | [
"Transfers",
"count",
"bytes",
"from",
"Memory",
"starting",
"at",
"memoryOffset",
"to",
"buffer",
"starting",
"at",
"bufferOffset"
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/utils/memory/MemoryUtil.java#L296-L306 |
jbundle/jbundle | base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/soap/SOAPMessageTransport.java | SOAPMessageTransport.setSOAPBody | public SOAPMessage setSOAPBody(SOAPMessage msg, BaseMessage message) {
"""
This utility method sticks this message into this soap message's body.
@param msg The source message.
"""
try {
if (msg == null)
msg = fac.createMessage();
// Message creation takes care of creating the SOAPPart - a
// required part of the message as per the SOAP 1.1
// specification.
SOAPPart soappart = msg.getSOAPPart();
// Retrieve the envelope from the soap part to start building
// the soap message.
SOAPEnvelope envelope = soappart.getEnvelope();
// Create a soap header from the envelope.
//?SOAPHeader header = envelope.getHeader();
// Create a soap body from the envelope.
SOAPBody body = envelope.getBody();
DOMResult result = new DOMResult(body);
if (((BaseXmlTrxMessageOut)message.getExternalMessage()).copyMessageToResult(result))
{ // Success
// Note: For Jabx, I would have to fix the namespace of the message (so don't use JAXB)
msg.saveChanges();
return msg;
}
} catch(Throwable e) {
e.printStackTrace();
Utility.getLogger().warning("Error in constructing or sending message "
+e.getMessage());
}
return null;
} | java | public SOAPMessage setSOAPBody(SOAPMessage msg, BaseMessage message)
{
try {
if (msg == null)
msg = fac.createMessage();
// Message creation takes care of creating the SOAPPart - a
// required part of the message as per the SOAP 1.1
// specification.
SOAPPart soappart = msg.getSOAPPart();
// Retrieve the envelope from the soap part to start building
// the soap message.
SOAPEnvelope envelope = soappart.getEnvelope();
// Create a soap header from the envelope.
//?SOAPHeader header = envelope.getHeader();
// Create a soap body from the envelope.
SOAPBody body = envelope.getBody();
DOMResult result = new DOMResult(body);
if (((BaseXmlTrxMessageOut)message.getExternalMessage()).copyMessageToResult(result))
{ // Success
// Note: For Jabx, I would have to fix the namespace of the message (so don't use JAXB)
msg.saveChanges();
return msg;
}
} catch(Throwable e) {
e.printStackTrace();
Utility.getLogger().warning("Error in constructing or sending message "
+e.getMessage());
}
return null;
} | [
"public",
"SOAPMessage",
"setSOAPBody",
"(",
"SOAPMessage",
"msg",
",",
"BaseMessage",
"message",
")",
"{",
"try",
"{",
"if",
"(",
"msg",
"==",
"null",
")",
"msg",
"=",
"fac",
".",
"createMessage",
"(",
")",
";",
"// Message creation takes care of creating the SOAPPart - a",
"// required part of the message as per the SOAP 1.1",
"// specification.",
"SOAPPart",
"soappart",
"=",
"msg",
".",
"getSOAPPart",
"(",
")",
";",
"// Retrieve the envelope from the soap part to start building",
"// the soap message.",
"SOAPEnvelope",
"envelope",
"=",
"soappart",
".",
"getEnvelope",
"(",
")",
";",
"// Create a soap header from the envelope.",
"//?SOAPHeader header = envelope.getHeader();",
"// Create a soap body from the envelope.",
"SOAPBody",
"body",
"=",
"envelope",
".",
"getBody",
"(",
")",
";",
"DOMResult",
"result",
"=",
"new",
"DOMResult",
"(",
"body",
")",
";",
"if",
"(",
"(",
"(",
"BaseXmlTrxMessageOut",
")",
"message",
".",
"getExternalMessage",
"(",
")",
")",
".",
"copyMessageToResult",
"(",
"result",
")",
")",
"{",
"// Success",
"// Note: For Jabx, I would have to fix the namespace of the message (so don't use JAXB)",
"msg",
".",
"saveChanges",
"(",
")",
";",
"return",
"msg",
";",
"}",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"Utility",
".",
"getLogger",
"(",
")",
".",
"warning",
"(",
"\"Error in constructing or sending message \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"return",
"null",
";",
"}"
] | This utility method sticks this message into this soap message's body.
@param msg The source message. | [
"This",
"utility",
"method",
"sticks",
"this",
"message",
"into",
"this",
"soap",
"message",
"s",
"body",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/soap/SOAPMessageTransport.java#L222-L255 |
google/closure-compiler | src/com/google/javascript/jscomp/AstFactory.java | AstFactory.createAsyncGeneratorWrapperReference | Node createAsyncGeneratorWrapperReference(JSType originalFunctionType, Scope scope) {
"""
Creates a reference to $jscomp.AsyncGeneratorWrapper with the template filled in to match the
original function.
@param originalFunctionType the type of the async generator function that needs transpilation
"""
Node ctor = createQName(scope, "$jscomp.AsyncGeneratorWrapper");
if (isAddingTypes() && !ctor.getJSType().isUnknownType()) {
// if ctor has the unknown type, we must have not injected the required runtime
// libraries - hopefully because this is in a test using NonInjectingCompiler.
// e.g get `number` from `AsyncIterable<number>`
JSType yieldedType =
originalFunctionType
.toMaybeFunctionType()
.getReturnType()
.getInstantiatedTypeArgument(getNativeType(JSTypeNative.ASYNC_ITERABLE_TYPE));
// e.g. replace
// AsyncGeneratorWrapper<T>
// with
// AsyncGeneratorWrapper<number>
ctor.setJSType(replaceTemplate(ctor.getJSType(), yieldedType));
}
return ctor;
} | java | Node createAsyncGeneratorWrapperReference(JSType originalFunctionType, Scope scope) {
Node ctor = createQName(scope, "$jscomp.AsyncGeneratorWrapper");
if (isAddingTypes() && !ctor.getJSType().isUnknownType()) {
// if ctor has the unknown type, we must have not injected the required runtime
// libraries - hopefully because this is in a test using NonInjectingCompiler.
// e.g get `number` from `AsyncIterable<number>`
JSType yieldedType =
originalFunctionType
.toMaybeFunctionType()
.getReturnType()
.getInstantiatedTypeArgument(getNativeType(JSTypeNative.ASYNC_ITERABLE_TYPE));
// e.g. replace
// AsyncGeneratorWrapper<T>
// with
// AsyncGeneratorWrapper<number>
ctor.setJSType(replaceTemplate(ctor.getJSType(), yieldedType));
}
return ctor;
} | [
"Node",
"createAsyncGeneratorWrapperReference",
"(",
"JSType",
"originalFunctionType",
",",
"Scope",
"scope",
")",
"{",
"Node",
"ctor",
"=",
"createQName",
"(",
"scope",
",",
"\"$jscomp.AsyncGeneratorWrapper\"",
")",
";",
"if",
"(",
"isAddingTypes",
"(",
")",
"&&",
"!",
"ctor",
".",
"getJSType",
"(",
")",
".",
"isUnknownType",
"(",
")",
")",
"{",
"// if ctor has the unknown type, we must have not injected the required runtime",
"// libraries - hopefully because this is in a test using NonInjectingCompiler.",
"// e.g get `number` from `AsyncIterable<number>`",
"JSType",
"yieldedType",
"=",
"originalFunctionType",
".",
"toMaybeFunctionType",
"(",
")",
".",
"getReturnType",
"(",
")",
".",
"getInstantiatedTypeArgument",
"(",
"getNativeType",
"(",
"JSTypeNative",
".",
"ASYNC_ITERABLE_TYPE",
")",
")",
";",
"// e.g. replace",
"// AsyncGeneratorWrapper<T>",
"// with",
"// AsyncGeneratorWrapper<number>",
"ctor",
".",
"setJSType",
"(",
"replaceTemplate",
"(",
"ctor",
".",
"getJSType",
"(",
")",
",",
"yieldedType",
")",
")",
";",
"}",
"return",
"ctor",
";",
"}"
] | Creates a reference to $jscomp.AsyncGeneratorWrapper with the template filled in to match the
original function.
@param originalFunctionType the type of the async generator function that needs transpilation | [
"Creates",
"a",
"reference",
"to",
"$jscomp",
".",
"AsyncGeneratorWrapper",
"with",
"the",
"template",
"filled",
"in",
"to",
"match",
"the",
"original",
"function",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AstFactory.java#L903-L925 |
windup/windup | decompiler/impl-procyon/src/main/java/org/jboss/windup/decompiler/procyon/ProcyonDecompiler.java | ProcyonDecompiler.refreshMetadataCache | private void refreshMetadataCache(final Queue<WindupMetadataSystem> metadataSystemCache, final DecompilerSettings settings) {
"""
The metadata cache can become huge over time. This simply flushes it periodically.
"""
metadataSystemCache.clear();
for (int i = 0; i < this.getNumberOfThreads(); i++)
{
metadataSystemCache.add(new NoRetryMetadataSystem(settings.getTypeLoader()));
}
} | java | private void refreshMetadataCache(final Queue<WindupMetadataSystem> metadataSystemCache, final DecompilerSettings settings)
{
metadataSystemCache.clear();
for (int i = 0; i < this.getNumberOfThreads(); i++)
{
metadataSystemCache.add(new NoRetryMetadataSystem(settings.getTypeLoader()));
}
} | [
"private",
"void",
"refreshMetadataCache",
"(",
"final",
"Queue",
"<",
"WindupMetadataSystem",
">",
"metadataSystemCache",
",",
"final",
"DecompilerSettings",
"settings",
")",
"{",
"metadataSystemCache",
".",
"clear",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"getNumberOfThreads",
"(",
")",
";",
"i",
"++",
")",
"{",
"metadataSystemCache",
".",
"add",
"(",
"new",
"NoRetryMetadataSystem",
"(",
"settings",
".",
"getTypeLoader",
"(",
")",
")",
")",
";",
"}",
"}"
] | The metadata cache can become huge over time. This simply flushes it periodically. | [
"The",
"metadata",
"cache",
"can",
"become",
"huge",
"over",
"time",
".",
"This",
"simply",
"flushes",
"it",
"periodically",
"."
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/decompiler/impl-procyon/src/main/java/org/jboss/windup/decompiler/procyon/ProcyonDecompiler.java#L522-L529 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java | HtmlDocletWriter.getTargetPackageLink | public Content getTargetPackageLink(PackageElement pkg, String target,
Content label) {
"""
Get Package link, with target frame.
@param pkg The link will be to the "package-summary.html" page for this package
@param target name of the target frame
@param label tag for the link
@return a content for the target package link
"""
return getHyperLink(pathString(pkg, DocPaths.PACKAGE_SUMMARY), label, "", target);
} | java | public Content getTargetPackageLink(PackageElement pkg, String target,
Content label) {
return getHyperLink(pathString(pkg, DocPaths.PACKAGE_SUMMARY), label, "", target);
} | [
"public",
"Content",
"getTargetPackageLink",
"(",
"PackageElement",
"pkg",
",",
"String",
"target",
",",
"Content",
"label",
")",
"{",
"return",
"getHyperLink",
"(",
"pathString",
"(",
"pkg",
",",
"DocPaths",
".",
"PACKAGE_SUMMARY",
")",
",",
"label",
",",
"\"\"",
",",
"target",
")",
";",
"}"
] | Get Package link, with target frame.
@param pkg The link will be to the "package-summary.html" page for this package
@param target name of the target frame
@param label tag for the link
@return a content for the target package link | [
"Get",
"Package",
"link",
"with",
"target",
"frame",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L358-L361 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/accounts/CmsTwoOrgUnitUsersList.java | CmsTwoOrgUnitUsersList.customHtmlEnd | protected String customHtmlEnd() {
"""
Returns the custom html end code for this dialog.<p>
@return custom html code
"""
StringBuffer result = new StringBuffer(512);
result.append("<form name='actions' method='post' action='");
result.append(getFirstWp().getDialogRealUri());
result.append("' class='nomargin' onsubmit=\"return submitAction('ok', null, 'actions');\">\n");
result.append(getFirstWp().allParamsAsHidden());
result.append("<div class=\"dialogspacer\" unselectable=\"on\"> </div>\n");
result.append("<!-- button row start -->\n<div class=\"dialogbuttons\" unselectable=\"on\">\n");
result.append("<input name='");
result.append(CmsDialog.DIALOG_CONFIRMED);
result.append("' type='button' value='");
result.append(
Messages.get().container(Messages.GUI_ORGUNITUSERS_BUTTON_CONFIRM_0).key(getFirstWp().getLocale()));
result.append("' onclick=\"submitAction('");
result.append(CmsDialog.DIALOG_CONFIRMED);
result.append("', form);\" class='dialogbutton'>\n");
result.append("<input name='");
result.append(CmsDialog.DIALOG_CANCEL);
result.append("' type='button' value='");
result.append(
Messages.get().container(Messages.GUI_ORGUNITUSERS_BUTTON_CANCEL_0).key(getFirstWp().getLocale()));
result.append("' onclick=\"submitAction('");
result.append(CmsDialog.DIALOG_CANCEL);
result.append("', form);\" class='dialogbutton'>\n");
result.append("</div>\n<!-- button row end -->\n");
result.append("</form>\n");
return result.toString();
} | java | protected String customHtmlEnd() {
StringBuffer result = new StringBuffer(512);
result.append("<form name='actions' method='post' action='");
result.append(getFirstWp().getDialogRealUri());
result.append("' class='nomargin' onsubmit=\"return submitAction('ok', null, 'actions');\">\n");
result.append(getFirstWp().allParamsAsHidden());
result.append("<div class=\"dialogspacer\" unselectable=\"on\"> </div>\n");
result.append("<!-- button row start -->\n<div class=\"dialogbuttons\" unselectable=\"on\">\n");
result.append("<input name='");
result.append(CmsDialog.DIALOG_CONFIRMED);
result.append("' type='button' value='");
result.append(
Messages.get().container(Messages.GUI_ORGUNITUSERS_BUTTON_CONFIRM_0).key(getFirstWp().getLocale()));
result.append("' onclick=\"submitAction('");
result.append(CmsDialog.DIALOG_CONFIRMED);
result.append("', form);\" class='dialogbutton'>\n");
result.append("<input name='");
result.append(CmsDialog.DIALOG_CANCEL);
result.append("' type='button' value='");
result.append(
Messages.get().container(Messages.GUI_ORGUNITUSERS_BUTTON_CANCEL_0).key(getFirstWp().getLocale()));
result.append("' onclick=\"submitAction('");
result.append(CmsDialog.DIALOG_CANCEL);
result.append("', form);\" class='dialogbutton'>\n");
result.append("</div>\n<!-- button row end -->\n");
result.append("</form>\n");
return result.toString();
} | [
"protected",
"String",
"customHtmlEnd",
"(",
")",
"{",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
"512",
")",
";",
"result",
".",
"append",
"(",
"\"<form name='actions' method='post' action='\"",
")",
";",
"result",
".",
"append",
"(",
"getFirstWp",
"(",
")",
".",
"getDialogRealUri",
"(",
")",
")",
";",
"result",
".",
"append",
"(",
"\"' class='nomargin' onsubmit=\\\"return submitAction('ok', null, 'actions');\\\">\\n\"",
")",
";",
"result",
".",
"append",
"(",
"getFirstWp",
"(",
")",
".",
"allParamsAsHidden",
"(",
")",
")",
";",
"result",
".",
"append",
"(",
"\"<div class=\\\"dialogspacer\\\" unselectable=\\\"on\\\"> </div>\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"<!-- button row start -->\\n<div class=\\\"dialogbuttons\\\" unselectable=\\\"on\\\">\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"<input name='\"",
")",
";",
"result",
".",
"append",
"(",
"CmsDialog",
".",
"DIALOG_CONFIRMED",
")",
";",
"result",
".",
"append",
"(",
"\"' type='button' value='\"",
")",
";",
"result",
".",
"append",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"Messages",
".",
"GUI_ORGUNITUSERS_BUTTON_CONFIRM_0",
")",
".",
"key",
"(",
"getFirstWp",
"(",
")",
".",
"getLocale",
"(",
")",
")",
")",
";",
"result",
".",
"append",
"(",
"\"' onclick=\\\"submitAction('\"",
")",
";",
"result",
".",
"append",
"(",
"CmsDialog",
".",
"DIALOG_CONFIRMED",
")",
";",
"result",
".",
"append",
"(",
"\"', form);\\\" class='dialogbutton'>\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"<input name='\"",
")",
";",
"result",
".",
"append",
"(",
"CmsDialog",
".",
"DIALOG_CANCEL",
")",
";",
"result",
".",
"append",
"(",
"\"' type='button' value='\"",
")",
";",
"result",
".",
"append",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"Messages",
".",
"GUI_ORGUNITUSERS_BUTTON_CANCEL_0",
")",
".",
"key",
"(",
"getFirstWp",
"(",
")",
".",
"getLocale",
"(",
")",
")",
")",
";",
"result",
".",
"append",
"(",
"\"' onclick=\\\"submitAction('\"",
")",
";",
"result",
".",
"append",
"(",
"CmsDialog",
".",
"DIALOG_CANCEL",
")",
";",
"result",
".",
"append",
"(",
"\"', form);\\\" class='dialogbutton'>\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"</div>\\n<!-- button row end -->\\n\"",
")",
";",
"result",
".",
"append",
"(",
"\"</form>\\n\"",
")",
";",
"return",
"result",
".",
"toString",
"(",
")",
";",
"}"
] | Returns the custom html end code for this dialog.<p>
@return custom html code | [
"Returns",
"the",
"custom",
"html",
"end",
"code",
"for",
"this",
"dialog",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/accounts/CmsTwoOrgUnitUsersList.java#L71-L99 |
googleads/googleads-java-lib | modules/ads_lib_appengine/src/main/java/com/google/api/ads/common/lib/soap/jaxws/JaxWsHandler.java | JaxWsHandler.setHeaderChildString | public void setHeaderChildString(BindingProvider soapClient, final String headerName,
String childNamespace, String childName, String childValue) {
"""
Adds a child text node named childName to the existing header named headerName.
@param soapClient the binding provider
@param headerName the name of the existing header
@param childNamespace the namespace of the new child
@param childName the name of the new child
@param childValue the value of the new child
@throws NullPointerException if no header exists named headerName
"""
// Find the parent header SOAPElement
SOAPElement parentHeader = (SOAPElement) getHeader(soapClient, headerName);
Preconditions.checkNotNull(parentHeader, "No header element found with name: %s", headerName);
// Add a SOAPElement for the child
try {
SOAPElement childElement = parentHeader.addChildElement(new QName(childNamespace, childName));
childElement.setTextContent(childValue);
} catch (SOAPException e) {
throw new ServiceException("Failed to set header for child " + childName, e);
}
} | java | public void setHeaderChildString(BindingProvider soapClient, final String headerName,
String childNamespace, String childName, String childValue) {
// Find the parent header SOAPElement
SOAPElement parentHeader = (SOAPElement) getHeader(soapClient, headerName);
Preconditions.checkNotNull(parentHeader, "No header element found with name: %s", headerName);
// Add a SOAPElement for the child
try {
SOAPElement childElement = parentHeader.addChildElement(new QName(childNamespace, childName));
childElement.setTextContent(childValue);
} catch (SOAPException e) {
throw new ServiceException("Failed to set header for child " + childName, e);
}
} | [
"public",
"void",
"setHeaderChildString",
"(",
"BindingProvider",
"soapClient",
",",
"final",
"String",
"headerName",
",",
"String",
"childNamespace",
",",
"String",
"childName",
",",
"String",
"childValue",
")",
"{",
"// Find the parent header SOAPElement",
"SOAPElement",
"parentHeader",
"=",
"(",
"SOAPElement",
")",
"getHeader",
"(",
"soapClient",
",",
"headerName",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"parentHeader",
",",
"\"No header element found with name: %s\"",
",",
"headerName",
")",
";",
"// Add a SOAPElement for the child",
"try",
"{",
"SOAPElement",
"childElement",
"=",
"parentHeader",
".",
"addChildElement",
"(",
"new",
"QName",
"(",
"childNamespace",
",",
"childName",
")",
")",
";",
"childElement",
".",
"setTextContent",
"(",
"childValue",
")",
";",
"}",
"catch",
"(",
"SOAPException",
"e",
")",
"{",
"throw",
"new",
"ServiceException",
"(",
"\"Failed to set header for child \"",
"+",
"childName",
",",
"e",
")",
";",
"}",
"}"
] | Adds a child text node named childName to the existing header named headerName.
@param soapClient the binding provider
@param headerName the name of the existing header
@param childNamespace the namespace of the new child
@param childName the name of the new child
@param childValue the value of the new child
@throws NullPointerException if no header exists named headerName | [
"Adds",
"a",
"child",
"text",
"node",
"named",
"childName",
"to",
"the",
"existing",
"header",
"named",
"headerName",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib_appengine/src/main/java/com/google/api/ads/common/lib/soap/jaxws/JaxWsHandler.java#L134-L146 |
hawkular/hawkular-apm | client/opentracing/src/main/java/io/opentracing/impl/APMSpan.java | APMSpan.initTopLevelState | protected void initTopLevelState(APMSpan topSpan, TraceRecorder recorder, ContextSampler sampler) {
"""
This method initialises the node builder and trace context for a top level
trace fragment.
@param topSpan The top level span in the trace
@param recorder The trace recorder
@param sampler The sampler
"""
nodeBuilder = new NodeBuilder();
traceContext = new TraceContext(topSpan, nodeBuilder, recorder, sampler);
} | java | protected void initTopLevelState(APMSpan topSpan, TraceRecorder recorder, ContextSampler sampler) {
nodeBuilder = new NodeBuilder();
traceContext = new TraceContext(topSpan, nodeBuilder, recorder, sampler);
} | [
"protected",
"void",
"initTopLevelState",
"(",
"APMSpan",
"topSpan",
",",
"TraceRecorder",
"recorder",
",",
"ContextSampler",
"sampler",
")",
"{",
"nodeBuilder",
"=",
"new",
"NodeBuilder",
"(",
")",
";",
"traceContext",
"=",
"new",
"TraceContext",
"(",
"topSpan",
",",
"nodeBuilder",
",",
"recorder",
",",
"sampler",
")",
";",
"}"
] | This method initialises the node builder and trace context for a top level
trace fragment.
@param topSpan The top level span in the trace
@param recorder The trace recorder
@param sampler The sampler | [
"This",
"method",
"initialises",
"the",
"node",
"builder",
"and",
"trace",
"context",
"for",
"a",
"top",
"level",
"trace",
"fragment",
"."
] | train | https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/opentracing/src/main/java/io/opentracing/impl/APMSpan.java#L166-L169 |
sinetja/sinetja | src/main/java/sinetja/Response.java | Response.respondEventSource | public ChannelFuture respondEventSource(Object data, String event) throws Exception {
"""
To respond event source, call this method as many time as you want.
<p>Event Source response is a special kind of chunked response, data must be UTF-8.
See:
- http://sockjs.github.com/sockjs-protocol/sockjs-protocol-0.3.3.html#section-94
- http://dev.w3.org/html5/eventsource/
<p>No need to call setChunked() before calling this method.
"""
if (!nonChunkedResponseOrFirstChunkSent) {
HttpUtil.setTransferEncodingChunked(response, true);
response.headers().set(CONTENT_TYPE, "text/event-stream; charset=UTF-8");
return respondText("\r\n"); // Send a new line prelude, due to a bug in Opera
}
return respondText(renderEventSource(data, event));
} | java | public ChannelFuture respondEventSource(Object data, String event) throws Exception {
if (!nonChunkedResponseOrFirstChunkSent) {
HttpUtil.setTransferEncodingChunked(response, true);
response.headers().set(CONTENT_TYPE, "text/event-stream; charset=UTF-8");
return respondText("\r\n"); // Send a new line prelude, due to a bug in Opera
}
return respondText(renderEventSource(data, event));
} | [
"public",
"ChannelFuture",
"respondEventSource",
"(",
"Object",
"data",
",",
"String",
"event",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"nonChunkedResponseOrFirstChunkSent",
")",
"{",
"HttpUtil",
".",
"setTransferEncodingChunked",
"(",
"response",
",",
"true",
")",
";",
"response",
".",
"headers",
"(",
")",
".",
"set",
"(",
"CONTENT_TYPE",
",",
"\"text/event-stream; charset=UTF-8\"",
")",
";",
"return",
"respondText",
"(",
"\"\\r\\n\"",
")",
";",
"// Send a new line prelude, due to a bug in Opera",
"}",
"return",
"respondText",
"(",
"renderEventSource",
"(",
"data",
",",
"event",
")",
")",
";",
"}"
] | To respond event source, call this method as many time as you want.
<p>Event Source response is a special kind of chunked response, data must be UTF-8.
See:
- http://sockjs.github.com/sockjs-protocol/sockjs-protocol-0.3.3.html#section-94
- http://dev.w3.org/html5/eventsource/
<p>No need to call setChunked() before calling this method. | [
"To",
"respond",
"event",
"source",
"call",
"this",
"method",
"as",
"many",
"time",
"as",
"you",
"want",
"."
] | train | https://github.com/sinetja/sinetja/blob/eec94dba55ec28263e3503fcdb33532282134775/src/main/java/sinetja/Response.java#L336-L343 |
aws/aws-sdk-java | aws-java-sdk-servicecatalog/src/main/java/com/amazonaws/services/servicecatalog/model/SearchProductsResult.java | SearchProductsResult.setProductViewAggregations | public void setProductViewAggregations(java.util.Map<String, java.util.List<ProductViewAggregationValue>> productViewAggregations) {
"""
<p>
The product view aggregations.
</p>
@param productViewAggregations
The product view aggregations.
"""
this.productViewAggregations = productViewAggregations;
} | java | public void setProductViewAggregations(java.util.Map<String, java.util.List<ProductViewAggregationValue>> productViewAggregations) {
this.productViewAggregations = productViewAggregations;
} | [
"public",
"void",
"setProductViewAggregations",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"java",
".",
"util",
".",
"List",
"<",
"ProductViewAggregationValue",
">",
">",
"productViewAggregations",
")",
"{",
"this",
".",
"productViewAggregations",
"=",
"productViewAggregations",
";",
"}"
] | <p>
The product view aggregations.
</p>
@param productViewAggregations
The product view aggregations. | [
"<p",
">",
"The",
"product",
"view",
"aggregations",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-servicecatalog/src/main/java/com/amazonaws/services/servicecatalog/model/SearchProductsResult.java#L137-L139 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.hosting_web_new_GET | public ArrayList<String> hosting_web_new_GET(OvhDnsZoneEnum dnsZone, String domain, OvhOrderableNameEnum module, net.minidev.ovh.api.hosting.web.OvhOfferEnum offer, Boolean waiveRetractationPeriod) throws IOException {
"""
Get allowed durations for 'new' option
REST: GET /order/hosting/web/new
@param domain [required] Domain name which will be linked to this hosting account
@param module [required] Module installation ready to use
@param dnsZone [required] Dns zone modification possibilities ( by default : RESET_ALL )
@param offer [required] Offer for your new hosting account
@param waiveRetractationPeriod [required] Indicates that order will be processed with waiving retractation period
"""
String qPath = "/order/hosting/web/new";
StringBuilder sb = path(qPath);
query(sb, "dnsZone", dnsZone);
query(sb, "domain", domain);
query(sb, "module", module);
query(sb, "offer", offer);
query(sb, "waiveRetractationPeriod", waiveRetractationPeriod);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<String> hosting_web_new_GET(OvhDnsZoneEnum dnsZone, String domain, OvhOrderableNameEnum module, net.minidev.ovh.api.hosting.web.OvhOfferEnum offer, Boolean waiveRetractationPeriod) throws IOException {
String qPath = "/order/hosting/web/new";
StringBuilder sb = path(qPath);
query(sb, "dnsZone", dnsZone);
query(sb, "domain", domain);
query(sb, "module", module);
query(sb, "offer", offer);
query(sb, "waiveRetractationPeriod", waiveRetractationPeriod);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"hosting_web_new_GET",
"(",
"OvhDnsZoneEnum",
"dnsZone",
",",
"String",
"domain",
",",
"OvhOrderableNameEnum",
"module",
",",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"hosting",
".",
"web",
".",
"OvhOfferEnum",
"offer",
",",
"Boolean",
"waiveRetractationPeriod",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/hosting/web/new\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
")",
";",
"query",
"(",
"sb",
",",
"\"dnsZone\"",
",",
"dnsZone",
")",
";",
"query",
"(",
"sb",
",",
"\"domain\"",
",",
"domain",
")",
";",
"query",
"(",
"sb",
",",
"\"module\"",
",",
"module",
")",
";",
"query",
"(",
"sb",
",",
"\"offer\"",
",",
"offer",
")",
";",
"query",
"(",
"sb",
",",
"\"waiveRetractationPeriod\"",
",",
"waiveRetractationPeriod",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"t1",
")",
";",
"}"
] | Get allowed durations for 'new' option
REST: GET /order/hosting/web/new
@param domain [required] Domain name which will be linked to this hosting account
@param module [required] Module installation ready to use
@param dnsZone [required] Dns zone modification possibilities ( by default : RESET_ALL )
@param offer [required] Offer for your new hosting account
@param waiveRetractationPeriod [required] Indicates that order will be processed with waiving retractation period | [
"Get",
"allowed",
"durations",
"for",
"new",
"option"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L4755-L4765 |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/importer/ExplodedImporterImpl.java | ExplodedImporterImpl.calculatePath | private ArchivePath calculatePath(File root, File child) {
"""
Calculate the relative child path.
@param root
The Archive root folder
@param child
The Child file
@return a Path fort he child relative to root
"""
String rootPath = unifyPath(root.getPath());
String childPath = unifyPath(child.getPath());
String archiveChildPath = childPath.replaceFirst(Pattern.quote(rootPath), "");
return new BasicPath(archiveChildPath);
} | java | private ArchivePath calculatePath(File root, File child) {
String rootPath = unifyPath(root.getPath());
String childPath = unifyPath(child.getPath());
String archiveChildPath = childPath.replaceFirst(Pattern.quote(rootPath), "");
return new BasicPath(archiveChildPath);
} | [
"private",
"ArchivePath",
"calculatePath",
"(",
"File",
"root",
",",
"File",
"child",
")",
"{",
"String",
"rootPath",
"=",
"unifyPath",
"(",
"root",
".",
"getPath",
"(",
")",
")",
";",
"String",
"childPath",
"=",
"unifyPath",
"(",
"child",
".",
"getPath",
"(",
")",
")",
";",
"String",
"archiveChildPath",
"=",
"childPath",
".",
"replaceFirst",
"(",
"Pattern",
".",
"quote",
"(",
"rootPath",
")",
",",
"\"\"",
")",
";",
"return",
"new",
"BasicPath",
"(",
"archiveChildPath",
")",
";",
"}"
] | Calculate the relative child path.
@param root
The Archive root folder
@param child
The Child file
@return a Path fort he child relative to root | [
"Calculate",
"the",
"relative",
"child",
"path",
"."
] | train | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/importer/ExplodedImporterImpl.java#L142-L147 |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/PhotosGeoApi.java | PhotosGeoApi.setPerms | public Response setPerms(String photoId, boolean isPublic, boolean isContact, boolean isFriend, boolean isFamily) throws JinxException {
"""
Set the permission for who may view the geo data associated with a photo.
<br>
This method requires authentication with 'write' permission.
@param photoId (Required) The id of the photo to set permissions for.
@param isPublic viewing permissions for the photo location data to public.
@param isContact viewing permissions for the photo location data to contacts.
@param isFriend viewing permissions for the photo location data to friends.
@param isFamily viewing permissions for the photo location data to family.
@return object with the status of the requested operation.
@throws JinxException if required parameters are missing, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.photos.geo.setPerms.html">flickr.photos.geo.setPerms</a>
"""
JinxUtils.validateParams(photoId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.photos.geo.setPerms");
params.put("photo_id", photoId);
params.put("is_public", isPublic ? "1" : "0");
params.put("is_contact", isContact ? "1" : "0");
params.put("is_friend", isFriend ? "1" : "0");
params.put("is_family", isFamily ? "1" : "0");
return jinx.flickrPost(params, Response.class);
} | java | public Response setPerms(String photoId, boolean isPublic, boolean isContact, boolean isFriend, boolean isFamily) throws JinxException {
JinxUtils.validateParams(photoId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.photos.geo.setPerms");
params.put("photo_id", photoId);
params.put("is_public", isPublic ? "1" : "0");
params.put("is_contact", isContact ? "1" : "0");
params.put("is_friend", isFriend ? "1" : "0");
params.put("is_family", isFamily ? "1" : "0");
return jinx.flickrPost(params, Response.class);
} | [
"public",
"Response",
"setPerms",
"(",
"String",
"photoId",
",",
"boolean",
"isPublic",
",",
"boolean",
"isContact",
",",
"boolean",
"isFriend",
",",
"boolean",
"isFamily",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"photoId",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"params",
".",
"put",
"(",
"\"method\"",
",",
"\"flickr.photos.geo.setPerms\"",
")",
";",
"params",
".",
"put",
"(",
"\"photo_id\"",
",",
"photoId",
")",
";",
"params",
".",
"put",
"(",
"\"is_public\"",
",",
"isPublic",
"?",
"\"1\"",
":",
"\"0\"",
")",
";",
"params",
".",
"put",
"(",
"\"is_contact\"",
",",
"isContact",
"?",
"\"1\"",
":",
"\"0\"",
")",
";",
"params",
".",
"put",
"(",
"\"is_friend\"",
",",
"isFriend",
"?",
"\"1\"",
":",
"\"0\"",
")",
";",
"params",
".",
"put",
"(",
"\"is_family\"",
",",
"isFamily",
"?",
"\"1\"",
":",
"\"0\"",
")",
";",
"return",
"jinx",
".",
"flickrPost",
"(",
"params",
",",
"Response",
".",
"class",
")",
";",
"}"
] | Set the permission for who may view the geo data associated with a photo.
<br>
This method requires authentication with 'write' permission.
@param photoId (Required) The id of the photo to set permissions for.
@param isPublic viewing permissions for the photo location data to public.
@param isContact viewing permissions for the photo location data to contacts.
@param isFriend viewing permissions for the photo location data to friends.
@param isFamily viewing permissions for the photo location data to family.
@return object with the status of the requested operation.
@throws JinxException if required parameters are missing, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.photos.geo.setPerms.html">flickr.photos.geo.setPerms</a> | [
"Set",
"the",
"permission",
"for",
"who",
"may",
"view",
"the",
"geo",
"data",
"associated",
"with",
"a",
"photo",
".",
"<br",
">",
"This",
"method",
"requires",
"authentication",
"with",
"write",
"permission",
"."
] | train | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PhotosGeoApi.java#L281-L291 |
ACRA/acra | acra-core/src/main/java/org/acra/builder/ReportExecutor.java | ReportExecutor.handReportToDefaultExceptionHandler | public void handReportToDefaultExceptionHandler(@Nullable Thread t, @NonNull Throwable e) {
"""
pass-through to default handler
@param t the crashed thread
@param e the uncaught exception
"""
if (defaultExceptionHandler != null) {
ACRA.log.i(LOG_TAG, "ACRA is disabled for " + context.getPackageName()
+ " - forwarding uncaught Exception on to default ExceptionHandler");
defaultExceptionHandler.uncaughtException(t, e);
} else {
ACRA.log.e(LOG_TAG, "ACRA is disabled for " + context.getPackageName() + " - no default ExceptionHandler");
ACRA.log.e(LOG_TAG, "ACRA caught a " + e.getClass().getSimpleName() + " for " + context.getPackageName(), e);
}
} | java | public void handReportToDefaultExceptionHandler(@Nullable Thread t, @NonNull Throwable e) {
if (defaultExceptionHandler != null) {
ACRA.log.i(LOG_TAG, "ACRA is disabled for " + context.getPackageName()
+ " - forwarding uncaught Exception on to default ExceptionHandler");
defaultExceptionHandler.uncaughtException(t, e);
} else {
ACRA.log.e(LOG_TAG, "ACRA is disabled for " + context.getPackageName() + " - no default ExceptionHandler");
ACRA.log.e(LOG_TAG, "ACRA caught a " + e.getClass().getSimpleName() + " for " + context.getPackageName(), e);
}
} | [
"public",
"void",
"handReportToDefaultExceptionHandler",
"(",
"@",
"Nullable",
"Thread",
"t",
",",
"@",
"NonNull",
"Throwable",
"e",
")",
"{",
"if",
"(",
"defaultExceptionHandler",
"!=",
"null",
")",
"{",
"ACRA",
".",
"log",
".",
"i",
"(",
"LOG_TAG",
",",
"\"ACRA is disabled for \"",
"+",
"context",
".",
"getPackageName",
"(",
")",
"+",
"\" - forwarding uncaught Exception on to default ExceptionHandler\"",
")",
";",
"defaultExceptionHandler",
".",
"uncaughtException",
"(",
"t",
",",
"e",
")",
";",
"}",
"else",
"{",
"ACRA",
".",
"log",
".",
"e",
"(",
"LOG_TAG",
",",
"\"ACRA is disabled for \"",
"+",
"context",
".",
"getPackageName",
"(",
")",
"+",
"\" - no default ExceptionHandler\"",
")",
";",
"ACRA",
".",
"log",
".",
"e",
"(",
"LOG_TAG",
",",
"\"ACRA caught a \"",
"+",
"e",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
"+",
"\" for \"",
"+",
"context",
".",
"getPackageName",
"(",
")",
",",
"e",
")",
";",
"}",
"}"
] | pass-through to default handler
@param t the crashed thread
@param e the uncaught exception | [
"pass",
"-",
"through",
"to",
"default",
"handler"
] | train | https://github.com/ACRA/acra/blob/bfa3235ab110328c5ab2f792ddf8ee87be4a32d1/acra-core/src/main/java/org/acra/builder/ReportExecutor.java#L98-L108 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/map/feature/Feature.java | Feature.setFloatAttribute | public void setFloatAttribute(String name, Float value) {
"""
Set attribute value of given type.
@param name attribute name
@param value attribute value
"""
Attribute attribute = getAttributes().get(name);
if (!(attribute instanceof FloatAttribute)) {
throw new IllegalStateException("Cannot set float value on attribute with different type, " +
attribute.getClass().getName() + " setting value " + value);
}
((FloatAttribute) attribute).setValue(value);
} | java | public void setFloatAttribute(String name, Float value) {
Attribute attribute = getAttributes().get(name);
if (!(attribute instanceof FloatAttribute)) {
throw new IllegalStateException("Cannot set float value on attribute with different type, " +
attribute.getClass().getName() + " setting value " + value);
}
((FloatAttribute) attribute).setValue(value);
} | [
"public",
"void",
"setFloatAttribute",
"(",
"String",
"name",
",",
"Float",
"value",
")",
"{",
"Attribute",
"attribute",
"=",
"getAttributes",
"(",
")",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"!",
"(",
"attribute",
"instanceof",
"FloatAttribute",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot set float value on attribute with different type, \"",
"+",
"attribute",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\" setting value \"",
"+",
"value",
")",
";",
"}",
"(",
"(",
"FloatAttribute",
")",
"attribute",
")",
".",
"setValue",
"(",
"value",
")",
";",
"}"
] | Set attribute value of given type.
@param name attribute name
@param value attribute value | [
"Set",
"attribute",
"value",
"of",
"given",
"type",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/feature/Feature.java#L275-L282 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/media/MediaClient.java | MediaClient.createPreset | public CreatePresetResponse createPreset(
String presetName, String container, Clip clip, Audio audio, Encryption encryption) {
"""
Create a preset which help to convert audio files on be played in a wide range of devices.
@param presetName The name of the new preset.
@param container The container type for the output file. Valid values include mp4, flv, hls, mp3, m4a.
@param clip The clip property of the preset.
@param audio Specify the audio format of target file.
@param encryption Specify the encryption property of target file.
"""
return createPreset(presetName, null, container, false, clip, audio, null, encryption, null);
} | java | public CreatePresetResponse createPreset(
String presetName, String container, Clip clip, Audio audio, Encryption encryption) {
return createPreset(presetName, null, container, false, clip, audio, null, encryption, null);
} | [
"public",
"CreatePresetResponse",
"createPreset",
"(",
"String",
"presetName",
",",
"String",
"container",
",",
"Clip",
"clip",
",",
"Audio",
"audio",
",",
"Encryption",
"encryption",
")",
"{",
"return",
"createPreset",
"(",
"presetName",
",",
"null",
",",
"container",
",",
"false",
",",
"clip",
",",
"audio",
",",
"null",
",",
"encryption",
",",
"null",
")",
";",
"}"
] | Create a preset which help to convert audio files on be played in a wide range of devices.
@param presetName The name of the new preset.
@param container The container type for the output file. Valid values include mp4, flv, hls, mp3, m4a.
@param clip The clip property of the preset.
@param audio Specify the audio format of target file.
@param encryption Specify the encryption property of target file. | [
"Create",
"a",
"preset",
"which",
"help",
"to",
"convert",
"audio",
"files",
"on",
"be",
"played",
"in",
"a",
"wide",
"range",
"of",
"devices",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/media/MediaClient.java#L705-L708 |
Azure/azure-sdk-for-java | streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/StreamingJobsInner.java | StreamingJobsInner.createOrReplace | public StreamingJobInner createOrReplace(String resourceGroupName, String jobName, StreamingJobInner streamingJob) {
"""
Creates a streaming job or replaces an already existing streaming job.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param jobName The name of the streaming job.
@param streamingJob The definition of the streaming job that will be used to create a new streaming job or replace the existing one.
@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 StreamingJobInner object if successful.
"""
return createOrReplaceWithServiceResponseAsync(resourceGroupName, jobName, streamingJob).toBlocking().last().body();
} | java | public StreamingJobInner createOrReplace(String resourceGroupName, String jobName, StreamingJobInner streamingJob) {
return createOrReplaceWithServiceResponseAsync(resourceGroupName, jobName, streamingJob).toBlocking().last().body();
} | [
"public",
"StreamingJobInner",
"createOrReplace",
"(",
"String",
"resourceGroupName",
",",
"String",
"jobName",
",",
"StreamingJobInner",
"streamingJob",
")",
"{",
"return",
"createOrReplaceWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"jobName",
",",
"streamingJob",
")",
".",
"toBlocking",
"(",
")",
".",
"last",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Creates a streaming job or replaces an already existing streaming job.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param jobName The name of the streaming job.
@param streamingJob The definition of the streaming job that will be used to create a new streaming job or replace the existing one.
@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 StreamingJobInner object if successful. | [
"Creates",
"a",
"streaming",
"job",
"or",
"replaces",
"an",
"already",
"existing",
"streaming",
"job",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/StreamingJobsInner.java#L143-L145 |
zaproxy/zaproxy | src/org/zaproxy/zap/extension/brk/BreakpointMessageHandler2.java | BreakpointMessageHandler2.handleMessageReceivedFromClient | public boolean handleMessageReceivedFromClient(Message aMessage, boolean onlyIfInScope) {
"""
Do not call if in {@link Mode#safe}.
@param aMessage
@param onlyIfInScope
@return False if message should be dropped.
"""
if ( ! isBreakpoint(aMessage, true, onlyIfInScope)) {
return true;
}
// Do this outside of the semaphore loop so that the 'continue' button can apply to all queued break points
// but be reset when the next break point is hit
breakMgmt.breakpointHit();
BreakEventPublisher.getPublisher().publishHitEvent(aMessage);
synchronized(SEMAPHORE) {
if (breakMgmt.isHoldMessage(aMessage)) {
BreakEventPublisher.getPublisher().publishActiveEvent(aMessage);
setBreakDisplay(aMessage, true);
waitUntilContinue(aMessage, true);
BreakEventPublisher.getPublisher().publishInactiveEvent(aMessage);
}
}
breakMgmt.clearAndDisableRequest();
return ! breakMgmt.isToBeDropped();
} | java | public boolean handleMessageReceivedFromClient(Message aMessage, boolean onlyIfInScope) {
if ( ! isBreakpoint(aMessage, true, onlyIfInScope)) {
return true;
}
// Do this outside of the semaphore loop so that the 'continue' button can apply to all queued break points
// but be reset when the next break point is hit
breakMgmt.breakpointHit();
BreakEventPublisher.getPublisher().publishHitEvent(aMessage);
synchronized(SEMAPHORE) {
if (breakMgmt.isHoldMessage(aMessage)) {
BreakEventPublisher.getPublisher().publishActiveEvent(aMessage);
setBreakDisplay(aMessage, true);
waitUntilContinue(aMessage, true);
BreakEventPublisher.getPublisher().publishInactiveEvent(aMessage);
}
}
breakMgmt.clearAndDisableRequest();
return ! breakMgmt.isToBeDropped();
} | [
"public",
"boolean",
"handleMessageReceivedFromClient",
"(",
"Message",
"aMessage",
",",
"boolean",
"onlyIfInScope",
")",
"{",
"if",
"(",
"!",
"isBreakpoint",
"(",
"aMessage",
",",
"true",
",",
"onlyIfInScope",
")",
")",
"{",
"return",
"true",
";",
"}",
"// Do this outside of the semaphore loop so that the 'continue' button can apply to all queued break points\r",
"// but be reset when the next break point is hit\r",
"breakMgmt",
".",
"breakpointHit",
"(",
")",
";",
"BreakEventPublisher",
".",
"getPublisher",
"(",
")",
".",
"publishHitEvent",
"(",
"aMessage",
")",
";",
"synchronized",
"(",
"SEMAPHORE",
")",
"{",
"if",
"(",
"breakMgmt",
".",
"isHoldMessage",
"(",
"aMessage",
")",
")",
"{",
"BreakEventPublisher",
".",
"getPublisher",
"(",
")",
".",
"publishActiveEvent",
"(",
"aMessage",
")",
";",
"setBreakDisplay",
"(",
"aMessage",
",",
"true",
")",
";",
"waitUntilContinue",
"(",
"aMessage",
",",
"true",
")",
";",
"BreakEventPublisher",
".",
"getPublisher",
"(",
")",
".",
"publishInactiveEvent",
"(",
"aMessage",
")",
";",
"}",
"}",
"breakMgmt",
".",
"clearAndDisableRequest",
"(",
")",
";",
"return",
"!",
"breakMgmt",
".",
"isToBeDropped",
"(",
")",
";",
"}"
] | Do not call if in {@link Mode#safe}.
@param aMessage
@param onlyIfInScope
@return False if message should be dropped. | [
"Do",
"not",
"call",
"if",
"in",
"{",
"@link",
"Mode#safe",
"}",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/brk/BreakpointMessageHandler2.java#L65-L85 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuTexRefSetMipmappedArray | public static int cuTexRefSetMipmappedArray(CUtexref hTexRef, CUmipmappedArray hMipmappedArray, int Flags) {
"""
Binds a mipmapped array to a texture reference.
<pre>
CUresult cuTexRefSetMipmappedArray (
CUtexref hTexRef,
CUmipmappedArray hMipmappedArray,
unsigned int Flags )
</pre>
<div>
<p>Binds a mipmapped array to a texture
reference. Binds the CUDA mipmapped array <tt>hMipmappedArray</tt>
to the texture reference <tt>hTexRef</tt>. Any previous address or
CUDA array state associated with the texture reference is superseded
by this function. <tt>Flags</tt> must be set to CU_TRSA_OVERRIDE_FORMAT.
Any CUDA array previously bound to <tt>hTexRef</tt> is unbound.
</p>
</div>
@param hTexRef Texture reference to bind
@param hMipmappedArray Mipmapped array to bind
@param Flags Options (must be CU_TRSA_OVERRIDE_FORMAT)
@return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED,
CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
@see JCudaDriver#cuTexRefSetAddress
@see JCudaDriver#cuTexRefSetAddress2D
@see JCudaDriver#cuTexRefSetAddressMode
@see JCudaDriver#cuTexRefSetFilterMode
@see JCudaDriver#cuTexRefSetFlags
@see JCudaDriver#cuTexRefSetFormat
@see JCudaDriver#cuTexRefGetAddress
@see JCudaDriver#cuTexRefGetAddressMode
@see JCudaDriver#cuTexRefGetArray
@see JCudaDriver#cuTexRefGetFilterMode
@see JCudaDriver#cuTexRefGetFlags
@see JCudaDriver#cuTexRefGetFormat
"""
return checkResult(cuTexRefSetMipmappedArrayNative(hTexRef, hMipmappedArray, Flags));
} | java | public static int cuTexRefSetMipmappedArray(CUtexref hTexRef, CUmipmappedArray hMipmappedArray, int Flags)
{
return checkResult(cuTexRefSetMipmappedArrayNative(hTexRef, hMipmappedArray, Flags));
} | [
"public",
"static",
"int",
"cuTexRefSetMipmappedArray",
"(",
"CUtexref",
"hTexRef",
",",
"CUmipmappedArray",
"hMipmappedArray",
",",
"int",
"Flags",
")",
"{",
"return",
"checkResult",
"(",
"cuTexRefSetMipmappedArrayNative",
"(",
"hTexRef",
",",
"hMipmappedArray",
",",
"Flags",
")",
")",
";",
"}"
] | Binds a mipmapped array to a texture reference.
<pre>
CUresult cuTexRefSetMipmappedArray (
CUtexref hTexRef,
CUmipmappedArray hMipmappedArray,
unsigned int Flags )
</pre>
<div>
<p>Binds a mipmapped array to a texture
reference. Binds the CUDA mipmapped array <tt>hMipmappedArray</tt>
to the texture reference <tt>hTexRef</tt>. Any previous address or
CUDA array state associated with the texture reference is superseded
by this function. <tt>Flags</tt> must be set to CU_TRSA_OVERRIDE_FORMAT.
Any CUDA array previously bound to <tt>hTexRef</tt> is unbound.
</p>
</div>
@param hTexRef Texture reference to bind
@param hMipmappedArray Mipmapped array to bind
@param Flags Options (must be CU_TRSA_OVERRIDE_FORMAT)
@return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED,
CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
@see JCudaDriver#cuTexRefSetAddress
@see JCudaDriver#cuTexRefSetAddress2D
@see JCudaDriver#cuTexRefSetAddressMode
@see JCudaDriver#cuTexRefSetFilterMode
@see JCudaDriver#cuTexRefSetFlags
@see JCudaDriver#cuTexRefSetFormat
@see JCudaDriver#cuTexRefGetAddress
@see JCudaDriver#cuTexRefGetAddressMode
@see JCudaDriver#cuTexRefGetArray
@see JCudaDriver#cuTexRefGetFilterMode
@see JCudaDriver#cuTexRefGetFlags
@see JCudaDriver#cuTexRefGetFormat | [
"Binds",
"a",
"mipmapped",
"array",
"to",
"a",
"texture",
"reference",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L9764-L9767 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/ellipse/SnapToEllipseEdge.java | SnapToEllipseEdge.change | protected static double change( EllipseRotated_F64 a , EllipseRotated_F64 b ) {
"""
Computes a numerical value for the difference in parameters between the two ellipses
"""
double total = 0;
total += Math.abs(a.center.x - b.center.x);
total += Math.abs(a.center.y - b.center.y);
total += Math.abs(a.a - b.a);
total += Math.abs(a.b - b.b);
// only care about the change of angle when it is not a circle
double weight = Math.min(4,2.0*(a.a/a.b-1.0));
total += weight*UtilAngle.distHalf(a.phi , b.phi);
return total;
} | java | protected static double change( EllipseRotated_F64 a , EllipseRotated_F64 b ) {
double total = 0;
total += Math.abs(a.center.x - b.center.x);
total += Math.abs(a.center.y - b.center.y);
total += Math.abs(a.a - b.a);
total += Math.abs(a.b - b.b);
// only care about the change of angle when it is not a circle
double weight = Math.min(4,2.0*(a.a/a.b-1.0));
total += weight*UtilAngle.distHalf(a.phi , b.phi);
return total;
} | [
"protected",
"static",
"double",
"change",
"(",
"EllipseRotated_F64",
"a",
",",
"EllipseRotated_F64",
"b",
")",
"{",
"double",
"total",
"=",
"0",
";",
"total",
"+=",
"Math",
".",
"abs",
"(",
"a",
".",
"center",
".",
"x",
"-",
"b",
".",
"center",
".",
"x",
")",
";",
"total",
"+=",
"Math",
".",
"abs",
"(",
"a",
".",
"center",
".",
"y",
"-",
"b",
".",
"center",
".",
"y",
")",
";",
"total",
"+=",
"Math",
".",
"abs",
"(",
"a",
".",
"a",
"-",
"b",
".",
"a",
")",
";",
"total",
"+=",
"Math",
".",
"abs",
"(",
"a",
".",
"b",
"-",
"b",
".",
"b",
")",
";",
"// only care about the change of angle when it is not a circle",
"double",
"weight",
"=",
"Math",
".",
"min",
"(",
"4",
",",
"2.0",
"*",
"(",
"a",
".",
"a",
"/",
"a",
".",
"b",
"-",
"1.0",
")",
")",
";",
"total",
"+=",
"weight",
"*",
"UtilAngle",
".",
"distHalf",
"(",
"a",
".",
"phi",
",",
"b",
".",
"phi",
")",
";",
"return",
"total",
";",
"}"
] | Computes a numerical value for the difference in parameters between the two ellipses | [
"Computes",
"a",
"numerical",
"value",
"for",
"the",
"difference",
"in",
"parameters",
"between",
"the",
"two",
"ellipses"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/ellipse/SnapToEllipseEdge.java#L116-L129 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java | Error.parametersUsageNotAllowed | public static void parametersUsageNotAllowed(String methodName, String className) {
"""
Thrown when the parameters number is incorrect.
@param methodName method name
@param className class name
"""
throw new DynamicConversionParameterException(MSG.INSTANCE.message(dynamicConversionParameterException,methodName,className));
} | java | public static void parametersUsageNotAllowed(String methodName, String className){
throw new DynamicConversionParameterException(MSG.INSTANCE.message(dynamicConversionParameterException,methodName,className));
} | [
"public",
"static",
"void",
"parametersUsageNotAllowed",
"(",
"String",
"methodName",
",",
"String",
"className",
")",
"{",
"throw",
"new",
"DynamicConversionParameterException",
"(",
"MSG",
".",
"INSTANCE",
".",
"message",
"(",
"dynamicConversionParameterException",
",",
"methodName",
",",
"className",
")",
")",
";",
"}"
] | Thrown when the parameters number is incorrect.
@param methodName method name
@param className class name | [
"Thrown",
"when",
"the",
"parameters",
"number",
"is",
"incorrect",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L214-L216 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/util/collection/Int2ObjectHashMap.java | Int2ObjectHashMap.computeIfAbsent | public V computeIfAbsent(final int key, final IntFunction<? extends V> mappingFunction) {
"""
Get a value for a given key, or if it does ot exist then default the value via a {@link IntFunction}
and put it in the map.
@param key to search on.
@param mappingFunction to provide a value if the get returns null.
@return the value if found otherwise the default.
"""
checkNotNull(mappingFunction, "mappingFunction cannot be null");
V value = get(key);
if (value == null) {
value = mappingFunction.apply(key);
if (value != null) {
put(key, value);
}
}
return value;
} | java | public V computeIfAbsent(final int key, final IntFunction<? extends V> mappingFunction) {
checkNotNull(mappingFunction, "mappingFunction cannot be null");
V value = get(key);
if (value == null) {
value = mappingFunction.apply(key);
if (value != null) {
put(key, value);
}
}
return value;
} | [
"public",
"V",
"computeIfAbsent",
"(",
"final",
"int",
"key",
",",
"final",
"IntFunction",
"<",
"?",
"extends",
"V",
">",
"mappingFunction",
")",
"{",
"checkNotNull",
"(",
"mappingFunction",
",",
"\"mappingFunction cannot be null\"",
")",
";",
"V",
"value",
"=",
"get",
"(",
"key",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"value",
"=",
"mappingFunction",
".",
"apply",
"(",
"key",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"put",
"(",
"key",
",",
"value",
")",
";",
"}",
"}",
"return",
"value",
";",
"}"
] | Get a value for a given key, or if it does ot exist then default the value via a {@link IntFunction}
and put it in the map.
@param key to search on.
@param mappingFunction to provide a value if the get returns null.
@return the value if found otherwise the default. | [
"Get",
"a",
"value",
"for",
"a",
"given",
"key",
"or",
"if",
"it",
"does",
"ot",
"exist",
"then",
"default",
"the",
"value",
"via",
"a",
"{",
"@link",
"IntFunction",
"}",
"and",
"put",
"it",
"in",
"the",
"map",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/collection/Int2ObjectHashMap.java#L193-L203 |
sebastiangraf/jSCSI | bundles/initiator/src/main/java/org/jscsi/initiator/Configuration.java | Configuration.getSetting | public final String getSetting (final String targetName, final int connectionID, final OperationalTextKey textKey) throws OperationalTextKeyException {
"""
Returns the value of a single parameter, instead of all values.
@param targetName Name of the iSCSI Target to connect.
@param connectionID The ID of the connection to retrieve.
@param textKey The name of the parameter.
@return The value of the given parameter.
@throws OperationalTextKeyException If the given parameter cannot be found.
"""
try {
final SessionConfiguration sc;
synchronized (sessionConfigs) {
sc = sessionConfigs.get(targetName);
synchronized (sc) {
if (sc != null) {
String value = sc.getSetting(connectionID, textKey);
if (value != null) { return value; }
}
}
}
} catch (OperationalTextKeyException e) {
// we had not find a session/connection entry, so we have to search
// in the
// global settings
}
final SettingEntry se;
synchronized (globalConfig) {
se = globalConfig.get(textKey);
synchronized (se) {
if (se != null) { return se.getValue(); }
}
}
throw new OperationalTextKeyException("No OperationalTextKey entry found for key: " + textKey.value());
} | java | public final String getSetting (final String targetName, final int connectionID, final OperationalTextKey textKey) throws OperationalTextKeyException {
try {
final SessionConfiguration sc;
synchronized (sessionConfigs) {
sc = sessionConfigs.get(targetName);
synchronized (sc) {
if (sc != null) {
String value = sc.getSetting(connectionID, textKey);
if (value != null) { return value; }
}
}
}
} catch (OperationalTextKeyException e) {
// we had not find a session/connection entry, so we have to search
// in the
// global settings
}
final SettingEntry se;
synchronized (globalConfig) {
se = globalConfig.get(textKey);
synchronized (se) {
if (se != null) { return se.getValue(); }
}
}
throw new OperationalTextKeyException("No OperationalTextKey entry found for key: " + textKey.value());
} | [
"public",
"final",
"String",
"getSetting",
"(",
"final",
"String",
"targetName",
",",
"final",
"int",
"connectionID",
",",
"final",
"OperationalTextKey",
"textKey",
")",
"throws",
"OperationalTextKeyException",
"{",
"try",
"{",
"final",
"SessionConfiguration",
"sc",
";",
"synchronized",
"(",
"sessionConfigs",
")",
"{",
"sc",
"=",
"sessionConfigs",
".",
"get",
"(",
"targetName",
")",
";",
"synchronized",
"(",
"sc",
")",
"{",
"if",
"(",
"sc",
"!=",
"null",
")",
"{",
"String",
"value",
"=",
"sc",
".",
"getSetting",
"(",
"connectionID",
",",
"textKey",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"return",
"value",
";",
"}",
"}",
"}",
"}",
"}",
"catch",
"(",
"OperationalTextKeyException",
"e",
")",
"{",
"// we had not find a session/connection entry, so we have to search",
"// in the",
"// global settings",
"}",
"final",
"SettingEntry",
"se",
";",
"synchronized",
"(",
"globalConfig",
")",
"{",
"se",
"=",
"globalConfig",
".",
"get",
"(",
"textKey",
")",
";",
"synchronized",
"(",
"se",
")",
"{",
"if",
"(",
"se",
"!=",
"null",
")",
"{",
"return",
"se",
".",
"getValue",
"(",
")",
";",
"}",
"}",
"}",
"throw",
"new",
"OperationalTextKeyException",
"(",
"\"No OperationalTextKey entry found for key: \"",
"+",
"textKey",
".",
"value",
"(",
")",
")",
";",
"}"
] | Returns the value of a single parameter, instead of all values.
@param targetName Name of the iSCSI Target to connect.
@param connectionID The ID of the connection to retrieve.
@param textKey The name of the parameter.
@return The value of the given parameter.
@throws OperationalTextKeyException If the given parameter cannot be found. | [
"Returns",
"the",
"value",
"of",
"a",
"single",
"parameter",
"instead",
"of",
"all",
"values",
"."
] | train | https://github.com/sebastiangraf/jSCSI/blob/6169bfe73f0b15de7d6485453555389e782ae888/bundles/initiator/src/main/java/org/jscsi/initiator/Configuration.java#L205-L235 |
jingwei/krati | krati-main/src/main/java/krati/core/array/SimpleDataArray.java | SimpleDataArray.setCompactionAddress | protected void setCompactionAddress(int index, long value, long scn) throws Exception {
"""
Sets the address (long value), which is produced by the Segment compactor,
at the specified array index.
@param index - the array index.
@param value - the address value.
@param scn - the System Change Number (SCN) representing an ever-increasing update order.
@throws Exception if the address cannot be updated at the specified array index.
"""
_addressArray.setCompactionAddress(index, value, scn);
_hwmSet = Math.max(_hwmSet, scn);
} | java | protected void setCompactionAddress(int index, long value, long scn) throws Exception {
_addressArray.setCompactionAddress(index, value, scn);
_hwmSet = Math.max(_hwmSet, scn);
} | [
"protected",
"void",
"setCompactionAddress",
"(",
"int",
"index",
",",
"long",
"value",
",",
"long",
"scn",
")",
"throws",
"Exception",
"{",
"_addressArray",
".",
"setCompactionAddress",
"(",
"index",
",",
"value",
",",
"scn",
")",
";",
"_hwmSet",
"=",
"Math",
".",
"max",
"(",
"_hwmSet",
",",
"scn",
")",
";",
"}"
] | Sets the address (long value), which is produced by the Segment compactor,
at the specified array index.
@param index - the array index.
@param value - the address value.
@param scn - the System Change Number (SCN) representing an ever-increasing update order.
@throws Exception if the address cannot be updated at the specified array index. | [
"Sets",
"the",
"address",
"(",
"long",
"value",
")",
"which",
"is",
"produced",
"by",
"the",
"Segment",
"compactor",
"at",
"the",
"specified",
"array",
"index",
"."
] | train | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/SimpleDataArray.java#L362-L365 |
xetorthio/jedis | src/main/java/redis/clients/jedis/BinaryJedis.java | BinaryJedis.zscore | @Override
public Double zscore(final byte[] key, final byte[] member) {
"""
Return the score of the specified element of the sorted set at key. If the specified element
does not exist in the sorted set, or the key does not exist at all, a special 'nil' value is
returned.
<p>
<b>Time complexity:</b> O(1)
@param key
@param member
@return the score
"""
checkIsInMultiOrPipeline();
client.zscore(key, member);
final String score = client.getBulkReply();
return (score != null ? new Double(score) : null);
} | java | @Override
public Double zscore(final byte[] key, final byte[] member) {
checkIsInMultiOrPipeline();
client.zscore(key, member);
final String score = client.getBulkReply();
return (score != null ? new Double(score) : null);
} | [
"@",
"Override",
"public",
"Double",
"zscore",
"(",
"final",
"byte",
"[",
"]",
"key",
",",
"final",
"byte",
"[",
"]",
"member",
")",
"{",
"checkIsInMultiOrPipeline",
"(",
")",
";",
"client",
".",
"zscore",
"(",
"key",
",",
"member",
")",
";",
"final",
"String",
"score",
"=",
"client",
".",
"getBulkReply",
"(",
")",
";",
"return",
"(",
"score",
"!=",
"null",
"?",
"new",
"Double",
"(",
"score",
")",
":",
"null",
")",
";",
"}"
] | Return the score of the specified element of the sorted set at key. If the specified element
does not exist in the sorted set, or the key does not exist at all, a special 'nil' value is
returned.
<p>
<b>Time complexity:</b> O(1)
@param key
@param member
@return the score | [
"Return",
"the",
"score",
"of",
"the",
"specified",
"element",
"of",
"the",
"sorted",
"set",
"at",
"key",
".",
"If",
"the",
"specified",
"element",
"does",
"not",
"exist",
"in",
"the",
"sorted",
"set",
"or",
"the",
"key",
"does",
"not",
"exist",
"at",
"all",
"a",
"special",
"nil",
"value",
"is",
"returned",
".",
"<p",
">",
"<b",
">",
"Time",
"complexity",
":",
"<",
"/",
"b",
">",
"O",
"(",
"1",
")"
] | train | https://github.com/xetorthio/jedis/blob/ef4ab403f9d8fd88bd05092fea96de2e9db0bede/src/main/java/redis/clients/jedis/BinaryJedis.java#L1836-L1842 |
JOML-CI/JOML | src/org/joml/Matrix3d.java | Matrix3d.setColumn | public Matrix3d setColumn(int column, Vector3dc src) throws IndexOutOfBoundsException {
"""
Set the column at the given <code>column</code> index, starting with <code>0</code>.
@param column
the column index in <code>[0..2]</code>
@param src
the column components to set
@return this
@throws IndexOutOfBoundsException if <code>column</code> is not in <code>[0..2]</code>
"""
return setColumn(column, src.x(), src.y(), src.z());
} | java | public Matrix3d setColumn(int column, Vector3dc src) throws IndexOutOfBoundsException {
return setColumn(column, src.x(), src.y(), src.z());
} | [
"public",
"Matrix3d",
"setColumn",
"(",
"int",
"column",
",",
"Vector3dc",
"src",
")",
"throws",
"IndexOutOfBoundsException",
"{",
"return",
"setColumn",
"(",
"column",
",",
"src",
".",
"x",
"(",
")",
",",
"src",
".",
"y",
"(",
")",
",",
"src",
".",
"z",
"(",
")",
")",
";",
"}"
] | Set the column at the given <code>column</code> index, starting with <code>0</code>.
@param column
the column index in <code>[0..2]</code>
@param src
the column components to set
@return this
@throws IndexOutOfBoundsException if <code>column</code> is not in <code>[0..2]</code> | [
"Set",
"the",
"column",
"at",
"the",
"given",
"<code",
">",
"column<",
"/",
"code",
">",
"index",
"starting",
"with",
"<code",
">",
"0<",
"/",
"code",
">",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3d.java#L3589-L3591 |
joniles/mpxj | src/main/java/net/sf/mpxj/explorer/ObjectPropertiesController.java | ObjectPropertiesController.getMultipleValues | private void getMultipleValues(Method method, Object object, Map<String, String> map) {
"""
Retrieve multiple properties.
@param method method definition
@param object target object
@param map parameter values
"""
try
{
int index = 1;
while (true)
{
Object value = filterValue(method.invoke(object, Integer.valueOf(index)));
if (value != null)
{
map.put(getPropertyName(method, index), String.valueOf(value));
}
++index;
}
}
catch (Exception ex)
{
// Reached the end of the valid indexes
}
} | java | private void getMultipleValues(Method method, Object object, Map<String, String> map)
{
try
{
int index = 1;
while (true)
{
Object value = filterValue(method.invoke(object, Integer.valueOf(index)));
if (value != null)
{
map.put(getPropertyName(method, index), String.valueOf(value));
}
++index;
}
}
catch (Exception ex)
{
// Reached the end of the valid indexes
}
} | [
"private",
"void",
"getMultipleValues",
"(",
"Method",
"method",
",",
"Object",
"object",
",",
"Map",
"<",
"String",
",",
"String",
">",
"map",
")",
"{",
"try",
"{",
"int",
"index",
"=",
"1",
";",
"while",
"(",
"true",
")",
"{",
"Object",
"value",
"=",
"filterValue",
"(",
"method",
".",
"invoke",
"(",
"object",
",",
"Integer",
".",
"valueOf",
"(",
"index",
")",
")",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"map",
".",
"put",
"(",
"getPropertyName",
"(",
"method",
",",
"index",
")",
",",
"String",
".",
"valueOf",
"(",
"value",
")",
")",
";",
"}",
"++",
"index",
";",
"}",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"// Reached the end of the valid indexes",
"}",
"}"
] | Retrieve multiple properties.
@param method method definition
@param object target object
@param map parameter values | [
"Retrieve",
"multiple",
"properties",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/ObjectPropertiesController.java#L192-L211 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/processor/map/NorthArrowGraphic.java | NorthArrowGraphic.createRaster | private static URI createRaster(
final Dimension targetSize, final RasterReference rasterReference,
final Double rotation, final Color backgroundColor,
final File workingDir) throws IOException {
"""
Renders a given graphic into a new image, scaled to fit the new size and rotated.
"""
final File path = File.createTempFile("north-arrow-", ".png", workingDir);
final BufferedImage newImage =
new BufferedImage(targetSize.width, targetSize.height, BufferedImage.TYPE_4BYTE_ABGR);
final Graphics2D graphics2d = newImage.createGraphics();
try {
final BufferedImage originalImage = ImageIO.read(rasterReference.inputStream);
if (originalImage == null) {
LOGGER.warn("Unable to load NorthArrow graphic: {}, it is not an image format that can be " +
"decoded",
rasterReference.uri);
throw new IllegalArgumentException();
}
// set background color
graphics2d.setColor(backgroundColor);
graphics2d.fillRect(0, 0, targetSize.width, targetSize.height);
// scale the original image to fit the new size
int newWidth;
int newHeight;
if (originalImage.getWidth() > originalImage.getHeight()) {
newWidth = targetSize.width;
newHeight = Math.min(
targetSize.height,
(int) Math.ceil(newWidth / (originalImage.getWidth() /
(double) originalImage.getHeight())));
} else {
newHeight = targetSize.height;
newWidth = Math.min(
targetSize.width,
(int) Math.ceil(newHeight / (originalImage.getHeight() /
(double) originalImage.getWidth())));
}
// position the original image in the center of the new
int deltaX = (int) Math.floor((targetSize.width - newWidth) / 2.0);
int deltaY = (int) Math.floor((targetSize.height - newHeight) / 2.0);
if (!FloatingPointUtil.equals(rotation, 0.0)) {
final AffineTransform rotate = AffineTransform.getRotateInstance(
rotation, targetSize.width / 2.0, targetSize.height / 2.0);
graphics2d.setTransform(rotate);
}
graphics2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
graphics2d.drawImage(originalImage, deltaX, deltaY, newWidth, newHeight, null);
ImageUtils.writeImage(newImage, "png", path);
} finally {
graphics2d.dispose();
}
return path.toURI();
} | java | private static URI createRaster(
final Dimension targetSize, final RasterReference rasterReference,
final Double rotation, final Color backgroundColor,
final File workingDir) throws IOException {
final File path = File.createTempFile("north-arrow-", ".png", workingDir);
final BufferedImage newImage =
new BufferedImage(targetSize.width, targetSize.height, BufferedImage.TYPE_4BYTE_ABGR);
final Graphics2D graphics2d = newImage.createGraphics();
try {
final BufferedImage originalImage = ImageIO.read(rasterReference.inputStream);
if (originalImage == null) {
LOGGER.warn("Unable to load NorthArrow graphic: {}, it is not an image format that can be " +
"decoded",
rasterReference.uri);
throw new IllegalArgumentException();
}
// set background color
graphics2d.setColor(backgroundColor);
graphics2d.fillRect(0, 0, targetSize.width, targetSize.height);
// scale the original image to fit the new size
int newWidth;
int newHeight;
if (originalImage.getWidth() > originalImage.getHeight()) {
newWidth = targetSize.width;
newHeight = Math.min(
targetSize.height,
(int) Math.ceil(newWidth / (originalImage.getWidth() /
(double) originalImage.getHeight())));
} else {
newHeight = targetSize.height;
newWidth = Math.min(
targetSize.width,
(int) Math.ceil(newHeight / (originalImage.getHeight() /
(double) originalImage.getWidth())));
}
// position the original image in the center of the new
int deltaX = (int) Math.floor((targetSize.width - newWidth) / 2.0);
int deltaY = (int) Math.floor((targetSize.height - newHeight) / 2.0);
if (!FloatingPointUtil.equals(rotation, 0.0)) {
final AffineTransform rotate = AffineTransform.getRotateInstance(
rotation, targetSize.width / 2.0, targetSize.height / 2.0);
graphics2d.setTransform(rotate);
}
graphics2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
graphics2d.drawImage(originalImage, deltaX, deltaY, newWidth, newHeight, null);
ImageUtils.writeImage(newImage, "png", path);
} finally {
graphics2d.dispose();
}
return path.toURI();
} | [
"private",
"static",
"URI",
"createRaster",
"(",
"final",
"Dimension",
"targetSize",
",",
"final",
"RasterReference",
"rasterReference",
",",
"final",
"Double",
"rotation",
",",
"final",
"Color",
"backgroundColor",
",",
"final",
"File",
"workingDir",
")",
"throws",
"IOException",
"{",
"final",
"File",
"path",
"=",
"File",
".",
"createTempFile",
"(",
"\"north-arrow-\"",
",",
"\".png\"",
",",
"workingDir",
")",
";",
"final",
"BufferedImage",
"newImage",
"=",
"new",
"BufferedImage",
"(",
"targetSize",
".",
"width",
",",
"targetSize",
".",
"height",
",",
"BufferedImage",
".",
"TYPE_4BYTE_ABGR",
")",
";",
"final",
"Graphics2D",
"graphics2d",
"=",
"newImage",
".",
"createGraphics",
"(",
")",
";",
"try",
"{",
"final",
"BufferedImage",
"originalImage",
"=",
"ImageIO",
".",
"read",
"(",
"rasterReference",
".",
"inputStream",
")",
";",
"if",
"(",
"originalImage",
"==",
"null",
")",
"{",
"LOGGER",
".",
"warn",
"(",
"\"Unable to load NorthArrow graphic: {}, it is not an image format that can be \"",
"+",
"\"decoded\"",
",",
"rasterReference",
".",
"uri",
")",
";",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"// set background color",
"graphics2d",
".",
"setColor",
"(",
"backgroundColor",
")",
";",
"graphics2d",
".",
"fillRect",
"(",
"0",
",",
"0",
",",
"targetSize",
".",
"width",
",",
"targetSize",
".",
"height",
")",
";",
"// scale the original image to fit the new size",
"int",
"newWidth",
";",
"int",
"newHeight",
";",
"if",
"(",
"originalImage",
".",
"getWidth",
"(",
")",
">",
"originalImage",
".",
"getHeight",
"(",
")",
")",
"{",
"newWidth",
"=",
"targetSize",
".",
"width",
";",
"newHeight",
"=",
"Math",
".",
"min",
"(",
"targetSize",
".",
"height",
",",
"(",
"int",
")",
"Math",
".",
"ceil",
"(",
"newWidth",
"/",
"(",
"originalImage",
".",
"getWidth",
"(",
")",
"/",
"(",
"double",
")",
"originalImage",
".",
"getHeight",
"(",
")",
")",
")",
")",
";",
"}",
"else",
"{",
"newHeight",
"=",
"targetSize",
".",
"height",
";",
"newWidth",
"=",
"Math",
".",
"min",
"(",
"targetSize",
".",
"width",
",",
"(",
"int",
")",
"Math",
".",
"ceil",
"(",
"newHeight",
"/",
"(",
"originalImage",
".",
"getHeight",
"(",
")",
"/",
"(",
"double",
")",
"originalImage",
".",
"getWidth",
"(",
")",
")",
")",
")",
";",
"}",
"// position the original image in the center of the new",
"int",
"deltaX",
"=",
"(",
"int",
")",
"Math",
".",
"floor",
"(",
"(",
"targetSize",
".",
"width",
"-",
"newWidth",
")",
"/",
"2.0",
")",
";",
"int",
"deltaY",
"=",
"(",
"int",
")",
"Math",
".",
"floor",
"(",
"(",
"targetSize",
".",
"height",
"-",
"newHeight",
")",
"/",
"2.0",
")",
";",
"if",
"(",
"!",
"FloatingPointUtil",
".",
"equals",
"(",
"rotation",
",",
"0.0",
")",
")",
"{",
"final",
"AffineTransform",
"rotate",
"=",
"AffineTransform",
".",
"getRotateInstance",
"(",
"rotation",
",",
"targetSize",
".",
"width",
"/",
"2.0",
",",
"targetSize",
".",
"height",
"/",
"2.0",
")",
";",
"graphics2d",
".",
"setTransform",
"(",
"rotate",
")",
";",
"}",
"graphics2d",
".",
"setRenderingHint",
"(",
"RenderingHints",
".",
"KEY_INTERPOLATION",
",",
"RenderingHints",
".",
"VALUE_INTERPOLATION_BICUBIC",
")",
";",
"graphics2d",
".",
"drawImage",
"(",
"originalImage",
",",
"deltaX",
",",
"deltaY",
",",
"newWidth",
",",
"newHeight",
",",
"null",
")",
";",
"ImageUtils",
".",
"writeImage",
"(",
"newImage",
",",
"\"png\"",
",",
"path",
")",
";",
"}",
"finally",
"{",
"graphics2d",
".",
"dispose",
"(",
")",
";",
"}",
"return",
"path",
".",
"toURI",
"(",
")",
";",
"}"
] | Renders a given graphic into a new image, scaled to fit the new size and rotated. | [
"Renders",
"a",
"given",
"graphic",
"into",
"a",
"new",
"image",
"scaled",
"to",
"fit",
"the",
"new",
"size",
"and",
"rotated",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/processor/map/NorthArrowGraphic.java#L113-L171 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SpoofChecker.java | SpoofChecker.areConfusable | public int areConfusable(String s1, String s2) {
"""
Check the whether two specified strings are visually confusable. The types of confusability to be tested - single
script, mixed script, or whole script - are determined by the check options set for the SpoofChecker.
The tests to be performed are controlled by the flags SINGLE_SCRIPT_CONFUSABLE MIXED_SCRIPT_CONFUSABLE
WHOLE_SCRIPT_CONFUSABLE At least one of these tests must be selected.
ANY_CASE is a modifier for the tests. Select it if the identifiers may be of mixed case. If identifiers are case
folded for comparison and display to the user, do not select the ANY_CASE option.
@param s1
The first of the two strings to be compared for confusability.
@param s2
The second of the two strings to be compared for confusability.
@return Non-zero if s1 and s1 are confusable. If not 0, the value will indicate the type(s) of confusability
found, as defined by spoof check test constants.
"""
//
// See section 4 of UAX 39 for the algorithm for checking whether two strings are confusable,
// and for definitions of the types (single, whole, mixed-script) of confusables.
// We only care about a few of the check flags. Ignore the others.
// If no tests relevant to this function have been specified, signal an error.
// TODO: is this really the right thing to do? It's probably an error on
// the caller's part, but logically we would just return 0 (no error).
if ((this.fChecks & CONFUSABLE) == 0) {
throw new IllegalArgumentException("No confusable checks are enabled.");
}
// Compute the skeletons and check for confusability.
String s1Skeleton = getSkeleton(s1);
String s2Skeleton = getSkeleton(s2);
if (!s1Skeleton.equals(s2Skeleton)) {
return 0;
}
// If we get here, the strings are confusable. Now we just need to set the flags for the appropriate classes
// of confusables according to UTS 39 section 4.
// Start by computing the resolved script sets of s1 and s2.
ScriptSet s1RSS = new ScriptSet();
getResolvedScriptSet(s1, s1RSS);
ScriptSet s2RSS = new ScriptSet();
getResolvedScriptSet(s2, s2RSS);
// Turn on all applicable flags
int result = 0;
if (s1RSS.intersects(s2RSS)) {
result |= SINGLE_SCRIPT_CONFUSABLE;
} else {
result |= MIXED_SCRIPT_CONFUSABLE;
if (!s1RSS.isEmpty() && !s2RSS.isEmpty()) {
result |= WHOLE_SCRIPT_CONFUSABLE;
}
}
// Turn off flags that the user doesn't want
result &= fChecks;
return result;
} | java | public int areConfusable(String s1, String s2) {
//
// See section 4 of UAX 39 for the algorithm for checking whether two strings are confusable,
// and for definitions of the types (single, whole, mixed-script) of confusables.
// We only care about a few of the check flags. Ignore the others.
// If no tests relevant to this function have been specified, signal an error.
// TODO: is this really the right thing to do? It's probably an error on
// the caller's part, but logically we would just return 0 (no error).
if ((this.fChecks & CONFUSABLE) == 0) {
throw new IllegalArgumentException("No confusable checks are enabled.");
}
// Compute the skeletons and check for confusability.
String s1Skeleton = getSkeleton(s1);
String s2Skeleton = getSkeleton(s2);
if (!s1Skeleton.equals(s2Skeleton)) {
return 0;
}
// If we get here, the strings are confusable. Now we just need to set the flags for the appropriate classes
// of confusables according to UTS 39 section 4.
// Start by computing the resolved script sets of s1 and s2.
ScriptSet s1RSS = new ScriptSet();
getResolvedScriptSet(s1, s1RSS);
ScriptSet s2RSS = new ScriptSet();
getResolvedScriptSet(s2, s2RSS);
// Turn on all applicable flags
int result = 0;
if (s1RSS.intersects(s2RSS)) {
result |= SINGLE_SCRIPT_CONFUSABLE;
} else {
result |= MIXED_SCRIPT_CONFUSABLE;
if (!s1RSS.isEmpty() && !s2RSS.isEmpty()) {
result |= WHOLE_SCRIPT_CONFUSABLE;
}
}
// Turn off flags that the user doesn't want
result &= fChecks;
return result;
} | [
"public",
"int",
"areConfusable",
"(",
"String",
"s1",
",",
"String",
"s2",
")",
"{",
"//",
"// See section 4 of UAX 39 for the algorithm for checking whether two strings are confusable,",
"// and for definitions of the types (single, whole, mixed-script) of confusables.",
"// We only care about a few of the check flags. Ignore the others.",
"// If no tests relevant to this function have been specified, signal an error.",
"// TODO: is this really the right thing to do? It's probably an error on",
"// the caller's part, but logically we would just return 0 (no error).",
"if",
"(",
"(",
"this",
".",
"fChecks",
"&",
"CONFUSABLE",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"No confusable checks are enabled.\"",
")",
";",
"}",
"// Compute the skeletons and check for confusability.",
"String",
"s1Skeleton",
"=",
"getSkeleton",
"(",
"s1",
")",
";",
"String",
"s2Skeleton",
"=",
"getSkeleton",
"(",
"s2",
")",
";",
"if",
"(",
"!",
"s1Skeleton",
".",
"equals",
"(",
"s2Skeleton",
")",
")",
"{",
"return",
"0",
";",
"}",
"// If we get here, the strings are confusable. Now we just need to set the flags for the appropriate classes",
"// of confusables according to UTS 39 section 4.",
"// Start by computing the resolved script sets of s1 and s2.",
"ScriptSet",
"s1RSS",
"=",
"new",
"ScriptSet",
"(",
")",
";",
"getResolvedScriptSet",
"(",
"s1",
",",
"s1RSS",
")",
";",
"ScriptSet",
"s2RSS",
"=",
"new",
"ScriptSet",
"(",
")",
";",
"getResolvedScriptSet",
"(",
"s2",
",",
"s2RSS",
")",
";",
"// Turn on all applicable flags",
"int",
"result",
"=",
"0",
";",
"if",
"(",
"s1RSS",
".",
"intersects",
"(",
"s2RSS",
")",
")",
"{",
"result",
"|=",
"SINGLE_SCRIPT_CONFUSABLE",
";",
"}",
"else",
"{",
"result",
"|=",
"MIXED_SCRIPT_CONFUSABLE",
";",
"if",
"(",
"!",
"s1RSS",
".",
"isEmpty",
"(",
")",
"&&",
"!",
"s2RSS",
".",
"isEmpty",
"(",
")",
")",
"{",
"result",
"|=",
"WHOLE_SCRIPT_CONFUSABLE",
";",
"}",
"}",
"// Turn off flags that the user doesn't want",
"result",
"&=",
"fChecks",
";",
"return",
"result",
";",
"}"
] | Check the whether two specified strings are visually confusable. The types of confusability to be tested - single
script, mixed script, or whole script - are determined by the check options set for the SpoofChecker.
The tests to be performed are controlled by the flags SINGLE_SCRIPT_CONFUSABLE MIXED_SCRIPT_CONFUSABLE
WHOLE_SCRIPT_CONFUSABLE At least one of these tests must be selected.
ANY_CASE is a modifier for the tests. Select it if the identifiers may be of mixed case. If identifiers are case
folded for comparison and display to the user, do not select the ANY_CASE option.
@param s1
The first of the two strings to be compared for confusability.
@param s2
The second of the two strings to be compared for confusability.
@return Non-zero if s1 and s1 are confusable. If not 0, the value will indicate the type(s) of confusability
found, as defined by spoof check test constants. | [
"Check",
"the",
"whether",
"two",
"specified",
"strings",
"are",
"visually",
"confusable",
".",
"The",
"types",
"of",
"confusability",
"to",
"be",
"tested",
"-",
"single",
"script",
"mixed",
"script",
"or",
"whole",
"script",
"-",
"are",
"determined",
"by",
"the",
"check",
"options",
"set",
"for",
"the",
"SpoofChecker",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SpoofChecker.java#L1344-L1387 |
hibernate/hibernate-ogm | infinispan-embedded/src/main/java/org/hibernate/ogm/datastore/infinispan/impl/InfinispanEmbeddedStoredProceduresManager.java | InfinispanEmbeddedStoredProceduresManager.callStoredProcedure | public ClosableIterator<Tuple> callStoredProcedure(EmbeddedCacheManager embeddedCacheManager, String storedProcedureName, ProcedureQueryParameters queryParameters, ClassLoaderService classLoaderService ) {
"""
Returns the result of a stored procedure executed on the backend.
@param embeddedCacheManager embedded cache manager
@param storedProcedureName name of stored procedure
@param queryParameters parameters passed for this query
@param classLoaderService the class loader service
@return a {@link ClosableIterator} with the result of the query
"""
validate( queryParameters );
Cache<String, String> cache = embeddedCacheManager.getCache( STORED_PROCEDURES_CACHE_NAME, true );
String className = cache.getOrDefault( storedProcedureName, storedProcedureName );
Callable<?> callable = instantiate( storedProcedureName, className, classLoaderService );
setParams( storedProcedureName, queryParameters, callable );
Object res = execute( storedProcedureName, embeddedCacheManager, callable );
return extractResultSet( storedProcedureName, res );
} | java | public ClosableIterator<Tuple> callStoredProcedure(EmbeddedCacheManager embeddedCacheManager, String storedProcedureName, ProcedureQueryParameters queryParameters, ClassLoaderService classLoaderService ) {
validate( queryParameters );
Cache<String, String> cache = embeddedCacheManager.getCache( STORED_PROCEDURES_CACHE_NAME, true );
String className = cache.getOrDefault( storedProcedureName, storedProcedureName );
Callable<?> callable = instantiate( storedProcedureName, className, classLoaderService );
setParams( storedProcedureName, queryParameters, callable );
Object res = execute( storedProcedureName, embeddedCacheManager, callable );
return extractResultSet( storedProcedureName, res );
} | [
"public",
"ClosableIterator",
"<",
"Tuple",
">",
"callStoredProcedure",
"(",
"EmbeddedCacheManager",
"embeddedCacheManager",
",",
"String",
"storedProcedureName",
",",
"ProcedureQueryParameters",
"queryParameters",
",",
"ClassLoaderService",
"classLoaderService",
")",
"{",
"validate",
"(",
"queryParameters",
")",
";",
"Cache",
"<",
"String",
",",
"String",
">",
"cache",
"=",
"embeddedCacheManager",
".",
"getCache",
"(",
"STORED_PROCEDURES_CACHE_NAME",
",",
"true",
")",
";",
"String",
"className",
"=",
"cache",
".",
"getOrDefault",
"(",
"storedProcedureName",
",",
"storedProcedureName",
")",
";",
"Callable",
"<",
"?",
">",
"callable",
"=",
"instantiate",
"(",
"storedProcedureName",
",",
"className",
",",
"classLoaderService",
")",
";",
"setParams",
"(",
"storedProcedureName",
",",
"queryParameters",
",",
"callable",
")",
";",
"Object",
"res",
"=",
"execute",
"(",
"storedProcedureName",
",",
"embeddedCacheManager",
",",
"callable",
")",
";",
"return",
"extractResultSet",
"(",
"storedProcedureName",
",",
"res",
")",
";",
"}"
] | Returns the result of a stored procedure executed on the backend.
@param embeddedCacheManager embedded cache manager
@param storedProcedureName name of stored procedure
@param queryParameters parameters passed for this query
@param classLoaderService the class loader service
@return a {@link ClosableIterator} with the result of the query | [
"Returns",
"the",
"result",
"of",
"a",
"stored",
"procedure",
"executed",
"on",
"the",
"backend",
"."
] | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/infinispan-embedded/src/main/java/org/hibernate/ogm/datastore/infinispan/impl/InfinispanEmbeddedStoredProceduresManager.java#L51-L59 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/memoize/StampedCommonCache.java | StampedCommonCache.doWithReadLock | private <R> R doWithReadLock(Action<K, V, R> action) {
"""
deal with the backed cache guarded by read lock
@param action the content to complete
"""
long stamp = sl.tryOptimisticRead();
R result = action.doWith(commonCache);
if (!sl.validate(stamp)) {
stamp = sl.readLock();
try {
result = action.doWith(commonCache);
} finally {
sl.unlockRead(stamp);
}
}
return result;
} | java | private <R> R doWithReadLock(Action<K, V, R> action) {
long stamp = sl.tryOptimisticRead();
R result = action.doWith(commonCache);
if (!sl.validate(stamp)) {
stamp = sl.readLock();
try {
result = action.doWith(commonCache);
} finally {
sl.unlockRead(stamp);
}
}
return result;
} | [
"private",
"<",
"R",
">",
"R",
"doWithReadLock",
"(",
"Action",
"<",
"K",
",",
"V",
",",
"R",
">",
"action",
")",
"{",
"long",
"stamp",
"=",
"sl",
".",
"tryOptimisticRead",
"(",
")",
";",
"R",
"result",
"=",
"action",
".",
"doWith",
"(",
"commonCache",
")",
";",
"if",
"(",
"!",
"sl",
".",
"validate",
"(",
"stamp",
")",
")",
"{",
"stamp",
"=",
"sl",
".",
"readLock",
"(",
")",
";",
"try",
"{",
"result",
"=",
"action",
".",
"doWith",
"(",
"commonCache",
")",
";",
"}",
"finally",
"{",
"sl",
".",
"unlockRead",
"(",
"stamp",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] | deal with the backed cache guarded by read lock
@param action the content to complete | [
"deal",
"with",
"the",
"backed",
"cache",
"guarded",
"by",
"read",
"lock"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/memoize/StampedCommonCache.java#L282-L296 |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/dam/markup/DamVideoMediaMarkupBuilder.java | DamVideoMediaMarkupBuilder.getVideoPlayerElement | protected Video getVideoPlayerElement(@NotNull Media media) {
"""
Build HTML5 video player element
@param media Media metadata
@return Media element
"""
Dimension dimension = MediaMarkupBuilderUtil.getMediaformatDimension(media);
Video video = new Video();
video.setWidth((int)dimension.getWidth());
video.setHeight((int)dimension.getHeight());
video.setControls(true);
// add video sources for each video profile
addSources(video, media);
// add flash player as fallback
video.addContent(getFlashPlayerElement(media, dimension));
return video;
} | java | protected Video getVideoPlayerElement(@NotNull Media media) {
Dimension dimension = MediaMarkupBuilderUtil.getMediaformatDimension(media);
Video video = new Video();
video.setWidth((int)dimension.getWidth());
video.setHeight((int)dimension.getHeight());
video.setControls(true);
// add video sources for each video profile
addSources(video, media);
// add flash player as fallback
video.addContent(getFlashPlayerElement(media, dimension));
return video;
} | [
"protected",
"Video",
"getVideoPlayerElement",
"(",
"@",
"NotNull",
"Media",
"media",
")",
"{",
"Dimension",
"dimension",
"=",
"MediaMarkupBuilderUtil",
".",
"getMediaformatDimension",
"(",
"media",
")",
";",
"Video",
"video",
"=",
"new",
"Video",
"(",
")",
";",
"video",
".",
"setWidth",
"(",
"(",
"int",
")",
"dimension",
".",
"getWidth",
"(",
")",
")",
";",
"video",
".",
"setHeight",
"(",
"(",
"int",
")",
"dimension",
".",
"getHeight",
"(",
")",
")",
";",
"video",
".",
"setControls",
"(",
"true",
")",
";",
"// add video sources for each video profile",
"addSources",
"(",
"video",
",",
"media",
")",
";",
"// add flash player as fallback",
"video",
".",
"addContent",
"(",
"getFlashPlayerElement",
"(",
"media",
",",
"dimension",
")",
")",
";",
"return",
"video",
";",
"}"
] | Build HTML5 video player element
@param media Media metadata
@return Media element | [
"Build",
"HTML5",
"video",
"player",
"element"
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/dam/markup/DamVideoMediaMarkupBuilder.java#L137-L152 |
bbottema/simple-java-mail | modules/core-module/src/main/java/org/simplejavamail/config/ConfigLoader.java | ConfigLoader.loadProperties | public static synchronized Map<Property, Object> loadProperties(final @Nullable InputStream inputStream, final boolean addProperties) {
"""
Loads properties from {@link InputStream}. Calling this method only has effect on new Email and Mailer instances after this.
@param inputStream Source of property key=value pairs separated by newline \n characters.
@param addProperties Flag to indicate if the new properties should be added or replacing the old properties.
@return The updated properties map that is used internally.
"""
final Properties prop = new Properties();
try {
prop.load(checkArgumentNotEmpty(inputStream, "InputStream was null"));
} catch (final IOException e) {
throw new IllegalStateException("error reading properties file from inputstream", e);
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (final IOException e) {
LOGGER.error(e.getMessage(), e);
}
}
}
if (!addProperties) {
RESOLVED_PROPERTIES.clear();
}
RESOLVED_PROPERTIES.putAll(readProperties(prop));
return unmodifiableMap(RESOLVED_PROPERTIES);
} | java | public static synchronized Map<Property, Object> loadProperties(final @Nullable InputStream inputStream, final boolean addProperties) {
final Properties prop = new Properties();
try {
prop.load(checkArgumentNotEmpty(inputStream, "InputStream was null"));
} catch (final IOException e) {
throw new IllegalStateException("error reading properties file from inputstream", e);
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (final IOException e) {
LOGGER.error(e.getMessage(), e);
}
}
}
if (!addProperties) {
RESOLVED_PROPERTIES.clear();
}
RESOLVED_PROPERTIES.putAll(readProperties(prop));
return unmodifiableMap(RESOLVED_PROPERTIES);
} | [
"public",
"static",
"synchronized",
"Map",
"<",
"Property",
",",
"Object",
">",
"loadProperties",
"(",
"final",
"@",
"Nullable",
"InputStream",
"inputStream",
",",
"final",
"boolean",
"addProperties",
")",
"{",
"final",
"Properties",
"prop",
"=",
"new",
"Properties",
"(",
")",
";",
"try",
"{",
"prop",
".",
"load",
"(",
"checkArgumentNotEmpty",
"(",
"inputStream",
",",
"\"InputStream was null\"",
")",
")",
";",
"}",
"catch",
"(",
"final",
"IOException",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"error reading properties file from inputstream\"",
",",
"e",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"inputStream",
"!=",
"null",
")",
"{",
"try",
"{",
"inputStream",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"IOException",
"e",
")",
"{",
"LOGGER",
".",
"error",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"}",
"}",
"if",
"(",
"!",
"addProperties",
")",
"{",
"RESOLVED_PROPERTIES",
".",
"clear",
"(",
")",
";",
"}",
"RESOLVED_PROPERTIES",
".",
"putAll",
"(",
"readProperties",
"(",
"prop",
")",
")",
";",
"return",
"unmodifiableMap",
"(",
"RESOLVED_PROPERTIES",
")",
";",
"}"
] | Loads properties from {@link InputStream}. Calling this method only has effect on new Email and Mailer instances after this.
@param inputStream Source of property key=value pairs separated by newline \n characters.
@param addProperties Flag to indicate if the new properties should be added or replacing the old properties.
@return The updated properties map that is used internally. | [
"Loads",
"properties",
"from",
"{",
"@link",
"InputStream",
"}",
".",
"Calling",
"this",
"method",
"only",
"has",
"effect",
"on",
"new",
"Email",
"and",
"Mailer",
"instances",
"after",
"this",
"."
] | train | https://github.com/bbottema/simple-java-mail/blob/b03635328aeecd525e35eddfef8f5b9a184559d8/modules/core-module/src/main/java/org/simplejavamail/config/ConfigLoader.java#L260-L282 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/util/BrokerHelper.java | BrokerHelper.getRealClassDescriptor | private ClassDescriptor getRealClassDescriptor(ClassDescriptor aCld, Object anObj) {
"""
Answer the real ClassDescriptor for anObj
ie. aCld may be an Interface of anObj, so the cld for anObj is returned
"""
ClassDescriptor result;
if(aCld.getClassOfObject() == ProxyHelper.getRealClass(anObj))
{
result = aCld;
}
else
{
result = aCld.getRepository().getDescriptorFor(anObj.getClass());
}
return result;
} | java | private ClassDescriptor getRealClassDescriptor(ClassDescriptor aCld, Object anObj)
{
ClassDescriptor result;
if(aCld.getClassOfObject() == ProxyHelper.getRealClass(anObj))
{
result = aCld;
}
else
{
result = aCld.getRepository().getDescriptorFor(anObj.getClass());
}
return result;
} | [
"private",
"ClassDescriptor",
"getRealClassDescriptor",
"(",
"ClassDescriptor",
"aCld",
",",
"Object",
"anObj",
")",
"{",
"ClassDescriptor",
"result",
";",
"if",
"(",
"aCld",
".",
"getClassOfObject",
"(",
")",
"==",
"ProxyHelper",
".",
"getRealClass",
"(",
"anObj",
")",
")",
"{",
"result",
"=",
"aCld",
";",
"}",
"else",
"{",
"result",
"=",
"aCld",
".",
"getRepository",
"(",
")",
".",
"getDescriptorFor",
"(",
"anObj",
".",
"getClass",
"(",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Answer the real ClassDescriptor for anObj
ie. aCld may be an Interface of anObj, so the cld for anObj is returned | [
"Answer",
"the",
"real",
"ClassDescriptor",
"for",
"anObj",
"ie",
".",
"aCld",
"may",
"be",
"an",
"Interface",
"of",
"anObj",
"so",
"the",
"cld",
"for",
"anObj",
"is",
"returned"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/BrokerHelper.java#L141-L155 |
Nexmo/nexmo-java | src/main/java/com/nexmo/client/insight/InsightClient.java | InsightClient.getStandardNumberInsight | @Deprecated
public StandardInsightResponse getStandardNumberInsight(String number, String country, boolean cnam) throws IOException, NexmoClientException {
"""
Perform a Standard Insight Request with a number, country, and cnam.
@param number A single phone number that you need insight about in national or international format.
@param country If a number does not have a country code or it is uncertain, set the two-character country code.
@param cnam Indicates if the name of the person who owns the phone number should also be looked up and returned.
Set to true to receive phone number owner name in the response. This is only available for US numbers
and incurs an additional charge.
@return A {@link StandardInsightResponse} representing the response from the Nexmo Number Insight API.
@throws IOException if a network error occurred contacting the Nexmo Nexmo Number Insight API.
@throws NexmoClientException if there was a problem with the Nexmo request or response objects.
@deprecated Create a {@link StandardInsightRequest} and use {@link InsightClient#getStandardNumberInsight(StandardInsightRequest)}
"""
return getStandardNumberInsight(StandardInsightRequest.builder(number).country(country).cnam(cnam).build());
} | java | @Deprecated
public StandardInsightResponse getStandardNumberInsight(String number, String country, boolean cnam) throws IOException, NexmoClientException {
return getStandardNumberInsight(StandardInsightRequest.builder(number).country(country).cnam(cnam).build());
} | [
"@",
"Deprecated",
"public",
"StandardInsightResponse",
"getStandardNumberInsight",
"(",
"String",
"number",
",",
"String",
"country",
",",
"boolean",
"cnam",
")",
"throws",
"IOException",
",",
"NexmoClientException",
"{",
"return",
"getStandardNumberInsight",
"(",
"StandardInsightRequest",
".",
"builder",
"(",
"number",
")",
".",
"country",
"(",
"country",
")",
".",
"cnam",
"(",
"cnam",
")",
".",
"build",
"(",
")",
")",
";",
"}"
] | Perform a Standard Insight Request with a number, country, and cnam.
@param number A single phone number that you need insight about in national or international format.
@param country If a number does not have a country code or it is uncertain, set the two-character country code.
@param cnam Indicates if the name of the person who owns the phone number should also be looked up and returned.
Set to true to receive phone number owner name in the response. This is only available for US numbers
and incurs an additional charge.
@return A {@link StandardInsightResponse} representing the response from the Nexmo Number Insight API.
@throws IOException if a network error occurred contacting the Nexmo Nexmo Number Insight API.
@throws NexmoClientException if there was a problem with the Nexmo request or response objects.
@deprecated Create a {@link StandardInsightRequest} and use {@link InsightClient#getStandardNumberInsight(StandardInsightRequest)} | [
"Perform",
"a",
"Standard",
"Insight",
"Request",
"with",
"a",
"number",
"country",
"and",
"cnam",
"."
] | train | https://github.com/Nexmo/nexmo-java/blob/7427eff6d6baa5a5bd9197fa096bcf2564191cf5/src/main/java/com/nexmo/client/insight/InsightClient.java#L140-L143 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/libs/modules/ModelsEngine.java | ModelsEngine.scalarProduct | public static double scalarProduct( double[] a, double[] b ) {
"""
Compute the dot product.
@param a
is a vector.
@param b
is a vector.
@return the dot product of a and b.
"""
double c = 0;
for( int i = 0; i < a.length; i++ ) {
c = c + a[i] * b[i];
}
return c;
} | java | public static double scalarProduct( double[] a, double[] b ) {
double c = 0;
for( int i = 0; i < a.length; i++ ) {
c = c + a[i] * b[i];
}
return c;
} | [
"public",
"static",
"double",
"scalarProduct",
"(",
"double",
"[",
"]",
"a",
",",
"double",
"[",
"]",
"b",
")",
"{",
"double",
"c",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"a",
".",
"length",
";",
"i",
"++",
")",
"{",
"c",
"=",
"c",
"+",
"a",
"[",
"i",
"]",
"*",
"b",
"[",
"i",
"]",
";",
"}",
"return",
"c",
";",
"}"
] | Compute the dot product.
@param a
is a vector.
@param b
is a vector.
@return the dot product of a and b. | [
"Compute",
"the",
"dot",
"product",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/libs/modules/ModelsEngine.java#L1229-L1235 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java | QueryReferenceBroker.getFKQuery1toN | private QueryByCriteria getFKQuery1toN(Object obj, ClassDescriptor cld, CollectionDescriptor cod) {
"""
Get Foreign key query for 1:n
@return org.apache.ojb.broker.query.QueryByCriteria
@param obj
@param cld
@param cod
"""
ValueContainer[] container = pb.serviceBrokerHelper().getKeyValues(cld, obj);
ClassDescriptor refCld = pb.getClassDescriptor(cod.getItemClass());
FieldDescriptor[] fields = cod.getForeignKeyFieldDescriptors(refCld);
Criteria criteria = new Criteria();
for (int i = 0; i < fields.length; i++)
{
FieldDescriptor fld = fields[i];
criteria.addEqualTo(fld.getAttributeName(), container[i].getValue());
}
return QueryFactory.newQuery(refCld.getClassOfObject(), criteria);
} | java | private QueryByCriteria getFKQuery1toN(Object obj, ClassDescriptor cld, CollectionDescriptor cod)
{
ValueContainer[] container = pb.serviceBrokerHelper().getKeyValues(cld, obj);
ClassDescriptor refCld = pb.getClassDescriptor(cod.getItemClass());
FieldDescriptor[] fields = cod.getForeignKeyFieldDescriptors(refCld);
Criteria criteria = new Criteria();
for (int i = 0; i < fields.length; i++)
{
FieldDescriptor fld = fields[i];
criteria.addEqualTo(fld.getAttributeName(), container[i].getValue());
}
return QueryFactory.newQuery(refCld.getClassOfObject(), criteria);
} | [
"private",
"QueryByCriteria",
"getFKQuery1toN",
"(",
"Object",
"obj",
",",
"ClassDescriptor",
"cld",
",",
"CollectionDescriptor",
"cod",
")",
"{",
"ValueContainer",
"[",
"]",
"container",
"=",
"pb",
".",
"serviceBrokerHelper",
"(",
")",
".",
"getKeyValues",
"(",
"cld",
",",
"obj",
")",
";",
"ClassDescriptor",
"refCld",
"=",
"pb",
".",
"getClassDescriptor",
"(",
"cod",
".",
"getItemClass",
"(",
")",
")",
";",
"FieldDescriptor",
"[",
"]",
"fields",
"=",
"cod",
".",
"getForeignKeyFieldDescriptors",
"(",
"refCld",
")",
";",
"Criteria",
"criteria",
"=",
"new",
"Criteria",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"fields",
".",
"length",
";",
"i",
"++",
")",
"{",
"FieldDescriptor",
"fld",
"=",
"fields",
"[",
"i",
"]",
";",
"criteria",
".",
"addEqualTo",
"(",
"fld",
".",
"getAttributeName",
"(",
")",
",",
"container",
"[",
"i",
"]",
".",
"getValue",
"(",
")",
")",
";",
"}",
"return",
"QueryFactory",
".",
"newQuery",
"(",
"refCld",
".",
"getClassOfObject",
"(",
")",
",",
"criteria",
")",
";",
"}"
] | Get Foreign key query for 1:n
@return org.apache.ojb.broker.query.QueryByCriteria
@param obj
@param cld
@param cod | [
"Get",
"Foreign",
"key",
"query",
"for",
"1",
":",
"n"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java#L893-L907 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.