repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
apache/incubator-shardingsphere
sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/api/yaml/YamlMasterSlaveDataSourceFactory.java
YamlMasterSlaveDataSourceFactory.createDataSource
public static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final File yamlFile) throws SQLException, IOException { """ Create master-slave data source. @param dataSourceMap data source map @param yamlFile YAML file for master-slave rule configuration without data sources @return master-slave data source @throws SQLException SQL exception @throws IOException IO exception """ YamlRootMasterSlaveConfiguration config = YamlEngine.unmarshal(yamlFile, YamlRootMasterSlaveConfiguration.class); return MasterSlaveDataSourceFactory.createDataSource(dataSourceMap, new MasterSlaveRuleConfigurationYamlSwapper().swap(config.getMasterSlaveRule()), config.getProps()); }
java
public static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final File yamlFile) throws SQLException, IOException { YamlRootMasterSlaveConfiguration config = YamlEngine.unmarshal(yamlFile, YamlRootMasterSlaveConfiguration.class); return MasterSlaveDataSourceFactory.createDataSource(dataSourceMap, new MasterSlaveRuleConfigurationYamlSwapper().swap(config.getMasterSlaveRule()), config.getProps()); }
[ "public", "static", "DataSource", "createDataSource", "(", "final", "Map", "<", "String", ",", "DataSource", ">", "dataSourceMap", ",", "final", "File", "yamlFile", ")", "throws", "SQLException", ",", "IOException", "{", "YamlRootMasterSlaveConfiguration", "config", ...
Create master-slave data source. @param dataSourceMap data source map @param yamlFile YAML file for master-slave rule configuration without data sources @return master-slave data source @throws SQLException SQL exception @throws IOException IO exception
[ "Create", "master", "-", "slave", "data", "source", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/api/yaml/YamlMasterSlaveDataSourceFactory.java#L76-L79
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/AvroFlattener.java
AvroFlattener.flattenRecord
private Schema flattenRecord(Schema schema, boolean shouldPopulateLineage, boolean flattenComplexTypes) { """ * Flatten Record schema @param schema Record Schema to flatten @param shouldPopulateLineage If lineage information should be tagged in the field, this is true when we are un-nesting fields @param flattenComplexTypes Flatten complex types recursively other than Record and Option @return Flattened Record Schema """ Preconditions.checkNotNull(schema); Preconditions.checkArgument(Schema.Type.RECORD.equals(schema.getType())); Schema flattenedSchema; List<Schema.Field> flattenedFields = new ArrayList<>(); if (schema.getFields().size() > 0) { for (Schema.Field oldField : schema.getFields()) { List<Schema.Field> newFields = flattenField(oldField, ImmutableList.<String>of(), shouldPopulateLineage, flattenComplexTypes, Optional.<Schema>absent()); if (null != newFields && newFields.size() > 0) { flattenedFields.addAll(newFields); } } } flattenedSchema = Schema.createRecord(schema.getName(), schema.getDoc(), schema.getNamespace(), schema.isError()); flattenedSchema.setFields(flattenedFields); return flattenedSchema; }
java
private Schema flattenRecord(Schema schema, boolean shouldPopulateLineage, boolean flattenComplexTypes) { Preconditions.checkNotNull(schema); Preconditions.checkArgument(Schema.Type.RECORD.equals(schema.getType())); Schema flattenedSchema; List<Schema.Field> flattenedFields = new ArrayList<>(); if (schema.getFields().size() > 0) { for (Schema.Field oldField : schema.getFields()) { List<Schema.Field> newFields = flattenField(oldField, ImmutableList.<String>of(), shouldPopulateLineage, flattenComplexTypes, Optional.<Schema>absent()); if (null != newFields && newFields.size() > 0) { flattenedFields.addAll(newFields); } } } flattenedSchema = Schema.createRecord(schema.getName(), schema.getDoc(), schema.getNamespace(), schema.isError()); flattenedSchema.setFields(flattenedFields); return flattenedSchema; }
[ "private", "Schema", "flattenRecord", "(", "Schema", "schema", ",", "boolean", "shouldPopulateLineage", ",", "boolean", "flattenComplexTypes", ")", "{", "Preconditions", ".", "checkNotNull", "(", "schema", ")", ";", "Preconditions", ".", "checkArgument", "(", "Schem...
* Flatten Record schema @param schema Record Schema to flatten @param shouldPopulateLineage If lineage information should be tagged in the field, this is true when we are un-nesting fields @param flattenComplexTypes Flatten complex types recursively other than Record and Option @return Flattened Record Schema
[ "*", "Flatten", "Record", "schema" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/AvroFlattener.java#L239-L261
JOML-CI/JOML
src/org/joml/Matrix4d.java
Matrix4d.setFrustumLH
public Matrix4d setFrustumLH(double left, double right, double bottom, double top, double zNear, double zFar, boolean zZeroToOne) { """ Set this matrix to be an arbitrary perspective projection frustum transformation for a left-handed coordinate system using OpenGL's NDC z range of <code>[-1..+1]</code>. <p> In order to apply the perspective frustum transformation to an existing transformation, use {@link #frustumLH(double, double, double, double, double, double, boolean) frustumLH()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#perspective">http://www.songho.ca</a> @see #frustumLH(double, double, double, double, double, double, boolean) @param left the distance along the x-axis to the left frustum edge @param right the distance along the x-axis to the right frustum edge @param bottom the distance along the y-axis to the bottom frustum edge @param top the distance along the y-axis to the top frustum edge @param zNear near clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity. In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}. @param zFar far clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity. In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}. @param zZeroToOne whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code> or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code> @return this """ if ((properties & PROPERTY_IDENTITY) == 0) _identity(); m00 = (zNear + zNear) / (right - left); m11 = (zNear + zNear) / (top - bottom); m20 = (right + left) / (right - left); m21 = (top + bottom) / (top - bottom); boolean farInf = zFar > 0 && Double.isInfinite(zFar); boolean nearInf = zNear > 0 && Double.isInfinite(zNear); if (farInf) { // See: "Infinite Projection Matrix" (http://www.terathon.com/gdc07_lengyel.pdf) double e = 1E-6; m22 = 1.0 - e; m32 = (e - (zZeroToOne ? 1.0 : 2.0)) * zNear; } else if (nearInf) { double e = 1E-6; m22 = (zZeroToOne ? 0.0 : 1.0) - e; m32 = ((zZeroToOne ? 1.0 : 2.0) - e) * zFar; } else { m22 = (zZeroToOne ? zFar : zFar + zNear) / (zFar - zNear); m32 = (zZeroToOne ? zFar : zFar + zFar) * zNear / (zNear - zFar); } m23 = 1.0; m33 = 0.0; properties = this.m20 == 0.0 && this.m21 == 0.0 ? PROPERTY_PERSPECTIVE : 0; return this; }
java
public Matrix4d setFrustumLH(double left, double right, double bottom, double top, double zNear, double zFar, boolean zZeroToOne) { if ((properties & PROPERTY_IDENTITY) == 0) _identity(); m00 = (zNear + zNear) / (right - left); m11 = (zNear + zNear) / (top - bottom); m20 = (right + left) / (right - left); m21 = (top + bottom) / (top - bottom); boolean farInf = zFar > 0 && Double.isInfinite(zFar); boolean nearInf = zNear > 0 && Double.isInfinite(zNear); if (farInf) { // See: "Infinite Projection Matrix" (http://www.terathon.com/gdc07_lengyel.pdf) double e = 1E-6; m22 = 1.0 - e; m32 = (e - (zZeroToOne ? 1.0 : 2.0)) * zNear; } else if (nearInf) { double e = 1E-6; m22 = (zZeroToOne ? 0.0 : 1.0) - e; m32 = ((zZeroToOne ? 1.0 : 2.0) - e) * zFar; } else { m22 = (zZeroToOne ? zFar : zFar + zNear) / (zFar - zNear); m32 = (zZeroToOne ? zFar : zFar + zFar) * zNear / (zNear - zFar); } m23 = 1.0; m33 = 0.0; properties = this.m20 == 0.0 && this.m21 == 0.0 ? PROPERTY_PERSPECTIVE : 0; return this; }
[ "public", "Matrix4d", "setFrustumLH", "(", "double", "left", ",", "double", "right", ",", "double", "bottom", ",", "double", "top", ",", "double", "zNear", ",", "double", "zFar", ",", "boolean", "zZeroToOne", ")", "{", "if", "(", "(", "properties", "&", ...
Set this matrix to be an arbitrary perspective projection frustum transformation for a left-handed coordinate system using OpenGL's NDC z range of <code>[-1..+1]</code>. <p> In order to apply the perspective frustum transformation to an existing transformation, use {@link #frustumLH(double, double, double, double, double, double, boolean) frustumLH()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#perspective">http://www.songho.ca</a> @see #frustumLH(double, double, double, double, double, double, boolean) @param left the distance along the x-axis to the left frustum edge @param right the distance along the x-axis to the right frustum edge @param bottom the distance along the y-axis to the bottom frustum edge @param top the distance along the y-axis to the top frustum edge @param zNear near clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity. In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}. @param zFar far clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity. In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}. @param zZeroToOne whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code> or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code> @return this
[ "Set", "this", "matrix", "to", "be", "an", "arbitrary", "perspective", "projection", "frustum", "transformation", "for", "a", "left", "-", "handed", "coordinate", "system", "using", "OpenGL", "s", "NDC", "z", "range", "of", "<code", ">", "[", "-", "1", ".....
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L13600-L13626
codeprimate-software/cp-elements
src/main/java/org/cp/elements/io/FileSystemUtils.java
FileSystemUtils.appendToPath
public static String appendToPath(String basePath, String... pathElements) { """ Creates a file system path by appending the array of path elements to the base path separated by {@link File#separator}. If the array of path elements is null or empty then base path is returned. @param basePath base of the file system path expressed as a pathname {@link String}. @param pathElements array of path elements to append to the base path. @return the path elements appended to the base path separated by {@link File#separator}. @throws NullPointerException if basePath is null. @see java.io.File#separator """ Assert.notNull(basePath, "basePath cannot be null"); String fileSeparator = (SystemUtils.isWindows() ? WINDOWS_FILE_SEPARATOR : File.separator); for (String pathElement : ArrayUtils.nullSafeArray(pathElements, String.class)) { if (StringUtils.hasText(pathElement)) { basePath = String.format("%1$s%2$s%3$s", basePath.trim(), fileSeparator, pathElement.trim()); } } String fileSeparatorPattern = (SystemUtils.isWindows() ? WINDOWS_FILE_SEPARATOR_PATTERN : UNIX_FILE_SEPARATOR_PATTERN); return basePath.trim().replaceAll(fileSeparatorPattern, fileSeparator); }
java
public static String appendToPath(String basePath, String... pathElements) { Assert.notNull(basePath, "basePath cannot be null"); String fileSeparator = (SystemUtils.isWindows() ? WINDOWS_FILE_SEPARATOR : File.separator); for (String pathElement : ArrayUtils.nullSafeArray(pathElements, String.class)) { if (StringUtils.hasText(pathElement)) { basePath = String.format("%1$s%2$s%3$s", basePath.trim(), fileSeparator, pathElement.trim()); } } String fileSeparatorPattern = (SystemUtils.isWindows() ? WINDOWS_FILE_SEPARATOR_PATTERN : UNIX_FILE_SEPARATOR_PATTERN); return basePath.trim().replaceAll(fileSeparatorPattern, fileSeparator); }
[ "public", "static", "String", "appendToPath", "(", "String", "basePath", ",", "String", "...", "pathElements", ")", "{", "Assert", ".", "notNull", "(", "basePath", ",", "\"basePath cannot be null\"", ")", ";", "String", "fileSeparator", "=", "(", "SystemUtils", ...
Creates a file system path by appending the array of path elements to the base path separated by {@link File#separator}. If the array of path elements is null or empty then base path is returned. @param basePath base of the file system path expressed as a pathname {@link String}. @param pathElements array of path elements to append to the base path. @return the path elements appended to the base path separated by {@link File#separator}. @throws NullPointerException if basePath is null. @see java.io.File#separator
[ "Creates", "a", "file", "system", "path", "by", "appending", "the", "array", "of", "path", "elements", "to", "the", "base", "path", "separated", "by", "{", "@link", "File#separator", "}", ".", "If", "the", "array", "of", "path", "elements", "is", "null", ...
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/io/FileSystemUtils.java#L72-L87
ysc/word
src/main/java/org/apdplat/word/recognition/RecognitionTool.java
RecognitionTool.recog
public static boolean recog(final String text, final int start, final int len) { """ 识别文本(英文单词、数字、时间等) @param text 识别文本 @param start 待识别文本开始索引 @param len 识别长度 @return 是否识别 """ if(!RECOGNITION_TOOL_ENABLED){ return false; } return isEnglishAndNumberMix(text, start, len) || isFraction(text, start, len) || isQuantifier(text, start, len) || isChineseNumber(text, start, len); }
java
public static boolean recog(final String text, final int start, final int len){ if(!RECOGNITION_TOOL_ENABLED){ return false; } return isEnglishAndNumberMix(text, start, len) || isFraction(text, start, len) || isQuantifier(text, start, len) || isChineseNumber(text, start, len); }
[ "public", "static", "boolean", "recog", "(", "final", "String", "text", ",", "final", "int", "start", ",", "final", "int", "len", ")", "{", "if", "(", "!", "RECOGNITION_TOOL_ENABLED", ")", "{", "return", "false", ";", "}", "return", "isEnglishAndNumberMix", ...
识别文本(英文单词、数字、时间等) @param text 识别文本 @param start 待识别文本开始索引 @param len 识别长度 @return 是否识别
[ "识别文本(英文单词、数字、时间等)" ]
train
https://github.com/ysc/word/blob/5e45607f4e97207f55d1e3bc561abda6b34f7c54/src/main/java/org/apdplat/word/recognition/RecognitionTool.java#L51-L59
maven-nar/nar-maven-plugin
src/main/java/com/github/maven_nar/cpptasks/apple/XcodeProjectWriter.java
XcodeProjectWriter.addSources
private List<PBXObjectRef> addSources(final Map objects, final String sourceTree, final String basePath, final Map<String, TargetInfo> targets) { """ Add file references for all source files to map of objects. @param objects map of objects. @param sourceTree source tree. @param basePath parent of XCode project dir @param targets build targets. @return list containing file references of source files. """ final List<PBXObjectRef> sourceGroupChildren = new ArrayList<>(); final List<File> sourceList = new ArrayList<>(targets.size()); for (final TargetInfo info : targets.values()) { final File[] targetsources = info.getSources(); Collections.addAll(sourceList, targetsources); } final File[] sortedSources = sourceList.toArray(new File[sourceList.size()]); Arrays.sort(sortedSources, new Comparator<File>() { @Override public int compare(final File o1, final File o2) { return o1.getName().compareTo(o2.getName()); } }); for (final File sortedSource : sortedSources) { final PBXObjectRef fileRef = createPBXFileReference(sourceTree, basePath, sortedSource); sourceGroupChildren.add(fileRef); objects.put(fileRef.getID(), fileRef.getProperties()); } return sourceGroupChildren; }
java
private List<PBXObjectRef> addSources(final Map objects, final String sourceTree, final String basePath, final Map<String, TargetInfo> targets) { final List<PBXObjectRef> sourceGroupChildren = new ArrayList<>(); final List<File> sourceList = new ArrayList<>(targets.size()); for (final TargetInfo info : targets.values()) { final File[] targetsources = info.getSources(); Collections.addAll(sourceList, targetsources); } final File[] sortedSources = sourceList.toArray(new File[sourceList.size()]); Arrays.sort(sortedSources, new Comparator<File>() { @Override public int compare(final File o1, final File o2) { return o1.getName().compareTo(o2.getName()); } }); for (final File sortedSource : sortedSources) { final PBXObjectRef fileRef = createPBXFileReference(sourceTree, basePath, sortedSource); sourceGroupChildren.add(fileRef); objects.put(fileRef.getID(), fileRef.getProperties()); } return sourceGroupChildren; }
[ "private", "List", "<", "PBXObjectRef", ">", "addSources", "(", "final", "Map", "objects", ",", "final", "String", "sourceTree", ",", "final", "String", "basePath", ",", "final", "Map", "<", "String", ",", "TargetInfo", ">", "targets", ")", "{", "final", "...
Add file references for all source files to map of objects. @param objects map of objects. @param sourceTree source tree. @param basePath parent of XCode project dir @param targets build targets. @return list containing file references of source files.
[ "Add", "file", "references", "for", "all", "source", "files", "to", "map", "of", "objects", "." ]
train
https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/apple/XcodeProjectWriter.java#L759-L782
VoltDB/voltdb
third_party/java/src/org/HdrHistogram_voltpatches/DoubleHistogram.java
DoubleHistogram.decodeFromCompressedByteBuffer
public static DoubleHistogram decodeFromCompressedByteBuffer( final ByteBuffer buffer, final long minBarForHighestToLowestValueRatio) throws DataFormatException { """ Construct a new DoubleHistogram by decoding it from a compressed form in a ByteBuffer. @param buffer The buffer to decode from @param minBarForHighestToLowestValueRatio Force highestTrackableValue to be set at least this high @return The newly constructed DoubleHistogram @throws DataFormatException on error parsing/decompressing the buffer """ return decodeFromCompressedByteBuffer(buffer, Histogram.class, minBarForHighestToLowestValueRatio); }
java
public static DoubleHistogram decodeFromCompressedByteBuffer( final ByteBuffer buffer, final long minBarForHighestToLowestValueRatio) throws DataFormatException { return decodeFromCompressedByteBuffer(buffer, Histogram.class, minBarForHighestToLowestValueRatio); }
[ "public", "static", "DoubleHistogram", "decodeFromCompressedByteBuffer", "(", "final", "ByteBuffer", "buffer", ",", "final", "long", "minBarForHighestToLowestValueRatio", ")", "throws", "DataFormatException", "{", "return", "decodeFromCompressedByteBuffer", "(", "buffer", ","...
Construct a new DoubleHistogram by decoding it from a compressed form in a ByteBuffer. @param buffer The buffer to decode from @param minBarForHighestToLowestValueRatio Force highestTrackableValue to be set at least this high @return The newly constructed DoubleHistogram @throws DataFormatException on error parsing/decompressing the buffer
[ "Construct", "a", "new", "DoubleHistogram", "by", "decoding", "it", "from", "a", "compressed", "form", "in", "a", "ByteBuffer", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/HdrHistogram_voltpatches/DoubleHistogram.java#L1529-L1533
jenkinsci/github-plugin
src/main/java/org/jenkinsci/plugins/github/util/FluentIterableWrapper.java
FluentIterableWrapper.append
@CheckReturnValue public final FluentIterableWrapper<E> append(Iterable<? extends E> other) { """ Returns a fluent iterable whose iterators traverse first the elements of this fluent iterable, followed by those of {@code other}. The iterators are not polled until necessary. <p>The returned iterable's {@code Iterator} supports {@code remove()} when the corresponding {@code Iterator} supports it. """ return from(Iterables.concat(iterable, other)); }
java
@CheckReturnValue public final FluentIterableWrapper<E> append(Iterable<? extends E> other) { return from(Iterables.concat(iterable, other)); }
[ "@", "CheckReturnValue", "public", "final", "FluentIterableWrapper", "<", "E", ">", "append", "(", "Iterable", "<", "?", "extends", "E", ">", "other", ")", "{", "return", "from", "(", "Iterables", ".", "concat", "(", "iterable", ",", "other", ")", ")", "...
Returns a fluent iterable whose iterators traverse first the elements of this fluent iterable, followed by those of {@code other}. The iterators are not polled until necessary. <p>The returned iterable's {@code Iterator} supports {@code remove()} when the corresponding {@code Iterator} supports it.
[ "Returns", "a", "fluent", "iterable", "whose", "iterators", "traverse", "first", "the", "elements", "of", "this", "fluent", "iterable", "followed", "by", "those", "of", "{", "@code", "other", "}", ".", "The", "iterators", "are", "not", "polled", "until", "ne...
train
https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/util/FluentIterableWrapper.java#L68-L71
alkacon/opencms-core
src/org/opencms/workplace/CmsDialog.java
CmsDialog.checkResourcePermissions
protected boolean checkResourcePermissions(CmsPermissionSet required, boolean neededForFolder) { """ Checks if the permissions of the current user on the resource to use in the dialog are sufficient.<p> Automatically generates a CmsMessageContainer object with an error message and stores it in the users session.<p> @param required the required permissions for the dialog @param neededForFolder if true, the permissions are required for the parent folder of the resource (e.g. for editors) @return true if the permissions are sufficient, otherwise false """ return checkResourcePermissions( required, neededForFolder, Messages.get().container( Messages.GUI_ERR_RESOURCE_PERMISSIONS_2, getParamResource(), required.getPermissionString())); }
java
protected boolean checkResourcePermissions(CmsPermissionSet required, boolean neededForFolder) { return checkResourcePermissions( required, neededForFolder, Messages.get().container( Messages.GUI_ERR_RESOURCE_PERMISSIONS_2, getParamResource(), required.getPermissionString())); }
[ "protected", "boolean", "checkResourcePermissions", "(", "CmsPermissionSet", "required", ",", "boolean", "neededForFolder", ")", "{", "return", "checkResourcePermissions", "(", "required", ",", "neededForFolder", ",", "Messages", ".", "get", "(", ")", ".", "container"...
Checks if the permissions of the current user on the resource to use in the dialog are sufficient.<p> Automatically generates a CmsMessageContainer object with an error message and stores it in the users session.<p> @param required the required permissions for the dialog @param neededForFolder if true, the permissions are required for the parent folder of the resource (e.g. for editors) @return true if the permissions are sufficient, otherwise false
[ "Checks", "if", "the", "permissions", "of", "the", "current", "user", "on", "the", "resource", "to", "use", "in", "the", "dialog", "are", "sufficient", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsDialog.java#L1691-L1700
tipsy/javalin
src/main/java/io/javalin/Javalin.java
Javalin.wsAfter
public Javalin wsAfter(@NotNull String path, @NotNull Consumer<WsHandler> wsHandler) { """ Adds a WebSocket after handler for the specified path to the instance. """ return addWsHandler(WsHandlerType.WS_AFTER, path, wsHandler); }
java
public Javalin wsAfter(@NotNull String path, @NotNull Consumer<WsHandler> wsHandler) { return addWsHandler(WsHandlerType.WS_AFTER, path, wsHandler); }
[ "public", "Javalin", "wsAfter", "(", "@", "NotNull", "String", "path", ",", "@", "NotNull", "Consumer", "<", "WsHandler", ">", "wsHandler", ")", "{", "return", "addWsHandler", "(", "WsHandlerType", ".", "WS_AFTER", ",", "path", ",", "wsHandler", ")", ";", ...
Adds a WebSocket after handler for the specified path to the instance.
[ "Adds", "a", "WebSocket", "after", "handler", "for", "the", "specified", "path", "to", "the", "instance", "." ]
train
https://github.com/tipsy/javalin/blob/68b2f7592f237db1c2b597e645697eb75fdaee53/src/main/java/io/javalin/Javalin.java#L555-L557
jronrun/benayn
benayn-ustyle/src/main/java/com/benayn/ustyle/Objects2.java
Objects2.defaultTostring
public static String defaultTostring(Object input, Object... appends) { """ Returns the default {@link Object#toString()} result @see Object#toString() @param input @return """ if (null == input) { return NULL_STR; } StringBuilder bul = new StringBuilder(input.getClass().getName()); bul.append("@").append(Integer.toHexString(input.hashCode())); for (Object a : appends) { bul.append(null != a ? a.toString() : NULL_STR); } return bul.toString(); }
java
public static String defaultTostring(Object input, Object... appends) { if (null == input) { return NULL_STR; } StringBuilder bul = new StringBuilder(input.getClass().getName()); bul.append("@").append(Integer.toHexString(input.hashCode())); for (Object a : appends) { bul.append(null != a ? a.toString() : NULL_STR); } return bul.toString(); }
[ "public", "static", "String", "defaultTostring", "(", "Object", "input", ",", "Object", "...", "appends", ")", "{", "if", "(", "null", "==", "input", ")", "{", "return", "NULL_STR", ";", "}", "StringBuilder", "bul", "=", "new", "StringBuilder", "(", "input...
Returns the default {@link Object#toString()} result @see Object#toString() @param input @return
[ "Returns", "the", "default", "{", "@link", "Object#toString", "()", "}", "result" ]
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/Objects2.java#L121-L129
h2oai/h2o-3
h2o-core/src/main/java/water/parser/ParseSetup.java
ParseSetup.guessSetup
public static ParseSetup guessSetup(Key[] fkeys, boolean singleQuote, int checkHeader) { """ Used by test harnesses for simple parsing of test data. Presumes auto-detection for file and separator types. @param fkeys Keys to input vectors to be parsed @param singleQuote single quotes quote fields @param checkHeader check for a header @return ParseSetup settings from looking at all files """ return guessSetup(fkeys, new ParseSetup(GUESS_INFO, GUESS_SEP, singleQuote, checkHeader, GUESS_COL_CNT, null, new ParseWriter.ParseErr[0])); }
java
public static ParseSetup guessSetup(Key[] fkeys, boolean singleQuote, int checkHeader) { return guessSetup(fkeys, new ParseSetup(GUESS_INFO, GUESS_SEP, singleQuote, checkHeader, GUESS_COL_CNT, null, new ParseWriter.ParseErr[0])); }
[ "public", "static", "ParseSetup", "guessSetup", "(", "Key", "[", "]", "fkeys", ",", "boolean", "singleQuote", ",", "int", "checkHeader", ")", "{", "return", "guessSetup", "(", "fkeys", ",", "new", "ParseSetup", "(", "GUESS_INFO", ",", "GUESS_SEP", ",", "sing...
Used by test harnesses for simple parsing of test data. Presumes auto-detection for file and separator types. @param fkeys Keys to input vectors to be parsed @param singleQuote single quotes quote fields @param checkHeader check for a header @return ParseSetup settings from looking at all files
[ "Used", "by", "test", "harnesses", "for", "simple", "parsing", "of", "test", "data", ".", "Presumes", "auto", "-", "detection", "for", "file", "and", "separator", "types", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/parser/ParseSetup.java#L336-L338
igniterealtime/Smack
smack-core/src/main/java/org/jivesoftware/smack/util/Async.java
Async.go
public static Thread go(Runnable runnable, String threadName) { """ Creates a new thread with the given Runnable, marks it daemon, sets the name, starts it and returns the started thread. @param runnable @param threadName the thread name. @return the started thread. """ Thread thread = daemonThreadFrom(runnable); thread.setName(threadName); thread.start(); return thread; }
java
public static Thread go(Runnable runnable, String threadName) { Thread thread = daemonThreadFrom(runnable); thread.setName(threadName); thread.start(); return thread; }
[ "public", "static", "Thread", "go", "(", "Runnable", "runnable", ",", "String", "threadName", ")", "{", "Thread", "thread", "=", "daemonThreadFrom", "(", "runnable", ")", ";", "thread", ".", "setName", "(", "threadName", ")", ";", "thread", ".", "start", "...
Creates a new thread with the given Runnable, marks it daemon, sets the name, starts it and returns the started thread. @param runnable @param threadName the thread name. @return the started thread.
[ "Creates", "a", "new", "thread", "with", "the", "given", "Runnable", "marks", "it", "daemon", "sets", "the", "name", "starts", "it", "and", "returns", "the", "started", "thread", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/Async.java#L44-L49
santhosh-tekuri/jlibs
core/src/main/java/jlibs/core/net/URLUtil.java
URLUtil.getQueryParams
public static Map<String, String> getQueryParams(String uri, String encoding) throws URISyntaxException, UnsupportedEncodingException { """ returns Query Parameters in specified uri as <code>Map</code>. key will be param name and value wil be param value. @param uri The string to be parsed into a URI @param encoding if null, <code>UTF-8</code> will be used @throws URISyntaxException in case of invalid uri @throws UnsupportedEncodingException if named character encoding is not supported """ if(encoding==null) encoding = IOUtil.UTF_8.name(); String query = new URI(uri).getRawQuery(); Map<String, String> map = new HashMap<String, String>(); StringTokenizer params = new StringTokenizer(query, "&;"); while(params.hasMoreTokens()){ String param = params.nextToken(); int equal = param.indexOf('='); String name = param.substring(0, equal); String value = param.substring(equal+1); name = URLDecoder.decode(name, encoding); value = URLDecoder.decode(value, encoding); map.put(name, value); } return map; }
java
public static Map<String, String> getQueryParams(String uri, String encoding) throws URISyntaxException, UnsupportedEncodingException{ if(encoding==null) encoding = IOUtil.UTF_8.name(); String query = new URI(uri).getRawQuery(); Map<String, String> map = new HashMap<String, String>(); StringTokenizer params = new StringTokenizer(query, "&;"); while(params.hasMoreTokens()){ String param = params.nextToken(); int equal = param.indexOf('='); String name = param.substring(0, equal); String value = param.substring(equal+1); name = URLDecoder.decode(name, encoding); value = URLDecoder.decode(value, encoding); map.put(name, value); } return map; }
[ "public", "static", "Map", "<", "String", ",", "String", ">", "getQueryParams", "(", "String", "uri", ",", "String", "encoding", ")", "throws", "URISyntaxException", ",", "UnsupportedEncodingException", "{", "if", "(", "encoding", "==", "null", ")", "encoding", ...
returns Query Parameters in specified uri as <code>Map</code>. key will be param name and value wil be param value. @param uri The string to be parsed into a URI @param encoding if null, <code>UTF-8</code> will be used @throws URISyntaxException in case of invalid uri @throws UnsupportedEncodingException if named character encoding is not supported
[ "returns", "Query", "Parameters", "in", "specified", "uri", "as", "<code", ">", "Map<", "/", "code", ">", ".", "key", "will", "be", "param", "name", "and", "value", "wil", "be", "param", "value", "." ]
train
https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/net/URLUtil.java#L110-L127
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/subdoc/MutateInBuilder.java
MutateInBuilder.upsert
@Deprecated public <T> MutateInBuilder upsert(String path, T fragment, boolean createPath) { """ Insert a fragment, replacing the old value if the path exists. @param path the path where to insert (or replace) a dictionary value. @param fragment the new dictionary value to be applied. @param createPath true to create missing intermediary nodes. """ asyncBuilder.upsert(path, fragment, new SubdocOptionsBuilder().createPath(createPath)); return this; }
java
@Deprecated public <T> MutateInBuilder upsert(String path, T fragment, boolean createPath) { asyncBuilder.upsert(path, fragment, new SubdocOptionsBuilder().createPath(createPath)); return this; }
[ "@", "Deprecated", "public", "<", "T", ">", "MutateInBuilder", "upsert", "(", "String", "path", ",", "T", "fragment", ",", "boolean", "createPath", ")", "{", "asyncBuilder", ".", "upsert", "(", "path", ",", "fragment", ",", "new", "SubdocOptionsBuilder", "("...
Insert a fragment, replacing the old value if the path exists. @param path the path where to insert (or replace) a dictionary value. @param fragment the new dictionary value to be applied. @param createPath true to create missing intermediary nodes.
[ "Insert", "a", "fragment", "replacing", "the", "old", "value", "if", "the", "path", "exists", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/MutateInBuilder.java#L578-L582
di2e/Argo
clui/src/main/java/net/dharwin/common/tools/cli/api/CLIContext.java
CLIContext.getInteger
public int getInteger(String key, int defaultValue) { """ Get the integer value, or the defaultValue if not found. @param key The key to search for. @param defaultValue the default value @return The value, or defaultValue if not found. """ Object o = getObject(key); if (o == null) { return defaultValue; } int val = defaultValue; try { val = Integer.parseInt(o.toString()); } catch (Exception e) { throw new IllegalArgumentException("Object ["+o+"] associated with key ["+key+"] is not of type Integer."); } return val; }
java
public int getInteger(String key, int defaultValue) { Object o = getObject(key); if (o == null) { return defaultValue; } int val = defaultValue; try { val = Integer.parseInt(o.toString()); } catch (Exception e) { throw new IllegalArgumentException("Object ["+o+"] associated with key ["+key+"] is not of type Integer."); } return val; }
[ "public", "int", "getInteger", "(", "String", "key", ",", "int", "defaultValue", ")", "{", "Object", "o", "=", "getObject", "(", "key", ")", ";", "if", "(", "o", "==", "null", ")", "{", "return", "defaultValue", ";", "}", "int", "val", "=", "defaultV...
Get the integer value, or the defaultValue if not found. @param key The key to search for. @param defaultValue the default value @return The value, or defaultValue if not found.
[ "Get", "the", "integer", "value", "or", "the", "defaultValue", "if", "not", "found", "." ]
train
https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/clui/src/main/java/net/dharwin/common/tools/cli/api/CLIContext.java#L212-L225
alkacon/opencms-core
src/org/opencms/main/CmsSingleThreadDumperThread.java
CmsSingleThreadDumperThread.saveSummaryXml
private void saveSummaryXml(SampleNode root) { """ Saves the stack trace summary tree starting from the given root node to an XML file.<p> @param root the root node """ root.sortTree(); Document doc = DocumentHelper.createDocument(); Element rootElem = doc.addElement("root"); root.appendToXml(rootElem); OutputFormat outformat = OutputFormat.createPrettyPrint(); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); outformat.setEncoding("UTF-8"); try { XMLWriter writer = new XMLWriter(buffer, outformat); writer.write(doc); writer.flush(); try (FileOutputStream fos = new FileOutputStream(m_summaryFilename)) { fos.write(buffer.toByteArray()); } } catch (Exception e) { e.printStackTrace(); } }
java
private void saveSummaryXml(SampleNode root) { root.sortTree(); Document doc = DocumentHelper.createDocument(); Element rootElem = doc.addElement("root"); root.appendToXml(rootElem); OutputFormat outformat = OutputFormat.createPrettyPrint(); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); outformat.setEncoding("UTF-8"); try { XMLWriter writer = new XMLWriter(buffer, outformat); writer.write(doc); writer.flush(); try (FileOutputStream fos = new FileOutputStream(m_summaryFilename)) { fos.write(buffer.toByteArray()); } } catch (Exception e) { e.printStackTrace(); } }
[ "private", "void", "saveSummaryXml", "(", "SampleNode", "root", ")", "{", "root", ".", "sortTree", "(", ")", ";", "Document", "doc", "=", "DocumentHelper", ".", "createDocument", "(", ")", ";", "Element", "rootElem", "=", "doc", ".", "addElement", "(", "\"...
Saves the stack trace summary tree starting from the given root node to an XML file.<p> @param root the root node
[ "Saves", "the", "stack", "trace", "summary", "tree", "starting", "from", "the", "given", "root", "node", "to", "an", "XML", "file", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsSingleThreadDumperThread.java#L356-L375
opencb/biodata
biodata-formats/src/main/java/org/opencb/biodata/formats/variant/clinvar/ClinvarParser.java
ClinvarParser.loadXMLInfo
public static Object loadXMLInfo(String filename, String clinvarVersion) throws JAXBException, IOException { """ Checks if XML info path exists and loads it @throws javax.xml.bind.JAXBException @throws java.io.IOException """ Object obj = null; JAXBContext jaxbContext = JAXBContext.newInstance(clinvarVersion); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); // Reading GZip input stream InputStream inputStream; if (filename.endsWith(".gz")) { inputStream = new GZIPInputStream(new FileInputStream(new File(filename))); }else { inputStream = Files.newInputStream(Paths.get(filename)); } obj = unmarshaller.unmarshal(inputStream); return obj; }
java
public static Object loadXMLInfo(String filename, String clinvarVersion) throws JAXBException, IOException { Object obj = null; JAXBContext jaxbContext = JAXBContext.newInstance(clinvarVersion); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); // Reading GZip input stream InputStream inputStream; if (filename.endsWith(".gz")) { inputStream = new GZIPInputStream(new FileInputStream(new File(filename))); }else { inputStream = Files.newInputStream(Paths.get(filename)); } obj = unmarshaller.unmarshal(inputStream); return obj; }
[ "public", "static", "Object", "loadXMLInfo", "(", "String", "filename", ",", "String", "clinvarVersion", ")", "throws", "JAXBException", ",", "IOException", "{", "Object", "obj", "=", "null", ";", "JAXBContext", "jaxbContext", "=", "JAXBContext", ".", "newInstance...
Checks if XML info path exists and loads it @throws javax.xml.bind.JAXBException @throws java.io.IOException
[ "Checks", "if", "XML", "info", "path", "exists", "and", "loads", "it" ]
train
https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-formats/src/main/java/org/opencb/biodata/formats/variant/clinvar/ClinvarParser.java#L64-L77
JodaOrg/joda-time
src/main/java/org/joda/time/format/DateTimeFormatterBuilder.java
DateTimeFormatterBuilder.appendTwoDigitWeekyear
public DateTimeFormatterBuilder appendTwoDigitWeekyear(int pivot, boolean lenientParse) { """ Instructs the printer to emit a numeric weekyear field which always prints two digits. A pivot year is used during parsing to determine the range of supported years as <code>(pivot - 50) .. (pivot + 49)</code>. If parse is instructed to be lenient and the digit count is not two, it is treated as an absolute weekyear. With lenient parsing, specifying a positive or negative sign before the weekyear also makes it absolute. @param pivot pivot weekyear to use when parsing @param lenientParse when true, if digit count is not two, it is treated as an absolute weekyear @return this DateTimeFormatterBuilder, for chaining @since 1.1 """ return append0(new TwoDigitYear(DateTimeFieldType.weekyear(), pivot, lenientParse)); }
java
public DateTimeFormatterBuilder appendTwoDigitWeekyear(int pivot, boolean lenientParse) { return append0(new TwoDigitYear(DateTimeFieldType.weekyear(), pivot, lenientParse)); }
[ "public", "DateTimeFormatterBuilder", "appendTwoDigitWeekyear", "(", "int", "pivot", ",", "boolean", "lenientParse", ")", "{", "return", "append0", "(", "new", "TwoDigitYear", "(", "DateTimeFieldType", ".", "weekyear", "(", ")", ",", "pivot", ",", "lenientParse", ...
Instructs the printer to emit a numeric weekyear field which always prints two digits. A pivot year is used during parsing to determine the range of supported years as <code>(pivot - 50) .. (pivot + 49)</code>. If parse is instructed to be lenient and the digit count is not two, it is treated as an absolute weekyear. With lenient parsing, specifying a positive or negative sign before the weekyear also makes it absolute. @param pivot pivot weekyear to use when parsing @param lenientParse when true, if digit count is not two, it is treated as an absolute weekyear @return this DateTimeFormatterBuilder, for chaining @since 1.1
[ "Instructs", "the", "printer", "to", "emit", "a", "numeric", "weekyear", "field", "which", "always", "prints", "two", "digits", ".", "A", "pivot", "year", "is", "used", "during", "parsing", "to", "determine", "the", "range", "of", "supported", "years", "as",...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/DateTimeFormatterBuilder.java#L909-L911
dita-ot/dita-ot
src/main/java/org/dita/dost/module/KeyrefModule.java
KeyrefModule.writeKeyDefinition
private void writeKeyDefinition(final Map<String, KeyDef> keydefs) { """ Add key definition to job configuration @param keydefs key defintions to add """ try { KeyDef.writeKeydef(new File(job.tempDir, KEYDEF_LIST_FILE), keydefs.values()); } catch (final DITAOTException e) { logger.error("Failed to write key definition file: " + e.getMessage(), e); } }
java
private void writeKeyDefinition(final Map<String, KeyDef> keydefs) { try { KeyDef.writeKeydef(new File(job.tempDir, KEYDEF_LIST_FILE), keydefs.values()); } catch (final DITAOTException e) { logger.error("Failed to write key definition file: " + e.getMessage(), e); } }
[ "private", "void", "writeKeyDefinition", "(", "final", "Map", "<", "String", ",", "KeyDef", ">", "keydefs", ")", "{", "try", "{", "KeyDef", ".", "writeKeydef", "(", "new", "File", "(", "job", ".", "tempDir", ",", "KEYDEF_LIST_FILE", ")", ",", "keydefs", ...
Add key definition to job configuration @param keydefs key defintions to add
[ "Add", "key", "definition", "to", "job", "configuration" ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/KeyrefModule.java#L384-L390
greenmail-mail-test/greenmail
greenmail-core/src/main/java/com/icegreen/greenmail/imap/commands/IdRange.java
IdRange.parseRange
public static IdRange parseRange(String range) { """ Parses a single id range, eg "1" or "1:2" or "4:*". @param range the range. @return the parsed id range. """ int pos = range.indexOf(':'); try { if (pos == -1) { long value = parseLong(range); return new IdRange(value); } else { long lowVal = parseLong(range.substring(0, pos)); long highVal = parseLong(range.substring(pos + 1)); return new IdRange(lowVal, highVal); } } catch (NumberFormatException e) { throw new IllegalArgumentException("Invalid message set " + range); } }
java
public static IdRange parseRange(String range) { int pos = range.indexOf(':'); try { if (pos == -1) { long value = parseLong(range); return new IdRange(value); } else { long lowVal = parseLong(range.substring(0, pos)); long highVal = parseLong(range.substring(pos + 1)); return new IdRange(lowVal, highVal); } } catch (NumberFormatException e) { throw new IllegalArgumentException("Invalid message set " + range); } }
[ "public", "static", "IdRange", "parseRange", "(", "String", "range", ")", "{", "int", "pos", "=", "range", ".", "indexOf", "(", "'", "'", ")", ";", "try", "{", "if", "(", "pos", "==", "-", "1", ")", "{", "long", "value", "=", "parseLong", "(", "r...
Parses a single id range, eg "1" or "1:2" or "4:*". @param range the range. @return the parsed id range.
[ "Parses", "a", "single", "id", "range", "eg", "1", "or", "1", ":", "2", "or", "4", ":", "*", "." ]
train
https://github.com/greenmail-mail-test/greenmail/blob/6d19a62233d1ef6fedbbd1f6fdde2d28e713834a/greenmail-core/src/main/java/com/icegreen/greenmail/imap/commands/IdRange.java#L67-L81
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSetDTM.java
NodeSetDTM.appendNodes
public void appendNodes(NodeVector nodes) { """ Append the nodes to the list. @param nodes The nodes to be appended to this node set. @throws RuntimeException thrown if this NodeSetDTM is not of a mutable type. """ if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); super.appendNodes(nodes); }
java
public void appendNodes(NodeVector nodes) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); super.appendNodes(nodes); }
[ "public", "void", "appendNodes", "(", "NodeVector", "nodes", ")", "{", "if", "(", "!", "m_mutable", ")", "throw", "new", "RuntimeException", "(", "XSLMessages", ".", "createXPATHMessage", "(", "XPATHErrorResources", ".", "ER_NODESETDTM_NOT_MUTABLE", ",", "null", "...
Append the nodes to the list. @param nodes The nodes to be appended to this node set. @throws RuntimeException thrown if this NodeSetDTM is not of a mutable type.
[ "Append", "the", "nodes", "to", "the", "list", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSetDTM.java#L929-L936
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/UtilLepetitEPnP.java
UtilLepetitEPnP.constraintMatrix6x6
public static void constraintMatrix6x6( DMatrixRMaj L_6x10 , DMatrixRMaj L_6x6 ) { """ Extracts the linear constraint matrix for case 3 from the full 6x10 constraint matrix. """ int index = 0; for( int i = 0; i < 6; i++ ) { L_6x6.data[index++] = L_6x10.get(i,0); L_6x6.data[index++] = L_6x10.get(i,1); L_6x6.data[index++] = L_6x10.get(i,2); L_6x6.data[index++] = L_6x10.get(i,4); L_6x6.data[index++] = L_6x10.get(i,5); L_6x6.data[index++] = L_6x10.get(i,7); } }
java
public static void constraintMatrix6x6( DMatrixRMaj L_6x10 , DMatrixRMaj L_6x6 ) { int index = 0; for( int i = 0; i < 6; i++ ) { L_6x6.data[index++] = L_6x10.get(i,0); L_6x6.data[index++] = L_6x10.get(i,1); L_6x6.data[index++] = L_6x10.get(i,2); L_6x6.data[index++] = L_6x10.get(i,4); L_6x6.data[index++] = L_6x10.get(i,5); L_6x6.data[index++] = L_6x10.get(i,7); } }
[ "public", "static", "void", "constraintMatrix6x6", "(", "DMatrixRMaj", "L_6x10", ",", "DMatrixRMaj", "L_6x6", ")", "{", "int", "index", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "6", ";", "i", "++", ")", "{", "L_6x6", ".", "da...
Extracts the linear constraint matrix for case 3 from the full 6x10 constraint matrix.
[ "Extracts", "the", "linear", "constraint", "matrix", "for", "case", "3", "from", "the", "full", "6x10", "constraint", "matrix", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/UtilLepetitEPnP.java#L95-L106
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLChecker.java
JQLChecker.extractPlaceHoldersFromVariableStatement
private <L extends Collection<JQLPlaceHolder>> L extractPlaceHoldersFromVariableStatement(final JQLContext jqlContext, String jql, final L result) { """ Extract place holders from variable statement. @param <L> the generic type @param jqlContext the jql context @param jql the jql @param result the result @return the l """ final One<Boolean> valid = new One<>(); if (!StringUtils.hasText(jql)) return result; valid.value0 = false; analyzeVariableStatementInternal(jqlContext, jql, new JqlBaseListener() { @Override public void enterBind_parameter(Bind_parameterContext ctx) { String parameter; if (ctx.bind_parameter_name() != null) { parameter = ctx.bind_parameter_name().getText(); } else { parameter = ctx.getText(); } result.add(new JQLPlaceHolder(JQLPlaceHolderType.PARAMETER, parameter)); } @Override public void enterBind_dynamic_sql(Bind_dynamic_sqlContext ctx) { result.add(new JQLPlaceHolder(JQLPlaceHolderType.DYNAMIC_SQL, ctx.bind_parameter_name().getText())); } }); return result; }
java
private <L extends Collection<JQLPlaceHolder>> L extractPlaceHoldersFromVariableStatement(final JQLContext jqlContext, String jql, final L result) { final One<Boolean> valid = new One<>(); if (!StringUtils.hasText(jql)) return result; valid.value0 = false; analyzeVariableStatementInternal(jqlContext, jql, new JqlBaseListener() { @Override public void enterBind_parameter(Bind_parameterContext ctx) { String parameter; if (ctx.bind_parameter_name() != null) { parameter = ctx.bind_parameter_name().getText(); } else { parameter = ctx.getText(); } result.add(new JQLPlaceHolder(JQLPlaceHolderType.PARAMETER, parameter)); } @Override public void enterBind_dynamic_sql(Bind_dynamic_sqlContext ctx) { result.add(new JQLPlaceHolder(JQLPlaceHolderType.DYNAMIC_SQL, ctx.bind_parameter_name().getText())); } }); return result; }
[ "private", "<", "L", "extends", "Collection", "<", "JQLPlaceHolder", ">", ">", "L", "extractPlaceHoldersFromVariableStatement", "(", "final", "JQLContext", "jqlContext", ",", "String", "jql", ",", "final", "L", "result", ")", "{", "final", "One", "<", "Boolean",...
Extract place holders from variable statement. @param <L> the generic type @param jqlContext the jql context @param jql the jql @param result the result @return the l
[ "Extract", "place", "holders", "from", "variable", "statement", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLChecker.java#L915-L943
Ordinastie/MalisisCore
src/main/java/net/malisis/core/client/gui/element/position/Positions.java
Positions.rightAligned
public static <T extends ISized & IChild<U>, U extends ISized> IntSupplier rightAligned(T owner, int spacing) { """ Positions the owner to the right inside its parent.<br> Respects the parent padding. @param <T> the generic type @param <U> the generic type @param spacing the spacing @return the int supplier """ return () -> { U parent = owner.getParent(); if (parent == null) return 0; return parent.size().width() - owner.size().width() - Padding.of(parent).right() - spacing; }; }
java
public static <T extends ISized & IChild<U>, U extends ISized> IntSupplier rightAligned(T owner, int spacing) { return () -> { U parent = owner.getParent(); if (parent == null) return 0; return parent.size().width() - owner.size().width() - Padding.of(parent).right() - spacing; }; }
[ "public", "static", "<", "T", "extends", "ISized", "&", "IChild", "<", "U", ">", ",", "U", "extends", "ISized", ">", "IntSupplier", "rightAligned", "(", "T", "owner", ",", "int", "spacing", ")", "{", "return", "(", ")", "->", "{", "U", "parent", "=",...
Positions the owner to the right inside its parent.<br> Respects the parent padding. @param <T> the generic type @param <U> the generic type @param spacing the spacing @return the int supplier
[ "Positions", "the", "owner", "to", "the", "right", "inside", "its", "parent", ".", "<br", ">", "Respects", "the", "parent", "padding", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/client/gui/element/position/Positions.java#L69-L78
aoindustries/aocode-public
src/main/java/com/aoindustries/io/ParallelDelete.java
ParallelDelete.getRelativePath
private static String getRelativePath(File file, FilesystemIterator iterator) throws IOException { """ Gets the relative path for the provided file from the provided iterator. """ String path = file.getPath(); String prefix = iterator.getStartPath(); if(!path.startsWith(prefix)) throw new IOException("path doesn't start with prefix: path=\""+path+"\", prefix=\""+prefix+"\""); return path.substring(prefix.length()); }
java
private static String getRelativePath(File file, FilesystemIterator iterator) throws IOException { String path = file.getPath(); String prefix = iterator.getStartPath(); if(!path.startsWith(prefix)) throw new IOException("path doesn't start with prefix: path=\""+path+"\", prefix=\""+prefix+"\""); return path.substring(prefix.length()); }
[ "private", "static", "String", "getRelativePath", "(", "File", "file", ",", "FilesystemIterator", "iterator", ")", "throws", "IOException", "{", "String", "path", "=", "file", ".", "getPath", "(", ")", ";", "String", "prefix", "=", "iterator", ".", "getStartPa...
Gets the relative path for the provided file from the provided iterator.
[ "Gets", "the", "relative", "path", "for", "the", "provided", "file", "from", "the", "provided", "iterator", "." ]
train
https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/io/ParallelDelete.java#L328-L333
google/closure-compiler
src/com/google/javascript/jscomp/SymbolTable.java
SymbolTable.mergeSymbol
private void mergeSymbol(Symbol from, Symbol to) { """ Merges 'from' symbol to 'to' symbol by moving all references to point to the 'to' symbol and removing 'from' symbol. """ for (Node nodeToMove : from.references.keySet()) { if (!nodeToMove.equals(from.getDeclarationNode())) { to.defineReferenceAt(nodeToMove); } } removeSymbol(from); }
java
private void mergeSymbol(Symbol from, Symbol to) { for (Node nodeToMove : from.references.keySet()) { if (!nodeToMove.equals(from.getDeclarationNode())) { to.defineReferenceAt(nodeToMove); } } removeSymbol(from); }
[ "private", "void", "mergeSymbol", "(", "Symbol", "from", ",", "Symbol", "to", ")", "{", "for", "(", "Node", "nodeToMove", ":", "from", ".", "references", ".", "keySet", "(", ")", ")", "{", "if", "(", "!", "nodeToMove", ".", "equals", "(", "from", "."...
Merges 'from' symbol to 'to' symbol by moving all references to point to the 'to' symbol and removing 'from' symbol.
[ "Merges", "from", "symbol", "to", "to", "symbol", "by", "moving", "all", "references", "to", "point", "to", "the", "to", "symbol", "and", "removing", "from", "symbol", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/SymbolTable.java#L653-L660
Red5/red5-io
src/main/java/org/red5/io/object/BaseInput.java
BaseInput.storeReference
protected void storeReference(int refId, Object newRef) { """ Replace a referenced object with another one. This is used by the AMF3 deserializer to handle circular references. @param refId reference id @param newRef replacement object """ refMap.put(Integer.valueOf(refId), newRef); }
java
protected void storeReference(int refId, Object newRef) { refMap.put(Integer.valueOf(refId), newRef); }
[ "protected", "void", "storeReference", "(", "int", "refId", ",", "Object", "newRef", ")", "{", "refMap", ".", "put", "(", "Integer", ".", "valueOf", "(", "refId", ")", ",", "newRef", ")", ";", "}" ]
Replace a referenced object with another one. This is used by the AMF3 deserializer to handle circular references. @param refId reference id @param newRef replacement object
[ "Replace", "a", "referenced", "object", "with", "another", "one", ".", "This", "is", "used", "by", "the", "AMF3", "deserializer", "to", "handle", "circular", "references", "." ]
train
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/object/BaseInput.java#L67-L69
unbescape/unbescape
src/main/java/org/unbescape/uri/UriEscape.java
UriEscape.unescapeUriFragmentId
public static void unescapeUriFragmentId(final Reader reader, final Writer writer, final String encoding) throws IOException { """ <p> Perform am URI fragment identifier <strong>unescape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> This method will unescape every percent-encoded (<tt>%HH</tt>) sequences present in input, even for those characters that do not need to be percent-encoded in this context (unreserved characters can be percent-encoded even if/when this is not required, though it is not generally considered a good practice). </p> <p> This method will use specified <tt>encoding</tt> in order to determine the characters specified in the percent-encoded byte sequences. </p> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be unescaped. @param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @param encoding the encoding to be used for unescaping. @throws IOException if an input/output exception occurs @since 1.1.2 """ if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } if (encoding == null) { throw new IllegalArgumentException("Argument 'encoding' cannot be null"); } UriEscapeUtil.unescape(reader, writer, UriEscapeUtil.UriEscapeType.FRAGMENT_ID, encoding); }
java
public static void unescapeUriFragmentId(final Reader reader, final Writer writer, final String encoding) throws IOException { if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } if (encoding == null) { throw new IllegalArgumentException("Argument 'encoding' cannot be null"); } UriEscapeUtil.unescape(reader, writer, UriEscapeUtil.UriEscapeType.FRAGMENT_ID, encoding); }
[ "public", "static", "void", "unescapeUriFragmentId", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ",", "final", "String", "encoding", ")", "throws", "IOException", "{", "if", "(", "writer", "==", "null", ")", "{", "throw", "new", "Ille...
<p> Perform am URI fragment identifier <strong>unescape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> This method will unescape every percent-encoded (<tt>%HH</tt>) sequences present in input, even for those characters that do not need to be percent-encoded in this context (unreserved characters can be percent-encoded even if/when this is not required, though it is not generally considered a good practice). </p> <p> This method will use specified <tt>encoding</tt> in order to determine the characters specified in the percent-encoded byte sequences. </p> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be unescaped. @param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @param encoding the encoding to be used for unescaping. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "am", "URI", "fragment", "identifier", "<strong", ">", "unescape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "Reader<", "/", "tt", ">", "input", "writing", "results", "to", "a", "<tt", ">", "Writer<", "/", "tt", ">"...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L2371-L2384
googleapis/google-cloud-java
google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TimestampBound.java
TimestampBound.ofMaxStaleness
public static TimestampBound ofMaxStaleness(long num, TimeUnit units) { """ Returns a timestamp bound that will perform reads and queries at a timestamp chosen to be at most {@code num units} stale. This guarantees that all writes that have committed more than the specified number of seconds ago are visible. Because Cloud Spanner chooses the exact timestamp, this mode works even if the client's local clock is substantially skewed from Cloud Spanner commit timestamps. <p>Useful for reading the freshest data available at a nearby replica, while bounding the possible staleness if the local replica has fallen behind. <p>Note that this option can only be used in single-use reads and single-use read-only transactions. """ checkStaleness(num); return new TimestampBound(Mode.MAX_STALENESS, null, createDuration(num, units)); }
java
public static TimestampBound ofMaxStaleness(long num, TimeUnit units) { checkStaleness(num); return new TimestampBound(Mode.MAX_STALENESS, null, createDuration(num, units)); }
[ "public", "static", "TimestampBound", "ofMaxStaleness", "(", "long", "num", ",", "TimeUnit", "units", ")", "{", "checkStaleness", "(", "num", ")", ";", "return", "new", "TimestampBound", "(", "Mode", ".", "MAX_STALENESS", ",", "null", ",", "createDuration", "(...
Returns a timestamp bound that will perform reads and queries at a timestamp chosen to be at most {@code num units} stale. This guarantees that all writes that have committed more than the specified number of seconds ago are visible. Because Cloud Spanner chooses the exact timestamp, this mode works even if the client's local clock is substantially skewed from Cloud Spanner commit timestamps. <p>Useful for reading the freshest data available at a nearby replica, while bounding the possible staleness if the local replica has fallen behind. <p>Note that this option can only be used in single-use reads and single-use read-only transactions.
[ "Returns", "a", "timestamp", "bound", "that", "will", "perform", "reads", "and", "queries", "at", "a", "timestamp", "chosen", "to", "be", "at", "most", "{", "@code", "num", "units", "}", "stale", ".", "This", "guarantees", "that", "all", "writes", "that", ...
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TimestampBound.java#L198-L201
minio/minio-java
api/src/main/java/io/minio/MinioClient.java
MinioClient.setBucketNotification
public void setBucketNotification(String bucketName, NotificationConfiguration notificationConfiguration) throws InvalidBucketNameException, InvalidObjectPrefixException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException { """ Set bucket notification configuration @param bucketName Bucket name. @param notificationConfiguration Notification configuration to be set. </p><b>Example:</b><br> <pre>{@code minioClient.setBucketNotification("my-bucketname", notificationConfiguration); }</pre> @throws InvalidBucketNameException upon invalid bucket name is given @throws InvalidObjectPrefixException upon invalid object prefix. @throws NoSuchAlgorithmException upon requested algorithm was not found during signature calculation @throws InsufficientDataException upon getting EOFException while reading given InputStream even before reading given length @throws IOException upon connection error @throws InvalidKeyException upon an invalid access key or secret key @throws NoResponseException upon no response from server @throws XmlPullParserException upon parsing response xml @throws ErrorResponseException upon unsuccessful execution @throws InternalException upon internal library error """ Map<String,String> queryParamMap = new HashMap<>(); queryParamMap.put("notification", ""); HttpResponse response = executePut(bucketName, null, null, queryParamMap, notificationConfiguration.toString(), 0); response.body().close(); }
java
public void setBucketNotification(String bucketName, NotificationConfiguration notificationConfiguration) throws InvalidBucketNameException, InvalidObjectPrefixException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException { Map<String,String> queryParamMap = new HashMap<>(); queryParamMap.put("notification", ""); HttpResponse response = executePut(bucketName, null, null, queryParamMap, notificationConfiguration.toString(), 0); response.body().close(); }
[ "public", "void", "setBucketNotification", "(", "String", "bucketName", ",", "NotificationConfiguration", "notificationConfiguration", ")", "throws", "InvalidBucketNameException", ",", "InvalidObjectPrefixException", ",", "NoSuchAlgorithmException", ",", "InsufficientDataException"...
Set bucket notification configuration @param bucketName Bucket name. @param notificationConfiguration Notification configuration to be set. </p><b>Example:</b><br> <pre>{@code minioClient.setBucketNotification("my-bucketname", notificationConfiguration); }</pre> @throws InvalidBucketNameException upon invalid bucket name is given @throws InvalidObjectPrefixException upon invalid object prefix. @throws NoSuchAlgorithmException upon requested algorithm was not found during signature calculation @throws InsufficientDataException upon getting EOFException while reading given InputStream even before reading given length @throws IOException upon connection error @throws InvalidKeyException upon an invalid access key or secret key @throws NoResponseException upon no response from server @throws XmlPullParserException upon parsing response xml @throws ErrorResponseException upon unsuccessful execution @throws InternalException upon internal library error
[ "Set", "bucket", "notification", "configuration" ]
train
https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/MinioClient.java#L4437-L4445
OpenLiberty/open-liberty
dev/com.ibm.ws.jpa.container/src/com/ibm/ws/jpa/container/osgi/internal/JPAComponentImpl.java
JPAComponentImpl.processClientModulePersistenceXml
private void processClientModulePersistenceXml(JPAApplInfo applInfo, ContainerInfo module, ClassLoader loader) { """ Locates and processes persistence.xml file in an Application Client module. <p> @param applInfo the application archive information @param module the client module archive information """ final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "processClientModulePersistenceXml : " + applInfo.getApplName() + "#" + module.getName()); String archiveName = module.getName(); Container clientContainer = module.getContainer(); ClassLoader clientClassLoader = loader; // ------------------------------------------------------------------------ // JPA 2.0 Specification - 8.2 Persistence Unit Packaging // // A persistence unit is defined by a persistence.xml file. The jar file or // directory whose META-INF directory contains the persistence.xml file is // termed the root of the persistence unit. In Java EE environments, the // root of a persistence unit may be one of the following: // // -> an EJB-JAR file // ------------------------------------------------------------------------ // Obtain persistence.xml in META-INF Entry pxml = clientContainer.getEntry("META-INF/persistence.xml"); if (pxml != null) { String appName = applInfo.getApplName(); URL puRoot = getPXmlRootURL(appName, archiveName, pxml); applInfo.addPersistenceUnits(new OSGiJPAPXml(applInfo, archiveName, JPAPuScope.Client_Scope, puRoot, clientClassLoader, pxml)); } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "processClientModulePersistenceXml : " + applInfo.getApplName() + "#" + module.getName()); }
java
private void processClientModulePersistenceXml(JPAApplInfo applInfo, ContainerInfo module, ClassLoader loader) { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "processClientModulePersistenceXml : " + applInfo.getApplName() + "#" + module.getName()); String archiveName = module.getName(); Container clientContainer = module.getContainer(); ClassLoader clientClassLoader = loader; // ------------------------------------------------------------------------ // JPA 2.0 Specification - 8.2 Persistence Unit Packaging // // A persistence unit is defined by a persistence.xml file. The jar file or // directory whose META-INF directory contains the persistence.xml file is // termed the root of the persistence unit. In Java EE environments, the // root of a persistence unit may be one of the following: // // -> an EJB-JAR file // ------------------------------------------------------------------------ // Obtain persistence.xml in META-INF Entry pxml = clientContainer.getEntry("META-INF/persistence.xml"); if (pxml != null) { String appName = applInfo.getApplName(); URL puRoot = getPXmlRootURL(appName, archiveName, pxml); applInfo.addPersistenceUnits(new OSGiJPAPXml(applInfo, archiveName, JPAPuScope.Client_Scope, puRoot, clientClassLoader, pxml)); } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "processClientModulePersistenceXml : " + applInfo.getApplName() + "#" + module.getName()); }
[ "private", "void", "processClientModulePersistenceXml", "(", "JPAApplInfo", "applInfo", ",", "ContainerInfo", "module", ",", "ClassLoader", "loader", ")", "{", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "...
Locates and processes persistence.xml file in an Application Client module. <p> @param applInfo the application archive information @param module the client module archive information
[ "Locates", "and", "processes", "persistence", ".", "xml", "file", "in", "an", "Application", "Client", "module", ".", "<p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container/src/com/ibm/ws/jpa/container/osgi/internal/JPAComponentImpl.java#L580-L612
ops4j/org.ops4j.pax.exam2
core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/war/ZipBuilder.java
ZipBuilder.normalizePath
private String normalizePath(File root, File file) { """ Returns the relative path of the given file with respect to the root directory, with all file separators replaced by slashes. Example: For root {@code C:\work} and file {@code C:\work\com\example\Foo.class}, the result is {@code com/example/Foo.class} @param root root directory @param file relative path @return normalized file path """ String relativePath = file.getPath().substring(root.getPath().length() + 1); String path = relativePath.replaceAll("\\" + File.separator, "/"); return path; }
java
private String normalizePath(File root, File file) { String relativePath = file.getPath().substring(root.getPath().length() + 1); String path = relativePath.replaceAll("\\" + File.separator, "/"); return path; }
[ "private", "String", "normalizePath", "(", "File", "root", ",", "File", "file", ")", "{", "String", "relativePath", "=", "file", ".", "getPath", "(", ")", ".", "substring", "(", "root", ".", "getPath", "(", ")", ".", "length", "(", ")", "+", "1", ")"...
Returns the relative path of the given file with respect to the root directory, with all file separators replaced by slashes. Example: For root {@code C:\work} and file {@code C:\work\com\example\Foo.class}, the result is {@code com/example/Foo.class} @param root root directory @param file relative path @return normalized file path
[ "Returns", "the", "relative", "path", "of", "the", "given", "file", "with", "respect", "to", "the", "root", "directory", "with", "all", "file", "separators", "replaced", "by", "slashes", "." ]
train
https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/war/ZipBuilder.java#L198-L202
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java
AbstractBeanDefinition.getBeanForField
@SuppressWarnings("unused") @Internal @UsedByGeneratedCode protected final Object getBeanForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex) { """ Obtains a bean definition for the field at the given index and the argument at the given index <p> Warning: this method is used by internal generated code and should not be called by user code. @param resolutionContext The resolution context @param context The context @param fieldIndex The field index @return The resolved bean """ FieldInjectionPoint injectionPoint = fieldInjectionPoints.get(fieldIndex); instrumentAnnotationMetadata(context, injectionPoint); return getBeanForField(resolutionContext, context, injectionPoint); }
java
@SuppressWarnings("unused") @Internal @UsedByGeneratedCode protected final Object getBeanForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex) { FieldInjectionPoint injectionPoint = fieldInjectionPoints.get(fieldIndex); instrumentAnnotationMetadata(context, injectionPoint); return getBeanForField(resolutionContext, context, injectionPoint); }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "@", "Internal", "@", "UsedByGeneratedCode", "protected", "final", "Object", "getBeanForField", "(", "BeanResolutionContext", "resolutionContext", ",", "BeanContext", "context", ",", "int", "fieldIndex", ")", "{", "Fiel...
Obtains a bean definition for the field at the given index and the argument at the given index <p> Warning: this method is used by internal generated code and should not be called by user code. @param resolutionContext The resolution context @param context The context @param fieldIndex The field index @return The resolved bean
[ "Obtains", "a", "bean", "definition", "for", "the", "field", "at", "the", "given", "index", "and", "the", "argument", "at", "the", "given", "index", "<p", ">", "Warning", ":", "this", "method", "is", "used", "by", "internal", "generated", "code", "and", ...
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java#L1142-L1149
unic/neba
core/src/main/java/io/neba/core/util/ReflectionUtil.java
ReflectionUtil.instantiateCollectionType
public static <K, T extends Collection<K>> Collection<K> instantiateCollectionType(Class<T> collectionType) { """ Creates an instance with a default capacity. @see #instantiateCollectionType(Class, int) """ return instantiateCollectionType(collectionType, DEFAULT_COLLECTION_SIZE); }
java
public static <K, T extends Collection<K>> Collection<K> instantiateCollectionType(Class<T> collectionType) { return instantiateCollectionType(collectionType, DEFAULT_COLLECTION_SIZE); }
[ "public", "static", "<", "K", ",", "T", "extends", "Collection", "<", "K", ">", ">", "Collection", "<", "K", ">", "instantiateCollectionType", "(", "Class", "<", "T", ">", "collectionType", ")", "{", "return", "instantiateCollectionType", "(", "collectionType"...
Creates an instance with a default capacity. @see #instantiateCollectionType(Class, int)
[ "Creates", "an", "instance", "with", "a", "default", "capacity", "." ]
train
https://github.com/unic/neba/blob/4d762e60112a1fcb850926a56a9843d5aa424c4b/core/src/main/java/io/neba/core/util/ReflectionUtil.java#L160-L162
intendia-oss/rxjava-gwt
src/main/modified/io/reactivex/super/io/reactivex/Flowable.java
Flowable.concatMapSingleDelayError
@CheckReturnValue @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) public final <R> Flowable<R> concatMapSingleDelayError(Function<? super T, ? extends SingleSource<? extends R>> mapper, boolean tillTheEnd, int prefetch) { """ Maps the upstream items into {@link SingleSource}s and subscribes to them one after the other succeeds or fails, emits their success values and optionally delays errors till both this {@code Flowable} and all inner {@code SingleSource}s terminate. <p> <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/concatMap.png" alt=""> <dl> <dt><b>Backpressure:</b></dt> <dd>The operator expects the upstream to support backpressure and honors the backpressure from downstream. If this {@code Flowable} violates the rule, the operator will signal a {@code MissingBackpressureException}.</dd> <dt><b>Scheduler:</b></dt> <dd>{@code concatMapSingleDelayError} does not operate by default on a particular {@link Scheduler}.</dd> </dl> <p>History: 2.1.11 - experimental @param <R> the result type of the inner {@code SingleSource}s @param mapper the function called with the upstream item and should return a {@code SingleSource} to become the next source to be subscribed to @param tillTheEnd If {@code true}, errors from this {@code Flowable} or any of the inner {@code SingleSource}s are delayed until all of them terminate. If {@code false}, an error from this {@code Flowable} is delayed until the current inner {@code SingleSource} terminates and only then is it emitted to the downstream. @param prefetch The number of upstream items to prefetch so that fresh items are ready to be mapped when a previous {@code SingleSource} terminates. The operator replenishes after half of the prefetch amount has been consumed and turned into {@code SingleSource}s. @return a new Flowable instance @see #concatMapSingle(Function, int) @since 2.2 """ ObjectHelper.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(prefetch, "prefetch"); return RxJavaPlugins.onAssembly(new FlowableConcatMapSingle<T, R>(this, mapper, tillTheEnd ? ErrorMode.END : ErrorMode.BOUNDARY, prefetch)); }
java
@CheckReturnValue @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) public final <R> Flowable<R> concatMapSingleDelayError(Function<? super T, ? extends SingleSource<? extends R>> mapper, boolean tillTheEnd, int prefetch) { ObjectHelper.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(prefetch, "prefetch"); return RxJavaPlugins.onAssembly(new FlowableConcatMapSingle<T, R>(this, mapper, tillTheEnd ? ErrorMode.END : ErrorMode.BOUNDARY, prefetch)); }
[ "@", "CheckReturnValue", "@", "BackpressureSupport", "(", "BackpressureKind", ".", "FULL", ")", "@", "SchedulerSupport", "(", "SchedulerSupport", ".", "NONE", ")", "public", "final", "<", "R", ">", "Flowable", "<", "R", ">", "concatMapSingleDelayError", "(", "Fu...
Maps the upstream items into {@link SingleSource}s and subscribes to them one after the other succeeds or fails, emits their success values and optionally delays errors till both this {@code Flowable} and all inner {@code SingleSource}s terminate. <p> <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/concatMap.png" alt=""> <dl> <dt><b>Backpressure:</b></dt> <dd>The operator expects the upstream to support backpressure and honors the backpressure from downstream. If this {@code Flowable} violates the rule, the operator will signal a {@code MissingBackpressureException}.</dd> <dt><b>Scheduler:</b></dt> <dd>{@code concatMapSingleDelayError} does not operate by default on a particular {@link Scheduler}.</dd> </dl> <p>History: 2.1.11 - experimental @param <R> the result type of the inner {@code SingleSource}s @param mapper the function called with the upstream item and should return a {@code SingleSource} to become the next source to be subscribed to @param tillTheEnd If {@code true}, errors from this {@code Flowable} or any of the inner {@code SingleSource}s are delayed until all of them terminate. If {@code false}, an error from this {@code Flowable} is delayed until the current inner {@code SingleSource} terminates and only then is it emitted to the downstream. @param prefetch The number of upstream items to prefetch so that fresh items are ready to be mapped when a previous {@code SingleSource} terminates. The operator replenishes after half of the prefetch amount has been consumed and turned into {@code SingleSource}s. @return a new Flowable instance @see #concatMapSingle(Function, int) @since 2.2
[ "Maps", "the", "upstream", "items", "into", "{" ]
train
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Flowable.java#L7903-L7910
google/closure-compiler
src/com/google/javascript/jscomp/ClosureCodingConvention.java
ClosureCodingConvention.extractClassNameIfProvide
@Override public String extractClassNameIfProvide(Node node, Node parent) { """ Extracts X from goog.provide('X'), if the applied Node is goog. @return The extracted class name, or null. """ String namespace = extractClassNameIfGoog(node, parent, "goog.provide"); if (namespace == null) { namespace = extractClassNameIfGoog(node, parent, "goog.module"); } return namespace; }
java
@Override public String extractClassNameIfProvide(Node node, Node parent) { String namespace = extractClassNameIfGoog(node, parent, "goog.provide"); if (namespace == null) { namespace = extractClassNameIfGoog(node, parent, "goog.module"); } return namespace; }
[ "@", "Override", "public", "String", "extractClassNameIfProvide", "(", "Node", "node", ",", "Node", "parent", ")", "{", "String", "namespace", "=", "extractClassNameIfGoog", "(", "node", ",", "parent", ",", "\"goog.provide\"", ")", ";", "if", "(", "namespace", ...
Extracts X from goog.provide('X'), if the applied Node is goog. @return The extracted class name, or null.
[ "Extracts", "X", "from", "goog", ".", "provide", "(", "X", ")", "if", "the", "applied", "Node", "is", "goog", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ClosureCodingConvention.java#L211-L218
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java
TreeScanner.visitReturn
@Override public R visitReturn(ReturnTree node, P p) { """ {@inheritDoc} This implementation scans the children in left to right order. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of scanning """ return scan(node.getExpression(), p); }
java
@Override public R visitReturn(ReturnTree node, P p) { return scan(node.getExpression(), p); }
[ "@", "Override", "public", "R", "visitReturn", "(", "ReturnTree", "node", ",", "P", "p", ")", "{", "return", "scan", "(", "node", ".", "getExpression", "(", ")", ",", "p", ")", ";", "}" ]
{@inheritDoc} This implementation scans the children in left to right order. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of scanning
[ "{", "@inheritDoc", "}", "This", "implementation", "scans", "the", "children", "in", "left", "to", "right", "order", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java#L467-L470
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/UnionImpl.java
UnionImpl.initNewHeapInstance
static UnionImpl initNewHeapInstance(final int lgNomLongs, final long seed, final float p, final ResizeFactor rf) { """ Construct a new Union SetOperation on the java heap. Called by SetOperationBuilder. @param lgNomLongs <a href="{@docRoot}/resources/dictionary.html#lgNomLogs">See lgNomLongs</a> @param seed <a href="{@docRoot}/resources/dictionary.html#seed">See seed</a> @param p <a href="{@docRoot}/resources/dictionary.html#p">See Sampling Probability, <i>p</i></a> @param rf <a href="{@docRoot}/resources/dictionary.html#resizeFactor">See Resize Factor</a> @return instance of this sketch """ final UpdateSketch gadget = new HeapQuickSelectSketch( lgNomLongs, seed, p, rf, true); //create with UNION family final UnionImpl unionImpl = new UnionImpl(gadget, seed); unionImpl.unionThetaLong_ = gadget.getThetaLong(); unionImpl.unionEmpty_ = gadget.isEmpty(); return unionImpl; }
java
static UnionImpl initNewHeapInstance(final int lgNomLongs, final long seed, final float p, final ResizeFactor rf) { final UpdateSketch gadget = new HeapQuickSelectSketch( lgNomLongs, seed, p, rf, true); //create with UNION family final UnionImpl unionImpl = new UnionImpl(gadget, seed); unionImpl.unionThetaLong_ = gadget.getThetaLong(); unionImpl.unionEmpty_ = gadget.isEmpty(); return unionImpl; }
[ "static", "UnionImpl", "initNewHeapInstance", "(", "final", "int", "lgNomLongs", ",", "final", "long", "seed", ",", "final", "float", "p", ",", "final", "ResizeFactor", "rf", ")", "{", "final", "UpdateSketch", "gadget", "=", "new", "HeapQuickSelectSketch", "(", ...
Construct a new Union SetOperation on the java heap. Called by SetOperationBuilder. @param lgNomLongs <a href="{@docRoot}/resources/dictionary.html#lgNomLogs">See lgNomLongs</a> @param seed <a href="{@docRoot}/resources/dictionary.html#seed">See seed</a> @param p <a href="{@docRoot}/resources/dictionary.html#p">See Sampling Probability, <i>p</i></a> @param rf <a href="{@docRoot}/resources/dictionary.html#resizeFactor">See Resize Factor</a> @return instance of this sketch
[ "Construct", "a", "new", "Union", "SetOperation", "on", "the", "java", "heap", ".", "Called", "by", "SetOperationBuilder", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/UnionImpl.java#L74-L82
Azure/azure-sdk-for-java
recoveryservices/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/v2016_06_01/implementation/VaultExtendedInfosInner.java
VaultExtendedInfosInner.updateAsync
public Observable<VaultExtendedInfoResourceInner> updateAsync(String resourceGroupName, String vaultName, VaultExtendedInfoResourceInner resourceResourceExtendedInfoDetails) { """ Update vault extended info. @param resourceGroupName The name of the resource group where the recovery services vault is present. @param vaultName The name of the recovery services vault. @param resourceResourceExtendedInfoDetails Details of ResourceExtendedInfo @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VaultExtendedInfoResourceInner object """ return updateWithServiceResponseAsync(resourceGroupName, vaultName, resourceResourceExtendedInfoDetails).map(new Func1<ServiceResponse<VaultExtendedInfoResourceInner>, VaultExtendedInfoResourceInner>() { @Override public VaultExtendedInfoResourceInner call(ServiceResponse<VaultExtendedInfoResourceInner> response) { return response.body(); } }); }
java
public Observable<VaultExtendedInfoResourceInner> updateAsync(String resourceGroupName, String vaultName, VaultExtendedInfoResourceInner resourceResourceExtendedInfoDetails) { return updateWithServiceResponseAsync(resourceGroupName, vaultName, resourceResourceExtendedInfoDetails).map(new Func1<ServiceResponse<VaultExtendedInfoResourceInner>, VaultExtendedInfoResourceInner>() { @Override public VaultExtendedInfoResourceInner call(ServiceResponse<VaultExtendedInfoResourceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VaultExtendedInfoResourceInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "vaultName", ",", "VaultExtendedInfoResourceInner", "resourceResourceExtendedInfoDetails", ")", "{", "return", "updateWithServiceResponseAsync", ...
Update vault extended info. @param resourceGroupName The name of the resource group where the recovery services vault is present. @param vaultName The name of the recovery services vault. @param resourceResourceExtendedInfoDetails Details of ResourceExtendedInfo @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VaultExtendedInfoResourceInner object
[ "Update", "vault", "extended", "info", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/v2016_06_01/implementation/VaultExtendedInfosInner.java#L290-L297
foundation-runtime/logging
logging-log4j/src/main/java/com/cisco/oss/foundation/logging/LoggingHelper.java
LoggingHelper.formatCommunicationMessage
public static String formatCommunicationMessage(final String protocol, final String source, final String destination, final String message, final IN_OUT_MODE inOutMODE) { """ Helper method for formatting transmission and reception messages. @param protocol The protocol used @param source Message source @param destination Message destination @param message The message @param inOutMODE - Enum the designates if this communication protocol is in coming (received) or outgoing (transmitted) @return A formatted message in the format: "Rx: / Tx: protocol[&lt;protocol&gt;] source[&lt;source&gt;] destination[&lt;destination&gt;] &lt;message&gt;" <br/> e.g. Rx: protocol[OpenCAS] source[234.234.234.234:4321] destination[123.123.123.123:4567] 0x0a0b0c0d0e0f """ return COMM_MESSAGE_FORMAT_IN_OUT.format(new Object[] { inOutMODE, protocol, source, destination, message }); }
java
public static String formatCommunicationMessage(final String protocol, final String source, final String destination, final String message, final IN_OUT_MODE inOutMODE) { return COMM_MESSAGE_FORMAT_IN_OUT.format(new Object[] { inOutMODE, protocol, source, destination, message }); }
[ "public", "static", "String", "formatCommunicationMessage", "(", "final", "String", "protocol", ",", "final", "String", "source", ",", "final", "String", "destination", ",", "final", "String", "message", ",", "final", "IN_OUT_MODE", "inOutMODE", ")", "{", "return"...
Helper method for formatting transmission and reception messages. @param protocol The protocol used @param source Message source @param destination Message destination @param message The message @param inOutMODE - Enum the designates if this communication protocol is in coming (received) or outgoing (transmitted) @return A formatted message in the format: "Rx: / Tx: protocol[&lt;protocol&gt;] source[&lt;source&gt;] destination[&lt;destination&gt;] &lt;message&gt;" <br/> e.g. Rx: protocol[OpenCAS] source[234.234.234.234:4321] destination[123.123.123.123:4567] 0x0a0b0c0d0e0f
[ "Helper", "method", "for", "formatting", "transmission", "and", "reception", "messages", "." ]
train
https://github.com/foundation-runtime/logging/blob/cd0a07b3c5b458ecf90ab92a1e0c72a067f5cbd6/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/LoggingHelper.java#L447-L449
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/io/IOUtils.java
IOUtils.writeStringToFile
public static void writeStringToFile(String contents, String path, String encoding) throws IOException { """ Writes a string to a file @param contents The string to write @param path The file path @param encoding The encoding to encode in @throws IOException In case of failure """ OutputStream writer = null; if (path.endsWith(".gz")) { writer = new GZIPOutputStream(new FileOutputStream(path)); } else { writer = new BufferedOutputStream(new FileOutputStream(path)); } writer.write(contents.getBytes(encoding)); }
java
public static void writeStringToFile(String contents, String path, String encoding) throws IOException { OutputStream writer = null; if (path.endsWith(".gz")) { writer = new GZIPOutputStream(new FileOutputStream(path)); } else { writer = new BufferedOutputStream(new FileOutputStream(path)); } writer.write(contents.getBytes(encoding)); }
[ "public", "static", "void", "writeStringToFile", "(", "String", "contents", ",", "String", "path", ",", "String", "encoding", ")", "throws", "IOException", "{", "OutputStream", "writer", "=", "null", ";", "if", "(", "path", ".", "endsWith", "(", "\".gz\"", "...
Writes a string to a file @param contents The string to write @param path The file path @param encoding The encoding to encode in @throws IOException In case of failure
[ "Writes", "a", "string", "to", "a", "file" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/io/IOUtils.java#L162-L170
beangle/beangle3
commons/model/src/main/java/org/beangle/commons/entity/metadata/Model.java
Model.populate
public static void populate(Object entity, Map<String, Object> params) { """ 将params中的属性([attr(string)->value(object)],放入到实体类中。<br> 如果引用到了别的实体,那么<br> 如果params中的id为null,则将该实体的置为null.<br> 否则新生成一个实体,将其id设为params中指定的值。 空字符串按照null处理 @param params a {@link java.util.Map} object. @param entity a {@link java.lang.Object} object. """ meta.getPopulator().populate(entity, meta.getEntityType(entity.getClass()), params); }
java
public static void populate(Object entity, Map<String, Object> params) { meta.getPopulator().populate(entity, meta.getEntityType(entity.getClass()), params); }
[ "public", "static", "void", "populate", "(", "Object", "entity", ",", "Map", "<", "String", ",", "Object", ">", "params", ")", "{", "meta", ".", "getPopulator", "(", ")", ".", "populate", "(", "entity", ",", "meta", ".", "getEntityType", "(", "entity", ...
将params中的属性([attr(string)->value(object)],放入到实体类中。<br> 如果引用到了别的实体,那么<br> 如果params中的id为null,则将该实体的置为null.<br> 否则新生成一个实体,将其id设为params中指定的值。 空字符串按照null处理 @param params a {@link java.util.Map} object. @param entity a {@link java.lang.Object} object.
[ "将params中的属性", "(", "[", "attr", "(", "string", ")", "-", ">", "value", "(", "object", ")", "]", ",放入到实体类中。<br", ">", "如果引用到了别的实体,那么<br", ">", "如果params中的id为null,则将该实体的置为null", ".", "<br", ">", "否则新生成一个实体,将其id设为params中指定的值。", "空字符串按照null处理" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/model/src/main/java/org/beangle/commons/entity/metadata/Model.java#L119-L121
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/graph/GraphGenerator.java
GraphGenerator.generateGraph
public <E> ObjectGraph generateGraph(E entity, PersistenceDelegator delegator, NodeState state) { """ Generate entity graph and returns after assigning headnode. n @param entity entity. @param delegator delegator @param pc persistence cache @return object graph. """ this.builder.assign(this); Node node = generate(entity, delegator, delegator.getPersistenceCache(), state); this.builder.assignHeadNode(node); return this.builder.getGraph(); }
java
public <E> ObjectGraph generateGraph(E entity, PersistenceDelegator delegator, NodeState state) { this.builder.assign(this); Node node = generate(entity, delegator, delegator.getPersistenceCache(), state); this.builder.assignHeadNode(node); return this.builder.getGraph(); }
[ "public", "<", "E", ">", "ObjectGraph", "generateGraph", "(", "E", "entity", ",", "PersistenceDelegator", "delegator", ",", "NodeState", "state", ")", "{", "this", ".", "builder", ".", "assign", "(", "this", ")", ";", "Node", "node", "=", "generate", "(", ...
Generate entity graph and returns after assigning headnode. n @param entity entity. @param delegator delegator @param pc persistence cache @return object graph.
[ "Generate", "entity", "graph", "and", "returns", "after", "assigning", "headnode", ".", "n" ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/graph/GraphGenerator.java#L98-L105
FudanNLP/fnlp
fnlp-core/src/main/java/org/fnlp/nlp/pipe/seq/DictLabel.java
DictLabel.getNextN
public WordInfo getNextN(String[] data, int index, int N) { """ 得到从位置index开始的长度为N的字串 @param data String[] @param index 起始位置 @param N 长度 @return """ StringBuilder sb = new StringBuilder(); int i = index; while(sb.length()<N&&i<data.length){ sb.append(data[i]); i++; } if(sb.length()<=N) return new WordInfo(sb.toString(),i-index); else return new WordInfo(sb.substring(0,N),i-index); }
java
public WordInfo getNextN(String[] data, int index, int N) { StringBuilder sb = new StringBuilder(); int i = index; while(sb.length()<N&&i<data.length){ sb.append(data[i]); i++; } if(sb.length()<=N) return new WordInfo(sb.toString(),i-index); else return new WordInfo(sb.substring(0,N),i-index); }
[ "public", "WordInfo", "getNextN", "(", "String", "[", "]", "data", ",", "int", "index", ",", "int", "N", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "int", "i", "=", "index", ";", "while", "(", "sb", ".", "length", ...
得到从位置index开始的长度为N的字串 @param data String[] @param index 起始位置 @param N 长度 @return
[ "得到从位置index开始的长度为N的字串" ]
train
https://github.com/FudanNLP/fnlp/blob/ce258f3e4a5add2ba0b5e4cbac7cab2190af6659/fnlp-core/src/main/java/org/fnlp/nlp/pipe/seq/DictLabel.java#L166-L177
apache/incubator-zipkin
zipkin-server/src/main/java/zipkin2/server/internal/elasticsearch/ZipkinElasticsearchStorageAutoConfiguration.java
ZipkinElasticsearchStorageAutoConfiguration.makeContextAware
static ExecutorService makeContextAware(ExecutorService delegate, CurrentTraceContext traceCtx) { """ Decorates the input such that the {@link RequestContext#current() current request context} and the and the {@link CurrentTraceContext#get() current trace context} at assembly time is made current when task is executed. """ class TracingCurrentRequestContextExecutorService extends WrappingExecutorService { @Override protected ExecutorService delegate() { return delegate; } @Override protected <C> Callable<C> wrap(Callable<C> task) { return RequestContext.current().makeContextAware(traceCtx.wrap(task)); } @Override protected Runnable wrap(Runnable task) { return RequestContext.current().makeContextAware(traceCtx.wrap(task)); } } return new TracingCurrentRequestContextExecutorService(); }
java
static ExecutorService makeContextAware(ExecutorService delegate, CurrentTraceContext traceCtx) { class TracingCurrentRequestContextExecutorService extends WrappingExecutorService { @Override protected ExecutorService delegate() { return delegate; } @Override protected <C> Callable<C> wrap(Callable<C> task) { return RequestContext.current().makeContextAware(traceCtx.wrap(task)); } @Override protected Runnable wrap(Runnable task) { return RequestContext.current().makeContextAware(traceCtx.wrap(task)); } } return new TracingCurrentRequestContextExecutorService(); }
[ "static", "ExecutorService", "makeContextAware", "(", "ExecutorService", "delegate", ",", "CurrentTraceContext", "traceCtx", ")", "{", "class", "TracingCurrentRequestContextExecutorService", "extends", "WrappingExecutorService", "{", "@", "Override", "protected", "ExecutorServi...
Decorates the input such that the {@link RequestContext#current() current request context} and the and the {@link CurrentTraceContext#get() current trace context} at assembly time is made current when task is executed.
[ "Decorates", "the", "input", "such", "that", "the", "{" ]
train
https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-server/src/main/java/zipkin2/server/internal/elasticsearch/ZipkinElasticsearchStorageAutoConfiguration.java#L169-L185
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/optimizers/particleswarm/PSEngine.java
PSEngine.parametersInRange
public static boolean parametersInRange( double[] parameters, double[]... ranges ) { """ Checks if the parameters are in the ranges. @param parameters the params. @param ranges the ranges. @return <code>true</code>, if they are inside the given ranges. """ for( int i = 0; i < ranges.length; i++ ) { if (!NumericsUtilities.isBetween(parameters[i], ranges[i])) { return false; } } return true; }
java
public static boolean parametersInRange( double[] parameters, double[]... ranges ) { for( int i = 0; i < ranges.length; i++ ) { if (!NumericsUtilities.isBetween(parameters[i], ranges[i])) { return false; } } return true; }
[ "public", "static", "boolean", "parametersInRange", "(", "double", "[", "]", "parameters", ",", "double", "[", "]", "...", "ranges", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "ranges", ".", "length", ";", "i", "++", ")", "{", "if",...
Checks if the parameters are in the ranges. @param parameters the params. @param ranges the ranges. @return <code>true</code>, if they are inside the given ranges.
[ "Checks", "if", "the", "parameters", "are", "in", "the", "ranges", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/optimizers/particleswarm/PSEngine.java#L211-L218
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NodeVector.java
NodeVector.indexOf
public int indexOf(int elem, int index) { """ Searches for the first occurence of the given argument, beginning the search at index, and testing for equality using the equals method. @param elem Node to look for @param index Index of where to start the search @return the index of the first occurrence of the object argument in this vector at position index or later in the vector; returns -1 if the object is not found. """ if (null == m_map) return -1; for (int i = index; i < m_firstFree; i++) { int node = m_map[i]; if (node == elem) return i; } return -1; }
java
public int indexOf(int elem, int index) { if (null == m_map) return -1; for (int i = index; i < m_firstFree; i++) { int node = m_map[i]; if (node == elem) return i; } return -1; }
[ "public", "int", "indexOf", "(", "int", "elem", ",", "int", "index", ")", "{", "if", "(", "null", "==", "m_map", ")", "return", "-", "1", ";", "for", "(", "int", "i", "=", "index", ";", "i", "<", "m_firstFree", ";", "i", "++", ")", "{", "int", ...
Searches for the first occurence of the given argument, beginning the search at index, and testing for equality using the equals method. @param elem Node to look for @param index Index of where to start the search @return the index of the first occurrence of the object argument in this vector at position index or later in the vector; returns -1 if the object is not found.
[ "Searches", "for", "the", "first", "occurence", "of", "the", "given", "argument", "beginning", "the", "search", "at", "index", "and", "testing", "for", "equality", "using", "the", "equals", "method", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NodeVector.java#L587-L602
QSFT/Doradus
doradus-client/src/main/java/com/dell/doradus/dory/command/Command.java
Command.getAppDef
public static ApplicationDefinition getAppDef(RESTClient restClient, String appName) { """ Get the {@link ApplicationDefinition} for the given application name. If the connected Doradus server has no such application defined, null is returned. @param appName Application name. @return Application's {@link ApplicationDefinition}, if it exists, otherwise null. """ // GET /_applications/{application} Utils.require(!restClient.isClosed(), "Client has been closed"); Utils.require(appName != null && appName.length() > 0, "appName"); try { StringBuilder uri = new StringBuilder(Utils.isEmpty(restClient.getApiPrefix()) ? "" : "/" + restClient.getApiPrefix()); uri.append("/_applications/"); uri.append(Utils.urlEncode(appName)); RESTResponse response = restClient.sendRequest(HttpMethod.GET, uri.toString()); logger.debug("listApplication() response: {}", response.toString()); if (response.getCode() == HttpCode.NOT_FOUND) { return null; } ApplicationDefinition appDef = new ApplicationDefinition(); appDef.parse(getUNodeResult(response)); return appDef; } catch (Exception e) { throw new RuntimeException(e); } }
java
public static ApplicationDefinition getAppDef(RESTClient restClient, String appName) { // GET /_applications/{application} Utils.require(!restClient.isClosed(), "Client has been closed"); Utils.require(appName != null && appName.length() > 0, "appName"); try { StringBuilder uri = new StringBuilder(Utils.isEmpty(restClient.getApiPrefix()) ? "" : "/" + restClient.getApiPrefix()); uri.append("/_applications/"); uri.append(Utils.urlEncode(appName)); RESTResponse response = restClient.sendRequest(HttpMethod.GET, uri.toString()); logger.debug("listApplication() response: {}", response.toString()); if (response.getCode() == HttpCode.NOT_FOUND) { return null; } ApplicationDefinition appDef = new ApplicationDefinition(); appDef.parse(getUNodeResult(response)); return appDef; } catch (Exception e) { throw new RuntimeException(e); } }
[ "public", "static", "ApplicationDefinition", "getAppDef", "(", "RESTClient", "restClient", ",", "String", "appName", ")", "{", "// GET /_applications/{application}", "Utils", ".", "require", "(", "!", "restClient", ".", "isClosed", "(", ")", ",", "\"Client has been cl...
Get the {@link ApplicationDefinition} for the given application name. If the connected Doradus server has no such application defined, null is returned. @param appName Application name. @return Application's {@link ApplicationDefinition}, if it exists, otherwise null.
[ "Get", "the", "{", "@link", "ApplicationDefinition", "}", "for", "the", "given", "application", "name", ".", "If", "the", "connected", "Doradus", "server", "has", "no", "such", "application", "defined", "null", "is", "returned", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-client/src/main/java/com/dell/doradus/dory/command/Command.java#L290-L311
fuwjax/ev-oss
funco/src/main/java/org/fuwjax/oss/util/assertion/Assert2.java
Assert2.containsAll
public static void containsAll(final Path expected, final Path actual) throws IOException { """ Asserts that every file that exists relative to expected also exists relative to actual. @param expected the expected path @param actual the actual path @throws IOException if the paths cannot be walked """ final Assertion<Path> exists = existsIn(expected, actual); if(Files.exists(expected)) { walkFileTree(expected, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException { assertThat(file, exists); return super.visitFile(file, attrs); } }); } }
java
public static void containsAll(final Path expected, final Path actual) throws IOException { final Assertion<Path> exists = existsIn(expected, actual); if(Files.exists(expected)) { walkFileTree(expected, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException { assertThat(file, exists); return super.visitFile(file, attrs); } }); } }
[ "public", "static", "void", "containsAll", "(", "final", "Path", "expected", ",", "final", "Path", "actual", ")", "throws", "IOException", "{", "final", "Assertion", "<", "Path", ">", "exists", "=", "existsIn", "(", "expected", ",", "actual", ")", ";", "if...
Asserts that every file that exists relative to expected also exists relative to actual. @param expected the expected path @param actual the actual path @throws IOException if the paths cannot be walked
[ "Asserts", "that", "every", "file", "that", "exists", "relative", "to", "expected", "also", "exists", "relative", "to", "actual", "." ]
train
https://github.com/fuwjax/ev-oss/blob/cbd88592e9b2fa9547c3bdd41e52e790061a2253/funco/src/main/java/org/fuwjax/oss/util/assertion/Assert2.java#L107-L118
labai/ted
ted-driver/src/main/java/ted/driver/TedDriver.java
TedDriver.createAndStartTask
public Long createAndStartTask(String taskName, String data, String key1, String key2) { """ create task and start to process it in channel (will NOT wait until execution finish) """ return tedDriverImpl.createAndExecuteTask(taskName, data, key1, key2, true); }
java
public Long createAndStartTask(String taskName, String data, String key1, String key2) { return tedDriverImpl.createAndExecuteTask(taskName, data, key1, key2, true); }
[ "public", "Long", "createAndStartTask", "(", "String", "taskName", ",", "String", "data", ",", "String", "key1", ",", "String", "key2", ")", "{", "return", "tedDriverImpl", ".", "createAndExecuteTask", "(", "taskName", ",", "data", ",", "key1", ",", "key2", ...
create task and start to process it in channel (will NOT wait until execution finish)
[ "create", "task", "and", "start", "to", "process", "it", "in", "channel", "(", "will", "NOT", "wait", "until", "execution", "finish", ")" ]
train
https://github.com/labai/ted/blob/2ee197246a78d842c18d6780c48fd903b00608a6/ted-driver/src/main/java/ted/driver/TedDriver.java#L94-L96
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/base/Json.java
Json.resource_to_string
public String resource_to_string(base_resource resources[], options option, String onerror) { """ Converts MPS resources to Json string. @param resources nitro resources. @param option options class object. @return returns a String """ String objecttype = resources[0].get_object_type(); String request = "{"; if ( (option != null && option.get_action() != null) || (!onerror.equals("")) ) { request = request + "\"params\":{"; if (option != null) { if(option.get_action() != null) { request = request + "\"action\":\"" + option.get_action()+"\","; } } if((!onerror.equals(""))) { request = request + "\"onerror\":\"" + onerror + "\""; } request = request + "},"; } request = request + "\"" + objecttype + "\":["; for (int i = 0; i < resources.length ; i++) { String str = this.resource_to_string(resources[i]); request = request + str + ","; } request = request + "]}"; return request; }
java
public String resource_to_string(base_resource resources[], options option, String onerror) { String objecttype = resources[0].get_object_type(); String request = "{"; if ( (option != null && option.get_action() != null) || (!onerror.equals("")) ) { request = request + "\"params\":{"; if (option != null) { if(option.get_action() != null) { request = request + "\"action\":\"" + option.get_action()+"\","; } } if((!onerror.equals(""))) { request = request + "\"onerror\":\"" + onerror + "\""; } request = request + "},"; } request = request + "\"" + objecttype + "\":["; for (int i = 0; i < resources.length ; i++) { String str = this.resource_to_string(resources[i]); request = request + str + ","; } request = request + "]}"; return request; }
[ "public", "String", "resource_to_string", "(", "base_resource", "resources", "[", "]", ",", "options", "option", ",", "String", "onerror", ")", "{", "String", "objecttype", "=", "resources", "[", "0", "]", ".", "get_object_type", "(", ")", ";", "String", "re...
Converts MPS resources to Json string. @param resources nitro resources. @param option options class object. @return returns a String
[ "Converts", "MPS", "resources", "to", "Json", "string", "." ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/base/Json.java#L135-L167
spockframework/spock
spock-core/src/main/java/org/spockframework/mock/MockUtil.java
MockUtil.createDetachedMock
@Beta public Object createDetachedMock(@Nullable String name, Type type, MockNature nature, MockImplementation implementation, Map<String, Object> options, ClassLoader classloader) { """ Creates a detached mock. @param name the name @param type the type of the mock @param nature the nature @param implementation the implementation @param options the options @param classloader the classloader to use @return the mock """ Object mock = CompositeMockFactory.INSTANCE.createDetached( new MockConfiguration(name, type, nature, implementation, options), classloader); return mock; }
java
@Beta public Object createDetachedMock(@Nullable String name, Type type, MockNature nature, MockImplementation implementation, Map<String, Object> options, ClassLoader classloader) { Object mock = CompositeMockFactory.INSTANCE.createDetached( new MockConfiguration(name, type, nature, implementation, options), classloader); return mock; }
[ "@", "Beta", "public", "Object", "createDetachedMock", "(", "@", "Nullable", "String", "name", ",", "Type", "type", ",", "MockNature", "nature", ",", "MockImplementation", "implementation", ",", "Map", "<", "String", ",", "Object", ">", "options", ",", "ClassL...
Creates a detached mock. @param name the name @param type the type of the mock @param nature the nature @param implementation the implementation @param options the options @param classloader the classloader to use @return the mock
[ "Creates", "a", "detached", "mock", "." ]
train
https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/mock/MockUtil.java#L88-L95
paypal/SeLion
server/src/main/java/com/paypal/selion/pojos/BrowserStatisticsCollection.java
BrowserStatisticsCollection.setMaxBrowserInstances
public void setMaxBrowserInstances(String browserName, int maxBrowserInstances) { """ Sets the maximum instances for a particular browser. This call creates a unique statistics for the provided browser name it does not exists. @param browserName Name of the browser. @param maxBrowserInstances Maximum instances of the browser. """ logger.entering(new Object[] { browserName, maxBrowserInstances }); validateBrowserName(browserName); BrowserStatistics lStatistics = createStatisticsIfNotPresent(browserName); lStatistics.setMaxBrowserInstances(maxBrowserInstances); logger.exiting(); }
java
public void setMaxBrowserInstances(String browserName, int maxBrowserInstances) { logger.entering(new Object[] { browserName, maxBrowserInstances }); validateBrowserName(browserName); BrowserStatistics lStatistics = createStatisticsIfNotPresent(browserName); lStatistics.setMaxBrowserInstances(maxBrowserInstances); logger.exiting(); }
[ "public", "void", "setMaxBrowserInstances", "(", "String", "browserName", ",", "int", "maxBrowserInstances", ")", "{", "logger", ".", "entering", "(", "new", "Object", "[", "]", "{", "browserName", ",", "maxBrowserInstances", "}", ")", ";", "validateBrowserName", ...
Sets the maximum instances for a particular browser. This call creates a unique statistics for the provided browser name it does not exists. @param browserName Name of the browser. @param maxBrowserInstances Maximum instances of the browser.
[ "Sets", "the", "maximum", "instances", "for", "a", "particular", "browser", ".", "This", "call", "creates", "a", "unique", "statistics", "for", "the", "provided", "browser", "name", "it", "does", "not", "exists", "." ]
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/server/src/main/java/com/paypal/selion/pojos/BrowserStatisticsCollection.java#L61-L67
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/MapExtensions.java
MapExtensions.operator_plus
@Pure @Inline(value = "$3.union($1, $2)", imported = MapExtensions.class) public static <K, V> Map<K, V> operator_plus(Map<K, V> left, Map<? extends K, ? extends V> right) { """ Merge the two maps. <p> The replied map is a view on the given map. It means that any change in the original map is reflected to the result of this operation. </p> <p> If a key exists in the left and right operands, the value in the right operand is preferred. </p> @param <K> type of the map keys. @param <V> type of the map values. @param left the left map. @param right the right map. @return a map with the merged contents from the two maps. @throws IllegalArgumentException - when a right operand key exists in the left operand. @since 2.15 """ return union(left, right); }
java
@Pure @Inline(value = "$3.union($1, $2)", imported = MapExtensions.class) public static <K, V> Map<K, V> operator_plus(Map<K, V> left, Map<? extends K, ? extends V> right) { return union(left, right); }
[ "@", "Pure", "@", "Inline", "(", "value", "=", "\"$3.union($1, $2)\"", ",", "imported", "=", "MapExtensions", ".", "class", ")", "public", "static", "<", "K", ",", "V", ">", "Map", "<", "K", ",", "V", ">", "operator_plus", "(", "Map", "<", "K", ",", ...
Merge the two maps. <p> The replied map is a view on the given map. It means that any change in the original map is reflected to the result of this operation. </p> <p> If a key exists in the left and right operands, the value in the right operand is preferred. </p> @param <K> type of the map keys. @param <V> type of the map values. @param left the left map. @param right the right map. @return a map with the merged contents from the two maps. @throws IllegalArgumentException - when a right operand key exists in the left operand. @since 2.15
[ "Merge", "the", "two", "maps", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/MapExtensions.java#L189-L193
opengeospatial/teamengine
teamengine-web/src/main/java/com/occamlab/te/web/CoverageMonitor.java
CoverageMonitor.writeDocument
void writeDocument(OutputStream outStream, Document doc) { """ Writes a DOM Document to the given OutputStream using the "UTF-8" encoding. The XML declaration is omitted. @param outStream The destination OutputStream object. @param doc A Document node. """ DOMImplementationRegistry domRegistry = null; try { domRegistry = DOMImplementationRegistry.newInstance(); // Fortify Mod: Broaden try block to capture all potential exceptions // } catch (Exception e) { // LOGR.warning(e.getMessage()); // } DOMImplementationLS impl = (DOMImplementationLS) domRegistry .getDOMImplementation("LS"); LSSerializer writer = impl.createLSSerializer(); writer.getDomConfig().setParameter("xml-declaration", false); writer.getDomConfig().setParameter("format-pretty-print", true); LSOutput output = impl.createLSOutput(); output.setEncoding("UTF-8"); output.setByteStream(outStream); writer.write(doc, output); } catch (Exception e) { LOGR.warning(e.getMessage()); } }
java
void writeDocument(OutputStream outStream, Document doc) { DOMImplementationRegistry domRegistry = null; try { domRegistry = DOMImplementationRegistry.newInstance(); // Fortify Mod: Broaden try block to capture all potential exceptions // } catch (Exception e) { // LOGR.warning(e.getMessage()); // } DOMImplementationLS impl = (DOMImplementationLS) domRegistry .getDOMImplementation("LS"); LSSerializer writer = impl.createLSSerializer(); writer.getDomConfig().setParameter("xml-declaration", false); writer.getDomConfig().setParameter("format-pretty-print", true); LSOutput output = impl.createLSOutput(); output.setEncoding("UTF-8"); output.setByteStream(outStream); writer.write(doc, output); } catch (Exception e) { LOGR.warning(e.getMessage()); } }
[ "void", "writeDocument", "(", "OutputStream", "outStream", ",", "Document", "doc", ")", "{", "DOMImplementationRegistry", "domRegistry", "=", "null", ";", "try", "{", "domRegistry", "=", "DOMImplementationRegistry", ".", "newInstance", "(", ")", ";", "// Fortify Mod...
Writes a DOM Document to the given OutputStream using the "UTF-8" encoding. The XML declaration is omitted. @param outStream The destination OutputStream object. @param doc A Document node.
[ "Writes", "a", "DOM", "Document", "to", "the", "given", "OutputStream", "using", "the", "UTF", "-", "8", "encoding", ".", "The", "XML", "declaration", "is", "omitted", "." ]
train
https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-web/src/main/java/com/occamlab/te/web/CoverageMonitor.java#L237-L257
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-common/src/main/java/org/deeplearning4j/common/resources/DL4JResources.java
DL4JResources.getDirectory
public static File getDirectory(ResourceType resourceType, String resourceName) { """ Get the storage location for the specified resource type and resource name @param resourceType Type of resource @param resourceName Name of the resource @return The root directory. Creates the directory and any parent directories, if required """ File f = new File(baseDirectory, resourceType.resourceName()); f = new File(f, resourceName); f.mkdirs(); return f; }
java
public static File getDirectory(ResourceType resourceType, String resourceName){ File f = new File(baseDirectory, resourceType.resourceName()); f = new File(f, resourceName); f.mkdirs(); return f; }
[ "public", "static", "File", "getDirectory", "(", "ResourceType", "resourceType", ",", "String", "resourceName", ")", "{", "File", "f", "=", "new", "File", "(", "baseDirectory", ",", "resourceType", ".", "resourceName", "(", ")", ")", ";", "f", "=", "new", ...
Get the storage location for the specified resource type and resource name @param resourceType Type of resource @param resourceName Name of the resource @return The root directory. Creates the directory and any parent directories, if required
[ "Get", "the", "storage", "location", "for", "the", "specified", "resource", "type", "and", "resource", "name" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-common/src/main/java/org/deeplearning4j/common/resources/DL4JResources.java#L148-L153
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PacketCapturesInner.java
PacketCapturesInner.listAsync
public Observable<List<PacketCaptureResultInner>> listAsync(String resourceGroupName, String networkWatcherName) { """ Lists all packet capture sessions within the specified resource group. @param resourceGroupName The name of the resource group. @param networkWatcherName The name of the Network Watcher resource. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;PacketCaptureResultInner&gt; object """ return listWithServiceResponseAsync(resourceGroupName, networkWatcherName).map(new Func1<ServiceResponse<List<PacketCaptureResultInner>>, List<PacketCaptureResultInner>>() { @Override public List<PacketCaptureResultInner> call(ServiceResponse<List<PacketCaptureResultInner>> response) { return response.body(); } }); }
java
public Observable<List<PacketCaptureResultInner>> listAsync(String resourceGroupName, String networkWatcherName) { return listWithServiceResponseAsync(resourceGroupName, networkWatcherName).map(new Func1<ServiceResponse<List<PacketCaptureResultInner>>, List<PacketCaptureResultInner>>() { @Override public List<PacketCaptureResultInner> call(ServiceResponse<List<PacketCaptureResultInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "PacketCaptureResultInner", ">", ">", "listAsync", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ")", "{", "return", "listWithServiceResponseAsync", "(", "resourceGroupName", ",", "networkWatcherName", ...
Lists all packet capture sessions within the specified resource group. @param resourceGroupName The name of the resource group. @param networkWatcherName The name of the Network Watcher resource. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;PacketCaptureResultInner&gt; object
[ "Lists", "all", "packet", "capture", "sessions", "within", "the", "specified", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PacketCapturesInner.java#L907-L914
threerings/narya
core/src/main/java/com/threerings/admin/client/ConfigEditorPanel.java
ConfigEditorPanel.gotConfigInfo
public void gotConfigInfo (final String[] keys, final int[] oids) { """ Called in response to our getConfigInfo server-side service request. """ // make sure we're still added if (!isDisplayable()) { return; } Integer indexes[] = new Integer[keys.length]; for (int ii = 0; ii < indexes.length; ii++) { indexes[ii] = ii; } QuickSort.sort(indexes, new Comparator<Integer>() { public int compare (Integer i1, Integer i2) { return keys[i1].compareTo(keys[i2]); } }); // create object editor panels for each of the categories for (Integer ii : indexes) { ObjectEditorPanel panel = new ObjectEditorPanel(_ctx, keys[ii], oids[ii]); JScrollPane scrolly = new JScrollPane(panel); _oeditors.addTab(keys[ii], scrolly); if (keys[ii].equals(_defaultPane)) { _oeditors.setSelectedComponent(scrolly); } } }
java
public void gotConfigInfo (final String[] keys, final int[] oids) { // make sure we're still added if (!isDisplayable()) { return; } Integer indexes[] = new Integer[keys.length]; for (int ii = 0; ii < indexes.length; ii++) { indexes[ii] = ii; } QuickSort.sort(indexes, new Comparator<Integer>() { public int compare (Integer i1, Integer i2) { return keys[i1].compareTo(keys[i2]); } }); // create object editor panels for each of the categories for (Integer ii : indexes) { ObjectEditorPanel panel = new ObjectEditorPanel(_ctx, keys[ii], oids[ii]); JScrollPane scrolly = new JScrollPane(panel); _oeditors.addTab(keys[ii], scrolly); if (keys[ii].equals(_defaultPane)) { _oeditors.setSelectedComponent(scrolly); } } }
[ "public", "void", "gotConfigInfo", "(", "final", "String", "[", "]", "keys", ",", "final", "int", "[", "]", "oids", ")", "{", "// make sure we're still added", "if", "(", "!", "isDisplayable", "(", ")", ")", "{", "return", ";", "}", "Integer", "indexes", ...
Called in response to our getConfigInfo server-side service request.
[ "Called", "in", "response", "to", "our", "getConfigInfo", "server", "-", "side", "service", "request", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/admin/client/ConfigEditorPanel.java#L112-L139
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAssetLoader.java
GVRAssetLoader.loadModel
public void loadModel(final GVRResourceVolume fileVolume, final GVRSceneObject model, final EnumSet<GVRImportSettings> settings, final boolean cacheEnabled, final IAssetEvents handler) { """ Loads a scene object {@link GVRSceneObject} asynchronously from a 3D model and raises asset events to a handler. <p> This function is a good choice for loading assets because it does not block the thread from which it is initiated. Instead, it runs the load request on a background thread and issues events to the handler provided. </p> @param fileVolume GVRResourceVolume with the path to the model to load. The filename is relative to the root of this volume. The volume will be used to load models referenced by this model. @param model {@link GVRSceneObject} that is the root of the hierarchy generated by loading the 3D model. @param settings Additional import {@link GVRImportSettings settings} @param cacheEnabled If true, add the model's textures to the texture cache @param handler IAssetEvents handler to process asset loading events @see IAssetEvents #loadMesh(GVRAndroidResource.MeshCallback, GVRAndroidResource, int) """ Threads.spawn(new Runnable() { public void run() { String filePath = fileVolume.getFileName(); String ext = filePath.substring(filePath.length() - 3).toLowerCase(); AssetRequest assetRequest = new AssetRequest(model, fileVolume, null, handler, false); model.setName(assetRequest.getBaseName()); assetRequest.setImportSettings(settings); assetRequest.useCache(cacheEnabled); try { if (ext.equals("x3d")) { loadX3DModel(assetRequest, model); } else { loadJassimpModel(assetRequest, model); } } catch (IOException ex) { // onModelError is generated in this case } } }); }
java
public void loadModel(final GVRResourceVolume fileVolume, final GVRSceneObject model, final EnumSet<GVRImportSettings> settings, final boolean cacheEnabled, final IAssetEvents handler) { Threads.spawn(new Runnable() { public void run() { String filePath = fileVolume.getFileName(); String ext = filePath.substring(filePath.length() - 3).toLowerCase(); AssetRequest assetRequest = new AssetRequest(model, fileVolume, null, handler, false); model.setName(assetRequest.getBaseName()); assetRequest.setImportSettings(settings); assetRequest.useCache(cacheEnabled); try { if (ext.equals("x3d")) { loadX3DModel(assetRequest, model); } else { loadJassimpModel(assetRequest, model); } } catch (IOException ex) { // onModelError is generated in this case } } }); }
[ "public", "void", "loadModel", "(", "final", "GVRResourceVolume", "fileVolume", ",", "final", "GVRSceneObject", "model", ",", "final", "EnumSet", "<", "GVRImportSettings", ">", "settings", ",", "final", "boolean", "cacheEnabled", ",", "final", "IAssetEvents", "handl...
Loads a scene object {@link GVRSceneObject} asynchronously from a 3D model and raises asset events to a handler. <p> This function is a good choice for loading assets because it does not block the thread from which it is initiated. Instead, it runs the load request on a background thread and issues events to the handler provided. </p> @param fileVolume GVRResourceVolume with the path to the model to load. The filename is relative to the root of this volume. The volume will be used to load models referenced by this model. @param model {@link GVRSceneObject} that is the root of the hierarchy generated by loading the 3D model. @param settings Additional import {@link GVRImportSettings settings} @param cacheEnabled If true, add the model's textures to the texture cache @param handler IAssetEvents handler to process asset loading events @see IAssetEvents #loadMesh(GVRAndroidResource.MeshCallback, GVRAndroidResource, int)
[ "Loads", "a", "scene", "object", "{", "@link", "GVRSceneObject", "}", "asynchronously", "from", "a", "3D", "model", "and", "raises", "asset", "events", "to", "a", "handler", ".", "<p", ">", "This", "function", "is", "a", "good", "choice", "for", "loading",...
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAssetLoader.java#L1571-L1605
netty/netty
common/src/main/java/io/netty/util/internal/ObjectUtil.java
ObjectUtil.checkNotNull
public static <T> T checkNotNull(T arg, String text) { """ Checks that the given argument is not null. If it is, throws {@link NullPointerException}. Otherwise, returns the argument. """ if (arg == null) { throw new NullPointerException(text); } return arg; }
java
public static <T> T checkNotNull(T arg, String text) { if (arg == null) { throw new NullPointerException(text); } return arg; }
[ "public", "static", "<", "T", ">", "T", "checkNotNull", "(", "T", "arg", ",", "String", "text", ")", "{", "if", "(", "arg", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "text", ")", ";", "}", "return", "arg", ";", "}" ]
Checks that the given argument is not null. If it is, throws {@link NullPointerException}. Otherwise, returns the argument.
[ "Checks", "that", "the", "given", "argument", "is", "not", "null", ".", "If", "it", "is", "throws", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/ObjectUtil.java#L31-L36
OpenLiberty/open-liberty
dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/asn1/DERBitString.java
DERBitString.getInstance
public static DERBitString getInstance( Object obj) { """ return a Bit String from the passed in object @exception IllegalArgumentException if the object cannot be converted. """ if (obj == null || obj instanceof DERBitString) { return (DERBitString)obj; } if (obj instanceof ASN1OctetString) { byte[] bytes = ((ASN1OctetString)obj).getOctets(); int padBits = bytes[0]; byte[] data = new byte[bytes.length - 1]; System.arraycopy(bytes, 1, data, 0, bytes.length - 1); return new DERBitString(data, padBits); } if (obj instanceof ASN1TaggedObject) { return getInstance(((ASN1TaggedObject)obj).getObject()); } throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName()); }
java
public static DERBitString getInstance( Object obj) { if (obj == null || obj instanceof DERBitString) { return (DERBitString)obj; } if (obj instanceof ASN1OctetString) { byte[] bytes = ((ASN1OctetString)obj).getOctets(); int padBits = bytes[0]; byte[] data = new byte[bytes.length - 1]; System.arraycopy(bytes, 1, data, 0, bytes.length - 1); return new DERBitString(data, padBits); } if (obj instanceof ASN1TaggedObject) { return getInstance(((ASN1TaggedObject)obj).getObject()); } throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName()); }
[ "public", "static", "DERBitString", "getInstance", "(", "Object", "obj", ")", "{", "if", "(", "obj", "==", "null", "||", "obj", "instanceof", "DERBitString", ")", "{", "return", "(", "DERBitString", ")", "obj", ";", "}", "if", "(", "obj", "instanceof", "...
return a Bit String from the passed in object @exception IllegalArgumentException if the object cannot be converted.
[ "return", "a", "Bit", "String", "from", "the", "passed", "in", "object" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/asn1/DERBitString.java#L107-L132
Stratio/cassandra-lucene-index
plugin/src/main/java/com/stratio/cassandra/lucene/search/condition/DateRangeCondition.java
DateRangeCondition.parseSpatialOperation
static SpatialOperation parseSpatialOperation(String operation) { """ Returns the {@link SpatialOperation} representing the specified {@code String}. @param operation a {@code String} representing a {@link SpatialOperation} @return the {@link SpatialOperation} representing the specified {@code String} """ if (operation == null) { throw new IndexException("Operation is required"); } else if (operation.equalsIgnoreCase("is_within")) { return SpatialOperation.IsWithin; } else if (operation.equalsIgnoreCase("contains")) { return SpatialOperation.Contains; } else if (operation.equalsIgnoreCase("intersects")) { return SpatialOperation.Intersects; } else { throw new IndexException("Operation is invalid: {}", operation); } }
java
static SpatialOperation parseSpatialOperation(String operation) { if (operation == null) { throw new IndexException("Operation is required"); } else if (operation.equalsIgnoreCase("is_within")) { return SpatialOperation.IsWithin; } else if (operation.equalsIgnoreCase("contains")) { return SpatialOperation.Contains; } else if (operation.equalsIgnoreCase("intersects")) { return SpatialOperation.Intersects; } else { throw new IndexException("Operation is invalid: {}", operation); } }
[ "static", "SpatialOperation", "parseSpatialOperation", "(", "String", "operation", ")", "{", "if", "(", "operation", "==", "null", ")", "{", "throw", "new", "IndexException", "(", "\"Operation is required\"", ")", ";", "}", "else", "if", "(", "operation", ".", ...
Returns the {@link SpatialOperation} representing the specified {@code String}. @param operation a {@code String} representing a {@link SpatialOperation} @return the {@link SpatialOperation} representing the specified {@code String}
[ "Returns", "the", "{", "@link", "SpatialOperation", "}", "representing", "the", "specified", "{", "@code", "String", "}", "." ]
train
https://github.com/Stratio/cassandra-lucene-index/blob/a94a4d9af6c25d40e1108729974c35c27c54441c/plugin/src/main/java/com/stratio/cassandra/lucene/search/condition/DateRangeCondition.java#L98-L110
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java
JBBPOut.BeginBin
public static JBBPOut BeginBin(final OutputStream out, final JBBPByteOrder byteOrder, final JBBPBitOrder bitOrder) { """ Start a DSL session for a defined stream with defined parameters. @param out the defined stream @param byteOrder the byte outOrder for the session @param bitOrder the bit outOrder for the session @return the new DSL session generated for the stream with parameters """ return new JBBPOut(out, byteOrder, bitOrder); }
java
public static JBBPOut BeginBin(final OutputStream out, final JBBPByteOrder byteOrder, final JBBPBitOrder bitOrder) { return new JBBPOut(out, byteOrder, bitOrder); }
[ "public", "static", "JBBPOut", "BeginBin", "(", "final", "OutputStream", "out", ",", "final", "JBBPByteOrder", "byteOrder", ",", "final", "JBBPBitOrder", "bitOrder", ")", "{", "return", "new", "JBBPOut", "(", "out", ",", "byteOrder", ",", "bitOrder", ")", ";",...
Start a DSL session for a defined stream with defined parameters. @param out the defined stream @param byteOrder the byte outOrder for the session @param bitOrder the bit outOrder for the session @return the new DSL session generated for the stream with parameters
[ "Start", "a", "DSL", "session", "for", "a", "defined", "stream", "with", "defined", "parameters", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java#L119-L121
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SignatureConverter.java
SignatureConverter.convertMethodSignature
public static String convertMethodSignature(InvokeInstruction inv, ConstantPoolGen cpg) { """ Convenience method for generating a method signature in human readable form. @param inv an InvokeInstruction @param cpg the ConstantPoolGen for the class the instruction belongs to """ return convertMethodSignature(inv.getClassName(cpg), inv.getName(cpg), inv.getSignature(cpg)); }
java
public static String convertMethodSignature(InvokeInstruction inv, ConstantPoolGen cpg) { return convertMethodSignature(inv.getClassName(cpg), inv.getName(cpg), inv.getSignature(cpg)); }
[ "public", "static", "String", "convertMethodSignature", "(", "InvokeInstruction", "inv", ",", "ConstantPoolGen", "cpg", ")", "{", "return", "convertMethodSignature", "(", "inv", ".", "getClassName", "(", "cpg", ")", ",", "inv", ".", "getName", "(", "cpg", ")", ...
Convenience method for generating a method signature in human readable form. @param inv an InvokeInstruction @param cpg the ConstantPoolGen for the class the instruction belongs to
[ "Convenience", "method", "for", "generating", "a", "method", "signature", "in", "human", "readable", "form", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SignatureConverter.java#L170-L172
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java
IoUtil.readUtf8Lines
public static <T extends Collection<String>> T readUtf8Lines(InputStream in, T collection) throws IORuntimeException { """ 从流中读取内容,使用UTF-8编码 @param <T> 集合类型 @param in 输入流 @param collection 返回集合 @return 内容 @throws IORuntimeException IO异常 """ return readLines(in, CharsetUtil.CHARSET_UTF_8, collection); }
java
public static <T extends Collection<String>> T readUtf8Lines(InputStream in, T collection) throws IORuntimeException { return readLines(in, CharsetUtil.CHARSET_UTF_8, collection); }
[ "public", "static", "<", "T", "extends", "Collection", "<", "String", ">", ">", "T", "readUtf8Lines", "(", "InputStream", "in", ",", "T", "collection", ")", "throws", "IORuntimeException", "{", "return", "readLines", "(", "in", ",", "CharsetUtil", ".", "CHAR...
从流中读取内容,使用UTF-8编码 @param <T> 集合类型 @param in 输入流 @param collection 返回集合 @return 内容 @throws IORuntimeException IO异常
[ "从流中读取内容,使用UTF", "-", "8编码" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L630-L632
zaproxy/zaproxy
src/org/zaproxy/zap/extension/httpsessions/ExtensionHttpSessions.java
ExtensionHttpSessions.markRemovedDefaultSessionToken
private void markRemovedDefaultSessionToken(String site, String token) { """ Marks a default session token as removed for a particular site. @param site the site. This parameter has to be formed as defined in the {@link ExtensionHttpSessions} class documentation. @param token the token """ if (removedDefaultTokens == null) removedDefaultTokens = new HashMap<>(1); HashSet<String> removedSet = removedDefaultTokens.get(site); if (removedSet == null) { removedSet = new HashSet<>(1); removedDefaultTokens.put(site, removedSet); } removedSet.add(token); }
java
private void markRemovedDefaultSessionToken(String site, String token) { if (removedDefaultTokens == null) removedDefaultTokens = new HashMap<>(1); HashSet<String> removedSet = removedDefaultTokens.get(site); if (removedSet == null) { removedSet = new HashSet<>(1); removedDefaultTokens.put(site, removedSet); } removedSet.add(token); }
[ "private", "void", "markRemovedDefaultSessionToken", "(", "String", "site", ",", "String", "token", ")", "{", "if", "(", "removedDefaultTokens", "==", "null", ")", "removedDefaultTokens", "=", "new", "HashMap", "<>", "(", "1", ")", ";", "HashSet", "<", "String...
Marks a default session token as removed for a particular site. @param site the site. This parameter has to be formed as defined in the {@link ExtensionHttpSessions} class documentation. @param token the token
[ "Marks", "a", "default", "session", "token", "as", "removed", "for", "a", "particular", "site", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/httpsessions/ExtensionHttpSessions.java#L325-L334
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java
DocBookBuildUtilities.convertDocumentToDocBookFormattedString
public static String convertDocumentToDocBookFormattedString(final DocBookVersion docBookVersion, final Document doc, final String elementName, final String entityName, final XMLFormatProperties xmlFormatProperties) { """ Convert a DOM Document to a DocBook Formatted String representation including the XML preamble and DOCTYPE/namespaces. @param docBookVersion The DocBook version to add the preamble content for. @param doc The DOM Document to be converted and formatted. @param elementName The name that the root element should be. @param entityName The name of the local entity file, if one exists. @param xmlFormatProperties The XML Formatting Properties. @return The converted XML String representation. """ final String formattedXML = convertDocumentToFormattedString(doc, xmlFormatProperties); return addDocBookPreamble(docBookVersion, formattedXML, elementName, entityName); }
java
public static String convertDocumentToDocBookFormattedString(final DocBookVersion docBookVersion, final Document doc, final String elementName, final String entityName, final XMLFormatProperties xmlFormatProperties) { final String formattedXML = convertDocumentToFormattedString(doc, xmlFormatProperties); return addDocBookPreamble(docBookVersion, formattedXML, elementName, entityName); }
[ "public", "static", "String", "convertDocumentToDocBookFormattedString", "(", "final", "DocBookVersion", "docBookVersion", ",", "final", "Document", "doc", ",", "final", "String", "elementName", ",", "final", "String", "entityName", ",", "final", "XMLFormatProperties", ...
Convert a DOM Document to a DocBook Formatted String representation including the XML preamble and DOCTYPE/namespaces. @param docBookVersion The DocBook version to add the preamble content for. @param doc The DOM Document to be converted and formatted. @param elementName The name that the root element should be. @param entityName The name of the local entity file, if one exists. @param xmlFormatProperties The XML Formatting Properties. @return The converted XML String representation.
[ "Convert", "a", "DOM", "Document", "to", "a", "DocBook", "Formatted", "String", "representation", "including", "the", "XML", "preamble", "and", "DOCTYPE", "/", "namespaces", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java#L442-L446
kuali/ojb-1.0.4
src/ejb/org/apache/ojb/ejb/odmg/RollbackBean.java
RollbackBean.rollbackClientWrongInput
public void rollbackClientWrongInput(List articles, List persons) { """ This test method expect an invalid object in the person list, so that OJB cause an internal error. @ejb:interface-method """ log.info("rollbackClientWrongInput method was called"); ArticleManagerODMGLocal am = getArticleManager(); PersonManagerODMGLocal pm = getPersonManager(); am.storeArticles(articles); pm.storePersons(persons); }
java
public void rollbackClientWrongInput(List articles, List persons) { log.info("rollbackClientWrongInput method was called"); ArticleManagerODMGLocal am = getArticleManager(); PersonManagerODMGLocal pm = getPersonManager(); am.storeArticles(articles); pm.storePersons(persons); }
[ "public", "void", "rollbackClientWrongInput", "(", "List", "articles", ",", "List", "persons", ")", "{", "log", ".", "info", "(", "\"rollbackClientWrongInput method was called\"", ")", ";", "ArticleManagerODMGLocal", "am", "=", "getArticleManager", "(", ")", ";", "P...
This test method expect an invalid object in the person list, so that OJB cause an internal error. @ejb:interface-method
[ "This", "test", "method", "expect", "an", "invalid", "object", "in", "the", "person", "list", "so", "that", "OJB", "cause", "an", "internal", "error", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/ejb/org/apache/ojb/ejb/odmg/RollbackBean.java#L163-L170
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java
ApiOvhDedicatedCloud.location_pccZone_stock_zpool_GET
public ArrayList<OvhZpoolStockProfile> location_pccZone_stock_zpool_GET(String pccZone, String profileFilter) throws IOException { """ Available zpool stock REST: GET /dedicatedCloud/location/{pccZone}/stock/zpool @param profileFilter [required] Profile filter @param pccZone [required] Name of pccZone """ String qPath = "/dedicatedCloud/location/{pccZone}/stock/zpool"; StringBuilder sb = path(qPath, pccZone); query(sb, "profileFilter", profileFilter); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t7); }
java
public ArrayList<OvhZpoolStockProfile> location_pccZone_stock_zpool_GET(String pccZone, String profileFilter) throws IOException { String qPath = "/dedicatedCloud/location/{pccZone}/stock/zpool"; StringBuilder sb = path(qPath, pccZone); query(sb, "profileFilter", profileFilter); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t7); }
[ "public", "ArrayList", "<", "OvhZpoolStockProfile", ">", "location_pccZone_stock_zpool_GET", "(", "String", "pccZone", ",", "String", "profileFilter", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicatedCloud/location/{pccZone}/stock/zpool\"", ";", "Stri...
Available zpool stock REST: GET /dedicatedCloud/location/{pccZone}/stock/zpool @param profileFilter [required] Profile filter @param pccZone [required] Name of pccZone
[ "Available", "zpool", "stock" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L3022-L3028
alkacon/opencms-core
src/org/opencms/ade/galleries/CmsGalleryService.java
CmsGalleryService.isEditable
boolean isEditable(CmsObject cms, CmsResource resource) { """ Checks if the current user has write permissions on the given resource.<p> @param cms the current cms context @param resource the resource to check @return <code>true</code> if the current user has write permissions on the given resource """ try { return cms.hasPermissions(resource, CmsPermissionSet.ACCESS_WRITE, false, CmsResourceFilter.ALL); } catch (CmsException e) { return false; } }
java
boolean isEditable(CmsObject cms, CmsResource resource) { try { return cms.hasPermissions(resource, CmsPermissionSet.ACCESS_WRITE, false, CmsResourceFilter.ALL); } catch (CmsException e) { return false; } }
[ "boolean", "isEditable", "(", "CmsObject", "cms", ",", "CmsResource", "resource", ")", "{", "try", "{", "return", "cms", ".", "hasPermissions", "(", "resource", ",", "CmsPermissionSet", ".", "ACCESS_WRITE", ",", "false", ",", "CmsResourceFilter", ".", "ALL", "...
Checks if the current user has write permissions on the given resource.<p> @param cms the current cms context @param resource the resource to check @return <code>true</code> if the current user has write permissions on the given resource
[ "Checks", "if", "the", "current", "user", "has", "write", "permissions", "on", "the", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/galleries/CmsGalleryService.java#L1529-L1536
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/CmsGalleryController.java
CmsGalleryController.selectResource
public void selectResource(String resourcePath, CmsUUID structureId, String title, String resourceType) { """ Selects the given resource and sets its path into the xml-content field or editor link.<p> @param resourcePath the resource path @param structureId the structure id @param title the resource title @param resourceType the resource type """ String provider = getProviderName(resourceType); if (provider == null) { // use {@link org.opencms.ade.galleries.client.preview.CmsBinaryPreviewProvider} as default to select a resource provider = I_CmsBinaryPreviewProvider.PREVIEW_NAME; } if (m_previewFactoryRegistration.containsKey(provider)) { m_previewFactoryRegistration.get(provider).getPreview(m_handler.m_galleryDialog).selectResource( resourcePath, structureId, title); } else { CmsDebugLog.getInstance().printLine("No provider available"); } }
java
public void selectResource(String resourcePath, CmsUUID structureId, String title, String resourceType) { String provider = getProviderName(resourceType); if (provider == null) { // use {@link org.opencms.ade.galleries.client.preview.CmsBinaryPreviewProvider} as default to select a resource provider = I_CmsBinaryPreviewProvider.PREVIEW_NAME; } if (m_previewFactoryRegistration.containsKey(provider)) { m_previewFactoryRegistration.get(provider).getPreview(m_handler.m_galleryDialog).selectResource( resourcePath, structureId, title); } else { CmsDebugLog.getInstance().printLine("No provider available"); } }
[ "public", "void", "selectResource", "(", "String", "resourcePath", ",", "CmsUUID", "structureId", ",", "String", "title", ",", "String", "resourceType", ")", "{", "String", "provider", "=", "getProviderName", "(", "resourceType", ")", ";", "if", "(", "provider",...
Selects the given resource and sets its path into the xml-content field or editor link.<p> @param resourcePath the resource path @param structureId the structure id @param title the resource title @param resourceType the resource type
[ "Selects", "the", "given", "resource", "and", "sets", "its", "path", "into", "the", "xml", "-", "content", "field", "or", "editor", "link", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/CmsGalleryController.java#L1246-L1262
ecclesia/kipeto
kipeto-core/src/main/java/de/ecclesia/kipeto/repository/FileRepositoryStrategy.java
FileRepositoryStrategy.subDirForId
private File subDirForId(String id) { """ Ermittelt anhand der <code>SUBDIR_POLICY</code> das Unterverzeichnis, in dem das Item zu der übergebenen Id gepeichert ist bzw. werden muss. } Das Verzeichnis wird angelegt, falls es nicht existiert. @param id des Items @return Verzeichnis, in dem das Item gespeichert ist bzw. werden soll. """ File subDir = new File(objs, id.substring(0, SUBDIR_POLICY)); if (!subDir.exists()) { subDir.mkdirs(); } return subDir; }
java
private File subDirForId(String id) { File subDir = new File(objs, id.substring(0, SUBDIR_POLICY)); if (!subDir.exists()) { subDir.mkdirs(); } return subDir; }
[ "private", "File", "subDirForId", "(", "String", "id", ")", "{", "File", "subDir", "=", "new", "File", "(", "objs", ",", "id", ".", "substring", "(", "0", ",", "SUBDIR_POLICY", ")", ")", ";", "if", "(", "!", "subDir", ".", "exists", "(", ")", ")", ...
Ermittelt anhand der <code>SUBDIR_POLICY</code> das Unterverzeichnis, in dem das Item zu der übergebenen Id gepeichert ist bzw. werden muss. } Das Verzeichnis wird angelegt, falls es nicht existiert. @param id des Items @return Verzeichnis, in dem das Item gespeichert ist bzw. werden soll.
[ "Ermittelt", "anhand", "der", "<code", ">", "SUBDIR_POLICY<", "/", "code", ">", "das", "Unterverzeichnis", "in", "dem", "das", "Item", "zu", "der", "übergebenen", "Id", "gepeichert", "ist", "bzw", ".", "werden", "muss", "." ]
train
https://github.com/ecclesia/kipeto/blob/ea39a10ae4eaa550f71a856ab2f2845270a64913/kipeto-core/src/main/java/de/ecclesia/kipeto/repository/FileRepositoryStrategy.java#L216-L224
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.updateSubscription
public Subscription updateSubscription(final String uuid, final SubscriptionUpdate subscriptionUpdate) { """ Update a particular {@link Subscription} by it's UUID <p> Returns information about a single subscription. @param uuid UUID of the subscription to update @param subscriptionUpdate subscriptionUpdate object @return Subscription the updated subscription """ return doPUT(Subscriptions.SUBSCRIPTIONS_RESOURCE + "/" + uuid, subscriptionUpdate, Subscription.class); }
java
public Subscription updateSubscription(final String uuid, final SubscriptionUpdate subscriptionUpdate) { return doPUT(Subscriptions.SUBSCRIPTIONS_RESOURCE + "/" + uuid, subscriptionUpdate, Subscription.class); }
[ "public", "Subscription", "updateSubscription", "(", "final", "String", "uuid", ",", "final", "SubscriptionUpdate", "subscriptionUpdate", ")", "{", "return", "doPUT", "(", "Subscriptions", ".", "SUBSCRIPTIONS_RESOURCE", "+", "\"/\"", "+", "uuid", ",", "subscriptionUpd...
Update a particular {@link Subscription} by it's UUID <p> Returns information about a single subscription. @param uuid UUID of the subscription to update @param subscriptionUpdate subscriptionUpdate object @return Subscription the updated subscription
[ "Update", "a", "particular", "{", "@link", "Subscription", "}", "by", "it", "s", "UUID", "<p", ">", "Returns", "information", "about", "a", "single", "subscription", "." ]
train
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L588-L593
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.touch
public static File touch(File parent, String path) throws IORuntimeException { """ 创建文件及其父目录,如果这个文件存在,直接返回这个文件<br> 此方法不对File对象类型做判断,如果File不存在,无法判断其类型 @param parent 父文件对象 @param path 文件路径 @return File @throws IORuntimeException IO异常 """ return touch(file(parent, path)); }
java
public static File touch(File parent, String path) throws IORuntimeException { return touch(file(parent, path)); }
[ "public", "static", "File", "touch", "(", "File", "parent", ",", "String", "path", ")", "throws", "IORuntimeException", "{", "return", "touch", "(", "file", "(", "parent", ",", "path", ")", ")", ";", "}" ]
创建文件及其父目录,如果这个文件存在,直接返回这个文件<br> 此方法不对File对象类型做判断,如果File不存在,无法判断其类型 @param parent 父文件对象 @param path 文件路径 @return File @throws IORuntimeException IO异常
[ "创建文件及其父目录,如果这个文件存在,直接返回这个文件<br", ">", "此方法不对File对象类型做判断,如果File不存在,无法判断其类型" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L634-L636
xqbase/tuna
core/src/main/java/com/xqbase/tuna/ConnectionWrapper.java
ConnectionWrapper.onRecv
@Override public void onRecv(byte[] b, int off, int len) { """ Wraps received data, from the network side to the application side """ connection.onRecv(b, off, len); }
java
@Override public void onRecv(byte[] b, int off, int len) { connection.onRecv(b, off, len); }
[ "@", "Override", "public", "void", "onRecv", "(", "byte", "[", "]", "b", ",", "int", "off", ",", "int", "len", ")", "{", "connection", ".", "onRecv", "(", "b", ",", "off", ",", "len", ")", ";", "}" ]
Wraps received data, from the network side to the application side
[ "Wraps", "received", "data", "from", "the", "network", "side", "to", "the", "application", "side" ]
train
https://github.com/xqbase/tuna/blob/60d05a9e03877a3daafe9de83dc4427c6cbb9995/core/src/main/java/com/xqbase/tuna/ConnectionWrapper.java#L16-L19
contentful/contentful-management.java
src/main/java/com/contentful/java/cma/ModuleEntries.java
ModuleEntries.fetchOne
public CMAEntry fetchOne(String spaceId, String environmentId, String entryId) { """ Fetch an entry with the given entryId from the given environment and space. @param spaceId Space ID @param environmentId Environment ID @param entryId Entry ID @return {@link CMAEntry} result instance @throws IllegalArgumentException if space id is null. @throws IllegalArgumentException if environment id is null. @throws IllegalArgumentException if entry id is null. """ assertNotNull(spaceId, "spaceId"); assertNotNull(environmentId, "environmentId"); assertNotNull(entryId, "entryId"); return service.fetchOne(spaceId, environmentId, entryId).blockingFirst(); }
java
public CMAEntry fetchOne(String spaceId, String environmentId, String entryId) { assertNotNull(spaceId, "spaceId"); assertNotNull(environmentId, "environmentId"); assertNotNull(entryId, "entryId"); return service.fetchOne(spaceId, environmentId, entryId).blockingFirst(); }
[ "public", "CMAEntry", "fetchOne", "(", "String", "spaceId", ",", "String", "environmentId", ",", "String", "entryId", ")", "{", "assertNotNull", "(", "spaceId", ",", "\"spaceId\"", ")", ";", "assertNotNull", "(", "environmentId", ",", "\"environmentId\"", ")", "...
Fetch an entry with the given entryId from the given environment and space. @param spaceId Space ID @param environmentId Environment ID @param entryId Entry ID @return {@link CMAEntry} result instance @throws IllegalArgumentException if space id is null. @throws IllegalArgumentException if environment id is null. @throws IllegalArgumentException if entry id is null.
[ "Fetch", "an", "entry", "with", "the", "given", "entryId", "from", "the", "given", "environment", "and", "space", "." ]
train
https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/ModuleEntries.java#L266-L271
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpClient.java
AmqpClient.closedHandler
void closedHandler(Object context, String input, Object frame, String stateName) { """ should be the order following in all our client implementations. """ if (getReadyState() == ReadyState.CLOSED) { return; } // TODO: Determine whether channels need to be cleaned up. if (this.channels.size() != 0) { for (int i = 1; i <= this.channels.size(); i++) { // 1-based AmqpChannel channel = this.channels.get(i); AmqpFrame f = new AmqpFrame(); // Close each channel which should result in CLOSE event // to be fired for each of the registered ChannelListener(s). f.setMethodName("closeChannel"); f.setChannelId((short) i); channel.channelClosedHandler(this, "", f, "closeChannel"); } } try { // Mark the readyState to be CLOSED. readyState = ReadyState.CLOSED; // Fire CLOSE event for the ConnectionListener(s) registered // on AmqpClient object. fireOnClosed(new ConnectionEvent(this, Kind.CLOSE)); // If the WebSocket(or ByteSocket) is still not closed, then // invoke the close() method. The callback in this case will be a // a no-op as we have completed the book-keeping here. if (websocket != null) { websocket.close(); } } catch (Exception e1) { throw new IllegalStateException(e1); } finally { websocket = null; } }
java
void closedHandler(Object context, String input, Object frame, String stateName) { if (getReadyState() == ReadyState.CLOSED) { return; } // TODO: Determine whether channels need to be cleaned up. if (this.channels.size() != 0) { for (int i = 1; i <= this.channels.size(); i++) { // 1-based AmqpChannel channel = this.channels.get(i); AmqpFrame f = new AmqpFrame(); // Close each channel which should result in CLOSE event // to be fired for each of the registered ChannelListener(s). f.setMethodName("closeChannel"); f.setChannelId((short) i); channel.channelClosedHandler(this, "", f, "closeChannel"); } } try { // Mark the readyState to be CLOSED. readyState = ReadyState.CLOSED; // Fire CLOSE event for the ConnectionListener(s) registered // on AmqpClient object. fireOnClosed(new ConnectionEvent(this, Kind.CLOSE)); // If the WebSocket(or ByteSocket) is still not closed, then // invoke the close() method. The callback in this case will be a // a no-op as we have completed the book-keeping here. if (websocket != null) { websocket.close(); } } catch (Exception e1) { throw new IllegalStateException(e1); } finally { websocket = null; } }
[ "void", "closedHandler", "(", "Object", "context", ",", "String", "input", ",", "Object", "frame", ",", "String", "stateName", ")", "{", "if", "(", "getReadyState", "(", ")", "==", "ReadyState", ".", "CLOSED", ")", "{", "return", ";", "}", "// TODO: Determ...
should be the order following in all our client implementations.
[ "should", "be", "the", "order", "following", "in", "all", "our", "client", "implementations", "." ]
train
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpClient.java#L593-L634
mcpat/microjiac-public
tools/microjiac-midlet-maven-plugin/src/main/java/de/jiac/micro/mojo/ConfiguratorMojo.java
ConfiguratorMojo.execute
public void execute() throws MojoExecutionException { """ Processes all dependencies first and then creates a new JVM to generate the configurator implementation with. """ ClassLoader classloader; try { classloader= createClassLoader(); } catch (Exception e) { throw new MojoExecutionException("could not create classloader from dependencies", e); } AbstractConfiguration[] configurations; try { configurations= ConfigurationGenerator.execute(generatedSourceDirectory, applicationDefinition, classloader, getSLF4JLogger()); } catch (Exception e) { throw new MojoExecutionException("could not generate the configurator", e); } getPluginContext().put(GENERATED_CONFIGURATIONS_KEY, configurations); project.addCompileSourceRoot(generatedSourceDirectory.getPath()); }
java
public void execute() throws MojoExecutionException { ClassLoader classloader; try { classloader= createClassLoader(); } catch (Exception e) { throw new MojoExecutionException("could not create classloader from dependencies", e); } AbstractConfiguration[] configurations; try { configurations= ConfigurationGenerator.execute(generatedSourceDirectory, applicationDefinition, classloader, getSLF4JLogger()); } catch (Exception e) { throw new MojoExecutionException("could not generate the configurator", e); } getPluginContext().put(GENERATED_CONFIGURATIONS_KEY, configurations); project.addCompileSourceRoot(generatedSourceDirectory.getPath()); }
[ "public", "void", "execute", "(", ")", "throws", "MojoExecutionException", "{", "ClassLoader", "classloader", ";", "try", "{", "classloader", "=", "createClassLoader", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "MojoExecution...
Processes all dependencies first and then creates a new JVM to generate the configurator implementation with.
[ "Processes", "all", "dependencies", "first", "and", "then", "creates", "a", "new", "JVM", "to", "generate", "the", "configurator", "implementation", "with", "." ]
train
https://github.com/mcpat/microjiac-public/blob/3c649e44846981a68e84cc4578719532414d8d35/tools/microjiac-midlet-maven-plugin/src/main/java/de/jiac/micro/mojo/ConfiguratorMojo.java#L185-L204
aws/aws-sdk-java
aws-java-sdk-kinesisvideo/src/main/java/com/amazonaws/services/kinesisvideo/internal/netty/handler/PutMediaDecoder.java
PutMediaDecoder.decodeAckEvent
private static void decodeAckEvent(ByteBuf in, List<Object> decodedOut) throws IOException { """ Decode ByteBuf to AckEvent objects. @param in byte buf @param decodedOut list of AckEvent objects """ int readerIndex = in.readerIndex(); int writerIndex = in.writerIndex(); for (; readerIndex < writerIndex; ++readerIndex) { // Read one byte at a time to avoid incrementing reader index byte c = in.getByte(readerIndex); if (NEW_LINE == c) { ByteBuf json = extractObject(in, in.readerIndex(), readerIndex - in.readerIndex()); if (json != null) { decodedOut.add(unmarshall(json)); } in.readerIndex(readerIndex + 1); in.discardReadBytes(); // Reader and writer index shift after discard. Update them readerIndex = in.readerIndex(); writerIndex = in.writerIndex(); ReferenceCountUtil.release(json); } } }
java
private static void decodeAckEvent(ByteBuf in, List<Object> decodedOut) throws IOException { int readerIndex = in.readerIndex(); int writerIndex = in.writerIndex(); for (; readerIndex < writerIndex; ++readerIndex) { // Read one byte at a time to avoid incrementing reader index byte c = in.getByte(readerIndex); if (NEW_LINE == c) { ByteBuf json = extractObject(in, in.readerIndex(), readerIndex - in.readerIndex()); if (json != null) { decodedOut.add(unmarshall(json)); } in.readerIndex(readerIndex + 1); in.discardReadBytes(); // Reader and writer index shift after discard. Update them readerIndex = in.readerIndex(); writerIndex = in.writerIndex(); ReferenceCountUtil.release(json); } } }
[ "private", "static", "void", "decodeAckEvent", "(", "ByteBuf", "in", ",", "List", "<", "Object", ">", "decodedOut", ")", "throws", "IOException", "{", "int", "readerIndex", "=", "in", ".", "readerIndex", "(", ")", ";", "int", "writerIndex", "=", "in", ".",...
Decode ByteBuf to AckEvent objects. @param in byte buf @param decodedOut list of AckEvent objects
[ "Decode", "ByteBuf", "to", "AckEvent", "objects", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-kinesisvideo/src/main/java/com/amazonaws/services/kinesisvideo/internal/netty/handler/PutMediaDecoder.java#L63-L83
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.setCertificateContactsAsync
public ServiceFuture<Contacts> setCertificateContactsAsync(String vaultBaseUrl, Contacts contacts, final ServiceCallback<Contacts> serviceCallback) { """ Sets the certificate contacts for the specified key vault. Sets the certificate contacts for the specified key vault. This operation requires the certificates/managecontacts permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param contacts The contacts for the key vault certificate. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object """ return ServiceFuture.fromResponse(setCertificateContactsWithServiceResponseAsync(vaultBaseUrl, contacts), serviceCallback); }
java
public ServiceFuture<Contacts> setCertificateContactsAsync(String vaultBaseUrl, Contacts contacts, final ServiceCallback<Contacts> serviceCallback) { return ServiceFuture.fromResponse(setCertificateContactsWithServiceResponseAsync(vaultBaseUrl, contacts), serviceCallback); }
[ "public", "ServiceFuture", "<", "Contacts", ">", "setCertificateContactsAsync", "(", "String", "vaultBaseUrl", ",", "Contacts", "contacts", ",", "final", "ServiceCallback", "<", "Contacts", ">", "serviceCallback", ")", "{", "return", "ServiceFuture", ".", "fromRespons...
Sets the certificate contacts for the specified key vault. Sets the certificate contacts for the specified key vault. This operation requires the certificates/managecontacts permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param contacts The contacts for the key vault certificate. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Sets", "the", "certificate", "contacts", "for", "the", "specified", "key", "vault", ".", "Sets", "the", "certificate", "contacts", "for", "the", "specified", "key", "vault", ".", "This", "operation", "requires", "the", "certificates", "/", "managecontacts", "pe...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L5427-L5429
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/Manager.java
Manager.getDatabase
@InterfaceAudience.Public public Database getDatabase(String name) throws CouchbaseLiteException { """ <p> Returns the database with the given name, or creates it if it doesn't exist. Multiple calls with the same name will return the same {@link Database} instance. <p/> <p> This is equivalent to calling {@link #openDatabase(String, DatabaseOptions)} with a default set of options with the `Create` flag set. </p> <p> NOTE: Database names may not contain capital letters. </p> """ DatabaseOptions options = getDefaultOptions(name); options.setCreate(true); return openDatabase(name, options); }
java
@InterfaceAudience.Public public Database getDatabase(String name) throws CouchbaseLiteException { DatabaseOptions options = getDefaultOptions(name); options.setCreate(true); return openDatabase(name, options); }
[ "@", "InterfaceAudience", ".", "Public", "public", "Database", "getDatabase", "(", "String", "name", ")", "throws", "CouchbaseLiteException", "{", "DatabaseOptions", "options", "=", "getDefaultOptions", "(", "name", ")", ";", "options", ".", "setCreate", "(", "tru...
<p> Returns the database with the given name, or creates it if it doesn't exist. Multiple calls with the same name will return the same {@link Database} instance. <p/> <p> This is equivalent to calling {@link #openDatabase(String, DatabaseOptions)} with a default set of options with the `Create` flag set. </p> <p> NOTE: Database names may not contain capital letters. </p>
[ "<p", ">", "Returns", "the", "database", "with", "the", "given", "name", "or", "creates", "it", "if", "it", "doesn", "t", "exist", ".", "Multiple", "calls", "with", "the", "same", "name", "will", "return", "the", "same", "{" ]
train
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/Manager.java#L301-L306
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/TableWorks.java
TableWorks.addExprIndex
Index addExprIndex(int[] col, Expression[] indexExprs, HsqlName name, boolean unique, boolean migrating, Expression predicate) { """ A VoltDB extended variant of addIndex that supports indexed generalized non-column expressions. @param cols int[] @param indexExprs Expression[] @param name HsqlName @param unique boolean @param predicate Expression @return new index """ Index newindex; if (table.isEmpty(session) || table.isIndexingMutable()) { newindex = table.createAndAddExprIndexStructure(name, col, indexExprs, unique, migrating, false); } else { newindex = table.createIndexStructure(name, col, null, null, unique, migrating, false, false).withExpressions(indexExprs); Table tn = table.moveDefinition(session, table.tableType, null, null, newindex, -1, 0, emptySet, emptySet); // for all sessions move the data tn.moveData(session, table, -1, 0); database.persistentStoreCollection.releaseStore(table); table = tn; setNewTableInSchema(table); updateConstraints(table, emptySet); } database.schemaManager.addSchemaObject(newindex); database.schemaManager.recompileDependentObjects(table); if (predicate != null) { newindex = newindex.withPredicate(predicate); } return newindex; }
java
Index addExprIndex(int[] col, Expression[] indexExprs, HsqlName name, boolean unique, boolean migrating, Expression predicate) { Index newindex; if (table.isEmpty(session) || table.isIndexingMutable()) { newindex = table.createAndAddExprIndexStructure(name, col, indexExprs, unique, migrating, false); } else { newindex = table.createIndexStructure(name, col, null, null, unique, migrating, false, false).withExpressions(indexExprs); Table tn = table.moveDefinition(session, table.tableType, null, null, newindex, -1, 0, emptySet, emptySet); // for all sessions move the data tn.moveData(session, table, -1, 0); database.persistentStoreCollection.releaseStore(table); table = tn; setNewTableInSchema(table); updateConstraints(table, emptySet); } database.schemaManager.addSchemaObject(newindex); database.schemaManager.recompileDependentObjects(table); if (predicate != null) { newindex = newindex.withPredicate(predicate); } return newindex; }
[ "Index", "addExprIndex", "(", "int", "[", "]", "col", ",", "Expression", "[", "]", "indexExprs", ",", "HsqlName", "name", ",", "boolean", "unique", ",", "boolean", "migrating", ",", "Expression", "predicate", ")", "{", "Index", "newindex", ";", "if", "(", ...
A VoltDB extended variant of addIndex that supports indexed generalized non-column expressions. @param cols int[] @param indexExprs Expression[] @param name HsqlName @param unique boolean @param predicate Expression @return new index
[ "A", "VoltDB", "extended", "variant", "of", "addIndex", "that", "supports", "indexed", "generalized", "non", "-", "column", "expressions", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/TableWorks.java#L1172-L1203
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapHelper.java
LdapHelper.cloneAttribute
public static Attribute cloneAttribute(String newAttrName, Attribute attr) throws WIMSystemException { """ Clone the specified attribute with a new name. @param newAttrName The new name of the attribute @param attr The Attribute object to be cloned. @return The cloned Attribute object with the new name. @throws WIMSystemException """ Attribute newAttr = new BasicAttribute(newAttrName); try { for (NamingEnumeration<?> neu = attr.getAll(); neu.hasMoreElements();) { newAttr.add(neu.nextElement()); } } catch (NamingException e) { throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)))); } return newAttr; }
java
public static Attribute cloneAttribute(String newAttrName, Attribute attr) throws WIMSystemException { Attribute newAttr = new BasicAttribute(newAttrName); try { for (NamingEnumeration<?> neu = attr.getAll(); neu.hasMoreElements();) { newAttr.add(neu.nextElement()); } } catch (NamingException e) { throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)))); } return newAttr; }
[ "public", "static", "Attribute", "cloneAttribute", "(", "String", "newAttrName", ",", "Attribute", "attr", ")", "throws", "WIMSystemException", "{", "Attribute", "newAttr", "=", "new", "BasicAttribute", "(", "newAttrName", ")", ";", "try", "{", "for", "(", "Nami...
Clone the specified attribute with a new name. @param newAttrName The new name of the attribute @param attr The Attribute object to be cloned. @return The cloned Attribute object with the new name. @throws WIMSystemException
[ "Clone", "the", "specified", "attribute", "with", "a", "new", "name", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapHelper.java#L898-L908
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderTransaction.java
SpiderTransaction.addLinkValue
public void addLinkValue(String ownerObjID, FieldDefinition linkDef, String targetObjID) { """ Add a link value column to the objects store of the given object ID. @param ownerObjID Object ID of object owns the link field. @param linkDef {@link FieldDefinition} of the link field. @param targetObjID Referenced (target) object ID. """ addColumn(SpiderService.objectsStoreName(linkDef.getTableDef()), ownerObjID, SpiderService.linkColumnName(linkDef, targetObjID)); }
java
public void addLinkValue(String ownerObjID, FieldDefinition linkDef, String targetObjID) { addColumn(SpiderService.objectsStoreName(linkDef.getTableDef()), ownerObjID, SpiderService.linkColumnName(linkDef, targetObjID)); }
[ "public", "void", "addLinkValue", "(", "String", "ownerObjID", ",", "FieldDefinition", "linkDef", ",", "String", "targetObjID", ")", "{", "addColumn", "(", "SpiderService", ".", "objectsStoreName", "(", "linkDef", ".", "getTableDef", "(", ")", ")", ",", "ownerOb...
Add a link value column to the objects store of the given object ID. @param ownerObjID Object ID of object owns the link field. @param linkDef {@link FieldDefinition} of the link field. @param targetObjID Referenced (target) object ID.
[ "Add", "a", "link", "value", "column", "to", "the", "objects", "store", "of", "the", "given", "object", "ID", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderTransaction.java#L252-L256
jayantk/jklol
src/com/jayantkrish/jklol/ccg/chart/CcgExactChart.java
CcgExactChart.decodeBestParseForSpan
public CcgParse decodeBestParseForSpan(int spanStart, int spanEnd, CcgParser parser) { """ Gets the best CCG parse for the given span. Returns {@code null} if no parse was found. @param spanStart @param spanEnd @param parser @return """ double maxProb = -1; int maxEntryIndex = -1; double[] probs = getChartEntryProbsForSpan(spanStart, spanEnd); for (int i = 0; i < chartSizes[spanStart][spanEnd]; i++) { if (probs[i] > maxProb) { maxProb = probs[i]; maxEntryIndex = i; } } if (maxEntryIndex == -1) { // No parses. return null; } else { return decodeParseFromSpan(spanStart, spanEnd, maxEntryIndex, parser); } }
java
public CcgParse decodeBestParseForSpan(int spanStart, int spanEnd, CcgParser parser) { double maxProb = -1; int maxEntryIndex = -1; double[] probs = getChartEntryProbsForSpan(spanStart, spanEnd); for (int i = 0; i < chartSizes[spanStart][spanEnd]; i++) { if (probs[i] > maxProb) { maxProb = probs[i]; maxEntryIndex = i; } } if (maxEntryIndex == -1) { // No parses. return null; } else { return decodeParseFromSpan(spanStart, spanEnd, maxEntryIndex, parser); } }
[ "public", "CcgParse", "decodeBestParseForSpan", "(", "int", "spanStart", ",", "int", "spanEnd", ",", "CcgParser", "parser", ")", "{", "double", "maxProb", "=", "-", "1", ";", "int", "maxEntryIndex", "=", "-", "1", ";", "double", "[", "]", "probs", "=", "...
Gets the best CCG parse for the given span. Returns {@code null} if no parse was found. @param spanStart @param spanEnd @param parser @return
[ "Gets", "the", "best", "CCG", "parse", "for", "the", "given", "span", ".", "Returns", "{", "@code", "null", "}", "if", "no", "parse", "was", "found", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/chart/CcgExactChart.java#L55-L72
kkopacz/agiso-tempel
templates/abstract-directoryExtenderEngine/src/main/java/org/agiso/tempel/engine/DirectoryExtenderEngine.java
DirectoryExtenderEngine.processVelocityResource
protected void processVelocityResource(ITemplateSource source, Map<String, Object> params, String target) throws Exception { """ Szablon może być pojedynczym katalogiem. W takiej sytuacji przetwarzane są wszsytkie jego wpisy. """ for(ITemplateSourceEntry entry : source.listEntries()) { //System.out.println("Wykryto zasób: " + entry.getName()); if(entry.isFile()) { // System.out.println("Element " + entry.getTemplate() + "/" + source.getResource() + // "/"+ entry.getName() + " jest plikiem"); processVelocityFile(entry, source.getResource(), params, target); } } }
java
protected void processVelocityResource(ITemplateSource source, Map<String, Object> params, String target) throws Exception { for(ITemplateSourceEntry entry : source.listEntries()) { //System.out.println("Wykryto zasób: " + entry.getName()); if(entry.isFile()) { // System.out.println("Element " + entry.getTemplate() + "/" + source.getResource() + // "/"+ entry.getName() + " jest plikiem"); processVelocityFile(entry, source.getResource(), params, target); } } }
[ "protected", "void", "processVelocityResource", "(", "ITemplateSource", "source", ",", "Map", "<", "String", ",", "Object", ">", "params", ",", "String", "target", ")", "throws", "Exception", "{", "for", "(", "ITemplateSourceEntry", "entry", ":", "source", ".", ...
Szablon może być pojedynczym katalogiem. W takiej sytuacji przetwarzane są wszsytkie jego wpisy.
[ "Szablon", "może", "być", "pojedynczym", "katalogiem", ".", "W", "takiej", "sytuacji", "przetwarzane", "są", "wszsytkie", "jego", "wpisy", "." ]
train
https://github.com/kkopacz/agiso-tempel/blob/ff7a96153153b6bc07212d776816b87d9538f6fa/templates/abstract-directoryExtenderEngine/src/main/java/org/agiso/tempel/engine/DirectoryExtenderEngine.java#L83-L94
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
SubjectUtils.countDuplicatesAndMaybeAddTypeInfoReturnObject
static DuplicateGroupedAndTyped countDuplicatesAndMaybeAddTypeInfoReturnObject( Iterable<?> itemsIterable, boolean addTypeInfo) { """ Similar to {@link #countDuplicatesAndAddTypeInfo} and {@link #countDuplicates} but (a) only adds type info if requested and (b) returns a richer object containing the data. """ if (addTypeInfo) { Collection<?> items = iterableToCollection(itemsIterable); Optional<String> homogeneousTypeName = getHomogeneousTypeName(items); NonHashingMultiset<?> valuesWithCountsAndMaybeTypes = homogeneousTypeName.isPresent() ? countDuplicatesToMultiset(items) : countDuplicatesToMultiset(addTypeInfoToEveryItem(items)); return new DuplicateGroupedAndTyped(valuesWithCountsAndMaybeTypes, homogeneousTypeName); } else { return new DuplicateGroupedAndTyped( countDuplicatesToMultiset(itemsIterable), /* homogeneousTypeToDisplay= */ Optional.<String>absent()); } }
java
static DuplicateGroupedAndTyped countDuplicatesAndMaybeAddTypeInfoReturnObject( Iterable<?> itemsIterable, boolean addTypeInfo) { if (addTypeInfo) { Collection<?> items = iterableToCollection(itemsIterable); Optional<String> homogeneousTypeName = getHomogeneousTypeName(items); NonHashingMultiset<?> valuesWithCountsAndMaybeTypes = homogeneousTypeName.isPresent() ? countDuplicatesToMultiset(items) : countDuplicatesToMultiset(addTypeInfoToEveryItem(items)); return new DuplicateGroupedAndTyped(valuesWithCountsAndMaybeTypes, homogeneousTypeName); } else { return new DuplicateGroupedAndTyped( countDuplicatesToMultiset(itemsIterable), /* homogeneousTypeToDisplay= */ Optional.<String>absent()); } }
[ "static", "DuplicateGroupedAndTyped", "countDuplicatesAndMaybeAddTypeInfoReturnObject", "(", "Iterable", "<", "?", ">", "itemsIterable", ",", "boolean", "addTypeInfo", ")", "{", "if", "(", "addTypeInfo", ")", "{", "Collection", "<", "?", ">", "items", "=", "iterable...
Similar to {@link #countDuplicatesAndAddTypeInfo} and {@link #countDuplicates} but (a) only adds type info if requested and (b) returns a richer object containing the data.
[ "Similar", "to", "{" ]
train
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/SubjectUtils.java#L123-L139
haraldk/TwelveMonkeys
imageio/imageio-jpeg/src/main/java/com/twelvemonkeys/imageio/plugins/jpeg/JPEGLosslessDecoderWrapper.java
JPEGLosslessDecoderWrapper.readImage
BufferedImage readImage(final List<Segment> segments, final ImageInputStream input) throws IOException { """ Decodes a JPEG Lossless stream to a {@code BufferedImage}. Currently the following conversions are supported: - 24Bit, RGB -> BufferedImage.TYPE_3BYTE_BGR - 8Bit, Grayscale -> BufferedImage.TYPE_BYTE_GRAY - 16Bit, Grayscale -> BufferedImage.TYPE_USHORT_GRAY @param segments segments @param input input stream which contains JPEG Lossless data @return if successfully a BufferedImage is returned @throws IOException is thrown if the decoder failed or a conversion is not supported """ JPEGLosslessDecoder decoder = new JPEGLosslessDecoder(segments, createBufferedInput(input), listenerDelegate); // TODO: Allow 10/12/14 bit (using a ComponentColorModel with correct bits, as in TIFF) // TODO: Rewrite this to pass a pre-allocated buffer of correct type (byte/short)/correct bands // TODO: Progress callbacks // TODO: Warning callbacks // Callback can then do subsampling etc. int[][] decoded = decoder.decode(); int width = decoder.getDimX(); int height = decoder.getDimY(); // Single component, assumed to be Gray if (decoder.getNumComponents() == 1) { switch (decoder.getPrecision()) { case 8: return to8Bit1ComponentGrayScale(decoded, width, height); case 10: case 12: case 14: case 16: return to16Bit1ComponentGrayScale(decoded, decoder.getPrecision(), width, height); } } // 3 components, assumed to be RGB else if (decoder.getNumComponents() == 3) { switch (decoder.getPrecision()) { case 8: return to24Bit3ComponentRGB(decoded, width, height); } } throw new IIOException("JPEG Lossless with " + decoder.getPrecision() + " bit precision and " + decoder.getNumComponents() + " component(s) not supported"); }
java
BufferedImage readImage(final List<Segment> segments, final ImageInputStream input) throws IOException { JPEGLosslessDecoder decoder = new JPEGLosslessDecoder(segments, createBufferedInput(input), listenerDelegate); // TODO: Allow 10/12/14 bit (using a ComponentColorModel with correct bits, as in TIFF) // TODO: Rewrite this to pass a pre-allocated buffer of correct type (byte/short)/correct bands // TODO: Progress callbacks // TODO: Warning callbacks // Callback can then do subsampling etc. int[][] decoded = decoder.decode(); int width = decoder.getDimX(); int height = decoder.getDimY(); // Single component, assumed to be Gray if (decoder.getNumComponents() == 1) { switch (decoder.getPrecision()) { case 8: return to8Bit1ComponentGrayScale(decoded, width, height); case 10: case 12: case 14: case 16: return to16Bit1ComponentGrayScale(decoded, decoder.getPrecision(), width, height); } } // 3 components, assumed to be RGB else if (decoder.getNumComponents() == 3) { switch (decoder.getPrecision()) { case 8: return to24Bit3ComponentRGB(decoded, width, height); } } throw new IIOException("JPEG Lossless with " + decoder.getPrecision() + " bit precision and " + decoder.getNumComponents() + " component(s) not supported"); }
[ "BufferedImage", "readImage", "(", "final", "List", "<", "Segment", ">", "segments", ",", "final", "ImageInputStream", "input", ")", "throws", "IOException", "{", "JPEGLosslessDecoder", "decoder", "=", "new", "JPEGLosslessDecoder", "(", "segments", ",", "createBuffe...
Decodes a JPEG Lossless stream to a {@code BufferedImage}. Currently the following conversions are supported: - 24Bit, RGB -> BufferedImage.TYPE_3BYTE_BGR - 8Bit, Grayscale -> BufferedImage.TYPE_BYTE_GRAY - 16Bit, Grayscale -> BufferedImage.TYPE_USHORT_GRAY @param segments segments @param input input stream which contains JPEG Lossless data @return if successfully a BufferedImage is returned @throws IOException is thrown if the decoder failed or a conversion is not supported
[ "Decodes", "a", "JPEG", "Lossless", "stream", "to", "a", "{", "@code", "BufferedImage", "}", ".", "Currently", "the", "following", "conversions", "are", "supported", ":", "-", "24Bit", "RGB", "-", ">", "BufferedImage", ".", "TYPE_3BYTE_BGR", "-", "8Bit", "Gr...
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-jpeg/src/main/java/com/twelvemonkeys/imageio/plugins/jpeg/JPEGLosslessDecoderWrapper.java#L79-L112
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/tx/narayana/SecurityActions.java
SecurityActions.createSubject
static Subject createSubject(final String recoverUserName, final String recoverPassword, final ManagedConnectionFactory mcf) { """ Get a Subject instance @param recoverUserName The user name @param recoverPassword The password @param mcf The ManagedConnectionFactory @return The instance """ if (System.getSecurityManager() == null) { Set<Principal> principals = new HashSet<Principal>(); Set<Object> pubCredentials = new HashSet<Object>(); Set<Object> privCredentials = new HashSet<Object>(); // Principals Principal p = new SimplePrincipal(recoverUserName); principals.add(p); // PublicCredentials // None // PrivateCredentials PasswordCredential pc = new PasswordCredential(recoverUserName, recoverPassword.toCharArray()); pc.setManagedConnectionFactory(mcf); privCredentials.add(pc); return new Subject(false, principals, pubCredentials, privCredentials); } return AccessController.doPrivileged(new PrivilegedAction<Subject>() { public Subject run() { Set<Principal> principals = new HashSet<Principal>(); Set<Object> pubCredentials = new HashSet<Object>(); Set<Object> privCredentials = new HashSet<Object>(); // Principals Principal p = new SimplePrincipal(recoverUserName); principals.add(p); // PublicCredentials // None // PrivateCredentials PasswordCredential pc = new PasswordCredential(recoverUserName, recoverPassword.toCharArray()); pc.setManagedConnectionFactory(mcf); privCredentials.add(pc); return new Subject(false, principals, pubCredentials, privCredentials); } }); }
java
static Subject createSubject(final String recoverUserName, final String recoverPassword, final ManagedConnectionFactory mcf) { if (System.getSecurityManager() == null) { Set<Principal> principals = new HashSet<Principal>(); Set<Object> pubCredentials = new HashSet<Object>(); Set<Object> privCredentials = new HashSet<Object>(); // Principals Principal p = new SimplePrincipal(recoverUserName); principals.add(p); // PublicCredentials // None // PrivateCredentials PasswordCredential pc = new PasswordCredential(recoverUserName, recoverPassword.toCharArray()); pc.setManagedConnectionFactory(mcf); privCredentials.add(pc); return new Subject(false, principals, pubCredentials, privCredentials); } return AccessController.doPrivileged(new PrivilegedAction<Subject>() { public Subject run() { Set<Principal> principals = new HashSet<Principal>(); Set<Object> pubCredentials = new HashSet<Object>(); Set<Object> privCredentials = new HashSet<Object>(); // Principals Principal p = new SimplePrincipal(recoverUserName); principals.add(p); // PublicCredentials // None // PrivateCredentials PasswordCredential pc = new PasswordCredential(recoverUserName, recoverPassword.toCharArray()); pc.setManagedConnectionFactory(mcf); privCredentials.add(pc); return new Subject(false, principals, pubCredentials, privCredentials); } }); }
[ "static", "Subject", "createSubject", "(", "final", "String", "recoverUserName", ",", "final", "String", "recoverPassword", ",", "final", "ManagedConnectionFactory", "mcf", ")", "{", "if", "(", "System", ".", "getSecurityManager", "(", ")", "==", "null", ")", "{...
Get a Subject instance @param recoverUserName The user name @param recoverPassword The password @param mcf The ManagedConnectionFactory @return The instance
[ "Get", "a", "Subject", "instance" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/tx/narayana/SecurityActions.java#L57-L104
aws/aws-sdk-java
aws-java-sdk-mq/src/main/java/com/amazonaws/services/mq/model/CreateBrokerRequest.java
CreateBrokerRequest.withTags
public CreateBrokerRequest withTags(java.util.Map<String, String> tags) { """ Create tags when creating the broker. @param tags Create tags when creating the broker. @return Returns a reference to this object so that method calls can be chained together. """ setTags(tags); return this; }
java
public CreateBrokerRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "CreateBrokerRequest", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
Create tags when creating the broker. @param tags Create tags when creating the broker. @return Returns a reference to this object so that method calls can be chained together.
[ "Create", "tags", "when", "creating", "the", "broker", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-mq/src/main/java/com/amazonaws/services/mq/model/CreateBrokerRequest.java#L717-L720
clanie/clanie-core
src/main/java/dk/clanie/collections/CollectionFilters.java
CollectionFilters.removeMatcing
public static <E> void removeMatcing(Collection<E> collection, Matcher<? super E> matcher) { """ Removes matching elements from the supplied Collection. @param <E> @param collection @param matcher """ Iterator<E> iter = collection.iterator(); while (iter.hasNext()) { E item = iter.next(); if (matcher.matches(item)) iter.remove(); } }
java
public static <E> void removeMatcing(Collection<E> collection, Matcher<? super E> matcher) { Iterator<E> iter = collection.iterator(); while (iter.hasNext()) { E item = iter.next(); if (matcher.matches(item)) iter.remove(); } }
[ "public", "static", "<", "E", ">", "void", "removeMatcing", "(", "Collection", "<", "E", ">", "collection", ",", "Matcher", "<", "?", "super", "E", ">", "matcher", ")", "{", "Iterator", "<", "E", ">", "iter", "=", "collection", ".", "iterator", "(", ...
Removes matching elements from the supplied Collection. @param <E> @param collection @param matcher
[ "Removes", "matching", "elements", "from", "the", "supplied", "Collection", "." ]
train
https://github.com/clanie/clanie-core/blob/ac8a655b93127f0e281b741c4d53f429be2816ad/src/main/java/dk/clanie/collections/CollectionFilters.java#L41-L47
jbundle/webapp
proxy/src/main/java/org/jbundle/util/webapp/proxy/ProxyServlet.java
ProxyServlet.service
public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { """ Process an HTML get or post. @exception ServletException From inherited class. @exception IOException From inherited class. """ if ((proxyURLPrefix == null) || (proxyURLPrefix.length() == 0)) { // No proxy specified super.service(req, res); return; } ServletOutputStream streamOut = res.getOutputStream(); try { String proxyURLString = getProxyURLString(req); HttpRequestBase httpRequest = getHttpRequest(req, proxyURLString); addHeaders(req, httpRequest); this.getDataFromClient(httpRequest, streamOut); } catch (Exception e) { displayErrorInHtml(streamOut, e); } }
java
public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { if ((proxyURLPrefix == null) || (proxyURLPrefix.length() == 0)) { // No proxy specified super.service(req, res); return; } ServletOutputStream streamOut = res.getOutputStream(); try { String proxyURLString = getProxyURLString(req); HttpRequestBase httpRequest = getHttpRequest(req, proxyURLString); addHeaders(req, httpRequest); this.getDataFromClient(httpRequest, streamOut); } catch (Exception e) { displayErrorInHtml(streamOut, e); } }
[ "public", "void", "service", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "res", ")", "throws", "ServletException", ",", "IOException", "{", "if", "(", "(", "proxyURLPrefix", "==", "null", ")", "||", "(", "proxyURLPrefix", ".", "length", "(", ...
Process an HTML get or post. @exception ServletException From inherited class. @exception IOException From inherited class.
[ "Process", "an", "HTML", "get", "or", "post", "." ]
train
https://github.com/jbundle/webapp/blob/af2cf32bd92254073052f1f9b4bcd47c2f76ba7d/proxy/src/main/java/org/jbundle/util/webapp/proxy/ProxyServlet.java#L78-L95
thorstenwagner/TraJ
src/main/java/de/biomedical_imaging/traJ/VisualizationUtils.java
VisualizationUtils.getTrajectoryChart
public static Chart getTrajectoryChart(String title, Trajectory t) { """ Plots the trajectory @param title Title of the plot @param t Trajectory to be plotted """ if(t.getDimension()==2){ double[] xData = new double[t.size()]; double[] yData = new double[t.size()]; for(int i = 0; i < t.size(); i++){ xData[i] = t.get(i).x; yData[i] = t.get(i).y; } // Create Chart Chart chart = QuickChart.getChart(title, "X", "Y", "y(x)", xData, yData); return chart; //Show it // SwingWrapper swr = new SwingWrapper(chart); // swr.displayChart(); } return null; }
java
public static Chart getTrajectoryChart(String title, Trajectory t){ if(t.getDimension()==2){ double[] xData = new double[t.size()]; double[] yData = new double[t.size()]; for(int i = 0; i < t.size(); i++){ xData[i] = t.get(i).x; yData[i] = t.get(i).y; } // Create Chart Chart chart = QuickChart.getChart(title, "X", "Y", "y(x)", xData, yData); return chart; //Show it // SwingWrapper swr = new SwingWrapper(chart); // swr.displayChart(); } return null; }
[ "public", "static", "Chart", "getTrajectoryChart", "(", "String", "title", ",", "Trajectory", "t", ")", "{", "if", "(", "t", ".", "getDimension", "(", ")", "==", "2", ")", "{", "double", "[", "]", "xData", "=", "new", "double", "[", "t", ".", "size",...
Plots the trajectory @param title Title of the plot @param t Trajectory to be plotted
[ "Plots", "the", "trajectory" ]
train
https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/VisualizationUtils.java#L56-L74
orbisgis/h2gis
h2gis-network/src/main/java/org/h2gis/network/functions/GraphFunctionParser.java
GraphFunctionParser.parseWeightAndOrientation
public void parseWeightAndOrientation(String arg1, String arg2) { """ Parse the weight and orientation(s) from two strings, given in arbitrary order. @param arg1 Weight or orientation @param arg2 Weight or orientation """ if ((arg1 == null && arg2 == null) || (isWeightString(arg1) && arg2 == null) || (arg1 == null && isWeightString(arg2))) { // Disable default orientations (D and WD). throw new IllegalArgumentException("You must specify the orientation."); } if (isWeightString(arg1) && isWeightString(arg2)) { throw new IllegalArgumentException("Cannot specify the weight column twice."); } if (isOrientationString(arg1) && isOrientationString(arg2)) { throw new IllegalArgumentException("Cannot specify the orientation twice."); } if (isWeightString(arg1) || isOrientationString(arg2)) { setWeightAndOrientation(arg1, arg2); } if (isOrientationString(arg1) || isWeightString(arg2)) { setWeightAndOrientation(arg2, arg1); } }
java
public void parseWeightAndOrientation(String arg1, String arg2) { if ((arg1 == null && arg2 == null) || (isWeightString(arg1) && arg2 == null) || (arg1 == null && isWeightString(arg2))) { // Disable default orientations (D and WD). throw new IllegalArgumentException("You must specify the orientation."); } if (isWeightString(arg1) && isWeightString(arg2)) { throw new IllegalArgumentException("Cannot specify the weight column twice."); } if (isOrientationString(arg1) && isOrientationString(arg2)) { throw new IllegalArgumentException("Cannot specify the orientation twice."); } if (isWeightString(arg1) || isOrientationString(arg2)) { setWeightAndOrientation(arg1, arg2); } if (isOrientationString(arg1) || isWeightString(arg2)) { setWeightAndOrientation(arg2, arg1); } }
[ "public", "void", "parseWeightAndOrientation", "(", "String", "arg1", ",", "String", "arg2", ")", "{", "if", "(", "(", "arg1", "==", "null", "&&", "arg2", "==", "null", ")", "||", "(", "isWeightString", "(", "arg1", ")", "&&", "arg2", "==", "null", ")"...
Parse the weight and orientation(s) from two strings, given in arbitrary order. @param arg1 Weight or orientation @param arg2 Weight or orientation
[ "Parse", "the", "weight", "and", "orientation", "(", "s", ")", "from", "two", "strings", "given", "in", "arbitrary", "order", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-network/src/main/java/org/h2gis/network/functions/GraphFunctionParser.java#L150-L169
apache/groovy
subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java
SwingGroovyMethods.leftShift
public static JMenu leftShift(JMenu self, String str) { """ Overloads the left shift operator to provide an easy way to add components to a menu.<p> @param self a JMenu @param str a String to be added to the menu. @return same menu, after the value was added to it. @since 1.6.4 """ self.add(str); return self; }
java
public static JMenu leftShift(JMenu self, String str) { self.add(str); return self; }
[ "public", "static", "JMenu", "leftShift", "(", "JMenu", "self", ",", "String", "str", ")", "{", "self", ".", "add", "(", "str", ")", ";", "return", "self", ";", "}" ]
Overloads the left shift operator to provide an easy way to add components to a menu.<p> @param self a JMenu @param str a String to be added to the menu. @return same menu, after the value was added to it. @since 1.6.4
[ "Overloads", "the", "left", "shift", "operator", "to", "provide", "an", "easy", "way", "to", "add", "components", "to", "a", "menu", ".", "<p", ">" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L809-L812
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/libcore/io/Streams.java
Streams.writeSingleByte
public static void writeSingleByte(OutputStream out, int b) throws IOException { """ Implements OutputStream.write(int) in terms of OutputStream.write(byte[], int, int). OutputStream assumes that you implement OutputStream.write(int) and provides default implementations of the others, but often the opposite is more efficient. """ byte[] buffer = new byte[1]; buffer[0] = (byte) (b & 0xff); out.write(buffer); }
java
public static void writeSingleByte(OutputStream out, int b) throws IOException { byte[] buffer = new byte[1]; buffer[0] = (byte) (b & 0xff); out.write(buffer); }
[ "public", "static", "void", "writeSingleByte", "(", "OutputStream", "out", ",", "int", "b", ")", "throws", "IOException", "{", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "1", "]", ";", "buffer", "[", "0", "]", "=", "(", "byte", ")", "(", ...
Implements OutputStream.write(int) in terms of OutputStream.write(byte[], int, int). OutputStream assumes that you implement OutputStream.write(int) and provides default implementations of the others, but often the opposite is more efficient.
[ "Implements", "OutputStream", ".", "write", "(", "int", ")", "in", "terms", "of", "OutputStream", ".", "write", "(", "byte", "[]", "int", "int", ")", ".", "OutputStream", "assumes", "that", "you", "implement", "OutputStream", ".", "write", "(", "int", ")",...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/libcore/io/Streams.java#L50-L54
steveohara/j2mod
src/main/java/com/ghgande/j2mod/modbus/msg/ReadCoilsResponse.java
ReadCoilsResponse.setCoilStatus
public void setCoilStatus(int index, boolean b) { """ Sets the status of the given coil. @param index the index of the coil to be set. @param b true if to be set, false for reset. """ if (index < 0) { throw new IllegalArgumentException(index + " < 0"); } if (index > coils.size()) { throw new IndexOutOfBoundsException(index + " > " + coils.size()); } coils.setBit(index, b); }
java
public void setCoilStatus(int index, boolean b) { if (index < 0) { throw new IllegalArgumentException(index + " < 0"); } if (index > coils.size()) { throw new IndexOutOfBoundsException(index + " > " + coils.size()); } coils.setBit(index, b); }
[ "public", "void", "setCoilStatus", "(", "int", "index", ",", "boolean", "b", ")", "{", "if", "(", "index", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "index", "+", "\" < 0\"", ")", ";", "}", "if", "(", "index", ">", "coils", ...
Sets the status of the given coil. @param index the index of the coil to be set. @param b true if to be set, false for reset.
[ "Sets", "the", "status", "of", "the", "given", "coil", "." ]
train
https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/msg/ReadCoilsResponse.java#L131-L141
ksclarke/freelib-utils
src/main/java/info/freelibrary/util/I18nObject.java
I18nObject.getI18n
protected String getI18n(final String aMessageKey, final File aFile) { """ Gets the internationalized value for the supplied message key, using a file as additional information. @param aMessageKey A message key @param aFile Additional details for the message @return The internationalized message """ return StringUtils.normalizeWS(myBundle.get(aMessageKey, aFile.getAbsolutePath())); }
java
protected String getI18n(final String aMessageKey, final File aFile) { return StringUtils.normalizeWS(myBundle.get(aMessageKey, aFile.getAbsolutePath())); }
[ "protected", "String", "getI18n", "(", "final", "String", "aMessageKey", ",", "final", "File", "aFile", ")", "{", "return", "StringUtils", ".", "normalizeWS", "(", "myBundle", ".", "get", "(", "aMessageKey", ",", "aFile", ".", "getAbsolutePath", "(", ")", ")...
Gets the internationalized value for the supplied message key, using a file as additional information. @param aMessageKey A message key @param aFile Additional details for the message @return The internationalized message
[ "Gets", "the", "internationalized", "value", "for", "the", "supplied", "message", "key", "using", "a", "file", "as", "additional", "information", "." ]
train
https://github.com/ksclarke/freelib-utils/blob/54e822ae4c11b3d74793fd82a1a535ffafffaf45/src/main/java/info/freelibrary/util/I18nObject.java#L112-L114
chrisjenx/Calligraphy
calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java
CalligraphyUtils.applyFontToTextView
public static boolean applyFontToTextView(final TextView textView, final Typeface typeface, boolean deferred) { """ Applies a Typeface to a TextView, if deferred,its recommend you don't call this multiple times, as this adds a TextWatcher. Deferring should really only be used on tricky views which get Typeface set by the system at weird times. @param textView Not null, TextView or child of. @param typeface Not null, Typeface to apply to the TextView. @param deferred If true we use Typefaces and TextChange listener to make sure font is always applied, but this sometimes conflicts with other {@link android.text.Spannable}'s. @return true if applied otherwise false. @see #applyFontToTextView(android.widget.TextView, android.graphics.Typeface) """ if (textView == null || typeface == null) return false; textView.setPaintFlags(textView.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); textView.setTypeface(typeface); if (deferred) { textView.setText(applyTypefaceSpan(textView.getText(), typeface), TextView.BufferType.SPANNABLE); textView.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { applyTypefaceSpan(s, typeface); } }); } return true; }
java
public static boolean applyFontToTextView(final TextView textView, final Typeface typeface, boolean deferred) { if (textView == null || typeface == null) return false; textView.setPaintFlags(textView.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); textView.setTypeface(typeface); if (deferred) { textView.setText(applyTypefaceSpan(textView.getText(), typeface), TextView.BufferType.SPANNABLE); textView.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { applyTypefaceSpan(s, typeface); } }); } return true; }
[ "public", "static", "boolean", "applyFontToTextView", "(", "final", "TextView", "textView", ",", "final", "Typeface", "typeface", ",", "boolean", "deferred", ")", "{", "if", "(", "textView", "==", "null", "||", "typeface", "==", "null", ")", "return", "false",...
Applies a Typeface to a TextView, if deferred,its recommend you don't call this multiple times, as this adds a TextWatcher. Deferring should really only be used on tricky views which get Typeface set by the system at weird times. @param textView Not null, TextView or child of. @param typeface Not null, Typeface to apply to the TextView. @param deferred If true we use Typefaces and TextChange listener to make sure font is always applied, but this sometimes conflicts with other {@link android.text.Spannable}'s. @return true if applied otherwise false. @see #applyFontToTextView(android.widget.TextView, android.graphics.Typeface)
[ "Applies", "a", "Typeface", "to", "a", "TextView", "if", "deferred", "its", "recommend", "you", "don", "t", "call", "this", "multiple", "times", "as", "this", "adds", "a", "TextWatcher", "." ]
train
https://github.com/chrisjenx/Calligraphy/blob/085e441954d787bd4ef31f245afe5f2f2a311ea5/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java#L74-L96