repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java
TrainingsImpl.getTaggedImages
public List<Image> getTaggedImages(UUID projectId, GetTaggedImagesOptionalParameter getTaggedImagesOptionalParameter) { return getTaggedImagesWithServiceResponseAsync(projectId, getTaggedImagesOptionalParameter).toBlocking().single().body(); }
java
public List<Image> getTaggedImages(UUID projectId, GetTaggedImagesOptionalParameter getTaggedImagesOptionalParameter) { return getTaggedImagesWithServiceResponseAsync(projectId, getTaggedImagesOptionalParameter).toBlocking().single().body(); }
[ "public", "List", "<", "Image", ">", "getTaggedImages", "(", "UUID", "projectId", ",", "GetTaggedImagesOptionalParameter", "getTaggedImagesOptionalParameter", ")", "{", "return", "getTaggedImagesWithServiceResponseAsync", "(", "projectId", ",", "getTaggedImagesOptionalParameter...
Get tagged images for a given project iteration. This API supports batching and range selection. By default it will only return first 50 images matching images. Use the {take} and {skip} parameters to control how many images to return in a given batch. The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and "Cat" tags, then only images tagged with Dog and/or Cat will be returned. @param projectId The project id @param getTaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;Image&gt; object if successful.
[ "Get", "tagged", "images", "for", "a", "given", "project", "iteration", ".", "This", "API", "supports", "batching", "and", "range", "selection", ".", "By", "default", "it", "will", "only", "return", "first", "50", "images", "matching", "images", ".", "Use", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L4974-L4976
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java
JDBC4DatabaseMetaData.getColumnPrivileges
@Override public ResultSet getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
java
@Override public ResultSet getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
[ "@", "Override", "public", "ResultSet", "getColumnPrivileges", "(", "String", "catalog", ",", "String", "schema", ",", "String", "table", ",", "String", "columnNamePattern", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "throw", "SQLError", "...
Retrieves a description of the access rights for a table's columns.
[ "Retrieves", "a", "description", "of", "the", "access", "rights", "for", "a", "table", "s", "columns", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java#L188-L193
EasyinnovaSL/Tiff-Library-4J
src/main/java/com/easyinnova/tiff/model/TiffDocument.java
TiffDocument.addTag
public boolean addTag(String tagName, String tagValue) { boolean result = false; if (firstIFD != null) { if (firstIFD.containsTagId(TiffTags.getTagId(tagName))) { firstIFD.removeTag(tagName); } firstIFD.addTag(tagName, tagValue); createMetadataDictionary(); } return result; }
java
public boolean addTag(String tagName, String tagValue) { boolean result = false; if (firstIFD != null) { if (firstIFD.containsTagId(TiffTags.getTagId(tagName))) { firstIFD.removeTag(tagName); } firstIFD.addTag(tagName, tagValue); createMetadataDictionary(); } return result; }
[ "public", "boolean", "addTag", "(", "String", "tagName", ",", "String", "tagValue", ")", "{", "boolean", "result", "=", "false", ";", "if", "(", "firstIFD", "!=", "null", ")", "{", "if", "(", "firstIFD", ".", "containsTagId", "(", "TiffTags", ".", "getTa...
Adds the tag. @param tagName the tag name @param tagValue the tag value @return true, if successful
[ "Adds", "the", "tag", "." ]
train
https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/model/TiffDocument.java#L497-L507
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/lock/LockSession.java
LockSession.unlockThisRecord
public boolean unlockThisRecord(String strDatabaseName, String strRecordName, Object bookmark, SessionInfo sessionInfo) throws DBException, RemoteException { sessionInfo.m_iRemoteSessionID = this.getSessionID(); LockTable lockTable = this.getLockTable(strDatabaseName, strRecordName); if (bookmark != null) return lockTable.removeLock(bookmark, sessionInfo); else return lockTable.unlockAll(sessionInfo); }
java
public boolean unlockThisRecord(String strDatabaseName, String strRecordName, Object bookmark, SessionInfo sessionInfo) throws DBException, RemoteException { sessionInfo.m_iRemoteSessionID = this.getSessionID(); LockTable lockTable = this.getLockTable(strDatabaseName, strRecordName); if (bookmark != null) return lockTable.removeLock(bookmark, sessionInfo); else return lockTable.unlockAll(sessionInfo); }
[ "public", "boolean", "unlockThisRecord", "(", "String", "strDatabaseName", ",", "String", "strRecordName", ",", "Object", "bookmark", ",", "SessionInfo", "sessionInfo", ")", "throws", "DBException", ",", "RemoteException", "{", "sessionInfo", ".", "m_iRemoteSessionID", ...
Unlock this bookmark in this record for this session. @param strRecordName The record to unlock in. @param bookmark The bookmark to unlock (or null to unlock all for this session). @param objSession The session that wants to unlock. @param iLockType The type of lock (wait or error lock). @return True if successful.
[ "Unlock", "this", "bookmark", "in", "this", "record", "for", "this", "session", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/lock/LockSession.java#L145-L154
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java
CoverageUtilities.coverageValuesMapper
public static GridCoverage2D coverageValuesMapper( GridCoverage2D valuesMap, GridCoverage2D maskMap ) { RegionMap valuesRegionMap = getRegionParamsFromGridCoverage(valuesMap); int cs = valuesRegionMap.getCols(); int rs = valuesRegionMap.getRows(); RegionMap maskRegionMap = getRegionParamsFromGridCoverage(maskMap); int tmpcs = maskRegionMap.getCols(); int tmprs = maskRegionMap.getRows(); if (cs != tmpcs || rs != tmprs) { throw new IllegalArgumentException("The raster maps have to be of equal size to be mapped."); } RandomIter valuesIter = RandomIterFactory.create(valuesMap.getRenderedImage(), null); RandomIter maskIter = RandomIterFactory.create(maskMap.getRenderedImage(), null); WritableRaster writableRaster = createWritableRaster(cs, rs, null, null, HMConstants.doubleNovalue); WritableRandomIter outIter = RandomIterFactory.createWritable(writableRaster, null); for( int c = 0; c < cs; c++ ) { for( int r = 0; r < rs; r++ ) { if (!isNovalue(maskIter.getSampleDouble(c, r, 0))) { // if not nv, put the value from the valueMap in the new map double value = valuesIter.getSampleDouble(c, r, 0); if (!isNovalue(value)) outIter.setSample(c, r, 0, value); } } } GridCoverage2D outCoverage = buildCoverage("mapped", writableRaster, maskRegionMap, //$NON-NLS-1$ valuesMap.getCoordinateReferenceSystem()); return outCoverage; }
java
public static GridCoverage2D coverageValuesMapper( GridCoverage2D valuesMap, GridCoverage2D maskMap ) { RegionMap valuesRegionMap = getRegionParamsFromGridCoverage(valuesMap); int cs = valuesRegionMap.getCols(); int rs = valuesRegionMap.getRows(); RegionMap maskRegionMap = getRegionParamsFromGridCoverage(maskMap); int tmpcs = maskRegionMap.getCols(); int tmprs = maskRegionMap.getRows(); if (cs != tmpcs || rs != tmprs) { throw new IllegalArgumentException("The raster maps have to be of equal size to be mapped."); } RandomIter valuesIter = RandomIterFactory.create(valuesMap.getRenderedImage(), null); RandomIter maskIter = RandomIterFactory.create(maskMap.getRenderedImage(), null); WritableRaster writableRaster = createWritableRaster(cs, rs, null, null, HMConstants.doubleNovalue); WritableRandomIter outIter = RandomIterFactory.createWritable(writableRaster, null); for( int c = 0; c < cs; c++ ) { for( int r = 0; r < rs; r++ ) { if (!isNovalue(maskIter.getSampleDouble(c, r, 0))) { // if not nv, put the value from the valueMap in the new map double value = valuesIter.getSampleDouble(c, r, 0); if (!isNovalue(value)) outIter.setSample(c, r, 0, value); } } } GridCoverage2D outCoverage = buildCoverage("mapped", writableRaster, maskRegionMap, //$NON-NLS-1$ valuesMap.getCoordinateReferenceSystem()); return outCoverage; }
[ "public", "static", "GridCoverage2D", "coverageValuesMapper", "(", "GridCoverage2D", "valuesMap", ",", "GridCoverage2D", "maskMap", ")", "{", "RegionMap", "valuesRegionMap", "=", "getRegionParamsFromGridCoverage", "(", "valuesMap", ")", ";", "int", "cs", "=", "valuesReg...
Mappes the values of a map (valuesMap) into the valid pixels of the second map (maskMap). @param valuesMap the map holding the values that are needed in the resulting map. @param maskMap the map to use as mask for the values. @return the map containing the values of the valuesMap, but only in the places in which the maskMap is valid.
[ "Mappes", "the", "values", "of", "a", "map", "(", "valuesMap", ")", "into", "the", "valid", "pixels", "of", "the", "second", "map", "(", "maskMap", ")", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java#L1366-L1397
deeplearning4j/deeplearning4j
datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/recordreader/BaseImageRecordReader.java
BaseImageRecordReader.initialize
public void initialize(InputSplit split, ImageTransform imageTransform) throws IOException { this.imageLoader = null; this.imageTransform = imageTransform; initialize(split); }
java
public void initialize(InputSplit split, ImageTransform imageTransform) throws IOException { this.imageLoader = null; this.imageTransform = imageTransform; initialize(split); }
[ "public", "void", "initialize", "(", "InputSplit", "split", ",", "ImageTransform", "imageTransform", ")", "throws", "IOException", "{", "this", ".", "imageLoader", "=", "null", ";", "this", ".", "imageTransform", "=", "imageTransform", ";", "initialize", "(", "s...
Called once at initialization. @param split the split that defines the range of records to read @param imageTransform the image transform to use to transform images while loading them @throws java.io.IOException
[ "Called", "once", "at", "initialization", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/recordreader/BaseImageRecordReader.java#L196-L200
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/media/MediaClient.java
MediaClient.listJobs
@Deprecated public ListJobsResponse listJobs(ListJobsRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getPipelineName(), "The parameter pipelineName should NOT be null or empty string."); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, TRANSCODE_JOB); internalRequest.addParameter("pipelineName", request.getPipelineName()); return invokeHttpClient(internalRequest, ListJobsResponse.class); }
java
@Deprecated public ListJobsResponse listJobs(ListJobsRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getPipelineName(), "The parameter pipelineName should NOT be null or empty string."); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, TRANSCODE_JOB); internalRequest.addParameter("pipelineName", request.getPipelineName()); return invokeHttpClient(internalRequest, ListJobsResponse.class); }
[ "@", "Deprecated", "public", "ListJobsResponse", "listJobs", "(", "ListJobsRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getPipelineName", "(", ...
List all transcoder jobs on specified pipeline. @param request The request object containing all options for list jobs. @return The list of job IDs. @deprecated As of release 0.8.5, replaced by {@link #listTranscodingJobs(ListTranscodingJobsRequest)}
[ "List", "all", "transcoder", "jobs", "on", "specified", "pipeline", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/media/MediaClient.java#L248-L256
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java
SegmentsUtil.getShort
public static short getShort(MemorySegment[] segments, int offset) { if (inFirstSegment(segments, offset, 2)) { return segments[0].getShort(offset); } else { return getShortMultiSegments(segments, offset); } }
java
public static short getShort(MemorySegment[] segments, int offset) { if (inFirstSegment(segments, offset, 2)) { return segments[0].getShort(offset); } else { return getShortMultiSegments(segments, offset); } }
[ "public", "static", "short", "getShort", "(", "MemorySegment", "[", "]", "segments", ",", "int", "offset", ")", "{", "if", "(", "inFirstSegment", "(", "segments", ",", "offset", ",", "2", ")", ")", "{", "return", "segments", "[", "0", "]", ".", "getSho...
get short from segments. @param segments target segments. @param offset value offset.
[ "get", "short", "from", "segments", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java#L800-L806
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java
ArrayUtil.containsAny
@SuppressWarnings("unchecked") public static <T> boolean containsAny(T[] array, T... values) { for (T value : values) { if(contains(array, value)) { return true; } } return false; }
java
@SuppressWarnings("unchecked") public static <T> boolean containsAny(T[] array, T... values) { for (T value : values) { if(contains(array, value)) { return true; } } return false; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "boolean", "containsAny", "(", "T", "[", "]", "array", ",", "T", "...", "values", ")", "{", "for", "(", "T", "value", ":", "values", ")", "{", "if", "(", "contains...
数组中是否包含指定元素中的任意一个 @param <T> 数组元素类型 @param array 数组 @param values 被检查的多个元素 @return 是否包含指定元素中的任意一个 @since 4.1.20
[ "数组中是否包含指定元素中的任意一个" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L970-L978
hageldave/ImagingKit
ImagingKit_Fourier/src/main/java/hageldave/imagingkit/fourier/ComplexImg.java
ComplexImg.copyArea
public ComplexImg copyArea(int x, int y, int w, int h, ComplexImg dest, int destX, int destY) { if(dest == null){ dest = new ComplexImg(w, h); } delegate.copyArea(x, y, w, h, dest.delegate, destX, destY); if(dest.isSynchronizePowerSpectrum()){ dest.recomputePowerChannel(); } return dest; }
java
public ComplexImg copyArea(int x, int y, int w, int h, ComplexImg dest, int destX, int destY) { if(dest == null){ dest = new ComplexImg(w, h); } delegate.copyArea(x, y, w, h, dest.delegate, destX, destY); if(dest.isSynchronizePowerSpectrum()){ dest.recomputePowerChannel(); } return dest; }
[ "public", "ComplexImg", "copyArea", "(", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ",", "ComplexImg", "dest", ",", "int", "destX", ",", "int", "destY", ")", "{", "if", "(", "dest", "==", "null", ")", "{", "dest", "=", "new", ...
See {@link ColorImg#copyArea(int, int, int, int, ColorImg, int, int)} @param x area origin in this image (x-coordinate) @param y area origin in this image (y-coordinate) @param w width of area @param h height of area @param dest destination image @param destX area origin in destination image (x-coordinate) @param destY area origin in destination image (y-coordinate) @return the destination image, or newly created image if destination was null. @throws IllegalArgumentException if the specified area is not within the bounds of this image or if the size of the area is not positive.
[ "See", "{", "@link", "ColorImg#copyArea", "(", "int", "int", "int", "int", "ColorImg", "int", "int", ")", "}" ]
train
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Fourier/src/main/java/hageldave/imagingkit/fourier/ComplexImg.java#L579-L588
mozilla/rhino
src/org/mozilla/javascript/optimizer/Block.java
Block.initLiveOnEntrySets
private void initLiveOnEntrySets(OptFunctionNode fn, Node[] statementNodes) { int listLength = fn.getVarCount(); itsUseBeforeDefSet = new BitSet(listLength); itsNotDefSet = new BitSet(listLength); itsLiveOnEntrySet = new BitSet(listLength); itsLiveOnExitSet = new BitSet(listLength); for (int i = itsStartNodeIndex; i <= itsEndNodeIndex; i++) { Node n = statementNodes[i]; lookForVariableAccess(fn, n); } itsNotDefSet.flip(0, listLength); // truth in advertising }
java
private void initLiveOnEntrySets(OptFunctionNode fn, Node[] statementNodes) { int listLength = fn.getVarCount(); itsUseBeforeDefSet = new BitSet(listLength); itsNotDefSet = new BitSet(listLength); itsLiveOnEntrySet = new BitSet(listLength); itsLiveOnExitSet = new BitSet(listLength); for (int i = itsStartNodeIndex; i <= itsEndNodeIndex; i++) { Node n = statementNodes[i]; lookForVariableAccess(fn, n); } itsNotDefSet.flip(0, listLength); // truth in advertising }
[ "private", "void", "initLiveOnEntrySets", "(", "OptFunctionNode", "fn", ",", "Node", "[", "]", "statementNodes", ")", "{", "int", "listLength", "=", "fn", ".", "getVarCount", "(", ")", ";", "itsUseBeforeDefSet", "=", "new", "BitSet", "(", "listLength", ")", ...
/* build the live on entry/exit sets. Then walk the trees looking for defs/uses of variables and build the def and useBeforeDef sets.
[ "/", "*", "build", "the", "live", "on", "entry", "/", "exit", "sets", ".", "Then", "walk", "the", "trees", "looking", "for", "defs", "/", "uses", "of", "variables", "and", "build", "the", "def", "and", "useBeforeDef", "sets", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/optimizer/Block.java#L414-L426
cdk/cdk
base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/matchers/QueryAtomContainer.java
QueryAtomContainer.addBond
@Override public void addBond(int atom1, int atom2, IBond.Order order, IBond.Stereo stereo) { IBond bond = getBuilder().newInstance(IBond.class, getAtom(atom1), getAtom(atom2), order, stereo); if (contains(bond)) { return; } if (bondCount >= bonds.length) { growBondArray(); } addBond(bond); /* * no notifyChanged() here because addBond(bond) does it already */ }
java
@Override public void addBond(int atom1, int atom2, IBond.Order order, IBond.Stereo stereo) { IBond bond = getBuilder().newInstance(IBond.class, getAtom(atom1), getAtom(atom2), order, stereo); if (contains(bond)) { return; } if (bondCount >= bonds.length) { growBondArray(); } addBond(bond); /* * no notifyChanged() here because addBond(bond) does it already */ }
[ "@", "Override", "public", "void", "addBond", "(", "int", "atom1", ",", "int", "atom2", ",", "IBond", ".", "Order", "order", ",", "IBond", ".", "Stereo", "stereo", ")", "{", "IBond", "bond", "=", "getBuilder", "(", ")", ".", "newInstance", "(", "IBond"...
Adds a bond to this container. @param atom1 Id of the first atom of the Bond in [0,..] @param atom2 Id of the second atom of the Bond in [0,..] @param order Bondorder @param stereo Stereochemical orientation
[ "Adds", "a", "bond", "to", "this", "container", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/matchers/QueryAtomContainer.java#L1371-L1386
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/ConstraintTypeUtility.java
ConstraintTypeUtility.getInstance
public static ConstraintType getInstance(Locale locale, String type) { int index = 0; String[] constraintTypes = LocaleData.getStringArray(locale, LocaleData.CONSTRAINT_TYPES); for (int loop = 0; loop < constraintTypes.length; loop++) { if (constraintTypes[loop].equalsIgnoreCase(type) == true) { index = loop; break; } } return (ConstraintType.getInstance(index)); }
java
public static ConstraintType getInstance(Locale locale, String type) { int index = 0; String[] constraintTypes = LocaleData.getStringArray(locale, LocaleData.CONSTRAINT_TYPES); for (int loop = 0; loop < constraintTypes.length; loop++) { if (constraintTypes[loop].equalsIgnoreCase(type) == true) { index = loop; break; } } return (ConstraintType.getInstance(index)); }
[ "public", "static", "ConstraintType", "getInstance", "(", "Locale", "locale", ",", "String", "type", ")", "{", "int", "index", "=", "0", ";", "String", "[", "]", "constraintTypes", "=", "LocaleData", ".", "getStringArray", "(", "locale", ",", "LocaleData", "...
This method takes the textual version of a constraint name and returns an appropriate class instance. Note that unrecognised values are treated as "As Soon As Possible" constraints. @param locale target locale @param type text version of the constraint type @return ConstraintType instance
[ "This", "method", "takes", "the", "textual", "version", "of", "a", "constraint", "name", "and", "returns", "an", "appropriate", "class", "instance", ".", "Note", "that", "unrecognised", "values", "are", "treated", "as", "As", "Soon", "As", "Possible", "constra...
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/ConstraintTypeUtility.java#L53-L68
terrestris/shogun-core
src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/AbstractUserTokenService.java
AbstractUserTokenService.getValidTokenForUser
protected E getValidTokenForUser(User user, Integer expirationTimeInMinutes) throws NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { // check if the user has an open reset request / not used token E userToken = findByUser(user); // if there is already an existing token for the user... if (userToken != null) { if (userToken.expiresWithin(EXPIRY_THRESHOLD_MINUTES)) { LOG.debug("User already has an expired token (or at least a " + "token that expires within the next " + EXPIRY_THRESHOLD_MINUTES + " minutes). This token " + "will be deleted."); // delete the expired token dao.delete(userToken); } else { LOG.debug("Returning existing token for user '" + user.getAccountName() + "'"); // return the existing and valid token return userToken; } } userToken = buildConcreteInstance(user, expirationTimeInMinutes); // persist the user token dao.saveOrUpdate(userToken); final String tokenType = userToken.getClass().getSimpleName(); LOG.debug("Successfully created a user token of type '" + tokenType + "' for user '" + user.getAccountName() + "'"); return userToken; }
java
protected E getValidTokenForUser(User user, Integer expirationTimeInMinutes) throws NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { // check if the user has an open reset request / not used token E userToken = findByUser(user); // if there is already an existing token for the user... if (userToken != null) { if (userToken.expiresWithin(EXPIRY_THRESHOLD_MINUTES)) { LOG.debug("User already has an expired token (or at least a " + "token that expires within the next " + EXPIRY_THRESHOLD_MINUTES + " minutes). This token " + "will be deleted."); // delete the expired token dao.delete(userToken); } else { LOG.debug("Returning existing token for user '" + user.getAccountName() + "'"); // return the existing and valid token return userToken; } } userToken = buildConcreteInstance(user, expirationTimeInMinutes); // persist the user token dao.saveOrUpdate(userToken); final String tokenType = userToken.getClass().getSimpleName(); LOG.debug("Successfully created a user token of type '" + tokenType + "' for user '" + user.getAccountName() + "'"); return userToken; }
[ "protected", "E", "getValidTokenForUser", "(", "User", "user", ",", "Integer", "expirationTimeInMinutes", ")", "throws", "NoSuchMethodException", ",", "SecurityException", ",", "InstantiationException", ",", "IllegalAccessException", ",", "IllegalArgumentException", ",", "I...
Returns a valid (i.e. non-expired) {@link UserToken} for the given user. If the user already owns a valid token, it will be returned. If the user has an invalid/expired token, it will be deleted and a new one will be generated and returned by this method. <p> An expiration time in minutes can also be passed. If this value is null, the default value will be used. @param user The user that needs a token. @param expirationTimeInMinutes The expiration time in minutes. If null, the default value will be used. @return A valid user token. @throws SecurityException @throws NoSuchMethodException @throws InvocationTargetException @throws IllegalArgumentException @throws IllegalAccessException @throws InstantiationException
[ "Returns", "a", "valid", "(", "i", ".", "e", ".", "non", "-", "expired", ")", "{", "@link", "UserToken", "}", "for", "the", "given", "user", ".", "If", "the", "user", "already", "owns", "a", "valid", "token", "it", "will", "be", "returned", ".", "I...
train
https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/AbstractUserTokenService.java#L112-L149
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java
ToStream.outputEntityDecl
void outputEntityDecl(String name, String value) throws IOException { final java.io.Writer writer = m_writer; writer.write("<!ENTITY "); writer.write(name); writer.write(" \""); writer.write(value); writer.write("\">"); writer.write(m_lineSep, 0, m_lineSepLen); }
java
void outputEntityDecl(String name, String value) throws IOException { final java.io.Writer writer = m_writer; writer.write("<!ENTITY "); writer.write(name); writer.write(" \""); writer.write(value); writer.write("\">"); writer.write(m_lineSep, 0, m_lineSepLen); }
[ "void", "outputEntityDecl", "(", "String", "name", ",", "String", "value", ")", "throws", "IOException", "{", "final", "java", ".", "io", ".", "Writer", "writer", "=", "m_writer", ";", "writer", ".", "write", "(", "\"<!ENTITY \"", ")", ";", "writer", ".", ...
Output the doc type declaration. @param name non-null reference to document type name. NEEDSDOC @param value @throws org.xml.sax.SAXException
[ "Output", "the", "doc", "type", "declaration", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java#L363-L372
otto-de/edison-microservice
edison-mongo/src/main/java/de/otto/edison/mongo/AbstractMongoRepository.java
AbstractMongoRepository.findOne
public Optional<V> findOne(final K key) { return findOne(key, mongoProperties.getDefaultReadTimeout(), TimeUnit.MILLISECONDS); }
java
public Optional<V> findOne(final K key) { return findOne(key, mongoProperties.getDefaultReadTimeout(), TimeUnit.MILLISECONDS); }
[ "public", "Optional", "<", "V", ">", "findOne", "(", "final", "K", "key", ")", "{", "return", "findOne", "(", "key", ",", "mongoProperties", ".", "getDefaultReadTimeout", "(", ")", ",", "TimeUnit", ".", "MILLISECONDS", ")", ";", "}" ]
Find a single value with the specified key, if existing. @param key the key to search for @return an Optional containing the requested value, or {@code Optional.empty()} if no value with this key exists
[ "Find", "a", "single", "value", "with", "the", "specified", "key", "if", "existing", "." ]
train
https://github.com/otto-de/edison-microservice/blob/89ecf0a0dee40977f004370b0b474a36c699e8a2/edison-mongo/src/main/java/de/otto/edison/mongo/AbstractMongoRepository.java#L60-L62
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java
WriteFileExtensions.writeByteArrayToFile
public static void writeByteArrayToFile(final String filename, final byte[] byteArray) throws IOException { final File file = new File(filename); writeByteArrayToFile(file, byteArray); }
java
public static void writeByteArrayToFile(final String filename, final byte[] byteArray) throws IOException { final File file = new File(filename); writeByteArrayToFile(file, byteArray); }
[ "public", "static", "void", "writeByteArrayToFile", "(", "final", "String", "filename", ",", "final", "byte", "[", "]", "byteArray", ")", "throws", "IOException", "{", "final", "File", "file", "=", "new", "File", "(", "filename", ")", ";", "writeByteArrayToFil...
Writes the given byte array to a file. @param filename The filename from the file. @param byteArray The byte array. @throws IOException Signals that an I/O exception has occurred.
[ "Writes", "the", "given", "byte", "array", "to", "a", "file", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java#L465-L470
baratine/baratine
framework/src/main/java/com/caucho/v5/ramp/jamp/InJamp.java
InJamp.readMessage
public MessageType readMessage(Reader is) throws IOException { JsonReaderImpl jIn = new JsonReaderImpl(is, _jsonFactory); return readMessage(jIn); }
java
public MessageType readMessage(Reader is) throws IOException { JsonReaderImpl jIn = new JsonReaderImpl(is, _jsonFactory); return readMessage(jIn); }
[ "public", "MessageType", "readMessage", "(", "Reader", "is", ")", "throws", "IOException", "{", "JsonReaderImpl", "jIn", "=", "new", "JsonReaderImpl", "(", "is", ",", "_jsonFactory", ")", ";", "return", "readMessage", "(", "jIn", ")", ";", "}" ]
Reads the next HMTP packet from the stream, returning false on end of file.
[ "Reads", "the", "next", "HMTP", "packet", "from", "the", "stream", "returning", "false", "on", "end", "of", "file", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/ramp/jamp/InJamp.java#L187-L193
phax/ph-web
ph-web/src/main/java/com/helger/web/multipart/MultipartStream.java
MultipartStream.findByte
@CheckForSigned protected int findByte (final byte nValue, final int nPos) { for (int i = nPos; i < m_nTail; i++) if (m_aBuffer[i] == nValue) return i; return -1; }
java
@CheckForSigned protected int findByte (final byte nValue, final int nPos) { for (int i = nPos; i < m_nTail; i++) if (m_aBuffer[i] == nValue) return i; return -1; }
[ "@", "CheckForSigned", "protected", "int", "findByte", "(", "final", "byte", "nValue", ",", "final", "int", "nPos", ")", "{", "for", "(", "int", "i", "=", "nPos", ";", "i", "<", "m_nTail", ";", "i", "++", ")", "if", "(", "m_aBuffer", "[", "i", "]",...
Searches for a byte of specified value in the <code>buffer</code>, starting at the specified <code>position</code>. @param nValue The value to find. @param nPos The starting position for searching. @return The position of byte found, counting from beginning of the <code>buffer</code>, or <code>-1</code> if not found.
[ "Searches", "for", "a", "byte", "of", "specified", "value", "in", "the", "<code", ">", "buffer<", "/", "code", ">", "starting", "at", "the", "specified", "<code", ">", "position<", "/", "code", ">", "." ]
train
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-web/src/main/java/com/helger/web/multipart/MultipartStream.java#L546-L553
OpenLiberty/open-liberty
dev/com.ibm.ws.app.manager/src/com/ibm/ws/app/manager/internal/monitor/DropinMonitor.java
DropinMonitor.tidyUpMonitoredDirectory
private void tidyUpMonitoredDirectory(boolean createdDir, File dirToCleanup) { if (createdDir && dirToCleanup != null) { File[] fileListing = dirToCleanup.listFiles(); if (fileListing == null || fileListing.length == 0) { if (!!!dirToCleanup.delete()) { Tr.error(_tc, "MONITOR_DIR_CLEANUP_FAIL", dirToCleanup); } else if (_tc.isDebugEnabled()) { //put the message that we were successful in debug so that we know it worked in automated testing Tr.debug(_tc, "Server deleted the old dropins directory " + dirToCleanup); } } } }
java
private void tidyUpMonitoredDirectory(boolean createdDir, File dirToCleanup) { if (createdDir && dirToCleanup != null) { File[] fileListing = dirToCleanup.listFiles(); if (fileListing == null || fileListing.length == 0) { if (!!!dirToCleanup.delete()) { Tr.error(_tc, "MONITOR_DIR_CLEANUP_FAIL", dirToCleanup); } else if (_tc.isDebugEnabled()) { //put the message that we were successful in debug so that we know it worked in automated testing Tr.debug(_tc, "Server deleted the old dropins directory " + dirToCleanup); } } } }
[ "private", "void", "tidyUpMonitoredDirectory", "(", "boolean", "createdDir", ",", "File", "dirToCleanup", ")", "{", "if", "(", "createdDir", "&&", "dirToCleanup", "!=", "null", ")", "{", "File", "[", "]", "fileListing", "=", "dirToCleanup", ".", "listFiles", "...
Clean up the monitored directory if we built it and it is empty. (i.e. clean up after ourselves if we can)
[ "Clean", "up", "the", "monitored", "directory", "if", "we", "built", "it", "and", "it", "is", "empty", ".", "(", "i", ".", "e", ".", "clean", "up", "after", "ourselves", "if", "we", "can", ")" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager/src/com/ibm/ws/app/manager/internal/monitor/DropinMonitor.java#L295-L307
hatunet/spring-data-mybatis
spring-data-mybatis/src/main/java/org/springframework/data/mybatis/dialect/pagination/AbstractLimitHandler.java
AbstractLimitHandler.bindLimitParameters
protected final int bindLimitParameters(RowSelection selection, PreparedStatement statement, int index) throws SQLException { if (!supportsVariableLimit() || !LimitHelper.hasMaxRows(selection)) { return 0; } final int firstRow = convertToFirstRowValue(LimitHelper.getFirstRow(selection)); final int lastRow = getMaxOrLimit(selection); final boolean hasFirstRow = supportsLimitOffset() && (firstRow > 0 || forceLimitUsage()); final boolean reverse = bindLimitParametersInReverseOrder(); if (hasFirstRow) { statement.setInt(index + (reverse ? 1 : 0), firstRow); } statement.setInt(index + (reverse || !hasFirstRow ? 0 : 1), lastRow); return hasFirstRow ? 2 : 1; }
java
protected final int bindLimitParameters(RowSelection selection, PreparedStatement statement, int index) throws SQLException { if (!supportsVariableLimit() || !LimitHelper.hasMaxRows(selection)) { return 0; } final int firstRow = convertToFirstRowValue(LimitHelper.getFirstRow(selection)); final int lastRow = getMaxOrLimit(selection); final boolean hasFirstRow = supportsLimitOffset() && (firstRow > 0 || forceLimitUsage()); final boolean reverse = bindLimitParametersInReverseOrder(); if (hasFirstRow) { statement.setInt(index + (reverse ? 1 : 0), firstRow); } statement.setInt(index + (reverse || !hasFirstRow ? 0 : 1), lastRow); return hasFirstRow ? 2 : 1; }
[ "protected", "final", "int", "bindLimitParameters", "(", "RowSelection", "selection", ",", "PreparedStatement", "statement", ",", "int", "index", ")", "throws", "SQLException", "{", "if", "(", "!", "supportsVariableLimit", "(", ")", "||", "!", "LimitHelper", ".", ...
Default implementation of binding parameter values needed by the LIMIT clause. @param selection the selection criteria for rows. @param statement Statement to which to bind limit parameter values. @param index Index from which to start binding. @return The number of parameter values bound. @throws SQLException Indicates problems binding parameter values.
[ "Default", "implementation", "of", "binding", "parameter", "values", "needed", "by", "the", "LIMIT", "clause", "." ]
train
https://github.com/hatunet/spring-data-mybatis/blob/ee6316f2c29f45e8e9ef1538957a29c21c89055f/spring-data-mybatis/src/main/java/org/springframework/data/mybatis/dialect/pagination/AbstractLimitHandler.java#L123-L137
groupon/odo
client/src/main/java/com/groupon/odo/client/PathValueClient.java
PathValueClient.getPathFromEndpoint
public JSONObject getPathFromEndpoint(String pathValue, String requestType) throws Exception { int type = getRequestTypeFromString(requestType); String url = BASE_PATH; JSONObject response = new JSONObject(doGet(url, null)); JSONArray paths = response.getJSONArray("paths"); for (int i = 0; i < paths.length(); i++) { JSONObject path = paths.getJSONObject(i); if (path.getString("path").equals(pathValue) && path.getInt("requestType") == type) { return path; } } return null; }
java
public JSONObject getPathFromEndpoint(String pathValue, String requestType) throws Exception { int type = getRequestTypeFromString(requestType); String url = BASE_PATH; JSONObject response = new JSONObject(doGet(url, null)); JSONArray paths = response.getJSONArray("paths"); for (int i = 0; i < paths.length(); i++) { JSONObject path = paths.getJSONObject(i); if (path.getString("path").equals(pathValue) && path.getInt("requestType") == type) { return path; } } return null; }
[ "public", "JSONObject", "getPathFromEndpoint", "(", "String", "pathValue", ",", "String", "requestType", ")", "throws", "Exception", "{", "int", "type", "=", "getRequestTypeFromString", "(", "requestType", ")", ";", "String", "url", "=", "BASE_PATH", ";", "JSONObj...
Retrieves the path using the endpoint value @param pathValue - path (endpoint) value @param requestType - "GET", "POST", etc @return Path or null @throws Exception exception
[ "Retrieves", "the", "path", "using", "the", "endpoint", "value" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/client/src/main/java/com/groupon/odo/client/PathValueClient.java#L43-L55
lestard/advanced-bindings
src/main/java/eu/lestard/advanced_bindings/api/MathBindings.java
MathBindings.IEEEremainder
public static DoubleBinding IEEEremainder(final ObservableDoubleValue f1, final ObservableDoubleValue f2) { return createDoubleBinding(() -> Math.IEEEremainder(f1.get(), f2.get()), f1, f2); }
java
public static DoubleBinding IEEEremainder(final ObservableDoubleValue f1, final ObservableDoubleValue f2) { return createDoubleBinding(() -> Math.IEEEremainder(f1.get(), f2.get()), f1, f2); }
[ "public", "static", "DoubleBinding", "IEEEremainder", "(", "final", "ObservableDoubleValue", "f1", ",", "final", "ObservableDoubleValue", "f2", ")", "{", "return", "createDoubleBinding", "(", "(", ")", "->", "Math", ".", "IEEEremainder", "(", "f1", ".", "get", "...
Binding for {@link java.lang.Math#IEEEremainder(double, double)} @param f1 the dividend. @param f2 the divisor. @return the remainder when {@code f1} is divided by {@code f2}.
[ "Binding", "for", "{", "@link", "java", ".", "lang", ".", "Math#IEEEremainder", "(", "double", "double", ")", "}" ]
train
https://github.com/lestard/advanced-bindings/blob/054a5dde261c29f862b971765fa3da3704a13ab4/src/main/java/eu/lestard/advanced_bindings/api/MathBindings.java#L624-L626
SeleniumHQ/selenium
java/client/src/org/openqa/selenium/interactions/Actions.java
Actions.moveByOffset
public Actions moveByOffset(int xOffset, int yOffset) { if (isBuildingActions()) { action.addAction(new MoveToOffsetAction(jsonMouse, null, xOffset, yOffset)); } return tick( defaultMouse.createPointerMove(Duration.ofMillis(200), Origin.pointer(), xOffset, yOffset)); }
java
public Actions moveByOffset(int xOffset, int yOffset) { if (isBuildingActions()) { action.addAction(new MoveToOffsetAction(jsonMouse, null, xOffset, yOffset)); } return tick( defaultMouse.createPointerMove(Duration.ofMillis(200), Origin.pointer(), xOffset, yOffset)); }
[ "public", "Actions", "moveByOffset", "(", "int", "xOffset", ",", "int", "yOffset", ")", "{", "if", "(", "isBuildingActions", "(", ")", ")", "{", "action", ".", "addAction", "(", "new", "MoveToOffsetAction", "(", "jsonMouse", ",", "null", ",", "xOffset", ",...
Moves the mouse from its current position (or 0,0) by the given offset. If the coordinates provided are outside the viewport (the mouse will end up outside the browser window) then the viewport is scrolled to match. @param xOffset horizontal offset. A negative value means moving the mouse left. @param yOffset vertical offset. A negative value means moving the mouse up. @return A self reference. @throws MoveTargetOutOfBoundsException if the provided offset is outside the document's boundaries.
[ "Moves", "the", "mouse", "from", "its", "current", "position", "(", "or", "0", "0", ")", "by", "the", "given", "offset", ".", "If", "the", "coordinates", "provided", "are", "outside", "the", "viewport", "(", "the", "mouse", "will", "end", "up", "outside"...
train
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/interactions/Actions.java#L405-L412
sarl/sarl
products/sarlc/src/main/java/io/sarl/lang/sarlc/modules/configs/SarlcConfigModule.java
SarlcConfigModule.getSarlcConfig
@SuppressWarnings("static-method") @Provides @Singleton public SarlConfig getSarlcConfig(ConfigurationFactory configFactory, Injector injector) { final SarlConfig config = SarlConfig.getConfiguration(configFactory); injector.injectMembers(config); return config; }
java
@SuppressWarnings("static-method") @Provides @Singleton public SarlConfig getSarlcConfig(ConfigurationFactory configFactory, Injector injector) { final SarlConfig config = SarlConfig.getConfiguration(configFactory); injector.injectMembers(config); return config; }
[ "@", "SuppressWarnings", "(", "\"static-method\"", ")", "@", "Provides", "@", "Singleton", "public", "SarlConfig", "getSarlcConfig", "(", "ConfigurationFactory", "configFactory", ",", "Injector", "injector", ")", "{", "final", "SarlConfig", "config", "=", "SarlConfig"...
Replies the instance of the sarl configuration. @param configFactory accessor to the bootique factory. @param injector the current injector. @return the path configuration accessor.
[ "Replies", "the", "instance", "of", "the", "sarl", "configuration", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/products/sarlc/src/main/java/io/sarl/lang/sarlc/modules/configs/SarlcConfigModule.java#L135-L142
Hygieia/Hygieia
collectors/misc/score/src/main/java/com/capitalone/dashboard/ApplicationScoreService.java
ApplicationScoreService.getScoreForApplication
public ScoreMetric getScoreForApplication(ScoreCollectorItem scoreApplication, ScoreCriteriaSettings scoreCriteriaSettings) { Dashboard dashboard = getDashboard(scoreApplication.getDashboardId()); if (null == dashboard) { LOGGER.info("Dashboard with id " + scoreApplication.getDashboardId() + " is null!"); return null; } LOGGER.info("Dashboard title:" + dashboard.getTitle() + ", type:" + dashboard.getType() + ", owner:" + dashboard.getOwner()); if (null == dashboard.getType() || !dashboard.getType().equals(DashboardType.Team)) { return null; } LOGGER.info("dashboard.getTitle():" + dashboard.getTitle() + " " + dashboard.getOwner()); ScoreWeight dashboardScore = getDashboardScoreFromWidgets( processWidgetScores(dashboard.getWidgets(), scoreCriteriaSettings) ); LOGGER.info("dashboardScore: {}" + dashboardScore); ScoreMetric scoreMetric = ScoreCalculationUtils.generateScoreMetric( dashboardScore, scoreCriteriaSettings.getMaxScore(), scoreApplication.getId(), dashboard.getId() ); LOGGER.info("ScoreMetric scoreMetric " + scoreMetric.toString()); return scoreMetric; }
java
public ScoreMetric getScoreForApplication(ScoreCollectorItem scoreApplication, ScoreCriteriaSettings scoreCriteriaSettings) { Dashboard dashboard = getDashboard(scoreApplication.getDashboardId()); if (null == dashboard) { LOGGER.info("Dashboard with id " + scoreApplication.getDashboardId() + " is null!"); return null; } LOGGER.info("Dashboard title:" + dashboard.getTitle() + ", type:" + dashboard.getType() + ", owner:" + dashboard.getOwner()); if (null == dashboard.getType() || !dashboard.getType().equals(DashboardType.Team)) { return null; } LOGGER.info("dashboard.getTitle():" + dashboard.getTitle() + " " + dashboard.getOwner()); ScoreWeight dashboardScore = getDashboardScoreFromWidgets( processWidgetScores(dashboard.getWidgets(), scoreCriteriaSettings) ); LOGGER.info("dashboardScore: {}" + dashboardScore); ScoreMetric scoreMetric = ScoreCalculationUtils.generateScoreMetric( dashboardScore, scoreCriteriaSettings.getMaxScore(), scoreApplication.getId(), dashboard.getId() ); LOGGER.info("ScoreMetric scoreMetric " + scoreMetric.toString()); return scoreMetric; }
[ "public", "ScoreMetric", "getScoreForApplication", "(", "ScoreCollectorItem", "scoreApplication", ",", "ScoreCriteriaSettings", "scoreCriteriaSettings", ")", "{", "Dashboard", "dashboard", "=", "getDashboard", "(", "scoreApplication", ".", "getDashboardId", "(", ")", ")", ...
Calculate score for a {@link ScoreCollectorItem} @param scoreApplication Score Application collector item for a dashboard @param scoreCriteriaSettings Score Criteria Settings @return Score for dashboard
[ "Calculate", "score", "for", "a", "{", "@link", "ScoreCollectorItem", "}" ]
train
https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/collectors/misc/score/src/main/java/com/capitalone/dashboard/ApplicationScoreService.java#L60-L91
bwkimmel/java-util
src/main/java/ca/eandb/util/sql/DbUtil.java
DbUtil.getTypeName
private static String getTypeName(int type, int length, ResultSet typeInfo) throws SQLException { int dataTypeColumn = typeInfo.findColumn("DATA_TYPE"); while (typeInfo.next()) { if (typeInfo.getInt(dataTypeColumn) == type) { String typeName = typeInfo.getString("TYPE_NAME"); if (length > 0) { if (typeName.contains("()")) { return typeName.replaceAll("\\(\\)", "(" + length + ")"); } else { return typeName + "(" + length + ")"; } } else { return typeName; } } } return null; }
java
private static String getTypeName(int type, int length, ResultSet typeInfo) throws SQLException { int dataTypeColumn = typeInfo.findColumn("DATA_TYPE"); while (typeInfo.next()) { if (typeInfo.getInt(dataTypeColumn) == type) { String typeName = typeInfo.getString("TYPE_NAME"); if (length > 0) { if (typeName.contains("()")) { return typeName.replaceAll("\\(\\)", "(" + length + ")"); } else { return typeName + "(" + length + ")"; } } else { return typeName; } } } return null; }
[ "private", "static", "String", "getTypeName", "(", "int", "type", ",", "int", "length", ",", "ResultSet", "typeInfo", ")", "throws", "SQLException", "{", "int", "dataTypeColumn", "=", "typeInfo", ".", "findColumn", "(", "\"DATA_TYPE\"", ")", ";", "while", "(",...
Gets the <code>String</code> denoting the specified SQL data type. @param type The data type to get the name of. Valid type values consist of the static fields of {@link java.sql.Types}. @param length The length to assign to data types for those types that require a length (e.g., <code>VARCHAR(n)</code>), or zero to indicate that no length is required. @param typeInfo The <code>ResultSet</code> containing the type information for the database. This must be obtained using {@link java.sql.DatabaseMetaData#getTypeInfo()}. @return The name of the type, or <code>null</code> if no such type exists. @throws SQLException If an error occurs while communicating with the database. @see java.sql.Types @see java.sql.DatabaseMetaData#getTypeInfo()
[ "Gets", "the", "<code", ">", "String<", "/", "code", ">", "denoting", "the", "specified", "SQL", "data", "type", "." ]
train
https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/sql/DbUtil.java#L521-L538
redkale/redkale-plugins
src/org/redkalex/convert/pson/ProtobufReader.java
ProtobufReader.readArrayB
@Override public final int readArrayB(DeMember member, byte[] typevals, Decodeable componentDecoder) { if (member == null || componentDecoder == null) return Reader.SIGN_NOLENBUTBYTES; Type type = componentDecoder.getType(); if (!(type instanceof Class)) return Reader.SIGN_NOLENBUTBYTES; Class clazz = (Class) type; if (clazz.isPrimitive() || clazz == Boolean.class || clazz == Byte.class || clazz == Short.class || clazz == Character.class || clazz == Integer.class || clazz == Float.class || clazz == Long.class || clazz == Double.class) { return Reader.SIGN_NOLENBUTBYTES; } return Reader.SIGN_NOLENGTH; }
java
@Override public final int readArrayB(DeMember member, byte[] typevals, Decodeable componentDecoder) { if (member == null || componentDecoder == null) return Reader.SIGN_NOLENBUTBYTES; Type type = componentDecoder.getType(); if (!(type instanceof Class)) return Reader.SIGN_NOLENBUTBYTES; Class clazz = (Class) type; if (clazz.isPrimitive() || clazz == Boolean.class || clazz == Byte.class || clazz == Short.class || clazz == Character.class || clazz == Integer.class || clazz == Float.class || clazz == Long.class || clazz == Double.class) { return Reader.SIGN_NOLENBUTBYTES; } return Reader.SIGN_NOLENGTH; }
[ "@", "Override", "public", "final", "int", "readArrayB", "(", "DeMember", "member", ",", "byte", "[", "]", "typevals", ",", "Decodeable", "componentDecoder", ")", "{", "if", "(", "member", "==", "null", "||", "componentDecoder", "==", "null", ")", "return", ...
判断下一个非空白字符是否为[ @param member DeMember @param typevals byte[] @param componentDecoder Decodeable @return SIGN_NOLENGTH 或 SIGN_NULL
[ "判断下一个非空白字符是否为", "[" ]
train
https://github.com/redkale/redkale-plugins/blob/a1edfc906a444ae19fe6aababce2957c9b5ea9d2/src/org/redkalex/convert/pson/ProtobufReader.java#L104-L118
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterHeartbeatManager.java
ClusterHeartbeatManager.onHeartbeat
public void onHeartbeat(MemberImpl member, long timestamp) { if (member == null) { return; } long clusterTime = clusterClock.getClusterTime(); if (logger.isFineEnabled()) { logger.fine(format("Received heartbeat from %s (now: %s, timestamp: %s)", member, timeToString(clusterTime), timeToString(timestamp))); } if (clusterTime - timestamp > maxNoHeartbeatMillis / 2) { logger.warning(format("Ignoring heartbeat from %s since it is expired (now: %s, timestamp: %s)", member, timeToString(clusterTime), timeToString(timestamp))); return; } if (isMaster(member)) { clusterClock.setMasterTime(timestamp); } heartbeatFailureDetector.heartbeat(member, clusterClock.getClusterTime()); MembershipManager membershipManager = clusterService.getMembershipManager(); membershipManager.clearMemberSuspicion(member.getAddress(), "Valid heartbeat"); nodeEngine.getQuorumService().onHeartbeat(member, timestamp); }
java
public void onHeartbeat(MemberImpl member, long timestamp) { if (member == null) { return; } long clusterTime = clusterClock.getClusterTime(); if (logger.isFineEnabled()) { logger.fine(format("Received heartbeat from %s (now: %s, timestamp: %s)", member, timeToString(clusterTime), timeToString(timestamp))); } if (clusterTime - timestamp > maxNoHeartbeatMillis / 2) { logger.warning(format("Ignoring heartbeat from %s since it is expired (now: %s, timestamp: %s)", member, timeToString(clusterTime), timeToString(timestamp))); return; } if (isMaster(member)) { clusterClock.setMasterTime(timestamp); } heartbeatFailureDetector.heartbeat(member, clusterClock.getClusterTime()); MembershipManager membershipManager = clusterService.getMembershipManager(); membershipManager.clearMemberSuspicion(member.getAddress(), "Valid heartbeat"); nodeEngine.getQuorumService().onHeartbeat(member, timestamp); }
[ "public", "void", "onHeartbeat", "(", "MemberImpl", "member", ",", "long", "timestamp", ")", "{", "if", "(", "member", "==", "null", ")", "{", "return", ";", "}", "long", "clusterTime", "=", "clusterClock", ".", "getClusterTime", "(", ")", ";", "if", "("...
Accepts the heartbeat message from {@code member} created at {@code timestamp}. The timestamp must be related to the cluster clock, not the local clock. The heartbeat is ignored if the duration between {@code timestamp} and the current cluster time is more than {@link GroupProperty#MAX_NO_HEARTBEAT_SECONDS}/2. If the sending node is the master, this node will also calculate and set the cluster clock diff. @param member the member sending the heartbeat @param timestamp the timestamp when the heartbeat was created
[ "Accepts", "the", "heartbeat", "message", "from", "{", "@code", "member", "}", "created", "at", "{", "@code", "timestamp", "}", ".", "The", "timestamp", "must", "be", "related", "to", "the", "cluster", "clock", "not", "the", "local", "clock", ".", "The", ...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterHeartbeatManager.java#L383-L407
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WDataTableRenderer.java
WDataTableRenderer.paintRows
private void paintRows(final WDataTable table, final WebXmlRenderContext renderContext) { XmlStringBuilder xml = renderContext.getWriter(); TableDataModel model = table.getDataModel(); xml.appendTagOpen("ui:tbody"); xml.appendAttribute("id", table.getRepeater().getId()); xml.appendClose(); if (model.getRowCount() == 0) { xml.appendTag("ui:nodata"); xml.appendEscaped(table.getNoDataMessage()); xml.appendEndTag("ui:nodata"); } else { // If has at least one visible col, paint the rows. final int columnCount = table.getColumnCount(); for (int i = 0; i < columnCount; i++) { if (table.getColumn(i).isVisible()) { doPaintRows(table, renderContext); break; } } } xml.appendEndTag("ui:tbody"); }
java
private void paintRows(final WDataTable table, final WebXmlRenderContext renderContext) { XmlStringBuilder xml = renderContext.getWriter(); TableDataModel model = table.getDataModel(); xml.appendTagOpen("ui:tbody"); xml.appendAttribute("id", table.getRepeater().getId()); xml.appendClose(); if (model.getRowCount() == 0) { xml.appendTag("ui:nodata"); xml.appendEscaped(table.getNoDataMessage()); xml.appendEndTag("ui:nodata"); } else { // If has at least one visible col, paint the rows. final int columnCount = table.getColumnCount(); for (int i = 0; i < columnCount; i++) { if (table.getColumn(i).isVisible()) { doPaintRows(table, renderContext); break; } } } xml.appendEndTag("ui:tbody"); }
[ "private", "void", "paintRows", "(", "final", "WDataTable", "table", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "XmlStringBuilder", "xml", "=", "renderContext", ".", "getWriter", "(", ")", ";", "TableDataModel", "model", "=", "table", ".", "...
Paints the rows of the table. @param table the table to paint the rows for. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "rows", "of", "the", "table", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WDataTableRenderer.java#L299-L324
lessthanoptimal/BoofCV
integration/boofcv-swing/src/main/java/boofcv/gui/image/ShowImages.java
ShowImages.showGrid
public static ImageGridPanel showGrid( int numColumns , String title , BufferedImage ...images ) { JFrame frame = new JFrame(title); int numRows = images.length/numColumns + images.length%numColumns; ImageGridPanel panel = new ImageGridPanel(numRows,numColumns,images); frame.add(panel, BorderLayout.CENTER); frame.pack(); frame.setVisible(true); return panel; }
java
public static ImageGridPanel showGrid( int numColumns , String title , BufferedImage ...images ) { JFrame frame = new JFrame(title); int numRows = images.length/numColumns + images.length%numColumns; ImageGridPanel panel = new ImageGridPanel(numRows,numColumns,images); frame.add(panel, BorderLayout.CENTER); frame.pack(); frame.setVisible(true); return panel; }
[ "public", "static", "ImageGridPanel", "showGrid", "(", "int", "numColumns", ",", "String", "title", ",", "BufferedImage", "...", "images", ")", "{", "JFrame", "frame", "=", "new", "JFrame", "(", "title", ")", ";", "int", "numRows", "=", "images", ".", "len...
Shows a set of images in a grid pattern. @param numColumns How many columns are in the grid @param title Number of the window @param images List of images to show @return Display panel
[ "Shows", "a", "set", "of", "images", "in", "a", "grid", "pattern", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/image/ShowImages.java#L56-L68
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithoutPath.java
PactDslRequestWithoutPath.pathFromProviderState
public PactDslRequestWithPath pathFromProviderState(String expression, String example) { requestGenerators.addGenerator(Category.PATH, new ProviderStateGenerator(expression)); return new PactDslRequestWithPath(consumerPactBuilder, consumerName, providerName, pactDslWithState.state, description, example, requestMethod, requestHeaders, query, requestBody, requestMatchers, requestGenerators, defaultRequestValues, defaultResponseValues); }
java
public PactDslRequestWithPath pathFromProviderState(String expression, String example) { requestGenerators.addGenerator(Category.PATH, new ProviderStateGenerator(expression)); return new PactDslRequestWithPath(consumerPactBuilder, consumerName, providerName, pactDslWithState.state, description, example, requestMethod, requestHeaders, query, requestBody, requestMatchers, requestGenerators, defaultRequestValues, defaultResponseValues); }
[ "public", "PactDslRequestWithPath", "pathFromProviderState", "(", "String", "expression", ",", "String", "example", ")", "{", "requestGenerators", ".", "addGenerator", "(", "Category", ".", "PATH", ",", "new", "ProviderStateGenerator", "(", "expression", ")", ")", "...
Sets the path to have it's value injected from the provider state @param expression Expression to be evaluated from the provider state @param example Example value to use in the consumer test
[ "Sets", "the", "path", "to", "have", "it", "s", "value", "injected", "from", "the", "provider", "state" ]
train
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithoutPath.java#L319-L324
vznet/mongo-jackson-mapper
src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java
JacksonDBCollection.findAndRemove
public T findAndRemove(DBObject query) { return findAndModify(query, null, null, true, new BasicDBObject(), false, false); // Alibi DBObject due ambiguous method call }
java
public T findAndRemove(DBObject query) { return findAndModify(query, null, null, true, new BasicDBObject(), false, false); // Alibi DBObject due ambiguous method call }
[ "public", "T", "findAndRemove", "(", "DBObject", "query", ")", "{", "return", "findAndModify", "(", "query", ",", "null", ",", "null", ",", "true", ",", "new", "BasicDBObject", "(", ")", ",", "false", ",", "false", ")", ";", "// Alibi DBObject due ambiguous ...
calls {@link DBCollection#findAndModify(com.mongodb.DBObject, com.mongodb.DBObject, com.mongodb.DBObject, boolean, com.mongodb.DBObject, boolean, boolean)} with fields=null, sort=null, remove=true, returnNew=false, upsert=false @param query The query @return the removed object
[ "calls", "{", "@link", "DBCollection#findAndModify", "(", "com", ".", "mongodb", ".", "DBObject", "com", ".", "mongodb", ".", "DBObject", "com", ".", "mongodb", ".", "DBObject", "boolean", "com", ".", "mongodb", ".", "DBObject", "boolean", "boolean", ")", "}...
train
https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java#L659-L661
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/ObjectUtils.java
ObjectUtils.equalsIgnoreNull
@NullSafe public static boolean equalsIgnoreNull(Object obj1, Object obj2) { return obj1 == null ? obj2 == null : obj1.equals(obj2); }
java
@NullSafe public static boolean equalsIgnoreNull(Object obj1, Object obj2) { return obj1 == null ? obj2 == null : obj1.equals(obj2); }
[ "@", "NullSafe", "public", "static", "boolean", "equalsIgnoreNull", "(", "Object", "obj1", ",", "Object", "obj2", ")", "{", "return", "obj1", "==", "null", "?", "obj2", "==", "null", ":", "obj1", ".", "equals", "(", "obj2", ")", ";", "}" ]
Determines whether two objects are equal in value as determined by the Object.equals method. Both objects are considered equal if and only if both are null or obj1.equals(obj2). @param obj1 the first Object in the equality comparison. @param obj2 the second Object in the equality comparison. @return a boolean value indicating whether the two Objects are equal in value where two null Object references are considered equal as well. @see java.lang.Object#equals(Object)
[ "Determines", "whether", "two", "objects", "are", "equal", "in", "value", "as", "determined", "by", "the", "Object", ".", "equals", "method", ".", "Both", "objects", "are", "considered", "equal", "if", "and", "only", "if", "both", "are", "null", "or", "obj...
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ObjectUtils.java#L311-L314
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker.java
WebSocketClientHandshaker.close
public ChannelFuture close(Channel channel, CloseWebSocketFrame frame, ChannelPromise promise) { if (channel == null) { throw new NullPointerException("channel"); } channel.writeAndFlush(frame, promise); applyForceCloseTimeout(channel, promise); return promise; }
java
public ChannelFuture close(Channel channel, CloseWebSocketFrame frame, ChannelPromise promise) { if (channel == null) { throw new NullPointerException("channel"); } channel.writeAndFlush(frame, promise); applyForceCloseTimeout(channel, promise); return promise; }
[ "public", "ChannelFuture", "close", "(", "Channel", "channel", ",", "CloseWebSocketFrame", "frame", ",", "ChannelPromise", "promise", ")", "{", "if", "(", "channel", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"channel\"", ")", ";", ...
Performs the closing handshake @param channel Channel @param frame Closing Frame that was received @param promise the {@link ChannelPromise} to be notified when the closing handshake is done
[ "Performs", "the", "closing", "handshake" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker.java#L490-L497
logic-ng/LogicNG
src/main/java/org/logicng/formulas/FormulaFactory.java
FormulaFactory.constructCNF
private Formula constructCNF(final LinkedHashSet<? extends Formula> clauses) { if (clauses.isEmpty()) return this.verum(); if (clauses.size() == 1) return clauses.iterator().next(); Map<LinkedHashSet<? extends Formula>, And> opAndMap = this.andsN; switch (clauses.size()) { case 2: opAndMap = this.ands2; break; case 3: opAndMap = this.ands3; break; case 4: opAndMap = this.ands4; break; default: break; } And tempAnd = opAndMap.get(clauses); if (tempAnd != null) return tempAnd; tempAnd = new And(clauses, this, true); opAndMap.put(clauses, tempAnd); return tempAnd; }
java
private Formula constructCNF(final LinkedHashSet<? extends Formula> clauses) { if (clauses.isEmpty()) return this.verum(); if (clauses.size() == 1) return clauses.iterator().next(); Map<LinkedHashSet<? extends Formula>, And> opAndMap = this.andsN; switch (clauses.size()) { case 2: opAndMap = this.ands2; break; case 3: opAndMap = this.ands3; break; case 4: opAndMap = this.ands4; break; default: break; } And tempAnd = opAndMap.get(clauses); if (tempAnd != null) return tempAnd; tempAnd = new And(clauses, this, true); opAndMap.put(clauses, tempAnd); return tempAnd; }
[ "private", "Formula", "constructCNF", "(", "final", "LinkedHashSet", "<", "?", "extends", "Formula", ">", "clauses", ")", "{", "if", "(", "clauses", ".", "isEmpty", "(", ")", ")", "return", "this", ".", "verum", "(", ")", ";", "if", "(", "clauses", "."...
Creates a new CNF. @param clauses the clauses @return a new CNF
[ "Creates", "a", "new", "CNF", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/FormulaFactory.java#L507-L532
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/crdt/pncounter/PNCounterImpl.java
PNCounterImpl.get
public CRDTTimestampedLong get(VectorClock observedTimestamps) { checkSessionConsistency(observedTimestamps); stateReadLock.lock(); try { long value = 0; for (long[] pnValue : state.values()) { value += pnValue[0]; value -= pnValue[1]; } return new CRDTTimestampedLong(value, new VectorClock(stateVectorClock)); } finally { stateReadLock.unlock(); } }
java
public CRDTTimestampedLong get(VectorClock observedTimestamps) { checkSessionConsistency(observedTimestamps); stateReadLock.lock(); try { long value = 0; for (long[] pnValue : state.values()) { value += pnValue[0]; value -= pnValue[1]; } return new CRDTTimestampedLong(value, new VectorClock(stateVectorClock)); } finally { stateReadLock.unlock(); } }
[ "public", "CRDTTimestampedLong", "get", "(", "VectorClock", "observedTimestamps", ")", "{", "checkSessionConsistency", "(", "observedTimestamps", ")", ";", "stateReadLock", ".", "lock", "(", ")", ";", "try", "{", "long", "value", "=", "0", ";", "for", "(", "lo...
Returns the current value of the counter. <p> The method can throw a {@link ConsistencyLostException} when the state of this CRDT is not causally related to the observed timestamps. This means that it cannot provide the session guarantees of RYW (read your writes) and monotonic read. @param observedTimestamps the vector clock last observed by the client of this counter @return the current counter value with the current counter vector clock @throws ConsistencyLostException if this replica cannot provide the session guarantees
[ "Returns", "the", "current", "value", "of", "the", "counter", ".", "<p", ">", "The", "method", "can", "throw", "a", "{", "@link", "ConsistencyLostException", "}", "when", "the", "state", "of", "this", "CRDT", "is", "not", "causally", "related", "to", "the"...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/crdt/pncounter/PNCounterImpl.java#L80-L93
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/RaMetaCodeGen.java
RaMetaCodeGen.writeClassBody
@Override public void writeClassBody(Definition def, Writer out) throws IOException { out.write("public class " + getClassName(def) + " implements ResourceAdapterMetaData"); writeLeftCurlyBracket(out, 0); int indent = 1; writeDefaultConstructor(def, out, indent); writeInfo(def, out, indent); writeSupport(def, out, indent); writeRightCurlyBracket(out, 0); }
java
@Override public void writeClassBody(Definition def, Writer out) throws IOException { out.write("public class " + getClassName(def) + " implements ResourceAdapterMetaData"); writeLeftCurlyBracket(out, 0); int indent = 1; writeDefaultConstructor(def, out, indent); writeInfo(def, out, indent); writeSupport(def, out, indent); writeRightCurlyBracket(out, 0); }
[ "@", "Override", "public", "void", "writeClassBody", "(", "Definition", "def", ",", "Writer", "out", ")", "throws", "IOException", "{", "out", ".", "write", "(", "\"public class \"", "+", "getClassName", "(", "def", ")", "+", "\" implements ResourceAdapterMetaData...
Output Metadata class @param def definition @param out Writer @throws IOException ioException
[ "Output", "Metadata", "class" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/RaMetaCodeGen.java#L43-L57
liferay/com-liferay-commerce
commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationQueueEntryPersistenceImpl.java
CommerceNotificationQueueEntryPersistenceImpl.findAll
@Override public List<CommerceNotificationQueueEntry> findAll(int start, int end) { return findAll(start, end, null); }
java
@Override public List<CommerceNotificationQueueEntry> findAll(int start, int end) { return findAll(start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceNotificationQueueEntry", ">", "findAll", "(", "int", "start", ",", "int", "end", ")", "{", "return", "findAll", "(", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the commerce notification queue entries. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceNotificationQueueEntryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param start the lower bound of the range of commerce notification queue entries @param end the upper bound of the range of commerce notification queue entries (not inclusive) @return the range of commerce notification queue entries
[ "Returns", "a", "range", "of", "all", "the", "commerce", "notification", "queue", "entries", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationQueueEntryPersistenceImpl.java#L2811-L2814
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/stat/pq/pq_stats.java
pq_stats.get_nitro_response
protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception { pq_stats[] resources = new pq_stats[1]; pq_response result = (pq_response) service.get_payload_formatter().string_to_resource(pq_response.class, response); if(result.errorcode != 0) { if (result.errorcode == 444) { service.clear_session(); } if(result.severity != null) { if (result.severity.equals("ERROR")) throw new nitro_exception(result.message,result.errorcode); } else { throw new nitro_exception(result.message,result.errorcode); } } resources[0] = result.pq; return resources; }
java
protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception { pq_stats[] resources = new pq_stats[1]; pq_response result = (pq_response) service.get_payload_formatter().string_to_resource(pq_response.class, response); if(result.errorcode != 0) { if (result.errorcode == 444) { service.clear_session(); } if(result.severity != null) { if (result.severity.equals("ERROR")) throw new nitro_exception(result.message,result.errorcode); } else { throw new nitro_exception(result.message,result.errorcode); } } resources[0] = result.pq; return resources; }
[ "protected", "base_resource", "[", "]", "get_nitro_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "pq_stats", "[", "]", "resources", "=", "new", "pq_stats", "[", "1", "]", ";", "pq_response", "result", "...
<pre> converts nitro response into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "converts", "nitro", "response", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/pq/pq_stats.java#L157-L176
esigate/esigate
esigate-core/src/main/java/org/esigate/util/UriUtils.java
UriUtils.rewriteURI
public static String rewriteURI(String uri, HttpHost targetHost) { try { return URIUtils.rewriteURI(createURI(uri), targetHost).toString(); } catch (URISyntaxException e) { throw new InvalidUriException(e); } }
java
public static String rewriteURI(String uri, HttpHost targetHost) { try { return URIUtils.rewriteURI(createURI(uri), targetHost).toString(); } catch (URISyntaxException e) { throw new InvalidUriException(e); } }
[ "public", "static", "String", "rewriteURI", "(", "String", "uri", ",", "HttpHost", "targetHost", ")", "{", "try", "{", "return", "URIUtils", ".", "rewriteURI", "(", "createURI", "(", "uri", ")", ",", "targetHost", ")", ".", "toString", "(", ")", ";", "}"...
Replaces the scheme, host and port in a URI. @param uri the URI @param targetHost the target host @return the rewritten URI
[ "Replaces", "the", "scheme", "host", "and", "port", "in", "a", "URI", "." ]
train
https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/util/UriUtils.java#L226-L232
synchronoss/cpo-api
cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java
CassandraCpoAdapter.persistObject
@Override public <T> long persistObject(T obj) throws CpoException { return processUpdateGroup(obj, CpoAdapter.PERSIST_GROUP, null, null, null, null); }
java
@Override public <T> long persistObject(T obj) throws CpoException { return processUpdateGroup(obj, CpoAdapter.PERSIST_GROUP, null, null, null, null); }
[ "@", "Override", "public", "<", "T", ">", "long", "persistObject", "(", "T", "obj", ")", "throws", "CpoException", "{", "return", "processUpdateGroup", "(", "obj", ",", "CpoAdapter", ".", "PERSIST_GROUP", ",", "null", ",", "null", ",", "null", ",", "null",...
Persists the Object into the datasource. The CpoAdapter will check to see if this object exists in the datasource. If it exists, the object is updated in the datasource If the object does not exist, then it is created in the datasource. This method stores the object in the datasource. This method uses the default EXISTS, CREATE, and UPDATE Function Groups specified for this object. <p/> <pre>Example: <code> <p/> class SomeObject so = new SomeObject(); class CpoAdapter cpo = null; <p/> try { cpo = new CpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; } <p/> if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ cpo.persistObject(so); } catch (CpoException ce) { // Handle the error } } </code> </pre> @param obj This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. @return A count of the number of objects persisted @throws CpoException Thrown if there are errors accessing the datasource @see #existsObject @see #insertObject @see #updateObject
[ "Persists", "the", "Object", "into", "the", "datasource", ".", "The", "CpoAdapter", "will", "check", "to", "see", "if", "this", "object", "exists", "in", "the", "datasource", ".", "If", "it", "exists", "the", "object", "is", "updated", "in", "the", "dataso...
train
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java#L1179-L1182
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/trifocal/TrifocalExtractGeometries.java
TrifocalExtractGeometries.extractCamera
public void extractCamera( DMatrixRMaj P2 , DMatrixRMaj P3 ) { // temp1 = [e3*e3^T -I] for( int i = 0; i < 3; i++ ) { for( int j = 0; j < 3; j++ ) { temp1.set(i,j,e3.getIdx(i)*e3.getIdx(j)); } temp1.set(i,i , temp1.get(i,i) - 1); } // compute the camera matrices one column at a time for( int i = 0; i < 3; i++ ) { DMatrixRMaj T = tensor.getT(i); GeometryMath_F64.mult(T, e3, column); P2.set(0, i, column.x); P2.set(1, i, column.y); P2.set(2, i, column.z); P2.set(i, 3, e2.getIdx(i)); GeometryMath_F64.multTran(T, e2, temp0); GeometryMath_F64.mult(temp1, temp0, column); P3.set(0, i, column.x); P3.set(1, i, column.y); P3.set(2, i, column.z); P3.set(i, 3, e3.getIdx(i)); } }
java
public void extractCamera( DMatrixRMaj P2 , DMatrixRMaj P3 ) { // temp1 = [e3*e3^T -I] for( int i = 0; i < 3; i++ ) { for( int j = 0; j < 3; j++ ) { temp1.set(i,j,e3.getIdx(i)*e3.getIdx(j)); } temp1.set(i,i , temp1.get(i,i) - 1); } // compute the camera matrices one column at a time for( int i = 0; i < 3; i++ ) { DMatrixRMaj T = tensor.getT(i); GeometryMath_F64.mult(T, e3, column); P2.set(0, i, column.x); P2.set(1, i, column.y); P2.set(2, i, column.z); P2.set(i, 3, e2.getIdx(i)); GeometryMath_F64.multTran(T, e2, temp0); GeometryMath_F64.mult(temp1, temp0, column); P3.set(0, i, column.x); P3.set(1, i, column.y); P3.set(2, i, column.z); P3.set(i, 3, e3.getIdx(i)); } }
[ "public", "void", "extractCamera", "(", "DMatrixRMaj", "P2", ",", "DMatrixRMaj", "P3", ")", "{", "// temp1 = [e3*e3^T -I]", "for", "(", "int", "i", "=", "0", ";", "i", "<", "3", ";", "i", "++", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", ...
<p> Extract the camera matrices up to a common projective transform. </p> <p>P2 = [[T1.T2.T3]e3|e2] and P3=[(e3*e2<sup>T</sup>-I)[T1',T2',T3'|e2|e3]</p> <p> NOTE: The camera matrix for the first view is assumed to be P1 = [I|0]. </p> @param P2 Output: 3x4 camera matrix for views 2. Modified. @param P3 Output: 3x4 camera matrix for views 3. Modified.
[ "<p", ">", "Extract", "the", "camera", "matrices", "up", "to", "a", "common", "projective", "transform", ".", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/trifocal/TrifocalExtractGeometries.java#L163-L190
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/Transform.java
Transform.setFromString
public void setFromString(String prop, String ...val) { if (val.length == 1) { String[] vals = val[0].split("[\\s,]+"); set(prop, vals); } else { set(prop, val); } }
java
public void setFromString(String prop, String ...val) { if (val.length == 1) { String[] vals = val[0].split("[\\s,]+"); set(prop, vals); } else { set(prop, val); } }
[ "public", "void", "setFromString", "(", "String", "prop", ",", "String", "...", "val", ")", "{", "if", "(", "val", ".", "length", "==", "1", ")", "{", "String", "[", "]", "vals", "=", "val", "[", "0", "]", ".", "split", "(", "\"[\\\\s,]+\"", ")", ...
Set a transform multi-value giving either a set of strings or just an string of values separated by comma.
[ "Set", "a", "transform", "multi", "-", "value", "giving", "either", "a", "set", "of", "strings", "or", "just", "an", "string", "of", "values", "separated", "by", "comma", "." ]
train
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/Transform.java#L182-L189
FasterXML/woodstox
src/main/java/com/ctc/wstx/util/TextBuffer.java
TextBuffer.initBinaryChunks
public void initBinaryChunks(Base64Variant v, CharArrayBase64Decoder dec, boolean firstChunk) { if (mInputStart < 0) { // non-shared dec.init(v, firstChunk, mCurrentSegment, 0, mCurrentSize, mSegments); } else { // shared dec.init(v, firstChunk, mInputBuffer, mInputStart, mInputLen, null); } }
java
public void initBinaryChunks(Base64Variant v, CharArrayBase64Decoder dec, boolean firstChunk) { if (mInputStart < 0) { // non-shared dec.init(v, firstChunk, mCurrentSegment, 0, mCurrentSize, mSegments); } else { // shared dec.init(v, firstChunk, mInputBuffer, mInputStart, mInputLen, null); } }
[ "public", "void", "initBinaryChunks", "(", "Base64Variant", "v", ",", "CharArrayBase64Decoder", "dec", ",", "boolean", "firstChunk", ")", "{", "if", "(", "mInputStart", "<", "0", ")", "{", "// non-shared", "dec", ".", "init", "(", "v", ",", "firstChunk", ","...
Method that needs to be called to configure given base64 decoder with textual contents collected by this buffer. @param dec Decoder that will need data @param firstChunk Whether this is the first segment fed or not; if it is, state needs to be fullt reset; if not, only partially.
[ "Method", "that", "needs", "to", "be", "called", "to", "configure", "given", "base64", "decoder", "with", "textual", "contents", "collected", "by", "this", "buffer", "." ]
train
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/TextBuffer.java#L533-L540
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/svg/inkscape/Util.java
Util.getStyle
static String getStyle(Element element, String styleName) { String value = element.getAttribute(styleName); if ((value != null) && (value.length() > 0)) { return value; } String style = element.getAttribute("style"); return extractStyle(style, styleName); }
java
static String getStyle(Element element, String styleName) { String value = element.getAttribute(styleName); if ((value != null) && (value.length() > 0)) { return value; } String style = element.getAttribute("style"); return extractStyle(style, styleName); }
[ "static", "String", "getStyle", "(", "Element", "element", ",", "String", "styleName", ")", "{", "String", "value", "=", "element", ".", "getAttribute", "(", "styleName", ")", ";", "if", "(", "(", "value", "!=", "null", ")", "&&", "(", "value", ".", "l...
Get the style attribute setting for a given style information element (i.e. fill, stroke) @param element The element to be processed @param styleName The name of the attribute to retrieve @return The style value
[ "Get", "the", "style", "attribute", "setting", "for", "a", "given", "style", "information", "element", "(", "i", ".", "e", ".", "fill", "stroke", ")" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/svg/inkscape/Util.java#L69-L78
Azure/azure-sdk-for-java
locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java
ManagementLocksInner.getAtResourceLevel
public ManagementLockObjectInner getAtResourceLevel(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String lockName) { return getAtResourceLevelWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName).toBlocking().single().body(); }
java
public ManagementLockObjectInner getAtResourceLevel(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String lockName) { return getAtResourceLevelWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName).toBlocking().single().body(); }
[ "public", "ManagementLockObjectInner", "getAtResourceLevel", "(", "String", "resourceGroupName", ",", "String", "resourceProviderNamespace", ",", "String", "parentResourcePath", ",", "String", "resourceType", ",", "String", "resourceName", ",", "String", "lockName", ")", ...
Get the management lock of a resource or any level below resource. @param resourceGroupName The name of the resource group. @param resourceProviderNamespace The namespace of the resource provider. @param parentResourcePath An extra path parameter needed in some services, like SQL Databases. @param resourceType The type of the resource. @param resourceName The name of the resource. @param lockName The name of lock. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ManagementLockObjectInner object if successful.
[ "Get", "the", "management", "lock", "of", "a", "resource", "or", "any", "level", "below", "resource", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java#L932-L934
alkacon/opencms-core
src/org/opencms/loader/CmsImageScaler.java
CmsImageScaler.getDownScaler
public CmsImageScaler getDownScaler(CmsImageScaler downScaler) { if (!isDownScaleRequired(downScaler)) { // no down scaling is required return null; } int downHeight = downScaler.getHeight(); int downWidth = downScaler.getWidth(); int height = getHeight(); int width = getWidth(); if (((height > width) && (downHeight < downWidth)) || ((width > height) && (downWidth < downHeight))) { // adjust orientation downHeight = downWidth; downWidth = downScaler.getHeight(); } if (width > downWidth) { // width is too large, re-calculate height float scale = (float)downWidth / (float)width; downHeight = Math.round(height * scale); } else if (height > downHeight) { // height is too large, re-calculate width float scale = (float)downHeight / (float)height; downWidth = Math.round(width * scale); } else { // something is wrong, don't down scale return null; } // now create and initialize the result scaler return new CmsImageScaler(downScaler, downWidth, downHeight); }
java
public CmsImageScaler getDownScaler(CmsImageScaler downScaler) { if (!isDownScaleRequired(downScaler)) { // no down scaling is required return null; } int downHeight = downScaler.getHeight(); int downWidth = downScaler.getWidth(); int height = getHeight(); int width = getWidth(); if (((height > width) && (downHeight < downWidth)) || ((width > height) && (downWidth < downHeight))) { // adjust orientation downHeight = downWidth; downWidth = downScaler.getHeight(); } if (width > downWidth) { // width is too large, re-calculate height float scale = (float)downWidth / (float)width; downHeight = Math.round(height * scale); } else if (height > downHeight) { // height is too large, re-calculate width float scale = (float)downHeight / (float)height; downWidth = Math.round(width * scale); } else { // something is wrong, don't down scale return null; } // now create and initialize the result scaler return new CmsImageScaler(downScaler, downWidth, downHeight); }
[ "public", "CmsImageScaler", "getDownScaler", "(", "CmsImageScaler", "downScaler", ")", "{", "if", "(", "!", "isDownScaleRequired", "(", "downScaler", ")", ")", "{", "// no down scaling is required", "return", "null", ";", "}", "int", "downHeight", "=", "downScaler",...
Returns a new image scaler that is a down scale from the size of <code>this</code> scaler to the given scaler size.<p> If no down scale from this to the given scaler is required according to {@link #isDownScaleRequired(CmsImageScaler)}, then <code>null</code> is returned.<p> @param downScaler the image scaler that holds the down scaled target image dimensions @return a new image scaler that is a down scale from the size of <code>this</code> scaler to the given target scaler size, or <code>null</code>
[ "Returns", "a", "new", "image", "scaler", "that", "is", "a", "down", "scale", "from", "the", "size", "of", "<code", ">", "this<", "/", "code", ">", "scaler", "to", "the", "given", "scaler", "size", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsImageScaler.java#L487-L521
guardtime/ksi-java-sdk
ksi-api/src/main/java/com/guardtime/ksi/unisignature/inmemory/InMemoryKsiSignature.java
InMemoryKsiSignature.sortAggregationHashChains
private List<AggregationHashChain> sortAggregationHashChains(List<AggregationHashChain> chains) throws InvalidSignatureException { Collections.sort(chains, new Comparator<AggregationHashChain>() { public int compare(AggregationHashChain chain1, AggregationHashChain chain2) { return chain2.getChainIndex().size() - chain1.getChainIndex().size(); } }); return chains; }
java
private List<AggregationHashChain> sortAggregationHashChains(List<AggregationHashChain> chains) throws InvalidSignatureException { Collections.sort(chains, new Comparator<AggregationHashChain>() { public int compare(AggregationHashChain chain1, AggregationHashChain chain2) { return chain2.getChainIndex().size() - chain1.getChainIndex().size(); } }); return chains; }
[ "private", "List", "<", "AggregationHashChain", ">", "sortAggregationHashChains", "(", "List", "<", "AggregationHashChain", ">", "chains", ")", "throws", "InvalidSignatureException", "{", "Collections", ".", "sort", "(", "chains", ",", "new", "Comparator", "<", "Agg...
Orders aggregation chains. @param chains aggregation chains to be ordered. @return ordered list of aggregation chains
[ "Orders", "aggregation", "chains", "." ]
train
https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/unisignature/inmemory/InMemoryKsiSignature.java#L230-L237
alkacon/opencms-core
src/org/opencms/main/CmsSessionManager.java
CmsSessionManager.updateSessionInfo
public void updateSessionInfo(CmsObject cms, HttpServletRequest req) { if (!cms.getRequestContext().isUpdateSessionEnabled()) { // this request must not update the user session info // this is true for long running "thread" requests, e.g. during project publish return; } if (cms.getRequestContext().getUri().equals(CmsToolManager.VIEW_JSPPAGE_LOCATION)) { // this request must not update the user session info // if not the switch user feature would not work return; } if (!cms.getRequestContext().getCurrentUser().isGuestUser()) { // Guest user requests don't need to update the OpenCms user session information // get the session info object for the user CmsSessionInfo sessionInfo = getSessionInfo(req); if (sessionInfo != null) { // update the users session information sessionInfo.update(cms.getRequestContext()); addSessionInfo(sessionInfo); } else { HttpSession session = req.getSession(false); // only create session info if a session is already available if (session != null) { // create a new session info for the user sessionInfo = new CmsSessionInfo( cms.getRequestContext(), new CmsUUID(), session.getMaxInactiveInterval()); // append the session info to the http session session.setAttribute(CmsSessionInfo.ATTRIBUTE_SESSION_ID, sessionInfo.getSessionId().clone()); // update the session info user data addSessionInfo(sessionInfo); } } } }
java
public void updateSessionInfo(CmsObject cms, HttpServletRequest req) { if (!cms.getRequestContext().isUpdateSessionEnabled()) { // this request must not update the user session info // this is true for long running "thread" requests, e.g. during project publish return; } if (cms.getRequestContext().getUri().equals(CmsToolManager.VIEW_JSPPAGE_LOCATION)) { // this request must not update the user session info // if not the switch user feature would not work return; } if (!cms.getRequestContext().getCurrentUser().isGuestUser()) { // Guest user requests don't need to update the OpenCms user session information // get the session info object for the user CmsSessionInfo sessionInfo = getSessionInfo(req); if (sessionInfo != null) { // update the users session information sessionInfo.update(cms.getRequestContext()); addSessionInfo(sessionInfo); } else { HttpSession session = req.getSession(false); // only create session info if a session is already available if (session != null) { // create a new session info for the user sessionInfo = new CmsSessionInfo( cms.getRequestContext(), new CmsUUID(), session.getMaxInactiveInterval()); // append the session info to the http session session.setAttribute(CmsSessionInfo.ATTRIBUTE_SESSION_ID, sessionInfo.getSessionId().clone()); // update the session info user data addSessionInfo(sessionInfo); } } } }
[ "public", "void", "updateSessionInfo", "(", "CmsObject", "cms", ",", "HttpServletRequest", "req", ")", "{", "if", "(", "!", "cms", ".", "getRequestContext", "(", ")", ".", "isUpdateSessionEnabled", "(", ")", ")", "{", "// this request must not update the user sessio...
Updates the the OpenCms session data used for quick authentication of users.<p> This is required if the user data (current group or project) was changed in the requested document.<p> The user data is only updated if the user was authenticated to the system. @param cms the current OpenCms user context @param req the current request
[ "Updates", "the", "the", "OpenCms", "session", "data", "used", "for", "quick", "authentication", "of", "users", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsSessionManager.java#L567-L606
mozilla/rhino
src/org/mozilla/javascript/Parser.java
Parser.propertyName
private AstNode propertyName(int atPos, String s, int memberTypeFlags) throws IOException { int pos = atPos != -1 ? atPos : ts.tokenBeg, lineno = ts.lineno; int colonPos = -1; Name name = createNameNode(true, currentToken); Name ns = null; if (matchToken(Token.COLONCOLON, true)) { ns = name; colonPos = ts.tokenBeg; switch (nextToken()) { // handles name::name case Token.NAME: name = createNameNode(); break; // handles name::* case Token.MUL: saveNameTokenData(ts.tokenBeg, "*", ts.lineno); name = createNameNode(false, -1); break; // handles name::[expr] or *::[expr] case Token.LB: return xmlElemRef(atPos, ns, colonPos); default: reportError("msg.no.name.after.coloncolon"); return makeErrorNode(); } } if (ns == null && memberTypeFlags == 0 && atPos == -1) { return name; } XmlPropRef ref = new XmlPropRef(pos, getNodeEnd(name) - pos); ref.setAtPos(atPos); ref.setNamespace(ns); ref.setColonPos(colonPos); ref.setPropName(name); ref.setLineno(lineno); return ref; }
java
private AstNode propertyName(int atPos, String s, int memberTypeFlags) throws IOException { int pos = atPos != -1 ? atPos : ts.tokenBeg, lineno = ts.lineno; int colonPos = -1; Name name = createNameNode(true, currentToken); Name ns = null; if (matchToken(Token.COLONCOLON, true)) { ns = name; colonPos = ts.tokenBeg; switch (nextToken()) { // handles name::name case Token.NAME: name = createNameNode(); break; // handles name::* case Token.MUL: saveNameTokenData(ts.tokenBeg, "*", ts.lineno); name = createNameNode(false, -1); break; // handles name::[expr] or *::[expr] case Token.LB: return xmlElemRef(atPos, ns, colonPos); default: reportError("msg.no.name.after.coloncolon"); return makeErrorNode(); } } if (ns == null && memberTypeFlags == 0 && atPos == -1) { return name; } XmlPropRef ref = new XmlPropRef(pos, getNodeEnd(name) - pos); ref.setAtPos(atPos); ref.setNamespace(ns); ref.setColonPos(colonPos); ref.setPropName(name); ref.setLineno(lineno); return ref; }
[ "private", "AstNode", "propertyName", "(", "int", "atPos", ",", "String", "s", ",", "int", "memberTypeFlags", ")", "throws", "IOException", "{", "int", "pos", "=", "atPos", "!=", "-", "1", "?", "atPos", ":", "ts", ".", "tokenBeg", ",", "lineno", "=", "...
Check if :: follows name in which case it becomes a qualified name. @param atPos a natural number if we just read an '@' token, else -1 @param s the name or string that was matched (an identifier, "throw" or "*"). @param memberTypeFlags flags tracking whether we're a '.' or '..' child @return an XmlRef node if it's an attribute access, a child of a '..' operator, or the name is followed by ::. For a plain name, returns a Name node. Returns an ErrorNode for malformed XML expressions. (For now - might change to return a partial XmlRef.)
[ "Check", "if", "::", "follows", "name", "in", "which", "case", "it", "becomes", "a", "qualified", "name", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Parser.java#L3016-L3061
apache/groovy
src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java
IOGroovyMethods.withObjectInputStream
public static <T> T withObjectInputStream(InputStream inputStream, @ClosureParams(value=SimpleType.class, options="java.io.ObjectInputStream") Closure<T> closure) throws IOException { return withStream(newObjectInputStream(inputStream), closure); }
java
public static <T> T withObjectInputStream(InputStream inputStream, @ClosureParams(value=SimpleType.class, options="java.io.ObjectInputStream") Closure<T> closure) throws IOException { return withStream(newObjectInputStream(inputStream), closure); }
[ "public", "static", "<", "T", ">", "T", "withObjectInputStream", "(", "InputStream", "inputStream", ",", "@", "ClosureParams", "(", "value", "=", "SimpleType", ".", "class", ",", "options", "=", "\"java.io.ObjectInputStream\"", ")", "Closure", "<", "T", ">", "...
Create a new ObjectInputStream for this file and pass it to the closure. This method ensures the stream is closed after the closure returns. @param inputStream an input stream @param closure a closure @return the value returned by the closure @throws IOException if an IOException occurs. @see #withStream(java.io.InputStream, groovy.lang.Closure) @since 1.5.0
[ "Create", "a", "new", "ObjectInputStream", "for", "this", "file", "and", "pass", "it", "to", "the", "closure", ".", "This", "method", "ensures", "the", "stream", "is", "closed", "after", "the", "closure", "returns", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L329-L331
alkacon/opencms-core
src/org/opencms/security/CmsRoleManager.java
CmsRoleManager.checkRoleForResource
public void checkRoleForResource(CmsObject cms, CmsRole role, String resourceName) throws CmsException, CmsRoleViolationException { CmsResource resource = cms.readResource(resourceName, CmsResourceFilter.ALL); m_securityManager.checkRoleForResource(cms.getRequestContext(), role, resource); }
java
public void checkRoleForResource(CmsObject cms, CmsRole role, String resourceName) throws CmsException, CmsRoleViolationException { CmsResource resource = cms.readResource(resourceName, CmsResourceFilter.ALL); m_securityManager.checkRoleForResource(cms.getRequestContext(), role, resource); }
[ "public", "void", "checkRoleForResource", "(", "CmsObject", "cms", ",", "CmsRole", "role", ",", "String", "resourceName", ")", "throws", "CmsException", ",", "CmsRoleViolationException", "{", "CmsResource", "resource", "=", "cms", ".", "readResource", "(", "resource...
Checks if the user of this OpenCms context is a member of the given role for the given resource.<p> The user must have the given role in at least one organizational unit to which this resource belongs.<p> @param cms the opencms context @param role the role to check @param resourceName the name of the resource to check the role for @throws CmsRoleViolationException if the user does not have the required role permissions @throws CmsException if something goes wrong, while reading the resource
[ "Checks", "if", "the", "user", "of", "this", "OpenCms", "context", "is", "a", "member", "of", "the", "given", "role", "for", "the", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/security/CmsRoleManager.java#L109-L114
rzwitserloot/lombok
src/core/lombok/eclipse/handlers/HandleWither.java
HandleWither.generateWitherForField
public void generateWitherForField(EclipseNode fieldNode, EclipseNode sourceNode, AccessLevel level) { for (EclipseNode child : fieldNode.down()) { if (child.getKind() == Kind.ANNOTATION) { if (annotationTypeMatches(Wither.class, child)) { //The annotation will make it happen, so we can skip it. return; } } } List<Annotation> empty = Collections.emptyList(); createWitherForField(level, fieldNode, sourceNode, false, empty, empty); }
java
public void generateWitherForField(EclipseNode fieldNode, EclipseNode sourceNode, AccessLevel level) { for (EclipseNode child : fieldNode.down()) { if (child.getKind() == Kind.ANNOTATION) { if (annotationTypeMatches(Wither.class, child)) { //The annotation will make it happen, so we can skip it. return; } } } List<Annotation> empty = Collections.emptyList(); createWitherForField(level, fieldNode, sourceNode, false, empty, empty); }
[ "public", "void", "generateWitherForField", "(", "EclipseNode", "fieldNode", ",", "EclipseNode", "sourceNode", ",", "AccessLevel", "level", ")", "{", "for", "(", "EclipseNode", "child", ":", "fieldNode", ".", "down", "(", ")", ")", "{", "if", "(", "child", "...
Generates a wither on the stated field. Used by {@link HandleValue}. The difference between this call and the handle method is as follows: If there is a {@code lombok.experimental.Wither} annotation on the field, it is used and the same rules apply (e.g. warning if the method already exists, stated access level applies). If not, the wither is still generated if it isn't already there, though there will not be a warning if its already there. The default access level is used.
[ "Generates", "a", "wither", "on", "the", "stated", "field", "." ]
train
https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/eclipse/handlers/HandleWither.java#L108-L120
bingoohuang/excel2javabeans
src/main/java/com/github/bingoohuang/excel2beans/BeansToExcelOnTemplate.java
BeansToExcelOnTemplate.mergeRows
private void mergeRows(ExcelRows excelRowsAnn, Cell templateCell, int itemSize) { val tmplCellRowIndex = templateCell.getRowIndex(); for (val ann : excelRowsAnn.mergeRows()) { val fr = ann.fromRef(); val cellRef = PoiUtil.isFullCellReference(fr) ? fr : fr + (tmplCellRowIndex + 1); val fromCell = PoiUtil.findCell(sheet, cellRef); val lastRow = tmplCellRowIndex + itemSize - 1; if (ann.type() == MergeType.Direct) { val fromRow = fromCell.getRow().getRowNum(); directMergeRows(ann, fromRow, lastRow, fromCell.getColumnIndex()); } else if (ann.type() == MergeType.SameValue) { sameValueMergeRows(ann, itemSize, fromCell); } } }
java
private void mergeRows(ExcelRows excelRowsAnn, Cell templateCell, int itemSize) { val tmplCellRowIndex = templateCell.getRowIndex(); for (val ann : excelRowsAnn.mergeRows()) { val fr = ann.fromRef(); val cellRef = PoiUtil.isFullCellReference(fr) ? fr : fr + (tmplCellRowIndex + 1); val fromCell = PoiUtil.findCell(sheet, cellRef); val lastRow = tmplCellRowIndex + itemSize - 1; if (ann.type() == MergeType.Direct) { val fromRow = fromCell.getRow().getRowNum(); directMergeRows(ann, fromRow, lastRow, fromCell.getColumnIndex()); } else if (ann.type() == MergeType.SameValue) { sameValueMergeRows(ann, itemSize, fromCell); } } }
[ "private", "void", "mergeRows", "(", "ExcelRows", "excelRowsAnn", ",", "Cell", "templateCell", ",", "int", "itemSize", ")", "{", "val", "tmplCellRowIndex", "=", "templateCell", ".", "getRowIndex", "(", ")", ";", "for", "(", "val", "ann", ":", "excelRowsAnn", ...
根据@ExcelRows注解的指示,纵向合并单元格。 @param excelRowsAnn @ExcelRows注解值。 @param templateCell 模板单元格。 @param itemSize 纵向合并多少行的单元格。
[ "根据@ExcelRows注解的指示,纵向合并单元格。" ]
train
https://github.com/bingoohuang/excel2javabeans/blob/db136d460b93b649814366c0d84a982698b96dc3/src/main/java/com/github/bingoohuang/excel2beans/BeansToExcelOnTemplate.java#L127-L143
workplacesystems/queuj
src/main/java/com/workplacesystems/queuj/Queue.java
Queue.newProcessBuilder
private B newProcessBuilder(Class[] param_types, Object[] params) { if (process_builder_class != null) { try { Constructor<B> constructor = process_builder_class.getDeclaredConstructor(param_types); return constructor.newInstance(params); } catch (Exception e) { throw new QueujException(e); } } if (parent_queue != null) return (B)parent_queue.newProcessBuilder(param_types, params); // else throw new QueujException("No ProcessBuilder exists for Queue"); }
java
private B newProcessBuilder(Class[] param_types, Object[] params) { if (process_builder_class != null) { try { Constructor<B> constructor = process_builder_class.getDeclaredConstructor(param_types); return constructor.newInstance(params); } catch (Exception e) { throw new QueujException(e); } } if (parent_queue != null) return (B)parent_queue.newProcessBuilder(param_types, params); // else throw new QueujException("No ProcessBuilder exists for Queue"); }
[ "private", "B", "newProcessBuilder", "(", "Class", "[", "]", "param_types", ",", "Object", "[", "]", "params", ")", "{", "if", "(", "process_builder_class", "!=", "null", ")", "{", "try", "{", "Constructor", "<", "B", ">", "constructor", "=", "process_buil...
Private method to instantiate the Queues ProcessBuilder. Will ask the parent Queue to instantiate its ProcessBuilder if this Queue doesn't have one.
[ "Private", "method", "to", "instantiate", "the", "Queues", "ProcessBuilder", ".", "Will", "ask", "the", "parent", "Queue", "to", "instantiate", "its", "ProcessBuilder", "if", "this", "Queue", "doesn", "t", "have", "one", "." ]
train
https://github.com/workplacesystems/queuj/blob/4293116b412b4a20ead99963b9b05a135812c501/src/main/java/com/workplacesystems/queuj/Queue.java#L127-L147
BioPAX/Paxtools
pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java
Pattern.updateLabel
public void updateLabel(String oldLabel, String newLabel) { if (hasLabel(newLabel)) throw new IllegalArgumentException( "The label \"" + newLabel + "\" already exists."); int i = indexOf(oldLabel); labelMap.remove(oldLabel); labelMap.put(newLabel, i); }
java
public void updateLabel(String oldLabel, String newLabel) { if (hasLabel(newLabel)) throw new IllegalArgumentException( "The label \"" + newLabel + "\" already exists."); int i = indexOf(oldLabel); labelMap.remove(oldLabel); labelMap.put(newLabel, i); }
[ "public", "void", "updateLabel", "(", "String", "oldLabel", ",", "String", "newLabel", ")", "{", "if", "(", "hasLabel", "(", "newLabel", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"The label \\\"\"", "+", "newLabel", "+", "\"\\\" already exists.\...
Changes a label. The oldLabel has to be an existing label and new label has to be a new label. @param oldLabel label to update @param newLabel updated label
[ "Changes", "a", "label", ".", "The", "oldLabel", "has", "to", "be", "an", "existing", "label", "and", "new", "label", "has", "to", "be", "a", "new", "label", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java#L417-L425
phax/ph-oton
ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload/FineUploaderBasic.java
FineUploaderBasic.setParams
@Nonnull public FineUploaderBasic setParams (@Nullable final Map <String, String> aParams) { m_aRequestParams.setAll (aParams); return this; }
java
@Nonnull public FineUploaderBasic setParams (@Nullable final Map <String, String> aParams) { m_aRequestParams.setAll (aParams); return this; }
[ "@", "Nonnull", "public", "FineUploaderBasic", "setParams", "(", "@", "Nullable", "final", "Map", "<", "String", ",", "String", ">", "aParams", ")", "{", "m_aRequestParams", ".", "setAll", "(", "aParams", ")", ";", "return", "this", ";", "}" ]
These parameters are sent with the request to the endpoint specified in the action option. @param aParams New parameters to be set. @return this
[ "These", "parameters", "are", "sent", "with", "the", "request", "to", "the", "endpoint", "specified", "in", "the", "action", "option", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload/FineUploaderBasic.java#L167-L172
bbossgroups/bboss-elasticsearch
bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/RestClientUtil.java
RestClientUtil.searchAllParallel
public <T> ESDatas<T> searchAllParallel(String index, final int fetchSize ,ScrollHandler<T> scrollHandler,final Class<T> type,int max) throws ElasticSearchException{ if(!this.client.isV1()) { SliceScroll sliceScroll = new SliceScroll() { @Override public String buildSliceDsl(int sliceId, int max) { StringBuilder builder = new StringBuilder(); String sliceDsl = builder.append("{\"slice\": {\"id\": ").append(sliceId).append(",\"max\": ") .append(max).append("},\"size\":").append(fetchSize).append(",\"query\": {\"match_all\": {}},\"sort\": [\"_doc\"]}").toString(); return sliceDsl; // return buildSliceDsl(i,max, params, dslTemplate); } }; return _slice(index + "/_search", scrollHandler, type, max, "1m", sliceScroll); } else{ StringBuilder builder = new StringBuilder(); String queryAll = builder.append("{ \"size\":").append(fetchSize).append(",\"query\": {\"match_all\": {}},\"sort\": [\"_doc\"]}").toString(); builder.setLength(0); return this.scrollParallel(builder.append(index).append("/_search").toString(),queryAll,"10m",type,scrollHandler); } }
java
public <T> ESDatas<T> searchAllParallel(String index, final int fetchSize ,ScrollHandler<T> scrollHandler,final Class<T> type,int max) throws ElasticSearchException{ if(!this.client.isV1()) { SliceScroll sliceScroll = new SliceScroll() { @Override public String buildSliceDsl(int sliceId, int max) { StringBuilder builder = new StringBuilder(); String sliceDsl = builder.append("{\"slice\": {\"id\": ").append(sliceId).append(",\"max\": ") .append(max).append("},\"size\":").append(fetchSize).append(",\"query\": {\"match_all\": {}},\"sort\": [\"_doc\"]}").toString(); return sliceDsl; // return buildSliceDsl(i,max, params, dslTemplate); } }; return _slice(index + "/_search", scrollHandler, type, max, "1m", sliceScroll); } else{ StringBuilder builder = new StringBuilder(); String queryAll = builder.append("{ \"size\":").append(fetchSize).append(",\"query\": {\"match_all\": {}},\"sort\": [\"_doc\"]}").toString(); builder.setLength(0); return this.scrollParallel(builder.append(index).append("/_search").toString(),queryAll,"10m",type,scrollHandler); } }
[ "public", "<", "T", ">", "ESDatas", "<", "T", ">", "searchAllParallel", "(", "String", "index", ",", "final", "int", "fetchSize", ",", "ScrollHandler", "<", "T", ">", "scrollHandler", ",", "final", "Class", "<", "T", ">", "type", ",", "int", "max", ")"...
并行检索索引所有数据 @param index @param fetchSize 指定每批次返回的数据,不指定默认为5000 @param scrollHandler 每批数据处理方法 @param type @param <T> @return @throws ElasticSearchException
[ "并行检索索引所有数据" ]
train
https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/RestClientUtil.java#L1732-L1754
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/SimulatedTaskRunner.java
SimulatedTaskRunner.launchTask
public void launchTask(TaskInProgress tip) throws IOException { LOG.info("Launching simulated task " + tip.getTask().getTaskID() + " for job " + tip.getTask().getJobID()); TaskUmbilicalProtocol umbilicalProtocol = taskTracker.getUmbilical(tip); // For map tasks, we can just finish the task after some time. Same thing // with cleanup tasks, as we don't need to be waiting for mappers to finish if (tip.getTask().isMapTask() || tip.getTask().isTaskCleanupTask() || tip.getTask().isJobCleanupTask() || tip.getTask().isJobSetupTask() ) { addTipToFinish(tip, umbilicalProtocol); } else { MapperWaitThread mwt = new MapperWaitThread(tip, this, umbilicalProtocol); // Save a reference to the mapper wait thread so that we can stop them if // the task gets killed mapperWaitThreadMap.put(tip, mwt); mwt.start(); } }
java
public void launchTask(TaskInProgress tip) throws IOException { LOG.info("Launching simulated task " + tip.getTask().getTaskID() + " for job " + tip.getTask().getJobID()); TaskUmbilicalProtocol umbilicalProtocol = taskTracker.getUmbilical(tip); // For map tasks, we can just finish the task after some time. Same thing // with cleanup tasks, as we don't need to be waiting for mappers to finish if (tip.getTask().isMapTask() || tip.getTask().isTaskCleanupTask() || tip.getTask().isJobCleanupTask() || tip.getTask().isJobSetupTask() ) { addTipToFinish(tip, umbilicalProtocol); } else { MapperWaitThread mwt = new MapperWaitThread(tip, this, umbilicalProtocol); // Save a reference to the mapper wait thread so that we can stop them if // the task gets killed mapperWaitThreadMap.put(tip, mwt); mwt.start(); } }
[ "public", "void", "launchTask", "(", "TaskInProgress", "tip", ")", "throws", "IOException", "{", "LOG", ".", "info", "(", "\"Launching simulated task \"", "+", "tip", ".", "getTask", "(", ")", ".", "getTaskID", "(", ")", "+", "\" for job \"", "+", "tip", "."...
The primary public method that should be called to 'run' a task. Handles both map and reduce tasks and marks them as completed after the configured time interval @param tip
[ "The", "primary", "public", "method", "that", "should", "be", "called", "to", "run", "a", "task", ".", "Handles", "both", "map", "and", "reduce", "tasks", "and", "marks", "them", "as", "completed", "after", "the", "configured", "time", "interval" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/SimulatedTaskRunner.java#L144-L162
lucee/Lucee
core/src/main/java/lucee/runtime/type/util/ListUtil.java
ListUtil.listFindNoCase
public static int listFindNoCase(String list, String value, String delimiter, boolean trim) { Array arr = trim ? listToArrayTrim(list, delimiter) : listToArray(list, delimiter); int len = arr.size(); for (int i = 1; i <= len; i++) { if (((String) arr.get(i, "")).equalsIgnoreCase(value)) return i - 1; } return -1; }
java
public static int listFindNoCase(String list, String value, String delimiter, boolean trim) { Array arr = trim ? listToArrayTrim(list, delimiter) : listToArray(list, delimiter); int len = arr.size(); for (int i = 1; i <= len; i++) { if (((String) arr.get(i, "")).equalsIgnoreCase(value)) return i - 1; } return -1; }
[ "public", "static", "int", "listFindNoCase", "(", "String", "list", ",", "String", "value", ",", "String", "delimiter", ",", "boolean", "trim", ")", "{", "Array", "arr", "=", "trim", "?", "listToArrayTrim", "(", "list", ",", "delimiter", ")", ":", "listToA...
finds a value inside a list, do not ignore case @param list list to search @param value value to find @param delimiter delimiter of the list @param trim trim the list or not @return position in list (0-n) or -1
[ "finds", "a", "value", "inside", "a", "list", "do", "not", "ignore", "case" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/ListUtil.java#L623-L630
apache/flink
flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBKeyedStateBackend.java
RocksDBKeyedStateBackend.migrateStateValues
private <N, S extends State, SV> void migrateStateValues( StateDescriptor<S, SV> stateDesc, Tuple2<ColumnFamilyHandle, RegisteredKeyValueStateBackendMetaInfo<N, SV>> stateMetaInfo) throws Exception { if (stateDesc.getType() == StateDescriptor.Type.MAP) { throw new StateMigrationException("The new serializer for a MapState requires state migration in order for the job to proceed." + " However, migration for MapState currently isn't supported."); } LOG.info( "Performing state migration for state {} because the state serializer's schema, i.e. serialization format, has changed.", stateDesc); // we need to get an actual state instance because migration is different // for different state types. For example, ListState needs to deal with // individual elements StateFactory stateFactory = STATE_FACTORIES.get(stateDesc.getClass()); if (stateFactory == null) { String message = String.format("State %s is not supported by %s", stateDesc.getClass(), this.getClass()); throw new FlinkRuntimeException(message); } State state = stateFactory.createState( stateDesc, stateMetaInfo, RocksDBKeyedStateBackend.this); if (!(state instanceof AbstractRocksDBState)) { throw new FlinkRuntimeException( "State should be an AbstractRocksDBState but is " + state); } @SuppressWarnings("unchecked") AbstractRocksDBState<?, ?, SV> rocksDBState = (AbstractRocksDBState<?, ?, SV>) state; Snapshot rocksDBSnapshot = db.getSnapshot(); try ( RocksIteratorWrapper iterator = RocksDBOperationUtils.getRocksIterator(db, stateMetaInfo.f0); RocksDBWriteBatchWrapper batchWriter = new RocksDBWriteBatchWrapper(db, getWriteOptions()) ) { iterator.seekToFirst(); DataInputDeserializer serializedValueInput = new DataInputDeserializer(); DataOutputSerializer migratedSerializedValueOutput = new DataOutputSerializer(512); while (iterator.isValid()) { serializedValueInput.setBuffer(iterator.value()); rocksDBState.migrateSerializedValue( serializedValueInput, migratedSerializedValueOutput, stateMetaInfo.f1.getPreviousStateSerializer(), stateMetaInfo.f1.getStateSerializer()); batchWriter.put(stateMetaInfo.f0, iterator.key(), migratedSerializedValueOutput.getCopyOfBuffer()); migratedSerializedValueOutput.clear(); iterator.next(); } } finally { db.releaseSnapshot(rocksDBSnapshot); rocksDBSnapshot.close(); } }
java
private <N, S extends State, SV> void migrateStateValues( StateDescriptor<S, SV> stateDesc, Tuple2<ColumnFamilyHandle, RegisteredKeyValueStateBackendMetaInfo<N, SV>> stateMetaInfo) throws Exception { if (stateDesc.getType() == StateDescriptor.Type.MAP) { throw new StateMigrationException("The new serializer for a MapState requires state migration in order for the job to proceed." + " However, migration for MapState currently isn't supported."); } LOG.info( "Performing state migration for state {} because the state serializer's schema, i.e. serialization format, has changed.", stateDesc); // we need to get an actual state instance because migration is different // for different state types. For example, ListState needs to deal with // individual elements StateFactory stateFactory = STATE_FACTORIES.get(stateDesc.getClass()); if (stateFactory == null) { String message = String.format("State %s is not supported by %s", stateDesc.getClass(), this.getClass()); throw new FlinkRuntimeException(message); } State state = stateFactory.createState( stateDesc, stateMetaInfo, RocksDBKeyedStateBackend.this); if (!(state instanceof AbstractRocksDBState)) { throw new FlinkRuntimeException( "State should be an AbstractRocksDBState but is " + state); } @SuppressWarnings("unchecked") AbstractRocksDBState<?, ?, SV> rocksDBState = (AbstractRocksDBState<?, ?, SV>) state; Snapshot rocksDBSnapshot = db.getSnapshot(); try ( RocksIteratorWrapper iterator = RocksDBOperationUtils.getRocksIterator(db, stateMetaInfo.f0); RocksDBWriteBatchWrapper batchWriter = new RocksDBWriteBatchWrapper(db, getWriteOptions()) ) { iterator.seekToFirst(); DataInputDeserializer serializedValueInput = new DataInputDeserializer(); DataOutputSerializer migratedSerializedValueOutput = new DataOutputSerializer(512); while (iterator.isValid()) { serializedValueInput.setBuffer(iterator.value()); rocksDBState.migrateSerializedValue( serializedValueInput, migratedSerializedValueOutput, stateMetaInfo.f1.getPreviousStateSerializer(), stateMetaInfo.f1.getStateSerializer()); batchWriter.put(stateMetaInfo.f0, iterator.key(), migratedSerializedValueOutput.getCopyOfBuffer()); migratedSerializedValueOutput.clear(); iterator.next(); } } finally { db.releaseSnapshot(rocksDBSnapshot); rocksDBSnapshot.close(); } }
[ "private", "<", "N", ",", "S", "extends", "State", ",", "SV", ">", "void", "migrateStateValues", "(", "StateDescriptor", "<", "S", ",", "SV", ">", "stateDesc", ",", "Tuple2", "<", "ColumnFamilyHandle", ",", "RegisteredKeyValueStateBackendMetaInfo", "<", "N", "...
Migrate only the state value, that is the "value" that is stored in RocksDB. We don't migrate the key here, which is made up of key group, key, namespace and map key (in case of MapState).
[ "Migrate", "only", "the", "state", "value", "that", "is", "the", "value", "that", "is", "stored", "in", "RocksDB", ".", "We", "don", "t", "migrate", "the", "key", "here", "which", "is", "made", "up", "of", "key", "group", "key", "namespace", "and", "ma...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBKeyedStateBackend.java#L541-L602
JohnPersano/SuperToasts
library/src/main/java/com/github/johnpersano/supertoasts/library/SuperToast.java
SuperToast.setGravity
public SuperToast setGravity(@Style.GravityStyle int gravity, int xOffset, int yOffset) { this.mStyle.gravity = gravity; this.mStyle.xOffset = xOffset; this.mStyle.yOffset = yOffset; return this; }
java
public SuperToast setGravity(@Style.GravityStyle int gravity, int xOffset, int yOffset) { this.mStyle.gravity = gravity; this.mStyle.xOffset = xOffset; this.mStyle.yOffset = yOffset; return this; }
[ "public", "SuperToast", "setGravity", "(", "@", "Style", ".", "GravityStyle", "int", "gravity", ",", "int", "xOffset", ",", "int", "yOffset", ")", "{", "this", ".", "mStyle", ".", "gravity", "=", "gravity", ";", "this", ".", "mStyle", ".", "xOffset", "="...
Sets the layout gravity, x, and y offsets for the SuperToast. @param gravity The desired Gravity @param xOffset The desired x (horizontal) offset @param yOffset The desired y (vertical) offset @return The current SuperToast instance @see #setGravity(int)
[ "Sets", "the", "layout", "gravity", "x", "and", "y", "offsets", "for", "the", "SuperToast", "." ]
train
https://github.com/JohnPersano/SuperToasts/blob/5394db6a2f5c38410586d5d001d61f731da1132a/library/src/main/java/com/github/johnpersano/supertoasts/library/SuperToast.java#L544-L549
belaban/JGroups
src/org/jgroups/util/Bits.java
Bits.writeAsciiString
public static void writeAsciiString(AsciiString s, DataOutput out) throws IOException { short length=(short)(s != null? s.length() : -1); out.writeShort(length); if(s != null) out.write(s.chars()); }
java
public static void writeAsciiString(AsciiString s, DataOutput out) throws IOException { short length=(short)(s != null? s.length() : -1); out.writeShort(length); if(s != null) out.write(s.chars()); }
[ "public", "static", "void", "writeAsciiString", "(", "AsciiString", "s", ",", "DataOutput", "out", ")", "throws", "IOException", "{", "short", "length", "=", "(", "short", ")", "(", "s", "!=", "null", "?", "s", ".", "length", "(", ")", ":", "-", "1", ...
Writes an AsciiString to buf. The length of the string is written first, followed by the chars (as single-byte values). @param s the string @param out the output stream
[ "Writes", "an", "AsciiString", "to", "buf", ".", "The", "length", "of", "the", "string", "is", "written", "first", "followed", "by", "the", "chars", "(", "as", "single", "-", "byte", "values", ")", "." ]
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Bits.java#L707-L712
joniles/mpxj
src/main/java/net/sf/mpxj/Task.java
Task.setEnterpriseCost
public void setEnterpriseCost(int index, Number value) { set(selectField(TaskFieldLists.ENTERPRISE_COST, index), value); }
java
public void setEnterpriseCost(int index, Number value) { set(selectField(TaskFieldLists.ENTERPRISE_COST, index), value); }
[ "public", "void", "setEnterpriseCost", "(", "int", "index", ",", "Number", "value", ")", "{", "set", "(", "selectField", "(", "TaskFieldLists", ".", "ENTERPRISE_COST", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set an enterprise field value. @param index field index @param value field value
[ "Set", "an", "enterprise", "field", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L3837-L3840
google/error-prone
core/src/main/java/com/google/errorprone/bugpatterns/MethodCanBeStatic.java
MethodCanBeStatic.fixQualifiers
private SuggestedFix fixQualifiers(VisitorState state, MethodSymbol sym, SuggestedFix f) { SuggestedFix.Builder builder = SuggestedFix.builder().merge(f); new TreeScanner<Void, Void>() { @Override public Void visitMemberSelect(MemberSelectTree tree, Void unused) { fixQualifier(tree, tree.getExpression()); return super.visitMemberSelect(tree, unused); } @Override public Void visitMemberReference(MemberReferenceTree tree, Void unused) { fixQualifier(tree, tree.getQualifierExpression()); return super.visitMemberReference(tree, unused); } private void fixQualifier(Tree tree, ExpressionTree qualifierExpression) { if (sym.equals(ASTHelpers.getSymbol(tree))) { builder.replace(qualifierExpression, sym.owner.enclClass().getSimpleName().toString()); } } }.scan(state.getPath().getCompilationUnit(), null); return builder.build(); }
java
private SuggestedFix fixQualifiers(VisitorState state, MethodSymbol sym, SuggestedFix f) { SuggestedFix.Builder builder = SuggestedFix.builder().merge(f); new TreeScanner<Void, Void>() { @Override public Void visitMemberSelect(MemberSelectTree tree, Void unused) { fixQualifier(tree, tree.getExpression()); return super.visitMemberSelect(tree, unused); } @Override public Void visitMemberReference(MemberReferenceTree tree, Void unused) { fixQualifier(tree, tree.getQualifierExpression()); return super.visitMemberReference(tree, unused); } private void fixQualifier(Tree tree, ExpressionTree qualifierExpression) { if (sym.equals(ASTHelpers.getSymbol(tree))) { builder.replace(qualifierExpression, sym.owner.enclClass().getSimpleName().toString()); } } }.scan(state.getPath().getCompilationUnit(), null); return builder.build(); }
[ "private", "SuggestedFix", "fixQualifiers", "(", "VisitorState", "state", ",", "MethodSymbol", "sym", ",", "SuggestedFix", "f", ")", "{", "SuggestedFix", ".", "Builder", "builder", "=", "SuggestedFix", ".", "builder", "(", ")", ".", "merge", "(", "f", ")", "...
Replace instance references to the method with static access (e.g. `this.foo(...)` -> `EnclosingClass.foo(...)` and `this::foo` to `EnclosingClass::foo`).
[ "Replace", "instance", "references", "to", "the", "method", "with", "static", "access", "(", "e", ".", "g", ".", "this", ".", "foo", "(", "...", ")", "-", ">", "EnclosingClass", ".", "foo", "(", "...", ")", "and", "this", "::", "foo", "to", "Enclosin...
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/MethodCanBeStatic.java#L204-L226
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/CachedXPathAPI.java
CachedXPathAPI.selectSingleNode
public Node selectSingleNode(Node contextNode, String str) throws TransformerException { return selectSingleNode(contextNode, str, contextNode); }
java
public Node selectSingleNode(Node contextNode, String str) throws TransformerException { return selectSingleNode(contextNode, str, contextNode); }
[ "public", "Node", "selectSingleNode", "(", "Node", "contextNode", ",", "String", "str", ")", "throws", "TransformerException", "{", "return", "selectSingleNode", "(", "contextNode", ",", "str", ",", "contextNode", ")", ";", "}" ]
Use an XPath string to select a single node. XPath namespace prefixes are resolved from the context node, which may not be what you want (see the next method). @param contextNode The node to start searching from. @param str A valid XPath string. @return The first node found that matches the XPath, or null. @throws TransformerException
[ "Use", "an", "XPath", "string", "to", "select", "a", "single", "node", ".", "XPath", "namespace", "prefixes", "are", "resolved", "from", "the", "context", "node", "which", "may", "not", "be", "what", "you", "want", "(", "see", "the", "next", "method", ")...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/CachedXPathAPI.java#L121-L125
terrestris/shogun-core
src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java
HttpUtil.forwardFormMultipartPost
public static Response forwardFormMultipartPost(URI uri, HttpServletRequest request, boolean forwardHeaders) throws URISyntaxException, HttpException, IllegalStateException, IOException, ServletException { Header[] headersToForward = null; if (request != null && forwardHeaders) { headersToForward = HttpUtil.getHeadersFromRequest(request); } // remove content headers as http client lib will care about this // when entity is set on the httpPost instance in the postMultiPart method headersToForward = removeHeaders(headersToForward, new String[]{"content-length", "content-type"}); Collection<Part> parts = request.getParts(); return HttpUtil.postMultiPart(uri, parts, headersToForward); }
java
public static Response forwardFormMultipartPost(URI uri, HttpServletRequest request, boolean forwardHeaders) throws URISyntaxException, HttpException, IllegalStateException, IOException, ServletException { Header[] headersToForward = null; if (request != null && forwardHeaders) { headersToForward = HttpUtil.getHeadersFromRequest(request); } // remove content headers as http client lib will care about this // when entity is set on the httpPost instance in the postMultiPart method headersToForward = removeHeaders(headersToForward, new String[]{"content-length", "content-type"}); Collection<Part> parts = request.getParts(); return HttpUtil.postMultiPart(uri, parts, headersToForward); }
[ "public", "static", "Response", "forwardFormMultipartPost", "(", "URI", "uri", ",", "HttpServletRequest", "request", ",", "boolean", "forwardHeaders", ")", "throws", "URISyntaxException", ",", "HttpException", ",", "IllegalStateException", ",", "IOException", ",", "Serv...
Forward FormMultipartPost (HTTP POST) to uri based on given request @param uri uri The URI to forward to. @param request The original {@link HttpServletRequest} @param forwardHeaders Should headers of request should be forwarded @return The HTTP response as Response object. @throws URISyntaxException @throws HttpException @throws IllegalStateException @throws IOException @throws ServletException
[ "Forward", "FormMultipartPost", "(", "HTTP", "POST", ")", "to", "uri", "based", "on", "given", "request" ]
train
https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java#L1084-L1099
couchbase/java-dcp-client
src/main/java/com/couchbase/client/dcp/state/SessionState.java
SessionState.rollbackToPosition
public void rollbackToPosition(short partition, long seqno) { PartitionState ps = partitionStates.get(partition); ps.setStartSeqno(seqno); ps.setSnapshotStartSeqno(seqno); ps.setSnapshotEndSeqno(seqno); List<FailoverLogEntry> failoverLog = ps.getFailoverLog(); Iterator<FailoverLogEntry> flogIterator = failoverLog.iterator(); List<FailoverLogEntry> entriesToRemove = new ArrayList<>(); while (flogIterator.hasNext()) { FailoverLogEntry entry = flogIterator.next(); // check if this entry is has a higher seqno than we need to roll back to if (lessThanUnsigned(seqno, entry.getSeqno())) { entriesToRemove.add(entry); } } failoverLog.removeAll(entriesToRemove); partitionStates.set(partition, ps); }
java
public void rollbackToPosition(short partition, long seqno) { PartitionState ps = partitionStates.get(partition); ps.setStartSeqno(seqno); ps.setSnapshotStartSeqno(seqno); ps.setSnapshotEndSeqno(seqno); List<FailoverLogEntry> failoverLog = ps.getFailoverLog(); Iterator<FailoverLogEntry> flogIterator = failoverLog.iterator(); List<FailoverLogEntry> entriesToRemove = new ArrayList<>(); while (flogIterator.hasNext()) { FailoverLogEntry entry = flogIterator.next(); // check if this entry is has a higher seqno than we need to roll back to if (lessThanUnsigned(seqno, entry.getSeqno())) { entriesToRemove.add(entry); } } failoverLog.removeAll(entriesToRemove); partitionStates.set(partition, ps); }
[ "public", "void", "rollbackToPosition", "(", "short", "partition", ",", "long", "seqno", ")", "{", "PartitionState", "ps", "=", "partitionStates", ".", "get", "(", "partition", ")", ";", "ps", ".", "setStartSeqno", "(", "seqno", ")", ";", "ps", ".", "setSn...
Helper method to rollback the given partition to the given sequence number. <p> This will set the seqno AND REMOVE ALL ENTRIES from the failover log that are higher than the given sequence number! @param partition the partition to rollback @param seqno the sequence number where to roll it back to.
[ "Helper", "method", "to", "rollback", "the", "given", "partition", "to", "the", "given", "sequence", "number", ".", "<p", ">", "This", "will", "set", "the", "seqno", "AND", "REMOVE", "ALL", "ENTRIES", "from", "the", "failover", "log", "that", "are", "highe...
train
https://github.com/couchbase/java-dcp-client/blob/75359d8c081d6c575f8087cf7c28d24ab24c6421/src/main/java/com/couchbase/client/dcp/state/SessionState.java#L165-L182
ibm-bluemix-mobile-services/bms-clientsdk-android-core
lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationRequestManager.java
AuthorizationRequestManager.onFailure
@Override public void onFailure(Response response, Throwable t, JSONObject extendedInfo) { if (isAuthorizationRequired(response)) { processResponseWrapper(response, true); } else { listener.onFailure(response, t, extendedInfo); } }
java
@Override public void onFailure(Response response, Throwable t, JSONObject extendedInfo) { if (isAuthorizationRequired(response)) { processResponseWrapper(response, true); } else { listener.onFailure(response, t, extendedInfo); } }
[ "@", "Override", "public", "void", "onFailure", "(", "Response", "response", ",", "Throwable", "t", ",", "JSONObject", "extendedInfo", ")", "{", "if", "(", "isAuthorizationRequired", "(", "response", ")", ")", "{", "processResponseWrapper", "(", "response", ",",...
Called when request fails. @param response Contains detail regarding why the request failed @param t Exception that could have caused the request to fail. Null if no Exception thrown.
[ "Called", "when", "request", "fails", "." ]
train
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core/blob/8db4f00d0d564792397bfc0e5bd57d52a238b858/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationRequestManager.java#L541-L548
spotbugs/spotbugs
eclipsePlugin/src/de/tobject/findbugs/builder/FindBugsWorker.java
FindBugsWorker.getFilterPath
public static IPath getFilterPath(String filePath, IProject project) { IPath path = new Path(filePath); if (path.isAbsolute()) { return path; } if (project != null) { // try first project relative location IPath newPath = project.getLocation().append(path); if (newPath.toFile().exists()) { return newPath; } } // try to resolve relative to workspace (if we use workspace properties // for project) IPath wspLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation(); IPath newPath = wspLocation.append(path); if (newPath.toFile().exists()) { return newPath; } // something which we have no idea what it can be (or missing/wrong file // path) return path; }
java
public static IPath getFilterPath(String filePath, IProject project) { IPath path = new Path(filePath); if (path.isAbsolute()) { return path; } if (project != null) { // try first project relative location IPath newPath = project.getLocation().append(path); if (newPath.toFile().exists()) { return newPath; } } // try to resolve relative to workspace (if we use workspace properties // for project) IPath wspLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation(); IPath newPath = wspLocation.append(path); if (newPath.toFile().exists()) { return newPath; } // something which we have no idea what it can be (or missing/wrong file // path) return path; }
[ "public", "static", "IPath", "getFilterPath", "(", "String", "filePath", ",", "IProject", "project", ")", "{", "IPath", "path", "=", "new", "Path", "(", "filePath", ")", ";", "if", "(", "path", ".", "isAbsolute", "(", ")", ")", "{", "return", "path", "...
Checks the given path and convert it to absolute path if it is specified relative to the given project or workspace @param filePath project relative OR workspace relative OR absolute OS file path (1.3.8+ version) @param project might be null (only for workspace relative or absolute paths) @return absolute path which matches given relative or absolute path, never null
[ "Checks", "the", "given", "path", "and", "convert", "it", "to", "absolute", "path", "if", "it", "is", "specified", "relative", "to", "the", "given", "project", "or", "workspace" ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/builder/FindBugsWorker.java#L403-L427
knightliao/apollo
src/main/java/com/github/knightliao/apollo/utils/time/DateUtils.java
DateUtils.getDate
public static Date getDate(int year, int month, int day) { GregorianCalendar d = new GregorianCalendar(year, month - 1, day); return d.getTime(); }
java
public static Date getDate(int year, int month, int day) { GregorianCalendar d = new GregorianCalendar(year, month - 1, day); return d.getTime(); }
[ "public", "static", "Date", "getDate", "(", "int", "year", ",", "int", "month", ",", "int", "day", ")", "{", "GregorianCalendar", "d", "=", "new", "GregorianCalendar", "(", "year", ",", "month", "-", "1", ",", "day", ")", ";", "return", "d", ".", "ge...
生成java.util.Date类型的对象 @param year int 年 @param month int 月 @param day int 日 @return Date java.util.Date类型的对象
[ "生成java", ".", "util", ".", "Date类型的对象" ]
train
https://github.com/knightliao/apollo/blob/d7a283659fa3e67af6375db8969b2d065a8ce6eb/src/main/java/com/github/knightliao/apollo/utils/time/DateUtils.java#L438-L441
avaje-common/avaje-resteasy-guice
src/main/java/org/avaje/resteasy/Bootstrap.java
Bootstrap.registerWebSockets
private void registerWebSockets(Injector injector) { Map<Key<?>, Binding<?>> allBindings = injector.getAllBindings(); // loop all the Guice bindings looking for @ServerEndpoint singletons for (Map.Entry<Key<?>, Binding<?>> entry : allBindings.entrySet()) { final Binding<?> binding = entry.getValue(); binding.acceptScopingVisitor(new DefaultBindingScopingVisitor() { @Override public Object visitEagerSingleton() { // also a eager singleton so register it registerWebSocketEndpoint(binding); return null; } }); } }
java
private void registerWebSockets(Injector injector) { Map<Key<?>, Binding<?>> allBindings = injector.getAllBindings(); // loop all the Guice bindings looking for @ServerEndpoint singletons for (Map.Entry<Key<?>, Binding<?>> entry : allBindings.entrySet()) { final Binding<?> binding = entry.getValue(); binding.acceptScopingVisitor(new DefaultBindingScopingVisitor() { @Override public Object visitEagerSingleton() { // also a eager singleton so register it registerWebSocketEndpoint(binding); return null; } }); } }
[ "private", "void", "registerWebSockets", "(", "Injector", "injector", ")", "{", "Map", "<", "Key", "<", "?", ">", ",", "Binding", "<", "?", ">", ">", "allBindings", "=", "injector", ".", "getAllBindings", "(", ")", ";", "// loop all the Guice bindings looking ...
Find any Guice eager singletons that are WebSocket endpoints and register them with the servlet container.
[ "Find", "any", "Guice", "eager", "singletons", "that", "are", "WebSocket", "endpoints", "and", "register", "them", "with", "the", "servlet", "container", "." ]
train
https://github.com/avaje-common/avaje-resteasy-guice/blob/a585d8c6b0a6d4fb5ffb679d8950e41a03795929/src/main/java/org/avaje/resteasy/Bootstrap.java#L67-L85
unbescape/unbescape
src/main/java/org/unbescape/uri/UriEscape.java
UriEscape.escapeUriPathSegment
public static void escapeUriPathSegment(final String text, 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.escape(new InternalStringReader(text), writer, UriEscapeUtil.UriEscapeType.PATH_SEGMENT, encoding); }
java
public static void escapeUriPathSegment(final String text, 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.escape(new InternalStringReader(text), writer, UriEscapeUtil.UriEscapeType.PATH_SEGMENT, encoding); }
[ "public", "static", "void", "escapeUriPathSegment", "(", "final", "String", "text", ",", "final", "Writer", "writer", ",", "final", "String", "encoding", ")", "throws", "IOException", "{", "if", "(", "writer", "==", "null", ")", "{", "throw", "new", "Illegal...
<p> Perform am URI path segment <strong>escape</strong> operation on a <tt>String</tt> input, writing results to a <tt>Writer</tt>. </p> <p> The following are the only allowed chars in an URI path segment (will not be escaped): </p> <ul> <li><tt>A-Z a-z 0-9</tt></li> <li><tt>- . _ ~</tt></li> <li><tt>! $ &amp; ' ( ) * + , ; =</tt></li> <li><tt>: @</tt></li> </ul> <p> All other chars will be escaped by converting them to the sequence of bytes that represents them in the specified <em>encoding</em> and then representing each byte in <tt>%HH</tt> syntax, being <tt>HH</tt> the hexadecimal representation of the byte. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>String</tt> to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped 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 escaping. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "am", "URI", "path", "segment", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "String<", "/", "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#L570-L583
headius/invokebinder
src/main/java/com/headius/invokebinder/Binder.java
Binder.foldVirtual
public Binder foldVirtual(MethodHandles.Lookup lookup, String method) { return fold(Binder.from(type()).invokeVirtualQuiet(lookup, method)); }
java
public Binder foldVirtual(MethodHandles.Lookup lookup, String method) { return fold(Binder.from(type()).invokeVirtualQuiet(lookup, method)); }
[ "public", "Binder", "foldVirtual", "(", "MethodHandles", ".", "Lookup", "lookup", ",", "String", "method", ")", "{", "return", "fold", "(", "Binder", ".", "from", "(", "type", "(", ")", ")", ".", "invokeVirtualQuiet", "(", "lookup", ",", "method", ")", "...
Process the incoming arguments by calling the given method on the first argument, inserting the result as the first argument. @param lookup the java.lang.invoke.MethodHandles.Lookup to use @param method the method to invoke on the first argument @return a new Binder
[ "Process", "the", "incoming", "arguments", "by", "calling", "the", "given", "method", "on", "the", "first", "argument", "inserting", "the", "result", "as", "the", "first", "argument", "." ]
train
https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Binder.java#L980-L982
beangle/beangle3
ioc/spring/src/main/java/org/beangle/inject/spring/config/BeanDefinitionParser.java
BeanDefinitionParser.parseValueElement
public Object parseValueElement(Element ele, String defaultTypeName) { // It's a literal value. String value = DomUtils.getTextValue(ele); String specifiedTypeName = ele.getAttribute(TYPE_ATTRIBUTE); String typeName = specifiedTypeName; if (!StringUtils.hasText(typeName)) typeName = defaultTypeName; try { TypedStringValue typedValue = buildTypedStringValue(value, typeName); typedValue.setSource(extractSource(ele)); typedValue.setSpecifiedTypeName(specifiedTypeName); return typedValue; } catch (ClassNotFoundException ex) { error("Type class [" + typeName + "] not found for <value> element", ele, ex); return value; } }
java
public Object parseValueElement(Element ele, String defaultTypeName) { // It's a literal value. String value = DomUtils.getTextValue(ele); String specifiedTypeName = ele.getAttribute(TYPE_ATTRIBUTE); String typeName = specifiedTypeName; if (!StringUtils.hasText(typeName)) typeName = defaultTypeName; try { TypedStringValue typedValue = buildTypedStringValue(value, typeName); typedValue.setSource(extractSource(ele)); typedValue.setSpecifiedTypeName(specifiedTypeName); return typedValue; } catch (ClassNotFoundException ex) { error("Type class [" + typeName + "] not found for <value> element", ele, ex); return value; } }
[ "public", "Object", "parseValueElement", "(", "Element", "ele", ",", "String", "defaultTypeName", ")", "{", "// It's a literal value.", "String", "value", "=", "DomUtils", ".", "getTextValue", "(", "ele", ")", ";", "String", "specifiedTypeName", "=", "ele", ".", ...
Return a typed String value Object for the given value element. @param ele a {@link org.w3c.dom.Element} object. @param defaultTypeName a {@link java.lang.String} object. @return a {@link java.lang.Object} object.
[ "Return", "a", "typed", "String", "value", "Object", "for", "the", "given", "value", "element", "." ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/ioc/spring/src/main/java/org/beangle/inject/spring/config/BeanDefinitionParser.java#L756-L771
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java
UnicodeSet.applyPattern
public UnicodeSet applyPattern(String pattern, int options) { checkFrozen(); return applyPattern(pattern, null, null, options); }
java
public UnicodeSet applyPattern(String pattern, int options) { checkFrozen(); return applyPattern(pattern, null, null, options); }
[ "public", "UnicodeSet", "applyPattern", "(", "String", "pattern", ",", "int", "options", ")", "{", "checkFrozen", "(", ")", ";", "return", "applyPattern", "(", "pattern", ",", "null", ",", "null", ",", "options", ")", ";", "}" ]
Modifies this set to represent the set specified by the given pattern, optionally ignoring whitespace. See the class description for the syntax of the pattern language. @param pattern a string specifying what characters are in the set @param options a bitmask indicating which options to apply. Valid options are IGNORE_SPACE and CASE. @exception java.lang.IllegalArgumentException if the pattern contains a syntax error.
[ "Modifies", "this", "set", "to", "represent", "the", "set", "specified", "by", "the", "given", "pattern", "optionally", "ignoring", "whitespace", ".", "See", "the", "class", "description", "for", "the", "syntax", "of", "the", "pattern", "language", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java#L573-L576
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringParser.java
StringParser.parseBoolObj
@Nullable public static Boolean parseBoolObj (@Nullable final Object aObject, @Nullable final Boolean aDefault) { return aObject == null ? aDefault : parseBoolObj (aObject.toString ()); }
java
@Nullable public static Boolean parseBoolObj (@Nullable final Object aObject, @Nullable final Boolean aDefault) { return aObject == null ? aDefault : parseBoolObj (aObject.toString ()); }
[ "@", "Nullable", "public", "static", "Boolean", "parseBoolObj", "(", "@", "Nullable", "final", "Object", "aObject", ",", "@", "Nullable", "final", "Boolean", "aDefault", ")", "{", "return", "aObject", "==", "null", "?", "aDefault", ":", "parseBoolObj", "(", ...
Try to interpret the passed {@link Object} as {@link Boolean}. @param aObject The object to be interpreted. May be <code>null</code>. @param aDefault The default value to be returned, if the passed object is <code>null</code>. @return The passed default value if the passed object is <code>null</code>, the matching {@link Boolean} otherwise.
[ "Try", "to", "interpret", "the", "passed", "{", "@link", "Object", "}", "as", "{", "@link", "Boolean", "}", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringParser.java#L176-L180
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/QueryParameterValue.java
QueryParameterValue.of
public static <T> QueryParameterValue of(T value, StandardSQLTypeName type) { return QueryParameterValue.newBuilder() .setValue(valueToStringOrNull(value, type)) .setType(type) .build(); }
java
public static <T> QueryParameterValue of(T value, StandardSQLTypeName type) { return QueryParameterValue.newBuilder() .setValue(valueToStringOrNull(value, type)) .setType(type) .build(); }
[ "public", "static", "<", "T", ">", "QueryParameterValue", "of", "(", "T", "value", ",", "StandardSQLTypeName", "type", ")", "{", "return", "QueryParameterValue", ".", "newBuilder", "(", ")", ".", "setValue", "(", "valueToStringOrNull", "(", "value", ",", "type...
Creates a {@code QueryParameterValue} object with the given value and type.
[ "Creates", "a", "{" ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/QueryParameterValue.java#L169-L174
lightbend/config
config/src/main/java/com/typesafe/config/parser/ConfigDocumentFactory.java
ConfigDocumentFactory.parseReader
public static ConfigDocument parseReader(Reader reader, ConfigParseOptions options) { return Parseable.newReader(reader, options).parseConfigDocument(); }
java
public static ConfigDocument parseReader(Reader reader, ConfigParseOptions options) { return Parseable.newReader(reader, options).parseConfigDocument(); }
[ "public", "static", "ConfigDocument", "parseReader", "(", "Reader", "reader", ",", "ConfigParseOptions", "options", ")", "{", "return", "Parseable", ".", "newReader", "(", "reader", ",", "options", ")", ".", "parseConfigDocument", "(", ")", ";", "}" ]
Parses a Reader into a ConfigDocument instance. @param reader the reader to parse @param options parse options to control how the reader is interpreted @return the parsed configuration @throws com.typesafe.config.ConfigException on IO or parse errors
[ "Parses", "a", "Reader", "into", "a", "ConfigDocument", "instance", "." ]
train
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/parser/ConfigDocumentFactory.java#L26-L28
Azure/azure-sdk-for-java
iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java
IotHubResourcesInner.getByResourceGroupAsync
public Observable<IotHubDescriptionInner> getByResourceGroupAsync(String resourceGroupName, String resourceName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<IotHubDescriptionInner>, IotHubDescriptionInner>() { @Override public IotHubDescriptionInner call(ServiceResponse<IotHubDescriptionInner> response) { return response.body(); } }); }
java
public Observable<IotHubDescriptionInner> getByResourceGroupAsync(String resourceGroupName, String resourceName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<IotHubDescriptionInner>, IotHubDescriptionInner>() { @Override public IotHubDescriptionInner call(ServiceResponse<IotHubDescriptionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "IotHubDescriptionInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ")", "....
Get the non-security related metadata of an IoT hub. Get the non-security related metadata of an IoT hub. @param resourceGroupName The name of the resource group that contains the IoT hub. @param resourceName The name of the IoT hub. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the IotHubDescriptionInner object
[ "Get", "the", "non", "-", "security", "related", "metadata", "of", "an", "IoT", "hub", ".", "Get", "the", "non", "-", "security", "related", "metadata", "of", "an", "IoT", "hub", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L254-L261
VoltDB/voltdb
src/frontend/org/voltdb/planner/AbstractParsedStmt.java
AbstractParsedStmt.addTableToStmtCache
protected StmtTableScan addTableToStmtCache(Table table, String tableAlias) { // Create an index into the query Catalog cache StmtTableScan tableScan = m_tableAliasMap.get(tableAlias); if (tableScan == null) { tableScan = new StmtTargetTableScan(table, tableAlias, m_stmtId); m_tableAliasMap.put(tableAlias, tableScan); } return tableScan; }
java
protected StmtTableScan addTableToStmtCache(Table table, String tableAlias) { // Create an index into the query Catalog cache StmtTableScan tableScan = m_tableAliasMap.get(tableAlias); if (tableScan == null) { tableScan = new StmtTargetTableScan(table, tableAlias, m_stmtId); m_tableAliasMap.put(tableAlias, tableScan); } return tableScan; }
[ "protected", "StmtTableScan", "addTableToStmtCache", "(", "Table", "table", ",", "String", "tableAlias", ")", "{", "// Create an index into the query Catalog cache", "StmtTableScan", "tableScan", "=", "m_tableAliasMap", ".", "get", "(", "tableAlias", ")", ";", "if", "("...
Add a table to the statement cache. @param table @param tableAlias @return the cache entry
[ "Add", "a", "table", "to", "the", "statement", "cache", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/planner/AbstractParsedStmt.java#L804-L812
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/Server.java
Server.createModuleBeanDefinition
protected static GenericBeanDefinition createModuleBeanDefinition(String className, Map<String,String> params, String role) throws IOException { ScannedGenericBeanDefinition result = getScannedBeanDefinition(className); result.setParentName(Module.class.getName()); result.setScope(BeanDefinition.SCOPE_SINGLETON); result.setAttribute("id", role); result.setAttribute("name", role); result.setAttribute("init-method", "initModule"); result.setEnforceInitMethod(true); result.setAttribute("destroy-method", "shutdownModule"); result.setEnforceDestroyMethod(true); ConstructorArgumentValues cArgs = new ConstructorArgumentValues(); cArgs.addIndexedArgumentValue(0, params,MODULE_CONSTRUCTOR_PARAM1_CLASS); // one server bean in context BeanReference serverRef = new RuntimeBeanReference(MODULE_CONSTRUCTOR_PARAM2_CLASS); cArgs.addIndexedArgumentValue(1, serverRef); cArgs.addIndexedArgumentValue(2, role,MODULE_CONSTRUCTOR_PARAM3_CLASS); result.setConstructorArgumentValues(cArgs); return result; }
java
protected static GenericBeanDefinition createModuleBeanDefinition(String className, Map<String,String> params, String role) throws IOException { ScannedGenericBeanDefinition result = getScannedBeanDefinition(className); result.setParentName(Module.class.getName()); result.setScope(BeanDefinition.SCOPE_SINGLETON); result.setAttribute("id", role); result.setAttribute("name", role); result.setAttribute("init-method", "initModule"); result.setEnforceInitMethod(true); result.setAttribute("destroy-method", "shutdownModule"); result.setEnforceDestroyMethod(true); ConstructorArgumentValues cArgs = new ConstructorArgumentValues(); cArgs.addIndexedArgumentValue(0, params,MODULE_CONSTRUCTOR_PARAM1_CLASS); // one server bean in context BeanReference serverRef = new RuntimeBeanReference(MODULE_CONSTRUCTOR_PARAM2_CLASS); cArgs.addIndexedArgumentValue(1, serverRef); cArgs.addIndexedArgumentValue(2, role,MODULE_CONSTRUCTOR_PARAM3_CLASS); result.setConstructorArgumentValues(cArgs); return result; }
[ "protected", "static", "GenericBeanDefinition", "createModuleBeanDefinition", "(", "String", "className", ",", "Map", "<", "String", ",", "String", ">", "params", ",", "String", "role", ")", "throws", "IOException", "{", "ScannedGenericBeanDefinition", "result", "=", ...
Generates Spring Bean definitions for Fedora Modules. Server param should be unnecessary if autowired. @param className @param params @param role @return
[ "Generates", "Spring", "Bean", "definitions", "for", "Fedora", "Modules", ".", "Server", "param", "should", "be", "unnecessary", "if", "autowired", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/Server.java#L787-L807
virgo47/javasimon
console-embed/src/main/java/org/javasimon/console/ActionContext.java
ActionContext.getParameterAsEnum
public <T extends Enum<T>> T getParameterAsEnum(String name, Class<T> type, T defaultValue) { return defaultValue(stringToEnum(getParameter(name), type), defaultValue); }
java
public <T extends Enum<T>> T getParameterAsEnum(String name, Class<T> type, T defaultValue) { return defaultValue(stringToEnum(getParameter(name), type), defaultValue); }
[ "public", "<", "T", "extends", "Enum", "<", "T", ">", ">", "T", "getParameterAsEnum", "(", "String", "name", ",", "Class", "<", "T", ">", "type", ",", "T", "defaultValue", ")", "{", "return", "defaultValue", "(", "stringToEnum", "(", "getParameter", "(",...
Get request parameter as a Enum. @param name Parameter name @param type Enum type @param defaultValue Parameter default value (can be null) @return Parameter value
[ "Get", "request", "parameter", "as", "a", "Enum", "." ]
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/ActionContext.java#L166-L168
actorapp/actor-platform
actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java
Messenger.unbindRawUploadFile
@ObjectiveCName("unbindRawUploadFileWithRid:withCallback:") public void unbindRawUploadFile(long rid, UploadFileCallback callback) { modules.getFilesModule().unbindUploadFile(rid, callback); }
java
@ObjectiveCName("unbindRawUploadFileWithRid:withCallback:") public void unbindRawUploadFile(long rid, UploadFileCallback callback) { modules.getFilesModule().unbindUploadFile(rid, callback); }
[ "@", "ObjectiveCName", "(", "\"unbindRawUploadFileWithRid:withCallback:\"", ")", "public", "void", "unbindRawUploadFile", "(", "long", "rid", ",", "UploadFileCallback", "callback", ")", "{", "modules", ".", "getFilesModule", "(", ")", ".", "unbindUploadFile", "(", "ri...
Unbind Raw Upload File @param rid randomId of uploading file @param callback file state callback
[ "Unbind", "Raw", "Upload", "File" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java#L1964-L1967
matomo-org/piwik-java-tracker
src/main/java/org/piwik/java/tracking/PiwikRequest.java
PiwikRequest.setCustomVariable
private void setCustomVariable(String parameter, CustomVariable customVariable, Integer index){ CustomVariableList cvl = (CustomVariableList)parameters.get(parameter); if (cvl == null){ cvl = new CustomVariableList(); parameters.put(parameter, cvl); } if (customVariable == null){ cvl.remove(index); if (cvl.isEmpty()){ parameters.remove(parameter); } } else if (index == null){ cvl.add(customVariable); } else { cvl.add(customVariable, index); } }
java
private void setCustomVariable(String parameter, CustomVariable customVariable, Integer index){ CustomVariableList cvl = (CustomVariableList)parameters.get(parameter); if (cvl == null){ cvl = new CustomVariableList(); parameters.put(parameter, cvl); } if (customVariable == null){ cvl.remove(index); if (cvl.isEmpty()){ parameters.remove(parameter); } } else if (index == null){ cvl.add(customVariable); } else { cvl.add(customVariable, index); } }
[ "private", "void", "setCustomVariable", "(", "String", "parameter", ",", "CustomVariable", "customVariable", ",", "Integer", "index", ")", "{", "CustomVariableList", "cvl", "=", "(", "CustomVariableList", ")", "parameters", ".", "get", "(", "parameter", ")", ";", ...
Store a value in a json object at the specified parameter. @param parameter the parameter to store the json object at @param key the key of the value. Cannot be null @param value the value. Removes the parameter if null
[ "Store", "a", "value", "in", "a", "json", "object", "at", "the", "specified", "parameter", "." ]
train
https://github.com/matomo-org/piwik-java-tracker/blob/23df71d27a89e89dc7a539b2eda88c90a206458b/src/main/java/org/piwik/java/tracking/PiwikRequest.java#L1858-L1877
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Date.java
Date.toGMTString
@Deprecated public String toGMTString() { // d MMM yyyy HH:mm:ss 'GMT' long t = getTime(); BaseCalendar cal = getCalendarSystem(t); BaseCalendar.Date date = (BaseCalendar.Date) cal.getCalendarDate(getTime(), (TimeZone)null); StringBuilder sb = new StringBuilder(32); CalendarUtils.sprintf0d(sb, date.getDayOfMonth(), 1).append(' '); // d convertToAbbr(sb, wtb[date.getMonth() - 1 + 2 + 7]).append(' '); // MMM sb.append(date.getYear()).append(' '); // yyyy CalendarUtils.sprintf0d(sb, date.getHours(), 2).append(':'); // HH CalendarUtils.sprintf0d(sb, date.getMinutes(), 2).append(':'); // mm CalendarUtils.sprintf0d(sb, date.getSeconds(), 2); // ss sb.append(" GMT"); // ' GMT' return sb.toString(); }
java
@Deprecated public String toGMTString() { // d MMM yyyy HH:mm:ss 'GMT' long t = getTime(); BaseCalendar cal = getCalendarSystem(t); BaseCalendar.Date date = (BaseCalendar.Date) cal.getCalendarDate(getTime(), (TimeZone)null); StringBuilder sb = new StringBuilder(32); CalendarUtils.sprintf0d(sb, date.getDayOfMonth(), 1).append(' '); // d convertToAbbr(sb, wtb[date.getMonth() - 1 + 2 + 7]).append(' '); // MMM sb.append(date.getYear()).append(' '); // yyyy CalendarUtils.sprintf0d(sb, date.getHours(), 2).append(':'); // HH CalendarUtils.sprintf0d(sb, date.getMinutes(), 2).append(':'); // mm CalendarUtils.sprintf0d(sb, date.getSeconds(), 2); // ss sb.append(" GMT"); // ' GMT' return sb.toString(); }
[ "@", "Deprecated", "public", "String", "toGMTString", "(", ")", "{", "// d MMM yyyy HH:mm:ss 'GMT'", "long", "t", "=", "getTime", "(", ")", ";", "BaseCalendar", "cal", "=", "getCalendarSystem", "(", "t", ")", ";", "BaseCalendar", ".", "Date", "date", "=", "(...
Creates a string representation of this <tt>Date</tt> object of the form: <blockquote><pre> d mon yyyy hh:mm:ss GMT</pre></blockquote> where:<ul> <li><i>d</i> is the day of the month (<tt>1</tt> through <tt>31</tt>), as one or two decimal digits. <li><i>mon</i> is the month (<tt>Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec</tt>). <li><i>yyyy</i> is the year, as four decimal digits. <li><i>hh</i> is the hour of the day (<tt>00</tt> through <tt>23</tt>), as two decimal digits. <li><i>mm</i> is the minute within the hour (<tt>00</tt> through <tt>59</tt>), as two decimal digits. <li><i>ss</i> is the second within the minute (<tt>00</tt> through <tt>61</tt>), as two decimal digits. <li><i>GMT</i> is exactly the ASCII letters "<tt>GMT</tt>" to indicate Greenwich Mean Time. </ul><p> The result does not depend on the local time zone. @return a string representation of this date, using the Internet GMT conventions. @see java.text.DateFormat @see java.util.Date#toString() @see java.util.Date#toLocaleString() @deprecated As of JDK version 1.1, replaced by <code>DateFormat.format(Date date)</code>, using a GMT <code>TimeZone</code>.
[ "Creates", "a", "string", "representation", "of", "this", "<tt", ">", "Date<", "/", "tt", ">", "object", "of", "the", "form", ":", "<blockquote", ">", "<pre", ">", "d", "mon", "yyyy", "hh", ":", "mm", ":", "ss", "GMT<", "/", "pre", ">", "<", "/", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Date.java#L1136-L1152
james-hu/jabb-core
src/main/java/net/sf/jabb/util/db/StartAndStopSQL.java
StartAndStopSQL.executeSQL
protected void executeSQL(String sql){ Connection conn = null; Statement stmt = null; if (useAnt){ try{ AntSqlExec sqlExec = new AntSqlExec(dataSource, sql, delimiter, delimiterType); sqlExec.execute(); log.info("SQL executed with Ant: " + sql); }catch(BuildException be){ throw new RuntimeException("Failed to execute SQL with Ant (" + be.getMessage() + "): " + sql, be); } }else{ try { conn = dataSource.getConnection(); stmt = conn.createStatement(); stmt.execute(sql); log.info("SQL executed: " + sql); }catch(SQLException sqle){ throw new RuntimeException("Failed to execute SQL (" + sqle.getMessage() + "): " + sql, sqle); }finally{ ConnectionUtility.closeConnection(conn, stmt); } } }
java
protected void executeSQL(String sql){ Connection conn = null; Statement stmt = null; if (useAnt){ try{ AntSqlExec sqlExec = new AntSqlExec(dataSource, sql, delimiter, delimiterType); sqlExec.execute(); log.info("SQL executed with Ant: " + sql); }catch(BuildException be){ throw new RuntimeException("Failed to execute SQL with Ant (" + be.getMessage() + "): " + sql, be); } }else{ try { conn = dataSource.getConnection(); stmt = conn.createStatement(); stmt.execute(sql); log.info("SQL executed: " + sql); }catch(SQLException sqle){ throw new RuntimeException("Failed to execute SQL (" + sqle.getMessage() + "): " + sql, sqle); }finally{ ConnectionUtility.closeConnection(conn, stmt); } } }
[ "protected", "void", "executeSQL", "(", "String", "sql", ")", "{", "Connection", "conn", "=", "null", ";", "Statement", "stmt", "=", "null", ";", "if", "(", "useAnt", ")", "{", "try", "{", "AntSqlExec", "sqlExec", "=", "new", "AntSqlExec", "(", "dataSour...
Execute one SQL statement. RuntimeException will be thrown if SQLException was caught. @param sql the statement to be executed
[ "Execute", "one", "SQL", "statement", ".", "RuntimeException", "will", "be", "thrown", "if", "SQLException", "was", "caught", "." ]
train
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/db/StartAndStopSQL.java#L86-L110
google/closure-compiler
src/com/google/javascript/jscomp/NodeUtil.java
NodeUtil.getNodeTypeReferenceCount
static int getNodeTypeReferenceCount( Node node, Token type, Predicate<Node> traverseChildrenPred) { return getCount(node, new MatchNodeType(type), traverseChildrenPred); }
java
static int getNodeTypeReferenceCount( Node node, Token type, Predicate<Node> traverseChildrenPred) { return getCount(node, new MatchNodeType(type), traverseChildrenPred); }
[ "static", "int", "getNodeTypeReferenceCount", "(", "Node", "node", ",", "Token", "type", ",", "Predicate", "<", "Node", ">", "traverseChildrenPred", ")", "{", "return", "getCount", "(", "node", ",", "new", "MatchNodeType", "(", "type", ")", ",", "traverseChild...
Finds the number of times a type is referenced within the node tree.
[ "Finds", "the", "number", "of", "times", "a", "type", "is", "referenced", "within", "the", "node", "tree", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L4647-L4650
JOML-CI/JOML
src/org/joml/AABBd.java
AABBd.setMin
public AABBd setMin(double minX, double minY, double minZ) { this.minX = minX; this.minY = minY; this.minZ = minZ; return this; }
java
public AABBd setMin(double minX, double minY, double minZ) { this.minX = minX; this.minY = minY; this.minZ = minZ; return this; }
[ "public", "AABBd", "setMin", "(", "double", "minX", ",", "double", "minY", ",", "double", "minZ", ")", "{", "this", ".", "minX", "=", "minX", ";", "this", ".", "minY", "=", "minY", ";", "this", ".", "minZ", "=", "minZ", ";", "return", "this", ";", ...
Set the minimum corner coordinates. @param minX the x coordinate of the minimum corner @param minY the y coordinate of the minimum corner @param minZ the z coordinate of the minimum corner @return this
[ "Set", "the", "minimum", "corner", "coordinates", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/AABBd.java#L117-L122
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/common/util/UrlUtils.java
UrlUtils.urlDecode
public static String urlDecode(String value, String enc) { return urlDecode(value, enc, false); }
java
public static String urlDecode(String value, String enc) { return urlDecode(value, enc, false); }
[ "public", "static", "String", "urlDecode", "(", "String", "value", ",", "String", "enc", ")", "{", "return", "urlDecode", "(", "value", ",", "enc", ",", "false", ")", ";", "}" ]
Decodes using URLDecoder - use when queries or form post values are decoded @param value value to decode @param enc encoding
[ "Decodes", "using", "URLDecoder", "-", "use", "when", "queries", "or", "form", "post", "values", "are", "decoded" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/common/util/UrlUtils.java#L73-L75
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/JobSchedulesInner.java
JobSchedulesInner.getAsync
public Observable<JobScheduleInner> getAsync(String resourceGroupName, String automationAccountName, UUID jobScheduleId) { return getWithServiceResponseAsync(resourceGroupName, automationAccountName, jobScheduleId).map(new Func1<ServiceResponse<JobScheduleInner>, JobScheduleInner>() { @Override public JobScheduleInner call(ServiceResponse<JobScheduleInner> response) { return response.body(); } }); }
java
public Observable<JobScheduleInner> getAsync(String resourceGroupName, String automationAccountName, UUID jobScheduleId) { return getWithServiceResponseAsync(resourceGroupName, automationAccountName, jobScheduleId).map(new Func1<ServiceResponse<JobScheduleInner>, JobScheduleInner>() { @Override public JobScheduleInner call(ServiceResponse<JobScheduleInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "JobScheduleInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "UUID", "jobScheduleId", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAccount...
Retrieve the job schedule identified by job schedule name. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param jobScheduleId The job schedule name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the JobScheduleInner object
[ "Retrieve", "the", "job", "schedule", "identified", "by", "job", "schedule", "name", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/JobSchedulesInner.java#L216-L223
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/linalg/jcublas/ops/executioner/CudaGridExecutioner.java
CudaGridExecutioner.isMatchingZX
protected boolean isMatchingZX(Op opA, Op opB) { if (opA.x() == opB.x() && opA.z() == opB.z() && opA.x() == opB.z()) return true; return false; }
java
protected boolean isMatchingZX(Op opA, Op opB) { if (opA.x() == opB.x() && opA.z() == opB.z() && opA.x() == opB.z()) return true; return false; }
[ "protected", "boolean", "isMatchingZX", "(", "Op", "opA", ",", "Op", "opB", ")", "{", "if", "(", "opA", ".", "x", "(", ")", "==", "opB", ".", "x", "(", ")", "&&", "opA", ".", "z", "(", ")", "==", "opB", ".", "z", "(", ")", "&&", "opA", ".",...
This method checks, if opA and opB are sharing the same operands @param opA @param opB @return
[ "This", "method", "checks", "if", "opA", "and", "opB", "are", "sharing", "the", "same", "operands" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/linalg/jcublas/ops/executioner/CudaGridExecutioner.java#L473-L478
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/BundleUtil.java
BundleUtil.resolveBundleDependencies
public static IBundleDependencies resolveBundleDependencies(Bundle bundle, BundleURLMappings javadocURLs, String... directDependencies) { final BundleURLMappings docMapping = javadocURLs == null ? new Utilities.SARLBundleJavadocURLMappings() : javadocURLs; final Collection<String> deps = directDependencies == null || directDependencies.length == 0 ? null : Arrays.asList(directDependencies); return new BundleDependencies(bundle, deps, docMapping); }
java
public static IBundleDependencies resolveBundleDependencies(Bundle bundle, BundleURLMappings javadocURLs, String... directDependencies) { final BundleURLMappings docMapping = javadocURLs == null ? new Utilities.SARLBundleJavadocURLMappings() : javadocURLs; final Collection<String> deps = directDependencies == null || directDependencies.length == 0 ? null : Arrays.asList(directDependencies); return new BundleDependencies(bundle, deps, docMapping); }
[ "public", "static", "IBundleDependencies", "resolveBundleDependencies", "(", "Bundle", "bundle", ",", "BundleURLMappings", "javadocURLs", ",", "String", "...", "directDependencies", ")", "{", "final", "BundleURLMappings", "docMapping", "=", "javadocURLs", "==", "null", ...
Replies the dependencies for the given bundle. @param bundle the bundle. @param javadocURLs the mapping from bundles to the corresponding Javadoc URLs. @param directDependencies the list of the bundle symbolic names that are the direct dependencies of the bundle to be considered. If the given bundle has other dependencies in its Manifest, they will be ignored if they are not in this parameter. @return the bundle dependencies.
[ "Replies", "the", "dependencies", "for", "the", "given", "bundle", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/BundleUtil.java#L255-L259
rzwitserloot/lombok
src/utils/lombok/core/SpiLoadUtil.java
SpiLoadUtil.findServices
public static <C> Iterable<C> findServices(Class<C> target) throws IOException { return findServices(target, Thread.currentThread().getContextClassLoader()); }
java
public static <C> Iterable<C> findServices(Class<C> target) throws IOException { return findServices(target, Thread.currentThread().getContextClassLoader()); }
[ "public", "static", "<", "C", ">", "Iterable", "<", "C", ">", "findServices", "(", "Class", "<", "C", ">", "target", ")", "throws", "IOException", "{", "return", "findServices", "(", "target", ",", "Thread", ".", "currentThread", "(", ")", ".", "getConte...
Returns an iterator of instances that, at least according to the spi discovery file, are implementations of the stated class. Like ServiceLoader, each listed class is turned into an instance by calling the public no-args constructor. Convenience method that calls the more elaborate {@link #findServices(Class, ClassLoader)} method with this {@link java.lang.Thread}'s context class loader as {@code ClassLoader}. @param target class to find implementations for.
[ "Returns", "an", "iterator", "of", "instances", "that", "at", "least", "according", "to", "the", "spi", "discovery", "file", "are", "implementations", "of", "the", "stated", "class", "." ]
train
https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/utils/lombok/core/SpiLoadUtil.java#L77-L79
google/closure-templates
java/src/com/google/template/soy/pysrc/internal/GenPyCallExprVisitor.java
GenPyCallExprVisitor.exec
PyExpr exec(CallNode callNode, LocalVariableStack localVarStack, ErrorReporter errorReporter) { this.localVarStack = localVarStack; this.errorReporter = errorReporter; PyExpr callExpr = visit(callNode); this.localVarStack = null; this.errorReporter = null; return callExpr; }
java
PyExpr exec(CallNode callNode, LocalVariableStack localVarStack, ErrorReporter errorReporter) { this.localVarStack = localVarStack; this.errorReporter = errorReporter; PyExpr callExpr = visit(callNode); this.localVarStack = null; this.errorReporter = null; return callExpr; }
[ "PyExpr", "exec", "(", "CallNode", "callNode", ",", "LocalVariableStack", "localVarStack", ",", "ErrorReporter", "errorReporter", ")", "{", "this", ".", "localVarStack", "=", "localVarStack", ";", "this", ".", "errorReporter", "=", "errorReporter", ";", "PyExpr", ...
Generates the Python expression for a given call. <p>Important: If there are CallParamContentNode children whose contents are not computable as Python expressions, then this function assumes that, elsewhere, code has been generated to define their respective {@code param<n>} temporary variables. <p>Here are five example calls: <pre> {call some.func data="all" /} {call some.func data="$boo" /} {call some.func} {param goo = $moo /} {/call} {call some.func data="$boo"} {param goo}Blah{/param} {/call} {call some.func} {param goo} {for $i in range(3)}{$i}{/for} {/param} {/call} </pre> Their respective generated calls might be the following: <pre> some.func(data) some.func(data.get('boo')) some.func({'goo': opt_data.get('moo')}) some.func(runtime.merge_into_dict({'goo': 'Blah'}, data.get('boo'))) some.func({'goo': param65}) </pre> Note that in the last case, the param content is not computable as Python expressions, so we assume that code has been generated to define the temporary variable {@code param<n>}. @param callNode The call to generate code for. @param localVarStack The current stack of replacement Python expressions for the local variables (and foreach-loop special functions) current in scope. @return The Python expression for the call.
[ "Generates", "the", "Python", "expression", "for", "a", "given", "call", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/pysrc/internal/GenPyCallExprVisitor.java#L114-L121
groupby/api-java
src/main/java/com/groupbyinc/api/Query.java
Query.setPinnedRefinements
public Query setPinnedRefinements(String navigationName, String... values) { Navigation navigation = navigations.get(navigationName); if (navigation == null) { navigation = new Navigation().setName(navigationName); navigations.put(navigationName, navigation); } navigation.setPinnedRefinements(asList(values)); return this; }
java
public Query setPinnedRefinements(String navigationName, String... values) { Navigation navigation = navigations.get(navigationName); if (navigation == null) { navigation = new Navigation().setName(navigationName); navigations.put(navigationName, navigation); } navigation.setPinnedRefinements(asList(values)); return this; }
[ "public", "Query", "setPinnedRefinements", "(", "String", "navigationName", ",", "String", "...", "values", ")", "{", "Navigation", "navigation", "=", "navigations", ".", "get", "(", "navigationName", ")", ";", "if", "(", "navigation", "==", "null", ")", "{", ...
<code> Add pinned value refinement. Takes a refinement name and a set of values. </code> @param navigationName The name of the navigation @param values The refinement values @return
[ "<code", ">", "Add", "pinned", "value", "refinement", ".", "Takes", "a", "refinement", "name", "and", "a", "set", "of", "values", ".", "<", "/", "code", ">" ]
train
https://github.com/groupby/api-java/blob/257c4ed0777221e5e4ade3b29b9921300fac4e2e/src/main/java/com/groupbyinc/api/Query.java#L803-L811
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java
KeyVaultClientCustomImpl.getKeyAsync
public ServiceFuture<KeyBundle> getKeyAsync(String vaultBaseUrl, String keyName, final ServiceCallback<KeyBundle> serviceCallback) { return getKeyAsync(vaultBaseUrl, keyName, "", serviceCallback); }
java
public ServiceFuture<KeyBundle> getKeyAsync(String vaultBaseUrl, String keyName, final ServiceCallback<KeyBundle> serviceCallback) { return getKeyAsync(vaultBaseUrl, keyName, "", serviceCallback); }
[ "public", "ServiceFuture", "<", "KeyBundle", ">", "getKeyAsync", "(", "String", "vaultBaseUrl", ",", "String", "keyName", ",", "final", "ServiceCallback", "<", "KeyBundle", ">", "serviceCallback", ")", "{", "return", "getKeyAsync", "(", "vaultBaseUrl", ",", "keyNa...
Gets the public part of a stored key. The get key operation is applicable to all key types. If the requested key is symmetric, then no key material is released in the response. Authorization: Requires the keys/get permission. @param vaultBaseUrl The vault name, e.g. https://myvault.vault.azure.net @param keyName The name of the key @param serviceCallback the async ServiceCallback to handle successful and failed responses. @return the {@link ServiceFuture} object
[ "Gets", "the", "public", "part", "of", "a", "stored", "key", ".", "The", "get", "key", "operation", "is", "applicable", "to", "all", "key", "types", ".", "If", "the", "requested", "key", "is", "symmetric", "then", "no", "key", "material", "is", "released...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java#L671-L674
optimatika/ojAlgo-finance
src/main/java/org/ojalgo/finance/portfolio/MarketEquilibrium.java
MarketEquilibrium.calibrate
public void calibrate(final PrimitiveMatrix assetWeights, final PrimitiveMatrix assetReturns) { final Scalar<?> tmpImpliedRiskAversion = this.calculateImpliedRiskAversion(assetWeights, assetReturns); this.setRiskAversion(tmpImpliedRiskAversion.get()); }
java
public void calibrate(final PrimitiveMatrix assetWeights, final PrimitiveMatrix assetReturns) { final Scalar<?> tmpImpliedRiskAversion = this.calculateImpliedRiskAversion(assetWeights, assetReturns); this.setRiskAversion(tmpImpliedRiskAversion.get()); }
[ "public", "void", "calibrate", "(", "final", "PrimitiveMatrix", "assetWeights", ",", "final", "PrimitiveMatrix", "assetReturns", ")", "{", "final", "Scalar", "<", "?", ">", "tmpImpliedRiskAversion", "=", "this", ".", "calculateImpliedRiskAversion", "(", "assetWeights"...
Will set the risk aversion factor to the best fit for an observed pair of market portfolio asset weights and equilibrium/historical excess returns.
[ "Will", "set", "the", "risk", "aversion", "factor", "to", "the", "best", "fit", "for", "an", "observed", "pair", "of", "market", "portfolio", "asset", "weights", "and", "equilibrium", "/", "historical", "excess", "returns", "." ]
train
https://github.com/optimatika/ojAlgo-finance/blob/c8d3f7e1894d4263b7334bca3f4c060e466f8b15/src/main/java/org/ojalgo/finance/portfolio/MarketEquilibrium.java#L168-L173
Alluxio/alluxio
core/server/proxy/src/main/java/alluxio/proxy/s3/S3RestUtils.java
S3RestUtils.createResponse
private static Response createResponse(Object object) { if (object == null) { return Response.ok().build(); } if (object instanceof Response) { return (Response) object; } if (object instanceof Response.Status) { Response.Status s = (Response.Status) object; switch (s) { case OK: return Response.ok().build(); case ACCEPTED: return Response.accepted().build(); case NO_CONTENT: return Response.noContent().build(); default: return createErrorResponse( new S3Exception("Response status is invalid", S3ErrorCode.INTERNAL_ERROR)); } } // Need to explicitly encode the string as XML because Jackson will not do it automatically. XmlMapper mapper = new XmlMapper(); try { return Response.ok(mapper.writeValueAsString(object)).build(); } catch (JsonProcessingException e) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR) .entity("Failed to encode XML: " + e.getMessage()).build(); } }
java
private static Response createResponse(Object object) { if (object == null) { return Response.ok().build(); } if (object instanceof Response) { return (Response) object; } if (object instanceof Response.Status) { Response.Status s = (Response.Status) object; switch (s) { case OK: return Response.ok().build(); case ACCEPTED: return Response.accepted().build(); case NO_CONTENT: return Response.noContent().build(); default: return createErrorResponse( new S3Exception("Response status is invalid", S3ErrorCode.INTERNAL_ERROR)); } } // Need to explicitly encode the string as XML because Jackson will not do it automatically. XmlMapper mapper = new XmlMapper(); try { return Response.ok(mapper.writeValueAsString(object)).build(); } catch (JsonProcessingException e) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR) .entity("Failed to encode XML: " + e.getMessage()).build(); } }
[ "private", "static", "Response", "createResponse", "(", "Object", "object", ")", "{", "if", "(", "object", "==", "null", ")", "{", "return", "Response", ".", "ok", "(", ")", ".", "build", "(", ")", ";", "}", "if", "(", "object", "instanceof", "Response...
Creates a response using the given object. @param object the object to respond with @return the response
[ "Creates", "a", "response", "using", "the", "given", "object", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/proxy/src/main/java/alluxio/proxy/s3/S3RestUtils.java#L87-L119