repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
liferay/com-liferay-commerce
commerce-product-api/src/main/java/com/liferay/commerce/product/model/CPOptionCategoryWrapper.java
CPOptionCategoryWrapper.getTitle
@Override public String getTitle(String languageId, boolean useDefault) { return _cpOptionCategory.getTitle(languageId, useDefault); }
java
@Override public String getTitle(String languageId, boolean useDefault) { return _cpOptionCategory.getTitle(languageId, useDefault); }
[ "@", "Override", "public", "String", "getTitle", "(", "String", "languageId", ",", "boolean", "useDefault", ")", "{", "return", "_cpOptionCategory", ".", "getTitle", "(", "languageId", ",", "useDefault", ")", ";", "}" ]
Returns the localized title of this cp option category in the language, optionally using the default language if no localization exists for the requested language. @param languageId the ID of the language @param useDefault whether to use the default language if no localization exists for the requested language @return the localized title of this cp option category
[ "Returns", "the", "localized", "title", "of", "this", "cp", "option", "category", "in", "the", "language", "optionally", "using", "the", "default", "language", "if", "no", "localization", "exists", "for", "the", "requested", "language", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-api/src/main/java/com/liferay/commerce/product/model/CPOptionCategoryWrapper.java#L408-L411
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java
AvatarNode.stopRPC
protected void stopRPC(boolean interruptClientHandlers) throws IOException { try { // stop avatardatanode server stopRPCInternal(server, "avatardatanode", interruptClientHandlers); // stop namenode rpc (client, datanode) super.stopRPC(interruptClientHandlers); // wait for avatardatanode rpc stopWaitRPCInternal(server, "avatardatanode"); } catch (InterruptedException ex) { throw new IOException("stopRPC() interrupted", ex); } }
java
protected void stopRPC(boolean interruptClientHandlers) throws IOException { try { // stop avatardatanode server stopRPCInternal(server, "avatardatanode", interruptClientHandlers); // stop namenode rpc (client, datanode) super.stopRPC(interruptClientHandlers); // wait for avatardatanode rpc stopWaitRPCInternal(server, "avatardatanode"); } catch (InterruptedException ex) { throw new IOException("stopRPC() interrupted", ex); } }
[ "protected", "void", "stopRPC", "(", "boolean", "interruptClientHandlers", ")", "throws", "IOException", "{", "try", "{", "// stop avatardatanode server", "stopRPCInternal", "(", "server", ",", "\"avatardatanode\"", ",", "interruptClientHandlers", ")", ";", "// stop namen...
Stops all RPC threads and ensures that all RPC handlers have exited. Stops all communication to the namenode.
[ "Stops", "all", "RPC", "threads", "and", "ensures", "that", "all", "RPC", "handlers", "have", "exited", ".", "Stops", "all", "communication", "to", "the", "namenode", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java#L651-L664
tango-controls/JTango
server/src/main/java/org/tango/server/attribute/AttributeImpl.java
AttributeImpl.setValue
private void setValue(final AttributeValue value, boolean fromMemorizedValue) throws DevFailed { if (!config.getWritable().equals(AttrWriteType.READ)) { // final Profiler profilerPeriod = new Profiler("write attribute " + name); // profilerPeriod.start("check"); checkSetErrors(value); // profilerPeriod.start("clone"); // copy value for safety and transform it to 2D array if necessary try { writeValue = (AttributeValue) value.clone(); } catch (final CloneNotSupportedException e) { throw DevFailedUtils.newDevFailed(e); } // profilerPeriod.start("after clone"); checkMinMaxValue(); writtenTimestamp = writeValue.getTime(); int dimY = writeValue.getYDim(); if (config.getFormat().equals(AttrDataFormat.IMAGE) && dimY == 0) { // force at least 1 to obtain a real 2D array with [][] dimY = 1; } // profilerPeriod.start("convert image"); value.setValue(ArrayUtils.fromArrayTo2DArray(writeValue.getValue(), writeValue.getXDim(), dimY), writtenTimestamp); behavior.setValue(value); if (isMemorized() && getFormat().equals(AttrDataFormat.SCALAR) && !fromMemorizedValue) { // TODO: refactoring to manage performance issues for spectrum and // images attributePropertiesManager.setAttributePropertyInDB(getName(), Constants.MEMORIZED_VALUE, getValueAsString()[0]); // if (getFormat().equals(AttrDataFormat.IMAGE)) { // deviceImpl.setAttributePropertyInDB(att.getName(), // Constants.MEMORIZED_VALUE_DIM, // Integer.toString(value4.w_dim.dim_x), // Integer.toString(value4.w_dim.dim_y)); // } } // profilerPeriod.stop().print(); } else { throw DevFailedUtils.newDevFailed(ExceptionMessages.ATTR_NOT_WRITABLE, name + " is not writable"); } }
java
private void setValue(final AttributeValue value, boolean fromMemorizedValue) throws DevFailed { if (!config.getWritable().equals(AttrWriteType.READ)) { // final Profiler profilerPeriod = new Profiler("write attribute " + name); // profilerPeriod.start("check"); checkSetErrors(value); // profilerPeriod.start("clone"); // copy value for safety and transform it to 2D array if necessary try { writeValue = (AttributeValue) value.clone(); } catch (final CloneNotSupportedException e) { throw DevFailedUtils.newDevFailed(e); } // profilerPeriod.start("after clone"); checkMinMaxValue(); writtenTimestamp = writeValue.getTime(); int dimY = writeValue.getYDim(); if (config.getFormat().equals(AttrDataFormat.IMAGE) && dimY == 0) { // force at least 1 to obtain a real 2D array with [][] dimY = 1; } // profilerPeriod.start("convert image"); value.setValue(ArrayUtils.fromArrayTo2DArray(writeValue.getValue(), writeValue.getXDim(), dimY), writtenTimestamp); behavior.setValue(value); if (isMemorized() && getFormat().equals(AttrDataFormat.SCALAR) && !fromMemorizedValue) { // TODO: refactoring to manage performance issues for spectrum and // images attributePropertiesManager.setAttributePropertyInDB(getName(), Constants.MEMORIZED_VALUE, getValueAsString()[0]); // if (getFormat().equals(AttrDataFormat.IMAGE)) { // deviceImpl.setAttributePropertyInDB(att.getName(), // Constants.MEMORIZED_VALUE_DIM, // Integer.toString(value4.w_dim.dim_x), // Integer.toString(value4.w_dim.dim_y)); // } } // profilerPeriod.stop().print(); } else { throw DevFailedUtils.newDevFailed(ExceptionMessages.ATTR_NOT_WRITABLE, name + " is not writable"); } }
[ "private", "void", "setValue", "(", "final", "AttributeValue", "value", ",", "boolean", "fromMemorizedValue", ")", "throws", "DevFailed", "{", "if", "(", "!", "config", ".", "getWritable", "(", ")", ".", "equals", "(", "AttrWriteType", ".", "READ", ")", ")",...
Write value @param value @param fromMemorizedValue true is value comes from tangodb @throws DevFailed
[ "Write", "value" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/attribute/AttributeImpl.java#L458-L500
apache/groovy
src/main/java/org/apache/groovy/plugin/GroovyRunnerRegistry.java
GroovyRunnerRegistry.putAll
@Override public void putAll(Map<? extends String, ? extends GroovyRunner> m) { Map<String, GroovyRunner> map = getMap(); writeLock.lock(); try { cachedValues = null; for (Map.Entry<? extends String, ? extends GroovyRunner> entry : m.entrySet()) { if (entry.getKey() != null && entry.getValue() != null) { map.put(entry.getKey(), entry.getValue()); } } } finally { writeLock.unlock(); } }
java
@Override public void putAll(Map<? extends String, ? extends GroovyRunner> m) { Map<String, GroovyRunner> map = getMap(); writeLock.lock(); try { cachedValues = null; for (Map.Entry<? extends String, ? extends GroovyRunner> entry : m.entrySet()) { if (entry.getKey() != null && entry.getValue() != null) { map.put(entry.getKey(), entry.getValue()); } } } finally { writeLock.unlock(); } }
[ "@", "Override", "public", "void", "putAll", "(", "Map", "<", "?", "extends", "String", ",", "?", "extends", "GroovyRunner", ">", "m", ")", "{", "Map", "<", "String", ",", "GroovyRunner", ">", "map", "=", "getMap", "(", ")", ";", "writeLock", ".", "l...
Adds all entries from the given Map to the registry. Any entries in the provided Map that contain a {@code null} key or value will be ignored. @param m entries to add to the registry @throws NullPointerException if the given Map is {@code null}
[ "Adds", "all", "entries", "from", "the", "given", "Map", "to", "the", "registry", ".", "Any", "entries", "in", "the", "provided", "Map", "that", "contain", "a", "{", "@code", "null", "}", "key", "or", "value", "will", "be", "ignored", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/apache/groovy/plugin/GroovyRunnerRegistry.java#L356-L370
vdurmont/semver4j
src/main/java/com/vdurmont/semver4j/Requirement.java
Requirement.buildNPM
public static Requirement buildNPM(String requirement) { if (requirement.isEmpty()) { requirement = "*"; } return buildWithTokenizer(requirement, Semver.SemverType.NPM); }
java
public static Requirement buildNPM(String requirement) { if (requirement.isEmpty()) { requirement = "*"; } return buildWithTokenizer(requirement, Semver.SemverType.NPM); }
[ "public", "static", "Requirement", "buildNPM", "(", "String", "requirement", ")", "{", "if", "(", "requirement", ".", "isEmpty", "(", ")", ")", "{", "requirement", "=", "\"*\"", ";", "}", "return", "buildWithTokenizer", "(", "requirement", ",", "Semver", "."...
Builds a requirement following the rules of NPM. @param requirement the requirement as a string @return the generated requirement
[ "Builds", "a", "requirement", "following", "the", "rules", "of", "NPM", "." ]
train
https://github.com/vdurmont/semver4j/blob/3f0266e4985ac29e9da482e04001ed15fad6c3e2/src/main/java/com/vdurmont/semver4j/Requirement.java#L96-L101
JoeKerouac/utils
src/main/java/com/joe/utils/reflect/asm/AsmByteCodeUtils.java
AsmByteCodeUtils.invokeMethod
public static void invokeMethod(MethodVisitor mv, Method method, Runnable load) { // 先加载数据 load.run(); // 执行方法 if (method.getDeclaringClass().isInterface()) { mv.visitMethodInsn(INVOKEINTERFACE, convert(method.getDeclaringClass()), method.getName(), getMethodDesc(method), true); } else { mv.visitMethodInsn(INVOKEVIRTUAL, convert(method.getDeclaringClass()), method.getName(), getMethodDesc(method), false); } if (method.getReturnType() == void.class) { mv.visitInsn(ACONST_NULL); mv.visitInsn(ARETURN); } else { // 返回结果 mv.visitInsn(ARETURN); } }
java
public static void invokeMethod(MethodVisitor mv, Method method, Runnable load) { // 先加载数据 load.run(); // 执行方法 if (method.getDeclaringClass().isInterface()) { mv.visitMethodInsn(INVOKEINTERFACE, convert(method.getDeclaringClass()), method.getName(), getMethodDesc(method), true); } else { mv.visitMethodInsn(INVOKEVIRTUAL, convert(method.getDeclaringClass()), method.getName(), getMethodDesc(method), false); } if (method.getReturnType() == void.class) { mv.visitInsn(ACONST_NULL); mv.visitInsn(ARETURN); } else { // 返回结果 mv.visitInsn(ARETURN); } }
[ "public", "static", "void", "invokeMethod", "(", "MethodVisitor", "mv", ",", "Method", "method", ",", "Runnable", "load", ")", "{", "// 先加载数据", "load", ".", "run", "(", ")", ";", "// 执行方法", "if", "(", "method", ".", "getDeclaringClass", "(", ")", ".", "i...
byte code执行指定方法 @param mv MethodVisitor @param method 要执行的方法 @param load 加载方法需要的数据
[ "byte", "code执行指定方法" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/reflect/asm/AsmByteCodeUtils.java#L48-L66
alkacon/opencms-core
src/org/opencms/jsp/util/CmsStringTemplateRenderer.java
CmsStringTemplateRenderer.renderTemplate
public static String renderTemplate( CmsObject cms, String template, CmsResource content, Map<String, Object> contextObjects) { return renderTemplate(cms, template, new CmsJspContentAccessBean(cms, content), contextObjects); }
java
public static String renderTemplate( CmsObject cms, String template, CmsResource content, Map<String, Object> contextObjects) { return renderTemplate(cms, template, new CmsJspContentAccessBean(cms, content), contextObjects); }
[ "public", "static", "String", "renderTemplate", "(", "CmsObject", "cms", ",", "String", "template", ",", "CmsResource", "content", ",", "Map", "<", "String", ",", "Object", ">", "contextObjects", ")", "{", "return", "renderTemplate", "(", "cms", ",", "template...
Renders the given string template.<p> @param cms the cms context @param template the template @param content the content @param contextObjects additional context objects made available to the template @return the rendering result
[ "Renders", "the", "given", "string", "template", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsStringTemplateRenderer.java#L170-L177
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/VForDefinition.java
VForDefinition.vForVariable
private boolean vForVariable(String loopVariablesDefinition, TemplateParserContext context) { Matcher matcher = VFOR_VARIABLE.matcher(loopVariablesDefinition); if (matcher.matches()) { initLoopVariable(matcher.group(1), matcher.group(2), context); indexVariableInfo = null; return true; } return false; }
java
private boolean vForVariable(String loopVariablesDefinition, TemplateParserContext context) { Matcher matcher = VFOR_VARIABLE.matcher(loopVariablesDefinition); if (matcher.matches()) { initLoopVariable(matcher.group(1), matcher.group(2), context); indexVariableInfo = null; return true; } return false; }
[ "private", "boolean", "vForVariable", "(", "String", "loopVariablesDefinition", ",", "TemplateParserContext", "context", ")", "{", "Matcher", "matcher", "=", "VFOR_VARIABLE", ".", "matcher", "(", "loopVariablesDefinition", ")", ";", "if", "(", "matcher", ".", "match...
v-for on an array with just a loop variable: "Item item in myArray" @param loopVariablesDefinition The variable definition ("Item item" above) @param context The context of the parser @return true if we managed the case, false otherwise
[ "v", "-", "for", "on", "an", "array", "with", "just", "a", "loop", "variable", ":", "Item", "item", "in", "myArray" ]
train
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/VForDefinition.java#L80-L89
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.listEntities
public List<EntityExtractor> listEntities(UUID appId, String versionId, ListEntitiesOptionalParameter listEntitiesOptionalParameter) { return listEntitiesWithServiceResponseAsync(appId, versionId, listEntitiesOptionalParameter).toBlocking().single().body(); }
java
public List<EntityExtractor> listEntities(UUID appId, String versionId, ListEntitiesOptionalParameter listEntitiesOptionalParameter) { return listEntitiesWithServiceResponseAsync(appId, versionId, listEntitiesOptionalParameter).toBlocking().single().body(); }
[ "public", "List", "<", "EntityExtractor", ">", "listEntities", "(", "UUID", "appId", ",", "String", "versionId", ",", "ListEntitiesOptionalParameter", "listEntitiesOptionalParameter", ")", "{", "return", "listEntitiesWithServiceResponseAsync", "(", "appId", ",", "versionI...
Gets information about the entity models. @param appId The application ID. @param versionId The version ID. @param listEntitiesOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;EntityExtractor&gt; object if successful.
[ "Gets", "information", "about", "the", "entity", "models", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L1103-L1105
actorapp/actor-platform
actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java
ImageLoading.saveJpeg
public static void saveJpeg(Bitmap src, String fileName, int quality) throws ImageSaveException { save(src, fileName, Bitmap.CompressFormat.JPEG, quality); }
java
public static void saveJpeg(Bitmap src, String fileName, int quality) throws ImageSaveException { save(src, fileName, Bitmap.CompressFormat.JPEG, quality); }
[ "public", "static", "void", "saveJpeg", "(", "Bitmap", "src", ",", "String", "fileName", ",", "int", "quality", ")", "throws", "ImageSaveException", "{", "save", "(", "src", ",", "fileName", ",", "Bitmap", ".", "CompressFormat", ".", "JPEG", ",", "quality", ...
Saving image in jpeg to file with better quality 90 @param src source image @param fileName destination file name @throws ImageSaveException if it is unable to save image
[ "Saving", "image", "in", "jpeg", "to", "file", "with", "better", "quality", "90" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java#L321-L323
dkpro/dkpro-jwpl
de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/CategoryGraph.java
CategoryGraph.matchesFilter
private boolean matchesFilter(Category cat, List<String> filterList) throws WikiTitleParsingException { String categoryTitle = cat.getTitle().getPlainTitle(); for (String filter : filterList) { if (categoryTitle.startsWith(filter)) { logger.info(categoryTitle + " starts with " + filter + " => removing"); return true; } } return false; }
java
private boolean matchesFilter(Category cat, List<String> filterList) throws WikiTitleParsingException { String categoryTitle = cat.getTitle().getPlainTitle(); for (String filter : filterList) { if (categoryTitle.startsWith(filter)) { logger.info(categoryTitle + " starts with " + filter + " => removing"); return true; } } return false; }
[ "private", "boolean", "matchesFilter", "(", "Category", "cat", ",", "List", "<", "String", ">", "filterList", ")", "throws", "WikiTitleParsingException", "{", "String", "categoryTitle", "=", "cat", ".", "getTitle", "(", ")", ".", "getPlainTitle", "(", ")", ";"...
Checks whether the category title matches the filter (a filter matches a string, if the string starts with the filter expression). @param cat A category. @param filterList A list of filter strings. @return True, if the category title starts with or is equal to a string in the filter list. False, otherwise. @throws WikiTitleParsingException Thrown if errors occurred.
[ "Checks", "whether", "the", "category", "title", "matches", "the", "filter", "(", "a", "filter", "matches", "a", "string", "if", "the", "string", "starts", "with", "the", "filter", "expression", ")", "." ]
train
https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/CategoryGraph.java#L378-L387
astrapi69/jaulp-wicket
jaulp-wicket-behaviors/src/main/java/de/alpharogroup/wicket/behaviors/JavascriptAppenderBehavior.java
JavascriptAppenderBehavior.of
public static JavascriptAppenderBehavior of(final String id, final CharSequence javascript, final JavascriptBindEvent bindEvent) { return new JavascriptAppenderBehavior(id, javascript, bindEvent); }
java
public static JavascriptAppenderBehavior of(final String id, final CharSequence javascript, final JavascriptBindEvent bindEvent) { return new JavascriptAppenderBehavior(id, javascript, bindEvent); }
[ "public", "static", "JavascriptAppenderBehavior", "of", "(", "final", "String", "id", ",", "final", "CharSequence", "javascript", ",", "final", "JavascriptBindEvent", "bindEvent", ")", "{", "return", "new", "JavascriptAppenderBehavior", "(", "id", ",", "javascript", ...
Factory method to create a new {@link JavascriptAppenderBehavior} object from the given parameters. @param id the id @param javascript the javascript @param bindEvent the bind event @return the new {@link JavascriptAppenderBehavior} object
[ "Factory", "method", "to", "create", "a", "new", "{", "@link", "JavascriptAppenderBehavior", "}", "object", "from", "the", "given", "parameters", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-behaviors/src/main/java/de/alpharogroup/wicket/behaviors/JavascriptAppenderBehavior.java#L98-L102
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/AbstractMethod.java
AbstractMethod.processWrapper
protected <T> WrapperGenericList<T> processWrapper(TypeReference typeRef, URL url, String errorMessageSuffix) throws MovieDbException { String webpage = httpTools.getRequest(url); try { // Due to type erasure, this doesn't work // TypeReference<WrapperGenericList<T>> typeRef = new TypeReference<WrapperGenericList<T>>() {}; return MAPPER.readValue(webpage, typeRef); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get " + errorMessageSuffix, url, ex); } }
java
protected <T> WrapperGenericList<T> processWrapper(TypeReference typeRef, URL url, String errorMessageSuffix) throws MovieDbException { String webpage = httpTools.getRequest(url); try { // Due to type erasure, this doesn't work // TypeReference<WrapperGenericList<T>> typeRef = new TypeReference<WrapperGenericList<T>>() {}; return MAPPER.readValue(webpage, typeRef); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get " + errorMessageSuffix, url, ex); } }
[ "protected", "<", "T", ">", "WrapperGenericList", "<", "T", ">", "processWrapper", "(", "TypeReference", "typeRef", ",", "URL", "url", ",", "String", "errorMessageSuffix", ")", "throws", "MovieDbException", "{", "String", "webpage", "=", "httpTools", ".", "getRe...
Process the wrapper list and return the whole wrapper @param <T> Type of list to process @param typeRef @param url URL of the page (Error output only) @param errorMessageSuffix Error message to output (Error output only) @return @throws MovieDbException
[ "Process", "the", "wrapper", "list", "and", "return", "the", "whole", "wrapper" ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/AbstractMethod.java#L160-L169
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java
SftpClient.get
public SftpFileAttributes get(String path, FileTransferProgress progress) throws FileNotFoundException, SftpStatusException, SshException, TransferCancelledException { return get(path, progress, false); }
java
public SftpFileAttributes get(String path, FileTransferProgress progress) throws FileNotFoundException, SftpStatusException, SshException, TransferCancelledException { return get(path, progress, false); }
[ "public", "SftpFileAttributes", "get", "(", "String", "path", ",", "FileTransferProgress", "progress", ")", "throws", "FileNotFoundException", ",", "SftpStatusException", ",", "SshException", ",", "TransferCancelledException", "{", "return", "get", "(", "path", ",", "...
<p> Download the remote file to the local computer. </p> @param path the path to the remote file @param progress @return the downloaded file's attributes @throws FileNotFoundException @throws SftpStatusException @throws SshException @throws TransferCancelledException
[ "<p", ">", "Download", "the", "remote", "file", "to", "the", "local", "computer", ".", "<", "/", "p", ">" ]
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java#L800-L804
indeedeng/proctor
proctor-store-git/src/main/java/com/indeed/proctor/store/GitProctorUtils.java
GitProctorUtils.resolveSvnMigratedRevision
public static String resolveSvnMigratedRevision(final Revision revision, final String branch) { if (revision == null) { return null; } final Pattern pattern = Pattern.compile("^git-svn-id: .*" + branch + "@([0-9]+) ", Pattern.MULTILINE); final Matcher matcher = pattern.matcher(revision.getMessage()); if (matcher.find()) { return matcher.group(1); } else { return revision.getRevision(); } }
java
public static String resolveSvnMigratedRevision(final Revision revision, final String branch) { if (revision == null) { return null; } final Pattern pattern = Pattern.compile("^git-svn-id: .*" + branch + "@([0-9]+) ", Pattern.MULTILINE); final Matcher matcher = pattern.matcher(revision.getMessage()); if (matcher.find()) { return matcher.group(1); } else { return revision.getRevision(); } }
[ "public", "static", "String", "resolveSvnMigratedRevision", "(", "final", "Revision", "revision", ",", "final", "String", "branch", ")", "{", "if", "(", "revision", "==", "null", ")", "{", "return", "null", ";", "}", "final", "Pattern", "pattern", "=", "Patt...
Helper method to retrieve a canonical revision for git commits migrated from SVN. Migrated commits are detected by the presence of 'git-svn-id' in the commit message. @param revision the commit/revision to inspect @param branch the name of the branch it came from @return the original SVN revision if it was a migrated commit from the branch specified, otherwise the git revision
[ "Helper", "method", "to", "retrieve", "a", "canonical", "revision", "for", "git", "commits", "migrated", "from", "SVN", ".", "Migrated", "commits", "are", "detected", "by", "the", "presence", "of", "git", "-", "svn", "-", "id", "in", "the", "commit", "mess...
train
https://github.com/indeedeng/proctor/blob/b7795acfc26a30d013655d0e0fa1d3f8d0576571/proctor-store-git/src/main/java/com/indeed/proctor/store/GitProctorUtils.java#L26-L37
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java
SourceToHTMLConverter.convertRoot
public static void convertRoot(ConfigurationImpl configuration, RootDoc rd, DocPath outputdir) { new SourceToHTMLConverter(configuration, rd, outputdir).generate(); }
java
public static void convertRoot(ConfigurationImpl configuration, RootDoc rd, DocPath outputdir) { new SourceToHTMLConverter(configuration, rd, outputdir).generate(); }
[ "public", "static", "void", "convertRoot", "(", "ConfigurationImpl", "configuration", ",", "RootDoc", "rd", ",", "DocPath", "outputdir", ")", "{", "new", "SourceToHTMLConverter", "(", "configuration", ",", "rd", ",", "outputdir", ")", ".", "generate", "(", ")", ...
Convert the Classes in the given RootDoc to an HTML. @param configuration the configuration. @param rd the RootDoc to convert. @param outputdir the name of the directory to output to.
[ "Convert", "the", "Classes", "in", "the", "given", "RootDoc", "to", "an", "HTML", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java#L93-L96
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/LossLayer.java
LossLayer.computeScore
@Override public double computeScore(double fullNetRegTerm, boolean training, LayerWorkspaceMgr workspaceMgr) { if (input == null || labels == null) throw new IllegalStateException("Cannot calculate score without input and labels " + layerId()); this.fullNetworkRegularizationScore = fullNetRegTerm; INDArray preOut = input; ILossFunction lossFunction = layerConf().getLossFn(); //double score = lossFunction.computeScore(getLabels2d(), preOut, layerConf().getActivationFunction(), maskArray, false); double score = lossFunction.computeScore(getLabels2d(), preOut, layerConf().getActivationFn(), maskArray, false); score /= getInputMiniBatchSize(); score += fullNetworkRegularizationScore; this.score = score; return score; }
java
@Override public double computeScore(double fullNetRegTerm, boolean training, LayerWorkspaceMgr workspaceMgr) { if (input == null || labels == null) throw new IllegalStateException("Cannot calculate score without input and labels " + layerId()); this.fullNetworkRegularizationScore = fullNetRegTerm; INDArray preOut = input; ILossFunction lossFunction = layerConf().getLossFn(); //double score = lossFunction.computeScore(getLabels2d(), preOut, layerConf().getActivationFunction(), maskArray, false); double score = lossFunction.computeScore(getLabels2d(), preOut, layerConf().getActivationFn(), maskArray, false); score /= getInputMiniBatchSize(); score += fullNetworkRegularizationScore; this.score = score; return score; }
[ "@", "Override", "public", "double", "computeScore", "(", "double", "fullNetRegTerm", ",", "boolean", "training", ",", "LayerWorkspaceMgr", "workspaceMgr", ")", "{", "if", "(", "input", "==", "null", "||", "labels", "==", "null", ")", "throw", "new", "IllegalS...
Compute score after labels and input have been set. @param fullNetRegTerm Regularization score term for the entire network @param training whether score should be calculated at train or test time (this affects things like application of dropout, etc) @return score (loss function)
[ "Compute", "score", "after", "labels", "and", "input", "have", "been", "set", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/LossLayer.java#L69-L86
scaleset/scaleset-geo
src/main/java/com/scaleset/geo/math/GoogleMapsTileMath.java
GoogleMapsTileMath.pixelsToMeters
public Coordinate pixelsToMeters(double px, double py, int zoomLevel) { double res = resolution(zoomLevel); double mx = px * res - originShift; double my = -py * res + originShift; return new Coordinate(mx, my); }
java
public Coordinate pixelsToMeters(double px, double py, int zoomLevel) { double res = resolution(zoomLevel); double mx = px * res - originShift; double my = -py * res + originShift; return new Coordinate(mx, my); }
[ "public", "Coordinate", "pixelsToMeters", "(", "double", "px", ",", "double", "py", ",", "int", "zoomLevel", ")", "{", "double", "res", "=", "resolution", "(", "zoomLevel", ")", ";", "double", "mx", "=", "px", "*", "res", "-", "originShift", ";", "double...
Converts pixel coordinates in given zoom level of pyramid to EPSG:3857 @param px the X pixel coordinate @param py the Y pixel coordinate @param zoomLevel the zoom level @return The coordinate transformed to EPSG:3857
[ "Converts", "pixel", "coordinates", "in", "given", "zoom", "level", "of", "pyramid", "to", "EPSG", ":", "3857" ]
train
https://github.com/scaleset/scaleset-geo/blob/5cff2349668037dc287928a6c1a1f67c76d96b02/src/main/java/com/scaleset/geo/math/GoogleMapsTileMath.java#L249-L255
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
SecondaryIndexManager.maybeBuildSecondaryIndexes
public void maybeBuildSecondaryIndexes(Collection<SSTableReader> sstables, Set<String> idxNames) { if (idxNames.isEmpty()) return; logger.info(String.format("Submitting index build of %s for data in %s", idxNames, StringUtils.join(sstables, ", "))); SecondaryIndexBuilder builder = new SecondaryIndexBuilder(baseCfs, idxNames, new ReducingKeyIterator(sstables)); Future<?> future = CompactionManager.instance.submitIndexBuild(builder); FBUtilities.waitOnFuture(future); flushIndexesBlocking(); logger.info("Index build of {} complete", idxNames); }
java
public void maybeBuildSecondaryIndexes(Collection<SSTableReader> sstables, Set<String> idxNames) { if (idxNames.isEmpty()) return; logger.info(String.format("Submitting index build of %s for data in %s", idxNames, StringUtils.join(sstables, ", "))); SecondaryIndexBuilder builder = new SecondaryIndexBuilder(baseCfs, idxNames, new ReducingKeyIterator(sstables)); Future<?> future = CompactionManager.instance.submitIndexBuild(builder); FBUtilities.waitOnFuture(future); flushIndexesBlocking(); logger.info("Index build of {} complete", idxNames); }
[ "public", "void", "maybeBuildSecondaryIndexes", "(", "Collection", "<", "SSTableReader", ">", "sstables", ",", "Set", "<", "String", ">", "idxNames", ")", "{", "if", "(", "idxNames", ".", "isEmpty", "(", ")", ")", "return", ";", "logger", ".", "info", "(",...
Does a full, blocking rebuild of the indexes specified by columns from the sstables. Does nothing if columns is empty. Caller must acquire and release references to the sstables used here. @param sstables the data to build from @param idxNames the list of columns to index, ordered by comparator
[ "Does", "a", "full", "blocking", "rebuild", "of", "the", "indexes", "specified", "by", "columns", "from", "the", "sstables", ".", "Does", "nothing", "if", "columns", "is", "empty", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java#L157-L172
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.getAt
@SuppressWarnings("unchecked") public static List<Long> getAt(long[] array, Collection indices) { return primitiveArrayGet(array, indices); }
java
@SuppressWarnings("unchecked") public static List<Long> getAt(long[] array, Collection indices) { return primitiveArrayGet(array, indices); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "List", "<", "Long", ">", "getAt", "(", "long", "[", "]", "array", ",", "Collection", "indices", ")", "{", "return", "primitiveArrayGet", "(", "array", ",", "indices", ")", ";", "}" ]
Support the subscript operator with a collection for a long array @param array a long array @param indices a collection of indices for the items to retrieve @return list of the longs at the given indices @since 1.0
[ "Support", "the", "subscript", "operator", "with", "a", "collection", "for", "a", "long", "array" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13990-L13993
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.deleteOwnerGroup
public Response deleteOwnerGroup(String roomName, String groupName) { return restClient.delete("chatrooms/" + roomName + "/owners/group/" + groupName, new HashMap<String, String>()); }
java
public Response deleteOwnerGroup(String roomName, String groupName) { return restClient.delete("chatrooms/" + roomName + "/owners/group/" + groupName, new HashMap<String, String>()); }
[ "public", "Response", "deleteOwnerGroup", "(", "String", "roomName", ",", "String", "groupName", ")", "{", "return", "restClient", ".", "delete", "(", "\"chatrooms/\"", "+", "roomName", "+", "\"/owners/group/\"", "+", "groupName", ",", "new", "HashMap", "<", "St...
Delete owner group from chatroom. @param roomName the room name @param groupName the groupName @return the response
[ "Delete", "owner", "group", "from", "chatroom", "." ]
train
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L369-L372
dlemmermann/PreferencesFX
preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Category.java
Category.of
public static Category of(String description, Node itemIcon, Setting... settings) { return new Category(description, itemIcon, Group.of(settings)); }
java
public static Category of(String description, Node itemIcon, Setting... settings) { return new Category(description, itemIcon, Group.of(settings)); }
[ "public", "static", "Category", "of", "(", "String", "description", ",", "Node", "itemIcon", ",", "Setting", "...", "settings", ")", "{", "return", "new", "Category", "(", "description", ",", "itemIcon", ",", "Group", ".", "of", "(", "settings", ")", ")", ...
Creates a new category from settings, if the settings shouldn't be individually grouped. @param description Category name, for display in {@link CategoryView} @param itemIcon Icon to be shown next to the category name @param settings {@link Setting} to be shown in the {@link CategoryView} @return initialized Category object
[ "Creates", "a", "new", "category", "from", "settings", "if", "the", "settings", "shouldn", "t", "be", "individually", "grouped", "." ]
train
https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Category.java#L128-L130
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/visualization/JobGraphLinkPainter.java
JobGraphLinkPainter.startLink
public void startLink(final VertexContext startVertex) { if (startVertex == null) { return; } final AbstractLayout<Object, JobGraphLink> graphLayout = _graphContext.getGraphLayout(); final int x = (int) graphLayout.getX(startVertex.getVertex()); final int y = (int) graphLayout.getY(startVertex.getVertex()); logger.debug("startLink({})", startVertex); _startVertex = startVertex; _startPoint = new Point(x, y); transformEdgeShape(_startPoint, _startPoint); _graphContext.getVisualizationViewer().addPostRenderPaintable(_edgePaintable); transformArrowShape(_startPoint, _startPoint); _graphContext.getVisualizationViewer().addPostRenderPaintable(_arrowPaintable); }
java
public void startLink(final VertexContext startVertex) { if (startVertex == null) { return; } final AbstractLayout<Object, JobGraphLink> graphLayout = _graphContext.getGraphLayout(); final int x = (int) graphLayout.getX(startVertex.getVertex()); final int y = (int) graphLayout.getY(startVertex.getVertex()); logger.debug("startLink({})", startVertex); _startVertex = startVertex; _startPoint = new Point(x, y); transformEdgeShape(_startPoint, _startPoint); _graphContext.getVisualizationViewer().addPostRenderPaintable(_edgePaintable); transformArrowShape(_startPoint, _startPoint); _graphContext.getVisualizationViewer().addPostRenderPaintable(_arrowPaintable); }
[ "public", "void", "startLink", "(", "final", "VertexContext", "startVertex", ")", "{", "if", "(", "startVertex", "==", "null", ")", "{", "return", ";", "}", "final", "AbstractLayout", "<", "Object", ",", "JobGraphLink", ">", "graphLayout", "=", "_graphContext"...
Called when the drawing of a new link/edge is started @param startVertex
[ "Called", "when", "the", "drawing", "of", "a", "new", "link", "/", "edge", "is", "started" ]
train
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/visualization/JobGraphLinkPainter.java#L154-L172
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/extension/std/XOrganizationalExtension.java
XOrganizationalExtension.assignRole
public void assignRole(XEvent event, String role) { if (role != null && role.trim().length() > 0) { XAttributeLiteral attr = (XAttributeLiteral) ATTR_ROLE.clone(); attr.setValue(role.trim()); event.getAttributes().put(KEY_ROLE, attr); } }
java
public void assignRole(XEvent event, String role) { if (role != null && role.trim().length() > 0) { XAttributeLiteral attr = (XAttributeLiteral) ATTR_ROLE.clone(); attr.setValue(role.trim()); event.getAttributes().put(KEY_ROLE, attr); } }
[ "public", "void", "assignRole", "(", "XEvent", "event", ",", "String", "role", ")", "{", "if", "(", "role", "!=", "null", "&&", "role", ".", "trim", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "XAttributeLiteral", "attr", "=", "(", "XAtt...
Assigns the role attribute value for a given event. @param event Event to be modified. @param resource Role string to be assigned.
[ "Assigns", "the", "role", "attribute", "value", "for", "a", "given", "event", "." ]
train
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/extension/std/XOrganizationalExtension.java#L228-L234
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/ch/Subtypes2.java
Subtypes2.isSubtype
public boolean isSubtype(ObjectType type, ObjectType possibleSupertype) throws ClassNotFoundException { if (DEBUG_QUERIES) { System.out.println("isSubtype: check " + type + " subtype of " + possibleSupertype); } if (type.equals(possibleSupertype)) { if (DEBUG_QUERIES) { System.out.println(" ==> yes, types are same"); } return true; } ClassDescriptor typeClassDescriptor = DescriptorFactory.getClassDescriptor(type); ClassDescriptor possibleSuperclassClassDescriptor = DescriptorFactory.getClassDescriptor(possibleSupertype); return isSubtype(typeClassDescriptor, possibleSuperclassClassDescriptor); }
java
public boolean isSubtype(ObjectType type, ObjectType possibleSupertype) throws ClassNotFoundException { if (DEBUG_QUERIES) { System.out.println("isSubtype: check " + type + " subtype of " + possibleSupertype); } if (type.equals(possibleSupertype)) { if (DEBUG_QUERIES) { System.out.println(" ==> yes, types are same"); } return true; } ClassDescriptor typeClassDescriptor = DescriptorFactory.getClassDescriptor(type); ClassDescriptor possibleSuperclassClassDescriptor = DescriptorFactory.getClassDescriptor(possibleSupertype); return isSubtype(typeClassDescriptor, possibleSuperclassClassDescriptor); }
[ "public", "boolean", "isSubtype", "(", "ObjectType", "type", ",", "ObjectType", "possibleSupertype", ")", "throws", "ClassNotFoundException", "{", "if", "(", "DEBUG_QUERIES", ")", "{", "System", ".", "out", ".", "println", "(", "\"isSubtype: check \"", "+", "type"...
Determine whether or not a given ObjectType is a subtype of another. Throws ClassNotFoundException if the question cannot be answered definitively due to a missing class. @param type a ReferenceType @param possibleSupertype another Reference type @return true if <code>type</code> is a subtype of <code>possibleSupertype</code>, false if not @throws ClassNotFoundException if a missing class prevents a definitive answer
[ "Determine", "whether", "or", "not", "a", "given", "ObjectType", "is", "a", "subtype", "of", "another", ".", "Throws", "ClassNotFoundException", "if", "the", "question", "cannot", "be", "answered", "definitively", "due", "to", "a", "missing", "class", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/ch/Subtypes2.java#L508-L523
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassViewportUI.java
SeaGlassViewportUI.invokeGetter
private static Object invokeGetter(Object obj, String methodName, Object defaultValue) { try { Method method = obj.getClass().getMethod(methodName, new Class[0]); Object result = method.invoke(obj, new Object[0]); return result; } catch (NoSuchMethodException e) { return defaultValue; } catch (IllegalAccessException e) { return defaultValue; } catch (InvocationTargetException e) { return defaultValue; } }
java
private static Object invokeGetter(Object obj, String methodName, Object defaultValue) { try { Method method = obj.getClass().getMethod(methodName, new Class[0]); Object result = method.invoke(obj, new Object[0]); return result; } catch (NoSuchMethodException e) { return defaultValue; } catch (IllegalAccessException e) { return defaultValue; } catch (InvocationTargetException e) { return defaultValue; } }
[ "private", "static", "Object", "invokeGetter", "(", "Object", "obj", ",", "String", "methodName", ",", "Object", "defaultValue", ")", "{", "try", "{", "Method", "method", "=", "obj", ".", "getClass", "(", ")", ".", "getMethod", "(", "methodName", ",", "new...
Invokes the specified getter method if it exists. @param obj The object on which to invoke the method. @param methodName The name of the method. @param defaultValue This value is returned, if the method does not exist. @return The value returned by the getter method or the default value.
[ "Invokes", "the", "specified", "getter", "method", "if", "it", "exists", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassViewportUI.java#L173-L185
apache/flink
flink-connectors/flink-connector-filesystem/src/main/java/org/apache/flink/streaming/connectors/fs/bucketing/BucketingSink.java
BucketingSink.shouldRoll
private boolean shouldRoll(BucketState<T> bucketState, long currentProcessingTime) throws IOException { boolean shouldRoll = false; int subtaskIndex = getRuntimeContext().getIndexOfThisSubtask(); if (!bucketState.isWriterOpen) { shouldRoll = true; LOG.debug("BucketingSink {} starting new bucket.", subtaskIndex); } else { long writePosition = bucketState.writer.getPos(); if (writePosition > batchSize) { shouldRoll = true; LOG.debug( "BucketingSink {} starting new bucket because file position {} is above batch size {}.", subtaskIndex, writePosition, batchSize); } else { if (currentProcessingTime - bucketState.creationTime > batchRolloverInterval) { shouldRoll = true; LOG.debug( "BucketingSink {} starting new bucket because file is older than roll over interval {}.", subtaskIndex, batchRolloverInterval); } } } return shouldRoll; }
java
private boolean shouldRoll(BucketState<T> bucketState, long currentProcessingTime) throws IOException { boolean shouldRoll = false; int subtaskIndex = getRuntimeContext().getIndexOfThisSubtask(); if (!bucketState.isWriterOpen) { shouldRoll = true; LOG.debug("BucketingSink {} starting new bucket.", subtaskIndex); } else { long writePosition = bucketState.writer.getPos(); if (writePosition > batchSize) { shouldRoll = true; LOG.debug( "BucketingSink {} starting new bucket because file position {} is above batch size {}.", subtaskIndex, writePosition, batchSize); } else { if (currentProcessingTime - bucketState.creationTime > batchRolloverInterval) { shouldRoll = true; LOG.debug( "BucketingSink {} starting new bucket because file is older than roll over interval {}.", subtaskIndex, batchRolloverInterval); } } } return shouldRoll; }
[ "private", "boolean", "shouldRoll", "(", "BucketState", "<", "T", ">", "bucketState", ",", "long", "currentProcessingTime", ")", "throws", "IOException", "{", "boolean", "shouldRoll", "=", "false", ";", "int", "subtaskIndex", "=", "getRuntimeContext", "(", ")", ...
Returns {@code true} if the current {@code part-file} should be closed and a new should be created. This happens if: <ol> <li>no file is created yet for the task to write to, or</li> <li>the current file has reached the maximum bucket size.</li> <li>the current file is older than roll over interval</li> </ol>
[ "Returns", "{" ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-filesystem/src/main/java/org/apache/flink/streaming/connectors/fs/bucketing/BucketingSink.java#L474-L500
phax/ph-css
ph-css/src/main/java/com/helger/css/reader/CSSReader.java
CSSReader.readFromString
@Nullable public static CascadingStyleSheet readFromString (@Nonnull final String sCSS, @Nonnull final ECSSVersion eVersion) { return readFromStringReader (sCSS, new CSSReaderSettings ().setCSSVersion (eVersion)); }
java
@Nullable public static CascadingStyleSheet readFromString (@Nonnull final String sCSS, @Nonnull final ECSSVersion eVersion) { return readFromStringReader (sCSS, new CSSReaderSettings ().setCSSVersion (eVersion)); }
[ "@", "Nullable", "public", "static", "CascadingStyleSheet", "readFromString", "(", "@", "Nonnull", "final", "String", "sCSS", ",", "@", "Nonnull", "final", "ECSSVersion", "eVersion", ")", "{", "return", "readFromStringReader", "(", "sCSS", ",", "new", "CSSReaderSe...
Read the CSS from the passed String using a character stream. An eventually contained <code>@charset</code> rule is ignored. @param sCSS The source string containing the CSS to be parsed. May not be <code>null</code>. @param eVersion The CSS version to use. May not be <code>null</code>. @return <code>null</code> if reading failed, the CSS declarations otherwise. @since 3.7.3
[ "Read", "the", "CSS", "from", "the", "passed", "String", "using", "a", "character", "stream", ".", "An", "eventually", "contained", "<code", ">", "@charset<", "/", "code", ">", "rule", "is", "ignored", "." ]
train
https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/reader/CSSReader.java#L523-L527
rhuss/jolokia
agent/core/src/main/java/org/jolokia/converter/json/ObjectToJsonConverter.java
ObjectToJsonConverter.extractObjectWithContext
private Object extractObjectWithContext(Object pValue, Stack<String> pExtraArgs, JsonConvertOptions pOpts, boolean pJsonify) throws AttributeNotFoundException { Object jsonResult; setupContext(pOpts); try { jsonResult = extractObject(pValue, pExtraArgs, pJsonify); } catch (ValueFaultHandler.AttributeFilteredException exp) { jsonResult = null; } finally { clearContext(); } return jsonResult; }
java
private Object extractObjectWithContext(Object pValue, Stack<String> pExtraArgs, JsonConvertOptions pOpts, boolean pJsonify) throws AttributeNotFoundException { Object jsonResult; setupContext(pOpts); try { jsonResult = extractObject(pValue, pExtraArgs, pJsonify); } catch (ValueFaultHandler.AttributeFilteredException exp) { jsonResult = null; } finally { clearContext(); } return jsonResult; }
[ "private", "Object", "extractObjectWithContext", "(", "Object", "pValue", ",", "Stack", "<", "String", ">", "pExtraArgs", ",", "JsonConvertOptions", "pOpts", ",", "boolean", "pJsonify", ")", "throws", "AttributeNotFoundException", "{", "Object", "jsonResult", ";", "...
Handle a value which means to dive into the internal of a complex object (if <code>pExtraArgs</code> is not null) and/or to convert it to JSON (if <code>pJsonify</code> is true). @param pValue value to extract from @param pExtraArgs stack used for diving in to the value @param pOpts options from which various processing parameters (like maxDepth, maxCollectionSize and maxObjects) are taken and put into context in order to influence the object traversal. @param pJsonify whether the result should be returned as an JSON object @return extracted value, either natively or as JSON @throws AttributeNotFoundException if during traversal an attribute is not found as specified in the stack
[ "Handle", "a", "value", "which", "means", "to", "dive", "into", "the", "internal", "of", "a", "complex", "object", "(", "if", "<code", ">", "pExtraArgs<", "/", "code", ">", "is", "not", "null", ")", "and", "/", "or", "to", "convert", "it", "to", "JSO...
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/converter/json/ObjectToJsonConverter.java#L202-L214
xvik/guice-persist-orient
src/main/java/ru/vyarus/guice/persist/orient/db/transaction/internal/AnnotationTxConfigBuilder.java
AnnotationTxConfigBuilder.buildConfig
public static TxConfig buildConfig(final Class<?> type, final Method method, final boolean useDefaults) { final Transactional transactional = findAnnotation(type, method, Transactional.class, useDefaults); TxConfig res = null; if (transactional != null) { final TxType txType = findAnnotation(type, method, TxType.class, true); res = new TxConfig(wrapExceptions(transactional.rollbackOn()), wrapExceptions(transactional.ignore()), txType.value()); } return res; }
java
public static TxConfig buildConfig(final Class<?> type, final Method method, final boolean useDefaults) { final Transactional transactional = findAnnotation(type, method, Transactional.class, useDefaults); TxConfig res = null; if (transactional != null) { final TxType txType = findAnnotation(type, method, TxType.class, true); res = new TxConfig(wrapExceptions(transactional.rollbackOn()), wrapExceptions(transactional.ignore()), txType.value()); } return res; }
[ "public", "static", "TxConfig", "buildConfig", "(", "final", "Class", "<", "?", ">", "type", ",", "final", "Method", "method", ",", "final", "boolean", "useDefaults", ")", "{", "final", "Transactional", "transactional", "=", "findAnnotation", "(", "type", ",",...
Build transaction config for type. @param type type to analyze @param method method to analyze @param useDefaults true to build default config if annotation not found @return tx config for found annotation, null if useDefaults false and default config otherwise
[ "Build", "transaction", "config", "for", "type", "." ]
train
https://github.com/xvik/guice-persist-orient/blob/5ef06fb4f734360512e9824a3b875c4906c56b5b/src/main/java/ru/vyarus/guice/persist/orient/db/transaction/internal/AnnotationTxConfigBuilder.java#L33-L42
kuali/ojb-1.0.4
src/tools/org/apache/ojb/tools/mapping/reversedb2/propertyEditors/EditableTreeNodeWithProperties.java
EditableTreeNodeWithProperties.setAttribute
public void setAttribute(String strKey, Object value) { this.propertyChangeDelegate.firePropertyChange(strKey, hmAttributes.put(strKey, value), value); }
java
public void setAttribute(String strKey, Object value) { this.propertyChangeDelegate.firePropertyChange(strKey, hmAttributes.put(strKey, value), value); }
[ "public", "void", "setAttribute", "(", "String", "strKey", ",", "Object", "value", ")", "{", "this", ".", "propertyChangeDelegate", ".", "firePropertyChange", "(", "strKey", ",", "hmAttributes", ".", "put", "(", "strKey", ",", "value", ")", ",", "value", ")"...
Set an attribute of this node as Object. This method is backed by a HashMap, so all rules of HashMap apply to this method. Fires a PropertyChangeEvent.
[ "Set", "an", "attribute", "of", "this", "node", "as", "Object", ".", "This", "method", "is", "backed", "by", "a", "HashMap", "so", "all", "rules", "of", "HashMap", "apply", "to", "this", "method", ".", "Fires", "a", "PropertyChangeEvent", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/tools/org/apache/ojb/tools/mapping/reversedb2/propertyEditors/EditableTreeNodeWithProperties.java#L103-L107
pwheel/spring-security-oauth2-client
src/main/java/com/racquettrack/security/oauth/OAuth2AuthenticationFilter.java
OAuth2AuthenticationFilter.checkStateParameter
protected void checkStateParameter(HttpSession session, Map<String, String[]> parameters) throws AuthenticationException { String originalState = (String)session.getAttribute(oAuth2ServiceProperties.getStateParamName()); String receivedStates[] = parameters.get(oAuth2ServiceProperties.getStateParamName()); // There should only be one entry in the array, if there are more they will be ignored. if (receivedStates == null || receivedStates.length == 0 || !receivedStates[0].equals(originalState)) { String errorMsg = String.format("Received states %s was not equal to original state %s", receivedStates, originalState); LOG.error(errorMsg); throw new AuthenticationServiceException(errorMsg); } }
java
protected void checkStateParameter(HttpSession session, Map<String, String[]> parameters) throws AuthenticationException { String originalState = (String)session.getAttribute(oAuth2ServiceProperties.getStateParamName()); String receivedStates[] = parameters.get(oAuth2ServiceProperties.getStateParamName()); // There should only be one entry in the array, if there are more they will be ignored. if (receivedStates == null || receivedStates.length == 0 || !receivedStates[0].equals(originalState)) { String errorMsg = String.format("Received states %s was not equal to original state %s", receivedStates, originalState); LOG.error(errorMsg); throw new AuthenticationServiceException(errorMsg); } }
[ "protected", "void", "checkStateParameter", "(", "HttpSession", "session", ",", "Map", "<", "String", ",", "String", "[", "]", ">", "parameters", ")", "throws", "AuthenticationException", "{", "String", "originalState", "=", "(", "String", ")", "session", ".", ...
Check the state parameter to ensure it is the same as was originally sent. Subclasses can override this behaviour if they so choose, but it is not recommended. @param session The http session, which will contain the original scope as an attribute. @param parameters The parameters received from the OAuth 2 Provider, which should contain the same state as originally sent to it and stored in the http session. @throws AuthenticationException If the state differs from the original.
[ "Check", "the", "state", "parameter", "to", "ensure", "it", "is", "the", "same", "as", "was", "originally", "sent", ".", "Subclasses", "can", "override", "this", "behaviour", "if", "they", "so", "choose", "but", "it", "is", "not", "recommended", "." ]
train
https://github.com/pwheel/spring-security-oauth2-client/blob/c0258823493e268495c9752c5d752f74c6809c6b/src/main/java/com/racquettrack/security/oauth/OAuth2AuthenticationFilter.java#L107-L121
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/hover/SARLHoverSignatureProvider.java
SARLHoverSignatureProvider.getTypeName
protected String getTypeName(JvmType type) { if (type != null) { if (type instanceof JvmDeclaredType) { final ITypeReferenceOwner owner = new StandardTypeReferenceOwner(this.services, type); return owner.toLightweightTypeReference(type).getHumanReadableName(); } return type.getSimpleName(); } return Messages.SARLHoverSignatureProvider_1; }
java
protected String getTypeName(JvmType type) { if (type != null) { if (type instanceof JvmDeclaredType) { final ITypeReferenceOwner owner = new StandardTypeReferenceOwner(this.services, type); return owner.toLightweightTypeReference(type).getHumanReadableName(); } return type.getSimpleName(); } return Messages.SARLHoverSignatureProvider_1; }
[ "protected", "String", "getTypeName", "(", "JvmType", "type", ")", "{", "if", "(", "type", "!=", "null", ")", "{", "if", "(", "type", "instanceof", "JvmDeclaredType", ")", "{", "final", "ITypeReferenceOwner", "owner", "=", "new", "StandardTypeReferenceOwner", ...
Replies the type name for the given type. @param type the type. @return the string representation of the given type.
[ "Replies", "the", "type", "name", "for", "the", "given", "type", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/hover/SARLHoverSignatureProvider.java#L273-L282
infinispan/infinispan
core/src/main/java/org/infinispan/atomic/AtomicMapLookup.java
AtomicMapLookup.getAtomicMap
public static <MK, K, V> AtomicMap<K, V> getAtomicMap(Cache<MK, ?> cache, MK key) { return getAtomicMap(cache, key, true); }
java
public static <MK, K, V> AtomicMap<K, V> getAtomicMap(Cache<MK, ?> cache, MK key) { return getAtomicMap(cache, key, true); }
[ "public", "static", "<", "MK", ",", "K", ",", "V", ">", "AtomicMap", "<", "K", ",", "V", ">", "getAtomicMap", "(", "Cache", "<", "MK", ",", "?", ">", "cache", ",", "MK", "key", ")", "{", "return", "getAtomicMap", "(", "cache", ",", "key", ",", ...
Retrieves an atomic map from a given cache, stored under a given key. If an atomic map did not exist, one is created and registered in an atomic fashion. @param cache underlying cache @param key key under which the atomic map exists @param <MK> key param of the cache @param <K> key param of the AtomicMap @param <V> value param of the AtomicMap @return an AtomicMap
[ "Retrieves", "an", "atomic", "map", "from", "a", "given", "cache", "stored", "under", "a", "given", "key", ".", "If", "an", "atomic", "map", "did", "not", "exist", "one", "is", "created", "and", "registered", "in", "an", "atomic", "fashion", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/atomic/AtomicMapLookup.java#L33-L35
b3log/latke
latke-core/src/main/java/org/json/JSONArray.java
JSONArray.getEnum
public <E extends Enum<E>> E getEnum(Class<E> clazz, int index) throws JSONException { E val = optEnum(clazz, index); if(val==null) { // JSONException should really take a throwable argument. // If it did, I would re-implement this with the Enum.valueOf // method and place any thrown exception in the JSONException throw new JSONException("JSONArray[" + index + "] is not an enum of type " + JSONObject.quote(clazz.getSimpleName()) + "."); } return val; }
java
public <E extends Enum<E>> E getEnum(Class<E> clazz, int index) throws JSONException { E val = optEnum(clazz, index); if(val==null) { // JSONException should really take a throwable argument. // If it did, I would re-implement this with the Enum.valueOf // method and place any thrown exception in the JSONException throw new JSONException("JSONArray[" + index + "] is not an enum of type " + JSONObject.quote(clazz.getSimpleName()) + "."); } return val; }
[ "public", "<", "E", "extends", "Enum", "<", "E", ">", ">", "E", "getEnum", "(", "Class", "<", "E", ">", "clazz", ",", "int", "index", ")", "throws", "JSONException", "{", "E", "val", "=", "optEnum", "(", "clazz", ",", "index", ")", ";", "if", "("...
Get the enum value associated with an index. @param <E> Enum Type @param clazz The type of enum to retrieve. @param index The index must be between 0 and length() - 1. @return The enum value at the index location @throws JSONException if the key is not found or if the value cannot be converted to an enum.
[ "Get", "the", "enum", "value", "associated", "with", "an", "index", "." ]
train
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONArray.java#L319-L329
fabric8io/fabric8-forge
fabric8-forge-core/src/main/java/io/fabric8/forge/rest/dto/ExecutionRequest.java
ExecutionRequest.createCommitMessage
public static String createCommitMessage(String name, ExecutionRequest executionRequest) { StringBuilder builder = new StringBuilder(name); List<Map<String, Object>> inputList = executionRequest.getInputList(); for (Map<String, Object> map : inputList) { Set<Map.Entry<String, Object>> entries = map.entrySet(); for (Map.Entry<String, Object> entry : entries) { String key = entry.getKey(); String textValue = null; Object value = entry.getValue(); if (value != null) { textValue = value.toString(); } if (!Strings.isNullOrEmpty(textValue) && !textValue.equals("0") && !textValue.toLowerCase().equals("false")) { builder.append(" --"); builder.append(key); builder.append("="); builder.append(textValue); } } } return builder.toString(); }
java
public static String createCommitMessage(String name, ExecutionRequest executionRequest) { StringBuilder builder = new StringBuilder(name); List<Map<String, Object>> inputList = executionRequest.getInputList(); for (Map<String, Object> map : inputList) { Set<Map.Entry<String, Object>> entries = map.entrySet(); for (Map.Entry<String, Object> entry : entries) { String key = entry.getKey(); String textValue = null; Object value = entry.getValue(); if (value != null) { textValue = value.toString(); } if (!Strings.isNullOrEmpty(textValue) && !textValue.equals("0") && !textValue.toLowerCase().equals("false")) { builder.append(" --"); builder.append(key); builder.append("="); builder.append(textValue); } } } return builder.toString(); }
[ "public", "static", "String", "createCommitMessage", "(", "String", "name", ",", "ExecutionRequest", "executionRequest", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", "name", ")", ";", "List", "<", "Map", "<", "String", ",", "Object", ...
Lets generate a commit message with the command name and all the parameters we specify
[ "Lets", "generate", "a", "commit", "message", "with", "the", "command", "name", "and", "all", "the", "parameters", "we", "specify" ]
train
https://github.com/fabric8io/fabric8-forge/blob/a59871bae4d5c5d3ece10f1e8758e73663087f19/fabric8-forge-core/src/main/java/io/fabric8/forge/rest/dto/ExecutionRequest.java#L52-L73
adamfisk/littleshoot-util
src/main/java/org/littleshoot/util/ITunesUtils.java
ITunesUtils.addAudioFile
public static boolean addAudioFile(final File file) throws IOException { if (!SystemUtils.IS_OS_MAC_OSX) { LOG.debug("Not on OSX, not adding to iTunes"); return false; } if (!isSupported(file)) { LOG.debug("iTunes does not support this file type: {}", file); return false; } //final Runnable runner = new ExecOsaScript(file.getCanonicalFile()); //final Thread thread = new DaemonThread(runner, "iTunes-Adding-Thread"); //thread.start(); Runtime.getRuntime().exec(createOSAScriptCommand(file)); return true; }
java
public static boolean addAudioFile(final File file) throws IOException { if (!SystemUtils.IS_OS_MAC_OSX) { LOG.debug("Not on OSX, not adding to iTunes"); return false; } if (!isSupported(file)) { LOG.debug("iTunes does not support this file type: {}", file); return false; } //final Runnable runner = new ExecOsaScript(file.getCanonicalFile()); //final Thread thread = new DaemonThread(runner, "iTunes-Adding-Thread"); //thread.start(); Runtime.getRuntime().exec(createOSAScriptCommand(file)); return true; }
[ "public", "static", "boolean", "addAudioFile", "(", "final", "File", "file", ")", "throws", "IOException", "{", "if", "(", "!", "SystemUtils", ".", "IS_OS_MAC_OSX", ")", "{", "LOG", ".", "debug", "(", "\"Not on OSX, not adding to iTunes\"", ")", ";", "return", ...
Adds the specified audio file to iTunes if we're on OSX. @param file The file to add. @return <code>true</code> if the audio file was added to iTunes, otherwise <code>false</code>. @throws IOException If there's an error getting the canonical file name.
[ "Adds", "the", "specified", "audio", "file", "to", "iTunes", "if", "we", "re", "on", "OSX", "." ]
train
https://github.com/adamfisk/littleshoot-util/blob/3c0dc4955116b3382d6b0575d2f164b7508a4f73/src/main/java/org/littleshoot/util/ITunesUtils.java#L32-L52
negusoft/holoaccent
HoloAccent/src/com/negusoft/holoaccent/AccentHelper.java
AccentHelper.prepareDialog
public void prepareDialog(Context c, Window window) { if (mDividerPainter == null) mDividerPainter = initPainter(c, mOverrideColor); mDividerPainter.paint(window); }
java
public void prepareDialog(Context c, Window window) { if (mDividerPainter == null) mDividerPainter = initPainter(c, mOverrideColor); mDividerPainter.paint(window); }
[ "public", "void", "prepareDialog", "(", "Context", "c", ",", "Window", "window", ")", "{", "if", "(", "mDividerPainter", "==", "null", ")", "mDividerPainter", "=", "initPainter", "(", "c", ",", "mOverrideColor", ")", ";", "mDividerPainter", ".", "paint", "("...
Paint the dialog's divider if required to correctly customize it.
[ "Paint", "the", "dialog", "s", "divider", "if", "required", "to", "correctly", "customize", "it", "." ]
train
https://github.com/negusoft/holoaccent/blob/7121a02dde94834e770cb81174d0bdc596323324/HoloAccent/src/com/negusoft/holoaccent/AccentHelper.java#L142-L146
mongodb/stitch-android-sdk
core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/sync/internal/DataSynchronizer.java
DataSynchronizer.resolveConflict
@CheckReturnValue private LocalSyncWriteModelContainer resolveConflict( final NamespaceSynchronizationConfig nsConfig, final CoreDocumentSynchronizationConfig docConfig, final ChangeEvent<BsonDocument> remoteEvent ) { return resolveConflict(nsConfig, docConfig, docConfig.getLastUncommittedChangeEvent(), remoteEvent); }
java
@CheckReturnValue private LocalSyncWriteModelContainer resolveConflict( final NamespaceSynchronizationConfig nsConfig, final CoreDocumentSynchronizationConfig docConfig, final ChangeEvent<BsonDocument> remoteEvent ) { return resolveConflict(nsConfig, docConfig, docConfig.getLastUncommittedChangeEvent(), remoteEvent); }
[ "@", "CheckReturnValue", "private", "LocalSyncWriteModelContainer", "resolveConflict", "(", "final", "NamespaceSynchronizationConfig", "nsConfig", ",", "final", "CoreDocumentSynchronizationConfig", "docConfig", ",", "final", "ChangeEvent", "<", "BsonDocument", ">", "remoteEvent...
Resolves a conflict between a synchronized document's local and remote state. The resolution will result in either the document being desynchronized or being replaced with some resolved state based on the conflict resolver specified for the document. Uses the last uncommitted local event as the local state. @param nsConfig the namespace synchronization config of the namespace where the document lives. @param docConfig the configuration of the document that describes the resolver and current state. @param remoteEvent the remote change event that is conflicting.
[ "Resolves", "a", "conflict", "between", "a", "synchronized", "document", "s", "local", "and", "remote", "state", ".", "The", "resolution", "will", "result", "in", "either", "the", "document", "being", "desynchronized", "or", "being", "replaced", "with", "some", ...
train
https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/sync/internal/DataSynchronizer.java#L1681-L1689
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/ProjectApi.java
ProjectApi.updatePushRules
public PushRules updatePushRules(Object projectIdOrPath, PushRules pushRule) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() .withParam("deny_delete_tag", pushRule.getDenyDeleteTag()) .withParam("member_check", pushRule.getMemberCheck()) .withParam("prevent_secrets", pushRule.getPreventSecrets()) .withParam("commit_message_regex", pushRule.getCommitMessageRegex()) .withParam("branch_name_regex", pushRule.getBranchNameRegex()) .withParam("author_email_regex", pushRule.getAuthorEmailRegex()) .withParam("file_name_regex", pushRule.getFileNameRegex()) .withParam("max_file_size", pushRule.getMaxFileSize()); final Response response = putWithFormData(Response.Status.OK, formData, "projects", getProjectIdOrPath(projectIdOrPath), "push_rule"); return (response.readEntity(PushRules.class)); }
java
public PushRules updatePushRules(Object projectIdOrPath, PushRules pushRule) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() .withParam("deny_delete_tag", pushRule.getDenyDeleteTag()) .withParam("member_check", pushRule.getMemberCheck()) .withParam("prevent_secrets", pushRule.getPreventSecrets()) .withParam("commit_message_regex", pushRule.getCommitMessageRegex()) .withParam("branch_name_regex", pushRule.getBranchNameRegex()) .withParam("author_email_regex", pushRule.getAuthorEmailRegex()) .withParam("file_name_regex", pushRule.getFileNameRegex()) .withParam("max_file_size", pushRule.getMaxFileSize()); final Response response = putWithFormData(Response.Status.OK, formData, "projects", getProjectIdOrPath(projectIdOrPath), "push_rule"); return (response.readEntity(PushRules.class)); }
[ "public", "PushRules", "updatePushRules", "(", "Object", "projectIdOrPath", ",", "PushRules", "pushRule", ")", "throws", "GitLabApiException", "{", "GitLabApiForm", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(", "\"deny_delete_tag\"", ",", ...
Updates a push rule for the specified project. <pre><code>PUT /projects/:id/push_rule/:push_rule_id</code></pre> The following properties on the PushRules instance are utilized when updating the push rule: <code> denyDeleteTag (optional) - Deny deleting a tag memberCheck (optional) - Restrict commits by author (email) to existing GitLab users preventSecrets (optional) - GitLab will reject any files that are likely to contain secrets commitMessageRegex (optional) - All commit messages must match this, e.g. Fixed \d+\..* branchNameRegex (optional) - All branch names must match this, e.g. `(feature authorEmailRegex (optional) - All commit author emails must match this, e.g. @my-company.com$ fileNameRegex (optional) - All committed filenames must not match this, e.g. `(jar maxFileSize (optional) - Maximum file size (MB </code> @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required @param pushRule the PushRules instance containing the push rule configuration to update @return a PushRules instance with the newly created push rule info @throws GitLabApiException if any exception occurs
[ "Updates", "a", "push", "rule", "for", "the", "specified", "project", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ProjectApi.java#L2240-L2253
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/journal/entry/CreatorJournalEntry.java
CreatorJournalEntry.invokeMethod
public Object invokeMethod(ManagementDelegate delegate, JournalWriter writer) throws ServerException, JournalException { synchronized (JournalWriter.SYNCHRONIZER) { JournalOperatingMode.enforceCurrentMode(); writer.prepareToWriteJournalEntry(); Object result = super.getMethod().invoke(delegate); writer.writeJournalEntry(this); return result; } }
java
public Object invokeMethod(ManagementDelegate delegate, JournalWriter writer) throws ServerException, JournalException { synchronized (JournalWriter.SYNCHRONIZER) { JournalOperatingMode.enforceCurrentMode(); writer.prepareToWriteJournalEntry(); Object result = super.getMethod().invoke(delegate); writer.writeJournalEntry(this); return result; } }
[ "public", "Object", "invokeMethod", "(", "ManagementDelegate", "delegate", ",", "JournalWriter", "writer", ")", "throws", "ServerException", ",", "JournalException", "{", "synchronized", "(", "JournalWriter", ".", "SYNCHRONIZER", ")", "{", "JournalOperatingMode", ".", ...
Process the management method: <ul> <li>Check the operating mode - if we are in {@link JournalOperatingMode#READ_ONLY Read-Only} mode, this check will throw an exception.</li> <li>Prepare the writer in case we need to initialize a new file with a repository hash.</li> <li>Invoke the method on the ManagementDelegate.</li> <li>Write the full journal entry, including any context changes from the Management method.</li> </ul> These operations occur within a synchronized block. We must be sure that any pending operations are complete before we get the repository hash, so we are confident that the hash accurately reflects the state of the repository. Since all API-M operations go through this synchronized block, we can be confident that the previous one had completed before the current one started. <p> There might be a way to enforce the synchronization at a lower level, thus increasing throughput, but we haven't explored it yet.
[ "Process", "the", "management", "method", ":", "<ul", ">", "<li", ">", "Check", "the", "operating", "mode", "-", "if", "we", "are", "in", "{" ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/entry/CreatorJournalEntry.java#L55-L64
revinate/assertj-json
src/main/java/com/revinate/assertj/json/JsonPathAssert.java
JsonPathAssert.jsonPathAsListOf
public <T> AbstractListAssert<?, ? extends List<? extends T>, T, ? extends AbstractAssert<?, T>> jsonPathAsListOf(String path, Class<T> type) { return Assertions.assertThat(actual.read(path, new TypeRef<List<T>>() { })); }
java
public <T> AbstractListAssert<?, ? extends List<? extends T>, T, ? extends AbstractAssert<?, T>> jsonPathAsListOf(String path, Class<T> type) { return Assertions.assertThat(actual.read(path, new TypeRef<List<T>>() { })); }
[ "public", "<", "T", ">", "AbstractListAssert", "<", "?", ",", "?", "extends", "List", "<", "?", "extends", "T", ">", ",", "T", ",", "?", "extends", "AbstractAssert", "<", "?", ",", "T", ">", ">", "jsonPathAsListOf", "(", "String", "path", ",", "Class...
Extracts a JSON array using a JsonPath expression and wrap it in a {@link ListAssert}. This method requires the JsonPath to be <a href="https://github.com/jayway/JsonPath#jsonprovider-spi">configured with Jackson or Gson</a>. @param path JsonPath to extract the array @param type The type to cast the content of the array, i.e.: {@link String}, {@link Integer} @param <T> The generic type of the type field @return an instance of {@link ListAssert}
[ "Extracts", "a", "JSON", "array", "using", "a", "JsonPath", "expression", "and", "wrap", "it", "in", "a", "{", "@link", "ListAssert", "}", ".", "This", "method", "requires", "the", "JsonPath", "to", "be", "<a", "href", "=", "https", ":", "//", "github", ...
train
https://github.com/revinate/assertj-json/blob/84c36ef2ae46e317bf5b2c9d553ca2174301cdd3/src/main/java/com/revinate/assertj/json/JsonPathAssert.java#L55-L58
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java
WordVectorSerializer.writeWordVectors
@Deprecated public static void writeWordVectors(ParagraphVectors vectors, OutputStream stream) { try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(stream, StandardCharsets.UTF_8))) { /* This method acts similary to w2v csv serialization, except of additional tag for labels */ VocabCache<VocabWord> vocabCache = vectors.getVocab(); for (VocabWord word : vocabCache.vocabWords()) { StringBuilder builder = new StringBuilder(); builder.append(word.isLabel() ? "L" : "E").append(" "); builder.append(word.getLabel().replaceAll(" ", WHITESPACE_REPLACEMENT)).append(" "); INDArray vector = vectors.getWordVectorMatrix(word.getLabel()); for (int j = 0; j < vector.length(); j++) { builder.append(vector.getDouble(j)); if (j < vector.length() - 1) { builder.append(" "); } } writer.write(builder.append("\n").toString()); } } catch (Exception e) { throw new RuntimeException(e); } }
java
@Deprecated public static void writeWordVectors(ParagraphVectors vectors, OutputStream stream) { try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(stream, StandardCharsets.UTF_8))) { /* This method acts similary to w2v csv serialization, except of additional tag for labels */ VocabCache<VocabWord> vocabCache = vectors.getVocab(); for (VocabWord word : vocabCache.vocabWords()) { StringBuilder builder = new StringBuilder(); builder.append(word.isLabel() ? "L" : "E").append(" "); builder.append(word.getLabel().replaceAll(" ", WHITESPACE_REPLACEMENT)).append(" "); INDArray vector = vectors.getWordVectorMatrix(word.getLabel()); for (int j = 0; j < vector.length(); j++) { builder.append(vector.getDouble(j)); if (j < vector.length() - 1) { builder.append(" "); } } writer.write(builder.append("\n").toString()); } } catch (Exception e) { throw new RuntimeException(e); } }
[ "@", "Deprecated", "public", "static", "void", "writeWordVectors", "(", "ParagraphVectors", "vectors", ",", "OutputStream", "stream", ")", "{", "try", "(", "BufferedWriter", "writer", "=", "new", "BufferedWriter", "(", "new", "OutputStreamWriter", "(", "stream", "...
This method saves paragraph vectors to the given output stream. @param vectors @param stream
[ "This", "method", "saves", "paragraph", "vectors", "to", "the", "given", "output", "stream", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java#L1155-L1182
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ProcessGroovyMethods.java
ProcessGroovyMethods.pipeTo
public static Process pipeTo(final Process left, final Process right) throws IOException { new Thread(new Runnable() { public void run() { InputStream in = new BufferedInputStream(getIn(left)); OutputStream out = new BufferedOutputStream(getOut(right)); byte[] buf = new byte[8192]; int next; try { while ((next = in.read(buf)) != -1) { out.write(buf, 0, next); } } catch (IOException e) { throw new GroovyRuntimeException("exception while reading process stream", e); } finally { closeWithWarning(out); closeWithWarning(in); } } }).start(); return right; }
java
public static Process pipeTo(final Process left, final Process right) throws IOException { new Thread(new Runnable() { public void run() { InputStream in = new BufferedInputStream(getIn(left)); OutputStream out = new BufferedOutputStream(getOut(right)); byte[] buf = new byte[8192]; int next; try { while ((next = in.read(buf)) != -1) { out.write(buf, 0, next); } } catch (IOException e) { throw new GroovyRuntimeException("exception while reading process stream", e); } finally { closeWithWarning(out); closeWithWarning(in); } } }).start(); return right; }
[ "public", "static", "Process", "pipeTo", "(", "final", "Process", "left", ",", "final", "Process", "right", ")", "throws", "IOException", "{", "new", "Thread", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "InputStream", ...
Allows one Process to asynchronously pipe data to another Process. @param left a Process instance @param right a Process to pipe output to @return the second Process to allow chaining @throws java.io.IOException if an IOException occurs. @since 1.5.2
[ "Allows", "one", "Process", "to", "asynchronously", "pipe", "data", "to", "another", "Process", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ProcessGroovyMethods.java#L393-L413
census-instrumentation/opencensus-java
contrib/http_util/src/main/java/io/opencensus/contrib/http/HttpServerHandler.java
HttpServerHandler.handleStart
public HttpRequestContext handleStart(C carrier, Q request) { checkNotNull(carrier, "carrier"); checkNotNull(request, "request"); SpanBuilder spanBuilder = null; String spanName = getSpanName(request, extractor); // de-serialize the context SpanContext spanContext = null; try { spanContext = textFormat.extract(carrier, getter); } catch (SpanContextParseException e) { // TODO: Currently we cannot distinguish between context parse error and missing context. // Logging would be annoying so we just ignore this error and do not even log a message. } if (spanContext == null || publicEndpoint) { spanBuilder = tracer.spanBuilder(spanName); } else { spanBuilder = tracer.spanBuilderWithRemoteParent(spanName, spanContext); } Span span = spanBuilder.setSpanKind(Kind.SERVER).startSpan(); if (publicEndpoint && spanContext != null) { span.addLink(Link.fromSpanContext(spanContext, Type.PARENT_LINKED_SPAN)); } if (span.getOptions().contains(Options.RECORD_EVENTS)) { addSpanRequestAttributes(span, request, extractor); } return getNewContext(span, tagger.getCurrentTagContext()); }
java
public HttpRequestContext handleStart(C carrier, Q request) { checkNotNull(carrier, "carrier"); checkNotNull(request, "request"); SpanBuilder spanBuilder = null; String spanName = getSpanName(request, extractor); // de-serialize the context SpanContext spanContext = null; try { spanContext = textFormat.extract(carrier, getter); } catch (SpanContextParseException e) { // TODO: Currently we cannot distinguish between context parse error and missing context. // Logging would be annoying so we just ignore this error and do not even log a message. } if (spanContext == null || publicEndpoint) { spanBuilder = tracer.spanBuilder(spanName); } else { spanBuilder = tracer.spanBuilderWithRemoteParent(spanName, spanContext); } Span span = spanBuilder.setSpanKind(Kind.SERVER).startSpan(); if (publicEndpoint && spanContext != null) { span.addLink(Link.fromSpanContext(spanContext, Type.PARENT_LINKED_SPAN)); } if (span.getOptions().contains(Options.RECORD_EVENTS)) { addSpanRequestAttributes(span, request, extractor); } return getNewContext(span, tagger.getCurrentTagContext()); }
[ "public", "HttpRequestContext", "handleStart", "(", "C", "carrier", ",", "Q", "request", ")", "{", "checkNotNull", "(", "carrier", ",", "\"carrier\"", ")", ";", "checkNotNull", "(", "request", ",", "\"request\"", ")", ";", "SpanBuilder", "spanBuilder", "=", "n...
Instrument an incoming request before it is handled. <p>This method will create a span under the deserialized propagated parent context. If the parent context is not present, the span will be created under the current context. <p>The generated span will NOT be set as current context. User can control when to enter the scope of this span. Use {@link AbstractHttpHandler#getSpanFromContext} to retrieve the span. @param carrier the entity that holds the HTTP information. @param request the request entity. @return the {@link HttpRequestContext} that contains stats and trace data associated with the request. @since 0.19
[ "Instrument", "an", "incoming", "request", "before", "it", "is", "handled", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/contrib/http_util/src/main/java/io/opencensus/contrib/http/HttpServerHandler.java#L118-L147
apptik/jus
android/jus-android/src/main/java/io/apptik/comm/jus/ui/ImageLoader.java
ImageLoader.getCacheKey
private static String getCacheKey(String url, int maxWidth, int maxHeight, ScaleType scaleType) { return "#W" + maxWidth + "#H" + maxHeight + "#S" + scaleType.ordinal() + url; }
java
private static String getCacheKey(String url, int maxWidth, int maxHeight, ScaleType scaleType) { return "#W" + maxWidth + "#H" + maxHeight + "#S" + scaleType.ordinal() + url; }
[ "private", "static", "String", "getCacheKey", "(", "String", "url", ",", "int", "maxWidth", ",", "int", "maxHeight", ",", "ScaleType", "scaleType", ")", "{", "return", "\"#W\"", "+", "maxWidth", "+", "\"#H\"", "+", "maxHeight", "+", "\"#S\"", "+", "scaleType...
Creates a cache key for use with the L1 cache. @param url The URL of the request. @param maxWidth The max-width of the output. @param maxHeight The max-height of the output. @param scaleType The scaleType of the imageView.
[ "Creates", "a", "cache", "key", "for", "use", "with", "the", "L1", "cache", "." ]
train
https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/android/jus-android/src/main/java/io/apptik/comm/jus/ui/ImageLoader.java#L567-L569
apereo/cas
core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/resolver/impl/ServiceTicketRequestWebflowEventResolver.java
ServiceTicketRequestWebflowEventResolver.grantServiceTicket
protected Event grantServiceTicket(final RequestContext context) { val ticketGrantingTicketId = WebUtils.getTicketGrantingTicketId(context); val credential = getCredentialFromContext(context); try { val service = WebUtils.getService(context); val authn = getWebflowEventResolutionConfigurationContext().getTicketRegistrySupport().getAuthenticationFrom(ticketGrantingTicketId); val registeredService = getWebflowEventResolutionConfigurationContext().getServicesManager().findServiceBy(service); if (authn != null && registeredService != null) { LOGGER.debug("Enforcing access strategy policies for registered service [{}] and principal [{}]", registeredService, authn.getPrincipal()); val audit = AuditableContext.builder().service(service) .authentication(authn) .registeredService(registeredService) .retrievePrincipalAttributesFromReleasePolicy(Boolean.TRUE) .build(); val accessResult = getWebflowEventResolutionConfigurationContext().getRegisteredServiceAccessStrategyEnforcer().execute(audit); accessResult.throwExceptionIfNeeded(); } val authenticationResult = getWebflowEventResolutionConfigurationContext().getAuthenticationSystemSupport() .handleAndFinalizeSingleAuthenticationTransaction(service, credential); val serviceTicketId = getWebflowEventResolutionConfigurationContext().getCentralAuthenticationService() .grantServiceTicket(ticketGrantingTicketId, service, authenticationResult); WebUtils.putServiceTicketInRequestScope(context, serviceTicketId); WebUtils.putWarnCookieIfRequestParameterPresent(getWebflowEventResolutionConfigurationContext().getWarnCookieGenerator(), context); return newEvent(CasWebflowConstants.TRANSITION_ID_WARN); } catch (final AuthenticationException | AbstractTicketException e) { return newEvent(CasWebflowConstants.TRANSITION_ID_AUTHENTICATION_FAILURE, e); } }
java
protected Event grantServiceTicket(final RequestContext context) { val ticketGrantingTicketId = WebUtils.getTicketGrantingTicketId(context); val credential = getCredentialFromContext(context); try { val service = WebUtils.getService(context); val authn = getWebflowEventResolutionConfigurationContext().getTicketRegistrySupport().getAuthenticationFrom(ticketGrantingTicketId); val registeredService = getWebflowEventResolutionConfigurationContext().getServicesManager().findServiceBy(service); if (authn != null && registeredService != null) { LOGGER.debug("Enforcing access strategy policies for registered service [{}] and principal [{}]", registeredService, authn.getPrincipal()); val audit = AuditableContext.builder().service(service) .authentication(authn) .registeredService(registeredService) .retrievePrincipalAttributesFromReleasePolicy(Boolean.TRUE) .build(); val accessResult = getWebflowEventResolutionConfigurationContext().getRegisteredServiceAccessStrategyEnforcer().execute(audit); accessResult.throwExceptionIfNeeded(); } val authenticationResult = getWebflowEventResolutionConfigurationContext().getAuthenticationSystemSupport() .handleAndFinalizeSingleAuthenticationTransaction(service, credential); val serviceTicketId = getWebflowEventResolutionConfigurationContext().getCentralAuthenticationService() .grantServiceTicket(ticketGrantingTicketId, service, authenticationResult); WebUtils.putServiceTicketInRequestScope(context, serviceTicketId); WebUtils.putWarnCookieIfRequestParameterPresent(getWebflowEventResolutionConfigurationContext().getWarnCookieGenerator(), context); return newEvent(CasWebflowConstants.TRANSITION_ID_WARN); } catch (final AuthenticationException | AbstractTicketException e) { return newEvent(CasWebflowConstants.TRANSITION_ID_AUTHENTICATION_FAILURE, e); } }
[ "protected", "Event", "grantServiceTicket", "(", "final", "RequestContext", "context", ")", "{", "val", "ticketGrantingTicketId", "=", "WebUtils", ".", "getTicketGrantingTicketId", "(", "context", ")", ";", "val", "credential", "=", "getCredentialFromContext", "(", "c...
Grant service ticket for the given credential based on the service and tgt that are found in the request context. @param context the context @return the resulting event. Warning, authentication failure or error. @since 4.1.0
[ "Grant", "service", "ticket", "for", "the", "given", "credential", "based", "on", "the", "service", "and", "tgt", "that", "are", "found", "in", "the", "request", "context", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/resolver/impl/ServiceTicketRequestWebflowEventResolver.java#L89-L122
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/validator/generalvalidator/GeneralValidator.java
GeneralValidator.addResultCollector
public void addResultCollector(ResultCollector<?, DPO> resultCollector) { if (resultCollector != null) { addTrigger(resultCollector); addDataProvider(resultCollector); } }
java
public void addResultCollector(ResultCollector<?, DPO> resultCollector) { if (resultCollector != null) { addTrigger(resultCollector); addDataProvider(resultCollector); } }
[ "public", "void", "addResultCollector", "(", "ResultCollector", "<", "?", ",", "DPO", ">", "resultCollector", ")", "{", "if", "(", "resultCollector", "!=", "null", ")", "{", "addTrigger", "(", "resultCollector", ")", ";", "addDataProvider", "(", "resultCollector...
Adds the specified result collector to the triggers and data providers. @param resultCollector Result collector to be added.
[ "Adds", "the", "specified", "result", "collector", "to", "the", "triggers", "and", "data", "providers", "." ]
train
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/validator/generalvalidator/GeneralValidator.java#L165-L170
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java
Expressions.dateTemplate
public static <T extends Comparable<?>> DateTemplate<T> dateTemplate(Class<? extends T> cl, String template, Object... args) { return dateTemplate(cl, createTemplate(template), ImmutableList.copyOf(args)); }
java
public static <T extends Comparable<?>> DateTemplate<T> dateTemplate(Class<? extends T> cl, String template, Object... args) { return dateTemplate(cl, createTemplate(template), ImmutableList.copyOf(args)); }
[ "public", "static", "<", "T", "extends", "Comparable", "<", "?", ">", ">", "DateTemplate", "<", "T", ">", "dateTemplate", "(", "Class", "<", "?", "extends", "T", ">", "cl", ",", "String", "template", ",", "Object", "...", "args", ")", "{", "return", ...
Create a new Template expression @param cl type of expression @param template template @param args template parameters @return template expression
[ "Create", "a", "new", "Template", "expression" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L480-L483
apache/groovy
subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java
Sql.firstRow
public GroovyRowResult firstRow(GString gstring) throws SQLException { List<Object> params = getParameters(gstring); String sql = asSql(gstring, params); return firstRow(sql, params); }
java
public GroovyRowResult firstRow(GString gstring) throws SQLException { List<Object> params = getParameters(gstring); String sql = asSql(gstring, params); return firstRow(sql, params); }
[ "public", "GroovyRowResult", "firstRow", "(", "GString", "gstring", ")", "throws", "SQLException", "{", "List", "<", "Object", ">", "params", "=", "getParameters", "(", "gstring", ")", ";", "String", "sql", "=", "asSql", "(", "gstring", ",", "params", ")", ...
Performs the given SQL query and return the first row of the result set. The query may contain GString expressions. <p> Example usage: <pre> def location = 25 def ans = sql.firstRow("select * from PERSON where location_id {@code <} $location") println ans.firstname </pre> <p> Resource handling is performed automatically where appropriate. @param gstring a GString containing the SQL query with embedded params @return a GroovyRowResult object or <code>null</code> if no row is found @throws SQLException if a database access error occurs @see #expand(Object)
[ "Performs", "the", "given", "SQL", "query", "and", "return", "the", "first", "row", "of", "the", "result", "set", ".", "The", "query", "may", "contain", "GString", "expressions", ".", "<p", ">", "Example", "usage", ":", "<pre", ">", "def", "location", "=...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L2209-L2213
gosu-lang/gosu-lang
gosu-core-api/src/main/java/gw/lang/reflect/BeanInfoUtil.java
BeanInfoUtil.buildScriptableMethodDescriptorNoArgs
public static MethodDescriptor buildScriptableMethodDescriptorNoArgs( Class actionClass, String methodName ) { MethodDescriptor md = _buildMethodDescriptor( actionClass, methodName, EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_CLASS_ARRAY ); makeScriptable( md ); return md; }
java
public static MethodDescriptor buildScriptableMethodDescriptorNoArgs( Class actionClass, String methodName ) { MethodDescriptor md = _buildMethodDescriptor( actionClass, methodName, EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_CLASS_ARRAY ); makeScriptable( md ); return md; }
[ "public", "static", "MethodDescriptor", "buildScriptableMethodDescriptorNoArgs", "(", "Class", "actionClass", ",", "String", "methodName", ")", "{", "MethodDescriptor", "md", "=", "_buildMethodDescriptor", "(", "actionClass", ",", "methodName", ",", "EMPTY_STRING_ARRAY", ...
Builds a no-arg method descriptor that is exposed for scripting everywhere.
[ "Builds", "a", "no", "-", "arg", "method", "descriptor", "that", "is", "exposed", "for", "scripting", "everywhere", "." ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/reflect/BeanInfoUtil.java#L33-L38
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/tracer/Tracer.java
Tracer.returnConnection
public static synchronized void returnConnection(String poolName, Object mcp, Object cl, Object connection) { log.tracef("%s", new TraceEvent(poolName, Integer.toHexString(System.identityHashCode(mcp)), TraceEvent.RETURN_CONNECTION, Integer.toHexString(System.identityHashCode(cl)), Integer.toHexString(System.identityHashCode(connection)))); }
java
public static synchronized void returnConnection(String poolName, Object mcp, Object cl, Object connection) { log.tracef("%s", new TraceEvent(poolName, Integer.toHexString(System.identityHashCode(mcp)), TraceEvent.RETURN_CONNECTION, Integer.toHexString(System.identityHashCode(cl)), Integer.toHexString(System.identityHashCode(connection)))); }
[ "public", "static", "synchronized", "void", "returnConnection", "(", "String", "poolName", ",", "Object", "mcp", ",", "Object", "cl", ",", "Object", "connection", ")", "{", "log", ".", "tracef", "(", "\"%s\"", ",", "new", "TraceEvent", "(", "poolName", ",", ...
Return connection @param poolName The name of the pool @param mcp The managed connection pool @param cl The connection listener @param connection The connection
[ "Return", "connection" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/tracer/Tracer.java#L389-L396
jhunters/jprotobuf
v3/src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java
CodedConstant.getMapKVMessageElements
private static MessageElement getMapKVMessageElements(String name, MapType mapType) { MessageElement.Builder ret = MessageElement.builder(); ret.name(name); DataType keyType = mapType.keyType(); Builder fieldBuilder = FieldElement.builder().name("key").tag(1); fieldBuilder.type(keyType).label(FieldElement.Label.OPTIONAL); ret.addField(fieldBuilder.build()); DataType valueType = mapType.valueType(); fieldBuilder = FieldElement.builder().name("value").tag(2); fieldBuilder.type(valueType).label(FieldElement.Label.OPTIONAL); ret.addField(fieldBuilder.build()); return ret.build(); }
java
private static MessageElement getMapKVMessageElements(String name, MapType mapType) { MessageElement.Builder ret = MessageElement.builder(); ret.name(name); DataType keyType = mapType.keyType(); Builder fieldBuilder = FieldElement.builder().name("key").tag(1); fieldBuilder.type(keyType).label(FieldElement.Label.OPTIONAL); ret.addField(fieldBuilder.build()); DataType valueType = mapType.valueType(); fieldBuilder = FieldElement.builder().name("value").tag(2); fieldBuilder.type(valueType).label(FieldElement.Label.OPTIONAL); ret.addField(fieldBuilder.build()); return ret.build(); }
[ "private", "static", "MessageElement", "getMapKVMessageElements", "(", "String", "name", ",", "MapType", "mapType", ")", "{", "MessageElement", ".", "Builder", "ret", "=", "MessageElement", ".", "builder", "(", ")", ";", "ret", ".", "name", "(", "name", ")", ...
Gets the map kv message elements. @param name the name @param mapType the map type @return the map kv message elements
[ "Gets", "the", "map", "kv", "message", "elements", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/v3/src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java#L1567-L1582
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java
Calendar.getInstanceInternal
private static Calendar getInstanceInternal(TimeZone tz, ULocale locale) { if (locale == null) { locale = ULocale.getDefault(Category.FORMAT); } if (tz == null) { tz = TimeZone.getDefault(); } Calendar cal = createInstance(locale); cal.setTimeZone(tz); cal.setTimeInMillis(System.currentTimeMillis()); return cal; }
java
private static Calendar getInstanceInternal(TimeZone tz, ULocale locale) { if (locale == null) { locale = ULocale.getDefault(Category.FORMAT); } if (tz == null) { tz = TimeZone.getDefault(); } Calendar cal = createInstance(locale); cal.setTimeZone(tz); cal.setTimeInMillis(System.currentTimeMillis()); return cal; }
[ "private", "static", "Calendar", "getInstanceInternal", "(", "TimeZone", "tz", ",", "ULocale", "locale", ")", "{", "if", "(", "locale", "==", "null", ")", "{", "locale", "=", "ULocale", ".", "getDefault", "(", "Category", ".", "FORMAT", ")", ";", "}", "i...
/* All getInstance implementations call this private method to create a new Calendar instance.
[ "/", "*", "All", "getInstance", "implementations", "call", "this", "private", "method", "to", "create", "a", "new", "Calendar", "instance", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java#L1685-L1697
ysc/HtmlExtractor
html-extractor/src/main/java/org/apdplat/extractor/html/impl/ExtractFunctionExecutor.java
ExtractFunctionExecutor.execute
public static String execute(String text, Document doc, CssPath cssPath, String parseExpression) { if (parseExpression.startsWith("deleteChild")) { return executeDeleteChild(text, doc, cssPath, parseExpression); } if (parseExpression.startsWith("removeText")) { return executeRemoveText(text, parseExpression); } if (parseExpression.startsWith("substring")) { return executeSubstring(text, parseExpression); } return null; }
java
public static String execute(String text, Document doc, CssPath cssPath, String parseExpression) { if (parseExpression.startsWith("deleteChild")) { return executeDeleteChild(text, doc, cssPath, parseExpression); } if (parseExpression.startsWith("removeText")) { return executeRemoveText(text, parseExpression); } if (parseExpression.startsWith("substring")) { return executeSubstring(text, parseExpression); } return null; }
[ "public", "static", "String", "execute", "(", "String", "text", ",", "Document", "doc", ",", "CssPath", "cssPath", ",", "String", "parseExpression", ")", "{", "if", "(", "parseExpression", ".", "startsWith", "(", "\"deleteChild\"", ")", ")", "{", "return", "...
执行抽取函数 @param text CSS路径抽取出来的文本 @param doc 根文档 @param cssPath CSS路径对象 @param parseExpression 抽取函数 @return 抽取函数处理之后的文本
[ "执行抽取函数" ]
train
https://github.com/ysc/HtmlExtractor/blob/5378bc5f94138562c55506cf81de1ffe72ab701e/html-extractor/src/main/java/org/apdplat/extractor/html/impl/ExtractFunctionExecutor.java#L52-L64
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/util/URLEncodedUtils.java
URLEncodedUtils.encodeFormFields
private static String encodeFormFields(final String content, final String charset) { if (content == null) { return null; } return urlEncode(content, charset != null ? Charset.forName(charset) : StringUtils.UTF8, URLENCODER, true); }
java
private static String encodeFormFields(final String content, final String charset) { if (content == null) { return null; } return urlEncode(content, charset != null ? Charset.forName(charset) : StringUtils.UTF8, URLENCODER, true); }
[ "private", "static", "String", "encodeFormFields", "(", "final", "String", "content", ",", "final", "String", "charset", ")", "{", "if", "(", "content", "==", "null", ")", "{", "return", "null", ";", "}", "return", "urlEncode", "(", "content", ",", "charse...
Encode/escape www-url-form-encoded content. <p> Uses the {@link #URLENCODER} set of characters, rather than the {@link #UNRSERVED} set; this is for compatibilty with previous releases, URLEncoder.encode() and most browsers. @param content the content to encode, will convert space to '+' @param charset the charset to use @return encoded string
[ "Encode", "/", "escape", "www", "-", "url", "-", "form", "-", "encoded", "content", ".", "<p", ">", "Uses", "the", "{", "@link", "#URLENCODER", "}", "set", "of", "characters", "rather", "than", "the", "{", "@link", "#UNRSERVED", "}", "set", ";", "this"...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/URLEncodedUtils.java#L284-L289
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/MultiColumnText.java
MultiColumnText.getHeight
private float getHeight(float[] left, float[] right) { float max = Float.MIN_VALUE; float min = Float.MAX_VALUE; for (int i = 0; i < left.length; i += 2) { min = Math.min(min, left[i + 1]); max = Math.max(max, left[i + 1]); } for (int i = 0; i < right.length; i += 2) { min = Math.min(min, right[i + 1]); max = Math.max(max, right[i + 1]); } return max - min; }
java
private float getHeight(float[] left, float[] right) { float max = Float.MIN_VALUE; float min = Float.MAX_VALUE; for (int i = 0; i < left.length; i += 2) { min = Math.min(min, left[i + 1]); max = Math.max(max, left[i + 1]); } for (int i = 0; i < right.length; i += 2) { min = Math.min(min, right[i + 1]); max = Math.max(max, right[i + 1]); } return max - min; }
[ "private", "float", "getHeight", "(", "float", "[", "]", "left", ",", "float", "[", "]", "right", ")", "{", "float", "max", "=", "Float", ".", "MIN_VALUE", ";", "float", "min", "=", "Float", ".", "MAX_VALUE", ";", "for", "(", "int", "i", "=", "0", ...
Figure out the height of a column from the border extents @param left left border @param right right border @return height
[ "Figure", "out", "the", "height", "of", "a", "column", "from", "the", "border", "extents" ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/MultiColumnText.java#L371-L383
google/error-prone
check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java
ASTHelpers.hasAnnotation
public static boolean hasAnnotation( Tree tree, Class<? extends Annotation> annotationClass, VisitorState state) { return hasAnnotation(tree, annotationClass.getName(), state); }
java
public static boolean hasAnnotation( Tree tree, Class<? extends Annotation> annotationClass, VisitorState state) { return hasAnnotation(tree, annotationClass.getName(), state); }
[ "public", "static", "boolean", "hasAnnotation", "(", "Tree", "tree", ",", "Class", "<", "?", "extends", "Annotation", ">", "annotationClass", ",", "VisitorState", "state", ")", "{", "return", "hasAnnotation", "(", "tree", ",", "annotationClass", ".", "getName", ...
Check for the presence of an annotation, considering annotation inheritance. @return true if the tree is annotated with given type.
[ "Check", "for", "the", "presence", "of", "an", "annotation", "considering", "annotation", "inheritance", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java#L727-L730
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java
SARLJvmModelInferrer.cloneWithTypeParametersAndProxies
protected JvmTypeReference cloneWithTypeParametersAndProxies(JvmTypeReference type, JvmExecutable forExecutable) { // Ensure that the executable is inside a container. Otherwise, the cloning function will fail. assert forExecutable.getDeclaringType() != null; // Get the type parameter mapping that is a consequence of the super type extension within the container. final Map<String, JvmTypeReference> superTypeParameterMapping = new HashMap<>(); Utils.getSuperTypeParameterMap(forExecutable.getDeclaringType(), superTypeParameterMapping); // Do the cloning return Utils.cloneWithTypeParametersAndProxies( type, forExecutable.getTypeParameters(), superTypeParameterMapping, this._typeReferenceBuilder, this.typeBuilder, this.typeReferences, this.typesFactory); }
java
protected JvmTypeReference cloneWithTypeParametersAndProxies(JvmTypeReference type, JvmExecutable forExecutable) { // Ensure that the executable is inside a container. Otherwise, the cloning function will fail. assert forExecutable.getDeclaringType() != null; // Get the type parameter mapping that is a consequence of the super type extension within the container. final Map<String, JvmTypeReference> superTypeParameterMapping = new HashMap<>(); Utils.getSuperTypeParameterMap(forExecutable.getDeclaringType(), superTypeParameterMapping); // Do the cloning return Utils.cloneWithTypeParametersAndProxies( type, forExecutable.getTypeParameters(), superTypeParameterMapping, this._typeReferenceBuilder, this.typeBuilder, this.typeReferences, this.typesFactory); }
[ "protected", "JvmTypeReference", "cloneWithTypeParametersAndProxies", "(", "JvmTypeReference", "type", ",", "JvmExecutable", "forExecutable", ")", "{", "// Ensure that the executable is inside a container. Otherwise, the cloning function will fail.", "assert", "forExecutable", ".", "ge...
Clone the given type reference that for being link to the given executable component. <p>The proxies are not resolved, and the type parameters are clone when they are related to the type parameter of the executable or the type container. @param type the source type. @param forExecutable the executable component that will contain the result type. @return the result type, i.e. a copy of the source type.
[ "Clone", "the", "given", "type", "reference", "that", "for", "being", "link", "to", "the", "given", "executable", "component", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java#L3296-L3309
roboconf/roboconf-platform
core/roboconf-target-docker/src/main/java/net/roboconf/target/docker/internal/DockerUtils.java
DockerUtils.getContainerState
public static ContainerState getContainerState( String containerId, DockerClient dockerClient ) { ContainerState result = null; try { InspectContainerResponse resp = dockerClient.inspectContainerCmd( containerId ).exec(); if( resp != null ) result = resp.getState(); } catch( Exception e ) { // nothing } return result; }
java
public static ContainerState getContainerState( String containerId, DockerClient dockerClient ) { ContainerState result = null; try { InspectContainerResponse resp = dockerClient.inspectContainerCmd( containerId ).exec(); if( resp != null ) result = resp.getState(); } catch( Exception e ) { // nothing } return result; }
[ "public", "static", "ContainerState", "getContainerState", "(", "String", "containerId", ",", "DockerClient", "dockerClient", ")", "{", "ContainerState", "result", "=", "null", ";", "try", "{", "InspectContainerResponse", "resp", "=", "dockerClient", ".", "inspectCont...
Gets the state of a container. @param containerId the container ID @param dockerClient the Docker client @return a container state, or null if the container was not found
[ "Gets", "the", "state", "of", "a", "container", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-docker/src/main/java/net/roboconf/target/docker/internal/DockerUtils.java#L213-L226
aol/cyclops
cyclops/src/main/java/com/oath/cyclops/util/ExceptionSoftener.java
ExceptionSoftener.throwIf
public static <X extends Throwable> void throwIf(final X e, final Predicate<X> p) { if (p.test(e)) throw ExceptionSoftener.<RuntimeException> uncheck(e); }
java
public static <X extends Throwable> void throwIf(final X e, final Predicate<X> p) { if (p.test(e)) throw ExceptionSoftener.<RuntimeException> uncheck(e); }
[ "public", "static", "<", "X", "extends", "Throwable", ">", "void", "throwIf", "(", "final", "X", "e", ",", "final", "Predicate", "<", "X", ">", "p", ")", "{", "if", "(", "p", ".", "test", "(", "e", ")", ")", "throw", "ExceptionSoftener", ".", "<", ...
Throw the exception as upwards if the predicate holds, otherwise do nothing @param e Exception @param p Predicate to check exception should be thrown or not
[ "Throw", "the", "exception", "as", "upwards", "if", "the", "predicate", "holds", "otherwise", "do", "nothing" ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/util/ExceptionSoftener.java#L680-L683
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java
Shape.getOffset
public static long getOffset(DataBuffer shapeInformation, int dim0, int dim1, int dim2) { int rank = rank(shapeInformation); if (rank != 3) throw new IllegalArgumentException( "Cannot use this getOffset method on arrays of rank != 3 (rank is: " + rank + ")"); return getOffsetUnsafe(shapeInformation, dim0, dim1, dim2); }
java
public static long getOffset(DataBuffer shapeInformation, int dim0, int dim1, int dim2) { int rank = rank(shapeInformation); if (rank != 3) throw new IllegalArgumentException( "Cannot use this getOffset method on arrays of rank != 3 (rank is: " + rank + ")"); return getOffsetUnsafe(shapeInformation, dim0, dim1, dim2); }
[ "public", "static", "long", "getOffset", "(", "DataBuffer", "shapeInformation", ",", "int", "dim0", ",", "int", "dim1", ",", "int", "dim2", ")", "{", "int", "rank", "=", "rank", "(", "shapeInformation", ")", ";", "if", "(", "rank", "!=", "3", ")", "thr...
Get the offset of the specified [dim0,dim1,dim2] for the 3d array @param shapeInformation Shape information @param dim0 Row index to get the offset for @param dim1 Column index to get the offset for @param dim2 dimension 2 index to get the offset for @return Buffer offset
[ "Get", "the", "offset", "of", "the", "specified", "[", "dim0", "dim1", "dim2", "]", "for", "the", "3d", "array" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L1117-L1123
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/ui/CmsResultsTab.java
CmsResultsTab.fillContent
public void fillContent(final CmsGallerySearchBean searchObj, List<CmsSearchParamPanel> paramPanels) { removeNoParamMessage(); // in case there is a single type selected and the current sort order is not by type, // hide the type ascending and type descending sort order options SortParams currentSorting = SortParams.valueOf(searchObj.getSortOrder()); if ((searchObj.getTypes().size() == 1) && !((currentSorting == SortParams.type_asc) || (currentSorting == SortParams.type_desc))) { m_sortSelectBox.setItems(getSortList(false)); } else { m_sortSelectBox.setItems(getSortList(true)); } m_sortSelectBox.selectValue(searchObj.getSortOrder()); displayResultCount(getResultsDisplayed(searchObj), searchObj.getResultCount()); m_hasMoreResults = searchObj.hasMore(); if (searchObj.getPage() == 1) { m_preset = null; getList().scrollToTop(); clearList(); showParams(paramPanels); m_backwardScrollHandler.updateSearchBean(searchObj); getList().getElement().getStyle().clearDisplay(); scrollToPreset(); } else { showParams(paramPanels); addContent(searchObj); } showUpload(searchObj); }
java
public void fillContent(final CmsGallerySearchBean searchObj, List<CmsSearchParamPanel> paramPanels) { removeNoParamMessage(); // in case there is a single type selected and the current sort order is not by type, // hide the type ascending and type descending sort order options SortParams currentSorting = SortParams.valueOf(searchObj.getSortOrder()); if ((searchObj.getTypes().size() == 1) && !((currentSorting == SortParams.type_asc) || (currentSorting == SortParams.type_desc))) { m_sortSelectBox.setItems(getSortList(false)); } else { m_sortSelectBox.setItems(getSortList(true)); } m_sortSelectBox.selectValue(searchObj.getSortOrder()); displayResultCount(getResultsDisplayed(searchObj), searchObj.getResultCount()); m_hasMoreResults = searchObj.hasMore(); if (searchObj.getPage() == 1) { m_preset = null; getList().scrollToTop(); clearList(); showParams(paramPanels); m_backwardScrollHandler.updateSearchBean(searchObj); getList().getElement().getStyle().clearDisplay(); scrollToPreset(); } else { showParams(paramPanels); addContent(searchObj); } showUpload(searchObj); }
[ "public", "void", "fillContent", "(", "final", "CmsGallerySearchBean", "searchObj", ",", "List", "<", "CmsSearchParamPanel", ">", "paramPanels", ")", "{", "removeNoParamMessage", "(", ")", ";", "// in case there is a single type selected and the current sort order is not by typ...
Fill the content of the results tab.<p> @param searchObj the current search object containing search results @param paramPanels list of search parameter panels to show
[ "Fill", "the", "content", "of", "the", "results", "tab", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/ui/CmsResultsTab.java#L380-L410
nielsbasjes/logparser
parser-core/src/main/java/nl/basjes/parse/core/Parser.java
Parser.addParseTarget
public Parser<RECORD> addParseTarget(final Method method, final List<String> fieldValues) { return addParseTarget(method, SetterPolicy.ALWAYS, fieldValues); }
java
public Parser<RECORD> addParseTarget(final Method method, final List<String> fieldValues) { return addParseTarget(method, SetterPolicy.ALWAYS, fieldValues); }
[ "public", "Parser", "<", "RECORD", ">", "addParseTarget", "(", "final", "Method", "method", ",", "final", "List", "<", "String", ">", "fieldValues", ")", "{", "return", "addParseTarget", "(", "method", ",", "SetterPolicy", ".", "ALWAYS", ",", "fieldValues", ...
/* When there is a need to add a target callback manually use this method.
[ "/", "*", "When", "there", "is", "a", "need", "to", "add", "a", "target", "callback", "manually", "use", "this", "method", "." ]
train
https://github.com/nielsbasjes/logparser/blob/236d5bf91926addab82b20387262bb35da8512cd/parser-core/src/main/java/nl/basjes/parse/core/Parser.java#L575-L577
ontop/ontop
core/obda/src/main/java/it/unibz/inf/ontop/spec/ontology/impl/OntologyBuilderImpl.java
OntologyBuilderImpl.addDataPropertyRangeAxiom
@Override public void addDataPropertyRangeAxiom(DataPropertyRangeExpression range, Datatype datatype) throws InconsistentOntologyException { checkSignature(range); checkSignature(datatype); if (datatype.equals(DatatypeImpl.rdfsLiteral)) return; // otherwise the datatype is not top if (range.getProperty().isBottom()) return; if (range.getProperty().isTop()) throw new InconsistentOntologyException(); BinaryAxiom<DataRangeExpression> ax = new BinaryAxiomImpl<>(range, datatype); subDataRangeAxioms.add(ax); }
java
@Override public void addDataPropertyRangeAxiom(DataPropertyRangeExpression range, Datatype datatype) throws InconsistentOntologyException { checkSignature(range); checkSignature(datatype); if (datatype.equals(DatatypeImpl.rdfsLiteral)) return; // otherwise the datatype is not top if (range.getProperty().isBottom()) return; if (range.getProperty().isTop()) throw new InconsistentOntologyException(); BinaryAxiom<DataRangeExpression> ax = new BinaryAxiomImpl<>(range, datatype); subDataRangeAxioms.add(ax); }
[ "@", "Override", "public", "void", "addDataPropertyRangeAxiom", "(", "DataPropertyRangeExpression", "range", ",", "Datatype", "datatype", ")", "throws", "InconsistentOntologyException", "{", "checkSignature", "(", "range", ")", ";", "checkSignature", "(", "datatype", ")...
Normalizes and adds a data property range axiom <p> DataPropertyRange := 'DataPropertyRange' '(' axiomAnnotations DataPropertyExpression DataRange ')' <p> Implements rule [D3]: - ignore if the property is bot or the range is rdfs:Literal (top datatype) - inconsistency if the property is top but the range is not rdfs:Literal @throws InconsistentOntologyException
[ "Normalizes", "and", "adds", "a", "data", "property", "range", "axiom", "<p", ">", "DataPropertyRange", ":", "=", "DataPropertyRange", "(", "axiomAnnotations", "DataPropertyExpression", "DataRange", ")", "<p", ">", "Implements", "rule", "[", "D3", "]", ":", "-",...
train
https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/core/obda/src/main/java/it/unibz/inf/ontop/spec/ontology/impl/OntologyBuilderImpl.java#L233-L248
micronaut-projects/micronaut-core
runtime/src/main/java/io/micronaut/jackson/JacksonConfiguration.java
JacksonConfiguration.setDeserialization
public void setDeserialization(Map<DeserializationFeature, Boolean> deserialization) { if (CollectionUtils.isNotEmpty(deserialization)) { this.deserialization = deserialization; } }
java
public void setDeserialization(Map<DeserializationFeature, Boolean> deserialization) { if (CollectionUtils.isNotEmpty(deserialization)) { this.deserialization = deserialization; } }
[ "public", "void", "setDeserialization", "(", "Map", "<", "DeserializationFeature", ",", "Boolean", ">", "deserialization", ")", "{", "if", "(", "CollectionUtils", ".", "isNotEmpty", "(", "deserialization", ")", ")", "{", "this", ".", "deserialization", "=", "des...
Sets the deserialization features to use. @param deserialization The deserialiation features.
[ "Sets", "the", "deserialization", "features", "to", "use", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/runtime/src/main/java/io/micronaut/jackson/JacksonConfiguration.java#L245-L249
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/fieldaccessor/LabelSetterFactory.java
LabelSetterFactory.createField
private Optional<LabelSetter> createField(final Class<?> beanClass, final String fieldName) { final String labelFieldName = fieldName + "Label"; final Field labelField; try { labelField = beanClass.getDeclaredField(labelFieldName); labelField.setAccessible(true); } catch (NoSuchFieldException | SecurityException e) { return Optional.empty(); } if(labelField.getType().equals(String.class)) { return Optional.of(new LabelSetter() { @Override public void set(final Object beanObj, final String label) { ArgUtils.notNull(beanObj, "beanObj"); ArgUtils.notNull(label, "label"); try { labelField.set(beanObj, label); } catch (IllegalArgumentException | IllegalAccessException e) { throw new RuntimeException("fail access label field.", e); } } }); } return Optional.empty(); }
java
private Optional<LabelSetter> createField(final Class<?> beanClass, final String fieldName) { final String labelFieldName = fieldName + "Label"; final Field labelField; try { labelField = beanClass.getDeclaredField(labelFieldName); labelField.setAccessible(true); } catch (NoSuchFieldException | SecurityException e) { return Optional.empty(); } if(labelField.getType().equals(String.class)) { return Optional.of(new LabelSetter() { @Override public void set(final Object beanObj, final String label) { ArgUtils.notNull(beanObj, "beanObj"); ArgUtils.notNull(label, "label"); try { labelField.set(beanObj, label); } catch (IllegalArgumentException | IllegalAccessException e) { throw new RuntimeException("fail access label field.", e); } } }); } return Optional.empty(); }
[ "private", "Optional", "<", "LabelSetter", ">", "createField", "(", "final", "Class", "<", "?", ">", "beanClass", ",", "final", "String", "fieldName", ")", "{", "final", "String", "labelFieldName", "=", "fieldName", "+", "\"Label\"", ";", "final", "Field", "...
フィールドによるラベル情報を格納する場合。 <p>{@code <フィールド名> + Label}のメソッド名</p> <p>引数として、{@link CellPosition}、{@link Point}、 {@link org.apache.poi.ss.util.CellAddress}をサポートする。</p> @param beanClass フィールドが定義してあるクラスのインスタンス @param fieldName フィールド名 @return ラベル情報の設定用クラス
[ "フィールドによるラベル情報を格納する場合。", "<p", ">", "{", "@code", "<フィールド名", ">", "+", "Label", "}", "のメソッド名<", "/", "p", ">", "<p", ">", "引数として、", "{", "@link", "CellPosition", "}", "、", "{", "@link", "Point", "}", "、", "{", "@link", "org", ".", "apache", ".", "poi...
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/fieldaccessor/LabelSetterFactory.java#L178-L211
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPMeasurementUnitPersistenceImpl.java
CPMeasurementUnitPersistenceImpl.removeByG_K_T
@Override public CPMeasurementUnit removeByG_K_T(long groupId, String key, int type) throws NoSuchCPMeasurementUnitException { CPMeasurementUnit cpMeasurementUnit = findByG_K_T(groupId, key, type); return remove(cpMeasurementUnit); }
java
@Override public CPMeasurementUnit removeByG_K_T(long groupId, String key, int type) throws NoSuchCPMeasurementUnitException { CPMeasurementUnit cpMeasurementUnit = findByG_K_T(groupId, key, type); return remove(cpMeasurementUnit); }
[ "@", "Override", "public", "CPMeasurementUnit", "removeByG_K_T", "(", "long", "groupId", ",", "String", "key", ",", "int", "type", ")", "throws", "NoSuchCPMeasurementUnitException", "{", "CPMeasurementUnit", "cpMeasurementUnit", "=", "findByG_K_T", "(", "groupId", ","...
Removes the cp measurement unit where groupId = &#63; and key = &#63; and type = &#63; from the database. @param groupId the group ID @param key the key @param type the type @return the cp measurement unit that was removed
[ "Removes", "the", "cp", "measurement", "unit", "where", "groupId", "=", "&#63", ";", "and", "key", "=", "&#63", ";", "and", "type", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPMeasurementUnitPersistenceImpl.java#L2724-L2730
baratine/baratine
kraken/src/main/java/com/caucho/v5/kelp/BlockTree.java
BlockTree.addCode
boolean addCode(int code, byte []minKey, byte []maxKey, int pid) { int len = minKey.length + maxKey.length + 5; int index = getIndex() - len; int ptr = index; if (ptr < 0) { return false; } byte []buffer = getBuffer(); buffer[ptr] = (byte) code; ptr += 1; System.arraycopy(minKey, 0, buffer, ptr, minKey.length); ptr += minKey.length; System.arraycopy(maxKey, 0, buffer, ptr, maxKey.length); ptr += maxKey.length; BitsUtil.writeInt(buffer, ptr, pid); setIndex(index); /* System.out.println("ADDC: " + code + " " + pid + " " + Hex.toShortHex(minKey) + " " + Hex.toShortHex(maxKey)); */ return true; }
java
boolean addCode(int code, byte []minKey, byte []maxKey, int pid) { int len = minKey.length + maxKey.length + 5; int index = getIndex() - len; int ptr = index; if (ptr < 0) { return false; } byte []buffer = getBuffer(); buffer[ptr] = (byte) code; ptr += 1; System.arraycopy(minKey, 0, buffer, ptr, minKey.length); ptr += minKey.length; System.arraycopy(maxKey, 0, buffer, ptr, maxKey.length); ptr += maxKey.length; BitsUtil.writeInt(buffer, ptr, pid); setIndex(index); /* System.out.println("ADDC: " + code + " " + pid + " " + Hex.toShortHex(minKey) + " " + Hex.toShortHex(maxKey)); */ return true; }
[ "boolean", "addCode", "(", "int", "code", ",", "byte", "[", "]", "minKey", ",", "byte", "[", "]", "maxKey", ",", "int", "pid", ")", "{", "int", "len", "=", "minKey", ".", "length", "+", "maxKey", ".", "length", "+", "5", ";", "int", "index", "=",...
/* boolean remove(byte []minKey, byte []maxKey) { int len = minKey.length + maxKey.length + 9; byte []buffer = getBuffer(); boolean isRemove = false; int minOffset = 1; int maxOffset = minOffset + minKey.length; for (int ptr = getIndex(); ptr < BLOCK_SIZE; ptr += len) { if (compareKey(minKey, buffer, ptr + minOffset) == 0 && compareKey(maxKey, buffer, ptr + maxOffset) == 0) { buffer[ptr] = REMOVE; isRemove = true; } } return isRemove; }
[ "/", "*", "boolean", "remove", "(", "byte", "[]", "minKey", "byte", "[]", "maxKey", ")", "{", "int", "len", "=", "minKey", ".", "length", "+", "maxKey", ".", "length", "+", "9", ";" ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/BlockTree.java#L105-L139
jenkinsci/jenkins
core/src/main/java/jenkins/util/SystemProperties.java
SystemProperties.getString
public static String getString(String key, @CheckForNull String def) { return getString(key, def, Level.CONFIG); }
java
public static String getString(String key, @CheckForNull String def) { return getString(key, def, Level.CONFIG); }
[ "public", "static", "String", "getString", "(", "String", "key", ",", "@", "CheckForNull", "String", "def", ")", "{", "return", "getString", "(", "key", ",", "def", ",", "Level", ".", "CONFIG", ")", ";", "}" ]
Gets the system property indicated by the specified key, or a default value. This behaves just like {@link System#getProperty(java.lang.String, java.lang.String)}, except that it also consults the {@link ServletContext}'s "init" parameters. @param key the name of the system property. @param def a default value. @return the string value of the system property, or {@code null} if the property is missing and the default value is {@code null}. @exception NullPointerException if {@code key} is {@code null}. @exception IllegalArgumentException if {@code key} is empty.
[ "Gets", "the", "system", "property", "indicated", "by", "the", "specified", "key", "or", "a", "default", "value", ".", "This", "behaves", "just", "like", "{", "@link", "System#getProperty", "(", "java", ".", "lang", ".", "String", "java", ".", "lang", ".",...
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/util/SystemProperties.java#L220-L222
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/document/json/JsonObject.java
JsonObject.getAndDecryptBigDecimal
public BigDecimal getAndDecryptBigDecimal(String name, String providerName) throws Exception { Object found = getAndDecrypt(name, providerName); if (found == null) { return null; } else if (found instanceof Double) { return new BigDecimal((Double) found); } return (BigDecimal) found; }
java
public BigDecimal getAndDecryptBigDecimal(String name, String providerName) throws Exception { Object found = getAndDecrypt(name, providerName); if (found == null) { return null; } else if (found instanceof Double) { return new BigDecimal((Double) found); } return (BigDecimal) found; }
[ "public", "BigDecimal", "getAndDecryptBigDecimal", "(", "String", "name", ",", "String", "providerName", ")", "throws", "Exception", "{", "Object", "found", "=", "getAndDecrypt", "(", "name", ",", "providerName", ")", ";", "if", "(", "found", "==", "null", ")"...
Retrieves the decrypted value from the field name and casts it to {@link BigDecimal}. Note: Use of the Field Level Encryption functionality provided in the com.couchbase.client.encryption namespace provided by Couchbase is subject to the Couchbase Inc. Enterprise Subscription License Agreement at https://www.couchbase.com/ESLA-11132015. @param name the name of the field. @param providerName crypto provider for decryption @return the result or null if it does not exist.
[ "Retrieves", "the", "decrypted", "value", "from", "the", "field", "name", "and", "casts", "it", "to", "{", "@link", "BigDecimal", "}", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/document/json/JsonObject.java#L944-L952
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UnicodeSetStringSpan.java
UnicodeSetStringSpan.spanOne
static int spanOne(final UnicodeSet set, CharSequence s, int start, int length) { char c = s.charAt(start); if (c >= 0xd800 && c <= 0xdbff && length >= 2) { char c2 = s.charAt(start + 1); if (android.icu.text.UTF16.isTrailSurrogate(c2)) { int supplementary = Character.toCodePoint(c, c2); return set.contains(supplementary) ? 2 : -2; } } return set.contains(c) ? 1 : -1; }
java
static int spanOne(final UnicodeSet set, CharSequence s, int start, int length) { char c = s.charAt(start); if (c >= 0xd800 && c <= 0xdbff && length >= 2) { char c2 = s.charAt(start + 1); if (android.icu.text.UTF16.isTrailSurrogate(c2)) { int supplementary = Character.toCodePoint(c, c2); return set.contains(supplementary) ? 2 : -2; } } return set.contains(c) ? 1 : -1; }
[ "static", "int", "spanOne", "(", "final", "UnicodeSet", "set", ",", "CharSequence", "s", ",", "int", "start", ",", "int", "length", ")", "{", "char", "c", "=", "s", ".", "charAt", "(", "start", ")", ";", "if", "(", "c", ">=", "0xd800", "&&", "c", ...
Does the set contain the next code point? If so, return its length; otherwise return its negative length.
[ "Does", "the", "set", "contain", "the", "next", "code", "point?", "If", "so", "return", "its", "length", ";", "otherwise", "return", "its", "negative", "length", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UnicodeSetStringSpan.java#L976-L986
ops4j/org.ops4j.pax.logging
pax-logging-service/src/main/java/org/apache/log4j/rule/InequalityRule.java
InequalityRule.getRule
public static Rule getRule(final String inequalitySymbol, final Stack stack) { if (stack.size() < 2) { throw new IllegalArgumentException("Invalid " + inequalitySymbol + " rule - expected two parameters but received " + stack.size()); } String p2 = stack.pop().toString(); String p1 = stack.pop().toString(); return getRule(inequalitySymbol, p1, p2); }
java
public static Rule getRule(final String inequalitySymbol, final Stack stack) { if (stack.size() < 2) { throw new IllegalArgumentException("Invalid " + inequalitySymbol + " rule - expected two parameters but received " + stack.size()); } String p2 = stack.pop().toString(); String p1 = stack.pop().toString(); return getRule(inequalitySymbol, p1, p2); }
[ "public", "static", "Rule", "getRule", "(", "final", "String", "inequalitySymbol", ",", "final", "Stack", "stack", ")", "{", "if", "(", "stack", ".", "size", "(", ")", "<", "2", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Invalid \"", "+"...
Create new instance from top two elements on stack. @param inequalitySymbol inequality symbol. @param stack stack. @return rule.
[ "Create", "new", "instance", "from", "top", "two", "elements", "on", "stack", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-service/src/main/java/org/apache/log4j/rule/InequalityRule.java#L89-L100
ksclarke/freelib-utils
src/main/java/info/freelibrary/util/BufferedFileWriter.java
BufferedFileWriter.getWriter
private static Writer getWriter(final File aFile) throws FileNotFoundException { try { return new OutputStreamWriter(new FileOutputStream(aFile), StandardCharsets.UTF_8.name()); } catch (final java.io.UnsupportedEncodingException details) { throw new UnsupportedEncodingException(details, StandardCharsets.UTF_8.name()); } }
java
private static Writer getWriter(final File aFile) throws FileNotFoundException { try { return new OutputStreamWriter(new FileOutputStream(aFile), StandardCharsets.UTF_8.name()); } catch (final java.io.UnsupportedEncodingException details) { throw new UnsupportedEncodingException(details, StandardCharsets.UTF_8.name()); } }
[ "private", "static", "Writer", "getWriter", "(", "final", "File", "aFile", ")", "throws", "FileNotFoundException", "{", "try", "{", "return", "new", "OutputStreamWriter", "(", "new", "FileOutputStream", "(", "aFile", ")", ",", "StandardCharsets", ".", "UTF_8", "...
Gets a writer that can write to the supplied file using the UTF-8 charset. @param aFile A file to which to write @return A writer that writes to the supplied file @throws FileNotFoundException If the supplied file cannot be found
[ "Gets", "a", "writer", "that", "can", "write", "to", "the", "supplied", "file", "using", "the", "UTF", "-", "8", "charset", "." ]
train
https://github.com/ksclarke/freelib-utils/blob/54e822ae4c11b3d74793fd82a1a535ffafffaf45/src/main/java/info/freelibrary/util/BufferedFileWriter.java#L47-L53
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/serialize/write/XMLCharHelper.java
XMLCharHelper.isInvalidXMLTextChar
public static boolean isInvalidXMLTextChar (@Nonnull final EXMLSerializeVersion eXMLVersion, final int c) { switch (eXMLVersion) { case XML_10: return INVALID_VALUE_CHAR_XML10.get (c); case XML_11: return INVALID_TEXT_VALUE_CHAR_XML11.get (c); case HTML: return INVALID_CHAR_HTML.get (c); default: throw new IllegalArgumentException ("Unsupported XML version " + eXMLVersion + "!"); } }
java
public static boolean isInvalidXMLTextChar (@Nonnull final EXMLSerializeVersion eXMLVersion, final int c) { switch (eXMLVersion) { case XML_10: return INVALID_VALUE_CHAR_XML10.get (c); case XML_11: return INVALID_TEXT_VALUE_CHAR_XML11.get (c); case HTML: return INVALID_CHAR_HTML.get (c); default: throw new IllegalArgumentException ("Unsupported XML version " + eXMLVersion + "!"); } }
[ "public", "static", "boolean", "isInvalidXMLTextChar", "(", "@", "Nonnull", "final", "EXMLSerializeVersion", "eXMLVersion", ",", "final", "int", "c", ")", "{", "switch", "(", "eXMLVersion", ")", "{", "case", "XML_10", ":", "return", "INVALID_VALUE_CHAR_XML10", "."...
Check if the passed character is invalid for a text node. @param eXMLVersion XML version to be used. May not be <code>null</code>. @param c char to check @return <code>true</code> if the char is invalid
[ "Check", "if", "the", "passed", "character", "is", "invalid", "for", "a", "text", "node", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/write/XMLCharHelper.java#L778-L791
mabe02/lanterna
src/main/java/com/googlecode/lanterna/gui2/ActionListBox.java
ActionListBox.addItem
public ActionListBox addItem(final String label, final Runnable action) { return addItem(new Runnable() { @Override public void run() { action.run(); } @Override public String toString() { return label; } }); }
java
public ActionListBox addItem(final String label, final Runnable action) { return addItem(new Runnable() { @Override public void run() { action.run(); } @Override public String toString() { return label; } }); }
[ "public", "ActionListBox", "addItem", "(", "final", "String", "label", ",", "final", "Runnable", "action", ")", "{", "return", "addItem", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "action", ".", "run"...
Adds a new item to the list, which is displayed in the list using a supplied label. @param label Label to use in the list for the new item @param action Runnable to invoke when this action is selected and then triggered @return Itself
[ "Adds", "a", "new", "item", "to", "the", "list", "which", "is", "displayed", "in", "the", "list", "using", "a", "supplied", "label", "." ]
train
https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/gui2/ActionListBox.java#L74-L86
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/RowReaderDefaultImpl.java
RowReaderDefaultImpl.readObjectArrayFrom
public void readObjectArrayFrom(ResultSetAndStatement rs_stmt, Map row) { FieldDescriptor[] fields; /* arminw: TODO: this feature doesn't work, so remove this in future */ if (m_cld.getSuperClass() != null) { /** * treeder * append super class fields if exist */ fields = m_cld.getFieldDescriptorsInHeirarchy(); } else { String ojbConcreteClass = extractOjbConcreteClass(m_cld, rs_stmt.m_rs, row); /* arminw: if multiple classes were mapped to the same table, lookup the concrete class and use these fields, attach ojbConcreteClass in row map for later use */ if(ojbConcreteClass != null) { ClassDescriptor cld = m_cld.getRepository().getDescriptorFor(ojbConcreteClass); row.put(OJB_CONCRETE_CLASS_KEY, cld.getClassOfObject()); fields = cld.getFieldDescriptor(true); } else { String ojbClass = SqlHelper.getOjbClassName(rs_stmt.m_rs); if (ojbClass != null) { ClassDescriptor cld = m_cld.getRepository().getDescriptorFor(ojbClass); row.put(OJB_CONCRETE_CLASS_KEY, cld.getClassOfObject()); fields = cld.getFieldDescriptor(true); } else { fields = m_cld.getFieldDescriptor(true); } } } readValuesFrom(rs_stmt, row, fields); }
java
public void readObjectArrayFrom(ResultSetAndStatement rs_stmt, Map row) { FieldDescriptor[] fields; /* arminw: TODO: this feature doesn't work, so remove this in future */ if (m_cld.getSuperClass() != null) { /** * treeder * append super class fields if exist */ fields = m_cld.getFieldDescriptorsInHeirarchy(); } else { String ojbConcreteClass = extractOjbConcreteClass(m_cld, rs_stmt.m_rs, row); /* arminw: if multiple classes were mapped to the same table, lookup the concrete class and use these fields, attach ojbConcreteClass in row map for later use */ if(ojbConcreteClass != null) { ClassDescriptor cld = m_cld.getRepository().getDescriptorFor(ojbConcreteClass); row.put(OJB_CONCRETE_CLASS_KEY, cld.getClassOfObject()); fields = cld.getFieldDescriptor(true); } else { String ojbClass = SqlHelper.getOjbClassName(rs_stmt.m_rs); if (ojbClass != null) { ClassDescriptor cld = m_cld.getRepository().getDescriptorFor(ojbClass); row.put(OJB_CONCRETE_CLASS_KEY, cld.getClassOfObject()); fields = cld.getFieldDescriptor(true); } else { fields = m_cld.getFieldDescriptor(true); } } } readValuesFrom(rs_stmt, row, fields); }
[ "public", "void", "readObjectArrayFrom", "(", "ResultSetAndStatement", "rs_stmt", ",", "Map", "row", ")", "{", "FieldDescriptor", "[", "]", "fields", ";", "/*\r\narminw:\r\nTODO: this feature doesn't work, so remove this in future\r\n*/", "if", "(", "m_cld", ".", "getSuperC...
materialize a single object, described by cld, from the first row of the ResultSet rs. There are two possible strategies: 1. The persistent class defines a public constructor with arguments matching the persistent primitive attributes of the class. In this case we build an array args of arguments from rs and call Constructor.newInstance(args) to build an object. 2. The persistent class does not provide such a constructor, but only a public default constructor. In this case we create an empty instance with Class.newInstance(). This empty instance is then filled by calling Field::set(obj,getObject(matchingColumn)) for each attribute. The second strategy needs n calls to Field::set() which are much more expensive than the filling of the args array in the first strategy. client applications should therefore define adequate constructors to benefit from performance gain of the first strategy. @throws PersistenceBrokerException if there is an error accessing the access layer
[ "materialize", "a", "single", "object", "described", "by", "cld", "from", "the", "first", "row", "of", "the", "ResultSet", "rs", ".", "There", "are", "two", "possible", "strategies", ":", "1", ".", "The", "persistent", "class", "defines", "a", "public", "c...
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/RowReaderDefaultImpl.java#L164-L209
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/graph/EdmondsMaximumMatching.java
EdmondsMaximumMatching.blossomSupports
private int[] blossomSupports(int v, int w, int base) { int n = 0; path[n++] = dsf.getRoot(v); Tuple b = new Tuple(v, w); while (path[n - 1] != base) { int u = even[path[n - 1]]; path[n++] = u; this.bridges.put(u, b); // contracting the blossom allows us to continue searching from odd // vertices (any odd vertices are now even - part of the blossom set) queue.add(u); path[n++] = dsf.getRoot(odd[u]); } return Arrays.copyOf(path, n); }
java
private int[] blossomSupports(int v, int w, int base) { int n = 0; path[n++] = dsf.getRoot(v); Tuple b = new Tuple(v, w); while (path[n - 1] != base) { int u = even[path[n - 1]]; path[n++] = u; this.bridges.put(u, b); // contracting the blossom allows us to continue searching from odd // vertices (any odd vertices are now even - part of the blossom set) queue.add(u); path[n++] = dsf.getRoot(odd[u]); } return Arrays.copyOf(path, n); }
[ "private", "int", "[", "]", "blossomSupports", "(", "int", "v", ",", "int", "w", ",", "int", "base", ")", "{", "int", "n", "=", "0", ";", "path", "[", "n", "++", "]", "=", "dsf", ".", "getRoot", "(", "v", ")", ";", "Tuple", "b", "=", "new", ...
Creates the blossom 'supports' for the specified blossom 'bridge' edge (v, w). We travel down each side to the base of the blossom ('base') collapsing vertices and point any 'odd' vertices to the correct 'bridge' edge. We do this by indexing the birdie to each vertex in the 'bridges' map. @param v an endpoint of the blossom bridge @param w another endpoint of the blossom bridge @param base the base of the blossom
[ "Creates", "the", "blossom", "supports", "for", "the", "specified", "blossom", "bridge", "edge", "(", "v", "w", ")", ".", "We", "travel", "down", "each", "side", "to", "the", "base", "of", "the", "blossom", "(", "base", ")", "collapsing", "vertices", "an...
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/graph/EdmondsMaximumMatching.java#L292-L308
comapi/comapi-sdk-android
COMAPI/foundation/src/main/java/com/comapi/internal/network/model/messaging/ConversationEventsResponse.java
ConversationEventsResponse.parseEvent
private void parseEvent(JsonObject event, Parser parser, int i) { JsonElement nameJE = event.get(Event.KEY_NAME); if (nameJE != null) { String name = nameJE.getAsString(); if (MessageSentEvent.TYPE.equals(name)) { MessageSentEvent parsed = parser.parse(event, MessageSentEvent.class); messageSent.add(parsed); map.put(i, parsed); } else if (MessageDeliveredEvent.TYPE.equals(name)) { MessageDeliveredEvent parsed = parser.parse(event, MessageDeliveredEvent.class); messageDelivered.add(parsed); map.put(i, parsed); } else if (MessageReadEvent.TYPE.equals(name)) { MessageReadEvent parsed = parser.parse(event, MessageReadEvent.class); messageRead.add(parsed); map.put(i, parsed); } } }
java
private void parseEvent(JsonObject event, Parser parser, int i) { JsonElement nameJE = event.get(Event.KEY_NAME); if (nameJE != null) { String name = nameJE.getAsString(); if (MessageSentEvent.TYPE.equals(name)) { MessageSentEvent parsed = parser.parse(event, MessageSentEvent.class); messageSent.add(parsed); map.put(i, parsed); } else if (MessageDeliveredEvent.TYPE.equals(name)) { MessageDeliveredEvent parsed = parser.parse(event, MessageDeliveredEvent.class); messageDelivered.add(parsed); map.put(i, parsed); } else if (MessageReadEvent.TYPE.equals(name)) { MessageReadEvent parsed = parser.parse(event, MessageReadEvent.class); messageRead.add(parsed); map.put(i, parsed); } } }
[ "private", "void", "parseEvent", "(", "JsonObject", "event", ",", "Parser", "parser", ",", "int", "i", ")", "{", "JsonElement", "nameJE", "=", "event", ".", "get", "(", "Event", ".", "KEY_NAME", ")", ";", "if", "(", "nameJE", "!=", "null", ")", "{", ...
Parse event and add to appropriate list. @param event Json object to parse. @param parser Parser interface. @param i Number of event in the json array.
[ "Parse", "event", "and", "add", "to", "appropriate", "list", "." ]
train
https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/model/messaging/ConversationEventsResponse.java#L69-L91
ReactiveX/RxJavaAsyncUtil
src/main/java/rx/util/async/Async.java
Async.toAsync
public static <T1, T2> Func2<T1, T2, Observable<Void>> toAsync(Action2<? super T1, ? super T2> action) { return toAsync(action, Schedulers.computation()); }
java
public static <T1, T2> Func2<T1, T2, Observable<Void>> toAsync(Action2<? super T1, ? super T2> action) { return toAsync(action, Schedulers.computation()); }
[ "public", "static", "<", "T1", ",", "T2", ">", "Func2", "<", "T1", ",", "T2", ",", "Observable", "<", "Void", ">", ">", "toAsync", "(", "Action2", "<", "?", "super", "T1", ",", "?", "super", "T2", ">", "action", ")", "{", "return", "toAsync", "("...
Convert a synchronous action call into an asynchronous function call through an Observable. <p> <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.an.png" alt=""> @param <T1> the first parameter type @param <T2> the second parameter type @param action the action to convert @return a function that returns an Observable that executes the {@code action} and emits {@code null} @see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a> @see <a href="http://msdn.microsoft.com/en-us/library/hh211875.aspx">MSDN: Observable.ToAsync</a>
[ "Convert", "a", "synchronous", "action", "call", "into", "an", "asynchronous", "function", "call", "through", "an", "Observable", ".", "<p", ">", "<img", "width", "=", "640", "src", "=", "https", ":", "//", "raw", ".", "github", ".", "com", "/", "wiki", ...
train
https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L239-L241
sdl/odata
odata_edm/src/main/java/com/sdl/odata/edm/factory/annotations/AnnotationFunctionFactory.java
AnnotationFunctionFactory.getFullyQualifiedFunctionName
public static String getFullyQualifiedFunctionName(EdmFunction functionAnnotation, Class<?> functionClass) { String name = getTypeName(functionAnnotation, functionClass); String namespace = getNamespace(functionAnnotation, functionClass); return namespace + "." + name; }
java
public static String getFullyQualifiedFunctionName(EdmFunction functionAnnotation, Class<?> functionClass) { String name = getTypeName(functionAnnotation, functionClass); String namespace = getNamespace(functionAnnotation, functionClass); return namespace + "." + name; }
[ "public", "static", "String", "getFullyQualifiedFunctionName", "(", "EdmFunction", "functionAnnotation", ",", "Class", "<", "?", ">", "functionClass", ")", "{", "String", "name", "=", "getTypeName", "(", "functionAnnotation", ",", "functionClass", ")", ";", "String"...
Returned fully qualified function name using function annotation and class. @param functionAnnotation function annotation @param functionClass function class @return fully qualified function name
[ "Returned", "fully", "qualified", "function", "name", "using", "function", "annotation", "and", "class", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_edm/src/main/java/com/sdl/odata/edm/factory/annotations/AnnotationFunctionFactory.java#L107-L111
aws/aws-sdk-java
aws-java-sdk-ses/src/main/java/com/amazonaws/services/simpleemail/AWSJavaMailTransport.java
AWSJavaMailTransport.sendMessage
@Override public void sendMessage(Message msg, Address[] addresses) throws MessagingException, SendFailedException { checkConnection(); checkMessage(msg); checkAddresses(msg, addresses); collateRecipients(msg, addresses); SendRawEmailRequest req = prepareEmail(msg); sendEmail(msg, req); }
java
@Override public void sendMessage(Message msg, Address[] addresses) throws MessagingException, SendFailedException { checkConnection(); checkMessage(msg); checkAddresses(msg, addresses); collateRecipients(msg, addresses); SendRawEmailRequest req = prepareEmail(msg); sendEmail(msg, req); }
[ "@", "Override", "public", "void", "sendMessage", "(", "Message", "msg", ",", "Address", "[", "]", "addresses", ")", "throws", "MessagingException", ",", "SendFailedException", "{", "checkConnection", "(", ")", ";", "checkMessage", "(", "msg", ")", ";", "check...
Sends a MIME message through Amazon's E-mail Service with the specified recipients. Addresses that are passed into this method are merged with the ones already embedded in the message (duplicates are removed). @param msg A Mime type e-mail message to be sent @param addresses Additional e-mail addresses (RFC-822) to be included in the message
[ "Sends", "a", "MIME", "message", "through", "Amazon", "s", "E", "-", "mail", "Service", "with", "the", "specified", "recipients", ".", "Addresses", "that", "are", "passed", "into", "this", "method", "are", "merged", "with", "the", "ones", "already", "embedde...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ses/src/main/java/com/amazonaws/services/simpleemail/AWSJavaMailTransport.java#L89-L101
mikepenz/FastAdapter
app/src/main/java/com/mikepenz/fastadapter/app/items/RadioButtonSampleItem.java
RadioButtonSampleItem.bindView
@Override public void bindView(ViewHolder viewHolder, List<Object> payloads) { super.bindView(viewHolder, payloads); viewHolder.radioButton.setChecked(isSelected()); //set the text for the name StringHolder.applyTo(name, viewHolder.name); //set the text for the description or hide StringHolder.applyToOrHide(description, viewHolder.description); }
java
@Override public void bindView(ViewHolder viewHolder, List<Object> payloads) { super.bindView(viewHolder, payloads); viewHolder.radioButton.setChecked(isSelected()); //set the text for the name StringHolder.applyTo(name, viewHolder.name); //set the text for the description or hide StringHolder.applyToOrHide(description, viewHolder.description); }
[ "@", "Override", "public", "void", "bindView", "(", "ViewHolder", "viewHolder", ",", "List", "<", "Object", ">", "payloads", ")", "{", "super", ".", "bindView", "(", "viewHolder", ",", "payloads", ")", ";", "viewHolder", ".", "radioButton", ".", "setChecked"...
binds the data of this item onto the viewHolder @param viewHolder the viewHolder of this item
[ "binds", "the", "data", "of", "this", "item", "onto", "the", "viewHolder" ]
train
https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/app/src/main/java/com/mikepenz/fastadapter/app/items/RadioButtonSampleItem.java#L81-L91
integration-technology/amazon-mws-orders
src/main/java/com/amazonservices/mws/client/MwsAQCall.java
MwsAQCall.getResponseHeaderMetadata
private MwsResponseHeaderMetadata getResponseHeaderMetadata(HttpResponse response) { Header requestIdHeader = response.getFirstHeader("x-mws-request-id"); String requestId = requestIdHeader == null ? null : requestIdHeader.getValue(); Header timestampHeader = response.getFirstHeader("x-mws-timestamp"); String timestamp = timestampHeader == null ? null : timestampHeader.getValue(); Header contextHeader = response.getFirstHeader("x-mws-response-context"); String contextString = contextHeader==null ? "" : contextHeader.getValue(); List<String> context = Collections.unmodifiableList(Arrays.asList(contextString.split(","))); Double quotaMax; try { Header quotaMaxHeader = response.getFirstHeader("x-mws-quota-max"); quotaMax = quotaMaxHeader == null ? null : Double.valueOf(quotaMaxHeader.getValue()); } catch (NumberFormatException ex) { quotaMax = null; } Double quotaRemaining; try { Header quotaRemainingHeader = response.getFirstHeader("x-mws-quota-remaining"); quotaRemaining = quotaRemainingHeader == null ? null : Double.valueOf(quotaRemainingHeader.getValue()); } catch (NumberFormatException ex) { quotaRemaining = null; } Date quotaResetDate; try { Header quotaResetHeader = response.getFirstHeader("x-mws-quota-resetsOn"); quotaResetDate = quotaResetHeader == null ? null : MwsUtl.parseTimestamp(quotaResetHeader.getValue()); } catch (java.text.ParseException ex) { quotaResetDate = null; } return new MwsResponseHeaderMetadata(requestId, context, timestamp, quotaMax, quotaRemaining, quotaResetDate); }
java
private MwsResponseHeaderMetadata getResponseHeaderMetadata(HttpResponse response) { Header requestIdHeader = response.getFirstHeader("x-mws-request-id"); String requestId = requestIdHeader == null ? null : requestIdHeader.getValue(); Header timestampHeader = response.getFirstHeader("x-mws-timestamp"); String timestamp = timestampHeader == null ? null : timestampHeader.getValue(); Header contextHeader = response.getFirstHeader("x-mws-response-context"); String contextString = contextHeader==null ? "" : contextHeader.getValue(); List<String> context = Collections.unmodifiableList(Arrays.asList(contextString.split(","))); Double quotaMax; try { Header quotaMaxHeader = response.getFirstHeader("x-mws-quota-max"); quotaMax = quotaMaxHeader == null ? null : Double.valueOf(quotaMaxHeader.getValue()); } catch (NumberFormatException ex) { quotaMax = null; } Double quotaRemaining; try { Header quotaRemainingHeader = response.getFirstHeader("x-mws-quota-remaining"); quotaRemaining = quotaRemainingHeader == null ? null : Double.valueOf(quotaRemainingHeader.getValue()); } catch (NumberFormatException ex) { quotaRemaining = null; } Date quotaResetDate; try { Header quotaResetHeader = response.getFirstHeader("x-mws-quota-resetsOn"); quotaResetDate = quotaResetHeader == null ? null : MwsUtl.parseTimestamp(quotaResetHeader.getValue()); } catch (java.text.ParseException ex) { quotaResetDate = null; } return new MwsResponseHeaderMetadata(requestId, context, timestamp, quotaMax, quotaRemaining, quotaResetDate); }
[ "private", "MwsResponseHeaderMetadata", "getResponseHeaderMetadata", "(", "HttpResponse", "response", ")", "{", "Header", "requestIdHeader", "=", "response", ".", "getFirstHeader", "(", "\"x-mws-request-id\"", ")", ";", "String", "requestId", "=", "requestIdHeader", "==",...
Get the metadata from the response headers. @param response @return The metadata.
[ "Get", "the", "metadata", "from", "the", "response", "headers", "." ]
train
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsAQCall.java#L131-L167
alkacon/opencms-core
src/org/opencms/jsp/CmsJspTagUser.java
CmsJspTagUser.userTagAction
public static String userTagAction(String property, ServletRequest req) { CmsFlexController controller = CmsFlexController.getController(req); CmsObject cms = controller.getCmsObject(); CmsUser user = cms.getRequestContext().getCurrentUser(); if (property == null) { property = USER_PROPERTIES[0]; } String result = null; switch (USER_PROPERTIES_LIST.indexOf(property)) { case 0: // name result = user.getName(); break; case 1: // firstname result = user.getFirstname(); break; case 2: // lastname result = user.getLastname(); break; case 3: // email result = user.getEmail(); break; case 4: // street result = user.getAddress(); break; case 5: // zip result = user.getZipcode(); break; case 6: // city result = user.getCity(); break; case 7: // description result = user.getDescription(cms.getRequestContext().getLocale()); break; // following 3 attributes are no longer supported case 8: // group case 9: // currentgroup case 10: // defaultgroup result = ""; break; case 11: // otherstuff Iterator<String> it = user.getAdditionalInfo().keySet().iterator(); CmsMessageContainer msgContainer = Messages.get().container(Messages.GUI_TAG_USER_ADDITIONALINFO_0); result = Messages.getLocalizedMessage(msgContainer, req); while (it.hasNext()) { Object o = it.next(); result += " " + o + "=" + user.getAdditionalInfo((String)o); } break; case 12: // institution result = user.getInstitution(); break; default: msgContainer = Messages.get().container(Messages.GUI_ERR_INVALID_USER_PROP_1, property); result = Messages.getLocalizedMessage(msgContainer, req); } return result; }
java
public static String userTagAction(String property, ServletRequest req) { CmsFlexController controller = CmsFlexController.getController(req); CmsObject cms = controller.getCmsObject(); CmsUser user = cms.getRequestContext().getCurrentUser(); if (property == null) { property = USER_PROPERTIES[0]; } String result = null; switch (USER_PROPERTIES_LIST.indexOf(property)) { case 0: // name result = user.getName(); break; case 1: // firstname result = user.getFirstname(); break; case 2: // lastname result = user.getLastname(); break; case 3: // email result = user.getEmail(); break; case 4: // street result = user.getAddress(); break; case 5: // zip result = user.getZipcode(); break; case 6: // city result = user.getCity(); break; case 7: // description result = user.getDescription(cms.getRequestContext().getLocale()); break; // following 3 attributes are no longer supported case 8: // group case 9: // currentgroup case 10: // defaultgroup result = ""; break; case 11: // otherstuff Iterator<String> it = user.getAdditionalInfo().keySet().iterator(); CmsMessageContainer msgContainer = Messages.get().container(Messages.GUI_TAG_USER_ADDITIONALINFO_0); result = Messages.getLocalizedMessage(msgContainer, req); while (it.hasNext()) { Object o = it.next(); result += " " + o + "=" + user.getAdditionalInfo((String)o); } break; case 12: // institution result = user.getInstitution(); break; default: msgContainer = Messages.get().container(Messages.GUI_ERR_INVALID_USER_PROP_1, property); result = Messages.getLocalizedMessage(msgContainer, req); } return result; }
[ "public", "static", "String", "userTagAction", "(", "String", "property", ",", "ServletRequest", "req", ")", "{", "CmsFlexController", "controller", "=", "CmsFlexController", ".", "getController", "(", "req", ")", ";", "CmsObject", "cms", "=", "controller", ".", ...
Internal action method.<p> @param property the selected user property @param req the current request @return String the value of the selected user property
[ "Internal", "action", "method", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagUser.java#L87-L148
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java
JDBC4DatabaseMetaData.getVersionColumns
@Override public ResultSet getVersionColumns(String catalog, String schema, String table) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
java
@Override public ResultSet getVersionColumns(String catalog, String schema, String table) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
[ "@", "Override", "public", "ResultSet", "getVersionColumns", "(", "String", "catalog", ",", "String", "schema", ",", "String", "table", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "throw", "SQLError", ".", "noSupport", "(", ")", ";", "}...
Retrieves a description of a table's columns that are automatically updated when any value in a row is updated.
[ "Retrieves", "a", "description", "of", "a", "table", "s", "columns", "that", "are", "automatically", "updated", "when", "any", "value", "in", "a", "row", "is", "updated", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java#L926-L931
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java
VirtualNetworkGatewayConnectionsInner.beginResetSharedKeyAsync
public Observable<ConnectionResetSharedKeyInner> beginResetSharedKeyAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, int keyLength) { return beginResetSharedKeyWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, keyLength).map(new Func1<ServiceResponse<ConnectionResetSharedKeyInner>, ConnectionResetSharedKeyInner>() { @Override public ConnectionResetSharedKeyInner call(ServiceResponse<ConnectionResetSharedKeyInner> response) { return response.body(); } }); }
java
public Observable<ConnectionResetSharedKeyInner> beginResetSharedKeyAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, int keyLength) { return beginResetSharedKeyWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, keyLength).map(new Func1<ServiceResponse<ConnectionResetSharedKeyInner>, ConnectionResetSharedKeyInner>() { @Override public ConnectionResetSharedKeyInner call(ServiceResponse<ConnectionResetSharedKeyInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ConnectionResetSharedKeyInner", ">", "beginResetSharedKeyAsync", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayConnectionName", ",", "int", "keyLength", ")", "{", "return", "beginResetSharedKeyWithServiceResponseAsync", "...
The VirtualNetworkGatewayConnectionResetSharedKey operation resets the virtual network gateway connection shared key for passed virtual network gateway connection in the specified resource group through Network resource provider. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayConnectionName The virtual network gateway connection reset shared key Name. @param keyLength The virtual network connection reset shared key length, should between 1 and 128. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ConnectionResetSharedKeyInner object
[ "The", "VirtualNetworkGatewayConnectionResetSharedKey", "operation", "resets", "the", "virtual", "network", "gateway", "connection", "shared", "key", "for", "passed", "virtual", "network", "gateway", "connection", "in", "the", "specified", "resource", "group", "through", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java#L1323-L1330
Stratio/stratio-cassandra
src/java/com/stratio/cassandra/index/schema/analysis/SnowballAnalyzerBuilder.java
SnowballAnalyzerBuilder.buildAnalyzer
private static Analyzer buildAnalyzer(final String language, final CharArraySet stopwords) { return new Analyzer() { protected TokenStreamComponents createComponents(String field, Reader reader) { final Tokenizer source = new StandardTokenizer(reader); TokenStream result = new StandardFilter(source); result = new LowerCaseFilter(result); result = new StopFilter(result, stopwords); result = new SnowballFilter(result, language); return new TokenStreamComponents(source, result); } }; }
java
private static Analyzer buildAnalyzer(final String language, final CharArraySet stopwords) { return new Analyzer() { protected TokenStreamComponents createComponents(String field, Reader reader) { final Tokenizer source = new StandardTokenizer(reader); TokenStream result = new StandardFilter(source); result = new LowerCaseFilter(result); result = new StopFilter(result, stopwords); result = new SnowballFilter(result, language); return new TokenStreamComponents(source, result); } }; }
[ "private", "static", "Analyzer", "buildAnalyzer", "(", "final", "String", "language", ",", "final", "CharArraySet", "stopwords", ")", "{", "return", "new", "Analyzer", "(", ")", "{", "protected", "TokenStreamComponents", "createComponents", "(", "String", "field", ...
Returns the snowball {@link Analyzer} for the specified language and stopwords. @param language The language code. The supported languages are English, French, Spanish, Portuguese, Italian, Romanian, German, Dutch, Swedish, Norwegian, Danish, Russian, Finnish, Irish, Hungarian, Turkish, Armenian, Basque and Catalan. @param stopwords The stop words. @return The snowball {@link Analyzer} for the specified language and stopwords.
[ "Returns", "the", "snowball", "{", "@link", "Analyzer", "}", "for", "the", "specified", "language", "and", "stopwords", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/com/stratio/cassandra/index/schema/analysis/SnowballAnalyzerBuilder.java#L105-L116
jledit/jledit
core/src/main/java/org/jledit/jline/TerminalLineSettings.java
TerminalLineSettings.getProperty
protected static int getProperty(String name, String stty) { // try the first kind of regex Pattern pattern = Pattern.compile(name + "\\s+=\\s+([^;]*)[;\\n\\r]"); Matcher matcher = pattern.matcher(stty); if (!matcher.find()) { // try a second kind of regex pattern = Pattern.compile(name + "\\s+([^;]*)[;\\n\\r]"); matcher = pattern.matcher(stty); if (!matcher.find()) { // try a second try of regex pattern = Pattern.compile("(\\S*)\\s+" + name); matcher = pattern.matcher(stty); if (!matcher.find()) { return -1; } } } return parseControlChar(matcher.group(1)); }
java
protected static int getProperty(String name, String stty) { // try the first kind of regex Pattern pattern = Pattern.compile(name + "\\s+=\\s+([^;]*)[;\\n\\r]"); Matcher matcher = pattern.matcher(stty); if (!matcher.find()) { // try a second kind of regex pattern = Pattern.compile(name + "\\s+([^;]*)[;\\n\\r]"); matcher = pattern.matcher(stty); if (!matcher.find()) { // try a second try of regex pattern = Pattern.compile("(\\S*)\\s+" + name); matcher = pattern.matcher(stty); if (!matcher.find()) { return -1; } } } return parseControlChar(matcher.group(1)); }
[ "protected", "static", "int", "getProperty", "(", "String", "name", ",", "String", "stty", ")", "{", "// try the first kind of regex", "Pattern", "pattern", "=", "Pattern", ".", "compile", "(", "name", "+", "\"\\\\s+=\\\\s+([^;]*)[;\\\\n\\\\r]\"", ")", ";", "Matcher...
<p> Parses a stty output (provided by stty -a) and return the value of a given property. </p> @param name property name. @param stty string resulting of stty -a execution. @return value of the given property.
[ "<p", ">", "Parses", "a", "stty", "output", "(", "provided", "by", "stty", "-", "a", ")", "and", "return", "the", "value", "of", "a", "given", "property", ".", "<", "/", "p", ">" ]
train
https://github.com/jledit/jledit/blob/ced2c4b44330664adb65f8be4c8fff780ccaa6fd/core/src/main/java/org/jledit/jline/TerminalLineSettings.java#L108-L126
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java
PrivacyListManager.updatePrivacyList
public void updatePrivacyList(String listName, List<PrivacyItem> privacyItems) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { // Build the privacy package to add or update the new list Privacy request = new Privacy(); request.setPrivacyList(listName, privacyItems); // Send the package to the server setRequest(request); }
java
public void updatePrivacyList(String listName, List<PrivacyItem> privacyItems) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { // Build the privacy package to add or update the new list Privacy request = new Privacy(); request.setPrivacyList(listName, privacyItems); // Send the package to the server setRequest(request); }
[ "public", "void", "updatePrivacyList", "(", "String", "listName", ",", "List", "<", "PrivacyItem", ">", "privacyItems", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "// Build the privacy p...
The client has edited an existing list. It updates the server content with the resulting list of privacy items. The {@link PrivacyItem} list MUST contain all elements in the list (not the "delta"). @param listName the list that has changed its content. @param privacyItems a List with every privacy item in the list. @throws XMPPErrorException @throws NoResponseException @throws NotConnectedException @throws InterruptedException
[ "The", "client", "has", "edited", "an", "existing", "list", ".", "It", "updates", "the", "server", "content", "with", "the", "resulting", "list", "of", "privacy", "items", ".", "The", "{", "@link", "PrivacyItem", "}", "list", "MUST", "contain", "all", "ele...
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java#L522-L529
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslvserver_binding.java
sslvserver_binding.get
public static sslvserver_binding get(nitro_service service, String vservername) throws Exception{ sslvserver_binding obj = new sslvserver_binding(); obj.set_vservername(vservername); sslvserver_binding response = (sslvserver_binding) obj.get_resource(service); return response; }
java
public static sslvserver_binding get(nitro_service service, String vservername) throws Exception{ sslvserver_binding obj = new sslvserver_binding(); obj.set_vservername(vservername); sslvserver_binding response = (sslvserver_binding) obj.get_resource(service); return response; }
[ "public", "static", "sslvserver_binding", "get", "(", "nitro_service", "service", ",", "String", "vservername", ")", "throws", "Exception", "{", "sslvserver_binding", "obj", "=", "new", "sslvserver_binding", "(", ")", ";", "obj", ".", "set_vservername", "(", "vser...
Use this API to fetch sslvserver_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "sslvserver_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslvserver_binding.java#L136-L141
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/AbstractRegionPainter.java
AbstractRegionPainter.createHorizontalGradient
protected Paint createHorizontalGradient(Shape s, TwoColors colors) { Rectangle2D bounds = s.getBounds2D(); float xMin = (float) bounds.getMinX(); float xMax = (float) bounds.getMaxX(); float yCenter = (float) bounds.getCenterY(); return createGradient(xMin, yCenter, xMax, yCenter, new float[] { 0f, 1f }, new Color[] { colors.top, colors.bottom }); }
java
protected Paint createHorizontalGradient(Shape s, TwoColors colors) { Rectangle2D bounds = s.getBounds2D(); float xMin = (float) bounds.getMinX(); float xMax = (float) bounds.getMaxX(); float yCenter = (float) bounds.getCenterY(); return createGradient(xMin, yCenter, xMax, yCenter, new float[] { 0f, 1f }, new Color[] { colors.top, colors.bottom }); }
[ "protected", "Paint", "createHorizontalGradient", "(", "Shape", "s", ",", "TwoColors", "colors", ")", "{", "Rectangle2D", "bounds", "=", "s", ".", "getBounds2D", "(", ")", ";", "float", "xMin", "=", "(", "float", ")", "bounds", ".", "getMinX", "(", ")", ...
Creates a simple horizontal gradient using the shape for bounds and the colors for top and bottom colors. @param s the shape to use for bounds. @param colors the colors to use for the gradient. @return the gradient.
[ "Creates", "a", "simple", "horizontal", "gradient", "using", "the", "shape", "for", "bounds", "and", "the", "colors", "for", "top", "and", "bottom", "colors", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/AbstractRegionPainter.java#L413-L420
outbrain/ob1k
ob1k-core/src/main/java/com/outbrain/ob1k/server/netty/HttpStaticFileServerHandler.java
HttpStaticFileServerHandler.setDateHeader
private static void setDateHeader(final FullHttpResponse response) { final SimpleDateFormat dateFormatter = new SimpleDateFormat(HTTP_DATE_FORMAT, Locale.US); dateFormatter.setTimeZone(TimeZone.getTimeZone(HTTP_DATE_GMT_TIMEZONE)); final Calendar time = new GregorianCalendar(); response.headers().set(DATE, dateFormatter.format(time.getTime())); }
java
private static void setDateHeader(final FullHttpResponse response) { final SimpleDateFormat dateFormatter = new SimpleDateFormat(HTTP_DATE_FORMAT, Locale.US); dateFormatter.setTimeZone(TimeZone.getTimeZone(HTTP_DATE_GMT_TIMEZONE)); final Calendar time = new GregorianCalendar(); response.headers().set(DATE, dateFormatter.format(time.getTime())); }
[ "private", "static", "void", "setDateHeader", "(", "final", "FullHttpResponse", "response", ")", "{", "final", "SimpleDateFormat", "dateFormatter", "=", "new", "SimpleDateFormat", "(", "HTTP_DATE_FORMAT", ",", "Locale", ".", "US", ")", ";", "dateFormatter", ".", "...
Sets the Date header for the HTTP response @param response HTTP response
[ "Sets", "the", "Date", "header", "for", "the", "HTTP", "response" ]
train
https://github.com/outbrain/ob1k/blob/9e43ab39230c5787065053da0f766d822d0fe4e7/ob1k-core/src/main/java/com/outbrain/ob1k/server/netty/HttpStaticFileServerHandler.java#L213-L219
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.getAttributeFloatWithDefault
@Pure public static Float getAttributeFloatWithDefault(Node document, boolean caseSensitive, Float defaultValue, String... path) { assert document != null : AssertMessages.notNullParameter(0); final String v = getAttributeValue(document, caseSensitive, 0, path); if (v != null) { try { return Float.parseFloat(v); } catch (NumberFormatException e) { // } } return defaultValue; }
java
@Pure public static Float getAttributeFloatWithDefault(Node document, boolean caseSensitive, Float defaultValue, String... path) { assert document != null : AssertMessages.notNullParameter(0); final String v = getAttributeValue(document, caseSensitive, 0, path); if (v != null) { try { return Float.parseFloat(v); } catch (NumberFormatException e) { // } } return defaultValue; }
[ "@", "Pure", "public", "static", "Float", "getAttributeFloatWithDefault", "(", "Node", "document", ",", "boolean", "caseSensitive", ",", "Float", "defaultValue", ",", "String", "...", "path", ")", "{", "assert", "document", "!=", "null", ":", "AssertMessages", "...
Replies the float value that corresponds to the specified attribute's path. <p>The path is an ordered list of tag's names and ended by the name of the attribute. @param document is the XML document to explore. @param caseSensitive indicates of the {@code path}'s components are case sensitive. @param defaultValue is the default value to reply. @param path is the list of and ended by the attribute's name. @return the float value of the specified attribute or <code>null</code> if it was node found in the document
[ "Replies", "the", "float", "value", "that", "corresponds", "to", "the", "specified", "attribute", "s", "path", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L769-L781
jkyamog/DeDS
sample_clients/java/src/main/java/nz/net/catalyst/mobile/dds/sample/DDSClient.java
DDSClient.getCapabilities
public static Map<String, String> getCapabilities(HttpServletRequest request, String ddsUrl) throws IOException { URL url; try { url = new URL(ddsUrl + "/get_capabilities?capability=resolution_width&capability=model_name&capability=xhtml_support_level&" + "headers=" + URLEncoder.encode(jsonEncode(getHeadersAsHashMap(request)), "UTF-8")); } catch (MalformedURLException e) { throw new IOException(e); } String httpResponse = fetchHttpResponse(url); return jsonDecode(httpResponse, new TypeReference<Map<String, String>>() { }); }
java
public static Map<String, String> getCapabilities(HttpServletRequest request, String ddsUrl) throws IOException { URL url; try { url = new URL(ddsUrl + "/get_capabilities?capability=resolution_width&capability=model_name&capability=xhtml_support_level&" + "headers=" + URLEncoder.encode(jsonEncode(getHeadersAsHashMap(request)), "UTF-8")); } catch (MalformedURLException e) { throw new IOException(e); } String httpResponse = fetchHttpResponse(url); return jsonDecode(httpResponse, new TypeReference<Map<String, String>>() { }); }
[ "public", "static", "Map", "<", "String", ",", "String", ">", "getCapabilities", "(", "HttpServletRequest", "request", ",", "String", "ddsUrl", ")", "throws", "IOException", "{", "URL", "url", ";", "try", "{", "url", "=", "new", "URL", "(", "ddsUrl", "+", ...
Get the capabilities as a map of capabilities. There are times that a strict data type is not desirable. Getting it as map provides some flexibility. This does not require any knowledge of what capabilities will be returned by the service. @param request @param ddsUrl @return @throws IOException
[ "Get", "the", "capabilities", "as", "a", "map", "of", "capabilities", ".", "There", "are", "times", "that", "a", "strict", "data", "type", "is", "not", "desirable", ".", "Getting", "it", "as", "map", "provides", "some", "flexibility", ".", "This", "does", ...
train
https://github.com/jkyamog/DeDS/blob/d8cf6a294a23daa8e8a92073827c73b1befe3fa1/sample_clients/java/src/main/java/nz/net/catalyst/mobile/dds/sample/DDSClient.java#L50-L63
CubeEngine/Dirigent
src/main/java/org/cubeengine/dirigent/context/Arguments.java
Arguments.getOrElse
public String getOrElse(String name, String def) { String val = get(name); if (val == null) { return def; } return val; }
java
public String getOrElse(String name, String def) { String val = get(name); if (val == null) { return def; } return val; }
[ "public", "String", "getOrElse", "(", "String", "name", ",", "String", "def", ")", "{", "String", "val", "=", "get", "(", "name", ")", ";", "if", "(", "val", "==", "null", ")", "{", "return", "def", ";", "}", "return", "val", ";", "}" ]
Returns the parameter value for the given name or the given default if not found. @param name the name of the parameter @param def the default value @return the value of the argument by name or the default value.
[ "Returns", "the", "parameter", "value", "for", "the", "given", "name", "or", "the", "given", "default", "if", "not", "found", "." ]
train
https://github.com/CubeEngine/Dirigent/blob/68587a8202754a6a6b629cc15e14c516806badaa/src/main/java/org/cubeengine/dirigent/context/Arguments.java#L88-L96
vincentk/joptimizer
src/main/java/com/joptimizer/util/Utils.java
Utils.calculateScaledResidual
public static double calculateScaledResidual(DoubleMatrix2D A, DoubleMatrix2D X, DoubleMatrix2D B){ double residual = -Double.MAX_VALUE; double niX = Algebra.DEFAULT.normInfinity(X); double niB = Algebra.DEFAULT.normInfinity(B); if(Double.compare(niX, 0.)==0 && Double.compare(niB, 0.)==0){ return 0; }else{ double num = Algebra.DEFAULT.normInfinity(Algebra.DEFAULT.mult(A, X).assign(B, Functions.minus)); double den = Algebra.DEFAULT.normInfinity(A) * niX + niB; residual = num / den; //log.debug("scaled residual: " + residual); return residual; } }
java
public static double calculateScaledResidual(DoubleMatrix2D A, DoubleMatrix2D X, DoubleMatrix2D B){ double residual = -Double.MAX_VALUE; double niX = Algebra.DEFAULT.normInfinity(X); double niB = Algebra.DEFAULT.normInfinity(B); if(Double.compare(niX, 0.)==0 && Double.compare(niB, 0.)==0){ return 0; }else{ double num = Algebra.DEFAULT.normInfinity(Algebra.DEFAULT.mult(A, X).assign(B, Functions.minus)); double den = Algebra.DEFAULT.normInfinity(A) * niX + niB; residual = num / den; //log.debug("scaled residual: " + residual); return residual; } }
[ "public", "static", "double", "calculateScaledResidual", "(", "DoubleMatrix2D", "A", ",", "DoubleMatrix2D", "X", ",", "DoubleMatrix2D", "B", ")", "{", "double", "residual", "=", "-", "Double", ".", "MAX_VALUE", ";", "double", "niX", "=", "Algebra", ".", "DEFAU...
Calculate the scaled residual <br> ||Ax-b||_oo/( ||A||_oo . ||x||_oo + ||b||_oo ), with <br> ||x||_oo = max(||x[i]||)
[ "Calculate", "the", "scaled", "residual", "<br", ">", "||Ax", "-", "b||_oo", "/", "(", "||A||_oo", ".", "||x||_oo", "+", "||b||_oo", ")", "with", "<br", ">", "||x||_oo", "=", "max", "(", "||x", "[", "i", "]", "||", ")" ]
train
https://github.com/vincentk/joptimizer/blob/65064c1bb0b26c7261358021e4c93d06dd43564f/src/main/java/com/joptimizer/util/Utils.java#L113-L127
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java
LocationHelper.modulateCircularIndex
public static int modulateCircularIndex(int index, int seqLength) { // Dummy case if (seqLength == 0) { return index; } // Modulate while (index > seqLength) { index -= seqLength; } return index; }
java
public static int modulateCircularIndex(int index, int seqLength) { // Dummy case if (seqLength == 0) { return index; } // Modulate while (index > seqLength) { index -= seqLength; } return index; }
[ "public", "static", "int", "modulateCircularIndex", "(", "int", "index", ",", "int", "seqLength", ")", "{", "// Dummy case", "if", "(", "seqLength", "==", "0", ")", "{", "return", "index", ";", "}", "// Modulate", "while", "(", "index", ">", "seqLength", "...
Takes a point on a circular location and moves it left until it falls at the earliest possible point that represents the same base. @param index Index of the position to work with @param seqLength Length of the Sequence @return The shifted point
[ "Takes", "a", "point", "on", "a", "circular", "location", "and", "moves", "it", "left", "until", "it", "falls", "at", "the", "earliest", "possible", "point", "that", "represents", "the", "same", "base", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java#L226-L236
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java
DatabasesInner.getAsync
public Observable<DatabaseInner> getAsync(String resourceGroupName, String serverName, String databaseName, String expand) { return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, expand).map(new Func1<ServiceResponse<DatabaseInner>, DatabaseInner>() { @Override public DatabaseInner call(ServiceResponse<DatabaseInner> response) { return response.body(); } }); }
java
public Observable<DatabaseInner> getAsync(String resourceGroupName, String serverName, String databaseName, String expand) { return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, expand).map(new Func1<ServiceResponse<DatabaseInner>, DatabaseInner>() { @Override public DatabaseInner call(ServiceResponse<DatabaseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DatabaseInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "String", "expand", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", ...
Gets a database. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database to be retrieved. @param expand A comma separated list of child objects to expand in the response. Possible properties: serviceTierAdvisors, transparentDataEncryption. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DatabaseInner object
[ "Gets", "a", "database", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java#L1089-L1096
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/datagrid/ImageAnchorCell.java
ImageAnchorCell.addParameter
public void addParameter(String name, Object value, String facet) throws JspException { ParamHelper.addParam(_imageAnchorCellModel.getParams(), name, value); }
java
public void addParameter(String name, Object value, String facet) throws JspException { ParamHelper.addParam(_imageAnchorCellModel.getParams(), name, value); }
[ "public", "void", "addParameter", "(", "String", "name", ",", "Object", "value", ",", "String", "facet", ")", "throws", "JspException", "{", "ParamHelper", ".", "addParam", "(", "_imageAnchorCellModel", ".", "getParams", "(", ")", ",", "name", ",", "value", ...
<p> Implementation of the {@link IUrlParams} interface. This allows this tag to accept &lt;netui:parameter&gt; and &lt;netui:parameterMap&gt; in order to add URL parameters onto the rendered anchor. For example: <pre> <netui-data:imageAnchorCell href="foo.jsp" src="foo.png"> <netui:parameter name="paramKey" value="paramValue"/> </netui-data:anchorCell> </pre> will render an HTML image anchor as: <pre> <a href="foo.jsp?paramKey=paramValue><img src="foo.png"/></a> </pre> </p> @param name the name of the parameter @param value the value of the parameter @param facet the facet for the parameter @throws JspException thrown when the facet is unsupported
[ "<p", ">", "Implementation", "of", "the", "{" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/datagrid/ImageAnchorCell.java#L657-L660