repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java
GISCoordinates.WSG84_L3
@Pure public static Point2d WSG84_L3(double lambda, double phi) { final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi); return NTFLambdaPhi_NTFLambert( ntfLambdaPhi.getX(), ntfLambdaPhi.getY(), LAMBERT_3_N, LAMBERT_3_C, LAMBERT_3_XS, LAMBERT_3_YS); }
java
@Pure public static Point2d WSG84_L3(double lambda, double phi) { final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi); return NTFLambdaPhi_NTFLambert( ntfLambdaPhi.getX(), ntfLambdaPhi.getY(), LAMBERT_3_N, LAMBERT_3_C, LAMBERT_3_XS, LAMBERT_3_YS); }
[ "@", "Pure", "public", "static", "Point2d", "WSG84_L3", "(", "double", "lambda", ",", "double", "phi", ")", "{", "final", "Point2d", "ntfLambdaPhi", "=", "WSG84_NTFLamdaPhi", "(", "lambda", ",", "phi", ")", ";", "return", "NTFLambdaPhi_NTFLambert", "(", "ntfLa...
This function convert WSG84 GPS coordinate to France Lambert III coordinate. @param lambda in degrees. @param phi in degrees. @return the France Lambert III coordinates.
[ "This", "function", "convert", "WSG84", "GPS", "coordinate", "to", "France", "Lambert", "III", "coordinate", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L1097-L1106
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/AccountsApi.java
AccountsApi.updateConsumerDisclosure
public ConsumerDisclosure updateConsumerDisclosure(String accountId, String langCode, ConsumerDisclosure consumerDisclosure) throws ApiException { return updateConsumerDisclosure(accountId, langCode, consumerDisclosure, null); }
java
public ConsumerDisclosure updateConsumerDisclosure(String accountId, String langCode, ConsumerDisclosure consumerDisclosure) throws ApiException { return updateConsumerDisclosure(accountId, langCode, consumerDisclosure, null); }
[ "public", "ConsumerDisclosure", "updateConsumerDisclosure", "(", "String", "accountId", ",", "String", "langCode", ",", "ConsumerDisclosure", "consumerDisclosure", ")", "throws", "ApiException", "{", "return", "updateConsumerDisclosure", "(", "accountId", ",", "langCode", ...
Update Consumer Disclosure. @param accountId The external account number (int) or account ID Guid. (required) @param langCode The simple type enumeration the language used in the response. The supported languages, with the language value shown in parenthesis, are:Arabic (ar), Bulgarian (bg), Czech (cs), Chinese Simplified (zh_CN), Chinese Traditional (zh_TW), Croatian (hr), Danish (da), Dutch (nl), English US (en), English UK (en_GB), Estonian (et), Farsi (fa), Finnish (fi), French (fr), French Canada (fr_CA), German (de), Greek (el), Hebrew (he), Hindi (hi), Hungarian (hu), Bahasa Indonesia (id), Italian (it), Japanese (ja), Korean (ko), Latvian (lv), Lithuanian (lt), Bahasa Melayu (ms), Norwegian (no), Polish (pl), Portuguese (pt), Portuguese Brazil (pt_BR), Romanian (ro), Russian (ru), Serbian (sr), Slovak (sk), Slovenian (sl), Spanish (es),Spanish Latin America (es_MX), Swedish (sv), Thai (th), Turkish (tr), Ukrainian (uk) and Vietnamese (vi). Additionally, the value can be set to �browser� to automatically detect the browser language being used by the viewer and display the disclosure in that language. (required) @param consumerDisclosure (optional) @return ConsumerDisclosure
[ "Update", "Consumer", "Disclosure", "." ]
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/AccountsApi.java#L2653-L2655
SvenEwald/xmlbeam
src/main/java/org/xmlbeam/ProjectionInvocationHandler.java
ProjectionInvocationHandler.injectMeAttribute
private static void injectMeAttribute(final DOMAccess me, final Object target, final Class<?> projectionInterface) { //final Class<?> projectionInterface = me.getProjectionInterface(); for (Field field : target.getClass().getDeclaredFields()) { if (!isValidMeField(field, projectionInterface)) { continue; } if (!field.isAccessible()) { field.setAccessible(true); } try { field.set(target, me); return; } catch (IllegalAccessException e) { throw new RuntimeException(e); } } throw new IllegalArgumentException("Mixin " + target.getClass().getSimpleName() + " needs an attribute \"private " + projectionInterface.getSimpleName() + " me;\" to be able to access the projection."); }
java
private static void injectMeAttribute(final DOMAccess me, final Object target, final Class<?> projectionInterface) { //final Class<?> projectionInterface = me.getProjectionInterface(); for (Field field : target.getClass().getDeclaredFields()) { if (!isValidMeField(field, projectionInterface)) { continue; } if (!field.isAccessible()) { field.setAccessible(true); } try { field.set(target, me); return; } catch (IllegalAccessException e) { throw new RuntimeException(e); } } throw new IllegalArgumentException("Mixin " + target.getClass().getSimpleName() + " needs an attribute \"private " + projectionInterface.getSimpleName() + " me;\" to be able to access the projection."); }
[ "private", "static", "void", "injectMeAttribute", "(", "final", "DOMAccess", "me", ",", "final", "Object", "target", ",", "final", "Class", "<", "?", ">", "projectionInterface", ")", "{", "//final Class<?> projectionInterface = me.getProjectionInterface();", "for", "(",...
Find the "me" attribute (which is a replacement for "this") and inject the projection proxy instance. @param me @param target
[ "Find", "the", "me", "attribute", "(", "which", "is", "a", "replacement", "for", "this", ")", "and", "inject", "the", "projection", "proxy", "instance", "." ]
train
https://github.com/SvenEwald/xmlbeam/blob/acaac1b8fa28d246f17187f5e3c6696458a0b447/src/main/java/org/xmlbeam/ProjectionInvocationHandler.java#L830-L847
icode/ameba
src/main/java/ameba/db/ebean/support/ModelResourceStructure.java
ModelResourceStructure.applyRowCountHeader
protected void applyRowCountHeader(MultivaluedMap<String, Object> headerParams, Query query, FutureRowCount rowCount) { ModelInterceptor.applyRowCountHeader(headerParams, query, rowCount); }
java
protected void applyRowCountHeader(MultivaluedMap<String, Object> headerParams, Query query, FutureRowCount rowCount) { ModelInterceptor.applyRowCountHeader(headerParams, query, rowCount); }
[ "protected", "void", "applyRowCountHeader", "(", "MultivaluedMap", "<", "String", ",", "Object", ">", "headerParams", ",", "Query", "query", ",", "FutureRowCount", "rowCount", ")", "{", "ModelInterceptor", ".", "applyRowCountHeader", "(", "headerParams", ",", "query...
<p>applyRowCountHeader.</p> @param headerParams a {@link javax.ws.rs.core.MultivaluedMap} object. @param query a {@link io.ebean.Query} object. @param rowCount a {@link io.ebean.FutureRowCount} object.
[ "<p", ">", "applyRowCountHeader", ".", "<", "/", "p", ">" ]
train
https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/support/ModelResourceStructure.java#L1042-L1044
korpling/ANNIS
annis-service/src/main/java/annis/administration/AdministrationDao.java
AdministrationDao.listIndexDefinitions
public List<String> listIndexDefinitions(boolean used, List<String> tables) { String scansOp = used ? "!=" : "="; String sql = "SELECT pg_get_indexdef(x.indexrelid) AS indexdef " + "FROM pg_index x, pg_class c " + "WHERE x.indexrelid = c.oid " + "AND c.relname IN ( " + StringUtils.repeat("?", ",", tables.size()) + ") " + "AND pg_stat_get_numscans(x.indexrelid) " + scansOp + " 0"; return getJdbcTemplate().query(sql, tables.toArray(), stringRowMapper()); }
java
public List<String> listIndexDefinitions(boolean used, List<String> tables) { String scansOp = used ? "!=" : "="; String sql = "SELECT pg_get_indexdef(x.indexrelid) AS indexdef " + "FROM pg_index x, pg_class c " + "WHERE x.indexrelid = c.oid " + "AND c.relname IN ( " + StringUtils.repeat("?", ",", tables.size()) + ") " + "AND pg_stat_get_numscans(x.indexrelid) " + scansOp + " 0"; return getJdbcTemplate().query(sql, tables.toArray(), stringRowMapper()); }
[ "public", "List", "<", "String", ">", "listIndexDefinitions", "(", "boolean", "used", ",", "List", "<", "String", ">", "tables", ")", "{", "String", "scansOp", "=", "used", "?", "\"!=\"", ":", "\"=\"", ";", "String", "sql", "=", "\"SELECT pg_get_indexdef(x.i...
/* Returns the CREATE INDEX statement for all indexes on the Annis tables, that are not auto-created by PostgreSQL (primary keys and unique constraints). @param used If True, return used indexes. If False, return unused indexes (scan count is 0).
[ "/", "*", "Returns", "the", "CREATE", "INDEX", "statement", "for", "all", "indexes", "on", "the", "Annis", "tables", "that", "are", "not", "auto", "-", "created", "by", "PostgreSQL", "(", "primary", "keys", "and", "unique", "constraints", ")", "." ]
train
https://github.com/korpling/ANNIS/blob/152a2e34832e015f73ac8ce8a7d4c32641641324/annis-service/src/main/java/annis/administration/AdministrationDao.java#L1808-L1819
ModeShape/modeshape
modeshape-jdbc/src/main/java/org/modeshape/jdbc/rest/ModeShapeRestClient.java
ModeShapeRestClient.getNodeTypes
public NodeTypes getNodeTypes() { String url = jsonRestClient.appendToURL(ITEMS_METHOD, NODE_TYPES_SEGMENT); JSONRestClient.Response response = jsonRestClient.doGet(url); if (!response.isOK()) { throw new RuntimeException(JdbcI18n.invalidServerResponse.text(url, response.asString())); } return new NodeTypes(response.json()); }
java
public NodeTypes getNodeTypes() { String url = jsonRestClient.appendToURL(ITEMS_METHOD, NODE_TYPES_SEGMENT); JSONRestClient.Response response = jsonRestClient.doGet(url); if (!response.isOK()) { throw new RuntimeException(JdbcI18n.invalidServerResponse.text(url, response.asString())); } return new NodeTypes(response.json()); }
[ "public", "NodeTypes", "getNodeTypes", "(", ")", "{", "String", "url", "=", "jsonRestClient", ".", "appendToURL", "(", "ITEMS_METHOD", ",", "NODE_TYPES_SEGMENT", ")", ";", "JSONRestClient", ".", "Response", "response", "=", "jsonRestClient", ".", "doGet", "(", "...
Returns all the node types that are available in the repository from {@code repoUrl} @return a {@link NodeTypes} instance; never {@code null}
[ "Returns", "all", "the", "node", "types", "that", "are", "available", "in", "the", "repository", "from", "{", "@code", "repoUrl", "}" ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jdbc/src/main/java/org/modeshape/jdbc/rest/ModeShapeRestClient.java#L110-L117
3pillarlabs/spring-data-simpledb
spring-data-simpledb-impl/src/main/java/org/springframework/data/simpledb/core/domain/DomainManager.java
DomainManager.dropDomain
protected void dropDomain(final String domainName, final AmazonSimpleDB sdb) { try { LOGGER.debug("Dropping domain: {}", domainName); DeleteDomainRequest request = new DeleteDomainRequest(domainName); sdb.deleteDomain(request); LOGGER.debug("Dropped domain: {}", domainName); } catch(AmazonClientException amazonException) { throw SimpleDbExceptionTranslator.getTranslatorInstance().translateAmazonClientException(amazonException); } }
java
protected void dropDomain(final String domainName, final AmazonSimpleDB sdb) { try { LOGGER.debug("Dropping domain: {}", domainName); DeleteDomainRequest request = new DeleteDomainRequest(domainName); sdb.deleteDomain(request); LOGGER.debug("Dropped domain: {}", domainName); } catch(AmazonClientException amazonException) { throw SimpleDbExceptionTranslator.getTranslatorInstance().translateAmazonClientException(amazonException); } }
[ "protected", "void", "dropDomain", "(", "final", "String", "domainName", ",", "final", "AmazonSimpleDB", "sdb", ")", "{", "try", "{", "LOGGER", ".", "debug", "(", "\"Dropping domain: {}\"", ",", "domainName", ")", ";", "DeleteDomainRequest", "request", "=", "new...
Running the delete-domain command over & over again on the same domain, or if the domain does NOT exist will NOT result in a Amazon Exception @param domainName
[ "Running", "the", "delete", "-", "domain", "command", "over", "&", "over", "again", "on", "the", "same", "domain", "or", "if", "the", "domain", "does", "NOT", "exist", "will", "NOT", "result", "in", "a", "Amazon", "Exception" ]
train
https://github.com/3pillarlabs/spring-data-simpledb/blob/f1e0eb4e48ec4674d3966e8f5bc04c95031f93ae/spring-data-simpledb-impl/src/main/java/org/springframework/data/simpledb/core/domain/DomainManager.java#L62-L71
mcxiaoke/Android-Next
core/src/main/java/com/mcxiaoke/next/utils/IOUtils.java
IOUtils.writeStream
public static boolean writeStream(String filePath, InputStream stream) throws IOException { return writeStream(filePath, stream, false); }
java
public static boolean writeStream(String filePath, InputStream stream) throws IOException { return writeStream(filePath, stream, false); }
[ "public", "static", "boolean", "writeStream", "(", "String", "filePath", ",", "InputStream", "stream", ")", "throws", "IOException", "{", "return", "writeStream", "(", "filePath", ",", "stream", ",", "false", ")", ";", "}" ]
write file @param filePath @param stream @return @see {@link #writeStream(String, InputStream, boolean)}
[ "write", "file" ]
train
https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/core/src/main/java/com/mcxiaoke/next/utils/IOUtils.java#L1186-L1188
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/TcasesJson.java
TcasesJson.writeGenerators
public static void writeGenerators( IGeneratorSet generators, OutputStream outputStream) { try( GeneratorSetJsonWriter writer = new GeneratorSetJsonWriter( outputStream)) { writer.write( generators); } catch( Exception e) { throw new RuntimeException( "Can't write generator definitions", e); } }
java
public static void writeGenerators( IGeneratorSet generators, OutputStream outputStream) { try( GeneratorSetJsonWriter writer = new GeneratorSetJsonWriter( outputStream)) { writer.write( generators); } catch( Exception e) { throw new RuntimeException( "Can't write generator definitions", e); } }
[ "public", "static", "void", "writeGenerators", "(", "IGeneratorSet", "generators", ",", "OutputStream", "outputStream", ")", "{", "try", "(", "GeneratorSetJsonWriter", "writer", "=", "new", "GeneratorSetJsonWriter", "(", "outputStream", ")", ")", "{", "writer", ".",...
Writes a JSON document describing the given generator definitions to the given output stream.
[ "Writes", "a", "JSON", "document", "describing", "the", "given", "generator", "definitions", "to", "the", "given", "output", "stream", "." ]
train
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/TcasesJson.java#L78-L88
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedServerBlobAuditingPoliciesInner.java
ExtendedServerBlobAuditingPoliciesInner.getAsync
public Observable<ExtendedServerBlobAuditingPolicyInner> getAsync(String resourceGroupName, String serverName) { return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<ExtendedServerBlobAuditingPolicyInner>, ExtendedServerBlobAuditingPolicyInner>() { @Override public ExtendedServerBlobAuditingPolicyInner call(ServiceResponse<ExtendedServerBlobAuditingPolicyInner> response) { return response.body(); } }); }
java
public Observable<ExtendedServerBlobAuditingPolicyInner> getAsync(String resourceGroupName, String serverName) { return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<ExtendedServerBlobAuditingPolicyInner>, ExtendedServerBlobAuditingPolicyInner>() { @Override public ExtendedServerBlobAuditingPolicyInner call(ServiceResponse<ExtendedServerBlobAuditingPolicyInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ExtendedServerBlobAuditingPolicyInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ")", ".", "map", "(", ...
Gets an extended server's blob auditing policy. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ExtendedServerBlobAuditingPolicyInner object
[ "Gets", "an", "extended", "server", "s", "blob", "auditing", "policy", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedServerBlobAuditingPoliciesInner.java#L106-L113
alkacon/opencms-core
src/org/opencms/file/collectors/A_CmsResourceCollector.java
A_CmsResourceCollector.getCreateInFolder
protected String getCreateInFolder(CmsObject cms, CmsCollectorData data) throws CmsException { return OpenCms.getResourceManager().getNameGenerator().getNewFileName(cms, data.getFileName(), 4); }
java
protected String getCreateInFolder(CmsObject cms, CmsCollectorData data) throws CmsException { return OpenCms.getResourceManager().getNameGenerator().getNewFileName(cms, data.getFileName(), 4); }
[ "protected", "String", "getCreateInFolder", "(", "CmsObject", "cms", ",", "CmsCollectorData", "data", ")", "throws", "CmsException", "{", "return", "OpenCms", ".", "getResourceManager", "(", ")", ".", "getNameGenerator", "(", ")", ".", "getNewFileName", "(", "cms"...
Returns the link to create a new XML content item in the folder pointed to by the parameter.<p> @param cms the current CmsObject @param data the collector data to use @return the link to create a new XML content item in the folder @throws CmsException if something goes wrong @since 7.0.2
[ "Returns", "the", "link", "to", "create", "a", "new", "XML", "content", "item", "in", "the", "folder", "pointed", "to", "by", "the", "parameter", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/collectors/A_CmsResourceCollector.java#L383-L386
Baidu-AIP/java-sdk
src/main/java/com/baidu/aip/face/AipFace.java
AipFace.getGroupUsers
public JSONObject getGroupUsers(String groupId, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("group_id", groupId); if (options != null) { request.addBody(options); } request.setUri(FaceConsts.GROUP_GETUSERS); request.setBodyFormat(EBodyFormat.RAW_JSON); postOperation(request); return requestServer(request); }
java
public JSONObject getGroupUsers(String groupId, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("group_id", groupId); if (options != null) { request.addBody(options); } request.setUri(FaceConsts.GROUP_GETUSERS); request.setBodyFormat(EBodyFormat.RAW_JSON); postOperation(request); return requestServer(request); }
[ "public", "JSONObject", "getGroupUsers", "(", "String", "groupId", ",", "HashMap", "<", "String", ",", "String", ">", "options", ")", "{", "AipRequest", "request", "=", "new", "AipRequest", "(", ")", ";", "preOperation", "(", "request", ")", ";", "request", ...
获取用户列表接口 @param groupId - 用户组id(由数字、字母、下划线组成),长度限制128B @param options - 可选参数对象,key: value都为string类型 options - options列表: start 默认值0,起始序号 length 返回数量,默认值100,最大值1000 @return JSONObject
[ "获取用户列表接口" ]
train
https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/face/AipFace.java#L251-L263
voldemort/voldemort
src/java/voldemort/utils/ByteUtils.java
ByteUtils.readBytes
public static long readBytes(byte[] bytes, int offset, int numBytes) { int shift = 0; long value = 0; for(int i = offset + numBytes - 1; i >= offset; i--) { value |= (bytes[i] & 0xFFL) << shift; shift += 8; } return value; }
java
public static long readBytes(byte[] bytes, int offset, int numBytes) { int shift = 0; long value = 0; for(int i = offset + numBytes - 1; i >= offset; i--) { value |= (bytes[i] & 0xFFL) << shift; shift += 8; } return value; }
[ "public", "static", "long", "readBytes", "(", "byte", "[", "]", "bytes", ",", "int", "offset", ",", "int", "numBytes", ")", "{", "int", "shift", "=", "0", ";", "long", "value", "=", "0", ";", "for", "(", "int", "i", "=", "offset", "+", "numBytes", ...
Read the given number of bytes into a long @param bytes The byte array to read from @param offset The offset at which to begin reading @param numBytes The number of bytes to read @return The long value read
[ "Read", "the", "given", "number", "of", "bytes", "into", "a", "long" ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/ByteUtils.java#L221-L229
VoltDB/voltdb
src/frontend/org/voltdb/messaging/FastDeserializer.java
FastDeserializer.readString
public static String readString(ByteBuffer buffer) throws IOException { final int NULL_STRING_INDICATOR = -1; final int len = buffer.getInt(); // check for null string if (len == NULL_STRING_INDICATOR) return null; assert len >= 0; if (len > VoltType.MAX_VALUE_LENGTH) { throw new IOException("Serializable strings cannot be longer then " + VoltType.MAX_VALUE_LENGTH + " bytes"); } if (len < NULL_STRING_INDICATOR) { throw new IOException("String length is negative " + len); } // now assume not null final byte[] strbytes = new byte[len]; buffer.get(strbytes); String retval = null; try { retval = new String(strbytes, "UTF-8"); } catch (final UnsupportedEncodingException e) { e.printStackTrace(); } return retval; }
java
public static String readString(ByteBuffer buffer) throws IOException { final int NULL_STRING_INDICATOR = -1; final int len = buffer.getInt(); // check for null string if (len == NULL_STRING_INDICATOR) return null; assert len >= 0; if (len > VoltType.MAX_VALUE_LENGTH) { throw new IOException("Serializable strings cannot be longer then " + VoltType.MAX_VALUE_LENGTH + " bytes"); } if (len < NULL_STRING_INDICATOR) { throw new IOException("String length is negative " + len); } // now assume not null final byte[] strbytes = new byte[len]; buffer.get(strbytes); String retval = null; try { retval = new String(strbytes, "UTF-8"); } catch (final UnsupportedEncodingException e) { e.printStackTrace(); } return retval; }
[ "public", "static", "String", "readString", "(", "ByteBuffer", "buffer", ")", "throws", "IOException", "{", "final", "int", "NULL_STRING_INDICATOR", "=", "-", "1", ";", "final", "int", "len", "=", "buffer", ".", "getInt", "(", ")", ";", "// check for null stri...
Read a string in the standard VoltDB way without wrapping the byte buffer[
[ "Read", "a", "string", "in", "the", "standard", "VoltDB", "way", "without", "wrapping", "the", "byte", "buffer", "[" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/messaging/FastDeserializer.java#L144-L172
Azure/azure-sdk-for-java
eventgrid/resource-manager/v2018_05_01_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_05_01_preview/implementation/EventSubscriptionsInner.java
EventSubscriptionsInner.listGlobalByResourceGroupForTopicType
public List<EventSubscriptionInner> listGlobalByResourceGroupForTopicType(String resourceGroupName, String topicTypeName) { return listGlobalByResourceGroupForTopicTypeWithServiceResponseAsync(resourceGroupName, topicTypeName).toBlocking().single().body(); }
java
public List<EventSubscriptionInner> listGlobalByResourceGroupForTopicType(String resourceGroupName, String topicTypeName) { return listGlobalByResourceGroupForTopicTypeWithServiceResponseAsync(resourceGroupName, topicTypeName).toBlocking().single().body(); }
[ "public", "List", "<", "EventSubscriptionInner", ">", "listGlobalByResourceGroupForTopicType", "(", "String", "resourceGroupName", ",", "String", "topicTypeName", ")", "{", "return", "listGlobalByResourceGroupForTopicTypeWithServiceResponseAsync", "(", "resourceGroupName", ",", ...
List all global event subscriptions under a resource group for a topic type. List all global event subscriptions under a resource group for a specific topic type. @param resourceGroupName The name of the resource group within the user's subscription. @param topicTypeName Name of the topic type @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;EventSubscriptionInner&gt; object if successful.
[ "List", "all", "global", "event", "subscriptions", "under", "a", "resource", "group", "for", "a", "topic", "type", ".", "List", "all", "global", "event", "subscriptions", "under", "a", "resource", "group", "for", "a", "specific", "topic", "type", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2018_05_01_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_05_01_preview/implementation/EventSubscriptionsInner.java#L1089-L1091
deeplearning4j/deeplearning4j
datavec/datavec-api/src/main/java/org/datavec/api/transform/TransformProcess.java
TransformProcess.executeSequenceToSingle
public List<Writable> executeSequenceToSingle(List<List<Writable>> inputSequence){ return execute(null, inputSequence).getLeft(); }
java
public List<Writable> executeSequenceToSingle(List<List<Writable>> inputSequence){ return execute(null, inputSequence).getLeft(); }
[ "public", "List", "<", "Writable", ">", "executeSequenceToSingle", "(", "List", "<", "List", "<", "Writable", ">", ">", "inputSequence", ")", "{", "return", "execute", "(", "null", ",", "inputSequence", ")", ".", "getLeft", "(", ")", ";", "}" ]
Execute a TransformProcess that starts with a sequence record, and converts it to a single (non-sequence) record @param inputSequence Input sequence @return Record after processing (or null if filtered out)
[ "Execute", "a", "TransformProcess", "that", "starts", "with", "a", "sequence", "record", "and", "converts", "it", "to", "a", "single", "(", "non", "-", "sequence", ")", "record" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/transform/TransformProcess.java#L330-L332
b3log/latke
latke-core/src/main/java/org/json/JSONObject.java
JSONObject.optBoolean
public boolean optBoolean(String key, boolean defaultValue) { Object val = this.opt(key); if (NULL.equals(val)) { return defaultValue; } if (val instanceof Boolean){ return ((Boolean) val).booleanValue(); } try { // we'll use the get anyway because it does string conversion. return this.getBoolean(key); } catch (Exception e) { return defaultValue; } }
java
public boolean optBoolean(String key, boolean defaultValue) { Object val = this.opt(key); if (NULL.equals(val)) { return defaultValue; } if (val instanceof Boolean){ return ((Boolean) val).booleanValue(); } try { // we'll use the get anyway because it does string conversion. return this.getBoolean(key); } catch (Exception e) { return defaultValue; } }
[ "public", "boolean", "optBoolean", "(", "String", "key", ",", "boolean", "defaultValue", ")", "{", "Object", "val", "=", "this", ".", "opt", "(", "key", ")", ";", "if", "(", "NULL", ".", "equals", "(", "val", ")", ")", "{", "return", "defaultValue", ...
Get an optional boolean associated with a key. It returns the defaultValue if there is no such key, or if it is not a Boolean or the String "true" or "false" (case insensitive). @param key A key string. @param defaultValue The default. @return The truth.
[ "Get", "an", "optional", "boolean", "associated", "with", "a", "key", ".", "It", "returns", "the", "defaultValue", "if", "there", "is", "no", "such", "key", "or", "if", "it", "is", "not", "a", "Boolean", "or", "the", "String", "true", "or", "false", "(...
train
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONObject.java#L1079-L1093
alkacon/opencms-core
src/org/opencms/util/CmsFileUtil.java
CmsFileUtil.getRfsPath
public static String getRfsPath(String filename, String extension, String parameters) { StringBuffer buf = new StringBuffer(128); buf.append(filename); buf.append('_'); int h = parameters.hashCode(); // ensure we do have a positive id value buf.append(h > 0 ? h : -h); buf.append(extension); return buf.toString(); }
java
public static String getRfsPath(String filename, String extension, String parameters) { StringBuffer buf = new StringBuffer(128); buf.append(filename); buf.append('_'); int h = parameters.hashCode(); // ensure we do have a positive id value buf.append(h > 0 ? h : -h); buf.append(extension); return buf.toString(); }
[ "public", "static", "String", "getRfsPath", "(", "String", "filename", ",", "String", "extension", ",", "String", "parameters", ")", "{", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", "128", ")", ";", "buf", ".", "append", "(", "filename", ")", "...
Creates unique, valid RFS name for the given filename that contains a coded version of the given parameters, with the given file extension appended.<p> This is used to create file names for the static export, or in a vfs disk cache.<p> @param filename the base file name @param extension the extension to use @param parameters the parameters to code in the result file name @return a unique, valid RFS name for the given parameters @see org.opencms.staticexport.CmsStaticExportManager
[ "Creates", "unique", "valid", "RFS", "name", "for", "the", "given", "filename", "that", "contains", "a", "coded", "version", "of", "the", "given", "parameters", "with", "the", "given", "file", "extension", "appended", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsFileUtil.java#L443-L453
alkacon/opencms-core
src-modules/org/opencms/workplace/commons/CmsCommentImages.java
CmsCommentImages.getImageScaler
protected CmsImageScaler getImageScaler() { if (m_imageScaler == null) { // not initialized, create image scaler with default settings m_imageScaler = new CmsImageScaler(); m_imageScaler.setWidth(THUMB_WIDTH); m_imageScaler.setHeight(THUMB_HEIGHT); m_imageScaler.setRenderMode(Simapi.RENDER_SPEED); m_imageScaler.setColor(new Color(0, 0, 0)); m_imageScaler.setType(1); } return m_imageScaler; }
java
protected CmsImageScaler getImageScaler() { if (m_imageScaler == null) { // not initialized, create image scaler with default settings m_imageScaler = new CmsImageScaler(); m_imageScaler.setWidth(THUMB_WIDTH); m_imageScaler.setHeight(THUMB_HEIGHT); m_imageScaler.setRenderMode(Simapi.RENDER_SPEED); m_imageScaler.setColor(new Color(0, 0, 0)); m_imageScaler.setType(1); } return m_imageScaler; }
[ "protected", "CmsImageScaler", "getImageScaler", "(", ")", "{", "if", "(", "m_imageScaler", "==", "null", ")", "{", "// not initialized, create image scaler with default settings", "m_imageScaler", "=", "new", "CmsImageScaler", "(", ")", ";", "m_imageScaler", ".", "setW...
Returns the initialized image scaler object used to generate thumbnails for the dialog form.<p> @return the initialized image scaler object used to generate thumbnails for the dialog form
[ "Returns", "the", "initialized", "image", "scaler", "object", "used", "to", "generate", "thumbnails", "for", "the", "dialog", "form", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsCommentImages.java#L276-L288
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/EnvelopesApi.java
EnvelopesApi.listStatus
public EnvelopesInformation listStatus(String accountId, EnvelopeIdsRequest envelopeIdsRequest) throws ApiException { return listStatus(accountId, envelopeIdsRequest, null); }
java
public EnvelopesInformation listStatus(String accountId, EnvelopeIdsRequest envelopeIdsRequest) throws ApiException { return listStatus(accountId, envelopeIdsRequest, null); }
[ "public", "EnvelopesInformation", "listStatus", "(", "String", "accountId", ",", "EnvelopeIdsRequest", "envelopeIdsRequest", ")", "throws", "ApiException", "{", "return", "listStatus", "(", "accountId", ",", "envelopeIdsRequest", ",", "null", ")", ";", "}" ]
Gets the envelope status for the specified envelopes. Retrieves the envelope status for the specified envelopes. @param accountId The external account number (int) or account ID Guid. (required) @param envelopeIdsRequest (optional) @return EnvelopesInformation
[ "Gets", "the", "envelope", "status", "for", "the", "specified", "envelopes", ".", "Retrieves", "the", "envelope", "status", "for", "the", "specified", "envelopes", "." ]
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/EnvelopesApi.java#L3940-L3942
openCage/eightyfs
src/main/java/de/pfabulist/lindwurm/eighty/attributes/AttributeProvider.java
AttributeProvider.addIsLinkIfPossible
@SuppressWarnings( "PMD.CollapsibleIfStatements" ) private <V extends FileAttributeView> V addIsLinkIfPossible( Class<V> type, V fav ) { if( BasicFileAttributeView.class.isAssignableFrom( type ) ) { if( (! v( () -> BasicFileAttributeView.class.cast( fav ).readAttributes()).isSymbolicLink() )) { if( !( fav instanceof LinkInfoSettable ) ) { throw new UnsupportedOperationException( "the attribute view need to implement LinkInfoSettable in order to make SymLinks work" ); } ( (LinkInfoSettable) ( fav ) ).setLink(); } } return fav; }
java
@SuppressWarnings( "PMD.CollapsibleIfStatements" ) private <V extends FileAttributeView> V addIsLinkIfPossible( Class<V> type, V fav ) { if( BasicFileAttributeView.class.isAssignableFrom( type ) ) { if( (! v( () -> BasicFileAttributeView.class.cast( fav ).readAttributes()).isSymbolicLink() )) { if( !( fav instanceof LinkInfoSettable ) ) { throw new UnsupportedOperationException( "the attribute view need to implement LinkInfoSettable in order to make SymLinks work" ); } ( (LinkInfoSettable) ( fav ) ).setLink(); } } return fav; }
[ "@", "SuppressWarnings", "(", "\"PMD.CollapsibleIfStatements\"", ")", "private", "<", "V", "extends", "FileAttributeView", ">", "V", "addIsLinkIfPossible", "(", "Class", "<", "V", ">", "type", ",", "V", "fav", ")", "{", "if", "(", "BasicFileAttributeView", ".", ...
if the the FAV is actually a BasicFileAttributeView then there is an isLink method if this is not already set and FAV implements LinkInfoSettable use it to add this link info
[ "if", "the", "the", "FAV", "is", "actually", "a", "BasicFileAttributeView", "then", "there", "is", "an", "isLink", "method", "if", "this", "is", "not", "already", "set", "and", "FAV", "implements", "LinkInfoSettable", "use", "it", "to", "add", "this", "link"...
train
https://github.com/openCage/eightyfs/blob/708ec4d336ee5e3dbd4196099f64091eaf6b3387/src/main/java/de/pfabulist/lindwurm/eighty/attributes/AttributeProvider.java#L106-L119
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/ExpressRouteCircuitsInner.java
ExpressRouteCircuitsInner.listRoutesTableSummary
public ExpressRouteCircuitsRoutesTableSummaryListResultInner listRoutesTableSummary(String resourceGroupName, String circuitName, String peeringName, String devicePath) { return listRoutesTableSummaryWithServiceResponseAsync(resourceGroupName, circuitName, peeringName, devicePath).toBlocking().last().body(); }
java
public ExpressRouteCircuitsRoutesTableSummaryListResultInner listRoutesTableSummary(String resourceGroupName, String circuitName, String peeringName, String devicePath) { return listRoutesTableSummaryWithServiceResponseAsync(resourceGroupName, circuitName, peeringName, devicePath).toBlocking().last().body(); }
[ "public", "ExpressRouteCircuitsRoutesTableSummaryListResultInner", "listRoutesTableSummary", "(", "String", "resourceGroupName", ",", "String", "circuitName", ",", "String", "peeringName", ",", "String", "devicePath", ")", "{", "return", "listRoutesTableSummaryWithServiceResponse...
Gets the currently advertised routes table summary associated with the express route circuit in a resource group. @param resourceGroupName The name of the resource group. @param circuitName The name of the express route circuit. @param peeringName The name of the peering. @param devicePath The path of the device. @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 ExpressRouteCircuitsRoutesTableSummaryListResultInner object if successful.
[ "Gets", "the", "currently", "advertised", "routes", "table", "summary", "associated", "with", "the", "express", "route", "circuit", "in", "a", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/ExpressRouteCircuitsInner.java#L1238-L1240
anotheria/moskito
moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/MonitoringAspect.java
MonitoringAspect.doProfilingClass
@Around (value = "execution(* (@(@net.anotheria.moskito.aop.annotation.Monitor *) *).*(..)) && !@annotation(net.anotheria.moskito.aop.annotation.DontMonitor)") public Object doProfilingClass(final ProceedingJoinPoint pjp) throws Throwable { return doProfilingClass(pjp, resolveAnnotation(pjp)); }
java
@Around (value = "execution(* (@(@net.anotheria.moskito.aop.annotation.Monitor *) *).*(..)) && !@annotation(net.anotheria.moskito.aop.annotation.DontMonitor)") public Object doProfilingClass(final ProceedingJoinPoint pjp) throws Throwable { return doProfilingClass(pjp, resolveAnnotation(pjp)); }
[ "@", "Around", "(", "value", "=", "\"execution(* (@(@net.anotheria.moskito.aop.annotation.Monitor *) *).*(..)) && !@annotation(net.anotheria.moskito.aop.annotation.DontMonitor)\"", ")", "public", "Object", "doProfilingClass", "(", "final", "ProceedingJoinPoint", "pjp", ")", "throws", ...
Special class profiling entry-point, which allow to fetch {@link Monitor} from one lvl up of class annotation. Pattern will pre-select 2-nd lvl annotation on class scope. @param pjp {@link ProceedingJoinPoint} @return call result @throws Throwable in case of error during {@link ProceedingJoinPoint#proceed()}
[ "Special", "class", "profiling", "entry", "-", "point", "which", "allow", "to", "fetch", "{", "@link", "Monitor", "}", "from", "one", "lvl", "up", "of", "class", "annotation", ".", "Pattern", "will", "pre", "-", "select", "2", "-", "nd", "lvl", "annotati...
train
https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/MonitoringAspect.java#L82-L85
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java
ElementsExceptionsFactory.newCloneException
public static CloneException newCloneException(String message, Object... args) { return newCloneException(null, message, args); }
java
public static CloneException newCloneException(String message, Object... args) { return newCloneException(null, message, args); }
[ "public", "static", "CloneException", "newCloneException", "(", "String", "message", ",", "Object", "...", "args", ")", "{", "return", "newCloneException", "(", "null", ",", "message", ",", "args", ")", ";", "}" ]
Constructs and initializes a new {@link CloneException} with the given {@link String message} formatted with the given {@link Object[] arguments}. @param message {@link String} describing the {@link CloneException exception}. @param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}. @return a new {@link CloneException} with the given {@link String message}. @see #newCloneException(Throwable, String, Object...) @see org.cp.elements.lang.CloneException
[ "Constructs", "and", "initializes", "a", "new", "{", "@link", "CloneException", "}", "with", "the", "given", "{", "@link", "String", "message", "}", "formatted", "with", "the", "given", "{", "@link", "Object", "[]", "arguments", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L271-L273
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Searcher.java
Searcher.searchWithTimeoutFor
public boolean searchWithTimeoutFor(Class<? extends TextView> viewClass, String regex, int expectedMinimumNumberOfMatches, boolean scroll, boolean onlyVisible) { final long endTime = SystemClock.uptimeMillis() + TIMEOUT; TextView foundAnyMatchingView = null; while (SystemClock.uptimeMillis() < endTime) { sleeper.sleep(); foundAnyMatchingView = searchFor(viewClass, regex, expectedMinimumNumberOfMatches, 0, scroll, onlyVisible); if (foundAnyMatchingView !=null){ return true; } } return false; }
java
public boolean searchWithTimeoutFor(Class<? extends TextView> viewClass, String regex, int expectedMinimumNumberOfMatches, boolean scroll, boolean onlyVisible) { final long endTime = SystemClock.uptimeMillis() + TIMEOUT; TextView foundAnyMatchingView = null; while (SystemClock.uptimeMillis() < endTime) { sleeper.sleep(); foundAnyMatchingView = searchFor(viewClass, regex, expectedMinimumNumberOfMatches, 0, scroll, onlyVisible); if (foundAnyMatchingView !=null){ return true; } } return false; }
[ "public", "boolean", "searchWithTimeoutFor", "(", "Class", "<", "?", "extends", "TextView", ">", "viewClass", ",", "String", "regex", ",", "int", "expectedMinimumNumberOfMatches", ",", "boolean", "scroll", ",", "boolean", "onlyVisible", ")", "{", "final", "long", ...
Searches for a {@code View} with the given regex string and returns {@code true} if the searched {@code Button} is found a given number of times. Will automatically scroll when needed. @param viewClass what kind of {@code View} to search for, e.g. {@code Button.class} or {@code TextView.class} @param regex the text to search for. The parameter <strong>will</strong> be interpreted as a regular expression. @param expectedMinimumNumberOfMatches the minimum number of matches expected to be found. {@code 0} matches means that one or more matches are expected to be found @param scroll whether scrolling should be performed @param onlyVisible {@code true} if only texts visible on the screen should be searched @return {@code true} if a {@code View} of the specified class with the given text is found a given number of times, and {@code false} if it is not found
[ "Searches", "for", "a", "{", "@code", "View", "}", "with", "the", "given", "regex", "string", "and", "returns", "{", "@code", "true", "}", "if", "the", "searched", "{", "@code", "Button", "}", "is", "found", "a", "given", "number", "of", "times", ".", ...
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Searcher.java#L70-L83
astrapi69/jaulp-wicket
jaulp-wicket-annotated-header-contributors/src/main/java/de/alpharogroup/wicket/PackageResourceReferences.java
PackageResourceReferences.addCssFiles
public static void addCssFiles(final IHeaderResponse response, final Class<?> scope, final String... cssFilenames) { for (final String cssFilename : cssFilenames) { final HeaderItem item = CssHeaderItem .forReference(new PackageResourceReference(scope, cssFilename)); response.render(item); } }
java
public static void addCssFiles(final IHeaderResponse response, final Class<?> scope, final String... cssFilenames) { for (final String cssFilename : cssFilenames) { final HeaderItem item = CssHeaderItem .forReference(new PackageResourceReference(scope, cssFilename)); response.render(item); } }
[ "public", "static", "void", "addCssFiles", "(", "final", "IHeaderResponse", "response", ",", "final", "Class", "<", "?", ">", "scope", ",", "final", "String", "...", "cssFilenames", ")", "{", "for", "(", "final", "String", "cssFilename", ":", "cssFilenames", ...
Adds the given css files to the given response object in the given scope. @param response the {@link org.apache.wicket.markup.head.IHeaderResponse} @param scope The scope of the css files. @param cssFilenames The css file names.
[ "Adds", "the", "given", "css", "files", "to", "the", "given", "response", "object", "in", "the", "given", "scope", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-annotated-header-contributors/src/main/java/de/alpharogroup/wicket/PackageResourceReferences.java#L59-L68
ironjacamar/ironjacamar
common/src/main/java/org/ironjacamar/common/metadata/common/AbstractParser.java
AbstractParser.elementAsLong
protected Long elementAsLong(XMLStreamReader reader, String key, Map<String, String> expressions) throws XMLStreamException, ParserException { Long longValue = null; String elementtext = rawElementText(reader); if (key != null && expressions != null && elementtext != null && elementtext.indexOf("${") != -1) expressions.put(key, elementtext); try { longValue = Long.valueOf(getSubstitutionValue(elementtext)); } catch (NumberFormatException nfe) { throw new ParserException(bundle.notValidNumber(elementtext, reader.getLocalName())); } return longValue; }
java
protected Long elementAsLong(XMLStreamReader reader, String key, Map<String, String> expressions) throws XMLStreamException, ParserException { Long longValue = null; String elementtext = rawElementText(reader); if (key != null && expressions != null && elementtext != null && elementtext.indexOf("${") != -1) expressions.put(key, elementtext); try { longValue = Long.valueOf(getSubstitutionValue(elementtext)); } catch (NumberFormatException nfe) { throw new ParserException(bundle.notValidNumber(elementtext, reader.getLocalName())); } return longValue; }
[ "protected", "Long", "elementAsLong", "(", "XMLStreamReader", "reader", ",", "String", "key", ",", "Map", "<", "String", ",", "String", ">", "expressions", ")", "throws", "XMLStreamException", ",", "ParserException", "{", "Long", "longValue", "=", "null", ";", ...
convert an xml element in Long value @param reader the StAX reader @param key The key @param expressions The expressions @return the long representing element @throws XMLStreamException StAX exception @throws ParserException in case it isn't a number
[ "convert", "an", "xml", "element", "in", "Long", "value" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/metadata/common/AbstractParser.java#L286-L305
google/closure-templates
java/src/com/google/template/soy/msgs/internal/InsertMsgsVisitor.java
InsertMsgsVisitor.buildReplacementNodesFromTranslation
private void buildReplacementNodesFromTranslation(MsgNode msg, SoyMsg translation) { currReplacementNodes = Lists.newArrayList(); for (SoyMsgPart msgPart : translation.getParts()) { if (msgPart instanceof SoyMsgRawTextPart) { // Append a new RawTextNode to the currReplacementNodes list. String rawText = ((SoyMsgRawTextPart) msgPart).getRawText(); currReplacementNodes.add( new RawTextNode(nodeIdGen.genId(), rawText, msg.getSourceLocation())); } else if (msgPart instanceof SoyMsgPlaceholderPart) { // Get the representative placeholder node and iterate through its contents. String placeholderName = ((SoyMsgPlaceholderPart) msgPart).getPlaceholderName(); MsgPlaceholderNode placeholderNode = msg.getRepPlaceholderNode(placeholderName); for (StandaloneNode contentNode : placeholderNode.getChildren()) { // If the content node is a MsgHtmlTagNode, it needs to be replaced by a number of // consecutive siblings. This is done by visiting the MsgHtmlTagNode. Otherwise, we // simply add the content node to the currReplacementNodes list being built. if (contentNode instanceof MsgHtmlTagNode) { currReplacementNodes.addAll(((MsgHtmlTagNode) contentNode).getChildren()); } else { currReplacementNodes.add(contentNode); } } } else { throw new AssertionError(); } } }
java
private void buildReplacementNodesFromTranslation(MsgNode msg, SoyMsg translation) { currReplacementNodes = Lists.newArrayList(); for (SoyMsgPart msgPart : translation.getParts()) { if (msgPart instanceof SoyMsgRawTextPart) { // Append a new RawTextNode to the currReplacementNodes list. String rawText = ((SoyMsgRawTextPart) msgPart).getRawText(); currReplacementNodes.add( new RawTextNode(nodeIdGen.genId(), rawText, msg.getSourceLocation())); } else if (msgPart instanceof SoyMsgPlaceholderPart) { // Get the representative placeholder node and iterate through its contents. String placeholderName = ((SoyMsgPlaceholderPart) msgPart).getPlaceholderName(); MsgPlaceholderNode placeholderNode = msg.getRepPlaceholderNode(placeholderName); for (StandaloneNode contentNode : placeholderNode.getChildren()) { // If the content node is a MsgHtmlTagNode, it needs to be replaced by a number of // consecutive siblings. This is done by visiting the MsgHtmlTagNode. Otherwise, we // simply add the content node to the currReplacementNodes list being built. if (contentNode instanceof MsgHtmlTagNode) { currReplacementNodes.addAll(((MsgHtmlTagNode) contentNode).getChildren()); } else { currReplacementNodes.add(contentNode); } } } else { throw new AssertionError(); } } }
[ "private", "void", "buildReplacementNodesFromTranslation", "(", "MsgNode", "msg", ",", "SoyMsg", "translation", ")", "{", "currReplacementNodes", "=", "Lists", ".", "newArrayList", "(", ")", ";", "for", "(", "SoyMsgPart", "msgPart", ":", "translation", ".", "getPa...
Private helper for visitMsgFallbackGroupNode() to build the list of replacement nodes for a message from its translation.
[ "Private", "helper", "for", "visitMsgFallbackGroupNode", "()", "to", "build", "the", "list", "of", "replacement", "nodes", "for", "a", "message", "from", "its", "translation", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/msgs/internal/InsertMsgsVisitor.java#L139-L170
alkacon/opencms-core
src/org/opencms/gwt/CmsClientUserSettingConverter.java
CmsClientUserSettingConverter.saveSetting
private void saveSetting(String key, String value) throws Exception { Map<String, I_CmsPreference> prefs = OpenCms.getWorkplaceManager().getDefaultUserSettings().getPreferences(); if (prefs.containsKey(key)) { prefs.get(key).setValue(m_currentPreferences, value); } else { LOG.error("Can't save user setting '" + key + "'"); } }
java
private void saveSetting(String key, String value) throws Exception { Map<String, I_CmsPreference> prefs = OpenCms.getWorkplaceManager().getDefaultUserSettings().getPreferences(); if (prefs.containsKey(key)) { prefs.get(key).setValue(m_currentPreferences, value); } else { LOG.error("Can't save user setting '" + key + "'"); } }
[ "private", "void", "saveSetting", "(", "String", "key", ",", "String", "value", ")", "throws", "Exception", "{", "Map", "<", "String", ",", "I_CmsPreference", ">", "prefs", "=", "OpenCms", ".", "getWorkplaceManager", "(", ")", ".", "getDefaultUserSettings", "(...
Saves an individual user preference value.<p> @param key the key of the user preference @param value the value of the user preference @throws Exception if something goes wrong
[ "Saves", "an", "individual", "user", "preference", "value", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/CmsClientUserSettingConverter.java#L186-L194
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/DoubleExtensions.java
DoubleExtensions.operator_power
@Pure public static double operator_power(Double a, Number b) { return Math.pow(a, b.doubleValue()); }
java
@Pure public static double operator_power(Double a, Number b) { return Math.pow(a, b.doubleValue()); }
[ "@", "Pure", "public", "static", "double", "operator_power", "(", "Double", "a", ",", "Number", "b", ")", "{", "return", "Math", ".", "pow", "(", "a", ",", "b", ".", "doubleValue", "(", ")", ")", ";", "}" ]
The <code>power</code> operator. @param a a double. May not be <code>null</code>. @param b a number. May not be <code>null</code>. @return <code>a ** b</code> @throws NullPointerException if {@code a} or {@code b} is <code>null</code>.
[ "The", "<code", ">", "power<", "/", "code", ">", "operator", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/DoubleExtensions.java#L78-L81
chhh/MSFTBX
MSFileToolbox/src/main/java/umich/ms/util/base64/Base64Slow.java
Base64Slow.isBase64
public static boolean isBase64(String string, String enc) throws UnsupportedEncodingException { return isBase64(string.getBytes(enc)); }
java
public static boolean isBase64(String string, String enc) throws UnsupportedEncodingException { return isBase64(string.getBytes(enc)); }
[ "public", "static", "boolean", "isBase64", "(", "String", "string", ",", "String", "enc", ")", "throws", "UnsupportedEncodingException", "{", "return", "isBase64", "(", "string", ".", "getBytes", "(", "enc", ")", ")", ";", "}" ]
Determines if the String is in base64 format. <p> Data will be considered to be in base64 format if it contains only base64 characters and white space with equals sign padding on the end so that the number of base64 characters is divisible by four. <p> It is possible for data to be in base64 format but for it to not meet these stringent requirements. It is also possible for data to meet these requirements even though decoding it would not make any sense. This method should be used as a guide but it is not authoritative because of the possibility of these false positives and false negatives. <p> Additionally, extra data such as headers or footers may throw this method off the scent and cause it to return false. @param string String that may be in base64 format. @param enc Character encoding to use when converting to bytes. @return Best guess as to whether the data is in base64 format. @throws UnsupportedEncodingException if the character encoding specified is not supported.
[ "Determines", "if", "the", "String", "is", "in", "base64", "format", ".", "<p", ">", "Data", "will", "be", "considered", "to", "be", "in", "base64", "format", "if", "it", "contains", "only", "base64", "characters", "and", "white", "space", "with", "equals"...
train
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/base64/Base64Slow.java#L892-L894
selenide/selenide
src/main/java/com/codeborne/selenide/SelenideTargetLocator.java
SelenideTargetLocator.innerFrame
public WebDriver innerFrame(String... frames) { delegate.defaultContent(); for (String frame : frames) { try { String selector = String.format("frame#%1$s,frame[name=%1$s],iframe#%1$s,iframe[name=%1$s]", frame); Wait().until(frameToBeAvailableAndSwitchToIt_fixed(By.cssSelector(selector))); } catch (NoSuchElementException | TimeoutException e) { throw new NoSuchFrameException("No frame found with id/name = " + frame, e); } } return webDriver; }
java
public WebDriver innerFrame(String... frames) { delegate.defaultContent(); for (String frame : frames) { try { String selector = String.format("frame#%1$s,frame[name=%1$s],iframe#%1$s,iframe[name=%1$s]", frame); Wait().until(frameToBeAvailableAndSwitchToIt_fixed(By.cssSelector(selector))); } catch (NoSuchElementException | TimeoutException e) { throw new NoSuchFrameException("No frame found with id/name = " + frame, e); } } return webDriver; }
[ "public", "WebDriver", "innerFrame", "(", "String", "...", "frames", ")", "{", "delegate", ".", "defaultContent", "(", ")", ";", "for", "(", "String", "frame", ":", "frames", ")", "{", "try", "{", "String", "selector", "=", "String", ".", "format", "(", ...
Switch to the inner frame (last child frame in given sequence)
[ "Switch", "to", "the", "inner", "frame", "(", "last", "child", "frame", "in", "given", "sequence", ")" ]
train
https://github.com/selenide/selenide/blob/b867baf171942cf07725d83a985237428569883f/src/main/java/com/codeborne/selenide/SelenideTargetLocator.java#L99-L113
hankcs/HanLP
src/main/java/com/hankcs/hanlp/collection/MDAG/MDAGNode.java
MDAGNode.addOutgoingTransition
public MDAGNode addOutgoingTransition(char letter, boolean targetAcceptStateStatus) { MDAGNode newTargetNode = new MDAGNode(targetAcceptStateStatus); newTargetNode.incomingTransitionCount++; outgoingTransitionTreeMap.put(letter, newTargetNode); return newTargetNode; }
java
public MDAGNode addOutgoingTransition(char letter, boolean targetAcceptStateStatus) { MDAGNode newTargetNode = new MDAGNode(targetAcceptStateStatus); newTargetNode.incomingTransitionCount++; outgoingTransitionTreeMap.put(letter, newTargetNode); return newTargetNode; }
[ "public", "MDAGNode", "addOutgoingTransition", "(", "char", "letter", ",", "boolean", "targetAcceptStateStatus", ")", "{", "MDAGNode", "newTargetNode", "=", "new", "MDAGNode", "(", "targetAcceptStateStatus", ")", ";", "newTargetNode", ".", "incomingTransitionCount", "++...
新建一个转移目标<br> Creates an outgoing _transition labeled with a given char that has a new node as its target. @param letter a char representing the desired label of the _transition @param targetAcceptStateStatus a boolean representing to-be-created _transition target node's accept status @return the (newly created) MDAGNode that is the target of the created _transition
[ "新建一个转移目标<br", ">", "Creates", "an", "outgoing", "_transition", "labeled", "with", "a", "given", "char", "that", "has", "a", "new", "node", "as", "its", "target", "." ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/MDAG/MDAGNode.java#L406-L413
sagiegurari/fax4j
src/main/java/org/fax4j/FaxClientFactory.java
FaxClientFactory.createFaxClient
public static FaxClient createFaxClient(String type,Properties configuration) { return FaxClientFactory.createFaxClientImpl(type,configuration); }
java
public static FaxClient createFaxClient(String type,Properties configuration) { return FaxClientFactory.createFaxClientImpl(type,configuration); }
[ "public", "static", "FaxClient", "createFaxClient", "(", "String", "type", ",", "Properties", "configuration", ")", "{", "return", "FaxClientFactory", ".", "createFaxClientImpl", "(", "type", ",", "configuration", ")", ";", "}" ]
This function creates a new fax client based on the provided configuration. @param type The fax client type (may be null for default type) @param configuration The fax client configuration (may be null) @return The fax client instance
[ "This", "function", "creates", "a", "new", "fax", "client", "based", "on", "the", "provided", "configuration", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/FaxClientFactory.java#L174-L177
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java
SARLQuickfixProvider.fixInvalidFiringEventType
@Fix(io.sarl.lang.validation.IssueCodes.INVALID_FIRING_EVENT_TYPE) public void fixInvalidFiringEventType(final Issue issue, IssueResolutionAcceptor acceptor) { FiredEventRemoveModification.accept(this, issue, acceptor); }
java
@Fix(io.sarl.lang.validation.IssueCodes.INVALID_FIRING_EVENT_TYPE) public void fixInvalidFiringEventType(final Issue issue, IssueResolutionAcceptor acceptor) { FiredEventRemoveModification.accept(this, issue, acceptor); }
[ "@", "Fix", "(", "io", ".", "sarl", ".", "lang", ".", "validation", ".", "IssueCodes", ".", "INVALID_FIRING_EVENT_TYPE", ")", "public", "void", "fixInvalidFiringEventType", "(", "final", "Issue", "issue", ",", "IssueResolutionAcceptor", "acceptor", ")", "{", "Fi...
Quick fix for "Invalid firing event type". @param issue the issue. @param acceptor the quick fix acceptor.
[ "Quick", "fix", "for", "Invalid", "firing", "event", "type", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L795-L798
mapbox/mapbox-plugins-android
plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/OfflineRegionSelector.java
OfflineRegionSelector.getOfflineDownloadOptions
public static OfflineDownloadOptions getOfflineDownloadOptions(final Intent data, byte[] metadata) { return OfflineDownloadOptions.builder() .definition(getRegionDefinition(data)) .regionName(getRegionName(data)) .metadata(metadata) .build(); }
java
public static OfflineDownloadOptions getOfflineDownloadOptions(final Intent data, byte[] metadata) { return OfflineDownloadOptions.builder() .definition(getRegionDefinition(data)) .regionName(getRegionName(data)) .metadata(metadata) .build(); }
[ "public", "static", "OfflineDownloadOptions", "getOfflineDownloadOptions", "(", "final", "Intent", "data", ",", "byte", "[", "]", "metadata", ")", "{", "return", "OfflineDownloadOptions", ".", "builder", "(", ")", ".", "definition", "(", "getRegionDefinition", "(", ...
Use this method to take the returning {@link Intent} data and construct a {@link OfflineDownloadOptions} instance which can be used for starting a new offline region download. @param data the {@link Activity#startActivityForResult(Intent, int)} which this method should be used in provides the returning intent which should be provided in this param @param metadata Add additional metadata to the {@link OfflineRegionDefinition}, note to make sure not to override the region definition name if you still wish to use it @return a new {@link OfflineDownloadOptions} instance which can be used to launch the download service using {@link com.mapbox.mapboxsdk.plugins.offline.offline.OfflinePlugin#startDownload(OfflineDownloadOptions)} @since 0.1.0
[ "Use", "this", "method", "to", "take", "the", "returning", "{", "@link", "Intent", "}", "data", "and", "construct", "a", "{", "@link", "OfflineDownloadOptions", "}", "instance", "which", "can", "be", "used", "for", "starting", "a", "new", "offline", "region"...
train
https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/OfflineRegionSelector.java#L61-L67
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/AbstractJobLauncher.java
AbstractJobLauncher.prepareWorkUnits
private WorkUnitStream prepareWorkUnits(WorkUnitStream workUnits, JobState jobState) { return workUnits.transform(new WorkUnitPreparator(this.jobContext.getJobId())); }
java
private WorkUnitStream prepareWorkUnits(WorkUnitStream workUnits, JobState jobState) { return workUnits.transform(new WorkUnitPreparator(this.jobContext.getJobId())); }
[ "private", "WorkUnitStream", "prepareWorkUnits", "(", "WorkUnitStream", "workUnits", ",", "JobState", "jobState", ")", "{", "return", "workUnits", ".", "transform", "(", "new", "WorkUnitPreparator", "(", "this", ".", "jobContext", ".", "getJobId", "(", ")", ")", ...
Prepare the flattened {@link WorkUnit}s for execution by populating the job and task IDs.
[ "Prepare", "the", "flattened", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/AbstractJobLauncher.java#L699-L701
lucee/Lucee
core/src/main/java/lucee/runtime/interpreter/CFMLExpressionInterpreter.java
CFMLExpressionInterpreter.andOp
private Ref andOp() throws PageException { Ref ref = notOp(); while (cfml.isValidIndex() && (cfml.forwardIfCurrent("&&") || cfml.forwardIfCurrent("and"))) { cfml.removeSpace(); ref = new And(ref, notOp(), limited); } return ref; }
java
private Ref andOp() throws PageException { Ref ref = notOp(); while (cfml.isValidIndex() && (cfml.forwardIfCurrent("&&") || cfml.forwardIfCurrent("and"))) { cfml.removeSpace(); ref = new And(ref, notOp(), limited); } return ref; }
[ "private", "Ref", "andOp", "(", ")", "throws", "PageException", "{", "Ref", "ref", "=", "notOp", "(", ")", ";", "while", "(", "cfml", ".", "isValidIndex", "(", ")", "&&", "(", "cfml", ".", "forwardIfCurrent", "(", "\"&&\"", ")", "||", "cfml", ".", "f...
Transfomiert eine And (and) Operation. Im Gegensatz zu CFMX , werden "&&" Zeichen auch als And Operatoren anerkannt. <br /> EBNF:<br /> <code>notOp {("and" | "&&") spaces notOp}; (* "&&" Existiert in CFMX nicht *)</code> @return CFXD Element @throws PageException
[ "Transfomiert", "eine", "And", "(", "and", ")", "Operation", ".", "Im", "Gegensatz", "zu", "CFMX", "werden", "&&", "Zeichen", "auch", "als", "And", "Operatoren", "anerkannt", ".", "<br", "/", ">", "EBNF", ":", "<br", "/", ">", "<code", ">", "notOp", "{...
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/interpreter/CFMLExpressionInterpreter.java#L416-L423
groupon/odo
client/src/main/java/com/groupon/odo/client/PathValueClient.java
PathValueClient.removeDefaultCustomResponse
public static boolean removeDefaultCustomResponse(String pathValue, String requestType) { try { JSONObject profile = getDefaultProfile(); String profileName = profile.getString("name"); PathValueClient client = new PathValueClient(profileName, false); return client.removeCustomResponse(pathValue, requestType); } catch (Exception e) { e.printStackTrace(); } return false; }
java
public static boolean removeDefaultCustomResponse(String pathValue, String requestType) { try { JSONObject profile = getDefaultProfile(); String profileName = profile.getString("name"); PathValueClient client = new PathValueClient(profileName, false); return client.removeCustomResponse(pathValue, requestType); } catch (Exception e) { e.printStackTrace(); } return false; }
[ "public", "static", "boolean", "removeDefaultCustomResponse", "(", "String", "pathValue", ",", "String", "requestType", ")", "{", "try", "{", "JSONObject", "profile", "=", "getDefaultProfile", "(", ")", ";", "String", "profileName", "=", "profile", ".", "getString...
Remove any overrides for an endpoint on the default profile, client @param pathValue path (endpoint) value @param requestType path request type. "GET", "POST", etc @return true if success, false otherwise
[ "Remove", "any", "overrides", "for", "an", "endpoint", "on", "the", "default", "profile", "client" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/client/src/main/java/com/groupon/odo/client/PathValueClient.java#L84-L94
m-m-m/util
gwt/src/main/resources/net/sf/mmm/util/gwt/supersource/net/sf/mmm/util/exception/api/NlsRuntimeException.java
NlsRuntimeException.printStackTraceCause
private static void printStackTraceCause(Throwable nested, Locale locale, Appendable buffer) throws IOException { if (nested instanceof NlsThrowable) { ((NlsThrowable) nested).printStackTrace(locale, buffer); } else { for (StackTraceElement element : nested.getStackTrace()) { buffer.append("\tat "); buffer.append(element.toString()); buffer.append('\n'); } Throwable cause = nested.getCause(); if (cause != null) { buffer.append("Caused by: "); buffer.append('\n'); printStackTraceCause(cause, locale, buffer); } } }
java
private static void printStackTraceCause(Throwable nested, Locale locale, Appendable buffer) throws IOException { if (nested instanceof NlsThrowable) { ((NlsThrowable) nested).printStackTrace(locale, buffer); } else { for (StackTraceElement element : nested.getStackTrace()) { buffer.append("\tat "); buffer.append(element.toString()); buffer.append('\n'); } Throwable cause = nested.getCause(); if (cause != null) { buffer.append("Caused by: "); buffer.append('\n'); printStackTraceCause(cause, locale, buffer); } } }
[ "private", "static", "void", "printStackTraceCause", "(", "Throwable", "nested", ",", "Locale", "locale", ",", "Appendable", "buffer", ")", "throws", "IOException", "{", "if", "(", "nested", "instanceof", "NlsThrowable", ")", "{", "(", "(", "NlsThrowable", ")", ...
@see NlsThrowable#printStackTrace(Locale, Appendable) @param nested is the {@link Throwable} to print. @param locale is the {@link Locale} to translate to. @param buffer is where to write the stack trace to. @throws IOException if caused by {@code buffer}.
[ "@see", "NlsThrowable#printStackTrace", "(", "Locale", "Appendable", ")" ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/gwt/src/main/resources/net/sf/mmm/util/gwt/supersource/net/sf/mmm/util/exception/api/NlsRuntimeException.java#L184-L201
elki-project/elki
elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/CASH.java
CASH.runDerivator
private double[][] runDerivator(Relation<ParameterizationFunction> relation, int dim, CASHInterval interval, ModifiableDBIDs ids) { Database derivatorDB = buildDerivatorDB(relation, interval); PCARunner pca = new PCARunner(new StandardCovarianceMatrixBuilder()); EigenPairFilter filter = new FirstNEigenPairFilter(dim - 1); DependencyDerivator<DoubleVector> derivator = new DependencyDerivator<>(null, FormatUtil.NF4, pca, filter, 0, false); CorrelationAnalysisSolution<DoubleVector> model = derivator.run(derivatorDB); double[][] weightMatrix = model.getSimilarityMatrix(); double[] centroid = model.getCentroid(); double eps = .25; ids.addDBIDs(interval.getIDs()); // Search for nearby vectors in original database for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { double[] v = minusEquals(relation.get(iditer).getColumnVector(), centroid); double d = transposeTimesTimes(v, weightMatrix, v); if(d <= eps) { ids.add(iditer); } } double[][] basis = model.getStrongEigenvectors(); return getMatrix(basis, 0, basis.length, 0, dim - 1); }
java
private double[][] runDerivator(Relation<ParameterizationFunction> relation, int dim, CASHInterval interval, ModifiableDBIDs ids) { Database derivatorDB = buildDerivatorDB(relation, interval); PCARunner pca = new PCARunner(new StandardCovarianceMatrixBuilder()); EigenPairFilter filter = new FirstNEigenPairFilter(dim - 1); DependencyDerivator<DoubleVector> derivator = new DependencyDerivator<>(null, FormatUtil.NF4, pca, filter, 0, false); CorrelationAnalysisSolution<DoubleVector> model = derivator.run(derivatorDB); double[][] weightMatrix = model.getSimilarityMatrix(); double[] centroid = model.getCentroid(); double eps = .25; ids.addDBIDs(interval.getIDs()); // Search for nearby vectors in original database for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { double[] v = minusEquals(relation.get(iditer).getColumnVector(), centroid); double d = transposeTimesTimes(v, weightMatrix, v); if(d <= eps) { ids.add(iditer); } } double[][] basis = model.getStrongEigenvectors(); return getMatrix(basis, 0, basis.length, 0, dim - 1); }
[ "private", "double", "[", "]", "[", "]", "runDerivator", "(", "Relation", "<", "ParameterizationFunction", ">", "relation", ",", "int", "dim", ",", "CASHInterval", "interval", ",", "ModifiableDBIDs", "ids", ")", "{", "Database", "derivatorDB", "=", "buildDerivat...
Runs the derivator on the specified interval and assigns all points having a distance less then the standard deviation of the derivator model to the model to this model. @param relation the database containing the parameterization functions @param interval the interval to build the model @param dim the dimensionality of the database @param ids an empty set to assign the ids @return a basis of the found subspace
[ "Runs", "the", "derivator", "on", "the", "specified", "interval", "and", "assigns", "all", "points", "having", "a", "distance", "less", "then", "the", "standard", "deviation", "of", "the", "derivator", "model", "to", "the", "model", "to", "this", "model", "....
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/CASH.java#L625-L650
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/application/NavigationHandlerImpl.java
NavigationHandlerImpl.getNavigationCase
public NavigationCase getNavigationCase(FacesContext facesContext, String fromAction, String outcome) { NavigationContext navigationContext = new NavigationContext(); try { return getNavigationCommand(facesContext, navigationContext, fromAction, outcome, null); } finally { navigationContext.finish(facesContext); } }
java
public NavigationCase getNavigationCase(FacesContext facesContext, String fromAction, String outcome) { NavigationContext navigationContext = new NavigationContext(); try { return getNavigationCommand(facesContext, navigationContext, fromAction, outcome, null); } finally { navigationContext.finish(facesContext); } }
[ "public", "NavigationCase", "getNavigationCase", "(", "FacesContext", "facesContext", ",", "String", "fromAction", ",", "String", "outcome", ")", "{", "NavigationContext", "navigationContext", "=", "new", "NavigationContext", "(", ")", ";", "try", "{", "return", "ge...
Returns the navigation case that applies for the given action and outcome
[ "Returns", "the", "navigation", "case", "that", "applies", "for", "the", "given", "action", "and", "outcome" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/application/NavigationHandlerImpl.java#L389-L400
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/metadata/Utils.java
Utils.compareInstance
public static <T> boolean compareInstance(T t1, T t2) { if (t1 == t2) { return true; } if (t1 != null && t2 != null && t1.equals(t2)) { return true; } return false; }
java
public static <T> boolean compareInstance(T t1, T t2) { if (t1 == t2) { return true; } if (t1 != null && t2 != null && t1.equals(t2)) { return true; } return false; }
[ "public", "static", "<", "T", ">", "boolean", "compareInstance", "(", "T", "t1", ",", "T", "t2", ")", "{", "if", "(", "t1", "==", "t2", ")", "{", "return", "true", ";", "}", "if", "(", "t1", "!=", "null", "&&", "t2", "!=", "null", "&&", "t1", ...
Compare tow instance. If both are null, still equal @param t1 @param t2 @return
[ "Compare", "tow", "instance", ".", "If", "both", "are", "null", "still", "equal" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/metadata/Utils.java#L28-L37
Netflix/servo
servo-core/src/main/java/com/netflix/servo/tag/BasicTagList.java
BasicTagList.copy
public BasicTagList copy(String key, String value) { return concat(this, Tags.newTag(key, value)); }
java
public BasicTagList copy(String key, String value) { return concat(this, Tags.newTag(key, value)); }
[ "public", "BasicTagList", "copy", "(", "String", "key", ",", "String", "value", ")", "{", "return", "concat", "(", "this", ",", "Tags", ".", "newTag", "(", "key", ",", "value", ")", ")", ";", "}" ]
Returns a new tag list with an additional tag. If {@code key} is already present in this tag list the value will be overwritten with {@code value}.
[ "Returns", "a", "new", "tag", "list", "with", "an", "additional", "tag", ".", "If", "{" ]
train
https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/tag/BasicTagList.java#L132-L134
apache/incubator-gobblin
gobblin-compaction/src/main/java/org/apache/gobblin/compaction/dataset/SimpleDatasetsFinder.java
SimpleDatasetsFinder.findDistinctDatasets
@Override public Set<Dataset> findDistinctDatasets() throws IOException { Set<Dataset> datasets = Sets.newHashSet(); Path inputPath = new Path(this.inputDir); Path inputLatePath = new Path(inputPath, MRCompactor.COMPACTION_LATE_DIR_SUFFIX); Path outputPath = new Path(this.destDir); Path outputLatePath = new Path(outputPath, MRCompactor.COMPACTION_LATE_DIR_SUFFIX); Dataset dataset = new Dataset.Builder().withPriority(this.getDatasetPriority(inputPath.getName())) .addInputPath(this.recompactDatasets ? outputPath : inputPath) .addInputLatePath(this.recompactDatasets ? outputLatePath : inputLatePath).withOutputPath(outputPath) .withOutputLatePath(outputLatePath).withOutputTmpPath(new Path(this.tmpOutputDir)).build(); datasets.add(dataset); return datasets; }
java
@Override public Set<Dataset> findDistinctDatasets() throws IOException { Set<Dataset> datasets = Sets.newHashSet(); Path inputPath = new Path(this.inputDir); Path inputLatePath = new Path(inputPath, MRCompactor.COMPACTION_LATE_DIR_SUFFIX); Path outputPath = new Path(this.destDir); Path outputLatePath = new Path(outputPath, MRCompactor.COMPACTION_LATE_DIR_SUFFIX); Dataset dataset = new Dataset.Builder().withPriority(this.getDatasetPriority(inputPath.getName())) .addInputPath(this.recompactDatasets ? outputPath : inputPath) .addInputLatePath(this.recompactDatasets ? outputLatePath : inputLatePath).withOutputPath(outputPath) .withOutputLatePath(outputLatePath).withOutputTmpPath(new Path(this.tmpOutputDir)).build(); datasets.add(dataset); return datasets; }
[ "@", "Override", "public", "Set", "<", "Dataset", ">", "findDistinctDatasets", "(", ")", "throws", "IOException", "{", "Set", "<", "Dataset", ">", "datasets", "=", "Sets", ".", "newHashSet", "(", ")", ";", "Path", "inputPath", "=", "new", "Path", "(", "t...
Create a dataset using {@link #inputDir} and {@link #destDir}. Set dataset input path to be {@link #destDir} if {@link #recompactDatasets} is true.
[ "Create", "a", "dataset", "using", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-compaction/src/main/java/org/apache/gobblin/compaction/dataset/SimpleDatasetsFinder.java#L45-L59
opsbears/owc-dic
src/main/java/com/opsbears/webcomponents/dic/InjectorConfiguration.java
InjectorConfiguration.withFactory
public <T> InjectorConfiguration withFactory( Class<T> classDefinition, Provider<T> factory ) { if (classDefinition.equals(Injector.class)) { throw new DependencyInjectionFailedException("Cowardly refusing to define a global factory for Injector since that would lead to a Service Locator pattern. If you need the injector, please define it on a per-class or per-method basis."); } //noinspection unchecked return new InjectorConfiguration( scopes, definedClasses, factories.withModified((value) -> value.with(classDefinition, factory)), factoryClasses, sharedClasses, sharedInstances, aliases, collectedAliases, namedParameterValues ); }
java
public <T> InjectorConfiguration withFactory( Class<T> classDefinition, Provider<T> factory ) { if (classDefinition.equals(Injector.class)) { throw new DependencyInjectionFailedException("Cowardly refusing to define a global factory for Injector since that would lead to a Service Locator pattern. If you need the injector, please define it on a per-class or per-method basis."); } //noinspection unchecked return new InjectorConfiguration( scopes, definedClasses, factories.withModified((value) -> value.with(classDefinition, factory)), factoryClasses, sharedClasses, sharedInstances, aliases, collectedAliases, namedParameterValues ); }
[ "public", "<", "T", ">", "InjectorConfiguration", "withFactory", "(", "Class", "<", "T", ">", "classDefinition", ",", "Provider", "<", "T", ">", "factory", ")", "{", "if", "(", "classDefinition", ".", "equals", "(", "Injector", ".", "class", ")", ")", "{...
Specify that the given class should be created using the factory instance specified. @param classDefinition the class that should be produced using a factory. @param factory the factory class that creates the class definition @param <T> type of the class @return a modified copy of this injection configuration.
[ "Specify", "that", "the", "given", "class", "should", "be", "created", "using", "the", "factory", "instance", "specified", "." ]
train
https://github.com/opsbears/owc-dic/blob/eb254ca993b26c299292a01598b358a31f323566/src/main/java/com/opsbears/webcomponents/dic/InjectorConfiguration.java#L270-L288
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getContinentSectorInfo
public void getContinentSectorInfo(int continentID, int floorID, int regionID, int mapID, int[] ids, Callback<List<ContinentMap.Sector>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getContinentSectorInfo(Integer.toString(continentID), Integer.toString(floorID), Integer.toString(regionID), Integer.toString(mapID), processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
java
public void getContinentSectorInfo(int continentID, int floorID, int regionID, int mapID, int[] ids, Callback<List<ContinentMap.Sector>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getContinentSectorInfo(Integer.toString(continentID), Integer.toString(floorID), Integer.toString(regionID), Integer.toString(mapID), processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
[ "public", "void", "getContinentSectorInfo", "(", "int", "continentID", ",", "int", "floorID", ",", "int", "regionID", ",", "int", "mapID", ",", "int", "[", "]", "ids", ",", "Callback", "<", "List", "<", "ContinentMap", ".", "Sector", ">", ">", "callback", ...
For more info on continents API go <a href="https://wiki.guildwars2.com/wiki/API:2/continents">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param continentID {@link Continent#id} @param floorID {@link ContinentFloor#id} @param regionID {@link ContinentRegion#id} @param mapID {@link ContinentMap#id} @param ids list of region map sector id @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception empty ID list @throws NullPointerException if given {@link Callback} is empty @see ContinentMap.Sector continents map sector info
[ "For", "more", "info", "on", "continents", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "continents", ">", "here<", "/", "a", ">", "<br", "/", ">", "Give", "use...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1160-L1163
line/armeria
core/src/main/java/com/linecorp/armeria/internal/annotation/AnnotatedElementNameUtil.java
AnnotatedElementNameUtil.findName
static String findName(Param param, Object nameRetrievalTarget) { requireNonNull(nameRetrievalTarget, "nameRetrievalTarget"); final String value = param.value(); if (DefaultValues.isSpecified(value)) { checkArgument(!value.isEmpty(), "value is empty"); return value; } return getName(nameRetrievalTarget); }
java
static String findName(Param param, Object nameRetrievalTarget) { requireNonNull(nameRetrievalTarget, "nameRetrievalTarget"); final String value = param.value(); if (DefaultValues.isSpecified(value)) { checkArgument(!value.isEmpty(), "value is empty"); return value; } return getName(nameRetrievalTarget); }
[ "static", "String", "findName", "(", "Param", "param", ",", "Object", "nameRetrievalTarget", ")", "{", "requireNonNull", "(", "nameRetrievalTarget", ",", "\"nameRetrievalTarget\"", ")", ";", "final", "String", "value", "=", "param", ".", "value", "(", ")", ";", ...
Returns the value of the {@link Param} annotation which is specified on the {@code element} if the value is not blank. If the value is blank, it returns the name of the specified {@code nameRetrievalTarget} object which is an instance of {@link Parameter} or {@link Field}.
[ "Returns", "the", "value", "of", "the", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/internal/annotation/AnnotatedElementNameUtil.java#L39-L48
kaazing/gateway
service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/HttpDirectoryService.java
HttpDirectoryService.buildPatternsList
private List<PatternCacheControl> buildPatternsList(ServiceProperties properties) { Map<String, PatternCacheControl> patterns = new LinkedHashMap<>(); List<ServiceProperties> locationsList = properties.getNested("location"); if (locationsList != null && locationsList.size() != 0) { for (ServiceProperties location : locationsList) { String directiveList = location.get("cache-control"); String[] patternList = location.get("patterns").split("\\s+"); for (String pattern : patternList) { patterns.put(pattern, new PatternCacheControl(pattern, directiveList)); } } resolvePatternSpecificity(patterns); return sortByMatchingPatternCount(patterns); } return new ArrayList<>(patterns.values()); }
java
private List<PatternCacheControl> buildPatternsList(ServiceProperties properties) { Map<String, PatternCacheControl> patterns = new LinkedHashMap<>(); List<ServiceProperties> locationsList = properties.getNested("location"); if (locationsList != null && locationsList.size() != 0) { for (ServiceProperties location : locationsList) { String directiveList = location.get("cache-control"); String[] patternList = location.get("patterns").split("\\s+"); for (String pattern : patternList) { patterns.put(pattern, new PatternCacheControl(pattern, directiveList)); } } resolvePatternSpecificity(patterns); return sortByMatchingPatternCount(patterns); } return new ArrayList<>(patterns.values()); }
[ "private", "List", "<", "PatternCacheControl", ">", "buildPatternsList", "(", "ServiceProperties", "properties", ")", "{", "Map", "<", "String", ",", "PatternCacheControl", ">", "patterns", "=", "new", "LinkedHashMap", "<>", "(", ")", ";", "List", "<", "ServiceP...
Creates the list of PatternCacheControl objects @param properties - list of ServiceProperties from the configuration file @return a list of PatternCacheControl objects
[ "Creates", "the", "list", "of", "PatternCacheControl", "objects" ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/HttpDirectoryService.java#L134-L149
EdwardRaff/JSAT
JSAT/src/jsat/linear/RowColumnOps.java
RowColumnOps.multRow
public static void multRow(Matrix A, int i, double[] c) { if(A.cols() != c.length) throw new ArithmeticException("Can not perform row update, length miss match " + A.cols() + " and " + c.length); multRow(A, i, 0, c.length, c); }
java
public static void multRow(Matrix A, int i, double[] c) { if(A.cols() != c.length) throw new ArithmeticException("Can not perform row update, length miss match " + A.cols() + " and " + c.length); multRow(A, i, 0, c.length, c); }
[ "public", "static", "void", "multRow", "(", "Matrix", "A", ",", "int", "i", ",", "double", "[", "]", "c", ")", "{", "if", "(", "A", ".", "cols", "(", ")", "!=", "c", ".", "length", ")", "throw", "new", "ArithmeticException", "(", "\"Can not perform r...
Updates the values of row <tt>i</tt> in the given matrix to be A[i,:] = A[i,:] .* c[i] @param A the matrix to perform he update on @param i the row to update @param c the array of values to multiple the elements of <tt>A</tt> by
[ "Updates", "the", "values", "of", "row", "<tt", ">", "i<", "/", "tt", ">", "in", "the", "given", "matrix", "to", "be", "A", "[", "i", ":", "]", "=", "A", "[", "i", ":", "]", ".", "*", "c", "[", "i", "]" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/RowColumnOps.java#L134-L139
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/Maps.java
Maps.putIntoValueCollection
public static <K, V, C extends Collection<V>> void putIntoValueCollection(Map<K, C> map, K key, V value, CollectionFactory<V> cf) { C c = map.get(key); if (c == null) { c = ErasureUtils.<C>uncheckedCast(cf.newCollection()); map.put(key, c); } c.add(value); }
java
public static <K, V, C extends Collection<V>> void putIntoValueCollection(Map<K, C> map, K key, V value, CollectionFactory<V> cf) { C c = map.get(key); if (c == null) { c = ErasureUtils.<C>uncheckedCast(cf.newCollection()); map.put(key, c); } c.add(value); }
[ "public", "static", "<", "K", ",", "V", ",", "C", "extends", "Collection", "<", "V", ">", ">", "void", "putIntoValueCollection", "(", "Map", "<", "K", ",", "C", ">", "map", ",", "K", "key", ",", "V", "value", ",", "CollectionFactory", "<", "V", ">"...
Adds the value to the collection given by map.get(key). A new collection is created using the supplied CollectionFactory.
[ "Adds", "the", "value", "to", "the", "collection", "given", "by", "map", ".", "get", "(", "key", ")", ".", "A", "new", "collection", "is", "created", "using", "the", "supplied", "CollectionFactory", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/Maps.java#L43-L50
baratine/baratine
framework/src/main/java/com/caucho/v5/bartender/pod/PodsManagerConfigImpl.java
PodsManagerConfigImpl.parseConfigFile
private void parseConfigFile(PodsConfig podsConfig, String path) { String configDir = "/config/pods"; PathImpl configPath = VfsOld.lookup("bfs://" + configDir + "/" + path); /* ConfigContext config = new ConfigContext(); try { podsConfig.setCurrentDepend(new Depend(configPath)); config.configure2(podsConfig, configPath); } catch (Exception e) { e.printStackTrace(); log.warning(e.toString()); podsConfig.setConfigException(e); } */ }
java
private void parseConfigFile(PodsConfig podsConfig, String path) { String configDir = "/config/pods"; PathImpl configPath = VfsOld.lookup("bfs://" + configDir + "/" + path); /* ConfigContext config = new ConfigContext(); try { podsConfig.setCurrentDepend(new Depend(configPath)); config.configure2(podsConfig, configPath); } catch (Exception e) { e.printStackTrace(); log.warning(e.toString()); podsConfig.setConfigException(e); } */ }
[ "private", "void", "parseConfigFile", "(", "PodsConfig", "podsConfig", ",", "String", "path", ")", "{", "String", "configDir", "=", "\"/config/pods\"", ";", "PathImpl", "configPath", "=", "VfsOld", ".", "lookup", "(", "\"bfs://\"", "+", "configDir", "+", "\"/\""...
/* Parse the /config/pods/foo.cf configuration file. The configuration is merged with the running PodsConfig.
[ "/", "*", "Parse", "the", "/", "config", "/", "pods", "/", "foo", ".", "cf", "configuration", "file", ".", "The", "configuration", "is", "merged", "with", "the", "running", "PodsConfig", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/pod/PodsManagerConfigImpl.java#L345-L365
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/StreamTokenizer.java
StreamTokenizer.whitespaceChars
public void whitespaceChars(int low, int hi) { if (low < 0) { low = 0; } if (hi > tokenTypes.length) { hi = tokenTypes.length - 1; } for (int i = low; i <= hi; i++) { tokenTypes[i] = TOKEN_WHITE; } }
java
public void whitespaceChars(int low, int hi) { if (low < 0) { low = 0; } if (hi > tokenTypes.length) { hi = tokenTypes.length - 1; } for (int i = low; i <= hi; i++) { tokenTypes[i] = TOKEN_WHITE; } }
[ "public", "void", "whitespaceChars", "(", "int", "low", ",", "int", "hi", ")", "{", "if", "(", "low", "<", "0", ")", "{", "low", "=", "0", ";", "}", "if", "(", "hi", ">", "tokenTypes", ".", "length", ")", "{", "hi", "=", "tokenTypes", ".", "len...
Specifies that the characters in the range from {@code low} to {@code hi} shall be treated as whitespace characters by this tokenizer. @param low the first character in the range of whitespace characters. @param hi the last character in the range of whitespace characters.
[ "Specifies", "that", "the", "characters", "in", "the", "range", "from", "{", "@code", "low", "}", "to", "{", "@code", "hi", "}", "shall", "be", "treated", "as", "whitespace", "characters", "by", "this", "tokenizer", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/StreamTokenizer.java#L642-L652
ReactiveX/RxJavaAsyncUtil
src/main/java/rx/util/async/Async.java
Async.asyncFunc
public static <R> FuncN<Observable<R>> asyncFunc(final FuncN<? extends R> func, final Scheduler scheduler) { return toAsync(func, scheduler); }
java
public static <R> FuncN<Observable<R>> asyncFunc(final FuncN<? extends R> func, final Scheduler scheduler) { return toAsync(func, scheduler); }
[ "public", "static", "<", "R", ">", "FuncN", "<", "Observable", "<", "R", ">", ">", "asyncFunc", "(", "final", "FuncN", "<", "?", "extends", "R", ">", "func", ",", "final", "Scheduler", "scheduler", ")", "{", "return", "toAsync", "(", "func", ",", "sc...
Convert a synchronous function call into an asynchronous function call through an Observable. <p> <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/asyncFunc.s.png" alt=""> <p> Alias for {@code toAsync(FuncN, Scheduler)} intended for dynamic languages. @param <R> the result type @param func the function to convert @param scheduler the Scheduler used to call the {@code func} @return a function that returns an Observable that executes the {@code func} and emits its returned value @see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: asyncFunc()</a>
[ "Convert", "a", "synchronous", "function", "call", "into", "an", "asynchronous", "function", "call", "through", "an", "Observable", ".", "<p", ">", "<img", "width", "=", "640", "src", "=", "https", ":", "//", "raw", ".", "github", ".", "com", "/", "wiki"...
train
https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L1748-L1750
blackfizz/EazeGraph
EazeGraphLibrary/src/main/java/org/eazegraph/lib/utils/Utils.java
Utils.intersectsPointWithRectF
public static boolean intersectsPointWithRectF(RectF _Rect, float _X, float _Y) { return _X > _Rect.left && _X < _Rect.right && _Y > _Rect.top && _Y < _Rect.bottom; }
java
public static boolean intersectsPointWithRectF(RectF _Rect, float _X, float _Y) { return _X > _Rect.left && _X < _Rect.right && _Y > _Rect.top && _Y < _Rect.bottom; }
[ "public", "static", "boolean", "intersectsPointWithRectF", "(", "RectF", "_Rect", ",", "float", "_X", ",", "float", "_Y", ")", "{", "return", "_X", ">", "_Rect", ".", "left", "&&", "_X", "<", "_Rect", ".", "right", "&&", "_Y", ">", "_Rect", ".", "top",...
Checks if a point is in the given rectangle. @param _Rect rectangle which is checked @param _X x-coordinate of the point @param _Y y-coordinate of the point @return True if the points intersects with the rectangle.
[ "Checks", "if", "a", "point", "is", "in", "the", "given", "rectangle", "." ]
train
https://github.com/blackfizz/EazeGraph/blob/ce5e68ecc70e154f83bbb2fcce1a970db125c1e6/EazeGraphLibrary/src/main/java/org/eazegraph/lib/utils/Utils.java#L180-L182
eurekaclinical/javautil
src/main/java/org/arp/javautil/sql/DatabaseMetaDataWrapper.java
DatabaseMetaDataWrapper.isDatabaseCompatible
public boolean isDatabaseCompatible(String databaseProductNameRegex, DatabaseVersion minVersion, DatabaseVersion maxVersion) throws SQLException { readMetaDataIfNeeded(); if (!this.databaseProductName.matches(databaseProductNameRegex)) { return false; } return new VersionRange(minVersion, maxVersion).isWithinRange(this.databaseVersion); }
java
public boolean isDatabaseCompatible(String databaseProductNameRegex, DatabaseVersion minVersion, DatabaseVersion maxVersion) throws SQLException { readMetaDataIfNeeded(); if (!this.databaseProductName.matches(databaseProductNameRegex)) { return false; } return new VersionRange(minVersion, maxVersion).isWithinRange(this.databaseVersion); }
[ "public", "boolean", "isDatabaseCompatible", "(", "String", "databaseProductNameRegex", ",", "DatabaseVersion", "minVersion", ",", "DatabaseVersion", "maxVersion", ")", "throws", "SQLException", "{", "readMetaDataIfNeeded", "(", ")", ";", "if", "(", "!", "this", ".", ...
Compares database product name and version information to that reported by the database. @param databaseProductNameRegex a regular expression that the actual database product name will match. Use a regular expression that is unlikely to overlap with the product names of other database systems. @param minVersion the expected minimum version, if any. @param maxVersion the expected maximum version, if any. @return whether the actual database product name and version match the provided arguments. The database product name comparison checks whether the actual database product name matches the provided database product name regular expression. The min and max version comparisons are inclusive. @throws SQLException if an error occurs fetching metadata containing the database product name and version from the database.
[ "Compares", "database", "product", "name", "and", "version", "information", "to", "that", "reported", "by", "the", "database", "." ]
train
https://github.com/eurekaclinical/javautil/blob/779bbc5bf096c75f8eed4f99ca45b99c1d44df43/src/main/java/org/arp/javautil/sql/DatabaseMetaDataWrapper.java#L72-L79
wildfly/wildfly-build-tools
provisioning/src/main/java/org/wildfly/build/provisioning/model/ServerProvisioningFeaturePack.java
ServerProvisioningFeaturePack.createConfigFiles
private static List<ConfigFile> createConfigFiles(File featurePackFile, List<org.wildfly.build.common.model.ConfigFile> configFiles, ConfigOverride configOverride, Map<String, ConfigFileOverride> configFileOverrides) { final List<ConfigFile> result = new ArrayList<>(); if (configOverride != null) { if (configFileOverrides != null && !configFileOverrides.isEmpty()) { for (org.wildfly.build.common.model.ConfigFile featurePackConfigFile : configFiles) { ConfigFileOverride configFileOverride = configFileOverrides.get(featurePackConfigFile.getOutputFile()); if (configFileOverride != null) { result.add(new ConfigFile(featurePackFile, featurePackConfigFile, configFileOverride)); } } } } else { for (org.wildfly.build.common.model.ConfigFile featurePackConfigFile : configFiles) { result.add(new ConfigFile(featurePackFile, featurePackConfigFile, null)); } } return result; }
java
private static List<ConfigFile> createConfigFiles(File featurePackFile, List<org.wildfly.build.common.model.ConfigFile> configFiles, ConfigOverride configOverride, Map<String, ConfigFileOverride> configFileOverrides) { final List<ConfigFile> result = new ArrayList<>(); if (configOverride != null) { if (configFileOverrides != null && !configFileOverrides.isEmpty()) { for (org.wildfly.build.common.model.ConfigFile featurePackConfigFile : configFiles) { ConfigFileOverride configFileOverride = configFileOverrides.get(featurePackConfigFile.getOutputFile()); if (configFileOverride != null) { result.add(new ConfigFile(featurePackFile, featurePackConfigFile, configFileOverride)); } } } } else { for (org.wildfly.build.common.model.ConfigFile featurePackConfigFile : configFiles) { result.add(new ConfigFile(featurePackFile, featurePackConfigFile, null)); } } return result; }
[ "private", "static", "List", "<", "ConfigFile", ">", "createConfigFiles", "(", "File", "featurePackFile", ",", "List", "<", "org", ".", "wildfly", ".", "build", ".", "common", ".", "model", ".", "ConfigFile", ">", "configFiles", ",", "ConfigOverride", "configO...
Creates a provisioning config file for each {@link org.wildfly.build.common.model.ConfigFile} provided. @param featurePackFile @param configFiles @param configOverride @param configFileOverrides @return
[ "Creates", "a", "provisioning", "config", "file", "for", "each", "{" ]
train
https://github.com/wildfly/wildfly-build-tools/blob/520a5f2e58e6a24097d63fd65c51a8fc29847a61/provisioning/src/main/java/org/wildfly/build/provisioning/model/ServerProvisioningFeaturePack.java#L322-L339
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsManagedQueueConnectionFactoryImpl.java
JmsManagedQueueConnectionFactoryImpl.instantiateConnection
JmsConnectionImpl instantiateConnection(JmsJcaConnection jcaConnection, Map _passThruProps) throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "instantiateConnection", jcaConnection); JmsQueueConnectionImpl jmsQueueConnection = new JmsQueueConnectionImpl(jcaConnection, isManaged(), _passThruProps); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "instantiateConnection", jmsQueueConnection); return jmsQueueConnection; }
java
JmsConnectionImpl instantiateConnection(JmsJcaConnection jcaConnection, Map _passThruProps) throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "instantiateConnection", jcaConnection); JmsQueueConnectionImpl jmsQueueConnection = new JmsQueueConnectionImpl(jcaConnection, isManaged(), _passThruProps); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "instantiateConnection", jmsQueueConnection); return jmsQueueConnection; }
[ "JmsConnectionImpl", "instantiateConnection", "(", "JmsJcaConnection", "jcaConnection", ",", "Map", "_passThruProps", ")", "throws", "JMSException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ...
This overrides a superclass method, so that the superclass's createConnection() method can be inherited, but still return an object of this class's type.
[ "This", "overrides", "a", "superclass", "method", "so", "that", "the", "superclass", "s", "createConnection", "()", "method", "can", "be", "inherited", "but", "still", "return", "an", "object", "of", "this", "class", "s", "type", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsManagedQueueConnectionFactoryImpl.java#L76-L81
Metatavu/edelphi
edelphi/src/main/java/fi/metatavu/edelphi/utils/GoogleDriveUtils.java
GoogleDriveUtils.downloadFile
public static DownloadResponse downloadFile(Drive drive, String fileId) throws IOException { Get request = drive.files().get(fileId).setAlt("media"); String contentType = request.executeUsingHead().getContentType(); if (StringUtils.isNotBlank(contentType)) { try (InputStream inputStream = request.executeAsInputStream()) { return new DownloadResponse(contentType, IOUtils.toByteArray(inputStream)); } } return null; }
java
public static DownloadResponse downloadFile(Drive drive, String fileId) throws IOException { Get request = drive.files().get(fileId).setAlt("media"); String contentType = request.executeUsingHead().getContentType(); if (StringUtils.isNotBlank(contentType)) { try (InputStream inputStream = request.executeAsInputStream()) { return new DownloadResponse(contentType, IOUtils.toByteArray(inputStream)); } } return null; }
[ "public", "static", "DownloadResponse", "downloadFile", "(", "Drive", "drive", ",", "String", "fileId", ")", "throws", "IOException", "{", "Get", "request", "=", "drive", ".", "files", "(", ")", ".", "get", "(", "fileId", ")", ".", "setAlt", "(", "\"media\...
Downloads file from Google Drive @param drive drive client @param fileId file id for file to be downloaded @return file content @throws IOException an IOException
[ "Downloads", "file", "from", "Google", "Drive" ]
train
https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/utils/GoogleDriveUtils.java#L331-L341
joniles/mpxj
src/main/java/net/sf/mpxj/Resource.java
Resource.setEnterpriseDuration
public void setEnterpriseDuration(int index, Duration value) { set(selectField(ResourceFieldLists.ENTERPRISE_DURATION, index), value); }
java
public void setEnterpriseDuration(int index, Duration value) { set(selectField(ResourceFieldLists.ENTERPRISE_DURATION, index), value); }
[ "public", "void", "setEnterpriseDuration", "(", "int", "index", ",", "Duration", "value", ")", "{", "set", "(", "selectField", "(", "ResourceFieldLists", ".", "ENTERPRISE_DURATION", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set an enterprise field value. @param index field index @param value field value
[ "Set", "an", "enterprise", "field", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Resource.java#L2095-L2098
jenkinsci/java-client-api
jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsTriggerHelper.java
JenkinsTriggerHelper.triggerJobAndWaitUntilFinished
public BuildWithDetails triggerJobAndWaitUntilFinished(String jobName, boolean crumbFlag) throws IOException, InterruptedException { JobWithDetails job = this.server.getJob(jobName); QueueReference queueRef = job.build(crumbFlag); return triggerJobAndWaitUntilFinished(jobName, queueRef); }
java
public BuildWithDetails triggerJobAndWaitUntilFinished(String jobName, boolean crumbFlag) throws IOException, InterruptedException { JobWithDetails job = this.server.getJob(jobName); QueueReference queueRef = job.build(crumbFlag); return triggerJobAndWaitUntilFinished(jobName, queueRef); }
[ "public", "BuildWithDetails", "triggerJobAndWaitUntilFinished", "(", "String", "jobName", ",", "boolean", "crumbFlag", ")", "throws", "IOException", ",", "InterruptedException", "{", "JobWithDetails", "job", "=", "this", ".", "server", ".", "getJob", "(", "jobName", ...
This method will trigger a build of the given job and will wait until the builds is ended or if the build has been cancelled. @param jobName The name of the job which should be triggered. @param crumbFlag set to <code>true</code> or <code>false</code>. @return In case of an cancelled job you will get {@link BuildWithDetails#getResult()} {@link BuildResult#CANCELLED}. So you have to check first if the build result is {@code CANCELLED}. @throws IOException in case of errors. @throws InterruptedException In case of interrupts.
[ "This", "method", "will", "trigger", "a", "build", "of", "the", "given", "job", "and", "will", "wait", "until", "the", "builds", "is", "ended", "or", "if", "the", "build", "has", "been", "cancelled", "." ]
train
https://github.com/jenkinsci/java-client-api/blob/c4f5953d3d4dda92cd946ad3bf2b811524c32da9/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsTriggerHelper.java#L149-L155
Nexmo/nexmo-java
src/main/java/com/nexmo/client/legacyutils/XmlParser.java
XmlParser.parseXml
public Document parseXml(String xml) throws NexmoResponseParseException { // TODO: Maybe an Error subclass for XML initialization errors, as these are serious and unexpected. Document doc; this.documentBuilderLock.lock(); try { if (this.documentBuilder == null) { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); this.documentBuilder = documentBuilderFactory.newDocumentBuilder(); } doc = XmlUtil.parseXmlString(this.documentBuilder, xml); } catch (ParserConfigurationException e) { throw new NexmoResponseParseException("Exception initialing XML parser", e); } finally { this.documentBuilderLock.unlock(); } return doc; }
java
public Document parseXml(String xml) throws NexmoResponseParseException { // TODO: Maybe an Error subclass for XML initialization errors, as these are serious and unexpected. Document doc; this.documentBuilderLock.lock(); try { if (this.documentBuilder == null) { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); this.documentBuilder = documentBuilderFactory.newDocumentBuilder(); } doc = XmlUtil.parseXmlString(this.documentBuilder, xml); } catch (ParserConfigurationException e) { throw new NexmoResponseParseException("Exception initialing XML parser", e); } finally { this.documentBuilderLock.unlock(); } return doc; }
[ "public", "Document", "parseXml", "(", "String", "xml", ")", "throws", "NexmoResponseParseException", "{", "// TODO: Maybe an Error subclass for XML initialization errors, as these are serious and unexpected.", "Document", "doc", ";", "this", ".", "documentBuilderLock", ".", "loc...
Parse a provided XML String and return the generated DOM Document. @param xml A String containing XML. @return A Document generated from the parsed XML. @throws NexmoResponseParseException If there is a problem initializing the XML parser or parsing the XML.
[ "Parse", "a", "provided", "XML", "String", "and", "return", "the", "generated", "DOM", "Document", "." ]
train
https://github.com/Nexmo/nexmo-java/blob/7427eff6d6baa5a5bd9197fa096bcf2564191cf5/src/main/java/com/nexmo/client/legacyutils/XmlParser.java#L53-L69
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.deposit_depositId_paidBills_billId_debt_operation_operationId_GET
public OvhOperation deposit_depositId_paidBills_billId_debt_operation_operationId_GET(String depositId, String billId, Long operationId) throws IOException { String qPath = "/me/deposit/{depositId}/paidBills/{billId}/debt/operation/{operationId}"; StringBuilder sb = path(qPath, depositId, billId, operationId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOperation.class); }
java
public OvhOperation deposit_depositId_paidBills_billId_debt_operation_operationId_GET(String depositId, String billId, Long operationId) throws IOException { String qPath = "/me/deposit/{depositId}/paidBills/{billId}/debt/operation/{operationId}"; StringBuilder sb = path(qPath, depositId, billId, operationId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOperation.class); }
[ "public", "OvhOperation", "deposit_depositId_paidBills_billId_debt_operation_operationId_GET", "(", "String", "depositId", ",", "String", "billId", ",", "Long", "operationId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/deposit/{depositId}/paidBills/{billI...
Get this object properties REST: GET /me/deposit/{depositId}/paidBills/{billId}/debt/operation/{operationId} @param depositId [required] @param billId [required] @param operationId [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L3195-L3200
lessthanoptimal/ddogleg
src/org/ddogleg/nn/alg/searches/KdTreeSearch1Bbf.java
KdTreeSearch1Bbf.checkBestDistance
@Override protected void checkBestDistance(KdTree.Node node, P target) { double distanceSq = distance.distance((P)node.point,target); if( distanceSq <= bestDistanceSq ) { if( bestNode == null || distanceSq < bestDistanceSq ) { bestDistanceSq = distanceSq; bestNode = node; } } }
java
@Override protected void checkBestDistance(KdTree.Node node, P target) { double distanceSq = distance.distance((P)node.point,target); if( distanceSq <= bestDistanceSq ) { if( bestNode == null || distanceSq < bestDistanceSq ) { bestDistanceSq = distanceSq; bestNode = node; } } }
[ "@", "Override", "protected", "void", "checkBestDistance", "(", "KdTree", ".", "Node", "node", ",", "P", "target", ")", "{", "double", "distanceSq", "=", "distance", ".", "distance", "(", "(", "P", ")", "node", ".", "point", ",", "target", ")", ";", "i...
Checks to see if the current node's point is the closet point found so far
[ "Checks", "to", "see", "if", "the", "current", "node", "s", "point", "is", "the", "closet", "point", "found", "so", "far" ]
train
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/nn/alg/searches/KdTreeSearch1Bbf.java#L64-L73
svenkubiak/mangooio
mangooio-core/src/main/java/io/mangoo/routing/bindings/Form.java
Form.addValueList
public void addValueList(String key, String value) { Objects.requireNonNull(key, Required.KEY.toString()); if (!valueMap.containsKey(key)) { List<String> values = new ArrayList<>(); values.add(value); valueMap.put(key, values); } else { List<String> values = valueMap.get(key); values.add(value); valueMap.put(key, values); } }
java
public void addValueList(String key, String value) { Objects.requireNonNull(key, Required.KEY.toString()); if (!valueMap.containsKey(key)) { List<String> values = new ArrayList<>(); values.add(value); valueMap.put(key, values); } else { List<String> values = valueMap.get(key); values.add(value); valueMap.put(key, values); } }
[ "public", "void", "addValueList", "(", "String", "key", ",", "String", "value", ")", "{", "Objects", ".", "requireNonNull", "(", "key", ",", "Required", ".", "KEY", ".", "toString", "(", ")", ")", ";", "if", "(", "!", "valueMap", ".", "containsKey", "(...
Adds an additional item to the value list @param key The name of the form element @param value The value to store
[ "Adds", "an", "additional", "item", "to", "the", "value", "list" ]
train
https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Form.java#L188-L202
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/EmptyField.java
EmptyField.init
public void init(Record record, String strName, int iDataLength, String strDesc, Object strDefault) { super.init(record, Constants.BLANK, 0, Constants.BLANK, null); m_data = Constants.BLANK; }
java
public void init(Record record, String strName, int iDataLength, String strDesc, Object strDefault) { super.init(record, Constants.BLANK, 0, Constants.BLANK, null); m_data = Constants.BLANK; }
[ "public", "void", "init", "(", "Record", "record", ",", "String", "strName", ",", "int", "iDataLength", ",", "String", "strDesc", ",", "Object", "strDefault", ")", "{", "super", ".", "init", "(", "record", ",", "Constants", ".", "BLANK", ",", "0", ",", ...
Constructor. @param record The parent record. @param strName The field name. @param iDataLength The maximum string length (pass -1 for default). @param strDesc The string description (usually pass null, to use the resource file desc). @param strDefault The default value (if object, this value is the default value, if string, the string is the default).
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/EmptyField.java#L68-L72
threerings/gwt-utils
src/main/java/com/threerings/gwt/tools/I18nSync.java
I18nSync.processFile
@Deprecated // static methods suck. Create an instance and call the method on it. public static void processFile (File sourceDir, File propsFile) throws IOException { new I18nSync().process(sourceDir, propsFile); }
java
@Deprecated // static methods suck. Create an instance and call the method on it. public static void processFile (File sourceDir, File propsFile) throws IOException { new I18nSync().process(sourceDir, propsFile); }
[ "@", "Deprecated", "// static methods suck. Create an instance and call the method on it.", "public", "static", "void", "processFile", "(", "File", "sourceDir", ",", "File", "propsFile", ")", "throws", "IOException", "{", "new", "I18nSync", "(", ")", ".", "process", "("...
Converts a single i18n properties file to its corresponding source file. @param sourceDir the root of the source directory. Used to infer the package for the generated source given the path to the properties file and the root of the source directory. @param propsFile the properties file from which to generate a source file. Name must be of the form <code>X.properties</code> for any X.
[ "Converts", "a", "single", "i18n", "properties", "file", "to", "its", "corresponding", "source", "file", "." ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/tools/I18nSync.java#L77-L82
mediathekview/MServer
src/main/java/mServer/tool/M3U8Utils.java
M3U8Utils.gatherUrlsFromWdrM3U8
public static Map<Qualities, String> gatherUrlsFromWdrM3U8(String aWDRM3U8Url) { Map<Qualities, String> urlAndQualities = new EnumMap<>(Qualities.class); if (aWDRM3U8Url.contains(M3U8_WDR_URL_BEGIN) || aWDRM3U8Url.contains(M3U8_WDR_URL_ALTERNATIV_BEGIN)) { String m3u8Url = aWDRM3U8Url.replaceAll(REGEX_ALL_BEFORE_PATTERN+M3U8_WDR_URL_BEGIN, "").replaceAll(REGEX_ALL_BEFORE_PATTERN+M3U8_WDR_URL_ALTERNATIV_BEGIN, ""); urlAndQualities.putAll(convertM3U8Url(m3u8Url)); } return urlAndQualities; }
java
public static Map<Qualities, String> gatherUrlsFromWdrM3U8(String aWDRM3U8Url) { Map<Qualities, String> urlAndQualities = new EnumMap<>(Qualities.class); if (aWDRM3U8Url.contains(M3U8_WDR_URL_BEGIN) || aWDRM3U8Url.contains(M3U8_WDR_URL_ALTERNATIV_BEGIN)) { String m3u8Url = aWDRM3U8Url.replaceAll(REGEX_ALL_BEFORE_PATTERN+M3U8_WDR_URL_BEGIN, "").replaceAll(REGEX_ALL_BEFORE_PATTERN+M3U8_WDR_URL_ALTERNATIV_BEGIN, ""); urlAndQualities.putAll(convertM3U8Url(m3u8Url)); } return urlAndQualities; }
[ "public", "static", "Map", "<", "Qualities", ",", "String", ">", "gatherUrlsFromWdrM3U8", "(", "String", "aWDRM3U8Url", ")", "{", "Map", "<", "Qualities", ",", "String", ">", "urlAndQualities", "=", "new", "EnumMap", "<>", "(", "Qualities", ".", "class", ")"...
If the URL follows the following structure it will be used to generate MP4 URLS from it.<br> This structure is needed: <code>http://adaptiv.wdr.de/i/medp/[region]/[fsk]/[unkownNumber]/[videoId]/,[Qualitie 01],[Qualitie 02],[Qualitie ...],.mp4.csmil/master.m3u8</code><br> @param aWDRM3U8Url The M3U8 URL. @return A Map containing the URLs and Qualities which was found. An empty Map if nothing was found.
[ "If", "the", "URL", "follows", "the", "following", "structure", "it", "will", "be", "used", "to", "generate", "MP4", "URLS", "from", "it", ".", "<br", ">", "This", "structure", "is", "needed", ":", "<code", ">", "http", ":", "//", "adaptiv", ".", "wdr"...
train
https://github.com/mediathekview/MServer/blob/ba8d03e6a1a303db3807a1327f553f1decd30388/src/main/java/mServer/tool/M3U8Utils.java#L40-L47
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java
SynchronousRequest.getPvPSeasonLeaderboardInfo
public List<PvPLeaderBoard> getPvPSeasonLeaderboardInfo(String id, String type, World.Region region) throws GuildWars2Exception { try { Response<List<PvPLeaderBoard>> response = gw2API.getPvPSeasonLeaderBoardInfo(id, type, region.name().toLowerCase()).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); } }
java
public List<PvPLeaderBoard> getPvPSeasonLeaderboardInfo(String id, String type, World.Region region) throws GuildWars2Exception { try { Response<List<PvPLeaderBoard>> response = gw2API.getPvPSeasonLeaderBoardInfo(id, type, region.name().toLowerCase()).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); } }
[ "public", "List", "<", "PvPLeaderBoard", ">", "getPvPSeasonLeaderboardInfo", "(", "String", "id", ",", "String", "type", ",", "World", ".", "Region", "region", ")", "throws", "GuildWars2Exception", "{", "try", "{", "Response", "<", "List", "<", "PvPLeaderBoard",...
For more info on pvp season API go <a href="https://wiki.guildwars2.com/wiki/API:2/pvp/seasons">here</a><br/> Get pvp season info for the given pvp season id(s) @param id Season id @param type ladder/legendary/guild @param region na/eu @return list of pvp season info @throws GuildWars2Exception see {@link ErrorCode} for detail @see PvPSeason pvp season info
[ "For", "more", "info", "on", "pvp", "season", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "pvp", "/", "seasons", ">", "here<", "/", "a", ">", "<br", "/", ">"...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java#L2916-L2924
shekhargulati/strman-java
src/main/java/strman/Strman.java
Strman.contains
public static boolean contains(final String value, final String needle, final boolean caseSensitive) { validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER); if (caseSensitive) { return value.contains(needle); } return value.toLowerCase().contains(needle.toLowerCase()); }
java
public static boolean contains(final String value, final String needle, final boolean caseSensitive) { validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER); if (caseSensitive) { return value.contains(needle); } return value.toLowerCase().contains(needle.toLowerCase()); }
[ "public", "static", "boolean", "contains", "(", "final", "String", "value", ",", "final", "String", "needle", ",", "final", "boolean", "caseSensitive", ")", "{", "validate", "(", "value", ",", "NULL_STRING_PREDICATE", ",", "NULL_STRING_MSG_SUPPLIER", ")", ";", "...
Verifies that the needle is contained in the value. @param value to search @param needle to find @param caseSensitive true or false @return true if found else false.
[ "Verifies", "that", "the", "needle", "is", "contained", "in", "the", "value", "." ]
train
https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L165-L171
hypfvieh/java-utils
src/main/java/com/github/hypfvieh/system/NativeLibraryLoader.java
NativeLibraryLoader.loadLibrary
public static void loadLibrary(boolean _trySystemLibsFirst, String _libName, String... _searchPathes) { if (!isEnabled()) { return; } List<SearchOrder> loadOrder = new ArrayList<>(); if (_trySystemLibsFirst) { loadOrder.add(SearchOrder.SYSTEM_PATH); } loadOrder.add(SearchOrder.CUSTOM_PATH); loadOrder.add(SearchOrder.CLASS_PATH); loadLibrary(_libName, loadOrder.toArray(new SearchOrder[] {}), _searchPathes); }
java
public static void loadLibrary(boolean _trySystemLibsFirst, String _libName, String... _searchPathes) { if (!isEnabled()) { return; } List<SearchOrder> loadOrder = new ArrayList<>(); if (_trySystemLibsFirst) { loadOrder.add(SearchOrder.SYSTEM_PATH); } loadOrder.add(SearchOrder.CUSTOM_PATH); loadOrder.add(SearchOrder.CLASS_PATH); loadLibrary(_libName, loadOrder.toArray(new SearchOrder[] {}), _searchPathes); }
[ "public", "static", "void", "loadLibrary", "(", "boolean", "_trySystemLibsFirst", ",", "String", "_libName", ",", "String", "...", "_searchPathes", ")", "{", "if", "(", "!", "isEnabled", "(", ")", ")", "{", "return", ";", "}", "List", "<", "SearchOrder", "...
Load the given _libName from one of the given pathes (will search for the library and uses first match). @param _trySystemLibsFirst use system pathes first @param _libName library to load @param _searchPathes pathes to search
[ "Load", "the", "given", "_libName", "from", "one", "of", "the", "given", "pathes", "(", "will", "search", "for", "the", "library", "and", "uses", "first", "match", ")", "." ]
train
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/system/NativeLibraryLoader.java#L55-L70
elki-project/elki
elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkmax/MkMaxTreeNode.java
MkMaxTreeNode.adjustEntry
@Override public boolean adjustEntry(MkMaxEntry entry, DBID routingObjectID, double parentDistance, AbstractMTree<O, MkMaxTreeNode<O>, MkMaxEntry, ?> mTree) { super.adjustEntry(entry, routingObjectID, parentDistance, mTree); // adjust knn distance entry.setKnnDistance(kNNDistance()); return true; // TODO: improve }
java
@Override public boolean adjustEntry(MkMaxEntry entry, DBID routingObjectID, double parentDistance, AbstractMTree<O, MkMaxTreeNode<O>, MkMaxEntry, ?> mTree) { super.adjustEntry(entry, routingObjectID, parentDistance, mTree); // adjust knn distance entry.setKnnDistance(kNNDistance()); return true; // TODO: improve }
[ "@", "Override", "public", "boolean", "adjustEntry", "(", "MkMaxEntry", "entry", ",", "DBID", "routingObjectID", ",", "double", "parentDistance", ",", "AbstractMTree", "<", "O", ",", "MkMaxTreeNode", "<", "O", ">", ",", "MkMaxEntry", ",", "?", ">", "mTree", ...
Calls the super method and adjust additionally the k-nearest neighbor distance of this node as the maximum of the k-nearest neighbor distances of all its entries.
[ "Calls", "the", "super", "method", "and", "adjust", "additionally", "the", "k", "-", "nearest", "neighbor", "distance", "of", "this", "node", "as", "the", "maximum", "of", "the", "k", "-", "nearest", "neighbor", "distances", "of", "all", "its", "entries", ...
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkmax/MkMaxTreeNode.java#L81-L87
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/server/RemoteSessionServer.java
RemoteSessionServer.getNewRemoteTask
public RemoteTask getNewRemoteTask(Map<String,Object> properties) { try { if (m_app != null) { // Make sure remote server has same db properties, etc. Map<String,Object> appProperties = m_app.getProperties(); properties = Utility.copyAppProperties(properties, appProperties); } Application app = new MainApplication(((BaseApplication)m_app).getEnvironment(), properties, null); RemoteTask remoteServer = new TaskSession(app); ((TaskSession)remoteServer).setProperties(properties); return remoteServer; } catch (Exception ex) { ex.printStackTrace(); return null; } }
java
public RemoteTask getNewRemoteTask(Map<String,Object> properties) { try { if (m_app != null) { // Make sure remote server has same db properties, etc. Map<String,Object> appProperties = m_app.getProperties(); properties = Utility.copyAppProperties(properties, appProperties); } Application app = new MainApplication(((BaseApplication)m_app).getEnvironment(), properties, null); RemoteTask remoteServer = new TaskSession(app); ((TaskSession)remoteServer).setProperties(properties); return remoteServer; } catch (Exception ex) { ex.printStackTrace(); return null; } }
[ "public", "RemoteTask", "getNewRemoteTask", "(", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "try", "{", "if", "(", "m_app", "!=", "null", ")", "{", "// Make sure remote server has same db properties, etc.", "Map", "<", "String", ",", "Obje...
Get a remote session from the pool and initialize it. If the pool is empty, create a new remote session. @param strUserID The user name/ID of the user, or null if unknown. @return The remote Task.
[ "Get", "a", "remote", "session", "from", "the", "pool", "and", "initialize", "it", ".", "If", "the", "pool", "is", "empty", "create", "a", "new", "remote", "session", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/server/RemoteSessionServer.java#L154-L170
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/PlainChangesLogImpl.java
PlainChangesLogImpl.getLastState
public ItemState getLastState(ItemData item, boolean forNode) { Map<String, ItemState> children = forNode ? lastChildNodeStates.get(item.getParentIdentifier()) : lastChildPropertyStates.get(item .getParentIdentifier()); return children == null ? null : children.get(item.getIdentifier()); }
java
public ItemState getLastState(ItemData item, boolean forNode) { Map<String, ItemState> children = forNode ? lastChildNodeStates.get(item.getParentIdentifier()) : lastChildPropertyStates.get(item .getParentIdentifier()); return children == null ? null : children.get(item.getIdentifier()); }
[ "public", "ItemState", "getLastState", "(", "ItemData", "item", ",", "boolean", "forNode", ")", "{", "Map", "<", "String", ",", "ItemState", ">", "children", "=", "forNode", "?", "lastChildNodeStates", ".", "get", "(", "item", ".", "getParentIdentifier", "(", ...
Return the last item state from ChangesLog. @param item an item data the last state which need to be taken @param forNode retrieves nodes' ItemStates is true, or properties' otherwise @return the last item state
[ "Return", "the", "last", "item", "state", "from", "ChangesLog", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/PlainChangesLogImpl.java#L645-L652
Stratio/stratio-cassandra
src/java/org/apache/cassandra/io/util/SequentialWriter.java
SequentialWriter.flushData
protected void flushData() { try { out.write(buffer, 0, validBufferBytes); lastFlushOffset += validBufferBytes; } catch (IOException e) { throw new FSWriteError(e, getPath()); } if (runPostFlush != null) runPostFlush.run(); }
java
protected void flushData() { try { out.write(buffer, 0, validBufferBytes); lastFlushOffset += validBufferBytes; } catch (IOException e) { throw new FSWriteError(e, getPath()); } if (runPostFlush != null) runPostFlush.run(); }
[ "protected", "void", "flushData", "(", ")", "{", "try", "{", "out", ".", "write", "(", "buffer", ",", "0", ",", "validBufferBytes", ")", ";", "lastFlushOffset", "+=", "validBufferBytes", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new...
Override this method instead of overriding flush() @throws FSWriteError on any I/O error.
[ "Override", "this", "method", "instead", "of", "overriding", "flush", "()" ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/io/util/SequentialWriter.java#L319-L332
Ordinastie/MalisisCore
src/main/java/net/malisis/core/renderer/icon/provider/IconProviderBuilder.java
IconProviderBuilder.forShape
public IconProviderBuilder forShape(String shapeName, Icon icon) { setType(Type.MODEL); shapeIcons.put(shapeName, checkNotNull(icon)); return this; }
java
public IconProviderBuilder forShape(String shapeName, Icon icon) { setType(Type.MODEL); shapeIcons.put(shapeName, checkNotNull(icon)); return this; }
[ "public", "IconProviderBuilder", "forShape", "(", "String", "shapeName", ",", "Icon", "icon", ")", "{", "setType", "(", "Type", ".", "MODEL", ")", ";", "shapeIcons", ".", "put", "(", "shapeName", ",", "checkNotNull", "(", "icon", ")", ")", ";", "return", ...
Sets the icon to use for a specific shape/group in a {@link MalisisModel}. @param shapeName the shape name @param icon the icon @return the icon provider builder
[ "Sets", "the", "icon", "to", "use", "for", "a", "specific", "shape", "/", "group", "in", "a", "{", "@link", "MalisisModel", "}", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/icon/provider/IconProviderBuilder.java#L267-L272
kiegroup/drools
drools-core/src/main/java/org/drools/core/util/DroolsStreamUtils.java
DroolsStreamUtils.streamOut
public static void streamOut(OutputStream out, Object object) throws IOException { streamOut(out, object, false); }
java
public static void streamOut(OutputStream out, Object object) throws IOException { streamOut(out, object, false); }
[ "public", "static", "void", "streamOut", "(", "OutputStream", "out", ",", "Object", "object", ")", "throws", "IOException", "{", "streamOut", "(", "out", ",", "object", ",", "false", ")", ";", "}" ]
This method would stream out the given object to the given output stream uncompressed. The output contents could only be read by the corresponding "streamIn" method of this class. @param out @param object @throws IOException
[ "This", "method", "would", "stream", "out", "the", "given", "object", "to", "the", "given", "output", "stream", "uncompressed", ".", "The", "output", "contents", "could", "only", "be", "read", "by", "the", "corresponding", "streamIn", "method", "of", "this", ...
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/util/DroolsStreamUtils.java#L76-L78
alkacon/opencms-core
src/org/opencms/file/history/CmsHistoryResourceHandler.java
CmsHistoryResourceHandler.getHistoryResourceURI
public static String getHistoryResourceURI(String uri, ServletRequest req) { String histUri = uri; if (CmsHistoryResourceHandler.isHistoryRequest(req)) { String version = req.getParameter(CmsHistoryResourceHandler.PARAM_VERSION); histUri = CmsRequestUtil.appendParameter(uri, CmsHistoryResourceHandler.PARAM_VERSION, version); } return histUri; }
java
public static String getHistoryResourceURI(String uri, ServletRequest req) { String histUri = uri; if (CmsHistoryResourceHandler.isHistoryRequest(req)) { String version = req.getParameter(CmsHistoryResourceHandler.PARAM_VERSION); histUri = CmsRequestUtil.appendParameter(uri, CmsHistoryResourceHandler.PARAM_VERSION, version); } return histUri; }
[ "public", "static", "String", "getHistoryResourceURI", "(", "String", "uri", ",", "ServletRequest", "req", ")", "{", "String", "histUri", "=", "uri", ";", "if", "(", "CmsHistoryResourceHandler", ".", "isHistoryRequest", "(", "req", ")", ")", "{", "String", "ve...
Appends the <code>version</code> parameter to the URI if needed.<p> @param uri the resource URI @param req the current request @return the same URI, with additional parameters in case of a historical request
[ "Appends", "the", "<code", ">", "version<", "/", "code", ">", "parameter", "to", "the", "URI", "if", "needed", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/history/CmsHistoryResourceHandler.java#L91-L99
spring-projects/spring-android
spring-android-core/src/main/java/org/springframework/util/ClassUtils.java
ClassUtils.hasMethod
public static boolean hasMethod(Class<?> clazz, String methodName, Class<?>... paramTypes) { return (getMethodIfAvailable(clazz, methodName, paramTypes) != null); }
java
public static boolean hasMethod(Class<?> clazz, String methodName, Class<?>... paramTypes) { return (getMethodIfAvailable(clazz, methodName, paramTypes) != null); }
[ "public", "static", "boolean", "hasMethod", "(", "Class", "<", "?", ">", "clazz", ",", "String", "methodName", ",", "Class", "<", "?", ">", "...", "paramTypes", ")", "{", "return", "(", "getMethodIfAvailable", "(", "clazz", ",", "methodName", ",", "paramTy...
Determine whether the given class has a public method with the given signature. <p>Essentially translates {@code NoSuchMethodException} to "false". @param clazz the clazz to analyze @param methodName the name of the method @param paramTypes the parameter types of the method @return whether the class has a corresponding method @see Class#getMethod
[ "Determine", "whether", "the", "given", "class", "has", "a", "public", "method", "with", "the", "given", "signature", ".", "<p", ">", "Essentially", "translates", "{" ]
train
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ClassUtils.java#L614-L616
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/DirectUpdateDoublesSketch.java
DirectUpdateDoublesSketch.newInstance
static DirectUpdateDoublesSketch newInstance(final int k, final WritableMemory dstMem) { // must be able to hold at least an empty sketch final long memCap = dstMem.getCapacity(); checkDirectMemCapacity(k, 0, memCap); //initialize dstMem dstMem.putLong(0, 0L); //clear pre0 insertPreLongs(dstMem, 2); insertSerVer(dstMem, DoublesSketch.DOUBLES_SER_VER); insertFamilyID(dstMem, Family.QUANTILES.getID()); insertFlags(dstMem, EMPTY_FLAG_MASK); insertK(dstMem, k); if (memCap >= COMBINED_BUFFER) { insertN(dstMem, 0L); insertMinDouble(dstMem, Double.NaN); insertMaxDouble(dstMem, Double.NaN); } final DirectUpdateDoublesSketch dds = new DirectUpdateDoublesSketch(k); dds.mem_ = dstMem; return dds; }
java
static DirectUpdateDoublesSketch newInstance(final int k, final WritableMemory dstMem) { // must be able to hold at least an empty sketch final long memCap = dstMem.getCapacity(); checkDirectMemCapacity(k, 0, memCap); //initialize dstMem dstMem.putLong(0, 0L); //clear pre0 insertPreLongs(dstMem, 2); insertSerVer(dstMem, DoublesSketch.DOUBLES_SER_VER); insertFamilyID(dstMem, Family.QUANTILES.getID()); insertFlags(dstMem, EMPTY_FLAG_MASK); insertK(dstMem, k); if (memCap >= COMBINED_BUFFER) { insertN(dstMem, 0L); insertMinDouble(dstMem, Double.NaN); insertMaxDouble(dstMem, Double.NaN); } final DirectUpdateDoublesSketch dds = new DirectUpdateDoublesSketch(k); dds.mem_ = dstMem; return dds; }
[ "static", "DirectUpdateDoublesSketch", "newInstance", "(", "final", "int", "k", ",", "final", "WritableMemory", "dstMem", ")", "{", "// must be able to hold at least an empty sketch", "final", "long", "memCap", "=", "dstMem", ".", "getCapacity", "(", ")", ";", "checkD...
Obtains a new Direct instance of a DoublesSketch, which may be off-heap. @param k Parameter that controls space usage of sketch and accuracy of estimates. Must be greater than 1 and less than 65536 and a power of 2. @param dstMem the destination Memory that will be initialized to hold the data for this sketch. It must initially be at least (16 * MIN_K + 32) bytes, where MIN_K defaults to 2. As it grows it will request more memory using the MemoryRequest callback. @return a DirectUpdateDoublesSketch
[ "Obtains", "a", "new", "Direct", "instance", "of", "a", "DoublesSketch", "which", "may", "be", "off", "-", "heap", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DirectUpdateDoublesSketch.java#L59-L81
Canadensys/canadensys-core
src/main/java/net/canadensys/utils/ZipUtils.java
ZipUtils.zipFolder
public static boolean zipFolder(File folder, String fileName){ boolean success = false; if(!folder.isDirectory()){ return false; } if(fileName == null){ fileName = folder.getAbsolutePath()+ZIP_EXT; } ZipArchiveOutputStream zipOutput = null; try { zipOutput = new ZipArchiveOutputStream(new File(fileName)); success = addFolderContentToZip(folder,zipOutput,""); zipOutput.close(); } catch (IOException e) { e.printStackTrace(); return false; } finally{ try { if(zipOutput != null){ zipOutput.close(); } } catch (IOException e) {} } return success; }
java
public static boolean zipFolder(File folder, String fileName){ boolean success = false; if(!folder.isDirectory()){ return false; } if(fileName == null){ fileName = folder.getAbsolutePath()+ZIP_EXT; } ZipArchiveOutputStream zipOutput = null; try { zipOutput = new ZipArchiveOutputStream(new File(fileName)); success = addFolderContentToZip(folder,zipOutput,""); zipOutput.close(); } catch (IOException e) { e.printStackTrace(); return false; } finally{ try { if(zipOutput != null){ zipOutput.close(); } } catch (IOException e) {} } return success; }
[ "public", "static", "boolean", "zipFolder", "(", "File", "folder", ",", "String", "fileName", ")", "{", "boolean", "success", "=", "false", ";", "if", "(", "!", "folder", ".", "isDirectory", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", ...
Utility function to zip the content of an entire folder, but not the folder itself. @param folder @param fileName optional @return success or not
[ "Utility", "function", "to", "zip", "the", "content", "of", "an", "entire", "folder", "but", "not", "the", "folder", "itself", "." ]
train
https://github.com/Canadensys/canadensys-core/blob/5e13569f7c0f4cdc7080da72643ff61123ad76fd/src/main/java/net/canadensys/utils/ZipUtils.java#L34-L64
logic-ng/LogicNG
src/main/java/org/logicng/cardinalityconstraints/CCTotalizer.java
CCTotalizer.buildEXK
void buildEXK(final EncodingResult result, final Variable[] vars, int rhs) { final LNGVector<Variable> cardinalityOutvars = this.initializeConstraint(result, vars); this.toCNF(cardinalityOutvars, rhs, Bound.BOTH); assert this.cardinalityInvars.size() == 0; for (int i = 0; i < rhs; i++) this.result.addClause(cardinalityOutvars.get(i)); for (int i = rhs; i < cardinalityOutvars.size(); i++) this.result.addClause(cardinalityOutvars.get(i).negate()); }
java
void buildEXK(final EncodingResult result, final Variable[] vars, int rhs) { final LNGVector<Variable> cardinalityOutvars = this.initializeConstraint(result, vars); this.toCNF(cardinalityOutvars, rhs, Bound.BOTH); assert this.cardinalityInvars.size() == 0; for (int i = 0; i < rhs; i++) this.result.addClause(cardinalityOutvars.get(i)); for (int i = rhs; i < cardinalityOutvars.size(); i++) this.result.addClause(cardinalityOutvars.get(i).negate()); }
[ "void", "buildEXK", "(", "final", "EncodingResult", "result", ",", "final", "Variable", "[", "]", "vars", ",", "int", "rhs", ")", "{", "final", "LNGVector", "<", "Variable", ">", "cardinalityOutvars", "=", "this", ".", "initializeConstraint", "(", "result", ...
Builds an exactly-k constraint. @param vars the variables @param rhs the right-hand side @throws IllegalArgumentException if the right hand side of the constraint was negative
[ "Builds", "an", "exactly", "-", "k", "constraint", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/cardinalityconstraints/CCTotalizer.java#L114-L122
infinispan/infinispan
core/src/main/java/org/infinispan/configuration/parsing/ParseUtils.java
ParseUtils.missingRequired
public static XMLStreamException missingRequired(final XMLStreamReader reader, final Set<?> required) { final StringBuilder b = new StringBuilder(); Iterator<?> iterator = required.iterator(); while (iterator.hasNext()) { final Object o = iterator.next(); b.append(o.toString()); if (iterator.hasNext()) { b.append(", "); } } return new XMLStreamException("Missing required attribute(s): " + b, reader.getLocation()); }
java
public static XMLStreamException missingRequired(final XMLStreamReader reader, final Set<?> required) { final StringBuilder b = new StringBuilder(); Iterator<?> iterator = required.iterator(); while (iterator.hasNext()) { final Object o = iterator.next(); b.append(o.toString()); if (iterator.hasNext()) { b.append(", "); } } return new XMLStreamException("Missing required attribute(s): " + b, reader.getLocation()); }
[ "public", "static", "XMLStreamException", "missingRequired", "(", "final", "XMLStreamReader", "reader", ",", "final", "Set", "<", "?", ">", "required", ")", "{", "final", "StringBuilder", "b", "=", "new", "StringBuilder", "(", ")", ";", "Iterator", "<", "?", ...
Get an exception reporting a missing, required XML attribute. @param reader the stream reader @param required a set of enums whose toString method returns the attribute name @return the exception
[ "Get", "an", "exception", "reporting", "a", "missing", "required", "XML", "attribute", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/parsing/ParseUtils.java#L89-L100
googleapis/google-cloud-java
google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/JobControllerClient.java
JobControllerClient.cancelJob
public final Job cancelJob(String projectId, String region, String jobId) { CancelJobRequest request = CancelJobRequest.newBuilder() .setProjectId(projectId) .setRegion(region) .setJobId(jobId) .build(); return cancelJob(request); }
java
public final Job cancelJob(String projectId, String region, String jobId) { CancelJobRequest request = CancelJobRequest.newBuilder() .setProjectId(projectId) .setRegion(region) .setJobId(jobId) .build(); return cancelJob(request); }
[ "public", "final", "Job", "cancelJob", "(", "String", "projectId", ",", "String", "region", ",", "String", "jobId", ")", "{", "CancelJobRequest", "request", "=", "CancelJobRequest", ".", "newBuilder", "(", ")", ".", "setProjectId", "(", "projectId", ")", ".", ...
Starts a job cancellation request. To access the job resource after cancellation, call [regions/{region}/jobs.list](/dataproc/docs/reference/rest/v1/projects.regions.jobs/list) or [regions/{region}/jobs.get](/dataproc/docs/reference/rest/v1/projects.regions.jobs/get). <p>Sample code: <pre><code> try (JobControllerClient jobControllerClient = JobControllerClient.create()) { String projectId = ""; String region = ""; String jobId = ""; Job response = jobControllerClient.cancelJob(projectId, region, jobId); } </code></pre> @param projectId Required. The ID of the Google Cloud Platform project that the job belongs to. @param region Required. The Cloud Dataproc region in which to handle the request. @param jobId Required. The job ID. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Starts", "a", "job", "cancellation", "request", ".", "To", "access", "the", "job", "resource", "after", "cancellation", "call", "[", "regions", "/", "{", "region", "}", "/", "jobs", ".", "list", "]", "(", "/", "dataproc", "/", "docs", "/", "reference", ...
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/JobControllerClient.java#L558-L567
protostuff/protostuff
protostuff-xml/src/main/java/io/protostuff/XmlIOUtil.java
XmlIOUtil.mergeFrom
public static <T> void mergeFrom(InputStream in, T message, Schema<T> schema) throws IOException { mergeFrom(in, message, schema, DEFAULT_INPUT_FACTORY); }
java
public static <T> void mergeFrom(InputStream in, T message, Schema<T> schema) throws IOException { mergeFrom(in, message, schema, DEFAULT_INPUT_FACTORY); }
[ "public", "static", "<", "T", ">", "void", "mergeFrom", "(", "InputStream", "in", ",", "T", "message", ",", "Schema", "<", "T", ">", "schema", ")", "throws", "IOException", "{", "mergeFrom", "(", "in", ",", "message", ",", "schema", ",", "DEFAULT_INPUT_F...
Merges the {@code message} from the {@link InputStream} using the given {@code schema}.
[ "Merges", "the", "{" ]
train
https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-xml/src/main/java/io/protostuff/XmlIOUtil.java#L215-L219
drewnoakes/metadata-extractor
Source/com/drew/metadata/exif/ExifTiffHandler.java
ExifTiffHandler.getReaderString
@NotNull private static String getReaderString(final @NotNull RandomAccessReader reader, final int makernoteOffset, final int bytesRequested) throws IOException { try { return reader.getString(makernoteOffset, bytesRequested, Charsets.UTF_8); } catch(BufferBoundsException e) { return ""; } }
java
@NotNull private static String getReaderString(final @NotNull RandomAccessReader reader, final int makernoteOffset, final int bytesRequested) throws IOException { try { return reader.getString(makernoteOffset, bytesRequested, Charsets.UTF_8); } catch(BufferBoundsException e) { return ""; } }
[ "@", "NotNull", "private", "static", "String", "getReaderString", "(", "final", "@", "NotNull", "RandomAccessReader", "reader", ",", "final", "int", "makernoteOffset", ",", "final", "int", "bytesRequested", ")", "throws", "IOException", "{", "try", "{", "return", ...
Read a given number of bytes from the stream This method is employed to "suppress" attempts to read beyond end of the file as may happen at the beginning of processMakernote when we read increasingly longer camera makes. Instead of failing altogether in this context we return an empty string which will fail all sensible attempts to compare to makes while avoiding a full-on failure.
[ "Read", "a", "given", "number", "of", "bytes", "from", "the", "stream" ]
train
https://github.com/drewnoakes/metadata-extractor/blob/a958e0b61b50e590731b3be1dca8df8e21ebd43c/Source/com/drew/metadata/exif/ExifTiffHandler.java#L379-L387
JodaOrg/joda-time
src/main/java/org/joda/time/Duration.java
Duration.dividedBy
public Duration dividedBy(long divisor, RoundingMode roundingMode) { if (divisor == 1) { return this; } return new Duration(FieldUtils.safeDivide(getMillis(), divisor, roundingMode)); }
java
public Duration dividedBy(long divisor, RoundingMode roundingMode) { if (divisor == 1) { return this; } return new Duration(FieldUtils.safeDivide(getMillis(), divisor, roundingMode)); }
[ "public", "Duration", "dividedBy", "(", "long", "divisor", ",", "RoundingMode", "roundingMode", ")", "{", "if", "(", "divisor", "==", "1", ")", "{", "return", "this", ";", "}", "return", "new", "Duration", "(", "FieldUtils", ".", "safeDivide", "(", "getMil...
Returns a new duration with its length divided by the specified divisor. {@code RoundingMode} can be specified. This instance is immutable and is not altered. <p> If the divisor is one, this instance is returned. @param divisor the divisor to divide this one by @param roundingMode the type of rounding desired @return the new duration instance
[ "Returns", "a", "new", "duration", "with", "its", "length", "divided", "by", "the", "specified", "divisor", ".", "{", "@code", "RoundingMode", "}", "can", "be", "specified", ".", "This", "instance", "is", "immutable", "and", "is", "not", "altered", ".", "<...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Duration.java#L520-L525
OpenLiberty/open-liberty
dev/com.ibm.ws.product.utility/src/com/ibm/ws/product/utility/extension/IFixUtils.java
IFixUtils.findIFixXmlFiles
private static File[] findIFixXmlFiles(File wlpInstallationDirectory) { File iFixDirectory = new File(wlpInstallationDirectory, "lib/fixes"); if (!iFixDirectory.exists() || !iFixDirectory.isDirectory()) { return new File[0]; } File[] iFixFiles = iFixDirectory.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String fileName) { return FileUtils.matchesFileExtension(".xml", fileName); } }); return iFixFiles; }
java
private static File[] findIFixXmlFiles(File wlpInstallationDirectory) { File iFixDirectory = new File(wlpInstallationDirectory, "lib/fixes"); if (!iFixDirectory.exists() || !iFixDirectory.isDirectory()) { return new File[0]; } File[] iFixFiles = iFixDirectory.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String fileName) { return FileUtils.matchesFileExtension(".xml", fileName); } }); return iFixFiles; }
[ "private", "static", "File", "[", "]", "findIFixXmlFiles", "(", "File", "wlpInstallationDirectory", ")", "{", "File", "iFixDirectory", "=", "new", "File", "(", "wlpInstallationDirectory", ",", "\"lib/fixes\"", ")", ";", "if", "(", "!", "iFixDirectory", ".", "exi...
This loads all of the files ending with ".xml" within the lib/fixes directory of the WLP install. If none exist then it returns an empty array. @param wlpInstallationDirectory The installation directory of the current install @return The list of XML files or an empty array if none is found
[ "This", "loads", "all", "of", "the", "files", "ending", "with", ".", "xml", "within", "the", "lib", "/", "fixes", "directory", "of", "the", "WLP", "install", ".", "If", "none", "exist", "then", "it", "returns", "an", "empty", "array", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.product.utility/src/com/ibm/ws/product/utility/extension/IFixUtils.java#L143-L155
zaproxy/zaproxy
src/org/zaproxy/zap/utils/LocaleUtils.java
LocaleUtils.getAvailableViewLocales
public static List<ViewLocale> getAvailableViewLocales() { List<String> locales = readAvailableLocales(); List<ViewLocale> localesUI = new ArrayList<>(); if (!locales.isEmpty()) { for (String locale : locales) { localesUI.add(new ViewLocale(locale, getLocalDisplayName(locale))); } Collections.sort(localesUI, new Comparator<ViewLocale>() { @Override public int compare(ViewLocale o1, ViewLocale o2) { return o1.toString().compareTo(o2.toString()); } }); } // Always put English at the top localesUI.add(0, new ViewLocale(DEFAULT_LOCALE, getLocalDisplayName(DEFAULT_LOCALE))); return localesUI; }
java
public static List<ViewLocale> getAvailableViewLocales() { List<String> locales = readAvailableLocales(); List<ViewLocale> localesUI = new ArrayList<>(); if (!locales.isEmpty()) { for (String locale : locales) { localesUI.add(new ViewLocale(locale, getLocalDisplayName(locale))); } Collections.sort(localesUI, new Comparator<ViewLocale>() { @Override public int compare(ViewLocale o1, ViewLocale o2) { return o1.toString().compareTo(o2.toString()); } }); } // Always put English at the top localesUI.add(0, new ViewLocale(DEFAULT_LOCALE, getLocalDisplayName(DEFAULT_LOCALE))); return localesUI; }
[ "public", "static", "List", "<", "ViewLocale", ">", "getAvailableViewLocales", "(", ")", "{", "List", "<", "String", ">", "locales", "=", "readAvailableLocales", "(", ")", ";", "List", "<", "ViewLocale", ">", "localesUI", "=", "new", "ArrayList", "<>", "(", ...
Returns a list of {@code ViewLocale}s, sorted by display name, of the default language and available translations. @return the {@code ViewLocale}s of the default language and available translations. @see ViewLocale @since 2.4.0
[ "Returns", "a", "list", "of", "{", "@code", "ViewLocale", "}", "s", "sorted", "by", "display", "name", "of", "the", "default", "language", "and", "available", "translations", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/utils/LocaleUtils.java#L410-L432
sstrickx/yahoofinance-api
src/main/java/yahoofinance/YahooFinance.java
YahooFinance.get
public static Stock get(String symbol, Interval interval) throws IOException { return YahooFinance.get(symbol, HistQuotesRequest.DEFAULT_FROM, HistQuotesRequest.DEFAULT_TO, interval); }
java
public static Stock get(String symbol, Interval interval) throws IOException { return YahooFinance.get(symbol, HistQuotesRequest.DEFAULT_FROM, HistQuotesRequest.DEFAULT_TO, interval); }
[ "public", "static", "Stock", "get", "(", "String", "symbol", ",", "Interval", "interval", ")", "throws", "IOException", "{", "return", "YahooFinance", ".", "get", "(", "symbol", ",", "HistQuotesRequest", ".", "DEFAULT_FROM", ",", "HistQuotesRequest", ".", "DEFAU...
Sends a request with the historical quotes included at the specified interval (DAILY, WEEKLY, MONTHLY). Returns null if the data can't be retrieved from Yahoo Finance. @param symbol the symbol of the stock for which you want to retrieve information @param interval the interval of the included historical data @return a {@link Stock} object containing the requested information @throws java.io.IOException when there's a connection problem
[ "Sends", "a", "request", "with", "the", "historical", "quotes", "included", "at", "the", "specified", "interval", "(", "DAILY", "WEEKLY", "MONTHLY", ")", ".", "Returns", "null", "if", "the", "data", "can", "t", "be", "retrieved", "from", "Yahoo", "Finance", ...
train
https://github.com/sstrickx/yahoofinance-api/blob/2766ba52fc5cccf9b4da5c06423d68059cf0a6e6/src/main/java/yahoofinance/YahooFinance.java#L112-L114
census-instrumentation/opencensus-java
contrib/resource_util/src/main/java/io/opencensus/contrib/resource/util/ContainerResource.java
ContainerResource.create
public static Resource create(String name, String imageName, String imageTag) { Map<String, String> labels = new LinkedHashMap<String, String>(); labels.put(NAME_KEY, checkNotNull(name, "name")); labels.put(IMAGE_NAME_KEY, checkNotNull(imageName, "imageName")); labels.put(IMAGE_TAG_KEY, checkNotNull(imageTag, "imageTag")); return Resource.create(TYPE, labels); }
java
public static Resource create(String name, String imageName, String imageTag) { Map<String, String> labels = new LinkedHashMap<String, String>(); labels.put(NAME_KEY, checkNotNull(name, "name")); labels.put(IMAGE_NAME_KEY, checkNotNull(imageName, "imageName")); labels.put(IMAGE_TAG_KEY, checkNotNull(imageTag, "imageTag")); return Resource.create(TYPE, labels); }
[ "public", "static", "Resource", "create", "(", "String", "name", ",", "String", "imageName", ",", "String", "imageTag", ")", "{", "Map", "<", "String", ",", "String", ">", "labels", "=", "new", "LinkedHashMap", "<", "String", ",", "String", ">", "(", ")"...
Returns a {@link Resource} that describes a container. @param name the container name. @param imageName the container image name. @param imageTag the container image tag. @return a {@link Resource} that describes a k8s container. @since 0.20
[ "Returns", "a", "{", "@link", "Resource", "}", "that", "describes", "a", "container", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/contrib/resource_util/src/main/java/io/opencensus/contrib/resource/util/ContainerResource.java#L69-L75
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java
BoxApiFile.getRenameRequest
public BoxRequestsFile.UpdateFile getRenameRequest(String id, String newName) { BoxRequestsFile.UpdateFile request = new BoxRequestsFile.UpdateFile(id, getFileInfoUrl(id), mSession); request.setName(newName); return request; }
java
public BoxRequestsFile.UpdateFile getRenameRequest(String id, String newName) { BoxRequestsFile.UpdateFile request = new BoxRequestsFile.UpdateFile(id, getFileInfoUrl(id), mSession); request.setName(newName); return request; }
[ "public", "BoxRequestsFile", ".", "UpdateFile", "getRenameRequest", "(", "String", "id", ",", "String", "newName", ")", "{", "BoxRequestsFile", ".", "UpdateFile", "request", "=", "new", "BoxRequestsFile", ".", "UpdateFile", "(", "id", ",", "getFileInfoUrl", "(", ...
Gets a request that renames a file @param id id of file to rename @param newName id of file to retrieve info on @return request to rename a file
[ "Gets", "a", "request", "that", "renames", "a", "file" ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java#L221-L225
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/serialize/write/XMLCharHelper.java
XMLCharHelper.isInvalidXMLNameStartChar
public static boolean isInvalidXMLNameStartChar (@Nonnull final EXMLSerializeVersion eXMLVersion, final int c) { switch (eXMLVersion) { case XML_10: return INVALID_NAME_START_CHAR_XML10.get (c); case XML_11: return INVALID_NAME_START_CHAR_XML11.get (c); case HTML: return INVALID_CHAR_HTML.get (c); default: throw new IllegalArgumentException ("Unsupported XML version " + eXMLVersion + "!"); } }
java
public static boolean isInvalidXMLNameStartChar (@Nonnull final EXMLSerializeVersion eXMLVersion, final int c) { switch (eXMLVersion) { case XML_10: return INVALID_NAME_START_CHAR_XML10.get (c); case XML_11: return INVALID_NAME_START_CHAR_XML11.get (c); case HTML: return INVALID_CHAR_HTML.get (c); default: throw new IllegalArgumentException ("Unsupported XML version " + eXMLVersion + "!"); } }
[ "public", "static", "boolean", "isInvalidXMLNameStartChar", "(", "@", "Nonnull", "final", "EXMLSerializeVersion", "eXMLVersion", ",", "final", "int", "c", ")", "{", "switch", "(", "eXMLVersion", ")", "{", "case", "XML_10", ":", "return", "INVALID_NAME_START_CHAR_XML...
Check if the passed character is invalid for an element or attribute name on the first position @param eXMLVersion XML version to be used. May not be <code>null</code>. @param c char to check @return <code>true</code> if the char is invalid
[ "Check", "if", "the", "passed", "character", "is", "invalid", "for", "an", "element", "or", "attribute", "name", "on", "the", "first", "position" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/write/XMLCharHelper.java#L643-L656
j256/simplejmx
src/main/java/com/j256/simplejmx/server/JmxServer.java
JmxServer.stopThrow
public synchronized void stopThrow() throws JMException { if (connector != null) { try { connector.stop(); } catch (IOException e) { throw createJmException("Could not stop our Jmx connector server", e); } finally { connector = null; } } if (rmiRegistry != null) { try { UnicastRemoteObject.unexportObject(rmiRegistry, true); } catch (NoSuchObjectException e) { throw createJmException("Could not unexport our RMI registry", e); } finally { rmiRegistry = null; } } if (serverHostNamePropertySet) { System.clearProperty(RMI_SERVER_HOST_NAME_PROPERTY); serverHostNamePropertySet = false; } }
java
public synchronized void stopThrow() throws JMException { if (connector != null) { try { connector.stop(); } catch (IOException e) { throw createJmException("Could not stop our Jmx connector server", e); } finally { connector = null; } } if (rmiRegistry != null) { try { UnicastRemoteObject.unexportObject(rmiRegistry, true); } catch (NoSuchObjectException e) { throw createJmException("Could not unexport our RMI registry", e); } finally { rmiRegistry = null; } } if (serverHostNamePropertySet) { System.clearProperty(RMI_SERVER_HOST_NAME_PROPERTY); serverHostNamePropertySet = false; } }
[ "public", "synchronized", "void", "stopThrow", "(", ")", "throws", "JMException", "{", "if", "(", "connector", "!=", "null", ")", "{", "try", "{", "connector", ".", "stop", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "creat...
Stop the JMX server by closing the connector and unpublishing it from the RMI registry. This throws a JMException on any issues.
[ "Stop", "the", "JMX", "server", "by", "closing", "the", "connector", "and", "unpublishing", "it", "from", "the", "RMI", "registry", ".", "This", "throws", "a", "JMException", "on", "any", "issues", "." ]
train
https://github.com/j256/simplejmx/blob/1a04f52512dfa0a711ba0cc7023c604dbc82a352/src/main/java/com/j256/simplejmx/server/JmxServer.java#L186-L209
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.rmacc
public void rmacc(String resourceName, String principalType, String principalName) throws CmsException { CmsResource res = readResource(resourceName, CmsResourceFilter.ALL); if (CmsUUID.isValidUUID(principalName)) { // principal name is in fact a UUID, probably the user was already deleted m_securityManager.removeAccessControlEntry(m_context, res, new CmsUUID(principalName)); } else if (CmsAccessControlEntry.PRINCIPAL_ALL_OTHERS_NAME.equals(principalName)) { m_securityManager.removeAccessControlEntry(m_context, res, CmsAccessControlEntry.PRINCIPAL_ALL_OTHERS_ID); } else if (CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_NAME.equals(principalName)) { m_securityManager.removeAccessControlEntry( m_context, res, CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_ID); } else { try { // principal name not a UUID, assume this is a normal group or user name I_CmsPrincipal principal = CmsPrincipal.readPrincipal(this, principalType, principalName); m_securityManager.removeAccessControlEntry(m_context, res, principal.getId()); } catch (CmsDbEntryNotFoundException e) { // role case CmsRole role = CmsRole.valueOfRoleName(principalName); if (role == null) { throw e; } m_securityManager.removeAccessControlEntry(m_context, res, role.getId()); } } }
java
public void rmacc(String resourceName, String principalType, String principalName) throws CmsException { CmsResource res = readResource(resourceName, CmsResourceFilter.ALL); if (CmsUUID.isValidUUID(principalName)) { // principal name is in fact a UUID, probably the user was already deleted m_securityManager.removeAccessControlEntry(m_context, res, new CmsUUID(principalName)); } else if (CmsAccessControlEntry.PRINCIPAL_ALL_OTHERS_NAME.equals(principalName)) { m_securityManager.removeAccessControlEntry(m_context, res, CmsAccessControlEntry.PRINCIPAL_ALL_OTHERS_ID); } else if (CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_NAME.equals(principalName)) { m_securityManager.removeAccessControlEntry( m_context, res, CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_ID); } else { try { // principal name not a UUID, assume this is a normal group or user name I_CmsPrincipal principal = CmsPrincipal.readPrincipal(this, principalType, principalName); m_securityManager.removeAccessControlEntry(m_context, res, principal.getId()); } catch (CmsDbEntryNotFoundException e) { // role case CmsRole role = CmsRole.valueOfRoleName(principalName); if (role == null) { throw e; } m_securityManager.removeAccessControlEntry(m_context, res, role.getId()); } } }
[ "public", "void", "rmacc", "(", "String", "resourceName", ",", "String", "principalType", ",", "String", "principalName", ")", "throws", "CmsException", "{", "CmsResource", "res", "=", "readResource", "(", "resourceName", ",", "CmsResourceFilter", ".", "ALL", ")",...
Removes an access control entry of a given principal from a given resource.<p> @param resourceName name of the resource @param principalType the type of the principal (currently group or user) @param principalName the name of the principal @throws CmsException if something goes wrong
[ "Removes", "an", "access", "control", "entry", "of", "a", "given", "principal", "from", "a", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L3714-L3742
CenturyLinkCloud/mdw
mdw-workflow/assets/com/centurylink/mdw/microservice/ResponseCollector.java
ResponseCollector.updateResponse
protected void updateResponse(Pair<Integer,JSONObject> combined) throws ActivityException { ServiceValuesAccess serviceValues = getRuntimeContext().getServiceValues(); Map<String,String> responseHeaders = serviceValues.getResponseHeaders(); if (responseHeaders == null) responseHeaders = new HashMap<>(); responseHeaders.put(Listener.METAINFO_HTTP_STATUS_CODE, String.valueOf(combined.getFirst())); setVariableValue(serviceValues.getResponseHeadersVariableName(),responseHeaders); setVariableValue(serviceValues.getResponseVariableName(), combined.getSecond().toString(2)); }
java
protected void updateResponse(Pair<Integer,JSONObject> combined) throws ActivityException { ServiceValuesAccess serviceValues = getRuntimeContext().getServiceValues(); Map<String,String> responseHeaders = serviceValues.getResponseHeaders(); if (responseHeaders == null) responseHeaders = new HashMap<>(); responseHeaders.put(Listener.METAINFO_HTTP_STATUS_CODE, String.valueOf(combined.getFirst())); setVariableValue(serviceValues.getResponseHeadersVariableName(),responseHeaders); setVariableValue(serviceValues.getResponseVariableName(), combined.getSecond().toString(2)); }
[ "protected", "void", "updateResponse", "(", "Pair", "<", "Integer", ",", "JSONObject", ">", "combined", ")", "throws", "ActivityException", "{", "ServiceValuesAccess", "serviceValues", "=", "getRuntimeContext", "(", ")", ".", "getServiceValues", "(", ")", ";", "Ma...
Updates the response variable and responseHeaders status code (if present). Override if your main response does not have a JsonTranslator for its type.
[ "Updates", "the", "response", "variable", "and", "responseHeaders", "status", "code", "(", "if", "present", ")", ".", "Override", "if", "your", "main", "response", "does", "not", "have", "a", "JsonTranslator", "for", "its", "type", "." ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-workflow/assets/com/centurylink/mdw/microservice/ResponseCollector.java#L64-L73
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/collections/MapUtils.java
MapUtils.longestKeyLength
public static <V> int longestKeyLength(Map<String, V> map) { if (map.isEmpty()) { return 0; } return Ordering.natural().max( FluentIterable.from(map.keySet()) .transform(StringUtils.lengthFunction())); }
java
public static <V> int longestKeyLength(Map<String, V> map) { if (map.isEmpty()) { return 0; } return Ordering.natural().max( FluentIterable.from(map.keySet()) .transform(StringUtils.lengthFunction())); }
[ "public", "static", "<", "V", ">", "int", "longestKeyLength", "(", "Map", "<", "String", ",", "V", ">", "map", ")", "{", "if", "(", "map", ".", "isEmpty", "(", ")", ")", "{", "return", "0", ";", "}", "return", "Ordering", ".", "natural", "(", ")"...
Returns the length of the longest key in a map, or 0 if the map is empty. Useful for printing tables, etc. The map may not have any null keys.
[ "Returns", "the", "length", "of", "the", "longest", "key", "in", "a", "map", "or", "0", "if", "the", "map", "is", "empty", ".", "Useful", "for", "printing", "tables", "etc", ".", "The", "map", "may", "not", "have", "any", "null", "keys", "." ]
train
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/collections/MapUtils.java#L338-L346
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/util/LevenshteinDistance.java
LevenshteinDistance.getDistance
public static int getDistance (@Nullable final String sStr1, @Nullable final String sStr2) { final int nLen1 = StringHelper.getLength (sStr1); final int nLen2 = StringHelper.getLength (sStr2); if (nLen1 == 0) return nLen2; if (nLen2 == 0) return nLen1; return _getDistance111 (sStr1.toCharArray (), nLen1, sStr2.toCharArray (), nLen2); }
java
public static int getDistance (@Nullable final String sStr1, @Nullable final String sStr2) { final int nLen1 = StringHelper.getLength (sStr1); final int nLen2 = StringHelper.getLength (sStr2); if (nLen1 == 0) return nLen2; if (nLen2 == 0) return nLen1; return _getDistance111 (sStr1.toCharArray (), nLen1, sStr2.toCharArray (), nLen2); }
[ "public", "static", "int", "getDistance", "(", "@", "Nullable", "final", "String", "sStr1", ",", "@", "Nullable", "final", "String", "sStr2", ")", "{", "final", "int", "nLen1", "=", "StringHelper", ".", "getLength", "(", "sStr1", ")", ";", "final", "int", ...
Get the distance of the 2 strings, using the costs 1 for insertion, deletion and substitution. @param sStr1 First string. @param sStr2 second string. @return The Levenshtein distance.
[ "Get", "the", "distance", "of", "the", "2", "strings", "using", "the", "costs", "1", "for", "insertion", "deletion", "and", "substitution", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/util/LevenshteinDistance.java#L211-L222
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java
PerspectiveOps.multTranA
public static void multTranA( DMatrix3x3 A , DMatrix3x3 B , DMatrix3x3 C , DMatrix3x3 output ) { double t11 = A.a11*B.a11 + A.a21*B.a21 + A.a31*B.a31; double t12 = A.a11*B.a12 + A.a21*B.a22 + A.a31*B.a32; double t13 = A.a11*B.a13 + A.a21*B.a23 + A.a31*B.a33; double t21 = A.a12*B.a11 + A.a22*B.a21 + A.a32*B.a31; double t22 = A.a12*B.a12 + A.a22*B.a22 + A.a32*B.a32; double t23 = A.a12*B.a13 + A.a22*B.a23 + A.a32*B.a33; double t31 = A.a13*B.a11 + A.a23*B.a21 + A.a33*B.a31; double t32 = A.a13*B.a12 + A.a23*B.a22 + A.a33*B.a32; double t33 = A.a13*B.a13 + A.a23*B.a23 + A.a33*B.a33; output.a11 = t11*C.a11 + t12*C.a21 + t13*C.a31; output.a12 = t11*C.a12 + t12*C.a22 + t13*C.a32; output.a13 = t11*C.a13 + t12*C.a23 + t13*C.a33; output.a21 = t21*C.a11 + t22*C.a21 + t23*C.a31; output.a22 = t21*C.a12 + t22*C.a22 + t23*C.a32; output.a23 = t21*C.a13 + t22*C.a23 + t23*C.a33; output.a31 = t31*C.a11 + t32*C.a21 + t33*C.a31; output.a32 = t31*C.a12 + t32*C.a22 + t33*C.a32; output.a33 = t31*C.a13 + t32*C.a23 + t33*C.a33; }
java
public static void multTranA( DMatrix3x3 A , DMatrix3x3 B , DMatrix3x3 C , DMatrix3x3 output ) { double t11 = A.a11*B.a11 + A.a21*B.a21 + A.a31*B.a31; double t12 = A.a11*B.a12 + A.a21*B.a22 + A.a31*B.a32; double t13 = A.a11*B.a13 + A.a21*B.a23 + A.a31*B.a33; double t21 = A.a12*B.a11 + A.a22*B.a21 + A.a32*B.a31; double t22 = A.a12*B.a12 + A.a22*B.a22 + A.a32*B.a32; double t23 = A.a12*B.a13 + A.a22*B.a23 + A.a32*B.a33; double t31 = A.a13*B.a11 + A.a23*B.a21 + A.a33*B.a31; double t32 = A.a13*B.a12 + A.a23*B.a22 + A.a33*B.a32; double t33 = A.a13*B.a13 + A.a23*B.a23 + A.a33*B.a33; output.a11 = t11*C.a11 + t12*C.a21 + t13*C.a31; output.a12 = t11*C.a12 + t12*C.a22 + t13*C.a32; output.a13 = t11*C.a13 + t12*C.a23 + t13*C.a33; output.a21 = t21*C.a11 + t22*C.a21 + t23*C.a31; output.a22 = t21*C.a12 + t22*C.a22 + t23*C.a32; output.a23 = t21*C.a13 + t22*C.a23 + t23*C.a33; output.a31 = t31*C.a11 + t32*C.a21 + t33*C.a31; output.a32 = t31*C.a12 + t32*C.a22 + t33*C.a32; output.a33 = t31*C.a13 + t32*C.a23 + t33*C.a33; }
[ "public", "static", "void", "multTranA", "(", "DMatrix3x3", "A", ",", "DMatrix3x3", "B", ",", "DMatrix3x3", "C", ",", "DMatrix3x3", "output", ")", "{", "double", "t11", "=", "A", ".", "a11", "*", "B", ".", "a11", "+", "A", ".", "a21", "*", "B", "."...
Computes: D = A<sup>T</sup>*B*C @param A (Input) 3x3 matrix @param B (Input) 3x3 matrix @param C (Input) 3x3 matrix @param output (Output) 3x3 matrix. Can be same instance A or B.
[ "Computes", ":", "D", "=", "A<sup", ">", "T<", "/", "sup", ">", "*", "B", "*", "C" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L859-L884
structurizr/java
structurizr-core/src/com/structurizr/documentation/StructurizrDocumentationTemplate.java
StructurizrDocumentationTemplate.addDataSection
@Nonnull public Section addDataSection(@Nullable SoftwareSystem softwareSystem, @Nonnull Format format, @Nonnull String content) { return addSection(softwareSystem, "Data", format, content); }
java
@Nonnull public Section addDataSection(@Nullable SoftwareSystem softwareSystem, @Nonnull Format format, @Nonnull String content) { return addSection(softwareSystem, "Data", format, content); }
[ "@", "Nonnull", "public", "Section", "addDataSection", "(", "@", "Nullable", "SoftwareSystem", "softwareSystem", ",", "@", "Nonnull", "Format", "format", ",", "@", "Nonnull", "String", "content", ")", "{", "return", "addSection", "(", "softwareSystem", ",", "\"D...
Adds a "Data" section relating to a {@link SoftwareSystem}. @param softwareSystem the {@link SoftwareSystem} the documentation content relates to @param format the {@link Format} of the documentation content @param content a String containing the documentation content @return a documentation {@link Section}
[ "Adds", "a", "Data", "section", "relating", "to", "a", "{", "@link", "SoftwareSystem", "}", "." ]
train
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/documentation/StructurizrDocumentationTemplate.java#L304-L307