repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/IcmpFailureDetectorConfig.java
IcmpFailureDetectorConfig.setIntervalMilliseconds
public IcmpFailureDetectorConfig setIntervalMilliseconds(int intervalMilliseconds) { if (intervalMilliseconds < MIN_INTERVAL_MILLIS) { throw new ConfigurationException(format("Interval can't be set to less than %d milliseconds.", MIN_INTERVAL_MILLIS)); } this.intervalMilliseconds = intervalMilliseconds; return this; }
java
public IcmpFailureDetectorConfig setIntervalMilliseconds(int intervalMilliseconds) { if (intervalMilliseconds < MIN_INTERVAL_MILLIS) { throw new ConfigurationException(format("Interval can't be set to less than %d milliseconds.", MIN_INTERVAL_MILLIS)); } this.intervalMilliseconds = intervalMilliseconds; return this; }
[ "public", "IcmpFailureDetectorConfig", "setIntervalMilliseconds", "(", "int", "intervalMilliseconds", ")", "{", "if", "(", "intervalMilliseconds", "<", "MIN_INTERVAL_MILLIS", ")", "{", "throw", "new", "ConfigurationException", "(", "format", "(", "\"Interval can't be set to...
Sets the time in milliseconds between each ping This value can not be smaller than 1000 milliseconds @param intervalMilliseconds the interval millis between each ping @return this {@link IcmpFailureDetectorConfig} instance
[ "Sets", "the", "time", "in", "milliseconds", "between", "each", "ping", "This", "value", "can", "not", "be", "smaller", "than", "1000", "milliseconds" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/IcmpFailureDetectorConfig.java#L115-L122
FasterXML/woodstox
src/main/java/com/ctc/wstx/sw/BaseStreamWriter.java
BaseStreamWriter.setProperty
@Override public boolean setProperty(String name, Object value) { /* Note: can not call local method, since it'll return false for * recognized but non-mutable properties */ return mConfig.setProperty(name, value); }
java
@Override public boolean setProperty(String name, Object value) { /* Note: can not call local method, since it'll return false for * recognized but non-mutable properties */ return mConfig.setProperty(name, value); }
[ "@", "Override", "public", "boolean", "setProperty", "(", "String", "name", ",", "Object", "value", ")", "{", "/* Note: can not call local method, since it'll return false for\n * recognized but non-mutable properties\n */", "return", "mConfig", ".", "setProperty", ...
@param name Name of the property to set @param value Value to set property to. @return True, if the specified property was <b>succesfully</b> set to specified value; false if its value was not changed
[ "@param", "name", "Name", "of", "the", "property", "to", "set", "@param", "value", "Value", "to", "set", "property", "to", "." ]
train
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sw/BaseStreamWriter.java#L950-L957
googleads/googleads-java-lib
modules/ads_lib/src/main/java/com/google/api/ads/common/lib/factory/AdsServiceClientFactory.java
AdsServiceClientFactory.createProxy
<T> T createProxy(Class<T> interfaceClass, C adsServiceClient) { Set<Class<?>> interfaces = Sets.newHashSet(adsServiceClient.getClass().getInterfaces()); interfaces.add(interfaceClass); Object proxy = Proxy.newProxyInstance( adsServiceClient.getSoapClient().getClass().getClassLoader(), interfaces.toArray(new Class[] {}), adsServiceClient); return interfaceClass.cast(proxy); }
java
<T> T createProxy(Class<T> interfaceClass, C adsServiceClient) { Set<Class<?>> interfaces = Sets.newHashSet(adsServiceClient.getClass().getInterfaces()); interfaces.add(interfaceClass); Object proxy = Proxy.newProxyInstance( adsServiceClient.getSoapClient().getClass().getClassLoader(), interfaces.toArray(new Class[] {}), adsServiceClient); return interfaceClass.cast(proxy); }
[ "<", "T", ">", "T", "createProxy", "(", "Class", "<", "T", ">", "interfaceClass", ",", "C", "adsServiceClient", ")", "{", "Set", "<", "Class", "<", "?", ">", ">", "interfaces", "=", "Sets", ".", "newHashSet", "(", "adsServiceClient", ".", "getClass", "...
Creates the proxy for the {@link AdsServiceClient}. @param <T> the service type @param adsServiceClient the client to proxy @return the proxy
[ "Creates", "the", "proxy", "for", "the", "{", "@link", "AdsServiceClient", "}", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/common/lib/factory/AdsServiceClientFactory.java#L87-L94
liferay/com-liferay-commerce
commerce-notification-api/src/main/java/com/liferay/commerce/notification/model/CommerceNotificationTemplateWrapper.java
CommerceNotificationTemplateWrapper.setSubject
@Override public void setSubject(String subject, java.util.Locale locale) { _commerceNotificationTemplate.setSubject(subject, locale); }
java
@Override public void setSubject(String subject, java.util.Locale locale) { _commerceNotificationTemplate.setSubject(subject, locale); }
[ "@", "Override", "public", "void", "setSubject", "(", "String", "subject", ",", "java", ".", "util", ".", "Locale", "locale", ")", "{", "_commerceNotificationTemplate", ".", "setSubject", "(", "subject", ",", "locale", ")", ";", "}" ]
Sets the localized subject of this commerce notification template in the language. @param subject the localized subject of this commerce notification template @param locale the locale of the language
[ "Sets", "the", "localized", "subject", "of", "this", "commerce", "notification", "template", "in", "the", "language", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-api/src/main/java/com/liferay/commerce/notification/model/CommerceNotificationTemplateWrapper.java#L968-L971
gallandarakhneorg/afc
advanced/bootique/bootique-synopsishelp/src/main/java/org/arakhne/afc/bootique/synopsishelp/help/SynopsisHelpGenerator.java
SynopsisHelpGenerator.printSynopsis
@SuppressWarnings("static-method") protected void printSynopsis(HelpAppender out, String name, String argumentSynopsis) { out.printSectionName(SYNOPSIS); assert name != null; if (Strings.isNullOrEmpty(argumentSynopsis)) { out.printText(name, OPTION_SYNOPSIS); } else { out.printText(name, OPTION_SYNOPSIS, argumentSynopsis); } }
java
@SuppressWarnings("static-method") protected void printSynopsis(HelpAppender out, String name, String argumentSynopsis) { out.printSectionName(SYNOPSIS); assert name != null; if (Strings.isNullOrEmpty(argumentSynopsis)) { out.printText(name, OPTION_SYNOPSIS); } else { out.printText(name, OPTION_SYNOPSIS, argumentSynopsis); } }
[ "@", "SuppressWarnings", "(", "\"static-method\"", ")", "protected", "void", "printSynopsis", "(", "HelpAppender", "out", ",", "String", "name", ",", "String", "argumentSynopsis", ")", "{", "out", ".", "printSectionName", "(", "SYNOPSIS", ")", ";", "assert", "na...
Print the synopsis of the command. @param out the output receiver. @param name the name of the command. @param argumentSynopsis the synopsis of the arguments.
[ "Print", "the", "synopsis", "of", "the", "command", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/bootique/bootique-synopsishelp/src/main/java/org/arakhne/afc/bootique/synopsishelp/help/SynopsisHelpGenerator.java#L107-L118
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/VoiceApi.java
VoiceApi.singleStepTransfer
public ApiSuccessResponse singleStepTransfer(String id, SingleStepTransferData singleStepTransferData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = singleStepTransferWithHttpInfo(id, singleStepTransferData); return resp.getData(); }
java
public ApiSuccessResponse singleStepTransfer(String id, SingleStepTransferData singleStepTransferData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = singleStepTransferWithHttpInfo(id, singleStepTransferData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "singleStepTransfer", "(", "String", "id", ",", "SingleStepTransferData", "singleStepTransferData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "singleStepTransferWithHttpInfo", "(", "id", ...
Transfer a call in a single step Perform a single-step transfer to the specified destination. @param id The connection ID of the call to transfer. (required) @param singleStepTransferData (required) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Transfer", "a", "call", "in", "a", "single", "step", "Perform", "a", "single", "-", "step", "transfer", "to", "the", "specified", "destination", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/VoiceApi.java#L4347-L4350
UrielCh/ovh-java-sdk
ovh-java-sdk-horizonView/src/main/java/net/minidev/ovh/api/ApiOvhHorizonView.java
ApiOvhHorizonView.serviceName_domainTrust_domainTrustId_addChildDomain_POST
public OvhTask serviceName_domainTrust_domainTrustId_addChildDomain_POST(String serviceName, Long domainTrustId, String activeDirectoryIP, String domain, String passphrase, String serviceAccountPassword) throws IOException { String qPath = "/horizonView/{serviceName}/domainTrust/{domainTrustId}/addChildDomain"; StringBuilder sb = path(qPath, serviceName, domainTrustId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "activeDirectoryIP", activeDirectoryIP); addBody(o, "domain", domain); addBody(o, "passphrase", passphrase); addBody(o, "serviceAccountPassword", serviceAccountPassword); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_domainTrust_domainTrustId_addChildDomain_POST(String serviceName, Long domainTrustId, String activeDirectoryIP, String domain, String passphrase, String serviceAccountPassword) throws IOException { String qPath = "/horizonView/{serviceName}/domainTrust/{domainTrustId}/addChildDomain"; StringBuilder sb = path(qPath, serviceName, domainTrustId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "activeDirectoryIP", activeDirectoryIP); addBody(o, "domain", domain); addBody(o, "passphrase", passphrase); addBody(o, "serviceAccountPassword", serviceAccountPassword); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_domainTrust_domainTrustId_addChildDomain_POST", "(", "String", "serviceName", ",", "Long", "domainTrustId", ",", "String", "activeDirectoryIP", ",", "String", "domain", ",", "String", "passphrase", ",", "String", "serviceAccountPassword", "...
Add a child domain for this domain. REST: POST /horizonView/{serviceName}/domainTrust/{domainTrustId}/addChildDomain @param domain [required] Name of your private domain @param serviceAccountPassword [required] Password of the horizonUI service account @param activeDirectoryIP [required] IP of your Active Directory @param passphrase [required] Shared passphrase to create the Active Directory trust @param serviceName [required] Domain of the service @param domainTrustId [required] Domain trust id
[ "Add", "a", "child", "domain", "for", "this", "domain", "." ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-horizonView/src/main/java/net/minidev/ovh/api/ApiOvhHorizonView.java#L273-L283
datacleaner/AnalyzerBeans
env/berkeleydb/src/main/java/org/eobjects/analyzer/storage/BerkeleyDbStorageProvider.java
BerkeleyDbStorageProvider.cleanDirectory
public void cleanDirectory() { File[] directories = _parentDirectory.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.startsWith(DIRECTORY_PREFIX); } }); for (File directory : directories) { delete(directory); } }
java
public void cleanDirectory() { File[] directories = _parentDirectory.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.startsWith(DIRECTORY_PREFIX); } }); for (File directory : directories) { delete(directory); } }
[ "public", "void", "cleanDirectory", "(", ")", "{", "File", "[", "]", "directories", "=", "_parentDirectory", ".", "listFiles", "(", "new", "FilenameFilter", "(", ")", "{", "@", "Override", "public", "boolean", "accept", "(", "File", "dir", ",", "String", "...
Cleans the parent directory of this storage provider. This action will delete all previous collection storages made in this directory, and thus it should only be invoked either before any collections has been made or when all collections are ensured to be unused.
[ "Cleans", "the", "parent", "directory", "of", "this", "storage", "provider", ".", "This", "action", "will", "delete", "all", "previous", "collection", "storages", "made", "in", "this", "directory", "and", "thus", "it", "should", "only", "be", "invoked", "eithe...
train
https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/env/berkeleydb/src/main/java/org/eobjects/analyzer/storage/BerkeleyDbStorageProvider.java#L94-L104
jenkinsci/jenkins
core/src/main/java/jenkins/scm/SCMCheckoutStrategy.java
SCMCheckoutStrategy.preCheckout
public void preCheckout(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException { AbstractProject<?, ?> project = build.getProject(); if (project instanceof BuildableItemWithBuildWrappers) { BuildableItemWithBuildWrappers biwbw = (BuildableItemWithBuildWrappers) project; for (BuildWrapper bw : biwbw.getBuildWrappersList()) bw.preCheckout(build,launcher,listener); } }
java
public void preCheckout(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException { AbstractProject<?, ?> project = build.getProject(); if (project instanceof BuildableItemWithBuildWrappers) { BuildableItemWithBuildWrappers biwbw = (BuildableItemWithBuildWrappers) project; for (BuildWrapper bw : biwbw.getBuildWrappersList()) bw.preCheckout(build,launcher,listener); } }
[ "public", "void", "preCheckout", "(", "AbstractBuild", "<", "?", ",", "?", ">", "build", ",", "Launcher", "launcher", ",", "BuildListener", "listener", ")", "throws", "IOException", ",", "InterruptedException", "{", "AbstractProject", "<", "?", ",", "?", ">", ...
Performs the pre checkout step. This method is called by the {@link Executor} that's carrying out the build. @param build Build being in progress. Never null. @param launcher Allows you to launch process on the node where the build is actually running. Never null. @param listener Allows you to write to console output and report errors. Never null.
[ "Performs", "the", "pre", "checkout", "step", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/scm/SCMCheckoutStrategy.java#L71-L78
aws/aws-sdk-java
aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/internal/DocumentationUtils.java
DocumentationUtils.createLinkToServiceDocumentation
public static String createLinkToServiceDocumentation(Metadata metadata, ShapeModel shapeModel) { return isRequestResponseOrModel(shapeModel) ? createLinkToServiceDocumentation(metadata, shapeModel.getDocumentationShapeName()) : ""; }
java
public static String createLinkToServiceDocumentation(Metadata metadata, ShapeModel shapeModel) { return isRequestResponseOrModel(shapeModel) ? createLinkToServiceDocumentation(metadata, shapeModel.getDocumentationShapeName()) : ""; }
[ "public", "static", "String", "createLinkToServiceDocumentation", "(", "Metadata", "metadata", ",", "ShapeModel", "shapeModel", ")", "{", "return", "isRequestResponseOrModel", "(", "shapeModel", ")", "?", "createLinkToServiceDocumentation", "(", "metadata", ",", "shapeMod...
Create the HTML for a link to the operation/shape core AWS docs site @param metadata the UID for the service from that services metadata @param shapeModel the model of the shape @return a '@see also' HTML link to the doc
[ "Create", "the", "HTML", "for", "a", "link", "to", "the", "operation", "/", "shape", "core", "AWS", "docs", "site" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/internal/DocumentationUtils.java#L148-L150
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java
TileBoundingBoxUtils.getWebMercatorBoundingBox
public static BoundingBox getWebMercatorBoundingBox(TileGrid tileGrid, int zoom) { double tileSize = tileSizeWithZoom(zoom); double minLon = (-1 * ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH) + (tileGrid.getMinX() * tileSize); double maxLon = (-1 * ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH) + ((tileGrid.getMaxX() + 1) * tileSize); double minLat = ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH - ((tileGrid.getMaxY() + 1) * tileSize); double maxLat = ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH - (tileGrid.getMinY() * tileSize); BoundingBox box = new BoundingBox(minLon, minLat, maxLon, maxLat); return box; }
java
public static BoundingBox getWebMercatorBoundingBox(TileGrid tileGrid, int zoom) { double tileSize = tileSizeWithZoom(zoom); double minLon = (-1 * ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH) + (tileGrid.getMinX() * tileSize); double maxLon = (-1 * ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH) + ((tileGrid.getMaxX() + 1) * tileSize); double minLat = ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH - ((tileGrid.getMaxY() + 1) * tileSize); double maxLat = ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH - (tileGrid.getMinY() * tileSize); BoundingBox box = new BoundingBox(minLon, minLat, maxLon, maxLat); return box; }
[ "public", "static", "BoundingBox", "getWebMercatorBoundingBox", "(", "TileGrid", "tileGrid", ",", "int", "zoom", ")", "{", "double", "tileSize", "=", "tileSizeWithZoom", "(", "zoom", ")", ";", "double", "minLon", "=", "(", "-", "1", "*", "ProjectionConstants", ...
Get the Web Mercator tile bounding box from the Google Maps API tile grid and zoom level @param tileGrid tile grid @param zoom zoom level @return bounding box
[ "Get", "the", "Web", "Mercator", "tile", "bounding", "box", "from", "the", "Google", "Maps", "API", "tile", "grid", "and", "zoom", "level" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java#L375-L392
ehcache/ehcache3
impl/src/main/java/org/ehcache/impl/config/resilience/DefaultResilienceStrategyProviderConfiguration.java
DefaultResilienceStrategyProviderConfiguration.setDefaultResilienceStrategy
@SuppressWarnings("rawtypes") public DefaultResilienceStrategyProviderConfiguration setDefaultResilienceStrategy(Class<? extends ResilienceStrategy> clazz, Object... arguments) { this.defaultRegularConfiguration = new DefaultResilienceStrategyConfiguration(clazz, arguments); return this; }
java
@SuppressWarnings("rawtypes") public DefaultResilienceStrategyProviderConfiguration setDefaultResilienceStrategy(Class<? extends ResilienceStrategy> clazz, Object... arguments) { this.defaultRegularConfiguration = new DefaultResilienceStrategyConfiguration(clazz, arguments); return this; }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "public", "DefaultResilienceStrategyProviderConfiguration", "setDefaultResilienceStrategy", "(", "Class", "<", "?", "extends", "ResilienceStrategy", ">", "clazz", ",", "Object", "...", "arguments", ")", "{", "this", "."...
Sets the default {@link ResilienceStrategy} class and associated constructor arguments to be used for caches without a loader-writer. <p> The provided class must have a constructor compatible with the supplied arguments followed by the cache's {@code RecoveryStore}. @param clazz the resilience strategy class @param arguments the constructor arguments @return this configuration instance
[ "Sets", "the", "default", "{", "@link", "ResilienceStrategy", "}", "class", "and", "associated", "constructor", "arguments", "to", "be", "used", "for", "caches", "without", "a", "loader", "-", "writer", ".", "<p", ">", "The", "provided", "class", "must", "ha...
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/config/resilience/DefaultResilienceStrategyProviderConfiguration.java#L78-L82
elki-project/elki
elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkmax/MkMaxTreeNode.java
MkMaxTreeNode.integrityCheckParameters
@Override protected void integrityCheckParameters(MkMaxEntry parentEntry, MkMaxTreeNode<O> parent, int index, AbstractMTree<O, MkMaxTreeNode<O>, MkMaxEntry, ?> mTree) { super.integrityCheckParameters(parentEntry, parent, index, mTree); // test if knn distance is correctly set MkMaxEntry entry = parent.getEntry(index); double knnDistance = kNNDistance(); if(Math.abs(entry.getKnnDistance() - knnDistance) > 0) { throw new RuntimeException("Wrong knnDistance in node " + parent.getPageID() + " at index " + index + " (child " + entry + ")" + "\nsoll: " + knnDistance + ",\n ist: " + entry.getKnnDistance()); } }
java
@Override protected void integrityCheckParameters(MkMaxEntry parentEntry, MkMaxTreeNode<O> parent, int index, AbstractMTree<O, MkMaxTreeNode<O>, MkMaxEntry, ?> mTree) { super.integrityCheckParameters(parentEntry, parent, index, mTree); // test if knn distance is correctly set MkMaxEntry entry = parent.getEntry(index); double knnDistance = kNNDistance(); if(Math.abs(entry.getKnnDistance() - knnDistance) > 0) { throw new RuntimeException("Wrong knnDistance in node " + parent.getPageID() + " at index " + index + " (child " + entry + ")" + "\nsoll: " + knnDistance + ",\n ist: " + entry.getKnnDistance()); } }
[ "@", "Override", "protected", "void", "integrityCheckParameters", "(", "MkMaxEntry", "parentEntry", ",", "MkMaxTreeNode", "<", "O", ">", "parent", ",", "int", "index", ",", "AbstractMTree", "<", "O", ",", "MkMaxTreeNode", "<", "O", ">", ",", "MkMaxEntry", ",",...
Calls the super method and tests if the k-nearest neighbor distance of this node is correctly set.
[ "Calls", "the", "super", "method", "and", "tests", "if", "the", "k", "-", "nearest", "neighbor", "distance", "of", "this", "node", "is", "correctly", "set", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkmax/MkMaxTreeNode.java#L93-L102
cache2k/cache2k
cache2k-jcache/src/main/java/org/cache2k/jcache/provider/event/AsyncDispatcher.java
AsyncDispatcher.runAllListenersInParallel
void runAllListenersInParallel(final EntryEvent<K, V> _event, List<Listener<K, V>> _listeners) { final AtomicInteger _countDown = new AtomicInteger(_listeners.size()); for (final Listener<K,V> l : _listeners) { Runnable r = new Runnable() { @Override public void run() { try { l.fire(_event); } catch (Throwable t) { t.printStackTrace(); } int _done = _countDown.decrementAndGet(); if (_done == 0) { runMoreOnKeyQueueOrStop(_event.getKey()); } } }; executor.execute(r); } }
java
void runAllListenersInParallel(final EntryEvent<K, V> _event, List<Listener<K, V>> _listeners) { final AtomicInteger _countDown = new AtomicInteger(_listeners.size()); for (final Listener<K,V> l : _listeners) { Runnable r = new Runnable() { @Override public void run() { try { l.fire(_event); } catch (Throwable t) { t.printStackTrace(); } int _done = _countDown.decrementAndGet(); if (_done == 0) { runMoreOnKeyQueueOrStop(_event.getKey()); } } }; executor.execute(r); } }
[ "void", "runAllListenersInParallel", "(", "final", "EntryEvent", "<", "K", ",", "V", ">", "_event", ",", "List", "<", "Listener", "<", "K", ",", "V", ">", ">", "_listeners", ")", "{", "final", "AtomicInteger", "_countDown", "=", "new", "AtomicInteger", "("...
Pass on runnables to the executor for all listeners. After each event is handled within the listener we check whether the event is processed by all listeners, by decrementing a countdown. In case the event is processed completely, we check whether more is queued up for this key meanwhile.
[ "Pass", "on", "runnables", "to", "the", "executor", "for", "all", "listeners", ".", "After", "each", "event", "is", "handled", "within", "the", "listener", "we", "check", "whether", "the", "event", "is", "processed", "by", "all", "listeners", "by", "decremen...
train
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-jcache/src/main/java/org/cache2k/jcache/provider/event/AsyncDispatcher.java#L146-L165
grails/grails-core
grails-web-databinding/src/main/groovy/grails/web/databinding/DataBindingUtils.java
DataBindingUtils.bindObjectToDomainInstance
public static BindingResult bindObjectToDomainInstance(PersistentEntity entity, Object object, Object source) { return bindObjectToDomainInstance(entity, object, source, getBindingIncludeList(object), Collections.emptyList(), null); }
java
public static BindingResult bindObjectToDomainInstance(PersistentEntity entity, Object object, Object source) { return bindObjectToDomainInstance(entity, object, source, getBindingIncludeList(object), Collections.emptyList(), null); }
[ "public", "static", "BindingResult", "bindObjectToDomainInstance", "(", "PersistentEntity", "entity", ",", "Object", "object", ",", "Object", "source", ")", "{", "return", "bindObjectToDomainInstance", "(", "entity", ",", "object", ",", "source", ",", "getBindingInclu...
Binds the given source object to the given target object performing type conversion if necessary @param entity The PersistentEntity instance @param object The object to bind to @param source The source object @see org.grails.datastore.mapping.model.PersistentEntity @return A BindingResult if there were errors or null if it was successful
[ "Binds", "the", "given", "source", "object", "to", "the", "given", "target", "object", "performing", "type", "conversion", "if", "necessary" ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-web-databinding/src/main/groovy/grails/web/databinding/DataBindingUtils.java#L150-L152
Appendium/objectlabkit
datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/ExcelDateUtil.java
ExcelDateUtil.getJavaDate
public static Date getJavaDate(final double excelDate, final boolean use1904windowing) { final Calendar cal = getJavaCalendar(excelDate, use1904windowing); return cal == null ? null : cal.getTime(); }
java
public static Date getJavaDate(final double excelDate, final boolean use1904windowing) { final Calendar cal = getJavaCalendar(excelDate, use1904windowing); return cal == null ? null : cal.getTime(); }
[ "public", "static", "Date", "getJavaDate", "(", "final", "double", "excelDate", ",", "final", "boolean", "use1904windowing", ")", "{", "final", "Calendar", "cal", "=", "getJavaCalendar", "(", "excelDate", ",", "use1904windowing", ")", ";", "return", "cal", "==",...
Given an Excel date with either 1900 or 1904 date windowing, converts it to a java.util.Date. NOTE: If the default <code>TimeZone</code> in Java uses Daylight Saving Time then the conversion back to an Excel date may not give the same value, that is the comparison <CODE>excelDate == getExcelDate(getJavaDate(excelDate,false))</CODE> is not always true. For example if default timezone is <code>Europe/Copenhagen</code>, on 2004-03-28 the minute after 01:59 CET is 03:00 CEST, if the excel date represents a time between 02:00 and 03:00 then it is converted to past 03:00 summer time @param excelDate The Excel date. @param use1904windowing true if date uses 1904 windowing, or false if using 1900 date windowing. @return Java representation of the date, or null if date is not a valid Excel date @see java.util.TimeZone
[ "Given", "an", "Excel", "date", "with", "either", "1900", "or", "1904", "date", "windowing", "converts", "it", "to", "a", "java", ".", "util", ".", "Date", "." ]
train
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/ExcelDateUtil.java#L150-L153
brettwooldridge/SansOrm
src/main/java/com/zaxxer/sansorm/OrmElf.java
OrmElf.resultSetToObject
public static <T> T resultSetToObject(ResultSet resultSet, T target) throws SQLException { return OrmReader.resultSetToObject(resultSet, target); }
java
public static <T> T resultSetToObject(ResultSet resultSet, T target) throws SQLException { return OrmReader.resultSetToObject(resultSet, target); }
[ "public", "static", "<", "T", ">", "T", "resultSetToObject", "(", "ResultSet", "resultSet", ",", "T", "target", ")", "throws", "SQLException", "{", "return", "OrmReader", ".", "resultSetToObject", "(", "resultSet", ",", "target", ")", ";", "}" ]
Get an object from the specified ResultSet. ResultSet.next() is <i>NOT</i> called, this should be done by the caller. <b>The ResultSet is not closed as a result of this method.</b> @param resultSet a {@link ResultSet} @param target the target object to set values on @param <T> the class template @return the populated object @throws SQLException if a {@link SQLException} occurs
[ "Get", "an", "object", "from", "the", "specified", "ResultSet", ".", "ResultSet", ".", "next", "()", "is", "<i", ">", "NOT<", "/", "i", ">", "called", "this", "should", "be", "done", "by", "the", "caller", ".", "<b", ">", "The", "ResultSet", "is", "n...
train
https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/OrmElf.java#L168-L171
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/tools/RuleMatchAsXmlSerializer.java
RuleMatchAsXmlSerializer.getXmlStart
public String getXmlStart(Language lang, Language motherTongue) { StringBuilder xml = new StringBuilder(CAPACITY); xml.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n") .append("<!-- THIS OUTPUT IS DEPRECATED, PLEASE SEE http://wiki.languagetool.org/http-server FOR A BETTER APPROACH -->\n") .append("<matches software=\"LanguageTool\" version=\"" + JLanguageTool.VERSION + "\"" + " buildDate=\"") .append(JLanguageTool.BUILD_DATE).append("\">\n"); if (lang != null || motherTongue != null) { String languageXml = "<language "; String warning = ""; if (lang != null) { languageXml += "shortname=\"" + lang.getShortCodeWithCountryAndVariant() + "\" name=\"" + lang.getName() + "\""; String longCode = lang.getShortCodeWithCountryAndVariant(); if ("en".equals(longCode) || "de".equals(longCode)) { xml.append("<!-- NOTE: The language code you selected ('").append(longCode).append("') doesn't support spell checking. Consider using a code with a variant like 'en-US'. -->\n"); } } if (motherTongue != null && (lang == null || !motherTongue.getShortCode().equals(lang.getShortCodeWithCountryAndVariant()))) { languageXml += " mothertongueshortname=\"" + motherTongue.getShortCode() + "\" mothertonguename=\"" + motherTongue.getName() + "\""; } languageXml += "/>\n"; xml.append(languageXml); xml.append(warning); } return xml.toString(); }
java
public String getXmlStart(Language lang, Language motherTongue) { StringBuilder xml = new StringBuilder(CAPACITY); xml.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n") .append("<!-- THIS OUTPUT IS DEPRECATED, PLEASE SEE http://wiki.languagetool.org/http-server FOR A BETTER APPROACH -->\n") .append("<matches software=\"LanguageTool\" version=\"" + JLanguageTool.VERSION + "\"" + " buildDate=\"") .append(JLanguageTool.BUILD_DATE).append("\">\n"); if (lang != null || motherTongue != null) { String languageXml = "<language "; String warning = ""; if (lang != null) { languageXml += "shortname=\"" + lang.getShortCodeWithCountryAndVariant() + "\" name=\"" + lang.getName() + "\""; String longCode = lang.getShortCodeWithCountryAndVariant(); if ("en".equals(longCode) || "de".equals(longCode)) { xml.append("<!-- NOTE: The language code you selected ('").append(longCode).append("') doesn't support spell checking. Consider using a code with a variant like 'en-US'. -->\n"); } } if (motherTongue != null && (lang == null || !motherTongue.getShortCode().equals(lang.getShortCodeWithCountryAndVariant()))) { languageXml += " mothertongueshortname=\"" + motherTongue.getShortCode() + "\" mothertonguename=\"" + motherTongue.getName() + "\""; } languageXml += "/>\n"; xml.append(languageXml); xml.append(warning); } return xml.toString(); }
[ "public", "String", "getXmlStart", "(", "Language", "lang", ",", "Language", "motherTongue", ")", "{", "StringBuilder", "xml", "=", "new", "StringBuilder", "(", "CAPACITY", ")", ";", "xml", ".", "append", "(", "\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\"...
Get the string to begin the XML. After this, use {@link #ruleMatchesToXmlSnippet} and then {@link #getXmlEnd()} or better, simply use {@link #ruleMatchesToXml}.
[ "Get", "the", "string", "to", "begin", "the", "XML", ".", "After", "this", "use", "{" ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/tools/RuleMatchAsXmlSerializer.java#L47-L71
morfologik/morfologik-stemming
morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/CFSA2Serializer.java
CFSA2Serializer.computeFirstStates
private int[] computeFirstStates(IntIntHashMap inlinkCount, int maxStates, int minInlinkCount) { Comparator<IntIntHolder> comparator = new Comparator<FSAUtils.IntIntHolder>() { public int compare(IntIntHolder o1, IntIntHolder o2) { int v = o1.a - o2.a; return v == 0 ? (o1.b - o2.b) : v; } }; PriorityQueue<IntIntHolder> stateInlink = new PriorityQueue<IntIntHolder>(1, comparator); IntIntHolder scratch = new IntIntHolder(); for (IntIntCursor c : inlinkCount) { if (c.value > minInlinkCount) { scratch.a = c.value; scratch.b = c.key; if (stateInlink.size() < maxStates || comparator.compare(scratch, stateInlink.peek()) > 0) { stateInlink.add(new IntIntHolder(c.value, c.key)); if (stateInlink.size() > maxStates) { stateInlink.remove(); } } } } int [] states = new int [stateInlink.size()]; for (int position = states.length; !stateInlink.isEmpty();) { IntIntHolder i = stateInlink.remove(); states[--position] = i.b; } return states; }
java
private int[] computeFirstStates(IntIntHashMap inlinkCount, int maxStates, int minInlinkCount) { Comparator<IntIntHolder> comparator = new Comparator<FSAUtils.IntIntHolder>() { public int compare(IntIntHolder o1, IntIntHolder o2) { int v = o1.a - o2.a; return v == 0 ? (o1.b - o2.b) : v; } }; PriorityQueue<IntIntHolder> stateInlink = new PriorityQueue<IntIntHolder>(1, comparator); IntIntHolder scratch = new IntIntHolder(); for (IntIntCursor c : inlinkCount) { if (c.value > minInlinkCount) { scratch.a = c.value; scratch.b = c.key; if (stateInlink.size() < maxStates || comparator.compare(scratch, stateInlink.peek()) > 0) { stateInlink.add(new IntIntHolder(c.value, c.key)); if (stateInlink.size() > maxStates) { stateInlink.remove(); } } } } int [] states = new int [stateInlink.size()]; for (int position = states.length; !stateInlink.isEmpty();) { IntIntHolder i = stateInlink.remove(); states[--position] = i.b; } return states; }
[ "private", "int", "[", "]", "computeFirstStates", "(", "IntIntHashMap", "inlinkCount", ",", "int", "maxStates", ",", "int", "minInlinkCount", ")", "{", "Comparator", "<", "IntIntHolder", ">", "comparator", "=", "new", "Comparator", "<", "FSAUtils", ".", "IntIntH...
Compute the set of states that should be linearized first to minimize other states goto length.
[ "Compute", "the", "set", "of", "states", "that", "should", "be", "linearized", "first", "to", "minimize", "other", "states", "goto", "length", "." ]
train
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/CFSA2Serializer.java#L335-L366
cubedtear/aritzh
aritzh-core/src/main/java/io/github/aritzhack/aritzh/util/ReflectionUtil.java
ReflectionUtil.classHasAnnotation
public static boolean classHasAnnotation(Class clazz, Class<? extends Annotation> annotation) { try { Set<Class> hierarchy = ReflectionUtil.flattenHierarchy(clazz); for (Class c : hierarchy) { if (c.isAnnotationPresent(annotation)) return true; } } catch (Throwable t) { t.printStackTrace(); } return false; }
java
public static boolean classHasAnnotation(Class clazz, Class<? extends Annotation> annotation) { try { Set<Class> hierarchy = ReflectionUtil.flattenHierarchy(clazz); for (Class c : hierarchy) { if (c.isAnnotationPresent(annotation)) return true; } } catch (Throwable t) { t.printStackTrace(); } return false; }
[ "public", "static", "boolean", "classHasAnnotation", "(", "Class", "clazz", ",", "Class", "<", "?", "extends", "Annotation", ">", "annotation", ")", "{", "try", "{", "Set", "<", "Class", ">", "hierarchy", "=", "ReflectionUtil", ".", "flattenHierarchy", "(", ...
Returns true if that class or any of its supertypes has the annotation @param clazz The class that needs the annotation @param annotation The annotation to look for @return true if and only if the class or any of its supertypes has the annotation
[ "Returns", "true", "if", "that", "class", "or", "any", "of", "its", "supertypes", "has", "the", "annotation" ]
train
https://github.com/cubedtear/aritzh/blob/bc7493447a1a6088c4a7306ca4d0f0c20278364f/aritzh-core/src/main/java/io/github/aritzhack/aritzh/util/ReflectionUtil.java#L125-L135
Esri/geometry-api-java
src/main/java/com/esri/core/geometry/GeoDist.java
GeoDist.PE_EQ
static private boolean PE_EQ(double a, double b) { return (a == b) || PE_ABS(a - b) <= PE_EPS * (1 + (PE_ABS(a) + PE_ABS(b)) / 2); }
java
static private boolean PE_EQ(double a, double b) { return (a == b) || PE_ABS(a - b) <= PE_EPS * (1 + (PE_ABS(a) + PE_ABS(b)) / 2); }
[ "static", "private", "boolean", "PE_EQ", "(", "double", "a", ",", "double", "b", ")", "{", "return", "(", "a", "==", "b", ")", "||", "PE_ABS", "(", "a", "-", "b", ")", "<=", "PE_EPS", "*", "(", "1", "+", "(", "PE_ABS", "(", "a", ")", "+", "PE...
Determine if two doubles are equal within a default tolerance
[ "Determine", "if", "two", "doubles", "are", "equal", "within", "a", "default", "tolerance" ]
train
https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/GeoDist.java#L46-L49
onelogin/onelogin-java-sdk
src/main/java/com/onelogin/sdk/conn/Client.java
Client.getOneLoginAppsBatch
public OneLoginResponse<OneLoginApp> getOneLoginAppsBatch(int batchSize) throws OAuthSystemException, OAuthProblemException, URISyntaxException { return getOneLoginAppsBatch(batchSize, null); }
java
public OneLoginResponse<OneLoginApp> getOneLoginAppsBatch(int batchSize) throws OAuthSystemException, OAuthProblemException, URISyntaxException { return getOneLoginAppsBatch(batchSize, null); }
[ "public", "OneLoginResponse", "<", "OneLoginApp", ">", "getOneLoginAppsBatch", "(", "int", "batchSize", ")", "throws", "OAuthSystemException", ",", "OAuthProblemException", ",", "URISyntaxException", "{", "return", "getOneLoginAppsBatch", "(", "batchSize", ",", "null", ...
Get a batch of OneLoginApps. @param batchSize Size of the Batch @return OneLoginResponse of OneLoginApp (Batch) @throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection @throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled @throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor @see com.onelogin.sdk.model.OneLoginApp @see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/apps/get-apps">Get Apps documentation</a>
[ "Get", "a", "batch", "of", "OneLoginApps", "." ]
train
https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L1565-L1567
mikepenz/FastAdapter
library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/scroll/EndlessScrollHelper.java
EndlessScrollHelper.onNewItems
protected void onNewItems(@NonNull List<Model> newItems, int page) { OnNewItemsListener<Model> onNewItemsListener = this.mOnNewItemsListener; try { onNewItemsListener.onNewItems(newItems, page); } catch (NullPointerException npe) { // Lazy null checking! If this was our npe, then throw with an appropriate message. throw onNewItemsListener != null ? npe : new NullPointerException("You must provide an `OnNewItemsListener`"); } }
java
protected void onNewItems(@NonNull List<Model> newItems, int page) { OnNewItemsListener<Model> onNewItemsListener = this.mOnNewItemsListener; try { onNewItemsListener.onNewItems(newItems, page); } catch (NullPointerException npe) { // Lazy null checking! If this was our npe, then throw with an appropriate message. throw onNewItemsListener != null ? npe : new NullPointerException("You must provide an `OnNewItemsListener`"); } }
[ "protected", "void", "onNewItems", "(", "@", "NonNull", "List", "<", "Model", ">", "newItems", ",", "int", "page", ")", "{", "OnNewItemsListener", "<", "Model", ">", "onNewItemsListener", "=", "this", ".", "mOnNewItemsListener", ";", "try", "{", "onNewItemsLis...
The default implementation takes care of calling the previously set {@link OnNewItemsListener OnNewItemsListener}. @param newItems @param page @see #withOnNewItemsListener(OnNewItemsListener) withOnNewItemsListener(OnNewItemsListener)
[ "The", "default", "implementation", "takes", "care", "of", "calling", "the", "previously", "set", "{", "@link", "OnNewItemsListener", "OnNewItemsListener", "}", "." ]
train
https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/scroll/EndlessScrollHelper.java#L241-L250
salesforce/Argus
ArgusCore/src/main/java/com/salesforce/dva/argus/entity/GlobalInterlock.java
GlobalInterlock.obtainLock
public static String obtainLock(EntityManager em, long expiration, long type, String note) { EntityTransaction tx = null; /* remove the existing lock if it's expired */ try { long now = System.currentTimeMillis(); tx = em.getTransaction(); tx.begin(); GlobalInterlock lock = _findAndRefreshLock(em, type); if (lock != null && now - lock.lockTime > expiration) { em.remove(lock); em.flush(); } tx.commit(); } catch (Exception ex) { LOGGER.warn("An error occurred trying to refresh the type {} lock: {}", type, ex.getMessage()); LOGGER.debug(ex.getMessage(), ex); if (tx != null && tx.isActive()) { tx.rollback(); } } /* attempt to obtain a lock */ try { tx = em.getTransaction(); tx.begin(); GlobalInterlock lock = em.merge(new GlobalInterlock(type, note)); em.flush(); tx.commit(); return Long.toHexString(lock.lockTime); } catch (Exception ex) { throw new GlobalInterlockException("Could not obtain " + type + " lock", ex); } finally { if (tx != null && tx.isActive()) { tx.rollback(); } } }
java
public static String obtainLock(EntityManager em, long expiration, long type, String note) { EntityTransaction tx = null; /* remove the existing lock if it's expired */ try { long now = System.currentTimeMillis(); tx = em.getTransaction(); tx.begin(); GlobalInterlock lock = _findAndRefreshLock(em, type); if (lock != null && now - lock.lockTime > expiration) { em.remove(lock); em.flush(); } tx.commit(); } catch (Exception ex) { LOGGER.warn("An error occurred trying to refresh the type {} lock: {}", type, ex.getMessage()); LOGGER.debug(ex.getMessage(), ex); if (tx != null && tx.isActive()) { tx.rollback(); } } /* attempt to obtain a lock */ try { tx = em.getTransaction(); tx.begin(); GlobalInterlock lock = em.merge(new GlobalInterlock(type, note)); em.flush(); tx.commit(); return Long.toHexString(lock.lockTime); } catch (Exception ex) { throw new GlobalInterlockException("Could not obtain " + type + " lock", ex); } finally { if (tx != null && tx.isActive()) { tx.rollback(); } } }
[ "public", "static", "String", "obtainLock", "(", "EntityManager", "em", ",", "long", "expiration", ",", "long", "type", ",", "String", "note", ")", "{", "EntityTransaction", "tx", "=", "null", ";", "/* remove the existing lock if it's expired */", "try", "{", "lon...
Obtains a global lock of a given type. @param em The entity manager to use. Cannot be null. @param expiration The time in milliseconds after which an existing lock may be clobbered and re-acquired. @param type The application specific lock type represented as a long value. @param note A descriptive note about the lock context. @return The unique key to be used from clients when releasing the lock. @throws GlobalInterlockException If the lock cannot be obtained.
[ "Obtains", "a", "global", "lock", "of", "a", "given", "type", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/GlobalInterlock.java#L140-L182
tango-controls/JTango
server/src/main/java/org/tango/server/servant/DeviceImpl.java
DeviceImpl.write_attributes_4
@Override public void write_attributes_4(final AttributeValue_4[] values, final ClntIdent clIdent) throws MultiDevFailed, DevFailed { MDC.setContextMap(contextMap); xlogger.entry(); checkInitialization(); final String[] names = new String[values.length]; for (int i = 0; i < names.length; i++) { names[i] = values[i].name; } logger.debug("writing {}", Arrays.toString(names)); deviceMonitoring.startRequest("write_attributes_4 " + Arrays.toString(names), clIdent); clientIdentity.set(clIdent); if (!name.equalsIgnoreCase(getAdminDeviceName())) { clientLocking.checkClientLocking(clIdent, names); } final Object lock = deviceLock.getAttributeLock(); try { synchronized (lock != null ? lock : new Object()) { AttributeGetterSetter.setAttributeValue4(values, attributeList, stateImpl, aroundInvokeImpl, clIdent); } } catch (final Exception e) { deviceMonitoring.addError(); if (e instanceof MultiDevFailed) { throw (MultiDevFailed) e; } else { // with CORBA, the stack trace is not visible by the client if // not inserted in DevFailed. throw DevFailedUtils.newDevFailed(e); } } xlogger.exit(); }
java
@Override public void write_attributes_4(final AttributeValue_4[] values, final ClntIdent clIdent) throws MultiDevFailed, DevFailed { MDC.setContextMap(contextMap); xlogger.entry(); checkInitialization(); final String[] names = new String[values.length]; for (int i = 0; i < names.length; i++) { names[i] = values[i].name; } logger.debug("writing {}", Arrays.toString(names)); deviceMonitoring.startRequest("write_attributes_4 " + Arrays.toString(names), clIdent); clientIdentity.set(clIdent); if (!name.equalsIgnoreCase(getAdminDeviceName())) { clientLocking.checkClientLocking(clIdent, names); } final Object lock = deviceLock.getAttributeLock(); try { synchronized (lock != null ? lock : new Object()) { AttributeGetterSetter.setAttributeValue4(values, attributeList, stateImpl, aroundInvokeImpl, clIdent); } } catch (final Exception e) { deviceMonitoring.addError(); if (e instanceof MultiDevFailed) { throw (MultiDevFailed) e; } else { // with CORBA, the stack trace is not visible by the client if // not inserted in DevFailed. throw DevFailedUtils.newDevFailed(e); } } xlogger.exit(); }
[ "@", "Override", "public", "void", "write_attributes_4", "(", "final", "AttributeValue_4", "[", "]", "values", ",", "final", "ClntIdent", "clIdent", ")", "throws", "MultiDevFailed", ",", "DevFailed", "{", "MDC", ".", "setContextMap", "(", "contextMap", ")", ";",...
Write some attributes. IDL 4 version @param values a container for attribute values. @param clIdent the client ID @throws DevFailed
[ "Write", "some", "attributes", ".", "IDL", "4", "version" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/servant/DeviceImpl.java#L1290-L1322
apache/groovy
src/main/java/org/codehaus/groovy/vmplugin/v7/IndyGuardsFiltersAndSignatures.java
IndyGuardsFiltersAndSignatures.invokeGroovyObjectInvoker
public static Object invokeGroovyObjectInvoker(MissingMethodException e, Object receiver, String name, Object[] args) { if (e instanceof MissingMethodExecutionFailed) { throw (MissingMethodException)e.getCause(); } else if (receiver.getClass() == e.getType() && e.getMethod().equals(name)) { //TODO: we should consider calling this one directly for MetaClassImpl, // then we save the new method selection // in case there's nothing else, invoke the object's own invokeMethod() return ((GroovyObject)receiver).invokeMethod(name, args); } else { throw e; } }
java
public static Object invokeGroovyObjectInvoker(MissingMethodException e, Object receiver, String name, Object[] args) { if (e instanceof MissingMethodExecutionFailed) { throw (MissingMethodException)e.getCause(); } else if (receiver.getClass() == e.getType() && e.getMethod().equals(name)) { //TODO: we should consider calling this one directly for MetaClassImpl, // then we save the new method selection // in case there's nothing else, invoke the object's own invokeMethod() return ((GroovyObject)receiver).invokeMethod(name, args); } else { throw e; } }
[ "public", "static", "Object", "invokeGroovyObjectInvoker", "(", "MissingMethodException", "e", ",", "Object", "receiver", ",", "String", "name", ",", "Object", "[", "]", "args", ")", "{", "if", "(", "e", "instanceof", "MissingMethodExecutionFailed", ")", "{", "t...
{@link GroovyObject#invokeMethod(String, Object)} path as fallback. This method is called by the handle as exception handler in case the selected method causes a MissingMethodExecutionFailed, where we will just give through the exception, and a normal MissingMethodException where we call {@link GroovyObject#invokeMethod(String, Object)} if receiver class, the type transported by the exception and the name for the method stored in the exception and our current method name are equal. Should those conditions not apply we just rethrow the exception.
[ "{" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/vmplugin/v7/IndyGuardsFiltersAndSignatures.java#L155-L167
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/super_src/com/google/gwt/dom/client/DOMImplWebkit.java
DOMImplWebkit.setDraggable
@Override public void setDraggable(Element elem, String draggable) { super.setDraggable(elem, draggable); if ("true".equals(draggable)) { elem.getStyle().setProperty("webkitUserDrag", "element"); } else { elem.getStyle().clearProperty("webkitUserDrag"); } }
java
@Override public void setDraggable(Element elem, String draggable) { super.setDraggable(elem, draggable); if ("true".equals(draggable)) { elem.getStyle().setProperty("webkitUserDrag", "element"); } else { elem.getStyle().clearProperty("webkitUserDrag"); } }
[ "@", "Override", "public", "void", "setDraggable", "(", "Element", "elem", ",", "String", "draggable", ")", "{", "super", ".", "setDraggable", "(", "elem", ",", "draggable", ")", ";", "if", "(", "\"true\"", ".", "equals", "(", "draggable", ")", ")", "{",...
Webkit based browsers require that we set the webkit-user-drag style attribute to make an element draggable.
[ "Webkit", "based", "browsers", "require", "that", "we", "set", "the", "webkit", "-", "user", "-", "drag", "style", "attribute", "to", "make", "an", "element", "draggable", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/super_src/com/google/gwt/dom/client/DOMImplWebkit.java#L58-L66
ziccardi/jnrpe
jnrpe-plugins/src/main/java/it/jnrpe/plugin/mysql/CheckMysql.java
CheckMysql.checkSlave
private Metric checkSlave(final ICommandLine cl, final Mysql mysql, final Connection conn) throws MetricGatheringException { Metric metric = null; try { Map<String, Integer> status = getSlaveStatus(conn); if (status.isEmpty()) { mysql.closeConnection(conn); throw new MetricGatheringException("CHECK_MYSQL - WARNING: No slaves defined. ", Status.CRITICAL, null); } // check if slave is running int slaveIoRunning = status.get("Slave_IO_Running"); int slaveSqlRunning = status.get("Slave_SQL_Running"); int secondsBehindMaster = status.get("Seconds_Behind_Master"); if (slaveIoRunning == 0 || slaveSqlRunning == 0) { mysql.closeConnection(conn); throw new MetricGatheringException("CHECK_MYSQL - CRITICAL: Slave status unavailable. ", Status.CRITICAL, null); } String slaveResult = "Slave IO: " + slaveIoRunning + " Slave SQL: " + slaveSqlRunning + " Seconds Behind Master: " + secondsBehindMaster; metric = new Metric("secondsBehindMaster", slaveResult, new BigDecimal(secondsBehindMaster), null, null); } catch (SQLException e) { String message = e.getMessage(); LOG.warn(getContext(), "Error executing the CheckMysql plugin: " + message, e); throw new MetricGatheringException("CHECK_MYSQL - CRITICAL: Unable to check slave status: - " + message, Status.CRITICAL, e); } return metric; }
java
private Metric checkSlave(final ICommandLine cl, final Mysql mysql, final Connection conn) throws MetricGatheringException { Metric metric = null; try { Map<String, Integer> status = getSlaveStatus(conn); if (status.isEmpty()) { mysql.closeConnection(conn); throw new MetricGatheringException("CHECK_MYSQL - WARNING: No slaves defined. ", Status.CRITICAL, null); } // check if slave is running int slaveIoRunning = status.get("Slave_IO_Running"); int slaveSqlRunning = status.get("Slave_SQL_Running"); int secondsBehindMaster = status.get("Seconds_Behind_Master"); if (slaveIoRunning == 0 || slaveSqlRunning == 0) { mysql.closeConnection(conn); throw new MetricGatheringException("CHECK_MYSQL - CRITICAL: Slave status unavailable. ", Status.CRITICAL, null); } String slaveResult = "Slave IO: " + slaveIoRunning + " Slave SQL: " + slaveSqlRunning + " Seconds Behind Master: " + secondsBehindMaster; metric = new Metric("secondsBehindMaster", slaveResult, new BigDecimal(secondsBehindMaster), null, null); } catch (SQLException e) { String message = e.getMessage(); LOG.warn(getContext(), "Error executing the CheckMysql plugin: " + message, e); throw new MetricGatheringException("CHECK_MYSQL - CRITICAL: Unable to check slave status: - " + message, Status.CRITICAL, e); } return metric; }
[ "private", "Metric", "checkSlave", "(", "final", "ICommandLine", "cl", ",", "final", "Mysql", "mysql", ",", "final", "Connection", "conn", ")", "throws", "MetricGatheringException", "{", "Metric", "metric", "=", "null", ";", "try", "{", "Map", "<", "String", ...
Check the status of mysql slave thread. @param cl The command line @param mysql MySQL connection mgr object @param conn The SQL connection @return ReturnValue - @throws MetricGatheringException -
[ "Check", "the", "status", "of", "mysql", "slave", "thread", "." ]
train
https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-plugins/src/main/java/it/jnrpe/plugin/mysql/CheckMysql.java#L117-L146
JodaOrg/joda-money
src/main/java/org/joda/money/format/MoneyFormatterBuilder.java
MoneyFormatterBuilder.appendSigned
public MoneyFormatterBuilder appendSigned( MoneyFormatter whenPositive, MoneyFormatter whenZero, MoneyFormatter whenNegative) { MoneyFormatter.checkNotNull(whenPositive, "MoneyFormatter whenPositive must not be null"); MoneyFormatter.checkNotNull(whenZero, "MoneyFormatter whenZero must not be null"); MoneyFormatter.checkNotNull(whenNegative, "MoneyFormatter whenNegative must not be null"); SignedPrinterParser pp = new SignedPrinterParser(whenPositive, whenZero, whenNegative); return appendInternal(pp, pp); }
java
public MoneyFormatterBuilder appendSigned( MoneyFormatter whenPositive, MoneyFormatter whenZero, MoneyFormatter whenNegative) { MoneyFormatter.checkNotNull(whenPositive, "MoneyFormatter whenPositive must not be null"); MoneyFormatter.checkNotNull(whenZero, "MoneyFormatter whenZero must not be null"); MoneyFormatter.checkNotNull(whenNegative, "MoneyFormatter whenNegative must not be null"); SignedPrinterParser pp = new SignedPrinterParser(whenPositive, whenZero, whenNegative); return appendInternal(pp, pp); }
[ "public", "MoneyFormatterBuilder", "appendSigned", "(", "MoneyFormatter", "whenPositive", ",", "MoneyFormatter", "whenZero", ",", "MoneyFormatter", "whenNegative", ")", "{", "MoneyFormatter", ".", "checkNotNull", "(", "whenPositive", ",", "\"MoneyFormatter whenPositive must n...
Appends the specified formatters, one used when the amount is positive, one when the amount is zero and one when the amount is negative. <p> When printing, the amount is queried and the appropriate formatter is used. <p> When parsing, each formatter is tried, with the longest successful match, or the first match if multiple are successful. If the zero parser is matched, the amount returned will be zero no matter what amount is parsed. If the negative parser is matched, the amount returned will be negative no matter what amount is parsed. <p> A typical use case for this would be to produce a format like '{@code ($123)}' for negative amounts and '{@code $123}' for positive amounts. <p> In order to use this method, it may be necessary to output an unsigned amount. This can be achieved using {@link #appendAmount(MoneyAmountStyle)} and {@link MoneyAmountStyle#withAbsValue(boolean)}. @param whenPositive the formatter to use when the amount is positive @param whenZero the formatter to use when the amount is zero @param whenNegative the formatter to use when the amount is negative @return this for chaining, never null
[ "Appends", "the", "specified", "formatters", "one", "used", "when", "the", "amount", "is", "positive", "one", "when", "the", "amount", "is", "zero", "and", "one", "when", "the", "amount", "is", "negative", ".", "<p", ">", "When", "printing", "the", "amount...
train
https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/format/MoneyFormatterBuilder.java#L244-L251
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/MiniMax.java
MiniMax.findMerge
protected static int findMerge(int end, MatrixParadigm mat, DBIDArrayMIter prots, PointerHierarchyRepresentationBuilder builder, Int2ObjectOpenHashMap<ModifiableDBIDs> clusters, DistanceQuery<?> dq) { final DBIDArrayIter ix = mat.ix, iy = mat.iy; final double[] distances = mat.matrix; double mindist = Double.POSITIVE_INFINITY; int x = -1, y = -1; for(int dx = 0; dx < end; dx++) { // Skip if object is already linked if(builder.isLinked(ix.seek(dx))) { continue; } final int xoffset = MatrixParadigm.triangleSize(dx); for(int dy = 0; dy < dx; dy++) { // Skip if object is already linked if(builder.isLinked(iy.seek(dy))) { continue; } double dist = distances[xoffset + dy]; if(dist < mindist) { mindist = dist; x = dx; y = dy; } } } assert (y < x); merge(end, mat, prots, builder, clusters, dq, x, y); return x; }
java
protected static int findMerge(int end, MatrixParadigm mat, DBIDArrayMIter prots, PointerHierarchyRepresentationBuilder builder, Int2ObjectOpenHashMap<ModifiableDBIDs> clusters, DistanceQuery<?> dq) { final DBIDArrayIter ix = mat.ix, iy = mat.iy; final double[] distances = mat.matrix; double mindist = Double.POSITIVE_INFINITY; int x = -1, y = -1; for(int dx = 0; dx < end; dx++) { // Skip if object is already linked if(builder.isLinked(ix.seek(dx))) { continue; } final int xoffset = MatrixParadigm.triangleSize(dx); for(int dy = 0; dy < dx; dy++) { // Skip if object is already linked if(builder.isLinked(iy.seek(dy))) { continue; } double dist = distances[xoffset + dy]; if(dist < mindist) { mindist = dist; x = dx; y = dy; } } } assert (y < x); merge(end, mat, prots, builder, clusters, dq, x, y); return x; }
[ "protected", "static", "int", "findMerge", "(", "int", "end", ",", "MatrixParadigm", "mat", ",", "DBIDArrayMIter", "prots", ",", "PointerHierarchyRepresentationBuilder", "builder", ",", "Int2ObjectOpenHashMap", "<", "ModifiableDBIDs", ">", "clusters", ",", "DistanceQuer...
Find the best merge. @param mat Matrix view @param prots Prototypes @param builder Result builder @param clusters Current clusters @param dq Distance query @return x, for shrinking the working set.
[ "Find", "the", "best", "merge", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/MiniMax.java#L147-L178
jnidzwetzki/bitfinex-v2-wss-api-java
src/main/java/com/github/jnidzwetzki/bitfinex/v2/BitfinexClientFactory.java
BitfinexClientFactory.newPooledClient
public static BitfinexWebsocketClient newPooledClient(final BitfinexWebsocketConfiguration config, final int channelsPerConnection) { if (channelsPerConnection < 10 || channelsPerConnection > 250) { throw new IllegalArgumentException("channelsPerConnection must be in range (10, 250)"); } final BitfinexApiCallbackRegistry callbacks = new BitfinexApiCallbackRegistry(); final SequenceNumberAuditor sequenceNumberAuditor = new SequenceNumberAuditor(); sequenceNumberAuditor.setErrorPolicy(config.getErrorPolicy()); return new PooledBitfinexApiBroker(config, callbacks, sequenceNumberAuditor, channelsPerConnection); }
java
public static BitfinexWebsocketClient newPooledClient(final BitfinexWebsocketConfiguration config, final int channelsPerConnection) { if (channelsPerConnection < 10 || channelsPerConnection > 250) { throw new IllegalArgumentException("channelsPerConnection must be in range (10, 250)"); } final BitfinexApiCallbackRegistry callbacks = new BitfinexApiCallbackRegistry(); final SequenceNumberAuditor sequenceNumberAuditor = new SequenceNumberAuditor(); sequenceNumberAuditor.setErrorPolicy(config.getErrorPolicy()); return new PooledBitfinexApiBroker(config, callbacks, sequenceNumberAuditor, channelsPerConnection); }
[ "public", "static", "BitfinexWebsocketClient", "newPooledClient", "(", "final", "BitfinexWebsocketConfiguration", "config", ",", "final", "int", "channelsPerConnection", ")", "{", "if", "(", "channelsPerConnection", "<", "10", "||", "channelsPerConnection", ">", "250", ...
bitfinex client with subscribed channel managed. spreads amount of subscribed channels across multiple websocket physical connections. @param config - config @param channelsPerConnection - channels per client - 25 - 250 (limit by bitfinex exchange) @return {@link PooledBitfinexApiBroker} client
[ "bitfinex", "client", "with", "subscribed", "channel", "managed", ".", "spreads", "amount", "of", "subscribed", "channels", "across", "multiple", "websocket", "physical", "connections", "." ]
train
https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/BitfinexClientFactory.java#L54-L67
greenmail-mail-test/greenmail
greenmail-core/src/main/java/com/icegreen/greenmail/util/GreenMailUtil.java
GreenMailUtil.createMultipartWithAttachment
public static MimeMultipart createMultipartWithAttachment(String msg, final byte[] attachment, final String contentType, final String filename, String description) { try { MimeMultipart multiPart = new MimeMultipart(); MimeBodyPart textPart = new MimeBodyPart(); multiPart.addBodyPart(textPart); textPart.setText(msg); MimeBodyPart binaryPart = new MimeBodyPart(); multiPart.addBodyPart(binaryPart); DataSource ds = new DataSource() { @Override public InputStream getInputStream() throws IOException { return new ByteArrayInputStream(attachment); } @Override public OutputStream getOutputStream() throws IOException { ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); byteStream.write(attachment); return byteStream; } @Override public String getContentType() { return contentType; } @Override public String getName() { return filename; } }; binaryPart.setDataHandler(new DataHandler(ds)); binaryPart.setFileName(filename); binaryPart.setDescription(description); return multiPart; } catch (MessagingException e) { throw new IllegalArgumentException("Can not create multipart message with attachment", e); } }
java
public static MimeMultipart createMultipartWithAttachment(String msg, final byte[] attachment, final String contentType, final String filename, String description) { try { MimeMultipart multiPart = new MimeMultipart(); MimeBodyPart textPart = new MimeBodyPart(); multiPart.addBodyPart(textPart); textPart.setText(msg); MimeBodyPart binaryPart = new MimeBodyPart(); multiPart.addBodyPart(binaryPart); DataSource ds = new DataSource() { @Override public InputStream getInputStream() throws IOException { return new ByteArrayInputStream(attachment); } @Override public OutputStream getOutputStream() throws IOException { ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); byteStream.write(attachment); return byteStream; } @Override public String getContentType() { return contentType; } @Override public String getName() { return filename; } }; binaryPart.setDataHandler(new DataHandler(ds)); binaryPart.setFileName(filename); binaryPart.setDescription(description); return multiPart; } catch (MessagingException e) { throw new IllegalArgumentException("Can not create multipart message with attachment", e); } }
[ "public", "static", "MimeMultipart", "createMultipartWithAttachment", "(", "String", "msg", ",", "final", "byte", "[", "]", "attachment", ",", "final", "String", "contentType", ",", "final", "String", "filename", ",", "String", "description", ")", "{", "try", "{...
Create new multipart with a text part and an attachment @param msg Message text @param attachment Attachment data @param contentType MIME content type of body @param filename File name of the attachment @param description Description of the attachment @return New multipart
[ "Create", "new", "multipart", "with", "a", "text", "part", "and", "an", "attachment" ]
train
https://github.com/greenmail-mail-test/greenmail/blob/6d19a62233d1ef6fedbbd1f6fdde2d28e713834a/greenmail-core/src/main/java/com/icegreen/greenmail/util/GreenMailUtil.java#L322-L364
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/reflect/ReflectionUtils.java
ReflectionUtils.getValue
public static <T> T getValue(Object obj, String fieldName, Class<T> fieldType) { try { return getValue(obj, getField(obj.getClass(), fieldName), fieldType); } catch (FieldNotFoundException e) { throw new IllegalArgumentException(String.format("Field with name (%1$s) does not exist on object of type (%2$s)!", fieldName, obj.getClass().getName()), e); } }
java
public static <T> T getValue(Object obj, String fieldName, Class<T> fieldType) { try { return getValue(obj, getField(obj.getClass(), fieldName), fieldType); } catch (FieldNotFoundException e) { throw new IllegalArgumentException(String.format("Field with name (%1$s) does not exist on object of type (%2$s)!", fieldName, obj.getClass().getName()), e); } }
[ "public", "static", "<", "T", ">", "T", "getValue", "(", "Object", "obj", ",", "String", "fieldName", ",", "Class", "<", "T", ">", "fieldType", ")", "{", "try", "{", "return", "getValue", "(", "obj", ",", "getField", "(", "obj", ".", "getClass", "(",...
Gets the value of the field with the specified name on the given object cast to the desired field type. This method assumes the field is a instance (object) member field. @param <T> the desired return type in which the field's value will be cast; should be compatible with the field's declared type. @param obj the Object on which the field is defined. @param fieldName a String indicating the name of the field from which to get the value. @param fieldType the declared type of the object's field. @return the value of the specified field on the given object cast to the desired type. @throws IllegalArgumentException if the given object's class type does not declare a instance member field with the specified name. @throws FieldAccessException if the value for the specified field could not be retrieved. @see #getField(Class, String) @see #getValue(Object, java.lang.reflect.Field, Class)
[ "Gets", "the", "value", "of", "the", "field", "with", "the", "specified", "name", "on", "the", "given", "object", "cast", "to", "the", "desired", "field", "type", ".", "This", "method", "assumes", "the", "field", "is", "a", "instance", "(", "object", ")"...
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/reflect/ReflectionUtils.java#L127-L135
OpenLiberty/open-liberty
dev/com.ibm.ws.ssl/src/com/ibm/websphere/ssl/JSSEHelper.java
JSSEHelper.getProperties
public Properties getProperties(String sslAliasName, Map<String, Object> connectionInfo, SSLConfigChangeListener listener) throws SSLException { return getProperties(sslAliasName, connectionInfo, listener, true); }
java
public Properties getProperties(String sslAliasName, Map<String, Object> connectionInfo, SSLConfigChangeListener listener) throws SSLException { return getProperties(sslAliasName, connectionInfo, listener, true); }
[ "public", "Properties", "getProperties", "(", "String", "sslAliasName", ",", "Map", "<", "String", ",", "Object", ">", "connectionInfo", ",", "SSLConfigChangeListener", "listener", ")", "throws", "SSLException", "{", "return", "getProperties", "(", "sslAliasName", "...
<p> This method returns the effective SSL properties object for use by an SSL application or component. </p> <p> When Java 2 Security is enabled, access to call this method requires WebSphereRuntimePermission "getSSLConfig" to be granted. </p> @param sslAliasName - Used in direct selection. The alias name of a specific SSL configuration (optional). You can pass in "null" here. If sslAliasName is provided but does not exist it will check connection information for a match. Then look for a default if no match with the connection information. @param connectionInfo - This refers to the remote connection information. The current properties known by the runtime include: <p> Example OUTBOUND case (endpoint refers more to protocol used since outbound names are not well-known): <ul> <li>com.ibm.ssl.remoteHost="hostname.ibm.com"</li> <li>com.ibm.ssl.remotePort="9809"</li> <li>com.ibm.ssl.direction="outbound"</li> </ul></p> <p> Example INBOUND case (endpoint name matches serverindex endpoint): <code> com.ibm.ssl.direction="inbound" </code></p> It's highly recommended to supply these properties when possible. @param listener - This is used to notify the caller of this API that the SSL configuration changed in the runtime. It's up to the caller to decide if they want to call this API again to get the new SSLContext for the configuration. Passing in NULL indicates no notification is desired. See the com.ibm.websphere.ssl.SSLConfigChangeListener interface for more information. @return Properties for the requested sslAliasName. If the requested sslAliasName is not avialable, the default properties will be returned. If the default properties are not available, null is returned. @throws com.ibm.websphere.ssl.SSLException @ibm-api
[ "<p", ">", "This", "method", "returns", "the", "effective", "SSL", "properties", "object", "for", "use", "by", "an", "SSL", "application", "or", "component", ".", "<", "/", "p", ">", "<p", ">", "When", "Java", "2", "Security", "is", "enabled", "access", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/websphere/ssl/JSSEHelper.java#L987-L989
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/math/SloppyMath.java
SloppyMath.logAdd
public static float logAdd(float lx, float ly) { float max, negDiff; if (lx > ly) { max = lx; negDiff = ly - lx; } else { max = ly; negDiff = lx - ly; } if (max == Double.NEGATIVE_INFINITY) { return max; } else if (negDiff < -LOGTOLERANCE_F) { return max; } else { return max + (float) Math.log(1.0 + Math.exp(negDiff)); } }
java
public static float logAdd(float lx, float ly) { float max, negDiff; if (lx > ly) { max = lx; negDiff = ly - lx; } else { max = ly; negDiff = lx - ly; } if (max == Double.NEGATIVE_INFINITY) { return max; } else if (negDiff < -LOGTOLERANCE_F) { return max; } else { return max + (float) Math.log(1.0 + Math.exp(negDiff)); } }
[ "public", "static", "float", "logAdd", "(", "float", "lx", ",", "float", "ly", ")", "{", "float", "max", ",", "negDiff", ";", "if", "(", "lx", ">", "ly", ")", "{", "max", "=", "lx", ";", "negDiff", "=", "ly", "-", "lx", ";", "}", "else", "{", ...
Returns the log of the sum of two numbers, which are themselves input in log form. This uses natural logarithms. Reasonable care is taken to do this as efficiently as possible (under the assumption that the numbers might differ greatly in magnitude), with high accuracy, and without numerical overflow. Also, handle correctly the case of arguments being -Inf (e.g., probability 0). @param lx First number, in log form @param ly Second number, in log form @return log(exp(lx) + exp(ly))
[ "Returns", "the", "log", "of", "the", "sum", "of", "two", "numbers", "which", "are", "themselves", "input", "in", "log", "form", ".", "This", "uses", "natural", "logarithms", ".", "Reasonable", "care", "is", "taken", "to", "do", "this", "as", "efficiently"...
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/SloppyMath.java#L240-L256
mozilla/rhino
src/org/mozilla/javascript/NativeGlobal.java
NativeGlobal.js_eval
private Object js_eval(Context cx, Scriptable scope, Object[] args) { Scriptable global = ScriptableObject.getTopLevelScope(scope); return ScriptRuntime.evalSpecial(cx, global, global, args, "eval code", 1); }
java
private Object js_eval(Context cx, Scriptable scope, Object[] args) { Scriptable global = ScriptableObject.getTopLevelScope(scope); return ScriptRuntime.evalSpecial(cx, global, global, args, "eval code", 1); }
[ "private", "Object", "js_eval", "(", "Context", "cx", ",", "Scriptable", "scope", ",", "Object", "[", "]", "args", ")", "{", "Scriptable", "global", "=", "ScriptableObject", ".", "getTopLevelScope", "(", "scope", ")", ";", "return", "ScriptRuntime", ".", "ev...
This is an indirect call to eval, and thus uses the global environment. Direct calls are executed via ScriptRuntime.callSpecial().
[ "This", "is", "an", "indirect", "call", "to", "eval", "and", "thus", "uses", "the", "global", "environment", ".", "Direct", "calls", "are", "executed", "via", "ScriptRuntime", ".", "callSpecial", "()", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/NativeGlobal.java#L482-L486
actorapp/actor-platform
actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java
Messenger.rawRequest
@ObjectiveCName("rawRequestWithService:withMethod:WithParams:") public void rawRequest(String service, String method, ApiRawValue params) { modules.getExternalModule().rawRequest(service, method, params); }
java
@ObjectiveCName("rawRequestWithService:withMethod:WithParams:") public void rawRequest(String service, String method, ApiRawValue params) { modules.getExternalModule().rawRequest(service, method, params); }
[ "@", "ObjectiveCName", "(", "\"rawRequestWithService:withMethod:WithParams:\"", ")", "public", "void", "rawRequest", "(", "String", "service", ",", "String", "method", ",", "ApiRawValue", "params", ")", "{", "modules", ".", "getExternalModule", "(", ")", ".", "rawRe...
Command for raw api request @param service service name @param method method name @param params request params
[ "Command", "for", "raw", "api", "request" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java#L2638-L2641
elki-project/elki
elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/OPTICSOF.java
OPTICSOF.run
public OutlierResult run(Database database, Relation<O> relation) { DistanceQuery<O> distQuery = database.getDistanceQuery(relation, getDistanceFunction()); KNNQuery<O> knnQuery = database.getKNNQuery(distQuery, minpts); RangeQuery<O> rangeQuery = database.getRangeQuery(distQuery); DBIDs ids = relation.getDBIDs(); // FIXME: implicit preprocessor. WritableDataStore<KNNList> nMinPts = DataStoreUtil.makeStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP, KNNList.class); WritableDoubleDataStore coreDistance = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP); WritableIntegerDataStore minPtsNeighborhoodSize = DataStoreUtil.makeIntegerStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP, -1); // Pass 1 // N_minpts(id) and core-distance(id) for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { KNNList minptsNeighbours = knnQuery.getKNNForDBID(iditer, minpts); double d = minptsNeighbours.getKNNDistance(); nMinPts.put(iditer, minptsNeighbours); coreDistance.putDouble(iditer, d); minPtsNeighborhoodSize.put(iditer, rangeQuery.getRangeForDBID(iditer, d).size()); } // Pass 2 WritableDataStore<List<Double>> reachDistance = DataStoreUtil.makeStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP, List.class); WritableDoubleDataStore lrds = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP); for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { List<Double> core = new ArrayList<>(); double lrd = 0; // TODO: optimize for double distances for(DoubleDBIDListIter neighbor = nMinPts.get(iditer).iter(); neighbor.valid(); neighbor.advance()) { double coreDist = coreDistance.doubleValue(neighbor); double dist = distQuery.distance(iditer, neighbor); double rd = MathUtil.max(coreDist, dist); lrd = rd + lrd; core.add(rd); } lrd = minPtsNeighborhoodSize.intValue(iditer) / lrd; reachDistance.put(iditer, core); lrds.putDouble(iditer, lrd); } // Pass 3 DoubleMinMax ofminmax = new DoubleMinMax(); WritableDoubleDataStore ofs = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_STATIC); for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { double of = 0; for(DBIDIter neighbor = nMinPts.get(iditer).iter(); neighbor.valid(); neighbor.advance()) { double lrd = lrds.doubleValue(iditer); double lrdN = lrds.doubleValue(neighbor); of = of + lrdN / lrd; } of = of / minPtsNeighborhoodSize.intValue(iditer); ofs.putDouble(iditer, of); // update minimum and maximum ofminmax.put(of); } // Build result representation. DoubleRelation scoreResult = new MaterializedDoubleRelation("OPTICS Outlier Scores", "optics-outlier", ofs, relation.getDBIDs()); OutlierScoreMeta scoreMeta = new QuotientOutlierScoreMeta(ofminmax.getMin(), ofminmax.getMax(), 0.0, Double.POSITIVE_INFINITY, 1.0); return new OutlierResult(scoreMeta, scoreResult); }
java
public OutlierResult run(Database database, Relation<O> relation) { DistanceQuery<O> distQuery = database.getDistanceQuery(relation, getDistanceFunction()); KNNQuery<O> knnQuery = database.getKNNQuery(distQuery, minpts); RangeQuery<O> rangeQuery = database.getRangeQuery(distQuery); DBIDs ids = relation.getDBIDs(); // FIXME: implicit preprocessor. WritableDataStore<KNNList> nMinPts = DataStoreUtil.makeStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP, KNNList.class); WritableDoubleDataStore coreDistance = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP); WritableIntegerDataStore minPtsNeighborhoodSize = DataStoreUtil.makeIntegerStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP, -1); // Pass 1 // N_minpts(id) and core-distance(id) for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { KNNList minptsNeighbours = knnQuery.getKNNForDBID(iditer, minpts); double d = minptsNeighbours.getKNNDistance(); nMinPts.put(iditer, minptsNeighbours); coreDistance.putDouble(iditer, d); minPtsNeighborhoodSize.put(iditer, rangeQuery.getRangeForDBID(iditer, d).size()); } // Pass 2 WritableDataStore<List<Double>> reachDistance = DataStoreUtil.makeStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP, List.class); WritableDoubleDataStore lrds = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP); for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { List<Double> core = new ArrayList<>(); double lrd = 0; // TODO: optimize for double distances for(DoubleDBIDListIter neighbor = nMinPts.get(iditer).iter(); neighbor.valid(); neighbor.advance()) { double coreDist = coreDistance.doubleValue(neighbor); double dist = distQuery.distance(iditer, neighbor); double rd = MathUtil.max(coreDist, dist); lrd = rd + lrd; core.add(rd); } lrd = minPtsNeighborhoodSize.intValue(iditer) / lrd; reachDistance.put(iditer, core); lrds.putDouble(iditer, lrd); } // Pass 3 DoubleMinMax ofminmax = new DoubleMinMax(); WritableDoubleDataStore ofs = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_STATIC); for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { double of = 0; for(DBIDIter neighbor = nMinPts.get(iditer).iter(); neighbor.valid(); neighbor.advance()) { double lrd = lrds.doubleValue(iditer); double lrdN = lrds.doubleValue(neighbor); of = of + lrdN / lrd; } of = of / minPtsNeighborhoodSize.intValue(iditer); ofs.putDouble(iditer, of); // update minimum and maximum ofminmax.put(of); } // Build result representation. DoubleRelation scoreResult = new MaterializedDoubleRelation("OPTICS Outlier Scores", "optics-outlier", ofs, relation.getDBIDs()); OutlierScoreMeta scoreMeta = new QuotientOutlierScoreMeta(ofminmax.getMin(), ofminmax.getMax(), 0.0, Double.POSITIVE_INFINITY, 1.0); return new OutlierResult(scoreMeta, scoreResult); }
[ "public", "OutlierResult", "run", "(", "Database", "database", ",", "Relation", "<", "O", ">", "relation", ")", "{", "DistanceQuery", "<", "O", ">", "distQuery", "=", "database", ".", "getDistanceQuery", "(", "relation", ",", "getDistanceFunction", "(", ")", ...
Perform OPTICS-based outlier detection. @param database Database @param relation Relation @return Outlier detection result
[ "Perform", "OPTICS", "-", "based", "outlier", "detection", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/OPTICSOF.java#L116-L176
jboss/jboss-jsf-api_spec
src/main/java/javax/faces/component/UIViewRoot.java
UIViewRoot.processApplication
public void processApplication(FacesContext context) { initState(); notifyBefore(context, PhaseId.INVOKE_APPLICATION); try { if (!skipPhase) { // NOTE - no tree walk is performed; this is a UIViewRoot-only operation broadcastEvents(context, PhaseId.INVOKE_APPLICATION); } } finally { clearFacesEvents(context); notifyAfter(context, PhaseId.INVOKE_APPLICATION); } }
java
public void processApplication(FacesContext context) { initState(); notifyBefore(context, PhaseId.INVOKE_APPLICATION); try { if (!skipPhase) { // NOTE - no tree walk is performed; this is a UIViewRoot-only operation broadcastEvents(context, PhaseId.INVOKE_APPLICATION); } } finally { clearFacesEvents(context); notifyAfter(context, PhaseId.INVOKE_APPLICATION); } }
[ "public", "void", "processApplication", "(", "FacesContext", "context", ")", "{", "initState", "(", ")", ";", "notifyBefore", "(", "context", ",", "PhaseId", ".", "INVOKE_APPLICATION", ")", ";", "try", "{", "if", "(", "!", "skipPhase", ")", "{", "// NOTE - n...
<p>Broadcast any events that have been queued for the <em>Invoke Application</em> phase of the request processing lifecycle and to clear out any events for later phases if the event processing for this phase caused {@link FacesContext#renderResponse} or {@link FacesContext#responseComplete} to be called.</p> @param context {@link FacesContext} for the request we are processing @throws NullPointerException if <code>context</code> is <code>null</code>
[ "<p", ">", "Broadcast", "any", "events", "that", "have", "been", "queued", "for", "the", "<em", ">", "Invoke", "Application<", "/", "em", ">", "phase", "of", "the", "request", "processing", "lifecycle", "and", "to", "clear", "out", "any", "events", "for", ...
train
https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/component/UIViewRoot.java#L1276-L1288
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/map/impl/LocalMapStatsUtil.java
LocalMapStatsUtil.incrementOtherOperationsCount
public static void incrementOtherOperationsCount(MapService service, String mapName) { MapServiceContext mapServiceContext = service.getMapServiceContext(); MapContainer mapContainer = mapServiceContext.getMapContainer(mapName); if (mapContainer.getMapConfig().isStatisticsEnabled()) { LocalMapStatsImpl localMapStats = mapServiceContext.getLocalMapStatsProvider().getLocalMapStatsImpl(mapName); localMapStats.incrementOtherOperations(); } }
java
public static void incrementOtherOperationsCount(MapService service, String mapName) { MapServiceContext mapServiceContext = service.getMapServiceContext(); MapContainer mapContainer = mapServiceContext.getMapContainer(mapName); if (mapContainer.getMapConfig().isStatisticsEnabled()) { LocalMapStatsImpl localMapStats = mapServiceContext.getLocalMapStatsProvider().getLocalMapStatsImpl(mapName); localMapStats.incrementOtherOperations(); } }
[ "public", "static", "void", "incrementOtherOperationsCount", "(", "MapService", "service", ",", "String", "mapName", ")", "{", "MapServiceContext", "mapServiceContext", "=", "service", ".", "getMapServiceContext", "(", ")", ";", "MapContainer", "mapContainer", "=", "m...
Increments other operations count statistic in local map statistics. @param service @param mapName
[ "Increments", "other", "operations", "count", "statistic", "in", "local", "map", "statistics", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/LocalMapStatsUtil.java#L35-L42
google/closure-compiler
src/com/google/javascript/jscomp/AstFactory.java
AstFactory.createThisAliasReferenceForFunction
Node createThisAliasReferenceForFunction(String aliasName, Node functionNode) { final Node result = IR.name(aliasName); if (isAddingTypes()) { result.setJSType(getTypeOfThisForFunctionNode(functionNode)); } return result; }
java
Node createThisAliasReferenceForFunction(String aliasName, Node functionNode) { final Node result = IR.name(aliasName); if (isAddingTypes()) { result.setJSType(getTypeOfThisForFunctionNode(functionNode)); } return result; }
[ "Node", "createThisAliasReferenceForFunction", "(", "String", "aliasName", ",", "Node", "functionNode", ")", "{", "final", "Node", "result", "=", "IR", ".", "name", "(", "aliasName", ")", ";", "if", "(", "isAddingTypes", "(", ")", ")", "{", "result", ".", ...
Creates a NAME node having the type of "this" appropriate for the given function node.
[ "Creates", "a", "NAME", "node", "having", "the", "type", "of", "this", "appropriate", "for", "the", "given", "function", "node", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AstFactory.java#L309-L315
phax/ph-web
ph-httpclient/src/main/java/com/helger/httpclient/response/ExtendedHttpResponseException.java
ExtendedHttpResponseException.getResponseBodyAsString
@Nullable public String getResponseBodyAsString (@Nonnull final Charset aCharset) { return m_aResponseBody == null ? null : new String (m_aResponseBody, aCharset); }
java
@Nullable public String getResponseBodyAsString (@Nonnull final Charset aCharset) { return m_aResponseBody == null ? null : new String (m_aResponseBody, aCharset); }
[ "@", "Nullable", "public", "String", "getResponseBodyAsString", "(", "@", "Nonnull", "final", "Charset", "aCharset", ")", "{", "return", "m_aResponseBody", "==", "null", "?", "null", ":", "new", "String", "(", "m_aResponseBody", ",", "aCharset", ")", ";", "}" ...
Get the response body as a string in the provided charset. @param aCharset The charset to use. May not be <code>null</code>. @return <code>null</code> if no response body is present.
[ "Get", "the", "response", "body", "as", "a", "string", "in", "the", "provided", "charset", "." ]
train
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-httpclient/src/main/java/com/helger/httpclient/response/ExtendedHttpResponseException.java#L148-L152
UrielCh/ovh-java-sdk
ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java
ApiOvhVps.serviceName_veeam_restorePoints_id_restore_POST
public OvhTask serviceName_veeam_restorePoints_id_restore_POST(String serviceName, Long id, Boolean changePassword, OvhExportTypeEnum export, Boolean full) throws IOException { String qPath = "/vps/{serviceName}/veeam/restorePoints/{id}/restore"; StringBuilder sb = path(qPath, serviceName, id); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "changePassword", changePassword); addBody(o, "export", export); addBody(o, "full", full); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_veeam_restorePoints_id_restore_POST(String serviceName, Long id, Boolean changePassword, OvhExportTypeEnum export, Boolean full) throws IOException { String qPath = "/vps/{serviceName}/veeam/restorePoints/{id}/restore"; StringBuilder sb = path(qPath, serviceName, id); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "changePassword", changePassword); addBody(o, "export", export); addBody(o, "full", full); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_veeam_restorePoints_id_restore_POST", "(", "String", "serviceName", ",", "Long", "id", ",", "Boolean", "changePassword", ",", "OvhExportTypeEnum", "export", ",", "Boolean", "full", ")", "throws", "IOException", "{", "String", "qPath", ...
Creates a VPS.Task that will restore the given restorePoint REST: POST /vps/{serviceName}/veeam/restorePoints/{id}/restore @param full [required] Replace your current VPS by the restorePoint @param changePassword [required] (Full only) Change the restored VPS root password when done @param export [required] (Except full) The export method for your restore - defaults to both @param serviceName [required] The internal name of your VPS offer @param id [required] Id of the object
[ "Creates", "a", "VPS", ".", "Task", "that", "will", "restore", "the", "given", "restorePoint" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java#L699-L708
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SpoofChecker.java
SpoofChecker.getResolvedScriptSetWithout
private void getResolvedScriptSetWithout(CharSequence input, int script, ScriptSet result) { result.setAll(); ScriptSet temp = new ScriptSet(); for (int utf16Offset = 0; utf16Offset < input.length();) { int codePoint = Character.codePointAt(input, utf16Offset); utf16Offset += Character.charCount(codePoint); // Compute the augmented script set for the character getAugmentedScriptSet(codePoint, temp); // Intersect the augmented script set with the resolved script set, but only if the character doesn't // have the script specified in the function call if (script == UScript.CODE_LIMIT || !temp.get(script)) { result.and(temp); } } }
java
private void getResolvedScriptSetWithout(CharSequence input, int script, ScriptSet result) { result.setAll(); ScriptSet temp = new ScriptSet(); for (int utf16Offset = 0; utf16Offset < input.length();) { int codePoint = Character.codePointAt(input, utf16Offset); utf16Offset += Character.charCount(codePoint); // Compute the augmented script set for the character getAugmentedScriptSet(codePoint, temp); // Intersect the augmented script set with the resolved script set, but only if the character doesn't // have the script specified in the function call if (script == UScript.CODE_LIMIT || !temp.get(script)) { result.and(temp); } } }
[ "private", "void", "getResolvedScriptSetWithout", "(", "CharSequence", "input", ",", "int", "script", ",", "ScriptSet", "result", ")", "{", "result", ".", "setAll", "(", ")", ";", "ScriptSet", "temp", "=", "new", "ScriptSet", "(", ")", ";", "for", "(", "in...
Computes the resolved script set for a string, omitting characters having the specified script. If UScript.CODE_LIMIT is passed as the second argument, all characters are included.
[ "Computes", "the", "resolved", "script", "set", "for", "a", "string", "omitting", "characters", "having", "the", "specified", "script", ".", "If", "UScript", ".", "CODE_LIMIT", "is", "passed", "as", "the", "second", "argument", "all", "characters", "are", "inc...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SpoofChecker.java#L1527-L1544
Whiley/WhileyCompiler
src/main/java/wyil/interpreter/Interpreter.java
Interpreter.checkInvariants
public void checkInvariants(CallStack frame, Tuple<Expr> invariants) { for (int i = 0; i != invariants.size(); ++i) { RValue.Bool b = executeExpression(BOOL_T, invariants.get(i), frame); if (b == RValue.False) { // FIXME: need to do more here throw new AssertionError(); } } }
java
public void checkInvariants(CallStack frame, Tuple<Expr> invariants) { for (int i = 0; i != invariants.size(); ++i) { RValue.Bool b = executeExpression(BOOL_T, invariants.get(i), frame); if (b == RValue.False) { // FIXME: need to do more here throw new AssertionError(); } } }
[ "public", "void", "checkInvariants", "(", "CallStack", "frame", ",", "Tuple", "<", "Expr", ">", "invariants", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "!=", "invariants", ".", "size", "(", ")", ";", "++", "i", ")", "{", "RValue", ".", ...
Evaluate zero or more conditional expressions, and check whether any is false. If so, raise an exception indicating a runtime fault. @param frame @param context @param invariants
[ "Evaluate", "zero", "or", "more", "conditional", "expressions", "and", "check", "whether", "any", "is", "false", ".", "If", "so", "raise", "an", "exception", "indicating", "a", "runtime", "fault", "." ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/interpreter/Interpreter.java#L1240-L1248
elki-project/elki
elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/FormatUtil.java
FormatUtil.endsWith
public static boolean endsWith(CharSequence buf, CharSequence end) { int len = end.length(), start = buf.length() - len; if(start < 0) { return false; } for(int i = 0; i < len; i++, start++) { if(buf.charAt(start) != end.charAt(i)) { return false; } } return true; }
java
public static boolean endsWith(CharSequence buf, CharSequence end) { int len = end.length(), start = buf.length() - len; if(start < 0) { return false; } for(int i = 0; i < len; i++, start++) { if(buf.charAt(start) != end.charAt(i)) { return false; } } return true; }
[ "public", "static", "boolean", "endsWith", "(", "CharSequence", "buf", ",", "CharSequence", "end", ")", "{", "int", "len", "=", "end", ".", "length", "(", ")", ",", "start", "=", "buf", ".", "length", "(", ")", "-", "len", ";", "if", "(", "start", ...
Similar to {@link String#endsWith(String)} but for buffers. @param buf Buffer @param end End @return {@code true} if the buffer ends with the given sequence
[ "Similar", "to", "{", "@link", "String#endsWith", "(", "String", ")", "}", "but", "for", "buffers", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/FormatUtil.java#L1057-L1068
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/pca/weightfunctions/GaussStddevWeight.java
GaussStddevWeight.getWeight
@Override public double getWeight(double distance, double max, double stddev) { if(stddev <= 0) { return 1; } double normdistance = distance / stddev; return scaling * FastMath.exp(-.5 * normdistance * normdistance) / stddev; }
java
@Override public double getWeight(double distance, double max, double stddev) { if(stddev <= 0) { return 1; } double normdistance = distance / stddev; return scaling * FastMath.exp(-.5 * normdistance * normdistance) / stddev; }
[ "@", "Override", "public", "double", "getWeight", "(", "double", "distance", ",", "double", "max", ",", "double", "stddev", ")", "{", "if", "(", "stddev", "<=", "0", ")", "{", "return", "1", ";", "}", "double", "normdistance", "=", "distance", "/", "st...
Get Gaussian Weight using standard deviation for scaling. max is ignored.
[ "Get", "Gaussian", "Weight", "using", "standard", "deviation", "for", "scaling", ".", "max", "is", "ignored", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/pca/weightfunctions/GaussStddevWeight.java#L44-L51
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/ResourceManager.java
ResourceManager.registerTaskExecutorInternal
private RegistrationResponse registerTaskExecutorInternal( TaskExecutorGateway taskExecutorGateway, String taskExecutorAddress, ResourceID taskExecutorResourceId, int dataPort, HardwareDescription hardwareDescription) { WorkerRegistration<WorkerType> oldRegistration = taskExecutors.remove(taskExecutorResourceId); if (oldRegistration != null) { // TODO :: suggest old taskExecutor to stop itself log.debug("Replacing old registration of TaskExecutor {}.", taskExecutorResourceId); // remove old task manager registration from slot manager slotManager.unregisterTaskManager(oldRegistration.getInstanceID()); } final WorkerType newWorker = workerStarted(taskExecutorResourceId); if (newWorker == null) { log.warn("Discard registration from TaskExecutor {} at ({}) because the framework did " + "not recognize it", taskExecutorResourceId, taskExecutorAddress); return new RegistrationResponse.Decline("unrecognized TaskExecutor"); } else { WorkerRegistration<WorkerType> registration = new WorkerRegistration<>(taskExecutorGateway, newWorker, dataPort, hardwareDescription); log.info("Registering TaskManager with ResourceID {} ({}) at ResourceManager", taskExecutorResourceId, taskExecutorAddress); taskExecutors.put(taskExecutorResourceId, registration); taskManagerHeartbeatManager.monitorTarget(taskExecutorResourceId, new HeartbeatTarget<Void>() { @Override public void receiveHeartbeat(ResourceID resourceID, Void payload) { // the ResourceManager will always send heartbeat requests to the // TaskManager } @Override public void requestHeartbeat(ResourceID resourceID, Void payload) { taskExecutorGateway.heartbeatFromResourceManager(resourceID); } }); return new TaskExecutorRegistrationSuccess( registration.getInstanceID(), resourceId, clusterInformation); } }
java
private RegistrationResponse registerTaskExecutorInternal( TaskExecutorGateway taskExecutorGateway, String taskExecutorAddress, ResourceID taskExecutorResourceId, int dataPort, HardwareDescription hardwareDescription) { WorkerRegistration<WorkerType> oldRegistration = taskExecutors.remove(taskExecutorResourceId); if (oldRegistration != null) { // TODO :: suggest old taskExecutor to stop itself log.debug("Replacing old registration of TaskExecutor {}.", taskExecutorResourceId); // remove old task manager registration from slot manager slotManager.unregisterTaskManager(oldRegistration.getInstanceID()); } final WorkerType newWorker = workerStarted(taskExecutorResourceId); if (newWorker == null) { log.warn("Discard registration from TaskExecutor {} at ({}) because the framework did " + "not recognize it", taskExecutorResourceId, taskExecutorAddress); return new RegistrationResponse.Decline("unrecognized TaskExecutor"); } else { WorkerRegistration<WorkerType> registration = new WorkerRegistration<>(taskExecutorGateway, newWorker, dataPort, hardwareDescription); log.info("Registering TaskManager with ResourceID {} ({}) at ResourceManager", taskExecutorResourceId, taskExecutorAddress); taskExecutors.put(taskExecutorResourceId, registration); taskManagerHeartbeatManager.monitorTarget(taskExecutorResourceId, new HeartbeatTarget<Void>() { @Override public void receiveHeartbeat(ResourceID resourceID, Void payload) { // the ResourceManager will always send heartbeat requests to the // TaskManager } @Override public void requestHeartbeat(ResourceID resourceID, Void payload) { taskExecutorGateway.heartbeatFromResourceManager(resourceID); } }); return new TaskExecutorRegistrationSuccess( registration.getInstanceID(), resourceId, clusterInformation); } }
[ "private", "RegistrationResponse", "registerTaskExecutorInternal", "(", "TaskExecutorGateway", "taskExecutorGateway", ",", "String", "taskExecutorAddress", ",", "ResourceID", "taskExecutorResourceId", ",", "int", "dataPort", ",", "HardwareDescription", "hardwareDescription", ")",...
Registers a new TaskExecutor. @param taskExecutorGateway to communicate with the registering TaskExecutor @param taskExecutorAddress address of the TaskExecutor @param taskExecutorResourceId ResourceID of the TaskExecutor @param dataPort port used for data transfer @param hardwareDescription of the registering TaskExecutor @return RegistrationResponse
[ "Registers", "a", "new", "TaskExecutor", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/ResourceManager.java#L683-L729
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/util/XMLUtilities.java
XMLUtilities.getChild
public static Element getChild(Element element, String name) { return (Element) element.getElementsByTagName(name).item(0); }
java
public static Element getChild(Element element, String name) { return (Element) element.getElementsByTagName(name).item(0); }
[ "public", "static", "Element", "getChild", "(", "Element", "element", ",", "String", "name", ")", "{", "return", "(", "Element", ")", "element", ".", "getElementsByTagName", "(", "name", ")", ".", "item", "(", "0", ")", ";", "}" ]
Get the first child element with the given name. @param element The parent element @param name The child element name @return The child element or null
[ "Get", "the", "first", "child", "element", "with", "the", "given", "name", "." ]
train
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/util/XMLUtilities.java#L60-L62
reactor/reactor-netty
src/main/java/reactor/netty/ByteBufFlux.java
ByteBufFlux.asByteArray
public final Flux<byte[]> asByteArray() { return handle((bb, sink) -> { try { byte[] bytes = new byte[bb.readableBytes()]; bb.readBytes(bytes); sink.next(bytes); } catch (IllegalReferenceCountException e) { sink.complete(); } }); }
java
public final Flux<byte[]> asByteArray() { return handle((bb, sink) -> { try { byte[] bytes = new byte[bb.readableBytes()]; bb.readBytes(bytes); sink.next(bytes); } catch (IllegalReferenceCountException e) { sink.complete(); } }); }
[ "public", "final", "Flux", "<", "byte", "[", "]", ">", "asByteArray", "(", ")", "{", "return", "handle", "(", "(", "bb", ",", "sink", ")", "->", "{", "try", "{", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "bb", ".", "readableBytes", "(",...
Convert to a {@literal byte[]} inbound {@link Flux} @return a {@literal byte[]} inbound {@link Flux}
[ "Convert", "to", "a", "{", "@literal", "byte", "[]", "}", "inbound", "{", "@link", "Flux", "}" ]
train
https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/ByteBufFlux.java#L196-L207
cloudfoundry/uaa
server/src/main/java/org/cloudfoundry/identity/uaa/oauth/UaaAuthorizationEndpoint.java
UaaAuthorizationEndpoint.commence
@Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException { String clientId = request.getParameter(OAuth2Utils.CLIENT_ID); String redirectUri = request.getParameter(OAuth2Utils.REDIRECT_URI); String[] responseTypes = ofNullable(request.getParameter(OAuth2Utils.RESPONSE_TYPE)).map(rt -> rt.split(" ")).orElse(new String[0]); ClientDetails client; try { client = getClientServiceExtention().loadClientByClientId(clientId, IdentityZoneHolder.get().getId()); } catch (ClientRegistrationException e) { logger.debug("[prompt=none] Unable to look up client for client_id=" + clientId, e); response.setStatus(HttpStatus.BAD_REQUEST.value()); return; } Set<String> redirectUris = ofNullable(client.getRegisteredRedirectUri()).orElse(EMPTY_SET); //if the client doesn't have a redirect uri set, the parameter is required. if (redirectUris.size() == 0 && !hasText(redirectUri)) { logger.debug("[prompt=none] Missing redirect_uri"); response.setStatus(HttpStatus.BAD_REQUEST.value()); return; } String resolvedRedirect; try { resolvedRedirect = redirectResolver.resolveRedirect(redirectUri, client); } catch (RedirectMismatchException rme) { logger.debug("[prompt=none] Invalid redirect " + redirectUri + " did not match one of the registered values"); response.setStatus(HttpStatus.BAD_REQUEST.value()); return; } HttpHost httpHost = URIUtils.extractHost(URI.create(resolvedRedirect)); String sessionState = openIdSessionStateCalculator.calculate("", clientId, httpHost.toURI()); boolean implicit = stream(responseTypes).noneMatch("code"::equalsIgnoreCase); String redirectLocation; String errorCode = authException instanceof InteractionRequiredException ? "interaction_required" : "login_required"; if (implicit) { redirectLocation = addFragmentComponent(resolvedRedirect, "error="+ errorCode); redirectLocation = addFragmentComponent(redirectLocation, "session_state=" + sessionState); } else { redirectLocation = addQueryParameter(resolvedRedirect, "error", errorCode); redirectLocation = addQueryParameter(redirectLocation, "session_state", sessionState); } response.sendRedirect(redirectLocation); }
java
@Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException { String clientId = request.getParameter(OAuth2Utils.CLIENT_ID); String redirectUri = request.getParameter(OAuth2Utils.REDIRECT_URI); String[] responseTypes = ofNullable(request.getParameter(OAuth2Utils.RESPONSE_TYPE)).map(rt -> rt.split(" ")).orElse(new String[0]); ClientDetails client; try { client = getClientServiceExtention().loadClientByClientId(clientId, IdentityZoneHolder.get().getId()); } catch (ClientRegistrationException e) { logger.debug("[prompt=none] Unable to look up client for client_id=" + clientId, e); response.setStatus(HttpStatus.BAD_REQUEST.value()); return; } Set<String> redirectUris = ofNullable(client.getRegisteredRedirectUri()).orElse(EMPTY_SET); //if the client doesn't have a redirect uri set, the parameter is required. if (redirectUris.size() == 0 && !hasText(redirectUri)) { logger.debug("[prompt=none] Missing redirect_uri"); response.setStatus(HttpStatus.BAD_REQUEST.value()); return; } String resolvedRedirect; try { resolvedRedirect = redirectResolver.resolveRedirect(redirectUri, client); } catch (RedirectMismatchException rme) { logger.debug("[prompt=none] Invalid redirect " + redirectUri + " did not match one of the registered values"); response.setStatus(HttpStatus.BAD_REQUEST.value()); return; } HttpHost httpHost = URIUtils.extractHost(URI.create(resolvedRedirect)); String sessionState = openIdSessionStateCalculator.calculate("", clientId, httpHost.toURI()); boolean implicit = stream(responseTypes).noneMatch("code"::equalsIgnoreCase); String redirectLocation; String errorCode = authException instanceof InteractionRequiredException ? "interaction_required" : "login_required"; if (implicit) { redirectLocation = addFragmentComponent(resolvedRedirect, "error="+ errorCode); redirectLocation = addFragmentComponent(redirectLocation, "session_state=" + sessionState); } else { redirectLocation = addQueryParameter(resolvedRedirect, "error", errorCode); redirectLocation = addQueryParameter(redirectLocation, "session_state", sessionState); } response.sendRedirect(redirectLocation); }
[ "@", "Override", "public", "void", "commence", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ",", "AuthenticationException", "authException", ")", "throws", "IOException", ",", "ServletException", "{", "String", "clientId", "=", "request"...
This method handles /oauth/authorize calls when user is not logged in and the prompt=none param is used
[ "This", "method", "handles", "/", "oauth", "/", "authorize", "calls", "when", "user", "is", "not", "logged", "in", "and", "the", "prompt", "=", "none", "param", "is", "used" ]
train
https://github.com/cloudfoundry/uaa/blob/e8df3d7060580c92d33461106399f9e4f36e3cd2/server/src/main/java/org/cloudfoundry/identity/uaa/oauth/UaaAuthorizationEndpoint.java#L252-L299
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeBuilder.java
AnnotationTypeBuilder.buildAnnotationTypeFieldDetails
public void buildAnnotationTypeFieldDetails(XMLNode node, Content memberDetailsTree) throws DocletException { configuration.getBuilderFactory(). getAnnotationTypeFieldsBuilder(writer).buildChildren(node, memberDetailsTree); }
java
public void buildAnnotationTypeFieldDetails(XMLNode node, Content memberDetailsTree) throws DocletException { configuration.getBuilderFactory(). getAnnotationTypeFieldsBuilder(writer).buildChildren(node, memberDetailsTree); }
[ "public", "void", "buildAnnotationTypeFieldDetails", "(", "XMLNode", "node", ",", "Content", "memberDetailsTree", ")", "throws", "DocletException", "{", "configuration", ".", "getBuilderFactory", "(", ")", ".", "getAnnotationTypeFieldsBuilder", "(", "writer", ")", ".", ...
Build the annotation type field documentation. @param node the XML element that specifies which components to document @param memberDetailsTree the content tree to which the documentation will be added @throws DocletException if there is a problem building the documentation
[ "Build", "the", "annotation", "type", "field", "documentation", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeBuilder.java#L242-L246
ow2-chameleon/fuchsia
bases/knx/calimero/src/main/java/tuwien/auto/calimero/knxnetip/ConnectionImpl.java
ConnectionImpl.fireFrameReceived
protected void fireFrameReceived(CEMI frame) { final FrameEvent fe = new FrameEvent(this, frame); for (final Iterator i = listenersCopy.iterator(); i.hasNext();) { final KNXListener l = (KNXListener) i.next(); try { l.frameReceived(fe); } catch (final RuntimeException e) { removeConnectionListener(l); logger.error("removed event listener", e); } } }
java
protected void fireFrameReceived(CEMI frame) { final FrameEvent fe = new FrameEvent(this, frame); for (final Iterator i = listenersCopy.iterator(); i.hasNext();) { final KNXListener l = (KNXListener) i.next(); try { l.frameReceived(fe); } catch (final RuntimeException e) { removeConnectionListener(l); logger.error("removed event listener", e); } } }
[ "protected", "void", "fireFrameReceived", "(", "CEMI", "frame", ")", "{", "final", "FrameEvent", "fe", "=", "new", "FrameEvent", "(", "this", ",", "frame", ")", ";", "for", "(", "final", "Iterator", "i", "=", "listenersCopy", ".", "iterator", "(", ")", "...
Fires a frame received event ({@link KNXListener#frameReceived(FrameEvent)}) for the supplied cEMI <code>frame</code>. @param frame the cEMI to generate the event for
[ "Fires", "a", "frame", "received", "event", "(", "{", "@link", "KNXListener#frameReceived", "(", "FrameEvent", ")", "}", ")", "for", "the", "supplied", "cEMI", "<code", ">", "frame<", "/", "code", ">", "." ]
train
https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/knxnetip/ConnectionImpl.java#L481-L494
grpc/grpc-java
netty/src/main/java/io/grpc/netty/GrpcSslContexts.java
GrpcSslContexts.forServer
public static SslContextBuilder forServer( File keyCertChainFile, File keyFile, String keyPassword) { return configure(SslContextBuilder.forServer(keyCertChainFile, keyFile, keyPassword)); }
java
public static SslContextBuilder forServer( File keyCertChainFile, File keyFile, String keyPassword) { return configure(SslContextBuilder.forServer(keyCertChainFile, keyFile, keyPassword)); }
[ "public", "static", "SslContextBuilder", "forServer", "(", "File", "keyCertChainFile", ",", "File", "keyFile", ",", "String", "keyPassword", ")", "{", "return", "configure", "(", "SslContextBuilder", ".", "forServer", "(", "keyCertChainFile", ",", "keyFile", ",", ...
Creates a SslContextBuilder with ciphers and APN appropriate for gRPC. @see SslContextBuilder#forServer(File, File, String) @see #configure(SslContextBuilder)
[ "Creates", "a", "SslContextBuilder", "with", "ciphers", "and", "APN", "appropriate", "for", "gRPC", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/GrpcSslContexts.java#L139-L142
landawn/AbacusUtil
src/com/landawn/abacus/util/ClassUtil.java
ClassUtil.getPropValue
@SuppressWarnings("unchecked") public static <T> T getPropValue(final Object entity, final String propName) { return getPropValue(entity, propName, false); }
java
@SuppressWarnings("unchecked") public static <T> T getPropValue(final Object entity, final String propName) { return getPropValue(entity, propName, false); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "getPropValue", "(", "final", "Object", "entity", ",", "final", "String", "propName", ")", "{", "return", "getPropValue", "(", "entity", ",", "propName", ",", "false"...
Refer to getPropValue(Method, Object) @param entity @param propName is case insensitive @return {@link #getPropValue(Object, Method)}
[ "Refer", "to", "getPropValue", "(", "Method", "Object", ")" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/ClassUtil.java#L1826-L1829
structr/structr
structr-core/src/main/java/org/structr/core/entity/AbstractEndpoint.java
AbstractEndpoint.getNotionProperties
protected PropertyMap getNotionProperties(final SecurityContext securityContext, final Class type, final String storageKey) { final Map<String, PropertyMap> notionPropertyMap = (Map<String, PropertyMap>)securityContext.getAttribute("notionProperties"); if (notionPropertyMap != null) { final Set<PropertyKey> keySet = Services.getInstance().getConfigurationProvider().getPropertySet(type, PropertyView.Public); final PropertyMap notionProperties = notionPropertyMap.get(storageKey); if (notionProperties != null) { for (final Iterator<PropertyKey> it = notionProperties.keySet().iterator(); it.hasNext();) { final PropertyKey key = it.next(); if (!keySet.contains(key)) { it.remove(); } } return notionProperties; } } return null; }
java
protected PropertyMap getNotionProperties(final SecurityContext securityContext, final Class type, final String storageKey) { final Map<String, PropertyMap> notionPropertyMap = (Map<String, PropertyMap>)securityContext.getAttribute("notionProperties"); if (notionPropertyMap != null) { final Set<PropertyKey> keySet = Services.getInstance().getConfigurationProvider().getPropertySet(type, PropertyView.Public); final PropertyMap notionProperties = notionPropertyMap.get(storageKey); if (notionProperties != null) { for (final Iterator<PropertyKey> it = notionProperties.keySet().iterator(); it.hasNext();) { final PropertyKey key = it.next(); if (!keySet.contains(key)) { it.remove(); } } return notionProperties; } } return null; }
[ "protected", "PropertyMap", "getNotionProperties", "(", "final", "SecurityContext", "securityContext", ",", "final", "Class", "type", ",", "final", "String", "storageKey", ")", "{", "final", "Map", "<", "String", ",", "PropertyMap", ">", "notionPropertyMap", "=", ...
Loads a PropertyMap from the current security context that was previously stored there by one of the Notions that was executed before this relationship creation. @param securityContext the security context @param type the entity type @param storageKey the key for which the PropertyMap was stored @return a PropertyMap or null
[ "Loads", "a", "PropertyMap", "from", "the", "current", "security", "context", "that", "was", "previously", "stored", "there", "by", "one", "of", "the", "Notions", "that", "was", "executed", "before", "this", "relationship", "creation", "." ]
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/core/entity/AbstractEndpoint.java#L73-L97
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/AssertKripton.java
AssertKripton.assertTrueOfInvalidConstructor
public static void assertTrueOfInvalidConstructor(boolean expression, ModelClass<?> entity) { if (!expression) { String msg = String.format( "Class '%s' has no constructor without parameters (to be a mutable class) or with all parameters (to be an immutable class).", entity.getElement().getQualifiedName()); throw (new InvalidDefinition(msg)); } }
java
public static void assertTrueOfInvalidConstructor(boolean expression, ModelClass<?> entity) { if (!expression) { String msg = String.format( "Class '%s' has no constructor without parameters (to be a mutable class) or with all parameters (to be an immutable class).", entity.getElement().getQualifiedName()); throw (new InvalidDefinition(msg)); } }
[ "public", "static", "void", "assertTrueOfInvalidConstructor", "(", "boolean", "expression", ",", "ModelClass", "<", "?", ">", "entity", ")", "{", "if", "(", "!", "expression", ")", "{", "String", "msg", "=", "String", ".", "format", "(", "\"Class '%s' has no c...
When a pojo has a valid constructor @param expression @param entity
[ "When", "a", "pojo", "has", "a", "valid", "constructor" ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/AssertKripton.java#L465-L473
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/ValueUtils.java
ValueUtils.convertDate
public static Date convertDate(Object target, String dateTimeFormat) { if (target instanceof JsonNode) { return convertDate((JsonNode) target, dateTimeFormat); } return target instanceof Number ? new Date(((Number) target).longValue()) : (target instanceof String ? DateFormatUtils.fromString(target.toString(), dateTimeFormat) : (target instanceof Date ? (Date) target : null)); }
java
public static Date convertDate(Object target, String dateTimeFormat) { if (target instanceof JsonNode) { return convertDate((JsonNode) target, dateTimeFormat); } return target instanceof Number ? new Date(((Number) target).longValue()) : (target instanceof String ? DateFormatUtils.fromString(target.toString(), dateTimeFormat) : (target instanceof Date ? (Date) target : null)); }
[ "public", "static", "Date", "convertDate", "(", "Object", "target", ",", "String", "dateTimeFormat", ")", "{", "if", "(", "target", "instanceof", "JsonNode", ")", "{", "return", "convertDate", "(", "(", "JsonNode", ")", "target", ",", "dateTimeFormat", ")", ...
Convert a target object to {@link Date}. If the target object is a string, parse it as a {@link Date} using the specified date-time format. @param target @param dateTimeFormat @return @since 0.6.3.1
[ "Convert", "a", "target", "object", "to", "{", "@link", "Date", "}", ".", "If", "the", "target", "object", "is", "a", "string", "parse", "it", "as", "a", "{", "@link", "Date", "}", "using", "the", "specified", "date", "-", "time", "format", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/ValueUtils.java#L180-L188
ThreeTen/threeten-extra
src/main/java/org/threeten/extra/Temporals.java
Temporals.parseFirstMatching
public static <T> T parseFirstMatching(CharSequence text, TemporalQuery<T> query, DateTimeFormatter... formatters) { Objects.requireNonNull(text, "text"); Objects.requireNonNull(query, "query"); Objects.requireNonNull(formatters, "formatters"); if (formatters.length == 0) { throw new DateTimeParseException("No formatters specified", text, 0); } if (formatters.length == 1) { return formatters[0].parse(text, query); } for (DateTimeFormatter formatter : formatters) { try { ParsePosition pp = new ParsePosition(0); formatter.parseUnresolved(text, pp); int len = text.length(); if (pp.getErrorIndex() == -1 && pp.getIndex() == len) { return formatter.parse(text, query); } } catch (RuntimeException ex) { // should not happen, but ignore if it does } } throw new DateTimeParseException("Text '" + text + "' could not be parsed", text, 0); }
java
public static <T> T parseFirstMatching(CharSequence text, TemporalQuery<T> query, DateTimeFormatter... formatters) { Objects.requireNonNull(text, "text"); Objects.requireNonNull(query, "query"); Objects.requireNonNull(formatters, "formatters"); if (formatters.length == 0) { throw new DateTimeParseException("No formatters specified", text, 0); } if (formatters.length == 1) { return formatters[0].parse(text, query); } for (DateTimeFormatter formatter : formatters) { try { ParsePosition pp = new ParsePosition(0); formatter.parseUnresolved(text, pp); int len = text.length(); if (pp.getErrorIndex() == -1 && pp.getIndex() == len) { return formatter.parse(text, query); } } catch (RuntimeException ex) { // should not happen, but ignore if it does } } throw new DateTimeParseException("Text '" + text + "' could not be parsed", text, 0); }
[ "public", "static", "<", "T", ">", "T", "parseFirstMatching", "(", "CharSequence", "text", ",", "TemporalQuery", "<", "T", ">", "query", ",", "DateTimeFormatter", "...", "formatters", ")", "{", "Objects", ".", "requireNonNull", "(", "text", ",", "\"text\"", ...
Parses the text using one of the formatters. <p> This will try each formatter in turn, attempting to fully parse the specified text. The temporal query is typically a method reference to a {@code from(TemporalAccessor)} method. For example: <pre> LocalDateTime dt = Temporals.parseFirstMatching(str, LocalDateTime::from, fmt1, fm2, fm3); </pre> If the parse completes without reading the entire length of the text, or a problem occurs during parsing or merging, then an exception is thrown. @param <T> the type of the parsed date-time @param text the text to parse, not null @param query the query defining the type to parse to, not null @param formatters the formatters to try, not null @return the parsed date-time, not null @throws DateTimeParseException if unable to parse the requested result
[ "Parses", "the", "text", "using", "one", "of", "the", "formatters", ".", "<p", ">", "This", "will", "try", "each", "formatter", "in", "turn", "attempting", "to", "fully", "parse", "the", "specified", "text", ".", "The", "temporal", "query", "is", "typicall...
train
https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/Temporals.java#L216-L239
inferred/FreeBuilder
src/main/java/org/inferred/freebuilder/processor/naming/NamingConventions.java
NamingConventions.determineNamingConvention
public static NamingConvention determineNamingConvention( TypeElement type, Iterable<ExecutableElement> methods, Messager messager, Types types) { ExecutableElement beanMethod = null; ExecutableElement prefixlessMethod = null; for (ExecutableElement method : methods) { switch (methodNameConvention(method)) { case BEAN: beanMethod = firstNonNull(beanMethod, method); break; case PREFIXLESS: prefixlessMethod = firstNonNull(prefixlessMethod, method); break; default: break; } } if (prefixlessMethod != null) { if (beanMethod != null) { messager.printMessage( ERROR, "Type contains an illegal mix of get-prefixed and unprefixed getter methods, e.g. '" + beanMethod.getSimpleName() + "' and '" + prefixlessMethod.getSimpleName() + "'", type); } return new PrefixlessConvention(messager, types); } else { return new BeanConvention(messager, types); } }
java
public static NamingConvention determineNamingConvention( TypeElement type, Iterable<ExecutableElement> methods, Messager messager, Types types) { ExecutableElement beanMethod = null; ExecutableElement prefixlessMethod = null; for (ExecutableElement method : methods) { switch (methodNameConvention(method)) { case BEAN: beanMethod = firstNonNull(beanMethod, method); break; case PREFIXLESS: prefixlessMethod = firstNonNull(prefixlessMethod, method); break; default: break; } } if (prefixlessMethod != null) { if (beanMethod != null) { messager.printMessage( ERROR, "Type contains an illegal mix of get-prefixed and unprefixed getter methods, e.g. '" + beanMethod.getSimpleName() + "' and '" + prefixlessMethod.getSimpleName() + "'", type); } return new PrefixlessConvention(messager, types); } else { return new BeanConvention(messager, types); } }
[ "public", "static", "NamingConvention", "determineNamingConvention", "(", "TypeElement", "type", ",", "Iterable", "<", "ExecutableElement", ">", "methods", ",", "Messager", "messager", ",", "Types", "types", ")", "{", "ExecutableElement", "beanMethod", "=", "null", ...
Determine whether the user has followed bean-like naming convention or not.
[ "Determine", "whether", "the", "user", "has", "followed", "bean", "-", "like", "naming", "convention", "or", "not", "." ]
train
https://github.com/inferred/FreeBuilder/blob/d5a222f90648aece135da4b971c55a60afe8649c/src/main/java/org/inferred/freebuilder/processor/naming/NamingConventions.java#L37-L68
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/FDBigInteger.java
FDBigInteger.multAndCarryBy10
private static int multAndCarryBy10(int[] src, int srcLen, int[] dst) { long carry = 0; for (int i = 0; i < srcLen; i++) { long product = (src[i] & LONG_MASK) * 10L + carry; dst[i] = (int) product; carry = product >>> 32; } return (int) carry; }
java
private static int multAndCarryBy10(int[] src, int srcLen, int[] dst) { long carry = 0; for (int i = 0; i < srcLen; i++) { long product = (src[i] & LONG_MASK) * 10L + carry; dst[i] = (int) product; carry = product >>> 32; } return (int) carry; }
[ "private", "static", "int", "multAndCarryBy10", "(", "int", "[", "]", "src", ",", "int", "srcLen", ",", "int", "[", "]", "dst", ")", "{", "long", "carry", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "srcLen", ";", "i", "++",...
/*@ @ requires src.length >= srcLen && dst.length >= srcLen; @ assignable dst[0 .. srcLen - 1]; @ ensures 0 <= \result && \result < 10; @ ensures AP(dst, srcLen) + (\result << (srcLen*32)) == \old(AP(src, srcLen) * 10); @
[ "/", "*" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/FDBigInteger.java#L1343-L1351
Alexey1Gavrilov/ExpectIt
expectit-ant/src/main/java/net/sf/expectit/ant/matcher/AbstractMultiMatcherElement.java
AbstractMultiMatcherElement.exportSuccessfulResult
@Override protected void exportSuccessfulResult(String prefix, MultiResult result) { super.exportSuccessfulResult(prefix, result); for (int i = 0; i < tasks.size(); i++) { AbstractMatcherElement<Result> t = tasks.get(i); t.exportSuccessfulResult(t.getResultPrefix(), result.getResults().get(i)); t.exportSuccessfulResult(prefix + "." + i, result.getResults().get(i)); } }
java
@Override protected void exportSuccessfulResult(String prefix, MultiResult result) { super.exportSuccessfulResult(prefix, result); for (int i = 0; i < tasks.size(); i++) { AbstractMatcherElement<Result> t = tasks.get(i); t.exportSuccessfulResult(t.getResultPrefix(), result.getResults().get(i)); t.exportSuccessfulResult(prefix + "." + i, result.getResults().get(i)); } }
[ "@", "Override", "protected", "void", "exportSuccessfulResult", "(", "String", "prefix", ",", "MultiResult", "result", ")", "{", "super", ".", "exportSuccessfulResult", "(", "prefix", ",", "result", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<"...
{@inheritDoc} <p/> In addition, this method exports the children results. They are exported using their {@code resultPrefix}, and via shortcut {@code prefix + "." + &lt;number&gt;}, where the number here is the result index. @param prefix the property prefix @param result the result
[ "{", "@inheritDoc", "}", "<p", "/", ">", "In", "addition", "this", "method", "exports", "the", "children", "results", ".", "They", "are", "exported", "using", "their", "{", "@code", "resultPrefix", "}", "and", "via", "shortcut", "{", "@code", "prefix", "+"...
train
https://github.com/Alexey1Gavrilov/ExpectIt/blob/5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3/expectit-ant/src/main/java/net/sf/expectit/ant/matcher/AbstractMultiMatcherElement.java#L56-L64
salesforce/Argus
ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/dto/DashboardDto.java
DashboardDto.transformToDto
public static List<DashboardDto> transformToDto(List<Dashboard> dashboards) { if (dashboards == null) { throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR); } List<DashboardDto> result = new ArrayList<DashboardDto>(); for (Dashboard dashboard : dashboards) { result.add(transformToDto(dashboard)); } return result; }
java
public static List<DashboardDto> transformToDto(List<Dashboard> dashboards) { if (dashboards == null) { throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR); } List<DashboardDto> result = new ArrayList<DashboardDto>(); for (Dashboard dashboard : dashboards) { result.add(transformToDto(dashboard)); } return result; }
[ "public", "static", "List", "<", "DashboardDto", ">", "transformToDto", "(", "List", "<", "Dashboard", ">", "dashboards", ")", "{", "if", "(", "dashboards", "==", "null", ")", "{", "throw", "new", "WebApplicationException", "(", "\"Null entity object cannot be con...
Converts list of dashboard entity objects to list of dashboardDto objects. @param dashboards List of dashboard entities. Cannot be null. @return List of dashboard objects. @throws WebApplicationException If an error occurs.
[ "Converts", "list", "of", "dashboard", "entity", "objects", "to", "list", "of", "dashboardDto", "objects", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/dto/DashboardDto.java#L97-L108
hankcs/HanLP
src/main/java/com/hankcs/hanlp/seg/Other/CommonAhoCorasickSegmentUtil.java
CommonAhoCorasickSegmentUtil.segmentReverseOrder
public static <V> LinkedList<ResultTerm<V>> segmentReverseOrder(final char[] charArray, AhoCorasickDoubleArrayTrie<V> trie) { LinkedList<ResultTerm<V>> termList = new LinkedList<ResultTerm<V>>(); final ResultTerm<V>[] wordNet = new ResultTerm[charArray.length + 1]; trie.parseText(charArray, new AhoCorasickDoubleArrayTrie.IHit<V>() { @Override public void hit(int begin, int end, V value) { if (wordNet[end] == null || wordNet[end].word.length() < end - begin) { wordNet[end] = new ResultTerm<V>(new String(charArray, begin, end - begin), value, begin); } } }); for (int i = charArray.length; i > 0;) { if (wordNet[i] == null) { StringBuilder sbTerm = new StringBuilder(); int offset = i - 1; byte preCharType = CharType.get(charArray[offset]); while (i > 0 && wordNet[i] == null && CharType.get(charArray[i - 1]) == preCharType) { sbTerm.append(charArray[i - 1]); preCharType = CharType.get(charArray[i - 1]); --i; } termList.addFirst(new ResultTerm<V>(sbTerm.reverse().toString(), null, offset)); } else { termList.addFirst(wordNet[i]); i -= wordNet[i].word.length(); } } return termList; }
java
public static <V> LinkedList<ResultTerm<V>> segmentReverseOrder(final char[] charArray, AhoCorasickDoubleArrayTrie<V> trie) { LinkedList<ResultTerm<V>> termList = new LinkedList<ResultTerm<V>>(); final ResultTerm<V>[] wordNet = new ResultTerm[charArray.length + 1]; trie.parseText(charArray, new AhoCorasickDoubleArrayTrie.IHit<V>() { @Override public void hit(int begin, int end, V value) { if (wordNet[end] == null || wordNet[end].word.length() < end - begin) { wordNet[end] = new ResultTerm<V>(new String(charArray, begin, end - begin), value, begin); } } }); for (int i = charArray.length; i > 0;) { if (wordNet[i] == null) { StringBuilder sbTerm = new StringBuilder(); int offset = i - 1; byte preCharType = CharType.get(charArray[offset]); while (i > 0 && wordNet[i] == null && CharType.get(charArray[i - 1]) == preCharType) { sbTerm.append(charArray[i - 1]); preCharType = CharType.get(charArray[i - 1]); --i; } termList.addFirst(new ResultTerm<V>(sbTerm.reverse().toString(), null, offset)); } else { termList.addFirst(wordNet[i]); i -= wordNet[i].word.length(); } } return termList; }
[ "public", "static", "<", "V", ">", "LinkedList", "<", "ResultTerm", "<", "V", ">", ">", "segmentReverseOrder", "(", "final", "char", "[", "]", "charArray", ",", "AhoCorasickDoubleArrayTrie", "<", "V", ">", "trie", ")", "{", "LinkedList", "<", "ResultTerm", ...
逆向最长分词,合并未知语素 @param charArray 文本 @param trie 自动机 @param <V> 类型 @return 结果链表
[ "逆向最长分词,合并未知语素" ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/Other/CommonAhoCorasickSegmentUtil.java#L102-L139
kaazing/gateway
service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/cachecontrol/CacheControlHandler.java
CacheControlHandler.parseMaxAgeMplus
private String parseMaxAgeMplus(String value, long lastModified) { long currentTimeMillis = System.currentTimeMillis(); return Long.toString(Long.parseLong(value) + (lastModified - currentTimeMillis) / 1000); }
java
private String parseMaxAgeMplus(String value, long lastModified) { long currentTimeMillis = System.currentTimeMillis(); return Long.toString(Long.parseLong(value) + (lastModified - currentTimeMillis) / 1000); }
[ "private", "String", "parseMaxAgeMplus", "(", "String", "value", ",", "long", "lastModified", ")", "{", "long", "currentTimeMillis", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "return", "Long", ".", "toString", "(", "Long", ".", "parseLong", "(", ...
Parse value for a max-age (m + N value), according to the requested file's last modified date @param value @param lastModified @return max-age parsed value
[ "Parse", "value", "for", "a", "max", "-", "age", "(", "m", "+", "N", "value", ")", "according", "to", "the", "requested", "file", "s", "last", "modified", "date" ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/cachecontrol/CacheControlHandler.java#L118-L121
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java
MathUtils.squaredLoss
public static double squaredLoss(double[] x, double[] y, double w_0, double w_1) { double sum = 0; for (int j = 0; j < x.length; j++) { sum += Math.pow((y[j] - (w_1 * x[j] + w_0)), 2); } return sum; }
java
public static double squaredLoss(double[] x, double[] y, double w_0, double w_1) { double sum = 0; for (int j = 0; j < x.length; j++) { sum += Math.pow((y[j] - (w_1 * x[j] + w_0)), 2); } return sum; }
[ "public", "static", "double", "squaredLoss", "(", "double", "[", "]", "x", ",", "double", "[", "]", "y", ",", "double", "w_0", ",", "double", "w_1", ")", "{", "double", "sum", "=", "0", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "x",...
This will return the squared loss of the given points @param x the x coordinates to use @param y the y coordinates to use @param w_0 the first weight @param w_1 the second weight @return the squared loss of the given points
[ "This", "will", "return", "the", "squared", "loss", "of", "the", "given", "points", "@param", "x", "the", "x", "coordinates", "to", "use", "@param", "y", "the", "y", "coordinates", "to", "use", "@param", "w_0", "the", "first", "weight" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java#L408-L414
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/ZipUtil.java
ZipUtil.containsEntry
public static boolean containsEntry(File zip, String name) { ZipFile zf = null; try { zf = new ZipFile(zip); return zf.getEntry(name) != null; } catch (IOException e) { throw ZipExceptionUtil.rethrow(e); } finally { closeQuietly(zf); } }
java
public static boolean containsEntry(File zip, String name) { ZipFile zf = null; try { zf = new ZipFile(zip); return zf.getEntry(name) != null; } catch (IOException e) { throw ZipExceptionUtil.rethrow(e); } finally { closeQuietly(zf); } }
[ "public", "static", "boolean", "containsEntry", "(", "File", "zip", ",", "String", "name", ")", "{", "ZipFile", "zf", "=", "null", ";", "try", "{", "zf", "=", "new", "ZipFile", "(", "zip", ")", ";", "return", "zf", ".", "getEntry", "(", "name", ")", ...
Checks if the ZIP file contains the given entry. @param zip ZIP file. @param name entry name. @return <code>true</code> if the ZIP file contains the given entry.
[ "Checks", "if", "the", "ZIP", "file", "contains", "the", "given", "entry", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L86-L98
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/TransactionWriteRequest.java
TransactionWriteRequest.addUpdate
public TransactionWriteRequest addUpdate(Object object, DynamoDBTransactionWriteExpression transactionWriteExpression, ReturnValuesOnConditionCheckFailure returnValuesOnConditionCheckFailure) { transactionWriteOperations.add(new TransactionWriteOperation(object, TransactionWriteOperationType.Update, transactionWriteExpression, returnValuesOnConditionCheckFailure)); return this; }
java
public TransactionWriteRequest addUpdate(Object object, DynamoDBTransactionWriteExpression transactionWriteExpression, ReturnValuesOnConditionCheckFailure returnValuesOnConditionCheckFailure) { transactionWriteOperations.add(new TransactionWriteOperation(object, TransactionWriteOperationType.Update, transactionWriteExpression, returnValuesOnConditionCheckFailure)); return this; }
[ "public", "TransactionWriteRequest", "addUpdate", "(", "Object", "object", ",", "DynamoDBTransactionWriteExpression", "transactionWriteExpression", ",", "ReturnValuesOnConditionCheckFailure", "returnValuesOnConditionCheckFailure", ")", "{", "transactionWriteOperations", ".", "add", ...
Adds update operation (to be executed on object) to the list of transaction write operations. transactionWriteExpression is used to conditionally update object. returnValuesOnConditionCheckFailure specifies which attributes values (of existing item) should be returned if condition check fails.
[ "Adds", "update", "operation", "(", "to", "be", "executed", "on", "object", ")", "to", "the", "list", "of", "transaction", "write", "operations", ".", "transactionWriteExpression", "is", "used", "to", "conditionally", "update", "object", ".", "returnValuesOnCondit...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/TransactionWriteRequest.java#L94-L99
apache/incubator-shardingsphere
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/lexer/LexerEngineFactory.java
LexerEngineFactory.newInstance
public static LexerEngine newInstance(final DatabaseType dbType, final String sql) { switch (dbType) { case H2: return new LexerEngine(new H2Lexer(sql)); case MySQL: return new LexerEngine(new MySQLLexer(sql)); case Oracle: return new LexerEngine(new OracleLexer(sql)); case SQLServer: return new LexerEngine(new SQLServerLexer(sql)); case PostgreSQL: return new LexerEngine(new PostgreSQLLexer(sql)); default: throw new UnsupportedOperationException(String.format("Cannot support database [%s].", dbType)); } }
java
public static LexerEngine newInstance(final DatabaseType dbType, final String sql) { switch (dbType) { case H2: return new LexerEngine(new H2Lexer(sql)); case MySQL: return new LexerEngine(new MySQLLexer(sql)); case Oracle: return new LexerEngine(new OracleLexer(sql)); case SQLServer: return new LexerEngine(new SQLServerLexer(sql)); case PostgreSQL: return new LexerEngine(new PostgreSQLLexer(sql)); default: throw new UnsupportedOperationException(String.format("Cannot support database [%s].", dbType)); } }
[ "public", "static", "LexerEngine", "newInstance", "(", "final", "DatabaseType", "dbType", ",", "final", "String", "sql", ")", "{", "switch", "(", "dbType", ")", "{", "case", "H2", ":", "return", "new", "LexerEngine", "(", "new", "H2Lexer", "(", "sql", ")",...
Create lexical analysis engine instance. @param dbType database type @param sql SQL @return lexical analysis engine instance
[ "Create", "lexical", "analysis", "engine", "instance", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/lexer/LexerEngineFactory.java#L44-L59
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPAttachmentFileEntryPersistenceImpl.java
CPAttachmentFileEntryPersistenceImpl.fetchByC_ERC
@Override public CPAttachmentFileEntry fetchByC_ERC(long companyId, String externalReferenceCode) { return fetchByC_ERC(companyId, externalReferenceCode, true); }
java
@Override public CPAttachmentFileEntry fetchByC_ERC(long companyId, String externalReferenceCode) { return fetchByC_ERC(companyId, externalReferenceCode, true); }
[ "@", "Override", "public", "CPAttachmentFileEntry", "fetchByC_ERC", "(", "long", "companyId", ",", "String", "externalReferenceCode", ")", "{", "return", "fetchByC_ERC", "(", "companyId", ",", "externalReferenceCode", ",", "true", ")", ";", "}" ]
Returns the cp attachment file entry where companyId = &#63; and externalReferenceCode = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache. @param companyId the company ID @param externalReferenceCode the external reference code @return the matching cp attachment file entry, or <code>null</code> if a matching cp attachment file entry could not be found
[ "Returns", "the", "cp", "attachment", "file", "entry", "where", "companyId", "=", "&#63", ";", "and", "externalReferenceCode", "=", "&#63", ";", "or", "returns", "<code", ">", "null<", "/", "code", ">", "if", "it", "could", "not", "be", "found", ".", "Us...
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPAttachmentFileEntryPersistenceImpl.java#L4810-L4814
jbundle/jbundle
thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessage.java
BaseMessage.putString
public void putString(String strKey, String strValue) { if (this.getMessageFieldDesc(strKey) != null) this.getMessageFieldDesc(strKey).putString(strValue); else this.putNative(strKey, strValue); }
java
public void putString(String strKey, String strValue) { if (this.getMessageFieldDesc(strKey) != null) this.getMessageFieldDesc(strKey).putString(strValue); else this.putNative(strKey, strValue); }
[ "public", "void", "putString", "(", "String", "strKey", ",", "String", "strValue", ")", "{", "if", "(", "this", ".", "getMessageFieldDesc", "(", "strKey", ")", "!=", "null", ")", "this", ".", "getMessageFieldDesc", "(", "strKey", ")", ".", "putString", "("...
Convert this external data format to the raw object and put it in the map. Typically overidden to return correctly converted data.
[ "Convert", "this", "external", "data", "format", "to", "the", "raw", "object", "and", "put", "it", "in", "the", "map", ".", "Typically", "overidden", "to", "return", "correctly", "converted", "data", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessage.java#L216-L222
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/DataModelSerializer.java
DataModelSerializer.serializeAsString
public static String serializeAsString(Object o) throws IOException { try { JsonStructure builtJsonObject = findFieldsToSerialize(o).mainObject; return builtJsonObject.toString(); } catch (IllegalStateException ise) { // the reflective attempt to build the object failed. throw new IOException("Unable to build JSON for Object", ise); } catch (JsonException e) { throw new IOException("Unable to build JSON for Object", e); } }
java
public static String serializeAsString(Object o) throws IOException { try { JsonStructure builtJsonObject = findFieldsToSerialize(o).mainObject; return builtJsonObject.toString(); } catch (IllegalStateException ise) { // the reflective attempt to build the object failed. throw new IOException("Unable to build JSON for Object", ise); } catch (JsonException e) { throw new IOException("Unable to build JSON for Object", e); } }
[ "public", "static", "String", "serializeAsString", "(", "Object", "o", ")", "throws", "IOException", "{", "try", "{", "JsonStructure", "builtJsonObject", "=", "findFieldsToSerialize", "(", "o", ")", ".", "mainObject", ";", "return", "builtJsonObject", ".", "toStri...
Convert a POJO into Serialized JSON form. @param o the POJO to serialize @return a String containing the JSON data. @throws IOException when there are problems creating the Json.
[ "Convert", "a", "POJO", "into", "Serialized", "JSON", "form", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/DataModelSerializer.java#L308-L318
Chorus-bdd/Chorus
interpreter/chorus-processes/src/main/java/org/chorusbdd/chorus/processes/manager/ProcessManagerImpl.java
ProcessManagerImpl.startProcess
public synchronized void startProcess(String configName, String processName, Properties processProperties) throws Exception { ProcessManagerConfig runtimeConfig = getProcessManagerConfig(configName, processProperties); if ( runtimeConfig.isEnabled()) { //could be disabled in some profiles doStart(processName, runtimeConfig); } else { log.info("Not starting process " + processName + " since enabled=false"); } }
java
public synchronized void startProcess(String configName, String processName, Properties processProperties) throws Exception { ProcessManagerConfig runtimeConfig = getProcessManagerConfig(configName, processProperties); if ( runtimeConfig.isEnabled()) { //could be disabled in some profiles doStart(processName, runtimeConfig); } else { log.info("Not starting process " + processName + " since enabled=false"); } }
[ "public", "synchronized", "void", "startProcess", "(", "String", "configName", ",", "String", "processName", ",", "Properties", "processProperties", ")", "throws", "Exception", "{", "ProcessManagerConfig", "runtimeConfig", "=", "getProcessManagerConfig", "(", "configName"...
Starts a record Java process using properties defined in a properties file alongside the feature file @throws Exception
[ "Starts", "a", "record", "Java", "process", "using", "properties", "defined", "in", "a", "properties", "file", "alongside", "the", "feature", "file" ]
train
https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-processes/src/main/java/org/chorusbdd/chorus/processes/manager/ProcessManagerImpl.java#L88-L97
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/ocr/OcrClient.java
OcrClient.idcardRecognition
public IdcardRecognitionResponse idcardRecognition(String image, String side) { IdcardRecognitionRequest request = new IdcardRecognitionRequest().withImage(image).withSide(side); return idcardRecognition(request); }
java
public IdcardRecognitionResponse idcardRecognition(String image, String side) { IdcardRecognitionRequest request = new IdcardRecognitionRequest().withImage(image).withSide(side); return idcardRecognition(request); }
[ "public", "IdcardRecognitionResponse", "idcardRecognition", "(", "String", "image", ",", "String", "side", ")", "{", "IdcardRecognitionRequest", "request", "=", "new", "IdcardRecognitionRequest", "(", ")", ".", "withImage", "(", "image", ")", ".", "withSide", "(", ...
Gets the idcard recognition properties of specific image resource. <p> The caller <i>must</i> authenticate with a valid BCE Access Key / Private Key pair. @param image The image data which needs to be base64 @param side The side of idcard image. (front/back) @return The idcard recognition properties of the image resource
[ "Gets", "the", "idcard", "recognition", "properties", "of", "specific", "image", "resource", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/ocr/OcrClient.java#L123-L126
jOOQ/jOOL
jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java
Unchecked.objIntConsumer
public static <T> ObjIntConsumer<T> objIntConsumer(CheckedObjIntConsumer<T> consumer) { return objIntConsumer(consumer, THROWABLE_TO_RUNTIME_EXCEPTION); }
java
public static <T> ObjIntConsumer<T> objIntConsumer(CheckedObjIntConsumer<T> consumer) { return objIntConsumer(consumer, THROWABLE_TO_RUNTIME_EXCEPTION); }
[ "public", "static", "<", "T", ">", "ObjIntConsumer", "<", "T", ">", "objIntConsumer", "(", "CheckedObjIntConsumer", "<", "T", ">", "consumer", ")", "{", "return", "objIntConsumer", "(", "consumer", ",", "THROWABLE_TO_RUNTIME_EXCEPTION", ")", ";", "}" ]
Wrap a {@link CheckedObjIntConsumer} in a {@link ObjIntConsumer}.
[ "Wrap", "a", "{" ]
train
https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L246-L248
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java
ApiOvhDedicatedCloud.serviceName_user_userId_right_rightId_GET
public OvhRight serviceName_user_userId_right_rightId_GET(String serviceName, Long userId, Long rightId) throws IOException { String qPath = "/dedicatedCloud/{serviceName}/user/{userId}/right/{rightId}"; StringBuilder sb = path(qPath, serviceName, userId, rightId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhRight.class); }
java
public OvhRight serviceName_user_userId_right_rightId_GET(String serviceName, Long userId, Long rightId) throws IOException { String qPath = "/dedicatedCloud/{serviceName}/user/{userId}/right/{rightId}"; StringBuilder sb = path(qPath, serviceName, userId, rightId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhRight.class); }
[ "public", "OvhRight", "serviceName_user_userId_right_rightId_GET", "(", "String", "serviceName", ",", "Long", "userId", ",", "Long", "rightId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicatedCloud/{serviceName}/user/{userId}/right/{rightId}\"", ";", ...
Get this object properties REST: GET /dedicatedCloud/{serviceName}/user/{userId}/right/{rightId} @param serviceName [required] Domain of the service @param userId [required] @param rightId [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L730-L735
stephanenicolas/toothpick
toothpick-runtime/src/main/java/toothpick/ScopeImpl.java
ScopeImpl.getBoundProvider
private <T> InternalProviderImpl<? extends T> getBoundProvider(Class<T> clazz, String bindingName) { return getInternalProvider(clazz, bindingName, true); }
java
private <T> InternalProviderImpl<? extends T> getBoundProvider(Class<T> clazz, String bindingName) { return getInternalProvider(clazz, bindingName, true); }
[ "private", "<", "T", ">", "InternalProviderImpl", "<", "?", "extends", "T", ">", "getBoundProvider", "(", "Class", "<", "T", ">", "clazz", ",", "String", "bindingName", ")", "{", "return", "getInternalProvider", "(", "clazz", ",", "bindingName", ",", "true",...
Obtains the provider of the class {@code clazz} and name {@code bindingName}, if any. The returned provider will be bound to the scope. It can be {@code null} if there is no such provider. Ancestors are not taken into account. @param clazz the class for which to obtain the bound provider. @param bindingName the name, possibly {@code null}, for which to obtain the bound provider. @param <T> the type of {@code clazz}. @return the bound provider for class {@code clazz} and {@code bindingName}. Returns {@code null} is there is no such bound provider.
[ "Obtains", "the", "provider", "of", "the", "class", "{", "@code", "clazz", "}", "and", "name", "{", "@code", "bindingName", "}", "if", "any", ".", "The", "returned", "provider", "will", "be", "bound", "to", "the", "scope", ".", "It", "can", "be", "{", ...
train
https://github.com/stephanenicolas/toothpick/blob/54476ca9a5fa48809c15a46e43e38db9ed7e1a75/toothpick-runtime/src/main/java/toothpick/ScopeImpl.java#L362-L364
CenturyLinkCloud/mdw
mdw-common/src/com/centurylink/mdw/model/user/User.java
User.addRoleForGroup
public void addRoleForGroup(String groupName, String roleName) { if (workgroups==null) { workgroups = new Workgroup[1]; workgroups[0] = new Workgroup(null, groupName, null); } List<String> roles = workgroups[0].getRoles(); if (roles==null) { roles = new ArrayList<String>(); workgroups[0].setRoles(roles); } roles.add(roleName); }
java
public void addRoleForGroup(String groupName, String roleName) { if (workgroups==null) { workgroups = new Workgroup[1]; workgroups[0] = new Workgroup(null, groupName, null); } List<String> roles = workgroups[0].getRoles(); if (roles==null) { roles = new ArrayList<String>(); workgroups[0].setRoles(roles); } roles.add(roleName); }
[ "public", "void", "addRoleForGroup", "(", "String", "groupName", ",", "String", "roleName", ")", "{", "if", "(", "workgroups", "==", "null", ")", "{", "workgroups", "=", "new", "Workgroup", "[", "1", "]", ";", "workgroups", "[", "0", "]", "=", "new", "...
This is only used when UserVO is a member of UserGroupVO. Only that group is populated as a substructure to store roles. @param groupId @param roleName
[ "This", "is", "only", "used", "when", "UserVO", "is", "a", "member", "of", "UserGroupVO", ".", "Only", "that", "group", "is", "populated", "as", "a", "substructure", "to", "store", "roles", "." ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/model/user/User.java#L289-L300
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/script/el/tokens/MapKeyToken.java
MapKeyToken.write
public void write(Object object, Object value) { if(object instanceof Map) mapUpdate((Map)object, _identifier, value); else beanUpdate(object, _identifier, value); }
java
public void write(Object object, Object value) { if(object instanceof Map) mapUpdate((Map)object, _identifier, value); else beanUpdate(object, _identifier, value); }
[ "public", "void", "write", "(", "Object", "object", ",", "Object", "value", ")", "{", "if", "(", "object", "instanceof", "Map", ")", "mapUpdate", "(", "(", "Map", ")", "object", ",", "_identifier", ",", "value", ")", ";", "else", "beanUpdate", "(", "ob...
Update a the value represented by this token on the given <code>object</code> with the new value. @param object the object @param value the new value of this property on the object
[ "Update", "a", "the", "value", "represented", "by", "this", "token", "on", "the", "given", "<code", ">", "object<", "/", "code", ">", "with", "the", "new", "value", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/script/el/tokens/MapKeyToken.java#L105-L109
carewebframework/carewebframework-core
org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.helpconverter/src/main/java/org/carewebframework/maven/plugin/help/chm/BinaryTransform.java
BinaryTransform.getString
protected String getString(byte[] data, int offset, int length) { return new String(data, offset, length, CS_WIN1252); }
java
protected String getString(byte[] data, int offset, int length) { return new String(data, offset, length, CS_WIN1252); }
[ "protected", "String", "getString", "(", "byte", "[", "]", "data", ",", "int", "offset", ",", "int", "length", ")", "{", "return", "new", "String", "(", "data", ",", "offset", ",", "length", ",", "CS_WIN1252", ")", ";", "}" ]
Returns a string value from the byte array. @param data The source data. @param offset The byte offset. @param length The string length. @return A string
[ "Returns", "a", "string", "value", "from", "the", "byte", "array", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.helpconverter/src/main/java/org/carewebframework/maven/plugin/help/chm/BinaryTransform.java#L139-L141
alkacon/opencms-core
src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageHandler.java
CmsContainerpageHandler.checkNewWidgetsAvailable
public void checkNewWidgetsAvailable(CmsUUID structureId, AsyncCallback<Boolean> asyncCallback) { m_controller.checkNewWidgetsAvailable(structureId, asyncCallback); }
java
public void checkNewWidgetsAvailable(CmsUUID structureId, AsyncCallback<Boolean> asyncCallback) { m_controller.checkNewWidgetsAvailable(structureId, asyncCallback); }
[ "public", "void", "checkNewWidgetsAvailable", "(", "CmsUUID", "structureId", ",", "AsyncCallback", "<", "Boolean", ">", "asyncCallback", ")", "{", "m_controller", ".", "checkNewWidgetsAvailable", "(", "structureId", ",", "asyncCallback", ")", ";", "}" ]
Checks whether GWT widgets are available for all fields of a content.<p> @param structureId the structure id of the content @param asyncCallback the callback for the result
[ "Checks", "whether", "GWT", "widgets", "are", "available", "for", "all", "fields", "of", "a", "content", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageHandler.java#L274-L277
JOML-CI/JOML
src/org/joml/Intersectionf.java
Intersectionf.intersectRaySphere
public static boolean intersectRaySphere(Vector3fc origin, Vector3fc dir, Vector3fc center, float radiusSquared, Vector2f result) { return intersectRaySphere(origin.x(), origin.y(), origin.z(), dir.x(), dir.y(), dir.z(), center.x(), center.y(), center.z(), radiusSquared, result); }
java
public static boolean intersectRaySphere(Vector3fc origin, Vector3fc dir, Vector3fc center, float radiusSquared, Vector2f result) { return intersectRaySphere(origin.x(), origin.y(), origin.z(), dir.x(), dir.y(), dir.z(), center.x(), center.y(), center.z(), radiusSquared, result); }
[ "public", "static", "boolean", "intersectRaySphere", "(", "Vector3fc", "origin", ",", "Vector3fc", "dir", ",", "Vector3fc", "center", ",", "float", "radiusSquared", ",", "Vector2f", "result", ")", "{", "return", "intersectRaySphere", "(", "origin", ".", "x", "("...
Test whether the ray with the given <code>origin</code> and normalized direction <code>dir</code> intersects the sphere with the given <code>center</code> and square radius <code>radiusSquared</code>, and store the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> for both points (near and far) of intersections into the given <code>result</code> vector. <p> This method returns <code>true</code> for a ray whose origin lies inside the sphere. <p> Reference: <a href="http://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-sphere-intersection">http://www.scratchapixel.com/</a> @param origin the ray's origin @param dir the ray's normalized direction @param center the sphere's center @param radiusSquared the sphere radius squared @param result a vector that will contain the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> for both points (near, far) of intersections with the sphere @return <code>true</code> if the ray intersects the sphere; <code>false</code> otherwise
[ "Test", "whether", "the", "ray", "with", "the", "given", "<code", ">", "origin<", "/", "code", ">", "and", "normalized", "direction", "<code", ">", "dir<", "/", "code", ">", "intersects", "the", "sphere", "with", "the", "given", "<code", ">", "center<", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectionf.java#L2112-L2114
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDRNN.java
SDRNN.lstmCell
public SDVariable lstmCell(String baseName, LSTMCellConfiguration configuration) { return new LSTMCell(sd, configuration).outputVariables(baseName)[0]; }
java
public SDVariable lstmCell(String baseName, LSTMCellConfiguration configuration) { return new LSTMCell(sd, configuration).outputVariables(baseName)[0]; }
[ "public", "SDVariable", "lstmCell", "(", "String", "baseName", ",", "LSTMCellConfiguration", "configuration", ")", "{", "return", "new", "LSTMCell", "(", "sd", ",", "configuration", ")", ".", "outputVariables", "(", "baseName", ")", "[", "0", "]", ";", "}" ]
LSTM unit @param baseName the base name for outputs @param configuration the configuration to use @return
[ "LSTM", "unit" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDRNN.java#L56-L58
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/AdditionalNamespaceResolver.java
AdditionalNamespaceResolver.addNamespace
private void addNamespace(String prefix, String uri) { prefixToURI.put(prefix, uri); uriToPrefix.put(uri, prefix); }
java
private void addNamespace(String prefix, String uri) { prefixToURI.put(prefix, uri); uriToPrefix.put(uri, prefix); }
[ "private", "void", "addNamespace", "(", "String", "prefix", ",", "String", "uri", ")", "{", "prefixToURI", ".", "put", "(", "prefix", ",", "uri", ")", ";", "uriToPrefix", ".", "put", "(", "uri", ",", "prefix", ")", ";", "}" ]
Adds the given namespace declaration to this resolver. @param prefix namespace prefix @param uri namespace URI
[ "Adds", "the", "given", "namespace", "declaration", "to", "this", "resolver", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/AdditionalNamespaceResolver.java#L79-L82
UrielCh/ovh-java-sdk
ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java
ApiOvhXdsl.email_pro_email_PUT
public void email_pro_email_PUT(String email, OvhXdslEmailPro body) throws IOException { String qPath = "/xdsl/email/pro/{email}"; StringBuilder sb = path(qPath, email); exec(qPath, "PUT", sb.toString(), body); }
java
public void email_pro_email_PUT(String email, OvhXdslEmailPro body) throws IOException { String qPath = "/xdsl/email/pro/{email}"; StringBuilder sb = path(qPath, email); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "email_pro_email_PUT", "(", "String", "email", ",", "OvhXdslEmailPro", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/xdsl/email/pro/{email}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "email", ")", "...
Alter this object properties REST: PUT /xdsl/email/pro/{email} @param body [required] New object properties @param email [required] The email address if the XDSL Email Pro
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L1924-L1928
Sciss/abc4j
abc/src/main/java/abc/ui/swing/ScoreMetrics.java
ScoreMetrics.getBounds
protected Rectangle2D getBounds(char[] glyph, int notationContext) { String key = String.valueOf(notationContext) + "-" + String.valueOf(glyph) + "-" + getMusicalFont().getName(); try { if (bounds.get(key) == null) { FontRenderContext frc = g2.getFontRenderContext(); bounds.put(key, new TextLayout( String.valueOf(glyph),//new Character(glyph[0]).toString(), getNotationFontForContext(notationContext), frc).getBounds()); } return (Rectangle2D) (bounds.get(key)); } catch (RuntimeException e) { System.err.println(e.getMessage() + " key="+key); throw e; } }
java
protected Rectangle2D getBounds(char[] glyph, int notationContext) { String key = String.valueOf(notationContext) + "-" + String.valueOf(glyph) + "-" + getMusicalFont().getName(); try { if (bounds.get(key) == null) { FontRenderContext frc = g2.getFontRenderContext(); bounds.put(key, new TextLayout( String.valueOf(glyph),//new Character(glyph[0]).toString(), getNotationFontForContext(notationContext), frc).getBounds()); } return (Rectangle2D) (bounds.get(key)); } catch (RuntimeException e) { System.err.println(e.getMessage() + " key="+key); throw e; } }
[ "protected", "Rectangle2D", "getBounds", "(", "char", "[", "]", "glyph", ",", "int", "notationContext", ")", "{", "String", "key", "=", "String", ".", "valueOf", "(", "notationContext", ")", "+", "\"-\"", "+", "String", ".", "valueOf", "(", "glyph", ")", ...
Get the bounds of a glyph in the given notation context @param glyph {@link abc.notation.Accidental#SHARP}, {@link abc.notation.Accidental#FLAT}... @param notationContext {@link #NOTATION_CONTEXT_NOTE} or {@link #NOTATION_CONTEXT_GRACENOTE}
[ "Get", "the", "bounds", "of", "a", "glyph", "in", "the", "given", "notation", "context" ]
train
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/ScoreMetrics.java#L99-L116
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java
SARLOperationHelper._hasSideEffects
protected Boolean _hasSideEffects(XFeatureCall expression, ISideEffectContext context) { return internalHasOperationSideEffects(expression, context, false); }
java
protected Boolean _hasSideEffects(XFeatureCall expression, ISideEffectContext context) { return internalHasOperationSideEffects(expression, context, false); }
[ "protected", "Boolean", "_hasSideEffects", "(", "XFeatureCall", "expression", ",", "ISideEffectContext", "context", ")", "{", "return", "internalHasOperationSideEffects", "(", "expression", ",", "context", ",", "false", ")", ";", "}" ]
Test if the given expression has side effects. @param expression the expression. @param context the list of context expressions. @return {@code true} if the expression has side effects.
[ "Test", "if", "the", "given", "expression", "has", "side", "effects", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java#L548-L550
Sonoport/freesound-java
src/main/java/com/sonoport/freesound/FreesoundClient.java
FreesoundClient.buildHTTPRequest
private HttpRequest buildHTTPRequest(final Query<?, ?> query) { final String url = API_ENDPOINT + query.getPath(); HttpRequest request; switch (query.getHttpRequestMethod()) { case GET: request = Unirest.get(url); if ((query.getQueryParameters() != null) && !query.getQueryParameters().isEmpty()) { ((GetRequest) request).queryString(query.getQueryParameters()); } break; case POST: request = Unirest.post(url); if ((query.getQueryParameters() != null) && !query.getQueryParameters().isEmpty()) { ((HttpRequestWithBody) request).fields(query.getQueryParameters()); } break; default: request = Unirest.get(url); } /* * Add any named route parameters to the request (i.e. elements used to build the URI, such as * '/sound/{sound_id}' would have a parameter named 'sound_id'). */ if ((query.getRouteParameters() != null) && !query.getRouteParameters().isEmpty()) { for (final Entry<String, String> routeParameter : query.getRouteParameters().entrySet()) { request.routeParam(routeParameter.getKey(), routeParameter.getValue()); } } return request; }
java
private HttpRequest buildHTTPRequest(final Query<?, ?> query) { final String url = API_ENDPOINT + query.getPath(); HttpRequest request; switch (query.getHttpRequestMethod()) { case GET: request = Unirest.get(url); if ((query.getQueryParameters() != null) && !query.getQueryParameters().isEmpty()) { ((GetRequest) request).queryString(query.getQueryParameters()); } break; case POST: request = Unirest.post(url); if ((query.getQueryParameters() != null) && !query.getQueryParameters().isEmpty()) { ((HttpRequestWithBody) request).fields(query.getQueryParameters()); } break; default: request = Unirest.get(url); } /* * Add any named route parameters to the request (i.e. elements used to build the URI, such as * '/sound/{sound_id}' would have a parameter named 'sound_id'). */ if ((query.getRouteParameters() != null) && !query.getRouteParameters().isEmpty()) { for (final Entry<String, String> routeParameter : query.getRouteParameters().entrySet()) { request.routeParam(routeParameter.getKey(), routeParameter.getValue()); } } return request; }
[ "private", "HttpRequest", "buildHTTPRequest", "(", "final", "Query", "<", "?", ",", "?", ">", "query", ")", "{", "final", "String", "url", "=", "API_ENDPOINT", "+", "query", ".", "getPath", "(", ")", ";", "HttpRequest", "request", ";", "switch", "(", "qu...
Build the Unirest {@link HttpRequest} that will be used to make the call to the API. @param query The query to be made @return Properly configured {@link HttpRequest} representing query
[ "Build", "the", "Unirest", "{", "@link", "HttpRequest", "}", "that", "will", "be", "used", "to", "make", "the", "call", "to", "the", "API", "." ]
train
https://github.com/Sonoport/freesound-java/blob/ab029e25de068c6f8cc028bc7f916938fd97c036/src/main/java/com/sonoport/freesound/FreesoundClient.java#L142-L180
Metatavu/edelphi
edelphi/src/main/java/fi/metatavu/edelphi/query/thesis/AbstractScaleThesisQueryPageHandler.java
AbstractScaleThesisQueryPageHandler.synchronizeField
protected void synchronizeField(QueryPage queryPage, List<String> options, String fieldName, String fieldCaption, Boolean mandatory) { QueryFieldDAO queryFieldDAO = new QueryFieldDAO(); QueryOptionFieldDAO queryOptionFieldDAO = new QueryOptionFieldDAO(); QueryOptionField queryField = (QueryOptionField) queryFieldDAO.findByQueryPageAndName(queryPage, fieldName); if (queryField != null) { queryFieldDAO.updateMandatory(queryField, mandatory); queryFieldDAO.updateCaption(queryField, fieldCaption); } else { queryField = queryOptionFieldDAO.create(queryPage, fieldName, mandatory, fieldCaption); } synchronizeFieldOptions(options, queryField); }
java
protected void synchronizeField(QueryPage queryPage, List<String> options, String fieldName, String fieldCaption, Boolean mandatory) { QueryFieldDAO queryFieldDAO = new QueryFieldDAO(); QueryOptionFieldDAO queryOptionFieldDAO = new QueryOptionFieldDAO(); QueryOptionField queryField = (QueryOptionField) queryFieldDAO.findByQueryPageAndName(queryPage, fieldName); if (queryField != null) { queryFieldDAO.updateMandatory(queryField, mandatory); queryFieldDAO.updateCaption(queryField, fieldCaption); } else { queryField = queryOptionFieldDAO.create(queryPage, fieldName, mandatory, fieldCaption); } synchronizeFieldOptions(options, queryField); }
[ "protected", "void", "synchronizeField", "(", "QueryPage", "queryPage", ",", "List", "<", "String", ">", "options", ",", "String", "fieldName", ",", "String", "fieldCaption", ",", "Boolean", "mandatory", ")", "{", "QueryFieldDAO", "queryFieldDAO", "=", "new", "Q...
Synchronizes field meta. Should not be used when field already contains replies @param queryPage query page @param options field options @param fieldName field name @param fieldCaption field caption @param mandatory whether field is mandatory
[ "Synchronizes", "field", "meta", ".", "Should", "not", "be", "used", "when", "field", "already", "contains", "replies" ]
train
https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/query/thesis/AbstractScaleThesisQueryPageHandler.java#L145-L158
auth0/java-jwt
lib/src/main/java/com/auth0/jwt/algorithms/Algorithm.java
Algorithm.RSA512
@Deprecated public static Algorithm RSA512(RSAKey key) throws IllegalArgumentException { RSAPublicKey publicKey = key instanceof RSAPublicKey ? (RSAPublicKey) key : null; RSAPrivateKey privateKey = key instanceof RSAPrivateKey ? (RSAPrivateKey) key : null; return RSA512(publicKey, privateKey); }
java
@Deprecated public static Algorithm RSA512(RSAKey key) throws IllegalArgumentException { RSAPublicKey publicKey = key instanceof RSAPublicKey ? (RSAPublicKey) key : null; RSAPrivateKey privateKey = key instanceof RSAPrivateKey ? (RSAPrivateKey) key : null; return RSA512(publicKey, privateKey); }
[ "@", "Deprecated", "public", "static", "Algorithm", "RSA512", "(", "RSAKey", "key", ")", "throws", "IllegalArgumentException", "{", "RSAPublicKey", "publicKey", "=", "key", "instanceof", "RSAPublicKey", "?", "(", "RSAPublicKey", ")", "key", ":", "null", ";", "RS...
Creates a new Algorithm instance using SHA512withRSA. Tokens specify this as "RS512". @param key the key to use in the verify or signing instance. @return a valid RSA512 Algorithm. @throws IllegalArgumentException if the provided Key is null. @deprecated use {@link #RSA512(RSAPublicKey, RSAPrivateKey)} or {@link #RSA512(RSAKeyProvider)}
[ "Creates", "a", "new", "Algorithm", "instance", "using", "SHA512withRSA", ".", "Tokens", "specify", "this", "as", "RS512", "." ]
train
https://github.com/auth0/java-jwt/blob/890538970a9699b7251a4bfe4f26e8d7605ad530/lib/src/main/java/com/auth0/jwt/algorithms/Algorithm.java#L128-L133
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/ComparatorCompat.java
ComparatorCompat.thenComparing
@NotNull public static <T> Comparator<T> thenComparing( @NotNull final Comparator<? super T> c1, @NotNull final Comparator<? super T> c2) { Objects.requireNonNull(c1); Objects.requireNonNull(c2); return new Comparator<T>() { @Override public int compare(T t1, T t2) { final int result = c1.compare(t1, t2); return (result != 0) ? result : c2.compare(t1, t2); } }; }
java
@NotNull public static <T> Comparator<T> thenComparing( @NotNull final Comparator<? super T> c1, @NotNull final Comparator<? super T> c2) { Objects.requireNonNull(c1); Objects.requireNonNull(c2); return new Comparator<T>() { @Override public int compare(T t1, T t2) { final int result = c1.compare(t1, t2); return (result != 0) ? result : c2.compare(t1, t2); } }; }
[ "@", "NotNull", "public", "static", "<", "T", ">", "Comparator", "<", "T", ">", "thenComparing", "(", "@", "NotNull", "final", "Comparator", "<", "?", "super", "T", ">", "c1", ",", "@", "NotNull", "final", "Comparator", "<", "?", "super", "T", ">", "...
Returns a comparator that uses {@code c2} comparator if {@code c1} comparator considers two elements equal. @param <T> the type of the objects compared by the comparators @param c1 a first comparator @param c2 a second comparator @return a comparator @throws NullPointerException if {@code c1} or {@code c2} is null
[ "Returns", "a", "comparator", "that", "uses", "{", "@code", "c2", "}", "comparator", "if", "{", "@code", "c1", "}", "comparator", "considers", "two", "elements", "equal", "." ]
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/ComparatorCompat.java#L84-L98
sundrio/sundrio
maven-plugin/src/main/java/io/sundr/maven/GenerateBomMojo.java
GenerateBomMojo.toGenerate
private static MavenProject toGenerate(MavenProject project, BomConfig config, Collection<Dependency> dependencies, Set<Artifact> plugins) { MavenProject toGenerate = project.clone(); toGenerate.setGroupId(project.getGroupId()); toGenerate.setArtifactId(config.getArtifactId()); toGenerate.setVersion(project.getVersion()); toGenerate.setPackaging("pom"); toGenerate.setName(config.getName()); toGenerate.setDescription(config.getDescription()); toGenerate.setUrl(project.getUrl()); toGenerate.setLicenses(project.getLicenses()); toGenerate.setScm(project.getScm()); toGenerate.setDevelopers(project.getDevelopers()); toGenerate.getModel().setDependencyManagement(new DependencyManagement()); for (Dependency dependency : dependencies) { toGenerate.getDependencyManagement().addDependency(dependency); } for (Dependency dependency : config.getExtraDependencies()) { toGenerate.getDependencyManagement().addDependency(dependency); } toGenerate.getModel().setBuild(new Build()); if (!plugins.isEmpty()) { toGenerate.getModel().setBuild(new Build()); toGenerate.getModel().getBuild().setPluginManagement(new PluginManagement()); for (Artifact artifact : plugins) { toGenerate.getPluginManagement().addPlugin(toPlugin(artifact)); } } return toGenerate; }
java
private static MavenProject toGenerate(MavenProject project, BomConfig config, Collection<Dependency> dependencies, Set<Artifact> plugins) { MavenProject toGenerate = project.clone(); toGenerate.setGroupId(project.getGroupId()); toGenerate.setArtifactId(config.getArtifactId()); toGenerate.setVersion(project.getVersion()); toGenerate.setPackaging("pom"); toGenerate.setName(config.getName()); toGenerate.setDescription(config.getDescription()); toGenerate.setUrl(project.getUrl()); toGenerate.setLicenses(project.getLicenses()); toGenerate.setScm(project.getScm()); toGenerate.setDevelopers(project.getDevelopers()); toGenerate.getModel().setDependencyManagement(new DependencyManagement()); for (Dependency dependency : dependencies) { toGenerate.getDependencyManagement().addDependency(dependency); } for (Dependency dependency : config.getExtraDependencies()) { toGenerate.getDependencyManagement().addDependency(dependency); } toGenerate.getModel().setBuild(new Build()); if (!plugins.isEmpty()) { toGenerate.getModel().setBuild(new Build()); toGenerate.getModel().getBuild().setPluginManagement(new PluginManagement()); for (Artifact artifact : plugins) { toGenerate.getPluginManagement().addPlugin(toPlugin(artifact)); } } return toGenerate; }
[ "private", "static", "MavenProject", "toGenerate", "(", "MavenProject", "project", ",", "BomConfig", "config", ",", "Collection", "<", "Dependency", ">", "dependencies", ",", "Set", "<", "Artifact", ">", "plugins", ")", "{", "MavenProject", "toGenerate", "=", "p...
Returns the model of the {@link org.apache.maven.project.MavenProject} to generate. This is a trimmed down version and contains just the stuff that need to go into the bom. @param project The source {@link org.apache.maven.project.MavenProject}. @param config The {@link io.sundr.maven.BomConfig}. @return The build {@link org.apache.maven.project.MavenProject}.
[ "Returns", "the", "model", "of", "the", "{", "@link", "org", ".", "apache", ".", "maven", ".", "project", ".", "MavenProject", "}", "to", "generate", ".", "This", "is", "a", "trimmed", "down", "version", "and", "contains", "just", "the", "stuff", "that",...
train
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/maven-plugin/src/main/java/io/sundr/maven/GenerateBomMojo.java#L301-L333
apache/incubator-heron
heron/spi/src/java/org/apache/heron/spi/statemgr/SchedulerStateManagerAdaptor.java
SchedulerStateManagerAdaptor.setExecutionState
public Boolean setExecutionState( ExecutionEnvironment.ExecutionState executionState, String topologyName) { return awaitResult(delegate.setExecutionState(executionState, topologyName)); }
java
public Boolean setExecutionState( ExecutionEnvironment.ExecutionState executionState, String topologyName) { return awaitResult(delegate.setExecutionState(executionState, topologyName)); }
[ "public", "Boolean", "setExecutionState", "(", "ExecutionEnvironment", ".", "ExecutionState", "executionState", ",", "String", "topologyName", ")", "{", "return", "awaitResult", "(", "delegate", ".", "setExecutionState", "(", "executionState", ",", "topologyName", ")", ...
Set the execution state for the given topology @return Boolean - Success or Failure
[ "Set", "the", "execution", "state", "for", "the", "given", "topology" ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/spi/src/java/org/apache/heron/spi/statemgr/SchedulerStateManagerAdaptor.java#L107-L110
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPersistenceImpl.java
CommerceOrderPersistenceImpl.findByUserId
@Override public List<CommerceOrder> findByUserId(long userId, int start, int end, OrderByComparator<CommerceOrder> orderByComparator) { return findByUserId(userId, start, end, orderByComparator, true); }
java
@Override public List<CommerceOrder> findByUserId(long userId, int start, int end, OrderByComparator<CommerceOrder> orderByComparator) { return findByUserId(userId, start, end, orderByComparator, true); }
[ "@", "Override", "public", "List", "<", "CommerceOrder", ">", "findByUserId", "(", "long", "userId", ",", "int", "start", ",", "int", "end", ",", "OrderByComparator", "<", "CommerceOrder", ">", "orderByComparator", ")", "{", "return", "findByUserId", "(", "use...
Returns an ordered range of all the commerce orders where userId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceOrderModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param userId the user ID @param start the lower bound of the range of commerce orders @param end the upper bound of the range of commerce orders (not inclusive) @param orderByComparator the comparator to order the results by (optionally <code>null</code>) @return the ordered range of matching commerce orders
[ "Returns", "an", "ordered", "range", "of", "all", "the", "commerce", "orders", "where", "userId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPersistenceImpl.java#L2050-L2054
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/plugins/configuration/PluginAdapterUtility.java
PluginAdapterUtility.buildDescription
public static Description buildDescription(final Object object, final DescriptionBuilder builder) { return buildDescription(object, builder, true); }
java
public static Description buildDescription(final Object object, final DescriptionBuilder builder) { return buildDescription(object, builder, true); }
[ "public", "static", "Description", "buildDescription", "(", "final", "Object", "object", ",", "final", "DescriptionBuilder", "builder", ")", "{", "return", "buildDescription", "(", "object", ",", "builder", ",", "true", ")", ";", "}" ]
@return Create a Description using a builder by analyzing the annotations on a plugin object, and including annotations on fields as DescriptionProperties. @param object the object @param builder builder
[ "@return", "Create", "a", "Description", "using", "a", "builder", "by", "analyzing", "the", "annotations", "on", "a", "plugin", "object", "and", "including", "annotations", "on", "fields", "as", "DescriptionProperties", "." ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/plugins/configuration/PluginAdapterUtility.java#L62-L64
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/ParallelRunner.java
ParallelRunner.renamePath
public void renamePath(final Path src, final Path dst, final Optional<String> group) { this.futures.add(new NamedFuture(this.executor.submit(new Callable<Void>() { @Override public Void call() throws Exception { Lock lock = ParallelRunner.this.locks.get(src.toString()); lock.lock(); try { if (ParallelRunner.this.fs.exists(src)) { HadoopUtils.renamePath(ParallelRunner.this.fs, src, dst); if (group.isPresent()) { HadoopUtils.setGroup(ParallelRunner.this.fs, dst, group.get()); } } return null; } catch (FileAlreadyExistsException e) { LOGGER.warn(String.format("Failed to rename %s to %s: dst already exists", src, dst), e); return null; } finally { lock.unlock(); } } }), "Rename " + src + " to " + dst)); }
java
public void renamePath(final Path src, final Path dst, final Optional<String> group) { this.futures.add(new NamedFuture(this.executor.submit(new Callable<Void>() { @Override public Void call() throws Exception { Lock lock = ParallelRunner.this.locks.get(src.toString()); lock.lock(); try { if (ParallelRunner.this.fs.exists(src)) { HadoopUtils.renamePath(ParallelRunner.this.fs, src, dst); if (group.isPresent()) { HadoopUtils.setGroup(ParallelRunner.this.fs, dst, group.get()); } } return null; } catch (FileAlreadyExistsException e) { LOGGER.warn(String.format("Failed to rename %s to %s: dst already exists", src, dst), e); return null; } finally { lock.unlock(); } } }), "Rename " + src + " to " + dst)); }
[ "public", "void", "renamePath", "(", "final", "Path", "src", ",", "final", "Path", "dst", ",", "final", "Optional", "<", "String", ">", "group", ")", "{", "this", ".", "futures", ".", "add", "(", "new", "NamedFuture", "(", "this", ".", "executor", ".",...
Rename a {@link Path}. <p> This method submits a task to rename a {@link Path} and returns immediately after the task is submitted. </p> @param src path to be renamed @param dst new path after rename @param group an optional group name for the destination path
[ "Rename", "a", "{", "@link", "Path", "}", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ParallelRunner.java#L259-L281
aws/aws-sdk-java
aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/TagResourceRequest.java
TagResourceRequest.withTagsToAdd
public TagResourceRequest withTagsToAdd(java.util.Map<String, String> tagsToAdd) { setTagsToAdd(tagsToAdd); return this; }
java
public TagResourceRequest withTagsToAdd(java.util.Map<String, String> tagsToAdd) { setTagsToAdd(tagsToAdd); return this; }
[ "public", "TagResourceRequest", "withTagsToAdd", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tagsToAdd", ")", "{", "setTagsToAdd", "(", "tagsToAdd", ")", ";", "return", "this", ";", "}" ]
<p> Tags to add to this resource. </p> @param tagsToAdd Tags to add to this resource. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Tags", "to", "add", "to", "this", "resource", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/TagResourceRequest.java#L137-L140
SonarSource/sonarqube
server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDao.java
IssueDao.selectByKeys
public List<IssueDto> selectByKeys(DbSession session, Collection<String> keys) { return executeLargeInputs(keys, mapper(session)::selectByKeys); }
java
public List<IssueDto> selectByKeys(DbSession session, Collection<String> keys) { return executeLargeInputs(keys, mapper(session)::selectByKeys); }
[ "public", "List", "<", "IssueDto", ">", "selectByKeys", "(", "DbSession", "session", ",", "Collection", "<", "String", ">", "keys", ")", "{", "return", "executeLargeInputs", "(", "keys", ",", "mapper", "(", "session", ")", "::", "selectByKeys", ")", ";", "...
Gets a list issues by their keys. The result does NOT contain {@code null} values for issues not found, so the size of result may be less than the number of keys. A single issue is returned if input keys contain multiple occurrences of a key. <p>Results may be in a different order as input keys.</p>
[ "Gets", "a", "list", "issues", "by", "their", "keys", ".", "The", "result", "does", "NOT", "contain", "{" ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDao.java#L56-L58
Netflix/netflix-commons
netflix-eventbus/src/main/java/com/netflix/eventbus/utils/EventBusUtils.java
EventBusUtils.getSubscriberConfig
public static SubscriberConfigProvider.SubscriberConfig getSubscriberConfig(Method subMethod, Object subscriber) { Preconditions.checkNotNull(subscriber); Preconditions.checkNotNull(subMethod); Subscribe annotation = subMethod.getAnnotation(Subscribe.class); if (null == annotation) { throw new IllegalArgumentException(String.format("Subscriber method %s does not contain a subscriber annotation.", subMethod.toGenericString())); } SubscriberConfigProvider.SubscriberConfig config = null; if (SubscriberConfigProvider.class.isAssignableFrom(subscriber.getClass())) { config = ((SubscriberConfigProvider) subscriber).getConfigForName(annotation.name()); } if (null == config) { config = new AnnotationBasedSubscriberConfig(annotation); } return config; }
java
public static SubscriberConfigProvider.SubscriberConfig getSubscriberConfig(Method subMethod, Object subscriber) { Preconditions.checkNotNull(subscriber); Preconditions.checkNotNull(subMethod); Subscribe annotation = subMethod.getAnnotation(Subscribe.class); if (null == annotation) { throw new IllegalArgumentException(String.format("Subscriber method %s does not contain a subscriber annotation.", subMethod.toGenericString())); } SubscriberConfigProvider.SubscriberConfig config = null; if (SubscriberConfigProvider.class.isAssignableFrom(subscriber.getClass())) { config = ((SubscriberConfigProvider) subscriber).getConfigForName(annotation.name()); } if (null == config) { config = new AnnotationBasedSubscriberConfig(annotation); } return config; }
[ "public", "static", "SubscriberConfigProvider", ".", "SubscriberConfig", "getSubscriberConfig", "(", "Method", "subMethod", ",", "Object", "subscriber", ")", "{", "Preconditions", ".", "checkNotNull", "(", "subscriber", ")", ";", "Preconditions", ".", "checkNotNull", ...
Returns configuration for the passed subscriber method. This configuration can be obtained from the {@link Subscribe} annotation on the method or from {@link SubscriberConfigProvider} if the subscriber implements that interface. @param subscriber The instance of the subscriber that contains the subscriber method. @param subMethod Method for which the configuration has to be found. @return Subscriber configuration.
[ "Returns", "configuration", "for", "the", "passed", "subscriber", "method", ".", "This", "configuration", "can", "be", "obtained", "from", "the", "{", "@link", "Subscribe", "}", "annotation", "on", "the", "method", "or", "from", "{", "@link", "SubscriberConfigPr...
train
https://github.com/Netflix/netflix-commons/blob/7a158af76906d4a9b753e9344ce3e7abeb91dc01/netflix-eventbus/src/main/java/com/netflix/eventbus/utils/EventBusUtils.java#L62-L80
michel-kraemer/bson4jackson
src/main/java/de/undercouch/bson4jackson/io/DynamicOutputBuffer.java
DynamicOutputBuffer.putInt
public void putInt(int pos, int i) { adaptSize(pos + 4); ByteBuffer bb = getBuffer(pos); int index = pos % _bufferSize; if (bb.limit() - index >= 4) { bb.putInt(index, i); } else { byte b0 = (byte)i; byte b1 = (byte)(i >> 8); byte b2 = (byte)(i >> 16); byte b3 = (byte)(i >> 24); if (_order == ByteOrder.BIG_ENDIAN) { putBytes(pos, b3, b2, b1, b0); } else { putBytes(pos, b0, b1, b2, b3); } } }
java
public void putInt(int pos, int i) { adaptSize(pos + 4); ByteBuffer bb = getBuffer(pos); int index = pos % _bufferSize; if (bb.limit() - index >= 4) { bb.putInt(index, i); } else { byte b0 = (byte)i; byte b1 = (byte)(i >> 8); byte b2 = (byte)(i >> 16); byte b3 = (byte)(i >> 24); if (_order == ByteOrder.BIG_ENDIAN) { putBytes(pos, b3, b2, b1, b0); } else { putBytes(pos, b0, b1, b2, b3); } } }
[ "public", "void", "putInt", "(", "int", "pos", ",", "int", "i", ")", "{", "adaptSize", "(", "pos", "+", "4", ")", ";", "ByteBuffer", "bb", "=", "getBuffer", "(", "pos", ")", ";", "int", "index", "=", "pos", "%", "_bufferSize", ";", "if", "(", "bb...
Puts a 32-bit integer into the buffer at the given position. Does not increase the write position. @param pos the position where to put the integer @param i the integer to put
[ "Puts", "a", "32", "-", "bit", "integer", "into", "the", "buffer", "at", "the", "given", "position", ".", "Does", "not", "increase", "the", "write", "position", "." ]
train
https://github.com/michel-kraemer/bson4jackson/blob/32d2ab3c516b3c07490fdfcf0c5e4ed0a2ee3979/src/main/java/de/undercouch/bson4jackson/io/DynamicOutputBuffer.java#L393-L411