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
apache/groovy
src/main/java/org/codehaus/groovy/transform/SortableASTTransformation.java
SortableASTTransformation.compareExpr
private static BinaryExpression compareExpr(Expression lhv, Expression rhv, boolean reversed) { """ Helper method used to build a binary expression that compares two values with the option to handle reverse order. """ return (reversed) ? cmpX(rhv, lhv) : cmpX(lhv, rhv); }
java
private static BinaryExpression compareExpr(Expression lhv, Expression rhv, boolean reversed) { return (reversed) ? cmpX(rhv, lhv) : cmpX(lhv, rhv); }
[ "private", "static", "BinaryExpression", "compareExpr", "(", "Expression", "lhv", ",", "Expression", "rhv", ",", "boolean", "reversed", ")", "{", "return", "(", "reversed", ")", "?", "cmpX", "(", "rhv", ",", "lhv", ")", ":", "cmpX", "(", "lhv", ",", "rhv...
Helper method used to build a binary expression that compares two values with the option to handle reverse order.
[ "Helper", "method", "used", "to", "build", "a", "binary", "expression", "that", "compares", "two", "values", "with", "the", "option", "to", "handle", "reverse", "order", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/SortableASTTransformation.java#L261-L263
google/auto
factory/src/main/java/com/google/auto/factory/processor/Key.java
Key.boxedType
private static TypeMirror boxedType(TypeMirror type, Types types) { """ If {@code type} is a primitive type, returns the boxed equivalent; otherwise returns {@code type}. """ return type.getKind().isPrimitive() ? types.boxedClass(MoreTypes.asPrimitiveType(type)).asType() : type; }
java
private static TypeMirror boxedType(TypeMirror type, Types types) { return type.getKind().isPrimitive() ? types.boxedClass(MoreTypes.asPrimitiveType(type)).asType() : type; }
[ "private", "static", "TypeMirror", "boxedType", "(", "TypeMirror", "type", ",", "Types", "types", ")", "{", "return", "type", ".", "getKind", "(", ")", ".", "isPrimitive", "(", ")", "?", "types", ".", "boxedClass", "(", "MoreTypes", ".", "asPrimitiveType", ...
If {@code type} is a primitive type, returns the boxed equivalent; otherwise returns {@code type}.
[ "If", "{" ]
train
https://github.com/google/auto/blob/4158a5fa71f1ef763e683b627f4d29bc04cfde9d/factory/src/main/java/com/google/auto/factory/processor/Key.java#L90-L94
adessoAG/wicked-charts
highcharts-wrapper/src/main/java/de/adesso/wickedcharts/highcharts/options/util/OptionsUtil.java
OptionsUtil.getPointWithWickedChartsId
public static Point getPointWithWickedChartsId(final Options options, final int wickedChartsId) { """ Retrieves the {@link Point} object with the given wickedChartsId from the given {@link Options} object. Returns null if a Point with the given ID does not exist. @param options Chartoptions @param wickedChartsId corresponding ID @return Point object """ for (Series<?> series : options.getSeries()) { for (Object object : series.getData()) { if (!(object instanceof Point)) { break; } else { Point point = (Point) object; if (point.getWickedChartsId() == wickedChartsId) { return point; } } } } return null; }
java
public static Point getPointWithWickedChartsId(final Options options, final int wickedChartsId) { for (Series<?> series : options.getSeries()) { for (Object object : series.getData()) { if (!(object instanceof Point)) { break; } else { Point point = (Point) object; if (point.getWickedChartsId() == wickedChartsId) { return point; } } } } return null; }
[ "public", "static", "Point", "getPointWithWickedChartsId", "(", "final", "Options", "options", ",", "final", "int", "wickedChartsId", ")", "{", "for", "(", "Series", "<", "?", ">", "series", ":", "options", ".", "getSeries", "(", ")", ")", "{", "for", "(",...
Retrieves the {@link Point} object with the given wickedChartsId from the given {@link Options} object. Returns null if a Point with the given ID does not exist. @param options Chartoptions @param wickedChartsId corresponding ID @return Point object
[ "Retrieves", "the", "{", "@link", "Point", "}", "object", "with", "the", "given", "wickedChartsId", "from", "the", "given", "{", "@link", "Options", "}", "object", ".", "Returns", "null", "if", "a", "Point", "with", "the", "given", "ID", "does", "not", "...
train
https://github.com/adessoAG/wicked-charts/blob/498aceff025f612e22ba5135b26531afeabac03c/highcharts-wrapper/src/main/java/de/adesso/wickedcharts/highcharts/options/util/OptionsUtil.java#L193-L207
JOML-CI/JOML
src/org/joml/Matrix3d.java
Matrix3d.rotateYXZ
public Matrix3d rotateYXZ(Vector3d angles) { """ Apply rotation of <code>angles.y</code> radians about the Y axis, followed by a rotation of <code>angles.x</code> radians about the X axis and followed by a rotation of <code>angles.z</code> radians about the Z axis. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>M * R</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the rotation will be applied first! <p> This method is equivalent to calling: <code>rotateY(angles.y).rotateX(angles.x).rotateZ(angles.z)</code> @param angles the Euler angles @return this """ return rotateYXZ(angles.y, angles.x, angles.z); }
java
public Matrix3d rotateYXZ(Vector3d angles) { return rotateYXZ(angles.y, angles.x, angles.z); }
[ "public", "Matrix3d", "rotateYXZ", "(", "Vector3d", "angles", ")", "{", "return", "rotateYXZ", "(", "angles", ".", "y", ",", "angles", ".", "x", ",", "angles", ".", "z", ")", ";", "}" ]
Apply rotation of <code>angles.y</code> radians about the Y axis, followed by a rotation of <code>angles.x</code> radians about the X axis and followed by a rotation of <code>angles.z</code> radians about the Z axis. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>M * R</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the rotation will be applied first! <p> This method is equivalent to calling: <code>rotateY(angles.y).rotateX(angles.x).rotateZ(angles.z)</code> @param angles the Euler angles @return this
[ "Apply", "rotation", "of", "<code", ">", "angles", ".", "y<", "/", "code", ">", "radians", "about", "the", "Y", "axis", "followed", "by", "a", "rotation", "of", "<code", ">", "angles", ".", "x<", "/", "code", ">", "radians", "about", "the", "X", "axi...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3d.java#L2404-L2406
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/Tr.java
Tr.formatMessage
public static String formatMessage(TraceComponent tc, Enumeration<Locale> locales, String msgKey, Object... objs) { """ Like {@link #formatMessage(TraceComponent, List, String, Object...)}, but takes an Enumeration of Locales. @see #formatMessage(TraceComponent, List, String, Object...) """ return formatMessage(tc, (locales == null) ? null : Collections.list(locales), msgKey, objs); }
java
public static String formatMessage(TraceComponent tc, Enumeration<Locale> locales, String msgKey, Object... objs) { return formatMessage(tc, (locales == null) ? null : Collections.list(locales), msgKey, objs); }
[ "public", "static", "String", "formatMessage", "(", "TraceComponent", "tc", ",", "Enumeration", "<", "Locale", ">", "locales", ",", "String", "msgKey", ",", "Object", "...", "objs", ")", "{", "return", "formatMessage", "(", "tc", ",", "(", "locales", "==", ...
Like {@link #formatMessage(TraceComponent, List, String, Object...)}, but takes an Enumeration of Locales. @see #formatMessage(TraceComponent, List, String, Object...)
[ "Like", "{", "@link", "#formatMessage", "(", "TraceComponent", "List", "String", "Object", "...", ")", "}", "but", "takes", "an", "Enumeration", "of", "Locales", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/Tr.java#L695-L697
Impetus/Kundera
src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java
CassandraSchemaManager.appendPropertyToBuilder
private void appendPropertyToBuilder(StringBuilder builder, String replicateOnWrite, String keyword) { """ Append property to builder. @param builder the builder @param replicateOnWrite the replicate on write @param keyword the keyword """ String replicateOn_Write = CQLTranslator.getKeyword(keyword); builder.append(replicateOn_Write); builder.append(CQLTranslator.EQ_CLAUSE); builder.append(replicateOnWrite); builder.append(CQLTranslator.AND_CLAUSE); }
java
private void appendPropertyToBuilder(StringBuilder builder, String replicateOnWrite, String keyword) { String replicateOn_Write = CQLTranslator.getKeyword(keyword); builder.append(replicateOn_Write); builder.append(CQLTranslator.EQ_CLAUSE); builder.append(replicateOnWrite); builder.append(CQLTranslator.AND_CLAUSE); }
[ "private", "void", "appendPropertyToBuilder", "(", "StringBuilder", "builder", ",", "String", "replicateOnWrite", ",", "String", "keyword", ")", "{", "String", "replicateOn_Write", "=", "CQLTranslator", ".", "getKeyword", "(", "keyword", ")", ";", "builder", ".", ...
Append property to builder. @param builder the builder @param replicateOnWrite the replicate on write @param keyword the keyword
[ "Append", "property", "to", "builder", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java#L2821-L2828
Azure/azure-sdk-for-java
storage/resource-manager/v2018_11_01/src/main/java/com/microsoft/azure/management/storage/v2018_11_01/implementation/BlobServicesInner.java
BlobServicesInner.setServiceProperties
public BlobServicePropertiesInner setServiceProperties(String resourceGroupName, String accountName, BlobServicePropertiesInner parameters) { """ Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @param parameters The properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @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 BlobServicePropertiesInner object if successful. """ return setServicePropertiesWithServiceResponseAsync(resourceGroupName, accountName, parameters).toBlocking().single().body(); }
java
public BlobServicePropertiesInner setServiceProperties(String resourceGroupName, String accountName, BlobServicePropertiesInner parameters) { return setServicePropertiesWithServiceResponseAsync(resourceGroupName, accountName, parameters).toBlocking().single().body(); }
[ "public", "BlobServicePropertiesInner", "setServiceProperties", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "BlobServicePropertiesInner", "parameters", ")", "{", "return", "setServicePropertiesWithServiceResponseAsync", "(", "resourceGroupName", ",", ...
Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @param parameters The properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @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 BlobServicePropertiesInner object if successful.
[ "Sets", "the", "properties", "of", "a", "storage", "account’s", "Blob", "service", "including", "properties", "for", "Storage", "Analytics", "and", "CORS", "(", "Cross", "-", "Origin", "Resource", "Sharing", ")", "rules", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_11_01/src/main/java/com/microsoft/azure/management/storage/v2018_11_01/implementation/BlobServicesInner.java#L78-L80
jillesvangurp/jsonj
src/main/java/com/github/jsonj/tools/JsonBuilder.java
JsonBuilder.putArray
public @Nonnull JsonBuilder putArray(String key, @Nonnull Number... values) { """ Add a JsonArray to the object with the number values added. @param key key @param values values values that go in the array @return the builder """ JsonArray jjArray = new JsonArray(); for (Number number : values) { jjArray.add(primitive(number)); } object.put(key, jjArray); return this; }
java
public @Nonnull JsonBuilder putArray(String key, @Nonnull Number... values) { JsonArray jjArray = new JsonArray(); for (Number number : values) { jjArray.add(primitive(number)); } object.put(key, jjArray); return this; }
[ "public", "@", "Nonnull", "JsonBuilder", "putArray", "(", "String", "key", ",", "@", "Nonnull", "Number", "...", "values", ")", "{", "JsonArray", "jjArray", "=", "new", "JsonArray", "(", ")", ";", "for", "(", "Number", "number", ":", "values", ")", "{", ...
Add a JsonArray to the object with the number values added. @param key key @param values values values that go in the array @return the builder
[ "Add", "a", "JsonArray", "to", "the", "object", "with", "the", "number", "values", "added", "." ]
train
https://github.com/jillesvangurp/jsonj/blob/1da0c44c5bdb60c0cd806c48d2da5a8a75bf84af/src/main/java/com/github/jsonj/tools/JsonBuilder.java#L142-L149
alkacon/opencms-core
src-gwt/org/opencms/ade/publish/client/CmsBrokenLinksPanel.java
CmsBrokenLinksPanel.addEntry
public CmsListItemWidget addEntry(CmsPublishResource res) { """ Adds a resource bean to be displayed.<p> @param res a resource bean @return the list item widget of the created entry """ final CmsListItemWidget itemWidget = CmsPublishGroupPanel.createListItemWidget(res, SLOT_MAPPING); CmsTreeItem item = new CmsTreeItem(false, itemWidget); item.setOpen(true); for (CmsPublishResource subRes : res.getRelated()) { final CmsListItemWidget subWidget = CmsPublishGroupPanel.createListItemWidget(subRes, SLOT_MAPPING); CmsTreeItem subItem = new CmsTreeItem(false, subWidget); item.addChild(subItem); } m_list.addItem(item); m_scrollPanel.onResizeDescendant(); return itemWidget; }
java
public CmsListItemWidget addEntry(CmsPublishResource res) { final CmsListItemWidget itemWidget = CmsPublishGroupPanel.createListItemWidget(res, SLOT_MAPPING); CmsTreeItem item = new CmsTreeItem(false, itemWidget); item.setOpen(true); for (CmsPublishResource subRes : res.getRelated()) { final CmsListItemWidget subWidget = CmsPublishGroupPanel.createListItemWidget(subRes, SLOT_MAPPING); CmsTreeItem subItem = new CmsTreeItem(false, subWidget); item.addChild(subItem); } m_list.addItem(item); m_scrollPanel.onResizeDescendant(); return itemWidget; }
[ "public", "CmsListItemWidget", "addEntry", "(", "CmsPublishResource", "res", ")", "{", "final", "CmsListItemWidget", "itemWidget", "=", "CmsPublishGroupPanel", ".", "createListItemWidget", "(", "res", ",", "SLOT_MAPPING", ")", ";", "CmsTreeItem", "item", "=", "new", ...
Adds a resource bean to be displayed.<p> @param res a resource bean @return the list item widget of the created entry
[ "Adds", "a", "resource", "bean", "to", "be", "displayed", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/publish/client/CmsBrokenLinksPanel.java#L136-L150
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.deletePrebuiltEntityRole
public OperationStatus deletePrebuiltEntityRole(UUID appId, String versionId, UUID entityId, UUID roleId) { """ Delete an entity role. @param appId The application ID. @param versionId The version ID. @param entityId The entity ID. @param roleId The entity role Id. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatus object if successful. """ return deletePrebuiltEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).toBlocking().single().body(); }
java
public OperationStatus deletePrebuiltEntityRole(UUID appId, String versionId, UUID entityId, UUID roleId) { return deletePrebuiltEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).toBlocking().single().body(); }
[ "public", "OperationStatus", "deletePrebuiltEntityRole", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ",", "UUID", "roleId", ")", "{", "return", "deletePrebuiltEntityRoleWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "ent...
Delete an entity role. @param appId The application ID. @param versionId The version ID. @param entityId The entity ID. @param roleId The entity role Id. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatus object if successful.
[ "Delete", "an", "entity", "role", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L11450-L11452
Azure/azure-sdk-for-java
compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/DisksInner.java
DisksInner.beginUpdate
public DiskInner beginUpdate(String resourceGroupName, String diskName, DiskUpdate disk) { """ Updates (patches) a disk. @param resourceGroupName The name of the resource group. @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. @param disk Disk object supplied in the body of the Patch disk operation. @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 DiskInner object if successful. """ return beginUpdateWithServiceResponseAsync(resourceGroupName, diskName, disk).toBlocking().single().body(); }
java
public DiskInner beginUpdate(String resourceGroupName, String diskName, DiskUpdate disk) { return beginUpdateWithServiceResponseAsync(resourceGroupName, diskName, disk).toBlocking().single().body(); }
[ "public", "DiskInner", "beginUpdate", "(", "String", "resourceGroupName", ",", "String", "diskName", ",", "DiskUpdate", "disk", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "diskName", ",", "disk", ")", ".", "toBlocking", ...
Updates (patches) a disk. @param resourceGroupName The name of the resource group. @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. @param disk Disk object supplied in the body of the Patch disk operation. @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 DiskInner object if successful.
[ "Updates", "(", "patches", ")", "a", "disk", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/DisksInner.java#L393-L395
dropbox/dropbox-sdk-java
src/main/java/com/dropbox/core/v1/DbxClientV1.java
DbxClientV1.getDeltaC
public <C> DbxDeltaC<C> getDeltaC(Collector<DbxDeltaC.Entry<DbxEntry>, C> collector, /*@Nullable*/String cursor, boolean includeMediaInfo) throws DbxException { """ A more generic version of {@link #getDelta}. You provide a <em>collector</em>, which lets you process the delta entries as they arrive over the network. """ return _getDeltaC(collector, cursor, null, includeMediaInfo); }
java
public <C> DbxDeltaC<C> getDeltaC(Collector<DbxDeltaC.Entry<DbxEntry>, C> collector, /*@Nullable*/String cursor, boolean includeMediaInfo) throws DbxException { return _getDeltaC(collector, cursor, null, includeMediaInfo); }
[ "public", "<", "C", ">", "DbxDeltaC", "<", "C", ">", "getDeltaC", "(", "Collector", "<", "DbxDeltaC", ".", "Entry", "<", "DbxEntry", ">", ",", "C", ">", "collector", ",", "/*@Nullable*/", "String", "cursor", ",", "boolean", "includeMediaInfo", ")", "throws...
A more generic version of {@link #getDelta}. You provide a <em>collector</em>, which lets you process the delta entries as they arrive over the network.
[ "A", "more", "generic", "version", "of", "{" ]
train
https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/v1/DbxClientV1.java#L1498-L1503
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/StringConverter.java
StringConverter.unicodeStringToString
public static String unicodeStringToString(String s) { """ Hsqldb specific decoding used only for log files. This method converts the 7 bit escaped ASCII strings in a log file back into Java Unicode strings. See stringToUnicodeBytes() above. <p> Method based on Hypersonic Code @param s encoded ASCII string in byte array @return Java string """ if ((s == null) || (s.indexOf("\\u") == -1)) { return s; } int len = s.length(); char[] b = new char[len]; int j = 0; for (int i = 0; i < len; i++) { char c = s.charAt(i); if (c == '\\' && i < len - 5) { char c1 = s.charAt(i + 1); if (c1 == 'u') { i++; // 4 characters read should always return 0-15 int k = getNibble(s.charAt(++i)) << 12; k += getNibble(s.charAt(++i)) << 8; k += getNibble(s.charAt(++i)) << 4; k += getNibble(s.charAt(++i)); b[j++] = (char) k; } else { b[j++] = c; } } else { b[j++] = c; } } return new String(b, 0, j); }
java
public static String unicodeStringToString(String s) { if ((s == null) || (s.indexOf("\\u") == -1)) { return s; } int len = s.length(); char[] b = new char[len]; int j = 0; for (int i = 0; i < len; i++) { char c = s.charAt(i); if (c == '\\' && i < len - 5) { char c1 = s.charAt(i + 1); if (c1 == 'u') { i++; // 4 characters read should always return 0-15 int k = getNibble(s.charAt(++i)) << 12; k += getNibble(s.charAt(++i)) << 8; k += getNibble(s.charAt(++i)) << 4; k += getNibble(s.charAt(++i)); b[j++] = (char) k; } else { b[j++] = c; } } else { b[j++] = c; } } return new String(b, 0, j); }
[ "public", "static", "String", "unicodeStringToString", "(", "String", "s", ")", "{", "if", "(", "(", "s", "==", "null", ")", "||", "(", "s", ".", "indexOf", "(", "\"\\\\u\"", ")", "==", "-", "1", ")", ")", "{", "return", "s", ";", "}", "int", "le...
Hsqldb specific decoding used only for log files. This method converts the 7 bit escaped ASCII strings in a log file back into Java Unicode strings. See stringToUnicodeBytes() above. <p> Method based on Hypersonic Code @param s encoded ASCII string in byte array @return Java string
[ "Hsqldb", "specific", "decoding", "used", "only", "for", "log", "files", ".", "This", "method", "converts", "the", "7", "bit", "escaped", "ASCII", "strings", "in", "a", "log", "file", "back", "into", "Java", "Unicode", "strings", ".", "See", "stringToUnicode...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/StringConverter.java#L434-L469
lightblueseas/wicket-js-addons
wicket-js-addons-core/src/main/java/de/alpharogroup/wicket/js/addon/core/JavascriptGenerator.java
JavascriptGenerator.generateJs
public String generateJs(final Settings settings, final String methodName) { """ Generate the javascript code. @param settings the settings @param methodName the method name @return the string """ // 1. Create an empty map... final Map<String, Object> variables = initializeVariables(settings.asSet()); // 4. Generate the js template with the map and the method name... final String stringTemplateContent = generateJavascriptTemplateContent(variables, methodName); // 5. Create the StringTextTemplate with the generated template... final StringTextTemplate stringTextTemplate = new StringTextTemplate(stringTemplateContent); // 6. Interpolate the template with the values of the map... stringTextTemplate.interpolate(variables); try { // 7. return it as String... return stringTextTemplate.asString(); } finally { try { stringTextTemplate.close(); } catch (final IOException e) { LOGGER.error(e.getMessage(), e); } } }
java
public String generateJs(final Settings settings, final String methodName) { // 1. Create an empty map... final Map<String, Object> variables = initializeVariables(settings.asSet()); // 4. Generate the js template with the map and the method name... final String stringTemplateContent = generateJavascriptTemplateContent(variables, methodName); // 5. Create the StringTextTemplate with the generated template... final StringTextTemplate stringTextTemplate = new StringTextTemplate(stringTemplateContent); // 6. Interpolate the template with the values of the map... stringTextTemplate.interpolate(variables); try { // 7. return it as String... return stringTextTemplate.asString(); } finally { try { stringTextTemplate.close(); } catch (final IOException e) { LOGGER.error(e.getMessage(), e); } } }
[ "public", "String", "generateJs", "(", "final", "Settings", "settings", ",", "final", "String", "methodName", ")", "{", "// 1. Create an empty map...\r", "final", "Map", "<", "String", ",", "Object", ">", "variables", "=", "initializeVariables", "(", "settings", "...
Generate the javascript code. @param settings the settings @param methodName the method name @return the string
[ "Generate", "the", "javascript", "code", "." ]
train
https://github.com/lightblueseas/wicket-js-addons/blob/b1c88c1abafd1e965f2e32ef13d66be0b28d76f6/wicket-js-addons-core/src/main/java/de/alpharogroup/wicket/js/addon/core/JavascriptGenerator.java#L163-L190
joniles/mpxj
src/main/java/net/sf/mpxj/json/JsonStreamWriter.java
JsonStreamWriter.internalWriteNameValuePair
private void internalWriteNameValuePair(String name, String value) throws IOException { """ Core write attribute implementation. @param name attribute name @param value attribute value """ writeComma(); writeNewLineIndent(); writeName(name); if (m_pretty) { m_writer.write(' '); } m_writer.write(value); }
java
private void internalWriteNameValuePair(String name, String value) throws IOException { writeComma(); writeNewLineIndent(); writeName(name); if (m_pretty) { m_writer.write(' '); } m_writer.write(value); }
[ "private", "void", "internalWriteNameValuePair", "(", "String", "name", ",", "String", "value", ")", "throws", "IOException", "{", "writeComma", "(", ")", ";", "writeNewLineIndent", "(", ")", ";", "writeName", "(", "name", ")", ";", "if", "(", "m_pretty", ")...
Core write attribute implementation. @param name attribute name @param value attribute value
[ "Core", "write", "attribute", "implementation", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/json/JsonStreamWriter.java#L206-L218
pravega/pravega
controller/src/main/java/io/pravega/controller/task/Stream/StreamMetadataTasks.java
StreamMetadataTasks.createStream
@Task(name = "createStream", version = "1.0", resource = " { """ Create stream. @param scope scope. @param stream stream name. @param config stream configuration. @param createTimestamp creation timestamp. @return creation status. """scope}/{stream}") public CompletableFuture<CreateStreamStatus.Status> createStream(String scope, String stream, StreamConfiguration config, long createTimestamp) { return execute( new Resource(scope, stream), new Serializable[]{scope, stream, config, createTimestamp}, () -> createStreamBody(scope, stream, config, createTimestamp)); }
java
@Task(name = "createStream", version = "1.0", resource = "{scope}/{stream}") public CompletableFuture<CreateStreamStatus.Status> createStream(String scope, String stream, StreamConfiguration config, long createTimestamp) { return execute( new Resource(scope, stream), new Serializable[]{scope, stream, config, createTimestamp}, () -> createStreamBody(scope, stream, config, createTimestamp)); }
[ "@", "Task", "(", "name", "=", "\"createStream\"", ",", "version", "=", "\"1.0\"", ",", "resource", "=", "\"{scope}/{stream}\"", ")", "public", "CompletableFuture", "<", "CreateStreamStatus", ".", "Status", ">", "createStream", "(", "String", "scope", ",", "Stri...
Create stream. @param scope scope. @param stream stream name. @param config stream configuration. @param createTimestamp creation timestamp. @return creation status.
[ "Create", "stream", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/task/Stream/StreamMetadataTasks.java#L155-L161
radkovo/jStyleParser
src/main/java/cz/vutbr/web/csskit/TermColorImpl.java
TermColorImpl.getColorByHash
public static TermColor getColorByHash(String hash) { """ Creates color from string in form #ABC or #AABBCC, or just simply ABC and AABBCC. where A, B, C are hexadecimal digits. @param hash Hash string @return Created color or <code>null</code> in case of error """ if(hash==null) throw new IllegalArgumentException("Invalid hash value (null) for color construction"); // lowercase and remove hash character, if any hash = hash.toLowerCase().replaceAll("^#", ""); // color written in #ABC format if(hash.matches("^[0-9a-f]{3}$")) { String r = hash.substring(0, 1); String g = hash.substring(1, 2); String b = hash.substring(2, 3); return new TermColorImpl(Integer.parseInt(r+r, 16), Integer.parseInt(g+g, 16), Integer.parseInt(b+b, 16)); } // color written in #AABBCC format else if(hash.matches("^[0-9a-f]{6}$")) { String r = hash.substring(0, 2); String g = hash.substring(2, 4); String b = hash.substring(4, 6); return new TermColorImpl(Integer.parseInt(r, 16), Integer.parseInt(g, 16), Integer.parseInt(b, 16)); } // invalid hash return null; }
java
public static TermColor getColorByHash(String hash) { if(hash==null) throw new IllegalArgumentException("Invalid hash value (null) for color construction"); // lowercase and remove hash character, if any hash = hash.toLowerCase().replaceAll("^#", ""); // color written in #ABC format if(hash.matches("^[0-9a-f]{3}$")) { String r = hash.substring(0, 1); String g = hash.substring(1, 2); String b = hash.substring(2, 3); return new TermColorImpl(Integer.parseInt(r+r, 16), Integer.parseInt(g+g, 16), Integer.parseInt(b+b, 16)); } // color written in #AABBCC format else if(hash.matches("^[0-9a-f]{6}$")) { String r = hash.substring(0, 2); String g = hash.substring(2, 4); String b = hash.substring(4, 6); return new TermColorImpl(Integer.parseInt(r, 16), Integer.parseInt(g, 16), Integer.parseInt(b, 16)); } // invalid hash return null; }
[ "public", "static", "TermColor", "getColorByHash", "(", "String", "hash", ")", "{", "if", "(", "hash", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"Invalid hash value (null) for color construction\"", ")", ";", "// lowercase and remove hash chara...
Creates color from string in form #ABC or #AABBCC, or just simply ABC and AABBCC. where A, B, C are hexadecimal digits. @param hash Hash string @return Created color or <code>null</code> in case of error
[ "Creates", "color", "from", "string", "in", "form", "#ABC", "or", "#AABBCC", "or", "just", "simply", "ABC", "and", "AABBCC", ".", "where", "A", "B", "C", "are", "hexadecimal", "digits", "." ]
train
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/TermColorImpl.java#L98-L122
xcesco/kripton
kripton-core/src/main/java/com/abubusoft/kripton/common/CollectionUtils.java
CollectionUtils.asList
public static <E extends List<Boolean>> E asList(boolean[] array, Class<E> listType) { """ As list. @param <E> the element type @param array the array @param listType the list type @return the e """ E result; try { result = listType.newInstance(); for (Object item : array) { result.add((boolean) item); } return result; } catch (InstantiationException | IllegalAccessException e) { e.printStackTrace(); throw (new KriptonRuntimeException(e.getMessage())); } }
java
public static <E extends List<Boolean>> E asList(boolean[] array, Class<E> listType) { E result; try { result = listType.newInstance(); for (Object item : array) { result.add((boolean) item); } return result; } catch (InstantiationException | IllegalAccessException e) { e.printStackTrace(); throw (new KriptonRuntimeException(e.getMessage())); } }
[ "public", "static", "<", "E", "extends", "List", "<", "Boolean", ">", ">", "E", "asList", "(", "boolean", "[", "]", "array", ",", "Class", "<", "E", ">", "listType", ")", "{", "E", "result", ";", "try", "{", "result", "=", "listType", ".", "newInst...
As list. @param <E> the element type @param array the array @param listType the list type @return the e
[ "As", "list", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-core/src/main/java/com/abubusoft/kripton/common/CollectionUtils.java#L282-L296
landawn/AbacusUtil
src/com/landawn/abacus/util/N.java
N.removeAll
@SafeVarargs public static long[] removeAll(final long[] a, final long... elements) { """ Returns a new array with removes all the occurrences of specified elements from <code>a</code> @param a @param elements @return @see Collection#removeAll(Collection) """ if (N.isNullOrEmpty(a)) { return N.EMPTY_LONG_ARRAY; } else if (N.isNullOrEmpty(elements)) { return a.clone(); } else if (elements.length == 1) { return removeAllOccurrences(a, elements[0]); } final LongList list = LongList.of(a.clone()); list.removeAll(LongList.of(elements)); return list.trimToSize().array(); }
java
@SafeVarargs public static long[] removeAll(final long[] a, final long... elements) { if (N.isNullOrEmpty(a)) { return N.EMPTY_LONG_ARRAY; } else if (N.isNullOrEmpty(elements)) { return a.clone(); } else if (elements.length == 1) { return removeAllOccurrences(a, elements[0]); } final LongList list = LongList.of(a.clone()); list.removeAll(LongList.of(elements)); return list.trimToSize().array(); }
[ "@", "SafeVarargs", "public", "static", "long", "[", "]", "removeAll", "(", "final", "long", "[", "]", "a", ",", "final", "long", "...", "elements", ")", "{", "if", "(", "N", ".", "isNullOrEmpty", "(", "a", ")", ")", "{", "return", "N", ".", "EMPTY...
Returns a new array with removes all the occurrences of specified elements from <code>a</code> @param a @param elements @return @see Collection#removeAll(Collection)
[ "Returns", "a", "new", "array", "with", "removes", "all", "the", "occurrences", "of", "specified", "elements", "from", "<code", ">", "a<", "/", "code", ">" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L23466-L23479
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleIO.java
ParticleIO.saveConfiguredSystem
public static void saveConfiguredSystem(File file, ParticleSystem system) throws IOException { """ Save a particle system with only ConfigurableEmitters in to an XML file @param file The file to save to @param system The system to store @throws IOException Indicates a failure to save or encode the system XML. """ saveConfiguredSystem(new FileOutputStream(file), system); }
java
public static void saveConfiguredSystem(File file, ParticleSystem system) throws IOException { saveConfiguredSystem(new FileOutputStream(file), system); }
[ "public", "static", "void", "saveConfiguredSystem", "(", "File", "file", ",", "ParticleSystem", "system", ")", "throws", "IOException", "{", "saveConfiguredSystem", "(", "new", "FileOutputStream", "(", "file", ")", ",", "system", ")", ";", "}" ]
Save a particle system with only ConfigurableEmitters in to an XML file @param file The file to save to @param system The system to store @throws IOException Indicates a failure to save or encode the system XML.
[ "Save", "a", "particle", "system", "with", "only", "ConfigurableEmitters", "in", "to", "an", "XML", "file" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleIO.java#L242-L245
EdwardRaff/JSAT
JSAT/src/jsat/DataSet.java
DataSet.setWeight
public void setWeight(int i, double w) { """ Sets the weight of a given datapoint within this data set. @param i the index to change the weight of @param w the new weight value. """ if(i >= size() || i < 0) throw new IndexOutOfBoundsException("Dataset has only " + size() + " members, can't access index " + i ); else if(Double.isNaN(w) || Double.isInfinite(w) || w < 0) throw new ArithmeticException("Invalid weight assignment of " + w); if(w == 1 && weights == null) return;//nothing to do, already handled implicitly if(weights == null)//need to init? { weights = new double[size()]; Arrays.fill(weights, 1.0); } //make sure we have enouh space if (weights.length <= i) weights = Arrays.copyOfRange(weights, 0, Math.max(weights.length*2, i+1)); weights[i] = w; }
java
public void setWeight(int i, double w) { if(i >= size() || i < 0) throw new IndexOutOfBoundsException("Dataset has only " + size() + " members, can't access index " + i ); else if(Double.isNaN(w) || Double.isInfinite(w) || w < 0) throw new ArithmeticException("Invalid weight assignment of " + w); if(w == 1 && weights == null) return;//nothing to do, already handled implicitly if(weights == null)//need to init? { weights = new double[size()]; Arrays.fill(weights, 1.0); } //make sure we have enouh space if (weights.length <= i) weights = Arrays.copyOfRange(weights, 0, Math.max(weights.length*2, i+1)); weights[i] = w; }
[ "public", "void", "setWeight", "(", "int", "i", ",", "double", "w", ")", "{", "if", "(", "i", ">=", "size", "(", ")", "||", "i", "<", "0", ")", "throw", "new", "IndexOutOfBoundsException", "(", "\"Dataset has only \"", "+", "size", "(", ")", "+", "\"...
Sets the weight of a given datapoint within this data set. @param i the index to change the weight of @param w the new weight value.
[ "Sets", "the", "weight", "of", "a", "given", "datapoint", "within", "this", "data", "set", "." ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/DataSet.java#L832-L853
GoogleCloudPlatform/bigdata-interop
gcsio/src/main/java/com/google/cloud/hadoop/gcsio/PrefixMappedItemCache.java
PrefixMappedItemCache.invalidateBucket
public synchronized void invalidateBucket(String bucket) { """ Invalidates all cached items and lists associated with the given bucket. @param bucket the bucket to invalidate. This must not be null. """ PrefixKey key = new PrefixKey(bucket, ""); getPrefixSubMap(itemMap, key).clear(); getPrefixSubMap(prefixMap, key).clear(); }
java
public synchronized void invalidateBucket(String bucket) { PrefixKey key = new PrefixKey(bucket, ""); getPrefixSubMap(itemMap, key).clear(); getPrefixSubMap(prefixMap, key).clear(); }
[ "public", "synchronized", "void", "invalidateBucket", "(", "String", "bucket", ")", "{", "PrefixKey", "key", "=", "new", "PrefixKey", "(", "bucket", ",", "\"\"", ")", ";", "getPrefixSubMap", "(", "itemMap", ",", "key", ")", ".", "clear", "(", ")", ";", "...
Invalidates all cached items and lists associated with the given bucket. @param bucket the bucket to invalidate. This must not be null.
[ "Invalidates", "all", "cached", "items", "and", "lists", "associated", "with", "the", "given", "bucket", "." ]
train
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/PrefixMappedItemCache.java#L212-L217
wcm-io/wcm-io-caconfig
extensions/src/main/java/io/wcm/caconfig/extensions/persistence/impl/PersistenceUtils.java
PersistenceUtils.ensurePageIfNotContainingPage
public static Resource ensurePageIfNotContainingPage(ResourceResolver resolver, String pagePath, String resourceType, ConfigurationManagementSettings configurationManagementSettings) { """ Ensure that a page at the given path exists, if the path is not already contained in a page. @param resolver Resource resolver @param pagePath Page path @param resourceType Resource type for page (if not template is set) @param configurationManagementSettings Configuration management settings @return Resource for AEM page or resource inside a page. """ Matcher matcher = PAGE_PATH_PATTERN.matcher(pagePath); if (matcher.matches()) { // ensure that shorted path part that ends with /jcr:content is created as AEM page (if not existent already) String detectedPagePath = matcher.group(1); ensurePage(resolver, detectedPagePath, null, resourceType, null, configurationManagementSettings); return getOrCreateResource(resolver, pagePath, DEFAULT_FOLDER_NODE_TYPE_IN_PAGE, null, configurationManagementSettings); } return ensurePage(resolver, pagePath, null, resourceType, null, configurationManagementSettings); }
java
public static Resource ensurePageIfNotContainingPage(ResourceResolver resolver, String pagePath, String resourceType, ConfigurationManagementSettings configurationManagementSettings) { Matcher matcher = PAGE_PATH_PATTERN.matcher(pagePath); if (matcher.matches()) { // ensure that shorted path part that ends with /jcr:content is created as AEM page (if not existent already) String detectedPagePath = matcher.group(1); ensurePage(resolver, detectedPagePath, null, resourceType, null, configurationManagementSettings); return getOrCreateResource(resolver, pagePath, DEFAULT_FOLDER_NODE_TYPE_IN_PAGE, null, configurationManagementSettings); } return ensurePage(resolver, pagePath, null, resourceType, null, configurationManagementSettings); }
[ "public", "static", "Resource", "ensurePageIfNotContainingPage", "(", "ResourceResolver", "resolver", ",", "String", "pagePath", ",", "String", "resourceType", ",", "ConfigurationManagementSettings", "configurationManagementSettings", ")", "{", "Matcher", "matcher", "=", "P...
Ensure that a page at the given path exists, if the path is not already contained in a page. @param resolver Resource resolver @param pagePath Page path @param resourceType Resource type for page (if not template is set) @param configurationManagementSettings Configuration management settings @return Resource for AEM page or resource inside a page.
[ "Ensure", "that", "a", "page", "at", "the", "given", "path", "exists", "if", "the", "path", "is", "not", "already", "contained", "in", "a", "page", "." ]
train
https://github.com/wcm-io/wcm-io-caconfig/blob/48592eadb0b62a09eec555cedfae7e00b213f6ed/extensions/src/main/java/io/wcm/caconfig/extensions/persistence/impl/PersistenceUtils.java#L118-L128
Azure/azure-sdk-for-java
containerinstance/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerinstance/v2018_02_01_preview/implementation/ContainerGroupsInner.java
ContainerGroupsInner.deleteAsync
public Observable<ContainerGroupInner> deleteAsync(String resourceGroupName, String containerGroupName) { """ Delete the specified container group. Delete the specified container group in the specified subscription and resource group. The operation does not delete other resources provided by the user, such as volumes. @param resourceGroupName The name of the resource group. @param containerGroupName The name of the container group. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ContainerGroupInner object """ return deleteWithServiceResponseAsync(resourceGroupName, containerGroupName).map(new Func1<ServiceResponse<ContainerGroupInner>, ContainerGroupInner>() { @Override public ContainerGroupInner call(ServiceResponse<ContainerGroupInner> response) { return response.body(); } }); }
java
public Observable<ContainerGroupInner> deleteAsync(String resourceGroupName, String containerGroupName) { return deleteWithServiceResponseAsync(resourceGroupName, containerGroupName).map(new Func1<ServiceResponse<ContainerGroupInner>, ContainerGroupInner>() { @Override public ContainerGroupInner call(ServiceResponse<ContainerGroupInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ContainerGroupInner", ">", "deleteAsync", "(", "String", "resourceGroupName", ",", "String", "containerGroupName", ")", "{", "return", "deleteWithServiceResponseAsync", "(", "resourceGroupName", ",", "containerGroupName", ")", ".", "map", "...
Delete the specified container group. Delete the specified container group in the specified subscription and resource group. The operation does not delete other resources provided by the user, such as volumes. @param resourceGroupName The name of the resource group. @param containerGroupName The name of the container group. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ContainerGroupInner object
[ "Delete", "the", "specified", "container", "group", ".", "Delete", "the", "specified", "container", "group", "in", "the", "specified", "subscription", "and", "resource", "group", ".", "The", "operation", "does", "not", "delete", "other", "resources", "provided", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerinstance/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerinstance/v2018_02_01_preview/implementation/ContainerGroupsInner.java#L745-L752
m-m-m/util
io/src/main/java/net/sf/mmm/util/io/impl/ProcessableDetectorStream.java
ProcessableDetectorStream.processInternal
public void processInternal(ByteArray buffer, boolean eos) throws IOException { """ @see DetectorStreamProcessor#process(net.sf.mmm.util.io.api.spi.DetectorStreamBuffer, Map, boolean) @param buffer is the next part of the streamed data. @param eos - {@code true} if the end of the stream has been reached and the given {@code buffer} has to be @throws IOException in case of an Input/Output error. Should only be used internally. """ if (buffer != null) { this.firstBuffer.append(buffer); } this.firstBuffer.process(getMutableMetadata(), eos); if (eos) { setDone(); } }
java
public void processInternal(ByteArray buffer, boolean eos) throws IOException { if (buffer != null) { this.firstBuffer.append(buffer); } this.firstBuffer.process(getMutableMetadata(), eos); if (eos) { setDone(); } }
[ "public", "void", "processInternal", "(", "ByteArray", "buffer", ",", "boolean", "eos", ")", "throws", "IOException", "{", "if", "(", "buffer", "!=", "null", ")", "{", "this", ".", "firstBuffer", ".", "append", "(", "buffer", ")", ";", "}", "this", ".", ...
@see DetectorStreamProcessor#process(net.sf.mmm.util.io.api.spi.DetectorStreamBuffer, Map, boolean) @param buffer is the next part of the streamed data. @param eos - {@code true} if the end of the stream has been reached and the given {@code buffer} has to be @throws IOException in case of an Input/Output error. Should only be used internally.
[ "@see", "DetectorStreamProcessor#process", "(", "net", ".", "sf", ".", "mmm", ".", "util", ".", "io", ".", "api", ".", "spi", ".", "DetectorStreamBuffer", "Map", "boolean", ")" ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/io/src/main/java/net/sf/mmm/util/io/impl/ProcessableDetectorStream.java#L73-L82
geomajas/geomajas-project-geometry
core/src/main/java/org/geomajas/geometry/service/BboxService.java
BboxService.intersects
public static boolean intersects(Bbox one, Bbox two) { """ Does one bounding box intersect another? @param one The first bounding box. @param two The second bounding box. @return true if the both bounding boxes intersect, false otherwise. """ if (two.getX() > one.getMaxX()) { return false; } if (two.getY() > one.getMaxY()) { return false; } if (two.getMaxX() < one.getX()) { return false; } if (two.getMaxY() < one.getY()) { return false; } return true; }
java
public static boolean intersects(Bbox one, Bbox two) { if (two.getX() > one.getMaxX()) { return false; } if (two.getY() > one.getMaxY()) { return false; } if (two.getMaxX() < one.getX()) { return false; } if (two.getMaxY() < one.getY()) { return false; } return true; }
[ "public", "static", "boolean", "intersects", "(", "Bbox", "one", ",", "Bbox", "two", ")", "{", "if", "(", "two", ".", "getX", "(", ")", ">", "one", ".", "getMaxX", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "two", ".", "getY", ...
Does one bounding box intersect another? @param one The first bounding box. @param two The second bounding box. @return true if the both bounding boxes intersect, false otherwise.
[ "Does", "one", "bounding", "box", "intersect", "another?" ]
train
https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/BboxService.java#L158-L172
aws/aws-sdk-java
aws-java-sdk-sagemaker/src/main/java/com/amazonaws/services/sagemaker/model/TransformJobDefinition.java
TransformJobDefinition.withEnvironment
public TransformJobDefinition withEnvironment(java.util.Map<String, String> environment) { """ <p> The environment variables to set in the Docker container. We support up to 16 key and values entries in the map. </p> @param environment The environment variables to set in the Docker container. We support up to 16 key and values entries in the map. @return Returns a reference to this object so that method calls can be chained together. """ setEnvironment(environment); return this; }
java
public TransformJobDefinition withEnvironment(java.util.Map<String, String> environment) { setEnvironment(environment); return this; }
[ "public", "TransformJobDefinition", "withEnvironment", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "environment", ")", "{", "setEnvironment", "(", "environment", ")", ";", "return", "this", ";", "}" ]
<p> The environment variables to set in the Docker container. We support up to 16 key and values entries in the map. </p> @param environment The environment variables to set in the Docker container. We support up to 16 key and values entries in the map. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "environment", "variables", "to", "set", "in", "the", "Docker", "container", ".", "We", "support", "up", "to", "16", "key", "and", "values", "entries", "in", "the", "map", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-sagemaker/src/main/java/com/amazonaws/services/sagemaker/model/TransformJobDefinition.java#L290-L293
moparisthebest/beehive
beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/RowToMapMapper.java
RowToMapMapper.mapRowToReturnType
public Object mapRowToReturnType() { """ Do the mapping. @return A Map. @throws ControlException on error. """ try { return Collections.unmodifiableMap(new ResultSetHashMap(_resultSet, _keys)); } catch (SQLException e) { throw new ControlException("Exception while creating ResultSetHashMap.", e); } }
java
public Object mapRowToReturnType() { try { return Collections.unmodifiableMap(new ResultSetHashMap(_resultSet, _keys)); } catch (SQLException e) { throw new ControlException("Exception while creating ResultSetHashMap.", e); } }
[ "public", "Object", "mapRowToReturnType", "(", ")", "{", "try", "{", "return", "Collections", ".", "unmodifiableMap", "(", "new", "ResultSetHashMap", "(", "_resultSet", ",", "_keys", ")", ")", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "throw", ...
Do the mapping. @return A Map. @throws ControlException on error.
[ "Do", "the", "mapping", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/RowToMapMapper.java#L55-L61
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/NetworkUtils.java
NetworkUtils.setLearningRate
public static void setLearningRate(ComputationGraph net, ISchedule newLrSchedule) { """ Set the learning rate schedule for all layers in the network to the specified schedule. This schedule will replace any/all existing schedules, and also any fixed learning rate values.<br> Note that the iteration/epoch counts will <i>not</i> be reset. Use {@link ComputationGraphConfiguration#setIterationCount(int)} and {@link ComputationGraphConfiguration#setEpochCount(int)} if this is required @param newLrSchedule New learning rate schedule for all layers """ setLearningRate(net, Double.NaN, newLrSchedule); }
java
public static void setLearningRate(ComputationGraph net, ISchedule newLrSchedule) { setLearningRate(net, Double.NaN, newLrSchedule); }
[ "public", "static", "void", "setLearningRate", "(", "ComputationGraph", "net", ",", "ISchedule", "newLrSchedule", ")", "{", "setLearningRate", "(", "net", ",", "Double", ".", "NaN", ",", "newLrSchedule", ")", ";", "}" ]
Set the learning rate schedule for all layers in the network to the specified schedule. This schedule will replace any/all existing schedules, and also any fixed learning rate values.<br> Note that the iteration/epoch counts will <i>not</i> be reset. Use {@link ComputationGraphConfiguration#setIterationCount(int)} and {@link ComputationGraphConfiguration#setEpochCount(int)} if this is required @param newLrSchedule New learning rate schedule for all layers
[ "Set", "the", "learning", "rate", "schedule", "for", "all", "layers", "in", "the", "network", "to", "the", "specified", "schedule", ".", "This", "schedule", "will", "replace", "any", "/", "all", "existing", "schedules", "and", "also", "any", "fixed", "learni...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/NetworkUtils.java#L283-L285
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.writeUtf8Lines
public static <T> File writeUtf8Lines(Collection<T> list, String path) throws IORuntimeException { """ 将列表写入文件,覆盖模式,编码为UTF-8 @param <T> 集合元素类型 @param list 列表 @param path 绝对路径 @return 目标文件 @throws IORuntimeException IO异常 @since 3.2.0 """ return writeLines(list, path, CharsetUtil.CHARSET_UTF_8); }
java
public static <T> File writeUtf8Lines(Collection<T> list, String path) throws IORuntimeException { return writeLines(list, path, CharsetUtil.CHARSET_UTF_8); }
[ "public", "static", "<", "T", ">", "File", "writeUtf8Lines", "(", "Collection", "<", "T", ">", "list", ",", "String", "path", ")", "throws", "IORuntimeException", "{", "return", "writeLines", "(", "list", ",", "path", ",", "CharsetUtil", ".", "CHARSET_UTF_8"...
将列表写入文件,覆盖模式,编码为UTF-8 @param <T> 集合元素类型 @param list 列表 @param path 绝对路径 @return 目标文件 @throws IORuntimeException IO异常 @since 3.2.0
[ "将列表写入文件,覆盖模式,编码为UTF", "-", "8" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2853-L2855
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AOStream.java
AOStream.consumeAcceptedTick
public final void consumeAcceptedTick(TransactionCommon t, AOValue storedTick) throws Exception { """ Helper method called by the AOStream when a persistent tick representing a persistently locked message should be removed since the message has been accepted. This method will also consume the message @param t the transaction @param stream the stream making this call @param storedTick the persistent tick @throws Exception """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "consumeAcceptedTick", storedTick); try { SIMPMessage msg = consumerDispatcher.getMessageByValue(storedTick); Transaction msTran = mp.resolveAndEnlistMsgStoreTransaction(t); // PK67067 We may not find a message in the store for this tick, because // it may have been removed using the SIBQueuePoint MBean if (msg != null) { msg.remove(msTran, storedTick.getPLockId()); } storedTick.lockItemIfAvailable(controlItemLockID); // should always be successful storedTick.remove(msTran, controlItemLockID); } catch (Exception e) { // No FFDC code needed if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "consumeAcceptedTick", e); throw e; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "consumeAcceptedTick"); }
java
public final void consumeAcceptedTick(TransactionCommon t, AOValue storedTick) throws Exception { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "consumeAcceptedTick", storedTick); try { SIMPMessage msg = consumerDispatcher.getMessageByValue(storedTick); Transaction msTran = mp.resolveAndEnlistMsgStoreTransaction(t); // PK67067 We may not find a message in the store for this tick, because // it may have been removed using the SIBQueuePoint MBean if (msg != null) { msg.remove(msTran, storedTick.getPLockId()); } storedTick.lockItemIfAvailable(controlItemLockID); // should always be successful storedTick.remove(msTran, controlItemLockID); } catch (Exception e) { // No FFDC code needed if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "consumeAcceptedTick", e); throw e; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "consumeAcceptedTick"); }
[ "public", "final", "void", "consumeAcceptedTick", "(", "TransactionCommon", "t", ",", "AOValue", "storedTick", ")", "throws", "Exception", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", ...
Helper method called by the AOStream when a persistent tick representing a persistently locked message should be removed since the message has been accepted. This method will also consume the message @param t the transaction @param stream the stream making this call @param storedTick the persistent tick @throws Exception
[ "Helper", "method", "called", "by", "the", "AOStream", "when", "a", "persistent", "tick", "representing", "a", "persistently", "locked", "message", "should", "be", "removed", "since", "the", "message", "has", "been", "accepted", ".", "This", "method", "will", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AOStream.java#L3184-L3214
jhalterman/failsafe
src/main/java/net/jodah/failsafe/ExecutionResult.java
ExecutionResult.withResult
public ExecutionResult withResult(Object result) { """ Returns a copy of the ExecutionResult with the {@code result} value, and completed and success set to true. """ return new ExecutionResult(result, null, nonResult, waitNanos, true, true, successAll); }
java
public ExecutionResult withResult(Object result) { return new ExecutionResult(result, null, nonResult, waitNanos, true, true, successAll); }
[ "public", "ExecutionResult", "withResult", "(", "Object", "result", ")", "{", "return", "new", "ExecutionResult", "(", "result", ",", "null", ",", "nonResult", ",", "waitNanos", ",", "true", ",", "true", ",", "successAll", ")", ";", "}" ]
Returns a copy of the ExecutionResult with the {@code result} value, and completed and success set to true.
[ "Returns", "a", "copy", "of", "the", "ExecutionResult", "with", "the", "{" ]
train
https://github.com/jhalterman/failsafe/blob/65fcd3a82f7b232d2ff59bc525a59d693dd8e223/src/main/java/net/jodah/failsafe/ExecutionResult.java#L103-L105
jbehave/jbehave-core
jbehave-core/src/main/java/org/jbehave/core/embedder/MetaFilter.java
MetaFilter.createMetaMatcher
protected MetaMatcher createMetaMatcher(String filterAsString, Map<String, MetaMatcher> metaMatchers) { """ Creates a MetaMatcher based on the filter content. @param filterAsString the String representation of the filter @param metaMatchers the Map of custom MetaMatchers @return A MetaMatcher used to match the filter content """ for ( String key : metaMatchers.keySet() ){ if ( filterAsString.startsWith(key)){ return metaMatchers.get(key); } } if (filterAsString.startsWith(GROOVY)) { return new GroovyMetaMatcher(); } return new DefaultMetaMatcher(); }
java
protected MetaMatcher createMetaMatcher(String filterAsString, Map<String, MetaMatcher> metaMatchers) { for ( String key : metaMatchers.keySet() ){ if ( filterAsString.startsWith(key)){ return metaMatchers.get(key); } } if (filterAsString.startsWith(GROOVY)) { return new GroovyMetaMatcher(); } return new DefaultMetaMatcher(); }
[ "protected", "MetaMatcher", "createMetaMatcher", "(", "String", "filterAsString", ",", "Map", "<", "String", ",", "MetaMatcher", ">", "metaMatchers", ")", "{", "for", "(", "String", "key", ":", "metaMatchers", ".", "keySet", "(", ")", ")", "{", "if", "(", ...
Creates a MetaMatcher based on the filter content. @param filterAsString the String representation of the filter @param metaMatchers the Map of custom MetaMatchers @return A MetaMatcher used to match the filter content
[ "Creates", "a", "MetaMatcher", "based", "on", "the", "filter", "content", "." ]
train
https://github.com/jbehave/jbehave-core/blob/bdd6a6199528df3c35087e72d4644870655b23e6/jbehave-core/src/main/java/org/jbehave/core/embedder/MetaFilter.java#L112-L122
twitter/hraven
hraven-core/src/main/java/com/twitter/hraven/datasource/JobHistoryService.java
JobHistoryService.getHbasePuts
public static List<Put> getHbasePuts(JobDesc jobDesc, Configuration jobConf) { """ Returns the HBase {@code Put} instances to store for the given {@code Configuration} data. Each configuration property will be stored as a separate key value. @param jobDesc the {@link JobDesc} generated for the job @param jobConf the job configuration @return puts for the given job configuration """ List<Put> puts = new LinkedList<Put>(); JobKey jobKey = new JobKey(jobDesc); byte[] jobKeyBytes = new JobKeyConverter().toBytes(jobKey); // Add all columns to one put Put jobPut = new Put(jobKeyBytes); jobPut.addColumn(Constants.INFO_FAM_BYTES, Constants.VERSION_COLUMN_BYTES, Bytes.toBytes(jobDesc.getVersion())); jobPut.addColumn(Constants.INFO_FAM_BYTES, Constants.FRAMEWORK_COLUMN_BYTES, Bytes.toBytes(jobDesc.getFramework().toString())); // Avoid doing string to byte conversion inside loop. byte[] jobConfColumnPrefix = Bytes.toBytes(Constants.JOB_CONF_COLUMN_PREFIX + Constants.SEP); // Create puts for all the parameters in the job configuration Iterator<Entry<String, String>> jobConfIterator = jobConf.iterator(); while (jobConfIterator.hasNext()) { Entry<String, String> entry = jobConfIterator.next(); // Prefix the job conf entry column with an indicator to byte[] column = Bytes.add(jobConfColumnPrefix, Bytes.toBytes(entry.getKey())); jobPut.addColumn(Constants.INFO_FAM_BYTES, column, Bytes.toBytes(entry.getValue())); } // ensure pool/queuename is set correctly setHravenQueueNamePut(jobConf, jobPut, jobKey, jobConfColumnPrefix); puts.add(jobPut); return puts; }
java
public static List<Put> getHbasePuts(JobDesc jobDesc, Configuration jobConf) { List<Put> puts = new LinkedList<Put>(); JobKey jobKey = new JobKey(jobDesc); byte[] jobKeyBytes = new JobKeyConverter().toBytes(jobKey); // Add all columns to one put Put jobPut = new Put(jobKeyBytes); jobPut.addColumn(Constants.INFO_FAM_BYTES, Constants.VERSION_COLUMN_BYTES, Bytes.toBytes(jobDesc.getVersion())); jobPut.addColumn(Constants.INFO_FAM_BYTES, Constants.FRAMEWORK_COLUMN_BYTES, Bytes.toBytes(jobDesc.getFramework().toString())); // Avoid doing string to byte conversion inside loop. byte[] jobConfColumnPrefix = Bytes.toBytes(Constants.JOB_CONF_COLUMN_PREFIX + Constants.SEP); // Create puts for all the parameters in the job configuration Iterator<Entry<String, String>> jobConfIterator = jobConf.iterator(); while (jobConfIterator.hasNext()) { Entry<String, String> entry = jobConfIterator.next(); // Prefix the job conf entry column with an indicator to byte[] column = Bytes.add(jobConfColumnPrefix, Bytes.toBytes(entry.getKey())); jobPut.addColumn(Constants.INFO_FAM_BYTES, column, Bytes.toBytes(entry.getValue())); } // ensure pool/queuename is set correctly setHravenQueueNamePut(jobConf, jobPut, jobKey, jobConfColumnPrefix); puts.add(jobPut); return puts; }
[ "public", "static", "List", "<", "Put", ">", "getHbasePuts", "(", "JobDesc", "jobDesc", ",", "Configuration", "jobConf", ")", "{", "List", "<", "Put", ">", "puts", "=", "new", "LinkedList", "<", "Put", ">", "(", ")", ";", "JobKey", "jobKey", "=", "new"...
Returns the HBase {@code Put} instances to store for the given {@code Configuration} data. Each configuration property will be stored as a separate key value. @param jobDesc the {@link JobDesc} generated for the job @param jobConf the job configuration @return puts for the given job configuration
[ "Returns", "the", "HBase", "{", "@code", "Put", "}", "instances", "to", "store", "for", "the", "given", "{", "@code", "Configuration", "}", "data", ".", "Each", "configuration", "property", "will", "be", "stored", "as", "a", "separate", "key", "value", "."...
train
https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-core/src/main/java/com/twitter/hraven/datasource/JobHistoryService.java#L740-L774
apache/spark
common/unsafe/src/main/java/org/apache/spark/unsafe/types/ByteArray.java
ByteArray.writeToMemory
public static void writeToMemory(byte[] src, Object target, long targetOffset) { """ Writes the content of a byte array into a memory address, identified by an object and an offset. The target memory address must already been allocated, and have enough space to hold all the bytes in this string. """ Platform.copyMemory(src, Platform.BYTE_ARRAY_OFFSET, target, targetOffset, src.length); }
java
public static void writeToMemory(byte[] src, Object target, long targetOffset) { Platform.copyMemory(src, Platform.BYTE_ARRAY_OFFSET, target, targetOffset, src.length); }
[ "public", "static", "void", "writeToMemory", "(", "byte", "[", "]", "src", ",", "Object", "target", ",", "long", "targetOffset", ")", "{", "Platform", ".", "copyMemory", "(", "src", ",", "Platform", ".", "BYTE_ARRAY_OFFSET", ",", "target", ",", "targetOffset...
Writes the content of a byte array into a memory address, identified by an object and an offset. The target memory address must already been allocated, and have enough space to hold all the bytes in this string.
[ "Writes", "the", "content", "of", "a", "byte", "array", "into", "a", "memory", "address", "identified", "by", "an", "object", "and", "an", "offset", ".", "The", "target", "memory", "address", "must", "already", "been", "allocated", "and", "have", "enough", ...
train
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/ByteArray.java#L35-L37
CenturyLinkCloud/mdw
mdw-common/src/com/centurylink/mdw/model/asset/AssetVersionSpec.java
AssetVersionSpec.parse
public static AssetVersionSpec parse(String versionSpec) { """ Smart Version Ranges: This is similar to the OSGi version spec. There are four supported syntaxes: - A specific version -- such as 1.2 -- can be specified. - Zero can be specified to always use the latest asset version. - A 'half-open' range -- such as [1.2,2) -- designates an inclusive lower limit and an exclusive upper limit, denoting version 1.2 and any version after this, up to, but not including, version 2.0. - An 'unbounded' version range -- such as [1.2 -- which denotes version 1.2 and all later versions. """ Matcher matcher = VERSION_PATTERN.matcher(versionSpec); String name = null; String ver = null; String pkg = null; if (matcher.find()) { int start = matcher.start(); ver = versionSpec.substring(start + 2); if (!ver.equals(VERSION_LATEST) && ver.indexOf('.') == -1 && Character.isDigit(ver.charAt(0))) ver = "0." + ver; name = versionSpec.substring(0, start); } else { name = versionSpec; // no version ver = VERSION_LATEST; } int slash = name.indexOf('/'); if (slash != -1) { pkg = name.substring(0, slash); name = name.substring(slash + 1); } return new AssetVersionSpec(pkg, name, ver); }
java
public static AssetVersionSpec parse(String versionSpec) { Matcher matcher = VERSION_PATTERN.matcher(versionSpec); String name = null; String ver = null; String pkg = null; if (matcher.find()) { int start = matcher.start(); ver = versionSpec.substring(start + 2); if (!ver.equals(VERSION_LATEST) && ver.indexOf('.') == -1 && Character.isDigit(ver.charAt(0))) ver = "0." + ver; name = versionSpec.substring(0, start); } else { name = versionSpec; // no version ver = VERSION_LATEST; } int slash = name.indexOf('/'); if (slash != -1) { pkg = name.substring(0, slash); name = name.substring(slash + 1); } return new AssetVersionSpec(pkg, name, ver); }
[ "public", "static", "AssetVersionSpec", "parse", "(", "String", "versionSpec", ")", "{", "Matcher", "matcher", "=", "VERSION_PATTERN", ".", "matcher", "(", "versionSpec", ")", ";", "String", "name", "=", "null", ";", "String", "ver", "=", "null", ";", "Strin...
Smart Version Ranges: This is similar to the OSGi version spec. There are four supported syntaxes: - A specific version -- such as 1.2 -- can be specified. - Zero can be specified to always use the latest asset version. - A 'half-open' range -- such as [1.2,2) -- designates an inclusive lower limit and an exclusive upper limit, denoting version 1.2 and any version after this, up to, but not including, version 2.0. - An 'unbounded' version range -- such as [1.2 -- which denotes version 1.2 and all later versions.
[ "Smart", "Version", "Ranges", ":", "This", "is", "similar", "to", "the", "OSGi", "version", "spec", ".", "There", "are", "four", "supported", "syntaxes", ":", "-", "A", "specific", "version", "--", "such", "as", "1", ".", "2", "--", "can", "be", "speci...
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/model/asset/AssetVersionSpec.java#L105-L128
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java
HadoopUtils.sanitizePath
public static String sanitizePath(String path, String substitute) { """ Remove illegal HDFS path characters from the given path. Illegal characters will be replaced with the given substitute. """ Preconditions.checkArgument(substitute.replaceAll(HDFS_ILLEGAL_TOKEN_REGEX, "").equals(substitute), "substitute contains illegal characters: " + substitute); return path.replaceAll(HDFS_ILLEGAL_TOKEN_REGEX, substitute); }
java
public static String sanitizePath(String path, String substitute) { Preconditions.checkArgument(substitute.replaceAll(HDFS_ILLEGAL_TOKEN_REGEX, "").equals(substitute), "substitute contains illegal characters: " + substitute); return path.replaceAll(HDFS_ILLEGAL_TOKEN_REGEX, substitute); }
[ "public", "static", "String", "sanitizePath", "(", "String", "path", ",", "String", "substitute", ")", "{", "Preconditions", ".", "checkArgument", "(", "substitute", ".", "replaceAll", "(", "HDFS_ILLEGAL_TOKEN_REGEX", ",", "\"\"", ")", ".", "equals", "(", "subst...
Remove illegal HDFS path characters from the given path. Illegal characters will be replaced with the given substitute.
[ "Remove", "illegal", "HDFS", "path", "characters", "from", "the", "given", "path", ".", "Illegal", "characters", "will", "be", "replaced", "with", "the", "given", "substitute", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java#L919-L924
minio/minio-java
api/src/main/java/io/minio/MinioClient.java
MinioClient.presignedPutObject
public String presignedPutObject(String bucketName, String objectName, Integer expires) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException, InvalidExpiresRangeException { """ Returns a presigned URL to upload an object in the bucket with given expiry time. </p><b>Example:</b><br> <pre>{@code String url = minioClient.presignedPutObject("my-bucketname", "my-objectname", 60 * 60 * 24); System.out.println(url); }</pre> @param bucketName Bucket name @param objectName Object name in the bucket @param expires Expiration time in seconds to presigned URL. @return string contains URL to upload the object. @throws InvalidBucketNameException upon invalid bucket name is given @throws NoSuchAlgorithmException upon requested algorithm was not found during signature calculation @throws InsufficientDataException upon getting EOFException while reading given InputStream even before reading given length @throws IOException upon connection error @throws InvalidKeyException upon an invalid access key or secret key @throws NoResponseException upon no response from server @throws XmlPullParserException upon parsing response xml @throws ErrorResponseException upon unsuccessful execution @throws InternalException upon internal library error @throws InvalidExpiresRangeException upon input expires is out of range """ return getPresignedObjectUrl(Method.PUT, bucketName, objectName, expires, null); }
java
public String presignedPutObject(String bucketName, String objectName, Integer expires) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException, InvalidExpiresRangeException { return getPresignedObjectUrl(Method.PUT, bucketName, objectName, expires, null); }
[ "public", "String", "presignedPutObject", "(", "String", "bucketName", ",", "String", "objectName", ",", "Integer", "expires", ")", "throws", "InvalidBucketNameException", ",", "NoSuchAlgorithmException", ",", "InsufficientDataException", ",", "IOException", ",", "Invalid...
Returns a presigned URL to upload an object in the bucket with given expiry time. </p><b>Example:</b><br> <pre>{@code String url = minioClient.presignedPutObject("my-bucketname", "my-objectname", 60 * 60 * 24); System.out.println(url); }</pre> @param bucketName Bucket name @param objectName Object name in the bucket @param expires Expiration time in seconds to presigned URL. @return string contains URL to upload the object. @throws InvalidBucketNameException upon invalid bucket name is given @throws NoSuchAlgorithmException upon requested algorithm was not found during signature calculation @throws InsufficientDataException upon getting EOFException while reading given InputStream even before reading given length @throws IOException upon connection error @throws InvalidKeyException upon an invalid access key or secret key @throws NoResponseException upon no response from server @throws XmlPullParserException upon parsing response xml @throws ErrorResponseException upon unsuccessful execution @throws InternalException upon internal library error @throws InvalidExpiresRangeException upon input expires is out of range
[ "Returns", "a", "presigned", "URL", "to", "upload", "an", "object", "in", "the", "bucket", "with", "given", "expiry", "time", "." ]
train
https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/MinioClient.java#L2506-L2511
SvenEwald/xmlbeam
src/main/java/org/xmlbeam/util/intern/duplex/DuplexExpression.java
DuplexExpression.getExpressionType
public ExpressionType getExpressionType() { """ Calculates the return type of the expression. @return ExpressionType """ try { //TODO: cache expression type ? final ExpressionType expressionType = node.firstChildAccept(new ExpressionTypeEvaluationVisitor(), null); return expressionType; } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Please report this bug: Can not determine type of XPath:" + xpath, e); } }
java
public ExpressionType getExpressionType() { try { //TODO: cache expression type ? final ExpressionType expressionType = node.firstChildAccept(new ExpressionTypeEvaluationVisitor(), null); return expressionType; } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Please report this bug: Can not determine type of XPath:" + xpath, e); } }
[ "public", "ExpressionType", "getExpressionType", "(", ")", "{", "try", "{", "//TODO: cache expression type ?", "final", "ExpressionType", "expressionType", "=", "node", ".", "firstChildAccept", "(", "new", "ExpressionTypeEvaluationVisitor", "(", ")", ",", "null", ")", ...
Calculates the return type of the expression. @return ExpressionType
[ "Calculates", "the", "return", "type", "of", "the", "expression", "." ]
train
https://github.com/SvenEwald/xmlbeam/blob/acaac1b8fa28d246f17187f5e3c6696458a0b447/src/main/java/org/xmlbeam/util/intern/duplex/DuplexExpression.java#L169-L176
Chorus-bdd/Chorus
interpreter/chorus-handlerconfig/src/main/java/org/chorusbdd/chorus/handlerconfig/HandlerConfigLoader.java
HandlerConfigLoader.loadPropertiesForSubGroup
public Properties loadPropertiesForSubGroup(ConfigurationManager configurationManager, String handlerPrefix, String groupName) { """ Get properties for a specific config, for a handler which maintains properties grouped by configNames Defaults may also be provided in a special default configName, defaults provide base values which may be overridden by those set at configName level. myHandler.config1.property1=val myHandler.config1.property2=val myHandler.config2.property1=val myHandler.config2.property2=val myHandler.default.property1=val """ PropertyOperations handlerProps = properties(loadProperties(configurationManager, handlerPrefix)); PropertyOperations defaultProps = handlerProps.filterByAndRemoveKeyPrefix(ChorusConstants.DEFAULT_PROPERTIES_GROUP + "."); PropertyOperations configProps = handlerProps.filterByAndRemoveKeyPrefix(groupName + "."); PropertyOperations merged = defaultProps.merge(configProps); return merged.loadProperties(); }
java
public Properties loadPropertiesForSubGroup(ConfigurationManager configurationManager, String handlerPrefix, String groupName) { PropertyOperations handlerProps = properties(loadProperties(configurationManager, handlerPrefix)); PropertyOperations defaultProps = handlerProps.filterByAndRemoveKeyPrefix(ChorusConstants.DEFAULT_PROPERTIES_GROUP + "."); PropertyOperations configProps = handlerProps.filterByAndRemoveKeyPrefix(groupName + "."); PropertyOperations merged = defaultProps.merge(configProps); return merged.loadProperties(); }
[ "public", "Properties", "loadPropertiesForSubGroup", "(", "ConfigurationManager", "configurationManager", ",", "String", "handlerPrefix", ",", "String", "groupName", ")", "{", "PropertyOperations", "handlerProps", "=", "properties", "(", "loadProperties", "(", "configuratio...
Get properties for a specific config, for a handler which maintains properties grouped by configNames Defaults may also be provided in a special default configName, defaults provide base values which may be overridden by those set at configName level. myHandler.config1.property1=val myHandler.config1.property2=val myHandler.config2.property1=val myHandler.config2.property2=val myHandler.default.property1=val
[ "Get", "properties", "for", "a", "specific", "config", "for", "a", "handler", "which", "maintains", "properties", "grouped", "by", "configNames" ]
train
https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-handlerconfig/src/main/java/org/chorusbdd/chorus/handlerconfig/HandlerConfigLoader.java#L65-L73
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/Item.java
Item.withDouble
public Item withDouble(String attrName, double val) { """ Sets the value of the specified attribute in the current item to the given value. """ checkInvalidAttrName(attrName); return withNumber(attrName, Double.valueOf(val)); }
java
public Item withDouble(String attrName, double val) { checkInvalidAttrName(attrName); return withNumber(attrName, Double.valueOf(val)); }
[ "public", "Item", "withDouble", "(", "String", "attrName", ",", "double", "val", ")", "{", "checkInvalidAttrName", "(", "attrName", ")", ";", "return", "withNumber", "(", "attrName", ",", "Double", ".", "valueOf", "(", "val", ")", ")", ";", "}" ]
Sets the value of the specified attribute in the current item to the given value.
[ "Sets", "the", "value", "of", "the", "specified", "attribute", "in", "the", "current", "item", "to", "the", "given", "value", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/Item.java#L323-L326
TouK/sputnik
src/main/java/pl/touk/sputnik/processor/sonar/SonarResultParser.java
SonarResultParser.getIssueFilePath
private String getIssueFilePath(String issueComponent, Map<String, Component> components) { """ Returns the path of the file linked to an issue created by Sonar. The path is relative to the folder where Sonar has been run. @param issueComponent "component" field in an issue. @param components information about all components. """ Component comp = components.get(issueComponent); String file = comp.path; if (!Strings.isNullOrEmpty(comp.moduleKey)) { String theKey = comp.moduleKey; while (!theKey.isEmpty()) { Component theChildComp = components.get(theKey); int p = theKey.lastIndexOf(":"); if (p > 0) { theKey = theKey.substring(0, p); } else { theKey = ""; } if (theChildComp != null && !Strings.isNullOrEmpty(theChildComp.path)) { file = theChildComp.path + '/' + file; } } } return file; }
java
private String getIssueFilePath(String issueComponent, Map<String, Component> components) { Component comp = components.get(issueComponent); String file = comp.path; if (!Strings.isNullOrEmpty(comp.moduleKey)) { String theKey = comp.moduleKey; while (!theKey.isEmpty()) { Component theChildComp = components.get(theKey); int p = theKey.lastIndexOf(":"); if (p > 0) { theKey = theKey.substring(0, p); } else { theKey = ""; } if (theChildComp != null && !Strings.isNullOrEmpty(theChildComp.path)) { file = theChildComp.path + '/' + file; } } } return file; }
[ "private", "String", "getIssueFilePath", "(", "String", "issueComponent", ",", "Map", "<", "String", ",", "Component", ">", "components", ")", "{", "Component", "comp", "=", "components", ".", "get", "(", "issueComponent", ")", ";", "String", "file", "=", "c...
Returns the path of the file linked to an issue created by Sonar. The path is relative to the folder where Sonar has been run. @param issueComponent "component" field in an issue. @param components information about all components.
[ "Returns", "the", "path", "of", "the", "file", "linked", "to", "an", "issue", "created", "by", "Sonar", ".", "The", "path", "is", "relative", "to", "the", "folder", "where", "Sonar", "has", "been", "run", "." ]
train
https://github.com/TouK/sputnik/blob/64569e603d8837e800e3b3797b604a6942a7b5c5/src/main/java/pl/touk/sputnik/processor/sonar/SonarResultParser.java#L117-L138
twilliamson/mogwee-logging
src/main/java/com/mogwee/logging/Logger.java
Logger.warnf
public final void warnf(String message, Object... args) { """ Logs a formatted message if WARN logging is enabled. @param message a <a href="http://download.oracle.com/javase/6/docs/api/java/util/Formatter.html#syntax">format string</a> @param args arguments referenced by the format specifiers in the format string. """ logf(Level.WARN, null, message, args); }
java
public final void warnf(String message, Object... args) { logf(Level.WARN, null, message, args); }
[ "public", "final", "void", "warnf", "(", "String", "message", ",", "Object", "...", "args", ")", "{", "logf", "(", "Level", ".", "WARN", ",", "null", ",", "message", ",", "args", ")", ";", "}" ]
Logs a formatted message if WARN logging is enabled. @param message a <a href="http://download.oracle.com/javase/6/docs/api/java/util/Formatter.html#syntax">format string</a> @param args arguments referenced by the format specifiers in the format string.
[ "Logs", "a", "formatted", "message", "if", "WARN", "logging", "is", "enabled", "." ]
train
https://github.com/twilliamson/mogwee-logging/blob/30b99c2649de455432d956a8f6a74316de4cd62c/src/main/java/com/mogwee/logging/Logger.java#L213-L216
playn/playn
core/src/playn/core/Texture.java
Texture.tile
public Tile tile (float x, float y, float width, float height) { """ Returns an instance that can be used to render a sub-region of this texture. """ final float tileX = x, tileY = y, tileWidth = width, tileHeight = height; return new Tile() { @Override public Texture texture () { return Texture.this; } @Override public float width () { return tileWidth; } @Override public float height () { return tileHeight; } @Override public float sx () { return tileX/displayWidth; } @Override public float sy () { return tileY/displayHeight; } @Override public float tx () { return (tileX+tileWidth)/displayHeight; } @Override public float ty () { return (tileY+tileWidth)/displayHeight; } @Override public void addToBatch (QuadBatch batch, int tint, AffineTransform tx, float x, float y, float width, float height) { batch.addQuad(texture(), tint, tx, x, y, width, height, tileX, tileY, tileWidth, tileHeight); } @Override public void addToBatch (QuadBatch batch, int tint, AffineTransform tx, float dx, float dy, float dw, float dh, float sx, float sy, float sw, float sh) { batch.addQuad(texture(), tint, tx, dx, dy, dw, dh, tileX+sx, tileY+sy, sw, sh); } }; }
java
public Tile tile (float x, float y, float width, float height) { final float tileX = x, tileY = y, tileWidth = width, tileHeight = height; return new Tile() { @Override public Texture texture () { return Texture.this; } @Override public float width () { return tileWidth; } @Override public float height () { return tileHeight; } @Override public float sx () { return tileX/displayWidth; } @Override public float sy () { return tileY/displayHeight; } @Override public float tx () { return (tileX+tileWidth)/displayHeight; } @Override public float ty () { return (tileY+tileWidth)/displayHeight; } @Override public void addToBatch (QuadBatch batch, int tint, AffineTransform tx, float x, float y, float width, float height) { batch.addQuad(texture(), tint, tx, x, y, width, height, tileX, tileY, tileWidth, tileHeight); } @Override public void addToBatch (QuadBatch batch, int tint, AffineTransform tx, float dx, float dy, float dw, float dh, float sx, float sy, float sw, float sh) { batch.addQuad(texture(), tint, tx, dx, dy, dw, dh, tileX+sx, tileY+sy, sw, sh); } }; }
[ "public", "Tile", "tile", "(", "float", "x", ",", "float", "y", ",", "float", "width", ",", "float", "height", ")", "{", "final", "float", "tileX", "=", "x", ",", "tileY", "=", "y", ",", "tileWidth", "=", "width", ",", "tileHeight", "=", "height", ...
Returns an instance that can be used to render a sub-region of this texture.
[ "Returns", "an", "instance", "that", "can", "be", "used", "to", "render", "a", "sub", "-", "region", "of", "this", "texture", "." ]
train
https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/Texture.java#L182-L202
jmrozanec/cron-utils
src/main/java/com/cronutils/model/time/TimeNode.java
TimeNode.getNearestBackwardValue
@VisibleForTesting NearestValue getNearestBackwardValue(final int reference, int shiftsToApply) { """ We return same reference value if matches or previous one if does not match. Then we start applying shifts. This way we ensure same value is returned if no shift is requested. @param reference - reference value @param shiftsToApply - shifts to apply @return NearestValue instance, never null. Holds information on nearest (backward) value and shifts performed. """ final List<Integer> temporaryValues = new ArrayList<>(this.values); Collections.reverse(temporaryValues); int index = 0; boolean foundSmaller = false; final AtomicInteger shift = new AtomicInteger(0); if (!temporaryValues.contains(reference)) { for (final Integer value : temporaryValues) { if (value < reference) { index = temporaryValues.indexOf(value); shiftsToApply--;//we just moved a position! foundSmaller = true; break; } } if (!foundSmaller) { shift.incrementAndGet(); } } else { index = temporaryValues.indexOf(reference); } int value = temporaryValues.get(index); for (int j = 0; j < shiftsToApply; j++) { value = getValueFromList(temporaryValues, index + 1, shift); index = temporaryValues.indexOf(value); } return new NearestValue(value, shift.get()); }
java
@VisibleForTesting NearestValue getNearestBackwardValue(final int reference, int shiftsToApply) { final List<Integer> temporaryValues = new ArrayList<>(this.values); Collections.reverse(temporaryValues); int index = 0; boolean foundSmaller = false; final AtomicInteger shift = new AtomicInteger(0); if (!temporaryValues.contains(reference)) { for (final Integer value : temporaryValues) { if (value < reference) { index = temporaryValues.indexOf(value); shiftsToApply--;//we just moved a position! foundSmaller = true; break; } } if (!foundSmaller) { shift.incrementAndGet(); } } else { index = temporaryValues.indexOf(reference); } int value = temporaryValues.get(index); for (int j = 0; j < shiftsToApply; j++) { value = getValueFromList(temporaryValues, index + 1, shift); index = temporaryValues.indexOf(value); } return new NearestValue(value, shift.get()); }
[ "@", "VisibleForTesting", "NearestValue", "getNearestBackwardValue", "(", "final", "int", "reference", ",", "int", "shiftsToApply", ")", "{", "final", "List", "<", "Integer", ">", "temporaryValues", "=", "new", "ArrayList", "<>", "(", "this", ".", "values", ")",...
We return same reference value if matches or previous one if does not match. Then we start applying shifts. This way we ensure same value is returned if no shift is requested. @param reference - reference value @param shiftsToApply - shifts to apply @return NearestValue instance, never null. Holds information on nearest (backward) value and shifts performed.
[ "We", "return", "same", "reference", "value", "if", "matches", "or", "previous", "one", "if", "does", "not", "match", ".", "Then", "we", "start", "applying", "shifts", ".", "This", "way", "we", "ensure", "same", "value", "is", "returned", "if", "no", "sh...
train
https://github.com/jmrozanec/cron-utils/blob/adac5ec8fd9160b082f9762a6eedea0715731170/src/main/java/com/cronutils/model/time/TimeNode.java#L91-L119
OpenLiberty/open-liberty
dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/ChecksumsManager.java
ChecksumsManager.saveChecksumFile
public static void saveChecksumFile(File csFile, Properties csprops, String reason) { """ Saves the checksum properties to csFile. @param csFile Output file @param csprops Checksum properties file @param reason the reason for saving the checksum file """ FileOutputStream fOut = null; try { fOut = new FileOutputStream(csFile); csprops.store(fOut, null); logger.log(Level.FINEST, "Successfully updated the checksum file " + csFile.getAbsolutePath() + reason); } catch (Exception e) { logger.log(Level.FINEST, "Failed to save checksum file " + csFile.getAbsolutePath() + reason, e); } finally { InstallUtils.close(fOut); } }
java
public static void saveChecksumFile(File csFile, Properties csprops, String reason) { FileOutputStream fOut = null; try { fOut = new FileOutputStream(csFile); csprops.store(fOut, null); logger.log(Level.FINEST, "Successfully updated the checksum file " + csFile.getAbsolutePath() + reason); } catch (Exception e) { logger.log(Level.FINEST, "Failed to save checksum file " + csFile.getAbsolutePath() + reason, e); } finally { InstallUtils.close(fOut); } }
[ "public", "static", "void", "saveChecksumFile", "(", "File", "csFile", ",", "Properties", "csprops", ",", "String", "reason", ")", "{", "FileOutputStream", "fOut", "=", "null", ";", "try", "{", "fOut", "=", "new", "FileOutputStream", "(", "csFile", ")", ";",...
Saves the checksum properties to csFile. @param csFile Output file @param csprops Checksum properties file @param reason the reason for saving the checksum file
[ "Saves", "the", "checksum", "properties", "to", "csFile", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/ChecksumsManager.java#L218-L229
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/naming/EJBJavaColonNamingHelper.java
EJBJavaColonNamingHelper.processJavaColonApp
private Object processJavaColonApp(String lookupName) throws NamingException { """ This method process lookup requests for java:app. @param appName Application name. @param lookupName JNDI lookup name. @param cmd Component metadata. @return the EJB object instance. @throws NamingException """ ComponentMetaData cmd = getComponentMetaData(JavaColonNamespace.APP, lookupName); ModuleMetaData mmd = cmd.getModuleMetaData(); ApplicationMetaData amd = mmd.getApplicationMetaData(); Lock readLock = javaColonLock.readLock(); readLock.lock(); EJBBinding binding = null; try { JavaColonNamespaceBindings<EJBBinding> appMap = getAppBindingMap(amd); if (appMap != null) { binding = appMap.lookup(lookupName); } } finally { readLock.unlock(); } return processJavaColon(binding, JavaColonNamespace.APP, lookupName); }
java
private Object processJavaColonApp(String lookupName) throws NamingException { ComponentMetaData cmd = getComponentMetaData(JavaColonNamespace.APP, lookupName); ModuleMetaData mmd = cmd.getModuleMetaData(); ApplicationMetaData amd = mmd.getApplicationMetaData(); Lock readLock = javaColonLock.readLock(); readLock.lock(); EJBBinding binding = null; try { JavaColonNamespaceBindings<EJBBinding> appMap = getAppBindingMap(amd); if (appMap != null) { binding = appMap.lookup(lookupName); } } finally { readLock.unlock(); } return processJavaColon(binding, JavaColonNamespace.APP, lookupName); }
[ "private", "Object", "processJavaColonApp", "(", "String", "lookupName", ")", "throws", "NamingException", "{", "ComponentMetaData", "cmd", "=", "getComponentMetaData", "(", "JavaColonNamespace", ".", "APP", ",", "lookupName", ")", ";", "ModuleMetaData", "mmd", "=", ...
This method process lookup requests for java:app. @param appName Application name. @param lookupName JNDI lookup name. @param cmd Component metadata. @return the EJB object instance. @throws NamingException
[ "This", "method", "process", "lookup", "requests", "for", "java", ":", "app", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/naming/EJBJavaColonNamingHelper.java#L198-L218
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.deleteRelationsFromResource
public void deleteRelationsFromResource(String resourceName, CmsRelationFilter filter) throws CmsException { """ Deletes the relations to a given resource.<p> @param resourceName the resource to delete the relations from @param filter the filter to use for deleting the relations @throws CmsException if something goes wrong """ CmsResource resource = readResource(resourceName, CmsResourceFilter.ALL); m_securityManager.deleteRelationsForResource(m_context, resource, filter); }
java
public void deleteRelationsFromResource(String resourceName, CmsRelationFilter filter) throws CmsException { CmsResource resource = readResource(resourceName, CmsResourceFilter.ALL); m_securityManager.deleteRelationsForResource(m_context, resource, filter); }
[ "public", "void", "deleteRelationsFromResource", "(", "String", "resourceName", ",", "CmsRelationFilter", "filter", ")", "throws", "CmsException", "{", "CmsResource", "resource", "=", "readResource", "(", "resourceName", ",", "CmsResourceFilter", ".", "ALL", ")", ";",...
Deletes the relations to a given resource.<p> @param resourceName the resource to delete the relations from @param filter the filter to use for deleting the relations @throws CmsException if something goes wrong
[ "Deletes", "the", "relations", "to", "a", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L1020-L1024
liferay/com-liferay-commerce
commerce-currency-api/src/main/java/com/liferay/commerce/currency/service/persistence/CommerceCurrencyUtil.java
CommerceCurrencyUtil.findByUUID_G
public static CommerceCurrency findByUUID_G(String uuid, long groupId) throws com.liferay.commerce.currency.exception.NoSuchCurrencyException { """ Returns the commerce currency where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchCurrencyException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching commerce currency @throws NoSuchCurrencyException if a matching commerce currency could not be found """ return getPersistence().findByUUID_G(uuid, groupId); }
java
public static CommerceCurrency findByUUID_G(String uuid, long groupId) throws com.liferay.commerce.currency.exception.NoSuchCurrencyException { return getPersistence().findByUUID_G(uuid, groupId); }
[ "public", "static", "CommerceCurrency", "findByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "com", ".", "liferay", ".", "commerce", ".", "currency", ".", "exception", ".", "NoSuchCurrencyException", "{", "return", "getPersistence", "(", ...
Returns the commerce currency where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchCurrencyException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching commerce currency @throws NoSuchCurrencyException if a matching commerce currency could not be found
[ "Returns", "the", "commerce", "currency", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchCurrencyException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-currency-api/src/main/java/com/liferay/commerce/currency/service/persistence/CommerceCurrencyUtil.java#L279-L282
javagl/CommonUI
src/main/java/de/javagl/common/ui/table/renderer/SortOrderTableHeaderCellRenderer.java
SortOrderTableHeaderCellRenderer.getSortOrder
private static SortOrder getSortOrder(JTable table, int column) { """ Returns the sort order of the specified column in the given table, or null if the column is not sorted @param table The table @param column The column @return The sort order """ List<? extends SortKey> sortKeys = table.getRowSorter().getSortKeys(); for (int i=0; i<sortKeys.size(); i++) { SortKey sortKey = sortKeys.get(i); if (sortKey.getColumn() == table.convertColumnIndexToModel(column)) { return sortKey.getSortOrder(); } } return null; }
java
private static SortOrder getSortOrder(JTable table, int column) { List<? extends SortKey> sortKeys = table.getRowSorter().getSortKeys(); for (int i=0; i<sortKeys.size(); i++) { SortKey sortKey = sortKeys.get(i); if (sortKey.getColumn() == table.convertColumnIndexToModel(column)) { return sortKey.getSortOrder(); } } return null; }
[ "private", "static", "SortOrder", "getSortOrder", "(", "JTable", "table", ",", "int", "column", ")", "{", "List", "<", "?", "extends", "SortKey", ">", "sortKeys", "=", "table", ".", "getRowSorter", "(", ")", ".", "getSortKeys", "(", ")", ";", "for", "(",...
Returns the sort order of the specified column in the given table, or null if the column is not sorted @param table The table @param column The column @return The sort order
[ "Returns", "the", "sort", "order", "of", "the", "specified", "column", "in", "the", "given", "table", "or", "null", "if", "the", "column", "is", "not", "sorted" ]
train
https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/table/renderer/SortOrderTableHeaderCellRenderer.java#L177-L189
CenturyLinkCloud/clc-java-sdk
sdk/src/main/java/com/centurylink/cloud/sdk/server/services/dsl/GroupService.java
GroupService.modify
public OperationFuture<List<Group>> modify(GroupFilter groupFilter, GroupConfig groupConfig) { """ Update provided list of groups @param groupFilter search criteria @param groupConfig group config @return OperationFuture wrapper for list of Group """ List<Group> groups = Arrays.asList(getRefsFromFilter(groupFilter)); return modify(groups, groupConfig); }
java
public OperationFuture<List<Group>> modify(GroupFilter groupFilter, GroupConfig groupConfig) { List<Group> groups = Arrays.asList(getRefsFromFilter(groupFilter)); return modify(groups, groupConfig); }
[ "public", "OperationFuture", "<", "List", "<", "Group", ">", ">", "modify", "(", "GroupFilter", "groupFilter", ",", "GroupConfig", "groupConfig", ")", "{", "List", "<", "Group", ">", "groups", "=", "Arrays", ".", "asList", "(", "getRefsFromFilter", "(", "gro...
Update provided list of groups @param groupFilter search criteria @param groupConfig group config @return OperationFuture wrapper for list of Group
[ "Update", "provided", "list", "of", "groups" ]
train
https://github.com/CenturyLinkCloud/clc-java-sdk/blob/c026322f077dea71b1acf9f2d665253d79d9bf85/sdk/src/main/java/com/centurylink/cloud/sdk/server/services/dsl/GroupService.java#L343-L347
intuit/QuickBooks-V3-Java-SDK
ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java
DataService.voidRequestAsync
public <T extends IEntity> void voidRequestAsync(T entity, CallbackHandler callbackHandler) throws FMSException { """ Method to cancel the operation for the corresponding entity in asynchronous fashion @param entity the entity @param callbackHandler the callback handler @throws FMSException """ IntuitMessage intuitMessage = prepareVoidRequest(entity); //set callback handler intuitMessage.getRequestElements().setCallbackHandler(callbackHandler); //execute async interceptors executeAsyncInterceptors(intuitMessage); }
java
public <T extends IEntity> void voidRequestAsync(T entity, CallbackHandler callbackHandler) throws FMSException { IntuitMessage intuitMessage = prepareVoidRequest(entity); //set callback handler intuitMessage.getRequestElements().setCallbackHandler(callbackHandler); //execute async interceptors executeAsyncInterceptors(intuitMessage); }
[ "public", "<", "T", "extends", "IEntity", ">", "void", "voidRequestAsync", "(", "T", "entity", ",", "CallbackHandler", "callbackHandler", ")", "throws", "FMSException", "{", "IntuitMessage", "intuitMessage", "=", "prepareVoidRequest", "(", "entity", ")", ";", "//s...
Method to cancel the operation for the corresponding entity in asynchronous fashion @param entity the entity @param callbackHandler the callback handler @throws FMSException
[ "Method", "to", "cancel", "the", "operation", "for", "the", "corresponding", "entity", "in", "asynchronous", "fashion" ]
train
https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java#L839-L848
stratosphere/stratosphere
stratosphere-addons/spargel/src/main/java/eu/stratosphere/spargel/java/VertexCentricIteration.java
VertexCentricIteration.addBroadcastSetForMessagingFunction
public void addBroadcastSetForMessagingFunction(String name, DataSet<?> data) { """ Adds a data set as a broadcast set to the messaging function. @param name The name under which the broadcast data is available in the messaging function. @param data The data set to be broadcasted. """ this.bcVarsMessaging.add(new Tuple2<String, DataSet<?>>(name, data)); }
java
public void addBroadcastSetForMessagingFunction(String name, DataSet<?> data) { this.bcVarsMessaging.add(new Tuple2<String, DataSet<?>>(name, data)); }
[ "public", "void", "addBroadcastSetForMessagingFunction", "(", "String", "name", ",", "DataSet", "<", "?", ">", "data", ")", "{", "this", ".", "bcVarsMessaging", ".", "add", "(", "new", "Tuple2", "<", "String", ",", "DataSet", "<", "?", ">", ">", "(", "na...
Adds a data set as a broadcast set to the messaging function. @param name The name under which the broadcast data is available in the messaging function. @param data The data set to be broadcasted.
[ "Adds", "a", "data", "set", "as", "a", "broadcast", "set", "to", "the", "messaging", "function", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-addons/spargel/src/main/java/eu/stratosphere/spargel/java/VertexCentricIteration.java#L180-L182
Alluxio/alluxio
job/server/src/main/java/alluxio/worker/job/task/TaskExecutorManager.java
TaskExecutorManager.executeTask
public synchronized void executeTask(long jobId, int taskId, JobConfig jobConfig, Serializable taskArgs, RunTaskContext context) { """ Executes the given task. @param jobId the job id @param taskId the task id @param jobConfig the job configuration @param taskArgs the arguments @param context the context of the worker """ Future<?> future = mTaskExecutionService .submit(new TaskExecutor(jobId, taskId, jobConfig, taskArgs, context, this)); Pair<Long, Integer> id = new Pair<>(jobId, taskId); mTaskFutures.put(id, future); TaskInfo.Builder taskInfo = TaskInfo.newBuilder(); taskInfo.setJobId(jobId); taskInfo.setTaskId(taskId); taskInfo.setStatus(Status.RUNNING); mUnfinishedTasks.put(id, taskInfo); mTaskUpdates.put(id, taskInfo.build()); LOG.info("Task {} for job {} started", taskId, jobId); }
java
public synchronized void executeTask(long jobId, int taskId, JobConfig jobConfig, Serializable taskArgs, RunTaskContext context) { Future<?> future = mTaskExecutionService .submit(new TaskExecutor(jobId, taskId, jobConfig, taskArgs, context, this)); Pair<Long, Integer> id = new Pair<>(jobId, taskId); mTaskFutures.put(id, future); TaskInfo.Builder taskInfo = TaskInfo.newBuilder(); taskInfo.setJobId(jobId); taskInfo.setTaskId(taskId); taskInfo.setStatus(Status.RUNNING); mUnfinishedTasks.put(id, taskInfo); mTaskUpdates.put(id, taskInfo.build()); LOG.info("Task {} for job {} started", taskId, jobId); }
[ "public", "synchronized", "void", "executeTask", "(", "long", "jobId", ",", "int", "taskId", ",", "JobConfig", "jobConfig", ",", "Serializable", "taskArgs", ",", "RunTaskContext", "context", ")", "{", "Future", "<", "?", ">", "future", "=", "mTaskExecutionServic...
Executes the given task. @param jobId the job id @param taskId the task id @param jobConfig the job configuration @param taskArgs the arguments @param context the context of the worker
[ "Executes", "the", "given", "task", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/job/server/src/main/java/alluxio/worker/job/task/TaskExecutorManager.java#L128-L141
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/pca/weightfunctions/ErfcStddevWeight.java
ErfcStddevWeight.getWeight
@Override public double getWeight(double distance, double max, double stddev) { """ Return Erfc weight, scaled by standard deviation. max is ignored. """ if(stddev <= 0) { return 1; } return NormalDistribution.erfc(MathUtil.SQRTHALF * distance / stddev); }
java
@Override public double getWeight(double distance, double max, double stddev) { if(stddev <= 0) { return 1; } return NormalDistribution.erfc(MathUtil.SQRTHALF * distance / stddev); }
[ "@", "Override", "public", "double", "getWeight", "(", "double", "distance", ",", "double", "max", ",", "double", "stddev", ")", "{", "if", "(", "stddev", "<=", "0", ")", "{", "return", "1", ";", "}", "return", "NormalDistribution", ".", "erfc", "(", "...
Return Erfc weight, scaled by standard deviation. max is ignored.
[ "Return", "Erfc", "weight", "scaled", "by", "standard", "deviation", ".", "max", "is", "ignored", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/pca/weightfunctions/ErfcStddevWeight.java#L39-L45
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/SubFileIntegrityHandler.java
SubFileIntegrityHandler.init
public void init(Record record, Record recSubFile, String strSubFile, boolean bRemoveSubRecords) { """ Constructor. @param record My owner (usually passed as null, and set on addListener in setOwner()). @param recordMain The main record to create a sub-query for. @param bRemoteSubRecords Remove sub-records on delete main? """ // For this to work right, the booking number field needs a listener to re-select this file whenever it changes super.init(record, null, recSubFile, true); m_strSubFile = strSubFile; m_bRemoveSubRecords = bRemoveSubRecords; }
java
public void init(Record record, Record recSubFile, String strSubFile, boolean bRemoveSubRecords) { // For this to work right, the booking number field needs a listener to re-select this file whenever it changes super.init(record, null, recSubFile, true); m_strSubFile = strSubFile; m_bRemoveSubRecords = bRemoveSubRecords; }
[ "public", "void", "init", "(", "Record", "record", ",", "Record", "recSubFile", ",", "String", "strSubFile", ",", "boolean", "bRemoveSubRecords", ")", "{", "// For this to work right, the booking number field needs a listener to re-select this file whenever it changes", "super", ...
Constructor. @param record My owner (usually passed as null, and set on addListener in setOwner()). @param recordMain The main record to create a sub-query for. @param bRemoteSubRecords Remove sub-records on delete main?
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/SubFileIntegrityHandler.java#L91-L97
RestComm/sip-servlets
sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java
FacebookRestClient.notifications_send
public void notifications_send(Collection<Integer> recipientIds, CharSequence notification) throws FacebookException, IOException { """ Send a notification message to the specified users on behalf of the logged-in user. @param recipientIds the user ids to which the message is to be sent. if empty, notification will be sent to logged-in user. @param notification the FBML to be displayed on the notifications page; only a stripped-down set of FBML tags that result in text and links is allowed @return a URL, possibly null, to which the user should be redirected to finalize the sending of the email @see <a href="http://wiki.developers.facebook.com/index.php/Notifications.sendEmail"> Developers Wiki: notifications.send</a> """ assert (null != notification); ArrayList<Pair<String, CharSequence>> args = new ArrayList<Pair<String, CharSequence>>(3); if (null != recipientIds && !recipientIds.isEmpty()) { args.add(new Pair<String, CharSequence>("to_ids", delimit(recipientIds))); } args.add(new Pair<String, CharSequence>("notification", notification)); this.callMethod(FacebookMethod.NOTIFICATIONS_SEND, args); }
java
public void notifications_send(Collection<Integer> recipientIds, CharSequence notification) throws FacebookException, IOException { assert (null != notification); ArrayList<Pair<String, CharSequence>> args = new ArrayList<Pair<String, CharSequence>>(3); if (null != recipientIds && !recipientIds.isEmpty()) { args.add(new Pair<String, CharSequence>("to_ids", delimit(recipientIds))); } args.add(new Pair<String, CharSequence>("notification", notification)); this.callMethod(FacebookMethod.NOTIFICATIONS_SEND, args); }
[ "public", "void", "notifications_send", "(", "Collection", "<", "Integer", ">", "recipientIds", ",", "CharSequence", "notification", ")", "throws", "FacebookException", ",", "IOException", "{", "assert", "(", "null", "!=", "notification", ")", ";", "ArrayList", "<...
Send a notification message to the specified users on behalf of the logged-in user. @param recipientIds the user ids to which the message is to be sent. if empty, notification will be sent to logged-in user. @param notification the FBML to be displayed on the notifications page; only a stripped-down set of FBML tags that result in text and links is allowed @return a URL, possibly null, to which the user should be redirected to finalize the sending of the email @see <a href="http://wiki.developers.facebook.com/index.php/Notifications.sendEmail"> Developers Wiki: notifications.send</a>
[ "Send", "a", "notification", "message", "to", "the", "specified", "users", "on", "behalf", "of", "the", "logged", "-", "in", "user", "." ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1156-L1165
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/conf/plugin/PluginConfig.java
PluginConfig.extendedKey
private static String extendedKey(Properties properties, String key) { """ For internal use only, please do not rely on this method. @return the environment specific configuration key. The original key will be returned if no prefixed configuration is specified for the current env. """ String extendedKey = extendedKey(key); return properties.containsKey(extendedKey) ? extendedKey : key; }
java
private static String extendedKey(Properties properties, String key) { String extendedKey = extendedKey(key); return properties.containsKey(extendedKey) ? extendedKey : key; }
[ "private", "static", "String", "extendedKey", "(", "Properties", "properties", ",", "String", "key", ")", "{", "String", "extendedKey", "=", "extendedKey", "(", "key", ")", ";", "return", "properties", ".", "containsKey", "(", "extendedKey", ")", "?", "extende...
For internal use only, please do not rely on this method. @return the environment specific configuration key. The original key will be returned if no prefixed configuration is specified for the current env.
[ "For", "internal", "use", "only", "please", "do", "not", "rely", "on", "this", "method", "." ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/conf/plugin/PluginConfig.java#L144-L147
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.freefax_serviceName_convertToVoicefax_GET
public OvhOrder freefax_serviceName_convertToVoicefax_GET(String serviceName, String billingAccount) throws IOException { """ Get prices and contracts information REST: GET /order/freefax/{serviceName}/convertToVoicefax @param billingAccount [required] The /telephony billing account you want your service to be attached to @param serviceName [required] Freefax number """ String qPath = "/order/freefax/{serviceName}/convertToVoicefax"; StringBuilder sb = path(qPath, serviceName); query(sb, "billingAccount", billingAccount); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder freefax_serviceName_convertToVoicefax_GET(String serviceName, String billingAccount) throws IOException { String qPath = "/order/freefax/{serviceName}/convertToVoicefax"; StringBuilder sb = path(qPath, serviceName); query(sb, "billingAccount", billingAccount); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "freefax_serviceName_convertToVoicefax_GET", "(", "String", "serviceName", ",", "String", "billingAccount", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/freefax/{serviceName}/convertToVoicefax\"", ";", "StringBuilder", "sb", "=", ...
Get prices and contracts information REST: GET /order/freefax/{serviceName}/convertToVoicefax @param billingAccount [required] The /telephony billing account you want your service to be attached to @param serviceName [required] Freefax number
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L956-L962
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/handler/ResourceBundlesHandlerImpl.java
ResourceBundlesHandlerImpl.joinAndStoreBundle
private void joinAndStoreBundle(JoinableResourceBundle bundle) { """ Joins the members of a bundle and stores it @param bundle the bundle @param the flag indicating if we should process the bundle or not """ BundleProcessingStatus status = new BundleProcessingStatus(BundleProcessingStatus.FILE_PROCESSING_TYPE, bundle, resourceHandler, config); JoinableResourceBundleContent store = null; // Process the bundle for searching variant if (needToSearchForVariantInPostProcess || hasVariantPostProcessor(bundle)) { status.setSearchingPostProcessorVariants(true); joinAndPostProcessBundle(bundle, status); // Process the bundles status.setSearchingPostProcessorVariants(false); Map<String, VariantSet> postProcessVariants = status.getPostProcessVariants(); if (!postProcessVariants.isEmpty()) { if (LOGGER.isDebugEnabled()) { LOGGER.debug( "Post process variants found for bundle " + bundle.getId() + ":" + postProcessVariants); } Map<String, VariantSet> newVariants = VariantUtils.concatVariants(bundle.getVariants(), postProcessVariants); bundle.setVariants(newVariants); joinAndPostProcessBundle(bundle, status); } } else { status.setSearchingPostProcessorVariants(false); joinAndPostProcessBundle(bundle, status); } // Store the collected resources as a single file, both in text and // gzip formats. store = joinAndPostprocessBundle(bundle, null, status); storeBundle(bundle.getId(), store); // Set the data hascode in the bundle, in case the prefix needs to // be generated initBundleDataHashcode(bundle, store, null); }
java
private void joinAndStoreBundle(JoinableResourceBundle bundle) { BundleProcessingStatus status = new BundleProcessingStatus(BundleProcessingStatus.FILE_PROCESSING_TYPE, bundle, resourceHandler, config); JoinableResourceBundleContent store = null; // Process the bundle for searching variant if (needToSearchForVariantInPostProcess || hasVariantPostProcessor(bundle)) { status.setSearchingPostProcessorVariants(true); joinAndPostProcessBundle(bundle, status); // Process the bundles status.setSearchingPostProcessorVariants(false); Map<String, VariantSet> postProcessVariants = status.getPostProcessVariants(); if (!postProcessVariants.isEmpty()) { if (LOGGER.isDebugEnabled()) { LOGGER.debug( "Post process variants found for bundle " + bundle.getId() + ":" + postProcessVariants); } Map<String, VariantSet> newVariants = VariantUtils.concatVariants(bundle.getVariants(), postProcessVariants); bundle.setVariants(newVariants); joinAndPostProcessBundle(bundle, status); } } else { status.setSearchingPostProcessorVariants(false); joinAndPostProcessBundle(bundle, status); } // Store the collected resources as a single file, both in text and // gzip formats. store = joinAndPostprocessBundle(bundle, null, status); storeBundle(bundle.getId(), store); // Set the data hascode in the bundle, in case the prefix needs to // be generated initBundleDataHashcode(bundle, store, null); }
[ "private", "void", "joinAndStoreBundle", "(", "JoinableResourceBundle", "bundle", ")", "{", "BundleProcessingStatus", "status", "=", "new", "BundleProcessingStatus", "(", "BundleProcessingStatus", ".", "FILE_PROCESSING_TYPE", ",", "bundle", ",", "resourceHandler", ",", "c...
Joins the members of a bundle and stores it @param bundle the bundle @param the flag indicating if we should process the bundle or not
[ "Joins", "the", "members", "of", "a", "bundle", "and", "stores", "it" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/handler/ResourceBundlesHandlerImpl.java#L1215-L1253
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/ZipChemCompProvider.java
ZipChemCompProvider.finder
static private File[] finder( String dirName, final String suffix) { """ Return File(s) in dirName that match suffix. @param dirName @param suffix @return """ if (null == dirName || null == suffix) { return null; } final File dir = new File(dirName); return dir.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String filename) { return filename.endsWith(suffix); } } ); }
java
static private File[] finder( String dirName, final String suffix){ if (null == dirName || null == suffix) { return null; } final File dir = new File(dirName); return dir.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String filename) { return filename.endsWith(suffix); } } ); }
[ "static", "private", "File", "[", "]", "finder", "(", "String", "dirName", ",", "final", "String", "suffix", ")", "{", "if", "(", "null", "==", "dirName", "||", "null", "==", "suffix", ")", "{", "return", "null", ";", "}", "final", "File", "dir", "="...
Return File(s) in dirName that match suffix. @param dirName @param suffix @return
[ "Return", "File", "(", "s", ")", "in", "dirName", "that", "match", "suffix", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/ZipChemCompProvider.java#L215-L226
shrinkwrap/shrinkwrap
impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/IOUtil.java
IOUtil.copyWithClose
public static void copyWithClose(InputStream input, OutputStream output) throws IOException { """ Copies the contents from an InputStream to an OutputStream and closes both streams. @param input @param output @throws IOException If a problem occurred during any I/O operations during the copy, but on closing the streams these will be ignored and logged at {@link Level#FINER} """ try { copy(input, output); } finally { try { input.close(); } catch (final IOException ignore) { if (log.isLoggable(Level.FINER)) { log.finer("Could not close stream due to: " + ignore.getMessage() + "; ignoring"); } } try { output.close(); } catch (final IOException ignore) { if (log.isLoggable(Level.FINER)) { log.finer("Could not close stream due to: " + ignore.getMessage() + "; ignoring"); } } } }
java
public static void copyWithClose(InputStream input, OutputStream output) throws IOException { try { copy(input, output); } finally { try { input.close(); } catch (final IOException ignore) { if (log.isLoggable(Level.FINER)) { log.finer("Could not close stream due to: " + ignore.getMessage() + "; ignoring"); } } try { output.close(); } catch (final IOException ignore) { if (log.isLoggable(Level.FINER)) { log.finer("Could not close stream due to: " + ignore.getMessage() + "; ignoring"); } } } }
[ "public", "static", "void", "copyWithClose", "(", "InputStream", "input", ",", "OutputStream", "output", ")", "throws", "IOException", "{", "try", "{", "copy", "(", "input", ",", "output", ")", ";", "}", "finally", "{", "try", "{", "input", ".", "close", ...
Copies the contents from an InputStream to an OutputStream and closes both streams. @param input @param output @throws IOException If a problem occurred during any I/O operations during the copy, but on closing the streams these will be ignored and logged at {@link Level#FINER}
[ "Copies", "the", "contents", "from", "an", "InputStream", "to", "an", "OutputStream", "and", "closes", "both", "streams", "." ]
train
https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/IOUtil.java#L202-L221
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java
SparkComputationGraph.doEvaluation
public IEvaluation[] doEvaluation(JavaRDD<String> data, int evalNumWorkers, int evalBatchSize, DataSetLoader loader, IEvaluation... emptyEvaluations) { """ Perform evaluation on serialized DataSet objects on disk, (potentially in any format), that are loaded using an {@link DataSetLoader}. @param data List of paths to the data (that can be loaded as / converted to DataSets) @param evalNumWorkers Number of workers to perform evaluation with. To reduce memory requirements and cache thrashing, it is common to set this to a lower value than the number of spark threads per JVM/executor @param evalBatchSize Batch size to use when performing evaluation @param loader Used to load DataSets from their paths @param emptyEvaluations Evaluations to perform @return Evaluation """ return doEvaluation(data, evalNumWorkers, evalBatchSize, loader, null, emptyEvaluations); }
java
public IEvaluation[] doEvaluation(JavaRDD<String> data, int evalNumWorkers, int evalBatchSize, DataSetLoader loader, IEvaluation... emptyEvaluations) { return doEvaluation(data, evalNumWorkers, evalBatchSize, loader, null, emptyEvaluations); }
[ "public", "IEvaluation", "[", "]", "doEvaluation", "(", "JavaRDD", "<", "String", ">", "data", ",", "int", "evalNumWorkers", ",", "int", "evalBatchSize", ",", "DataSetLoader", "loader", ",", "IEvaluation", "...", "emptyEvaluations", ")", "{", "return", "doEvalua...
Perform evaluation on serialized DataSet objects on disk, (potentially in any format), that are loaded using an {@link DataSetLoader}. @param data List of paths to the data (that can be loaded as / converted to DataSets) @param evalNumWorkers Number of workers to perform evaluation with. To reduce memory requirements and cache thrashing, it is common to set this to a lower value than the number of spark threads per JVM/executor @param evalBatchSize Batch size to use when performing evaluation @param loader Used to load DataSets from their paths @param emptyEvaluations Evaluations to perform @return Evaluation
[ "Perform", "evaluation", "on", "serialized", "DataSet", "objects", "on", "disk", "(", "potentially", "in", "any", "format", ")", "that", "are", "loaded", "using", "an", "{" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java#L881-L883
Netflix/astyanax
astyanax-core/src/main/java/com/netflix/astyanax/connectionpool/Host.java
Host.parsePortFromHostAndPort
public static int parsePortFromHostAndPort(String urlPort, int defaultPort) { """ Parse the port from a "hostname:port" formatted string @param urlPort @param defaultPort @return """ return urlPort.lastIndexOf(':') > 0 ? Integer.valueOf(urlPort.substring(urlPort.lastIndexOf(':') + 1, urlPort.length())) : defaultPort; }
java
public static int parsePortFromHostAndPort(String urlPort, int defaultPort) { return urlPort.lastIndexOf(':') > 0 ? Integer.valueOf(urlPort.substring(urlPort.lastIndexOf(':') + 1, urlPort.length())) : defaultPort; }
[ "public", "static", "int", "parsePortFromHostAndPort", "(", "String", "urlPort", ",", "int", "defaultPort", ")", "{", "return", "urlPort", ".", "lastIndexOf", "(", "'", "'", ")", ">", "0", "?", "Integer", ".", "valueOf", "(", "urlPort", ".", "substring", "...
Parse the port from a "hostname:port" formatted string @param urlPort @param defaultPort @return
[ "Parse", "the", "port", "from", "a", "hostname", ":", "port", "formatted", "string" ]
train
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-core/src/main/java/com/netflix/astyanax/connectionpool/Host.java#L118-L121
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/BaseLevel.java
BaseLevel.getClosestTopicByDBId
public SpecTopic getClosestTopicByDBId(final Integer DBId, final SpecNode callerNode, final boolean checkParentNode) { """ This function checks the levels nodes and child nodes to see if it can match a spec topic for a topic database id. @param DBId The topic database id @param callerNode The node that called this function so that it isn't rechecked @param checkParentNode If the function should check the levels parents as well @return The closest available SpecTopic that matches the DBId otherwise null. """ final SpecTopic retValue = super.getClosestTopicByDBId(DBId, callerNode, checkParentNode); if (retValue != null) { return retValue; } else { // Look up the metadata topics final ContentSpec contentSpec = getContentSpec(); for (final Node contentSpecNode : contentSpec.getNodes()) { if (contentSpecNode instanceof KeyValueNode && ((KeyValueNode) contentSpecNode).getValue() instanceof SpecTopic) { final SpecTopic childTopic = (SpecTopic) ((KeyValueNode) contentSpecNode).getValue(); if (childTopic.getDBId().equals(DBId)) { return childTopic; } } } return null; } }
java
public SpecTopic getClosestTopicByDBId(final Integer DBId, final SpecNode callerNode, final boolean checkParentNode) { final SpecTopic retValue = super.getClosestTopicByDBId(DBId, callerNode, checkParentNode); if (retValue != null) { return retValue; } else { // Look up the metadata topics final ContentSpec contentSpec = getContentSpec(); for (final Node contentSpecNode : contentSpec.getNodes()) { if (contentSpecNode instanceof KeyValueNode && ((KeyValueNode) contentSpecNode).getValue() instanceof SpecTopic) { final SpecTopic childTopic = (SpecTopic) ((KeyValueNode) contentSpecNode).getValue(); if (childTopic.getDBId().equals(DBId)) { return childTopic; } } } return null; } }
[ "public", "SpecTopic", "getClosestTopicByDBId", "(", "final", "Integer", "DBId", ",", "final", "SpecNode", "callerNode", ",", "final", "boolean", "checkParentNode", ")", "{", "final", "SpecTopic", "retValue", "=", "super", ".", "getClosestTopicByDBId", "(", "DBId", ...
This function checks the levels nodes and child nodes to see if it can match a spec topic for a topic database id. @param DBId The topic database id @param callerNode The node that called this function so that it isn't rechecked @param checkParentNode If the function should check the levels parents as well @return The closest available SpecTopic that matches the DBId otherwise null.
[ "This", "function", "checks", "the", "levels", "nodes", "and", "child", "nodes", "to", "see", "if", "it", "can", "match", "a", "spec", "topic", "for", "a", "topic", "database", "id", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/BaseLevel.java#L73-L91
aws/aws-sdk-java
aws-java-sdk-codestar/src/main/java/com/amazonaws/services/codestar/model/TagProjectRequest.java
TagProjectRequest.withTags
public TagProjectRequest withTags(java.util.Map<String, String> tags) { """ <p> The tags you want to add to the project. </p> @param tags The tags you want to add to the project. @return Returns a reference to this object so that method calls can be chained together. """ setTags(tags); return this; }
java
public TagProjectRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "TagProjectRequest", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> The tags you want to add to the project. </p> @param tags The tags you want to add to the project. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "tags", "you", "want", "to", "add", "to", "the", "project", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-codestar/src/main/java/com/amazonaws/services/codestar/model/TagProjectRequest.java#L116-L119
orbisgis/h2gis
postgis-jts/src/main/java/org/h2gis/postgis_jts/JtsBinaryParser.java
JtsBinaryParser.parseLineString
private LineString parseLineString(ValueGetter data, boolean haveZ, boolean haveM) { """ Parse the given {@link org.postgis.binary.ValueGetter} into a JTS {@link org.locationtech.jts.geom.LineString}. @param data {@link org.postgis.binary.ValueGetter} to parse. @param haveZ True if the {@link org.locationtech.jts.geom.LineString} has a Z component. @param haveM True if the {@link org.locationtech.jts.geom.LineString} has a M component. @return The parsed {@link org.locationtech.jts.geom.LineString}. """ return JtsGeometry.geofac.createLineString(this.parseCS(data, haveZ, haveM)); }
java
private LineString parseLineString(ValueGetter data, boolean haveZ, boolean haveM) { return JtsGeometry.geofac.createLineString(this.parseCS(data, haveZ, haveM)); }
[ "private", "LineString", "parseLineString", "(", "ValueGetter", "data", ",", "boolean", "haveZ", ",", "boolean", "haveM", ")", "{", "return", "JtsGeometry", ".", "geofac", ".", "createLineString", "(", "this", ".", "parseCS", "(", "data", ",", "haveZ", ",", ...
Parse the given {@link org.postgis.binary.ValueGetter} into a JTS {@link org.locationtech.jts.geom.LineString}. @param data {@link org.postgis.binary.ValueGetter} to parse. @param haveZ True if the {@link org.locationtech.jts.geom.LineString} has a Z component. @param haveM True if the {@link org.locationtech.jts.geom.LineString} has a M component. @return The parsed {@link org.locationtech.jts.geom.LineString}.
[ "Parse", "the", "given", "{", "@link", "org", ".", "postgis", ".", "binary", ".", "ValueGetter", "}", "into", "a", "JTS", "{", "@link", "org", ".", "locationtech", ".", "jts", ".", "geom", ".", "LineString", "}", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/postgis-jts/src/main/java/org/h2gis/postgis_jts/JtsBinaryParser.java#L253-L255
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java
Instance.setMetadata
public Operation setMetadata(Metadata metadata, OperationOption... options) { """ Sets the metadata for this instance. @return a zone operation if the set request was issued correctly, {@code null} if the instance was not found @throws ComputeException upon failure """ return compute.setMetadata(getInstanceId(), metadata, options); }
java
public Operation setMetadata(Metadata metadata, OperationOption... options) { return compute.setMetadata(getInstanceId(), metadata, options); }
[ "public", "Operation", "setMetadata", "(", "Metadata", "metadata", ",", "OperationOption", "...", "options", ")", "{", "return", "compute", ".", "setMetadata", "(", "getInstanceId", "(", ")", ",", "metadata", ",", "options", ")", ";", "}" ]
Sets the metadata for this instance. @return a zone operation if the set request was issued correctly, {@code null} if the instance was not found @throws ComputeException upon failure
[ "Sets", "the", "metadata", "for", "this", "instance", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java#L359-L361
sdl/odata
odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java
EntityDataModelUtil.checkIsEntityType
public static EntityType checkIsEntityType(Type type) { """ Checks if the specified OData type is an entity type and throws an exception if it is not. @param type The OData type. @return The OData type. @throws ODataSystemException If the OData type is not an entity type. """ if (!isEntityType(type)) { throw new ODataSystemException("An entity type is required, but '" + type.getFullyQualifiedName() + "' is not an entity type: " + type.getMetaType()); } return (EntityType) type; }
java
public static EntityType checkIsEntityType(Type type) { if (!isEntityType(type)) { throw new ODataSystemException("An entity type is required, but '" + type.getFullyQualifiedName() + "' is not an entity type: " + type.getMetaType()); } return (EntityType) type; }
[ "public", "static", "EntityType", "checkIsEntityType", "(", "Type", "type", ")", "{", "if", "(", "!", "isEntityType", "(", "type", ")", ")", "{", "throw", "new", "ODataSystemException", "(", "\"An entity type is required, but '\"", "+", "type", ".", "getFullyQuali...
Checks if the specified OData type is an entity type and throws an exception if it is not. @param type The OData type. @return The OData type. @throws ODataSystemException If the OData type is not an entity type.
[ "Checks", "if", "the", "specified", "OData", "type", "is", "an", "entity", "type", "and", "throws", "an", "exception", "if", "it", "is", "not", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java#L204-L210
Azure/azure-sdk-for-java
containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ManagedClustersInner.java
ManagedClustersInner.listClusterUserCredentials
public CredentialResultsInner listClusterUserCredentials(String resourceGroupName, String resourceName) { """ Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @param resourceGroupName The name of the resource group. @param resourceName The name of the managed cluster resource. @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 CredentialResultsInner object if successful. """ return listClusterUserCredentialsWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); }
java
public CredentialResultsInner listClusterUserCredentials(String resourceGroupName, String resourceName) { return listClusterUserCredentialsWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); }
[ "public", "CredentialResultsInner", "listClusterUserCredentials", "(", "String", "resourceGroupName", ",", "String", "resourceName", ")", "{", "return", "listClusterUserCredentialsWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ")", ".", "toBlocking", ...
Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @param resourceGroupName The name of the resource group. @param resourceName The name of the managed cluster resource. @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 CredentialResultsInner object if successful.
[ "Gets", "cluster", "user", "credential", "of", "a", "managed", "cluster", ".", "Gets", "cluster", "user", "credential", "of", "the", "managed", "cluster", "with", "a", "specified", "resource", "group", "and", "name", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ManagedClustersInner.java#L661-L663
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java
BugInstance.getProperty
public String getProperty(String name, String defaultValue) { """ Get value of given property, returning given default value if the property has not been set. @param name name of the property to get @param defaultValue default value to return if propery is not set @return the value of the named property, or the default value if the property has not been set """ String value = getProperty(name); return value != null ? value : defaultValue; }
java
public String getProperty(String name, String defaultValue) { String value = getProperty(name); return value != null ? value : defaultValue; }
[ "public", "String", "getProperty", "(", "String", "name", ",", "String", "defaultValue", ")", "{", "String", "value", "=", "getProperty", "(", "name", ")", ";", "return", "value", "!=", "null", "?", "value", ":", "defaultValue", ";", "}" ]
Get value of given property, returning given default value if the property has not been set. @param name name of the property to get @param defaultValue default value to return if propery is not set @return the value of the named property, or the default value if the property has not been set
[ "Get", "value", "of", "given", "property", "returning", "given", "default", "value", "if", "the", "property", "has", "not", "been", "set", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java#L688-L691
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.writeJpg
public static void writeJpg(Image image, OutputStream out) throws IORuntimeException { """ 写出图像为JPG格式 @param image {@link Image} @param out 写出到的目标流 @throws IORuntimeException IO异常 @since 4.0.10 """ write(image, IMAGE_TYPE_JPG, out); }
java
public static void writeJpg(Image image, OutputStream out) throws IORuntimeException { write(image, IMAGE_TYPE_JPG, out); }
[ "public", "static", "void", "writeJpg", "(", "Image", "image", ",", "OutputStream", "out", ")", "throws", "IORuntimeException", "{", "write", "(", "image", ",", "IMAGE_TYPE_JPG", ",", "out", ")", ";", "}" ]
写出图像为JPG格式 @param image {@link Image} @param out 写出到的目标流 @throws IORuntimeException IO异常 @since 4.0.10
[ "写出图像为JPG格式" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1377-L1379
eclipse/xtext-extras
org.eclipse.xtext.generator/xtend-gen/org/eclipse/xtext/generator/grammarAccess/GrammarAccess.java
GrammarAccess.toJavaIdentifier
public String toJavaIdentifier(final String text, final boolean uppercaseFirst) { """ Converts an arbitary string to a valid Java identifier. The string is split up along the the characters that are not valid as Java identifier. The first character of each segments is made upper case which leads to a camel-case style. @param text the string @param uppercaseFirst whether the first character of the returned identifier should be uppercase or lowercase @return the java identifier """ return GrammarAccessUtil.toJavaIdentifier(text, Boolean.valueOf(uppercaseFirst)); }
java
public String toJavaIdentifier(final String text, final boolean uppercaseFirst) { return GrammarAccessUtil.toJavaIdentifier(text, Boolean.valueOf(uppercaseFirst)); }
[ "public", "String", "toJavaIdentifier", "(", "final", "String", "text", ",", "final", "boolean", "uppercaseFirst", ")", "{", "return", "GrammarAccessUtil", ".", "toJavaIdentifier", "(", "text", ",", "Boolean", ".", "valueOf", "(", "uppercaseFirst", ")", ")", ";"...
Converts an arbitary string to a valid Java identifier. The string is split up along the the characters that are not valid as Java identifier. The first character of each segments is made upper case which leads to a camel-case style. @param text the string @param uppercaseFirst whether the first character of the returned identifier should be uppercase or lowercase @return the java identifier
[ "Converts", "an", "arbitary", "string", "to", "a", "valid", "Java", "identifier", ".", "The", "string", "is", "split", "up", "along", "the", "the", "characters", "that", "are", "not", "valid", "as", "Java", "identifier", ".", "The", "first", "character", "...
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.generator/xtend-gen/org/eclipse/xtext/generator/grammarAccess/GrammarAccess.java#L46-L48
lessthanoptimal/ejml
main/ejml-zdense/src/org/ejml/dense/row/MatrixFeatures_ZDRM.java
MatrixFeatures_ZDRM.isEquals
public static boolean isEquals(ZMatrixD1 a , ZMatrixD1 b , double tol ) { """ <p> Checks to see if each element in the two matrices are within tolerance of each other: tol &ge; |a<sub>ij</sub> - b<sub>ij</sub>|. <p> <p> NOTE: If any of the elements are not countable then false is returned.<br> NOTE: If a tolerance of zero is passed in this is equivalent to calling {@link #isEquals(ZMatrixD1, ZMatrixD1)} </p> @param a A matrix. Not modified. @param b A matrix. Not modified. @param tol How close to being identical each element needs to be. @return true if equals and false otherwise. """ if( a.numRows != b.numRows || a.numCols != b.numCols ) { return false; } if( tol == 0.0 ) return isEquals(a,b); final int length = a.getDataLength(); for( int i = 0; i < length; i++ ) { if( !(tol >= Math.abs(a.data[i] - b.data[i])) ) { return false; } } return true; }
java
public static boolean isEquals(ZMatrixD1 a , ZMatrixD1 b , double tol ) { if( a.numRows != b.numRows || a.numCols != b.numCols ) { return false; } if( tol == 0.0 ) return isEquals(a,b); final int length = a.getDataLength(); for( int i = 0; i < length; i++ ) { if( !(tol >= Math.abs(a.data[i] - b.data[i])) ) { return false; } } return true; }
[ "public", "static", "boolean", "isEquals", "(", "ZMatrixD1", "a", ",", "ZMatrixD1", "b", ",", "double", "tol", ")", "{", "if", "(", "a", ".", "numRows", "!=", "b", ".", "numRows", "||", "a", ".", "numCols", "!=", "b", ".", "numCols", ")", "{", "ret...
<p> Checks to see if each element in the two matrices are within tolerance of each other: tol &ge; |a<sub>ij</sub> - b<sub>ij</sub>|. <p> <p> NOTE: If any of the elements are not countable then false is returned.<br> NOTE: If a tolerance of zero is passed in this is equivalent to calling {@link #isEquals(ZMatrixD1, ZMatrixD1)} </p> @param a A matrix. Not modified. @param b A matrix. Not modified. @param tol How close to being identical each element needs to be. @return true if equals and false otherwise.
[ "<p", ">", "Checks", "to", "see", "if", "each", "element", "in", "the", "two", "matrices", "are", "within", "tolerance", "of", "each", "other", ":", "tol", "&ge", ";", "|a<sub", ">", "ij<", "/", "sub", ">", "-", "b<sub", ">", "ij<", "/", "sub", ">"...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/MatrixFeatures_ZDRM.java#L154-L171
micronaut-projects/micronaut-core
cli/src/main/groovy/io/micronaut/cli/io/support/AntPathMatcher.java
AntPathMatcher.matchStrings
private boolean matchStrings(String pattern, String str, Map<String, String> uriTemplateVariables) { """ Tests whether or not a string matches against a pattern. The pattern may contain two special characters:<br> '*' means zero or more characters<br> '?' means one and only one character @param pattern pattern to match against. Must not be <code>null</code>. @param str string which must be matched against the pattern. Must not be <code>null</code>. @return <code>true</code> if the string matches against the pattern, or <code>false</code> otherwise. """ AntPathStringMatcher matcher = new AntPathStringMatcher(pattern, str, uriTemplateVariables); return matcher.matchStrings(); }
java
private boolean matchStrings(String pattern, String str, Map<String, String> uriTemplateVariables) { AntPathStringMatcher matcher = new AntPathStringMatcher(pattern, str, uriTemplateVariables); return matcher.matchStrings(); }
[ "private", "boolean", "matchStrings", "(", "String", "pattern", ",", "String", "str", ",", "Map", "<", "String", ",", "String", ">", "uriTemplateVariables", ")", "{", "AntPathStringMatcher", "matcher", "=", "new", "AntPathStringMatcher", "(", "pattern", ",", "st...
Tests whether or not a string matches against a pattern. The pattern may contain two special characters:<br> '*' means zero or more characters<br> '?' means one and only one character @param pattern pattern to match against. Must not be <code>null</code>. @param str string which must be matched against the pattern. Must not be <code>null</code>. @return <code>true</code> if the string matches against the pattern, or <code>false</code> otherwise.
[ "Tests", "whether", "or", "not", "a", "string", "matches", "against", "a", "pattern", ".", "The", "pattern", "may", "contain", "two", "special", "characters", ":", "<br", ">", "*", "means", "zero", "or", "more", "characters<br", ">", "?", "means", "one", ...
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/cli/src/main/groovy/io/micronaut/cli/io/support/AntPathMatcher.java#L243-L246
drallgood/jpasskit
jpasskit/src/main/java/de/brendamour/jpasskit/signing/PKSigningInformationUtil.java
PKSigningInformationUtil.loadSigningInformationFromPKCS12AndIntermediateCertificate
public PKSigningInformation loadSigningInformationFromPKCS12AndIntermediateCertificate(final String keyPath,final String keyPassword, final String appleWWDRCAFilePath) throws IOException, CertificateException { """ Load all signing information necessary for pass generation from the filesystem or classpath. @param keyPath path to keystore (classpath or filesystem) @param keyPassword Password used to access the key store @param appleWWDRCAFilePath path to apple's WWDRCA certificate file (classpath or filesystem) @return a {@link PKSigningInformation} object filled with all certificates from the provided files @throws IOException @throws IllegalStateException @throws CertificateException """ try (InputStream walletCertStream = CertUtils.toInputStream(keyPath); InputStream appleWWDRCertStream = CertUtils.toInputStream(appleWWDRCAFilePath)) { KeyStore pkcs12KeyStore = loadPKCS12File(walletCertStream, keyPassword); X509Certificate appleWWDRCert = loadDERCertificate(appleWWDRCertStream); return loadSigningInformation(pkcs12KeyStore, keyPassword, appleWWDRCert); } }
java
public PKSigningInformation loadSigningInformationFromPKCS12AndIntermediateCertificate(final String keyPath,final String keyPassword, final String appleWWDRCAFilePath) throws IOException, CertificateException { try (InputStream walletCertStream = CertUtils.toInputStream(keyPath); InputStream appleWWDRCertStream = CertUtils.toInputStream(appleWWDRCAFilePath)) { KeyStore pkcs12KeyStore = loadPKCS12File(walletCertStream, keyPassword); X509Certificate appleWWDRCert = loadDERCertificate(appleWWDRCertStream); return loadSigningInformation(pkcs12KeyStore, keyPassword, appleWWDRCert); } }
[ "public", "PKSigningInformation", "loadSigningInformationFromPKCS12AndIntermediateCertificate", "(", "final", "String", "keyPath", ",", "final", "String", "keyPassword", ",", "final", "String", "appleWWDRCAFilePath", ")", "throws", "IOException", ",", "CertificateException", ...
Load all signing information necessary for pass generation from the filesystem or classpath. @param keyPath path to keystore (classpath or filesystem) @param keyPassword Password used to access the key store @param appleWWDRCAFilePath path to apple's WWDRCA certificate file (classpath or filesystem) @return a {@link PKSigningInformation} object filled with all certificates from the provided files @throws IOException @throws IllegalStateException @throws CertificateException
[ "Load", "all", "signing", "information", "necessary", "for", "pass", "generation", "from", "the", "filesystem", "or", "classpath", "." ]
train
https://github.com/drallgood/jpasskit/blob/63bfa8abbdb85c2d7596c60eed41ed8e374cbd01/jpasskit/src/main/java/de/brendamour/jpasskit/signing/PKSigningInformationUtil.java#L68-L79
rometools/rome-certiorem
src/main/java/com/rometools/certiorem/hub/Hub.java
Hub.sendNotification
public void sendNotification(final String requestHost, final String topic) { """ Sends a notification to the subscribers @param requestHost the host name the hub is running on. (Used for the user agent) @param topic the URL of the topic that was updated. @throws HttpStatusCodeException a wrapper exception with a recommended status code for the request. """ // FIXME assert should not be used for validation because it can be disabled assert validTopics.isEmpty() || validTopics.contains(topic) : "That topic is not supported by this hub. " + topic; LOG.debug("Sending notification for {}", topic); try { final List<? extends Subscriber> subscribers = dao.subscribersForTopic(topic); if (subscribers.isEmpty()) { LOG.debug("No subscribers to notify for {}", topic); return; } final List<? extends SubscriptionSummary> summaries = dao.summariesForTopic(topic); int total = 0; final StringBuilder hosts = new StringBuilder(); for (final SubscriptionSummary s : summaries) { if (s.getSubscribers() > 0) { total += s.getSubscribers(); hosts.append(" (").append(s.getHost()).append("; ").append(s.getSubscribers()).append(" subscribers)"); } } final StringBuilder userAgent = new StringBuilder("ROME-Certiorem (+http://").append(requestHost).append("; ").append(total) .append(" subscribers)").append(hosts); final SyndFeed feed = fetcher.retrieveFeed(userAgent.toString(), new URL(topic)); LOG.debug("Got feed for {} Sending to {} subscribers.", topic, subscribers.size()); notifier.notifySubscribers(subscribers, feed, new SubscriptionSummaryCallback() { @Override public void onSummaryInfo(final SubscriptionSummary summary) { dao.handleSummary(topic, summary); } }); } catch (final Exception ex) { LOG.debug("Exception getting " + topic, ex); throw new HttpStatusCodeException(500, ex.getMessage(), ex); } }
java
public void sendNotification(final String requestHost, final String topic) { // FIXME assert should not be used for validation because it can be disabled assert validTopics.isEmpty() || validTopics.contains(topic) : "That topic is not supported by this hub. " + topic; LOG.debug("Sending notification for {}", topic); try { final List<? extends Subscriber> subscribers = dao.subscribersForTopic(topic); if (subscribers.isEmpty()) { LOG.debug("No subscribers to notify for {}", topic); return; } final List<? extends SubscriptionSummary> summaries = dao.summariesForTopic(topic); int total = 0; final StringBuilder hosts = new StringBuilder(); for (final SubscriptionSummary s : summaries) { if (s.getSubscribers() > 0) { total += s.getSubscribers(); hosts.append(" (").append(s.getHost()).append("; ").append(s.getSubscribers()).append(" subscribers)"); } } final StringBuilder userAgent = new StringBuilder("ROME-Certiorem (+http://").append(requestHost).append("; ").append(total) .append(" subscribers)").append(hosts); final SyndFeed feed = fetcher.retrieveFeed(userAgent.toString(), new URL(topic)); LOG.debug("Got feed for {} Sending to {} subscribers.", topic, subscribers.size()); notifier.notifySubscribers(subscribers, feed, new SubscriptionSummaryCallback() { @Override public void onSummaryInfo(final SubscriptionSummary summary) { dao.handleSummary(topic, summary); } }); } catch (final Exception ex) { LOG.debug("Exception getting " + topic, ex); throw new HttpStatusCodeException(500, ex.getMessage(), ex); } }
[ "public", "void", "sendNotification", "(", "final", "String", "requestHost", ",", "final", "String", "topic", ")", "{", "// FIXME assert should not be used for validation because it can be disabled", "assert", "validTopics", ".", "isEmpty", "(", ")", "||", "validTopics", ...
Sends a notification to the subscribers @param requestHost the host name the hub is running on. (Used for the user agent) @param topic the URL of the topic that was updated. @throws HttpStatusCodeException a wrapper exception with a recommended status code for the request.
[ "Sends", "a", "notification", "to", "the", "subscribers" ]
train
https://github.com/rometools/rome-certiorem/blob/e5a003193dd2abd748e77961c0f216a7f5690712/src/main/java/com/rometools/certiorem/hub/Hub.java#L125-L162
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.serviceName_pca_pcaServiceName_sessions_sessionId_files_GET
public ArrayList<String> serviceName_pca_pcaServiceName_sessions_sessionId_files_GET(String serviceName, String pcaServiceName, String sessionId, String name) throws IOException { """ cloud archives files in session REST: GET /cloud/{serviceName}/pca/{pcaServiceName}/sessions/{sessionId}/files @param name [required] Filter the value of name property (like) @param serviceName [required] The internal name of your public cloud passport @param pcaServiceName [required] The internal name of your PCA offer @param sessionId [required] Session ID @deprecated """ String qPath = "/cloud/{serviceName}/pca/{pcaServiceName}/sessions/{sessionId}/files"; StringBuilder sb = path(qPath, serviceName, pcaServiceName, sessionId); query(sb, "name", name); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<String> serviceName_pca_pcaServiceName_sessions_sessionId_files_GET(String serviceName, String pcaServiceName, String sessionId, String name) throws IOException { String qPath = "/cloud/{serviceName}/pca/{pcaServiceName}/sessions/{sessionId}/files"; StringBuilder sb = path(qPath, serviceName, pcaServiceName, sessionId); query(sb, "name", name); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "String", ">", "serviceName_pca_pcaServiceName_sessions_sessionId_files_GET", "(", "String", "serviceName", ",", "String", "pcaServiceName", ",", "String", "sessionId", ",", "String", "name", ")", "throws", "IOException", "{", "String", "qPat...
cloud archives files in session REST: GET /cloud/{serviceName}/pca/{pcaServiceName}/sessions/{sessionId}/files @param name [required] Filter the value of name property (like) @param serviceName [required] The internal name of your public cloud passport @param pcaServiceName [required] The internal name of your PCA offer @param sessionId [required] Session ID @deprecated
[ "cloud", "archives", "files", "in", "session" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L2532-L2538
JOML-CI/JOML
src/org/joml/Matrix4x3f.java
Matrix4x3f.rotateLocalZ
public Matrix4x3f rotateLocalZ(float ang, Matrix4x3f dest) { """ Pre-multiply a rotation around the Z axis to this matrix by rotating the given amount of radians about the Z axis and store the result in <code>dest</code>. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>R * M</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>R * M * v</code>, the rotation will be applied last! <p> In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use {@link #rotationZ(float) rotationZ()}. <p> Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle">http://en.wikipedia.org</a> @see #rotationZ(float) @param ang the angle in radians to rotate about the Z axis @param dest will hold the result @return dest """ float sin = (float) Math.sin(ang); float cos = (float) Math.cosFromSin(sin, ang); float nm00 = cos * m00 - sin * m01; float nm01 = sin * m00 + cos * m01; float nm10 = cos * m10 - sin * m11; float nm11 = sin * m10 + cos * m11; float nm20 = cos * m20 - sin * m21; float nm21 = sin * m20 + cos * m21; float nm30 = cos * m30 - sin * m31; float nm31 = sin * m30 + cos * m31; dest._m00(nm00); dest._m01(nm01); dest._m02(m02); dest._m10(nm10); dest._m11(nm11); dest._m12(m12); dest._m20(nm20); dest._m21(nm21); dest._m22(m22); dest._m30(nm30); dest._m31(nm31); dest._m32(m32); dest.properties = properties & ~(PROPERTY_IDENTITY | PROPERTY_TRANSLATION); return dest; }
java
public Matrix4x3f rotateLocalZ(float ang, Matrix4x3f dest) { float sin = (float) Math.sin(ang); float cos = (float) Math.cosFromSin(sin, ang); float nm00 = cos * m00 - sin * m01; float nm01 = sin * m00 + cos * m01; float nm10 = cos * m10 - sin * m11; float nm11 = sin * m10 + cos * m11; float nm20 = cos * m20 - sin * m21; float nm21 = sin * m20 + cos * m21; float nm30 = cos * m30 - sin * m31; float nm31 = sin * m30 + cos * m31; dest._m00(nm00); dest._m01(nm01); dest._m02(m02); dest._m10(nm10); dest._m11(nm11); dest._m12(m12); dest._m20(nm20); dest._m21(nm21); dest._m22(m22); dest._m30(nm30); dest._m31(nm31); dest._m32(m32); dest.properties = properties & ~(PROPERTY_IDENTITY | PROPERTY_TRANSLATION); return dest; }
[ "public", "Matrix4x3f", "rotateLocalZ", "(", "float", "ang", ",", "Matrix4x3f", "dest", ")", "{", "float", "sin", "=", "(", "float", ")", "Math", ".", "sin", "(", "ang", ")", ";", "float", "cos", "=", "(", "float", ")", "Math", ".", "cosFromSin", "("...
Pre-multiply a rotation around the Z axis to this matrix by rotating the given amount of radians about the Z axis and store the result in <code>dest</code>. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>R * M</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>R * M * v</code>, the rotation will be applied last! <p> In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use {@link #rotationZ(float) rotationZ()}. <p> Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle">http://en.wikipedia.org</a> @see #rotationZ(float) @param ang the angle in radians to rotate about the Z axis @param dest will hold the result @return dest
[ "Pre", "-", "multiply", "a", "rotation", "around", "the", "Z", "axis", "to", "this", "matrix", "by", "rotating", "the", "given", "amount", "of", "radians", "about", "the", "Z", "axis", "and", "store", "the", "result", "in", "<code", ">", "dest<", "/", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L4404-L4429
Azure/azure-sdk-for-java
network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/NetworkSecurityGroupsInner.java
NetworkSecurityGroupsInner.createOrUpdateAsync
public Observable<NetworkSecurityGroupInner> createOrUpdateAsync(String resourceGroupName, String networkSecurityGroupName, NetworkSecurityGroupInner parameters) { """ Creates or updates a network security group in the specified resource group. @param resourceGroupName The name of the resource group. @param networkSecurityGroupName The name of the network security group. @param parameters Parameters supplied to the create or update network security group operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, networkSecurityGroupName, parameters).map(new Func1<ServiceResponse<NetworkSecurityGroupInner>, NetworkSecurityGroupInner>() { @Override public NetworkSecurityGroupInner call(ServiceResponse<NetworkSecurityGroupInner> response) { return response.body(); } }); }
java
public Observable<NetworkSecurityGroupInner> createOrUpdateAsync(String resourceGroupName, String networkSecurityGroupName, NetworkSecurityGroupInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, networkSecurityGroupName, parameters).map(new Func1<ServiceResponse<NetworkSecurityGroupInner>, NetworkSecurityGroupInner>() { @Override public NetworkSecurityGroupInner call(ServiceResponse<NetworkSecurityGroupInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "NetworkSecurityGroupInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "networkSecurityGroupName", ",", "NetworkSecurityGroupInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "("...
Creates or updates a network security group in the specified resource group. @param resourceGroupName The name of the resource group. @param networkSecurityGroupName The name of the network security group. @param parameters Parameters supplied to the create or update network security group operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "or", "updates", "a", "network", "security", "group", "in", "the", "specified", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/NetworkSecurityGroupsInner.java#L471-L478
facebook/fresco
imagepipeline/src/main/java/com/facebook/imagepipeline/platform/GingerbreadPurgeableDecoder.java
GingerbreadPurgeableDecoder.decodeJPEGByteArrayAsPurgeable
@Override protected Bitmap decodeJPEGByteArrayAsPurgeable( CloseableReference<PooledByteBuffer> bytesRef, int length, BitmapFactory.Options options) { """ Decodes a byteArray containing jpeg encoded bytes into a purgeable bitmap <p>Adds a JFIF End-Of-Image marker if needed before decoding. @param bytesRef the byte buffer that contains the encoded bytes @param length the length of bytes for decox @param options the options passed to the BitmapFactory @return the decoded bitmap """ byte[] suffix = endsWithEOI(bytesRef, length) ? null : EOI; return decodeFileDescriptorAsPurgeable(bytesRef, length, suffix, options); }
java
@Override protected Bitmap decodeJPEGByteArrayAsPurgeable( CloseableReference<PooledByteBuffer> bytesRef, int length, BitmapFactory.Options options) { byte[] suffix = endsWithEOI(bytesRef, length) ? null : EOI; return decodeFileDescriptorAsPurgeable(bytesRef, length, suffix, options); }
[ "@", "Override", "protected", "Bitmap", "decodeJPEGByteArrayAsPurgeable", "(", "CloseableReference", "<", "PooledByteBuffer", ">", "bytesRef", ",", "int", "length", ",", "BitmapFactory", ".", "Options", "options", ")", "{", "byte", "[", "]", "suffix", "=", "endsWi...
Decodes a byteArray containing jpeg encoded bytes into a purgeable bitmap <p>Adds a JFIF End-Of-Image marker if needed before decoding. @param bytesRef the byte buffer that contains the encoded bytes @param length the length of bytes for decox @param options the options passed to the BitmapFactory @return the decoded bitmap
[ "Decodes", "a", "byteArray", "containing", "jpeg", "encoded", "bytes", "into", "a", "purgeable", "bitmap" ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/platform/GingerbreadPurgeableDecoder.java#L71-L76
apache/incubator-gobblin
gobblin-core/src/main/java/org/apache/gobblin/writer/initializer/WriterInitializerFactory.java
WriterInitializerFactory.newInstace
public static WriterInitializer newInstace(State state, WorkUnitStream workUnits) { """ Provides WriterInitializer based on the writer. Mostly writer is decided by the Writer builder (and destination) that user passes. If there's more than one branch, it will instantiate same number of WriterInitializer instance as number of branches and combine it into MultiWriterInitializer. @param state @return WriterInitializer """ int branches = state.getPropAsInt(ConfigurationKeys.FORK_BRANCHES_KEY, 1); if (branches == 1) { return newSingleInstance(state, workUnits, branches, 0); } List<WriterInitializer> wis = Lists.newArrayList(); for (int branchId = 0; branchId < branches; branchId++) { wis.add(newSingleInstance(state, workUnits, branches, branchId)); } return new MultiWriterInitializer(wis); }
java
public static WriterInitializer newInstace(State state, WorkUnitStream workUnits) { int branches = state.getPropAsInt(ConfigurationKeys.FORK_BRANCHES_KEY, 1); if (branches == 1) { return newSingleInstance(state, workUnits, branches, 0); } List<WriterInitializer> wis = Lists.newArrayList(); for (int branchId = 0; branchId < branches; branchId++) { wis.add(newSingleInstance(state, workUnits, branches, branchId)); } return new MultiWriterInitializer(wis); }
[ "public", "static", "WriterInitializer", "newInstace", "(", "State", "state", ",", "WorkUnitStream", "workUnits", ")", "{", "int", "branches", "=", "state", ".", "getPropAsInt", "(", "ConfigurationKeys", ".", "FORK_BRANCHES_KEY", ",", "1", ")", ";", "if", "(", ...
Provides WriterInitializer based on the writer. Mostly writer is decided by the Writer builder (and destination) that user passes. If there's more than one branch, it will instantiate same number of WriterInitializer instance as number of branches and combine it into MultiWriterInitializer. @param state @return WriterInitializer
[ "Provides", "WriterInitializer", "based", "on", "the", "writer", ".", "Mostly", "writer", "is", "decided", "by", "the", "Writer", "builder", "(", "and", "destination", ")", "that", "user", "passes", ".", "If", "there", "s", "more", "than", "one", "branch", ...
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/writer/initializer/WriterInitializerFactory.java#L42-L53
UrielCh/ovh-java-sdk
ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java
ApiOvhXdsl.serviceName_rma_id_GET
public OvhRma serviceName_rma_id_GET(String serviceName, String id) throws IOException { """ Get this object properties REST: GET /xdsl/{serviceName}/rma/{id} @param serviceName [required] The internal name of your XDSL offer @param id [required] Return merchandise authorisation identifier """ String qPath = "/xdsl/{serviceName}/rma/{id}"; StringBuilder sb = path(qPath, serviceName, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhRma.class); }
java
public OvhRma serviceName_rma_id_GET(String serviceName, String id) throws IOException { String qPath = "/xdsl/{serviceName}/rma/{id}"; StringBuilder sb = path(qPath, serviceName, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhRma.class); }
[ "public", "OvhRma", "serviceName_rma_id_GET", "(", "String", "serviceName", ",", "String", "id", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/xdsl/{serviceName}/rma/{id}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName",...
Get this object properties REST: GET /xdsl/{serviceName}/rma/{id} @param serviceName [required] The internal name of your XDSL offer @param id [required] Return merchandise authorisation identifier
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L1790-L1795
sculptor/sculptor
sculptor-generator/sculptor-generator-core/src/main/java/org/sculptor/generator/util/HelperBase.java
HelperBase.substringBetween
public String substringBetween(String string, String begin, String end) { """ Gets a substring between the begin and end boundaries @param string original string @param begin start boundary @param end end boundary @return substring between boundaries """ return substringBetween(string, begin, end, false); }
java
public String substringBetween(String string, String begin, String end) { return substringBetween(string, begin, end, false); }
[ "public", "String", "substringBetween", "(", "String", "string", ",", "String", "begin", ",", "String", "end", ")", "{", "return", "substringBetween", "(", "string", ",", "begin", ",", "end", ",", "false", ")", ";", "}" ]
Gets a substring between the begin and end boundaries @param string original string @param begin start boundary @param end end boundary @return substring between boundaries
[ "Gets", "a", "substring", "between", "the", "begin", "and", "end", "boundaries" ]
train
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-generator/sculptor-generator-core/src/main/java/org/sculptor/generator/util/HelperBase.java#L523-L525
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/AccountsImpl.java
AccountsImpl.listNodeAgentSkus
public PagedList<NodeAgentSku> listNodeAgentSkus(final AccountListNodeAgentSkusOptions accountListNodeAgentSkusOptions) { """ Lists all node agent SKUs supported by the Azure Batch service. @param accountListNodeAgentSkusOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @throws BatchErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PagedList&lt;NodeAgentSku&gt; object if successful. """ ServiceResponseWithHeaders<Page<NodeAgentSku>, AccountListNodeAgentSkusHeaders> response = listNodeAgentSkusSinglePageAsync(accountListNodeAgentSkusOptions).toBlocking().single(); return new PagedList<NodeAgentSku>(response.body()) { @Override public Page<NodeAgentSku> nextPage(String nextPageLink) { AccountListNodeAgentSkusNextOptions accountListNodeAgentSkusNextOptions = null; if (accountListNodeAgentSkusOptions != null) { accountListNodeAgentSkusNextOptions = new AccountListNodeAgentSkusNextOptions(); accountListNodeAgentSkusNextOptions.withClientRequestId(accountListNodeAgentSkusOptions.clientRequestId()); accountListNodeAgentSkusNextOptions.withReturnClientRequestId(accountListNodeAgentSkusOptions.returnClientRequestId()); accountListNodeAgentSkusNextOptions.withOcpDate(accountListNodeAgentSkusOptions.ocpDate()); } return listNodeAgentSkusNextSinglePageAsync(nextPageLink, accountListNodeAgentSkusNextOptions).toBlocking().single().body(); } }; }
java
public PagedList<NodeAgentSku> listNodeAgentSkus(final AccountListNodeAgentSkusOptions accountListNodeAgentSkusOptions) { ServiceResponseWithHeaders<Page<NodeAgentSku>, AccountListNodeAgentSkusHeaders> response = listNodeAgentSkusSinglePageAsync(accountListNodeAgentSkusOptions).toBlocking().single(); return new PagedList<NodeAgentSku>(response.body()) { @Override public Page<NodeAgentSku> nextPage(String nextPageLink) { AccountListNodeAgentSkusNextOptions accountListNodeAgentSkusNextOptions = null; if (accountListNodeAgentSkusOptions != null) { accountListNodeAgentSkusNextOptions = new AccountListNodeAgentSkusNextOptions(); accountListNodeAgentSkusNextOptions.withClientRequestId(accountListNodeAgentSkusOptions.clientRequestId()); accountListNodeAgentSkusNextOptions.withReturnClientRequestId(accountListNodeAgentSkusOptions.returnClientRequestId()); accountListNodeAgentSkusNextOptions.withOcpDate(accountListNodeAgentSkusOptions.ocpDate()); } return listNodeAgentSkusNextSinglePageAsync(nextPageLink, accountListNodeAgentSkusNextOptions).toBlocking().single().body(); } }; }
[ "public", "PagedList", "<", "NodeAgentSku", ">", "listNodeAgentSkus", "(", "final", "AccountListNodeAgentSkusOptions", "accountListNodeAgentSkusOptions", ")", "{", "ServiceResponseWithHeaders", "<", "Page", "<", "NodeAgentSku", ">", ",", "AccountListNodeAgentSkusHeaders", ">"...
Lists all node agent SKUs supported by the Azure Batch service. @param accountListNodeAgentSkusOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @throws BatchErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PagedList&lt;NodeAgentSku&gt; object if successful.
[ "Lists", "all", "node", "agent", "SKUs", "supported", "by", "the", "Azure", "Batch", "service", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/AccountsImpl.java#L208-L223
alibaba/jstorm
jstorm-core/src/main/java/backtype/storm/StormSubmitter.java
StormSubmitter.submitTopologyWithProgressBar
public static void submitTopologyWithProgressBar(String name, Map stormConf, StormTopology topology, SubmitOptions opts) throws AlreadyAliveException, InvalidTopologyException { """ Submits a topology to run on the cluster with a progress bar. A topology runs forever or until explicitly killed. @param name the name of the storm. @param stormConf the topology-specific configuration. See {@link Config}. @param topology the processing to execute. @param opts to manipulate the starting of the topology @throws AlreadyAliveException if a topology with this name is already running @throws InvalidTopologyException if an invalid topology was submitted """ /** * progress bar is removed in jstorm */ submitTopology(name, stormConf, topology, opts); }
java
public static void submitTopologyWithProgressBar(String name, Map stormConf, StormTopology topology, SubmitOptions opts) throws AlreadyAliveException, InvalidTopologyException { /** * progress bar is removed in jstorm */ submitTopology(name, stormConf, topology, opts); }
[ "public", "static", "void", "submitTopologyWithProgressBar", "(", "String", "name", ",", "Map", "stormConf", ",", "StormTopology", "topology", ",", "SubmitOptions", "opts", ")", "throws", "AlreadyAliveException", ",", "InvalidTopologyException", "{", "/**\n * prog...
Submits a topology to run on the cluster with a progress bar. A topology runs forever or until explicitly killed. @param name the name of the storm. @param stormConf the topology-specific configuration. See {@link Config}. @param topology the processing to execute. @param opts to manipulate the starting of the topology @throws AlreadyAliveException if a topology with this name is already running @throws InvalidTopologyException if an invalid topology was submitted
[ "Submits", "a", "topology", "to", "run", "on", "the", "cluster", "with", "a", "progress", "bar", ".", "A", "topology", "runs", "forever", "or", "until", "explicitly", "killed", "." ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/StormSubmitter.java#L194-L200
OpenLiberty/open-liberty
dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JaxbPUnit21.java
JaxbPUnit21.getProperties
public Properties getProperties() { """ Gets the value of the properties property. @return value of the properties property. """ Properties rtnProperties = null; // Convert this Properties from the class defined in JAXB // (com.ibm.ws.jpa.pxml21.Persistence.PersistenceUnit.Properties) // to standard JDK classes (java.util.Properties). com.ibm.ws.jpa.pxml21.Persistence.PersistenceUnit.Properties puProperties = ivPUnit.getProperties(); if (puProperties != null) { List<com.ibm.ws.jpa.pxml21.Persistence.PersistenceUnit.Properties.Property> propertyList = puProperties.getProperty(); if (propertyList != null && !propertyList.isEmpty()) { rtnProperties = new Properties(); for (com.ibm.ws.jpa.pxml21.Persistence.PersistenceUnit.Properties.Property puProperty : propertyList) { // It is possible that a syntax error will exist in the persistence.xml // where the property or value is null. Neither is acceptable for // a Hashtable and will result in an exception. try { rtnProperties.setProperty(puProperty.getName(), puProperty.getValue()); } catch (Throwable ex) { FFDCFilter.processException(ex, CLASS_NAME + ".getProperties", "219", this); Tr.error(tc, "PROPERTY_SYNTAX_ERROR_IN_PERSISTENCE_XML_CWWJP0039E", ivPUnit.getName(), puProperty.getName(), puProperty.getValue(), ex); String exMsg = "A severe error occurred while processing the properties " + "within the persistence.xml of Persistence Unit: " + ivPUnit.getName() + " (Property = " + puProperty.getName() + ", Value = " + puProperty.getValue() + ")."; throw new RuntimeException(exMsg, ex); } } } } return rtnProperties; }
java
public Properties getProperties() { Properties rtnProperties = null; // Convert this Properties from the class defined in JAXB // (com.ibm.ws.jpa.pxml21.Persistence.PersistenceUnit.Properties) // to standard JDK classes (java.util.Properties). com.ibm.ws.jpa.pxml21.Persistence.PersistenceUnit.Properties puProperties = ivPUnit.getProperties(); if (puProperties != null) { List<com.ibm.ws.jpa.pxml21.Persistence.PersistenceUnit.Properties.Property> propertyList = puProperties.getProperty(); if (propertyList != null && !propertyList.isEmpty()) { rtnProperties = new Properties(); for (com.ibm.ws.jpa.pxml21.Persistence.PersistenceUnit.Properties.Property puProperty : propertyList) { // It is possible that a syntax error will exist in the persistence.xml // where the property or value is null. Neither is acceptable for // a Hashtable and will result in an exception. try { rtnProperties.setProperty(puProperty.getName(), puProperty.getValue()); } catch (Throwable ex) { FFDCFilter.processException(ex, CLASS_NAME + ".getProperties", "219", this); Tr.error(tc, "PROPERTY_SYNTAX_ERROR_IN_PERSISTENCE_XML_CWWJP0039E", ivPUnit.getName(), puProperty.getName(), puProperty.getValue(), ex); String exMsg = "A severe error occurred while processing the properties " + "within the persistence.xml of Persistence Unit: " + ivPUnit.getName() + " (Property = " + puProperty.getName() + ", Value = " + puProperty.getValue() + ")."; throw new RuntimeException(exMsg, ex); } } } } return rtnProperties; }
[ "public", "Properties", "getProperties", "(", ")", "{", "Properties", "rtnProperties", "=", "null", ";", "// Convert this Properties from the class defined in JAXB", "// (com.ibm.ws.jpa.pxml21.Persistence.PersistenceUnit.Properties)", "// to standard JDK classes (java.util.Properties).", ...
Gets the value of the properties property. @return value of the properties property.
[ "Gets", "the", "value", "of", "the", "properties", "property", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JaxbPUnit21.java#L248-L283
deeplearning4j/deeplearning4j
datavec/datavec-api/src/main/java/org/datavec/api/transform/serde/BaseSerializer.java
BaseSerializer.deserializeReducerList
public List<IAssociativeReducer> deserializeReducerList(String str) { """ Deserialize an IStringReducer List serialized using {@link #serializeReducerList(List)}, or an array serialized using {@link #serialize(IReducer[])} @param str String representation (YAML/JSON) of the IStringReducer list @return {@code List<IStringReducer>} """ return load(str, ListWrappers.ReducerList.class).getList(); }
java
public List<IAssociativeReducer> deserializeReducerList(String str) { return load(str, ListWrappers.ReducerList.class).getList(); }
[ "public", "List", "<", "IAssociativeReducer", ">", "deserializeReducerList", "(", "String", "str", ")", "{", "return", "load", "(", "str", ",", "ListWrappers", ".", "ReducerList", ".", "class", ")", ".", "getList", "(", ")", ";", "}" ]
Deserialize an IStringReducer List serialized using {@link #serializeReducerList(List)}, or an array serialized using {@link #serialize(IReducer[])} @param str String representation (YAML/JSON) of the IStringReducer list @return {@code List<IStringReducer>}
[ "Deserialize", "an", "IStringReducer", "List", "serialized", "using", "{", "@link", "#serializeReducerList", "(", "List", ")", "}", "or", "an", "array", "serialized", "using", "{", "@link", "#serialize", "(", "IReducer", "[]", ")", "}" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/transform/serde/BaseSerializer.java#L311-L313
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/cache/impl/CacheEntryViews.java
CacheEntryViews.createEntryView
public static CacheEntryView<Data, Data> createEntryView(Data key, Data value, Data expiryPolicy, CacheRecord record, CacheEntryViewType cacheEntryViewType) { """ Creates a {@link CacheEntryView} instance. @param key the key to be wrapped @param value the value to be wrapped @param record {@link CacheRecord} instance to gather additional entry view properties like access time, expiration time and access hit @param cacheEntryViewType the type of the {@link CacheEntryView} represented as {@link CacheEntryViewType} @return the {@link CacheEntryView} instance """ if (cacheEntryViewType == null) { throw new IllegalArgumentException("Empty cache entry view type"); } switch (cacheEntryViewType) { case DEFAULT: return createDefaultEntryView(key, value, expiryPolicy, record); case LAZY: return createLazyEntryView(key, value, expiryPolicy, record); default: throw new IllegalArgumentException("Invalid cache entry view type: " + cacheEntryViewType); } }
java
public static CacheEntryView<Data, Data> createEntryView(Data key, Data value, Data expiryPolicy, CacheRecord record, CacheEntryViewType cacheEntryViewType) { if (cacheEntryViewType == null) { throw new IllegalArgumentException("Empty cache entry view type"); } switch (cacheEntryViewType) { case DEFAULT: return createDefaultEntryView(key, value, expiryPolicy, record); case LAZY: return createLazyEntryView(key, value, expiryPolicy, record); default: throw new IllegalArgumentException("Invalid cache entry view type: " + cacheEntryViewType); } }
[ "public", "static", "CacheEntryView", "<", "Data", ",", "Data", ">", "createEntryView", "(", "Data", "key", ",", "Data", "value", ",", "Data", "expiryPolicy", ",", "CacheRecord", "record", ",", "CacheEntryViewType", "cacheEntryViewType", ")", "{", "if", "(", "...
Creates a {@link CacheEntryView} instance. @param key the key to be wrapped @param value the value to be wrapped @param record {@link CacheRecord} instance to gather additional entry view properties like access time, expiration time and access hit @param cacheEntryViewType the type of the {@link CacheEntryView} represented as {@link CacheEntryViewType} @return the {@link CacheEntryView} instance
[ "Creates", "a", "{", "@link", "CacheEntryView", "}", "instance", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cache/impl/CacheEntryViews.java#L107-L120
JOML-CI/JOML
src/org/joml/Quaterniond.java
Quaterniond.rotateAxis
public Quaterniond rotateAxis(double angle, double axisX, double axisY, double axisZ, Quaterniond dest) { """ /* (non-Javadoc) @see org.joml.Quaterniondc#rotateAxis(double, double, double, double, org.joml.Quaterniond) """ double hangle = angle / 2.0; double sinAngle = Math.sin(hangle); double invVLength = 1.0 / Math.sqrt(axisX * axisX + axisY * axisY + axisZ * axisZ); double rx = axisX * invVLength * sinAngle; double ry = axisY * invVLength * sinAngle; double rz = axisZ * invVLength * sinAngle; double rw = Math.cosFromSin(sinAngle, hangle); dest.set(w * rx + x * rw + y * rz - z * ry, w * ry - x * rz + y * rw + z * rx, w * rz + x * ry - y * rx + z * rw, w * rw - x * rx - y * ry - z * rz); return dest; }
java
public Quaterniond rotateAxis(double angle, double axisX, double axisY, double axisZ, Quaterniond dest) { double hangle = angle / 2.0; double sinAngle = Math.sin(hangle); double invVLength = 1.0 / Math.sqrt(axisX * axisX + axisY * axisY + axisZ * axisZ); double rx = axisX * invVLength * sinAngle; double ry = axisY * invVLength * sinAngle; double rz = axisZ * invVLength * sinAngle; double rw = Math.cosFromSin(sinAngle, hangle); dest.set(w * rx + x * rw + y * rz - z * ry, w * ry - x * rz + y * rw + z * rx, w * rz + x * ry - y * rx + z * rw, w * rw - x * rx - y * ry - z * rz); return dest; }
[ "public", "Quaterniond", "rotateAxis", "(", "double", "angle", ",", "double", "axisX", ",", "double", "axisY", ",", "double", "axisZ", ",", "Quaterniond", "dest", ")", "{", "double", "hangle", "=", "angle", "/", "2.0", ";", "double", "sinAngle", "=", "Math...
/* (non-Javadoc) @see org.joml.Quaterniondc#rotateAxis(double, double, double, double, org.joml.Quaterniond)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Quaterniond.java#L2471-L2486
thorntail/thorntail
plugins/gradle/gradle-plugin/src/main/java/org/wildfly/swarm/plugin/gradle/GradleDependencyResolutionHelper.java
GradleDependencyResolutionHelper.getAllProjects
private static Map<String, Project> getAllProjects(final Project project) { """ Get the collection of Gradle projects along with their GAV definitions. This collection is used for determining if an artifact specification represents a Gradle project or not. @param project the Gradle project that is being analyzed. @return a map of GAV coordinates for each of the available projects (returned as keys). """ return getCachedReference(project, "thorntail_project_gav_collection", () -> { Map<String, Project> gavMap = new HashMap<>(); project.getRootProject().getAllprojects().forEach(p -> { gavMap.put(p.getGroup() + ":" + p.getName() + ":" + p.getVersion(), p); }); return gavMap; }); }
java
private static Map<String, Project> getAllProjects(final Project project) { return getCachedReference(project, "thorntail_project_gav_collection", () -> { Map<String, Project> gavMap = new HashMap<>(); project.getRootProject().getAllprojects().forEach(p -> { gavMap.put(p.getGroup() + ":" + p.getName() + ":" + p.getVersion(), p); }); return gavMap; }); }
[ "private", "static", "Map", "<", "String", ",", "Project", ">", "getAllProjects", "(", "final", "Project", "project", ")", "{", "return", "getCachedReference", "(", "project", ",", "\"thorntail_project_gav_collection\"", ",", "(", ")", "->", "{", "Map", "<", "...
Get the collection of Gradle projects along with their GAV definitions. This collection is used for determining if an artifact specification represents a Gradle project or not. @param project the Gradle project that is being analyzed. @return a map of GAV coordinates for each of the available projects (returned as keys).
[ "Get", "the", "collection", "of", "Gradle", "projects", "along", "with", "their", "GAV", "definitions", ".", "This", "collection", "is", "used", "for", "determining", "if", "an", "artifact", "specification", "represents", "a", "Gradle", "project", "or", "not", ...
train
https://github.com/thorntail/thorntail/blob/4a391b68ffae98c6e66d30a3bfb99dadc9509f14/plugins/gradle/gradle-plugin/src/main/java/org/wildfly/swarm/plugin/gradle/GradleDependencyResolutionHelper.java#L321-L329
stephenc/simple-java-mail
src/main/java/org/codemonkey/simplejavamail/Email.java
Email.addAttachment
public void addAttachment(final String name, final byte[] data, final String mimetype) { """ Adds an attachment to the email message and generates the necessary {@link DataSource} with the given byte data. Then delegates to {@link #addAttachment(String, DataSource)}. At this point the datasource is actually a {@link ByteArrayDataSource}. @param name The name of the extension (eg. filename including extension). @param data The byte data of the attachment. @param mimetype The content type of the given data (eg. "plain/text", "image/gif" or "application/pdf"). @see ByteArrayDataSource @see #addAttachment(String, DataSource) """ final ByteArrayDataSource dataSource = new ByteArrayDataSource(data, mimetype); dataSource.setName(name); addAttachment(name, dataSource); }
java
public void addAttachment(final String name, final byte[] data, final String mimetype) { final ByteArrayDataSource dataSource = new ByteArrayDataSource(data, mimetype); dataSource.setName(name); addAttachment(name, dataSource); }
[ "public", "void", "addAttachment", "(", "final", "String", "name", ",", "final", "byte", "[", "]", "data", ",", "final", "String", "mimetype", ")", "{", "final", "ByteArrayDataSource", "dataSource", "=", "new", "ByteArrayDataSource", "(", "data", ",", "mimetyp...
Adds an attachment to the email message and generates the necessary {@link DataSource} with the given byte data. Then delegates to {@link #addAttachment(String, DataSource)}. At this point the datasource is actually a {@link ByteArrayDataSource}. @param name The name of the extension (eg. filename including extension). @param data The byte data of the attachment. @param mimetype The content type of the given data (eg. "plain/text", "image/gif" or "application/pdf"). @see ByteArrayDataSource @see #addAttachment(String, DataSource)
[ "Adds", "an", "attachment", "to", "the", "email", "message", "and", "generates", "the", "necessary", "{", "@link", "DataSource", "}", "with", "the", "given", "byte", "data", ".", "Then", "delegates", "to", "{", "@link", "#addAttachment", "(", "String", "Data...
train
https://github.com/stephenc/simple-java-mail/blob/8c5897e6bbc23c11e7c7eb5064f407625c653923/src/main/java/org/codemonkey/simplejavamail/Email.java#L144-L148
Whiley/WhileyCompiler
src/main/java/wyil/util/AbstractTypedVisitor.java
AbstractTypedVisitor.isDerivation
public boolean isDerivation(Type parent, Type child) { """ Check whether one type is a derivation of another. For example, in this scenario: <pre> type parent is (int p) where ... type child is (parent c) where ... </pre> @param parent The type being derived to @param child The type we are trying to derive @return """ if (child.equals(parent)) { return true; } else if (child instanceof Type.Nominal) { Type.Nominal t = (Type.Nominal) child; Decl.Type decl = t.getLink().getTarget(); return isDerivation(parent, decl.getType()); } else { return false; } }
java
public boolean isDerivation(Type parent, Type child) { if (child.equals(parent)) { return true; } else if (child instanceof Type.Nominal) { Type.Nominal t = (Type.Nominal) child; Decl.Type decl = t.getLink().getTarget(); return isDerivation(parent, decl.getType()); } else { return false; } }
[ "public", "boolean", "isDerivation", "(", "Type", "parent", ",", "Type", "child", ")", "{", "if", "(", "child", ".", "equals", "(", "parent", ")", ")", "{", "return", "true", ";", "}", "else", "if", "(", "child", "instanceof", "Type", ".", "Nominal", ...
Check whether one type is a derivation of another. For example, in this scenario: <pre> type parent is (int p) where ... type child is (parent c) where ... </pre> @param parent The type being derived to @param child The type we are trying to derive @return
[ "Check", "whether", "one", "type", "is", "a", "derivation", "of", "another", ".", "For", "example", "in", "this", "scenario", ":" ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/util/AbstractTypedVisitor.java#L1297-L1307
dhemery/hartley
src/main/java/com/dhemery/expressing/Expressive.java
Expressive.waitUntil
public <V> void waitUntil(Sampler<V> variable, Matcher<? super V> criteria) { """ Wait until a polled sample of the variable satisfies the criteria. Uses a default ticker. """ waitUntil(variable, eventually(), criteria); }
java
public <V> void waitUntil(Sampler<V> variable, Matcher<? super V> criteria) { waitUntil(variable, eventually(), criteria); }
[ "public", "<", "V", ">", "void", "waitUntil", "(", "Sampler", "<", "V", ">", "variable", ",", "Matcher", "<", "?", "super", "V", ">", "criteria", ")", "{", "waitUntil", "(", "variable", ",", "eventually", "(", ")", ",", "criteria", ")", ";", "}" ]
Wait until a polled sample of the variable satisfies the criteria. Uses a default ticker.
[ "Wait", "until", "a", "polled", "sample", "of", "the", "variable", "satisfies", "the", "criteria", ".", "Uses", "a", "default", "ticker", "." ]
train
https://github.com/dhemery/hartley/blob/7754bd6bc12695f2249601b8890da530a61fcf33/src/main/java/com/dhemery/expressing/Expressive.java#L192-L194
dkpro/dkpro-argumentation
dkpro-argumentation-types/src/main/java/org/dkpro/argumentation/types/ArgumentUnitUtils.java
ArgumentUnitUtils.getProperty
public static String getProperty(ArgumentUnit argumentUnit, String propertyName) { """ Returns the property value @param argumentUnit argument component @param propertyName property name @return the value to which the specified key is mapped, or {@code null} if this map contains no mapping for the key """ Properties properties = ArgumentUnitUtils.getProperties(argumentUnit); return (String) properties.get(propertyName); }
java
public static String getProperty(ArgumentUnit argumentUnit, String propertyName) { Properties properties = ArgumentUnitUtils.getProperties(argumentUnit); return (String) properties.get(propertyName); }
[ "public", "static", "String", "getProperty", "(", "ArgumentUnit", "argumentUnit", ",", "String", "propertyName", ")", "{", "Properties", "properties", "=", "ArgumentUnitUtils", ".", "getProperties", "(", "argumentUnit", ")", ";", "return", "(", "String", ")", "pro...
Returns the property value @param argumentUnit argument component @param propertyName property name @return the value to which the specified key is mapped, or {@code null} if this map contains no mapping for the key
[ "Returns", "the", "property", "value" ]
train
https://github.com/dkpro/dkpro-argumentation/blob/57ce6f5e73d8075b7088aeeebb107c85b3d4bbcb/dkpro-argumentation-types/src/main/java/org/dkpro/argumentation/types/ArgumentUnitUtils.java#L170-L174
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
NodeIndexer.addDoubleValue
protected void addDoubleValue(Document doc, String fieldName, Object internalValue) { """ Adds the double value to the document as the named field. The double value is converted to an indexable string value using the {@link DoubleField} class. @param doc The document to which to add the field @param fieldName The name of the field to add @param internalValue The value for the field to add to the document. """ double doubleVal = ((Double)internalValue).doubleValue(); doc.add(createFieldWithoutNorms(fieldName, DoubleField.doubleToString(doubleVal), PropertyType.DOUBLE)); }
java
protected void addDoubleValue(Document doc, String fieldName, Object internalValue) { double doubleVal = ((Double)internalValue).doubleValue(); doc.add(createFieldWithoutNorms(fieldName, DoubleField.doubleToString(doubleVal), PropertyType.DOUBLE)); }
[ "protected", "void", "addDoubleValue", "(", "Document", "doc", ",", "String", "fieldName", ",", "Object", "internalValue", ")", "{", "double", "doubleVal", "=", "(", "(", "Double", ")", "internalValue", ")", ".", "doubleValue", "(", ")", ";", "doc", ".", "...
Adds the double value to the document as the named field. The double value is converted to an indexable string value using the {@link DoubleField} class. @param doc The document to which to add the field @param fieldName The name of the field to add @param internalValue The value for the field to add to the document.
[ "Adds", "the", "double", "value", "to", "the", "document", "as", "the", "named", "field", ".", "The", "double", "value", "is", "converted", "to", "an", "indexable", "string", "value", "using", "the", "{", "@link", "DoubleField", "}", "class", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java#L760-L764
realtime-framework/RealtimeMessaging-Java
library/src/main/java/ibt/ortc/api/Balancer.java
Balancer.getServerFromBalancer
public static String getServerFromBalancer(String balancerUrl,String applicationKey, Proxy proxy) throws IOException, InvalidBalancerServerException { """ Retrieves an Ortc Server url from the Ortc Balancer @param balancerUrl The Ortc Balancer url @return An Ortc Server url @throws java.io.IOException @throws UnknownHostException @throws InvalidBalancerServerException """ Matcher protocolMatcher = urlProtocolPattern.matcher(balancerUrl); String protocol = protocolMatcher.matches() ? "" : protocolMatcher.group(1); String parsedUrl = String.format("%s%s", protocol, balancerUrl); if(!Strings.isNullOrEmpty(applicationKey)){ // CAUSE: Prefer String.format to + parsedUrl += String.format("?appkey=%s", applicationKey); } URL url = new URL(parsedUrl); String balancer = IOUtil.doGetRequest(url, proxy); Matcher matcher = balancerServerPattern.matcher(balancer); if (!matcher.matches()) { throw new InvalidBalancerServerException(balancer); } return matcher.group(1); }
java
public static String getServerFromBalancer(String balancerUrl,String applicationKey, Proxy proxy) throws IOException, InvalidBalancerServerException { Matcher protocolMatcher = urlProtocolPattern.matcher(balancerUrl); String protocol = protocolMatcher.matches() ? "" : protocolMatcher.group(1); String parsedUrl = String.format("%s%s", protocol, balancerUrl); if(!Strings.isNullOrEmpty(applicationKey)){ // CAUSE: Prefer String.format to + parsedUrl += String.format("?appkey=%s", applicationKey); } URL url = new URL(parsedUrl); String balancer = IOUtil.doGetRequest(url, proxy); Matcher matcher = balancerServerPattern.matcher(balancer); if (!matcher.matches()) { throw new InvalidBalancerServerException(balancer); } return matcher.group(1); }
[ "public", "static", "String", "getServerFromBalancer", "(", "String", "balancerUrl", ",", "String", "applicationKey", ",", "Proxy", "proxy", ")", "throws", "IOException", ",", "InvalidBalancerServerException", "{", "Matcher", "protocolMatcher", "=", "urlProtocolPattern", ...
Retrieves an Ortc Server url from the Ortc Balancer @param balancerUrl The Ortc Balancer url @return An Ortc Server url @throws java.io.IOException @throws UnknownHostException @throws InvalidBalancerServerException
[ "Retrieves", "an", "Ortc", "Server", "url", "from", "the", "Ortc", "Balancer" ]
train
https://github.com/realtime-framework/RealtimeMessaging-Java/blob/cae0dfd01567a2d9e55a0849c0c9b09ad4b2cc08/library/src/main/java/ibt/ortc/api/Balancer.java#L76-L96
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/data/nexus/NexusSearch.java
NexusSearch.preflightRequest
public boolean preflightRequest() { """ Do a preflight request to see if the repository is actually working. @return whether the repository is listening and returns the /status URL correctly """ final HttpURLConnection conn; try { final URL url = new URL(rootURL, "status"); final URLConnectionFactory factory = new URLConnectionFactory(settings); conn = factory.createHttpURLConnection(url, useProxy); conn.addRequestProperty("Accept", "application/xml"); final String authHeader = buildHttpAuthHeaderValue(); if (!authHeader.isEmpty()) { conn.addRequestProperty("Authorization", authHeader); } conn.connect(); if (conn.getResponseCode() != 200) { LOGGER.warn("Expected 200 result from Nexus, got {}", conn.getResponseCode()); return false; } final DocumentBuilder builder = XmlUtils.buildSecureDocumentBuilder(); final Document doc = builder.parse(conn.getInputStream()); if (!"status".equals(doc.getDocumentElement().getNodeName())) { LOGGER.warn("Expected root node name of status, got {}", doc.getDocumentElement().getNodeName()); return false; } } catch (IOException | ParserConfigurationException | SAXException e) { return false; } return true; }
java
public boolean preflightRequest() { final HttpURLConnection conn; try { final URL url = new URL(rootURL, "status"); final URLConnectionFactory factory = new URLConnectionFactory(settings); conn = factory.createHttpURLConnection(url, useProxy); conn.addRequestProperty("Accept", "application/xml"); final String authHeader = buildHttpAuthHeaderValue(); if (!authHeader.isEmpty()) { conn.addRequestProperty("Authorization", authHeader); } conn.connect(); if (conn.getResponseCode() != 200) { LOGGER.warn("Expected 200 result from Nexus, got {}", conn.getResponseCode()); return false; } final DocumentBuilder builder = XmlUtils.buildSecureDocumentBuilder(); final Document doc = builder.parse(conn.getInputStream()); if (!"status".equals(doc.getDocumentElement().getNodeName())) { LOGGER.warn("Expected root node name of status, got {}", doc.getDocumentElement().getNodeName()); return false; } } catch (IOException | ParserConfigurationException | SAXException e) { return false; } return true; }
[ "public", "boolean", "preflightRequest", "(", ")", "{", "final", "HttpURLConnection", "conn", ";", "try", "{", "final", "URL", "url", "=", "new", "URL", "(", "rootURL", ",", "\"status\"", ")", ";", "final", "URLConnectionFactory", "factory", "=", "new", "URL...
Do a preflight request to see if the repository is actually working. @return whether the repository is listening and returns the /status URL correctly
[ "Do", "a", "preflight", "request", "to", "see", "if", "the", "repository", "is", "actually", "working", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/nexus/NexusSearch.java#L177-L204
grpc/grpc-java
android/src/main/java/io/grpc/android/AndroidChannelBuilder.java
AndroidChannelBuilder.sslSocketFactory
@Deprecated public AndroidChannelBuilder sslSocketFactory(SSLSocketFactory factory) { """ Set the delegate channel builder's sslSocketFactory. @deprecated Use {@link #fromBuilder(ManagedChannelBuilder)} with a pre-configured ManagedChannelBuilder instead. """ try { OKHTTP_CHANNEL_BUILDER_CLASS .getMethod("sslSocketFactory", SSLSocketFactory.class) .invoke(delegateBuilder, factory); return this; } catch (Exception e) { throw new RuntimeException("Failed to invoke sslSocketFactory on delegate builder", e); } }
java
@Deprecated public AndroidChannelBuilder sslSocketFactory(SSLSocketFactory factory) { try { OKHTTP_CHANNEL_BUILDER_CLASS .getMethod("sslSocketFactory", SSLSocketFactory.class) .invoke(delegateBuilder, factory); return this; } catch (Exception e) { throw new RuntimeException("Failed to invoke sslSocketFactory on delegate builder", e); } }
[ "@", "Deprecated", "public", "AndroidChannelBuilder", "sslSocketFactory", "(", "SSLSocketFactory", "factory", ")", "{", "try", "{", "OKHTTP_CHANNEL_BUILDER_CLASS", ".", "getMethod", "(", "\"sslSocketFactory\"", ",", "SSLSocketFactory", ".", "class", ")", ".", "invoke", ...
Set the delegate channel builder's sslSocketFactory. @deprecated Use {@link #fromBuilder(ManagedChannelBuilder)} with a pre-configured ManagedChannelBuilder instead.
[ "Set", "the", "delegate", "channel", "builder", "s", "sslSocketFactory", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/android/src/main/java/io/grpc/android/AndroidChannelBuilder.java#L137-L147
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/collections/sort/RedBlackTreeInteger.java
RedBlackTreeInteger.getPrevious
public Node<T> getPrevious(Node<T> node) { """ Returns the node containing the key just before the key of the given node. """ if (node.left != null) { node = node.left; while (node.right != null) node = node.right; return node; } // nothing at left, it may be the parent node if the node is at the right if (node == first) return null; return getPrevious(root, node.value); }
java
public Node<T> getPrevious(Node<T> node) { if (node.left != null) { node = node.left; while (node.right != null) node = node.right; return node; } // nothing at left, it may be the parent node if the node is at the right if (node == first) return null; return getPrevious(root, node.value); }
[ "public", "Node", "<", "T", ">", "getPrevious", "(", "Node", "<", "T", ">", "node", ")", "{", "if", "(", "node", ".", "left", "!=", "null", ")", "{", "node", "=", "node", ".", "left", ";", "while", "(", "node", ".", "right", "!=", "null", ")", ...
Returns the node containing the key just before the key of the given node.
[ "Returns", "the", "node", "containing", "the", "key", "just", "before", "the", "key", "of", "the", "given", "node", "." ]
train
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/collections/sort/RedBlackTreeInteger.java#L107-L116