repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
broadinstitute/barclay | src/main/java/org/broadinstitute/barclay/help/HelpDoclet.java | HelpDoclet.emitOutputFromTemplates | private void emitOutputFromTemplates (
final List<Map<String, String>> groupMaps,
final List<Map<String, String>> featureMaps)
{
try {
/* ------------------------------------------------------------------- */
/* You should do this ONLY ONCE in the whole application life-cycle: */
final Configuration cfg = new Configuration(Configuration.VERSION_2_3_23);
cfg.setObjectWrapper(new DefaultObjectWrapper(Configuration.VERSION_2_3_23));
// We need to set up a scheme to load our settings from wherever they may live.
// This means we need to set up a multi-loader including the classpath and any specified options:
TemplateLoader templateLoader;
// Only add the settings directory if we're supposed to:
if ( useDefaultTemplates ) {
templateLoader = new ClassTemplateLoader(getClass(), DEFAULT_SETTINGS_CLASSPATH);
}
else {
templateLoader = new FileTemplateLoader(new File(settingsDir.getPath()));
}
// Tell freemarker to load our templates as we specified above:
cfg.setTemplateLoader(templateLoader);
// Generate one template file for each work unit
workUnits.stream().forEach(workUnit -> processWorkUnitTemplate(cfg, workUnit, groupMaps, featureMaps));
processIndexTemplate(cfg, new ArrayList<>(workUnits), groupMaps);
} catch (FileNotFoundException e) {
throw new RuntimeException("FileNotFoundException processing javadoc template", e);
} catch (IOException e) {
throw new RuntimeException("IOException processing javadoc template", e);
}
} | java | private void emitOutputFromTemplates (
final List<Map<String, String>> groupMaps,
final List<Map<String, String>> featureMaps)
{
try {
/* ------------------------------------------------------------------- */
/* You should do this ONLY ONCE in the whole application life-cycle: */
final Configuration cfg = new Configuration(Configuration.VERSION_2_3_23);
cfg.setObjectWrapper(new DefaultObjectWrapper(Configuration.VERSION_2_3_23));
// We need to set up a scheme to load our settings from wherever they may live.
// This means we need to set up a multi-loader including the classpath and any specified options:
TemplateLoader templateLoader;
// Only add the settings directory if we're supposed to:
if ( useDefaultTemplates ) {
templateLoader = new ClassTemplateLoader(getClass(), DEFAULT_SETTINGS_CLASSPATH);
}
else {
templateLoader = new FileTemplateLoader(new File(settingsDir.getPath()));
}
// Tell freemarker to load our templates as we specified above:
cfg.setTemplateLoader(templateLoader);
// Generate one template file for each work unit
workUnits.stream().forEach(workUnit -> processWorkUnitTemplate(cfg, workUnit, groupMaps, featureMaps));
processIndexTemplate(cfg, new ArrayList<>(workUnits), groupMaps);
} catch (FileNotFoundException e) {
throw new RuntimeException("FileNotFoundException processing javadoc template", e);
} catch (IOException e) {
throw new RuntimeException("IOException processing javadoc template", e);
}
} | [
"private",
"void",
"emitOutputFromTemplates",
"(",
"final",
"List",
"<",
"Map",
"<",
"String",
",",
"String",
">",
">",
"groupMaps",
",",
"final",
"List",
"<",
"Map",
"<",
"String",
",",
"String",
">",
">",
"featureMaps",
")",
"{",
"try",
"{",
"/* ------... | Actually write out the output files (html and gson file for each feature) and the index file. | [
"Actually",
"write",
"out",
"the",
"output",
"files",
"(",
"html",
"and",
"gson",
"file",
"for",
"each",
"feature",
")",
"and",
"the",
"index",
"file",
"."
] | train | https://github.com/broadinstitute/barclay/blob/7e56d725766b0da3baff23e79a31c3d01c3589c2/src/main/java/org/broadinstitute/barclay/help/HelpDoclet.java#L369-L404 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/OutputProperties.java | OutputProperties.copyFrom | public void copyFrom(Properties src, boolean shouldResetDefaults)
{
Enumeration keys = src.keys();
while (keys.hasMoreElements())
{
String key = (String) keys.nextElement();
if (!isLegalPropertyKey(key))
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, new Object[]{key})); //"output property not recognized: "
Object oldValue = m_properties.get(key);
if (null == oldValue)
{
String val = (String) src.get(key);
if(shouldResetDefaults && key.equals(OutputKeys.METHOD))
{
setMethodDefaults(val);
}
m_properties.put(key, val);
}
else if (key.equals(OutputKeys.CDATA_SECTION_ELEMENTS))
{
m_properties.put(key, (String) oldValue + " " + (String) src.get(key));
}
}
} | java | public void copyFrom(Properties src, boolean shouldResetDefaults)
{
Enumeration keys = src.keys();
while (keys.hasMoreElements())
{
String key = (String) keys.nextElement();
if (!isLegalPropertyKey(key))
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, new Object[]{key})); //"output property not recognized: "
Object oldValue = m_properties.get(key);
if (null == oldValue)
{
String val = (String) src.get(key);
if(shouldResetDefaults && key.equals(OutputKeys.METHOD))
{
setMethodDefaults(val);
}
m_properties.put(key, val);
}
else if (key.equals(OutputKeys.CDATA_SECTION_ELEMENTS))
{
m_properties.put(key, (String) oldValue + " " + (String) src.get(key));
}
}
} | [
"public",
"void",
"copyFrom",
"(",
"Properties",
"src",
",",
"boolean",
"shouldResetDefaults",
")",
"{",
"Enumeration",
"keys",
"=",
"src",
".",
"keys",
"(",
")",
";",
"while",
"(",
"keys",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"String",
"key",
"="... | Copy the keys and values from the source to this object. This will
not copy the default values. This is meant to be used by going from
a higher precedence object to a lower precedence object, so that if a
key already exists, this method will not reset it.
@param src non-null reference to the source properties.
@param shouldResetDefaults true if the defaults should be reset based on
the method property. | [
"Copy",
"the",
"keys",
"and",
"values",
"from",
"the",
"source",
"to",
"this",
"object",
".",
"This",
"will",
"not",
"copy",
"the",
"default",
"values",
".",
"This",
"is",
"meant",
"to",
"be",
"used",
"by",
"going",
"from",
"a",
"higher",
"precedence",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/OutputProperties.java#L592-L621 |
igniterealtime/REST-API-Client | src/main/java/org/igniterealtime/restclient/RestApiClient.java | RestApiClient.deleteAdmin | public Response deleteAdmin(String roomName, String jid) {
return restClient.delete("chatrooms/" + roomName + "/admins/" + jid,
new HashMap<String, String>());
} | java | public Response deleteAdmin(String roomName, String jid) {
return restClient.delete("chatrooms/" + roomName + "/admins/" + jid,
new HashMap<String, String>());
} | [
"public",
"Response",
"deleteAdmin",
"(",
"String",
"roomName",
",",
"String",
"jid",
")",
"{",
"return",
"restClient",
".",
"delete",
"(",
"\"chatrooms/\"",
"+",
"roomName",
"+",
"\"/admins/\"",
"+",
"jid",
",",
"new",
"HashMap",
"<",
"String",
",",
"String... | Delete admin from chatroom.
@param roomName
the room name
@param jid
the jid
@return the response | [
"Delete",
"admin",
"from",
"chatroom",
"."
] | train | https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L288-L291 |
Azure/azure-sdk-for-java | redis/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/redis/v2018_03_01/implementation/PatchSchedulesInner.java | PatchSchedulesInner.getAsync | public Observable<RedisPatchScheduleInner> getAsync(String resourceGroupName, String name) {
return getWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<RedisPatchScheduleInner>, RedisPatchScheduleInner>() {
@Override
public RedisPatchScheduleInner call(ServiceResponse<RedisPatchScheduleInner> response) {
return response.body();
}
});
} | java | public Observable<RedisPatchScheduleInner> getAsync(String resourceGroupName, String name) {
return getWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<RedisPatchScheduleInner>, RedisPatchScheduleInner>() {
@Override
public RedisPatchScheduleInner call(ServiceResponse<RedisPatchScheduleInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RedisPatchScheduleInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
")",
".",
"map",
"(",
"new",
"Func1",
"<",... | Gets the patching schedule of a redis cache (requires Premium SKU).
@param resourceGroupName The name of the resource group.
@param name The name of the redis cache.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RedisPatchScheduleInner object | [
"Gets",
"the",
"patching",
"schedule",
"of",
"a",
"redis",
"cache",
"(",
"requires",
"Premium",
"SKU",
")",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/redis/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/redis/v2018_03_01/implementation/PatchSchedulesInner.java#L431-L438 |
JoeKerouac/utils | src/main/java/com/joe/utils/reflect/BeanUtils.java | BeanUtils.getName | private static String getName(JsonProperty jsonProperty, XmlNode xmlNode, Field field) {
String name;
if (jsonProperty != null) {
name = jsonProperty.value();
} else if (xmlNode != null) {
name = xmlNode.name();
} else {
name = field.getName();
}
return name;
} | java | private static String getName(JsonProperty jsonProperty, XmlNode xmlNode, Field field) {
String name;
if (jsonProperty != null) {
name = jsonProperty.value();
} else if (xmlNode != null) {
name = xmlNode.name();
} else {
name = field.getName();
}
return name;
} | [
"private",
"static",
"String",
"getName",
"(",
"JsonProperty",
"jsonProperty",
",",
"XmlNode",
"xmlNode",
",",
"Field",
"field",
")",
"{",
"String",
"name",
";",
"if",
"(",
"jsonProperty",
"!=",
"null",
")",
"{",
"name",
"=",
"jsonProperty",
".",
"value",
... | 从注解获取字段名字,优先使用{@link JsonProperty JsonProperty}
@param jsonProperty json注解
@param xmlNode xml注解
@param field 字段
@return 字段名 | [
"从注解获取字段名字,优先使用",
"{",
"@link",
"JsonProperty",
"JsonProperty",
"}"
] | train | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/reflect/BeanUtils.java#L380-L390 |
auth0/auth0-spring-security-api | lib/src/main/java/com/auth0/spring/security/api/JwtWebSecurityConfigurer.java | JwtWebSecurityConfigurer.forHS256WithBase64Secret | @SuppressWarnings({"WeakerAccess", "SameParameterValue"})
public static JwtWebSecurityConfigurer forHS256WithBase64Secret(String audience, String issuer, String secret) {
final byte[] secretBytes = new Base64(true).decode(secret);
return new JwtWebSecurityConfigurer(audience, issuer, new JwtAuthenticationProvider(secretBytes, issuer, audience));
} | java | @SuppressWarnings({"WeakerAccess", "SameParameterValue"})
public static JwtWebSecurityConfigurer forHS256WithBase64Secret(String audience, String issuer, String secret) {
final byte[] secretBytes = new Base64(true).decode(secret);
return new JwtWebSecurityConfigurer(audience, issuer, new JwtAuthenticationProvider(secretBytes, issuer, audience));
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"WeakerAccess\"",
",",
"\"SameParameterValue\"",
"}",
")",
"public",
"static",
"JwtWebSecurityConfigurer",
"forHS256WithBase64Secret",
"(",
"String",
"audience",
",",
"String",
"issuer",
",",
"String",
"secret",
")",
"{",
"final",
... | Configures application authorization for JWT signed with HS256
@param audience identifier of the API and must match the {@code aud} value in the token
@param issuer of the token for this API and must match the {@code iss} value in the token
@param secret used to sign and verify tokens encoded in Base64
@return JwtWebSecurityConfigurer for further configuration | [
"Configures",
"application",
"authorization",
"for",
"JWT",
"signed",
"with",
"HS256"
] | train | https://github.com/auth0/auth0-spring-security-api/blob/cebd4daa0125efd4da9e651cf29aa5ebdb147e2b/lib/src/main/java/com/auth0/spring/security/api/JwtWebSecurityConfigurer.java#L60-L64 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java | ArrayFunctions.arrayRemove | public static Expression arrayRemove(Expression expression, Expression value) {
return x("ARRAY_REMOVE(" + expression.toString() + ", " + value.toString() + ")");
} | java | public static Expression arrayRemove(Expression expression, Expression value) {
return x("ARRAY_REMOVE(" + expression.toString() + ", " + value.toString() + ")");
} | [
"public",
"static",
"Expression",
"arrayRemove",
"(",
"Expression",
"expression",
",",
"Expression",
"value",
")",
"{",
"return",
"x",
"(",
"\"ARRAY_REMOVE(\"",
"+",
"expression",
".",
"toString",
"(",
")",
"+",
"\", \"",
"+",
"value",
".",
"toString",
"(",
... | Returned expression results in new array with all occurrences of value removed. | [
"Returned",
"expression",
"results",
"in",
"new",
"array",
"with",
"all",
"occurrences",
"of",
"value",
"removed",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java#L344-L346 |
betfair/cougar | cougar-codegen-plugin/src/main/java/com/betfair/cougar/codegen/IdlToDSMojo.java | IdlToDSMojo.generateJavaCode | private void generateJavaCode(Service service, Document iddDoc) throws Exception {
IDLReader reader = new IDLReader();
Document extensionDoc = parseExtensionFile(service.getServiceName());
String packageName = derivePackageName(service, iddDoc);
reader.init(iddDoc, extensionDoc, service.getServiceName(), packageName, getBaseDir(),
generatedSourceDir, getLog(), service.getOutputDir(), isClient(), isServer());
runMerge(reader);
// also create the stripped down, combined version of the IDD doc
getLog().debug("Generating combined IDD sans comments...");
Document combinedIDDDoc = parseIddFromString(reader.serialize());
// WARNING: this absolutely has to be run after a call to reader.runMerge (called by runMerge above) as otherwise the version will be null...
generateExposedIDD(combinedIDDDoc, reader.getInterfaceName(), reader.getInterfaceMajorMinorVersion());
// generate WSDL/XSD
getLog().debug("Generating wsdl...");
generateWsdl(iddDoc, reader.getInterfaceName(), reader.getInterfaceMajorMinorVersion());
getLog().debug("Generating xsd...");
generateXsd(iddDoc, reader.getInterfaceName(), reader.getInterfaceMajorMinorVersion());
} | java | private void generateJavaCode(Service service, Document iddDoc) throws Exception {
IDLReader reader = new IDLReader();
Document extensionDoc = parseExtensionFile(service.getServiceName());
String packageName = derivePackageName(service, iddDoc);
reader.init(iddDoc, extensionDoc, service.getServiceName(), packageName, getBaseDir(),
generatedSourceDir, getLog(), service.getOutputDir(), isClient(), isServer());
runMerge(reader);
// also create the stripped down, combined version of the IDD doc
getLog().debug("Generating combined IDD sans comments...");
Document combinedIDDDoc = parseIddFromString(reader.serialize());
// WARNING: this absolutely has to be run after a call to reader.runMerge (called by runMerge above) as otherwise the version will be null...
generateExposedIDD(combinedIDDDoc, reader.getInterfaceName(), reader.getInterfaceMajorMinorVersion());
// generate WSDL/XSD
getLog().debug("Generating wsdl...");
generateWsdl(iddDoc, reader.getInterfaceName(), reader.getInterfaceMajorMinorVersion());
getLog().debug("Generating xsd...");
generateXsd(iddDoc, reader.getInterfaceName(), reader.getInterfaceMajorMinorVersion());
} | [
"private",
"void",
"generateJavaCode",
"(",
"Service",
"service",
",",
"Document",
"iddDoc",
")",
"throws",
"Exception",
"{",
"IDLReader",
"reader",
"=",
"new",
"IDLReader",
"(",
")",
";",
"Document",
"extensionDoc",
"=",
"parseExtensionFile",
"(",
"service",
".... | The original concept of the IDLReader (other devs) has gone away a bit, so there could be
some refactoring around this. | [
"The",
"original",
"concept",
"of",
"the",
"IDLReader",
"(",
"other",
"devs",
")",
"has",
"gone",
"away",
"a",
"bit",
"so",
"there",
"could",
"be",
"some",
"refactoring",
"around",
"this",
"."
] | train | https://github.com/betfair/cougar/blob/08d1fe338fbd0e8572a9c2305bb5796402d5b1f5/cougar-codegen-plugin/src/main/java/com/betfair/cougar/codegen/IdlToDSMojo.java#L445-L469 |
phax/ph-web | ph-servlet/src/main/java/com/helger/servlet/response/UnifiedResponseDefaultSettings.java | UnifiedResponseDefaultSettings.setResponseHeader | public static void setResponseHeader (@Nonnull @Nonempty final String sName, @Nonnull @Nonempty final String sValue)
{
ValueEnforcer.notEmpty (sName, "Name");
ValueEnforcer.notEmpty (sValue, "Value");
s_aRWLock.writeLocked ( () -> s_aResponseHeaderMap.setHeader (sName, sValue));
} | java | public static void setResponseHeader (@Nonnull @Nonempty final String sName, @Nonnull @Nonempty final String sValue)
{
ValueEnforcer.notEmpty (sName, "Name");
ValueEnforcer.notEmpty (sValue, "Value");
s_aRWLock.writeLocked ( () -> s_aResponseHeaderMap.setHeader (sName, sValue));
} | [
"public",
"static",
"void",
"setResponseHeader",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sName",
",",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sValue",
")",
"{",
"ValueEnforcer",
".",
"notEmpty",
"(",
"sName",
",",
"\"Name\"",
"... | Sets a response header to the response according to the passed name and
value. An existing header entry with the same name is overridden.
@param sName
Name of the header. May neither be <code>null</code> nor empty.
@param sValue
Value of the header. May neither be <code>null</code> nor empty. | [
"Sets",
"a",
"response",
"header",
"to",
"the",
"response",
"according",
"to",
"the",
"passed",
"name",
"and",
"value",
".",
"An",
"existing",
"header",
"entry",
"with",
"the",
"same",
"name",
"is",
"overridden",
"."
] | train | https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-servlet/src/main/java/com/helger/servlet/response/UnifiedResponseDefaultSettings.java#L217-L224 |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/RepositoryApplicationConfiguration.java | RepositoryApplicationConfiguration.controllerManagement | @Bean
@ConditionalOnMissingBean
ControllerManagement controllerManagement(final ScheduledExecutorService executorService,
final RepositoryProperties repositoryProperties) {
return new JpaControllerManagement(executorService, repositoryProperties);
} | java | @Bean
@ConditionalOnMissingBean
ControllerManagement controllerManagement(final ScheduledExecutorService executorService,
final RepositoryProperties repositoryProperties) {
return new JpaControllerManagement(executorService, repositoryProperties);
} | [
"@",
"Bean",
"@",
"ConditionalOnMissingBean",
"ControllerManagement",
"controllerManagement",
"(",
"final",
"ScheduledExecutorService",
"executorService",
",",
"final",
"RepositoryProperties",
"repositoryProperties",
")",
"{",
"return",
"new",
"JpaControllerManagement",
"(",
... | {@link JpaControllerManagement} bean.
@return a new {@link ControllerManagement} | [
"{",
"@link",
"JpaControllerManagement",
"}",
"bean",
"."
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/RepositoryApplicationConfiguration.java#L690-L695 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/sjavac/JavacState.java | JavacState.taintPackagesDependingOnChangedPackages | public void taintPackagesDependingOnChangedPackages(Set<String> pkgs, Set<String> recentlyCompiled) {
for (Package pkg : prev.packages().values()) {
for (String dep : pkg.dependencies()) {
if (pkgs.contains(dep) && !recentlyCompiled.contains(pkg.name())) {
taintPackage(pkg.name(), " its depending on "+dep);
}
}
}
} | java | public void taintPackagesDependingOnChangedPackages(Set<String> pkgs, Set<String> recentlyCompiled) {
for (Package pkg : prev.packages().values()) {
for (String dep : pkg.dependencies()) {
if (pkgs.contains(dep) && !recentlyCompiled.contains(pkg.name())) {
taintPackage(pkg.name(), " its depending on "+dep);
}
}
}
} | [
"public",
"void",
"taintPackagesDependingOnChangedPackages",
"(",
"Set",
"<",
"String",
">",
"pkgs",
",",
"Set",
"<",
"String",
">",
"recentlyCompiled",
")",
"{",
"for",
"(",
"Package",
"pkg",
":",
"prev",
".",
"packages",
"(",
")",
".",
"values",
"(",
")"... | Propagate recompilation through the dependency chains.
Avoid re-tainting packages that have already been compiled. | [
"Propagate",
"recompilation",
"through",
"the",
"dependency",
"chains",
".",
"Avoid",
"re",
"-",
"tainting",
"packages",
"that",
"have",
"already",
"been",
"compiled",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/JavacState.java#L497-L505 |
JodaOrg/joda-beans | src/main/java/org/joda/beans/impl/direct/DirectMetaBean.java | DirectMetaBean.propertySet | protected void propertySet(Bean bean, String propertyName, Object value, boolean quiet) {
// used to enable 100% test coverage in beans
if (quiet) {
return;
}
throw new NoSuchElementException("Unknown property: " + propertyName);
} | java | protected void propertySet(Bean bean, String propertyName, Object value, boolean quiet) {
// used to enable 100% test coverage in beans
if (quiet) {
return;
}
throw new NoSuchElementException("Unknown property: " + propertyName);
} | [
"protected",
"void",
"propertySet",
"(",
"Bean",
"bean",
",",
"String",
"propertyName",
",",
"Object",
"value",
",",
"boolean",
"quiet",
")",
"{",
"// used to enable 100% test coverage in beans",
"if",
"(",
"quiet",
")",
"{",
"return",
";",
"}",
"throw",
"new",
... | Sets the value of the property.
@param bean the bean to update, not null
@param propertyName the property name, not null
@param value the value of the property, may be null
@param quiet true to take no action if unable to write
@throws NoSuchElementException if the property name is invalid | [
"Sets",
"the",
"value",
"of",
"the",
"property",
"."
] | train | https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/impl/direct/DirectMetaBean.java#L100-L106 |
Viascom/groundwork | foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/header/FoxHttpHeader.java | FoxHttpHeader.addHeader | public void addHeader(HeaderTypes name, String value) {
headerEntries.add(new HeaderEntry(name.toString(), value));
} | java | public void addHeader(HeaderTypes name, String value) {
headerEntries.add(new HeaderEntry(name.toString(), value));
} | [
"public",
"void",
"addHeader",
"(",
"HeaderTypes",
"name",
",",
"String",
"value",
")",
"{",
"headerEntries",
".",
"add",
"(",
"new",
"HeaderEntry",
"(",
"name",
".",
"toString",
"(",
")",
",",
"value",
")",
")",
";",
"}"
] | Add a new header entry
@param name name of the header entry
@param value value of the header entry | [
"Add",
"a",
"new",
"header",
"entry"
] | train | https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/header/FoxHttpHeader.java#L42-L44 |
TheHortonMachine/hortonmachine | gui/src/main/java/org/hortonmachine/gui/spatialtoolbox/core/AnnotationUtilities.java | AnnotationUtilities.getLocalizedDescription | public static String getLocalizedDescription( Description description ) throws Exception {
// try to get the language
Class< ? > annotationclass = Description.class;
return getLocalizedString(description, annotationclass);
} | java | public static String getLocalizedDescription( Description description ) throws Exception {
// try to get the language
Class< ? > annotationclass = Description.class;
return getLocalizedString(description, annotationclass);
} | [
"public",
"static",
"String",
"getLocalizedDescription",
"(",
"Description",
"description",
")",
"throws",
"Exception",
"{",
"// try to get the language",
"Class",
"<",
"?",
">",
"annotationclass",
"=",
"Description",
".",
"class",
";",
"return",
"getLocalizedString",
... | Gets the localized description of the {@link Description}.
@param description the {@link Description} annotation.
@return the description string or " - ".
@throws Exception | [
"Gets",
"the",
"localized",
"description",
"of",
"the",
"{",
"@link",
"Description",
"}",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gui/src/main/java/org/hortonmachine/gui/spatialtoolbox/core/AnnotationUtilities.java#L48-L52 |
amaembo/streamex | src/main/java/one/util/streamex/DoubleStreamEx.java | DoubleStreamEx.mapFirst | public DoubleStreamEx mapFirst(DoubleUnaryOperator mapper) {
return delegate(new PairSpliterator.PSOfDouble((a, b) -> b, mapper, spliterator(),
PairSpliterator.MODE_MAP_FIRST));
} | java | public DoubleStreamEx mapFirst(DoubleUnaryOperator mapper) {
return delegate(new PairSpliterator.PSOfDouble((a, b) -> b, mapper, spliterator(),
PairSpliterator.MODE_MAP_FIRST));
} | [
"public",
"DoubleStreamEx",
"mapFirst",
"(",
"DoubleUnaryOperator",
"mapper",
")",
"{",
"return",
"delegate",
"(",
"new",
"PairSpliterator",
".",
"PSOfDouble",
"(",
"(",
"a",
",",
"b",
")",
"->",
"b",
",",
"mapper",
",",
"spliterator",
"(",
")",
",",
"Pair... | Returns a stream where the first element is the replaced with the result
of applying the given function while the other elements are left intact.
<p>
This is a <a href="package-summary.html#StreamOps">quasi-intermediate
operation</a>.
@param mapper a
<a href="package-summary.html#NonInterference">non-interfering
</a>, <a href="package-summary.html#Statelessness">stateless</a>
function to apply to the first element
@return the new stream
@since 0.4.1 | [
"Returns",
"a",
"stream",
"where",
"the",
"first",
"element",
"is",
"the",
"replaced",
"with",
"the",
"result",
"of",
"applying",
"the",
"given",
"function",
"while",
"the",
"other",
"elements",
"are",
"left",
"intact",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/DoubleStreamEx.java#L166-L169 |
apache/incubator-druid | server/src/main/java/org/apache/druid/server/coordinator/CostBalancerStrategy.java | CostBalancerStrategy.computeJointSegmentsCost | public static double computeJointSegmentsCost(final DataSegment segmentA, final DataSegment segmentB)
{
final Interval intervalA = segmentA.getInterval();
final Interval intervalB = segmentB.getInterval();
final double t0 = intervalA.getStartMillis();
final double t1 = (intervalA.getEndMillis() - t0) / MILLIS_FACTOR;
final double start = (intervalB.getStartMillis() - t0) / MILLIS_FACTOR;
final double end = (intervalB.getEndMillis() - t0) / MILLIS_FACTOR;
// constant cost-multiplier for segments of the same datsource
final double multiplier = segmentA.getDataSource().equals(segmentB.getDataSource()) ? 2.0 : 1.0;
return INV_LAMBDA_SQUARE * intervalCost(t1, start, end) * multiplier;
} | java | public static double computeJointSegmentsCost(final DataSegment segmentA, final DataSegment segmentB)
{
final Interval intervalA = segmentA.getInterval();
final Interval intervalB = segmentB.getInterval();
final double t0 = intervalA.getStartMillis();
final double t1 = (intervalA.getEndMillis() - t0) / MILLIS_FACTOR;
final double start = (intervalB.getStartMillis() - t0) / MILLIS_FACTOR;
final double end = (intervalB.getEndMillis() - t0) / MILLIS_FACTOR;
// constant cost-multiplier for segments of the same datsource
final double multiplier = segmentA.getDataSource().equals(segmentB.getDataSource()) ? 2.0 : 1.0;
return INV_LAMBDA_SQUARE * intervalCost(t1, start, end) * multiplier;
} | [
"public",
"static",
"double",
"computeJointSegmentsCost",
"(",
"final",
"DataSegment",
"segmentA",
",",
"final",
"DataSegment",
"segmentB",
")",
"{",
"final",
"Interval",
"intervalA",
"=",
"segmentA",
".",
"getInterval",
"(",
")",
";",
"final",
"Interval",
"interv... | This defines the unnormalized cost function between two segments.
See https://github.com/apache/incubator-druid/pull/2972 for more details about the cost function.
intervalCost: segments close together are more likely to be queried together
multiplier: if two segments belong to the same data source, they are more likely to be involved
in the same queries
@param segmentA The first DataSegment.
@param segmentB The second DataSegment.
@return the joint cost of placing the two DataSegments together on one node. | [
"This",
"defines",
"the",
"unnormalized",
"cost",
"function",
"between",
"two",
"segments",
"."
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/server/coordinator/CostBalancerStrategy.java#L67-L81 |
NessComputing/components-ness-core | src/main/java/com/nesscomputing/callback/Callbacks.java | Callbacks.stream | @SafeVarargs
public static <T> void stream(Callback<T> callback, T... items) throws Exception
{
stream(callback, Arrays.asList(items));
} | java | @SafeVarargs
public static <T> void stream(Callback<T> callback, T... items) throws Exception
{
stream(callback, Arrays.asList(items));
} | [
"@",
"SafeVarargs",
"public",
"static",
"<",
"T",
">",
"void",
"stream",
"(",
"Callback",
"<",
"T",
">",
"callback",
",",
"T",
"...",
"items",
")",
"throws",
"Exception",
"{",
"stream",
"(",
"callback",
",",
"Arrays",
".",
"asList",
"(",
"items",
")",
... | For every element, invoke the given callback.
Stops if {@link CallbackRefusedException} is thrown. | [
"For",
"every",
"element",
"invoke",
"the",
"given",
"callback",
".",
"Stops",
"if",
"{"
] | train | https://github.com/NessComputing/components-ness-core/blob/980db2925e5f9085c75ad3682d5314a973209297/src/main/java/com/nesscomputing/callback/Callbacks.java#L30-L34 |
synchronoss/cpo-api | cpo-jdbc/src/main/java/org/synchronoss/cpo/transform/jdbc/TransformBlob.java | TransformBlob.transformOut | @Override
public Blob transformOut(JdbcPreparedStatementFactory jpsf, byte[] attributeObject) throws CpoException {
BLOB newBlob = null;
try {
if (attributeObject != null) {
newBlob = BLOB.createTemporary(jpsf.getPreparedStatement().getConnection(), false, BLOB.DURATION_SESSION);
jpsf.AddReleasible(new OracleTemporaryBlob(newBlob));
//OutputStream os = newBlob.getBinaryOutputStream();
OutputStream os = newBlob.setBinaryStream(0);
os.write(attributeObject);
os.close();
}
} catch (Exception e) {
String msg = "Error BLOBing Byte Array";
logger.error(msg, e);
throw new CpoException(msg, e);
}
return newBlob;
} | java | @Override
public Blob transformOut(JdbcPreparedStatementFactory jpsf, byte[] attributeObject) throws CpoException {
BLOB newBlob = null;
try {
if (attributeObject != null) {
newBlob = BLOB.createTemporary(jpsf.getPreparedStatement().getConnection(), false, BLOB.DURATION_SESSION);
jpsf.AddReleasible(new OracleTemporaryBlob(newBlob));
//OutputStream os = newBlob.getBinaryOutputStream();
OutputStream os = newBlob.setBinaryStream(0);
os.write(attributeObject);
os.close();
}
} catch (Exception e) {
String msg = "Error BLOBing Byte Array";
logger.error(msg, e);
throw new CpoException(msg, e);
}
return newBlob;
} | [
"@",
"Override",
"public",
"Blob",
"transformOut",
"(",
"JdbcPreparedStatementFactory",
"jpsf",
",",
"byte",
"[",
"]",
"attributeObject",
")",
"throws",
"CpoException",
"{",
"BLOB",
"newBlob",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"attributeObject",
"!=",
"... | Transforms the data from the class attribute to the object required by the datasource
@param cpoAdapter The CpoAdapter for the datasource where the attribute is being persisted
@param parentObject The object that contains the attribute being persisted.
@param attributeObject The object that represents the attribute being persisted.
@return The object to be stored in the datasource
@throws CpoException | [
"Transforms",
"the",
"data",
"from",
"the",
"class",
"attribute",
"to",
"the",
"object",
"required",
"by",
"the",
"datasource"
] | train | https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/transform/jdbc/TransformBlob.java#L87-L108 |
roboconf/roboconf-platform | core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/InstanceHelpers.java | InstanceHelpers.insertChild | public static void insertChild( Instance parent, Instance child ) {
child.setParent( parent );
parent.getChildren().add( child );
} | java | public static void insertChild( Instance parent, Instance child ) {
child.setParent( parent );
parent.getChildren().add( child );
} | [
"public",
"static",
"void",
"insertChild",
"(",
"Instance",
"parent",
",",
"Instance",
"child",
")",
"{",
"child",
".",
"setParent",
"(",
"parent",
")",
";",
"parent",
".",
"getChildren",
"(",
")",
".",
"add",
"(",
"child",
")",
";",
"}"
] | Inserts a child instance.
<p>
This method does not check anything.
In real implementations, such as in the DM, one should
use {@link #tryToInsertChildInstance(AbstractApplication, Instance, Instance)}.
</p>
@param child a child instance (not null)
@param parent a parent instance (not null) | [
"Inserts",
"a",
"child",
"instance",
".",
"<p",
">",
"This",
"method",
"does",
"not",
"check",
"anything",
".",
"In",
"real",
"implementations",
"such",
"as",
"in",
"the",
"DM",
"one",
"should",
"use",
"{",
"@link",
"#tryToInsertChildInstance",
"(",
"Abstrac... | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/InstanceHelpers.java#L166-L169 |
web3j/web3j | crypto/src/main/java/org/web3j/crypto/ECDSASignature.java | ECDSASignature.toCanonicalised | public ECDSASignature toCanonicalised() {
if (!isCanonical()) {
// The order of the curve is the number of valid points that exist on that curve.
// If S is in the upper half of the number of valid points, then bring it back to
// the lower half. Otherwise, imagine that
// N = 10
// s = 8, so (-8 % 10 == 2) thus both (r, 8) and (r, 2) are valid solutions.
// 10 - 8 == 2, giving us always the latter solution, which is canonical.
return new ECDSASignature(r, Sign.CURVE.getN().subtract(s));
} else {
return this;
}
} | java | public ECDSASignature toCanonicalised() {
if (!isCanonical()) {
// The order of the curve is the number of valid points that exist on that curve.
// If S is in the upper half of the number of valid points, then bring it back to
// the lower half. Otherwise, imagine that
// N = 10
// s = 8, so (-8 % 10 == 2) thus both (r, 8) and (r, 2) are valid solutions.
// 10 - 8 == 2, giving us always the latter solution, which is canonical.
return new ECDSASignature(r, Sign.CURVE.getN().subtract(s));
} else {
return this;
}
} | [
"public",
"ECDSASignature",
"toCanonicalised",
"(",
")",
"{",
"if",
"(",
"!",
"isCanonical",
"(",
")",
")",
"{",
"// The order of the curve is the number of valid points that exist on that curve.",
"// If S is in the upper half of the number of valid points, then bring it back to",
"... | Will automatically adjust the S component to be less than or equal to half the curve
order, if necessary. This is required because for every signature (r,s) the signature
(r, -s (mod N)) is a valid signature of the same message. However, we dislike the
ability to modify the bits of a Bitcoin transaction after it's been signed, as that
violates various assumed invariants. Thus in future only one of those forms will be
considered legal and the other will be banned.
@return the signature in a canonicalised form. | [
"Will",
"automatically",
"adjust",
"the",
"S",
"component",
"to",
"be",
"less",
"than",
"or",
"equal",
"to",
"half",
"the",
"curve",
"order",
"if",
"necessary",
".",
"This",
"is",
"required",
"because",
"for",
"every",
"signature",
"(",
"r",
"s",
")",
"t... | train | https://github.com/web3j/web3j/blob/f99ceb19cdd65895c18e0a565034767ca18ea9fc/crypto/src/main/java/org/web3j/crypto/ECDSASignature.java#L38-L50 |
s1-platform/s1 | s1-mongodb/src/java/org/s1/mongodb/MongoDBQueryHelper.java | MongoDBQueryHelper.get | public static Map<String, Object> get(CollectionId c, Map<String,Object> search)
throws NotFoundException, MoreThanOneFoundException {
ensureOnlyOne(c, search);
DBCollection coll = MongoDBConnectionHelper.getConnection(c.getDatabase()).getCollection(c.getCollection());
Map<String,Object> m = MongoDBFormat.toMap(coll.findOne(MongoDBFormat.fromMap(search)));
if(LOG.isDebugEnabled())
LOG.debug("MongoDB get result ("+c+", search:"+search+"\n\t> "+m);
return m;
} | java | public static Map<String, Object> get(CollectionId c, Map<String,Object> search)
throws NotFoundException, MoreThanOneFoundException {
ensureOnlyOne(c, search);
DBCollection coll = MongoDBConnectionHelper.getConnection(c.getDatabase()).getCollection(c.getCollection());
Map<String,Object> m = MongoDBFormat.toMap(coll.findOne(MongoDBFormat.fromMap(search)));
if(LOG.isDebugEnabled())
LOG.debug("MongoDB get result ("+c+", search:"+search+"\n\t> "+m);
return m;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"get",
"(",
"CollectionId",
"c",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"search",
")",
"throws",
"NotFoundException",
",",
"MoreThanOneFoundException",
"{",
"ensureOnlyOne",
"(",
"c",
",",... | Select exactly one record from collection
@param c
@param search
@throws NotFoundException
@throws MoreThanOneFoundException
@return | [
"Select",
"exactly",
"one",
"record",
"from",
"collection"
] | train | https://github.com/s1-platform/s1/blob/370101c13fef01af524bc171bcc1a97e5acc76e8/s1-mongodb/src/java/org/s1/mongodb/MongoDBQueryHelper.java#L65-L74 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java | ApiOvhDedicatedCloud.serviceName_datacenter_datacenterId_backup_changeProperties_POST | public OvhTask serviceName_datacenter_datacenterId_backup_changeProperties_POST(String serviceName, Long datacenterId, Boolean backupDurationInReport, OvhOfferTypeEnum backupOffer, Boolean backupSizeInReport, Boolean diskSizeInReport, Boolean fullDayInReport, String mailAddress, Boolean restorePointInReport, Date scheduleHour) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/backup/changeProperties";
StringBuilder sb = path(qPath, serviceName, datacenterId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "backupDurationInReport", backupDurationInReport);
addBody(o, "backupOffer", backupOffer);
addBody(o, "backupSizeInReport", backupSizeInReport);
addBody(o, "diskSizeInReport", diskSizeInReport);
addBody(o, "fullDayInReport", fullDayInReport);
addBody(o, "mailAddress", mailAddress);
addBody(o, "restorePointInReport", restorePointInReport);
addBody(o, "scheduleHour", scheduleHour);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask serviceName_datacenter_datacenterId_backup_changeProperties_POST(String serviceName, Long datacenterId, Boolean backupDurationInReport, OvhOfferTypeEnum backupOffer, Boolean backupSizeInReport, Boolean diskSizeInReport, Boolean fullDayInReport, String mailAddress, Boolean restorePointInReport, Date scheduleHour) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/backup/changeProperties";
StringBuilder sb = path(qPath, serviceName, datacenterId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "backupDurationInReport", backupDurationInReport);
addBody(o, "backupOffer", backupOffer);
addBody(o, "backupSizeInReport", backupSizeInReport);
addBody(o, "diskSizeInReport", diskSizeInReport);
addBody(o, "fullDayInReport", fullDayInReport);
addBody(o, "mailAddress", mailAddress);
addBody(o, "restorePointInReport", restorePointInReport);
addBody(o, "scheduleHour", scheduleHour);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"serviceName_datacenter_datacenterId_backup_changeProperties_POST",
"(",
"String",
"serviceName",
",",
"Long",
"datacenterId",
",",
"Boolean",
"backupDurationInReport",
",",
"OvhOfferTypeEnum",
"backupOffer",
",",
"Boolean",
"backupSizeInReport",
",",
"Bool... | Edit the backup on a Private Cloud
REST: POST /dedicatedCloud/{serviceName}/datacenter/{datacenterId}/backup/changeProperties
@param scheduleHour [required] Schedule hour for start backup. UTC Timezone
@param fullDayInReport [required] Full day on mail report
@param mailAddress [required] Unique additional email address for backup daily report
@param restorePointInReport [required] RestorePoint number on mail report
@param diskSizeInReport [required] Disk size on mail report
@param backupSizeInReport [required] Backup size on day on email report
@param backupDurationInReport [required] Duration on email report
@param backupOffer [required] Backup offer type
@param serviceName [required] Domain of the service
@param datacenterId [required] | [
"Edit",
"the",
"backup",
"on",
"a",
"Private",
"Cloud"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L2406-L2420 |
offbynull/coroutines | instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java | GenericGenerators.lineNumber | public static InsnList lineNumber(int num) {
Validate.isTrue(num >= 0);
InsnList ret = new InsnList();
LabelNode labelNode = new LabelNode();
ret.add(labelNode);
ret.add(new LineNumberNode(num, labelNode));
return ret;
} | java | public static InsnList lineNumber(int num) {
Validate.isTrue(num >= 0);
InsnList ret = new InsnList();
LabelNode labelNode = new LabelNode();
ret.add(labelNode);
ret.add(new LineNumberNode(num, labelNode));
return ret;
} | [
"public",
"static",
"InsnList",
"lineNumber",
"(",
"int",
"num",
")",
"{",
"Validate",
".",
"isTrue",
"(",
"num",
">=",
"0",
")",
";",
"InsnList",
"ret",
"=",
"new",
"InsnList",
"(",
")",
";",
"LabelNode",
"labelNode",
"=",
"new",
"LabelNode",
"(",
")"... | Generates instructions for line numbers. This is useful for debugging. For example, you can put a line number of 99999 or some other
special number to denote that the code being executed is instrumented code. Then if a stacktrace happens, you'll know that if
instrumented code was immediately involved.
@param num line number
@return instructions for a line number
@throws IllegalArgumentException if {@code num < 0} | [
"Generates",
"instructions",
"for",
"line",
"numbers",
".",
"This",
"is",
"useful",
"for",
"debugging",
".",
"For",
"example",
"you",
"can",
"put",
"a",
"line",
"number",
"of",
"99999",
"or",
"some",
"other",
"special",
"number",
"to",
"denote",
"that",
"t... | train | https://github.com/offbynull/coroutines/blob/b1b83c293945f53a2f63fca8f15a53e88b796bf5/instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java#L286-L296 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java | SqlQueryStatement.appendFieldCriteria | private void appendFieldCriteria(TableAlias alias, PathInfo pathInfo, FieldCriteria c, StringBuffer buf)
{
appendColName(alias, pathInfo, c.isTranslateAttribute(), buf);
buf.append(c.getClause());
if (c.isTranslateField())
{
appendColName((String) c.getValue(), false, c.getUserAlias(), buf);
}
else
{
buf.append(c.getValue());
}
} | java | private void appendFieldCriteria(TableAlias alias, PathInfo pathInfo, FieldCriteria c, StringBuffer buf)
{
appendColName(alias, pathInfo, c.isTranslateAttribute(), buf);
buf.append(c.getClause());
if (c.isTranslateField())
{
appendColName((String) c.getValue(), false, c.getUserAlias(), buf);
}
else
{
buf.append(c.getValue());
}
} | [
"private",
"void",
"appendFieldCriteria",
"(",
"TableAlias",
"alias",
",",
"PathInfo",
"pathInfo",
",",
"FieldCriteria",
"c",
",",
"StringBuffer",
"buf",
")",
"{",
"appendColName",
"(",
"alias",
",",
"pathInfo",
",",
"c",
".",
"isTranslateAttribute",
"(",
")",
... | Answer the SQL-Clause for a FieldCriteria<br>
The value of the FieldCriteria will be translated
@param alias
@param pathInfo
@param c ColumnCriteria
@param buf | [
"Answer",
"the",
"SQL",
"-",
"Clause",
"for",
"a",
"FieldCriteria<br",
">",
"The",
"value",
"of",
"the",
"FieldCriteria",
"will",
"be",
"translated"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java#L728-L741 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java | Resolve.isProtectedAccessible | private
boolean isProtectedAccessible(Symbol sym, ClassSymbol c, Type site) {
Type newSite = site.hasTag(TYPEVAR) ? site.getUpperBound() : site;
while (c != null &&
!(c.isSubClass(sym.owner, types) &&
(c.flags() & INTERFACE) == 0 &&
// In JLS 2e 6.6.2.1, the subclass restriction applies
// only to instance fields and methods -- types are excluded
// regardless of whether they are declared 'static' or not.
((sym.flags() & STATIC) != 0 || sym.kind == TYP || newSite.tsym.isSubClass(c, types))))
c = c.owner.enclClass();
return c != null;
} | java | private
boolean isProtectedAccessible(Symbol sym, ClassSymbol c, Type site) {
Type newSite = site.hasTag(TYPEVAR) ? site.getUpperBound() : site;
while (c != null &&
!(c.isSubClass(sym.owner, types) &&
(c.flags() & INTERFACE) == 0 &&
// In JLS 2e 6.6.2.1, the subclass restriction applies
// only to instance fields and methods -- types are excluded
// regardless of whether they are declared 'static' or not.
((sym.flags() & STATIC) != 0 || sym.kind == TYP || newSite.tsym.isSubClass(c, types))))
c = c.owner.enclClass();
return c != null;
} | [
"private",
"boolean",
"isProtectedAccessible",
"(",
"Symbol",
"sym",
",",
"ClassSymbol",
"c",
",",
"Type",
"site",
")",
"{",
"Type",
"newSite",
"=",
"site",
".",
"hasTag",
"(",
"TYPEVAR",
")",
"?",
"site",
".",
"getUpperBound",
"(",
")",
":",
"site",
";"... | Is given protected symbol accessible if it is selected from given site
and the selection takes place in given class?
@param sym The symbol with protected access
@param c The class where the access takes place
@site The type of the qualifier | [
"Is",
"given",
"protected",
"symbol",
"accessible",
"if",
"it",
"is",
"selected",
"from",
"given",
"site",
"and",
"the",
"selection",
"takes",
"place",
"in",
"given",
"class?"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L467-L479 |
qiniu/java-sdk | src/main/java/com/qiniu/storage/BucketManager.java | BucketManager.deleteAfterDays | public Response deleteAfterDays(String bucket, String key, int days) throws QiniuException {
return rsPost(bucket, String.format("/deleteAfterDays/%s/%d", encodedEntry(bucket, key), days), null);
} | java | public Response deleteAfterDays(String bucket, String key, int days) throws QiniuException {
return rsPost(bucket, String.format("/deleteAfterDays/%s/%d", encodedEntry(bucket, key), days), null);
} | [
"public",
"Response",
"deleteAfterDays",
"(",
"String",
"bucket",
",",
"String",
"key",
",",
"int",
"days",
")",
"throws",
"QiniuException",
"{",
"return",
"rsPost",
"(",
"bucket",
",",
"String",
".",
"format",
"(",
"\"/deleteAfterDays/%s/%d\"",
",",
"encodedEnt... | 设置文件的存活时间
@param bucket 空间名称
@param key 文件名称
@param days 存活时间,单位:天 | [
"设置文件的存活时间"
] | train | https://github.com/qiniu/java-sdk/blob/6c05f3fb718403a496c725b048e9241f80171499/src/main/java/com/qiniu/storage/BucketManager.java#L594-L596 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.health/src/com/ibm/ws/microprofile/health/internal/AppTrackerImpl.java | AppTrackerImpl.setAppModuleNames | private AppModuleName setAppModuleNames(IServletContext isc) {
WebAppConfig webAppConfig = isc.getWebAppConfig();
if (webAppConfig.isSystemApp()) {
Tr.debug(tc, "Detected system app so won't track for health check; appName = ", webAppConfig.getApplicationName());
return null;
}
if (isOsgiApp(isc)) {
Tr.debug(tc, "Detected OSGi app, so won't track for health check; appName = ", webAppConfig.getApplicationName());
return null;
}
WebModuleMetaData webModuleMetaData = ((WebAppConfigExtended) webAppConfig).getMetaData();
String appName = webModuleMetaData.getApplicationMetaData().getName();
String moduleName = webModuleMetaData.getJ2EEName().toString();
return addAppModuleNames(appName, moduleName);
} | java | private AppModuleName setAppModuleNames(IServletContext isc) {
WebAppConfig webAppConfig = isc.getWebAppConfig();
if (webAppConfig.isSystemApp()) {
Tr.debug(tc, "Detected system app so won't track for health check; appName = ", webAppConfig.getApplicationName());
return null;
}
if (isOsgiApp(isc)) {
Tr.debug(tc, "Detected OSGi app, so won't track for health check; appName = ", webAppConfig.getApplicationName());
return null;
}
WebModuleMetaData webModuleMetaData = ((WebAppConfigExtended) webAppConfig).getMetaData();
String appName = webModuleMetaData.getApplicationMetaData().getName();
String moduleName = webModuleMetaData.getJ2EEName().toString();
return addAppModuleNames(appName, moduleName);
} | [
"private",
"AppModuleName",
"setAppModuleNames",
"(",
"IServletContext",
"isc",
")",
"{",
"WebAppConfig",
"webAppConfig",
"=",
"isc",
".",
"getWebAppConfig",
"(",
")",
";",
"if",
"(",
"webAppConfig",
".",
"isSystemApp",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
... | /*
collect all app and module names and save it for later use | [
"/",
"*",
"collect",
"all",
"app",
"and",
"module",
"names",
"and",
"save",
"it",
"for",
"later",
"use"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.health/src/com/ibm/ws/microprofile/health/internal/AppTrackerImpl.java#L99-L117 |
antopen/alipay-sdk-java | src/main/java/com/alipay/api/internal/util/XmlUtils.java | XmlUtils.xmlToHtml | public static String xmlToHtml(String payload, File xsltFile)
throws AlipayApiException {
String result = null;
try {
Source template = new StreamSource(xsltFile);
Transformer transformer = TransformerFactory.newInstance()
.newTransformer(template);
Properties props = transformer.getOutputProperties();
props.setProperty(OutputKeys.OMIT_XML_DECLARATION, LOGIC_YES);
transformer.setOutputProperties(props);
StreamSource source = new StreamSource(new StringReader(payload));
StreamResult sr = new StreamResult(new StringWriter());
transformer.transform(source, sr);
result = sr.getWriter().toString();
} catch (TransformerException e) {
throw new AlipayApiException("XML_TRANSFORM_ERROR", e);
}
return result;
} | java | public static String xmlToHtml(String payload, File xsltFile)
throws AlipayApiException {
String result = null;
try {
Source template = new StreamSource(xsltFile);
Transformer transformer = TransformerFactory.newInstance()
.newTransformer(template);
Properties props = transformer.getOutputProperties();
props.setProperty(OutputKeys.OMIT_XML_DECLARATION, LOGIC_YES);
transformer.setOutputProperties(props);
StreamSource source = new StreamSource(new StringReader(payload));
StreamResult sr = new StreamResult(new StringWriter());
transformer.transform(source, sr);
result = sr.getWriter().toString();
} catch (TransformerException e) {
throw new AlipayApiException("XML_TRANSFORM_ERROR", e);
}
return result;
} | [
"public",
"static",
"String",
"xmlToHtml",
"(",
"String",
"payload",
",",
"File",
"xsltFile",
")",
"throws",
"AlipayApiException",
"{",
"String",
"result",
"=",
"null",
";",
"try",
"{",
"Source",
"template",
"=",
"new",
"StreamSource",
"(",
"xsltFile",
")",
... | Transforms the XML content to XHTML/HTML format string with the XSL.
@param payload the XML payload to convert
@param xsltFile the XML stylesheet file
@return the transformed XHTML/HTML format string
@throws ApiException problem converting XML to HTML | [
"Transforms",
"the",
"XML",
"content",
"to",
"XHTML",
"/",
"HTML",
"format",
"string",
"with",
"the",
"XSL",
"."
] | train | https://github.com/antopen/alipay-sdk-java/blob/e82aeac7d0239330ee173c7e393596e51e41c1cd/src/main/java/com/alipay/api/internal/util/XmlUtils.java#L568-L591 |
petergeneric/stdlib | guice/hibernate/src/main/java/com/peterphi/std/guice/hibernate/module/HibernateModule.java | HibernateModule.validateHibernateProperties | private void validateHibernateProperties(final GuiceConfig configuration, final Properties hibernateProperties)
{
final boolean allowCreateSchema = configuration.getBoolean(GuiceProperties.HIBERNATE_ALLOW_HBM2DDL_CREATE, false);
if (!allowCreateSchema)
{
// Check that hbm2ddl is not set to a prohibited value, throwing an exception if it is
final String hbm2ddl = hibernateProperties.getProperty("hibernate.hbm2ddl.auto");
if (hbm2ddl != null && (hbm2ddl.equalsIgnoreCase("create") || hbm2ddl.equalsIgnoreCase("create-drop")))
{
throw new IllegalArgumentException("Value '" +
hbm2ddl +
"' is not permitted for hibernate property 'hibernate.hbm2ddl.auto' under the current configuration, consider using 'update' instead. If you must use the value 'create' then set configuration parameter '" +
GuiceProperties.HIBERNATE_ALLOW_HBM2DDL_CREATE +
"' to 'true'");
}
}
} | java | private void validateHibernateProperties(final GuiceConfig configuration, final Properties hibernateProperties)
{
final boolean allowCreateSchema = configuration.getBoolean(GuiceProperties.HIBERNATE_ALLOW_HBM2DDL_CREATE, false);
if (!allowCreateSchema)
{
// Check that hbm2ddl is not set to a prohibited value, throwing an exception if it is
final String hbm2ddl = hibernateProperties.getProperty("hibernate.hbm2ddl.auto");
if (hbm2ddl != null && (hbm2ddl.equalsIgnoreCase("create") || hbm2ddl.equalsIgnoreCase("create-drop")))
{
throw new IllegalArgumentException("Value '" +
hbm2ddl +
"' is not permitted for hibernate property 'hibernate.hbm2ddl.auto' under the current configuration, consider using 'update' instead. If you must use the value 'create' then set configuration parameter '" +
GuiceProperties.HIBERNATE_ALLOW_HBM2DDL_CREATE +
"' to 'true'");
}
}
} | [
"private",
"void",
"validateHibernateProperties",
"(",
"final",
"GuiceConfig",
"configuration",
",",
"final",
"Properties",
"hibernateProperties",
")",
"{",
"final",
"boolean",
"allowCreateSchema",
"=",
"configuration",
".",
"getBoolean",
"(",
"GuiceProperties",
".",
"H... | Checks whether hbm2ddl is set to a prohibited value, throwing an exception if it is
@param configuration
the global app config
@param hibernateProperties
the hibernate-specific config
@throws IllegalArgumentException
if the hibernate.hbm2ddl.auto property is set to a prohibited value | [
"Checks",
"whether",
"hbm2ddl",
"is",
"set",
"to",
"a",
"prohibited",
"value",
"throwing",
"an",
"exception",
"if",
"it",
"is"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/guice/hibernate/src/main/java/com/peterphi/std/guice/hibernate/module/HibernateModule.java#L171-L189 |
twitter/cloudhopper-commons | ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/GsmUtil.java | GsmUtil.getShortMessageUserDataHeader | static public byte[] getShortMessageUserDataHeader(byte[] shortMessage) throws IllegalArgumentException {
if (shortMessage == null) {
return null;
}
if (shortMessage.length == 0) {
return shortMessage;
}
// the entire length of UDH is the first byte + the length
int userDataHeaderLength = ByteUtil.decodeUnsigned(shortMessage[0]) + 1;
// is there enough data?
if (userDataHeaderLength > shortMessage.length) {
throw new IllegalArgumentException("User data header length exceeds short message length [shortMessageLength=" + shortMessage.length + ", userDataHeaderLength=" + userDataHeaderLength + "]");
}
// is the user data header the only part of the payload (optimization)
if (userDataHeaderLength == shortMessage.length) {
return shortMessage;
}
// create a new message with just the header
byte[] userDataHeader = new byte[userDataHeaderLength];
System.arraycopy(shortMessage, 0, userDataHeader, 0, userDataHeaderLength);
return userDataHeader;
} | java | static public byte[] getShortMessageUserDataHeader(byte[] shortMessage) throws IllegalArgumentException {
if (shortMessage == null) {
return null;
}
if (shortMessage.length == 0) {
return shortMessage;
}
// the entire length of UDH is the first byte + the length
int userDataHeaderLength = ByteUtil.decodeUnsigned(shortMessage[0]) + 1;
// is there enough data?
if (userDataHeaderLength > shortMessage.length) {
throw new IllegalArgumentException("User data header length exceeds short message length [shortMessageLength=" + shortMessage.length + ", userDataHeaderLength=" + userDataHeaderLength + "]");
}
// is the user data header the only part of the payload (optimization)
if (userDataHeaderLength == shortMessage.length) {
return shortMessage;
}
// create a new message with just the header
byte[] userDataHeader = new byte[userDataHeaderLength];
System.arraycopy(shortMessage, 0, userDataHeader, 0, userDataHeaderLength);
return userDataHeader;
} | [
"static",
"public",
"byte",
"[",
"]",
"getShortMessageUserDataHeader",
"(",
"byte",
"[",
"]",
"shortMessage",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"shortMessage",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"shortMessag... | Gets the "User Data Header" part of a short message byte array. Only call this
method if the short message contains a user data header. This method will
take the value of the first byte ("N") as the length of the user
data header and return the first ("N+1") bytes from the the short message.
@param shortMessage The byte array representing the entire message including
a user data header and user data. A null will return null. An
empty byte array will return an empty byte array. A byte array
not containing enough data will throw an IllegalArgumentException.
@return A byte array of the user data header (minus the user data)
@throws IllegalArgumentException If the byte array does not contain
enough data to fit both the user data header and user data. | [
"Gets",
"the",
"User",
"Data",
"Header",
"part",
"of",
"a",
"short",
"message",
"byte",
"array",
".",
"Only",
"call",
"this",
"method",
"if",
"the",
"short",
"message",
"contains",
"a",
"user",
"data",
"header",
".",
"This",
"method",
"will",
"take",
"th... | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/GsmUtil.java#L211-L238 |
strator-dev/greenpepper | greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/rpc/runner/XmlRpcRemoteRunner.java | XmlRpcRemoteRunner.getSpecificationHierarchy | public DocumentNode getSpecificationHierarchy(Repository repository, SystemUnderTest systemUnderTest)
throws GreenPepperServerException
{
return xmlRpc.getSpecificationHierarchy(repository, systemUnderTest, getIdentifier());
} | java | public DocumentNode getSpecificationHierarchy(Repository repository, SystemUnderTest systemUnderTest)
throws GreenPepperServerException
{
return xmlRpc.getSpecificationHierarchy(repository, systemUnderTest, getIdentifier());
} | [
"public",
"DocumentNode",
"getSpecificationHierarchy",
"(",
"Repository",
"repository",
",",
"SystemUnderTest",
"systemUnderTest",
")",
"throws",
"GreenPepperServerException",
"{",
"return",
"xmlRpc",
".",
"getSpecificationHierarchy",
"(",
"repository",
",",
"systemUnderTest"... | <p>getSpecificationHierarchy.</p>
@param repository a {@link com.greenpepper.server.domain.Repository} object.
@param systemUnderTest a {@link com.greenpepper.server.domain.SystemUnderTest} object.
@return a {@link DocumentNode} object.
@throws com.greenpepper.server.GreenPepperServerException if any. | [
"<p",
">",
"getSpecificationHierarchy",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/rpc/runner/XmlRpcRemoteRunner.java#L81-L85 |
dashorst/wicket-stuff-markup-validator | isorelax/src/main/java/org/iso_relax/verifier/VerifierFactory.java | VerifierFactory.newVerifier | public Verifier newVerifier(InputStream stream)
throws VerifierConfigurationException, SAXException, IOException {
return compileSchema( stream, null ).newVerifier();
} | java | public Verifier newVerifier(InputStream stream)
throws VerifierConfigurationException, SAXException, IOException {
return compileSchema( stream, null ).newVerifier();
} | [
"public",
"Verifier",
"newVerifier",
"(",
"InputStream",
"stream",
")",
"throws",
"VerifierConfigurationException",
",",
"SAXException",
",",
"IOException",
"{",
"return",
"compileSchema",
"(",
"stream",
",",
"null",
")",
".",
"newVerifier",
"(",
")",
";",
"}"
] | parses a schema from the specified InputStream and returns a Verifier object
that validates documents by using that schema. | [
"parses",
"a",
"schema",
"from",
"the",
"specified",
"InputStream",
"and",
"returns",
"a",
"Verifier",
"object",
"that",
"validates",
"documents",
"by",
"using",
"that",
"schema",
"."
] | train | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/isorelax/src/main/java/org/iso_relax/verifier/VerifierFactory.java#L64-L68 |
opendatatrentino/s-match | src/main/java/it/unitn/disi/common/utils/ClassFactory.java | ClassFactory.getClassInstance | @SuppressWarnings("unchecked")
public static Object getClassInstance(String className,
Class[] attrTypes,
Object[] attrValues) throws DISIException {
Constructor constr;
try {
Class cl = Class.forName(className);
constr = cl.getConstructor(attrTypes);
} catch (ClassNotFoundException e) {
//yep, log and throw...
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new DISIException(errMessage, e);
} catch (NoSuchMethodException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new DISIException(errMessage, e);
}
Object classInst;
try {
classInst = constr.newInstance(attrValues);
} catch (InstantiationException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new DISIException(errMessage, e);
} catch (IllegalAccessException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new DISIException(errMessage, e);
} catch (InvocationTargetException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new DISIException(errMessage, e);
}
return classInst;
} | java | @SuppressWarnings("unchecked")
public static Object getClassInstance(String className,
Class[] attrTypes,
Object[] attrValues) throws DISIException {
Constructor constr;
try {
Class cl = Class.forName(className);
constr = cl.getConstructor(attrTypes);
} catch (ClassNotFoundException e) {
//yep, log and throw...
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new DISIException(errMessage, e);
} catch (NoSuchMethodException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new DISIException(errMessage, e);
}
Object classInst;
try {
classInst = constr.newInstance(attrValues);
} catch (InstantiationException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new DISIException(errMessage, e);
} catch (IllegalAccessException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new DISIException(errMessage, e);
} catch (InvocationTargetException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new DISIException(errMessage, e);
}
return classInst;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"Object",
"getClassInstance",
"(",
"String",
"className",
",",
"Class",
"[",
"]",
"attrTypes",
",",
"Object",
"[",
"]",
"attrValues",
")",
"throws",
"DISIException",
"{",
"Constructor",
"con... | Creates an instance of the class whose name is passed as the parameter.
@param className name of the class those instance is to be created
@param attrTypes attrTypes
@param attrValues attrValues
@return instance of the class
@throws DISIException DISIException | [
"Creates",
"an",
"instance",
"of",
"the",
"class",
"whose",
"name",
"is",
"passed",
"as",
"the",
"parameter",
"."
] | train | https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/common/utils/ClassFactory.java#L59-L97 |
apache/groovy | subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java | NioGroovyMethods.eachDir | public static void eachDir(Path self, @ClosureParams(value = SimpleType.class, options = "java.nio.file.Path") Closure closure) throws IOException { // throws FileNotFoundException, IllegalArgumentException {
eachFile(self, FileType.DIRECTORIES, closure);
} | java | public static void eachDir(Path self, @ClosureParams(value = SimpleType.class, options = "java.nio.file.Path") Closure closure) throws IOException { // throws FileNotFoundException, IllegalArgumentException {
eachFile(self, FileType.DIRECTORIES, closure);
} | [
"public",
"static",
"void",
"eachDir",
"(",
"Path",
"self",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"SimpleType",
".",
"class",
",",
"options",
"=",
"\"java.nio.file.Path\"",
")",
"Closure",
"closure",
")",
"throws",
"IOException",
"{",
"// throws FileNotF... | Invokes the closure for each subdirectory in this directory,
ignoring regular files.
@param self a Path (that happens to be a folder/directory)
@param closure a closure (the parameter is the Path for the subdirectory file)
@throws java.io.FileNotFoundException if the given directory does not exist
@throws IllegalArgumentException if the provided Path object does not represent a directory
@see #eachFile(Path, groovy.io.FileType, groovy.lang.Closure)
@since 2.3.0 | [
"Invokes",
"the",
"closure",
"for",
"each",
"subdirectory",
"in",
"this",
"directory",
"ignoring",
"regular",
"files",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java#L901-L903 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/io/FastaAFPChainConverter.java | FastaAFPChainConverter.fastaStringToAfpChain | public static AFPChain fastaStringToAfpChain(String sequence1, String sequence2, Structure structure1,
Structure structure2) throws StructureException, CompoundNotFoundException {
ProteinSequence seq1 = new ProteinSequence(sequence1);
ProteinSequence seq2 = new ProteinSequence(sequence2);
return fastaToAfpChain(seq1, seq2, structure1, structure2);
} | java | public static AFPChain fastaStringToAfpChain(String sequence1, String sequence2, Structure structure1,
Structure structure2) throws StructureException, CompoundNotFoundException {
ProteinSequence seq1 = new ProteinSequence(sequence1);
ProteinSequence seq2 = new ProteinSequence(sequence2);
return fastaToAfpChain(seq1, seq2, structure1, structure2);
} | [
"public",
"static",
"AFPChain",
"fastaStringToAfpChain",
"(",
"String",
"sequence1",
",",
"String",
"sequence2",
",",
"Structure",
"structure1",
",",
"Structure",
"structure2",
")",
"throws",
"StructureException",
",",
"CompoundNotFoundException",
"{",
"ProteinSequence",
... | Returns an AFPChain corresponding to the alignment between {@code structure1} and {@code structure2}, which is given by the gapped protein sequences {@code sequence1} and {@code sequence2}. The
sequences need not correspond to the entire structures, since local alignment is performed to match the sequences to structures.
@throws StructureException
@throws CompoundNotFoundException | [
"Returns",
"an",
"AFPChain",
"corresponding",
"to",
"the",
"alignment",
"between",
"{"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/FastaAFPChainConverter.java#L213-L218 |
aws/aws-sdk-java | aws-java-sdk-ses/src/main/java/com/amazonaws/services/simpleemail/model/GetIdentityPoliciesResult.java | GetIdentityPoliciesResult.withPolicies | public GetIdentityPoliciesResult withPolicies(java.util.Map<String, String> policies) {
setPolicies(policies);
return this;
} | java | public GetIdentityPoliciesResult withPolicies(java.util.Map<String, String> policies) {
setPolicies(policies);
return this;
} | [
"public",
"GetIdentityPoliciesResult",
"withPolicies",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"policies",
")",
"{",
"setPolicies",
"(",
"policies",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A map of policy names to policies.
</p>
@param policies
A map of policy names to policies.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"map",
"of",
"policy",
"names",
"to",
"policies",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ses/src/main/java/com/amazonaws/services/simpleemail/model/GetIdentityPoliciesResult.java#L74-L77 |
lucee/Lucee | core/src/main/java/lucee/runtime/op/Operator.java | Operator.ct | public static boolean ct(Object left, Object right) throws PageException {
return Caster.toString(left).toLowerCase().indexOf(Caster.toString(right).toLowerCase()) != -1;
} | java | public static boolean ct(Object left, Object right) throws PageException {
return Caster.toString(left).toLowerCase().indexOf(Caster.toString(right).toLowerCase()) != -1;
} | [
"public",
"static",
"boolean",
"ct",
"(",
"Object",
"left",
",",
"Object",
"right",
")",
"throws",
"PageException",
"{",
"return",
"Caster",
".",
"toString",
"(",
"left",
")",
".",
"toLowerCase",
"(",
")",
".",
"indexOf",
"(",
"Caster",
".",
"toString",
... | check if left is inside right (String-> ignore case)
@param left string to check
@param right substring to find in string
@return return if substring has been found
@throws PageException | [
"check",
"if",
"left",
"is",
"inside",
"right",
"(",
"String",
"-",
">",
"ignore",
"case",
")"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Operator.java#L793-L795 |
JM-Lab/utils-java8 | src/main/java/kr/jm/utils/helper/JMResources.java | JMResources.getStringWithFilePathOrClasspath | public static String getStringWithFilePathOrClasspath(
String filePathOrClasspath, String charsetName) {
return getStringAsOptWithFilePath(filePathOrClasspath, charsetName)
.orElseGet(
() -> getStringAsOptWithClasspath(
filePathOrClasspath,
charsetName).orElse(null));
} | java | public static String getStringWithFilePathOrClasspath(
String filePathOrClasspath, String charsetName) {
return getStringAsOptWithFilePath(filePathOrClasspath, charsetName)
.orElseGet(
() -> getStringAsOptWithClasspath(
filePathOrClasspath,
charsetName).orElse(null));
} | [
"public",
"static",
"String",
"getStringWithFilePathOrClasspath",
"(",
"String",
"filePathOrClasspath",
",",
"String",
"charsetName",
")",
"{",
"return",
"getStringAsOptWithFilePath",
"(",
"filePathOrClasspath",
",",
"charsetName",
")",
".",
"orElseGet",
"(",
"(",
")",
... | Gets string with file path or classpath.
@param filePathOrClasspath the file path or classpath
@param charsetName the charset name
@return the string with file path or classpath | [
"Gets",
"string",
"with",
"file",
"path",
"or",
"classpath",
"."
] | train | https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMResources.java#L406-L413 |
mangstadt/biweekly | src/main/java/biweekly/component/ICalComponent.java | ICalComponent.checkRequiredCardinality | protected void checkRequiredCardinality(List<ValidationWarning> warnings, Class<? extends ICalProperty>... classes) {
for (Class<? extends ICalProperty> clazz : classes) {
List<? extends ICalProperty> props = getProperties(clazz);
if (props.isEmpty()) {
warnings.add(new ValidationWarning(2, clazz.getSimpleName()));
continue;
}
if (props.size() > 1) {
warnings.add(new ValidationWarning(3, clazz.getSimpleName()));
continue;
}
}
} | java | protected void checkRequiredCardinality(List<ValidationWarning> warnings, Class<? extends ICalProperty>... classes) {
for (Class<? extends ICalProperty> clazz : classes) {
List<? extends ICalProperty> props = getProperties(clazz);
if (props.isEmpty()) {
warnings.add(new ValidationWarning(2, clazz.getSimpleName()));
continue;
}
if (props.size() > 1) {
warnings.add(new ValidationWarning(3, clazz.getSimpleName()));
continue;
}
}
} | [
"protected",
"void",
"checkRequiredCardinality",
"(",
"List",
"<",
"ValidationWarning",
">",
"warnings",
",",
"Class",
"<",
"?",
"extends",
"ICalProperty",
">",
"...",
"classes",
")",
"{",
"for",
"(",
"Class",
"<",
"?",
"extends",
"ICalProperty",
">",
"clazz",... | Utility method for validating that there is exactly one instance of each
of the given properties.
@param warnings the list to add the warnings to
@param classes the properties to check | [
"Utility",
"method",
"for",
"validating",
"that",
"there",
"is",
"exactly",
"one",
"instance",
"of",
"each",
"of",
"the",
"given",
"properties",
"."
] | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/component/ICalComponent.java#L512-L526 |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectProperties.java | ProjectProperties.set | private void set(FieldType field, boolean value)
{
set(field, (value ? Boolean.TRUE : Boolean.FALSE));
} | java | private void set(FieldType field, boolean value)
{
set(field, (value ? Boolean.TRUE : Boolean.FALSE));
} | [
"private",
"void",
"set",
"(",
"FieldType",
"field",
",",
"boolean",
"value",
")",
"{",
"set",
"(",
"field",
",",
"(",
"value",
"?",
"Boolean",
".",
"TRUE",
":",
"Boolean",
".",
"FALSE",
")",
")",
";",
"}"
] | This method inserts a name value pair into internal storage.
@param field task field
@param value attribute value | [
"This",
"method",
"inserts",
"a",
"name",
"value",
"pair",
"into",
"internal",
"storage",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectProperties.java#L2730-L2733 |
defei/codelogger-utils | src/main/java/org/codelogger/utils/DateUtils.java | DateUtils.subMinutes | public static long subMinutes(final Date date1, final Date date2) {
return subTime(date1, date2, DatePeriod.MINUTE);
} | java | public static long subMinutes(final Date date1, final Date date2) {
return subTime(date1, date2, DatePeriod.MINUTE);
} | [
"public",
"static",
"long",
"subMinutes",
"(",
"final",
"Date",
"date1",
",",
"final",
"Date",
"date2",
")",
"{",
"return",
"subTime",
"(",
"date1",
",",
"date2",
",",
"DatePeriod",
".",
"MINUTE",
")",
";",
"}"
] | Get how many minutes between two date.
@param date1 date to be tested.
@param date2 date to be tested.
@return how many minutes between two date. | [
"Get",
"how",
"many",
"minutes",
"between",
"two",
"date",
"."
] | train | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L423-L426 |
s1-platform/s1 | s1-core/src/java/org/s1/format/json/org_json_simple/JSONArray.java | JSONArray.writeJSONString | public static void writeJSONString(Collection collection, Writer out) throws IOException{
if(collection == null){
out.write("null");
return;
}
boolean first = true;
Iterator iter=collection.iterator();
out.write('[');
while(iter.hasNext()){
if(first)
first = false;
else
out.write(',');
Object value=iter.next();
if(value == null){
out.write("null");
continue;
}
JSONValue.writeJSONString(value, out);
}
out.write(']');
} | java | public static void writeJSONString(Collection collection, Writer out) throws IOException{
if(collection == null){
out.write("null");
return;
}
boolean first = true;
Iterator iter=collection.iterator();
out.write('[');
while(iter.hasNext()){
if(first)
first = false;
else
out.write(',');
Object value=iter.next();
if(value == null){
out.write("null");
continue;
}
JSONValue.writeJSONString(value, out);
}
out.write(']');
} | [
"public",
"static",
"void",
"writeJSONString",
"(",
"Collection",
"collection",
",",
"Writer",
"out",
")",
"throws",
"IOException",
"{",
"if",
"(",
"collection",
"==",
"null",
")",
"{",
"out",
".",
"write",
"(",
"\"null\"",
")",
";",
"return",
";",
"}",
... | Encode a list into JSON text and write it to out.
If this list is also a JSONStreamAware or a JSONAware, JSONStreamAware and JSONAware specific behaviours will be ignored at this top level.
@see org.json.simple.JSONValue#writeJSONString(Object, java.io.Writer)
@param collection
@param out | [
"Encode",
"a",
"list",
"into",
"JSON",
"text",
"and",
"write",
"it",
"to",
"out",
".",
"If",
"this",
"list",
"is",
"also",
"a",
"JSONStreamAware",
"or",
"a",
"JSONAware",
"JSONStreamAware",
"and",
"JSONAware",
"specific",
"behaviours",
"will",
"be",
"ignored... | train | https://github.com/s1-platform/s1/blob/370101c13fef01af524bc171bcc1a97e5acc76e8/s1-core/src/java/org/s1/format/json/org_json_simple/JSONArray.java#L64-L89 |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java | XPathParser.parseRelativePathExpr | private void parseRelativePathExpr() throws TTXPathException {
parseStepExpr();
while (mToken.getType() == TokenType.SLASH || mToken.getType() == TokenType.DESC_STEP) {
if (is(TokenType.DESC_STEP, true)) {
final AbsAxis mAxis = new DescendantAxis(getTransaction(), true);
mPipeBuilder.addStep(mAxis);
} else {
// in this case the slash is just a separator
consume(TokenType.SLASH, true);
}
parseStepExpr();
}
} | java | private void parseRelativePathExpr() throws TTXPathException {
parseStepExpr();
while (mToken.getType() == TokenType.SLASH || mToken.getType() == TokenType.DESC_STEP) {
if (is(TokenType.DESC_STEP, true)) {
final AbsAxis mAxis = new DescendantAxis(getTransaction(), true);
mPipeBuilder.addStep(mAxis);
} else {
// in this case the slash is just a separator
consume(TokenType.SLASH, true);
}
parseStepExpr();
}
} | [
"private",
"void",
"parseRelativePathExpr",
"(",
")",
"throws",
"TTXPathException",
"{",
"parseStepExpr",
"(",
")",
";",
"while",
"(",
"mToken",
".",
"getType",
"(",
")",
"==",
"TokenType",
".",
"SLASH",
"||",
"mToken",
".",
"getType",
"(",
")",
"==",
"Tok... | Parses the the rule RelativePathExpr according to the following
production rule:
<p>
[26] RelativePathExpr ::= StepExpr (("/" | "//") StepExpr)* .
</p>
@throws TTXPathException | [
"Parses",
"the",
"the",
"rule",
"RelativePathExpr",
"according",
"to",
"the",
"following",
"production",
"rule",
":",
"<p",
">",
"[",
"26",
"]",
"RelativePathExpr",
"::",
"=",
"StepExpr",
"((",
"/",
"|",
"//",
")",
"StepExpr",
")",
"*",
".",
"<",
"/",
... | train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java#L722-L739 |
hdecarne/java-default | src/main/java/de/carne/io/Closeables.java | Closeables.safeClose | public static void safeClose(Throwable exception, @Nullable Object object) {
if (object instanceof Closeable) {
try {
((Closeable) object).close();
} catch (IOException e) {
exception.addSuppressed(e);
}
}
} | java | public static void safeClose(Throwable exception, @Nullable Object object) {
if (object instanceof Closeable) {
try {
((Closeable) object).close();
} catch (IOException e) {
exception.addSuppressed(e);
}
}
} | [
"public",
"static",
"void",
"safeClose",
"(",
"Throwable",
"exception",
",",
"@",
"Nullable",
"Object",
"object",
")",
"{",
"if",
"(",
"object",
"instanceof",
"Closeable",
")",
"{",
"try",
"{",
"(",
"(",
"Closeable",
")",
"object",
")",
".",
"close",
"("... | Close potential {@linkplain Closeable}.
<p>
An {@linkplain IOException} caused by {@linkplain Closeable#close()} is suppressed and added to the given outer
exception.
@param exception the currently handled outer exception.
@param object the object to check and close. | [
"Close",
"potential",
"{",
"@linkplain",
"Closeable",
"}",
".",
"<p",
">",
"An",
"{",
"@linkplain",
"IOException",
"}",
"caused",
"by",
"{",
"@linkplain",
"Closeable#close",
"()",
"}",
"is",
"suppressed",
"and",
"added",
"to",
"the",
"given",
"outer",
"excep... | train | https://github.com/hdecarne/java-default/blob/ca16f6fdb0436e90e9e2df3106055e320bb3c9e3/src/main/java/de/carne/io/Closeables.java#L107-L115 |
lestard/advanced-bindings | src/main/java/eu/lestard/advanced_bindings/api/CollectionBindings.java | CollectionBindings.join | public static StringBinding join(final ObservableList<?> items, final ObservableValue<String> delimiter) {
return Bindings.createStringBinding(() -> items.stream().map(String::valueOf).collect(Collectors.joining(delimiter.getValue())), items, delimiter);
} | java | public static StringBinding join(final ObservableList<?> items, final ObservableValue<String> delimiter) {
return Bindings.createStringBinding(() -> items.stream().map(String::valueOf).collect(Collectors.joining(delimiter.getValue())), items, delimiter);
} | [
"public",
"static",
"StringBinding",
"join",
"(",
"final",
"ObservableList",
"<",
"?",
">",
"items",
",",
"final",
"ObservableValue",
"<",
"String",
">",
"delimiter",
")",
"{",
"return",
"Bindings",
".",
"createStringBinding",
"(",
"(",
")",
"->",
"items",
"... | Creates a string binding that constructs a sequence of characters separated by a delimiter.
@param items the observable list of items.
@param delimiter the sequence of characters to be used between each element.
@return a string binding. | [
"Creates",
"a",
"string",
"binding",
"that",
"constructs",
"a",
"sequence",
"of",
"characters",
"separated",
"by",
"a",
"delimiter",
"."
] | train | https://github.com/lestard/advanced-bindings/blob/054a5dde261c29f862b971765fa3da3704a13ab4/src/main/java/eu/lestard/advanced_bindings/api/CollectionBindings.java#L136-L138 |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGeneratorUtils.java | GraphGeneratorUtils.vertexSequence | public static DataSet<Vertex<LongValue, NullValue>> vertexSequence(ExecutionEnvironment env, int parallelism, long vertexCount) {
Preconditions.checkArgument(vertexCount >= 0, "Vertex count must be non-negative");
if (vertexCount == 0) {
return env
.fromCollection(Collections.emptyList(), TypeInformation.of(new TypeHint<Vertex<LongValue, NullValue>>(){}))
.setParallelism(parallelism)
.name("Empty vertex set");
} else {
LongValueSequenceIterator iterator = new LongValueSequenceIterator(0, vertexCount - 1);
DataSource<LongValue> vertexLabels = env
.fromParallelCollection(iterator, LongValue.class)
.setParallelism(parallelism)
.name("Vertex indices");
return vertexLabels
.map(new CreateVertex())
.setParallelism(parallelism)
.name("Vertex sequence");
}
} | java | public static DataSet<Vertex<LongValue, NullValue>> vertexSequence(ExecutionEnvironment env, int parallelism, long vertexCount) {
Preconditions.checkArgument(vertexCount >= 0, "Vertex count must be non-negative");
if (vertexCount == 0) {
return env
.fromCollection(Collections.emptyList(), TypeInformation.of(new TypeHint<Vertex<LongValue, NullValue>>(){}))
.setParallelism(parallelism)
.name("Empty vertex set");
} else {
LongValueSequenceIterator iterator = new LongValueSequenceIterator(0, vertexCount - 1);
DataSource<LongValue> vertexLabels = env
.fromParallelCollection(iterator, LongValue.class)
.setParallelism(parallelism)
.name("Vertex indices");
return vertexLabels
.map(new CreateVertex())
.setParallelism(parallelism)
.name("Vertex sequence");
}
} | [
"public",
"static",
"DataSet",
"<",
"Vertex",
"<",
"LongValue",
",",
"NullValue",
">",
">",
"vertexSequence",
"(",
"ExecutionEnvironment",
"env",
",",
"int",
"parallelism",
",",
"long",
"vertexCount",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"vertex... | Generates {@link Vertex Vertices} with sequential, numerical labels.
@param env the Flink execution environment.
@param parallelism operator parallelism
@param vertexCount number of sequential vertex labels
@return {@link DataSet} of sequentially labeled {@link Vertex vertices} | [
"Generates",
"{",
"@link",
"Vertex",
"Vertices",
"}",
"with",
"sequential",
"numerical",
"labels",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGeneratorUtils.java#L56-L77 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/SerializationUtil.java | SerializationUtil.writeNullableList | public static <T> void writeNullableList(List<T> items, ObjectDataOutput out) throws IOException {
writeNullableCollection(items, out);
} | java | public static <T> void writeNullableList(List<T> items, ObjectDataOutput out) throws IOException {
writeNullableCollection(items, out);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"writeNullableList",
"(",
"List",
"<",
"T",
">",
"items",
",",
"ObjectDataOutput",
"out",
")",
"throws",
"IOException",
"{",
"writeNullableCollection",
"(",
"items",
",",
"out",
")",
";",
"}"
] | Writes a list to an {@link ObjectDataOutput}. The list's size is written
to the data output, then each object in the list is serialized.
The list is allowed to be null.
@param items list of items to be serialized
@param out data output to write to
@param <T> type of items
@throws IOException when an error occurs while writing to the output | [
"Writes",
"a",
"list",
"to",
"an",
"{",
"@link",
"ObjectDataOutput",
"}",
".",
"The",
"list",
"s",
"size",
"is",
"written",
"to",
"the",
"data",
"output",
"then",
"each",
"object",
"in",
"the",
"list",
"is",
"serialized",
".",
"The",
"list",
"is",
"all... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/SerializationUtil.java#L234-L236 |
whitfin/siphash-java | src/main/java/io/whitfin/siphash/SipHasher.java | SipHasher.bytesToLong | static long bytesToLong(byte[] bytes, int offset) {
long m = 0;
for (int i = 0; i < 8; i++) {
m |= ((((long) bytes[i + offset]) & 0xff) << (8 * i));
}
return m;
} | java | static long bytesToLong(byte[] bytes, int offset) {
long m = 0;
for (int i = 0; i < 8; i++) {
m |= ((((long) bytes[i + offset]) & 0xff) << (8 * i));
}
return m;
} | [
"static",
"long",
"bytesToLong",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
")",
"{",
"long",
"m",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"8",
";",
"i",
"++",
")",
"{",
"m",
"|=",
"(",
"(",
"(",
"(",
"l... | Converts a chunk of 8 bytes to a number in little endian.
Accepts an offset to determine where the chunk begins.
@param bytes
the byte array containing our bytes to convert.
@param offset
the index to start at when chunking bytes.
@return
a long representation, in little endian. | [
"Converts",
"a",
"chunk",
"of",
"8",
"bytes",
"to",
"a",
"number",
"in",
"little",
"endian",
"."
] | train | https://github.com/whitfin/siphash-java/blob/0744d68238bf6d0258154a8152bf2f4537b3cbb8/src/main/java/io/whitfin/siphash/SipHasher.java#L189-L195 |
opsmatters/newrelic-api | src/main/java/com/opsmatters/newrelic/api/httpclient/GsonMessageBodyHandler.java | GsonMessageBodyHandler.writeTo | @Override
public void writeTo(Object object, Class<?> type, Type genericType, Annotation[] annotations,
MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream)
throws IOException, WebApplicationException
{
OutputStreamWriter outputStreamWriter = null;
try
{
outputStreamWriter = new OutputStreamWriter(entityStream, CHARSET);
Type jsonType = getAppropriateType(type, genericType);
String json = getGson().toJson(object, jsonType);
if(logger.isLoggable(Level.FINE))
logger.fine("Outgoing JSON Entity: "+json);
getGson().toJson(object, jsonType, outputStreamWriter);
}
finally
{
if(outputStreamWriter != null)
outputStreamWriter.close();
}
} | java | @Override
public void writeTo(Object object, Class<?> type, Type genericType, Annotation[] annotations,
MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream)
throws IOException, WebApplicationException
{
OutputStreamWriter outputStreamWriter = null;
try
{
outputStreamWriter = new OutputStreamWriter(entityStream, CHARSET);
Type jsonType = getAppropriateType(type, genericType);
String json = getGson().toJson(object, jsonType);
if(logger.isLoggable(Level.FINE))
logger.fine("Outgoing JSON Entity: "+json);
getGson().toJson(object, jsonType, outputStreamWriter);
}
finally
{
if(outputStreamWriter != null)
outputStreamWriter.close();
}
} | [
"@",
"Override",
"public",
"void",
"writeTo",
"(",
"Object",
"object",
",",
"Class",
"<",
"?",
">",
"type",
",",
"Type",
"genericType",
",",
"Annotation",
"[",
"]",
"annotations",
",",
"MediaType",
"mediaType",
",",
"MultivaluedMap",
"<",
"String",
",",
"O... | Write a type to a HTTP message.
@param object The instance to write
@param type The class of instance that is to be written
@param genericType The type of instance to be written
@param annotations An array of the annotations attached to the message entity instance
@param mediaType The media type of the HTTP entity
@param httpHeaders A mutable map of the HTTP message headers
@param entityStream the OutputStream for the HTTP entity | [
"Write",
"a",
"type",
"to",
"a",
"HTTP",
"message",
"."
] | train | https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/httpclient/GsonMessageBodyHandler.java#L325-L346 |
mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/items/AbstractItem.java | AbstractItem.generateView | @Override
public View generateView(Context ctx) {
VH viewHolder = getViewHolder(createView(ctx, null));
//as we already know the type of our ViewHolder cast it to our type
bindView(viewHolder, Collections.EMPTY_LIST);
//return the bound view
return viewHolder.itemView;
} | java | @Override
public View generateView(Context ctx) {
VH viewHolder = getViewHolder(createView(ctx, null));
//as we already know the type of our ViewHolder cast it to our type
bindView(viewHolder, Collections.EMPTY_LIST);
//return the bound view
return viewHolder.itemView;
} | [
"@",
"Override",
"public",
"View",
"generateView",
"(",
"Context",
"ctx",
")",
"{",
"VH",
"viewHolder",
"=",
"getViewHolder",
"(",
"createView",
"(",
"ctx",
",",
"null",
")",
")",
";",
"//as we already know the type of our ViewHolder cast it to our type",
"bindView",
... | generates a view by the defined LayoutRes
@param ctx
@return | [
"generates",
"a",
"view",
"by",
"the",
"defined",
"LayoutRes"
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/items/AbstractItem.java#L256-L265 |
revelc/formatter-maven-plugin | src/main/java/net/revelc/code/formatter/FormatterMojo.java | FormatterMojo.writeStringToFile | private void writeStringToFile(String str, File file) throws IOException {
if (!file.exists() && file.isDirectory()) {
return;
}
try (BufferedWriter bw = new BufferedWriter(WriterFactory.newWriter(file, this.encoding))) {
bw.write(str);
}
} | java | private void writeStringToFile(String str, File file) throws IOException {
if (!file.exists() && file.isDirectory()) {
return;
}
try (BufferedWriter bw = new BufferedWriter(WriterFactory.newWriter(file, this.encoding))) {
bw.write(str);
}
} | [
"private",
"void",
"writeStringToFile",
"(",
"String",
"str",
",",
"File",
"file",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"file",
".",
"exists",
"(",
")",
"&&",
"file",
".",
"isDirectory",
"(",
")",
")",
"{",
"return",
";",
"}",
"try",
"(... | Write the given string to a file.
@param str
the str
@param file
the file
@throws IOException
Signals that an I/O exception has occurred. | [
"Write",
"the",
"given",
"string",
"to",
"a",
"file",
"."
] | train | https://github.com/revelc/formatter-maven-plugin/blob/a237073ce6220e73ad6b1faef412fe0660485cf4/src/main/java/net/revelc/code/formatter/FormatterMojo.java#L621-L629 |
haraldk/TwelveMonkeys | imageio/imageio-metadata/src/main/java/com/twelvemonkeys/imageio/metadata/jpeg/JPEGSegmentUtil.java | JPEGSegmentUtil.readSegments | public static List<JPEGSegment> readSegments(final ImageInputStream stream, final int marker, final String identifier) throws IOException {
return readSegments(stream, Collections.singletonMap(marker, identifier != null ? Collections.singletonList(identifier) : ALL_IDS));
} | java | public static List<JPEGSegment> readSegments(final ImageInputStream stream, final int marker, final String identifier) throws IOException {
return readSegments(stream, Collections.singletonMap(marker, identifier != null ? Collections.singletonList(identifier) : ALL_IDS));
} | [
"public",
"static",
"List",
"<",
"JPEGSegment",
">",
"readSegments",
"(",
"final",
"ImageInputStream",
"stream",
",",
"final",
"int",
"marker",
",",
"final",
"String",
"identifier",
")",
"throws",
"IOException",
"{",
"return",
"readSegments",
"(",
"stream",
",",... | Reads the requested JPEG segments from the stream.
The stream position must be directly before the SOI marker, and only segments for the current image is read.
@param stream the stream to read from.
@param marker the segment marker to read
@param identifier the identifier to read, or {@code null} to match any segment
@return a list of segments with the given app marker and optional identifier. If no segments are found, an
empty list is returned.
@throws IIOException if a JPEG format exception occurs during reading
@throws IOException if an I/O exception occurs during reading | [
"Reads",
"the",
"requested",
"JPEG",
"segments",
"from",
"the",
"stream",
".",
"The",
"stream",
"position",
"must",
"be",
"directly",
"before",
"the",
"SOI",
"marker",
"and",
"only",
"segments",
"for",
"the",
"current",
"image",
"is",
"read",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-metadata/src/main/java/com/twelvemonkeys/imageio/metadata/jpeg/JPEGSegmentUtil.java#L82-L84 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java | SheetResourcesImpl.getSheet | public Sheet getSheet(long id, EnumSet<SheetInclusion> includes, EnumSet<ObjectExclusion> excludes, Set<Long> rowIds, Set<Integer> rowNumbers, Set<Long> columnIds, Integer pageSize, Integer page) throws SmartsheetException {
return this.getSheet(id, includes, excludes, rowIds, rowNumbers, columnIds, pageSize, page, null, null);
} | java | public Sheet getSheet(long id, EnumSet<SheetInclusion> includes, EnumSet<ObjectExclusion> excludes, Set<Long> rowIds, Set<Integer> rowNumbers, Set<Long> columnIds, Integer pageSize, Integer page) throws SmartsheetException {
return this.getSheet(id, includes, excludes, rowIds, rowNumbers, columnIds, pageSize, page, null, null);
} | [
"public",
"Sheet",
"getSheet",
"(",
"long",
"id",
",",
"EnumSet",
"<",
"SheetInclusion",
">",
"includes",
",",
"EnumSet",
"<",
"ObjectExclusion",
">",
"excludes",
",",
"Set",
"<",
"Long",
">",
"rowIds",
",",
"Set",
"<",
"Integer",
">",
"rowNumbers",
",",
... | Get a sheet.
It mirrors to the following Smartsheet REST API method: GET /sheet/{id}
Exceptions:
- InvalidRequestException : if there is any problem with the REST API request
- AuthorizationException : if there is any problem with the REST API authorization(access token)
- ResourceNotFoundException : if the resource can not be found
- ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
- SmartsheetRestException : if there is any other REST API related error occurred during the operation
- SmartsheetException : if there is any other error occurred during the operation
@param id the id
@param includes used to specify the optional objects to include, currently DISCUSSIONS and
ATTACHMENTS are supported.
@param columnIds the column ids
@param excludes the exclude parameters
@param page the page number
@param pageSize the page size
@param rowIds the row ids
@param rowNumbers the row numbers
@return the resource (note that if there is no such resource, this method will throw ResourceNotFoundException
rather than returning null).
@throws SmartsheetException the smartsheet exception | [
"Get",
"a",
"sheet",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java#L226-L228 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/common/abstracts/algorithms/AbstractDPMM.java | AbstractDPMM.getFromClusterMap | private CL getFromClusterMap(int clusterId, Map<Integer, CL> clusterMap) {
CL c = clusterMap.get(clusterId);
if(c.getFeatureIds() == null) {
c.setFeatureIds(knowledgeBase.getModelParameters().getFeatureIds()); //fetch the featureIds from model parameters object
}
return c;
} | java | private CL getFromClusterMap(int clusterId, Map<Integer, CL> clusterMap) {
CL c = clusterMap.get(clusterId);
if(c.getFeatureIds() == null) {
c.setFeatureIds(knowledgeBase.getModelParameters().getFeatureIds()); //fetch the featureIds from model parameters object
}
return c;
} | [
"private",
"CL",
"getFromClusterMap",
"(",
"int",
"clusterId",
",",
"Map",
"<",
"Integer",
",",
"CL",
">",
"clusterMap",
")",
"{",
"CL",
"c",
"=",
"clusterMap",
".",
"get",
"(",
"clusterId",
")",
";",
"if",
"(",
"c",
".",
"getFeatureIds",
"(",
")",
"... | Always use this method to get the cluster from the clusterMap because it
ensures that the featureIds are set.
The featureIds can be unset if we use a data structure which stores
stuff in file. Since the featureIds field of cluster is transient, the
information gets lost. This function ensures that it sets it back.
@param clusterId
@param clusterMap
@return | [
"Always",
"use",
"this",
"method",
"to",
"get",
"the",
"cluster",
"from",
"the",
"clusterMap",
"because",
"it",
"ensures",
"that",
"the",
"featureIds",
"are",
"set",
".",
"The",
"featureIds",
"can",
"be",
"unset",
"if",
"we",
"use",
"a",
"data",
"structure... | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/common/abstracts/algorithms/AbstractDPMM.java#L373-L379 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/IdGenerator.java | IdGenerator.waitTillNextTick | public static long waitTillNextTick(long currentTick, long tickSize) {
long nextBlock = System.currentTimeMillis() / tickSize;
for (; nextBlock <= currentTick; nextBlock = System.currentTimeMillis() / tickSize) {
Thread.yield();
}
return nextBlock;
} | java | public static long waitTillNextTick(long currentTick, long tickSize) {
long nextBlock = System.currentTimeMillis() / tickSize;
for (; nextBlock <= currentTick; nextBlock = System.currentTimeMillis() / tickSize) {
Thread.yield();
}
return nextBlock;
} | [
"public",
"static",
"long",
"waitTillNextTick",
"(",
"long",
"currentTick",
",",
"long",
"tickSize",
")",
"{",
"long",
"nextBlock",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"/",
"tickSize",
";",
"for",
"(",
";",
"nextBlock",
"<=",
"currentTick",
";... | Waits till clock moves to the next tick.
@param currentTick
@param tickSize
tick size in milliseconds
@return the "next" tick | [
"Waits",
"till",
"clock",
"moves",
"to",
"the",
"next",
"tick",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/IdGenerator.java#L190-L196 |
google/closure-templates | java/src/com/google/template/soy/msgs/internal/MsgUtils.java | MsgUtils.buildMsgPartsAndComputeMsgIdForDualFormat | public static MsgPartsAndIds buildMsgPartsAndComputeMsgIdForDualFormat(MsgNode msgNode) {
if (msgNode.isPlrselMsg()) {
MsgPartsAndIds mpai = buildMsgPartsAndComputeMsgIds(msgNode, true);
return new MsgPartsAndIds(mpai.parts, mpai.idUsingBracedPhs, -1L);
} else {
return buildMsgPartsAndComputeMsgIds(msgNode, false);
}
} | java | public static MsgPartsAndIds buildMsgPartsAndComputeMsgIdForDualFormat(MsgNode msgNode) {
if (msgNode.isPlrselMsg()) {
MsgPartsAndIds mpai = buildMsgPartsAndComputeMsgIds(msgNode, true);
return new MsgPartsAndIds(mpai.parts, mpai.idUsingBracedPhs, -1L);
} else {
return buildMsgPartsAndComputeMsgIds(msgNode, false);
}
} | [
"public",
"static",
"MsgPartsAndIds",
"buildMsgPartsAndComputeMsgIdForDualFormat",
"(",
"MsgNode",
"msgNode",
")",
"{",
"if",
"(",
"msgNode",
".",
"isPlrselMsg",
"(",
")",
")",
"{",
"MsgPartsAndIds",
"mpai",
"=",
"buildMsgPartsAndComputeMsgIds",
"(",
"msgNode",
",",
... | Builds the list of SoyMsgParts and computes the unique message id for the given MsgNode,
assuming a specific dual format.
<p>Note: The field {@code idUsingBracedPhs} in the return value is simply set to -1L.
@param msgNode The message parsed from the Soy source.
@return A {@code MsgPartsAndIds} object, assuming a specific dual format, with field {@code
idUsingBracedPhs} set to -1L. | [
"Builds",
"the",
"list",
"of",
"SoyMsgParts",
"and",
"computes",
"the",
"unique",
"message",
"id",
"for",
"the",
"given",
"MsgNode",
"assuming",
"a",
"specific",
"dual",
"format",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/msgs/internal/MsgUtils.java#L77-L85 |
google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/ElementUtil.java | ElementUtil.suppressesWarning | @SuppressWarnings("unchecked")
public static boolean suppressesWarning(String warning, Element element) {
if (element == null || isPackage(element)) {
return false;
}
AnnotationMirror annotation = getAnnotation(element, SuppressWarnings.class);
if (annotation != null) {
for (AnnotationValue elem
: (List<? extends AnnotationValue>) getAnnotationValue(annotation, "value")) {
if (warning.equals(elem.getValue())) {
return true;
}
}
}
return suppressesWarning(warning, element.getEnclosingElement());
} | java | @SuppressWarnings("unchecked")
public static boolean suppressesWarning(String warning, Element element) {
if (element == null || isPackage(element)) {
return false;
}
AnnotationMirror annotation = getAnnotation(element, SuppressWarnings.class);
if (annotation != null) {
for (AnnotationValue elem
: (List<? extends AnnotationValue>) getAnnotationValue(annotation, "value")) {
if (warning.equals(elem.getValue())) {
return true;
}
}
}
return suppressesWarning(warning, element.getEnclosingElement());
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"boolean",
"suppressesWarning",
"(",
"String",
"warning",
",",
"Element",
"element",
")",
"{",
"if",
"(",
"element",
"==",
"null",
"||",
"isPackage",
"(",
"element",
")",
")",
"{",
"retu... | Returns true if there's a SuppressedWarning annotation with the specified warning.
The SuppressWarnings annotation can be inherited from the owning method or class,
but does not have package scope. | [
"Returns",
"true",
"if",
"there",
"s",
"a",
"SuppressedWarning",
"annotation",
"with",
"the",
"specified",
"warning",
".",
"The",
"SuppressWarnings",
"annotation",
"can",
"be",
"inherited",
"from",
"the",
"owning",
"method",
"or",
"class",
"but",
"does",
"not",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/ElementUtil.java#L769-L784 |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/media/impl/MediaFormatResolver.java | MediaFormatResolver.addResponsiveImageMediaFormats | private boolean addResponsiveImageMediaFormats(MediaArgs mediaArgs) {
Map<String, MediaFormat> additionalMediaFormats = new LinkedHashMap<>();
// check if additional on-the-fly generated media formats needs to be added for responsive image handling
if (!resolveForImageSizes(mediaArgs, additionalMediaFormats)) {
return false;
}
if (!resolveForResponsivePictureSources(mediaArgs, additionalMediaFormats)) {
return false;
}
// if additional media formats where found add them to the media format list in media args
if (!additionalMediaFormats.isEmpty()) {
List<MediaFormat> allMediaFormats = new ArrayList<>();
if (mediaArgs.getMediaFormats() != null) {
allMediaFormats.addAll(Arrays.asList(mediaArgs.getMediaFormats()));
}
allMediaFormats.addAll(additionalMediaFormats.values());
mediaArgs.mediaFormats(allMediaFormats.toArray(new MediaFormat[allMediaFormats.size()]));
}
return true;
} | java | private boolean addResponsiveImageMediaFormats(MediaArgs mediaArgs) {
Map<String, MediaFormat> additionalMediaFormats = new LinkedHashMap<>();
// check if additional on-the-fly generated media formats needs to be added for responsive image handling
if (!resolveForImageSizes(mediaArgs, additionalMediaFormats)) {
return false;
}
if (!resolveForResponsivePictureSources(mediaArgs, additionalMediaFormats)) {
return false;
}
// if additional media formats where found add them to the media format list in media args
if (!additionalMediaFormats.isEmpty()) {
List<MediaFormat> allMediaFormats = new ArrayList<>();
if (mediaArgs.getMediaFormats() != null) {
allMediaFormats.addAll(Arrays.asList(mediaArgs.getMediaFormats()));
}
allMediaFormats.addAll(additionalMediaFormats.values());
mediaArgs.mediaFormats(allMediaFormats.toArray(new MediaFormat[allMediaFormats.size()]));
}
return true;
} | [
"private",
"boolean",
"addResponsiveImageMediaFormats",
"(",
"MediaArgs",
"mediaArgs",
")",
"{",
"Map",
"<",
"String",
",",
"MediaFormat",
">",
"additionalMediaFormats",
"=",
"new",
"LinkedHashMap",
"<>",
"(",
")",
";",
"// check if additional on-the-fly generated media f... | Add on-the-fly generated media formats if required for responsive image handling
via image sizes or picture sources.
@param mediaArgs Media args
@return true if resolution was successful | [
"Add",
"on",
"-",
"the",
"-",
"fly",
"generated",
"media",
"formats",
"if",
"required",
"for",
"responsive",
"image",
"handling",
"via",
"image",
"sizes",
"or",
"picture",
"sources",
"."
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/media/impl/MediaFormatResolver.java#L99-L121 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2017_03_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_03_01/implementation/RegistriesInner.java | RegistriesInner.getByResourceGroup | public RegistryInner getByResourceGroup(String resourceGroupName, String registryName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, registryName).toBlocking().single().body();
} | java | public RegistryInner getByResourceGroup(String resourceGroupName, String registryName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, registryName).toBlocking().single().body();
} | [
"public",
"RegistryInner",
"getByResourceGroup",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",
")",
".",
"toBlocking",
"(",
")",
".",
"s... | Gets the properties of the specified container registry.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@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 RegistryInner object if successful. | [
"Gets",
"the",
"properties",
"of",
"the",
"specified",
"container",
"registry",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_03_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_03_01/implementation/RegistriesInner.java#L215-L217 |
alkacon/opencms-core | src/org/opencms/site/CmsSiteManagerImpl.java | CmsSiteManagerImpl.updateSite | public void updateSite(CmsObject cms, CmsSite oldSite, CmsSite newSite) throws CmsException {
if (oldSite != null) {
// remove the old site
removeSite(cms, oldSite);
}
if (newSite != null) {
// add the new site
addSite(cms, newSite);
}
} | java | public void updateSite(CmsObject cms, CmsSite oldSite, CmsSite newSite) throws CmsException {
if (oldSite != null) {
// remove the old site
removeSite(cms, oldSite);
}
if (newSite != null) {
// add the new site
addSite(cms, newSite);
}
} | [
"public",
"void",
"updateSite",
"(",
"CmsObject",
"cms",
",",
"CmsSite",
"oldSite",
",",
"CmsSite",
"newSite",
")",
"throws",
"CmsException",
"{",
"if",
"(",
"oldSite",
"!=",
"null",
")",
"{",
"// remove the old site",
"removeSite",
"(",
"cms",
",",
"oldSite",... | Updates or creates a site.<p>
@param cms the CMS object
@param oldSite the site to remove if not <code>null</code>
@param newSite the site to add if not <code>null</code>
@throws CmsException if something goes wrong | [
"Updates",
"or",
"creates",
"a",
"site",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/site/CmsSiteManagerImpl.java#L1592-L1603 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/config/CommonConfigUtils.java | CommonConfigUtils.getLongConfigAttribute | public long getLongConfigAttribute(Map<String, Object> props, String key, long defaultValue) {
if (props.containsKey(key)) {
return (Long) props.get(key);
}
return defaultValue;
} | java | public long getLongConfigAttribute(Map<String, Object> props, String key, long defaultValue) {
if (props.containsKey(key)) {
return (Long) props.get(key);
}
return defaultValue;
} | [
"public",
"long",
"getLongConfigAttribute",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"props",
",",
"String",
"key",
",",
"long",
"defaultValue",
")",
"{",
"if",
"(",
"props",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"return",
"(",
"Long",
"... | Returns the value for the configuration attribute matching the key provided. If the value does not exist or is empty, the
provided default value will be returned. | [
"Returns",
"the",
"value",
"for",
"the",
"configuration",
"attribute",
"matching",
"the",
"key",
"provided",
".",
"If",
"the",
"value",
"does",
"not",
"exist",
"or",
"is",
"empty",
"the",
"provided",
"default",
"value",
"will",
"be",
"returned",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/config/CommonConfigUtils.java#L152-L157 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/process/ProcessFaxClientSpi.java | ProcessFaxClientSpi.createProcessCommand | protected String createProcessCommand(Enum<?> templateNameEnum,FaxJob faxJob)
{
//get template name
String templateName=templateNameEnum.toString();
//get template
String template=this.getTemplate(templateName);
String command=null;
if(template!=null)
{
//format template
command=this.formatTemplate(template,faxJob);
}
return command;
} | java | protected String createProcessCommand(Enum<?> templateNameEnum,FaxJob faxJob)
{
//get template name
String templateName=templateNameEnum.toString();
//get template
String template=this.getTemplate(templateName);
String command=null;
if(template!=null)
{
//format template
command=this.formatTemplate(template,faxJob);
}
return command;
} | [
"protected",
"String",
"createProcessCommand",
"(",
"Enum",
"<",
"?",
">",
"templateNameEnum",
",",
"FaxJob",
"faxJob",
")",
"{",
"//get template name",
"String",
"templateName",
"=",
"templateNameEnum",
".",
"toString",
"(",
")",
";",
"//get template",
"String",
... | Creates the process command from the fax job data.
@param templateNameEnum
The template name
@param faxJob
The fax job object
@return The process command to execute | [
"Creates",
"the",
"process",
"command",
"from",
"the",
"fax",
"job",
"data",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/process/ProcessFaxClientSpi.java#L538-L553 |
JOML-CI/JOML | src/org/joml/Matrix4x3f.java | Matrix4x3f.rotateLocal | public Matrix4x3f rotateLocal(float ang, float x, float y, float z, Matrix4x3f dest) {
float s = (float) Math.sin(ang);
float c = (float) Math.cosFromSin(s, ang);
float C = 1.0f - c;
float xx = x * x, xy = x * y, xz = x * z;
float yy = y * y, yz = y * z;
float zz = z * z;
float lm00 = xx * C + c;
float lm01 = xy * C + z * s;
float lm02 = xz * C - y * s;
float lm10 = xy * C - z * s;
float lm11 = yy * C + c;
float lm12 = yz * C + x * s;
float lm20 = xz * C + y * s;
float lm21 = yz * C - x * s;
float lm22 = zz * C + c;
float nm00 = lm00 * m00 + lm10 * m01 + lm20 * m02;
float nm01 = lm01 * m00 + lm11 * m01 + lm21 * m02;
float nm02 = lm02 * m00 + lm12 * m01 + lm22 * m02;
float nm10 = lm00 * m10 + lm10 * m11 + lm20 * m12;
float nm11 = lm01 * m10 + lm11 * m11 + lm21 * m12;
float nm12 = lm02 * m10 + lm12 * m11 + lm22 * m12;
float nm20 = lm00 * m20 + lm10 * m21 + lm20 * m22;
float nm21 = lm01 * m20 + lm11 * m21 + lm21 * m22;
float nm22 = lm02 * m20 + lm12 * m21 + lm22 * m22;
float nm30 = lm00 * m30 + lm10 * m31 + lm20 * m32;
float nm31 = lm01 * m30 + lm11 * m31 + lm21 * m32;
float nm32 = lm02 * m30 + lm12 * m31 + lm22 * m32;
dest.m00 = nm00;
dest.m01 = nm01;
dest.m02 = nm02;
dest.m10 = nm10;
dest.m11 = nm11;
dest.m12 = nm12;
dest.m20 = nm20;
dest.m21 = nm21;
dest.m22 = nm22;
dest.m30 = nm30;
dest.m31 = nm31;
dest.m32 = nm32;
dest.properties = properties & ~(PROPERTY_IDENTITY | PROPERTY_TRANSLATION);
return dest;
} | java | public Matrix4x3f rotateLocal(float ang, float x, float y, float z, Matrix4x3f dest) {
float s = (float) Math.sin(ang);
float c = (float) Math.cosFromSin(s, ang);
float C = 1.0f - c;
float xx = x * x, xy = x * y, xz = x * z;
float yy = y * y, yz = y * z;
float zz = z * z;
float lm00 = xx * C + c;
float lm01 = xy * C + z * s;
float lm02 = xz * C - y * s;
float lm10 = xy * C - z * s;
float lm11 = yy * C + c;
float lm12 = yz * C + x * s;
float lm20 = xz * C + y * s;
float lm21 = yz * C - x * s;
float lm22 = zz * C + c;
float nm00 = lm00 * m00 + lm10 * m01 + lm20 * m02;
float nm01 = lm01 * m00 + lm11 * m01 + lm21 * m02;
float nm02 = lm02 * m00 + lm12 * m01 + lm22 * m02;
float nm10 = lm00 * m10 + lm10 * m11 + lm20 * m12;
float nm11 = lm01 * m10 + lm11 * m11 + lm21 * m12;
float nm12 = lm02 * m10 + lm12 * m11 + lm22 * m12;
float nm20 = lm00 * m20 + lm10 * m21 + lm20 * m22;
float nm21 = lm01 * m20 + lm11 * m21 + lm21 * m22;
float nm22 = lm02 * m20 + lm12 * m21 + lm22 * m22;
float nm30 = lm00 * m30 + lm10 * m31 + lm20 * m32;
float nm31 = lm01 * m30 + lm11 * m31 + lm21 * m32;
float nm32 = lm02 * m30 + lm12 * m31 + lm22 * m32;
dest.m00 = nm00;
dest.m01 = nm01;
dest.m02 = nm02;
dest.m10 = nm10;
dest.m11 = nm11;
dest.m12 = nm12;
dest.m20 = nm20;
dest.m21 = nm21;
dest.m22 = nm22;
dest.m30 = nm30;
dest.m31 = nm31;
dest.m32 = nm32;
dest.properties = properties & ~(PROPERTY_IDENTITY | PROPERTY_TRANSLATION);
return dest;
} | [
"public",
"Matrix4x3f",
"rotateLocal",
"(",
"float",
"ang",
",",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
",",
"Matrix4x3f",
"dest",
")",
"{",
"float",
"s",
"=",
"(",
"float",
")",
"Math",
".",
"sin",
"(",
"ang",
")",
";",
"float",
"c",
... | Pre-multiply a rotation to this matrix by rotating the given amount of radians
about the specified <code>(x, y, z)</code> axis and store the result in <code>dest</code>.
<p>
The axis described by the three components needs to be a unit vector.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix,
then the new matrix will be <code>R * M</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>R * M * v</code>, the
rotation will be applied last!
<p>
In order to set the matrix to a rotation matrix without pre-multiplying the rotation
transformation, use {@link #rotation(float, float, float, float) rotation()}.
<p>
Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle">http://en.wikipedia.org</a>
@see #rotation(float, float, float, float)
@param ang
the angle in radians
@param x
the x component of the axis
@param y
the y component of the axis
@param z
the z component of the axis
@param dest
will hold the result
@return dest | [
"Pre",
"-",
"multiply",
"a",
"rotation",
"to",
"this",
"matrix",
"by",
"rotating",
"the",
"given",
"amount",
"of",
"radians",
"about",
"the",
"specified",
"<code",
">",
"(",
"x",
"y",
"z",
")",
"<",
"/",
"code",
">",
"axis",
"and",
"store",
"the",
"r... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L4138-L4180 |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRepositoryAuditor.java | XDSRepositoryAuditor.auditProvideAndRegisterEvent | protected void auditProvideAndRegisterEvent (
IHETransactionEventTypeCodes transaction,
RFC3881EventOutcomeCodes eventOutcome,
String sourceUserId, String sourceIpAddress,
String userName,
String repositoryEndpointUri,
String submissionSetUniqueId,
String patientId,
List<CodedValueType> purposesOfUse,
List<CodedValueType> userRoles)
{
ImportEvent importEvent = new ImportEvent(false, eventOutcome, transaction, purposesOfUse);
importEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId());
importEvent.addSourceActiveParticipant(sourceUserId, null, null, sourceIpAddress, true);
if (!EventUtils.isEmptyOrNull(userName)) {
importEvent.addHumanRequestorActiveParticipant(userName, null, userName, userRoles);
}
importEvent.addDestinationActiveParticipant(repositoryEndpointUri, getSystemAltUserId(), null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false);
if (!EventUtils.isEmptyOrNull(patientId)) {
importEvent.addPatientParticipantObject(patientId);
}
importEvent.addSubmissionSetParticipantObject(submissionSetUniqueId);
audit(importEvent);
} | java | protected void auditProvideAndRegisterEvent (
IHETransactionEventTypeCodes transaction,
RFC3881EventOutcomeCodes eventOutcome,
String sourceUserId, String sourceIpAddress,
String userName,
String repositoryEndpointUri,
String submissionSetUniqueId,
String patientId,
List<CodedValueType> purposesOfUse,
List<CodedValueType> userRoles)
{
ImportEvent importEvent = new ImportEvent(false, eventOutcome, transaction, purposesOfUse);
importEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId());
importEvent.addSourceActiveParticipant(sourceUserId, null, null, sourceIpAddress, true);
if (!EventUtils.isEmptyOrNull(userName)) {
importEvent.addHumanRequestorActiveParticipant(userName, null, userName, userRoles);
}
importEvent.addDestinationActiveParticipant(repositoryEndpointUri, getSystemAltUserId(), null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false);
if (!EventUtils.isEmptyOrNull(patientId)) {
importEvent.addPatientParticipantObject(patientId);
}
importEvent.addSubmissionSetParticipantObject(submissionSetUniqueId);
audit(importEvent);
} | [
"protected",
"void",
"auditProvideAndRegisterEvent",
"(",
"IHETransactionEventTypeCodes",
"transaction",
",",
"RFC3881EventOutcomeCodes",
"eventOutcome",
",",
"String",
"sourceUserId",
",",
"String",
"sourceIpAddress",
",",
"String",
"userName",
",",
"String",
"repositoryEndp... | Generically sends audit messages for XDS Document Repository Provide And Register Document Set events
@param transaction The specific IHE Transaction (ITI-15 or ITI-41)
@param eventOutcome The event outcome indicator
@param sourceUserId The Active Participant UserID for the document consumer (if using WS-Addressing)
@param sourceIpAddress The IP address of the document source that initiated the transaction
@param repositoryEndpointUri The Web service endpoint URI for this document repository
@param submissionSetUniqueId The UniqueID of the Submission Set registered
@param patientId The Patient Id that this submission pertains to
@param purposesOfUse purpose of use codes (may be taken from XUA token)
@param userRoles roles of the human user (may be taken from XUA token) | [
"Generically",
"sends",
"audit",
"messages",
"for",
"XDS",
"Document",
"Repository",
"Provide",
"And",
"Register",
"Document",
"Set",
"events"
] | train | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRepositoryAuditor.java#L378-L402 |
jMotif/SAX | src/main/java/net/seninp/jmotif/distance/EuclideanDistance.java | EuclideanDistance.seriesDistance | public double seriesDistance(double[][] series1, double[][] series2) throws Exception {
if (series1.length == series2.length) {
Double res = 0D;
for (int i = 0; i < series1.length; i++) {
res = res + distance2(series1[i], series2[i]);
}
return Math.sqrt(res);
}
else {
throw new Exception("Exception in Euclidean distance: array lengths are not equal");
}
} | java | public double seriesDistance(double[][] series1, double[][] series2) throws Exception {
if (series1.length == series2.length) {
Double res = 0D;
for (int i = 0; i < series1.length; i++) {
res = res + distance2(series1[i], series2[i]);
}
return Math.sqrt(res);
}
else {
throw new Exception("Exception in Euclidean distance: array lengths are not equal");
}
} | [
"public",
"double",
"seriesDistance",
"(",
"double",
"[",
"]",
"[",
"]",
"series1",
",",
"double",
"[",
"]",
"[",
"]",
"series2",
")",
"throws",
"Exception",
"{",
"if",
"(",
"series1",
".",
"length",
"==",
"series2",
".",
"length",
")",
"{",
"Double",
... | Calculates Euclidean distance between two multi-dimensional time-series of equal length.
@param series1 The first series.
@param series2 The second series.
@return The eclidean distance.
@throws Exception if error occures. | [
"Calculates",
"Euclidean",
"distance",
"between",
"two",
"multi",
"-",
"dimensional",
"time",
"-",
"series",
"of",
"equal",
"length",
"."
] | train | https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/distance/EuclideanDistance.java#L119-L130 |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/AbstractHttpTransport.java | AbstractHttpTransport.getParameter | protected static String getParameter(HttpServletRequest request, String[] aliases) {
final String sourceMethod = "getParameter"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(sourceClass, sourceMethod, new Object[]{request.getQueryString(), Arrays.asList(aliases)});
}
Map<String, String[]> params = request.getParameterMap();
String result = null;
for (Map.Entry<String, String[]> entry : params.entrySet()) {
String name = entry.getKey();
for (String alias : aliases) {
if (alias.equalsIgnoreCase(name)) {
String[] values = entry.getValue();
result = values[values.length-1]; // return last value in array
}
}
}
if (isTraceLogging) {
log.exiting(sourceClass, sourceMethod, result);
}
return result;
} | java | protected static String getParameter(HttpServletRequest request, String[] aliases) {
final String sourceMethod = "getParameter"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(sourceClass, sourceMethod, new Object[]{request.getQueryString(), Arrays.asList(aliases)});
}
Map<String, String[]> params = request.getParameterMap();
String result = null;
for (Map.Entry<String, String[]> entry : params.entrySet()) {
String name = entry.getKey();
for (String alias : aliases) {
if (alias.equalsIgnoreCase(name)) {
String[] values = entry.getValue();
result = values[values.length-1]; // return last value in array
}
}
}
if (isTraceLogging) {
log.exiting(sourceClass, sourceMethod, result);
}
return result;
} | [
"protected",
"static",
"String",
"getParameter",
"(",
"HttpServletRequest",
"request",
",",
"String",
"[",
"]",
"aliases",
")",
"{",
"final",
"String",
"sourceMethod",
"=",
"\"getParameter\"",
";",
"//$NON-NLS-1$\r",
"boolean",
"isTraceLogging",
"=",
"log",
".",
"... | Returns the value of the requested parameter from the request, or null
@param request
the request object
@param aliases
array of query arg names by which the request may be specified
@return the value of the param, or null if it is not specified under the
specified names | [
"Returns",
"the",
"value",
"of",
"the",
"requested",
"parameter",
"from",
"the",
"request",
"or",
"null"
] | train | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/AbstractHttpTransport.java#L506-L527 |
astrapi69/jaulp-wicket | jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/application/OnlineSessionUsers.java | OnlineSessionUsers.replaceSessionId | public synchronized ID replaceSessionId(final USER user, final ID oldSessionId,
final ID newSessionId, final SESSION newSession)
{
remove(oldSessionId);
return addOnline(user, newSessionId, newSession);
} | java | public synchronized ID replaceSessionId(final USER user, final ID oldSessionId,
final ID newSessionId, final SESSION newSession)
{
remove(oldSessionId);
return addOnline(user, newSessionId, newSession);
} | [
"public",
"synchronized",
"ID",
"replaceSessionId",
"(",
"final",
"USER",
"user",
",",
"final",
"ID",
"oldSessionId",
",",
"final",
"ID",
"newSessionId",
",",
"final",
"SESSION",
"newSession",
")",
"{",
"remove",
"(",
"oldSessionId",
")",
";",
"return",
"addOn... | Replace the given old session id with the new one.
@param user
the user
@param oldSessionId
the old session id
@param newSessionId
the new session id
@param newSession
the new session object
@return the new session id that is associated with the given user. | [
"Replace",
"the",
"given",
"old",
"session",
"id",
"with",
"the",
"new",
"one",
"."
] | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/application/OnlineSessionUsers.java#L129-L134 |
qcloudsms/qcloudsms_java | src/main/java/com/github/qcloudsms/VoiceFileStatus.java | VoiceFileStatus.get | public VoiceFileStatusResult get(String fid)
throws HTTPException, JSONException, IOException {
long random = SmsSenderUtil.getRandom();
long now = SmsSenderUtil.getCurrentTime();
JSONObject body = new JSONObject()
.put("fid", fid)
.put("sig", SmsSenderUtil.calculateFStatusSignature(
this.appkey, random, now, fid))
.put("time", now);
HTTPRequest req = new HTTPRequest(HTTPMethod.POST, this.url)
.addHeader("Conetent-Type", "application/json")
.addQueryParameter("sdkappid", this.appid)
.addQueryParameter("random", random)
.setConnectionTimeout(60 * 1000)
.setRequestTimeout(60 * 1000)
.setBody(body.toString());
try {
// May throw IOException and URISyntaxexception
HTTPResponse res = httpclient.fetch(req);
// May throw HTTPException
handleError(res);
// May throw JSONException
return (new VoiceFileStatusResult()).parseFromHTTPResponse(res);
} catch(URISyntaxException e) {
throw new RuntimeException("API url has been modified, current url: " + url);
}
} | java | public VoiceFileStatusResult get(String fid)
throws HTTPException, JSONException, IOException {
long random = SmsSenderUtil.getRandom();
long now = SmsSenderUtil.getCurrentTime();
JSONObject body = new JSONObject()
.put("fid", fid)
.put("sig", SmsSenderUtil.calculateFStatusSignature(
this.appkey, random, now, fid))
.put("time", now);
HTTPRequest req = new HTTPRequest(HTTPMethod.POST, this.url)
.addHeader("Conetent-Type", "application/json")
.addQueryParameter("sdkappid", this.appid)
.addQueryParameter("random", random)
.setConnectionTimeout(60 * 1000)
.setRequestTimeout(60 * 1000)
.setBody(body.toString());
try {
// May throw IOException and URISyntaxexception
HTTPResponse res = httpclient.fetch(req);
// May throw HTTPException
handleError(res);
// May throw JSONException
return (new VoiceFileStatusResult()).parseFromHTTPResponse(res);
} catch(URISyntaxException e) {
throw new RuntimeException("API url has been modified, current url: " + url);
}
} | [
"public",
"VoiceFileStatusResult",
"get",
"(",
"String",
"fid",
")",
"throws",
"HTTPException",
",",
"JSONException",
",",
"IOException",
"{",
"long",
"random",
"=",
"SmsSenderUtil",
".",
"getRandom",
"(",
")",
";",
"long",
"now",
"=",
"SmsSenderUtil",
".",
"g... | 查询语音文件审核状态
@param fid 语音文件fid
@return {@link}VoiceFileStatusResult
@throws HTTPException http status exception
@throws JSONException json parse exception
@throws IOException network problem | [
"查询语音文件审核状态"
] | train | https://github.com/qcloudsms/qcloudsms_java/blob/920ba838b4fdafcbf684e71bb09846de72294eea/src/main/java/com/github/qcloudsms/VoiceFileStatus.java#L39-L70 |
grpc/grpc-java | api/src/main/java/io/grpc/ServiceProviders.java | ServiceProviders.getCandidatesViaHardCoded | @VisibleForTesting
static <T> Iterable<T> getCandidatesViaHardCoded(Class<T> klass, Iterable<Class<?>> hardcoded) {
List<T> list = new ArrayList<>();
for (Class<?> candidate : hardcoded) {
list.add(create(klass, candidate));
}
return list;
} | java | @VisibleForTesting
static <T> Iterable<T> getCandidatesViaHardCoded(Class<T> klass, Iterable<Class<?>> hardcoded) {
List<T> list = new ArrayList<>();
for (Class<?> candidate : hardcoded) {
list.add(create(klass, candidate));
}
return list;
} | [
"@",
"VisibleForTesting",
"static",
"<",
"T",
">",
"Iterable",
"<",
"T",
">",
"getCandidatesViaHardCoded",
"(",
"Class",
"<",
"T",
">",
"klass",
",",
"Iterable",
"<",
"Class",
"<",
"?",
">",
">",
"hardcoded",
")",
"{",
"List",
"<",
"T",
">",
"list",
... | Load providers from a hard-coded list. This avoids using getResource(), which has performance
problems on Android (see https://github.com/grpc/grpc-java/issues/2037). | [
"Load",
"providers",
"from",
"a",
"hard",
"-",
"coded",
"list",
".",
"This",
"avoids",
"using",
"getResource",
"()",
"which",
"has",
"performance",
"problems",
"on",
"Android",
"(",
"see",
"https",
":",
"//",
"github",
".",
"com",
"/",
"grpc",
"/",
"grpc... | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/api/src/main/java/io/grpc/ServiceProviders.java#L121-L128 |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/http/converter/json/MappingJackson2HttpMessageConverter.java | MappingJackson2HttpMessageConverter.getJavaType | protected JavaType getJavaType(Type type, Class<?> contextClass) {
return (contextClass != null) ?
this.objectMapper.getTypeFactory().constructType(type, contextClass) :
this.objectMapper.constructType(type);
} | java | protected JavaType getJavaType(Type type, Class<?> contextClass) {
return (contextClass != null) ?
this.objectMapper.getTypeFactory().constructType(type, contextClass) :
this.objectMapper.constructType(type);
} | [
"protected",
"JavaType",
"getJavaType",
"(",
"Type",
"type",
",",
"Class",
"<",
"?",
">",
"contextClass",
")",
"{",
"return",
"(",
"contextClass",
"!=",
"null",
")",
"?",
"this",
".",
"objectMapper",
".",
"getTypeFactory",
"(",
")",
".",
"constructType",
"... | Return the Jackson {@link JavaType} for the specified type and context class.
<p>The default implementation returns {@link ObjectMapper#constructType(java.lang.reflect.Type)}
or {@code ObjectMapper.getTypeFactory().constructType(type, contextClass)},
but this can be overridden in subclasses, to allow for custom generic collection handling.
For instance:
<pre class="code">
protected JavaType getJavaType(Type type) {
if (type instanceof Class && List.class.isAssignableFrom((Class)type)) {
return TypeFactory.collectionType(ArrayList.class, MyBean.class);
} else {
return super.getJavaType(type);
}
}
</pre>
@param type the type to return the java type for
@param contextClass a context class for the target type, for example a class
in which the target type appears in a method signature, can be {@code null}
signature, can be {@code null}
@return the java type | [
"Return",
"the",
"Jackson",
"{"
] | train | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/converter/json/MappingJackson2HttpMessageConverter.java#L232-L236 |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple3.java | Tuple3.setFields | public void setFields(T0 value0, T1 value1, T2 value2) {
this.f0 = value0;
this.f1 = value1;
this.f2 = value2;
} | java | public void setFields(T0 value0, T1 value1, T2 value2) {
this.f0 = value0;
this.f1 = value1;
this.f2 = value2;
} | [
"public",
"void",
"setFields",
"(",
"T0",
"value0",
",",
"T1",
"value1",
",",
"T2",
"value2",
")",
"{",
"this",
".",
"f0",
"=",
"value0",
";",
"this",
".",
"f1",
"=",
"value1",
";",
"this",
".",
"f2",
"=",
"value2",
";",
"}"
] | Sets new values to all fields of the tuple.
@param value0 The value for field 0
@param value1 The value for field 1
@param value2 The value for field 2 | [
"Sets",
"new",
"values",
"to",
"all",
"fields",
"of",
"the",
"tuple",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple3.java#L120-L124 |
jenkinsci/artifactory-plugin | src/main/java/org/jfrog/hudson/release/gradle/GradlePropertiesTransformer.java | GradlePropertiesTransformer.invoke | public Boolean invoke(File propertiesFile, VirtualChannel channel) throws IOException, InterruptedException {
if (!propertiesFile.exists()) {
throw new AbortException("Couldn't find properties file: " + propertiesFile.getAbsolutePath());
}
PropertiesTransformer transformer = new PropertiesTransformer(propertiesFile, versionsByName);
return transformer.transform();
} | java | public Boolean invoke(File propertiesFile, VirtualChannel channel) throws IOException, InterruptedException {
if (!propertiesFile.exists()) {
throw new AbortException("Couldn't find properties file: " + propertiesFile.getAbsolutePath());
}
PropertiesTransformer transformer = new PropertiesTransformer(propertiesFile, versionsByName);
return transformer.transform();
} | [
"public",
"Boolean",
"invoke",
"(",
"File",
"propertiesFile",
",",
"VirtualChannel",
"channel",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"if",
"(",
"!",
"propertiesFile",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"AbortException",... | {@inheritDoc}
@return {@code True} in case the properties file was modified during the transformation. {@code false} otherwise | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/release/gradle/GradlePropertiesTransformer.java#L45-L51 |
apache/spark | common/network-common/src/main/java/org/apache/spark/network/TransportContext.java | TransportContext.createChannelHandler | private TransportChannelHandler createChannelHandler(Channel channel, RpcHandler rpcHandler) {
TransportResponseHandler responseHandler = new TransportResponseHandler(channel);
TransportClient client = new TransportClient(channel, responseHandler);
TransportRequestHandler requestHandler = new TransportRequestHandler(channel, client,
rpcHandler, conf.maxChunksBeingTransferred());
return new TransportChannelHandler(client, responseHandler, requestHandler,
conf.connectionTimeoutMs(), closeIdleConnections, this);
} | java | private TransportChannelHandler createChannelHandler(Channel channel, RpcHandler rpcHandler) {
TransportResponseHandler responseHandler = new TransportResponseHandler(channel);
TransportClient client = new TransportClient(channel, responseHandler);
TransportRequestHandler requestHandler = new TransportRequestHandler(channel, client,
rpcHandler, conf.maxChunksBeingTransferred());
return new TransportChannelHandler(client, responseHandler, requestHandler,
conf.connectionTimeoutMs(), closeIdleConnections, this);
} | [
"private",
"TransportChannelHandler",
"createChannelHandler",
"(",
"Channel",
"channel",
",",
"RpcHandler",
"rpcHandler",
")",
"{",
"TransportResponseHandler",
"responseHandler",
"=",
"new",
"TransportResponseHandler",
"(",
"channel",
")",
";",
"TransportClient",
"client",
... | Creates the server- and client-side handler which is used to handle both RequestMessages and
ResponseMessages. The channel is expected to have been successfully created, though certain
properties (such as the remoteAddress()) may not be available yet. | [
"Creates",
"the",
"server",
"-",
"and",
"client",
"-",
"side",
"handler",
"which",
"is",
"used",
"to",
"handle",
"both",
"RequestMessages",
"and",
"ResponseMessages",
".",
"The",
"channel",
"is",
"expected",
"to",
"have",
"been",
"successfully",
"created",
"th... | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/TransportContext.java#L217-L224 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GPXTablesFactory.java | GPXTablesFactory.createTrackTable | public static PreparedStatement createTrackTable(Connection connection, String trackTableName,boolean isH2) throws SQLException {
try (Statement stmt = connection.createStatement()) {
StringBuilder sb = new StringBuilder("CREATE TABLE ");
sb.append(trackTableName).append(" (");
if (isH2) {
sb.append("the_geom MULTILINESTRING CHECK ST_SRID(THE_GEOM) = 4326,");
} else {
sb.append("the_geom GEOMETRY(MULTILINESTRING, 4326),");
}
sb.append(" id INT,");
sb.append(GPXTags.NAME.toLowerCase()).append(" TEXT,");
sb.append(GPXTags.CMT.toLowerCase()).append(" TEXT,");
sb.append("description").append(" TEXT,");
sb.append(GPXTags.SRC.toLowerCase()).append(" TEXT,");
sb.append(GPXTags.HREF.toLowerCase()).append(" TEXT,");
sb.append(GPXTags.HREFTITLE.toLowerCase()).append(" TEXT,");
sb.append(GPXTags.NUMBER.toLowerCase()).append(" INT,");
sb.append(GPXTags.TYPE.toLowerCase()).append(" TEXT,");
sb.append(GPXTags.EXTENSIONS.toLowerCase()).append(" TEXT);");
stmt.execute(sb.toString());
}
//We return the preparedstatement of the route table
StringBuilder insert = new StringBuilder("INSERT INTO ").append(trackTableName).append(" VALUES ( ?");
for (int i = 1; i < GpxMetadata.RTEFIELDCOUNT; i++) {
insert.append(",?");
}
insert.append(");");
return connection.prepareStatement(insert.toString());
} | java | public static PreparedStatement createTrackTable(Connection connection, String trackTableName,boolean isH2) throws SQLException {
try (Statement stmt = connection.createStatement()) {
StringBuilder sb = new StringBuilder("CREATE TABLE ");
sb.append(trackTableName).append(" (");
if (isH2) {
sb.append("the_geom MULTILINESTRING CHECK ST_SRID(THE_GEOM) = 4326,");
} else {
sb.append("the_geom GEOMETRY(MULTILINESTRING, 4326),");
}
sb.append(" id INT,");
sb.append(GPXTags.NAME.toLowerCase()).append(" TEXT,");
sb.append(GPXTags.CMT.toLowerCase()).append(" TEXT,");
sb.append("description").append(" TEXT,");
sb.append(GPXTags.SRC.toLowerCase()).append(" TEXT,");
sb.append(GPXTags.HREF.toLowerCase()).append(" TEXT,");
sb.append(GPXTags.HREFTITLE.toLowerCase()).append(" TEXT,");
sb.append(GPXTags.NUMBER.toLowerCase()).append(" INT,");
sb.append(GPXTags.TYPE.toLowerCase()).append(" TEXT,");
sb.append(GPXTags.EXTENSIONS.toLowerCase()).append(" TEXT);");
stmt.execute(sb.toString());
}
//We return the preparedstatement of the route table
StringBuilder insert = new StringBuilder("INSERT INTO ").append(trackTableName).append(" VALUES ( ?");
for (int i = 1; i < GpxMetadata.RTEFIELDCOUNT; i++) {
insert.append(",?");
}
insert.append(");");
return connection.prepareStatement(insert.toString());
} | [
"public",
"static",
"PreparedStatement",
"createTrackTable",
"(",
"Connection",
"connection",
",",
"String",
"trackTableName",
",",
"boolean",
"isH2",
")",
"throws",
"SQLException",
"{",
"try",
"(",
"Statement",
"stmt",
"=",
"connection",
".",
"createStatement",
"("... | Creat the track table
@param connection
@param trackTableName
@param isH2 set true if it's an H2 database
@return
@throws SQLException | [
"Creat",
"the",
"track",
"table"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GPXTablesFactory.java#L204-L233 |
sarl/sarl | main/coreplugins/io.sarl.m2e/src/io/sarl/m2e/wizards/importproject/ImportMavenSarlProjectWizard.java | ImportMavenSarlProjectWizard.createImportJob | protected WorkspaceJob createImportJob(Collection<MavenProjectInfo> projects) {
final WorkspaceJob job = new ImportMavenSarlProjectsJob(projects, this.workingSets, this.importConfiguration);
job.setRule(MavenPlugin.getProjectConfigurationManager().getRule());
return job;
} | java | protected WorkspaceJob createImportJob(Collection<MavenProjectInfo> projects) {
final WorkspaceJob job = new ImportMavenSarlProjectsJob(projects, this.workingSets, this.importConfiguration);
job.setRule(MavenPlugin.getProjectConfigurationManager().getRule());
return job;
} | [
"protected",
"WorkspaceJob",
"createImportJob",
"(",
"Collection",
"<",
"MavenProjectInfo",
">",
"projects",
")",
"{",
"final",
"WorkspaceJob",
"job",
"=",
"new",
"ImportMavenSarlProjectsJob",
"(",
"projects",
",",
"this",
".",
"workingSets",
",",
"this",
".",
"im... | Create the import job.
@param projects the projects to import.
@return the import job. | [
"Create",
"the",
"import",
"job",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.m2e/src/io/sarl/m2e/wizards/importproject/ImportMavenSarlProjectWizard.java#L154-L158 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java | HtmlDocletWriter.addPreQualifiedStrongClassLink | public void addPreQualifiedStrongClassLink(LinkInfoImpl.Kind context, ClassDoc cd, Content contentTree) {
addPreQualifiedClassLink(context, cd, true, contentTree);
} | java | public void addPreQualifiedStrongClassLink(LinkInfoImpl.Kind context, ClassDoc cd, Content contentTree) {
addPreQualifiedClassLink(context, cd, true, contentTree);
} | [
"public",
"void",
"addPreQualifiedStrongClassLink",
"(",
"LinkInfoImpl",
".",
"Kind",
"context",
",",
"ClassDoc",
"cd",
",",
"Content",
"contentTree",
")",
"{",
"addPreQualifiedClassLink",
"(",
"context",
",",
"cd",
",",
"true",
",",
"contentTree",
")",
";",
"}"... | Add the class link, with only class name as the strong link and prefixing
plain package name.
@param context the id of the context where the link will be added
@param cd the class to link to
@param contentTree the content tree to which the link with be added | [
"Add",
"the",
"class",
"link",
"with",
"only",
"class",
"name",
"as",
"the",
"strong",
"link",
"and",
"prefixing",
"plain",
"package",
"name",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L1162-L1164 |
Alluxio/alluxio | job/server/src/main/java/alluxio/worker/job/task/TaskExecutorManager.java | TaskExecutorManager.cancelTask | public synchronized void cancelTask(long jobId, int taskId) {
Pair<Long, Integer> id = new Pair<>(jobId, taskId);
TaskInfo.Builder taskInfo = mUnfinishedTasks.get(id);
if (!mTaskFutures.containsKey(id) || taskInfo.getStatus().equals(Status.CANCELED)) {
// job has finished, or failed, or canceled
return;
}
Future<?> future = mTaskFutures.get(id);
if (!future.cancel(true)) {
taskInfo.setStatus(Status.FAILED);
taskInfo.setErrorMessage("Failed to cancel the task");
finishTask(id);
}
} | java | public synchronized void cancelTask(long jobId, int taskId) {
Pair<Long, Integer> id = new Pair<>(jobId, taskId);
TaskInfo.Builder taskInfo = mUnfinishedTasks.get(id);
if (!mTaskFutures.containsKey(id) || taskInfo.getStatus().equals(Status.CANCELED)) {
// job has finished, or failed, or canceled
return;
}
Future<?> future = mTaskFutures.get(id);
if (!future.cancel(true)) {
taskInfo.setStatus(Status.FAILED);
taskInfo.setErrorMessage("Failed to cancel the task");
finishTask(id);
}
} | [
"public",
"synchronized",
"void",
"cancelTask",
"(",
"long",
"jobId",
",",
"int",
"taskId",
")",
"{",
"Pair",
"<",
"Long",
",",
"Integer",
">",
"id",
"=",
"new",
"Pair",
"<>",
"(",
"jobId",
",",
"taskId",
")",
";",
"TaskInfo",
".",
"Builder",
"taskInfo... | Cancels the given task.
@param jobId the job id
@param taskId the task id | [
"Cancels",
"the",
"given",
"task",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/job/server/src/main/java/alluxio/worker/job/task/TaskExecutorManager.java#L149-L163 |
alkacon/opencms-core | src/org/opencms/db/generic/CmsUserDriver.java | CmsUserDriver.internalCreateUser | protected CmsUser internalCreateUser(CmsDbContext dbc, ResultSet res) throws SQLException {
String userName = res.getString(m_sqlManager.readQuery("C_USERS_USER_NAME_0"));
String ou = CmsOrganizationalUnit.removeLeadingSeparator(
res.getString(m_sqlManager.readQuery("C_USERS_USER_OU_0")));
CmsUUID userId = new CmsUUID(res.getString(m_sqlManager.readQuery("C_USERS_USER_ID_0")));
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_DBG_CREATE_USER_1, userName));
}
return new CmsUser(
userId,
ou + userName,
res.getString(m_sqlManager.readQuery("C_USERS_USER_PASSWORD_0")),
res.getString(m_sqlManager.readQuery("C_USERS_USER_FIRSTNAME_0")),
res.getString(m_sqlManager.readQuery("C_USERS_USER_LASTNAME_0")),
res.getString(m_sqlManager.readQuery("C_USERS_USER_EMAIL_0")),
res.getLong(m_sqlManager.readQuery("C_USERS_USER_LASTLOGIN_0")),
res.getInt(m_sqlManager.readQuery("C_USERS_USER_FLAGS_0")),
res.getLong(m_sqlManager.readQuery("C_USERS_USER_DATECREATED_0")),
null);
} | java | protected CmsUser internalCreateUser(CmsDbContext dbc, ResultSet res) throws SQLException {
String userName = res.getString(m_sqlManager.readQuery("C_USERS_USER_NAME_0"));
String ou = CmsOrganizationalUnit.removeLeadingSeparator(
res.getString(m_sqlManager.readQuery("C_USERS_USER_OU_0")));
CmsUUID userId = new CmsUUID(res.getString(m_sqlManager.readQuery("C_USERS_USER_ID_0")));
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_DBG_CREATE_USER_1, userName));
}
return new CmsUser(
userId,
ou + userName,
res.getString(m_sqlManager.readQuery("C_USERS_USER_PASSWORD_0")),
res.getString(m_sqlManager.readQuery("C_USERS_USER_FIRSTNAME_0")),
res.getString(m_sqlManager.readQuery("C_USERS_USER_LASTNAME_0")),
res.getString(m_sqlManager.readQuery("C_USERS_USER_EMAIL_0")),
res.getLong(m_sqlManager.readQuery("C_USERS_USER_LASTLOGIN_0")),
res.getInt(m_sqlManager.readQuery("C_USERS_USER_FLAGS_0")),
res.getLong(m_sqlManager.readQuery("C_USERS_USER_DATECREATED_0")),
null);
} | [
"protected",
"CmsUser",
"internalCreateUser",
"(",
"CmsDbContext",
"dbc",
",",
"ResultSet",
"res",
")",
"throws",
"SQLException",
"{",
"String",
"userName",
"=",
"res",
".",
"getString",
"(",
"m_sqlManager",
".",
"readQuery",
"(",
"\"C_USERS_USER_NAME_0\"",
")",
"... | Semi-constructor to create a {@link CmsUser} instance from a JDBC result set.<p>
@param dbc the current database context
@param res the JDBC ResultSet
@return the new CmsUser object
@throws SQLException in case the result set does not include a requested table attribute | [
"Semi",
"-",
"constructor",
"to",
"create",
"a",
"{",
"@link",
"CmsUser",
"}",
"instance",
"from",
"a",
"JDBC",
"result",
"set",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsUserDriver.java#L2507-L2529 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractController.java | AbstractController.callCommand | protected Wave callCommand(final Class<? extends Command> commandClass, final WaveData<?>... data) {
return model().callCommand(commandClass, data);
} | java | protected Wave callCommand(final Class<? extends Command> commandClass, final WaveData<?>... data) {
return model().callCommand(commandClass, data);
} | [
"protected",
"Wave",
"callCommand",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Command",
">",
"commandClass",
",",
"final",
"WaveData",
"<",
"?",
">",
"...",
"data",
")",
"{",
"return",
"model",
"(",
")",
".",
"callCommand",
"(",
"commandClass",
",",
"... | Redirect to {@link Model#callCommand(Class, WaveData...)}.
@param commandClass the command class to call
@param data the data to transport
@return the wave created and sent to JIT, be careful when you use a strong reference it can hold a lot of objects | [
"Redirect",
"to",
"{",
"@link",
"Model#callCommand",
"(",
"Class",
"WaveData",
"...",
")",
"}",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractController.java#L268-L270 |
Hygieia/Hygieia | api/src/main/java/com/capitalone/dashboard/service/CmdbRemoteServiceImpl.java | CmdbRemoteServiceImpl.buildCollectorItem | private CollectorItem buildCollectorItem( CmdbRequest request, Collector collector ) {
CollectorItem collectorItem = new CollectorItem();
collectorItem.setCollectorId( collector.getId() );
collectorItem.setEnabled( false );
collectorItem.setPushed( true );
collectorItem.setDescription( request.getCommonName() );
collectorItem.setLastUpdated( System.currentTimeMillis() );
collectorItem.getOptions().put( CONFIGURATION_ITEM, request.getConfigurationItem() );
collectorItem.getOptions().put( COMMON_NAME, request.getCommonName() );
return collectorService.createCollectorItem( collectorItem );
} | java | private CollectorItem buildCollectorItem( CmdbRequest request, Collector collector ) {
CollectorItem collectorItem = new CollectorItem();
collectorItem.setCollectorId( collector.getId() );
collectorItem.setEnabled( false );
collectorItem.setPushed( true );
collectorItem.setDescription( request.getCommonName() );
collectorItem.setLastUpdated( System.currentTimeMillis() );
collectorItem.getOptions().put( CONFIGURATION_ITEM, request.getConfigurationItem() );
collectorItem.getOptions().put( COMMON_NAME, request.getCommonName() );
return collectorService.createCollectorItem( collectorItem );
} | [
"private",
"CollectorItem",
"buildCollectorItem",
"(",
"CmdbRequest",
"request",
",",
"Collector",
"collector",
")",
"{",
"CollectorItem",
"collectorItem",
"=",
"new",
"CollectorItem",
"(",
")",
";",
"collectorItem",
".",
"setCollectorId",
"(",
"collector",
".",
"ge... | Builds collector Item for new Cmdb item
@param request
@param collector
@return | [
"Builds",
"collector",
"Item",
"for",
"new",
"Cmdb",
"item"
] | train | https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/api/src/main/java/com/capitalone/dashboard/service/CmdbRemoteServiceImpl.java#L127-L139 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/responder/responderpolicy_stats.java | responderpolicy_stats.get | public static responderpolicy_stats get(nitro_service service, String name) throws Exception{
responderpolicy_stats obj = new responderpolicy_stats();
obj.set_name(name);
responderpolicy_stats response = (responderpolicy_stats) obj.stat_resource(service);
return response;
} | java | public static responderpolicy_stats get(nitro_service service, String name) throws Exception{
responderpolicy_stats obj = new responderpolicy_stats();
obj.set_name(name);
responderpolicy_stats response = (responderpolicy_stats) obj.stat_resource(service);
return response;
} | [
"public",
"static",
"responderpolicy_stats",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"responderpolicy_stats",
"obj",
"=",
"new",
"responderpolicy_stats",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
... | Use this API to fetch statistics of responderpolicy_stats resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"statistics",
"of",
"responderpolicy_stats",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/responder/responderpolicy_stats.java#L169-L174 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/classify/SVMLightClassifier.java | SVMLightClassifier.logProbabilityOf | @Override
public Counter<L> logProbabilityOf(Datum<L, F> example) {
if (platt == null) {
throw new UnsupportedOperationException("If you want to ask for the probability, you must train a Platt model!");
}
Counter<L> scores = scoresOf(example);
scores.incrementCount(null);
Counter<L> probs = platt.logProbabilityOf(new RVFDatum<L, L>(scores));
//System.out.println(scores+" "+probs);
return probs;
} | java | @Override
public Counter<L> logProbabilityOf(Datum<L, F> example) {
if (platt == null) {
throw new UnsupportedOperationException("If you want to ask for the probability, you must train a Platt model!");
}
Counter<L> scores = scoresOf(example);
scores.incrementCount(null);
Counter<L> probs = platt.logProbabilityOf(new RVFDatum<L, L>(scores));
//System.out.println(scores+" "+probs);
return probs;
} | [
"@",
"Override",
"public",
"Counter",
"<",
"L",
">",
"logProbabilityOf",
"(",
"Datum",
"<",
"L",
",",
"F",
">",
"example",
")",
"{",
"if",
"(",
"platt",
"==",
"null",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"If you want to ask for t... | Returns a counter for the log probability of each of the classes
looking at the the sum of e^v for each count v, should be 1
Note: Uses SloppyMath.logSum which isn't exact but isn't as
offensively slow as doing a series of exponentials | [
"Returns",
"a",
"counter",
"for",
"the",
"log",
"probability",
"of",
"each",
"of",
"the",
"classes",
"looking",
"at",
"the",
"the",
"sum",
"of",
"e^v",
"for",
"each",
"count",
"v",
"should",
"be",
"1",
"Note",
":",
"Uses",
"SloppyMath",
".",
"logSum",
... | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/SVMLightClassifier.java#L45-L55 |
xvik/generics-resolver | src/main/java/ru/vyarus/java/generics/resolver/util/TypeToStringUtils.java | TypeToStringUtils.toStringMethod | public static String toStringMethod(final Method method, final Map<String, Type> generics) {
return String.format("%s %s(%s)",
toStringType(method.getGenericReturnType(), generics),
method.getName(),
toStringTypes(method.getGenericParameterTypes(), generics));
} | java | public static String toStringMethod(final Method method, final Map<String, Type> generics) {
return String.format("%s %s(%s)",
toStringType(method.getGenericReturnType(), generics),
method.getName(),
toStringTypes(method.getGenericParameterTypes(), generics));
} | [
"public",
"static",
"String",
"toStringMethod",
"(",
"final",
"Method",
"method",
",",
"final",
"Map",
"<",
"String",
",",
"Type",
">",
"generics",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"%s %s(%s)\"",
",",
"toStringType",
"(",
"method",
".",
... | <pre>{@code class B extends A<Long> {}
class A<T> {
List<T> get(T one);
}
Method method = A.class.getMethod("get", Object.class);
Map<String, Type> generics = (context of B).method().visibleGenericsMap();
TypeToStringUtils.toStringMethod(method, generics) == "List<Long> get(Long)"
}</pre>.
@param method method
@param generics required generics (type generics and possible method generics)
@return method string with replaced generic variables
@see ru.vyarus.java.generics.resolver.util.map.PrintableGenericsMap to print not known generic names
@see ru.vyarus.java.generics.resolver.util.map.IgnoreGenericsMap to print Object instead of not known generic | [
"<pre",
">",
"{",
"@code",
"class",
"B",
"extends",
"A<Long",
">",
"{}",
"class",
"A<T",
">",
"{",
"List<T",
">",
"get",
"(",
"T",
"one",
")",
";",
"}"
] | train | https://github.com/xvik/generics-resolver/blob/d7d9d2783265df1178230e8f0b7cb6d853b67a7b/src/main/java/ru/vyarus/java/generics/resolver/util/TypeToStringUtils.java#L190-L195 |
apereo/cas | support/cas-server-support-openid/src/main/java/org/apereo/cas/support/openid/authentication/principal/OpenIdServiceResponseBuilder.java | OpenIdServiceResponseBuilder.determineIdentity | protected String determineIdentity(final OpenIdService service, final Assertion assertion) {
if (assertion != null && OpenIdProtocolConstants.OPENID_IDENTIFIERSELECT.equals(service.getIdentity())) {
return this.openIdPrefixUrl + '/' + assertion.getPrimaryAuthentication().getPrincipal().getId();
}
return service.getIdentity();
} | java | protected String determineIdentity(final OpenIdService service, final Assertion assertion) {
if (assertion != null && OpenIdProtocolConstants.OPENID_IDENTIFIERSELECT.equals(service.getIdentity())) {
return this.openIdPrefixUrl + '/' + assertion.getPrimaryAuthentication().getPrincipal().getId();
}
return service.getIdentity();
} | [
"protected",
"String",
"determineIdentity",
"(",
"final",
"OpenIdService",
"service",
",",
"final",
"Assertion",
"assertion",
")",
"{",
"if",
"(",
"assertion",
"!=",
"null",
"&&",
"OpenIdProtocolConstants",
".",
"OPENID_IDENTIFIERSELECT",
".",
"equals",
"(",
"servic... | Determine identity.
@param service the service
@param assertion the assertion
@return the string | [
"Determine",
"identity",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-openid/src/main/java/org/apereo/cas/support/openid/authentication/principal/OpenIdServiceResponseBuilder.java#L108-L113 |
stevespringett/Alpine | alpine/src/main/java/alpine/persistence/AbstractAlpineQueryManager.java | AbstractAlpineQueryManager.getCount | public long getCount(final Query query, final Object... parameters) {
final String ordering = ((JDOQuery) query).getInternalQuery().getOrdering();
query.setResult("count(id)");
query.setOrdering(null);
final long count = (Long) query.executeWithArray(parameters);
query.setOrdering(ordering);
return count;
} | java | public long getCount(final Query query, final Object... parameters) {
final String ordering = ((JDOQuery) query).getInternalQuery().getOrdering();
query.setResult("count(id)");
query.setOrdering(null);
final long count = (Long) query.executeWithArray(parameters);
query.setOrdering(ordering);
return count;
} | [
"public",
"long",
"getCount",
"(",
"final",
"Query",
"query",
",",
"final",
"Object",
"...",
"parameters",
")",
"{",
"final",
"String",
"ordering",
"=",
"(",
"(",
"JDOQuery",
")",
"query",
")",
".",
"getInternalQuery",
"(",
")",
".",
"getOrdering",
"(",
... | Returns the number of items that would have resulted from returning all object.
This method is performant in that the objects are not actually retrieved, only
the count.
@param query the query to return a count from
@param parameters the <code>Object</code> array with all of the parameters
@return the number of items
@since 1.0.0 | [
"Returns",
"the",
"number",
"of",
"items",
"that",
"would",
"have",
"resulted",
"from",
"returning",
"all",
"object",
".",
"This",
"method",
"is",
"performant",
"in",
"that",
"the",
"objects",
"are",
"not",
"actually",
"retrieved",
"only",
"the",
"count",
".... | train | https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AbstractAlpineQueryManager.java#L344-L351 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/ShakeAroundAPI.java | ShakeAroundAPI.pageDelete | public static PageDeleteResult pageDelete(String accessToken,
PageDelete pageDelete) {
return pageDelete(accessToken, JsonUtil.toJSONString(pageDelete));
} | java | public static PageDeleteResult pageDelete(String accessToken,
PageDelete pageDelete) {
return pageDelete(accessToken, JsonUtil.toJSONString(pageDelete));
} | [
"public",
"static",
"PageDeleteResult",
"pageDelete",
"(",
"String",
"accessToken",
",",
"PageDelete",
"pageDelete",
")",
"{",
"return",
"pageDelete",
"(",
"accessToken",
",",
"JsonUtil",
".",
"toJSONString",
"(",
"pageDelete",
")",
")",
";",
"}"
] | 页面管理-删除页面
@param accessToken accessToken
@param pageDelete pageDelete
@return result | [
"页面管理-删除页面"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/ShakeAroundAPI.java#L756-L759 |
assertthat/selenium-shutterbug | src/main/java/com/assertthat/selenium_shutterbug/core/Shutterbug.java | Shutterbug.shootPage | public static PageSnapshot shootPage(WebDriver driver, boolean useDevicePixelRatio) {
Browser browser = new Browser(driver, useDevicePixelRatio);
PageSnapshot pageScreenshot = new PageSnapshot(driver,browser.getDevicePixelRatio());
pageScreenshot.setImage(browser.takeScreenshot());
return pageScreenshot;
} | java | public static PageSnapshot shootPage(WebDriver driver, boolean useDevicePixelRatio) {
Browser browser = new Browser(driver, useDevicePixelRatio);
PageSnapshot pageScreenshot = new PageSnapshot(driver,browser.getDevicePixelRatio());
pageScreenshot.setImage(browser.takeScreenshot());
return pageScreenshot;
} | [
"public",
"static",
"PageSnapshot",
"shootPage",
"(",
"WebDriver",
"driver",
",",
"boolean",
"useDevicePixelRatio",
")",
"{",
"Browser",
"browser",
"=",
"new",
"Browser",
"(",
"driver",
",",
"useDevicePixelRatio",
")",
";",
"PageSnapshot",
"pageScreenshot",
"=",
"... | Make screen shot of the viewport only.
To be used when screen shooting the page
and don't need to scroll while making screen shots (FF, IE).
@param driver WebDriver instance
@param useDevicePixelRatio whether or not take into account device pixel ratio
@return PageSnapshot instance | [
"Make",
"screen",
"shot",
"of",
"the",
"viewport",
"only",
".",
"To",
"be",
"used",
"when",
"screen",
"shooting",
"the",
"page",
"and",
"don",
"t",
"need",
"to",
"scroll",
"while",
"making",
"screen",
"shots",
"(",
"FF",
"IE",
")",
"."
] | train | https://github.com/assertthat/selenium-shutterbug/blob/770d9b92423200d262c9ab70e40405921d81e262/src/main/java/com/assertthat/selenium_shutterbug/core/Shutterbug.java#L41-L46 |
igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java | PacketParserUtils.parseSASLFailure | public static SASLFailure parseSASLFailure(XmlPullParser parser) throws XmlPullParserException, IOException {
final int initialDepth = parser.getDepth();
String condition = null;
Map<String, String> descriptiveTexts = null;
outerloop: while (true) {
int eventType = parser.next();
switch (eventType) {
case XmlPullParser.START_TAG:
String name = parser.getName();
if (name.equals("text")) {
descriptiveTexts = parseDescriptiveTexts(parser, descriptiveTexts);
}
else {
assert (condition == null);
condition = parser.getName();
}
break;
case XmlPullParser.END_TAG:
if (parser.getDepth() == initialDepth) {
break outerloop;
}
break;
}
}
return new SASLFailure(condition, descriptiveTexts);
} | java | public static SASLFailure parseSASLFailure(XmlPullParser parser) throws XmlPullParserException, IOException {
final int initialDepth = parser.getDepth();
String condition = null;
Map<String, String> descriptiveTexts = null;
outerloop: while (true) {
int eventType = parser.next();
switch (eventType) {
case XmlPullParser.START_TAG:
String name = parser.getName();
if (name.equals("text")) {
descriptiveTexts = parseDescriptiveTexts(parser, descriptiveTexts);
}
else {
assert (condition == null);
condition = parser.getName();
}
break;
case XmlPullParser.END_TAG:
if (parser.getDepth() == initialDepth) {
break outerloop;
}
break;
}
}
return new SASLFailure(condition, descriptiveTexts);
} | [
"public",
"static",
"SASLFailure",
"parseSASLFailure",
"(",
"XmlPullParser",
"parser",
")",
"throws",
"XmlPullParserException",
",",
"IOException",
"{",
"final",
"int",
"initialDepth",
"=",
"parser",
".",
"getDepth",
"(",
")",
";",
"String",
"condition",
"=",
"nul... | Parses SASL authentication error packets.
@param parser the XML parser.
@return a SASL Failure packet.
@throws IOException
@throws XmlPullParserException | [
"Parses",
"SASL",
"authentication",
"error",
"packets",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java#L780-L805 |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java | SarlLinkFactory.getLinkForTypeVariable | protected void getLinkForTypeVariable(Content link, LinkInfo linkInfo, Type type) {
link.addContent(getTypeAnnotationLinks(linkInfo));
linkInfo.isTypeBound = true;
final Doc owner = type.asTypeVariable().owner();
if ((!linkInfo.excludeTypeParameterLinks) && owner instanceof ClassDoc) {
linkInfo.classDoc = (ClassDoc) owner;
final Content label = newContent();
label.addContent(type.typeName());
linkInfo.label = label;
link.addContent(getClassLink(linkInfo));
} else {
link.addContent(type.typeName());
}
final Type[] bounds = type.asTypeVariable().bounds();
if (!linkInfo.excludeTypeBounds) {
linkInfo.excludeTypeBounds = true;
final SARLFeatureAccess kw = Utils.getKeywords();
for (int i = 0; i < bounds.length; ++i) {
link.addContent(i > 0 ? " " + kw.getAmpersandKeyword() + " " //$NON-NLS-1$ //$NON-NLS-2$
: " " + kw.getExtendsKeyword() + " "); //$NON-NLS-1$ //$NON-NLS-2$
setBoundsLinkInfo(linkInfo, bounds[i]);
link.addContent(getLink(linkInfo));
}
}
} | java | protected void getLinkForTypeVariable(Content link, LinkInfo linkInfo, Type type) {
link.addContent(getTypeAnnotationLinks(linkInfo));
linkInfo.isTypeBound = true;
final Doc owner = type.asTypeVariable().owner();
if ((!linkInfo.excludeTypeParameterLinks) && owner instanceof ClassDoc) {
linkInfo.classDoc = (ClassDoc) owner;
final Content label = newContent();
label.addContent(type.typeName());
linkInfo.label = label;
link.addContent(getClassLink(linkInfo));
} else {
link.addContent(type.typeName());
}
final Type[] bounds = type.asTypeVariable().bounds();
if (!linkInfo.excludeTypeBounds) {
linkInfo.excludeTypeBounds = true;
final SARLFeatureAccess kw = Utils.getKeywords();
for (int i = 0; i < bounds.length; ++i) {
link.addContent(i > 0 ? " " + kw.getAmpersandKeyword() + " " //$NON-NLS-1$ //$NON-NLS-2$
: " " + kw.getExtendsKeyword() + " "); //$NON-NLS-1$ //$NON-NLS-2$
setBoundsLinkInfo(linkInfo, bounds[i]);
link.addContent(getLink(linkInfo));
}
}
} | [
"protected",
"void",
"getLinkForTypeVariable",
"(",
"Content",
"link",
",",
"LinkInfo",
"linkInfo",
",",
"Type",
"type",
")",
"{",
"link",
".",
"addContent",
"(",
"getTypeAnnotationLinks",
"(",
"linkInfo",
")",
")",
";",
"linkInfo",
".",
"isTypeBound",
"=",
"t... | Build the link for the type variable.
@param link the link.
@param linkInfo the information on the link.
@param type the type. | [
"Build",
"the",
"link",
"for",
"the",
"type",
"variable",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java#L114-L138 |
apereo/cas | core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/handler/support/jaas/JaasAuthenticationHandler.java | JaasAuthenticationHandler.getLoginContext | protected LoginContext getLoginContext(final UsernamePasswordCredential credential) throws GeneralSecurityException {
val callbackHandler = new UsernamePasswordCallbackHandler(credential.getUsername(), credential.getPassword());
if (this.loginConfigurationFile != null && StringUtils.isNotBlank(this.loginConfigType)
&& this.loginConfigurationFile.exists() && this.loginConfigurationFile.canRead()) {
final Configuration.Parameters parameters = new URIParameter(loginConfigurationFile.toURI());
val loginConfig = Configuration.getInstance(this.loginConfigType, parameters);
return new LoginContext(this.realm, null, callbackHandler, loginConfig);
}
return new LoginContext(this.realm, callbackHandler);
} | java | protected LoginContext getLoginContext(final UsernamePasswordCredential credential) throws GeneralSecurityException {
val callbackHandler = new UsernamePasswordCallbackHandler(credential.getUsername(), credential.getPassword());
if (this.loginConfigurationFile != null && StringUtils.isNotBlank(this.loginConfigType)
&& this.loginConfigurationFile.exists() && this.loginConfigurationFile.canRead()) {
final Configuration.Parameters parameters = new URIParameter(loginConfigurationFile.toURI());
val loginConfig = Configuration.getInstance(this.loginConfigType, parameters);
return new LoginContext(this.realm, null, callbackHandler, loginConfig);
}
return new LoginContext(this.realm, callbackHandler);
} | [
"protected",
"LoginContext",
"getLoginContext",
"(",
"final",
"UsernamePasswordCredential",
"credential",
")",
"throws",
"GeneralSecurityException",
"{",
"val",
"callbackHandler",
"=",
"new",
"UsernamePasswordCallbackHandler",
"(",
"credential",
".",
"getUsername",
"(",
")"... | Gets login context.
@param credential the credential
@return the login context
@throws GeneralSecurityException the general security exception | [
"Gets",
"login",
"context",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/handler/support/jaas/JaasAuthenticationHandler.java#L166-L175 |
b3log/latke | latke-core/src/main/java/org/b3log/latke/plugin/AbstractPlugin.java | AbstractPlugin.getLang | public String getLang(final Locale locale, final String key) {
return langs.get(locale.toString()).getProperty(key);
} | java | public String getLang(final Locale locale, final String key) {
return langs.get(locale.toString()).getProperty(key);
} | [
"public",
"String",
"getLang",
"(",
"final",
"Locale",
"locale",
",",
"final",
"String",
"key",
")",
"{",
"return",
"langs",
".",
"get",
"(",
"locale",
".",
"toString",
"(",
")",
")",
".",
"getProperty",
"(",
"key",
")",
";",
"}"
] | Gets language label with the specified locale and key.
@param locale the specified locale
@param key the specified key
@return language label | [
"Gets",
"language",
"label",
"with",
"the",
"specified",
"locale",
"and",
"key",
"."
] | train | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/plugin/AbstractPlugin.java#L217-L219 |
belaban/JGroups | src/org/jgroups/util/ForwardQueue.java | ForwardQueue.canDeliver | protected boolean canDeliver(Address sender, long seqno) {
BoundedHashMap<Long,Long> seqno_set=delivery_table.get(sender);
if(seqno_set == null) {
seqno_set=new BoundedHashMap<>(delivery_table_max_size);
BoundedHashMap<Long,Long> existing=delivery_table.put(sender,seqno_set);
if(existing != null)
seqno_set=existing;
}
return seqno_set.add(seqno, seqno);
} | java | protected boolean canDeliver(Address sender, long seqno) {
BoundedHashMap<Long,Long> seqno_set=delivery_table.get(sender);
if(seqno_set == null) {
seqno_set=new BoundedHashMap<>(delivery_table_max_size);
BoundedHashMap<Long,Long> existing=delivery_table.put(sender,seqno_set);
if(existing != null)
seqno_set=existing;
}
return seqno_set.add(seqno, seqno);
} | [
"protected",
"boolean",
"canDeliver",
"(",
"Address",
"sender",
",",
"long",
"seqno",
")",
"{",
"BoundedHashMap",
"<",
"Long",
",",
"Long",
">",
"seqno_set",
"=",
"delivery_table",
".",
"get",
"(",
"sender",
")",
";",
"if",
"(",
"seqno_set",
"==",
"null",
... | Checks if seqno has already been received from sender. This weeds out duplicates.
Note that this method is never called concurrently for the same sender. | [
"Checks",
"if",
"seqno",
"has",
"already",
"been",
"received",
"from",
"sender",
".",
"This",
"weeds",
"out",
"duplicates",
".",
"Note",
"that",
"this",
"method",
"is",
"never",
"called",
"concurrently",
"for",
"the",
"same",
"sender",
"."
] | train | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/ForwardQueue.java#L236-L245 |
sawano/java-commons | src/main/java/se/sawano/java/commons/lang/validate/Validate.java | Validate.validIndex | public static <T extends Collection<?>> T validIndex(final T collection, final int index) {
return INSTANCE.validIndex(collection, index);
} | java | public static <T extends Collection<?>> T validIndex(final T collection, final int index) {
return INSTANCE.validIndex(collection, index);
} | [
"public",
"static",
"<",
"T",
"extends",
"Collection",
"<",
"?",
">",
">",
"T",
"validIndex",
"(",
"final",
"T",
"collection",
",",
"final",
"int",
"index",
")",
"{",
"return",
"INSTANCE",
".",
"validIndex",
"(",
"collection",
",",
"index",
")",
";",
"... | <p>Validates that the index is within the bounds of the argument collection; otherwise throwing an exception.</p>
<pre>Validate.validIndex(myCollection, 2);</pre>
<p>If the index is invalid, then the message of the exception is "The validated collection index is invalid: " followed by the index.</p>
@param <T>
the collection type
@param collection
the collection to check, validated not null by this method
@param index
the index to check
@return the validated collection (never {@code null} for method chaining)
@throws NullPointerValidationException
if the collection is {@code null}
@throws IndexOutOfBoundsException
if the index is invalid
@see #validIndex(Collection, int, String, Object...) | [
"<p",
">",
"Validates",
"that",
"the",
"index",
"is",
"within",
"the",
"bounds",
"of",
"the",
"argument",
"collection",
";",
"otherwise",
"throwing",
"an",
"exception",
".",
"<",
"/",
"p",
">",
"<pre",
">",
"Validate",
".",
"validIndex",
"(",
"myCollection... | train | https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/Validate.java#L1256-L1258 |
ehcache/ehcache3 | impl/src/main/java/org/ehcache/impl/internal/resilience/RobustLoaderWriterResilienceStrategy.java | RobustLoaderWriterResilienceStrategy.putIfAbsentFailure | @Override
public V putIfAbsentFailure(K key, V value, StoreAccessException e) {
// FIXME: Should I care about useLoaderInAtomics?
try {
try {
V loaded = loaderWriter.load(key);
if (loaded != null) {
return loaded;
}
} catch (Exception e1) {
throw ExceptionFactory.newCacheLoadingException(e1, e);
}
try {
loaderWriter.write(key, value);
} catch (Exception e1) {
throw ExceptionFactory.newCacheWritingException(e1, e);
}
} finally {
cleanup(key, e);
}
return null;
} | java | @Override
public V putIfAbsentFailure(K key, V value, StoreAccessException e) {
// FIXME: Should I care about useLoaderInAtomics?
try {
try {
V loaded = loaderWriter.load(key);
if (loaded != null) {
return loaded;
}
} catch (Exception e1) {
throw ExceptionFactory.newCacheLoadingException(e1, e);
}
try {
loaderWriter.write(key, value);
} catch (Exception e1) {
throw ExceptionFactory.newCacheWritingException(e1, e);
}
} finally {
cleanup(key, e);
}
return null;
} | [
"@",
"Override",
"public",
"V",
"putIfAbsentFailure",
"(",
"K",
"key",
",",
"V",
"value",
",",
"StoreAccessException",
"e",
")",
"{",
"// FIXME: Should I care about useLoaderInAtomics?",
"try",
"{",
"try",
"{",
"V",
"loaded",
"=",
"loaderWriter",
".",
"load",
"(... | Write the value to the loader-writer if it doesn't already exist in it. Note that the load and write pair
is not atomic. This atomicity, if needed, should be handled by the something else.
@param key the key being put
@param value the value being put
@param e the triggered failure
@return the existing value or null if the new was set | [
"Write",
"the",
"value",
"to",
"the",
"loader",
"-",
"writer",
"if",
"it",
"doesn",
"t",
"already",
"exist",
"in",
"it",
".",
"Note",
"that",
"the",
"load",
"and",
"write",
"pair",
"is",
"not",
"atomic",
".",
"This",
"atomicity",
"if",
"needed",
"shoul... | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/internal/resilience/RobustLoaderWriterResilienceStrategy.java#L133-L154 |
Whiley/WhileyCompiler | src/main/java/wyil/interpreter/Interpreter.java | Interpreter.executeConst | private RValue executeConst(Expr.Constant expr, CallStack frame) {
Value v = expr.getValue();
switch (v.getOpcode()) {
case ITEM_null:
return RValue.Null;
case ITEM_bool: {
Value.Bool b = (Value.Bool) v;
if (b.get()) {
return RValue.True;
} else {
return RValue.False;
}
}
case ITEM_byte: {
Value.Byte b = (Value.Byte) v;
return semantics.Byte(b.get());
}
case ITEM_int: {
Value.Int i = (Value.Int) v;
return semantics.Int(i.get());
}
case ITEM_utf8: {
Value.UTF8 s = (Value.UTF8) v;
byte[] bytes = s.get();
RValue[] elements = new RValue[bytes.length];
for (int i = 0; i != elements.length; ++i) {
// FIXME: something tells me this is wrong for signed byte
// values?
elements[i] = semantics.Int(BigInteger.valueOf(bytes[i]));
}
return semantics.Array(elements);
}
default:
throw new RuntimeException("unknown value encountered (" + expr + ")");
}
} | java | private RValue executeConst(Expr.Constant expr, CallStack frame) {
Value v = expr.getValue();
switch (v.getOpcode()) {
case ITEM_null:
return RValue.Null;
case ITEM_bool: {
Value.Bool b = (Value.Bool) v;
if (b.get()) {
return RValue.True;
} else {
return RValue.False;
}
}
case ITEM_byte: {
Value.Byte b = (Value.Byte) v;
return semantics.Byte(b.get());
}
case ITEM_int: {
Value.Int i = (Value.Int) v;
return semantics.Int(i.get());
}
case ITEM_utf8: {
Value.UTF8 s = (Value.UTF8) v;
byte[] bytes = s.get();
RValue[] elements = new RValue[bytes.length];
for (int i = 0; i != elements.length; ++i) {
// FIXME: something tells me this is wrong for signed byte
// values?
elements[i] = semantics.Int(BigInteger.valueOf(bytes[i]));
}
return semantics.Array(elements);
}
default:
throw new RuntimeException("unknown value encountered (" + expr + ")");
}
} | [
"private",
"RValue",
"executeConst",
"(",
"Expr",
".",
"Constant",
"expr",
",",
"CallStack",
"frame",
")",
"{",
"Value",
"v",
"=",
"expr",
".",
"getValue",
"(",
")",
";",
"switch",
"(",
"v",
".",
"getOpcode",
"(",
")",
")",
"{",
"case",
"ITEM_null",
... | Execute a Constant expression at a given point in the function or
method body
@param expr
--- The expression to execute
@param frame
--- The current stack frame
@return | [
"Execute",
"a",
"Constant",
"expression",
"at",
"a",
"given",
"point",
"in",
"the",
"function",
"or",
"method",
"body"
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/interpreter/Interpreter.java#L693-L728 |
JOML-CI/JOML | src/org/joml/Matrix3d.java | Matrix3d.setColumn | public Matrix3d setColumn(int column, double x, double y, double z) throws IndexOutOfBoundsException {
switch (column) {
case 0:
this.m00 = x;
this.m01 = y;
this.m02 = z;
break;
case 1:
this.m10 = x;
this.m11 = y;
this.m12 = z;
break;
case 2:
this.m20 = x;
this.m21 = y;
this.m22 = z;
break;
default:
throw new IndexOutOfBoundsException();
}
return this;
} | java | public Matrix3d setColumn(int column, double x, double y, double z) throws IndexOutOfBoundsException {
switch (column) {
case 0:
this.m00 = x;
this.m01 = y;
this.m02 = z;
break;
case 1:
this.m10 = x;
this.m11 = y;
this.m12 = z;
break;
case 2:
this.m20 = x;
this.m21 = y;
this.m22 = z;
break;
default:
throw new IndexOutOfBoundsException();
}
return this;
} | [
"public",
"Matrix3d",
"setColumn",
"(",
"int",
"column",
",",
"double",
"x",
",",
"double",
"y",
",",
"double",
"z",
")",
"throws",
"IndexOutOfBoundsException",
"{",
"switch",
"(",
"column",
")",
"{",
"case",
"0",
":",
"this",
".",
"m00",
"=",
"x",
";"... | 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 x
the first element in the column
@param y
the second element in the column
@param z
the third element in the column
@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#L3607-L3628 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ras/SibTr.java | SibTr.formatBytes | public static String formatBytes (byte[] data, int start, int count, int max) {
StringBuilder sb = new StringBuilder(256);
sb.append(ls);
formatBytesToSB(sb, data, start, count, true, max);
return sb.toString();
} | java | public static String formatBytes (byte[] data, int start, int count, int max) {
StringBuilder sb = new StringBuilder(256);
sb.append(ls);
formatBytesToSB(sb, data, start, count, true, max);
return sb.toString();
} | [
"public",
"static",
"String",
"formatBytes",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"start",
",",
"int",
"count",
",",
"int",
"max",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"256",
")",
";",
"sb",
".",
"append",
"(",
"ls... | Produce a formatted view of a limited portion of a byte array.
Duplicate output lines are suppressed to save space.
Formatting of the byte array starts at the specified position and continues
for count, max, or the end of the data, whichever occurs first.
<p>
@param data the byte array to be formatted
@param start position to start formatting the byte array
@param count of bytes from start position that should be formatted
@param max maximun number of bytes from start position that should be formatted,
regardless of the value of length.
@return the formatted byte array | [
"Produce",
"a",
"formatted",
"view",
"of",
"a",
"limited",
"portion",
"of",
"a",
"byte",
"array",
".",
"Duplicate",
"output",
"lines",
"are",
"suppressed",
"to",
"save",
"space",
".",
"Formatting",
"of",
"the",
"byte",
"array",
"starts",
"at",
"the",
"spec... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ras/SibTr.java#L1458-L1463 |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/record/impl/ORecordBytes.java | ORecordBytes.fromInputStream | public int fromInputStream(final InputStream in, final int iMaxSize) throws IOException {
final byte[] buffer = new byte[iMaxSize];
final int readBytesCount = in.read(buffer);
if (readBytesCount == -1) {
_source = EMPTY_SOURCE;
_size = 0;
} else if (readBytesCount == iMaxSize) {
_source = buffer;
_size = iMaxSize;
} else {
_source = Arrays.copyOf(buffer, readBytesCount);
_size = readBytesCount;
}
return _size;
} | java | public int fromInputStream(final InputStream in, final int iMaxSize) throws IOException {
final byte[] buffer = new byte[iMaxSize];
final int readBytesCount = in.read(buffer);
if (readBytesCount == -1) {
_source = EMPTY_SOURCE;
_size = 0;
} else if (readBytesCount == iMaxSize) {
_source = buffer;
_size = iMaxSize;
} else {
_source = Arrays.copyOf(buffer, readBytesCount);
_size = readBytesCount;
}
return _size;
} | [
"public",
"int",
"fromInputStream",
"(",
"final",
"InputStream",
"in",
",",
"final",
"int",
"iMaxSize",
")",
"throws",
"IOException",
"{",
"final",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"iMaxSize",
"]",
";",
"final",
"int",
"readBytesCount",
... | Reads the input stream in memory specifying the maximum bytes to read. This is more efficient than
{@link #fromInputStream(InputStream)} because allocation is made only once.
@param in
Input Stream, use buffered input stream wrapper to speed up reading
@param iMaxSize
Maximum size to read
@return Buffer count of bytes that are read from the stream. It's also the internal buffer size in bytes
@throws IOException if an I/O error occurs. | [
"Reads",
"the",
"input",
"stream",
"in",
"memory",
"specifying",
"the",
"maximum",
"bytes",
"to",
"read",
".",
"This",
"is",
"more",
"efficient",
"than",
"{",
"@link",
"#fromInputStream",
"(",
"InputStream",
")",
"}",
"because",
"allocation",
"is",
"made",
"... | train | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/record/impl/ORecordBytes.java#L137-L151 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/AccountsImpl.java | AccountsImpl.listPoolNodeCounts | public PagedList<PoolNodeCounts> listPoolNodeCounts() {
ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders> response = listPoolNodeCountsSinglePageAsync().toBlocking().single();
return new PagedList<PoolNodeCounts>(response.body()) {
@Override
public Page<PoolNodeCounts> nextPage(String nextPageLink) {
return listPoolNodeCountsNextSinglePageAsync(nextPageLink, null).toBlocking().single().body();
}
};
} | java | public PagedList<PoolNodeCounts> listPoolNodeCounts() {
ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders> response = listPoolNodeCountsSinglePageAsync().toBlocking().single();
return new PagedList<PoolNodeCounts>(response.body()) {
@Override
public Page<PoolNodeCounts> nextPage(String nextPageLink) {
return listPoolNodeCountsNextSinglePageAsync(nextPageLink, null).toBlocking().single().body();
}
};
} | [
"public",
"PagedList",
"<",
"PoolNodeCounts",
">",
"listPoolNodeCounts",
"(",
")",
"{",
"ServiceResponseWithHeaders",
"<",
"Page",
"<",
"PoolNodeCounts",
">",
",",
"AccountListPoolNodeCountsHeaders",
">",
"response",
"=",
"listPoolNodeCountsSinglePageAsync",
"(",
")",
"... | Gets the number of nodes in each state, grouped by pool.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws BatchErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the PagedList<PoolNodeCounts> object if successful. | [
"Gets",
"the",
"number",
"of",
"nodes",
"in",
"each",
"state",
"grouped",
"by",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/AccountsImpl.java#L370-L378 |
czyzby/gdx-lml | kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/viewport/LetterboxingViewport.java | LetterboxingViewport.updateWorldSize | private void updateWorldSize(final int screenWidth, final int screenHeight) {
final float width = screenWidth * scaleX;
final float height = screenHeight * scaleY;
final float fitHeight = width / aspectRatio;
if (fitHeight > height) {
setWorldSize(height * aspectRatio, height);
} else {
setWorldSize(width, fitHeight);
}
} | java | private void updateWorldSize(final int screenWidth, final int screenHeight) {
final float width = screenWidth * scaleX;
final float height = screenHeight * scaleY;
final float fitHeight = width / aspectRatio;
if (fitHeight > height) {
setWorldSize(height * aspectRatio, height);
} else {
setWorldSize(width, fitHeight);
}
} | [
"private",
"void",
"updateWorldSize",
"(",
"final",
"int",
"screenWidth",
",",
"final",
"int",
"screenHeight",
")",
"{",
"final",
"float",
"width",
"=",
"screenWidth",
"*",
"scaleX",
";",
"final",
"float",
"height",
"=",
"screenHeight",
"*",
"scaleY",
";",
"... | Forces update of current world size according to window size. Will try to keep the set aspect ratio.
@param screenWidth current screen width.
@param screenHeight current screen height. | [
"Forces",
"update",
"of",
"current",
"world",
"size",
"according",
"to",
"window",
"size",
".",
"Will",
"try",
"to",
"keep",
"the",
"set",
"aspect",
"ratio",
"."
] | train | https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/viewport/LetterboxingViewport.java#L89-L98 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.