repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
netplex/json-smart-v2
json-smart/src/main/java/net/minidev/json/parser/JSONParser.java
JSONParser.parse
public <T> T parse(InputStream in, JsonReaderI<T> mapper) throws ParseException, UnsupportedEncodingException { """ use to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory """ return getPBinStream().parse(in, mapper); }
java
public <T> T parse(InputStream in, JsonReaderI<T> mapper) throws ParseException, UnsupportedEncodingException { return getPBinStream().parse(in, mapper); }
[ "public", "<", "T", ">", "T", "parse", "(", "InputStream", "in", ",", "JsonReaderI", "<", "T", ">", "mapper", ")", "throws", "ParseException", ",", "UnsupportedEncodingException", "{", "return", "getPBinStream", "(", ")", ".", "parse", "(", "in", ",", "map...
use to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory
[ "use", "to", "return", "Primitive", "Type", "or", "String", "Or", "JsonObject", "or", "JsonArray", "generated", "by", "a", "ContainerFactory" ]
train
https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/json-smart/src/main/java/net/minidev/json/parser/JSONParser.java#L222-L224
OpenLiberty/open-liberty
dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/config/CommonConfigUtils.java
CommonConfigUtils.getLongConfigAttribute
public long getLongConfigAttribute(Map<String, Object> props, String key, long defaultValue) { """ Returns the value for the configuration attribute matching the key provided. If the value does not exist or is empty, the provided default value will be returned. """ if (props.containsKey(key)) { return (Long) props.get(key); } return defaultValue; }
java
public long getLongConfigAttribute(Map<String, Object> props, String key, long defaultValue) { if (props.containsKey(key)) { return (Long) props.get(key); } return defaultValue; }
[ "public", "long", "getLongConfigAttribute", "(", "Map", "<", "String", ",", "Object", ">", "props", ",", "String", "key", ",", "long", "defaultValue", ")", "{", "if", "(", "props", ".", "containsKey", "(", "key", ")", ")", "{", "return", "(", "Long", "...
Returns the value for the configuration attribute matching the key provided. If the value does not exist or is empty, the provided default value will be returned.
[ "Returns", "the", "value", "for", "the", "configuration", "attribute", "matching", "the", "key", "provided", ".", "If", "the", "value", "does", "not", "exist", "or", "is", "empty", "the", "provided", "default", "value", "will", "be", "returned", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/config/CommonConfigUtils.java#L152-L157
kubernetes-client/java
examples/src/main/java/io/kubernetes/client/examples/ExpandedExample.java
ExpandedExample.printLog
public static void printLog(String namespace, String podName) throws ApiException { """ Print out the Log for specific Pods @param namespace @param podName @throws ApiException """ // https://github.com/kubernetes-client/java/blob/master/kubernetes/docs/CoreV1Api.md#readNamespacedPodLog String readNamespacedPodLog = COREV1_API.readNamespacedPodLog( podName, namespace, null, Boolean.FALSE, Integer.MAX_VALUE, null, Boolean.FALSE, Integer.MAX_VALUE, 40, Boolean.FALSE); System.out.println(readNamespacedPodLog); }
java
public static void printLog(String namespace, String podName) throws ApiException { // https://github.com/kubernetes-client/java/blob/master/kubernetes/docs/CoreV1Api.md#readNamespacedPodLog String readNamespacedPodLog = COREV1_API.readNamespacedPodLog( podName, namespace, null, Boolean.FALSE, Integer.MAX_VALUE, null, Boolean.FALSE, Integer.MAX_VALUE, 40, Boolean.FALSE); System.out.println(readNamespacedPodLog); }
[ "public", "static", "void", "printLog", "(", "String", "namespace", ",", "String", "podName", ")", "throws", "ApiException", "{", "// https://github.com/kubernetes-client/java/blob/master/kubernetes/docs/CoreV1Api.md#readNamespacedPodLog", "String", "readNamespacedPodLog", "=", "...
Print out the Log for specific Pods @param namespace @param podName @throws ApiException
[ "Print", "out", "the", "Log", "for", "specific", "Pods" ]
train
https://github.com/kubernetes-client/java/blob/7413e98bd904f09d1ad00fb60e8c6ff787f3f560/examples/src/main/java/io/kubernetes/client/examples/ExpandedExample.java#L255-L270
SonarSource/sonarqube
server/sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java
ServerPluginRepository.overrideAndRegisterPlugin
private void overrideAndRegisterPlugin(File sourceFile) { """ Move or copy plugin to directory extensions/plugins. If a version of this plugin already exists then it's deleted. """ File destDir = fs.getInstalledPluginsDir(); File destFile = new File(destDir, sourceFile.getName()); if (destFile.exists()) { // plugin with same filename already installed deleteQuietly(destFile); } try { moveFile(sourceFile, destFile); } catch (IOException e) { throw new IllegalStateException(format("Fail to move plugin: %s to %s", sourceFile.getAbsolutePath(), destFile.getAbsolutePath()), e); } PluginInfo info = PluginInfo.create(destFile); PluginInfo existing = pluginInfosByKeys.put(info.getKey(), info); if (existing != null) { if (!existing.getNonNullJarFile().getName().equals(destFile.getName())) { deleteQuietly(existing.getNonNullJarFile()); } LOG.info("Plugin {} [{}] updated to version {}", info.getName(), info.getKey(), info.getVersion()); } else { LOG.info("Plugin {} [{}] installed", info.getName(), info.getKey()); } }
java
private void overrideAndRegisterPlugin(File sourceFile) { File destDir = fs.getInstalledPluginsDir(); File destFile = new File(destDir, sourceFile.getName()); if (destFile.exists()) { // plugin with same filename already installed deleteQuietly(destFile); } try { moveFile(sourceFile, destFile); } catch (IOException e) { throw new IllegalStateException(format("Fail to move plugin: %s to %s", sourceFile.getAbsolutePath(), destFile.getAbsolutePath()), e); } PluginInfo info = PluginInfo.create(destFile); PluginInfo existing = pluginInfosByKeys.put(info.getKey(), info); if (existing != null) { if (!existing.getNonNullJarFile().getName().equals(destFile.getName())) { deleteQuietly(existing.getNonNullJarFile()); } LOG.info("Plugin {} [{}] updated to version {}", info.getName(), info.getKey(), info.getVersion()); } else { LOG.info("Plugin {} [{}] installed", info.getName(), info.getKey()); } }
[ "private", "void", "overrideAndRegisterPlugin", "(", "File", "sourceFile", ")", "{", "File", "destDir", "=", "fs", ".", "getInstalledPluginsDir", "(", ")", ";", "File", "destFile", "=", "new", "File", "(", "destDir", ",", "sourceFile", ".", "getName", "(", "...
Move or copy plugin to directory extensions/plugins. If a version of this plugin already exists then it's deleted.
[ "Move", "or", "copy", "plugin", "to", "directory", "extensions", "/", "plugins", ".", "If", "a", "version", "of", "this", "plugin", "already", "exists", "then", "it", "s", "deleted", "." ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java#L173-L199
jenetics/jenetics
jenetics/src/main/java/io/jenetics/engine/Codecs.java
Codecs.ofVector
public static <A> Codec<ISeq<A>, AnyGene<A>> ofVector( final Supplier<? extends A> supplier, final int length ) { """ Return a scala {@code Codec} with the given allele {@link Supplier} and {@code Chromosome} length. The {@code supplier} is responsible for creating new random alleles. @param <A> the allele type @param supplier the allele-supplier which is used for creating new, random alleles @param length the vector length @return a new {@code Codec} with the given parameters @throws NullPointerException if one of the parameters is {@code null} @throws IllegalArgumentException if the length of the vector is smaller than one. """ return ofVector(supplier, Predicates.TRUE, length); }
java
public static <A> Codec<ISeq<A>, AnyGene<A>> ofVector( final Supplier<? extends A> supplier, final int length ) { return ofVector(supplier, Predicates.TRUE, length); }
[ "public", "static", "<", "A", ">", "Codec", "<", "ISeq", "<", "A", ">", ",", "AnyGene", "<", "A", ">", ">", "ofVector", "(", "final", "Supplier", "<", "?", "extends", "A", ">", "supplier", ",", "final", "int", "length", ")", "{", "return", "ofVecto...
Return a scala {@code Codec} with the given allele {@link Supplier} and {@code Chromosome} length. The {@code supplier} is responsible for creating new random alleles. @param <A> the allele type @param supplier the allele-supplier which is used for creating new, random alleles @param length the vector length @return a new {@code Codec} with the given parameters @throws NullPointerException if one of the parameters is {@code null} @throws IllegalArgumentException if the length of the vector is smaller than one.
[ "Return", "a", "scala", "{", "@code", "Codec", "}", "with", "the", "given", "allele", "{", "@link", "Supplier", "}", "and", "{", "@code", "Chromosome", "}", "length", ".", "The", "{", "@code", "supplier", "}", "is", "responsible", "for", "creating", "new...
train
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/engine/Codecs.java#L458-L463
RestComm/sip-servlets
sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java
FacebookRestClient.photos_upload
public T photos_upload(File photo, Long albumId) throws FacebookException, IOException { """ Uploads a photo to Facebook. @param photo an image file @param albumId the album into which the photo should be uploaded @return a T with the standard Facebook photo information @see <a href="http://wiki.developers.facebook.com/index.php/Photos.upload"> Developers wiki: Photos.upload</a> """ return photos_upload(photo, /*caption*/null, albumId); }
java
public T photos_upload(File photo, Long albumId) throws FacebookException, IOException { return photos_upload(photo, /*caption*/null, albumId); }
[ "public", "T", "photos_upload", "(", "File", "photo", ",", "Long", "albumId", ")", "throws", "FacebookException", ",", "IOException", "{", "return", "photos_upload", "(", "photo", ",", "/*caption*/", "null", ",", "albumId", ")", ";", "}" ]
Uploads a photo to Facebook. @param photo an image file @param albumId the album into which the photo should be uploaded @return a T with the standard Facebook photo information @see <a href="http://wiki.developers.facebook.com/index.php/Photos.upload"> Developers wiki: Photos.upload</a>
[ "Uploads", "a", "photo", "to", "Facebook", "." ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1308-L1311
rubenlagus/TelegramBots
telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/commands/DefaultBotCommand.java
DefaultBotCommand.processMessage
@Override public void processMessage(AbsSender absSender, Message message, String[] arguments) { """ Process the message and execute the command @param absSender absSender to send messages over @param message the message to process @param arguments passed arguments """ execute(absSender, message.getFrom(), message.getChat(), message.getMessageId(), arguments); }
java
@Override public void processMessage(AbsSender absSender, Message message, String[] arguments) { execute(absSender, message.getFrom(), message.getChat(), message.getMessageId(), arguments); }
[ "@", "Override", "public", "void", "processMessage", "(", "AbsSender", "absSender", ",", "Message", "message", ",", "String", "[", "]", "arguments", ")", "{", "execute", "(", "absSender", ",", "message", ".", "getFrom", "(", ")", ",", "message", ".", "getC...
Process the message and execute the command @param absSender absSender to send messages over @param message the message to process @param arguments passed arguments
[ "Process", "the", "message", "and", "execute", "the", "command" ]
train
https://github.com/rubenlagus/TelegramBots/blob/d62354915d7664597a40fd9858f16bce67ef1478/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/commands/DefaultBotCommand.java#L33-L36
sagiegurari/fax4j
src/main/java/org/fax4j/bridge/email/DefaultMailMessageParser.java
DefaultMailMessageParser.getFileInfoFromInputDataImpl
@Override protected FileInfo getFileInfoFromInputDataImpl(Message inputData) { """ This function returns the file info from the request data. @param inputData The input data @return The file info """ FileInfo fileInfo=null; try { //get file info fileInfo=this.getFileInfo(inputData); } catch(MessagingException exception) { throw new FaxException("Unable to extract fax job file data from mail message.",exception); } catch(IOException exception) { throw new FaxException("Unable to extract fax job file data from mail message.",exception); } return fileInfo; }
java
@Override protected FileInfo getFileInfoFromInputDataImpl(Message inputData) { FileInfo fileInfo=null; try { //get file info fileInfo=this.getFileInfo(inputData); } catch(MessagingException exception) { throw new FaxException("Unable to extract fax job file data from mail message.",exception); } catch(IOException exception) { throw new FaxException("Unable to extract fax job file data from mail message.",exception); } return fileInfo; }
[ "@", "Override", "protected", "FileInfo", "getFileInfoFromInputDataImpl", "(", "Message", "inputData", ")", "{", "FileInfo", "fileInfo", "=", "null", ";", "try", "{", "//get file info", "fileInfo", "=", "this", ".", "getFileInfo", "(", "inputData", ")", ";", "}"...
This function returns the file info from the request data. @param inputData The input data @return The file info
[ "This", "function", "returns", "the", "file", "info", "from", "the", "request", "data", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/bridge/email/DefaultMailMessageParser.java#L61-L80
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Message.java
Message.create
public static Message create(final BandwidthClient client, final Map<String, Object> params) throws Exception { """ Factory method to send a message from a params object, given a client instance @param client the client @param params the params @return the message @throws IOException unexpected error """ final String messageUri = client.getUserResourceUri(BandwidthConstants.MESSAGES_URI_PATH); final RestResponse response = client.post(messageUri, params); final String messageId = response.getLocation().substring(client.getPath(messageUri).length() + 1); return get(client, messageId); }
java
public static Message create(final BandwidthClient client, final Map<String, Object> params) throws Exception { final String messageUri = client.getUserResourceUri(BandwidthConstants.MESSAGES_URI_PATH); final RestResponse response = client.post(messageUri, params); final String messageId = response.getLocation().substring(client.getPath(messageUri).length() + 1); return get(client, messageId); }
[ "public", "static", "Message", "create", "(", "final", "BandwidthClient", "client", ",", "final", "Map", "<", "String", ",", "Object", ">", "params", ")", "throws", "Exception", "{", "final", "String", "messageUri", "=", "client", ".", "getUserResourceUri", "(...
Factory method to send a message from a params object, given a client instance @param client the client @param params the params @return the message @throws IOException unexpected error
[ "Factory", "method", "to", "send", "a", "message", "from", "a", "params", "object", "given", "a", "client", "instance" ]
train
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Message.java#L198-L204
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/matrix/GrowingSparseMatrix.java
GrowingSparseMatrix.setRow
public void setRow(int row, DoubleVector data) { """ {@inheritDoc} The size of the matrix will be expanded if either row or col is larger than the largest previously seen row or column value. When the matrix is expanded by either dimension, the values for the new row/column will all be assumed to be zero. """ checkIndices(row, data.length() -1); if (cols <= data.length()) cols = data.length(); Vectors.copy(updateRow(row), data); }
java
public void setRow(int row, DoubleVector data) { checkIndices(row, data.length() -1); if (cols <= data.length()) cols = data.length(); Vectors.copy(updateRow(row), data); }
[ "public", "void", "setRow", "(", "int", "row", ",", "DoubleVector", "data", ")", "{", "checkIndices", "(", "row", ",", "data", ".", "length", "(", ")", "-", "1", ")", ";", "if", "(", "cols", "<=", "data", ".", "length", "(", ")", ")", "cols", "="...
{@inheritDoc} The size of the matrix will be expanded if either row or col is larger than the largest previously seen row or column value. When the matrix is expanded by either dimension, the values for the new row/column will all be assumed to be zero.
[ "{", "@inheritDoc", "}" ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/matrix/GrowingSparseMatrix.java#L272-L279
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java
VirtualMachinesInner.beginRedeployAsync
public Observable<OperationStatusResponseInner> beginRedeployAsync(String resourceGroupName, String vmName) { """ The operation to redeploy a virtual machine. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatusResponseInner object """ return beginRedeployWithServiceResponseAsync(resourceGroupName, vmName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
java
public Observable<OperationStatusResponseInner> beginRedeployAsync(String resourceGroupName, String vmName) { return beginRedeployWithServiceResponseAsync(resourceGroupName, vmName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatusResponseInner", ">", "beginRedeployAsync", "(", "String", "resourceGroupName", ",", "String", "vmName", ")", "{", "return", "beginRedeployWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmName", ")", ".", "map", "(...
The operation to redeploy a virtual machine. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatusResponseInner object
[ "The", "operation", "to", "redeploy", "a", "virtual", "machine", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java#L2407-L2414
sagiegurari/fax4j
src/main/java/org/fax4j/spi/process/ProcessFaxClientSpi.java
ProcessFaxClientSpi.createProcessCommand
protected String createProcessCommand(Enum<?> templateNameEnum,FaxJob faxJob) { """ Creates the process command from the fax job data. @param templateNameEnum The template name @param faxJob The fax job object @return The process command to execute """ //get template name String templateName=templateNameEnum.toString(); //get template String template=this.getTemplate(templateName); String command=null; if(template!=null) { //format template command=this.formatTemplate(template,faxJob); } return command; }
java
protected String createProcessCommand(Enum<?> templateNameEnum,FaxJob faxJob) { //get template name String templateName=templateNameEnum.toString(); //get template String template=this.getTemplate(templateName); String command=null; if(template!=null) { //format template command=this.formatTemplate(template,faxJob); } return command; }
[ "protected", "String", "createProcessCommand", "(", "Enum", "<", "?", ">", "templateNameEnum", ",", "FaxJob", "faxJob", ")", "{", "//get template name", "String", "templateName", "=", "templateNameEnum", ".", "toString", "(", ")", ";", "//get template", "String", ...
Creates the process command from the fax job data. @param templateNameEnum The template name @param faxJob The fax job object @return The process command to execute
[ "Creates", "the", "process", "command", "from", "the", "fax", "job", "data", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/process/ProcessFaxClientSpi.java#L538-L553
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java
AbstractBeanDefinition.injectBeanField
@SuppressWarnings("unused") @Internal protected final void injectBeanField(BeanResolutionContext resolutionContext, DefaultBeanContext context, int index, Object bean) { """ Injects the value of a field of a bean that requires reflection. @param resolutionContext The resolution context @param context The bean context @param index The index of the field @param bean The bean being injected """ FieldInjectionPoint fieldInjectionPoint = fieldInjectionPoints.get(index); boolean isInject = fieldInjectionPoint.getAnnotationMetadata().hasDeclaredAnnotation(Inject.class); try { Object value; if (isInject) { value = getBeanForField(resolutionContext, context, fieldInjectionPoint); } else { value = getValueForField(resolutionContext, context, index); } if (value != null) { //noinspection unchecked fieldInjectionPoint.set(bean, value); } } catch (Throwable e) { if (e instanceof BeanContextException) { throw (BeanContextException) e; } else { throw new DependencyInjectionException(resolutionContext, fieldInjectionPoint, "Error setting field value: " + e.getMessage(), e); } } }
java
@SuppressWarnings("unused") @Internal protected final void injectBeanField(BeanResolutionContext resolutionContext, DefaultBeanContext context, int index, Object bean) { FieldInjectionPoint fieldInjectionPoint = fieldInjectionPoints.get(index); boolean isInject = fieldInjectionPoint.getAnnotationMetadata().hasDeclaredAnnotation(Inject.class); try { Object value; if (isInject) { value = getBeanForField(resolutionContext, context, fieldInjectionPoint); } else { value = getValueForField(resolutionContext, context, index); } if (value != null) { //noinspection unchecked fieldInjectionPoint.set(bean, value); } } catch (Throwable e) { if (e instanceof BeanContextException) { throw (BeanContextException) e; } else { throw new DependencyInjectionException(resolutionContext, fieldInjectionPoint, "Error setting field value: " + e.getMessage(), e); } } }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "@", "Internal", "protected", "final", "void", "injectBeanField", "(", "BeanResolutionContext", "resolutionContext", ",", "DefaultBeanContext", "context", ",", "int", "index", ",", "Object", "bean", ")", "{", "FieldIn...
Injects the value of a field of a bean that requires reflection. @param resolutionContext The resolution context @param context The bean context @param index The index of the field @param bean The bean being injected
[ "Injects", "the", "value", "of", "a", "field", "of", "a", "bean", "that", "requires", "reflection", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java#L706-L729
bq-development/lib-ws
src/main/java/io/corbel/lib/ws/cli/ServiceRunnerWithVersionResource.java
ServiceRunnerWithVersionResource.configureService
@Override protected void configureService(Environment environment, ApplicationContext context) { """ Subclasses have to call super.configureService(...) to register version resource """ super.configureService(environment, context); environment.jersey().register(new ArtifactIdVersionResource(getArtifactId())); }
java
@Override protected void configureService(Environment environment, ApplicationContext context) { super.configureService(environment, context); environment.jersey().register(new ArtifactIdVersionResource(getArtifactId())); }
[ "@", "Override", "protected", "void", "configureService", "(", "Environment", "environment", ",", "ApplicationContext", "context", ")", "{", "super", ".", "configureService", "(", "environment", ",", "context", ")", ";", "environment", ".", "jersey", "(", ")", "...
Subclasses have to call super.configureService(...) to register version resource
[ "Subclasses", "have", "to", "call", "super", ".", "configureService", "(", "...", ")", "to", "register", "version", "resource" ]
train
https://github.com/bq-development/lib-ws/blob/2a32235adcbcea961a9b6bc6ebce2629896d177b/src/main/java/io/corbel/lib/ws/cli/ServiceRunnerWithVersionResource.java#L22-L26
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDataAllValuesFromImpl_CustomFieldSerializer.java
OWLDataAllValuesFromImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLDataAllValuesFromImpl instance) throws SerializationException { """ Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful """ deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLDataAllValuesFromImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLDataAllValuesFromImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", "}" ]
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamReader", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDataAllValuesFromImpl_CustomFieldSerializer.java#L94-L97
tvesalainen/util
util/src/main/java/org/vesalainen/math/AbstractPoint.java
AbstractPoint.searchX
public static final int searchX(Point[] points, Point key) { """ Searches given key in array in x-order @param points @param key @return Like in Arrays.binarySearch @see java.util.Arrays """ return Arrays.binarySearch(points, key, xcomp); }
java
public static final int searchX(Point[] points, Point key) { return Arrays.binarySearch(points, key, xcomp); }
[ "public", "static", "final", "int", "searchX", "(", "Point", "[", "]", "points", ",", "Point", "key", ")", "{", "return", "Arrays", ".", "binarySearch", "(", "points", ",", "key", ",", "xcomp", ")", ";", "}" ]
Searches given key in array in x-order @param points @param key @return Like in Arrays.binarySearch @see java.util.Arrays
[ "Searches", "given", "key", "in", "array", "in", "x", "-", "order" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/AbstractPoint.java#L293-L296
mpetazzoni/ttorrent
ttorrent-client/src/main/java/com/turn/ttorrent/client/CommunicationManager.java
CommunicationManager.addTorrent
public TorrentManager addTorrent(String dotTorrentFilePath, String downloadDirPath, PieceStorageFactory pieceStorageFactory) throws IOException { """ Adds torrent to storage with specified {@link PieceStorageFactory}. It can be used for skipping initial validation of data @param dotTorrentFilePath path to torrent metadata file @param downloadDirPath path to directory where downloaded files are placed @param pieceStorageFactory factory for creating {@link PieceStorage}. @return {@link TorrentManager} instance for monitoring torrent state @throws IOException if IO error occurs in reading metadata file """ return addTorrent(dotTorrentFilePath, downloadDirPath, pieceStorageFactory, Collections.<TorrentListener>emptyList()); }
java
public TorrentManager addTorrent(String dotTorrentFilePath, String downloadDirPath, PieceStorageFactory pieceStorageFactory) throws IOException { return addTorrent(dotTorrentFilePath, downloadDirPath, pieceStorageFactory, Collections.<TorrentListener>emptyList()); }
[ "public", "TorrentManager", "addTorrent", "(", "String", "dotTorrentFilePath", ",", "String", "downloadDirPath", ",", "PieceStorageFactory", "pieceStorageFactory", ")", "throws", "IOException", "{", "return", "addTorrent", "(", "dotTorrentFilePath", ",", "downloadDirPath", ...
Adds torrent to storage with specified {@link PieceStorageFactory}. It can be used for skipping initial validation of data @param dotTorrentFilePath path to torrent metadata file @param downloadDirPath path to directory where downloaded files are placed @param pieceStorageFactory factory for creating {@link PieceStorage}. @return {@link TorrentManager} instance for monitoring torrent state @throws IOException if IO error occurs in reading metadata file
[ "Adds", "torrent", "to", "storage", "with", "specified", "{", "@link", "PieceStorageFactory", "}", ".", "It", "can", "be", "used", "for", "skipping", "initial", "validation", "of", "data" ]
train
https://github.com/mpetazzoni/ttorrent/blob/ecd0e6caf853b63393c4ab63cfd8f20114f73f70/ttorrent-client/src/main/java/com/turn/ttorrent/client/CommunicationManager.java#L156-L160
OpenNMS/newts
cassandra/search/src/main/java/org/opennms/newts/cassandra/search/EscapableResourceIdSplitter.java
EscapableResourceIdSplitter.splitIdIntoElements
@Override public List<String> splitIdIntoElements(String id) { """ Splits a resource id into a list of elements. Elements in the resource id are delimited by colons (:). Colons can be escaped by a backslash (\:). Backslashes are escaped when paired (\\). For example, the following resources id: a:b\::c\\:d will result in the following elements: a, b:, c\, d @param id the resource id @return a list of elements """ Preconditions.checkNotNull(id, "id argument"); List<String> elements = Lists.newArrayList(); int startOfNextElement = 0; int numConsecutiveEscapeCharacters = 0; char[] idChars = id.toCharArray(); for (int i = 0; i < idChars.length; i++) { // If we hit a separator, only treat it as such if it is preceded by an even number of escape characters if(idChars[i] == SEPARATOR && numConsecutiveEscapeCharacters % 2 == 0) { maybeAddSanitizedElement(new String(idChars, startOfNextElement, i-startOfNextElement), elements); startOfNextElement = i+1; } if (idChars[i] == '\\') { numConsecutiveEscapeCharacters++; } else { numConsecutiveEscapeCharacters = 0; } } maybeAddSanitizedElement(new String(idChars, startOfNextElement, idChars.length - startOfNextElement), elements); return elements; }
java
@Override public List<String> splitIdIntoElements(String id) { Preconditions.checkNotNull(id, "id argument"); List<String> elements = Lists.newArrayList(); int startOfNextElement = 0; int numConsecutiveEscapeCharacters = 0; char[] idChars = id.toCharArray(); for (int i = 0; i < idChars.length; i++) { // If we hit a separator, only treat it as such if it is preceded by an even number of escape characters if(idChars[i] == SEPARATOR && numConsecutiveEscapeCharacters % 2 == 0) { maybeAddSanitizedElement(new String(idChars, startOfNextElement, i-startOfNextElement), elements); startOfNextElement = i+1; } if (idChars[i] == '\\') { numConsecutiveEscapeCharacters++; } else { numConsecutiveEscapeCharacters = 0; } } maybeAddSanitizedElement(new String(idChars, startOfNextElement, idChars.length - startOfNextElement), elements); return elements; }
[ "@", "Override", "public", "List", "<", "String", ">", "splitIdIntoElements", "(", "String", "id", ")", "{", "Preconditions", ".", "checkNotNull", "(", "id", ",", "\"id argument\"", ")", ";", "List", "<", "String", ">", "elements", "=", "Lists", ".", "newA...
Splits a resource id into a list of elements. Elements in the resource id are delimited by colons (:). Colons can be escaped by a backslash (\:). Backslashes are escaped when paired (\\). For example, the following resources id: a:b\::c\\:d will result in the following elements: a, b:, c\, d @param id the resource id @return a list of elements
[ "Splits", "a", "resource", "id", "into", "a", "list", "of", "elements", "." ]
train
https://github.com/OpenNMS/newts/blob/e1b53169d8a7fbc5e9fb826da08d602f628063ea/cassandra/search/src/main/java/org/opennms/newts/cassandra/search/EscapableResourceIdSplitter.java#L50-L74
alkacon/opencms-core
src/org/opencms/i18n/CmsLocaleManager.java
CmsLocaleManager.getMainLocale
public static Locale getMainLocale(CmsObject cms, CmsResource res) { """ Utility method to get the primary locale for a given resource.<p> @param cms the current CMS context @param res the resource for which the locale should be retrieved @return the primary locale """ CmsLocaleManager localeManager = OpenCms.getLocaleManager(); List<Locale> defaultLocales = null; // must switch project id in stored Admin context to match current project String defaultNames = null; try { defaultNames = cms.readPropertyObject(res, CmsPropertyDefinition.PROPERTY_LOCALE, true).getValue(); } catch (CmsException e) { LOG.warn(e.getLocalizedMessage(), e); } if (defaultNames != null) { defaultLocales = localeManager.getAvailableLocales(defaultNames); } if ((defaultLocales == null) || (defaultLocales.isEmpty())) { // no default locales could be determined defaultLocales = localeManager.getDefaultLocales(); } Locale locale; // return the first default locale name if ((defaultLocales != null) && (defaultLocales.size() > 0)) { locale = defaultLocales.get(0); } else { locale = CmsLocaleManager.getDefaultLocale(); } return locale; }
java
public static Locale getMainLocale(CmsObject cms, CmsResource res) { CmsLocaleManager localeManager = OpenCms.getLocaleManager(); List<Locale> defaultLocales = null; // must switch project id in stored Admin context to match current project String defaultNames = null; try { defaultNames = cms.readPropertyObject(res, CmsPropertyDefinition.PROPERTY_LOCALE, true).getValue(); } catch (CmsException e) { LOG.warn(e.getLocalizedMessage(), e); } if (defaultNames != null) { defaultLocales = localeManager.getAvailableLocales(defaultNames); } if ((defaultLocales == null) || (defaultLocales.isEmpty())) { // no default locales could be determined defaultLocales = localeManager.getDefaultLocales(); } Locale locale; // return the first default locale name if ((defaultLocales != null) && (defaultLocales.size() > 0)) { locale = defaultLocales.get(0); } else { locale = CmsLocaleManager.getDefaultLocale(); } return locale; }
[ "public", "static", "Locale", "getMainLocale", "(", "CmsObject", "cms", ",", "CmsResource", "res", ")", "{", "CmsLocaleManager", "localeManager", "=", "OpenCms", ".", "getLocaleManager", "(", ")", ";", "List", "<", "Locale", ">", "defaultLocales", "=", "null", ...
Utility method to get the primary locale for a given resource.<p> @param cms the current CMS context @param res the resource for which the locale should be retrieved @return the primary locale
[ "Utility", "method", "to", "get", "the", "primary", "locale", "for", "a", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsLocaleManager.java#L322-L349
lastaflute/lastaflute
src/main/java/org/lastaflute/web/LastaAction.java
LastaAction.redirectById
protected HtmlResponse redirectById(Class<?> actionType, Number... ids) { """ Redirect to the action (index method) by the IDs on URL. <pre> <span style="color: #3F7E5E">// e.g. /member/edit/3/</span> return redirectById(MemberEditAction.class, 3); <span style="color: #3F7E5E">// e.g. /member/edit/3/197/</span> return redirectById(MemberEditAction.class, 3, 197); <span style="color: #3F7E5E">// e.g. /member/3/</span> return redirectById(MemberAction.class, 3); </pre> @param actionType The class type of action that it redirects to. (NotNull) @param ids The varying array for IDs. (NotNull) @return The HTML response for redirect. (NotNull) """ assertArgumentNotNull("actionType", actionType); assertArgumentNotNull("ids", ids); final Object[] objAry = (Object[]) ids; // to suppress warning return redirectWith(actionType, moreUrl(objAry)); }
java
protected HtmlResponse redirectById(Class<?> actionType, Number... ids) { assertArgumentNotNull("actionType", actionType); assertArgumentNotNull("ids", ids); final Object[] objAry = (Object[]) ids; // to suppress warning return redirectWith(actionType, moreUrl(objAry)); }
[ "protected", "HtmlResponse", "redirectById", "(", "Class", "<", "?", ">", "actionType", ",", "Number", "...", "ids", ")", "{", "assertArgumentNotNull", "(", "\"actionType\"", ",", "actionType", ")", ";", "assertArgumentNotNull", "(", "\"ids\"", ",", "ids", ")", ...
Redirect to the action (index method) by the IDs on URL. <pre> <span style="color: #3F7E5E">// e.g. /member/edit/3/</span> return redirectById(MemberEditAction.class, 3); <span style="color: #3F7E5E">// e.g. /member/edit/3/197/</span> return redirectById(MemberEditAction.class, 3, 197); <span style="color: #3F7E5E">// e.g. /member/3/</span> return redirectById(MemberAction.class, 3); </pre> @param actionType The class type of action that it redirects to. (NotNull) @param ids The varying array for IDs. (NotNull) @return The HTML response for redirect. (NotNull)
[ "Redirect", "to", "the", "action", "(", "index", "method", ")", "by", "the", "IDs", "on", "URL", ".", "<pre", ">", "<span", "style", "=", "color", ":", "#3F7E5E", ">", "//", "e", ".", "g", ".", "/", "member", "/", "edit", "/", "3", "/", "<", "/...
train
https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/web/LastaAction.java#L283-L288
flow/commons
src/main/java/com/flowpowered/commons/LogicUtil.java
LogicUtil.equalsAny
public static <A, B> boolean equalsAny(A object, B... objects) { """ Checks if the object equals one of the other objects given @param object to check @param objects to use equals against @return True if one of the objects equal the object """ for (B o : objects) { if (bothNullOrEqual(o, object)) { return true; } } return false; }
java
public static <A, B> boolean equalsAny(A object, B... objects) { for (B o : objects) { if (bothNullOrEqual(o, object)) { return true; } } return false; }
[ "public", "static", "<", "A", ",", "B", ">", "boolean", "equalsAny", "(", "A", "object", ",", "B", "...", "objects", ")", "{", "for", "(", "B", "o", ":", "objects", ")", "{", "if", "(", "bothNullOrEqual", "(", "o", ",", "object", ")", ")", "{", ...
Checks if the object equals one of the other objects given @param object to check @param objects to use equals against @return True if one of the objects equal the object
[ "Checks", "if", "the", "object", "equals", "one", "of", "the", "other", "objects", "given" ]
train
https://github.com/flow/commons/blob/0690efdac06fd728fcd7e9cf10f2b1319379c45b/src/main/java/com/flowpowered/commons/LogicUtil.java#L58-L65
JOML-CI/JOML
src/org/joml/Matrix4x3f.java
Matrix4x3f.rotateLocal
public Matrix4x3f rotateLocal(float ang, float x, float y, float z, Matrix4x3f dest) { """ Pre-multiply a rotation to this matrix by rotating the given amount of radians about the specified <code>(x, y, z)</code> axis and store the result in <code>dest</code>. <p> The axis described by the three components needs to be a unit vector. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>R * M</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>R * M * v</code>, the rotation will be applied last! <p> In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use {@link #rotation(float, float, float, float) rotation()}. <p> Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle">http://en.wikipedia.org</a> @see #rotation(float, float, float, float) @param ang the angle in radians @param x the x component of the axis @param y the y component of the axis @param z the z component of the axis @param dest will hold the result @return dest """ float s = (float) Math.sin(ang); float c = (float) Math.cosFromSin(s, ang); float C = 1.0f - c; float xx = x * x, xy = x * y, xz = x * z; float yy = y * y, yz = y * z; float zz = z * z; float lm00 = xx * C + c; float lm01 = xy * C + z * s; float lm02 = xz * C - y * s; float lm10 = xy * C - z * s; float lm11 = yy * C + c; float lm12 = yz * C + x * s; float lm20 = xz * C + y * s; float lm21 = yz * C - x * s; float lm22 = zz * C + c; float nm00 = lm00 * m00 + lm10 * m01 + lm20 * m02; float nm01 = lm01 * m00 + lm11 * m01 + lm21 * m02; float nm02 = lm02 * m00 + lm12 * m01 + lm22 * m02; float nm10 = lm00 * m10 + lm10 * m11 + lm20 * m12; float nm11 = lm01 * m10 + lm11 * m11 + lm21 * m12; float nm12 = lm02 * m10 + lm12 * m11 + lm22 * m12; float nm20 = lm00 * m20 + lm10 * m21 + lm20 * m22; float nm21 = lm01 * m20 + lm11 * m21 + lm21 * m22; float nm22 = lm02 * m20 + lm12 * m21 + lm22 * m22; float nm30 = lm00 * m30 + lm10 * m31 + lm20 * m32; float nm31 = lm01 * m30 + lm11 * m31 + lm21 * m32; float nm32 = lm02 * m30 + lm12 * m31 + lm22 * m32; dest.m00 = nm00; dest.m01 = nm01; dest.m02 = nm02; dest.m10 = nm10; dest.m11 = nm11; dest.m12 = nm12; dest.m20 = nm20; dest.m21 = nm21; dest.m22 = nm22; dest.m30 = nm30; dest.m31 = nm31; dest.m32 = nm32; dest.properties = properties & ~(PROPERTY_IDENTITY | PROPERTY_TRANSLATION); return dest; }
java
public Matrix4x3f rotateLocal(float ang, float x, float y, float z, Matrix4x3f dest) { float s = (float) Math.sin(ang); float c = (float) Math.cosFromSin(s, ang); float C = 1.0f - c; float xx = x * x, xy = x * y, xz = x * z; float yy = y * y, yz = y * z; float zz = z * z; float lm00 = xx * C + c; float lm01 = xy * C + z * s; float lm02 = xz * C - y * s; float lm10 = xy * C - z * s; float lm11 = yy * C + c; float lm12 = yz * C + x * s; float lm20 = xz * C + y * s; float lm21 = yz * C - x * s; float lm22 = zz * C + c; float nm00 = lm00 * m00 + lm10 * m01 + lm20 * m02; float nm01 = lm01 * m00 + lm11 * m01 + lm21 * m02; float nm02 = lm02 * m00 + lm12 * m01 + lm22 * m02; float nm10 = lm00 * m10 + lm10 * m11 + lm20 * m12; float nm11 = lm01 * m10 + lm11 * m11 + lm21 * m12; float nm12 = lm02 * m10 + lm12 * m11 + lm22 * m12; float nm20 = lm00 * m20 + lm10 * m21 + lm20 * m22; float nm21 = lm01 * m20 + lm11 * m21 + lm21 * m22; float nm22 = lm02 * m20 + lm12 * m21 + lm22 * m22; float nm30 = lm00 * m30 + lm10 * m31 + lm20 * m32; float nm31 = lm01 * m30 + lm11 * m31 + lm21 * m32; float nm32 = lm02 * m30 + lm12 * m31 + lm22 * m32; dest.m00 = nm00; dest.m01 = nm01; dest.m02 = nm02; dest.m10 = nm10; dest.m11 = nm11; dest.m12 = nm12; dest.m20 = nm20; dest.m21 = nm21; dest.m22 = nm22; dest.m30 = nm30; dest.m31 = nm31; dest.m32 = nm32; dest.properties = properties & ~(PROPERTY_IDENTITY | PROPERTY_TRANSLATION); return dest; }
[ "public", "Matrix4x3f", "rotateLocal", "(", "float", "ang", ",", "float", "x", ",", "float", "y", ",", "float", "z", ",", "Matrix4x3f", "dest", ")", "{", "float", "s", "=", "(", "float", ")", "Math", ".", "sin", "(", "ang", ")", ";", "float", "c", ...
Pre-multiply a rotation to this matrix by rotating the given amount of radians about the specified <code>(x, y, z)</code> axis and store the result in <code>dest</code>. <p> The axis described by the three components needs to be a unit vector. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>R * M</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>R * M * v</code>, the rotation will be applied last! <p> In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use {@link #rotation(float, float, float, float) rotation()}. <p> Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle">http://en.wikipedia.org</a> @see #rotation(float, float, float, float) @param ang the angle in radians @param x the x component of the axis @param y the y component of the axis @param z the z component of the axis @param dest will hold the result @return dest
[ "Pre", "-", "multiply", "a", "rotation", "to", "this", "matrix", "by", "rotating", "the", "given", "amount", "of", "radians", "about", "the", "specified", "<code", ">", "(", "x", "y", "z", ")", "<", "/", "code", ">", "axis", "and", "store", "the", "r...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L4138-L4180
metamx/java-util
src/main/java/com/metamx/common/lifecycle/Lifecycle.java
Lifecycle.addHandler
public void addHandler(Handler handler, Stage stage) { """ Adds a handler to the Lifecycle. If the lifecycle has already been started, it throws an {@link ISE} @param handler The hander to add to the lifecycle @param stage The stage to add the lifecycle at @throws ISE indicates that the lifecycle has already been started and thus cannot be added to """ synchronized (handlers) { if (started.get()) { throw new ISE("Cannot add a handler after the Lifecycle has started, it doesn't work that way."); } handlers.get(stage).add(handler); } }
java
public void addHandler(Handler handler, Stage stage) { synchronized (handlers) { if (started.get()) { throw new ISE("Cannot add a handler after the Lifecycle has started, it doesn't work that way."); } handlers.get(stage).add(handler); } }
[ "public", "void", "addHandler", "(", "Handler", "handler", ",", "Stage", "stage", ")", "{", "synchronized", "(", "handlers", ")", "{", "if", "(", "started", ".", "get", "(", ")", ")", "{", "throw", "new", "ISE", "(", "\"Cannot add a handler after the Lifecyc...
Adds a handler to the Lifecycle. If the lifecycle has already been started, it throws an {@link ISE} @param handler The hander to add to the lifecycle @param stage The stage to add the lifecycle at @throws ISE indicates that the lifecycle has already been started and thus cannot be added to
[ "Adds", "a", "handler", "to", "the", "Lifecycle", ".", "If", "the", "lifecycle", "has", "already", "been", "started", "it", "throws", "an", "{", "@link", "ISE", "}" ]
train
https://github.com/metamx/java-util/blob/9d204043da1136e94fb2e2d63e3543a29bf54b4d/src/main/java/com/metamx/common/lifecycle/Lifecycle.java#L150-L158
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/PlainChangesLogImpl.java
PlainChangesLogImpl.createCopy
public static PlainChangesLogImpl createCopy(List<ItemState> items, String pairId, PlainChangesLog originalLog) { """ Creates a new instance of {@link PlainChangesLogImpl} by copying metadata from originalLog instance with Items and PairID provided. Metadata will be copied excluding PairID. @param items @param originalLog @return """ if (originalLog.getSession() != null) { return new PlainChangesLogImpl(items, originalLog.getSession().getId(), originalLog.getEventType(), pairId, originalLog.getSession()); } return new PlainChangesLogImpl(items, originalLog.getSessionId(), originalLog.getEventType(), pairId, null); }
java
public static PlainChangesLogImpl createCopy(List<ItemState> items, String pairId, PlainChangesLog originalLog) { if (originalLog.getSession() != null) { return new PlainChangesLogImpl(items, originalLog.getSession().getId(), originalLog.getEventType(), pairId, originalLog.getSession()); } return new PlainChangesLogImpl(items, originalLog.getSessionId(), originalLog.getEventType(), pairId, null); }
[ "public", "static", "PlainChangesLogImpl", "createCopy", "(", "List", "<", "ItemState", ">", "items", ",", "String", "pairId", ",", "PlainChangesLog", "originalLog", ")", "{", "if", "(", "originalLog", ".", "getSession", "(", ")", "!=", "null", ")", "{", "re...
Creates a new instance of {@link PlainChangesLogImpl} by copying metadata from originalLog instance with Items and PairID provided. Metadata will be copied excluding PairID. @param items @param originalLog @return
[ "Creates", "a", "new", "instance", "of", "{", "@link", "PlainChangesLogImpl", "}", "by", "copying", "metadata", "from", "originalLog", "instance", "with", "Items", "and", "PairID", "provided", ".", "Metadata", "will", "be", "copied", "excluding", "PairID", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/PlainChangesLogImpl.java#L348-L356
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/CollectionLiteralsTypeComputer.java
CollectionLiteralsTypeComputer.isSubtypeButNotSynonym
protected boolean isSubtypeButNotSynonym(LightweightTypeReference expectation, Class<?> clazz) { """ Same as {@link LightweightTypeReference#isSubtypeOf(Class)} but does not accept synonym types as subtypes. """ if (expectation.isType(clazz)) { return true; } ITypeReferenceOwner owner = expectation.getOwner(); JvmType declaredType = owner.getServices().getTypeReferences().findDeclaredType(clazz, owner.getContextResourceSet()); if (declaredType == null) { return false; } LightweightTypeReference superType = owner.newParameterizedTypeReference(declaredType); // don't allow synonyms, e.g. Iterable is not considered to be a supertype of Functions.Function0 boolean result = superType.isAssignableFrom(expectation.getRawTypeReference(), new TypeConformanceComputationArgument(false, false, true, true, false, false)); return result; }
java
protected boolean isSubtypeButNotSynonym(LightweightTypeReference expectation, Class<?> clazz) { if (expectation.isType(clazz)) { return true; } ITypeReferenceOwner owner = expectation.getOwner(); JvmType declaredType = owner.getServices().getTypeReferences().findDeclaredType(clazz, owner.getContextResourceSet()); if (declaredType == null) { return false; } LightweightTypeReference superType = owner.newParameterizedTypeReference(declaredType); // don't allow synonyms, e.g. Iterable is not considered to be a supertype of Functions.Function0 boolean result = superType.isAssignableFrom(expectation.getRawTypeReference(), new TypeConformanceComputationArgument(false, false, true, true, false, false)); return result; }
[ "protected", "boolean", "isSubtypeButNotSynonym", "(", "LightweightTypeReference", "expectation", ",", "Class", "<", "?", ">", "clazz", ")", "{", "if", "(", "expectation", ".", "isType", "(", "clazz", ")", ")", "{", "return", "true", ";", "}", "ITypeReferenceO...
Same as {@link LightweightTypeReference#isSubtypeOf(Class)} but does not accept synonym types as subtypes.
[ "Same", "as", "{" ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/CollectionLiteralsTypeComputer.java#L352-L366
samskivert/samskivert
src/main/java/com/samskivert/jdbc/JDBCUtil.java
JDBCUtil.dropIndex
public static boolean dropIndex (Connection conn, String table, String cname, String iname) throws SQLException { """ Removes a named index from the specified table. @return true if the index was dropped, false if it did not exist in the first place. """ if (!tableContainsIndex(conn, table, cname, iname)) { return false; } String update = "ALTER TABLE " + table + " DROP INDEX " + iname; PreparedStatement stmt = null; try { stmt = conn.prepareStatement(update); if (stmt.executeUpdate() == 1) { log.info("Database index '" + iname + "' removed from table '" + table + "'."); } } finally { close(stmt); } return true; }
java
public static boolean dropIndex (Connection conn, String table, String cname, String iname) throws SQLException { if (!tableContainsIndex(conn, table, cname, iname)) { return false; } String update = "ALTER TABLE " + table + " DROP INDEX " + iname; PreparedStatement stmt = null; try { stmt = conn.prepareStatement(update); if (stmt.executeUpdate() == 1) { log.info("Database index '" + iname + "' removed from table '" + table + "'."); } } finally { close(stmt); } return true; }
[ "public", "static", "boolean", "dropIndex", "(", "Connection", "conn", ",", "String", "table", ",", "String", "cname", ",", "String", "iname", ")", "throws", "SQLException", "{", "if", "(", "!", "tableContainsIndex", "(", "conn", ",", "table", ",", "cname", ...
Removes a named index from the specified table. @return true if the index was dropped, false if it did not exist in the first place.
[ "Removes", "a", "named", "index", "from", "the", "specified", "table", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/jdbc/JDBCUtil.java#L560-L578
Azure/azure-sdk-for-java
common/azure-common/src/main/java/com/azure/common/implementation/serializer/HttpResponseBodyDecoder.java
HttpResponseBodyDecoder.deserializePage
private static Object deserializePage(String value, Type resultType, Type wireType, SerializerAdapter serializer, SerializerEncoding encoding) throws IOException { """ Deserializes a response body as a Page<T> given that {@param wireType} is either: 1. A type that implements the interface 2. Is of {@link Page} @param value The string to deserialize @param resultType The type T, of the page contents. @param wireType The {@link Type} that either is, or implements {@link Page} @param serializer The serializer used to deserialize the value. @param encoding Encoding used to deserialize string @return An object representing an instance of {@param wireType} @throws IOException if the serializer is unable to deserialize the value. """ final Type wireResponseType; if (wireType == Page.class) { // If the type is the 'Page' interface [i.e. `@ReturnValueWireType(Page.class)`], we will use the 'ItemPage' class instead. wireResponseType = TypeUtil.createParameterizedType(ItemPage.class, resultType); } else { wireResponseType = wireType; } return serializer.deserialize(value, wireResponseType, encoding); }
java
private static Object deserializePage(String value, Type resultType, Type wireType, SerializerAdapter serializer, SerializerEncoding encoding) throws IOException { final Type wireResponseType; if (wireType == Page.class) { // If the type is the 'Page' interface [i.e. `@ReturnValueWireType(Page.class)`], we will use the 'ItemPage' class instead. wireResponseType = TypeUtil.createParameterizedType(ItemPage.class, resultType); } else { wireResponseType = wireType; } return serializer.deserialize(value, wireResponseType, encoding); }
[ "private", "static", "Object", "deserializePage", "(", "String", "value", ",", "Type", "resultType", ",", "Type", "wireType", ",", "SerializerAdapter", "serializer", ",", "SerializerEncoding", "encoding", ")", "throws", "IOException", "{", "final", "Type", "wireResp...
Deserializes a response body as a Page<T> given that {@param wireType} is either: 1. A type that implements the interface 2. Is of {@link Page} @param value The string to deserialize @param resultType The type T, of the page contents. @param wireType The {@link Type} that either is, or implements {@link Page} @param serializer The serializer used to deserialize the value. @param encoding Encoding used to deserialize string @return An object representing an instance of {@param wireType} @throws IOException if the serializer is unable to deserialize the value.
[ "Deserializes", "a", "response", "body", "as", "a", "Page<T", ">", "given", "that", "{", "@param", "wireType", "}", "is", "either", ":", "1", ".", "A", "type", "that", "implements", "the", "interface", "2", ".", "Is", "of", "{", "@link", "Page", "}" ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/common/azure-common/src/main/java/com/azure/common/implementation/serializer/HttpResponseBodyDecoder.java#L237-L248
JodaOrg/joda-time
src/main/java/org/joda/time/Period.java
Period.plusMinutes
public Period plusMinutes(int minutes) { """ Returns a new period plus the specified number of minutes added. <p> This period instance is immutable and unaffected by this method call. @param minutes the amount of minutes to add, may be negative @return the new period plus the increased minutes @throws UnsupportedOperationException if the field is not supported """ if (minutes == 0) { return this; } int[] values = getValues(); // cloned getPeriodType().addIndexedField(this, PeriodType.MINUTE_INDEX, values, minutes); return new Period(values, getPeriodType()); }
java
public Period plusMinutes(int minutes) { if (minutes == 0) { return this; } int[] values = getValues(); // cloned getPeriodType().addIndexedField(this, PeriodType.MINUTE_INDEX, values, minutes); return new Period(values, getPeriodType()); }
[ "public", "Period", "plusMinutes", "(", "int", "minutes", ")", "{", "if", "(", "minutes", "==", "0", ")", "{", "return", "this", ";", "}", "int", "[", "]", "values", "=", "getValues", "(", ")", ";", "// cloned", "getPeriodType", "(", ")", ".", "addIn...
Returns a new period plus the specified number of minutes added. <p> This period instance is immutable and unaffected by this method call. @param minutes the amount of minutes to add, may be negative @return the new period plus the increased minutes @throws UnsupportedOperationException if the field is not supported
[ "Returns", "a", "new", "period", "plus", "the", "specified", "number", "of", "minutes", "added", ".", "<p", ">", "This", "period", "instance", "is", "immutable", "and", "unaffected", "by", "this", "method", "call", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Period.java#L1159-L1166
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/Transaction.java
Transaction.addSignedInput
public TransactionInput addSignedInput(TransactionOutput output, ECKey signingKey) { """ Adds an input that points to the given output and contains a valid signature for it, calculated using the signing key. """ return addSignedInput(output.getOutPointFor(), output.getScriptPubKey(), signingKey); }
java
public TransactionInput addSignedInput(TransactionOutput output, ECKey signingKey) { return addSignedInput(output.getOutPointFor(), output.getScriptPubKey(), signingKey); }
[ "public", "TransactionInput", "addSignedInput", "(", "TransactionOutput", "output", ",", "ECKey", "signingKey", ")", "{", "return", "addSignedInput", "(", "output", ".", "getOutPointFor", "(", ")", ",", "output", ".", "getScriptPubKey", "(", ")", ",", "signingKey"...
Adds an input that points to the given output and contains a valid signature for it, calculated using the signing key.
[ "Adds", "an", "input", "that", "points", "to", "the", "given", "output", "and", "contains", "a", "valid", "signature", "for", "it", "calculated", "using", "the", "signing", "key", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L1001-L1003
radkovo/SwingBox
src/main/java/org/fit/cssbox/swingbox/view/ElementBoxView.java
ElementBoxView.getChildAllocation
@Override public Shape getChildAllocation(int index, Shape a) { """ /*protected void paintChild(Graphics g, View v, Shape rect, int index) { System.err.println("Painting " + v); v.paint(g, rect); } """ // zvyraznovanie ! if (a != null /* && isAllocationValid() */) { Box tmpBox = getBox(getView(index)); Rectangle alloc = (a instanceof Rectangle) ? (Rectangle) a : a.getBounds(); //alloc.setBounds(tmpBox.getAbsoluteBounds()); alloc.setBounds(getCompleteBoxAllocation(tmpBox)); return alloc; } return null; }
java
@Override public Shape getChildAllocation(int index, Shape a) { // zvyraznovanie ! if (a != null /* && isAllocationValid() */) { Box tmpBox = getBox(getView(index)); Rectangle alloc = (a instanceof Rectangle) ? (Rectangle) a : a.getBounds(); //alloc.setBounds(tmpBox.getAbsoluteBounds()); alloc.setBounds(getCompleteBoxAllocation(tmpBox)); return alloc; } return null; }
[ "@", "Override", "public", "Shape", "getChildAllocation", "(", "int", "index", ",", "Shape", "a", ")", "{", "// zvyraznovanie !", "if", "(", "a", "!=", "null", "/* && isAllocationValid() */", ")", "{", "Box", "tmpBox", "=", "getBox", "(", "getView", "(", "in...
/*protected void paintChild(Graphics g, View v, Shape rect, int index) { System.err.println("Painting " + v); v.paint(g, rect); }
[ "/", "*", "protected", "void", "paintChild", "(", "Graphics", "g", "View", "v", "Shape", "rect", "int", "index", ")", "{", "System", ".", "err", ".", "println", "(", "Painting", "+", "v", ")", ";", "v", ".", "paint", "(", "g", "rect", ")", ";", "...
train
https://github.com/radkovo/SwingBox/blob/ff370f3dc54d248e4c8852c17513618c83c25984/src/main/java/org/fit/cssbox/swingbox/view/ElementBoxView.java#L475-L489
vkostyukov/la4j
src/main/java/org/la4j/Vectors.java
Vectors.asMulFunction
public static VectorFunction asMulFunction(final double arg) { """ Creates a mul function that multiplies given {@code value} by it's argument. @param arg a value to be multiplied by function's argument @return a closure that does {@code _ * _} """ return new VectorFunction() { @Override public double evaluate(int i, double value) { return value * arg; } }; }
java
public static VectorFunction asMulFunction(final double arg) { return new VectorFunction() { @Override public double evaluate(int i, double value) { return value * arg; } }; }
[ "public", "static", "VectorFunction", "asMulFunction", "(", "final", "double", "arg", ")", "{", "return", "new", "VectorFunction", "(", ")", "{", "@", "Override", "public", "double", "evaluate", "(", "int", "i", ",", "double", "value", ")", "{", "return", ...
Creates a mul function that multiplies given {@code value} by it's argument. @param arg a value to be multiplied by function's argument @return a closure that does {@code _ * _}
[ "Creates", "a", "mul", "function", "that", "multiplies", "given", "{", "@code", "value", "}", "by", "it", "s", "argument", "." ]
train
https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Vectors.java#L186-L193
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRepositoryAuditor.java
XDSRepositoryAuditor.auditProvideAndRegisterEvent
protected void auditProvideAndRegisterEvent ( IHETransactionEventTypeCodes transaction, RFC3881EventOutcomeCodes eventOutcome, String sourceUserId, String sourceIpAddress, String userName, String repositoryEndpointUri, String submissionSetUniqueId, String patientId, List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { """ Generically sends audit messages for XDS Document Repository Provide And Register Document Set events @param transaction The specific IHE Transaction (ITI-15 or ITI-41) @param eventOutcome The event outcome indicator @param sourceUserId The Active Participant UserID for the document consumer (if using WS-Addressing) @param sourceIpAddress The IP address of the document source that initiated the transaction @param repositoryEndpointUri The Web service endpoint URI for this document repository @param submissionSetUniqueId The UniqueID of the Submission Set registered @param patientId The Patient Id that this submission pertains to @param purposesOfUse purpose of use codes (may be taken from XUA token) @param userRoles roles of the human user (may be taken from XUA token) """ ImportEvent importEvent = new ImportEvent(false, eventOutcome, transaction, purposesOfUse); importEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); importEvent.addSourceActiveParticipant(sourceUserId, null, null, sourceIpAddress, true); if (!EventUtils.isEmptyOrNull(userName)) { importEvent.addHumanRequestorActiveParticipant(userName, null, userName, userRoles); } importEvent.addDestinationActiveParticipant(repositoryEndpointUri, getSystemAltUserId(), null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false); if (!EventUtils.isEmptyOrNull(patientId)) { importEvent.addPatientParticipantObject(patientId); } importEvent.addSubmissionSetParticipantObject(submissionSetUniqueId); audit(importEvent); }
java
protected void auditProvideAndRegisterEvent ( IHETransactionEventTypeCodes transaction, RFC3881EventOutcomeCodes eventOutcome, String sourceUserId, String sourceIpAddress, String userName, String repositoryEndpointUri, String submissionSetUniqueId, String patientId, List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { ImportEvent importEvent = new ImportEvent(false, eventOutcome, transaction, purposesOfUse); importEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); importEvent.addSourceActiveParticipant(sourceUserId, null, null, sourceIpAddress, true); if (!EventUtils.isEmptyOrNull(userName)) { importEvent.addHumanRequestorActiveParticipant(userName, null, userName, userRoles); } importEvent.addDestinationActiveParticipant(repositoryEndpointUri, getSystemAltUserId(), null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false); if (!EventUtils.isEmptyOrNull(patientId)) { importEvent.addPatientParticipantObject(patientId); } importEvent.addSubmissionSetParticipantObject(submissionSetUniqueId); audit(importEvent); }
[ "protected", "void", "auditProvideAndRegisterEvent", "(", "IHETransactionEventTypeCodes", "transaction", ",", "RFC3881EventOutcomeCodes", "eventOutcome", ",", "String", "sourceUserId", ",", "String", "sourceIpAddress", ",", "String", "userName", ",", "String", "repositoryEndp...
Generically sends audit messages for XDS Document Repository Provide And Register Document Set events @param transaction The specific IHE Transaction (ITI-15 or ITI-41) @param eventOutcome The event outcome indicator @param sourceUserId The Active Participant UserID for the document consumer (if using WS-Addressing) @param sourceIpAddress The IP address of the document source that initiated the transaction @param repositoryEndpointUri The Web service endpoint URI for this document repository @param submissionSetUniqueId The UniqueID of the Submission Set registered @param patientId The Patient Id that this submission pertains to @param purposesOfUse purpose of use codes (may be taken from XUA token) @param userRoles roles of the human user (may be taken from XUA token)
[ "Generically", "sends", "audit", "messages", "for", "XDS", "Document", "Repository", "Provide", "And", "Register", "Document", "Set", "events" ]
train
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRepositoryAuditor.java#L378-L402
andrehertwig/admintool
admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/contoller/ATSecDBAbctractController.java
ATSecDBAbctractController.handleException
protected <E extends Throwable, V extends ATSecDBValidator> Set<ATError> handleException(E e, Log logger, V validator, String key, String suffix, String defaultMessagePrefix) { """ logging the error and creates {@link ATError} list output @param e @param logger @param validator @param key @param suffix @param defaultMessagePrefix @return """ return handleException(e, logger, validator, key, suffix, defaultMessagePrefix, new Object[] {}); }
java
protected <E extends Throwable, V extends ATSecDBValidator> Set<ATError> handleException(E e, Log logger, V validator, String key, String suffix, String defaultMessagePrefix) { return handleException(e, logger, validator, key, suffix, defaultMessagePrefix, new Object[] {}); }
[ "protected", "<", "E", "extends", "Throwable", ",", "V", "extends", "ATSecDBValidator", ">", "Set", "<", "ATError", ">", "handleException", "(", "E", "e", ",", "Log", "logger", ",", "V", "validator", ",", "String", "key", ",", "String", "suffix", ",", "S...
logging the error and creates {@link ATError} list output @param e @param logger @param validator @param key @param suffix @param defaultMessagePrefix @return
[ "logging", "the", "error", "and", "creates", "{", "@link", "ATError", "}", "list", "output" ]
train
https://github.com/andrehertwig/admintool/blob/6d391e2d26969b70e3ccabfc34202abe8d915080/admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/contoller/ATSecDBAbctractController.java#L52-L55
jfinal/jfinal
src/main/java/com/jfinal/plugin/redis/Cache.java
Cache.zcount
public Long zcount(Object key, double min, double max) { """ 返回有序集 key 中, score 值在 min 和 max 之间(默认包括 score 值等于 min 或 max )的成员的数量。 关于参数 min 和 max 的详细使用方法,请参考 ZRANGEBYSCORE 命令。 """ Jedis jedis = getJedis(); try { return jedis.zcount(keyToBytes(key), min, max); } finally {close(jedis);} }
java
public Long zcount(Object key, double min, double max) { Jedis jedis = getJedis(); try { return jedis.zcount(keyToBytes(key), min, max); } finally {close(jedis);} }
[ "public", "Long", "zcount", "(", "Object", "key", ",", "double", "min", ",", "double", "max", ")", "{", "Jedis", "jedis", "=", "getJedis", "(", ")", ";", "try", "{", "return", "jedis", ".", "zcount", "(", "keyToBytes", "(", "key", ")", ",", "min", ...
返回有序集 key 中, score 值在 min 和 max 之间(默认包括 score 值等于 min 或 max )的成员的数量。 关于参数 min 和 max 的详细使用方法,请参考 ZRANGEBYSCORE 命令。
[ "返回有序集", "key", "中,", "score", "值在", "min", "和", "max", "之间", "(", "默认包括", "score", "值等于", "min", "或", "max", ")", "的成员的数量。", "关于参数", "min", "和", "max", "的详细使用方法,请参考", "ZRANGEBYSCORE", "命令。" ]
train
https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/redis/Cache.java#L1030-L1036
Esri/geometry-api-java
src/main/java/com/esri/core/geometry/Transformation2D.java
Transformation2D.setRotate
void setRotate(double angle_in_Radians, Point2D rotationCenter) { """ Sets this transformation to be a rotation around point rotationCenter. When the axis Y is directed up and X is directed to the right, the positive angle corresponds to the anti-clockwise rotation. When the axis Y is directed down and X is directed to the right, the positive angle corresponds to the clockwise rotation. @param angle_in_Radians The rotation angle in radian. @param rotationCenter The center point of the rotation. """ setRotate(Math.cos(angle_in_Radians), Math.sin(angle_in_Radians), rotationCenter); }
java
void setRotate(double angle_in_Radians, Point2D rotationCenter) { setRotate(Math.cos(angle_in_Radians), Math.sin(angle_in_Radians), rotationCenter); }
[ "void", "setRotate", "(", "double", "angle_in_Radians", ",", "Point2D", "rotationCenter", ")", "{", "setRotate", "(", "Math", ".", "cos", "(", "angle_in_Radians", ")", ",", "Math", ".", "sin", "(", "angle_in_Radians", ")", ",", "rotationCenter", ")", ";", "}...
Sets this transformation to be a rotation around point rotationCenter. When the axis Y is directed up and X is directed to the right, the positive angle corresponds to the anti-clockwise rotation. When the axis Y is directed down and X is directed to the right, the positive angle corresponds to the clockwise rotation. @param angle_in_Radians The rotation angle in radian. @param rotationCenter The center point of the rotation.
[ "Sets", "this", "transformation", "to", "be", "a", "rotation", "around", "point", "rotationCenter", "." ]
train
https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/Transformation2D.java#L709-L712
voldemort/voldemort
src/java/voldemort/utils/UpdateClusterUtils.java
UpdateClusterUtils.updateCluster
public static Cluster updateCluster(Cluster currentCluster, List<Node> updatedNodeList) { """ Concatenates the list of current nodes in the given cluster with the new nodes provided and returns an updated cluster metadata. <br> If the nodes being updated already exist in the current metadata, we take the updated ones @param currentCluster The current cluster metadata @param updatedNodeList The list of new nodes to be added @return New cluster metadata containing both the sets of nodes """ List<Node> newNodeList = new ArrayList<Node>(updatedNodeList); for(Node currentNode: currentCluster.getNodes()) { if(!updatedNodeList.contains(currentNode)) newNodeList.add(currentNode); } Collections.sort(newNodeList); return new Cluster(currentCluster.getName(), newNodeList, Lists.newArrayList(currentCluster.getZones())); }
java
public static Cluster updateCluster(Cluster currentCluster, List<Node> updatedNodeList) { List<Node> newNodeList = new ArrayList<Node>(updatedNodeList); for(Node currentNode: currentCluster.getNodes()) { if(!updatedNodeList.contains(currentNode)) newNodeList.add(currentNode); } Collections.sort(newNodeList); return new Cluster(currentCluster.getName(), newNodeList, Lists.newArrayList(currentCluster.getZones())); }
[ "public", "static", "Cluster", "updateCluster", "(", "Cluster", "currentCluster", ",", "List", "<", "Node", ">", "updatedNodeList", ")", "{", "List", "<", "Node", ">", "newNodeList", "=", "new", "ArrayList", "<", "Node", ">", "(", "updatedNodeList", ")", ";"...
Concatenates the list of current nodes in the given cluster with the new nodes provided and returns an updated cluster metadata. <br> If the nodes being updated already exist in the current metadata, we take the updated ones @param currentCluster The current cluster metadata @param updatedNodeList The list of new nodes to be added @return New cluster metadata containing both the sets of nodes
[ "Concatenates", "the", "list", "of", "current", "nodes", "in", "the", "given", "cluster", "with", "the", "new", "nodes", "provided", "and", "returns", "an", "updated", "cluster", "metadata", ".", "<br", ">", "If", "the", "nodes", "being", "updated", "already...
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/UpdateClusterUtils.java#L120-L131
james-hu/jabb-core
src/main/java/net/sf/jabb/camel/RegistryUtility.java
RegistryUtility.addDecoder
@SuppressWarnings("unchecked") static public void addDecoder(CamelContext context, String name, ChannelUpstreamHandler decoder) { """ Adds an Netty decoder to Registry.<br> 向Registry中增加一个给Netty用的decoder。 @param context The CamelContext must be based on CombinedRegistry, otherwise ClassCastException will be thrown.<br> 这个context必须是采用CombinedRegistry类型的Registry的,否则会抛出格式转换异常。 @param name Name of the decoder in Registry.<br> decoder在Registry中的名字。 @param decoder The decoder that will be used by Netty.<br> 将被Netty用到的decoder。 """ CombinedRegistry registry = getCombinedRegistry(context); addCodecOnly(registry, name, decoder); List<ChannelUpstreamHandler> decoders; Object o = registry.lookup(NAME_DECODERS); if (o == null){ decoders = new ArrayList<ChannelUpstreamHandler>(); registry.getDefaultSimpleRegistry().put(NAME_DECODERS, decoders); }else{ try{ decoders = (List<ChannelUpstreamHandler>)o; }catch(Exception e){ throw new IllegalArgumentException("Preserved name '" + NAME_DECODERS + "' is already being used by others in at least one of the registries."); } } decoders.add(decoder); }
java
@SuppressWarnings("unchecked") static public void addDecoder(CamelContext context, String name, ChannelUpstreamHandler decoder){ CombinedRegistry registry = getCombinedRegistry(context); addCodecOnly(registry, name, decoder); List<ChannelUpstreamHandler> decoders; Object o = registry.lookup(NAME_DECODERS); if (o == null){ decoders = new ArrayList<ChannelUpstreamHandler>(); registry.getDefaultSimpleRegistry().put(NAME_DECODERS, decoders); }else{ try{ decoders = (List<ChannelUpstreamHandler>)o; }catch(Exception e){ throw new IllegalArgumentException("Preserved name '" + NAME_DECODERS + "' is already being used by others in at least one of the registries."); } } decoders.add(decoder); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "static", "public", "void", "addDecoder", "(", "CamelContext", "context", ",", "String", "name", ",", "ChannelUpstreamHandler", "decoder", ")", "{", "CombinedRegistry", "registry", "=", "getCombinedRegistry", "(", ...
Adds an Netty decoder to Registry.<br> 向Registry中增加一个给Netty用的decoder。 @param context The CamelContext must be based on CombinedRegistry, otherwise ClassCastException will be thrown.<br> 这个context必须是采用CombinedRegistry类型的Registry的,否则会抛出格式转换异常。 @param name Name of the decoder in Registry.<br> decoder在Registry中的名字。 @param decoder The decoder that will be used by Netty.<br> 将被Netty用到的decoder。
[ "Adds", "an", "Netty", "decoder", "to", "Registry", ".", "<br", ">", "向Registry中增加一个给Netty用的decoder。" ]
train
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/camel/RegistryUtility.java#L106-L124
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/actions/PurgeEndpointAction.java
PurgeEndpointAction.resolveEndpointName
protected Endpoint resolveEndpointName(String endpointName) { """ Resolve the endpoint by name. @param endpointName the name to resolve @return the Endpoint object """ try { return beanFactory.getBean(endpointName, Endpoint.class); } catch (BeansException e) { throw new CitrusRuntimeException(String.format("Unable to resolve endpoint for name '%s'", endpointName), e); } }
java
protected Endpoint resolveEndpointName(String endpointName) { try { return beanFactory.getBean(endpointName, Endpoint.class); } catch (BeansException e) { throw new CitrusRuntimeException(String.format("Unable to resolve endpoint for name '%s'", endpointName), e); } }
[ "protected", "Endpoint", "resolveEndpointName", "(", "String", "endpointName", ")", "{", "try", "{", "return", "beanFactory", ".", "getBean", "(", "endpointName", ",", "Endpoint", ".", "class", ")", ";", "}", "catch", "(", "BeansException", "e", ")", "{", "t...
Resolve the endpoint by name. @param endpointName the name to resolve @return the Endpoint object
[ "Resolve", "the", "endpoint", "by", "name", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/actions/PurgeEndpointAction.java#L144-L150
acromusashi/acromusashi-stream-ml
src/main/java/acromusashi/stream/ml/anomaly/lof/LofCalculator.java
LofCalculator.calculateLofWithoutUpdate
public static double calculateLofWithoutUpdate(int kn, LofPoint targetPoint, LofDataSet dataSet) { """ 指定したK値、対象点、データセットを基に局所外れ係数スコアを算出する。<br> 本メソッド呼び出しによってデータセットの更新は行われない。<br> 学習データの更新を伴わないため、高速に処理が可能となっている。 @param kn K値 @param targetPoint 対象点 @param dataSet 学習データセット @return LOFスコア """ // 対象点のK距離、K距離近傍を算出する。 KDistanceResult kResult = calculateKDistance(kn, targetPoint, dataSet); LofPoint tmpPoint = targetPoint.deepCopy(); tmpPoint.setkDistance(kResult.getkDistance()); tmpPoint.setkDistanceNeighbor(kResult.getkDistanceNeighbor()); updateLrd(tmpPoint, dataSet); // 対象の局所外れ係数を算出する。 double lof = calculateLof(tmpPoint, dataSet); return lof; }
java
public static double calculateLofWithoutUpdate(int kn, LofPoint targetPoint, LofDataSet dataSet) { // 対象点のK距離、K距離近傍を算出する。 KDistanceResult kResult = calculateKDistance(kn, targetPoint, dataSet); LofPoint tmpPoint = targetPoint.deepCopy(); tmpPoint.setkDistance(kResult.getkDistance()); tmpPoint.setkDistanceNeighbor(kResult.getkDistanceNeighbor()); updateLrd(tmpPoint, dataSet); // 対象の局所外れ係数を算出する。 double lof = calculateLof(tmpPoint, dataSet); return lof; }
[ "public", "static", "double", "calculateLofWithoutUpdate", "(", "int", "kn", ",", "LofPoint", "targetPoint", ",", "LofDataSet", "dataSet", ")", "{", "// 対象点のK距離、K距離近傍を算出する。", "KDistanceResult", "kResult", "=", "calculateKDistance", "(", "kn", ",", "targetPoint", ",", ...
指定したK値、対象点、データセットを基に局所外れ係数スコアを算出する。<br> 本メソッド呼び出しによってデータセットの更新は行われない。<br> 学習データの更新を伴わないため、高速に処理が可能となっている。 @param kn K値 @param targetPoint 対象点 @param dataSet 学習データセット @return LOFスコア
[ "指定したK値、対象点、データセットを基に局所外れ係数スコアを算出する。<br", ">", "本メソッド呼び出しによってデータセットの更新は行われない。<br", ">", "学習データの更新を伴わないため、高速に処理が可能となっている。" ]
train
https://github.com/acromusashi/acromusashi-stream-ml/blob/26d6799a917cacda68e21d506c75cfeb17d832a6/src/main/java/acromusashi/stream/ml/anomaly/lof/LofCalculator.java#L117-L131
JOML-CI/JOML
src/org/joml/Matrix4x3d.java
Matrix4x3d.setOrtho2D
public Matrix4x3d setOrtho2D(double left, double right, double bottom, double top) { """ Set this matrix to be an orthographic projection transformation for a right-handed coordinate system. <p> This method is equivalent to calling {@link #setOrtho(double, double, double, double, double, double) setOrtho()} with <code>zNear=-1</code> and <code>zFar=+1</code>. <p> In order to apply the orthographic projection to an already existing transformation, use {@link #ortho2D(double, double, double, double) ortho2D()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #setOrtho(double, double, double, double, double, double) @see #ortho2D(double, double, double, double) @param left the distance from the center to the left frustum edge @param right the distance from the center to the right frustum edge @param bottom the distance from the center to the bottom frustum edge @param top the distance from the center to the top frustum edge @return this """ m00 = 2.0 / (right - left); m01 = 0.0; m02 = 0.0; m10 = 0.0; m11 = 2.0 / (top - bottom); m12 = 0.0; m20 = 0.0; m21 = 0.0; m22 = -1.0; m30 = -(right + left) / (right - left); m31 = -(top + bottom) / (top - bottom); m32 = 0.0; properties = 0; return this; }
java
public Matrix4x3d setOrtho2D(double left, double right, double bottom, double top) { m00 = 2.0 / (right - left); m01 = 0.0; m02 = 0.0; m10 = 0.0; m11 = 2.0 / (top - bottom); m12 = 0.0; m20 = 0.0; m21 = 0.0; m22 = -1.0; m30 = -(right + left) / (right - left); m31 = -(top + bottom) / (top - bottom); m32 = 0.0; properties = 0; return this; }
[ "public", "Matrix4x3d", "setOrtho2D", "(", "double", "left", ",", "double", "right", ",", "double", "bottom", ",", "double", "top", ")", "{", "m00", "=", "2.0", "/", "(", "right", "-", "left", ")", ";", "m01", "=", "0.0", ";", "m02", "=", "0.0", ";...
Set this matrix to be an orthographic projection transformation for a right-handed coordinate system. <p> This method is equivalent to calling {@link #setOrtho(double, double, double, double, double, double) setOrtho()} with <code>zNear=-1</code> and <code>zFar=+1</code>. <p> In order to apply the orthographic projection to an already existing transformation, use {@link #ortho2D(double, double, double, double) ortho2D()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #setOrtho(double, double, double, double, double, double) @see #ortho2D(double, double, double, double) @param left the distance from the center to the left frustum edge @param right the distance from the center to the right frustum edge @param bottom the distance from the center to the bottom frustum edge @param top the distance from the center to the top frustum edge @return this
[ "Set", "this", "matrix", "to", "be", "an", "orthographic", "projection", "transformation", "for", "a", "right", "-", "handed", "coordinate", "system", ".", "<p", ">", "This", "method", "is", "equivalent", "to", "calling", "{", "@link", "#setOrtho", "(", "dou...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3d.java#L7712-L7727
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/base/base_resource.java
base_resource.add_resource
protected base_resource[] add_resource(nitro_service service, options option) throws Exception { """ Use this method to perform a add operation on MPS resource. @param service nitro_service object. @param option options class object. @return status of the operation performed. @throws Exception """ if (!service.isLogin() && !get_object_type().equals("login")) service.login(); String request = resource_to_string(service, option); return post_data(service, request); }
java
protected base_resource[] add_resource(nitro_service service, options option) throws Exception { if (!service.isLogin() && !get_object_type().equals("login")) service.login(); String request = resource_to_string(service, option); return post_data(service, request); }
[ "protected", "base_resource", "[", "]", "add_resource", "(", "nitro_service", "service", ",", "options", "option", ")", "throws", "Exception", "{", "if", "(", "!", "service", ".", "isLogin", "(", ")", "&&", "!", "get_object_type", "(", ")", ".", "equals", ...
Use this method to perform a add operation on MPS resource. @param service nitro_service object. @param option options class object. @return status of the operation performed. @throws Exception
[ "Use", "this", "method", "to", "perform", "a", "add", "operation", "on", "MPS", "resource", "." ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/base/base_resource.java#L216-L223
jMotif/SAX
src/main/java/net/seninp/jmotif/distance/EuclideanDistance.java
EuclideanDistance.seriesDistance
public double seriesDistance(double[][] series1, double[][] series2) throws Exception { """ Calculates Euclidean distance between two multi-dimensional time-series of equal length. @param series1 The first series. @param series2 The second series. @return The eclidean distance. @throws Exception if error occures. """ if (series1.length == series2.length) { Double res = 0D; for (int i = 0; i < series1.length; i++) { res = res + distance2(series1[i], series2[i]); } return Math.sqrt(res); } else { throw new Exception("Exception in Euclidean distance: array lengths are not equal"); } }
java
public double seriesDistance(double[][] series1, double[][] series2) throws Exception { if (series1.length == series2.length) { Double res = 0D; for (int i = 0; i < series1.length; i++) { res = res + distance2(series1[i], series2[i]); } return Math.sqrt(res); } else { throw new Exception("Exception in Euclidean distance: array lengths are not equal"); } }
[ "public", "double", "seriesDistance", "(", "double", "[", "]", "[", "]", "series1", ",", "double", "[", "]", "[", "]", "series2", ")", "throws", "Exception", "{", "if", "(", "series1", ".", "length", "==", "series2", ".", "length", ")", "{", "Double", ...
Calculates Euclidean distance between two multi-dimensional time-series of equal length. @param series1 The first series. @param series2 The second series. @return The eclidean distance. @throws Exception if error occures.
[ "Calculates", "Euclidean", "distance", "between", "two", "multi", "-", "dimensional", "time", "-", "series", "of", "equal", "length", "." ]
train
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/distance/EuclideanDistance.java#L119-L130
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/GenericLogicDiscoverer.java
GenericLogicDiscoverer.findOperationsConsumingAll
@Override public Map<URI, MatchResult> findOperationsConsumingAll(Set<URI> inputTypes) { """ Discover registered operations that consume all the types of input provided. That is, all those that have as input the types provided. All the input types should be matched to different inputs. @param inputTypes the types of input to be consumed @return a Set containing all the matching operations. If there are no solutions, the Set should be empty, not null. """ return findOperationsConsumingAll(inputTypes, LogicConceptMatchType.Plugin); }
java
@Override public Map<URI, MatchResult> findOperationsConsumingAll(Set<URI> inputTypes) { return findOperationsConsumingAll(inputTypes, LogicConceptMatchType.Plugin); }
[ "@", "Override", "public", "Map", "<", "URI", ",", "MatchResult", ">", "findOperationsConsumingAll", "(", "Set", "<", "URI", ">", "inputTypes", ")", "{", "return", "findOperationsConsumingAll", "(", "inputTypes", ",", "LogicConceptMatchType", ".", "Plugin", ")", ...
Discover registered operations that consume all the types of input provided. That is, all those that have as input the types provided. All the input types should be matched to different inputs. @param inputTypes the types of input to be consumed @return a Set containing all the matching operations. If there are no solutions, the Set should be empty, not null.
[ "Discover", "registered", "operations", "that", "consume", "all", "the", "types", "of", "input", "provided", ".", "That", "is", "all", "those", "that", "have", "as", "input", "the", "types", "provided", ".", "All", "the", "input", "types", "should", "be", ...
train
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/GenericLogicDiscoverer.java#L248-L251
svenkubiak/mangooio
mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java
Validator.expectMatch
public void expectMatch(String name, String anotherName, String message) { """ Validates to fields to (case-insensitive) match @param name The field to check @param anotherName The field to check against @param message A custom error message instead of the default one """ String value = Optional.ofNullable(get(name)).orElse(""); String anotherValue = Optional.ofNullable(get(anotherName)).orElse(""); if (( StringUtils.isBlank(value) && StringUtils.isBlank(anotherValue) ) || ( StringUtils.isNotBlank(value) && !value.equalsIgnoreCase(anotherValue) )) { addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.MATCH_KEY.name(), name, anotherName))); } }
java
public void expectMatch(String name, String anotherName, String message) { String value = Optional.ofNullable(get(name)).orElse(""); String anotherValue = Optional.ofNullable(get(anotherName)).orElse(""); if (( StringUtils.isBlank(value) && StringUtils.isBlank(anotherValue) ) || ( StringUtils.isNotBlank(value) && !value.equalsIgnoreCase(anotherValue) )) { addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.MATCH_KEY.name(), name, anotherName))); } }
[ "public", "void", "expectMatch", "(", "String", "name", ",", "String", "anotherName", ",", "String", "message", ")", "{", "String", "value", "=", "Optional", ".", "ofNullable", "(", "get", "(", "name", ")", ")", ".", "orElse", "(", "\"\"", ")", ";", "S...
Validates to fields to (case-insensitive) match @param name The field to check @param anotherName The field to check against @param message A custom error message instead of the default one
[ "Validates", "to", "fields", "to", "(", "case", "-", "insensitive", ")", "match" ]
train
https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java#L208-L215
BorderTech/wcomponents
wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/menu/TreeMenuExample.java
TreeMenuExample.buildTreeMenuWithDecoratedLabel
private WMenu buildTreeMenuWithDecoratedLabel() { """ Tree menu containing image in the items. This example demonstrates creating {@link WSubMenu} and {@link WMenuItem} components with {@link WDecoratedLabel}. @return menu with a decorated label """ WMenu menu = new WMenu(WMenu.MenuType.TREE); WDecoratedLabel dLabel = new WDecoratedLabel(null, new WText("Settings Menu"), new WImage( "/image/settings.png", "settings")); WSubMenu settings = new WSubMenu(dLabel); settings.setMode(WSubMenu.MenuMode.LAZY); settings.setAccessKey('S'); menu.add(settings); settings.add(new WMenuItem(new WDecoratedLabel(null, new WText("Account Settings"), new WImage("/image/user-properties.png", "user properties")))); settings.add(new WMenuItem(new WDecoratedLabel(null, new WText("Personal Details"), new WImage("/image/user.png", "user")))); WSubMenu addressSub = new WSubMenu(new WDecoratedLabel(null, new WText("Address Details"), new WImage("/image/address-book-open.png", "address book"))); addressSub.setMode(WSubMenu.MenuMode.LAZY); settings.add(addressSub); addressSub.add(new WMenuItem(new WDecoratedLabel(null, new WText("Home Address"), new WImage("/image/home.png", "home")))); addressSub.add(new WMenuItem(new WDecoratedLabel(null, new WText("Work Address"), new WImage("/image/wrench.png", "work")))); addressSub.add(new WMenuItem(new WDecoratedLabel(null, new WText("Postal Address"), new WImage("/image/mail-post.png", "postal")))); WMenuItem itemWithIcon = new WMenuItem("Help"); itemWithIcon.setAction(new Action() { @Override public void execute(final ActionEvent event) { // do something } }); itemWithIcon.setHtmlClass(HtmlClassProperties.ICON_HELP_BEFORE); menu.add(itemWithIcon); return menu; }
java
private WMenu buildTreeMenuWithDecoratedLabel() { WMenu menu = new WMenu(WMenu.MenuType.TREE); WDecoratedLabel dLabel = new WDecoratedLabel(null, new WText("Settings Menu"), new WImage( "/image/settings.png", "settings")); WSubMenu settings = new WSubMenu(dLabel); settings.setMode(WSubMenu.MenuMode.LAZY); settings.setAccessKey('S'); menu.add(settings); settings.add(new WMenuItem(new WDecoratedLabel(null, new WText("Account Settings"), new WImage("/image/user-properties.png", "user properties")))); settings.add(new WMenuItem(new WDecoratedLabel(null, new WText("Personal Details"), new WImage("/image/user.png", "user")))); WSubMenu addressSub = new WSubMenu(new WDecoratedLabel(null, new WText("Address Details"), new WImage("/image/address-book-open.png", "address book"))); addressSub.setMode(WSubMenu.MenuMode.LAZY); settings.add(addressSub); addressSub.add(new WMenuItem(new WDecoratedLabel(null, new WText("Home Address"), new WImage("/image/home.png", "home")))); addressSub.add(new WMenuItem(new WDecoratedLabel(null, new WText("Work Address"), new WImage("/image/wrench.png", "work")))); addressSub.add(new WMenuItem(new WDecoratedLabel(null, new WText("Postal Address"), new WImage("/image/mail-post.png", "postal")))); WMenuItem itemWithIcon = new WMenuItem("Help"); itemWithIcon.setAction(new Action() { @Override public void execute(final ActionEvent event) { // do something } }); itemWithIcon.setHtmlClass(HtmlClassProperties.ICON_HELP_BEFORE); menu.add(itemWithIcon); return menu; }
[ "private", "WMenu", "buildTreeMenuWithDecoratedLabel", "(", ")", "{", "WMenu", "menu", "=", "new", "WMenu", "(", "WMenu", ".", "MenuType", ".", "TREE", ")", ";", "WDecoratedLabel", "dLabel", "=", "new", "WDecoratedLabel", "(", "null", ",", "new", "WText", "(...
Tree menu containing image in the items. This example demonstrates creating {@link WSubMenu} and {@link WMenuItem} components with {@link WDecoratedLabel}. @return menu with a decorated label
[ "Tree", "menu", "containing", "image", "in", "the", "items", ".", "This", "example", "demonstrates", "creating", "{", "@link", "WSubMenu", "}", "and", "{", "@link", "WMenuItem", "}", "components", "with", "{", "@link", "WDecoratedLabel", "}", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/menu/TreeMenuExample.java#L152-L187
aws/aws-sdk-java
aws-java-sdk-kms/src/main/java/com/amazonaws/services/kms/model/ReEncryptRequest.java
ReEncryptRequest.withSourceEncryptionContext
public ReEncryptRequest withSourceEncryptionContext(java.util.Map<String, String> sourceEncryptionContext) { """ <p> Encryption context used to encrypt and decrypt the data specified in the <code>CiphertextBlob</code> parameter. </p> @param sourceEncryptionContext Encryption context used to encrypt and decrypt the data specified in the <code>CiphertextBlob</code> parameter. @return Returns a reference to this object so that method calls can be chained together. """ setSourceEncryptionContext(sourceEncryptionContext); return this; }
java
public ReEncryptRequest withSourceEncryptionContext(java.util.Map<String, String> sourceEncryptionContext) { setSourceEncryptionContext(sourceEncryptionContext); return this; }
[ "public", "ReEncryptRequest", "withSourceEncryptionContext", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "sourceEncryptionContext", ")", "{", "setSourceEncryptionContext", "(", "sourceEncryptionContext", ")", ";", "return", "this", ";", ...
<p> Encryption context used to encrypt and decrypt the data specified in the <code>CiphertextBlob</code> parameter. </p> @param sourceEncryptionContext Encryption context used to encrypt and decrypt the data specified in the <code>CiphertextBlob</code> parameter. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Encryption", "context", "used", "to", "encrypt", "and", "decrypt", "the", "data", "specified", "in", "the", "<code", ">", "CiphertextBlob<", "/", "code", ">", "parameter", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-kms/src/main/java/com/amazonaws/services/kms/model/ReEncryptRequest.java#L206-L209
grpc/grpc-java
api/src/main/java/io/grpc/MethodDescriptor.java
MethodDescriptor.generateFullMethodName
public static String generateFullMethodName(String fullServiceName, String methodName) { """ Generate the fully qualified method name. This matches the name @param fullServiceName the fully qualified service name that is prefixed with the package name @param methodName the short method name @since 1.0.0 """ return checkNotNull(fullServiceName, "fullServiceName") + "/" + checkNotNull(methodName, "methodName"); }
java
public static String generateFullMethodName(String fullServiceName, String methodName) { return checkNotNull(fullServiceName, "fullServiceName") + "/" + checkNotNull(methodName, "methodName"); }
[ "public", "static", "String", "generateFullMethodName", "(", "String", "fullServiceName", ",", "String", "methodName", ")", "{", "return", "checkNotNull", "(", "fullServiceName", ",", "\"fullServiceName\"", ")", "+", "\"/\"", "+", "checkNotNull", "(", "methodName", ...
Generate the fully qualified method name. This matches the name @param fullServiceName the fully qualified service name that is prefixed with the package name @param methodName the short method name @since 1.0.0
[ "Generate", "the", "fully", "qualified", "method", "name", ".", "This", "matches", "the", "name" ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/api/src/main/java/io/grpc/MethodDescriptor.java#L386-L390
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/objdetect/Yolo2OutputLayer.java
Yolo2OutputLayer.getProbabilityMatrix
public INDArray getProbabilityMatrix(INDArray networkOutput, int example, int classNumber) { """ Get the probability matrix (probability of the specified class, assuming an object is present, for all x/y positions), from the network output activations array @param networkOutput Network output activations @param example Example number, in minibatch @param classNumber Class number @return Confidence matrix """ //Input format: [minibatch, 5B+C, H, W], with order [x,y,w,h,c] //Therefore: probabilities for class I is at depths 5B + classNumber val bbs = layerConf().getBoundingBoxes().size(0); INDArray conf = networkOutput.get(point(example), point(5*bbs + classNumber), all(), all()); return conf; }
java
public INDArray getProbabilityMatrix(INDArray networkOutput, int example, int classNumber){ //Input format: [minibatch, 5B+C, H, W], with order [x,y,w,h,c] //Therefore: probabilities for class I is at depths 5B + classNumber val bbs = layerConf().getBoundingBoxes().size(0); INDArray conf = networkOutput.get(point(example), point(5*bbs + classNumber), all(), all()); return conf; }
[ "public", "INDArray", "getProbabilityMatrix", "(", "INDArray", "networkOutput", ",", "int", "example", ",", "int", "classNumber", ")", "{", "//Input format: [minibatch, 5B+C, H, W], with order [x,y,w,h,c]", "//Therefore: probabilities for class I is at depths 5B + classNumber", "val"...
Get the probability matrix (probability of the specified class, assuming an object is present, for all x/y positions), from the network output activations array @param networkOutput Network output activations @param example Example number, in minibatch @param classNumber Class number @return Confidence matrix
[ "Get", "the", "probability", "matrix", "(", "probability", "of", "the", "specified", "class", "assuming", "an", "object", "is", "present", "for", "all", "x", "/", "y", "positions", ")", "from", "the", "network", "output", "activations", "array" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/objdetect/Yolo2OutputLayer.java#L666-L673
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/css/CSSClassManager.java
CSSClassManager.getClass
public CSSClass getClass(String name, Object owner) throws CSSNamingConflict { """ Retrieve a single class by name and owner @param name Class name @param owner Class owner @return existing (old) class @throws CSSNamingConflict if an owner was specified and doesn't match """ CSSClass existing = store.get(name); // Not found. if (existing == null) { return null; } // Different owner if (owner != null && existing.getOwner() != owner) { throw new CSSNamingConflict("CSS class naming conflict between "+owner.toString()+" and "+existing.getOwner().toString()); } return existing; }
java
public CSSClass getClass(String name, Object owner) throws CSSNamingConflict { CSSClass existing = store.get(name); // Not found. if (existing == null) { return null; } // Different owner if (owner != null && existing.getOwner() != owner) { throw new CSSNamingConflict("CSS class naming conflict between "+owner.toString()+" and "+existing.getOwner().toString()); } return existing; }
[ "public", "CSSClass", "getClass", "(", "String", "name", ",", "Object", "owner", ")", "throws", "CSSNamingConflict", "{", "CSSClass", "existing", "=", "store", ".", "get", "(", "name", ")", ";", "// Not found.", "if", "(", "existing", "==", "null", ")", "{...
Retrieve a single class by name and owner @param name Class name @param owner Class owner @return existing (old) class @throws CSSNamingConflict if an owner was specified and doesn't match
[ "Retrieve", "a", "single", "class", "by", "name", "and", "owner" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/css/CSSClassManager.java#L83-L94
igniterealtime/Smack
smack-core/src/main/java/org/jivesoftware/smack/packet/Message.java
Message.addBody
public Body addBody(String language, String body) { """ Adds a body with a corresponding language. @param language the language of the body being added. @param body the body being added to the message. @return the new {@link org.jivesoftware.smack.packet.Message.Body} @throws NullPointerException if the body is null, a null pointer exception is thrown @since 3.0.2 """ language = determineLanguage(language); removeBody(language); Body messageBody = new Body(language, body); addExtension(messageBody); return messageBody; }
java
public Body addBody(String language, String body) { language = determineLanguage(language); removeBody(language); Body messageBody = new Body(language, body); addExtension(messageBody); return messageBody; }
[ "public", "Body", "addBody", "(", "String", "language", ",", "String", "body", ")", "{", "language", "=", "determineLanguage", "(", "language", ")", ";", "removeBody", "(", "language", ")", ";", "Body", "messageBody", "=", "new", "Body", "(", "language", "...
Adds a body with a corresponding language. @param language the language of the body being added. @param body the body being added to the message. @return the new {@link org.jivesoftware.smack.packet.Message.Body} @throws NullPointerException if the body is null, a null pointer exception is thrown @since 3.0.2
[ "Adds", "a", "body", "with", "a", "corresponding", "language", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/packet/Message.java#L380-L388
Azure/azure-sdk-for-java
common/azure-common-auth/src/main/java/com/azure/common/auth/credentials/DelegatedTokenCredentials.java
DelegatedTokenCredentials.fromFile
public static DelegatedTokenCredentials fromFile(File authFile, String redirectUrl) throws IOException { """ Creates a new instance of the DelegatedTokenCredentials from an auth file. @param authFile The credentials based on the file @param redirectUrl the URL to redirect to after authentication in Active Directory @return a new delegated token credentials @throws IOException exception thrown from file access errors. """ return new DelegatedTokenCredentials(ApplicationTokenCredentials.fromFile(authFile), redirectUrl); }
java
public static DelegatedTokenCredentials fromFile(File authFile, String redirectUrl) throws IOException { return new DelegatedTokenCredentials(ApplicationTokenCredentials.fromFile(authFile), redirectUrl); }
[ "public", "static", "DelegatedTokenCredentials", "fromFile", "(", "File", "authFile", ",", "String", "redirectUrl", ")", "throws", "IOException", "{", "return", "new", "DelegatedTokenCredentials", "(", "ApplicationTokenCredentials", ".", "fromFile", "(", "authFile", ")"...
Creates a new instance of the DelegatedTokenCredentials from an auth file. @param authFile The credentials based on the file @param redirectUrl the URL to redirect to after authentication in Active Directory @return a new delegated token credentials @throws IOException exception thrown from file access errors.
[ "Creates", "a", "new", "instance", "of", "the", "DelegatedTokenCredentials", "from", "an", "auth", "file", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/common/azure-common-auth/src/main/java/com/azure/common/auth/credentials/DelegatedTokenCredentials.java#L73-L75
OpenNTF/JavascriptAggregator
jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/AbstractHttpTransport.java
AbstractHttpTransport.getParameter
protected static String getParameter(HttpServletRequest request, String[] aliases) { """ Returns the value of the requested parameter from the request, or null @param request the request object @param aliases array of query arg names by which the request may be specified @return the value of the param, or null if it is not specified under the specified names """ final String sourceMethod = "getParameter"; //$NON-NLS-1$ boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(sourceClass, sourceMethod, new Object[]{request.getQueryString(), Arrays.asList(aliases)}); } Map<String, String[]> params = request.getParameterMap(); String result = null; for (Map.Entry<String, String[]> entry : params.entrySet()) { String name = entry.getKey(); for (String alias : aliases) { if (alias.equalsIgnoreCase(name)) { String[] values = entry.getValue(); result = values[values.length-1]; // return last value in array } } } if (isTraceLogging) { log.exiting(sourceClass, sourceMethod, result); } return result; }
java
protected static String getParameter(HttpServletRequest request, String[] aliases) { final String sourceMethod = "getParameter"; //$NON-NLS-1$ boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(sourceClass, sourceMethod, new Object[]{request.getQueryString(), Arrays.asList(aliases)}); } Map<String, String[]> params = request.getParameterMap(); String result = null; for (Map.Entry<String, String[]> entry : params.entrySet()) { String name = entry.getKey(); for (String alias : aliases) { if (alias.equalsIgnoreCase(name)) { String[] values = entry.getValue(); result = values[values.length-1]; // return last value in array } } } if (isTraceLogging) { log.exiting(sourceClass, sourceMethod, result); } return result; }
[ "protected", "static", "String", "getParameter", "(", "HttpServletRequest", "request", ",", "String", "[", "]", "aliases", ")", "{", "final", "String", "sourceMethod", "=", "\"getParameter\"", ";", "//$NON-NLS-1$\r", "boolean", "isTraceLogging", "=", "log", ".", "...
Returns the value of the requested parameter from the request, or null @param request the request object @param aliases array of query arg names by which the request may be specified @return the value of the param, or null if it is not specified under the specified names
[ "Returns", "the", "value", "of", "the", "requested", "parameter", "from", "the", "request", "or", "null" ]
train
https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/AbstractHttpTransport.java#L506-L527
JOML-CI/JOML
src/org/joml/Matrix4x3d.java
Matrix4x3d.setOrthoSymmetricLH
public Matrix4x3d setOrthoSymmetricLH(double width, double height, double zNear, double zFar) { """ Set this matrix to be a symmetric orthographic projection transformation for a left-handed coordinate system using OpenGL's NDC z range of <code>[-1..+1]</code>. <p> This method is equivalent to calling {@link #setOrthoLH(double, double, double, double, double, double) setOrthoLH()} with <code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>. <p> In order to apply the symmetric orthographic projection to an already existing transformation, use {@link #orthoSymmetricLH(double, double, double, double) orthoSymmetricLH()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #orthoSymmetricLH(double, double, double, double) @param width the distance between the right and left frustum edges @param height the distance between the top and bottom frustum edges @param zNear near clipping plane distance @param zFar far clipping plane distance @return this """ return setOrthoSymmetricLH(width, height, zNear, zFar, false); }
java
public Matrix4x3d setOrthoSymmetricLH(double width, double height, double zNear, double zFar) { return setOrthoSymmetricLH(width, height, zNear, zFar, false); }
[ "public", "Matrix4x3d", "setOrthoSymmetricLH", "(", "double", "width", ",", "double", "height", ",", "double", "zNear", ",", "double", "zFar", ")", "{", "return", "setOrthoSymmetricLH", "(", "width", ",", "height", ",", "zNear", ",", "zFar", ",", "false", ")...
Set this matrix to be a symmetric orthographic projection transformation for a left-handed coordinate system using OpenGL's NDC z range of <code>[-1..+1]</code>. <p> This method is equivalent to calling {@link #setOrthoLH(double, double, double, double, double, double) setOrthoLH()} with <code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>. <p> In order to apply the symmetric orthographic projection to an already existing transformation, use {@link #orthoSymmetricLH(double, double, double, double) orthoSymmetricLH()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #orthoSymmetricLH(double, double, double, double) @param width the distance between the right and left frustum edges @param height the distance between the top and bottom frustum edges @param zNear near clipping plane distance @param zFar far clipping plane distance @return this
[ "Set", "this", "matrix", "to", "be", "a", "symmetric", "orthographic", "projection", "transformation", "for", "a", "left", "-", "handed", "coordinate", "system", "using", "OpenGL", "s", "NDC", "z", "range", "of", "<code", ">", "[", "-", "1", "..", "+", "...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3d.java#L7503-L7505
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_rule_ruleId_GET
public OvhOvhPabxDialplanExtensionRule billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_rule_ruleId_GET(String billingAccount, String serviceName, Long dialplanId, Long extensionId, Long ruleId) throws IOException { """ Get this object properties REST: GET /telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/rule/{ruleId} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param dialplanId [required] @param extensionId [required] @param ruleId [required] """ String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/rule/{ruleId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId, extensionId, ruleId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOvhPabxDialplanExtensionRule.class); }
java
public OvhOvhPabxDialplanExtensionRule billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_rule_ruleId_GET(String billingAccount, String serviceName, Long dialplanId, Long extensionId, Long ruleId) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/rule/{ruleId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId, extensionId, ruleId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOvhPabxDialplanExtensionRule.class); }
[ "public", "OvhOvhPabxDialplanExtensionRule", "billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_rule_ruleId_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "dialplanId", ",", "Long", "extensionId", ",", "Long", "ruleId", ...
Get this object properties REST: GET /telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/rule/{ruleId} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param dialplanId [required] @param extensionId [required] @param ruleId [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L7243-L7248
jhalterman/failsafe
src/main/java/net/jodah/failsafe/FailsafeExecutor.java
FailsafeExecutor.get
public <T extends R> T get(CheckedSupplier<T> supplier) { """ Executes the {@code supplier} until a successful result is returned or the configured policies are exceeded. @throws NullPointerException if the {@code supplier} is null @throws FailsafeException if the {@code supplier} fails with a checked Exception or if interrupted while waiting to perform a retry. @throws CircuitBreakerOpenException if a configured circuit is open. """ return call(execution -> Assert.notNull(supplier, "supplier")); }
java
public <T extends R> T get(CheckedSupplier<T> supplier) { return call(execution -> Assert.notNull(supplier, "supplier")); }
[ "public", "<", "T", "extends", "R", ">", "T", "get", "(", "CheckedSupplier", "<", "T", ">", "supplier", ")", "{", "return", "call", "(", "execution", "->", "Assert", ".", "notNull", "(", "supplier", ",", "\"supplier\"", ")", ")", ";", "}" ]
Executes the {@code supplier} until a successful result is returned or the configured policies are exceeded. @throws NullPointerException if the {@code supplier} is null @throws FailsafeException if the {@code supplier} fails with a checked Exception or if interrupted while waiting to perform a retry. @throws CircuitBreakerOpenException if a configured circuit is open.
[ "Executes", "the", "{", "@code", "supplier", "}", "until", "a", "successful", "result", "is", "returned", "or", "the", "configured", "policies", "are", "exceeded", "." ]
train
https://github.com/jhalterman/failsafe/blob/65fcd3a82f7b232d2ff59bc525a59d693dd8e223/src/main/java/net/jodah/failsafe/FailsafeExecutor.java#L68-L70
google/auto
value/src/main/java/com/google/auto/value/processor/TemplateVars.java
TemplateVars.readerFromUrl
private static Reader readerFromUrl(String resourceName) throws IOException { """ through the getResourceAsStream should be a lot more efficient than reopening the jar. """ URL resourceUrl = TemplateVars.class.getResource(resourceName); InputStream in; try { if (resourceUrl.getProtocol().equalsIgnoreCase("file")) { in = inputStreamFromFile(resourceUrl); } else if (resourceUrl.getProtocol().equalsIgnoreCase("jar")) { in = inputStreamFromJar(resourceUrl); } else { throw new AssertionError("Template fallback logic fails for: " + resourceUrl); } } catch (URISyntaxException e) { throw new IOException(e); } return new InputStreamReader(in, StandardCharsets.UTF_8); }
java
private static Reader readerFromUrl(String resourceName) throws IOException { URL resourceUrl = TemplateVars.class.getResource(resourceName); InputStream in; try { if (resourceUrl.getProtocol().equalsIgnoreCase("file")) { in = inputStreamFromFile(resourceUrl); } else if (resourceUrl.getProtocol().equalsIgnoreCase("jar")) { in = inputStreamFromJar(resourceUrl); } else { throw new AssertionError("Template fallback logic fails for: " + resourceUrl); } } catch (URISyntaxException e) { throw new IOException(e); } return new InputStreamReader(in, StandardCharsets.UTF_8); }
[ "private", "static", "Reader", "readerFromUrl", "(", "String", "resourceName", ")", "throws", "IOException", "{", "URL", "resourceUrl", "=", "TemplateVars", ".", "class", ".", "getResource", "(", "resourceName", ")", ";", "InputStream", "in", ";", "try", "{", ...
through the getResourceAsStream should be a lot more efficient than reopening the jar.
[ "through", "the", "getResourceAsStream", "should", "be", "a", "lot", "more", "efficient", "than", "reopening", "the", "jar", "." ]
train
https://github.com/google/auto/blob/4158a5fa71f1ef763e683b627f4d29bc04cfde9d/value/src/main/java/com/google/auto/value/processor/TemplateVars.java#L156-L171
nmdp-bioinformatics/ngs
reads/src/main/java/org/nmdp/ngs/reads/paired/PairedEndFastqReader.java
PairedEndFastqReader.streamInterleaved
public static void streamInterleaved(final Readable readable, final PairedEndListener listener) throws IOException { """ Stream the specified interleaved paired end reads. Per the interleaved format, all reads must be sorted and paired. @param readable readable, must not be null @param listener paired end listener, must not be null @throws IOException if an I/O error occurs """ checkNotNull(readable); checkNotNull(listener); StreamListener streamListener = new StreamListener() { private Fastq left; @Override public void fastq(final Fastq fastq) { if (isLeft(fastq) && (left == null)) { left = fastq; } else if (isRight(fastq) && (left != null) && (prefix(left).equals(prefix(fastq)))) { Fastq right = fastq; listener.paired(left, right); left = null; } else { throw new PairedEndFastqReaderException("invalid interleaved FASTQ format, left=" + (left == null ? "null" : left.getDescription()) + " right=" + (fastq == null ? "null" : fastq.getDescription())); } } }; try { new SangerFastqReader().stream(readable, streamListener); } catch (PairedEndFastqReaderException e) { throw new IOException("could not stream interleaved paired end FASTQ reads", e); } }
java
public static void streamInterleaved(final Readable readable, final PairedEndListener listener) throws IOException { checkNotNull(readable); checkNotNull(listener); StreamListener streamListener = new StreamListener() { private Fastq left; @Override public void fastq(final Fastq fastq) { if (isLeft(fastq) && (left == null)) { left = fastq; } else if (isRight(fastq) && (left != null) && (prefix(left).equals(prefix(fastq)))) { Fastq right = fastq; listener.paired(left, right); left = null; } else { throw new PairedEndFastqReaderException("invalid interleaved FASTQ format, left=" + (left == null ? "null" : left.getDescription()) + " right=" + (fastq == null ? "null" : fastq.getDescription())); } } }; try { new SangerFastqReader().stream(readable, streamListener); } catch (PairedEndFastqReaderException e) { throw new IOException("could not stream interleaved paired end FASTQ reads", e); } }
[ "public", "static", "void", "streamInterleaved", "(", "final", "Readable", "readable", ",", "final", "PairedEndListener", "listener", ")", "throws", "IOException", "{", "checkNotNull", "(", "readable", ")", ";", "checkNotNull", "(", "listener", ")", ";", "StreamLi...
Stream the specified interleaved paired end reads. Per the interleaved format, all reads must be sorted and paired. @param readable readable, must not be null @param listener paired end listener, must not be null @throws IOException if an I/O error occurs
[ "Stream", "the", "specified", "interleaved", "paired", "end", "reads", ".", "Per", "the", "interleaved", "format", "all", "reads", "must", "be", "sorted", "and", "paired", "." ]
train
https://github.com/nmdp-bioinformatics/ngs/blob/277627e4311313a80f5dc110b3185b0d7af32bd0/reads/src/main/java/org/nmdp/ngs/reads/paired/PairedEndFastqReader.java#L265-L294
awslabs/amazon-sqs-java-messaging-lib
src/main/java/com/amazon/sqs/javamessaging/acknowledge/BulkSQSOperation.java
BulkSQSOperation.bulkAction
public void bulkAction(List<SQSMessageIdentifier> messageIdentifierList, int indexOfMessage) throws JMSException { """ Bulk action on list of message identifiers up to the provided index @param messageIdentifierList Container for the list of message identifiers @param indexOfMessage The action will apply to all messages up to this index @throws JMSException if <code>action</code> throws """ assert indexOfMessage > 0; assert indexOfMessage <= messageIdentifierList.size(); Map<String, List<String>> receiptHandleWithSameQueueUrl = new HashMap<String, List<String>>(); // Add all messages up to and including requested message into Map. // Map contains key as queueUrl and value as list receiptHandles from // that queueUrl. for (int i = 0; i < indexOfMessage; i++) { SQSMessageIdentifier messageIdentifier = messageIdentifierList.get(i); String queueUrl = messageIdentifier.getQueueUrl(); List<String> receiptHandles = receiptHandleWithSameQueueUrl.get(queueUrl); // if value of queueUrl is null create new list. if (receiptHandles == null) { receiptHandles = new ArrayList<String>(); receiptHandleWithSameQueueUrl.put(queueUrl, receiptHandles); } // add receiptHandle to the list. receiptHandles.add(messageIdentifier.getReceiptHandle()); // Once there are 10 messages in messageBatch, apply the batch action if (receiptHandles.size() == SQSMessagingClientConstants.MAX_BATCH) { action(queueUrl, receiptHandles); receiptHandles.clear(); } } // Flush rest of messages in map. for (Entry<String, List<String>> entry : receiptHandleWithSameQueueUrl.entrySet()) { action(entry.getKey(), entry.getValue()); } }
java
public void bulkAction(List<SQSMessageIdentifier> messageIdentifierList, int indexOfMessage) throws JMSException { assert indexOfMessage > 0; assert indexOfMessage <= messageIdentifierList.size(); Map<String, List<String>> receiptHandleWithSameQueueUrl = new HashMap<String, List<String>>(); // Add all messages up to and including requested message into Map. // Map contains key as queueUrl and value as list receiptHandles from // that queueUrl. for (int i = 0; i < indexOfMessage; i++) { SQSMessageIdentifier messageIdentifier = messageIdentifierList.get(i); String queueUrl = messageIdentifier.getQueueUrl(); List<String> receiptHandles = receiptHandleWithSameQueueUrl.get(queueUrl); // if value of queueUrl is null create new list. if (receiptHandles == null) { receiptHandles = new ArrayList<String>(); receiptHandleWithSameQueueUrl.put(queueUrl, receiptHandles); } // add receiptHandle to the list. receiptHandles.add(messageIdentifier.getReceiptHandle()); // Once there are 10 messages in messageBatch, apply the batch action if (receiptHandles.size() == SQSMessagingClientConstants.MAX_BATCH) { action(queueUrl, receiptHandles); receiptHandles.clear(); } } // Flush rest of messages in map. for (Entry<String, List<String>> entry : receiptHandleWithSameQueueUrl.entrySet()) { action(entry.getKey(), entry.getValue()); } }
[ "public", "void", "bulkAction", "(", "List", "<", "SQSMessageIdentifier", ">", "messageIdentifierList", ",", "int", "indexOfMessage", ")", "throws", "JMSException", "{", "assert", "indexOfMessage", ">", "0", ";", "assert", "indexOfMessage", "<=", "messageIdentifierLis...
Bulk action on list of message identifiers up to the provided index @param messageIdentifierList Container for the list of message identifiers @param indexOfMessage The action will apply to all messages up to this index @throws JMSException if <code>action</code> throws
[ "Bulk", "action", "on", "list", "of", "message", "identifiers", "up", "to", "the", "provided", "index" ]
train
https://github.com/awslabs/amazon-sqs-java-messaging-lib/blob/efa716d34d51ef1c5572790626cdb795419cb342/src/main/java/com/amazon/sqs/javamessaging/acknowledge/BulkSQSOperation.java#L43-L77
foundation-runtime/service-directory
1.1/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryLookupService.java
DirectoryLookupService.removeNotificationHandler
public void removeNotificationHandler(String serviceName, NotificationHandler handler) { """ Remove the NotificationHandler from the Service. @param serviceName the service name. @param handler the NotificationHandler for the service. """ ServiceInstanceUtils.validateServiceName(serviceName); if (handler == null) { throw new ServiceException(ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR, ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR.getMessageTemplate(), "NotificationHandler"); } synchronized(notificationHandlers){ if(notificationHandlers.containsKey(serviceName)){ List<NotificationHandler> list = notificationHandlers.get(serviceName); if(list.contains(handler)){ list.remove(handler); } if(list.isEmpty()){ notificationHandlers.remove(serviceName); } } } }
java
public void removeNotificationHandler(String serviceName, NotificationHandler handler){ ServiceInstanceUtils.validateServiceName(serviceName); if (handler == null) { throw new ServiceException(ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR, ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR.getMessageTemplate(), "NotificationHandler"); } synchronized(notificationHandlers){ if(notificationHandlers.containsKey(serviceName)){ List<NotificationHandler> list = notificationHandlers.get(serviceName); if(list.contains(handler)){ list.remove(handler); } if(list.isEmpty()){ notificationHandlers.remove(serviceName); } } } }
[ "public", "void", "removeNotificationHandler", "(", "String", "serviceName", ",", "NotificationHandler", "handler", ")", "{", "ServiceInstanceUtils", ".", "validateServiceName", "(", "serviceName", ")", ";", "if", "(", "handler", "==", "null", ")", "{", "throw", "...
Remove the NotificationHandler from the Service. @param serviceName the service name. @param handler the NotificationHandler for the service.
[ "Remove", "the", "NotificationHandler", "from", "the", "Service", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/1.1/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryLookupService.java#L231-L251
apache/groovy
src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java
ClassNodeUtils.addGeneratedConstructor
public static void addGeneratedConstructor(ClassNode classNode, ConstructorNode consNode) { """ Add a method that is marked as @Generated. @see ClassNode#addConstructor(ConstructorNode) """ classNode.addConstructor(consNode); markAsGenerated(classNode, consNode); }
java
public static void addGeneratedConstructor(ClassNode classNode, ConstructorNode consNode) { classNode.addConstructor(consNode); markAsGenerated(classNode, consNode); }
[ "public", "static", "void", "addGeneratedConstructor", "(", "ClassNode", "classNode", ",", "ConstructorNode", "consNode", ")", "{", "classNode", ".", "addConstructor", "(", "consNode", ")", ";", "markAsGenerated", "(", "classNode", ",", "consNode", ")", ";", "}" ]
Add a method that is marked as @Generated. @see ClassNode#addConstructor(ConstructorNode)
[ "Add", "a", "method", "that", "is", "marked", "as", "@Generated", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java#L132-L135
elki-project/elki
elki-data-generator/src/main/java/de/lmu/ifi/dbs/elki/datasource/GeneratorXMLDatabaseConnection.java
GeneratorXMLDatabaseConnection.processElementGamma
private void processElementGamma(GeneratorSingleCluster cluster, Node cur) { """ Process a 'gamma' Element in the XML stream. @param cluster @param cur Current document nod """ double k = 1.0; double theta = 1.0; String kstr = ((Element) cur).getAttribute(ATTR_K); if(kstr != null && kstr.length() > 0) { k = ParseUtil.parseDouble(kstr); } String thetastr = ((Element) cur).getAttribute(ATTR_THETA); if(thetastr != null && thetastr.length() > 0) { theta = ParseUtil.parseDouble(thetastr); } // *** New normal distribution generator Random random = cluster.getNewRandomGenerator(); Distribution generator = new GammaDistribution(k, theta, random); cluster.addGenerator(generator); // TODO: check for unknown attributes. XMLNodeIterator iter = new XMLNodeIterator(cur.getFirstChild()); while(iter.hasNext()) { Node child = iter.next(); if(child.getNodeType() == Node.ELEMENT_NODE) { LOG.warning("Unknown element in XML specification file: " + child.getNodeName()); } } }
java
private void processElementGamma(GeneratorSingleCluster cluster, Node cur) { double k = 1.0; double theta = 1.0; String kstr = ((Element) cur).getAttribute(ATTR_K); if(kstr != null && kstr.length() > 0) { k = ParseUtil.parseDouble(kstr); } String thetastr = ((Element) cur).getAttribute(ATTR_THETA); if(thetastr != null && thetastr.length() > 0) { theta = ParseUtil.parseDouble(thetastr); } // *** New normal distribution generator Random random = cluster.getNewRandomGenerator(); Distribution generator = new GammaDistribution(k, theta, random); cluster.addGenerator(generator); // TODO: check for unknown attributes. XMLNodeIterator iter = new XMLNodeIterator(cur.getFirstChild()); while(iter.hasNext()) { Node child = iter.next(); if(child.getNodeType() == Node.ELEMENT_NODE) { LOG.warning("Unknown element in XML specification file: " + child.getNodeName()); } } }
[ "private", "void", "processElementGamma", "(", "GeneratorSingleCluster", "cluster", ",", "Node", "cur", ")", "{", "double", "k", "=", "1.0", ";", "double", "theta", "=", "1.0", ";", "String", "kstr", "=", "(", "(", "Element", ")", "cur", ")", ".", "getAt...
Process a 'gamma' Element in the XML stream. @param cluster @param cur Current document nod
[ "Process", "a", "gamma", "Element", "in", "the", "XML", "stream", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-data-generator/src/main/java/de/lmu/ifi/dbs/elki/datasource/GeneratorXMLDatabaseConnection.java#L459-L484
astrapi69/jaulp-wicket
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/application/OnlineSessionUsers.java
OnlineSessionUsers.replaceSessionId
public synchronized ID replaceSessionId(final USER user, final ID oldSessionId, final ID newSessionId, final SESSION newSession) { """ Replace the given old session id with the new one. @param user the user @param oldSessionId the old session id @param newSessionId the new session id @param newSession the new session object @return the new session id that is associated with the given user. """ remove(oldSessionId); return addOnline(user, newSessionId, newSession); }
java
public synchronized ID replaceSessionId(final USER user, final ID oldSessionId, final ID newSessionId, final SESSION newSession) { remove(oldSessionId); return addOnline(user, newSessionId, newSession); }
[ "public", "synchronized", "ID", "replaceSessionId", "(", "final", "USER", "user", ",", "final", "ID", "oldSessionId", ",", "final", "ID", "newSessionId", ",", "final", "SESSION", "newSession", ")", "{", "remove", "(", "oldSessionId", ")", ";", "return", "addOn...
Replace the given old session id with the new one. @param user the user @param oldSessionId the old session id @param newSessionId the new session id @param newSession the new session object @return the new session id that is associated with the given user.
[ "Replace", "the", "given", "old", "session", "id", "with", "the", "new", "one", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/application/OnlineSessionUsers.java#L129-L134
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalFormat.java
DateIntervalFormat.getInstance
public static final DateIntervalFormat getInstance(String skeleton, ULocale locale, DateIntervalInfo dtitvinf) { """ Construct a DateIntervalFormat from skeleton a DateIntervalInfo, and the given locale. <P> In this factory method, user provides its own date interval pattern information, instead of using those pre-defined data in resource file. This factory method is for powerful users who want to provide their own interval patterns. <P> There are pre-defined skeleton in DateFormat, such as MONTH_DAY, YEAR_MONTH_WEEKDAY_DAY etc. Those skeletons have pre-defined interval patterns in resource files. Users are encouraged to use them. For example: DateIntervalFormat.getInstance(DateFormat.MONTH_DAY, false, loc,itvinf); the DateIntervalInfo provides the interval patterns. User are encouraged to set default interval pattern in DateIntervalInfo as well, if they want to set other interval patterns ( instead of reading the interval patterns from resource files). When the corresponding interval pattern for a largest calendar different field is not found ( if user not set it ), interval format fallback to the default interval pattern. If user does not provide default interval pattern, it fallback to "{date0} - {date1}" @param skeleton the skeleton on which interval format based. @param locale the given locale @param dtitvinf the DateIntervalInfo object to be adopted. @return a date time interval formatter. """ // clone. If it is frozen, clone returns itself, otherwise, clone // returns a copy. dtitvinf = (DateIntervalInfo)dtitvinf.clone(); DateTimePatternGenerator generator = DateTimePatternGenerator.getInstance(locale); return new DateIntervalFormat(skeleton, dtitvinf, new SimpleDateFormat(generator.getBestPattern(skeleton), locale)); }
java
public static final DateIntervalFormat getInstance(String skeleton, ULocale locale, DateIntervalInfo dtitvinf) { // clone. If it is frozen, clone returns itself, otherwise, clone // returns a copy. dtitvinf = (DateIntervalInfo)dtitvinf.clone(); DateTimePatternGenerator generator = DateTimePatternGenerator.getInstance(locale); return new DateIntervalFormat(skeleton, dtitvinf, new SimpleDateFormat(generator.getBestPattern(skeleton), locale)); }
[ "public", "static", "final", "DateIntervalFormat", "getInstance", "(", "String", "skeleton", ",", "ULocale", "locale", ",", "DateIntervalInfo", "dtitvinf", ")", "{", "// clone. If it is frozen, clone returns itself, otherwise, clone", "// returns a copy.", "dtitvinf", "=", "(...
Construct a DateIntervalFormat from skeleton a DateIntervalInfo, and the given locale. <P> In this factory method, user provides its own date interval pattern information, instead of using those pre-defined data in resource file. This factory method is for powerful users who want to provide their own interval patterns. <P> There are pre-defined skeleton in DateFormat, such as MONTH_DAY, YEAR_MONTH_WEEKDAY_DAY etc. Those skeletons have pre-defined interval patterns in resource files. Users are encouraged to use them. For example: DateIntervalFormat.getInstance(DateFormat.MONTH_DAY, false, loc,itvinf); the DateIntervalInfo provides the interval patterns. User are encouraged to set default interval pattern in DateIntervalInfo as well, if they want to set other interval patterns ( instead of reading the interval patterns from resource files). When the corresponding interval pattern for a largest calendar different field is not found ( if user not set it ), interval format fallback to the default interval pattern. If user does not provide default interval pattern, it fallback to "{date0} - {date1}" @param skeleton the skeleton on which interval format based. @param locale the given locale @param dtitvinf the DateIntervalInfo object to be adopted. @return a date time interval formatter.
[ "Construct", "a", "DateIntervalFormat", "from", "skeleton", "a", "DateIntervalInfo", "and", "the", "given", "locale", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalFormat.java#L554-L563
ops4j/org.ops4j.base
ops4j-base-lang/src/main/java/org/ops4j/lang/PostConditionException.java
PostConditionException.validateNull
public static void validateNull( Object object, String identifier ) throws PostConditionException { """ Validates that the object is null. @param object The object to be validated. @param identifier The name of the object. @throws PostConditionException if the object is not null. """ if( object == null ) { return; } throw new PostConditionException( identifier + " was NOT NULL." ); }
java
public static void validateNull( Object object, String identifier ) throws PostConditionException { if( object == null ) { return; } throw new PostConditionException( identifier + " was NOT NULL." ); }
[ "public", "static", "void", "validateNull", "(", "Object", "object", ",", "String", "identifier", ")", "throws", "PostConditionException", "{", "if", "(", "object", "==", "null", ")", "{", "return", ";", "}", "throw", "new", "PostConditionException", "(", "ide...
Validates that the object is null. @param object The object to be validated. @param identifier The name of the object. @throws PostConditionException if the object is not null.
[ "Validates", "that", "the", "object", "is", "null", "." ]
train
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-lang/src/main/java/org/ops4j/lang/PostConditionException.java#L65-L73
gsi-upm/BeastTool
beast-tool/src/main/java/es/upm/dit/gsi/beast/mock/jadex/common/MockAgentPlan.java
MockAgentPlan.sendRequestToDF
protected String sendRequestToDF(String df_service, Object msgContent) { """ Method to send Request messages to a specific df_service @param df_service The name of the df_service @param msgContent The content of the message to be sent @return Message sent to + the name of the df_service """ IDFComponentDescription[] receivers = getReceivers(df_service); if (receivers.length > 0) { IMessageEvent mevent = createMessageEvent("send_request"); mevent.getParameter(SFipa.CONTENT).setValue(msgContent); for (int i = 0; i < receivers.length; i++) { mevent.getParameterSet(SFipa.RECEIVERS).addValue( receivers[i].getName()); logger.info("The receiver is " + receivers[i].getName()); } sendMessage(mevent); } logger.info("Message sended to " + df_service + " to " + receivers.length + " receivers"); return ("Message sended to " + df_service); }
java
protected String sendRequestToDF(String df_service, Object msgContent) { IDFComponentDescription[] receivers = getReceivers(df_service); if (receivers.length > 0) { IMessageEvent mevent = createMessageEvent("send_request"); mevent.getParameter(SFipa.CONTENT).setValue(msgContent); for (int i = 0; i < receivers.length; i++) { mevent.getParameterSet(SFipa.RECEIVERS).addValue( receivers[i].getName()); logger.info("The receiver is " + receivers[i].getName()); } sendMessage(mevent); } logger.info("Message sended to " + df_service + " to " + receivers.length + " receivers"); return ("Message sended to " + df_service); }
[ "protected", "String", "sendRequestToDF", "(", "String", "df_service", ",", "Object", "msgContent", ")", "{", "IDFComponentDescription", "[", "]", "receivers", "=", "getReceivers", "(", "df_service", ")", ";", "if", "(", "receivers", ".", "length", ">", "0", "...
Method to send Request messages to a specific df_service @param df_service The name of the df_service @param msgContent The content of the message to be sent @return Message sent to + the name of the df_service
[ "Method", "to", "send", "Request", "messages", "to", "a", "specific", "df_service" ]
train
https://github.com/gsi-upm/BeastTool/blob/cc7fdc75cb818c5d60802aaf32c27829e0ca144c/beast-tool/src/main/java/es/upm/dit/gsi/beast/mock/jadex/common/MockAgentPlan.java#L51-L67
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/rename/CmsRenameDialog.java
CmsRenameDialog.loadAndShow
public void loadAndShow() { """ Loads the necessary data for the rename dialog from the server and then displays the rename dialog.<p> """ CmsRpcAction<CmsRenameInfoBean> infoAction = new CmsRpcAction<CmsRenameInfoBean>() { @Override public void execute() { start(0, true); CmsCoreProvider.getVfsService().getRenameInfo(m_structureId, this); } @Override protected void onResponse(CmsRenameInfoBean renameInfo) { stop(false); CmsRenameView view = new CmsRenameView(renameInfo, m_renameHandler); for (CmsPushButton button : view.getDialogButtons()) { addButton(button); } setMainContent(view); view.setDialog(CmsRenameDialog.this); center(); } }; infoAction.execute(); }
java
public void loadAndShow() { CmsRpcAction<CmsRenameInfoBean> infoAction = new CmsRpcAction<CmsRenameInfoBean>() { @Override public void execute() { start(0, true); CmsCoreProvider.getVfsService().getRenameInfo(m_structureId, this); } @Override protected void onResponse(CmsRenameInfoBean renameInfo) { stop(false); CmsRenameView view = new CmsRenameView(renameInfo, m_renameHandler); for (CmsPushButton button : view.getDialogButtons()) { addButton(button); } setMainContent(view); view.setDialog(CmsRenameDialog.this); center(); } }; infoAction.execute(); }
[ "public", "void", "loadAndShow", "(", ")", "{", "CmsRpcAction", "<", "CmsRenameInfoBean", ">", "infoAction", "=", "new", "CmsRpcAction", "<", "CmsRenameInfoBean", ">", "(", ")", "{", "@", "Override", "public", "void", "execute", "(", ")", "{", "start", "(", ...
Loads the necessary data for the rename dialog from the server and then displays the rename dialog.<p>
[ "Loads", "the", "necessary", "data", "for", "the", "rename", "dialog", "from", "the", "server", "and", "then", "displays", "the", "rename", "dialog", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/rename/CmsRenameDialog.java#L68-L93
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java
HtmlTree.A
public static HtmlTree A(HtmlVersion htmlVersion, String attr, Content body) { """ Generates an HTML anchor tag with an id or a name attribute and content. @param htmlVersion the version of the generated HTML @param attr name or id attribute for the anchor tag @param body content for the anchor tag @return an HtmlTree object """ HtmlTree htmltree = new HtmlTree(HtmlTag.A); htmltree.addAttr((htmlVersion == HtmlVersion.HTML4) ? HtmlAttr.NAME : HtmlAttr.ID, nullCheck(attr)); htmltree.addContent(nullCheck(body)); return htmltree; }
java
public static HtmlTree A(HtmlVersion htmlVersion, String attr, Content body) { HtmlTree htmltree = new HtmlTree(HtmlTag.A); htmltree.addAttr((htmlVersion == HtmlVersion.HTML4) ? HtmlAttr.NAME : HtmlAttr.ID, nullCheck(attr)); htmltree.addContent(nullCheck(body)); return htmltree; }
[ "public", "static", "HtmlTree", "A", "(", "HtmlVersion", "htmlVersion", ",", "String", "attr", ",", "Content", "body", ")", "{", "HtmlTree", "htmltree", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "A", ")", ";", "htmltree", ".", "addAttr", "(", "(", "ht...
Generates an HTML anchor tag with an id or a name attribute and content. @param htmlVersion the version of the generated HTML @param attr name or id attribute for the anchor tag @param body content for the anchor tag @return an HtmlTree object
[ "Generates", "an", "HTML", "anchor", "tag", "with", "an", "id", "or", "a", "name", "attribute", "and", "content", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java#L243-L251
lucmoreau/ProvToolbox
prov-model/src/main/java/org/openprovenance/prov/model/DOMProcessing.java
DOMProcessing.newElement
final static public Element newElement(QualifiedName elementName, String value, QualifiedName type) { """ Creates a DOM {@link Element} for a {@link QualifiedName} and content given by value and type @param elementName a {@link QualifiedName} to denote the element name @param value for the created {@link Element} @param type of the value @return a new {@link Element} """ org.w3c.dom.Document doc = builder.newDocument(); String qualifiedNameString; qualifiedNameString= qualifiedNameToString(elementName.toQName()); Element el = doc.createElementNS(elementName.getNamespaceURI(), qualifiedNameString); el.setAttributeNS(NamespacePrefixMapper.XSI_NS, "xsi:type", qualifiedNameToString(type)); //if (withNullLocal || withDigit) { // el.setAttributeNS(NamespacePrefixMapper.PROV_NS, "prov:local", localPart); //} el.appendChild(doc.createTextNode(value)); doc.appendChild(el); return el; }
java
final static public Element newElement(QualifiedName elementName, String value, QualifiedName type) { org.w3c.dom.Document doc = builder.newDocument(); String qualifiedNameString; qualifiedNameString= qualifiedNameToString(elementName.toQName()); Element el = doc.createElementNS(elementName.getNamespaceURI(), qualifiedNameString); el.setAttributeNS(NamespacePrefixMapper.XSI_NS, "xsi:type", qualifiedNameToString(type)); //if (withNullLocal || withDigit) { // el.setAttributeNS(NamespacePrefixMapper.PROV_NS, "prov:local", localPart); //} el.appendChild(doc.createTextNode(value)); doc.appendChild(el); return el; }
[ "final", "static", "public", "Element", "newElement", "(", "QualifiedName", "elementName", ",", "String", "value", ",", "QualifiedName", "type", ")", "{", "org", ".", "w3c", ".", "dom", ".", "Document", "doc", "=", "builder", ".", "newDocument", "(", ")", ...
Creates a DOM {@link Element} for a {@link QualifiedName} and content given by value and type @param elementName a {@link QualifiedName} to denote the element name @param value for the created {@link Element} @param type of the value @return a new {@link Element}
[ "Creates", "a", "DOM", "{" ]
train
https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-model/src/main/java/org/openprovenance/prov/model/DOMProcessing.java#L166-L182
mapsforge/mapsforge
mapsforge-map-writer/src/main/java/org/mapsforge/map/writer/util/GeoUtils.java
GeoUtils.computeBitmask
public static short computeBitmask(final Geometry geometry, final TileCoordinate tile, final int enlargementInMeter) { """ A tile on zoom level <i>z</i> has exactly 16 sub tiles on zoom level <i>z+2</i>. For each of these 16 sub tiles it is analyzed if the given way needs to be included. The result is represented as a 16 bit short value. Each bit represents one of the 16 sub tiles. A bit is set to 1 if the sub tile needs to include the way. Representation is row-wise. @param geometry the geometry which is analyzed @param tile the tile which is split into 16 sub tiles @param enlargementInMeter amount of pixels that is used to enlarge the bounding box of the way and the tiles in the mapping process @return a 16 bit short value that represents the information which of the sub tiles needs to include the way """ List<TileCoordinate> subtiles = tile .translateToZoomLevel((byte) (tile.getZoomlevel() + SUBTILE_ZOOMLEVEL_DIFFERENCE)); short bitmask = 0; int tileCounter = 0; for (TileCoordinate subtile : subtiles) { Geometry bbox = tileToJTSGeometry(subtile.getX(), subtile.getY(), subtile.getZoomlevel(), enlargementInMeter); if (bbox.intersects(geometry)) { bitmask |= TILE_BITMASK_VALUES[tileCounter]; } tileCounter++; } return bitmask; }
java
public static short computeBitmask(final Geometry geometry, final TileCoordinate tile, final int enlargementInMeter) { List<TileCoordinate> subtiles = tile .translateToZoomLevel((byte) (tile.getZoomlevel() + SUBTILE_ZOOMLEVEL_DIFFERENCE)); short bitmask = 0; int tileCounter = 0; for (TileCoordinate subtile : subtiles) { Geometry bbox = tileToJTSGeometry(subtile.getX(), subtile.getY(), subtile.getZoomlevel(), enlargementInMeter); if (bbox.intersects(geometry)) { bitmask |= TILE_BITMASK_VALUES[tileCounter]; } tileCounter++; } return bitmask; }
[ "public", "static", "short", "computeBitmask", "(", "final", "Geometry", "geometry", ",", "final", "TileCoordinate", "tile", ",", "final", "int", "enlargementInMeter", ")", "{", "List", "<", "TileCoordinate", ">", "subtiles", "=", "tile", ".", "translateToZoomLeve...
A tile on zoom level <i>z</i> has exactly 16 sub tiles on zoom level <i>z+2</i>. For each of these 16 sub tiles it is analyzed if the given way needs to be included. The result is represented as a 16 bit short value. Each bit represents one of the 16 sub tiles. A bit is set to 1 if the sub tile needs to include the way. Representation is row-wise. @param geometry the geometry which is analyzed @param tile the tile which is split into 16 sub tiles @param enlargementInMeter amount of pixels that is used to enlarge the bounding box of the way and the tiles in the mapping process @return a 16 bit short value that represents the information which of the sub tiles needs to include the way
[ "A", "tile", "on", "zoom", "level", "<i", ">", "z<", "/", "i", ">", "has", "exactly", "16", "sub", "tiles", "on", "zoom", "level", "<i", ">", "z", "+", "2<", "/", "i", ">", ".", "For", "each", "of", "these", "16", "sub", "tiles", "it", "is", ...
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-writer/src/main/java/org/mapsforge/map/writer/util/GeoUtils.java#L138-L153
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionRelPersistenceImpl.java
CPDefinitionOptionRelPersistenceImpl.findByCPDefinitionId
@Override public List<CPDefinitionOptionRel> findByCPDefinitionId( long CPDefinitionId, int start, int end) { """ Returns a range of all the cp definition option rels where CPDefinitionId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionOptionRelModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param CPDefinitionId the cp definition ID @param start the lower bound of the range of cp definition option rels @param end the upper bound of the range of cp definition option rels (not inclusive) @return the range of matching cp definition option rels """ return findByCPDefinitionId(CPDefinitionId, start, end, null); }
java
@Override public List<CPDefinitionOptionRel> findByCPDefinitionId( long CPDefinitionId, int start, int end) { return findByCPDefinitionId(CPDefinitionId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CPDefinitionOptionRel", ">", "findByCPDefinitionId", "(", "long", "CPDefinitionId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByCPDefinitionId", "(", "CPDefinitionId", ",", "start", ",", "end", ",",...
Returns a range of all the cp definition option rels where CPDefinitionId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionOptionRelModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param CPDefinitionId the cp definition ID @param start the lower bound of the range of cp definition option rels @param end the upper bound of the range of cp definition option rels (not inclusive) @return the range of matching cp definition option rels
[ "Returns", "a", "range", "of", "all", "the", "cp", "definition", "option", "rels", "where", "CPDefinitionId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionRelPersistenceImpl.java#L2566-L2570
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java
XML.checksAttributesExistence
private XML checksAttributesExistence(Class<?> aClass,String[] attributes) { """ Verifies that the attributes exist in aClass. @param aClass Class to check @param attributes list of the names attributes to check. @return this instance of XML """ if(!classExists(aClass)) Error.xmlClassInexistent(this.xmlPath,aClass); for (String attributeName : attributes) try{ aClass.getDeclaredField(attributeName); } catch (Exception e){ Error.attributeInexistent(attributeName, aClass);} return this; }
java
private XML checksAttributesExistence(Class<?> aClass,String[] attributes){ if(!classExists(aClass)) Error.xmlClassInexistent(this.xmlPath,aClass); for (String attributeName : attributes) try{ aClass.getDeclaredField(attributeName); } catch (Exception e){ Error.attributeInexistent(attributeName, aClass);} return this; }
[ "private", "XML", "checksAttributesExistence", "(", "Class", "<", "?", ">", "aClass", ",", "String", "[", "]", "attributes", ")", "{", "if", "(", "!", "classExists", "(", "aClass", ")", ")", "Error", ".", "xmlClassInexistent", "(", "this", ".", "xmlPath", ...
Verifies that the attributes exist in aClass. @param aClass Class to check @param attributes list of the names attributes to check. @return this instance of XML
[ "Verifies", "that", "the", "attributes", "exist", "in", "aClass", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java#L421-L427
qcloudsms/qcloudsms_java
src/main/java/com/github/qcloudsms/VoiceFileStatus.java
VoiceFileStatus.get
public VoiceFileStatusResult get(String fid) throws HTTPException, JSONException, IOException { """ 查询语音文件审核状态 @param fid 语音文件fid @return {@link}VoiceFileStatusResult @throws HTTPException http status exception @throws JSONException json parse exception @throws IOException network problem """ long random = SmsSenderUtil.getRandom(); long now = SmsSenderUtil.getCurrentTime(); JSONObject body = new JSONObject() .put("fid", fid) .put("sig", SmsSenderUtil.calculateFStatusSignature( this.appkey, random, now, fid)) .put("time", now); HTTPRequest req = new HTTPRequest(HTTPMethod.POST, this.url) .addHeader("Conetent-Type", "application/json") .addQueryParameter("sdkappid", this.appid) .addQueryParameter("random", random) .setConnectionTimeout(60 * 1000) .setRequestTimeout(60 * 1000) .setBody(body.toString()); try { // May throw IOException and URISyntaxexception HTTPResponse res = httpclient.fetch(req); // May throw HTTPException handleError(res); // May throw JSONException return (new VoiceFileStatusResult()).parseFromHTTPResponse(res); } catch(URISyntaxException e) { throw new RuntimeException("API url has been modified, current url: " + url); } }
java
public VoiceFileStatusResult get(String fid) throws HTTPException, JSONException, IOException { long random = SmsSenderUtil.getRandom(); long now = SmsSenderUtil.getCurrentTime(); JSONObject body = new JSONObject() .put("fid", fid) .put("sig", SmsSenderUtil.calculateFStatusSignature( this.appkey, random, now, fid)) .put("time", now); HTTPRequest req = new HTTPRequest(HTTPMethod.POST, this.url) .addHeader("Conetent-Type", "application/json") .addQueryParameter("sdkappid", this.appid) .addQueryParameter("random", random) .setConnectionTimeout(60 * 1000) .setRequestTimeout(60 * 1000) .setBody(body.toString()); try { // May throw IOException and URISyntaxexception HTTPResponse res = httpclient.fetch(req); // May throw HTTPException handleError(res); // May throw JSONException return (new VoiceFileStatusResult()).parseFromHTTPResponse(res); } catch(URISyntaxException e) { throw new RuntimeException("API url has been modified, current url: " + url); } }
[ "public", "VoiceFileStatusResult", "get", "(", "String", "fid", ")", "throws", "HTTPException", ",", "JSONException", ",", "IOException", "{", "long", "random", "=", "SmsSenderUtil", ".", "getRandom", "(", ")", ";", "long", "now", "=", "SmsSenderUtil", ".", "g...
查询语音文件审核状态 @param fid 语音文件fid @return {@link}VoiceFileStatusResult @throws HTTPException http status exception @throws JSONException json parse exception @throws IOException network problem
[ "查询语音文件审核状态" ]
train
https://github.com/qcloudsms/qcloudsms_java/blob/920ba838b4fdafcbf684e71bb09846de72294eea/src/main/java/com/github/qcloudsms/VoiceFileStatus.java#L39-L70
google/error-prone
core/src/main/java/com/google/errorprone/refaster/ULabeledStatement.java
ULabeledStatement.inlineLabel
@Nullable static Name inlineLabel(@Nullable CharSequence label, Inliner inliner) { """ Returns either the {@code Name} bound to the specified label, or a {@code Name} representing the original label if none is already bound. """ return (label == null) ? null : inliner.asName(inliner.getOptionalBinding(new Key(label)).or(label)); }
java
@Nullable static Name inlineLabel(@Nullable CharSequence label, Inliner inliner) { return (label == null) ? null : inliner.asName(inliner.getOptionalBinding(new Key(label)).or(label)); }
[ "@", "Nullable", "static", "Name", "inlineLabel", "(", "@", "Nullable", "CharSequence", "label", ",", "Inliner", "inliner", ")", "{", "return", "(", "label", "==", "null", ")", "?", "null", ":", "inliner", ".", "asName", "(", "inliner", ".", "getOptionalBi...
Returns either the {@code Name} bound to the specified label, or a {@code Name} representing the original label if none is already bound.
[ "Returns", "either", "the", "{" ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/refaster/ULabeledStatement.java#L47-L52
ical4j/ical4j
src/main/java/net/fortuna/ical4j/validate/ParameterValidator.java
ParameterValidator.assertOne
public void assertOne(final String paramName, final ParameterList parameters) throws ValidationException { """ Ensure a parameter occurs once. @param paramName the parameter name @param parameters a list of parameters to query @throws ValidationException when the specified parameter does not occur once """ if (parameters.getParameters(paramName).size() != 1) { throw new ValidationException(ASSERT_ONE_MESSAGE, new Object[] {paramName}); } }
java
public void assertOne(final String paramName, final ParameterList parameters) throws ValidationException { if (parameters.getParameters(paramName).size() != 1) { throw new ValidationException(ASSERT_ONE_MESSAGE, new Object[] {paramName}); } }
[ "public", "void", "assertOne", "(", "final", "String", "paramName", ",", "final", "ParameterList", "parameters", ")", "throws", "ValidationException", "{", "if", "(", "parameters", ".", "getParameters", "(", "paramName", ")", ".", "size", "(", ")", "!=", "1", ...
Ensure a parameter occurs once. @param paramName the parameter name @param parameters a list of parameters to query @throws ValidationException when the specified parameter does not occur once
[ "Ensure", "a", "parameter", "occurs", "once", "." ]
train
https://github.com/ical4j/ical4j/blob/7ac4bd1ce2bb2e0a2906fb69a56fbd2d9d974156/src/main/java/net/fortuna/ical4j/validate/ParameterValidator.java#L91-L97
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java
PossibleIncompleteSerialization.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { """ implements the visitor to look for classes that are serializable, and are derived from non serializable classes and don't either implement methods in Externalizable or Serializable to save parent class fields. @param classContext the context object of the currently parsed class """ try { JavaClass cls = classContext.getJavaClass(); if (isSerializable(cls)) { JavaClass superCls = cls.getSuperClass(); if (!isSerializable(superCls) && hasSerializableFields(superCls) && !hasSerializingMethods(cls)) { bugReporter.reportBug(new BugInstance(this, BugType.PIS_POSSIBLE_INCOMPLETE_SERIALIZATION.name(), NORMAL_PRIORITY).addClass(cls)); } } } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } }
java
@Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); if (isSerializable(cls)) { JavaClass superCls = cls.getSuperClass(); if (!isSerializable(superCls) && hasSerializableFields(superCls) && !hasSerializingMethods(cls)) { bugReporter.reportBug(new BugInstance(this, BugType.PIS_POSSIBLE_INCOMPLETE_SERIALIZATION.name(), NORMAL_PRIORITY).addClass(cls)); } } } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } }
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "JavaClass", "cls", "=", "classContext", ".", "getJavaClass", "(", ")", ";", "if", "(", "isSerializable", "(", "cls", ")", ")", "{", "JavaClass...
implements the visitor to look for classes that are serializable, and are derived from non serializable classes and don't either implement methods in Externalizable or Serializable to save parent class fields. @param classContext the context object of the currently parsed class
[ "implements", "the", "visitor", "to", "look", "for", "classes", "that", "are", "serializable", "and", "are", "derived", "from", "non", "serializable", "classes", "and", "don", "t", "either", "implement", "methods", "in", "Externalizable", "or", "Serializable", "...
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java#L62-L75
GCRC/nunaliit
nunaliit2-json/src/main/java/org/json/XMLTokener.java
XMLTokener.unescapeEntity
static String unescapeEntity(String e) { """ Unescapes an XML entity encoding; @param e entity (only the actual entity value, not the preceding & or ending ; @return """ // validate if (e == null || e.isEmpty()) { return ""; } // if our entity is an encoded unicode point, parse it. if (e.charAt(0) == '#') { int cp; if (e.charAt(1) == 'x') { // hex encoded unicode cp = Integer.parseInt(e.substring(2), 16); } else { // decimal encoded unicode cp = Integer.parseInt(e.substring(1)); } return new String(new int[] {cp},0,1); } Character knownEntity = entity.get(e); if(knownEntity==null) { // we don't know the entity so keep it encoded return '&' + e + ';'; } return knownEntity.toString(); }
java
static String unescapeEntity(String e) { // validate if (e == null || e.isEmpty()) { return ""; } // if our entity is an encoded unicode point, parse it. if (e.charAt(0) == '#') { int cp; if (e.charAt(1) == 'x') { // hex encoded unicode cp = Integer.parseInt(e.substring(2), 16); } else { // decimal encoded unicode cp = Integer.parseInt(e.substring(1)); } return new String(new int[] {cp},0,1); } Character knownEntity = entity.get(e); if(knownEntity==null) { // we don't know the entity so keep it encoded return '&' + e + ';'; } return knownEntity.toString(); }
[ "static", "String", "unescapeEntity", "(", "String", "e", ")", "{", "// validate", "if", "(", "e", "==", "null", "||", "e", ".", "isEmpty", "(", ")", ")", "{", "return", "\"\"", ";", "}", "// if our entity is an encoded unicode point, parse it.", "if", "(", ...
Unescapes an XML entity encoding; @param e entity (only the actual entity value, not the preceding & or ending ; @return
[ "Unescapes", "an", "XML", "entity", "encoding", ";" ]
train
https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-json/src/main/java/org/json/XMLTokener.java#L159-L182
opendatatrentino/s-match
src/main/java/it/unitn/disi/common/components/Configurable.java
Configurable.loadProperties
public static Properties loadProperties(String filename) throws ConfigurableException { """ Loads the properties from the properties file. @param filename the properties file name @return Properties instance @throws ConfigurableException ConfigurableException """ log.info("Loading properties from " + filename); Properties properties = new Properties(); FileInputStream input = null; try { input = new FileInputStream(filename); properties.load(input); } catch (IOException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); throw new ConfigurableException(errMessage, e); } finally { if (null != input) { try { input.close(); } catch (IOException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); } } } return properties; }
java
public static Properties loadProperties(String filename) throws ConfigurableException { log.info("Loading properties from " + filename); Properties properties = new Properties(); FileInputStream input = null; try { input = new FileInputStream(filename); properties.load(input); } catch (IOException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); throw new ConfigurableException(errMessage, e); } finally { if (null != input) { try { input.close(); } catch (IOException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); } } } return properties; }
[ "public", "static", "Properties", "loadProperties", "(", "String", "filename", ")", "throws", "ConfigurableException", "{", "log", ".", "info", "(", "\"Loading properties from \"", "+", "filename", ")", ";", "Properties", "properties", "=", "new", "Properties", "(",...
Loads the properties from the properties file. @param filename the properties file name @return Properties instance @throws ConfigurableException ConfigurableException
[ "Loads", "the", "properties", "from", "the", "properties", "file", "." ]
train
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/common/components/Configurable.java#L192-L215
OpenLiberty/open-liberty
dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/document/SymbolTable.java
SymbolTable.containsSymbol
public boolean containsSymbol(char[] buffer, int offset, int length) { """ Returns true if the symbol table already contains the specified symbol. @param buffer The buffer containing the symbol to look for. @param offset The offset into the buffer. @param length The length of the symbol in the buffer. """ // search for identical symbol int bucket = hash(buffer, offset, length) % fTableSize; OUTER: for (Entry entry = fBuckets[bucket]; entry != null; entry = entry.next) { if (length == entry.characters.length) { for (int i = 0; i < length; i++) { if (buffer[offset + i] != entry.characters[i]) { continue OUTER; } } return true; } } return false; }
java
public boolean containsSymbol(char[] buffer, int offset, int length) { // search for identical symbol int bucket = hash(buffer, offset, length) % fTableSize; OUTER: for (Entry entry = fBuckets[bucket]; entry != null; entry = entry.next) { if (length == entry.characters.length) { for (int i = 0; i < length; i++) { if (buffer[offset + i] != entry.characters[i]) { continue OUTER; } } return true; } } return false; }
[ "public", "boolean", "containsSymbol", "(", "char", "[", "]", "buffer", ",", "int", "offset", ",", "int", "length", ")", "{", "// search for identical symbol", "int", "bucket", "=", "hash", "(", "buffer", ",", "offset", ",", "length", ")", "%", "fTableSize",...
Returns true if the symbol table already contains the specified symbol. @param buffer The buffer containing the symbol to look for. @param offset The offset into the buffer. @param length The length of the symbol in the buffer.
[ "Returns", "true", "if", "the", "symbol", "table", "already", "contains", "the", "specified", "symbol", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/document/SymbolTable.java#L215-L232
XDean/Java-EX
src/main/java/xdean/jex/util/reflect/AnnotationUtil.java
AnnotationUtil.addAnnotation
@SuppressWarnings("unchecked") public static void addAnnotation(Field field, Annotation annotation) { """ Add annotation to Field<br> Note that you may need to give the root field. @param field @param annotation @author XDean @see java.lang.reflect.Field @see #createAnnotationFromMap(Class, Map) @see ReflectUtil#getRootFields(Class) """ field.getAnnotation(Annotation.class);// prevent declaredAnnotations haven't initialized Map<Class<? extends Annotation>, Annotation> annos; try { annos = (Map<Class<? extends Annotation>, Annotation>) Field_Field_DeclaredAnnotations.get(field); } catch (IllegalAccessException e) { throw new IllegalStateException(e); } if (annos.getClass() == Collections.EMPTY_MAP.getClass()) { annos = new HashMap<>(); try { Field_Field_DeclaredAnnotations.set(field, annos); } catch (IllegalAccessException e) { throw new IllegalStateException(e); } } annos.put(annotation.annotationType(), annotation); }
java
@SuppressWarnings("unchecked") public static void addAnnotation(Field field, Annotation annotation) { field.getAnnotation(Annotation.class);// prevent declaredAnnotations haven't initialized Map<Class<? extends Annotation>, Annotation> annos; try { annos = (Map<Class<? extends Annotation>, Annotation>) Field_Field_DeclaredAnnotations.get(field); } catch (IllegalAccessException e) { throw new IllegalStateException(e); } if (annos.getClass() == Collections.EMPTY_MAP.getClass()) { annos = new HashMap<>(); try { Field_Field_DeclaredAnnotations.set(field, annos); } catch (IllegalAccessException e) { throw new IllegalStateException(e); } } annos.put(annotation.annotationType(), annotation); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "void", "addAnnotation", "(", "Field", "field", ",", "Annotation", "annotation", ")", "{", "field", ".", "getAnnotation", "(", "Annotation", ".", "class", ")", ";", "// prevent declaredAnnotat...
Add annotation to Field<br> Note that you may need to give the root field. @param field @param annotation @author XDean @see java.lang.reflect.Field @see #createAnnotationFromMap(Class, Map) @see ReflectUtil#getRootFields(Class)
[ "Add", "annotation", "to", "Field<br", ">", "Note", "that", "you", "may", "need", "to", "give", "the", "root", "field", "." ]
train
https://github.com/XDean/Java-EX/blob/9208ba71c5b2af9f9bd979d01fab2ff5e433b3e7/src/main/java/xdean/jex/util/reflect/AnnotationUtil.java#L173-L191
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnGatewaysInner.java
P2sVpnGatewaysInner.getByResourceGroupAsync
public Observable<P2SVpnGatewayInner> getByResourceGroupAsync(String resourceGroupName, String gatewayName) { """ Retrieves the details of a virtual wan p2s vpn gateway. @param resourceGroupName The resource group name of the P2SVpnGateway. @param gatewayName The name of the gateway. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the P2SVpnGatewayInner object """ return getByResourceGroupWithServiceResponseAsync(resourceGroupName, gatewayName).map(new Func1<ServiceResponse<P2SVpnGatewayInner>, P2SVpnGatewayInner>() { @Override public P2SVpnGatewayInner call(ServiceResponse<P2SVpnGatewayInner> response) { return response.body(); } }); }
java
public Observable<P2SVpnGatewayInner> getByResourceGroupAsync(String resourceGroupName, String gatewayName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, gatewayName).map(new Func1<ServiceResponse<P2SVpnGatewayInner>, P2SVpnGatewayInner>() { @Override public P2SVpnGatewayInner call(ServiceResponse<P2SVpnGatewayInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "P2SVpnGatewayInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "gatewayName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "gatewayName", ")", ".", "...
Retrieves the details of a virtual wan p2s vpn gateway. @param resourceGroupName The resource group name of the P2SVpnGateway. @param gatewayName The name of the gateway. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the P2SVpnGatewayInner object
[ "Retrieves", "the", "details", "of", "a", "virtual", "wan", "p2s", "vpn", "gateway", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnGatewaysInner.java#L163-L170
twitter/finagle
finagle-serversets/src/main/java/com/twitter/finagle/common/zookeeper/ZooKeeperClient.java
ZooKeeperClient.digestCredentials
public static Credentials digestCredentials(String username, String password) { """ Creates a set of credentials for the zoo keeper digest authentication mechanism. @param username the username to authenticate with @param password the password to authenticate with @return a set of credentials that can be used to authenticate the zoo keeper client """ MorePreconditions.checkNotBlank(username); Objects.requireNonNull(password); // TODO(John Sirois): DigestAuthenticationProvider is broken - uses platform default charset // (on server) and so we just have to hope here that clients are deployed in compatible jvms. // Consider writing and installing a version of DigestAuthenticationProvider that controls its // Charset explicitly. return credentials("digest", (username + ":" + password).getBytes()); }
java
public static Credentials digestCredentials(String username, String password) { MorePreconditions.checkNotBlank(username); Objects.requireNonNull(password); // TODO(John Sirois): DigestAuthenticationProvider is broken - uses platform default charset // (on server) and so we just have to hope here that clients are deployed in compatible jvms. // Consider writing and installing a version of DigestAuthenticationProvider that controls its // Charset explicitly. return credentials("digest", (username + ":" + password).getBytes()); }
[ "public", "static", "Credentials", "digestCredentials", "(", "String", "username", ",", "String", "password", ")", "{", "MorePreconditions", ".", "checkNotBlank", "(", "username", ")", ";", "Objects", ".", "requireNonNull", "(", "password", ")", ";", "// TODO(John...
Creates a set of credentials for the zoo keeper digest authentication mechanism. @param username the username to authenticate with @param password the password to authenticate with @return a set of credentials that can be used to authenticate the zoo keeper client
[ "Creates", "a", "set", "of", "credentials", "for", "the", "zoo", "keeper", "digest", "authentication", "mechanism", "." ]
train
https://github.com/twitter/finagle/blob/872be5f2b147fa50351bdbf08b003a26745e1df8/finagle-serversets/src/main/java/com/twitter/finagle/common/zookeeper/ZooKeeperClient.java#L121-L130
grpc/grpc-java
api/src/main/java/io/grpc/ServiceProviders.java
ServiceProviders.getCandidatesViaHardCoded
@VisibleForTesting static <T> Iterable<T> getCandidatesViaHardCoded(Class<T> klass, Iterable<Class<?>> hardcoded) { """ Load providers from a hard-coded list. This avoids using getResource(), which has performance problems on Android (see https://github.com/grpc/grpc-java/issues/2037). """ List<T> list = new ArrayList<>(); for (Class<?> candidate : hardcoded) { list.add(create(klass, candidate)); } return list; }
java
@VisibleForTesting static <T> Iterable<T> getCandidatesViaHardCoded(Class<T> klass, Iterable<Class<?>> hardcoded) { List<T> list = new ArrayList<>(); for (Class<?> candidate : hardcoded) { list.add(create(klass, candidate)); } return list; }
[ "@", "VisibleForTesting", "static", "<", "T", ">", "Iterable", "<", "T", ">", "getCandidatesViaHardCoded", "(", "Class", "<", "T", ">", "klass", ",", "Iterable", "<", "Class", "<", "?", ">", ">", "hardcoded", ")", "{", "List", "<", "T", ">", "list", ...
Load providers from a hard-coded list. This avoids using getResource(), which has performance problems on Android (see https://github.com/grpc/grpc-java/issues/2037).
[ "Load", "providers", "from", "a", "hard", "-", "coded", "list", ".", "This", "avoids", "using", "getResource", "()", "which", "has", "performance", "problems", "on", "Android", "(", "see", "https", ":", "//", "github", ".", "com", "/", "grpc", "/", "grpc...
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/api/src/main/java/io/grpc/ServiceProviders.java#L121-L128
radkovo/jStyleParser
src/main/java/cz/vutbr/web/domassign/MultiMap.java
MultiMap.getOrCreate
public D getOrCreate(E el, P pseudo) { """ Gets the data or creates an empty list if it does not exist yet. @param el the element @param pseudo a pseudo-element or null, if no pseudo-element is required @return the stored data """ D ret; if (pseudo == null) { ret = mainMap.get(el); if (ret == null) { ret = createDataInstance(); mainMap.put(el, ret); } } else { HashMap<P, D> map = pseudoMaps.get(el); if (map == null) { map = new HashMap<P, D>(); pseudoMaps.put(el, map); } ret = map.get(pseudo); if (ret == null) { ret = createDataInstance(); map.put(pseudo, ret); } } return ret; }
java
public D getOrCreate(E el, P pseudo) { D ret; if (pseudo == null) { ret = mainMap.get(el); if (ret == null) { ret = createDataInstance(); mainMap.put(el, ret); } } else { HashMap<P, D> map = pseudoMaps.get(el); if (map == null) { map = new HashMap<P, D>(); pseudoMaps.put(el, map); } ret = map.get(pseudo); if (ret == null) { ret = createDataInstance(); map.put(pseudo, ret); } } return ret; }
[ "public", "D", "getOrCreate", "(", "E", "el", ",", "P", "pseudo", ")", "{", "D", "ret", ";", "if", "(", "pseudo", "==", "null", ")", "{", "ret", "=", "mainMap", ".", "get", "(", "el", ")", ";", "if", "(", "ret", "==", "null", ")", "{", "ret",...
Gets the data or creates an empty list if it does not exist yet. @param el the element @param pseudo a pseudo-element or null, if no pseudo-element is required @return the stored data
[ "Gets", "the", "data", "or", "creates", "an", "empty", "list", "if", "it", "does", "not", "exist", "yet", "." ]
train
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/MultiMap.java#L96-L124
aequologica/geppaequo
geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/auth/MethodUtils.java
MethodUtils.getAccessibleMethod
public static Method getAccessibleMethod( Class<?> clazz, String methodName, Class<?>[] parameterTypes) { """ <p>Return an accessible method (that is, one that can be invoked via reflection) with given name and parameters. If no such method can be found, return <code>null</code>. This is just a convenient wrapper for {@link #getAccessibleMethod(Method method)}.</p> @param clazz get method from this class @param methodName get method with this name @param parameterTypes with these parameters types @return The accessible method """ try { MethodDescriptor md = new MethodDescriptor(clazz, methodName, parameterTypes, true); // Check the cache first Method method = getCachedMethod(md); if (method != null) { return method; } method = getAccessibleMethod (clazz, clazz.getMethod(methodName, parameterTypes)); cacheMethod(md, method); return method; } catch (NoSuchMethodException e) { return (null); } }
java
public static Method getAccessibleMethod( Class<?> clazz, String methodName, Class<?>[] parameterTypes) { try { MethodDescriptor md = new MethodDescriptor(clazz, methodName, parameterTypes, true); // Check the cache first Method method = getCachedMethod(md); if (method != null) { return method; } method = getAccessibleMethod (clazz, clazz.getMethod(methodName, parameterTypes)); cacheMethod(md, method); return method; } catch (NoSuchMethodException e) { return (null); } }
[ "public", "static", "Method", "getAccessibleMethod", "(", "Class", "<", "?", ">", "clazz", ",", "String", "methodName", ",", "Class", "<", "?", ">", "[", "]", "parameterTypes", ")", "{", "try", "{", "MethodDescriptor", "md", "=", "new", "MethodDescriptor", ...
<p>Return an accessible method (that is, one that can be invoked via reflection) with given name and parameters. If no such method can be found, return <code>null</code>. This is just a convenient wrapper for {@link #getAccessibleMethod(Method method)}.</p> @param clazz get method from this class @param methodName get method with this name @param parameterTypes with these parameters types @return The accessible method
[ "<p", ">", "Return", "an", "accessible", "method", "(", "that", "is", "one", "that", "can", "be", "invoked", "via", "reflection", ")", "with", "given", "name", "and", "parameters", ".", "If", "no", "such", "method", "can", "be", "found", "return", "<code...
train
https://github.com/aequologica/geppaequo/blob/b72e5f6356535fd045a931f8c544d4a8ea6e35a2/geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/auth/MethodUtils.java#L727-L747
lightblue-platform/lightblue-migrator
facade/src/main/java/com/redhat/lightblue/migrator/facade/ServiceFacade.java
ServiceFacade.getWithTimeout
private <T> T getWithTimeout(ListenableFuture<T> listenableFuture, String methodName, FacadeOperation facadeOperation, int destinationCallTimeout) throws InterruptedException, ExecutionException, TimeoutException { """ Call destination (lightblue) using a timeout in dual read/write phases. Do not use facade timeout during lightblue proxy and kinda proxy phases (when reading from source is disabled). @param listenableFuture @param methodName method name is used to read method specific timeout configuration @param destinationCallTimeout Set future timeout to this amount @return @throws InterruptedException @throws ExecutionException @throws TimeoutException """ // not reading from source/legacy means this is either proxy or kinda proxy phase // in that case, ignore timeout settings for Lightblue call if (!shouldSource(FacadeOperation.READ) || timeoutConfiguration.getTimeoutMS(methodName, facadeOperation) <= 0) { return listenableFuture.get(); } else { return listenableFuture.get(destinationCallTimeout, TimeUnit.MILLISECONDS); } }
java
private <T> T getWithTimeout(ListenableFuture<T> listenableFuture, String methodName, FacadeOperation facadeOperation, int destinationCallTimeout) throws InterruptedException, ExecutionException, TimeoutException { // not reading from source/legacy means this is either proxy or kinda proxy phase // in that case, ignore timeout settings for Lightblue call if (!shouldSource(FacadeOperation.READ) || timeoutConfiguration.getTimeoutMS(methodName, facadeOperation) <= 0) { return listenableFuture.get(); } else { return listenableFuture.get(destinationCallTimeout, TimeUnit.MILLISECONDS); } }
[ "private", "<", "T", ">", "T", "getWithTimeout", "(", "ListenableFuture", "<", "T", ">", "listenableFuture", ",", "String", "methodName", ",", "FacadeOperation", "facadeOperation", ",", "int", "destinationCallTimeout", ")", "throws", "InterruptedException", ",", "Ex...
Call destination (lightblue) using a timeout in dual read/write phases. Do not use facade timeout during lightblue proxy and kinda proxy phases (when reading from source is disabled). @param listenableFuture @param methodName method name is used to read method specific timeout configuration @param destinationCallTimeout Set future timeout to this amount @return @throws InterruptedException @throws ExecutionException @throws TimeoutException
[ "Call", "destination", "(", "lightblue", ")", "using", "a", "timeout", "in", "dual", "read", "/", "write", "phases", ".", "Do", "not", "use", "facade", "timeout", "during", "lightblue", "proxy", "and", "kinda", "proxy", "phases", "(", "when", "reading", "f...
train
https://github.com/lightblue-platform/lightblue-migrator/blob/ec20748557b40d1f7851e1816d1b76dae48d2027/facade/src/main/java/com/redhat/lightblue/migrator/facade/ServiceFacade.java#L198-L206
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/PhotosetsApi.java
PhotosetsApi.editPhotos
public Response editPhotos(String photosetId, String primaryPhotoId, List<String> photoIds) throws JinxException { """ Modify the photos in a photoset. Use this method to add, remove and re-order photos. <br> This method requires authentication with 'write' permission. <br> This method has no specific response - It returns an empty success response if it completes without error. @param photosetId id of the photoset to modify. The photoset must belong to the calling user. Required. @param primaryPhotoId id of the photo to use as the 'primary' photo for the set. This id must also be passed along in photo_ids list argument. Required. @param photoIds list of photo ids to include in the set. They will appear in the set in the order sent. This list must contain the primary photo id. All photos must belong to the owner of the set. This list of photos replaces the existing list. Call addPhoto to append a photo to a set. Required. @return success response if it completes without error. @throws JinxException if required parameters are null, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.photosets.editPhotos.html">flickr.photosets.editPhotos</a> """ JinxUtils.validateParams(photosetId, primaryPhotoId, photoIds); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photosets.editPhotos"); params.put("photoset_id", photosetId); params.put("primary_photo_id", primaryPhotoId); StringBuilder builder = new StringBuilder(); for (String id : photoIds) { builder.append(id).append(','); } builder.deleteCharAt(builder.length() - 1); params.put("photo_ids", builder.toString()); return jinx.flickrPost(params, Response.class); }
java
public Response editPhotos(String photosetId, String primaryPhotoId, List<String> photoIds) throws JinxException { JinxUtils.validateParams(photosetId, primaryPhotoId, photoIds); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photosets.editPhotos"); params.put("photoset_id", photosetId); params.put("primary_photo_id", primaryPhotoId); StringBuilder builder = new StringBuilder(); for (String id : photoIds) { builder.append(id).append(','); } builder.deleteCharAt(builder.length() - 1); params.put("photo_ids", builder.toString()); return jinx.flickrPost(params, Response.class); }
[ "public", "Response", "editPhotos", "(", "String", "photosetId", ",", "String", "primaryPhotoId", ",", "List", "<", "String", ">", "photoIds", ")", "throws", "JinxException", "{", "JinxUtils", ".", "validateParams", "(", "photosetId", ",", "primaryPhotoId", ",", ...
Modify the photos in a photoset. Use this method to add, remove and re-order photos. <br> This method requires authentication with 'write' permission. <br> This method has no specific response - It returns an empty success response if it completes without error. @param photosetId id of the photoset to modify. The photoset must belong to the calling user. Required. @param primaryPhotoId id of the photo to use as the 'primary' photo for the set. This id must also be passed along in photo_ids list argument. Required. @param photoIds list of photo ids to include in the set. They will appear in the set in the order sent. This list must contain the primary photo id. All photos must belong to the owner of the set. This list of photos replaces the existing list. Call addPhoto to append a photo to a set. Required. @return success response if it completes without error. @throws JinxException if required parameters are null, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.photosets.editPhotos.html">flickr.photosets.editPhotos</a>
[ "Modify", "the", "photos", "in", "a", "photoset", ".", "Use", "this", "method", "to", "add", "remove", "and", "re", "-", "order", "photos", ".", "<br", ">", "This", "method", "requires", "authentication", "with", "write", "permission", ".", "<br", ">", "...
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PhotosetsApi.java#L162-L176
agmip/agmip-common-functions
src/main/java/org/agmip/functions/PTSaxton2006.java
PTSaxton2006.calcSatMatric
public static String calcSatMatric(String slsnd, String slcly, String omPct) { """ Equation 16 for calculating Saturated conductivity (matric soil), mm/h @param slsnd Sand weight percentage by layer ([0,100]%) @param slcly Clay weight percentage by layer ([0,100]%) @param omPct Organic matter weight percentage by layer ([0,100]%), (= SLOC * 1.72) """ String satMt = divide(calcSaturatedMoisture(slsnd, slcly, omPct), "100"); String mt33 = divide(calcMoisture33Kpa(slsnd, slcly, omPct), "100"); String lamda = calcLamda(slsnd, slcly, omPct); String ret = product("1930", pow(substract(satMt, mt33), substract("3", lamda))); LOG.debug("Calculate result for Saturated conductivity (matric soil), mm/h is {}", ret); return ret; }
java
public static String calcSatMatric(String slsnd, String slcly, String omPct) { String satMt = divide(calcSaturatedMoisture(slsnd, slcly, omPct), "100"); String mt33 = divide(calcMoisture33Kpa(slsnd, slcly, omPct), "100"); String lamda = calcLamda(slsnd, slcly, omPct); String ret = product("1930", pow(substract(satMt, mt33), substract("3", lamda))); LOG.debug("Calculate result for Saturated conductivity (matric soil), mm/h is {}", ret); return ret; }
[ "public", "static", "String", "calcSatMatric", "(", "String", "slsnd", ",", "String", "slcly", ",", "String", "omPct", ")", "{", "String", "satMt", "=", "divide", "(", "calcSaturatedMoisture", "(", "slsnd", ",", "slcly", ",", "omPct", ")", ",", "\"100\"", ...
Equation 16 for calculating Saturated conductivity (matric soil), mm/h @param slsnd Sand weight percentage by layer ([0,100]%) @param slcly Clay weight percentage by layer ([0,100]%) @param omPct Organic matter weight percentage by layer ([0,100]%), (= SLOC * 1.72)
[ "Equation", "16", "for", "calculating", "Saturated", "conductivity", "(", "matric", "soil", ")", "mm", "/", "h" ]
train
https://github.com/agmip/agmip-common-functions/blob/4efa3042178841b026ca6fba9c96da02fbfb9a8e/src/main/java/org/agmip/functions/PTSaxton2006.java#L337-L345
zandero/rest.vertx
src/main/java/com/zandero/rest/data/ClassFactory.java
ClassFactory.constructType
public static <T> Object constructType(Class<T> type, String fromValue) throws ClassFactoryException { """ Aims to construct given type utilizing a constructor that takes String or other primitive type values @param type to be constructed @param fromValue constructor param @param <T> type of value @return class object @throws ClassFactoryException in case type could not be constructed """ Assert.notNull(type, "Missing type!"); // a primitive or "simple" type if (isSimpleType(type)) { return stringToPrimitiveType(fromValue, type); } // have a constructor that accepts a single argument (String or any other primitive type that can be converted from String) Pair<Boolean, T> result = constructViaConstructor(type, fromValue); if (result.getKey()) { return result.getValue(); } result = constructViaMethod(type, fromValue); if (result.getKey()) { return result.getValue(); } // // have a registered implementation of ParamConverterProvider JAX-RS extension SPI that returns a ParamConverter instance capable of a "from string" conversion for the type. // // Be List, Set or SortedSet, where T satisfies 2, 3 or 4 above. The resulting collection is read-only. /*if (type.isAssignableFrom(List.class) || type.isAssignableFrom(Set.class) || type.isAssignableFrom(SortedSet.class))*/ throw new ClassFactoryException("Could not construct: " + type + " with default value: '" + fromValue + "', " + "must provide String only or primitive type constructor, " + "static fromString() or valueOf() methods!", null); }
java
public static <T> Object constructType(Class<T> type, String fromValue) throws ClassFactoryException { Assert.notNull(type, "Missing type!"); // a primitive or "simple" type if (isSimpleType(type)) { return stringToPrimitiveType(fromValue, type); } // have a constructor that accepts a single argument (String or any other primitive type that can be converted from String) Pair<Boolean, T> result = constructViaConstructor(type, fromValue); if (result.getKey()) { return result.getValue(); } result = constructViaMethod(type, fromValue); if (result.getKey()) { return result.getValue(); } // // have a registered implementation of ParamConverterProvider JAX-RS extension SPI that returns a ParamConverter instance capable of a "from string" conversion for the type. // // Be List, Set or SortedSet, where T satisfies 2, 3 or 4 above. The resulting collection is read-only. /*if (type.isAssignableFrom(List.class) || type.isAssignableFrom(Set.class) || type.isAssignableFrom(SortedSet.class))*/ throw new ClassFactoryException("Could not construct: " + type + " with default value: '" + fromValue + "', " + "must provide String only or primitive type constructor, " + "static fromString() or valueOf() methods!", null); }
[ "public", "static", "<", "T", ">", "Object", "constructType", "(", "Class", "<", "T", ">", "type", ",", "String", "fromValue", ")", "throws", "ClassFactoryException", "{", "Assert", ".", "notNull", "(", "type", ",", "\"Missing type!\"", ")", ";", "// a primi...
Aims to construct given type utilizing a constructor that takes String or other primitive type values @param type to be constructed @param fromValue constructor param @param <T> type of value @return class object @throws ClassFactoryException in case type could not be constructed
[ "Aims", "to", "construct", "given", "type", "utilizing", "a", "constructor", "that", "takes", "String", "or", "other", "primitive", "type", "values" ]
train
https://github.com/zandero/rest.vertx/blob/ba458720cf59e076953eab9dac7227eeaf9e58ce/src/main/java/com/zandero/rest/data/ClassFactory.java#L455-L488
BioPAX/Paxtools
pattern/src/main/java/org/biopax/paxtools/pattern/miner/SIFSearcher.java
SIFSearcher.searchSIF
public boolean searchSIF(Model model, OutputStream out) { """ Searches the given model with the contained miners. Writes the textual result to the given output stream. Closes the stream at the end. Produces the simplest version of SIF format. @param model model to search @param out stream to write @return true if any output produced successfully """ return searchSIF(model, out, new SIFToText() { @Override public String convert(SIFInteraction inter) { return inter.toString(); } }); }
java
public boolean searchSIF(Model model, OutputStream out) { return searchSIF(model, out, new SIFToText() { @Override public String convert(SIFInteraction inter) { return inter.toString(); } }); }
[ "public", "boolean", "searchSIF", "(", "Model", "model", ",", "OutputStream", "out", ")", "{", "return", "searchSIF", "(", "model", ",", "out", ",", "new", "SIFToText", "(", ")", "{", "@", "Override", "public", "String", "convert", "(", "SIFInteraction", "...
Searches the given model with the contained miners. Writes the textual result to the given output stream. Closes the stream at the end. Produces the simplest version of SIF format. @param model model to search @param out stream to write @return true if any output produced successfully
[ "Searches", "the", "given", "model", "with", "the", "contained", "miners", ".", "Writes", "the", "textual", "result", "to", "the", "given", "output", "stream", ".", "Closes", "the", "stream", "at", "the", "end", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/SIFSearcher.java#L194-L203
autermann/yaml
src/main/java/com/github/autermann/yaml/nodes/YamlMappingNode.java
YamlMappingNode.put
public T put(YamlNode key, int value) { """ Adds the specified {@code key}/{@code value} pair to this mapping. @param key the key @param value the value @return {@code this} """ return put(key, getNodeFactory().intNode(value)); }
java
public T put(YamlNode key, int value) { return put(key, getNodeFactory().intNode(value)); }
[ "public", "T", "put", "(", "YamlNode", "key", ",", "int", "value", ")", "{", "return", "put", "(", "key", ",", "getNodeFactory", "(", ")", ".", "intNode", "(", "value", ")", ")", ";", "}" ]
Adds the specified {@code key}/{@code value} pair to this mapping. @param key the key @param value the value @return {@code this}
[ "Adds", "the", "specified", "{", "@code", "key", "}", "/", "{", "@code", "value", "}", "pair", "to", "this", "mapping", "." ]
train
https://github.com/autermann/yaml/blob/5f8ab03e4fec3a2abe72c03561cdaa3a3936634d/src/main/java/com/github/autermann/yaml/nodes/YamlMappingNode.java#L516-L518
datacleaner/AnalyzerBeans
core/src/main/java/org/eobjects/analyzer/util/convert/ResourceConverter.java
ResourceConverter.parseStructure
public ResourceStructure parseStructure(String str) { """ Parses a string in order to produce a {@link ResourceStructure} object @param str @return """ Matcher matcher = RESOURCE_PATTERN.matcher(str); if (!matcher.find()) { logger.info("Did not find any scheme definition in resource path: {}. Using default scheme: {}.", str, _defaultScheme); return new ResourceStructure(_defaultScheme, str); } String scheme = matcher.group(1); String path = matcher.group(2); return new ResourceStructure(scheme, path); }
java
public ResourceStructure parseStructure(String str) { Matcher matcher = RESOURCE_PATTERN.matcher(str); if (!matcher.find()) { logger.info("Did not find any scheme definition in resource path: {}. Using default scheme: {}.", str, _defaultScheme); return new ResourceStructure(_defaultScheme, str); } String scheme = matcher.group(1); String path = matcher.group(2); return new ResourceStructure(scheme, path); }
[ "public", "ResourceStructure", "parseStructure", "(", "String", "str", ")", "{", "Matcher", "matcher", "=", "RESOURCE_PATTERN", ".", "matcher", "(", "str", ")", ";", "if", "(", "!", "matcher", ".", "find", "(", ")", ")", "{", "logger", ".", "info", "(", ...
Parses a string in order to produce a {@link ResourceStructure} object @param str @return
[ "Parses", "a", "string", "in", "order", "to", "produce", "a", "{", "@link", "ResourceStructure", "}", "object" ]
train
https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/core/src/main/java/org/eobjects/analyzer/util/convert/ResourceConverter.java#L161-L171
spring-projects/spring-android
spring-android-rest-template/src/main/java/org/springframework/http/converter/json/MappingJackson2HttpMessageConverter.java
MappingJackson2HttpMessageConverter.getJavaType
protected JavaType getJavaType(Type type, Class<?> contextClass) { """ Return the Jackson {@link JavaType} for the specified type and context class. <p>The default implementation returns {@link ObjectMapper#constructType(java.lang.reflect.Type)} or {@code ObjectMapper.getTypeFactory().constructType(type, contextClass)}, but this can be overridden in subclasses, to allow for custom generic collection handling. For instance: <pre class="code"> protected JavaType getJavaType(Type type) { if (type instanceof Class && List.class.isAssignableFrom((Class)type)) { return TypeFactory.collectionType(ArrayList.class, MyBean.class); } else { return super.getJavaType(type); } } </pre> @param type the type to return the java type for @param contextClass a context class for the target type, for example a class in which the target type appears in a method signature, can be {@code null} signature, can be {@code null} @return the java type """ return (contextClass != null) ? this.objectMapper.getTypeFactory().constructType(type, contextClass) : this.objectMapper.constructType(type); }
java
protected JavaType getJavaType(Type type, Class<?> contextClass) { return (contextClass != null) ? this.objectMapper.getTypeFactory().constructType(type, contextClass) : this.objectMapper.constructType(type); }
[ "protected", "JavaType", "getJavaType", "(", "Type", "type", ",", "Class", "<", "?", ">", "contextClass", ")", "{", "return", "(", "contextClass", "!=", "null", ")", "?", "this", ".", "objectMapper", ".", "getTypeFactory", "(", ")", ".", "constructType", "...
Return the Jackson {@link JavaType} for the specified type and context class. <p>The default implementation returns {@link ObjectMapper#constructType(java.lang.reflect.Type)} or {@code ObjectMapper.getTypeFactory().constructType(type, contextClass)}, but this can be overridden in subclasses, to allow for custom generic collection handling. For instance: <pre class="code"> protected JavaType getJavaType(Type type) { if (type instanceof Class && List.class.isAssignableFrom((Class)type)) { return TypeFactory.collectionType(ArrayList.class, MyBean.class); } else { return super.getJavaType(type); } } </pre> @param type the type to return the java type for @param contextClass a context class for the target type, for example a class in which the target type appears in a method signature, can be {@code null} signature, can be {@code null} @return the java type
[ "Return", "the", "Jackson", "{" ]
train
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/converter/json/MappingJackson2HttpMessageConverter.java#L232-L236
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java
SARLOperationHelper._hasSideEffects
protected Boolean _hasSideEffects(XCollectionLiteral expression, ISideEffectContext context) { """ Test if the given expression has side effects. @param expression the expression. @param context the list of context expressions. @return {@code true} if the expression has side effects. """ context.open(); for (final XExpression ex : expression.getElements()) { if (hasSideEffects(ex, context)) { return true; } } context.close(); return false; }
java
protected Boolean _hasSideEffects(XCollectionLiteral expression, ISideEffectContext context) { context.open(); for (final XExpression ex : expression.getElements()) { if (hasSideEffects(ex, context)) { return true; } } context.close(); return false; }
[ "protected", "Boolean", "_hasSideEffects", "(", "XCollectionLiteral", "expression", ",", "ISideEffectContext", "context", ")", "{", "context", ".", "open", "(", ")", ";", "for", "(", "final", "XExpression", "ex", ":", "expression", ".", "getElements", "(", ")", ...
Test if the given expression has side effects. @param expression the expression. @param context the list of context expressions. @return {@code true} if the expression has side effects.
[ "Test", "if", "the", "given", "expression", "has", "side", "effects", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java#L464-L473
box/box-java-sdk
src/main/java/com/box/sdk/BoxRetentionPolicy.java
BoxRetentionPolicy.createIndefinitePolicy
public static BoxRetentionPolicy.Info createIndefinitePolicy(BoxAPIConnection api, String name) { """ Used to create a new indefinite retention policy. @param api the API connection to be used by the created user. @param name the name of the retention policy. @return the created retention policy's info. """ return createRetentionPolicy(api, name, TYPE_INDEFINITE, 0, ACTION_REMOVE_RETENTION); }
java
public static BoxRetentionPolicy.Info createIndefinitePolicy(BoxAPIConnection api, String name) { return createRetentionPolicy(api, name, TYPE_INDEFINITE, 0, ACTION_REMOVE_RETENTION); }
[ "public", "static", "BoxRetentionPolicy", ".", "Info", "createIndefinitePolicy", "(", "BoxAPIConnection", "api", ",", "String", "name", ")", "{", "return", "createRetentionPolicy", "(", "api", ",", "name", ",", "TYPE_INDEFINITE", ",", "0", ",", "ACTION_REMOVE_RETENT...
Used to create a new indefinite retention policy. @param api the API connection to be used by the created user. @param name the name of the retention policy. @return the created retention policy's info.
[ "Used", "to", "create", "a", "new", "indefinite", "retention", "policy", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxRetentionPolicy.java#L93-L95
jenkinsci/jenkins
core/src/main/java/hudson/util/Futures.java
Futures.precomputed
public static <T> Future<T> precomputed(final T value) { """ Creates a {@link Future} instance that already has its value pre-computed. """ return new Future<T>() { public boolean cancel(boolean mayInterruptIfRunning) { return false; } public boolean isCancelled() { return false; } public boolean isDone() { return true; } public T get() { return value; } public T get(long timeout, TimeUnit unit) { return value; } }; }
java
public static <T> Future<T> precomputed(final T value) { return new Future<T>() { public boolean cancel(boolean mayInterruptIfRunning) { return false; } public boolean isCancelled() { return false; } public boolean isDone() { return true; } public T get() { return value; } public T get(long timeout, TimeUnit unit) { return value; } }; }
[ "public", "static", "<", "T", ">", "Future", "<", "T", ">", "precomputed", "(", "final", "T", "value", ")", "{", "return", "new", "Future", "<", "T", ">", "(", ")", "{", "public", "boolean", "cancel", "(", "boolean", "mayInterruptIfRunning", ")", "{", ...
Creates a {@link Future} instance that already has its value pre-computed.
[ "Creates", "a", "{" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/Futures.java#L39-L61
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/FieldToUpperHandler.java
FieldToUpperHandler.doSetData
public int doSetData(Object objData, boolean bDisplayOption, int iMoveMode) { """ Move the physical binary data to this field. @param objData the raw data to set the basefield to. @param bDisplayOption If true, display the change. @param iMoveMode The type of move being done (init/read/screen). @return The error code (or NORMAL_RETURN if okay). """ if (objData instanceof String) objData = ((String)objData).toUpperCase(); return super.doSetData(objData, bDisplayOption, iMoveMode); }
java
public int doSetData(Object objData, boolean bDisplayOption, int iMoveMode) { if (objData instanceof String) objData = ((String)objData).toUpperCase(); return super.doSetData(objData, bDisplayOption, iMoveMode); }
[ "public", "int", "doSetData", "(", "Object", "objData", ",", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "if", "(", "objData", "instanceof", "String", ")", "objData", "=", "(", "(", "String", ")", "objData", ")", ".", "toUpperCase", "("...
Move the physical binary data to this field. @param objData the raw data to set the basefield to. @param bDisplayOption If true, display the change. @param iMoveMode The type of move being done (init/read/screen). @return The error code (or NORMAL_RETURN if okay).
[ "Move", "the", "physical", "binary", "data", "to", "this", "field", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/FieldToUpperHandler.java#L55-L60
cycorp/api-suite
core-api/src/main/java/com/cyc/kb/exception/DeleteException.java
DeleteException.fromThrowable
public static DeleteException fromThrowable(String message, Throwable cause) { """ Converts a Throwable to a DeleteException with the specified detail message. If the Throwable is a DeleteException and if the Throwable's message is identical to the one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in a new DeleteException with the detail message. @param cause the Throwable to convert @param message the specified detail message @return a DeleteException """ return (cause instanceof DeleteException && Objects.equals(message, cause.getMessage())) ? (DeleteException) cause : new DeleteException(message, cause); }
java
public static DeleteException fromThrowable(String message, Throwable cause) { return (cause instanceof DeleteException && Objects.equals(message, cause.getMessage())) ? (DeleteException) cause : new DeleteException(message, cause); }
[ "public", "static", "DeleteException", "fromThrowable", "(", "String", "message", ",", "Throwable", "cause", ")", "{", "return", "(", "cause", "instanceof", "DeleteException", "&&", "Objects", ".", "equals", "(", "message", ",", "cause", ".", "getMessage", "(", ...
Converts a Throwable to a DeleteException with the specified detail message. If the Throwable is a DeleteException and if the Throwable's message is identical to the one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in a new DeleteException with the detail message. @param cause the Throwable to convert @param message the specified detail message @return a DeleteException
[ "Converts", "a", "Throwable", "to", "a", "DeleteException", "with", "the", "specified", "detail", "message", ".", "If", "the", "Throwable", "is", "a", "DeleteException", "and", "if", "the", "Throwable", "s", "message", "is", "identical", "to", "the", "one", ...
train
https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/DeleteException.java#L62-L66
taimos/dvalin
interconnect/model/src/main/java/de/taimos/dvalin/interconnect/model/service/DaemonScanner.java
DaemonScanner.getAnnotation
public static <A extends Annotation> A getAnnotation(final Class<A> annotation, final Method method) { """ Checks also the inheritance hierarchy. @param annotation Annotation @param method Method @param <A> Annotation @return Annotation or null """ try { return DaemonScanner.isAnnotationPresent(annotation, method.getDeclaringClass(), method.getName(), method.getParameterTypes()); } catch(final NoSuchMethodException e) { return null; } }
java
public static <A extends Annotation> A getAnnotation(final Class<A> annotation, final Method method) { try { return DaemonScanner.isAnnotationPresent(annotation, method.getDeclaringClass(), method.getName(), method.getParameterTypes()); } catch(final NoSuchMethodException e) { return null; } }
[ "public", "static", "<", "A", "extends", "Annotation", ">", "A", "getAnnotation", "(", "final", "Class", "<", "A", ">", "annotation", ",", "final", "Method", "method", ")", "{", "try", "{", "return", "DaemonScanner", ".", "isAnnotationPresent", "(", "annotat...
Checks also the inheritance hierarchy. @param annotation Annotation @param method Method @param <A> Annotation @return Annotation or null
[ "Checks", "also", "the", "inheritance", "hierarchy", "." ]
train
https://github.com/taimos/dvalin/blob/ff8f1bf594e43d7e8ca8de0b4da9f923b66a1a47/interconnect/model/src/main/java/de/taimos/dvalin/interconnect/model/service/DaemonScanner.java#L147-L153
hypercube1024/firefly
firefly/src/main/java/com/firefly/codec/http2/model/MimeTypes.java
MimeTypes.addMimeMapping
public void addMimeMapping(String extension, String type) { """ Set a mime mapping @param extension the extension @param type the mime type """ _mimeMap.put(StringUtils.asciiToLowerCase(extension), normalizeMimeType(type)); }
java
public void addMimeMapping(String extension, String type) { _mimeMap.put(StringUtils.asciiToLowerCase(extension), normalizeMimeType(type)); }
[ "public", "void", "addMimeMapping", "(", "String", "extension", ",", "String", "type", ")", "{", "_mimeMap", ".", "put", "(", "StringUtils", ".", "asciiToLowerCase", "(", "extension", ")", ",", "normalizeMimeType", "(", "type", ")", ")", ";", "}" ]
Set a mime mapping @param extension the extension @param type the mime type
[ "Set", "a", "mime", "mapping" ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/http2/model/MimeTypes.java#L309-L311
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/colors/ColorInterpolator.java
ColorInterpolator.interpolateColor
public static Color interpolateColor( Color color1, Color color2, float fraction ) { """ Interpolate a color at a given fraction between 0 and 1. @param color1 start color. @param color2 end color. @param fraction the fraction to interpolate. @return the new color. """ float int2Float = 1f / 255f; fraction = Math.min(fraction, 1f); fraction = Math.max(fraction, 0f); float r1 = color1.getRed() * int2Float; float g1 = color1.getGreen() * int2Float; float b1 = color1.getBlue() * int2Float; float a1 = color1.getAlpha() * int2Float; float r2 = color2.getRed() * int2Float; float g2 = color2.getGreen() * int2Float; float b2 = color2.getBlue() * int2Float; float a2 = color2.getAlpha() * int2Float; float deltaR = r2 - r1; float deltaG = g2 - g1; float deltaB = b2 - b1; float deltaA = a2 - a1; float red = r1 + (deltaR * fraction); float green = g1 + (deltaG * fraction); float blue = b1 + (deltaB * fraction); float alpha = a1 + (deltaA * fraction); red = Math.min(red, 1f); red = Math.max(red, 0f); green = Math.min(green, 1f); green = Math.max(green, 0f); blue = Math.min(blue, 1f); blue = Math.max(blue, 0f); alpha = Math.min(alpha, 1f); alpha = Math.max(alpha, 0f); return new Color(red, green, blue, alpha); }
java
public static Color interpolateColor( Color color1, Color color2, float fraction ) { float int2Float = 1f / 255f; fraction = Math.min(fraction, 1f); fraction = Math.max(fraction, 0f); float r1 = color1.getRed() * int2Float; float g1 = color1.getGreen() * int2Float; float b1 = color1.getBlue() * int2Float; float a1 = color1.getAlpha() * int2Float; float r2 = color2.getRed() * int2Float; float g2 = color2.getGreen() * int2Float; float b2 = color2.getBlue() * int2Float; float a2 = color2.getAlpha() * int2Float; float deltaR = r2 - r1; float deltaG = g2 - g1; float deltaB = b2 - b1; float deltaA = a2 - a1; float red = r1 + (deltaR * fraction); float green = g1 + (deltaG * fraction); float blue = b1 + (deltaB * fraction); float alpha = a1 + (deltaA * fraction); red = Math.min(red, 1f); red = Math.max(red, 0f); green = Math.min(green, 1f); green = Math.max(green, 0f); blue = Math.min(blue, 1f); blue = Math.max(blue, 0f); alpha = Math.min(alpha, 1f); alpha = Math.max(alpha, 0f); return new Color(red, green, blue, alpha); }
[ "public", "static", "Color", "interpolateColor", "(", "Color", "color1", ",", "Color", "color2", ",", "float", "fraction", ")", "{", "float", "int2Float", "=", "1f", "/", "255f", ";", "fraction", "=", "Math", ".", "min", "(", "fraction", ",", "1f", ")", ...
Interpolate a color at a given fraction between 0 and 1. @param color1 start color. @param color2 end color. @param fraction the fraction to interpolate. @return the new color.
[ "Interpolate", "a", "color", "at", "a", "given", "fraction", "between", "0", "and", "1", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/colors/ColorInterpolator.java#L161-L196