repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
cdk/cdk
legacy/src/main/java/org/openscience/cdk/geometry/GeometryTools.java
GeometryTools.translate2D
public static void translate2D(IAtomContainer atomCon, double transX, double transY) { translate2D(atomCon, new Vector2d(transX, transY)); }
java
public static void translate2D(IAtomContainer atomCon, double transX, double transY) { translate2D(atomCon, new Vector2d(transX, transY)); }
[ "public", "static", "void", "translate2D", "(", "IAtomContainer", "atomCon", ",", "double", "transX", ",", "double", "transY", ")", "{", "translate2D", "(", "atomCon", ",", "new", "Vector2d", "(", "transX", ",", "transY", ")", ")", ";", "}" ]
Translates the given molecule by the given Vector. See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for details on coordinate sets @param atomCon The molecule to be translated @param transX translation in x direction @param transY translation in y direction
[ "Translates", "the", "given", "molecule", "by", "the", "given", "Vector", ".", "See", "comment", "for", "center", "(", "IAtomContainer", "atomCon", "Dimension", "areaDim", "HashMap", "renderingCoordinates", ")", "for", "details", "on", "coordinate", "sets" ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/geometry/GeometryTools.java#L138-L140
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CECalendar.java
CECalendar.jdToCE
public static void jdToCE(int julianDay, int jdEpochOffset, int[] fields) { int c4; // number of 4 year cycle (1461 days) int[] r4 = new int[1]; // remainder of 4 year cycle, always positive c4 = floorDivide(julianDay - jdEpochOffset, 1461, r4); // exteded year fields[0] = 4 * c4 + (r4[0]/365 - r4[0]/1460); // 4 * <number of 4year cycle> + <years within the last cycle> int doy = (r4[0] == 1460) ? 365 : (r4[0] % 365); // days in present year // month fields[1] = doy / 30; // 30 -> Coptic/Ethiopic month length up to 12th month // day fields[2] = (doy % 30) + 1; // 1-based days in a month }
java
public static void jdToCE(int julianDay, int jdEpochOffset, int[] fields) { int c4; // number of 4 year cycle (1461 days) int[] r4 = new int[1]; // remainder of 4 year cycle, always positive c4 = floorDivide(julianDay - jdEpochOffset, 1461, r4); // exteded year fields[0] = 4 * c4 + (r4[0]/365 - r4[0]/1460); // 4 * <number of 4year cycle> + <years within the last cycle> int doy = (r4[0] == 1460) ? 365 : (r4[0] % 365); // days in present year // month fields[1] = doy / 30; // 30 -> Coptic/Ethiopic month length up to 12th month // day fields[2] = (doy % 30) + 1; // 1-based days in a month }
[ "public", "static", "void", "jdToCE", "(", "int", "julianDay", ",", "int", "jdEpochOffset", ",", "int", "[", "]", "fields", ")", "{", "int", "c4", ";", "// number of 4 year cycle (1461 days)", "int", "[", "]", "r4", "=", "new", "int", "[", "1", "]", ";",...
Convert a Julian day to an Coptic/Ethiopic year, month and day @hide unsupported on Android
[ "Convert", "a", "Julian", "day", "to", "an", "Coptic", "/", "Ethiopic", "year", "month", "and", "day" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CECalendar.java#L264-L279
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java
HashtableOnDisk.getStaticInstance
static public HashtableOnDisk getStaticInstance(FileManager filemgr, boolean auto_rehash, long instanceid, HashtableInitInterface initfn, boolean hasCacheValue, HTODDynacache htoddc) throws FileManagerException, ClassNotFoundException, IOException, HashtableOnDiskException { if (instanceid == 0) { instanceid = filemgr.start(); } HashtableOnDisk answer = null; try { answer = new HashtableOnDisk(filemgr, auto_rehash, instanceid, initfn, hasCacheValue, htoddc); } catch (EOFException e) { // eof means the file is empty and there is no such instance } return answer; }
java
static public HashtableOnDisk getStaticInstance(FileManager filemgr, boolean auto_rehash, long instanceid, HashtableInitInterface initfn, boolean hasCacheValue, HTODDynacache htoddc) throws FileManagerException, ClassNotFoundException, IOException, HashtableOnDiskException { if (instanceid == 0) { instanceid = filemgr.start(); } HashtableOnDisk answer = null; try { answer = new HashtableOnDisk(filemgr, auto_rehash, instanceid, initfn, hasCacheValue, htoddc); } catch (EOFException e) { // eof means the file is empty and there is no such instance } return answer; }
[ "static", "public", "HashtableOnDisk", "getStaticInstance", "(", "FileManager", "filemgr", ",", "boolean", "auto_rehash", ",", "long", "instanceid", ",", "HashtableInitInterface", "initfn", ",", "boolean", "hasCacheValue", ",", "HTODDynacache", "htoddc", ")", "throws", ...
*********************************************************************** getInstance. Initializes a HashtableOnDisk instance over the specified FileManager, from the specified instanceid. The instanceid was used to originally create the instance in the createInstance method. @param filemgr The FileManager for the HTOD. @param auto_rehash If "true", the HTOD will automatically double in capacity when its occupancy exceeds its threshold. If "false" the HTOD will increase only if the startRehash() method is invoked. @param instanceid The instance of the HTOD in the FileManager. @param initfn An interface to which each object will be passed on initialztion *only* if it is determined that the HTOD was not previously properly closed. @return A HashtableOnDisk pointer ***********************************************************************
[ "***********************************************************************", "getInstance", ".", "Initializes", "a", "HashtableOnDisk", "instance", "over", "the", "specified", "FileManager", "from", "the", "specified", "instanceid", ".", "The", "instanceid", "was", "used", "to"...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java#L382-L404
actorapp/actor-platform
actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java
ImageLoading.savePng
public static void savePng(Bitmap src, String fileName) throws ImageSaveException { save(src, fileName, Bitmap.CompressFormat.PNG, 100); }
java
public static void savePng(Bitmap src, String fileName) throws ImageSaveException { save(src, fileName, Bitmap.CompressFormat.PNG, 100); }
[ "public", "static", "void", "savePng", "(", "Bitmap", "src", ",", "String", "fileName", ")", "throws", "ImageSaveException", "{", "save", "(", "src", ",", "fileName", ",", "Bitmap", ".", "CompressFormat", ".", "PNG", ",", "100", ")", ";", "}" ]
Saving image in png to file @param src source image @param fileName destination file name @throws ImageSaveException if it is unable to save image
[ "Saving", "image", "in", "png", "to", "file" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java#L332-L334
ReactiveX/RxNetty
rxnetty-common/src/main/java/io/reactivex/netty/util/LineReader.java
LineReader.decodeLast
public void decodeLast(ByteBuf in, List<Object> out, ByteBufAllocator allocator) { decode(in, out, allocator); if (null != incompleteBuffer && incompleteBuffer.isReadable()) { out.add(incompleteBuffer.toString(encoding)); } }
java
public void decodeLast(ByteBuf in, List<Object> out, ByteBufAllocator allocator) { decode(in, out, allocator); if (null != incompleteBuffer && incompleteBuffer.isReadable()) { out.add(incompleteBuffer.toString(encoding)); } }
[ "public", "void", "decodeLast", "(", "ByteBuf", "in", ",", "List", "<", "Object", ">", "out", ",", "ByteBufAllocator", "allocator", ")", "{", "decode", "(", "in", ",", "out", ",", "allocator", ")", ";", "if", "(", "null", "!=", "incompleteBuffer", "&&", ...
Same as {@link #decode(ByteBuf, List, ByteBufAllocator)} but it also produces the left-over buffer, even in absence of a line termination. {@link #dispose()} must be called when the associated {@link ChannelHandler} is removed from the pipeline. @param in Buffer to decode. @param out List to add the read lines to. @param allocator Allocator to allocate new buffers, if required.
[ "Same", "as", "{", "@link", "#decode", "(", "ByteBuf", "List", "ByteBufAllocator", ")", "}", "but", "it", "also", "produces", "the", "left", "-", "over", "buffer", "even", "in", "absence", "of", "a", "line", "termination", "." ]
train
https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-common/src/main/java/io/reactivex/netty/util/LineReader.java#L112-L117
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java
KeyUtil.generateKeyPair
public static KeyPair generateKeyPair(String algorithm, byte[] seed, AlgorithmParameterSpec param) { return generateKeyPair(algorithm, DEFAULT_KEY_SIZE, seed, param); }
java
public static KeyPair generateKeyPair(String algorithm, byte[] seed, AlgorithmParameterSpec param) { return generateKeyPair(algorithm, DEFAULT_KEY_SIZE, seed, param); }
[ "public", "static", "KeyPair", "generateKeyPair", "(", "String", "algorithm", ",", "byte", "[", "]", "seed", ",", "AlgorithmParameterSpec", "param", ")", "{", "return", "generateKeyPair", "(", "algorithm", ",", "DEFAULT_KEY_SIZE", ",", "seed", ",", "param", ")",...
生成用于非对称加密的公钥和私钥<br> 密钥对生成算法见:https://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#KeyPairGenerator @param algorithm 非对称加密算法 @param param {@link AlgorithmParameterSpec} @param seed 种子 @return {@link KeyPair} @since 4.3.3
[ "生成用于非对称加密的公钥和私钥<br", ">", "密钥对生成算法见:https", ":", "//", "docs", ".", "oracle", ".", "com", "/", "javase", "/", "7", "/", "docs", "/", "technotes", "/", "guides", "/", "security", "/", "StandardNames", ".", "html#KeyPairGenerator" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java#L378-L380
Scalified/viewmover
viewmover/src/main/java/com/scalified/viewmover/movers/MarginViewMover.java
MarginViewMover.changeViewPosition
@Override void changeViewPosition(float xAxisDelta, float yAxisDelta) { ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) getView().getLayoutParams(); if (isViewLeftAligned(layoutParams)) { layoutParams.leftMargin += xAxisDelta; } else { layoutParams.rightMargin -= xAxisDelta; } if (isViewTopAligned(layoutParams)) { layoutParams.topMargin += yAxisDelta; } else { layoutParams.bottomMargin -= yAxisDelta; } LOGGER.trace("Updated view margins: left = {}, top = {}, right = {}, bottom = {}", layoutParams.leftMargin, layoutParams.topMargin, layoutParams.rightMargin, layoutParams.bottomMargin); getView().setLayoutParams(layoutParams); }
java
@Override void changeViewPosition(float xAxisDelta, float yAxisDelta) { ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) getView().getLayoutParams(); if (isViewLeftAligned(layoutParams)) { layoutParams.leftMargin += xAxisDelta; } else { layoutParams.rightMargin -= xAxisDelta; } if (isViewTopAligned(layoutParams)) { layoutParams.topMargin += yAxisDelta; } else { layoutParams.bottomMargin -= yAxisDelta; } LOGGER.trace("Updated view margins: left = {}, top = {}, right = {}, bottom = {}", layoutParams.leftMargin, layoutParams.topMargin, layoutParams.rightMargin, layoutParams.bottomMargin); getView().setLayoutParams(layoutParams); }
[ "@", "Override", "void", "changeViewPosition", "(", "float", "xAxisDelta", ",", "float", "yAxisDelta", ")", "{", "ViewGroup", ".", "MarginLayoutParams", "layoutParams", "=", "(", "ViewGroup", ".", "MarginLayoutParams", ")", "getView", "(", ")", ".", "getLayoutPara...
Changes the position of the view, based on view's margins within its parent container @param xAxisDelta X-axis delta in actual pixels @param yAxisDelta Y-axis delta in actual pixels
[ "Changes", "the", "position", "of", "the", "view", "based", "on", "view", "s", "margins", "within", "its", "parent", "container" ]
train
https://github.com/Scalified/viewmover/blob/e2b35f7d8517a5533afe8b68a4c1ee352d9aec34/viewmover/src/main/java/com/scalified/viewmover/movers/MarginViewMover.java#L61-L77
lucee/Lucee
core/src/main/java/lucee/runtime/tag/Ldap.java
Ldap.setScope
public void setScope(String strScope) throws ApplicationException { strScope = strScope.trim().toLowerCase(); if (strScope.equals("onelevel")) scope = SearchControls.ONELEVEL_SCOPE; else if (strScope.equals("base")) scope = SearchControls.OBJECT_SCOPE; else if (strScope.equals("subtree")) scope = SearchControls.SUBTREE_SCOPE; else throw new ApplicationException("invalid value for attribute scope [" + strScope + "], valid values are [oneLevel,base,subtree]"); }
java
public void setScope(String strScope) throws ApplicationException { strScope = strScope.trim().toLowerCase(); if (strScope.equals("onelevel")) scope = SearchControls.ONELEVEL_SCOPE; else if (strScope.equals("base")) scope = SearchControls.OBJECT_SCOPE; else if (strScope.equals("subtree")) scope = SearchControls.SUBTREE_SCOPE; else throw new ApplicationException("invalid value for attribute scope [" + strScope + "], valid values are [oneLevel,base,subtree]"); }
[ "public", "void", "setScope", "(", "String", "strScope", ")", "throws", "ApplicationException", "{", "strScope", "=", "strScope", ".", "trim", "(", ")", ".", "toLowerCase", "(", ")", ";", "if", "(", "strScope", ".", "equals", "(", "\"onelevel\"", ")", ")",...
Specifies the scope of the search from the entry specified in the Start attribute for action = "Query". @param strScope The scope to set. @throws ApplicationException
[ "Specifies", "the", "scope", "of", "the", "search", "from", "the", "entry", "specified", "in", "the", "Start", "attribute", "for", "action", "=", "Query", "." ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Ldap.java#L218-L224
nohana/Amalgam
amalgam/src/main/java/com/amalgam/database/CursorUtils.java
CursorUtils.getFloat
public static float getFloat(Cursor cursor, String columnName) { if (cursor == null) { return -1; } return cursor.getFloat(cursor.getColumnIndex(columnName)); }
java
public static float getFloat(Cursor cursor, String columnName) { if (cursor == null) { return -1; } return cursor.getFloat(cursor.getColumnIndex(columnName)); }
[ "public", "static", "float", "getFloat", "(", "Cursor", "cursor", ",", "String", "columnName", ")", "{", "if", "(", "cursor", "==", "null", ")", "{", "return", "-", "1", ";", "}", "return", "cursor", ".", "getFloat", "(", "cursor", ".", "getColumnIndex",...
Read the float data for the column. @see android.database.Cursor#getFloat(int). @see android.database.Cursor#getColumnIndex(String). @param cursor the cursor. @param columnName the column name. @return the float value.
[ "Read", "the", "float", "data", "for", "the", "column", "." ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/database/CursorUtils.java#L144-L150
banq/jdonframework
src/main/java/com/jdon/util/UtilValidate.java
UtilValidate.stripCharsInBag
public static String stripCharsInBag(String s, String bag) { int i; String returnString = ""; // Search through string's characters one by one. // If character is not in bag, append to returnString. for (i = 0; i < s.length(); i++) { char c = s.charAt(i); if (bag.indexOf(c) == -1) returnString += c; } return returnString; }
java
public static String stripCharsInBag(String s, String bag) { int i; String returnString = ""; // Search through string's characters one by one. // If character is not in bag, append to returnString. for (i = 0; i < s.length(); i++) { char c = s.charAt(i); if (bag.indexOf(c) == -1) returnString += c; } return returnString; }
[ "public", "static", "String", "stripCharsInBag", "(", "String", "s", ",", "String", "bag", ")", "{", "int", "i", ";", "String", "returnString", "=", "\"\"", ";", "// Search through string's characters one by one.\r", "// If character is not in bag, append to returnString.\r...
Removes all characters which appear in string bag from string s.
[ "Removes", "all", "characters", "which", "appear", "in", "string", "bag", "from", "string", "s", "." ]
train
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilValidate.java#L227-L239
grandstaish/paperparcel
paperparcel-compiler/src/main/java/paperparcel/Utils.java
Utils.getCreatorArg
static TypeMirror getCreatorArg(Elements elements, Types types, DeclaredType creatorType) { TypeElement creatorElement = elements.getTypeElement(PARCELABLE_CREATOR_CLASS_NAME); TypeParameterElement param = creatorElement.getTypeParameters().get(0); return paramAsMemberOf(types, creatorType, param); }
java
static TypeMirror getCreatorArg(Elements elements, Types types, DeclaredType creatorType) { TypeElement creatorElement = elements.getTypeElement(PARCELABLE_CREATOR_CLASS_NAME); TypeParameterElement param = creatorElement.getTypeParameters().get(0); return paramAsMemberOf(types, creatorType, param); }
[ "static", "TypeMirror", "getCreatorArg", "(", "Elements", "elements", ",", "Types", "types", ",", "DeclaredType", "creatorType", ")", "{", "TypeElement", "creatorElement", "=", "elements", ".", "getTypeElement", "(", "PARCELABLE_CREATOR_CLASS_NAME", ")", ";", "TypePar...
Returns the {@link TypeMirror} argument found in a given {@code Parcelable.Creator} type.
[ "Returns", "the", "{" ]
train
https://github.com/grandstaish/paperparcel/blob/917686ced81b335b6708d81d6cc0e3e496f7280d/paperparcel-compiler/src/main/java/paperparcel/Utils.java#L239-L243
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/ServiceTaskBase.java
ServiceTaskBase.checkProgressRatio
@Override public boolean checkProgressRatio(final double newWorkDone, final double totalWork, final double amountThreshold) { double currentRatio; synchronized (this) { // Compute the actual progression currentRatio = this.localWorkDone >= 0 ? 100 * this.localWorkDone / totalWork : 0.0; } // Compute the future progression final double newRatio = 100 * newWorkDone / totalWork; // return true if the task has progressed of at least block increment value return newRatio - currentRatio > amountThreshold; }
java
@Override public boolean checkProgressRatio(final double newWorkDone, final double totalWork, final double amountThreshold) { double currentRatio; synchronized (this) { // Compute the actual progression currentRatio = this.localWorkDone >= 0 ? 100 * this.localWorkDone / totalWork : 0.0; } // Compute the future progression final double newRatio = 100 * newWorkDone / totalWork; // return true if the task has progressed of at least block increment value return newRatio - currentRatio > amountThreshold; }
[ "@", "Override", "public", "boolean", "checkProgressRatio", "(", "final", "double", "newWorkDone", ",", "final", "double", "totalWork", ",", "final", "double", "amountThreshold", ")", "{", "double", "currentRatio", ";", "synchronized", "(", "this", ")", "{", "//...
Check if the task has enough progressed according to the given threshold. This method can be called outside the JAT, it's useful to filter useless call to JAT @param newWorkDone the amount of work done @param totalWork the total amount of work @param amountThreshold the minimum threshold amount to return true; range is [0.0 - 100.0] (typically 1.0 for 1%) @return true if the threshold is reached
[ "Check", "if", "the", "task", "has", "enough", "progressed", "according", "to", "the", "given", "threshold", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/ServiceTaskBase.java#L367-L381
census-instrumentation/opencensus-java
api/src/main/java/io/opencensus/trace/propagation/BinaryFormat.java
BinaryFormat.fromByteArray
public SpanContext fromByteArray(byte[] bytes) throws SpanContextParseException { // Implementation must override this method. If it doesn't, the below will StackOverflowError. try { return fromBinaryValue(bytes); } catch (ParseException e) { throw new SpanContextParseException("Error while parsing.", e); } }
java
public SpanContext fromByteArray(byte[] bytes) throws SpanContextParseException { // Implementation must override this method. If it doesn't, the below will StackOverflowError. try { return fromBinaryValue(bytes); } catch (ParseException e) { throw new SpanContextParseException("Error while parsing.", e); } }
[ "public", "SpanContext", "fromByteArray", "(", "byte", "[", "]", "bytes", ")", "throws", "SpanContextParseException", "{", "// Implementation must override this method. If it doesn't, the below will StackOverflowError.", "try", "{", "return", "fromBinaryValue", "(", "bytes", ")...
Parses the {@link SpanContext} from a byte array using the binary format. @param bytes a binary encoded buffer from which the {@code SpanContext} will be parsed. @return the parsed {@code SpanContext}. @throws NullPointerException if the {@code input} is {@code null}. @throws SpanContextParseException if the version is not supported or the input is invalid @since 0.7
[ "Parses", "the", "{", "@link", "SpanContext", "}", "from", "a", "byte", "array", "using", "the", "binary", "format", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/trace/propagation/BinaryFormat.java#L123-L130
flex-oss/flex-fruit
fruit-jpa/src/main/java/org/cdlflex/fruit/jpa/QueryFactory.java
QueryFactory.select
public TypedQuery<T> select(Filter filter, OrderBy orderBy) { CriteriaQuery<T> query = cb.createQuery(getEntityClass()); Root<T> from = query.from(getEntityClass()); CriteriaMapper criteriaMapper = new CriteriaMapper(from, cb); if (orderBy != null) { query.orderBy(criteriaMapper.create(orderBy)); } if (filter != null) { query.where(criteriaMapper.create(filter)); } return getEntityManager().createQuery(query); }
java
public TypedQuery<T> select(Filter filter, OrderBy orderBy) { CriteriaQuery<T> query = cb.createQuery(getEntityClass()); Root<T> from = query.from(getEntityClass()); CriteriaMapper criteriaMapper = new CriteriaMapper(from, cb); if (orderBy != null) { query.orderBy(criteriaMapper.create(orderBy)); } if (filter != null) { query.where(criteriaMapper.create(filter)); } return getEntityManager().createQuery(query); }
[ "public", "TypedQuery", "<", "T", ">", "select", "(", "Filter", "filter", ",", "OrderBy", "orderBy", ")", "{", "CriteriaQuery", "<", "T", ">", "query", "=", "cb", ".", "createQuery", "(", "getEntityClass", "(", ")", ")", ";", "Root", "<", "T", ">", "...
Creates a new query that is the basis for the {@link JpaRepository#find(org.cdlflex.fruit.Query)} call without limit and offset. @param filter the filter @param orderBy the order by clause @return a typed query
[ "Creates", "a", "new", "query", "that", "is", "the", "basis", "for", "the", "{", "@link", "JpaRepository#find", "(", "org", ".", "cdlflex", ".", "fruit", ".", "Query", ")", "}", "call", "without", "limit", "and", "offset", "." ]
train
https://github.com/flex-oss/flex-fruit/blob/30d7eca5ee796b829f96c9932a95b259ca9738d9/fruit-jpa/src/main/java/org/cdlflex/fruit/jpa/QueryFactory.java#L101-L115
upwork/java-upwork
src/com/Upwork/api/Routers/Messages.java
Messages.getRoomByOffer
public JSONObject getRoomByOffer(String company, String offerId, HashMap<String, String> params) throws JSONException { return oClient.get("/messages/v3/" + company + "/rooms/offers/" + offerId, params); }
java
public JSONObject getRoomByOffer(String company, String offerId, HashMap<String, String> params) throws JSONException { return oClient.get("/messages/v3/" + company + "/rooms/offers/" + offerId, params); }
[ "public", "JSONObject", "getRoomByOffer", "(", "String", "company", ",", "String", "offerId", ",", "HashMap", "<", "String", ",", "String", ">", "params", ")", "throws", "JSONException", "{", "return", "oClient", ".", "get", "(", "\"/messages/v3/\"", "+", "com...
Get a specific room by offer ID @param company Company ID @param offerId Offer ID @param params Parameters @throws JSONException If error occurred @return {@link JSONObject}
[ "Get", "a", "specific", "room", "by", "offer", "ID" ]
train
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Messages.java#L75-L77
elki-project/elki
elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/heap/Heap.java
Heap.heapifyUp
protected void heapifyUp(int pos, E elem) { assert (pos < size && pos >= 0); while(pos > 0) { final int parent = (pos - 1) >>> 1; Object par = queue[parent]; if(comparator.compare(elem, par) >= 0) { break; } queue[pos] = par; pos = parent; } queue[pos] = elem; }
java
protected void heapifyUp(int pos, E elem) { assert (pos < size && pos >= 0); while(pos > 0) { final int parent = (pos - 1) >>> 1; Object par = queue[parent]; if(comparator.compare(elem, par) >= 0) { break; } queue[pos] = par; pos = parent; } queue[pos] = elem; }
[ "protected", "void", "heapifyUp", "(", "int", "pos", ",", "E", "elem", ")", "{", "assert", "(", "pos", "<", "size", "&&", "pos", ">=", "0", ")", ";", "while", "(", "pos", ">", "0", ")", "{", "final", "int", "parent", "=", "(", "pos", "-", "1", ...
Execute a "Heapify Upwards" aka "SiftUp". Used in insertions. @param pos insertion position @param elem Element to insert
[ "Execute", "a", "Heapify", "Upwards", "aka", "SiftUp", ".", "Used", "in", "insertions", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/heap/Heap.java#L185-L198
twitter/hraven
hraven-core/src/main/java/com/twitter/hraven/util/StringUtil.java
StringUtil.buildParam
public static String buildParam(String paramName, List<String> paramArgs) throws IOException { StringBuilder sb = new StringBuilder(); for (String arg : paramArgs) { if (sb.length() > 0) { sb.append("&"); } sb.append(paramName).append("=").append(URLEncoder.encode(arg, "UTF-8")); } return sb.toString(); }
java
public static String buildParam(String paramName, List<String> paramArgs) throws IOException { StringBuilder sb = new StringBuilder(); for (String arg : paramArgs) { if (sb.length() > 0) { sb.append("&"); } sb.append(paramName).append("=").append(URLEncoder.encode(arg, "UTF-8")); } return sb.toString(); }
[ "public", "static", "String", "buildParam", "(", "String", "paramName", ",", "List", "<", "String", ">", "paramArgs", ")", "throws", "IOException", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "String", "arg", ":", "p...
builds up a String with the parameters for the filtering of fields @param paramName @param paramArgs @return String @throws IOException
[ "builds", "up", "a", "String", "with", "the", "parameters", "for", "the", "filtering", "of", "fields" ]
train
https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-core/src/main/java/com/twitter/hraven/util/StringUtil.java#L56-L66
emilsjolander/android-FlipView
library/src/se/emilsjolander/flipview/FlipView.java
FlipView.setDrawWithLayer
private void setDrawWithLayer(View v, boolean drawWithLayer) { if (isHardwareAccelerated()) { if (v.getLayerType() != LAYER_TYPE_HARDWARE && drawWithLayer) { v.setLayerType(LAYER_TYPE_HARDWARE, null); } else if (v.getLayerType() != LAYER_TYPE_NONE && !drawWithLayer) { v.setLayerType(LAYER_TYPE_NONE, null); } } }
java
private void setDrawWithLayer(View v, boolean drawWithLayer) { if (isHardwareAccelerated()) { if (v.getLayerType() != LAYER_TYPE_HARDWARE && drawWithLayer) { v.setLayerType(LAYER_TYPE_HARDWARE, null); } else if (v.getLayerType() != LAYER_TYPE_NONE && !drawWithLayer) { v.setLayerType(LAYER_TYPE_NONE, null); } } }
[ "private", "void", "setDrawWithLayer", "(", "View", "v", ",", "boolean", "drawWithLayer", ")", "{", "if", "(", "isHardwareAccelerated", "(", ")", ")", "{", "if", "(", "v", ".", "getLayerType", "(", ")", "!=", "LAYER_TYPE_HARDWARE", "&&", "drawWithLayer", ")"...
Enable a hardware layer for the view. @param v @param drawWithLayer
[ "Enable", "a", "hardware", "layer", "for", "the", "view", "." ]
train
https://github.com/emilsjolander/android-FlipView/blob/7dc0dbd37339dc9691934b60a1c2763b5ed29ffe/library/src/se/emilsjolander/flipview/FlipView.java#L875-L883
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/Config.java
Config.getMapMerkleTreeConfig
public MerkleTreeConfig getMapMerkleTreeConfig(String name) { return ConfigUtils.getConfig(configPatternMatcher, mapMerkleTreeConfigs, name, MerkleTreeConfig.class, new BiConsumer<MerkleTreeConfig, String>() { @Override public void accept(MerkleTreeConfig merkleTreeConfig, String name) { merkleTreeConfig.setMapName(name); if ("default".equals(name)) { merkleTreeConfig.setEnabled(false); } } }); }
java
public MerkleTreeConfig getMapMerkleTreeConfig(String name) { return ConfigUtils.getConfig(configPatternMatcher, mapMerkleTreeConfigs, name, MerkleTreeConfig.class, new BiConsumer<MerkleTreeConfig, String>() { @Override public void accept(MerkleTreeConfig merkleTreeConfig, String name) { merkleTreeConfig.setMapName(name); if ("default".equals(name)) { merkleTreeConfig.setEnabled(false); } } }); }
[ "public", "MerkleTreeConfig", "getMapMerkleTreeConfig", "(", "String", "name", ")", "{", "return", "ConfigUtils", ".", "getConfig", "(", "configPatternMatcher", ",", "mapMerkleTreeConfigs", ",", "name", ",", "MerkleTreeConfig", ".", "class", ",", "new", "BiConsumer", ...
Returns the map merkle tree config for the given name, creating one if necessary and adding it to the collection of known configurations. <p> The configuration is found by matching the configuration name pattern to the provided {@code name} without the partition qualifier (the part of the name after {@code '@'}). If no configuration matches, it will create one by cloning the {@code "default"} configuration and add it to the configuration collection. <p> If there is no default config as well, it will create one and disable the merkle tree by default. This method is intended to easily and fluently create and add configurations more specific than the default configuration without explicitly adding it by invoking {@link #addMerkleTreeConfig(MerkleTreeConfig)}. <p> Because it adds new configurations if they are not already present, this method is intended to be used before this config is used to create a hazelcast instance. Afterwards, newly added configurations may be ignored. @param name name of the map merkle tree config @return the map merkle tree configuration @throws ConfigurationException if ambiguous configurations are found @see StringPartitioningStrategy#getBaseName(java.lang.String) @see #setConfigPatternMatcher(ConfigPatternMatcher) @see #getConfigPatternMatcher()
[ "Returns", "the", "map", "merkle", "tree", "config", "for", "the", "given", "name", "creating", "one", "if", "necessary", "and", "adding", "it", "to", "the", "collection", "of", "known", "configurations", ".", "<p", ">", "The", "configuration", "is", "found"...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L2958-L2969
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/PropertiesUtils.java
PropertiesUtils.checkProperties
@SuppressWarnings("unchecked") public static void checkProperties(Properties properties, Properties defaults) { Set<String> names = Generics.newHashSet(); for (Enumeration<String> e = (Enumeration<String>) properties.propertyNames(); e.hasMoreElements(); ) { names.add(e.nextElement()); } for (Enumeration<String> e = (Enumeration<String>) defaults.propertyNames(); e.hasMoreElements(); ) { names.remove(e.nextElement()); } if (!names.isEmpty()) { if (names.size() == 1) { throw new IllegalArgumentException("Unknown property: " + names.iterator().next()); } else { throw new IllegalArgumentException("Unknown properties: " + names); } } }
java
@SuppressWarnings("unchecked") public static void checkProperties(Properties properties, Properties defaults) { Set<String> names = Generics.newHashSet(); for (Enumeration<String> e = (Enumeration<String>) properties.propertyNames(); e.hasMoreElements(); ) { names.add(e.nextElement()); } for (Enumeration<String> e = (Enumeration<String>) defaults.propertyNames(); e.hasMoreElements(); ) { names.remove(e.nextElement()); } if (!names.isEmpty()) { if (names.size() == 1) { throw new IllegalArgumentException("Unknown property: " + names.iterator().next()); } else { throw new IllegalArgumentException("Unknown properties: " + names); } } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "void", "checkProperties", "(", "Properties", "properties", ",", "Properties", "defaults", ")", "{", "Set", "<", "String", ">", "names", "=", "Generics", ".", "newHashSet", "(", ")", ";", ...
Checks to make sure that all properties specified in <code>properties</code> are known to the program by checking that each simply overrides a default value @param properties Current properties @param defaults Default properties which lists all known keys
[ "Checks", "to", "make", "sure", "that", "all", "properties", "specified", "in", "<code", ">", "properties<", "/", "code", ">", "are", "known", "to", "the", "program", "by", "checking", "that", "each", "simply", "overrides", "a", "default", "value" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/PropertiesUtils.java#L82-L100
elvishew/xLog
sample/src/main/java/com/elvishew/xlogsample/MainActivity.java
MainActivity.setEnabledStateOnViews
public static void setEnabledStateOnViews(View v, boolean enabled) { v.setEnabled(enabled); if (v instanceof ViewGroup) { final ViewGroup vg = (ViewGroup) v; for (int i = vg.getChildCount() - 1; i >= 0; i--) { setEnabledStateOnViews(vg.getChildAt(i), enabled); } } }
java
public static void setEnabledStateOnViews(View v, boolean enabled) { v.setEnabled(enabled); if (v instanceof ViewGroup) { final ViewGroup vg = (ViewGroup) v; for (int i = vg.getChildCount() - 1; i >= 0; i--) { setEnabledStateOnViews(vg.getChildAt(i), enabled); } } }
[ "public", "static", "void", "setEnabledStateOnViews", "(", "View", "v", ",", "boolean", "enabled", ")", "{", "v", ".", "setEnabled", "(", "enabled", ")", ";", "if", "(", "v", "instanceof", "ViewGroup", ")", "{", "final", "ViewGroup", "vg", "=", "(", "Vie...
Makes sure the view (and any children) get the enabled state changed.
[ "Makes", "sure", "the", "view", "(", "and", "any", "children", ")", "get", "the", "enabled", "state", "changed", "." ]
train
https://github.com/elvishew/xLog/blob/c6fb95555ce619d3e527f5ba6c45d4d247c5a838/sample/src/main/java/com/elvishew/xlogsample/MainActivity.java#L247-L256
Erudika/para
para-core/src/main/java/com/erudika/para/utils/Utils.java
Utils.formatDate
public static String formatDate(Long timestamp, String format, Locale loc) { if (StringUtils.isBlank(format)) { format = DateFormatUtils.ISO_8601_EXTENDED_DATE_FORMAT.getPattern(); } if (timestamp == null) { timestamp = timestamp(); } if (loc == null) { loc = Locale.US; } return DateFormatUtils.format(timestamp, format, loc); }
java
public static String formatDate(Long timestamp, String format, Locale loc) { if (StringUtils.isBlank(format)) { format = DateFormatUtils.ISO_8601_EXTENDED_DATE_FORMAT.getPattern(); } if (timestamp == null) { timestamp = timestamp(); } if (loc == null) { loc = Locale.US; } return DateFormatUtils.format(timestamp, format, loc); }
[ "public", "static", "String", "formatDate", "(", "Long", "timestamp", ",", "String", "format", ",", "Locale", "loc", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "format", ")", ")", "{", "format", "=", "DateFormatUtils", ".", "ISO_8601_EXTENDED_D...
Formats a date in a specific format. @param timestamp the Java timestamp @param format the date format @param loc the locale instance @return a formatted date
[ "Formats", "a", "date", "in", "a", "specific", "format", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/utils/Utils.java#L449-L460
alkacon/opencms-core
src-gwt/org/opencms/ade/publish/client/CmsPublishDataModel.java
CmsPublishDataModel.signalGroup
public void signalGroup(Signal signal, int groupNum) { CmsPublishGroup group = m_groups.get(groupNum); for (CmsPublishResource res : group.getResources()) { CmsUUID id = res.getId(); m_status.get(id).handleSignal(signal); } runSelectionChangeAction(); }
java
public void signalGroup(Signal signal, int groupNum) { CmsPublishGroup group = m_groups.get(groupNum); for (CmsPublishResource res : group.getResources()) { CmsUUID id = res.getId(); m_status.get(id).handleSignal(signal); } runSelectionChangeAction(); }
[ "public", "void", "signalGroup", "(", "Signal", "signal", ",", "int", "groupNum", ")", "{", "CmsPublishGroup", "group", "=", "m_groups", ".", "get", "(", "groupNum", ")", ";", "for", "(", "CmsPublishResource", "res", ":", "group", ".", "getResources", "(", ...
Sends a signal to all publish items in a given group.<p> @param signal the signal to send @param groupNum the group index
[ "Sends", "a", "signal", "to", "all", "publish", "items", "in", "a", "given", "group", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/publish/client/CmsPublishDataModel.java#L415-L423
FitLayout/segmentation
src/main/java/org/fit/segm/grouping/SegmentationAreaTree.java
SegmentationAreaTree.findStandaloneAreas
private void findStandaloneAreas(Box boxroot, Area arearoot) { if (boxroot.isVisible()) { for (int i = 0; i < boxroot.getChildCount(); i++) { Box child = boxroot.getChildAt(i); if (child.isVisible()) { if (isVisuallySeparated(child)) { Area newnode = new AreaImpl(child); if (newnode.getWidth() > 1 || newnode.getHeight() > 1) { findStandaloneAreas(child, newnode); arearoot.appendChild(newnode); } } else findStandaloneAreas(child, arearoot); } } } }
java
private void findStandaloneAreas(Box boxroot, Area arearoot) { if (boxroot.isVisible()) { for (int i = 0; i < boxroot.getChildCount(); i++) { Box child = boxroot.getChildAt(i); if (child.isVisible()) { if (isVisuallySeparated(child)) { Area newnode = new AreaImpl(child); if (newnode.getWidth() > 1 || newnode.getHeight() > 1) { findStandaloneAreas(child, newnode); arearoot.appendChild(newnode); } } else findStandaloneAreas(child, arearoot); } } } }
[ "private", "void", "findStandaloneAreas", "(", "Box", "boxroot", ",", "Area", "arearoot", ")", "{", "if", "(", "boxroot", ".", "isVisible", "(", ")", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "boxroot", ".", "getChildCount", "(", ")"...
Goes through a box tree and tries to identify the boxes that form standalone visual areas. From these boxes, new areas are created, which are added to the area tree. Other boxes are ignored. @param boxroot the root of the box tree @param arearoot the root node of the new area tree
[ "Goes", "through", "a", "box", "tree", "and", "tries", "to", "identify", "the", "boxes", "that", "form", "standalone", "visual", "areas", ".", "From", "these", "boxes", "new", "areas", "are", "created", "which", "are", "added", "to", "the", "area", "tree",...
train
https://github.com/FitLayout/segmentation/blob/12998087d576640c2f2a6360cf6088af95eea5f4/src/main/java/org/fit/segm/grouping/SegmentationAreaTree.java#L103-L126
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/rules/WorkflowEngineOperationsProcessor.java
WorkflowEngineOperationsProcessor.waitForChanges
private void waitForChanges(final Map<String, String> changes) throws InterruptedException { WorkflowSystem.OperationCompleted<DAT> take = stateChangeQueue.poll(sleeper.time(), sleeper.unit()); if (null == take || take.getNewState().getState().isEmpty()) { sleeper.backoff(); return; } sleeper.reset(); changes.putAll(take.getNewState().getState()); if (null != sharedData) { sharedData.addData(take.getResult()); } getAvailableChanges(changes); }
java
private void waitForChanges(final Map<String, String> changes) throws InterruptedException { WorkflowSystem.OperationCompleted<DAT> take = stateChangeQueue.poll(sleeper.time(), sleeper.unit()); if (null == take || take.getNewState().getState().isEmpty()) { sleeper.backoff(); return; } sleeper.reset(); changes.putAll(take.getNewState().getState()); if (null != sharedData) { sharedData.addData(take.getResult()); } getAvailableChanges(changes); }
[ "private", "void", "waitForChanges", "(", "final", "Map", "<", "String", ",", "String", ">", "changes", ")", "throws", "InterruptedException", "{", "WorkflowSystem", ".", "OperationCompleted", "<", "DAT", ">", "take", "=", "stateChangeQueue", ".", "poll", "(", ...
Sleep until changes are available on the queue, if any are found then consume remaining and return false, otherwise return true @param changes @return true if no changes found in the sleep time. @throws InterruptedException
[ "Sleep", "until", "changes", "are", "available", "on", "the", "queue", "if", "any", "are", "found", "then", "consume", "remaining", "and", "return", "false", "otherwise", "return", "true" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/rules/WorkflowEngineOperationsProcessor.java#L289-L305
banq/jdonframework
src/main/java/com/jdon/util/FileUtil.java
FileUtil.CopyDir
public static void CopyDir(String sourcedir, String destdir) throws Exception { File dest = new File(destdir); File source = new File(sourcedir); String[] files = source.list(); try { makehome(destdir); } catch (Exception ex) { throw new Exception("CopyDir:" + ex.getMessage()); } for (int i = 0; i < files.length; i++) { String sourcefile = source + File.separator + files[i]; String destfile = dest + File.separator + files[i]; File temp = new File(sourcefile); if (temp.isFile()) { try { copy(sourcefile, destfile); } catch (Exception ex) { throw new Exception("CopyDir:" + ex.getMessage()); } } } }
java
public static void CopyDir(String sourcedir, String destdir) throws Exception { File dest = new File(destdir); File source = new File(sourcedir); String[] files = source.list(); try { makehome(destdir); } catch (Exception ex) { throw new Exception("CopyDir:" + ex.getMessage()); } for (int i = 0; i < files.length; i++) { String sourcefile = source + File.separator + files[i]; String destfile = dest + File.separator + files[i]; File temp = new File(sourcefile); if (temp.isFile()) { try { copy(sourcefile, destfile); } catch (Exception ex) { throw new Exception("CopyDir:" + ex.getMessage()); } } } }
[ "public", "static", "void", "CopyDir", "(", "String", "sourcedir", ",", "String", "destdir", ")", "throws", "Exception", "{", "File", "dest", "=", "new", "File", "(", "destdir", ")", ";", "File", "source", "=", "new", "File", "(", "sourcedir", ")", ";", ...
This class copies an input files of a directory to another directory not include subdir @param String sourcedir the directory to copy from such as:/home/bqlr/images @param String destdir the target directory
[ "This", "class", "copies", "an", "input", "files", "of", "a", "directory", "to", "another", "directory", "not", "include", "subdir" ]
train
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/FileUtil.java#L166-L189
Impetus/Kundera
src/kundera-hbase/kundera-hbase/src/main/java/com/impetus/client/hbase/query/HBaseQuery.java
HBaseQuery.onQuery
private List onQuery(EntityMetadata m, Client client) { // Called only in case of standalone entity. QueryTranslator translator = new QueryTranslator(); translator.translate(getKunderaQuery(), m, ((ClientBase) client).getClientMetadata()); // start with 1 as first element is alias. List<String> columns = getTranslatedColumns(m, getKunderaQuery().getResult(), 1); Filter filter = translator.getFilter(); if (translator.rowList != null && !translator.rowList.isEmpty()) { return ((HBaseClient) client).findAll(m.getEntityClazz(), columns.toArray(new String[columns.size()]), translator.getRowList()); } if (!translator.isWhereQuery() && columns != null) { return ((HBaseClient) client).findByRange(m.getEntityClazz(), m, translator.getStartRow(), translator .getEndRow(), columns.toArray(new String[columns.size()]), null, getKunderaQuery() .getFilterClauseQueue()); } if (MetadataUtils.useSecondryIndex(((ClientBase) client).getClientMetadata())) { // if range query. means query over id column. create range // scan method. // else setFilter to client and invoke new method. find by // query if isFindById is false! else invoke findById if (translator.isWhereQuery() && !translator.isRangeScan()) { return ((HBaseClient) client).findByQuery(m.getEntityClazz(), m, filter, getKunderaQuery() .getFilterClauseQueue(), columns.toArray(new String[columns.size()])); } else { return ((HBaseClient) client).findByRange(m.getEntityClazz(), m, translator.getStartRow(), translator .getEndRow(), columns.toArray(new String[columns.size()]), filter, getKunderaQuery() .getFilterClauseQueue()); } } else { return populateUsingLucene(m, client, null, null); } }
java
private List onQuery(EntityMetadata m, Client client) { // Called only in case of standalone entity. QueryTranslator translator = new QueryTranslator(); translator.translate(getKunderaQuery(), m, ((ClientBase) client).getClientMetadata()); // start with 1 as first element is alias. List<String> columns = getTranslatedColumns(m, getKunderaQuery().getResult(), 1); Filter filter = translator.getFilter(); if (translator.rowList != null && !translator.rowList.isEmpty()) { return ((HBaseClient) client).findAll(m.getEntityClazz(), columns.toArray(new String[columns.size()]), translator.getRowList()); } if (!translator.isWhereQuery() && columns != null) { return ((HBaseClient) client).findByRange(m.getEntityClazz(), m, translator.getStartRow(), translator .getEndRow(), columns.toArray(new String[columns.size()]), null, getKunderaQuery() .getFilterClauseQueue()); } if (MetadataUtils.useSecondryIndex(((ClientBase) client).getClientMetadata())) { // if range query. means query over id column. create range // scan method. // else setFilter to client and invoke new method. find by // query if isFindById is false! else invoke findById if (translator.isWhereQuery() && !translator.isRangeScan()) { return ((HBaseClient) client).findByQuery(m.getEntityClazz(), m, filter, getKunderaQuery() .getFilterClauseQueue(), columns.toArray(new String[columns.size()])); } else { return ((HBaseClient) client).findByRange(m.getEntityClazz(), m, translator.getStartRow(), translator .getEndRow(), columns.toArray(new String[columns.size()]), filter, getKunderaQuery() .getFilterClauseQueue()); } } else { return populateUsingLucene(m, client, null, null); } }
[ "private", "List", "onQuery", "(", "EntityMetadata", "m", ",", "Client", "client", ")", "{", "// Called only in case of standalone entity.", "QueryTranslator", "translator", "=", "new", "QueryTranslator", "(", ")", ";", "translator", ".", "translate", "(", "getKundera...
Parses and translates query into HBase filter and invokes client's method to return list of entities. @param m Entity metadata @param client hbase client @return list of entities.
[ "Parses", "and", "translates", "query", "into", "HBase", "filter", "and", "invokes", "client", "s", "method", "to", "return", "list", "of", "entities", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-hbase/kundera-hbase/src/main/java/com/impetus/client/hbase/query/HBaseQuery.java#L152-L195
aoindustries/ao-encoding
src/main/java/com/aoindustries/encoding/MediaValidator.java
MediaValidator.getMediaValidator
public static MediaValidator getMediaValidator(MediaType contentType, Writer out) throws MediaException { // If the existing out is already validating for this type, use it. // This occurs when one validation validates to a set of characters that are a subset of the requested validator. // For example, a URL is always valid TEXT. if(out instanceof MediaValidator) { MediaValidator inputValidator = (MediaValidator)out; if(inputValidator.isValidatingMediaInputType(contentType)) return inputValidator; } // Add filter if needed for the given type switch(contentType) { case JAVASCRIPT: case JSON: case LD_JSON: return new JavaScriptValidator(out, contentType); case SH: return new ShValidator(out); case MYSQL: return new MysqlValidator(out); case PSQL: return new PsqlValidator(out); case TEXT: return new TextValidator(out); case URL: return new UrlValidator(out); case XHTML: return new XhtmlValidator(out); case XHTML_ATTRIBUTE: return new XhtmlAttributeValidator(out); default: throw new MediaException(ApplicationResources.accessor.getMessage("MediaValidator.unableToFindValidator", contentType.getContentType())); } }
java
public static MediaValidator getMediaValidator(MediaType contentType, Writer out) throws MediaException { // If the existing out is already validating for this type, use it. // This occurs when one validation validates to a set of characters that are a subset of the requested validator. // For example, a URL is always valid TEXT. if(out instanceof MediaValidator) { MediaValidator inputValidator = (MediaValidator)out; if(inputValidator.isValidatingMediaInputType(contentType)) return inputValidator; } // Add filter if needed for the given type switch(contentType) { case JAVASCRIPT: case JSON: case LD_JSON: return new JavaScriptValidator(out, contentType); case SH: return new ShValidator(out); case MYSQL: return new MysqlValidator(out); case PSQL: return new PsqlValidator(out); case TEXT: return new TextValidator(out); case URL: return new UrlValidator(out); case XHTML: return new XhtmlValidator(out); case XHTML_ATTRIBUTE: return new XhtmlAttributeValidator(out); default: throw new MediaException(ApplicationResources.accessor.getMessage("MediaValidator.unableToFindValidator", contentType.getContentType())); } }
[ "public", "static", "MediaValidator", "getMediaValidator", "(", "MediaType", "contentType", ",", "Writer", "out", ")", "throws", "MediaException", "{", "// If the existing out is already validating for this type, use it.", "// This occurs when one validation validates to a set of chara...
Gets the media validator for the given type. If the given writer is already validator for the requested type, will return the provided writer. @exception MediaException when unable to find an appropriate validator.
[ "Gets", "the", "media", "validator", "for", "the", "given", "type", ".", "If", "the", "given", "writer", "is", "already", "validator", "for", "the", "requested", "type", "will", "return", "the", "provided", "writer", "." ]
train
https://github.com/aoindustries/ao-encoding/blob/54eeb8ff58ab7b44bb02549bbe2572625b449e4e/src/main/java/com/aoindustries/encoding/MediaValidator.java#L42-L73
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/task/TaskUtils.java
TaskUtils.setTaskFactoryClass
public static void setTaskFactoryClass(State state, Class<? extends TaskFactory> klazz) { state.setProp(TASK_FACTORY_CLASS, klazz.getName()); }
java
public static void setTaskFactoryClass(State state, Class<? extends TaskFactory> klazz) { state.setProp(TASK_FACTORY_CLASS, klazz.getName()); }
[ "public", "static", "void", "setTaskFactoryClass", "(", "State", "state", ",", "Class", "<", "?", "extends", "TaskFactory", ">", "klazz", ")", "{", "state", ".", "setProp", "(", "TASK_FACTORY_CLASS", ",", "klazz", ".", "getName", "(", ")", ")", ";", "}" ]
Define the {@link TaskFactory} that should be used to run this task.
[ "Define", "the", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/task/TaskUtils.java#L50-L52
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/parallel/ParallelIterate.java
ParallelIterate.newPooledExecutor
public static ExecutorService newPooledExecutor(int newPoolSize, String poolName, boolean useDaemonThreads) { return new ThreadPoolExecutor( newPoolSize, newPoolSize, 0L, TimeUnit.MILLISECONDS, new SynchronousQueue<Runnable>(), new CollectionsThreadFactory(poolName, useDaemonThreads), new ThreadPoolExecutor.CallerRunsPolicy()); }
java
public static ExecutorService newPooledExecutor(int newPoolSize, String poolName, boolean useDaemonThreads) { return new ThreadPoolExecutor( newPoolSize, newPoolSize, 0L, TimeUnit.MILLISECONDS, new SynchronousQueue<Runnable>(), new CollectionsThreadFactory(poolName, useDaemonThreads), new ThreadPoolExecutor.CallerRunsPolicy()); }
[ "public", "static", "ExecutorService", "newPooledExecutor", "(", "int", "newPoolSize", ",", "String", "poolName", ",", "boolean", "useDaemonThreads", ")", "{", "return", "new", "ThreadPoolExecutor", "(", "newPoolSize", ",", "newPoolSize", ",", "0L", ",", "TimeUnit",...
Returns a brand new ExecutorService using the specified poolName with the specified maximum thread pool size. The same poolName may be used more than once resulting in multiple pools with the same name. <p> The pool will be initialised with newPoolSize threads. If that number of threads are in use and another thread is requested, the pool will reject execution and the submitting thread will execute the task.
[ "Returns", "a", "brand", "new", "ExecutorService", "using", "the", "specified", "poolName", "with", "the", "specified", "maximum", "thread", "pool", "size", ".", "The", "same", "poolName", "may", "be", "used", "more", "than", "once", "resulting", "in", "multip...
train
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/parallel/ParallelIterate.java#L1344-L1354
app55/app55-java
src/main/java/com/app55/util/Base64.java
Base64.decodeFromFile
public static byte[] decodeFromFile(String filename) { byte[] decodedData = null; Base64.InputStream bis = null; try { // Set up some useful variables java.io.File file = new java.io.File(filename); byte[] buffer = null; int length = 0; int numBytes = 0; // Check for size of file if (file.length() > Integer.MAX_VALUE) { return null; } // end if: file too big for int index buffer = new byte[(int) file.length()]; // Open a stream bis = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(file)), Base64.DECODE); // Read until done while ((numBytes = bis.read(buffer, length, 4096)) >= 0) length += numBytes; // Save in a variable to return decodedData = new byte[length]; System.arraycopy(buffer, 0, decodedData, 0, length); } // end try catch (java.io.IOException e) { } // end catch: IOException finally { try { if (bis != null) bis.close(); } catch (Exception e) { } } // end finally return decodedData; }
java
public static byte[] decodeFromFile(String filename) { byte[] decodedData = null; Base64.InputStream bis = null; try { // Set up some useful variables java.io.File file = new java.io.File(filename); byte[] buffer = null; int length = 0; int numBytes = 0; // Check for size of file if (file.length() > Integer.MAX_VALUE) { return null; } // end if: file too big for int index buffer = new byte[(int) file.length()]; // Open a stream bis = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(file)), Base64.DECODE); // Read until done while ((numBytes = bis.read(buffer, length, 4096)) >= 0) length += numBytes; // Save in a variable to return decodedData = new byte[length]; System.arraycopy(buffer, 0, decodedData, 0, length); } // end try catch (java.io.IOException e) { } // end catch: IOException finally { try { if (bis != null) bis.close(); } catch (Exception e) { } } // end finally return decodedData; }
[ "public", "static", "byte", "[", "]", "decodeFromFile", "(", "String", "filename", ")", "{", "byte", "[", "]", "decodedData", "=", "null", ";", "Base64", ".", "InputStream", "bis", "=", "null", ";", "try", "{", "// Set up some useful variables", "java", ".",...
Convenience method for reading a base64-encoded file and decoding it. @param filename Filename for reading encoded data @return decoded byte array or null if unsuccessful @since 2.1
[ "Convenience", "method", "for", "reading", "a", "base64", "-", "encoded", "file", "and", "decoding", "it", "." ]
train
https://github.com/app55/app55-java/blob/73e51d0f3141a859dfbd37ca9becef98477e553e/src/main/java/com/app55/util/Base64.java#L1185-L1232
looly/hutool
hutool-core/src/main/java/cn/hutool/core/exceptions/ExceptionUtil.java
ExceptionUtil.stacktraceToString
public static String stacktraceToString(Throwable throwable, int limit, Map<Character, String> replaceCharToStrMap) { final FastByteArrayOutputStream baos = new FastByteArrayOutputStream(); throwable.printStackTrace(new PrintStream(baos)); String exceptionStr = baos.toString(); int length = exceptionStr.length(); if (limit > 0 && limit < length) { length = limit; } if (CollectionUtil.isNotEmpty(replaceCharToStrMap)) { final StringBuilder sb = StrUtil.builder(); char c; String value; for (int i = 0; i < length; i++) { c = exceptionStr.charAt(i); value = replaceCharToStrMap.get(c); if (null != value) { sb.append(value); } else { sb.append(c); } } return sb.toString(); } else { return StrUtil.subPre(exceptionStr, limit); } }
java
public static String stacktraceToString(Throwable throwable, int limit, Map<Character, String> replaceCharToStrMap) { final FastByteArrayOutputStream baos = new FastByteArrayOutputStream(); throwable.printStackTrace(new PrintStream(baos)); String exceptionStr = baos.toString(); int length = exceptionStr.length(); if (limit > 0 && limit < length) { length = limit; } if (CollectionUtil.isNotEmpty(replaceCharToStrMap)) { final StringBuilder sb = StrUtil.builder(); char c; String value; for (int i = 0; i < length; i++) { c = exceptionStr.charAt(i); value = replaceCharToStrMap.get(c); if (null != value) { sb.append(value); } else { sb.append(c); } } return sb.toString(); } else { return StrUtil.subPre(exceptionStr, limit); } }
[ "public", "static", "String", "stacktraceToString", "(", "Throwable", "throwable", ",", "int", "limit", ",", "Map", "<", "Character", ",", "String", ">", "replaceCharToStrMap", ")", "{", "final", "FastByteArrayOutputStream", "baos", "=", "new", "FastByteArrayOutputS...
堆栈转为完整字符串 @param throwable 异常对象 @param limit 限制最大长度 @param replaceCharToStrMap 替换字符为指定字符串 @return 堆栈转为的字符串
[ "堆栈转为完整字符串" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/exceptions/ExceptionUtil.java#L185-L211
luuuis/jcalendar
src/main/java/com/toedter/calendar/JTextFieldDateEditor.java
JTextFieldDateEditor.setDate
protected void setDate(Date date, boolean firePropertyChange) { Date oldDate = this.date; this.date = date; if (date == null) { setText(""); } else { String formattedDate = dateFormatter.format(date); try { setText(formattedDate); } catch (RuntimeException e) { e.printStackTrace(); } } if (date != null && dateUtil.checkDate(date)) { setForeground(Color.BLACK); } if (firePropertyChange) { firePropertyChange("date", oldDate, date); } }
java
protected void setDate(Date date, boolean firePropertyChange) { Date oldDate = this.date; this.date = date; if (date == null) { setText(""); } else { String formattedDate = dateFormatter.format(date); try { setText(formattedDate); } catch (RuntimeException e) { e.printStackTrace(); } } if (date != null && dateUtil.checkDate(date)) { setForeground(Color.BLACK); } if (firePropertyChange) { firePropertyChange("date", oldDate, date); } }
[ "protected", "void", "setDate", "(", "Date", "date", ",", "boolean", "firePropertyChange", ")", "{", "Date", "oldDate", "=", "this", ".", "date", ";", "this", ".", "date", "=", "date", ";", "if", "(", "date", "==", "null", ")", "{", "setText", "(", "...
Sets the date. @param date the date @param firePropertyChange true, if the date property should be fired.
[ "Sets", "the", "date", "." ]
train
https://github.com/luuuis/jcalendar/blob/442e5bc319d92dee93400e6180ca74a5b6bd7775/src/main/java/com/toedter/calendar/JTextFieldDateEditor.java#L151-L173
mozilla/rhino
src/org/mozilla/javascript/Parser.java
Parser.xmlElemRef
private XmlElemRef xmlElemRef(int atPos, Name namespace, int colonPos) throws IOException { int lb = ts.tokenBeg, rb = -1, pos = atPos != -1 ? atPos : lb; AstNode expr = expr(); int end = getNodeEnd(expr); if (mustMatchToken(Token.RB, "msg.no.bracket.index", true)) { rb = ts.tokenBeg; end = ts.tokenEnd; } XmlElemRef ref = new XmlElemRef(pos, end - pos); ref.setNamespace(namespace); ref.setColonPos(colonPos); ref.setAtPos(atPos); ref.setExpression(expr); ref.setBrackets(lb, rb); return ref; }
java
private XmlElemRef xmlElemRef(int atPos, Name namespace, int colonPos) throws IOException { int lb = ts.tokenBeg, rb = -1, pos = atPos != -1 ? atPos : lb; AstNode expr = expr(); int end = getNodeEnd(expr); if (mustMatchToken(Token.RB, "msg.no.bracket.index", true)) { rb = ts.tokenBeg; end = ts.tokenEnd; } XmlElemRef ref = new XmlElemRef(pos, end - pos); ref.setNamespace(namespace); ref.setColonPos(colonPos); ref.setAtPos(atPos); ref.setExpression(expr); ref.setBrackets(lb, rb); return ref; }
[ "private", "XmlElemRef", "xmlElemRef", "(", "int", "atPos", ",", "Name", "namespace", ",", "int", "colonPos", ")", "throws", "IOException", "{", "int", "lb", "=", "ts", ".", "tokenBeg", ",", "rb", "=", "-", "1", ",", "pos", "=", "atPos", "!=", "-", "...
Parse the [expr] portion of an xml element reference, e.g. @[expr], @*::[expr], or ns::[expr].
[ "Parse", "the", "[", "expr", "]", "portion", "of", "an", "xml", "element", "reference", "e", ".", "g", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Parser.java#L3067-L3084
BioPAX/Paxtools
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/InterToPartER.java
InterToPartER.generate
@Override public Collection<BioPAXElement> generate(Match match, int... ind) { Interaction inter = (Interaction) match.get(ind[0]); Set<Entity> taboo = new HashSet<Entity>(); for (int i = 1; i < getVariableSize() - 1; i++) { taboo.add((Entity) match.get(ind[i])); } if (direction == null) return generate(inter, taboo); else return generate((Conversion) inter, direction, taboo); }
java
@Override public Collection<BioPAXElement> generate(Match match, int... ind) { Interaction inter = (Interaction) match.get(ind[0]); Set<Entity> taboo = new HashSet<Entity>(); for (int i = 1; i < getVariableSize() - 1; i++) { taboo.add((Entity) match.get(ind[i])); } if (direction == null) return generate(inter, taboo); else return generate((Conversion) inter, direction, taboo); }
[ "@", "Override", "public", "Collection", "<", "BioPAXElement", ">", "generate", "(", "Match", "match", ",", "int", "...", "ind", ")", "{", "Interaction", "inter", "=", "(", "Interaction", ")", "match", ".", "get", "(", "ind", "[", "0", "]", ")", ";", ...
Iterated over non-taboo participants and collectes related ER. @param match current pattern match @param ind mapped indices @return related participants
[ "Iterated", "over", "non", "-", "taboo", "participants", "and", "collectes", "related", "ER", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/InterToPartER.java#L106-L120
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/protocols/payments/PaymentSession.java
PaymentSession.createFromUrl
public static ListenableFuture<PaymentSession> createFromUrl(final String url) throws PaymentProtocolException { return createFromUrl(url, true, null); }
java
public static ListenableFuture<PaymentSession> createFromUrl(final String url) throws PaymentProtocolException { return createFromUrl(url, true, null); }
[ "public", "static", "ListenableFuture", "<", "PaymentSession", ">", "createFromUrl", "(", "final", "String", "url", ")", "throws", "PaymentProtocolException", "{", "return", "createFromUrl", "(", "url", ",", "true", ",", "null", ")", ";", "}" ]
Returns a future that will be notified with a PaymentSession object after it is fetched using the provided url. url is an address where the {@link Protos.PaymentRequest} object may be fetched. If verifyPki is specified and the payment request object specifies a PKI method, then the system trust store will be used to verify the signature provided by the payment request. An exception is thrown by the future if the signature cannot be verified.
[ "Returns", "a", "future", "that", "will", "be", "notified", "with", "a", "PaymentSession", "object", "after", "it", "is", "fetched", "using", "the", "provided", "url", ".", "url", "is", "an", "address", "where", "the", "{" ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/payments/PaymentSession.java#L138-L140
apache/groovy
src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java
StaticTypeCheckingSupport.collectAllInterfaces
private static void collectAllInterfaces(final ClassNode node, final Set<ClassNode> out) { if (node == null) return; Set<ClassNode> allInterfaces = node.getAllInterfaces(); out.addAll(allInterfaces); collectAllInterfaces(node.getSuperClass(), out); }
java
private static void collectAllInterfaces(final ClassNode node, final Set<ClassNode> out) { if (node == null) return; Set<ClassNode> allInterfaces = node.getAllInterfaces(); out.addAll(allInterfaces); collectAllInterfaces(node.getSuperClass(), out); }
[ "private", "static", "void", "collectAllInterfaces", "(", "final", "ClassNode", "node", ",", "final", "Set", "<", "ClassNode", ">", "out", ")", "{", "if", "(", "node", "==", "null", ")", "return", ";", "Set", "<", "ClassNode", ">", "allInterfaces", "=", ...
Collects all interfaces of a class node, including those defined by the super class. @param node a class for which we want to retrieve all interfaces @param out the set where to collect interfaces
[ "Collects", "all", "interfaces", "of", "a", "class", "node", "including", "those", "defined", "by", "the", "super", "class", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java#L2509-L2514
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/security/BESecurityConfig.java
BESecurityConfig.toStream
public void toStream(boolean skipNonOverrides, OutputStream out) throws Exception { PrintWriter writer = null; try { writer = new PrintWriter(new OutputStreamWriter(out, "UTF-8")); write(skipNonOverrides, true, writer); } finally { try { writer.close(); } catch (Throwable th) { } try { out.close(); } catch (Throwable th) { } } }
java
public void toStream(boolean skipNonOverrides, OutputStream out) throws Exception { PrintWriter writer = null; try { writer = new PrintWriter(new OutputStreamWriter(out, "UTF-8")); write(skipNonOverrides, true, writer); } finally { try { writer.close(); } catch (Throwable th) { } try { out.close(); } catch (Throwable th) { } } }
[ "public", "void", "toStream", "(", "boolean", "skipNonOverrides", ",", "OutputStream", "out", ")", "throws", "Exception", "{", "PrintWriter", "writer", "=", "null", ";", "try", "{", "writer", "=", "new", "PrintWriter", "(", "new", "OutputStreamWriter", "(", "o...
Serialize to the given stream, closing it when finished. If skipNonOverrides is true, any configuration whose values are all null will not be written.
[ "Serialize", "to", "the", "given", "stream", "closing", "it", "when", "finished", ".", "If", "skipNonOverrides", "is", "true", "any", "configuration", "whose", "values", "are", "all", "null", "will", "not", "be", "written", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/security/BESecurityConfig.java#L440-L456
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/FileSystem.java
FileSystem.listLocatedStatus
@Deprecated public RemoteIterator<LocatedFileStatus> listLocatedStatus(final Path f) throws FileNotFoundException, IOException { return listLocatedStatus(f, DEFAULT_FILTER); }
java
@Deprecated public RemoteIterator<LocatedFileStatus> listLocatedStatus(final Path f) throws FileNotFoundException, IOException { return listLocatedStatus(f, DEFAULT_FILTER); }
[ "@", "Deprecated", "public", "RemoteIterator", "<", "LocatedFileStatus", ">", "listLocatedStatus", "(", "final", "Path", "f", ")", "throws", "FileNotFoundException", ",", "IOException", "{", "return", "listLocatedStatus", "(", "f", ",", "DEFAULT_FILTER", ")", ";", ...
List the statuses of the files/directories in the given path if the path is a directory. Return the file's status and block locations If the path is a file. If a returned status is a file, it contains the file's block locations. @param f is the path @return an iterator that traverses statuses of the files/directories in the given path @throws FileNotFoundException If <code>f</code> does not exist @throws IOException If an I/O error occurred
[ "List", "the", "statuses", "of", "the", "files", "/", "directories", "in", "the", "given", "path", "if", "the", "path", "is", "a", "directory", ".", "Return", "the", "file", "s", "status", "and", "block", "locations", "If", "the", "path", "is", "a", "f...
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L1042-L1046
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/servlet/ServletMapPrinterFactory.java
ServletMapPrinterFactory.setConfigurationFiles
public final void setConfigurationFiles(final Map<String, String> configurationFiles) throws URISyntaxException { this.configurationFiles.clear(); this.configurationFileLastModifiedTimes.clear(); for (Map.Entry<String, String> entry: configurationFiles.entrySet()) { if (!entry.getValue().contains(":/")) { // assume is a file this.configurationFiles.put(entry.getKey(), new File(entry.getValue()).toURI()); } else { this.configurationFiles.put(entry.getKey(), new URI(entry.getValue())); } } if (this.configFileLoader != null) { this.validateConfigurationFiles(); } }
java
public final void setConfigurationFiles(final Map<String, String> configurationFiles) throws URISyntaxException { this.configurationFiles.clear(); this.configurationFileLastModifiedTimes.clear(); for (Map.Entry<String, String> entry: configurationFiles.entrySet()) { if (!entry.getValue().contains(":/")) { // assume is a file this.configurationFiles.put(entry.getKey(), new File(entry.getValue()).toURI()); } else { this.configurationFiles.put(entry.getKey(), new URI(entry.getValue())); } } if (this.configFileLoader != null) { this.validateConfigurationFiles(); } }
[ "public", "final", "void", "setConfigurationFiles", "(", "final", "Map", "<", "String", ",", "String", ">", "configurationFiles", ")", "throws", "URISyntaxException", "{", "this", ".", "configurationFiles", ".", "clear", "(", ")", ";", "this", ".", "configuratio...
The setter for setting configuration file. It will convert the value to a URI. @param configurationFiles the configuration file map.
[ "The", "setter", "for", "setting", "configuration", "file", ".", "It", "will", "convert", "the", "value", "to", "a", "URI", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/servlet/ServletMapPrinterFactory.java#L149-L165
apereo/cas
core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java
AbstractCasWebflowConfigurer.prependActionsToActionStateExecutionList
public void prependActionsToActionStateExecutionList(final Flow flow, final ActionState actionStateId, final String... actions) { prependActionsToActionStateExecutionList(flow, actionStateId.getId(), actions); }
java
public void prependActionsToActionStateExecutionList(final Flow flow, final ActionState actionStateId, final String... actions) { prependActionsToActionStateExecutionList(flow, actionStateId.getId(), actions); }
[ "public", "void", "prependActionsToActionStateExecutionList", "(", "final", "Flow", "flow", ",", "final", "ActionState", "actionStateId", ",", "final", "String", "...", "actions", ")", "{", "prependActionsToActionStateExecutionList", "(", "flow", ",", "actionStateId", "...
Prepend actions to action state execution list. @param flow the flow @param actionStateId the action state id @param actions the actions
[ "Prepend", "actions", "to", "action", "state", "execution", "list", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java#L797-L799
indeedeng/proctor
proctor-consumer/src/main/java/com/indeed/proctor/consumer/spring/SampleRandomGroupsHttpHandler.java
SampleRandomGroupsHttpHandler.runSampling
private Map<String, Integer> runSampling( final ProctorContext proctorContext, final Set<String> targetTestNames, final TestType testType, final int determinationsToRun ) { final Set<String> targetTestGroups = getTargetTestGroups(targetTestNames); final Map<String, Integer> testGroupToOccurrences = Maps.newTreeMap(); for (final String testGroup : targetTestGroups) { testGroupToOccurrences.put(testGroup, 0); } for (int i = 0; i < determinationsToRun; ++i) { final Identifiers identifiers = TestType.RANDOM.equals(testType) ? new Identifiers(Collections.<TestType, String>emptyMap(), /* randomEnabled */ true) : Identifiers.of(testType, Long.toString(random.nextLong())); final AbstractGroups groups = supplier.getRandomGroups(proctorContext, identifiers); for (final Entry<String, TestBucket> e : groups.getProctorResult().getBuckets().entrySet()) { final String testName = e.getKey(); if (targetTestNames.contains(testName)) { final int group = e.getValue().getValue(); final String testGroup = testName + group; testGroupToOccurrences.put(testGroup, testGroupToOccurrences.get(testGroup) + 1); } } } return testGroupToOccurrences; }
java
private Map<String, Integer> runSampling( final ProctorContext proctorContext, final Set<String> targetTestNames, final TestType testType, final int determinationsToRun ) { final Set<String> targetTestGroups = getTargetTestGroups(targetTestNames); final Map<String, Integer> testGroupToOccurrences = Maps.newTreeMap(); for (final String testGroup : targetTestGroups) { testGroupToOccurrences.put(testGroup, 0); } for (int i = 0; i < determinationsToRun; ++i) { final Identifiers identifiers = TestType.RANDOM.equals(testType) ? new Identifiers(Collections.<TestType, String>emptyMap(), /* randomEnabled */ true) : Identifiers.of(testType, Long.toString(random.nextLong())); final AbstractGroups groups = supplier.getRandomGroups(proctorContext, identifiers); for (final Entry<String, TestBucket> e : groups.getProctorResult().getBuckets().entrySet()) { final String testName = e.getKey(); if (targetTestNames.contains(testName)) { final int group = e.getValue().getValue(); final String testGroup = testName + group; testGroupToOccurrences.put(testGroup, testGroupToOccurrences.get(testGroup) + 1); } } } return testGroupToOccurrences; }
[ "private", "Map", "<", "String", ",", "Integer", ">", "runSampling", "(", "final", "ProctorContext", "proctorContext", ",", "final", "Set", "<", "String", ">", "targetTestNames", ",", "final", "TestType", "testType", ",", "final", "int", "determinationsToRun", "...
test, how many times the group was present in the list of groups.
[ "test", "how", "many", "times", "the", "group", "was", "present", "in", "the", "list", "of", "groups", "." ]
train
https://github.com/indeedeng/proctor/blob/b7795acfc26a30d013655d0e0fa1d3f8d0576571/proctor-consumer/src/main/java/com/indeed/proctor/consumer/spring/SampleRandomGroupsHttpHandler.java#L143-L171
prestodb/presto
presto-orc/src/main/java/com/facebook/presto/orc/TupleDomainOrcPredicate.java
TupleDomainOrcPredicate.checkInBloomFilter
@VisibleForTesting public static boolean checkInBloomFilter(BloomFilter bloomFilter, Object predicateValue, Type sqlType) { if (sqlType == TINYINT || sqlType == SMALLINT || sqlType == INTEGER || sqlType == BIGINT) { return bloomFilter.testLong(((Number) predicateValue).longValue()); } if (sqlType == DOUBLE) { return bloomFilter.testDouble((Double) predicateValue); } if (sqlType instanceof VarcharType || sqlType instanceof VarbinaryType) { return bloomFilter.test(((Slice) predicateValue).getBytes()); } // todo support DECIMAL, FLOAT, DATE, TIMESTAMP, and CHAR return true; }
java
@VisibleForTesting public static boolean checkInBloomFilter(BloomFilter bloomFilter, Object predicateValue, Type sqlType) { if (sqlType == TINYINT || sqlType == SMALLINT || sqlType == INTEGER || sqlType == BIGINT) { return bloomFilter.testLong(((Number) predicateValue).longValue()); } if (sqlType == DOUBLE) { return bloomFilter.testDouble((Double) predicateValue); } if (sqlType instanceof VarcharType || sqlType instanceof VarbinaryType) { return bloomFilter.test(((Slice) predicateValue).getBytes()); } // todo support DECIMAL, FLOAT, DATE, TIMESTAMP, and CHAR return true; }
[ "@", "VisibleForTesting", "public", "static", "boolean", "checkInBloomFilter", "(", "BloomFilter", "bloomFilter", ",", "Object", "predicateValue", ",", "Type", "sqlType", ")", "{", "if", "(", "sqlType", "==", "TINYINT", "||", "sqlType", "==", "SMALLINT", "||", "...
checks whether a value part of the effective predicate is likely to be part of this bloom filter
[ "checks", "whether", "a", "value", "part", "of", "the", "effective", "predicate", "is", "likely", "to", "be", "part", "of", "this", "bloom", "filter" ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-orc/src/main/java/com/facebook/presto/orc/TupleDomainOrcPredicate.java#L162-L179
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/Transaction.java
Transaction.addOutput
public TransactionOutput addOutput(Coin value, ECKey pubkey) { return addOutput(new TransactionOutput(params, this, value, pubkey)); }
java
public TransactionOutput addOutput(Coin value, ECKey pubkey) { return addOutput(new TransactionOutput(params, this, value, pubkey)); }
[ "public", "TransactionOutput", "addOutput", "(", "Coin", "value", ",", "ECKey", "pubkey", ")", "{", "return", "addOutput", "(", "new", "TransactionOutput", "(", "params", ",", "this", ",", "value", ",", "pubkey", ")", ")", ";", "}" ]
Creates an output that pays to the given pubkey directly (no address) with the given value, adds it to this transaction, and returns the new output.
[ "Creates", "an", "output", "that", "pays", "to", "the", "given", "pubkey", "directly", "(", "no", "address", ")", "with", "the", "given", "value", "adds", "it", "to", "this", "transaction", "and", "returns", "the", "new", "output", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L1049-L1051
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/GridBagLayoutFormBuilder.java
GridBagLayoutFormBuilder.appendLabeledField
public GridBagLayoutFormBuilder appendLabeledField(String propertyName, final JComponent field, LabelOrientation labelOrientation, int colSpan) { return appendLabeledField(propertyName, field, labelOrientation, colSpan, 1, true, false); }
java
public GridBagLayoutFormBuilder appendLabeledField(String propertyName, final JComponent field, LabelOrientation labelOrientation, int colSpan) { return appendLabeledField(propertyName, field, labelOrientation, colSpan, 1, true, false); }
[ "public", "GridBagLayoutFormBuilder", "appendLabeledField", "(", "String", "propertyName", ",", "final", "JComponent", "field", ",", "LabelOrientation", "labelOrientation", ",", "int", "colSpan", ")", "{", "return", "appendLabeledField", "(", "propertyName", ",", "field...
Appends a label and field to the end of the current line. <p /> The label will be to the left of the field, and be right-justified. <br /> The field will "grow" horizontally as space allows. <p /> @param propertyName the name of the property to create the controls for @param colSpan the number of columns the field should span @return "this" to make it easier to string together append calls @see FormComponentInterceptor#processLabel(String, JComponent)
[ "Appends", "a", "label", "and", "field", "to", "the", "end", "of", "the", "current", "line", ".", "<p", "/", ">" ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/GridBagLayoutFormBuilder.java#L155-L158
perwendel/spark
src/main/java/spark/Response.java
Response.removeCookie
public void removeCookie(String path, String name) { Cookie cookie = new Cookie(name, ""); cookie.setPath(path); cookie.setMaxAge(0); response.addCookie(cookie); }
java
public void removeCookie(String path, String name) { Cookie cookie = new Cookie(name, ""); cookie.setPath(path); cookie.setMaxAge(0); response.addCookie(cookie); }
[ "public", "void", "removeCookie", "(", "String", "path", ",", "String", "name", ")", "{", "Cookie", "cookie", "=", "new", "Cookie", "(", "name", ",", "\"\"", ")", ";", "cookie", ".", "setPath", "(", "path", ")", ";", "cookie", ".", "setMaxAge", "(", ...
Removes the cookie with given path and name. @param path path of the cookie @param name name of the cookie
[ "Removes", "the", "cookie", "with", "given", "path", "and", "name", "." ]
train
https://github.com/perwendel/spark/blob/080fb1f9d6e580f6742e9589044c7420d3157b8b/src/main/java/spark/Response.java#L269-L274
kuali/ojb-1.0.4
src/tools/org/apache/ojb/tools/mapping/reversedb2/dbmetatreemodel/DatabaseMetaDataTreeModel.java
DatabaseMetaDataTreeModel.reportSqlError
public void reportSqlError(String message, java.sql.SQLException sqlEx) { StringBuffer strBufMessages = new StringBuffer(); java.sql.SQLException currentSqlEx = sqlEx; do { strBufMessages.append("\n" + sqlEx.getErrorCode() + ":" + sqlEx.getMessage()); currentSqlEx = currentSqlEx.getNextException(); } while (currentSqlEx != null); System.err.println(message + strBufMessages.toString()); sqlEx.printStackTrace(); }
java
public void reportSqlError(String message, java.sql.SQLException sqlEx) { StringBuffer strBufMessages = new StringBuffer(); java.sql.SQLException currentSqlEx = sqlEx; do { strBufMessages.append("\n" + sqlEx.getErrorCode() + ":" + sqlEx.getMessage()); currentSqlEx = currentSqlEx.getNextException(); } while (currentSqlEx != null); System.err.println(message + strBufMessages.toString()); sqlEx.printStackTrace(); }
[ "public", "void", "reportSqlError", "(", "String", "message", ",", "java", ".", "sql", ".", "SQLException", "sqlEx", ")", "{", "StringBuffer", "strBufMessages", "=", "new", "StringBuffer", "(", ")", ";", "java", ".", "sql", ".", "SQLException", "currentSqlEx",...
Method for reporting SQLException. This is used by the treenodes if retrieving information for a node is not successful. @param message The message describing where the error occurred @param sqlEx The exception to be reported.
[ "Method", "for", "reporting", "SQLException", ".", "This", "is", "used", "by", "the", "treenodes", "if", "retrieving", "information", "for", "a", "node", "is", "not", "successful", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/tools/org/apache/ojb/tools/mapping/reversedb2/dbmetatreemodel/DatabaseMetaDataTreeModel.java#L93-L104
EdwardRaff/JSAT
JSAT/src/jsat/linear/Matrix.java
Matrix.updateRow
public void updateRow(int i, double c, Vec b) { if(b.length() != this.cols()) throw new ArithmeticException("vector is not of the same column length"); if (b.isSparse()) for (IndexValue iv : b) this.increment(i, iv.getIndex(), c * iv.getValue()); else for (int j = 0; j < b.length(); j++) this.increment(i, j, c * b.get(j)); }
java
public void updateRow(int i, double c, Vec b) { if(b.length() != this.cols()) throw new ArithmeticException("vector is not of the same column length"); if (b.isSparse()) for (IndexValue iv : b) this.increment(i, iv.getIndex(), c * iv.getValue()); else for (int j = 0; j < b.length(); j++) this.increment(i, j, c * b.get(j)); }
[ "public", "void", "updateRow", "(", "int", "i", ",", "double", "c", ",", "Vec", "b", ")", "{", "if", "(", "b", ".", "length", "(", ")", "!=", "this", ".", "cols", "(", ")", ")", "throw", "new", "ArithmeticException", "(", "\"vector is not of the same c...
Alters row i of <i>this</i> matrix, such that <i>A[i,:] = A[i,:] + c*<b>b</b></i> @param i the index of the row to update @param c the scalar constant to multiply the vector by @param b the vector to add to the specified row
[ "Alters", "row", "i", "of", "<i", ">", "this<", "/", "i", ">", "matrix", "such", "that", "<i", ">", "A", "[", "i", ":", "]", "=", "A", "[", "i", ":", "]", "+", "c", "*", "<b", ">", "b<", "/", "b", ">", "<", "/", "i", ">" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/Matrix.java#L864-L874
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerIdentityImpl.java
TransformerIdentityImpl.setOutputProperty
public void setOutputProperty(String name, String value) throws IllegalArgumentException { if (!OutputProperties.isLegalPropertyKey(name)) throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, new Object[]{name})); //"output property not recognized: " //+ name); m_outputFormat.setProperty(name, value); }
java
public void setOutputProperty(String name, String value) throws IllegalArgumentException { if (!OutputProperties.isLegalPropertyKey(name)) throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, new Object[]{name})); //"output property not recognized: " //+ name); m_outputFormat.setProperty(name, value); }
[ "public", "void", "setOutputProperty", "(", "String", "name", ",", "String", "value", ")", "throws", "IllegalArgumentException", "{", "if", "(", "!", "OutputProperties", ".", "isLegalPropertyKey", "(", "name", ")", ")", "throw", "new", "IllegalArgumentException", ...
Set an output property that will be in effect for the transformation. <p>Pass a qualified property name as a two-part string, the namespace URI enclosed in curly braces ({}), followed by the local name. If the name has a null URL, the String only contain the local name. An application can safely check for a non-null URI by testing to see if the first character of the name is a '{' character.</p> <p>For example, if a URI and local name were obtained from an element defined with &lt;xyz:foo xmlns:xyz="http://xyz.foo.com/yada/baz.html"/&gt;, then the qualified name would be "{http://xyz.foo.com/yada/baz.html}foo". Note that no prefix is used.</p> <p>The Properties object that was passed to {@link #setOutputProperties} won't be effected by calling this method.</p> @param name A non-null String that specifies an output property name, which may be namespace qualified. @param value The non-null string value of the output property. @throws IllegalArgumentException If the property is not supported, and is not qualified with a namespace. @see javax.xml.transform.OutputKeys
[ "Set", "an", "output", "property", "that", "will", "be", "in", "effect", "for", "the", "transformation", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerIdentityImpl.java#L735-L744
colin-lee/mybatis-spring-support
src/main/java/com/github/mybatis/util/ReflectionUtil.java
ReflectionUtil.getFieldValue
@SuppressWarnings("unchecked") public static <T> T getFieldValue(Object object, String fieldName) { Field field = CACHE.getUnchecked(object.getClass().getName() + '#' + fieldName); if (field == null) { throw new IllegalArgumentException("Could not find field [" + fieldName + "] on target [" + object + "]"); } Object result = null; try { result = field.get(object); } catch (IllegalAccessException ignored) { } return (T) result; }
java
@SuppressWarnings("unchecked") public static <T> T getFieldValue(Object object, String fieldName) { Field field = CACHE.getUnchecked(object.getClass().getName() + '#' + fieldName); if (field == null) { throw new IllegalArgumentException("Could not find field [" + fieldName + "] on target [" + object + "]"); } Object result = null; try { result = field.get(object); } catch (IllegalAccessException ignored) { } return (T) result; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "getFieldValue", "(", "Object", "object", ",", "String", "fieldName", ")", "{", "Field", "field", "=", "CACHE", ".", "getUnchecked", "(", "object", ".", "getClass", ...
获取类属性,无视private/protected限制,不经过getter方法 @param object 类对象 @param fieldName 属性名 @param <T> 目标类型 @return
[ "获取类属性,无视private", "/", "protected限制,不经过getter方法" ]
train
https://github.com/colin-lee/mybatis-spring-support/blob/de412e98d00e9a012c0619778fa1a61832863b82/src/main/java/com/github/mybatis/util/ReflectionUtil.java#L62-L75
gnagy/webhejj-commons
src/main/java/hu/webhejj/commons/collections/ArrayUtils.java
ArrayUtils.addToSortedCharArray
public static char[] addToSortedCharArray(char[] a, char value) { if(a == null || a.length == 0) { return new char[] {value}; } int insertionPochar = -java.util.Arrays.binarySearch(a, value) - 1; if(insertionPochar < 0) { throw new IllegalArgumentException(String.format("Element %d already exists in array", value)); } char[] array = new char[a.length + 1]; if(insertionPochar > 0) { System.arraycopy(a, 0, array, 0, insertionPochar); } array[insertionPochar] = value; if(insertionPochar < a.length) { System.arraycopy(a, insertionPochar, array, insertionPochar + 1, array.length - insertionPochar - 1); } return array; }
java
public static char[] addToSortedCharArray(char[] a, char value) { if(a == null || a.length == 0) { return new char[] {value}; } int insertionPochar = -java.util.Arrays.binarySearch(a, value) - 1; if(insertionPochar < 0) { throw new IllegalArgumentException(String.format("Element %d already exists in array", value)); } char[] array = new char[a.length + 1]; if(insertionPochar > 0) { System.arraycopy(a, 0, array, 0, insertionPochar); } array[insertionPochar] = value; if(insertionPochar < a.length) { System.arraycopy(a, insertionPochar, array, insertionPochar + 1, array.length - insertionPochar - 1); } return array; }
[ "public", "static", "char", "[", "]", "addToSortedCharArray", "(", "char", "[", "]", "a", ",", "char", "value", ")", "{", "if", "(", "a", "==", "null", "||", "a", ".", "length", "==", "0", ")", "{", "return", "new", "char", "[", "]", "{", "value"...
insert value into the sorted array a, at the index returned by java.util.Arrays.binarySearch() @param a array to add to, may be null @param value value to add to a @return new sorted array with value added
[ "insert", "value", "into", "the", "sorted", "array", "a", "at", "the", "index", "returned", "by", "java", ".", "util", ".", "Arrays", ".", "binarySearch", "()" ]
train
https://github.com/gnagy/webhejj-commons/blob/270bc6f111ec5761af31d39bd38c40fd914d2eba/src/main/java/hu/webhejj/commons/collections/ArrayUtils.java#L131-L152
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/text/codepoint/CodepointHelper.java
CodepointHelper.verify
public static void verify (final AbstractCodepointIterator aIter, @Nonnull final ECodepointProfile eProfile) { verify (aIter, eProfile.getFilter ()); }
java
public static void verify (final AbstractCodepointIterator aIter, @Nonnull final ECodepointProfile eProfile) { verify (aIter, eProfile.getFilter ()); }
[ "public", "static", "void", "verify", "(", "final", "AbstractCodepointIterator", "aIter", ",", "@", "Nonnull", "final", "ECodepointProfile", "eProfile", ")", "{", "verify", "(", "aIter", ",", "eProfile", ".", "getFilter", "(", ")", ")", ";", "}" ]
Verifies a sequence of codepoints using the specified filter @param aIter codepoint iterator @param eProfile profile to use
[ "Verifies", "a", "sequence", "of", "codepoints", "using", "the", "specified", "filter" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/text/codepoint/CodepointHelper.java#L762-L765
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java
DevicesInner.beginCreateOrUpdate
public DataBoxEdgeDeviceInner beginCreateOrUpdate(String deviceName, String resourceGroupName, DataBoxEdgeDeviceInner dataBoxEdgeDevice) { return beginCreateOrUpdateWithServiceResponseAsync(deviceName, resourceGroupName, dataBoxEdgeDevice).toBlocking().single().body(); }
java
public DataBoxEdgeDeviceInner beginCreateOrUpdate(String deviceName, String resourceGroupName, DataBoxEdgeDeviceInner dataBoxEdgeDevice) { return beginCreateOrUpdateWithServiceResponseAsync(deviceName, resourceGroupName, dataBoxEdgeDevice).toBlocking().single().body(); }
[ "public", "DataBoxEdgeDeviceInner", "beginCreateOrUpdate", "(", "String", "deviceName", ",", "String", "resourceGroupName", ",", "DataBoxEdgeDeviceInner", "dataBoxEdgeDevice", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "deviceName", ",", "resourceGr...
Creates or updates a Data Box Edge/Gateway resource. @param deviceName The device name. @param resourceGroupName The resource group name. @param dataBoxEdgeDevice The resource object. @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 DataBoxEdgeDeviceInner object if successful.
[ "Creates", "or", "updates", "a", "Data", "Box", "Edge", "/", "Gateway", "resource", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java#L780-L782
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java
DateFormat.getDateTimeInstance
public final static DateFormat getDateTimeInstance( int dateStyle, int timeStyle, ULocale locale) { return get(dateStyle, timeStyle, locale, null); }
java
public final static DateFormat getDateTimeInstance( int dateStyle, int timeStyle, ULocale locale) { return get(dateStyle, timeStyle, locale, null); }
[ "public", "final", "static", "DateFormat", "getDateTimeInstance", "(", "int", "dateStyle", ",", "int", "timeStyle", ",", "ULocale", "locale", ")", "{", "return", "get", "(", "dateStyle", ",", "timeStyle", ",", "locale", ",", "null", ")", ";", "}" ]
Returns the date/time formatter with the given formatting styles for the given locale. @param dateStyle the given date formatting style. As currently implemented, relative date formatting only affects a limited range of calendar days before or after the current date, based on the CLDR &lt;field type="day"&gt;/&lt;relative&gt; data: For example, in English, "Yesterday", "Today", and "Tomorrow". Outside of this range, relative dates are formatted using the corresponding non-relative style. @param timeStyle the given time formatting style. Relative time styles are not currently supported, and behave just like the corresponding non-relative style. @param locale the given ulocale. @return a date/time formatter.
[ "Returns", "the", "date", "/", "time", "formatter", "with", "the", "given", "formatting", "styles", "for", "the", "given", "locale", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java#L1404-L1408
Waikato/moa
moa/src/main/java/moa/clusterers/outliers/AnyOut/AnyOutCore.java
AnyOutCore.calcC1
private double calcC1(int objectId) { int nrOfPreviousResults = previousOScoreResultList.get(objectId).size(); if (nrOfPreviousResults == 0) { return 0.0; } int count=1; double difSum_k = Math.abs(lastOScoreResult.get(objectId)-previousOScoreResultList.get(objectId).get(nrOfPreviousResults-1)); //if previousOscoreResultList contains more than two results, this loop sums up further diffs for (int i=Math.max(0, nrOfPreviousResults - (confK-1)) + 1; i < nrOfPreviousResults; i++){ difSum_k += Math.abs(previousOScoreResultList.get(objectId).get(i)-previousOScoreResultList.get(objectId).get(i-1)); count++; } // hier msste gelten count==confK-1, d.h. wenn ich die letzten 3 Werte betrachten will, bekomme ich 2 differenzen // XXX SW: Nicht ganz. Wenn ich die letzten 4 Werte betrachten will, aber erst 2 Ergebnisse zur Verf�gung stehen, bekomme ich an anstatt der 3 Differenzen nur 1 // dafr die Zhlvariable difSum_k /= count; return Math.pow(Math.E, (-1.0 * difSum_k)); }
java
private double calcC1(int objectId) { int nrOfPreviousResults = previousOScoreResultList.get(objectId).size(); if (nrOfPreviousResults == 0) { return 0.0; } int count=1; double difSum_k = Math.abs(lastOScoreResult.get(objectId)-previousOScoreResultList.get(objectId).get(nrOfPreviousResults-1)); //if previousOscoreResultList contains more than two results, this loop sums up further diffs for (int i=Math.max(0, nrOfPreviousResults - (confK-1)) + 1; i < nrOfPreviousResults; i++){ difSum_k += Math.abs(previousOScoreResultList.get(objectId).get(i)-previousOScoreResultList.get(objectId).get(i-1)); count++; } // hier msste gelten count==confK-1, d.h. wenn ich die letzten 3 Werte betrachten will, bekomme ich 2 differenzen // XXX SW: Nicht ganz. Wenn ich die letzten 4 Werte betrachten will, aber erst 2 Ergebnisse zur Verf�gung stehen, bekomme ich an anstatt der 3 Differenzen nur 1 // dafr die Zhlvariable difSum_k /= count; return Math.pow(Math.E, (-1.0 * difSum_k)); }
[ "private", "double", "calcC1", "(", "int", "objectId", ")", "{", "int", "nrOfPreviousResults", "=", "previousOScoreResultList", ".", "get", "(", "objectId", ")", ".", "size", "(", ")", ";", "if", "(", "nrOfPreviousResults", "==", "0", ")", "{", "return", "...
Calculates the Confidence on the basis of the standard deviation of previous OScore results @return confidence
[ "Calculates", "the", "Confidence", "on", "the", "basis", "of", "the", "standard", "deviation", "of", "previous", "OScore", "results" ]
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/outliers/AnyOut/AnyOutCore.java#L234-L252
threerings/gwt-utils
src/main/java/com/threerings/gwt/ui/WidgetUtil.java
WidgetUtil.makeShim
public static Widget makeShim (int width, int height) { Label shim = new Label(""); shim.setWidth(width + "px"); shim.setHeight(height + "px"); return shim; }
java
public static Widget makeShim (int width, int height) { Label shim = new Label(""); shim.setWidth(width + "px"); shim.setHeight(height + "px"); return shim; }
[ "public", "static", "Widget", "makeShim", "(", "int", "width", ",", "int", "height", ")", "{", "Label", "shim", "=", "new", "Label", "(", "\"\"", ")", ";", "shim", ".", "setWidth", "(", "width", "+", "\"px\"", ")", ";", "shim", ".", "setHeight", "(",...
Makes a widget that takes up horizontal and or vertical space. Shim shimminy shim shim shiree.
[ "Makes", "a", "widget", "that", "takes", "up", "horizontal", "and", "or", "vertical", "space", ".", "Shim", "shimminy", "shim", "shim", "shiree", "." ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/WidgetUtil.java#L254-L260
protostuff/protostuff
protostuff-xml/src/main/java/io/protostuff/XmlIOUtil.java
XmlIOUtil.mergeFrom
public static <T> void mergeFrom(Reader r, T message, Schema<T> schema) throws IOException { mergeFrom(r, message, schema, DEFAULT_INPUT_FACTORY); }
java
public static <T> void mergeFrom(Reader r, T message, Schema<T> schema) throws IOException { mergeFrom(r, message, schema, DEFAULT_INPUT_FACTORY); }
[ "public", "static", "<", "T", ">", "void", "mergeFrom", "(", "Reader", "r", ",", "T", "message", ",", "Schema", "<", "T", ">", "schema", ")", "throws", "IOException", "{", "mergeFrom", "(", "r", ",", "message", ",", "schema", ",", "DEFAULT_INPUT_FACTORY"...
Merges the {@code message} from the {@link Reader} using the given {@code schema}.
[ "Merges", "the", "{" ]
train
https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-xml/src/main/java/io/protostuff/XmlIOUtil.java#L256-L260
navnorth/LRJavaLib
src/com/navnorth/learningregistry/LRImporter.java
LRImporter.getHarvestRequestPath
private String getHarvestRequestPath(String requestID, Boolean byResourceID, Boolean byDocID) { String path = harvestPath; if (requestID != null) { path += "?" + requestIDParam + "=" + requestID; } else { // error return null; } if (byResourceID) { path += "&" + byResourceIDParam + "=" + booleanTrueString; } else { path += "&" + byResourceIDParam + "=" + booleanFalseString; } if (byDocID) { path += "&" + byDocIDParam + "=" + booleanTrueString; } else { path += "&" + byDocIDParam + "=" + booleanFalseString; } return path; }
java
private String getHarvestRequestPath(String requestID, Boolean byResourceID, Boolean byDocID) { String path = harvestPath; if (requestID != null) { path += "?" + requestIDParam + "=" + requestID; } else { // error return null; } if (byResourceID) { path += "&" + byResourceIDParam + "=" + booleanTrueString; } else { path += "&" + byResourceIDParam + "=" + booleanFalseString; } if (byDocID) { path += "&" + byDocIDParam + "=" + booleanTrueString; } else { path += "&" + byDocIDParam + "=" + booleanFalseString; } return path; }
[ "private", "String", "getHarvestRequestPath", "(", "String", "requestID", ",", "Boolean", "byResourceID", ",", "Boolean", "byDocID", ")", "{", "String", "path", "=", "harvestPath", ";", "if", "(", "requestID", "!=", "null", ")", "{", "path", "+=", "\"?\"", "...
Obtain the path used for a harvest request @param requestID the "request_ID" parameter for the request @param byResourceID the "by_resource_ID" parameter for the request @param byDocID the "by_doc_ID" parameter for the request @return the string of the path for a harvest request
[ "Obtain", "the", "path", "used", "for", "a", "harvest", "request" ]
train
https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRImporter.java#L176-L209
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/CoroutineManager.java
CoroutineManager.co_exit_to
public synchronized void co_exit_to(Object arg_object,int thisCoroutine,int toCoroutine) throws java.lang.NoSuchMethodException { if(!m_activeIDs.get(toCoroutine)) throw new java.lang.NoSuchMethodException(XMLMessages.createXMLMessage(XMLErrorResources.ER_COROUTINE_NOT_AVAIL, new Object[]{Integer.toString(toCoroutine)})); //"Coroutine not available, id="+toCoroutine); // We expect these values to be overwritten during the notify()/wait() // periods, as other coroutines in this set get their opportunity to run. m_yield=arg_object; m_nextCoroutine=toCoroutine; m_activeIDs.clear(thisCoroutine); notify(); }
java
public synchronized void co_exit_to(Object arg_object,int thisCoroutine,int toCoroutine) throws java.lang.NoSuchMethodException { if(!m_activeIDs.get(toCoroutine)) throw new java.lang.NoSuchMethodException(XMLMessages.createXMLMessage(XMLErrorResources.ER_COROUTINE_NOT_AVAIL, new Object[]{Integer.toString(toCoroutine)})); //"Coroutine not available, id="+toCoroutine); // We expect these values to be overwritten during the notify()/wait() // periods, as other coroutines in this set get their opportunity to run. m_yield=arg_object; m_nextCoroutine=toCoroutine; m_activeIDs.clear(thisCoroutine); notify(); }
[ "public", "synchronized", "void", "co_exit_to", "(", "Object", "arg_object", ",", "int", "thisCoroutine", ",", "int", "toCoroutine", ")", "throws", "java", ".", "lang", ".", "NoSuchMethodException", "{", "if", "(", "!", "m_activeIDs", ".", "get", "(", "toCorou...
Make the ID available for reuse and terminate this coroutine, transferring control to the specified coroutine. Note that this returns immediately rather than waiting for any further coroutine traffic, so the thread can proceed with other shutdown activities. @param arg_object A value to be passed to the other coroutine. @param thisCoroutine Integer identifier for the coroutine leaving the set. @param toCoroutine Integer identifier for the coroutine we wish to invoke. @exception java.lang.NoSuchMethodException if toCoroutine isn't a registered member of this group. %REVIEW% whether this is the best choice.
[ "Make", "the", "ID", "available", "for", "reuse", "and", "terminate", "this", "coroutine", "transferring", "control", "to", "the", "specified", "coroutine", ".", "Note", "that", "this", "returns", "immediately", "rather", "than", "waiting", "for", "any", "furthe...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/CoroutineManager.java#L330-L343
sdl/odata
odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java
EntityDataModelUtil.setPropertyValue
public static void setPropertyValue(StructuralProperty property, Object object, Object value) { Field field = property.getJavaField(); field.setAccessible(true); try { field.set(object, value); } catch (IllegalAccessException e) { throw new ODataSystemException("Cannot write property: " + property + " of object: " + object, e); } }
java
public static void setPropertyValue(StructuralProperty property, Object object, Object value) { Field field = property.getJavaField(); field.setAccessible(true); try { field.set(object, value); } catch (IllegalAccessException e) { throw new ODataSystemException("Cannot write property: " + property + " of object: " + object, e); } }
[ "public", "static", "void", "setPropertyValue", "(", "StructuralProperty", "property", ",", "Object", "object", ",", "Object", "value", ")", "{", "Field", "field", "=", "property", ".", "getJavaField", "(", ")", ";", "field", ".", "setAccessible", "(", "true",...
Sets the value of a property. @param property The property. @param object The object to set the value in (typically an OData entity). @param value The value to set.
[ "Sets", "the", "value", "of", "a", "property", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java#L328-L336
ykrasik/jaci
jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionUtils.java
ReflectionUtils.isAssignableFrom
public static boolean isAssignableFrom(Class<?> c1, Class<?> c2) { assertReflectionAccessor(); return accessor.isAssignableFrom(c1, c2); }
java
public static boolean isAssignableFrom(Class<?> c1, Class<?> c2) { assertReflectionAccessor(); return accessor.isAssignableFrom(c1, c2); }
[ "public", "static", "boolean", "isAssignableFrom", "(", "Class", "<", "?", ">", "c1", ",", "Class", "<", "?", ">", "c2", ")", "{", "assertReflectionAccessor", "(", ")", ";", "return", "accessor", ".", "isAssignableFrom", "(", "c1", ",", "c2", ")", ";", ...
Determines if the class or interface represented by first Class parameter is either the same as, or is a superclass or superinterface of, the class or interface represented by the second Class parameter. @param c1 Class to check. @param c2 Class to check against. @return {@code true} if the first class parameter is either the same as or a superinterface of the second class parameter.
[ "Determines", "if", "the", "class", "or", "interface", "represented", "by", "first", "Class", "parameter", "is", "either", "the", "same", "as", "or", "is", "a", "superclass", "or", "superinterface", "of", "the", "class", "or", "interface", "represented", "by",...
train
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionUtils.java#L174-L177
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java
HttpHeaders.setHeader
@Deprecated public static void setHeader(HttpMessage message, String name, Object value) { message.headers().set(name, value); }
java
@Deprecated public static void setHeader(HttpMessage message, String name, Object value) { message.headers().set(name, value); }
[ "@", "Deprecated", "public", "static", "void", "setHeader", "(", "HttpMessage", "message", ",", "String", "name", ",", "Object", "value", ")", "{", "message", ".", "headers", "(", ")", ".", "set", "(", "name", ",", "value", ")", ";", "}" ]
@deprecated Use {@link #set(CharSequence, Object)} instead. @see #setHeader(HttpMessage, CharSequence, Object)
[ "@deprecated", "Use", "{", "@link", "#set", "(", "CharSequence", "Object", ")", "}", "instead", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L599-L602
ist-dresden/composum
sling/core/commons/src/main/java/com/composum/sling/core/util/JsonUtil.java
JsonUtil.parseJsonString
public static String parseJsonString(JsonReader reader, JsonProperty property) throws IOException { if (property.type == null) { // set property type to the default value if not set otherwise // (e.g. on by the value before in an array loop) property.type = PropertyType.nameFromValue(PropertyType.STRING); } String string = reader.nextString(); // check for a type hint string pattern and extract the parts if matching Matcher matcher = MappingRules.TYPED_PROPERTY_STRING.matcher(string); if (matcher.matches()) { try { // ensure that the type ist known in the JCR repository property.type = PropertyType.nameFromValue( PropertyType.valueFromName(matcher.group(1))); string = matcher.group(2); } catch (IllegalArgumentException iaex) { // if not a known type let the string unchanged } } property.value = string; return string; }
java
public static String parseJsonString(JsonReader reader, JsonProperty property) throws IOException { if (property.type == null) { // set property type to the default value if not set otherwise // (e.g. on by the value before in an array loop) property.type = PropertyType.nameFromValue(PropertyType.STRING); } String string = reader.nextString(); // check for a type hint string pattern and extract the parts if matching Matcher matcher = MappingRules.TYPED_PROPERTY_STRING.matcher(string); if (matcher.matches()) { try { // ensure that the type ist known in the JCR repository property.type = PropertyType.nameFromValue( PropertyType.valueFromName(matcher.group(1))); string = matcher.group(2); } catch (IllegalArgumentException iaex) { // if not a known type let the string unchanged } } property.value = string; return string; }
[ "public", "static", "String", "parseJsonString", "(", "JsonReader", "reader", ",", "JsonProperty", "property", ")", "throws", "IOException", "{", "if", "(", "property", ".", "type", "==", "null", ")", "{", "// set property type to the default value if not set otherwise"...
The parser for a JSON string value with an optional type hint ('{type}...') as the values prefix. Sets the value and type of the property POJO and returns the string value without the type. This is used for single property values and also for multiple values (in the array loop). @param reader @param property @return @throws IOException
[ "The", "parser", "for", "a", "JSON", "string", "value", "with", "an", "optional", "type", "hint", "(", "{", "type", "}", "...", ")", "as", "the", "values", "prefix", ".", "Sets", "the", "value", "and", "type", "of", "the", "property", "POJO", "and", ...
train
https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/core/util/JsonUtil.java#L602-L623
diffplug/JMatIO
src/main/java/ca/mjdsystems/jmatio/io/MatFileIncrementalWriter.java
MatFileIncrementalWriter.writeName
private void writeName(DataOutputStream os, MLArray array) throws IOException { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); DataOutputStream bufferDOS = new DataOutputStream(buffer); byte[] nameByteArray = array.getNameToByteArray(); buffer = new ByteArrayOutputStream(); bufferDOS = new DataOutputStream(buffer); bufferDOS.write( nameByteArray ); OSArrayTag tag = new OSArrayTag(MatDataTypes.miINT8, buffer.toByteArray() ); tag.writeTo( os ); }
java
private void writeName(DataOutputStream os, MLArray array) throws IOException { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); DataOutputStream bufferDOS = new DataOutputStream(buffer); byte[] nameByteArray = array.getNameToByteArray(); buffer = new ByteArrayOutputStream(); bufferDOS = new DataOutputStream(buffer); bufferDOS.write( nameByteArray ); OSArrayTag tag = new OSArrayTag(MatDataTypes.miINT8, buffer.toByteArray() ); tag.writeTo( os ); }
[ "private", "void", "writeName", "(", "DataOutputStream", "os", ",", "MLArray", "array", ")", "throws", "IOException", "{", "ByteArrayOutputStream", "buffer", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "DataOutputStream", "bufferDOS", "=", "new", "DataOutput...
Writes MATRIX name into <code>OutputStream</code>. @param os - <code>OutputStream</code> @param array - a <code>MLArray</code> @throws IOException
[ "Writes", "MATRIX", "name", "into", "<code", ">", "OutputStream<", "/", "code", ">", "." ]
train
https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/io/MatFileIncrementalWriter.java#L499-L510
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java
TransformersLogger.logAttributeWarning
public void logAttributeWarning(PathAddress address, String message, String attribute) { logAttributeWarning(address, null, message, attribute); }
java
public void logAttributeWarning(PathAddress address, String message, String attribute) { logAttributeWarning(address, null, message, attribute); }
[ "public", "void", "logAttributeWarning", "(", "PathAddress", "address", ",", "String", "message", ",", "String", "attribute", ")", "{", "logAttributeWarning", "(", "address", ",", "null", ",", "message", ",", "attribute", ")", ";", "}" ]
Log warning for the resource at the provided address and single attribute, using the provided detail message. @param address where warning occurred @param message custom error message to append @param attribute attribute we are warning about
[ "Log", "warning", "for", "the", "resource", "at", "the", "provided", "address", "and", "single", "attribute", "using", "the", "provided", "detail", "message", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java#L121-L123
softindex/datakernel
core-promise/src/main/java/io/datakernel/file/AsyncFile.java
AsyncFile.createDirectory
public static Promise<Void> createDirectory(Executor executor, Path dir, @Nullable FileAttribute<?>[] attrs) { return ofBlockingRunnable(executor, () -> { try { Files.createDirectory(dir, attrs == null ? new FileAttribute<?>[0] : attrs); } catch (IOException e) { throw new UncheckedException(e); } }); }
java
public static Promise<Void> createDirectory(Executor executor, Path dir, @Nullable FileAttribute<?>[] attrs) { return ofBlockingRunnable(executor, () -> { try { Files.createDirectory(dir, attrs == null ? new FileAttribute<?>[0] : attrs); } catch (IOException e) { throw new UncheckedException(e); } }); }
[ "public", "static", "Promise", "<", "Void", ">", "createDirectory", "(", "Executor", "executor", ",", "Path", "dir", ",", "@", "Nullable", "FileAttribute", "<", "?", ">", "[", "]", "attrs", ")", "{", "return", "ofBlockingRunnable", "(", "executor", ",", "(...
Creates a new directory. @param executor executor for running tasks in other thread @param dir the directory to create @param attrs an optional list of file attributes to set atomically when creating the directory
[ "Creates", "a", "new", "directory", "." ]
train
https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-promise/src/main/java/io/datakernel/file/AsyncFile.java#L169-L177
VoltDB/voltdb
src/frontend/org/voltdb/ClientAppBase.java
ClientAppBase.printLog
protected void printLog(String msg, Object...args) { printLogStatic(this.getClass().getSimpleName(), msg, args); }
java
protected void printLog(String msg, Object...args) { printLogStatic(this.getClass().getSimpleName(), msg, args); }
[ "protected", "void", "printLog", "(", "String", "msg", ",", "Object", "...", "args", ")", "{", "printLogStatic", "(", "this", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ",", "msg", ",", "args", ")", ";", "}" ]
<p>The non-static method to print a log message to the console.</p> <p>This method will automatically use the name of the current class as class name.</p> @param msg The log message that needs to be printed. @param args The arguments that may be needed for formatting the message.
[ "<p", ">", "The", "non", "-", "static", "method", "to", "print", "a", "log", "message", "to", "the", "console", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "will", "automatically", "use", "the", "name", "of", "the", "current", "class", "as"...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/ClientAppBase.java#L71-L73
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/TypeQualifierApplications.java
TypeQualifierApplications.getEffectiveTypeQualifierAnnotation
public static TypeQualifierAnnotation getEffectiveTypeQualifierAnnotation(AnnotatedObject o, TypeQualifierValue<?> typeQualifierValue) { if (o instanceof XMethod) { XMethod m = (XMethod) o; if (m.getName().startsWith("access$")) { InnerClassAccessMap icam = AnalysisContext.currentAnalysisContext().getInnerClassAccessMap(); try { InnerClassAccess ica = icam.getInnerClassAccess(m.getClassName(), m.getName()); if (ica != null && ica.isLoad()) { o = ica.getField(); } } catch (ClassNotFoundException e) { AnalysisContext.reportMissingClass(e); return null; } } } TypeQualifierAnnotation tqa = computeEffectiveTypeQualifierAnnotation(typeQualifierValue, o); final AnnotatedObject o2 = o; if (CHECK_EXCLUSIVE && tqa == null && typeQualifierValue.isExclusiveQualifier()) { tqa = computeExclusiveQualifier(typeQualifierValue, new ComputeEffectiveTypeQualifierAnnotation() { @Override public TypeQualifierAnnotation compute(TypeQualifierValue<?> tqv) { return computeEffectiveTypeQualifierAnnotation(tqv, o2); } @Override public String toString() { return o2.toString(); } }); } return tqa; }
java
public static TypeQualifierAnnotation getEffectiveTypeQualifierAnnotation(AnnotatedObject o, TypeQualifierValue<?> typeQualifierValue) { if (o instanceof XMethod) { XMethod m = (XMethod) o; if (m.getName().startsWith("access$")) { InnerClassAccessMap icam = AnalysisContext.currentAnalysisContext().getInnerClassAccessMap(); try { InnerClassAccess ica = icam.getInnerClassAccess(m.getClassName(), m.getName()); if (ica != null && ica.isLoad()) { o = ica.getField(); } } catch (ClassNotFoundException e) { AnalysisContext.reportMissingClass(e); return null; } } } TypeQualifierAnnotation tqa = computeEffectiveTypeQualifierAnnotation(typeQualifierValue, o); final AnnotatedObject o2 = o; if (CHECK_EXCLUSIVE && tqa == null && typeQualifierValue.isExclusiveQualifier()) { tqa = computeExclusiveQualifier(typeQualifierValue, new ComputeEffectiveTypeQualifierAnnotation() { @Override public TypeQualifierAnnotation compute(TypeQualifierValue<?> tqv) { return computeEffectiveTypeQualifierAnnotation(tqv, o2); } @Override public String toString() { return o2.toString(); } }); } return tqa; }
[ "public", "static", "TypeQualifierAnnotation", "getEffectiveTypeQualifierAnnotation", "(", "AnnotatedObject", "o", ",", "TypeQualifierValue", "<", "?", ">", "typeQualifierValue", ")", "{", "if", "(", "o", "instanceof", "XMethod", ")", "{", "XMethod", "m", "=", "(", ...
Get the effective TypeQualifierAnnotation on given AnnotatedObject. Takes into account inherited and default (outer scope) annotations. Also takes exclusive qualifiers into account. @param o an AnnotatedObject @param typeQualifierValue a TypeQualifierValue specifying kind of annotation we want to look up @return the effective TypeQualifierAnnotation, or null if there is no effective TypeQualifierAnnotation on this AnnotatedObject
[ "Get", "the", "effective", "TypeQualifierAnnotation", "on", "given", "AnnotatedObject", ".", "Takes", "into", "account", "inherited", "and", "default", "(", "outer", "scope", ")", "annotations", ".", "Also", "takes", "exclusive", "qualifiers", "into", "account", "...
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/TypeQualifierApplications.java#L559-L594
JodaOrg/joda-time
src/main/java/org/joda/time/MonthDay.java
MonthDay.withMonthOfYear
public MonthDay withMonthOfYear(int monthOfYear) { int[] newValues = getValues(); newValues = getChronology().monthOfYear().set(this, MONTH_OF_YEAR, newValues, monthOfYear); return new MonthDay(this, newValues); }
java
public MonthDay withMonthOfYear(int monthOfYear) { int[] newValues = getValues(); newValues = getChronology().monthOfYear().set(this, MONTH_OF_YEAR, newValues, monthOfYear); return new MonthDay(this, newValues); }
[ "public", "MonthDay", "withMonthOfYear", "(", "int", "monthOfYear", ")", "{", "int", "[", "]", "newValues", "=", "getValues", "(", ")", ";", "newValues", "=", "getChronology", "(", ")", ".", "monthOfYear", "(", ")", ".", "set", "(", "this", ",", "MONTH_O...
Returns a copy of this month-day with the month of year field updated. <p> MonthDay is immutable, so there are no set methods. Instead, this method returns a new instance with the value of month of year changed. @param monthOfYear the month of year to set @return a copy of this object with the field set, never null @throws IllegalArgumentException if the value is invalid
[ "Returns", "a", "copy", "of", "this", "month", "-", "day", "with", "the", "month", "of", "year", "field", "updated", ".", "<p", ">", "MonthDay", "is", "immutable", "so", "there", "are", "no", "set", "methods", ".", "Instead", "this", "method", "returns",...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/MonthDay.java#L720-L724
jbake-org/jbake
jbake-core/src/main/java/org/jbake/app/configuration/JBakeConfigurationFactory.java
JBakeConfigurationFactory.createJettyJbakeConfiguration
public DefaultJBakeConfiguration createJettyJbakeConfiguration(File sourceFolder, File destinationFolder, boolean isClearCache) throws ConfigurationException { DefaultJBakeConfiguration configuration = (DefaultJBakeConfiguration) getConfigUtil().loadConfig(sourceFolder); configuration.setDestinationFolder(destinationFolder); configuration.setClearCache(isClearCache); configuration.setSiteHost("http://localhost:"+configuration.getServerPort()); return configuration; }
java
public DefaultJBakeConfiguration createJettyJbakeConfiguration(File sourceFolder, File destinationFolder, boolean isClearCache) throws ConfigurationException { DefaultJBakeConfiguration configuration = (DefaultJBakeConfiguration) getConfigUtil().loadConfig(sourceFolder); configuration.setDestinationFolder(destinationFolder); configuration.setClearCache(isClearCache); configuration.setSiteHost("http://localhost:"+configuration.getServerPort()); return configuration; }
[ "public", "DefaultJBakeConfiguration", "createJettyJbakeConfiguration", "(", "File", "sourceFolder", ",", "File", "destinationFolder", ",", "boolean", "isClearCache", ")", "throws", "ConfigurationException", "{", "DefaultJBakeConfiguration", "configuration", "=", "(", "Defaul...
Creates a {@link DefaultJBakeConfiguration} with value site.host replaced by http://localhost:[server.port]. The server.port is read from the project properties file. @param sourceFolder The source folder of the project @param destinationFolder The destination folder to render and copy files to @param isClearCache Whether to clear database cache or not @return A configuration by given parameters @throws ConfigurationException if loading the configuration fails
[ "Creates", "a", "{", "@link", "DefaultJBakeConfiguration", "}", "with", "value", "site", ".", "host", "replaced", "by", "http", ":", "//", "localhost", ":", "[", "server", ".", "port", "]", ".", "The", "server", ".", "port", "is", "read", "from", "the", ...
train
https://github.com/jbake-org/jbake/blob/beb9042a54bf0eb168821d524c88b9ea0bee88dc/jbake-core/src/main/java/org/jbake/app/configuration/JBakeConfigurationFactory.java#L93-L99
joniles/mpxj
src/main/java/net/sf/mpxj/Resource.java
Resource.setDate
public void setDate(int index, Date value) { set(selectField(ResourceFieldLists.CUSTOM_DATE, index), value); }
java
public void setDate(int index, Date value) { set(selectField(ResourceFieldLists.CUSTOM_DATE, index), value); }
[ "public", "void", "setDate", "(", "int", "index", ",", "Date", "value", ")", "{", "set", "(", "selectField", "(", "ResourceFieldLists", ".", "CUSTOM_DATE", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set a date value. @param index date index (1-10) @param value date value
[ "Set", "a", "date", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Resource.java#L1683-L1686
phax/ph-schedule
ph-mini-quartz/src/main/java/com/helger/quartz/utils/PropertiesParser.java
PropertiesParser.getStringProperty
public String getStringProperty (final String name, final String def) { String val = m_aProps.getProperty (name, def); if (val == null) return def; val = val.trim (); return val.length () == 0 ? def : val; }
java
public String getStringProperty (final String name, final String def) { String val = m_aProps.getProperty (name, def); if (val == null) return def; val = val.trim (); return val.length () == 0 ? def : val; }
[ "public", "String", "getStringProperty", "(", "final", "String", "name", ",", "final", "String", "def", ")", "{", "String", "val", "=", "m_aProps", ".", "getProperty", "(", "name", ",", "def", ")", ";", "if", "(", "val", "==", "null", ")", "return", "d...
Get the trimmed String value of the property with the given <code>name</code> or the given default value if the value is null or empty after trimming.
[ "Get", "the", "trimmed", "String", "value", "of", "the", "property", "with", "the", "given", "<code", ">", "name<", "/", "code", ">", "or", "the", "given", "default", "value", "if", "the", "value", "is", "null", "or", "empty", "after", "trimming", "." ]
train
https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/utils/PropertiesParser.java#L72-L79
groupon/odo
proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java
PathOverrideService.setContentType
public void setContentType(int pathId, String contentType) { PreparedStatement statement = null; try (Connection sqlConnection = sqlService.getConnection()) { statement = sqlConnection.prepareStatement( "UPDATE " + Constants.DB_TABLE_PATH + " SET " + Constants.PATH_PROFILE_CONTENT_TYPE + " = ? " + " WHERE " + Constants.GENERIC_ID + " = ?" ); statement.setString(1, contentType); statement.setInt(2, pathId); statement.executeUpdate(); statement.close(); } catch (SQLException e) { e.printStackTrace(); } finally { try { if (statement != null) { statement.close(); } } catch (Exception e) { } } }
java
public void setContentType(int pathId, String contentType) { PreparedStatement statement = null; try (Connection sqlConnection = sqlService.getConnection()) { statement = sqlConnection.prepareStatement( "UPDATE " + Constants.DB_TABLE_PATH + " SET " + Constants.PATH_PROFILE_CONTENT_TYPE + " = ? " + " WHERE " + Constants.GENERIC_ID + " = ?" ); statement.setString(1, contentType); statement.setInt(2, pathId); statement.executeUpdate(); statement.close(); } catch (SQLException e) { e.printStackTrace(); } finally { try { if (statement != null) { statement.close(); } } catch (Exception e) { } } }
[ "public", "void", "setContentType", "(", "int", "pathId", ",", "String", "contentType", ")", "{", "PreparedStatement", "statement", "=", "null", ";", "try", "(", "Connection", "sqlConnection", "=", "sqlService", ".", "getConnection", "(", ")", ")", "{", "state...
Sets the content type for this ID @param pathId ID of path @param contentType content type value
[ "Sets", "the", "content", "type", "for", "this", "ID" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java#L1207-L1229
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/AbstractDatabase.java
AbstractDatabase.addChangeListener
@NonNull public ListenerToken addChangeListener(Executor executor, @NonNull DatabaseChangeListener listener) { if (listener == null) { throw new IllegalArgumentException("listener cannot be null."); } synchronized (lock) { mustBeOpen(); return addDatabaseChangeListener(executor, listener); } }
java
@NonNull public ListenerToken addChangeListener(Executor executor, @NonNull DatabaseChangeListener listener) { if (listener == null) { throw new IllegalArgumentException("listener cannot be null."); } synchronized (lock) { mustBeOpen(); return addDatabaseChangeListener(executor, listener); } }
[ "@", "NonNull", "public", "ListenerToken", "addChangeListener", "(", "Executor", "executor", ",", "@", "NonNull", "DatabaseChangeListener", "listener", ")", "{", "if", "(", "listener", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"lis...
Set the given DatabaseChangeListener to the this database with an executor on which the the changes will be posted to the listener. @param listener
[ "Set", "the", "given", "DatabaseChangeListener", "to", "the", "this", "database", "with", "an", "executor", "on", "which", "the", "the", "changes", "will", "be", "posted", "to", "the", "listener", "." ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/AbstractDatabase.java#L622-L630
HanSolo/SteelSeries-Swing
src/main/java/eu/hansolo/steelseries/extras/Poi.java
Poi.shiftTo
public Point2D shiftTo(final double DISTANCE, final double ANGLE) { final double EARTH_RADIUS = 6371000.0; // m final double LON1 = Math.toRadians(this.lon); final double LAT1 = Math.toRadians(this.lat); final double LAT2 = Math.asin(Math.sin(LAT1) * Math.cos(DISTANCE / EARTH_RADIUS) + Math.cos(LAT1) * Math.sin(DISTANCE / EARTH_RADIUS) * Math.cos(Math.toRadians(ANGLE))); final double LON2 = LON1 + Math.atan2(Math.sin(Math.toRadians(ANGLE)) * Math.sin(DISTANCE / EARTH_RADIUS) * Math.cos(LAT1), Math.cos(DISTANCE / EARTH_RADIUS) - Math.sin(LAT1) * Math.sin(LAT2)); final double LON2_CORRECTED = (LON2 + 3 * Math.PI) % (2 * Math.PI) - Math.PI; //normalise to -180...+180 setLocation(Math.toDegrees(LAT2), Math.toDegrees(LON2_CORRECTED)); return getLocation(); }
java
public Point2D shiftTo(final double DISTANCE, final double ANGLE) { final double EARTH_RADIUS = 6371000.0; // m final double LON1 = Math.toRadians(this.lon); final double LAT1 = Math.toRadians(this.lat); final double LAT2 = Math.asin(Math.sin(LAT1) * Math.cos(DISTANCE / EARTH_RADIUS) + Math.cos(LAT1) * Math.sin(DISTANCE / EARTH_RADIUS) * Math.cos(Math.toRadians(ANGLE))); final double LON2 = LON1 + Math.atan2(Math.sin(Math.toRadians(ANGLE)) * Math.sin(DISTANCE / EARTH_RADIUS) * Math.cos(LAT1), Math.cos(DISTANCE / EARTH_RADIUS) - Math.sin(LAT1) * Math.sin(LAT2)); final double LON2_CORRECTED = (LON2 + 3 * Math.PI) % (2 * Math.PI) - Math.PI; //normalise to -180...+180 setLocation(Math.toDegrees(LAT2), Math.toDegrees(LON2_CORRECTED)); return getLocation(); }
[ "public", "Point2D", "shiftTo", "(", "final", "double", "DISTANCE", ",", "final", "double", "ANGLE", ")", "{", "final", "double", "EARTH_RADIUS", "=", "6371000.0", ";", "// m", "final", "double", "LON1", "=", "Math", ".", "toRadians", "(", "this", ".", "lo...
Moves the poi to the position defined by the given distance and angle @param DISTANCE @param ANGLE @return the poi moved by the given distance and angle
[ "Moves", "the", "poi", "to", "the", "position", "defined", "by", "the", "given", "distance", "and", "angle" ]
train
https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/extras/Poi.java#L382-L393
cortical-io/java-client-sdk
retina-service-java-api-client/src/main/java/io/cortical/services/RetinaApiUtils.java
RetinaApiUtils.generateBasepath
public static String generateBasepath(final String ip, Short port) { if (isEmpty(ip)) { throw new IllegalArgumentException(NULL_SERVER_IP_MSG); } if (port == null) { port = 80; } StringBuilder basePath = new StringBuilder(); basePath.append("http://").append(ip).append(":").append(port).append("/rest"); return basePath.toString(); }
java
public static String generateBasepath(final String ip, Short port) { if (isEmpty(ip)) { throw new IllegalArgumentException(NULL_SERVER_IP_MSG); } if (port == null) { port = 80; } StringBuilder basePath = new StringBuilder(); basePath.append("http://").append(ip).append(":").append(port).append("/rest"); return basePath.toString(); }
[ "public", "static", "String", "generateBasepath", "(", "final", "String", "ip", ",", "Short", "port", ")", "{", "if", "(", "isEmpty", "(", "ip", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "NULL_SERVER_IP_MSG", ")", ";", "}", "if", "(",...
Generate the base path for the retina. @param ip : retina server ip. @param port : retina service port. @return : the retina's API base path.
[ "Generate", "the", "base", "path", "for", "the", "retina", "." ]
train
https://github.com/cortical-io/java-client-sdk/blob/7a1ee811cd7c221690dc0a7e643c286c56cab921/retina-service-java-api-client/src/main/java/io/cortical/services/RetinaApiUtils.java#L26-L36
joniles/mpxj
src/main/java/net/sf/mpxj/Resource.java
Resource.setEnterpriseNumber
public void setEnterpriseNumber(int index, Number value) { set(selectField(ResourceFieldLists.ENTERPRISE_NUMBER, index), value); }
java
public void setEnterpriseNumber(int index, Number value) { set(selectField(ResourceFieldLists.ENTERPRISE_NUMBER, index), value); }
[ "public", "void", "setEnterpriseNumber", "(", "int", "index", ",", "Number", "value", ")", "{", "set", "(", "selectField", "(", "ResourceFieldLists", ".", "ENTERPRISE_NUMBER", ",", "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/Resource.java#L2139-L2142
primefaces/primefaces
src/main/java/org/primefaces/renderkit/InputRenderer.java
InputRenderer.renderARIAInvalid
protected void renderARIAInvalid(FacesContext context, UIInput component) throws IOException { if (!component.isValid()) { ResponseWriter writer = context.getResponseWriter(); writer.writeAttribute(HTML.ARIA_INVALID, "true", null); } }
java
protected void renderARIAInvalid(FacesContext context, UIInput component) throws IOException { if (!component.isValid()) { ResponseWriter writer = context.getResponseWriter(); writer.writeAttribute(HTML.ARIA_INVALID, "true", null); } }
[ "protected", "void", "renderARIAInvalid", "(", "FacesContext", "context", ",", "UIInput", "component", ")", "throws", "IOException", "{", "if", "(", "!", "component", ".", "isValid", "(", ")", ")", "{", "ResponseWriter", "writer", "=", "context", ".", "getResp...
Adds "aria-invalid" if the component is invalid. @param context the {@link FacesContext} @param component the {@link UIInput} component to add attributes for @throws IOException if any error occurs writing the response
[ "Adds", "aria", "-", "invalid", "if", "the", "component", "is", "invalid", "." ]
train
https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/renderkit/InputRenderer.java#L95-L100
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/core/contents/ContentsDao.java
ContentsDao.deleteCascade
public int deleteCascade(Contents contents, boolean userTable) throws SQLException { int count = deleteCascade(contents); if (userTable) { dropTable(contents.getTableName()); } return count; }
java
public int deleteCascade(Contents contents, boolean userTable) throws SQLException { int count = deleteCascade(contents); if (userTable) { dropTable(contents.getTableName()); } return count; }
[ "public", "int", "deleteCascade", "(", "Contents", "contents", ",", "boolean", "userTable", ")", "throws", "SQLException", "{", "int", "count", "=", "deleteCascade", "(", "contents", ")", ";", "if", "(", "userTable", ")", "{", "dropTable", "(", "contents", "...
Delete the Contents, cascading optionally including the user table @param contents contents @param userTable true if a user table @return deleted count @throws SQLException upon deletion error
[ "Delete", "the", "Contents", "cascading", "optionally", "including", "the", "user", "table" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/core/contents/ContentsDao.java#L355-L364
wcm-io/wcm-io-tooling
netbeans/sightly/src/main/java/io/wcm/tooling/netbeans/sightly/completion/AbstractCompleter.java
AbstractCompleter.getRowFirstNonWhite
protected int getRowFirstNonWhite(StyledDocument doc, int offset) throws BadLocationException { Element lineElement = doc.getParagraphElement(offset); int start = lineElement.getStartOffset(); while (start + 1 < lineElement.getEndOffset()) { try { if (doc.getText(start, 1).charAt(0) != ' ') { break; } } catch (BadLocationException ex) { throw (BadLocationException)new BadLocationException("calling getText(" + start + ", " + (start + 1) + ") on doc of length: " + doc.getLength(), start) .initCause(ex); } start++; } return start; }
java
protected int getRowFirstNonWhite(StyledDocument doc, int offset) throws BadLocationException { Element lineElement = doc.getParagraphElement(offset); int start = lineElement.getStartOffset(); while (start + 1 < lineElement.getEndOffset()) { try { if (doc.getText(start, 1).charAt(0) != ' ') { break; } } catch (BadLocationException ex) { throw (BadLocationException)new BadLocationException("calling getText(" + start + ", " + (start + 1) + ") on doc of length: " + doc.getLength(), start) .initCause(ex); } start++; } return start; }
[ "protected", "int", "getRowFirstNonWhite", "(", "StyledDocument", "doc", ",", "int", "offset", ")", "throws", "BadLocationException", "{", "Element", "lineElement", "=", "doc", ".", "getParagraphElement", "(", "offset", ")", ";", "int", "start", "=", "lineElement"...
iterates through the text to find first nonwhite @param doc @param offset @return the offset of the first non-white @throws BadLocationException
[ "iterates", "through", "the", "text", "to", "find", "first", "nonwhite" ]
train
https://github.com/wcm-io/wcm-io-tooling/blob/1abcd01dd3ad4cc248f03b431f929573d84fa9b4/netbeans/sightly/src/main/java/io/wcm/tooling/netbeans/sightly/completion/AbstractCompleter.java#L103-L119
jqm4gwt/jqm4gwt
library/src/main/java/com/sksamuel/jqm4gwt/html/CustomFlowPanel.java
CustomFlowPanel.adoptExternal
public static CustomFlowPanel adoptExternal(ComplexPanel parentPanel, Element externalChild) { if (parentPanel == null || externalChild == null) return null; CustomFlowPanel rslt = new CustomFlowPanel(externalChild); WidgetCollection children = getChildren(parentPanel); children.add(rslt); // Logical attach adoptChild(parentPanel, rslt); // Adopt return rslt; }
java
public static CustomFlowPanel adoptExternal(ComplexPanel parentPanel, Element externalChild) { if (parentPanel == null || externalChild == null) return null; CustomFlowPanel rslt = new CustomFlowPanel(externalChild); WidgetCollection children = getChildren(parentPanel); children.add(rslt); // Logical attach adoptChild(parentPanel, rslt); // Adopt return rslt; }
[ "public", "static", "CustomFlowPanel", "adoptExternal", "(", "ComplexPanel", "parentPanel", ",", "Element", "externalChild", ")", "{", "if", "(", "parentPanel", "==", "null", "||", "externalChild", "==", "null", ")", "return", "null", ";", "CustomFlowPanel", "rslt...
The same as ComplexPanel.add(child, container), but without physical DOM.appendChild() attach. @param parentPanel - depends on externalChild placement in DOM, in most of the cases it should be RootPanel.get()
[ "The", "same", "as", "ComplexPanel", ".", "add", "(", "child", "container", ")", "but", "without", "physical", "DOM", ".", "appendChild", "()", "attach", "." ]
train
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/html/CustomFlowPanel.java#L101-L108
jpush/jmessage-api-java-client
src/main/java/cn/jmessage/api/JMessageClient.java
JMessageClient.addOrRemoveMembers
public void addOrRemoveMembers(long gid, String[] addList, String[] removeList) throws APIConnectionException, APIRequestException { Members add = Members.newBuilder() .addMember(addList) .build(); Members remove = Members.newBuilder() .addMember(removeList) .build(); _groupClient.addOrRemoveMembers(gid, add, remove); }
java
public void addOrRemoveMembers(long gid, String[] addList, String[] removeList) throws APIConnectionException, APIRequestException { Members add = Members.newBuilder() .addMember(addList) .build(); Members remove = Members.newBuilder() .addMember(removeList) .build(); _groupClient.addOrRemoveMembers(gid, add, remove); }
[ "public", "void", "addOrRemoveMembers", "(", "long", "gid", ",", "String", "[", "]", "addList", ",", "String", "[", "]", "removeList", ")", "throws", "APIConnectionException", ",", "APIRequestException", "{", "Members", "add", "=", "Members", ".", "newBuilder", ...
Add or remove members from a group @param gid The group id @param addList If this parameter is null then send remove request @param removeList If this parameter is null then send add request @throws APIConnectionException connect exception @throws APIRequestException request exception
[ "Add", "or", "remove", "members", "from", "a", "group" ]
train
https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L400-L411
jcuda/jcusparse
JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java
JCusparse.cusparseSgtsvStridedBatch
public static int cusparseSgtsvStridedBatch( cusparseHandle handle, int m, Pointer dl, Pointer d, Pointer du, Pointer x, int batchCount, int batchStride) { return checkResult(cusparseSgtsvStridedBatchNative(handle, m, dl, d, du, x, batchCount, batchStride)); }
java
public static int cusparseSgtsvStridedBatch( cusparseHandle handle, int m, Pointer dl, Pointer d, Pointer du, Pointer x, int batchCount, int batchStride) { return checkResult(cusparseSgtsvStridedBatchNative(handle, m, dl, d, du, x, batchCount, batchStride)); }
[ "public", "static", "int", "cusparseSgtsvStridedBatch", "(", "cusparseHandle", "handle", ",", "int", "m", ",", "Pointer", "dl", ",", "Pointer", "d", ",", "Pointer", "du", ",", "Pointer", "x", ",", "int", "batchCount", ",", "int", "batchStride", ")", "{", "...
<pre> Description: Solution of a set of tridiagonal linear systems A_{i} * x_{i} = f_{i} for i=1,...,batchCount. The coefficient matrices A_{i} are composed of lower (dl), main (d) and upper (du) diagonals and stored separated by a batchStride. Also, the right-hand-sides/solutions f_{i}/x_{i} are separated by a batchStride. </pre>
[ "<pre", ">", "Description", ":", "Solution", "of", "a", "set", "of", "tridiagonal", "linear", "systems", "A_", "{", "i", "}", "*", "x_", "{", "i", "}", "=", "f_", "{", "i", "}", "for", "i", "=", "1", "...", "batchCount", ".", "The", "coefficient", ...
train
https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L8619-L8630
alkacon/opencms-core
src/org/opencms/ui/apps/cacheadmin/CmsCacheViewApp.java
CmsCacheViewApp.getImageViewComponent
private Component getImageViewComponent() { m_siteTableFilter = new TextField(); HorizontalSplitPanel sp = new HorizontalSplitPanel(); sp.setSizeFull(); VerticalLayout intro = CmsVaadinUtils.getInfoLayout(Messages.GUI_CACHE_IMAGE_INTRODUCTION_0); VerticalLayout nullResult = CmsVaadinUtils.getInfoLayout(Messages.GUI_CACHE_IMAGE_NO_RESULTS_0); final CmsImageCacheTable table = new CmsImageCacheTable(intro, nullResult, m_siteTableFilter); sp.setFirstComponent(new CmsImageCacheInput(table)); VerticalLayout secC = new VerticalLayout(); secC.setSizeFull(); secC.addComponent(intro); secC.addComponent(nullResult); secC.addComponent(table); m_siteTableFilter.setIcon(FontOpenCms.FILTER); m_siteTableFilter.setInputPrompt( Messages.get().getBundle(UI.getCurrent().getLocale()).key(Messages.GUI_EXPLORER_FILTER_0)); m_siteTableFilter.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); m_siteTableFilter.setWidth("200px"); m_siteTableFilter.addTextChangeListener(new TextChangeListener() { private static final long serialVersionUID = 1L; public void textChange(TextChangeEvent event) { table.filterTable(event.getText()); } }); m_infoLayout.addComponent(m_siteTableFilter); m_uiContext.addToolbarButton(getImageStatisticButton()); m_uiContext.addToolbarButton(CmsFlushCache.getFlushToolButton()); table.setSizeFull(); sp.setSecondComponent(secC); sp.setSplitPosition(CmsFileExplorer.LAYOUT_SPLIT_POSITION, Unit.PIXELS); table.setVisible(false); nullResult.setVisible(false); m_siteTableFilter.setVisible(false); return sp; }
java
private Component getImageViewComponent() { m_siteTableFilter = new TextField(); HorizontalSplitPanel sp = new HorizontalSplitPanel(); sp.setSizeFull(); VerticalLayout intro = CmsVaadinUtils.getInfoLayout(Messages.GUI_CACHE_IMAGE_INTRODUCTION_0); VerticalLayout nullResult = CmsVaadinUtils.getInfoLayout(Messages.GUI_CACHE_IMAGE_NO_RESULTS_0); final CmsImageCacheTable table = new CmsImageCacheTable(intro, nullResult, m_siteTableFilter); sp.setFirstComponent(new CmsImageCacheInput(table)); VerticalLayout secC = new VerticalLayout(); secC.setSizeFull(); secC.addComponent(intro); secC.addComponent(nullResult); secC.addComponent(table); m_siteTableFilter.setIcon(FontOpenCms.FILTER); m_siteTableFilter.setInputPrompt( Messages.get().getBundle(UI.getCurrent().getLocale()).key(Messages.GUI_EXPLORER_FILTER_0)); m_siteTableFilter.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); m_siteTableFilter.setWidth("200px"); m_siteTableFilter.addTextChangeListener(new TextChangeListener() { private static final long serialVersionUID = 1L; public void textChange(TextChangeEvent event) { table.filterTable(event.getText()); } }); m_infoLayout.addComponent(m_siteTableFilter); m_uiContext.addToolbarButton(getImageStatisticButton()); m_uiContext.addToolbarButton(CmsFlushCache.getFlushToolButton()); table.setSizeFull(); sp.setSecondComponent(secC); sp.setSplitPosition(CmsFileExplorer.LAYOUT_SPLIT_POSITION, Unit.PIXELS); table.setVisible(false); nullResult.setVisible(false); m_siteTableFilter.setVisible(false); return sp; }
[ "private", "Component", "getImageViewComponent", "(", ")", "{", "m_siteTableFilter", "=", "new", "TextField", "(", ")", ";", "HorizontalSplitPanel", "sp", "=", "new", "HorizontalSplitPanel", "(", ")", ";", "sp", ".", "setSizeFull", "(", ")", ";", "VerticalLayout...
Creates the view for the image cache.<p> @return a vaadin vertical layout with the information about the image cache
[ "Creates", "the", "view", "for", "the", "image", "cache", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/cacheadmin/CmsCacheViewApp.java#L331-L376
apereo/cas
support/cas-server-support-saml-idp-metadata/src/main/java/org/apereo/cas/support/saml/services/idp/metadata/cache/resolver/BaseSamlRegisteredServiceMetadataResolver.java
BaseSamlRegisteredServiceMetadataResolver.buildRequiredValidUntilFilterIfNeeded
protected void buildRequiredValidUntilFilterIfNeeded(final SamlRegisteredService service, final List<MetadataFilter> metadataFilterList) { if (service.getMetadataMaxValidity() > 0) { val requiredValidUntilFilter = new RequiredValidUntilFilter(service.getMetadataMaxValidity()); metadataFilterList.add(requiredValidUntilFilter); LOGGER.debug("Added metadata RequiredValidUntilFilter with max validity of [{}]", service.getMetadataMaxValidity()); } else { LOGGER.debug("No metadata maximum validity criteria is defined for [{}], so RequiredValidUntilFilter will not be invoked", service.getMetadataLocation()); } }
java
protected void buildRequiredValidUntilFilterIfNeeded(final SamlRegisteredService service, final List<MetadataFilter> metadataFilterList) { if (service.getMetadataMaxValidity() > 0) { val requiredValidUntilFilter = new RequiredValidUntilFilter(service.getMetadataMaxValidity()); metadataFilterList.add(requiredValidUntilFilter); LOGGER.debug("Added metadata RequiredValidUntilFilter with max validity of [{}]", service.getMetadataMaxValidity()); } else { LOGGER.debug("No metadata maximum validity criteria is defined for [{}], so RequiredValidUntilFilter will not be invoked", service.getMetadataLocation()); } }
[ "protected", "void", "buildRequiredValidUntilFilterIfNeeded", "(", "final", "SamlRegisteredService", "service", ",", "final", "List", "<", "MetadataFilter", ">", "metadataFilterList", ")", "{", "if", "(", "service", ".", "getMetadataMaxValidity", "(", ")", ">", "0", ...
Build required valid until filter if needed. See {@link RequiredValidUntilFilter}. @param service the service @param metadataFilterList the metadata filter list
[ "Build", "required", "valid", "until", "filter", "if", "needed", ".", "See", "{", "@link", "RequiredValidUntilFilter", "}", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-metadata/src/main/java/org/apereo/cas/support/saml/services/idp/metadata/cache/resolver/BaseSamlRegisteredServiceMetadataResolver.java#L264-L273
intendia-oss/rxjava-gwt
src/main/modified/io/reactivex/super/io/reactivex/Completable.java
Completable.toSingle
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <T> Single<T> toSingle(final Callable<? extends T> completionValueSupplier) { ObjectHelper.requireNonNull(completionValueSupplier, "completionValueSupplier is null"); return RxJavaPlugins.onAssembly(new CompletableToSingle<T>(this, completionValueSupplier, null)); }
java
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <T> Single<T> toSingle(final Callable<? extends T> completionValueSupplier) { ObjectHelper.requireNonNull(completionValueSupplier, "completionValueSupplier is null"); return RxJavaPlugins.onAssembly(new CompletableToSingle<T>(this, completionValueSupplier, null)); }
[ "@", "CheckReturnValue", "@", "SchedulerSupport", "(", "SchedulerSupport", ".", "NONE", ")", "public", "final", "<", "T", ">", "Single", "<", "T", ">", "toSingle", "(", "final", "Callable", "<", "?", "extends", "T", ">", "completionValueSupplier", ")", "{", ...
Converts this Completable into a Single which when this Completable completes normally, calls the given supplier and emits its returned value through onSuccess. <p> <img width="640" height="583" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Completable.toSingle.png" alt=""> <dl> <dt><b>Scheduler:</b></dt> <dd>{@code toSingle} does not operate by default on a particular {@link Scheduler}.</dd> </dl> @param <T> the value type @param completionValueSupplier the value supplier called when this Completable completes normally @return the new Single instance @throws NullPointerException if completionValueSupplier is null
[ "Converts", "this", "Completable", "into", "a", "Single", "which", "when", "this", "Completable", "completes", "normally", "calls", "the", "given", "supplier", "and", "emits", "its", "returned", "value", "through", "onSuccess", ".", "<p", ">", "<img", "width", ...
train
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Completable.java#L2557-L2562
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.service.location/src/com/ibm/ws/kernel/service/location/internal/SymbolRegistry.java
SymbolRegistry.resolveRawSymbolicString
String resolveRawSymbolicString(String string) { if (string == null) throw new NullPointerException("String must be non-null"); return resolveStringSymbols(string, string, true, 0, false); }
java
String resolveRawSymbolicString(String string) { if (string == null) throw new NullPointerException("String must be non-null"); return resolveStringSymbols(string, string, true, 0, false); }
[ "String", "resolveRawSymbolicString", "(", "String", "string", ")", "{", "if", "(", "string", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"String must be non-null\"", ")", ";", "return", "resolveStringSymbols", "(", "string", ",", "string", "...
Resolves the given string, evaluating all symbols, but does NOT path-normalize the value. @param string @return The resolved value, not path-normalized.
[ "Resolves", "the", "given", "string", "evaluating", "all", "symbols", "but", "does", "NOT", "path", "-", "normalize", "the", "value", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service.location/src/com/ibm/ws/kernel/service/location/internal/SymbolRegistry.java#L215-L220
jbundle/jbundle
main/screen/src/main/java/org/jbundle/main/user/screen/UserPreferenceScreen.java
UserPreferenceScreen.doCommand
public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions) { if (UserPasswordChange.CHANGE_PASSWORD.equalsIgnoreCase(strCommand)) { ScreenLocation itsLocation = null; BasePanel parentScreen = this.getParentScreen(); if ((iCommandOptions & ScreenConstants.USE_NEW_WINDOW) == ScreenConstants.USE_SAME_WINDOW) // Use same window itsLocation = this.getScreenLocation(); else parentScreen = Screen.makeWindow(this.getTask().getApplication()); new UserPasswordChange(null, itsLocation, parentScreen, null, 0, null); return true; } else if (UserEntryScreen.CREATE_NEW_USER.equalsIgnoreCase(strCommand)) { ScreenLocation itsLocation = null; BasePanel parentScreen = this.getParentScreen(); if ((iCommandOptions & ScreenConstants.USE_NEW_WINDOW) == ScreenConstants.USE_SAME_WINDOW) // Use same window itsLocation = this.getScreenLocation(); else parentScreen = Screen.makeWindow(this.getTask().getApplication()); new UserEntryScreen(null, itsLocation, parentScreen, null, 0, null); // Add here todo (don) return true; } return super.doCommand(strCommand, sourceSField, iCommandOptions); }
java
public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions) { if (UserPasswordChange.CHANGE_PASSWORD.equalsIgnoreCase(strCommand)) { ScreenLocation itsLocation = null; BasePanel parentScreen = this.getParentScreen(); if ((iCommandOptions & ScreenConstants.USE_NEW_WINDOW) == ScreenConstants.USE_SAME_WINDOW) // Use same window itsLocation = this.getScreenLocation(); else parentScreen = Screen.makeWindow(this.getTask().getApplication()); new UserPasswordChange(null, itsLocation, parentScreen, null, 0, null); return true; } else if (UserEntryScreen.CREATE_NEW_USER.equalsIgnoreCase(strCommand)) { ScreenLocation itsLocation = null; BasePanel parentScreen = this.getParentScreen(); if ((iCommandOptions & ScreenConstants.USE_NEW_WINDOW) == ScreenConstants.USE_SAME_WINDOW) // Use same window itsLocation = this.getScreenLocation(); else parentScreen = Screen.makeWindow(this.getTask().getApplication()); new UserEntryScreen(null, itsLocation, parentScreen, null, 0, null); // Add here todo (don) return true; } return super.doCommand(strCommand, sourceSField, iCommandOptions); }
[ "public", "boolean", "doCommand", "(", "String", "strCommand", ",", "ScreenField", "sourceSField", ",", "int", "iCommandOptions", ")", "{", "if", "(", "UserPasswordChange", ".", "CHANGE_PASSWORD", ".", "equalsIgnoreCase", "(", "strCommand", ")", ")", "{", "ScreenL...
Process the command. <br />Step 1 - Process the command if possible and return true if processed. <br />Step 2 - If I can't process, pass to all children (with me as the source). <br />Step 3 - If children didn't process, pass to parent (with me as the source). <br />Note: Never pass to a parent or child that matches the source (to avoid an endless loop). @param strCommand The command to process. @param sourceSField The source screen field (to avoid echos). @param iCommandOptions If this command creates a new screen, create in a new window? @return true if success.
[ "Process", "the", "command", ".", "<br", "/", ">", "Step", "1", "-", "Process", "the", "command", "if", "possible", "and", "return", "true", "if", "processed", ".", "<br", "/", ">", "Step", "2", "-", "If", "I", "can", "t", "process", "pass", "to", ...
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/screen/src/main/java/org/jbundle/main/user/screen/UserPreferenceScreen.java#L166-L192
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/Evaluation.java
Evaluation.eval
public void eval(INDArray realOutcomes, INDArray guesses) { eval(realOutcomes, guesses, (List<Serializable>) null); }
java
public void eval(INDArray realOutcomes, INDArray guesses) { eval(realOutcomes, guesses, (List<Serializable>) null); }
[ "public", "void", "eval", "(", "INDArray", "realOutcomes", ",", "INDArray", "guesses", ")", "{", "eval", "(", "realOutcomes", ",", "guesses", ",", "(", "List", "<", "Serializable", ">", ")", "null", ")", ";", "}" ]
Collects statistics on the real outcomes vs the guesses. This is for logistic outcome matrices. <p> Note that an IllegalArgumentException is thrown if the two passed in matrices aren't the same length. @param realOutcomes the real outcomes (labels - usually binary) @param guesses the guesses/prediction (usually a probability vector)
[ "Collects", "statistics", "on", "the", "real", "outcomes", "vs", "the", "guesses", ".", "This", "is", "for", "logistic", "outcome", "matrices", ".", "<p", ">", "Note", "that", "an", "IllegalArgumentException", "is", "thrown", "if", "the", "two", "passed", "i...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/Evaluation.java#L351-L353
datasalt/pangool
core/src/main/java/com/datasalt/pangool/tuplemr/mapred/lib/input/PangoolMultipleInputs.java
PangoolMultipleInputs.setSpecificInputContext
public static void setSpecificInputContext(Configuration conf, String inputName, int inputId) { for (Map.Entry<String, String> entries : conf) { String confKey = entries.getKey(); String confValue = entries.getValue(); if (confKey.startsWith(MI_PREFIX + inputName + "." + inputId + CONF)) { // Specific context key, value found String contextKey = confKey.substring((MI_PREFIX + inputName + "." + inputId + CONF + ".").length(), confKey .length()); conf.set(contextKey, confValue); } } }
java
public static void setSpecificInputContext(Configuration conf, String inputName, int inputId) { for (Map.Entry<String, String> entries : conf) { String confKey = entries.getKey(); String confValue = entries.getValue(); if (confKey.startsWith(MI_PREFIX + inputName + "." + inputId + CONF)) { // Specific context key, value found String contextKey = confKey.substring((MI_PREFIX + inputName + "." + inputId + CONF + ".").length(), confKey .length()); conf.set(contextKey, confValue); } } }
[ "public", "static", "void", "setSpecificInputContext", "(", "Configuration", "conf", ",", "String", "inputName", ",", "int", "inputId", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entries", ":", "conf", ")", "{", "String"...
Iterates over the Configuration and sets the specific context found for the input in the Job instance. Package-access so it can be unit tested. The specific context is configured in method this. {@link #addInputContext(Job, String, String, String)}
[ "Iterates", "over", "the", "Configuration", "and", "sets", "the", "specific", "context", "found", "for", "the", "input", "in", "the", "Job", "instance", ".", "Package", "-", "access", "so", "it", "can", "be", "unit", "tested", ".", "The", "specific", "cont...
train
https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/tuplemr/mapred/lib/input/PangoolMultipleInputs.java#L183-L194
GerdHolz/TOVAL
src/de/invation/code/toval/graphic/diagrams/models/ScatterChartModel.java
ScatterChartModel.getValue
@Override public Number getValue(ValueDimension dim, int index) { return values.get(dim).get(index); }
java
@Override public Number getValue(ValueDimension dim, int index) { return values.get(dim).get(index); }
[ "@", "Override", "public", "Number", "getValue", "(", "ValueDimension", "dim", ",", "int", "index", ")", "{", "return", "values", ".", "get", "(", "dim", ")", ".", "get", "(", "index", ")", ";", "}" ]
Returns the value with the given index of the given dimension. @param dim Reference dimension for value extraction @param index Index of the desired value @return Value with the given index of the given dimension
[ "Returns", "the", "value", "with", "the", "given", "index", "of", "the", "given", "dimension", "." ]
train
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/graphic/diagrams/models/ScatterChartModel.java#L72-L75
mqlight/java-mqlight
mqlight/src/main/java/com/ibm/mqlight/api/impl/engine/Engine.java
Engine.writeToNetwork
private void writeToNetwork(EngineConnection engineConnection) { final String methodName = "writeToNetwork"; logger.entry(this, methodName, engineConnection); if (engineConnection.transport.pending() > 0) { ByteBuffer head = engineConnection.transport.head(); int amount = head.remaining(); engineConnection.channel.write(head, new NetworkWritePromiseImpl(this, amount, engineConnection)); engineConnection.transport.pop(amount); engineConnection.transport.tick(System.currentTimeMillis()); } logger.exit(this, methodName); }
java
private void writeToNetwork(EngineConnection engineConnection) { final String methodName = "writeToNetwork"; logger.entry(this, methodName, engineConnection); if (engineConnection.transport.pending() > 0) { ByteBuffer head = engineConnection.transport.head(); int amount = head.remaining(); engineConnection.channel.write(head, new NetworkWritePromiseImpl(this, amount, engineConnection)); engineConnection.transport.pop(amount); engineConnection.transport.tick(System.currentTimeMillis()); } logger.exit(this, methodName); }
[ "private", "void", "writeToNetwork", "(", "EngineConnection", "engineConnection", ")", "{", "final", "String", "methodName", "=", "\"writeToNetwork\"", ";", "logger", ".", "entry", "(", "this", ",", "methodName", ",", "engineConnection", ")", ";", "if", "(", "en...
Drains any pending data from a Proton transport object onto the network
[ "Drains", "any", "pending", "data", "from", "a", "Proton", "transport", "object", "onto", "the", "network" ]
train
https://github.com/mqlight/java-mqlight/blob/a565dfa6044050826d1221697da9e3268b557aeb/mqlight/src/main/java/com/ibm/mqlight/api/impl/engine/Engine.java#L440-L453
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/ObjectExtensions.java
ObjectExtensions.operator_notEquals
@Pure @Inline(value="(!$3.equal($1, $2))", imported=Objects.class) public static boolean operator_notEquals(Object a, Object b) { return !Objects.equal(a, b); }
java
@Pure @Inline(value="(!$3.equal($1, $2))", imported=Objects.class) public static boolean operator_notEquals(Object a, Object b) { return !Objects.equal(a, b); }
[ "@", "Pure", "@", "Inline", "(", "value", "=", "\"(!$3.equal($1, $2))\"", ",", "imported", "=", "Objects", ".", "class", ")", "public", "static", "boolean", "operator_notEquals", "(", "Object", "a", ",", "Object", "b", ")", "{", "return", "!", "Objects", "...
The <code>equals not</code> operator. This is the equivalent to a negated, null-safe {@link Object#equals(Object)} method. @param a an object. @param b another object. @return <code>true</code> if {@code a} and {@code b} are not equal.
[ "The", "<code", ">", "equals", "not<", "/", "code", ">", "operator", ".", "This", "is", "the", "equivalent", "to", "a", "negated", "null", "-", "safe", "{", "@link", "Object#equals", "(", "Object", ")", "}", "method", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/ObjectExtensions.java#L30-L34
m-m-m/util
nls/src/main/java/net/sf/mmm/util/nls/base/NlsCachingLocalizer.java
NlsCachingLocalizer.parseTemplate
protected NlsTemplate parseTemplate(String internationalizedMessage) { Matcher matcher = TEMPLATE_PATTERN.matcher(internationalizedMessage); if (matcher.matches()) { String name = matcher.group(2); if (name == null) { name = this.bundleName; } String key = matcher.group(3); return new NlsTemplateImpl(name, key); } return null; }
java
protected NlsTemplate parseTemplate(String internationalizedMessage) { Matcher matcher = TEMPLATE_PATTERN.matcher(internationalizedMessage); if (matcher.matches()) { String name = matcher.group(2); if (name == null) { name = this.bundleName; } String key = matcher.group(3); return new NlsTemplateImpl(name, key); } return null; }
[ "protected", "NlsTemplate", "parseTemplate", "(", "String", "internationalizedMessage", ")", "{", "Matcher", "matcher", "=", "TEMPLATE_PATTERN", ".", "matcher", "(", "internationalizedMessage", ")", ";", "if", "(", "matcher", ".", "matches", "(", ")", ")", "{", ...
This method parses the given {@code internationalizedMessage} as {@link NlsTemplate} in case it is given in the form {{@literal <BUNDLE>#<KEY>}}. @param internationalizedMessage is the template specified in the form described above or the {@link NlsMessage#getInternationalizedMessage() internationalized message}. @return the {@link NlsTemplate} if the {@code internationalizedMessage} has the form described above or {@code null} otherwise.
[ "This", "method", "parses", "the", "given", "{", "@code", "internationalizedMessage", "}", "as", "{", "@link", "NlsTemplate", "}", "in", "case", "it", "is", "given", "in", "the", "form", "{{", "@literal", "<BUNDLE", ">", "#<KEY", ">", "}}", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/nls/src/main/java/net/sf/mmm/util/nls/base/NlsCachingLocalizer.java#L103-L115
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/handler/ClientSideHandlerGeneratorImpl.java
ClientSideHandlerGeneratorImpl.getPathPrefix
private String getPathPrefix(HttpServletRequest request, JawrConfig config) { if (request.isSecure()) { if (null != config.getContextPathSslOverride()) { return config.getContextPathSslOverride(); } } else { if (null != config.getContextPathOverride()) { return config.getContextPathOverride(); } } String mapping = null == config.getServletMapping() ? "" : config.getServletMapping(); String path = PathNormalizer.joinPaths(request.getContextPath(), mapping); path = path.endsWith("/") ? path : path + '/'; return path; }
java
private String getPathPrefix(HttpServletRequest request, JawrConfig config) { if (request.isSecure()) { if (null != config.getContextPathSslOverride()) { return config.getContextPathSslOverride(); } } else { if (null != config.getContextPathOverride()) { return config.getContextPathOverride(); } } String mapping = null == config.getServletMapping() ? "" : config.getServletMapping(); String path = PathNormalizer.joinPaths(request.getContextPath(), mapping); path = path.endsWith("/") ? path : path + '/'; return path; }
[ "private", "String", "getPathPrefix", "(", "HttpServletRequest", "request", ",", "JawrConfig", "config", ")", "{", "if", "(", "request", ".", "isSecure", "(", ")", ")", "{", "if", "(", "null", "!=", "config", ".", "getContextPathSslOverride", "(", ")", ")", ...
Determines which prefix should be used for the links, according to the context path override if present, or using the context path and possibly the jawr mapping. @param request the request @return the path prefix
[ "Determines", "which", "prefix", "should", "be", "used", "for", "the", "links", "according", "to", "the", "context", "path", "override", "if", "present", "or", "using", "the", "context", "path", "and", "possibly", "the", "jawr", "mapping", "." ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/handler/ClientSideHandlerGeneratorImpl.java#L217-L233
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/SRTServletRequestUtils.java
SRTServletRequestUtils.getPrivateAttribute
public static Object getPrivateAttribute(HttpServletRequest req, String key) { HttpServletRequest sr = getWrappedServletRequestObject(req); if (sr instanceof IPrivateRequestAttributes) { return ((IPrivateRequestAttributes) sr).getPrivateAttribute(key); } else { if (tc.isDebugEnabled()) { Tr.debug(tc, "getPrivateAttribute called for non-IPrivateRequestAttributes object", req); } return null; } }
java
public static Object getPrivateAttribute(HttpServletRequest req, String key) { HttpServletRequest sr = getWrappedServletRequestObject(req); if (sr instanceof IPrivateRequestAttributes) { return ((IPrivateRequestAttributes) sr).getPrivateAttribute(key); } else { if (tc.isDebugEnabled()) { Tr.debug(tc, "getPrivateAttribute called for non-IPrivateRequestAttributes object", req); } return null; } }
[ "public", "static", "Object", "getPrivateAttribute", "(", "HttpServletRequest", "req", ",", "String", "key", ")", "{", "HttpServletRequest", "sr", "=", "getWrappedServletRequestObject", "(", "req", ")", ";", "if", "(", "sr", "instanceof", "IPrivateRequestAttributes", ...
Get private attribute value from the request (if applicable). If the request object is of an unexpected type, a {@code null} is returned. @param req @param key @return The attribute value, or {@code null} if the object type is unexpected @see IPrivateRequestAttributes#getPrivateAttribute(String)
[ "Get", "private", "attribute", "value", "from", "the", "request", "(", "if", "applicable", ")", ".", "If", "the", "request", "object", "is", "of", "an", "unexpected", "type", "a", "{", "@code", "null", "}", "is", "returned", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/SRTServletRequestUtils.java#L36-L46
io7m/jaffirm
com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Invariants.java
Invariants.checkInvariantD
public static double checkInvariantD( final double value, final ContractDoubleConditionType condition) throws InvariantViolationException { return checkInvariantD(value, condition.predicate(), condition.describer()); }
java
public static double checkInvariantD( final double value, final ContractDoubleConditionType condition) throws InvariantViolationException { return checkInvariantD(value, condition.predicate(), condition.describer()); }
[ "public", "static", "double", "checkInvariantD", "(", "final", "double", "value", ",", "final", "ContractDoubleConditionType", "condition", ")", "throws", "InvariantViolationException", "{", "return", "checkInvariantD", "(", "value", ",", "condition", ".", "predicate", ...
A {@code double} specialized version of {@link #checkInvariant(Object, ContractConditionType)}. @param value The value @param condition The predicate @return value @throws InvariantViolationException If the predicate is false
[ "A", "{", "@code", "double", "}", "specialized", "version", "of", "{", "@link", "#checkInvariant", "(", "Object", "ContractConditionType", ")", "}", "." ]
train
https://github.com/io7m/jaffirm/blob/c97d246242d381e48832838737418cfe4cb57b4d/com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Invariants.java#L500-L506
wellner/jcarafe
jcarafe-core/src/main/java/cern/colt/list/BooleanArrayList.java
BooleanArrayList.countSortFromTo
public void countSortFromTo(int from, int to) { if (size==0) return; checkRangeFromTo(from, to, size); boolean[] theElements = elements; int trues = 0; for (int i=from; i<=to;) if (theElements[i++]) trues++; int falses = to-from+1-trues; if (falses>0) fillFromToWith(from,from+falses-1,false); if (trues>0) fillFromToWith(from+falses,from+falses-1+trues,true); }
java
public void countSortFromTo(int from, int to) { if (size==0) return; checkRangeFromTo(from, to, size); boolean[] theElements = elements; int trues = 0; for (int i=from; i<=to;) if (theElements[i++]) trues++; int falses = to-from+1-trues; if (falses>0) fillFromToWith(from,from+falses-1,false); if (trues>0) fillFromToWith(from+falses,from+falses-1+trues,true); }
[ "public", "void", "countSortFromTo", "(", "int", "from", ",", "int", "to", ")", "{", "if", "(", "size", "==", "0", ")", "return", ";", "checkRangeFromTo", "(", "from", ",", "to", ",", "size", ")", ";", "boolean", "[", "]", "theElements", "=", "elemen...
Sorts the specified range of the receiver into ascending numerical order (<tt>false &lt; true</tt>). The sorting algorithm is a count sort. This algorithm offers guaranteed O(n) performance without auxiliary memory. @param from the index of the first element (inclusive) to be sorted. @param to the index of the last element (inclusive) to be sorted.
[ "Sorts", "the", "specified", "range", "of", "the", "receiver", "into", "ascending", "numerical", "order", "(", "<tt", ">", "false", "&lt", ";", "true<", "/", "tt", ">", ")", "." ]
train
https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/list/BooleanArrayList.java#L108-L119
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java
ImageMiscOps.rotateCCW
public static void rotateCCW( GrayS64 input , GrayS64 output ) { if( input.width != output.height || input.height != output.width ) throw new IllegalArgumentException("Incompatible shapes"); int w = input.width-1; for( int y = 0; y < input.height; y++ ) { int indexIn = input.startIndex + y*input.stride; for (int x = 0; x < input.width; x++) { output.unsafe_set(y,w-x,input.data[indexIn++]); } } }
java
public static void rotateCCW( GrayS64 input , GrayS64 output ) { if( input.width != output.height || input.height != output.width ) throw new IllegalArgumentException("Incompatible shapes"); int w = input.width-1; for( int y = 0; y < input.height; y++ ) { int indexIn = input.startIndex + y*input.stride; for (int x = 0; x < input.width; x++) { output.unsafe_set(y,w-x,input.data[indexIn++]); } } }
[ "public", "static", "void", "rotateCCW", "(", "GrayS64", "input", ",", "GrayS64", "output", ")", "{", "if", "(", "input", ".", "width", "!=", "output", ".", "height", "||", "input", ".", "height", "!=", "output", ".", "width", ")", "throw", "new", "Ill...
Rotates the image 90 degrees in the counter-clockwise direction.
[ "Rotates", "the", "image", "90", "degrees", "in", "the", "counter", "-", "clockwise", "direction", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java#L2152-L2164
BorderTech/wcomponents
wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/datatable/TreeTableHierarchyExample.java
TreeTableHierarchyExample.createTable
private WDataTable createTable() { WDataTable tbl = new WDataTable(); tbl.setType(WDataTable.Type.HIERARCHIC); tbl.addColumn(new WTableColumn("First name", new WText())); tbl.addColumn(new WTableColumn("Last name", new WText())); tbl.addColumn(new WTableColumn("DOB", new WDateField())); tbl.setExpandMode(ExpandMode.CLIENT); tbl.setStripingType(WDataTable.StripingType.ROWS); TableTreeNode root = createTree(); tbl.setDataModel(new ExampleTreeTableModel(root)); return tbl; }
java
private WDataTable createTable() { WDataTable tbl = new WDataTable(); tbl.setType(WDataTable.Type.HIERARCHIC); tbl.addColumn(new WTableColumn("First name", new WText())); tbl.addColumn(new WTableColumn("Last name", new WText())); tbl.addColumn(new WTableColumn("DOB", new WDateField())); tbl.setExpandMode(ExpandMode.CLIENT); tbl.setStripingType(WDataTable.StripingType.ROWS); TableTreeNode root = createTree(); tbl.setDataModel(new ExampleTreeTableModel(root)); return tbl; }
[ "private", "WDataTable", "createTable", "(", ")", "{", "WDataTable", "tbl", "=", "new", "WDataTable", "(", ")", ";", "tbl", ".", "setType", "(", "WDataTable", ".", "Type", ".", "HIERARCHIC", ")", ";", "tbl", ".", "addColumn", "(", "new", "WTableColumn", ...
Creates and configures the table to be used by the example. The table is configured with global rather than user data. Although this is not a realistic scenario, it will suffice for this example. @return a new configured table.
[ "Creates", "and", "configures", "the", "table", "to", "be", "used", "by", "the", "example", ".", "The", "table", "is", "configured", "with", "global", "rather", "than", "user", "data", ".", "Although", "this", "is", "not", "a", "realistic", "scenario", "it...
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/datatable/TreeTableHierarchyExample.java#L44-L57