repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
JOML-CI/JOML
src/org/joml/Intersectionf.java
Intersectionf.distancePointLine
public static float distancePointLine(float pointX, float pointY, float x0, float y0, float x1, float y1) { float dx = x1 - x0; float dy = y1 - y0; float denom = (float) Math.sqrt(dx * dx + dy * dy); return (dx * (y0 - pointY) - (x0 - pointX) * dy) / denom; }
java
public static float distancePointLine(float pointX, float pointY, float x0, float y0, float x1, float y1) { float dx = x1 - x0; float dy = y1 - y0; float denom = (float) Math.sqrt(dx * dx + dy * dy); return (dx * (y0 - pointY) - (x0 - pointX) * dy) / denom; }
[ "public", "static", "float", "distancePointLine", "(", "float", "pointX", ",", "float", "pointY", ",", "float", "x0", ",", "float", "y0", ",", "float", "x1", ",", "float", "y1", ")", "{", "float", "dx", "=", "x1", "-", "x0", ";", "float", "dy", "=", ...
Determine the signed distance of the given point <code>(pointX, pointY)</code> to the line defined by the two points <code>(x0, y0)</code> and <code>(x1, y1)</code>. <p> Reference: <a href="http://mathworld.wolfram.com/Point-LineDistance2-Dimensional.html">http://mathworld.wolfram.com</a> @param pointX the x coordinate of the point @param pointY the y coordinate of the point @param x0 the x coordinate of the first point on the line @param y0 the y coordinate of the first point on the line @param x1 the x coordinate of the second point on the line @param y1 the y coordinate of the second point on the line @return the distance between the point and the line
[ "Determine", "the", "signed", "distance", "of", "the", "given", "point", "<code", ">", "(", "pointX", "pointY", ")", "<", "/", "code", ">", "to", "the", "line", "defined", "by", "the", "two", "points", "<code", ">", "(", "x0", "y0", ")", "<", "/", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectionf.java#L3850-L3855
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java
ForkJoinPool.inactivate
private void inactivate(WorkQueue w, int ss) { int ns = (ss + SS_SEQ) | UNSIGNALLED; long lc = ns & SP_MASK, nc, c; if (w != null) { w.scanState = ns; do { nc = lc | (UC_MASK & ((c = ctl) - AC_UNIT)); w.stackPred = (int)c; } while (!U.compareAndSwapLong(this, CTL, c, nc)); } }
java
private void inactivate(WorkQueue w, int ss) { int ns = (ss + SS_SEQ) | UNSIGNALLED; long lc = ns & SP_MASK, nc, c; if (w != null) { w.scanState = ns; do { nc = lc | (UC_MASK & ((c = ctl) - AC_UNIT)); w.stackPred = (int)c; } while (!U.compareAndSwapLong(this, CTL, c, nc)); } }
[ "private", "void", "inactivate", "(", "WorkQueue", "w", ",", "int", "ss", ")", "{", "int", "ns", "=", "(", "ss", "+", "SS_SEQ", ")", "|", "UNSIGNALLED", ";", "long", "lc", "=", "ns", "&", "SP_MASK", ",", "nc", ",", "c", ";", "if", "(", "w", "!=...
If worker w exists and is active, enqueues and sets status to inactive. @param w the worker @param ss current (non-negative) scanState
[ "If", "worker", "w", "exists", "and", "is", "active", "enqueues", "and", "sets", "status", "to", "inactive", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java#L1775-L1785
FrodeRanders/java-vopn
src/main/java/org/gautelis/vopn/lang/Date.java
Date.validateDateFormat
public static boolean validateDateFormat(String date, Locale locale) { SimpleDateFormat df; SimpleDateFormat sdf; java.text.ParsePosition pos; java.util.Date dbDate; dbDate = null; try { if (date == null || date.equals("")) { return false; } df = (SimpleDateFormat) DateFormat.getDateInstance( dateStyle, locale ); sdf = new SimpleDateFormat(df.toPattern()); pos = new java.text.ParsePosition(0); sdf.setLenient(false); dbDate = sdf.parse(date, pos); return dbDate != null && dbDate.getTime() > 0L; } catch (Exception e) { return false; } }
java
public static boolean validateDateFormat(String date, Locale locale) { SimpleDateFormat df; SimpleDateFormat sdf; java.text.ParsePosition pos; java.util.Date dbDate; dbDate = null; try { if (date == null || date.equals("")) { return false; } df = (SimpleDateFormat) DateFormat.getDateInstance( dateStyle, locale ); sdf = new SimpleDateFormat(df.toPattern()); pos = new java.text.ParsePosition(0); sdf.setLenient(false); dbDate = sdf.parse(date, pos); return dbDate != null && dbDate.getTime() > 0L; } catch (Exception e) { return false; } }
[ "public", "static", "boolean", "validateDateFormat", "(", "String", "date", ",", "Locale", "locale", ")", "{", "SimpleDateFormat", "df", ";", "SimpleDateFormat", "sdf", ";", "java", ".", "text", ".", "ParsePosition", "pos", ";", "java", ".", "util", ".", "Da...
Validates the users inputted date value @param date The Date in String form @param locale Check format according to this locale @return true if user inputted corect format, otherwise false
[ "Validates", "the", "users", "inputted", "date", "value" ]
train
https://github.com/FrodeRanders/java-vopn/blob/4c7b2f90201327af4eaa3cd46b3fee68f864e5cc/src/main/java/org/gautelis/vopn/lang/Date.java#L81-L108
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java
UnicodeSet.applyIntPropertyValue
public UnicodeSet applyIntPropertyValue(int prop, int value) { checkFrozen(); if (prop == UProperty.GENERAL_CATEGORY_MASK) { applyFilter(new GeneralCategoryMaskFilter(value), UCharacterProperty.SRC_CHAR); } else if (prop == UProperty.SCRIPT_EXTENSIONS) { applyFilter(new ScriptExtensionsFilter(value), UCharacterProperty.SRC_PROPSVEC); } else { applyFilter(new IntPropertyFilter(prop, value), UCharacterProperty.INSTANCE.getSource(prop)); } return this; }
java
public UnicodeSet applyIntPropertyValue(int prop, int value) { checkFrozen(); if (prop == UProperty.GENERAL_CATEGORY_MASK) { applyFilter(new GeneralCategoryMaskFilter(value), UCharacterProperty.SRC_CHAR); } else if (prop == UProperty.SCRIPT_EXTENSIONS) { applyFilter(new ScriptExtensionsFilter(value), UCharacterProperty.SRC_PROPSVEC); } else { applyFilter(new IntPropertyFilter(prop, value), UCharacterProperty.INSTANCE.getSource(prop)); } return this; }
[ "public", "UnicodeSet", "applyIntPropertyValue", "(", "int", "prop", ",", "int", "value", ")", "{", "checkFrozen", "(", ")", ";", "if", "(", "prop", "==", "UProperty", ".", "GENERAL_CATEGORY_MASK", ")", "{", "applyFilter", "(", "new", "GeneralCategoryMaskFilter"...
Modifies this set to contain those code points which have the given value for the given binary or enumerated property, as returned by UCharacter.getIntPropertyValue. Prior contents of this set are lost. @param prop a property in the range UProperty.BIN_START..UProperty.BIN_LIMIT-1 or UProperty.INT_START..UProperty.INT_LIMIT-1 or. UProperty.MASK_START..UProperty.MASK_LIMIT-1. @param value a value in the range UCharacter.getIntPropertyMinValue(prop).. UCharacter.getIntPropertyMaxValue(prop), with one exception. If prop is UProperty.GENERAL_CATEGORY_MASK, then value should not be a UCharacter.getType() result, but rather a mask value produced by logically ORing (1 &lt;&lt; UCharacter.getType()) values together. This allows grouped categories such as [:L:] to be represented. @return a reference to this set
[ "Modifies", "this", "set", "to", "contain", "those", "code", "points", "which", "have", "the", "given", "value", "for", "the", "given", "binary", "or", "enumerated", "property", "as", "returned", "by", "UCharacter", ".", "getIntPropertyValue", ".", "Prior", "c...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java#L3310-L3320
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java
DateSpinner.compareCalendarDates
static int compareCalendarDates(@NonNull Calendar first, @NonNull Calendar second) { final int firstYear = first.get(Calendar.YEAR); final int secondYear = second.get(Calendar.YEAR); final int firstDay = first.get(Calendar.DAY_OF_YEAR); final int secondDay = second.get(Calendar.DAY_OF_YEAR); if(firstYear == secondYear) { if(firstDay == secondDay) return 0; else if(firstDay < secondDay) return -1; else return 1; } else if(firstYear < secondYear) return -1; else return 1; }
java
static int compareCalendarDates(@NonNull Calendar first, @NonNull Calendar second) { final int firstYear = first.get(Calendar.YEAR); final int secondYear = second.get(Calendar.YEAR); final int firstDay = first.get(Calendar.DAY_OF_YEAR); final int secondDay = second.get(Calendar.DAY_OF_YEAR); if(firstYear == secondYear) { if(firstDay == secondDay) return 0; else if(firstDay < secondDay) return -1; else return 1; } else if(firstYear < secondYear) return -1; else return 1; }
[ "static", "int", "compareCalendarDates", "(", "@", "NonNull", "Calendar", "first", ",", "@", "NonNull", "Calendar", "second", ")", "{", "final", "int", "firstYear", "=", "first", ".", "get", "(", "Calendar", ".", "YEAR", ")", ";", "final", "int", "secondYe...
Compares the two given Calendar objects, only counting the date, not time. @return -1 if first comes before second, 0 if both are the same day, 1 if second is before first.
[ "Compares", "the", "two", "given", "Calendar", "objects", "only", "counting", "the", "date", "not", "time", "." ]
train
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java#L438-L455
BorderTech/wcomponents
wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/transientcontainer/ExampleTablePanel.java
ExampleTablePanel.setData
public void setData(final List data) { // Bean properties to render String[] properties = new String[]{"colour", "shape", "animal"}; simpleTable.setDataModel(new SimpleBeanListTableDataModel(properties, data)); }
java
public void setData(final List data) { // Bean properties to render String[] properties = new String[]{"colour", "shape", "animal"}; simpleTable.setDataModel(new SimpleBeanListTableDataModel(properties, data)); }
[ "public", "void", "setData", "(", "final", "List", "data", ")", "{", "// Bean properties to render", "String", "[", "]", "properties", "=", "new", "String", "[", "]", "{", "\"colour\"", ",", "\"shape\"", ",", "\"animal\"", "}", ";", "simpleTable", ".", "setD...
Sets the table data. @param data a list of {@link ExampleDataBean}s.
[ "Sets", "the", "table", "data", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/transientcontainer/ExampleTablePanel.java#L46-L51
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/variant/css/CssSkinVariantResourceProviderStrategy.java
CssSkinVariantResourceProviderStrategy.initVariantProviderStrategy
@Override public void initVariantProviderStrategy(GeneratorContext context, Map<String, VariantSet> variantsSetMap) { List<Map<String, String>> variantMapStrategies = new ArrayList<>(); Map<String, String> ctxVariantMap = context.getVariantMap(); VariantSet skinVariantSet = variantsSetMap.get(JawrConstant.SKIN_VARIANT_TYPE); String skinVariant = ctxVariantMap.get(JawrConstant.SKIN_VARIANT_TYPE); VariantSet localeVariantSet = variantsSetMap.get(JawrConstant.LOCALE_VARIANT_TYPE); String localeVariant = ctxVariantMap.get(JawrConstant.LOCALE_VARIANT_TYPE); variantMapStrategies.add(getVariantMap(skinVariant, localeVariant)); if (localeVariantSet != null) { variantMapStrategies.add(getVariantMap(skinVariant, localeVariantSet.getDefaultVariant())); } variantMapStrategies.add(getVariantMap(skinVariantSet.getDefaultVariant(), localeVariant)); if (localeVariantSet != null) { variantMapStrategies .add(getVariantMap(skinVariantSet.getDefaultVariant(), localeVariantSet.getDefaultVariant())); } variantMapStrategyIterator = variantMapStrategies.iterator(); }
java
@Override public void initVariantProviderStrategy(GeneratorContext context, Map<String, VariantSet> variantsSetMap) { List<Map<String, String>> variantMapStrategies = new ArrayList<>(); Map<String, String> ctxVariantMap = context.getVariantMap(); VariantSet skinVariantSet = variantsSetMap.get(JawrConstant.SKIN_VARIANT_TYPE); String skinVariant = ctxVariantMap.get(JawrConstant.SKIN_VARIANT_TYPE); VariantSet localeVariantSet = variantsSetMap.get(JawrConstant.LOCALE_VARIANT_TYPE); String localeVariant = ctxVariantMap.get(JawrConstant.LOCALE_VARIANT_TYPE); variantMapStrategies.add(getVariantMap(skinVariant, localeVariant)); if (localeVariantSet != null) { variantMapStrategies.add(getVariantMap(skinVariant, localeVariantSet.getDefaultVariant())); } variantMapStrategies.add(getVariantMap(skinVariantSet.getDefaultVariant(), localeVariant)); if (localeVariantSet != null) { variantMapStrategies .add(getVariantMap(skinVariantSet.getDefaultVariant(), localeVariantSet.getDefaultVariant())); } variantMapStrategyIterator = variantMapStrategies.iterator(); }
[ "@", "Override", "public", "void", "initVariantProviderStrategy", "(", "GeneratorContext", "context", ",", "Map", "<", "String", ",", "VariantSet", ">", "variantsSetMap", ")", "{", "List", "<", "Map", "<", "String", ",", "String", ">", ">", "variantMapStrategies...
Initialize the variant resource provider strategy @param context the generator context @param variantsSetMap the variant set map for the current context path
[ "Initialize", "the", "variant", "resource", "provider", "strategy" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/variant/css/CssSkinVariantResourceProviderStrategy.java#L53-L75
auth0/Lock.Android
lib/src/main/java/com/auth0/android/lock/views/AuthConfig.java
AuthConfig.getIdForResource
int getIdForResource(@NonNull Context context, @StyleableRes int index) { final int[] attrs = new int[]{index}; final TypedArray typedArray = context.getTheme().obtainStyledAttributes(styleRes, attrs); int id = typedArray.getResourceId(0, -1); typedArray.recycle(); return id; }
java
int getIdForResource(@NonNull Context context, @StyleableRes int index) { final int[] attrs = new int[]{index}; final TypedArray typedArray = context.getTheme().obtainStyledAttributes(styleRes, attrs); int id = typedArray.getResourceId(0, -1); typedArray.recycle(); return id; }
[ "int", "getIdForResource", "(", "@", "NonNull", "Context", "context", ",", "@", "StyleableRes", "int", "index", ")", "{", "final", "int", "[", "]", "attrs", "=", "new", "int", "[", "]", "{", "index", "}", ";", "final", "TypedArray", "typedArray", "=", ...
Retrieves the resource id of the given Style index. @param context a valid Context @param index The index to search on the Style definition. @return the id if found or -1.
[ "Retrieves", "the", "resource", "id", "of", "the", "given", "Style", "index", "." ]
train
https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/views/AuthConfig.java#L65-L71
looly/hutool
hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java
SqlExecutor.executeBatch
public static int[] executeBatch(Connection conn, String... sqls) throws SQLException { return executeBatch(conn, new ArrayIter<String>(sqls)); }
java
public static int[] executeBatch(Connection conn, String... sqls) throws SQLException { return executeBatch(conn, new ArrayIter<String>(sqls)); }
[ "public", "static", "int", "[", "]", "executeBatch", "(", "Connection", "conn", ",", "String", "...", "sqls", ")", "throws", "SQLException", "{", "return", "executeBatch", "(", "conn", ",", "new", "ArrayIter", "<", "String", ">", "(", "sqls", ")", ")", "...
批量执行非查询语句<br> 语句包括 插入、更新、删除<br> 此方法不会关闭Connection @param conn 数据库连接对象 @param sqls SQL列表 @return 每个SQL执行影响的行数 @throws SQLException SQL执行异常 @since 4.5.6
[ "批量执行非查询语句<br", ">", "语句包括", "插入、更新、删除<br", ">", "此方法不会关闭Connection" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java#L200-L202
phax/ph-commons
ph-dao/src/main/java/com/helger/dao/wal/AbstractMapBasedWALDAO.java
AbstractMapBasedWALDAO.internalDeleteItem
@MustBeLocked (ELockType.WRITE) @Nullable protected final IMPLTYPE internalDeleteItem (@Nullable final String sID) { return internalDeleteItem (sID, true); }
java
@MustBeLocked (ELockType.WRITE) @Nullable protected final IMPLTYPE internalDeleteItem (@Nullable final String sID) { return internalDeleteItem (sID, true); }
[ "@", "MustBeLocked", "(", "ELockType", ".", "WRITE", ")", "@", "Nullable", "protected", "final", "IMPLTYPE", "internalDeleteItem", "(", "@", "Nullable", "final", "String", "sID", ")", "{", "return", "internalDeleteItem", "(", "sID", ",", "true", ")", ";", "}...
Delete the item by removing it from the map. If something was remove the onDeleteItem callback is invoked. Must only be invoked inside a write-lock. @param sID The ID to be removed. May be <code>null</code>. @return The deleted item. If <code>null</code> no such item was found and therefore nothing was removed.
[ "Delete", "the", "item", "by", "removing", "it", "from", "the", "map", ".", "If", "something", "was", "remove", "the", "onDeleteItem", "callback", "is", "invoked", ".", "Must", "only", "be", "invoked", "inside", "a", "write", "-", "lock", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-dao/src/main/java/com/helger/dao/wal/AbstractMapBasedWALDAO.java#L386-L391
samskivert/pythagoras
src/main/java/pythagoras/d/Points.java
Points.pointToString
public static String pointToString (double x, double y) { return MathUtil.toString(x) + MathUtil.toString(y); }
java
public static String pointToString (double x, double y) { return MathUtil.toString(x) + MathUtil.toString(y); }
[ "public", "static", "String", "pointToString", "(", "double", "x", ",", "double", "y", ")", "{", "return", "MathUtil", ".", "toString", "(", "x", ")", "+", "MathUtil", ".", "toString", "(", "y", ")", ";", "}" ]
Returns a string describing the supplied point, of the form <code>+x+y</code>, <code>+x-y</code>, <code>-x-y</code>, etc.
[ "Returns", "a", "string", "describing", "the", "supplied", "point", "of", "the", "form", "<code", ">", "+", "x", "+", "y<", "/", "code", ">", "<code", ">", "+", "x", "-", "y<", "/", "code", ">", "<code", ">", "-", "x", "-", "y<", "/", "code", "...
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Points.java#L77-L79
xvik/generics-resolver
src/main/java/ru/vyarus/java/generics/resolver/util/TypeVariableUtils.java
TypeVariableUtils.matchVariables
public static Map<TypeVariable, Type> matchVariables(final Type template, final Type real) { final MatchVariablesVisitor visitor = new MatchVariablesVisitor(); TypesWalker.walk(template, real, visitor); if (visitor.isHierarchyError()) { throw new IllegalArgumentException(String.format( "Type %s variables can't be matched from type %s because they " + "are not compatible", TypeToStringUtils.toStringTypeIgnoringVariables(template), TypeToStringUtils.toStringTypeIgnoringVariables(real))); } final Map<TypeVariable, Type> res = visitor.getMatched(); // to be sure that right type does not contain variables for (Map.Entry<TypeVariable, Type> entry : res.entrySet()) { entry.setValue(resolveAllTypeVariables(entry.getValue(), visitor.getMatchedMap())); } return res; }
java
public static Map<TypeVariable, Type> matchVariables(final Type template, final Type real) { final MatchVariablesVisitor visitor = new MatchVariablesVisitor(); TypesWalker.walk(template, real, visitor); if (visitor.isHierarchyError()) { throw new IllegalArgumentException(String.format( "Type %s variables can't be matched from type %s because they " + "are not compatible", TypeToStringUtils.toStringTypeIgnoringVariables(template), TypeToStringUtils.toStringTypeIgnoringVariables(real))); } final Map<TypeVariable, Type> res = visitor.getMatched(); // to be sure that right type does not contain variables for (Map.Entry<TypeVariable, Type> entry : res.entrySet()) { entry.setValue(resolveAllTypeVariables(entry.getValue(), visitor.getMatchedMap())); } return res; }
[ "public", "static", "Map", "<", "TypeVariable", ",", "Type", ">", "matchVariables", "(", "final", "Type", "template", ",", "final", "Type", "real", ")", "{", "final", "MatchVariablesVisitor", "visitor", "=", "new", "MatchVariablesVisitor", "(", ")", ";", "Type...
Match explicit variables ({@link ExplicitTypeVariable}) in type with provided type. For example, suppose you have type {@code List<E>} (with {@link ExplicitTypeVariable} as E variable) and real type {@code List<String>}. This method will match variable E to String from real type. <p> WARNING: if provided template type will contain {@link TypeVariable} - they would not be detected! Because method resolve all variables to it's raw declaration. Use {@link #preserveVariables(Type)} in order to replace variables before matching. It is not dont automatically to avoid redundant calls (this api considered as low level api). @param template type with variables @param real type to compare and resolve variables from @return map of resolved variables or empty map @throws IllegalArgumentException when provided types are nto compatible @see #trackRootVariables(Class, List) for variables tracking form root class @see #preserveVariables(Type) for variables preserving in types
[ "Match", "explicit", "variables", "(", "{", "@link", "ExplicitTypeVariable", "}", ")", "in", "type", "with", "provided", "type", ".", "For", "example", "suppose", "you", "have", "type", "{", "@code", "List<E", ">", "}", "(", "with", "{", "@link", "Explicit...
train
https://github.com/xvik/generics-resolver/blob/d7d9d2783265df1178230e8f0b7cb6d853b67a7b/src/main/java/ru/vyarus/java/generics/resolver/util/TypeVariableUtils.java#L98-L114
phax/ph-web
ph-xservlet/src/main/java/com/helger/xservlet/AbstractXServlet.java
AbstractXServlet.logInvalidRequestSetup
@OverrideOnDemand protected void logInvalidRequestSetup (@Nonnull final String sMsg, @Nonnull final HttpServletRequest aHttpRequest) { log (sMsg + ":\n" + RequestLogger.getRequestDebugString (aHttpRequest).toString ()); }
java
@OverrideOnDemand protected void logInvalidRequestSetup (@Nonnull final String sMsg, @Nonnull final HttpServletRequest aHttpRequest) { log (sMsg + ":\n" + RequestLogger.getRequestDebugString (aHttpRequest).toString ()); }
[ "@", "OverrideOnDemand", "protected", "void", "logInvalidRequestSetup", "(", "@", "Nonnull", "final", "String", "sMsg", ",", "@", "Nonnull", "final", "HttpServletRequest", "aHttpRequest", ")", "{", "log", "(", "sMsg", "+", "\":\\n\"", "+", "RequestLogger", ".", ...
This method logs errors, in case a HttpServletRequest object is missing basic information or uses unsupported values for e.g. HTTP version and HTTP method. @param sMsg The concrete message to emit. May not be <code>null</code>. @param aHttpRequest The current HTTP request. May not be <code>null</code>.
[ "This", "method", "logs", "errors", "in", "case", "a", "HttpServletRequest", "object", "is", "missing", "basic", "information", "or", "uses", "unsupported", "values", "for", "e", ".", "g", ".", "HTTP", "version", "and", "HTTP", "method", "." ]
train
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-xservlet/src/main/java/com/helger/xservlet/AbstractXServlet.java#L419-L423
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ImageModerationsImpl.java
ImageModerationsImpl.matchFileInputWithServiceResponseAsync
public Observable<ServiceResponse<MatchResponse>> matchFileInputWithServiceResponseAsync(byte[] imageStream, MatchFileInputOptionalParameter matchFileInputOptionalParameter) { if (this.client.baseUrl() == null) { throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null."); } if (imageStream == null) { throw new IllegalArgumentException("Parameter imageStream is required and cannot be null."); } final String listId = matchFileInputOptionalParameter != null ? matchFileInputOptionalParameter.listId() : null; final Boolean cacheImage = matchFileInputOptionalParameter != null ? matchFileInputOptionalParameter.cacheImage() : null; return matchFileInputWithServiceResponseAsync(imageStream, listId, cacheImage); }
java
public Observable<ServiceResponse<MatchResponse>> matchFileInputWithServiceResponseAsync(byte[] imageStream, MatchFileInputOptionalParameter matchFileInputOptionalParameter) { if (this.client.baseUrl() == null) { throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null."); } if (imageStream == null) { throw new IllegalArgumentException("Parameter imageStream is required and cannot be null."); } final String listId = matchFileInputOptionalParameter != null ? matchFileInputOptionalParameter.listId() : null; final Boolean cacheImage = matchFileInputOptionalParameter != null ? matchFileInputOptionalParameter.cacheImage() : null; return matchFileInputWithServiceResponseAsync(imageStream, listId, cacheImage); }
[ "public", "Observable", "<", "ServiceResponse", "<", "MatchResponse", ">", ">", "matchFileInputWithServiceResponseAsync", "(", "byte", "[", "]", "imageStream", ",", "MatchFileInputOptionalParameter", "matchFileInputOptionalParameter", ")", "{", "if", "(", "this", ".", "...
Fuzzily match an image against one of your custom Image Lists. You can create and manage your custom image lists using &lt;a href="/docs/services/578ff44d2703741568569ab9/operations/578ff7b12703741568569abe"&gt;this&lt;/a&gt; API. Returns ID and tags of matching image.&lt;br/&gt; &lt;br/&gt; Note: Refresh Index must be run on the corresponding Image List before additions and removals are reflected in the response. @param imageStream The image file. @param matchFileInputOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the MatchResponse object
[ "Fuzzily", "match", "an", "image", "against", "one", "of", "your", "custom", "Image", "Lists", ".", "You", "can", "create", "and", "manage", "your", "custom", "image", "lists", "using", "&lt", ";", "a", "href", "=", "/", "docs", "/", "services", "/", "...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ImageModerationsImpl.java#L1998-L2009
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/util/SdkHttpUtils.java
SdkHttpUtils.appendUri
public static String appendUri(String baseUri, String path) { return appendUri(baseUri, path, false); }
java
public static String appendUri(String baseUri, String path) { return appendUri(baseUri, path, false); }
[ "public", "static", "String", "appendUri", "(", "String", "baseUri", ",", "String", "path", ")", "{", "return", "appendUri", "(", "baseUri", ",", "path", ",", "false", ")", ";", "}" ]
Append the given path to the given baseUri. By default, all slash characters in path will not be url-encoded.
[ "Append", "the", "given", "path", "to", "the", "given", "baseUri", ".", "By", "default", "all", "slash", "characters", "in", "path", "will", "not", "be", "url", "-", "encoded", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/SdkHttpUtils.java#L182-L184
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java
VirtualNetworkGatewaysInner.beginDelete
public void beginDelete(String resourceGroupName, String virtualNetworkGatewayName) { beginDeleteWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().single().body(); }
java
public void beginDelete(String resourceGroupName, String virtualNetworkGatewayName) { beginDeleteWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().single().body(); }
[ "public", "void", "beginDelete", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayName", ")", "{", "beginDeleteWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualNetworkGatewayName", ")", ".", "toBlocking", "(", ")", ".", "single", ...
Deletes the specified virtual network gateway. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network gateway. @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
[ "Deletes", "the", "specified", "virtual", "network", "gateway", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L525-L527
gresrun/jesque
src/main/java/net/greghaines/jesque/worker/WorkerImpl.java
WorkerImpl.failMsg
protected String failMsg(final Throwable thrwbl, final String queue, final Job job) throws IOException { final JobFailure failure = new JobFailure(); failure.setFailedAt(new Date()); failure.setWorker(this.name); failure.setQueue(queue); failure.setPayload(job); failure.setThrowable(thrwbl); return ObjectMapperFactory.get().writeValueAsString(failure); }
java
protected String failMsg(final Throwable thrwbl, final String queue, final Job job) throws IOException { final JobFailure failure = new JobFailure(); failure.setFailedAt(new Date()); failure.setWorker(this.name); failure.setQueue(queue); failure.setPayload(job); failure.setThrowable(thrwbl); return ObjectMapperFactory.get().writeValueAsString(failure); }
[ "protected", "String", "failMsg", "(", "final", "Throwable", "thrwbl", ",", "final", "String", "queue", ",", "final", "Job", "job", ")", "throws", "IOException", "{", "final", "JobFailure", "failure", "=", "new", "JobFailure", "(", ")", ";", "failure", ".", ...
Create and serialize a JobFailure. @param thrwbl the Throwable that occurred @param queue the queue the job came from @param job the Job that failed @return the JSON representation of a new JobFailure @throws IOException if there was an error serializing the JobFailure
[ "Create", "and", "serialize", "a", "JobFailure", "." ]
train
https://github.com/gresrun/jesque/blob/44749183dccc40962a94c2af547ea7d0d880b5d1/src/main/java/net/greghaines/jesque/worker/WorkerImpl.java#L722-L730
Azure/azure-sdk-for-java
datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java
AccountsInner.listDataLakeStoreAccountsWithServiceResponseAsync
public Observable<ServiceResponse<Page<DataLakeStoreAccountInfoInner>>> listDataLakeStoreAccountsWithServiceResponseAsync(final String resourceGroupName, final String accountName, final String filter, final Integer top, final Integer skip, final String expand, final String select, final String orderby, final Boolean count, final String search, final String format) { return listDataLakeStoreAccountsSinglePageAsync(resourceGroupName, accountName, filter, top, skip, expand, select, orderby, count, search, format) .concatMap(new Func1<ServiceResponse<Page<DataLakeStoreAccountInfoInner>>, Observable<ServiceResponse<Page<DataLakeStoreAccountInfoInner>>>>() { @Override public Observable<ServiceResponse<Page<DataLakeStoreAccountInfoInner>>> call(ServiceResponse<Page<DataLakeStoreAccountInfoInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listDataLakeStoreAccountsNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<DataLakeStoreAccountInfoInner>>> listDataLakeStoreAccountsWithServiceResponseAsync(final String resourceGroupName, final String accountName, final String filter, final Integer top, final Integer skip, final String expand, final String select, final String orderby, final Boolean count, final String search, final String format) { return listDataLakeStoreAccountsSinglePageAsync(resourceGroupName, accountName, filter, top, skip, expand, select, orderby, count, search, format) .concatMap(new Func1<ServiceResponse<Page<DataLakeStoreAccountInfoInner>>, Observable<ServiceResponse<Page<DataLakeStoreAccountInfoInner>>>>() { @Override public Observable<ServiceResponse<Page<DataLakeStoreAccountInfoInner>>> call(ServiceResponse<Page<DataLakeStoreAccountInfoInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listDataLakeStoreAccountsNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "DataLakeStoreAccountInfoInner", ">", ">", ">", "listDataLakeStoreAccountsWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "accountName", ",", "final", "String...
Gets the first page of Data Lake Store accounts linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any. @param resourceGroupName The name of the Azure resource group that contains the Data Lake Analytics account. @param accountName The name of the Data Lake Analytics account for which to list Data Lake Store accounts. @param filter OData filter. Optional. @param top The number of items to return. Optional. @param skip The number of items to skip over before returning elements. Optional. @param expand OData expansion. Expand related resources in line with the retrieved resources, e.g. Categories/$expand=Products would expand Product data in line with each Category entry. Optional. @param select OData Select statement. Limits the properties on each entry to just those requested, e.g. Categories?$select=CategoryName,Description. Optional. @param orderby OrderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc. Optional. @param count The Boolean value of true or false to request a count of the matching resources included with the resources in the response, e.g. Categories?$count=true. Optional. @param search A free form search. A free-text search expression to match for whether a particular entry should be included in the feed, e.g. Categories?$search=blue OR green. Optional. @param format The desired return format. Return the response in particular formatxii without access to request headers for standard content-type negotiation (e.g Orders?$format=json). Optional. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DataLakeStoreAccountInfoInner&gt; object
[ "Gets", "the", "first", "page", "of", "Data", "Lake", "Store", "accounts", "linked", "to", "the", "specified", "Data", "Lake", "Analytics", "account", ".", "The", "response", "includes", "a", "link", "to", "the", "next", "page", "if", "any", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java#L1742-L1754
nextreports/nextreports-engine
src/ro/nextreports/engine/util/ParameterUtil.java
ParameterUtil.getParameterByName
public static QueryParameter getParameterByName(List<QueryParameter> params, String parameterName) { for (QueryParameter parameter : params) { if (parameter.getName().equals(parameterName)) { return parameter; } } return null; }
java
public static QueryParameter getParameterByName(List<QueryParameter> params, String parameterName) { for (QueryParameter parameter : params) { if (parameter.getName().equals(parameterName)) { return parameter; } } return null; }
[ "public", "static", "QueryParameter", "getParameterByName", "(", "List", "<", "QueryParameter", ">", "params", ",", "String", "parameterName", ")", "{", "for", "(", "QueryParameter", "parameter", ":", "params", ")", "{", "if", "(", "parameter", ".", "getName", ...
Get parameter by name @param params list of parameters @param parameterName parameter name @return return paramater with the specified name, null if parameter not found
[ "Get", "parameter", "by", "name" ]
train
https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ParameterUtil.java#L626-L633
alkacon/opencms-core
src/org/opencms/ade/contenteditor/CmsContentService.java
CmsContentService.transferInvisibleValues
protected void transferInvisibleValues(CmsEntity original, CmsEntity target, CmsContentTypeVisitor visitor) { List<String> invisibleAttributes = new ArrayList<String>(); for (Entry<String, CmsAttributeConfiguration> configEntry : visitor.getAttributeConfigurations().entrySet()) { if (!configEntry.getValue().isVisible()) { invisibleAttributes.add(configEntry.getKey()); } } CmsContentDefinition.transferValues( original, target, invisibleAttributes, visitor.getTypes(), visitor.getAttributeConfigurations(), true); }
java
protected void transferInvisibleValues(CmsEntity original, CmsEntity target, CmsContentTypeVisitor visitor) { List<String> invisibleAttributes = new ArrayList<String>(); for (Entry<String, CmsAttributeConfiguration> configEntry : visitor.getAttributeConfigurations().entrySet()) { if (!configEntry.getValue().isVisible()) { invisibleAttributes.add(configEntry.getKey()); } } CmsContentDefinition.transferValues( original, target, invisibleAttributes, visitor.getTypes(), visitor.getAttributeConfigurations(), true); }
[ "protected", "void", "transferInvisibleValues", "(", "CmsEntity", "original", ",", "CmsEntity", "target", ",", "CmsContentTypeVisitor", "visitor", ")", "{", "List", "<", "String", ">", "invisibleAttributes", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ...
Transfers values marked as invisible from the original entity to the target entity.<p> @param original the original entity @param target the target entiy @param visitor the type visitor holding the content type configuration
[ "Transfers", "values", "marked", "as", "invisible", "from", "the", "original", "entity", "to", "the", "target", "entity", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/contenteditor/CmsContentService.java#L1230-L1245
fuinorg/utils4j
src/main/java/org/fuin/utils4j/PropertiesFilePreferencesFactory.java
PropertiesFilePreferencesFactory.getValidDir
private File getValidDir(final String varName, final String dirName) { if (dirName == null) { throw new RuntimeException("The system variable '" + varName + "' is not set!"); } final File dir = new File(dirName); if (!dir.exists()) { throw new IllegalArgumentException("The directory '" + dir + "' does not exist! [system variable '" + varName + "']"); } if (!dir.isDirectory()) { throw new IllegalArgumentException("The name '" + dir + "' is not a directory! [system variable '" + varName + "']"); } return dir; }
java
private File getValidDir(final String varName, final String dirName) { if (dirName == null) { throw new RuntimeException("The system variable '" + varName + "' is not set!"); } final File dir = new File(dirName); if (!dir.exists()) { throw new IllegalArgumentException("The directory '" + dir + "' does not exist! [system variable '" + varName + "']"); } if (!dir.isDirectory()) { throw new IllegalArgumentException("The name '" + dir + "' is not a directory! [system variable '" + varName + "']"); } return dir; }
[ "private", "File", "getValidDir", "(", "final", "String", "varName", ",", "final", "String", "dirName", ")", "{", "if", "(", "dirName", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"The system variable '\"", "+", "varName", "+", "\"' is n...
Checks if the system variable is set and is a valid directory. If this is not the case a {@link RuntimeException} will be thrown. @param varName Name of the system variable. @param dirName Name of the directory (from the system variable). @return Directory reference.
[ "Checks", "if", "the", "system", "variable", "is", "set", "and", "is", "a", "valid", "directory", ".", "If", "this", "is", "not", "the", "case", "a", "{", "@link", "RuntimeException", "}", "will", "be", "thrown", "." ]
train
https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/PropertiesFilePreferencesFactory.java#L119-L131
h2oai/h2o-3
h2o-core/src/main/java/water/util/IcedBitSet.java
IcedBitSet.byteToBinaryString
static String byteToBinaryString(byte b, int limit) { final StringBuilder sb = new StringBuilder(); if (limit > 8) { limit = 8; } for (int i = 0; i < limit; i++) { sb.append((char)('0' + (b&1))); b>>=1; } return sb.toString(); }
java
static String byteToBinaryString(byte b, int limit) { final StringBuilder sb = new StringBuilder(); if (limit > 8) { limit = 8; } for (int i = 0; i < limit; i++) { sb.append((char)('0' + (b&1))); b>>=1; } return sb.toString(); }
[ "static", "String", "byteToBinaryString", "(", "byte", "b", ",", "int", "limit", ")", "{", "final", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "limit", ">", "8", ")", "{", "limit", "=", "8", ";", "}", "for", "(", ...
Converts a byte into its binary representation (with at most 8 digits). @param b the byte to be converted @param limit the maximal length of returned string - it will never exceed 8 anyway @return binary representation, lowest bit (weight 1) goes first
[ "Converts", "a", "byte", "into", "its", "binary", "representation", "(", "with", "at", "most", "8", "digits", ")", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/util/IcedBitSet.java#L150-L160
HanSolo/tilesfx
src/main/java/eu/hansolo/tilesfx/Tile.java
Tile.getTime
public ZonedDateTime getTime() { if (null == time) { ZonedDateTime now = ZonedDateTime.now(); time = new ObjectPropertyBase<ZonedDateTime>(now) { @Override protected void invalidated() { zoneId = get().getZone(); fireTileEvent(RECALC_EVENT); if (!isRunning() && isAnimated()) { long animationDuration = getAnimationDuration(); timeline.stop(); final KeyValue KEY_VALUE = new KeyValue(currentTime, now.toEpochSecond()); final KeyFrame KEY_FRAME = new KeyFrame(javafx.util.Duration.millis(animationDuration), KEY_VALUE); timeline.getKeyFrames().setAll(KEY_FRAME); timeline.setOnFinished(e -> fireTileEvent(FINISHED_EVENT)); timeline.play(); } else { currentTime.set(now.toEpochSecond()); fireTileEvent(FINISHED_EVENT); } } @Override public Object getBean() { return Tile.this; } @Override public String getName() { return "time"; } }; } return time.get(); }
java
public ZonedDateTime getTime() { if (null == time) { ZonedDateTime now = ZonedDateTime.now(); time = new ObjectPropertyBase<ZonedDateTime>(now) { @Override protected void invalidated() { zoneId = get().getZone(); fireTileEvent(RECALC_EVENT); if (!isRunning() && isAnimated()) { long animationDuration = getAnimationDuration(); timeline.stop(); final KeyValue KEY_VALUE = new KeyValue(currentTime, now.toEpochSecond()); final KeyFrame KEY_FRAME = new KeyFrame(javafx.util.Duration.millis(animationDuration), KEY_VALUE); timeline.getKeyFrames().setAll(KEY_FRAME); timeline.setOnFinished(e -> fireTileEvent(FINISHED_EVENT)); timeline.play(); } else { currentTime.set(now.toEpochSecond()); fireTileEvent(FINISHED_EVENT); } } @Override public Object getBean() { return Tile.this; } @Override public String getName() { return "time"; } }; } return time.get(); }
[ "public", "ZonedDateTime", "getTime", "(", ")", "{", "if", "(", "null", "==", "time", ")", "{", "ZonedDateTime", "now", "=", "ZonedDateTime", ".", "now", "(", ")", ";", "time", "=", "new", "ObjectPropertyBase", "<", "ZonedDateTime", ">", "(", "now", ")",...
Returns the current time of the clock. @return the current time of the clock
[ "Returns", "the", "current", "time", "of", "the", "clock", "." ]
train
https://github.com/HanSolo/tilesfx/blob/36eb07b1119017beb851dad95256439224d1fcf4/src/main/java/eu/hansolo/tilesfx/Tile.java#L3628-L3653
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/logging/Redwood.java
Redwood.getStackTrace
private static StackTraceElement getStackTrace() { StackTraceElement[] stack = Thread.currentThread().getStackTrace(); int i = 2; // we can skip the first two (first is getStackTrace(), second is this method) while (i < stack.length) { boolean isLoggingClass = false; for (String loggingClass : loggingClasses) { String className = stack[i].getClassName(); if (className.startsWith(loggingClass)) { isLoggingClass = true; break; } } if (!isLoggingClass) { break; } i += 1; } // if we didn't find anything, keep last element (probably shouldn't happen, but could if people add too many logging classes) if (i >= stack.length) { i = stack.length - 1; } return stack[i]; }
java
private static StackTraceElement getStackTrace() { StackTraceElement[] stack = Thread.currentThread().getStackTrace(); int i = 2; // we can skip the first two (first is getStackTrace(), second is this method) while (i < stack.length) { boolean isLoggingClass = false; for (String loggingClass : loggingClasses) { String className = stack[i].getClassName(); if (className.startsWith(loggingClass)) { isLoggingClass = true; break; } } if (!isLoggingClass) { break; } i += 1; } // if we didn't find anything, keep last element (probably shouldn't happen, but could if people add too many logging classes) if (i >= stack.length) { i = stack.length - 1; } return stack[i]; }
[ "private", "static", "StackTraceElement", "getStackTrace", "(", ")", "{", "StackTraceElement", "[", "]", "stack", "=", "Thread", ".", "currentThread", "(", ")", ".", "getStackTrace", "(", ")", ";", "int", "i", "=", "2", ";", "// we can skip the first two (first ...
Get the current stack trace element, skipping anything from known logging classes. @return The current stack trace for this thread
[ "Get", "the", "current", "stack", "trace", "element", "skipping", "anything", "from", "known", "logging", "classes", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/logging/Redwood.java#L800-L825
sdaschner/jaxrs-analyzer
src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/rest/TypeRepresentation.java
TypeRepresentation.ofConcrete
public static TypeRepresentation ofConcrete(final TypeIdentifier identifier, final Map<String, TypeIdentifier> properties) { return new ConcreteTypeRepresentation(identifier, properties); }
java
public static TypeRepresentation ofConcrete(final TypeIdentifier identifier, final Map<String, TypeIdentifier> properties) { return new ConcreteTypeRepresentation(identifier, properties); }
[ "public", "static", "TypeRepresentation", "ofConcrete", "(", "final", "TypeIdentifier", "identifier", ",", "final", "Map", "<", "String", ",", "TypeIdentifier", ">", "properties", ")", "{", "return", "new", "ConcreteTypeRepresentation", "(", "identifier", ",", "prop...
Creates a type representation of a concrete type (i.e. a Java type, not a programmatically created type) plus the actual properties. @param identifier The type identifier @param properties The type (POJO) description @return The type representation
[ "Creates", "a", "type", "representation", "of", "a", "concrete", "type", "(", "i", ".", "e", ".", "a", "Java", "type", "not", "a", "programmatically", "created", "type", ")", "plus", "the", "actual", "properties", "." ]
train
https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/rest/TypeRepresentation.java#L82-L84
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/MediaApi.java
MediaApi.setFocusTimeMedia
public ApiSuccessResponse setFocusTimeMedia(String mediatype, String id, SetFocusTimeData1 setFocusTimeData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = setFocusTimeMediaWithHttpInfo(mediatype, id, setFocusTimeData); return resp.getData(); }
java
public ApiSuccessResponse setFocusTimeMedia(String mediatype, String id, SetFocusTimeData1 setFocusTimeData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = setFocusTimeMediaWithHttpInfo(mediatype, id, setFocusTimeData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "setFocusTimeMedia", "(", "String", "mediatype", ",", "String", "id", ",", "SetFocusTimeData1", "setFocusTimeData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "setFocusTimeMediaWithHttpIn...
Set the focus time of interaction Set the focus time to the specified interaction. @param mediatype media-type of interaction (required) @param id id of interaction (required) @param setFocusTimeData Request parameters. (required) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Set", "the", "focus", "time", "of", "interaction", "Set", "the", "focus", "time", "to", "the", "specified", "interaction", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/MediaApi.java#L4199-L4202
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java
FileUtils.addExtension
public static File addExtension(final File f, final String extension) { checkNotNull(f); checkNotNull(extension); Preconditions.checkArgument(!extension.isEmpty()); Preconditions.checkArgument(!f.isDirectory()); final String absolutePath = f.getAbsolutePath(); return new File(absolutePath + "." + extension); }
java
public static File addExtension(final File f, final String extension) { checkNotNull(f); checkNotNull(extension); Preconditions.checkArgument(!extension.isEmpty()); Preconditions.checkArgument(!f.isDirectory()); final String absolutePath = f.getAbsolutePath(); return new File(absolutePath + "." + extension); }
[ "public", "static", "File", "addExtension", "(", "final", "File", "f", ",", "final", "String", "extension", ")", "{", "checkNotNull", "(", "f", ")", ";", "checkNotNull", "(", "extension", ")", ";", "Preconditions", ".", "checkArgument", "(", "!", "extension"...
Derives one {@link File} from another by adding the provided extension. The extension will be separated from the base file name by a ".".
[ "Derives", "one", "{" ]
train
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java#L212-L220
gwtplus/google-gin
src/main/java/com/google/gwt/inject/rebind/GinjectorBindings.java
GinjectorBindings.registerLocalChildBinding
private void registerLocalChildBinding(Key<?> key, GinjectorBindings binding) { boundLocallyInChildren.put(key, binding); if (parent != null) { parent.registerLocalChildBinding(key, binding); } }
java
private void registerLocalChildBinding(Key<?> key, GinjectorBindings binding) { boundLocallyInChildren.put(key, binding); if (parent != null) { parent.registerLocalChildBinding(key, binding); } }
[ "private", "void", "registerLocalChildBinding", "(", "Key", "<", "?", ">", "key", ",", "GinjectorBindings", "binding", ")", "{", "boundLocallyInChildren", ".", "put", "(", "key", ",", "binding", ")", ";", "if", "(", "parent", "!=", "null", ")", "{", "paren...
Register the key in the "boundLocallyInChildren" set for this injector, and recursively register it with all of the ancestors. The caller is responsible for ensuring that the binding being registered is actually local (i.e., not a ParentBinding).
[ "Register", "the", "key", "in", "the", "boundLocallyInChildren", "set", "for", "this", "injector", "and", "recursively", "register", "it", "with", "all", "of", "the", "ancestors", ".", "The", "caller", "is", "responsible", "for", "ensuring", "that", "the", "bi...
train
https://github.com/gwtplus/google-gin/blob/595e61ee0d2fa508815c016e924ec0e5cea2a2aa/src/main/java/com/google/gwt/inject/rebind/GinjectorBindings.java#L471-L476
threerings/narya
core/src/main/java/com/threerings/crowd/chat/client/ChatDirector.java
ChatDirector.registerCommandHandler
public void registerCommandHandler (MessageBundle msg, String command, CommandHandler handler) { // the usage key is derived from the untranslated command handler._usageKey = "m.usage_" + command; String key = "c." + command; handler._aliases = msg.exists(key) ? msg.get(key).split("\\s+") : new String[] { command }; for (String alias : handler._aliases) { _handlers.put(alias, handler); } }
java
public void registerCommandHandler (MessageBundle msg, String command, CommandHandler handler) { // the usage key is derived from the untranslated command handler._usageKey = "m.usage_" + command; String key = "c." + command; handler._aliases = msg.exists(key) ? msg.get(key).split("\\s+") : new String[] { command }; for (String alias : handler._aliases) { _handlers.put(alias, handler); } }
[ "public", "void", "registerCommandHandler", "(", "MessageBundle", "msg", ",", "String", "command", ",", "CommandHandler", "handler", ")", "{", "// the usage key is derived from the untranslated command", "handler", ".", "_usageKey", "=", "\"m.usage_\"", "+", "command", ";...
Registers a chat command handler. @param msg the message bundle via which the slash command will be translated (as <code>c.</code><i>command</i>). If no translation exists the command will be <code>/</code><i>command</i>. @param command the name of the command that will be used to invoke this handler (e.g. <code>tell</code> if the command will be invoked as <code>/tell</code>). @param handler the chat command handler itself.
[ "Registers", "a", "chat", "command", "handler", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/chat/client/ChatDirector.java#L265-L275
js-lib-com/template.xhtml
src/main/java/js/template/xhtml/Content.java
Content.getString
String getString(Object scope, String propertyPath) throws TemplateException { return getString(scope, propertyPath, null); }
java
String getString(Object scope, String propertyPath) throws TemplateException { return getString(scope, propertyPath, null); }
[ "String", "getString", "(", "Object", "scope", ",", "String", "propertyPath", ")", "throws", "TemplateException", "{", "return", "getString", "(", "scope", ",", "propertyPath", ",", "null", ")", ";", "}" ]
Convenient method to call {@link #getString(Object, String, Format)} with null formatter. @param scope object scope, @param propertyPath object property path. @return content value as string, possible null. @throws TemplateException if requested value is undefined.
[ "Convenient", "method", "to", "call", "{", "@link", "#getString", "(", "Object", "String", "Format", ")", "}", "with", "null", "formatter", "." ]
train
https://github.com/js-lib-com/template.xhtml/blob/d50cec08aca9ab9680baebe2a26a341c096564fb/src/main/java/js/template/xhtml/Content.java#L228-L231
marvinlabs/android-intents
library/src/main/java/com/marvinlabs/intents/GeoIntents.java
GeoIntents.newNavigationIntent
public static Intent newNavigationIntent(String address) { StringBuilder sb = new StringBuilder(); sb.append("google.navigation:q="); String addressEncoded = Uri.encode(address); sb.append(addressEncoded); return new Intent(Intent.ACTION_VIEW, Uri.parse(sb.toString())); }
java
public static Intent newNavigationIntent(String address) { StringBuilder sb = new StringBuilder(); sb.append("google.navigation:q="); String addressEncoded = Uri.encode(address); sb.append(addressEncoded); return new Intent(Intent.ACTION_VIEW, Uri.parse(sb.toString())); }
[ "public", "static", "Intent", "newNavigationIntent", "(", "String", "address", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "\"google.navigation:q=\"", ")", ";", "String", "addressEncoded", "=", "Uri", ...
Intent that should allow opening a map showing the given address (if it exists) @param address The address to search @return the intent
[ "Intent", "that", "should", "allow", "opening", "a", "map", "showing", "the", "given", "address", "(", "if", "it", "exists", ")" ]
train
https://github.com/marvinlabs/android-intents/blob/33e79c825188b6a97601869522533cc825801f6e/library/src/main/java/com/marvinlabs/intents/GeoIntents.java#L98-L106
intuit/QuickBooks-V3-Java-SDK
ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/HTTPBatchClientConnectionInterceptor.java
HTTPBatchClientConnectionInterceptor.extractURI
private URI extractURI(RequestElements intuitRequest) throws FMSException { URI uri = null; try { uri = new URI(intuitRequest.getRequestParameters().get(RequestElements.REQ_PARAM_RESOURCE_URL)); } catch (URISyntaxException e) { throw new FMSException("URISyntaxException", e); } return uri; }
java
private URI extractURI(RequestElements intuitRequest) throws FMSException { URI uri = null; try { uri = new URI(intuitRequest.getRequestParameters().get(RequestElements.REQ_PARAM_RESOURCE_URL)); } catch (URISyntaxException e) { throw new FMSException("URISyntaxException", e); } return uri; }
[ "private", "URI", "extractURI", "(", "RequestElements", "intuitRequest", ")", "throws", "FMSException", "{", "URI", "uri", "=", "null", ";", "try", "{", "uri", "=", "new", "URI", "(", "intuitRequest", ".", "getRequestParameters", "(", ")", ".", "get", "(", ...
Returns URI instance which will be used as a connection source @param intuitRequest @return URI @throws FMSException
[ "Returns", "URI", "instance", "which", "will", "be", "used", "as", "a", "connection", "source" ]
train
https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/HTTPBatchClientConnectionInterceptor.java#L253-L263
erlang/otp
lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java
OtpInputStream.read_ref
public OtpErlangRef read_ref() throws OtpErlangDecodeException { String node; int id; int creation; int tag; tag = read1skip_version(); switch (tag) { case OtpExternal.refTag: node = read_atom(); id = read4BE() & 0x3ffff; // 18 bits creation = read1() & 0x03; // 2 bits return new OtpErlangRef(node, id, creation); case OtpExternal.newRefTag: case OtpExternal.newerRefTag: final int arity = read2BE(); if (arity > 3) { throw new OtpErlangDecodeException( "Ref arity " + arity + " too large "); } node = read_atom(); if (tag == OtpExternal.newRefTag) creation = read1(); else creation = read4BE(); final int[] ids = new int[arity]; for (int i = 0; i < arity; i++) { ids[i] = read4BE(); } return new OtpErlangRef(tag, node, ids, creation); default: throw new OtpErlangDecodeException( "Wrong tag encountered, expected ref, got " + tag); } }
java
public OtpErlangRef read_ref() throws OtpErlangDecodeException { String node; int id; int creation; int tag; tag = read1skip_version(); switch (tag) { case OtpExternal.refTag: node = read_atom(); id = read4BE() & 0x3ffff; // 18 bits creation = read1() & 0x03; // 2 bits return new OtpErlangRef(node, id, creation); case OtpExternal.newRefTag: case OtpExternal.newerRefTag: final int arity = read2BE(); if (arity > 3) { throw new OtpErlangDecodeException( "Ref arity " + arity + " too large "); } node = read_atom(); if (tag == OtpExternal.newRefTag) creation = read1(); else creation = read4BE(); final int[] ids = new int[arity]; for (int i = 0; i < arity; i++) { ids[i] = read4BE(); } return new OtpErlangRef(tag, node, ids, creation); default: throw new OtpErlangDecodeException( "Wrong tag encountered, expected ref, got " + tag); } }
[ "public", "OtpErlangRef", "read_ref", "(", ")", "throws", "OtpErlangDecodeException", "{", "String", "node", ";", "int", "id", ";", "int", "creation", ";", "int", "tag", ";", "tag", "=", "read1skip_version", "(", ")", ";", "switch", "(", "tag", ")", "{", ...
Read an Erlang reference from the stream. @return the value of the reference @exception OtpErlangDecodeException if the next term in the stream is not an Erlang reference.
[ "Read", "an", "Erlang", "reference", "from", "the", "stream", "." ]
train
https://github.com/erlang/otp/blob/ac6084fd83240355f72e94adbf303e57832d1fab/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java#L1018-L1056
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java
TypeAnnotations.annotationTargetType
public AnnotationType annotationTargetType(Attribute.Compound a, Symbol s) { List<Attribute> targets = annotationTargets(a.type.tsym); return (targets == null) ? AnnotationType.DECLARATION : targets.stream() .map(attr -> targetToAnnotationType(attr, s)) .reduce(AnnotationType.NONE, this::combineAnnotationType); }
java
public AnnotationType annotationTargetType(Attribute.Compound a, Symbol s) { List<Attribute> targets = annotationTargets(a.type.tsym); return (targets == null) ? AnnotationType.DECLARATION : targets.stream() .map(attr -> targetToAnnotationType(attr, s)) .reduce(AnnotationType.NONE, this::combineAnnotationType); }
[ "public", "AnnotationType", "annotationTargetType", "(", "Attribute", ".", "Compound", "a", ",", "Symbol", "s", ")", "{", "List", "<", "Attribute", ">", "targets", "=", "annotationTargets", "(", "a", ".", "type", ".", "tsym", ")", ";", "return", "(", "targ...
Determine whether an annotation is a declaration annotation, a type annotation, or both.
[ "Determine", "whether", "an", "annotation", "is", "a", "declaration", "annotation", "a", "type", "annotation", "or", "both", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java#L173-L180
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java
ComputeNodesImpl.getRemoteDesktopAsync
public Observable<InputStream> getRemoteDesktopAsync(String poolId, String nodeId) { return getRemoteDesktopWithServiceResponseAsync(poolId, nodeId).map(new Func1<ServiceResponseWithHeaders<InputStream, ComputeNodeGetRemoteDesktopHeaders>, InputStream>() { @Override public InputStream call(ServiceResponseWithHeaders<InputStream, ComputeNodeGetRemoteDesktopHeaders> response) { return response.body(); } }); }
java
public Observable<InputStream> getRemoteDesktopAsync(String poolId, String nodeId) { return getRemoteDesktopWithServiceResponseAsync(poolId, nodeId).map(new Func1<ServiceResponseWithHeaders<InputStream, ComputeNodeGetRemoteDesktopHeaders>, InputStream>() { @Override public InputStream call(ServiceResponseWithHeaders<InputStream, ComputeNodeGetRemoteDesktopHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "InputStream", ">", "getRemoteDesktopAsync", "(", "String", "poolId", ",", "String", "nodeId", ")", "{", "return", "getRemoteDesktopWithServiceResponseAsync", "(", "poolId", ",", "nodeId", ")", ".", "map", "(", "new", "Func1", "<", "...
Gets the Remote Desktop Protocol file for the specified compute node. Before you can access a node by using the RDP file, you must create a user account on the node. This API can only be invoked on pools created with a cloud service configuration. For pools created with a virtual machine configuration, see the GetRemoteLoginSettings API. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node for which you want to get the Remote Desktop Protocol file. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the InputStream object
[ "Gets", "the", "Remote", "Desktop", "Protocol", "file", "for", "the", "specified", "compute", "node", ".", "Before", "you", "can", "access", "a", "node", "by", "using", "the", "RDP", "file", "you", "must", "create", "a", "user", "account", "on", "the", "...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java#L2183-L2190
kubernetes-client/java
util/src/main/java/io/kubernetes/client/util/Yaml.java
Yaml.dumpAll
public static void dumpAll(Iterator<? extends Object> data, Writer output) { getSnakeYaml().dumpAll(data, output); }
java
public static void dumpAll(Iterator<? extends Object> data, Writer output) { getSnakeYaml().dumpAll(data, output); }
[ "public", "static", "void", "dumpAll", "(", "Iterator", "<", "?", "extends", "Object", ">", "data", ",", "Writer", "output", ")", "{", "getSnakeYaml", "(", ")", ".", "dumpAll", "(", "data", ",", "output", ")", ";", "}" ]
Takes an Iterator of YAML API objects and writes a YAML String representing all of them. @param data The list of YAML API objects. @param output The writer to output the YAML String to.
[ "Takes", "an", "Iterator", "of", "YAML", "API", "objects", "and", "writes", "a", "YAML", "String", "representing", "all", "of", "them", "." ]
train
https://github.com/kubernetes-client/java/blob/7413e98bd904f09d1ad00fb60e8c6ff787f3f560/util/src/main/java/io/kubernetes/client/util/Yaml.java#L316-L318
ginere/ginere-base
src/main/java/eu/ginere/base/util/lang/MapOfLists.java
MapOfLists.put
public void put(K key,V value){ List<V> list; if (map.containsKey(key)){ list=(List<V>)map.get(key); } else { list=new Vector<V>(); map.put(key,list); } list.add(value); }
java
public void put(K key,V value){ List<V> list; if (map.containsKey(key)){ list=(List<V>)map.get(key); } else { list=new Vector<V>(); map.put(key,list); } list.add(value); }
[ "public", "void", "put", "(", "K", "key", ",", "V", "value", ")", "{", "List", "<", "V", ">", "list", ";", "if", "(", "map", ".", "containsKey", "(", "key", ")", ")", "{", "list", "=", "(", "List", "<", "V", ">", ")", "map", ".", "get", "("...
This add the element value at the end of the list pointed by key
[ "This", "add", "the", "element", "value", "at", "the", "end", "of", "the", "list", "pointed", "by", "key" ]
train
https://github.com/ginere/ginere-base/blob/b1cc1c5834bd8a31df475c6f3fc0ee51273c5a24/src/main/java/eu/ginere/base/util/lang/MapOfLists.java#L35-L44
code4everything/util
src/main/java/com/zhazhapan/util/ReflectUtils.java
ReflectUtils.invokeMethodUseBasicType
public static Object invokeMethodUseBasicType(Object object, String methodName, Object[] parameters) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { return invokeMethod(object, methodName, getBasicTypes(parameters), parameters); }
java
public static Object invokeMethodUseBasicType(Object object, String methodName, Object[] parameters) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { return invokeMethod(object, methodName, getBasicTypes(parameters), parameters); }
[ "public", "static", "Object", "invokeMethodUseBasicType", "(", "Object", "object", ",", "String", "methodName", ",", "Object", "[", "]", "parameters", ")", "throws", "NoSuchMethodException", ",", "InvocationTargetException", ",", "IllegalAccessException", "{", "return",...
调用方法 @param object 对象 @param methodName 方法名 @param parameters 参数 @return 方法返回的结果 @throws NoSuchMethodException 异常 @throws InvocationTargetException 异常 @throws IllegalAccessException 异常
[ "调用方法" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/ReflectUtils.java#L118-L120
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/util/concurrent/ConcurrentConveyor.java
ConcurrentConveyor.drainTo
public final int drainTo(int queueIndex, Collection<? super E> drain) { return drain(queues[queueIndex], drain, Integer.MAX_VALUE); }
java
public final int drainTo(int queueIndex, Collection<? super E> drain) { return drain(queues[queueIndex], drain, Integer.MAX_VALUE); }
[ "public", "final", "int", "drainTo", "(", "int", "queueIndex", ",", "Collection", "<", "?", "super", "E", ">", "drain", ")", "{", "return", "drain", "(", "queues", "[", "queueIndex", "]", ",", "drain", ",", "Integer", ".", "MAX_VALUE", ")", ";", "}" ]
Drains a batch of items from the queue at the supplied index into the supplied collection. @return the number of items drained
[ "Drains", "a", "batch", "of", "items", "from", "the", "queue", "at", "the", "supplied", "index", "into", "the", "supplied", "collection", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/util/concurrent/ConcurrentConveyor.java#L287-L289
hibernate/hibernate-ogm
infinispan-remote/src/main/java/org/hibernate/ogm/datastore/infinispanremote/configuration/impl/InfinispanRemoteConfiguration.java
InfinispanRemoteConfiguration.setAdditionalProperties
private void setAdditionalProperties(Map<?, ?> configurationMap, ConfigurationPropertyReader propertyReader, Properties hotRodConfiguration) { // Programmatic properties override the resource file for ( Entry<?, ?> property : configurationMap.entrySet() ) { String key = (String) property.getKey(); if ( key.startsWith( HOT_ROD_CLIENT_PREFIX ) ) { String hotRodProperty = key.substring( HOT_ROD_CLIENT_PREFIX.length() ); String value = propertyReader.property( key, String.class ).getValue(); if ( !ArrayHelper.contains( noPrefixProperties, hotRodProperty ) ) { hotRodProperty = HOT_ROD_ORIGINAL_PREFIX + hotRodProperty; } hotRodConfiguration.setProperty( hotRodProperty, value ); } } }
java
private void setAdditionalProperties(Map<?, ?> configurationMap, ConfigurationPropertyReader propertyReader, Properties hotRodConfiguration) { // Programmatic properties override the resource file for ( Entry<?, ?> property : configurationMap.entrySet() ) { String key = (String) property.getKey(); if ( key.startsWith( HOT_ROD_CLIENT_PREFIX ) ) { String hotRodProperty = key.substring( HOT_ROD_CLIENT_PREFIX.length() ); String value = propertyReader.property( key, String.class ).getValue(); if ( !ArrayHelper.contains( noPrefixProperties, hotRodProperty ) ) { hotRodProperty = HOT_ROD_ORIGINAL_PREFIX + hotRodProperty; } hotRodConfiguration.setProperty( hotRodProperty, value ); } } }
[ "private", "void", "setAdditionalProperties", "(", "Map", "<", "?", ",", "?", ">", "configurationMap", ",", "ConfigurationPropertyReader", "propertyReader", ",", "Properties", "hotRodConfiguration", ")", "{", "// Programmatic properties override the resource file", "for", "...
Set the properties defined using the prefix {@link InfinispanRemoteProperties#HOT_ROD_CLIENT_PREFIX} @param configurationMap contains all the properties defined for OGM @param propertyReader read the value of a property @param hotRodConfiguration the Hot Rod configuration to update
[ "Set", "the", "properties", "defined", "using", "the", "prefix", "{", "@link", "InfinispanRemoteProperties#HOT_ROD_CLIENT_PREFIX", "}" ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/infinispan-remote/src/main/java/org/hibernate/ogm/datastore/infinispanremote/configuration/impl/InfinispanRemoteConfiguration.java#L294-L307
foundation-runtime/service-directory
1.2/sd-api/src/main/java/com/cisco/oss/foundation/directory/lookup/LookupManagerImpl.java
LookupManagerImpl.addNotificationHandler
@Override public void addNotificationHandler(String serviceName, NotificationHandler handler) throws ServiceException { ServiceInstanceUtils.validateManagerIsStarted(isStarted.get()); ServiceInstanceUtils.validateServiceName(serviceName); if (handler == null) { throw new ServiceException(ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR, ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR.getMessageTemplate(), "NotificationHandler"); } ModelService service = getLookupService().getModelService(serviceName); if (service == null) { throw new ServiceException(ErrorCode.SERVICE_DOES_NOT_EXIST,ErrorCode.SERVICE_DOES_NOT_EXIST.getMessageTemplate(),serviceName); } getLookupService().addNotificationHandler(serviceName, handler); }
java
@Override public void addNotificationHandler(String serviceName, NotificationHandler handler) throws ServiceException { ServiceInstanceUtils.validateManagerIsStarted(isStarted.get()); ServiceInstanceUtils.validateServiceName(serviceName); if (handler == null) { throw new ServiceException(ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR, ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR.getMessageTemplate(), "NotificationHandler"); } ModelService service = getLookupService().getModelService(serviceName); if (service == null) { throw new ServiceException(ErrorCode.SERVICE_DOES_NOT_EXIST,ErrorCode.SERVICE_DOES_NOT_EXIST.getMessageTemplate(),serviceName); } getLookupService().addNotificationHandler(serviceName, handler); }
[ "@", "Override", "public", "void", "addNotificationHandler", "(", "String", "serviceName", ",", "NotificationHandler", "handler", ")", "throws", "ServiceException", "{", "ServiceInstanceUtils", ".", "validateManagerIsStarted", "(", "isStarted", ".", "get", "(", ")", "...
Add a NotificationHandler to the Service. This method can check the duplicated NotificationHandler for the serviceName, if the NotificationHandler already exists for the serviceName, do nothing. Throws IllegalArgumentException if serviceName or handler is null. @param serviceName the service name. @param handler the NotificationHandler for the service. @deprecated
[ "Add", "a", "NotificationHandler", "to", "the", "Service", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/1.2/sd-api/src/main/java/com/cisco/oss/foundation/directory/lookup/LookupManagerImpl.java#L358-L374
Netflix/zuul
zuul-core/src/main/java/com/netflix/zuul/FilterLoader.java
FilterLoader.getFiltersByType
public List<ZuulFilter> getFiltersByType(FilterType filterType) { List<ZuulFilter> list = hashFiltersByType.get(filterType); if (list != null) return list; list = new ArrayList<ZuulFilter>(); Collection<ZuulFilter> filters = filterRegistry.getAllFilters(); for (Iterator<ZuulFilter> iterator = filters.iterator(); iterator.hasNext(); ) { ZuulFilter filter = iterator.next(); if (filter.filterType().equals(filterType)) { list.add(filter); } } // Sort by filterOrder. Collections.sort(list, new Comparator<ZuulFilter>() { @Override public int compare(ZuulFilter o1, ZuulFilter o2) { return o1.filterOrder() - o2.filterOrder(); } }); hashFiltersByType.putIfAbsent(filterType, list); return list; }
java
public List<ZuulFilter> getFiltersByType(FilterType filterType) { List<ZuulFilter> list = hashFiltersByType.get(filterType); if (list != null) return list; list = new ArrayList<ZuulFilter>(); Collection<ZuulFilter> filters = filterRegistry.getAllFilters(); for (Iterator<ZuulFilter> iterator = filters.iterator(); iterator.hasNext(); ) { ZuulFilter filter = iterator.next(); if (filter.filterType().equals(filterType)) { list.add(filter); } } // Sort by filterOrder. Collections.sort(list, new Comparator<ZuulFilter>() { @Override public int compare(ZuulFilter o1, ZuulFilter o2) { return o1.filterOrder() - o2.filterOrder(); } }); hashFiltersByType.putIfAbsent(filterType, list); return list; }
[ "public", "List", "<", "ZuulFilter", ">", "getFiltersByType", "(", "FilterType", "filterType", ")", "{", "List", "<", "ZuulFilter", ">", "list", "=", "hashFiltersByType", ".", "get", "(", "filterType", ")", ";", "if", "(", "list", "!=", "null", ")", "retur...
Returns a list of filters by the filterType specified @param filterType @return a List<ZuulFilter>
[ "Returns", "a", "list", "of", "filters", "by", "the", "filterType", "specified" ]
train
https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/FilterLoader.java#L202-L227
hal/elemento
core/src/main/java/org/jboss/gwt/elemento/core/Elements.java
Elements.insertBefore
public static void insertBefore(Element newElement, Element before) { before.parentNode.insertBefore(newElement, before); }
java
public static void insertBefore(Element newElement, Element before) { before.parentNode.insertBefore(newElement, before); }
[ "public", "static", "void", "insertBefore", "(", "Element", "newElement", ",", "Element", "before", ")", "{", "before", ".", "parentNode", ".", "insertBefore", "(", "newElement", ",", "before", ")", ";", "}" ]
Inserts the specified element into the parent of the before element.
[ "Inserts", "the", "specified", "element", "into", "the", "parent", "of", "the", "before", "element", "." ]
train
https://github.com/hal/elemento/blob/26da2d5a1fe2ec55b779737dbaeda25a942eee61/core/src/main/java/org/jboss/gwt/elemento/core/Elements.java#L680-L682
threerings/nenya
core/src/main/java/com/threerings/media/tile/TileManager.java
TileManager.loadTileSet
public UniformTileSet loadTileSet (String imgPath, int width, int height) { return loadCachedTileSet("", imgPath, width, height); }
java
public UniformTileSet loadTileSet (String imgPath, int width, int height) { return loadCachedTileSet("", imgPath, width, height); }
[ "public", "UniformTileSet", "loadTileSet", "(", "String", "imgPath", ",", "int", "width", ",", "int", "height", ")", "{", "return", "loadCachedTileSet", "(", "\"\"", ",", "imgPath", ",", "width", ",", "height", ")", ";", "}" ]
Loads up a tileset from the specified image with the specified metadata parameters.
[ "Loads", "up", "a", "tileset", "from", "the", "specified", "image", "with", "the", "specified", "metadata", "parameters", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/tile/TileManager.java#L64-L67
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getSkinInfo
public void getSkinInfo(int[] ids, Callback<List<Skin>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getSkinInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
java
public void getSkinInfo(int[] ids, Callback<List<Skin>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getSkinInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
[ "public", "void", "getSkinInfo", "(", "int", "[", "]", "ids", ",", "Callback", "<", "List", "<", "Skin", ">", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", "(", "ids", ")"...
For more info on Skin API go <a href="https://wiki.guildwars2.com/wiki/API:2/skins">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param ids list of skin id @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception empty ID list @throws NullPointerException if given {@link Callback} is empty @see Skin skin info
[ "For", "more", "info", "on", "Skin", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "skins", ">", "here<", "/", "a", ">", "<br", "/", ">", "Give", "user", "the"...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L2379-L2382
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/hashcode/HashCodeCalculator.java
HashCodeCalculator.append
public static int append (final int nPrevHashCode, @Nullable final Object x) { return append (nPrevHashCode, HashCodeImplementationRegistry.getHashCode (x)); }
java
public static int append (final int nPrevHashCode, @Nullable final Object x) { return append (nPrevHashCode, HashCodeImplementationRegistry.getHashCode (x)); }
[ "public", "static", "int", "append", "(", "final", "int", "nPrevHashCode", ",", "@", "Nullable", "final", "Object", "x", ")", "{", "return", "append", "(", "nPrevHashCode", ",", "HashCodeImplementationRegistry", ".", "getHashCode", "(", "x", ")", ")", ";", "...
Object hash code generation. @param nPrevHashCode The previous hash code used as the basis for calculation @param x Object to add. May be <code>null</code>. @return The updated hash code
[ "Object", "hash", "code", "generation", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/hashcode/HashCodeCalculator.java#L173-L176
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VirtualNetworkTapsInner.java
VirtualNetworkTapsInner.createOrUpdate
public VirtualNetworkTapInner createOrUpdate(String resourceGroupName, String tapName, VirtualNetworkTapInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, tapName, parameters).toBlocking().last().body(); }
java
public VirtualNetworkTapInner createOrUpdate(String resourceGroupName, String tapName, VirtualNetworkTapInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, tapName, parameters).toBlocking().last().body(); }
[ "public", "VirtualNetworkTapInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "tapName", ",", "VirtualNetworkTapInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "tapName", ",", "par...
Creates or updates a Virtual Network Tap. @param resourceGroupName The name of the resource group. @param tapName The name of the virtual network tap. @param parameters Parameters supplied to the create or update virtual network tap operation. @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 VirtualNetworkTapInner object if successful.
[ "Creates", "or", "updates", "a", "Virtual", "Network", "Tap", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VirtualNetworkTapsInner.java#L362-L364
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/URLConnectionTools.java
URLConnectionTools.getInputStream
public static InputStream getInputStream(URL url, boolean acceptGzipEncoding, int timeout) throws IOException { InputStream inStream = null ; URLConnection huc = URLConnectionTools.openURLConnection(url,timeout); if ( acceptGzipEncoding) huc.setRequestProperty("Accept-Encoding", "gzip"); String contentEncoding = huc.getContentEncoding(); inStream = huc.getInputStream(); if (contentEncoding != null) { if (contentEncoding.contains("gzip")) { inStream = new GZIPInputStream(inStream); } } return inStream; }
java
public static InputStream getInputStream(URL url, boolean acceptGzipEncoding, int timeout) throws IOException { InputStream inStream = null ; URLConnection huc = URLConnectionTools.openURLConnection(url,timeout); if ( acceptGzipEncoding) huc.setRequestProperty("Accept-Encoding", "gzip"); String contentEncoding = huc.getContentEncoding(); inStream = huc.getInputStream(); if (contentEncoding != null) { if (contentEncoding.contains("gzip")) { inStream = new GZIPInputStream(inStream); } } return inStream; }
[ "public", "static", "InputStream", "getInputStream", "(", "URL", "url", ",", "boolean", "acceptGzipEncoding", ",", "int", "timeout", ")", "throws", "IOException", "{", "InputStream", "inStream", "=", "null", ";", "URLConnection", "huc", "=", "URLConnectionTools", ...
Open a URL and return an InputStream to it if acceptGzipEncoding == true, use GZIPEncoding to compress communication. <p> The caller is responsible to close the returned InputStream not to cause resource leaks. @param url the input URL to be read @param acceptGzipEncoding whether to accept Gzip encoding @param timeout @return an {@link InputStream} of response @throws IOException due to an error opening the URL
[ "Open", "a", "URL", "and", "return", "an", "InputStream", "to", "it", "if", "acceptGzipEncoding", "==", "true", "use", "GZIPEncoding", "to", "compress", "communication", ".", "<p", ">", "The", "caller", "is", "responsible", "to", "close", "the", "returned", ...
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/URLConnectionTools.java#L125-L143
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java
ImageMiscOps.insertBand
public static void insertBand( GrayI8 input, int band , InterleavedI8 output) { final int numBands = output.numBands; for (int y = 0; y < input.height; y++) { int indexIn = input.getStartIndex() + y * input.getStride(); int indexOut = output.getStartIndex() + y * output.getStride() + band; int end = indexOut + output.width*numBands - band; for (; indexOut < end; indexOut += numBands , indexIn++ ) { output.data[indexOut] = input.data[indexIn]; } } }
java
public static void insertBand( GrayI8 input, int band , InterleavedI8 output) { final int numBands = output.numBands; for (int y = 0; y < input.height; y++) { int indexIn = input.getStartIndex() + y * input.getStride(); int indexOut = output.getStartIndex() + y * output.getStride() + band; int end = indexOut + output.width*numBands - band; for (; indexOut < end; indexOut += numBands , indexIn++ ) { output.data[indexOut] = input.data[indexIn]; } } }
[ "public", "static", "void", "insertBand", "(", "GrayI8", "input", ",", "int", "band", ",", "InterleavedI8", "output", ")", "{", "final", "int", "numBands", "=", "output", ".", "numBands", ";", "for", "(", "int", "y", "=", "0", ";", "y", "<", "input", ...
Inserts a single band into a multi-band image overwriting the original band @param input Single band image @param band Which band the image is to be inserted into @param output The multi-band image which the input image is to be inserted into
[ "Inserts", "a", "single", "band", "into", "a", "multi", "-", "band", "image", "overwriting", "the", "original", "band" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java#L176-L187
phax/ph-schedule
ph-mini-quartz/src/main/java/com/helger/quartz/TimeOfDay.java
TimeOfDay.hourAndMinuteAndSecondFromDate
@Nullable public static TimeOfDay hourAndMinuteAndSecondFromDate (@Nullable final Date dateTime, @Nullable final TimeZone tz) { if (dateTime == null) return null; final Calendar cal = PDTFactory.createCalendar (); cal.setTime (dateTime); if (tz != null) cal.setTimeZone (tz); return new TimeOfDay (cal.get (Calendar.HOUR_OF_DAY), cal.get (Calendar.MINUTE), cal.get (Calendar.SECOND)); }
java
@Nullable public static TimeOfDay hourAndMinuteAndSecondFromDate (@Nullable final Date dateTime, @Nullable final TimeZone tz) { if (dateTime == null) return null; final Calendar cal = PDTFactory.createCalendar (); cal.setTime (dateTime); if (tz != null) cal.setTimeZone (tz); return new TimeOfDay (cal.get (Calendar.HOUR_OF_DAY), cal.get (Calendar.MINUTE), cal.get (Calendar.SECOND)); }
[ "@", "Nullable", "public", "static", "TimeOfDay", "hourAndMinuteAndSecondFromDate", "(", "@", "Nullable", "final", "Date", "dateTime", ",", "@", "Nullable", "final", "TimeZone", "tz", ")", "{", "if", "(", "dateTime", "==", "null", ")", "return", "null", ";", ...
Create a {@link TimeOfDay} from the given date, in the given TimeZone. @param dateTime The {@link Date} from which to extract Hour, Minute and Second. @param tz The {@link TimeZone} from which relate Hour, Minute and Second for the given date. If null, system default TimeZone will be used.
[ "Create", "a", "{", "@link", "TimeOfDay", "}", "from", "the", "given", "date", "in", "the", "given", "TimeZone", "." ]
train
https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/TimeOfDay.java#L250-L261
google/closure-templates
java/src/com/google/template/soy/jssrc/internal/JsCodeBuilder.java
JsCodeBuilder.setOutputVarInited
public JsCodeBuilder setOutputVarInited() { outputVars.pop(); outputVars.push(new OutputVar(currOutputVar, /* initialized= */ true)); currOutputVarIsInited = true; return this; }
java
public JsCodeBuilder setOutputVarInited() { outputVars.pop(); outputVars.push(new OutputVar(currOutputVar, /* initialized= */ true)); currOutputVarIsInited = true; return this; }
[ "public", "JsCodeBuilder", "setOutputVarInited", "(", ")", "{", "outputVars", ".", "pop", "(", ")", ";", "outputVars", ".", "push", "(", "new", "OutputVar", "(", "currOutputVar", ",", "/* initialized= */", "true", ")", ")", ";", "currOutputVarIsInited", "=", "...
Tells this CodeBuilder that the current output variable has already been initialized. This causes {@code initOutputVarIfNecessary} and {@code addToOutputVar} to not add initialization code even on the first use of the variable.
[ "Tells", "this", "CodeBuilder", "that", "the", "current", "output", "variable", "has", "already", "been", "initialized", ".", "This", "causes", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/JsCodeBuilder.java#L248-L253
alkacon/opencms-core
src/org/opencms/jsp/Messages.java
Messages.getLocalizedMessage
public static String getLocalizedMessage(CmsMessageContainer container, ServletRequest request) { CmsObject cms = CmsFlexController.getCmsObject(request); return getLocalizedMessage(container, cms); }
java
public static String getLocalizedMessage(CmsMessageContainer container, ServletRequest request) { CmsObject cms = CmsFlexController.getCmsObject(request); return getLocalizedMessage(container, cms); }
[ "public", "static", "String", "getLocalizedMessage", "(", "CmsMessageContainer", "container", ",", "ServletRequest", "request", ")", "{", "CmsObject", "cms", "=", "CmsFlexController", ".", "getCmsObject", "(", "request", ")", ";", "return", "getLocalizedMessage", "(",...
Returns the String for the given CmsMessageContainer localized to the current user's locale if available or to the default locale else. <p> This method allows a static method ({@link CmsJspTagInfo#infoTagAction(String, javax.servlet.http.HttpServletRequest)}) that has no <code>pageContext</code> in scope to lookup the locale at request time. <p> @see #getLocalizedMessage(CmsMessageContainer, PageContext) @param container A CmsMessageContainer containing the message to localize. @param request The current request. @return the String for the given CmsMessageContainer localized to the current user's locale if available or to the default locale else. <p>
[ "Returns", "the", "String", "for", "the", "given", "CmsMessageContainer", "localized", "to", "the", "current", "user", "s", "locale", "if", "available", "or", "to", "the", "default", "locale", "else", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/Messages.java#L336-L341
networknt/light-4j
utility/src/main/java/com/networknt/utility/RegExUtils.java
RegExUtils.replaceAll
public static String replaceAll(final String text, final Pattern regex, final String replacement) { if (text == null || regex == null || replacement == null) { return text; } return regex.matcher(text).replaceAll(replacement); }
java
public static String replaceAll(final String text, final Pattern regex, final String replacement) { if (text == null || regex == null || replacement == null) { return text; } return regex.matcher(text).replaceAll(replacement); }
[ "public", "static", "String", "replaceAll", "(", "final", "String", "text", ",", "final", "Pattern", "regex", ",", "final", "String", "replacement", ")", "{", "if", "(", "text", "==", "null", "||", "regex", "==", "null", "||", "replacement", "==", "null", ...
<p>Replaces each substring of the text String that matches the given regular expression pattern with the given replacement.</p> This method is a {@code null} safe equivalent to: <ul> <li>{@code pattern.matcher(text).replaceAll(replacement)}</li> </ul> <p>A {@code null} reference passed to this method is a no-op.</p> <pre> StringUtils.replaceAll(null, *, *) = null StringUtils.replaceAll("any", (Pattern) null, *) = "any" StringUtils.replaceAll("any", *, null) = "any" StringUtils.replaceAll("", Pattern.compile(""), "zzz") = "zzz" StringUtils.replaceAll("", Pattern.compile(".*"), "zzz") = "zzz" StringUtils.replaceAll("", Pattern.compile(".+"), "zzz") = "" StringUtils.replaceAll("abc", Pattern.compile(""), "ZZ") = "ZZaZZbZZcZZ" StringUtils.replaceAll("&lt;__&gt;\n&lt;__&gt;", Pattern.compile("&lt;.*&gt;"), "z") = "z\nz" StringUtils.replaceAll("&lt;__&gt;\n&lt;__&gt;", Pattern.compile("&lt;.*&gt;", Pattern.DOTALL), "z") = "z" StringUtils.replaceAll("&lt;__&gt;\n&lt;__&gt;", Pattern.compile("(?s)&lt;.*&gt;"), "z") = "z" StringUtils.replaceAll("ABCabc123", Pattern.compile("[a-z]"), "_") = "ABC___123" StringUtils.replaceAll("ABCabc123", Pattern.compile("[^A-Z0-9]+"), "_") = "ABC_123" StringUtils.replaceAll("ABCabc123", Pattern.compile("[^A-Z0-9]+"), "") = "ABC123" StringUtils.replaceAll("Lorem ipsum dolor sit", Pattern.compile("( +)([a-z]+)"), "_$2") = "Lorem_ipsum_dolor_sit" </pre> @param text text to search and replace in, may be null @param regex the regular expression pattern to which this string is to be matched @param replacement the string to be substituted for each match @return the text with any replacements processed, {@code null} if null String input @see java.util.regex.Matcher#replaceAll(String) @see java.util.regex.Pattern
[ "<p", ">", "Replaces", "each", "substring", "of", "the", "text", "String", "that", "matches", "the", "given", "regular", "expression", "pattern", "with", "the", "given", "replacement", ".", "<", "/", "p", ">" ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/RegExUtils.java#L258-L263
UrielCh/ovh-java-sdk
ovh-java-sdk-service/src/main/java/net/minidev/ovh/api/ApiOvhService.java
ApiOvhService.serviceId_PUT
public void serviceId_PUT(Long serviceId, OvhService body) throws IOException { String qPath = "/service/{serviceId}"; StringBuilder sb = path(qPath, serviceId); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceId_PUT(Long serviceId, OvhService body) throws IOException { String qPath = "/service/{serviceId}"; StringBuilder sb = path(qPath, serviceId); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceId_PUT", "(", "Long", "serviceId", ",", "OvhService", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/service/{serviceId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceId", ")", ";", "e...
Alter this object properties REST: PUT /service/{serviceId} @param body [required] New object properties @param serviceId [required] The internal ID of your service API beta
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-service/src/main/java/net/minidev/ovh/api/ApiOvhService.java#L76-L80
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/AmazonWebServiceClient.java
AmazonWebServiceClient.setRegion
@Deprecated public void setRegion(Region region) throws IllegalArgumentException { checkMutability(); if (region == null) { throw new IllegalArgumentException("No region provided"); } final String serviceNameForEndpoint = getEndpointPrefix(); final String serviceNameForSigner = getServiceNameIntern(); URI uri = new DefaultServiceEndpointBuilder(serviceNameForEndpoint, clientConfiguration.getProtocol() .toString()).withRegion(region).getServiceEndpoint(); Signer signer = computeSignerByServiceRegion(serviceNameForSigner, region.getName(), signerRegionOverride, false); synchronized (this) { this.endpoint = uri; this.signerProvider = createSignerProvider(signer); this.signingRegion = AwsHostNameUtils.parseRegion(endpoint.toString(), getEndpointPrefix()); } }
java
@Deprecated public void setRegion(Region region) throws IllegalArgumentException { checkMutability(); if (region == null) { throw new IllegalArgumentException("No region provided"); } final String serviceNameForEndpoint = getEndpointPrefix(); final String serviceNameForSigner = getServiceNameIntern(); URI uri = new DefaultServiceEndpointBuilder(serviceNameForEndpoint, clientConfiguration.getProtocol() .toString()).withRegion(region).getServiceEndpoint(); Signer signer = computeSignerByServiceRegion(serviceNameForSigner, region.getName(), signerRegionOverride, false); synchronized (this) { this.endpoint = uri; this.signerProvider = createSignerProvider(signer); this.signingRegion = AwsHostNameUtils.parseRegion(endpoint.toString(), getEndpointPrefix()); } }
[ "@", "Deprecated", "public", "void", "setRegion", "(", "Region", "region", ")", "throws", "IllegalArgumentException", "{", "checkMutability", "(", ")", ";", "if", "(", "region", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"No regio...
An alternative to {@link AmazonWebServiceClient#setEndpoint(String)}, sets the regional endpoint for this client's service calls. Callers can use this method to control which AWS region they want to work with. <p> <b>This method is not threadsafe. A region should be configured when the client is created and before any service requests are made. Changing it afterwards creates inevitable race conditions for any service requests in transit or retrying.</b> <p> By default, all service endpoints in all regions use the https protocol. To use http instead, specify it in the {@link ClientConfiguration} supplied at construction. @param region The region this client will communicate with. See {@link Region#getRegion(com.amazonaws.regions.Regions)} for accessing a given region. @throws java.lang.IllegalArgumentException If the given region is null, or if this service isn't available in the given region. See {@link Region#isServiceSupported(String)} @see Region#getRegion(com.amazonaws.regions.Regions) @see Region#createClient(Class, com.amazonaws.auth.AWSCredentialsProvider, ClientConfiguration) @deprecated use {@link AwsClientBuilder#setRegion(String)}
[ "An", "alternative", "to", "{", "@link", "AmazonWebServiceClient#setEndpoint", "(", "String", ")", "}", "sets", "the", "regional", "endpoint", "for", "this", "client", "s", "service", "calls", ".", "Callers", "can", "use", "this", "method", "to", "control", "w...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/AmazonWebServiceClient.java#L486-L502
cycorp/api-suite
core-api/src/main/java/com/cyc/session/exception/SessionServiceException.java
SessionServiceException.fromThrowable
public static SessionServiceException fromThrowable(Class interfaceClass, String message, Throwable cause) { return (cause instanceof SessionServiceException && Objects.equals(interfaceClass, ((SessionServiceException) cause).getInterfaceClass()) && Objects.equals(message, cause.getMessage())) ? (SessionServiceException) cause : new SessionServiceException(interfaceClass, message, cause); }
java
public static SessionServiceException fromThrowable(Class interfaceClass, String message, Throwable cause) { return (cause instanceof SessionServiceException && Objects.equals(interfaceClass, ((SessionServiceException) cause).getInterfaceClass()) && Objects.equals(message, cause.getMessage())) ? (SessionServiceException) cause : new SessionServiceException(interfaceClass, message, cause); }
[ "public", "static", "SessionServiceException", "fromThrowable", "(", "Class", "interfaceClass", ",", "String", "message", ",", "Throwable", "cause", ")", "{", "return", "(", "cause", "instanceof", "SessionServiceException", "&&", "Objects", ".", "equals", "(", "inte...
Converts a Throwable to a SessionServiceException with the specified detail message. If the Throwable is a SessionServiceException and if the Throwable's message is identical to the one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in a new SessionServiceException with the detail message. @param cause the Throwable to convert @param interfaceClass @param message the specified detail message @return a SessionServiceException
[ "Converts", "a", "Throwable", "to", "a", "SessionServiceException", "with", "the", "specified", "detail", "message", ".", "If", "the", "Throwable", "is", "a", "SessionServiceException", "and", "if", "the", "Throwable", "s", "message", "is", "identical", "to", "t...
train
https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/SessionServiceException.java#L64-L70
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/BandwidthClient.java
BandwidthClient.requestJson
protected RestResponse requestJson(final String path, final String method, final String param) throws IOException, AppPlatformException { final HttpUriRequest request = setupRequestJson(path, method, param); return performRequest(request); }
java
protected RestResponse requestJson(final String path, final String method, final String param) throws IOException, AppPlatformException { final HttpUriRequest request = setupRequestJson(path, method, param); return performRequest(request); }
[ "protected", "RestResponse", "requestJson", "(", "final", "String", "path", ",", "final", "String", "method", ",", "final", "String", "param", ")", "throws", "IOException", ",", "AppPlatformException", "{", "final", "HttpUriRequest", "request", "=", "setupRequestJso...
Helper method to build the request to the server. @param path the path @param method the method @param param payload json string @return the response. @throws IOException unexpected exception. @throws AppPlatformException unexpected exception.
[ "Helper", "method", "to", "build", "the", "request", "to", "the", "server", "." ]
train
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/BandwidthClient.java#L498-L502
foundation-runtime/service-directory
2.0/sd-core/src/main/java/com/cisco/oss/foundation/directory/Configurations.java
Configurations.getString
public static String getString(String name, String defaultVal){ if(getConfiguration().containsKey(name)){ return getConfiguration().getString(name); } else { return defaultVal; } }
java
public static String getString(String name, String defaultVal){ if(getConfiguration().containsKey(name)){ return getConfiguration().getString(name); } else { return defaultVal; } }
[ "public", "static", "String", "getString", "(", "String", "name", ",", "String", "defaultVal", ")", "{", "if", "(", "getConfiguration", "(", ")", ".", "containsKey", "(", "name", ")", ")", "{", "return", "getConfiguration", "(", ")", ".", "getString", "(",...
Get the property object as String, or return defaultVal if property is not defined. @param name property name. @param defaultVal default property value. @return property value as String, return defaultVal if property is undefined.
[ "Get", "the", "property", "object", "as", "String", "or", "return", "defaultVal", "if", "property", "is", "not", "defined", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-core/src/main/java/com/cisco/oss/foundation/directory/Configurations.java#L98-L104
google/error-prone
core/src/main/java/com/google/errorprone/bugpatterns/ModifiedButNotUsed.java
ModifiedButNotUsed.newFluentChain
private static boolean newFluentChain(ExpressionTree tree, VisitorState state) { while (tree instanceof MethodInvocationTree && FLUENT_CHAIN.matches(tree, state)) { tree = getReceiver(tree); } return tree != null && FLUENT_CONSTRUCTOR.matches(tree, state); }
java
private static boolean newFluentChain(ExpressionTree tree, VisitorState state) { while (tree instanceof MethodInvocationTree && FLUENT_CHAIN.matches(tree, state)) { tree = getReceiver(tree); } return tree != null && FLUENT_CONSTRUCTOR.matches(tree, state); }
[ "private", "static", "boolean", "newFluentChain", "(", "ExpressionTree", "tree", ",", "VisitorState", "state", ")", "{", "while", "(", "tree", "instanceof", "MethodInvocationTree", "&&", "FLUENT_CHAIN", ".", "matches", "(", "tree", ",", "state", ")", ")", "{", ...
Whether this is a chain of method invocations terminating in a new proto or collection builder.
[ "Whether", "this", "is", "a", "chain", "of", "method", "invocations", "terminating", "in", "a", "new", "proto", "or", "collection", "builder", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/ModifiedButNotUsed.java#L299-L304
undertow-io/undertow
servlet/src/main/java/io/undertow/servlet/Servlets.java
Servlets.multipartConfig
public static MultipartConfigElement multipartConfig(String location, long maxFileSize, long maxRequestSize, int fileSizeThreshold) { return new MultipartConfigElement(location, maxFileSize, maxRequestSize, fileSizeThreshold); }
java
public static MultipartConfigElement multipartConfig(String location, long maxFileSize, long maxRequestSize, int fileSizeThreshold) { return new MultipartConfigElement(location, maxFileSize, maxRequestSize, fileSizeThreshold); }
[ "public", "static", "MultipartConfigElement", "multipartConfig", "(", "String", "location", ",", "long", "maxFileSize", ",", "long", "maxRequestSize", ",", "int", "fileSizeThreshold", ")", "{", "return", "new", "MultipartConfigElement", "(", "location", ",", "maxFileS...
Creates a new multipart config element @param location the directory location where files will be stored @param maxFileSize the maximum size allowed for uploaded files @param maxRequestSize the maximum size allowed for multipart/form-data requests @param fileSizeThreshold the size threshold after which files will be written to disk
[ "Creates", "a", "new", "multipart", "config", "element" ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/servlet/src/main/java/io/undertow/servlet/Servlets.java#L159-L161
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java
TimestampUtils.toTimeBin
public Time toTimeBin(TimeZone tz, byte[] bytes) throws PSQLException { if ((bytes.length != 8 && bytes.length != 12)) { throw new PSQLException(GT.tr("Unsupported binary encoding of {0}.", "time"), PSQLState.BAD_DATETIME_FORMAT); } long millis; int timeOffset; if (usesDouble) { double time = ByteConverter.float8(bytes, 0); millis = (long) (time * 1000); } else { long time = ByteConverter.int8(bytes, 0); millis = time / 1000; } if (bytes.length == 12) { timeOffset = ByteConverter.int4(bytes, 8); timeOffset *= -1000; millis -= timeOffset; return new Time(millis); } if (tz == null) { tz = getDefaultTz(); } // Here be dragons: backend did not provide us the timezone, so we guess the actual point in // time millis = guessTimestamp(millis, tz); return convertToTime(millis, tz); // Ensure date part is 1970-01-01 }
java
public Time toTimeBin(TimeZone tz, byte[] bytes) throws PSQLException { if ((bytes.length != 8 && bytes.length != 12)) { throw new PSQLException(GT.tr("Unsupported binary encoding of {0}.", "time"), PSQLState.BAD_DATETIME_FORMAT); } long millis; int timeOffset; if (usesDouble) { double time = ByteConverter.float8(bytes, 0); millis = (long) (time * 1000); } else { long time = ByteConverter.int8(bytes, 0); millis = time / 1000; } if (bytes.length == 12) { timeOffset = ByteConverter.int4(bytes, 8); timeOffset *= -1000; millis -= timeOffset; return new Time(millis); } if (tz == null) { tz = getDefaultTz(); } // Here be dragons: backend did not provide us the timezone, so we guess the actual point in // time millis = guessTimestamp(millis, tz); return convertToTime(millis, tz); // Ensure date part is 1970-01-01 }
[ "public", "Time", "toTimeBin", "(", "TimeZone", "tz", ",", "byte", "[", "]", "bytes", ")", "throws", "PSQLException", "{", "if", "(", "(", "bytes", ".", "length", "!=", "8", "&&", "bytes", ".", "length", "!=", "12", ")", ")", "{", "throw", "new", "...
Returns the SQL Time object matching the given bytes with {@link Oid#TIME} or {@link Oid#TIMETZ}. @param tz The timezone used when received data is {@link Oid#TIME}, ignored if data already contains {@link Oid#TIMETZ}. @param bytes The binary encoded time value. @return The parsed time object. @throws PSQLException If binary format could not be parsed.
[ "Returns", "the", "SQL", "Time", "object", "matching", "the", "given", "bytes", "with", "{", "@link", "Oid#TIME", "}", "or", "{", "@link", "Oid#TIMETZ", "}", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java#L967-L1002
OpenLiberty/open-liberty
dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/BootstrapContextImpl.java
BootstrapContextImpl.getDestinationName
private Object getDestinationName(String destinationType, Object destination) throws Exception { String methodName; if ("javax.jms.Queue".equals(destinationType)) methodName = "getQueueName"; else if ("javax.jms.Topic".equals(destinationType)) methodName = "getTopicName"; else throw new InvalidPropertyException("destinationType: " + destinationType); try { return destination.getClass().getMethod(methodName).invoke(destination); } catch (NoSuchMethodException x) { throw new InvalidPropertyException(Tr.formatMessage(tc, "J2CA8505.destination.type.mismatch", destination, destinationType), x); } }
java
private Object getDestinationName(String destinationType, Object destination) throws Exception { String methodName; if ("javax.jms.Queue".equals(destinationType)) methodName = "getQueueName"; else if ("javax.jms.Topic".equals(destinationType)) methodName = "getTopicName"; else throw new InvalidPropertyException("destinationType: " + destinationType); try { return destination.getClass().getMethod(methodName).invoke(destination); } catch (NoSuchMethodException x) { throw new InvalidPropertyException(Tr.formatMessage(tc, "J2CA8505.destination.type.mismatch", destination, destinationType), x); } }
[ "private", "Object", "getDestinationName", "(", "String", "destinationType", ",", "Object", "destination", ")", "throws", "Exception", "{", "String", "methodName", ";", "if", "(", "\"javax.jms.Queue\"", ".", "equals", "(", "destinationType", ")", ")", "methodName", ...
Returns the name of the queue or topic. @param destinationType type of destination (javax.jms.Queue or javax.jms.Topic). @param value instance of the above type. @return name of the queue or topic. @throws Exception if unable to obtain the destination name.
[ "Returns", "the", "name", "of", "the", "queue", "or", "topic", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/BootstrapContextImpl.java#L801-L815
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.mergeCertificate
public CertificateBundle mergeCertificate(String vaultBaseUrl, String certificateName, List<byte[]> x509Certificates) { return mergeCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, x509Certificates).toBlocking().single().body(); }
java
public CertificateBundle mergeCertificate(String vaultBaseUrl, String certificateName, List<byte[]> x509Certificates) { return mergeCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, x509Certificates).toBlocking().single().body(); }
[ "public", "CertificateBundle", "mergeCertificate", "(", "String", "vaultBaseUrl", ",", "String", "certificateName", ",", "List", "<", "byte", "[", "]", ">", "x509Certificates", ")", "{", "return", "mergeCertificateWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "...
Merges a certificate or a certificate chain with a key pair existing on the server. The MergeCertificate operation performs the merging of a certificate or certificate chain with a key pair currently available in the service. This operation requires the certificates/create permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param certificateName The name of the certificate. @param x509Certificates The certificate or the certificate chain to merge. @throws IllegalArgumentException thrown if parameters fail the validation @throws KeyVaultErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the CertificateBundle object if successful.
[ "Merges", "a", "certificate", "or", "a", "certificate", "chain", "with", "a", "key", "pair", "existing", "on", "the", "server", ".", "The", "MergeCertificate", "operation", "performs", "the", "merging", "of", "a", "certificate", "or", "certificate", "chain", "...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L7911-L7913
RestComm/sip-servlets
sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipSessionsUtilImpl.java
SipSessionsUtilImpl.addCorrespondingSipSession
public void addCorrespondingSipSession(MobicentsSipSession newSession, MobicentsSipSession correspondingSipSession, String headerName) { if(JoinHeader.NAME.equalsIgnoreCase(headerName)) { joinSession.putIfAbsent(newSession.getKey(), correspondingSipSession); } else if (ReplacesHeader.NAME.equalsIgnoreCase(headerName)) { replacesSession.putIfAbsent(newSession.getKey(), correspondingSipSession); } else { throw new IllegalArgumentException("headerName argument should either be one of Join or Replaces, was : " + headerName); } }
java
public void addCorrespondingSipSession(MobicentsSipSession newSession, MobicentsSipSession correspondingSipSession, String headerName) { if(JoinHeader.NAME.equalsIgnoreCase(headerName)) { joinSession.putIfAbsent(newSession.getKey(), correspondingSipSession); } else if (ReplacesHeader.NAME.equalsIgnoreCase(headerName)) { replacesSession.putIfAbsent(newSession.getKey(), correspondingSipSession); } else { throw new IllegalArgumentException("headerName argument should either be one of Join or Replaces, was : " + headerName); } }
[ "public", "void", "addCorrespondingSipSession", "(", "MobicentsSipSession", "newSession", ",", "MobicentsSipSession", "correspondingSipSession", ",", "String", "headerName", ")", "{", "if", "(", "JoinHeader", ".", "NAME", ".", "equalsIgnoreCase", "(", "headerName", ")",...
Add a mapping between a new session and a corresponding sipSession related to a headerName. See Also getCorrespondingSipSession method. @param newSession the new session @param correspondingSipSession the corresponding sip session to add @param headerName the header name
[ "Add", "a", "mapping", "between", "a", "new", "session", "and", "a", "corresponding", "sipSession", "related", "to", "a", "headerName", ".", "See", "Also", "getCorrespondingSipSession", "method", "." ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipSessionsUtilImpl.java#L160-L168
looly/hutool
hutool-http/src/main/java/cn/hutool/http/HttpUtil.java
HttpUtil.download
public static long download(String url, OutputStream out, boolean isCloseOut, StreamProgress streamProgress) { if (StrUtil.isBlank(url)) { throw new NullPointerException("[url] is null!"); } if (null == out) { throw new NullPointerException("[out] is null!"); } final HttpResponse response = HttpRequest.get(url).executeAsync(); if (false == response.isOk()) { throw new HttpException("Server response error with status code: [{}]", response.getStatus()); } return response.writeBody(out, isCloseOut, streamProgress); }
java
public static long download(String url, OutputStream out, boolean isCloseOut, StreamProgress streamProgress) { if (StrUtil.isBlank(url)) { throw new NullPointerException("[url] is null!"); } if (null == out) { throw new NullPointerException("[out] is null!"); } final HttpResponse response = HttpRequest.get(url).executeAsync(); if (false == response.isOk()) { throw new HttpException("Server response error with status code: [{}]", response.getStatus()); } return response.writeBody(out, isCloseOut, streamProgress); }
[ "public", "static", "long", "download", "(", "String", "url", ",", "OutputStream", "out", ",", "boolean", "isCloseOut", ",", "StreamProgress", "streamProgress", ")", "{", "if", "(", "StrUtil", ".", "isBlank", "(", "url", ")", ")", "{", "throw", "new", "Nul...
下载远程文件 @param url 请求的url @param out 将下载内容写到输出流中 {@link OutputStream} @param isCloseOut 是否关闭输出流 @param streamProgress 进度条 @return 文件大小
[ "下载远程文件" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpUtil.java#L339-L352
milaboratory/milib
src/main/java/com/milaboratory/core/sequence/SequencesUtils.java
SequencesUtils.belongsToAlphabet
public static boolean belongsToAlphabet(Alphabet<?> alphabet, String string) { for (int i = 0; i < string.length(); ++i) if (alphabet.symbolToCode(string.charAt(i)) == -1) return false; return true; }
java
public static boolean belongsToAlphabet(Alphabet<?> alphabet, String string) { for (int i = 0; i < string.length(); ++i) if (alphabet.symbolToCode(string.charAt(i)) == -1) return false; return true; }
[ "public", "static", "boolean", "belongsToAlphabet", "(", "Alphabet", "<", "?", ">", "alphabet", ",", "String", "string", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "string", ".", "length", "(", ")", ";", "++", "i", ")", "if", "(", ...
Check if a sequence contains letters only from specified alphabet. So in can be converted to corresponding type of sequence. @param alphabet alphabet @param string string to check @return {@literal true} if sequence belongs to alphabet, {@literal false} if does not
[ "Check", "if", "a", "sequence", "contains", "letters", "only", "from", "specified", "alphabet", ".", "So", "in", "can", "be", "converted", "to", "corresponding", "type", "of", "sequence", "." ]
train
https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/sequence/SequencesUtils.java#L39-L44
appium/java-client
src/main/java/io/appium/java_client/service/local/AppiumDriverLocalService.java
AppiumDriverLocalService.addSlf4jLogMessageConsumer
public void addSlf4jLogMessageConsumer(BiConsumer<String, Slf4jLogMessageContext> slf4jLogMessageConsumer) { checkNotNull(slf4jLogMessageConsumer, "slf4jLogMessageConsumer parameter is NULL!"); addLogMessageConsumer(logMessage -> { slf4jLogMessageConsumer.accept(logMessage, parseSlf4jContextFromLogMessage(logMessage)); }); }
java
public void addSlf4jLogMessageConsumer(BiConsumer<String, Slf4jLogMessageContext> slf4jLogMessageConsumer) { checkNotNull(slf4jLogMessageConsumer, "slf4jLogMessageConsumer parameter is NULL!"); addLogMessageConsumer(logMessage -> { slf4jLogMessageConsumer.accept(logMessage, parseSlf4jContextFromLogMessage(logMessage)); }); }
[ "public", "void", "addSlf4jLogMessageConsumer", "(", "BiConsumer", "<", "String", ",", "Slf4jLogMessageContext", ">", "slf4jLogMessageConsumer", ")", "{", "checkNotNull", "(", "slf4jLogMessageConsumer", ",", "\"slf4jLogMessageConsumer parameter is NULL!\"", ")", ";", "addLogM...
When a complete log message is available (from server output data) that message is parsed for its slf4j context (logger name, logger level etc.) and the specified {@code BiConsumer} is invoked with the log message and slf4j context. <p>Use this method only if you want a behavior that differentiates from the default behavior as enabled by method {@link #enableDefaultSlf4jLoggingOfOutputData()}. <p>NOTE: You might want to call method {@link #clearOutPutStreams()} before calling this method. <p>implementation detail: <ul> <li>if log message begins with {@code [debug]} then log level is set to {@code DEBUG}, otherwise log level is {@code INFO}.</li> <li>the appium sub module name is parsed from the log message and used as logger name (prefixed with "appium.service.", all lower case, spaces removed). If no appium sub module is detected then "appium.service" is used as logger name.</li> </ul> Example log-message: "[ADB] Cannot read version codes of " is logged by {@code appium.service.adb} at level {@code INFO} <br> Example log-message: "[debug] [XCUITest] Xcode version set to 'x.y.z' " is logged by {@code appium.service.xcuitest} at level {@code DEBUG} <br> @param slf4jLogMessageConsumer BiConsumer block to be executed when a log message is available.
[ "When", "a", "complete", "log", "message", "is", "available", "(", "from", "server", "output", "data", ")", "that", "message", "is", "parsed", "for", "its", "slf4j", "context", "(", "logger", "name", "logger", "level", "etc", ".", ")", "and", "the", "spe...
train
https://github.com/appium/java-client/blob/5a17759b05d6fda8ef425b3ab6e766c73ed2e8df/src/main/java/io/appium/java_client/service/local/AppiumDriverLocalService.java#L310-L315
lucmoreau/ProvToolbox
prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java
ProvFactory.newWasGeneratedBy
public WasGeneratedBy newWasGeneratedBy(QualifiedName id, QualifiedName entity, QualifiedName activity) { WasGeneratedBy res=newWasGeneratedBy(id,entity,null,activity); return res; }
java
public WasGeneratedBy newWasGeneratedBy(QualifiedName id, QualifiedName entity, QualifiedName activity) { WasGeneratedBy res=newWasGeneratedBy(id,entity,null,activity); return res; }
[ "public", "WasGeneratedBy", "newWasGeneratedBy", "(", "QualifiedName", "id", ",", "QualifiedName", "entity", ",", "QualifiedName", "activity", ")", "{", "WasGeneratedBy", "res", "=", "newWasGeneratedBy", "(", "id", ",", "entity", ",", "null", ",", "activity", ")",...
A factory method to create an instance of a generation {@link WasGeneratedBy} @param id an optional identifier for a usage @param entity an identifier for the created <a href="http://www.w3.org/TR/prov-dm/#generation.entity">entity</a> @param activity an optional identifier for the <a href="http://www.w3.org/TR/prov-dm/#generation.activity">activity</a> that creates the entity @return an instance of {@link WasGeneratedBy}
[ "A", "factory", "method", "to", "create", "an", "instance", "of", "a", "generation", "{" ]
train
https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java#L1331-L1334
infinispan/infinispan
core/src/main/java/org/infinispan/container/impl/InternalEntryFactoryImpl.java
InternalEntryFactoryImpl.isStoreMetadata
public static boolean isStoreMetadata(Metadata metadata, InternalCacheEntry ice) { return metadata != null && (ice == null || isEntryMetadataAware(ice)) && (metadata.version() != null || !(metadata instanceof EmbeddedMetadata)); }
java
public static boolean isStoreMetadata(Metadata metadata, InternalCacheEntry ice) { return metadata != null && (ice == null || isEntryMetadataAware(ice)) && (metadata.version() != null || !(metadata instanceof EmbeddedMetadata)); }
[ "public", "static", "boolean", "isStoreMetadata", "(", "Metadata", "metadata", ",", "InternalCacheEntry", "ice", ")", "{", "return", "metadata", "!=", "null", "&&", "(", "ice", "==", "null", "||", "isEntryMetadataAware", "(", "ice", ")", ")", "&&", "(", "met...
Indicates whether the entire metadata object needs to be stored or not. This check is done to avoid keeping the entire metadata object around when only lifespan or maxIdle time is stored. If more information needs to be stored (i.e. version), or the metadata object is not the embedded one, keep the entire metadata object around. @return true if the entire metadata object needs to be stored, otherwise simply store lifespan and/or maxIdle in existing cache entries
[ "Indicates", "whether", "the", "entire", "metadata", "object", "needs", "to", "be", "stored", "or", "not", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/container/impl/InternalEntryFactoryImpl.java#L387-L392
Impetus/Kundera
src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/HBaseClient.java
HBaseClient.findData
public <E> List<E> findData(EntityMetadata m, Object rowKey, byte[] startRow, byte[] endRow, List<Map<String, Object>> columnsToOutput, Filter filters) { String tableName = HBaseUtils.getHTableName(m.getSchema(), m.getTableName()); FilterList filterList = getFilterList(filters); try { return handler.readData(tableName, m, rowKey, startRow, endRow, columnsToOutput, filterList); } catch (IOException ioex) { log.error("Error during find by range, Caused by: .", ioex); throw new KunderaException("Error during find by range, Caused by: .", ioex); } }
java
public <E> List<E> findData(EntityMetadata m, Object rowKey, byte[] startRow, byte[] endRow, List<Map<String, Object>> columnsToOutput, Filter filters) { String tableName = HBaseUtils.getHTableName(m.getSchema(), m.getTableName()); FilterList filterList = getFilterList(filters); try { return handler.readData(tableName, m, rowKey, startRow, endRow, columnsToOutput, filterList); } catch (IOException ioex) { log.error("Error during find by range, Caused by: .", ioex); throw new KunderaException("Error during find by range, Caused by: .", ioex); } }
[ "public", "<", "E", ">", "List", "<", "E", ">", "findData", "(", "EntityMetadata", "m", ",", "Object", "rowKey", ",", "byte", "[", "]", "startRow", ",", "byte", "[", "]", "endRow", ",", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", ...
Find data. @param <E> the element type @param m the m @param rowKey the row key @param startRow the start row @param endRow the end row @param columnsToOutput the columns to output @param filters the filters @return the list
[ "Find", "data", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/HBaseClient.java#L247-L261
elki-project/elki
addons/joglvis/src/main/java/de/lmu/ifi/dbs/elki/joglvis/ShaderUtil.java
ShaderUtil.compileShader
public static int compileShader(Class<?> context, GL2 gl, int type, String name) throws ShaderCompilationException { int prog = -1; try (InputStream in = context.getResourceAsStream(name)) { int[] error = new int[1]; String shaderdata = FileUtil.slurp(in); prog = gl.glCreateShader(type); gl.glShaderSource(prog, 1, new String[] { shaderdata }, null, 0); gl.glCompileShader(prog); // This worked best for me to capture error messages: gl.glGetObjectParameterivARB(prog, GL2.GL_OBJECT_INFO_LOG_LENGTH_ARB, error, 0); if(error[0] > 1) { byte[] info = new byte[error[0]]; gl.glGetInfoLogARB(prog, info.length, error, 0, info, 0); String out = new String(info); gl.glDeleteShader(prog); throw new ShaderCompilationException("Shader compilation error in '" + name + "': " + out); } // Different way of catching errors. gl.glGetShaderiv(prog, GL2.GL_COMPILE_STATUS, error, 0); if(error[0] > 1) { throw new ShaderCompilationException("Shader compilation of '" + name + "' failed."); } } catch(IOException e) { throw new ShaderCompilationException("IO error loading shader: " + name, e); } return prog; }
java
public static int compileShader(Class<?> context, GL2 gl, int type, String name) throws ShaderCompilationException { int prog = -1; try (InputStream in = context.getResourceAsStream(name)) { int[] error = new int[1]; String shaderdata = FileUtil.slurp(in); prog = gl.glCreateShader(type); gl.glShaderSource(prog, 1, new String[] { shaderdata }, null, 0); gl.glCompileShader(prog); // This worked best for me to capture error messages: gl.glGetObjectParameterivARB(prog, GL2.GL_OBJECT_INFO_LOG_LENGTH_ARB, error, 0); if(error[0] > 1) { byte[] info = new byte[error[0]]; gl.glGetInfoLogARB(prog, info.length, error, 0, info, 0); String out = new String(info); gl.glDeleteShader(prog); throw new ShaderCompilationException("Shader compilation error in '" + name + "': " + out); } // Different way of catching errors. gl.glGetShaderiv(prog, GL2.GL_COMPILE_STATUS, error, 0); if(error[0] > 1) { throw new ShaderCompilationException("Shader compilation of '" + name + "' failed."); } } catch(IOException e) { throw new ShaderCompilationException("IO error loading shader: " + name, e); } return prog; }
[ "public", "static", "int", "compileShader", "(", "Class", "<", "?", ">", "context", ",", "GL2", "gl", ",", "int", "type", ",", "String", "name", ")", "throws", "ShaderCompilationException", "{", "int", "prog", "=", "-", "1", ";", "try", "(", "InputStream...
Compile a shader from a file. @param context Class context for loading the resource file. @param gl GL context @param type @param name @return Shader program number. @throws ShaderCompilationException When compilation failed.
[ "Compile", "a", "shader", "from", "a", "file", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/joglvis/src/main/java/de/lmu/ifi/dbs/elki/joglvis/ShaderUtil.java#L54-L81
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/LegacyDfuImpl.java
LegacyDfuImpl.resetAndRestart
private void resetAndRestart(@NonNull final BluetoothGatt gatt, @NonNull final Intent intent) throws DfuException, DeviceDisconnectedException, UploadAbortedException { mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_WARNING, "Last upload interrupted. Restarting device..."); // Send 'jump to bootloader command' (Start DFU) mProgressInfo.setProgress(DfuBaseService.PROGRESS_DISCONNECTING); logi("Sending Reset command (Op Code = 6)"); writeOpCode(mControlPointCharacteristic, OP_CODE_RESET); mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_APPLICATION, "Reset request sent"); // The device will reset so we don't have to send Disconnect signal. mService.waitUntilDisconnected(); mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_INFO, "Disconnected by the remote device"); final BluetoothGattService gas = gatt.getService(GENERIC_ATTRIBUTE_SERVICE_UUID); final boolean hasServiceChanged = gas != null && gas.getCharacteristic(SERVICE_CHANGED_UUID) != null; mService.refreshDeviceCache(gatt, !hasServiceChanged); // Close the device mService.close(gatt); logi("Restarting the service"); final Intent newIntent = new Intent(); newIntent.fillIn(intent, Intent.FILL_IN_COMPONENT | Intent.FILL_IN_PACKAGE); restartService(newIntent, false); }
java
private void resetAndRestart(@NonNull final BluetoothGatt gatt, @NonNull final Intent intent) throws DfuException, DeviceDisconnectedException, UploadAbortedException { mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_WARNING, "Last upload interrupted. Restarting device..."); // Send 'jump to bootloader command' (Start DFU) mProgressInfo.setProgress(DfuBaseService.PROGRESS_DISCONNECTING); logi("Sending Reset command (Op Code = 6)"); writeOpCode(mControlPointCharacteristic, OP_CODE_RESET); mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_APPLICATION, "Reset request sent"); // The device will reset so we don't have to send Disconnect signal. mService.waitUntilDisconnected(); mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_INFO, "Disconnected by the remote device"); final BluetoothGattService gas = gatt.getService(GENERIC_ATTRIBUTE_SERVICE_UUID); final boolean hasServiceChanged = gas != null && gas.getCharacteristic(SERVICE_CHANGED_UUID) != null; mService.refreshDeviceCache(gatt, !hasServiceChanged); // Close the device mService.close(gatt); logi("Restarting the service"); final Intent newIntent = new Intent(); newIntent.fillIn(intent, Intent.FILL_IN_COMPONENT | Intent.FILL_IN_PACKAGE); restartService(newIntent, false); }
[ "private", "void", "resetAndRestart", "(", "@", "NonNull", "final", "BluetoothGatt", "gatt", ",", "@", "NonNull", "final", "Intent", "intent", ")", "throws", "DfuException", ",", "DeviceDisconnectedException", ",", "UploadAbortedException", "{", "mService", ".", "se...
Sends Reset command to the target device to reset its state and restarts the DFU Service that will start again. @param gatt the GATT device. @param intent intent used to start the service. @throws DeviceDisconnectedException Thrown when the device will disconnect in the middle of the transmission. @throws DfuException Thrown if DFU error occur. @throws UploadAbortedException Thrown if DFU operation was aborted by user.
[ "Sends", "Reset", "command", "to", "the", "target", "device", "to", "reset", "its", "state", "and", "restarts", "the", "DFU", "Service", "that", "will", "start", "again", "." ]
train
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/LegacyDfuImpl.java#L720-L744
Backendless/Android-SDK
src/com/backendless/persistence/BackendlessSerializer.java
BackendlessSerializer.getOrMakeSerializedObject
private Object getOrMakeSerializedObject( Object entityEntryValue, Map<Object, Map<String, Object>> serializedCache ) { if( serializedCache.containsKey( entityEntryValue ) ) //cyclic relation { //take from cache and substitute return serializedCache.get( entityEntryValue ); } else //not cyclic relation { //serialize and put into result return serializeToMap( entityEntryValue, serializedCache ); } }
java
private Object getOrMakeSerializedObject( Object entityEntryValue, Map<Object, Map<String, Object>> serializedCache ) { if( serializedCache.containsKey( entityEntryValue ) ) //cyclic relation { //take from cache and substitute return serializedCache.get( entityEntryValue ); } else //not cyclic relation { //serialize and put into result return serializeToMap( entityEntryValue, serializedCache ); } }
[ "private", "Object", "getOrMakeSerializedObject", "(", "Object", "entityEntryValue", ",", "Map", "<", "Object", ",", "Map", "<", "String", ",", "Object", ">", ">", "serializedCache", ")", "{", "if", "(", "serializedCache", ".", "containsKey", "(", "entityEntryVa...
Returns serialized object from cache or serializes object if it's not present in cache. @param entityEntryValue object to be serialized @return Map formed from given object
[ "Returns", "serialized", "object", "from", "cache", "or", "serializes", "object", "if", "it", "s", "not", "present", "in", "cache", "." ]
train
https://github.com/Backendless/Android-SDK/blob/3af1e9a378f19d890db28a833f7fc8595b924cc3/src/com/backendless/persistence/BackendlessSerializer.java#L214-L227
ChannelFinder/javaCFClient
src/main/java/gov/bnl/channelfinder/api/CFProperties.java
CFProperties.getPreferenceValue
public String getPreferenceValue(String key, String defaultValue) { if (userCFProperties.containsKey(key)) return userCFProperties.getProperty(key); else if (userHomeCFProperties.containsKey(key)) return userHomeCFProperties.getProperty(key); else if (systemCFProperties.containsKey(key)) return systemCFProperties.getProperty(key); else if (defaultProperties.containsKey(key)) return defaultProperties.getProperty(key); else return defaultValue; }
java
public String getPreferenceValue(String key, String defaultValue) { if (userCFProperties.containsKey(key)) return userCFProperties.getProperty(key); else if (userHomeCFProperties.containsKey(key)) return userHomeCFProperties.getProperty(key); else if (systemCFProperties.containsKey(key)) return systemCFProperties.getProperty(key); else if (defaultProperties.containsKey(key)) return defaultProperties.getProperty(key); else return defaultValue; }
[ "public", "String", "getPreferenceValue", "(", "String", "key", ",", "String", "defaultValue", ")", "{", "if", "(", "userCFProperties", ".", "containsKey", "(", "key", ")", ")", "return", "userCFProperties", ".", "getProperty", "(", "key", ")", ";", "else", ...
check java preferences for the requested key - then checks the various default properties files. @param key @param defaultValue @return
[ "check", "java", "preferences", "for", "the", "requested", "key", "-", "then", "checks", "the", "various", "default", "properties", "files", "." ]
train
https://github.com/ChannelFinder/javaCFClient/blob/000fce53ad2b8f8c38ef24fec5b5ec65e383ac9d/src/main/java/gov/bnl/channelfinder/api/CFProperties.java#L100-L111
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/frequencies/LongsSketch.java
LongsSketch.getInstance
public static LongsSketch getInstance(final String string) { final String[] tokens = string.split(","); if (tokens.length < (STR_PREAMBLE_TOKENS + 2)) { throw new SketchesArgumentException( "String not long enough: " + tokens.length); } final int serVer = Integer.parseInt(tokens[0]); final int famID = Integer.parseInt(tokens[1]); final int lgMax = Integer.parseInt(tokens[2]); final int flags = Integer.parseInt(tokens[3]); final long streamWt = Long.parseLong(tokens[4]); final long offset = Long.parseLong(tokens[5]); //error offset //should always get at least the next 2 from the map final int numActive = Integer.parseInt(tokens[6]); final int lgCur = Integer.numberOfTrailingZeros(Integer.parseInt(tokens[7])); //checks if (serVer != SER_VER) { throw new SketchesArgumentException("Possible Corruption: Bad SerVer: " + serVer); } Family.FREQUENCY.checkFamilyID(famID); final boolean empty = flags > 0; if (!empty && (numActive == 0)) { throw new SketchesArgumentException( "Possible Corruption: !Empty && NumActive=0; strLen: " + numActive); } final int numTokens = tokens.length; if ((2 * numActive) != (numTokens - STR_PREAMBLE_TOKENS - 2)) { throw new SketchesArgumentException( "Possible Corruption: Incorrect # of tokens: " + numTokens + ", numActive: " + numActive); } final LongsSketch sketch = new LongsSketch(lgMax, lgCur); sketch.streamWeight = streamWt; sketch.offset = offset; sketch.hashMap = deserializeFromStringArray(tokens); return sketch; }
java
public static LongsSketch getInstance(final String string) { final String[] tokens = string.split(","); if (tokens.length < (STR_PREAMBLE_TOKENS + 2)) { throw new SketchesArgumentException( "String not long enough: " + tokens.length); } final int serVer = Integer.parseInt(tokens[0]); final int famID = Integer.parseInt(tokens[1]); final int lgMax = Integer.parseInt(tokens[2]); final int flags = Integer.parseInt(tokens[3]); final long streamWt = Long.parseLong(tokens[4]); final long offset = Long.parseLong(tokens[5]); //error offset //should always get at least the next 2 from the map final int numActive = Integer.parseInt(tokens[6]); final int lgCur = Integer.numberOfTrailingZeros(Integer.parseInt(tokens[7])); //checks if (serVer != SER_VER) { throw new SketchesArgumentException("Possible Corruption: Bad SerVer: " + serVer); } Family.FREQUENCY.checkFamilyID(famID); final boolean empty = flags > 0; if (!empty && (numActive == 0)) { throw new SketchesArgumentException( "Possible Corruption: !Empty && NumActive=0; strLen: " + numActive); } final int numTokens = tokens.length; if ((2 * numActive) != (numTokens - STR_PREAMBLE_TOKENS - 2)) { throw new SketchesArgumentException( "Possible Corruption: Incorrect # of tokens: " + numTokens + ", numActive: " + numActive); } final LongsSketch sketch = new LongsSketch(lgMax, lgCur); sketch.streamWeight = streamWt; sketch.offset = offset; sketch.hashMap = deserializeFromStringArray(tokens); return sketch; }
[ "public", "static", "LongsSketch", "getInstance", "(", "final", "String", "string", ")", "{", "final", "String", "[", "]", "tokens", "=", "string", ".", "split", "(", "\",\"", ")", ";", "if", "(", "tokens", ".", "length", "<", "(", "STR_PREAMBLE_TOKENS", ...
Returns a sketch instance of this class from the given String, which must be a String representation of this sketch class. @param string a String representation of a sketch of this class. @return a sketch instance of this class.
[ "Returns", "a", "sketch", "instance", "of", "this", "class", "from", "the", "given", "String", "which", "must", "be", "a", "String", "representation", "of", "this", "sketch", "class", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/frequencies/LongsSketch.java#L275-L313
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/functions/FunctionOneArg.java
FunctionOneArg.setArg
public void setArg(Expression arg, int argNum) throws WrongNumberArgsException { if (0 == argNum) { m_arg0 = arg; arg.exprSetParent(this); } else reportWrongNumberArgs(); }
java
public void setArg(Expression arg, int argNum) throws WrongNumberArgsException { if (0 == argNum) { m_arg0 = arg; arg.exprSetParent(this); } else reportWrongNumberArgs(); }
[ "public", "void", "setArg", "(", "Expression", "arg", ",", "int", "argNum", ")", "throws", "WrongNumberArgsException", "{", "if", "(", "0", "==", "argNum", ")", "{", "m_arg0", "=", "arg", ";", "arg", ".", "exprSetParent", "(", "this", ")", ";", "}", "e...
Set an argument expression for a function. This method is called by the XPath compiler. @param arg non-null expression that represents the argument. @param argNum The argument number index. @throws WrongNumberArgsException If the argNum parameter is greater than 0.
[ "Set", "an", "argument", "expression", "for", "a", "function", ".", "This", "method", "is", "called", "by", "the", "XPath", "compiler", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/functions/FunctionOneArg.java#L60-L71
jayantk/jklol
src/com/jayantkrish/jklol/ccg/CcgParserUtils.java
CcgParserUtils.isPossibleExample
public static boolean isPossibleExample(CcgParser parser, CcgExample example) { CcgBeamSearchChart chart = new CcgBeamSearchChart(example.getSentence(), Integer.MAX_VALUE, 100); SyntacticChartCost filter = SyntacticChartCost.createAgreementCost(example.getSyntacticParse()); parser.parseCommon(chart, example.getSentence(), filter, null, -1, 1); List<CcgParse> parses = chart.decodeBestParsesForSpan(0, example.getSentence().size() - 1, 100, parser); if (parses.size() == 0) { // Provide a deeper analysis of why parsing failed. analyzeParseFailure(example.getSyntacticParse(), chart, parser.getSyntaxVarType(), "Parse failure", 0); System.out.println("Discarding example: " + example); return false; } else if (parses.size() > 1) { analyzeParseFailure(example.getSyntacticParse(), chart, parser.getSyntaxVarType(), "Parse duplication", 2); System.out.println("Duplicate correct parse: " + example.getSyntacticParse()); } return true; }
java
public static boolean isPossibleExample(CcgParser parser, CcgExample example) { CcgBeamSearchChart chart = new CcgBeamSearchChart(example.getSentence(), Integer.MAX_VALUE, 100); SyntacticChartCost filter = SyntacticChartCost.createAgreementCost(example.getSyntacticParse()); parser.parseCommon(chart, example.getSentence(), filter, null, -1, 1); List<CcgParse> parses = chart.decodeBestParsesForSpan(0, example.getSentence().size() - 1, 100, parser); if (parses.size() == 0) { // Provide a deeper analysis of why parsing failed. analyzeParseFailure(example.getSyntacticParse(), chart, parser.getSyntaxVarType(), "Parse failure", 0); System.out.println("Discarding example: " + example); return false; } else if (parses.size() > 1) { analyzeParseFailure(example.getSyntacticParse(), chart, parser.getSyntaxVarType(), "Parse duplication", 2); System.out.println("Duplicate correct parse: " + example.getSyntacticParse()); } return true; }
[ "public", "static", "boolean", "isPossibleExample", "(", "CcgParser", "parser", ",", "CcgExample", "example", ")", "{", "CcgBeamSearchChart", "chart", "=", "new", "CcgBeamSearchChart", "(", "example", ".", "getSentence", "(", ")", ",", "Integer", ".", "MAX_VALUE",...
Returns {@code true} if {@code parser} can reproduce the syntactic tree in {@code example}. @param parser @param example @return
[ "Returns", "{", "@code", "true", "}", "if", "{", "@code", "parser", "}", "can", "reproduce", "the", "syntactic", "tree", "in", "{", "@code", "example", "}", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/CcgParserUtils.java#L59-L74
Azure/azure-sdk-for-java
network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/LoadBalancerLoadBalancingRulesInner.java
LoadBalancerLoadBalancingRulesInner.getAsync
public Observable<LoadBalancingRuleInner> getAsync(String resourceGroupName, String loadBalancerName, String loadBalancingRuleName) { return getWithServiceResponseAsync(resourceGroupName, loadBalancerName, loadBalancingRuleName).map(new Func1<ServiceResponse<LoadBalancingRuleInner>, LoadBalancingRuleInner>() { @Override public LoadBalancingRuleInner call(ServiceResponse<LoadBalancingRuleInner> response) { return response.body(); } }); }
java
public Observable<LoadBalancingRuleInner> getAsync(String resourceGroupName, String loadBalancerName, String loadBalancingRuleName) { return getWithServiceResponseAsync(resourceGroupName, loadBalancerName, loadBalancingRuleName).map(new Func1<ServiceResponse<LoadBalancingRuleInner>, LoadBalancingRuleInner>() { @Override public LoadBalancingRuleInner call(ServiceResponse<LoadBalancingRuleInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "LoadBalancingRuleInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "loadBalancerName", ",", "String", "loadBalancingRuleName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "loadBa...
Gets the specified load balancer load balancing rule. @param resourceGroupName The name of the resource group. @param loadBalancerName The name of the load balancer. @param loadBalancingRuleName The name of the load balancing rule. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the LoadBalancingRuleInner object
[ "Gets", "the", "specified", "load", "balancer", "load", "balancing", "rule", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/LoadBalancerLoadBalancingRulesInner.java#L233-L240
VoltDB/voltdb
src/frontend/org/voltdb/PlannerStatsCollector.java
PlannerStatsCollector.updateStatsRow
@Override protected void updateStatsRow(Object rowKey, Object rowValues[]) { super.updateStatsRow(rowKey, rowValues); rowValues[columnNameToIndex.get("PARTITION_ID")] = m_partitionId; long totalTimedExecutionTime = m_totalPlanningTime; long minExecutionTime = m_minPlanningTime; long maxExecutionTime = m_maxPlanningTime; long cache1Level = m_cache1Level; long cache2Level = m_cache2Level; long cache1Hits = m_cache1Hits; long cache2Hits = m_cache2Hits; long cacheMisses = m_cacheMisses; long failureCount = m_failures; if (m_interval) { totalTimedExecutionTime = m_totalPlanningTime - m_lastTimedPlanningTime; m_lastTimedPlanningTime = m_totalPlanningTime; minExecutionTime = m_lastMinPlanningTime; maxExecutionTime = m_lastMaxPlanningTime; m_lastMinPlanningTime = Long.MAX_VALUE; m_lastMaxPlanningTime = Long.MIN_VALUE; cache1Level = m_cache1Level - m_lastCache1Level; m_lastCache1Level = m_cache1Level; cache2Level = m_cache2Level - m_lastCache2Level; m_lastCache2Level = m_cache2Level; cache1Hits = m_cache1Hits - m_lastCache1Hits; m_lastCache1Hits = m_cache1Hits; cache2Hits = m_cache2Hits - m_lastCache2Hits; m_lastCache2Hits = m_cache2Hits; cacheMisses = m_cacheMisses - m_lastCacheMisses; m_lastCacheMisses = m_cacheMisses; failureCount = m_failures - m_lastFailures; m_lastFailures = m_failures; m_lastInvocations = m_invocations; } rowValues[columnNameToIndex.get(VoltSystemProcedure.CNAME_SITE_ID)] = m_siteId; rowValues[columnNameToIndex.get("PARTITION_ID")] = m_partitionId; rowValues[columnNameToIndex.get("CACHE1_LEVEL")] = cache1Level; rowValues[columnNameToIndex.get("CACHE2_LEVEL")] = cache2Level; rowValues[columnNameToIndex.get("CACHE1_HITS" )] = cache1Hits; rowValues[columnNameToIndex.get("CACHE2_HITS" )] = cache2Hits; rowValues[columnNameToIndex.get("CACHE_MISSES")] = cacheMisses; rowValues[columnNameToIndex.get("PLAN_TIME_MIN")] = minExecutionTime; rowValues[columnNameToIndex.get("PLAN_TIME_MAX")] = maxExecutionTime; if (getSampleCount() != 0) { rowValues[columnNameToIndex.get("PLAN_TIME_AVG")] = (totalTimedExecutionTime / getSampleCount()); } else { rowValues[columnNameToIndex.get("PLAN_TIME_AVG")] = 0L; } rowValues[columnNameToIndex.get("FAILURES")] = failureCount; }
java
@Override protected void updateStatsRow(Object rowKey, Object rowValues[]) { super.updateStatsRow(rowKey, rowValues); rowValues[columnNameToIndex.get("PARTITION_ID")] = m_partitionId; long totalTimedExecutionTime = m_totalPlanningTime; long minExecutionTime = m_minPlanningTime; long maxExecutionTime = m_maxPlanningTime; long cache1Level = m_cache1Level; long cache2Level = m_cache2Level; long cache1Hits = m_cache1Hits; long cache2Hits = m_cache2Hits; long cacheMisses = m_cacheMisses; long failureCount = m_failures; if (m_interval) { totalTimedExecutionTime = m_totalPlanningTime - m_lastTimedPlanningTime; m_lastTimedPlanningTime = m_totalPlanningTime; minExecutionTime = m_lastMinPlanningTime; maxExecutionTime = m_lastMaxPlanningTime; m_lastMinPlanningTime = Long.MAX_VALUE; m_lastMaxPlanningTime = Long.MIN_VALUE; cache1Level = m_cache1Level - m_lastCache1Level; m_lastCache1Level = m_cache1Level; cache2Level = m_cache2Level - m_lastCache2Level; m_lastCache2Level = m_cache2Level; cache1Hits = m_cache1Hits - m_lastCache1Hits; m_lastCache1Hits = m_cache1Hits; cache2Hits = m_cache2Hits - m_lastCache2Hits; m_lastCache2Hits = m_cache2Hits; cacheMisses = m_cacheMisses - m_lastCacheMisses; m_lastCacheMisses = m_cacheMisses; failureCount = m_failures - m_lastFailures; m_lastFailures = m_failures; m_lastInvocations = m_invocations; } rowValues[columnNameToIndex.get(VoltSystemProcedure.CNAME_SITE_ID)] = m_siteId; rowValues[columnNameToIndex.get("PARTITION_ID")] = m_partitionId; rowValues[columnNameToIndex.get("CACHE1_LEVEL")] = cache1Level; rowValues[columnNameToIndex.get("CACHE2_LEVEL")] = cache2Level; rowValues[columnNameToIndex.get("CACHE1_HITS" )] = cache1Hits; rowValues[columnNameToIndex.get("CACHE2_HITS" )] = cache2Hits; rowValues[columnNameToIndex.get("CACHE_MISSES")] = cacheMisses; rowValues[columnNameToIndex.get("PLAN_TIME_MIN")] = minExecutionTime; rowValues[columnNameToIndex.get("PLAN_TIME_MAX")] = maxExecutionTime; if (getSampleCount() != 0) { rowValues[columnNameToIndex.get("PLAN_TIME_AVG")] = (totalTimedExecutionTime / getSampleCount()); } else { rowValues[columnNameToIndex.get("PLAN_TIME_AVG")] = 0L; } rowValues[columnNameToIndex.get("FAILURES")] = failureCount; }
[ "@", "Override", "protected", "void", "updateStatsRow", "(", "Object", "rowKey", ",", "Object", "rowValues", "[", "]", ")", "{", "super", ".", "updateStatsRow", "(", "rowKey", ",", "rowValues", ")", ";", "rowValues", "[", "columnNameToIndex", ".", "get", "("...
Update the rowValues array with the latest statistical information. This method is overrides the super class version which must also be called so that it can update its columns. @param values Values of each column of the row of stats. Used as output.
[ "Update", "the", "rowValues", "array", "with", "the", "latest", "statistical", "information", ".", "This", "method", "is", "overrides", "the", "super", "class", "version", "which", "must", "also", "be", "called", "so", "that", "it", "can", "update", "its", "...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/PlannerStatsCollector.java#L244-L305
Wadpam/guja
guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java
GeneratedDContactDaoImpl.queryByWorkPhone
public Iterable<DContact> queryByWorkPhone(Object parent, java.lang.String workPhone) { return queryByField(parent, DContactMapper.Field.WORKPHONE.getFieldName(), workPhone); }
java
public Iterable<DContact> queryByWorkPhone(Object parent, java.lang.String workPhone) { return queryByField(parent, DContactMapper.Field.WORKPHONE.getFieldName(), workPhone); }
[ "public", "Iterable", "<", "DContact", ">", "queryByWorkPhone", "(", "Object", "parent", ",", "java", ".", "lang", ".", "String", "workPhone", ")", "{", "return", "queryByField", "(", "parent", ",", "DContactMapper", ".", "Field", ".", "WORKPHONE", ".", "get...
query-by method for field workPhone @param workPhone the specified attribute @return an Iterable of DContacts for the specified workPhone
[ "query", "-", "by", "method", "for", "field", "workPhone" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L322-L324
timtiemens/secretshare
src/main/java/com/tiemens/secretshare/engine/SecretShare.java
SecretShare.performParanoidCombines
public ParanoidOutput performParanoidCombines(List<ShareInfo> shares, ParanoidInput paranoidInput) { if (paranoidInput == null) { return ParanoidOutput.createEmpty(); } else { return performParanoidCombinesNonNull(shares, paranoidInput); } }
java
public ParanoidOutput performParanoidCombines(List<ShareInfo> shares, ParanoidInput paranoidInput) { if (paranoidInput == null) { return ParanoidOutput.createEmpty(); } else { return performParanoidCombinesNonNull(shares, paranoidInput); } }
[ "public", "ParanoidOutput", "performParanoidCombines", "(", "List", "<", "ShareInfo", ">", "shares", ",", "ParanoidInput", "paranoidInput", ")", "{", "if", "(", "paranoidInput", "==", "null", ")", "{", "return", "ParanoidOutput", ".", "createEmpty", "(", ")", ";...
This version just collects all of the reconstructed secrets. @param shares to use @param paranoidInput - control over process if greater than 0 use that number if less than 0 OR null no limit @return ParanoidOutput
[ "This", "version", "just", "collects", "all", "of", "the", "reconstructed", "secrets", "." ]
train
https://github.com/timtiemens/secretshare/blob/f5f88929af99ae0ed0df02dc802e40cdb25fceac/src/main/java/com/tiemens/secretshare/engine/SecretShare.java#L1167-L1178
twotoasters/JazzyListView
library/src/main/java/com/twotoasters/jazzylistview/JazzyHelper.java
JazzyHelper.setVelocity
private void setVelocity(int firstVisibleItem, int totalItemCount) { if (mMaxVelocity > MAX_VELOCITY_OFF && mPreviousFirstVisibleItem != firstVisibleItem) { long currTime = System.currentTimeMillis(); long timeToScrollOneItem = currTime - mPreviousEventTime; if (timeToScrollOneItem < 1) { double newSpeed = ((1.0d / timeToScrollOneItem) * 1000); // We need to normalize velocity so different size item don't // give largely different velocities. if (newSpeed < (0.9f * mSpeed)) { mSpeed *= 0.9f; } else if (newSpeed > (1.1f * mSpeed)) { mSpeed *= 1.1f; } else { mSpeed = newSpeed; } } else { mSpeed = ((1.0d / timeToScrollOneItem) * 1000); } mPreviousFirstVisibleItem = firstVisibleItem; mPreviousEventTime = currTime; } }
java
private void setVelocity(int firstVisibleItem, int totalItemCount) { if (mMaxVelocity > MAX_VELOCITY_OFF && mPreviousFirstVisibleItem != firstVisibleItem) { long currTime = System.currentTimeMillis(); long timeToScrollOneItem = currTime - mPreviousEventTime; if (timeToScrollOneItem < 1) { double newSpeed = ((1.0d / timeToScrollOneItem) * 1000); // We need to normalize velocity so different size item don't // give largely different velocities. if (newSpeed < (0.9f * mSpeed)) { mSpeed *= 0.9f; } else if (newSpeed > (1.1f * mSpeed)) { mSpeed *= 1.1f; } else { mSpeed = newSpeed; } } else { mSpeed = ((1.0d / timeToScrollOneItem) * 1000); } mPreviousFirstVisibleItem = firstVisibleItem; mPreviousEventTime = currTime; } }
[ "private", "void", "setVelocity", "(", "int", "firstVisibleItem", ",", "int", "totalItemCount", ")", "{", "if", "(", "mMaxVelocity", ">", "MAX_VELOCITY_OFF", "&&", "mPreviousFirstVisibleItem", "!=", "firstVisibleItem", ")", "{", "long", "currTime", "=", "System", ...
Should be called in onScroll to keep take of current Velocity. @param firstVisibleItem The index of the first visible item in the ListView.
[ "Should", "be", "called", "in", "onScroll", "to", "keep", "take", "of", "current", "Velocity", "." ]
train
https://github.com/twotoasters/JazzyListView/blob/4a69239f90374a71e7d4073448ca049bd074f7fe/library/src/main/java/com/twotoasters/jazzylistview/JazzyHelper.java#L156-L178
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlImplementation.java
AptControlImplementation.initContexts
private ArrayList<AptContextField> initContexts() { ArrayList<AptContextField> contexts = new ArrayList<AptContextField>(); if ( _implDecl == null || _implDecl.getFields() == null ) return contexts; Collection<FieldDeclaration> declaredFields = _implDecl.getFields(); for (FieldDeclaration fieldDecl : declaredFields) { if (fieldDecl.getAnnotation(org.apache.beehive.controls.api.context.Context.class) != null) contexts.add(new AptContextField(this, fieldDecl, _ap)); } return contexts; }
java
private ArrayList<AptContextField> initContexts() { ArrayList<AptContextField> contexts = new ArrayList<AptContextField>(); if ( _implDecl == null || _implDecl.getFields() == null ) return contexts; Collection<FieldDeclaration> declaredFields = _implDecl.getFields(); for (FieldDeclaration fieldDecl : declaredFields) { if (fieldDecl.getAnnotation(org.apache.beehive.controls.api.context.Context.class) != null) contexts.add(new AptContextField(this, fieldDecl, _ap)); } return contexts; }
[ "private", "ArrayList", "<", "AptContextField", ">", "initContexts", "(", ")", "{", "ArrayList", "<", "AptContextField", ">", "contexts", "=", "new", "ArrayList", "<", "AptContextField", ">", "(", ")", ";", "if", "(", "_implDecl", "==", "null", "||", "_implD...
Initializes the list of ContextField declared directly by this ControlImpl
[ "Initializes", "the", "list", "of", "ContextField", "declared", "directly", "by", "this", "ControlImpl" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlImplementation.java#L135-L149
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringHelper.java
StringHelper.getImplodedNonEmpty
@Nonnull public static String getImplodedNonEmpty (@Nullable final Iterable <String> aElements) { return getImplodedMappedNonEmpty (aElements, Function.identity ()); }
java
@Nonnull public static String getImplodedNonEmpty (@Nullable final Iterable <String> aElements) { return getImplodedMappedNonEmpty (aElements, Function.identity ()); }
[ "@", "Nonnull", "public", "static", "String", "getImplodedNonEmpty", "(", "@", "Nullable", "final", "Iterable", "<", "String", ">", "aElements", ")", "{", "return", "getImplodedMappedNonEmpty", "(", "aElements", ",", "Function", ".", "identity", "(", ")", ")", ...
Get a concatenated String from all non-<code>null</code> and non empty elements of the passed container without a separator string. This the very generic version of {@link #getConcatenatedOnDemand(String, String)} for an arbitrary number of elements. @param aElements The container to convert. May be <code>null</code> or empty. @return The concatenated string.
[ "Get", "a", "concatenated", "String", "from", "all", "non", "-", "<code", ">", "null<", "/", "code", ">", "and", "non", "empty", "elements", "of", "the", "passed", "container", "without", "a", "separator", "string", ".", "This", "the", "very", "generic", ...
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L1483-L1487
avianey/facebook-api-android-maven
facebook/src/main/java/com/facebook/Request.java
Request.executeMeRequestAsync
@Deprecated public static RequestAsyncTask executeMeRequestAsync(Session session, GraphUserCallback callback) { return newMeRequest(session, callback).executeAsync(); }
java
@Deprecated public static RequestAsyncTask executeMeRequestAsync(Session session, GraphUserCallback callback) { return newMeRequest(session, callback).executeAsync(); }
[ "@", "Deprecated", "public", "static", "RequestAsyncTask", "executeMeRequestAsync", "(", "Session", "session", ",", "GraphUserCallback", "callback", ")", "{", "return", "newMeRequest", "(", "session", ",", "callback", ")", ".", "executeAsync", "(", ")", ";", "}" ]
Starts a new Request configured to retrieve a user's own profile. <p/> This should only be called from the UI thread. This method is deprecated. Prefer to call Request.newMeRequest(...).executeAsync(); @param session the Session to use, or null; if non-null, the session must be in an opened state @param callback a callback that will be called when the request is completed to handle success or error conditions @return a RequestAsyncTask that is executing the request
[ "Starts", "a", "new", "Request", "configured", "to", "retrieve", "a", "user", "s", "own", "profile", ".", "<p", "/", ">", "This", "should", "only", "be", "called", "from", "the", "UI", "thread", "." ]
train
https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/Request.java#L1115-L1118
linkedin/dexmaker
dexmaker/src/main/java/com/android/dx/Code.java
Code.iget
public <D, V> void iget(FieldId<D, ? extends V> fieldId, Local<V> target, Local<D> instance) { addInstruction(new ThrowingCstInsn(Rops.opGetField(target.type.ropType), sourcePosition, RegisterSpecList.make(instance.spec()), catches, fieldId.constant)); moveResult(target, true); }
java
public <D, V> void iget(FieldId<D, ? extends V> fieldId, Local<V> target, Local<D> instance) { addInstruction(new ThrowingCstInsn(Rops.opGetField(target.type.ropType), sourcePosition, RegisterSpecList.make(instance.spec()), catches, fieldId.constant)); moveResult(target, true); }
[ "public", "<", "D", ",", "V", ">", "void", "iget", "(", "FieldId", "<", "D", ",", "?", "extends", "V", ">", "fieldId", ",", "Local", "<", "V", ">", "target", ",", "Local", "<", "D", ">", "instance", ")", "{", "addInstruction", "(", "new", "Throwi...
Copies the value in instance field {@code fieldId} of {@code instance} to {@code target}.
[ "Copies", "the", "value", "in", "instance", "field", "{" ]
train
https://github.com/linkedin/dexmaker/blob/c58ffebcbb2564c7d1fa6fb58b48f351c330296d/dexmaker/src/main/java/com/android/dx/Code.java#L590-L594
strator-dev/greenpepper
samples-application/src/main/java/com/greenpepper/samples/application/system/AccountManager.java
AccountManager.insertGroup
public boolean insertGroup(String name) { if (isGroupExist(name)) { throw new SystemException(String.format("Group '%s' already exist.", name)); } return allGroups.add(name); }
java
public boolean insertGroup(String name) { if (isGroupExist(name)) { throw new SystemException(String.format("Group '%s' already exist.", name)); } return allGroups.add(name); }
[ "public", "boolean", "insertGroup", "(", "String", "name", ")", "{", "if", "(", "isGroupExist", "(", "name", ")", ")", "{", "throw", "new", "SystemException", "(", "String", ".", "format", "(", "\"Group '%s' already exist.\"", ",", "name", ")", ")", ";", "...
<p>insertGroup.</p> @param name a {@link java.lang.String} object. @return a boolean.
[ "<p", ">", "insertGroup", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/samples-application/src/main/java/com/greenpepper/samples/application/system/AccountManager.java#L63-L71
klarna/HiveRunner
src/main/java/com/klarna/hiverunner/StandaloneHiveRunner.java
StandaloneHiveRunner.createHiveServerContainer
private HiveShellContainer createHiveServerContainer(final List<? extends Script> scripts, final Object testCase, TemporaryFolder baseDir) throws IOException { HiveServerContext context = new StandaloneHiveServerContext(baseDir, config); final HiveServerContainer hiveTestHarness = new HiveServerContainer(context); HiveShellBuilder hiveShellBuilder = new HiveShellBuilder(); hiveShellBuilder.setCommandShellEmulation(config.getCommandShellEmulator()); HiveShellField shellSetter = loadScriptUnderTest(testCase, hiveShellBuilder); if (scripts != null) { hiveShellBuilder.overrideScriptsUnderTest(scripts); } hiveShellBuilder.setHiveServerContainer(hiveTestHarness); loadAnnotatedResources(testCase, hiveShellBuilder); loadAnnotatedProperties(testCase, hiveShellBuilder); loadAnnotatedSetupScripts(testCase, hiveShellBuilder); // Build shell final HiveShellContainer shell = hiveShellBuilder.buildShell(); // Set shell shellSetter.setShell(shell); if (shellSetter.isAutoStart()) { shell.start(); } return shell; }
java
private HiveShellContainer createHiveServerContainer(final List<? extends Script> scripts, final Object testCase, TemporaryFolder baseDir) throws IOException { HiveServerContext context = new StandaloneHiveServerContext(baseDir, config); final HiveServerContainer hiveTestHarness = new HiveServerContainer(context); HiveShellBuilder hiveShellBuilder = new HiveShellBuilder(); hiveShellBuilder.setCommandShellEmulation(config.getCommandShellEmulator()); HiveShellField shellSetter = loadScriptUnderTest(testCase, hiveShellBuilder); if (scripts != null) { hiveShellBuilder.overrideScriptsUnderTest(scripts); } hiveShellBuilder.setHiveServerContainer(hiveTestHarness); loadAnnotatedResources(testCase, hiveShellBuilder); loadAnnotatedProperties(testCase, hiveShellBuilder); loadAnnotatedSetupScripts(testCase, hiveShellBuilder); // Build shell final HiveShellContainer shell = hiveShellBuilder.buildShell(); // Set shell shellSetter.setShell(shell); if (shellSetter.isAutoStart()) { shell.start(); } return shell; }
[ "private", "HiveShellContainer", "createHiveServerContainer", "(", "final", "List", "<", "?", "extends", "Script", ">", "scripts", ",", "final", "Object", "testCase", ",", "TemporaryFolder", "baseDir", ")", "throws", "IOException", "{", "HiveServerContext", "context",...
Traverses the test case annotations. Will inject a HiveShell in the test case that envelopes the HiveServer.
[ "Traverses", "the", "test", "case", "annotations", ".", "Will", "inject", "a", "HiveShell", "in", "the", "test", "case", "that", "envelopes", "the", "HiveServer", "." ]
train
https://github.com/klarna/HiveRunner/blob/c8899237db6122127f16e3d8a740c1f8657c2ae3/src/main/java/com/klarna/hiverunner/StandaloneHiveRunner.java#L187-L221
samskivert/samskivert
src/main/java/com/samskivert/servlet/SiteResourceLoader.java
SiteResourceLoader.getResourceAsStream
public InputStream getResourceAsStream (int siteId, String path) throws IOException { // Log.info("Loading site resource [siteId=" + siteId + // ", path=" + path + "]."); // synchronize on the lock to ensure that only one thread per site // is concurrently executing synchronized (getLock(siteId)) { SiteResourceBundle bundle = getBundle(siteId); // make sure the path has no leading slash if (path.startsWith("/")) { path = path.substring(1); } // obtain our resource from the bundle return bundle.getResourceAsStream(path); } }
java
public InputStream getResourceAsStream (int siteId, String path) throws IOException { // Log.info("Loading site resource [siteId=" + siteId + // ", path=" + path + "]."); // synchronize on the lock to ensure that only one thread per site // is concurrently executing synchronized (getLock(siteId)) { SiteResourceBundle bundle = getBundle(siteId); // make sure the path has no leading slash if (path.startsWith("/")) { path = path.substring(1); } // obtain our resource from the bundle return bundle.getResourceAsStream(path); } }
[ "public", "InputStream", "getResourceAsStream", "(", "int", "siteId", ",", "String", "path", ")", "throws", "IOException", "{", "// Log.info(\"Loading site resource [siteId=\" + siteId +", "// \", path=\" + path + \"].\");", "// synchronize on the lock to ens...
Loads the specific resource, from the site-specific jar file if one exists and contains the specified resource. If no resource exists with that path, null will be returned. @param siteId the unique identifer for the site for which we are loading the resource. @param path the path to the desired resource. @return an input stream via which the resource can be read or null if no resource could be located with the specified path. @exception IOException thrown if an I/O error occurs while loading a resource.
[ "Loads", "the", "specific", "resource", "from", "the", "site", "-", "specific", "jar", "file", "if", "one", "exists", "and", "contains", "the", "specified", "resource", ".", "If", "no", "resource", "exists", "with", "that", "path", "null", "will", "be", "r...
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/servlet/SiteResourceLoader.java#L96-L115
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java
ICUResourceBundle.createBundle
public static ICUResourceBundle createBundle(String baseName, String localeID, ClassLoader root) { ICUResourceBundleReader reader = ICUResourceBundleReader.getReader(baseName, localeID, root); if (reader == null) { // could not open the .res file return null; } return getBundle(reader, baseName, localeID, root); }
java
public static ICUResourceBundle createBundle(String baseName, String localeID, ClassLoader root) { ICUResourceBundleReader reader = ICUResourceBundleReader.getReader(baseName, localeID, root); if (reader == null) { // could not open the .res file return null; } return getBundle(reader, baseName, localeID, root); }
[ "public", "static", "ICUResourceBundle", "createBundle", "(", "String", "baseName", ",", "String", "localeID", ",", "ClassLoader", "root", ")", "{", "ICUResourceBundleReader", "reader", "=", "ICUResourceBundleReader", ".", "getReader", "(", "baseName", ",", "localeID"...
Create a bundle using a reader. @param baseName The name for the bundle. @param localeID The locale identification. @param root The ClassLoader object root. @return the new bundle
[ "Create", "a", "bundle", "using", "a", "reader", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java#L1283-L1290
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaWriterHelper.java
FastaWriterHelper.writeGeneSequence
public static void writeGeneSequence(File file, Collection<GeneSequence> geneSequences,boolean showExonUppercase) throws Exception { FileOutputStream outputStream = new FileOutputStream(file); BufferedOutputStream bo = new BufferedOutputStream(outputStream); writeGeneSequence(bo, geneSequences,showExonUppercase); bo.close(); outputStream.close(); }
java
public static void writeGeneSequence(File file, Collection<GeneSequence> geneSequences,boolean showExonUppercase) throws Exception { FileOutputStream outputStream = new FileOutputStream(file); BufferedOutputStream bo = new BufferedOutputStream(outputStream); writeGeneSequence(bo, geneSequences,showExonUppercase); bo.close(); outputStream.close(); }
[ "public", "static", "void", "writeGeneSequence", "(", "File", "file", ",", "Collection", "<", "GeneSequence", ">", "geneSequences", ",", "boolean", "showExonUppercase", ")", "throws", "Exception", "{", "FileOutputStream", "outputStream", "=", "new", "FileOutputStream"...
Write a collection of GeneSequences to a file where if the gene is negative strand it will flip and complement the sequence @param file @param geneSequences @throws Exception
[ "Write", "a", "collection", "of", "GeneSequences", "to", "a", "file", "where", "if", "the", "gene", "is", "negative", "strand", "it", "will", "flip", "and", "complement", "the", "sequence" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaWriterHelper.java#L88-L94
TheHortonMachine/hortonmachine
gui/src/main/java/org/hortonmachine/gui/spatialtoolbox/core/ParametersPanel.java
ParametersPanel.isAtLeastOneAssignable
private boolean isAtLeastOneAssignable( String main, Class< ? >... classes ) { for( Class< ? > clazz : classes ) { if (clazz.getCanonicalName().equals(main)) { return true; } } return false; }
java
private boolean isAtLeastOneAssignable( String main, Class< ? >... classes ) { for( Class< ? > clazz : classes ) { if (clazz.getCanonicalName().equals(main)) { return true; } } return false; }
[ "private", "boolean", "isAtLeastOneAssignable", "(", "String", "main", ",", "Class", "<", "?", ">", "...", "classes", ")", "{", "for", "(", "Class", "<", "?", ">", "clazz", ":", "classes", ")", "{", "if", "(", "clazz", ".", "getCanonicalName", "(", ")"...
Checks if one class is assignable from at least one of the others. @param main the canonical name of class to check. @param classes the other classes. @return true if at least one of the other classes match.
[ "Checks", "if", "one", "class", "is", "assignable", "from", "at", "least", "one", "of", "the", "others", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gui/src/main/java/org/hortonmachine/gui/spatialtoolbox/core/ParametersPanel.java#L548-L555
gallandarakhneorg/afc
core/maths/mathgeom/tobeincluded/src/d3/continuous/OrientedBox3f.java
OrientedBox3f.setSecondAxis
@Override public void setSecondAxis(double x, double y, double z) { setSecondAxis(x, y, z, getSecondAxisExtent()); }
java
@Override public void setSecondAxis(double x, double y, double z) { setSecondAxis(x, y, z, getSecondAxisExtent()); }
[ "@", "Override", "public", "void", "setSecondAxis", "(", "double", "x", ",", "double", "y", ",", "double", "z", ")", "{", "setSecondAxis", "(", "x", ",", "y", ",", "z", ",", "getSecondAxisExtent", "(", ")", ")", ";", "}" ]
Set the second axis of the box. The third axis is updated to be perpendicular to the two other axis. @param x - the new values for the second axis. @param y - the new values for the second axis. @param z - the new values for the second axis.
[ "Set", "the", "second", "axis", "of", "the", "box", ".", "The", "third", "axis", "is", "updated", "to", "be", "perpendicular", "to", "the", "two", "other", "axis", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/OrientedBox3f.java#L493-L496
tbrooks8/Precipice
precipice-core/src/main/java/net/uncontended/precipice/GuardRail.java
GuardRail.releasePermits
public void releasePermits(ExecutionContext context, Result result) { releasePermits(context.permitCount(), result, context.startNanos(), clock.nanoTime()); }
java
public void releasePermits(ExecutionContext context, Result result) { releasePermits(context.permitCount(), result, context.startNanos(), clock.nanoTime()); }
[ "public", "void", "releasePermits", "(", "ExecutionContext", "context", ",", "Result", "result", ")", "{", "releasePermits", "(", "context", ".", "permitCount", "(", ")", ",", "result", ",", "context", ".", "startNanos", "(", ")", ",", "clock", ".", "nanoTim...
Release acquired permits with known result. Since there is a known result the result count object and latency will be updated. @param context context of the task execution @param result of the execution
[ "Release", "acquired", "permits", "with", "known", "result", ".", "Since", "there", "is", "a", "known", "result", "the", "result", "count", "object", "and", "latency", "will", "be", "updated", "." ]
train
https://github.com/tbrooks8/Precipice/blob/97fae467fd676b16a96b8d88b02569d8fc1f2681/precipice-core/src/main/java/net/uncontended/precipice/GuardRail.java#L115-L117
cerner/beadledom
client/resteasy-client/src/main/java/com/cerner/beadledom/client/resteasy/BeadledomResteasyClientBuilder.java
BeadledomResteasyClientBuilder.setTtl
@Override public BeadledomResteasyClientBuilder setTtl(int ttl, TimeUnit timeUnit) { long millis = timeUnit.toMillis(ttl); if (millis > Integer.MAX_VALUE || millis < 0) { throw new IllegalArgumentException( "TTL must be smaller than Integer.MAX_VALUE when converted to milliseconds"); } this.clientConfigBuilder.ttlMillis((int) millis); return this; }
java
@Override public BeadledomResteasyClientBuilder setTtl(int ttl, TimeUnit timeUnit) { long millis = timeUnit.toMillis(ttl); if (millis > Integer.MAX_VALUE || millis < 0) { throw new IllegalArgumentException( "TTL must be smaller than Integer.MAX_VALUE when converted to milliseconds"); } this.clientConfigBuilder.ttlMillis((int) millis); return this; }
[ "@", "Override", "public", "BeadledomResteasyClientBuilder", "setTtl", "(", "int", "ttl", ",", "TimeUnit", "timeUnit", ")", "{", "long", "millis", "=", "timeUnit", ".", "toMillis", "(", "ttl", ")", ";", "if", "(", "millis", ">", "Integer", ".", "MAX_VALUE", ...
Sets the default TTL to be used if a {@link ClientHttpEngine} isn't specified via {@link #setHttpEngine(ClientHttpEngine)}. <p>If a {@link ClientHttpEngine} is specified via {@link #setHttpEngine(ClientHttpEngine)}, then this property will be ignored. @return this builder
[ "Sets", "the", "default", "TTL", "to", "be", "used", "if", "a", "{", "@link", "ClientHttpEngine", "}", "isn", "t", "specified", "via", "{", "@link", "#setHttpEngine", "(", "ClientHttpEngine", ")", "}", "." ]
train
https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/client/resteasy-client/src/main/java/com/cerner/beadledom/client/resteasy/BeadledomResteasyClientBuilder.java#L190-L200
bohnman/squiggly-java
src/main/java/com/github/bohnman/squiggly/util/SquigglyUtils.java
SquigglyUtils.collectify
public static Collection<Map<String, Object>> collectify(ObjectMapper mapper, Object source, Class<? extends Collection> targetCollectionType) { return collectify(mapper, source, targetCollectionType, String.class, Object.class); }
java
public static Collection<Map<String, Object>> collectify(ObjectMapper mapper, Object source, Class<? extends Collection> targetCollectionType) { return collectify(mapper, source, targetCollectionType, String.class, Object.class); }
[ "public", "static", "Collection", "<", "Map", "<", "String", ",", "Object", ">", ">", "collectify", "(", "ObjectMapper", "mapper", ",", "Object", "source", ",", "Class", "<", "?", "extends", "Collection", ">", "targetCollectionType", ")", "{", "return", "col...
Convert an object to a collection of maps. @param mapper the object mapper @param source the source object @param targetCollectionType the target collection type @return collection
[ "Convert", "an", "object", "to", "a", "collection", "of", "maps", "." ]
train
https://github.com/bohnman/squiggly-java/blob/ba0c0b924ab718225d1ad180273ee63ea6c4f55a/src/main/java/com/github/bohnman/squiggly/util/SquigglyUtils.java#L32-L34
chhh/MSFTBX
MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java
JaxbUtils.unmarshalCollection
public static <T> List<T> unmarshalCollection(Class<T> cl, InputStream s) throws JAXBException { return unmarshalCollection(cl, new StreamSource(s)); }
java
public static <T> List<T> unmarshalCollection(Class<T> cl, InputStream s) throws JAXBException { return unmarshalCollection(cl, new StreamSource(s)); }
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "unmarshalCollection", "(", "Class", "<", "T", ">", "cl", ",", "InputStream", "s", ")", "throws", "JAXBException", "{", "return", "unmarshalCollection", "(", "cl", ",", "new", "StreamSource", "(", ...
Converts the contents of the InputStream to a List with objects of the given class. @param cl Type to be used @param s Input @return List with objects of the given type
[ "Converts", "the", "contents", "of", "the", "InputStream", "to", "a", "List", "with", "objects", "of", "the", "given", "class", "." ]
train
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L321-L323
lucee/Lucee
core/src/main/java/lucee/commons/io/compress/CompressUtil.java
CompressUtil.compressTBZ2
private static void compressTBZ2(Resource[] sources, Resource target, int mode) throws IOException { // File tmpTarget = File.createTempFile("_temp","tmp"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); compressTar(sources, baos, mode); _compressBZip2(new ByteArrayInputStream(baos.toByteArray()), target.getOutputStream()); // tmpTarget.delete(); }
java
private static void compressTBZ2(Resource[] sources, Resource target, int mode) throws IOException { // File tmpTarget = File.createTempFile("_temp","tmp"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); compressTar(sources, baos, mode); _compressBZip2(new ByteArrayInputStream(baos.toByteArray()), target.getOutputStream()); // tmpTarget.delete(); }
[ "private", "static", "void", "compressTBZ2", "(", "Resource", "[", "]", "sources", ",", "Resource", "target", ",", "int", "mode", ")", "throws", "IOException", "{", "// File tmpTarget = File.createTempFile(\"_temp\",\"tmp\");", "ByteArrayOutputStream", "baos", "=", "new...
compress a source file/directory to a tar/bzip2 file @param sources @param target @param mode @throws IOException
[ "compress", "a", "source", "file", "/", "directory", "to", "a", "tar", "/", "bzip2", "file" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/compress/CompressUtil.java#L396-L402
dnsjava/dnsjava
org/xbill/DNS/Record.java
Record.newRecord
public static Record newRecord(Name name, int type, int dclass, long ttl) { if (!name.isAbsolute()) throw new RelativeNameException(name); Type.check(type); DClass.check(dclass); TTL.check(ttl); return getEmptyRecord(name, type, dclass, ttl, false); }
java
public static Record newRecord(Name name, int type, int dclass, long ttl) { if (!name.isAbsolute()) throw new RelativeNameException(name); Type.check(type); DClass.check(dclass); TTL.check(ttl); return getEmptyRecord(name, type, dclass, ttl, false); }
[ "public", "static", "Record", "newRecord", "(", "Name", "name", ",", "int", "type", ",", "int", "dclass", ",", "long", "ttl", ")", "{", "if", "(", "!", "name", ".", "isAbsolute", "(", ")", ")", "throw", "new", "RelativeNameException", "(", "name", ")",...
Creates a new empty record, with the given parameters. @param name The owner name of the record. @param type The record's type. @param dclass The record's class. @param ttl The record's time to live. @return An object of a subclass of Record
[ "Creates", "a", "new", "empty", "record", "with", "the", "given", "parameters", "." ]
train
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Record.java#L150-L159
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/Table.java
Table.deleteNoCheck
private void deleteNoCheck(Session session, Row row) { if (row.isDeleted(session)) { return; } session.addDeleteAction(this, row); }
java
private void deleteNoCheck(Session session, Row row) { if (row.isDeleted(session)) { return; } session.addDeleteAction(this, row); }
[ "private", "void", "deleteNoCheck", "(", "Session", "session", ",", "Row", "row", ")", "{", "if", "(", "row", ".", "isDeleted", "(", "session", ")", ")", "{", "return", ";", "}", "session", ".", "addDeleteAction", "(", "this", ",", "row", ")", ";", "...
Low level row delete method. Removes the row from the indexes and from the Cache.
[ "Low", "level", "row", "delete", "method", ".", "Removes", "the", "row", "from", "the", "indexes", "and", "from", "the", "Cache", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/Table.java#L2451-L2458