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
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildTasksInner.java
BuildTasksInner.listSourceRepositoryProperties
public SourceRepositoryPropertiesInner listSourceRepositoryProperties(String resourceGroupName, String registryName, String buildTaskName) { """ Get the source control properties for a build task. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param buildTaskName The name of the container registry build task. @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 SourceRepositoryPropertiesInner object if successful. """ return listSourceRepositoryPropertiesWithServiceResponseAsync(resourceGroupName, registryName, buildTaskName).toBlocking().single().body(); }
java
public SourceRepositoryPropertiesInner listSourceRepositoryProperties(String resourceGroupName, String registryName, String buildTaskName) { return listSourceRepositoryPropertiesWithServiceResponseAsync(resourceGroupName, registryName, buildTaskName).toBlocking().single().body(); }
[ "public", "SourceRepositoryPropertiesInner", "listSourceRepositoryProperties", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "String", "buildTaskName", ")", "{", "return", "listSourceRepositoryPropertiesWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ",", "buildTaskName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Get the source control properties for a build task. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param buildTaskName The name of the container registry build task. @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 SourceRepositoryPropertiesInner object if successful.
[ "Get", "the", "source", "control", "properties", "for", "a", "build", "task", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildTasksInner.java#L987-L989
foundation-runtime/service-directory
2.0/sd-core/src/main/java/com/cisco/oss/foundation/directory/utils/ServiceInstanceUtils.java
ServiceInstanceUtils.isOptionalFieldValid
public static boolean isOptionalFieldValid(String field, String reg) { """ Validate the optional field String against regex. @param field the field value String. @param reg the regex. @return true if field is empty of matched the pattern. """ if (field == null || field.length() == 0) { return true; } return Pattern.matches(reg, field); }
java
public static boolean isOptionalFieldValid(String field, String reg) { if (field == null || field.length() == 0) { return true; } return Pattern.matches(reg, field); }
[ "public", "static", "boolean", "isOptionalFieldValid", "(", "String", "field", ",", "String", "reg", ")", "{", "if", "(", "field", "==", "null", "||", "field", ".", "length", "(", ")", "==", "0", ")", "{", "return", "true", ";", "}", "return", "Pattern", ".", "matches", "(", "reg", ",", "field", ")", ";", "}" ]
Validate the optional field String against regex. @param field the field value String. @param reg the regex. @return true if field is empty of matched the pattern.
[ "Validate", "the", "optional", "field", "String", "against", "regex", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-core/src/main/java/com/cisco/oss/foundation/directory/utils/ServiceInstanceUtils.java#L92-L97
threerings/narya
core/src/main/java/com/threerings/presents/peer/server/PeerManager.java
PeerManager.lookupNodeDatum
public <T> T lookupNodeDatum (Function<NodeObject,T> op) { """ Locates a datum from among the set of peer {@link NodeObject}s. Objects are searched in arbitrary order and the first non-null value returned by the supplied lookup operation is returned to the caller. Null if all lookup operations returned null. """ for (T value : Iterables.filter(Iterables.transform(getNodeObjects(), op), Predicates.notNull())) { return value; } return null; }
java
public <T> T lookupNodeDatum (Function<NodeObject,T> op) { for (T value : Iterables.filter(Iterables.transform(getNodeObjects(), op), Predicates.notNull())) { return value; } return null; }
[ "public", "<", "T", ">", "T", "lookupNodeDatum", "(", "Function", "<", "NodeObject", ",", "T", ">", "op", ")", "{", "for", "(", "T", "value", ":", "Iterables", ".", "filter", "(", "Iterables", ".", "transform", "(", "getNodeObjects", "(", ")", ",", "op", ")", ",", "Predicates", ".", "notNull", "(", ")", ")", ")", "{", "return", "value", ";", "}", "return", "null", ";", "}" ]
Locates a datum from among the set of peer {@link NodeObject}s. Objects are searched in arbitrary order and the first non-null value returned by the supplied lookup operation is returned to the caller. Null if all lookup operations returned null.
[ "Locates", "a", "datum", "from", "among", "the", "set", "of", "peer", "{" ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L430-L437
zaproxy/zaproxy
src/org/zaproxy/zap/utils/PagingTableModel.java
PagingTableModel.setData
private void setData(int offset, List<T> page) { """ Sets the given {@code page} as the currently loaded data and notifies the table model listeners of the rows updated. <p> <strong>Note:</strong> This method must be call on the EDT, failing to do so might result in GUI state inconsistencies. </p> @param offset the start offset of the given {@code page} @param page the new data @see EventQueue#invokeLater(Runnable) @see TableModelListener """ int lastRow = offset + page.size() - 1; dataOffset = offset; data = page; fireTableRowsUpdated(offset, lastRow); }
java
private void setData(int offset, List<T> page) { int lastRow = offset + page.size() - 1; dataOffset = offset; data = page; fireTableRowsUpdated(offset, lastRow); }
[ "private", "void", "setData", "(", "int", "offset", ",", "List", "<", "T", ">", "page", ")", "{", "int", "lastRow", "=", "offset", "+", "page", ".", "size", "(", ")", "-", "1", ";", "dataOffset", "=", "offset", ";", "data", "=", "page", ";", "fireTableRowsUpdated", "(", "offset", ",", "lastRow", ")", ";", "}" ]
Sets the given {@code page} as the currently loaded data and notifies the table model listeners of the rows updated. <p> <strong>Note:</strong> This method must be call on the EDT, failing to do so might result in GUI state inconsistencies. </p> @param offset the start offset of the given {@code page} @param page the new data @see EventQueue#invokeLater(Runnable) @see TableModelListener
[ "Sets", "the", "given", "{", "@code", "page", "}", "as", "the", "currently", "loaded", "data", "and", "notifies", "the", "table", "model", "listeners", "of", "the", "rows", "updated", ".", "<p", ">", "<strong", ">", "Note", ":", "<", "/", "strong", ">", "This", "method", "must", "be", "call", "on", "the", "EDT", "failing", "to", "do", "so", "might", "result", "in", "GUI", "state", "inconsistencies", ".", "<", "/", "p", ">" ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/utils/PagingTableModel.java#L335-L340
bazaarvoice/emodb
table/src/main/java/com/bazaarvoice/emodb/table/db/astyanax/AstyanaxTable.java
AstyanaxTable.createUnknown
public static AstyanaxTable createUnknown(long uuid, Placement placement, @Nullable String name) { """ Creates a placeholder for unknown tables. A table may be unknown for one of two reasons: 1) the table used to exist but has been deleted, or 2) the table never existed. In the former case the table will have a name, but in the latter case the table will be unnamed and the "name" parameter will be null. """ AstyanaxStorage storage = new AstyanaxStorage( uuid, RowKeyUtils.NUM_SHARDS_UNKNOWN, false/*reads-not-allowed*/, placement.getName(), Suppliers.ofInstance(placement)); return new AstyanaxTable( name != null ? name : "__unknown:" + TableUuidFormat.encode(uuid), new TableOptionsBuilder().setPlacement(placement.getName()).build(), ImmutableMap.<String, Object>of("~unknown", true, "uuid", uuid), null/*availability*/, storage, ImmutableList.of(storage), Suppliers.<Collection<DataCenter>>ofInstance(ImmutableList.<DataCenter>of())); }
java
public static AstyanaxTable createUnknown(long uuid, Placement placement, @Nullable String name) { AstyanaxStorage storage = new AstyanaxStorage( uuid, RowKeyUtils.NUM_SHARDS_UNKNOWN, false/*reads-not-allowed*/, placement.getName(), Suppliers.ofInstance(placement)); return new AstyanaxTable( name != null ? name : "__unknown:" + TableUuidFormat.encode(uuid), new TableOptionsBuilder().setPlacement(placement.getName()).build(), ImmutableMap.<String, Object>of("~unknown", true, "uuid", uuid), null/*availability*/, storage, ImmutableList.of(storage), Suppliers.<Collection<DataCenter>>ofInstance(ImmutableList.<DataCenter>of())); }
[ "public", "static", "AstyanaxTable", "createUnknown", "(", "long", "uuid", ",", "Placement", "placement", ",", "@", "Nullable", "String", "name", ")", "{", "AstyanaxStorage", "storage", "=", "new", "AstyanaxStorage", "(", "uuid", ",", "RowKeyUtils", ".", "NUM_SHARDS_UNKNOWN", ",", "false", "/*reads-not-allowed*/", ",", "placement", ".", "getName", "(", ")", ",", "Suppliers", ".", "ofInstance", "(", "placement", ")", ")", ";", "return", "new", "AstyanaxTable", "(", "name", "!=", "null", "?", "name", ":", "\"__unknown:\"", "+", "TableUuidFormat", ".", "encode", "(", "uuid", ")", ",", "new", "TableOptionsBuilder", "(", ")", ".", "setPlacement", "(", "placement", ".", "getName", "(", ")", ")", ".", "build", "(", ")", ",", "ImmutableMap", ".", "<", "String", ",", "Object", ">", "of", "(", "\"~unknown\"", ",", "true", ",", "\"uuid\"", ",", "uuid", ")", ",", "null", "/*availability*/", ",", "storage", ",", "ImmutableList", ".", "of", "(", "storage", ")", ",", "Suppliers", ".", "<", "Collection", "<", "DataCenter", ">", ">", "ofInstance", "(", "ImmutableList", ".", "<", "DataCenter", ">", "of", "(", ")", ")", ")", ";", "}" ]
Creates a placeholder for unknown tables. A table may be unknown for one of two reasons: 1) the table used to exist but has been deleted, or 2) the table never existed. In the former case the table will have a name, but in the latter case the table will be unnamed and the "name" parameter will be null.
[ "Creates", "a", "placeholder", "for", "unknown", "tables", ".", "A", "table", "may", "be", "unknown", "for", "one", "of", "two", "reasons", ":", "1", ")", "the", "table", "used", "to", "exist", "but", "has", "been", "deleted", "or", "2", ")", "the", "table", "never", "existed", ".", "In", "the", "former", "case", "the", "table", "will", "have", "a", "name", "but", "in", "the", "latter", "case", "the", "table", "will", "be", "unnamed", "and", "the", "name", "parameter", "will", "be", "null", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/table/src/main/java/com/bazaarvoice/emodb/table/db/astyanax/AstyanaxTable.java#L110-L120
salesforce/Argus
ArgusCore/src/main/java/com/salesforce/dva/argus/entity/MetatagsRecord.java
MetatagsRecord.setMetatags
public void setMetatags(Map<String, String> metatags, String key) { """ Replaces the metatags for a metric. Metatags cannot use any of the reserved tag names. @param metatags A key-value pairs of metatags. Cannot be null or empty. @param key A unique identifier to be used while indexing this metatags into a schema db. """ if (metatags != null) { TSDBEntity.validateTags(metatags); _metatags.clear(); _metatags.putAll(metatags); _key = key; } }
java
public void setMetatags(Map<String, String> metatags, String key) { if (metatags != null) { TSDBEntity.validateTags(metatags); _metatags.clear(); _metatags.putAll(metatags); _key = key; } }
[ "public", "void", "setMetatags", "(", "Map", "<", "String", ",", "String", ">", "metatags", ",", "String", "key", ")", "{", "if", "(", "metatags", "!=", "null", ")", "{", "TSDBEntity", ".", "validateTags", "(", "metatags", ")", ";", "_metatags", ".", "clear", "(", ")", ";", "_metatags", ".", "putAll", "(", "metatags", ")", ";", "_key", "=", "key", ";", "}", "}" ]
Replaces the metatags for a metric. Metatags cannot use any of the reserved tag names. @param metatags A key-value pairs of metatags. Cannot be null or empty. @param key A unique identifier to be used while indexing this metatags into a schema db.
[ "Replaces", "the", "metatags", "for", "a", "metric", ".", "Metatags", "cannot", "use", "any", "of", "the", "reserved", "tag", "names", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/MetatagsRecord.java#L97-L104
Azure/azure-sdk-for-java
cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/CollectionPartitionsInner.java
CollectionPartitionsInner.listUsages
public List<PartitionUsageInner> listUsages(String resourceGroupName, String accountName, String databaseRid, String collectionRid) { """ Retrieves the usages (most recent storage data) for the given collection, split by partition. @param resourceGroupName Name of an Azure resource group. @param accountName Cosmos DB database account name. @param databaseRid Cosmos DB database rid. @param collectionRid Cosmos DB collection rid. @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 List&lt;PartitionUsageInner&gt; object if successful. """ return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid).toBlocking().single().body(); }
java
public List<PartitionUsageInner> listUsages(String resourceGroupName, String accountName, String databaseRid, String collectionRid) { return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid).toBlocking().single().body(); }
[ "public", "List", "<", "PartitionUsageInner", ">", "listUsages", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "databaseRid", ",", "String", "collectionRid", ")", "{", "return", "listUsagesWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "databaseRid", ",", "collectionRid", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Retrieves the usages (most recent storage data) for the given collection, split by partition. @param resourceGroupName Name of an Azure resource group. @param accountName Cosmos DB database account name. @param databaseRid Cosmos DB database rid. @param collectionRid Cosmos DB collection rid. @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 List&lt;PartitionUsageInner&gt; object if successful.
[ "Retrieves", "the", "usages", "(", "most", "recent", "storage", "data", ")", "for", "the", "given", "collection", "split", "by", "partition", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/CollectionPartitionsInner.java#L189-L191
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.createClosedListEntityRoleWithServiceResponseAsync
public Observable<ServiceResponse<UUID>> createClosedListEntityRoleWithServiceResponseAsync(UUID appId, String versionId, UUID entityId, CreateClosedListEntityRoleOptionalParameter createClosedListEntityRoleOptionalParameter) { """ Create an entity role for an entity in the application. @param appId The application ID. @param versionId The version ID. @param entityId The entity model ID. @param createClosedListEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the UUID object """ if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } if (entityId == null) { throw new IllegalArgumentException("Parameter entityId is required and cannot be null."); } final String name = createClosedListEntityRoleOptionalParameter != null ? createClosedListEntityRoleOptionalParameter.name() : null; return createClosedListEntityRoleWithServiceResponseAsync(appId, versionId, entityId, name); }
java
public Observable<ServiceResponse<UUID>> createClosedListEntityRoleWithServiceResponseAsync(UUID appId, String versionId, UUID entityId, CreateClosedListEntityRoleOptionalParameter createClosedListEntityRoleOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } if (entityId == null) { throw new IllegalArgumentException("Parameter entityId is required and cannot be null."); } final String name = createClosedListEntityRoleOptionalParameter != null ? createClosedListEntityRoleOptionalParameter.name() : null; return createClosedListEntityRoleWithServiceResponseAsync(appId, versionId, entityId, name); }
[ "public", "Observable", "<", "ServiceResponse", "<", "UUID", ">", ">", "createClosedListEntityRoleWithServiceResponseAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ",", "CreateClosedListEntityRoleOptionalParameter", "createClosedListEntityRoleOptionalParameter", ")", "{", "if", "(", "this", ".", "client", ".", "endpoint", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter this.client.endpoint() is required and cannot be null.\"", ")", ";", "}", "if", "(", "appId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter appId is required and cannot be null.\"", ")", ";", "}", "if", "(", "versionId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter versionId is required and cannot be null.\"", ")", ";", "}", "if", "(", "entityId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter entityId is required and cannot be null.\"", ")", ";", "}", "final", "String", "name", "=", "createClosedListEntityRoleOptionalParameter", "!=", "null", "?", "createClosedListEntityRoleOptionalParameter", ".", "name", "(", ")", ":", "null", ";", "return", "createClosedListEntityRoleWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "entityId", ",", "name", ")", ";", "}" ]
Create an entity role for an entity in the application. @param appId The application ID. @param versionId The version ID. @param entityId The entity model ID. @param createClosedListEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the UUID object
[ "Create", "an", "entity", "role", "for", "an", "entity", "in", "the", "application", "." ]
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#L8360-L8376
groupon/odo
proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java
PathOverrideService.removeGroupFromPathProfile
public void removeGroupFromPathProfile(int group_id, int pathId, int profileId) { """ Removes a group from a path/profile combination @param group_id ID of group @param pathId ID of path @param profileId ID of profile """ int[] groupIds = Utils.arrayFromStringOfIntegers(getGroupIdsInPathProfile(profileId, pathId)); String newGroupIds = ""; for (int i = 0; i < groupIds.length; i++) { if (groupIds[i] != group_id) { newGroupIds += (groupIds[i] + ","); } } EditService.updatePathTable(Constants.PATH_PROFILE_GROUP_IDS, newGroupIds, pathId); }
java
public void removeGroupFromPathProfile(int group_id, int pathId, int profileId) { int[] groupIds = Utils.arrayFromStringOfIntegers(getGroupIdsInPathProfile(profileId, pathId)); String newGroupIds = ""; for (int i = 0; i < groupIds.length; i++) { if (groupIds[i] != group_id) { newGroupIds += (groupIds[i] + ","); } } EditService.updatePathTable(Constants.PATH_PROFILE_GROUP_IDS, newGroupIds, pathId); }
[ "public", "void", "removeGroupFromPathProfile", "(", "int", "group_id", ",", "int", "pathId", ",", "int", "profileId", ")", "{", "int", "[", "]", "groupIds", "=", "Utils", ".", "arrayFromStringOfIntegers", "(", "getGroupIdsInPathProfile", "(", "profileId", ",", "pathId", ")", ")", ";", "String", "newGroupIds", "=", "\"\"", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "groupIds", ".", "length", ";", "i", "++", ")", "{", "if", "(", "groupIds", "[", "i", "]", "!=", "group_id", ")", "{", "newGroupIds", "+=", "(", "groupIds", "[", "i", "]", "+", "\",\"", ")", ";", "}", "}", "EditService", ".", "updatePathTable", "(", "Constants", ".", "PATH_PROFILE_GROUP_IDS", ",", "newGroupIds", ",", "pathId", ")", ";", "}" ]
Removes a group from a path/profile combination @param group_id ID of group @param pathId ID of path @param profileId ID of profile
[ "Removes", "a", "group", "from", "a", "path", "/", "profile", "combination" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java#L883-L893
eduarddrenth/ConfigurableReports
src/main/java/com/vectorprint/report/itext/style/css/CssDocumentHandler.java
CssDocumentHandler.property
@Override public void property(String string, LexicalUnit lu, boolean bln) throws CSSException { """ for each {@link Selector} in the current list, call {@link #toBaseStylerParam(org.w3c.css.sac.Selector, java.lang.String, org.w3c.css.sac.LexicalUnit) } @param string @param lu @param bln @throws CSSException """ for (int i = 0; i < current.getLength(); i++) { toBaseStylerParam(current.item(i), string, lu); } }
java
@Override public void property(String string, LexicalUnit lu, boolean bln) throws CSSException { for (int i = 0; i < current.getLength(); i++) { toBaseStylerParam(current.item(i), string, lu); } }
[ "@", "Override", "public", "void", "property", "(", "String", "string", ",", "LexicalUnit", "lu", ",", "boolean", "bln", ")", "throws", "CSSException", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "current", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "toBaseStylerParam", "(", "current", ".", "item", "(", "i", ")", ",", "string", ",", "lu", ")", ";", "}", "}" ]
for each {@link Selector} in the current list, call {@link #toBaseStylerParam(org.w3c.css.sac.Selector, java.lang.String, org.w3c.css.sac.LexicalUnit) } @param string @param lu @param bln @throws CSSException
[ "for", "each", "{", "@link", "Selector", "}", "in", "the", "current", "list", "call", "{", "@link", "#toBaseStylerParam", "(", "org", ".", "w3c", ".", "css", ".", "sac", ".", "Selector", "java", ".", "lang", ".", "String", "org", ".", "w3c", ".", "css", ".", "sac", ".", "LexicalUnit", ")", "}" ]
train
https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/style/css/CssDocumentHandler.java#L219-L224
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/replace/CmsReplaceDialog.java
CmsReplaceDialog.showErrorReport
public void showErrorReport(final String message, final String stacktrace) { """ Shows the error report.<p> @param message the message to show @param stacktrace the stacktrace to show """ if (!m_canceled) { CmsErrorDialog errDialog = new CmsErrorDialog(message, stacktrace); if (m_handlerReg != null) { m_handlerReg.removeHandler(); } if (m_closeHandler != null) { errDialog.addCloseHandler(m_closeHandler); } hide(); errDialog.center(); } }
java
public void showErrorReport(final String message, final String stacktrace) { if (!m_canceled) { CmsErrorDialog errDialog = new CmsErrorDialog(message, stacktrace); if (m_handlerReg != null) { m_handlerReg.removeHandler(); } if (m_closeHandler != null) { errDialog.addCloseHandler(m_closeHandler); } hide(); errDialog.center(); } }
[ "public", "void", "showErrorReport", "(", "final", "String", "message", ",", "final", "String", "stacktrace", ")", "{", "if", "(", "!", "m_canceled", ")", "{", "CmsErrorDialog", "errDialog", "=", "new", "CmsErrorDialog", "(", "message", ",", "stacktrace", ")", ";", "if", "(", "m_handlerReg", "!=", "null", ")", "{", "m_handlerReg", ".", "removeHandler", "(", ")", ";", "}", "if", "(", "m_closeHandler", "!=", "null", ")", "{", "errDialog", ".", "addCloseHandler", "(", "m_closeHandler", ")", ";", "}", "hide", "(", ")", ";", "errDialog", ".", "center", "(", ")", ";", "}", "}" ]
Shows the error report.<p> @param message the message to show @param stacktrace the stacktrace to show
[ "Shows", "the", "error", "report", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/replace/CmsReplaceDialog.java#L250-L263
wisdom-framework/wisdom
extensions/wisdom-raml/wisdom-source-watcher/src/main/java/org/wisdom/source/ast/visitor/ClassSourceVisitor.java
ClassSourceVisitor.containsClassName
private boolean containsClassName(List<ClassOrInterfaceType> klassList, Set<String> simpleNames) { """ Check if the list of class or interface contains a class which name is given in the <code>simpleNames</code> set. @param klassList The list of class or interface @param simpleNames a set of class simple name. @return <code>true</code> if the list contains a class or interface which name is present in the <code>simpleNames</code> set. """ for (ClassOrInterfaceType ctype : klassList) { if (simpleNames.contains(ctype.getName())) { return true; } } return false; }
java
private boolean containsClassName(List<ClassOrInterfaceType> klassList, Set<String> simpleNames) { for (ClassOrInterfaceType ctype : klassList) { if (simpleNames.contains(ctype.getName())) { return true; } } return false; }
[ "private", "boolean", "containsClassName", "(", "List", "<", "ClassOrInterfaceType", ">", "klassList", ",", "Set", "<", "String", ">", "simpleNames", ")", "{", "for", "(", "ClassOrInterfaceType", "ctype", ":", "klassList", ")", "{", "if", "(", "simpleNames", ".", "contains", "(", "ctype", ".", "getName", "(", ")", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Check if the list of class or interface contains a class which name is given in the <code>simpleNames</code> set. @param klassList The list of class or interface @param simpleNames a set of class simple name. @return <code>true</code> if the list contains a class or interface which name is present in the <code>simpleNames</code> set.
[ "Check", "if", "the", "list", "of", "class", "or", "interface", "contains", "a", "class", "which", "name", "is", "given", "in", "the", "<code", ">", "simpleNames<", "/", "code", ">", "set", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-raml/wisdom-source-watcher/src/main/java/org/wisdom/source/ast/visitor/ClassSourceVisitor.java#L129-L136
zxing/zxing
android-integration/src/main/java/com/google/zxing/integration/android/IntentIntegrator.java
IntentIntegrator.startActivityForResult
protected void startActivityForResult(Intent intent, int code) { """ Start an activity. This method is defined to allow different methods of activity starting for newer versions of Android and for compatibility library. @param intent Intent to start. @param code Request code for the activity @see Activity#startActivityForResult(Intent, int) @see Fragment#startActivityForResult(Intent, int) """ if (fragment == null) { activity.startActivityForResult(intent, code); } else { fragment.startActivityForResult(intent, code); } }
java
protected void startActivityForResult(Intent intent, int code) { if (fragment == null) { activity.startActivityForResult(intent, code); } else { fragment.startActivityForResult(intent, code); } }
[ "protected", "void", "startActivityForResult", "(", "Intent", "intent", ",", "int", "code", ")", "{", "if", "(", "fragment", "==", "null", ")", "{", "activity", ".", "startActivityForResult", "(", "intent", ",", "code", ")", ";", "}", "else", "{", "fragment", ".", "startActivityForResult", "(", "intent", ",", "code", ")", ";", "}", "}" ]
Start an activity. This method is defined to allow different methods of activity starting for newer versions of Android and for compatibility library. @param intent Intent to start. @param code Request code for the activity @see Activity#startActivityForResult(Intent, int) @see Fragment#startActivityForResult(Intent, int)
[ "Start", "an", "activity", ".", "This", "method", "is", "defined", "to", "allow", "different", "methods", "of", "activity", "starting", "for", "newer", "versions", "of", "Android", "and", "for", "compatibility", "library", "." ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android-integration/src/main/java/com/google/zxing/integration/android/IntentIntegrator.java#L342-L348
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java
ReUtil.get
public static String get(Pattern pattern, CharSequence content, int groupIndex) { """ 获得匹配的字符串,对应分组0表示整个匹配内容,1表示第一个括号分组内容,依次类推 @param pattern 编译后的正则模式 @param content 被匹配的内容 @param groupIndex 匹配正则的分组序号,0表示整个匹配内容,1表示第一个括号分组内容,依次类推 @return 匹配后得到的字符串,未匹配返回null """ if (null == content || null == pattern) { return null; } final Matcher matcher = pattern.matcher(content); if (matcher.find()) { return matcher.group(groupIndex); } return null; }
java
public static String get(Pattern pattern, CharSequence content, int groupIndex) { if (null == content || null == pattern) { return null; } final Matcher matcher = pattern.matcher(content); if (matcher.find()) { return matcher.group(groupIndex); } return null; }
[ "public", "static", "String", "get", "(", "Pattern", "pattern", ",", "CharSequence", "content", ",", "int", "groupIndex", ")", "{", "if", "(", "null", "==", "content", "||", "null", "==", "pattern", ")", "{", "return", "null", ";", "}", "final", "Matcher", "matcher", "=", "pattern", ".", "matcher", "(", "content", ")", ";", "if", "(", "matcher", ".", "find", "(", ")", ")", "{", "return", "matcher", ".", "group", "(", "groupIndex", ")", ";", "}", "return", "null", ";", "}" ]
获得匹配的字符串,对应分组0表示整个匹配内容,1表示第一个括号分组内容,依次类推 @param pattern 编译后的正则模式 @param content 被匹配的内容 @param groupIndex 匹配正则的分组序号,0表示整个匹配内容,1表示第一个括号分组内容,依次类推 @return 匹配后得到的字符串,未匹配返回null
[ "获得匹配的字符串,对应分组0表示整个匹配内容,1表示第一个括号分组内容,依次类推" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java#L111-L121
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/locking/RemoteLockMapImpl.java
RemoteLockMapImpl.removeReader
public void removeReader(TransactionImpl tx, Object obj) { """ remove a reader lock entry for transaction tx on object obj from the persistent storage. """ try { LockEntry lock = new LockEntry(new Identity(obj,getBroker()).toString(), tx.getGUID()); removeReaderRemote(lock); } catch (Throwable t) { log.error("Cannot remove LockEntry for object " + obj + " in transaction " + tx); } }
java
public void removeReader(TransactionImpl tx, Object obj) { try { LockEntry lock = new LockEntry(new Identity(obj,getBroker()).toString(), tx.getGUID()); removeReaderRemote(lock); } catch (Throwable t) { log.error("Cannot remove LockEntry for object " + obj + " in transaction " + tx); } }
[ "public", "void", "removeReader", "(", "TransactionImpl", "tx", ",", "Object", "obj", ")", "{", "try", "{", "LockEntry", "lock", "=", "new", "LockEntry", "(", "new", "Identity", "(", "obj", ",", "getBroker", "(", ")", ")", ".", "toString", "(", ")", ",", "tx", ".", "getGUID", "(", ")", ")", ";", "removeReaderRemote", "(", "lock", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "log", ".", "error", "(", "\"Cannot remove LockEntry for object \"", "+", "obj", "+", "\" in transaction \"", "+", "tx", ")", ";", "}", "}" ]
remove a reader lock entry for transaction tx on object obj from the persistent storage.
[ "remove", "a", "reader", "lock", "entry", "for", "transaction", "tx", "on", "object", "obj", "from", "the", "persistent", "storage", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/locking/RemoteLockMapImpl.java#L245-L256
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsApiMessageImpl.java
JsApiMessageImpl.getMQMDSetPropertiesMap
final JsMsgMap getMQMDSetPropertiesMap() { """ Helper method used by the main Message Property methods to obtain any JMS_IBM_MQMD_ Properties explicitly set, in the form of a map. <p> The method has package level visibility as it is used by JsJmsMessageImpl and JsSdoMessageimpl. @return A JsMsgMap containing the Message Property name-value pairs. """ if (mqMdSetPropertiesMap == null) { // There will not usually be any set MQMD properties, so the JMF choice defaults to // to empty (and will definitely be empty if the message has arrived from a // pre-v7 WAS). This is different from the other maps which default to empty lists. if (getHdr2().getChoiceField(JsHdr2Access.MQMDPROPERTIES) == JsHdr2Access.IS_MQMDPROPERTIES_MAP) { List<String> keys = (List<String>) getHdr2().getField(JsHdr2Access.MQMDPROPERTIES_MAP_NAME); List<Object> values = (List<Object>) getHdr2().getField(JsHdr2Access.MQMDPROPERTIES_MAP_VALUE); mqMdSetPropertiesMap = new JsMsgMap(keys, values); } else { mqMdSetPropertiesMap = new JsMsgMap(null, null); } } return mqMdSetPropertiesMap; }
java
final JsMsgMap getMQMDSetPropertiesMap() { if (mqMdSetPropertiesMap == null) { // There will not usually be any set MQMD properties, so the JMF choice defaults to // to empty (and will definitely be empty if the message has arrived from a // pre-v7 WAS). This is different from the other maps which default to empty lists. if (getHdr2().getChoiceField(JsHdr2Access.MQMDPROPERTIES) == JsHdr2Access.IS_MQMDPROPERTIES_MAP) { List<String> keys = (List<String>) getHdr2().getField(JsHdr2Access.MQMDPROPERTIES_MAP_NAME); List<Object> values = (List<Object>) getHdr2().getField(JsHdr2Access.MQMDPROPERTIES_MAP_VALUE); mqMdSetPropertiesMap = new JsMsgMap(keys, values); } else { mqMdSetPropertiesMap = new JsMsgMap(null, null); } } return mqMdSetPropertiesMap; }
[ "final", "JsMsgMap", "getMQMDSetPropertiesMap", "(", ")", "{", "if", "(", "mqMdSetPropertiesMap", "==", "null", ")", "{", "// There will not usually be any set MQMD properties, so the JMF choice defaults to", "// to empty (and will definitely be empty if the message has arrived from a", "// pre-v7 WAS). This is different from the other maps which default to empty lists.", "if", "(", "getHdr2", "(", ")", ".", "getChoiceField", "(", "JsHdr2Access", ".", "MQMDPROPERTIES", ")", "==", "JsHdr2Access", ".", "IS_MQMDPROPERTIES_MAP", ")", "{", "List", "<", "String", ">", "keys", "=", "(", "List", "<", "String", ">", ")", "getHdr2", "(", ")", ".", "getField", "(", "JsHdr2Access", ".", "MQMDPROPERTIES_MAP_NAME", ")", ";", "List", "<", "Object", ">", "values", "=", "(", "List", "<", "Object", ">", ")", "getHdr2", "(", ")", ".", "getField", "(", "JsHdr2Access", ".", "MQMDPROPERTIES_MAP_VALUE", ")", ";", "mqMdSetPropertiesMap", "=", "new", "JsMsgMap", "(", "keys", ",", "values", ")", ";", "}", "else", "{", "mqMdSetPropertiesMap", "=", "new", "JsMsgMap", "(", "null", ",", "null", ")", ";", "}", "}", "return", "mqMdSetPropertiesMap", ";", "}" ]
Helper method used by the main Message Property methods to obtain any JMS_IBM_MQMD_ Properties explicitly set, in the form of a map. <p> The method has package level visibility as it is used by JsJmsMessageImpl and JsSdoMessageimpl. @return A JsMsgMap containing the Message Property name-value pairs.
[ "Helper", "method", "used", "by", "the", "main", "Message", "Property", "methods", "to", "obtain", "any", "JMS_IBM_MQMD_", "Properties", "explicitly", "set", "in", "the", "form", "of", "a", "map", ".", "<p", ">", "The", "method", "has", "package", "level", "visibility", "as", "it", "is", "used", "by", "JsJmsMessageImpl", "and", "JsSdoMessageimpl", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsApiMessageImpl.java#L932-L947
threerings/narya
core/src/main/java/com/threerings/presents/peer/server/PeerManager.java
PeerManager.queryLock
public void queryLock (NodeObject.Lock lock, ResultListener<String> listener) { """ Determines the owner of the specified lock, waiting for any resolution to complete before notifying the supplied listener. """ // if it's being resolved, add the listener to the list LockHandler handler = _locks.get(lock); if (handler != null) { handler.listeners.add(listener); return; } // otherwise, return its present value listener.requestCompleted(queryLock(lock)); }
java
public void queryLock (NodeObject.Lock lock, ResultListener<String> listener) { // if it's being resolved, add the listener to the list LockHandler handler = _locks.get(lock); if (handler != null) { handler.listeners.add(listener); return; } // otherwise, return its present value listener.requestCompleted(queryLock(lock)); }
[ "public", "void", "queryLock", "(", "NodeObject", ".", "Lock", "lock", ",", "ResultListener", "<", "String", ">", "listener", ")", "{", "// if it's being resolved, add the listener to the list", "LockHandler", "handler", "=", "_locks", ".", "get", "(", "lock", ")", ";", "if", "(", "handler", "!=", "null", ")", "{", "handler", ".", "listeners", ".", "add", "(", "listener", ")", ";", "return", ";", "}", "// otherwise, return its present value", "listener", ".", "requestCompleted", "(", "queryLock", "(", "lock", ")", ")", ";", "}" ]
Determines the owner of the specified lock, waiting for any resolution to complete before notifying the supplied listener.
[ "Determines", "the", "owner", "of", "the", "specified", "lock", "waiting", "for", "any", "resolution", "to", "complete", "before", "notifying", "the", "supplied", "listener", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L876-L887
mlhartme/sushi
src/main/java/net/oneandone/sushi/fs/ssh/SshNode.java
SshNode.copyFileTo
@Override public long copyFileTo(OutputStream dest, long skip) throws FileNotFoundException, CopyFileToException { """ This is the core function to read an ssh node. Does not close dest. @throws FileNotFoundException if this is not a file """ ChannelSftp sftp; Progress monitor; try { sftp = alloc(); monitor = new Progress(); try { sftp.get(escape(slashPath), dest, monitor, ChannelSftp.RESUME, skip); } finally { free(sftp); } return Math.max(0, monitor.sum - skip); } catch (SftpException e) { if (e.id == 2 || e.id == 4) { throw new FileNotFoundException(this); } throw new CopyFileToException(this, e); } catch (JSchException e) { throw new CopyFileToException(this, e); } }
java
@Override public long copyFileTo(OutputStream dest, long skip) throws FileNotFoundException, CopyFileToException { ChannelSftp sftp; Progress monitor; try { sftp = alloc(); monitor = new Progress(); try { sftp.get(escape(slashPath), dest, monitor, ChannelSftp.RESUME, skip); } finally { free(sftp); } return Math.max(0, monitor.sum - skip); } catch (SftpException e) { if (e.id == 2 || e.id == 4) { throw new FileNotFoundException(this); } throw new CopyFileToException(this, e); } catch (JSchException e) { throw new CopyFileToException(this, e); } }
[ "@", "Override", "public", "long", "copyFileTo", "(", "OutputStream", "dest", ",", "long", "skip", ")", "throws", "FileNotFoundException", ",", "CopyFileToException", "{", "ChannelSftp", "sftp", ";", "Progress", "monitor", ";", "try", "{", "sftp", "=", "alloc", "(", ")", ";", "monitor", "=", "new", "Progress", "(", ")", ";", "try", "{", "sftp", ".", "get", "(", "escape", "(", "slashPath", ")", ",", "dest", ",", "monitor", ",", "ChannelSftp", ".", "RESUME", ",", "skip", ")", ";", "}", "finally", "{", "free", "(", "sftp", ")", ";", "}", "return", "Math", ".", "max", "(", "0", ",", "monitor", ".", "sum", "-", "skip", ")", ";", "}", "catch", "(", "SftpException", "e", ")", "{", "if", "(", "e", ".", "id", "==", "2", "||", "e", ".", "id", "==", "4", ")", "{", "throw", "new", "FileNotFoundException", "(", "this", ")", ";", "}", "throw", "new", "CopyFileToException", "(", "this", ",", "e", ")", ";", "}", "catch", "(", "JSchException", "e", ")", "{", "throw", "new", "CopyFileToException", "(", "this", ",", "e", ")", ";", "}", "}" ]
This is the core function to read an ssh node. Does not close dest. @throws FileNotFoundException if this is not a file
[ "This", "is", "the", "core", "function", "to", "read", "an", "ssh", "node", ".", "Does", "not", "close", "dest", "." ]
train
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/ssh/SshNode.java#L706-L728
Domo42/saga-lib
saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaInstanceFactory.java
SagaInstanceFactory.continueExisting
public Saga continueExisting(final Class<? extends Saga> sagaType, final SagaState state) throws ExecutionException { """ Creates a new saga instance attaching an existing saga state. @throws ExecutionException Is thrown in case no provider can be found to create an instance. The actual cause can be inspected by {@link ExecutionException#getCause()}. """ // do not catch exception as in create new // if there is an exception during creation, although we want to continue // something is terribly wrong -> it has worked at least once before. Saga saga = createNewSagaInstance(sagaType); saga.setState(state); return saga; }
java
public Saga continueExisting(final Class<? extends Saga> sagaType, final SagaState state) throws ExecutionException { // do not catch exception as in create new // if there is an exception during creation, although we want to continue // something is terribly wrong -> it has worked at least once before. Saga saga = createNewSagaInstance(sagaType); saga.setState(state); return saga; }
[ "public", "Saga", "continueExisting", "(", "final", "Class", "<", "?", "extends", "Saga", ">", "sagaType", ",", "final", "SagaState", "state", ")", "throws", "ExecutionException", "{", "// do not catch exception as in create new", "// if there is an exception during creation, although we want to continue", "// something is terribly wrong -> it has worked at least once before.", "Saga", "saga", "=", "createNewSagaInstance", "(", "sagaType", ")", ";", "saga", ".", "setState", "(", "state", ")", ";", "return", "saga", ";", "}" ]
Creates a new saga instance attaching an existing saga state. @throws ExecutionException Is thrown in case no provider can be found to create an instance. The actual cause can be inspected by {@link ExecutionException#getCause()}.
[ "Creates", "a", "new", "saga", "instance", "attaching", "an", "existing", "saga", "state", "." ]
train
https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaInstanceFactory.java#L77-L84
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/CharacterDecoder.java
CharacterDecoder.readFully
protected int readFully(InputStream in, byte buffer[], int offset, int len) throws java.io.IOException { """ This method works around the bizarre semantics of BufferedInputStream's read method. """ for (int i = 0; i < len; i++) { int q = in.read(); if (q == -1) return ((i == 0) ? -1 : i); buffer[i+offset] = (byte)q; } return len; }
java
protected int readFully(InputStream in, byte buffer[], int offset, int len) throws java.io.IOException { for (int i = 0; i < len; i++) { int q = in.read(); if (q == -1) return ((i == 0) ? -1 : i); buffer[i+offset] = (byte)q; } return len; }
[ "protected", "int", "readFully", "(", "InputStream", "in", ",", "byte", "buffer", "[", "]", ",", "int", "offset", ",", "int", "len", ")", "throws", "java", ".", "io", ".", "IOException", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "int", "q", "=", "in", ".", "read", "(", ")", ";", "if", "(", "q", "==", "-", "1", ")", "return", "(", "(", "i", "==", "0", ")", "?", "-", "1", ":", "i", ")", ";", "buffer", "[", "i", "+", "offset", "]", "=", "(", "byte", ")", "q", ";", "}", "return", "len", ";", "}" ]
This method works around the bizarre semantics of BufferedInputStream's read method.
[ "This", "method", "works", "around", "the", "bizarre", "semantics", "of", "BufferedInputStream", "s", "read", "method", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/CharacterDecoder.java#L133-L142
minio/minio-java
api/src/main/java/io/minio/MinioClient.java
MinioClient.listObjectsV2
private ListBucketResult listObjectsV2(String bucketName, String continuationToken, String prefix, String delimiter) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException { """ Returns {@link ListBucketResult} of given bucket, marker, prefix and delimiter. @param bucketName Bucket name. @param continuationToken Marker string. List objects whose name is greater than `marker`. @param prefix Prefix string. List objects whose name starts with `prefix`. @param delimiter Delimiter string. Group objects whose name contains `delimiter`. """ Map<String,String> queryParamMap = new HashMap<>(); queryParamMap.put("list-type", "2"); if (continuationToken != null) { queryParamMap.put("continuation-token", continuationToken); } if (prefix != null) { queryParamMap.put("prefix", prefix); } else { queryParamMap.put("prefix", ""); } if (delimiter != null) { queryParamMap.put("delimiter", delimiter); } else { queryParamMap.put("delimiter", ""); } HttpResponse response = executeGet(bucketName, null, null, queryParamMap); ListBucketResult result = new ListBucketResult(); result.parseXml(response.body().charStream()); response.body().close(); return result; }
java
private ListBucketResult listObjectsV2(String bucketName, String continuationToken, String prefix, String delimiter) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException { Map<String,String> queryParamMap = new HashMap<>(); queryParamMap.put("list-type", "2"); if (continuationToken != null) { queryParamMap.put("continuation-token", continuationToken); } if (prefix != null) { queryParamMap.put("prefix", prefix); } else { queryParamMap.put("prefix", ""); } if (delimiter != null) { queryParamMap.put("delimiter", delimiter); } else { queryParamMap.put("delimiter", ""); } HttpResponse response = executeGet(bucketName, null, null, queryParamMap); ListBucketResult result = new ListBucketResult(); result.parseXml(response.body().charStream()); response.body().close(); return result; }
[ "private", "ListBucketResult", "listObjectsV2", "(", "String", "bucketName", ",", "String", "continuationToken", ",", "String", "prefix", ",", "String", "delimiter", ")", "throws", "InvalidBucketNameException", ",", "NoSuchAlgorithmException", ",", "InsufficientDataException", ",", "IOException", ",", "InvalidKeyException", ",", "NoResponseException", ",", "XmlPullParserException", ",", "ErrorResponseException", ",", "InternalException", "{", "Map", "<", "String", ",", "String", ">", "queryParamMap", "=", "new", "HashMap", "<>", "(", ")", ";", "queryParamMap", ".", "put", "(", "\"list-type\"", ",", "\"2\"", ")", ";", "if", "(", "continuationToken", "!=", "null", ")", "{", "queryParamMap", ".", "put", "(", "\"continuation-token\"", ",", "continuationToken", ")", ";", "}", "if", "(", "prefix", "!=", "null", ")", "{", "queryParamMap", ".", "put", "(", "\"prefix\"", ",", "prefix", ")", ";", "}", "else", "{", "queryParamMap", ".", "put", "(", "\"prefix\"", ",", "\"\"", ")", ";", "}", "if", "(", "delimiter", "!=", "null", ")", "{", "queryParamMap", ".", "put", "(", "\"delimiter\"", ",", "delimiter", ")", ";", "}", "else", "{", "queryParamMap", ".", "put", "(", "\"delimiter\"", ",", "\"\"", ")", ";", "}", "HttpResponse", "response", "=", "executeGet", "(", "bucketName", ",", "null", ",", "null", ",", "queryParamMap", ")", ";", "ListBucketResult", "result", "=", "new", "ListBucketResult", "(", ")", ";", "result", ".", "parseXml", "(", "response", ".", "body", "(", ")", ".", "charStream", "(", ")", ")", ";", "response", ".", "body", "(", ")", ".", "close", "(", ")", ";", "return", "result", ";", "}" ]
Returns {@link ListBucketResult} of given bucket, marker, prefix and delimiter. @param bucketName Bucket name. @param continuationToken Marker string. List objects whose name is greater than `marker`. @param prefix Prefix string. List objects whose name starts with `prefix`. @param delimiter Delimiter string. Group objects whose name contains `delimiter`.
[ "Returns", "{", "@link", "ListBucketResult", "}", "of", "given", "bucket", "marker", "prefix", "and", "delimiter", "." ]
train
https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/MinioClient.java#L3015-L3044
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java
Log.printRawLines
public static void printRawLines(PrintWriter writer, String msg) { """ Print the text of a message, translating newlines appropriately for the platform. """ int nl; while ((nl = msg.indexOf('\n')) != -1) { writer.println(msg.substring(0, nl)); msg = msg.substring(nl+1); } if (msg.length() != 0) writer.println(msg); }
java
public static void printRawLines(PrintWriter writer, String msg) { int nl; while ((nl = msg.indexOf('\n')) != -1) { writer.println(msg.substring(0, nl)); msg = msg.substring(nl+1); } if (msg.length() != 0) writer.println(msg); }
[ "public", "static", "void", "printRawLines", "(", "PrintWriter", "writer", ",", "String", "msg", ")", "{", "int", "nl", ";", "while", "(", "(", "nl", "=", "msg", ".", "indexOf", "(", "'", "'", ")", ")", "!=", "-", "1", ")", "{", "writer", ".", "println", "(", "msg", ".", "substring", "(", "0", ",", "nl", ")", ")", ";", "msg", "=", "msg", ".", "substring", "(", "nl", "+", "1", ")", ";", "}", "if", "(", "msg", ".", "length", "(", ")", "!=", "0", ")", "writer", ".", "println", "(", "msg", ")", ";", "}" ]
Print the text of a message, translating newlines appropriately for the platform.
[ "Print", "the", "text", "of", "a", "message", "translating", "newlines", "appropriately", "for", "the", "platform", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java#L615-L622
GCRC/nunaliit
nunaliit2-dbWeb/src/main/java/ca/carleton/gcrc/dbWeb/DbWebServlet.java
DbWebServlet.performQuery
private void performQuery(HttpServletRequest request, HttpServletResponse response) throws Exception { """ Perform a SQL query of a specified table, that must be accessible via dbSec. The http parms must include: table=<tableName> specifying a valid and accessible table. the http parms may include one or more (each) of: select=<e1>[,<e2>[,...]] where each <ei> is the name of a valid and accessible column or is an expression of one of the forms: sum(<c>), max(<c>), min(<c>) where <c> is the name of a valid and accessible column. groupBy=<c1>[,<c2>[,...]] where each <ci> is the name of a valid and accessible column. where=<whereclause> where multiple where clauses are combined using logical AND and <whereClause> is of the form: <c>,<comparator> where <c> is the name of a valid and accessible column, and <comparator> is one of: eq(<value>) where value is a valid comparison value for the column's data type. ne(<value>) where value is a valid comparison value for the column's data type. ge(<value>) where value is a valid comparison value for the column's data type. le(<value>) where value is a valid comparison value for the column's data type. gt(<value>) where value is a valid comparison value for the column's data type. lt(<value>) where value is a valid comparison value for the column's data type. isNull. isNotNull. @param request http request containing the query parameters. @param response http response to be sent. @throws Exception (for a variety of reasons detected while parsing and validating the http parms). """ User user = AuthenticationUtils.getUserFromRequest(request); String tableName = getTableNameFromRequest(request); DbTableAccess tableAccess = DbTableAccess.getAccess(dbSecurity, tableName, new DbUserAdaptor(user)); List<RecordSelector> whereMap = getRecordSelectorsFromRequest(request); List<FieldSelector> selectSpecifiers = getFieldSelectorsFromRequest(request); List<FieldSelector> groupByColumnNames = getGroupByFromRequest(request); List<OrderSpecifier> orderBy = getOrderByList(request); Integer limit = getLimitFromRequest(request); Integer offset = getOffsetFromRequest(request); JSONArray queriedObjects = tableAccess.query( whereMap ,selectSpecifiers ,groupByColumnNames ,orderBy ,limit ,offset ); JSONObject obj = new JSONObject(); obj.put("queried", queriedObjects); sendJsonResponse(response, obj); }
java
private void performQuery(HttpServletRequest request, HttpServletResponse response) throws Exception { User user = AuthenticationUtils.getUserFromRequest(request); String tableName = getTableNameFromRequest(request); DbTableAccess tableAccess = DbTableAccess.getAccess(dbSecurity, tableName, new DbUserAdaptor(user)); List<RecordSelector> whereMap = getRecordSelectorsFromRequest(request); List<FieldSelector> selectSpecifiers = getFieldSelectorsFromRequest(request); List<FieldSelector> groupByColumnNames = getGroupByFromRequest(request); List<OrderSpecifier> orderBy = getOrderByList(request); Integer limit = getLimitFromRequest(request); Integer offset = getOffsetFromRequest(request); JSONArray queriedObjects = tableAccess.query( whereMap ,selectSpecifiers ,groupByColumnNames ,orderBy ,limit ,offset ); JSONObject obj = new JSONObject(); obj.put("queried", queriedObjects); sendJsonResponse(response, obj); }
[ "private", "void", "performQuery", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "Exception", "{", "User", "user", "=", "AuthenticationUtils", ".", "getUserFromRequest", "(", "request", ")", ";", "String", "tableName", "=", "getTableNameFromRequest", "(", "request", ")", ";", "DbTableAccess", "tableAccess", "=", "DbTableAccess", ".", "getAccess", "(", "dbSecurity", ",", "tableName", ",", "new", "DbUserAdaptor", "(", "user", ")", ")", ";", "List", "<", "RecordSelector", ">", "whereMap", "=", "getRecordSelectorsFromRequest", "(", "request", ")", ";", "List", "<", "FieldSelector", ">", "selectSpecifiers", "=", "getFieldSelectorsFromRequest", "(", "request", ")", ";", "List", "<", "FieldSelector", ">", "groupByColumnNames", "=", "getGroupByFromRequest", "(", "request", ")", ";", "List", "<", "OrderSpecifier", ">", "orderBy", "=", "getOrderByList", "(", "request", ")", ";", "Integer", "limit", "=", "getLimitFromRequest", "(", "request", ")", ";", "Integer", "offset", "=", "getOffsetFromRequest", "(", "request", ")", ";", "JSONArray", "queriedObjects", "=", "tableAccess", ".", "query", "(", "whereMap", ",", "selectSpecifiers", ",", "groupByColumnNames", ",", "orderBy", ",", "limit", ",", "offset", ")", ";", "JSONObject", "obj", "=", "new", "JSONObject", "(", ")", ";", "obj", ".", "put", "(", "\"queried\"", ",", "queriedObjects", ")", ";", "sendJsonResponse", "(", "response", ",", "obj", ")", ";", "}" ]
Perform a SQL query of a specified table, that must be accessible via dbSec. The http parms must include: table=<tableName> specifying a valid and accessible table. the http parms may include one or more (each) of: select=<e1>[,<e2>[,...]] where each <ei> is the name of a valid and accessible column or is an expression of one of the forms: sum(<c>), max(<c>), min(<c>) where <c> is the name of a valid and accessible column. groupBy=<c1>[,<c2>[,...]] where each <ci> is the name of a valid and accessible column. where=<whereclause> where multiple where clauses are combined using logical AND and <whereClause> is of the form: <c>,<comparator> where <c> is the name of a valid and accessible column, and <comparator> is one of: eq(<value>) where value is a valid comparison value for the column's data type. ne(<value>) where value is a valid comparison value for the column's data type. ge(<value>) where value is a valid comparison value for the column's data type. le(<value>) where value is a valid comparison value for the column's data type. gt(<value>) where value is a valid comparison value for the column's data type. lt(<value>) where value is a valid comparison value for the column's data type. isNull. isNotNull. @param request http request containing the query parameters. @param response http response to be sent. @throws Exception (for a variety of reasons detected while parsing and validating the http parms).
[ "Perform", "a", "SQL", "query", "of", "a", "specified", "table", "that", "must", "be", "accessible", "via", "dbSec", "." ]
train
https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-dbWeb/src/main/java/ca/carleton/gcrc/dbWeb/DbWebServlet.java#L231-L257
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/APIClient.java
APIClient.copyIndex
public JSONObject copyIndex(String srcIndexName, String dstIndexName, List<String> scopes) throws AlgoliaException { """ Copy an existing index. @param srcIndexName the name of index to copy. @param dstIndexName the new index name that will contains a copy of srcIndexName (destination will be overriten if it already exist). @param scopes the list of scopes to copy """ return operationOnIndex("copy", srcIndexName, dstIndexName, scopes, RequestOptions.empty); }
java
public JSONObject copyIndex(String srcIndexName, String dstIndexName, List<String> scopes) throws AlgoliaException { return operationOnIndex("copy", srcIndexName, dstIndexName, scopes, RequestOptions.empty); }
[ "public", "JSONObject", "copyIndex", "(", "String", "srcIndexName", ",", "String", "dstIndexName", ",", "List", "<", "String", ">", "scopes", ")", "throws", "AlgoliaException", "{", "return", "operationOnIndex", "(", "\"copy\"", ",", "srcIndexName", ",", "dstIndexName", ",", "scopes", ",", "RequestOptions", ".", "empty", ")", ";", "}" ]
Copy an existing index. @param srcIndexName the name of index to copy. @param dstIndexName the new index name that will contains a copy of srcIndexName (destination will be overriten if it already exist). @param scopes the list of scopes to copy
[ "Copy", "an", "existing", "index", "." ]
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/APIClient.java#L373-L375
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.patchClosedListAsync
public Observable<OperationStatus> patchClosedListAsync(UUID appId, String versionId, UUID clEntityId, PatchClosedListOptionalParameter patchClosedListOptionalParameter) { """ Adds a batch of sublists to an existing closedlist. @param appId The application ID. @param versionId The version ID. @param clEntityId The closed list model ID. @param patchClosedListOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object """ return patchClosedListWithServiceResponseAsync(appId, versionId, clEntityId, patchClosedListOptionalParameter).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
java
public Observable<OperationStatus> patchClosedListAsync(UUID appId, String versionId, UUID clEntityId, PatchClosedListOptionalParameter patchClosedListOptionalParameter) { return patchClosedListWithServiceResponseAsync(appId, versionId, clEntityId, patchClosedListOptionalParameter).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatus", ">", "patchClosedListAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "clEntityId", ",", "PatchClosedListOptionalParameter", "patchClosedListOptionalParameter", ")", "{", "return", "patchClosedListWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "clEntityId", ",", "patchClosedListOptionalParameter", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "OperationStatus", ">", ",", "OperationStatus", ">", "(", ")", "{", "@", "Override", "public", "OperationStatus", "call", "(", "ServiceResponse", "<", "OperationStatus", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Adds a batch of sublists to an existing closedlist. @param appId The application ID. @param versionId The version ID. @param clEntityId The closed list model ID. @param patchClosedListOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object
[ "Adds", "a", "batch", "of", "sublists", "to", "an", "existing", "closedlist", "." ]
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#L4439-L4446
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/store/BaseHashMap.java
BaseHashMap.getAccessCountCeiling
public int getAccessCountCeiling(int count, int margin) { """ Return the max accessCount value for count elements with the lowest access count. Always return at least accessMin + 1 """ return ArrayCounter.rank(accessTable, hashIndex.newNodePointer, count, accessMin + 1, accessCount, margin); }
java
public int getAccessCountCeiling(int count, int margin) { return ArrayCounter.rank(accessTable, hashIndex.newNodePointer, count, accessMin + 1, accessCount, margin); }
[ "public", "int", "getAccessCountCeiling", "(", "int", "count", ",", "int", "margin", ")", "{", "return", "ArrayCounter", ".", "rank", "(", "accessTable", ",", "hashIndex", ".", "newNodePointer", ",", "count", ",", "accessMin", "+", "1", ",", "accessCount", ",", "margin", ")", ";", "}" ]
Return the max accessCount value for count elements with the lowest access count. Always return at least accessMin + 1
[ "Return", "the", "max", "accessCount", "value", "for", "count", "elements", "with", "the", "lowest", "access", "count", ".", "Always", "return", "at", "least", "accessMin", "+", "1" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/store/BaseHashMap.java#L1098-L1101
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java
FeatureOverlayQuery.isOnAtCurrentZoom
public boolean isOnAtCurrentZoom(GoogleMap map, LatLng latLng) { """ Determine if the the feature overlay is on for the current zoom level of the map at the location @param map google map @param latLng lat lon location @return true if on @since 1.2.6 """ float zoom = MapUtils.getCurrentZoom(map); boolean on = isOnAtCurrentZoom(zoom, latLng); return on; }
java
public boolean isOnAtCurrentZoom(GoogleMap map, LatLng latLng) { float zoom = MapUtils.getCurrentZoom(map); boolean on = isOnAtCurrentZoom(zoom, latLng); return on; }
[ "public", "boolean", "isOnAtCurrentZoom", "(", "GoogleMap", "map", ",", "LatLng", "latLng", ")", "{", "float", "zoom", "=", "MapUtils", ".", "getCurrentZoom", "(", "map", ")", ";", "boolean", "on", "=", "isOnAtCurrentZoom", "(", "zoom", ",", "latLng", ")", ";", "return", "on", ";", "}" ]
Determine if the the feature overlay is on for the current zoom level of the map at the location @param map google map @param latLng lat lon location @return true if on @since 1.2.6
[ "Determine", "if", "the", "the", "feature", "overlay", "is", "on", "for", "the", "current", "zoom", "level", "of", "the", "map", "at", "the", "location" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java#L173-L177
DDTH/ddth-kafka
src/main/java/com/github/ddth/kafka/KafkaClient.java
KafkaClient.seekToBeginning
public boolean seekToBeginning(String consumerGroupId, String topic) { """ Seeks to the beginning of all assigned partitions of a topic. @param consumerGroupId @param topic @return {@code true} if the consumer has subscribed to the specified topic, {@code false} otherwise. @since 1.2.0 """ KafkaMsgConsumer consumer = getKafkaConsumer(consumerGroupId, false); return consumer.seekToBeginning(topic); }
java
public boolean seekToBeginning(String consumerGroupId, String topic) { KafkaMsgConsumer consumer = getKafkaConsumer(consumerGroupId, false); return consumer.seekToBeginning(topic); }
[ "public", "boolean", "seekToBeginning", "(", "String", "consumerGroupId", ",", "String", "topic", ")", "{", "KafkaMsgConsumer", "consumer", "=", "getKafkaConsumer", "(", "consumerGroupId", ",", "false", ")", ";", "return", "consumer", ".", "seekToBeginning", "(", "topic", ")", ";", "}" ]
Seeks to the beginning of all assigned partitions of a topic. @param consumerGroupId @param topic @return {@code true} if the consumer has subscribed to the specified topic, {@code false} otherwise. @since 1.2.0
[ "Seeks", "to", "the", "beginning", "of", "all", "assigned", "partitions", "of", "a", "topic", "." ]
train
https://github.com/DDTH/ddth-kafka/blob/aaeb8536e28a109ac0b69022f0ea4bbf5696b76f/src/main/java/com/github/ddth/kafka/KafkaClient.java#L434-L437
canhnt/sne-xacml
sne-xacml/src/main/java/nl/uva/sne/midd/builders/MIDDCombiner.java
MIDDCombiner.combineInternalNodeStates
private InternalNodeState combineInternalNodeStates(InternalNodeState inState, ExternalNode3 externalNode) { """ Combine an indeterminate state of an internal node with an external node which use indicated combining algorithm. @param inState @param externalNode @return """ ExternalNode3 n1 = inState.getExternalNode(); ExternalNode3 n = combineExternalNodes(n1, externalNode); return new InternalNodeState(n); }
java
private InternalNodeState combineInternalNodeStates(InternalNodeState inState, ExternalNode3 externalNode) { ExternalNode3 n1 = inState.getExternalNode(); ExternalNode3 n = combineExternalNodes(n1, externalNode); return new InternalNodeState(n); }
[ "private", "InternalNodeState", "combineInternalNodeStates", "(", "InternalNodeState", "inState", ",", "ExternalNode3", "externalNode", ")", "{", "ExternalNode3", "n1", "=", "inState", ".", "getExternalNode", "(", ")", ";", "ExternalNode3", "n", "=", "combineExternalNodes", "(", "n1", ",", "externalNode", ")", ";", "return", "new", "InternalNodeState", "(", "n", ")", ";", "}" ]
Combine an indeterminate state of an internal node with an external node which use indicated combining algorithm. @param inState @param externalNode @return
[ "Combine", "an", "indeterminate", "state", "of", "an", "internal", "node", "with", "an", "external", "node", "which", "use", "indicated", "combining", "algorithm", "." ]
train
https://github.com/canhnt/sne-xacml/blob/7ffca16bf558d2c3ee16181d926f066ab1de75b2/sne-xacml/src/main/java/nl/uva/sne/midd/builders/MIDDCombiner.java#L352-L359
wouterd/docker-maven-plugin
src/main/java/net/wouterdanes/docker/maven/AbstractDockerMojo.java
AbstractDockerMojo.handleDockerException
protected void handleDockerException(final String message, DockerException e) throws MojoFailureException { """ Common method for re-throwing a {@link DockerException} as a {@link MojoFailureException} with a more specific error message. Extract into a common, template method in this base class to allow pre "verify" Mojos to handle errors differently. @param message The message for the exception @param e The Docker Exception @throws org.apache.maven.plugin.MojoFailureException to indicate Plugin failure """ Optional<String> apiResponse = e.getApiResponse(); String exceptionMessage = apiResponse.isPresent() ? (message + "\nApi response:\n" + apiResponse.get()) : message; throw new MojoFailureException(exceptionMessage, e); }
java
protected void handleDockerException(final String message, DockerException e) throws MojoFailureException { Optional<String> apiResponse = e.getApiResponse(); String exceptionMessage = apiResponse.isPresent() ? (message + "\nApi response:\n" + apiResponse.get()) : message; throw new MojoFailureException(exceptionMessage, e); }
[ "protected", "void", "handleDockerException", "(", "final", "String", "message", ",", "DockerException", "e", ")", "throws", "MojoFailureException", "{", "Optional", "<", "String", ">", "apiResponse", "=", "e", ".", "getApiResponse", "(", ")", ";", "String", "exceptionMessage", "=", "apiResponse", ".", "isPresent", "(", ")", "?", "(", "message", "+", "\"\\nApi response:\\n\"", "+", "apiResponse", ".", "get", "(", ")", ")", ":", "message", ";", "throw", "new", "MojoFailureException", "(", "exceptionMessage", ",", "e", ")", ";", "}" ]
Common method for re-throwing a {@link DockerException} as a {@link MojoFailureException} with a more specific error message. Extract into a common, template method in this base class to allow pre "verify" Mojos to handle errors differently. @param message The message for the exception @param e The Docker Exception @throws org.apache.maven.plugin.MojoFailureException to indicate Plugin failure
[ "Common", "method", "for", "re", "-", "throwing", "a", "{", "@link", "DockerException", "}", "as", "a", "{", "@link", "MojoFailureException", "}", "with", "a", "more", "specific", "error", "message", ".", "Extract", "into", "a", "common", "template", "method", "in", "this", "base", "class", "to", "allow", "pre", "verify", "Mojos", "to", "handle", "errors", "differently", "." ]
train
https://github.com/wouterd/docker-maven-plugin/blob/ea15f9e6c273989bb91f4228fb52cb73d00e07b3/src/main/java/net/wouterdanes/docker/maven/AbstractDockerMojo.java#L355-L361
lucmoreau/ProvToolbox
prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java
InteropFramework.writeDocument
public void writeDocument(OutputStream os, MediaType mt, Document document) { """ Write a {@link Document} to output stream, according to specified Internet Media Type @param os an {@link OutputStream} to write the Document to @param mt a {@link MediaType} @param document a {@link Document} to serialize """ ProvFormat format = mimeTypeRevMap.get(mt.toString()); writeDocument(os, format, document); }
java
public void writeDocument(OutputStream os, MediaType mt, Document document) { ProvFormat format = mimeTypeRevMap.get(mt.toString()); writeDocument(os, format, document); }
[ "public", "void", "writeDocument", "(", "OutputStream", "os", ",", "MediaType", "mt", ",", "Document", "document", ")", "{", "ProvFormat", "format", "=", "mimeTypeRevMap", ".", "get", "(", "mt", ".", "toString", "(", ")", ")", ";", "writeDocument", "(", "os", ",", "format", ",", "document", ")", ";", "}" ]
Write a {@link Document} to output stream, according to specified Internet Media Type @param os an {@link OutputStream} to write the Document to @param mt a {@link MediaType} @param document a {@link Document} to serialize
[ "Write", "a", "{" ]
train
https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java#L1064-L1067
Erudika/para
para-server/src/main/java/com/erudika/para/security/SecurityUtils.java
SecurityUtils.checkIfActive
public static UserAuthentication checkIfActive(UserAuthentication userAuth, User user, boolean throwException) { """ Checks if account is active. @param userAuth user authentication object @param user user object @param throwException throw or not @return the authentication object if {@code user.active == true} """ if (userAuth == null || user == null || user.getIdentifier() == null) { if (throwException) { throw new BadCredentialsException("Bad credentials."); } else { logger.debug("Bad credentials. {}", userAuth); return null; } } else if (!user.getActive()) { if (throwException) { throw new LockedException("Account " + user.getId() + " (" + user.getAppid() + "/" + user.getIdentifier() + ") is locked."); } else { logger.warn("Account {} ({}/{}) is locked.", user.getId(), user.getAppid(), user.getIdentifier()); return null; } } return userAuth; }
java
public static UserAuthentication checkIfActive(UserAuthentication userAuth, User user, boolean throwException) { if (userAuth == null || user == null || user.getIdentifier() == null) { if (throwException) { throw new BadCredentialsException("Bad credentials."); } else { logger.debug("Bad credentials. {}", userAuth); return null; } } else if (!user.getActive()) { if (throwException) { throw new LockedException("Account " + user.getId() + " (" + user.getAppid() + "/" + user.getIdentifier() + ") is locked."); } else { logger.warn("Account {} ({}/{}) is locked.", user.getId(), user.getAppid(), user.getIdentifier()); return null; } } return userAuth; }
[ "public", "static", "UserAuthentication", "checkIfActive", "(", "UserAuthentication", "userAuth", ",", "User", "user", ",", "boolean", "throwException", ")", "{", "if", "(", "userAuth", "==", "null", "||", "user", "==", "null", "||", "user", ".", "getIdentifier", "(", ")", "==", "null", ")", "{", "if", "(", "throwException", ")", "{", "throw", "new", "BadCredentialsException", "(", "\"Bad credentials.\"", ")", ";", "}", "else", "{", "logger", ".", "debug", "(", "\"Bad credentials. {}\"", ",", "userAuth", ")", ";", "return", "null", ";", "}", "}", "else", "if", "(", "!", "user", ".", "getActive", "(", ")", ")", "{", "if", "(", "throwException", ")", "{", "throw", "new", "LockedException", "(", "\"Account \"", "+", "user", ".", "getId", "(", ")", "+", "\" (\"", "+", "user", ".", "getAppid", "(", ")", "+", "\"/\"", "+", "user", ".", "getIdentifier", "(", ")", "+", "\") is locked.\"", ")", ";", "}", "else", "{", "logger", ".", "warn", "(", "\"Account {} ({}/{}) is locked.\"", ",", "user", ".", "getId", "(", ")", ",", "user", ".", "getAppid", "(", ")", ",", "user", ".", "getIdentifier", "(", ")", ")", ";", "return", "null", ";", "}", "}", "return", "userAuth", ";", "}" ]
Checks if account is active. @param userAuth user authentication object @param user user object @param throwException throw or not @return the authentication object if {@code user.active == true}
[ "Checks", "if", "account", "is", "active", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/security/SecurityUtils.java#L391-L409
networknt/light-4j
dump/src/main/java/com/networknt/dump/QueryParametersDumper.java
QueryParametersDumper.putDumpInfoTo
@Override protected void putDumpInfoTo(Map<String, Object> result) { """ put queryParametersMap to result. @param result a Map you want to put dumping info to. """ if(this.queryParametersMap.size() > 0) { result.put(DumpConstants.QUERY_PARAMETERS, queryParametersMap); } }
java
@Override protected void putDumpInfoTo(Map<String, Object> result) { if(this.queryParametersMap.size() > 0) { result.put(DumpConstants.QUERY_PARAMETERS, queryParametersMap); } }
[ "@", "Override", "protected", "void", "putDumpInfoTo", "(", "Map", "<", "String", ",", "Object", ">", "result", ")", "{", "if", "(", "this", ".", "queryParametersMap", ".", "size", "(", ")", ">", "0", ")", "{", "result", ".", "put", "(", "DumpConstants", ".", "QUERY_PARAMETERS", ",", "queryParametersMap", ")", ";", "}", "}" ]
put queryParametersMap to result. @param result a Map you want to put dumping info to.
[ "put", "queryParametersMap", "to", "result", "." ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/QueryParametersDumper.java#L55-L60
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/query/Criteria.java
Criteria.addLike
public void addLike(Object attribute, Object value) { """ Adds Like (LIKE) criteria, customer_name LIKE "m%ller" @see LikeCriteria @param attribute The field name to be used @param value An object representing the value of the field """ // PAW // addSelectionCriteria(ValueCriteria.buildLikeCriteria(attribute, value, getAlias())); addSelectionCriteria(ValueCriteria.buildLikeCriteria(attribute, value, getUserAlias(attribute))); }
java
public void addLike(Object attribute, Object value) { // PAW // addSelectionCriteria(ValueCriteria.buildLikeCriteria(attribute, value, getAlias())); addSelectionCriteria(ValueCriteria.buildLikeCriteria(attribute, value, getUserAlias(attribute))); }
[ "public", "void", "addLike", "(", "Object", "attribute", ",", "Object", "value", ")", "{", "// PAW\r", "// addSelectionCriteria(ValueCriteria.buildLikeCriteria(attribute, value, getAlias()));\r", "addSelectionCriteria", "(", "ValueCriteria", ".", "buildLikeCriteria", "(", "attribute", ",", "value", ",", "getUserAlias", "(", "attribute", ")", ")", ")", ";", "}" ]
Adds Like (LIKE) criteria, customer_name LIKE "m%ller" @see LikeCriteria @param attribute The field name to be used @param value An object representing the value of the field
[ "Adds", "Like", "(", "LIKE", ")", "criteria", "customer_name", "LIKE", "m%ller" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/Criteria.java#L464-L469
google/closure-compiler
src/com/google/javascript/jscomp/DevirtualizePrototypeMethods.java
DevirtualizePrototypeMethods.rewriteCall
private void rewriteCall(Node getprop, String newMethodName) { """ Rewrites object method call sites as calls to global functions that take "this" as their first argument. <p>Before: o.foo(a, b, c) <p>After: foo(o, a, b, c) """ checkArgument(getprop.isGetProp(), getprop); Node call = getprop.getParent(); checkArgument(call.isCall(), call); Node receiver = getprop.getFirstChild(); // This rewriting does not exactly preserve order of operations; the newly inserted static // method name will be resolved before `receiver` is evaluated. This is known to be safe due // to the eligibility checks earlier in the pass. // // We choose not to do a full-fidelity rewriting (e.g. using `ExpressionDecomposer`) because // doing so means extracting `receiver` into a new variable at each call-site. This has a // significant code-size impact (circa 2018-11-19). getprop.removeChild(receiver); call.replaceChild(getprop, receiver); call.addChildToFront(IR.name(newMethodName).srcref(getprop)); if (receiver.isSuper()) { // Case: `super.foo(a, b)` => `foo(this, a, b)` receiver.setToken(Token.THIS); } call.putBooleanProp(Node.FREE_CALL, true); compiler.reportChangeToEnclosingScope(call); }
java
private void rewriteCall(Node getprop, String newMethodName) { checkArgument(getprop.isGetProp(), getprop); Node call = getprop.getParent(); checkArgument(call.isCall(), call); Node receiver = getprop.getFirstChild(); // This rewriting does not exactly preserve order of operations; the newly inserted static // method name will be resolved before `receiver` is evaluated. This is known to be safe due // to the eligibility checks earlier in the pass. // // We choose not to do a full-fidelity rewriting (e.g. using `ExpressionDecomposer`) because // doing so means extracting `receiver` into a new variable at each call-site. This has a // significant code-size impact (circa 2018-11-19). getprop.removeChild(receiver); call.replaceChild(getprop, receiver); call.addChildToFront(IR.name(newMethodName).srcref(getprop)); if (receiver.isSuper()) { // Case: `super.foo(a, b)` => `foo(this, a, b)` receiver.setToken(Token.THIS); } call.putBooleanProp(Node.FREE_CALL, true); compiler.reportChangeToEnclosingScope(call); }
[ "private", "void", "rewriteCall", "(", "Node", "getprop", ",", "String", "newMethodName", ")", "{", "checkArgument", "(", "getprop", ".", "isGetProp", "(", ")", ",", "getprop", ")", ";", "Node", "call", "=", "getprop", ".", "getParent", "(", ")", ";", "checkArgument", "(", "call", ".", "isCall", "(", ")", ",", "call", ")", ";", "Node", "receiver", "=", "getprop", ".", "getFirstChild", "(", ")", ";", "// This rewriting does not exactly preserve order of operations; the newly inserted static", "// method name will be resolved before `receiver` is evaluated. This is known to be safe due", "// to the eligibility checks earlier in the pass.", "//", "// We choose not to do a full-fidelity rewriting (e.g. using `ExpressionDecomposer`) because", "// doing so means extracting `receiver` into a new variable at each call-site. This has a", "// significant code-size impact (circa 2018-11-19).", "getprop", ".", "removeChild", "(", "receiver", ")", ";", "call", ".", "replaceChild", "(", "getprop", ",", "receiver", ")", ";", "call", ".", "addChildToFront", "(", "IR", ".", "name", "(", "newMethodName", ")", ".", "srcref", "(", "getprop", ")", ")", ";", "if", "(", "receiver", ".", "isSuper", "(", ")", ")", "{", "// Case: `super.foo(a, b)` => `foo(this, a, b)`", "receiver", ".", "setToken", "(", "Token", ".", "THIS", ")", ";", "}", "call", ".", "putBooleanProp", "(", "Node", ".", "FREE_CALL", ",", "true", ")", ";", "compiler", ".", "reportChangeToEnclosingScope", "(", "call", ")", ";", "}" ]
Rewrites object method call sites as calls to global functions that take "this" as their first argument. <p>Before: o.foo(a, b, c) <p>After: foo(o, a, b, c)
[ "Rewrites", "object", "method", "call", "sites", "as", "calls", "to", "global", "functions", "that", "take", "this", "as", "their", "first", "argument", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/DevirtualizePrototypeMethods.java#L363-L388
aliyun/fc-java-sdk
src/main/java/com/aliyuncs/fc/client/DefaultFcClient.java
DefaultFcClient.concatQueryString
public String concatQueryString(Map<String, String> parameters) throws UnsupportedEncodingException { """ concate query string parameters (e.g. name=foo) @param parameters query parameters @return concatenated query string @throws UnsupportedEncodingException exceptions """ if (null == parameters) { return null; } StringBuilder urlBuilder = new StringBuilder(""); for (Map.Entry<String, String> entry : parameters.entrySet()) { String key = entry.getKey(); String val = entry.getValue(); urlBuilder.append(encode(key)); if (val != null) { urlBuilder.append("=").append(encode(val)); } urlBuilder.append("&"); } int strIndex = urlBuilder.length(); if (parameters.size() > 0) { urlBuilder.deleteCharAt(strIndex - 1); } return urlBuilder.toString(); }
java
public String concatQueryString(Map<String, String> parameters) throws UnsupportedEncodingException { if (null == parameters) { return null; } StringBuilder urlBuilder = new StringBuilder(""); for (Map.Entry<String, String> entry : parameters.entrySet()) { String key = entry.getKey(); String val = entry.getValue(); urlBuilder.append(encode(key)); if (val != null) { urlBuilder.append("=").append(encode(val)); } urlBuilder.append("&"); } int strIndex = urlBuilder.length(); if (parameters.size() > 0) { urlBuilder.deleteCharAt(strIndex - 1); } return urlBuilder.toString(); }
[ "public", "String", "concatQueryString", "(", "Map", "<", "String", ",", "String", ">", "parameters", ")", "throws", "UnsupportedEncodingException", "{", "if", "(", "null", "==", "parameters", ")", "{", "return", "null", ";", "}", "StringBuilder", "urlBuilder", "=", "new", "StringBuilder", "(", "\"\"", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", ":", "parameters", ".", "entrySet", "(", ")", ")", "{", "String", "key", "=", "entry", ".", "getKey", "(", ")", ";", "String", "val", "=", "entry", ".", "getValue", "(", ")", ";", "urlBuilder", ".", "append", "(", "encode", "(", "key", ")", ")", ";", "if", "(", "val", "!=", "null", ")", "{", "urlBuilder", ".", "append", "(", "\"=\"", ")", ".", "append", "(", "encode", "(", "val", ")", ")", ";", "}", "urlBuilder", ".", "append", "(", "\"&\"", ")", ";", "}", "int", "strIndex", "=", "urlBuilder", ".", "length", "(", ")", ";", "if", "(", "parameters", ".", "size", "(", ")", ">", "0", ")", "{", "urlBuilder", ".", "deleteCharAt", "(", "strIndex", "-", "1", ")", ";", "}", "return", "urlBuilder", ".", "toString", "(", ")", ";", "}" ]
concate query string parameters (e.g. name=foo) @param parameters query parameters @return concatenated query string @throws UnsupportedEncodingException exceptions
[ "concate", "query", "string", "parameters", "(", "e", ".", "g", ".", "name", "=", "foo", ")" ]
train
https://github.com/aliyun/fc-java-sdk/blob/45ee0cbff93d4ea7eaa87fc08fd18ac176df2dfe/src/main/java/com/aliyuncs/fc/client/DefaultFcClient.java#L90-L113
Azure/azure-sdk-for-java
servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java
ClientFactory.acceptSessionFromEntityPathAsync
public static CompletableFuture<IMessageSession> acceptSessionFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath, String sessionId) { """ Asynchronously accepts a session from service bus using the client settings. Session Id can be null, if null, service will return the first available session. @param messagingFactory messaging factory (which represents a connection) on which the session receiver needs to be created. @param entityPath path of entity @param sessionId session id, if null, service will return the first available session, otherwise, service will return specified session @return a CompletableFuture representing the pending session accepting """ return acceptSessionFromEntityPathAsync(messagingFactory, entityPath, sessionId, DEFAULTRECEIVEMODE); }
java
public static CompletableFuture<IMessageSession> acceptSessionFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath, String sessionId) { return acceptSessionFromEntityPathAsync(messagingFactory, entityPath, sessionId, DEFAULTRECEIVEMODE); }
[ "public", "static", "CompletableFuture", "<", "IMessageSession", ">", "acceptSessionFromEntityPathAsync", "(", "MessagingFactory", "messagingFactory", ",", "String", "entityPath", ",", "String", "sessionId", ")", "{", "return", "acceptSessionFromEntityPathAsync", "(", "messagingFactory", ",", "entityPath", ",", "sessionId", ",", "DEFAULTRECEIVEMODE", ")", ";", "}" ]
Asynchronously accepts a session from service bus using the client settings. Session Id can be null, if null, service will return the first available session. @param messagingFactory messaging factory (which represents a connection) on which the session receiver needs to be created. @param entityPath path of entity @param sessionId session id, if null, service will return the first available session, otherwise, service will return specified session @return a CompletableFuture representing the pending session accepting
[ "Asynchronously", "accepts", "a", "session", "from", "service", "bus", "using", "the", "client", "settings", ".", "Session", "Id", "can", "be", "null", "if", "null", "service", "will", "return", "the", "first", "available", "session", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java#L724-L726
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/RandomUtils.java
RandomUtils.nextLong
public static long nextLong(final long startInclusive, final long endExclusive) { """ <p> Returns a random long within the specified range. </p> @param startInclusive the smallest value that can be returned, must be non-negative @param endExclusive the upper bound (not included) @throws IllegalArgumentException if {@code startInclusive > endExclusive} or if {@code startInclusive} is negative @return the random long """ Validate.isTrue(endExclusive >= startInclusive, "Start value must be smaller or equal to end value."); Validate.isTrue(startInclusive >= 0, "Both range values must be non-negative."); if (startInclusive == endExclusive) { return startInclusive; } return (long) nextDouble(startInclusive, endExclusive); }
java
public static long nextLong(final long startInclusive, final long endExclusive) { Validate.isTrue(endExclusive >= startInclusive, "Start value must be smaller or equal to end value."); Validate.isTrue(startInclusive >= 0, "Both range values must be non-negative."); if (startInclusive == endExclusive) { return startInclusive; } return (long) nextDouble(startInclusive, endExclusive); }
[ "public", "static", "long", "nextLong", "(", "final", "long", "startInclusive", ",", "final", "long", "endExclusive", ")", "{", "Validate", ".", "isTrue", "(", "endExclusive", ">=", "startInclusive", ",", "\"Start value must be smaller or equal to end value.\"", ")", ";", "Validate", ".", "isTrue", "(", "startInclusive", ">=", "0", ",", "\"Both range values must be non-negative.\"", ")", ";", "if", "(", "startInclusive", "==", "endExclusive", ")", "{", "return", "startInclusive", ";", "}", "return", "(", "long", ")", "nextDouble", "(", "startInclusive", ",", "endExclusive", ")", ";", "}" ]
<p> Returns a random long within the specified range. </p> @param startInclusive the smallest value that can be returned, must be non-negative @param endExclusive the upper bound (not included) @throws IllegalArgumentException if {@code startInclusive > endExclusive} or if {@code startInclusive} is negative @return the random long
[ "<p", ">", "Returns", "a", "random", "long", "within", "the", "specified", "range", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/RandomUtils.java#L131-L141
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/filter/RawScale3x.java
RawScale3x.computeE1
private static int computeE1(int a, int b, int c, int d, int e, int f) { """ Compute E1 pixel. @param a The a value. @param b The b value. @param c The c value. @param d The d value. @param e The e value. @param f The f value. @return The computed value. """ if (d == b && e != c || b == f && e != a) { return b; } return e; }
java
private static int computeE1(int a, int b, int c, int d, int e, int f) { if (d == b && e != c || b == f && e != a) { return b; } return e; }
[ "private", "static", "int", "computeE1", "(", "int", "a", ",", "int", "b", ",", "int", "c", ",", "int", "d", ",", "int", "e", ",", "int", "f", ")", "{", "if", "(", "d", "==", "b", "&&", "e", "!=", "c", "||", "b", "==", "f", "&&", "e", "!=", "a", ")", "{", "return", "b", ";", "}", "return", "e", ";", "}" ]
Compute E1 pixel. @param a The a value. @param b The b value. @param c The c value. @param d The d value. @param e The e value. @param f The f value. @return The computed value.
[ "Compute", "E1", "pixel", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/filter/RawScale3x.java#L56-L63
beangle/beangle3
commons/model/src/main/java/org/beangle/commons/entity/metadata/impl/ConvertPopulatorBean.java
ConvertPopulatorBean.initProperty
public ObjectAndType initProperty(final Object target, Type type, final String attr) { """ Initialize target's attribuate path,Return the last property value and type. """ Object propObj = target; Object property = null; int index = 0; String[] attrs = Strings.split(attr, "."); while (index < attrs.length) { try { property = getProperty(propObj, attrs[index]); Type propertyType = null; if (attrs[index].contains("[") && null != property) { propertyType = new IdentifierType(property.getClass()); } else { propertyType = type.getPropertyType(attrs[index]); if (null == propertyType) { logger.error("Cannot find property type [{}] of {}", attrs[index], propObj.getClass()); throw new RuntimeException( "Cannot find property type " + attrs[index] + " of " + propObj.getClass().getName()); } } if (null == property) { property = propertyType.newInstance(); setProperty(propObj, attrs[index], property); } index++; propObj = property; type = propertyType; } catch (Exception e) { throw new RuntimeException(e); } } return new ObjectAndType(property, type); }
java
public ObjectAndType initProperty(final Object target, Type type, final String attr) { Object propObj = target; Object property = null; int index = 0; String[] attrs = Strings.split(attr, "."); while (index < attrs.length) { try { property = getProperty(propObj, attrs[index]); Type propertyType = null; if (attrs[index].contains("[") && null != property) { propertyType = new IdentifierType(property.getClass()); } else { propertyType = type.getPropertyType(attrs[index]); if (null == propertyType) { logger.error("Cannot find property type [{}] of {}", attrs[index], propObj.getClass()); throw new RuntimeException( "Cannot find property type " + attrs[index] + " of " + propObj.getClass().getName()); } } if (null == property) { property = propertyType.newInstance(); setProperty(propObj, attrs[index], property); } index++; propObj = property; type = propertyType; } catch (Exception e) { throw new RuntimeException(e); } } return new ObjectAndType(property, type); }
[ "public", "ObjectAndType", "initProperty", "(", "final", "Object", "target", ",", "Type", "type", ",", "final", "String", "attr", ")", "{", "Object", "propObj", "=", "target", ";", "Object", "property", "=", "null", ";", "int", "index", "=", "0", ";", "String", "[", "]", "attrs", "=", "Strings", ".", "split", "(", "attr", ",", "\".\"", ")", ";", "while", "(", "index", "<", "attrs", ".", "length", ")", "{", "try", "{", "property", "=", "getProperty", "(", "propObj", ",", "attrs", "[", "index", "]", ")", ";", "Type", "propertyType", "=", "null", ";", "if", "(", "attrs", "[", "index", "]", ".", "contains", "(", "\"[\"", ")", "&&", "null", "!=", "property", ")", "{", "propertyType", "=", "new", "IdentifierType", "(", "property", ".", "getClass", "(", ")", ")", ";", "}", "else", "{", "propertyType", "=", "type", ".", "getPropertyType", "(", "attrs", "[", "index", "]", ")", ";", "if", "(", "null", "==", "propertyType", ")", "{", "logger", ".", "error", "(", "\"Cannot find property type [{}] of {}\"", ",", "attrs", "[", "index", "]", ",", "propObj", ".", "getClass", "(", ")", ")", ";", "throw", "new", "RuntimeException", "(", "\"Cannot find property type \"", "+", "attrs", "[", "index", "]", "+", "\" of \"", "+", "propObj", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "}", "if", "(", "null", "==", "property", ")", "{", "property", "=", "propertyType", ".", "newInstance", "(", ")", ";", "setProperty", "(", "propObj", ",", "attrs", "[", "index", "]", ",", "property", ")", ";", "}", "index", "++", ";", "propObj", "=", "property", ";", "type", "=", "propertyType", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}", "return", "new", "ObjectAndType", "(", "property", ",", "type", ")", ";", "}" ]
Initialize target's attribuate path,Return the last property value and type.
[ "Initialize", "target", "s", "attribuate", "path", "Return", "the", "last", "property", "value", "and", "type", "." ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/model/src/main/java/org/beangle/commons/entity/metadata/impl/ConvertPopulatorBean.java#L78-L110
milaboratory/milib
src/main/java/com/milaboratory/core/io/util/IOUtil.java
IOUtil.writeRawVarint32
public static void writeRawVarint32(OutputStream os, int value) throws IOException { """ Encode and write a varint. {@code value} is treated as unsigned, so it won't be sign-extended if negative. <p>Copied from com.google.protobuf.CodedOutputStream from Google's protobuf library.</p> """ while (true) { if ((value & ~0x7F) == 0) { os.write(value); return; } else { os.write((value & 0x7F) | 0x80); value >>>= 7; } } }
java
public static void writeRawVarint32(OutputStream os, int value) throws IOException { while (true) { if ((value & ~0x7F) == 0) { os.write(value); return; } else { os.write((value & 0x7F) | 0x80); value >>>= 7; } } }
[ "public", "static", "void", "writeRawVarint32", "(", "OutputStream", "os", ",", "int", "value", ")", "throws", "IOException", "{", "while", "(", "true", ")", "{", "if", "(", "(", "value", "&", "~", "0x7F", ")", "==", "0", ")", "{", "os", ".", "write", "(", "value", ")", ";", "return", ";", "}", "else", "{", "os", ".", "write", "(", "(", "value", "&", "0x7F", ")", "|", "0x80", ")", ";", "value", ">>>=", "7", ";", "}", "}", "}" ]
Encode and write a varint. {@code value} is treated as unsigned, so it won't be sign-extended if negative. <p>Copied from com.google.protobuf.CodedOutputStream from Google's protobuf library.</p>
[ "Encode", "and", "write", "a", "varint", ".", "{", "@code", "value", "}", "is", "treated", "as", "unsigned", "so", "it", "won", "t", "be", "sign", "-", "extended", "if", "negative", "." ]
train
https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/io/util/IOUtil.java#L84-L94
BlueBrain/bluima
modules/bluima_abbreviations/src/main/java/com/wcohen/ss/TokenFelligiSunter.java
TokenFelligiSunter.explainScore
public String explainScore(StringWrapper s, StringWrapper t) { """ Explain how the distance was computed. In the output, the tokens in S and T are listed, and the common tokens are marked with an asterisk. """ BagOfTokens sBag = (BagOfTokens)s; BagOfTokens tBag = (BagOfTokens)t; StringBuffer buf = new StringBuffer(""); PrintfFormat fmt = new PrintfFormat("%.3f"); buf.append("Common tokens: "); for (Iterator i = sBag.tokenIterator(); i.hasNext(); ) { Token tok = (Token)i.next(); if (tBag.contains(tok)) { buf.append(" "+tok.getValue()+": "); buf.append(fmt.sprintf(tBag.getWeight(tok))); } } buf.append("\nscore = "+score(s,t)); return buf.toString(); }
java
public String explainScore(StringWrapper s, StringWrapper t) { BagOfTokens sBag = (BagOfTokens)s; BagOfTokens tBag = (BagOfTokens)t; StringBuffer buf = new StringBuffer(""); PrintfFormat fmt = new PrintfFormat("%.3f"); buf.append("Common tokens: "); for (Iterator i = sBag.tokenIterator(); i.hasNext(); ) { Token tok = (Token)i.next(); if (tBag.contains(tok)) { buf.append(" "+tok.getValue()+": "); buf.append(fmt.sprintf(tBag.getWeight(tok))); } } buf.append("\nscore = "+score(s,t)); return buf.toString(); }
[ "public", "String", "explainScore", "(", "StringWrapper", "s", ",", "StringWrapper", "t", ")", "{", "BagOfTokens", "sBag", "=", "(", "BagOfTokens", ")", "s", ";", "BagOfTokens", "tBag", "=", "(", "BagOfTokens", ")", "t", ";", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", "\"\"", ")", ";", "PrintfFormat", "fmt", "=", "new", "PrintfFormat", "(", "\"%.3f\"", ")", ";", "buf", ".", "append", "(", "\"Common tokens: \"", ")", ";", "for", "(", "Iterator", "i", "=", "sBag", ".", "tokenIterator", "(", ")", ";", "i", ".", "hasNext", "(", ")", ";", ")", "{", "Token", "tok", "=", "(", "Token", ")", "i", ".", "next", "(", ")", ";", "if", "(", "tBag", ".", "contains", "(", "tok", ")", ")", "{", "buf", ".", "append", "(", "\" \"", "+", "tok", ".", "getValue", "(", ")", "+", "\": \"", ")", ";", "buf", ".", "append", "(", "fmt", ".", "sprintf", "(", "tBag", ".", "getWeight", "(", "tok", ")", ")", ")", ";", "}", "}", "buf", ".", "append", "(", "\"\\nscore = \"", "+", "score", "(", "s", ",", "t", ")", ")", ";", "return", "buf", ".", "toString", "(", ")", ";", "}" ]
Explain how the distance was computed. In the output, the tokens in S and T are listed, and the common tokens are marked with an asterisk.
[ "Explain", "how", "the", "distance", "was", "computed", ".", "In", "the", "output", "the", "tokens", "in", "S", "and", "T", "are", "listed", "and", "the", "common", "tokens", "are", "marked", "with", "an", "asterisk", "." ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_abbreviations/src/main/java/com/wcohen/ss/TokenFelligiSunter.java#L75-L91
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java
ChromosomeMappingTools.getTranscriptDNASequence
public static DNASequence getTranscriptDNASequence(TwoBitFacade twoBitFacade, String chromosome, List<Integer> exonStarts, List<Integer> exonEnds, int cdsStart, int cdsEnd, Character orientation) throws Exception { """ Extracts the DNA sequence transcribed from the input genetic coordinates. @param chromosome the name of the chromosome @param exonStarts The list holding the genetic coordinates pointing to the start positions of the exons (including UTR regions) @param exonEnds The list holding the genetic coordinates pointing to the end positions of the exons (including UTR regions) @param cdsStart The start position of a coding region @param cdsEnd The end position of a coding region @param orientation The orientation of the strand where the gene is living @return the DNA sequence transcribed from the input genetic coordinates """ List<Range<Integer>> cdsRegion = getCDSRegions(exonStarts, exonEnds, cdsStart, cdsEnd); String dnaSequence = ""; for (Range<Integer> range : cdsRegion) { String exonSequence = twoBitFacade.getSequence(chromosome,range.lowerEndpoint(), range.upperEndpoint()); dnaSequence += exonSequence; } if (orientation.equals('-')) { dnaSequence = new StringBuilder(dnaSequence).reverse().toString(); DNASequence dna = new DNASequence(dnaSequence); SequenceView<NucleotideCompound> compliment = dna.getComplement(); dnaSequence = compliment.getSequenceAsString(); } return new DNASequence(dnaSequence.toUpperCase()); }
java
public static DNASequence getTranscriptDNASequence(TwoBitFacade twoBitFacade, String chromosome, List<Integer> exonStarts, List<Integer> exonEnds, int cdsStart, int cdsEnd, Character orientation) throws Exception { List<Range<Integer>> cdsRegion = getCDSRegions(exonStarts, exonEnds, cdsStart, cdsEnd); String dnaSequence = ""; for (Range<Integer> range : cdsRegion) { String exonSequence = twoBitFacade.getSequence(chromosome,range.lowerEndpoint(), range.upperEndpoint()); dnaSequence += exonSequence; } if (orientation.equals('-')) { dnaSequence = new StringBuilder(dnaSequence).reverse().toString(); DNASequence dna = new DNASequence(dnaSequence); SequenceView<NucleotideCompound> compliment = dna.getComplement(); dnaSequence = compliment.getSequenceAsString(); } return new DNASequence(dnaSequence.toUpperCase()); }
[ "public", "static", "DNASequence", "getTranscriptDNASequence", "(", "TwoBitFacade", "twoBitFacade", ",", "String", "chromosome", ",", "List", "<", "Integer", ">", "exonStarts", ",", "List", "<", "Integer", ">", "exonEnds", ",", "int", "cdsStart", ",", "int", "cdsEnd", ",", "Character", "orientation", ")", "throws", "Exception", "{", "List", "<", "Range", "<", "Integer", ">>", "cdsRegion", "=", "getCDSRegions", "(", "exonStarts", ",", "exonEnds", ",", "cdsStart", ",", "cdsEnd", ")", ";", "String", "dnaSequence", "=", "\"\"", ";", "for", "(", "Range", "<", "Integer", ">", "range", ":", "cdsRegion", ")", "{", "String", "exonSequence", "=", "twoBitFacade", ".", "getSequence", "(", "chromosome", ",", "range", ".", "lowerEndpoint", "(", ")", ",", "range", ".", "upperEndpoint", "(", ")", ")", ";", "dnaSequence", "+=", "exonSequence", ";", "}", "if", "(", "orientation", ".", "equals", "(", "'", "'", ")", ")", "{", "dnaSequence", "=", "new", "StringBuilder", "(", "dnaSequence", ")", ".", "reverse", "(", ")", ".", "toString", "(", ")", ";", "DNASequence", "dna", "=", "new", "DNASequence", "(", "dnaSequence", ")", ";", "SequenceView", "<", "NucleotideCompound", ">", "compliment", "=", "dna", ".", "getComplement", "(", ")", ";", "dnaSequence", "=", "compliment", ".", "getSequenceAsString", "(", ")", ";", "}", "return", "new", "DNASequence", "(", "dnaSequence", ".", "toUpperCase", "(", ")", ")", ";", "}" ]
Extracts the DNA sequence transcribed from the input genetic coordinates. @param chromosome the name of the chromosome @param exonStarts The list holding the genetic coordinates pointing to the start positions of the exons (including UTR regions) @param exonEnds The list holding the genetic coordinates pointing to the end positions of the exons (including UTR regions) @param cdsStart The start position of a coding region @param cdsEnd The end position of a coding region @param orientation The orientation of the strand where the gene is living @return the DNA sequence transcribed from the input genetic coordinates
[ "Extracts", "the", "DNA", "sequence", "transcribed", "from", "the", "input", "genetic", "coordinates", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java#L955-L971
landawn/AbacusUtil
src/com/landawn/abacus/util/DateUtil.java
DateUtil.addMonths
public static <T extends Calendar> T addMonths(final T calendar, final int amount) { """ Adds a number of months to a calendar returning a new object. The original {@code Date} is unchanged. @param calendar the calendar, not null @param amount the amount to add, may be negative @return the new {@code Date} with the amount added @throws IllegalArgumentException if the calendar is null """ return roll(calendar, amount, CalendarUnit.MONTH); }
java
public static <T extends Calendar> T addMonths(final T calendar, final int amount) { return roll(calendar, amount, CalendarUnit.MONTH); }
[ "public", "static", "<", "T", "extends", "Calendar", ">", "T", "addMonths", "(", "final", "T", "calendar", ",", "final", "int", "amount", ")", "{", "return", "roll", "(", "calendar", ",", "amount", ",", "CalendarUnit", ".", "MONTH", ")", ";", "}" ]
Adds a number of months to a calendar returning a new object. The original {@code Date} is unchanged. @param calendar the calendar, not null @param amount the amount to add, may be negative @return the new {@code Date} with the amount added @throws IllegalArgumentException if the calendar is null
[ "Adds", "a", "number", "of", "months", "to", "a", "calendar", "returning", "a", "new", "object", ".", "The", "original", "{", "@code", "Date", "}", "is", "unchanged", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/DateUtil.java#L1077-L1079
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WText.java
WText.setText
public void setText(final String text, final Serializable... args) { """ <p> Sets the text.</p> <p> NOTE: If the text is dynamically generated, it may be preferable to override {@link #getText()} instead. This will reduce the amount of data which is stored in the user session. </p> @param text the text to set, using {@link MessageFormat} syntax. @param args optional arguments for the message format string. <pre> // Changes the text to "Hello world" myText.setText("Hello world"); </pre> <pre> // Changes the text to "Secret agent James Bond, 007" new WText("Secret agent {0}, {1,number,000}", "James Bond", 7); </pre> """ setData(I18nUtilities.asMessage(text, args)); }
java
public void setText(final String text, final Serializable... args) { setData(I18nUtilities.asMessage(text, args)); }
[ "public", "void", "setText", "(", "final", "String", "text", ",", "final", "Serializable", "...", "args", ")", "{", "setData", "(", "I18nUtilities", ".", "asMessage", "(", "text", ",", "args", ")", ")", ";", "}" ]
<p> Sets the text.</p> <p> NOTE: If the text is dynamically generated, it may be preferable to override {@link #getText()} instead. This will reduce the amount of data which is stored in the user session. </p> @param text the text to set, using {@link MessageFormat} syntax. @param args optional arguments for the message format string. <pre> // Changes the text to "Hello world" myText.setText("Hello world"); </pre> <pre> // Changes the text to "Secret agent James Bond, 007" new WText("Secret agent {0}, {1,number,000}", "James Bond", 7); </pre>
[ "<p", ">", "Sets", "the", "text", ".", "<", "/", "p", ">" ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WText.java#L89-L91
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/WebSiteManagementClientImpl.java
WebSiteManagementClientImpl.validateMove
public void validateMove(String resourceGroupName, CsmMoveResourceEnvelope moveResourceEnvelope) { """ Validate whether a resource can be moved. Validate whether a resource can be moved. @param resourceGroupName Name of the resource group to which the resource belongs. @param moveResourceEnvelope Object that represents the resource to move. @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 """ validateMoveWithServiceResponseAsync(resourceGroupName, moveResourceEnvelope).toBlocking().single().body(); }
java
public void validateMove(String resourceGroupName, CsmMoveResourceEnvelope moveResourceEnvelope) { validateMoveWithServiceResponseAsync(resourceGroupName, moveResourceEnvelope).toBlocking().single().body(); }
[ "public", "void", "validateMove", "(", "String", "resourceGroupName", ",", "CsmMoveResourceEnvelope", "moveResourceEnvelope", ")", "{", "validateMoveWithServiceResponseAsync", "(", "resourceGroupName", ",", "moveResourceEnvelope", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Validate whether a resource can be moved. Validate whether a resource can be moved. @param resourceGroupName Name of the resource group to which the resource belongs. @param moveResourceEnvelope Object that represents the resource to move. @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
[ "Validate", "whether", "a", "resource", "can", "be", "moved", ".", "Validate", "whether", "a", "resource", "can", "be", "moved", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/WebSiteManagementClientImpl.java#L2330-L2332
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/MiniMax.java
MiniMax.findPrototype
private static double findPrototype(DistanceQuery<?> dq, DBIDs cx, DBIDs cy, DBIDVar prototype, double minMaxDist) { """ Find the prototypes. @param dq Distance query @param cx First set @param cy Second set @param prototype Prototype output variable @param minMaxDist Previously best distance. @return New best distance """ for(DBIDIter i = cx.iter(); i.valid(); i.advance()) { // Maximum distance of i to all elements in cy double maxDist = findMax(dq, i, cy, 0., minMaxDist); if(maxDist >= minMaxDist) { // We already have an at least equally good candidate. continue; } // Maximum distance of i to all elements in cx maxDist = findMax(dq, i, cx, maxDist, minMaxDist); // New best solution? if(maxDist < minMaxDist) { minMaxDist = maxDist; prototype.set(i); } } return minMaxDist; }
java
private static double findPrototype(DistanceQuery<?> dq, DBIDs cx, DBIDs cy, DBIDVar prototype, double minMaxDist) { for(DBIDIter i = cx.iter(); i.valid(); i.advance()) { // Maximum distance of i to all elements in cy double maxDist = findMax(dq, i, cy, 0., minMaxDist); if(maxDist >= minMaxDist) { // We already have an at least equally good candidate. continue; } // Maximum distance of i to all elements in cx maxDist = findMax(dq, i, cx, maxDist, minMaxDist); // New best solution? if(maxDist < minMaxDist) { minMaxDist = maxDist; prototype.set(i); } } return minMaxDist; }
[ "private", "static", "double", "findPrototype", "(", "DistanceQuery", "<", "?", ">", "dq", ",", "DBIDs", "cx", ",", "DBIDs", "cy", ",", "DBIDVar", "prototype", ",", "double", "minMaxDist", ")", "{", "for", "(", "DBIDIter", "i", "=", "cx", ".", "iter", "(", ")", ";", "i", ".", "valid", "(", ")", ";", "i", ".", "advance", "(", ")", ")", "{", "// Maximum distance of i to all elements in cy", "double", "maxDist", "=", "findMax", "(", "dq", ",", "i", ",", "cy", ",", "0.", ",", "minMaxDist", ")", ";", "if", "(", "maxDist", ">=", "minMaxDist", ")", "{", "// We already have an at least equally good candidate.", "continue", ";", "}", "// Maximum distance of i to all elements in cx", "maxDist", "=", "findMax", "(", "dq", ",", "i", ",", "cx", ",", "maxDist", ",", "minMaxDist", ")", ";", "// New best solution?", "if", "(", "maxDist", "<", "minMaxDist", ")", "{", "minMaxDist", "=", "maxDist", ";", "prototype", ".", "set", "(", "i", ")", ";", "}", "}", "return", "minMaxDist", ";", "}" ]
Find the prototypes. @param dq Distance query @param cx First set @param cy Second set @param prototype Prototype output variable @param minMaxDist Previously best distance. @return New best distance
[ "Find", "the", "prototypes", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/MiniMax.java#L314-L332
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/TaskContext.java
TaskContext.getDestinationType
public Destination.DestinationType getDestinationType(int branches, int index) { """ Get the writer {@link Destination.DestinationType}. @param branches number of forked branches @param index branch index @return writer {@link Destination.DestinationType} """ return Destination.DestinationType.valueOf(this.taskState.getProp( ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_DESTINATION_TYPE_KEY, branches, index), Destination.DestinationType.HDFS.name())); }
java
public Destination.DestinationType getDestinationType(int branches, int index) { return Destination.DestinationType.valueOf(this.taskState.getProp( ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_DESTINATION_TYPE_KEY, branches, index), Destination.DestinationType.HDFS.name())); }
[ "public", "Destination", ".", "DestinationType", "getDestinationType", "(", "int", "branches", ",", "int", "index", ")", "{", "return", "Destination", ".", "DestinationType", ".", "valueOf", "(", "this", ".", "taskState", ".", "getProp", "(", "ForkOperatorUtils", ".", "getPropertyNameForBranch", "(", "ConfigurationKeys", ".", "WRITER_DESTINATION_TYPE_KEY", ",", "branches", ",", "index", ")", ",", "Destination", ".", "DestinationType", ".", "HDFS", ".", "name", "(", ")", ")", ")", ";", "}" ]
Get the writer {@link Destination.DestinationType}. @param branches number of forked branches @param index branch index @return writer {@link Destination.DestinationType}
[ "Get", "the", "writer", "{", "@link", "Destination", ".", "DestinationType", "}", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/TaskContext.java#L161-L165
adessoAG/wicked-charts
highcharts-wrapper/src/main/java/de/adesso/wickedcharts/highcharts/options/CssStyle.java
CssStyle.setProperty
public CssStyle setProperty(final String key, final String value) { """ Sets a CSS property. @param key the name of the property. Note that hyphen notation ("-") is automatically converted into camel case notation since the property name is used as key in a JSON object. Highcharts will evaluate it as if it were hyphen notation. @param value the value of the CSS property. @return this for chaining. """ if (this.properties == null) { this.properties = new HashMap<String, String>(); } this.properties.put(sanitizeCssPropertyName(key), value); return this; }
java
public CssStyle setProperty(final String key, final String value) { if (this.properties == null) { this.properties = new HashMap<String, String>(); } this.properties.put(sanitizeCssPropertyName(key), value); return this; }
[ "public", "CssStyle", "setProperty", "(", "final", "String", "key", ",", "final", "String", "value", ")", "{", "if", "(", "this", ".", "properties", "==", "null", ")", "{", "this", ".", "properties", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "}", "this", ".", "properties", ".", "put", "(", "sanitizeCssPropertyName", "(", "key", ")", ",", "value", ")", ";", "return", "this", ";", "}" ]
Sets a CSS property. @param key the name of the property. Note that hyphen notation ("-") is automatically converted into camel case notation since the property name is used as key in a JSON object. Highcharts will evaluate it as if it were hyphen notation. @param value the value of the CSS property. @return this for chaining.
[ "Sets", "a", "CSS", "property", "." ]
train
https://github.com/adessoAG/wicked-charts/blob/498aceff025f612e22ba5135b26531afeabac03c/highcharts-wrapper/src/main/java/de/adesso/wickedcharts/highcharts/options/CssStyle.java#L66-L72
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.visitCode
@Override public void visitCode(Code obj) { """ implements the visitor to reset the register to location map @param obj the context object of the currently parsed code block """ try { ignoreRegs.clear(); Method method = getMethod(); if (!method.isStatic()) { ignoreRegs.set(0); } int[] parmRegs = RegisterUtils.getParameterRegisters(method); for (int parm : parmRegs) { ignoreRegs.set(parm); } rootScopeBlock = new ScopeBlock(0, obj.getLength()); tryBlocks.clear(); catchHandlers.clear(); CodeException[] exceptions = obj.getExceptionTable(); if (exceptions != null) { for (CodeException ex : exceptions) { tryBlocks.set(ex.getStartPC()); catchHandlers.set(ex.getHandlerPC()); } } switchTargets.clear(); stack.resetForMethodEntry(this); dontReport = false; sawDup = false; sawNull = false; super.visitCode(obj); if (!dontReport) { rootScopeBlock.findBugs(new HashSet<Integer>()); } } finally { rootScopeBlock = null; } }
java
@Override public void visitCode(Code obj) { try { ignoreRegs.clear(); Method method = getMethod(); if (!method.isStatic()) { ignoreRegs.set(0); } int[] parmRegs = RegisterUtils.getParameterRegisters(method); for (int parm : parmRegs) { ignoreRegs.set(parm); } rootScopeBlock = new ScopeBlock(0, obj.getLength()); tryBlocks.clear(); catchHandlers.clear(); CodeException[] exceptions = obj.getExceptionTable(); if (exceptions != null) { for (CodeException ex : exceptions) { tryBlocks.set(ex.getStartPC()); catchHandlers.set(ex.getHandlerPC()); } } switchTargets.clear(); stack.resetForMethodEntry(this); dontReport = false; sawDup = false; sawNull = false; super.visitCode(obj); if (!dontReport) { rootScopeBlock.findBugs(new HashSet<Integer>()); } } finally { rootScopeBlock = null; } }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "try", "{", "ignoreRegs", ".", "clear", "(", ")", ";", "Method", "method", "=", "getMethod", "(", ")", ";", "if", "(", "!", "method", ".", "isStatic", "(", ")", ")", "{", "ignoreRegs", ".", "set", "(", "0", ")", ";", "}", "int", "[", "]", "parmRegs", "=", "RegisterUtils", ".", "getParameterRegisters", "(", "method", ")", ";", "for", "(", "int", "parm", ":", "parmRegs", ")", "{", "ignoreRegs", ".", "set", "(", "parm", ")", ";", "}", "rootScopeBlock", "=", "new", "ScopeBlock", "(", "0", ",", "obj", ".", "getLength", "(", ")", ")", ";", "tryBlocks", ".", "clear", "(", ")", ";", "catchHandlers", ".", "clear", "(", ")", ";", "CodeException", "[", "]", "exceptions", "=", "obj", ".", "getExceptionTable", "(", ")", ";", "if", "(", "exceptions", "!=", "null", ")", "{", "for", "(", "CodeException", "ex", ":", "exceptions", ")", "{", "tryBlocks", ".", "set", "(", "ex", ".", "getStartPC", "(", ")", ")", ";", "catchHandlers", ".", "set", "(", "ex", ".", "getHandlerPC", "(", ")", ")", ";", "}", "}", "switchTargets", ".", "clear", "(", ")", ";", "stack", ".", "resetForMethodEntry", "(", "this", ")", ";", "dontReport", "=", "false", ";", "sawDup", "=", "false", ";", "sawNull", "=", "false", ";", "super", ".", "visitCode", "(", "obj", ")", ";", "if", "(", "!", "dontReport", ")", "{", "rootScopeBlock", ".", "findBugs", "(", "new", "HashSet", "<", "Integer", ">", "(", ")", ")", ";", "}", "}", "finally", "{", "rootScopeBlock", "=", "null", ";", "}", "}" ]
implements the visitor to reset the register to location map @param obj the context object of the currently parsed code block
[ "implements", "the", "visitor", "to", "reset", "the", "register", "to", "location", "map" ]
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L152-L192
tvesalainen/lpg
src/main/java/org/vesalainen/regex/Regex.java
Regex.startsWith
public boolean startsWith(PushbackReader in, int size) throws IOException { """ Returns true if input start matches the regular expression @param in @param size @return @throws IOException """ InputReader reader = Input.getInstance(in, size); boolean b = startsWith(reader); reader.release(); return b; }
java
public boolean startsWith(PushbackReader in, int size) throws IOException { InputReader reader = Input.getInstance(in, size); boolean b = startsWith(reader); reader.release(); return b; }
[ "public", "boolean", "startsWith", "(", "PushbackReader", "in", ",", "int", "size", ")", "throws", "IOException", "{", "InputReader", "reader", "=", "Input", ".", "getInstance", "(", "in", ",", "size", ")", ";", "boolean", "b", "=", "startsWith", "(", "reader", ")", ";", "reader", ".", "release", "(", ")", ";", "return", "b", ";", "}" ]
Returns true if input start matches the regular expression @param in @param size @return @throws IOException
[ "Returns", "true", "if", "input", "start", "matches", "the", "regular", "expression" ]
train
https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/regex/Regex.java#L505-L511
Azure/azure-sdk-for-java
resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java
ResourcesInner.beginUpdateById
public GenericResourceInner beginUpdateById(String resourceId, String apiVersion, GenericResourceInner parameters) { """ Updates a resource by ID. @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} @param apiVersion The API version to use for the operation. @param parameters Update resource parameters. @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 GenericResourceInner object if successful. """ return beginUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).toBlocking().single().body(); }
java
public GenericResourceInner beginUpdateById(String resourceId, String apiVersion, GenericResourceInner parameters) { return beginUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).toBlocking().single().body(); }
[ "public", "GenericResourceInner", "beginUpdateById", "(", "String", "resourceId", ",", "String", "apiVersion", ",", "GenericResourceInner", "parameters", ")", "{", "return", "beginUpdateByIdWithServiceResponseAsync", "(", "resourceId", ",", "apiVersion", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Updates a resource by ID. @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} @param apiVersion The API version to use for the operation. @param parameters Update resource parameters. @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 GenericResourceInner object if successful.
[ "Updates", "a", "resource", "by", "ID", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java#L2302-L2304
voldemort/voldemort
src/java/voldemort/tools/admin/command/AdminCommandMeta.java
SubCommandMetaClearRebalance.doMetaClearRebalance
public static void doMetaClearRebalance(AdminClient adminClient, List<Integer> nodeIds) { """ Removes metadata related to rebalancing. @param adminClient An instance of AdminClient points to given cluster @param nodeIds Node ids to clear metadata after rebalancing """ AdminToolUtils.assertServerNotInOfflineState(adminClient, nodeIds); System.out.println("Setting " + MetadataStore.SERVER_STATE_KEY + " to " + MetadataStore.VoldemortState.NORMAL_SERVER); doMetaSet(adminClient, nodeIds, MetadataStore.SERVER_STATE_KEY, MetadataStore.VoldemortState.NORMAL_SERVER.toString()); RebalancerState state = RebalancerState.create("[]"); System.out.println("Cleaning up " + MetadataStore.REBALANCING_STEAL_INFO + " to " + state.toJsonString()); doMetaSet(adminClient, nodeIds, MetadataStore.REBALANCING_STEAL_INFO, state.toJsonString()); System.out.println("Cleaning up " + MetadataStore.REBALANCING_SOURCE_CLUSTER_XML + " to empty string"); doMetaSet(adminClient, nodeIds, MetadataStore.REBALANCING_SOURCE_CLUSTER_XML, ""); }
java
public static void doMetaClearRebalance(AdminClient adminClient, List<Integer> nodeIds) { AdminToolUtils.assertServerNotInOfflineState(adminClient, nodeIds); System.out.println("Setting " + MetadataStore.SERVER_STATE_KEY + " to " + MetadataStore.VoldemortState.NORMAL_SERVER); doMetaSet(adminClient, nodeIds, MetadataStore.SERVER_STATE_KEY, MetadataStore.VoldemortState.NORMAL_SERVER.toString()); RebalancerState state = RebalancerState.create("[]"); System.out.println("Cleaning up " + MetadataStore.REBALANCING_STEAL_INFO + " to " + state.toJsonString()); doMetaSet(adminClient, nodeIds, MetadataStore.REBALANCING_STEAL_INFO, state.toJsonString()); System.out.println("Cleaning up " + MetadataStore.REBALANCING_SOURCE_CLUSTER_XML + " to empty string"); doMetaSet(adminClient, nodeIds, MetadataStore.REBALANCING_SOURCE_CLUSTER_XML, ""); }
[ "public", "static", "void", "doMetaClearRebalance", "(", "AdminClient", "adminClient", ",", "List", "<", "Integer", ">", "nodeIds", ")", "{", "AdminToolUtils", ".", "assertServerNotInOfflineState", "(", "adminClient", ",", "nodeIds", ")", ";", "System", ".", "out", ".", "println", "(", "\"Setting \"", "+", "MetadataStore", ".", "SERVER_STATE_KEY", "+", "\" to \"", "+", "MetadataStore", ".", "VoldemortState", ".", "NORMAL_SERVER", ")", ";", "doMetaSet", "(", "adminClient", ",", "nodeIds", ",", "MetadataStore", ".", "SERVER_STATE_KEY", ",", "MetadataStore", ".", "VoldemortState", ".", "NORMAL_SERVER", ".", "toString", "(", ")", ")", ";", "RebalancerState", "state", "=", "RebalancerState", ".", "create", "(", "\"[]\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"Cleaning up \"", "+", "MetadataStore", ".", "REBALANCING_STEAL_INFO", "+", "\" to \"", "+", "state", ".", "toJsonString", "(", ")", ")", ";", "doMetaSet", "(", "adminClient", ",", "nodeIds", ",", "MetadataStore", ".", "REBALANCING_STEAL_INFO", ",", "state", ".", "toJsonString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"Cleaning up \"", "+", "MetadataStore", ".", "REBALANCING_SOURCE_CLUSTER_XML", "+", "\" to empty string\"", ")", ";", "doMetaSet", "(", "adminClient", ",", "nodeIds", ",", "MetadataStore", ".", "REBALANCING_SOURCE_CLUSTER_XML", ",", "\"\"", ")", ";", "}" ]
Removes metadata related to rebalancing. @param adminClient An instance of AdminClient points to given cluster @param nodeIds Node ids to clear metadata after rebalancing
[ "Removes", "metadata", "related", "to", "rebalancing", "." ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/command/AdminCommandMeta.java#L658-L676
JodaOrg/joda-time
src/main/java/org/joda/time/chrono/GJChronology.java
GJChronology.getInstance
public static GJChronology getInstance( DateTimeZone zone, long gregorianCutover, int minDaysInFirstWeek) { """ Factory method returns instances of the GJ cutover chronology. Any cutover date may be specified. @param zone the time zone to use, null is default @param gregorianCutover the cutover to use @param minDaysInFirstWeek minimum number of days in first week of the year; default is 4 """ Instant cutoverInstant; if (gregorianCutover == DEFAULT_CUTOVER.getMillis()) { cutoverInstant = null; } else { cutoverInstant = new Instant(gregorianCutover); } return getInstance(zone, cutoverInstant, minDaysInFirstWeek); }
java
public static GJChronology getInstance( DateTimeZone zone, long gregorianCutover, int minDaysInFirstWeek) { Instant cutoverInstant; if (gregorianCutover == DEFAULT_CUTOVER.getMillis()) { cutoverInstant = null; } else { cutoverInstant = new Instant(gregorianCutover); } return getInstance(zone, cutoverInstant, minDaysInFirstWeek); }
[ "public", "static", "GJChronology", "getInstance", "(", "DateTimeZone", "zone", ",", "long", "gregorianCutover", ",", "int", "minDaysInFirstWeek", ")", "{", "Instant", "cutoverInstant", ";", "if", "(", "gregorianCutover", "==", "DEFAULT_CUTOVER", ".", "getMillis", "(", ")", ")", "{", "cutoverInstant", "=", "null", ";", "}", "else", "{", "cutoverInstant", "=", "new", "Instant", "(", "gregorianCutover", ")", ";", "}", "return", "getInstance", "(", "zone", ",", "cutoverInstant", ",", "minDaysInFirstWeek", ")", ";", "}" ]
Factory method returns instances of the GJ cutover chronology. Any cutover date may be specified. @param zone the time zone to use, null is default @param gregorianCutover the cutover to use @param minDaysInFirstWeek minimum number of days in first week of the year; default is 4
[ "Factory", "method", "returns", "instances", "of", "the", "GJ", "cutover", "chronology", ".", "Any", "cutover", "date", "may", "be", "specified", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/chrono/GJChronology.java#L232-L244
Jasig/uPortal
uPortal-utils/uPortal-utils-jmx/src/main/java/org/apereo/portal/jmx/JavaManagementServerBean.java
JavaManagementServerBean.getServiceUrl
protected JMXServiceURL getServiceUrl(final int portOne, int portTwo) { """ Generates the JMXServiceURL for the two specified ports. @return A JMXServiceURL for this host using the two specified ports. @throws IllegalStateException If localhost cannot be resolved or if the JMXServiceURL is malformed. """ final String jmxHost; if (this.host == null) { final InetAddress inetHost; try { inetHost = InetAddress.getLocalHost(); } catch (UnknownHostException uhe) { throw new IllegalStateException("Cannot resolve localhost InetAddress.", uhe); } jmxHost = inetHost.getHostName(); } else { jmxHost = this.host; } final String jmxUrl = "service:jmx:rmi://" + jmxHost + ":" + portTwo + "/jndi/rmi://" + jmxHost + ":" + portOne + "/server"; final JMXServiceURL jmxServiceUrl; try { jmxServiceUrl = new JMXServiceURL(jmxUrl); } catch (MalformedURLException mue) { throw new IllegalStateException( "Failed to create JMXServiceURL for url String '" + jmxUrl + "'", mue); } if (this.logger.isDebugEnabled()) { this.logger.debug( "Generated JMXServiceURL='" + jmxServiceUrl + "' from String " + jmxUrl + "'."); } return jmxServiceUrl; }
java
protected JMXServiceURL getServiceUrl(final int portOne, int portTwo) { final String jmxHost; if (this.host == null) { final InetAddress inetHost; try { inetHost = InetAddress.getLocalHost(); } catch (UnknownHostException uhe) { throw new IllegalStateException("Cannot resolve localhost InetAddress.", uhe); } jmxHost = inetHost.getHostName(); } else { jmxHost = this.host; } final String jmxUrl = "service:jmx:rmi://" + jmxHost + ":" + portTwo + "/jndi/rmi://" + jmxHost + ":" + portOne + "/server"; final JMXServiceURL jmxServiceUrl; try { jmxServiceUrl = new JMXServiceURL(jmxUrl); } catch (MalformedURLException mue) { throw new IllegalStateException( "Failed to create JMXServiceURL for url String '" + jmxUrl + "'", mue); } if (this.logger.isDebugEnabled()) { this.logger.debug( "Generated JMXServiceURL='" + jmxServiceUrl + "' from String " + jmxUrl + "'."); } return jmxServiceUrl; }
[ "protected", "JMXServiceURL", "getServiceUrl", "(", "final", "int", "portOne", ",", "int", "portTwo", ")", "{", "final", "String", "jmxHost", ";", "if", "(", "this", ".", "host", "==", "null", ")", "{", "final", "InetAddress", "inetHost", ";", "try", "{", "inetHost", "=", "InetAddress", ".", "getLocalHost", "(", ")", ";", "}", "catch", "(", "UnknownHostException", "uhe", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Cannot resolve localhost InetAddress.\"", ",", "uhe", ")", ";", "}", "jmxHost", "=", "inetHost", ".", "getHostName", "(", ")", ";", "}", "else", "{", "jmxHost", "=", "this", ".", "host", ";", "}", "final", "String", "jmxUrl", "=", "\"service:jmx:rmi://\"", "+", "jmxHost", "+", "\":\"", "+", "portTwo", "+", "\"/jndi/rmi://\"", "+", "jmxHost", "+", "\":\"", "+", "portOne", "+", "\"/server\"", ";", "final", "JMXServiceURL", "jmxServiceUrl", ";", "try", "{", "jmxServiceUrl", "=", "new", "JMXServiceURL", "(", "jmxUrl", ")", ";", "}", "catch", "(", "MalformedURLException", "mue", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Failed to create JMXServiceURL for url String '\"", "+", "jmxUrl", "+", "\"'\"", ",", "mue", ")", ";", "}", "if", "(", "this", ".", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "this", ".", "logger", ".", "debug", "(", "\"Generated JMXServiceURL='\"", "+", "jmxServiceUrl", "+", "\"' from String \"", "+", "jmxUrl", "+", "\"'.\"", ")", ";", "}", "return", "jmxServiceUrl", ";", "}" ]
Generates the JMXServiceURL for the two specified ports. @return A JMXServiceURL for this host using the two specified ports. @throws IllegalStateException If localhost cannot be resolved or if the JMXServiceURL is malformed.
[ "Generates", "the", "JMXServiceURL", "for", "the", "two", "specified", "ports", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-utils/uPortal-utils-jmx/src/main/java/org/apereo/portal/jmx/JavaManagementServerBean.java#L269-L309
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Util.java
Util.saveTo
public static void saveTo(String path, byte[] content) { """ Saves content of byte array to file. @param path path to file - can be absolute or relative to current. @param content bytes to save. """ InputStream is = null; try { is = new ByteArrayInputStream(content); saveTo(path, is); } finally { closeQuietly(is); } }
java
public static void saveTo(String path, byte[] content) { InputStream is = null; try { is = new ByteArrayInputStream(content); saveTo(path, is); } finally { closeQuietly(is); } }
[ "public", "static", "void", "saveTo", "(", "String", "path", ",", "byte", "[", "]", "content", ")", "{", "InputStream", "is", "=", "null", ";", "try", "{", "is", "=", "new", "ByteArrayInputStream", "(", "content", ")", ";", "saveTo", "(", "path", ",", "is", ")", ";", "}", "finally", "{", "closeQuietly", "(", "is", ")", ";", "}", "}" ]
Saves content of byte array to file. @param path path to file - can be absolute or relative to current. @param content bytes to save.
[ "Saves", "content", "of", "byte", "array", "to", "file", "." ]
train
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Util.java#L456-L464
jcuda/jcusparse
JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java
JCusparse.cusparseXbsrsm2_zeroPivot
public static int cusparseXbsrsm2_zeroPivot( cusparseHandle handle, bsrsm2Info info, Pointer position) { """ <pre> Description: Solution of triangular linear system op(A) * X = alpha * B, with multiple right-hand-sides, where A is a sparse matrix in CSR storage format, rhs B and solution X are dense tall matrices. This routine implements algorithm 2 for this problem. </pre> """ return checkResult(cusparseXbsrsm2_zeroPivotNative(handle, info, position)); }
java
public static int cusparseXbsrsm2_zeroPivot( cusparseHandle handle, bsrsm2Info info, Pointer position) { return checkResult(cusparseXbsrsm2_zeroPivotNative(handle, info, position)); }
[ "public", "static", "int", "cusparseXbsrsm2_zeroPivot", "(", "cusparseHandle", "handle", ",", "bsrsm2Info", "info", ",", "Pointer", "position", ")", "{", "return", "checkResult", "(", "cusparseXbsrsm2_zeroPivotNative", "(", "handle", ",", "info", ",", "position", ")", ")", ";", "}" ]
<pre> Description: Solution of triangular linear system op(A) * X = alpha * B, with multiple right-hand-sides, where A is a sparse matrix in CSR storage format, rhs B and solution X are dense tall matrices. This routine implements algorithm 2 for this problem. </pre>
[ "<pre", ">", "Description", ":", "Solution", "of", "triangular", "linear", "system", "op", "(", "A", ")", "*", "X", "=", "alpha", "*", "B", "with", "multiple", "right", "-", "hand", "-", "sides", "where", "A", "is", "a", "sparse", "matrix", "in", "CSR", "storage", "format", "rhs", "B", "and", "solution", "X", "are", "dense", "tall", "matrices", ".", "This", "routine", "implements", "algorithm", "2", "for", "this", "problem", ".", "<", "/", "pre", ">" ]
train
https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L5071-L5077
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/agent/DependencyCheckScanAgent.java
DependencyCheckScanAgent.executeDependencyCheck
private Engine executeDependencyCheck() throws ExceptionCollection { """ Executes the Dependency-Check on the dependent libraries. <b>Note</b>, the engine object returned from this method must be closed by calling `close()` @return the Engine used to scan the dependencies. @throws ExceptionCollection a collection of one or more exceptions that occurred during analysis. """ populateSettings(); final Engine engine; try { engine = new Engine(settings); } catch (DatabaseException ex) { throw new ExceptionCollection(ex, true); } if (this.updateOnly) { try { engine.doUpdates(); } catch (UpdateException ex) { throw new ExceptionCollection(ex); } finally { engine.close(); } } else { engine.setDependencies(this.dependencies); engine.analyzeDependencies(); } return engine; }
java
private Engine executeDependencyCheck() throws ExceptionCollection { populateSettings(); final Engine engine; try { engine = new Engine(settings); } catch (DatabaseException ex) { throw new ExceptionCollection(ex, true); } if (this.updateOnly) { try { engine.doUpdates(); } catch (UpdateException ex) { throw new ExceptionCollection(ex); } finally { engine.close(); } } else { engine.setDependencies(this.dependencies); engine.analyzeDependencies(); } return engine; }
[ "private", "Engine", "executeDependencyCheck", "(", ")", "throws", "ExceptionCollection", "{", "populateSettings", "(", ")", ";", "final", "Engine", "engine", ";", "try", "{", "engine", "=", "new", "Engine", "(", "settings", ")", ";", "}", "catch", "(", "DatabaseException", "ex", ")", "{", "throw", "new", "ExceptionCollection", "(", "ex", ",", "true", ")", ";", "}", "if", "(", "this", ".", "updateOnly", ")", "{", "try", "{", "engine", ".", "doUpdates", "(", ")", ";", "}", "catch", "(", "UpdateException", "ex", ")", "{", "throw", "new", "ExceptionCollection", "(", "ex", ")", ";", "}", "finally", "{", "engine", ".", "close", "(", ")", ";", "}", "}", "else", "{", "engine", ".", "setDependencies", "(", "this", ".", "dependencies", ")", ";", "engine", ".", "analyzeDependencies", "(", ")", ";", "}", "return", "engine", ";", "}" ]
Executes the Dependency-Check on the dependent libraries. <b>Note</b>, the engine object returned from this method must be closed by calling `close()` @return the Engine used to scan the dependencies. @throws ExceptionCollection a collection of one or more exceptions that occurred during analysis.
[ "Executes", "the", "Dependency", "-", "Check", "on", "the", "dependent", "libraries", ".", "<b", ">", "Note<", "/", "b", ">", "the", "engine", "object", "returned", "from", "this", "method", "must", "be", "closed", "by", "calling", "close", "()" ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/agent/DependencyCheckScanAgent.java#L862-L883
wcm-io/wcm-io-tooling
commons/content-package-builder/src/main/java/io/wcm/tooling/commons/contentpackagebuilder/ContentPackageBuilder.java
ContentPackageBuilder.xmlNamespace
public ContentPackageBuilder xmlNamespace(String prefix, String uri) { """ Register a XML namespace that is used by your content added to the JCR XML. This method can be called multiple times to register multiple namespaces. The JCR namespaces "jcr", "nt", "cq" and "sling" are registered by default. @param prefix Namespace prefix @param uri Namespace URI @return this """ metadata.addXmlNamespace(prefix, uri); return this; }
java
public ContentPackageBuilder xmlNamespace(String prefix, String uri) { metadata.addXmlNamespace(prefix, uri); return this; }
[ "public", "ContentPackageBuilder", "xmlNamespace", "(", "String", "prefix", ",", "String", "uri", ")", "{", "metadata", ".", "addXmlNamespace", "(", "prefix", ",", "uri", ")", ";", "return", "this", ";", "}" ]
Register a XML namespace that is used by your content added to the JCR XML. This method can be called multiple times to register multiple namespaces. The JCR namespaces "jcr", "nt", "cq" and "sling" are registered by default. @param prefix Namespace prefix @param uri Namespace URI @return this
[ "Register", "a", "XML", "namespace", "that", "is", "used", "by", "your", "content", "added", "to", "the", "JCR", "XML", ".", "This", "method", "can", "be", "called", "multiple", "times", "to", "register", "multiple", "namespaces", ".", "The", "JCR", "namespaces", "jcr", "nt", "cq", "and", "sling", "are", "registered", "by", "default", "." ]
train
https://github.com/wcm-io/wcm-io-tooling/blob/1abcd01dd3ad4cc248f03b431f929573d84fa9b4/commons/content-package-builder/src/main/java/io/wcm/tooling/commons/contentpackagebuilder/ContentPackageBuilder.java#L151-L154
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/StudentsTDistribution.java
StudentsTDistribution.logpdf
public static double logpdf(double val, int v) { """ Static version of the t distribution's PDF. @param val value to evaluate @param v degrees of freedom @return f(val,v) """ return GammaDistribution.logGamma((v + 1) * .5) - GammaDistribution.logGamma(v * .5) // - .5 * FastMath.log(v * Math.PI) + FastMath.log1p(val * val / v) * -.5 * (v + 1); }
java
public static double logpdf(double val, int v) { return GammaDistribution.logGamma((v + 1) * .5) - GammaDistribution.logGamma(v * .5) // - .5 * FastMath.log(v * Math.PI) + FastMath.log1p(val * val / v) * -.5 * (v + 1); }
[ "public", "static", "double", "logpdf", "(", "double", "val", ",", "int", "v", ")", "{", "return", "GammaDistribution", ".", "logGamma", "(", "(", "v", "+", "1", ")", "*", ".5", ")", "-", "GammaDistribution", ".", "logGamma", "(", "v", "*", ".5", ")", "//", "-", ".5", "*", "FastMath", ".", "log", "(", "v", "*", "Math", ".", "PI", ")", "+", "FastMath", ".", "log1p", "(", "val", "*", "val", "/", "v", ")", "*", "-", ".5", "*", "(", "v", "+", "1", ")", ";", "}" ]
Static version of the t distribution's PDF. @param val value to evaluate @param v degrees of freedom @return f(val,v)
[ "Static", "version", "of", "the", "t", "distribution", "s", "PDF", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/StudentsTDistribution.java#L124-L127
spring-projects/spring-boot
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONArray.java
JSONArray.put
public JSONArray put(int index, Object value) throws JSONException { """ Sets the value at {@code index} to {@code value}, null padding this array to the required length if necessary. If a value already exists at {@code index}, it will be replaced. @param index the index to set the value to @param value a {@link JSONObject}, {@link JSONArray}, String, Boolean, Integer, Long, Double, {@link JSONObject#NULL}, or {@code null}. May not be {@link Double#isNaN() NaNs} or {@link Double#isInfinite() infinities}. @return this array. @throws JSONException if processing of json failed """ if (value instanceof Number) { // deviate from the original by checking all Numbers, not just floats & // doubles JSON.checkDouble(((Number) value).doubleValue()); } while (this.values.size() <= index) { this.values.add(null); } this.values.set(index, value); return this; }
java
public JSONArray put(int index, Object value) throws JSONException { if (value instanceof Number) { // deviate from the original by checking all Numbers, not just floats & // doubles JSON.checkDouble(((Number) value).doubleValue()); } while (this.values.size() <= index) { this.values.add(null); } this.values.set(index, value); return this; }
[ "public", "JSONArray", "put", "(", "int", "index", ",", "Object", "value", ")", "throws", "JSONException", "{", "if", "(", "value", "instanceof", "Number", ")", "{", "// deviate from the original by checking all Numbers, not just floats &", "// doubles", "JSON", ".", "checkDouble", "(", "(", "(", "Number", ")", "value", ")", ".", "doubleValue", "(", ")", ")", ";", "}", "while", "(", "this", ".", "values", ".", "size", "(", ")", "<=", "index", ")", "{", "this", ".", "values", ".", "add", "(", "null", ")", ";", "}", "this", ".", "values", ".", "set", "(", "index", ",", "value", ")", ";", "return", "this", ";", "}" ]
Sets the value at {@code index} to {@code value}, null padding this array to the required length if necessary. If a value already exists at {@code index}, it will be replaced. @param index the index to set the value to @param value a {@link JSONObject}, {@link JSONArray}, String, Boolean, Integer, Long, Double, {@link JSONObject#NULL}, or {@code null}. May not be {@link Double#isNaN() NaNs} or {@link Double#isInfinite() infinities}. @return this array. @throws JSONException if processing of json failed
[ "Sets", "the", "value", "at", "{" ]
train
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONArray.java#L250-L261
netty/netty
buffer/src/main/java/io/netty/buffer/ByteBufUtil.java
ByteBufUtil.appendPrettyHexDump
public static void appendPrettyHexDump(StringBuilder dump, ByteBuf buf, int offset, int length) { """ Appends the prettified multi-line hexadecimal dump of the specified {@link ByteBuf} to the specified {@link StringBuilder} that is easy to read by humans, starting at the given {@code offset} using the given {@code length}. """ HexUtil.appendPrettyHexDump(dump, buf, offset, length); }
java
public static void appendPrettyHexDump(StringBuilder dump, ByteBuf buf, int offset, int length) { HexUtil.appendPrettyHexDump(dump, buf, offset, length); }
[ "public", "static", "void", "appendPrettyHexDump", "(", "StringBuilder", "dump", ",", "ByteBuf", "buf", ",", "int", "offset", ",", "int", "length", ")", "{", "HexUtil", ".", "appendPrettyHexDump", "(", "dump", ",", "buf", ",", "offset", ",", "length", ")", ";", "}" ]
Appends the prettified multi-line hexadecimal dump of the specified {@link ByteBuf} to the specified {@link StringBuilder} that is easy to read by humans, starting at the given {@code offset} using the given {@code length}.
[ "Appends", "the", "prettified", "multi", "-", "line", "hexadecimal", "dump", "of", "the", "specified", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L935-L937
crawljax/crawljax
core/src/main/java/com/crawljax/util/DomUtils.java
DomUtils.removeTags
public static Document removeTags(Document dom, String tagName) { """ Removes all the given tags from the document. @param dom the document object. @param tagName the tag name, examples: script, style, meta @return the changed dom. """ NodeList list; try { list = XPathHelper.evaluateXpathExpression(dom, "//" + tagName.toUpperCase()); while (list.getLength() > 0) { Node sc = list.item(0); if (sc != null) { sc.getParentNode().removeChild(sc); } list = XPathHelper.evaluateXpathExpression(dom, "//" + tagName.toUpperCase()); } } catch (XPathExpressionException e) { LOGGER.error("Error while removing tag " + tagName, e); } return dom; }
java
public static Document removeTags(Document dom, String tagName) { NodeList list; try { list = XPathHelper.evaluateXpathExpression(dom, "//" + tagName.toUpperCase()); while (list.getLength() > 0) { Node sc = list.item(0); if (sc != null) { sc.getParentNode().removeChild(sc); } list = XPathHelper.evaluateXpathExpression(dom, "//" + tagName.toUpperCase()); } } catch (XPathExpressionException e) { LOGGER.error("Error while removing tag " + tagName, e); } return dom; }
[ "public", "static", "Document", "removeTags", "(", "Document", "dom", ",", "String", "tagName", ")", "{", "NodeList", "list", ";", "try", "{", "list", "=", "XPathHelper", ".", "evaluateXpathExpression", "(", "dom", ",", "\"//\"", "+", "tagName", ".", "toUpperCase", "(", ")", ")", ";", "while", "(", "list", ".", "getLength", "(", ")", ">", "0", ")", "{", "Node", "sc", "=", "list", ".", "item", "(", "0", ")", ";", "if", "(", "sc", "!=", "null", ")", "{", "sc", ".", "getParentNode", "(", ")", ".", "removeChild", "(", "sc", ")", ";", "}", "list", "=", "XPathHelper", ".", "evaluateXpathExpression", "(", "dom", ",", "\"//\"", "+", "tagName", ".", "toUpperCase", "(", ")", ")", ";", "}", "}", "catch", "(", "XPathExpressionException", "e", ")", "{", "LOGGER", ".", "error", "(", "\"Error while removing tag \"", "+", "tagName", ",", "e", ")", ";", "}", "return", "dom", ";", "}" ]
Removes all the given tags from the document. @param dom the document object. @param tagName the tag name, examples: script, style, meta @return the changed dom.
[ "Removes", "all", "the", "given", "tags", "from", "the", "document", "." ]
train
https://github.com/crawljax/crawljax/blob/d339f4f622ca902ccd35322065821e52a62ec543/core/src/main/java/com/crawljax/util/DomUtils.java#L171-L193
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/preview/ui/CmsBinaryPreviewContent.java
CmsBinaryPreviewContent.createListItem
private CmsListItem createListItem(CmsResourceInfoBean resourceInfo, CmsDNDHandler dndHandler) { """ Creates the list item for the resource information bean.<p> @param resourceInfo the resource information bean @param dndHandler the drag and drop handler @return the list item widget """ CmsListInfoBean infoBean = new CmsListInfoBean(); infoBean.setTitle( CmsStringUtil.isNotEmptyOrWhitespaceOnly(resourceInfo.getProperties().get(CmsClientProperty.PROPERTY_TITLE)) ? resourceInfo.getProperties().get(CmsClientProperty.PROPERTY_TITLE) : resourceInfo.getTitle()); infoBean.setSubTitle(resourceInfo.getResourcePath()); infoBean.setResourceType(resourceInfo.getResourceType()); infoBean.setBigIconClasses(resourceInfo.getBigIconClasses()); infoBean.setSmallIconClasses(resourceInfo.getSmallIconClasses()); infoBean.addAdditionalInfo(Messages.get().key(Messages.GUI_PREVIEW_LABEL_SIZE_0), resourceInfo.getSize()); if (resourceInfo.getDescription() != null) { infoBean.addAdditionalInfo( Messages.get().key(Messages.GUI_PREVIEW_LABEL_DESCRIPTION_0), resourceInfo.getDescription()); } if (resourceInfo.getLastModified() != null) { infoBean.addAdditionalInfo( Messages.get().key(Messages.GUI_PREVIEW_LABEL_DATEMODIFIED_0), CmsDateTimeUtil.getDate(resourceInfo.getLastModified(), Format.MEDIUM)); } CmsListItemWidget itemWidget = new CmsListItemWidget(infoBean); itemWidget.addOpenHandler(new OpenHandler<CmsListItemWidget>() { public void onOpen(OpenEvent<CmsListItemWidget> event) { int widgetHeight = event.getTarget().getOffsetHeight(); m_previewContent.getElement().getStyle().setTop(12 + widgetHeight, Unit.PX); } }); itemWidget.addCloseHandler(new CloseHandler<CmsListItemWidget>() { public void onClose(CloseEvent<CmsListItemWidget> event) { m_previewContent.getElement().getStyle().clearTop(); } }); CmsListItem result = new CmsListItem(itemWidget); CmsPushButton button = CmsResultListItem.createDeleteButton(); if (dndHandler != null) { result.initMoveHandle(dndHandler); } CmsResultsTab resultsTab = m_binaryPreviewHandler.getGalleryDialog().getResultsTab(); final DeleteHandler deleteHandler = resultsTab.makeDeleteHandler(resourceInfo.getResourcePath()); ClickHandler handler = new ClickHandler() { public void onClick(ClickEvent event) { deleteHandler.onClick(event); m_binaryPreviewHandler.closePreview(); } }; button.addClickHandler(handler); itemWidget.addButton(button); return result; }
java
private CmsListItem createListItem(CmsResourceInfoBean resourceInfo, CmsDNDHandler dndHandler) { CmsListInfoBean infoBean = new CmsListInfoBean(); infoBean.setTitle( CmsStringUtil.isNotEmptyOrWhitespaceOnly(resourceInfo.getProperties().get(CmsClientProperty.PROPERTY_TITLE)) ? resourceInfo.getProperties().get(CmsClientProperty.PROPERTY_TITLE) : resourceInfo.getTitle()); infoBean.setSubTitle(resourceInfo.getResourcePath()); infoBean.setResourceType(resourceInfo.getResourceType()); infoBean.setBigIconClasses(resourceInfo.getBigIconClasses()); infoBean.setSmallIconClasses(resourceInfo.getSmallIconClasses()); infoBean.addAdditionalInfo(Messages.get().key(Messages.GUI_PREVIEW_LABEL_SIZE_0), resourceInfo.getSize()); if (resourceInfo.getDescription() != null) { infoBean.addAdditionalInfo( Messages.get().key(Messages.GUI_PREVIEW_LABEL_DESCRIPTION_0), resourceInfo.getDescription()); } if (resourceInfo.getLastModified() != null) { infoBean.addAdditionalInfo( Messages.get().key(Messages.GUI_PREVIEW_LABEL_DATEMODIFIED_0), CmsDateTimeUtil.getDate(resourceInfo.getLastModified(), Format.MEDIUM)); } CmsListItemWidget itemWidget = new CmsListItemWidget(infoBean); itemWidget.addOpenHandler(new OpenHandler<CmsListItemWidget>() { public void onOpen(OpenEvent<CmsListItemWidget> event) { int widgetHeight = event.getTarget().getOffsetHeight(); m_previewContent.getElement().getStyle().setTop(12 + widgetHeight, Unit.PX); } }); itemWidget.addCloseHandler(new CloseHandler<CmsListItemWidget>() { public void onClose(CloseEvent<CmsListItemWidget> event) { m_previewContent.getElement().getStyle().clearTop(); } }); CmsListItem result = new CmsListItem(itemWidget); CmsPushButton button = CmsResultListItem.createDeleteButton(); if (dndHandler != null) { result.initMoveHandle(dndHandler); } CmsResultsTab resultsTab = m_binaryPreviewHandler.getGalleryDialog().getResultsTab(); final DeleteHandler deleteHandler = resultsTab.makeDeleteHandler(resourceInfo.getResourcePath()); ClickHandler handler = new ClickHandler() { public void onClick(ClickEvent event) { deleteHandler.onClick(event); m_binaryPreviewHandler.closePreview(); } }; button.addClickHandler(handler); itemWidget.addButton(button); return result; }
[ "private", "CmsListItem", "createListItem", "(", "CmsResourceInfoBean", "resourceInfo", ",", "CmsDNDHandler", "dndHandler", ")", "{", "CmsListInfoBean", "infoBean", "=", "new", "CmsListInfoBean", "(", ")", ";", "infoBean", ".", "setTitle", "(", "CmsStringUtil", ".", "isNotEmptyOrWhitespaceOnly", "(", "resourceInfo", ".", "getProperties", "(", ")", ".", "get", "(", "CmsClientProperty", ".", "PROPERTY_TITLE", ")", ")", "?", "resourceInfo", ".", "getProperties", "(", ")", ".", "get", "(", "CmsClientProperty", ".", "PROPERTY_TITLE", ")", ":", "resourceInfo", ".", "getTitle", "(", ")", ")", ";", "infoBean", ".", "setSubTitle", "(", "resourceInfo", ".", "getResourcePath", "(", ")", ")", ";", "infoBean", ".", "setResourceType", "(", "resourceInfo", ".", "getResourceType", "(", ")", ")", ";", "infoBean", ".", "setBigIconClasses", "(", "resourceInfo", ".", "getBigIconClasses", "(", ")", ")", ";", "infoBean", ".", "setSmallIconClasses", "(", "resourceInfo", ".", "getSmallIconClasses", "(", ")", ")", ";", "infoBean", ".", "addAdditionalInfo", "(", "Messages", ".", "get", "(", ")", ".", "key", "(", "Messages", ".", "GUI_PREVIEW_LABEL_SIZE_0", ")", ",", "resourceInfo", ".", "getSize", "(", ")", ")", ";", "if", "(", "resourceInfo", ".", "getDescription", "(", ")", "!=", "null", ")", "{", "infoBean", ".", "addAdditionalInfo", "(", "Messages", ".", "get", "(", ")", ".", "key", "(", "Messages", ".", "GUI_PREVIEW_LABEL_DESCRIPTION_0", ")", ",", "resourceInfo", ".", "getDescription", "(", ")", ")", ";", "}", "if", "(", "resourceInfo", ".", "getLastModified", "(", ")", "!=", "null", ")", "{", "infoBean", ".", "addAdditionalInfo", "(", "Messages", ".", "get", "(", ")", ".", "key", "(", "Messages", ".", "GUI_PREVIEW_LABEL_DATEMODIFIED_0", ")", ",", "CmsDateTimeUtil", ".", "getDate", "(", "resourceInfo", ".", "getLastModified", "(", ")", ",", "Format", ".", "MEDIUM", ")", ")", ";", "}", "CmsListItemWidget", "itemWidget", "=", "new", "CmsListItemWidget", "(", "infoBean", ")", ";", "itemWidget", ".", "addOpenHandler", "(", "new", "OpenHandler", "<", "CmsListItemWidget", ">", "(", ")", "{", "public", "void", "onOpen", "(", "OpenEvent", "<", "CmsListItemWidget", ">", "event", ")", "{", "int", "widgetHeight", "=", "event", ".", "getTarget", "(", ")", ".", "getOffsetHeight", "(", ")", ";", "m_previewContent", ".", "getElement", "(", ")", ".", "getStyle", "(", ")", ".", "setTop", "(", "12", "+", "widgetHeight", ",", "Unit", ".", "PX", ")", ";", "}", "}", ")", ";", "itemWidget", ".", "addCloseHandler", "(", "new", "CloseHandler", "<", "CmsListItemWidget", ">", "(", ")", "{", "public", "void", "onClose", "(", "CloseEvent", "<", "CmsListItemWidget", ">", "event", ")", "{", "m_previewContent", ".", "getElement", "(", ")", ".", "getStyle", "(", ")", ".", "clearTop", "(", ")", ";", "}", "}", ")", ";", "CmsListItem", "result", "=", "new", "CmsListItem", "(", "itemWidget", ")", ";", "CmsPushButton", "button", "=", "CmsResultListItem", ".", "createDeleteButton", "(", ")", ";", "if", "(", "dndHandler", "!=", "null", ")", "{", "result", ".", "initMoveHandle", "(", "dndHandler", ")", ";", "}", "CmsResultsTab", "resultsTab", "=", "m_binaryPreviewHandler", ".", "getGalleryDialog", "(", ")", ".", "getResultsTab", "(", ")", ";", "final", "DeleteHandler", "deleteHandler", "=", "resultsTab", ".", "makeDeleteHandler", "(", "resourceInfo", ".", "getResourcePath", "(", ")", ")", ";", "ClickHandler", "handler", "=", "new", "ClickHandler", "(", ")", "{", "public", "void", "onClick", "(", "ClickEvent", "event", ")", "{", "deleteHandler", ".", "onClick", "(", "event", ")", ";", "m_binaryPreviewHandler", ".", "closePreview", "(", ")", ";", "}", "}", ";", "button", ".", "addClickHandler", "(", "handler", ")", ";", "itemWidget", ".", "addButton", "(", "button", ")", ";", "return", "result", ";", "}" ]
Creates the list item for the resource information bean.<p> @param resourceInfo the resource information bean @param dndHandler the drag and drop handler @return the list item widget
[ "Creates", "the", "list", "item", "for", "the", "resource", "information", "bean", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/preview/ui/CmsBinaryPreviewContent.java#L121-L178
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/print/PaperPrint.java
PaperPrint.surveyPage
public void surveyPage(PageFormat pageFormat, Graphics2D g2d, boolean bPrintHeader) { """ Save basic page information. @param pageFormat The pageformat from the print call. @param g2d The graphics environment from the print call. """ pageRect = new Rectangle((int)pageFormat.getImageableX(), (int)pageFormat.getImageableY(), (int)pageFormat.getImageableWidth(), (int)pageFormat.getImageableHeight()); FontMetrics fm = g2d.getFontMetrics(); int textHeight = fm.getHeight(); if (bPrintHeader) { headerHeight = textHeight + HEADER_MARGIN + BORDER; footerHeight = textHeight + HEADER_MARGIN + BORDER; } }
java
public void surveyPage(PageFormat pageFormat, Graphics2D g2d, boolean bPrintHeader) { pageRect = new Rectangle((int)pageFormat.getImageableX(), (int)pageFormat.getImageableY(), (int)pageFormat.getImageableWidth(), (int)pageFormat.getImageableHeight()); FontMetrics fm = g2d.getFontMetrics(); int textHeight = fm.getHeight(); if (bPrintHeader) { headerHeight = textHeight + HEADER_MARGIN + BORDER; footerHeight = textHeight + HEADER_MARGIN + BORDER; } }
[ "public", "void", "surveyPage", "(", "PageFormat", "pageFormat", ",", "Graphics2D", "g2d", ",", "boolean", "bPrintHeader", ")", "{", "pageRect", "=", "new", "Rectangle", "(", "(", "int", ")", "pageFormat", ".", "getImageableX", "(", ")", ",", "(", "int", ")", "pageFormat", ".", "getImageableY", "(", ")", ",", "(", "int", ")", "pageFormat", ".", "getImageableWidth", "(", ")", ",", "(", "int", ")", "pageFormat", ".", "getImageableHeight", "(", ")", ")", ";", "FontMetrics", "fm", "=", "g2d", ".", "getFontMetrics", "(", ")", ";", "int", "textHeight", "=", "fm", ".", "getHeight", "(", ")", ";", "if", "(", "bPrintHeader", ")", "{", "headerHeight", "=", "textHeight", "+", "HEADER_MARGIN", "+", "BORDER", ";", "footerHeight", "=", "textHeight", "+", "HEADER_MARGIN", "+", "BORDER", ";", "}", "}" ]
Save basic page information. @param pageFormat The pageformat from the print call. @param g2d The graphics environment from the print call.
[ "Save", "basic", "page", "information", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/print/PaperPrint.java#L57-L68
joniles/mpxj
src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java
MPD9AbstractReader.processOutlineCodeField
protected void processOutlineCodeField(Integer entityID, Row row) { """ Read a single outline code field extended attribute. @param entityID parent entity @param row field data """ processField(row, "OC_FIELD_ID", entityID, row.getString("OC_NAME")); }
java
protected void processOutlineCodeField(Integer entityID, Row row) { processField(row, "OC_FIELD_ID", entityID, row.getString("OC_NAME")); }
[ "protected", "void", "processOutlineCodeField", "(", "Integer", "entityID", ",", "Row", "row", ")", "{", "processField", "(", "row", ",", "\"OC_FIELD_ID\"", ",", "entityID", ",", "row", ".", "getString", "(", "\"OC_NAME\"", ")", ")", ";", "}" ]
Read a single outline code field extended attribute. @param entityID parent entity @param row field data
[ "Read", "a", "single", "outline", "code", "field", "extended", "attribute", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java#L703-L706
dickschoeller/gedbrowser
gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/util/DateParser.java
DateParser.stripPrefix
private String stripPrefix(final String input, final String searchString) { """ Strip the searchString with and trim the result. @param input the source string @param searchString the string to look for in the source @return the stripped string """ return input.substring(searchString.length(), input.length()).trim(); }
java
private String stripPrefix(final String input, final String searchString) { return input.substring(searchString.length(), input.length()).trim(); }
[ "private", "String", "stripPrefix", "(", "final", "String", "input", ",", "final", "String", "searchString", ")", "{", "return", "input", ".", "substring", "(", "searchString", ".", "length", "(", ")", ",", "input", ".", "length", "(", ")", ")", ".", "trim", "(", ")", ";", "}" ]
Strip the searchString with and trim the result. @param input the source string @param searchString the string to look for in the source @return the stripped string
[ "Strip", "the", "searchString", "with", "and", "trim", "the", "result", "." ]
train
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/util/DateParser.java#L183-L185
apache/incubator-gobblin
gobblin-compaction/src/main/java/org/apache/gobblin/compaction/verify/CompactionTimeRangeVerifier.java
CompactionTimeRangeVerifier.getMachedLookbackTime
public static String getMachedLookbackTime (String datasetName, String datasetsAndLookBacks, String sysDefaultLookback) { """ Find the correct lookback time for a given dataset. @param datasetsAndLookBacks Lookback string for multiple datasets. Datasets is represented by Regex pattern. Multiple 'datasets and lookback' pairs were joined by semi-colon. A default lookback time can be given without any Regex prefix. If nothing found, we will use {@param sysDefaultLookback}. Example Format: [Regex1]:[T1];[Regex2]:[T2];[DEFAULT_T];[Regex3]:[T3] Ex. Identity.*:1d2h;22h;BizProfile.BizCompany:3h (22h is default lookback time) @param sysDefaultLookback If user doesn't specify any lookback time for {@param datasetName}, also there is no default lookback time inside {@param datasetsAndLookBacks}, this system default lookback time is return. @param datasetName A description of dataset without time partition information. Example 'Identity/MemberAccount' or 'PageViewEvent' @return The lookback time matched with given dataset. """ String defaultLookback = sysDefaultLookback; for (String entry : Splitter.on(";").trimResults() .omitEmptyStrings().splitToList(datasetsAndLookBacks)) { List<String> datasetAndLookbackTime = Splitter.on(":").trimResults().omitEmptyStrings().splitToList(entry); if (datasetAndLookbackTime.size() == 1) { defaultLookback = datasetAndLookbackTime.get(0); } else if (datasetAndLookbackTime.size() == 2) { String regex = datasetAndLookbackTime.get(0); if (Pattern.compile(regex).matcher(datasetName).find()) { return datasetAndLookbackTime.get(1); } } else { log.error("Invalid format in {}, {} cannot find its lookback time", datasetsAndLookBacks, datasetName); } } return defaultLookback; }
java
public static String getMachedLookbackTime (String datasetName, String datasetsAndLookBacks, String sysDefaultLookback) { String defaultLookback = sysDefaultLookback; for (String entry : Splitter.on(";").trimResults() .omitEmptyStrings().splitToList(datasetsAndLookBacks)) { List<String> datasetAndLookbackTime = Splitter.on(":").trimResults().omitEmptyStrings().splitToList(entry); if (datasetAndLookbackTime.size() == 1) { defaultLookback = datasetAndLookbackTime.get(0); } else if (datasetAndLookbackTime.size() == 2) { String regex = datasetAndLookbackTime.get(0); if (Pattern.compile(regex).matcher(datasetName).find()) { return datasetAndLookbackTime.get(1); } } else { log.error("Invalid format in {}, {} cannot find its lookback time", datasetsAndLookBacks, datasetName); } } return defaultLookback; }
[ "public", "static", "String", "getMachedLookbackTime", "(", "String", "datasetName", ",", "String", "datasetsAndLookBacks", ",", "String", "sysDefaultLookback", ")", "{", "String", "defaultLookback", "=", "sysDefaultLookback", ";", "for", "(", "String", "entry", ":", "Splitter", ".", "on", "(", "\";\"", ")", ".", "trimResults", "(", ")", ".", "omitEmptyStrings", "(", ")", ".", "splitToList", "(", "datasetsAndLookBacks", ")", ")", "{", "List", "<", "String", ">", "datasetAndLookbackTime", "=", "Splitter", ".", "on", "(", "\":\"", ")", ".", "trimResults", "(", ")", ".", "omitEmptyStrings", "(", ")", ".", "splitToList", "(", "entry", ")", ";", "if", "(", "datasetAndLookbackTime", ".", "size", "(", ")", "==", "1", ")", "{", "defaultLookback", "=", "datasetAndLookbackTime", ".", "get", "(", "0", ")", ";", "}", "else", "if", "(", "datasetAndLookbackTime", ".", "size", "(", ")", "==", "2", ")", "{", "String", "regex", "=", "datasetAndLookbackTime", ".", "get", "(", "0", ")", ";", "if", "(", "Pattern", ".", "compile", "(", "regex", ")", ".", "matcher", "(", "datasetName", ")", ".", "find", "(", ")", ")", "{", "return", "datasetAndLookbackTime", ".", "get", "(", "1", ")", ";", "}", "}", "else", "{", "log", ".", "error", "(", "\"Invalid format in {}, {} cannot find its lookback time\"", ",", "datasetsAndLookBacks", ",", "datasetName", ")", ";", "}", "}", "return", "defaultLookback", ";", "}" ]
Find the correct lookback time for a given dataset. @param datasetsAndLookBacks Lookback string for multiple datasets. Datasets is represented by Regex pattern. Multiple 'datasets and lookback' pairs were joined by semi-colon. A default lookback time can be given without any Regex prefix. If nothing found, we will use {@param sysDefaultLookback}. Example Format: [Regex1]:[T1];[Regex2]:[T2];[DEFAULT_T];[Regex3]:[T3] Ex. Identity.*:1d2h;22h;BizProfile.BizCompany:3h (22h is default lookback time) @param sysDefaultLookback If user doesn't specify any lookback time for {@param datasetName}, also there is no default lookback time inside {@param datasetsAndLookBacks}, this system default lookback time is return. @param datasetName A description of dataset without time partition information. Example 'Identity/MemberAccount' or 'PageViewEvent' @return The lookback time matched with given dataset.
[ "Find", "the", "correct", "lookback", "time", "for", "a", "given", "dataset", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-compaction/src/main/java/org/apache/gobblin/compaction/verify/CompactionTimeRangeVerifier.java#L112-L130
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/io/csv/CsvWriter.java
CsvWriter.addCells
public static void addCells(StringBuilder builder, String... cells) { """ Add formatted CSV cells to a builder @param builder the string builder @param cells the cells to format as CSV cells in a row """ if(builder == null || cells == null || cells.length == 0) return; for (String cell : cells) { addCell(builder,cell); } }
java
public static void addCells(StringBuilder builder, String... cells) { if(builder == null || cells == null || cells.length == 0) return; for (String cell : cells) { addCell(builder,cell); } }
[ "public", "static", "void", "addCells", "(", "StringBuilder", "builder", ",", "String", "...", "cells", ")", "{", "if", "(", "builder", "==", "null", "||", "cells", "==", "null", "||", "cells", ".", "length", "==", "0", ")", "return", ";", "for", "(", "String", "cell", ":", "cells", ")", "{", "addCell", "(", "builder", ",", "cell", ")", ";", "}", "}" ]
Add formatted CSV cells to a builder @param builder the string builder @param cells the cells to format as CSV cells in a row
[ "Add", "formatted", "CSV", "cells", "to", "a", "builder" ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/io/csv/CsvWriter.java#L183-L192
kiegroup/drools
drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/java/parser/JavaParser.java
JavaParser.methodName
public final void methodName() throws RecognitionException { """ src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1229:1: methodName : ( Identifier | 'insert' | 'update' | 'modify' | 'retract' | 'delete' ); """ int methodName_StartIndex = input.index(); try { if ( state.backtracking>0 && alreadyParsedRule(input, 128) ) { return; } // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1230:5: ( Identifier | 'insert' | 'update' | 'modify' | 'retract' | 'delete' ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g: { if ( input.LA(1)==Identifier||input.LA(1)==75||input.LA(1)==90||input.LA(1)==95||input.LA(1)==103||input.LA(1)==117 ) { input.consume(); state.errorRecovery=false; state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return;} MismatchedSetException mse = new MismatchedSetException(null,input); throw mse; } } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 128, methodName_StartIndex); } } }
java
public final void methodName() throws RecognitionException { int methodName_StartIndex = input.index(); try { if ( state.backtracking>0 && alreadyParsedRule(input, 128) ) { return; } // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1230:5: ( Identifier | 'insert' | 'update' | 'modify' | 'retract' | 'delete' ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g: { if ( input.LA(1)==Identifier||input.LA(1)==75||input.LA(1)==90||input.LA(1)==95||input.LA(1)==103||input.LA(1)==117 ) { input.consume(); state.errorRecovery=false; state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return;} MismatchedSetException mse = new MismatchedSetException(null,input); throw mse; } } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 128, methodName_StartIndex); } } }
[ "public", "final", "void", "methodName", "(", ")", "throws", "RecognitionException", "{", "int", "methodName_StartIndex", "=", "input", ".", "index", "(", ")", ";", "try", "{", "if", "(", "state", ".", "backtracking", ">", "0", "&&", "alreadyParsedRule", "(", "input", ",", "128", ")", ")", "{", "return", ";", "}", "// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1230:5: ( Identifier | 'insert' | 'update' | 'modify' | 'retract' | 'delete' )", "// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:", "{", "if", "(", "input", ".", "LA", "(", "1", ")", "==", "Identifier", "||", "input", ".", "LA", "(", "1", ")", "==", "75", "||", "input", ".", "LA", "(", "1", ")", "==", "90", "||", "input", ".", "LA", "(", "1", ")", "==", "95", "||", "input", ".", "LA", "(", "1", ")", "==", "103", "||", "input", ".", "LA", "(", "1", ")", "==", "117", ")", "{", "input", ".", "consume", "(", ")", ";", "state", ".", "errorRecovery", "=", "false", ";", "state", ".", "failed", "=", "false", ";", "}", "else", "{", "if", "(", "state", ".", "backtracking", ">", "0", ")", "{", "state", ".", "failed", "=", "true", ";", "return", ";", "}", "MismatchedSetException", "mse", "=", "new", "MismatchedSetException", "(", "null", ",", "input", ")", ";", "throw", "mse", ";", "}", "}", "}", "catch", "(", "RecognitionException", "re", ")", "{", "reportError", "(", "re", ")", ";", "recover", "(", "input", ",", "re", ")", ";", "}", "finally", "{", "// do for sure before leaving", "if", "(", "state", ".", "backtracking", ">", "0", ")", "{", "memoize", "(", "input", ",", "128", ",", "methodName_StartIndex", ")", ";", "}", "}", "}" ]
src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1229:1: methodName : ( Identifier | 'insert' | 'update' | 'modify' | 'retract' | 'delete' );
[ "src", "/", "main", "/", "resources", "/", "org", "/", "drools", "/", "compiler", "/", "semantics", "/", "java", "/", "parser", "/", "Java", ".", "g", ":", "1229", ":", "1", ":", "methodName", ":", "(", "Identifier", "|", "insert", "|", "update", "|", "modify", "|", "retract", "|", "delete", ")", ";" ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/java/parser/JavaParser.java#L11237-L11268
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceListsImpl.java
FaceListsImpl.addFaceFromUrl
public PersistedFace addFaceFromUrl(String faceListId, String url, AddFaceFromUrlOptionalParameter addFaceFromUrlOptionalParameter) { """ Add a face to a face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. @param faceListId Id referencing a particular face list. @param url Publicly reachable URL of an image @param addFaceFromUrlOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws APIErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PersistedFace object if successful. """ return addFaceFromUrlWithServiceResponseAsync(faceListId, url, addFaceFromUrlOptionalParameter).toBlocking().single().body(); }
java
public PersistedFace addFaceFromUrl(String faceListId, String url, AddFaceFromUrlOptionalParameter addFaceFromUrlOptionalParameter) { return addFaceFromUrlWithServiceResponseAsync(faceListId, url, addFaceFromUrlOptionalParameter).toBlocking().single().body(); }
[ "public", "PersistedFace", "addFaceFromUrl", "(", "String", "faceListId", ",", "String", "url", ",", "AddFaceFromUrlOptionalParameter", "addFaceFromUrlOptionalParameter", ")", "{", "return", "addFaceFromUrlWithServiceResponseAsync", "(", "faceListId", ",", "url", ",", "addFaceFromUrlOptionalParameter", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Add a face to a face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. @param faceListId Id referencing a particular face list. @param url Publicly reachable URL of an image @param addFaceFromUrlOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws APIErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PersistedFace object if successful.
[ "Add", "a", "face", "to", "a", "face", "list", ".", "The", "input", "face", "is", "specified", "as", "an", "image", "with", "a", "targetFace", "rectangle", ".", "It", "returns", "a", "persistedFaceId", "representing", "the", "added", "face", "and", "persistedFaceId", "will", "not", "expire", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceListsImpl.java#L751-L753
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionRangeConfig.java
CollisionRangeConfig.imports
public static CollisionRange imports(XmlReader node) { """ Create the collision range data from a node. @param node The node reference (must not be <code>null</code>). @return The collision range data. @throws LionEngineException If error when reading node. """ Check.notNull(node); final String axisName = node.readString(ATT_AXIS); try { final Axis axis = Axis.valueOf(axisName); final int minX = node.readInteger(ATT_MIN_X); final int maxX = node.readInteger(ATT_MAX_X); final int minY = node.readInteger(ATT_MIN_Y); final int maxY = node.readInteger(ATT_MAX_Y); return new CollisionRange(axis, minX, maxX, minY, maxY); } catch (final IllegalArgumentException exception) { throw new LionEngineException(exception, ERROR_TYPE + axisName); } }
java
public static CollisionRange imports(XmlReader node) { Check.notNull(node); final String axisName = node.readString(ATT_AXIS); try { final Axis axis = Axis.valueOf(axisName); final int minX = node.readInteger(ATT_MIN_X); final int maxX = node.readInteger(ATT_MAX_X); final int minY = node.readInteger(ATT_MIN_Y); final int maxY = node.readInteger(ATT_MAX_Y); return new CollisionRange(axis, minX, maxX, minY, maxY); } catch (final IllegalArgumentException exception) { throw new LionEngineException(exception, ERROR_TYPE + axisName); } }
[ "public", "static", "CollisionRange", "imports", "(", "XmlReader", "node", ")", "{", "Check", ".", "notNull", "(", "node", ")", ";", "final", "String", "axisName", "=", "node", ".", "readString", "(", "ATT_AXIS", ")", ";", "try", "{", "final", "Axis", "axis", "=", "Axis", ".", "valueOf", "(", "axisName", ")", ";", "final", "int", "minX", "=", "node", ".", "readInteger", "(", "ATT_MIN_X", ")", ";", "final", "int", "maxX", "=", "node", ".", "readInteger", "(", "ATT_MAX_X", ")", ";", "final", "int", "minY", "=", "node", ".", "readInteger", "(", "ATT_MIN_Y", ")", ";", "final", "int", "maxY", "=", "node", ".", "readInteger", "(", "ATT_MAX_Y", ")", ";", "return", "new", "CollisionRange", "(", "axis", ",", "minX", ",", "maxX", ",", "minY", ",", "maxY", ")", ";", "}", "catch", "(", "final", "IllegalArgumentException", "exception", ")", "{", "throw", "new", "LionEngineException", "(", "exception", ",", "ERROR_TYPE", "+", "axisName", ")", ";", "}", "}" ]
Create the collision range data from a node. @param node The node reference (must not be <code>null</code>). @return The collision range data. @throws LionEngineException If error when reading node.
[ "Create", "the", "collision", "range", "data", "from", "a", "node", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionRangeConfig.java#L58-L77
OpenLiberty/open-liberty
dev/com.ibm.ws.security.mp.jwt_fat_tck/fat/src/org/eclipse/microprofile/jwt/tck/util/TokenUtils.java
TokenUtils.readPrivateKey
public static PrivateKey readPrivateKey(String pemResName) throws Exception { """ Read a PEM encoded private key from the classpath @param pemResName - key file resource name @return PrivateKey @throws Exception on decode failure """ InputStream contentIS = TokenUtils.class.getResourceAsStream(pemResName); byte[] tmp = new byte[4096]; int length = contentIS.read(tmp); PrivateKey privateKey = decodePrivateKey(new String(tmp, 0, length)); return privateKey; }
java
public static PrivateKey readPrivateKey(String pemResName) throws Exception { InputStream contentIS = TokenUtils.class.getResourceAsStream(pemResName); byte[] tmp = new byte[4096]; int length = contentIS.read(tmp); PrivateKey privateKey = decodePrivateKey(new String(tmp, 0, length)); return privateKey; }
[ "public", "static", "PrivateKey", "readPrivateKey", "(", "String", "pemResName", ")", "throws", "Exception", "{", "InputStream", "contentIS", "=", "TokenUtils", ".", "class", ".", "getResourceAsStream", "(", "pemResName", ")", ";", "byte", "[", "]", "tmp", "=", "new", "byte", "[", "4096", "]", ";", "int", "length", "=", "contentIS", ".", "read", "(", "tmp", ")", ";", "PrivateKey", "privateKey", "=", "decodePrivateKey", "(", "new", "String", "(", "tmp", ",", "0", ",", "length", ")", ")", ";", "return", "privateKey", ";", "}" ]
Read a PEM encoded private key from the classpath @param pemResName - key file resource name @return PrivateKey @throws Exception on decode failure
[ "Read", "a", "PEM", "encoded", "private", "key", "from", "the", "classpath" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat_tck/fat/src/org/eclipse/microprofile/jwt/tck/util/TokenUtils.java#L162-L168
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.getPatternAnyEntityInfoAsync
public Observable<PatternAnyEntityExtractor> getPatternAnyEntityInfoAsync(UUID appId, String versionId, UUID entityId) { """ Gets information about the application version's Pattern.Any model. @param appId The application ID. @param versionId The version ID. @param entityId The entity extractor ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PatternAnyEntityExtractor object """ return getPatternAnyEntityInfoWithServiceResponseAsync(appId, versionId, entityId).map(new Func1<ServiceResponse<PatternAnyEntityExtractor>, PatternAnyEntityExtractor>() { @Override public PatternAnyEntityExtractor call(ServiceResponse<PatternAnyEntityExtractor> response) { return response.body(); } }); }
java
public Observable<PatternAnyEntityExtractor> getPatternAnyEntityInfoAsync(UUID appId, String versionId, UUID entityId) { return getPatternAnyEntityInfoWithServiceResponseAsync(appId, versionId, entityId).map(new Func1<ServiceResponse<PatternAnyEntityExtractor>, PatternAnyEntityExtractor>() { @Override public PatternAnyEntityExtractor call(ServiceResponse<PatternAnyEntityExtractor> response) { return response.body(); } }); }
[ "public", "Observable", "<", "PatternAnyEntityExtractor", ">", "getPatternAnyEntityInfoAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ")", "{", "return", "getPatternAnyEntityInfoWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "entityId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "PatternAnyEntityExtractor", ">", ",", "PatternAnyEntityExtractor", ">", "(", ")", "{", "@", "Override", "public", "PatternAnyEntityExtractor", "call", "(", "ServiceResponse", "<", "PatternAnyEntityExtractor", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets information about the application version's Pattern.Any model. @param appId The application ID. @param versionId The version ID. @param entityId The entity extractor ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PatternAnyEntityExtractor object
[ "Gets", "information", "about", "the", "application", "version", "s", "Pattern", ".", "Any", "model", "." ]
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#L10487-L10494
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/io/DataIO.java
DataIO.columnIndex
public static int columnIndex(CSTable table, String name) { """ Gets a column index by name @param table The table to check @param name the column name @return the index of the column """ for (int i = 1; i <= table.getColumnCount(); i++) { if (table.getColumnName(i).equals(name)) { return i; } } return -1; }
java
public static int columnIndex(CSTable table, String name) { for (int i = 1; i <= table.getColumnCount(); i++) { if (table.getColumnName(i).equals(name)) { return i; } } return -1; }
[ "public", "static", "int", "columnIndex", "(", "CSTable", "table", ",", "String", "name", ")", "{", "for", "(", "int", "i", "=", "1", ";", "i", "<=", "table", ".", "getColumnCount", "(", ")", ";", "i", "++", ")", "{", "if", "(", "table", ".", "getColumnName", "(", "i", ")", ".", "equals", "(", "name", ")", ")", "{", "return", "i", ";", "}", "}", "return", "-", "1", ";", "}" ]
Gets a column index by name @param table The table to check @param name the column name @return the index of the column
[ "Gets", "a", "column", "index", "by", "name" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/io/DataIO.java#L1252-L1259
lessthanoptimal/BoofCV
applications/src/main/java/boofcv/app/calib/ImageSelectorAndSaver.java
ImageSelectorAndSaver.process
public synchronized void process(GrayF32 image, List<Point2D_F64> sides) { """ Computes the sharpness score for the current image, if better than the current best image it's then saved. @param image Gray scale input image for detector @param sides Location of 4 corners on fiducial """ if( sides.size() != 4 ) throw new IllegalArgumentException("Expected 4 sidesCollision"); updateScore(image,sides); if( currentScore < bestScore ) { bestScore = currentScore; if( bestImage == null ) { bestImage = new BufferedImage(image.getWidth(), image.getHeight(),BufferedImage.TYPE_INT_RGB); } ConvertBufferedImage.convertTo(image,bestImage); } }
java
public synchronized void process(GrayF32 image, List<Point2D_F64> sides) { if( sides.size() != 4 ) throw new IllegalArgumentException("Expected 4 sidesCollision"); updateScore(image,sides); if( currentScore < bestScore ) { bestScore = currentScore; if( bestImage == null ) { bestImage = new BufferedImage(image.getWidth(), image.getHeight(),BufferedImage.TYPE_INT_RGB); } ConvertBufferedImage.convertTo(image,bestImage); } }
[ "public", "synchronized", "void", "process", "(", "GrayF32", "image", ",", "List", "<", "Point2D_F64", ">", "sides", ")", "{", "if", "(", "sides", ".", "size", "(", ")", "!=", "4", ")", "throw", "new", "IllegalArgumentException", "(", "\"Expected 4 sidesCollision\"", ")", ";", "updateScore", "(", "image", ",", "sides", ")", ";", "if", "(", "currentScore", "<", "bestScore", ")", "{", "bestScore", "=", "currentScore", ";", "if", "(", "bestImage", "==", "null", ")", "{", "bestImage", "=", "new", "BufferedImage", "(", "image", ".", "getWidth", "(", ")", ",", "image", ".", "getHeight", "(", ")", ",", "BufferedImage", ".", "TYPE_INT_RGB", ")", ";", "}", "ConvertBufferedImage", ".", "convertTo", "(", "image", ",", "bestImage", ")", ";", "}", "}" ]
Computes the sharpness score for the current image, if better than the current best image it's then saved. @param image Gray scale input image for detector @param sides Location of 4 corners on fiducial
[ "Computes", "the", "sharpness", "score", "for", "the", "current", "image", "if", "better", "than", "the", "current", "best", "image", "it", "s", "then", "saved", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/applications/src/main/java/boofcv/app/calib/ImageSelectorAndSaver.java#L125-L138
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java
DBCleanService.resolveDialect
private static String resolveDialect(Connection jdbcConn, WorkspaceEntry wsEntry) throws DBCleanException { """ Resolves dialect which it is used in workspace configuration. First of all, method will try to get parameter {@link JDBCWorkspaceDataContainer#DB_DIALECT} from a configuration. And only then method will try to detect dialect using {@link DialectDetecter} in case if dialect is set as {@link DialectConstants#DB_DIALECT_AUTO}. @param wsEntry workspace configuration @return dialect @throws DBCleanException """ String dialect = DBInitializerHelper.getDatabaseDialect(wsEntry); if (dialect.startsWith(DBConstants.DB_DIALECT_AUTO)) { try { dialect = DialectDetecter.detect(jdbcConn.getMetaData()); } catch (SQLException e) { throw new DBCleanException(e); } } return dialect; }
java
private static String resolveDialect(Connection jdbcConn, WorkspaceEntry wsEntry) throws DBCleanException { String dialect = DBInitializerHelper.getDatabaseDialect(wsEntry); if (dialect.startsWith(DBConstants.DB_DIALECT_AUTO)) { try { dialect = DialectDetecter.detect(jdbcConn.getMetaData()); } catch (SQLException e) { throw new DBCleanException(e); } } return dialect; }
[ "private", "static", "String", "resolveDialect", "(", "Connection", "jdbcConn", ",", "WorkspaceEntry", "wsEntry", ")", "throws", "DBCleanException", "{", "String", "dialect", "=", "DBInitializerHelper", ".", "getDatabaseDialect", "(", "wsEntry", ")", ";", "if", "(", "dialect", ".", "startsWith", "(", "DBConstants", ".", "DB_DIALECT_AUTO", ")", ")", "{", "try", "{", "dialect", "=", "DialectDetecter", ".", "detect", "(", "jdbcConn", ".", "getMetaData", "(", ")", ")", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "throw", "new", "DBCleanException", "(", "e", ")", ";", "}", "}", "return", "dialect", ";", "}" ]
Resolves dialect which it is used in workspace configuration. First of all, method will try to get parameter {@link JDBCWorkspaceDataContainer#DB_DIALECT} from a configuration. And only then method will try to detect dialect using {@link DialectDetecter} in case if dialect is set as {@link DialectConstants#DB_DIALECT_AUTO}. @param wsEntry workspace configuration @return dialect @throws DBCleanException
[ "Resolves", "dialect", "which", "it", "is", "used", "in", "workspace", "configuration", ".", "First", "of", "all", "method", "will", "try", "to", "get", "parameter", "{", "@link", "JDBCWorkspaceDataContainer#DB_DIALECT", "}", "from", "a", "configuration", ".", "And", "only", "then", "method", "will", "try", "to", "detect", "dialect", "using", "{", "@link", "DialectDetecter", "}", "in", "case", "if", "dialect", "is", "set", "as", "{", "@link", "DialectConstants#DB_DIALECT_AUTO", "}", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java#L313-L330
googleapis/google-cloud-java
google-cloud-clients/google-cloud-monitoring/src/main/java/com/google/cloud/monitoring/v3/GroupServiceClient.java
GroupServiceClient.createGroup
public final Group createGroup(String name, Group group) { """ Creates a new group. <p>Sample code: <pre><code> try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) { ProjectName name = ProjectName.of("[PROJECT]"); Group group = Group.newBuilder().build(); Group response = groupServiceClient.createGroup(name.toString(), group); } </code></pre> @param name The project in which to create the group. The format is `"projects/{project_id_or_number}"`. @param group A group definition. It is an error to define the `name` field because the system assigns the name. @throws com.google.api.gax.rpc.ApiException if the remote call fails """ CreateGroupRequest request = CreateGroupRequest.newBuilder().setName(name).setGroup(group).build(); return createGroup(request); }
java
public final Group createGroup(String name, Group group) { CreateGroupRequest request = CreateGroupRequest.newBuilder().setName(name).setGroup(group).build(); return createGroup(request); }
[ "public", "final", "Group", "createGroup", "(", "String", "name", ",", "Group", "group", ")", "{", "CreateGroupRequest", "request", "=", "CreateGroupRequest", ".", "newBuilder", "(", ")", ".", "setName", "(", "name", ")", ".", "setGroup", "(", "group", ")", ".", "build", "(", ")", ";", "return", "createGroup", "(", "request", ")", ";", "}" ]
Creates a new group. <p>Sample code: <pre><code> try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) { ProjectName name = ProjectName.of("[PROJECT]"); Group group = Group.newBuilder().build(); Group response = groupServiceClient.createGroup(name.toString(), group); } </code></pre> @param name The project in which to create the group. The format is `"projects/{project_id_or_number}"`. @param group A group definition. It is an error to define the `name` field because the system assigns the name. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "new", "group", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-monitoring/src/main/java/com/google/cloud/monitoring/v3/GroupServiceClient.java#L397-L402
apache/fluo
modules/api/src/main/java/org/apache/fluo/api/data/Bytes.java
Bytes.copyTo
public void copyTo(int start, int end, byte[] dest, int destPos) { """ Copy a subsequence of Bytes to specific byte array. Uses the specified offset in the dest byte array to start the copy. @param start index of subsequence start (inclusive) @param end index of subsequence end (exclusive) @param dest destination array @param destPos starting position in the destination data. @exception IndexOutOfBoundsException if copying would cause access of data outside array bounds. @exception NullPointerException if either <code>src</code> or <code>dest</code> is <code>null</code>. @since 1.1.0 """ // this.subSequence(start, end).copyTo(dest, destPos) would allocate another Bytes object arraycopy(start, dest, destPos, end - start); }
java
public void copyTo(int start, int end, byte[] dest, int destPos) { // this.subSequence(start, end).copyTo(dest, destPos) would allocate another Bytes object arraycopy(start, dest, destPos, end - start); }
[ "public", "void", "copyTo", "(", "int", "start", ",", "int", "end", ",", "byte", "[", "]", "dest", ",", "int", "destPos", ")", "{", "// this.subSequence(start, end).copyTo(dest, destPos) would allocate another Bytes object", "arraycopy", "(", "start", ",", "dest", ",", "destPos", ",", "end", "-", "start", ")", ";", "}" ]
Copy a subsequence of Bytes to specific byte array. Uses the specified offset in the dest byte array to start the copy. @param start index of subsequence start (inclusive) @param end index of subsequence end (exclusive) @param dest destination array @param destPos starting position in the destination data. @exception IndexOutOfBoundsException if copying would cause access of data outside array bounds. @exception NullPointerException if either <code>src</code> or <code>dest</code> is <code>null</code>. @since 1.1.0
[ "Copy", "a", "subsequence", "of", "Bytes", "to", "specific", "byte", "array", ".", "Uses", "the", "specified", "offset", "in", "the", "dest", "byte", "array", "to", "start", "the", "copy", "." ]
train
https://github.com/apache/fluo/blob/8e06204d4167651e2d3b5219b8c1397644e6ba6e/modules/api/src/main/java/org/apache/fluo/api/data/Bytes.java#L674-L677
tvesalainen/util
util/src/main/java/org/vesalainen/util/concurrent/CachedScheduledThreadPool.java
CachedScheduledThreadPool.iterateAtFixedRate
public ScheduledFuture<?> iterateAtFixedRate(long initialDelay, long period, TimeUnit unit, Runnable... commands) { """ After initialDelay executes commands with period delay or command throws exception. @param initialDelay @param period @param unit @param commands @return @see java.util.concurrent.ScheduledThreadPoolExecutor#scheduleAtFixedDelay(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit) """ return iterateAtFixedRate(initialDelay, period, unit, new ArrayIterator<>(commands)); }
java
public ScheduledFuture<?> iterateAtFixedRate(long initialDelay, long period, TimeUnit unit, Runnable... commands) { return iterateAtFixedRate(initialDelay, period, unit, new ArrayIterator<>(commands)); }
[ "public", "ScheduledFuture", "<", "?", ">", "iterateAtFixedRate", "(", "long", "initialDelay", ",", "long", "period", ",", "TimeUnit", "unit", ",", "Runnable", "...", "commands", ")", "{", "return", "iterateAtFixedRate", "(", "initialDelay", ",", "period", ",", "unit", ",", "new", "ArrayIterator", "<>", "(", "commands", ")", ")", ";", "}" ]
After initialDelay executes commands with period delay or command throws exception. @param initialDelay @param period @param unit @param commands @return @see java.util.concurrent.ScheduledThreadPoolExecutor#scheduleAtFixedDelay(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit)
[ "After", "initialDelay", "executes", "commands", "with", "period", "delay", "or", "command", "throws", "exception", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/concurrent/CachedScheduledThreadPool.java#L180-L183
apereo/cas
core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/PolicyBasedAuthenticationManager.java
PolicyBasedAuthenticationManager.getPrincipalResolverLinkedToHandlerIfAny
protected PrincipalResolver getPrincipalResolverLinkedToHandlerIfAny(final AuthenticationHandler handler, final AuthenticationTransaction transaction) { """ Gets principal resolver linked to the handler if any. @param handler the handler @param transaction the transaction @return the principal resolver linked to handler if any, or null. """ return this.authenticationEventExecutionPlan.getPrincipalResolverForAuthenticationTransaction(handler, transaction); }
java
protected PrincipalResolver getPrincipalResolverLinkedToHandlerIfAny(final AuthenticationHandler handler, final AuthenticationTransaction transaction) { return this.authenticationEventExecutionPlan.getPrincipalResolverForAuthenticationTransaction(handler, transaction); }
[ "protected", "PrincipalResolver", "getPrincipalResolverLinkedToHandlerIfAny", "(", "final", "AuthenticationHandler", "handler", ",", "final", "AuthenticationTransaction", "transaction", ")", "{", "return", "this", ".", "authenticationEventExecutionPlan", ".", "getPrincipalResolverForAuthenticationTransaction", "(", "handler", ",", "transaction", ")", ";", "}" ]
Gets principal resolver linked to the handler if any. @param handler the handler @param transaction the transaction @return the principal resolver linked to handler if any, or null.
[ "Gets", "principal", "resolver", "linked", "to", "the", "handler", "if", "any", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/PolicyBasedAuthenticationManager.java#L240-L242
cdk/cdk
base/silent/src/main/java/org/openscience/cdk/silent/MolecularFormula.java
MolecularFormula.setProperties
@Override public void setProperties(Map<Object, Object> properties) { """ Sets the properties of this object. @param properties a Hashtable specifying the property values @see #getProperties """ Iterator<Object> keys = properties.keySet().iterator(); while (keys.hasNext()) { Object key = keys.next(); lazyProperties().put(key, properties.get(key)); } }
java
@Override public void setProperties(Map<Object, Object> properties) { Iterator<Object> keys = properties.keySet().iterator(); while (keys.hasNext()) { Object key = keys.next(); lazyProperties().put(key, properties.get(key)); } }
[ "@", "Override", "public", "void", "setProperties", "(", "Map", "<", "Object", ",", "Object", ">", "properties", ")", "{", "Iterator", "<", "Object", ">", "keys", "=", "properties", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "keys", ".", "hasNext", "(", ")", ")", "{", "Object", "key", "=", "keys", ".", "next", "(", ")", ";", "lazyProperties", "(", ")", ".", "put", "(", "key", ",", "properties", ".", "get", "(", "key", ")", ")", ";", "}", "}" ]
Sets the properties of this object. @param properties a Hashtable specifying the property values @see #getProperties
[ "Sets", "the", "properties", "of", "this", "object", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/silent/src/main/java/org/openscience/cdk/silent/MolecularFormula.java#L357-L365
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/primitives/DoubleUtils.java
DoubleUtils.min
public static double min(final double[] data, final int startInclusive, final int endExclusive) { """ Returns the maximum value in the array within the specified bounds. If the supplied range is empty or invalid, an {@link IllegalArgumentException} is thrown. """ checkArgument(endExclusive > startInclusive); checkArgument(startInclusive >= 0); checkArgument(endExclusive <= data.length); double minValue = Double.POSITIVE_INFINITY; for (int i = startInclusive; i < endExclusive; ++i) { minValue = Math.min(minValue, data[i]); } return minValue; }
java
public static double min(final double[] data, final int startInclusive, final int endExclusive) { checkArgument(endExclusive > startInclusive); checkArgument(startInclusive >= 0); checkArgument(endExclusive <= data.length); double minValue = Double.POSITIVE_INFINITY; for (int i = startInclusive; i < endExclusive; ++i) { minValue = Math.min(minValue, data[i]); } return minValue; }
[ "public", "static", "double", "min", "(", "final", "double", "[", "]", "data", ",", "final", "int", "startInclusive", ",", "final", "int", "endExclusive", ")", "{", "checkArgument", "(", "endExclusive", ">", "startInclusive", ")", ";", "checkArgument", "(", "startInclusive", ">=", "0", ")", ";", "checkArgument", "(", "endExclusive", "<=", "data", ".", "length", ")", ";", "double", "minValue", "=", "Double", ".", "POSITIVE_INFINITY", ";", "for", "(", "int", "i", "=", "startInclusive", ";", "i", "<", "endExclusive", ";", "++", "i", ")", "{", "minValue", "=", "Math", ".", "min", "(", "minValue", ",", "data", "[", "i", "]", ")", ";", "}", "return", "minValue", ";", "}" ]
Returns the maximum value in the array within the specified bounds. If the supplied range is empty or invalid, an {@link IllegalArgumentException} is thrown.
[ "Returns", "the", "maximum", "value", "in", "the", "array", "within", "the", "specified", "bounds", ".", "If", "the", "supplied", "range", "is", "empty", "or", "invalid", "an", "{" ]
train
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/primitives/DoubleUtils.java#L177-L187
vdmeer/skb-java-base
src/main/java/de/vandermeer/skb/base/info/AbstractFileInfo.java
AbstractFileInfo.tryFS
protected final boolean tryFS(String directory, String fileName) { """ Try to locate a file in the file system. @param directory a directory to locate the file in @param fileName a file name with optional path information @return true if the file was found, false otherwise """ String path = directory + "/" + fileName; if(directory==null){ path = fileName; } File file = new File(path); if(this.testFile(file)==true){ //found in file system try{ this.url = file.toURI().toURL(); this.file = file; this.fullFileName = FilenameUtils.getName(file.getAbsolutePath()); if(directory!=null){ this.setRootPath = directory; } return true; } catch (MalformedURLException e) { this.errors.addError("init() - malformed URL for file with name " + this.file.getAbsolutePath() + " and message: " + e.getMessage()); } } return false; }
java
protected final boolean tryFS(String directory, String fileName){ String path = directory + "/" + fileName; if(directory==null){ path = fileName; } File file = new File(path); if(this.testFile(file)==true){ //found in file system try{ this.url = file.toURI().toURL(); this.file = file; this.fullFileName = FilenameUtils.getName(file.getAbsolutePath()); if(directory!=null){ this.setRootPath = directory; } return true; } catch (MalformedURLException e) { this.errors.addError("init() - malformed URL for file with name " + this.file.getAbsolutePath() + " and message: " + e.getMessage()); } } return false; }
[ "protected", "final", "boolean", "tryFS", "(", "String", "directory", ",", "String", "fileName", ")", "{", "String", "path", "=", "directory", "+", "\"/\"", "+", "fileName", ";", "if", "(", "directory", "==", "null", ")", "{", "path", "=", "fileName", ";", "}", "File", "file", "=", "new", "File", "(", "path", ")", ";", "if", "(", "this", ".", "testFile", "(", "file", ")", "==", "true", ")", "{", "//found in file system", "try", "{", "this", ".", "url", "=", "file", ".", "toURI", "(", ")", ".", "toURL", "(", ")", ";", "this", ".", "file", "=", "file", ";", "this", ".", "fullFileName", "=", "FilenameUtils", ".", "getName", "(", "file", ".", "getAbsolutePath", "(", ")", ")", ";", "if", "(", "directory", "!=", "null", ")", "{", "this", ".", "setRootPath", "=", "directory", ";", "}", "return", "true", ";", "}", "catch", "(", "MalformedURLException", "e", ")", "{", "this", ".", "errors", ".", "addError", "(", "\"init() - malformed URL for file with name \"", "+", "this", ".", "file", ".", "getAbsolutePath", "(", ")", "+", "\" and message: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "return", "false", ";", "}" ]
Try to locate a file in the file system. @param directory a directory to locate the file in @param fileName a file name with optional path information @return true if the file was found, false otherwise
[ "Try", "to", "locate", "a", "file", "in", "the", "file", "system", "." ]
train
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/info/AbstractFileInfo.java#L327-L349
mlhartme/mork
src/main/java/net/oneandone/mork/semantics/AgBuffer.java
AgBuffer.cloneAttributes
public Attribute cloneAttributes(AgBuffer orig, Type type, Attribute seed) { """ Clones this buffer but replaces all transport attributes with new attributes of the specified type. @param type for new attributes @return cloned seed """ Map<Attribute, Attribute> map; // old attributes to new attributes Attribute attr; State newState; map = new HashMap<Attribute, Attribute>(); for (State state : orig.states) { attr = state.getAttribute(); map.put(attr, new Attribute(attr.symbol, null, type)); } for (State state : orig.states) { newState = state.cloneAttributeTransport(map); states.add(newState); } attr = map.get(seed); if (attr == null) { throw new IllegalArgumentException(); } return attr; }
java
public Attribute cloneAttributes(AgBuffer orig, Type type, Attribute seed) { Map<Attribute, Attribute> map; // old attributes to new attributes Attribute attr; State newState; map = new HashMap<Attribute, Attribute>(); for (State state : orig.states) { attr = state.getAttribute(); map.put(attr, new Attribute(attr.symbol, null, type)); } for (State state : orig.states) { newState = state.cloneAttributeTransport(map); states.add(newState); } attr = map.get(seed); if (attr == null) { throw new IllegalArgumentException(); } return attr; }
[ "public", "Attribute", "cloneAttributes", "(", "AgBuffer", "orig", ",", "Type", "type", ",", "Attribute", "seed", ")", "{", "Map", "<", "Attribute", ",", "Attribute", ">", "map", ";", "// old attributes to new attributes", "Attribute", "attr", ";", "State", "newState", ";", "map", "=", "new", "HashMap", "<", "Attribute", ",", "Attribute", ">", "(", ")", ";", "for", "(", "State", "state", ":", "orig", ".", "states", ")", "{", "attr", "=", "state", ".", "getAttribute", "(", ")", ";", "map", ".", "put", "(", "attr", ",", "new", "Attribute", "(", "attr", ".", "symbol", ",", "null", ",", "type", ")", ")", ";", "}", "for", "(", "State", "state", ":", "orig", ".", "states", ")", "{", "newState", "=", "state", ".", "cloneAttributeTransport", "(", "map", ")", ";", "states", ".", "add", "(", "newState", ")", ";", "}", "attr", "=", "map", ".", "get", "(", "seed", ")", ";", "if", "(", "attr", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "return", "attr", ";", "}" ]
Clones this buffer but replaces all transport attributes with new attributes of the specified type. @param type for new attributes @return cloned seed
[ "Clones", "this", "buffer", "but", "replaces", "all", "transport", "attributes", "with", "new", "attributes", "of", "the", "specified", "type", "." ]
train
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/semantics/AgBuffer.java#L315-L334
rjeschke/txtmark
src/main/java/com/github/rjeschke/txtmark/Emitter.java
Emitter.addLinkRef
public void addLinkRef(final String key, final LinkRef linkRef) { """ Adds a LinkRef to this set of LinkRefs. @param key The key/id. @param linkRef The LinkRef. """ this.linkRefs.put(key.toLowerCase(), linkRef); }
java
public void addLinkRef(final String key, final LinkRef linkRef) { this.linkRefs.put(key.toLowerCase(), linkRef); }
[ "public", "void", "addLinkRef", "(", "final", "String", "key", ",", "final", "LinkRef", "linkRef", ")", "{", "this", ".", "linkRefs", ".", "put", "(", "key", ".", "toLowerCase", "(", ")", ",", "linkRef", ")", ";", "}" ]
Adds a LinkRef to this set of LinkRefs. @param key The key/id. @param linkRef The LinkRef.
[ "Adds", "a", "LinkRef", "to", "this", "set", "of", "LinkRefs", "." ]
train
https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/Emitter.java#L50-L53
PawelAdamski/HttpClientMock
src/main/java/com/github/paweladamski/httpclientmock/HttpClientResponseBuilder.java
HttpClientResponseBuilder.doReturnJSON
public HttpClientResponseBuilder doReturnJSON(String response, Charset charset) { """ Adds action which returns provided JSON in provided encoding and status 200. Additionally it sets "Content-type" header to "application/json". @param response JSON to return @return response builder """ return doReturn(response, charset).withHeader("Content-type", APPLICATION_JSON.toString()); }
java
public HttpClientResponseBuilder doReturnJSON(String response, Charset charset) { return doReturn(response, charset).withHeader("Content-type", APPLICATION_JSON.toString()); }
[ "public", "HttpClientResponseBuilder", "doReturnJSON", "(", "String", "response", ",", "Charset", "charset", ")", "{", "return", "doReturn", "(", "response", ",", "charset", ")", ".", "withHeader", "(", "\"Content-type\"", ",", "APPLICATION_JSON", ".", "toString", "(", ")", ")", ";", "}" ]
Adds action which returns provided JSON in provided encoding and status 200. Additionally it sets "Content-type" header to "application/json". @param response JSON to return @return response builder
[ "Adds", "action", "which", "returns", "provided", "JSON", "in", "provided", "encoding", "and", "status", "200", ".", "Additionally", "it", "sets", "Content", "-", "type", "header", "to", "application", "/", "json", "." ]
train
https://github.com/PawelAdamski/HttpClientMock/blob/0205498434bbc0c78c187a51181cac9b266a28fb/src/main/java/com/github/paweladamski/httpclientmock/HttpClientResponseBuilder.java#L155-L157
jbossws/jbossws-cxf
modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java
SoapAddressRewriteHelper.getRewrittenPublishedEndpointUrl
public static String getRewrittenPublishedEndpointUrl(String address, SOAPAddressRewriteMetadata sarm) { """ Rewrite and get address to be used for CXF published endpoint url prop (rewritten wsdl address). This method is to be used for code-first endpoints, when no wsdl is provided by the user. @param address The container computed endpoint address @param sarm The deployment SOAPAddressRewriteMetadata @return """ try { if (isPathRewriteRequired(sarm) || isSchemeRewriteRequired(sarm)) { final URL url = new URL(address); final String uriScheme = rewriteUriScheme(sarm, getUriScheme(address), null); final String port = getDotPortNumber(uriScheme, sarm); final StringBuilder builder = new StringBuilder(); builder.append(uriScheme); builder.append("://"); builder.append(url.getHost()); builder.append(port); final String path = url.getPath(); builder.append(isPathRewriteRequired(sarm) ? SEDProcessor.newInstance(sarm.getWebServicePathRewriteRule()).processLine(path) : path); final String newUrl = builder.toString(); ADDRESS_REWRITE_LOGGER.addressRewritten(address, newUrl); return newUrl; } else { ADDRESS_REWRITE_LOGGER.rewriteNotRequired(address); return address; } } catch (MalformedURLException e) { ADDRESS_REWRITE_LOGGER.invalidAddressProvidedUseItWithoutRewriting(address, ""); return address; } }
java
public static String getRewrittenPublishedEndpointUrl(String address, SOAPAddressRewriteMetadata sarm) { try { if (isPathRewriteRequired(sarm) || isSchemeRewriteRequired(sarm)) { final URL url = new URL(address); final String uriScheme = rewriteUriScheme(sarm, getUriScheme(address), null); final String port = getDotPortNumber(uriScheme, sarm); final StringBuilder builder = new StringBuilder(); builder.append(uriScheme); builder.append("://"); builder.append(url.getHost()); builder.append(port); final String path = url.getPath(); builder.append(isPathRewriteRequired(sarm) ? SEDProcessor.newInstance(sarm.getWebServicePathRewriteRule()).processLine(path) : path); final String newUrl = builder.toString(); ADDRESS_REWRITE_LOGGER.addressRewritten(address, newUrl); return newUrl; } else { ADDRESS_REWRITE_LOGGER.rewriteNotRequired(address); return address; } } catch (MalformedURLException e) { ADDRESS_REWRITE_LOGGER.invalidAddressProvidedUseItWithoutRewriting(address, ""); return address; } }
[ "public", "static", "String", "getRewrittenPublishedEndpointUrl", "(", "String", "address", ",", "SOAPAddressRewriteMetadata", "sarm", ")", "{", "try", "{", "if", "(", "isPathRewriteRequired", "(", "sarm", ")", "||", "isSchemeRewriteRequired", "(", "sarm", ")", ")", "{", "final", "URL", "url", "=", "new", "URL", "(", "address", ")", ";", "final", "String", "uriScheme", "=", "rewriteUriScheme", "(", "sarm", ",", "getUriScheme", "(", "address", ")", ",", "null", ")", ";", "final", "String", "port", "=", "getDotPortNumber", "(", "uriScheme", ",", "sarm", ")", ";", "final", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "builder", ".", "append", "(", "uriScheme", ")", ";", "builder", ".", "append", "(", "\"://\"", ")", ";", "builder", ".", "append", "(", "url", ".", "getHost", "(", ")", ")", ";", "builder", ".", "append", "(", "port", ")", ";", "final", "String", "path", "=", "url", ".", "getPath", "(", ")", ";", "builder", ".", "append", "(", "isPathRewriteRequired", "(", "sarm", ")", "?", "SEDProcessor", ".", "newInstance", "(", "sarm", ".", "getWebServicePathRewriteRule", "(", ")", ")", ".", "processLine", "(", "path", ")", ":", "path", ")", ";", "final", "String", "newUrl", "=", "builder", ".", "toString", "(", ")", ";", "ADDRESS_REWRITE_LOGGER", ".", "addressRewritten", "(", "address", ",", "newUrl", ")", ";", "return", "newUrl", ";", "}", "else", "{", "ADDRESS_REWRITE_LOGGER", ".", "rewriteNotRequired", "(", "address", ")", ";", "return", "address", ";", "}", "}", "catch", "(", "MalformedURLException", "e", ")", "{", "ADDRESS_REWRITE_LOGGER", ".", "invalidAddressProvidedUseItWithoutRewriting", "(", "address", ",", "\"\"", ")", ";", "return", "address", ";", "}", "}" ]
Rewrite and get address to be used for CXF published endpoint url prop (rewritten wsdl address). This method is to be used for code-first endpoints, when no wsdl is provided by the user. @param address The container computed endpoint address @param sarm The deployment SOAPAddressRewriteMetadata @return
[ "Rewrite", "and", "get", "address", "to", "be", "used", "for", "CXF", "published", "endpoint", "url", "prop", "(", "rewritten", "wsdl", "address", ")", ".", "This", "method", "is", "to", "be", "used", "for", "code", "-", "first", "endpoints", "when", "no", "wsdl", "is", "provided", "by", "the", "user", "." ]
train
https://github.com/jbossws/jbossws-cxf/blob/e1d5df3664cbc2482ebc83cafd355a4d60d12150/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java#L78-L109
knowhowlab/org.knowhowlab.osgi.shell
knopflerfish/src/main/java/org/knowhowlab/osgi/shell/knopflerfish/Activator.java
Activator.isValidCommandMethod
private boolean isValidCommandMethod(Object service, String commandName) { """ Validate Command method @param service service instance @param commandName command method name @return <code>true</code> if method is peresent in service, <code>public</code> and has params <code>PrintStream</code> and <code>String[]</code>, otherwise - <code>false</code> """ try { service.getClass().getMethod(commandName, PrintWriter.class, String[].class); return true; } catch (NoSuchMethodException e) { return false; } }
java
private boolean isValidCommandMethod(Object service, String commandName) { try { service.getClass().getMethod(commandName, PrintWriter.class, String[].class); return true; } catch (NoSuchMethodException e) { return false; } }
[ "private", "boolean", "isValidCommandMethod", "(", "Object", "service", ",", "String", "commandName", ")", "{", "try", "{", "service", ".", "getClass", "(", ")", ".", "getMethod", "(", "commandName", ",", "PrintWriter", ".", "class", ",", "String", "[", "]", ".", "class", ")", ";", "return", "true", ";", "}", "catch", "(", "NoSuchMethodException", "e", ")", "{", "return", "false", ";", "}", "}" ]
Validate Command method @param service service instance @param commandName command method name @return <code>true</code> if method is peresent in service, <code>public</code> and has params <code>PrintStream</code> and <code>String[]</code>, otherwise - <code>false</code>
[ "Validate", "Command", "method" ]
train
https://github.com/knowhowlab/org.knowhowlab.osgi.shell/blob/5c3172b1e6b741c753f02af48ab42adc4915a6ae/knopflerfish/src/main/java/org/knowhowlab/osgi/shell/knopflerfish/Activator.java#L86-L93
roboconf/roboconf-platform
miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/ProjectUtils.java
ProjectUtils.createSimpleProject
private static void createSimpleProject( File targetDirectory, CreationBean creationBean ) throws IOException { """ Creates a simple project for Roboconf. @param targetDirectory the directory into which the Roboconf files must be copied @param creationBean the creation properties @throws IOException if something went wrong """ // Create the directory structure String[] directoriesToCreate = creationBean.isReusableRecipe() ? RR_DIRECTORIES : ALL_DIRECTORIES; for( String s : directoriesToCreate ) { File dir = new File( targetDirectory, s ); Utils.createDirectory( dir ); } // Create the descriptor InputStream in = ProjectUtils.class.getResourceAsStream( "/application-skeleton.props" ); ByteArrayOutputStream out = new ByteArrayOutputStream(); Utils.copyStreamSafely( in, out ); String tpl = out.toString( "UTF-8" ) .replace( TPL_NAME, creationBean.getProjectName()) .replace( TPL_VERSION, creationBean.getProjectVersion()) .replace( TPL_DESCRIPTION, creationBean.getProjectDescription()); // Create the rest of the project completeProjectCreation( targetDirectory, tpl, creationBean ); }
java
private static void createSimpleProject( File targetDirectory, CreationBean creationBean ) throws IOException { // Create the directory structure String[] directoriesToCreate = creationBean.isReusableRecipe() ? RR_DIRECTORIES : ALL_DIRECTORIES; for( String s : directoriesToCreate ) { File dir = new File( targetDirectory, s ); Utils.createDirectory( dir ); } // Create the descriptor InputStream in = ProjectUtils.class.getResourceAsStream( "/application-skeleton.props" ); ByteArrayOutputStream out = new ByteArrayOutputStream(); Utils.copyStreamSafely( in, out ); String tpl = out.toString( "UTF-8" ) .replace( TPL_NAME, creationBean.getProjectName()) .replace( TPL_VERSION, creationBean.getProjectVersion()) .replace( TPL_DESCRIPTION, creationBean.getProjectDescription()); // Create the rest of the project completeProjectCreation( targetDirectory, tpl, creationBean ); }
[ "private", "static", "void", "createSimpleProject", "(", "File", "targetDirectory", ",", "CreationBean", "creationBean", ")", "throws", "IOException", "{", "// Create the directory structure", "String", "[", "]", "directoriesToCreate", "=", "creationBean", ".", "isReusableRecipe", "(", ")", "?", "RR_DIRECTORIES", ":", "ALL_DIRECTORIES", ";", "for", "(", "String", "s", ":", "directoriesToCreate", ")", "{", "File", "dir", "=", "new", "File", "(", "targetDirectory", ",", "s", ")", ";", "Utils", ".", "createDirectory", "(", "dir", ")", ";", "}", "// Create the descriptor", "InputStream", "in", "=", "ProjectUtils", ".", "class", ".", "getResourceAsStream", "(", "\"/application-skeleton.props\"", ")", ";", "ByteArrayOutputStream", "out", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "Utils", ".", "copyStreamSafely", "(", "in", ",", "out", ")", ";", "String", "tpl", "=", "out", ".", "toString", "(", "\"UTF-8\"", ")", ".", "replace", "(", "TPL_NAME", ",", "creationBean", ".", "getProjectName", "(", ")", ")", ".", "replace", "(", "TPL_VERSION", ",", "creationBean", ".", "getProjectVersion", "(", ")", ")", ".", "replace", "(", "TPL_DESCRIPTION", ",", "creationBean", ".", "getProjectDescription", "(", ")", ")", ";", "// Create the rest of the project", "completeProjectCreation", "(", "targetDirectory", ",", "tpl", ",", "creationBean", ")", ";", "}" ]
Creates a simple project for Roboconf. @param targetDirectory the directory into which the Roboconf files must be copied @param creationBean the creation properties @throws IOException if something went wrong
[ "Creates", "a", "simple", "project", "for", "Roboconf", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/ProjectUtils.java#L138-L159
jmrozanec/cron-utils
src/main/java/com/cronutils/descriptor/refactor/SecondsDescriptor.java
SecondsDescriptor.describe
protected String describe(final On on, final boolean and) { """ Provide a human readable description for On instance. @param on - On @return human readable description - String """ if (and) { return nominalValue(on.getTime()); } return String.format("%s %s ", bundle.getString("at"), nominalValue(on.getTime())) + "%s"; }
java
protected String describe(final On on, final boolean and) { if (and) { return nominalValue(on.getTime()); } return String.format("%s %s ", bundle.getString("at"), nominalValue(on.getTime())) + "%s"; }
[ "protected", "String", "describe", "(", "final", "On", "on", ",", "final", "boolean", "and", ")", "{", "if", "(", "and", ")", "{", "return", "nominalValue", "(", "on", ".", "getTime", "(", ")", ")", ";", "}", "return", "String", ".", "format", "(", "\"%s %s \"", ",", "bundle", ".", "getString", "(", "\"at\"", ")", ",", "nominalValue", "(", "on", ".", "getTime", "(", ")", ")", ")", "+", "\"%s\"", ";", "}" ]
Provide a human readable description for On instance. @param on - On @return human readable description - String
[ "Provide", "a", "human", "readable", "description", "for", "On", "instance", "." ]
train
https://github.com/jmrozanec/cron-utils/blob/adac5ec8fd9160b082f9762a6eedea0715731170/src/main/java/com/cronutils/descriptor/refactor/SecondsDescriptor.java#L136-L141
Impetus/Kundera
src/kundera-oracle-nosql/src/main/java/com/impetus/client/oraclenosql/OracleNoSQLClient.java
OracleNoSQLClient.addDiscriminatorColumn
private void addDiscriminatorColumn(Row row, EntityType entityType, Table schemaTable) { """ Process discriminator columns. @param row kv row object. @param entityType metamodel attribute. @param schemaTable the schema table """ String discrColumn = ((AbstractManagedType) entityType).getDiscriminatorColumn(); String discrValue = ((AbstractManagedType) entityType).getDiscriminatorValue(); // No need to check for empty or blank, as considering it as valid name // for nosql! if (discrColumn != null && discrValue != null) { // Key // Key key = Key.createKey(majorKeyComponent, discrColumn); byte[] valueInBytes = PropertyAccessorHelper.getBytes(discrValue); NoSqlDBUtils.add(schemaTable.getField(discrColumn), row, discrValue, discrColumn); } }
java
private void addDiscriminatorColumn(Row row, EntityType entityType, Table schemaTable) { String discrColumn = ((AbstractManagedType) entityType).getDiscriminatorColumn(); String discrValue = ((AbstractManagedType) entityType).getDiscriminatorValue(); // No need to check for empty or blank, as considering it as valid name // for nosql! if (discrColumn != null && discrValue != null) { // Key // Key key = Key.createKey(majorKeyComponent, discrColumn); byte[] valueInBytes = PropertyAccessorHelper.getBytes(discrValue); NoSqlDBUtils.add(schemaTable.getField(discrColumn), row, discrValue, discrColumn); } }
[ "private", "void", "addDiscriminatorColumn", "(", "Row", "row", ",", "EntityType", "entityType", ",", "Table", "schemaTable", ")", "{", "String", "discrColumn", "=", "(", "(", "AbstractManagedType", ")", "entityType", ")", ".", "getDiscriminatorColumn", "(", ")", ";", "String", "discrValue", "=", "(", "(", "AbstractManagedType", ")", "entityType", ")", ".", "getDiscriminatorValue", "(", ")", ";", "// No need to check for empty or blank, as considering it as valid name", "// for nosql!", "if", "(", "discrColumn", "!=", "null", "&&", "discrValue", "!=", "null", ")", "{", "// Key", "// Key key = Key.createKey(majorKeyComponent, discrColumn);", "byte", "[", "]", "valueInBytes", "=", "PropertyAccessorHelper", ".", "getBytes", "(", "discrValue", ")", ";", "NoSqlDBUtils", ".", "add", "(", "schemaTable", ".", "getField", "(", "discrColumn", ")", ",", "row", ",", "discrValue", ",", "discrColumn", ")", ";", "}", "}" ]
Process discriminator columns. @param row kv row object. @param entityType metamodel attribute. @param schemaTable the schema table
[ "Process", "discriminator", "columns", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-oracle-nosql/src/main/java/com/impetus/client/oraclenosql/OracleNoSQLClient.java#L1143-L1159
liferay/com-liferay-commerce
commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListPersistenceImpl.java
CommercePriceListPersistenceImpl.removeByUUID_G
@Override public CommercePriceList removeByUUID_G(String uuid, long groupId) throws NoSuchPriceListException { """ Removes the commerce price list where uuid = &#63; and groupId = &#63; from the database. @param uuid the uuid @param groupId the group ID @return the commerce price list that was removed """ CommercePriceList commercePriceList = findByUUID_G(uuid, groupId); return remove(commercePriceList); }
java
@Override public CommercePriceList removeByUUID_G(String uuid, long groupId) throws NoSuchPriceListException { CommercePriceList commercePriceList = findByUUID_G(uuid, groupId); return remove(commercePriceList); }
[ "@", "Override", "public", "CommercePriceList", "removeByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "NoSuchPriceListException", "{", "CommercePriceList", "commercePriceList", "=", "findByUUID_G", "(", "uuid", ",", "groupId", ")", ";", "return", "remove", "(", "commercePriceList", ")", ";", "}" ]
Removes the commerce price list where uuid = &#63; and groupId = &#63; from the database. @param uuid the uuid @param groupId the group ID @return the commerce price list that was removed
[ "Removes", "the", "commerce", "price", "list", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListPersistenceImpl.java#L818-L824
loldevs/riotapi
rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java
ThrottledApiHandler.getTeams
public Future<Map<Long, List<RankedTeam>>> getTeams(long... ids) { """ Retrieve the ranked teams of the specified users @param ids The users' ids @return The ranked teams of the users @see <a href=https://developer.riotgames.com/api/methods#!/594/1865>Official API documentation</a> """ return new ApiFuture<>(() -> handler.getTeamsBySummoners(ids)); }
java
public Future<Map<Long, List<RankedTeam>>> getTeams(long... ids) { return new ApiFuture<>(() -> handler.getTeamsBySummoners(ids)); }
[ "public", "Future", "<", "Map", "<", "Long", ",", "List", "<", "RankedTeam", ">", ">", ">", "getTeams", "(", "long", "...", "ids", ")", "{", "return", "new", "ApiFuture", "<>", "(", "(", ")", "->", "handler", ".", "getTeamsBySummoners", "(", "ids", ")", ")", ";", "}" ]
Retrieve the ranked teams of the specified users @param ids The users' ids @return The ranked teams of the users @see <a href=https://developer.riotgames.com/api/methods#!/594/1865>Official API documentation</a>
[ "Retrieve", "the", "ranked", "teams", "of", "the", "specified", "users" ]
train
https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L1205-L1207
Tourenathan-G5organisation/SiliCompressor
silicompressor/src/main/java/com/iceteck/silicompressorr/FileUtils.java
FileUtils.getThumbnail
public static Bitmap getThumbnail(Context context, Uri uri) { """ Attempt to retrieve the thumbnail of given Uri from the MediaStore. This should not be called on the UI thread. @param context @param uri @return @author paulburke """ return getThumbnail(context, uri, getMimeType(context, uri)); }
java
public static Bitmap getThumbnail(Context context, Uri uri) { return getThumbnail(context, uri, getMimeType(context, uri)); }
[ "public", "static", "Bitmap", "getThumbnail", "(", "Context", "context", ",", "Uri", "uri", ")", "{", "return", "getThumbnail", "(", "context", ",", "uri", ",", "getMimeType", "(", "context", ",", "uri", ")", ")", ";", "}" ]
Attempt to retrieve the thumbnail of given Uri from the MediaStore. This should not be called on the UI thread. @param context @param uri @return @author paulburke
[ "Attempt", "to", "retrieve", "the", "thumbnail", "of", "given", "Uri", "from", "the", "MediaStore", ".", "This", "should", "not", "be", "called", "on", "the", "UI", "thread", "." ]
train
https://github.com/Tourenathan-G5organisation/SiliCompressor/blob/546f6cd7b2a7a783e1122df46c1e237f8938fe72/silicompressor/src/main/java/com/iceteck/silicompressorr/FileUtils.java#L405-L407
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/NodeImpl.java
NodeImpl.setName
static void setName(NodeImpl node, String name) { """ Sets {@code node} to be not namespace-aware and assigns its name. @param node an element or attribute node. """ int prefixSeparator = name.lastIndexOf(":"); if (prefixSeparator != -1) { String prefix = name.substring(0, prefixSeparator); String localName = name.substring(prefixSeparator + 1); if (!DocumentImpl.isXMLIdentifier(prefix) || !DocumentImpl.isXMLIdentifier(localName)) { throw new DOMException(DOMException.INVALID_CHARACTER_ERR, name); } } else if (!DocumentImpl.isXMLIdentifier(name)) { throw new DOMException(DOMException.INVALID_CHARACTER_ERR, name); } switch (node.getNodeType()) { case ATTRIBUTE_NODE: AttrImpl attr = (AttrImpl) node; attr.namespaceAware = false; attr.localName = name; break; case ELEMENT_NODE: ElementImpl element = (ElementImpl) node; element.namespaceAware = false; element.localName = name; break; default: throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Cannot rename nodes of type " + node.getNodeType()); } }
java
static void setName(NodeImpl node, String name) { int prefixSeparator = name.lastIndexOf(":"); if (prefixSeparator != -1) { String prefix = name.substring(0, prefixSeparator); String localName = name.substring(prefixSeparator + 1); if (!DocumentImpl.isXMLIdentifier(prefix) || !DocumentImpl.isXMLIdentifier(localName)) { throw new DOMException(DOMException.INVALID_CHARACTER_ERR, name); } } else if (!DocumentImpl.isXMLIdentifier(name)) { throw new DOMException(DOMException.INVALID_CHARACTER_ERR, name); } switch (node.getNodeType()) { case ATTRIBUTE_NODE: AttrImpl attr = (AttrImpl) node; attr.namespaceAware = false; attr.localName = name; break; case ELEMENT_NODE: ElementImpl element = (ElementImpl) node; element.namespaceAware = false; element.localName = name; break; default: throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Cannot rename nodes of type " + node.getNodeType()); } }
[ "static", "void", "setName", "(", "NodeImpl", "node", ",", "String", "name", ")", "{", "int", "prefixSeparator", "=", "name", ".", "lastIndexOf", "(", "\":\"", ")", ";", "if", "(", "prefixSeparator", "!=", "-", "1", ")", "{", "String", "prefix", "=", "name", ".", "substring", "(", "0", ",", "prefixSeparator", ")", ";", "String", "localName", "=", "name", ".", "substring", "(", "prefixSeparator", "+", "1", ")", ";", "if", "(", "!", "DocumentImpl", ".", "isXMLIdentifier", "(", "prefix", ")", "||", "!", "DocumentImpl", ".", "isXMLIdentifier", "(", "localName", ")", ")", "{", "throw", "new", "DOMException", "(", "DOMException", ".", "INVALID_CHARACTER_ERR", ",", "name", ")", ";", "}", "}", "else", "if", "(", "!", "DocumentImpl", ".", "isXMLIdentifier", "(", "name", ")", ")", "{", "throw", "new", "DOMException", "(", "DOMException", ".", "INVALID_CHARACTER_ERR", ",", "name", ")", ";", "}", "switch", "(", "node", ".", "getNodeType", "(", ")", ")", "{", "case", "ATTRIBUTE_NODE", ":", "AttrImpl", "attr", "=", "(", "AttrImpl", ")", "node", ";", "attr", ".", "namespaceAware", "=", "false", ";", "attr", ".", "localName", "=", "name", ";", "break", ";", "case", "ELEMENT_NODE", ":", "ElementImpl", "element", "=", "(", "ElementImpl", ")", "node", ";", "element", ".", "namespaceAware", "=", "false", ";", "element", ".", "localName", "=", "name", ";", "break", ";", "default", ":", "throw", "new", "DOMException", "(", "DOMException", ".", "NOT_SUPPORTED_ERR", ",", "\"Cannot rename nodes of type \"", "+", "node", ".", "getNodeType", "(", ")", ")", ";", "}", "}" ]
Sets {@code node} to be not namespace-aware and assigns its name. @param node an element or attribute node.
[ "Sets", "{", "@code", "node", "}", "to", "be", "not", "namespace", "-", "aware", "and", "assigns", "its", "name", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/NodeImpl.java#L279-L308
OpenLiberty/open-liberty
dev/com.ibm.ws.jsfContainer_fat_2.3/fat/src/com/ibm/ws/jsf/container/fat/utils/JSFUtils.java
JSFUtils.waitForPageResponse
public static boolean waitForPageResponse(HtmlPage page, String responseMessage) throws InterruptedException { """ Create a custom wait mechanism that waits for any background JavaScript to finish and verifies a message in the page response. @param page The current HtmlPage @return A boolean value indicating if the response message was found @throws InterruptedException """ int i = 0; boolean isTextFound = false; while (!isTextFound && i < 5) { isTextFound = page.asText().contains(responseMessage); i++; Thread.sleep(1000); Log.info(c, "waitForPageResponse", "Waiting for: " + responseMessage + " isTextFound: " + isTextFound + " i: " + i); } return isTextFound; }
java
public static boolean waitForPageResponse(HtmlPage page, String responseMessage) throws InterruptedException { int i = 0; boolean isTextFound = false; while (!isTextFound && i < 5) { isTextFound = page.asText().contains(responseMessage); i++; Thread.sleep(1000); Log.info(c, "waitForPageResponse", "Waiting for: " + responseMessage + " isTextFound: " + isTextFound + " i: " + i); } return isTextFound; }
[ "public", "static", "boolean", "waitForPageResponse", "(", "HtmlPage", "page", ",", "String", "responseMessage", ")", "throws", "InterruptedException", "{", "int", "i", "=", "0", ";", "boolean", "isTextFound", "=", "false", ";", "while", "(", "!", "isTextFound", "&&", "i", "<", "5", ")", "{", "isTextFound", "=", "page", ".", "asText", "(", ")", ".", "contains", "(", "responseMessage", ")", ";", "i", "++", ";", "Thread", ".", "sleep", "(", "1000", ")", ";", "Log", ".", "info", "(", "c", ",", "\"waitForPageResponse\"", ",", "\"Waiting for: \"", "+", "responseMessage", "+", "\" isTextFound: \"", "+", "isTextFound", "+", "\" i: \"", "+", "i", ")", ";", "}", "return", "isTextFound", ";", "}" ]
Create a custom wait mechanism that waits for any background JavaScript to finish and verifies a message in the page response. @param page The current HtmlPage @return A boolean value indicating if the response message was found @throws InterruptedException
[ "Create", "a", "custom", "wait", "mechanism", "that", "waits", "for", "any", "background", "JavaScript", "to", "finish", "and", "verifies", "a", "message", "in", "the", "page", "response", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsfContainer_fat_2.3/fat/src/com/ibm/ws/jsf/container/fat/utils/JSFUtils.java#L72-L82
apache/flink
flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/functions/aggfunctions/AvgAggFunction.java
AvgAggFunction.getValueExpression
@Override public Expression getValueExpression() { """ If all input are nulls, count will be 0 and we will get null after the division. """ return ifThenElse(equalTo(count, literal(0L)), nullOf(getResultType()), div(sum, count)); }
java
@Override public Expression getValueExpression() { return ifThenElse(equalTo(count, literal(0L)), nullOf(getResultType()), div(sum, count)); }
[ "@", "Override", "public", "Expression", "getValueExpression", "(", ")", "{", "return", "ifThenElse", "(", "equalTo", "(", "count", ",", "literal", "(", "0L", ")", ")", ",", "nullOf", "(", "getResultType", "(", ")", ")", ",", "div", "(", "sum", ",", "count", ")", ")", ";", "}" ]
If all input are nulls, count will be 0 and we will get null after the division.
[ "If", "all", "input", "are", "nulls", "count", "will", "be", "0", "and", "we", "will", "get", "null", "after", "the", "division", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/functions/aggfunctions/AvgAggFunction.java#L106-L109
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/ASegment.java
ASegment.getNextPunctuationPairWord
protected IWord getNextPunctuationPairWord(int c, int pos) throws IOException { """ get the next punctuation pair word from the current position of the input stream. @param c @param pos @return IWord could be null and that mean we reached a stop word @throws IOException """ IWord w = null, w2 = null; String text = getPairPunctuationText(c); //handle the punctuation. String str = String.valueOf((char)c); if ( ! ( config.CLEAR_STOPWORD && dic.match(ILexicon.STOP_WORD, str) ) ) { w = new Word(str, IWord.T_PUNCTUATION); w.setPartSpeech(IWord.PUNCTUATION); w.setPosition(pos); } //handle the pair text. if ( text != null && text.length() > 0 && ! ( config.CLEAR_STOPWORD && dic.match(ILexicon.STOP_WORD, text) ) ) { w2 = new Word( text, ILexicon.CJK_WORD ); w2.setPartSpeech(IWord.PPT_POSPEECH); w2.setPosition(pos+1); if ( w == null ) w = w2; else wordPool.add(w2); } /* here: * 1. the punctuation is clear. * 2. the pair text is null or being cleared. * @date 2013-09-06 */ if ( w == null && w2 == null ) { return null; } return w; }
java
protected IWord getNextPunctuationPairWord(int c, int pos) throws IOException { IWord w = null, w2 = null; String text = getPairPunctuationText(c); //handle the punctuation. String str = String.valueOf((char)c); if ( ! ( config.CLEAR_STOPWORD && dic.match(ILexicon.STOP_WORD, str) ) ) { w = new Word(str, IWord.T_PUNCTUATION); w.setPartSpeech(IWord.PUNCTUATION); w.setPosition(pos); } //handle the pair text. if ( text != null && text.length() > 0 && ! ( config.CLEAR_STOPWORD && dic.match(ILexicon.STOP_WORD, text) ) ) { w2 = new Word( text, ILexicon.CJK_WORD ); w2.setPartSpeech(IWord.PPT_POSPEECH); w2.setPosition(pos+1); if ( w == null ) w = w2; else wordPool.add(w2); } /* here: * 1. the punctuation is clear. * 2. the pair text is null or being cleared. * @date 2013-09-06 */ if ( w == null && w2 == null ) { return null; } return w; }
[ "protected", "IWord", "getNextPunctuationPairWord", "(", "int", "c", ",", "int", "pos", ")", "throws", "IOException", "{", "IWord", "w", "=", "null", ",", "w2", "=", "null", ";", "String", "text", "=", "getPairPunctuationText", "(", "c", ")", ";", "//handle the punctuation.", "String", "str", "=", "String", ".", "valueOf", "(", "(", "char", ")", "c", ")", ";", "if", "(", "!", "(", "config", ".", "CLEAR_STOPWORD", "&&", "dic", ".", "match", "(", "ILexicon", ".", "STOP_WORD", ",", "str", ")", ")", ")", "{", "w", "=", "new", "Word", "(", "str", ",", "IWord", ".", "T_PUNCTUATION", ")", ";", "w", ".", "setPartSpeech", "(", "IWord", ".", "PUNCTUATION", ")", ";", "w", ".", "setPosition", "(", "pos", ")", ";", "}", "//handle the pair text.", "if", "(", "text", "!=", "null", "&&", "text", ".", "length", "(", ")", ">", "0", "&&", "!", "(", "config", ".", "CLEAR_STOPWORD", "&&", "dic", ".", "match", "(", "ILexicon", ".", "STOP_WORD", ",", "text", ")", ")", ")", "{", "w2", "=", "new", "Word", "(", "text", ",", "ILexicon", ".", "CJK_WORD", ")", ";", "w2", ".", "setPartSpeech", "(", "IWord", ".", "PPT_POSPEECH", ")", ";", "w2", ".", "setPosition", "(", "pos", "+", "1", ")", ";", "if", "(", "w", "==", "null", ")", "w", "=", "w2", ";", "else", "wordPool", ".", "add", "(", "w2", ")", ";", "}", "/* here: \n * 1. the punctuation is clear.\n * 2. the pair text is null or being cleared.\n * @date 2013-09-06\n */", "if", "(", "w", "==", "null", "&&", "w2", "==", "null", ")", "{", "return", "null", ";", "}", "return", "w", ";", "}" ]
get the next punctuation pair word from the current position of the input stream. @param c @param pos @return IWord could be null and that mean we reached a stop word @throws IOException
[ "get", "the", "next", "punctuation", "pair", "word", "from", "the", "current", "position", "of", "the", "input", "stream", "." ]
train
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/ASegment.java#L700-L736
linkedin/dexmaker
dexmaker-mockito-inline-extended/src/main/java/com/android/dx/mockito/inline/extended/ExtendedMockito.java
ExtendedMockito.doReturn
public static StaticCapableStubber doReturn(Object toBeReturned, Object... toBeReturnedNext) { """ Same as {@link Mockito#doReturn(Object, Object...)} but adds the ability to stub static method calls via {@link StaticCapableStubber#when(MockedMethod)} and {@link StaticCapableStubber#when(MockedVoidMethod)}. """ return new StaticCapableStubber(Mockito.doReturn(toBeReturned, toBeReturnedNext)); }
java
public static StaticCapableStubber doReturn(Object toBeReturned, Object... toBeReturnedNext) { return new StaticCapableStubber(Mockito.doReturn(toBeReturned, toBeReturnedNext)); }
[ "public", "static", "StaticCapableStubber", "doReturn", "(", "Object", "toBeReturned", ",", "Object", "...", "toBeReturnedNext", ")", "{", "return", "new", "StaticCapableStubber", "(", "Mockito", ".", "doReturn", "(", "toBeReturned", ",", "toBeReturnedNext", ")", ")", ";", "}" ]
Same as {@link Mockito#doReturn(Object, Object...)} but adds the ability to stub static method calls via {@link StaticCapableStubber#when(MockedMethod)} and {@link StaticCapableStubber#when(MockedVoidMethod)}.
[ "Same", "as", "{" ]
train
https://github.com/linkedin/dexmaker/blob/c58ffebcbb2564c7d1fa6fb58b48f351c330296d/dexmaker-mockito-inline-extended/src/main/java/com/android/dx/mockito/inline/extended/ExtendedMockito.java#L113-L115