repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
drewnoakes/metadata-extractor
Source/com/drew/metadata/Directory.java
Directory.setDate
public void setDate(int tagType, @NotNull java.util.Date value) { setObject(tagType, value); }
java
public void setDate(int tagType, @NotNull java.util.Date value) { setObject(tagType, value); }
[ "public", "void", "setDate", "(", "int", "tagType", ",", "@", "NotNull", "java", ".", "util", ".", "Date", "value", ")", "{", "setObject", "(", "tagType", ",", "value", ")", ";", "}" ]
Sets a <code>java.util.Date</code> value for the specified tag. @param tagType the tag's value as an int @param value the value for the specified tag as a java.util.Date
[ "Sets", "a", "<code", ">", "java", ".", "util", ".", "Date<", "/", "code", ">", "value", "for", "the", "specified", "tag", "." ]
train
https://github.com/drewnoakes/metadata-extractor/blob/a958e0b61b50e590731b3be1dca8df8e21ebd43c/Source/com/drew/metadata/Directory.java#L341-L344
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/BillingApi.java
BillingApi.updatePlan
public BillingPlanUpdateResponse updatePlan(String accountId, BillingPlanInformation billingPlanInformation, BillingApi.UpdatePlanOptions options) throws ApiException { Object localVarPostBody = billingPlanInformation; // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException(400, "Missing the required parameter 'accountId' when calling updatePlan"); } // create path and map variables String localVarPath = "/v2/accounts/{accountId}/billing_plan".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); if (options != null) { localVarQueryParams.addAll(apiClient.parameterToPairs("", "preview_billing_plan", options.previewBillingPlan)); } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ }; GenericType<BillingPlanUpdateResponse> localVarReturnType = new GenericType<BillingPlanUpdateResponse>() {}; return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); }
java
public BillingPlanUpdateResponse updatePlan(String accountId, BillingPlanInformation billingPlanInformation, BillingApi.UpdatePlanOptions options) throws ApiException { Object localVarPostBody = billingPlanInformation; // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException(400, "Missing the required parameter 'accountId' when calling updatePlan"); } // create path and map variables String localVarPath = "/v2/accounts/{accountId}/billing_plan".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); if (options != null) { localVarQueryParams.addAll(apiClient.parameterToPairs("", "preview_billing_plan", options.previewBillingPlan)); } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ }; GenericType<BillingPlanUpdateResponse> localVarReturnType = new GenericType<BillingPlanUpdateResponse>() {}; return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); }
[ "public", "BillingPlanUpdateResponse", "updatePlan", "(", "String", "accountId", ",", "BillingPlanInformation", "billingPlanInformation", ",", "BillingApi", ".", "UpdatePlanOptions", "options", ")", "throws", "ApiException", "{", "Object", "localVarPostBody", "=", "billingP...
Updates the account billing plan. Updates the billing plan information, billing address, and credit card information for the specified account. @param accountId The external account number (int) or account ID Guid. (required) @param billingPlanInformation (optional) @param options for modifying the method behavior. @return BillingPlanUpdateResponse @throws ApiException if fails to make API call
[ "Updates", "the", "account", "billing", "plan", ".", "Updates", "the", "billing", "plan", "information", "billing", "address", "and", "credit", "card", "information", "for", "the", "specified", "account", "." ]
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/BillingApi.java#L705-L741
eobermuhlner/big-math
ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java
BigDecimalMath.acoth
public static BigDecimal acoth(BigDecimal x, MathContext mathContext) { checkMathContext(mathContext); MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); BigDecimal result = log(x.add(ONE, mc).divide(x.subtract(ONE, mc), mc), mc).divide(TWO, mc); return round(result, mathContext); }
java
public static BigDecimal acoth(BigDecimal x, MathContext mathContext) { checkMathContext(mathContext); MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); BigDecimal result = log(x.add(ONE, mc).divide(x.subtract(ONE, mc), mc), mc).divide(TWO, mc); return round(result, mathContext); }
[ "public", "static", "BigDecimal", "acoth", "(", "BigDecimal", "x", ",", "MathContext", "mathContext", ")", "{", "checkMathContext", "(", "mathContext", ")", ";", "MathContext", "mc", "=", "new", "MathContext", "(", "mathContext", ".", "getPrecision", "(", ")", ...
Calculates the arc hyperbolic cotangens (inverse hyperbolic cotangens) of {@link BigDecimal} x. <p>See: <a href="https://en.wikipedia.org/wiki/Hyperbolic_function">Wikipedia: Hyperbolic function</a></p> @param x the {@link BigDecimal} to calculate the arc hyperbolic cotangens for @param mathContext the {@link MathContext} used for the result @return the calculated arc hyperbolic cotangens {@link BigDecimal} with the precision specified in the <code>mathContext</code> @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision
[ "Calculates", "the", "arc", "hyperbolic", "cotangens", "(", "inverse", "hyperbolic", "cotangens", ")", "of", "{", "@link", "BigDecimal", "}", "x", "." ]
train
https://github.com/eobermuhlner/big-math/blob/52c4fc334d0d722b295de740c1018ee400e3e8f2/ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java#L1659-L1664
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java
NetworkWatchersInner.beginGetAzureReachabilityReportAsync
public Observable<AzureReachabilityReportInner> beginGetAzureReachabilityReportAsync(String resourceGroupName, String networkWatcherName, AzureReachabilityReportParameters parameters) { return beginGetAzureReachabilityReportWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<AzureReachabilityReportInner>, AzureReachabilityReportInner>() { @Override public AzureReachabilityReportInner call(ServiceResponse<AzureReachabilityReportInner> response) { return response.body(); } }); }
java
public Observable<AzureReachabilityReportInner> beginGetAzureReachabilityReportAsync(String resourceGroupName, String networkWatcherName, AzureReachabilityReportParameters parameters) { return beginGetAzureReachabilityReportWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<AzureReachabilityReportInner>, AzureReachabilityReportInner>() { @Override public AzureReachabilityReportInner call(ServiceResponse<AzureReachabilityReportInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "AzureReachabilityReportInner", ">", "beginGetAzureReachabilityReportAsync", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "AzureReachabilityReportParameters", "parameters", ")", "{", "return", "beginGetAzureReachabilit...
Gets the relative latency score for internet service providers from a specified location to Azure regions. @param resourceGroupName The name of the network watcher resource group. @param networkWatcherName The name of the network watcher resource. @param parameters Parameters that determine Azure reachability report configuration. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the AzureReachabilityReportInner object
[ "Gets", "the", "relative", "latency", "score", "for", "internet", "service", "providers", "from", "a", "specified", "location", "to", "Azure", "regions", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L2410-L2417
liyiorg/weixin-popular
src/main/java/weixin/popular/api/ShakeAroundAPI.java
ShakeAroundAPI.deviceSearch
public static DeviceSearchResult deviceSearch(String accessToken, DeviceSearch deviceSearch) { return deviceSearch(accessToken, JsonUtil.toJSONString(deviceSearch)); }
java
public static DeviceSearchResult deviceSearch(String accessToken, DeviceSearch deviceSearch) { return deviceSearch(accessToken, JsonUtil.toJSONString(deviceSearch)); }
[ "public", "static", "DeviceSearchResult", "deviceSearch", "(", "String", "accessToken", ",", "DeviceSearch", "deviceSearch", ")", "{", "return", "deviceSearch", "(", "accessToken", ",", "JsonUtil", ".", "toJSONString", "(", "deviceSearch", ")", ")", ";", "}" ]
查询设备列表 @param accessToken accessToken @param deviceSearch deviceSearch @return result
[ "查询设备列表" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/ShakeAroundAPI.java#L506-L509
rhuss/jolokia
agent/core/src/main/java/org/jolokia/handler/JsonRequestHandler.java
JsonRequestHandler.checkForModifiedSince
protected void checkForModifiedSince(MBeanServerExecutor pServerManager, JmxRequest pRequest) throws NotChangedException { int ifModifiedSince = pRequest.getParameterAsInt(ConfigKey.IF_MODIFIED_SINCE); if (!pServerManager.hasMBeansListChangedSince(ifModifiedSince)) { throw new NotChangedException(pRequest); } }
java
protected void checkForModifiedSince(MBeanServerExecutor pServerManager, JmxRequest pRequest) throws NotChangedException { int ifModifiedSince = pRequest.getParameterAsInt(ConfigKey.IF_MODIFIED_SINCE); if (!pServerManager.hasMBeansListChangedSince(ifModifiedSince)) { throw new NotChangedException(pRequest); } }
[ "protected", "void", "checkForModifiedSince", "(", "MBeanServerExecutor", "pServerManager", ",", "JmxRequest", "pRequest", ")", "throws", "NotChangedException", "{", "int", "ifModifiedSince", "=", "pRequest", ".", "getParameterAsInt", "(", "ConfigKey", ".", "IF_MODIFIED_S...
Check, whether the set of MBeans for any managed MBeanServer has been change since the timestamp provided in the given request @param pServerManager manager for all MBeanServers @param pRequest the request from where to fetch the timestamp @throws NotChangedException if there has been no REGISTER/UNREGISTER notifications in the meantime
[ "Check", "whether", "the", "set", "of", "MBeans", "for", "any", "managed", "MBeanServer", "has", "been", "change", "since", "the", "timestamp", "provided", "in", "the", "given", "request" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/handler/JsonRequestHandler.java#L208-L214
jbundle/jbundle
thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/mem/serial/SDatabase.java
SDatabase.makeNewPTable
public PTable makeNewPTable(FieldList record, Object lookupKey) { InputStream istream = null; try { if (lookupKey instanceof String) istream = this.openSerialStream(record, (String)lookupKey); if (istream != null) { ObjectInputStream q = new ObjectInputStream(istream); MTable sTable = (MTable)q.readObject(); q.close(); // Is this necessary? sTable.init(this, record, lookupKey); return sTable; } } catch (Exception ex) { System.out.println("Error " + ex.getMessage() + " on read serial file: " + lookupKey); //+Util.getLogger().warning("Error " + ex.getMessage() + " on read serial file: " + lookupKey); } finally { try { if (istream != null) istream.close(); } catch (IOException e) { } } return new MTable(this, record, lookupKey); // New empty table }
java
public PTable makeNewPTable(FieldList record, Object lookupKey) { InputStream istream = null; try { if (lookupKey instanceof String) istream = this.openSerialStream(record, (String)lookupKey); if (istream != null) { ObjectInputStream q = new ObjectInputStream(istream); MTable sTable = (MTable)q.readObject(); q.close(); // Is this necessary? sTable.init(this, record, lookupKey); return sTable; } } catch (Exception ex) { System.out.println("Error " + ex.getMessage() + " on read serial file: " + lookupKey); //+Util.getLogger().warning("Error " + ex.getMessage() + " on read serial file: " + lookupKey); } finally { try { if (istream != null) istream.close(); } catch (IOException e) { } } return new MTable(this, record, lookupKey); // New empty table }
[ "public", "PTable", "makeNewPTable", "(", "FieldList", "record", ",", "Object", "lookupKey", ")", "{", "InputStream", "istream", "=", "null", ";", "try", "{", "if", "(", "lookupKey", "instanceof", "String", ")", "istream", "=", "this", ".", "openSerialStream",...
Create a raw data table for this table. @param table The table to create a raw data table for. @param key The lookup key that will be passed (on initialization) to the new raw data table. @return The new raw data table.
[ "Create", "a", "raw", "data", "table", "for", "this", "table", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/mem/serial/SDatabase.java#L67-L95
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.updateRelationsForResource
public void updateRelationsForResource(CmsRequestContext context, CmsResource resource, List<CmsLink> relations) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { m_driverManager.updateRelationsForResource(dbc, resource, relations); } catch (Exception e) { dbc.report( null, Messages.get().container(Messages.ERR_UPDATE_RELATIONS_1, dbc.removeSiteRoot(resource.getRootPath())), e); } finally { dbc.clear(); } }
java
public void updateRelationsForResource(CmsRequestContext context, CmsResource resource, List<CmsLink> relations) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { m_driverManager.updateRelationsForResource(dbc, resource, relations); } catch (Exception e) { dbc.report( null, Messages.get().container(Messages.ERR_UPDATE_RELATIONS_1, dbc.removeSiteRoot(resource.getRootPath())), e); } finally { dbc.clear(); } }
[ "public", "void", "updateRelationsForResource", "(", "CmsRequestContext", "context", ",", "CmsResource", "resource", ",", "List", "<", "CmsLink", ">", "relations", ")", "throws", "CmsException", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "getDbContext...
Updates/Creates the relations for the given resource.<p> @param context the current user context @param resource the resource to update the relations for @param relations the relations to update @throws CmsException if something goes wrong @see CmsDriverManager#updateRelationsForResource(CmsDbContext, CmsResource, List)
[ "Updates", "/", "Creates", "the", "relations", "for", "the", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L6490-L6504
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/LocalUnitsManager.java
LocalUnitsManager.unitMap
public static <T> T unitMap(Function<Map<String, List<Unit>>, T> function) { readWriteLock.readLock().lock(); try { return function.apply(Collections.unmodifiableMap(unitMap)); } finally { readWriteLock.readLock().unlock(); } }
java
public static <T> T unitMap(Function<Map<String, List<Unit>>, T> function) { readWriteLock.readLock().lock(); try { return function.apply(Collections.unmodifiableMap(unitMap)); } finally { readWriteLock.readLock().unlock(); } }
[ "public", "static", "<", "T", ">", "T", "unitMap", "(", "Function", "<", "Map", "<", "String", ",", "List", "<", "Unit", ">", ">", ",", "T", ">", "function", ")", "{", "readWriteLock", ".", "readLock", "(", ")", ".", "lock", "(", ")", ";", "try",...
Iterate the {@link #unitMap local unit map} thread-safely. This iteration is for you to read the map, not to modify the map. @param function the function whatever you want to do with the unit map.
[ "Iterate", "the", "{", "@link", "#unitMap", "local", "unit", "map", "}", "thread", "-", "safely", ".", "This", "iteration", "is", "for", "you", "to", "read", "the", "map", "not", "to", "modify", "the", "map", "." ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/LocalUnitsManager.java#L213-L220
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java
SDBaseOps.matchCondition
public SDVariable matchCondition(SDVariable in, Condition condition) { return matchCondition(null, in, condition); }
java
public SDVariable matchCondition(SDVariable in, Condition condition) { return matchCondition(null, in, condition); }
[ "public", "SDVariable", "matchCondition", "(", "SDVariable", "in", ",", "Condition", "condition", ")", "{", "return", "matchCondition", "(", "null", ",", "in", ",", "condition", ")", ";", "}" ]
Returns a boolean mask of equal shape to the input, where the condition is satisfied - value 1 where satisfied, 0 otherwise @param in Input variable @param condition Condition @return Boolean mask mariable
[ "Returns", "a", "boolean", "mask", "of", "equal", "shape", "to", "the", "input", "where", "the", "condition", "is", "satisfied", "-", "value", "1", "where", "satisfied", "0", "otherwise" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L974-L976
motown-io/motown
ocpp/websocket-json/src/main/java/io/motown/ocpp/websocketjson/wamp/WampMessageParser.java
WampMessageParser.parseMessage
public WampMessage parseMessage(ChargingStationId chargingStationId, Reader reader) throws IOException { String rawMessage = this.convertToString(reader); String trimmedMessage = this.removeBrackets(rawMessage); //In case a payload is present, it always is the last part of the message int payloadStart = trimmedMessage.indexOf("{"); String payload = payloadStart > 0 ? trimmedMessage.substring(payloadStart) : null; String metaData = payloadStart > 0 ? trimmedMessage.substring(0, payloadStart) : trimmedMessage; String[] metaDataParts = metaData.split(","); int messageType = Integer.parseInt(removeQuotesAndTrim(metaDataParts[0])); String callId = removeQuotes(removeQuotesAndTrim(metaDataParts[1])); WampMessage wampMessage; switch (messageType) { case WampMessage.CALL: MessageProcUri procUri = MessageProcUri.fromValue(removeQuotesAndTrim(metaDataParts[2])); wampMessage = new WampMessage(messageType, callId, procUri, payload); if (wampMessageHandler != null) { wampMessageHandler.handleWampCall(chargingStationId.getId(), rawMessage, callId); } break; case WampMessage.CALL_RESULT: wampMessage = new WampMessage(messageType, callId, payload); if (wampMessageHandler != null) { wampMessageHandler.handleWampCallResult(chargingStationId.getId(), rawMessage, callId); } break; case WampMessage.CALL_ERROR: String errorCode = removeQuotes(metaDataParts[2]); String errorDescription = removeQuotes(metaDataParts[3]); String errorDetails = removeQuotes(metaDataParts[4]); wampMessage = new WampMessage(messageType, callId, errorCode, errorDescription, errorDetails); if (wampMessageHandler != null) { wampMessageHandler.handleWampCallError(chargingStationId.getId(), rawMessage, callId); } break; default: if (wampMessageHandler != null) { wampMessageHandler.handle(chargingStationId.getId(), rawMessage); } throw new IllegalArgumentException(String.format("Unknown WAMP messageType: %s", messageType)); } return wampMessage; }
java
public WampMessage parseMessage(ChargingStationId chargingStationId, Reader reader) throws IOException { String rawMessage = this.convertToString(reader); String trimmedMessage = this.removeBrackets(rawMessage); //In case a payload is present, it always is the last part of the message int payloadStart = trimmedMessage.indexOf("{"); String payload = payloadStart > 0 ? trimmedMessage.substring(payloadStart) : null; String metaData = payloadStart > 0 ? trimmedMessage.substring(0, payloadStart) : trimmedMessage; String[] metaDataParts = metaData.split(","); int messageType = Integer.parseInt(removeQuotesAndTrim(metaDataParts[0])); String callId = removeQuotes(removeQuotesAndTrim(metaDataParts[1])); WampMessage wampMessage; switch (messageType) { case WampMessage.CALL: MessageProcUri procUri = MessageProcUri.fromValue(removeQuotesAndTrim(metaDataParts[2])); wampMessage = new WampMessage(messageType, callId, procUri, payload); if (wampMessageHandler != null) { wampMessageHandler.handleWampCall(chargingStationId.getId(), rawMessage, callId); } break; case WampMessage.CALL_RESULT: wampMessage = new WampMessage(messageType, callId, payload); if (wampMessageHandler != null) { wampMessageHandler.handleWampCallResult(chargingStationId.getId(), rawMessage, callId); } break; case WampMessage.CALL_ERROR: String errorCode = removeQuotes(metaDataParts[2]); String errorDescription = removeQuotes(metaDataParts[3]); String errorDetails = removeQuotes(metaDataParts[4]); wampMessage = new WampMessage(messageType, callId, errorCode, errorDescription, errorDetails); if (wampMessageHandler != null) { wampMessageHandler.handleWampCallError(chargingStationId.getId(), rawMessage, callId); } break; default: if (wampMessageHandler != null) { wampMessageHandler.handle(chargingStationId.getId(), rawMessage); } throw new IllegalArgumentException(String.format("Unknown WAMP messageType: %s", messageType)); } return wampMessage; }
[ "public", "WampMessage", "parseMessage", "(", "ChargingStationId", "chargingStationId", ",", "Reader", "reader", ")", "throws", "IOException", "{", "String", "rawMessage", "=", "this", ".", "convertToString", "(", "reader", ")", ";", "String", "trimmedMessage", "=",...
Parses a CALL, RESULT, or ERROR message and constructs a WampMessage @param chargingStationId sending the message @param reader containing the message @return WampMessage @throws IOException in case the message could not be read @throws IllegalArgumentException in case an unknown wamp messageType is encountered
[ "Parses", "a", "CALL", "RESULT", "or", "ERROR", "message", "and", "constructs", "a", "WampMessage" ]
train
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/ocpp/websocket-json/src/main/java/io/motown/ocpp/websocketjson/wamp/WampMessageParser.java#L42-L86
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java
HtmlTableRendererBase.renderCaptionFacet
protected void renderCaptionFacet(FacesContext facesContext, ResponseWriter writer, UIComponent component) throws IOException { HtmlRendererUtils.renderTableCaption(facesContext, writer, component); }
java
protected void renderCaptionFacet(FacesContext facesContext, ResponseWriter writer, UIComponent component) throws IOException { HtmlRendererUtils.renderTableCaption(facesContext, writer, component); }
[ "protected", "void", "renderCaptionFacet", "(", "FacesContext", "facesContext", ",", "ResponseWriter", "writer", ",", "UIComponent", "component", ")", "throws", "IOException", "{", "HtmlRendererUtils", ".", "renderTableCaption", "(", "facesContext", ",", "writer", ",", ...
Renders the caption facet. @param facesContext the <code>FacesContext</code>. @param writer the <code>ResponseWriter</code>. @param component the parent <code>UIComponent</code> containing the facets. @throws IOException if an exception occurs.
[ "Renders", "the", "caption", "facet", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java#L220-L224
grails/grails-core
grails-encoder/src/main/groovy/org/grails/encoder/AbstractEncodedAppender.java
AbstractEncodedAppender.encodeAndWrite
protected void encodeAndWrite(Encoder encoder, EncodingState newEncodingState, CharSequence input) throws IOException { Object encoded = encoder.encode(input); if (encoded != null) { String encodedStr = String.valueOf(encoded); write(newEncodingState, encodedStr, 0, encodedStr.length()); } }
java
protected void encodeAndWrite(Encoder encoder, EncodingState newEncodingState, CharSequence input) throws IOException { Object encoded = encoder.encode(input); if (encoded != null) { String encodedStr = String.valueOf(encoded); write(newEncodingState, encodedStr, 0, encodedStr.length()); } }
[ "protected", "void", "encodeAndWrite", "(", "Encoder", "encoder", ",", "EncodingState", "newEncodingState", ",", "CharSequence", "input", ")", "throws", "IOException", "{", "Object", "encoded", "=", "encoder", ".", "encode", "(", "input", ")", ";", "if", "(", ...
Encode and write input to buffer using a non-streaming encoder @param encoder the encoder to use @param newEncodingState the new encoding state after encoder has been applied @param input the input CharSequence @throws IOException Signals that an I/O exception has occurred.
[ "Encode", "and", "write", "input", "to", "buffer", "using", "a", "non", "-", "streaming", "encoder" ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-encoder/src/main/groovy/org/grails/encoder/AbstractEncodedAppender.java#L192-L199
Javacord/Javacord
javacord-api/src/main/java/org/javacord/api/entity/message/embed/EmbedBuilder.java
EmbedBuilder.setFooter
public EmbedBuilder setFooter(String text, InputStream icon) { delegate.setFooter(text, icon); return this; }
java
public EmbedBuilder setFooter(String text, InputStream icon) { delegate.setFooter(text, icon); return this; }
[ "public", "EmbedBuilder", "setFooter", "(", "String", "text", ",", "InputStream", "icon", ")", "{", "delegate", ".", "setFooter", "(", "text", ",", "icon", ")", ";", "return", "this", ";", "}" ]
Sets the footer of the embed. This method assumes the file type is "png"! @param text The text of the footer. @param icon The footer's icon. @return The current instance in order to chain call methods.
[ "Sets", "the", "footer", "of", "the", "embed", ".", "This", "method", "assumes", "the", "file", "type", "is", "png", "!" ]
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/entity/message/embed/EmbedBuilder.java#L156-L159
threerings/nenya
core/src/main/java/com/threerings/media/AbstractMediaManager.java
AbstractMediaManager.viewLocationDidChange
public void viewLocationDidChange (int dx, int dy) { // let our media know for (int ii = 0, ll = _media.size(); ii < ll; ii++) { _media.get(ii).viewLocationDidChange(dx, dy); } }
java
public void viewLocationDidChange (int dx, int dy) { // let our media know for (int ii = 0, ll = _media.size(); ii < ll; ii++) { _media.get(ii).viewLocationDidChange(dx, dy); } }
[ "public", "void", "viewLocationDidChange", "(", "int", "dx", ",", "int", "dy", ")", "{", "// let our media know", "for", "(", "int", "ii", "=", "0", ",", "ll", "=", "_media", ".", "size", "(", ")", ";", "ii", "<", "ll", ";", "ii", "++", ")", "{", ...
Called by a {@link VirtualMediaPanel} when the view that contains our media is scrolled. @param dx the scrolled distance in the x direction (in pixels). @param dy the scrolled distance in the y direction (in pixels).
[ "Called", "by", "a", "{", "@link", "VirtualMediaPanel", "}", "when", "the", "view", "that", "contains", "our", "media", "is", "scrolled", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/AbstractMediaManager.java#L151-L157
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/aromaticity/Aromaticity.java
Aromaticity.findBonds
public Set<IBond> findBonds(IAtomContainer molecule) throws CDKException { // build graph data-structures for fast cycle perception final EdgeToBondMap bondMap = EdgeToBondMap.withSpaceFor(molecule); final int[][] graph = GraphUtil.toAdjList(molecule, bondMap); // initial ring/cycle search and get the contribution from each atom final RingSearch ringSearch = new RingSearch(molecule, graph); final int[] electrons = model.contribution(molecule, ringSearch); final Set<IBond> bonds = Sets.newHashSetWithExpectedSize(molecule.getBondCount()); // obtain the subset of electron contributions which are >= 0 (i.e. // allowed to be aromatic) - we then find the cycles in this subgraph // and 'lift' the indices back to the original graph using the subset // as a lookup final int[] subset = subset(electrons); final int[][] subgraph = GraphUtil.subgraph(graph, subset); // for each cycle if the electron sum is valid add the bonds of the // cycle to the set or aromatic bonds for (final int[] cycle : cycles.find(molecule, subgraph, subgraph.length).paths()) { if (checkElectronSum(cycle, electrons, subset)) { for (int i = 1; i < cycle.length; i++) { bonds.add(bondMap.get(subset[cycle[i]], subset[cycle[i - 1]])); } } } return bonds; }
java
public Set<IBond> findBonds(IAtomContainer molecule) throws CDKException { // build graph data-structures for fast cycle perception final EdgeToBondMap bondMap = EdgeToBondMap.withSpaceFor(molecule); final int[][] graph = GraphUtil.toAdjList(molecule, bondMap); // initial ring/cycle search and get the contribution from each atom final RingSearch ringSearch = new RingSearch(molecule, graph); final int[] electrons = model.contribution(molecule, ringSearch); final Set<IBond> bonds = Sets.newHashSetWithExpectedSize(molecule.getBondCount()); // obtain the subset of electron contributions which are >= 0 (i.e. // allowed to be aromatic) - we then find the cycles in this subgraph // and 'lift' the indices back to the original graph using the subset // as a lookup final int[] subset = subset(electrons); final int[][] subgraph = GraphUtil.subgraph(graph, subset); // for each cycle if the electron sum is valid add the bonds of the // cycle to the set or aromatic bonds for (final int[] cycle : cycles.find(molecule, subgraph, subgraph.length).paths()) { if (checkElectronSum(cycle, electrons, subset)) { for (int i = 1; i < cycle.length; i++) { bonds.add(bondMap.get(subset[cycle[i]], subset[cycle[i - 1]])); } } } return bonds; }
[ "public", "Set", "<", "IBond", ">", "findBonds", "(", "IAtomContainer", "molecule", ")", "throws", "CDKException", "{", "// build graph data-structures for fast cycle perception", "final", "EdgeToBondMap", "bondMap", "=", "EdgeToBondMap", ".", "withSpaceFor", "(", "molecu...
Find the bonds of a {@code molecule} which this model determined were aromatic. <blockquote><pre>{@code Aromaticity aromaticity = new Aromaticity(ElectronDonation.cdk(), Cycles.all()); IAtomContainer container = ...; try { Set<IBond> bonds = aromaticity.findBonds(container); int nAromaticBonds = bonds.size(); } catch (CDKException e) { // cycle computation was intractable } }</pre></blockquote> @param molecule the molecule to apply the model to @return the set of bonds which are aromatic @throws CDKException a problem occurred with the cycle perception - one can retry with a simpler cycle set
[ "Find", "the", "bonds", "of", "a", "{", "@code", "molecule", "}", "which", "this", "model", "determined", "were", "aromatic", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/aromaticity/Aromaticity.java#L179-L209
shrinkwrap/resolver
api/src/main/java/org/jboss/shrinkwrap/resolver/api/Invokable.java
Invokable.invokeMethod
Object invokeMethod(String name, Class<?>[] parameterTypes, Object instance, Object[] parameters) throws InvocationException { try { return findMethod(name, parameterTypes).invoke(instance, parameters); } catch (IllegalAccessException e) { throw new InvocationException(e, "Unable to invoke {0}({1}) on object {2} with parameters {3}", name, parameterTypes, instance == null ? "" : instance.getClass().getName(), parameters); } catch (IllegalArgumentException e) { throw new InvocationException(e, "Unable to invoke {0}({1}) on object {2} with parameters {3}", name, parameterTypes, instance == null ? "" : instance.getClass().getName(), parameters); } catch (InvocationTargetException e) { throw new InvocationException(e, "Unable to invoke {0}({1}) on object {2} with parameters {3}", name, parameterTypes, instance == null ? "" : instance.getClass().getName(), parameters); } catch (SecurityException e) { throw new InvocationException(e, "Unable to invoke {0}({1}) on object {2} with parameters {3}", name, parameterTypes, instance == null ? "" : instance.getClass().getName(), parameters); } catch (InvocationException e) { throw new InvocationException(e, "Unable to invoke {0}({1}) on object {2} with parameters {3}", name, parameterTypes, instance == null ? "" : instance.getClass().getName(), parameters); } }
java
Object invokeMethod(String name, Class<?>[] parameterTypes, Object instance, Object[] parameters) throws InvocationException { try { return findMethod(name, parameterTypes).invoke(instance, parameters); } catch (IllegalAccessException e) { throw new InvocationException(e, "Unable to invoke {0}({1}) on object {2} with parameters {3}", name, parameterTypes, instance == null ? "" : instance.getClass().getName(), parameters); } catch (IllegalArgumentException e) { throw new InvocationException(e, "Unable to invoke {0}({1}) on object {2} with parameters {3}", name, parameterTypes, instance == null ? "" : instance.getClass().getName(), parameters); } catch (InvocationTargetException e) { throw new InvocationException(e, "Unable to invoke {0}({1}) on object {2} with parameters {3}", name, parameterTypes, instance == null ? "" : instance.getClass().getName(), parameters); } catch (SecurityException e) { throw new InvocationException(e, "Unable to invoke {0}({1}) on object {2} with parameters {3}", name, parameterTypes, instance == null ? "" : instance.getClass().getName(), parameters); } catch (InvocationException e) { throw new InvocationException(e, "Unable to invoke {0}({1}) on object {2} with parameters {3}", name, parameterTypes, instance == null ? "" : instance.getClass().getName(), parameters); } }
[ "Object", "invokeMethod", "(", "String", "name", ",", "Class", "<", "?", ">", "[", "]", "parameterTypes", ",", "Object", "instance", ",", "Object", "[", "]", "parameters", ")", "throws", "InvocationException", "{", "try", "{", "return", "findMethod", "(", ...
Invokes method on class registered within {@link Invokable}. It looks also for superclasses @param name name of the method @param parameterTypes parameter types of the method @param instance instance on which method is called, {@code null} for static methods @param parameters parameters for method invocation @return @throws InvocationException if method was not found or could not be invoked
[ "Invokes", "method", "on", "class", "registered", "within", "{", "@link", "Invokable", "}", ".", "It", "looks", "also", "for", "superclasses" ]
train
https://github.com/shrinkwrap/resolver/blob/e881a84b8cff5b0a014f2a5ebf612be3eb9db01f/api/src/main/java/org/jboss/shrinkwrap/resolver/api/Invokable.java#L97-L117
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ModelSerializer.java
ModelSerializer.addNormalizerToModel
public static void addNormalizerToModel(File f, Normalizer<?> normalizer) { File tempFile = null; try { // copy existing model to temporary file tempFile = DL4JFileUtils.createTempFile("dl4jModelSerializerTemp", "bin"); tempFile.deleteOnExit(); Files.copy(f, tempFile); try (ZipFile zipFile = new ZipFile(tempFile); ZipOutputStream writeFile = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(f)))) { // roll over existing files within model, and copy them one by one Enumeration<? extends ZipEntry> entries = zipFile.entries(); while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); // we're NOT copying existing normalizer, if any if (entry.getName().equalsIgnoreCase(NORMALIZER_BIN)) continue; log.debug("Copying: {}", entry.getName()); InputStream is = zipFile.getInputStream(entry); ZipEntry wEntry = new ZipEntry(entry.getName()); writeFile.putNextEntry(wEntry); IOUtils.copy(is, writeFile); } // now, add our normalizer as additional entry ZipEntry nEntry = new ZipEntry(NORMALIZER_BIN); writeFile.putNextEntry(nEntry); NormalizerSerializer.getDefault().write(normalizer, writeFile); } } catch (Exception ex) { throw new RuntimeException(ex); } finally { if (tempFile != null) { tempFile.delete(); } } }
java
public static void addNormalizerToModel(File f, Normalizer<?> normalizer) { File tempFile = null; try { // copy existing model to temporary file tempFile = DL4JFileUtils.createTempFile("dl4jModelSerializerTemp", "bin"); tempFile.deleteOnExit(); Files.copy(f, tempFile); try (ZipFile zipFile = new ZipFile(tempFile); ZipOutputStream writeFile = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(f)))) { // roll over existing files within model, and copy them one by one Enumeration<? extends ZipEntry> entries = zipFile.entries(); while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); // we're NOT copying existing normalizer, if any if (entry.getName().equalsIgnoreCase(NORMALIZER_BIN)) continue; log.debug("Copying: {}", entry.getName()); InputStream is = zipFile.getInputStream(entry); ZipEntry wEntry = new ZipEntry(entry.getName()); writeFile.putNextEntry(wEntry); IOUtils.copy(is, writeFile); } // now, add our normalizer as additional entry ZipEntry nEntry = new ZipEntry(NORMALIZER_BIN); writeFile.putNextEntry(nEntry); NormalizerSerializer.getDefault().write(normalizer, writeFile); } } catch (Exception ex) { throw new RuntimeException(ex); } finally { if (tempFile != null) { tempFile.delete(); } } }
[ "public", "static", "void", "addNormalizerToModel", "(", "File", "f", ",", "Normalizer", "<", "?", ">", "normalizer", ")", "{", "File", "tempFile", "=", "null", ";", "try", "{", "// copy existing model to temporary file", "tempFile", "=", "DL4JFileUtils", ".", "...
This method appends normalizer to a given persisted model. PLEASE NOTE: File should be model file saved earlier with ModelSerializer @param f @param normalizer
[ "This", "method", "appends", "normalizer", "to", "a", "given", "persisted", "model", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ModelSerializer.java#L731-L772
jhades/jhades
jhades/src/main/java/org/jhades/model/ClasspathResources.java
ClasspathResources.sortByNumberOfVersionsDesc
public static void sortByNumberOfVersionsDesc(List<ClasspathResource> resources) { // sort by number of version occurrences Comparator<ClasspathResource> sortByNumberOfVersionsDesc = new Comparator<ClasspathResource>() { @Override public int compare(ClasspathResource resource1, ClasspathResource resource2) { return -1 * new Integer(resource1.getResourceFileVersions().size()).compareTo(resource2.getResourceFileVersions().size()); } }; Collections.sort(resources, sortByNumberOfVersionsDesc); }
java
public static void sortByNumberOfVersionsDesc(List<ClasspathResource> resources) { // sort by number of version occurrences Comparator<ClasspathResource> sortByNumberOfVersionsDesc = new Comparator<ClasspathResource>() { @Override public int compare(ClasspathResource resource1, ClasspathResource resource2) { return -1 * new Integer(resource1.getResourceFileVersions().size()).compareTo(resource2.getResourceFileVersions().size()); } }; Collections.sort(resources, sortByNumberOfVersionsDesc); }
[ "public", "static", "void", "sortByNumberOfVersionsDesc", "(", "List", "<", "ClasspathResource", ">", "resources", ")", "{", "// sort by number of version occurrences", "Comparator", "<", "ClasspathResource", ">", "sortByNumberOfVersionsDesc", "=", "new", "Comparator", "<",...
Takes a list of classpath resources and sorts them by the number of classpath versions. The resources with the biggest number of versions will be first on the list. @param resources to be sorted
[ "Takes", "a", "list", "of", "classpath", "resources", "and", "sorts", "them", "by", "the", "number", "of", "classpath", "versions", "." ]
train
https://github.com/jhades/jhades/blob/51e20b7d67f51697f947fcab94494c93f6bf1b01/jhades/src/main/java/org/jhades/model/ClasspathResources.java#L53-L62
trellis-ldp/trellis
auth/basic/src/main/java/org/trellisldp/auth/basic/Credentials.java
Credentials.parse
public static Credentials parse(final String encoded) { try { final String decoded = new String(Base64.getDecoder().decode(encoded), UTF_8); final String[] parts = decoded.split(":", 2); if (parts.length == 2) { return new Credentials(parts[0], parts[1]); } } catch (final IllegalArgumentException ex) { // log error } return null; }
java
public static Credentials parse(final String encoded) { try { final String decoded = new String(Base64.getDecoder().decode(encoded), UTF_8); final String[] parts = decoded.split(":", 2); if (parts.length == 2) { return new Credentials(parts[0], parts[1]); } } catch (final IllegalArgumentException ex) { // log error } return null; }
[ "public", "static", "Credentials", "parse", "(", "final", "String", "encoded", ")", "{", "try", "{", "final", "String", "decoded", "=", "new", "String", "(", "Base64", ".", "getDecoder", "(", ")", ".", "decode", "(", "encoded", ")", ",", "UTF_8", ")", ...
Create a set of credentials. @param encoded the encoded header @return credentials or null on error
[ "Create", "a", "set", "of", "credentials", "." ]
train
https://github.com/trellis-ldp/trellis/blob/789fd7a3df86cab7ebba63e72bf4e58397e5f42d/auth/basic/src/main/java/org/trellisldp/auth/basic/Credentials.java#L55-L66
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/factory/H2GISFunctions.java
H2GISFunctions.getBooleanProperty
private static boolean getBooleanProperty(Function function, String propertyKey, boolean defaultValue) { Object value = function.getProperty(propertyKey); return value instanceof Boolean ? (Boolean)value : defaultValue; }
java
private static boolean getBooleanProperty(Function function, String propertyKey, boolean defaultValue) { Object value = function.getProperty(propertyKey); return value instanceof Boolean ? (Boolean)value : defaultValue; }
[ "private", "static", "boolean", "getBooleanProperty", "(", "Function", "function", ",", "String", "propertyKey", ",", "boolean", "defaultValue", ")", "{", "Object", "value", "=", "function", ".", "getProperty", "(", "propertyKey", ")", ";", "return", "value", "i...
Return a boolean property of the function @param function @param propertyKey @param defaultValue @return
[ "Return", "a", "boolean", "property", "of", "the", "function" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/factory/H2GISFunctions.java#L430-L433
calimero-project/calimero-core
src/tuwien/auto/calimero/mgmt/ManagementClientImpl.java
ManagementClientImpl.readProperty2
List<byte[]> readProperty2(final Destination dst, final int objIndex, final int propertyId, final int start, final int elements) throws KNXTimeoutException, KNXRemoteException, KNXDisconnectException, KNXLinkClosedException, InterruptedException { return readProperty(dst, objIndex, propertyId, start, elements, false); }
java
List<byte[]> readProperty2(final Destination dst, final int objIndex, final int propertyId, final int start, final int elements) throws KNXTimeoutException, KNXRemoteException, KNXDisconnectException, KNXLinkClosedException, InterruptedException { return readProperty(dst, objIndex, propertyId, start, elements, false); }
[ "List", "<", "byte", "[", "]", ">", "readProperty2", "(", "final", "Destination", "dst", ",", "final", "int", "objIndex", ",", "final", "int", "propertyId", ",", "final", "int", "start", ",", "final", "int", "elements", ")", "throws", "KNXTimeoutException", ...
as readProperty, but collects all responses until response timeout is reached
[ "as", "readProperty", "but", "collects", "all", "responses", "until", "response", "timeout", "is", "reached" ]
train
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/mgmt/ManagementClientImpl.java#L624-L629
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java
JDBC4CallableStatement.setBlob
@Override public void setBlob(String parameterName, Blob x) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
java
@Override public void setBlob(String parameterName, Blob x) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
[ "@", "Override", "public", "void", "setBlob", "(", "String", "parameterName", ",", "Blob", "x", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "throw", "SQLError", ".", "noSupport", "(", ")", ";", "}" ]
Sets the designated parameter to the given java.sql.Blob object.
[ "Sets", "the", "designated", "parameter", "to", "the", "given", "java", ".", "sql", ".", "Blob", "object", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java#L623-L628
threerings/narya
core/src/main/java/com/threerings/presents/dobj/DObject.java
DObject.updateSet
public void updateSet (String setName, DSet.Entry entry) { requestEntryUpdate(setName, getSet(setName), entry); }
java
public void updateSet (String setName, DSet.Entry entry) { requestEntryUpdate(setName, getSet(setName), entry); }
[ "public", "void", "updateSet", "(", "String", "setName", ",", "DSet", ".", "Entry", "entry", ")", "{", "requestEntryUpdate", "(", "setName", ",", "getSet", "(", "setName", ")", ",", "entry", ")", ";", "}" ]
Request to have the specified item updated in the specified DSet.
[ "Request", "to", "have", "the", "specified", "item", "updated", "in", "the", "specified", "DSet", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L275-L278
OpenLiberty/open-liberty
dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterEndpointServices.java
TwitterEndpointServices.obtainRequestToken
public Map<String, Object> obtainRequestToken(SocialLoginConfig config, String callbackUrl) { String endpointUrl = config.getRequestTokenUrl(); try { SocialUtil.validateEndpointWithQuery(endpointUrl); } catch (SocialLoginException e) { return createErrorResponse("TWITTER_BAD_REQUEST_TOKEN_URL", new Object[] { endpointUrl, TwitterLoginConfigImpl.KEY_requestTokenUrl, config.getUniqueId(), e.getLocalizedMessage() }); } // Create the Authorization header string necessary to authenticate the request String authzHeaderString = createAuthzHeaderForRequestTokenEndpoint(callbackUrl, endpointUrl); if (tc.isDebugEnabled()) { Tr.debug(tc, "Authz header string: " + authzHeaderString); } return executeRequest(config, requestMethod, authzHeaderString, endpointUrl, TwitterConstants.TWITTER_ENDPOINT_REQUEST_TOKEN, null); }
java
public Map<String, Object> obtainRequestToken(SocialLoginConfig config, String callbackUrl) { String endpointUrl = config.getRequestTokenUrl(); try { SocialUtil.validateEndpointWithQuery(endpointUrl); } catch (SocialLoginException e) { return createErrorResponse("TWITTER_BAD_REQUEST_TOKEN_URL", new Object[] { endpointUrl, TwitterLoginConfigImpl.KEY_requestTokenUrl, config.getUniqueId(), e.getLocalizedMessage() }); } // Create the Authorization header string necessary to authenticate the request String authzHeaderString = createAuthzHeaderForRequestTokenEndpoint(callbackUrl, endpointUrl); if (tc.isDebugEnabled()) { Tr.debug(tc, "Authz header string: " + authzHeaderString); } return executeRequest(config, requestMethod, authzHeaderString, endpointUrl, TwitterConstants.TWITTER_ENDPOINT_REQUEST_TOKEN, null); }
[ "public", "Map", "<", "String", ",", "Object", ">", "obtainRequestToken", "(", "SocialLoginConfig", "config", ",", "String", "callbackUrl", ")", "{", "String", "endpointUrl", "=", "config", ".", "getRequestTokenUrl", "(", ")", ";", "try", "{", "SocialUtil", "....
Invokes the {@value TwitterConstants#TWITTER_ENDPOINT_REQUEST_TOKEN} endpoint in order to obtain a request token. The request is authorized for the consumer key set by the class and the callback URL provided to the method. The appropriate consumer key must be set before invoking this method in order to obtain a request token for the correct consumer. For more information, see {@link https://dev.twitter.com/oauth/reference/post/oauth/request_token}. @param config @param callbackUrl @return
[ "Invokes", "the", "{", "@value", "TwitterConstants#TWITTER_ENDPOINT_REQUEST_TOKEN", "}", "endpoint", "in", "order", "to", "obtain", "a", "request", "token", ".", "The", "request", "is", "authorized", "for", "the", "consumer", "key", "set", "by", "the", "class", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterEndpointServices.java#L914-L930
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java
SimpleDateFormat.fastZeroPaddingNumber
private void fastZeroPaddingNumber(StringBuffer buf, int value, int minDigits, int maxDigits) { int limit = decimalBuf.length < maxDigits ? decimalBuf.length : maxDigits; int index = limit - 1; while (true) { decimalBuf[index] = decDigits[(value % 10)]; value /= 10; if (index == 0 || value == 0) { break; } index--; } int padding = minDigits - (limit - index); while (padding > 0 && index > 0) { decimalBuf[--index] = decDigits[0]; padding--; } while (padding > 0) { // when pattern width is longer than decimalBuf, need extra // leading zeros - ticke#7595 buf.append(decDigits[0]); padding--; } buf.append(decimalBuf, index, limit - index); }
java
private void fastZeroPaddingNumber(StringBuffer buf, int value, int minDigits, int maxDigits) { int limit = decimalBuf.length < maxDigits ? decimalBuf.length : maxDigits; int index = limit - 1; while (true) { decimalBuf[index] = decDigits[(value % 10)]; value /= 10; if (index == 0 || value == 0) { break; } index--; } int padding = minDigits - (limit - index); while (padding > 0 && index > 0) { decimalBuf[--index] = decDigits[0]; padding--; } while (padding > 0) { // when pattern width is longer than decimalBuf, need extra // leading zeros - ticke#7595 buf.append(decDigits[0]); padding--; } buf.append(decimalBuf, index, limit - index); }
[ "private", "void", "fastZeroPaddingNumber", "(", "StringBuffer", "buf", ",", "int", "value", ",", "int", "minDigits", ",", "int", "maxDigits", ")", "{", "int", "limit", "=", "decimalBuf", ".", "length", "<", "maxDigits", "?", "decimalBuf", ".", "length", ":"...
/* Lightweight zero padding integer number format function. Note: This implementation is almost equivalent to format method in DateNumberFormat. In the method zeroPaddingNumber above should be able to use the one in DateNumberFormat, but, it does not help IBM J9's JIT to optimize the performance much. In simple repeative date format test case, having local implementation is ~10% faster than using one in DateNumberFormat on IBM J9 VM. On Sun Hotspot VM, I do not see such difference. -Yoshito
[ "/", "*", "Lightweight", "zero", "padding", "integer", "number", "format", "function", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java#L2259-L2282
SeleniumHQ/selenium
java/client/src/org/openqa/selenium/interactions/touch/TouchActions.java
TouchActions.singleTap
public TouchActions singleTap(WebElement onElement) { if (touchScreen != null) { action.addAction(new SingleTapAction(touchScreen, (Locatable) onElement)); } tick(touchPointer.createPointerDown(0)); tick(touchPointer.createPointerUp(0)); return this; }
java
public TouchActions singleTap(WebElement onElement) { if (touchScreen != null) { action.addAction(new SingleTapAction(touchScreen, (Locatable) onElement)); } tick(touchPointer.createPointerDown(0)); tick(touchPointer.createPointerUp(0)); return this; }
[ "public", "TouchActions", "singleTap", "(", "WebElement", "onElement", ")", "{", "if", "(", "touchScreen", "!=", "null", ")", "{", "action", ".", "addAction", "(", "new", "SingleTapAction", "(", "touchScreen", ",", "(", "Locatable", ")", "onElement", ")", ")...
Allows the execution of single tap on the screen, analogous to click using a Mouse. @param onElement the {@link WebElement} on the screen. @return self
[ "Allows", "the", "execution", "of", "single", "tap", "on", "the", "screen", "analogous", "to", "click", "using", "a", "Mouse", "." ]
train
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/interactions/touch/TouchActions.java#L54-L61
StripesFramework/stripes-stuff
src/main/java/org/stripesstuff/plugin/security/InstanceBasedSecurityManager.java
InstanceBasedSecurityManager.hasRoleName
protected Boolean hasRoleName(ActionBean bean, Method handler, String roleName) { // Let our superclass check if the user has the required role. return super.hasRole(bean, handler, roleName); }
java
protected Boolean hasRoleName(ActionBean bean, Method handler, String roleName) { // Let our superclass check if the user has the required role. return super.hasRole(bean, handler, roleName); }
[ "protected", "Boolean", "hasRoleName", "(", "ActionBean", "bean", ",", "Method", "handler", ",", "String", "roleName", ")", "{", "// Let our superclass check if the user has the required role.", "return", "super", ".", "hasRole", "(", "bean", ",", "handler", ",", "rol...
Checks to see if the user has an individual role by name. The default is to use the parent class and call {@code super.hasRole(bean,roleName)}. When subclassing {@link InstanceBasedSecurityManager}, override this method instead of {@link #hasRole(ActionBean, Method, String)} to keep using the EL expression logic but change how to verify if a user has an individual role name. @param bean the current action bean @param handler the current event handler @param roleName the name of the role to check @return {@code true} if the user has the role, and {@code false} otherwise
[ "Checks", "to", "see", "if", "the", "user", "has", "an", "individual", "role", "by", "name", ".", "The", "default", "is", "to", "use", "the", "parent", "class", "and", "call", "{", "@code", "super", ".", "hasRole", "(", "bean", "roleName", ")", "}", ...
train
https://github.com/StripesFramework/stripes-stuff/blob/51ad92b4bd5862ba34d7c18c5829fb00ea3a3811/src/main/java/org/stripesstuff/plugin/security/InstanceBasedSecurityManager.java#L106-L110
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyStore.java
KeyStore.getInstance
public static KeyStore getInstance(String type) throws KeyStoreException { try { Object[] objs = Security.getImpl(type, "KeyStore", (String)null); return new KeyStore((KeyStoreSpi)objs[0], (Provider)objs[1], type); } catch (NoSuchAlgorithmException nsae) { throw new KeyStoreException(type + " not found", nsae); } catch (NoSuchProviderException nspe) { throw new KeyStoreException(type + " not found", nspe); } }
java
public static KeyStore getInstance(String type) throws KeyStoreException { try { Object[] objs = Security.getImpl(type, "KeyStore", (String)null); return new KeyStore((KeyStoreSpi)objs[0], (Provider)objs[1], type); } catch (NoSuchAlgorithmException nsae) { throw new KeyStoreException(type + " not found", nsae); } catch (NoSuchProviderException nspe) { throw new KeyStoreException(type + " not found", nspe); } }
[ "public", "static", "KeyStore", "getInstance", "(", "String", "type", ")", "throws", "KeyStoreException", "{", "try", "{", "Object", "[", "]", "objs", "=", "Security", ".", "getImpl", "(", "type", ",", "\"KeyStore\"", ",", "(", "String", ")", "null", ")", ...
Returns a keystore object of the specified type. <p> This method traverses the list of registered security Providers, starting with the most preferred Provider. A new KeyStore object encapsulating the KeyStoreSpi implementation from the first Provider that supports the specified type is returned. <p> Note that the list of registered providers may be retrieved via the {@link Security#getProviders() Security.getProviders()} method. @param type the type of keystore. See the KeyStore section in the <a href= "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#KeyStore"> Java Cryptography Architecture Standard Algorithm Name Documentation</a> for information about standard keystore types. @return a keystore object of the specified type. @exception KeyStoreException if no Provider supports a KeyStoreSpi implementation for the specified type. @see Provider
[ "Returns", "a", "keystore", "object", "of", "the", "specified", "type", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyStore.java#L651-L662
google/auto
common/src/main/java/com/google/auto/common/AnnotationMirrors.java
AnnotationMirrors.getAnnotationValue
public static AnnotationValue getAnnotationValue( AnnotationMirror annotationMirror, String elementName) { return getAnnotationElementAndValue(annotationMirror, elementName).getValue(); }
java
public static AnnotationValue getAnnotationValue( AnnotationMirror annotationMirror, String elementName) { return getAnnotationElementAndValue(annotationMirror, elementName).getValue(); }
[ "public", "static", "AnnotationValue", "getAnnotationValue", "(", "AnnotationMirror", "annotationMirror", ",", "String", "elementName", ")", "{", "return", "getAnnotationElementAndValue", "(", "annotationMirror", ",", "elementName", ")", ".", "getValue", "(", ")", ";", ...
Returns an {@link AnnotationValue} for the named element if such an element was either declared in the usage represented by the provided {@link AnnotationMirror}, or if such an element was defined with a default. @throws IllegalArgumentException if no element is defined with the given elementName.
[ "Returns", "an", "{", "@link", "AnnotationValue", "}", "for", "the", "named", "element", "if", "such", "an", "element", "was", "either", "declared", "in", "the", "usage", "represented", "by", "the", "provided", "{", "@link", "AnnotationMirror", "}", "or", "i...
train
https://github.com/google/auto/blob/4158a5fa71f1ef763e683b627f4d29bc04cfde9d/common/src/main/java/com/google/auto/common/AnnotationMirrors.java#L112-L115
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/stats/Counters.java
Counters.toVerticalString
public static <E> String toVerticalString(Counter<E> c, int k, String fmt, boolean swap) { PriorityQueue<E> q = Counters.toPriorityQueue(c); List<E> sortedKeys = q.toSortedList(); StringBuilder sb = new StringBuilder(); int i = 0; for (Iterator<E> keyI = sortedKeys.iterator(); keyI.hasNext() && i < k; i++) { E key = keyI.next(); double val = q.getPriority(key); if (swap) { sb.append(String.format(fmt, key, val)); } else { sb.append(String.format(fmt, val, key)); } if (keyI.hasNext()) { sb.append('\n'); } } return sb.toString(); }
java
public static <E> String toVerticalString(Counter<E> c, int k, String fmt, boolean swap) { PriorityQueue<E> q = Counters.toPriorityQueue(c); List<E> sortedKeys = q.toSortedList(); StringBuilder sb = new StringBuilder(); int i = 0; for (Iterator<E> keyI = sortedKeys.iterator(); keyI.hasNext() && i < k; i++) { E key = keyI.next(); double val = q.getPriority(key); if (swap) { sb.append(String.format(fmt, key, val)); } else { sb.append(String.format(fmt, val, key)); } if (keyI.hasNext()) { sb.append('\n'); } } return sb.toString(); }
[ "public", "static", "<", "E", ">", "String", "toVerticalString", "(", "Counter", "<", "E", ">", "c", ",", "int", "k", ",", "String", "fmt", ",", "boolean", "swap", ")", "{", "PriorityQueue", "<", "E", ">", "q", "=", "Counters", ".", "toPriorityQueue", ...
Returns a <code>String</code> representation of the <code>k</code> keys with the largest counts in the given {@link Counter}, using the given format string. @param c a Counter @param k how many keys to print @param fmt a format string, such as "%.0f\t%s" (do not include final "%n") @param swap whether the count should appear after the key
[ "Returns", "a", "<code", ">", "String<", "/", "code", ">", "representation", "of", "the", "<code", ">", "k<", "/", "code", ">", "keys", "with", "the", "largest", "counts", "in", "the", "given", "{", "@link", "Counter", "}", "using", "the", "given", "fo...
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/Counters.java#L1942-L1960
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/Format.java
Format.atol
public static long atol( String s ) { int i = 0; while( i < s.length() && Character.isWhitespace(s.charAt(i)) ) { i++; } if (i < s.length() && s.charAt(i) == '0') { if (i + 1 < s.length() && (s.charAt(i + 1) == 'x' || s.charAt(i + 1) == 'X')) { return parseLong(s.substring(i + 2), 16); } else { return parseLong(s, 8); } } else { return parseLong(s, 10); } }
java
public static long atol( String s ) { int i = 0; while( i < s.length() && Character.isWhitespace(s.charAt(i)) ) { i++; } if (i < s.length() && s.charAt(i) == '0') { if (i + 1 < s.length() && (s.charAt(i + 1) == 'x' || s.charAt(i + 1) == 'X')) { return parseLong(s.substring(i + 2), 16); } else { return parseLong(s, 8); } } else { return parseLong(s, 10); } }
[ "public", "static", "long", "atol", "(", "String", "s", ")", "{", "int", "i", "=", "0", ";", "while", "(", "i", "<", "s", ".", "length", "(", ")", "&&", "Character", ".", "isWhitespace", "(", "s", ".", "charAt", "(", "i", ")", ")", ")", "{", ...
Converts a string of digits (decimal, octal or hex) to a long integer @param s a string @return the numeric value of the prefix of s representing a base 10 integer
[ "Converts", "a", "string", "of", "digits", "(", "decimal", "octal", "or", "hex", ")", "to", "a", "long", "integer" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/Format.java#L699-L714
snowflakedb/snowflake-jdbc
src/main/java/net/snowflake/client/core/IncidentUtil.java
IncidentUtil.dumpVmMetrics
public static void dumpVmMetrics(String incidentId) { PrintWriter writer = null; try { String dumpFile = EventUtil.getDumpPathPrefix() + "/" + INC_DUMP_FILE_NAME + incidentId + INC_DUMP_FILE_EXT; final OutputStream outStream = new GZIPOutputStream(new FileOutputStream(dumpFile)); writer = new PrintWriter(outStream, true); final VirtualMachineMetrics vm = VirtualMachineMetrics.getInstance(); writer.print("\n\n\n--------------------------- METRICS " + "---------------------------\n\n"); writer.flush(); JsonFactory jf = new JsonFactory(); jf.disable(JsonGenerator.Feature.AUTO_CLOSE_TARGET); ObjectMapper mapper = new ObjectMapper(jf); mapper.registerModule(new JodaModule()); mapper.setDateFormat(new ISO8601DateFormat()); mapper.configure(SerializationFeature.INDENT_OUTPUT, true); MetricsServlet metrics = new MetricsServlet(Clock.defaultClock(), vm, Metrics.defaultRegistry(), jf, true); final JsonGenerator json = jf.createGenerator(outStream, JsonEncoding.UTF8); json.useDefaultPrettyPrinter(); json.writeStartObject(); // JVM metrics writeVmMetrics(json, vm); // Components metrics metrics.writeRegularMetrics(json, // json generator null, // class prefix false); // include full samples json.writeEndObject(); json.close(); logger.debug("Creating full thread dump in dump file {}", dumpFile); // Thread dump next.... writer.print("\n\n\n--------------------------- THREAD DUMP " + "---------------------------\n\n"); writer.flush(); vm.threadDump(outStream); logger.debug("Dump file {} is created.", dumpFile); } catch (Exception exc) { logger.error( "Unable to write dump file, exception: {}", exc.getMessage()); } finally { if (writer != null) { writer.close(); } } }
java
public static void dumpVmMetrics(String incidentId) { PrintWriter writer = null; try { String dumpFile = EventUtil.getDumpPathPrefix() + "/" + INC_DUMP_FILE_NAME + incidentId + INC_DUMP_FILE_EXT; final OutputStream outStream = new GZIPOutputStream(new FileOutputStream(dumpFile)); writer = new PrintWriter(outStream, true); final VirtualMachineMetrics vm = VirtualMachineMetrics.getInstance(); writer.print("\n\n\n--------------------------- METRICS " + "---------------------------\n\n"); writer.flush(); JsonFactory jf = new JsonFactory(); jf.disable(JsonGenerator.Feature.AUTO_CLOSE_TARGET); ObjectMapper mapper = new ObjectMapper(jf); mapper.registerModule(new JodaModule()); mapper.setDateFormat(new ISO8601DateFormat()); mapper.configure(SerializationFeature.INDENT_OUTPUT, true); MetricsServlet metrics = new MetricsServlet(Clock.defaultClock(), vm, Metrics.defaultRegistry(), jf, true); final JsonGenerator json = jf.createGenerator(outStream, JsonEncoding.UTF8); json.useDefaultPrettyPrinter(); json.writeStartObject(); // JVM metrics writeVmMetrics(json, vm); // Components metrics metrics.writeRegularMetrics(json, // json generator null, // class prefix false); // include full samples json.writeEndObject(); json.close(); logger.debug("Creating full thread dump in dump file {}", dumpFile); // Thread dump next.... writer.print("\n\n\n--------------------------- THREAD DUMP " + "---------------------------\n\n"); writer.flush(); vm.threadDump(outStream); logger.debug("Dump file {} is created.", dumpFile); } catch (Exception exc) { logger.error( "Unable to write dump file, exception: {}", exc.getMessage()); } finally { if (writer != null) { writer.close(); } } }
[ "public", "static", "void", "dumpVmMetrics", "(", "String", "incidentId", ")", "{", "PrintWriter", "writer", "=", "null", ";", "try", "{", "String", "dumpFile", "=", "EventUtil", ".", "getDumpPathPrefix", "(", ")", "+", "\"/\"", "+", "INC_DUMP_FILE_NAME", "+",...
Dumps JVM metrics for this process. @param incidentId incident id
[ "Dumps", "JVM", "metrics", "for", "this", "process", "." ]
train
https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/IncidentUtil.java#L83-L151
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeFormatter.java
DateTimeFormatter.ofLocalizedDateTime
public static DateTimeFormatter ofLocalizedDateTime(FormatStyle dateStyle, FormatStyle timeStyle) { Objects.requireNonNull(dateStyle, "dateStyle"); Objects.requireNonNull(timeStyle, "timeStyle"); return new DateTimeFormatterBuilder().appendLocalized(dateStyle, timeStyle) .toFormatter(ResolverStyle.SMART, IsoChronology.INSTANCE); }
java
public static DateTimeFormatter ofLocalizedDateTime(FormatStyle dateStyle, FormatStyle timeStyle) { Objects.requireNonNull(dateStyle, "dateStyle"); Objects.requireNonNull(timeStyle, "timeStyle"); return new DateTimeFormatterBuilder().appendLocalized(dateStyle, timeStyle) .toFormatter(ResolverStyle.SMART, IsoChronology.INSTANCE); }
[ "public", "static", "DateTimeFormatter", "ofLocalizedDateTime", "(", "FormatStyle", "dateStyle", ",", "FormatStyle", "timeStyle", ")", "{", "Objects", ".", "requireNonNull", "(", "dateStyle", ",", "\"dateStyle\"", ")", ";", "Objects", ".", "requireNonNull", "(", "ti...
Returns a locale specific date and time format for the ISO chronology. <p> This returns a formatter that will format or parse a date-time. The exact format pattern used varies by locale. <p> The locale is determined from the formatter. The formatter returned directly by this method will use the {@link Locale#getDefault() default FORMAT locale}. The locale can be controlled using {@link DateTimeFormatter#withLocale(Locale) withLocale(Locale)} on the result of this method. <p> Note that the localized pattern is looked up lazily. This {@code DateTimeFormatter} holds the style required and the locale, looking up the pattern required on demand. <p> The returned formatter has a chronology of ISO set to ensure dates in other calendar systems are correctly converted. It has no override zone and uses the {@link ResolverStyle#SMART SMART} resolver style. @param dateStyle the date formatter style to obtain, not null @param timeStyle the time formatter style to obtain, not null @return the date, time or date-time formatter, not null
[ "Returns", "a", "locale", "specific", "date", "and", "time", "format", "for", "the", "ISO", "chronology", ".", "<p", ">", "This", "returns", "a", "formatter", "that", "will", "format", "or", "parse", "a", "date", "-", "time", ".", "The", "exact", "format...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeFormatter.java#L671-L676
jenkinsci/java-client-api
jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java
JenkinsServer.renameJob
public JenkinsServer renameJob(String oldJobName, String newJobName, Boolean crumbFlag) throws IOException { renameJob(null, oldJobName, newJobName, crumbFlag); return this; }
java
public JenkinsServer renameJob(String oldJobName, String newJobName, Boolean crumbFlag) throws IOException { renameJob(null, oldJobName, newJobName, crumbFlag); return this; }
[ "public", "JenkinsServer", "renameJob", "(", "String", "oldJobName", ",", "String", "newJobName", ",", "Boolean", "crumbFlag", ")", "throws", "IOException", "{", "renameJob", "(", "null", ",", "oldJobName", ",", "newJobName", ",", "crumbFlag", ")", ";", "return"...
Rename a job @param oldJobName existing job name. @param newJobName The new job name. @param crumbFlag <code>true</code> to add <b>crumbIssuer</b> <code>false</code> otherwise. @throws IOException In case of a failure.
[ "Rename", "a", "job" ]
train
https://github.com/jenkinsci/java-client-api/blob/c4f5953d3d4dda92cd946ad3bf2b811524c32da9/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java#L874-L877
Prototik/HoloEverywhere
library/src/android/support/v7/internal/view/menu/MenuBuilder.java
MenuBuilder.removeItemAtInt
private void removeItemAtInt(int index, boolean updateChildrenOnMenuViews) { if ((index < 0) || (index >= mItems.size())) { return; } mItems.remove(index); if (updateChildrenOnMenuViews) { onItemsChanged(true); } }
java
private void removeItemAtInt(int index, boolean updateChildrenOnMenuViews) { if ((index < 0) || (index >= mItems.size())) { return; } mItems.remove(index); if (updateChildrenOnMenuViews) { onItemsChanged(true); } }
[ "private", "void", "removeItemAtInt", "(", "int", "index", ",", "boolean", "updateChildrenOnMenuViews", ")", "{", "if", "(", "(", "index", "<", "0", ")", "||", "(", "index", ">=", "mItems", ".", "size", "(", ")", ")", ")", "{", "return", ";", "}", "m...
Remove the item at the given index and optionally forces menu views to update. @param index The index of the item to be removed. If this index is invalid an exception is thrown. @param updateChildrenOnMenuViews Whether to force update on menu views. Please make sure you eventually call this after your batch of removals.
[ "Remove", "the", "item", "at", "the", "given", "index", "and", "optionally", "forces", "menu", "views", "to", "update", "." ]
train
https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/android/support/v7/internal/view/menu/MenuBuilder.java#L520-L530
zxing/zxing
core/src/main/java/com/google/zxing/common/detector/WhiteRectangleDetector.java
WhiteRectangleDetector.centerEdges
private ResultPoint[] centerEdges(ResultPoint y, ResultPoint z, ResultPoint x, ResultPoint t) { // // t t // z x // x OR z // y y // float yi = y.getX(); float yj = y.getY(); float zi = z.getX(); float zj = z.getY(); float xi = x.getX(); float xj = x.getY(); float ti = t.getX(); float tj = t.getY(); if (yi < width / 2.0f) { return new ResultPoint[]{ new ResultPoint(ti - CORR, tj + CORR), new ResultPoint(zi + CORR, zj + CORR), new ResultPoint(xi - CORR, xj - CORR), new ResultPoint(yi + CORR, yj - CORR)}; } else { return new ResultPoint[]{ new ResultPoint(ti + CORR, tj + CORR), new ResultPoint(zi + CORR, zj - CORR), new ResultPoint(xi - CORR, xj + CORR), new ResultPoint(yi - CORR, yj - CORR)}; } }
java
private ResultPoint[] centerEdges(ResultPoint y, ResultPoint z, ResultPoint x, ResultPoint t) { // // t t // z x // x OR z // y y // float yi = y.getX(); float yj = y.getY(); float zi = z.getX(); float zj = z.getY(); float xi = x.getX(); float xj = x.getY(); float ti = t.getX(); float tj = t.getY(); if (yi < width / 2.0f) { return new ResultPoint[]{ new ResultPoint(ti - CORR, tj + CORR), new ResultPoint(zi + CORR, zj + CORR), new ResultPoint(xi - CORR, xj - CORR), new ResultPoint(yi + CORR, yj - CORR)}; } else { return new ResultPoint[]{ new ResultPoint(ti + CORR, tj + CORR), new ResultPoint(zi + CORR, zj - CORR), new ResultPoint(xi - CORR, xj + CORR), new ResultPoint(yi - CORR, yj - CORR)}; } }
[ "private", "ResultPoint", "[", "]", "centerEdges", "(", "ResultPoint", "y", ",", "ResultPoint", "z", ",", "ResultPoint", "x", ",", "ResultPoint", "t", ")", "{", "//", "// t t", "// z x", "// x OR z", "// y ...
recenters the points of a constant distance towards the center @param y bottom most point @param z left most point @param x right most point @param t top most point @return {@link ResultPoint}[] describing the corners of the rectangular region. The first and last points are opposed on the diagonal, as are the second and third. The first point will be the topmost point and the last, the bottommost. The second point will be leftmost and the third, the rightmost
[ "recenters", "the", "points", "of", "a", "constant", "distance", "towards", "the", "center" ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/common/detector/WhiteRectangleDetector.java#L263-L295
gallandarakhneorg/afc
advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/xml/XMLGISElementUtil.java
XMLGISElementUtil.writeMapElement
public static Element writeMapElement(MapElement primitive, XMLBuilder builder, XMLResources resources) throws IOException { return writeMapElement(primitive, null, builder, resources); }
java
public static Element writeMapElement(MapElement primitive, XMLBuilder builder, XMLResources resources) throws IOException { return writeMapElement(primitive, null, builder, resources); }
[ "public", "static", "Element", "writeMapElement", "(", "MapElement", "primitive", ",", "XMLBuilder", "builder", ",", "XMLResources", "resources", ")", "throws", "IOException", "{", "return", "writeMapElement", "(", "primitive", ",", "null", ",", "builder", ",", "r...
Write the XML description for the given map element. @param primitive is the map element to output. @param builder is the tool to create XML nodes. @param resources is the tool that permits to gather the resources. @return the XML node of the map element. @throws IOException in case of error.
[ "Write", "the", "XML", "description", "for", "the", "given", "map", "element", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/xml/XMLGISElementUtil.java#L140-L142
Swagger2Markup/swagger2markup
src/main/java/io/github/swagger2markup/internal/document/DefinitionsDocument.java
DefinitionsDocument.applyDefinitionComponent
private void applyDefinitionComponent(MarkupDocBuilder markupDocBuilder, String definitionName, Model model) { definitionComponent.apply(markupDocBuilder, DefinitionComponent.parameters( definitionName, model, 2)); }
java
private void applyDefinitionComponent(MarkupDocBuilder markupDocBuilder, String definitionName, Model model) { definitionComponent.apply(markupDocBuilder, DefinitionComponent.parameters( definitionName, model, 2)); }
[ "private", "void", "applyDefinitionComponent", "(", "MarkupDocBuilder", "markupDocBuilder", ",", "String", "definitionName", ",", "Model", "model", ")", "{", "definitionComponent", ".", "apply", "(", "markupDocBuilder", ",", "DefinitionComponent", ".", "parameters", "("...
Builds a concrete definition @param markupDocBuilder the markupDocBuilder do use for output @param definitionName the name of the definition @param model the Swagger Model of the definition
[ "Builds", "a", "concrete", "definition" ]
train
https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/internal/document/DefinitionsDocument.java#L159-L164
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/VirtualWANsInner.java
VirtualWANsInner.updateTagsAsync
public Observable<VirtualWANInner> updateTagsAsync(String resourceGroupName, String virtualWANName, Map<String, String> tags) { return updateTagsWithServiceResponseAsync(resourceGroupName, virtualWANName, tags).map(new Func1<ServiceResponse<VirtualWANInner>, VirtualWANInner>() { @Override public VirtualWANInner call(ServiceResponse<VirtualWANInner> response) { return response.body(); } }); }
java
public Observable<VirtualWANInner> updateTagsAsync(String resourceGroupName, String virtualWANName, Map<String, String> tags) { return updateTagsWithServiceResponseAsync(resourceGroupName, virtualWANName, tags).map(new Func1<ServiceResponse<VirtualWANInner>, VirtualWANInner>() { @Override public VirtualWANInner call(ServiceResponse<VirtualWANInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualWANInner", ">", "updateTagsAsync", "(", "String", "resourceGroupName", ",", "String", "virtualWANName", ",", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "updateTagsWithServiceResponseAsync", "(", "resour...
Updates a VirtualWAN tags. @param resourceGroupName The resource group name of the VirtualWan. @param virtualWANName The name of the VirtualWAN being updated. @param tags Resource tags. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Updates", "a", "VirtualWAN", "tags", "." ]
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/VirtualWANsInner.java#L475-L482
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/Config.java
Config.getMapEventJournalConfig
public EventJournalConfig getMapEventJournalConfig(String name) { return ConfigUtils.getConfig(configPatternMatcher, mapEventJournalConfigs, name, EventJournalConfig.class, new BiConsumer<EventJournalConfig, String>() { @Override public void accept(EventJournalConfig eventJournalConfig, String name) { eventJournalConfig.setMapName(name); if ("default".equals(name)) { eventJournalConfig.setEnabled(false); } } }); }
java
public EventJournalConfig getMapEventJournalConfig(String name) { return ConfigUtils.getConfig(configPatternMatcher, mapEventJournalConfigs, name, EventJournalConfig.class, new BiConsumer<EventJournalConfig, String>() { @Override public void accept(EventJournalConfig eventJournalConfig, String name) { eventJournalConfig.setMapName(name); if ("default".equals(name)) { eventJournalConfig.setEnabled(false); } } }); }
[ "public", "EventJournalConfig", "getMapEventJournalConfig", "(", "String", "name", ")", "{", "return", "ConfigUtils", ".", "getConfig", "(", "configPatternMatcher", ",", "mapEventJournalConfigs", ",", "name", ",", "EventJournalConfig", ".", "class", ",", "new", "BiCon...
Returns the map event journal config for the given name, creating one if necessary and adding it to the collection of known configurations. <p> The configuration is found by matching the configuration name pattern to the provided {@code name} without the partition qualifier (the part of the name after {@code '@'}). If no configuration matches, it will create one by cloning the {@code "default"} configuration and add it to the configuration collection. <p> If there is no default config as well, it will create one and disable the event journal by default. This method is intended to easily and fluently create and add configurations more specific than the default configuration without explicitly adding it by invoking {@link #addEventJournalConfig(EventJournalConfig)}. <p> Because it adds new configurations if they are not already present, this method is intended to be used before this config is used to create a hazelcast instance. Afterwards, newly added configurations may be ignored. @param name name of the map event journal config @return the map event journal configuration @throws ConfigurationException if ambiguous configurations are found @see StringPartitioningStrategy#getBaseName(java.lang.String) @see #setConfigPatternMatcher(ConfigPatternMatcher) @see #getConfigPatternMatcher()
[ "Returns", "the", "map", "event", "journal", "config", "for", "the", "given", "name", "creating", "one", "if", "necessary", "and", "adding", "it", "to", "the", "collection", "of", "known", "configurations", ".", "<p", ">", "The", "configuration", "is", "foun...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L2817-L2828
Azure/azure-sdk-for-java
applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/FavoritesInner.java
FavoritesInner.listAsync
public Observable<List<ApplicationInsightsComponentFavoriteInner>> listAsync(String resourceGroupName, String resourceName) { return listWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<List<ApplicationInsightsComponentFavoriteInner>>, List<ApplicationInsightsComponentFavoriteInner>>() { @Override public List<ApplicationInsightsComponentFavoriteInner> call(ServiceResponse<List<ApplicationInsightsComponentFavoriteInner>> response) { return response.body(); } }); }
java
public Observable<List<ApplicationInsightsComponentFavoriteInner>> listAsync(String resourceGroupName, String resourceName) { return listWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<List<ApplicationInsightsComponentFavoriteInner>>, List<ApplicationInsightsComponentFavoriteInner>>() { @Override public List<ApplicationInsightsComponentFavoriteInner> call(ServiceResponse<List<ApplicationInsightsComponentFavoriteInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "ApplicationInsightsComponentFavoriteInner", ">", ">", "listAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ")", "{", "return", "listWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceNam...
Gets a list of favorites defined within an Application Insights component. @param resourceGroupName The name of the resource group. @param resourceName The name of the Application Insights component resource. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;ApplicationInsightsComponentFavoriteInner&gt; object
[ "Gets", "a", "list", "of", "favorites", "defined", "within", "an", "Application", "Insights", "component", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/FavoritesInner.java#L120-L127
stapler/stapler
core/src/main/java/org/kohsuke/stapler/config/ConfigurationLoader.java
ConfigurationLoader.fromEnvironmentVariables
public static ConfigurationLoader fromEnvironmentVariables() throws IOException { TreeMap<String, String> m = new TreeMap<String, String>(new Comparator<String>() { public int compare(String o1, String o2) { return o1.compareToIgnoreCase(o2); } }); m.putAll(System.getenv()); return from(m); }
java
public static ConfigurationLoader fromEnvironmentVariables() throws IOException { TreeMap<String, String> m = new TreeMap<String, String>(new Comparator<String>() { public int compare(String o1, String o2) { return o1.compareToIgnoreCase(o2); } }); m.putAll(System.getenv()); return from(m); }
[ "public", "static", "ConfigurationLoader", "fromEnvironmentVariables", "(", ")", "throws", "IOException", "{", "TreeMap", "<", "String", ",", "String", ">", "m", "=", "new", "TreeMap", "<", "String", ",", "String", ">", "(", "new", "Comparator", "<", "String",...
Creates {@link ConfigurationLoader} that uses environment variables as the source. Since environment variables are often by convention all caps, while system properties and other properties tend to be camel cased, this method creates a case-insensitive configuration (that allows retrievals by both "path" and "PATH" to fill this gap.
[ "Creates", "{", "@link", "ConfigurationLoader", "}", "that", "uses", "environment", "variables", "as", "the", "source", "." ]
train
https://github.com/stapler/stapler/blob/11ad5af185e062fb46e01bf9fbed66f3ebf2a8f7/core/src/main/java/org/kohsuke/stapler/config/ConfigurationLoader.java#L111-L119
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/mail/MailUtil.java
MailUtil.sendHtml
public static void sendHtml(Collection<String> tos, String subject, String content, File... files) { send(tos, subject, content, true, files); }
java
public static void sendHtml(Collection<String> tos, String subject, String content, File... files) { send(tos, subject, content, true, files); }
[ "public", "static", "void", "sendHtml", "(", "Collection", "<", "String", ">", "tos", ",", "String", "subject", ",", "String", "content", ",", "File", "...", "files", ")", "{", "send", "(", "tos", ",", "subject", ",", "content", ",", "true", ",", "file...
使用配置文件中设置的账户发送HTML邮件,发送给多人 @param tos 收件人列表 @param subject 标题 @param content 正文 @param files 附件列表 @since 3.2.0
[ "使用配置文件中设置的账户发送HTML邮件,发送给多人" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/mail/MailUtil.java#L98-L100
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/ContentKeyPoliciesInner.java
ContentKeyPoliciesInner.getPolicyPropertiesWithSecrets
public ContentKeyPolicyPropertiesInner getPolicyPropertiesWithSecrets(String resourceGroupName, String accountName, String contentKeyPolicyName) { return getPolicyPropertiesWithSecretsWithServiceResponseAsync(resourceGroupName, accountName, contentKeyPolicyName).toBlocking().single().body(); }
java
public ContentKeyPolicyPropertiesInner getPolicyPropertiesWithSecrets(String resourceGroupName, String accountName, String contentKeyPolicyName) { return getPolicyPropertiesWithSecretsWithServiceResponseAsync(resourceGroupName, accountName, contentKeyPolicyName).toBlocking().single().body(); }
[ "public", "ContentKeyPolicyPropertiesInner", "getPolicyPropertiesWithSecrets", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "contentKeyPolicyName", ")", "{", "return", "getPolicyPropertiesWithSecretsWithServiceResponseAsync", "(", "resourceGroupN...
Get a Content Key Policy with secrets. Get a Content Key Policy including secret values. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param contentKeyPolicyName The Content Key Policy name. @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ContentKeyPolicyPropertiesInner object if successful.
[ "Get", "a", "Content", "Key", "Policy", "with", "secrets", ".", "Get", "a", "Content", "Key", "Policy", "including", "secret", "values", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/ContentKeyPoliciesInner.java#L781-L783
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java
AppServicePlansInner.getVnetGateway
public VnetGatewayInner getVnetGateway(String resourceGroupName, String name, String vnetName, String gatewayName) { return getVnetGatewayWithServiceResponseAsync(resourceGroupName, name, vnetName, gatewayName).toBlocking().single().body(); }
java
public VnetGatewayInner getVnetGateway(String resourceGroupName, String name, String vnetName, String gatewayName) { return getVnetGatewayWithServiceResponseAsync(resourceGroupName, name, vnetName, gatewayName).toBlocking().single().body(); }
[ "public", "VnetGatewayInner", "getVnetGateway", "(", "String", "resourceGroupName", ",", "String", "name", ",", "String", "vnetName", ",", "String", "gatewayName", ")", "{", "return", "getVnetGatewayWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ",", ...
Get a Virtual Network gateway. Get a Virtual Network gateway. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @param vnetName Name of the Virtual Network. @param gatewayName Name of the gateway. Only the 'primary' gateway is supported. @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 VnetGatewayInner object if successful.
[ "Get", "a", "Virtual", "Network", "gateway", ".", "Get", "a", "Virtual", "Network", "gateway", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L3174-L3176
elki-project/elki
elki-core/src/main/java/de/lmu/ifi/dbs/elki/evaluation/scores/ROCEvaluation.java
ROCEvaluation.computeROCAUC
public static <I extends ScoreIter> double computeROCAUC(Predicate<? super I> predicate, I iter) { int poscnt = 0, negcnt = 0, pospre = 0, negpre = 0; double acc = 0.; while(iter.valid()) { // positive or negative match? do { if(predicate.test(iter)) { ++poscnt; } else { ++negcnt; } iter.advance(); } // Loop while tied: while(iter.valid() && iter.tiedToPrevious()); if(negcnt > negpre) { acc += (poscnt + pospre) * .5 * (negcnt - negpre); negpre = negcnt; } pospre = poscnt; } acc /= negcnt * (long) poscnt; return acc == acc ? acc : 0.5; /* Detect NaN */ }
java
public static <I extends ScoreIter> double computeROCAUC(Predicate<? super I> predicate, I iter) { int poscnt = 0, negcnt = 0, pospre = 0, negpre = 0; double acc = 0.; while(iter.valid()) { // positive or negative match? do { if(predicate.test(iter)) { ++poscnt; } else { ++negcnt; } iter.advance(); } // Loop while tied: while(iter.valid() && iter.tiedToPrevious()); if(negcnt > negpre) { acc += (poscnt + pospre) * .5 * (negcnt - negpre); negpre = negcnt; } pospre = poscnt; } acc /= negcnt * (long) poscnt; return acc == acc ? acc : 0.5; /* Detect NaN */ }
[ "public", "static", "<", "I", "extends", "ScoreIter", ">", "double", "computeROCAUC", "(", "Predicate", "<", "?", "super", "I", ">", "predicate", ",", "I", "iter", ")", "{", "int", "poscnt", "=", "0", ",", "negcnt", "=", "0", ",", "pospre", "=", "0",...
Compute the area under the ROC curve given a set of positive IDs and a sorted list of (comparable, ID)s, where the comparable object is used to decided when two objects are interchangeable. @param <I> Iterator type @param predicate Predicate to test for positive objects @param iter Iterator over results, with ties. @return area under curve
[ "Compute", "the", "area", "under", "the", "ROC", "curve", "given", "a", "set", "of", "positive", "IDs", "and", "a", "sorted", "list", "of", "(", "comparable", "ID", ")", "s", "where", "the", "comparable", "object", "is", "used", "to", "decided", "when", ...
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core/src/main/java/de/lmu/ifi/dbs/elki/evaluation/scores/ROCEvaluation.java#L113-L136
guardtime/ksi-java-sdk
ksi-common/src/main/java/com/guardtime/ksi/hashing/DataHasher.java
DataHasher.getHash
public final DataHash getHash() { if (outputHash == null) { byte[] hash = messageDigest.digest(); outputHash = new DataHash(algorithm, hash); } return outputHash; }
java
public final DataHash getHash() { if (outputHash == null) { byte[] hash = messageDigest.digest(); outputHash = new DataHash(algorithm, hash); } return outputHash; }
[ "public", "final", "DataHash", "getHash", "(", ")", "{", "if", "(", "outputHash", "==", "null", ")", "{", "byte", "[", "]", "hash", "=", "messageDigest", ".", "digest", "(", ")", ";", "outputHash", "=", "new", "DataHash", "(", "algorithm", ",", "hash",...
Gets the final hash value for the digest. <p> This will not reset hash calculation.</p> @return hashValue with computed hash value. @throws HashException when exception occurs during hash calculation.
[ "Gets", "the", "final", "hash", "value", "for", "the", "digest", ".", "<p", ">", "This", "will", "not", "reset", "hash", "calculation", ".", "<", "/", "p", ">" ]
train
https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/hashing/DataHasher.java#L268-L274
lessthanoptimal/ejml
main/ejml-dsparse/src/org/ejml/sparse/csc/misc/TriangularSolver_DSCC.java
TriangularSolver_DSCC.solveL
public static void solveL(DMatrixSparseCSC L , double []x ) { final int N = L.numCols; int idx0 = L.col_idx[0]; for (int col = 0; col < N; col++) { int idx1 = L.col_idx[col+1]; double x_j = x[col] /= L.nz_values[idx0]; for (int i = idx0+1; i < idx1; i++) { int row = L.nz_rows[i]; x[row] -= L.nz_values[i]*x_j; } idx0 = idx1; } }
java
public static void solveL(DMatrixSparseCSC L , double []x ) { final int N = L.numCols; int idx0 = L.col_idx[0]; for (int col = 0; col < N; col++) { int idx1 = L.col_idx[col+1]; double x_j = x[col] /= L.nz_values[idx0]; for (int i = idx0+1; i < idx1; i++) { int row = L.nz_rows[i]; x[row] -= L.nz_values[i]*x_j; } idx0 = idx1; } }
[ "public", "static", "void", "solveL", "(", "DMatrixSparseCSC", "L", ",", "double", "[", "]", "x", ")", "{", "final", "int", "N", "=", "L", ".", "numCols", ";", "int", "idx0", "=", "L", ".", "col_idx", "[", "0", "]", ";", "for", "(", "int", "col",...
Solves for a lower triangular matrix against a dense matrix. L*x = b @param L Lower triangular matrix. Diagonal elements are assumed to be non-zero @param x (Input) Solution matrix 'b'. (Output) matrix 'x'
[ "Solves", "for", "a", "lower", "triangular", "matrix", "against", "a", "dense", "matrix", ".", "L", "*", "x", "=", "b" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/misc/TriangularSolver_DSCC.java#L40-L57
LachlanMcKee/gsonpath
library/src/main/java/gsonpath/GsonPath.java
GsonPath.createTypeAdapterFactory
public static TypeAdapterFactory createTypeAdapterFactory(Class<? extends TypeAdapterFactory> clazz) { String factoryClassName = clazz.getCanonicalName() + FACTORY_IMPLEMENTATION_SUFFIX; try { return (TypeAdapterFactory) Class.forName(factoryClassName).newInstance(); } catch (Exception e) { throw new IllegalStateException("Unable to instantiate generated TypeAdapterFactory '" + factoryClassName + "'", e); } }
java
public static TypeAdapterFactory createTypeAdapterFactory(Class<? extends TypeAdapterFactory> clazz) { String factoryClassName = clazz.getCanonicalName() + FACTORY_IMPLEMENTATION_SUFFIX; try { return (TypeAdapterFactory) Class.forName(factoryClassName).newInstance(); } catch (Exception e) { throw new IllegalStateException("Unable to instantiate generated TypeAdapterFactory '" + factoryClassName + "'", e); } }
[ "public", "static", "TypeAdapterFactory", "createTypeAdapterFactory", "(", "Class", "<", "?", "extends", "TypeAdapterFactory", ">", "clazz", ")", "{", "String", "factoryClassName", "=", "clazz", ".", "getCanonicalName", "(", ")", "+", "FACTORY_IMPLEMENTATION_SUFFIX", ...
Creates an instance of an {@link TypeAdapterFactory} implementation class that implements the input interface. <p> This factory is used to map the auto generated {@link com.google.gson.TypeAdapter} classes created using the {@link gsonpath.AutoGsonAdapter} annotation. <p> Only a single use of reflection is used within the constructor, so it isn't critical to hold onto this reference for later usage. @param clazz the type adatper class to use to find the concrete implementation. Ensure that the interface is annotated with {@link gsonpath.AutoGsonAdapterFactory} @return a new instance of the {@link TypeAdapterFactory} class
[ "Creates", "an", "instance", "of", "an", "{", "@link", "TypeAdapterFactory", "}", "implementation", "class", "that", "implements", "the", "input", "interface", ".", "<p", ">", "This", "factory", "is", "used", "to", "map", "the", "auto", "generated", "{", "@l...
train
https://github.com/LachlanMcKee/gsonpath/blob/7462869521b163684d66a07feef0ddbadc8949b5/library/src/main/java/gsonpath/GsonPath.java#L29-L36
exoplatform/jcr
exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/UserProfileHandlerImpl.java
UserProfileHandlerImpl.postSave
private void postSave(UserProfile userProfile, boolean isNew) throws Exception { for (UserProfileEventListener listener : listeners) { listener.postSave(userProfile, isNew); } }
java
private void postSave(UserProfile userProfile, boolean isNew) throws Exception { for (UserProfileEventListener listener : listeners) { listener.postSave(userProfile, isNew); } }
[ "private", "void", "postSave", "(", "UserProfile", "userProfile", ",", "boolean", "isNew", ")", "throws", "Exception", "{", "for", "(", "UserProfileEventListener", "listener", ":", "listeners", ")", "{", "listener", ".", "postSave", "(", "userProfile", ",", "isN...
Notifying listeners after profile creation. @param userProfile the user profile which is used in save operation @param isNew true if we have deal with new profile, otherwise it is false which mean update operation is in progress @throws Exception if any listener failed to handle the event
[ "Notifying", "listeners", "after", "profile", "creation", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/UserProfileHandlerImpl.java#L427-L433
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java
HadoopUtils.deserializeFsPermission
public static FsPermission deserializeFsPermission(State props, String propName, FsPermission defaultPermission) { short mode = props.getPropAsShortWithRadix(propName, defaultPermission.toShort(), ConfigurationKeys.PERMISSION_PARSING_RADIX); return new FsPermission(mode); }
java
public static FsPermission deserializeFsPermission(State props, String propName, FsPermission defaultPermission) { short mode = props.getPropAsShortWithRadix(propName, defaultPermission.toShort(), ConfigurationKeys.PERMISSION_PARSING_RADIX); return new FsPermission(mode); }
[ "public", "static", "FsPermission", "deserializeFsPermission", "(", "State", "props", ",", "String", "propName", ",", "FsPermission", "defaultPermission", ")", "{", "short", "mode", "=", "props", ".", "getPropAsShortWithRadix", "(", "propName", ",", "defaultPermission...
Get {@link FsPermission} from a {@link State} object. @param props A {@link State} containing properties. @param propName The property name for the permission. If not contained in the given state, defaultPermission will be used. @param defaultPermission default permission if propName is not contained in props. @return An {@link FsPermission} object.
[ "Get", "{", "@link", "FsPermission", "}", "from", "a", "{", "@link", "State", "}", "object", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java#L909-L913
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java
ShapeGenerator.createInternalDropShadowRounded
public Shape createInternalDropShadowRounded(final int x, final int y, final int w, final int h) { final double radius = h / 2; final int right = x + w; final double bottom = y + radius; path.reset(); // Upper edge. path.moveTo(x, bottom); path.quadTo(x, y, x + radius, y); path.lineTo(right - radius, y); path.quadTo(right, y, right, bottom); // Lower edge. path.lineTo(right - 1, bottom); path.quadTo(right - 2, y + 2, right - radius - 1, y + 2); path.lineTo(x + radius + 1, y + 2); path.quadTo(x + 2, y + 2, x + 1, bottom); path.closePath(); return path; }
java
public Shape createInternalDropShadowRounded(final int x, final int y, final int w, final int h) { final double radius = h / 2; final int right = x + w; final double bottom = y + radius; path.reset(); // Upper edge. path.moveTo(x, bottom); path.quadTo(x, y, x + radius, y); path.lineTo(right - radius, y); path.quadTo(right, y, right, bottom); // Lower edge. path.lineTo(right - 1, bottom); path.quadTo(right - 2, y + 2, right - radius - 1, y + 2); path.lineTo(x + radius + 1, y + 2); path.quadTo(x + 2, y + 2, x + 1, bottom); path.closePath(); return path; }
[ "public", "Shape", "createInternalDropShadowRounded", "(", "final", "int", "x", ",", "final", "int", "y", ",", "final", "int", "w", ",", "final", "int", "h", ")", "{", "final", "double", "radius", "=", "h", "/", "2", ";", "final", "int", "right", "=", ...
Return a path for a rounded internal drop shadow. This is used for progress bar tracks and search fields. @param x the X coordinate of the upper-left corner of the shadow @param y the Y coordinate of the upper-left corner of the shadow @param w the width of the shadow @param h the height of the rectangle @return a path representing the shadow.
[ "Return", "a", "path", "for", "a", "rounded", "internal", "drop", "shadow", ".", "This", "is", "used", "for", "progress", "bar", "tracks", "and", "search", "fields", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L409-L431
cdk/cdk
legacy/src/main/java/org/openscience/cdk/smsd/algorithm/rgraph/CDKMCS.java
CDKMCS.getOverlaps
public static List<IAtomContainer> getOverlaps(IAtomContainer sourceGraph, IAtomContainer targetGraph, boolean shouldMatchBonds) throws CDKException { List<List<CDKRMap>> rMapsList = search(sourceGraph, targetGraph, new BitSet(), new BitSet(), true, false, shouldMatchBonds); // projection on G1 ArrayList<IAtomContainer> graphList = projectList(rMapsList, sourceGraph, ID1); // reduction of set of solution (isomorphism and substructure // with different 'mappings' return getMaximum(graphList, shouldMatchBonds); }
java
public static List<IAtomContainer> getOverlaps(IAtomContainer sourceGraph, IAtomContainer targetGraph, boolean shouldMatchBonds) throws CDKException { List<List<CDKRMap>> rMapsList = search(sourceGraph, targetGraph, new BitSet(), new BitSet(), true, false, shouldMatchBonds); // projection on G1 ArrayList<IAtomContainer> graphList = projectList(rMapsList, sourceGraph, ID1); // reduction of set of solution (isomorphism and substructure // with different 'mappings' return getMaximum(graphList, shouldMatchBonds); }
[ "public", "static", "List", "<", "IAtomContainer", ">", "getOverlaps", "(", "IAtomContainer", "sourceGraph", ",", "IAtomContainer", "targetGraph", ",", "boolean", "shouldMatchBonds", ")", "throws", "CDKException", "{", "List", "<", "List", "<", "CDKRMap", ">>", "r...
Returns all the maximal common substructure between 2 atom containers. @param sourceGraph first molecule. Must not be an IQueryAtomContainer. @param targetGraph second molecule. May be an IQueryAtomContainer. @param shouldMatchBonds @return the list of all the maximal common substructure found projected of sourceGraph (list of AtomContainer ) @throws CDKException
[ "Returns", "all", "the", "maximal", "common", "substructure", "between", "2", "atom", "containers", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/smsd/algorithm/rgraph/CDKMCS.java#L398-L410
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/table/support/AbstractObjectTable.java
AbstractObjectTable.createTableModel
protected GlazedTableModel createTableModel(EventList eventList) { return new GlazedTableModel(eventList, getColumnPropertyNames(), modelId) { protected TableFormat createTableFormat() { return new DefaultAdvancedTableFormat(); } }; }
java
protected GlazedTableModel createTableModel(EventList eventList) { return new GlazedTableModel(eventList, getColumnPropertyNames(), modelId) { protected TableFormat createTableFormat() { return new DefaultAdvancedTableFormat(); } }; }
[ "protected", "GlazedTableModel", "createTableModel", "(", "EventList", "eventList", ")", "{", "return", "new", "GlazedTableModel", "(", "eventList", ",", "getColumnPropertyNames", "(", ")", ",", "modelId", ")", "{", "protected", "TableFormat", "createTableFormat", "("...
Construct the table model for this table. The default implementation of this creates a GlazedTableModel using an Advanced format. @param eventList on which to build the model @return table model
[ "Construct", "the", "table", "model", "for", "this", "table", ".", "The", "default", "implementation", "of", "this", "creates", "a", "GlazedTableModel", "using", "an", "Advanced", "format", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/table/support/AbstractObjectTable.java#L463-L470
camunda/camunda-commons
logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
BaseLogger.createLogger
public static <T extends BaseLogger> T createLogger(Class<T> loggerClass, String projectCode, String name, String componentId) { try { T logger = loggerClass.newInstance(); logger.projectCode = projectCode; logger.componentId = componentId; logger.delegateLogger = LoggerFactory.getLogger(name); return logger; } catch (InstantiationException e) { throw new RuntimeException("Unable to instantiate logger '"+loggerClass.getName()+"'", e); } catch (IllegalAccessException e) { throw new RuntimeException("Unable to instantiate logger '"+loggerClass.getName()+"'", e); } }
java
public static <T extends BaseLogger> T createLogger(Class<T> loggerClass, String projectCode, String name, String componentId) { try { T logger = loggerClass.newInstance(); logger.projectCode = projectCode; logger.componentId = componentId; logger.delegateLogger = LoggerFactory.getLogger(name); return logger; } catch (InstantiationException e) { throw new RuntimeException("Unable to instantiate logger '"+loggerClass.getName()+"'", e); } catch (IllegalAccessException e) { throw new RuntimeException("Unable to instantiate logger '"+loggerClass.getName()+"'", e); } }
[ "public", "static", "<", "T", "extends", "BaseLogger", ">", "T", "createLogger", "(", "Class", "<", "T", ">", "loggerClass", ",", "String", "projectCode", ",", "String", "name", ",", "String", "componentId", ")", "{", "try", "{", "T", "logger", "=", "log...
Creates a new instance of the {@link BaseLogger Logger}. @param loggerClass the type of the logger @param projectCode the unique code for a complete project. @param name the name of the slf4j logger to use. @param componentId the unique id of the component.
[ "Creates", "a", "new", "instance", "of", "the", "{", "@link", "BaseLogger", "Logger", "}", "." ]
train
https://github.com/camunda/camunda-commons/blob/bd3195db47c92c25717288fe9e6735f8e882f247/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java#L90-L106
OpenLiberty/open-liberty
dev/com.ibm.ws.webserver.plugin.utility/src/com/ibm/ws/webserver/plugin/utility/utils/CommonMBeanConnection.java
CommonMBeanConnection.getMBeanServerConnection
private JMXConnector getMBeanServerConnection(String controllerHost, int controllerPort, HashMap<String, Object> environment) throws MalformedURLException, IOException { JMXServiceURL serviceURL = new JMXServiceURL("REST", controllerHost, controllerPort, "/IBMJMXConnectorREST"); return new ClientProvider().newJMXConnector(serviceURL, environment); }
java
private JMXConnector getMBeanServerConnection(String controllerHost, int controllerPort, HashMap<String, Object> environment) throws MalformedURLException, IOException { JMXServiceURL serviceURL = new JMXServiceURL("REST", controllerHost, controllerPort, "/IBMJMXConnectorREST"); return new ClientProvider().newJMXConnector(serviceURL, environment); }
[ "private", "JMXConnector", "getMBeanServerConnection", "(", "String", "controllerHost", ",", "int", "controllerPort", ",", "HashMap", "<", "String", ",", "Object", ">", "environment", ")", "throws", "MalformedURLException", ",", "IOException", "{", "JMXServiceURL", "s...
Get the MBeanServerConnection for the target controller host and port. @param controllerHost @param controllerPort @param environment @return @throws MalformedURLException @throws IOException
[ "Get", "the", "MBeanServerConnection", "for", "the", "target", "controller", "host", "and", "port", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webserver.plugin.utility/src/com/ibm/ws/webserver/plugin/utility/utils/CommonMBeanConnection.java#L114-L117
auth0/Auth0.Android
auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.java
AuthenticationAPIClient.loginWithEmail
@SuppressWarnings("WeakerAccess") public AuthenticationRequest loginWithEmail(@NonNull String email, @NonNull String verificationCode) { return loginWithEmail(email, verificationCode, EMAIL_CONNECTION); }
java
@SuppressWarnings("WeakerAccess") public AuthenticationRequest loginWithEmail(@NonNull String email, @NonNull String verificationCode) { return loginWithEmail(email, verificationCode, EMAIL_CONNECTION); }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "AuthenticationRequest", "loginWithEmail", "(", "@", "NonNull", "String", "email", ",", "@", "NonNull", "String", "verificationCode", ")", "{", "return", "loginWithEmail", "(", "email", ",", "verificat...
Log in a user using an email and a verification code received via Email (Part of passwordless login flow) By default it will try to authenticate using the "email" connection. Example usage: <pre> {@code client.loginWithEmail("{email}", "{code}") .start(new BaseCallback<Credentials>() { {@literal}Override public void onSuccess(Credentials payload) { } {@literal}@Override public void onFailure(AuthenticationException error) { } }); } </pre> @param email where the user received the verification code @param verificationCode sent by Auth0 via Email @return a request to configure and start that will yield {@link Credentials}
[ "Log", "in", "a", "user", "using", "an", "email", "and", "a", "verification", "code", "received", "via", "Email", "(", "Part", "of", "passwordless", "login", "flow", ")", "By", "default", "it", "will", "try", "to", "authenticate", "using", "the", "email", ...
train
https://github.com/auth0/Auth0.Android/blob/ee37b7f94d989c1fbab2cb1378c87fdcaf7a8156/auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.java#L434-L437
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/Mapper.java
Mapper.toDBObject
public DBObject toDBObject(final Object entity, final Map<Object, DBObject> involvedObjects) { return toDBObject(entity, involvedObjects, true); }
java
public DBObject toDBObject(final Object entity, final Map<Object, DBObject> involvedObjects) { return toDBObject(entity, involvedObjects, true); }
[ "public", "DBObject", "toDBObject", "(", "final", "Object", "entity", ",", "final", "Map", "<", "Object", ",", "DBObject", ">", "involvedObjects", ")", "{", "return", "toDBObject", "(", "entity", ",", "involvedObjects", ",", "true", ")", ";", "}" ]
Converts an entity (POJO) to a DBObject. A special field will be added to keep track of the class type. @param entity The POJO @param involvedObjects A Map of (already converted) POJOs @return the DBObject
[ "Converts", "an", "entity", "(", "POJO", ")", "to", "a", "DBObject", ".", "A", "special", "field", "will", "be", "added", "to", "keep", "track", "of", "the", "class", "type", "." ]
train
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/Mapper.java#L622-L624
line/armeria
core/src/main/java/com/linecorp/armeria/common/util/TextFormatter.java
TextFormatter.appendEpochMillis
public static void appendEpochMillis(StringBuilder buf, long timeMillis) { buf.append(dateTimeFormatter.format(Instant.ofEpochMilli(timeMillis))) .append('(').append(timeMillis).append(')'); }
java
public static void appendEpochMillis(StringBuilder buf, long timeMillis) { buf.append(dateTimeFormatter.format(Instant.ofEpochMilli(timeMillis))) .append('(').append(timeMillis).append(')'); }
[ "public", "static", "void", "appendEpochMillis", "(", "StringBuilder", "buf", ",", "long", "timeMillis", ")", "{", "buf", ".", "append", "(", "dateTimeFormatter", ".", "format", "(", "Instant", ".", "ofEpochMilli", "(", "timeMillis", ")", ")", ")", ".", "app...
Formats the given epoch time in milliseconds to typical human-readable format "yyyy-MM-dd'T'HH_mm:ss.SSSX" and appends it to the specified {@link StringBuilder}.
[ "Formats", "the", "given", "epoch", "time", "in", "milliseconds", "to", "typical", "human", "-", "readable", "format", "yyyy", "-", "MM", "-", "dd", "T", "HH_mm", ":", "ss", ".", "SSSX", "and", "appends", "it", "to", "the", "specified", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/common/util/TextFormatter.java#L173-L176
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatednas/src/main/java/net/minidev/ovh/api/ApiOvhDedicatednas.java
ApiOvhDedicatednas.serviceName_partition_partitionName_PUT
public void serviceName_partition_partitionName_PUT(String serviceName, String partitionName, OvhPartition body) throws IOException { String qPath = "/dedicated/nas/{serviceName}/partition/{partitionName}"; StringBuilder sb = path(qPath, serviceName, partitionName); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_partition_partitionName_PUT(String serviceName, String partitionName, OvhPartition body) throws IOException { String qPath = "/dedicated/nas/{serviceName}/partition/{partitionName}"; StringBuilder sb = path(qPath, serviceName, partitionName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_partition_partitionName_PUT", "(", "String", "serviceName", ",", "String", "partitionName", ",", "OvhPartition", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/nas/{serviceName}/partition/{partitionName}\"", ";"...
Alter this object properties REST: PUT /dedicated/nas/{serviceName}/partition/{partitionName} @param body [required] New object properties @param serviceName [required] The internal name of your storage @param partitionName [required] the given name of partition
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatednas/src/main/java/net/minidev/ovh/api/ApiOvhDedicatednas.java#L209-L213
sakserv/hadoop-mini-clusters
hadoop-mini-clusters-yarn/src/main/java/com/github/sakserv/minicluster/yarn/InJvmContainerExecutor.java
InJvmContainerExecutor.doLaunchContainer
private void doLaunchContainer(Class<?> containerClass, Method mainMethod, String[] arguments) throws Exception { if (logger.isInfoEnabled()) { logger.info("Launching container for " + containerClass.getName() + " with arguments: " + Arrays.asList(arguments)); } try { mainMethod.invoke(null, (Object) arguments); logger.info("Keeping " + containerClass.getName() + " process alive"); LockSupport.park(); } catch (SystemExitException e) { logger.warn("Ignoring System.exit(..) call in " + containerClass.getName()); } if (logger.isInfoEnabled()) { logger.warn("Container " + containerClass.getName() + " is finished"); } }
java
private void doLaunchContainer(Class<?> containerClass, Method mainMethod, String[] arguments) throws Exception { if (logger.isInfoEnabled()) { logger.info("Launching container for " + containerClass.getName() + " with arguments: " + Arrays.asList(arguments)); } try { mainMethod.invoke(null, (Object) arguments); logger.info("Keeping " + containerClass.getName() + " process alive"); LockSupport.park(); } catch (SystemExitException e) { logger.warn("Ignoring System.exit(..) call in " + containerClass.getName()); } if (logger.isInfoEnabled()) { logger.warn("Container " + containerClass.getName() + " is finished"); } }
[ "private", "void", "doLaunchContainer", "(", "Class", "<", "?", ">", "containerClass", ",", "Method", "mainMethod", ",", "String", "[", "]", "arguments", ")", "throws", "Exception", "{", "if", "(", "logger", ".", "isInfoEnabled", "(", ")", ")", "{", "logge...
Will invoke Container's main method blocking if necessary. This method contains a hack that I am not proud of it, but given the fact that some containers rely on System.exit to manage its life-cycle instead of proper exit this will ensure that together with the SystemExitDisallowingSecurityManager (see constructor of this class) this method will block until such container invokes System.exit ByteCodeUtils.hasSystemExit(..) will check if a container that was invoked has calls to System.exit and if it does it will block this thread until SystemExitException is thrown which will be caught allowing this method to exit normally. Of course this doesn't guarantee anything since the underlying implementation of the container may still be implemented in such way where it exits gracefully while also has some shortcut method for some exceptional conditions where System.exit is called and if that's the case this process will block infinitely. The bottom line: DON'T USE System.exit when implementing application containers!!!
[ "Will", "invoke", "Container", "s", "main", "method", "blocking", "if", "necessary", ".", "This", "method", "contains", "a", "hack", "that", "I", "am", "not", "proud", "of", "it", "but", "given", "the", "fact", "that", "some", "containers", "rely", "on", ...
train
https://github.com/sakserv/hadoop-mini-clusters/blob/c3915274714b457cf7e1af62f2f289274510dc0b/hadoop-mini-clusters-yarn/src/main/java/com/github/sakserv/minicluster/yarn/InJvmContainerExecutor.java#L257-L274
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java
SimpleRandomSampling.xbarStd
public static double xbarStd(double std, int sampleN, int populationN) { return Math.sqrt(xbarVariance(std*std, sampleN, populationN)); }
java
public static double xbarStd(double std, int sampleN, int populationN) { return Math.sqrt(xbarVariance(std*std, sampleN, populationN)); }
[ "public", "static", "double", "xbarStd", "(", "double", "std", ",", "int", "sampleN", ",", "int", "populationN", ")", "{", "return", "Math", ".", "sqrt", "(", "xbarVariance", "(", "std", "*", "std", ",", "sampleN", ",", "populationN", ")", ")", ";", "}...
Calculates Standard Deviation for Xbar for finite population size @param std @param sampleN @param populationN @return
[ "Calculates", "Standard", "Deviation", "for", "Xbar", "for", "finite", "population", "size" ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java#L190-L192
ttddyy/datasource-proxy
src/main/java/net/ttddyy/dsproxy/listener/logging/DefaultQueryLogEntryCreator.java
DefaultQueryLogEntryCreator.writeParamsForSinglePreparedEntry
protected void writeParamsForSinglePreparedEntry(StringBuilder sb, SortedMap<String, String> paramMap, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) { sb.append("("); for (Map.Entry<String, String> paramEntry : paramMap.entrySet()) { sb.append(paramEntry.getValue()); sb.append(","); } chompIfEndWith(sb, ','); sb.append("),"); }
java
protected void writeParamsForSinglePreparedEntry(StringBuilder sb, SortedMap<String, String> paramMap, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) { sb.append("("); for (Map.Entry<String, String> paramEntry : paramMap.entrySet()) { sb.append(paramEntry.getValue()); sb.append(","); } chompIfEndWith(sb, ','); sb.append("),"); }
[ "protected", "void", "writeParamsForSinglePreparedEntry", "(", "StringBuilder", "sb", ",", "SortedMap", "<", "String", ",", "String", ">", "paramMap", ",", "ExecutionInfo", "execInfo", ",", "List", "<", "QueryInfo", ">", "queryInfoList", ")", "{", "sb", ".", "ap...
Write query parameters for PreparedStatement. <p>default: Params:[(foo,100),(bar,101)], @param sb StringBuilder to write @param paramMap sorted parameters map @param execInfo execution info @param queryInfoList query info list @since 1.4
[ "Write", "query", "parameters", "for", "PreparedStatement", "." ]
train
https://github.com/ttddyy/datasource-proxy/blob/62163ccf9a569a99aa3ad9f9151a32567447a62e/src/main/java/net/ttddyy/dsproxy/listener/logging/DefaultQueryLogEntryCreator.java#L295-L303
Azure/azure-sdk-for-java
keyvault/resource-manager/v2016_10_01/src/main/java/com/microsoft/azure/management/keyvault/v2016_10_01/implementation/VaultsInner.java
VaultsInner.beginPurgeDeleted
public void beginPurgeDeleted(String vaultName, String location) { beginPurgeDeletedWithServiceResponseAsync(vaultName, location).toBlocking().single().body(); }
java
public void beginPurgeDeleted(String vaultName, String location) { beginPurgeDeletedWithServiceResponseAsync(vaultName, location).toBlocking().single().body(); }
[ "public", "void", "beginPurgeDeleted", "(", "String", "vaultName", ",", "String", "location", ")", "{", "beginPurgeDeletedWithServiceResponseAsync", "(", "vaultName", ",", "location", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ...
Permanently deletes the specified vault. aka Purges the deleted Azure key vault. @param vaultName The name of the soft-deleted vault. @param location The location of the soft-deleted vault. @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
[ "Permanently", "deletes", "the", "specified", "vault", ".", "aka", "Purges", "the", "deleted", "Azure", "key", "vault", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/resource-manager/v2016_10_01/src/main/java/com/microsoft/azure/management/keyvault/v2016_10_01/implementation/VaultsInner.java#L1321-L1323
Appendium/objectlabkit
datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractIMMDateCalculator.java
AbstractIMMDateCalculator.getIMMDates
@Override public List<E> getIMMDates(final E start, final E end) { return getIMMDates(start, end, IMMPeriod.QUARTERLY); }
java
@Override public List<E> getIMMDates(final E start, final E end) { return getIMMDates(start, end, IMMPeriod.QUARTERLY); }
[ "@", "Override", "public", "List", "<", "E", ">", "getIMMDates", "(", "final", "E", "start", ",", "final", "E", "end", ")", "{", "return", "getIMMDates", "(", "start", ",", "end", ",", "IMMPeriod", ".", "QUARTERLY", ")", ";", "}" ]
Returns a list of IMM dates between 2 dates, it will exclude the start date if it is an IMM date but would include the end date if it is an IMM (same as IMMPeriod.QUARTERLY). @param start start of the interval, excluded @param end end of the interval, may be included. @return list of IMM dates
[ "Returns", "a", "list", "of", "IMM", "dates", "between", "2", "dates", "it", "will", "exclude", "the", "start", "date", "if", "it", "is", "an", "IMM", "date", "but", "would", "include", "the", "end", "date", "if", "it", "is", "an", "IMM", "(", "same"...
train
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractIMMDateCalculator.java#L120-L123
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java
ApiOvhDedicatedCloud.serviceName_datacenter_datacenterId_vm_vmId_GET
public OvhVm serviceName_datacenter_datacenterId_vm_vmId_GET(String serviceName, Long datacenterId, Long vmId) throws IOException { String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/vm/{vmId}"; StringBuilder sb = path(qPath, serviceName, datacenterId, vmId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhVm.class); }
java
public OvhVm serviceName_datacenter_datacenterId_vm_vmId_GET(String serviceName, Long datacenterId, Long vmId) throws IOException { String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/vm/{vmId}"; StringBuilder sb = path(qPath, serviceName, datacenterId, vmId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhVm.class); }
[ "public", "OvhVm", "serviceName_datacenter_datacenterId_vm_vmId_GET", "(", "String", "serviceName", ",", "Long", "datacenterId", ",", "Long", "vmId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/vm/{vmId}\...
Get this object properties REST: GET /dedicatedCloud/{serviceName}/datacenter/{datacenterId}/vm/{vmId} @param serviceName [required] Domain of the service @param datacenterId [required] @param vmId [required] Id of the virtual machine. API beta
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L2130-L2135
apache/reef
lang/java/reef-io/src/main/java/org/apache/reef/io/network/group/impl/task/OperatorTopologyStructImpl.java
OperatorTopologyStructImpl.nodesWithDataTakeUnsafe
private NodeStruct nodesWithDataTakeUnsafe() { LOG.entering("OperatorTopologyStructImpl", "nodesWithDataTakeUnsafe"); try { final NodeStruct child = nodesWithData.take(); LOG.exiting("OperatorTopologyStructImpl", "nodesWithDataTakeUnsafe", child); return child; } catch (final InterruptedException e) { throw new RuntimeException("InterruptedException while waiting to take data from nodesWithData queue", e); } }
java
private NodeStruct nodesWithDataTakeUnsafe() { LOG.entering("OperatorTopologyStructImpl", "nodesWithDataTakeUnsafe"); try { final NodeStruct child = nodesWithData.take(); LOG.exiting("OperatorTopologyStructImpl", "nodesWithDataTakeUnsafe", child); return child; } catch (final InterruptedException e) { throw new RuntimeException("InterruptedException while waiting to take data from nodesWithData queue", e); } }
[ "private", "NodeStruct", "nodesWithDataTakeUnsafe", "(", ")", "{", "LOG", ".", "entering", "(", "\"OperatorTopologyStructImpl\"", ",", "\"nodesWithDataTakeUnsafe\"", ")", ";", "try", "{", "final", "NodeStruct", "child", "=", "nodesWithData", ".", "take", "(", ")", ...
Retrieves and removes the head of {@code nodesWithData}, waiting if necessary until an element becomes available. (Comment taken from {@link java.util.concurrent.BlockingQueue}) If interrupted while waiting, then throws a RuntimeException. @return the head of this queue
[ "Retrieves", "and", "removes", "the", "head", "of", "{", "@code", "nodesWithData", "}", "waiting", "if", "necessary", "until", "an", "element", "becomes", "available", ".", "(", "Comment", "taken", "from", "{", "@link", "java", ".", "util", ".", "concurrent"...
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/group/impl/task/OperatorTopologyStructImpl.java#L280-L290
jbake-org/jbake
jbake-core/src/main/java/org/jbake/app/FileUtil.java
FileUtil.isFileInDirectory
public static boolean isFileInDirectory(File file, File directory) throws IOException { return (file.exists() && !file.isHidden() && directory.isDirectory() && file.getCanonicalPath().startsWith(directory.getCanonicalPath())); }
java
public static boolean isFileInDirectory(File file, File directory) throws IOException { return (file.exists() && !file.isHidden() && directory.isDirectory() && file.getCanonicalPath().startsWith(directory.getCanonicalPath())); }
[ "public", "static", "boolean", "isFileInDirectory", "(", "File", "file", ",", "File", "directory", ")", "throws", "IOException", "{", "return", "(", "file", ".", "exists", "(", ")", "&&", "!", "file", ".", "isHidden", "(", ")", "&&", "directory", ".", "i...
Utility method to determine if a given file is located somewhere in the directory provided. @param file used to check if it is located in the provided directory. @param directory to validate whether or not the provided file resides. @return true if the file is somewhere in the provided directory, false if it is not. @throws IOException if the canonical path for either of the input directories can't be determined.
[ "Utility", "method", "to", "determine", "if", "a", "given", "file", "is", "located", "somewhere", "in", "the", "directory", "provided", "." ]
train
https://github.com/jbake-org/jbake/blob/beb9042a54bf0eb168821d524c88b9ea0bee88dc/jbake-core/src/main/java/org/jbake/app/FileUtil.java#L241-L246
facebookarchive/hadoop-20
src/core/org/apache/hadoop/http/HtmlQuoting.java
HtmlQuoting.needsQuoting
public static boolean needsQuoting(String str) { if (str == null) { return false; } byte[] bytes = str.getBytes(); return needsQuoting(bytes, 0 , bytes.length); }
java
public static boolean needsQuoting(String str) { if (str == null) { return false; } byte[] bytes = str.getBytes(); return needsQuoting(bytes, 0 , bytes.length); }
[ "public", "static", "boolean", "needsQuoting", "(", "String", "str", ")", "{", "if", "(", "str", "==", "null", ")", "{", "return", "false", ";", "}", "byte", "[", "]", "bytes", "=", "str", ".", "getBytes", "(", ")", ";", "return", "needsQuoting", "("...
Does the given string need to be quoted? @param str the string to check @return does the string contain any of the active html characters?
[ "Does", "the", "given", "string", "need", "to", "be", "quoted?" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/http/HtmlQuoting.java#L62-L68
geomajas/geomajas-project-graphics
graphics/src/main/java/org/geomajas/graphics/client/widget/CreateIconChoicePopup.java
CreateIconChoicePopup.translateMarker
private ClickableMarkerShape translateMarker(ClickableMarkerShape shape, int amountOfMarkers) { if (amountOfMarkers % imagePerRow != 0) { int size = choiceListImageSize + 6; shape.setTranslation(size * (amountOfMarkers % imagePerRow), size * (amountOfMarkers / imagePerRow)); } return shape; }
java
private ClickableMarkerShape translateMarker(ClickableMarkerShape shape, int amountOfMarkers) { if (amountOfMarkers % imagePerRow != 0) { int size = choiceListImageSize + 6; shape.setTranslation(size * (amountOfMarkers % imagePerRow), size * (amountOfMarkers / imagePerRow)); } return shape; }
[ "private", "ClickableMarkerShape", "translateMarker", "(", "ClickableMarkerShape", "shape", ",", "int", "amountOfMarkers", ")", "{", "if", "(", "amountOfMarkers", "%", "imagePerRow", "!=", "0", ")", "{", "int", "size", "=", "choiceListImageSize", "+", "6", ";", ...
used for displaying marker SVG elements in a drawing area. @param shape @param amountOfMarkers @return
[ "used", "for", "displaying", "marker", "SVG", "elements", "in", "a", "drawing", "area", "." ]
train
https://github.com/geomajas/geomajas-project-graphics/blob/1104196640e0ba455b8a619e774352a8e1e319ba/graphics/src/main/java/org/geomajas/graphics/client/widget/CreateIconChoicePopup.java#L351-L357
to2mbn/JMCCC
jmccc/src/main/java/org/to2mbn/jmccc/version/parsing/Versions.java
Versions.resolveAssets
public static Set<Asset> resolveAssets(MinecraftDirectory minecraftDir, String assets) throws IOException { Objects.requireNonNull(minecraftDir); Objects.requireNonNull(assets); if (!minecraftDir.getAssetIndex(assets).isFile()) { return null; } try { return getVersionParser().parseAssetIndex(IOUtils.toJson(minecraftDir.getAssetIndex(assets))); } catch (JSONException e) { throw new IOException("Couldn't parse asset index: " + assets, e); } }
java
public static Set<Asset> resolveAssets(MinecraftDirectory minecraftDir, String assets) throws IOException { Objects.requireNonNull(minecraftDir); Objects.requireNonNull(assets); if (!minecraftDir.getAssetIndex(assets).isFile()) { return null; } try { return getVersionParser().parseAssetIndex(IOUtils.toJson(minecraftDir.getAssetIndex(assets))); } catch (JSONException e) { throw new IOException("Couldn't parse asset index: " + assets, e); } }
[ "public", "static", "Set", "<", "Asset", ">", "resolveAssets", "(", "MinecraftDirectory", "minecraftDir", ",", "String", "assets", ")", "throws", "IOException", "{", "Objects", ".", "requireNonNull", "(", "minecraftDir", ")", ";", "Objects", ".", "requireNonNull",...
Resolves the asset index. @param minecraftDir the minecraft directory @param assets the name of the asset index, you can get this via {@link Version#getAssets()} @return the asset index, null if the asset index does not exist @throws IOException if an I/O error has occurred during resolving asset index @throws NullPointerException if <code>minecraftDir==null || assets==null</code>
[ "Resolves", "the", "asset", "index", "." ]
train
https://github.com/to2mbn/JMCCC/blob/17e5b1b56ff18255cfd60976dca1a24598946647/jmccc/src/main/java/org/to2mbn/jmccc/version/parsing/Versions.java#L102-L114
lightblueseas/swing-components
src/main/java/de/alpharogroup/swing/img/ImageExtensions.java
ImageExtensions.getResized
public static BufferedImage getResized(final BufferedImage originalImage, final String formatName, final int targetWidth, final int targetHeight) throws IOException { return read(resize(originalImage, formatName, targetWidth, targetHeight)); }
java
public static BufferedImage getResized(final BufferedImage originalImage, final String formatName, final int targetWidth, final int targetHeight) throws IOException { return read(resize(originalImage, formatName, targetWidth, targetHeight)); }
[ "public", "static", "BufferedImage", "getResized", "(", "final", "BufferedImage", "originalImage", ",", "final", "String", "formatName", ",", "final", "int", "targetWidth", ",", "final", "int", "targetHeight", ")", "throws", "IOException", "{", "return", "read", "...
Resize the given BufferedImage and returns the resized BufferedImage. @param originalImage the original image @param formatName the format name @param targetWidth the target width @param targetHeight the target height @return the resized @throws IOException Signals that an I/O exception has occurred.
[ "Resize", "the", "given", "BufferedImage", "and", "returns", "the", "resized", "BufferedImage", "." ]
train
https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/img/ImageExtensions.java#L188-L192
alkacon/opencms-core
src/org/opencms/workplace/CmsDialog.java
CmsDialog.dialogToggleStart
public String dialogToggleStart(String headline, String id, boolean show) { StringBuffer result = new StringBuffer(512); // set icon and style class to use: hide user permissions String image = "plus.png"; String styleClass = "hide"; if (show) { // show user permissions image = "minus.png"; styleClass = "show"; } result.append("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n"); result.append("<tr>\n"); result.append( "\t<td style=\"vertical-align: bottom; padding-bottom: 2px;\"><a href=\"javascript:toggleDetail('"); result.append(id); result.append("');\"><img src=\""); result.append(getSkinUri()); result.append("commons/"); result.append(image); result.append("\" class=\"noborder\" id=\"ic-"); result.append(id); result.append("\"></a></td>\n"); result.append("\t<td>"); result.append(dialogSubheadline(headline)); result.append("</td>\n"); result.append("</tr>\n"); result.append("</table>\n"); result.append("<div class=\""); result.append(styleClass); result.append("\" id=\""); result.append(id); result.append("\">\n"); return result.toString(); }
java
public String dialogToggleStart(String headline, String id, boolean show) { StringBuffer result = new StringBuffer(512); // set icon and style class to use: hide user permissions String image = "plus.png"; String styleClass = "hide"; if (show) { // show user permissions image = "minus.png"; styleClass = "show"; } result.append("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n"); result.append("<tr>\n"); result.append( "\t<td style=\"vertical-align: bottom; padding-bottom: 2px;\"><a href=\"javascript:toggleDetail('"); result.append(id); result.append("');\"><img src=\""); result.append(getSkinUri()); result.append("commons/"); result.append(image); result.append("\" class=\"noborder\" id=\"ic-"); result.append(id); result.append("\"></a></td>\n"); result.append("\t<td>"); result.append(dialogSubheadline(headline)); result.append("</td>\n"); result.append("</tr>\n"); result.append("</table>\n"); result.append("<div class=\""); result.append(styleClass); result.append("\" id=\""); result.append(id); result.append("\">\n"); return result.toString(); }
[ "public", "String", "dialogToggleStart", "(", "String", "headline", ",", "String", "id", ",", "boolean", "show", ")", "{", "StringBuffer", "result", "=", "new", "StringBuffer", "(", "512", ")", ";", "// set icon and style class to use: hide user permissions", "String"...
Builds the HTML code to fold and unfold a white-box.<p> @param headline the heading to display @param id the id of the toggle @param show true if the white box is open at the beginning @return HTML code to fold and unfold a white-box
[ "Builds", "the", "HTML", "code", "to", "fold", "and", "unfold", "a", "white", "-", "box", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsDialog.java#L997-L1033
UrielCh/ovh-java-sdk
ovh-java-sdk-clusterhadoop/src/main/java/net/minidev/ovh/api/ApiOvhClusterhadoop.java
ApiOvhClusterhadoop.serviceName_node_hostname_role_type_GET
public OvhRole serviceName_node_hostname_role_type_GET(String serviceName, String hostname, net.minidev.ovh.api.cluster.hadoop.OvhRoleTypeEnum type) throws IOException { String qPath = "/cluster/hadoop/{serviceName}/node/{hostname}/role/{type}"; StringBuilder sb = path(qPath, serviceName, hostname, type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhRole.class); }
java
public OvhRole serviceName_node_hostname_role_type_GET(String serviceName, String hostname, net.minidev.ovh.api.cluster.hadoop.OvhRoleTypeEnum type) throws IOException { String qPath = "/cluster/hadoop/{serviceName}/node/{hostname}/role/{type}"; StringBuilder sb = path(qPath, serviceName, hostname, type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhRole.class); }
[ "public", "OvhRole", "serviceName_node_hostname_role_type_GET", "(", "String", "serviceName", ",", "String", "hostname", ",", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "cluster", ".", "hadoop", ".", "OvhRoleTypeEnum", "type", ")", "throws", "IOException"...
Get this object properties REST: GET /cluster/hadoop/{serviceName}/node/{hostname}/role/{type} @param serviceName [required] The internal name of your cluster @param hostname [required] Hostname of the node @param type [required] Role name
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-clusterhadoop/src/main/java/net/minidev/ovh/api/ApiOvhClusterhadoop.java#L319-L324
googleapis/cloud-bigtable-client
bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableSession.java
BigtableSession.createChannelPool
public static ManagedChannel createChannelPool(final String host, final BigtableOptions options, int count) throws IOException, GeneralSecurityException { final List<ClientInterceptor> interceptorList = new ArrayList<>(); ClientInterceptor credentialsInterceptor = CredentialInterceptorCache.getInstance() .getCredentialsInterceptor(options.getCredentialOptions(), options.getRetryOptions()); if (credentialsInterceptor != null) { interceptorList.add(credentialsInterceptor); } if (options.getInstanceName() != null) { interceptorList .add(new GoogleCloudResourcePrefixInterceptor(options.getInstanceName().toString())); } final ClientInterceptor[] interceptors = interceptorList.toArray(new ClientInterceptor[interceptorList.size()]); ChannelPool.ChannelFactory factory = new ChannelPool.ChannelFactory() { @Override public ManagedChannel create() throws IOException { return createNettyChannel(host, options, interceptors); } }; return new ChannelPool(factory, count); }
java
public static ManagedChannel createChannelPool(final String host, final BigtableOptions options, int count) throws IOException, GeneralSecurityException { final List<ClientInterceptor> interceptorList = new ArrayList<>(); ClientInterceptor credentialsInterceptor = CredentialInterceptorCache.getInstance() .getCredentialsInterceptor(options.getCredentialOptions(), options.getRetryOptions()); if (credentialsInterceptor != null) { interceptorList.add(credentialsInterceptor); } if (options.getInstanceName() != null) { interceptorList .add(new GoogleCloudResourcePrefixInterceptor(options.getInstanceName().toString())); } final ClientInterceptor[] interceptors = interceptorList.toArray(new ClientInterceptor[interceptorList.size()]); ChannelPool.ChannelFactory factory = new ChannelPool.ChannelFactory() { @Override public ManagedChannel create() throws IOException { return createNettyChannel(host, options, interceptors); } }; return new ChannelPool(factory, count); }
[ "public", "static", "ManagedChannel", "createChannelPool", "(", "final", "String", "host", ",", "final", "BigtableOptions", "options", ",", "int", "count", ")", "throws", "IOException", ",", "GeneralSecurityException", "{", "final", "List", "<", "ClientInterceptor", ...
Create a new {@link com.google.cloud.bigtable.grpc.io.ChannelPool}, with auth headers. @param host a {@link String} object specifying the host to connect to. @param options a {@link BigtableOptions} object with the credentials, retry and other connection options. @param count an int defining the number of channels to create @return a {@link ChannelPool} object. @throws IOException if any. @throws GeneralSecurityException
[ "Create", "a", "new", "{", "@link", "com", ".", "google", ".", "cloud", ".", "bigtable", ".", "grpc", ".", "io", ".", "ChannelPool", "}", "with", "auth", "headers", "." ]
train
https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableSession.java#L578-L602
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/instance/HazelcastInstanceFactory.java
HazelcastInstanceFactory.newHazelcastInstance
public static HazelcastInstance newHazelcastInstance(Config config, String instanceName, NodeContext nodeContext) { if (config == null) { config = new XmlConfigBuilder().build(); } String name = getInstanceName(instanceName, config); InstanceFuture future = new InstanceFuture(); if (INSTANCE_MAP.putIfAbsent(name, future) != null) { throw new DuplicateInstanceNameException("HazelcastInstance with name '" + name + "' already exists!"); } try { return constructHazelcastInstance(config, name, nodeContext, future); } catch (Throwable t) { INSTANCE_MAP.remove(name, future); future.setFailure(t); throw ExceptionUtil.rethrow(t); } }
java
public static HazelcastInstance newHazelcastInstance(Config config, String instanceName, NodeContext nodeContext) { if (config == null) { config = new XmlConfigBuilder().build(); } String name = getInstanceName(instanceName, config); InstanceFuture future = new InstanceFuture(); if (INSTANCE_MAP.putIfAbsent(name, future) != null) { throw new DuplicateInstanceNameException("HazelcastInstance with name '" + name + "' already exists!"); } try { return constructHazelcastInstance(config, name, nodeContext, future); } catch (Throwable t) { INSTANCE_MAP.remove(name, future); future.setFailure(t); throw ExceptionUtil.rethrow(t); } }
[ "public", "static", "HazelcastInstance", "newHazelcastInstance", "(", "Config", "config", ",", "String", "instanceName", ",", "NodeContext", "nodeContext", ")", "{", "if", "(", "config", "==", "null", ")", "{", "config", "=", "new", "XmlConfigBuilder", "(", ")",...
Creates a new Hazelcast instance. @param config the configuration to use; if <code>null</code>, the set of defaults as specified in the XSD for the configuration XML will be used. @param instanceName the name of the {@link HazelcastInstance} @param nodeContext the {@link NodeContext} to use @return the configured {@link HazelcastInstance}
[ "Creates", "a", "new", "Hazelcast", "instance", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/instance/HazelcastInstanceFactory.java#L194-L213
sarl/sarl
docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Reflect.java
Reflect.callProc
public static void callProc(Object instance, Class<?> type, String methodName, Class<?>[] types, Object... args) { try { final Method method = type.getDeclaredMethod(methodName, types); method.setAccessible(true); method.invoke(instance, args); } catch (Exception exception) { throw new Error(exception); } }
java
public static void callProc(Object instance, Class<?> type, String methodName, Class<?>[] types, Object... args) { try { final Method method = type.getDeclaredMethod(methodName, types); method.setAccessible(true); method.invoke(instance, args); } catch (Exception exception) { throw new Error(exception); } }
[ "public", "static", "void", "callProc", "(", "Object", "instance", ",", "Class", "<", "?", ">", "type", ",", "String", "methodName", ",", "Class", "<", "?", ">", "[", "]", "types", ",", "Object", "...", "args", ")", "{", "try", "{", "final", "Method"...
Call the method. @param instance the instance to call on. @param type the type. @param methodName the name of the method. @param types the types of the parameters. @param args the values of the arguments.
[ "Call", "the", "method", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Reflect.java#L77-L85
Azure/azure-sdk-for-java
containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ManagedClustersInner.java
ManagedClustersInner.beginResetAADProfileAsync
public Observable<Void> beginResetAADProfileAsync(String resourceGroupName, String resourceName, ManagedClusterAADProfile parameters) { return beginResetAADProfileWithServiceResponseAsync(resourceGroupName, resourceName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> beginResetAADProfileAsync(String resourceGroupName, String resourceName, ManagedClusterAADProfile parameters) { return beginResetAADProfileWithServiceResponseAsync(resourceGroupName, resourceName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "beginResetAADProfileAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "ManagedClusterAADProfile", "parameters", ")", "{", "return", "beginResetAADProfileWithServiceResponseAsync", "(", "resourceGroupName...
Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. @param resourceGroupName The name of the resource group. @param resourceName The name of the managed cluster resource. @param parameters Parameters supplied to the Reset AAD Profile operation for a Managed Cluster. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Reset", "AAD", "Profile", "of", "a", "managed", "cluster", ".", "Update", "the", "AAD", "Profile", "for", "a", "managed", "cluster", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ManagedClustersInner.java#L1782-L1789
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.isCase
public static boolean isCase(Object caseValue, Object switchValue) { if (caseValue.getClass().isArray()) { return isCase(DefaultTypeTransformation.asCollection(caseValue), switchValue); } return caseValue.equals(switchValue); }
java
public static boolean isCase(Object caseValue, Object switchValue) { if (caseValue.getClass().isArray()) { return isCase(DefaultTypeTransformation.asCollection(caseValue), switchValue); } return caseValue.equals(switchValue); }
[ "public", "static", "boolean", "isCase", "(", "Object", "caseValue", ",", "Object", "switchValue", ")", "{", "if", "(", "caseValue", ".", "getClass", "(", ")", ".", "isArray", "(", ")", ")", "{", "return", "isCase", "(", "DefaultTypeTransformation", ".", "...
Method for overloading the behavior of the 'case' method in switch statements. The default implementation handles arrays types but otherwise simply delegates to Object#equals, but this may be overridden for other types. In this example: <pre> switch( a ) { case b: //some code }</pre> "some code" is called when <code>b.isCase( a )</code> returns <code>true</code>. @param caseValue the case value @param switchValue the switch value @return true if the switchValue is deemed to be equal to the caseValue @since 1.0
[ "Method", "for", "overloading", "the", "behavior", "of", "the", "case", "method", "in", "switch", "statements", ".", "The", "default", "implementation", "handles", "arrays", "types", "but", "otherwise", "simply", "delegates", "to", "Object#equals", "but", "this", ...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L1110-L1115
weld/core
impl/src/main/java/org/jboss/weld/resolution/BeanTypeAssignabilityRules.java
BeanTypeAssignabilityRules.matches
private boolean matches(Class<?> type1, ParameterizedType type2) { if (!type1.equals(Reflections.getRawType(type2))) { return false; } return Types.isArrayOfUnboundedTypeVariablesOrObjects(type2.getActualTypeArguments()); }
java
private boolean matches(Class<?> type1, ParameterizedType type2) { if (!type1.equals(Reflections.getRawType(type2))) { return false; } return Types.isArrayOfUnboundedTypeVariablesOrObjects(type2.getActualTypeArguments()); }
[ "private", "boolean", "matches", "(", "Class", "<", "?", ">", "type1", ",", "ParameterizedType", "type2", ")", "{", "if", "(", "!", "type1", ".", "equals", "(", "Reflections", ".", "getRawType", "(", "type2", ")", ")", ")", "{", "return", "false", ";",...
A parameterized bean type is considered assignable to a raw required type if the raw types are identical and all type parameters of the bean type are either unbounded type variables or java.lang.Object. <p> A raw bean type is considered assignable to a parameterized required type if the raw types are identical and all type parameters of the required type are either unbounded type variables or java.lang.Object.
[ "A", "parameterized", "bean", "type", "is", "considered", "assignable", "to", "a", "raw", "required", "type", "if", "the", "raw", "types", "are", "identical", "and", "all", "type", "parameters", "of", "the", "bean", "type", "are", "either", "unbounded", "typ...
train
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/resolution/BeanTypeAssignabilityRules.java#L89-L94
redkale/redkale
src/org/redkale/convert/json/JsonWriter.java
JsonWriter.writeTo
public void writeTo(final boolean quote, final String value) { int len = value.length(); expand(len + (quote ? 2 : 0)); if (quote) content[count++] = '"'; value.getChars(0, len, content, count); count += len; if (quote) content[count++] = '"'; }
java
public void writeTo(final boolean quote, final String value) { int len = value.length(); expand(len + (quote ? 2 : 0)); if (quote) content[count++] = '"'; value.getChars(0, len, content, count); count += len; if (quote) content[count++] = '"'; }
[ "public", "void", "writeTo", "(", "final", "boolean", "quote", ",", "final", "String", "value", ")", "{", "int", "len", "=", "value", ".", "length", "(", ")", ";", "expand", "(", "len", "+", "(", "quote", "?", "2", ":", "0", ")", ")", ";", "if", ...
<b>注意:</b> 该String值不能为null且不会进行转义, 只用于不含需要转义字符的字符串,例如enum、double、BigInteger转换的String @param quote 是否加双引号 @param value 非null且不含需要转义的字符的String值
[ "<b", ">", "注意:<", "/", "b", ">", "该String值不能为null且不会进行转义,", "只用于不含需要转义字符的字符串,例如enum、double、BigInteger转换的String" ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/convert/json/JsonWriter.java#L91-L98
raphw/byte-buddy
byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/Initialization.java
Initialization.getEntryPoint
public EntryPoint getEntryPoint(ClassLoaderResolver classLoaderResolver, File root, Iterable<? extends File> classPath) { if (entryPoint == null || entryPoint.length() == 0) { throw new GradleException("Entry point name is not defined"); } for (EntryPoint.Default entryPoint : EntryPoint.Default.values()) { if (this.entryPoint.equals(entryPoint.name())) { return entryPoint; } } try { return (EntryPoint) Class.forName(entryPoint, false, classLoaderResolver.resolve(getClassPath(root, classPath))) .getDeclaredConstructor() .newInstance(); } catch (Exception exception) { throw new GradleException("Cannot create entry point: " + entryPoint, exception); } }
java
public EntryPoint getEntryPoint(ClassLoaderResolver classLoaderResolver, File root, Iterable<? extends File> classPath) { if (entryPoint == null || entryPoint.length() == 0) { throw new GradleException("Entry point name is not defined"); } for (EntryPoint.Default entryPoint : EntryPoint.Default.values()) { if (this.entryPoint.equals(entryPoint.name())) { return entryPoint; } } try { return (EntryPoint) Class.forName(entryPoint, false, classLoaderResolver.resolve(getClassPath(root, classPath))) .getDeclaredConstructor() .newInstance(); } catch (Exception exception) { throw new GradleException("Cannot create entry point: " + entryPoint, exception); } }
[ "public", "EntryPoint", "getEntryPoint", "(", "ClassLoaderResolver", "classLoaderResolver", ",", "File", "root", ",", "Iterable", "<", "?", "extends", "File", ">", "classPath", ")", "{", "if", "(", "entryPoint", "==", "null", "||", "entryPoint", ".", "length", ...
Resolves this initialization to an entry point instance. @param classLoaderResolver The class loader resolver to use if appropriate. @param root The root file describing the current tasks classes. @param classPath The class path of the current task. @return A resolved entry point.
[ "Resolves", "this", "initialization", "to", "an", "entry", "point", "instance", "." ]
train
https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/Initialization.java#L61-L77
xiancloud/xian
xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/ScopeService.java
ScopeService.getScopes
public String getScopes(HttpRequest req) throws OAuthException { QueryStringDecoder dec = new QueryStringDecoder(req.uri()); Map<String, List<String>> queryParams = dec.parameters(); if (queryParams.containsKey("client_id")) { return getScopes(queryParams.get("client_id").get(0)); } List<Scope> scopes = DBManagerFactory.getInstance().getAllScopes().blockingGet(); String jsonString; try { jsonString = JSON.toJSONString(scopes); } catch (Exception e) { LOG.error("cannot load scopes", e); throw new OAuthException(e, null, HttpResponseStatus.BAD_REQUEST); } return jsonString; }
java
public String getScopes(HttpRequest req) throws OAuthException { QueryStringDecoder dec = new QueryStringDecoder(req.uri()); Map<String, List<String>> queryParams = dec.parameters(); if (queryParams.containsKey("client_id")) { return getScopes(queryParams.get("client_id").get(0)); } List<Scope> scopes = DBManagerFactory.getInstance().getAllScopes().blockingGet(); String jsonString; try { jsonString = JSON.toJSONString(scopes); } catch (Exception e) { LOG.error("cannot load scopes", e); throw new OAuthException(e, null, HttpResponseStatus.BAD_REQUEST); } return jsonString; }
[ "public", "String", "getScopes", "(", "HttpRequest", "req", ")", "throws", "OAuthException", "{", "QueryStringDecoder", "dec", "=", "new", "QueryStringDecoder", "(", "req", ".", "uri", "(", ")", ")", ";", "Map", "<", "String", ",", "List", "<", "String", "...
Returns either all scopes or scopes for a specific client_id passed as query parameter. @param req request @return string If query param client_id is passed, then the scopes for that client_id will be returned. Otherwise, all available scopes will be returned in JSON format.
[ "Returns", "either", "all", "scopes", "or", "scopes", "for", "a", "specific", "client_id", "passed", "as", "query", "parameter", "." ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/ScopeService.java#L108-L123
synchronoss/cpo-api
cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java
JdbcCpoAdapter.getGroupType
protected <T> String getGroupType(T obj, String type, String name, Connection c) throws CpoException { String retType = type; long objCount; if (JdbcCpoAdapter.PERSIST_GROUP.equals(retType)) { objCount = existsObject(name, obj, c, null); if (objCount == 0) { retType = JdbcCpoAdapter.CREATE_GROUP; } else if (objCount == 1) { retType = JdbcCpoAdapter.UPDATE_GROUP; } else { throw new CpoException("Persist can only UPDATE one record. Your EXISTS function returned 2 or more."); } } return retType; }
java
protected <T> String getGroupType(T obj, String type, String name, Connection c) throws CpoException { String retType = type; long objCount; if (JdbcCpoAdapter.PERSIST_GROUP.equals(retType)) { objCount = existsObject(name, obj, c, null); if (objCount == 0) { retType = JdbcCpoAdapter.CREATE_GROUP; } else if (objCount == 1) { retType = JdbcCpoAdapter.UPDATE_GROUP; } else { throw new CpoException("Persist can only UPDATE one record. Your EXISTS function returned 2 or more."); } } return retType; }
[ "protected", "<", "T", ">", "String", "getGroupType", "(", "T", "obj", ",", "String", "type", ",", "String", "name", ",", "Connection", "c", ")", "throws", "CpoException", "{", "String", "retType", "=", "type", ";", "long", "objCount", ";", "if", "(", ...
DOCUMENT ME! @param obj DOCUMENT ME! @param type DOCUMENT ME! @param name DOCUMENT ME! @param c DOCUMENT ME! @return DOCUMENT ME! @throws CpoException DOCUMENT ME!
[ "DOCUMENT", "ME!" ]
train
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java#L2019-L2036
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/AnnotationUtil.java
AnnotationUtil.getAnnotation
public static Annotation getAnnotation(Annotation[] annotations, Class<?> annotationClass) { return Arrays.stream(annotations).filter(annotation -> annotation.annotationType().equals(annotationClass)).findFirst().orElse(null); }
java
public static Annotation getAnnotation(Annotation[] annotations, Class<?> annotationClass) { return Arrays.stream(annotations).filter(annotation -> annotation.annotationType().equals(annotationClass)).findFirst().orElse(null); }
[ "public", "static", "Annotation", "getAnnotation", "(", "Annotation", "[", "]", "annotations", ",", "Class", "<", "?", ">", "annotationClass", ")", "{", "return", "Arrays", ".", "stream", "(", "annotations", ")", ".", "filter", "(", "annotation", "->", "anno...
Gets annotation. @param annotations the annotations @param annotationClass the annotation class @return the annotation
[ "Gets", "annotation", "." ]
train
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/AnnotationUtil.java#L18-L20
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/rocksdb/RocksDbWrapper.java
RocksDbWrapper.openReadOnly
public static RocksDbWrapper openReadOnly(String dirPath, DBOptions dbOptions, ReadOptions readOptions) throws RocksDbException, IOException { RocksDbWrapper rocksDbWrapper = new RocksDbWrapper(dirPath, true); rocksDbWrapper.setDbOptions(dbOptions).setReadOptions(readOptions); rocksDbWrapper.init(); return rocksDbWrapper; }
java
public static RocksDbWrapper openReadOnly(String dirPath, DBOptions dbOptions, ReadOptions readOptions) throws RocksDbException, IOException { RocksDbWrapper rocksDbWrapper = new RocksDbWrapper(dirPath, true); rocksDbWrapper.setDbOptions(dbOptions).setReadOptions(readOptions); rocksDbWrapper.init(); return rocksDbWrapper; }
[ "public", "static", "RocksDbWrapper", "openReadOnly", "(", "String", "dirPath", ",", "DBOptions", "dbOptions", ",", "ReadOptions", "readOptions", ")", "throws", "RocksDbException", ",", "IOException", "{", "RocksDbWrapper", "rocksDbWrapper", "=", "new", "RocksDbWrapper"...
Open a {@link RocksDB} with specified options in read-only mode. @param dirPath existing {@link RocksDB} data directory @param dbOptions @param readOptions @return @throws RocksDBException @throws IOException
[ "Open", "a", "{", "@link", "RocksDB", "}", "with", "specified", "options", "in", "read", "-", "only", "mode", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/rocksdb/RocksDbWrapper.java#L104-L110
Harium/keel
src/main/java/com/harium/keel/catalano/math/distance/Distance.java
Distance.SymmetricKullbackLeibler
public static double SymmetricKullbackLeibler(double[] p, double[] q) { double dist = 0; for (int i = 0; i < p.length; i++) { dist += (p[i] - q[i]) * (Math.log(p[i]) - Math.log(q[i])); } return dist; }
java
public static double SymmetricKullbackLeibler(double[] p, double[] q) { double dist = 0; for (int i = 0; i < p.length; i++) { dist += (p[i] - q[i]) * (Math.log(p[i]) - Math.log(q[i])); } return dist; }
[ "public", "static", "double", "SymmetricKullbackLeibler", "(", "double", "[", "]", "p", ",", "double", "[", "]", "q", ")", "{", "double", "dist", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "p", ".", "length", ";", "i", "++", ...
Gets the Symmetric Kullback-Leibler distance. This metric is valid only for real and positive P and Q. @param p P vector. @param q Q vector. @return The Symmetric Kullback Leibler distance between p and q.
[ "Gets", "the", "Symmetric", "Kullback", "-", "Leibler", "distance", ".", "This", "metric", "is", "valid", "only", "for", "real", "and", "positive", "P", "and", "Q", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/distance/Distance.java#L873-L880
wisdom-framework/wisdom
core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java
CSSMinifierMojo.fileCreated
@Override public boolean fileCreated(File file) throws WatchingException { if (stylesheets != null) { try { process(stylesheets); } catch (MojoExecutionException e) { throw new WatchingException("Error while aggregating or minifying CSS resources", file, e); } } else { process(file); } return true; }
java
@Override public boolean fileCreated(File file) throws WatchingException { if (stylesheets != null) { try { process(stylesheets); } catch (MojoExecutionException e) { throw new WatchingException("Error while aggregating or minifying CSS resources", file, e); } } else { process(file); } return true; }
[ "@", "Override", "public", "boolean", "fileCreated", "(", "File", "file", ")", "throws", "WatchingException", "{", "if", "(", "stylesheets", "!=", "null", ")", "{", "try", "{", "process", "(", "stylesheets", ")", ";", "}", "catch", "(", "MojoExecutionExcepti...
Minifies the created files. @param file is the file. @return {@literal false} if the pipeline processing must be interrupted for this event. Most watchers should return {@literal true} to let other watchers be notified. @throws org.wisdom.maven.WatchingException if the watcher failed to process the given file.
[ "Minifies", "the", "created", "files", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java#L295-L307
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/config/MergePolicyValidator.java
MergePolicyValidator.checkMapMergePolicyWhenStatisticsAreDisabled
private static void checkMapMergePolicyWhenStatisticsAreDisabled(String mergePolicyClass, List<Class> requiredMergeTypes) { for (Class<?> requiredMergeType : requiredMergeTypes) { if (MergingLastStoredTime.class.isAssignableFrom(requiredMergeType) || MergingExpirationTime.class.isAssignableFrom(requiredMergeType)) { throw new InvalidConfigurationException("The merge policy " + mergePolicyClass + " requires the merge type " + requiredMergeType.getName() + ", which is just provided if the map statistics are enabled."); } } }
java
private static void checkMapMergePolicyWhenStatisticsAreDisabled(String mergePolicyClass, List<Class> requiredMergeTypes) { for (Class<?> requiredMergeType : requiredMergeTypes) { if (MergingLastStoredTime.class.isAssignableFrom(requiredMergeType) || MergingExpirationTime.class.isAssignableFrom(requiredMergeType)) { throw new InvalidConfigurationException("The merge policy " + mergePolicyClass + " requires the merge type " + requiredMergeType.getName() + ", which is just provided if the map statistics are enabled."); } } }
[ "private", "static", "void", "checkMapMergePolicyWhenStatisticsAreDisabled", "(", "String", "mergePolicyClass", ",", "List", "<", "Class", ">", "requiredMergeTypes", ")", "{", "for", "(", "Class", "<", "?", ">", "requiredMergeType", ":", "requiredMergeTypes", ")", "...
Checks if the configured merge policy requires merge types, which are just available if map statistics are enabled. @param mergePolicyClass the name of the configured merge policy class @param requiredMergeTypes the required merge types of the configured merge policy
[ "Checks", "if", "the", "configured", "merge", "policy", "requires", "merge", "types", "which", "are", "just", "available", "if", "map", "statistics", "are", "enabled", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/config/MergePolicyValidator.java#L164-L173
before/quality-check
modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java
Check.matchesPattern
@ArgumentsChecked @Throws({ IllegalNullArgumentException.class, IllegalPatternArgumentException.class }) public static <T extends CharSequence> T matchesPattern(@Nonnull final Pattern pattern, @Nonnull final T chars) { return matchesPattern(pattern, chars, EMPTY_ARGUMENT_NAME); }
java
@ArgumentsChecked @Throws({ IllegalNullArgumentException.class, IllegalPatternArgumentException.class }) public static <T extends CharSequence> T matchesPattern(@Nonnull final Pattern pattern, @Nonnull final T chars) { return matchesPattern(pattern, chars, EMPTY_ARGUMENT_NAME); }
[ "@", "ArgumentsChecked", "@", "Throws", "(", "{", "IllegalNullArgumentException", ".", "class", ",", "IllegalPatternArgumentException", ".", "class", "}", ")", "public", "static", "<", "T", "extends", "CharSequence", ">", "T", "matchesPattern", "(", "@", "Nonnull"...
Ensures that a readable sequence of {@code char} values matches a specified pattern. If the given character sequence does not match against the passed pattern, an {@link IllegalPatternArgumentException} will be thrown. <p> We recommend to use the overloaded method {@link Check#matchesPattern(Pattern, CharSequence, String)} and pass as second argument the name of the parameter to enhance the exception message. @param pattern pattern, that the {@code chars} must correspond to @param chars a readable sequence of {@code char} values which should match the given pattern @return the passed {@code chars} that matches the given pattern @throws IllegalNullArgumentException if the given argument {@code chars} is {@code null} @throws IllegalPatternArgumentException if the given {@code chars} that does not match the {@code pattern}
[ "Ensures", "that", "a", "readable", "sequence", "of", "{", "@code", "char", "}", "values", "matches", "a", "specified", "pattern", ".", "If", "the", "given", "character", "sequence", "does", "not", "match", "against", "the", "passed", "pattern", "an", "{", ...
train
https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java#L1776-L1780
mozilla/rhino
src/org/mozilla/javascript/Context.java
Context.newArray
public Scriptable newArray(Scriptable scope, int length) { NativeArray result = new NativeArray(length); ScriptRuntime.setBuiltinProtoAndParent(result, scope, TopLevel.Builtins.Array); return result; }
java
public Scriptable newArray(Scriptable scope, int length) { NativeArray result = new NativeArray(length); ScriptRuntime.setBuiltinProtoAndParent(result, scope, TopLevel.Builtins.Array); return result; }
[ "public", "Scriptable", "newArray", "(", "Scriptable", "scope", ",", "int", "length", ")", "{", "NativeArray", "result", "=", "new", "NativeArray", "(", "length", ")", ";", "ScriptRuntime", ".", "setBuiltinProtoAndParent", "(", "result", ",", "scope", ",", "To...
Create an array with a specified initial length. <p> @param scope the scope to create the object in @param length the initial length (JavaScript arrays may have additional properties added dynamically). @return the new array object
[ "Create", "an", "array", "with", "a", "specified", "initial", "length", ".", "<p", ">" ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Context.java#L1694-L1700
BranchMetrics/android-branch-deep-linking
Branch-SDK/src/io/branch/referral/PrefHelper.java
PrefHelper.setActionTotalCount
public void setActionTotalCount(String action, int count) { ArrayList<String> actions = getActions(); if (!actions.contains(action)) { actions.add(action); setActions(actions); } setInteger(KEY_TOTAL_BASE + action, count); }
java
public void setActionTotalCount(String action, int count) { ArrayList<String> actions = getActions(); if (!actions.contains(action)) { actions.add(action); setActions(actions); } setInteger(KEY_TOTAL_BASE + action, count); }
[ "public", "void", "setActionTotalCount", "(", "String", "action", ",", "int", "count", ")", "{", "ArrayList", "<", "String", ">", "actions", "=", "getActions", "(", ")", ";", "if", "(", "!", "actions", ".", "contains", "(", "action", ")", ")", "{", "ac...
<p>Sets the count of total number of times that the specified action has been carried out during the current session, as defined in preferences.</p> @param action - A {@link String} value containing the name of the action to return the count for. @param count - An {@link Integer} value containing the total number of times that the specified action has been carried out during the current session.
[ "<p", ">", "Sets", "the", "count", "of", "total", "number", "of", "times", "that", "the", "specified", "action", "has", "been", "carried", "out", "during", "the", "current", "session", "as", "defined", "in", "preferences", ".", "<", "/", "p", ">" ]
train
https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/PrefHelper.java#L834-L841
liferay/com-liferay-commerce
commerce-tax-service/src/main/java/com/liferay/commerce/tax/service/persistence/impl/CommerceTaxMethodPersistenceImpl.java
CommerceTaxMethodPersistenceImpl.removeByG_E
@Override public CommerceTaxMethod removeByG_E(long groupId, String engineKey) throws NoSuchTaxMethodException { CommerceTaxMethod commerceTaxMethod = findByG_E(groupId, engineKey); return remove(commerceTaxMethod); }
java
@Override public CommerceTaxMethod removeByG_E(long groupId, String engineKey) throws NoSuchTaxMethodException { CommerceTaxMethod commerceTaxMethod = findByG_E(groupId, engineKey); return remove(commerceTaxMethod); }
[ "@", "Override", "public", "CommerceTaxMethod", "removeByG_E", "(", "long", "groupId", ",", "String", "engineKey", ")", "throws", "NoSuchTaxMethodException", "{", "CommerceTaxMethod", "commerceTaxMethod", "=", "findByG_E", "(", "groupId", ",", "engineKey", ")", ";", ...
Removes the commerce tax method where groupId = &#63; and engineKey = &#63; from the database. @param groupId the group ID @param engineKey the engine key @return the commerce tax method that was removed
[ "Removes", "the", "commerce", "tax", "method", "where", "groupId", "=", "&#63", ";", "and", "engineKey", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-tax-service/src/main/java/com/liferay/commerce/tax/service/persistence/impl/CommerceTaxMethodPersistenceImpl.java#L770-L776
syphr42/prom
src/main/java/org/syphr/prom/PropertiesManager.java
PropertiesManager.isReferencing
public boolean isReferencing(T property1, T property2) { return getEvaluator().isReferencing(getRawProperty(property1), getTranslator().getPropertyName(property2), getRetriever()); }
java
public boolean isReferencing(T property1, T property2) { return getEvaluator().isReferencing(getRawProperty(property1), getTranslator().getPropertyName(property2), getRetriever()); }
[ "public", "boolean", "isReferencing", "(", "T", "property1", ",", "T", "property2", ")", "{", "return", "getEvaluator", "(", ")", ".", "isReferencing", "(", "getRawProperty", "(", "property1", ")", ",", "getTranslator", "(", ")", ".", "getPropertyName", "(", ...
Determine whether or not one property holds references to another property. @param property1 the property to check for references @param property2 the target referenced property @return <code>true</code> if the first property references the second; <code>false</code> otherwise
[ "Determine", "whether", "or", "not", "one", "property", "holds", "references", "to", "another", "property", "." ]
train
https://github.com/syphr42/prom/blob/074d67c4ebb3afb0b163fcb0bc4826ee577ac803/src/main/java/org/syphr/prom/PropertiesManager.java#L709-L714
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java
ElementsExceptionsFactory.newParseException
public static ParseException newParseException(String message, Object... args) { return newParseException(null, message, args); }
java
public static ParseException newParseException(String message, Object... args) { return newParseException(null, message, args); }
[ "public", "static", "ParseException", "newParseException", "(", "String", "message", ",", "Object", "...", "args", ")", "{", "return", "newParseException", "(", "null", ",", "message", ",", "args", ")", ";", "}" ]
Constructs and initializes a new {@link ParseException} with the given {@link String message} formatted with the given {@link Object[] arguments}. @param message {@link String} describing the {@link ParseException exception}. @param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}. @return a new {@link ParseException} with the given {@link String message}. @see #newParseException(Throwable, String, Object...) @see org.cp.elements.text.ParseException
[ "Constructs", "and", "initializes", "a", "new", "{", "@link", "ParseException", "}", "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#L731-L733
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java
XmlSchemaParser.getAttributeValue
public static String getAttributeValue(final Node elementNode, final String attrName) { final Node attrNode = elementNode.getAttributes().getNamedItemNS(null, attrName); if (attrNode == null || "".equals(attrNode.getNodeValue())) { throw new IllegalStateException( "Element '" + elementNode.getNodeName() + "' has empty or missing attribute: " + attrName); } return attrNode.getNodeValue(); }
java
public static String getAttributeValue(final Node elementNode, final String attrName) { final Node attrNode = elementNode.getAttributes().getNamedItemNS(null, attrName); if (attrNode == null || "".equals(attrNode.getNodeValue())) { throw new IllegalStateException( "Element '" + elementNode.getNodeName() + "' has empty or missing attribute: " + attrName); } return attrNode.getNodeValue(); }
[ "public", "static", "String", "getAttributeValue", "(", "final", "Node", "elementNode", ",", "final", "String", "attrName", ")", "{", "final", "Node", "attrNode", "=", "elementNode", ".", "getAttributes", "(", ")", ".", "getNamedItemNS", "(", "null", ",", "att...
Helper function that throws an exception when the attribute is not set. @param elementNode that should have the attribute @param attrName that is to be looked up @return value of the attribute @throws IllegalArgumentException if the attribute is not present
[ "Helper", "function", "that", "throws", "an", "exception", "when", "the", "attribute", "is", "not", "set", "." ]
train
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java#L280-L291
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java
ValueFileIOHelper.writeStreamedValue
protected long writeStreamedValue(File file, ValueData value) throws IOException { long size; // stream Value if (value instanceof StreamPersistedValueData) { StreamPersistedValueData streamed = (StreamPersistedValueData)value; if (streamed.isPersisted()) { // already persisted in another Value, copy it to this Value size = copyClose(streamed.getAsStream(), new FileOutputStream(file)); } else { // the Value not yet persisted, i.e. or in client stream or spooled to a temp file File tempFile; if ((tempFile = streamed.getTempFile()) != null) { // it's spooled Value, try move its file to VS if (!tempFile.renameTo(file)) { // not succeeded - copy bytes, temp file will be deleted by transient ValueData if (LOG.isDebugEnabled()) { LOG.debug("Value spool file move (rename) to Values Storage is not succeeded. " + "Trying bytes copy. Spool file: " + tempFile.getAbsolutePath() + ". Destination: " + file.getAbsolutePath()); } size = copyClose(new FileInputStream(tempFile), new FileOutputStream(file)); } else { size = file.length(); } } else { // not spooled, use client InputStream size = copyClose(streamed.getStream(), new FileOutputStream(file)); } // link this Value to file in VS streamed.setPersistedFile(file); } } else { // copy from Value stream to the file, e.g. from FilePersistedValueData to this Value size = copyClose(value.getAsStream(), new FileOutputStream(file)); } return size; }
java
protected long writeStreamedValue(File file, ValueData value) throws IOException { long size; // stream Value if (value instanceof StreamPersistedValueData) { StreamPersistedValueData streamed = (StreamPersistedValueData)value; if (streamed.isPersisted()) { // already persisted in another Value, copy it to this Value size = copyClose(streamed.getAsStream(), new FileOutputStream(file)); } else { // the Value not yet persisted, i.e. or in client stream or spooled to a temp file File tempFile; if ((tempFile = streamed.getTempFile()) != null) { // it's spooled Value, try move its file to VS if (!tempFile.renameTo(file)) { // not succeeded - copy bytes, temp file will be deleted by transient ValueData if (LOG.isDebugEnabled()) { LOG.debug("Value spool file move (rename) to Values Storage is not succeeded. " + "Trying bytes copy. Spool file: " + tempFile.getAbsolutePath() + ". Destination: " + file.getAbsolutePath()); } size = copyClose(new FileInputStream(tempFile), new FileOutputStream(file)); } else { size = file.length(); } } else { // not spooled, use client InputStream size = copyClose(streamed.getStream(), new FileOutputStream(file)); } // link this Value to file in VS streamed.setPersistedFile(file); } } else { // copy from Value stream to the file, e.g. from FilePersistedValueData to this Value size = copyClose(value.getAsStream(), new FileOutputStream(file)); } return size; }
[ "protected", "long", "writeStreamedValue", "(", "File", "file", ",", "ValueData", "value", ")", "throws", "IOException", "{", "long", "size", ";", "// stream Value\r", "if", "(", "value", "instanceof", "StreamPersistedValueData", ")", "{", "StreamPersistedValueData", ...
Write streamed value to a file. @param file File @param value ValueData @return size of wrote content @throws IOException if error occurs
[ "Write", "streamed", "value", "to", "a", "file", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java#L121-L176
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java
ApiOvhHostingweb.serviceName_requestBoost_POST
public OvhTask serviceName_requestBoost_POST(String serviceName, OvhOfferEnum offer) throws IOException { String qPath = "/hosting/web/{serviceName}/requestBoost"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "offer", offer); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_requestBoost_POST(String serviceName, OvhOfferEnum offer) throws IOException { String qPath = "/hosting/web/{serviceName}/requestBoost"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "offer", offer); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_requestBoost_POST", "(", "String", "serviceName", ",", "OvhOfferEnum", "offer", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/hosting/web/{serviceName}/requestBoost\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPa...
Allows you to boost your offer. REST: POST /hosting/web/{serviceName}/requestBoost @param offer [required] The boost offer of your choice. Set to null to disable boost. @param serviceName [required] The internal name of your hosting
[ "Allows", "you", "to", "boost", "your", "offer", "." ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L1575-L1582
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/filter/Filter.java
Filter.andExists
public final Filter<S> andExists(String propertyName, Filter<?> subFilter) { ChainedProperty<S> prop = new FilterParser<S>(mType, propertyName).parseChainedProperty(); return and(ExistsFilter.build(prop, subFilter, false)); }
java
public final Filter<S> andExists(String propertyName, Filter<?> subFilter) { ChainedProperty<S> prop = new FilterParser<S>(mType, propertyName).parseChainedProperty(); return and(ExistsFilter.build(prop, subFilter, false)); }
[ "public", "final", "Filter", "<", "S", ">", "andExists", "(", "String", "propertyName", ",", "Filter", "<", "?", ">", "subFilter", ")", "{", "ChainedProperty", "<", "S", ">", "prop", "=", "new", "FilterParser", "<", "S", ">", "(", "mType", ",", "proper...
Returns a combined filter instance that accepts records which are only accepted by this filter and the "exists" test applied to a join. @param propertyName join property name, which may be a chained property @param subFilter sub-filter to apply to join, which may be null to test for any existing @return canonical Filter instance @throws IllegalArgumentException if property is not found @since 1.2
[ "Returns", "a", "combined", "filter", "instance", "that", "accepts", "records", "which", "are", "only", "accepted", "by", "this", "filter", "and", "the", "exists", "test", "applied", "to", "a", "join", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/filter/Filter.java#L304-L307