repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
JakeWharton/ActionBarSherlock
actionbarsherlock/src/com/actionbarsherlock/internal/view/menu/ActionMenuPresenter.java
ActionMenuPresenter.showOverflowMenu
public boolean showOverflowMenu() { if (mReserveOverflow && !isOverflowMenuShowing() && mMenu != null && mMenuView != null && mPostedOpenRunnable == null && !mMenu.getNonActionItems().isEmpty()) { OverflowPopup popup = new OverflowPopup(mContext, mMenu, mOverflowButton, true); mPostedOpenRunnable = new OpenOverflowRunnable(popup); // Post this for later; we might still need a layout for the anchor to be right. ((View) mMenuView).post(mPostedOpenRunnable); // ActionMenuPresenter uses null as a callback argument here // to indicate overflow is opening. super.onSubMenuSelected(null); return true; } return false; }
java
public boolean showOverflowMenu() { if (mReserveOverflow && !isOverflowMenuShowing() && mMenu != null && mMenuView != null && mPostedOpenRunnable == null && !mMenu.getNonActionItems().isEmpty()) { OverflowPopup popup = new OverflowPopup(mContext, mMenu, mOverflowButton, true); mPostedOpenRunnable = new OpenOverflowRunnable(popup); // Post this for later; we might still need a layout for the anchor to be right. ((View) mMenuView).post(mPostedOpenRunnable); // ActionMenuPresenter uses null as a callback argument here // to indicate overflow is opening. super.onSubMenuSelected(null); return true; } return false; }
[ "public", "boolean", "showOverflowMenu", "(", ")", "{", "if", "(", "mReserveOverflow", "&&", "!", "isOverflowMenuShowing", "(", ")", "&&", "mMenu", "!=", "null", "&&", "mMenuView", "!=", "null", "&&", "mPostedOpenRunnable", "==", "null", "&&", "!", "mMenu", ...
Display the overflow menu if one is present. @return true if the overflow menu was shown, false otherwise.
[ "Display", "the", "overflow", "menu", "if", "one", "is", "present", "." ]
train
https://github.com/JakeWharton/ActionBarSherlock/blob/2c71339e756bcc0b1424c4525680549ba3a2dc97/actionbarsherlock/src/com/actionbarsherlock/internal/view/menu/ActionMenuPresenter.java#L297-L312
Impetus/Kundera
src/kundera-oracle-nosql/src/main/java/com/impetus/client/oraclenosql/OracleNoSQLClient.java
OracleNoSQLClient.populateId
private void populateId(EntityMetadata entityMetadata, Table schemaTable, Object entity, Row row) { FieldDef fieldMetadata; FieldValue value; String idColumnName = ((AbstractAttribute) entityMetadata.getIdAttribute()).getJPAColumnName(); fieldMetadata = schemaTable.getField(idColumnName); value = row.get(idColumnName); NoSqlDBUtils.get(fieldMetadata, value, entity, (Field) entityMetadata.getIdAttribute().getJavaMember()); }
java
private void populateId(EntityMetadata entityMetadata, Table schemaTable, Object entity, Row row) { FieldDef fieldMetadata; FieldValue value; String idColumnName = ((AbstractAttribute) entityMetadata.getIdAttribute()).getJPAColumnName(); fieldMetadata = schemaTable.getField(idColumnName); value = row.get(idColumnName); NoSqlDBUtils.get(fieldMetadata, value, entity, (Field) entityMetadata.getIdAttribute().getJavaMember()); }
[ "private", "void", "populateId", "(", "EntityMetadata", "entityMetadata", ",", "Table", "schemaTable", ",", "Object", "entity", ",", "Row", "row", ")", "{", "FieldDef", "fieldMetadata", ";", "FieldValue", "value", ";", "String", "idColumnName", "=", "(", "(", ...
Populate id. @param entityMetadata the entity metadata @param schemaTable the schema table @param entity the entity @param row the row
[ "Populate", "id", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-oracle-nosql/src/main/java/com/impetus/client/oraclenosql/OracleNoSQLClient.java#L1197-L1208
Alluxio/alluxio
core/common/src/main/java/alluxio/util/ModeUtils.java
ModeUtils.applyUMask
private static Mode applyUMask(Mode mode, Mode umask) { mode.setOwnerBits(mode.getOwnerBits().and(umask.getOwnerBits().not())); mode.setGroupBits(mode.getGroupBits().and(umask.getGroupBits().not())); mode.setOtherBits(mode.getOtherBits().and(umask.getOtherBits().not())); return mode; }
java
private static Mode applyUMask(Mode mode, Mode umask) { mode.setOwnerBits(mode.getOwnerBits().and(umask.getOwnerBits().not())); mode.setGroupBits(mode.getGroupBits().and(umask.getGroupBits().not())); mode.setOtherBits(mode.getOtherBits().and(umask.getOtherBits().not())); return mode; }
[ "private", "static", "Mode", "applyUMask", "(", "Mode", "mode", ",", "Mode", "umask", ")", "{", "mode", ".", "setOwnerBits", "(", "mode", ".", "getOwnerBits", "(", ")", ".", "and", "(", "umask", ".", "getOwnerBits", "(", ")", ".", "not", "(", ")", ")...
Applies the given umask {@link Mode} to this mode. @param mode the mode to update @param umask the umask to apply @return the updated object
[ "Applies", "the", "given", "umask", "{", "@link", "Mode", "}", "to", "this", "mode", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/ModeUtils.java#L73-L78
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java
BasePanel.displayError
public void displayError(String strError, int iWarningLevel) { if ((strError == null) || (strError.length() == 0)) return; // No error Task task = this.getTask(); if (task != null) task.setStatusText(strError, iWarningLevel); }
java
public void displayError(String strError, int iWarningLevel) { if ((strError == null) || (strError.length() == 0)) return; // No error Task task = this.getTask(); if (task != null) task.setStatusText(strError, iWarningLevel); }
[ "public", "void", "displayError", "(", "String", "strError", ",", "int", "iWarningLevel", ")", "{", "if", "(", "(", "strError", "==", "null", ")", "||", "(", "strError", ".", "length", "(", ")", "==", "0", ")", ")", "return", ";", "// No error", "Task"...
Display a dialog/status box with this error. @param strError The error text. @param The level of the error (debug/warning/error/etc).
[ "Display", "a", "dialog", "/", "status", "box", "with", "this", "error", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java#L370-L377
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPAddressesInner.java
PublicIPAddressesInner.listVirtualMachineScaleSetPublicIPAddressesWithServiceResponseAsync
public Observable<ServiceResponse<Page<PublicIPAddressInner>>> listVirtualMachineScaleSetPublicIPAddressesWithServiceResponseAsync(final String resourceGroupName, final String virtualMachineScaleSetName) { return listVirtualMachineScaleSetPublicIPAddressesSinglePageAsync(resourceGroupName, virtualMachineScaleSetName) .concatMap(new Func1<ServiceResponse<Page<PublicIPAddressInner>>, Observable<ServiceResponse<Page<PublicIPAddressInner>>>>() { @Override public Observable<ServiceResponse<Page<PublicIPAddressInner>>> call(ServiceResponse<Page<PublicIPAddressInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listVirtualMachineScaleSetPublicIPAddressesNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<PublicIPAddressInner>>> listVirtualMachineScaleSetPublicIPAddressesWithServiceResponseAsync(final String resourceGroupName, final String virtualMachineScaleSetName) { return listVirtualMachineScaleSetPublicIPAddressesSinglePageAsync(resourceGroupName, virtualMachineScaleSetName) .concatMap(new Func1<ServiceResponse<Page<PublicIPAddressInner>>, Observable<ServiceResponse<Page<PublicIPAddressInner>>>>() { @Override public Observable<ServiceResponse<Page<PublicIPAddressInner>>> call(ServiceResponse<Page<PublicIPAddressInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listVirtualMachineScaleSetPublicIPAddressesNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "PublicIPAddressInner", ">", ">", ">", "listVirtualMachineScaleSetPublicIPAddressesWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "virtualMachineScaleSetName", "...
Gets information about all public IP addresses on a virtual machine scale set level. @param resourceGroupName The name of the resource group. @param virtualMachineScaleSetName The name of the virtual machine scale set. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;PublicIPAddressInner&gt; object
[ "Gets", "information", "about", "all", "public", "IP", "addresses", "on", "a", "virtual", "machine", "scale", "set", "level", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPAddressesInner.java#L1220-L1232
finmath/finmath-lib
src/main/java/net/finmath/fouriermethod/products/smile/EuropeanOptionSmile.java
EuropeanOptionSmile.getDescriptors
public Map<Double, SingleAssetEuropeanOptionProductDescriptor> getDescriptors(LocalDate referenceDate){ int numberOfStrikes = strikes.length; HashMap<Double, SingleAssetEuropeanOptionProductDescriptor> descriptors = new HashMap<Double, SingleAssetEuropeanOptionProductDescriptor>(); LocalDate maturityDate = FloatingpointDate.getDateFromFloatingPointDate(referenceDate, maturity); for(int i = 0; i< numberOfStrikes; i++) { descriptors.put(strikes[i], new SingleAssetEuropeanOptionProductDescriptor(underlyingName, maturityDate, strikes[i])); } return descriptors; }
java
public Map<Double, SingleAssetEuropeanOptionProductDescriptor> getDescriptors(LocalDate referenceDate){ int numberOfStrikes = strikes.length; HashMap<Double, SingleAssetEuropeanOptionProductDescriptor> descriptors = new HashMap<Double, SingleAssetEuropeanOptionProductDescriptor>(); LocalDate maturityDate = FloatingpointDate.getDateFromFloatingPointDate(referenceDate, maturity); for(int i = 0; i< numberOfStrikes; i++) { descriptors.put(strikes[i], new SingleAssetEuropeanOptionProductDescriptor(underlyingName, maturityDate, strikes[i])); } return descriptors; }
[ "public", "Map", "<", "Double", ",", "SingleAssetEuropeanOptionProductDescriptor", ">", "getDescriptors", "(", "LocalDate", "referenceDate", ")", "{", "int", "numberOfStrikes", "=", "strikes", ".", "length", ";", "HashMap", "<", "Double", ",", "SingleAssetEuropeanOpti...
Return a collection of product descriptors for each option in the smile. @param referenceDate The reference date (translating the maturity floating point date to dates. @return a collection of product descriptors for each option in the smile.
[ "Return", "a", "collection", "of", "product", "descriptors", "for", "each", "option", "in", "the", "smile", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/fouriermethod/products/smile/EuropeanOptionSmile.java#L88-L99
p6spy/p6spy
src/main/java/com/p6spy/engine/common/ConnectionInformation.java
ConnectionInformation.fromDriver
public static ConnectionInformation fromDriver(Driver driver, Connection connection, long timeToGetConnectionNs) { final ConnectionInformation connectionInformation = new ConnectionInformation(); connectionInformation.driver = driver; connectionInformation.connection = connection; connectionInformation.timeToGetConnectionNs = timeToGetConnectionNs; return connectionInformation; }
java
public static ConnectionInformation fromDriver(Driver driver, Connection connection, long timeToGetConnectionNs) { final ConnectionInformation connectionInformation = new ConnectionInformation(); connectionInformation.driver = driver; connectionInformation.connection = connection; connectionInformation.timeToGetConnectionNs = timeToGetConnectionNs; return connectionInformation; }
[ "public", "static", "ConnectionInformation", "fromDriver", "(", "Driver", "driver", ",", "Connection", "connection", ",", "long", "timeToGetConnectionNs", ")", "{", "final", "ConnectionInformation", "connectionInformation", "=", "new", "ConnectionInformation", "(", ")", ...
Creates a new {@link ConnectionInformation} instance for a {@link Connection} which has been obtained via a {@link Driver} @param driver the {@link Driver} which created the {@link #connection} @param connection the {@link #connection} created by the {@link #driver} @param timeToGetConnectionNs the time it took to obtain the connection in nanoseconds @return a new {@link ConnectionInformation} instance
[ "Creates", "a", "new", "{", "@link", "ConnectionInformation", "}", "instance", "for", "a", "{", "@link", "Connection", "}", "which", "has", "been", "obtained", "via", "a", "{", "@link", "Driver", "}" ]
train
https://github.com/p6spy/p6spy/blob/c3c0fecd6e26156eecf90a90901c3c1c8a7dbdf2/src/main/java/com/p6spy/engine/common/ConnectionInformation.java#L55-L61
comapi/comapi-sdk-android
COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java
InternalService.updateConversation
public Observable<ComapiResult<ConversationDetails>> updateConversation(@NonNull final String conversationId, @NonNull final ConversationUpdate request, @Nullable final String eTag) { final String token = getToken(); if (sessionController.isCreatingSession()) { return getTaskQueue().queueUpdateConversation(conversationId, request, eTag); } else if (TextUtils.isEmpty(token)) { return Observable.error(getSessionStateErrorDescription()); } else { return doUpdateConversation(token, conversationId, request, eTag); } }
java
public Observable<ComapiResult<ConversationDetails>> updateConversation(@NonNull final String conversationId, @NonNull final ConversationUpdate request, @Nullable final String eTag) { final String token = getToken(); if (sessionController.isCreatingSession()) { return getTaskQueue().queueUpdateConversation(conversationId, request, eTag); } else if (TextUtils.isEmpty(token)) { return Observable.error(getSessionStateErrorDescription()); } else { return doUpdateConversation(token, conversationId, request, eTag); } }
[ "public", "Observable", "<", "ComapiResult", "<", "ConversationDetails", ">", ">", "updateConversation", "(", "@", "NonNull", "final", "String", "conversationId", ",", "@", "NonNull", "final", "ConversationUpdate", "request", ",", "@", "Nullable", "final", "String",...
Returns observable to update a conversation. @param conversationId ID of a conversation to update. @param request Request with conversation details to update. @param eTag Tag to specify local data version. @return Observable to update a conversation.
[ "Returns", "observable", "to", "update", "a", "conversation", "." ]
train
https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L574-L585
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/CommandGroup.java
CommandGroup.createButtonBar
public JComponent createButtonBar(final Size minimumButtonSize, final Border border) { return createButtonBar(minimumButtonSize == null ? null : new ColumnSpec(minimumButtonSize), null, border); }
java
public JComponent createButtonBar(final Size minimumButtonSize, final Border border) { return createButtonBar(minimumButtonSize == null ? null : new ColumnSpec(minimumButtonSize), null, border); }
[ "public", "JComponent", "createButtonBar", "(", "final", "Size", "minimumButtonSize", ",", "final", "Border", "border", ")", "{", "return", "createButtonBar", "(", "minimumButtonSize", "==", "null", "?", "null", ":", "new", "ColumnSpec", "(", "minimumButtonSize", ...
Create a button bar with buttons for all the commands in this. @param minimumButtonSize if null, then there is no minimum size @param border if null, then don't use a border @return never null
[ "Create", "a", "button", "bar", "with", "buttons", "for", "all", "the", "commands", "in", "this", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/CommandGroup.java#L458-L460
impossibl/stencil
engine/src/main/java/com/impossibl/stencil/engine/internal/StencilOperands.java
StencilOperands.isFloatingPointType
protected boolean isFloatingPointType(Object left, Object right) { return left instanceof Float || left instanceof Double || right instanceof Float || right instanceof Double; }
java
protected boolean isFloatingPointType(Object left, Object right) { return left instanceof Float || left instanceof Double || right instanceof Float || right instanceof Double; }
[ "protected", "boolean", "isFloatingPointType", "(", "Object", "left", ",", "Object", "right", ")", "{", "return", "left", "instanceof", "Float", "||", "left", "instanceof", "Double", "||", "right", "instanceof", "Float", "||", "right", "instanceof", "Double", ";...
Test if either left or right are either a Float or Double. @param left one object to test @param right the other @return the result of the test.
[ "Test", "if", "either", "left", "or", "right", "are", "either", "a", "Float", "or", "Double", "." ]
train
https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/engine/internal/StencilOperands.java#L119-L121
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/tools/manipulator/AtomContainerManipulator.java
AtomContainerManipulator.getTotalNaturalAbundance
public static double getTotalNaturalAbundance(IAtomContainer atomContainer) { try { Isotopes isotopes = Isotopes.getInstance(); double abundance = 1.0; double hAbundance = isotopes.getMajorIsotope(1).getNaturalAbundance(); int nImplH = 0; for (IAtom atom : atomContainer.atoms()) { if (atom.getImplicitHydrogenCount() == null) throw new IllegalArgumentException("an atom had with unknown (null) implicit hydrogens"); abundance *= atom.getNaturalAbundance(); for (int h = 0; h < atom.getImplicitHydrogenCount(); h++) abundance *= hAbundance; nImplH += atom.getImplicitHydrogenCount(); } return abundance / Math.pow(100, nImplH + atomContainer.getAtomCount()); } catch (IOException e) { throw new RuntimeException("Isotopes definitions could not be loaded", e); } }
java
public static double getTotalNaturalAbundance(IAtomContainer atomContainer) { try { Isotopes isotopes = Isotopes.getInstance(); double abundance = 1.0; double hAbundance = isotopes.getMajorIsotope(1).getNaturalAbundance(); int nImplH = 0; for (IAtom atom : atomContainer.atoms()) { if (atom.getImplicitHydrogenCount() == null) throw new IllegalArgumentException("an atom had with unknown (null) implicit hydrogens"); abundance *= atom.getNaturalAbundance(); for (int h = 0; h < atom.getImplicitHydrogenCount(); h++) abundance *= hAbundance; nImplH += atom.getImplicitHydrogenCount(); } return abundance / Math.pow(100, nImplH + atomContainer.getAtomCount()); } catch (IOException e) { throw new RuntimeException("Isotopes definitions could not be loaded", e); } }
[ "public", "static", "double", "getTotalNaturalAbundance", "(", "IAtomContainer", "atomContainer", ")", "{", "try", "{", "Isotopes", "isotopes", "=", "Isotopes", ".", "getInstance", "(", ")", ";", "double", "abundance", "=", "1.0", ";", "double", "hAbundance", "=...
Get the summed natural abundance of all atoms in an AtomContainer @param atomContainer The IAtomContainer to manipulate @return The summed natural abundance of all atoms in this AtomContainer.
[ "Get", "the", "summed", "natural", "abundance", "of", "all", "atoms", "in", "an", "AtomContainer" ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/tools/manipulator/AtomContainerManipulator.java#L459-L479
groupon/monsoon
history/src/main/java/com/groupon/lex/metrics/history/xdr/support/FileUtil.java
FileUtil.createTempFile
public static FileChannel createTempFile(Path dir, String prefix, String suffix) throws IOException { return createNewFileImpl(dir, prefix, suffix, new OpenOption[]{READ, WRITE, CREATE_NEW, DELETE_ON_CLOSE}).getFileChannel(); }
java
public static FileChannel createTempFile(Path dir, String prefix, String suffix) throws IOException { return createNewFileImpl(dir, prefix, suffix, new OpenOption[]{READ, WRITE, CREATE_NEW, DELETE_ON_CLOSE}).getFileChannel(); }
[ "public", "static", "FileChannel", "createTempFile", "(", "Path", "dir", ",", "String", "prefix", ",", "String", "suffix", ")", "throws", "IOException", "{", "return", "createNewFileImpl", "(", "dir", ",", "prefix", ",", "suffix", ",", "new", "OpenOption", "["...
Create a temporary file that will be removed when it is closed.
[ "Create", "a", "temporary", "file", "that", "will", "be", "removed", "when", "it", "is", "closed", "." ]
train
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/history/src/main/java/com/groupon/lex/metrics/history/xdr/support/FileUtil.java#L58-L60
aws/aws-sdk-java
aws-java-sdk-cognitoidentity/src/main/java/com/amazonaws/services/cognitoidentity/model/GetIdentityPoolRolesResult.java
GetIdentityPoolRolesResult.withRoleMappings
public GetIdentityPoolRolesResult withRoleMappings(java.util.Map<String, RoleMapping> roleMappings) { setRoleMappings(roleMappings); return this; }
java
public GetIdentityPoolRolesResult withRoleMappings(java.util.Map<String, RoleMapping> roleMappings) { setRoleMappings(roleMappings); return this; }
[ "public", "GetIdentityPoolRolesResult", "withRoleMappings", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "RoleMapping", ">", "roleMappings", ")", "{", "setRoleMappings", "(", "roleMappings", ")", ";", "return", "this", ";", "}" ]
<p> How users for a specific identity provider are to mapped to roles. This is a String-to-<a>RoleMapping</a> object map. The string identifies the identity provider, for example, "graph.facebook.com" or "cognito-idp.us-east-1.amazonaws.com/us-east-1_abcdefghi:app_client_id". </p> @param roleMappings How users for a specific identity provider are to mapped to roles. This is a String-to-<a>RoleMapping</a> object map. The string identifies the identity provider, for example, "graph.facebook.com" or "cognito-idp.us-east-1.amazonaws.com/us-east-1_abcdefghi:app_client_id". @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "How", "users", "for", "a", "specific", "identity", "provider", "are", "to", "mapped", "to", "roles", ".", "This", "is", "a", "String", "-", "to", "-", "<a", ">", "RoleMapping<", "/", "a", ">", "object", "map", ".", "The", "string", "ident...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cognitoidentity/src/main/java/com/amazonaws/services/cognitoidentity/model/GetIdentityPoolRolesResult.java#L201-L204
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/mps/syslog_generic.java
syslog_generic.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { syslog_generic_responses result = (syslog_generic_responses) service.get_payload_formatter().string_to_resource(syslog_generic_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.syslog_generic_response_array); } syslog_generic[] result_syslog_generic = new syslog_generic[result.syslog_generic_response_array.length]; for(int i = 0; i < result.syslog_generic_response_array.length; i++) { result_syslog_generic[i] = result.syslog_generic_response_array[i].syslog_generic[0]; } return result_syslog_generic; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { syslog_generic_responses result = (syslog_generic_responses) service.get_payload_formatter().string_to_resource(syslog_generic_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.syslog_generic_response_array); } syslog_generic[] result_syslog_generic = new syslog_generic[result.syslog_generic_response_array.length]; for(int i = 0; i < result.syslog_generic_response_array.length; i++) { result_syslog_generic[i] = result.syslog_generic_response_array[i].syslog_generic[0]; } return result_syslog_generic; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "syslog_generic_responses", "result", "=", "(", "syslog_generic_responses", ")", "service", ".", "get_payload_...
<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/mps/syslog_generic.java#L478-L495
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/expressions/Expressions.java
Expressions.isLessThan
public static BooleanIsLessThan isLessThan(BooleanExpression left, Object constant) { if (!(constant instanceof Boolean)) throw new IllegalArgumentException("constant is not a Boolean"); return new BooleanIsLessThan(left, constant((Boolean)constant)); }
java
public static BooleanIsLessThan isLessThan(BooleanExpression left, Object constant) { if (!(constant instanceof Boolean)) throw new IllegalArgumentException("constant is not a Boolean"); return new BooleanIsLessThan(left, constant((Boolean)constant)); }
[ "public", "static", "BooleanIsLessThan", "isLessThan", "(", "BooleanExpression", "left", ",", "Object", "constant", ")", "{", "if", "(", "!", "(", "constant", "instanceof", "Boolean", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"constant is not a Bo...
Creates an BooleanIsLessThan expression from the given expression and constant. @param left The left expression. @param constant The constant to compare to (must be a Number). @throws IllegalArgumentException If the constant is not a Number @return A new is less than binary expression.
[ "Creates", "an", "BooleanIsLessThan", "expression", "from", "the", "given", "expression", "and", "constant", "." ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/expressions/Expressions.java#L362-L368
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/util/LazyInitializedCacheMap.java
LazyInitializedCacheMap.putIfAbsent
public V putIfAbsent(K key, LazyInitializer<V> value) { LazyInitializer<V> v = cache.get(key); if (v == null) { v = cache.putIfAbsent(key, value); if (v == null) { return value.get(); } } return v.get(); }
java
public V putIfAbsent(K key, LazyInitializer<V> value) { LazyInitializer<V> v = cache.get(key); if (v == null) { v = cache.putIfAbsent(key, value); if (v == null) { return value.get(); } } return v.get(); }
[ "public", "V", "putIfAbsent", "(", "K", "key", ",", "LazyInitializer", "<", "V", ">", "value", ")", "{", "LazyInitializer", "<", "V", ">", "v", "=", "cache", ".", "get", "(", "key", ")", ";", "if", "(", "v", "==", "null", ")", "{", "v", "=", "c...
If the specified key is not already associated with a value, associate it with the given value. This is equivalent to <pre> if (!map.containsKey(key)) return map.put(key, value); else return map.get(key);</pre> except that the action is performed atomically. @param key key with which the specified value is to be associated @param value a lazy initialized value object. @return the previous value associated with the specified key, or <tt>null</tt> if there was no mapping for the key @throws NullPointerException if the specified key or value is null
[ "If", "the", "specified", "key", "is", "not", "already", "associated", "with", "a", "value", "associate", "it", "with", "the", "given", "value", ".", "This", "is", "equivalent", "to", "<pre", ">", "if", "(", "!map", ".", "containsKey", "(", "key", "))", ...
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/util/LazyInitializedCacheMap.java#L116-L126
datumbox/datumbox-framework
datumbox-framework-common/src/main/java/com/datumbox/framework/common/dataobjects/AssociativeArray2D.java
AssociativeArray2D.put
public final AssociativeArray put(Object key, AssociativeArray value) { return internalData.put(key, value); }
java
public final AssociativeArray put(Object key, AssociativeArray value) { return internalData.put(key, value); }
[ "public", "final", "AssociativeArray", "put", "(", "Object", "key", ",", "AssociativeArray", "value", ")", "{", "return", "internalData", ".", "put", "(", "key", ",", "value", ")", ";", "}" ]
Adds a particular key-value into the internal map. It returns the previous value which was associated with that key. @param key @param value @return
[ "Adds", "a", "particular", "key", "-", "value", "into", "the", "internal", "map", ".", "It", "returns", "the", "previous", "value", "which", "was", "associated", "with", "that", "key", "." ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-common/src/main/java/com/datumbox/framework/common/dataobjects/AssociativeArray2D.java#L89-L91
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/Certificate.java
Certificate.writeReplace
protected Object writeReplace() throws java.io.ObjectStreamException { try { return new CertificateRep(type, getEncoded()); } catch (CertificateException e) { throw new java.io.NotSerializableException ("java.security.cert.Certificate: " + type + ": " + e.getMessage()); } }
java
protected Object writeReplace() throws java.io.ObjectStreamException { try { return new CertificateRep(type, getEncoded()); } catch (CertificateException e) { throw new java.io.NotSerializableException ("java.security.cert.Certificate: " + type + ": " + e.getMessage()); } }
[ "protected", "Object", "writeReplace", "(", ")", "throws", "java", ".", "io", ".", "ObjectStreamException", "{", "try", "{", "return", "new", "CertificateRep", "(", "type", ",", "getEncoded", "(", ")", ")", ";", "}", "catch", "(", "CertificateException", "e"...
Replace the Certificate to be serialized. @return the alternate Certificate object to be serialized @throws java.io.ObjectStreamException if a new object representing this Certificate could not be created @since 1.3
[ "Replace", "the", "Certificate", "to", "be", "serialized", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/Certificate.java#L296-L306
EdwardRaff/JSAT
JSAT/src/jsat/math/optimization/NelderMead.java
NelderMead.setContraction
public void setContraction(double contraction) { if(contraction >= 1 || contraction <= 0 || Double.isNaN(contraction) || Double.isInfinite(contraction) ) throw new ArithmeticException("Contraction constant must be > 0 and < 1, not " + contraction); this.contraction = contraction; }
java
public void setContraction(double contraction) { if(contraction >= 1 || contraction <= 0 || Double.isNaN(contraction) || Double.isInfinite(contraction) ) throw new ArithmeticException("Contraction constant must be > 0 and < 1, not " + contraction); this.contraction = contraction; }
[ "public", "void", "setContraction", "(", "double", "contraction", ")", "{", "if", "(", "contraction", ">=", "1", "||", "contraction", "<=", "0", "||", "Double", ".", "isNaN", "(", "contraction", ")", "||", "Double", ".", "isInfinite", "(", "contraction", "...
Sets the contraction constant, which must be in the range (0, 1) @param contraction the contraction constant
[ "Sets", "the", "contraction", "constant", "which", "must", "be", "in", "the", "range", "(", "0", "1", ")" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/optimization/NelderMead.java#L85-L90
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/collections/sort/RedBlackTreeLong.java
RedBlackTreeLong.removeInstance
@Override public void removeInstance(long key, T instance) { if (first.value == key && instance == first.element) { removeMin(); return; } if (last.value == key && instance == last.element) { removeMax(); return; } // if both children of root are black, set root to red if ((root.left == null || !root.left.red) && (root.right == null || !root.right.red)) root.red = true; root = removeInstance(root, key, instance); if (root != null) root.red = false; }
java
@Override public void removeInstance(long key, T instance) { if (first.value == key && instance == first.element) { removeMin(); return; } if (last.value == key && instance == last.element) { removeMax(); return; } // if both children of root are black, set root to red if ((root.left == null || !root.left.red) && (root.right == null || !root.right.red)) root.red = true; root = removeInstance(root, key, instance); if (root != null) root.red = false; }
[ "@", "Override", "public", "void", "removeInstance", "(", "long", "key", ",", "T", "instance", ")", "{", "if", "(", "first", ".", "value", "==", "key", "&&", "instance", "==", "first", ".", "element", ")", "{", "removeMin", "(", ")", ";", "return", "...
Remove the node containing the given key and element. The node MUST exists, else the tree won't be valid anymore.
[ "Remove", "the", "node", "containing", "the", "given", "key", "and", "element", ".", "The", "node", "MUST", "exists", "else", "the", "tree", "won", "t", "be", "valid", "anymore", "." ]
train
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/collections/sort/RedBlackTreeLong.java#L572-L589
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java
BigtableDataClient.create
public static BigtableDataClient create(String projectId, String instanceId) throws IOException { BigtableDataSettings settings = BigtableDataSettings.newBuilder().setProjectId(projectId).setInstanceId(instanceId).build(); return create(settings); }
java
public static BigtableDataClient create(String projectId, String instanceId) throws IOException { BigtableDataSettings settings = BigtableDataSettings.newBuilder().setProjectId(projectId).setInstanceId(instanceId).build(); return create(settings); }
[ "public", "static", "BigtableDataClient", "create", "(", "String", "projectId", ",", "String", "instanceId", ")", "throws", "IOException", "{", "BigtableDataSettings", "settings", "=", "BigtableDataSettings", ".", "newBuilder", "(", ")", ".", "setProjectId", "(", "p...
Constructs an instance of BigtableDataClient with default settings. @param projectId The project id of the instance to connect to. @param instanceId The id of the instance to connect to. @return A new client. @throws IOException If any.
[ "Constructs", "an", "instance", "of", "BigtableDataClient", "with", "default", "settings", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java#L123-L127
Netflix/eureka
eureka-client/src/main/java/com/netflix/appinfo/InstanceInfo.java
InstanceInfo.getZone
public static String getZone(String[] availZones, InstanceInfo myInfo) { String instanceZone = ((availZones == null || availZones.length == 0) ? "default" : availZones[0]); if (myInfo != null && myInfo.getDataCenterInfo().getName() == DataCenterInfo.Name.Amazon) { String awsInstanceZone = ((AmazonInfo) myInfo.getDataCenterInfo()) .get(AmazonInfo.MetaDataKey.availabilityZone); if (awsInstanceZone != null) { instanceZone = awsInstanceZone; } } return instanceZone; }
java
public static String getZone(String[] availZones, InstanceInfo myInfo) { String instanceZone = ((availZones == null || availZones.length == 0) ? "default" : availZones[0]); if (myInfo != null && myInfo.getDataCenterInfo().getName() == DataCenterInfo.Name.Amazon) { String awsInstanceZone = ((AmazonInfo) myInfo.getDataCenterInfo()) .get(AmazonInfo.MetaDataKey.availabilityZone); if (awsInstanceZone != null) { instanceZone = awsInstanceZone; } } return instanceZone; }
[ "public", "static", "String", "getZone", "(", "String", "[", "]", "availZones", ",", "InstanceInfo", "myInfo", ")", "{", "String", "instanceZone", "=", "(", "(", "availZones", "==", "null", "||", "availZones", ".", "length", "==", "0", ")", "?", "\"default...
Get the zone that a particular instance is in. Note that for AWS deployments, myInfo should contain AWS dataCenterInfo which should contain the AWS zone of the instance, and availZones is ignored. @param availZones the list of available zones for non-AWS deployments @param myInfo - The InstanceInfo object of the instance. @return - The zone in which the particular instance belongs to.
[ "Get", "the", "zone", "that", "a", "particular", "instance", "is", "in", ".", "Note", "that", "for", "AWS", "deployments", "myInfo", "should", "contain", "AWS", "dataCenterInfo", "which", "should", "contain", "the", "AWS", "zone", "of", "the", "instance", "a...
train
https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-client/src/main/java/com/netflix/appinfo/InstanceInfo.java#L1372-L1386
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ClassUtils.java
ClassUtils.getValueFromMapForClass
public static Object getValueFromMapForClass(final Class typeClass, final Map classMap) { Object val = classMap.get(typeClass); if (val == null) { // search through the interfaces first val = getValueFromMapForInterfaces(typeClass, classMap); if (val == null) { // now go up through the inheritance hierarchy val = getValueFromMapForSuperClass(typeClass, classMap); } if (val == null) { // not found anywhere if (logger.isDebugEnabled()) { logger.debug("Could not find a definition for " + typeClass + " in " + classMap.keySet()); } return null; } // remember this so it doesn't have to be looked-up again classMap.put(typeClass, val); return val; } return val; }
java
public static Object getValueFromMapForClass(final Class typeClass, final Map classMap) { Object val = classMap.get(typeClass); if (val == null) { // search through the interfaces first val = getValueFromMapForInterfaces(typeClass, classMap); if (val == null) { // now go up through the inheritance hierarchy val = getValueFromMapForSuperClass(typeClass, classMap); } if (val == null) { // not found anywhere if (logger.isDebugEnabled()) { logger.debug("Could not find a definition for " + typeClass + " in " + classMap.keySet()); } return null; } // remember this so it doesn't have to be looked-up again classMap.put(typeClass, val); return val; } return val; }
[ "public", "static", "Object", "getValueFromMapForClass", "(", "final", "Class", "typeClass", ",", "final", "Map", "classMap", ")", "{", "Object", "val", "=", "classMap", ".", "get", "(", "typeClass", ")", ";", "if", "(", "val", "==", "null", ")", "{", "/...
Given a {@link Map}where the keys are {@link Class}es, search the map for the closest match of the key to the <tt>typeClass</tt>. This is extremely useful to support polymorphism (and an absolute requirement to find proxied classes where classes are acting as keys in a map). <p /> For example: If the Map has keys of Number.class and String.class, using a <tt>typeClass</tt> of Long.class will find the Number.class entry and return its value. <p /> When doing the search, it looks for the most exact match it can, giving preference to interfaces over class inheritance. As a performance optimiziation, if it finds a match it stores the derived match in the map so it does not have to be derived again. @param typeClass the kind of class to search for @param classMap the map where the keys are of type Class @return null only if it can't find any match
[ "Given", "a", "{", "@link", "Map", "}", "where", "the", "keys", "are", "{", "@link", "Class", "}", "es", "search", "the", "map", "for", "the", "closest", "match", "of", "the", "key", "to", "the", "<tt", ">", "typeClass<", "/", "tt", ">", ".", "This...
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ClassUtils.java#L257-L281
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/mps/mail_profile.java
mail_profile.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { mail_profile_responses result = (mail_profile_responses) service.get_payload_formatter().string_to_resource(mail_profile_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.mail_profile_response_array); } mail_profile[] result_mail_profile = new mail_profile[result.mail_profile_response_array.length]; for(int i = 0; i < result.mail_profile_response_array.length; i++) { result_mail_profile[i] = result.mail_profile_response_array[i].mail_profile[0]; } return result_mail_profile; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { mail_profile_responses result = (mail_profile_responses) service.get_payload_formatter().string_to_resource(mail_profile_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.mail_profile_response_array); } mail_profile[] result_mail_profile = new mail_profile[result.mail_profile_response_array.length]; for(int i = 0; i < result.mail_profile_response_array.length; i++) { result_mail_profile[i] = result.mail_profile_response_array[i].mail_profile[0]; } return result_mail_profile; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "mail_profile_responses", "result", "=", "(", "mail_profile_responses", ")", "service", ".", "get_payload_form...
<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/mps/mail_profile.java#L410-L427
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.getHierarchicalEntityRoleAsync
public Observable<EntityRole> getHierarchicalEntityRoleAsync(UUID appId, String versionId, UUID hEntityId, UUID roleId) { return getHierarchicalEntityRoleWithServiceResponseAsync(appId, versionId, hEntityId, roleId).map(new Func1<ServiceResponse<EntityRole>, EntityRole>() { @Override public EntityRole call(ServiceResponse<EntityRole> response) { return response.body(); } }); }
java
public Observable<EntityRole> getHierarchicalEntityRoleAsync(UUID appId, String versionId, UUID hEntityId, UUID roleId) { return getHierarchicalEntityRoleWithServiceResponseAsync(appId, versionId, hEntityId, roleId).map(new Func1<ServiceResponse<EntityRole>, EntityRole>() { @Override public EntityRole call(ServiceResponse<EntityRole> response) { return response.body(); } }); }
[ "public", "Observable", "<", "EntityRole", ">", "getHierarchicalEntityRoleAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "hEntityId", ",", "UUID", "roleId", ")", "{", "return", "getHierarchicalEntityRoleWithServiceResponseAsync", "(", "appId", ...
Get one entity role for a given entity. @param appId The application ID. @param versionId The version ID. @param hEntityId The hierarchical entity extractor ID. @param roleId entity role ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the EntityRole object
[ "Get", "one", "entity", "role", "for", "a", "given", "entity", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L13189-L13196
thelinmichael/spotify-web-api-java
src/main/java/com/wrapper/spotify/SpotifyApi.java
SpotifyApi.checkCurrentUserFollowsArtistsOrUsers
public CheckCurrentUserFollowsArtistsOrUsersRequest.Builder checkCurrentUserFollowsArtistsOrUsers( ModelObjectType type, String[] ids) { return new CheckCurrentUserFollowsArtistsOrUsersRequest.Builder(accessToken) .setDefaults(httpManager, scheme, host, port) .type(type) .ids(concat(ids, ',')); }
java
public CheckCurrentUserFollowsArtistsOrUsersRequest.Builder checkCurrentUserFollowsArtistsOrUsers( ModelObjectType type, String[] ids) { return new CheckCurrentUserFollowsArtistsOrUsersRequest.Builder(accessToken) .setDefaults(httpManager, scheme, host, port) .type(type) .ids(concat(ids, ',')); }
[ "public", "CheckCurrentUserFollowsArtistsOrUsersRequest", ".", "Builder", "checkCurrentUserFollowsArtistsOrUsers", "(", "ModelObjectType", "type", ",", "String", "[", "]", "ids", ")", "{", "return", "new", "CheckCurrentUserFollowsArtistsOrUsersRequest", ".", "Builder", "(", ...
Check to see if the current user is following one or more artists or other Spotify users. @param type The ID type: either artist or user. @param ids A list of the artist or the user Spotify IDs to check. Maximum: 50 IDs. @return A {@link CheckCurrentUserFollowsArtistsOrUsersRequest.Builder}. @see <a href="https://developer.spotify.com/web-api/user-guide/#spotify-uris-and-ids">Spotify: URLs &amp; IDs</a>
[ "Check", "to", "see", "if", "the", "current", "user", "is", "following", "one", "or", "more", "artists", "or", "other", "Spotify", "users", "." ]
train
https://github.com/thelinmichael/spotify-web-api-java/blob/c06b8512344c0310d0c1df362fa267879021da2e/src/main/java/com/wrapper/spotify/SpotifyApi.java#L612-L618
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/extension/NGAExtensions.java
NGAExtensions.deleteContentsId
public static void deleteContentsId(GeoPackageCore geoPackage, String table) { ContentsIdExtension contentsIdExtension = new ContentsIdExtension( geoPackage); if (contentsIdExtension.has()) { contentsIdExtension.delete(table); } }
java
public static void deleteContentsId(GeoPackageCore geoPackage, String table) { ContentsIdExtension contentsIdExtension = new ContentsIdExtension( geoPackage); if (contentsIdExtension.has()) { contentsIdExtension.delete(table); } }
[ "public", "static", "void", "deleteContentsId", "(", "GeoPackageCore", "geoPackage", ",", "String", "table", ")", "{", "ContentsIdExtension", "contentsIdExtension", "=", "new", "ContentsIdExtension", "(", "geoPackage", ")", ";", "if", "(", "contentsIdExtension", ".", ...
Delete the Contents Id extensions for the table @param geoPackage GeoPackage @param table table name @since 3.2.0
[ "Delete", "the", "Contents", "Id", "extensions", "for", "the", "table" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/NGAExtensions.java#L358-L366
ModeShape/modeshape
modeshape-jcr-api/src/main/java/org/modeshape/jcr/api/JcrTools.java
JcrTools.printQuery
public QueryResult printQuery( Session session, String jcrSql2, long expectedNumberOfResults, Map<String, String> variables ) throws RepositoryException { return printQuery(session, jcrSql2, Query.JCR_SQL2, expectedNumberOfResults, variables); }
java
public QueryResult printQuery( Session session, String jcrSql2, long expectedNumberOfResults, Map<String, String> variables ) throws RepositoryException { return printQuery(session, jcrSql2, Query.JCR_SQL2, expectedNumberOfResults, variables); }
[ "public", "QueryResult", "printQuery", "(", "Session", "session", ",", "String", "jcrSql2", ",", "long", "expectedNumberOfResults", ",", "Map", "<", "String", ",", "String", ">", "variables", ")", "throws", "RepositoryException", "{", "return", "printQuery", "(", ...
Execute the supplied JCR-SQL2 query and, if printing is enabled, print out the results. @param session the session @param jcrSql2 the JCR-SQL2 query @param expectedNumberOfResults the expected number of rows in the results, or -1 if this is not to be checked @param variables the array of variable maps for the query; all maps will be combined into a single map @return the results @throws RepositoryException
[ "Execute", "the", "supplied", "JCR", "-", "SQL2", "query", "and", "if", "printing", "is", "enabled", "print", "out", "the", "results", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr-api/src/main/java/org/modeshape/jcr/api/JcrTools.java#L663-L668
sagiegurari/fax4j
src/main/java/org/fax4j/spi/LogFaxClientSpiInterceptor.java
LogFaxClientSpiInterceptor.onMethodInvocationError
public final void onMethodInvocationError(Method method,Object[] arguments,Throwable throwable) { this.logEvent(FaxClientSpiProxyEventType.ERROR_EVENT_TYPE,method,arguments,null,throwable); }
java
public final void onMethodInvocationError(Method method,Object[] arguments,Throwable throwable) { this.logEvent(FaxClientSpiProxyEventType.ERROR_EVENT_TYPE,method,arguments,null,throwable); }
[ "public", "final", "void", "onMethodInvocationError", "(", "Method", "method", ",", "Object", "[", "]", "arguments", ",", "Throwable", "throwable", ")", "{", "this", ".", "logEvent", "(", "FaxClientSpiProxyEventType", ".", "ERROR_EVENT_TYPE", ",", "method", ",", ...
This function is invoked by the fax client SPI proxy in of an error while invoking the method in the fax client SPI itself. @param method The method invoked @param arguments The method arguments @param throwable The throwable while invoking the method
[ "This", "function", "is", "invoked", "by", "the", "fax", "client", "SPI", "proxy", "in", "of", "an", "error", "while", "invoking", "the", "method", "in", "the", "fax", "client", "SPI", "itself", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/LogFaxClientSpiInterceptor.java#L191-L194
DDTH/ddth-tsc
ddth-tsc-core/src/main/java/com/github/ddth/tsc/redis/ShardedRedisCounterFactory.java
ShardedRedisCounterFactory.newJedisPool
public static ShardedJedisPool newJedisPool(String hostsAndPorts, String password) { return newJedisPool(hostsAndPorts, password, DEFAULT_TIMEOUT_MS); }
java
public static ShardedJedisPool newJedisPool(String hostsAndPorts, String password) { return newJedisPool(hostsAndPorts, password, DEFAULT_TIMEOUT_MS); }
[ "public", "static", "ShardedJedisPool", "newJedisPool", "(", "String", "hostsAndPorts", ",", "String", "password", ")", "{", "return", "newJedisPool", "(", "hostsAndPorts", ",", "password", ",", "DEFAULT_TIMEOUT_MS", ")", ";", "}" ]
Creates a new {@link ShardedJedisPool}, with default timeout. @param hostsAndPorts format {@code host1:port1,host2:port2...} @param password @return
[ "Creates", "a", "new", "{", "@link", "ShardedJedisPool", "}", "with", "default", "timeout", "." ]
train
https://github.com/DDTH/ddth-tsc/blob/d233c304c8fed2f3c069de42a36b7bbd5c8be01b/ddth-tsc-core/src/main/java/com/github/ddth/tsc/redis/ShardedRedisCounterFactory.java#L39-L41
trajano/caliper
caliper/src/main/java/com/google/caliper/util/InterleavedReader.java
InterleavedReader.read
public Object read() throws IOException { char[] buffer = new char[BUFFER_LENGTH]; reader.mark(BUFFER_LENGTH); int count = 0; int textEnd; while (true) { int r = reader.read(buffer, count, buffer.length - count); if (r == -1) { // the input is exhausted; return the remaining characters textEnd = count; break; } count += r; int possibleMarker = findPossibleMarker(buffer, count); if (possibleMarker != 0) { // return the characters that precede the marker textEnd = possibleMarker; break; } if (count < marker.length()) { // the buffer contains only the prefix of a marker so we must read more continue; } // we've read a marker so return the value that follows reader.reset(); String json = reader.readLine().substring(marker.length()); return jsonParser.parse(json); } if (count == 0) { return null; } // return characters reader.reset(); count = reader.read(buffer, 0, textEnd); return new String(buffer, 0, count); }
java
public Object read() throws IOException { char[] buffer = new char[BUFFER_LENGTH]; reader.mark(BUFFER_LENGTH); int count = 0; int textEnd; while (true) { int r = reader.read(buffer, count, buffer.length - count); if (r == -1) { // the input is exhausted; return the remaining characters textEnd = count; break; } count += r; int possibleMarker = findPossibleMarker(buffer, count); if (possibleMarker != 0) { // return the characters that precede the marker textEnd = possibleMarker; break; } if (count < marker.length()) { // the buffer contains only the prefix of a marker so we must read more continue; } // we've read a marker so return the value that follows reader.reset(); String json = reader.readLine().substring(marker.length()); return jsonParser.parse(json); } if (count == 0) { return null; } // return characters reader.reset(); count = reader.read(buffer, 0, textEnd); return new String(buffer, 0, count); }
[ "public", "Object", "read", "(", ")", "throws", "IOException", "{", "char", "[", "]", "buffer", "=", "new", "char", "[", "BUFFER_LENGTH", "]", ";", "reader", ".", "mark", "(", "BUFFER_LENGTH", ")", ";", "int", "count", "=", "0", ";", "int", "textEnd", ...
Returns the next value in the stream: either a String, a JsonElement, or null to indicate the end of the stream. Callers should use instanceof to inspect the return type.
[ "Returns", "the", "next", "value", "in", "the", "stream", ":", "either", "a", "String", "a", "JsonElement", "or", "null", "to", "indicate", "the", "end", "of", "the", "stream", ".", "Callers", "should", "use", "instanceof", "to", "inspect", "the", "return"...
train
https://github.com/trajano/caliper/blob/a8bcfd84fa9d7b893b3edfadc3b13240ae5cd658/caliper/src/main/java/com/google/caliper/util/InterleavedReader.java#L63-L106
Mthwate/DatLib
src/main/java/com/mthwate/datlib/HashUtils.java
HashUtils.sha384Hex
public static String sha384Hex(String data, Charset charset) throws NoSuchAlgorithmException { return sha384Hex(data.getBytes(charset)); }
java
public static String sha384Hex(String data, Charset charset) throws NoSuchAlgorithmException { return sha384Hex(data.getBytes(charset)); }
[ "public", "static", "String", "sha384Hex", "(", "String", "data", ",", "Charset", "charset", ")", "throws", "NoSuchAlgorithmException", "{", "return", "sha384Hex", "(", "data", ".", "getBytes", "(", "charset", ")", ")", ";", "}" ]
Hashes a string using the SHA-384 algorithm. Returns a hexadecimal result. @since 1.1 @param data the string to hash @param charset the charset of the string @return the hexadecimal SHA-384 hash of the string @throws NoSuchAlgorithmException the algorithm is not supported by existing providers
[ "Hashes", "a", "string", "using", "the", "SHA", "-", "384", "algorithm", ".", "Returns", "a", "hexadecimal", "result", "." ]
train
https://github.com/Mthwate/DatLib/blob/f0b3a9f9cf6fdc773d4f86234ebd95986c9b6077/src/main/java/com/mthwate/datlib/HashUtils.java#L508-L510
apache/incubator-atlas
typesystem/src/main/java/org/apache/atlas/typesystem/types/TypeSystem.java
TypeSystem.commitTypes
public void commitTypes(Map<String, IDataType> typesAdded) throws AtlasException { for (Map.Entry<String, IDataType> typeEntry : typesAdded.entrySet()) { IDataType type = typeEntry.getValue(); //Add/replace the new type in the typesystem typeCache.put(type); } }
java
public void commitTypes(Map<String, IDataType> typesAdded) throws AtlasException { for (Map.Entry<String, IDataType> typeEntry : typesAdded.entrySet()) { IDataType type = typeEntry.getValue(); //Add/replace the new type in the typesystem typeCache.put(type); } }
[ "public", "void", "commitTypes", "(", "Map", "<", "String", ",", "IDataType", ">", "typesAdded", ")", "throws", "AtlasException", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "IDataType", ">", "typeEntry", ":", "typesAdded", ".", "entrySet", "...
Commit the given types to this {@link TypeSystem} instance. This step should be called only after the types have been committed to the backend stores successfully. @param typesAdded newly added types. @throws AtlasException
[ "Commit", "the", "given", "types", "to", "this", "{", "@link", "TypeSystem", "}", "instance", "." ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/typesystem/src/main/java/org/apache/atlas/typesystem/types/TypeSystem.java#L362-L368
opencb/java-common-libs
commons-datastore/commons-datastore-solr/src/main/java/org/opencb/commons/datastore/solr/SolrManager.java
SolrManager.createCore
public void createCore(String coreName, String configSet) throws SolrException { try { logger.debug("Creating core: host={}, core={}, configSet={}", host, coreName, configSet); CoreAdminRequest.Create request = new CoreAdminRequest.Create(); request.setCoreName(coreName); request.setConfigSet(configSet); request.process(solrClient); } catch (Exception e) { throw new SolrException(SolrException.ErrorCode.CONFLICT, e); } }
java
public void createCore(String coreName, String configSet) throws SolrException { try { logger.debug("Creating core: host={}, core={}, configSet={}", host, coreName, configSet); CoreAdminRequest.Create request = new CoreAdminRequest.Create(); request.setCoreName(coreName); request.setConfigSet(configSet); request.process(solrClient); } catch (Exception e) { throw new SolrException(SolrException.ErrorCode.CONFLICT, e); } }
[ "public", "void", "createCore", "(", "String", "coreName", ",", "String", "configSet", ")", "throws", "SolrException", "{", "try", "{", "logger", ".", "debug", "(", "\"Creating core: host={}, core={}, configSet={}\"", ",", "host", ",", "coreName", ",", "configSet", ...
Create a Solr core from a configuration set directory. By default, the configuration set directory is located inside the folder server/solr/configsets. @param coreName Core name @param configSet Configuration set name @throws SolrException Exception
[ "Create", "a", "Solr", "core", "from", "a", "configuration", "set", "directory", ".", "By", "default", "the", "configuration", "set", "directory", "is", "located", "inside", "the", "folder", "server", "/", "solr", "/", "configsets", "." ]
train
https://github.com/opencb/java-common-libs/blob/5c97682530d0be55828e1e4e374ff01fceb5f198/commons-datastore/commons-datastore-solr/src/main/java/org/opencb/commons/datastore/solr/SolrManager.java#L136-L146
fabric8io/fabric8-forge
addons/utils/src/main/java/io/fabric8/forge/addon/utils/MavenHelpers.java
MavenHelpers.getConfigurationElement
public static ConfigurationElement getConfigurationElement(Configuration config, String... names) { if (config != null && names.length > 0) { String first = names[0]; ConfigurationElement root = findConfigurationElement(config, first); if (root != null) { if (names.length == 1) { return root; } else { int remainingLength = names.length - 1; String[] remaining = new String[remainingLength]; System.arraycopy(names, 1, remaining, 0, remainingLength); return getConfigurationElement(root, remaining); } } } return null; }
java
public static ConfigurationElement getConfigurationElement(Configuration config, String... names) { if (config != null && names.length > 0) { String first = names[0]; ConfigurationElement root = findConfigurationElement(config, first); if (root != null) { if (names.length == 1) { return root; } else { int remainingLength = names.length - 1; String[] remaining = new String[remainingLength]; System.arraycopy(names, 1, remaining, 0, remainingLength); return getConfigurationElement(root, remaining); } } } return null; }
[ "public", "static", "ConfigurationElement", "getConfigurationElement", "(", "Configuration", "config", ",", "String", "...", "names", ")", "{", "if", "(", "config", "!=", "null", "&&", "names", ".", "length", ">", "0", ")", "{", "String", "first", "=", "name...
Returns the plugin configuration element for the given set of element names
[ "Returns", "the", "plugin", "configuration", "element", "for", "the", "given", "set", "of", "element", "names" ]
train
https://github.com/fabric8io/fabric8-forge/blob/a59871bae4d5c5d3ece10f1e8758e73663087f19/addons/utils/src/main/java/io/fabric8/forge/addon/utils/MavenHelpers.java#L277-L293
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
FSNamesystem.checkFileProgress
boolean checkFileProgress(INodeFile v, boolean checkall) throws IOException { INode.enforceRegularStorageINode(v, "checkFileProgress is not supported for non-regular files"); if (checkall) { // // check all blocks of the file. // int closeFileReplicationMin = Math.min(v.getReplication(), this.minCloseReplication); for (Block block : v.getBlocks()) { if (!checkBlockProgress(v, block, closeFileReplicationMin)) { return false; } } return true; } else { // // check the penultimate block of this file // Block b = v.getStorage().getPenultimateBlock(); return checkBlockProgress(v, b, minReplication); } }
java
boolean checkFileProgress(INodeFile v, boolean checkall) throws IOException { INode.enforceRegularStorageINode(v, "checkFileProgress is not supported for non-regular files"); if (checkall) { // // check all blocks of the file. // int closeFileReplicationMin = Math.min(v.getReplication(), this.minCloseReplication); for (Block block : v.getBlocks()) { if (!checkBlockProgress(v, block, closeFileReplicationMin)) { return false; } } return true; } else { // // check the penultimate block of this file // Block b = v.getStorage().getPenultimateBlock(); return checkBlockProgress(v, b, minReplication); } }
[ "boolean", "checkFileProgress", "(", "INodeFile", "v", ",", "boolean", "checkall", ")", "throws", "IOException", "{", "INode", ".", "enforceRegularStorageINode", "(", "v", ",", "\"checkFileProgress is not supported for non-regular files\"", ")", ";", "if", "(", "checkal...
Check that the indicated file's blocks are present and replicated. If not, return false. If checkall is true, then check all blocks, otherwise check only penultimate block.
[ "Check", "that", "the", "indicated", "file", "s", "blocks", "are", "present", "and", "replicated", ".", "If", "not", "return", "false", ".", "If", "checkall", "is", "true", "then", "check", "all", "blocks", "otherwise", "check", "only", "penultimate", "block...
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L3340-L3363
nohana/Amalgam
amalgam/src/main/java/com/amalgam/os/BundleUtils.java
BundleUtils.optChar
public static char optChar(@Nullable Bundle bundle, @Nullable String key, char fallback) { if (bundle == null) { return fallback; } return bundle.getChar(key, fallback); }
java
public static char optChar(@Nullable Bundle bundle, @Nullable String key, char fallback) { if (bundle == null) { return fallback; } return bundle.getChar(key, fallback); }
[ "public", "static", "char", "optChar", "(", "@", "Nullable", "Bundle", "bundle", ",", "@", "Nullable", "String", "key", ",", "char", "fallback", ")", "{", "if", "(", "bundle", "==", "null", ")", "{", "return", "fallback", ";", "}", "return", "bundle", ...
Returns a optional char value. In other words, returns the value mapped by key if it exists and is a char. The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns a fallback value. @param bundle a bundle. If the bundle is null, this method will return null. @param key a key for the value. @param fallback fallback value @return a char value if exists, fallback value otherwise. @see android.os.Bundle#getChar(String, char)
[ "Returns", "a", "optional", "char", "value", ".", "In", "other", "words", "returns", "the", "value", "mapped", "by", "key", "if", "it", "exists", "and", "is", "a", "char", ".", "The", "bundle", "argument", "is", "allowed", "to", "be", "{" ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L284-L289
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.email_exchange_organizationName_service_exchangeService_outlook_duration_POST
public OvhOrder email_exchange_organizationName_service_exchangeService_outlook_duration_POST(String organizationName, String exchangeService, String duration, OvhOutlookVersionEnum licence, String primaryEmailAddress) throws IOException { String qPath = "/order/email/exchange/{organizationName}/service/{exchangeService}/outlook/{duration}"; StringBuilder sb = path(qPath, organizationName, exchangeService, duration); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "licence", licence); addBody(o, "primaryEmailAddress", primaryEmailAddress); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder email_exchange_organizationName_service_exchangeService_outlook_duration_POST(String organizationName, String exchangeService, String duration, OvhOutlookVersionEnum licence, String primaryEmailAddress) throws IOException { String qPath = "/order/email/exchange/{organizationName}/service/{exchangeService}/outlook/{duration}"; StringBuilder sb = path(qPath, organizationName, exchangeService, duration); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "licence", licence); addBody(o, "primaryEmailAddress", primaryEmailAddress); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "email_exchange_organizationName_service_exchangeService_outlook_duration_POST", "(", "String", "organizationName", ",", "String", "exchangeService", ",", "String", "duration", ",", "OvhOutlookVersionEnum", "licence", ",", "String", "primaryEmailAddress", ")...
Create order REST: POST /order/email/exchange/{organizationName}/service/{exchangeService}/outlook/{duration} @param licence [required] Outlook version @param primaryEmailAddress [required] Primary email address for account which You want to buy an outlook @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service @param duration [required] Duration
[ "Create", "order" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L3851-L3859
Domo42/saga-lib
saga-lib/src/main/java/com/codebullets/sagalib/AbstractSaga.java
AbstractSaga.requestTimeout
protected TimeoutId requestTimeout(final long delay, final TimeUnit unit, @Nullable final String name, @Nullable final Object data) { return timeoutManager.requestTimeout(context(), state().getSagaId(), delay, unit, name, data); }
java
protected TimeoutId requestTimeout(final long delay, final TimeUnit unit, @Nullable final String name, @Nullable final Object data) { return timeoutManager.requestTimeout(context(), state().getSagaId(), delay, unit, name, data); }
[ "protected", "TimeoutId", "requestTimeout", "(", "final", "long", "delay", ",", "final", "TimeUnit", "unit", ",", "@", "Nullable", "final", "String", "name", ",", "@", "Nullable", "final", "Object", "data", ")", "{", "return", "timeoutManager", ".", "requestTi...
Requests a timeout event with a specific name and attached data.
[ "Requests", "a", "timeout", "event", "with", "a", "specific", "name", "and", "attached", "data", "." ]
train
https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/AbstractSaga.java#L109-L111
code4everything/util
src/main/java/com/zhazhapan/util/RandomUtils.java
RandomUtils.getRandomText
public static String getRandomText(int floor, int ceil, int length) { StringBuilder builder = new StringBuilder(); for (int i = 0; i < length; i++) { builder.append((char) getRandomInteger(floor, ceil)); } return builder.toString(); }
java
public static String getRandomText(int floor, int ceil, int length) { StringBuilder builder = new StringBuilder(); for (int i = 0; i < length; i++) { builder.append((char) getRandomInteger(floor, ceil)); } return builder.toString(); }
[ "public", "static", "String", "getRandomText", "(", "int", "floor", ",", "int", "ceil", ",", "int", "length", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ...
获取自定义随机字符串 @param floor ascii下限 @param ceil ascii上限 @param length 长度 @return 字符串
[ "获取自定义随机字符串" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/RandomUtils.java#L133-L139
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/AppsImpl.java
AppsImpl.updatePublishSettingsAsync
public Observable<OperationStatus> updatePublishSettingsAsync(UUID appId, PublishSettingUpdateObject publishSettingUpdateObject) { return updatePublishSettingsWithServiceResponseAsync(appId, publishSettingUpdateObject).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
java
public Observable<OperationStatus> updatePublishSettingsAsync(UUID appId, PublishSettingUpdateObject publishSettingUpdateObject) { return updatePublishSettingsWithServiceResponseAsync(appId, publishSettingUpdateObject).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatus", ">", "updatePublishSettingsAsync", "(", "UUID", "appId", ",", "PublishSettingUpdateObject", "publishSettingUpdateObject", ")", "{", "return", "updatePublishSettingsWithServiceResponseAsync", "(", "appId", ",", "publishSettingUpdat...
Updates the application publish settings. @param appId The application ID. @param publishSettingUpdateObject An object containing the new publish application settings. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object
[ "Updates", "the", "application", "publish", "settings", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/AppsImpl.java#L1564-L1571
Azure/azure-sdk-for-java
eventgrid/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/eventgrid/v2019_01_01/implementation/TopicsInner.java
TopicsInner.beginUpdateAsync
public Observable<TopicInner> beginUpdateAsync(String resourceGroupName, String topicName, Map<String, String> tags) { return beginUpdateWithServiceResponseAsync(resourceGroupName, topicName, tags).map(new Func1<ServiceResponse<TopicInner>, TopicInner>() { @Override public TopicInner call(ServiceResponse<TopicInner> response) { return response.body(); } }); }
java
public Observable<TopicInner> beginUpdateAsync(String resourceGroupName, String topicName, Map<String, String> tags) { return beginUpdateWithServiceResponseAsync(resourceGroupName, topicName, tags).map(new Func1<ServiceResponse<TopicInner>, TopicInner>() { @Override public TopicInner call(ServiceResponse<TopicInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "TopicInner", ">", "beginUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "topicName", ",", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "resourceGroupN...
Update a topic. Asynchronously updates a topic with the specified parameters. @param resourceGroupName The name of the resource group within the user's subscription. @param topicName Name of the topic @param tags Tags of the resource @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the TopicInner object
[ "Update", "a", "topic", ".", "Asynchronously", "updates", "a", "topic", "with", "the", "specified", "parameters", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/eventgrid/v2019_01_01/implementation/TopicsInner.java#L832-L839
autermann/yaml
src/main/java/com/github/autermann/yaml/nodes/YamlMappingNode.java
YamlMappingNode.put
public T put(String key, YamlNode value) { return put(getNodeFactory().textNode(key), value); }
java
public T put(String key, YamlNode value) { return put(getNodeFactory().textNode(key), value); }
[ "public", "T", "put", "(", "String", "key", ",", "YamlNode", "value", ")", "{", "return", "put", "(", "getNodeFactory", "(", ")", ".", "textNode", "(", "key", ")", ",", "value", ")", ";", "}" ]
Adds the specified {@code key}/{@code value} pair to this mapping. @param key the key @param value the value @return {@code this}
[ "Adds", "the", "specified", "{", "@code", "key", "}", "/", "{", "@code", "value", "}", "pair", "to", "this", "mapping", "." ]
train
https://github.com/autermann/yaml/blob/5f8ab03e4fec3a2abe72c03561cdaa3a3936634d/src/main/java/com/github/autermann/yaml/nodes/YamlMappingNode.java#L62-L64
Netflix/Hystrix
hystrix-core/src/main/java/com/netflix/hystrix/strategy/executionhook/HystrixCommandExecutionHook.java
HystrixCommandExecutionHook.onComplete
@Deprecated public <T> T onComplete(HystrixCommand<T> commandInstance, T response) { // pass-thru by default return response; }
java
@Deprecated public <T> T onComplete(HystrixCommand<T> commandInstance, T response) { // pass-thru by default return response; }
[ "@", "Deprecated", "public", "<", "T", ">", "T", "onComplete", "(", "HystrixCommand", "<", "T", ">", "commandInstance", ",", "T", "response", ")", "{", "// pass-thru by default", "return", "response", ";", "}" ]
DEPRECATED: Change usages of this to {@link #onEmit} if you want to write a hook that handles each emitted command value or to {@link #onSuccess} if you want to write a hook that handles success of the command Invoked after completion of {@link HystrixCommand} execution that results in a response. <p> The response can come either from {@link HystrixCommand#run()} or {@link HystrixCommand#getFallback()}. @param commandInstance The executing HystrixCommand instance. @param response from {@link HystrixCommand#run()} or {@link HystrixCommand#getFallback()}. @return T response object that can be modified, decorated, replaced or just returned as a pass-thru. @since 1.2
[ "DEPRECATED", ":", "Change", "usages", "of", "this", "to", "{", "@link", "#onEmit", "}", "if", "you", "want", "to", "write", "a", "hook", "that", "handles", "each", "emitted", "command", "value", "or", "to", "{", "@link", "#onSuccess", "}", "if", "you", ...
train
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/strategy/executionhook/HystrixCommandExecutionHook.java#L447-L451
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/component/dateTimePicker/DateTimePickerRenderer.java
DateTimePickerRenderer.getValueAsString
public static String getValueAsString(Object value, FacesContext ctx, DateTimePicker dtp) { // Else we use our own converter if(value == null) { return null; } Locale sloc = BsfUtils.selectLocale(ctx.getViewRoot().getLocale(), dtp.getLocale(), dtp); String javaFormatString = BsfUtils.selectJavaDateTimeFormatFromMomentJSFormatOrDefault(sloc, dtp.getFormat(), dtp.isShowDate(), dtp.isShowTime()); return getDateAsString(ctx, dtp, value, javaFormatString, sloc); }
java
public static String getValueAsString(Object value, FacesContext ctx, DateTimePicker dtp) { // Else we use our own converter if(value == null) { return null; } Locale sloc = BsfUtils.selectLocale(ctx.getViewRoot().getLocale(), dtp.getLocale(), dtp); String javaFormatString = BsfUtils.selectJavaDateTimeFormatFromMomentJSFormatOrDefault(sloc, dtp.getFormat(), dtp.isShowDate(), dtp.isShowTime()); return getDateAsString(ctx, dtp, value, javaFormatString, sloc); }
[ "public", "static", "String", "getValueAsString", "(", "Object", "value", ",", "FacesContext", "ctx", ",", "DateTimePicker", "dtp", ")", "{", "// Else we use our own converter", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "Locale", ...
Yields the value which is displayed in the input field of the date picker. @param ctx @param dtp @return
[ "Yields", "the", "value", "which", "is", "displayed", "in", "the", "input", "field", "of", "the", "date", "picker", "." ]
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/dateTimePicker/DateTimePickerRenderer.java#L86-L95
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java
TrainingsImpl.queryPredictionsAsync
public Observable<PredictionQueryResult> queryPredictionsAsync(UUID projectId, PredictionQueryToken query) { return queryPredictionsWithServiceResponseAsync(projectId, query).map(new Func1<ServiceResponse<PredictionQueryResult>, PredictionQueryResult>() { @Override public PredictionQueryResult call(ServiceResponse<PredictionQueryResult> response) { return response.body(); } }); }
java
public Observable<PredictionQueryResult> queryPredictionsAsync(UUID projectId, PredictionQueryToken query) { return queryPredictionsWithServiceResponseAsync(projectId, query).map(new Func1<ServiceResponse<PredictionQueryResult>, PredictionQueryResult>() { @Override public PredictionQueryResult call(ServiceResponse<PredictionQueryResult> response) { return response.body(); } }); }
[ "public", "Observable", "<", "PredictionQueryResult", ">", "queryPredictionsAsync", "(", "UUID", "projectId", ",", "PredictionQueryToken", "query", ")", "{", "return", "queryPredictionsWithServiceResponseAsync", "(", "projectId", ",", "query", ")", ".", "map", "(", "n...
Get images that were sent to your prediction endpoint. @param projectId The project id @param query Parameters used to query the predictions. Limited to combining 2 tags @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PredictionQueryResult object
[ "Get", "images", "that", "were", "sent", "to", "your", "prediction", "endpoint", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L3028-L3035
casbin/jcasbin
src/main/java/org/casbin/jcasbin/main/Enforcer.java
Enforcer.deleteRoleForUserInDomain
public boolean deleteRoleForUserInDomain(String user, String role, String domain) { return removeGroupingPolicy(user, role, domain); }
java
public boolean deleteRoleForUserInDomain(String user, String role, String domain) { return removeGroupingPolicy(user, role, domain); }
[ "public", "boolean", "deleteRoleForUserInDomain", "(", "String", "user", ",", "String", "role", ",", "String", "domain", ")", "{", "return", "removeGroupingPolicy", "(", "user", ",", "role", ",", "domain", ")", ";", "}" ]
deleteRoleForUserInDomain deletes a role for a user inside a domain. Returns false if the user does not have the role (aka not affected). @param user the user. @param role the role. @param domain the domain. @return succeeds or not.
[ "deleteRoleForUserInDomain", "deletes", "a", "role", "for", "a", "user", "inside", "a", "domain", ".", "Returns", "false", "if", "the", "user", "does", "not", "have", "the", "role", "(", "aka", "not", "affected", ")", "." ]
train
https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/main/Enforcer.java#L400-L402
NoraUi/NoraUi
src/main/java/com/github/noraui/application/steps/CommonSteps.java
CommonSteps.saveValue
@Conditioned @Et("Je sauvegarde la valeur de '(.*)-(.*)' dans la clé '(.*)' du contexte[\\.|\\?]") @And("I save the value of '(.*)-(.*)' in '(.*)' context key[\\.|\\?]") public void saveValue(String page, String field, String targetKey, List<GherkinStepCondition> conditions) throws TechnicalException, FailureException { saveElementValue('-' + field, targetKey, Page.getInstance(page)); }
java
@Conditioned @Et("Je sauvegarde la valeur de '(.*)-(.*)' dans la clé '(.*)' du contexte[\\.|\\?]") @And("I save the value of '(.*)-(.*)' in '(.*)' context key[\\.|\\?]") public void saveValue(String page, String field, String targetKey, List<GherkinStepCondition> conditions) throws TechnicalException, FailureException { saveElementValue('-' + field, targetKey, Page.getInstance(page)); }
[ "@", "Conditioned", "@", "Et", "(", "\"Je sauvegarde la valeur de '(.*)-(.*)' dans la clé '(.*)' du contexte[\\\\.|\\\\?]\")", "\r", "@", "And", "(", "\"I save the value of '(.*)-(.*)' in '(.*)' context key[\\\\.|\\\\?]\"", ")", "public", "void", "saveValue", "(", "String", "page",...
Save field in memory if all 'expected' parameters equals 'actual' parameters in conditions. The value is saved directly into the Context targetKey. @param page The concerned page of field @param field Name of the field to save in memory. @param targetKey Target key to save retrieved value. @param conditions list of 'expected' values condition and 'actual' values ({@link com.github.noraui.gherkin.GherkinStepCondition}). @throws FailureException if the scenario encounters a functional error (with message and screenshot) @throws TechnicalException is thrown if the scenario encounters a technical error (format, configuration, data, ...) in NoraUi. Exception with {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_UNABLE_TO_FIND_ELEMENT} or {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_UNABLE_TO_RETRIEVE_VALUE}
[ "Save", "field", "in", "memory", "if", "all", "expected", "parameters", "equals", "actual", "parameters", "in", "conditions", ".", "The", "value", "is", "saved", "directly", "into", "the", "Context", "targetKey", "." ]
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/CommonSteps.java#L362-L367
before/quality-check
modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java
Check.matchesPattern
@ArgumentsChecked @Throws({ IllegalNullArgumentException.class, IllegalPatternArgumentException.class }) public static <T extends CharSequence> T matchesPattern(@Nonnull final Pattern pattern, @Nonnull final T chars, @Nullable final String name) { Check.notNull(pattern, "pattern"); Check.notNull(chars, "chars"); if (!matches(pattern, chars)) { throw new IllegalPatternArgumentException(name, pattern, chars); } return chars; }
java
@ArgumentsChecked @Throws({ IllegalNullArgumentException.class, IllegalPatternArgumentException.class }) public static <T extends CharSequence> T matchesPattern(@Nonnull final Pattern pattern, @Nonnull final T chars, @Nullable final String name) { Check.notNull(pattern, "pattern"); Check.notNull(chars, "chars"); if (!matches(pattern, chars)) { throw new IllegalPatternArgumentException(name, pattern, chars); } return chars; }
[ "@", "ArgumentsChecked", "@", "Throws", "(", "{", "IllegalNullArgumentException", ".", "class", ",", "IllegalPatternArgumentException", ".", "class", "}", ")", "public", "static", "<", "T", "extends", "CharSequence", ">", "T", "matchesPattern", "(", "@", "Nonnull"...
Ensures that a readable sequence of {@code char} values matches a specified pattern. If the given character sequence does not match against the passed pattern, an {@link IllegalPatternArgumentException} will be thrown. @param pattern pattern, that the {@code chars} must correspond to @param chars a readable sequence of {@code char} values which should match the given pattern @param name name of object reference (in source code) @return the passed {@code chars} that matches the given pattern @throws IllegalNullArgumentException if the given argument {@code chars} is {@code null} @throws IllegalPatternArgumentException if the given {@code chars} that does not match the {@code pattern}
[ "Ensures", "that", "a", "readable", "sequence", "of", "{", "@code", "char", "}", "values", "matches", "a", "specified", "pattern", ".", "If", "the", "given", "character", "sequence", "does", "not", "match", "against", "the", "passed", "pattern", "an", "{", ...
train
https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java#L1799-L1809
allengeorge/libraft
libraft-agent/src/main/java/io/libraft/agent/snapshots/OnDiskSnapshotsStore.java
OnDiskSnapshotsStore.reconcileSnapshots
public void reconcileSnapshots() throws StorageException { checkInitialized(); try { // return all snapshots that _do not_ have a corresponding file on the filesystem List<SnapshotMetadata> snapshotsToDelete = getMatchingOrderedSnapshots(new Predicate<SnapshotMetadata>() { @Override public boolean apply(@Nullable SnapshotMetadata metadata) { checkArgument(metadata != null); return !snapshotExistsOnFilesystem(snapshotsDirectory, metadata.getFilename()); } }); // for each of these broken rows, delete the snapshot entry from the db for (final SnapshotMetadata metadata : snapshotsToDelete) { dbi.withHandle(new HandleCallback<Void>() { @Override public Void withHandle(Handle handle) throws Exception { SnapshotsDAO dao = handle.attach(SnapshotsDAO.class); dao.removeSnapshotWithTimestamp(metadata.getTimestamp()); return null; } }); } } catch (StorageException e) { throw e; } catch (CallbackFailedException e) { throw new StorageException("fail reconcile snapshot", e.getCause()); } catch (Exception e) { throw new StorageException("fail reconcile snapshot", e); } }
java
public void reconcileSnapshots() throws StorageException { checkInitialized(); try { // return all snapshots that _do not_ have a corresponding file on the filesystem List<SnapshotMetadata> snapshotsToDelete = getMatchingOrderedSnapshots(new Predicate<SnapshotMetadata>() { @Override public boolean apply(@Nullable SnapshotMetadata metadata) { checkArgument(metadata != null); return !snapshotExistsOnFilesystem(snapshotsDirectory, metadata.getFilename()); } }); // for each of these broken rows, delete the snapshot entry from the db for (final SnapshotMetadata metadata : snapshotsToDelete) { dbi.withHandle(new HandleCallback<Void>() { @Override public Void withHandle(Handle handle) throws Exception { SnapshotsDAO dao = handle.attach(SnapshotsDAO.class); dao.removeSnapshotWithTimestamp(metadata.getTimestamp()); return null; } }); } } catch (StorageException e) { throw e; } catch (CallbackFailedException e) { throw new StorageException("fail reconcile snapshot", e.getCause()); } catch (Exception e) { throw new StorageException("fail reconcile snapshot", e); } }
[ "public", "void", "reconcileSnapshots", "(", ")", "throws", "StorageException", "{", "checkInitialized", "(", ")", ";", "try", "{", "// return all snapshots that _do not_ have a corresponding file on the filesystem", "List", "<", "SnapshotMetadata", ">", "snapshotsToDelete", ...
Remove all snapshot metadata entries from the database for which there are no corresponding snapshot files on the filesystem. @throws IllegalStateException if this method is called before {@link OnDiskSnapshotsStore#initialize()} @throws StorageException if the snapshot database cannot be accessed or there was a problem removing snapshot metadata from the database
[ "Remove", "all", "snapshot", "metadata", "entries", "from", "the", "database", "for", "which", "there", "are", "no", "corresponding", "snapshot", "files", "on", "the", "filesystem", "." ]
train
https://github.com/allengeorge/libraft/blob/00d68bb5e68d4020af59df3c8a9a14380108ac89/libraft-agent/src/main/java/io/libraft/agent/snapshots/OnDiskSnapshotsStore.java#L415-L446
Netflix/servo
servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java
Monitors.newCacheMonitor
public static CompositeMonitor<?> newCacheMonitor(String id, Cache<?, ?> cache) { return newObjectMonitor(id, new MonitoredCache(cache)); }
java
public static CompositeMonitor<?> newCacheMonitor(String id, Cache<?, ?> cache) { return newObjectMonitor(id, new MonitoredCache(cache)); }
[ "public", "static", "CompositeMonitor", "<", "?", ">", "newCacheMonitor", "(", "String", "id", ",", "Cache", "<", "?", ",", "?", ">", "cache", ")", "{", "return", "newObjectMonitor", "(", "id", ",", "new", "MonitoredCache", "(", "cache", ")", ")", ";", ...
Creates a new monitor for a cache with standard metrics for the hits, misses, and loads. @param id id to differentiate metrics for this cache from others. @param cache cache instance to monitor. @return composite monitor based on stats provided for the cache
[ "Creates", "a", "new", "monitor", "for", "a", "cache", "with", "standard", "metrics", "for", "the", "hits", "misses", "and", "loads", "." ]
train
https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java#L179-L181
glyptodon/guacamole-client
extensions/guacamole-auth-radius/src/main/java/org/apache/guacamole/auth/radius/RadiusConnectionService.java
RadiusConnectionService.sendChallengeResponse
public RadiusPacket sendChallengeResponse(String username, String response, byte[] state) throws GuacamoleException { if (username == null || username.isEmpty()) { logger.error("Challenge/response to RADIUS requires a username."); return null; } if (state == null || state.length == 0) { logger.error("Challenge/response to RADIUS requires a prior state."); return null; } if (response == null || response.isEmpty()) { logger.error("Challenge/response to RADIUS requires a response."); return null; } return authenticate(username,response,state); }
java
public RadiusPacket sendChallengeResponse(String username, String response, byte[] state) throws GuacamoleException { if (username == null || username.isEmpty()) { logger.error("Challenge/response to RADIUS requires a username."); return null; } if (state == null || state.length == 0) { logger.error("Challenge/response to RADIUS requires a prior state."); return null; } if (response == null || response.isEmpty()) { logger.error("Challenge/response to RADIUS requires a response."); return null; } return authenticate(username,response,state); }
[ "public", "RadiusPacket", "sendChallengeResponse", "(", "String", "username", ",", "String", "response", ",", "byte", "[", "]", "state", ")", "throws", "GuacamoleException", "{", "if", "(", "username", "==", "null", "||", "username", ".", "isEmpty", "(", ")", ...
Send a challenge response to the RADIUS server by validating the input and then sending it along to the authenticate method. @param username The username to send to the RADIUS server for authentication. @param response The response phrase to send to the RADIUS server in response to the challenge previously provided. @param state The state data provided by the RADIUS server in order to continue the RADIUS conversation. @return A RadiusPacket containing the server's response to the authentication attempt. @throws GuacamoleException If an error is encountered trying to talk to the RADIUS server.
[ "Send", "a", "challenge", "response", "to", "the", "RADIUS", "server", "by", "validating", "the", "input", "and", "then", "sending", "it", "along", "to", "the", "authenticate", "method", "." ]
train
https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/extensions/guacamole-auth-radius/src/main/java/org/apache/guacamole/auth/radius/RadiusConnectionService.java#L285-L305
google/closure-compiler
src/com/google/javascript/jscomp/DiagnosticType.java
DiagnosticType.make
public static DiagnosticType make(String name, CheckLevel level, String descriptionFormat) { return new DiagnosticType(name, level, new MessageFormat(descriptionFormat)); }
java
public static DiagnosticType make(String name, CheckLevel level, String descriptionFormat) { return new DiagnosticType(name, level, new MessageFormat(descriptionFormat)); }
[ "public", "static", "DiagnosticType", "make", "(", "String", "name", ",", "CheckLevel", "level", ",", "String", "descriptionFormat", ")", "{", "return", "new", "DiagnosticType", "(", "name", ",", "level", ",", "new", "MessageFormat", "(", "descriptionFormat", ")...
Create a DiagnosticType at a given CheckLevel. @param name An identifier @param level Either CheckLevel.ERROR or CheckLevel.WARNING @param descriptionFormat A format string @return A new DiagnosticType
[ "Create", "a", "DiagnosticType", "at", "a", "given", "CheckLevel", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/DiagnosticType.java#L84-L88
janvanbesien/java-ipv6
src/main/java/com/googlecode/ipv6/IPv6AddressHelpers.java
IPv6AddressHelpers.rewriteIPv4MappedNotation
static String rewriteIPv4MappedNotation(String string) { if (!string.contains(".")) { return string; } else { int lastColon = string.lastIndexOf(":"); String firstPart = string.substring(0, lastColon + 1); String mappedIPv4Part = string.substring(lastColon + 1); if (mappedIPv4Part.contains(".")) { String[] dotSplits = DOT_DELIM.split(mappedIPv4Part); if (dotSplits.length != 4) throw new IllegalArgumentException(String.format("can not parse [%s]", string)); StringBuilder rewrittenString = new StringBuilder(); rewrittenString.append(firstPart); int byteZero = Integer.parseInt(dotSplits[0]); int byteOne = Integer.parseInt(dotSplits[1]); int byteTwo = Integer.parseInt(dotSplits[2]); int byteThree = Integer.parseInt(dotSplits[3]); rewrittenString.append(String.format("%02x", byteZero)); rewrittenString.append(String.format("%02x", byteOne)); rewrittenString.append(":"); rewrittenString.append(String.format("%02x", byteTwo)); rewrittenString.append(String.format("%02x", byteThree)); return rewrittenString.toString(); } else { throw new IllegalArgumentException(String.format("can not parse [%s]", string)); } } }
java
static String rewriteIPv4MappedNotation(String string) { if (!string.contains(".")) { return string; } else { int lastColon = string.lastIndexOf(":"); String firstPart = string.substring(0, lastColon + 1); String mappedIPv4Part = string.substring(lastColon + 1); if (mappedIPv4Part.contains(".")) { String[] dotSplits = DOT_DELIM.split(mappedIPv4Part); if (dotSplits.length != 4) throw new IllegalArgumentException(String.format("can not parse [%s]", string)); StringBuilder rewrittenString = new StringBuilder(); rewrittenString.append(firstPart); int byteZero = Integer.parseInt(dotSplits[0]); int byteOne = Integer.parseInt(dotSplits[1]); int byteTwo = Integer.parseInt(dotSplits[2]); int byteThree = Integer.parseInt(dotSplits[3]); rewrittenString.append(String.format("%02x", byteZero)); rewrittenString.append(String.format("%02x", byteOne)); rewrittenString.append(":"); rewrittenString.append(String.format("%02x", byteTwo)); rewrittenString.append(String.format("%02x", byteThree)); return rewrittenString.toString(); } else { throw new IllegalArgumentException(String.format("can not parse [%s]", string)); } } }
[ "static", "String", "rewriteIPv4MappedNotation", "(", "String", "string", ")", "{", "if", "(", "!", "string", ".", "contains", "(", "\".\"", ")", ")", "{", "return", "string", ";", "}", "else", "{", "int", "lastColon", "=", "string", ".", "lastIndexOf", ...
Replaces a w.x.y.z substring at the end of the given string with corresponding hexadecimal notation. This is useful in case the string was using IPv4-Mapped address notation.
[ "Replaces", "a", "w", ".", "x", ".", "y", ".", "z", "substring", "at", "the", "end", "of", "the", "given", "string", "with", "corresponding", "hexadecimal", "notation", ".", "This", "is", "useful", "in", "case", "the", "string", "was", "using", "IPv4", ...
train
https://github.com/janvanbesien/java-ipv6/blob/9af15b4a6c0074f9fa23dfa030027c631b9c2f78/src/main/java/com/googlecode/ipv6/IPv6AddressHelpers.java#L100-L138
LearnLib/learnlib
algorithms/active/adt/src/main/java/de/learnlib/algorithms/adt/adt/ADT.java
ADT.extendLeaf
public ADTNode<S, I, O> extendLeaf(final ADTNode<S, I, O> nodeToSplit, final Word<I> distinguishingSuffix, final Word<O> oldOutput, final Word<O> newOutput) { if (!ADTUtil.isLeafNode(nodeToSplit)) { throw new IllegalArgumentException("Node to split is not a leaf node"); } if (!(distinguishingSuffix.length() == oldOutput.length() && oldOutput.length() == newOutput.length())) { throw new IllegalArgumentException("Distinguishing suffixes and outputs differ in length"); } if (oldOutput.equals(newOutput)) { throw new IllegalArgumentException("Old and new output are equal"); } // initial split if (this.root.equals(nodeToSplit)) { return splitLeaf(nodeToSplit, distinguishingSuffix, oldOutput, newOutput); } return LeafSplitters.splitParent(nodeToSplit, distinguishingSuffix, oldOutput, newOutput); }
java
public ADTNode<S, I, O> extendLeaf(final ADTNode<S, I, O> nodeToSplit, final Word<I> distinguishingSuffix, final Word<O> oldOutput, final Word<O> newOutput) { if (!ADTUtil.isLeafNode(nodeToSplit)) { throw new IllegalArgumentException("Node to split is not a leaf node"); } if (!(distinguishingSuffix.length() == oldOutput.length() && oldOutput.length() == newOutput.length())) { throw new IllegalArgumentException("Distinguishing suffixes and outputs differ in length"); } if (oldOutput.equals(newOutput)) { throw new IllegalArgumentException("Old and new output are equal"); } // initial split if (this.root.equals(nodeToSplit)) { return splitLeaf(nodeToSplit, distinguishingSuffix, oldOutput, newOutput); } return LeafSplitters.splitParent(nodeToSplit, distinguishingSuffix, oldOutput, newOutput); }
[ "public", "ADTNode", "<", "S", ",", "I", ",", "O", ">", "extendLeaf", "(", "final", "ADTNode", "<", "S", ",", "I", ",", "O", ">", "nodeToSplit", ",", "final", "Word", "<", "I", ">", "distinguishingSuffix", ",", "final", "Word", "<", "O", ">", "oldO...
Splitting a leaf node by extending the trace leading into the node to split. @param nodeToSplit the leaf node to extends @param distinguishingSuffix the input sequence that splits the hypothesis state of the leaf to split and the new node. The current trace leading into the node to split must be a prefix of this word. @param oldOutput the hypothesis output of the node to split given the distinguishing suffix @param newOutput the hypothesis output of the new leaf given the distinguishing suffix @return the new leaf node
[ "Splitting", "a", "leaf", "node", "by", "extending", "the", "trace", "leading", "into", "the", "node", "to", "split", "." ]
train
https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/algorithms/active/adt/src/main/java/de/learnlib/algorithms/adt/adt/ADT.java#L146-L166
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/util/FileUtils.java
FileUtils.getFileResource
public static Resource getFileResource(String filePath, TestContext context) { if (filePath.contains(FILE_PATH_CHARSET_PARAMETER)) { return new PathMatchingResourcePatternResolver().getResource( context.replaceDynamicContentInString(filePath.substring(0, filePath.indexOf(FileUtils.FILE_PATH_CHARSET_PARAMETER)))); } else { return new PathMatchingResourcePatternResolver().getResource( context.replaceDynamicContentInString(filePath)); } }
java
public static Resource getFileResource(String filePath, TestContext context) { if (filePath.contains(FILE_PATH_CHARSET_PARAMETER)) { return new PathMatchingResourcePatternResolver().getResource( context.replaceDynamicContentInString(filePath.substring(0, filePath.indexOf(FileUtils.FILE_PATH_CHARSET_PARAMETER)))); } else { return new PathMatchingResourcePatternResolver().getResource( context.replaceDynamicContentInString(filePath)); } }
[ "public", "static", "Resource", "getFileResource", "(", "String", "filePath", ",", "TestContext", "context", ")", "{", "if", "(", "filePath", ".", "contains", "(", "FILE_PATH_CHARSET_PARAMETER", ")", ")", "{", "return", "new", "PathMatchingResourcePatternResolver", ...
Reads file resource from path with variable replacement support. @param filePath @param context @return
[ "Reads", "file", "resource", "from", "path", "with", "variable", "replacement", "support", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/util/FileUtils.java#L243-L251
TNG/JGiven
jgiven-core/src/main/java/com/tngtech/jgiven/report/json/JsonModelTraverser.java
JsonModelTraverser.traverseModels
public void traverseModels( File sourceDirectory, ReportModelFileHandler handler ) { for( ReportModelFile f : Files.fileTreeTraverser().breadthFirstTraversal( sourceDirectory ) .filter( FilePredicates.endsWith( ".json" ) ) .transform( new ReportModelFileReader() ) ) { handler.handleReportModel( f ); } }
java
public void traverseModels( File sourceDirectory, ReportModelFileHandler handler ) { for( ReportModelFile f : Files.fileTreeTraverser().breadthFirstTraversal( sourceDirectory ) .filter( FilePredicates.endsWith( ".json" ) ) .transform( new ReportModelFileReader() ) ) { handler.handleReportModel( f ); } }
[ "public", "void", "traverseModels", "(", "File", "sourceDirectory", ",", "ReportModelFileHandler", "handler", ")", "{", "for", "(", "ReportModelFile", "f", ":", "Files", ".", "fileTreeTraverser", "(", ")", ".", "breadthFirstTraversal", "(", "sourceDirectory", ")", ...
Reads all JSON files from {@code sourceDirectory} and invokes for each found file the {@link ReportModelFileHandler#handleReportModel} method of the given {@code handler}. @param sourceDirectory the directory that contains the JSON files @param handler the handler to be invoked for each file
[ "Reads", "all", "JSON", "files", "from", "{", "@code", "sourceDirectory", "}", "and", "invokes", "for", "each", "found", "file", "the", "{", "@link", "ReportModelFileHandler#handleReportModel", "}", "method", "of", "the", "given", "{", "@code", "handler", "}", ...
train
https://github.com/TNG/JGiven/blob/1a69248fc6d7eb380cdc4542e3be273842889748/jgiven-core/src/main/java/com/tngtech/jgiven/report/json/JsonModelTraverser.java#L18-L24
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/f/EpipolarMinimizeGeometricError.java
EpipolarMinimizeGeometricError.process
public boolean process(DMatrixRMaj F21 , double x1 , double y1, double x2, double y2, Point2D_F64 p1 , Point2D_F64 p2 ) { // translations used to move points to the origin assignTinv(T1,x1,y1); assignTinv(T2,x2,y2); // take F to the new coordinate system // F1 = T2'*F*T1 PerspectiveOps.multTranA(T2,F21,T1,Ft); extract.process(Ft,e1,e2); // normalize so that e[x]*e[x] + e[y]*e[y] == 1 normalizeEpipole(e1); normalizeEpipole(e2); assignR(R1,e1); assignR(R2,e2); // Ft = R2*Ft*R1' PerspectiveOps.multTranC(R2,Ft,R1,Ft); double f1 = e1.z; double f2 = e2.z; double a = Ft.get(1,1); double b = Ft.get(1,2); double c = Ft.get(2,1); double d = Ft.get(2,2); if( !solvePolynomial(f1,f2,a,b,c,d)) return false; if( !selectBestSolution(rootFinder.getRoots(),f1,f2,a,b,c,d)) return false; // find the closeset point on the two lines below to the origin double t = solutionT; l1.set(t*f1,1,-t); l2.set(-f2*(c*t+d),a*t+b,c*t+d); closestPointToOrigin(l1,e1); // recycle epipole storage closestPointToOrigin(l2,e2); // original coordinates originalCoordinates(T1,R1,e1); originalCoordinates(T2,R2,e2); // back to 2D coordinates p1.set(e1.x/e1.z, e1.y/e1.z); p2.set(e2.x/e2.z, e2.y/e2.z); return true; }
java
public boolean process(DMatrixRMaj F21 , double x1 , double y1, double x2, double y2, Point2D_F64 p1 , Point2D_F64 p2 ) { // translations used to move points to the origin assignTinv(T1,x1,y1); assignTinv(T2,x2,y2); // take F to the new coordinate system // F1 = T2'*F*T1 PerspectiveOps.multTranA(T2,F21,T1,Ft); extract.process(Ft,e1,e2); // normalize so that e[x]*e[x] + e[y]*e[y] == 1 normalizeEpipole(e1); normalizeEpipole(e2); assignR(R1,e1); assignR(R2,e2); // Ft = R2*Ft*R1' PerspectiveOps.multTranC(R2,Ft,R1,Ft); double f1 = e1.z; double f2 = e2.z; double a = Ft.get(1,1); double b = Ft.get(1,2); double c = Ft.get(2,1); double d = Ft.get(2,2); if( !solvePolynomial(f1,f2,a,b,c,d)) return false; if( !selectBestSolution(rootFinder.getRoots(),f1,f2,a,b,c,d)) return false; // find the closeset point on the two lines below to the origin double t = solutionT; l1.set(t*f1,1,-t); l2.set(-f2*(c*t+d),a*t+b,c*t+d); closestPointToOrigin(l1,e1); // recycle epipole storage closestPointToOrigin(l2,e2); // original coordinates originalCoordinates(T1,R1,e1); originalCoordinates(T2,R2,e2); // back to 2D coordinates p1.set(e1.x/e1.z, e1.y/e1.z); p2.set(e2.x/e2.z, e2.y/e2.z); return true; }
[ "public", "boolean", "process", "(", "DMatrixRMaj", "F21", ",", "double", "x1", ",", "double", "y1", ",", "double", "x2", ",", "double", "y2", ",", "Point2D_F64", "p1", ",", "Point2D_F64", "p2", ")", "{", "// translations used to move points to the origin", "ass...
Minimizes the geometric error @param F21 (Input) Fundamental matrix x2 * F21 * x1 == 0 @param x1 (Input) Point 1 x-coordinate. Pixels @param y1 (Input) Point 1 y-coordinate. Pixels @param x2 (Input) Point 2 x-coordinate. Pixels @param y2 (Input) Point 2 y-coordinate. Pixels @param p1 (Output) Point 1. Pixels @param p2 (Output) Point 2. Pixels @return true if a solution was found or false if it failed
[ "Minimizes", "the", "geometric", "error" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/f/EpipolarMinimizeGeometricError.java#L87-L140
ziccardi/jnrpe
jnrpe-lib/src/main/java/it/jnrpe/utils/PluginRepositoryUtil.java
PluginRepositoryUtil.parseXmlPluginDefinition
public static PluginDefinition parseXmlPluginDefinition(final ClassLoader cl, final InputStream in) throws PluginConfigurationException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); Document document; try { DocumentBuilder loader = factory.newDocumentBuilder(); DOMReader reader = new DOMReader(); document = reader.read(loader.parse(in)); } catch (Exception e) { throw new PluginConfigurationException(e.getMessage(), e); } Element plugin = document.getRootElement(); // TODO : validate against schema return parsePluginDefinition(cl, plugin); }
java
public static PluginDefinition parseXmlPluginDefinition(final ClassLoader cl, final InputStream in) throws PluginConfigurationException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); Document document; try { DocumentBuilder loader = factory.newDocumentBuilder(); DOMReader reader = new DOMReader(); document = reader.read(loader.parse(in)); } catch (Exception e) { throw new PluginConfigurationException(e.getMessage(), e); } Element plugin = document.getRootElement(); // TODO : validate against schema return parsePluginDefinition(cl, plugin); }
[ "public", "static", "PluginDefinition", "parseXmlPluginDefinition", "(", "final", "ClassLoader", "cl", ",", "final", "InputStream", "in", ")", "throws", "PluginConfigurationException", "{", "DocumentBuilderFactory", "factory", "=", "DocumentBuilderFactory", ".", "newInstanc...
Loads the definition of a single plugin from an XML file. @param cl The classloader to be used to instantiate the plugin class @param in The stream to the XML file @return The plugin definition @throws PluginConfigurationException if an error occurs parsing the plugin definition
[ "Loads", "the", "definition", "of", "a", "single", "plugin", "from", "an", "XML", "file", "." ]
train
https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-lib/src/main/java/it/jnrpe/utils/PluginRepositoryUtil.java#L125-L145
cdk/cdk
tool/formula/src/main/java/org/openscience/cdk/formula/MolecularFormulaGenerator.java
MolecularFormulaGenerator.isIllPosed
private static boolean isIllPosed(double minMass, double maxMass, MolecularFormulaRange mfRange) { // when the number of integers to decompose is incredible large // we have to adjust the internal settings (e.g. precision!) // instead we simply fallback to the full enumeration method if (maxMass - minMass >= 1) return true; if (maxMass > 400000) return true; // if the number of elements to decompose is very small // we fall back to the full enumeration methods as the // minimal decomposable mass of a certain residue class might // exceed the 32 bit integer space if (mfRange.getIsotopeCount() <= 2) return true; // if the mass of the smallest element in alphabet is large // it is more efficient to use the full enumeration method double smallestMass = Double.POSITIVE_INFINITY; for (IIsotope i : mfRange.isotopes()) { smallestMass = Math.min(smallestMass, i.getExactMass()); } return smallestMass > 5; }
java
private static boolean isIllPosed(double minMass, double maxMass, MolecularFormulaRange mfRange) { // when the number of integers to decompose is incredible large // we have to adjust the internal settings (e.g. precision!) // instead we simply fallback to the full enumeration method if (maxMass - minMass >= 1) return true; if (maxMass > 400000) return true; // if the number of elements to decompose is very small // we fall back to the full enumeration methods as the // minimal decomposable mass of a certain residue class might // exceed the 32 bit integer space if (mfRange.getIsotopeCount() <= 2) return true; // if the mass of the smallest element in alphabet is large // it is more efficient to use the full enumeration method double smallestMass = Double.POSITIVE_INFINITY; for (IIsotope i : mfRange.isotopes()) { smallestMass = Math.min(smallestMass, i.getExactMass()); } return smallestMass > 5; }
[ "private", "static", "boolean", "isIllPosed", "(", "double", "minMass", ",", "double", "maxMass", ",", "MolecularFormulaRange", "mfRange", ")", "{", "// when the number of integers to decompose is incredible large", "// we have to adjust the internal settings (e.g. precision!)", "/...
Decides wheter to use the round robin algorithm or full enumeration algorithm. The round robin implementation here is optimized for chemical elements in organic compounds. It gets slow if - the mass of the smallest element is very large (i.e. hydrogen is not allowed) - the maximal mass to decompose is too large (round robin always decomposes integers. Therefore, the mass have to be small enough to be represented as 32 bit integer) - the number of elements in the set is extremely small (in this case, however, the problem becomes trivial anyways) In theory we could handle these problems by optimizing the way DECOMP discretizes the masses. However, it's easier to just fall back to the full enumeration method if a problem occurs (especially, because most of the problems lead to trivial cases that are fast to compute). @return true if the problem is ill-posed (i.e. should be calculated by full enumeration method)
[ "Decides", "wheter", "to", "use", "the", "round", "robin", "algorithm", "or", "full", "enumeration", "algorithm", ".", "The", "round", "robin", "implementation", "here", "is", "optimized", "for", "chemical", "elements", "in", "organic", "compounds", ".", "It", ...
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/formula/src/main/java/org/openscience/cdk/formula/MolecularFormulaGenerator.java#L94-L114
mojohaus/aspectj-maven-plugin
src/main/java/org/codehaus/mojo/aspectj/AjcHelper.java
AjcHelper.getBuildFilesForAjdtFile
public static Set<String> getBuildFilesForAjdtFile( String ajdtBuildDefFile, File basedir ) throws MojoExecutionException { Set<String> result = new LinkedHashSet<String>(); Properties ajdtBuildProperties = new Properties(); try { ajdtBuildProperties.load( new FileInputStream( new File( basedir, ajdtBuildDefFile ) ) ); } catch ( FileNotFoundException e ) { throw new MojoExecutionException( "Build properties file specified not found", e ); } catch ( IOException e ) { throw new MojoExecutionException( "IO Error reading build properties file specified", e ); } result.addAll( resolveIncludeExcludeString( ajdtBuildProperties.getProperty( "src.includes" ), basedir ) ); Set<String> exludes = resolveIncludeExcludeString( ajdtBuildProperties.getProperty( "src.excludes" ), basedir ); result.removeAll( exludes ); return result; }
java
public static Set<String> getBuildFilesForAjdtFile( String ajdtBuildDefFile, File basedir ) throws MojoExecutionException { Set<String> result = new LinkedHashSet<String>(); Properties ajdtBuildProperties = new Properties(); try { ajdtBuildProperties.load( new FileInputStream( new File( basedir, ajdtBuildDefFile ) ) ); } catch ( FileNotFoundException e ) { throw new MojoExecutionException( "Build properties file specified not found", e ); } catch ( IOException e ) { throw new MojoExecutionException( "IO Error reading build properties file specified", e ); } result.addAll( resolveIncludeExcludeString( ajdtBuildProperties.getProperty( "src.includes" ), basedir ) ); Set<String> exludes = resolveIncludeExcludeString( ajdtBuildProperties.getProperty( "src.excludes" ), basedir ); result.removeAll( exludes ); return result; }
[ "public", "static", "Set", "<", "String", ">", "getBuildFilesForAjdtFile", "(", "String", "ajdtBuildDefFile", ",", "File", "basedir", ")", "throws", "MojoExecutionException", "{", "Set", "<", "String", ">", "result", "=", "new", "LinkedHashSet", "<", "String", "...
Based on a AJDT build properties file resolves the combination of all include and exclude statements and returns a set of all the files to be compiled and weaved. @param ajdtBuildDefFile the ajdtBuildDefFile @param basedir the baseDirectory @return @throws MojoExecutionException
[ "Based", "on", "a", "AJDT", "build", "properties", "file", "resolves", "the", "combination", "of", "all", "include", "and", "exclude", "statements", "and", "returns", "a", "set", "of", "all", "the", "files", "to", "be", "compiled", "and", "weaved", "." ]
train
https://github.com/mojohaus/aspectj-maven-plugin/blob/120ee1ce08b93873931035ed98cd70e3ccceeefb/src/main/java/org/codehaus/mojo/aspectj/AjcHelper.java#L136-L159
gallandarakhneorg/afc
advanced/attributes/src/main/java/org/arakhne/afc/attrs/attr/AttributeValueImpl.java
AttributeValueImpl.compareValues
@Pure public static int compareValues(AttributeValue arg0, AttributeValue arg1) { if (arg0 == arg1) { return 0; } if (arg0 == null) { return Integer.MAX_VALUE; } if (arg1 == null) { return Integer.MIN_VALUE; } Object v0; Object v1; try { v0 = arg0.getValue(); } catch (Exception exception) { v0 = null; } try { v1 = arg1.getValue(); } catch (Exception exception) { v1 = null; } return compareRawValues(v0, v1); }
java
@Pure public static int compareValues(AttributeValue arg0, AttributeValue arg1) { if (arg0 == arg1) { return 0; } if (arg0 == null) { return Integer.MAX_VALUE; } if (arg1 == null) { return Integer.MIN_VALUE; } Object v0; Object v1; try { v0 = arg0.getValue(); } catch (Exception exception) { v0 = null; } try { v1 = arg1.getValue(); } catch (Exception exception) { v1 = null; } return compareRawValues(v0, v1); }
[ "@", "Pure", "public", "static", "int", "compareValues", "(", "AttributeValue", "arg0", ",", "AttributeValue", "arg1", ")", "{", "if", "(", "arg0", "==", "arg1", ")", "{", "return", "0", ";", "}", "if", "(", "arg0", "==", "null", ")", "{", "return", ...
Compare the two specified values. @param arg0 first value. @param arg1 second value. @return replies a negative value if {@code arg0} is lesser than {@code arg1}, a positive value if {@code arg0} is greater than {@code arg1}, or <code>0</code> if they are equal. @see AttributeValueComparator
[ "Compare", "the", "two", "specified", "values", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/attributes/src/main/java/org/arakhne/afc/attrs/attr/AttributeValueImpl.java#L464-L492
raydac/netbeans-mmd-plugin
mind-map/mind-map-swing-panel/src/main/java/com/igormaznitsa/mindmap/swing/panel/MindMapPanel.java
MindMapPanel.copyTopicsToClipboard
public boolean copyTopicsToClipboard(final boolean cut, @Nonnull @MustNotContainNull final Topic... topics) { boolean result = false; if (this.lockIfNotDisposed()) { try { if (topics.length > 0) { final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(new MMDTopicsTransferable(topics), this); if (cut) { deleteTopics(true, ensureNoRootInArray(topics)); } result = true; } } finally { this.unlock(); } } return result; }
java
public boolean copyTopicsToClipboard(final boolean cut, @Nonnull @MustNotContainNull final Topic... topics) { boolean result = false; if (this.lockIfNotDisposed()) { try { if (topics.length > 0) { final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(new MMDTopicsTransferable(topics), this); if (cut) { deleteTopics(true, ensureNoRootInArray(topics)); } result = true; } } finally { this.unlock(); } } return result; }
[ "public", "boolean", "copyTopicsToClipboard", "(", "final", "boolean", "cut", ",", "@", "Nonnull", "@", "MustNotContainNull", "final", "Topic", "...", "topics", ")", "{", "boolean", "result", "=", "false", ";", "if", "(", "this", ".", "lockIfNotDisposed", "(",...
Create transferable topic list in system clipboard. @param cut true shows that remove topics after placing into clipboard @param topics topics to be placed into clipboard, if there are successors and ancestors then successors will be removed @return true if topic array is not empty and operation completed successfully, false otherwise @since 1.3.1
[ "Create", "transferable", "topic", "list", "in", "system", "clipboard", "." ]
train
https://github.com/raydac/netbeans-mmd-plugin/blob/997493d23556a25354372b6419a64a0fbd0ac6ba/mind-map/mind-map-swing-panel/src/main/java/com/igormaznitsa/mindmap/swing/panel/MindMapPanel.java#L2647-L2668
google/closure-compiler
src/com/google/javascript/rhino/Node.java
Node.writeEncodedInt
@GwtIncompatible("ObjectOutput") private void writeEncodedInt(ObjectOutput out, int value) throws IOException { while (value > 0X7f || value < 0) { out.writeByte(((value & 0X7f) | 0x80)); value >>>= 7; } out.writeByte(value); }
java
@GwtIncompatible("ObjectOutput") private void writeEncodedInt(ObjectOutput out, int value) throws IOException { while (value > 0X7f || value < 0) { out.writeByte(((value & 0X7f) | 0x80)); value >>>= 7; } out.writeByte(value); }
[ "@", "GwtIncompatible", "(", "\"ObjectOutput\"", ")", "private", "void", "writeEncodedInt", "(", "ObjectOutput", "out", ",", "int", "value", ")", "throws", "IOException", "{", "while", "(", "value", ">", "0X7f", "||", "value", "<", "0", ")", "{", "out", "....
Encode integers using variable length encoding. Encodes an integer as a sequence of 7-bit values with a continuation bit. For example the number 3912 (0111 0100 1000) is encoded in two bytes as follows 0xC80E (1100 1000 0000 1110), i.e. first byte will be the lower 7 bits with a continuation bit set and second byte will consist of the upper 7 bits with the continuation bit unset. This encoding aims to reduce the serialized footprint for the most common values, reducing the footprint for all positive values that are smaller than 2^21 (~2000000): 0 - 127 are encoded in one byte 128 - 16384 are encoded in two bytes 16385 - 2097152 are encoded in three bytes 2097153 - 268435456 are encoded in four bytes. values greater than 268435456 and negative values are encoded in 5 bytes. Most values for the length field will be encoded with one byte and most values for sourcePosition will be encoded with 2 or 3 bytes. (Value -1, which is used to mark absence will use 5 bytes, and could be accommodated in the present scheme by an offset of 1 if it leads to size improvements).
[ "Encode", "integers", "using", "variable", "length", "encoding", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/Node.java#L3504-L3511
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDOAuth2UserDaoImpl.java
GeneratedDOAuth2UserDaoImpl.findByEmail
public DOAuth2User findByEmail(java.lang.String email) { return queryUniqueByField(null, DOAuth2UserMapper.Field.EMAIL.getFieldName(), email); }
java
public DOAuth2User findByEmail(java.lang.String email) { return queryUniqueByField(null, DOAuth2UserMapper.Field.EMAIL.getFieldName(), email); }
[ "public", "DOAuth2User", "findByEmail", "(", "java", ".", "lang", ".", "String", "email", ")", "{", "return", "queryUniqueByField", "(", "null", ",", "DOAuth2UserMapper", ".", "Field", ".", "EMAIL", ".", "getFieldName", "(", ")", ",", "email", ")", ";", "}...
find-by method for unique field email @param email the unique attribute @return the unique DOAuth2User for the specified email
[ "find", "-", "by", "method", "for", "unique", "field", "email" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDOAuth2UserDaoImpl.java#L97-L99
glyptodon/guacamole-client
extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ConnectionService.java
ConnectionService.retrieveHistory
public List<ConnectionRecord> retrieveHistory(ModeledAuthenticatedUser user, ModeledConnection connection) throws GuacamoleException { String identifier = connection.getIdentifier(); // Retrieve history only if READ permission is granted if (hasObjectPermission(user, identifier, ObjectPermission.Type.READ)) { // Retrieve history List<ConnectionRecordModel> models = connectionRecordMapper.select(identifier); // Get currently-active connections List<ConnectionRecord> records = new ArrayList<ConnectionRecord>(tunnelService.getActiveConnections(connection)); Collections.reverse(records); // Add past connections from model objects for (ConnectionRecordModel model : models) records.add(getObjectInstance(model)); // Return converted history list return records; } // The user does not have permission to read the history throw new GuacamoleSecurityException("Permission denied."); }
java
public List<ConnectionRecord> retrieveHistory(ModeledAuthenticatedUser user, ModeledConnection connection) throws GuacamoleException { String identifier = connection.getIdentifier(); // Retrieve history only if READ permission is granted if (hasObjectPermission(user, identifier, ObjectPermission.Type.READ)) { // Retrieve history List<ConnectionRecordModel> models = connectionRecordMapper.select(identifier); // Get currently-active connections List<ConnectionRecord> records = new ArrayList<ConnectionRecord>(tunnelService.getActiveConnections(connection)); Collections.reverse(records); // Add past connections from model objects for (ConnectionRecordModel model : models) records.add(getObjectInstance(model)); // Return converted history list return records; } // The user does not have permission to read the history throw new GuacamoleSecurityException("Permission denied."); }
[ "public", "List", "<", "ConnectionRecord", ">", "retrieveHistory", "(", "ModeledAuthenticatedUser", "user", ",", "ModeledConnection", "connection", ")", "throws", "GuacamoleException", "{", "String", "identifier", "=", "connection", ".", "getIdentifier", "(", ")", ";"...
Retrieves the connection history of the given connection, including any active connections. @param user The user retrieving the connection history. @param connection The connection whose history is being retrieved. @return The connection history of the given connection, including any active connections. @throws GuacamoleException If permission to read the connection history is denied.
[ "Retrieves", "the", "connection", "history", "of", "the", "given", "connection", "including", "any", "active", "connections", "." ]
train
https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ConnectionService.java#L410-L437
lessthanoptimal/BoofCV
main/boofcv-types/src/main/java/boofcv/struct/convolve/Kernel1D_F32.java
Kernel1D_F32.wrap
public static Kernel1D_F32 wrap(float data[], int width, int offset ) { Kernel1D_F32 ret = new Kernel1D_F32(); ret.data = data; ret.width = width; ret.offset = offset; return ret; }
java
public static Kernel1D_F32 wrap(float data[], int width, int offset ) { Kernel1D_F32 ret = new Kernel1D_F32(); ret.data = data; ret.width = width; ret.offset = offset; return ret; }
[ "public", "static", "Kernel1D_F32", "wrap", "(", "float", "data", "[", "]", ",", "int", "width", ",", "int", "offset", ")", "{", "Kernel1D_F32", "ret", "=", "new", "Kernel1D_F32", "(", ")", ";", "ret", ".", "data", "=", "data", ";", "ret", ".", "widt...
Creates a kernel whose elements are the specified data array and has the specified width. @param data The array who will be the kernel's data. Reference is saved. @param width The kernel's width. @param offset Location of the origin in the array @return A new kernel.
[ "Creates", "a", "kernel", "whose", "elements", "are", "the", "specified", "data", "array", "and", "has", "the", "specified", "width", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/struct/convolve/Kernel1D_F32.java#L102-L109
OpenNTF/JavascriptAggregator
jaggr-core/src/main/java/com/ibm/jaggr/core/impl/AbstractAggregatorImpl.java
AbstractAggregatorImpl.notifyRequestListeners
protected void notifyRequestListeners(RequestNotifierAction action, HttpServletRequest req, HttpServletResponse resp) throws IOException { // notify any listeners that the config has been updated IServiceReference[] refs = null; try { refs = getPlatformServices().getServiceReferences(IRequestListener.class.getName(), "(name="+getName()+")"); //$NON-NLS-1$ //$NON-NLS-2$ } catch (PlatformServicesException e) { if (log.isLoggable(Level.SEVERE)) { log.log(Level.SEVERE, e.getMessage(), e); } } if (refs != null) { for (IServiceReference ref : refs) { IRequestListener listener = (IRequestListener)getPlatformServices().getService(ref); try { if (action == RequestNotifierAction.start) { listener.startRequest(req, resp); } else { listener.endRequest(req, resp); } } finally { getPlatformServices().ungetService(ref); } } } }
java
protected void notifyRequestListeners(RequestNotifierAction action, HttpServletRequest req, HttpServletResponse resp) throws IOException { // notify any listeners that the config has been updated IServiceReference[] refs = null; try { refs = getPlatformServices().getServiceReferences(IRequestListener.class.getName(), "(name="+getName()+")"); //$NON-NLS-1$ //$NON-NLS-2$ } catch (PlatformServicesException e) { if (log.isLoggable(Level.SEVERE)) { log.log(Level.SEVERE, e.getMessage(), e); } } if (refs != null) { for (IServiceReference ref : refs) { IRequestListener listener = (IRequestListener)getPlatformServices().getService(ref); try { if (action == RequestNotifierAction.start) { listener.startRequest(req, resp); } else { listener.endRequest(req, resp); } } finally { getPlatformServices().ungetService(ref); } } } }
[ "protected", "void", "notifyRequestListeners", "(", "RequestNotifierAction", "action", ",", "HttpServletRequest", "req", ",", "HttpServletResponse", "resp", ")", "throws", "IOException", "{", "// notify any listeners that the config has been updated\r", "IServiceReference", "[", ...
Calls the registered request notifier listeners. @param action The request action (start or end) @param req The request object. @param resp The response object. @throws IOException
[ "Calls", "the", "registered", "request", "notifier", "listeners", "." ]
train
https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/AbstractAggregatorImpl.java#L1175-L1199
cesarferreira/AndroidQuickUtils
library/src/main/java/quickutils/core/categories/security.java
security.privateBase64Decoder
private static String privateBase64Decoder(String decode, int flags) { if (flags == -1) { flags = Base64.DEFAULT; } byte[] data1 = Base64.decode(decode, flags); String decodedBase64 = null; try { decodedBase64 = new String(data1, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return decodedBase64; }
java
private static String privateBase64Decoder(String decode, int flags) { if (flags == -1) { flags = Base64.DEFAULT; } byte[] data1 = Base64.decode(decode, flags); String decodedBase64 = null; try { decodedBase64 = new String(data1, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return decodedBase64; }
[ "private", "static", "String", "privateBase64Decoder", "(", "String", "decode", ",", "int", "flags", ")", "{", "if", "(", "flags", "==", "-", "1", ")", "{", "flags", "=", "Base64", ".", "DEFAULT", ";", "}", "byte", "[", "]", "data1", "=", "Base64", "...
Private decoder in base64 @param toDecode String to be encoded @param flags flags to decode the String @return decoded String in base64
[ "Private", "decoder", "in", "base64" ]
train
https://github.com/cesarferreira/AndroidQuickUtils/blob/73a91daedbb9f7be7986ea786fbc441c9e5a881c/library/src/main/java/quickutils/core/categories/security.java#L101-L115
RestComm/sip-servlets
sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java
FacebookRestClient.callMethod
protected T callMethod(IFacebookMethod method, Collection<Pair<String, CharSequence>> paramPairs) throws FacebookException, IOException { HashMap<String, CharSequence> params = new HashMap<String, CharSequence>(2 * method.numTotalParams()); params.put("method", method.methodName()); params.put("api_key", _apiKey); params.put("v", TARGET_API_VERSION); String format = getResponseFormat(); if (null != format) { params.put("format", format); } if (method.requiresSession()) { params.put("call_id", Long.toString(System.currentTimeMillis())); params.put("session_key", _sessionKey); } CharSequence oldVal; for (Pair<String, CharSequence> p : paramPairs) { oldVal = params.put(p.first, p.second); if (oldVal != null) System.err.printf("For parameter %s, overwrote old value %s with new value %s.", p.first, oldVal, p.second); } assert (!params.containsKey("sig")); String signature = generateSignature(FacebookSignatureUtil.convert(params.entrySet()), method.requiresSession()); params.put("sig", signature); boolean doHttps = this.isDesktop() && FacebookMethod.AUTH_GET_SESSION.equals(method); InputStream data = method.takesFile() ? postFileRequest(method.methodName(), params) : postRequest(method.methodName(), params, doHttps, /*doEncode*/true); return parseCallResult(data, method); }
java
protected T callMethod(IFacebookMethod method, Collection<Pair<String, CharSequence>> paramPairs) throws FacebookException, IOException { HashMap<String, CharSequence> params = new HashMap<String, CharSequence>(2 * method.numTotalParams()); params.put("method", method.methodName()); params.put("api_key", _apiKey); params.put("v", TARGET_API_VERSION); String format = getResponseFormat(); if (null != format) { params.put("format", format); } if (method.requiresSession()) { params.put("call_id", Long.toString(System.currentTimeMillis())); params.put("session_key", _sessionKey); } CharSequence oldVal; for (Pair<String, CharSequence> p : paramPairs) { oldVal = params.put(p.first, p.second); if (oldVal != null) System.err.printf("For parameter %s, overwrote old value %s with new value %s.", p.first, oldVal, p.second); } assert (!params.containsKey("sig")); String signature = generateSignature(FacebookSignatureUtil.convert(params.entrySet()), method.requiresSession()); params.put("sig", signature); boolean doHttps = this.isDesktop() && FacebookMethod.AUTH_GET_SESSION.equals(method); InputStream data = method.takesFile() ? postFileRequest(method.methodName(), params) : postRequest(method.methodName(), params, doHttps, /*doEncode*/true); return parseCallResult(data, method); }
[ "protected", "T", "callMethod", "(", "IFacebookMethod", "method", ",", "Collection", "<", "Pair", "<", "String", ",", "CharSequence", ">", ">", "paramPairs", ")", "throws", "FacebookException", ",", "IOException", "{", "HashMap", "<", "String", ",", "CharSequenc...
Call the specified method, with the given parameters, and return a DOM tree with the results. @param method the fieldName of the method @param paramPairs a list of arguments to the method @throws Exception with a description of any errors given to us by the server.
[ "Call", "the", "specified", "method", "with", "the", "given", "parameters", "and", "return", "a", "DOM", "tree", "with", "the", "results", "." ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L844-L880
ModeShape/modeshape
index-providers/modeshape-elasticsearch-index-provider/src/main/java/org/modeshape/jcr/index/elasticsearch/client/EsClient.java
EsClient.createIndex
public boolean createIndex(String name, String type, EsRequest mappings) throws IOException { if (indexExists(name)) { return true; } CloseableHttpClient client = HttpClients.createDefault(); HttpPost method = new HttpPost(String.format("http://%s:%d/%s", host, port, name)); try { StringEntity requestEntity = new StringEntity(mappings.toString(), ContentType.APPLICATION_JSON); method.setEntity(requestEntity); CloseableHttpResponse resp = client.execute(method); return resp.getStatusLine().getStatusCode() == HttpStatus.SC_OK; } finally { method.releaseConnection(); } }
java
public boolean createIndex(String name, String type, EsRequest mappings) throws IOException { if (indexExists(name)) { return true; } CloseableHttpClient client = HttpClients.createDefault(); HttpPost method = new HttpPost(String.format("http://%s:%d/%s", host, port, name)); try { StringEntity requestEntity = new StringEntity(mappings.toString(), ContentType.APPLICATION_JSON); method.setEntity(requestEntity); CloseableHttpResponse resp = client.execute(method); return resp.getStatusLine().getStatusCode() == HttpStatus.SC_OK; } finally { method.releaseConnection(); } }
[ "public", "boolean", "createIndex", "(", "String", "name", ",", "String", "type", ",", "EsRequest", "mappings", ")", "throws", "IOException", "{", "if", "(", "indexExists", "(", "name", ")", ")", "{", "return", "true", ";", "}", "CloseableHttpClient", "clien...
Creates new index. @param name the name of the index to test. @param type index type @param mappings field mapping definition. @return true if index was created. @throws IOException communication exception.
[ "Creates", "new", "index", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/index-providers/modeshape-elasticsearch-index-provider/src/main/java/org/modeshape/jcr/index/elasticsearch/client/EsClient.java#L80-L95
line/armeria
core/src/main/java/com/linecorp/armeria/client/HttpChannelPool.java
HttpChannelPool.acquireNow
@Nullable PooledChannel acquireNow(SessionProtocol desiredProtocol, PoolKey key) { PooledChannel ch; switch (desiredProtocol) { case HTTP: ch = acquireNowExact(key, SessionProtocol.H2C); if (ch == null) { ch = acquireNowExact(key, SessionProtocol.H1C); } break; case HTTPS: ch = acquireNowExact(key, SessionProtocol.H2); if (ch == null) { ch = acquireNowExact(key, SessionProtocol.H1); } break; default: ch = acquireNowExact(key, desiredProtocol); } return ch; }
java
@Nullable PooledChannel acquireNow(SessionProtocol desiredProtocol, PoolKey key) { PooledChannel ch; switch (desiredProtocol) { case HTTP: ch = acquireNowExact(key, SessionProtocol.H2C); if (ch == null) { ch = acquireNowExact(key, SessionProtocol.H1C); } break; case HTTPS: ch = acquireNowExact(key, SessionProtocol.H2); if (ch == null) { ch = acquireNowExact(key, SessionProtocol.H1); } break; default: ch = acquireNowExact(key, desiredProtocol); } return ch; }
[ "@", "Nullable", "PooledChannel", "acquireNow", "(", "SessionProtocol", "desiredProtocol", ",", "PoolKey", "key", ")", "{", "PooledChannel", "ch", ";", "switch", "(", "desiredProtocol", ")", "{", "case", "HTTP", ":", "ch", "=", "acquireNowExact", "(", "key", "...
Attempts to acquire a {@link Channel} which is matched by the specified condition immediately. @return {@code null} is there's no match left in the pool and thus a new connection has to be requested via {@link #acquireLater(SessionProtocol, PoolKey, ClientConnectionTimingsBuilder)}.
[ "Attempts", "to", "acquire", "a", "{", "@link", "Channel", "}", "which", "is", "matched", "by", "the", "specified", "condition", "immediately", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/HttpChannelPool.java#L162-L182
VoltDB/voltdb
src/frontend/org/voltdb/sysprocs/AdHocNTBase.java
AdHocNTBase.processAdHocSQLStmtTypes
public static AdHocSQLMix processAdHocSQLStmtTypes(String sql, List<String> validatedHomogeonousSQL) { assert(validatedHomogeonousSQL != null); assert(validatedHomogeonousSQL.size() == 0); List<String> sqlStatements = SQLLexer.splitStatements(sql).getCompletelyParsedStmts(); // do initial naive scan of statements for DDL, forbid mixed DDL and (DML|DQL) Boolean hasDDL = null; for (String stmt : sqlStatements) { // Simulate an unhandled exception? (ENG-7653) if (DEBUG_MODE.isTrue() && stmt.equals(DEBUG_EXCEPTION_DDL)) { throw new IndexOutOfBoundsException(DEBUG_EXCEPTION_DDL); } String ddlToken = SQLLexer.extractDDLToken(stmt); if (hasDDL == null) { hasDDL = (ddlToken != null) ? true : false; } else if ((hasDDL && ddlToken == null) || (!hasDDL && ddlToken != null)) { return AdHocSQLMix.MIXED; } validatedHomogeonousSQL.add(stmt); } if (validatedHomogeonousSQL.isEmpty()) { return AdHocSQLMix.EMPTY; } assert(hasDDL != null); return hasDDL ? AdHocSQLMix.ALL_DDL : AdHocSQLMix.ALL_DML_OR_DQL; }
java
public static AdHocSQLMix processAdHocSQLStmtTypes(String sql, List<String> validatedHomogeonousSQL) { assert(validatedHomogeonousSQL != null); assert(validatedHomogeonousSQL.size() == 0); List<String> sqlStatements = SQLLexer.splitStatements(sql).getCompletelyParsedStmts(); // do initial naive scan of statements for DDL, forbid mixed DDL and (DML|DQL) Boolean hasDDL = null; for (String stmt : sqlStatements) { // Simulate an unhandled exception? (ENG-7653) if (DEBUG_MODE.isTrue() && stmt.equals(DEBUG_EXCEPTION_DDL)) { throw new IndexOutOfBoundsException(DEBUG_EXCEPTION_DDL); } String ddlToken = SQLLexer.extractDDLToken(stmt); if (hasDDL == null) { hasDDL = (ddlToken != null) ? true : false; } else if ((hasDDL && ddlToken == null) || (!hasDDL && ddlToken != null)) { return AdHocSQLMix.MIXED; } validatedHomogeonousSQL.add(stmt); } if (validatedHomogeonousSQL.isEmpty()) { return AdHocSQLMix.EMPTY; } assert(hasDDL != null); return hasDDL ? AdHocSQLMix.ALL_DDL : AdHocSQLMix.ALL_DML_OR_DQL; }
[ "public", "static", "AdHocSQLMix", "processAdHocSQLStmtTypes", "(", "String", "sql", ",", "List", "<", "String", ">", "validatedHomogeonousSQL", ")", "{", "assert", "(", "validatedHomogeonousSQL", "!=", "null", ")", ";", "assert", "(", "validatedHomogeonousSQL", "."...
Split a set of one or more semi-colon delimited sql statements into a list. Store the list in validatedHomogeonousSQL. Return whether the SQL is empty, all dml or dql, all ddl, or an invalid mix (AdHocSQLMix) Used by the NT adhoc procs, but also by the experimental in-proc adhoc.
[ "Split", "a", "set", "of", "one", "or", "more", "semi", "-", "colon", "delimited", "sql", "statements", "into", "a", "list", ".", "Store", "the", "list", "in", "validatedHomogeonousSQL", ".", "Return", "whether", "the", "SQL", "is", "empty", "all", "dml", ...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/sysprocs/AdHocNTBase.java#L128-L160
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/util/ClassesManager.java
ClassesManager.isPutAllPermitted
public static boolean isPutAllPermitted(Field destination,Field source){ boolean isFirst = true; boolean isAddAllFunction = false; boolean isPutAllFunction = true; return isAssignableFrom(getGenericString(destination), getGenericString(source), destination.getType(), source.getType(), isFirst, isAddAllFunction, isPutAllFunction); }
java
public static boolean isPutAllPermitted(Field destination,Field source){ boolean isFirst = true; boolean isAddAllFunction = false; boolean isPutAllFunction = true; return isAssignableFrom(getGenericString(destination), getGenericString(source), destination.getType(), source.getType(), isFirst, isAddAllFunction, isPutAllFunction); }
[ "public", "static", "boolean", "isPutAllPermitted", "(", "Field", "destination", ",", "Field", "source", ")", "{", "boolean", "isFirst", "=", "true", ";", "boolean", "isAddAllFunction", "=", "false", ";", "boolean", "isPutAllFunction", "=", "true", ";", "return"...
this method verify that the istruction: <p><code> destination.putAll(source) </code><p>is permitted @param destination destination field @param source source field @return true if the istruction destination.putAll(source) is permitted
[ "this", "method", "verify", "that", "the", "istruction", ":", "<p", ">", "<code", ">", "destination", ".", "putAll", "(", "source", ")", "<", "/", "code", ">", "<p", ">", "is", "permitted" ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/util/ClassesManager.java#L64-L71
fcrepo3/fcrepo
fcrepo-client/fcrepo-client-admin/src/main/java/org/fcrepo/client/FedoraClient.java
FedoraClient.uploadFile
public String uploadFile(File file) throws IOException { HttpPost post = null; try { // prepare the post method post = new HttpPost(getUploadURL()); post.getParams().setParameter("Connection", "Keep-Alive"); // add the file part MultipartEntity entity = new MultipartEntity(); entity.addPart("file", new FileBody(file)); post.setEntity(entity); // execute and get the response HttpResponse response = getHttpClient().execute(post); int responseCode = response.getStatusLine().getStatusCode(); String body = null; try { if (response.getEntity() != null) { body = EntityUtils.toString(response.getEntity()); } } catch (Exception e) { logger.warn("Error reading response body", e); } if (body == null) { body = "[empty response body]"; } body = body.trim(); if (responseCode != HttpStatus.SC_CREATED) { throw new IOException("Upload failed: " + response.getStatusLine().getReasonPhrase() + ": " + replaceNewlines(body, " ")); } else { return replaceNewlines(body, ""); } } finally { if (post != null) { post.releaseConnection(); } } }
java
public String uploadFile(File file) throws IOException { HttpPost post = null; try { // prepare the post method post = new HttpPost(getUploadURL()); post.getParams().setParameter("Connection", "Keep-Alive"); // add the file part MultipartEntity entity = new MultipartEntity(); entity.addPart("file", new FileBody(file)); post.setEntity(entity); // execute and get the response HttpResponse response = getHttpClient().execute(post); int responseCode = response.getStatusLine().getStatusCode(); String body = null; try { if (response.getEntity() != null) { body = EntityUtils.toString(response.getEntity()); } } catch (Exception e) { logger.warn("Error reading response body", e); } if (body == null) { body = "[empty response body]"; } body = body.trim(); if (responseCode != HttpStatus.SC_CREATED) { throw new IOException("Upload failed: " + response.getStatusLine().getReasonPhrase() + ": " + replaceNewlines(body, " ")); } else { return replaceNewlines(body, ""); } } finally { if (post != null) { post.releaseConnection(); } } }
[ "public", "String", "uploadFile", "(", "File", "file", ")", "throws", "IOException", "{", "HttpPost", "post", "=", "null", ";", "try", "{", "// prepare the post method", "post", "=", "new", "HttpPost", "(", "getUploadURL", "(", ")", ")", ";", "post", ".", ...
Upload the given file to Fedora's upload interface via HTTP POST. @return the temporary id which can then be passed to API-M requests as a URL. It will look like uploaded://123
[ "Upload", "the", "given", "file", "to", "Fedora", "s", "upload", "interface", "via", "HTTP", "POST", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-client/fcrepo-client-admin/src/main/java/org/fcrepo/client/FedoraClient.java#L232-L271
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java
NetworkInterfacesInner.getEffectiveRouteTable
public EffectiveRouteListResultInner getEffectiveRouteTable(String resourceGroupName, String networkInterfaceName) { return getEffectiveRouteTableWithServiceResponseAsync(resourceGroupName, networkInterfaceName).toBlocking().last().body(); }
java
public EffectiveRouteListResultInner getEffectiveRouteTable(String resourceGroupName, String networkInterfaceName) { return getEffectiveRouteTableWithServiceResponseAsync(resourceGroupName, networkInterfaceName).toBlocking().last().body(); }
[ "public", "EffectiveRouteListResultInner", "getEffectiveRouteTable", "(", "String", "resourceGroupName", ",", "String", "networkInterfaceName", ")", "{", "return", "getEffectiveRouteTableWithServiceResponseAsync", "(", "resourceGroupName", ",", "networkInterfaceName", ")", ".", ...
Gets all route tables applied to a network interface. @param resourceGroupName The name of the resource group. @param networkInterfaceName The name of the network interface. @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 EffectiveRouteListResultInner object if successful.
[ "Gets", "all", "route", "tables", "applied", "to", "a", "network", "interface", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java#L1192-L1194
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.getAttributeDoubleWithDefault
@Pure public static Double getAttributeDoubleWithDefault(Node document, Double defaultValue, String... path) { assert document != null : AssertMessages.notNullParameter(0); return getAttributeDoubleWithDefault(document, true, defaultValue, path); }
java
@Pure public static Double getAttributeDoubleWithDefault(Node document, Double defaultValue, String... path) { assert document != null : AssertMessages.notNullParameter(0); return getAttributeDoubleWithDefault(document, true, defaultValue, path); }
[ "@", "Pure", "public", "static", "Double", "getAttributeDoubleWithDefault", "(", "Node", "document", ",", "Double", "defaultValue", ",", "String", "...", "path", ")", "{", "assert", "document", "!=", "null", ":", "AssertMessages", ".", "notNullParameter", "(", "...
Replies the double value that corresponds to the specified attribute's path. <p>The path is an ordered list of tag's names and ended by the name of the attribute. Be careful about the fact that the names are case sensitives. @param document is the XML document to explore. @param defaultValue is the default value to reply. @param path is the list of and ended by the attribute's name. @return the double value of the specified attribute or <code>0</code>.
[ "Replies", "the", "double", "value", "that", "corresponds", "to", "the", "specified", "attribute", "s", "path", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L636-L640
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/http/HttpMessage.java
HttpMessage.setField
public String setField(String name, String value) { if (_state!=__MSG_EDITABLE) return null; if (HttpFields.__ContentType.equalsIgnoreCase(name)) { String old=_header.get(name); setContentType(value); return old; } return _header.put(name,value); }
java
public String setField(String name, String value) { if (_state!=__MSG_EDITABLE) return null; if (HttpFields.__ContentType.equalsIgnoreCase(name)) { String old=_header.get(name); setContentType(value); return old; } return _header.put(name,value); }
[ "public", "String", "setField", "(", "String", "name", ",", "String", "value", ")", "{", "if", "(", "_state", "!=", "__MSG_EDITABLE", ")", "return", "null", ";", "if", "(", "HttpFields", ".", "__ContentType", ".", "equalsIgnoreCase", "(", "name", ")", ")",...
Set a field value. If the message is editable, then a header field is set. Otherwise if the message is sending and a HTTP/1.1 version, then a trailer field is set. @param name Name of field @param value New value of field @return Old value of field
[ "Set", "a", "field", "value", ".", "If", "the", "message", "is", "editable", "then", "a", "header", "field", "is", "set", ".", "Otherwise", "if", "the", "message", "is", "sending", "and", "a", "HTTP", "/", "1", ".", "1", "version", "then", "a", "trai...
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/http/HttpMessage.java#L267-L280
elki-project/elki
elki-itemsets/src/main/java/de/lmu/ifi/dbs/elki/algorithm/itemsetmining/APRIORI.java
APRIORI.buildFrequentOneItemsets
protected List<OneItemset> buildFrequentOneItemsets(final Relation<? extends SparseFeatureVector<?>> relation, final int dim, final int needed) { // TODO: use TIntList and prefill appropriately to avoid knowing "dim" // beforehand? int[] counts = new int[dim]; for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { SparseFeatureVector<?> bv = relation.get(iditer); for(int it = bv.iter(); bv.iterValid(it); it = bv.iterAdvance(it)) { counts[bv.iterDim(it)]++; } } if(LOG.isStatistics()) { LOG.statistics(new LongStatistic(STAT + "1-items.candidates", dim)); } // Generate initial candidates of length 1. List<OneItemset> frequent = new ArrayList<>(dim); for(int i = 0; i < dim; i++) { if(counts[i] >= needed) { frequent.add(new OneItemset(i, counts[i])); } } return frequent; }
java
protected List<OneItemset> buildFrequentOneItemsets(final Relation<? extends SparseFeatureVector<?>> relation, final int dim, final int needed) { // TODO: use TIntList and prefill appropriately to avoid knowing "dim" // beforehand? int[] counts = new int[dim]; for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { SparseFeatureVector<?> bv = relation.get(iditer); for(int it = bv.iter(); bv.iterValid(it); it = bv.iterAdvance(it)) { counts[bv.iterDim(it)]++; } } if(LOG.isStatistics()) { LOG.statistics(new LongStatistic(STAT + "1-items.candidates", dim)); } // Generate initial candidates of length 1. List<OneItemset> frequent = new ArrayList<>(dim); for(int i = 0; i < dim; i++) { if(counts[i] >= needed) { frequent.add(new OneItemset(i, counts[i])); } } return frequent; }
[ "protected", "List", "<", "OneItemset", ">", "buildFrequentOneItemsets", "(", "final", "Relation", "<", "?", "extends", "SparseFeatureVector", "<", "?", ">", ">", "relation", ",", "final", "int", "dim", ",", "final", "int", "needed", ")", "{", "// TODO: use TI...
Build the 1-itemsets. @param relation Data relation @param dim Maximum dimensionality @param needed Minimum support needed @return 1-itemsets
[ "Build", "the", "1", "-", "itemsets", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-itemsets/src/main/java/de/lmu/ifi/dbs/elki/algorithm/itemsetmining/APRIORI.java#L198-L219
OpenLiberty/open-liberty
dev/com.ibm.ws.security.javaeesec.cdi/src/com/ibm/ws/security/javaeesec/cdi/extensions/IdentityStoreHandlerServiceImpl.java
IdentityStoreHandlerServiceImpl.createHashtableInSubject
@Override public Subject createHashtableInSubject(String username, @Sensitive String password) throws AuthenticationException { UsernamePasswordCredential credential = new UsernamePasswordCredential(username, password); return createHashtableInSubject(credential); }
java
@Override public Subject createHashtableInSubject(String username, @Sensitive String password) throws AuthenticationException { UsernamePasswordCredential credential = new UsernamePasswordCredential(username, password); return createHashtableInSubject(credential); }
[ "@", "Override", "public", "Subject", "createHashtableInSubject", "(", "String", "username", ",", "@", "Sensitive", "String", "password", ")", "throws", "AuthenticationException", "{", "UsernamePasswordCredential", "credential", "=", "new", "UsernamePasswordCredential", "...
Returns the partial subject for hashtable login @param username @param password @return the partial subject which can be used for hashtable login if username and password are valid. @throws com.ibm.ws.security.authentication.AuthenticationException
[ "Returns", "the", "partial", "subject", "for", "hashtable", "login" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.javaeesec.cdi/src/com/ibm/ws/security/javaeesec/cdi/extensions/IdentityStoreHandlerServiceImpl.java#L63-L67
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/data/ResourceReader.java
ResourceReader._reset
private void _reset() throws UnsupportedEncodingException { try { close(); } catch (IOException e) {} if (lineNo == 0) { return; } InputStream is = ICUData.getStream(root, resourceName); if (is == null) { throw new IllegalArgumentException("Can't open " + resourceName); } InputStreamReader isr = (encoding == null) ? new InputStreamReader(is) : new InputStreamReader(is, encoding); reader = new BufferedReader(isr); lineNo = 0; }
java
private void _reset() throws UnsupportedEncodingException { try { close(); } catch (IOException e) {} if (lineNo == 0) { return; } InputStream is = ICUData.getStream(root, resourceName); if (is == null) { throw new IllegalArgumentException("Can't open " + resourceName); } InputStreamReader isr = (encoding == null) ? new InputStreamReader(is) : new InputStreamReader(is, encoding); reader = new BufferedReader(isr); lineNo = 0; }
[ "private", "void", "_reset", "(", ")", "throws", "UnsupportedEncodingException", "{", "try", "{", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "}", "if", "(", "lineNo", "==", "0", ")", "{", "return", ";", "}", "InputStream",...
Reset to the start by reconstructing the stream and readers. We could also use mark() and reset() on the stream or reader, but that would cause them to keep the stream data around in memory. We don't want that because some of the resource files are large, e.g., 400k.
[ "Reset", "to", "the", "start", "by", "reconstructing", "the", "stream", "and", "readers", ".", "We", "could", "also", "use", "mark", "()", "and", "reset", "()", "on", "the", "stream", "or", "reader", "but", "that", "would", "cause", "them", "to", "keep",...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/data/ResourceReader.java#L238-L255
imsweb/naaccr-xml
src/main/java/com/imsweb/naaccrxml/NaaccrXmlUtils.java
NaaccrXmlUtils.createWriter
public static Writer createWriter(File file) throws NaaccrIOException { OutputStream os = null; try { os = new FileOutputStream(file); if (file.getName().endsWith(".gz")) os = new GZIPOutputStream(os); return new OutputStreamWriter(os, StandardCharsets.UTF_8); } catch (IOException e) { if (os != null) { try { os.close(); } catch (IOException e1) { // give up } } throw new NaaccrIOException(e.getMessage()); } }
java
public static Writer createWriter(File file) throws NaaccrIOException { OutputStream os = null; try { os = new FileOutputStream(file); if (file.getName().endsWith(".gz")) os = new GZIPOutputStream(os); return new OutputStreamWriter(os, StandardCharsets.UTF_8); } catch (IOException e) { if (os != null) { try { os.close(); } catch (IOException e1) { // give up } } throw new NaaccrIOException(e.getMessage()); } }
[ "public", "static", "Writer", "createWriter", "(", "File", "file", ")", "throws", "NaaccrIOException", "{", "OutputStream", "os", "=", "null", ";", "try", "{", "os", "=", "new", "FileOutputStream", "(", "file", ")", ";", "if", "(", "file", ".", "getName", ...
Returns a generic writer for the provided file, taking care of the optional GZ compression. @param file file to create the writer from, cannot be null @return a generic writer to the file, never null @throws NaaccrIOException if the writer cannot be created
[ "Returns", "a", "generic", "writer", "for", "the", "provided", "file", "taking", "care", "of", "the", "optional", "GZ", "compression", "." ]
train
https://github.com/imsweb/naaccr-xml/blob/a3a501faa2a0c3411dd5248b2c1379f279131696/src/main/java/com/imsweb/naaccrxml/NaaccrXmlUtils.java#L504-L525
box/box-java-sdk
src/main/java/com/box/sdk/BoxGroup.java
BoxGroup.createGroup
public static BoxGroup.Info createGroup(BoxAPIConnection api, String name) { return createGroup(api, name, null, null, null, null, null); }
java
public static BoxGroup.Info createGroup(BoxAPIConnection api, String name) { return createGroup(api, name, null, null, null, null, null); }
[ "public", "static", "BoxGroup", ".", "Info", "createGroup", "(", "BoxAPIConnection", "api", ",", "String", "name", ")", "{", "return", "createGroup", "(", "api", ",", "name", ",", "null", ",", "null", ",", "null", ",", "null", ",", "null", ")", ";", "}...
Creates a new group with a specified name. @param api the API connection to be used by the group. @param name the name of the new group. @return info about the created group.
[ "Creates", "a", "new", "group", "with", "a", "specified", "name", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxGroup.java#L63-L65
mapsforge/mapsforge
mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java
MercatorProjection.getPixelRelativeToTile
public static Point getPixelRelativeToTile(LatLong latLong, Tile tile) { return getPixelRelative(latLong, tile.mapSize, tile.getOrigin()); }
java
public static Point getPixelRelativeToTile(LatLong latLong, Tile tile) { return getPixelRelative(latLong, tile.mapSize, tile.getOrigin()); }
[ "public", "static", "Point", "getPixelRelativeToTile", "(", "LatLong", "latLong", ",", "Tile", "tile", ")", "{", "return", "getPixelRelative", "(", "latLong", ",", "tile", ".", "mapSize", ",", "tile", ".", "getOrigin", "(", ")", ")", ";", "}" ]
Calculates the absolute pixel position for a tile and tile size relative to origin @param latLong the geographic position. @param tile tile @return the relative pixel position to the origin values (e.g. for a tile)
[ "Calculates", "the", "absolute", "pixel", "position", "for", "a", "tile", "and", "tile", "size", "relative", "to", "origin" ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java#L175-L177
paymill/paymill-java
src/main/java/com/paymill/services/RefundService.java
RefundService.refundTransaction
public Refund refundTransaction( String transactionId, Integer amount, String description ) { return this.refundTransaction( new Transaction( transactionId ), amount, description ); }
java
public Refund refundTransaction( String transactionId, Integer amount, String description ) { return this.refundTransaction( new Transaction( transactionId ), amount, description ); }
[ "public", "Refund", "refundTransaction", "(", "String", "transactionId", ",", "Integer", "amount", ",", "String", "description", ")", "{", "return", "this", ".", "refundTransaction", "(", "new", "Transaction", "(", "transactionId", ")", ",", "amount", ",", "desc...
This function refunds a {@link Transaction} that has been created previously and was refunded in parts or wasn't refunded at all. The inserted amount will be refunded to the credit card / direct debit of the original {@link Transaction}. There will be some fees for the merchant for every refund. <p> Note: <ul> <li>You can refund parts of a transaction until the transaction amount is fully refunded. But be careful there will be a fee for every refund</li> <li>There is no need to define a currency for refunds, because they will be in the same currency as the original transaction</li> </ul> @param transactionId Id of {@link Transaction}, which will be refunded. @param amount Amount (in cents) which will be charged. @param description Additional description for this refund. @return A {@link Refund} for the given {@link Transaction}.
[ "This", "function", "refunds", "a", "{" ]
train
https://github.com/paymill/paymill-java/blob/17281a0d4376c76f1711af9f09bfc138c90ba65a/src/main/java/com/paymill/services/RefundService.java#L157-L159
looly/hutool
hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java
CollUtil.forEach
public static <T> void forEach(Enumeration<T> enumeration, Consumer<T> consumer) { int index = 0; while (enumeration.hasMoreElements()) { consumer.accept(enumeration.nextElement(), index); index++; } }
java
public static <T> void forEach(Enumeration<T> enumeration, Consumer<T> consumer) { int index = 0; while (enumeration.hasMoreElements()) { consumer.accept(enumeration.nextElement(), index); index++; } }
[ "public", "static", "<", "T", ">", "void", "forEach", "(", "Enumeration", "<", "T", ">", "enumeration", ",", "Consumer", "<", "T", ">", "consumer", ")", "{", "int", "index", "=", "0", ";", "while", "(", "enumeration", ".", "hasMoreElements", "(", ")", ...
循环遍历 {@link Enumeration},使用{@link Consumer} 接受遍历的每条数据,并针对每条数据做处理 @param <T> 集合元素类型 @param enumeration {@link Enumeration} @param consumer {@link Consumer} 遍历的每条数据处理器
[ "循环遍历", "{", "@link", "Enumeration", "}", ",使用", "{", "@link", "Consumer", "}", "接受遍历的每条数据,并针对每条数据做处理" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L2254-L2260
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/distort/brown/AddBrownNtoN_F32.java
AddBrownNtoN_F32.compute
@Override public void compute(float x, float y, Point2D_F32 out) { float[] radial = params.radial; float t1 = params.t1; float t2 = params.t2; float r2 = x*x + y*y; float ri2 = r2; float sum = 0; for( int i = 0; i < radial.length; i++ ) { sum += radial[i]*ri2; ri2 *= r2; } out.x = x*(1 + sum) + 2*t1*x*y + t2*(r2 + 2*x*x); out.y = y*(1 + sum) + t1*(r2 + 2*y*y) + 2*t2*x*y; }
java
@Override public void compute(float x, float y, Point2D_F32 out) { float[] radial = params.radial; float t1 = params.t1; float t2 = params.t2; float r2 = x*x + y*y; float ri2 = r2; float sum = 0; for( int i = 0; i < radial.length; i++ ) { sum += radial[i]*ri2; ri2 *= r2; } out.x = x*(1 + sum) + 2*t1*x*y + t2*(r2 + 2*x*x); out.y = y*(1 + sum) + t1*(r2 + 2*y*y) + 2*t2*x*y; }
[ "@", "Override", "public", "void", "compute", "(", "float", "x", ",", "float", "y", ",", "Point2D_F32", "out", ")", "{", "float", "[", "]", "radial", "=", "params", ".", "radial", ";", "float", "t1", "=", "params", ".", "t1", ";", "float", "t2", "=...
Adds radial distortion @param x Undistorted x-coordinate normalized image coordinates @param y Undistorted y-coordinate normalized image coordinates @param out Distorted normalized image coordinate.
[ "Adds", "radial", "distortion" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/distort/brown/AddBrownNtoN_F32.java#L53-L71
alkacon/opencms-core
src/org/opencms/loader/CmsDumpLoader.java
CmsDumpLoader.canSendLastModifiedHeader
protected boolean canSendLastModifiedHeader(CmsResource resource, HttpServletRequest req, HttpServletResponse res) { // resource state must be unchanged if (resource.getState().isUnchanged() // the request must not have been send by a workplace user (we can't use "304 - not modified" in workplace && !CmsWorkplaceManager.isWorkplaceUser(req) // last modified header must match the time form the resource && CmsFlexController.isNotModifiedSince(req, resource.getDateLastModified())) { long now = System.currentTimeMillis(); if ((resource.getDateReleased() < now) && (resource.getDateExpired() > now)) { // resource is available and not expired CmsFlexController.setDateExpiresHeader(res, resource.getDateExpired(), m_clientCacheMaxAge); // set status 304 - not modified res.setStatus(HttpServletResponse.SC_NOT_MODIFIED); return true; } } return false; }
java
protected boolean canSendLastModifiedHeader(CmsResource resource, HttpServletRequest req, HttpServletResponse res) { // resource state must be unchanged if (resource.getState().isUnchanged() // the request must not have been send by a workplace user (we can't use "304 - not modified" in workplace && !CmsWorkplaceManager.isWorkplaceUser(req) // last modified header must match the time form the resource && CmsFlexController.isNotModifiedSince(req, resource.getDateLastModified())) { long now = System.currentTimeMillis(); if ((resource.getDateReleased() < now) && (resource.getDateExpired() > now)) { // resource is available and not expired CmsFlexController.setDateExpiresHeader(res, resource.getDateExpired(), m_clientCacheMaxAge); // set status 304 - not modified res.setStatus(HttpServletResponse.SC_NOT_MODIFIED); return true; } } return false; }
[ "protected", "boolean", "canSendLastModifiedHeader", "(", "CmsResource", "resource", ",", "HttpServletRequest", "req", ",", "HttpServletResponse", "res", ")", "{", "// resource state must be unchanged", "if", "(", "resource", ".", "getState", "(", ")", ".", "isUnchanged...
Checks if the requested resource must be send to the client by checking the "If-Modified-Since" http header.<p> If the resource has not been modified, the "304 - not modified" header is send to the client and <code>true</code> is returned, otherwise nothing is send and <code>false</code> is returned.<p> @param resource the resource to check @param req the current request @param res the current response @return <code>true</code> if the "304 - not modified" header has been send to the client
[ "Checks", "if", "the", "requested", "resource", "must", "be", "send", "to", "the", "client", "by", "checking", "the", "If", "-", "Modified", "-", "Since", "http", "header", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsDumpLoader.java#L284-L302
grails/grails-core
grails-core/src/main/groovy/grails/util/GrailsClassUtils.java
GrailsClassUtils.getProperty
public static PropertyDescriptor getProperty(Class<?> clazz, String propertyName, Class<?> propertyType) { if (clazz == null || propertyName == null || propertyType == null) { return null; } try { PropertyDescriptor pd = BeanUtils.getPropertyDescriptor(clazz, propertyName); if (pd != null && pd.getPropertyType().equals(propertyType)) { return pd; } return null; } catch (Exception e) { // if there are any errors in instantiating just return null for the moment return null; } }
java
public static PropertyDescriptor getProperty(Class<?> clazz, String propertyName, Class<?> propertyType) { if (clazz == null || propertyName == null || propertyType == null) { return null; } try { PropertyDescriptor pd = BeanUtils.getPropertyDescriptor(clazz, propertyName); if (pd != null && pd.getPropertyType().equals(propertyType)) { return pd; } return null; } catch (Exception e) { // if there are any errors in instantiating just return null for the moment return null; } }
[ "public", "static", "PropertyDescriptor", "getProperty", "(", "Class", "<", "?", ">", "clazz", ",", "String", "propertyName", ",", "Class", "<", "?", ">", "propertyType", ")", "{", "if", "(", "clazz", "==", "null", "||", "propertyName", "==", "null", "||",...
Retrieves a property of the given class of the specified name and type @param clazz The class to retrieve the property from @param propertyName The name of the property @param propertyType The type of the property @return A PropertyDescriptor instance or null if none exists
[ "Retrieves", "a", "property", "of", "the", "given", "class", "of", "the", "specified", "name", "and", "type", "@param", "clazz", "The", "class", "to", "retrieve", "the", "property", "from", "@param", "propertyName", "The", "name", "of", "the", "property", "@...
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/util/GrailsClassUtils.java#L396-L412
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/util/ConcurrentCountingMap.java
ConcurrentCountingMap.put
public int put(final byte[] array, final int offset, final int length, final int value) { final long hash = MurmurHash3.hash(array, offset, length); final WriteLock writeLock = lock[(int)(hash >>> shift)].writeLock(); try { writeLock.lock(); return stripe[(int)(hash >>> shift)].put(array, offset, length, hash, value); } finally { writeLock.unlock(); } }
java
public int put(final byte[] array, final int offset, final int length, final int value) { final long hash = MurmurHash3.hash(array, offset, length); final WriteLock writeLock = lock[(int)(hash >>> shift)].writeLock(); try { writeLock.lock(); return stripe[(int)(hash >>> shift)].put(array, offset, length, hash, value); } finally { writeLock.unlock(); } }
[ "public", "int", "put", "(", "final", "byte", "[", "]", "array", ",", "final", "int", "offset", ",", "final", "int", "length", ",", "final", "int", "value", ")", "{", "final", "long", "hash", "=", "MurmurHash3", ".", "hash", "(", "array", ",", "offse...
Sets the value associated with a given key. @param array a byte array. @param offset the first valid byte in {@code array}. @param length the number of valid elements in {@code array}. @param value a value to be associated with the specified key. @return the previous value of the counter associated with the specified key.
[ "Sets", "the", "value", "associated", "with", "a", "given", "key", "." ]
train
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/util/ConcurrentCountingMap.java#L145-L155
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_trunk_serviceName_externalDisplayedNumber_number_validate_POST
public OvhTrunkExternalDisplayedNumberValidation billingAccount_trunk_serviceName_externalDisplayedNumber_number_validate_POST(String billingAccount, String serviceName, String number) throws IOException { String qPath = "/telephony/{billingAccount}/trunk/{serviceName}/externalDisplayedNumber/{number}/validate"; StringBuilder sb = path(qPath, billingAccount, serviceName, number); String resp = exec(qPath, "POST", sb.toString(), null); return convertTo(resp, OvhTrunkExternalDisplayedNumberValidation.class); }
java
public OvhTrunkExternalDisplayedNumberValidation billingAccount_trunk_serviceName_externalDisplayedNumber_number_validate_POST(String billingAccount, String serviceName, String number) throws IOException { String qPath = "/telephony/{billingAccount}/trunk/{serviceName}/externalDisplayedNumber/{number}/validate"; StringBuilder sb = path(qPath, billingAccount, serviceName, number); String resp = exec(qPath, "POST", sb.toString(), null); return convertTo(resp, OvhTrunkExternalDisplayedNumberValidation.class); }
[ "public", "OvhTrunkExternalDisplayedNumberValidation", "billingAccount_trunk_serviceName_externalDisplayedNumber_number_validate_POST", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "String", "number", ")", "throws", "IOException", "{", "String", "qPath", "=...
Generate a phone call for validation. Returned validation code should be typed when asked. REST: POST /telephony/{billingAccount}/trunk/{serviceName}/externalDisplayedNumber/{number}/validate @param billingAccount [required] The name of your billingAccount @param serviceName [required] Name of the service @param number [required] External displayed number linked to a trunk
[ "Generate", "a", "phone", "call", "for", "validation", ".", "Returned", "validation", "code", "should", "be", "typed", "when", "asked", "." ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L8164-L8169
jayantk/jklol
src/com/jayantkrish/jklol/tensor/DenseTensorBuilder.java
DenseTensorBuilder.incrementWithMultiplier
@Override public void incrementWithMultiplier(TensorBase other, double multiplier) { if (Arrays.equals(other.getDimensionNumbers(), getDimensionNumbers())) { simpleIncrement(other, multiplier); } else { repmatIncrement(other, multiplier); } }
java
@Override public void incrementWithMultiplier(TensorBase other, double multiplier) { if (Arrays.equals(other.getDimensionNumbers(), getDimensionNumbers())) { simpleIncrement(other, multiplier); } else { repmatIncrement(other, multiplier); } }
[ "@", "Override", "public", "void", "incrementWithMultiplier", "(", "TensorBase", "other", ",", "double", "multiplier", ")", "{", "if", "(", "Arrays", ".", "equals", "(", "other", ".", "getDimensionNumbers", "(", ")", ",", "getDimensionNumbers", "(", ")", ")", ...
{@inheritDoc} This implementation supports increments when {@code other} has a subset of {@code this}'s dimensions. In this case, the values in {@code other} are implicitly replicated across all dimensions of {@code this} not present in {@code other}.
[ "{", "@inheritDoc", "}" ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/tensor/DenseTensorBuilder.java#L94-L101
timols/java-gitlab-api
src/main/java/org/gitlab/api/http/GitlabHTTPRequestor.java
GitlabHTTPRequestor.authenticate
public GitlabHTTPRequestor authenticate(String token, TokenType type, AuthMethod method) { this.apiToken = token; this.tokenType = type; this.authMethod = method; return this; }
java
public GitlabHTTPRequestor authenticate(String token, TokenType type, AuthMethod method) { this.apiToken = token; this.tokenType = type; this.authMethod = method; return this; }
[ "public", "GitlabHTTPRequestor", "authenticate", "(", "String", "token", ",", "TokenType", "type", ",", "AuthMethod", "method", ")", "{", "this", ".", "apiToken", "=", "token", ";", "this", ".", "tokenType", "=", "type", ";", "this", ".", "authMethod", "=", ...
Sets authentication data for the request. Has a fluent api for method chaining. @param token The token value @param type The type of the token @param method The authentication method @return this
[ "Sets", "authentication", "data", "for", "the", "request", ".", "Has", "a", "fluent", "api", "for", "method", "chaining", "." ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/http/GitlabHTTPRequestor.java#L66-L71
JOML-CI/JOML
src/org/joml/Quaternionf.java
Quaternionf.lookAlong
public Quaternionf lookAlong(Vector3fc dir, Vector3fc up) { return lookAlong(dir.x(), dir.y(), dir.z(), up.x(), up.y(), up.z(), this); }
java
public Quaternionf lookAlong(Vector3fc dir, Vector3fc up) { return lookAlong(dir.x(), dir.y(), dir.z(), up.x(), up.y(), up.z(), this); }
[ "public", "Quaternionf", "lookAlong", "(", "Vector3fc", "dir", ",", "Vector3fc", "up", ")", "{", "return", "lookAlong", "(", "dir", ".", "x", "(", ")", ",", "dir", ".", "y", "(", ")", ",", "dir", ".", "z", "(", ")", ",", "up", ".", "x", "(", ")...
Apply a rotation to this quaternion that maps the given direction to the positive Z axis. <p> Because there are multiple possibilities for such a rotation, this method will choose the one that ensures the given up direction to remain parallel to the plane spanned by the <code>up</code> and <code>dir</code> vectors. <p> If <code>Q</code> is <code>this</code> quaternion and <code>R</code> the quaternion representing the specified rotation, then the new quaternion will be <code>Q * R</code>. So when transforming a vector <code>v</code> with the new quaternion by using <code>Q * R * v</code>, the rotation added by this method will be applied first! <p> Reference: <a href="http://answers.unity3d.com/questions/467614/what-is-the-source-code-of-quaternionlookrotation.html">http://answers.unity3d.com</a> @see #lookAlong(float, float, float, float, float, float, Quaternionf) @param dir the direction to map to the positive Z axis @param up the vector which will be mapped to a vector parallel to the plane spanned by the given <code>dir</code> and <code>up</code> @return this
[ "Apply", "a", "rotation", "to", "this", "quaternion", "that", "maps", "the", "given", "direction", "to", "the", "positive", "Z", "axis", ".", "<p", ">", "Because", "there", "are", "multiple", "possibilities", "for", "such", "a", "rotation", "this", "method",...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Quaternionf.java#L2091-L2093
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java
EpanetWrapper.ENsetnodevalue
public void ENsetnodevalue( int index, NodeParameters nodeParameter, float value ) throws EpanetException { int errcode = epanet.ENsetnodevalue(index, nodeParameter.getCode(), value); checkError(errcode); }
java
public void ENsetnodevalue( int index, NodeParameters nodeParameter, float value ) throws EpanetException { int errcode = epanet.ENsetnodevalue(index, nodeParameter.getCode(), value); checkError(errcode); }
[ "public", "void", "ENsetnodevalue", "(", "int", "index", ",", "NodeParameters", "nodeParameter", ",", "float", "value", ")", "throws", "EpanetException", "{", "int", "errcode", "=", "epanet", ".", "ENsetnodevalue", "(", "index", ",", "nodeParameter", ".", "getCo...
Sets the value of a parameter for a specific node. @param index node index. @param paramcode parameter code. @param value parameter value. @throws EpanetException
[ "Sets", "the", "value", "of", "a", "parameter", "for", "a", "specific", "node", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java#L610-L613
threerings/nenya
core/src/main/java/com/threerings/media/AbstractMediaManager.java
AbstractMediaManager.queueNotification
public void queueNotification (ObserverList<Object> observers, ObserverOp<Object> event) { _notify.add(new Tuple<ObserverList<Object>,ObserverOp<Object>>(observers, event)); }
java
public void queueNotification (ObserverList<Object> observers, ObserverOp<Object> event) { _notify.add(new Tuple<ObserverList<Object>,ObserverOp<Object>>(observers, event)); }
[ "public", "void", "queueNotification", "(", "ObserverList", "<", "Object", ">", "observers", ",", "ObserverOp", "<", "Object", ">", "event", ")", "{", "_notify", ".", "add", "(", "new", "Tuple", "<", "ObserverList", "<", "Object", ">", ",", "ObserverOp", "...
Queues the notification for dispatching after we've ticked all the media.
[ "Queues", "the", "notification", "for", "dispatching", "after", "we", "ve", "ticked", "all", "the", "media", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/AbstractMediaManager.java#L266-L269
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverter.java
TypeConverter.convertToFloat
public static float convertToFloat (@Nonnull final Object aSrcValue) { if (aSrcValue == null) throw new TypeConverterException (float.class, EReason.NULL_SOURCE_NOT_ALLOWED); final Float aValue = convert (aSrcValue, Float.class); return aValue.floatValue (); }
java
public static float convertToFloat (@Nonnull final Object aSrcValue) { if (aSrcValue == null) throw new TypeConverterException (float.class, EReason.NULL_SOURCE_NOT_ALLOWED); final Float aValue = convert (aSrcValue, Float.class); return aValue.floatValue (); }
[ "public", "static", "float", "convertToFloat", "(", "@", "Nonnull", "final", "Object", "aSrcValue", ")", "{", "if", "(", "aSrcValue", "==", "null", ")", "throw", "new", "TypeConverterException", "(", "float", ".", "class", ",", "EReason", ".", "NULL_SOURCE_NOT...
Convert the passed source value to float @param aSrcValue The source value. May not be <code>null</code>. @return The converted value. @throws TypeConverterException if the source value is <code>null</code> or if no converter was found or if the converter returned a <code>null</code> object. @throws RuntimeException If the converter itself throws an exception @see TypeConverterProviderBestMatch
[ "Convert", "the", "passed", "source", "value", "to", "float" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverter.java#L274-L280
finmath/finmath-lib
src/main/java/net/finmath/montecarlo/interestrate/products/DigitalCaplet.java
DigitalCaplet.getValue
@Override public RandomVariable getValue(double evaluationTime, LIBORModelMonteCarloSimulationModel model) throws CalculationException { // Set payment date and period length double paymentDate = periodEnd; double periodLength = periodEnd - periodStart; // Get random variables RandomVariable libor = model.getLIBOR(optionMaturity, periodStart, periodEnd); RandomVariable trigger = libor.sub(strike).mult(periodLength); RandomVariable values = trigger.choose((new RandomVariableFromDoubleArray(periodLength)), (new RandomVariableFromDoubleArray(0.0))); // Get numeraire and probabilities for payment time RandomVariable numeraire = model.getNumeraire(paymentDate); RandomVariable monteCarloProbabilities = model.getMonteCarloWeights(paymentDate); values = values.div(numeraire).mult(monteCarloProbabilities); // Get numeraire and probabilities for evaluation time RandomVariable numeraireAtEvaluationTime = model.getNumeraire(evaluationTime); RandomVariable monteCarloProbabilitiesAtEvaluationTime = model.getMonteCarloWeights(evaluationTime); values = values.mult(numeraireAtEvaluationTime).div(monteCarloProbabilitiesAtEvaluationTime); // Return values return values; }
java
@Override public RandomVariable getValue(double evaluationTime, LIBORModelMonteCarloSimulationModel model) throws CalculationException { // Set payment date and period length double paymentDate = periodEnd; double periodLength = periodEnd - periodStart; // Get random variables RandomVariable libor = model.getLIBOR(optionMaturity, periodStart, periodEnd); RandomVariable trigger = libor.sub(strike).mult(periodLength); RandomVariable values = trigger.choose((new RandomVariableFromDoubleArray(periodLength)), (new RandomVariableFromDoubleArray(0.0))); // Get numeraire and probabilities for payment time RandomVariable numeraire = model.getNumeraire(paymentDate); RandomVariable monteCarloProbabilities = model.getMonteCarloWeights(paymentDate); values = values.div(numeraire).mult(monteCarloProbabilities); // Get numeraire and probabilities for evaluation time RandomVariable numeraireAtEvaluationTime = model.getNumeraire(evaluationTime); RandomVariable monteCarloProbabilitiesAtEvaluationTime = model.getMonteCarloWeights(evaluationTime); values = values.mult(numeraireAtEvaluationTime).div(monteCarloProbabilitiesAtEvaluationTime); // Return values return values; }
[ "@", "Override", "public", "RandomVariable", "getValue", "(", "double", "evaluationTime", ",", "LIBORModelMonteCarloSimulationModel", "model", ")", "throws", "CalculationException", "{", "// Set payment date and period length", "double", "paymentDate", "=", "periodEnd", ";", ...
This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime. Note: For a lattice this is often the value conditional to evalutationTime, for a Monte-Carlo simulation this is the (sum of) value discounted to evaluation time. Cashflows prior evaluationTime are not considered. @param evaluationTime The time on which this products value should be observed. @param model The model used to price the product. @return The random variable representing the value of the product discounted to evaluation time @throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</code> method.
[ "This", "method", "returns", "the", "value", "random", "variable", "of", "the", "product", "within", "the", "specified", "model", "evaluated", "at", "a", "given", "evalutationTime", ".", "Note", ":", "For", "a", "lattice", "this", "is", "often", "the", "valu...
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/interestrate/products/DigitalCaplet.java#L58-L85
threerings/narya
core/src/main/java/com/threerings/presents/client/InvocationDirector.java
InvocationDirector.handleClientObjectChanged
protected void handleClientObjectChanged (int newCloid) { // subscribe to the new client object _omgr.subscribeToObject(newCloid, new Subscriber<ClientObject>() { public void objectAvailable (ClientObject clobj) { // grab a reference to our old receiver registrations DSet<Registration> receivers = _clobj.receivers; // replace the client object _clobj = clobj; // add ourselves as an event listener _clobj.addListener(InvocationDirector.this); // reregister our receivers _clobj.startTransaction(); try { _clobj.setReceivers(new DSet<Registration>()); for (Registration reg : receivers) { _clobj.addToReceivers(reg); } } finally { _clobj.commitTransaction(); } // and report the switcheroo back to the client _client.clientObjectDidChange(_clobj); } public void requestFailed (int oid, ObjectAccessException cause) { log.warning("Aiya! Unable to subscribe to changed client object", "cloid", oid, "cause", cause); } }); }
java
protected void handleClientObjectChanged (int newCloid) { // subscribe to the new client object _omgr.subscribeToObject(newCloid, new Subscriber<ClientObject>() { public void objectAvailable (ClientObject clobj) { // grab a reference to our old receiver registrations DSet<Registration> receivers = _clobj.receivers; // replace the client object _clobj = clobj; // add ourselves as an event listener _clobj.addListener(InvocationDirector.this); // reregister our receivers _clobj.startTransaction(); try { _clobj.setReceivers(new DSet<Registration>()); for (Registration reg : receivers) { _clobj.addToReceivers(reg); } } finally { _clobj.commitTransaction(); } // and report the switcheroo back to the client _client.clientObjectDidChange(_clobj); } public void requestFailed (int oid, ObjectAccessException cause) { log.warning("Aiya! Unable to subscribe to changed client object", "cloid", oid, "cause", cause); } }); }
[ "protected", "void", "handleClientObjectChanged", "(", "int", "newCloid", ")", "{", "// subscribe to the new client object", "_omgr", ".", "subscribeToObject", "(", "newCloid", ",", "new", "Subscriber", "<", "ClientObject", ">", "(", ")", "{", "public", "void", "obj...
Called when the server has informed us that our previous client object is going the way of the Dodo because we're changing screen names. We subscribe to the new object and report to the client once we've got our hands on it.
[ "Called", "when", "the", "server", "has", "informed", "us", "that", "our", "previous", "client", "object", "is", "going", "the", "way", "of", "the", "Dodo", "because", "we", "re", "changing", "screen", "names", ".", "We", "subscribe", "to", "the", "new", ...
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/client/InvocationDirector.java#L338-L372
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_instance_instanceId_reboot_POST
public void project_serviceName_instance_instanceId_reboot_POST(String serviceName, String instanceId, OvhRebootTypeEnum type) throws IOException { String qPath = "/cloud/project/{serviceName}/instance/{instanceId}/reboot"; StringBuilder sb = path(qPath, serviceName, instanceId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "type", type); exec(qPath, "POST", sb.toString(), o); }
java
public void project_serviceName_instance_instanceId_reboot_POST(String serviceName, String instanceId, OvhRebootTypeEnum type) throws IOException { String qPath = "/cloud/project/{serviceName}/instance/{instanceId}/reboot"; StringBuilder sb = path(qPath, serviceName, instanceId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "type", type); exec(qPath, "POST", sb.toString(), o); }
[ "public", "void", "project_serviceName_instance_instanceId_reboot_POST", "(", "String", "serviceName", ",", "String", "instanceId", ",", "OvhRebootTypeEnum", "type", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/instance/{instanceId}...
Reboot an instance REST: POST /cloud/project/{serviceName}/instance/{instanceId}/reboot @param instanceId [required] Instance id @param serviceName [required] Service name @param type [required] Reboot type (default soft)
[ "Reboot", "an", "instance" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1909-L1915