repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
looly/hutool
hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java
DateUtil.betweenDay
public static long betweenDay(Date beginDate, Date endDate, boolean isReset) { """ 判断两个日期相差的天数<br> <pre> 有时候我们计算相差天数的时候需要忽略时分秒。 比如:2016-02-01 23:59:59和2016-02-02 00:00:00相差一秒 如果isReset为<code>false</code>相差天数为0。 如果isReset为<code>true</code>相差天数将被计算为1 </pre> @param beginDate 起始日期 @param endDate 结束日期 @param isReset 是否重置时间为起始时间 @return 日期差 @since 3.0.1 """ if (isReset) { beginDate = beginOfDay(beginDate); endDate = beginOfDay(endDate); } return between(beginDate, endDate, DateUnit.DAY); }
java
public static long betweenDay(Date beginDate, Date endDate, boolean isReset) { if (isReset) { beginDate = beginOfDay(beginDate); endDate = beginOfDay(endDate); } return between(beginDate, endDate, DateUnit.DAY); }
[ "public", "static", "long", "betweenDay", "(", "Date", "beginDate", ",", "Date", "endDate", ",", "boolean", "isReset", ")", "{", "if", "(", "isReset", ")", "{", "beginDate", "=", "beginOfDay", "(", "beginDate", ")", ";", "endDate", "=", "beginOfDay", "(", "endDate", ")", ";", "}", "return", "between", "(", "beginDate", ",", "endDate", ",", "DateUnit", ".", "DAY", ")", ";", "}" ]
判断两个日期相差的天数<br> <pre> 有时候我们计算相差天数的时候需要忽略时分秒。 比如:2016-02-01 23:59:59和2016-02-02 00:00:00相差一秒 如果isReset为<code>false</code>相差天数为0。 如果isReset为<code>true</code>相差天数将被计算为1 </pre> @param beginDate 起始日期 @param endDate 结束日期 @param isReset 是否重置时间为起始时间 @return 日期差 @since 3.0.1
[ "判断两个日期相差的天数<br", ">" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L1274-L1280
danieldk/dictomaton
src/main/java/eu/danieldk/dictomaton/State.java
State.addTransition
public void addTransition(Character c, State s) { """ Add a transition to the state. If a transition with the provided character already exists, it will be replaced. @param c The transition character. @param s The to-state. """ transitions.put(c, s); d_recomputeHash = true; }
java
public void addTransition(Character c, State s) { transitions.put(c, s); d_recomputeHash = true; }
[ "public", "void", "addTransition", "(", "Character", "c", ",", "State", "s", ")", "{", "transitions", ".", "put", "(", "c", ",", "s", ")", ";", "d_recomputeHash", "=", "true", ";", "}" ]
Add a transition to the state. If a transition with the provided character already exists, it will be replaced. @param c The transition character. @param s The to-state.
[ "Add", "a", "transition", "to", "the", "state", ".", "If", "a", "transition", "with", "the", "provided", "character", "already", "exists", "it", "will", "be", "replaced", "." ]
train
https://github.com/danieldk/dictomaton/blob/c0a3ae2d407ebd88023ea2d0f02a4882b0492df0/src/main/java/eu/danieldk/dictomaton/State.java#L45-L48
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_interface.java
xen_health_interface.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { """ <pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre> """ xen_health_interface_responses result = (xen_health_interface_responses) service.get_payload_formatter().string_to_resource(xen_health_interface_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_health_interface_response_array); } xen_health_interface[] result_xen_health_interface = new xen_health_interface[result.xen_health_interface_response_array.length]; for(int i = 0; i < result.xen_health_interface_response_array.length; i++) { result_xen_health_interface[i] = result.xen_health_interface_response_array[i].xen_health_interface[0]; } return result_xen_health_interface; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { xen_health_interface_responses result = (xen_health_interface_responses) service.get_payload_formatter().string_to_resource(xen_health_interface_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_health_interface_response_array); } xen_health_interface[] result_xen_health_interface = new xen_health_interface[result.xen_health_interface_response_array.length]; for(int i = 0; i < result.xen_health_interface_response_array.length; i++) { result_xen_health_interface[i] = result.xen_health_interface_response_array[i].xen_health_interface[0]; } return result_xen_health_interface; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "xen_health_interface_responses", "result", "=", "(", "xen_health_interface_responses", ")", "service", ".", "get_payload_formatter", "(", ")", ".", "string_to_resource", "(", "xen_health_interface_responses", ".", "class", ",", "response", ")", ";", "if", "(", "result", ".", "errorcode", "!=", "0", ")", "{", "if", "(", "result", ".", "errorcode", "==", "SESSION_NOT_EXISTS", ")", "service", ".", "clear_session", "(", ")", ";", "throw", "new", "nitro_exception", "(", "result", ".", "message", ",", "result", ".", "errorcode", ",", "(", "base_response", "[", "]", ")", "result", ".", "xen_health_interface_response_array", ")", ";", "}", "xen_health_interface", "[", "]", "result_xen_health_interface", "=", "new", "xen_health_interface", "[", "result", ".", "xen_health_interface_response_array", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "result", ".", "xen_health_interface_response_array", ".", "length", ";", "i", "++", ")", "{", "result_xen_health_interface", "[", "i", "]", "=", "result", ".", "xen_health_interface_response_array", "[", "i", "]", ".", "xen_health_interface", "[", "0", "]", ";", "}", "return", "result_xen_health_interface", ";", "}" ]
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_interface.java#L430-L447
Ordinastie/MalisisCore
src/main/java/net/malisis/core/util/EntityUtils.java
EntityUtils.getEntityRotation
public static int getEntityRotation(Entity entity, boolean sixWays) { """ Gets the entity rotation based on where it's currently facing. @param entity the entity @param sixWays the six ways @return the entity rotation """ if (entity == null) return 6; float pitch = entity.rotationPitch; if (sixWays && pitch < -45) return 4; if (sixWays && pitch > 45) return 5; return (MathHelper.floor(entity.rotationYaw * 4.0F / 360.0F + 0.5D) + 2) & 3; }
java
public static int getEntityRotation(Entity entity, boolean sixWays) { if (entity == null) return 6; float pitch = entity.rotationPitch; if (sixWays && pitch < -45) return 4; if (sixWays && pitch > 45) return 5; return (MathHelper.floor(entity.rotationYaw * 4.0F / 360.0F + 0.5D) + 2) & 3; }
[ "public", "static", "int", "getEntityRotation", "(", "Entity", "entity", ",", "boolean", "sixWays", ")", "{", "if", "(", "entity", "==", "null", ")", "return", "6", ";", "float", "pitch", "=", "entity", ".", "rotationPitch", ";", "if", "(", "sixWays", "&&", "pitch", "<", "-", "45", ")", "return", "4", ";", "if", "(", "sixWays", "&&", "pitch", ">", "45", ")", "return", "5", ";", "return", "(", "MathHelper", ".", "floor", "(", "entity", ".", "rotationYaw", "*", "4.0F", "/", "360.0F", "+", "0.5D", ")", "+", "2", ")", "&", "3", ";", "}" ]
Gets the entity rotation based on where it's currently facing. @param entity the entity @param sixWays the six ways @return the entity rotation
[ "Gets", "the", "entity", "rotation", "based", "on", "where", "it", "s", "currently", "facing", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/EntityUtils.java#L180-L192
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java
FilesImpl.listFromComputeNodeWithServiceResponseAsync
public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>> listFromComputeNodeWithServiceResponseAsync(final String poolId, final String nodeId, final Boolean recursive, final FileListFromComputeNodeOptions fileListFromComputeNodeOptions) { """ Lists all of the files in task directories on the specified compute node. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node whose files you want to list. @param recursive Whether to list children of a directory. @param fileListFromComputeNodeOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;NodeFile&gt; object """ return listFromComputeNodeSinglePageAsync(poolId, nodeId, recursive, fileListFromComputeNodeOptions) .concatMap(new Func1<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>, Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>> call(ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions = null; if (fileListFromComputeNodeOptions != null) { fileListFromComputeNodeNextOptions = new FileListFromComputeNodeNextOptions(); fileListFromComputeNodeNextOptions.withClientRequestId(fileListFromComputeNodeOptions.clientRequestId()); fileListFromComputeNodeNextOptions.withReturnClientRequestId(fileListFromComputeNodeOptions.returnClientRequestId()); fileListFromComputeNodeNextOptions.withOcpDate(fileListFromComputeNodeOptions.ocpDate()); } return Observable.just(page).concatWith(listFromComputeNodeNextWithServiceResponseAsync(nextPageLink, fileListFromComputeNodeNextOptions)); } }); }
java
public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>> listFromComputeNodeWithServiceResponseAsync(final String poolId, final String nodeId, final Boolean recursive, final FileListFromComputeNodeOptions fileListFromComputeNodeOptions) { return listFromComputeNodeSinglePageAsync(poolId, nodeId, recursive, fileListFromComputeNodeOptions) .concatMap(new Func1<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>, Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>> call(ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions = null; if (fileListFromComputeNodeOptions != null) { fileListFromComputeNodeNextOptions = new FileListFromComputeNodeNextOptions(); fileListFromComputeNodeNextOptions.withClientRequestId(fileListFromComputeNodeOptions.clientRequestId()); fileListFromComputeNodeNextOptions.withReturnClientRequestId(fileListFromComputeNodeOptions.returnClientRequestId()); fileListFromComputeNodeNextOptions.withOcpDate(fileListFromComputeNodeOptions.ocpDate()); } return Observable.just(page).concatWith(listFromComputeNodeNextWithServiceResponseAsync(nextPageLink, fileListFromComputeNodeNextOptions)); } }); }
[ "public", "Observable", "<", "ServiceResponseWithHeaders", "<", "Page", "<", "NodeFile", ">", ",", "FileListFromComputeNodeHeaders", ">", ">", "listFromComputeNodeWithServiceResponseAsync", "(", "final", "String", "poolId", ",", "final", "String", "nodeId", ",", "final", "Boolean", "recursive", ",", "final", "FileListFromComputeNodeOptions", "fileListFromComputeNodeOptions", ")", "{", "return", "listFromComputeNodeSinglePageAsync", "(", "poolId", ",", "nodeId", ",", "recursive", ",", "fileListFromComputeNodeOptions", ")", ".", "concatMap", "(", "new", "Func1", "<", "ServiceResponseWithHeaders", "<", "Page", "<", "NodeFile", ">", ",", "FileListFromComputeNodeHeaders", ">", ",", "Observable", "<", "ServiceResponseWithHeaders", "<", "Page", "<", "NodeFile", ">", ",", "FileListFromComputeNodeHeaders", ">", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "ServiceResponseWithHeaders", "<", "Page", "<", "NodeFile", ">", ",", "FileListFromComputeNodeHeaders", ">", ">", "call", "(", "ServiceResponseWithHeaders", "<", "Page", "<", "NodeFile", ">", ",", "FileListFromComputeNodeHeaders", ">", "page", ")", "{", "String", "nextPageLink", "=", "page", ".", "body", "(", ")", ".", "nextPageLink", "(", ")", ";", "if", "(", "nextPageLink", "==", "null", ")", "{", "return", "Observable", ".", "just", "(", "page", ")", ";", "}", "FileListFromComputeNodeNextOptions", "fileListFromComputeNodeNextOptions", "=", "null", ";", "if", "(", "fileListFromComputeNodeOptions", "!=", "null", ")", "{", "fileListFromComputeNodeNextOptions", "=", "new", "FileListFromComputeNodeNextOptions", "(", ")", ";", "fileListFromComputeNodeNextOptions", ".", "withClientRequestId", "(", "fileListFromComputeNodeOptions", ".", "clientRequestId", "(", ")", ")", ";", "fileListFromComputeNodeNextOptions", ".", "withReturnClientRequestId", "(", "fileListFromComputeNodeOptions", ".", "returnClientRequestId", "(", ")", ")", ";", "fileListFromComputeNodeNextOptions", ".", "withOcpDate", "(", "fileListFromComputeNodeOptions", ".", "ocpDate", "(", ")", ")", ";", "}", "return", "Observable", ".", "just", "(", "page", ")", ".", "concatWith", "(", "listFromComputeNodeNextWithServiceResponseAsync", "(", "nextPageLink", ",", "fileListFromComputeNodeNextOptions", ")", ")", ";", "}", "}", ")", ";", "}" ]
Lists all of the files in task directories on the specified compute node. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node whose files you want to list. @param recursive Whether to list children of a directory. @param fileListFromComputeNodeOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;NodeFile&gt; object
[ "Lists", "all", "of", "the", "files", "in", "task", "directories", "on", "the", "specified", "compute", "node", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java#L2126-L2145
geomajas/geomajas-project-client-gwt
plugin/widget-utility/utility-gwt/src/main/java/org/geomajas/widget/utility/gwt/client/ribbon/dropdown/DropDownPanel.java
DropDownPanel.getButton
private RibbonColumn getButton(ButtonAction action, ButtonLayoutStyle buttonButtonLayoutStyle) { """ Converts the given action into a {@link RibbonColumn}. @param action ButtonAction @param buttonButtonLayoutStyle the layout of the group. Is used if the action does not contain one itself. @return column RibbonColumn containing the button. """ RibbonColumn column; if (action instanceof ToolbarButtonCanvas) { column = new RibbonColumnCanvas((ToolbarButtonCanvas) action); } else { // if no layout was given, use the one given by the group if (null == action.getButtonLayoutStyle()) { action.setButtonLayoutStyle(buttonButtonLayoutStyle); } RibbonButton button = new RibbonButton(action, 16, TitleAlignment.RIGHT); if (ButtonLayoutStyle.ICON_AND_TITLE.equals(buttonButtonLayoutStyle)) { button = new RibbonButton(action, GuwLayout.DropDown.ribbonBarDropDownButtonIconSize, TitleAlignment.RIGHT); button.setHeight(GuwLayout.DropDown.ribbonBarDropDownButtonIconSize + 4); } else if (ButtonLayoutStyle.ICON_TITLE_AND_DESCRIPTION.equals(buttonButtonLayoutStyle)) { button = new RibbonButton(action, GuwLayout.DropDown.ribbonBarDropDownButtonDescriptionIconSize, TitleAlignment.RIGHT); button.setHeight(GuwLayout.DropDown.ribbonBarDropDownButtonDescriptionIconSize + 4); } button.setOverflow(Overflow.VISIBLE); button.setWidth100(); button.setMargin(2); button.addClickHandler(new ClickHandler() { public void onClick( com.smartgwt.client.widgets.events.ClickEvent event) { hide(); } }); column = button; } return column; }
java
private RibbonColumn getButton(ButtonAction action, ButtonLayoutStyle buttonButtonLayoutStyle) { RibbonColumn column; if (action instanceof ToolbarButtonCanvas) { column = new RibbonColumnCanvas((ToolbarButtonCanvas) action); } else { // if no layout was given, use the one given by the group if (null == action.getButtonLayoutStyle()) { action.setButtonLayoutStyle(buttonButtonLayoutStyle); } RibbonButton button = new RibbonButton(action, 16, TitleAlignment.RIGHT); if (ButtonLayoutStyle.ICON_AND_TITLE.equals(buttonButtonLayoutStyle)) { button = new RibbonButton(action, GuwLayout.DropDown.ribbonBarDropDownButtonIconSize, TitleAlignment.RIGHT); button.setHeight(GuwLayout.DropDown.ribbonBarDropDownButtonIconSize + 4); } else if (ButtonLayoutStyle.ICON_TITLE_AND_DESCRIPTION.equals(buttonButtonLayoutStyle)) { button = new RibbonButton(action, GuwLayout.DropDown.ribbonBarDropDownButtonDescriptionIconSize, TitleAlignment.RIGHT); button.setHeight(GuwLayout.DropDown.ribbonBarDropDownButtonDescriptionIconSize + 4); } button.setOverflow(Overflow.VISIBLE); button.setWidth100(); button.setMargin(2); button.addClickHandler(new ClickHandler() { public void onClick( com.smartgwt.client.widgets.events.ClickEvent event) { hide(); } }); column = button; } return column; }
[ "private", "RibbonColumn", "getButton", "(", "ButtonAction", "action", ",", "ButtonLayoutStyle", "buttonButtonLayoutStyle", ")", "{", "RibbonColumn", "column", ";", "if", "(", "action", "instanceof", "ToolbarButtonCanvas", ")", "{", "column", "=", "new", "RibbonColumnCanvas", "(", "(", "ToolbarButtonCanvas", ")", "action", ")", ";", "}", "else", "{", "// if no layout was given, use the one given by the group", "if", "(", "null", "==", "action", ".", "getButtonLayoutStyle", "(", ")", ")", "{", "action", ".", "setButtonLayoutStyle", "(", "buttonButtonLayoutStyle", ")", ";", "}", "RibbonButton", "button", "=", "new", "RibbonButton", "(", "action", ",", "16", ",", "TitleAlignment", ".", "RIGHT", ")", ";", "if", "(", "ButtonLayoutStyle", ".", "ICON_AND_TITLE", ".", "equals", "(", "buttonButtonLayoutStyle", ")", ")", "{", "button", "=", "new", "RibbonButton", "(", "action", ",", "GuwLayout", ".", "DropDown", ".", "ribbonBarDropDownButtonIconSize", ",", "TitleAlignment", ".", "RIGHT", ")", ";", "button", ".", "setHeight", "(", "GuwLayout", ".", "DropDown", ".", "ribbonBarDropDownButtonIconSize", "+", "4", ")", ";", "}", "else", "if", "(", "ButtonLayoutStyle", ".", "ICON_TITLE_AND_DESCRIPTION", ".", "equals", "(", "buttonButtonLayoutStyle", ")", ")", "{", "button", "=", "new", "RibbonButton", "(", "action", ",", "GuwLayout", ".", "DropDown", ".", "ribbonBarDropDownButtonDescriptionIconSize", ",", "TitleAlignment", ".", "RIGHT", ")", ";", "button", ".", "setHeight", "(", "GuwLayout", ".", "DropDown", ".", "ribbonBarDropDownButtonDescriptionIconSize", "+", "4", ")", ";", "}", "button", ".", "setOverflow", "(", "Overflow", ".", "VISIBLE", ")", ";", "button", ".", "setWidth100", "(", ")", ";", "button", ".", "setMargin", "(", "2", ")", ";", "button", ".", "addClickHandler", "(", "new", "ClickHandler", "(", ")", "{", "public", "void", "onClick", "(", "com", ".", "smartgwt", ".", "client", ".", "widgets", ".", "events", ".", "ClickEvent", "event", ")", "{", "hide", "(", ")", ";", "}", "}", ")", ";", "column", "=", "button", ";", "}", "return", "column", ";", "}" ]
Converts the given action into a {@link RibbonColumn}. @param action ButtonAction @param buttonButtonLayoutStyle the layout of the group. Is used if the action does not contain one itself. @return column RibbonColumn containing the button.
[ "Converts", "the", "given", "action", "into", "a", "{", "@link", "RibbonColumn", "}", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-utility/utility-gwt/src/main/java/org/geomajas/widget/utility/gwt/client/ribbon/dropdown/DropDownPanel.java#L110-L143
Azure/azure-sdk-for-java
mixedreality/resource-manager/v2019_02_28_preview/src/main/java/com/microsoft/azure/management/mixedreality/v2019_02_28_preview/implementation/SpatialAnchorsAccountsInner.java
SpatialAnchorsAccountsInner.update
public SpatialAnchorsAccountInner update(String resourceGroupName, String spatialAnchorsAccountName, SpatialAnchorsAccountInner spatialAnchorsAccount) { """ Updating a Spatial Anchors Account. @param resourceGroupName Name of an Azure resource group. @param spatialAnchorsAccountName Name of an Mixed Reality Spatial Anchors Account. @param spatialAnchorsAccount Spatial Anchors Account parameter. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the SpatialAnchorsAccountInner object if successful. """ return updateWithServiceResponseAsync(resourceGroupName, spatialAnchorsAccountName, spatialAnchorsAccount).toBlocking().single().body(); }
java
public SpatialAnchorsAccountInner update(String resourceGroupName, String spatialAnchorsAccountName, SpatialAnchorsAccountInner spatialAnchorsAccount) { return updateWithServiceResponseAsync(resourceGroupName, spatialAnchorsAccountName, spatialAnchorsAccount).toBlocking().single().body(); }
[ "public", "SpatialAnchorsAccountInner", "update", "(", "String", "resourceGroupName", ",", "String", "spatialAnchorsAccountName", ",", "SpatialAnchorsAccountInner", "spatialAnchorsAccount", ")", "{", "return", "updateWithServiceResponseAsync", "(", "resourceGroupName", ",", "spatialAnchorsAccountName", ",", "spatialAnchorsAccount", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Updating a Spatial Anchors Account. @param resourceGroupName Name of an Azure resource group. @param spatialAnchorsAccountName Name of an Mixed Reality Spatial Anchors Account. @param spatialAnchorsAccount Spatial Anchors Account parameter. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the SpatialAnchorsAccountInner object if successful.
[ "Updating", "a", "Spatial", "Anchors", "Account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mixedreality/resource-manager/v2019_02_28_preview/src/main/java/com/microsoft/azure/management/mixedreality/v2019_02_28_preview/implementation/SpatialAnchorsAccountsInner.java#L517-L519
JOML-CI/JOML
src/org/joml/Matrix4d.java
Matrix4d.setPerspectiveLH
public Matrix4d setPerspectiveLH(double fovy, double aspect, double zNear, double zFar) { """ Set this matrix to be a symmetric perspective projection frustum transformation for a left-handed coordinate system using OpenGL's NDC z range of <code>[-1..+1]</code>. <p> In order to apply the perspective projection transformation to an existing transformation, use {@link #perspectiveLH(double, double, double, double) perspectiveLH()}. @see #perspectiveLH(double, double, double, double) @param fovy the vertical field of view in radians (must be greater than zero and less than {@link Math#PI PI}) @param aspect the aspect ratio (i.e. width / height; must be greater than zero) @param zNear near clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity. In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}. @param zFar far clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity. In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}. @return this """ return setPerspectiveLH(fovy, aspect, zNear, zFar, false); }
java
public Matrix4d setPerspectiveLH(double fovy, double aspect, double zNear, double zFar) { return setPerspectiveLH(fovy, aspect, zNear, zFar, false); }
[ "public", "Matrix4d", "setPerspectiveLH", "(", "double", "fovy", ",", "double", "aspect", ",", "double", "zNear", ",", "double", "zFar", ")", "{", "return", "setPerspectiveLH", "(", "fovy", ",", "aspect", ",", "zNear", ",", "zFar", ",", "false", ")", ";", "}" ]
Set this matrix to be a symmetric perspective projection frustum transformation for a left-handed coordinate system using OpenGL's NDC z range of <code>[-1..+1]</code>. <p> In order to apply the perspective projection transformation to an existing transformation, use {@link #perspectiveLH(double, double, double, double) perspectiveLH()}. @see #perspectiveLH(double, double, double, double) @param fovy the vertical field of view in radians (must be greater than zero and less than {@link Math#PI PI}) @param aspect the aspect ratio (i.e. width / height; must be greater than zero) @param zNear near clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity. In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}. @param zFar far clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity. In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}. @return this
[ "Set", "this", "matrix", "to", "be", "a", "symmetric", "perspective", "projection", "frustum", "transformation", "for", "a", "left", "-", "handed", "coordinate", "system", "using", "OpenGL", "s", "NDC", "z", "range", "of", "<code", ">", "[", "-", "1", "..", "+", "1", "]", "<", "/", "code", ">", ".", "<p", ">", "In", "order", "to", "apply", "the", "perspective", "projection", "transformation", "to", "an", "existing", "transformation", "use", "{", "@link", "#perspectiveLH", "(", "double", "double", "double", "double", ")", "perspectiveLH", "()", "}", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L13063-L13065
mcxiaoke/Android-Next
recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java
HeaderFooterRecyclerAdapter.notifyContentItemRangeChanged
public final void notifyContentItemRangeChanged(int positionStart, int itemCount) { """ Notifies that multiple content items are changed. @param positionStart the position. @param itemCount the item count. """ if (positionStart < 0 || itemCount < 0 || positionStart + itemCount > contentItemCount) { throw new IndexOutOfBoundsException("The given range [" + positionStart + " - " + (positionStart + itemCount - 1) + "] is not within the position bounds for content items [0 - " + (contentItemCount - 1) + "]."); } notifyItemRangeChanged(positionStart + headerItemCount, itemCount); }
java
public final void notifyContentItemRangeChanged(int positionStart, int itemCount) { if (positionStart < 0 || itemCount < 0 || positionStart + itemCount > contentItemCount) { throw new IndexOutOfBoundsException("The given range [" + positionStart + " - " + (positionStart + itemCount - 1) + "] is not within the position bounds for content items [0 - " + (contentItemCount - 1) + "]."); } notifyItemRangeChanged(positionStart + headerItemCount, itemCount); }
[ "public", "final", "void", "notifyContentItemRangeChanged", "(", "int", "positionStart", ",", "int", "itemCount", ")", "{", "if", "(", "positionStart", "<", "0", "||", "itemCount", "<", "0", "||", "positionStart", "+", "itemCount", ">", "contentItemCount", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "\"The given range [\"", "+", "positionStart", "+", "\" - \"", "+", "(", "positionStart", "+", "itemCount", "-", "1", ")", "+", "\"] is not within the position bounds for content items [0 - \"", "+", "(", "contentItemCount", "-", "1", ")", "+", "\"].\"", ")", ";", "}", "notifyItemRangeChanged", "(", "positionStart", "+", "headerItemCount", ",", "itemCount", ")", ";", "}" ]
Notifies that multiple content items are changed. @param positionStart the position. @param itemCount the item count.
[ "Notifies", "that", "multiple", "content", "items", "are", "changed", "." ]
train
https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java#L254-L261
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocFile.java
DocFile.readResourceLine
private static String readResourceLine(DocPath docPath, BufferedReader in) throws ResourceIOException { """ Reads a line of characters from an input stream opened from a given resource. If an IOException occurs, it is wrapped in a ResourceIOException. @param resource the resource for the stream @param in the stream @return the line of text, or {@code null} if at end of stream @throws ResourceIOException if an exception occurred while reading the stream """ try { return in.readLine(); } catch (IOException e) { throw new ResourceIOException(docPath, e); } }
java
private static String readResourceLine(DocPath docPath, BufferedReader in) throws ResourceIOException { try { return in.readLine(); } catch (IOException e) { throw new ResourceIOException(docPath, e); } }
[ "private", "static", "String", "readResourceLine", "(", "DocPath", "docPath", ",", "BufferedReader", "in", ")", "throws", "ResourceIOException", "{", "try", "{", "return", "in", ".", "readLine", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "ResourceIOException", "(", "docPath", ",", "e", ")", ";", "}", "}" ]
Reads a line of characters from an input stream opened from a given resource. If an IOException occurs, it is wrapped in a ResourceIOException. @param resource the resource for the stream @param in the stream @return the line of text, or {@code null} if at end of stream @throws ResourceIOException if an exception occurred while reading the stream
[ "Reads", "a", "line", "of", "characters", "from", "an", "input", "stream", "opened", "from", "a", "given", "resource", ".", "If", "an", "IOException", "occurs", "it", "is", "wrapped", "in", "a", "ResourceIOException", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocFile.java#L352-L358
julianhyde/eigenbase-properties
src/main/java/org/eigenbase/util/property/TriggerableProperties.java
TriggerableProperties.superSetProperty
private void superSetProperty(String key, String oldValue) { """ This is ONLY called during a veto operation. It calls the super class {@link #setProperty}. @param key Property name @param oldValue Previous value of property """ if (oldValue != null) { super.setProperty(key, oldValue); } }
java
private void superSetProperty(String key, String oldValue) { if (oldValue != null) { super.setProperty(key, oldValue); } }
[ "private", "void", "superSetProperty", "(", "String", "key", ",", "String", "oldValue", ")", "{", "if", "(", "oldValue", "!=", "null", ")", "{", "super", ".", "setProperty", "(", "key", ",", "oldValue", ")", ";", "}", "}" ]
This is ONLY called during a veto operation. It calls the super class {@link #setProperty}. @param key Property name @param oldValue Previous value of property
[ "This", "is", "ONLY", "called", "during", "a", "veto", "operation", ".", "It", "calls", "the", "super", "class", "{", "@link", "#setProperty", "}", "." ]
train
https://github.com/julianhyde/eigenbase-properties/blob/fb8a544fa3775a52030c9434285478f139880d58/src/main/java/org/eigenbase/util/property/TriggerableProperties.java#L136-L141
cesarferreira/AndroidQuickUtils
library/src/main/java/quickutils/core/adapters/BindableAdapter.java
BindableAdapter.bindDropDownView
public void bindDropDownView(T item, int position, View view) { """ Bind the data for the specified {@code position} to the drop-down view. """ bindView(item, position, view); }
java
public void bindDropDownView(T item, int position, View view) { bindView(item, position, view); }
[ "public", "void", "bindDropDownView", "(", "T", "item", ",", "int", "position", ",", "View", "view", ")", "{", "bindView", "(", "item", ",", "position", ",", "view", ")", ";", "}" ]
Bind the data for the specified {@code position} to the drop-down view.
[ "Bind", "the", "data", "for", "the", "specified", "{" ]
train
https://github.com/cesarferreira/AndroidQuickUtils/blob/73a91daedbb9f7be7986ea786fbc441c9e5a881c/library/src/main/java/quickutils/core/adapters/BindableAdapter.java#L64-L66
icode/ameba
src/main/java/ameba/websocket/internal/EndpointMeta.java
EndpointMeta.onError
public void onError(Session session, Throwable thr) { """ <p>onError.</p> @param session a {@link javax.websocket.Session} object. @param thr a {@link java.lang.Throwable} object. """ if (getOnErrorHandle() != null) { callMethod(getOnErrorHandle(), getOnErrorParameters(), session, false, thr); } else { logger.error(Messages.get("web.socket.error"), thr); } }
java
public void onError(Session session, Throwable thr) { if (getOnErrorHandle() != null) { callMethod(getOnErrorHandle(), getOnErrorParameters(), session, false, thr); } else { logger.error(Messages.get("web.socket.error"), thr); } }
[ "public", "void", "onError", "(", "Session", "session", ",", "Throwable", "thr", ")", "{", "if", "(", "getOnErrorHandle", "(", ")", "!=", "null", ")", "{", "callMethod", "(", "getOnErrorHandle", "(", ")", ",", "getOnErrorParameters", "(", ")", ",", "session", ",", "false", ",", "thr", ")", ";", "}", "else", "{", "logger", ".", "error", "(", "Messages", ".", "get", "(", "\"web.socket.error\"", ")", ",", "thr", ")", ";", "}", "}" ]
<p>onError.</p> @param session a {@link javax.websocket.Session} object. @param thr a {@link java.lang.Throwable} object.
[ "<p", ">", "onError", ".", "<", "/", "p", ">" ]
train
https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/websocket/internal/EndpointMeta.java#L207-L213
aws/aws-sdk-java
aws-java-sdk-storagegateway/src/main/java/com/amazonaws/services/storagegateway/StorageGatewayUtils.java
StorageGatewayUtils.getActivationKey
public static String getActivationKey(String gatewayAddress, Region activationRegion) throws AmazonClientException { """ Sends a request to the AWS Storage Gateway server running at the specified address, and returns the activation key for that server. @param gatewayAddress The DNS name or IP address of a running AWS Storage Gateway @param activationRegionName The region in which the gateway will be activated. @return The activation key required for some API calls to AWS Storage Gateway. @throws AmazonClientException If any problems are encountered while trying to contact the remote AWS Storage Gateway server. """ return getActivationKey(gatewayAddress, activationRegion == null ? null : activationRegion.getName()); }
java
public static String getActivationKey(String gatewayAddress, Region activationRegion) throws AmazonClientException { return getActivationKey(gatewayAddress, activationRegion == null ? null : activationRegion.getName()); }
[ "public", "static", "String", "getActivationKey", "(", "String", "gatewayAddress", ",", "Region", "activationRegion", ")", "throws", "AmazonClientException", "{", "return", "getActivationKey", "(", "gatewayAddress", ",", "activationRegion", "==", "null", "?", "null", ":", "activationRegion", ".", "getName", "(", ")", ")", ";", "}" ]
Sends a request to the AWS Storage Gateway server running at the specified address, and returns the activation key for that server. @param gatewayAddress The DNS name or IP address of a running AWS Storage Gateway @param activationRegionName The region in which the gateway will be activated. @return The activation key required for some API calls to AWS Storage Gateway. @throws AmazonClientException If any problems are encountered while trying to contact the remote AWS Storage Gateway server.
[ "Sends", "a", "request", "to", "the", "AWS", "Storage", "Gateway", "server", "running", "at", "the", "specified", "address", "and", "returns", "the", "activation", "key", "for", "that", "server", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-storagegateway/src/main/java/com/amazonaws/services/storagegateway/StorageGatewayUtils.java#L72-L76
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java
ExcelUtil.getReader
public static ExcelReader getReader(File bookFile, String sheetName) { """ 获取Excel读取器,通过调用{@link ExcelReader}的read或readXXX方法读取Excel内容 @param bookFile Excel文件 @param sheetName sheet名,第一个默认是sheet1 @return {@link ExcelReader} """ try { return new ExcelReader(bookFile, sheetName); } catch (NoClassDefFoundError e) { throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG); } }
java
public static ExcelReader getReader(File bookFile, String sheetName) { try { return new ExcelReader(bookFile, sheetName); } catch (NoClassDefFoundError e) { throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG); } }
[ "public", "static", "ExcelReader", "getReader", "(", "File", "bookFile", ",", "String", "sheetName", ")", "{", "try", "{", "return", "new", "ExcelReader", "(", "bookFile", ",", "sheetName", ")", ";", "}", "catch", "(", "NoClassDefFoundError", "e", ")", "{", "throw", "new", "DependencyException", "(", "ObjectUtil", ".", "defaultIfNull", "(", "e", ".", "getCause", "(", ")", ",", "e", ")", ",", "PoiChecker", ".", "NO_POI_ERROR_MSG", ")", ";", "}", "}" ]
获取Excel读取器,通过调用{@link ExcelReader}的read或readXXX方法读取Excel内容 @param bookFile Excel文件 @param sheetName sheet名,第一个默认是sheet1 @return {@link ExcelReader}
[ "获取Excel读取器,通过调用", "{", "@link", "ExcelReader", "}", "的read或readXXX方法读取Excel内容" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java#L245-L251
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/split/ST_Split.java
ST_Split.splitMultiLineStringWithLine
private static Geometry splitMultiLineStringWithLine(MultiLineString input, LineString cut) { """ Splits the specified MultiLineString with another lineString. @param MultiLineString @param lineString """ Geometry lines = input.difference(cut); //Only to preserve SQL constrains if (lines instanceof LineString) { return FACTORY.createMultiLineString(new LineString[]{(LineString) lines.getGeometryN(0)}); } return lines; }
java
private static Geometry splitMultiLineStringWithLine(MultiLineString input, LineString cut) { Geometry lines = input.difference(cut); //Only to preserve SQL constrains if (lines instanceof LineString) { return FACTORY.createMultiLineString(new LineString[]{(LineString) lines.getGeometryN(0)}); } return lines; }
[ "private", "static", "Geometry", "splitMultiLineStringWithLine", "(", "MultiLineString", "input", ",", "LineString", "cut", ")", "{", "Geometry", "lines", "=", "input", ".", "difference", "(", "cut", ")", ";", "//Only to preserve SQL constrains", "if", "(", "lines", "instanceof", "LineString", ")", "{", "return", "FACTORY", ".", "createMultiLineString", "(", "new", "LineString", "[", "]", "{", "(", "LineString", ")", "lines", ".", "getGeometryN", "(", "0", ")", "}", ")", ";", "}", "return", "lines", ";", "}" ]
Splits the specified MultiLineString with another lineString. @param MultiLineString @param lineString
[ "Splits", "the", "specified", "MultiLineString", "with", "another", "lineString", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/split/ST_Split.java#L322-L329
apache/incubator-gobblin
gobblin-service/src/main/java/org/apache/gobblin/service/modules/template/StaticFlowTemplate.java
StaticFlowTemplate.isResolvable
@Override public boolean isResolvable(Config userConfig, DatasetDescriptor inputDescriptor, DatasetDescriptor outputDescriptor) throws SpecNotFoundException, JobTemplate.TemplateException { """ Checks if the {@link FlowTemplate} is resolvable using the provided {@link Config} object. A {@link FlowTemplate} is resolvable only if each of the {@link JobTemplate}s in the flow is resolvable @param userConfig User supplied Config @return true if the {@link FlowTemplate} is resolvable """ Config inputDescriptorConfig = inputDescriptor.getRawConfig().atPath(DatasetDescriptorConfigKeys.FLOW_EDGE_INPUT_DATASET_DESCRIPTOR_PREFIX); Config outputDescriptorConfig = outputDescriptor.getRawConfig().atPath(DatasetDescriptorConfigKeys.FLOW_EDGE_OUTPUT_DATASET_DESCRIPTOR_PREFIX); userConfig = userConfig.withFallback(inputDescriptorConfig).withFallback(outputDescriptorConfig); ConfigResolveOptions resolveOptions = ConfigResolveOptions.defaults().setAllowUnresolved(true); for (JobTemplate template: this.jobTemplates) { Config templateConfig = template.getResolvedConfig(userConfig).resolve(resolveOptions); if (!template.getResolvedConfig(userConfig).resolve(resolveOptions).isResolved()) { return false; } } return true; }
java
@Override public boolean isResolvable(Config userConfig, DatasetDescriptor inputDescriptor, DatasetDescriptor outputDescriptor) throws SpecNotFoundException, JobTemplate.TemplateException { Config inputDescriptorConfig = inputDescriptor.getRawConfig().atPath(DatasetDescriptorConfigKeys.FLOW_EDGE_INPUT_DATASET_DESCRIPTOR_PREFIX); Config outputDescriptorConfig = outputDescriptor.getRawConfig().atPath(DatasetDescriptorConfigKeys.FLOW_EDGE_OUTPUT_DATASET_DESCRIPTOR_PREFIX); userConfig = userConfig.withFallback(inputDescriptorConfig).withFallback(outputDescriptorConfig); ConfigResolveOptions resolveOptions = ConfigResolveOptions.defaults().setAllowUnresolved(true); for (JobTemplate template: this.jobTemplates) { Config templateConfig = template.getResolvedConfig(userConfig).resolve(resolveOptions); if (!template.getResolvedConfig(userConfig).resolve(resolveOptions).isResolved()) { return false; } } return true; }
[ "@", "Override", "public", "boolean", "isResolvable", "(", "Config", "userConfig", ",", "DatasetDescriptor", "inputDescriptor", ",", "DatasetDescriptor", "outputDescriptor", ")", "throws", "SpecNotFoundException", ",", "JobTemplate", ".", "TemplateException", "{", "Config", "inputDescriptorConfig", "=", "inputDescriptor", ".", "getRawConfig", "(", ")", ".", "atPath", "(", "DatasetDescriptorConfigKeys", ".", "FLOW_EDGE_INPUT_DATASET_DESCRIPTOR_PREFIX", ")", ";", "Config", "outputDescriptorConfig", "=", "outputDescriptor", ".", "getRawConfig", "(", ")", ".", "atPath", "(", "DatasetDescriptorConfigKeys", ".", "FLOW_EDGE_OUTPUT_DATASET_DESCRIPTOR_PREFIX", ")", ";", "userConfig", "=", "userConfig", ".", "withFallback", "(", "inputDescriptorConfig", ")", ".", "withFallback", "(", "outputDescriptorConfig", ")", ";", "ConfigResolveOptions", "resolveOptions", "=", "ConfigResolveOptions", ".", "defaults", "(", ")", ".", "setAllowUnresolved", "(", "true", ")", ";", "for", "(", "JobTemplate", "template", ":", "this", ".", "jobTemplates", ")", "{", "Config", "templateConfig", "=", "template", ".", "getResolvedConfig", "(", "userConfig", ")", ".", "resolve", "(", "resolveOptions", ")", ";", "if", "(", "!", "template", ".", "getResolvedConfig", "(", "userConfig", ")", ".", "resolve", "(", "resolveOptions", ")", ".", "isResolved", "(", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Checks if the {@link FlowTemplate} is resolvable using the provided {@link Config} object. A {@link FlowTemplate} is resolvable only if each of the {@link JobTemplate}s in the flow is resolvable @param userConfig User supplied Config @return true if the {@link FlowTemplate} is resolvable
[ "Checks", "if", "the", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-service/src/main/java/org/apache/gobblin/service/modules/template/StaticFlowTemplate.java#L155-L171
pedrovgs/Nox
nox/src/main/java/com/github/pedrovgs/nox/shape/Shape.java
Shape.getNoxItemHit
public int getNoxItemHit(float x, float y) { """ Returns the position of the NoxView if any of the previously configured NoxItem instances is hit. If there is no any NoxItem hit this method returns -1. """ int noxItemPosition = -1; for (int i = 0; i < getNumberOfElements(); i++) { float noxItemX = getXForItemAtPosition(i) + offsetX; float noxItemY = getYForItemAtPosition(i) + offsetY; float itemSize = getNoxItemSize(); boolean matchesHorizontally = x >= noxItemX && x <= noxItemX + itemSize; boolean matchesVertically = y >= noxItemY && y <= noxItemY + itemSize; if (matchesHorizontally && matchesVertically) { noxItemPosition = i; break; } } return noxItemPosition; }
java
public int getNoxItemHit(float x, float y) { int noxItemPosition = -1; for (int i = 0; i < getNumberOfElements(); i++) { float noxItemX = getXForItemAtPosition(i) + offsetX; float noxItemY = getYForItemAtPosition(i) + offsetY; float itemSize = getNoxItemSize(); boolean matchesHorizontally = x >= noxItemX && x <= noxItemX + itemSize; boolean matchesVertically = y >= noxItemY && y <= noxItemY + itemSize; if (matchesHorizontally && matchesVertically) { noxItemPosition = i; break; } } return noxItemPosition; }
[ "public", "int", "getNoxItemHit", "(", "float", "x", ",", "float", "y", ")", "{", "int", "noxItemPosition", "=", "-", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "getNumberOfElements", "(", ")", ";", "i", "++", ")", "{", "float", "noxItemX", "=", "getXForItemAtPosition", "(", "i", ")", "+", "offsetX", ";", "float", "noxItemY", "=", "getYForItemAtPosition", "(", "i", ")", "+", "offsetY", ";", "float", "itemSize", "=", "getNoxItemSize", "(", ")", ";", "boolean", "matchesHorizontally", "=", "x", ">=", "noxItemX", "&&", "x", "<=", "noxItemX", "+", "itemSize", ";", "boolean", "matchesVertically", "=", "y", ">=", "noxItemY", "&&", "y", "<=", "noxItemY", "+", "itemSize", ";", "if", "(", "matchesHorizontally", "&&", "matchesVertically", ")", "{", "noxItemPosition", "=", "i", ";", "break", ";", "}", "}", "return", "noxItemPosition", ";", "}" ]
Returns the position of the NoxView if any of the previously configured NoxItem instances is hit. If there is no any NoxItem hit this method returns -1.
[ "Returns", "the", "position", "of", "the", "NoxView", "if", "any", "of", "the", "previously", "configured", "NoxItem", "instances", "is", "hit", ".", "If", "there", "is", "no", "any", "NoxItem", "hit", "this", "method", "returns", "-", "1", "." ]
train
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/shape/Shape.java#L149-L163
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java
AppServiceCertificateOrdersInner.renewAsync
public Observable<Void> renewAsync(String resourceGroupName, String certificateOrderName, RenewCertificateOrderRequest renewCertificateOrderRequest) { """ Renew an existing certificate order. Renew an existing certificate order. @param resourceGroupName Name of the resource group to which the resource belongs. @param certificateOrderName Name of the certificate order. @param renewCertificateOrderRequest Renew parameters @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful. """ return renewWithServiceResponseAsync(resourceGroupName, certificateOrderName, renewCertificateOrderRequest).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> renewAsync(String resourceGroupName, String certificateOrderName, RenewCertificateOrderRequest renewCertificateOrderRequest) { return renewWithServiceResponseAsync(resourceGroupName, certificateOrderName, renewCertificateOrderRequest).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "renewAsync", "(", "String", "resourceGroupName", ",", "String", "certificateOrderName", ",", "RenewCertificateOrderRequest", "renewCertificateOrderRequest", ")", "{", "return", "renewWithServiceResponseAsync", "(", "resourceGroupName", ",", "certificateOrderName", ",", "renewCertificateOrderRequest", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Void", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponse", "<", "Void", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Renew an existing certificate order. Renew an existing certificate order. @param resourceGroupName Name of the resource group to which the resource belongs. @param certificateOrderName Name of the certificate order. @param renewCertificateOrderRequest Renew parameters @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Renew", "an", "existing", "certificate", "order", ".", "Renew", "an", "existing", "certificate", "order", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java#L1710-L1717
Alluxio/alluxio
core/common/src/main/java/alluxio/concurrent/jsr/CompletableFuture.java
CompletableFuture.delayedExecutor
public static Executor delayedExecutor(long delay, TimeUnit unit, Executor executor) { """ Returns a new Executor that submits a task to the given base executor after the given delay (or no delay if non-positive). Each delay commences upon invocation of the returned executor's {@code execute} method. @param delay how long to delay, in units of {@code unit} @param unit a {@code TimeUnit} determining how to interpret the {@code delay} parameter @param executor the base executor @return the new delayed executor @since 9 """ if (unit == null || executor == null) throw new NullPointerException(); return new DelayedExecutor(delay, unit, executor); }
java
public static Executor delayedExecutor(long delay, TimeUnit unit, Executor executor) { if (unit == null || executor == null) throw new NullPointerException(); return new DelayedExecutor(delay, unit, executor); }
[ "public", "static", "Executor", "delayedExecutor", "(", "long", "delay", ",", "TimeUnit", "unit", ",", "Executor", "executor", ")", "{", "if", "(", "unit", "==", "null", "||", "executor", "==", "null", ")", "throw", "new", "NullPointerException", "(", ")", ";", "return", "new", "DelayedExecutor", "(", "delay", ",", "unit", ",", "executor", ")", ";", "}" ]
Returns a new Executor that submits a task to the given base executor after the given delay (or no delay if non-positive). Each delay commences upon invocation of the returned executor's {@code execute} method. @param delay how long to delay, in units of {@code unit} @param unit a {@code TimeUnit} determining how to interpret the {@code delay} parameter @param executor the base executor @return the new delayed executor @since 9
[ "Returns", "a", "new", "Executor", "that", "submits", "a", "task", "to", "the", "given", "base", "executor", "after", "the", "given", "delay", "(", "or", "no", "delay", "if", "non", "-", "positive", ")", ".", "Each", "delay", "commences", "upon", "invocation", "of", "the", "returned", "executor", "s", "{", "@code", "execute", "}", "method", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/concurrent/jsr/CompletableFuture.java#L520-L524
glyptodon/guacamole-client
guacamole-common/src/main/java/org/apache/guacamole/protocol/GuacamoleConfiguration.java
GuacamoleConfiguration.setParameters
public void setParameters(Map<String, String> parameters) { """ Replaces all current parameters with the parameters defined within the given map. Key/value pairs within the map represent parameter name/value pairs. @param parameters A map which contains all parameter name/value pairs as key/value pairs. """ this.parameters.clear(); this.parameters.putAll(parameters); }
java
public void setParameters(Map<String, String> parameters) { this.parameters.clear(); this.parameters.putAll(parameters); }
[ "public", "void", "setParameters", "(", "Map", "<", "String", ",", "String", ">", "parameters", ")", "{", "this", ".", "parameters", ".", "clear", "(", ")", ";", "this", ".", "parameters", ".", "putAll", "(", "parameters", ")", ";", "}" ]
Replaces all current parameters with the parameters defined within the given map. Key/value pairs within the map represent parameter name/value pairs. @param parameters A map which contains all parameter name/value pairs as key/value pairs.
[ "Replaces", "all", "current", "parameters", "with", "the", "parameters", "defined", "within", "the", "given", "map", ".", "Key", "/", "value", "pairs", "within", "the", "map", "represent", "parameter", "name", "/", "value", "pairs", "." ]
train
https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/guacamole-common/src/main/java/org/apache/guacamole/protocol/GuacamoleConfiguration.java#L182-L185
apache/incubator-atlas
webapp/src/main/java/org/apache/atlas/web/service/AtlasZookeeperSecurityProperties.java
AtlasZookeeperSecurityProperties.parseAcl
public static ACL parseAcl(String aclString) { """ Get an {@link ACL} by parsing input string. @param aclString A string of the form scheme:id @return {@link ACL} with the perms set to {@link org.apache.zookeeper.ZooDefs.Perms#ALL} and scheme and id taken from configuration values. """ String[] aclComponents = getComponents(aclString, "acl", "scheme:id"); return new ACL(ZooDefs.Perms.ALL, new Id(aclComponents[0], aclComponents[1])); }
java
public static ACL parseAcl(String aclString) { String[] aclComponents = getComponents(aclString, "acl", "scheme:id"); return new ACL(ZooDefs.Perms.ALL, new Id(aclComponents[0], aclComponents[1])); }
[ "public", "static", "ACL", "parseAcl", "(", "String", "aclString", ")", "{", "String", "[", "]", "aclComponents", "=", "getComponents", "(", "aclString", ",", "\"acl\"", ",", "\"scheme:id\"", ")", ";", "return", "new", "ACL", "(", "ZooDefs", ".", "Perms", ".", "ALL", ",", "new", "Id", "(", "aclComponents", "[", "0", "]", ",", "aclComponents", "[", "1", "]", ")", ")", ";", "}" ]
Get an {@link ACL} by parsing input string. @param aclString A string of the form scheme:id @return {@link ACL} with the perms set to {@link org.apache.zookeeper.ZooDefs.Perms#ALL} and scheme and id taken from configuration values.
[ "Get", "an", "{" ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/webapp/src/main/java/org/apache/atlas/web/service/AtlasZookeeperSecurityProperties.java#L47-L50
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/CollectionLiteralsTypeComputer.java
CollectionLiteralsTypeComputer.createCollectionTypeReference
protected LightweightTypeReference createCollectionTypeReference(JvmGenericType collectionType, LightweightTypeReference elementType, LightweightTypeReference expectedType, ITypeReferenceOwner owner) { """ Creates a collection type reference that comes as close as possible / necessary to its expected type. """ ParameterizedTypeReference result = new ParameterizedTypeReference(owner, collectionType); result.addTypeArgument(elementType); if (isIterableExpectation(expectedType) && !expectedType.isAssignableFrom(result)) { // avoid to assign a set literal to a list and viceversa: // at least the raw types must be assignable // https://bugs.eclipse.org/bugs/show_bug.cgi?id=498779 if (expectedType.getRawTypeReference().isAssignableFrom(result.getRawTypeReference())) { LightweightTypeReference expectedElementType = getElementOrComponentType(expectedType, owner); if (matchesExpectation(elementType, expectedElementType)) { return expectedType; } } } return result; }
java
protected LightweightTypeReference createCollectionTypeReference(JvmGenericType collectionType, LightweightTypeReference elementType, LightweightTypeReference expectedType, ITypeReferenceOwner owner) { ParameterizedTypeReference result = new ParameterizedTypeReference(owner, collectionType); result.addTypeArgument(elementType); if (isIterableExpectation(expectedType) && !expectedType.isAssignableFrom(result)) { // avoid to assign a set literal to a list and viceversa: // at least the raw types must be assignable // https://bugs.eclipse.org/bugs/show_bug.cgi?id=498779 if (expectedType.getRawTypeReference().isAssignableFrom(result.getRawTypeReference())) { LightweightTypeReference expectedElementType = getElementOrComponentType(expectedType, owner); if (matchesExpectation(elementType, expectedElementType)) { return expectedType; } } } return result; }
[ "protected", "LightweightTypeReference", "createCollectionTypeReference", "(", "JvmGenericType", "collectionType", ",", "LightweightTypeReference", "elementType", ",", "LightweightTypeReference", "expectedType", ",", "ITypeReferenceOwner", "owner", ")", "{", "ParameterizedTypeReference", "result", "=", "new", "ParameterizedTypeReference", "(", "owner", ",", "collectionType", ")", ";", "result", ".", "addTypeArgument", "(", "elementType", ")", ";", "if", "(", "isIterableExpectation", "(", "expectedType", ")", "&&", "!", "expectedType", ".", "isAssignableFrom", "(", "result", ")", ")", "{", "// avoid to assign a set literal to a list and viceversa:", "// at least the raw types must be assignable", "// https://bugs.eclipse.org/bugs/show_bug.cgi?id=498779", "if", "(", "expectedType", ".", "getRawTypeReference", "(", ")", ".", "isAssignableFrom", "(", "result", ".", "getRawTypeReference", "(", ")", ")", ")", "{", "LightweightTypeReference", "expectedElementType", "=", "getElementOrComponentType", "(", "expectedType", ",", "owner", ")", ";", "if", "(", "matchesExpectation", "(", "elementType", ",", "expectedElementType", ")", ")", "{", "return", "expectedType", ";", "}", "}", "}", "return", "result", ";", "}" ]
Creates a collection type reference that comes as close as possible / necessary to its expected type.
[ "Creates", "a", "collection", "type", "reference", "that", "comes", "as", "close", "as", "possible", "/", "necessary", "to", "its", "expected", "type", "." ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/CollectionLiteralsTypeComputer.java#L241-L256
apache/incubator-gobblin
gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/converter/jdbc/AvroToJdbcEntryConverter.java
AvroToJdbcEntryConverter.convertSchema
@Override public JdbcEntrySchema convertSchema(Schema inputSchema, WorkUnitState workUnit) throws SchemaConversionException { """ Converts Avro schema to JdbcEntrySchema. Few precondition to the Avro schema 1. Avro schema should have one entry type record at first depth. 2. Avro schema can recurse by having record inside record. 3. Supported Avro primitive types and conversion boolean --> java.lang.Boolean int --> java.lang.Integer long --> java.lang.Long or java.sql.Date , java.sql.Time , java.sql.Timestamp float --> java.lang.Float double --> java.lang.Double bytes --> byte[] string --> java.lang.String null: only allowed if it's within union (see complex types for more details) 4. Supported Avro complex types Records: Supports nested record type as well. Enum --> java.lang.String Unions --> Only allowed if it have one primitive type in it, along with Record type, or null type with one primitive type where null will be ignored. Once Union is narrowed down to one primitive type, it will follow conversion of primitive type above. {@inheritDoc} 5. In order to make conversion from Avro long type to java.sql.Date or java.sql.Time or java.sql.Timestamp, converter will get table metadata from JDBC. 6. As it needs JDBC connection from condition 5, it also assumes that it will use JDBC publisher where it will get connection information from. 7. Conversion assumes that both schema, Avro and JDBC, uses same column name where name space in Avro is ignored. For case sensitivity, Avro is case sensitive where it differs in JDBC based on underlying database. As Avro is case sensitive, column name equality also take case sensitive in to account. @see org.apache.gobblin.converter.Converter#convertSchema(java.lang.Object, org.apache.gobblin.configuration.WorkUnitState) """ LOG.info("Converting schema " + inputSchema); Preconditions.checkArgument(Type.RECORD.equals(inputSchema.getType()), "%s is expected for the first level element in Avro schema %s", Type.RECORD, inputSchema); Map<String, Type> avroColumnType = flatten(inputSchema); String jsonStr = Preconditions.checkNotNull(workUnit.getProp(CONVERTER_AVRO_JDBC_DATE_FIELDS)); java.lang.reflect.Type typeOfMap = new TypeToken<Map<String, JdbcType>>() {}.getType(); Map<String, JdbcType> dateColumnMapping = new Gson().fromJson(jsonStr, typeOfMap); LOG.info("Date column mapping: " + dateColumnMapping); List<JdbcEntryMetaDatum> jdbcEntryMetaData = Lists.newArrayList(); for (Map.Entry<String, Type> avroEntry : avroColumnType.entrySet()) { String colName = tryConvertAvroColNameToJdbcColName(avroEntry.getKey()); JdbcType JdbcType = dateColumnMapping.get(colName); if (JdbcType == null) { JdbcType = AVRO_TYPE_JDBC_TYPE_MAPPING.get(avroEntry.getValue()); } Preconditions.checkNotNull(JdbcType, "Failed to convert " + avroEntry + " AVRO_TYPE_JDBC_TYPE_MAPPING: " + AVRO_TYPE_JDBC_TYPE_MAPPING + " , dateColumnMapping: " + dateColumnMapping); jdbcEntryMetaData.add(new JdbcEntryMetaDatum(colName, JdbcType)); } JdbcEntrySchema converted = new JdbcEntrySchema(jdbcEntryMetaData); LOG.info("Converted schema into " + converted); return converted; }
java
@Override public JdbcEntrySchema convertSchema(Schema inputSchema, WorkUnitState workUnit) throws SchemaConversionException { LOG.info("Converting schema " + inputSchema); Preconditions.checkArgument(Type.RECORD.equals(inputSchema.getType()), "%s is expected for the first level element in Avro schema %s", Type.RECORD, inputSchema); Map<String, Type> avroColumnType = flatten(inputSchema); String jsonStr = Preconditions.checkNotNull(workUnit.getProp(CONVERTER_AVRO_JDBC_DATE_FIELDS)); java.lang.reflect.Type typeOfMap = new TypeToken<Map<String, JdbcType>>() {}.getType(); Map<String, JdbcType> dateColumnMapping = new Gson().fromJson(jsonStr, typeOfMap); LOG.info("Date column mapping: " + dateColumnMapping); List<JdbcEntryMetaDatum> jdbcEntryMetaData = Lists.newArrayList(); for (Map.Entry<String, Type> avroEntry : avroColumnType.entrySet()) { String colName = tryConvertAvroColNameToJdbcColName(avroEntry.getKey()); JdbcType JdbcType = dateColumnMapping.get(colName); if (JdbcType == null) { JdbcType = AVRO_TYPE_JDBC_TYPE_MAPPING.get(avroEntry.getValue()); } Preconditions.checkNotNull(JdbcType, "Failed to convert " + avroEntry + " AVRO_TYPE_JDBC_TYPE_MAPPING: " + AVRO_TYPE_JDBC_TYPE_MAPPING + " , dateColumnMapping: " + dateColumnMapping); jdbcEntryMetaData.add(new JdbcEntryMetaDatum(colName, JdbcType)); } JdbcEntrySchema converted = new JdbcEntrySchema(jdbcEntryMetaData); LOG.info("Converted schema into " + converted); return converted; }
[ "@", "Override", "public", "JdbcEntrySchema", "convertSchema", "(", "Schema", "inputSchema", ",", "WorkUnitState", "workUnit", ")", "throws", "SchemaConversionException", "{", "LOG", ".", "info", "(", "\"Converting schema \"", "+", "inputSchema", ")", ";", "Preconditions", ".", "checkArgument", "(", "Type", ".", "RECORD", ".", "equals", "(", "inputSchema", ".", "getType", "(", ")", ")", ",", "\"%s is expected for the first level element in Avro schema %s\"", ",", "Type", ".", "RECORD", ",", "inputSchema", ")", ";", "Map", "<", "String", ",", "Type", ">", "avroColumnType", "=", "flatten", "(", "inputSchema", ")", ";", "String", "jsonStr", "=", "Preconditions", ".", "checkNotNull", "(", "workUnit", ".", "getProp", "(", "CONVERTER_AVRO_JDBC_DATE_FIELDS", ")", ")", ";", "java", ".", "lang", ".", "reflect", ".", "Type", "typeOfMap", "=", "new", "TypeToken", "<", "Map", "<", "String", ",", "JdbcType", ">", ">", "(", ")", "{", "}", ".", "getType", "(", ")", ";", "Map", "<", "String", ",", "JdbcType", ">", "dateColumnMapping", "=", "new", "Gson", "(", ")", ".", "fromJson", "(", "jsonStr", ",", "typeOfMap", ")", ";", "LOG", ".", "info", "(", "\"Date column mapping: \"", "+", "dateColumnMapping", ")", ";", "List", "<", "JdbcEntryMetaDatum", ">", "jdbcEntryMetaData", "=", "Lists", ".", "newArrayList", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Type", ">", "avroEntry", ":", "avroColumnType", ".", "entrySet", "(", ")", ")", "{", "String", "colName", "=", "tryConvertAvroColNameToJdbcColName", "(", "avroEntry", ".", "getKey", "(", ")", ")", ";", "JdbcType", "JdbcType", "=", "dateColumnMapping", ".", "get", "(", "colName", ")", ";", "if", "(", "JdbcType", "==", "null", ")", "{", "JdbcType", "=", "AVRO_TYPE_JDBC_TYPE_MAPPING", ".", "get", "(", "avroEntry", ".", "getValue", "(", ")", ")", ";", "}", "Preconditions", ".", "checkNotNull", "(", "JdbcType", ",", "\"Failed to convert \"", "+", "avroEntry", "+", "\" AVRO_TYPE_JDBC_TYPE_MAPPING: \"", "+", "AVRO_TYPE_JDBC_TYPE_MAPPING", "+", "\" , dateColumnMapping: \"", "+", "dateColumnMapping", ")", ";", "jdbcEntryMetaData", ".", "add", "(", "new", "JdbcEntryMetaDatum", "(", "colName", ",", "JdbcType", ")", ")", ";", "}", "JdbcEntrySchema", "converted", "=", "new", "JdbcEntrySchema", "(", "jdbcEntryMetaData", ")", ";", "LOG", ".", "info", "(", "\"Converted schema into \"", "+", "converted", ")", ";", "return", "converted", ";", "}" ]
Converts Avro schema to JdbcEntrySchema. Few precondition to the Avro schema 1. Avro schema should have one entry type record at first depth. 2. Avro schema can recurse by having record inside record. 3. Supported Avro primitive types and conversion boolean --> java.lang.Boolean int --> java.lang.Integer long --> java.lang.Long or java.sql.Date , java.sql.Time , java.sql.Timestamp float --> java.lang.Float double --> java.lang.Double bytes --> byte[] string --> java.lang.String null: only allowed if it's within union (see complex types for more details) 4. Supported Avro complex types Records: Supports nested record type as well. Enum --> java.lang.String Unions --> Only allowed if it have one primitive type in it, along with Record type, or null type with one primitive type where null will be ignored. Once Union is narrowed down to one primitive type, it will follow conversion of primitive type above. {@inheritDoc} 5. In order to make conversion from Avro long type to java.sql.Date or java.sql.Time or java.sql.Timestamp, converter will get table metadata from JDBC. 6. As it needs JDBC connection from condition 5, it also assumes that it will use JDBC publisher where it will get connection information from. 7. Conversion assumes that both schema, Avro and JDBC, uses same column name where name space in Avro is ignored. For case sensitivity, Avro is case sensitive where it differs in JDBC based on underlying database. As Avro is case sensitive, column name equality also take case sensitive in to account. @see org.apache.gobblin.converter.Converter#convertSchema(java.lang.Object, org.apache.gobblin.configuration.WorkUnitState)
[ "Converts", "Avro", "schema", "to", "JdbcEntrySchema", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/converter/jdbc/AvroToJdbcEntryConverter.java#L176-L205
sahan/RoboZombie
robozombie/src/main/java/com/lonepulse/robozombie/util/Assert.java
Assert.assertAssignable
public static <T extends Object> T assertAssignable(Object arg, Class<T> type) { """ <p>Asserts that the given Object is assignable to the specified type. If either the generic Object or the {@link Class} is {@code null} a {@link NullPointerException} will be thrown with the message, <i>"The supplied argument was found to be &lt;null&gt;"</i>. If the object was not found to be in conformance with the specified type, a {@link ClassCastException} will be thrown with the message, <i>"The instance of type &lt;argument-type&gt; cannot be assigned to a &lt;specified-type&gt;"</i>.</p> @param arg the argument to be asserted for type conformance <br><br> @param type the {@link Class} type to which the argument must conform <br><br> @return the argument which was asserted to conform to the specified type <br><br> @throws ClassCastException if the supplied argument does not conform to the specified type <br><br> @since 1.3.0 """ assertNotNull(arg); assertNotNull(type); if(!type.isAssignableFrom(arg.getClass())) { throw new ClassCastException(new StringBuilder("The instance of type <") .append(arg.getClass().getName()).append("> cannot be assigned to a <") .append(type.getName()) .append(">").toString()); } return type.cast(arg); }
java
public static <T extends Object> T assertAssignable(Object arg, Class<T> type) { assertNotNull(arg); assertNotNull(type); if(!type.isAssignableFrom(arg.getClass())) { throw new ClassCastException(new StringBuilder("The instance of type <") .append(arg.getClass().getName()).append("> cannot be assigned to a <") .append(type.getName()) .append(">").toString()); } return type.cast(arg); }
[ "public", "static", "<", "T", "extends", "Object", ">", "T", "assertAssignable", "(", "Object", "arg", ",", "Class", "<", "T", ">", "type", ")", "{", "assertNotNull", "(", "arg", ")", ";", "assertNotNull", "(", "type", ")", ";", "if", "(", "!", "type", ".", "isAssignableFrom", "(", "arg", ".", "getClass", "(", ")", ")", ")", "{", "throw", "new", "ClassCastException", "(", "new", "StringBuilder", "(", "\"The instance of type <\"", ")", ".", "append", "(", "arg", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ".", "append", "(", "\"> cannot be assigned to a <\"", ")", ".", "append", "(", "type", ".", "getName", "(", ")", ")", ".", "append", "(", "\">\"", ")", ".", "toString", "(", ")", ")", ";", "}", "return", "type", ".", "cast", "(", "arg", ")", ";", "}" ]
<p>Asserts that the given Object is assignable to the specified type. If either the generic Object or the {@link Class} is {@code null} a {@link NullPointerException} will be thrown with the message, <i>"The supplied argument was found to be &lt;null&gt;"</i>. If the object was not found to be in conformance with the specified type, a {@link ClassCastException} will be thrown with the message, <i>"The instance of type &lt;argument-type&gt; cannot be assigned to a &lt;specified-type&gt;"</i>.</p> @param arg the argument to be asserted for type conformance <br><br> @param type the {@link Class} type to which the argument must conform <br><br> @return the argument which was asserted to conform to the specified type <br><br> @throws ClassCastException if the supplied argument does not conform to the specified type <br><br> @since 1.3.0
[ "<p", ">", "Asserts", "that", "the", "given", "Object", "is", "assignable", "to", "the", "specified", "type", ".", "If", "either", "the", "generic", "Object", "or", "the", "{", "@link", "Class", "}", "is", "{", "@code", "null", "}", "a", "{", "@link", "NullPointerException", "}", "will", "be", "thrown", "with", "the", "message", "<i", ">", "The", "supplied", "argument", "was", "found", "to", "be", "&lt", ";", "null&gt", ";", "<", "/", "i", ">", ".", "If", "the", "object", "was", "not", "found", "to", "be", "in", "conformance", "with", "the", "specified", "type", "a", "{", "@link", "ClassCastException", "}", "will", "be", "thrown", "with", "the", "message", "<i", ">", "The", "instance", "of", "type", "&lt", ";", "argument", "-", "type&gt", ";", "cannot", "be", "assigned", "to", "a", "&lt", ";", "specified", "-", "type&gt", ";", "<", "/", "i", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/sahan/RoboZombie/blob/2e02f0d41647612e9d89360c5c48811ea86b33c8/robozombie/src/main/java/com/lonepulse/robozombie/util/Assert.java#L68-L82
elki-project/elki
elki-docutil/src/main/java/de/lmu/ifi/dbs/elki/application/internal/MarkdownDocStream.java
MarkdownDocStream.append
public MarkdownDocStream append(CharSequence p, int start, int end) { """ Output part of a string. @param p String @param start Begin @param end End @return {@code this} """ for(int pos = start; pos < end; ++pos) { final char c = p.charAt(pos); if(c == '\r') { continue; } append(c); // Uses \n magic. } return this; }
java
public MarkdownDocStream append(CharSequence p, int start, int end) { for(int pos = start; pos < end; ++pos) { final char c = p.charAt(pos); if(c == '\r') { continue; } append(c); // Uses \n magic. } return this; }
[ "public", "MarkdownDocStream", "append", "(", "CharSequence", "p", ",", "int", "start", ",", "int", "end", ")", "{", "for", "(", "int", "pos", "=", "start", ";", "pos", "<", "end", ";", "++", "pos", ")", "{", "final", "char", "c", "=", "p", ".", "charAt", "(", "pos", ")", ";", "if", "(", "c", "==", "'", "'", ")", "{", "continue", ";", "}", "append", "(", "c", ")", ";", "// Uses \\n magic.", "}", "return", "this", ";", "}" ]
Output part of a string. @param p String @param start Begin @param end End @return {@code this}
[ "Output", "part", "of", "a", "string", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-docutil/src/main/java/de/lmu/ifi/dbs/elki/application/internal/MarkdownDocStream.java#L124-L133
andrehertwig/admintool
admin-tools-log4j2/src/main/java/de/chandre/admintool/log4j2/AdminToolLog4j2Util.java
AdminToolLog4j2Util.changeLogger
public void changeLogger(final String name, final String levelStr, boolean parent) throws IllegalArgumentException { """ changes the level of an logger @param name logger name @param levelStr level as string @param parent if the logger is a parent logger @throws IllegalArgumentException """ Level level = getLevel(levelStr); changeLogger(name, level, parent); }
java
public void changeLogger(final String name, final String levelStr, boolean parent) throws IllegalArgumentException { Level level = getLevel(levelStr); changeLogger(name, level, parent); }
[ "public", "void", "changeLogger", "(", "final", "String", "name", ",", "final", "String", "levelStr", ",", "boolean", "parent", ")", "throws", "IllegalArgumentException", "{", "Level", "level", "=", "getLevel", "(", "levelStr", ")", ";", "changeLogger", "(", "name", ",", "level", ",", "parent", ")", ";", "}" ]
changes the level of an logger @param name logger name @param levelStr level as string @param parent if the logger is a parent logger @throws IllegalArgumentException
[ "changes", "the", "level", "of", "an", "logger" ]
train
https://github.com/andrehertwig/admintool/blob/6d391e2d26969b70e3ccabfc34202abe8d915080/admin-tools-log4j2/src/main/java/de/chandre/admintool/log4j2/AdminToolLog4j2Util.java#L215-L219
alkacon/opencms-core
src-modules/org/opencms/workplace/commons/CmsChtype.java
CmsChtype.dialogButtonsOkAdvancedCancel
public String dialogButtonsOkAdvancedCancel(String okAttrs, String advancedAttrs, String cancelAttrs) { """ Builds a button row with an optional "ok", "advanced" and a "cancel" button.<p> @param okAttrs optional attributes for the ok button @param advancedAttrs optional attributes for the advanced button @param cancelAttrs optional attributes for the cancel button @return the button row """ if (!m_advancedMode && m_limitedRestypes && OpenCms.getRoleManager().hasRole(getCms(), CmsRole.VFS_MANAGER)) { return dialogButtons( new int[] {BUTTON_OK, BUTTON_ADVANCED, BUTTON_CANCEL}, new String[] {okAttrs, advancedAttrs, cancelAttrs}); } else { return dialogButtonsOkCancel(okAttrs, cancelAttrs); } }
java
public String dialogButtonsOkAdvancedCancel(String okAttrs, String advancedAttrs, String cancelAttrs) { if (!m_advancedMode && m_limitedRestypes && OpenCms.getRoleManager().hasRole(getCms(), CmsRole.VFS_MANAGER)) { return dialogButtons( new int[] {BUTTON_OK, BUTTON_ADVANCED, BUTTON_CANCEL}, new String[] {okAttrs, advancedAttrs, cancelAttrs}); } else { return dialogButtonsOkCancel(okAttrs, cancelAttrs); } }
[ "public", "String", "dialogButtonsOkAdvancedCancel", "(", "String", "okAttrs", ",", "String", "advancedAttrs", ",", "String", "cancelAttrs", ")", "{", "if", "(", "!", "m_advancedMode", "&&", "m_limitedRestypes", "&&", "OpenCms", ".", "getRoleManager", "(", ")", ".", "hasRole", "(", "getCms", "(", ")", ",", "CmsRole", ".", "VFS_MANAGER", ")", ")", "{", "return", "dialogButtons", "(", "new", "int", "[", "]", "{", "BUTTON_OK", ",", "BUTTON_ADVANCED", ",", "BUTTON_CANCEL", "}", ",", "new", "String", "[", "]", "{", "okAttrs", ",", "advancedAttrs", ",", "cancelAttrs", "}", ")", ";", "}", "else", "{", "return", "dialogButtonsOkCancel", "(", "okAttrs", ",", "cancelAttrs", ")", ";", "}", "}" ]
Builds a button row with an optional "ok", "advanced" and a "cancel" button.<p> @param okAttrs optional attributes for the ok button @param advancedAttrs optional attributes for the advanced button @param cancelAttrs optional attributes for the cancel button @return the button row
[ "Builds", "a", "button", "row", "with", "an", "optional", "ok", "advanced", "and", "a", "cancel", "button", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsChtype.java#L197-L206
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/GeometryCoordinateDimension.java
GeometryCoordinateDimension.convert
public static Polygon convert(Polygon polygon, int dimension) { """ Force the dimension of the Polygon and update correctly the coordinate dimension @param polygon @param dimension @return """ LinearRing shell = GeometryCoordinateDimension.convert(polygon.getExteriorRing(),dimension); int nbOfHoles = polygon.getNumInteriorRing(); final LinearRing[] holes = new LinearRing[nbOfHoles]; for (int i = 0; i < nbOfHoles; i++) { holes[i] = GeometryCoordinateDimension.convert(polygon.getInteriorRingN(i),dimension); } return gf.createPolygon(shell, holes); }
java
public static Polygon convert(Polygon polygon, int dimension) { LinearRing shell = GeometryCoordinateDimension.convert(polygon.getExteriorRing(),dimension); int nbOfHoles = polygon.getNumInteriorRing(); final LinearRing[] holes = new LinearRing[nbOfHoles]; for (int i = 0; i < nbOfHoles; i++) { holes[i] = GeometryCoordinateDimension.convert(polygon.getInteriorRingN(i),dimension); } return gf.createPolygon(shell, holes); }
[ "public", "static", "Polygon", "convert", "(", "Polygon", "polygon", ",", "int", "dimension", ")", "{", "LinearRing", "shell", "=", "GeometryCoordinateDimension", ".", "convert", "(", "polygon", ".", "getExteriorRing", "(", ")", ",", "dimension", ")", ";", "int", "nbOfHoles", "=", "polygon", ".", "getNumInteriorRing", "(", ")", ";", "final", "LinearRing", "[", "]", "holes", "=", "new", "LinearRing", "[", "nbOfHoles", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nbOfHoles", ";", "i", "++", ")", "{", "holes", "[", "i", "]", "=", "GeometryCoordinateDimension", ".", "convert", "(", "polygon", ".", "getInteriorRingN", "(", "i", ")", ",", "dimension", ")", ";", "}", "return", "gf", ".", "createPolygon", "(", "shell", ",", "holes", ")", ";", "}" ]
Force the dimension of the Polygon and update correctly the coordinate dimension @param polygon @param dimension @return
[ "Force", "the", "dimension", "of", "the", "Polygon", "and", "update", "correctly", "the", "coordinate", "dimension" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/GeometryCoordinateDimension.java#L126-L134
http-builder-ng/http-builder-ng
http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java
HttpBuilder.postAsync
public CompletableFuture<Object> postAsync(@DelegatesTo(HttpConfig.class) final Closure closure) { """ Executes an asynchronous POST request on the configured URI (an asynchronous alias to the `post(Closure)` method), with additional configuration provided by the configuration closure. [source,groovy] ---- def http = HttpBuilder.configure { request.uri = 'http://localhost:10101' } def result = http.postAsync(){ request.uri.path = '/something' request.body = 'My content' request.contentType = 'text/plain' } ---- The configuration `closure` allows additional configuration for this request based on the {@link HttpConfig} interface. @param closure the additional configuration closure (delegated to {@link HttpConfig}) @return the {@link CompletableFuture} containing the future result data """ return CompletableFuture.supplyAsync(() -> post(closure), getExecutor()); }
java
public CompletableFuture<Object> postAsync(@DelegatesTo(HttpConfig.class) final Closure closure) { return CompletableFuture.supplyAsync(() -> post(closure), getExecutor()); }
[ "public", "CompletableFuture", "<", "Object", ">", "postAsync", "(", "@", "DelegatesTo", "(", "HttpConfig", ".", "class", ")", "final", "Closure", "closure", ")", "{", "return", "CompletableFuture", ".", "supplyAsync", "(", "(", ")", "->", "post", "(", "closure", ")", ",", "getExecutor", "(", ")", ")", ";", "}" ]
Executes an asynchronous POST request on the configured URI (an asynchronous alias to the `post(Closure)` method), with additional configuration provided by the configuration closure. [source,groovy] ---- def http = HttpBuilder.configure { request.uri = 'http://localhost:10101' } def result = http.postAsync(){ request.uri.path = '/something' request.body = 'My content' request.contentType = 'text/plain' } ---- The configuration `closure` allows additional configuration for this request based on the {@link HttpConfig} interface. @param closure the additional configuration closure (delegated to {@link HttpConfig}) @return the {@link CompletableFuture} containing the future result data
[ "Executes", "an", "asynchronous", "POST", "request", "on", "the", "configured", "URI", "(", "an", "asynchronous", "alias", "to", "the", "post", "(", "Closure", ")", "method", ")", "with", "additional", "configuration", "provided", "by", "the", "configuration", "closure", "." ]
train
https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java#L801-L803
allure-framework/allure-java
allure-java-commons/src/main/java/io/qameta/allure/AllureLifecycle.java
AllureLifecycle.updateStep
public void updateStep(final String uuid, final Consumer<StepResult> update) { """ Updates step by specified uuid. @param uuid the uuid of step. @param update the update function. """ final Optional<StepResult> found = storage.getStep(uuid); if (!found.isPresent()) { LOGGER.error("Could not update step: step with uuid {} not found", uuid); return; } final StepResult step = found.get(); notifier.beforeStepUpdate(step); update.accept(step); notifier.afterStepUpdate(step); }
java
public void updateStep(final String uuid, final Consumer<StepResult> update) { final Optional<StepResult> found = storage.getStep(uuid); if (!found.isPresent()) { LOGGER.error("Could not update step: step with uuid {} not found", uuid); return; } final StepResult step = found.get(); notifier.beforeStepUpdate(step); update.accept(step); notifier.afterStepUpdate(step); }
[ "public", "void", "updateStep", "(", "final", "String", "uuid", ",", "final", "Consumer", "<", "StepResult", ">", "update", ")", "{", "final", "Optional", "<", "StepResult", ">", "found", "=", "storage", ".", "getStep", "(", "uuid", ")", ";", "if", "(", "!", "found", ".", "isPresent", "(", ")", ")", "{", "LOGGER", ".", "error", "(", "\"Could not update step: step with uuid {} not found\"", ",", "uuid", ")", ";", "return", ";", "}", "final", "StepResult", "step", "=", "found", ".", "get", "(", ")", ";", "notifier", ".", "beforeStepUpdate", "(", "step", ")", ";", "update", ".", "accept", "(", "step", ")", ";", "notifier", ".", "afterStepUpdate", "(", "step", ")", ";", "}" ]
Updates step by specified uuid. @param uuid the uuid of step. @param update the update function.
[ "Updates", "step", "by", "specified", "uuid", "." ]
train
https://github.com/allure-framework/allure-java/blob/64015ca2b789aa6f7b19c793f1512e2f11d0174e/allure-java-commons/src/main/java/io/qameta/allure/AllureLifecycle.java#L510-L522
apache/incubator-shardingsphere
sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/recognizer/JDBCDriverURLRecognizerEngine.java
JDBCDriverURLRecognizerEngine.getDriverClassName
public static String getDriverClassName(final String url) { """ Get JDBC driver class name. @param url JDBC URL @return driver class name """ for (Entry<String, String> entry : URL_PREFIX_AND_DRIVER_CLASS_NAME_MAPPER.entrySet()) { if (url.startsWith(entry.getKey())) { return entry.getValue(); } } throw new ShardingException("Cannot resolve JDBC url `%s`. Please implements `%s` and add to SPI.", url, JDBCDriverURLRecognizer.class.getName()); }
java
public static String getDriverClassName(final String url) { for (Entry<String, String> entry : URL_PREFIX_AND_DRIVER_CLASS_NAME_MAPPER.entrySet()) { if (url.startsWith(entry.getKey())) { return entry.getValue(); } } throw new ShardingException("Cannot resolve JDBC url `%s`. Please implements `%s` and add to SPI.", url, JDBCDriverURLRecognizer.class.getName()); }
[ "public", "static", "String", "getDriverClassName", "(", "final", "String", "url", ")", "{", "for", "(", "Entry", "<", "String", ",", "String", ">", "entry", ":", "URL_PREFIX_AND_DRIVER_CLASS_NAME_MAPPER", ".", "entrySet", "(", ")", ")", "{", "if", "(", "url", ".", "startsWith", "(", "entry", ".", "getKey", "(", ")", ")", ")", "{", "return", "entry", ".", "getValue", "(", ")", ";", "}", "}", "throw", "new", "ShardingException", "(", "\"Cannot resolve JDBC url `%s`. Please implements `%s` and add to SPI.\"", ",", "url", ",", "JDBCDriverURLRecognizer", ".", "class", ".", "getName", "(", ")", ")", ";", "}" ]
Get JDBC driver class name. @param url JDBC URL @return driver class name
[ "Get", "JDBC", "driver", "class", "name", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/recognizer/JDBCDriverURLRecognizerEngine.java#L59-L66
JM-Lab/utils-java8
src/main/java/kr/jm/utils/helper/JMFiles.java
JMFiles.buildBufferedAppendWriter
public static Writer buildBufferedAppendWriter(Path path, Charset charset) { """ Build buffered append writer writer. @param path the path @param charset the charset @return the writer """ try { if (JMPath.notExists(path)) JMPathOperation.createFileWithParentDirectories(path); return Files.newBufferedWriter(path, charset, StandardOpenOption .APPEND); } catch (IOException e) { return JMExceptionManager.handleExceptionAndReturnNull(log, e, "buildBufferedAppendWriter", path, charset); } }
java
public static Writer buildBufferedAppendWriter(Path path, Charset charset) { try { if (JMPath.notExists(path)) JMPathOperation.createFileWithParentDirectories(path); return Files.newBufferedWriter(path, charset, StandardOpenOption .APPEND); } catch (IOException e) { return JMExceptionManager.handleExceptionAndReturnNull(log, e, "buildBufferedAppendWriter", path, charset); } }
[ "public", "static", "Writer", "buildBufferedAppendWriter", "(", "Path", "path", ",", "Charset", "charset", ")", "{", "try", "{", "if", "(", "JMPath", ".", "notExists", "(", "path", ")", ")", "JMPathOperation", ".", "createFileWithParentDirectories", "(", "path", ")", ";", "return", "Files", ".", "newBufferedWriter", "(", "path", ",", "charset", ",", "StandardOpenOption", ".", "APPEND", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "return", "JMExceptionManager", ".", "handleExceptionAndReturnNull", "(", "log", ",", "e", ",", "\"buildBufferedAppendWriter\"", ",", "path", ",", "charset", ")", ";", "}", "}" ]
Build buffered append writer writer. @param path the path @param charset the charset @return the writer
[ "Build", "buffered", "append", "writer", "writer", "." ]
train
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMFiles.java#L72-L82
jparsec/jparsec
jparsec/src/main/java/org/jparsec/pattern/Patterns.java
Patterns.hasAtLeast
public static Pattern hasAtLeast(final int n) { """ Returns a {@link Pattern} object that matches if the input has at least {@code n} characters left. Match length is {@code n} if succeed. """ return new Pattern() { @Override public int match(CharSequence src, int begin, int end) { if ((begin + n) > end) return MISMATCH; else return n; } @Override public String toString() { return ".{" + n + ",}"; } }; }
java
public static Pattern hasAtLeast(final int n) { return new Pattern() { @Override public int match(CharSequence src, int begin, int end) { if ((begin + n) > end) return MISMATCH; else return n; } @Override public String toString() { return ".{" + n + ",}"; } }; }
[ "public", "static", "Pattern", "hasAtLeast", "(", "final", "int", "n", ")", "{", "return", "new", "Pattern", "(", ")", "{", "@", "Override", "public", "int", "match", "(", "CharSequence", "src", ",", "int", "begin", ",", "int", "end", ")", "{", "if", "(", "(", "begin", "+", "n", ")", ">", "end", ")", "return", "MISMATCH", ";", "else", "return", "n", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "\".{\"", "+", "n", "+", "\",}\"", ";", "}", "}", ";", "}" ]
Returns a {@link Pattern} object that matches if the input has at least {@code n} characters left. Match length is {@code n} if succeed.
[ "Returns", "a", "{" ]
train
https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/pattern/Patterns.java#L130-L140
liferay/com-liferay-commerce
commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountPersistenceImpl.java
CommerceAccountPersistenceImpl.findByU_T
@Override public List<CommerceAccount> findByU_T(long userId, int type, int start, int end, OrderByComparator<CommerceAccount> orderByComparator) { """ Returns an ordered range of all the commerce accounts where userId = &#63; and type = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceAccountModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param userId the user ID @param type the type @param start the lower bound of the range of commerce accounts @param end the upper bound of the range of commerce accounts (not inclusive) @param orderByComparator the comparator to order the results by (optionally <code>null</code>) @return the ordered range of matching commerce accounts """ return findByU_T(userId, type, start, end, orderByComparator, true); }
java
@Override public List<CommerceAccount> findByU_T(long userId, int type, int start, int end, OrderByComparator<CommerceAccount> orderByComparator) { return findByU_T(userId, type, start, end, orderByComparator, true); }
[ "@", "Override", "public", "List", "<", "CommerceAccount", ">", "findByU_T", "(", "long", "userId", ",", "int", "type", ",", "int", "start", ",", "int", "end", ",", "OrderByComparator", "<", "CommerceAccount", ">", "orderByComparator", ")", "{", "return", "findByU_T", "(", "userId", ",", "type", ",", "start", ",", "end", ",", "orderByComparator", ",", "true", ")", ";", "}" ]
Returns an ordered range of all the commerce accounts where userId = &#63; and type = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceAccountModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param userId the user ID @param type the type @param start the lower bound of the range of commerce accounts @param end the upper bound of the range of commerce accounts (not inclusive) @param orderByComparator the comparator to order the results by (optionally <code>null</code>) @return the ordered range of matching commerce accounts
[ "Returns", "an", "ordered", "range", "of", "all", "the", "commerce", "accounts", "where", "userId", "=", "&#63", ";", "and", "type", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountPersistenceImpl.java#L1038-L1042
OpenLiberty/open-liberty
dev/com.ibm.json4j/src/com/ibm/json/xml/internal/JSONObject.java
JSONObject.writeTextOnlyObject
private void writeTextOnlyObject(Writer writer, int indentDepth, boolean contentOnly, boolean compact) throws IOException { """ Method to write a text ony XML tagset, like <F>FOO</F> @param writer The writer object to render the XML to. @param indentDepth How far to indent. @param contentOnly Whether or not to write the object name as part of the output @param compact Whether or not to write the ohject in compact form, or nice indent form. @throws IOException Trhown if an error occurs on write. """ if (logger.isLoggable(Level.FINER)) logger.entering(className, "writeTextOnlyObject(Writer, int, boolean, boolean)"); if (!contentOnly) { writeAttribute(writer,this.objectName,this.tagText.trim(),indentDepth, compact); } else { if (!compact) { writeIndention(writer, indentDepth); writer.write("\"" + escapeStringSpecialCharacters(this.tagText.trim()) + "\""); } else { writer.write("\"" + escapeStringSpecialCharacters(this.tagText.trim()) + "\""); } } if (logger.isLoggable(Level.FINER)) logger.exiting(className, "writeTextOnlyObject(Writer, int, boolean, boolean)"); }
java
private void writeTextOnlyObject(Writer writer, int indentDepth, boolean contentOnly, boolean compact) throws IOException { if (logger.isLoggable(Level.FINER)) logger.entering(className, "writeTextOnlyObject(Writer, int, boolean, boolean)"); if (!contentOnly) { writeAttribute(writer,this.objectName,this.tagText.trim(),indentDepth, compact); } else { if (!compact) { writeIndention(writer, indentDepth); writer.write("\"" + escapeStringSpecialCharacters(this.tagText.trim()) + "\""); } else { writer.write("\"" + escapeStringSpecialCharacters(this.tagText.trim()) + "\""); } } if (logger.isLoggable(Level.FINER)) logger.exiting(className, "writeTextOnlyObject(Writer, int, boolean, boolean)"); }
[ "private", "void", "writeTextOnlyObject", "(", "Writer", "writer", ",", "int", "indentDepth", ",", "boolean", "contentOnly", ",", "boolean", "compact", ")", "throws", "IOException", "{", "if", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINER", ")", ")", "logger", ".", "entering", "(", "className", ",", "\"writeTextOnlyObject(Writer, int, boolean, boolean)\"", ")", ";", "if", "(", "!", "contentOnly", ")", "{", "writeAttribute", "(", "writer", ",", "this", ".", "objectName", ",", "this", ".", "tagText", ".", "trim", "(", ")", ",", "indentDepth", ",", "compact", ")", ";", "}", "else", "{", "if", "(", "!", "compact", ")", "{", "writeIndention", "(", "writer", ",", "indentDepth", ")", ";", "writer", ".", "write", "(", "\"\\\"\"", "+", "escapeStringSpecialCharacters", "(", "this", ".", "tagText", ".", "trim", "(", ")", ")", "+", "\"\\\"\"", ")", ";", "}", "else", "{", "writer", ".", "write", "(", "\"\\\"\"", "+", "escapeStringSpecialCharacters", "(", "this", ".", "tagText", ".", "trim", "(", ")", ")", "+", "\"\\\"\"", ")", ";", "}", "}", "if", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINER", ")", ")", "logger", ".", "exiting", "(", "className", ",", "\"writeTextOnlyObject(Writer, int, boolean, boolean)\"", ")", ";", "}" ]
Method to write a text ony XML tagset, like <F>FOO</F> @param writer The writer object to render the XML to. @param indentDepth How far to indent. @param contentOnly Whether or not to write the object name as part of the output @param compact Whether or not to write the ohject in compact form, or nice indent form. @throws IOException Trhown if an error occurs on write.
[ "Method", "to", "write", "a", "text", "ony", "XML", "tagset", "like", "<F", ">", "FOO<", "/", "F", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.json4j/src/com/ibm/json/xml/internal/JSONObject.java#L621-L644
calimero-project/calimero-core
src/tuwien/auto/calimero/mgmt/TransportLayerImpl.java
TransportLayerImpl.createDestination
@Override public Destination createDestination(final IndividualAddress remote, final boolean connectionOriented, final boolean keepAlive, final boolean verifyMode) { """ {@inheritDoc} Only one destination can be created per remote address. If a destination with the supplied remote address already exists for this transport layer, a {@link KNXIllegalArgumentException} is thrown.<br> A transport layer can only handle one connection per destination, because it can't distinguish incoming messages between more than one connection. """ if (detached) throw new IllegalStateException("TL detached"); synchronized (proxies) { if (proxies.containsKey(remote)) throw new KNXIllegalArgumentException("destination already created: " + remote); final AggregatorProxy p = new AggregatorProxy(this); final Destination d = new Destination(p, remote, connectionOriented, keepAlive, verifyMode); proxies.put(remote, p); logger.trace("created {} destination for {}", (connectionOriented ? "co" : "cl"), remote); return d; } }
java
@Override public Destination createDestination(final IndividualAddress remote, final boolean connectionOriented, final boolean keepAlive, final boolean verifyMode) { if (detached) throw new IllegalStateException("TL detached"); synchronized (proxies) { if (proxies.containsKey(remote)) throw new KNXIllegalArgumentException("destination already created: " + remote); final AggregatorProxy p = new AggregatorProxy(this); final Destination d = new Destination(p, remote, connectionOriented, keepAlive, verifyMode); proxies.put(remote, p); logger.trace("created {} destination for {}", (connectionOriented ? "co" : "cl"), remote); return d; } }
[ "@", "Override", "public", "Destination", "createDestination", "(", "final", "IndividualAddress", "remote", ",", "final", "boolean", "connectionOriented", ",", "final", "boolean", "keepAlive", ",", "final", "boolean", "verifyMode", ")", "{", "if", "(", "detached", ")", "throw", "new", "IllegalStateException", "(", "\"TL detached\"", ")", ";", "synchronized", "(", "proxies", ")", "{", "if", "(", "proxies", ".", "containsKey", "(", "remote", ")", ")", "throw", "new", "KNXIllegalArgumentException", "(", "\"destination already created: \"", "+", "remote", ")", ";", "final", "AggregatorProxy", "p", "=", "new", "AggregatorProxy", "(", "this", ")", ";", "final", "Destination", "d", "=", "new", "Destination", "(", "p", ",", "remote", ",", "connectionOriented", ",", "keepAlive", ",", "verifyMode", ")", ";", "proxies", ".", "put", "(", "remote", ",", "p", ")", ";", "logger", ".", "trace", "(", "\"created {} destination for {}\"", ",", "(", "connectionOriented", "?", "\"co\"", ":", "\"cl\"", ")", ",", "remote", ")", ";", "return", "d", ";", "}", "}" ]
{@inheritDoc} Only one destination can be created per remote address. If a destination with the supplied remote address already exists for this transport layer, a {@link KNXIllegalArgumentException} is thrown.<br> A transport layer can only handle one connection per destination, because it can't distinguish incoming messages between more than one connection.
[ "{" ]
train
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/mgmt/TransportLayerImpl.java#L233-L248
aerogear/aerogear-unifiedpush-server
push-sender/src/main/java/org/jboss/aerogear/unifiedpush/message/sender/FCMPushNotificationSender.java
FCMPushNotificationSender.processFCM
private void processFCM(AndroidVariant androidVariant, List<String> pushTargets, Message fcmMessage, ConfigurableFCMSender sender) throws IOException { """ Process the HTTP POST to the FCM infrastructure for the given list of registrationIDs. """ // push targets can be registration IDs OR topics (starting /topic/), but they can't be mixed. if (pushTargets.get(0).startsWith(Constants.TOPIC_PREFIX)) { // perform the topic delivery for (String topic : pushTargets) { logger.info(String.format("Sent push notification to FCM topic: %s", topic)); Result result = sender.sendNoRetry(fcmMessage, topic); logger.trace("Response from FCM topic request: {}", result); } } else { logger.info(String.format("Sent push notification to FCM Server for %d registrationIDs", pushTargets.size())); MulticastResult multicastResult = sender.sendNoRetry(fcmMessage, pushTargets); logger.trace("Response from FCM request: {}", multicastResult); // after sending, let's identify the inactive/invalid registrationIDs and trigger their deletion: cleanupInvalidRegistrationIDsForVariant(androidVariant.getVariantID(), multicastResult, pushTargets); } }
java
private void processFCM(AndroidVariant androidVariant, List<String> pushTargets, Message fcmMessage, ConfigurableFCMSender sender) throws IOException { // push targets can be registration IDs OR topics (starting /topic/), but they can't be mixed. if (pushTargets.get(0).startsWith(Constants.TOPIC_PREFIX)) { // perform the topic delivery for (String topic : pushTargets) { logger.info(String.format("Sent push notification to FCM topic: %s", topic)); Result result = sender.sendNoRetry(fcmMessage, topic); logger.trace("Response from FCM topic request: {}", result); } } else { logger.info(String.format("Sent push notification to FCM Server for %d registrationIDs", pushTargets.size())); MulticastResult multicastResult = sender.sendNoRetry(fcmMessage, pushTargets); logger.trace("Response from FCM request: {}", multicastResult); // after sending, let's identify the inactive/invalid registrationIDs and trigger their deletion: cleanupInvalidRegistrationIDsForVariant(androidVariant.getVariantID(), multicastResult, pushTargets); } }
[ "private", "void", "processFCM", "(", "AndroidVariant", "androidVariant", ",", "List", "<", "String", ">", "pushTargets", ",", "Message", "fcmMessage", ",", "ConfigurableFCMSender", "sender", ")", "throws", "IOException", "{", "// push targets can be registration IDs OR topics (starting /topic/), but they can't be mixed.", "if", "(", "pushTargets", ".", "get", "(", "0", ")", ".", "startsWith", "(", "Constants", ".", "TOPIC_PREFIX", ")", ")", "{", "// perform the topic delivery", "for", "(", "String", "topic", ":", "pushTargets", ")", "{", "logger", ".", "info", "(", "String", ".", "format", "(", "\"Sent push notification to FCM topic: %s\"", ",", "topic", ")", ")", ";", "Result", "result", "=", "sender", ".", "sendNoRetry", "(", "fcmMessage", ",", "topic", ")", ";", "logger", ".", "trace", "(", "\"Response from FCM topic request: {}\"", ",", "result", ")", ";", "}", "}", "else", "{", "logger", ".", "info", "(", "String", ".", "format", "(", "\"Sent push notification to FCM Server for %d registrationIDs\"", ",", "pushTargets", ".", "size", "(", ")", ")", ")", ";", "MulticastResult", "multicastResult", "=", "sender", ".", "sendNoRetry", "(", "fcmMessage", ",", "pushTargets", ")", ";", "logger", ".", "trace", "(", "\"Response from FCM request: {}\"", ",", "multicastResult", ")", ";", "// after sending, let's identify the inactive/invalid registrationIDs and trigger their deletion:", "cleanupInvalidRegistrationIDsForVariant", "(", "androidVariant", ".", "getVariantID", "(", ")", ",", "multicastResult", ",", "pushTargets", ")", ";", "}", "}" ]
Process the HTTP POST to the FCM infrastructure for the given list of registrationIDs.
[ "Process", "the", "HTTP", "POST", "to", "the", "FCM", "infrastructure", "for", "the", "given", "list", "of", "registrationIDs", "." ]
train
https://github.com/aerogear/aerogear-unifiedpush-server/blob/c7b798f085449117d84345d8c378b27165cad32b/push-sender/src/main/java/org/jboss/aerogear/unifiedpush/message/sender/FCMPushNotificationSender.java#L142-L165
jhunters/jprotobuf
v3/src/main/java/com/baidu/bjf/remoting/protobuf/code/CodeGenerator.java
CodeGenerator.checkType
private void checkType(FieldType type, Field field) { """ Check {@link FieldType} is validate to class type of {@link Field} @param type @param field """ Class<?> cls = field.getType(); if (type == FieldType.OBJECT || type == FieldType.ENUM) { return; } String javaType = type.getJavaType(); if (Integer.class.getSimpleName().equals(javaType)) { if (cls.getSimpleName().equals("int") || Integer.class.getSimpleName().equals(cls.getSimpleName())) { return; } throw new IllegalArgumentException(getMismatchTypeErroMessage(type, field)); } if (!javaType.equalsIgnoreCase(cls.getSimpleName())) { throw new IllegalArgumentException(getMismatchTypeErroMessage(type, field)); } }
java
private void checkType(FieldType type, Field field) { Class<?> cls = field.getType(); if (type == FieldType.OBJECT || type == FieldType.ENUM) { return; } String javaType = type.getJavaType(); if (Integer.class.getSimpleName().equals(javaType)) { if (cls.getSimpleName().equals("int") || Integer.class.getSimpleName().equals(cls.getSimpleName())) { return; } throw new IllegalArgumentException(getMismatchTypeErroMessage(type, field)); } if (!javaType.equalsIgnoreCase(cls.getSimpleName())) { throw new IllegalArgumentException(getMismatchTypeErroMessage(type, field)); } }
[ "private", "void", "checkType", "(", "FieldType", "type", ",", "Field", "field", ")", "{", "Class", "<", "?", ">", "cls", "=", "field", ".", "getType", "(", ")", ";", "if", "(", "type", "==", "FieldType", ".", "OBJECT", "||", "type", "==", "FieldType", ".", "ENUM", ")", "{", "return", ";", "}", "String", "javaType", "=", "type", ".", "getJavaType", "(", ")", ";", "if", "(", "Integer", ".", "class", ".", "getSimpleName", "(", ")", ".", "equals", "(", "javaType", ")", ")", "{", "if", "(", "cls", ".", "getSimpleName", "(", ")", ".", "equals", "(", "\"int\"", ")", "||", "Integer", ".", "class", ".", "getSimpleName", "(", ")", ".", "equals", "(", "cls", ".", "getSimpleName", "(", ")", ")", ")", "{", "return", ";", "}", "throw", "new", "IllegalArgumentException", "(", "getMismatchTypeErroMessage", "(", "type", ",", "field", ")", ")", ";", "}", "if", "(", "!", "javaType", ".", "equalsIgnoreCase", "(", "cls", ".", "getSimpleName", "(", ")", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "getMismatchTypeErroMessage", "(", "type", ",", "field", ")", ")", ";", "}", "}" ]
Check {@link FieldType} is validate to class type of {@link Field} @param type @param field
[ "Check", "{", "@link", "FieldType", "}", "is", "validate", "to", "class", "type", "of", "{", "@link", "Field", "}" ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/v3/src/main/java/com/baidu/bjf/remoting/protobuf/code/CodeGenerator.java#L547-L564
Harium/keel
src/main/java/com/harium/keel/util/CameraUtil.java
CameraUtil.fieldOfView
public static float fieldOfView(float focalLength, float sensorWidth) { """ Calculate the FOV of camera, using focalLength and sensorWidth @param focalLength @param sensorWidth @return FOV """ double fov = 2 * Math.atan(.5 * sensorWidth / focalLength); return (float) Math.toDegrees(fov); }
java
public static float fieldOfView(float focalLength, float sensorWidth) { double fov = 2 * Math.atan(.5 * sensorWidth / focalLength); return (float) Math.toDegrees(fov); }
[ "public", "static", "float", "fieldOfView", "(", "float", "focalLength", ",", "float", "sensorWidth", ")", "{", "double", "fov", "=", "2", "*", "Math", ".", "atan", "(", ".5", "*", "sensorWidth", "/", "focalLength", ")", ";", "return", "(", "float", ")", "Math", ".", "toDegrees", "(", "fov", ")", ";", "}" ]
Calculate the FOV of camera, using focalLength and sensorWidth @param focalLength @param sensorWidth @return FOV
[ "Calculate", "the", "FOV", "of", "camera", "using", "focalLength", "and", "sensorWidth" ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/util/CameraUtil.java#L24-L27
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/KeyHasher.java
KeyHasher.getNextHash
static UUID getNextHash(UUID hash) { """ Generates a new Key Hash that is immediately after the given one. We define Key Hash H2 to be immediately after Key Hash h1 if there doesn't exist Key Hash H3 such that H1&lt;H3&lt;H2. The ordering is performed using {@link UUID#compareTo}. @return The successor Key Hash, or null if no more successors are available (if {@link IteratorState#isEnd} returns true). """ if (hash == null) { // No hash given. By definition, the first hash is the "next" one". hash = MIN_HASH; } else if (hash.compareTo(MAX_HASH) >= 0) { // Given hash already equals or exceeds the max value. There is no successor. return null; } long msb = hash.getMostSignificantBits(); long lsb = hash.getLeastSignificantBits(); if (lsb == Long.MAX_VALUE) { msb++; // This won't overflow since we've checked that state is not end (i.e., id != MAX). lsb = Long.MIN_VALUE; } else { lsb++; } return new UUID(msb, lsb); }
java
static UUID getNextHash(UUID hash) { if (hash == null) { // No hash given. By definition, the first hash is the "next" one". hash = MIN_HASH; } else if (hash.compareTo(MAX_HASH) >= 0) { // Given hash already equals or exceeds the max value. There is no successor. return null; } long msb = hash.getMostSignificantBits(); long lsb = hash.getLeastSignificantBits(); if (lsb == Long.MAX_VALUE) { msb++; // This won't overflow since we've checked that state is not end (i.e., id != MAX). lsb = Long.MIN_VALUE; } else { lsb++; } return new UUID(msb, lsb); }
[ "static", "UUID", "getNextHash", "(", "UUID", "hash", ")", "{", "if", "(", "hash", "==", "null", ")", "{", "// No hash given. By definition, the first hash is the \"next\" one\".", "hash", "=", "MIN_HASH", ";", "}", "else", "if", "(", "hash", ".", "compareTo", "(", "MAX_HASH", ")", ">=", "0", ")", "{", "// Given hash already equals or exceeds the max value. There is no successor.", "return", "null", ";", "}", "long", "msb", "=", "hash", ".", "getMostSignificantBits", "(", ")", ";", "long", "lsb", "=", "hash", ".", "getLeastSignificantBits", "(", ")", ";", "if", "(", "lsb", "==", "Long", ".", "MAX_VALUE", ")", "{", "msb", "++", ";", "// This won't overflow since we've checked that state is not end (i.e., id != MAX).", "lsb", "=", "Long", ".", "MIN_VALUE", ";", "}", "else", "{", "lsb", "++", ";", "}", "return", "new", "UUID", "(", "msb", ",", "lsb", ")", ";", "}" ]
Generates a new Key Hash that is immediately after the given one. We define Key Hash H2 to be immediately after Key Hash h1 if there doesn't exist Key Hash H3 such that H1&lt;H3&lt;H2. The ordering is performed using {@link UUID#compareTo}. @return The successor Key Hash, or null if no more successors are available (if {@link IteratorState#isEnd} returns true).
[ "Generates", "a", "new", "Key", "Hash", "that", "is", "immediately", "after", "the", "given", "one", ".", "We", "define", "Key", "Hash", "H2", "to", "be", "immediately", "after", "Key", "Hash", "h1", "if", "there", "doesn", "t", "exist", "Key", "Hash", "H3", "such", "that", "H1&lt", ";", "H3&lt", ";", "H2", ".", "The", "ordering", "is", "performed", "using", "{", "@link", "UUID#compareTo", "}", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/KeyHasher.java#L80-L99
ksclarke/vertx-pairtree
src/main/java/info/freelibrary/pairtree/PairtreeUtils.java
PairtreeUtils.mapToID
public static String mapToID(final String aBasePath, final String aPtPath) throws InvalidPathException { """ Maps the supplied base path to an ID using the supplied Pairtree path. @param aBasePath A base path to use for the mapping @param aPtPath A Pairtree path to map to an ID @return The ID that is a result of the mapping @throws InvalidPathException If there is trouble mapping the path """ return mapToID(removeBasePath(aBasePath, aPtPath)); }
java
public static String mapToID(final String aBasePath, final String aPtPath) throws InvalidPathException { return mapToID(removeBasePath(aBasePath, aPtPath)); }
[ "public", "static", "String", "mapToID", "(", "final", "String", "aBasePath", ",", "final", "String", "aPtPath", ")", "throws", "InvalidPathException", "{", "return", "mapToID", "(", "removeBasePath", "(", "aBasePath", ",", "aPtPath", ")", ")", ";", "}" ]
Maps the supplied base path to an ID using the supplied Pairtree path. @param aBasePath A base path to use for the mapping @param aPtPath A Pairtree path to map to an ID @return The ID that is a result of the mapping @throws InvalidPathException If there is trouble mapping the path
[ "Maps", "the", "supplied", "base", "path", "to", "an", "ID", "using", "the", "supplied", "Pairtree", "path", "." ]
train
https://github.com/ksclarke/vertx-pairtree/blob/b2ea1e32057e5df262e9265540d346a732b718df/src/main/java/info/freelibrary/pairtree/PairtreeUtils.java#L198-L200
sebastiangraf/jSCSI
bundles/target/src/main/java/org/jscsi/target/scsi/sense/senseDataDescriptor/SenseDataDescriptor.java
SenseDataDescriptor.serializeCommonFields
private final void serializeCommonFields (final ByteBuffer byteBuffer, final int index) { """ Serializes the fields common to all sense data descriptors. @param byteBuffer where the serialized fields will be stored @param index the position of the first byte of the sense data descriptor in the {@link ByteBuffer} """ byteBuffer.position(index); byteBuffer.put(descriptorType.getValue()); byteBuffer.put((byte) additionalLength); }
java
private final void serializeCommonFields (final ByteBuffer byteBuffer, final int index) { byteBuffer.position(index); byteBuffer.put(descriptorType.getValue()); byteBuffer.put((byte) additionalLength); }
[ "private", "final", "void", "serializeCommonFields", "(", "final", "ByteBuffer", "byteBuffer", ",", "final", "int", "index", ")", "{", "byteBuffer", ".", "position", "(", "index", ")", ";", "byteBuffer", ".", "put", "(", "descriptorType", ".", "getValue", "(", ")", ")", ";", "byteBuffer", ".", "put", "(", "(", "byte", ")", "additionalLength", ")", ";", "}" ]
Serializes the fields common to all sense data descriptors. @param byteBuffer where the serialized fields will be stored @param index the position of the first byte of the sense data descriptor in the {@link ByteBuffer}
[ "Serializes", "the", "fields", "common", "to", "all", "sense", "data", "descriptors", "." ]
train
https://github.com/sebastiangraf/jSCSI/blob/6169bfe73f0b15de7d6485453555389e782ae888/bundles/target/src/main/java/org/jscsi/target/scsi/sense/senseDataDescriptor/SenseDataDescriptor.java#L54-L58
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java
BlocksMap.removeNode
boolean removeNode(Block b, DatanodeDescriptor node) { """ Remove data-node reference from the block. Remove the block from the block map only if it does not belong to any file and data-nodes. """ BlockInfo info = blocks.get(b); if (info == null) return false; // remove block from the data-node list and the node from the block info boolean removed = node.removeBlock(info); if (info.getDatanode(0) == null // no datanodes left && info.inode == null) { // does not belong to a file removeBlockFromMap(b); // remove block from the map } return removed; }
java
boolean removeNode(Block b, DatanodeDescriptor node) { BlockInfo info = blocks.get(b); if (info == null) return false; // remove block from the data-node list and the node from the block info boolean removed = node.removeBlock(info); if (info.getDatanode(0) == null // no datanodes left && info.inode == null) { // does not belong to a file removeBlockFromMap(b); // remove block from the map } return removed; }
[ "boolean", "removeNode", "(", "Block", "b", ",", "DatanodeDescriptor", "node", ")", "{", "BlockInfo", "info", "=", "blocks", ".", "get", "(", "b", ")", ";", "if", "(", "info", "==", "null", ")", "return", "false", ";", "// remove block from the data-node list and the node from the block info", "boolean", "removed", "=", "node", ".", "removeBlock", "(", "info", ")", ";", "if", "(", "info", ".", "getDatanode", "(", "0", ")", "==", "null", "// no datanodes left", "&&", "info", ".", "inode", "==", "null", ")", "{", "// does not belong to a file", "removeBlockFromMap", "(", "b", ")", ";", "// remove block from the map", "}", "return", "removed", ";", "}" ]
Remove data-node reference from the block. Remove the block from the block map only if it does not belong to any file and data-nodes.
[ "Remove", "data", "-", "node", "reference", "from", "the", "block", ".", "Remove", "the", "block", "from", "the", "block", "map", "only", "if", "it", "does", "not", "belong", "to", "any", "file", "and", "data", "-", "nodes", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java#L555-L568
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/attributes/AttributeLocalizedContentUrl.java
AttributeLocalizedContentUrl.updateLocalizedContentUrl
public static MozuUrl updateLocalizedContentUrl(String attributeFQN, String localeCode, String responseFields) { """ Get Resource Url for UpdateLocalizedContent @param attributeFQN Fully qualified name for an attribute. @param localeCode The two character country code that sets the locale, such as US for United States. Sites, tenants, and catalogs use locale codes for localizing content, such as translated product text per supported country. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url """ UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/LocalizedContent/{localeCode}?responseFields={responseFields}"); formatter.formatUrl("attributeFQN", attributeFQN); formatter.formatUrl("localeCode", localeCode); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl updateLocalizedContentUrl(String attributeFQN, String localeCode, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/LocalizedContent/{localeCode}?responseFields={responseFields}"); formatter.formatUrl("attributeFQN", attributeFQN); formatter.formatUrl("localeCode", localeCode); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "updateLocalizedContentUrl", "(", "String", "attributeFQN", ",", "String", "localeCode", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/LocalizedContent/{localeCode}?responseFields={responseFields}\"", ")", ";", "formatter", ".", "formatUrl", "(", "\"attributeFQN\"", ",", "attributeFQN", ")", ";", "formatter", ".", "formatUrl", "(", "\"localeCode\"", ",", "localeCode", ")", ";", "formatter", ".", "formatUrl", "(", "\"responseFields\"", ",", "responseFields", ")", ";", "return", "new", "MozuUrl", "(", "formatter", ".", "getResourceUrl", "(", ")", ",", "MozuUrl", ".", "UrlLocation", ".", "TENANT_POD", ")", ";", "}" ]
Get Resource Url for UpdateLocalizedContent @param attributeFQN Fully qualified name for an attribute. @param localeCode The two character country code that sets the locale, such as US for United States. Sites, tenants, and catalogs use locale codes for localizing content, such as translated product text per supported country. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "UpdateLocalizedContent" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/attributes/AttributeLocalizedContentUrl.java#L77-L84
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ProcessGroovyMethods.java
ProcessGroovyMethods.consumeProcessOutput
public static void consumeProcessOutput(Process self, Appendable output, Appendable error) { """ Gets the output and error streams from a process and reads them to keep the process from blocking due to a full output buffer. The processed stream data is appended to the supplied Appendable. For this, two Threads are started, so this method will return immediately. The threads will not be join()ed, even if waitFor() is called. To wait for the output to be fully consumed call waitForProcessOutput(). @param self a Process @param output an Appendable to capture the process stdout @param error an Appendable to capture the process stderr @since 1.7.5 """ consumeProcessOutputStream(self, output); consumeProcessErrorStream(self, error); }
java
public static void consumeProcessOutput(Process self, Appendable output, Appendable error) { consumeProcessOutputStream(self, output); consumeProcessErrorStream(self, error); }
[ "public", "static", "void", "consumeProcessOutput", "(", "Process", "self", ",", "Appendable", "output", ",", "Appendable", "error", ")", "{", "consumeProcessOutputStream", "(", "self", ",", "output", ")", ";", "consumeProcessErrorStream", "(", "self", ",", "error", ")", ";", "}" ]
Gets the output and error streams from a process and reads them to keep the process from blocking due to a full output buffer. The processed stream data is appended to the supplied Appendable. For this, two Threads are started, so this method will return immediately. The threads will not be join()ed, even if waitFor() is called. To wait for the output to be fully consumed call waitForProcessOutput(). @param self a Process @param output an Appendable to capture the process stdout @param error an Appendable to capture the process stderr @since 1.7.5
[ "Gets", "the", "output", "and", "error", "streams", "from", "a", "process", "and", "reads", "them", "to", "keep", "the", "process", "from", "blocking", "due", "to", "a", "full", "output", "buffer", ".", "The", "processed", "stream", "data", "is", "appended", "to", "the", "supplied", "Appendable", ".", "For", "this", "two", "Threads", "are", "started", "so", "this", "method", "will", "return", "immediately", ".", "The", "threads", "will", "not", "be", "join", "()", "ed", "even", "if", "waitFor", "()", "is", "called", ".", "To", "wait", "for", "the", "output", "to", "be", "fully", "consumed", "call", "waitForProcessOutput", "()", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ProcessGroovyMethods.java#L187-L190
rapidpro/expressions
java/src/main/java/io/rapidpro/expressions/functions/ExcelFunctions.java
ExcelFunctions.datedif
public static int datedif(EvaluationContext ctx, Object startDate, Object endDate, Object unit) { """ Calculates the number of days, months, or years between two dates. """ LocalDate _startDate = Conversions.toDate(startDate, ctx); LocalDate _endDate = Conversions.toDate(endDate, ctx); String _unit = Conversions.toString(unit, ctx).toLowerCase(); if (_startDate.isAfter(_endDate)) { throw new RuntimeException("Start date cannot be after end date"); } switch (_unit) { case "y": return (int) ChronoUnit.YEARS.between(_startDate, _endDate); case "m": return (int) ChronoUnit.MONTHS.between(_startDate, _endDate); case "d": return (int) ChronoUnit.DAYS.between(_startDate, _endDate); case "md": return Period.between(_startDate, _endDate).getDays(); case "ym": return Period.between(_startDate, _endDate).getMonths(); case "yd": return (int) ChronoUnit.DAYS.between(_startDate.withYear(_endDate.getYear()), _endDate); } throw new RuntimeException("Invalid unit value: " + _unit); }
java
public static int datedif(EvaluationContext ctx, Object startDate, Object endDate, Object unit) { LocalDate _startDate = Conversions.toDate(startDate, ctx); LocalDate _endDate = Conversions.toDate(endDate, ctx); String _unit = Conversions.toString(unit, ctx).toLowerCase(); if (_startDate.isAfter(_endDate)) { throw new RuntimeException("Start date cannot be after end date"); } switch (_unit) { case "y": return (int) ChronoUnit.YEARS.between(_startDate, _endDate); case "m": return (int) ChronoUnit.MONTHS.between(_startDate, _endDate); case "d": return (int) ChronoUnit.DAYS.between(_startDate, _endDate); case "md": return Period.between(_startDate, _endDate).getDays(); case "ym": return Period.between(_startDate, _endDate).getMonths(); case "yd": return (int) ChronoUnit.DAYS.between(_startDate.withYear(_endDate.getYear()), _endDate); } throw new RuntimeException("Invalid unit value: " + _unit); }
[ "public", "static", "int", "datedif", "(", "EvaluationContext", "ctx", ",", "Object", "startDate", ",", "Object", "endDate", ",", "Object", "unit", ")", "{", "LocalDate", "_startDate", "=", "Conversions", ".", "toDate", "(", "startDate", ",", "ctx", ")", ";", "LocalDate", "_endDate", "=", "Conversions", ".", "toDate", "(", "endDate", ",", "ctx", ")", ";", "String", "_unit", "=", "Conversions", ".", "toString", "(", "unit", ",", "ctx", ")", ".", "toLowerCase", "(", ")", ";", "if", "(", "_startDate", ".", "isAfter", "(", "_endDate", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"Start date cannot be after end date\"", ")", ";", "}", "switch", "(", "_unit", ")", "{", "case", "\"y\"", ":", "return", "(", "int", ")", "ChronoUnit", ".", "YEARS", ".", "between", "(", "_startDate", ",", "_endDate", ")", ";", "case", "\"m\"", ":", "return", "(", "int", ")", "ChronoUnit", ".", "MONTHS", ".", "between", "(", "_startDate", ",", "_endDate", ")", ";", "case", "\"d\"", ":", "return", "(", "int", ")", "ChronoUnit", ".", "DAYS", ".", "between", "(", "_startDate", ",", "_endDate", ")", ";", "case", "\"md\"", ":", "return", "Period", ".", "between", "(", "_startDate", ",", "_endDate", ")", ".", "getDays", "(", ")", ";", "case", "\"ym\"", ":", "return", "Period", ".", "between", "(", "_startDate", ",", "_endDate", ")", ".", "getMonths", "(", ")", ";", "case", "\"yd\"", ":", "return", "(", "int", ")", "ChronoUnit", ".", "DAYS", ".", "between", "(", "_startDate", ".", "withYear", "(", "_endDate", ".", "getYear", "(", ")", ")", ",", "_endDate", ")", ";", "}", "throw", "new", "RuntimeException", "(", "\"Invalid unit value: \"", "+", "_unit", ")", ";", "}" ]
Calculates the number of days, months, or years between two dates.
[ "Calculates", "the", "number", "of", "days", "months", "or", "years", "between", "two", "dates", "." ]
train
https://github.com/rapidpro/expressions/blob/b03d91ec58fc328960bce90ecb5fa49dcf467627/java/src/main/java/io/rapidpro/expressions/functions/ExcelFunctions.java#L214-L239
doanduyhai/Achilles
achilles-core/src/main/java/info/archinnov/achilles/internals/dsl/options/AbstractOptionsForSelect.java
AbstractOptionsForSelect.withResultSetAsyncListener
public T withResultSetAsyncListener(Function<ResultSet, ResultSet> resultSetAsyncListener) { """ Add the given async listener on the {@link com.datastax.driver.core.ResultSet} object. Example of usage: <pre class="code"><code class="java"> .withResultSetAsyncListener(resultSet -> { //Do something with the resultSet object here }) </code></pre> Remark: <strong>it is not allowed to consume the ResultSet values. It is strongly advised to read only meta data</strong> """ getOptions().setResultSetAsyncListeners(Optional.of(asList(resultSetAsyncListener))); return getThis(); }
java
public T withResultSetAsyncListener(Function<ResultSet, ResultSet> resultSetAsyncListener) { getOptions().setResultSetAsyncListeners(Optional.of(asList(resultSetAsyncListener))); return getThis(); }
[ "public", "T", "withResultSetAsyncListener", "(", "Function", "<", "ResultSet", ",", "ResultSet", ">", "resultSetAsyncListener", ")", "{", "getOptions", "(", ")", ".", "setResultSetAsyncListeners", "(", "Optional", ".", "of", "(", "asList", "(", "resultSetAsyncListener", ")", ")", ")", ";", "return", "getThis", "(", ")", ";", "}" ]
Add the given async listener on the {@link com.datastax.driver.core.ResultSet} object. Example of usage: <pre class="code"><code class="java"> .withResultSetAsyncListener(resultSet -> { //Do something with the resultSet object here }) </code></pre> Remark: <strong>it is not allowed to consume the ResultSet values. It is strongly advised to read only meta data</strong>
[ "Add", "the", "given", "async", "listener", "on", "the", "{", "@link", "com", ".", "datastax", ".", "driver", ".", "core", ".", "ResultSet", "}", "object", ".", "Example", "of", "usage", ":", "<pre", "class", "=", "code", ">", "<code", "class", "=", "java", ">" ]
train
https://github.com/doanduyhai/Achilles/blob/8281c33100e72c993e570592ae1a5306afac6813/achilles-core/src/main/java/info/archinnov/achilles/internals/dsl/options/AbstractOptionsForSelect.java#L200-L203
lightblueseas/swing-components
src/main/java/de/alpharogroup/generic/mvc/controller/AbstractGenericController.java
AbstractGenericController.setChild
@Override public Object setChild(final String key, final Controller<M, V> controller) { """ (non-Javadoc). @param key the key @param controller the controller @return the object """ if (null != controller.getParent()) { // controller.getParent().re } return children.put(key, controller); }
java
@Override public Object setChild(final String key, final Controller<M, V> controller) { if (null != controller.getParent()) { // controller.getParent().re } return children.put(key, controller); }
[ "@", "Override", "public", "Object", "setChild", "(", "final", "String", "key", ",", "final", "Controller", "<", "M", ",", "V", ">", "controller", ")", "{", "if", "(", "null", "!=", "controller", ".", "getParent", "(", ")", ")", "{", "// controller.getParent().re", "}", "return", "children", ".", "put", "(", "key", ",", "controller", ")", ";", "}" ]
(non-Javadoc). @param key the key @param controller the controller @return the object
[ "(", "non", "-", "Javadoc", ")", "." ]
train
https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/generic/mvc/controller/AbstractGenericController.java#L241-L249
datastax/java-driver
query-builder/src/main/java/com/datastax/oss/driver/api/querybuilder/SchemaBuilder.java
SchemaBuilder.dropTable
@NonNull public static Drop dropTable(@Nullable CqlIdentifier keyspace, @NonNull CqlIdentifier tableName) { """ Starts a DROP TABLE query for the given table name for the given keyspace name. """ return new DefaultDrop(keyspace, tableName, "TABLE"); }
java
@NonNull public static Drop dropTable(@Nullable CqlIdentifier keyspace, @NonNull CqlIdentifier tableName) { return new DefaultDrop(keyspace, tableName, "TABLE"); }
[ "@", "NonNull", "public", "static", "Drop", "dropTable", "(", "@", "Nullable", "CqlIdentifier", "keyspace", ",", "@", "NonNull", "CqlIdentifier", "tableName", ")", "{", "return", "new", "DefaultDrop", "(", "keyspace", ",", "tableName", ",", "\"TABLE\"", ")", ";", "}" ]
Starts a DROP TABLE query for the given table name for the given keyspace name.
[ "Starts", "a", "DROP", "TABLE", "query", "for", "the", "given", "table", "name", "for", "the", "given", "keyspace", "name", "." ]
train
https://github.com/datastax/java-driver/blob/612a63f2525618e2020e86c9ad75ab37adba6132/query-builder/src/main/java/com/datastax/oss/driver/api/querybuilder/SchemaBuilder.java#L192-L195
wcm-io/wcm-io-handler
url/src/main/java/io/wcm/handler/url/suffix/SuffixParser.java
SuffixParser.getResources
@SuppressWarnings("null") public @NotNull List<Resource> getResources(@Nullable Predicate<Resource> filter, @Nullable Resource baseResource) { """ Get the resources selected in the suffix of the URL @param filter optional filter to select only specific resources @param baseResource the suffix path is relative to this resource path (null for current page's jcr:content node) @return a list containing the Resources """ // resolve base path or fallback to current page's content if not specified Resource baseResourceToUse = baseResource; if (baseResourceToUse == null) { PageManager pageManager = request.getResourceResolver().adaptTo(PageManager.class); Page currentPage = pageManager.getContainingPage(request.getResource()); if (currentPage != null) { baseResourceToUse = currentPage.getContentResource(); } else { baseResourceToUse = request.getResource(); } } return getResourcesWithBaseResource(filter, baseResourceToUse); }
java
@SuppressWarnings("null") public @NotNull List<Resource> getResources(@Nullable Predicate<Resource> filter, @Nullable Resource baseResource) { // resolve base path or fallback to current page's content if not specified Resource baseResourceToUse = baseResource; if (baseResourceToUse == null) { PageManager pageManager = request.getResourceResolver().adaptTo(PageManager.class); Page currentPage = pageManager.getContainingPage(request.getResource()); if (currentPage != null) { baseResourceToUse = currentPage.getContentResource(); } else { baseResourceToUse = request.getResource(); } } return getResourcesWithBaseResource(filter, baseResourceToUse); }
[ "@", "SuppressWarnings", "(", "\"null\"", ")", "public", "@", "NotNull", "List", "<", "Resource", ">", "getResources", "(", "@", "Nullable", "Predicate", "<", "Resource", ">", "filter", ",", "@", "Nullable", "Resource", "baseResource", ")", "{", "// resolve base path or fallback to current page's content if not specified", "Resource", "baseResourceToUse", "=", "baseResource", ";", "if", "(", "baseResourceToUse", "==", "null", ")", "{", "PageManager", "pageManager", "=", "request", ".", "getResourceResolver", "(", ")", ".", "adaptTo", "(", "PageManager", ".", "class", ")", ";", "Page", "currentPage", "=", "pageManager", ".", "getContainingPage", "(", "request", ".", "getResource", "(", ")", ")", ";", "if", "(", "currentPage", "!=", "null", ")", "{", "baseResourceToUse", "=", "currentPage", ".", "getContentResource", "(", ")", ";", "}", "else", "{", "baseResourceToUse", "=", "request", ".", "getResource", "(", ")", ";", "}", "}", "return", "getResourcesWithBaseResource", "(", "filter", ",", "baseResourceToUse", ")", ";", "}" ]
Get the resources selected in the suffix of the URL @param filter optional filter to select only specific resources @param baseResource the suffix path is relative to this resource path (null for current page's jcr:content node) @return a list containing the Resources
[ "Get", "the", "resources", "selected", "in", "the", "suffix", "of", "the", "URL" ]
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/url/src/main/java/io/wcm/handler/url/suffix/SuffixParser.java#L260-L276
leadware/jpersistence-tools
jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/impl/JPAGenericDAORulesBasedImpl.java
JPAGenericDAORulesBasedImpl.addProperties
protected void addProperties(Root<T> root, Set<String> properties) { """ Methode d'ajout des Proprietes a charger a la requete de recherche @param root Entités objet du from @param properties Conteneur de propriétés """ // Si le conteneur est vide if(properties == null || properties.size() == 0) return; // Parcours du conteneur for (String property : properties) { // Si la ppt est nulle ou vide if(property == null || property.trim().length() == 0) continue; // On split String[] hierarchicalPaths = property.split("\\."); // Le fetch de depart FetchParent<?, ?> fetch = root; // Parcours de la liste for (String path : hierarchicalPaths) { // Si la propriete est vide if(path == null || path.trim().isEmpty()) continue; // chargement de cette hierarchie fetch = fetch.fetch(path.trim(), JoinType.LEFT); } } }
java
protected void addProperties(Root<T> root, Set<String> properties) { // Si le conteneur est vide if(properties == null || properties.size() == 0) return; // Parcours du conteneur for (String property : properties) { // Si la ppt est nulle ou vide if(property == null || property.trim().length() == 0) continue; // On split String[] hierarchicalPaths = property.split("\\."); // Le fetch de depart FetchParent<?, ?> fetch = root; // Parcours de la liste for (String path : hierarchicalPaths) { // Si la propriete est vide if(path == null || path.trim().isEmpty()) continue; // chargement de cette hierarchie fetch = fetch.fetch(path.trim(), JoinType.LEFT); } } }
[ "protected", "void", "addProperties", "(", "Root", "<", "T", ">", "root", ",", "Set", "<", "String", ">", "properties", ")", "{", "// Si le conteneur est vide\r", "if", "(", "properties", "==", "null", "||", "properties", ".", "size", "(", ")", "==", "0", ")", "return", ";", "// Parcours du conteneur\r", "for", "(", "String", "property", ":", "properties", ")", "{", "// Si la ppt est nulle ou vide\r", "if", "(", "property", "==", "null", "||", "property", ".", "trim", "(", ")", ".", "length", "(", ")", "==", "0", ")", "continue", ";", "// On split\r", "String", "[", "]", "hierarchicalPaths", "=", "property", ".", "split", "(", "\"\\\\.\"", ")", ";", "// Le fetch de depart\r", "FetchParent", "<", "?", ",", "?", ">", "fetch", "=", "root", ";", "// Parcours de la liste\r", "for", "(", "String", "path", ":", "hierarchicalPaths", ")", "{", "// Si la propriete est vide\r", "if", "(", "path", "==", "null", "||", "path", ".", "trim", "(", ")", ".", "isEmpty", "(", ")", ")", "continue", ";", "// chargement de cette hierarchie\r", "fetch", "=", "fetch", ".", "fetch", "(", "path", ".", "trim", "(", ")", ",", "JoinType", ".", "LEFT", ")", ";", "}", "}", "}" ]
Methode d'ajout des Proprietes a charger a la requete de recherche @param root Entités objet du from @param properties Conteneur de propriétés
[ "Methode", "d", "ajout", "des", "Proprietes", "a", "charger", "a", "la", "requete", "de", "recherche" ]
train
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/impl/JPAGenericDAORulesBasedImpl.java#L741-L768
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/provisioning/BundleRepositoryRegistry.java
BundleRepositoryRegistry.initializeDefaults
public static synchronized void initializeDefaults(String serverName, boolean useMsgs) { """ Add the default repositories for the product @param serverName If set to a serverName, a cache will be created in that server's workarea. A null value disables caching. @param useMsgs This setting is passed on to the held ContentLocalBundleRepositories. """ allUseMsgs = useMsgs; cacheServerName = serverName; addBundleRepository(Utils.getInstallDir().getAbsolutePath(), ExtensionConstants.CORE_EXTENSION); addBundleRepository(new File(Utils.getUserDir(), "/extension/").getAbsolutePath(), ExtensionConstants.USER_EXTENSION); }
java
public static synchronized void initializeDefaults(String serverName, boolean useMsgs) { allUseMsgs = useMsgs; cacheServerName = serverName; addBundleRepository(Utils.getInstallDir().getAbsolutePath(), ExtensionConstants.CORE_EXTENSION); addBundleRepository(new File(Utils.getUserDir(), "/extension/").getAbsolutePath(), ExtensionConstants.USER_EXTENSION); }
[ "public", "static", "synchronized", "void", "initializeDefaults", "(", "String", "serverName", ",", "boolean", "useMsgs", ")", "{", "allUseMsgs", "=", "useMsgs", ";", "cacheServerName", "=", "serverName", ";", "addBundleRepository", "(", "Utils", ".", "getInstallDir", "(", ")", ".", "getAbsolutePath", "(", ")", ",", "ExtensionConstants", ".", "CORE_EXTENSION", ")", ";", "addBundleRepository", "(", "new", "File", "(", "Utils", ".", "getUserDir", "(", ")", ",", "\"/extension/\"", ")", ".", "getAbsolutePath", "(", ")", ",", "ExtensionConstants", ".", "USER_EXTENSION", ")", ";", "}" ]
Add the default repositories for the product @param serverName If set to a serverName, a cache will be created in that server's workarea. A null value disables caching. @param useMsgs This setting is passed on to the held ContentLocalBundleRepositories.
[ "Add", "the", "default", "repositories", "for", "the", "product" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/provisioning/BundleRepositoryRegistry.java#L42-L47
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/cache/impl/MXBeanUtil.java
MXBeanUtil.unregisterCacheObject
public static void unregisterCacheObject(String cacheManagerName, String name, boolean stats) { """ UnRegisters the mxbean if registered already. @param cacheManagerName name generated by URI and classloader. @param name cache name. @param stats is mxbean, a statistics mxbean. """ synchronized (mBeanServer) { ObjectName objectName = calculateObjectName(cacheManagerName, name, stats); Set<ObjectName> registeredObjectNames = mBeanServer.queryNames(objectName, null); if (isRegistered(cacheManagerName, name, stats)) { //should just be one for (ObjectName registeredObjectName : registeredObjectNames) { try { mBeanServer.unregisterMBean(registeredObjectName); } catch (InstanceNotFoundException e) { // it can happen that the instance that we want to unregister isn't found. So lets ignore it // https://github.com/hazelcast/hazelcast/issues/11055 ignore(e); } catch (Exception e) { throw new CacheException("Error unregistering object instance " + registeredObjectName + ". Error was " + e.getMessage(), e); } } } } }
java
public static void unregisterCacheObject(String cacheManagerName, String name, boolean stats) { synchronized (mBeanServer) { ObjectName objectName = calculateObjectName(cacheManagerName, name, stats); Set<ObjectName> registeredObjectNames = mBeanServer.queryNames(objectName, null); if (isRegistered(cacheManagerName, name, stats)) { //should just be one for (ObjectName registeredObjectName : registeredObjectNames) { try { mBeanServer.unregisterMBean(registeredObjectName); } catch (InstanceNotFoundException e) { // it can happen that the instance that we want to unregister isn't found. So lets ignore it // https://github.com/hazelcast/hazelcast/issues/11055 ignore(e); } catch (Exception e) { throw new CacheException("Error unregistering object instance " + registeredObjectName + ". Error was " + e.getMessage(), e); } } } } }
[ "public", "static", "void", "unregisterCacheObject", "(", "String", "cacheManagerName", ",", "String", "name", ",", "boolean", "stats", ")", "{", "synchronized", "(", "mBeanServer", ")", "{", "ObjectName", "objectName", "=", "calculateObjectName", "(", "cacheManagerName", ",", "name", ",", "stats", ")", ";", "Set", "<", "ObjectName", ">", "registeredObjectNames", "=", "mBeanServer", ".", "queryNames", "(", "objectName", ",", "null", ")", ";", "if", "(", "isRegistered", "(", "cacheManagerName", ",", "name", ",", "stats", ")", ")", "{", "//should just be one", "for", "(", "ObjectName", "registeredObjectName", ":", "registeredObjectNames", ")", "{", "try", "{", "mBeanServer", ".", "unregisterMBean", "(", "registeredObjectName", ")", ";", "}", "catch", "(", "InstanceNotFoundException", "e", ")", "{", "// it can happen that the instance that we want to unregister isn't found. So lets ignore it", "// https://github.com/hazelcast/hazelcast/issues/11055", "ignore", "(", "e", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "CacheException", "(", "\"Error unregistering object instance \"", "+", "registeredObjectName", "+", "\". Error was \"", "+", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "}", "}", "}", "}" ]
UnRegisters the mxbean if registered already. @param cacheManagerName name generated by URI and classloader. @param name cache name. @param stats is mxbean, a statistics mxbean.
[ "UnRegisters", "the", "mxbean", "if", "registered", "already", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cache/impl/MXBeanUtil.java#L79-L99
ziccardi/jnrpe
jnrpe-plugins/src/main/java/it/jnrpe/plugin/utils/Shell.java
Shell.executeSystemCommandAndGetOutput
public final String executeSystemCommandAndGetOutput(final String[] command, final String encoding) throws IOException { """ Executes a system command with arguments and returns the output. @param command command to be executed @param encoding encoding to be used @return command output @throws IOException on any error """ Process p = Runtime.getRuntime().exec(command); StreamManager sm = new StreamManager(); try { InputStream input = sm.handle(p.getInputStream()); StringBuffer lines = new StringBuffer(); String line; BufferedReader in = (BufferedReader) sm.handle(new BufferedReader(new InputStreamReader(input, encoding))); while ((line = in.readLine()) != null) { lines.append(line).append('\n'); } return lines.toString(); } finally { sm.closeAll(); } }
java
public final String executeSystemCommandAndGetOutput(final String[] command, final String encoding) throws IOException { Process p = Runtime.getRuntime().exec(command); StreamManager sm = new StreamManager(); try { InputStream input = sm.handle(p.getInputStream()); StringBuffer lines = new StringBuffer(); String line; BufferedReader in = (BufferedReader) sm.handle(new BufferedReader(new InputStreamReader(input, encoding))); while ((line = in.readLine()) != null) { lines.append(line).append('\n'); } return lines.toString(); } finally { sm.closeAll(); } }
[ "public", "final", "String", "executeSystemCommandAndGetOutput", "(", "final", "String", "[", "]", "command", ",", "final", "String", "encoding", ")", "throws", "IOException", "{", "Process", "p", "=", "Runtime", ".", "getRuntime", "(", ")", ".", "exec", "(", "command", ")", ";", "StreamManager", "sm", "=", "new", "StreamManager", "(", ")", ";", "try", "{", "InputStream", "input", "=", "sm", ".", "handle", "(", "p", ".", "getInputStream", "(", ")", ")", ";", "StringBuffer", "lines", "=", "new", "StringBuffer", "(", ")", ";", "String", "line", ";", "BufferedReader", "in", "=", "(", "BufferedReader", ")", "sm", ".", "handle", "(", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "input", ",", "encoding", ")", ")", ")", ";", "while", "(", "(", "line", "=", "in", ".", "readLine", "(", ")", ")", "!=", "null", ")", "{", "lines", ".", "append", "(", "line", ")", ".", "append", "(", "'", "'", ")", ";", "}", "return", "lines", ".", "toString", "(", ")", ";", "}", "finally", "{", "sm", ".", "closeAll", "(", ")", ";", "}", "}" ]
Executes a system command with arguments and returns the output. @param command command to be executed @param encoding encoding to be used @return command output @throws IOException on any error
[ "Executes", "a", "system", "command", "with", "arguments", "and", "returns", "the", "output", "." ]
train
https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-plugins/src/main/java/it/jnrpe/plugin/utils/Shell.java#L55-L72
orhanobut/dialogplus
dialogplus/src/main/java/com/orhanobut/dialogplus/DialogPlusBuilder.java
DialogPlusBuilder.setOutMostMargin
public DialogPlusBuilder setOutMostMargin(int left, int top, int right, int bottom) { """ Add margins to your outmost view which contains everything. As default they are 0 are applied """ this.outMostMargin[0] = left; this.outMostMargin[1] = top; this.outMostMargin[2] = right; this.outMostMargin[3] = bottom; return this; }
java
public DialogPlusBuilder setOutMostMargin(int left, int top, int right, int bottom) { this.outMostMargin[0] = left; this.outMostMargin[1] = top; this.outMostMargin[2] = right; this.outMostMargin[3] = bottom; return this; }
[ "public", "DialogPlusBuilder", "setOutMostMargin", "(", "int", "left", ",", "int", "top", ",", "int", "right", ",", "int", "bottom", ")", "{", "this", ".", "outMostMargin", "[", "0", "]", "=", "left", ";", "this", ".", "outMostMargin", "[", "1", "]", "=", "top", ";", "this", ".", "outMostMargin", "[", "2", "]", "=", "right", ";", "this", ".", "outMostMargin", "[", "3", "]", "=", "bottom", ";", "return", "this", ";", "}" ]
Add margins to your outmost view which contains everything. As default they are 0 are applied
[ "Add", "margins", "to", "your", "outmost", "view", "which", "contains", "everything", ".", "As", "default", "they", "are", "0", "are", "applied" ]
train
https://github.com/orhanobut/dialogplus/blob/291bf4daaa3c81bf5537125f547913beb8ee2c17/dialogplus/src/main/java/com/orhanobut/dialogplus/DialogPlusBuilder.java#L208-L214
JOML-CI/JOML
src/org/joml/Matrix4x3f.java
Matrix4x3f.setTranslation
public Matrix4x3f setTranslation(float x, float y, float z) { """ Set only the translation components <code>(m30, m31, m32)</code> of this matrix to the given values <code>(x, y, z)</code>. <p> To build a translation matrix instead, use {@link #translation(float, float, float)}. To apply a translation, use {@link #translate(float, float, float)}. @see #translation(float, float, float) @see #translate(float, float, float) @param x the offset to translate in x @param y the offset to translate in y @param z the offset to translate in z @return this """ m30 = x; m31 = y; m32 = z; properties &= ~(PROPERTY_IDENTITY); return this; }
java
public Matrix4x3f setTranslation(float x, float y, float z) { m30 = x; m31 = y; m32 = z; properties &= ~(PROPERTY_IDENTITY); return this; }
[ "public", "Matrix4x3f", "setTranslation", "(", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "m30", "=", "x", ";", "m31", "=", "y", ";", "m32", "=", "z", ";", "properties", "&=", "~", "(", "PROPERTY_IDENTITY", ")", ";", "return", "this", ";", "}" ]
Set only the translation components <code>(m30, m31, m32)</code> of this matrix to the given values <code>(x, y, z)</code>. <p> To build a translation matrix instead, use {@link #translation(float, float, float)}. To apply a translation, use {@link #translate(float, float, float)}. @see #translation(float, float, float) @see #translate(float, float, float) @param x the offset to translate in x @param y the offset to translate in y @param z the offset to translate in z @return this
[ "Set", "only", "the", "translation", "components", "<code", ">", "(", "m30", "m31", "m32", ")", "<", "/", "code", ">", "of", "this", "matrix", "to", "the", "given", "values", "<code", ">", "(", "x", "y", "z", ")", "<", "/", "code", ">", ".", "<p", ">", "To", "build", "a", "translation", "matrix", "instead", "use", "{", "@link", "#translation", "(", "float", "float", "float", ")", "}", ".", "To", "apply", "a", "translation", "use", "{", "@link", "#translate", "(", "float", "float", "float", ")", "}", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L1610-L1616
VoltDB/voltdb
src/frontend/org/voltdb/utils/CatalogSchemaTools.java
CatalogSchemaTools.toSchema
public static void toSchema(StringBuilder sb, Group grp) { """ Convert a Group (Role) into a DDL string. sb The ddl @param grp The group """ // Don't output the default roles because user cannot change them. if (grp.getTypeName().equalsIgnoreCase("ADMINISTRATOR") || grp.getTypeName().equalsIgnoreCase("USER")) { return; } final EnumSet<Permission> permissions = Permission.getPermissionSetForGroup(grp); sb.append("CREATE ROLE ").append(grp.getTypeName()); String delimiter = " WITH "; for (Permission permission : permissions) { sb.append(delimiter).append(permission.name()); delimiter = ", "; } sb.append(";\n"); }
java
public static void toSchema(StringBuilder sb, Group grp) { // Don't output the default roles because user cannot change them. if (grp.getTypeName().equalsIgnoreCase("ADMINISTRATOR") || grp.getTypeName().equalsIgnoreCase("USER")) { return; } final EnumSet<Permission> permissions = Permission.getPermissionSetForGroup(grp); sb.append("CREATE ROLE ").append(grp.getTypeName()); String delimiter = " WITH "; for (Permission permission : permissions) { sb.append(delimiter).append(permission.name()); delimiter = ", "; } sb.append(";\n"); }
[ "public", "static", "void", "toSchema", "(", "StringBuilder", "sb", ",", "Group", "grp", ")", "{", "// Don't output the default roles because user cannot change them.", "if", "(", "grp", ".", "getTypeName", "(", ")", ".", "equalsIgnoreCase", "(", "\"ADMINISTRATOR\"", ")", "||", "grp", ".", "getTypeName", "(", ")", ".", "equalsIgnoreCase", "(", "\"USER\"", ")", ")", "{", "return", ";", "}", "final", "EnumSet", "<", "Permission", ">", "permissions", "=", "Permission", ".", "getPermissionSetForGroup", "(", "grp", ")", ";", "sb", ".", "append", "(", "\"CREATE ROLE \"", ")", ".", "append", "(", "grp", ".", "getTypeName", "(", ")", ")", ";", "String", "delimiter", "=", "\" WITH \"", ";", "for", "(", "Permission", "permission", ":", "permissions", ")", "{", "sb", ".", "append", "(", "delimiter", ")", ".", "append", "(", "permission", ".", "name", "(", ")", ")", ";", "delimiter", "=", "\", \"", ";", "}", "sb", ".", "append", "(", "\";\\n\"", ")", ";", "}" ]
Convert a Group (Role) into a DDL string. sb The ddl @param grp The group
[ "Convert", "a", "Group", "(", "Role", ")", "into", "a", "DDL", "string", ".", "sb", "The", "ddl" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/utils/CatalogSchemaTools.java#L425-L441
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java
FilesImpl.listFromComputeNodeAsync
public Observable<Page<NodeFile>> listFromComputeNodeAsync(final String poolId, final String nodeId, final Boolean recursive, final FileListFromComputeNodeOptions fileListFromComputeNodeOptions) { """ Lists all of the files in task directories on the specified compute node. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node whose files you want to list. @param recursive Whether to list children of a directory. @param fileListFromComputeNodeOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;NodeFile&gt; object """ return listFromComputeNodeWithServiceResponseAsync(poolId, nodeId, recursive, fileListFromComputeNodeOptions) .map(new Func1<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>, Page<NodeFile>>() { @Override public Page<NodeFile> call(ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders> response) { return response.body(); } }); }
java
public Observable<Page<NodeFile>> listFromComputeNodeAsync(final String poolId, final String nodeId, final Boolean recursive, final FileListFromComputeNodeOptions fileListFromComputeNodeOptions) { return listFromComputeNodeWithServiceResponseAsync(poolId, nodeId, recursive, fileListFromComputeNodeOptions) .map(new Func1<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>, Page<NodeFile>>() { @Override public Page<NodeFile> call(ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "NodeFile", ">", ">", "listFromComputeNodeAsync", "(", "final", "String", "poolId", ",", "final", "String", "nodeId", ",", "final", "Boolean", "recursive", ",", "final", "FileListFromComputeNodeOptions", "fileListFromComputeNodeOptions", ")", "{", "return", "listFromComputeNodeWithServiceResponseAsync", "(", "poolId", ",", "nodeId", ",", "recursive", ",", "fileListFromComputeNodeOptions", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponseWithHeaders", "<", "Page", "<", "NodeFile", ">", ",", "FileListFromComputeNodeHeaders", ">", ",", "Page", "<", "NodeFile", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "NodeFile", ">", "call", "(", "ServiceResponseWithHeaders", "<", "Page", "<", "NodeFile", ">", ",", "FileListFromComputeNodeHeaders", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Lists all of the files in task directories on the specified compute node. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node whose files you want to list. @param recursive Whether to list children of a directory. @param fileListFromComputeNodeOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;NodeFile&gt; object
[ "Lists", "all", "of", "the", "files", "in", "task", "directories", "on", "the", "specified", "compute", "node", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java#L2106-L2114
wso2/transport-http
components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/sender/HttpClientChannelInitializer.java
HttpClientChannelInitializer.configureHttpPipeline
public void configureHttpPipeline(ChannelPipeline pipeline, TargetHandler targetHandler) { """ Creates pipeline for http requests. @param pipeline the client channel pipeline @param targetHandler the target handler """ pipeline.addLast(Constants.HTTP_CLIENT_CODEC, new HttpClientCodec()); addCommonHandlers(pipeline); pipeline.addLast(Constants.BACK_PRESSURE_HANDLER, new BackPressureHandler()); pipeline.addLast(Constants.TARGET_HANDLER, targetHandler); }
java
public void configureHttpPipeline(ChannelPipeline pipeline, TargetHandler targetHandler) { pipeline.addLast(Constants.HTTP_CLIENT_CODEC, new HttpClientCodec()); addCommonHandlers(pipeline); pipeline.addLast(Constants.BACK_PRESSURE_HANDLER, new BackPressureHandler()); pipeline.addLast(Constants.TARGET_HANDLER, targetHandler); }
[ "public", "void", "configureHttpPipeline", "(", "ChannelPipeline", "pipeline", ",", "TargetHandler", "targetHandler", ")", "{", "pipeline", ".", "addLast", "(", "Constants", ".", "HTTP_CLIENT_CODEC", ",", "new", "HttpClientCodec", "(", ")", ")", ";", "addCommonHandlers", "(", "pipeline", ")", ";", "pipeline", ".", "addLast", "(", "Constants", ".", "BACK_PRESSURE_HANDLER", ",", "new", "BackPressureHandler", "(", ")", ")", ";", "pipeline", ".", "addLast", "(", "Constants", ".", "TARGET_HANDLER", ",", "targetHandler", ")", ";", "}" ]
Creates pipeline for http requests. @param pipeline the client channel pipeline @param targetHandler the target handler
[ "Creates", "pipeline", "for", "http", "requests", "." ]
train
https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/sender/HttpClientChannelInitializer.java#L242-L247
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPoliciesInner.java
ServiceEndpointPoliciesInner.createOrUpdate
public ServiceEndpointPolicyInner createOrUpdate(String resourceGroupName, String serviceEndpointPolicyName, ServiceEndpointPolicyInner parameters) { """ Creates or updates a service Endpoint Policies. @param resourceGroupName The name of the resource group. @param serviceEndpointPolicyName The name of the service endpoint policy. @param parameters Parameters supplied to the create or update service endpoint policy operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ServiceEndpointPolicyInner object if successful. """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName, parameters).toBlocking().last().body(); }
java
public ServiceEndpointPolicyInner createOrUpdate(String resourceGroupName, String serviceEndpointPolicyName, ServiceEndpointPolicyInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName, parameters).toBlocking().last().body(); }
[ "public", "ServiceEndpointPolicyInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "serviceEndpointPolicyName", ",", "ServiceEndpointPolicyInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "serviceEndpointPolicyName", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
Creates or updates a service Endpoint Policies. @param resourceGroupName The name of the resource group. @param serviceEndpointPolicyName The name of the service endpoint policy. @param parameters Parameters supplied to the create or update service endpoint policy operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ServiceEndpointPolicyInner object if successful.
[ "Creates", "or", "updates", "a", "service", "Endpoint", "Policies", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPoliciesInner.java#L444-L446
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectPropertyAssertionAxiomImpl_CustomFieldSerializer.java
OWLObjectPropertyAssertionAxiomImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLObjectPropertyAssertionAxiomImpl instance) throws SerializationException { """ Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful """ serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLObjectPropertyAssertionAxiomImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLObjectPropertyAssertionAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ]
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamWriter", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectPropertyAssertionAxiomImpl_CustomFieldSerializer.java#L78-L81
Azure/azure-sdk-for-java
cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java
DatabaseAccountsInner.listReadOnlyKeysAsync
public Observable<DatabaseAccountListReadOnlyKeysResultInner> listReadOnlyKeysAsync(String resourceGroupName, String accountName) { """ Lists the read-only access keys for the specified Azure Cosmos DB database account. @param resourceGroupName Name of an Azure resource group. @param accountName Cosmos DB database account name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DatabaseAccountListReadOnlyKeysResultInner object """ return listReadOnlyKeysWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<DatabaseAccountListReadOnlyKeysResultInner>, DatabaseAccountListReadOnlyKeysResultInner>() { @Override public DatabaseAccountListReadOnlyKeysResultInner call(ServiceResponse<DatabaseAccountListReadOnlyKeysResultInner> response) { return response.body(); } }); }
java
public Observable<DatabaseAccountListReadOnlyKeysResultInner> listReadOnlyKeysAsync(String resourceGroupName, String accountName) { return listReadOnlyKeysWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<DatabaseAccountListReadOnlyKeysResultInner>, DatabaseAccountListReadOnlyKeysResultInner>() { @Override public DatabaseAccountListReadOnlyKeysResultInner call(ServiceResponse<DatabaseAccountListReadOnlyKeysResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DatabaseAccountListReadOnlyKeysResultInner", ">", "listReadOnlyKeysAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ")", "{", "return", "listReadOnlyKeysWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "DatabaseAccountListReadOnlyKeysResultInner", ">", ",", "DatabaseAccountListReadOnlyKeysResultInner", ">", "(", ")", "{", "@", "Override", "public", "DatabaseAccountListReadOnlyKeysResultInner", "call", "(", "ServiceResponse", "<", "DatabaseAccountListReadOnlyKeysResultInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Lists the read-only access keys for the specified Azure Cosmos DB database account. @param resourceGroupName Name of an Azure resource group. @param accountName Cosmos DB database account name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DatabaseAccountListReadOnlyKeysResultInner object
[ "Lists", "the", "read", "-", "only", "access", "keys", "for", "the", "specified", "Azure", "Cosmos", "DB", "database", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java#L1739-L1746
chr78rm/tracelogger
src/main/java/de/christofreichardt/diagnosis/AbstractTracer.java
AbstractTracer.initCurrentTracingContext
public void initCurrentTracingContext(int debugLevel, boolean online) { """ Initialises the current tracing context with the given debugLevel and online state. @param debugLevel controls the extent of the output @param online a value of false delivers no output of the current thread at all whereas a value of true delivers output controlled by debugLevel """ // todo: prevent manually creation of tracing contexts by configuration?! TracingContext tracingContext = this.threadMap.getCurrentTracingContext(); if (tracingContext == null) { System.out.println(formatContextInfo(debugLevel, online)); tracingContext = new TracingContext(debugLevel, online); this.threadMap.setCurrentTracingContext(tracingContext); } else { tracingContext.setDebugLevel(debugLevel); tracingContext.setOnline(online); } }
java
public void initCurrentTracingContext(int debugLevel, boolean online) { // todo: prevent manually creation of tracing contexts by configuration?! TracingContext tracingContext = this.threadMap.getCurrentTracingContext(); if (tracingContext == null) { System.out.println(formatContextInfo(debugLevel, online)); tracingContext = new TracingContext(debugLevel, online); this.threadMap.setCurrentTracingContext(tracingContext); } else { tracingContext.setDebugLevel(debugLevel); tracingContext.setOnline(online); } }
[ "public", "void", "initCurrentTracingContext", "(", "int", "debugLevel", ",", "boolean", "online", ")", "{", "// todo: prevent manually creation of tracing contexts by configuration?!\r", "TracingContext", "tracingContext", "=", "this", ".", "threadMap", ".", "getCurrentTracingContext", "(", ")", ";", "if", "(", "tracingContext", "==", "null", ")", "{", "System", ".", "out", ".", "println", "(", "formatContextInfo", "(", "debugLevel", ",", "online", ")", ")", ";", "tracingContext", "=", "new", "TracingContext", "(", "debugLevel", ",", "online", ")", ";", "this", ".", "threadMap", ".", "setCurrentTracingContext", "(", "tracingContext", ")", ";", "}", "else", "{", "tracingContext", ".", "setDebugLevel", "(", "debugLevel", ")", ";", "tracingContext", ".", "setOnline", "(", "online", ")", ";", "}", "}" ]
Initialises the current tracing context with the given debugLevel and online state. @param debugLevel controls the extent of the output @param online a value of false delivers no output of the current thread at all whereas a value of true delivers output controlled by debugLevel
[ "Initialises", "the", "current", "tracing", "context", "with", "the", "given", "debugLevel", "and", "online", "state", "." ]
train
https://github.com/chr78rm/tracelogger/blob/ad22452b20f8111ad4d367302c2b26a100a20200/src/main/java/de/christofreichardt/diagnosis/AbstractTracer.java#L571-L585
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-classloader/xwiki-commons-classloader-api/src/main/java/org/xwiki/classloader/URIClassLoader.java
URIClassLoader.isSealed
private boolean isSealed(String name, Manifest man) { """ returns true if the specified package name is sealed according to the given manifest. """ String path = name.replace('.', '/').concat("/"); Attributes attr = man.getAttributes(path); String sealed = null; if (attr != null) { sealed = attr.getValue(Name.SEALED); } if (sealed == null) { if ((attr = man.getMainAttributes()) != null) { sealed = attr.getValue(Name.SEALED); } } return "true".equalsIgnoreCase(sealed); }
java
private boolean isSealed(String name, Manifest man) { String path = name.replace('.', '/').concat("/"); Attributes attr = man.getAttributes(path); String sealed = null; if (attr != null) { sealed = attr.getValue(Name.SEALED); } if (sealed == null) { if ((attr = man.getMainAttributes()) != null) { sealed = attr.getValue(Name.SEALED); } } return "true".equalsIgnoreCase(sealed); }
[ "private", "boolean", "isSealed", "(", "String", "name", ",", "Manifest", "man", ")", "{", "String", "path", "=", "name", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ".", "concat", "(", "\"/\"", ")", ";", "Attributes", "attr", "=", "man", ".", "getAttributes", "(", "path", ")", ";", "String", "sealed", "=", "null", ";", "if", "(", "attr", "!=", "null", ")", "{", "sealed", "=", "attr", ".", "getValue", "(", "Name", ".", "SEALED", ")", ";", "}", "if", "(", "sealed", "==", "null", ")", "{", "if", "(", "(", "attr", "=", "man", ".", "getMainAttributes", "(", ")", ")", "!=", "null", ")", "{", "sealed", "=", "attr", ".", "getValue", "(", "Name", ".", "SEALED", ")", ";", "}", "}", "return", "\"true\"", ".", "equalsIgnoreCase", "(", "sealed", ")", ";", "}" ]
returns true if the specified package name is sealed according to the given manifest.
[ "returns", "true", "if", "the", "specified", "package", "name", "is", "sealed", "according", "to", "the", "given", "manifest", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-classloader/xwiki-commons-classloader-api/src/main/java/org/xwiki/classloader/URIClassLoader.java#L244-L258
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAnimation.java
GVRAnimation.setDuration
public GVRAnimation setDuration(float start, float end) { """ Sets the duration for the animation to be played. @param start the animation will start playing from the specified time @param end the animation will stop playing at the specified time @return {@code this}, so you can chain setProperty() calls. @throws IllegalArgumentException If {@code start} is either negative value, greater than {@code end} value or {@code end} is greater than duration """ if(start>end || start<0 || end>mDuration){ throw new IllegalArgumentException("start and end values are wrong"); } animationOffset = start; mDuration = end-start; return this; }
java
public GVRAnimation setDuration(float start, float end) { if(start>end || start<0 || end>mDuration){ throw new IllegalArgumentException("start and end values are wrong"); } animationOffset = start; mDuration = end-start; return this; }
[ "public", "GVRAnimation", "setDuration", "(", "float", "start", ",", "float", "end", ")", "{", "if", "(", "start", ">", "end", "||", "start", "<", "0", "||", "end", ">", "mDuration", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"start and end values are wrong\"", ")", ";", "}", "animationOffset", "=", "start", ";", "mDuration", "=", "end", "-", "start", ";", "return", "this", ";", "}" ]
Sets the duration for the animation to be played. @param start the animation will start playing from the specified time @param end the animation will stop playing at the specified time @return {@code this}, so you can chain setProperty() calls. @throws IllegalArgumentException If {@code start} is either negative value, greater than {@code end} value or {@code end} is greater than duration
[ "Sets", "the", "duration", "for", "the", "animation", "to", "be", "played", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAnimation.java#L301-L309
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/mail/MailUtil.java
MailUtil.send
public static void send(Collection<String> tos, String subject, String content, boolean isHtml, File... files) { """ 使用配置文件中设置的账户发送邮件,发送给多人 @param tos 收件人列表 @param subject 标题 @param content 正文 @param isHtml 是否为HTML @param files 附件列表 """ send(GlobalMailAccount.INSTANCE.getAccount(), tos, subject, content, isHtml, files); }
java
public static void send(Collection<String> tos, String subject, String content, boolean isHtml, File... files) { send(GlobalMailAccount.INSTANCE.getAccount(), tos, subject, content, isHtml, files); }
[ "public", "static", "void", "send", "(", "Collection", "<", "String", ">", "tos", ",", "String", "subject", ",", "String", "content", ",", "boolean", "isHtml", ",", "File", "...", "files", ")", "{", "send", "(", "GlobalMailAccount", ".", "INSTANCE", ".", "getAccount", "(", ")", ",", "tos", ",", "subject", ",", "content", ",", "isHtml", ",", "files", ")", ";", "}" ]
使用配置文件中设置的账户发送邮件,发送给多人 @param tos 收件人列表 @param subject 标题 @param content 正文 @param isHtml 是否为HTML @param files 附件列表
[ "使用配置文件中设置的账户发送邮件,发送给多人" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/mail/MailUtil.java#L111-L113
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java
XFactory.createXMethod
public static XMethod createXMethod(String className, Method method) { """ Create an XMethod object from a BCEL Method. @param className the class to which the Method belongs @param method the Method @return an XMethod representing the Method """ String methodName = method.getName(); String methodSig = method.getSignature(); int accessFlags = method.getAccessFlags(); return createXMethod(className, methodName, methodSig, accessFlags); }
java
public static XMethod createXMethod(String className, Method method) { String methodName = method.getName(); String methodSig = method.getSignature(); int accessFlags = method.getAccessFlags(); return createXMethod(className, methodName, methodSig, accessFlags); }
[ "public", "static", "XMethod", "createXMethod", "(", "String", "className", ",", "Method", "method", ")", "{", "String", "methodName", "=", "method", ".", "getName", "(", ")", ";", "String", "methodSig", "=", "method", ".", "getSignature", "(", ")", ";", "int", "accessFlags", "=", "method", ".", "getAccessFlags", "(", ")", ";", "return", "createXMethod", "(", "className", ",", "methodName", ",", "methodSig", ",", "accessFlags", ")", ";", "}" ]
Create an XMethod object from a BCEL Method. @param className the class to which the Method belongs @param method the Method @return an XMethod representing the Method
[ "Create", "an", "XMethod", "object", "from", "a", "BCEL", "Method", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java#L255-L261
hdecarne/java-default
src/main/java/de/carne/util/cmdline/CmdLineProcessor.java
CmdLineProcessor.onOption
public CmdLineAction onOption(BiConsumer<@NonNull String, @NonNull String> action) { """ Add a {@linkplain CmdLineAction} for option argument ({@code e.g. --option value}) processing. @param action The {@linkplain BiConsumer} to invoke with the argument and option string. @return The created {@linkplain CmdLineAction}. """ OptionCmdLineAction optionAction = new OptionCmdLineAction(action); this.optionActions.add(optionAction); return optionAction; }
java
public CmdLineAction onOption(BiConsumer<@NonNull String, @NonNull String> action) { OptionCmdLineAction optionAction = new OptionCmdLineAction(action); this.optionActions.add(optionAction); return optionAction; }
[ "public", "CmdLineAction", "onOption", "(", "BiConsumer", "<", "@", "NonNull", "String", ",", "@", "NonNull", "String", ">", "action", ")", "{", "OptionCmdLineAction", "optionAction", "=", "new", "OptionCmdLineAction", "(", "action", ")", ";", "this", ".", "optionActions", ".", "add", "(", "optionAction", ")", ";", "return", "optionAction", ";", "}" ]
Add a {@linkplain CmdLineAction} for option argument ({@code e.g. --option value}) processing. @param action The {@linkplain BiConsumer} to invoke with the argument and option string. @return The created {@linkplain CmdLineAction}.
[ "Add", "a", "{", "@linkplain", "CmdLineAction", "}", "for", "option", "argument", "(", "{", "@code", "e", ".", "g", ".", "--", "option", "value", "}", ")", "processing", "." ]
train
https://github.com/hdecarne/java-default/blob/ca16f6fdb0436e90e9e2df3106055e320bb3c9e3/src/main/java/de/carne/util/cmdline/CmdLineProcessor.java#L224-L229
mbenson/therian
core/src/main/java/therian/util/Positions.java
Positions.readOnly
public static <T> Position.Readable<T> readOnly(final Typed<T> typed, final T value) { """ Get a read-only position of type {@code typed.type} and value {@code value}. @param typed not {@code null} @param value @return Position.Readable """ return readOnly(typed, (Supplier<T>) () -> value); }
java
public static <T> Position.Readable<T> readOnly(final Typed<T> typed, final T value) { return readOnly(typed, (Supplier<T>) () -> value); }
[ "public", "static", "<", "T", ">", "Position", ".", "Readable", "<", "T", ">", "readOnly", "(", "final", "Typed", "<", "T", ">", "typed", ",", "final", "T", "value", ")", "{", "return", "readOnly", "(", "typed", ",", "(", "Supplier", "<", "T", ">", ")", "(", ")", "->", "value", ")", ";", "}" ]
Get a read-only position of type {@code typed.type} and value {@code value}. @param typed not {@code null} @param value @return Position.Readable
[ "Get", "a", "read", "-", "only", "position", "of", "type", "{", "@code", "typed", ".", "type", "}", "and", "value", "{", "@code", "value", "}", "." ]
train
https://github.com/mbenson/therian/blob/0653505f73e2a6f5b0abc394ea6d83af03408254/core/src/main/java/therian/util/Positions.java#L212-L214
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.pauseDomainStream
public PauseDomainStreamResponse pauseDomainStream(PauseDomainStreamRequest request) { """ pause domain's stream in the live stream service. @param request The request object containing all options for pause a domain's stream @return the response """ checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getDomain(), "Domain should NOT be empty."); checkStringNotEmpty(request.getApp(), "App should NOT be empty."); checkStringNotEmpty(request.getStream(), "Stream should NOT be empty."); InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, LIVE_DOMAIN, request.getDomain(), LIVE_APP, request.getApp(), LIVE_STREAM, request.getStream()); internalRequest.addParameter(PAUSE, null); return invokeHttpClient(internalRequest, PauseDomainStreamResponse.class); }
java
public PauseDomainStreamResponse pauseDomainStream(PauseDomainStreamRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getDomain(), "Domain should NOT be empty."); checkStringNotEmpty(request.getApp(), "App should NOT be empty."); checkStringNotEmpty(request.getStream(), "Stream should NOT be empty."); InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, LIVE_DOMAIN, request.getDomain(), LIVE_APP, request.getApp(), LIVE_STREAM, request.getStream()); internalRequest.addParameter(PAUSE, null); return invokeHttpClient(internalRequest, PauseDomainStreamResponse.class); }
[ "public", "PauseDomainStreamResponse", "pauseDomainStream", "(", "PauseDomainStreamRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getDomain", "(", ")", ",", "\"Domain should NOT be empty.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getApp", "(", ")", ",", "\"App should NOT be empty.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getStream", "(", ")", ",", "\"Stream should NOT be empty.\"", ")", ";", "InternalRequest", "internalRequest", "=", "createRequest", "(", "HttpMethodName", ".", "PUT", ",", "request", ",", "LIVE_DOMAIN", ",", "request", ".", "getDomain", "(", ")", ",", "LIVE_APP", ",", "request", ".", "getApp", "(", ")", ",", "LIVE_STREAM", ",", "request", ".", "getStream", "(", ")", ")", ";", "internalRequest", ".", "addParameter", "(", "PAUSE", ",", "null", ")", ";", "return", "invokeHttpClient", "(", "internalRequest", ",", "PauseDomainStreamResponse", ".", "class", ")", ";", "}" ]
pause domain's stream in the live stream service. @param request The request object containing all options for pause a domain's stream @return the response
[ "pause", "domain", "s", "stream", "in", "the", "live", "stream", "service", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1498-L1511
Crab2died/Excel4J
src/main/java/com/github/crab2died/ExcelUtils.java
ExcelUtils.exportObjects2Excel
public void exportObjects2Excel(List<?> data, List<String> header, String targetPath) throws IOException { """ 无模板、无注解的数据(形如{@code List[?]}、{@code List[List[?]]}、{@code List[Object[]]})导出 @param data 待导出数据 @param header 设置表头信息 @param targetPath 生成的Excel输出全路径 @throws IOException 异常 @author Crab2Died """ try (OutputStream fos = new FileOutputStream(targetPath); Workbook workbook = exportExcelBySimpleHandler(data, header, null, true)) { workbook.write(fos); } }
java
public void exportObjects2Excel(List<?> data, List<String> header, String targetPath) throws IOException { try (OutputStream fos = new FileOutputStream(targetPath); Workbook workbook = exportExcelBySimpleHandler(data, header, null, true)) { workbook.write(fos); } }
[ "public", "void", "exportObjects2Excel", "(", "List", "<", "?", ">", "data", ",", "List", "<", "String", ">", "header", ",", "String", "targetPath", ")", "throws", "IOException", "{", "try", "(", "OutputStream", "fos", "=", "new", "FileOutputStream", "(", "targetPath", ")", ";", "Workbook", "workbook", "=", "exportExcelBySimpleHandler", "(", "data", ",", "header", ",", "null", ",", "true", ")", ")", "{", "workbook", ".", "write", "(", "fos", ")", ";", "}", "}" ]
无模板、无注解的数据(形如{@code List[?]}、{@code List[List[?]]}、{@code List[Object[]]})导出 @param data 待导出数据 @param header 设置表头信息 @param targetPath 生成的Excel输出全路径 @throws IOException 异常 @author Crab2Died
[ "无模板、无注解的数据", "(", "形如", "{", "@code", "List", "[", "?", "]", "}", "、", "{", "@code", "List", "[", "List", "[", "?", "]]", "}", "、", "{", "@code", "List", "[", "Object", "[]", "]", "}", ")", "导出" ]
train
https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/ExcelUtils.java#L1305-L1312
Jasig/uPortal
uPortal-tools/src/main/java/org/apereo/portal/version/VersionUtils.java
VersionUtils.parseVersion
public static Version parseVersion(String versionString) { """ Parse a version string into a Version object, if the string doesn't match the pattern null is returned. <p>The regular expression used in parsing is: ^(\d+)\.(\d+)\.(\d+)(?:\.(\d+))?(?:[\.-].*)?$ <p>Examples that match correctly: <ul> <li>4.0.5 <li>4.0.5.123123 <li>4.0.5-SNAPSHOT <ul> Examples do NOT match correctly: <ul> <li>4.0 <li>4.0.5_123123 <ul> """ final Matcher versionMatcher = VERSION_PATTERN.matcher(versionString); if (!versionMatcher.matches()) { return null; } final int major = Integer.parseInt(versionMatcher.group(1)); final int minor = Integer.parseInt(versionMatcher.group(2)); final int patch = Integer.parseInt(versionMatcher.group(3)); final String local = versionMatcher.group(4); if (local != null) { return new SimpleVersion(major, minor, patch, Integer.valueOf(local)); } return new SimpleVersion(major, minor, patch); }
java
public static Version parseVersion(String versionString) { final Matcher versionMatcher = VERSION_PATTERN.matcher(versionString); if (!versionMatcher.matches()) { return null; } final int major = Integer.parseInt(versionMatcher.group(1)); final int minor = Integer.parseInt(versionMatcher.group(2)); final int patch = Integer.parseInt(versionMatcher.group(3)); final String local = versionMatcher.group(4); if (local != null) { return new SimpleVersion(major, minor, patch, Integer.valueOf(local)); } return new SimpleVersion(major, minor, patch); }
[ "public", "static", "Version", "parseVersion", "(", "String", "versionString", ")", "{", "final", "Matcher", "versionMatcher", "=", "VERSION_PATTERN", ".", "matcher", "(", "versionString", ")", ";", "if", "(", "!", "versionMatcher", ".", "matches", "(", ")", ")", "{", "return", "null", ";", "}", "final", "int", "major", "=", "Integer", ".", "parseInt", "(", "versionMatcher", ".", "group", "(", "1", ")", ")", ";", "final", "int", "minor", "=", "Integer", ".", "parseInt", "(", "versionMatcher", ".", "group", "(", "2", ")", ")", ";", "final", "int", "patch", "=", "Integer", ".", "parseInt", "(", "versionMatcher", ".", "group", "(", "3", ")", ")", ";", "final", "String", "local", "=", "versionMatcher", ".", "group", "(", "4", ")", ";", "if", "(", "local", "!=", "null", ")", "{", "return", "new", "SimpleVersion", "(", "major", ",", "minor", ",", "patch", ",", "Integer", ".", "valueOf", "(", "local", ")", ")", ";", "}", "return", "new", "SimpleVersion", "(", "major", ",", "minor", ",", "patch", ")", ";", "}" ]
Parse a version string into a Version object, if the string doesn't match the pattern null is returned. <p>The regular expression used in parsing is: ^(\d+)\.(\d+)\.(\d+)(?:\.(\d+))?(?:[\.-].*)?$ <p>Examples that match correctly: <ul> <li>4.0.5 <li>4.0.5.123123 <li>4.0.5-SNAPSHOT <ul> Examples do NOT match correctly: <ul> <li>4.0 <li>4.0.5_123123 <ul>
[ "Parse", "a", "version", "string", "into", "a", "Version", "object", "if", "the", "string", "doesn", "t", "match", "the", "pattern", "null", "is", "returned", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-tools/src/main/java/org/apereo/portal/version/VersionUtils.java#L46-L61
LearnLib/automatalib
util/src/main/java/net/automatalib/util/automata/copy/AutomatonLowLevelCopy.java
AutomatonLowLevelCopy.rawCopy
public static <S1, I, T1, S2, T2, SP2, TP2> Mapping<S1, S2> rawCopy(AutomatonCopyMethod method, Automaton<S1, ? super I, T1> in, Collection<? extends I> inputs, MutableAutomaton<S2, I, T2, SP2, TP2> out, Function<? super S1, ? extends SP2> spMapping, Function<? super T1, ? extends TP2> tpMapping) { """ Copies an {@link Automaton} to a {@link MutableAutomaton} with a compatible input alphabet, but possibly heterogeneous state and transition properties. States and transitions will not be filtered. @param <S1> input automaton state type @param <I> input symbol type @param <T1> input automaton transition type @param <S2> output automaton state type @param <T2> output automaton transition type @param <SP2> output automaton state property type @param <TP2> output automaton transition property type @param method the copy method to use @param in the input automaton @param inputs the inputs to consider @param out the output automaton @param spMapping the function for obtaining state properties @param tpMapping the function for obtaining transition properties @return a mapping from old to new states """ return rawCopy(method, in, inputs, out, spMapping, tpMapping, s -> true, (s, i, t) -> true); }
java
public static <S1, I, T1, S2, T2, SP2, TP2> Mapping<S1, S2> rawCopy(AutomatonCopyMethod method, Automaton<S1, ? super I, T1> in, Collection<? extends I> inputs, MutableAutomaton<S2, I, T2, SP2, TP2> out, Function<? super S1, ? extends SP2> spMapping, Function<? super T1, ? extends TP2> tpMapping) { return rawCopy(method, in, inputs, out, spMapping, tpMapping, s -> true, (s, i, t) -> true); }
[ "public", "static", "<", "S1", ",", "I", ",", "T1", ",", "S2", ",", "T2", ",", "SP2", ",", "TP2", ">", "Mapping", "<", "S1", ",", "S2", ">", "rawCopy", "(", "AutomatonCopyMethod", "method", ",", "Automaton", "<", "S1", ",", "?", "super", "I", ",", "T1", ">", "in", ",", "Collection", "<", "?", "extends", "I", ">", "inputs", ",", "MutableAutomaton", "<", "S2", ",", "I", ",", "T2", ",", "SP2", ",", "TP2", ">", "out", ",", "Function", "<", "?", "super", "S1", ",", "?", "extends", "SP2", ">", "spMapping", ",", "Function", "<", "?", "super", "T1", ",", "?", "extends", "TP2", ">", "tpMapping", ")", "{", "return", "rawCopy", "(", "method", ",", "in", ",", "inputs", ",", "out", ",", "spMapping", ",", "tpMapping", ",", "s", "->", "true", ",", "(", "s", ",", "i", ",", "t", ")", "->", "true", ")", ";", "}" ]
Copies an {@link Automaton} to a {@link MutableAutomaton} with a compatible input alphabet, but possibly heterogeneous state and transition properties. States and transitions will not be filtered. @param <S1> input automaton state type @param <I> input symbol type @param <T1> input automaton transition type @param <S2> output automaton state type @param <T2> output automaton transition type @param <SP2> output automaton state property type @param <TP2> output automaton transition property type @param method the copy method to use @param in the input automaton @param inputs the inputs to consider @param out the output automaton @param spMapping the function for obtaining state properties @param tpMapping the function for obtaining transition properties @return a mapping from old to new states
[ "Copies", "an", "{", "@link", "Automaton", "}", "to", "a", "{", "@link", "MutableAutomaton", "}", "with", "a", "compatible", "input", "alphabet", "but", "possibly", "heterogeneous", "state", "and", "transition", "properties", ".", "States", "and", "transitions", "will", "not", "be", "filtered", "." ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/automata/copy/AutomatonLowLevelCopy.java#L185-L192
apache/incubator-gobblin
gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/MetricContext.java
MetricContext.contextAwareMeter
public ContextAwareMeter contextAwareMeter(String name, ContextAwareMetricFactory<ContextAwareMeter> factory) { """ Get a {@link ContextAwareMeter} with a given name. @param name name of the {@link ContextAwareMeter} @param factory a {@link ContextAwareMetricFactory} for building {@link ContextAwareMeter}s @return the {@link ContextAwareMeter} with the given name """ return this.innerMetricContext.getOrCreate(name, factory); }
java
public ContextAwareMeter contextAwareMeter(String name, ContextAwareMetricFactory<ContextAwareMeter> factory) { return this.innerMetricContext.getOrCreate(name, factory); }
[ "public", "ContextAwareMeter", "contextAwareMeter", "(", "String", "name", ",", "ContextAwareMetricFactory", "<", "ContextAwareMeter", ">", "factory", ")", "{", "return", "this", ".", "innerMetricContext", ".", "getOrCreate", "(", "name", ",", "factory", ")", ";", "}" ]
Get a {@link ContextAwareMeter} with a given name. @param name name of the {@link ContextAwareMeter} @param factory a {@link ContextAwareMetricFactory} for building {@link ContextAwareMeter}s @return the {@link ContextAwareMeter} with the given name
[ "Get", "a", "{", "@link", "ContextAwareMeter", "}", "with", "a", "given", "name", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/MetricContext.java#L457-L459
lucee/Lucee
core/src/main/java/lucee/runtime/converter/XMLConverter.java
XMLConverter._serializeStruct
private String _serializeStruct(Struct struct, Map<Object, String> done, String id) throws ConverterException { """ serialize a Struct @param struct Struct to serialize @param done @return serialized struct @throws ConverterException """ StringBuilder sb = new StringBuilder(goIn() + "<STRUCT ID=\"" + id + "\">"); Iterator<Key> it = struct.keyIterator(); deep++; while (it.hasNext()) { Key key = it.next(); // <ENTRY NAME="STRING" TYPE="STRING">hello</ENTRY> String value = _serialize(struct.get(key, null), done); sb.append(goIn() + "<ENTRY NAME=\"" + key.toString() + "\" TYPE=\"" + type + "\">"); sb.append(value); sb.append(goIn() + "</ENTRY>"); } deep--; sb.append(goIn() + "</STRUCT>"); type = "STRUCT"; return sb.toString(); }
java
private String _serializeStruct(Struct struct, Map<Object, String> done, String id) throws ConverterException { StringBuilder sb = new StringBuilder(goIn() + "<STRUCT ID=\"" + id + "\">"); Iterator<Key> it = struct.keyIterator(); deep++; while (it.hasNext()) { Key key = it.next(); // <ENTRY NAME="STRING" TYPE="STRING">hello</ENTRY> String value = _serialize(struct.get(key, null), done); sb.append(goIn() + "<ENTRY NAME=\"" + key.toString() + "\" TYPE=\"" + type + "\">"); sb.append(value); sb.append(goIn() + "</ENTRY>"); } deep--; sb.append(goIn() + "</STRUCT>"); type = "STRUCT"; return sb.toString(); }
[ "private", "String", "_serializeStruct", "(", "Struct", "struct", ",", "Map", "<", "Object", ",", "String", ">", "done", ",", "String", "id", ")", "throws", "ConverterException", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "goIn", "(", ")", "+", "\"<STRUCT ID=\\\"\"", "+", "id", "+", "\"\\\">\"", ")", ";", "Iterator", "<", "Key", ">", "it", "=", "struct", ".", "keyIterator", "(", ")", ";", "deep", "++", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "Key", "key", "=", "it", ".", "next", "(", ")", ";", "// <ENTRY NAME=\"STRING\" TYPE=\"STRING\">hello</ENTRY>", "String", "value", "=", "_serialize", "(", "struct", ".", "get", "(", "key", ",", "null", ")", ",", "done", ")", ";", "sb", ".", "append", "(", "goIn", "(", ")", "+", "\"<ENTRY NAME=\\\"\"", "+", "key", ".", "toString", "(", ")", "+", "\"\\\" TYPE=\\\"\"", "+", "type", "+", "\"\\\">\"", ")", ";", "sb", ".", "append", "(", "value", ")", ";", "sb", ".", "append", "(", "goIn", "(", ")", "+", "\"</ENTRY>\"", ")", ";", "}", "deep", "--", ";", "sb", ".", "append", "(", "goIn", "(", ")", "+", "\"</STRUCT>\"", ")", ";", "type", "=", "\"STRUCT\"", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
serialize a Struct @param struct Struct to serialize @param done @return serialized struct @throws ConverterException
[ "serialize", "a", "Struct" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/converter/XMLConverter.java#L237-L256
aws/aws-sdk-java
aws-java-sdk-kinesisvideo/src/main/java/com/amazonaws/services/kinesisvideo/model/transform/AckEventUnmarshaller.java
AckEventUnmarshaller.getTextField
private String getTextField(JsonNode json, String fieldName) { """ Get a String field from the JSON. @param json JSON document. @param fieldName Field name to get. @return String value of field or null if not present. """ if (!json.has(fieldName)) { return null; } return json.get(fieldName).asText(); }
java
private String getTextField(JsonNode json, String fieldName) { if (!json.has(fieldName)) { return null; } return json.get(fieldName).asText(); }
[ "private", "String", "getTextField", "(", "JsonNode", "json", ",", "String", "fieldName", ")", "{", "if", "(", "!", "json", ".", "has", "(", "fieldName", ")", ")", "{", "return", "null", ";", "}", "return", "json", ".", "get", "(", "fieldName", ")", ".", "asText", "(", ")", ";", "}" ]
Get a String field from the JSON. @param json JSON document. @param fieldName Field name to get. @return String value of field or null if not present.
[ "Get", "a", "String", "field", "from", "the", "JSON", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-kinesisvideo/src/main/java/com/amazonaws/services/kinesisvideo/model/transform/AckEventUnmarshaller.java#L57-L62
UrielCh/ovh-java-sdk
ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java
ApiOvhXdsl.serviceName_modem_lan_lanName_dhcp_dhcpName_DHCPStaticAddresses_MACAddress_PUT
public void serviceName_modem_lan_lanName_dhcp_dhcpName_DHCPStaticAddresses_MACAddress_PUT(String serviceName, String lanName, String dhcpName, String MACAddress, OvhDHCPStaticAddress body) throws IOException { """ Alter this object properties REST: PUT /xdsl/{serviceName}/modem/lan/{lanName}/dhcp/{dhcpName}/DHCPStaticAddresses/{MACAddress} @param body [required] New object properties @param serviceName [required] The internal name of your XDSL offer @param lanName [required] Name of the LAN @param dhcpName [required] Name of the DHCP @param MACAddress [required] The MAC address of the device """ String qPath = "/xdsl/{serviceName}/modem/lan/{lanName}/dhcp/{dhcpName}/DHCPStaticAddresses/{MACAddress}"; StringBuilder sb = path(qPath, serviceName, lanName, dhcpName, MACAddress); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_modem_lan_lanName_dhcp_dhcpName_DHCPStaticAddresses_MACAddress_PUT(String serviceName, String lanName, String dhcpName, String MACAddress, OvhDHCPStaticAddress body) throws IOException { String qPath = "/xdsl/{serviceName}/modem/lan/{lanName}/dhcp/{dhcpName}/DHCPStaticAddresses/{MACAddress}"; StringBuilder sb = path(qPath, serviceName, lanName, dhcpName, MACAddress); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_modem_lan_lanName_dhcp_dhcpName_DHCPStaticAddresses_MACAddress_PUT", "(", "String", "serviceName", ",", "String", "lanName", ",", "String", "dhcpName", ",", "String", "MACAddress", ",", "OvhDHCPStaticAddress", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/xdsl/{serviceName}/modem/lan/{lanName}/dhcp/{dhcpName}/DHCPStaticAddresses/{MACAddress}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "lanName", ",", "dhcpName", ",", "MACAddress", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /xdsl/{serviceName}/modem/lan/{lanName}/dhcp/{dhcpName}/DHCPStaticAddresses/{MACAddress} @param body [required] New object properties @param serviceName [required] The internal name of your XDSL offer @param lanName [required] Name of the LAN @param dhcpName [required] Name of the DHCP @param MACAddress [required] The MAC address of the device
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L1107-L1111
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.defineDesktopPanes
private void defineDesktopPanes(UIDefaults d) { """ Initialize the desktop pane UI settings. @param d the UI defaults map. """ d.put("seaGlassDesktopPane", new ColorUIResource(0x556ba6)); String c = PAINTER_PREFIX + "DesktopPanePainter"; String p = "DesktopPane"; d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, DesktopPanePainter.Which.BACKGROUND_ENABLED)); // Initialize DesktopIcon p = "DesktopIcon"; c = PAINTER_PREFIX + "DesktopIconPainter"; d.put(p + ".contentMargins", new InsetsUIResource(0, 6, 5, 4)); d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, DesktopIconPainter.Which.BACKGROUND_ENABLED)); }
java
private void defineDesktopPanes(UIDefaults d) { d.put("seaGlassDesktopPane", new ColorUIResource(0x556ba6)); String c = PAINTER_PREFIX + "DesktopPanePainter"; String p = "DesktopPane"; d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, DesktopPanePainter.Which.BACKGROUND_ENABLED)); // Initialize DesktopIcon p = "DesktopIcon"; c = PAINTER_PREFIX + "DesktopIconPainter"; d.put(p + ".contentMargins", new InsetsUIResource(0, 6, 5, 4)); d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, DesktopIconPainter.Which.BACKGROUND_ENABLED)); }
[ "private", "void", "defineDesktopPanes", "(", "UIDefaults", "d", ")", "{", "d", ".", "put", "(", "\"seaGlassDesktopPane\"", ",", "new", "ColorUIResource", "(", "0x556ba6", ")", ")", ";", "String", "c", "=", "PAINTER_PREFIX", "+", "\"DesktopPanePainter\"", ";", "String", "p", "=", "\"DesktopPane\"", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "DesktopPanePainter", ".", "Which", ".", "BACKGROUND_ENABLED", ")", ")", ";", "// Initialize DesktopIcon", "p", "=", "\"DesktopIcon\"", ";", "c", "=", "PAINTER_PREFIX", "+", "\"DesktopIconPainter\"", ";", "d", ".", "put", "(", "p", "+", "\".contentMargins\"", ",", "new", "InsetsUIResource", "(", "0", ",", "6", ",", "5", ",", "4", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "DesktopIconPainter", ".", "Which", ".", "BACKGROUND_ENABLED", ")", ")", ";", "}" ]
Initialize the desktop pane UI settings. @param d the UI defaults map.
[ "Initialize", "the", "desktop", "pane", "UI", "settings", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L1143-L1156
jhunters/jprotobuf
src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLProxy.java
ProtobufIDLProxy.createSingle
public static IDLProxyObject createSingle(String data, boolean debug, File path) { """ Creates the single. @param data the data @param debug the debug @param path the path @return the IDL proxy object """ return createSingle(data, debug, path, true); }
java
public static IDLProxyObject createSingle(String data, boolean debug, File path) { return createSingle(data, debug, path, true); }
[ "public", "static", "IDLProxyObject", "createSingle", "(", "String", "data", ",", "boolean", "debug", ",", "File", "path", ")", "{", "return", "createSingle", "(", "data", ",", "debug", ",", "path", ",", "true", ")", ";", "}" ]
Creates the single. @param data the data @param debug the debug @param path the path @return the IDL proxy object
[ "Creates", "the", "single", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLProxy.java#L1121-L1123
phax/ph-css
ph-css/src/main/java/com/helger/css/writer/CSSCompressor.java
CSSCompressor.getCompressedCSS
@Nonnull public static String getCompressedCSS (@Nonnull final String sOriginalCSS, @Nonnull final ECSSVersion eCSSVersion) { """ Get the compressed version of the passed CSS code. @param sOriginalCSS The original CSS code to be compressed. @param eCSSVersion The CSS version to use. @return If compression failed because the CSS is invalid or whatsoever, the original CSS is returned, else the compressed version is returned. """ return getCompressedCSS (sOriginalCSS, eCSSVersion, false); }
java
@Nonnull public static String getCompressedCSS (@Nonnull final String sOriginalCSS, @Nonnull final ECSSVersion eCSSVersion) { return getCompressedCSS (sOriginalCSS, eCSSVersion, false); }
[ "@", "Nonnull", "public", "static", "String", "getCompressedCSS", "(", "@", "Nonnull", "final", "String", "sOriginalCSS", ",", "@", "Nonnull", "final", "ECSSVersion", "eCSSVersion", ")", "{", "return", "getCompressedCSS", "(", "sOriginalCSS", ",", "eCSSVersion", ",", "false", ")", ";", "}" ]
Get the compressed version of the passed CSS code. @param sOriginalCSS The original CSS code to be compressed. @param eCSSVersion The CSS version to use. @return If compression failed because the CSS is invalid or whatsoever, the original CSS is returned, else the compressed version is returned.
[ "Get", "the", "compressed", "version", "of", "the", "passed", "CSS", "code", "." ]
train
https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/writer/CSSCompressor.java#L57-L61
threerings/nenya
core/src/main/java/com/threerings/media/util/LinePath.java
LinePath.getTranslatedInstance
public Path getTranslatedInstance (int x, int y) { """ Return a copy of the path, translated by the specified amounts. """ if (_source == null) { return new LinePath(null, new Point(_dest.x + x, _dest.y + y), _duration); } else { return new LinePath(_source.x + x, _source.y + y, _dest.x + x, _dest.y + y, _duration); } }
java
public Path getTranslatedInstance (int x, int y) { if (_source == null) { return new LinePath(null, new Point(_dest.x + x, _dest.y + y), _duration); } else { return new LinePath(_source.x + x, _source.y + y, _dest.x + x, _dest.y + y, _duration); } }
[ "public", "Path", "getTranslatedInstance", "(", "int", "x", ",", "int", "y", ")", "{", "if", "(", "_source", "==", "null", ")", "{", "return", "new", "LinePath", "(", "null", ",", "new", "Point", "(", "_dest", ".", "x", "+", "x", ",", "_dest", ".", "y", "+", "y", ")", ",", "_duration", ")", ";", "}", "else", "{", "return", "new", "LinePath", "(", "_source", ".", "x", "+", "x", ",", "_source", ".", "y", "+", "y", ",", "_dest", ".", "x", "+", "x", ",", "_dest", ".", "y", "+", "y", ",", "_duration", ")", ";", "}", "}" ]
Return a copy of the path, translated by the specified amounts.
[ "Return", "a", "copy", "of", "the", "path", "translated", "by", "the", "specified", "amounts", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/util/LinePath.java#L66-L75
AltBeacon/android-beacon-library
lib/src/main/java/org/altbeacon/beacon/Beacon.java
Beacon.calculateDistance
protected static Double calculateDistance(int txPower, double bestRssiAvailable) { """ Estimate the distance to the beacon using the DistanceCalculator set on this class. If no DistanceCalculator has been set, return -1 as the distance. @see org.altbeacon.beacon.distance.DistanceCalculator @param txPower @param bestRssiAvailable @return """ if (Beacon.getDistanceCalculator() != null) { return Beacon.getDistanceCalculator().calculateDistance(txPower, bestRssiAvailable); } else { LogManager.e(TAG, "Distance calculator not set. Distance will bet set to -1"); return -1.0; } }
java
protected static Double calculateDistance(int txPower, double bestRssiAvailable) { if (Beacon.getDistanceCalculator() != null) { return Beacon.getDistanceCalculator().calculateDistance(txPower, bestRssiAvailable); } else { LogManager.e(TAG, "Distance calculator not set. Distance will bet set to -1"); return -1.0; } }
[ "protected", "static", "Double", "calculateDistance", "(", "int", "txPower", ",", "double", "bestRssiAvailable", ")", "{", "if", "(", "Beacon", ".", "getDistanceCalculator", "(", ")", "!=", "null", ")", "{", "return", "Beacon", ".", "getDistanceCalculator", "(", ")", ".", "calculateDistance", "(", "txPower", ",", "bestRssiAvailable", ")", ";", "}", "else", "{", "LogManager", ".", "e", "(", "TAG", ",", "\"Distance calculator not set. Distance will bet set to -1\"", ")", ";", "return", "-", "1.0", ";", "}", "}" ]
Estimate the distance to the beacon using the DistanceCalculator set on this class. If no DistanceCalculator has been set, return -1 as the distance. @see org.altbeacon.beacon.distance.DistanceCalculator @param txPower @param bestRssiAvailable @return
[ "Estimate", "the", "distance", "to", "the", "beacon", "using", "the", "DistanceCalculator", "set", "on", "this", "class", ".", "If", "no", "DistanceCalculator", "has", "been", "set", "return", "-", "1", "as", "the", "distance", ".", "@see", "org", ".", "altbeacon", ".", "beacon", ".", "distance", ".", "DistanceCalculator" ]
train
https://github.com/AltBeacon/android-beacon-library/blob/f7f3a323ea7415d53e7bd695ff6a01f1501d5dc3/lib/src/main/java/org/altbeacon/beacon/Beacon.java#L659-L667
onelogin/onelogin-java-sdk
src/main/java/com/onelogin/sdk/conn/Client.java
Client.getEventsBatch
public OneLoginResponse<Event> getEventsBatch(int batchSize, String afterCursor) throws OAuthSystemException, OAuthProblemException, URISyntaxException { """ Get a batch of Events. @param batchSize Size of the Batch @param afterCursor Reference to continue collecting items of next page @return OneLoginResponse of Event (Batch) @throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection @throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled @throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor @see com.onelogin.sdk.model.Event @see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/events/get-events">Get Events documentation</a> """ return getEventsBatch(new HashMap<String, String>(), batchSize, afterCursor); }
java
public OneLoginResponse<Event> getEventsBatch(int batchSize, String afterCursor) throws OAuthSystemException, OAuthProblemException, URISyntaxException { return getEventsBatch(new HashMap<String, String>(), batchSize, afterCursor); }
[ "public", "OneLoginResponse", "<", "Event", ">", "getEventsBatch", "(", "int", "batchSize", ",", "String", "afterCursor", ")", "throws", "OAuthSystemException", ",", "OAuthProblemException", ",", "URISyntaxException", "{", "return", "getEventsBatch", "(", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ",", "batchSize", ",", "afterCursor", ")", ";", "}" ]
Get a batch of Events. @param batchSize Size of the Batch @param afterCursor Reference to continue collecting items of next page @return OneLoginResponse of Event (Batch) @throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection @throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled @throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor @see com.onelogin.sdk.model.Event @see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/events/get-events">Get Events documentation</a>
[ "Get", "a", "batch", "of", "Events", "." ]
train
https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L2004-L2007
motown-io/motown
chargingstation-configuration/view-model/src/main/java/io/motown/chargingstationconfiguration/viewmodel/domain/DomainService.java
DomainService.createEvse
public Evse createEvse(Long chargingStationTypeId, Evse evse) throws ResourceAlreadyExistsException { """ Creates a Evse in a charging station type. @param chargingStationTypeId charging station type identifier. @param evse evse object @return created Evse """ ChargingStationType chargingStationType = chargingStationTypeRepository.findOne(chargingStationTypeId); if (getEvseByIdentifier(chargingStationType, evse.getIdentifier()) != null) { throw new ResourceAlreadyExistsException(String.format("Evse with identifier '%s' already exists.", evse.getIdentifier())); } chargingStationType.getEvses().add(evse); chargingStationType = chargingStationTypeRepository.createOrUpdate(chargingStationType); return getEvseByIdentifier(chargingStationType, evse.getIdentifier()); }
java
public Evse createEvse(Long chargingStationTypeId, Evse evse) throws ResourceAlreadyExistsException { ChargingStationType chargingStationType = chargingStationTypeRepository.findOne(chargingStationTypeId); if (getEvseByIdentifier(chargingStationType, evse.getIdentifier()) != null) { throw new ResourceAlreadyExistsException(String.format("Evse with identifier '%s' already exists.", evse.getIdentifier())); } chargingStationType.getEvses().add(evse); chargingStationType = chargingStationTypeRepository.createOrUpdate(chargingStationType); return getEvseByIdentifier(chargingStationType, evse.getIdentifier()); }
[ "public", "Evse", "createEvse", "(", "Long", "chargingStationTypeId", ",", "Evse", "evse", ")", "throws", "ResourceAlreadyExistsException", "{", "ChargingStationType", "chargingStationType", "=", "chargingStationTypeRepository", ".", "findOne", "(", "chargingStationTypeId", ")", ";", "if", "(", "getEvseByIdentifier", "(", "chargingStationType", ",", "evse", ".", "getIdentifier", "(", ")", ")", "!=", "null", ")", "{", "throw", "new", "ResourceAlreadyExistsException", "(", "String", ".", "format", "(", "\"Evse with identifier '%s' already exists.\"", ",", "evse", ".", "getIdentifier", "(", ")", ")", ")", ";", "}", "chargingStationType", ".", "getEvses", "(", ")", ".", "add", "(", "evse", ")", ";", "chargingStationType", "=", "chargingStationTypeRepository", ".", "createOrUpdate", "(", "chargingStationType", ")", ";", "return", "getEvseByIdentifier", "(", "chargingStationType", ",", "evse", ".", "getIdentifier", "(", ")", ")", ";", "}" ]
Creates a Evse in a charging station type. @param chargingStationTypeId charging station type identifier. @param evse evse object @return created Evse
[ "Creates", "a", "Evse", "in", "a", "charging", "station", "type", "." ]
train
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/chargingstation-configuration/view-model/src/main/java/io/motown/chargingstationconfiguration/viewmodel/domain/DomainService.java#L73-L84
OpenLiberty/open-liberty
dev/com.ibm.ws.serialization/src/com/ibm/ws/serialization/DeserializationObjectInputStream.java
DeserializationObjectInputStream.resolveProxyClass
@Override protected Class<?> resolveProxyClass(String[] interfaceNames) throws ClassNotFoundException { """ Delegates class loading to the specified class loader. <p>{@inheritDoc} """ ClassLoader proxyClassLoader = classLoader; Class<?>[] interfaces = new Class[interfaceNames.length]; Class<?> nonPublicInterface = null; for (int i = 0; i < interfaceNames.length; i++) { Class<?> intf = loadClass(interfaceNames[i]); if (!Modifier.isPublic(intf.getModifiers())) { ClassLoader classLoader = getClassLoader(intf); if (nonPublicInterface != null) { if (classLoader != proxyClassLoader) { throw new IllegalAccessError(nonPublicInterface + " and " + intf + " both declared non-public in different class loaders"); } } else { nonPublicInterface = intf; proxyClassLoader = classLoader; } } interfaces[i] = intf; } try { return Proxy.getProxyClass(proxyClassLoader, interfaces); } catch (IllegalArgumentException ex) { throw new ClassNotFoundException(null, ex); } }
java
@Override protected Class<?> resolveProxyClass(String[] interfaceNames) throws ClassNotFoundException { ClassLoader proxyClassLoader = classLoader; Class<?>[] interfaces = new Class[interfaceNames.length]; Class<?> nonPublicInterface = null; for (int i = 0; i < interfaceNames.length; i++) { Class<?> intf = loadClass(interfaceNames[i]); if (!Modifier.isPublic(intf.getModifiers())) { ClassLoader classLoader = getClassLoader(intf); if (nonPublicInterface != null) { if (classLoader != proxyClassLoader) { throw new IllegalAccessError(nonPublicInterface + " and " + intf + " both declared non-public in different class loaders"); } } else { nonPublicInterface = intf; proxyClassLoader = classLoader; } } interfaces[i] = intf; } try { return Proxy.getProxyClass(proxyClassLoader, interfaces); } catch (IllegalArgumentException ex) { throw new ClassNotFoundException(null, ex); } }
[ "@", "Override", "protected", "Class", "<", "?", ">", "resolveProxyClass", "(", "String", "[", "]", "interfaceNames", ")", "throws", "ClassNotFoundException", "{", "ClassLoader", "proxyClassLoader", "=", "classLoader", ";", "Class", "<", "?", ">", "[", "]", "interfaces", "=", "new", "Class", "[", "interfaceNames", ".", "length", "]", ";", "Class", "<", "?", ">", "nonPublicInterface", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "interfaceNames", ".", "length", ";", "i", "++", ")", "{", "Class", "<", "?", ">", "intf", "=", "loadClass", "(", "interfaceNames", "[", "i", "]", ")", ";", "if", "(", "!", "Modifier", ".", "isPublic", "(", "intf", ".", "getModifiers", "(", ")", ")", ")", "{", "ClassLoader", "classLoader", "=", "getClassLoader", "(", "intf", ")", ";", "if", "(", "nonPublicInterface", "!=", "null", ")", "{", "if", "(", "classLoader", "!=", "proxyClassLoader", ")", "{", "throw", "new", "IllegalAccessError", "(", "nonPublicInterface", "+", "\" and \"", "+", "intf", "+", "\" both declared non-public in different class loaders\"", ")", ";", "}", "}", "else", "{", "nonPublicInterface", "=", "intf", ";", "proxyClassLoader", "=", "classLoader", ";", "}", "}", "interfaces", "[", "i", "]", "=", "intf", ";", "}", "try", "{", "return", "Proxy", ".", "getProxyClass", "(", "proxyClassLoader", ",", "interfaces", ")", ";", "}", "catch", "(", "IllegalArgumentException", "ex", ")", "{", "throw", "new", "ClassNotFoundException", "(", "null", ",", "ex", ")", ";", "}", "}" ]
Delegates class loading to the specified class loader. <p>{@inheritDoc}
[ "Delegates", "class", "loading", "to", "the", "specified", "class", "loader", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.serialization/src/com/ibm/ws/serialization/DeserializationObjectInputStream.java#L212-L241
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.purgeDeletedCertificateAsync
public ServiceFuture<Void> purgeDeletedCertificateAsync(String vaultBaseUrl, String certificateName, final ServiceCallback<Void> serviceCallback) { """ Permanently deletes the specified deleted certificate. The PurgeDeletedCertificate operation performs an irreversible deletion of the specified certificate, without possibility for recovery. The operation is not available if the recovery level does not specify 'Purgeable'. This operation requires the certificate/purge permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param certificateName The name of the certificate @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object """ return ServiceFuture.fromResponse(purgeDeletedCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName), serviceCallback); }
java
public ServiceFuture<Void> purgeDeletedCertificateAsync(String vaultBaseUrl, String certificateName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(purgeDeletedCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName), serviceCallback); }
[ "public", "ServiceFuture", "<", "Void", ">", "purgeDeletedCertificateAsync", "(", "String", "vaultBaseUrl", ",", "String", "certificateName", ",", "final", "ServiceCallback", "<", "Void", ">", "serviceCallback", ")", "{", "return", "ServiceFuture", ".", "fromResponse", "(", "purgeDeletedCertificateWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "certificateName", ")", ",", "serviceCallback", ")", ";", "}" ]
Permanently deletes the specified deleted certificate. The PurgeDeletedCertificate operation performs an irreversible deletion of the specified certificate, without possibility for recovery. The operation is not available if the recovery level does not specify 'Purgeable'. This operation requires the certificate/purge permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param certificateName The name of the certificate @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Permanently", "deletes", "the", "specified", "deleted", "certificate", ".", "The", "PurgeDeletedCertificate", "operation", "performs", "an", "irreversible", "deletion", "of", "the", "specified", "certificate", "without", "possibility", "for", "recovery", ".", "The", "operation", "is", "not", "available", "if", "the", "recovery", "level", "does", "not", "specify", "Purgeable", ".", "This", "operation", "requires", "the", "certificate", "/", "purge", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L8635-L8637
threerings/nenya
core/src/main/java/com/threerings/media/image/ImageUtil.java
ImageUtil.recolorImage
public static BufferedImage recolorImage ( BufferedImage image, Color rootColor, float[] dists, float[] offsets) { """ Used to recolor images by shifting bands of color (in HSV color space) to a new hue. The source images must be 8-bit color mapped images, as the recoloring process works by analysing the color map and modifying it. """ return recolorImage(image, new Colorization[] { new Colorization(-1, rootColor, dists, offsets) }); }
java
public static BufferedImage recolorImage ( BufferedImage image, Color rootColor, float[] dists, float[] offsets) { return recolorImage(image, new Colorization[] { new Colorization(-1, rootColor, dists, offsets) }); }
[ "public", "static", "BufferedImage", "recolorImage", "(", "BufferedImage", "image", ",", "Color", "rootColor", ",", "float", "[", "]", "dists", ",", "float", "[", "]", "offsets", ")", "{", "return", "recolorImage", "(", "image", ",", "new", "Colorization", "[", "]", "{", "new", "Colorization", "(", "-", "1", ",", "rootColor", ",", "dists", ",", "offsets", ")", "}", ")", ";", "}" ]
Used to recolor images by shifting bands of color (in HSV color space) to a new hue. The source images must be 8-bit color mapped images, as the recoloring process works by analysing the color map and modifying it.
[ "Used", "to", "recolor", "images", "by", "shifting", "bands", "of", "color", "(", "in", "HSV", "color", "space", ")", "to", "a", "new", "hue", ".", "The", "source", "images", "must", "be", "8", "-", "bit", "color", "mapped", "images", "as", "the", "recoloring", "process", "works", "by", "analysing", "the", "color", "map", "and", "modifying", "it", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ImageUtil.java#L94-L99
yavijava/yavijava
src/main/java/com/vmware/vim25/mo/OverheadMemoryManager.java
OverheadMemoryManager.lookupVmOverheadMemory
public long lookupVmOverheadMemory(VirtualMachine vm, HostSystem host) throws InvalidArgument, InvalidType, ManagedObjectNotFound, NotFound, RuntimeFault, RemoteException { """ Return static VM overhead memory value in bytes for a (vm, host) pair from the overhead memory module (OMM) in Virtual Center. @param vm The Virtual Machine @param host The Host @return Overhead memory value, if found in the OMM. @throws InvalidArgument @throws InvalidType @throws ManagedObjectNotFound @throws NotFound @throws RuntimeFault @throws RemoteException """ return getVimService().lookupVmOverheadMemory(getMOR(), vm.getMOR(), host.getMOR()); }
java
public long lookupVmOverheadMemory(VirtualMachine vm, HostSystem host) throws InvalidArgument, InvalidType, ManagedObjectNotFound, NotFound, RuntimeFault, RemoteException { return getVimService().lookupVmOverheadMemory(getMOR(), vm.getMOR(), host.getMOR()); }
[ "public", "long", "lookupVmOverheadMemory", "(", "VirtualMachine", "vm", ",", "HostSystem", "host", ")", "throws", "InvalidArgument", ",", "InvalidType", ",", "ManagedObjectNotFound", ",", "NotFound", ",", "RuntimeFault", ",", "RemoteException", "{", "return", "getVimService", "(", ")", ".", "lookupVmOverheadMemory", "(", "getMOR", "(", ")", ",", "vm", ".", "getMOR", "(", ")", ",", "host", ".", "getMOR", "(", ")", ")", ";", "}" ]
Return static VM overhead memory value in bytes for a (vm, host) pair from the overhead memory module (OMM) in Virtual Center. @param vm The Virtual Machine @param host The Host @return Overhead memory value, if found in the OMM. @throws InvalidArgument @throws InvalidType @throws ManagedObjectNotFound @throws NotFound @throws RuntimeFault @throws RemoteException
[ "Return", "static", "VM", "overhead", "memory", "value", "in", "bytes", "for", "a", "(", "vm", "host", ")", "pair", "from", "the", "overhead", "memory", "module", "(", "OMM", ")", "in", "Virtual", "Center", "." ]
train
https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/OverheadMemoryManager.java#L44-L46
NessComputing/components-ness-amqp
src/main/java/com/nesscomputing/amqp/AmqpRunnableFactory.java
AmqpRunnableFactory.createQueueListener
public QueueConsumer createQueueListener(final String name, final ConsumerCallback messageCallback) { """ Creates a new {@link QueueConsumer}. For every message received (or when the timeout waiting for messages is hit), the callback is invoked with the message received. """ Preconditions.checkState(connectionFactory != null, "connection factory was never injected!"); return new QueueConsumer(connectionFactory, amqpConfig, name, messageCallback); }
java
public QueueConsumer createQueueListener(final String name, final ConsumerCallback messageCallback) { Preconditions.checkState(connectionFactory != null, "connection factory was never injected!"); return new QueueConsumer(connectionFactory, amqpConfig, name, messageCallback); }
[ "public", "QueueConsumer", "createQueueListener", "(", "final", "String", "name", ",", "final", "ConsumerCallback", "messageCallback", ")", "{", "Preconditions", ".", "checkState", "(", "connectionFactory", "!=", "null", ",", "\"connection factory was never injected!\"", ")", ";", "return", "new", "QueueConsumer", "(", "connectionFactory", ",", "amqpConfig", ",", "name", ",", "messageCallback", ")", ";", "}" ]
Creates a new {@link QueueConsumer}. For every message received (or when the timeout waiting for messages is hit), the callback is invoked with the message received.
[ "Creates", "a", "new", "{" ]
train
https://github.com/NessComputing/components-ness-amqp/blob/3d36b0b71d975f943efb3c181a16c72d46892922/src/main/java/com/nesscomputing/amqp/AmqpRunnableFactory.java#L139-L143
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_line_serviceName_phone_changePhoneConfiguration_POST
public void billingAccount_line_serviceName_phone_changePhoneConfiguration_POST(String billingAccount, String serviceName, Boolean autoReboot, OvhSafeKeyValue<String>[] newConfigurations) throws IOException { """ Edit configuration of the phone remotely by provisioning REST: POST /telephony/{billingAccount}/line/{serviceName}/phone/changePhoneConfiguration @param autoReboot [required] Automatically reboot phone when applying the configuration @param newConfigurations [required] Name value pairs of provisioning options @param billingAccount [required] The name of your billingAccount @param serviceName [required] """ String qPath = "/telephony/{billingAccount}/line/{serviceName}/phone/changePhoneConfiguration"; StringBuilder sb = path(qPath, billingAccount, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "autoReboot", autoReboot); addBody(o, "newConfigurations", newConfigurations); exec(qPath, "POST", sb.toString(), o); }
java
public void billingAccount_line_serviceName_phone_changePhoneConfiguration_POST(String billingAccount, String serviceName, Boolean autoReboot, OvhSafeKeyValue<String>[] newConfigurations) throws IOException { String qPath = "/telephony/{billingAccount}/line/{serviceName}/phone/changePhoneConfiguration"; StringBuilder sb = path(qPath, billingAccount, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "autoReboot", autoReboot); addBody(o, "newConfigurations", newConfigurations); exec(qPath, "POST", sb.toString(), o); }
[ "public", "void", "billingAccount_line_serviceName_phone_changePhoneConfiguration_POST", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Boolean", "autoReboot", ",", "OvhSafeKeyValue", "<", "String", ">", "[", "]", "newConfigurations", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/line/{serviceName}/phone/changePhoneConfiguration\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "serviceName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"autoReboot\"", ",", "autoReboot", ")", ";", "addBody", "(", "o", ",", "\"newConfigurations\"", ",", "newConfigurations", ")", ";", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "}" ]
Edit configuration of the phone remotely by provisioning REST: POST /telephony/{billingAccount}/line/{serviceName}/phone/changePhoneConfiguration @param autoReboot [required] Automatically reboot phone when applying the configuration @param newConfigurations [required] Name value pairs of provisioning options @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Edit", "configuration", "of", "the", "phone", "remotely", "by", "provisioning" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L1208-L1215
opengeospatial/teamengine
teamengine-core/src/main/java/com/occamlab/te/parsers/XmlErrorHandler.java
XmlErrorHandler.addError
private void addError(short severity, SAXParseException spex) { """ Adds a validation error based on a <code>SAXParseException</code>. @param severity the severity of the error @param spex the <code>SAXParseException</code> raised while validating the XML source """ if (spex.getLineNumber() > 0) { buf.append("Line " + spex.getLineNumber() + " - "); } buf.append(spex.getMessage() + "\n"); ValidationError error = new ValidationError(severity, buf.toString()); errors.add(error); buf.setLength(0); }
java
private void addError(short severity, SAXParseException spex) { if (spex.getLineNumber() > 0) { buf.append("Line " + spex.getLineNumber() + " - "); } buf.append(spex.getMessage() + "\n"); ValidationError error = new ValidationError(severity, buf.toString()); errors.add(error); buf.setLength(0); }
[ "private", "void", "addError", "(", "short", "severity", ",", "SAXParseException", "spex", ")", "{", "if", "(", "spex", ".", "getLineNumber", "(", ")", ">", "0", ")", "{", "buf", ".", "append", "(", "\"Line \"", "+", "spex", ".", "getLineNumber", "(", ")", "+", "\" - \"", ")", ";", "}", "buf", ".", "append", "(", "spex", ".", "getMessage", "(", ")", "+", "\"\\n\"", ")", ";", "ValidationError", "error", "=", "new", "ValidationError", "(", "severity", ",", "buf", ".", "toString", "(", ")", ")", ";", "errors", ".", "add", "(", "error", ")", ";", "buf", ".", "setLength", "(", "0", ")", ";", "}" ]
Adds a validation error based on a <code>SAXParseException</code>. @param severity the severity of the error @param spex the <code>SAXParseException</code> raised while validating the XML source
[ "Adds", "a", "validation", "error", "based", "on", "a", "<code", ">", "SAXParseException<", "/", "code", ">", "." ]
train
https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-core/src/main/java/com/occamlab/te/parsers/XmlErrorHandler.java#L130-L138
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/common/ServiceSupport.java
ServiceSupport.setService
@Override public void setService(final String name, final FrameworkSupportService service) { """ Set a service by name @param name name @param service service """ synchronized (services){ if(null==services.get(name) && null!=service) { services.put(name, service); }else if(null==service) { services.remove(name); } } }
java
@Override public void setService(final String name, final FrameworkSupportService service){ synchronized (services){ if(null==services.get(name) && null!=service) { services.put(name, service); }else if(null==service) { services.remove(name); } } }
[ "@", "Override", "public", "void", "setService", "(", "final", "String", "name", ",", "final", "FrameworkSupportService", "service", ")", "{", "synchronized", "(", "services", ")", "{", "if", "(", "null", "==", "services", ".", "get", "(", "name", ")", "&&", "null", "!=", "service", ")", "{", "services", ".", "put", "(", "name", ",", "service", ")", ";", "}", "else", "if", "(", "null", "==", "service", ")", "{", "services", ".", "remove", "(", "name", ")", ";", "}", "}", "}" ]
Set a service by name @param name name @param service service
[ "Set", "a", "service", "by", "name" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/common/ServiceSupport.java#L85-L94
deephacks/confit
api-model/src/main/java/org/deephacks/confit/model/Bean.java
Bean.setReferences
public void setReferences(final String propertyName, final List<BeanId> values) { """ Overwrite/replace the current references with the provided reference. @param propertyName name of the property as defined by the bean's schema. @param values override """ Preconditions.checkNotNull(propertyName); if (values == null || values.size() == 0) { references.put(propertyName, null); return; } checkCircularReference(values.toArray(new BeanId[values.size()])); references.put(propertyName, values); }
java
public void setReferences(final String propertyName, final List<BeanId> values) { Preconditions.checkNotNull(propertyName); if (values == null || values.size() == 0) { references.put(propertyName, null); return; } checkCircularReference(values.toArray(new BeanId[values.size()])); references.put(propertyName, values); }
[ "public", "void", "setReferences", "(", "final", "String", "propertyName", ",", "final", "List", "<", "BeanId", ">", "values", ")", "{", "Preconditions", ".", "checkNotNull", "(", "propertyName", ")", ";", "if", "(", "values", "==", "null", "||", "values", ".", "size", "(", ")", "==", "0", ")", "{", "references", ".", "put", "(", "propertyName", ",", "null", ")", ";", "return", ";", "}", "checkCircularReference", "(", "values", ".", "toArray", "(", "new", "BeanId", "[", "values", ".", "size", "(", ")", "]", ")", ")", ";", "references", ".", "put", "(", "propertyName", ",", "values", ")", ";", "}" ]
Overwrite/replace the current references with the provided reference. @param propertyName name of the property as defined by the bean's schema. @param values override
[ "Overwrite", "/", "replace", "the", "current", "references", "with", "the", "provided", "reference", "." ]
train
https://github.com/deephacks/confit/blob/4e6d4ee5fed32cbc5104433e61de1bcf1b360832/api-model/src/main/java/org/deephacks/confit/model/Bean.java#L374-L382
opentelecoms-org/zrtp-java
src/zorg/platform/android/AndroidCacheEntry.java
AndroidCacheEntry.fromString
public static ZrtpCacheEntry fromString(String key, String value) { """ Create a Cache Entry, from the Zid string and the CSV representation of HEX RAW data and phone number @param key ZID string @param value CSV of HEX raw data and phone number, for example "E84FE07E054660FFF5CF90B4,+3943332233323" @return a new ZRTP cache entry """ String data = null; String number = null; int sep = value.indexOf(','); if (sep > 0) { data = value.substring(0, sep); number = value.substring(sep + 1); } else { data = value; number = ""; } byte[] buffer = new byte[data.length() / 2]; for (int i = 0; i < buffer.length; i++) { buffer[i] = (byte) Short.parseShort( data.substring(i * 2, i * 2 + 2), 16); } AndroidCacheEntry entry = new AndroidCacheEntry(key, buffer, number); return entry; }
java
public static ZrtpCacheEntry fromString(String key, String value) { String data = null; String number = null; int sep = value.indexOf(','); if (sep > 0) { data = value.substring(0, sep); number = value.substring(sep + 1); } else { data = value; number = ""; } byte[] buffer = new byte[data.length() / 2]; for (int i = 0; i < buffer.length; i++) { buffer[i] = (byte) Short.parseShort( data.substring(i * 2, i * 2 + 2), 16); } AndroidCacheEntry entry = new AndroidCacheEntry(key, buffer, number); return entry; }
[ "public", "static", "ZrtpCacheEntry", "fromString", "(", "String", "key", ",", "String", "value", ")", "{", "String", "data", "=", "null", ";", "String", "number", "=", "null", ";", "int", "sep", "=", "value", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "sep", ">", "0", ")", "{", "data", "=", "value", ".", "substring", "(", "0", ",", "sep", ")", ";", "number", "=", "value", ".", "substring", "(", "sep", "+", "1", ")", ";", "}", "else", "{", "data", "=", "value", ";", "number", "=", "\"\"", ";", "}", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "data", ".", "length", "(", ")", "/", "2", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "buffer", ".", "length", ";", "i", "++", ")", "{", "buffer", "[", "i", "]", "=", "(", "byte", ")", "Short", ".", "parseShort", "(", "data", ".", "substring", "(", "i", "*", "2", ",", "i", "*", "2", "+", "2", ")", ",", "16", ")", ";", "}", "AndroidCacheEntry", "entry", "=", "new", "AndroidCacheEntry", "(", "key", ",", "buffer", ",", "number", ")", ";", "return", "entry", ";", "}" ]
Create a Cache Entry, from the Zid string and the CSV representation of HEX RAW data and phone number @param key ZID string @param value CSV of HEX raw data and phone number, for example "E84FE07E054660FFF5CF90B4,+3943332233323" @return a new ZRTP cache entry
[ "Create", "a", "Cache", "Entry", "from", "the", "Zid", "string", "and", "the", "CSV", "representation", "of", "HEX", "RAW", "data", "and", "phone", "number" ]
train
https://github.com/opentelecoms-org/zrtp-java/blob/10a0c77866c5d1b1504df161db9a447f5069ed54/src/zorg/platform/android/AndroidCacheEntry.java#L108-L126
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/operators/BatchTask.java
BatchTask.openUserCode
public static void openUserCode(Function stub, Configuration parameters) throws Exception { """ Opens the given stub using its {@link org.apache.flink.api.common.functions.RichFunction#open(Configuration)} method. If the open call produces an exception, a new exception with a standard error message is created, using the encountered exception as its cause. @param stub The user code instance to be opened. @param parameters The parameters supplied to the user code. @throws Exception Thrown, if the user code's open method produces an exception. """ try { FunctionUtils.openFunction(stub, parameters); } catch (Throwable t) { throw new Exception("The user defined 'open(Configuration)' method in " + stub.getClass().toString() + " caused an exception: " + t.getMessage(), t); } }
java
public static void openUserCode(Function stub, Configuration parameters) throws Exception { try { FunctionUtils.openFunction(stub, parameters); } catch (Throwable t) { throw new Exception("The user defined 'open(Configuration)' method in " + stub.getClass().toString() + " caused an exception: " + t.getMessage(), t); } }
[ "public", "static", "void", "openUserCode", "(", "Function", "stub", ",", "Configuration", "parameters", ")", "throws", "Exception", "{", "try", "{", "FunctionUtils", ".", "openFunction", "(", "stub", ",", "parameters", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "throw", "new", "Exception", "(", "\"The user defined 'open(Configuration)' method in \"", "+", "stub", ".", "getClass", "(", ")", ".", "toString", "(", ")", "+", "\" caused an exception: \"", "+", "t", ".", "getMessage", "(", ")", ",", "t", ")", ";", "}", "}" ]
Opens the given stub using its {@link org.apache.flink.api.common.functions.RichFunction#open(Configuration)} method. If the open call produces an exception, a new exception with a standard error message is created, using the encountered exception as its cause. @param stub The user code instance to be opened. @param parameters The parameters supplied to the user code. @throws Exception Thrown, if the user code's open method produces an exception.
[ "Opens", "the", "given", "stub", "using", "its", "{", "@link", "org", ".", "apache", ".", "flink", ".", "api", ".", "common", ".", "functions", ".", "RichFunction#open", "(", "Configuration", ")", "}", "method", ".", "If", "the", "open", "call", "produces", "an", "exception", "a", "new", "exception", "with", "a", "standard", "error", "message", "is", "created", "using", "the", "encountered", "exception", "as", "its", "cause", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/BatchTask.java#L1347-L1353
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/ReferrerURLCookieHandler.java
ReferrerURLCookieHandler.setReferrerURLCookie
public void setReferrerURLCookie(HttpServletRequest req, AuthenticationResult authResult, String url) { """ Sets the referrer URL cookie into the AuthenticationResult. If PRESERVE_FULLY_QUALIFIED_REFERRER_URL is not set, or set to false, then the host name of the referrer URL is removed. @param authResult AuthenticationResult instance @param url non-null URL String @param securityConfig SecurityConfig instance """ //PM81345: If the URL contains favicon, then we will not update the value of the ReffererURL. The only way //we will do it, is if the value of the cookie is null. This will solve the Error 500. if (url.contains("/favicon.ico") && CookieHelper.getCookieValue(req.getCookies(), REFERRER_URL_COOKIENAME) != null) { if (tc.isDebugEnabled()) Tr.debug(tc, "Will not update the WASReqURL cookie"); } else { if (!webAppSecConfig.getPreserveFullyQualifiedReferrerUrl()) { url = removeHostNameFromURL(url); } url = encodeURL(url); authResult.setCookie(createReferrerUrlCookie(req, url)); if (tc.isDebugEnabled()) { Tr.debug(tc, "set " + REFERRER_URL_COOKIENAME + " cookie into AuthenticationResult."); Tr.debug(tc, "setReferrerURLCookie", "Referrer URL cookie set " + url); } } }
java
public void setReferrerURLCookie(HttpServletRequest req, AuthenticationResult authResult, String url) { //PM81345: If the URL contains favicon, then we will not update the value of the ReffererURL. The only way //we will do it, is if the value of the cookie is null. This will solve the Error 500. if (url.contains("/favicon.ico") && CookieHelper.getCookieValue(req.getCookies(), REFERRER_URL_COOKIENAME) != null) { if (tc.isDebugEnabled()) Tr.debug(tc, "Will not update the WASReqURL cookie"); } else { if (!webAppSecConfig.getPreserveFullyQualifiedReferrerUrl()) { url = removeHostNameFromURL(url); } url = encodeURL(url); authResult.setCookie(createReferrerUrlCookie(req, url)); if (tc.isDebugEnabled()) { Tr.debug(tc, "set " + REFERRER_URL_COOKIENAME + " cookie into AuthenticationResult."); Tr.debug(tc, "setReferrerURLCookie", "Referrer URL cookie set " + url); } } }
[ "public", "void", "setReferrerURLCookie", "(", "HttpServletRequest", "req", ",", "AuthenticationResult", "authResult", ",", "String", "url", ")", "{", "//PM81345: If the URL contains favicon, then we will not update the value of the ReffererURL. The only way", "//we will do it, is if the value of the cookie is null. This will solve the Error 500.", "if", "(", "url", ".", "contains", "(", "\"/favicon.ico\"", ")", "&&", "CookieHelper", ".", "getCookieValue", "(", "req", ".", "getCookies", "(", ")", ",", "REFERRER_URL_COOKIENAME", ")", "!=", "null", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Will not update the WASReqURL cookie\"", ")", ";", "}", "else", "{", "if", "(", "!", "webAppSecConfig", ".", "getPreserveFullyQualifiedReferrerUrl", "(", ")", ")", "{", "url", "=", "removeHostNameFromURL", "(", "url", ")", ";", "}", "url", "=", "encodeURL", "(", "url", ")", ";", "authResult", ".", "setCookie", "(", "createReferrerUrlCookie", "(", "req", ",", "url", ")", ")", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"set \"", "+", "REFERRER_URL_COOKIENAME", "+", "\" cookie into AuthenticationResult.\"", ")", ";", "Tr", ".", "debug", "(", "tc", ",", "\"setReferrerURLCookie\"", ",", "\"Referrer URL cookie set \"", "+", "url", ")", ";", "}", "}", "}" ]
Sets the referrer URL cookie into the AuthenticationResult. If PRESERVE_FULLY_QUALIFIED_REFERRER_URL is not set, or set to false, then the host name of the referrer URL is removed. @param authResult AuthenticationResult instance @param url non-null URL String @param securityConfig SecurityConfig instance
[ "Sets", "the", "referrer", "URL", "cookie", "into", "the", "AuthenticationResult", ".", "If", "PRESERVE_FULLY_QUALIFIED_REFERRER_URL", "is", "not", "set", "or", "set", "to", "false", "then", "the", "host", "name", "of", "the", "referrer", "URL", "is", "removed", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/ReferrerURLCookieHandler.java#L221-L238
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/PagingParams.java
PagingParams.fromMap
public static PagingParams fromMap(AnyValueMap map) { """ Creates a new PagingParams and sets it parameters from the AnyValueMap map @param map a AnyValueMap to initialize this PagingParams @return a newly created PagingParams. """ Long skip = map.getAsNullableLong("skip"); Long take = map.getAsNullableLong("take"); boolean total = map.getAsBooleanWithDefault("total", true); return new PagingParams(skip, take, total); }
java
public static PagingParams fromMap(AnyValueMap map) { Long skip = map.getAsNullableLong("skip"); Long take = map.getAsNullableLong("take"); boolean total = map.getAsBooleanWithDefault("total", true); return new PagingParams(skip, take, total); }
[ "public", "static", "PagingParams", "fromMap", "(", "AnyValueMap", "map", ")", "{", "Long", "skip", "=", "map", ".", "getAsNullableLong", "(", "\"skip\"", ")", ";", "Long", "take", "=", "map", ".", "getAsNullableLong", "(", "\"take\"", ")", ";", "boolean", "total", "=", "map", ".", "getAsBooleanWithDefault", "(", "\"total\"", ",", "true", ")", ";", "return", "new", "PagingParams", "(", "skip", ",", "take", ",", "total", ")", ";", "}" ]
Creates a new PagingParams and sets it parameters from the AnyValueMap map @param map a AnyValueMap to initialize this PagingParams @return a newly created PagingParams.
[ "Creates", "a", "new", "PagingParams", "and", "sets", "it", "parameters", "from", "the", "AnyValueMap", "map" ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/PagingParams.java#L164-L169
jenkinsci/support-core-plugin
src/main/java/com/cloudbees/jenkins/support/impl/GCLogs.java
GCLogs.handleRotatedLogs
private void handleRotatedLogs(@Nonnull final String gcLogFileLocation, Container result) { """ Two cases: <ul> <li>The file name contains <code>%t</code> or <code>%p</code> somewhere in the middle: then we are simply going to replace those by <code>.*</code> to find associated logs and match files by regex. This will match GC logs from the current JVM execution, or possibly previous ones.</li> <li>or that feature is not used, then we simply match by "starts with"</li> </ul> @param gcLogFileLocation the specified value after <code>-Xloggc:</code> @param result the container where to add the found logs, if any. @see https://bugs.openjdk.java.net/browse/JDK-7164841 """ File gcLogFile = new File(gcLogFileLocation); // always add .* in the end because this is where the numbering is going to happen String regex = gcLogFile.getName().replaceAll("%[pt]", ".*") + ".*"; final Pattern gcLogFilesPattern = Pattern.compile(regex); File parentDirectory = gcLogFile.getParentFile(); if (parentDirectory == null || !parentDirectory.exists()) { LOGGER.warning("[Support Bundle] " + parentDirectory + " does not exist, cannot collect gc logging files."); return; } File[] gcLogs = parentDirectory.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return gcLogFilesPattern.matcher(name).matches(); } }); if (gcLogs == null || gcLogs.length == 0) { LOGGER.warning("No GC logging files found, although the VM argument was found. This is probably a bug."); return; } LOGGER.finest("Found " + gcLogs.length + " matching files in " + parentDirectory.getAbsolutePath()); for (File gcLog : gcLogs) { LOGGER.finest("Adding '" + gcLog.getName() + "' file"); result.add(new FileContent(GCLOGS_BUNDLE_ROOT + "{0}", new String[]{gcLog.getName()}, gcLog)); } }
java
private void handleRotatedLogs(@Nonnull final String gcLogFileLocation, Container result) { File gcLogFile = new File(gcLogFileLocation); // always add .* in the end because this is where the numbering is going to happen String regex = gcLogFile.getName().replaceAll("%[pt]", ".*") + ".*"; final Pattern gcLogFilesPattern = Pattern.compile(regex); File parentDirectory = gcLogFile.getParentFile(); if (parentDirectory == null || !parentDirectory.exists()) { LOGGER.warning("[Support Bundle] " + parentDirectory + " does not exist, cannot collect gc logging files."); return; } File[] gcLogs = parentDirectory.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return gcLogFilesPattern.matcher(name).matches(); } }); if (gcLogs == null || gcLogs.length == 0) { LOGGER.warning("No GC logging files found, although the VM argument was found. This is probably a bug."); return; } LOGGER.finest("Found " + gcLogs.length + " matching files in " + parentDirectory.getAbsolutePath()); for (File gcLog : gcLogs) { LOGGER.finest("Adding '" + gcLog.getName() + "' file"); result.add(new FileContent(GCLOGS_BUNDLE_ROOT + "{0}", new String[]{gcLog.getName()}, gcLog)); } }
[ "private", "void", "handleRotatedLogs", "(", "@", "Nonnull", "final", "String", "gcLogFileLocation", ",", "Container", "result", ")", "{", "File", "gcLogFile", "=", "new", "File", "(", "gcLogFileLocation", ")", ";", "// always add .* in the end because this is where the numbering is going to happen", "String", "regex", "=", "gcLogFile", ".", "getName", "(", ")", ".", "replaceAll", "(", "\"%[pt]\"", ",", "\".*\"", ")", "+", "\".*\"", ";", "final", "Pattern", "gcLogFilesPattern", "=", "Pattern", ".", "compile", "(", "regex", ")", ";", "File", "parentDirectory", "=", "gcLogFile", ".", "getParentFile", "(", ")", ";", "if", "(", "parentDirectory", "==", "null", "||", "!", "parentDirectory", ".", "exists", "(", ")", ")", "{", "LOGGER", ".", "warning", "(", "\"[Support Bundle] \"", "+", "parentDirectory", "+", "\" does not exist, cannot collect gc logging files.\"", ")", ";", "return", ";", "}", "File", "[", "]", "gcLogs", "=", "parentDirectory", ".", "listFiles", "(", "new", "FilenameFilter", "(", ")", "{", "@", "Override", "public", "boolean", "accept", "(", "File", "dir", ",", "String", "name", ")", "{", "return", "gcLogFilesPattern", ".", "matcher", "(", "name", ")", ".", "matches", "(", ")", ";", "}", "}", ")", ";", "if", "(", "gcLogs", "==", "null", "||", "gcLogs", ".", "length", "==", "0", ")", "{", "LOGGER", ".", "warning", "(", "\"No GC logging files found, although the VM argument was found. This is probably a bug.\"", ")", ";", "return", ";", "}", "LOGGER", ".", "finest", "(", "\"Found \"", "+", "gcLogs", ".", "length", "+", "\" matching files in \"", "+", "parentDirectory", ".", "getAbsolutePath", "(", ")", ")", ";", "for", "(", "File", "gcLog", ":", "gcLogs", ")", "{", "LOGGER", ".", "finest", "(", "\"Adding '\"", "+", "gcLog", ".", "getName", "(", ")", "+", "\"' file\"", ")", ";", "result", ".", "add", "(", "new", "FileContent", "(", "GCLOGS_BUNDLE_ROOT", "+", "\"{0}\"", ",", "new", "String", "[", "]", "{", "gcLog", ".", "getName", "(", ")", "}", ",", "gcLog", ")", ")", ";", "}", "}" ]
Two cases: <ul> <li>The file name contains <code>%t</code> or <code>%p</code> somewhere in the middle: then we are simply going to replace those by <code>.*</code> to find associated logs and match files by regex. This will match GC logs from the current JVM execution, or possibly previous ones.</li> <li>or that feature is not used, then we simply match by "starts with"</li> </ul> @param gcLogFileLocation the specified value after <code>-Xloggc:</code> @param result the container where to add the found logs, if any. @see https://bugs.openjdk.java.net/browse/JDK-7164841
[ "Two", "cases", ":", "<ul", ">", "<li", ">", "The", "file", "name", "contains", "<code", ">", "%t<", "/", "code", ">", "or", "<code", ">", "%p<", "/", "code", ">", "somewhere", "in", "the", "middle", ":", "then", "we", "are", "simply", "going", "to", "replace", "those", "by", "<code", ">", ".", "*", "<", "/", "code", ">", "to", "find", "associated", "logs", "and", "match", "files", "by", "regex", ".", "This", "will", "match", "GC", "logs", "from", "the", "current", "JVM", "execution", "or", "possibly", "previous", "ones", ".", "<", "/", "li", ">", "<li", ">", "or", "that", "feature", "is", "not", "used", "then", "we", "simply", "match", "by", "starts", "with", "<", "/", "li", ">", "<", "/", "ul", ">" ]
train
https://github.com/jenkinsci/support-core-plugin/blob/bcbe1dfd5bf48ac89903645cd48ed897c1a04688/src/main/java/com/cloudbees/jenkins/support/impl/GCLogs.java#L108-L138
google/Accessibility-Test-Framework-for-Android
src/main/java/com/googlecode/eyesfree/utils/ScreenshotUtils.java
ScreenshotUtils.cropBitmap
public static Bitmap cropBitmap(Bitmap sourceBitmap, Rect bounds) { """ Creates a new {@link Bitmap} object with a rectangular region of pixels from the source bitmap. <p> The source bitmap is unaffected by this operation. @param sourceBitmap The source bitmap to crop. @param bounds The rectangular bounds to keep when cropping. @return A new bitmap of the cropped area, or {@code null} if the source was {@code null} or the crop parameters were out of bounds. """ if ((bounds == null) || bounds.isEmpty()) { return null; } return cropBitmap(sourceBitmap, bounds.left, bounds.top, bounds.width(), bounds.height()); }
java
public static Bitmap cropBitmap(Bitmap sourceBitmap, Rect bounds) { if ((bounds == null) || bounds.isEmpty()) { return null; } return cropBitmap(sourceBitmap, bounds.left, bounds.top, bounds.width(), bounds.height()); }
[ "public", "static", "Bitmap", "cropBitmap", "(", "Bitmap", "sourceBitmap", ",", "Rect", "bounds", ")", "{", "if", "(", "(", "bounds", "==", "null", ")", "||", "bounds", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "return", "cropBitmap", "(", "sourceBitmap", ",", "bounds", ".", "left", ",", "bounds", ".", "top", ",", "bounds", ".", "width", "(", ")", ",", "bounds", ".", "height", "(", ")", ")", ";", "}" ]
Creates a new {@link Bitmap} object with a rectangular region of pixels from the source bitmap. <p> The source bitmap is unaffected by this operation. @param sourceBitmap The source bitmap to crop. @param bounds The rectangular bounds to keep when cropping. @return A new bitmap of the cropped area, or {@code null} if the source was {@code null} or the crop parameters were out of bounds.
[ "Creates", "a", "new", "{", "@link", "Bitmap", "}", "object", "with", "a", "rectangular", "region", "of", "pixels", "from", "the", "source", "bitmap", ".", "<p", ">", "The", "source", "bitmap", "is", "unaffected", "by", "this", "operation", "." ]
train
https://github.com/google/Accessibility-Test-Framework-for-Android/blob/a6117fe0059c82dd764fa628d3817d724570f69e/src/main/java/com/googlecode/eyesfree/utils/ScreenshotUtils.java#L130-L136