repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
qiniu/android-sdk | library/src/main/java/com/qiniu/android/storage/UploadManager.java | UploadManager.syncPut | public ResponseInfo syncPut(File file, String key, String token, UploadOptions options) {
"""
同步上传文件。使用 form 表单方式上传,建议只在文件较小情况下使用此方式,如 file.size() < 1024 * 1024。
@param file 上传的文件对象
@param key 上传数据保存的文件名
@param token 上传凭证
@param options 上传数据的可选参数
@return 响应信息 ResponseInfo#response 响应体,序列化后 json 格式
"""
final UpToken decodedToken = UpToken.parse(token);
ResponseInfo info = areInvalidArg(key, null, file, token, decodedToken);
if (info != null) {
return info;
}
return FormUploader.syncUpload(client, config, file, key, decodedToken, options);
} | java | public ResponseInfo syncPut(File file, String key, String token, UploadOptions options) {
final UpToken decodedToken = UpToken.parse(token);
ResponseInfo info = areInvalidArg(key, null, file, token, decodedToken);
if (info != null) {
return info;
}
return FormUploader.syncUpload(client, config, file, key, decodedToken, options);
} | [
"public",
"ResponseInfo",
"syncPut",
"(",
"File",
"file",
",",
"String",
"key",
",",
"String",
"token",
",",
"UploadOptions",
"options",
")",
"{",
"final",
"UpToken",
"decodedToken",
"=",
"UpToken",
".",
"parse",
"(",
"token",
")",
";",
"ResponseInfo",
"info... | 同步上传文件。使用 form 表单方式上传,建议只在文件较小情况下使用此方式,如 file.size() < 1024 * 1024。
@param file 上传的文件对象
@param key 上传数据保存的文件名
@param token 上传凭证
@param options 上传数据的可选参数
@return 响应信息 ResponseInfo#response 响应体,序列化后 json 格式 | [
"同步上传文件。使用",
"form",
"表单方式上传,建议只在文件较小情况下使用此方式,如",
"file",
".",
"size",
"()",
"<",
"1024",
"*",
"1024。"
] | train | https://github.com/qiniu/android-sdk/blob/dbd2a01fb3bff7a5e75e8934bbf81713124d8466/library/src/main/java/com/qiniu/android/storage/UploadManager.java#L219-L226 |
salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/alert/notifier/GOCNotifier.java | GOCNotifier._sendAdditionalNotification | protected void _sendAdditionalNotification(NotificationContext context, NotificationStatus status) {
"""
Update the state of the notification to indicate whether the triggering condition exists or has been cleared.
@param context The notification context. Cannot be null.
@param status The notification status. If null, will set the notification severity to <tt>ERROR</tt>
"""
requireArgument(context != null, "Notification context cannot be null.");
if(status == NotificationStatus.TRIGGERED) {
super.sendAdditionalNotification(context);
}else {
super.clearAdditionalNotification(context);
}
Notification notification = null;
Trigger trigger = null;
for (Notification tempNotification : context.getAlert().getNotifications()) {
if (tempNotification.getName().equalsIgnoreCase(context.getNotification().getName())) {
notification = tempNotification;
break;
}
}
requireArgument(notification != null, "Notification in notification context cannot be null.");
for (Trigger tempTrigger : context.getAlert().getTriggers()) {
if (tempTrigger.getName().equalsIgnoreCase(context.getTrigger().getName())) {
trigger = tempTrigger;
break;
}
}
requireArgument(trigger != null, "Trigger in notification context cannot be null.");
String body = getGOCMessageBody(notification, trigger, context, status);
Severity sev = status == NotificationStatus.CLEARED ? Severity.OK : Severity.ERROR;
sendMessage(sev, TemplateReplacer.applyTemplateChanges(context, context.getNotification().getName()), TemplateReplacer.applyTemplateChanges(context, context.getAlert().getName()), TemplateReplacer.applyTemplateChanges(context, context.getTrigger().getName()), body,
context.getNotification().getSeverityLevel(),context.getNotification().getSRActionable(), context.getTriggerFiredTime(), context.getTriggeredMetric());
} | java | protected void _sendAdditionalNotification(NotificationContext context, NotificationStatus status) {
requireArgument(context != null, "Notification context cannot be null.");
if(status == NotificationStatus.TRIGGERED) {
super.sendAdditionalNotification(context);
}else {
super.clearAdditionalNotification(context);
}
Notification notification = null;
Trigger trigger = null;
for (Notification tempNotification : context.getAlert().getNotifications()) {
if (tempNotification.getName().equalsIgnoreCase(context.getNotification().getName())) {
notification = tempNotification;
break;
}
}
requireArgument(notification != null, "Notification in notification context cannot be null.");
for (Trigger tempTrigger : context.getAlert().getTriggers()) {
if (tempTrigger.getName().equalsIgnoreCase(context.getTrigger().getName())) {
trigger = tempTrigger;
break;
}
}
requireArgument(trigger != null, "Trigger in notification context cannot be null.");
String body = getGOCMessageBody(notification, trigger, context, status);
Severity sev = status == NotificationStatus.CLEARED ? Severity.OK : Severity.ERROR;
sendMessage(sev, TemplateReplacer.applyTemplateChanges(context, context.getNotification().getName()), TemplateReplacer.applyTemplateChanges(context, context.getAlert().getName()), TemplateReplacer.applyTemplateChanges(context, context.getTrigger().getName()), body,
context.getNotification().getSeverityLevel(),context.getNotification().getSRActionable(), context.getTriggerFiredTime(), context.getTriggeredMetric());
} | [
"protected",
"void",
"_sendAdditionalNotification",
"(",
"NotificationContext",
"context",
",",
"NotificationStatus",
"status",
")",
"{",
"requireArgument",
"(",
"context",
"!=",
"null",
",",
"\"Notification context cannot be null.\"",
")",
";",
"if",
"(",
"status",
"==... | Update the state of the notification to indicate whether the triggering condition exists or has been cleared.
@param context The notification context. Cannot be null.
@param status The notification status. If null, will set the notification severity to <tt>ERROR</tt> | [
"Update",
"the",
"state",
"of",
"the",
"notification",
"to",
"indicate",
"whether",
"the",
"triggering",
"condition",
"exists",
"or",
"has",
"been",
"cleared",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/alert/notifier/GOCNotifier.java#L232-L264 |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/av/EglCore.java | EglCore.makeCurrent | public void makeCurrent(EGLSurface drawSurface, EGLSurface readSurface) {
"""
Makes our EGL context current, using the supplied "draw" and "read" surfaces.
"""
if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) {
// called makeCurrent() before create?
Log.d(TAG, "NOTE: makeCurrent w/o display");
}
if (!EGL14.eglMakeCurrent(mEGLDisplay, drawSurface, readSurface, mEGLContext)) {
throw new RuntimeException("eglMakeCurrent(draw,read) failed");
}
} | java | public void makeCurrent(EGLSurface drawSurface, EGLSurface readSurface) {
if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) {
// called makeCurrent() before create?
Log.d(TAG, "NOTE: makeCurrent w/o display");
}
if (!EGL14.eglMakeCurrent(mEGLDisplay, drawSurface, readSurface, mEGLContext)) {
throw new RuntimeException("eglMakeCurrent(draw,read) failed");
}
} | [
"public",
"void",
"makeCurrent",
"(",
"EGLSurface",
"drawSurface",
",",
"EGLSurface",
"readSurface",
")",
"{",
"if",
"(",
"mEGLDisplay",
"==",
"EGL14",
".",
"EGL_NO_DISPLAY",
")",
"{",
"// called makeCurrent() before create?",
"Log",
".",
"d",
"(",
"TAG",
",",
"... | Makes our EGL context current, using the supplied "draw" and "read" surfaces. | [
"Makes",
"our",
"EGL",
"context",
"current",
"using",
"the",
"supplied",
"draw",
"and",
"read",
"surfaces",
"."
] | train | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/EglCore.java#L276-L284 |
mapbox/mapbox-plugins-android | plugin-traffic/src/main/java/com/mapbox/mapboxsdk/plugins/traffic/TrafficPlugin.java | TrafficPlugin.addTrafficLayersToMap | private void addTrafficLayersToMap(Layer layerCase, Layer layer, String idAboveLayer) {
"""
Add Layer to the map and track the id.
@param layer the layer to be added to the map
@param idAboveLayer the id of the layer above
"""
style.addLayerBelow(layerCase, idAboveLayer);
style.addLayerAbove(layer, layerCase.getId());
layerIds.add(layerCase.getId());
layerIds.add(layer.getId());
} | java | private void addTrafficLayersToMap(Layer layerCase, Layer layer, String idAboveLayer) {
style.addLayerBelow(layerCase, idAboveLayer);
style.addLayerAbove(layer, layerCase.getId());
layerIds.add(layerCase.getId());
layerIds.add(layer.getId());
} | [
"private",
"void",
"addTrafficLayersToMap",
"(",
"Layer",
"layerCase",
",",
"Layer",
"layer",
",",
"String",
"idAboveLayer",
")",
"{",
"style",
".",
"addLayerBelow",
"(",
"layerCase",
",",
"idAboveLayer",
")",
";",
"style",
".",
"addLayerAbove",
"(",
"layer",
... | Add Layer to the map and track the id.
@param layer the layer to be added to the map
@param idAboveLayer the id of the layer above | [
"Add",
"Layer",
"to",
"the",
"map",
"and",
"track",
"the",
"id",
"."
] | train | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-traffic/src/main/java/com/mapbox/mapboxsdk/plugins/traffic/TrafficPlugin.java#L320-L325 |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java | SystemPropertyUtils.getProperty | public static String getProperty(String key, String defaultValue, String text) {
"""
Search the System properties and environment variables for a value with the
provided key. Environment variables in {@code UPPER_CASE} style are allowed where
System properties would normally be {@code lower.case}.
@param key the key to resolve
@param defaultValue the default value
@param text optional extra context for an error message if the key resolution fails
(e.g. if System properties are not accessible)
@return a static property value or null of not found
"""
try {
String propVal = System.getProperty(key);
if (propVal == null) {
// Fall back to searching the system environment.
propVal = System.getenv(key);
}
if (propVal == null) {
// Try with underscores.
String name = key.replace('.', '_');
propVal = System.getenv(name);
}
if (propVal == null) {
// Try uppercase with underscores as well.
String name = key.toUpperCase(Locale.ENGLISH).replace('.', '_');
propVal = System.getenv(name);
}
if (propVal != null) {
return propVal;
}
}
catch (Throwable ex) {
System.err.println("Could not resolve key '" + key + "' in '" + text
+ "' as system property or in environment: " + ex);
}
return defaultValue;
} | java | public static String getProperty(String key, String defaultValue, String text) {
try {
String propVal = System.getProperty(key);
if (propVal == null) {
// Fall back to searching the system environment.
propVal = System.getenv(key);
}
if (propVal == null) {
// Try with underscores.
String name = key.replace('.', '_');
propVal = System.getenv(name);
}
if (propVal == null) {
// Try uppercase with underscores as well.
String name = key.toUpperCase(Locale.ENGLISH).replace('.', '_');
propVal = System.getenv(name);
}
if (propVal != null) {
return propVal;
}
}
catch (Throwable ex) {
System.err.println("Could not resolve key '" + key + "' in '" + text
+ "' as system property or in environment: " + ex);
}
return defaultValue;
} | [
"public",
"static",
"String",
"getProperty",
"(",
"String",
"key",
",",
"String",
"defaultValue",
",",
"String",
"text",
")",
"{",
"try",
"{",
"String",
"propVal",
"=",
"System",
".",
"getProperty",
"(",
"key",
")",
";",
"if",
"(",
"propVal",
"==",
"null... | Search the System properties and environment variables for a value with the
provided key. Environment variables in {@code UPPER_CASE} style are allowed where
System properties would normally be {@code lower.case}.
@param key the key to resolve
@param defaultValue the default value
@param text optional extra context for an error message if the key resolution fails
(e.g. if System properties are not accessible)
@return a static property value or null of not found | [
"Search",
"the",
"System",
"properties",
"and",
"environment",
"variables",
"for",
"a",
"value",
"with",
"the",
"provided",
"key",
".",
"Environment",
"variables",
"in",
"{"
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java#L179-L205 |
baratine/baratine | web/src/main/java/com/caucho/v5/http/protocol/RequestHttpBase.java | RequestHttpBase.headerOut | public void headerOut(String key, String value) {
"""
Sets a header, replacing an already-existing header.
@param key the header key to set.
@param value the header value to set.
"""
Objects.requireNonNull(value);
if (isOutCommitted()) {
return;
}
if (headerOutSpecial(key, value)) {
return;
}
setHeaderOutImpl(key, value);
} | java | public void headerOut(String key, String value)
{
Objects.requireNonNull(value);
if (isOutCommitted()) {
return;
}
if (headerOutSpecial(key, value)) {
return;
}
setHeaderOutImpl(key, value);
} | [
"public",
"void",
"headerOut",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"value",
")",
";",
"if",
"(",
"isOutCommitted",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"headerOutSpecial",
"(",
"k... | Sets a header, replacing an already-existing header.
@param key the header key to set.
@param value the header value to set. | [
"Sets",
"a",
"header",
"replacing",
"an",
"already",
"-",
"existing",
"header",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/protocol/RequestHttpBase.java#L1852-L1865 |
alkacon/opencms-core | src/org/opencms/db/generic/CmsVfsDriver.java | CmsVfsDriver.internalRemoveFolder | protected void internalRemoveFolder(CmsDbContext dbc, CmsProject currentProject, CmsResource resource)
throws CmsDataAccessException {
"""
Removes a resource physically in the database.<p>
@param dbc the current database context
@param currentProject the current project
@param resource the folder to remove
@throws CmsDataAccessException if something goes wrong
"""
PreparedStatement stmt = null;
Connection conn = null;
try {
conn = m_sqlManager.getConnection(dbc);
// delete the structure record
stmt = m_sqlManager.getPreparedStatement(conn, currentProject, "C_STRUCTURE_DELETE_BY_STRUCTUREID");
stmt.setString(1, resource.getStructureId().toString());
stmt.executeUpdate();
m_sqlManager.closeAll(dbc, null, stmt, null);
// delete the resource record
stmt = m_sqlManager.getPreparedStatement(conn, currentProject, "C_RESOURCES_DELETE_BY_RESOURCEID");
stmt.setString(1, resource.getResourceId().toString());
stmt.executeUpdate();
} catch (SQLException e) {
throw new CmsDbSqlException(
Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)),
e);
} finally {
m_sqlManager.closeAll(dbc, conn, stmt, null);
}
} | java | protected void internalRemoveFolder(CmsDbContext dbc, CmsProject currentProject, CmsResource resource)
throws CmsDataAccessException {
PreparedStatement stmt = null;
Connection conn = null;
try {
conn = m_sqlManager.getConnection(dbc);
// delete the structure record
stmt = m_sqlManager.getPreparedStatement(conn, currentProject, "C_STRUCTURE_DELETE_BY_STRUCTUREID");
stmt.setString(1, resource.getStructureId().toString());
stmt.executeUpdate();
m_sqlManager.closeAll(dbc, null, stmt, null);
// delete the resource record
stmt = m_sqlManager.getPreparedStatement(conn, currentProject, "C_RESOURCES_DELETE_BY_RESOURCEID");
stmt.setString(1, resource.getResourceId().toString());
stmt.executeUpdate();
} catch (SQLException e) {
throw new CmsDbSqlException(
Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)),
e);
} finally {
m_sqlManager.closeAll(dbc, conn, stmt, null);
}
} | [
"protected",
"void",
"internalRemoveFolder",
"(",
"CmsDbContext",
"dbc",
",",
"CmsProject",
"currentProject",
",",
"CmsResource",
"resource",
")",
"throws",
"CmsDataAccessException",
"{",
"PreparedStatement",
"stmt",
"=",
"null",
";",
"Connection",
"conn",
"=",
"null"... | Removes a resource physically in the database.<p>
@param dbc the current database context
@param currentProject the current project
@param resource the folder to remove
@throws CmsDataAccessException if something goes wrong | [
"Removes",
"a",
"resource",
"physically",
"in",
"the",
"database",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsVfsDriver.java#L3987-L4014 |
Impetus/Kundera | src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/admin/HBaseDataHandler.java | HBaseDataHandler.createHbaseRow | public HBaseRow createHbaseRow(EntityMetadata m, Object entity, Object rowId, List<RelationHolder> relations)
throws IOException {
"""
Creates the hbase row.
@param m
the m
@param entity
the entity
@param rowId
the row id
@param relations
the relations
@return the hBase row
@throws IOException
Signals that an I/O exception has occurred.
"""
MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
m.getPersistenceUnit());
EntityType entityType = metaModel.entity(m.getEntityClazz());
Set<Attribute> attributes = entityType.getAttributes();
if (metaModel.isEmbeddable(m.getIdAttribute().getBindableJavaType()))
{
rowId = KunderaCoreUtils.prepareCompositeKey(m, rowId);
}
HBaseRow hbaseRow = new HBaseRow(rowId, new ArrayList<HBaseCell>());
// handle attributes and embeddables
createCellsAndAddToRow(entity, metaModel, attributes, hbaseRow, m, -1, "");
// handle relations
if (relations != null && !relations.isEmpty())
{
hbaseRow.addCells(getRelationCell(m, rowId, relations));
}
// handle inheritence
String discrColumn = ((AbstractManagedType) entityType).getDiscriminatorColumn();
String discrValue = ((AbstractManagedType) entityType).getDiscriminatorValue();
if (discrColumn != null && discrValue != null)
{
hbaseRow.addCell(new HBaseCell(m.getTableName(), discrColumn, discrValue));
}
return hbaseRow;
} | java | public HBaseRow createHbaseRow(EntityMetadata m, Object entity, Object rowId, List<RelationHolder> relations)
throws IOException
{
MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
m.getPersistenceUnit());
EntityType entityType = metaModel.entity(m.getEntityClazz());
Set<Attribute> attributes = entityType.getAttributes();
if (metaModel.isEmbeddable(m.getIdAttribute().getBindableJavaType()))
{
rowId = KunderaCoreUtils.prepareCompositeKey(m, rowId);
}
HBaseRow hbaseRow = new HBaseRow(rowId, new ArrayList<HBaseCell>());
// handle attributes and embeddables
createCellsAndAddToRow(entity, metaModel, attributes, hbaseRow, m, -1, "");
// handle relations
if (relations != null && !relations.isEmpty())
{
hbaseRow.addCells(getRelationCell(m, rowId, relations));
}
// handle inheritence
String discrColumn = ((AbstractManagedType) entityType).getDiscriminatorColumn();
String discrValue = ((AbstractManagedType) entityType).getDiscriminatorValue();
if (discrColumn != null && discrValue != null)
{
hbaseRow.addCell(new HBaseCell(m.getTableName(), discrColumn, discrValue));
}
return hbaseRow;
} | [
"public",
"HBaseRow",
"createHbaseRow",
"(",
"EntityMetadata",
"m",
",",
"Object",
"entity",
",",
"Object",
"rowId",
",",
"List",
"<",
"RelationHolder",
">",
"relations",
")",
"throws",
"IOException",
"{",
"MetamodelImpl",
"metaModel",
"=",
"(",
"MetamodelImpl",
... | Creates the hbase row.
@param m
the m
@param entity
the entity
@param rowId
the row id
@param relations
the relations
@return the hBase row
@throws IOException
Signals that an I/O exception has occurred. | [
"Creates",
"the",
"hbase",
"row",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/admin/HBaseDataHandler.java#L251-L278 |
jamesagnew/hapi-fhir | hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/validation/BaseValidator.java | BaseValidator.suppressedwarning | protected boolean suppressedwarning(List<ValidationMessage> errors, IssueType type, List<String> pathParts, boolean thePass, String theMessage, Object... theMessageArguments) {
"""
Test a rule and add a {@link IssueSeverity#WARNING} validation message if the validation fails
@param thePass
Set this parameter to <code>false</code> if the validation does not pass
@return Returns <code>thePass</code> (in other words, returns <code>true</code> if the rule did not fail validation)
"""
if (!thePass) {
String path = toPath(pathParts);
String message = formatMessage(theMessage, theMessageArguments);
addValidationMessage(errors, type, -1, -1, path, message, IssueSeverity.INFORMATION);
}
return thePass;
} | java | protected boolean suppressedwarning(List<ValidationMessage> errors, IssueType type, List<String> pathParts, boolean thePass, String theMessage, Object... theMessageArguments) {
if (!thePass) {
String path = toPath(pathParts);
String message = formatMessage(theMessage, theMessageArguments);
addValidationMessage(errors, type, -1, -1, path, message, IssueSeverity.INFORMATION);
}
return thePass;
} | [
"protected",
"boolean",
"suppressedwarning",
"(",
"List",
"<",
"ValidationMessage",
">",
"errors",
",",
"IssueType",
"type",
",",
"List",
"<",
"String",
">",
"pathParts",
",",
"boolean",
"thePass",
",",
"String",
"theMessage",
",",
"Object",
"...",
"theMessageAr... | Test a rule and add a {@link IssueSeverity#WARNING} validation message if the validation fails
@param thePass
Set this parameter to <code>false</code> if the validation does not pass
@return Returns <code>thePass</code> (in other words, returns <code>true</code> if the rule did not fail validation) | [
"Test",
"a",
"rule",
"and",
"add",
"a",
"{",
"@link",
"IssueSeverity#WARNING",
"}",
"validation",
"message",
"if",
"the",
"validation",
"fails"
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/validation/BaseValidator.java#L439-L446 |
Axway/Grapes | server/src/main/java/org/axway/grapes/server/core/ModuleHandler.java | ModuleHandler.getModuleLicenses | public List<DbLicense> getModuleLicenses(final String moduleId,
final LicenseMatcher licenseMatcher) {
"""
Return a licenses view of the targeted module
@param moduleId String
@return List<DbLicense>
"""
final DbModule module = getModule(moduleId);
final List<DbLicense> licenses = new ArrayList<>();
final FiltersHolder filters = new FiltersHolder();
final ArtifactHandler artifactHandler = new ArtifactHandler(repositoryHandler, licenseMatcher);
for (final String gavc : DataUtils.getAllArtifacts(module)) {
licenses.addAll(artifactHandler.getArtifactLicenses(gavc, filters));
}
return licenses;
} | java | public List<DbLicense> getModuleLicenses(final String moduleId,
final LicenseMatcher licenseMatcher) {
final DbModule module = getModule(moduleId);
final List<DbLicense> licenses = new ArrayList<>();
final FiltersHolder filters = new FiltersHolder();
final ArtifactHandler artifactHandler = new ArtifactHandler(repositoryHandler, licenseMatcher);
for (final String gavc : DataUtils.getAllArtifacts(module)) {
licenses.addAll(artifactHandler.getArtifactLicenses(gavc, filters));
}
return licenses;
} | [
"public",
"List",
"<",
"DbLicense",
">",
"getModuleLicenses",
"(",
"final",
"String",
"moduleId",
",",
"final",
"LicenseMatcher",
"licenseMatcher",
")",
"{",
"final",
"DbModule",
"module",
"=",
"getModule",
"(",
"moduleId",
")",
";",
"final",
"List",
"<",
"DbL... | Return a licenses view of the targeted module
@param moduleId String
@return List<DbLicense> | [
"Return",
"a",
"licenses",
"view",
"of",
"the",
"targeted",
"module"
] | train | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/core/ModuleHandler.java#L124-L137 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/TCPChannel.java | TCPChannel.setup | public ChannelTermination setup(ChannelData runtimeConfig, TCPChannelConfiguration tcpConfig, TCPChannelFactory factory) throws ChannelException {
"""
Initialize this channel.
@param runtimeConfig
@param tcpConfig
@param factory
@return ChannelTermination
@throws ChannelException
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "setup");
}
this.channelFactory = factory;
this.channelData = runtimeConfig;
this.channelName = runtimeConfig.getName();
this.externalName = runtimeConfig.getExternalName();
this.config = tcpConfig;
for (int i = 0; i < this.inUse.length; i++) {
this.inUse[i] = new ConcurrentLinkedQueue<TCPConnLink>();
}
this.vcFactory = ChannelFrameworkFactory.getChannelFramework().getInboundVCFactory();
this.alists = AccessLists.getInstance(this.config);
if (this.config.isInbound() && acceptReqProcessor.get() == null) {
acceptReqProcessor = StaticValue.mutateStaticValue(acceptReqProcessor, new Callable<NBAccept>() {
@Override
public NBAccept call() throws Exception {
return new NBAccept(TCPChannel.this.config);
}
});
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "setup");
}
return null;
} | java | public ChannelTermination setup(ChannelData runtimeConfig, TCPChannelConfiguration tcpConfig, TCPChannelFactory factory) throws ChannelException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "setup");
}
this.channelFactory = factory;
this.channelData = runtimeConfig;
this.channelName = runtimeConfig.getName();
this.externalName = runtimeConfig.getExternalName();
this.config = tcpConfig;
for (int i = 0; i < this.inUse.length; i++) {
this.inUse[i] = new ConcurrentLinkedQueue<TCPConnLink>();
}
this.vcFactory = ChannelFrameworkFactory.getChannelFramework().getInboundVCFactory();
this.alists = AccessLists.getInstance(this.config);
if (this.config.isInbound() && acceptReqProcessor.get() == null) {
acceptReqProcessor = StaticValue.mutateStaticValue(acceptReqProcessor, new Callable<NBAccept>() {
@Override
public NBAccept call() throws Exception {
return new NBAccept(TCPChannel.this.config);
}
});
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "setup");
}
return null;
} | [
"public",
"ChannelTermination",
"setup",
"(",
"ChannelData",
"runtimeConfig",
",",
"TCPChannelConfiguration",
"tcpConfig",
",",
"TCPChannelFactory",
"factory",
")",
"throws",
"ChannelException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&... | Initialize this channel.
@param runtimeConfig
@param tcpConfig
@param factory
@return ChannelTermination
@throws ChannelException | [
"Initialize",
"this",
"channel",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/TCPChannel.java#L124-L156 |
xm-online/xm-commons | xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/service/PermissionCheckService.java | PermissionCheckService.hasPermission | @SuppressWarnings("unchecked")
public boolean hasPermission(Authentication authentication,
Serializable resource,
String resourceType,
Object privilege) {
"""
Check permission for role, privilege key, new resource and old resource.
@param authentication the authentication
@param resource the old resource
@param resourceType the resource type
@param privilege the privilege key
@return true if permitted
"""
boolean logPermission = isLogPermission(resource);
if (checkRole(authentication, privilege, logPermission)) {
return true;
}
if (resource != null) {
Object resourceId = ((Map<String, Object>) resource).get("id");
if (resourceId != null) {
((Map<String, Object>) resource).put(resourceType,
resourceFactory.getResource(resourceId, resourceType));
}
}
return checkPermission(authentication, resource, privilege, true, logPermission);
} | java | @SuppressWarnings("unchecked")
public boolean hasPermission(Authentication authentication,
Serializable resource,
String resourceType,
Object privilege) {
boolean logPermission = isLogPermission(resource);
if (checkRole(authentication, privilege, logPermission)) {
return true;
}
if (resource != null) {
Object resourceId = ((Map<String, Object>) resource).get("id");
if (resourceId != null) {
((Map<String, Object>) resource).put(resourceType,
resourceFactory.getResource(resourceId, resourceType));
}
}
return checkPermission(authentication, resource, privilege, true, logPermission);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"boolean",
"hasPermission",
"(",
"Authentication",
"authentication",
",",
"Serializable",
"resource",
",",
"String",
"resourceType",
",",
"Object",
"privilege",
")",
"{",
"boolean",
"logPermission",
"=",
... | Check permission for role, privilege key, new resource and old resource.
@param authentication the authentication
@param resource the old resource
@param resourceType the resource type
@param privilege the privilege key
@return true if permitted | [
"Check",
"permission",
"for",
"role",
"privilege",
"key",
"new",
"resource",
"and",
"old",
"resource",
"."
] | train | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/service/PermissionCheckService.java#L84-L101 |
Axway/Grapes | server/src/main/java/org/axway/grapes/server/webapp/resources/LicenseResource.java | LicenseResource.postLicense | @POST
public Response postLicense(@Auth final DbCredential credential, final License license) {
"""
Handle license posts when the server got a request POST <dm_url>/license & MIME that contains the license.
@param license The license to add to Grapes database
@return Response An acknowledgment:<br/>- 400 if the artifact is MIME is malformed<br/>- 500 if internal error<br/>- 201 if ok
"""
if(!credential.getRoles().contains(AvailableRoles.DATA_UPDATER)){
throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).build());
}
LOG.info("Got a post license request.");
//
// Checks if the data is corrupted, pattern can be compiled etc.
//
DataValidator.validate(license);
// Save the license
final DbLicense dbLicense = getModelMapper().getDbLicense(license);
//
// The store method will deal with making sure there are no pattern conflicts
// The reason behind this move is the presence of the instance of RepositoryHandler
// and the imposibility to access that handler from here.
//
getLicenseHandler().store(dbLicense);
cacheUtils.clear(CacheName.PROMOTION_REPORTS);
return Response.ok().status(HttpStatus.CREATED_201).build();
} | java | @POST
public Response postLicense(@Auth final DbCredential credential, final License license){
if(!credential.getRoles().contains(AvailableRoles.DATA_UPDATER)){
throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).build());
}
LOG.info("Got a post license request.");
//
// Checks if the data is corrupted, pattern can be compiled etc.
//
DataValidator.validate(license);
// Save the license
final DbLicense dbLicense = getModelMapper().getDbLicense(license);
//
// The store method will deal with making sure there are no pattern conflicts
// The reason behind this move is the presence of the instance of RepositoryHandler
// and the imposibility to access that handler from here.
//
getLicenseHandler().store(dbLicense);
cacheUtils.clear(CacheName.PROMOTION_REPORTS);
return Response.ok().status(HttpStatus.CREATED_201).build();
} | [
"@",
"POST",
"public",
"Response",
"postLicense",
"(",
"@",
"Auth",
"final",
"DbCredential",
"credential",
",",
"final",
"License",
"license",
")",
"{",
"if",
"(",
"!",
"credential",
".",
"getRoles",
"(",
")",
".",
"contains",
"(",
"AvailableRoles",
".",
"... | Handle license posts when the server got a request POST <dm_url>/license & MIME that contains the license.
@param license The license to add to Grapes database
@return Response An acknowledgment:<br/>- 400 if the artifact is MIME is malformed<br/>- 500 if internal error<br/>- 201 if ok | [
"Handle",
"license",
"posts",
"when",
"the",
"server",
"got",
"a",
"request",
"POST",
"<dm_url",
">",
"/",
"license",
"&",
"MIME",
"that",
"contains",
"the",
"license",
"."
] | train | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/webapp/resources/LicenseResource.java#L54-L79 |
alibaba/jstorm | jstorm-hdfs/src/main/java/com/alibaba/jstorm/hdfs/spout/HdfsSpout.java | HdfsSpout.renameToInProgressFile | private Path renameToInProgressFile(Path file)
throws IOException {
"""
Renames files with .inprogress suffix
@return path of renamed file
@throws if operation fails
"""
Path newFile = new Path( file.toString() + inprogress_suffix );
try {
if (hdfs.rename(file, newFile)) {
return newFile;
}
throw new RenameException(file, newFile);
} catch (IOException e){
throw new RenameException(file, newFile, e);
}
} | java | private Path renameToInProgressFile(Path file)
throws IOException {
Path newFile = new Path( file.toString() + inprogress_suffix );
try {
if (hdfs.rename(file, newFile)) {
return newFile;
}
throw new RenameException(file, newFile);
} catch (IOException e){
throw new RenameException(file, newFile, e);
}
} | [
"private",
"Path",
"renameToInProgressFile",
"(",
"Path",
"file",
")",
"throws",
"IOException",
"{",
"Path",
"newFile",
"=",
"new",
"Path",
"(",
"file",
".",
"toString",
"(",
")",
"+",
"inprogress_suffix",
")",
";",
"try",
"{",
"if",
"(",
"hdfs",
".",
"r... | Renames files with .inprogress suffix
@return path of renamed file
@throws if operation fails | [
"Renames",
"files",
"with",
".",
"inprogress",
"suffix"
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-hdfs/src/main/java/com/alibaba/jstorm/hdfs/spout/HdfsSpout.java#L647-L658 |
square/flow | flow/src/main/java/flow/Flow.java | Flow.replaceTop | public void replaceTop(@NonNull final Object key, @NonNull final Direction direction) {
"""
Replaces the top key of the history with the given key and dispatches in the given direction.
"""
setHistory(getHistory().buildUpon().pop(1).push(key).build(), direction);
} | java | public void replaceTop(@NonNull final Object key, @NonNull final Direction direction) {
setHistory(getHistory().buildUpon().pop(1).push(key).build(), direction);
} | [
"public",
"void",
"replaceTop",
"(",
"@",
"NonNull",
"final",
"Object",
"key",
",",
"@",
"NonNull",
"final",
"Direction",
"direction",
")",
"{",
"setHistory",
"(",
"getHistory",
"(",
")",
".",
"buildUpon",
"(",
")",
".",
"pop",
"(",
"1",
")",
".",
"pus... | Replaces the top key of the history with the given key and dispatches in the given direction. | [
"Replaces",
"the",
"top",
"key",
"of",
"the",
"history",
"with",
"the",
"given",
"key",
"and",
"dispatches",
"in",
"the",
"given",
"direction",
"."
] | train | https://github.com/square/flow/blob/1656288d1cb4a92dfbcff8276f4d7f9e3390419b/flow/src/main/java/flow/Flow.java#L215-L217 |
rzwitserloot/lombok | src/core/lombok/javac/handlers/JavacHandlerUtil.java | JavacHandlerUtil.injectMethod | public static void injectMethod(JavacNode typeNode, JCMethodDecl method, List<Type> paramTypes, Type returnType) {
"""
Adds the given new method declaration to the provided type AST Node.
Can also inject constructors.
Also takes care of updating the JavacAST.
"""
JCClassDecl type = (JCClassDecl) typeNode.get();
if (method.getName().contentEquals("<init>")) {
//Scan for default constructor, and remove it.
int idx = 0;
for (JCTree def : type.defs) {
if (def instanceof JCMethodDecl) {
if ((((JCMethodDecl) def).mods.flags & Flags.GENERATEDCONSTR) != 0) {
JavacNode tossMe = typeNode.getNodeFor(def);
if (tossMe != null) tossMe.up().removeChild(tossMe);
type.defs = addAllButOne(type.defs, idx);
ClassSymbolMembersField.remove(type.sym, ((JCMethodDecl) def).sym);
break;
}
}
idx++;
}
}
addSuppressWarningsAll(method.mods, typeNode, method.pos, getGeneratedBy(method), typeNode.getContext());
addGenerated(method.mods, typeNode, method.pos, getGeneratedBy(method), typeNode.getContext());
type.defs = type.defs.append(method);
fixMethodMirror(typeNode.getContext(), typeNode.getElement(), method.getModifiers().flags, method.getName(), paramTypes, returnType);
typeNode.add(method, Kind.METHOD);
} | java | public static void injectMethod(JavacNode typeNode, JCMethodDecl method, List<Type> paramTypes, Type returnType) {
JCClassDecl type = (JCClassDecl) typeNode.get();
if (method.getName().contentEquals("<init>")) {
//Scan for default constructor, and remove it.
int idx = 0;
for (JCTree def : type.defs) {
if (def instanceof JCMethodDecl) {
if ((((JCMethodDecl) def).mods.flags & Flags.GENERATEDCONSTR) != 0) {
JavacNode tossMe = typeNode.getNodeFor(def);
if (tossMe != null) tossMe.up().removeChild(tossMe);
type.defs = addAllButOne(type.defs, idx);
ClassSymbolMembersField.remove(type.sym, ((JCMethodDecl) def).sym);
break;
}
}
idx++;
}
}
addSuppressWarningsAll(method.mods, typeNode, method.pos, getGeneratedBy(method), typeNode.getContext());
addGenerated(method.mods, typeNode, method.pos, getGeneratedBy(method), typeNode.getContext());
type.defs = type.defs.append(method);
fixMethodMirror(typeNode.getContext(), typeNode.getElement(), method.getModifiers().flags, method.getName(), paramTypes, returnType);
typeNode.add(method, Kind.METHOD);
} | [
"public",
"static",
"void",
"injectMethod",
"(",
"JavacNode",
"typeNode",
",",
"JCMethodDecl",
"method",
",",
"List",
"<",
"Type",
">",
"paramTypes",
",",
"Type",
"returnType",
")",
"{",
"JCClassDecl",
"type",
"=",
"(",
"JCClassDecl",
")",
"typeNode",
".",
"... | Adds the given new method declaration to the provided type AST Node.
Can also inject constructors.
Also takes care of updating the JavacAST. | [
"Adds",
"the",
"given",
"new",
"method",
"declaration",
"to",
"the",
"provided",
"type",
"AST",
"Node",
".",
"Can",
"also",
"inject",
"constructors",
"."
] | train | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/handlers/JavacHandlerUtil.java#L1162-L1189 |
codelibs/fess | src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java | FessMessages.addErrorsCrudInvalidMode | public FessMessages addErrorsCrudInvalidMode(String property, String arg0, String arg1) {
"""
Add the created action message for the key 'errors.crud_invalid_mode' with parameters.
<pre>
message: Invalid mode(expected value is {0}, but it's {1}).
</pre>
@param property The property name for the message. (NotNull)
@param arg0 The parameter arg0 for message. (NotNull)
@param arg1 The parameter arg1 for message. (NotNull)
@return this. (NotNull)
"""
assertPropertyNotNull(property);
add(property, new UserMessage(ERRORS_crud_invalid_mode, arg0, arg1));
return this;
} | java | public FessMessages addErrorsCrudInvalidMode(String property, String arg0, String arg1) {
assertPropertyNotNull(property);
add(property, new UserMessage(ERRORS_crud_invalid_mode, arg0, arg1));
return this;
} | [
"public",
"FessMessages",
"addErrorsCrudInvalidMode",
"(",
"String",
"property",
",",
"String",
"arg0",
",",
"String",
"arg1",
")",
"{",
"assertPropertyNotNull",
"(",
"property",
")",
";",
"add",
"(",
"property",
",",
"new",
"UserMessage",
"(",
"ERRORS_crud_invali... | Add the created action message for the key 'errors.crud_invalid_mode' with parameters.
<pre>
message: Invalid mode(expected value is {0}, but it's {1}).
</pre>
@param property The property name for the message. (NotNull)
@param arg0 The parameter arg0 for message. (NotNull)
@param arg1 The parameter arg1 for message. (NotNull)
@return this. (NotNull) | [
"Add",
"the",
"created",
"action",
"message",
"for",
"the",
"key",
"errors",
".",
"crud_invalid_mode",
"with",
"parameters",
".",
"<pre",
">",
"message",
":",
"Invalid",
"mode",
"(",
"expected",
"value",
"is",
"{",
"0",
"}",
"but",
"it",
"s",
"{",
"1",
... | train | https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L2096-L2100 |
knowm/XChange | xchange-bitcointoyou/src/main/java/org/knowm/xchange/bitcointoyou/service/polling/BitcointoyouMarketDataServiceRaw.java | BitcointoyouMarketDataServiceRaw.getBitcointoyouPublicTrades | BitcointoyouPublicTrade[] getBitcointoyouPublicTrades(CurrencyPair currencyPair)
throws IOException {
"""
List all public trades made at Bitcointoyou Exchange.
@param currencyPair the trade currency pair
@return an array of {@link BitcointoyouPublicTrade}
@throws IOException
"""
try {
return getBitcointoyouPublicTrades(currencyPair, null, null);
} catch (BitcointoyouException e) {
throw new ExchangeException(e.getError());
}
} | java | BitcointoyouPublicTrade[] getBitcointoyouPublicTrades(CurrencyPair currencyPair)
throws IOException {
try {
return getBitcointoyouPublicTrades(currencyPair, null, null);
} catch (BitcointoyouException e) {
throw new ExchangeException(e.getError());
}
} | [
"BitcointoyouPublicTrade",
"[",
"]",
"getBitcointoyouPublicTrades",
"(",
"CurrencyPair",
"currencyPair",
")",
"throws",
"IOException",
"{",
"try",
"{",
"return",
"getBitcointoyouPublicTrades",
"(",
"currencyPair",
",",
"null",
",",
"null",
")",
";",
"}",
"catch",
"(... | List all public trades made at Bitcointoyou Exchange.
@param currencyPair the trade currency pair
@return an array of {@link BitcointoyouPublicTrade}
@throws IOException | [
"List",
"all",
"public",
"trades",
"made",
"at",
"Bitcointoyou",
"Exchange",
"."
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-bitcointoyou/src/main/java/org/knowm/xchange/bitcointoyou/service/polling/BitcointoyouMarketDataServiceRaw.java#L67-L75 |
virgo47/javasimon | core/src/main/java/org/javasimon/callback/quantiles/AutoQuantilesCallback.java | AutoQuantilesCallback.createBucketsAfterWarmup | protected Buckets createBucketsAfterWarmup(Stopwatch stopwatch) {
"""
Create the buckets after warmup time.
Can be overridden to customize buckets configuration.
By default buckets are create with:<ul>
<li>Min: stopwatch min-10% rounded to inferior millisecond</li>
<li>Max: stopwatch max+10 rounded to superior millisecond</li>
<li>Nb buckets: {@link #bucketNb}
@param stopwatch Stopwatch (containing configuration)
@return new Buckets objects
"""
// Compute min
long min = stopwatch.getMin() * 90L / 100L; // min -10%
min = Math.max(0, min); // no negative mins
min = (min / SimonClock.NANOS_IN_MILLIS) * SimonClock.NANOS_IN_MILLIS; // round to lower millisecond
// Compute max
long max = (stopwatch.getMax() * 110L) / 100L; // max +10%
max = (max / SimonClock.NANOS_IN_MILLIS + 1) * SimonClock.NANOS_IN_MILLIS; // round to upper millisecond
return createBuckets(stopwatch, min, max, bucketNb);
} | java | protected Buckets createBucketsAfterWarmup(Stopwatch stopwatch) {
// Compute min
long min = stopwatch.getMin() * 90L / 100L; // min -10%
min = Math.max(0, min); // no negative mins
min = (min / SimonClock.NANOS_IN_MILLIS) * SimonClock.NANOS_IN_MILLIS; // round to lower millisecond
// Compute max
long max = (stopwatch.getMax() * 110L) / 100L; // max +10%
max = (max / SimonClock.NANOS_IN_MILLIS + 1) * SimonClock.NANOS_IN_MILLIS; // round to upper millisecond
return createBuckets(stopwatch, min, max, bucketNb);
} | [
"protected",
"Buckets",
"createBucketsAfterWarmup",
"(",
"Stopwatch",
"stopwatch",
")",
"{",
"// Compute min\r",
"long",
"min",
"=",
"stopwatch",
".",
"getMin",
"(",
")",
"*",
"90L",
"/",
"100L",
";",
"// min -10%\r",
"min",
"=",
"Math",
".",
"max",
"(",
"0"... | Create the buckets after warmup time.
Can be overridden to customize buckets configuration.
By default buckets are create with:<ul>
<li>Min: stopwatch min-10% rounded to inferior millisecond</li>
<li>Max: stopwatch max+10 rounded to superior millisecond</li>
<li>Nb buckets: {@link #bucketNb}
@param stopwatch Stopwatch (containing configuration)
@return new Buckets objects | [
"Create",
"the",
"buckets",
"after",
"warmup",
"time",
".",
"Can",
"be",
"overridden",
"to",
"customize",
"buckets",
"configuration",
".",
"By",
"default",
"buckets",
"are",
"create",
"with",
":",
"<ul",
">",
"<li",
">",
"Min",
":",
"stopwatch",
"min",
"-"... | train | https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/quantiles/AutoQuantilesCallback.java#L112-L121 |
real-logic/simple-binary-encoding | sbe-tool/src/main/java/uk/co/real_logic/sbe/otf/OtfHeaderDecoder.java | OtfHeaderDecoder.getSchemaId | public int getSchemaId(final DirectBuffer buffer, final int bufferOffset) {
"""
Get the schema id number from the message header.
@param buffer from which to read the value.
@param bufferOffset in the buffer at which the message header begins.
@return the value of the schema id number.
"""
return Types.getInt(buffer, bufferOffset + schemaIdOffset, schemaIdType, schemaIdByteOrder);
} | java | public int getSchemaId(final DirectBuffer buffer, final int bufferOffset)
{
return Types.getInt(buffer, bufferOffset + schemaIdOffset, schemaIdType, schemaIdByteOrder);
} | [
"public",
"int",
"getSchemaId",
"(",
"final",
"DirectBuffer",
"buffer",
",",
"final",
"int",
"bufferOffset",
")",
"{",
"return",
"Types",
".",
"getInt",
"(",
"buffer",
",",
"bufferOffset",
"+",
"schemaIdOffset",
",",
"schemaIdType",
",",
"schemaIdByteOrder",
")"... | Get the schema id number from the message header.
@param buffer from which to read the value.
@param bufferOffset in the buffer at which the message header begins.
@return the value of the schema id number. | [
"Get",
"the",
"schema",
"id",
"number",
"from",
"the",
"message",
"header",
"."
] | train | https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/otf/OtfHeaderDecoder.java#L118-L121 |
kiegroup/drools | drools-core/src/main/java/org/drools/core/impl/KnowledgeBaseImpl.java | KnowledgeBaseImpl.populateGlobalsMap | private void populateGlobalsMap(Map<String, String> globs) throws ClassNotFoundException {
"""
globals class types must be re-wired after serialization
@throws ClassNotFoundException
"""
this.globals = new HashMap<String, Class<?>>();
for (Map.Entry<String, String> entry : globs.entrySet()) {
addGlobal( entry.getKey(),
this.rootClassLoader.loadClass( entry.getValue() ) );
}
} | java | private void populateGlobalsMap(Map<String, String> globs) throws ClassNotFoundException {
this.globals = new HashMap<String, Class<?>>();
for (Map.Entry<String, String> entry : globs.entrySet()) {
addGlobal( entry.getKey(),
this.rootClassLoader.loadClass( entry.getValue() ) );
}
} | [
"private",
"void",
"populateGlobalsMap",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"globs",
")",
"throws",
"ClassNotFoundException",
"{",
"this",
".",
"globals",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Class",
"<",
"?",
">",
">",
"(",
")",
";",
... | globals class types must be re-wired after serialization
@throws ClassNotFoundException | [
"globals",
"class",
"types",
"must",
"be",
"re",
"-",
"wired",
"after",
"serialization"
] | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/impl/KnowledgeBaseImpl.java#L588-L594 |
apache/groovy | subprojects/groovy-dateutil/src/main/java/org/apache/groovy/dateutil/extensions/DateUtilExtensions.java | DateUtilExtensions.plus | public static java.sql.Date plus(java.sql.Date self, int days) {
"""
Add a number of days to this date and returns the new date.
@param self a java.sql.Date
@param days the number of days to increase
@return the new date
@since 1.0
"""
return new java.sql.Date(plus((Date) self, days).getTime());
} | java | public static java.sql.Date plus(java.sql.Date self, int days) {
return new java.sql.Date(plus((Date) self, days).getTime());
} | [
"public",
"static",
"java",
".",
"sql",
".",
"Date",
"plus",
"(",
"java",
".",
"sql",
".",
"Date",
"self",
",",
"int",
"days",
")",
"{",
"return",
"new",
"java",
".",
"sql",
".",
"Date",
"(",
"plus",
"(",
"(",
"Date",
")",
"self",
",",
"days",
... | Add a number of days to this date and returns the new date.
@param self a java.sql.Date
@param days the number of days to increase
@return the new date
@since 1.0 | [
"Add",
"a",
"number",
"of",
"days",
"to",
"this",
"date",
"and",
"returns",
"the",
"new",
"date",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-dateutil/src/main/java/org/apache/groovy/dateutil/extensions/DateUtilExtensions.java#L392-L394 |
Jasig/uPortal | uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/rest/permissions/PermissionsRESTController.java | PermissionsRESTController.getActivities | @PreAuthorize(
"hasPermission('ALL', 'java.lang.String', new org.apereo.portal.spring.security.evaluator.AuthorizableActivity('UP_PERMISSIONS', 'VIEW_PERMISSIONS'))")
@RequestMapping(value = "/permissions/activities.json", method = RequestMethod.GET)
public ModelAndView getActivities(@RequestParam(value = "q", required = false) String query) {
"""
Provide a list of all registered IPermissionActivities. If an optional search string is
provided, the returned list will be restricted to activities matching the query.
"""
if (StringUtils.isNotBlank(query)) {
query = query.toLowerCase();
}
List<IPermissionActivity> activities = new ArrayList<>();
Collection<IPermissionOwner> owners = permissionOwnerDao.getAllPermissionOwners();
for (IPermissionOwner owner : owners) {
for (IPermissionActivity activity : owner.getActivities()) {
if (StringUtils.isBlank(query)
|| activity.getName().toLowerCase().contains(query)) {
activities.add(activity);
}
}
}
Collections.sort(activities);
ModelAndView mv = new ModelAndView();
mv.addObject("activities", activities);
mv.setViewName("json");
return mv;
} | java | @PreAuthorize(
"hasPermission('ALL', 'java.lang.String', new org.apereo.portal.spring.security.evaluator.AuthorizableActivity('UP_PERMISSIONS', 'VIEW_PERMISSIONS'))")
@RequestMapping(value = "/permissions/activities.json", method = RequestMethod.GET)
public ModelAndView getActivities(@RequestParam(value = "q", required = false) String query) {
if (StringUtils.isNotBlank(query)) {
query = query.toLowerCase();
}
List<IPermissionActivity> activities = new ArrayList<>();
Collection<IPermissionOwner> owners = permissionOwnerDao.getAllPermissionOwners();
for (IPermissionOwner owner : owners) {
for (IPermissionActivity activity : owner.getActivities()) {
if (StringUtils.isBlank(query)
|| activity.getName().toLowerCase().contains(query)) {
activities.add(activity);
}
}
}
Collections.sort(activities);
ModelAndView mv = new ModelAndView();
mv.addObject("activities", activities);
mv.setViewName("json");
return mv;
} | [
"@",
"PreAuthorize",
"(",
"\"hasPermission('ALL', 'java.lang.String', new org.apereo.portal.spring.security.evaluator.AuthorizableActivity('UP_PERMISSIONS', 'VIEW_PERMISSIONS'))\"",
")",
"@",
"RequestMapping",
"(",
"value",
"=",
"\"/permissions/activities.json\"",
",",
"method",
"=",
"Re... | Provide a list of all registered IPermissionActivities. If an optional search string is
provided, the returned list will be restricted to activities matching the query. | [
"Provide",
"a",
"list",
"of",
"all",
"registered",
"IPermissionActivities",
".",
"If",
"an",
"optional",
"search",
"string",
"is",
"provided",
"the",
"returned",
"list",
"will",
"be",
"restricted",
"to",
"activities",
"matching",
"the",
"query",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/rest/permissions/PermissionsRESTController.java#L149-L176 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/MonitoredResource.java | MonitoredResource.of | public static MonitoredResource of(String type, Map<String, String> labels) {
"""
Creates a {@code MonitoredResource} object given the resource's type and labels.
"""
return newBuilder(type).setLabels(labels).build();
} | java | public static MonitoredResource of(String type, Map<String, String> labels) {
return newBuilder(type).setLabels(labels).build();
} | [
"public",
"static",
"MonitoredResource",
"of",
"(",
"String",
"type",
",",
"Map",
"<",
"String",
",",
"String",
">",
"labels",
")",
"{",
"return",
"newBuilder",
"(",
"type",
")",
".",
"setLabels",
"(",
"labels",
")",
".",
"build",
"(",
")",
";",
"}"
] | Creates a {@code MonitoredResource} object given the resource's type and labels. | [
"Creates",
"a",
"{"
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/MonitoredResource.java#L158-L160 |
cdk/cdk | app/depict/src/main/java/org/openscience/cdk/depict/Abbreviations.java | Abbreviations.matchExact | private IQueryAtom matchExact(final IAtomContainer mol, final IAtom atom) {
"""
Make a query atom that matches atomic number, h count, valence, and
connectivity. This effectively provides an exact match for that atom
type.
@param mol molecule
@param atom atom of molecule
@return the query atom (null if attachment point)
"""
final IChemObjectBuilder bldr = atom.getBuilder();
int elem = atom.getAtomicNumber();
// attach atom skipped
if (elem == 0)
return null;
int hcnt = atom.getImplicitHydrogenCount();
int val = hcnt;
int con = hcnt;
for (IBond bond : mol.getConnectedBondsList(atom)) {
val += bond.getOrder().numeric();
con++;
if (bond.getOther(atom).getAtomicNumber() == 1)
hcnt++;
}
Expr expr = new Expr(Expr.Type.ELEMENT, elem)
.and(new Expr(Expr.Type.TOTAL_DEGREE, con))
.and(new Expr(Expr.Type.TOTAL_H_COUNT, hcnt))
.and(new Expr(Expr.Type.VALENCE, val));
return new QueryAtom(expr);
} | java | private IQueryAtom matchExact(final IAtomContainer mol, final IAtom atom) {
final IChemObjectBuilder bldr = atom.getBuilder();
int elem = atom.getAtomicNumber();
// attach atom skipped
if (elem == 0)
return null;
int hcnt = atom.getImplicitHydrogenCount();
int val = hcnt;
int con = hcnt;
for (IBond bond : mol.getConnectedBondsList(atom)) {
val += bond.getOrder().numeric();
con++;
if (bond.getOther(atom).getAtomicNumber() == 1)
hcnt++;
}
Expr expr = new Expr(Expr.Type.ELEMENT, elem)
.and(new Expr(Expr.Type.TOTAL_DEGREE, con))
.and(new Expr(Expr.Type.TOTAL_H_COUNT, hcnt))
.and(new Expr(Expr.Type.VALENCE, val));
return new QueryAtom(expr);
} | [
"private",
"IQueryAtom",
"matchExact",
"(",
"final",
"IAtomContainer",
"mol",
",",
"final",
"IAtom",
"atom",
")",
"{",
"final",
"IChemObjectBuilder",
"bldr",
"=",
"atom",
".",
"getBuilder",
"(",
")",
";",
"int",
"elem",
"=",
"atom",
".",
"getAtomicNumber",
"... | Make a query atom that matches atomic number, h count, valence, and
connectivity. This effectively provides an exact match for that atom
type.
@param mol molecule
@param atom atom of molecule
@return the query atom (null if attachment point) | [
"Make",
"a",
"query",
"atom",
"that",
"matches",
"atomic",
"number",
"h",
"count",
"valence",
"and",
"connectivity",
".",
"This",
"effectively",
"provides",
"an",
"exact",
"match",
"for",
"that",
"atom",
"type",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/app/depict/src/main/java/org/openscience/cdk/depict/Abbreviations.java#L693-L718 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/filter/WebAppFilterManager.java | WebAppFilterManager.getFilterChain | public WebAppFilterChain getFilterChain(String reqURI, ServletWrapper reqServlet) throws ServletException {
"""
Returns a WebAppFilterChain object corresponding to the passed in uri and
servlet. If the filter chain has previously been created, return that
instance...if not, then create a new filter chain instance, ensuring that
all filters in the chain are loaded
@param uri
- String containing the uri for which a filter chain is
desired
@return a WebAppFilterChain object corresponding to the passed in uri
@throws ServletException
"""
return this.getFilterChain(reqURI, reqServlet, DispatcherType.REQUEST);
} | java | public WebAppFilterChain getFilterChain(String reqURI, ServletWrapper reqServlet) throws ServletException {
return this.getFilterChain(reqURI, reqServlet, DispatcherType.REQUEST);
} | [
"public",
"WebAppFilterChain",
"getFilterChain",
"(",
"String",
"reqURI",
",",
"ServletWrapper",
"reqServlet",
")",
"throws",
"ServletException",
"{",
"return",
"this",
".",
"getFilterChain",
"(",
"reqURI",
",",
"reqServlet",
",",
"DispatcherType",
".",
"REQUEST",
"... | Returns a WebAppFilterChain object corresponding to the passed in uri and
servlet. If the filter chain has previously been created, return that
instance...if not, then create a new filter chain instance, ensuring that
all filters in the chain are loaded
@param uri
- String containing the uri for which a filter chain is
desired
@return a WebAppFilterChain object corresponding to the passed in uri
@throws ServletException | [
"Returns",
"a",
"WebAppFilterChain",
"object",
"corresponding",
"to",
"the",
"passed",
"in",
"uri",
"and",
"servlet",
".",
"If",
"the",
"filter",
"chain",
"has",
"previously",
"been",
"created",
"return",
"that",
"instance",
"...",
"if",
"not",
"then",
"create... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/filter/WebAppFilterManager.java#L414-L417 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF2.java | CommonOps_DDF2.subtractEquals | public static void subtractEquals( DMatrix2 a , DMatrix2 b ) {
"""
<p>Performs the following operation:<br>
<br>
a = a - b <br>
a<sub>i</sub> = a<sub>i</sub> - b<sub>i</sub> <br>
</p>
@param a A Vector. Modified.
@param b A Vector. Not modified.
"""
a.a1 -= b.a1;
a.a2 -= b.a2;
} | java | public static void subtractEquals( DMatrix2 a , DMatrix2 b ) {
a.a1 -= b.a1;
a.a2 -= b.a2;
} | [
"public",
"static",
"void",
"subtractEquals",
"(",
"DMatrix2",
"a",
",",
"DMatrix2",
"b",
")",
"{",
"a",
".",
"a1",
"-=",
"b",
".",
"a1",
";",
"a",
".",
"a2",
"-=",
"b",
".",
"a2",
";",
"}"
] | <p>Performs the following operation:<br>
<br>
a = a - b <br>
a<sub>i</sub> = a<sub>i</sub> - b<sub>i</sub> <br>
</p>
@param a A Vector. Modified.
@param b A Vector. Not modified. | [
"<p",
">",
"Performs",
"the",
"following",
"operation",
":",
"<br",
">",
"<br",
">",
"a",
"=",
"a",
"-",
"b",
"<br",
">",
"a<sub",
">",
"i<",
"/",
"sub",
">",
"=",
"a<sub",
">",
"i<",
"/",
"sub",
">",
"-",
"b<sub",
">",
"i<",
"/",
"sub",
">",... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF2.java#L175-L178 |
jdereg/java-util | src/main/java/com/cedarsoftware/util/UrlUtilities.java | UrlUtilities.getContentFromUrlAsString | @Deprecated
public static String getContentFromUrlAsString(String url, String proxyServer, int port, Map inCookies, Map outCookies, boolean ignoreSec) {
"""
Get content from the passed in URL. This code will open a connection to
the passed in server, fetch the requested content, and return it as a
String.
Anyone using the proxy calls such as this one should have that managed by the jvm with -D parameters:
http.proxyHost
http.proxyPort (default: 80)
always * https.proxyHost
https.proxyPort
Example: -Dhttp.proxyHost=proxy.example.org -Dhttp.proxyPort=8080 -Dhttps.proxyHost=proxy.example.org -Dhttps.proxyPort=8080 -Dhttp.nonProxyHosts=*.foo.com|localhost|*.td.afg
@param url URL to hit
@param proxyServer String named of proxy server
@param port port to access proxy server
@param inCookies Map of session cookies (or null if not needed)
@param outCookies Map of session cookies (or null if not needed)
@param ignoreSec if true, SSL connection will always be trusted.
@return String of content fetched from URL.
@deprecated As of release 1.13.0, replaced by {@link #getContentFromUrlAsString(String, java.util.Map, java.util.Map, boolean)}
"""
return getContentFromUrlAsString(url, inCookies, outCookies, ignoreSec);
} | java | @Deprecated
public static String getContentFromUrlAsString(String url, String proxyServer, int port, Map inCookies, Map outCookies, boolean ignoreSec)
{
return getContentFromUrlAsString(url, inCookies, outCookies, ignoreSec);
} | [
"@",
"Deprecated",
"public",
"static",
"String",
"getContentFromUrlAsString",
"(",
"String",
"url",
",",
"String",
"proxyServer",
",",
"int",
"port",
",",
"Map",
"inCookies",
",",
"Map",
"outCookies",
",",
"boolean",
"ignoreSec",
")",
"{",
"return",
"getContentF... | Get content from the passed in URL. This code will open a connection to
the passed in server, fetch the requested content, and return it as a
String.
Anyone using the proxy calls such as this one should have that managed by the jvm with -D parameters:
http.proxyHost
http.proxyPort (default: 80)
always * https.proxyHost
https.proxyPort
Example: -Dhttp.proxyHost=proxy.example.org -Dhttp.proxyPort=8080 -Dhttps.proxyHost=proxy.example.org -Dhttps.proxyPort=8080 -Dhttp.nonProxyHosts=*.foo.com|localhost|*.td.afg
@param url URL to hit
@param proxyServer String named of proxy server
@param port port to access proxy server
@param inCookies Map of session cookies (or null if not needed)
@param outCookies Map of session cookies (or null if not needed)
@param ignoreSec if true, SSL connection will always be trusted.
@return String of content fetched from URL.
@deprecated As of release 1.13.0, replaced by {@link #getContentFromUrlAsString(String, java.util.Map, java.util.Map, boolean)} | [
"Get",
"content",
"from",
"the",
"passed",
"in",
"URL",
".",
"This",
"code",
"will",
"open",
"a",
"connection",
"to",
"the",
"passed",
"in",
"server",
"fetch",
"the",
"requested",
"content",
"and",
"return",
"it",
"as",
"a",
"String",
"."
] | train | https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/UrlUtilities.java#L959-L963 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/models/BoxSession.java | BoxSession.onAuthFailure | @Override
public void onAuthFailure(BoxAuthentication.BoxAuthenticationInfo info, Exception ex) {
"""
Called when a failure occurs trying to authenticate or refresh.
@param info The last authentication information available, before the exception.
@param ex the exception that occurred.
"""
if (sameUser(info) || (info == null && getUserId() == null)) {
if (sessionAuthListener != null) {
sessionAuthListener.onAuthFailure(info, ex);
}
if (ex instanceof BoxException) {
BoxException.ErrorType errorType = ((BoxException) ex).getErrorType();
switch (errorType) {
case NETWORK_ERROR:
toastString(mApplicationContext, R.string.boxsdk_error_network_connection);
break;
case IP_BLOCKED:
}
}
}
} | java | @Override
public void onAuthFailure(BoxAuthentication.BoxAuthenticationInfo info, Exception ex) {
if (sameUser(info) || (info == null && getUserId() == null)) {
if (sessionAuthListener != null) {
sessionAuthListener.onAuthFailure(info, ex);
}
if (ex instanceof BoxException) {
BoxException.ErrorType errorType = ((BoxException) ex).getErrorType();
switch (errorType) {
case NETWORK_ERROR:
toastString(mApplicationContext, R.string.boxsdk_error_network_connection);
break;
case IP_BLOCKED:
}
}
}
} | [
"@",
"Override",
"public",
"void",
"onAuthFailure",
"(",
"BoxAuthentication",
".",
"BoxAuthenticationInfo",
"info",
",",
"Exception",
"ex",
")",
"{",
"if",
"(",
"sameUser",
"(",
"info",
")",
"||",
"(",
"info",
"==",
"null",
"&&",
"getUserId",
"(",
")",
"==... | Called when a failure occurs trying to authenticate or refresh.
@param info The last authentication information available, before the exception.
@param ex the exception that occurred. | [
"Called",
"when",
"a",
"failure",
"occurs",
"trying",
"to",
"authenticate",
"or",
"refresh",
"."
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/models/BoxSession.java#L596-L614 |
liferay/com-liferay-commerce | commerce-product-api/src/main/java/com/liferay/commerce/product/model/CPDefinitionSpecificationOptionValueWrapper.java | CPDefinitionSpecificationOptionValueWrapper.setValueMap | @Override
public void setValueMap(Map<java.util.Locale, String> valueMap) {
"""
Sets the localized values of this cp definition specification option value from the map of locales and localized values.
@param valueMap the locales and localized values of this cp definition specification option value
"""
_cpDefinitionSpecificationOptionValue.setValueMap(valueMap);
} | java | @Override
public void setValueMap(Map<java.util.Locale, String> valueMap) {
_cpDefinitionSpecificationOptionValue.setValueMap(valueMap);
} | [
"@",
"Override",
"public",
"void",
"setValueMap",
"(",
"Map",
"<",
"java",
".",
"util",
".",
"Locale",
",",
"String",
">",
"valueMap",
")",
"{",
"_cpDefinitionSpecificationOptionValue",
".",
"setValueMap",
"(",
"valueMap",
")",
";",
"}"
] | Sets the localized values of this cp definition specification option value from the map of locales and localized values.
@param valueMap the locales and localized values of this cp definition specification option value | [
"Sets",
"the",
"localized",
"values",
"of",
"this",
"cp",
"definition",
"specification",
"option",
"value",
"from",
"the",
"map",
"of",
"locales",
"and",
"localized",
"values",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-api/src/main/java/com/liferay/commerce/product/model/CPDefinitionSpecificationOptionValueWrapper.java#L714-L717 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java | NetworkWatchersInner.beginSetFlowLogConfiguration | public FlowLogInformationInner beginSetFlowLogConfiguration(String resourceGroupName, String networkWatcherName, FlowLogInformationInner parameters) {
"""
Configures flow log on a specified resource.
@param resourceGroupName The name of the network watcher resource group.
@param networkWatcherName The name of the network watcher resource.
@param parameters Parameters that define the configuration of flow log.
@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 FlowLogInformationInner object if successful.
"""
return beginSetFlowLogConfigurationWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().single().body();
} | java | public FlowLogInformationInner beginSetFlowLogConfiguration(String resourceGroupName, String networkWatcherName, FlowLogInformationInner parameters) {
return beginSetFlowLogConfigurationWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().single().body();
} | [
"public",
"FlowLogInformationInner",
"beginSetFlowLogConfiguration",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkWatcherName",
",",
"FlowLogInformationInner",
"parameters",
")",
"{",
"return",
"beginSetFlowLogConfigurationWithServiceResponseAsync",
"(",
"resourceGrou... | Configures flow log on a specified resource.
@param resourceGroupName The name of the network watcher resource group.
@param networkWatcherName The name of the network watcher resource.
@param parameters Parameters that define the configuration of flow log.
@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 FlowLogInformationInner object if successful. | [
"Configures",
"flow",
"log",
"on",
"a",
"specified",
"resource",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L1877-L1879 |
alipay/sofa-rpc | core/common/src/main/java/com/alipay/sofa/rpc/common/utils/CommonUtils.java | CommonUtils.join | public static String join(Collection collection, String separator) {
"""
连接集合类为字符串
@param collection 集合
@param separator 分隔符
@return 分隔符连接的字符串
"""
if (isEmpty(collection)) {
return StringUtils.EMPTY;
}
StringBuilder sb = new StringBuilder();
for (Object object : collection) {
if (object != null) {
String string = StringUtils.toString(object);
if (string != null) {
sb.append(string).append(separator);
}
}
}
return sb.length() > 0 ? sb.substring(0, sb.length() - separator.length()) : StringUtils.EMPTY;
} | java | public static String join(Collection collection, String separator) {
if (isEmpty(collection)) {
return StringUtils.EMPTY;
}
StringBuilder sb = new StringBuilder();
for (Object object : collection) {
if (object != null) {
String string = StringUtils.toString(object);
if (string != null) {
sb.append(string).append(separator);
}
}
}
return sb.length() > 0 ? sb.substring(0, sb.length() - separator.length()) : StringUtils.EMPTY;
} | [
"public",
"static",
"String",
"join",
"(",
"Collection",
"collection",
",",
"String",
"separator",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"collection",
")",
")",
"{",
"return",
"StringUtils",
".",
"EMPTY",
";",
"}",
"StringBuilder",
"sb",
"=",
"new",
"String... | 连接集合类为字符串
@param collection 集合
@param separator 分隔符
@return 分隔符连接的字符串 | [
"连接集合类为字符串"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/common/src/main/java/com/alipay/sofa/rpc/common/utils/CommonUtils.java#L263-L277 |
actframework/actframework | src/main/java/act/internal/util/AppDescriptor.java | AppDescriptor.of | public static AppDescriptor of(String appName, Class<?> entryClass) {
"""
Create an `AppDescriptor` with appName and entry class specified.
If `appName` is `null` or blank, it will try the following
approach to get app name:
1. check the {@link Version#getArtifactId() artifact id} and use it unless
2. if artifact id is null or empty, then infer app name using {@link AppNameInferer}
@param appName
the app name
@param entryClass
the entry class
@return
an `AppDescriptor` instance
"""
System.setProperty("osgl.version.suppress-var-found-warning", "true");
return of(appName, entryClass, Version.of(entryClass));
} | java | public static AppDescriptor of(String appName, Class<?> entryClass) {
System.setProperty("osgl.version.suppress-var-found-warning", "true");
return of(appName, entryClass, Version.of(entryClass));
} | [
"public",
"static",
"AppDescriptor",
"of",
"(",
"String",
"appName",
",",
"Class",
"<",
"?",
">",
"entryClass",
")",
"{",
"System",
".",
"setProperty",
"(",
"\"osgl.version.suppress-var-found-warning\"",
",",
"\"true\"",
")",
";",
"return",
"of",
"(",
"appName",... | Create an `AppDescriptor` with appName and entry class specified.
If `appName` is `null` or blank, it will try the following
approach to get app name:
1. check the {@link Version#getArtifactId() artifact id} and use it unless
2. if artifact id is null or empty, then infer app name using {@link AppNameInferer}
@param appName
the app name
@param entryClass
the entry class
@return
an `AppDescriptor` instance | [
"Create",
"an",
"AppDescriptor",
"with",
"appName",
"and",
"entry",
"class",
"specified",
"."
] | train | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/internal/util/AppDescriptor.java#L196-L199 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/optionhandling/parameterization/ListParameterization.java | ListParameterization.addParameter | public ListParameterization addParameter(OptionID optionid, Object value) {
"""
Add a parameter to the parameter list
@param optionid Option ID
@param value Value
@return this, for chaining
"""
parameters.add(new ParameterPair(optionid, value));
return this;
} | java | public ListParameterization addParameter(OptionID optionid, Object value) {
parameters.add(new ParameterPair(optionid, value));
return this;
} | [
"public",
"ListParameterization",
"addParameter",
"(",
"OptionID",
"optionid",
",",
"Object",
"value",
")",
"{",
"parameters",
".",
"add",
"(",
"new",
"ParameterPair",
"(",
"optionid",
",",
"value",
")",
")",
";",
"return",
"this",
";",
"}"
] | Add a parameter to the parameter list
@param optionid Option ID
@param value Value
@return this, for chaining | [
"Add",
"a",
"parameter",
"to",
"the",
"parameter",
"list"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/optionhandling/parameterization/ListParameterization.java#L100-L103 |
lucmoreau/ProvToolbox | prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java | ProvFactory.newWasEndedBy | public WasEndedBy newWasEndedBy(QualifiedName id, QualifiedName activity, QualifiedName trigger, QualifiedName ender) {
"""
A factory method to create an instance of an end {@link WasEndedBy}
@param id
@param activity an identifier for the ended <a href="http://www.w3.org/TR/prov-dm/#end.activity">activity</a>
@param trigger an optional identifier for the <a href="http://www.w3.org/TR/prov-dm/#end.trigger">entity triggering</a> the activity ending
@param ender an optional identifier for the <a href="http://www.w3.org/TR/prov-dm/#end.ender">activity</a> that generated the (possibly unspecified) entity
@return an instance of {@link WasEndedBy}
"""
WasEndedBy res=newWasEndedBy(id,activity,trigger);
res.setEnder(ender);
return res;
} | java | public WasEndedBy newWasEndedBy(QualifiedName id, QualifiedName activity, QualifiedName trigger, QualifiedName ender) {
WasEndedBy res=newWasEndedBy(id,activity,trigger);
res.setEnder(ender);
return res;
} | [
"public",
"WasEndedBy",
"newWasEndedBy",
"(",
"QualifiedName",
"id",
",",
"QualifiedName",
"activity",
",",
"QualifiedName",
"trigger",
",",
"QualifiedName",
"ender",
")",
"{",
"WasEndedBy",
"res",
"=",
"newWasEndedBy",
"(",
"id",
",",
"activity",
",",
"trigger",
... | A factory method to create an instance of an end {@link WasEndedBy}
@param id
@param activity an identifier for the ended <a href="http://www.w3.org/TR/prov-dm/#end.activity">activity</a>
@param trigger an optional identifier for the <a href="http://www.w3.org/TR/prov-dm/#end.trigger">entity triggering</a> the activity ending
@param ender an optional identifier for the <a href="http://www.w3.org/TR/prov-dm/#end.ender">activity</a> that generated the (possibly unspecified) entity
@return an instance of {@link WasEndedBy} | [
"A",
"factory",
"method",
"to",
"create",
"an",
"instance",
"of",
"an",
"end",
"{"
] | train | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java#L1261-L1265 |
sendgrid/sendgrid-java | src/main/java/com/sendgrid/helpers/mail/Mail.java | Mail.addSection | public void addSection(String key, String value) {
"""
Add a section to the email.
@param key the section's key.
@param value the section's value.
"""
this.sections = addToMap(key, value, this.sections);
} | java | public void addSection(String key, String value) {
this.sections = addToMap(key, value, this.sections);
} | [
"public",
"void",
"addSection",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"this",
".",
"sections",
"=",
"addToMap",
"(",
"key",
",",
"value",
",",
"this",
".",
"sections",
")",
";",
"}"
] | Add a section to the email.
@param key the section's key.
@param value the section's value. | [
"Add",
"a",
"section",
"to",
"the",
"email",
"."
] | train | https://github.com/sendgrid/sendgrid-java/blob/22292142bf243d1a838744ee43902b5050bb6e5b/src/main/java/com/sendgrid/helpers/mail/Mail.java#L300-L302 |
javalite/activeweb | javalite-async/src/main/java/org/javalite/async/Async.java | Async.receiveCommand | @SuppressWarnings("unchecked")
public <T extends Command> T receiveCommand(String queueName, int timeout, Class<T> type) {
"""
Receives a command from a queue synchronously. If this queue also has listeners, then commands will be distributed across
all consumers.
@param queueName name of queue
@param timeout timeout in milliseconds. If a command is not received during a timeout, this methods returns null.
@param type expected class of a command
@return command if found. If command not found, this method will block till a command is present in queue.
@see {@link #receiveCommand(String, long)}
"""
return (T) receiveCommand(queueName, timeout);
} | java | @SuppressWarnings("unchecked")
public <T extends Command> T receiveCommand(String queueName, int timeout, Class<T> type) {
return (T) receiveCommand(queueName, timeout);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
"extends",
"Command",
">",
"T",
"receiveCommand",
"(",
"String",
"queueName",
",",
"int",
"timeout",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"(",
"T",
")",
"receiveC... | Receives a command from a queue synchronously. If this queue also has listeners, then commands will be distributed across
all consumers.
@param queueName name of queue
@param timeout timeout in milliseconds. If a command is not received during a timeout, this methods returns null.
@param type expected class of a command
@return command if found. If command not found, this method will block till a command is present in queue.
@see {@link #receiveCommand(String, long)} | [
"Receives",
"a",
"command",
"from",
"a",
"queue",
"synchronously",
".",
"If",
"this",
"queue",
"also",
"has",
"listeners",
"then",
"commands",
"will",
"be",
"distributed",
"across",
"all",
"consumers",
"."
] | train | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/javalite-async/src/main/java/org/javalite/async/Async.java#L418-L421 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webservices.javaee.common/src/com/ibm/ws/webservices/javaee/common/internal/JaxWsDDHelper.java | JaxWsDDHelper.getWebserviceDescriptionByServletLink | static WebserviceDescription getWebserviceDescriptionByServletLink(String servletLink, Adaptable containerToAdapt) throws UnableToAdaptException {
"""
Get the WebserviceDescription by servlet-link.
@param servletLink
@param containerToAdapt
@return
@throws UnableToAdaptException
"""
return getHighLevelElementByServiceImplBean(servletLink, containerToAdapt, WebserviceDescription.class, LinkType.SERVLET);
} | java | static WebserviceDescription getWebserviceDescriptionByServletLink(String servletLink, Adaptable containerToAdapt) throws UnableToAdaptException {
return getHighLevelElementByServiceImplBean(servletLink, containerToAdapt, WebserviceDescription.class, LinkType.SERVLET);
} | [
"static",
"WebserviceDescription",
"getWebserviceDescriptionByServletLink",
"(",
"String",
"servletLink",
",",
"Adaptable",
"containerToAdapt",
")",
"throws",
"UnableToAdaptException",
"{",
"return",
"getHighLevelElementByServiceImplBean",
"(",
"servletLink",
",",
"containerToAda... | Get the WebserviceDescription by servlet-link.
@param servletLink
@param containerToAdapt
@return
@throws UnableToAdaptException | [
"Get",
"the",
"WebserviceDescription",
"by",
"servlet",
"-",
"link",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webservices.javaee.common/src/com/ibm/ws/webservices/javaee/common/internal/JaxWsDDHelper.java#L80-L82 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java | PackageSummaryBuilder.buildAnnotationTypeSummary | public void buildAnnotationTypeSummary(XMLNode node, Content summaryContentTree) {
"""
Build the summary for the annotation type in this package.
@param node the XML element that specifies which components to document
@param summaryContentTree the summary tree to which the annotation type
summary will be added
"""
String annotationtypeTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Annotation_Types_Summary"),
configuration.getText("doclet.annotationtypes"));
String[] annotationtypeTableHeader = new String[] {
configuration.getText("doclet.AnnotationType"),
configuration.getText("doclet.Description")
};
ClassDoc[] annotationTypes =
packageDoc.isIncluded()
? packageDoc.annotationTypes()
: configuration.classDocCatalog.annotationTypes(
Util.getPackageName(packageDoc));
annotationTypes = Util.filterOutPrivateClasses(annotationTypes, configuration.javafx);
if (annotationTypes.length > 0) {
packageWriter.addClassesSummary(
annotationTypes,
configuration.getText("doclet.Annotation_Types_Summary"),
annotationtypeTableSummary, annotationtypeTableHeader,
summaryContentTree);
}
} | java | public void buildAnnotationTypeSummary(XMLNode node, Content summaryContentTree) {
String annotationtypeTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Annotation_Types_Summary"),
configuration.getText("doclet.annotationtypes"));
String[] annotationtypeTableHeader = new String[] {
configuration.getText("doclet.AnnotationType"),
configuration.getText("doclet.Description")
};
ClassDoc[] annotationTypes =
packageDoc.isIncluded()
? packageDoc.annotationTypes()
: configuration.classDocCatalog.annotationTypes(
Util.getPackageName(packageDoc));
annotationTypes = Util.filterOutPrivateClasses(annotationTypes, configuration.javafx);
if (annotationTypes.length > 0) {
packageWriter.addClassesSummary(
annotationTypes,
configuration.getText("doclet.Annotation_Types_Summary"),
annotationtypeTableSummary, annotationtypeTableHeader,
summaryContentTree);
}
} | [
"public",
"void",
"buildAnnotationTypeSummary",
"(",
"XMLNode",
"node",
",",
"Content",
"summaryContentTree",
")",
"{",
"String",
"annotationtypeTableSummary",
"=",
"configuration",
".",
"getText",
"(",
"\"doclet.Member_Table_Summary\"",
",",
"configuration",
".",
"getTex... | Build the summary for the annotation type in this package.
@param node the XML element that specifies which components to document
@param summaryContentTree the summary tree to which the annotation type
summary will be added | [
"Build",
"the",
"summary",
"for",
"the",
"annotation",
"type",
"in",
"this",
"package",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java#L314-L336 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/util/TimingInfo.java | TimingInfo.unmodifiableTimingInfo | public static TimingInfo unmodifiableTimingInfo(long startEpochTimeMilli, long startTimeNano, Long endTimeNano) {
"""
Returns an instance of {@link TimingInfo} that is not modifiable.
@param startEpochTimeMilli start time since epoch in millisecond
@param startTimeNano start time in nanosecond
@param endTimeNano end time in nanosecond; or null if not known
"""
return new TimingInfoUnmodifiable(startEpochTimeMilli, startTimeNano, endTimeNano);
} | java | public static TimingInfo unmodifiableTimingInfo(long startEpochTimeMilli, long startTimeNano, Long endTimeNano) {
return new TimingInfoUnmodifiable(startEpochTimeMilli, startTimeNano, endTimeNano);
} | [
"public",
"static",
"TimingInfo",
"unmodifiableTimingInfo",
"(",
"long",
"startEpochTimeMilli",
",",
"long",
"startTimeNano",
",",
"Long",
"endTimeNano",
")",
"{",
"return",
"new",
"TimingInfoUnmodifiable",
"(",
"startEpochTimeMilli",
",",
"startTimeNano",
",",
"endTime... | Returns an instance of {@link TimingInfo} that is not modifiable.
@param startEpochTimeMilli start time since epoch in millisecond
@param startTimeNano start time in nanosecond
@param endTimeNano end time in nanosecond; or null if not known | [
"Returns",
"an",
"instance",
"of",
"{",
"@link",
"TimingInfo",
"}",
"that",
"is",
"not",
"modifiable",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/TimingInfo.java#L149-L151 |
teatrove/teatrove | teaapps/src/main/java/org/teatrove/teaapps/contexts/BeanContext.java | BeanContext.getBeanMap | public BeanMap getBeanMap(Object bean, boolean failOnNulls)
throws BeanContextException {
"""
Get an object wrapping the given bean that allows dynamic property
lookups. The <code>failOnNulls</code> parameter may be used to cause
an exception to be thrown when portions of the composite graph are
<code>null</code>.
<code>bean = getBeanMap(bean); bean['name']</code>
@param bean The bean to wrap and return
@param failOnNulls The state of whether to throw exceptions on null graph
@return The object allowing dynamic lookups on the bean
@throws BeanContextException If any portion of the composite graph is
<code>null</code> such as city being null in 'team.city.name'.
This is only thrown if failOnNulls is <code>true</code>
"""
BeanPropertyAccessor accessor =
BeanPropertyAccessor.forClass(bean.getClass());
return new BeanMap(bean, accessor, failOnNulls);
} | java | public BeanMap getBeanMap(Object bean, boolean failOnNulls)
throws BeanContextException {
BeanPropertyAccessor accessor =
BeanPropertyAccessor.forClass(bean.getClass());
return new BeanMap(bean, accessor, failOnNulls);
} | [
"public",
"BeanMap",
"getBeanMap",
"(",
"Object",
"bean",
",",
"boolean",
"failOnNulls",
")",
"throws",
"BeanContextException",
"{",
"BeanPropertyAccessor",
"accessor",
"=",
"BeanPropertyAccessor",
".",
"forClass",
"(",
"bean",
".",
"getClass",
"(",
")",
")",
";",... | Get an object wrapping the given bean that allows dynamic property
lookups. The <code>failOnNulls</code> parameter may be used to cause
an exception to be thrown when portions of the composite graph are
<code>null</code>.
<code>bean = getBeanMap(bean); bean['name']</code>
@param bean The bean to wrap and return
@param failOnNulls The state of whether to throw exceptions on null graph
@return The object allowing dynamic lookups on the bean
@throws BeanContextException If any portion of the composite graph is
<code>null</code> such as city being null in 'team.city.name'.
This is only thrown if failOnNulls is <code>true</code> | [
"Get",
"an",
"object",
"wrapping",
"the",
"given",
"bean",
"that",
"allows",
"dynamic",
"property",
"lookups",
".",
"The",
"<code",
">",
"failOnNulls<",
"/",
"code",
">",
"parameter",
"may",
"be",
"used",
"to",
"cause",
"an",
"exception",
"to",
"be",
"thro... | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/BeanContext.java#L88-L94 |
EdwardRaff/JSAT | JSAT/src/jsat/linear/Matrix.java | Matrix.diagMult | public static void diagMult(Matrix A, Vec b) {
"""
Alters the matrix <i>A</i> so that it contains the result of <i>A</i>
times a sparse matrix represented by only its diagonal values or
<i>A = A*diag(<b>b</b>)</i>. This is equivalent to the code
<code>
A = A{@link #multiply(jsat.linear.Matrix) .multiply}
({@link #diag(jsat.linear.Vec) diag}(b))
</code>
@param A the square matrix to update
@param b the diagonal value vector
"""
if(A.cols() != b.length())
throw new ArithmeticException("Could not multiply, matrix dimensions must agree");
for(int i = 0; i < A.rows(); i++)
RowColumnOps.multRow(A, i, b);
} | java | public static void diagMult(Matrix A, Vec b)
{
if(A.cols() != b.length())
throw new ArithmeticException("Could not multiply, matrix dimensions must agree");
for(int i = 0; i < A.rows(); i++)
RowColumnOps.multRow(A, i, b);
} | [
"public",
"static",
"void",
"diagMult",
"(",
"Matrix",
"A",
",",
"Vec",
"b",
")",
"{",
"if",
"(",
"A",
".",
"cols",
"(",
")",
"!=",
"b",
".",
"length",
"(",
")",
")",
"throw",
"new",
"ArithmeticException",
"(",
"\"Could not multiply, matrix dimensions must... | Alters the matrix <i>A</i> so that it contains the result of <i>A</i>
times a sparse matrix represented by only its diagonal values or
<i>A = A*diag(<b>b</b>)</i>. This is equivalent to the code
<code>
A = A{@link #multiply(jsat.linear.Matrix) .multiply}
({@link #diag(jsat.linear.Vec) diag}(b))
</code>
@param A the square matrix to update
@param b the diagonal value vector | [
"Alters",
"the",
"matrix",
"<i",
">",
"A<",
"/",
"i",
">",
"so",
"that",
"it",
"contains",
"the",
"result",
"of",
"<i",
">",
"A<",
"/",
"i",
">",
"times",
"a",
"sparse",
"matrix",
"represented",
"by",
"only",
"its",
"diagonal",
"values",
"or",
"<i",
... | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/Matrix.java#L1037-L1043 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ClassDescriptorConstraints.java | ClassDescriptorConstraints.ensureNoTableInfoIfNoRepositoryInfo | private void ensureNoTableInfoIfNoRepositoryInfo(ClassDescriptorDef classDef, String checkLevel) {
"""
Ensures that generate-table-info is set to false if generate-repository-info is set to false.
@param classDef The class descriptor
@param checkLevel The current check level (this constraint is checked in all levels)
"""
if (!classDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_GENERATE_REPOSITORY_INFO, true))
{
classDef.setProperty(PropertyHelper.OJB_PROPERTY_GENERATE_TABLE_INFO, "false");
}
} | java | private void ensureNoTableInfoIfNoRepositoryInfo(ClassDescriptorDef classDef, String checkLevel)
{
if (!classDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_GENERATE_REPOSITORY_INFO, true))
{
classDef.setProperty(PropertyHelper.OJB_PROPERTY_GENERATE_TABLE_INFO, "false");
}
} | [
"private",
"void",
"ensureNoTableInfoIfNoRepositoryInfo",
"(",
"ClassDescriptorDef",
"classDef",
",",
"String",
"checkLevel",
")",
"{",
"if",
"(",
"!",
"classDef",
".",
"getBooleanProperty",
"(",
"PropertyHelper",
".",
"OJB_PROPERTY_GENERATE_REPOSITORY_INFO",
",",
"true",... | Ensures that generate-table-info is set to false if generate-repository-info is set to false.
@param classDef The class descriptor
@param checkLevel The current check level (this constraint is checked in all levels) | [
"Ensures",
"that",
"generate",
"-",
"table",
"-",
"info",
"is",
"set",
"to",
"false",
"if",
"generate",
"-",
"repository",
"-",
"info",
"is",
"set",
"to",
"false",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ClassDescriptorConstraints.java#L66-L72 |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/utils/JInternalFrameExtensions.java | JInternalFrameExtensions.addViewToFrame | public static void addViewToFrame(final JInternalFrame internalFrame, final View<?, ?> view) {
"""
Adds the given {@link View} object to the given {@link JInternalFrame} object.
@param internalFrame
the {@link JInternalFrame} object.
@param view
the {@link View} object to add
"""
internalFrame.add(view.getComponent(), BorderLayout.CENTER);
internalFrame.pack();
} | java | public static void addViewToFrame(final JInternalFrame internalFrame, final View<?, ?> view)
{
internalFrame.add(view.getComponent(), BorderLayout.CENTER);
internalFrame.pack();
} | [
"public",
"static",
"void",
"addViewToFrame",
"(",
"final",
"JInternalFrame",
"internalFrame",
",",
"final",
"View",
"<",
"?",
",",
"?",
">",
"view",
")",
"{",
"internalFrame",
".",
"add",
"(",
"view",
".",
"getComponent",
"(",
")",
",",
"BorderLayout",
".... | Adds the given {@link View} object to the given {@link JInternalFrame} object.
@param internalFrame
the {@link JInternalFrame} object.
@param view
the {@link View} object to add | [
"Adds",
"the",
"given",
"{",
"@link",
"View",
"}",
"object",
"to",
"the",
"given",
"{",
"@link",
"JInternalFrame",
"}",
"object",
"."
] | train | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/utils/JInternalFrameExtensions.java#L68-L72 |
inferred/FreeBuilder | src/main/java/org/inferred/freebuilder/processor/source/SourceBuilder.java | SourceBuilder.forEnvironment | public static SourceBuilder forEnvironment(ProcessingEnvironment env, FeatureSet features) {
"""
Returns a {@link SourceBuilder}. {@code env} will be inspected for potential import collisions.
If {@code features} is not null, it will be used instead of those deduced from {@code env}.
"""
return new SourceBuilder(
new CompilerReflection(env.getElementUtils()),
Optional.ofNullable(features).orElseGet(() -> new EnvironmentFeatureSet(env)));
} | java | public static SourceBuilder forEnvironment(ProcessingEnvironment env, FeatureSet features) {
return new SourceBuilder(
new CompilerReflection(env.getElementUtils()),
Optional.ofNullable(features).orElseGet(() -> new EnvironmentFeatureSet(env)));
} | [
"public",
"static",
"SourceBuilder",
"forEnvironment",
"(",
"ProcessingEnvironment",
"env",
",",
"FeatureSet",
"features",
")",
"{",
"return",
"new",
"SourceBuilder",
"(",
"new",
"CompilerReflection",
"(",
"env",
".",
"getElementUtils",
"(",
")",
")",
",",
"Option... | Returns a {@link SourceBuilder}. {@code env} will be inspected for potential import collisions.
If {@code features} is not null, it will be used instead of those deduced from {@code env}. | [
"Returns",
"a",
"{"
] | train | https://github.com/inferred/FreeBuilder/blob/d5a222f90648aece135da4b971c55a60afe8649c/src/main/java/org/inferred/freebuilder/processor/source/SourceBuilder.java#L58-L62 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfFileSpecification.java | PdfFileSpecification.fileExtern | public static PdfFileSpecification fileExtern(PdfWriter writer, String filePath) {
"""
Creates a file specification for an external file.
@param writer the <CODE>PdfWriter</CODE>
@param filePath the file path
@return the file specification
"""
PdfFileSpecification fs = new PdfFileSpecification();
fs.writer = writer;
fs.put(PdfName.F, new PdfString(filePath));
fs.setUnicodeFileName(filePath, false);
return fs;
} | java | public static PdfFileSpecification fileExtern(PdfWriter writer, String filePath) {
PdfFileSpecification fs = new PdfFileSpecification();
fs.writer = writer;
fs.put(PdfName.F, new PdfString(filePath));
fs.setUnicodeFileName(filePath, false);
return fs;
} | [
"public",
"static",
"PdfFileSpecification",
"fileExtern",
"(",
"PdfWriter",
"writer",
",",
"String",
"filePath",
")",
"{",
"PdfFileSpecification",
"fs",
"=",
"new",
"PdfFileSpecification",
"(",
")",
";",
"fs",
".",
"writer",
"=",
"writer",
";",
"fs",
".",
"put... | Creates a file specification for an external file.
@param writer the <CODE>PdfWriter</CODE>
@param filePath the file path
@return the file specification | [
"Creates",
"a",
"file",
"specification",
"for",
"an",
"external",
"file",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfFileSpecification.java#L231-L237 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/SloppyBugComparator.java | SloppyBugComparator.compareClassesAllowingNull | private int compareClassesAllowingNull(ClassAnnotation lhs, ClassAnnotation rhs) {
"""
Compare class annotations.
@param lhs
left hand class annotation
@param rhs
right hand class annotation
@return comparison of the class annotations
"""
if (lhs == null || rhs == null) {
return compareNullElements(lhs, rhs);
}
String lhsClassName = classNameRewriter.rewriteClassName(lhs.getClassName());
String rhsClassName = classNameRewriter.rewriteClassName(rhs.getClassName());
if (DEBUG) {
System.err.println("Comparing " + lhsClassName + " and " + rhsClassName);
}
int cmp = lhsClassName.compareTo(rhsClassName);
if (DEBUG) {
System.err.println("\t==> " + cmp);
}
return cmp;
} | java | private int compareClassesAllowingNull(ClassAnnotation lhs, ClassAnnotation rhs) {
if (lhs == null || rhs == null) {
return compareNullElements(lhs, rhs);
}
String lhsClassName = classNameRewriter.rewriteClassName(lhs.getClassName());
String rhsClassName = classNameRewriter.rewriteClassName(rhs.getClassName());
if (DEBUG) {
System.err.println("Comparing " + lhsClassName + " and " + rhsClassName);
}
int cmp = lhsClassName.compareTo(rhsClassName);
if (DEBUG) {
System.err.println("\t==> " + cmp);
}
return cmp;
} | [
"private",
"int",
"compareClassesAllowingNull",
"(",
"ClassAnnotation",
"lhs",
",",
"ClassAnnotation",
"rhs",
")",
"{",
"if",
"(",
"lhs",
"==",
"null",
"||",
"rhs",
"==",
"null",
")",
"{",
"return",
"compareNullElements",
"(",
"lhs",
",",
"rhs",
")",
";",
... | Compare class annotations.
@param lhs
left hand class annotation
@param rhs
right hand class annotation
@return comparison of the class annotations | [
"Compare",
"class",
"annotations",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/SloppyBugComparator.java#L63-L80 |
Talend/tesb-rt-se | locator-service/locator-soap-service/src/main/java/org/talend/esb/locator/service/LocatorSoapServiceImpl.java | LocatorSoapServiceImpl.buildEndpoint | private W3CEndpointReference buildEndpoint(QName serviceName, String adress)
throws ServiceLocatorFault, InterruptedExceptionFault {
"""
Build Endpoint Reference for giving service name and address
@param serviceName
@param adress
@return
"""
W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
// builder.serviceName(serviceName);
builder.address(adress);
SLEndpoint endpoint = null;
try {
endpoint = locatorClient.getEndpoint(serviceName, adress);
} catch (ServiceLocatorException e) {
ServiceLocatorFaultDetail serviceFaultDetail = new ServiceLocatorFaultDetail();
serviceFaultDetail.setLocatorFaultDetail(serviceName.toString()
+ "throws ServiceLocatorFault");
throw new ServiceLocatorFault(e.getMessage(), serviceFaultDetail);
} catch (InterruptedException e) {
InterruptionFaultDetail interruptionFaultDetail = new InterruptionFaultDetail();
interruptionFaultDetail.setInterruptionDetail(serviceName
.toString() + "throws InterruptionFault");
throw new InterruptedExceptionFault(e.getMessage(),
interruptionFaultDetail);
}
if (endpoint != null) {
SLProperties properties = endpoint.getProperties();
if (properties != null && !properties.getPropertyNames().isEmpty()) {
EndpointTransformerImpl transformer = new EndpointTransformerImpl();
DOMResult result = new DOMResult();
transformer.writePropertiesTo(properties, result);
Document docResult = (Document) result.getNode();
builder.metadata(docResult.getDocumentElement());
}
}
return builder.build();
} | java | private W3CEndpointReference buildEndpoint(QName serviceName, String adress)
throws ServiceLocatorFault, InterruptedExceptionFault {
W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
// builder.serviceName(serviceName);
builder.address(adress);
SLEndpoint endpoint = null;
try {
endpoint = locatorClient.getEndpoint(serviceName, adress);
} catch (ServiceLocatorException e) {
ServiceLocatorFaultDetail serviceFaultDetail = new ServiceLocatorFaultDetail();
serviceFaultDetail.setLocatorFaultDetail(serviceName.toString()
+ "throws ServiceLocatorFault");
throw new ServiceLocatorFault(e.getMessage(), serviceFaultDetail);
} catch (InterruptedException e) {
InterruptionFaultDetail interruptionFaultDetail = new InterruptionFaultDetail();
interruptionFaultDetail.setInterruptionDetail(serviceName
.toString() + "throws InterruptionFault");
throw new InterruptedExceptionFault(e.getMessage(),
interruptionFaultDetail);
}
if (endpoint != null) {
SLProperties properties = endpoint.getProperties();
if (properties != null && !properties.getPropertyNames().isEmpty()) {
EndpointTransformerImpl transformer = new EndpointTransformerImpl();
DOMResult result = new DOMResult();
transformer.writePropertiesTo(properties, result);
Document docResult = (Document) result.getNode();
builder.metadata(docResult.getDocumentElement());
}
}
return builder.build();
} | [
"private",
"W3CEndpointReference",
"buildEndpoint",
"(",
"QName",
"serviceName",
",",
"String",
"adress",
")",
"throws",
"ServiceLocatorFault",
",",
"InterruptedExceptionFault",
"{",
"W3CEndpointReferenceBuilder",
"builder",
"=",
"new",
"W3CEndpointReferenceBuilder",
"(",
"... | Build Endpoint Reference for giving service name and address
@param serviceName
@param adress
@return | [
"Build",
"Endpoint",
"Reference",
"for",
"giving",
"service",
"name",
"and",
"address"
] | train | https://github.com/Talend/tesb-rt-se/blob/0a151a6d91ffff65ac4b5ee0c5b2c882ac28d886/locator-service/locator-soap-service/src/main/java/org/talend/esb/locator/service/LocatorSoapServiceImpl.java#L446-L479 |
captain-miao/OptionRoundCardview | optroundcardview/src/main/java/com/github/captain_miao/optroundcardview/OptRoundCardView.java | OptRoundCardView.setContentPadding | public void setContentPadding(int left, int top, int right, int bottom) {
"""
Sets the padding between the Card's edges and the children of CardView.
<p>
Depending on platform version or {@link #getUseCompatPadding()} settings, CardView may
update these values before calling {@link android.view.View#setPadding(int, int, int, int)}.
@param left The left padding in pixels
@param top The top padding in pixels
@param right The right padding in pixels
@param bottom The bottom padding in pixels
@attr ref android.support.v7.cardview.R.styleable#CardView_contentPadding
@attr ref android.support.v7.cardview.R.styleable#CardView_contentPaddingLeft
@attr ref android.support.v7.cardview.R.styleable#CardView_contentPaddingTop
@attr ref android.support.v7.cardview.R.styleable#CardView_contentPaddingRight
@attr ref android.support.v7.cardview.R.styleable#CardView_contentPaddingBottom
"""
mContentPadding.set(left, top, right, bottom);
IMPL.updatePadding(this);
} | java | public void setContentPadding(int left, int top, int right, int bottom) {
mContentPadding.set(left, top, right, bottom);
IMPL.updatePadding(this);
} | [
"public",
"void",
"setContentPadding",
"(",
"int",
"left",
",",
"int",
"top",
",",
"int",
"right",
",",
"int",
"bottom",
")",
"{",
"mContentPadding",
".",
"set",
"(",
"left",
",",
"top",
",",
"right",
",",
"bottom",
")",
";",
"IMPL",
".",
"updatePaddin... | Sets the padding between the Card's edges and the children of CardView.
<p>
Depending on platform version or {@link #getUseCompatPadding()} settings, CardView may
update these values before calling {@link android.view.View#setPadding(int, int, int, int)}.
@param left The left padding in pixels
@param top The top padding in pixels
@param right The right padding in pixels
@param bottom The bottom padding in pixels
@attr ref android.support.v7.cardview.R.styleable#CardView_contentPadding
@attr ref android.support.v7.cardview.R.styleable#CardView_contentPaddingLeft
@attr ref android.support.v7.cardview.R.styleable#CardView_contentPaddingTop
@attr ref android.support.v7.cardview.R.styleable#CardView_contentPaddingRight
@attr ref android.support.v7.cardview.R.styleable#CardView_contentPaddingBottom | [
"Sets",
"the",
"padding",
"between",
"the",
"Card",
"s",
"edges",
"and",
"the",
"children",
"of",
"CardView",
".",
"<p",
">",
"Depending",
"on",
"platform",
"version",
"or",
"{",
"@link",
"#getUseCompatPadding",
"()",
"}",
"settings",
"CardView",
"may",
"upd... | train | https://github.com/captain-miao/OptionRoundCardview/blob/aefad1e42351958724b916b8003a24f10634b3d8/optroundcardview/src/main/java/com/github/captain_miao/optroundcardview/OptRoundCardView.java#L170-L173 |
Harium/keel | src/main/java/com/harium/keel/catalano/math/distance/Distance.java | Distance.Cosine | public static double Cosine(double x1, double y1, double x2, double y2) {
"""
Gets the Cosine distance between two points.
@param x1 X1 axis coordinate.
@param y1 Y1 axis coordinate.
@param x2 X2 axis coordinate.
@param y2 Y2 axis coordinate.
@return The Cosine distance between x and y.
"""
double sumProduct = x1 * x2 + y1 * y2;
double sumP = Math.pow(Math.abs(x1), 2) + Math.pow(Math.abs(x2), 2);
double sumQ = Math.pow(Math.abs(y1), 2) + Math.pow(Math.abs(y2), 2);
sumP = Math.sqrt(sumP);
sumQ = Math.sqrt(sumQ);
double result = 1 - (sumProduct / (sumP * sumQ));
return result;
} | java | public static double Cosine(double x1, double y1, double x2, double y2) {
double sumProduct = x1 * x2 + y1 * y2;
double sumP = Math.pow(Math.abs(x1), 2) + Math.pow(Math.abs(x2), 2);
double sumQ = Math.pow(Math.abs(y1), 2) + Math.pow(Math.abs(y2), 2);
sumP = Math.sqrt(sumP);
sumQ = Math.sqrt(sumQ);
double result = 1 - (sumProduct / (sumP * sumQ));
return result;
} | [
"public",
"static",
"double",
"Cosine",
"(",
"double",
"x1",
",",
"double",
"y1",
",",
"double",
"x2",
",",
"double",
"y2",
")",
"{",
"double",
"sumProduct",
"=",
"x1",
"*",
"x2",
"+",
"y1",
"*",
"y2",
";",
"double",
"sumP",
"=",
"Math",
".",
"pow"... | Gets the Cosine distance between two points.
@param x1 X1 axis coordinate.
@param y1 Y1 axis coordinate.
@param x2 X2 axis coordinate.
@param y2 Y2 axis coordinate.
@return The Cosine distance between x and y. | [
"Gets",
"the",
"Cosine",
"distance",
"between",
"two",
"points",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/distance/Distance.java#L344-L354 |
lucee/Lucee | core/src/main/java/lucee/commons/io/compress/CompressUtil.java | CompressUtil.compressTar | public static void compressTar(Resource[] sources, Resource target, int mode) throws IOException {
"""
compress a source file/directory to a tar file
@param sources
@param target
@param mode
@throws IOException
"""
compressTar(sources, IOUtil.toBufferedOutputStream(target.getOutputStream()), mode);
} | java | public static void compressTar(Resource[] sources, Resource target, int mode) throws IOException {
compressTar(sources, IOUtil.toBufferedOutputStream(target.getOutputStream()), mode);
} | [
"public",
"static",
"void",
"compressTar",
"(",
"Resource",
"[",
"]",
"sources",
",",
"Resource",
"target",
",",
"int",
"mode",
")",
"throws",
"IOException",
"{",
"compressTar",
"(",
"sources",
",",
"IOUtil",
".",
"toBufferedOutputStream",
"(",
"target",
".",
... | compress a source file/directory to a tar file
@param sources
@param target
@param mode
@throws IOException | [
"compress",
"a",
"source",
"file",
"/",
"directory",
"to",
"a",
"tar",
"file"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/compress/CompressUtil.java#L543-L545 |
alkacon/opencms-core | src/org/opencms/ui/contextmenu/CmsContextMenu.java | CmsContextMenu.setEntries | public <T> void setEntries(Collection<I_CmsSimpleContextMenuEntry<T>> entries, T data) {
"""
Sets the context menu entries. Removes all previously present entries.<p>
@param entries the entries
@param data the context data
"""
removeAllItems();
Locale locale = UI.getCurrent().getLocale();
for (final I_CmsSimpleContextMenuEntry<T> entry : entries) {
CmsMenuItemVisibilityMode visibility = entry.getVisibility(data);
if (!visibility.isInVisible()) {
ContextMenuItem item = addItem(entry.getTitle(locale));
if (visibility.isInActive()) {
item.setEnabled(false);
if (visibility.getMessageKey() != null) {
item.setDescription(CmsVaadinUtils.getMessageText(visibility.getMessageKey()));
}
} else {
item.setData(data);
item.addItemClickListener(new ContextMenuItemClickListener() {
@SuppressWarnings("unchecked")
public void contextMenuItemClicked(ContextMenuItemClickEvent event) {
entry.executeAction((T)((ContextMenuItem)event.getSource()).getData());
}
});
}
if (entry instanceof I_CmsSimpleContextMenuEntry.I_HasCssStyles) {
item.addStyleName(((I_CmsSimpleContextMenuEntry.I_HasCssStyles)entry).getStyles());
}
}
}
} | java | public <T> void setEntries(Collection<I_CmsSimpleContextMenuEntry<T>> entries, T data) {
removeAllItems();
Locale locale = UI.getCurrent().getLocale();
for (final I_CmsSimpleContextMenuEntry<T> entry : entries) {
CmsMenuItemVisibilityMode visibility = entry.getVisibility(data);
if (!visibility.isInVisible()) {
ContextMenuItem item = addItem(entry.getTitle(locale));
if (visibility.isInActive()) {
item.setEnabled(false);
if (visibility.getMessageKey() != null) {
item.setDescription(CmsVaadinUtils.getMessageText(visibility.getMessageKey()));
}
} else {
item.setData(data);
item.addItemClickListener(new ContextMenuItemClickListener() {
@SuppressWarnings("unchecked")
public void contextMenuItemClicked(ContextMenuItemClickEvent event) {
entry.executeAction((T)((ContextMenuItem)event.getSource()).getData());
}
});
}
if (entry instanceof I_CmsSimpleContextMenuEntry.I_HasCssStyles) {
item.addStyleName(((I_CmsSimpleContextMenuEntry.I_HasCssStyles)entry).getStyles());
}
}
}
} | [
"public",
"<",
"T",
">",
"void",
"setEntries",
"(",
"Collection",
"<",
"I_CmsSimpleContextMenuEntry",
"<",
"T",
">",
">",
"entries",
",",
"T",
"data",
")",
"{",
"removeAllItems",
"(",
")",
";",
"Locale",
"locale",
"=",
"UI",
".",
"getCurrent",
"(",
")",
... | Sets the context menu entries. Removes all previously present entries.<p>
@param entries the entries
@param data the context data | [
"Sets",
"the",
"context",
"menu",
"entries",
".",
"Removes",
"all",
"previously",
"present",
"entries",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/contextmenu/CmsContextMenu.java#L1252-L1281 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java | PoolsImpl.removeNodesAsync | public Observable<Void> removeNodesAsync(String poolId, NodeRemoveParameter nodeRemoveParameter, PoolRemoveNodesOptions poolRemoveNodesOptions) {
"""
Removes compute nodes from the specified pool.
This operation can only run when the allocation state of the pool is steady. When this operation runs, the allocation state changes from steady to resizing.
@param poolId The ID of the pool from which you want to remove nodes.
@param nodeRemoveParameter The parameters for the request.
@param poolRemoveNodesOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponseWithHeaders} object if successful.
"""
return removeNodesWithServiceResponseAsync(poolId, nodeRemoveParameter, poolRemoveNodesOptions).map(new Func1<ServiceResponseWithHeaders<Void, PoolRemoveNodesHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, PoolRemoveNodesHeaders> response) {
return response.body();
}
});
} | java | public Observable<Void> removeNodesAsync(String poolId, NodeRemoveParameter nodeRemoveParameter, PoolRemoveNodesOptions poolRemoveNodesOptions) {
return removeNodesWithServiceResponseAsync(poolId, nodeRemoveParameter, poolRemoveNodesOptions).map(new Func1<ServiceResponseWithHeaders<Void, PoolRemoveNodesHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, PoolRemoveNodesHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"removeNodesAsync",
"(",
"String",
"poolId",
",",
"NodeRemoveParameter",
"nodeRemoveParameter",
",",
"PoolRemoveNodesOptions",
"poolRemoveNodesOptions",
")",
"{",
"return",
"removeNodesWithServiceResponseAsync",
"(",
"poolId",
",",
... | Removes compute nodes from the specified pool.
This operation can only run when the allocation state of the pool is steady. When this operation runs, the allocation state changes from steady to resizing.
@param poolId The ID of the pool from which you want to remove nodes.
@param nodeRemoveParameter The parameters for the request.
@param poolRemoveNodesOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponseWithHeaders} object if successful. | [
"Removes",
"compute",
"nodes",
"from",
"the",
"specified",
"pool",
".",
"This",
"operation",
"can",
"only",
"run",
"when",
"the",
"allocation",
"state",
"of",
"the",
"pool",
"is",
"steady",
".",
"When",
"this",
"operation",
"runs",
"the",
"allocation",
"stat... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java#L3539-L3546 |
alkacon/opencms-core | src/org/opencms/xml/CmsXmlContentDefinition.java | CmsXmlContentDefinition.createLocale | public Element createLocale(CmsObject cms, I_CmsXmlDocument document, Element root, Locale locale) {
"""
Generates a valid locale (language) element for the XML schema of this content definition.<p>
@param cms the current users OpenCms context
@param document the OpenCms XML document the XML is created for
@param root the root node of the document where to append the locale to
@param locale the locale to create the default element in the document with
@return a valid XML element for the locale according to the XML schema of this content definition
"""
// add an element with a "locale" attribute to the given root node
Element element = root.addElement(getInnerName());
element.addAttribute(XSD_ATTRIBUTE_VALUE_LANGUAGE, locale.toString());
// now generate the default XML for the element
return createDefaultXml(cms, document, element, locale);
} | java | public Element createLocale(CmsObject cms, I_CmsXmlDocument document, Element root, Locale locale) {
// add an element with a "locale" attribute to the given root node
Element element = root.addElement(getInnerName());
element.addAttribute(XSD_ATTRIBUTE_VALUE_LANGUAGE, locale.toString());
// now generate the default XML for the element
return createDefaultXml(cms, document, element, locale);
} | [
"public",
"Element",
"createLocale",
"(",
"CmsObject",
"cms",
",",
"I_CmsXmlDocument",
"document",
",",
"Element",
"root",
",",
"Locale",
"locale",
")",
"{",
"// add an element with a \"locale\" attribute to the given root node",
"Element",
"element",
"=",
"root",
".",
... | Generates a valid locale (language) element for the XML schema of this content definition.<p>
@param cms the current users OpenCms context
@param document the OpenCms XML document the XML is created for
@param root the root node of the document where to append the locale to
@param locale the locale to create the default element in the document with
@return a valid XML element for the locale according to the XML schema of this content definition | [
"Generates",
"a",
"valid",
"locale",
"(",
"language",
")",
"element",
"for",
"the",
"XML",
"schema",
"of",
"this",
"content",
"definition",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/CmsXmlContentDefinition.java#L1238-L1246 |
aws/aws-sdk-java | aws-java-sdk-opensdk/src/main/java/com/amazonaws/opensdk/internal/protocol/ApiGatewayErrorResponseHandler.java | ApiGatewayErrorResponseHandler.createException | private BaseException createException(int httpStatusCode, JsonContent jsonContent) {
"""
Create an AmazonServiceException using the chain of unmarshallers. This method will never
return null, it will always return a valid exception.
@param httpStatusCode Http status code to find an appropriate unmarshaller
@param jsonContent JsonContent of HTTP response
@return Unmarshalled exception
"""
return unmarshallers.stream()
.filter(u -> u.matches(httpStatusCode))
.findFirst()
.map(u -> safeUnmarshall(jsonContent, u))
.orElseThrow(this::createUnknownException);
} | java | private BaseException createException(int httpStatusCode, JsonContent jsonContent) {
return unmarshallers.stream()
.filter(u -> u.matches(httpStatusCode))
.findFirst()
.map(u -> safeUnmarshall(jsonContent, u))
.orElseThrow(this::createUnknownException);
} | [
"private",
"BaseException",
"createException",
"(",
"int",
"httpStatusCode",
",",
"JsonContent",
"jsonContent",
")",
"{",
"return",
"unmarshallers",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"u",
"->",
"u",
".",
"matches",
"(",
"httpStatusCode",
")",
")",
... | Create an AmazonServiceException using the chain of unmarshallers. This method will never
return null, it will always return a valid exception.
@param httpStatusCode Http status code to find an appropriate unmarshaller
@param jsonContent JsonContent of HTTP response
@return Unmarshalled exception | [
"Create",
"an",
"AmazonServiceException",
"using",
"the",
"chain",
"of",
"unmarshallers",
".",
"This",
"method",
"will",
"never",
"return",
"null",
"it",
"will",
"always",
"return",
"a",
"valid",
"exception",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-opensdk/src/main/java/com/amazonaws/opensdk/internal/protocol/ApiGatewayErrorResponseHandler.java#L80-L86 |
dadoonet/elasticsearch-beyonder | src/main/java/fr/pilato/elasticsearch/tools/index/IndexElasticsearchUpdater.java | IndexElasticsearchUpdater.createIndexWithSettings | @Deprecated
public static void createIndexWithSettings(Client client, String index, String settings, boolean force) throws Exception {
"""
Create a new index in Elasticsearch
@param client Elasticsearch client
@param index Index name
@param settings Settings if any, null if no specific settings
@param force Remove index if exists (Warning: remove all data)
@throws Exception if the elasticsearch API call is failing
"""
if (force && isIndexExist(client, index)) {
logger.debug("Index [{}] already exists but force set to true. Removing all data!", index);
removeIndexInElasticsearch(client, index);
}
if (force || !isIndexExist(client, index)) {
logger.debug("Index [{}] doesn't exist. Creating it.", index);
createIndexWithSettingsInElasticsearch(client, index, settings);
} else {
logger.debug("Index [{}] already exists.", index);
}
} | java | @Deprecated
public static void createIndexWithSettings(Client client, String index, String settings, boolean force) throws Exception {
if (force && isIndexExist(client, index)) {
logger.debug("Index [{}] already exists but force set to true. Removing all data!", index);
removeIndexInElasticsearch(client, index);
}
if (force || !isIndexExist(client, index)) {
logger.debug("Index [{}] doesn't exist. Creating it.", index);
createIndexWithSettingsInElasticsearch(client, index, settings);
} else {
logger.debug("Index [{}] already exists.", index);
}
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"createIndexWithSettings",
"(",
"Client",
"client",
",",
"String",
"index",
",",
"String",
"settings",
",",
"boolean",
"force",
")",
"throws",
"Exception",
"{",
"if",
"(",
"force",
"&&",
"isIndexExist",
"(",
"clie... | Create a new index in Elasticsearch
@param client Elasticsearch client
@param index Index name
@param settings Settings if any, null if no specific settings
@param force Remove index if exists (Warning: remove all data)
@throws Exception if the elasticsearch API call is failing | [
"Create",
"a",
"new",
"index",
"in",
"Elasticsearch"
] | train | https://github.com/dadoonet/elasticsearch-beyonder/blob/275bf63432b97169a90a266e983143cca9ad7629/src/main/java/fr/pilato/elasticsearch/tools/index/IndexElasticsearchUpdater.java#L76-L88 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.mixin | public static void mixin(MetaClass self, List<Class> categoryClasses) {
"""
Extend object with category methods.
All methods for given class and all super classes will be added to the object.
@param self any Class
@param categoryClasses a category classes to use
@since 1.6.0
"""
MixinInMetaClass.mixinClassesToMetaClass(self, categoryClasses);
} | java | public static void mixin(MetaClass self, List<Class> categoryClasses) {
MixinInMetaClass.mixinClassesToMetaClass(self, categoryClasses);
} | [
"public",
"static",
"void",
"mixin",
"(",
"MetaClass",
"self",
",",
"List",
"<",
"Class",
">",
"categoryClasses",
")",
"{",
"MixinInMetaClass",
".",
"mixinClassesToMetaClass",
"(",
"self",
",",
"categoryClasses",
")",
";",
"}"
] | Extend object with category methods.
All methods for given class and all super classes will be added to the object.
@param self any Class
@param categoryClasses a category classes to use
@since 1.6.0 | [
"Extend",
"object",
"with",
"category",
"methods",
".",
"All",
"methods",
"for",
"given",
"class",
"and",
"all",
"super",
"classes",
"will",
"be",
"added",
"to",
"the",
"object",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L566-L568 |
EdwardRaff/JSAT | JSAT/src/jsat/linear/RowColumnOps.java | RowColumnOps.divRow | public static void divRow(Matrix A, int i, double c) {
"""
Updates the values of row <tt>i</tt> in the given matrix to be A[i,:] = A[i,:] / c
@param A the matrix to perform he update on
@param i the row to update
@param c the constant to divide each element by
"""
divRow(A, i, 0, A.cols(), c);
} | java | public static void divRow(Matrix A, int i, double c)
{
divRow(A, i, 0, A.cols(), c);
} | [
"public",
"static",
"void",
"divRow",
"(",
"Matrix",
"A",
",",
"int",
"i",
",",
"double",
"c",
")",
"{",
"divRow",
"(",
"A",
",",
"i",
",",
"0",
",",
"A",
".",
"cols",
"(",
")",
",",
"c",
")",
";",
"}"
] | Updates the values of row <tt>i</tt> in the given matrix to be A[i,:] = A[i,:] / c
@param A the matrix to perform he update on
@param i the row to update
@param c the constant to divide each element by | [
"Updates",
"the",
"values",
"of",
"row",
"<tt",
">",
"i<",
"/",
"tt",
">",
"in",
"the",
"given",
"matrix",
"to",
"be",
"A",
"[",
"i",
":",
"]",
"=",
"A",
"[",
"i",
":",
"]",
"/",
"c"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/RowColumnOps.java#L163-L166 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/style/Color.java | Color.setColor | public void setColor(String red, String green, String blue, String alpha) {
"""
Set the color with individual hex colors and alpha
@param red
red hex color in format RR
@param green
green hex color in format GG
@param blue
blue hex color in format BB
@param alpha
alpha hex color in format AA
"""
setColor(red, green, blue);
setAlpha(alpha);
} | java | public void setColor(String red, String green, String blue, String alpha) {
setColor(red, green, blue);
setAlpha(alpha);
} | [
"public",
"void",
"setColor",
"(",
"String",
"red",
",",
"String",
"green",
",",
"String",
"blue",
",",
"String",
"alpha",
")",
"{",
"setColor",
"(",
"red",
",",
"green",
",",
"blue",
")",
";",
"setAlpha",
"(",
"alpha",
")",
";",
"}"
] | Set the color with individual hex colors and alpha
@param red
red hex color in format RR
@param green
green hex color in format GG
@param blue
blue hex color in format BB
@param alpha
alpha hex color in format AA | [
"Set",
"the",
"color",
"with",
"individual",
"hex",
"colors",
"and",
"alpha"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/style/Color.java#L309-L312 |
sd4324530/fastweixin | src/main/java/com/github/sd4324530/fastweixin/api/MaterialAPI.java | MaterialAPI.batchGetMaterial | public GetMaterialListResponse batchGetMaterial(MaterialType type, int offset, int count) {
"""
获取素材列表
@param type 素材类型
@param offset 从全部素材的该偏移位置开始返回,0表示从第一个素材 返回
@param count 返回素材的数量,取值在1到20之间
@return 素材列表结果
"""
if(offset < 0) offset = 0;
if(count > 20) count = 20;
if(count < 1) count = 1;
GetMaterialListResponse response = null;
String url = BASE_API_URL + "cgi-bin/material/batchget_material?access_token=#";
final Map<String, Object> params = new HashMap<String, Object>(4, 1);
params.put("type", type.toString());
params.put("offset", offset);
params.put("count", count);
BaseResponse r = executePost(url, JSONUtil.toJson(params));
String resultJson = isSuccess(r.getErrcode()) ? r.getErrmsg() : r.toJsonString();
response = JSONUtil.toBean(resultJson, GetMaterialListResponse.class);
return response;
} | java | public GetMaterialListResponse batchGetMaterial(MaterialType type, int offset, int count){
if(offset < 0) offset = 0;
if(count > 20) count = 20;
if(count < 1) count = 1;
GetMaterialListResponse response = null;
String url = BASE_API_URL + "cgi-bin/material/batchget_material?access_token=#";
final Map<String, Object> params = new HashMap<String, Object>(4, 1);
params.put("type", type.toString());
params.put("offset", offset);
params.put("count", count);
BaseResponse r = executePost(url, JSONUtil.toJson(params));
String resultJson = isSuccess(r.getErrcode()) ? r.getErrmsg() : r.toJsonString();
response = JSONUtil.toBean(resultJson, GetMaterialListResponse.class);
return response;
} | [
"public",
"GetMaterialListResponse",
"batchGetMaterial",
"(",
"MaterialType",
"type",
",",
"int",
"offset",
",",
"int",
"count",
")",
"{",
"if",
"(",
"offset",
"<",
"0",
")",
"offset",
"=",
"0",
";",
"if",
"(",
"count",
">",
"20",
")",
"count",
"=",
"2... | 获取素材列表
@param type 素材类型
@param offset 从全部素材的该偏移位置开始返回,0表示从第一个素材 返回
@param count 返回素材的数量,取值在1到20之间
@return 素材列表结果 | [
"获取素材列表"
] | train | https://github.com/sd4324530/fastweixin/blob/6bc0a7abfa23aad0dbad4c3123a47a7fb53f3447/src/main/java/com/github/sd4324530/fastweixin/api/MaterialAPI.java#L186-L202 |
attoparser/attoparser | src/main/java/org/attoparser/dom/StructureTextsRepository.java | StructureTextsRepository.getStructureName | static String getStructureName(final char[] buffer, final int offset, final int len) {
"""
This method will try to avoid creating new strings for each structure name (element/attribute)
"""
final int index = TextUtil.binarySearch(true, ALL_STANDARD_NAMES, buffer, offset, len);
if (index < 0) {
return new String(buffer, offset, len);
}
return ALL_STANDARD_NAMES[index];
} | java | static String getStructureName(final char[] buffer, final int offset, final int len) {
final int index = TextUtil.binarySearch(true, ALL_STANDARD_NAMES, buffer, offset, len);
if (index < 0) {
return new String(buffer, offset, len);
}
return ALL_STANDARD_NAMES[index];
} | [
"static",
"String",
"getStructureName",
"(",
"final",
"char",
"[",
"]",
"buffer",
",",
"final",
"int",
"offset",
",",
"final",
"int",
"len",
")",
"{",
"final",
"int",
"index",
"=",
"TextUtil",
".",
"binarySearch",
"(",
"true",
",",
"ALL_STANDARD_NAMES",
",... | This method will try to avoid creating new strings for each structure name (element/attribute) | [
"This",
"method",
"will",
"try",
"to",
"avoid",
"creating",
"new",
"strings",
"for",
"each",
"structure",
"name",
"(",
"element",
"/",
"attribute",
")"
] | train | https://github.com/attoparser/attoparser/blob/d2e8c1d822e290b0ce0242aff6e56ebdb9ca74b0/src/main/java/org/attoparser/dom/StructureTextsRepository.java#L139-L148 |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository.liberty/src/com/ibm/ws/repository/connections/liberty/MainRepository.java | MainRepository.repositoryDescriptionFileExists | public static boolean repositoryDescriptionFileExists(RestRepositoryConnectionProxy proxy) {
"""
Tests if the repository description properties file exists as defined by the
location override system property or at the default location
@return true if the properties file exists, otherwise false
"""
boolean exists = false;
try {
URL propertiesFileURL = getPropertiesFileLocation();
// Are we accessing the properties file (from DHE) using a proxy ?
if (proxy != null) {
if (proxy.isHTTPorHTTPS()) {
Proxy javaNetProxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxy.getProxyURL().getHost(), proxy.getProxyURL().getPort()));
URLConnection connection = propertiesFileURL.openConnection(javaNetProxy);
InputStream is = connection.getInputStream();
exists = true;
is.close();
if (connection instanceof HttpURLConnection) {
((HttpURLConnection) connection).disconnect();
}
} else {
// The proxy is not an HTTP or HTTPS proxy we do not support this
UnsupportedOperationException ue = new UnsupportedOperationException("Non-HTTP proxy not supported");
throw new IOException(ue);
}
} else {
// not using a proxy
InputStream is = propertiesFileURL.openStream();
exists = true;
is.close();
}
} catch (MalformedURLException e) {
// ignore
} catch (IOException e) {
// ignore
}
return exists;
} | java | public static boolean repositoryDescriptionFileExists(RestRepositoryConnectionProxy proxy) {
boolean exists = false;
try {
URL propertiesFileURL = getPropertiesFileLocation();
// Are we accessing the properties file (from DHE) using a proxy ?
if (proxy != null) {
if (proxy.isHTTPorHTTPS()) {
Proxy javaNetProxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxy.getProxyURL().getHost(), proxy.getProxyURL().getPort()));
URLConnection connection = propertiesFileURL.openConnection(javaNetProxy);
InputStream is = connection.getInputStream();
exists = true;
is.close();
if (connection instanceof HttpURLConnection) {
((HttpURLConnection) connection).disconnect();
}
} else {
// The proxy is not an HTTP or HTTPS proxy we do not support this
UnsupportedOperationException ue = new UnsupportedOperationException("Non-HTTP proxy not supported");
throw new IOException(ue);
}
} else {
// not using a proxy
InputStream is = propertiesFileURL.openStream();
exists = true;
is.close();
}
} catch (MalformedURLException e) {
// ignore
} catch (IOException e) {
// ignore
}
return exists;
} | [
"public",
"static",
"boolean",
"repositoryDescriptionFileExists",
"(",
"RestRepositoryConnectionProxy",
"proxy",
")",
"{",
"boolean",
"exists",
"=",
"false",
";",
"try",
"{",
"URL",
"propertiesFileURL",
"=",
"getPropertiesFileLocation",
"(",
")",
";",
"// Are we accessi... | Tests if the repository description properties file exists as defined by the
location override system property or at the default location
@return true if the properties file exists, otherwise false | [
"Tests",
"if",
"the",
"repository",
"description",
"properties",
"file",
"exists",
"as",
"defined",
"by",
"the",
"location",
"override",
"system",
"property",
"or",
"at",
"the",
"default",
"location"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.liberty/src/com/ibm/ws/repository/connections/liberty/MainRepository.java#L118-L160 |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.el.3.0/src/javax/el/ELResolver.java | ELResolver.convertToType | public Object convertToType(ELContext context, Object obj, Class<?> type) {
"""
Converts the given object to the given type. This default implementation
always returns <code>null</code>.
@param context The EL context for this evaluation
@param obj The object to convert
@param type The type to which the object should be converted
@return Always <code>null</code>
@since EL 3.0
"""
context.setPropertyResolved(false);
return null;
} | java | public Object convertToType(ELContext context, Object obj, Class<?> type) {
context.setPropertyResolved(false);
return null;
} | [
"public",
"Object",
"convertToType",
"(",
"ELContext",
"context",
",",
"Object",
"obj",
",",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"context",
".",
"setPropertyResolved",
"(",
"false",
")",
";",
"return",
"null",
";",
"}"
] | Converts the given object to the given type. This default implementation
always returns <code>null</code>.
@param context The EL context for this evaluation
@param obj The object to convert
@param type The type to which the object should be converted
@return Always <code>null</code>
@since EL 3.0 | [
"Converts",
"the",
"given",
"object",
"to",
"the",
"given",
"type",
".",
"This",
"default",
"implementation",
"always",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.el.3.0/src/javax/el/ELResolver.java#L138-L141 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/gslb/gslbvserver_binding.java | gslbvserver_binding.get | public static gslbvserver_binding get(nitro_service service, String name) throws Exception {
"""
Use this API to fetch gslbvserver_binding resource of given name .
"""
gslbvserver_binding obj = new gslbvserver_binding();
obj.set_name(name);
gslbvserver_binding response = (gslbvserver_binding) obj.get_resource(service);
return response;
} | java | public static gslbvserver_binding get(nitro_service service, String name) throws Exception{
gslbvserver_binding obj = new gslbvserver_binding();
obj.set_name(name);
gslbvserver_binding response = (gslbvserver_binding) obj.get_resource(service);
return response;
} | [
"public",
"static",
"gslbvserver_binding",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"gslbvserver_binding",
"obj",
"=",
"new",
"gslbvserver_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
... | Use this API to fetch gslbvserver_binding resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"gslbvserver_binding",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/gslb/gslbvserver_binding.java#L125-L130 |
geomajas/geomajas-project-client-gwt | common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java | HtmlBuilder.divStyle | public static String divStyle(String style, String... content) {
"""
Build a HTML DIV with given style for a string.
Given content does <b>not</b> consists of HTML snippets and
as such is being prepared with {@link HtmlBuilder#htmlEncode(String)}.
@param style style for div (plain CSS)
@param content content string
@return HTML DIV element as string
"""
return tagStyle(Html.Tag.DIV, style, content);
} | java | public static String divStyle(String style, String... content) {
return tagStyle(Html.Tag.DIV, style, content);
} | [
"public",
"static",
"String",
"divStyle",
"(",
"String",
"style",
",",
"String",
"...",
"content",
")",
"{",
"return",
"tagStyle",
"(",
"Html",
".",
"Tag",
".",
"DIV",
",",
"style",
",",
"content",
")",
";",
"}"
] | Build a HTML DIV with given style for a string.
Given content does <b>not</b> consists of HTML snippets and
as such is being prepared with {@link HtmlBuilder#htmlEncode(String)}.
@param style style for div (plain CSS)
@param content content string
@return HTML DIV element as string | [
"Build",
"a",
"HTML",
"DIV",
"with",
"given",
"style",
"for",
"a",
"string",
".",
"Given",
"content",
"does",
"<b",
">",
"not<",
"/",
"b",
">",
"consists",
"of",
"HTML",
"snippets",
"and",
"as",
"such",
"is",
"being",
"prepared",
"with",
"{",
"@link",
... | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java#L239-L241 |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/common/Utils.java | Utils.isBoxedType | public static boolean isBoxedType(Class<?> primitive, Class<?> boxed) {
"""
Determines if the primitive type is boxed as the boxed type
@param primitive the primitive type to check if boxed is the boxed type
@param boxed the possible boxed type of the primitive
@return true if boxed is the boxed type of primitive, false otherwise.
"""
return (primitive.equals(boolean.class) && boxed.equals(Boolean.class)) ||
(primitive.equals(byte.class) && boxed.equals(Byte.class)) ||
(primitive.equals(char.class) && boxed.equals(Character.class)) ||
(primitive.equals(double.class) && boxed.equals(Double.class)) ||
(primitive.equals(float.class) && boxed.equals(Float.class)) ||
(primitive.equals(int.class) && boxed.equals(Integer.class)) ||
(primitive.equals(long.class) && boxed.equals(Long.class)) ||
(primitive.equals(short.class) && boxed.equals(Short.class)) ||
(primitive.equals(void.class) && boxed.equals(Void.class));
} | java | public static boolean isBoxedType(Class<?> primitive, Class<?> boxed) {
return (primitive.equals(boolean.class) && boxed.equals(Boolean.class)) ||
(primitive.equals(byte.class) && boxed.equals(Byte.class)) ||
(primitive.equals(char.class) && boxed.equals(Character.class)) ||
(primitive.equals(double.class) && boxed.equals(Double.class)) ||
(primitive.equals(float.class) && boxed.equals(Float.class)) ||
(primitive.equals(int.class) && boxed.equals(Integer.class)) ||
(primitive.equals(long.class) && boxed.equals(Long.class)) ||
(primitive.equals(short.class) && boxed.equals(Short.class)) ||
(primitive.equals(void.class) && boxed.equals(Void.class));
} | [
"public",
"static",
"boolean",
"isBoxedType",
"(",
"Class",
"<",
"?",
">",
"primitive",
",",
"Class",
"<",
"?",
">",
"boxed",
")",
"{",
"return",
"(",
"primitive",
".",
"equals",
"(",
"boolean",
".",
"class",
")",
"&&",
"boxed",
".",
"equals",
"(",
"... | Determines if the primitive type is boxed as the boxed type
@param primitive the primitive type to check if boxed is the boxed type
@param boxed the possible boxed type of the primitive
@return true if boxed is the boxed type of primitive, false otherwise. | [
"Determines",
"if",
"the",
"primitive",
"type",
"is",
"boxed",
"as",
"the",
"boxed",
"type"
] | train | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/common/Utils.java#L282-L292 |
antopen/alipay-sdk-java | src/main/java/com/alipay/api/internal/util/XmlUtils.java | XmlUtils.getDocument | public static Document getDocument(InputStream in) throws AlipayApiException {
"""
Parses the content of the given stream as an XML document.
@param in the XML file input stream
@return the document instance representing the entire XML document
@throws ApiException problem parsing the XML input stream
"""
Document doc = null;
try {
DocumentBuilder builder = DocumentBuilderFactory.newInstance()
.newDocumentBuilder();
doc = builder.parse(in);
} catch (ParserConfigurationException e) {
throw new AlipayApiException(e);
} catch (SAXException e) {
throw new AlipayApiException("XML_PARSE_ERROR", e);
} catch (IOException e) {
throw new AlipayApiException("XML_READ_ERROR", e);
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
// nothing to do
}
}
}
return doc;
} | java | public static Document getDocument(InputStream in) throws AlipayApiException {
Document doc = null;
try {
DocumentBuilder builder = DocumentBuilderFactory.newInstance()
.newDocumentBuilder();
doc = builder.parse(in);
} catch (ParserConfigurationException e) {
throw new AlipayApiException(e);
} catch (SAXException e) {
throw new AlipayApiException("XML_PARSE_ERROR", e);
} catch (IOException e) {
throw new AlipayApiException("XML_READ_ERROR", e);
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
// nothing to do
}
}
}
return doc;
} | [
"public",
"static",
"Document",
"getDocument",
"(",
"InputStream",
"in",
")",
"throws",
"AlipayApiException",
"{",
"Document",
"doc",
"=",
"null",
";",
"try",
"{",
"DocumentBuilder",
"builder",
"=",
"DocumentBuilderFactory",
".",
"newInstance",
"(",
")",
".",
"n... | Parses the content of the given stream as an XML document.
@param in the XML file input stream
@return the document instance representing the entire XML document
@throws ApiException problem parsing the XML input stream | [
"Parses",
"the",
"content",
"of",
"the",
"given",
"stream",
"as",
"an",
"XML",
"document",
"."
] | train | https://github.com/antopen/alipay-sdk-java/blob/e82aeac7d0239330ee173c7e393596e51e41c1cd/src/main/java/com/alipay/api/internal/util/XmlUtils.java#L96-L120 |
OpenTSDB/opentsdb | src/core/Internal.java | Internal.isFloat | public static boolean isFloat(final byte[] qualifier, final int offset) {
"""
Parses the qualifier to determine if the data is a floating point value.
4 bytes == Float, 8 bytes == Double
@param qualifier The qualifier to parse
@param offset An offset within the byte array
@return True if the encoded data is a floating point value
@throws IllegalArgumentException if the qualifier is null or the offset falls
outside of the qualifier array
@since 2.1
"""
validateQualifier(qualifier, offset);
if ((qualifier[offset] & Const.MS_BYTE_FLAG) == Const.MS_BYTE_FLAG) {
return (qualifier[offset + 3] & Const.FLAG_FLOAT) == Const.FLAG_FLOAT;
} else {
return (qualifier[offset + 1] & Const.FLAG_FLOAT) == Const.FLAG_FLOAT;
}
} | java | public static boolean isFloat(final byte[] qualifier, final int offset) {
validateQualifier(qualifier, offset);
if ((qualifier[offset] & Const.MS_BYTE_FLAG) == Const.MS_BYTE_FLAG) {
return (qualifier[offset + 3] & Const.FLAG_FLOAT) == Const.FLAG_FLOAT;
} else {
return (qualifier[offset + 1] & Const.FLAG_FLOAT) == Const.FLAG_FLOAT;
}
} | [
"public",
"static",
"boolean",
"isFloat",
"(",
"final",
"byte",
"[",
"]",
"qualifier",
",",
"final",
"int",
"offset",
")",
"{",
"validateQualifier",
"(",
"qualifier",
",",
"offset",
")",
";",
"if",
"(",
"(",
"qualifier",
"[",
"offset",
"]",
"&",
"Const",... | Parses the qualifier to determine if the data is a floating point value.
4 bytes == Float, 8 bytes == Double
@param qualifier The qualifier to parse
@param offset An offset within the byte array
@return True if the encoded data is a floating point value
@throws IllegalArgumentException if the qualifier is null or the offset falls
outside of the qualifier array
@since 2.1 | [
"Parses",
"the",
"qualifier",
"to",
"determine",
"if",
"the",
"data",
"is",
"a",
"floating",
"point",
"value",
".",
"4",
"bytes",
"==",
"Float",
"8",
"bytes",
"==",
"Double"
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/Internal.java#L789-L796 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/common/FrameworkProjectConfig.java | FrameworkProjectConfig.createProjectPropertyLookup | private static PropertyLookup createProjectPropertyLookup(
IFilesystemFramework filesystemFramework,
String projectName
) {
"""
Create PropertyLookup for a project from the framework basedir
@param filesystemFramework the filesystem
"""
PropertyLookup lookup;
final Properties ownProps = new Properties();
ownProps.setProperty("project.name", projectName);
File baseDir = filesystemFramework.getBaseDir();
File projectsBaseDir = filesystemFramework.getFrameworkProjectsBaseDir();
//generic framework properties for a project
final File fwkProjectPropertyFile = FilesystemFramework.getPropertyFile(filesystemFramework.getConfigDir());
final Properties nodeWideDepotProps = PropertyLookup.fetchProperties(fwkProjectPropertyFile);
nodeWideDepotProps.putAll(ownProps);
final File propertyFile = getProjectPropertyFile(new File(projectsBaseDir, projectName));
if (propertyFile.exists()) {
lookup = PropertyLookup.create(
propertyFile,
nodeWideDepotProps,
FilesystemFramework.createPropertyLookupFromBasedir(baseDir)
);
} else {
lookup = PropertyLookup.create(fwkProjectPropertyFile,
ownProps, FilesystemFramework.createPropertyLookupFromBasedir(baseDir)
);
}
lookup.expand();
return lookup;
} | java | private static PropertyLookup createProjectPropertyLookup(
IFilesystemFramework filesystemFramework,
String projectName
)
{
PropertyLookup lookup;
final Properties ownProps = new Properties();
ownProps.setProperty("project.name", projectName);
File baseDir = filesystemFramework.getBaseDir();
File projectsBaseDir = filesystemFramework.getFrameworkProjectsBaseDir();
//generic framework properties for a project
final File fwkProjectPropertyFile = FilesystemFramework.getPropertyFile(filesystemFramework.getConfigDir());
final Properties nodeWideDepotProps = PropertyLookup.fetchProperties(fwkProjectPropertyFile);
nodeWideDepotProps.putAll(ownProps);
final File propertyFile = getProjectPropertyFile(new File(projectsBaseDir, projectName));
if (propertyFile.exists()) {
lookup = PropertyLookup.create(
propertyFile,
nodeWideDepotProps,
FilesystemFramework.createPropertyLookupFromBasedir(baseDir)
);
} else {
lookup = PropertyLookup.create(fwkProjectPropertyFile,
ownProps, FilesystemFramework.createPropertyLookupFromBasedir(baseDir)
);
}
lookup.expand();
return lookup;
} | [
"private",
"static",
"PropertyLookup",
"createProjectPropertyLookup",
"(",
"IFilesystemFramework",
"filesystemFramework",
",",
"String",
"projectName",
")",
"{",
"PropertyLookup",
"lookup",
";",
"final",
"Properties",
"ownProps",
"=",
"new",
"Properties",
"(",
")",
";",... | Create PropertyLookup for a project from the framework basedir
@param filesystemFramework the filesystem | [
"Create",
"PropertyLookup",
"for",
"a",
"project",
"from",
"the",
"framework",
"basedir"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/common/FrameworkProjectConfig.java#L365-L396 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/AvroUtils.java | AvroUtils.copyProperties | private static void copyProperties(Map<String, JsonNode> props, Schema schema) {
"""
*
Copy properties to an Avro Schema
@param props Properties to copy to Avro Schema
@param schema Avro Schema to copy properties to
"""
Preconditions.checkNotNull(schema);
// (if null, don't copy but do not throw exception)
if (null != props) {
for (Map.Entry<String, JsonNode> prop : props.entrySet()) {
schema.addProp(prop.getKey(), prop.getValue());
}
}
} | java | private static void copyProperties(Map<String, JsonNode> props, Schema schema) {
Preconditions.checkNotNull(schema);
// (if null, don't copy but do not throw exception)
if (null != props) {
for (Map.Entry<String, JsonNode> prop : props.entrySet()) {
schema.addProp(prop.getKey(), prop.getValue());
}
}
} | [
"private",
"static",
"void",
"copyProperties",
"(",
"Map",
"<",
"String",
",",
"JsonNode",
">",
"props",
",",
"Schema",
"schema",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"schema",
")",
";",
"// (if null, don't copy but do not throw exception)",
"if",
... | *
Copy properties to an Avro Schema
@param props Properties to copy to Avro Schema
@param schema Avro Schema to copy properties to | [
"*",
"Copy",
"properties",
"to",
"an",
"Avro",
"Schema"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/AvroUtils.java#L793-L802 |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/AccountsApi.java | AccountsApi.createPermissionProfile | public PermissionProfile createPermissionProfile(String accountId, PermissionProfile permissionProfile) throws ApiException {
"""
Creates a new permission profile in the specified account.
@param accountId The external account number (int) or account ID Guid. (required)
@param permissionProfile (optional)
@return PermissionProfile
"""
return createPermissionProfile(accountId, permissionProfile, null);
} | java | public PermissionProfile createPermissionProfile(String accountId, PermissionProfile permissionProfile) throws ApiException {
return createPermissionProfile(accountId, permissionProfile, null);
} | [
"public",
"PermissionProfile",
"createPermissionProfile",
"(",
"String",
"accountId",
",",
"PermissionProfile",
"permissionProfile",
")",
"throws",
"ApiException",
"{",
"return",
"createPermissionProfile",
"(",
"accountId",
",",
"permissionProfile",
",",
"null",
")",
";",... | Creates a new permission profile in the specified account.
@param accountId The external account number (int) or account ID Guid. (required)
@param permissionProfile (optional)
@return PermissionProfile | [
"Creates",
"a",
"new",
"permission",
"profile",
"in",
"the",
"specified",
"account",
"."
] | train | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/AccountsApi.java#L274-L276 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/HelixSolver.java | HelixSolver.getRise | private static double getRise(Matrix4d transformation, Point3d p1,
Point3d p2) {
"""
Returns the rise of a helix given the subunit centers of two adjacent
subunits and the helix transformation
@param transformation
helix transformation
@param p1
center of one subunit
@param p2
center of an adjacent subunit
@return
"""
AxisAngle4d axis = getAxisAngle(transformation);
Vector3d h = new Vector3d(axis.x, axis.y, axis.z);
Vector3d p = new Vector3d();
p.sub(p1, p2);
return p.dot(h);
} | java | private static double getRise(Matrix4d transformation, Point3d p1,
Point3d p2) {
AxisAngle4d axis = getAxisAngle(transformation);
Vector3d h = new Vector3d(axis.x, axis.y, axis.z);
Vector3d p = new Vector3d();
p.sub(p1, p2);
return p.dot(h);
} | [
"private",
"static",
"double",
"getRise",
"(",
"Matrix4d",
"transformation",
",",
"Point3d",
"p1",
",",
"Point3d",
"p2",
")",
"{",
"AxisAngle4d",
"axis",
"=",
"getAxisAngle",
"(",
"transformation",
")",
";",
"Vector3d",
"h",
"=",
"new",
"Vector3d",
"(",
"axi... | Returns the rise of a helix given the subunit centers of two adjacent
subunits and the helix transformation
@param transformation
helix transformation
@param p1
center of one subunit
@param p2
center of an adjacent subunit
@return | [
"Returns",
"the",
"rise",
"of",
"a",
"helix",
"given",
"the",
"subunit",
"centers",
"of",
"two",
"adjacent",
"subunits",
"and",
"the",
"helix",
"transformation"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/HelixSolver.java#L407-L414 |
apereo/person-directory | person-directory-impl/src/main/java/org/apereo/services/persondir/support/web/RequestAttributeSourceFilter.java | RequestAttributeSourceFilter.addRequestHeaders | protected void addRequestHeaders(final HttpServletRequest httpServletRequest, final Map<String, List<Object>> attributes) {
"""
Add request headers to the attributes map
@param httpServletRequest Http Servlet Request
@param attributes Map of attributes to add additional attributes to from the Http Request
"""
for (final Map.Entry<String, Set<String>> headerAttributeEntry : this.headerAttributeMapping.entrySet()) {
final String headerName = headerAttributeEntry.getKey();
final String value = httpServletRequest.getHeader(headerName);
if (value != null) {
for (final String attributeName : headerAttributeEntry.getValue()) {
attributes.put(attributeName,
headersToIgnoreSemicolons.contains(headerName) ?
list(value)
: splitOnSemiColonHandlingBackslashEscaping(value));
}
}
}
} | java | protected void addRequestHeaders(final HttpServletRequest httpServletRequest, final Map<String, List<Object>> attributes) {
for (final Map.Entry<String, Set<String>> headerAttributeEntry : this.headerAttributeMapping.entrySet()) {
final String headerName = headerAttributeEntry.getKey();
final String value = httpServletRequest.getHeader(headerName);
if (value != null) {
for (final String attributeName : headerAttributeEntry.getValue()) {
attributes.put(attributeName,
headersToIgnoreSemicolons.contains(headerName) ?
list(value)
: splitOnSemiColonHandlingBackslashEscaping(value));
}
}
}
} | [
"protected",
"void",
"addRequestHeaders",
"(",
"final",
"HttpServletRequest",
"httpServletRequest",
",",
"final",
"Map",
"<",
"String",
",",
"List",
"<",
"Object",
">",
">",
"attributes",
")",
"{",
"for",
"(",
"final",
"Map",
".",
"Entry",
"<",
"String",
","... | Add request headers to the attributes map
@param httpServletRequest Http Servlet Request
@param attributes Map of attributes to add additional attributes to from the Http Request | [
"Add",
"request",
"headers",
"to",
"the",
"attributes",
"map"
] | train | https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/web/RequestAttributeSourceFilter.java#L458-L472 |
exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/artifact/ArtifactManagingServiceImpl.java | ArtifactManagingServiceImpl.removeArtifact | public void removeArtifact(SessionProvider sp, Descriptor artifact) throws RepositoryException {
"""
/*
According JCR structure, version Node holds all actual data: jar, pom and ckecksums Removing
that node is removing all content and artifact indeed!
@see org.exoplatform.services.jcr.ext.maven.ArtifactManagingService#removeArtifact
(org.exoplatform.services.jcr.ext.common.SessionProvider,
org.exoplatform.services.jcr.ext.maven.ArtifactDescriptor)
"""
Session session = currentSession(sp);
Node root = (Node) session.getItem(rootNodePath);
String pathToRemove = "";
if (rootNodePath.length() > 1)
{
if (rootNodePath.endsWith("/"))
pathToRemove = rootNodePath + artifact.getAsPath();
else
pathToRemove = rootNodePath + "/" + artifact.getAsPath();
}
else
{
pathToRemove = "/" + artifact.getAsPath();
}
if (LOG.isDebugEnabled())
{
LOG.debug("Remove node: " + pathToRemove);
}
Node rmNode = (Node) session.getItem(pathToRemove);
// while (rmNode != root) {
// Node parent = rmNode.getParent();
rmNode.remove();
// if (!parent.hasNodes())
// rmNode = parent;
// else
// break;
// }
session.save();
} | java | public void removeArtifact(SessionProvider sp, Descriptor artifact) throws RepositoryException
{
Session session = currentSession(sp);
Node root = (Node) session.getItem(rootNodePath);
String pathToRemove = "";
if (rootNodePath.length() > 1)
{
if (rootNodePath.endsWith("/"))
pathToRemove = rootNodePath + artifact.getAsPath();
else
pathToRemove = rootNodePath + "/" + artifact.getAsPath();
}
else
{
pathToRemove = "/" + artifact.getAsPath();
}
if (LOG.isDebugEnabled())
{
LOG.debug("Remove node: " + pathToRemove);
}
Node rmNode = (Node) session.getItem(pathToRemove);
// while (rmNode != root) {
// Node parent = rmNode.getParent();
rmNode.remove();
// if (!parent.hasNodes())
// rmNode = parent;
// else
// break;
// }
session.save();
} | [
"public",
"void",
"removeArtifact",
"(",
"SessionProvider",
"sp",
",",
"Descriptor",
"artifact",
")",
"throws",
"RepositoryException",
"{",
"Session",
"session",
"=",
"currentSession",
"(",
"sp",
")",
";",
"Node",
"root",
"=",
"(",
"Node",
")",
"session",
".",... | /*
According JCR structure, version Node holds all actual data: jar, pom and ckecksums Removing
that node is removing all content and artifact indeed!
@see org.exoplatform.services.jcr.ext.maven.ArtifactManagingService#removeArtifact
(org.exoplatform.services.jcr.ext.common.SessionProvider,
org.exoplatform.services.jcr.ext.maven.ArtifactDescriptor) | [
"/",
"*",
"According",
"JCR",
"structure",
"version",
"Node",
"holds",
"all",
"actual",
"data",
":",
"jar",
"pom",
"and",
"ckecksums",
"Removing",
"that",
"node",
"is",
"removing",
"all",
"content",
"and",
"artifact",
"indeed!"
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/artifact/ArtifactManagingServiceImpl.java#L528-L563 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_GET | public OvhOvhPabxDialplanExtension billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_GET(String billingAccount, String serviceName, Long dialplanId, Long extensionId) throws IOException {
"""
Get this object properties
REST: GET /telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param dialplanId [required]
@param extensionId [required]
"""
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId, extensionId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOvhPabxDialplanExtension.class);
} | java | public OvhOvhPabxDialplanExtension billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_GET(String billingAccount, String serviceName, Long dialplanId, Long extensionId) throws IOException {
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId, extensionId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOvhPabxDialplanExtension.class);
} | [
"public",
"OvhOvhPabxDialplanExtension",
"billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_GET",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"dialplanId",
",",
"Long",
"extensionId",
")",
"throws",
"IOException",
"{",
... | Get this object properties
REST: GET /telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param dialplanId [required]
@param extensionId [required] | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L7034-L7039 |
line/centraldogma | server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java | MetadataService.updateTokenRole | public CompletableFuture<Revision> updateTokenRole(Author author, String projectName,
Token token, ProjectRole role) {
"""
Updates a {@link ProjectRole} for the {@link Token} of the specified {@code appId}.
"""
requireNonNull(author, "author");
requireNonNull(projectName, "projectName");
requireNonNull(token, "token");
requireNonNull(role, "role");
final TokenRegistration registration = new TokenRegistration(token.appId(), role,
UserAndTimestamp.of(author));
final JsonPointer path = JsonPointer.compile("/tokens" + encodeSegment(registration.id()));
final Change<JsonNode> change =
Change.ofJsonPatch(METADATA_JSON,
new ReplaceOperation(path, Jackson.valueToTree(registration))
.toJsonNode());
final String commitSummary = "Update the role of a token '" + token.appId() +
"' as '" + role + "' for the project " + projectName;
return metadataRepo.push(projectName, Project.REPO_DOGMA, author, commitSummary, change);
} | java | public CompletableFuture<Revision> updateTokenRole(Author author, String projectName,
Token token, ProjectRole role) {
requireNonNull(author, "author");
requireNonNull(projectName, "projectName");
requireNonNull(token, "token");
requireNonNull(role, "role");
final TokenRegistration registration = new TokenRegistration(token.appId(), role,
UserAndTimestamp.of(author));
final JsonPointer path = JsonPointer.compile("/tokens" + encodeSegment(registration.id()));
final Change<JsonNode> change =
Change.ofJsonPatch(METADATA_JSON,
new ReplaceOperation(path, Jackson.valueToTree(registration))
.toJsonNode());
final String commitSummary = "Update the role of a token '" + token.appId() +
"' as '" + role + "' for the project " + projectName;
return metadataRepo.push(projectName, Project.REPO_DOGMA, author, commitSummary, change);
} | [
"public",
"CompletableFuture",
"<",
"Revision",
">",
"updateTokenRole",
"(",
"Author",
"author",
",",
"String",
"projectName",
",",
"Token",
"token",
",",
"ProjectRole",
"role",
")",
"{",
"requireNonNull",
"(",
"author",
",",
"\"author\"",
")",
";",
"requireNonN... | Updates a {@link ProjectRole} for the {@link Token} of the specified {@code appId}. | [
"Updates",
"a",
"{"
] | train | https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java#L407-L424 |
aws/aws-sdk-java | aws-java-sdk-sns/src/main/java/com/amazonaws/services/sns/model/PlatformApplication.java | PlatformApplication.withAttributes | public PlatformApplication withAttributes(java.util.Map<String, String> attributes) {
"""
<p>
Attributes for platform application object.
</p>
@param attributes
Attributes for platform application object.
@return Returns a reference to this object so that method calls can be chained together.
"""
setAttributes(attributes);
return this;
} | java | public PlatformApplication withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | [
"public",
"PlatformApplication",
"withAttributes",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"setAttributes",
"(",
"attributes",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Attributes for platform application object.
</p>
@param attributes
Attributes for platform application object.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Attributes",
"for",
"platform",
"application",
"object",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-sns/src/main/java/com/amazonaws/services/sns/model/PlatformApplication.java#L120-L123 |
apache/flink | flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/drivers/parameter/DoubleParameter.java | DoubleParameter.setMinimumValue | public DoubleParameter setMinimumValue(double minimumValue, boolean inclusive) {
"""
Set the minimum value. The minimum value is an acceptable value if and
only if inclusive is set to true.
@param minimumValue the minimum value
@param inclusive whether the minimum value is a valid value
@return this
"""
if (hasDefaultValue) {
if (inclusive) {
Util.checkParameter(minimumValue <= defaultValue,
"Minimum value (" + minimumValue + ") must be less than or equal to default (" + defaultValue + ")");
} else {
Util.checkParameter(minimumValue < defaultValue,
"Minimum value (" + minimumValue + ") must be less than default (" + defaultValue + ")");
}
} else if (hasMaximumValue) {
if (inclusive && maximumValueInclusive) {
Util.checkParameter(minimumValue <= maximumValue,
"Minimum value (" + minimumValue + ") must be less than or equal to maximum (" + maximumValue + ")");
} else {
Util.checkParameter(minimumValue < maximumValue,
"Minimum value (" + minimumValue + ") must be less than maximum (" + maximumValue + ")");
}
}
this.hasMinimumValue = true;
this.minimumValue = minimumValue;
this.minimumValueInclusive = inclusive;
return this;
} | java | public DoubleParameter setMinimumValue(double minimumValue, boolean inclusive) {
if (hasDefaultValue) {
if (inclusive) {
Util.checkParameter(minimumValue <= defaultValue,
"Minimum value (" + minimumValue + ") must be less than or equal to default (" + defaultValue + ")");
} else {
Util.checkParameter(minimumValue < defaultValue,
"Minimum value (" + minimumValue + ") must be less than default (" + defaultValue + ")");
}
} else if (hasMaximumValue) {
if (inclusive && maximumValueInclusive) {
Util.checkParameter(minimumValue <= maximumValue,
"Minimum value (" + minimumValue + ") must be less than or equal to maximum (" + maximumValue + ")");
} else {
Util.checkParameter(minimumValue < maximumValue,
"Minimum value (" + minimumValue + ") must be less than maximum (" + maximumValue + ")");
}
}
this.hasMinimumValue = true;
this.minimumValue = minimumValue;
this.minimumValueInclusive = inclusive;
return this;
} | [
"public",
"DoubleParameter",
"setMinimumValue",
"(",
"double",
"minimumValue",
",",
"boolean",
"inclusive",
")",
"{",
"if",
"(",
"hasDefaultValue",
")",
"{",
"if",
"(",
"inclusive",
")",
"{",
"Util",
".",
"checkParameter",
"(",
"minimumValue",
"<=",
"defaultValu... | Set the minimum value. The minimum value is an acceptable value if and
only if inclusive is set to true.
@param minimumValue the minimum value
@param inclusive whether the minimum value is a valid value
@return this | [
"Set",
"the",
"minimum",
"value",
".",
"The",
"minimum",
"value",
"is",
"an",
"acceptable",
"value",
"if",
"and",
"only",
"if",
"inclusive",
"is",
"set",
"to",
"true",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/drivers/parameter/DoubleParameter.java#L88-L112 |
h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/easy/EasyPredictModelWrapper.java | EasyPredictModelWrapper.predictOrdinal | public OrdinalModelPrediction predictOrdinal(RowData data, double offset) throws PredictException {
"""
Make a prediction on a new data point using a Ordinal model.
@param data A new data point.
@param offset Prediction offset
@return The prediction.
@throws PredictException
"""
double[] preds = preamble(ModelCategory.Ordinal, data, offset);
OrdinalModelPrediction p = new OrdinalModelPrediction();
p.classProbabilities = new double[m.getNumResponseClasses()];
p.labelIndex = (int) preds[0];
String[] domainValues = m.getDomainValues(m.getResponseIdx());
p.label = domainValues[p.labelIndex];
System.arraycopy(preds, 1, p.classProbabilities, 0, p.classProbabilities.length);
return p;
} | java | public OrdinalModelPrediction predictOrdinal(RowData data, double offset) throws PredictException {
double[] preds = preamble(ModelCategory.Ordinal, data, offset);
OrdinalModelPrediction p = new OrdinalModelPrediction();
p.classProbabilities = new double[m.getNumResponseClasses()];
p.labelIndex = (int) preds[0];
String[] domainValues = m.getDomainValues(m.getResponseIdx());
p.label = domainValues[p.labelIndex];
System.arraycopy(preds, 1, p.classProbabilities, 0, p.classProbabilities.length);
return p;
} | [
"public",
"OrdinalModelPrediction",
"predictOrdinal",
"(",
"RowData",
"data",
",",
"double",
"offset",
")",
"throws",
"PredictException",
"{",
"double",
"[",
"]",
"preds",
"=",
"preamble",
"(",
"ModelCategory",
".",
"Ordinal",
",",
"data",
",",
"offset",
")",
... | Make a prediction on a new data point using a Ordinal model.
@param data A new data point.
@param offset Prediction offset
@return The prediction.
@throws PredictException | [
"Make",
"a",
"prediction",
"on",
"a",
"new",
"data",
"point",
"using",
"a",
"Ordinal",
"model",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/easy/EasyPredictModelWrapper.java#L644-L655 |
BotMill/fb-botmill | src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ReplyFactory.java | ReplyFactory.addAirlineCheckinTemplate | public static AirlineCheckinTemplateBuilder addAirlineCheckinTemplate(
String introMessage, String locale, String pnrNumber,
String checkinUrl) {
"""
Adds an Airline Checkin Template to the response.
@param introMessage
the message to send before the template. It can't be empty.
@param locale
the current locale. It can't be empty and must be in format
[a-z]{2}_[A-Z]{2}. Locale must be in format [a-z]{2}_[A-Z]{2}.
For more information see<a href=
"https://developers.facebook.com/docs/internationalization#locales"
> Facebook's locale support</a>.
@param pnrNumber
the Passenger Name Record number (Booking Number). It can't be
empty.
@param checkinUrl
the url for the checkin. It can't be empty.
@return a builder for the response.
@see <a href=
"https://developers.facebook.com/docs/messenger-platform/send-api-reference/airline-checkin-template"
> Facebook's Messenger Platform Airline Checkin Template
Documentation</a>
"""
return new AirlineCheckinTemplateBuilder(introMessage, locale,
pnrNumber, checkinUrl);
} | java | public static AirlineCheckinTemplateBuilder addAirlineCheckinTemplate(
String introMessage, String locale, String pnrNumber,
String checkinUrl) {
return new AirlineCheckinTemplateBuilder(introMessage, locale,
pnrNumber, checkinUrl);
} | [
"public",
"static",
"AirlineCheckinTemplateBuilder",
"addAirlineCheckinTemplate",
"(",
"String",
"introMessage",
",",
"String",
"locale",
",",
"String",
"pnrNumber",
",",
"String",
"checkinUrl",
")",
"{",
"return",
"new",
"AirlineCheckinTemplateBuilder",
"(",
"introMessag... | Adds an Airline Checkin Template to the response.
@param introMessage
the message to send before the template. It can't be empty.
@param locale
the current locale. It can't be empty and must be in format
[a-z]{2}_[A-Z]{2}. Locale must be in format [a-z]{2}_[A-Z]{2}.
For more information see<a href=
"https://developers.facebook.com/docs/internationalization#locales"
> Facebook's locale support</a>.
@param pnrNumber
the Passenger Name Record number (Booking Number). It can't be
empty.
@param checkinUrl
the url for the checkin. It can't be empty.
@return a builder for the response.
@see <a href=
"https://developers.facebook.com/docs/messenger-platform/send-api-reference/airline-checkin-template"
> Facebook's Messenger Platform Airline Checkin Template
Documentation</a> | [
"Adds",
"an",
"Airline",
"Checkin",
"Template",
"to",
"the",
"response",
"."
] | train | https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ReplyFactory.java#L323-L328 |
seam/faces | impl/src/main/java/org/jboss/seam/faces/util/BeanManagerUtils.java | BeanManagerUtils.getContextualInstanceStrict | @SuppressWarnings("unchecked")
public static <T> T getContextualInstanceStrict(final BeanManager manager, final Class<T> type) {
"""
Get a CDI managed instance matching exactly the given type. That's why BeanManager#resolve isn't used.
<p/>
<b>NOTE:</b> Using this method should be avoided at all costs.
<b>NOTE:</b> Using this method should be avoided at all costs.
@param manager The bean manager with which to perform the lookup.
@param type The class for which to return an instance.
@return The managed instance, or null if none could be provided.
"""
T result = null;
Bean<T> bean = resolveStrict(manager, type);
if (bean != null) {
CreationalContext<T> context = manager.createCreationalContext(bean);
if (context != null) {
result = (T) manager.getReference(bean, type, context);
}
}
return result;
} | java | @SuppressWarnings("unchecked")
public static <T> T getContextualInstanceStrict(final BeanManager manager, final Class<T> type) {
T result = null;
Bean<T> bean = resolveStrict(manager, type);
if (bean != null) {
CreationalContext<T> context = manager.createCreationalContext(bean);
if (context != null) {
result = (T) manager.getReference(bean, type, context);
}
}
return result;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"getContextualInstanceStrict",
"(",
"final",
"BeanManager",
"manager",
",",
"final",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"T",
"result",
"=",
"null",
";",
"Bea... | Get a CDI managed instance matching exactly the given type. That's why BeanManager#resolve isn't used.
<p/>
<b>NOTE:</b> Using this method should be avoided at all costs.
<b>NOTE:</b> Using this method should be avoided at all costs.
@param manager The bean manager with which to perform the lookup.
@param type The class for which to return an instance.
@return The managed instance, or null if none could be provided. | [
"Get",
"a",
"CDI",
"managed",
"instance",
"matching",
"exactly",
"the",
"given",
"type",
".",
"That",
"s",
"why",
"BeanManager#resolve",
"isn",
"t",
"used",
".",
"<p",
"/",
">",
"<b",
">",
"NOTE",
":",
"<",
"/",
"b",
">",
"Using",
"this",
"method",
"... | train | https://github.com/seam/faces/blob/2fdedbc7070318c2c58bfffb8a26f1ea1d0ee1e3/impl/src/main/java/org/jboss/seam/faces/util/BeanManagerUtils.java#L134-L145 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WPartialDateField.java | WPartialDateField.isValidCharacters | private boolean isValidCharacters(final String component, final char padding) {
"""
Check the component is either all padding chars or all digit chars.
@param component the date component.
@param padding the padding character.
@return true if the component is valid, otherwise false
"""
// Check the component is either all padding chars or all digit chars
boolean paddingChars = false;
boolean digitChars = false;
for (int i = 0; i < component.length(); i++) {
char chr = component.charAt(i);
// Padding
if (chr == padding) {
if (digitChars) {
return false;
}
paddingChars = true;
} else if (chr >= '0' && chr <= '9') { // Digit
if (paddingChars) {
return false;
}
digitChars = true;
} else {
return false;
}
}
return true;
} | java | private boolean isValidCharacters(final String component, final char padding) {
// Check the component is either all padding chars or all digit chars
boolean paddingChars = false;
boolean digitChars = false;
for (int i = 0; i < component.length(); i++) {
char chr = component.charAt(i);
// Padding
if (chr == padding) {
if (digitChars) {
return false;
}
paddingChars = true;
} else if (chr >= '0' && chr <= '9') { // Digit
if (paddingChars) {
return false;
}
digitChars = true;
} else {
return false;
}
}
return true;
} | [
"private",
"boolean",
"isValidCharacters",
"(",
"final",
"String",
"component",
",",
"final",
"char",
"padding",
")",
"{",
"// Check the component is either all padding chars or all digit chars",
"boolean",
"paddingChars",
"=",
"false",
";",
"boolean",
"digitChars",
"=",
... | Check the component is either all padding chars or all digit chars.
@param component the date component.
@param padding the padding character.
@return true if the component is valid, otherwise false | [
"Check",
"the",
"component",
"is",
"either",
"all",
"padding",
"chars",
"or",
"all",
"digit",
"chars",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WPartialDateField.java#L695-L718 |
overturetool/overture | core/pog/src/main/java/org/overture/pog/obligation/ProofObligation.java | ProofObligation.makeRelContext | protected AForAllExp makeRelContext(ATypeDefinition node, AVariableExp... exps) {
"""
Create the context (forall x,y,z...) for a Proof Obligation for
eq and ord relations.
"""
AForAllExp forall_exp = new AForAllExp();
forall_exp.setType(new ABooleanBasicType());
ATypeMultipleBind tmb = new ATypeMultipleBind();
List<PPattern> pats = new LinkedList<>();
for (AVariableExp exp : exps)
{
pats.add(AstFactory.newAIdentifierPattern(exp.getName().clone()));
}
tmb.setPlist(pats);
tmb.setType(node.getType().clone());
List<PMultipleBind> binds = new LinkedList<>();
binds.add(tmb);
forall_exp.setBindList(binds);
return forall_exp;
} | java | protected AForAllExp makeRelContext(ATypeDefinition node, AVariableExp... exps){
AForAllExp forall_exp = new AForAllExp();
forall_exp.setType(new ABooleanBasicType());
ATypeMultipleBind tmb = new ATypeMultipleBind();
List<PPattern> pats = new LinkedList<>();
for (AVariableExp exp : exps)
{
pats.add(AstFactory.newAIdentifierPattern(exp.getName().clone()));
}
tmb.setPlist(pats);
tmb.setType(node.getType().clone());
List<PMultipleBind> binds = new LinkedList<>();
binds.add(tmb);
forall_exp.setBindList(binds);
return forall_exp;
} | [
"protected",
"AForAllExp",
"makeRelContext",
"(",
"ATypeDefinition",
"node",
",",
"AVariableExp",
"...",
"exps",
")",
"{",
"AForAllExp",
"forall_exp",
"=",
"new",
"AForAllExp",
"(",
")",
";",
"forall_exp",
".",
"setType",
"(",
"new",
"ABooleanBasicType",
"(",
")... | Create the context (forall x,y,z...) for a Proof Obligation for
eq and ord relations. | [
"Create",
"the",
"context",
"(",
"forall",
"x",
"y",
"z",
"...",
")",
"for",
"a",
"Proof",
"Obligation",
"for",
"eq",
"and",
"ord",
"relations",
"."
] | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/pog/src/main/java/org/overture/pog/obligation/ProofObligation.java#L237-L254 |
MorphiaOrg/morphia | morphia/src/main/java/dev/morphia/MapreduceResults.java | MapreduceResults.setInlineRequiredOptions | public void setInlineRequiredOptions(final Datastore datastore, final Class<T> clazz, final Mapper mapper, final EntityCache cache) {
"""
Sets the required options when the operation type was INLINE
@param datastore the Datastore to use when fetching this reference
@param clazz the type of the results
@param mapper the mapper to use
@param cache the cache of entities seen so far
@see OutputType
"""
this.mapper = mapper;
this.datastore = datastore;
this.clazz = clazz;
this.cache = cache;
} | java | public void setInlineRequiredOptions(final Datastore datastore, final Class<T> clazz, final Mapper mapper, final EntityCache cache) {
this.mapper = mapper;
this.datastore = datastore;
this.clazz = clazz;
this.cache = cache;
} | [
"public",
"void",
"setInlineRequiredOptions",
"(",
"final",
"Datastore",
"datastore",
",",
"final",
"Class",
"<",
"T",
">",
"clazz",
",",
"final",
"Mapper",
"mapper",
",",
"final",
"EntityCache",
"cache",
")",
"{",
"this",
".",
"mapper",
"=",
"mapper",
";",
... | Sets the required options when the operation type was INLINE
@param datastore the Datastore to use when fetching this reference
@param clazz the type of the results
@param mapper the mapper to use
@param cache the cache of entities seen so far
@see OutputType | [
"Sets",
"the",
"required",
"options",
"when",
"the",
"operation",
"type",
"was",
"INLINE"
] | train | https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/MapreduceResults.java#L166-L171 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/SimpleResourceDefinition.java | SimpleResourceDefinition.registerAddOperation | @Deprecated
@SuppressWarnings("deprecation")
protected void registerAddOperation(final ManagementResourceRegistration registration, final OperationStepHandler handler, OperationEntry.Flag... flags) {
"""
Registers add operation
@param registration resource on which to register
@param handler operation handler to register
@param flags with flags
@deprecated use {@link #registerAddOperation(org.jboss.as.controller.registry.ManagementResourceRegistration, AbstractAddStepHandler, org.jboss.as.controller.registry.OperationEntry.Flag...)}
"""
if (handler instanceof DescriptionProvider) {
registration.registerOperationHandler(getOperationDefinition(ModelDescriptionConstants.ADD,
(DescriptionProvider) handler, OperationEntry.EntryType.PUBLIC,flags)
, handler);
} else {
registration.registerOperationHandler(getOperationDefinition(ModelDescriptionConstants.ADD,
new DefaultResourceAddDescriptionProvider(registration, descriptionResolver, orderedChild),
OperationEntry.EntryType.PUBLIC,
flags)
, handler);
}
} | java | @Deprecated
@SuppressWarnings("deprecation")
protected void registerAddOperation(final ManagementResourceRegistration registration, final OperationStepHandler handler, OperationEntry.Flag... flags) {
if (handler instanceof DescriptionProvider) {
registration.registerOperationHandler(getOperationDefinition(ModelDescriptionConstants.ADD,
(DescriptionProvider) handler, OperationEntry.EntryType.PUBLIC,flags)
, handler);
} else {
registration.registerOperationHandler(getOperationDefinition(ModelDescriptionConstants.ADD,
new DefaultResourceAddDescriptionProvider(registration, descriptionResolver, orderedChild),
OperationEntry.EntryType.PUBLIC,
flags)
, handler);
}
} | [
"@",
"Deprecated",
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"protected",
"void",
"registerAddOperation",
"(",
"final",
"ManagementResourceRegistration",
"registration",
",",
"final",
"OperationStepHandler",
"handler",
",",
"OperationEntry",
".",
"Flag",
"..."... | Registers add operation
@param registration resource on which to register
@param handler operation handler to register
@param flags with flags
@deprecated use {@link #registerAddOperation(org.jboss.as.controller.registry.ManagementResourceRegistration, AbstractAddStepHandler, org.jboss.as.controller.registry.OperationEntry.Flag...)} | [
"Registers",
"add",
"operation"
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/SimpleResourceDefinition.java#L415-L430 |
kazocsaba/matrix | src/main/java/hu/kazocsaba/math/matrix/MatrixFactory.java | MatrixFactory.createVector | public static Vector3 createVector(double x, double y, double z) {
"""
Creates and initializes a new 3D column vector.
@param x the x coordinate of the new vector
@param y the y coordinate of the new vector
@param z the z coordinate of the new vector
@return the new vector
"""
Vector3 v=new Vector3Impl();
v.setX(x);
v.setY(y);
v.setZ(z);
return v;
} | java | public static Vector3 createVector(double x, double y, double z) {
Vector3 v=new Vector3Impl();
v.setX(x);
v.setY(y);
v.setZ(z);
return v;
} | [
"public",
"static",
"Vector3",
"createVector",
"(",
"double",
"x",
",",
"double",
"y",
",",
"double",
"z",
")",
"{",
"Vector3",
"v",
"=",
"new",
"Vector3Impl",
"(",
")",
";",
"v",
".",
"setX",
"(",
"x",
")",
";",
"v",
".",
"setY",
"(",
"y",
")",
... | Creates and initializes a new 3D column vector.
@param x the x coordinate of the new vector
@param y the y coordinate of the new vector
@param z the z coordinate of the new vector
@return the new vector | [
"Creates",
"and",
"initializes",
"a",
"new",
"3D",
"column",
"vector",
"."
] | train | https://github.com/kazocsaba/matrix/blob/018570db945fe616b25606fe605fa6e0c180ab5b/src/main/java/hu/kazocsaba/math/matrix/MatrixFactory.java#L38-L44 |
m-m-m/util | xml/src/main/java/net/sf/mmm/util/xml/base/DomUtilImpl.java | DomUtilImpl.createTransformer | private Transformer createTransformer(boolean indent) {
"""
This method creates a new transformer.
@param indent - {@code true} if the XML should be indented (automatically add linebreaks before opening
tags), {@code false} otherwise.
@return the new transformer.
"""
try {
Transformer result = this.transformerFactory.newTransformer();
if (indent) {
result.setOutputProperty(OutputKeys.INDENT, "yes");
}
return result;
} catch (TransformerConfigurationException e) {
throw new IllegalStateException("XML Transformer misconfigured!" + " Probably your JVM does not support the required JAXP version!", e);
}
} | java | private Transformer createTransformer(boolean indent) {
try {
Transformer result = this.transformerFactory.newTransformer();
if (indent) {
result.setOutputProperty(OutputKeys.INDENT, "yes");
}
return result;
} catch (TransformerConfigurationException e) {
throw new IllegalStateException("XML Transformer misconfigured!" + " Probably your JVM does not support the required JAXP version!", e);
}
} | [
"private",
"Transformer",
"createTransformer",
"(",
"boolean",
"indent",
")",
"{",
"try",
"{",
"Transformer",
"result",
"=",
"this",
".",
"transformerFactory",
".",
"newTransformer",
"(",
")",
";",
"if",
"(",
"indent",
")",
"{",
"result",
".",
"setOutputProper... | This method creates a new transformer.
@param indent - {@code true} if the XML should be indented (automatically add linebreaks before opening
tags), {@code false} otherwise.
@return the new transformer. | [
"This",
"method",
"creates",
"a",
"new",
"transformer",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/xml/src/main/java/net/sf/mmm/util/xml/base/DomUtilImpl.java#L176-L187 |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/parser/TrecEvalParser.java | TrecEvalParser.parseLine | private void parseLine(final String line, final DataModelIF<Long, Long> dataset) {
"""
A method that parses a line from the file.
@param line the line to be parsed
@param dataset the dataset where the information parsed from the line
will be stored into.
"""
String[] toks = line.split("\t");
// user
long userId = Long.parseLong(toks[USER_TOK]);
// item
long itemId = Long.parseLong(toks[ITEM_TOK]);
// preference
double preference = Double.parseDouble(toks[RATING_TOK]);
//////
// update information
//////
dataset.addPreference(userId, itemId, preference);
// no timestamp info
} | java | private void parseLine(final String line, final DataModelIF<Long, Long> dataset) {
String[] toks = line.split("\t");
// user
long userId = Long.parseLong(toks[USER_TOK]);
// item
long itemId = Long.parseLong(toks[ITEM_TOK]);
// preference
double preference = Double.parseDouble(toks[RATING_TOK]);
//////
// update information
//////
dataset.addPreference(userId, itemId, preference);
// no timestamp info
} | [
"private",
"void",
"parseLine",
"(",
"final",
"String",
"line",
",",
"final",
"DataModelIF",
"<",
"Long",
",",
"Long",
">",
"dataset",
")",
"{",
"String",
"[",
"]",
"toks",
"=",
"line",
".",
"split",
"(",
"\"\\t\"",
")",
";",
"// user",
"long",
"userId... | A method that parses a line from the file.
@param line the line to be parsed
@param dataset the dataset where the information parsed from the line
will be stored into. | [
"A",
"method",
"that",
"parses",
"a",
"line",
"from",
"the",
"file",
"."
] | train | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/parser/TrecEvalParser.java#L84-L97 |
lucee/Lucee | core/src/main/java/lucee/runtime/net/http/ReqRspUtil.java | ReqRspUtil.getRequestBody | public static Object getRequestBody(PageContext pc, boolean deserialized, Object defaultValue) {
"""
returns the body of the request
@param pc
@param deserialized if true lucee tries to deserialize the body based on the content-type, for
example when the content type is "application/json"
@param defaultValue value returned if there is no body
@return
"""
HttpServletRequest req = pc.getHttpServletRequest();
MimeType contentType = getContentType(pc);
String strContentType = contentType == MimeType.ALL ? null : contentType.toString();
Charset cs = getCharacterEncoding(pc, req);
boolean isBinary = !(strContentType == null || HTTPUtil.isTextMimeType(contentType) || strContentType.toLowerCase().startsWith("application/x-www-form-urlencoded"));
if (req.getContentLength() > -1) {
ServletInputStream is = null;
try {
byte[] data = IOUtil.toBytes(is = req.getInputStream());// new byte[req.getContentLength()];
Object obj = NULL;
if (deserialized) {
int format = MimeType.toFormat(contentType, -1);
obj = toObject(pc, data, format, cs, obj);
}
if (obj == NULL) {
if (isBinary) obj = data;
else obj = toString(data, cs);
}
return obj;
}
catch (Exception e) {
pc.getConfig().getLog("application").error("request", e);
return defaultValue;
}
finally {
IOUtil.closeEL(is);
}
}
return defaultValue;
} | java | public static Object getRequestBody(PageContext pc, boolean deserialized, Object defaultValue) {
HttpServletRequest req = pc.getHttpServletRequest();
MimeType contentType = getContentType(pc);
String strContentType = contentType == MimeType.ALL ? null : contentType.toString();
Charset cs = getCharacterEncoding(pc, req);
boolean isBinary = !(strContentType == null || HTTPUtil.isTextMimeType(contentType) || strContentType.toLowerCase().startsWith("application/x-www-form-urlencoded"));
if (req.getContentLength() > -1) {
ServletInputStream is = null;
try {
byte[] data = IOUtil.toBytes(is = req.getInputStream());// new byte[req.getContentLength()];
Object obj = NULL;
if (deserialized) {
int format = MimeType.toFormat(contentType, -1);
obj = toObject(pc, data, format, cs, obj);
}
if (obj == NULL) {
if (isBinary) obj = data;
else obj = toString(data, cs);
}
return obj;
}
catch (Exception e) {
pc.getConfig().getLog("application").error("request", e);
return defaultValue;
}
finally {
IOUtil.closeEL(is);
}
}
return defaultValue;
} | [
"public",
"static",
"Object",
"getRequestBody",
"(",
"PageContext",
"pc",
",",
"boolean",
"deserialized",
",",
"Object",
"defaultValue",
")",
"{",
"HttpServletRequest",
"req",
"=",
"pc",
".",
"getHttpServletRequest",
"(",
")",
";",
"MimeType",
"contentType",
"=",
... | returns the body of the request
@param pc
@param deserialized if true lucee tries to deserialize the body based on the content-type, for
example when the content type is "application/json"
@param defaultValue value returned if there is no body
@return | [
"returns",
"the",
"body",
"of",
"the",
"request"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/http/ReqRspUtil.java#L443-L480 |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/components/factories/JComponentFactory.java | JComponentFactory.newTrayIcon | public static TrayIcon newTrayIcon(final String imgFilename, final String appName,
final PopupMenu systemTrayPopupMenu, final Map<String, ActionListener> actionListeners) {
"""
Factory method for create a {@link TrayIcon} object.
@param imgFilename
the img filename
@param appName
the app name
@param systemTrayPopupMenu
the system tray popup menu
@param actionListeners
the action listeners
@return the new {@link TrayIcon}.
"""
final Image image = Toolkit.getDefaultToolkit().getImage(imgFilename);
final TrayIcon trayIcon = new TrayIcon(image, appName, systemTrayPopupMenu);
for (final Map.Entry<String, ActionListener> actionListener : actionListeners.entrySet())
{
trayIcon.setActionCommand(actionListener.getKey());
trayIcon.addActionListener(actionListener.getValue());
}
return trayIcon;
} | java | public static TrayIcon newTrayIcon(final String imgFilename, final String appName,
final PopupMenu systemTrayPopupMenu, final Map<String, ActionListener> actionListeners)
{
final Image image = Toolkit.getDefaultToolkit().getImage(imgFilename);
final TrayIcon trayIcon = new TrayIcon(image, appName, systemTrayPopupMenu);
for (final Map.Entry<String, ActionListener> actionListener : actionListeners.entrySet())
{
trayIcon.setActionCommand(actionListener.getKey());
trayIcon.addActionListener(actionListener.getValue());
}
return trayIcon;
} | [
"public",
"static",
"TrayIcon",
"newTrayIcon",
"(",
"final",
"String",
"imgFilename",
",",
"final",
"String",
"appName",
",",
"final",
"PopupMenu",
"systemTrayPopupMenu",
",",
"final",
"Map",
"<",
"String",
",",
"ActionListener",
">",
"actionListeners",
")",
"{",
... | Factory method for create a {@link TrayIcon} object.
@param imgFilename
the img filename
@param appName
the app name
@param systemTrayPopupMenu
the system tray popup menu
@param actionListeners
the action listeners
@return the new {@link TrayIcon}. | [
"Factory",
"method",
"for",
"create",
"a",
"{",
"@link",
"TrayIcon",
"}",
"object",
"."
] | train | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/components/factories/JComponentFactory.java#L317-L328 |
alkacon/opencms-core | src/org/opencms/workplace/editors/CmsEditorSelector.java | CmsEditorSelector.showErrorDialog | private static void showErrorDialog(CmsJspActionElement jsp, Throwable t) {
"""
Shows the error dialog when no valid editor is found and returns null for the editor URI.<p>
@param jsp the instantiated CmsJspActionElement
@param t a throwable object, can be null
"""
CmsDialog wp = new CmsDialog(jsp);
wp.setParamMessage(Messages.get().getBundle(wp.getLocale()).key(Messages.ERR_NO_EDITOR_FOUND_0));
wp.fillParamValues(jsp.getRequest());
try {
wp.includeErrorpage(wp, t);
} catch (JspException e) {
LOG.debug(
org.opencms.workplace.commons.Messages.get().getBundle().key(
org.opencms.workplace.commons.Messages.LOG_ERROR_INCLUDE_FAILED_1,
CmsWorkplace.FILE_DIALOG_SCREEN_ERRORPAGE),
e);
}
} | java | private static void showErrorDialog(CmsJspActionElement jsp, Throwable t) {
CmsDialog wp = new CmsDialog(jsp);
wp.setParamMessage(Messages.get().getBundle(wp.getLocale()).key(Messages.ERR_NO_EDITOR_FOUND_0));
wp.fillParamValues(jsp.getRequest());
try {
wp.includeErrorpage(wp, t);
} catch (JspException e) {
LOG.debug(
org.opencms.workplace.commons.Messages.get().getBundle().key(
org.opencms.workplace.commons.Messages.LOG_ERROR_INCLUDE_FAILED_1,
CmsWorkplace.FILE_DIALOG_SCREEN_ERRORPAGE),
e);
}
} | [
"private",
"static",
"void",
"showErrorDialog",
"(",
"CmsJspActionElement",
"jsp",
",",
"Throwable",
"t",
")",
"{",
"CmsDialog",
"wp",
"=",
"new",
"CmsDialog",
"(",
"jsp",
")",
";",
"wp",
".",
"setParamMessage",
"(",
"Messages",
".",
"get",
"(",
")",
".",
... | Shows the error dialog when no valid editor is found and returns null for the editor URI.<p>
@param jsp the instantiated CmsJspActionElement
@param t a throwable object, can be null | [
"Shows",
"the",
"error",
"dialog",
"when",
"no",
"valid",
"editor",
"is",
"found",
"and",
"returns",
"null",
"for",
"the",
"editor",
"URI",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/editors/CmsEditorSelector.java#L85-L99 |
mgm-tp/jfunk | jfunk-data-generator/src/main/java/com/mgmtp/jfunk/data/generator/data/FormData.java | FormData.indexFormEntry | private boolean indexFormEntry(final FormData formData, final Field field, final int index, final Map<String, String> fixedValues) {
"""
Sets the {@link FormEntry} for {@code key+index} to the value of the {@link FormEntry} for
{@code key}. This method can be used for several lines within the same basic data set.
@return true if a value could be generated, false if the value already existed (but cannot be
regenerated because of it having to be unique)
"""
String entryKey = field.getEntryKey();
FormEntry entry = formData.getFormEntry(entryKey);
boolean unique = field.isUnique();
String value = entry.getValue();
String indexedKey = entryKey + JFunkConstants.INDEXED_KEY_SEPARATOR + index;
if (fixedValues != null && fixedValues.containsKey(indexedKey)) {
return true;
}
if (unique && !uniqueValuesMap.put(entry.getKey(), value)) {
log.debug("Value for " + entryKey + " has already been generated, but has to be unique.");
return false;
}
FormEntry target = getFormEntry(indexedKey);
target.setCurrentValue(value);
return true;
} | java | private boolean indexFormEntry(final FormData formData, final Field field, final int index, final Map<String, String> fixedValues) {
String entryKey = field.getEntryKey();
FormEntry entry = formData.getFormEntry(entryKey);
boolean unique = field.isUnique();
String value = entry.getValue();
String indexedKey = entryKey + JFunkConstants.INDEXED_KEY_SEPARATOR + index;
if (fixedValues != null && fixedValues.containsKey(indexedKey)) {
return true;
}
if (unique && !uniqueValuesMap.put(entry.getKey(), value)) {
log.debug("Value for " + entryKey + " has already been generated, but has to be unique.");
return false;
}
FormEntry target = getFormEntry(indexedKey);
target.setCurrentValue(value);
return true;
} | [
"private",
"boolean",
"indexFormEntry",
"(",
"final",
"FormData",
"formData",
",",
"final",
"Field",
"field",
",",
"final",
"int",
"index",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"fixedValues",
")",
"{",
"String",
"entryKey",
"=",
"field",
... | Sets the {@link FormEntry} for {@code key+index} to the value of the {@link FormEntry} for
{@code key}. This method can be used for several lines within the same basic data set.
@return true if a value could be generated, false if the value already existed (but cannot be
regenerated because of it having to be unique) | [
"Sets",
"the",
"{",
"@link",
"FormEntry",
"}",
"for",
"{",
"@code",
"key",
"+",
"index",
"}",
"to",
"the",
"value",
"of",
"the",
"{",
"@link",
"FormEntry",
"}",
"for",
"{",
"@code",
"key",
"}",
".",
"This",
"method",
"can",
"be",
"used",
"for",
"se... | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-data-generator/src/main/java/com/mgmtp/jfunk/data/generator/data/FormData.java#L287-L306 |
opsmatters/newrelic-api | src/main/java/com/opsmatters/newrelic/api/services/MonitorService.java | MonitorService.deleteLabel | public MonitorService deleteLabel(String monitorId, Label label) {
"""
Deletes the given label from the monitor with the given id.
@param monitorId The id of the monitor with the label
@param label The label to delete
@return This object
"""
HTTP.DELETE(String.format("/v1/monitors/%s/labels/%s", monitorId, label.getKey()));
return this;
} | java | public MonitorService deleteLabel(String monitorId, Label label)
{
HTTP.DELETE(String.format("/v1/monitors/%s/labels/%s", monitorId, label.getKey()));
return this;
} | [
"public",
"MonitorService",
"deleteLabel",
"(",
"String",
"monitorId",
",",
"Label",
"label",
")",
"{",
"HTTP",
".",
"DELETE",
"(",
"String",
".",
"format",
"(",
"\"/v1/monitors/%s/labels/%s\"",
",",
"monitorId",
",",
"label",
".",
"getKey",
"(",
")",
")",
"... | Deletes the given label from the monitor with the given id.
@param monitorId The id of the monitor with the label
@param label The label to delete
@return This object | [
"Deletes",
"the",
"given",
"label",
"from",
"the",
"monitor",
"with",
"the",
"given",
"id",
"."
] | train | https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/MonitorService.java#L220-L224 |
apache/groovy | subprojects/groovy-json/src/main/java/groovy/json/StreamingJsonBuilder.java | StreamingJsonBuilder.call | public Object call(Iterable coll, @DelegatesTo(StreamingJsonDelegate.class) Closure c) throws IOException {
"""
A collection and closure passed to a JSON builder will create a root JSON array applying
the closure to each object in the collection
<p>
Example:
<pre class="groovyTestCase">
class Author {
String name
}
def authors = [new Author (name: "Guillaume"), new Author (name: "Jochen"), new Author (name: "Paul")]
new StringWriter().with { w {@code ->}
def json = new groovy.json.StreamingJsonBuilder(w)
json authors, { Author author {@code ->}
name author.name
}
assert w.toString() == '[{"name":"Guillaume"},{"name":"Jochen"},{"name":"Paul"}]'
}
</pre>
@param coll a collection
@param c a closure used to convert the objects of coll
"""
return StreamingJsonDelegate.writeCollectionWithClosure(writer, coll, c, generator);
} | java | public Object call(Iterable coll, @DelegatesTo(StreamingJsonDelegate.class) Closure c) throws IOException {
return StreamingJsonDelegate.writeCollectionWithClosure(writer, coll, c, generator);
} | [
"public",
"Object",
"call",
"(",
"Iterable",
"coll",
",",
"@",
"DelegatesTo",
"(",
"StreamingJsonDelegate",
".",
"class",
")",
"Closure",
"c",
")",
"throws",
"IOException",
"{",
"return",
"StreamingJsonDelegate",
".",
"writeCollectionWithClosure",
"(",
"writer",
"... | A collection and closure passed to a JSON builder will create a root JSON array applying
the closure to each object in the collection
<p>
Example:
<pre class="groovyTestCase">
class Author {
String name
}
def authors = [new Author (name: "Guillaume"), new Author (name: "Jochen"), new Author (name: "Paul")]
new StringWriter().with { w {@code ->}
def json = new groovy.json.StreamingJsonBuilder(w)
json authors, { Author author {@code ->}
name author.name
}
assert w.toString() == '[{"name":"Guillaume"},{"name":"Jochen"},{"name":"Paul"}]'
}
</pre>
@param coll a collection
@param c a closure used to convert the objects of coll | [
"A",
"collection",
"and",
"closure",
"passed",
"to",
"a",
"JSON",
"builder",
"will",
"create",
"a",
"root",
"JSON",
"array",
"applying",
"the",
"closure",
"to",
"each",
"object",
"in",
"the",
"collection",
"<p",
">",
"Example",
":",
"<pre",
"class",
"=",
... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-json/src/main/java/groovy/json/StreamingJsonBuilder.java#L240-L242 |
spring-projects/spring-retry | src/main/java/org/springframework/classify/util/MethodInvokerUtils.java | MethodInvokerUtils.getMethodInvokerByName | public static MethodInvoker getMethodInvokerByName(Object object, String methodName,
boolean paramsRequired, Class<?>... paramTypes) {
"""
Create a {@link MethodInvoker} using the provided method name to search.
@param object to be invoked
@param methodName of the method to be invoked
@param paramsRequired boolean indicating whether the parameters are required, if
false, a no args version of the method will be searched for.
@param paramTypes - parameter types of the method to search for.
@return MethodInvoker if the method is found, null if it is not.
"""
Assert.notNull(object, "Object to invoke must not be null");
Method method = ClassUtils.getMethodIfAvailable(object.getClass(), methodName,
paramTypes);
if (method == null) {
String errorMsg = "no method found with name [" + methodName + "] on class ["
+ object.getClass().getSimpleName()
+ "] compatable with the signature ["
+ getParamTypesString(paramTypes) + "].";
Assert.isTrue(!paramsRequired, errorMsg);
// if no method was found for the given parameters, and the
// parameters aren't required, then try with no params
method = ClassUtils.getMethodIfAvailable(object.getClass(), methodName,
new Class[] {});
Assert.notNull(method, errorMsg);
}
return new SimpleMethodInvoker(object, method);
} | java | public static MethodInvoker getMethodInvokerByName(Object object, String methodName,
boolean paramsRequired, Class<?>... paramTypes) {
Assert.notNull(object, "Object to invoke must not be null");
Method method = ClassUtils.getMethodIfAvailable(object.getClass(), methodName,
paramTypes);
if (method == null) {
String errorMsg = "no method found with name [" + methodName + "] on class ["
+ object.getClass().getSimpleName()
+ "] compatable with the signature ["
+ getParamTypesString(paramTypes) + "].";
Assert.isTrue(!paramsRequired, errorMsg);
// if no method was found for the given parameters, and the
// parameters aren't required, then try with no params
method = ClassUtils.getMethodIfAvailable(object.getClass(), methodName,
new Class[] {});
Assert.notNull(method, errorMsg);
}
return new SimpleMethodInvoker(object, method);
} | [
"public",
"static",
"MethodInvoker",
"getMethodInvokerByName",
"(",
"Object",
"object",
",",
"String",
"methodName",
",",
"boolean",
"paramsRequired",
",",
"Class",
"<",
"?",
">",
"...",
"paramTypes",
")",
"{",
"Assert",
".",
"notNull",
"(",
"object",
",",
"\"... | Create a {@link MethodInvoker} using the provided method name to search.
@param object to be invoked
@param methodName of the method to be invoked
@param paramsRequired boolean indicating whether the parameters are required, if
false, a no args version of the method will be searched for.
@param paramTypes - parameter types of the method to search for.
@return MethodInvoker if the method is found, null if it is not. | [
"Create",
"a",
"{"
] | train | https://github.com/spring-projects/spring-retry/blob/e2b0555f96594c2321990d0deeac45fc44d4f123/src/main/java/org/springframework/classify/util/MethodInvokerUtils.java#L51-L69 |
fengwenyi/JavaLib | src/main/java/com/fengwenyi/javalib/util/DateTimeUtil.java | DateTimeUtil.stringToDate | public static Date stringToDate(String source, String format) throws ParseException {
"""
时间字符串转时间类型({@link Date})
@param source 时间字符串(需要满足指定格式)
@param format 指定格式
@return 时间类型({@link java.util.Date})
@throws ParseException 格式化出错
"""
if (StringUtils.isEmpty(source))
return null;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format);
return simpleDateFormat.parse(source);
} | java | public static Date stringToDate(String source, String format) throws ParseException {
if (StringUtils.isEmpty(source))
return null;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format);
return simpleDateFormat.parse(source);
} | [
"public",
"static",
"Date",
"stringToDate",
"(",
"String",
"source",
",",
"String",
"format",
")",
"throws",
"ParseException",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"source",
")",
")",
"return",
"null",
";",
"SimpleDateFormat",
"simpleDateFormat",
... | 时间字符串转时间类型({@link Date})
@param source 时间字符串(需要满足指定格式)
@param format 指定格式
@return 时间类型({@link java.util.Date})
@throws ParseException 格式化出错 | [
"时间字符串转时间类型",
"(",
"{"
] | train | https://github.com/fengwenyi/JavaLib/blob/14838b13fb11c024e41be766aa3e13ead4be1703/src/main/java/com/fengwenyi/javalib/util/DateTimeUtil.java#L39-L46 |
osglworks/java-tool | src/main/java/org/osgl/OsglConfig.java | OsglConfig.addGlobalMappingFilters | public static void addGlobalMappingFilters(String filterSpec, String ... filterSpecs) {
"""
Register global mapping filters.
@param filterSpec
the first filter spec
@param filterSpecs
other filter specs
@see #addGlobalMappingFilter(String)
"""
addGlobalMappingFilter(filterSpec);
for (String s : filterSpecs) {
addGlobalMappingFilter(s);
}
} | java | public static void addGlobalMappingFilters(String filterSpec, String ... filterSpecs) {
addGlobalMappingFilter(filterSpec);
for (String s : filterSpecs) {
addGlobalMappingFilter(s);
}
} | [
"public",
"static",
"void",
"addGlobalMappingFilters",
"(",
"String",
"filterSpec",
",",
"String",
"...",
"filterSpecs",
")",
"{",
"addGlobalMappingFilter",
"(",
"filterSpec",
")",
";",
"for",
"(",
"String",
"s",
":",
"filterSpecs",
")",
"{",
"addGlobalMappingFilt... | Register global mapping filters.
@param filterSpec
the first filter spec
@param filterSpecs
other filter specs
@see #addGlobalMappingFilter(String) | [
"Register",
"global",
"mapping",
"filters",
"."
] | train | https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/OsglConfig.java#L158-L163 |
thorstenwagner/TraJ | src/main/java/de/biomedical_imaging/traJ/simulation/SimulationUtil.java | SimulationUtil.addPositionNoise | public static Trajectory addPositionNoise(Trajectory t, double sd) {
"""
Adds position noise to the trajectories
@param t
@param sd
@return trajectory with position noise
"""
CentralRandomNumberGenerator r = CentralRandomNumberGenerator.getInstance();
Trajectory newt = new Trajectory(t.getDimension());
for(int i = 0; i < t.size(); i++){
newt.add(t.get(i));
for(int j = 1; j <= t.getDimension(); j++){
switch (j) {
case 1:
newt.get(i).setX(newt.get(i).x + r.nextGaussian()*sd);
break;
case 2:
newt.get(i).setY(newt.get(i).y + r.nextGaussian()*sd);
break;
case 3:
newt.get(i).setZ(newt.get(i).z + r.nextGaussian()*sd);
break;
default:
break;
}
}
}
return newt;
} | java | public static Trajectory addPositionNoise(Trajectory t, double sd){
CentralRandomNumberGenerator r = CentralRandomNumberGenerator.getInstance();
Trajectory newt = new Trajectory(t.getDimension());
for(int i = 0; i < t.size(); i++){
newt.add(t.get(i));
for(int j = 1; j <= t.getDimension(); j++){
switch (j) {
case 1:
newt.get(i).setX(newt.get(i).x + r.nextGaussian()*sd);
break;
case 2:
newt.get(i).setY(newt.get(i).y + r.nextGaussian()*sd);
break;
case 3:
newt.get(i).setZ(newt.get(i).z + r.nextGaussian()*sd);
break;
default:
break;
}
}
}
return newt;
} | [
"public",
"static",
"Trajectory",
"addPositionNoise",
"(",
"Trajectory",
"t",
",",
"double",
"sd",
")",
"{",
"CentralRandomNumberGenerator",
"r",
"=",
"CentralRandomNumberGenerator",
".",
"getInstance",
"(",
")",
";",
"Trajectory",
"newt",
"=",
"new",
"Trajectory",
... | Adds position noise to the trajectories
@param t
@param sd
@return trajectory with position noise | [
"Adds",
"position",
"noise",
"to",
"the",
"trajectories"
] | train | https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/simulation/SimulationUtil.java#L45-L70 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/linalg/jcublas/util/CudaArgs.java | CudaArgs.convertMPtoCores | public static int convertMPtoCores(int ccMajor, int ccMinor, int numberOfProcessors) {
"""
Returns number of SMs, based on device compute capability and number of processors.
@param ccMajor
@param ccMinor
@return
"""
// Defines for GPU Architecture types (using the SM version to determine the # of cores per SM
if (ccMajor == 1)
return 8;
if (ccMajor == 2 && ccMinor == 1)
return 48;
if (ccMajor == 2)
return 32;
if (ccMajor == 3)
return 192;
if (ccMajor == 5)
return 128;
// return negative number if device is unknown
return -1;
} | java | public static int convertMPtoCores(int ccMajor, int ccMinor, int numberOfProcessors) {
// Defines for GPU Architecture types (using the SM version to determine the # of cores per SM
if (ccMajor == 1)
return 8;
if (ccMajor == 2 && ccMinor == 1)
return 48;
if (ccMajor == 2)
return 32;
if (ccMajor == 3)
return 192;
if (ccMajor == 5)
return 128;
// return negative number if device is unknown
return -1;
} | [
"public",
"static",
"int",
"convertMPtoCores",
"(",
"int",
"ccMajor",
",",
"int",
"ccMinor",
",",
"int",
"numberOfProcessors",
")",
"{",
"// Defines for GPU Architecture types (using the SM version to determine the # of cores per SM",
"if",
"(",
"ccMajor",
"==",
"1",
")",
... | Returns number of SMs, based on device compute capability and number of processors.
@param ccMajor
@param ccMinor
@return | [
"Returns",
"number",
"of",
"SMs",
"based",
"on",
"device",
"compute",
"capability",
"and",
"number",
"of",
"processors",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/linalg/jcublas/util/CudaArgs.java#L274-L290 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/SigEva.java | SigEva.normScore | private double normScore(double score, double rmsd, int optLen, int r) {
"""
the chaining score is normalized by rmsd, twist and optimal alignment length
"""
//double score1 = modScore(score, r);
double score1 = score;
if(r > 0) score1 /= Math.sqrt(r + 1);
//it is tested that flexible score is more linear relevant to 1/r2 than 1/r
if(rmsd < 0.5) score1 *= Math.sqrt((optLen) / 0.5);
else score1 *= Math.sqrt((optLen) / rmsd);
return score1;
} | java | private double normScore(double score, double rmsd, int optLen, int r)
{
//double score1 = modScore(score, r);
double score1 = score;
if(r > 0) score1 /= Math.sqrt(r + 1);
//it is tested that flexible score is more linear relevant to 1/r2 than 1/r
if(rmsd < 0.5) score1 *= Math.sqrt((optLen) / 0.5);
else score1 *= Math.sqrt((optLen) / rmsd);
return score1;
} | [
"private",
"double",
"normScore",
"(",
"double",
"score",
",",
"double",
"rmsd",
",",
"int",
"optLen",
",",
"int",
"r",
")",
"{",
"//double score1 = modScore(score, r);",
"double",
"score1",
"=",
"score",
";",
"if",
"(",
"r",
">",
"0",
")",
"score1",
... | the chaining score is normalized by rmsd, twist and optimal alignment length | [
"the",
"chaining",
"score",
"is",
"normalized",
"by",
"rmsd",
"twist",
"and",
"optimal",
"alignment",
"length"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/SigEva.java#L201-L210 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.