repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/transform/transformprofile_binding.java
transformprofile_binding.get
public static transformprofile_binding get(nitro_service service, String name) throws Exception{ transformprofile_binding obj = new transformprofile_binding(); obj.set_name(name); transformprofile_binding response = (transformprofile_binding) obj.get_resource(service); return response; }
java
public static transformprofile_binding get(nitro_service service, String name) throws Exception{ transformprofile_binding obj = new transformprofile_binding(); obj.set_name(name); transformprofile_binding response = (transformprofile_binding) obj.get_resource(service); return response; }
[ "public", "static", "transformprofile_binding", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "transformprofile_binding", "obj", "=", "new", "transformprofile_binding", "(", ")", ";", "obj", ".", "set_name", "(", "...
Use this API to fetch transformprofile_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "transformprofile_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/transform/transformprofile_binding.java#L103-L108
ManfredTremmel/gwt-bean-validators
mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/util/BeanPropertyReaderUtil.java
BeanPropertyReaderUtil.getNullSaveStringProperty
public static String getNullSaveStringProperty(final Object pbean, final String pname) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { String property; try { property = BeanUtils.getProperty(pbean, pname); } catch (final NestedNullException pexception) { property = null; } return property; }
java
public static String getNullSaveStringProperty(final Object pbean, final String pname) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { String property; try { property = BeanUtils.getProperty(pbean, pname); } catch (final NestedNullException pexception) { property = null; } return property; }
[ "public", "static", "String", "getNullSaveStringProperty", "(", "final", "Object", "pbean", ",", "final", "String", "pname", ")", "throws", "IllegalAccessException", ",", "InvocationTargetException", ",", "NoSuchMethodException", "{", "String", "property", ";", "try", ...
<p> Return the value of the specified property of the specified bean, no matter which property reference format is used, as a String. </p> <p> If there is a null value in path hierarchy, exception is cached and null returned. </p> @param pbean Bean whose property is to be extracted @param pname Possibly indexed and/or nested name of the property to be extracted @return The property's value, converted to a String @exception IllegalAccessException if the caller does not have access to the property accessor method @exception InvocationTargetException if the property accessor method throws an exception @exception NoSuchMethodException if an accessor method for this property cannot be found @see BeanUtilsBean#getProperty
[ "<p", ">", "Return", "the", "value", "of", "the", "specified", "property", "of", "the", "specified", "bean", "no", "matter", "which", "property", "reference", "format", "is", "used", "as", "a", "String", ".", "<", "/", "p", ">", "<p", ">", "If", "there...
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/util/BeanPropertyReaderUtil.java#L59-L68
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java
ApplicationGatewaysInner.beginStart
public void beginStart(String resourceGroupName, String applicationGatewayName) { beginStartWithServiceResponseAsync(resourceGroupName, applicationGatewayName).toBlocking().single().body(); }
java
public void beginStart(String resourceGroupName, String applicationGatewayName) { beginStartWithServiceResponseAsync(resourceGroupName, applicationGatewayName).toBlocking().single().body(); }
[ "public", "void", "beginStart", "(", "String", "resourceGroupName", ",", "String", "applicationGatewayName", ")", "{", "beginStartWithServiceResponseAsync", "(", "resourceGroupName", ",", "applicationGatewayName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ...
Starts the specified application gateway. @param resourceGroupName The name of the resource group. @param applicationGatewayName The name of the application gateway. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Starts", "the", "specified", "application", "gateway", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java#L1170-L1172
spotify/sparkey-java
src/main/java/com/spotify/sparkey/Sparkey.java
Sparkey.createNew
public static SparkeyWriter createNew(File file, CompressionType compressionType, int compressionBlockSize) throws IOException { return SingleThreadedSparkeyWriter.createNew(file, compressionType, compressionBlockSize); }
java
public static SparkeyWriter createNew(File file, CompressionType compressionType, int compressionBlockSize) throws IOException { return SingleThreadedSparkeyWriter.createNew(file, compressionType, compressionBlockSize); }
[ "public", "static", "SparkeyWriter", "createNew", "(", "File", "file", ",", "CompressionType", "compressionType", ",", "int", "compressionBlockSize", ")", "throws", "IOException", "{", "return", "SingleThreadedSparkeyWriter", ".", "createNew", "(", "file", ",", "compr...
Creates a new sparkey writer with the specified compression This is not a thread-safe class, only use it from one thread. @param file File base to use, the actual file endings will be set to .spi and .spl @param compressionType @param compressionBlockSize The maximum compression block size in bytes @return a new writer,
[ "Creates", "a", "new", "sparkey", "writer", "with", "the", "specified", "compression" ]
train
https://github.com/spotify/sparkey-java/blob/77ed13b17b4b28f38d6e335610269fb135c3a1be/src/main/java/com/spotify/sparkey/Sparkey.java#L55-L57
haifengl/smile
core/src/main/java/smile/neighbor/MPLSH.java
MPLSH.learn
public void learn(RNNSearch<double[], double[]> range, double[][] samples, double radius, int Nz, double sigma) { TrainSample[] training = new TrainSample[samples.length]; for (int i = 0; i < samples.length; i++) { training[i] = new TrainSample(); training[i].query = samples[i]; training[i].neighbors = new ArrayList<>(); ArrayList<Neighbor<double[], double[]>> neighbors = new ArrayList<>(); range.range(training[i].query, radius, neighbors); for (Neighbor<double[], double[]> n : neighbors) { training[i].neighbors.add(keys.get(n.index)); } } model = new ArrayList<>(hash.size()); for (int i = 0; i < hash.size(); i++) { model.add(new PosterioriModel(hash.get(i), training, Nz, sigma)); } }
java
public void learn(RNNSearch<double[], double[]> range, double[][] samples, double radius, int Nz, double sigma) { TrainSample[] training = new TrainSample[samples.length]; for (int i = 0; i < samples.length; i++) { training[i] = new TrainSample(); training[i].query = samples[i]; training[i].neighbors = new ArrayList<>(); ArrayList<Neighbor<double[], double[]>> neighbors = new ArrayList<>(); range.range(training[i].query, radius, neighbors); for (Neighbor<double[], double[]> n : neighbors) { training[i].neighbors.add(keys.get(n.index)); } } model = new ArrayList<>(hash.size()); for (int i = 0; i < hash.size(); i++) { model.add(new PosterioriModel(hash.get(i), training, Nz, sigma)); } }
[ "public", "void", "learn", "(", "RNNSearch", "<", "double", "[", "]", ",", "double", "[", "]", ">", "range", ",", "double", "[", "]", "[", "]", "samples", ",", "double", "radius", ",", "int", "Nz", ",", "double", "sigma", ")", "{", "TrainSample", "...
Train the posteriori multiple probe algorithm. @param range the neighborhood search data structure. @param radius the radius for range search. @param Nz the number of quantized values. @param sigma the Parzen window width.
[ "Train", "the", "posteriori", "multiple", "probe", "algorithm", "." ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/neighbor/MPLSH.java#L869-L886
perwendel/spark
src/main/java/spark/Routable.java
Routable.afterAfter
public void afterAfter(String path, Filter filter) { addFilter(HttpMethod.afterafter, FilterImpl.create(path, filter)); }
java
public void afterAfter(String path, Filter filter) { addFilter(HttpMethod.afterafter, FilterImpl.create(path, filter)); }
[ "public", "void", "afterAfter", "(", "String", "path", ",", "Filter", "filter", ")", "{", "addFilter", "(", "HttpMethod", ".", "afterafter", ",", "FilterImpl", ".", "create", "(", "path", ",", "filter", ")", ")", ";", "}" ]
Maps a filter to be executed after any matching routes even if the route throws any exception @param filter The filter
[ "Maps", "a", "filter", "to", "be", "executed", "after", "any", "matching", "routes", "even", "if", "the", "route", "throws", "any", "exception" ]
train
https://github.com/perwendel/spark/blob/080fb1f9d6e580f6742e9589044c7420d3157b8b/src/main/java/spark/Routable.java#L322-L324
skuzzle/TinyPlugz
tiny-plugz/src/main/java/de/skuzzle/tinyplugz/util/ReflectionUtil.java
ReflectionUtil.createInstance
public static <T> T createInstance(Object source, Class<T> base, ClassLoader classLoader) { Require.nonNull(source, "source"); Require.nonNull(base, "base"); Require.nonNull(classLoader, "classLoader"); if (source instanceof Class<?>) { return fromClass(base, (Class<?>) source); } else if (source instanceof String) { try { final Class<?> concrete = classLoader.loadClass(source.toString()); return fromClass(base, concrete); } catch (ClassNotFoundException e) { throw new TinyPlugzException(e); } } else if (base.isInstance(source)) { return base.cast(source); } else { throw new TinyPlugzException(String.format("'%s' is not valid for '%s'", source, base.getName())); } }
java
public static <T> T createInstance(Object source, Class<T> base, ClassLoader classLoader) { Require.nonNull(source, "source"); Require.nonNull(base, "base"); Require.nonNull(classLoader, "classLoader"); if (source instanceof Class<?>) { return fromClass(base, (Class<?>) source); } else if (source instanceof String) { try { final Class<?> concrete = classLoader.loadClass(source.toString()); return fromClass(base, concrete); } catch (ClassNotFoundException e) { throw new TinyPlugzException(e); } } else if (base.isInstance(source)) { return base.cast(source); } else { throw new TinyPlugzException(String.format("'%s' is not valid for '%s'", source, base.getName())); } }
[ "public", "static", "<", "T", ">", "T", "createInstance", "(", "Object", "source", ",", "Class", "<", "T", ">", "base", ",", "ClassLoader", "classLoader", ")", "{", "Require", ".", "nonNull", "(", "source", ",", "\"source\"", ")", ";", "Require", ".", ...
Creates or returns an instance of an arbitrary type which is a sub type of given {@code base} class. If the source object already is an instance of {@code base}, then it is returned. If the source object is a {@link Class} object, its no-argument default constructor will be called and the resulting object returned. If the source is a String it is taken to be the full qualified name of a class which is then loaded using the given ClassLoader prior to calling its default constructor. @param source Either a String, a Class or a ready to use object. @param base A super type of the object to create. @param classLoader The ClassLoader that should be used to load the class in case the {@code source} parameter is a String. @return The obtained object. @throws TinyPlugzException If anything goes wrong in the process described above.
[ "Creates", "or", "returns", "an", "instance", "of", "an", "arbitrary", "type", "which", "is", "a", "sub", "type", "of", "given", "{", "@code", "base", "}", "class", ".", "If", "the", "source", "object", "already", "is", "an", "instance", "of", "{", "@c...
train
https://github.com/skuzzle/TinyPlugz/blob/739858ed0ba5a0c75b6ccf18df9a4d5612374a4b/tiny-plugz/src/main/java/de/skuzzle/tinyplugz/util/ReflectionUtil.java#L36-L57
spring-projects/spring-social
spring-social-web/src/main/java/org/springframework/social/connect/web/ProviderSignInController.java
ProviderSignInController.oauth1Callback
@RequestMapping(value="/{providerId}", method=RequestMethod.GET, params="oauth_token") public RedirectView oauth1Callback(@PathVariable String providerId, NativeWebRequest request) { try { OAuth1ConnectionFactory<?> connectionFactory = (OAuth1ConnectionFactory<?>) connectionFactoryLocator.getConnectionFactory(providerId); Connection<?> connection = connectSupport.completeConnection(connectionFactory, request); return handleSignIn(connection, connectionFactory, request); } catch (Exception e) { logger.error("Exception while completing OAuth 1.0(a) connection: ", e); return redirect(URIBuilder.fromUri(signInUrl).queryParam("error", "provider").build().toString()); } }
java
@RequestMapping(value="/{providerId}", method=RequestMethod.GET, params="oauth_token") public RedirectView oauth1Callback(@PathVariable String providerId, NativeWebRequest request) { try { OAuth1ConnectionFactory<?> connectionFactory = (OAuth1ConnectionFactory<?>) connectionFactoryLocator.getConnectionFactory(providerId); Connection<?> connection = connectSupport.completeConnection(connectionFactory, request); return handleSignIn(connection, connectionFactory, request); } catch (Exception e) { logger.error("Exception while completing OAuth 1.0(a) connection: ", e); return redirect(URIBuilder.fromUri(signInUrl).queryParam("error", "provider").build().toString()); } }
[ "@", "RequestMapping", "(", "value", "=", "\"/{providerId}\"", ",", "method", "=", "RequestMethod", ".", "GET", ",", "params", "=", "\"oauth_token\"", ")", "public", "RedirectView", "oauth1Callback", "(", "@", "PathVariable", "String", "providerId", ",", "NativeWe...
Process the authentication callback from an OAuth 1 service provider. Called after the member authorizes the authentication, generally done once by having he or she click "Allow" in their web browser at the provider's site. Handles the provider sign-in callback by first determining if a local user account is associated with the connected provider account. If so, signs the local user in by delegating to {@link SignInAdapter#signIn(String, Connection, NativeWebRequest)} If not, redirects the user to a signup page to create a new account with {@link ProviderSignInAttempt} context exposed in the HttpSession. @param providerId the provider ID to authorize against @param request the request @return a RedirectView to the provider's authorization page or to the application's signin page if there is an error @see ProviderSignInAttempt @see ProviderSignInUtils
[ "Process", "the", "authentication", "callback", "from", "an", "OAuth", "1", "service", "provider", ".", "Called", "after", "the", "member", "authorizes", "the", "authentication", "generally", "done", "once", "by", "having", "he", "or", "she", "click", "Allow", ...
train
https://github.com/spring-projects/spring-social/blob/e41cfecb288022b83c79413b58f52511c3c9d4fc/spring-social-web/src/main/java/org/springframework/social/connect/web/ProviderSignInController.java#L199-L209
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.listCapacitiesAsync
public Observable<Page<StampCapacityInner>> listCapacitiesAsync(final String resourceGroupName, final String name) { return listCapacitiesWithServiceResponseAsync(resourceGroupName, name) .map(new Func1<ServiceResponse<Page<StampCapacityInner>>, Page<StampCapacityInner>>() { @Override public Page<StampCapacityInner> call(ServiceResponse<Page<StampCapacityInner>> response) { return response.body(); } }); }
java
public Observable<Page<StampCapacityInner>> listCapacitiesAsync(final String resourceGroupName, final String name) { return listCapacitiesWithServiceResponseAsync(resourceGroupName, name) .map(new Func1<ServiceResponse<Page<StampCapacityInner>>, Page<StampCapacityInner>>() { @Override public Page<StampCapacityInner> call(ServiceResponse<Page<StampCapacityInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "StampCapacityInner", ">", ">", "listCapacitiesAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "name", ")", "{", "return", "listCapacitiesWithServiceResponseAsync", "(", "resourceGroupName", ",", "...
Get the used, available, and total worker capacity an App Service Environment. Get the used, available, and total worker capacity an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;StampCapacityInner&gt; object
[ "Get", "the", "used", "available", "and", "total", "worker", "capacity", "an", "App", "Service", "Environment", ".", "Get", "the", "used", "available", "and", "total", "worker", "capacity", "an", "App", "Service", "Environment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L1339-L1347
awslabs/amazon-sqs-java-extended-client-lib
src/main/java/com/amazon/sqs/javamessaging/ExtendedClientConfiguration.java
ExtendedClientConfiguration.setLargePayloadSupportEnabled
public void setLargePayloadSupportEnabled(AmazonS3 s3, String s3BucketName) { if (s3 == null || s3BucketName == null) { String errorMessage = "S3 client and/or S3 bucket name cannot be null."; LOG.error(errorMessage); throw new AmazonClientException(errorMessage); } if (isLargePayloadSupportEnabled()) { LOG.warn("Large-payload support is already enabled. Overwriting AmazonS3Client and S3BucketName."); } this.s3 = s3; this.s3BucketName = s3BucketName; largePayloadSupport = true; LOG.info("Large-payload support enabled."); }
java
public void setLargePayloadSupportEnabled(AmazonS3 s3, String s3BucketName) { if (s3 == null || s3BucketName == null) { String errorMessage = "S3 client and/or S3 bucket name cannot be null."; LOG.error(errorMessage); throw new AmazonClientException(errorMessage); } if (isLargePayloadSupportEnabled()) { LOG.warn("Large-payload support is already enabled. Overwriting AmazonS3Client and S3BucketName."); } this.s3 = s3; this.s3BucketName = s3BucketName; largePayloadSupport = true; LOG.info("Large-payload support enabled."); }
[ "public", "void", "setLargePayloadSupportEnabled", "(", "AmazonS3", "s3", ",", "String", "s3BucketName", ")", "{", "if", "(", "s3", "==", "null", "||", "s3BucketName", "==", "null", ")", "{", "String", "errorMessage", "=", "\"S3 client and/or S3 bucket name cannot b...
Enables support for large-payload messages. @param s3 Amazon S3 client which is going to be used for storing large-payload messages. @param s3BucketName Name of the bucket which is going to be used for storing large-payload messages. The bucket must be already created and configured in s3.
[ "Enables", "support", "for", "large", "-", "payload", "messages", "." ]
train
https://github.com/awslabs/amazon-sqs-java-extended-client-lib/blob/df0c6251b99e682d6179938fe784590e662b84ea/src/main/java/com/amazon/sqs/javamessaging/ExtendedClientConfiguration.java#L64-L77
line/armeria
saml/src/main/java/com/linecorp/armeria/server/saml/SamlEndpoint.java
SamlEndpoint.ofHttpPost
public static SamlEndpoint ofHttpPost(URI uri) { requireNonNull(uri, "uri"); return new SamlEndpoint(uri, SamlBindingProtocol.HTTP_POST); }
java
public static SamlEndpoint ofHttpPost(URI uri) { requireNonNull(uri, "uri"); return new SamlEndpoint(uri, SamlBindingProtocol.HTTP_POST); }
[ "public", "static", "SamlEndpoint", "ofHttpPost", "(", "URI", "uri", ")", "{", "requireNonNull", "(", "uri", ",", "\"uri\"", ")", ";", "return", "new", "SamlEndpoint", "(", "uri", ",", "SamlBindingProtocol", ".", "HTTP_POST", ")", ";", "}" ]
Creates a {@link SamlEndpoint} of the specified {@code uri} and the HTTP POST binding protocol.
[ "Creates", "a", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/saml/src/main/java/com/linecorp/armeria/server/saml/SamlEndpoint.java#L68-L71
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/TriggersInner.java
TriggersInner.createOrUpdate
public TriggerInner createOrUpdate(String deviceName, String name, String resourceGroupName, TriggerInner trigger) { return createOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, trigger).toBlocking().last().body(); }
java
public TriggerInner createOrUpdate(String deviceName, String name, String resourceGroupName, TriggerInner trigger) { return createOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, trigger).toBlocking().last().body(); }
[ "public", "TriggerInner", "createOrUpdate", "(", "String", "deviceName", ",", "String", "name", ",", "String", "resourceGroupName", ",", "TriggerInner", "trigger", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "deviceName", ",", "name", ",", "reso...
Creates or updates a trigger. @param deviceName Creates or updates a trigger @param name The trigger name. @param resourceGroupName The resource group name. @param trigger The trigger. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the TriggerInner object if successful.
[ "Creates", "or", "updates", "a", "trigger", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/TriggersInner.java#L444-L446
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmOptimizer.java
SymmOptimizer.probabilityFunction
private double probabilityFunction(double AS, int m, int maxIter) { double prob = (C + AS) / (C * Math.sqrt(m)); double norm = (1 - (m * 1.0) / maxIter); // Normalization factor return Math.min(Math.max(prob * norm, 0.0), 1.0); }
java
private double probabilityFunction(double AS, int m, int maxIter) { double prob = (C + AS) / (C * Math.sqrt(m)); double norm = (1 - (m * 1.0) / maxIter); // Normalization factor return Math.min(Math.max(prob * norm, 0.0), 1.0); }
[ "private", "double", "probabilityFunction", "(", "double", "AS", ",", "int", "m", ",", "int", "maxIter", ")", "{", "double", "prob", "=", "(", "C", "+", "AS", ")", "/", "(", "C", "*", "Math", ".", "sqrt", "(", "m", ")", ")", ";", "double", "norm"...
Calculates the probability of accepting a bad move given the iteration step and the score change. <p> Function: p=(C-AS)/(C*sqrt(step)) Added a normalization factor so that the probability approaches 0 when the maxIter is reached.
[ "Calculates", "the", "probability", "of", "accepting", "a", "bad", "move", "given", "the", "iteration", "step", "and", "the", "score", "change", ".", "<p", ">", "Function", ":", "p", "=", "(", "C", "-", "AS", ")", "/", "(", "C", "*", "sqrt", "(", "...
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmOptimizer.java#L827-L832
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urltemplates/URLTemplate.java
URLTemplate.substitute
public void substitute( String token, int value ) { String valueStr = Integer.toString( value ); _tokenValuesMap.put( token, valueStr ); }
java
public void substitute( String token, int value ) { String valueStr = Integer.toString( value ); _tokenValuesMap.put( token, valueStr ); }
[ "public", "void", "substitute", "(", "String", "token", ",", "int", "value", ")", "{", "String", "valueStr", "=", "Integer", ".", "toString", "(", "value", ")", ";", "_tokenValuesMap", ".", "put", "(", "token", ",", "valueStr", ")", ";", "}" ]
Replace a single token in the template with a corresponding int value. Tokens are expected to be qualified in braces. E.g. {url:port}
[ "Replace", "a", "single", "token", "in", "the", "template", "with", "a", "corresponding", "int", "value", ".", "Tokens", "are", "expected", "to", "be", "qualified", "in", "braces", ".", "E", ".", "g", ".", "{", "url", ":", "port", "}" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urltemplates/URLTemplate.java#L258-L262
UrielCh/ovh-java-sdk
ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java
ApiOvhVps.serviceName_reinstall_POST
public OvhTask serviceName_reinstall_POST(String serviceName, Boolean doNotSendPassword, String language, Long[] softwareId, String[] sshKey, Long templateId) throws IOException { String qPath = "/vps/{serviceName}/reinstall"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "doNotSendPassword", doNotSendPassword); addBody(o, "language", language); addBody(o, "softwareId", softwareId); addBody(o, "sshKey", sshKey); addBody(o, "templateId", templateId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_reinstall_POST(String serviceName, Boolean doNotSendPassword, String language, Long[] softwareId, String[] sshKey, Long templateId) throws IOException { String qPath = "/vps/{serviceName}/reinstall"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "doNotSendPassword", doNotSendPassword); addBody(o, "language", language); addBody(o, "softwareId", softwareId); addBody(o, "sshKey", sshKey); addBody(o, "templateId", templateId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_reinstall_POST", "(", "String", "serviceName", ",", "Boolean", "doNotSendPassword", ",", "String", "language", ",", "Long", "[", "]", "softwareId", ",", "String", "[", "]", "sshKey", ",", "Long", "templateId", ")", "throws", "IO...
Reinstall the virtual server REST: POST /vps/{serviceName}/reinstall @param doNotSendPassword [required] If asked, the installation password will NOT be sent (only if sshKey defined) @param softwareId [required] Id of the vps.Software type fetched in /template/{id}/software @param language [required] Distribution language. default : en @param templateId [required] Id of the vps.Template fetched in /templates list @param sshKey [required] SSH key names to pre-install on your VPS (name from /me/sshKey) @param serviceName [required] The internal name of your VPS offer
[ "Reinstall", "the", "virtual", "server" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java#L84-L95
facebook/fresco
animated-base/src/main/java/com/facebook/imagepipeline/animated/util/AnimatedDrawableUtil.java
AnimatedDrawableUtil.getFrameForTimestampMs
public int getFrameForTimestampMs(int frameTimestampsMs[], int timestampMs) { int index = Arrays.binarySearch(frameTimestampsMs, timestampMs); if (index < 0) { return -index - 1 - 1; } else { return index; } }
java
public int getFrameForTimestampMs(int frameTimestampsMs[], int timestampMs) { int index = Arrays.binarySearch(frameTimestampsMs, timestampMs); if (index < 0) { return -index - 1 - 1; } else { return index; } }
[ "public", "int", "getFrameForTimestampMs", "(", "int", "frameTimestampsMs", "[", "]", ",", "int", "timestampMs", ")", "{", "int", "index", "=", "Arrays", ".", "binarySearch", "(", "frameTimestampsMs", ",", "timestampMs", ")", ";", "if", "(", "index", "<", "0...
Gets the frame index for specified timestamp. @param frameTimestampsMs an array of timestamps generated by {@link #getFrameForTimestampMs)} @param timestampMs the timestamp @return the frame index for the timestamp or the last frame number if the timestamp is outside the duration of the entire animation
[ "Gets", "the", "frame", "index", "for", "specified", "timestamp", "." ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/animated-base/src/main/java/com/facebook/imagepipeline/animated/util/AnimatedDrawableUtil.java#L81-L88
Azure/azure-sdk-for-java
dns/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/dns/v2017_10_01/implementation/ZonesInner.java
ZonesInner.getByResourceGroupAsync
public Observable<ZoneInner> getByResourceGroupAsync(String resourceGroupName, String zoneName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, zoneName).map(new Func1<ServiceResponse<ZoneInner>, ZoneInner>() { @Override public ZoneInner call(ServiceResponse<ZoneInner> response) { return response.body(); } }); }
java
public Observable<ZoneInner> getByResourceGroupAsync(String resourceGroupName, String zoneName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, zoneName).map(new Func1<ServiceResponse<ZoneInner>, ZoneInner>() { @Override public ZoneInner call(ServiceResponse<ZoneInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ZoneInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "zoneName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "zoneName", ")", ".", "map", "(", ...
Gets a DNS zone. Retrieves the zone properties, but not the record sets within the zone. @param resourceGroupName The name of the resource group. @param zoneName The name of the DNS zone (without a terminating dot). @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ZoneInner object
[ "Gets", "a", "DNS", "zone", ".", "Retrieves", "the", "zone", "properties", "but", "not", "the", "record", "sets", "within", "the", "zone", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/dns/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/dns/v2017_10_01/implementation/ZonesInner.java#L645-L652
google/closure-templates
java/src/com/google/template/soy/jbcsrc/SoyNodeCompiler.java
SoyNodeCompiler.getParamStoreExpression
private Expression getParamStoreExpression(CallNode node, Label reattachPoint) { if (!node.isPassingData()) { return ConstructorRef.BASIC_PARAM_STORE.construct(constant(node.numChildren())); } Expression dataExpression; if (node.isPassingAllData()) { dataExpression = parameterLookup.getParamsRecord(); } else { dataExpression = getDataRecordExpression(node, reattachPoint); } Expression paramStoreExpression = ConstructorRef.AUGMENTED_PARAM_STORE.construct( dataExpression, constant(node.numChildren())); if (node.isPassingAllData()) { paramStoreExpression = maybeAddDefaultParams(node, paramStoreExpression).or(paramStoreExpression); } return paramStoreExpression; }
java
private Expression getParamStoreExpression(CallNode node, Label reattachPoint) { if (!node.isPassingData()) { return ConstructorRef.BASIC_PARAM_STORE.construct(constant(node.numChildren())); } Expression dataExpression; if (node.isPassingAllData()) { dataExpression = parameterLookup.getParamsRecord(); } else { dataExpression = getDataRecordExpression(node, reattachPoint); } Expression paramStoreExpression = ConstructorRef.AUGMENTED_PARAM_STORE.construct( dataExpression, constant(node.numChildren())); if (node.isPassingAllData()) { paramStoreExpression = maybeAddDefaultParams(node, paramStoreExpression).or(paramStoreExpression); } return paramStoreExpression; }
[ "private", "Expression", "getParamStoreExpression", "(", "CallNode", "node", ",", "Label", "reattachPoint", ")", "{", "if", "(", "!", "node", ".", "isPassingData", "(", ")", ")", "{", "return", "ConstructorRef", ".", "BASIC_PARAM_STORE", ".", "construct", "(", ...
Returns an expression that creates a new {@link ParamStore} suitable for holding all the parameters.
[ "Returns", "an", "expression", "that", "creates", "a", "new", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/SoyNodeCompiler.java#L1052-L1071
javagl/ND
nd-tuples/src/main/java/de/javagl/nd/tuples/j/LongTuples.java
LongTuples.incrementLexicographically
private static boolean incrementLexicographically( MutableLongTuple current, LongTuple min, LongTuple max, int index) { if (index == -1) { return false; } long oldValue = current.get(index); long newValue = oldValue + 1; current.set(index, newValue); if (newValue >= max.get(index)) { current.set(index, min.get(index)); return incrementLexicographically(current, min, max, index-1); } return true; }
java
private static boolean incrementLexicographically( MutableLongTuple current, LongTuple min, LongTuple max, int index) { if (index == -1) { return false; } long oldValue = current.get(index); long newValue = oldValue + 1; current.set(index, newValue); if (newValue >= max.get(index)) { current.set(index, min.get(index)); return incrementLexicographically(current, min, max, index-1); } return true; }
[ "private", "static", "boolean", "incrementLexicographically", "(", "MutableLongTuple", "current", ",", "LongTuple", "min", ",", "LongTuple", "max", ",", "int", "index", ")", "{", "if", "(", "index", "==", "-", "1", ")", "{", "return", "false", ";", "}", "l...
Recursively increment the given tuple lexicographically, starting at the given index. @param current The tuple to increment @param min The minimum values @param max The maximum values @param index The index @return Whether the tuple could be incremented
[ "Recursively", "increment", "the", "given", "tuple", "lexicographically", "starting", "at", "the", "given", "index", "." ]
train
https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-tuples/src/main/java/de/javagl/nd/tuples/j/LongTuples.java#L1557-L1573
asterisk-java/asterisk-java
src/main/java/org/asteriskjava/manager/internal/ManagerUtil.java
ManagerUtil.addInternalActionId
public static String addInternalActionId(String actionId, String internalActionId) { if (actionId == null) { return internalActionId + INTERNAL_ACTION_ID_DELIMITER; } return internalActionId + INTERNAL_ACTION_ID_DELIMITER + actionId; }
java
public static String addInternalActionId(String actionId, String internalActionId) { if (actionId == null) { return internalActionId + INTERNAL_ACTION_ID_DELIMITER; } return internalActionId + INTERNAL_ACTION_ID_DELIMITER + actionId; }
[ "public", "static", "String", "addInternalActionId", "(", "String", "actionId", ",", "String", "internalActionId", ")", "{", "if", "(", "actionId", "==", "null", ")", "{", "return", "internalActionId", "+", "INTERNAL_ACTION_ID_DELIMITER", ";", "}", "return", "inte...
Adds the internal action id to the given action id. @param actionId the action id as set by the user. @param internalActionId the internal action id to add. @return the action id prefixed by the internal action id suitable to be sent to Asterisk.
[ "Adds", "the", "internal", "action", "id", "to", "the", "given", "action", "id", "." ]
train
https://github.com/asterisk-java/asterisk-java/blob/cdc9849270d97ef75afa447a02c5194ed29121eb/src/main/java/org/asteriskjava/manager/internal/ManagerUtil.java#L123-L130
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/TimeSeriesUtils.java
TimeSeriesUtils.reshapeCnnMaskToTimeSeriesMask
public static INDArray reshapeCnnMaskToTimeSeriesMask(INDArray timeSeriesMaskAsCnnMask, int minibatchSize) { Preconditions.checkArgument(timeSeriesMaskAsCnnMask.rank() == 4 || timeSeriesMaskAsCnnMask.size(1) != 1 || timeSeriesMaskAsCnnMask.size(2) != 1 || timeSeriesMaskAsCnnMask.size(3) != 1, "Expected rank 4 mask with shape [mb*seqLength, 1, 1, 1]. Got rank %s mask array with shape %s", timeSeriesMaskAsCnnMask.rank(), timeSeriesMaskAsCnnMask.shape()); val timeSeriesLength = timeSeriesMaskAsCnnMask.length() / minibatchSize; return timeSeriesMaskAsCnnMask.reshape('f', minibatchSize, timeSeriesLength); }
java
public static INDArray reshapeCnnMaskToTimeSeriesMask(INDArray timeSeriesMaskAsCnnMask, int minibatchSize) { Preconditions.checkArgument(timeSeriesMaskAsCnnMask.rank() == 4 || timeSeriesMaskAsCnnMask.size(1) != 1 || timeSeriesMaskAsCnnMask.size(2) != 1 || timeSeriesMaskAsCnnMask.size(3) != 1, "Expected rank 4 mask with shape [mb*seqLength, 1, 1, 1]. Got rank %s mask array with shape %s", timeSeriesMaskAsCnnMask.rank(), timeSeriesMaskAsCnnMask.shape()); val timeSeriesLength = timeSeriesMaskAsCnnMask.length() / minibatchSize; return timeSeriesMaskAsCnnMask.reshape('f', minibatchSize, timeSeriesLength); }
[ "public", "static", "INDArray", "reshapeCnnMaskToTimeSeriesMask", "(", "INDArray", "timeSeriesMaskAsCnnMask", ",", "int", "minibatchSize", ")", "{", "Preconditions", ".", "checkArgument", "(", "timeSeriesMaskAsCnnMask", ".", "rank", "(", ")", "==", "4", "||", "timeSer...
Reshape CNN-style 4d mask array of shape [seqLength*minibatch,1,1,1] to time series mask [mb,seqLength] This should match the assumptions (f order, etc) in RnnOutputLayer @param timeSeriesMaskAsCnnMask Mask array to reshape @return Sequence mask array - [minibatch, sequenceLength]
[ "Reshape", "CNN", "-", "style", "4d", "mask", "array", "of", "shape", "[", "seqLength", "*", "minibatch", "1", "1", "1", "]", "to", "time", "series", "mask", "[", "mb", "seqLength", "]", "This", "should", "match", "the", "assumptions", "(", "f", "order...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/TimeSeriesUtils.java#L125-L134
jayantk/jklol
src/com/jayantkrish/jklol/lisp/LispUtil.java
LispUtil.readProgram
public static SExpression readProgram(List<String> filenames, IndexedList<String> symbolTable) { StringBuilder programBuilder = new StringBuilder(); programBuilder.append("(begin "); for (String filename : filenames) { for (String line : IoUtils.readLines(filename)) { line = line.replaceAll("^[ \t]*;.*", ""); programBuilder.append(line); programBuilder.append(" "); } } programBuilder.append(" )"); String program = programBuilder.toString(); ExpressionParser<SExpression> parser = ExpressionParser.sExpression(symbolTable); SExpression programExpression = parser.parse(program); return programExpression; }
java
public static SExpression readProgram(List<String> filenames, IndexedList<String> symbolTable) { StringBuilder programBuilder = new StringBuilder(); programBuilder.append("(begin "); for (String filename : filenames) { for (String line : IoUtils.readLines(filename)) { line = line.replaceAll("^[ \t]*;.*", ""); programBuilder.append(line); programBuilder.append(" "); } } programBuilder.append(" )"); String program = programBuilder.toString(); ExpressionParser<SExpression> parser = ExpressionParser.sExpression(symbolTable); SExpression programExpression = parser.parse(program); return programExpression; }
[ "public", "static", "SExpression", "readProgram", "(", "List", "<", "String", ">", "filenames", ",", "IndexedList", "<", "String", ">", "symbolTable", ")", "{", "StringBuilder", "programBuilder", "=", "new", "StringBuilder", "(", ")", ";", "programBuilder", ".",...
Reads a program from a list of files. Lines starting with any amount of whitespace followed by ; are ignored as comments. @param filenames @param symbolTable @return
[ "Reads", "a", "program", "from", "a", "list", "of", "files", ".", "Lines", "starting", "with", "any", "amount", "of", "whitespace", "followed", "by", ";", "are", "ignored", "as", "comments", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/lisp/LispUtil.java#L26-L43
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.deleteFromConference
public void deleteFromConference(String connId, String dnToDrop) throws WorkspaceApiException { this.deleteFromConference(connId, dnToDrop, null, null); }
java
public void deleteFromConference(String connId, String dnToDrop) throws WorkspaceApiException { this.deleteFromConference(connId, dnToDrop, null, null); }
[ "public", "void", "deleteFromConference", "(", "String", "connId", ",", "String", "dnToDrop", ")", "throws", "WorkspaceApiException", "{", "this", ".", "deleteFromConference", "(", "connId", ",", "dnToDrop", ",", "null", ",", "null", ")", ";", "}" ]
Delete the specified DN from the conference call. This operation can only be performed by the owner of the conference call. @param connId The connection ID of the conference. @param dnToDrop The DN of the party to drop from the conference.
[ "Delete", "the", "specified", "DN", "from", "the", "conference", "call", ".", "This", "operation", "can", "only", "be", "performed", "by", "the", "owner", "of", "the", "conference", "call", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L906-L908
knowm/XChange
xchange-bitcoinde/src/main/java/org/knowm/xchange/bitcoinde/BitcoindeAdapters.java
BitcoindeAdapters.adaptAccountInfo
public static AccountInfo adaptAccountInfo(BitcoindeAccountWrapper bitcoindeAccount) { // This adapter is not complete yet BitcoindeBalance btc = bitcoindeAccount.getData().getBalances().getBtc(); BitcoindeBalance eth = bitcoindeAccount.getData().getBalances().getEth(); BigDecimal eur = bitcoindeAccount.getData().getFidorReservation().getAvailableAmount(); Balance btcBalance = new Balance(Currency.BTC, btc.getAvailableAmount()); Balance ethBalance = new Balance(Currency.ETH, eth.getAvailableAmount()); Balance eurBalance = new Balance(Currency.EUR, eur); Wallet wallet = new Wallet(btcBalance, ethBalance, eurBalance); return new AccountInfo(wallet); }
java
public static AccountInfo adaptAccountInfo(BitcoindeAccountWrapper bitcoindeAccount) { // This adapter is not complete yet BitcoindeBalance btc = bitcoindeAccount.getData().getBalances().getBtc(); BitcoindeBalance eth = bitcoindeAccount.getData().getBalances().getEth(); BigDecimal eur = bitcoindeAccount.getData().getFidorReservation().getAvailableAmount(); Balance btcBalance = new Balance(Currency.BTC, btc.getAvailableAmount()); Balance ethBalance = new Balance(Currency.ETH, eth.getAvailableAmount()); Balance eurBalance = new Balance(Currency.EUR, eur); Wallet wallet = new Wallet(btcBalance, ethBalance, eurBalance); return new AccountInfo(wallet); }
[ "public", "static", "AccountInfo", "adaptAccountInfo", "(", "BitcoindeAccountWrapper", "bitcoindeAccount", ")", "{", "// This adapter is not complete yet", "BitcoindeBalance", "btc", "=", "bitcoindeAccount", ".", "getData", "(", ")", ".", "getBalances", "(", ")", ".", "...
Adapt a org.knowm.xchange.bitcoinde.dto.marketdata.BitcoindeAccount object to an AccountInfo object. @param bitcoindeAccount @return
[ "Adapt", "a", "org", ".", "knowm", ".", "xchange", ".", "bitcoinde", ".", "dto", ".", "marketdata", ".", "BitcoindeAccount", "object", "to", "an", "AccountInfo", "object", "." ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-bitcoinde/src/main/java/org/knowm/xchange/bitcoinde/BitcoindeAdapters.java#L94-L108
percolate/caffeine
caffeine/src/main/java/com/percolate/caffeine/ToastUtils.java
ToastUtils.quickToast
public static Toast quickToast(Context context, String message) { return quickToast(context, message, false); }
java
public static Toast quickToast(Context context, String message) { return quickToast(context, message, false); }
[ "public", "static", "Toast", "quickToast", "(", "Context", "context", ",", "String", "message", ")", "{", "return", "quickToast", "(", "context", ",", "message", ",", "false", ")", ";", "}" ]
Display a toast with the given message (Length will be Toast.LENGTH_SHORT -- approx 2 sec). @param context The current Context or Activity that this method is called from @param message Message to display @return Toast object that is being displayed. Note,show() has already been called on this object.
[ "Display", "a", "toast", "with", "the", "given", "message", "(", "Length", "will", "be", "Toast", ".", "LENGTH_SHORT", "--", "approx", "2", "sec", ")", "." ]
train
https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/ToastUtils.java#L21-L23
aerogear/aerogear-android-push
library/src/main/java/org/jboss/aerogear/android/unifiedpush/fcm/AeroGearFCMPushRegistrar.java
AeroGearFCMPushRegistrar.presistPostInformation
private void presistPostInformation(Context appContext, JsonObject postData) { preferenceProvider.get(appContext).edit() .putString(String.format(REGISTRAR_PREFERENCE_TEMPLATE, senderId), postData.toString()) .commit(); }
java
private void presistPostInformation(Context appContext, JsonObject postData) { preferenceProvider.get(appContext).edit() .putString(String.format(REGISTRAR_PREFERENCE_TEMPLATE, senderId), postData.toString()) .commit(); }
[ "private", "void", "presistPostInformation", "(", "Context", "appContext", ",", "JsonObject", "postData", ")", "{", "preferenceProvider", ".", "get", "(", "appContext", ")", ".", "edit", "(", ")", ".", "putString", "(", "String", ".", "format", "(", "REGISTRAR...
Save the post sent to UPS. This will be used by {@link AeroGearUPSMessageService} to refresh the registration token if the registration token changes. @param appContext the application Context
[ "Save", "the", "post", "sent", "to", "UPS", ".", "This", "will", "be", "used", "by", "{", "@link", "AeroGearUPSMessageService", "}", "to", "refresh", "the", "registration", "token", "if", "the", "registration", "token", "changes", "." ]
train
https://github.com/aerogear/aerogear-android-push/blob/f21f93393a9f4590e9a8d6d045ab9aabca3d211f/library/src/main/java/org/jboss/aerogear/android/unifiedpush/fcm/AeroGearFCMPushRegistrar.java#L371-L375
rhuss/jolokia
agent/core/src/main/java/org/jolokia/util/EscapeUtil.java
EscapeUtil.parsePath
public static List<String> parsePath(String pPath) { // Special cases which simply implies 'no path' if (pPath == null || pPath.equals("") || pPath.equals("/")) { return null; } return replaceWildcardsWithNull(split(pPath, PATH_ESCAPE, "/")); }
java
public static List<String> parsePath(String pPath) { // Special cases which simply implies 'no path' if (pPath == null || pPath.equals("") || pPath.equals("/")) { return null; } return replaceWildcardsWithNull(split(pPath, PATH_ESCAPE, "/")); }
[ "public", "static", "List", "<", "String", ">", "parsePath", "(", "String", "pPath", ")", "{", "// Special cases which simply implies 'no path'", "if", "(", "pPath", "==", "null", "||", "pPath", ".", "equals", "(", "\"\"", ")", "||", "pPath", ".", "equals", ...
Parse a string path and return a list of split up parts. @param pPath the path to parse. Can be null @return list of path elements or null if the initial path is null.
[ "Parse", "a", "string", "path", "and", "return", "a", "list", "of", "split", "up", "parts", "." ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/util/EscapeUtil.java#L88-L94
mockito/mockito
src/main/java/org/mockito/internal/matchers/apachecommons/EqualsBuilder.java
EqualsBuilder.reflectionEquals
public static boolean reflectionEquals(Object lhs, Object rhs, boolean testTransients) { return reflectionEquals(lhs, rhs, testTransients, null, null); }
java
public static boolean reflectionEquals(Object lhs, Object rhs, boolean testTransients) { return reflectionEquals(lhs, rhs, testTransients, null, null); }
[ "public", "static", "boolean", "reflectionEquals", "(", "Object", "lhs", ",", "Object", "rhs", ",", "boolean", "testTransients", ")", "{", "return", "reflectionEquals", "(", "lhs", ",", "rhs", ",", "testTransients", ",", "null", ",", "null", ")", ";", "}" ]
<p>This method uses reflection to determine if the two <code>Object</code>s are equal.</p> <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will throw a security exception if run under a security manager, if the permissions are not set up correctly. It is also not as efficient as testing explicitly.</p> <p>If the TestTransients parameter is set to <code>true</code>, transient members will be tested, otherwise they are ignored, as they are likely derived fields, and not part of the value of the <code>Object</code>.</p> <p>Static fields will not be tested. Superclass fields will be included.</p> @param lhs <code>this</code> object @param rhs the other object @param testTransients whether to include transient fields @return <code>true</code> if the two Objects have tested equals.
[ "<p", ">", "This", "method", "uses", "reflection", "to", "determine", "if", "the", "two", "<code", ">", "Object<", "/", "code", ">", "s", "are", "equal", ".", "<", "/", "p", ">" ]
train
https://github.com/mockito/mockito/blob/c5e2b80af76e3192cae7c9550b70c4d1ab312034/src/main/java/org/mockito/internal/matchers/apachecommons/EqualsBuilder.java#L162-L164
datastax/java-driver
core/src/main/java/com/datastax/oss/driver/internal/core/util/DirectedGraph.java
DirectedGraph.addEdge
public void addEdge(VertexT from, VertexT to) { Preconditions.checkArgument(vertices.containsKey(from) && vertices.containsKey(to)); adjacencyList.put(from, to); vertices.put(to, vertices.get(to) + 1); }
java
public void addEdge(VertexT from, VertexT to) { Preconditions.checkArgument(vertices.containsKey(from) && vertices.containsKey(to)); adjacencyList.put(from, to); vertices.put(to, vertices.get(to) + 1); }
[ "public", "void", "addEdge", "(", "VertexT", "from", ",", "VertexT", "to", ")", "{", "Preconditions", ".", "checkArgument", "(", "vertices", ".", "containsKey", "(", "from", ")", "&&", "vertices", ".", "containsKey", "(", "to", ")", ")", ";", "adjacencyLis...
this assumes that {@code from} and {@code to} were part of the vertices passed to the constructor
[ "this", "assumes", "that", "{" ]
train
https://github.com/datastax/java-driver/blob/612a63f2525618e2020e86c9ad75ab37adba6132/core/src/main/java/com/datastax/oss/driver/internal/core/util/DirectedGraph.java#L61-L65
lunarray-org/common-event
src/main/java/org/lunarray/common/event/Bus.java
Bus.removeListener
public <T> void removeListener(final Listener<T> listener, final Object instance) { final ListenerInstancePair<T> pair = new ListenerInstancePair<T>(listener, instance); this.listeners.remove(pair); for (final List<ListenerInstancePair<?>> entry : this.cachedListeners.values()) { entry.remove(pair); } }
java
public <T> void removeListener(final Listener<T> listener, final Object instance) { final ListenerInstancePair<T> pair = new ListenerInstancePair<T>(listener, instance); this.listeners.remove(pair); for (final List<ListenerInstancePair<?>> entry : this.cachedListeners.values()) { entry.remove(pair); } }
[ "public", "<", "T", ">", "void", "removeListener", "(", "final", "Listener", "<", "T", ">", "listener", ",", "final", "Object", "instance", ")", "{", "final", "ListenerInstancePair", "<", "T", ">", "pair", "=", "new", "ListenerInstancePair", "<", "T", ">",...
Remove a listener. @param listener The listener to remove. @param instance The associated marker. @param <T> The listener event type.
[ "Remove", "a", "listener", "." ]
train
https://github.com/lunarray-org/common-event/blob/a92102546d136d5f4270cfe8dbd69e4188a46202/src/main/java/org/lunarray/common/event/Bus.java#L206-L212
Ordinastie/MalisisCore
src/main/java/net/malisis/core/asm/AsmUtils.java
AsmUtils.insnEqual
public static boolean insnEqual(AbstractInsnNode node1, AbstractInsnNode node2) { if (node1 == null || node2 == null || node1.getOpcode() != node2.getOpcode()) return false; switch (node2.getType()) { case VAR_INSN: return varInsnEqual((VarInsnNode) node1, (VarInsnNode) node2); case TYPE_INSN: return typeInsnEqual((TypeInsnNode) node1, (TypeInsnNode) node2); case FIELD_INSN: return fieldInsnEqual((FieldInsnNode) node1, (FieldInsnNode) node2); case METHOD_INSN: return methodInsnEqual((MethodInsnNode) node1, (MethodInsnNode) node2); case LDC_INSN: return ldcInsnEqual((LdcInsnNode) node1, (LdcInsnNode) node2); case IINC_INSN: return iincInsnEqual((IincInsnNode) node1, (IincInsnNode) node2); case INT_INSN: return intInsnEqual((IntInsnNode) node1, (IntInsnNode) node2); default: return true; } }
java
public static boolean insnEqual(AbstractInsnNode node1, AbstractInsnNode node2) { if (node1 == null || node2 == null || node1.getOpcode() != node2.getOpcode()) return false; switch (node2.getType()) { case VAR_INSN: return varInsnEqual((VarInsnNode) node1, (VarInsnNode) node2); case TYPE_INSN: return typeInsnEqual((TypeInsnNode) node1, (TypeInsnNode) node2); case FIELD_INSN: return fieldInsnEqual((FieldInsnNode) node1, (FieldInsnNode) node2); case METHOD_INSN: return methodInsnEqual((MethodInsnNode) node1, (MethodInsnNode) node2); case LDC_INSN: return ldcInsnEqual((LdcInsnNode) node1, (LdcInsnNode) node2); case IINC_INSN: return iincInsnEqual((IincInsnNode) node1, (IincInsnNode) node2); case INT_INSN: return intInsnEqual((IntInsnNode) node1, (IntInsnNode) node2); default: return true; } }
[ "public", "static", "boolean", "insnEqual", "(", "AbstractInsnNode", "node1", ",", "AbstractInsnNode", "node2", ")", "{", "if", "(", "node1", "==", "null", "||", "node2", "==", "null", "||", "node1", ".", "getOpcode", "(", ")", "!=", "node2", ".", "getOpco...
Checks if two {@link AbstractInsnNode} are equals. @param node1 the node1 @param node2 the node2 @return true, if equal
[ "Checks", "if", "two", "{", "@link", "AbstractInsnNode", "}", "are", "equals", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/asm/AsmUtils.java#L147-L171
zandero/rest.vertx
src/main/java/com/zandero/rest/RestBuilder.java
RestBuilder.addProvider
public <T> RestBuilder addProvider(Class<T> clazz, Class<? extends ContextProvider<T>> provider) { Assert.notNull(clazz, "Missing provided class type!"); Assert.notNull(provider, "Missing context provider!"); registeredProviders.put(clazz, provider); return this; }
java
public <T> RestBuilder addProvider(Class<T> clazz, Class<? extends ContextProvider<T>> provider) { Assert.notNull(clazz, "Missing provided class type!"); Assert.notNull(provider, "Missing context provider!"); registeredProviders.put(clazz, provider); return this; }
[ "public", "<", "T", ">", "RestBuilder", "addProvider", "(", "Class", "<", "T", ">", "clazz", ",", "Class", "<", "?", "extends", "ContextProvider", "<", "T", ">", ">", "provider", ")", "{", "Assert", ".", "notNull", "(", "clazz", ",", "\"Missing provided ...
Creates a provider that delivers type when needed @param provider to be executed when needed @param <T> provided object as argument @return builder
[ "Creates", "a", "provider", "that", "delivers", "type", "when", "needed" ]
train
https://github.com/zandero/rest.vertx/blob/ba458720cf59e076953eab9dac7227eeaf9e58ce/src/main/java/com/zandero/rest/RestBuilder.java#L353-L359
xm-online/xm-commons
xm-commons-logging/src/main/java/com/icthh/xm/commons/logging/util/LogObjectPrinter.java
LogObjectPrinter.joinUrlPaths
@SafeVarargs public static <T> String joinUrlPaths(final T[] arr, final T... arr2) { try { T[] url = ArrayUtils.addAll(arr, arr2); String res = StringUtils.join(url); return (res == null) ? "" : res; } catch (IndexOutOfBoundsException | IllegalArgumentException | ArrayStoreException e) { log.warn("Error while join URL paths from: {}, {}", arr, arr2); return "printerror:" + e; } }
java
@SafeVarargs public static <T> String joinUrlPaths(final T[] arr, final T... arr2) { try { T[] url = ArrayUtils.addAll(arr, arr2); String res = StringUtils.join(url); return (res == null) ? "" : res; } catch (IndexOutOfBoundsException | IllegalArgumentException | ArrayStoreException e) { log.warn("Error while join URL paths from: {}, {}", arr, arr2); return "printerror:" + e; } }
[ "@", "SafeVarargs", "public", "static", "<", "T", ">", "String", "joinUrlPaths", "(", "final", "T", "[", "]", "arr", ",", "final", "T", "...", "arr2", ")", "{", "try", "{", "T", "[", "]", "url", "=", "ArrayUtils", ".", "addAll", "(", "arr", ",", ...
Join URL path into one string. @param arr first url paths @param arr2 other url paths @param <T> url part path type @return URL representation string
[ "Join", "URL", "path", "into", "one", "string", "." ]
train
https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-logging/src/main/java/com/icthh/xm/commons/logging/util/LogObjectPrinter.java#L110-L120
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java
ImportScope.finalizeScope
public void finalizeScope() { for (List<Scope> scopes = this.subScopes; scopes.nonEmpty(); scopes = scopes.tail) { Scope impScope = scopes.head; if (impScope instanceof FilterImportScope && impScope.owner.kind == Kind.TYP) { WriteableScope finalized = WriteableScope.create(impScope.owner); for (Symbol sym : impScope.getSymbols()) { finalized.enter(sym); } finalized.listeners.add(new ScopeListener() { @Override public void symbolAdded(Symbol sym, Scope s) { Assert.error("The scope is sealed."); } @Override public void symbolRemoved(Symbol sym, Scope s) { Assert.error("The scope is sealed."); } }); scopes.head = finalized; } } }
java
public void finalizeScope() { for (List<Scope> scopes = this.subScopes; scopes.nonEmpty(); scopes = scopes.tail) { Scope impScope = scopes.head; if (impScope instanceof FilterImportScope && impScope.owner.kind == Kind.TYP) { WriteableScope finalized = WriteableScope.create(impScope.owner); for (Symbol sym : impScope.getSymbols()) { finalized.enter(sym); } finalized.listeners.add(new ScopeListener() { @Override public void symbolAdded(Symbol sym, Scope s) { Assert.error("The scope is sealed."); } @Override public void symbolRemoved(Symbol sym, Scope s) { Assert.error("The scope is sealed."); } }); scopes.head = finalized; } } }
[ "public", "void", "finalizeScope", "(", ")", "{", "for", "(", "List", "<", "Scope", ">", "scopes", "=", "this", ".", "subScopes", ";", "scopes", ".", "nonEmpty", "(", ")", ";", "scopes", "=", "scopes", ".", "tail", ")", "{", "Scope", "impScope", "=",...
Finalize the content of the ImportScope to speed-up future lookups. No further changes to class hierarchy or class content will be reflected.
[ "Finalize", "the", "content", "of", "the", "ImportScope", "to", "speed", "-", "up", "future", "lookups", ".", "No", "further", "changes", "to", "class", "hierarchy", "or", "class", "content", "will", "be", "reflected", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java#L742-L768
UrielCh/ovh-java-sdk
ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java
ApiOvhPrice.xdsl_offers_offersName_GET
public OvhPrice xdsl_offers_offersName_GET(net.minidev.ovh.api.price.xdsl.OvhOffersEnum offersName) throws IOException { String qPath = "/price/xdsl/offers/{offersName}"; StringBuilder sb = path(qPath, offersName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPrice.class); }
java
public OvhPrice xdsl_offers_offersName_GET(net.minidev.ovh.api.price.xdsl.OvhOffersEnum offersName) throws IOException { String qPath = "/price/xdsl/offers/{offersName}"; StringBuilder sb = path(qPath, offersName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPrice.class); }
[ "public", "OvhPrice", "xdsl_offers_offersName_GET", "(", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "price", ".", "xdsl", ".", "OvhOffersEnum", "offersName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/price/xdsl/offers/{offersName}\"", ...
Get the price of xdsl offers REST: GET /price/xdsl/offers/{offersName} @param offersName [required] The name of the offer
[ "Get", "the", "price", "of", "xdsl", "offers" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java#L24-L29
hsiafan/requests
src/main/java/net/dongliu/requests/utils/Cookies.java
Cookies.isDomainSuffix
public static boolean isDomainSuffix(String domain, String domainSuffix) { if (domain.length() < domainSuffix.length()) { return false; } if (domain.length() == domainSuffix.length()) { return domain.equals(domainSuffix); } return domain.endsWith(domainSuffix) && domain.charAt(domain.length() - domainSuffix.length() - 1) == '.'; }
java
public static boolean isDomainSuffix(String domain, String domainSuffix) { if (domain.length() < domainSuffix.length()) { return false; } if (domain.length() == domainSuffix.length()) { return domain.equals(domainSuffix); } return domain.endsWith(domainSuffix) && domain.charAt(domain.length() - domainSuffix.length() - 1) == '.'; }
[ "public", "static", "boolean", "isDomainSuffix", "(", "String", "domain", ",", "String", "domainSuffix", ")", "{", "if", "(", "domain", ".", "length", "(", ")", "<", "domainSuffix", ".", "length", "(", ")", ")", "{", "return", "false", ";", "}", "if", ...
If domainSuffix is suffix of domain @param domain start with "." @param domainSuffix not start with "."
[ "If", "domainSuffix", "is", "suffix", "of", "domain" ]
train
https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/utils/Cookies.java#L95-L104
Red5/red5-io
src/main/java/org/red5/io/utils/IOUtils.java
IOUtils.writeExtendedMediumInt
public final static void writeExtendedMediumInt(IoBuffer out, int value) { value = ((value & 0xff000000) >> 24) | (value << 8); out.putInt(value); }
java
public final static void writeExtendedMediumInt(IoBuffer out, int value) { value = ((value & 0xff000000) >> 24) | (value << 8); out.putInt(value); }
[ "public", "final", "static", "void", "writeExtendedMediumInt", "(", "IoBuffer", "out", ",", "int", "value", ")", "{", "value", "=", "(", "(", "value", "&", "0xff000000", ")", ">>", "24", ")", "|", "(", "value", "<<", "8", ")", ";", "out", ".", "putIn...
Writes extended medium integer (equivalent to a regular integer whose most significant byte has been moved to its end, past its least significant byte) @param out Output buffer @param value Integer to write
[ "Writes", "extended", "medium", "integer", "(", "equivalent", "to", "a", "regular", "integer", "whose", "most", "significant", "byte", "has", "been", "moved", "to", "its", "end", "past", "its", "least", "significant", "byte", ")" ]
train
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/IOUtils.java#L89-L92
JamesIry/jADT
jADT-core/src/main/java/com/pogofish/jadt/JADT.java
JADT.createDummyJADT
public static JADT createDummyJADT(List<SyntaxError> syntaxErrors, List<SemanticError> semanticErrors, String testSrcInfo, SinkFactoryFactory factory) { final SourceFactory sourceFactory = new StringSourceFactory(TEST_STRING); final Doc doc = new Doc(TEST_SRC_INFO, Pkg._Pkg(NO_COMMENTS, "pkg"), Util.<Imprt> list(), Util.<DataType> list()); final ParseResult parseResult = new ParseResult(doc, syntaxErrors); final DocEmitter docEmitter = new DummyDocEmitter(doc, TEST_CLASS_NAME); final Parser parser = new DummyParser(parseResult, testSrcInfo, TEST_STRING); final Checker checker = new DummyChecker(semanticErrors); final JADT jadt = new JADT(sourceFactory, parser, checker, docEmitter, factory); return jadt; }
java
public static JADT createDummyJADT(List<SyntaxError> syntaxErrors, List<SemanticError> semanticErrors, String testSrcInfo, SinkFactoryFactory factory) { final SourceFactory sourceFactory = new StringSourceFactory(TEST_STRING); final Doc doc = new Doc(TEST_SRC_INFO, Pkg._Pkg(NO_COMMENTS, "pkg"), Util.<Imprt> list(), Util.<DataType> list()); final ParseResult parseResult = new ParseResult(doc, syntaxErrors); final DocEmitter docEmitter = new DummyDocEmitter(doc, TEST_CLASS_NAME); final Parser parser = new DummyParser(parseResult, testSrcInfo, TEST_STRING); final Checker checker = new DummyChecker(semanticErrors); final JADT jadt = new JADT(sourceFactory, parser, checker, docEmitter, factory); return jadt; }
[ "public", "static", "JADT", "createDummyJADT", "(", "List", "<", "SyntaxError", ">", "syntaxErrors", ",", "List", "<", "SemanticError", ">", "semanticErrors", ",", "String", "testSrcInfo", ",", "SinkFactoryFactory", "factory", ")", "{", "final", "SourceFactory", "...
Create a dummy configged jADT based on the provided syntaxErrors, semanticErrors, testSrcInfo, and sink factory Useful for testing
[ "Create", "a", "dummy", "configged", "jADT", "based", "on", "the", "provided", "syntaxErrors", "semanticErrors", "testSrcInfo", "and", "sink", "factory", "Useful", "for", "testing" ]
train
https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/JADT.java#L177-L186
mojohaus/webstart
webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/dependency/task/UpdateManifestTask.java
UpdateManifestTask.createManifest
private Manifest createManifest( File jar, Map<String, String> manifestentries ) throws MojoExecutionException { JarFile jarFile = null; try { jarFile = new JarFile( jar ); // read manifest from jar Manifest manifest = jarFile.getManifest(); if ( manifest == null || manifest.getMainAttributes().isEmpty() ) { manifest = new Manifest(); manifest.getMainAttributes().putValue( Attributes.Name.MANIFEST_VERSION.toString(), "1.0" ); } // add or overwrite entries Set<Map.Entry<String, String>> entrySet = manifestentries.entrySet(); for ( Map.Entry<String, String> entry : entrySet ) { manifest.getMainAttributes().putValue( entry.getKey(), entry.getValue() ); } return manifest; } catch ( IOException e ) { throw new MojoExecutionException( "Error while reading manifest from " + jar.getAbsolutePath(), e ); } finally { ioUtil.close( jarFile ); } }
java
private Manifest createManifest( File jar, Map<String, String> manifestentries ) throws MojoExecutionException { JarFile jarFile = null; try { jarFile = new JarFile( jar ); // read manifest from jar Manifest manifest = jarFile.getManifest(); if ( manifest == null || manifest.getMainAttributes().isEmpty() ) { manifest = new Manifest(); manifest.getMainAttributes().putValue( Attributes.Name.MANIFEST_VERSION.toString(), "1.0" ); } // add or overwrite entries Set<Map.Entry<String, String>> entrySet = manifestentries.entrySet(); for ( Map.Entry<String, String> entry : entrySet ) { manifest.getMainAttributes().putValue( entry.getKey(), entry.getValue() ); } return manifest; } catch ( IOException e ) { throw new MojoExecutionException( "Error while reading manifest from " + jar.getAbsolutePath(), e ); } finally { ioUtil.close( jarFile ); } }
[ "private", "Manifest", "createManifest", "(", "File", "jar", ",", "Map", "<", "String", ",", "String", ">", "manifestentries", ")", "throws", "MojoExecutionException", "{", "JarFile", "jarFile", "=", "null", ";", "try", "{", "jarFile", "=", "new", "JarFile", ...
Create the new manifest from the existing jar file and the new entries. @param jar @param manifestentries @return Manifest @throws MojoExecutionException
[ "Create", "the", "new", "manifest", "from", "the", "existing", "jar", "file", "and", "the", "new", "entries", "." ]
train
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/dependency/task/UpdateManifestTask.java#L172-L206
knowm/XChange
xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/v2/service/CoinbaseTradeServiceRaw.java
CoinbaseTradeServiceRaw.quote
public CoinbaseSell quote(String accountId, BigDecimal total, Currency currency) throws IOException { return sellInternal(accountId, new SellPayload(total, currency.getCurrencyCode(), false, true)); }
java
public CoinbaseSell quote(String accountId, BigDecimal total, Currency currency) throws IOException { return sellInternal(accountId, new SellPayload(total, currency.getCurrencyCode(), false, true)); }
[ "public", "CoinbaseSell", "quote", "(", "String", "accountId", ",", "BigDecimal", "total", ",", "Currency", "currency", ")", "throws", "IOException", "{", "return", "sellInternal", "(", "accountId", ",", "new", "SellPayload", "(", "total", ",", "currency", ".", ...
Authenticated resource that lets you convert Bitcoin crediting your primary bank account on Coinbase. (You must link and verify your bank account through the website before this API call will work). @see <a href="https://developers.coinbase.com/api/v2#place-sell-order">developers.coinbase.com/api/v2#place-sell-order</a>
[ "Authenticated", "resource", "that", "lets", "you", "convert", "Bitcoin", "crediting", "your", "primary", "bank", "account", "on", "Coinbase", ".", "(", "You", "must", "link", "and", "verify", "your", "bank", "account", "through", "the", "website", "before", "...
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/v2/service/CoinbaseTradeServiceRaw.java#L76-L80
isisaddons-legacy/isis-module-security
dom/src/main/java/org/isisaddons/module/security/shiro/AuthenticationStrategyForIsisModuleSecurityRealm.java
AuthenticationStrategyForIsisModuleSecurityRealm.beforeAllAttempts
@Override public AuthenticationInfo beforeAllAttempts(Collection<? extends Realm> realms, AuthenticationToken token) throws AuthenticationException { final SimpleAuthenticationInfo authenticationInfo = (SimpleAuthenticationInfo) super.beforeAllAttempts(realms, token); authenticationInfo.setPrincipals(new PrincipalCollectionWithSinglePrincipalForApplicationUserInAnyRealm()); return authenticationInfo; }
java
@Override public AuthenticationInfo beforeAllAttempts(Collection<? extends Realm> realms, AuthenticationToken token) throws AuthenticationException { final SimpleAuthenticationInfo authenticationInfo = (SimpleAuthenticationInfo) super.beforeAllAttempts(realms, token); authenticationInfo.setPrincipals(new PrincipalCollectionWithSinglePrincipalForApplicationUserInAnyRealm()); return authenticationInfo; }
[ "@", "Override", "public", "AuthenticationInfo", "beforeAllAttempts", "(", "Collection", "<", "?", "extends", "Realm", ">", "realms", ",", "AuthenticationToken", "token", ")", "throws", "AuthenticationException", "{", "final", "SimpleAuthenticationInfo", "authenticationIn...
Reconfigures the SimpleAuthenticationInfo to use a implementation for storing its PrincipalCollections. <p> The default implementation uses a {@link org.apache.shiro.subject.SimplePrincipalCollection}, however this doesn't play well with the Isis Addons' security module which ends up chaining together multiple instances of {@link org.isisaddons.module.security.shiro.PrincipalForApplicationUser} for each login. This is probably because of it doing double duty with holding authorization information. There may be a better design here, but for now the solution I've chosen is to use a different implementation of {@link org.apache.shiro.subject.PrincipalCollection} that will only ever store one instance of {@link org.isisaddons.module.security.shiro.PrincipalForApplicationUser} as a principal. </p>
[ "Reconfigures", "the", "SimpleAuthenticationInfo", "to", "use", "a", "implementation", "for", "storing", "its", "PrincipalCollections", "." ]
train
https://github.com/isisaddons-legacy/isis-module-security/blob/a9deb1b003ba01e44c859085bd078be8df0c1863/dom/src/main/java/org/isisaddons/module/security/shiro/AuthenticationStrategyForIsisModuleSecurityRealm.java#L26-L32
crnk-project/crnk-framework
crnk-core/src/main/java/io/crnk/core/engine/internal/utils/PreconditionUtil.java
PreconditionUtil.assertFalse
public static void assertFalse(boolean condition, String message, Object... args) { verify(!condition, message, args); }
java
public static void assertFalse(boolean condition, String message, Object... args) { verify(!condition, message, args); }
[ "public", "static", "void", "assertFalse", "(", "boolean", "condition", ",", "String", "message", ",", "Object", "...", "args", ")", "{", "verify", "(", "!", "condition", ",", "message", ",", "args", ")", ";", "}" ]
Asserts that a condition is true. If it isn't it throws an {@link AssertionError} with the given message. @param message the identifying message for the {@link AssertionError} ( <code>null</code> okay) @param condition condition to be checked
[ "Asserts", "that", "a", "condition", "is", "true", ".", "If", "it", "isn", "t", "it", "throws", "an", "{", "@link", "AssertionError", "}", "with", "the", "given", "message", "." ]
train
https://github.com/crnk-project/crnk-framework/blob/2fd3ef9a991788d46fd2e83b43c8ea37cbaf8681/crnk-core/src/main/java/io/crnk/core/engine/internal/utils/PreconditionUtil.java#L99-L101
interedition/collatex
collatex-core/src/main/java/eu/interedition/collatex/suffixtree/ActivePoint.java
ActivePoint.setPosition
void setPosition(Node<T, S> node, Edge<T, S> edge, int length) { activeNode = node; activeEdge = edge; activeLength = length; }
java
void setPosition(Node<T, S> node, Edge<T, S> edge, int length) { activeNode = node; activeEdge = edge; activeLength = length; }
[ "void", "setPosition", "(", "Node", "<", "T", ",", "S", ">", "node", ",", "Edge", "<", "T", ",", "S", ">", "edge", ",", "int", "length", ")", "{", "activeNode", "=", "node", ";", "activeEdge", "=", "edge", ";", "activeLength", "=", "length", ";", ...
Sets the active point to a new node, edge, length tripple. @param node @param edge @param length
[ "Sets", "the", "active", "point", "to", "a", "new", "node", "edge", "length", "tripple", "." ]
train
https://github.com/interedition/collatex/blob/76dd1fcc36047bc66a87d31142e72e98b5347821/collatex-core/src/main/java/eu/interedition/collatex/suffixtree/ActivePoint.java#L38-L42
nutzam/nutzboot
nutzboot-demo/nutzboot-demo-simple/nutzboot-demo-simple-elasticsearch/src/main/java/io/nutz/demo/simple/utils/ElasticsearchUtil.java
ElasticsearchUtil.createOrUpdateData
public void createOrUpdateData(String indexName, String type, List<NutMap> list) { BulkRequestBuilder bulkRequest = getClient().prepareBulk(); if (list.size() > 0) { for (NutMap nutMap : list) { bulkRequest.add(getClient().prepareIndex(indexName, type).setId(nutMap.getString("id")).setSource(Lang.obj2map(nutMap.get("obj")))); } bulkRequest.execute().actionGet(); } }
java
public void createOrUpdateData(String indexName, String type, List<NutMap> list) { BulkRequestBuilder bulkRequest = getClient().prepareBulk(); if (list.size() > 0) { for (NutMap nutMap : list) { bulkRequest.add(getClient().prepareIndex(indexName, type).setId(nutMap.getString("id")).setSource(Lang.obj2map(nutMap.get("obj")))); } bulkRequest.execute().actionGet(); } }
[ "public", "void", "createOrUpdateData", "(", "String", "indexName", ",", "String", "type", ",", "List", "<", "NutMap", ">", "list", ")", "{", "BulkRequestBuilder", "bulkRequest", "=", "getClient", "(", ")", ".", "prepareBulk", "(", ")", ";", "if", "(", "li...
批量创建或更新文档 @param indexName 索引名 @param type 数据类型(表名) @param list 包含id和obj的NutMap集合对象
[ "批量创建或更新文档" ]
train
https://github.com/nutzam/nutzboot/blob/fd33fd4fdce058eab594f28e4d3202f997e3c66a/nutzboot-demo/nutzboot-demo-simple/nutzboot-demo-simple-elasticsearch/src/main/java/io/nutz/demo/simple/utils/ElasticsearchUtil.java#L134-L142
apache/spark
common/network-common/src/main/java/org/apache/spark/network/TransportContext.java
TransportContext.initializePipeline
public TransportChannelHandler initializePipeline( SocketChannel channel, RpcHandler channelRpcHandler) { try { TransportChannelHandler channelHandler = createChannelHandler(channel, channelRpcHandler); ChunkFetchRequestHandler chunkFetchHandler = createChunkFetchHandler(channelHandler, channelRpcHandler); ChannelPipeline pipeline = channel.pipeline() .addLast("encoder", ENCODER) .addLast(TransportFrameDecoder.HANDLER_NAME, NettyUtils.createFrameDecoder()) .addLast("decoder", DECODER) .addLast("idleStateHandler", new IdleStateHandler(0, 0, conf.connectionTimeoutMs() / 1000)) // NOTE: Chunks are currently guaranteed to be returned in the order of request, but this // would require more logic to guarantee if this were not part of the same event loop. .addLast("handler", channelHandler); // Use a separate EventLoopGroup to handle ChunkFetchRequest messages for shuffle rpcs. if (chunkFetchWorkers != null) { pipeline.addLast(chunkFetchWorkers, "chunkFetchHandler", chunkFetchHandler); } return channelHandler; } catch (RuntimeException e) { logger.error("Error while initializing Netty pipeline", e); throw e; } }
java
public TransportChannelHandler initializePipeline( SocketChannel channel, RpcHandler channelRpcHandler) { try { TransportChannelHandler channelHandler = createChannelHandler(channel, channelRpcHandler); ChunkFetchRequestHandler chunkFetchHandler = createChunkFetchHandler(channelHandler, channelRpcHandler); ChannelPipeline pipeline = channel.pipeline() .addLast("encoder", ENCODER) .addLast(TransportFrameDecoder.HANDLER_NAME, NettyUtils.createFrameDecoder()) .addLast("decoder", DECODER) .addLast("idleStateHandler", new IdleStateHandler(0, 0, conf.connectionTimeoutMs() / 1000)) // NOTE: Chunks are currently guaranteed to be returned in the order of request, but this // would require more logic to guarantee if this were not part of the same event loop. .addLast("handler", channelHandler); // Use a separate EventLoopGroup to handle ChunkFetchRequest messages for shuffle rpcs. if (chunkFetchWorkers != null) { pipeline.addLast(chunkFetchWorkers, "chunkFetchHandler", chunkFetchHandler); } return channelHandler; } catch (RuntimeException e) { logger.error("Error while initializing Netty pipeline", e); throw e; } }
[ "public", "TransportChannelHandler", "initializePipeline", "(", "SocketChannel", "channel", ",", "RpcHandler", "channelRpcHandler", ")", "{", "try", "{", "TransportChannelHandler", "channelHandler", "=", "createChannelHandler", "(", "channel", ",", "channelRpcHandler", ")",...
Initializes a client or server Netty Channel Pipeline which encodes/decodes messages and has a {@link org.apache.spark.network.server.TransportChannelHandler} to handle request or response messages. @param channel The channel to initialize. @param channelRpcHandler The RPC handler to use for the channel. @return Returns the created TransportChannelHandler, which includes a TransportClient that can be used to communicate on this channel. The TransportClient is directly associated with a ChannelHandler to ensure all users of the same channel get the same TransportClient object.
[ "Initializes", "a", "client", "or", "server", "Netty", "Channel", "Pipeline", "which", "encodes", "/", "decodes", "messages", "and", "has", "a", "{", "@link", "org", ".", "apache", ".", "spark", ".", "network", ".", "server", ".", "TransportChannelHandler", ...
train
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/TransportContext.java#L185-L210
GoSimpleLLC/nbvcxz
src/main/java/me/gosimple/nbvcxz/Nbvcxz.java
Nbvcxz.calcEntropy
private double calcEntropy(final List<Match> matches, final boolean include_brute_force) { double entropy = 0; for (Match match : matches) { if (include_brute_force || !(match instanceof BruteForceMatch)) { entropy += match.calculateEntropy(); } } return entropy; }
java
private double calcEntropy(final List<Match> matches, final boolean include_brute_force) { double entropy = 0; for (Match match : matches) { if (include_brute_force || !(match instanceof BruteForceMatch)) { entropy += match.calculateEntropy(); } } return entropy; }
[ "private", "double", "calcEntropy", "(", "final", "List", "<", "Match", ">", "matches", ",", "final", "boolean", "include_brute_force", ")", "{", "double", "entropy", "=", "0", ";", "for", "(", "Match", "match", ":", "matches", ")", "{", "if", "(", "incl...
Helper method to calculate entropy from a list of matches. @param matches the list of matches @return the sum of the entropy in the list passed in
[ "Helper", "method", "to", "calculate", "entropy", "from", "a", "list", "of", "matches", "." ]
train
https://github.com/GoSimpleLLC/nbvcxz/blob/a86fb24680e646efdf78d6fda9d68a5410145f56/src/main/java/me/gosimple/nbvcxz/Nbvcxz.java#L531-L542
audit4j/audit4j-core
src/main/java/org/audit4j/core/extra/scannotation/ClasspathUrlFinder.java
ClasspathUrlFinder.findResourceBase
public static URL findResourceBase(String baseResource, ClassLoader loader) { URL url = loader.getResource(baseResource); return findResourceBase(url, baseResource); }
java
public static URL findResourceBase(String baseResource, ClassLoader loader) { URL url = loader.getResource(baseResource); return findResourceBase(url, baseResource); }
[ "public", "static", "URL", "findResourceBase", "(", "String", "baseResource", ",", "ClassLoader", "loader", ")", "{", "URL", "url", "=", "loader", ".", "getResource", "(", "baseResource", ")", ";", "return", "findResourceBase", "(", "url", ",", "baseResource", ...
Find the classpath URL for a specific classpath resource. The classpath URL is extracted from loader.getResource() using the baseResource. @param baseResource @param loader @return
[ "Find", "the", "classpath", "URL", "for", "a", "specific", "classpath", "resource", ".", "The", "classpath", "URL", "is", "extracted", "from", "loader", ".", "getResource", "()", "using", "the", "baseResource", "." ]
train
https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/extra/scannotation/ClasspathUrlFinder.java#L103-L107
jingwei/krati
krati-main/src/main/java/krati/core/StoreConfig.java
StoreConfig.getDouble
public double getDouble(String pName, double defaultValue) { String pValue = _properties.getProperty(pName); return parseDouble(pName, pValue, defaultValue); }
java
public double getDouble(String pName, double defaultValue) { String pValue = _properties.getProperty(pName); return parseDouble(pName, pValue, defaultValue); }
[ "public", "double", "getDouble", "(", "String", "pName", ",", "double", "defaultValue", ")", "{", "String", "pValue", "=", "_properties", ".", "getProperty", "(", "pName", ")", ";", "return", "parseDouble", "(", "pName", ",", "pValue", ",", "defaultValue", "...
Gets a double property via a string property name. @param pName - the property name @param defaultValue - the default property value @return a double property
[ "Gets", "a", "double", "property", "via", "a", "string", "property", "name", "." ]
train
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/StoreConfig.java#L447-L450
looly/hutool
hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java
IterUtil.toMap
public static <K, V> Map<K, V> toMap(Iterator<K> keys, Iterator<V> values) { return toMap(keys, values, false); }
java
public static <K, V> Map<K, V> toMap(Iterator<K> keys, Iterator<V> values) { return toMap(keys, values, false); }
[ "public", "static", "<", "K", ",", "V", ">", "Map", "<", "K", ",", "V", ">", "toMap", "(", "Iterator", "<", "K", ">", "keys", ",", "Iterator", "<", "V", ">", "values", ")", "{", "return", "toMap", "(", "keys", ",", "values", ",", "false", ")", ...
将键列表和值列表转换为Map<br> 以键为准,值与键位置需对应。如果键元素数多于值元素,多余部分值用null代替。<br> 如果值多于键,忽略多余的值。 @param <K> 键类型 @param <V> 值类型 @param keys 键列表 @param values 值列表 @return 标题内容Map @since 3.1.0
[ "将键列表和值列表转换为Map<br", ">", "以键为准,值与键位置需对应。如果键元素数多于值元素,多余部分值用null代替。<br", ">", "如果值多于键,忽略多余的值。" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java#L404-L406
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Domain.java
Domain.update
public static Domain update(final String id) throws AppPlatformException, ParseException, IOException, Exception { return update(id, null); }
java
public static Domain update(final String id) throws AppPlatformException, ParseException, IOException, Exception { return update(id, null); }
[ "public", "static", "Domain", "update", "(", "final", "String", "id", ")", "throws", "AppPlatformException", ",", "ParseException", ",", "IOException", ",", "Exception", "{", "return", "update", "(", "id", ",", "null", ")", ";", "}" ]
Convenience method to get information about a specific Domain. @param id the domain id. @return information about a specific Domain. @throws AppPlatformException API Exception @throws ParseException Error parsing data @throws IOException unexpected error @throws Exception error
[ "Convenience", "method", "to", "get", "information", "about", "a", "specific", "Domain", "." ]
train
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Domain.java#L167-L169
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java
XPathParser.Literal
protected void Literal() throws javax.xml.transform.TransformerException { int last = m_token.length() - 1; char c0 = m_tokenChar; char cX = m_token.charAt(last); if (((c0 == '\"') && (cX == '\"')) || ((c0 == '\'') && (cX == '\''))) { // Mutate the token to remove the quotes and have the XString object // already made. int tokenQueuePos = m_queueMark - 1; m_ops.m_tokenQueue.setElementAt(null,tokenQueuePos); Object obj = new XString(m_token.substring(1, last)); m_ops.m_tokenQueue.setElementAt(obj,tokenQueuePos); // lit = m_token.substring(1, last); m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), tokenQueuePos); m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1); nextToken(); } else { error(XPATHErrorResources.ER_PATTERN_LITERAL_NEEDS_BE_QUOTED, new Object[]{ m_token }); //"Pattern literal ("+m_token+") needs to be quoted!"); } }
java
protected void Literal() throws javax.xml.transform.TransformerException { int last = m_token.length() - 1; char c0 = m_tokenChar; char cX = m_token.charAt(last); if (((c0 == '\"') && (cX == '\"')) || ((c0 == '\'') && (cX == '\''))) { // Mutate the token to remove the quotes and have the XString object // already made. int tokenQueuePos = m_queueMark - 1; m_ops.m_tokenQueue.setElementAt(null,tokenQueuePos); Object obj = new XString(m_token.substring(1, last)); m_ops.m_tokenQueue.setElementAt(obj,tokenQueuePos); // lit = m_token.substring(1, last); m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), tokenQueuePos); m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1); nextToken(); } else { error(XPATHErrorResources.ER_PATTERN_LITERAL_NEEDS_BE_QUOTED, new Object[]{ m_token }); //"Pattern literal ("+m_token+") needs to be quoted!"); } }
[ "protected", "void", "Literal", "(", ")", "throws", "javax", ".", "xml", ".", "transform", ".", "TransformerException", "{", "int", "last", "=", "m_token", ".", "length", "(", ")", "-", "1", ";", "char", "c0", "=", "m_tokenChar", ";", "char", "cX", "="...
The value of the Literal is the sequence of characters inside the " or ' characters>. Literal ::= '"' [^"]* '"' | "'" [^']* "'" @throws javax.xml.transform.TransformerException
[ "The", "value", "of", "the", "Literal", "is", "the", "sequence", "of", "characters", "inside", "the", "or", "characters", ">", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java#L2017-L2048
jcuda/jcufft
JCufftJava/src/main/java/jcuda/jcufft/JCufft.java
JCufft.cufftExecR2C
public static int cufftExecR2C(cufftHandle plan, Pointer rIdata, Pointer cOdata) { return checkResult(cufftExecR2CNative(plan, rIdata, cOdata)); }
java
public static int cufftExecR2C(cufftHandle plan, Pointer rIdata, Pointer cOdata) { return checkResult(cufftExecR2CNative(plan, rIdata, cOdata)); }
[ "public", "static", "int", "cufftExecR2C", "(", "cufftHandle", "plan", ",", "Pointer", "rIdata", ",", "Pointer", "cOdata", ")", "{", "return", "checkResult", "(", "cufftExecR2CNative", "(", "plan", ",", "rIdata", ",", "cOdata", ")", ")", ";", "}" ]
<pre> Executes a CUFFT real-to-complex (implicitly forward) transform plan. cufftResult cufftExecR2C( cufftHandle plan, cufftReal *idata, cufftComplex *odata ); CUFFT uses as input data the GPU memory pointed to by the idata parameter. This function stores the non-redundant Fourier coefficients in the odata array. If idata and odata are the same, this method does an in-place transform (See CUFFT documentation for details on real data FFTs.) Input ---- plan The cufftHandle object for the plan to update idata Pointer to the input data (in GPU memory) to transform odata Pointer to the output data (in GPU memory) direction The transform direction: CUFFT_FORWARD or CUFFT_INVERSE Output ---- odata Contains the complex Fourier coefficients Return Values ---- CUFFT_SETUP_FAILED CUFFT library failed to initialize. CUFFT_INVALID_PLAN The plan parameter is not a valid handle. CUFFT_INVALID_VALUE The idata, odata, and/or direction parameter is not valid. CUFFT_EXEC_FAILED CUFFT failed to execute the transform on GPU. CUFFT_SUCCESS CUFFT successfully executed the FFT plan. JCUFFT_INTERNAL_ERROR If an internal JCufft error occurred <pre>
[ "<pre", ">", "Executes", "a", "CUFFT", "real", "-", "to", "-", "complex", "(", "implicitly", "forward", ")", "transform", "plan", "." ]
train
https://github.com/jcuda/jcufft/blob/833c87ffb0864f7ee7270fddef8af57f48939b3a/JCufftJava/src/main/java/jcuda/jcufft/JCufft.java#L952-L955
javagl/CommonUI
src/main/java/de/javagl/common/ui/tree/checkbox/CheckBoxTree.java
CheckBoxTree.fireStateChanged
private void fireStateChanged(Object node, State oldState, State newState) { for (StateListener stateListener : stateListeners) { stateListener.stateChanged(node, oldState, newState); } }
java
private void fireStateChanged(Object node, State oldState, State newState) { for (StateListener stateListener : stateListeners) { stateListener.stateChanged(node, oldState, newState); } }
[ "private", "void", "fireStateChanged", "(", "Object", "node", ",", "State", "oldState", ",", "State", "newState", ")", "{", "for", "(", "StateListener", "stateListener", ":", "stateListeners", ")", "{", "stateListener", ".", "stateChanged", "(", "node", ",", "...
Notify all {@link StateListener}s about a {@link State} change @param node The node whose state changed @param oldState The old state @param newState The new state
[ "Notify", "all", "{", "@link", "StateListener", "}", "s", "about", "a", "{", "@link", "State", "}", "change" ]
train
https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/tree/checkbox/CheckBoxTree.java#L185-L191
andkulikov/Transitions-Everywhere
library(1.x)/src/main/java/com/transitionseverywhere/TransitionManager.java
TransitionManager.setTransitionName
public static void setTransitionName(@NonNull View v, @Nullable String transitionName) { ViewUtils.setTransitionName(v, transitionName); }
java
public static void setTransitionName(@NonNull View v, @Nullable String transitionName) { ViewUtils.setTransitionName(v, transitionName); }
[ "public", "static", "void", "setTransitionName", "(", "@", "NonNull", "View", "v", ",", "@", "Nullable", "String", "transitionName", ")", "{", "ViewUtils", ".", "setTransitionName", "(", "v", ",", "transitionName", ")", ";", "}" ]
Sets the name of the View to be used to identify Views in Transitions. Names should be unique in the View hierarchy. @param transitionName The name of the View to uniquely identify it for Transitions.
[ "Sets", "the", "name", "of", "the", "View", "to", "be", "used", "to", "identify", "Views", "in", "Transitions", ".", "Names", "should", "be", "unique", "in", "the", "View", "hierarchy", "." ]
train
https://github.com/andkulikov/Transitions-Everywhere/blob/828efe5f152a2f05e2bfeee6254b74ad2269d4f1/library(1.x)/src/main/java/com/transitionseverywhere/TransitionManager.java#L481-L483
apereo/cas
support/cas-server-support-ws-idp/src/main/java/org/apereo/cas/ws/idp/web/WSFederationValidateRequestController.java
WSFederationValidateRequestController.handleFederationRequest
@GetMapping(path = WSFederationConstants.ENDPOINT_FEDERATION_REQUEST) protected void handleFederationRequest(final HttpServletResponse response, final HttpServletRequest request) throws Exception { val fedRequest = WSFederationRequest.of(request); val wa = fedRequest.getWa(); if (StringUtils.isBlank(wa)) { throw new UnauthorizedAuthenticationException("Unable to determine the [WA] parameter", new HashMap<>(0)); } switch (wa.toLowerCase()) { case WSFederationConstants.WSIGNOUT10: case WSFederationConstants.WSIGNOUT_CLEANUP10: handleLogoutRequest(fedRequest, request, response); break; case WSFederationConstants.WSIGNIN10: val targetService = getWsFederationRequestConfigurationContext().getWebApplicationServiceFactory().createService(fedRequest.getWreply()); handleInitialAuthenticationRequest(fedRequest, targetService, response, request); break; default: throw new UnauthorizedAuthenticationException("The authentication request is not recognized", new HashMap<>(0)); } }
java
@GetMapping(path = WSFederationConstants.ENDPOINT_FEDERATION_REQUEST) protected void handleFederationRequest(final HttpServletResponse response, final HttpServletRequest request) throws Exception { val fedRequest = WSFederationRequest.of(request); val wa = fedRequest.getWa(); if (StringUtils.isBlank(wa)) { throw new UnauthorizedAuthenticationException("Unable to determine the [WA] parameter", new HashMap<>(0)); } switch (wa.toLowerCase()) { case WSFederationConstants.WSIGNOUT10: case WSFederationConstants.WSIGNOUT_CLEANUP10: handleLogoutRequest(fedRequest, request, response); break; case WSFederationConstants.WSIGNIN10: val targetService = getWsFederationRequestConfigurationContext().getWebApplicationServiceFactory().createService(fedRequest.getWreply()); handleInitialAuthenticationRequest(fedRequest, targetService, response, request); break; default: throw new UnauthorizedAuthenticationException("The authentication request is not recognized", new HashMap<>(0)); } }
[ "@", "GetMapping", "(", "path", "=", "WSFederationConstants", ".", "ENDPOINT_FEDERATION_REQUEST", ")", "protected", "void", "handleFederationRequest", "(", "final", "HttpServletResponse", "response", ",", "final", "HttpServletRequest", "request", ")", "throws", "Exception...
Handle federation request. @param response the response @param request the request @throws Exception the exception
[ "Handle", "federation", "request", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-ws-idp/src/main/java/org/apereo/cas/ws/idp/web/WSFederationValidateRequestController.java#L41-L61
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UniversalTimeScale.java
UniversalTimeScale.toLong
public static long toLong(long universalTime, int timeScale) { TimeScaleData data = toRangeCheck(universalTime, timeScale); if (universalTime < 0) { if (universalTime < data.minRound) { return (universalTime + data.unitsRound) / data.units - data.epochOffsetP1; } return (universalTime - data.unitsRound) / data.units - data.epochOffset; } if (universalTime > data.maxRound) { return (universalTime - data.unitsRound) / data.units - data.epochOffsetM1; } return (universalTime + data.unitsRound) / data.units - data.epochOffset; }
java
public static long toLong(long universalTime, int timeScale) { TimeScaleData data = toRangeCheck(universalTime, timeScale); if (universalTime < 0) { if (universalTime < data.minRound) { return (universalTime + data.unitsRound) / data.units - data.epochOffsetP1; } return (universalTime - data.unitsRound) / data.units - data.epochOffset; } if (universalTime > data.maxRound) { return (universalTime - data.unitsRound) / data.units - data.epochOffsetM1; } return (universalTime + data.unitsRound) / data.units - data.epochOffset; }
[ "public", "static", "long", "toLong", "(", "long", "universalTime", ",", "int", "timeScale", ")", "{", "TimeScaleData", "data", "=", "toRangeCheck", "(", "universalTime", ",", "timeScale", ")", ";", "if", "(", "universalTime", "<", "0", ")", "{", "if", "("...
Convert a datetime from the universal time scale stored as a <code>BigDecimal</code> to a <code>long</code> in the given time scale. Since this calculation requires a divide, we must round. The straight forward way to round by adding half of the divisor will push the sum out of range for values within have the divisor of the limits of the precision of a <code>long</code>. To get around this, we do the rounding like this: <p><code> (universalTime - units + units/2) / units + 1 </code> <p> (i.e. we subtract units first to guarantee that we'll still be in range when we add <code>units/2</code>. We then need to add one to the quotent to make up for the extra subtraction. This simplifies to: <p><code> (universalTime - units/2) / units - 1 </code> <p> For negative values to round away from zero, we need to flip the signs: <p><code> (universalTime + units/2) / units + 1 </code> <p> Since we also need to subtract the epochOffset, we fold the <code>+/- 1</code> into the offset value. (i.e. <code>epochOffsetP1</code>, <code>epochOffsetM1</code>.) @param universalTime The datetime in the universal time scale @param timeScale The time scale to convert to @return The datetime converted to the given time scale
[ "Convert", "a", "datetime", "from", "the", "universal", "time", "scale", "stored", "as", "a", "<code", ">", "BigDecimal<", "/", "code", ">", "to", "a", "<code", ">", "long<", "/", "code", ">", "in", "the", "given", "time", "scale", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UniversalTimeScale.java#L440-L457
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java
CalendarCodeGenerator.addPattern
private void addPattern(MethodSpec.Builder method, String pattern) { // Parse the pattern and populate the method body with instructions to format the date. for (Node node : DATETIME_PARSER.parse(pattern)) { if (node instanceof Text) { method.addStatement("b.append($S)", ((Text)node).text()); } else if (node instanceof Field) { Field field = (Field)node; method.addStatement("formatField(d, '$L', $L, b)", field.ch(), field.width()); } } }
java
private void addPattern(MethodSpec.Builder method, String pattern) { // Parse the pattern and populate the method body with instructions to format the date. for (Node node : DATETIME_PARSER.parse(pattern)) { if (node instanceof Text) { method.addStatement("b.append($S)", ((Text)node).text()); } else if (node instanceof Field) { Field field = (Field)node; method.addStatement("formatField(d, '$L', $L, b)", field.ch(), field.width()); } } }
[ "private", "void", "addPattern", "(", "MethodSpec", ".", "Builder", "method", ",", "String", "pattern", ")", "{", "// Parse the pattern and populate the method body with instructions to format the date.", "for", "(", "Node", "node", ":", "DATETIME_PARSER", ".", "parse", "...
Add a named date-time pattern, adding statements to the formatting and indexing methods. Returns true if the pattern corresponds to a date; false if a time.
[ "Add", "a", "named", "date", "-", "time", "pattern", "adding", "statements", "to", "the", "formatting", "and", "indexing", "methods", ".", "Returns", "true", "if", "the", "pattern", "corresponds", "to", "a", "date", ";", "false", "if", "a", "time", "." ]
train
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java#L297-L307
OpenLiberty/open-liberty
dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseTraceService.java
BaseTraceService.updateConduitSyncHandlerConnection
private void updateConduitSyncHandlerConnection(List<String> sourceList, SynchronousHandler handler) { if (sourceList.contains("message")) { logConduit.addSyncHandler(handler); } else { logConduit.removeSyncHandler(handler); } if (sourceList.contains("trace")) { traceConduit.addSyncHandler(handler); } else { traceConduit.removeSyncHandler(handler); } }
java
private void updateConduitSyncHandlerConnection(List<String> sourceList, SynchronousHandler handler) { if (sourceList.contains("message")) { logConduit.addSyncHandler(handler); } else { logConduit.removeSyncHandler(handler); } if (sourceList.contains("trace")) { traceConduit.addSyncHandler(handler); } else { traceConduit.removeSyncHandler(handler); } }
[ "private", "void", "updateConduitSyncHandlerConnection", "(", "List", "<", "String", ">", "sourceList", ",", "SynchronousHandler", "handler", ")", "{", "if", "(", "sourceList", ".", "contains", "(", "\"message\"", ")", ")", "{", "logConduit", ".", "addSyncHandler"...
/* Based on config (sourceList), need to connect the synchronized handler to configured source/conduit.. Or disconnect it.
[ "/", "*", "Based", "on", "config", "(", "sourceList", ")", "need", "to", "connect", "the", "synchronized", "handler", "to", "configured", "source", "/", "conduit", "..", "Or", "disconnect", "it", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseTraceService.java#L1375-L1387
JM-Lab/utils-java8
src/main/java/kr/jm/utils/helper/JMResources.java
JMResources.setSystemPropertyIfIsNull
public static void setSystemPropertyIfIsNull(String key, Object value) { if (!System.getProperties().containsKey(key)) System.setProperty(key, value.toString()); }
java
public static void setSystemPropertyIfIsNull(String key, Object value) { if (!System.getProperties().containsKey(key)) System.setProperty(key, value.toString()); }
[ "public", "static", "void", "setSystemPropertyIfIsNull", "(", "String", "key", ",", "Object", "value", ")", "{", "if", "(", "!", "System", ".", "getProperties", "(", ")", ".", "containsKey", "(", "key", ")", ")", "System", ".", "setProperty", "(", "key", ...
Sets system property if is null. @param key the key @param value the value
[ "Sets", "system", "property", "if", "is", "null", "." ]
train
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMResources.java#L31-L34
inkstand-io/scribble
scribble-ldap/src/main/java/io/inkstand/scribble/rules/ldap/Directory.java
Directory.importLdif
public void importLdif(InputStream ldifData) throws IOException { final File ldifFile = getOuterRule().newFile("scribble_import.ldif"); try (final Writer writer = new OutputStreamWriter(new FileOutputStream(ldifFile), Charsets.UTF_8)) { IOUtils.copy(ldifData, writer); } final String pathToLdifFile = ldifFile.getAbsolutePath(); final CoreSession session = this.getDirectoryService().getAdminSession(); final LdifFileLoader loader = new LdifFileLoader(session, pathToLdifFile); loader.execute(); }
java
public void importLdif(InputStream ldifData) throws IOException { final File ldifFile = getOuterRule().newFile("scribble_import.ldif"); try (final Writer writer = new OutputStreamWriter(new FileOutputStream(ldifFile), Charsets.UTF_8)) { IOUtils.copy(ldifData, writer); } final String pathToLdifFile = ldifFile.getAbsolutePath(); final CoreSession session = this.getDirectoryService().getAdminSession(); final LdifFileLoader loader = new LdifFileLoader(session, pathToLdifFile); loader.execute(); }
[ "public", "void", "importLdif", "(", "InputStream", "ldifData", ")", "throws", "IOException", "{", "final", "File", "ldifFile", "=", "getOuterRule", "(", ")", ".", "newFile", "(", "\"scribble_import.ldif\"", ")", ";", "try", "(", "final", "Writer", "writer", "...
Imports directory content that is defined in LDIF format and provided as input stream. The method writes the stream content into a temporary file. @param ldifData the ldif data to import as a stream @throws IOException if the temporary file can not be created
[ "Imports", "directory", "content", "that", "is", "defined", "in", "LDIF", "format", "and", "provided", "as", "input", "stream", ".", "The", "method", "writes", "the", "stream", "content", "into", "a", "temporary", "file", "." ]
train
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-ldap/src/main/java/io/inkstand/scribble/rules/ldap/Directory.java#L324-L336
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.getAnnotations
private List<Content> getAnnotations(int indent, List<? extends AnnotationMirror> descList, boolean linkBreak) { return getAnnotations(indent, descList, linkBreak, true); }
java
private List<Content> getAnnotations(int indent, List<? extends AnnotationMirror> descList, boolean linkBreak) { return getAnnotations(indent, descList, linkBreak, true); }
[ "private", "List", "<", "Content", ">", "getAnnotations", "(", "int", "indent", ",", "List", "<", "?", "extends", "AnnotationMirror", ">", "descList", ",", "boolean", "linkBreak", ")", "{", "return", "getAnnotations", "(", "indent", ",", "descList", ",", "li...
Return the string representations of the annotation types for the given doc. @param indent the number of extra spaces to indent the annotations. @param descList the array of {@link AnnotationDesc}. @param linkBreak if true, add new line between each member value. @return an array of strings representing the annotations being documented.
[ "Return", "the", "string", "representations", "of", "the", "annotation", "types", "for", "the", "given", "doc", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L2309-L2311
HanSolo/SteelSeries-Swing
src/main/java/eu/hansolo/steelseries/gauges/SparkLine.java
SparkLine.create_HI_INDICATOR_Image
private BufferedImage create_HI_INDICATOR_Image(final int WIDTH) { if (WIDTH <= 0) { return null; } // Define the size of the indicator int indicatorSize = (int) (0.015 * WIDTH); if (indicatorSize < 4) { indicatorSize = 4; } if (indicatorSize > 8) { indicatorSize = 8; } final BufferedImage IMAGE = UTIL.createImage(indicatorSize, indicatorSize, Transparency.TRANSLUCENT); final Graphics2D G2 = IMAGE.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); G2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); G2.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); final int IMAGE_WIDTH = IMAGE.getWidth(); final int IMAGE_HEIGHT = IMAGE.getHeight(); final GeneralPath THRESHOLD_TRIANGLE = new GeneralPath(); THRESHOLD_TRIANGLE.setWindingRule(Path2D.WIND_EVEN_ODD); THRESHOLD_TRIANGLE.moveTo(IMAGE_WIDTH * 0.5, 0); THRESHOLD_TRIANGLE.lineTo(0, IMAGE_HEIGHT); THRESHOLD_TRIANGLE.lineTo(IMAGE_WIDTH, IMAGE_HEIGHT); THRESHOLD_TRIANGLE.lineTo(IMAGE_WIDTH * 0.5, 0); THRESHOLD_TRIANGLE.closePath(); final Point2D THRESHOLD_TRIANGLE_START = new Point2D.Double(0, THRESHOLD_TRIANGLE.getBounds2D().getMinY()); final Point2D THRESHOLD_TRIANGLE_STOP = new Point2D.Double(0, THRESHOLD_TRIANGLE.getBounds2D().getMaxY()); final float[] THRESHOLD_TRIANGLE_FRACTIONS = { 0.0f, 0.3f, 0.59f, 1.0f }; final Color[] THRESHOLD_TRIANGLE_COLORS = { new Color(82, 0, 0, 255), new Color(252, 29, 0, 255), new Color(252, 29, 0, 255), new Color(82, 0, 0, 255) }; final LinearGradientPaint THRESHOLD_TRIANGLE_GRADIENT = new LinearGradientPaint(THRESHOLD_TRIANGLE_START, THRESHOLD_TRIANGLE_STOP, THRESHOLD_TRIANGLE_FRACTIONS, THRESHOLD_TRIANGLE_COLORS); G2.setPaint(THRESHOLD_TRIANGLE_GRADIENT); G2.fill(THRESHOLD_TRIANGLE); G2.setColor(Color.RED); G2.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); G2.draw(THRESHOLD_TRIANGLE); G2.dispose(); return IMAGE; }
java
private BufferedImage create_HI_INDICATOR_Image(final int WIDTH) { if (WIDTH <= 0) { return null; } // Define the size of the indicator int indicatorSize = (int) (0.015 * WIDTH); if (indicatorSize < 4) { indicatorSize = 4; } if (indicatorSize > 8) { indicatorSize = 8; } final BufferedImage IMAGE = UTIL.createImage(indicatorSize, indicatorSize, Transparency.TRANSLUCENT); final Graphics2D G2 = IMAGE.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); G2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); G2.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); final int IMAGE_WIDTH = IMAGE.getWidth(); final int IMAGE_HEIGHT = IMAGE.getHeight(); final GeneralPath THRESHOLD_TRIANGLE = new GeneralPath(); THRESHOLD_TRIANGLE.setWindingRule(Path2D.WIND_EVEN_ODD); THRESHOLD_TRIANGLE.moveTo(IMAGE_WIDTH * 0.5, 0); THRESHOLD_TRIANGLE.lineTo(0, IMAGE_HEIGHT); THRESHOLD_TRIANGLE.lineTo(IMAGE_WIDTH, IMAGE_HEIGHT); THRESHOLD_TRIANGLE.lineTo(IMAGE_WIDTH * 0.5, 0); THRESHOLD_TRIANGLE.closePath(); final Point2D THRESHOLD_TRIANGLE_START = new Point2D.Double(0, THRESHOLD_TRIANGLE.getBounds2D().getMinY()); final Point2D THRESHOLD_TRIANGLE_STOP = new Point2D.Double(0, THRESHOLD_TRIANGLE.getBounds2D().getMaxY()); final float[] THRESHOLD_TRIANGLE_FRACTIONS = { 0.0f, 0.3f, 0.59f, 1.0f }; final Color[] THRESHOLD_TRIANGLE_COLORS = { new Color(82, 0, 0, 255), new Color(252, 29, 0, 255), new Color(252, 29, 0, 255), new Color(82, 0, 0, 255) }; final LinearGradientPaint THRESHOLD_TRIANGLE_GRADIENT = new LinearGradientPaint(THRESHOLD_TRIANGLE_START, THRESHOLD_TRIANGLE_STOP, THRESHOLD_TRIANGLE_FRACTIONS, THRESHOLD_TRIANGLE_COLORS); G2.setPaint(THRESHOLD_TRIANGLE_GRADIENT); G2.fill(THRESHOLD_TRIANGLE); G2.setColor(Color.RED); G2.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); G2.draw(THRESHOLD_TRIANGLE); G2.dispose(); return IMAGE; }
[ "private", "BufferedImage", "create_HI_INDICATOR_Image", "(", "final", "int", "WIDTH", ")", "{", "if", "(", "WIDTH", "<=", "0", ")", "{", "return", "null", ";", "}", "// Define the size of the indicator", "int", "indicatorSize", "=", "(", "int", ")", "(", "0.0...
Returns a buffered image that contains the hi value indicator @param WIDTH @return a buffered image that contains the hi value indicator
[ "Returns", "a", "buffered", "image", "that", "contains", "the", "hi", "value", "indicator" ]
train
https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/gauges/SparkLine.java#L1447-L1505
Stratio/bdt
src/main/java/com/stratio/qa/specs/MiscSpec.java
MiscSpec.assertExceptionNotThrown
@Then("^an exception '(.+?)' thrown( with class '(.+?)'( and message like '(.+?)')?)?") public void assertExceptionNotThrown(String exception, String foo, String clazz, String bar, String exceptionMsg) throws ClassNotFoundException { List<Exception> exceptions = commonspec.getExceptions(); if ("IS NOT".equals(exception)) { assertThat(exceptions).as("Captured exception list is not empty").isEmpty(); } else { assertThat(exceptions).as("Captured exception list is empty").isNotEmpty(); Exception ex = exceptions.get(exceptions.size() - 1); if ((clazz != null) && (exceptionMsg != null)) { assertThat(ex.toString()).as("Unexpected last exception class").contains(clazz); assertThat(ex.toString()).as("Unexpected last exception message").contains(exceptionMsg); } else if (clazz != null) { assertThat(exceptions.get(exceptions.size() - 1).getClass().getSimpleName()).as("Unexpected last exception class").isEqualTo(clazz); } commonspec.getExceptions().clear(); } }
java
@Then("^an exception '(.+?)' thrown( with class '(.+?)'( and message like '(.+?)')?)?") public void assertExceptionNotThrown(String exception, String foo, String clazz, String bar, String exceptionMsg) throws ClassNotFoundException { List<Exception> exceptions = commonspec.getExceptions(); if ("IS NOT".equals(exception)) { assertThat(exceptions).as("Captured exception list is not empty").isEmpty(); } else { assertThat(exceptions).as("Captured exception list is empty").isNotEmpty(); Exception ex = exceptions.get(exceptions.size() - 1); if ((clazz != null) && (exceptionMsg != null)) { assertThat(ex.toString()).as("Unexpected last exception class").contains(clazz); assertThat(ex.toString()).as("Unexpected last exception message").contains(exceptionMsg); } else if (clazz != null) { assertThat(exceptions.get(exceptions.size() - 1).getClass().getSimpleName()).as("Unexpected last exception class").isEqualTo(clazz); } commonspec.getExceptions().clear(); } }
[ "@", "Then", "(", "\"^an exception '(.+?)' thrown( with class '(.+?)'( and message like '(.+?)')?)?\"", ")", "public", "void", "assertExceptionNotThrown", "(", "String", "exception", ",", "String", "foo", ",", "String", "clazz", ",", "String", "bar", ",", "String", "excep...
Checks if an exception has been thrown. @param exception : "IS NOT" | "IS" @param foo @param clazz @param bar @param exceptionMsg
[ "Checks", "if", "an", "exception", "has", "been", "thrown", "." ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/MiscSpec.java#L176-L195
hawkular/hawkular-apm
server/api/src/main/java/org/hawkular/apm/server/api/utils/SourceInfoUtil.java
SourceInfoUtil.findRootOrServerSpan
protected static Span findRootOrServerSpan(String tenantId, Span span, SpanCache spanCache) { while (span != null && !span.serverSpan() && !span.topLevelSpan()) { span = spanCache.get(tenantId, span.getParentId()); } return span; }
java
protected static Span findRootOrServerSpan(String tenantId, Span span, SpanCache spanCache) { while (span != null && !span.serverSpan() && !span.topLevelSpan()) { span = spanCache.get(tenantId, span.getParentId()); } return span; }
[ "protected", "static", "Span", "findRootOrServerSpan", "(", "String", "tenantId", ",", "Span", "span", ",", "SpanCache", "spanCache", ")", "{", "while", "(", "span", "!=", "null", "&&", "!", "span", ".", "serverSpan", "(", ")", "&&", "!", "span", ".", "t...
This method identifies the root or enclosing server span that contains the supplied client span. @param tenantId The tenant id @param span The client span @param spanCache The span cache @return The root or enclosing server span, or null if not found
[ "This", "method", "identifies", "the", "root", "or", "enclosing", "server", "span", "that", "contains", "the", "supplied", "client", "span", "." ]
train
https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/server/api/src/main/java/org/hawkular/apm/server/api/utils/SourceInfoUtil.java#L180-L186
OpenNTF/JavascriptAggregator
jaggr-core/src/main/java/com/ibm/jaggr/core/util/ZipUtil.java
ZipUtil.extractDirectory
private static void extractDirectory(ZipEntry entry, File dir) throws IOException { final String sourceMethod = "extractFile"; //$NON-NLS-1$ final boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(sourceClass, sourceMethod, new Object[]{entry, dir}); } dir.mkdir(); // May fail if the directory has already been created if (!dir.setLastModified(entry.getTime())) { throw new IOException("Failed to set last modified time for " + dir.getAbsolutePath()); //$NON-NLS-1$ } if (isTraceLogging) { log.exiting(sourceClass, sourceMethod); } }
java
private static void extractDirectory(ZipEntry entry, File dir) throws IOException { final String sourceMethod = "extractFile"; //$NON-NLS-1$ final boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(sourceClass, sourceMethod, new Object[]{entry, dir}); } dir.mkdir(); // May fail if the directory has already been created if (!dir.setLastModified(entry.getTime())) { throw new IOException("Failed to set last modified time for " + dir.getAbsolutePath()); //$NON-NLS-1$ } if (isTraceLogging) { log.exiting(sourceClass, sourceMethod); } }
[ "private", "static", "void", "extractDirectory", "(", "ZipEntry", "entry", ",", "File", "dir", ")", "throws", "IOException", "{", "final", "String", "sourceMethod", "=", "\"extractFile\"", ";", "//$NON-NLS-1$\r", "final", "boolean", "isTraceLogging", "=", "log", "...
Extracts the directory entry to the location specified by {@code dir} @param entry the {@link ZipEntry} object for the directory being extracted @param dir the {@link File} object for the target directory @throws IOException
[ "Extracts", "the", "directory", "entry", "to", "the", "location", "specified", "by", "{", "@code", "dir", "}" ]
train
https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/util/ZipUtil.java#L158-L173
alkacon/opencms-core
src-gwt/org/opencms/acacia/client/export/CmsEntityWrapper.java
CmsEntityWrapper.insertAttributeValueString
public void insertAttributeValueString(String attributeName, String value, int index) { m_entity.insertAttributeValue(attributeName, value, index); }
java
public void insertAttributeValueString(String attributeName, String value, int index) { m_entity.insertAttributeValue(attributeName, value, index); }
[ "public", "void", "insertAttributeValueString", "(", "String", "attributeName", ",", "String", "value", ",", "int", "index", ")", "{", "m_entity", ".", "insertAttributeValue", "(", "attributeName", ",", "value", ",", "index", ")", ";", "}" ]
Wrapper method.<p> @param attributeName parameter for the wrapped method @param value parameter for the wrapped method @param index parameter for the wrapped method
[ "Wrapper", "method", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/export/CmsEntityWrapper.java#L166-L169
line/armeria
core/src/main/java/com/linecorp/armeria/common/metric/MeterIdPrefix.java
MeterIdPrefix.appendWithTags
public MeterIdPrefix appendWithTags(String suffix, Iterable<Tag> tags) { return new MeterIdPrefix(name(suffix), sortedImmutableTags(tags)); }
java
public MeterIdPrefix appendWithTags(String suffix, Iterable<Tag> tags) { return new MeterIdPrefix(name(suffix), sortedImmutableTags(tags)); }
[ "public", "MeterIdPrefix", "appendWithTags", "(", "String", "suffix", ",", "Iterable", "<", "Tag", ">", "tags", ")", "{", "return", "new", "MeterIdPrefix", "(", "name", "(", "suffix", ")", ",", "sortedImmutableTags", "(", "tags", ")", ")", ";", "}" ]
Returns a newly-created instance whose name is concatenated by the specified {@code suffix} and {@code tags}.
[ "Returns", "a", "newly", "-", "created", "instance", "whose", "name", "is", "concatenated", "by", "the", "specified", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/common/metric/MeterIdPrefix.java#L183-L185
codecentric/zucchini
zucchini-bdd/src/main/java/de/codecentric/zucchini/bdd/util/Assert.java
Assert.assertIdentity
@SuppressWarnings("WeakerAccess") public static void assertIdentity(String message, Object expected, Object actual) { if (expected != actual) { fail(message); } }
java
@SuppressWarnings("WeakerAccess") public static void assertIdentity(String message, Object expected, Object actual) { if (expected != actual) { fail(message); } }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "static", "void", "assertIdentity", "(", "String", "message", ",", "Object", "expected", ",", "Object", "actual", ")", "{", "if", "(", "expected", "!=", "actual", ")", "{", "fail", "(", "messag...
Asserts that two objects have the same identity, i.e. {@code expected == actual}, and fails otherwise. @param message The message of the thrown {@link java.lang.AssertionError}. @param expected The expected object. @param actual The actual object.
[ "Asserts", "that", "two", "objects", "have", "the", "same", "identity", "i", ".", "e", ".", "{", "@code", "expected", "==", "actual", "}", "and", "fails", "otherwise", "." ]
train
https://github.com/codecentric/zucchini/blob/61541cd8ce666ef21ad943486a7c0eb53310ed5a/zucchini-bdd/src/main/java/de/codecentric/zucchini/bdd/util/Assert.java#L76-L81
jOOQ/jOOL
jOOL-java-8/src/main/java/org/jooq/lambda/Agg.java
Agg.maxAll
public static <T, U extends Comparable<? super U>> Collector<T, ?, Seq<U>> maxAll(Function<? super T, ? extends U> function) { return maxAll(function, naturalOrder()); }
java
public static <T, U extends Comparable<? super U>> Collector<T, ?, Seq<U>> maxAll(Function<? super T, ? extends U> function) { return maxAll(function, naturalOrder()); }
[ "public", "static", "<", "T", ",", "U", "extends", "Comparable", "<", "?", "super", "U", ">", ">", "Collector", "<", "T", ",", "?", ",", "Seq", "<", "U", ">", ">", "maxAll", "(", "Function", "<", "?", "super", "T", ",", "?", "extends", "U", ">"...
Get a {@link Collector} that calculates the <code>MAX()</code> function, producing multiple results.
[ "Get", "a", "{" ]
train
https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Agg.java#L343-L345
igniterealtime/Smack
smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java
AgentSession.sendRoomTransfer
public void sendRoomTransfer(RoomTransfer.Type type, String invitee, String sessionID, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { final RoomTransfer transfer = new RoomTransfer(type, invitee, sessionID, reason); IQ iq = new RoomTransfer.RoomTransferIQ(transfer); iq.setType(IQ.Type.set); iq.setTo(workgroupJID); iq.setFrom(connection.getUser()); connection.createStanzaCollectorAndSend(iq).nextResultOrThrow(); }
java
public void sendRoomTransfer(RoomTransfer.Type type, String invitee, String sessionID, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { final RoomTransfer transfer = new RoomTransfer(type, invitee, sessionID, reason); IQ iq = new RoomTransfer.RoomTransferIQ(transfer); iq.setType(IQ.Type.set); iq.setTo(workgroupJID); iq.setFrom(connection.getUser()); connection.createStanzaCollectorAndSend(iq).nextResultOrThrow(); }
[ "public", "void", "sendRoomTransfer", "(", "RoomTransfer", ".", "Type", "type", ",", "String", "invitee", ",", "String", "sessionID", ",", "String", "reason", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "Interr...
Transfer an existing session support to another user or agent. The provided invitee's JID can be of a user, an agent, a queue or a workgroup. In the case of a queue or a workgroup the workgroup service will decide the best agent to receive the invitation.<p> This method will return either when the service returned an ACK of the request or if an error occurred while requesting the transfer. After sending the ACK the service will send the invitation to the target entity. When dealing with agents the common sequence of offer-response will be followed. However, when sending an invitation to a user a standard MUC invitation will be sent.<p> Once the invitee joins the support room the workgroup service will kick the inviter from the room.<p> Different situations may lead to a failed transfers. Possible cases are: 1) all agents rejected the offer and there are no agents available, 2) the agent that accepted the offer failed to join the room or 2) the user that received the MUC invitation never replied or joined the room. In any of these cases (or other failing cases) the inviter will get an error message with the failed notification. @param type type of entity that will get the invitation. @param invitee JID of entity that will get the invitation. @param sessionID ID of the support session that the invitee is being invited. @param reason the reason of the invitation. @throws XMPPErrorException if the sender of the invitation is not an agent or the service failed to process the request. @throws NoResponseException @throws NotConnectedException @throws InterruptedException
[ "Transfer", "an", "existing", "session", "support", "to", "another", "user", "or", "agent", ".", "The", "provided", "invitee", "s", "JID", "can", "be", "of", "a", "user", "an", "agent", "a", "queue", "or", "a", "workgroup", ".", "In", "the", "case", "o...
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java#L1057-L1065
geomajas/geomajas-project-client-gwt2
plugin/wms/server-extension/src/main/java/org/geomajas/gwt2/plugin/wms/client/WmsServerExtension.java
WmsServerExtension.createLayer
public FeatureInfoSupportedWmsServerLayer createLayer(String title, String crs, TileConfiguration tileConfig, WmsLayerConfiguration layerConfig, WmsLayerInfo layerInfo) { return new FeatureInfoSupportedWmsServerLayer(title, crs, layerConfig, tileConfig, layerInfo); }
java
public FeatureInfoSupportedWmsServerLayer createLayer(String title, String crs, TileConfiguration tileConfig, WmsLayerConfiguration layerConfig, WmsLayerInfo layerInfo) { return new FeatureInfoSupportedWmsServerLayer(title, crs, layerConfig, tileConfig, layerInfo); }
[ "public", "FeatureInfoSupportedWmsServerLayer", "createLayer", "(", "String", "title", ",", "String", "crs", ",", "TileConfiguration", "tileConfig", ",", "WmsLayerConfiguration", "layerConfig", ",", "WmsLayerInfo", "layerInfo", ")", "{", "return", "new", "FeatureInfoSuppo...
Create a new WMS layer. This layer extends the default {@link org.geomajas.gwt2.plugin.wms.client.layer.WmsLayer} by supporting GetFeatureInfo calls. @param title The layer title. @param crs The CRS for this layer. @param tileConfig The tile configuration object. @param layerConfig The layer configuration object. @param layerInfo The layer info object. Acquired from a WMS GetCapabilities. This is optional. @return A new WMS layer.
[ "Create", "a", "new", "WMS", "layer", ".", "This", "layer", "extends", "the", "default", "{", "@link", "org", ".", "geomajas", ".", "gwt2", ".", "plugin", ".", "wms", ".", "client", ".", "layer", ".", "WmsLayer", "}", "by", "supporting", "GetFeatureInfo"...
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/wms/server-extension/src/main/java/org/geomajas/gwt2/plugin/wms/client/WmsServerExtension.java#L156-L159
comapi/comapi-sdk-android
COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java
InternalService.removeParticipants
public void removeParticipants(@NonNull final String conversationId, @NonNull final List<String> ids, @Nullable Callback<ComapiResult<Void>> callback) { adapter.adapt(removeParticipants(conversationId, ids), callback); }
java
public void removeParticipants(@NonNull final String conversationId, @NonNull final List<String> ids, @Nullable Callback<ComapiResult<Void>> callback) { adapter.adapt(removeParticipants(conversationId, ids), callback); }
[ "public", "void", "removeParticipants", "(", "@", "NonNull", "final", "String", "conversationId", ",", "@", "NonNull", "final", "List", "<", "String", ">", "ids", ",", "@", "Nullable", "Callback", "<", "ComapiResult", "<", "Void", ">", ">", "callback", ")", ...
Returns observable to remove list of participants from a conversation. @param conversationId ID of a conversation to delete. @param ids List of participant ids to be removed. @param callback Callback to deliver new session instance.
[ "Returns", "observable", "to", "remove", "list", "of", "participants", "from", "a", "conversation", "." ]
train
https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L626-L628
cdk/cdk
display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/AtomSymbol.java
AtomSymbol.addAnnotation
AtomSymbol addAnnotation(TextOutline annotation) { List<TextOutline> newAnnotations = new ArrayList<TextOutline>(annotationAdjuncts); newAnnotations.add(annotation); return new AtomSymbol(element, adjuncts, newAnnotations, alignment, hull); }
java
AtomSymbol addAnnotation(TextOutline annotation) { List<TextOutline> newAnnotations = new ArrayList<TextOutline>(annotationAdjuncts); newAnnotations.add(annotation); return new AtomSymbol(element, adjuncts, newAnnotations, alignment, hull); }
[ "AtomSymbol", "addAnnotation", "(", "TextOutline", "annotation", ")", "{", "List", "<", "TextOutline", ">", "newAnnotations", "=", "new", "ArrayList", "<", "TextOutline", ">", "(", "annotationAdjuncts", ")", ";", "newAnnotations", ".", "add", "(", "annotation", ...
Include a new annotation adjunct in the atom symbol. @param annotation the new annotation adjunct @return a new AtomSymbol instance including the annotation adjunct
[ "Include", "a", "new", "annotation", "adjunct", "in", "the", "atom", "symbol", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/AtomSymbol.java#L127-L131
alkacon/opencms-core
src/org/opencms/i18n/CmsVfsBundleManager.java
CmsVfsBundleManager.logError
protected void logError(Exception e, boolean logToErrorChannel) { if (logToErrorChannel) { LOG.error(e.getLocalizedMessage(), e); } else { LOG.info(e.getLocalizedMessage(), e); } // if an error was logged make sure that the flag to schedule a reload is reset setReloadScheduled(false); }
java
protected void logError(Exception e, boolean logToErrorChannel) { if (logToErrorChannel) { LOG.error(e.getLocalizedMessage(), e); } else { LOG.info(e.getLocalizedMessage(), e); } // if an error was logged make sure that the flag to schedule a reload is reset setReloadScheduled(false); }
[ "protected", "void", "logError", "(", "Exception", "e", ",", "boolean", "logToErrorChannel", ")", "{", "if", "(", "logToErrorChannel", ")", "{", "LOG", ".", "error", "(", "e", ".", "getLocalizedMessage", "(", ")", ",", "e", ")", ";", "}", "else", "{", ...
Logs an exception that occurred.<p> @param e the exception to log @param logToErrorChannel if true erros should be written to the error channel instead of the info channel
[ "Logs", "an", "exception", "that", "occurred", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsVfsBundleManager.java#L257-L266
cloudfoundry/uaa
server/src/main/java/org/cloudfoundry/identity/uaa/oauth/UaaAuthorizationRequestManager.java
UaaAuthorizationRequestManager.validateParameters
public void validateParameters(Map<String, String> parameters, ClientDetails clientDetails) { if (parameters.containsKey("scope")) { Set<String> validScope = clientDetails.getScope(); if (GRANT_TYPE_CLIENT_CREDENTIALS.equals(parameters.get("grant_type"))) { validScope = AuthorityUtils.authorityListToSet(clientDetails.getAuthorities()); } Set<Pattern> validWildcards = constructWildcards(validScope); Set<String> scopes = OAuth2Utils.parseParameterList(parameters.get("scope")); for (String scope : scopes) { if (!matches(validWildcards, scope)) { throw new InvalidScopeException(scope + " is invalid. Please use a valid scope name in the request"); } } } }
java
public void validateParameters(Map<String, String> parameters, ClientDetails clientDetails) { if (parameters.containsKey("scope")) { Set<String> validScope = clientDetails.getScope(); if (GRANT_TYPE_CLIENT_CREDENTIALS.equals(parameters.get("grant_type"))) { validScope = AuthorityUtils.authorityListToSet(clientDetails.getAuthorities()); } Set<Pattern> validWildcards = constructWildcards(validScope); Set<String> scopes = OAuth2Utils.parseParameterList(parameters.get("scope")); for (String scope : scopes) { if (!matches(validWildcards, scope)) { throw new InvalidScopeException(scope + " is invalid. Please use a valid scope name in the request"); } } } }
[ "public", "void", "validateParameters", "(", "Map", "<", "String", ",", "String", ">", "parameters", ",", "ClientDetails", "clientDetails", ")", "{", "if", "(", "parameters", ".", "containsKey", "(", "\"scope\"", ")", ")", "{", "Set", "<", "String", ">", "...
Apply UAA rules to validate the requested scopes scope. For client credentials grants the valid requested scopes are actually in the authorities of the client.
[ "Apply", "UAA", "rules", "to", "validate", "the", "requested", "scopes", "scope", ".", "For", "client", "credentials", "grants", "the", "valid", "requested", "scopes", "are", "actually", "in", "the", "authorities", "of", "the", "client", "." ]
train
https://github.com/cloudfoundry/uaa/blob/e8df3d7060580c92d33461106399f9e4f36e3cd2/server/src/main/java/org/cloudfoundry/identity/uaa/oauth/UaaAuthorizationRequestManager.java#L205-L219
beangle/beangle3
orm/hibernate/src/main/java/org/beangle/orm/hibernate/id/TableSeqGenerator.java
TableSeqGenerator.configure
public void configure(Type type, Properties params, Dialect dialect) { if (Strings.isEmpty(params.getProperty(SEQUENCE_PARAM))) { String tableName = params.getProperty(PersistentIdentifierGenerator.TABLE); String pk = params.getProperty(PersistentIdentifierGenerator.PK); if (null != tableName) { String seqName = Strings.replace(sequencePattern, "{table}", tableName); seqName = Strings.replace(seqName, "{pk}", pk); if (seqName.length() > MaxLength) { logger.warn("{}'s length >=30, wouldn't be supported in some db!", seqName); } String entityName = params.getProperty(IdentifierGenerator.ENTITY_NAME); if (null != entityName && null != namingStrategy) { String schema = namingStrategy.getSchema(entityName); if (null != schema) seqName = schema + "." + seqName; } params.setProperty(SEQUENCE_PARAM, seqName); } } super.configure(type, params, dialect); }
java
public void configure(Type type, Properties params, Dialect dialect) { if (Strings.isEmpty(params.getProperty(SEQUENCE_PARAM))) { String tableName = params.getProperty(PersistentIdentifierGenerator.TABLE); String pk = params.getProperty(PersistentIdentifierGenerator.PK); if (null != tableName) { String seqName = Strings.replace(sequencePattern, "{table}", tableName); seqName = Strings.replace(seqName, "{pk}", pk); if (seqName.length() > MaxLength) { logger.warn("{}'s length >=30, wouldn't be supported in some db!", seqName); } String entityName = params.getProperty(IdentifierGenerator.ENTITY_NAME); if (null != entityName && null != namingStrategy) { String schema = namingStrategy.getSchema(entityName); if (null != schema) seqName = schema + "." + seqName; } params.setProperty(SEQUENCE_PARAM, seqName); } } super.configure(type, params, dialect); }
[ "public", "void", "configure", "(", "Type", "type", ",", "Properties", "params", ",", "Dialect", "dialect", ")", "{", "if", "(", "Strings", ".", "isEmpty", "(", "params", ".", "getProperty", "(", "SEQUENCE_PARAM", ")", ")", ")", "{", "String", "tableName",...
If the parameters do not contain a {@link SequenceGenerator#SEQUENCE} name, we assign one based on the table name.
[ "If", "the", "parameters", "do", "not", "contain", "a", "{" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/orm/hibernate/src/main/java/org/beangle/orm/hibernate/id/TableSeqGenerator.java#L62-L81
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/DefaultPriorityProvider.java
DefaultPriorityProvider.evaluateValueProvider
protected Long evaluateValueProvider(ParameterValueProvider valueProvider, ExecutionEntity execution, String errorMessageHeading) { Object value; try { value = valueProvider.getValue(execution); } catch (ProcessEngineException e) { if (Context.getProcessEngineConfiguration().isEnableGracefulDegradationOnContextSwitchFailure() && isSymptomOfContextSwitchFailure(e, execution)) { value = getDefaultPriorityOnResolutionFailure(); logNotDeterminingPriority(execution, value, e); } else { throw e; } } if (!(value instanceof Number)) { throw new ProcessEngineException(errorMessageHeading + ": Priority value is not an Integer"); } else { Number numberValue = (Number) value; if (isValidLongValue(numberValue)) { return numberValue.longValue(); } else { throw new ProcessEngineException(errorMessageHeading + ": Priority value must be either Short, Integer, or Long"); } } }
java
protected Long evaluateValueProvider(ParameterValueProvider valueProvider, ExecutionEntity execution, String errorMessageHeading) { Object value; try { value = valueProvider.getValue(execution); } catch (ProcessEngineException e) { if (Context.getProcessEngineConfiguration().isEnableGracefulDegradationOnContextSwitchFailure() && isSymptomOfContextSwitchFailure(e, execution)) { value = getDefaultPriorityOnResolutionFailure(); logNotDeterminingPriority(execution, value, e); } else { throw e; } } if (!(value instanceof Number)) { throw new ProcessEngineException(errorMessageHeading + ": Priority value is not an Integer"); } else { Number numberValue = (Number) value; if (isValidLongValue(numberValue)) { return numberValue.longValue(); } else { throw new ProcessEngineException(errorMessageHeading + ": Priority value must be either Short, Integer, or Long"); } } }
[ "protected", "Long", "evaluateValueProvider", "(", "ParameterValueProvider", "valueProvider", ",", "ExecutionEntity", "execution", ",", "String", "errorMessageHeading", ")", "{", "Object", "value", ";", "try", "{", "value", "=", "valueProvider", ".", "getValue", "(", ...
Evaluates a given value provider with the given execution entity to determine the correct value. The error message heading is used for the error message if the validation fails because the value is no valid priority. @param valueProvider the provider which contains the value @param execution the execution entity @param errorMessageHeading the heading which is used for the error message @return the valid priority value
[ "Evaluates", "a", "given", "value", "provider", "with", "the", "given", "execution", "entity", "to", "determine", "the", "correct", "value", ".", "The", "error", "message", "heading", "is", "used", "for", "the", "error", "message", "if", "the", "validation", ...
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/DefaultPriorityProvider.java#L73-L103
intendia-oss/rxjava-gwt
src/main/modified/io/reactivex/super/io/reactivex/Maybe.java
Maybe.flattenAsObservable
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <U> Observable<U> flattenAsObservable(final Function<? super T, ? extends Iterable<? extends U>> mapper) { ObjectHelper.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new MaybeFlatMapIterableObservable<T, U>(this, mapper)); }
java
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <U> Observable<U> flattenAsObservable(final Function<? super T, ? extends Iterable<? extends U>> mapper) { ObjectHelper.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new MaybeFlatMapIterableObservable<T, U>(this, mapper)); }
[ "@", "CheckReturnValue", "@", "SchedulerSupport", "(", "SchedulerSupport", ".", "NONE", ")", "public", "final", "<", "U", ">", "Observable", "<", "U", ">", "flattenAsObservable", "(", "final", "Function", "<", "?", "super", "T", ",", "?", "extends", "Iterabl...
Returns an Observable that maps a success value into an Iterable and emits its items. <p> <img width="640" height="373" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/flattenAsObservable.png" alt=""> <dl> <dt><b>Scheduler:</b></dt> <dd>{@code flattenAsObservable} does not operate by default on a particular {@link Scheduler}.</dd> </dl> @param <U> the type of item emitted by the resulting Iterable @param mapper a function that returns an Iterable sequence of values for when given an item emitted by the source Maybe @return the new Observable instance @see <a href="http://reactivex.io/documentation/operators/flatmap.html">ReactiveX operators documentation: FlatMap</a>
[ "Returns", "an", "Observable", "that", "maps", "a", "success", "value", "into", "an", "Iterable", "and", "emits", "its", "items", ".", "<p", ">", "<img", "width", "=", "640", "height", "=", "373", "src", "=", "https", ":", "//", "raw", ".", "github", ...
train
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Maybe.java#L3016-L3021
casmi/casmi
src/main/java/casmi/graphics/Graphics.java
Graphics.setBackground
public void setBackground(float x, float y, float z, float a) { gl.glClearColor(x / 255, y / 255, z / 255, a / 255); }
java
public void setBackground(float x, float y, float z, float a) { gl.glClearColor(x / 255, y / 255, z / 255, a / 255); }
[ "public", "void", "setBackground", "(", "float", "x", ",", "float", "y", ",", "float", "z", ",", "float", "a", ")", "{", "gl", ".", "glClearColor", "(", "x", "/", "255", ",", "y", "/", "255", ",", "z", "/", "255", ",", "a", "/", "255", ")", "...
Sets the background to a RGB and alpha value. @param x The R value of the background. @param y The G value of the background. @param z The B value of the background. @param a The alpha opacity of the background.
[ "Sets", "the", "background", "to", "a", "RGB", "and", "alpha", "value", "." ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/Graphics.java#L174-L176
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.paintTiles
protected void paintTiles (Graphics2D gfx, Rectangle clip) { // go through rendering our tiles _paintOp.setGraphics(gfx); _applicator.applyToTiles(clip, _paintOp); _paintOp.setGraphics(null); }
java
protected void paintTiles (Graphics2D gfx, Rectangle clip) { // go through rendering our tiles _paintOp.setGraphics(gfx); _applicator.applyToTiles(clip, _paintOp); _paintOp.setGraphics(null); }
[ "protected", "void", "paintTiles", "(", "Graphics2D", "gfx", ",", "Rectangle", "clip", ")", "{", "// go through rendering our tiles", "_paintOp", ".", "setGraphics", "(", "gfx", ")", ";", "_applicator", ".", "applyToTiles", "(", "clip", ",", "_paintOp", ")", ";"...
Renders the base and fringe layer tiles that intersect the specified clipping rectangle.
[ "Renders", "the", "base", "and", "fringe", "layer", "tiles", "that", "intersect", "the", "specified", "clipping", "rectangle", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L1361-L1367
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiBookmark.java
BoxApiBookmark.getAddCommentRequest
public BoxRequestsBookmark.AddCommentToBookmark getAddCommentRequest(String bookmarkId, String message) { BoxRequestsBookmark.AddCommentToBookmark request = new BoxRequestsBookmark.AddCommentToBookmark(bookmarkId, message, getCommentUrl(), mSession); return request; }
java
public BoxRequestsBookmark.AddCommentToBookmark getAddCommentRequest(String bookmarkId, String message) { BoxRequestsBookmark.AddCommentToBookmark request = new BoxRequestsBookmark.AddCommentToBookmark(bookmarkId, message, getCommentUrl(), mSession); return request; }
[ "public", "BoxRequestsBookmark", ".", "AddCommentToBookmark", "getAddCommentRequest", "(", "String", "bookmarkId", ",", "String", "message", ")", "{", "BoxRequestsBookmark", ".", "AddCommentToBookmark", "request", "=", "new", "BoxRequestsBookmark", ".", "AddCommentToBookmar...
Gets a request that adds a comment to a bookmark @param bookmarkId id of the bookmark to add the comment to @param message message for the comment that will be added @return request to add a comment to a bookmark
[ "Gets", "a", "request", "that", "adds", "a", "comment", "to", "a", "bookmark" ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiBookmark.java#L181-L184
qsardb/qsardb
model/src/main/java/org/qsardb/model/Cargo.java
Cargo.loadString
public String loadString(String encoding) throws IOException { byte[] bytes = loadByteArray(); ByteOrderMask bom = ByteOrderMask.valueOf(bytes); if(bom != null){ int offset = (bom.getBytes()).length; return new String(bytes, offset, bytes.length - offset, bom.getEncoding()); } return new String(bytes, encoding); }
java
public String loadString(String encoding) throws IOException { byte[] bytes = loadByteArray(); ByteOrderMask bom = ByteOrderMask.valueOf(bytes); if(bom != null){ int offset = (bom.getBytes()).length; return new String(bytes, offset, bytes.length - offset, bom.getEncoding()); } return new String(bytes, encoding); }
[ "public", "String", "loadString", "(", "String", "encoding", ")", "throws", "IOException", "{", "byte", "[", "]", "bytes", "=", "loadByteArray", "(", ")", ";", "ByteOrderMask", "bom", "=", "ByteOrderMask", ".", "valueOf", "(", "bytes", ")", ";", "if", "(",...
Loads the string in the user specified character encoding. However, when the underlying byte array begins with a known Unicode byte order mark (BOM), then the BOM specified character encoding takes precedence over the user specified character encoding. @param encoding The user specified character encoding. @see ByteOrderMask
[ "Loads", "the", "string", "in", "the", "user", "specified", "character", "encoding", "." ]
train
https://github.com/qsardb/qsardb/blob/9798f524abd973878b9040927aed8131885127fa/model/src/main/java/org/qsardb/model/Cargo.java#L272-L283
rundeck/rundeck
rundeck-storage/rundeck-storage-data/src/main/java/org/rundeck/storage/data/DataUtil.java
DataUtil.withText
public static <T extends ContentMeta> T withText(String text, Map<String, String> meta, ContentFactory<T> factory) { return factory.create(lazyStream(new ByteArrayInputStream(text.getBytes())), meta); }
java
public static <T extends ContentMeta> T withText(String text, Map<String, String> meta, ContentFactory<T> factory) { return factory.create(lazyStream(new ByteArrayInputStream(text.getBytes())), meta); }
[ "public", "static", "<", "T", "extends", "ContentMeta", ">", "T", "withText", "(", "String", "text", ",", "Map", "<", "String", ",", "String", ">", "meta", ",", "ContentFactory", "<", "T", ">", "factory", ")", "{", "return", "factory", ".", "create", "...
Returns a read-only FileMeta from the input source @param text text data @param meta meta data @param factory factory @param <T> resource type @return content
[ "Returns", "a", "read", "-", "only", "FileMeta", "from", "the", "input", "source" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/rundeck-storage/rundeck-storage-data/src/main/java/org/rundeck/storage/data/DataUtil.java#L53-L55
groupon/monsoon
history/src/main/java/com/groupon/lex/metrics/history/v1/xdr/ToXdr.java
ToXdr.metricName_index
private int metricName_index(dictionary_delta dict_delta, MetricName metric) { final BiMap<MetricName, Integer> dict = from_.getMetricDict().inverse(); final Integer resolved = dict.get(metric); if (resolved != null) return resolved; final int allocated = allocate_index_(dict); dict.put(metric, allocated); // Create new pdd for serialization. path_dictionary_delta mdd = new path_dictionary_delta(); mdd.id = allocated; mdd.value = new_path_(metric.getPath()); // Append new entry to array. dict_delta.mdd = Stream.concat(Arrays.stream(dict_delta.mdd), Stream.of(mdd)) .toArray(path_dictionary_delta[]::new); LOG.log(Level.FINE, "dict_delta.mdd: {0} items (added {1})", new Object[]{dict_delta.mdd.length, metric}); return allocated; }
java
private int metricName_index(dictionary_delta dict_delta, MetricName metric) { final BiMap<MetricName, Integer> dict = from_.getMetricDict().inverse(); final Integer resolved = dict.get(metric); if (resolved != null) return resolved; final int allocated = allocate_index_(dict); dict.put(metric, allocated); // Create new pdd for serialization. path_dictionary_delta mdd = new path_dictionary_delta(); mdd.id = allocated; mdd.value = new_path_(metric.getPath()); // Append new entry to array. dict_delta.mdd = Stream.concat(Arrays.stream(dict_delta.mdd), Stream.of(mdd)) .toArray(path_dictionary_delta[]::new); LOG.log(Level.FINE, "dict_delta.mdd: {0} items (added {1})", new Object[]{dict_delta.mdd.length, metric}); return allocated; }
[ "private", "int", "metricName_index", "(", "dictionary_delta", "dict_delta", ",", "MetricName", "metric", ")", "{", "final", "BiMap", "<", "MetricName", ",", "Integer", ">", "dict", "=", "from_", ".", "getMetricDict", "(", ")", ".", "inverse", "(", ")", ";",...
Lookup the index for the argument, or if it isn't present, create one.
[ "Lookup", "the", "index", "for", "the", "argument", "or", "if", "it", "isn", "t", "present", "create", "one", "." ]
train
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/history/src/main/java/com/groupon/lex/metrics/history/v1/xdr/ToXdr.java#L135-L153
googlegenomics/utils-java
src/main/java/com/google/cloud/genomics/utils/GenomicsUtils.java
GenomicsUtils.getReferenceSetId
public static String getReferenceSetId(String readGroupSetId, OfflineAuth auth) throws IOException { Genomics genomics = GenomicsFactory.builder().build().fromOfflineAuth(auth); ReadGroupSet readGroupSet = genomics.readgroupsets().get(readGroupSetId) .setFields("referenceSetId").execute(); return readGroupSet.getReferenceSetId(); }
java
public static String getReferenceSetId(String readGroupSetId, OfflineAuth auth) throws IOException { Genomics genomics = GenomicsFactory.builder().build().fromOfflineAuth(auth); ReadGroupSet readGroupSet = genomics.readgroupsets().get(readGroupSetId) .setFields("referenceSetId").execute(); return readGroupSet.getReferenceSetId(); }
[ "public", "static", "String", "getReferenceSetId", "(", "String", "readGroupSetId", ",", "OfflineAuth", "auth", ")", "throws", "IOException", "{", "Genomics", "genomics", "=", "GenomicsFactory", ".", "builder", "(", ")", ".", "build", "(", ")", ".", "fromOffline...
Gets the ReferenceSetId for a given readGroupSetId using the Genomics API. @param readGroupSetId The id of the readGroupSet to query. @param auth The OfflineAuth for the API request. @return The referenceSetId for the redGroupSet (which may be null). @throws IOException
[ "Gets", "the", "ReferenceSetId", "for", "a", "given", "readGroupSetId", "using", "the", "Genomics", "API", "." ]
train
https://github.com/googlegenomics/utils-java/blob/7205d5b4e4f61fc6b93acb4bdd76b93df5b5f612/src/main/java/com/google/cloud/genomics/utils/GenomicsUtils.java#L70-L76
logic-ng/LogicNG
src/main/java/org/logicng/backbones/BackboneGeneration.java
BackboneGeneration.computePositive
public static Backbone computePositive(final Collection<Formula> formulas, final Collection<Variable> variables) { return compute(formulas, variables, BackboneType.ONLY_POSITIVE); }
java
public static Backbone computePositive(final Collection<Formula> formulas, final Collection<Variable> variables) { return compute(formulas, variables, BackboneType.ONLY_POSITIVE); }
[ "public", "static", "Backbone", "computePositive", "(", "final", "Collection", "<", "Formula", ">", "formulas", ",", "final", "Collection", "<", "Variable", ">", "variables", ")", "{", "return", "compute", "(", "formulas", ",", "variables", ",", "BackboneType", ...
Computes the positive backbone variables for a given collection of formulas w.r.t. a collection of variables. @param formulas the given collection of formulas @param variables the given collection of relevant variables for the backbone computation @return the positive backbone or {@code null} if the formula is UNSAT
[ "Computes", "the", "positive", "backbone", "variables", "for", "a", "given", "collection", "of", "formulas", "w", ".", "r", ".", "t", ".", "a", "collection", "of", "variables", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/backbones/BackboneGeneration.java#L164-L166
bramp/ffmpeg-cli-wrapper
src/main/java/net/bramp/ffmpeg/nut/NutReader.java
NutReader.readFileId
protected void readFileId() throws IOException { byte[] b = new byte[HEADER.length]; in.readFully(b); if (!Arrays.equals(b, HEADER)) { throw new IOException( "file_id_string does not match. got: " + new String(b, Charsets.ISO_8859_1)); } }
java
protected void readFileId() throws IOException { byte[] b = new byte[HEADER.length]; in.readFully(b); if (!Arrays.equals(b, HEADER)) { throw new IOException( "file_id_string does not match. got: " + new String(b, Charsets.ISO_8859_1)); } }
[ "protected", "void", "readFileId", "(", ")", "throws", "IOException", "{", "byte", "[", "]", "b", "=", "new", "byte", "[", "HEADER", ".", "length", "]", ";", "in", ".", "readFully", "(", "b", ")", ";", "if", "(", "!", "Arrays", ".", "equals", "(", ...
Read the magic at the beginning of the file. @throws IOException If a I/O error occurs
[ "Read", "the", "magic", "at", "the", "beginning", "of", "the", "file", "." ]
train
https://github.com/bramp/ffmpeg-cli-wrapper/blob/3819b155edf9132acc75bb6af66dcef1b98c64b2/src/main/java/net/bramp/ffmpeg/nut/NutReader.java#L52-L60
baratine/baratine
framework/src/main/java/com/caucho/v5/reflect/ReflectUtil.java
ReflectUtil.findMethod
public static Method findMethod(Collection<Method> methods, Method testMethod) { for (Method method : methods) { if (isMatch(method, testMethod)) return method; } return null; }
java
public static Method findMethod(Collection<Method> methods, Method testMethod) { for (Method method : methods) { if (isMatch(method, testMethod)) return method; } return null; }
[ "public", "static", "Method", "findMethod", "(", "Collection", "<", "Method", ">", "methods", ",", "Method", "testMethod", ")", "{", "for", "(", "Method", "method", ":", "methods", ")", "{", "if", "(", "isMatch", "(", "method", ",", "testMethod", ")", ")...
Finds any method matching the method name and parameter types.
[ "Finds", "any", "method", "matching", "the", "method", "name", "and", "parameter", "types", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/reflect/ReflectUtil.java#L84-L92
jcuda/jcurand
JCurandJava/src/main/java/jcuda/jcurand/JCurand.java
JCurand.curandGeneratePoisson
public static int curandGeneratePoisson(curandGenerator generator, Pointer outputPtr, long n, double lambda) { return checkResult(curandGeneratePoissonNative(generator, outputPtr, n, lambda)); }
java
public static int curandGeneratePoisson(curandGenerator generator, Pointer outputPtr, long n, double lambda) { return checkResult(curandGeneratePoissonNative(generator, outputPtr, n, lambda)); }
[ "public", "static", "int", "curandGeneratePoisson", "(", "curandGenerator", "generator", ",", "Pointer", "outputPtr", ",", "long", "n", ",", "double", "lambda", ")", "{", "return", "checkResult", "(", "curandGeneratePoissonNative", "(", "generator", ",", "outputPtr"...
<pre> Generate Poisson-distributed unsigned ints. Use generator to generate n unsigned int results into device memory at outputPtr. The device memory must have been previously allocated and must be large enough to hold all the results. Launches are done with the stream set using ::curandSetStream(), or the null stream if no stream has been set. Results are 32-bit unsigned int point values with Poisson distribution, with lambda lambda. @param generator - Generator to use @param outputPtr - Pointer to device memory to store CUDA-generated results, or Pointer to host memory to store CPU-generated results @param n - Number of unsigned ints to generate @param lambda - lambda for the Poisson distribution @return - CURAND_STATUS_NOT_INITIALIZED if the generator was never created - CURAND_STATUS_PREEXISTING_FAILURE if there was an existing error from a previous kernel launch - CURAND_STATUS_LAUNCH_FAILURE if the kernel launch failed for any reason - CURAND_STATUS_LENGTH_NOT_MULTIPLE if the number of output samples is not a multiple of the quasirandom dimension - CURAND_STATUS_DOUBLE_PRECISION_REQUIRED if the GPU or sm does not support double precision - CURAND_STATUS_OUT_OF_RANGE if lambda is non-positive or greater than 400,000 - CURAND_STATUS_SUCCESS if the results were generated successfully </pre>
[ "<pre", ">", "Generate", "Poisson", "-", "distributed", "unsigned", "ints", "." ]
train
https://github.com/jcuda/jcurand/blob/0f463d2bb72cd93b3988f7ce148cdb6069ba4fd9/JCurandJava/src/main/java/jcuda/jcurand/JCurand.java#L929-L932
Azure/azure-sdk-for-java
cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java
DatabaseAccountsInner.beginFailoverPriorityChange
public void beginFailoverPriorityChange(String resourceGroupName, String accountName, List<FailoverPolicy> failoverPolicies) { beginFailoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName, failoverPolicies).toBlocking().single().body(); }
java
public void beginFailoverPriorityChange(String resourceGroupName, String accountName, List<FailoverPolicy> failoverPolicies) { beginFailoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName, failoverPolicies).toBlocking().single().body(); }
[ "public", "void", "beginFailoverPriorityChange", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "List", "<", "FailoverPolicy", ">", "failoverPolicies", ")", "{", "beginFailoverPriorityChangeWithServiceResponseAsync", "(", "resourceGroupName", ",", "a...
Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. @param resourceGroupName Name of an Azure resource group. @param accountName Cosmos DB database account name. @param failoverPolicies List of failover policies. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Changes", "the", "failover", "priority", "for", "the", "Azure", "Cosmos", "DB", "database", "account", ".", "A", "failover", "priority", "of", "0", "indicates", "a", "write", "region", ".", "The", "maximum", "value", "for", "a", "failover", "priority", "=",...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java#L847-L849
jtmelton/appsensor
analysis-engines/appsensor-analysis-rules/src/main/java/org/owasp/appsensor/analysis/AggregateEventAnalysisEngine.java
AggregateEventAnalysisEngine.checkRule
protected boolean checkRule(Event triggerEvent, Rule rule) { Queue<Notification> notifications = getNotifications(triggerEvent, rule); Queue<Notification> windowedNotifications = new PriorityQueue<Notification>(1, Notification.getStartTimeAscendingComparator()); Iterator<Expression> expressions = rule.getExpressions().iterator(); Expression currentExpression = expressions.next(); Notification tail = null; while (!notifications.isEmpty()) { tail = notifications.poll(); windowedNotifications.add(tail); trim(windowedNotifications, tail.getEndTime().minus(currentExpression.getWindow().toMillis())); if (checkExpression(currentExpression, windowedNotifications)) { if (expressions.hasNext()) { currentExpression = expressions.next(); windowedNotifications = new LinkedList<Notification>(); trim(notifications, tail.getEndTime()); } else { return true; } } } return false; }
java
protected boolean checkRule(Event triggerEvent, Rule rule) { Queue<Notification> notifications = getNotifications(triggerEvent, rule); Queue<Notification> windowedNotifications = new PriorityQueue<Notification>(1, Notification.getStartTimeAscendingComparator()); Iterator<Expression> expressions = rule.getExpressions().iterator(); Expression currentExpression = expressions.next(); Notification tail = null; while (!notifications.isEmpty()) { tail = notifications.poll(); windowedNotifications.add(tail); trim(windowedNotifications, tail.getEndTime().minus(currentExpression.getWindow().toMillis())); if (checkExpression(currentExpression, windowedNotifications)) { if (expressions.hasNext()) { currentExpression = expressions.next(); windowedNotifications = new LinkedList<Notification>(); trim(notifications, tail.getEndTime()); } else { return true; } } } return false; }
[ "protected", "boolean", "checkRule", "(", "Event", "triggerEvent", ",", "Rule", "rule", ")", "{", "Queue", "<", "Notification", ">", "notifications", "=", "getNotifications", "(", "triggerEvent", ",", "rule", ")", ";", "Queue", "<", "Notification", ">", "windo...
Evaluates a {@link Rule}'s logic by compiling a list of all {@link Notification}s and then evaluating each {@link Expression} within the {@link Rule}. All {@link Expression}s must evaluate to true within the {@link Rule}'s window for the {@link Rule} to evaluate to true. The process follows the "sliding window" pattern. @param event the {@link Event} that triggered analysis @param rule the {@link Rule} being evaluated @return the boolean evaluation of the {@link Rule}
[ "Evaluates", "a", "{", "@link", "Rule", "}", "s", "logic", "by", "compiling", "a", "list", "of", "all", "{", "@link", "Notification", "}", "s", "and", "then", "evaluating", "each", "{", "@link", "Expression", "}", "within", "the", "{", "@link", "Rule", ...
train
https://github.com/jtmelton/appsensor/blob/c3b4e9ada50fdee974e0d618ec4bdfabc2163798/analysis-engines/appsensor-analysis-rules/src/main/java/org/owasp/appsensor/analysis/AggregateEventAnalysisEngine.java#L82-L107
stapler/stapler
core/src/main/java/org/kohsuke/stapler/HttpResponses.java
HttpResponses.errorWithoutStack
public static HttpResponseException errorWithoutStack(final int code, final String errorMessage) { return new HttpResponseException() { public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node) throws IOException, ServletException { rsp.sendError(code, errorMessage); } }; }
java
public static HttpResponseException errorWithoutStack(final int code, final String errorMessage) { return new HttpResponseException() { public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node) throws IOException, ServletException { rsp.sendError(code, errorMessage); } }; }
[ "public", "static", "HttpResponseException", "errorWithoutStack", "(", "final", "int", "code", ",", "final", "String", "errorMessage", ")", "{", "return", "new", "HttpResponseException", "(", ")", "{", "public", "void", "generateResponse", "(", "StaplerRequest", "re...
Sends an error without a stack trace. @since 1.215 @see #error(int, String)
[ "Sends", "an", "error", "without", "a", "stack", "trace", "." ]
train
https://github.com/stapler/stapler/blob/11ad5af185e062fb46e01bf9fbed66f3ebf2a8f7/core/src/main/java/org/kohsuke/stapler/HttpResponses.java#L108-L114
jirutka/spring-rest-exception-handler
src/main/java/cz/jirutka/spring/exhandler/RestHandlerExceptionResolverBuilder.java
RestHandlerExceptionResolverBuilder.addHandler
public <E extends Exception> RestHandlerExceptionResolverBuilder addHandler(AbstractRestExceptionHandler<E, ?> exceptionHandler) { return addHandler(exceptionHandler.getExceptionClass(), exceptionHandler); }
java
public <E extends Exception> RestHandlerExceptionResolverBuilder addHandler(AbstractRestExceptionHandler<E, ?> exceptionHandler) { return addHandler(exceptionHandler.getExceptionClass(), exceptionHandler); }
[ "public", "<", "E", "extends", "Exception", ">", "RestHandlerExceptionResolverBuilder", "addHandler", "(", "AbstractRestExceptionHandler", "<", "E", ",", "?", ">", "exceptionHandler", ")", "{", "return", "addHandler", "(", "exceptionHandler", ".", "getExceptionClass", ...
Same as {@link #addHandler(Class, RestExceptionHandler)}, but the exception type is determined from the handler.
[ "Same", "as", "{" ]
train
https://github.com/jirutka/spring-rest-exception-handler/blob/f171956e59fe866f1a853c7d38444f136acc7a3b/src/main/java/cz/jirutka/spring/exhandler/RestHandlerExceptionResolverBuilder.java#L198-L202
codelibs/fess
src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java
FessMessages.addErrorsPropertyTypeLong
public FessMessages addErrorsPropertyTypeLong(String property, String arg0) { assertPropertyNotNull(property); add(property, new UserMessage(ERRORS_property_type_long, arg0)); return this; }
java
public FessMessages addErrorsPropertyTypeLong(String property, String arg0) { assertPropertyNotNull(property); add(property, new UserMessage(ERRORS_property_type_long, arg0)); return this; }
[ "public", "FessMessages", "addErrorsPropertyTypeLong", "(", "String", "property", ",", "String", "arg0", ")", "{", "assertPropertyNotNull", "(", "property", ")", ";", "add", "(", "property", ",", "new", "UserMessage", "(", "ERRORS_property_type_long", ",", "arg0", ...
Add the created action message for the key 'errors.property_type_long' with parameters. <pre> message: {0} should be numeric. </pre> @param property The property name for the message. (NotNull) @param arg0 The parameter arg0 for message. (NotNull) @return this. (NotNull)
[ "Add", "the", "created", "action", "message", "for", "the", "key", "errors", ".", "property_type_long", "with", "parameters", ".", "<pre", ">", "message", ":", "{", "0", "}", "should", "be", "numeric", ".", "<", "/", "pre", ">" ]
train
https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L2215-L2219
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2Engine.java
SM2Engine.xor
private void xor(byte[] data, byte[] kdfOut, int dOff, int dRemaining) { for (int i = 0; i != dRemaining; i++) { data[dOff + i] ^= kdfOut[i]; } }
java
private void xor(byte[] data, byte[] kdfOut, int dOff, int dRemaining) { for (int i = 0; i != dRemaining; i++) { data[dOff + i] ^= kdfOut[i]; } }
[ "private", "void", "xor", "(", "byte", "[", "]", "data", ",", "byte", "[", "]", "kdfOut", ",", "int", "dOff", ",", "int", "dRemaining", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "!=", "dRemaining", ";", "i", "++", ")", "{", "data", ...
异或 @param data 数据 @param kdfOut kdf输出值 @param dOff d偏移 @param dRemaining d剩余
[ "异或" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2Engine.java#L326-L330
ModeShape/modeshape
modeshape-schematic/src/main/java/org/modeshape/schematic/internal/document/BsonUtils.java
BsonUtils.writeObjectId
public static void writeObjectId(ObjectId id, byte[] b) { int time = id.getTime(); int machine = id.getMachine(); int process = id.getProcess(); int inc = id.getInc(); b[0] = (byte) ((time >>> 24) & 0xFF); b[1] = (byte) ((time >>> 16) & 0xFF); b[2] = (byte) ((time >>> 8) & 0xFF); b[3] = (byte) ((time >>> 0) & 0xFF); b[4] = (byte) ((machine >>> 16) & 0xFF); b[5] = (byte) ((machine >>> 8) & 0xFF); b[6] = (byte) ((machine >>> 0) & 0xFF); b[7] = (byte) ((process >>> 8) & 0xFF); b[8] = (byte) ((process >>> 0) & 0xFF); b[9] = (byte) ((inc >>> 16) & 0xFF); b[10] = (byte) ((inc >>> 8) & 0xFF); b[11] = (byte) ((inc >>> 0) & 0xFF); }
java
public static void writeObjectId(ObjectId id, byte[] b) { int time = id.getTime(); int machine = id.getMachine(); int process = id.getProcess(); int inc = id.getInc(); b[0] = (byte) ((time >>> 24) & 0xFF); b[1] = (byte) ((time >>> 16) & 0xFF); b[2] = (byte) ((time >>> 8) & 0xFF); b[3] = (byte) ((time >>> 0) & 0xFF); b[4] = (byte) ((machine >>> 16) & 0xFF); b[5] = (byte) ((machine >>> 8) & 0xFF); b[6] = (byte) ((machine >>> 0) & 0xFF); b[7] = (byte) ((process >>> 8) & 0xFF); b[8] = (byte) ((process >>> 0) & 0xFF); b[9] = (byte) ((inc >>> 16) & 0xFF); b[10] = (byte) ((inc >>> 8) & 0xFF); b[11] = (byte) ((inc >>> 0) & 0xFF); }
[ "public", "static", "void", "writeObjectId", "(", "ObjectId", "id", ",", "byte", "[", "]", "b", ")", "{", "int", "time", "=", "id", ".", "getTime", "(", ")", ";", "int", "machine", "=", "id", ".", "getMachine", "(", ")", ";", "int", "process", "=",...
Write the 12-byte representation of the ObjectId per the BSON specification (or rather the <a href="http://www.mongodb.org/display/DOCS/Object+IDs">MongoDB documentation</a>). @param id the ObjectId; may not be null @param b the bytes into which the object ID should be written
[ "Write", "the", "12", "-", "byte", "representation", "of", "the", "ObjectId", "per", "the", "BSON", "specification", "(", "or", "rather", "the", "<a", "href", "=", "http", ":", "//", "www", ".", "mongodb", ".", "org", "/", "display", "/", "DOCS", "/", ...
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-schematic/src/main/java/org/modeshape/schematic/internal/document/BsonUtils.java#L145-L162
Sciss/abc4j
abc/src/main/java/abc/ui/swing/ScoreTemplate.java
ScoreTemplate.setVisible
public void setVisible(byte[] fields, boolean visible) { for (byte field : fields) { getFieldInfos(field).m_visible = visible; } notifyListeners(); }
java
public void setVisible(byte[] fields, boolean visible) { for (byte field : fields) { getFieldInfos(field).m_visible = visible; } notifyListeners(); }
[ "public", "void", "setVisible", "(", "byte", "[", "]", "fields", ",", "boolean", "visible", ")", "{", "for", "(", "byte", "field", ":", "fields", ")", "{", "getFieldInfos", "(", "field", ")", ".", "m_visible", "=", "visible", ";", "}", "notifyListeners",...
Sets the visibility of several fields @param fields array of {@link ScoreElements} constants
[ "Sets", "the", "visibility", "of", "several", "fields" ]
train
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/ScoreTemplate.java#L1037-L1042
hypfvieh/java-utils
src/main/java/com/github/hypfvieh/util/StringUtil.java
StringUtil.containsAny
public static boolean containsAny(boolean _ignoreCase, String _str, String... _args) { if (_str == null || _args == null || _args.length == 0) { return false; } String heystack = _str; if (_ignoreCase) { heystack = _str.toLowerCase(); } for (String s : _args) { String needle = _ignoreCase ? s.toLowerCase() : s; if (heystack.contains(needle)) { return true; } } return false; }
java
public static boolean containsAny(boolean _ignoreCase, String _str, String... _args) { if (_str == null || _args == null || _args.length == 0) { return false; } String heystack = _str; if (_ignoreCase) { heystack = _str.toLowerCase(); } for (String s : _args) { String needle = _ignoreCase ? s.toLowerCase() : s; if (heystack.contains(needle)) { return true; } } return false; }
[ "public", "static", "boolean", "containsAny", "(", "boolean", "_ignoreCase", ",", "String", "_str", ",", "String", "...", "_args", ")", "{", "if", "(", "_str", "==", "null", "||", "_args", "==", "null", "||", "_args", ".", "length", "==", "0", ")", "{"...
Checks if any of the given strings in _args is contained in _str. @param _ignoreCase true to ignore case, false to be case sensitive @param _str string to check @param _args patterns to find @return true if any string in _args is found in _str, false if not or _str/_args is null
[ "Checks", "if", "any", "of", "the", "given", "strings", "in", "_args", "is", "contained", "in", "_str", "." ]
train
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/StringUtil.java#L495-L512
lucee/Lucee
core/src/main/java/lucee/runtime/cache/CacheUtil.java
CacheUtil.getDefault
public static Cache getDefault(PageContext pc, int type) throws IOException { // get default from application conetxt String name = pc != null ? pc.getApplicationContext().getDefaultCacheName(type) : null; if (!StringUtil.isEmpty(name)) { Cache cc = getCache(pc, name, null); if (cc != null) return cc; } // get default from config Config config = ThreadLocalPageContext.getConfig(pc); CacheConnection cc = ((ConfigImpl) config).getCacheDefaultConnection(type); if (cc == null) throw new CacheException("there is no default " + toStringType(type, "") + " cache defined, you need to define this default cache in the Lucee Administrator"); return cc.getInstance(config); }
java
public static Cache getDefault(PageContext pc, int type) throws IOException { // get default from application conetxt String name = pc != null ? pc.getApplicationContext().getDefaultCacheName(type) : null; if (!StringUtil.isEmpty(name)) { Cache cc = getCache(pc, name, null); if (cc != null) return cc; } // get default from config Config config = ThreadLocalPageContext.getConfig(pc); CacheConnection cc = ((ConfigImpl) config).getCacheDefaultConnection(type); if (cc == null) throw new CacheException("there is no default " + toStringType(type, "") + " cache defined, you need to define this default cache in the Lucee Administrator"); return cc.getInstance(config); }
[ "public", "static", "Cache", "getDefault", "(", "PageContext", "pc", ",", "int", "type", ")", "throws", "IOException", "{", "// get default from application conetxt", "String", "name", "=", "pc", "!=", "null", "?", "pc", ".", "getApplicationContext", "(", ")", "...
get the default cache for a certain type, also check definitions in application context (application . cfc/cfapplication) @param pc current PageContext @param type default type -> Config.CACHE_DEFAULT_... @return matching cache @throws IOException
[ "get", "the", "default", "cache", "for", "a", "certain", "type", "also", "check", "definitions", "in", "application", "context", "(", "application", ".", "cfc", "/", "cfapplication", ")" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/cache/CacheUtil.java#L94-L108
Trilarion/java-vorbis-support
src/main/java/com/github/trilarion/sound/vorbis/sampled/spi/VorbisAudioFileReader.java
VorbisAudioFileReader.getAudioInputStream
@Override public AudioInputStream getAudioInputStream(InputStream inputStream) throws UnsupportedAudioFileException, IOException { LOG.log(Level.FINE, "getAudioInputStream(InputStream inputStream)"); return getAudioInputStream(inputStream, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED); }
java
@Override public AudioInputStream getAudioInputStream(InputStream inputStream) throws UnsupportedAudioFileException, IOException { LOG.log(Level.FINE, "getAudioInputStream(InputStream inputStream)"); return getAudioInputStream(inputStream, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED); }
[ "@", "Override", "public", "AudioInputStream", "getAudioInputStream", "(", "InputStream", "inputStream", ")", "throws", "UnsupportedAudioFileException", ",", "IOException", "{", "LOG", ".", "log", "(", "Level", ".", "FINE", ",", "\"getAudioInputStream(InputStream inputStr...
Return the AudioInputStream from the given InputStream. @return @throws javax.sound.sampled.UnsupportedAudioFileException @throws java.io.IOException
[ "Return", "the", "AudioInputStream", "from", "the", "given", "InputStream", "." ]
train
https://github.com/Trilarion/java-vorbis-support/blob/f72aba7d97167fe0ff20b1b719fdb5bb662ff736/src/main/java/com/github/trilarion/sound/vorbis/sampled/spi/VorbisAudioFileReader.java#L274-L278