repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
Stratio/bdt
src/main/java/com/stratio/qa/utils/MongoDBUtils.java
MongoDBUtils.insertDocIntoMongoDBCollection
public void insertDocIntoMongoDBCollection(String collection, String document) { DBObject dbObject = (DBObject) JSON.parse(document); this.dataBase.getCollection(collection).insert(dbObject); }
java
public void insertDocIntoMongoDBCollection(String collection, String document) { DBObject dbObject = (DBObject) JSON.parse(document); this.dataBase.getCollection(collection).insert(dbObject); }
[ "public", "void", "insertDocIntoMongoDBCollection", "(", "String", "collection", ",", "String", "document", ")", "{", "DBObject", "dbObject", "=", "(", "DBObject", ")", "JSON", ".", "parse", "(", "document", ")", ";", "this", ".", "dataBase", ".", "getCollecti...
Insert document in a MongoDB Collection. @param collection @param document
[ "Insert", "document", "in", "a", "MongoDB", "Collection", "." ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/utils/MongoDBUtils.java#L223-L228
Azure/azure-sdk-for-java
resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java
ResourcesInner.createOrUpdateAsync
public Observable<GenericResourceInner> createOrUpdateAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).map(new Func1<ServiceResponse<GenericResourceInner>, GenericResourceInner>() { @Override public GenericResourceInner call(ServiceResponse<GenericResourceInner> response) { return response.body(); } }); }
java
public Observable<GenericResourceInner> createOrUpdateAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).map(new Func1<ServiceResponse<GenericResourceInner>, GenericResourceInner>() { @Override public GenericResourceInner call(ServiceResponse<GenericResourceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "GenericResourceInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "resourceProviderNamespace", ",", "String", "parentResourcePath", ",", "String", "resourceType", ",", "String", "resourceName", ",", "String...
Creates a resource. @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. @param resourceProviderNamespace The namespace of the resource provider. @param parentResourcePath The parent resource identity. @param resourceType The resource type of the resource to create. @param resourceName The name of the resource to create. @param apiVersion The API version to use for the operation. @param parameters Parameters for creating or updating the resource. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "a", "resource", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java#L1329-L1336
apache/flink
flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java
ParameterTool.get
public String get(String key, String defaultValue) { addToDefaults(key, defaultValue); String value = get(key); if (value == null) { return defaultValue; } else { return value; } }
java
public String get(String key, String defaultValue) { addToDefaults(key, defaultValue); String value = get(key); if (value == null) { return defaultValue; } else { return value; } }
[ "public", "String", "get", "(", "String", "key", ",", "String", "defaultValue", ")", "{", "addToDefaults", "(", "key", ",", "defaultValue", ")", ";", "String", "value", "=", "get", "(", "key", ")", ";", "if", "(", "value", "==", "null", ")", "{", "re...
Returns the String value for the given key. If the key does not exist it will return the given default value.
[ "Returns", "the", "String", "value", "for", "the", "given", "key", ".", "If", "the", "key", "does", "not", "exist", "it", "will", "return", "the", "given", "default", "value", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java#L260-L268
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableReferenceBuilder.java
SyntheticStorableReferenceBuilder.generateSafeMethodName
private String generateSafeMethodName(StorableInfo info, String prefix) { Class type = info.getStorableType(); // Try a few times to generate a unique name. There's nothing special // about choosing 100 as the limit. int value = 0; for (int i = 0; i < 100; i++) { String name = prefix + value; if (!methodExists(type, name)) { return name; } value = name.hashCode(); } throw new InternalError("Unable to create unique method name starting with: " + prefix); }
java
private String generateSafeMethodName(StorableInfo info, String prefix) { Class type = info.getStorableType(); // Try a few times to generate a unique name. There's nothing special // about choosing 100 as the limit. int value = 0; for (int i = 0; i < 100; i++) { String name = prefix + value; if (!methodExists(type, name)) { return name; } value = name.hashCode(); } throw new InternalError("Unable to create unique method name starting with: " + prefix); }
[ "private", "String", "generateSafeMethodName", "(", "StorableInfo", "info", ",", "String", "prefix", ")", "{", "Class", "type", "=", "info", ".", "getStorableType", "(", ")", ";", "// Try a few times to generate a unique name. There's nothing special\r", "// about choosing ...
Generates a property name which doesn't clash with any already defined.
[ "Generates", "a", "property", "name", "which", "doesn", "t", "clash", "with", "any", "already", "defined", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableReferenceBuilder.java#L523-L539
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java
JBBPOut.Bin
public JBBPOut Bin(final Object object, final JBBPCustomFieldWriter customFieldWriter) throws IOException { if (this.processCommands) { this.processObject(object, null, customFieldWriter); } return this; }
java
public JBBPOut Bin(final Object object, final JBBPCustomFieldWriter customFieldWriter) throws IOException { if (this.processCommands) { this.processObject(object, null, customFieldWriter); } return this; }
[ "public", "JBBPOut", "Bin", "(", "final", "Object", "object", ",", "final", "JBBPCustomFieldWriter", "customFieldWriter", ")", "throws", "IOException", "{", "if", "(", "this", ".", "processCommands", ")", "{", "this", ".", "processObject", "(", "object", ",", ...
Save fields of an object marked by Bin annotation. Fields will be ordered through {@link Bin#outOrder()} field, NB! By default Java doesn't keep field outOrder. Ordered fields of class will be saved into internal cache for speed but the cache can be reset through {@link #resetInsideClassCache()} @param object an object to be saved into stream, must not be null @param customFieldWriter a custom field writer to be used for saving of custom fields of the object, it can be null @return the context @throws IOException it will be thrown for any transport error @see #resetInsideClassCache() @see Bin @since 1.1
[ "Save", "fields", "of", "an", "object", "marked", "by", "Bin", "annotation", ".", "Fields", "will", "be", "ordered", "through", "{", "@link", "Bin#outOrder", "()", "}", "field", "NB!", "By", "default", "Java", "doesn", "t", "keep", "field", "outOrder", "."...
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java#L1029-L1035
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java
ModuleIndexWriter.addModulesList
protected void addModulesList(Collection<ModuleElement> modules, Content tbody) { boolean altColor = true; for (ModuleElement mdle : modules) { if (!mdle.isUnnamed()) { Content moduleLinkContent = getModuleLink(mdle, new StringContent(mdle.getQualifiedName().toString())); Content thModule = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, moduleLinkContent); HtmlTree tdSummary = new HtmlTree(HtmlTag.TD); tdSummary.addStyle(HtmlStyle.colLast); addSummaryComment(mdle, tdSummary); HtmlTree tr = HtmlTree.TR(thModule); tr.addContent(tdSummary); tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor); tbody.addContent(tr); } altColor = !altColor; } }
java
protected void addModulesList(Collection<ModuleElement> modules, Content tbody) { boolean altColor = true; for (ModuleElement mdle : modules) { if (!mdle.isUnnamed()) { Content moduleLinkContent = getModuleLink(mdle, new StringContent(mdle.getQualifiedName().toString())); Content thModule = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, moduleLinkContent); HtmlTree tdSummary = new HtmlTree(HtmlTag.TD); tdSummary.addStyle(HtmlStyle.colLast); addSummaryComment(mdle, tdSummary); HtmlTree tr = HtmlTree.TR(thModule); tr.addContent(tdSummary); tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor); tbody.addContent(tr); } altColor = !altColor; } }
[ "protected", "void", "addModulesList", "(", "Collection", "<", "ModuleElement", ">", "modules", ",", "Content", "tbody", ")", "{", "boolean", "altColor", "=", "true", ";", "for", "(", "ModuleElement", "mdle", ":", "modules", ")", "{", "if", "(", "!", "mdle...
Adds list of modules in the index table. Generate link to each module. @param tbody the documentation tree to which the list will be added
[ "Adds", "list", "of", "modules", "in", "the", "index", "table", ".", "Generate", "link", "to", "each", "module", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java#L167-L183
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/MapTileCollisionRendererModel.java
MapTileCollisionRendererModel.renderCollision
private void renderCollision(Graphic g, TileCollision tile, int x, int y) { for (final CollisionFormula collision : tile.getCollisionFormulas()) { final ImageBuffer buffer = collisionCache.get(collision); if (buffer != null) { g.drawImage(buffer, x, y); } } }
java
private void renderCollision(Graphic g, TileCollision tile, int x, int y) { for (final CollisionFormula collision : tile.getCollisionFormulas()) { final ImageBuffer buffer = collisionCache.get(collision); if (buffer != null) { g.drawImage(buffer, x, y); } } }
[ "private", "void", "renderCollision", "(", "Graphic", "g", ",", "TileCollision", "tile", ",", "int", "x", ",", "int", "y", ")", "{", "for", "(", "final", "CollisionFormula", "collision", ":", "tile", ".", "getCollisionFormulas", "(", ")", ")", "{", "final"...
Render the collision function. @param g The graphic output. @param tile The tile reference. @param x The horizontal render location. @param y The vertical render location.
[ "Render", "the", "collision", "function", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/MapTileCollisionRendererModel.java#L174-L184
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/MathUtil.java
MathUtil.approximateBinomialCoefficient
public static double approximateBinomialCoefficient(int n, int k) { final int m = max(k, n - k); long temp = 1; for(int i = n, j = 1; i > m; i--, j++) { temp = temp * i / j; } return temp; }
java
public static double approximateBinomialCoefficient(int n, int k) { final int m = max(k, n - k); long temp = 1; for(int i = n, j = 1; i > m; i--, j++) { temp = temp * i / j; } return temp; }
[ "public", "static", "double", "approximateBinomialCoefficient", "(", "int", "n", ",", "int", "k", ")", "{", "final", "int", "m", "=", "max", "(", "k", ",", "n", "-", "k", ")", ";", "long", "temp", "=", "1", ";", "for", "(", "int", "i", "=", "n", ...
Binomial coefficent, also known as "n choose k"). @param n Total number of samples. n &gt; 0 @param k Number of elements to choose. <code>n &gt;= k</code>, <code>k &gt;= 0</code> @return n! / (k! * (n-k)!)
[ "Binomial", "coefficent", "also", "known", "as", "n", "choose", "k", ")", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/MathUtil.java#L269-L276
E7du/jfinal-ext3
src/main/java/com/jfinal/ext/kit/PageViewKit.java
PageViewKit.getJSPPageView
public static String getJSPPageView(String dir, String viewPath, String pageName){ return getPageView(dir, viewPath, pageName, JSP); }
java
public static String getJSPPageView(String dir, String viewPath, String pageName){ return getPageView(dir, viewPath, pageName, JSP); }
[ "public", "static", "String", "getJSPPageView", "(", "String", "dir", ",", "String", "viewPath", ",", "String", "pageName", ")", "{", "return", "getPageView", "(", "dir", ",", "viewPath", ",", "pageName", ",", "JSP", ")", ";", "}" ]
获取页面 @param dir 所在目录 @param viewPath view路径 @param pageName view名字 @return
[ "获取页面" ]
train
https://github.com/E7du/jfinal-ext3/blob/8ffcbd150fd50c72852bb778bd427b5eb19254dc/src/main/java/com/jfinal/ext/kit/PageViewKit.java#L203-L205
haifengl/smile
math/src/main/java/smile/sort/SortUtils.java
SortUtils.siftDown
public static <T extends Comparable<? super T>> void siftDown(T[] arr, int k, int n) { while (2*k <= n) { int j = 2 * k; if (j < n && arr[j].compareTo(arr[j + 1]) < 0) { j++; } if (arr[k].compareTo(arr[j]) >= 0) { break; } SortUtils.swap(arr, k, j); k = j; } }
java
public static <T extends Comparable<? super T>> void siftDown(T[] arr, int k, int n) { while (2*k <= n) { int j = 2 * k; if (j < n && arr[j].compareTo(arr[j + 1]) < 0) { j++; } if (arr[k].compareTo(arr[j]) >= 0) { break; } SortUtils.swap(arr, k, j); k = j; } }
[ "public", "static", "<", "T", "extends", "Comparable", "<", "?", "super", "T", ">", ">", "void", "siftDown", "(", "T", "[", "]", "arr", ",", "int", "k", ",", "int", "n", ")", "{", "while", "(", "2", "*", "k", "<=", "n", ")", "{", "int", "j", ...
To restore the max-heap condition when a node's priority is decreased. We move down the heap, exchanging the node at position k with the larger of that node's two children if necessary and stopping when the node at k is not smaller than either child or the bottom is reached. Note that if n is even and k is n/2, then the node at k has only one child -- this case must be treated properly.
[ "To", "restore", "the", "max", "-", "heap", "condition", "when", "a", "node", "s", "priority", "is", "decreased", ".", "We", "move", "down", "the", "heap", "exchanging", "the", "node", "at", "position", "k", "with", "the", "larger", "of", "that", "node",...
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/sort/SortUtils.java#L195-L207
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java
MapMessage.newInstance
@SuppressWarnings("unchecked") public M newInstance(final Map<String, V> map) { return (M) new MapMessage<>(map); }
java
@SuppressWarnings("unchecked") public M newInstance(final Map<String, V> map) { return (M) new MapMessage<>(map); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "M", "newInstance", "(", "final", "Map", "<", "String", ",", "V", ">", "map", ")", "{", "return", "(", "M", ")", "new", "MapMessage", "<>", "(", "map", ")", ";", "}" ]
Constructs a new instance based on an existing Map. @param map The Map. @return A new MapMessage
[ "Constructs", "a", "new", "instance", "based", "on", "an", "existing", "Map", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java#L419-L422
mikepenz/Android-Iconics
library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java
IconicsDrawable.backgroundColorListRes
@NonNull public IconicsDrawable backgroundColorListRes(@ColorRes int colorResId) { return backgroundColor(ContextCompat.getColorStateList(mContext, colorResId)); }
java
@NonNull public IconicsDrawable backgroundColorListRes(@ColorRes int colorResId) { return backgroundColor(ContextCompat.getColorStateList(mContext, colorResId)); }
[ "@", "NonNull", "public", "IconicsDrawable", "backgroundColorListRes", "(", "@", "ColorRes", "int", "colorResId", ")", "{", "return", "backgroundColor", "(", "ContextCompat", ".", "getColorStateList", "(", "mContext", ",", "colorResId", ")", ")", ";", "}" ]
Set background contour colors from color res. @return The current IconicsDrawable for chaining.
[ "Set", "background", "contour", "colors", "from", "color", "res", "." ]
train
https://github.com/mikepenz/Android-Iconics/blob/0b2c8f7d07b6d2715a417563c66311e7e1fcc7d8/library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java#L860-L863
ziccardi/jnrpe
jnrpe-lib/src/main/java/it/jnrpe/plugins/MetricBuilder.java
MetricBuilder.withValue
public MetricBuilder withValue(Number value, String prettyPrintFormat) { current = new MetricValue(value.toString(), prettyPrintFormat); return this; }
java
public MetricBuilder withValue(Number value, String prettyPrintFormat) { current = new MetricValue(value.toString(), prettyPrintFormat); return this; }
[ "public", "MetricBuilder", "withValue", "(", "Number", "value", ",", "String", "prettyPrintFormat", ")", "{", "current", "=", "new", "MetricValue", "(", "value", ".", "toString", "(", ")", ",", "prettyPrintFormat", ")", ";", "return", "this", ";", "}" ]
Sets the value of the metric to be built. @param value the value of the metric @param prettyPrintFormat the format of the output (@see {@link DecimalFormat}) @return this
[ "Sets", "the", "value", "of", "the", "metric", "to", "be", "built", "." ]
train
https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-lib/src/main/java/it/jnrpe/plugins/MetricBuilder.java#L81-L84
nohana/Amalgam
amalgam/src/main/java/com/amalgam/os/BundleUtils.java
BundleUtils.optFloat
public static float optFloat(@Nullable Bundle bundle, @Nullable String key, float fallback) { if (bundle == null) { return fallback; } return bundle.getFloat(key, fallback); }
java
public static float optFloat(@Nullable Bundle bundle, @Nullable String key, float fallback) { if (bundle == null) { return fallback; } return bundle.getFloat(key, fallback); }
[ "public", "static", "float", "optFloat", "(", "@", "Nullable", "Bundle", "bundle", ",", "@", "Nullable", "String", "key", ",", "float", "fallback", ")", "{", "if", "(", "bundle", "==", "null", ")", "{", "return", "fallback", ";", "}", "return", "bundle",...
Returns a optional float value. In other words, returns the value mapped by key if it exists and is a float. The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns a fallback value. @param bundle a bundle. If the bundle is null, this method will return a fallback value. @param key a key for the value. @param fallback fallback value. @return a float value if exists, fallback value otherwise. @see android.os.Bundle#getFloat(String, float)
[ "Returns", "a", "optional", "float", "value", ".", "In", "other", "words", "returns", "the", "value", "mapped", "by", "key", "if", "it", "exists", "and", "is", "a", "float", ".", "The", "bundle", "argument", "is", "allowed", "to", "be", "{" ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L496-L501
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfContentByte.java
PdfContentByte.escapeString
static void escapeString(byte b[], ByteBuffer content) { content.append_i('('); for (int k = 0; k < b.length; ++k) { byte c = b[k]; switch (c) { case '\r': content.append("\\r"); break; case '\n': content.append("\\n"); break; case '\t': content.append("\\t"); break; case '\b': content.append("\\b"); break; case '\f': content.append("\\f"); break; case '(': case ')': case '\\': content.append_i('\\').append_i(c); break; default: content.append_i(c); } } content.append(")"); }
java
static void escapeString(byte b[], ByteBuffer content) { content.append_i('('); for (int k = 0; k < b.length; ++k) { byte c = b[k]; switch (c) { case '\r': content.append("\\r"); break; case '\n': content.append("\\n"); break; case '\t': content.append("\\t"); break; case '\b': content.append("\\b"); break; case '\f': content.append("\\f"); break; case '(': case ')': case '\\': content.append_i('\\').append_i(c); break; default: content.append_i(c); } } content.append(")"); }
[ "static", "void", "escapeString", "(", "byte", "b", "[", "]", ",", "ByteBuffer", "content", ")", "{", "content", ".", "append_i", "(", "'", "'", ")", ";", "for", "(", "int", "k", "=", "0", ";", "k", "<", "b", ".", "length", ";", "++", "k", ")",...
Escapes a <CODE>byte</CODE> array according to the PDF conventions. @param b the <CODE>byte</CODE> array to escape @param content the content
[ "Escapes", "a", "<CODE", ">", "byte<", "/", "CODE", ">", "array", "according", "to", "the", "PDF", "conventions", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L1614-L1644
taskadapter/redmine-java-api
src/main/java/com/taskadapter/redmineapi/RedmineManagerFactory.java
RedmineManagerFactory.createWithApiKey
public static RedmineManager createWithApiKey(String uri, String apiAccessKey, HttpClient httpClient) { return new RedmineManager(new Transport(new URIConfigurator(uri, apiAccessKey), httpClient)); }
java
public static RedmineManager createWithApiKey(String uri, String apiAccessKey, HttpClient httpClient) { return new RedmineManager(new Transport(new URIConfigurator(uri, apiAccessKey), httpClient)); }
[ "public", "static", "RedmineManager", "createWithApiKey", "(", "String", "uri", ",", "String", "apiAccessKey", ",", "HttpClient", "httpClient", ")", "{", "return", "new", "RedmineManager", "(", "new", "Transport", "(", "new", "URIConfigurator", "(", "uri", ",", ...
Creates an instance of RedmineManager class. Host and apiAccessKey are not checked at this moment. @param uri complete Redmine server web URI, including protocol and port number. Example: http://demo.redmine.org:8080 @param apiAccessKey Redmine API access key. It is shown on "My Account" / "API access key" webpage (check <i>http://redmine_server_url/my/account</i> URL). This parameter is <strong>optional</strong> (can be set to NULL) for Redmine projects, which are "public". @param httpClient Http Client. you can provide your own pre-configured HttpClient if you want to control connection pooling, manage connections eviction, closing, etc.
[ "Creates", "an", "instance", "of", "RedmineManager", "class", ".", "Host", "and", "apiAccessKey", "are", "not", "checked", "at", "this", "moment", "." ]
train
https://github.com/taskadapter/redmine-java-api/blob/0bb65f27ee806ec3bd4007e1641f3e996261a04e/src/main/java/com/taskadapter/redmineapi/RedmineManagerFactory.java#L112-L116
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadLocalRandom.java
ThreadLocalRandom.nextLong
public long nextLong(long origin, long bound) { if (origin >= bound) throw new IllegalArgumentException(BAD_RANGE); return internalNextLong(origin, bound); }
java
public long nextLong(long origin, long bound) { if (origin >= bound) throw new IllegalArgumentException(BAD_RANGE); return internalNextLong(origin, bound); }
[ "public", "long", "nextLong", "(", "long", "origin", ",", "long", "bound", ")", "{", "if", "(", "origin", ">=", "bound", ")", "throw", "new", "IllegalArgumentException", "(", "BAD_RANGE", ")", ";", "return", "internalNextLong", "(", "origin", ",", "bound", ...
Returns a pseudorandom {@code long} value between the specified origin (inclusive) and the specified bound (exclusive). @param origin the least value returned @param bound the upper bound (exclusive) @return a pseudorandom {@code long} value between the origin (inclusive) and the bound (exclusive) @throws IllegalArgumentException if {@code origin} is greater than or equal to {@code bound}
[ "Returns", "a", "pseudorandom", "{", "@code", "long", "}", "value", "between", "the", "specified", "origin", "(", "inclusive", ")", "and", "the", "specified", "bound", "(", "exclusive", ")", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadLocalRandom.java#L373-L377
gwtplus/google-gin
src/main/java/com/google/gwt/inject/rebind/util/SourceSnippets.java
SourceSnippets.callMemberInject
public static SourceSnippet callMemberInject(final TypeLiteral<?> type, final String input) { return new SourceSnippet() { public String getSource(InjectorWriteContext writeContext) { return writeContext.callMemberInject(type, input); } }; }
java
public static SourceSnippet callMemberInject(final TypeLiteral<?> type, final String input) { return new SourceSnippet() { public String getSource(InjectorWriteContext writeContext) { return writeContext.callMemberInject(type, input); } }; }
[ "public", "static", "SourceSnippet", "callMemberInject", "(", "final", "TypeLiteral", "<", "?", ">", "type", ",", "final", "String", "input", ")", "{", "return", "new", "SourceSnippet", "(", ")", "{", "public", "String", "getSource", "(", "InjectorWriteContext",...
Creates a snippet (including a trailing semicolon) that performs member injection on a value of the given type. @param type the type of value to perform member injection on @param input a Java expression that evaluates to the object that should be member-injected
[ "Creates", "a", "snippet", "(", "including", "a", "trailing", "semicolon", ")", "that", "performs", "member", "injection", "on", "a", "value", "of", "the", "given", "type", "." ]
train
https://github.com/gwtplus/google-gin/blob/595e61ee0d2fa508815c016e924ec0e5cea2a2aa/src/main/java/com/google/gwt/inject/rebind/util/SourceSnippets.java#L63-L69
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.initEditorStates
private void initEditorStates() { m_editorState = new HashMap<CmsMessageBundleEditorTypes.EditMode, EditorState>(); List<TableProperty> cols = null; switch (m_bundleType) { case PROPERTY: case XML: if (hasDescriptor()) { // bundle descriptor is present, keys are not editable in default mode, maybe master mode is available m_editorState.put(CmsMessageBundleEditorTypes.EditMode.DEFAULT, getDefaultState()); if (hasMasterMode()) { // the bundle descriptor is editable m_editorState.put(CmsMessageBundleEditorTypes.EditMode.MASTER, getMasterState()); } } else { // no bundle descriptor given - implies no master mode cols = new ArrayList<TableProperty>(1); cols.add(TableProperty.KEY); cols.add(TableProperty.TRANSLATION); m_editorState.put(CmsMessageBundleEditorTypes.EditMode.DEFAULT, new EditorState(cols, true)); } break; case DESCRIPTOR: cols = new ArrayList<TableProperty>(3); cols.add(TableProperty.KEY); cols.add(TableProperty.DESCRIPTION); cols.add(TableProperty.DEFAULT); m_editorState.put(CmsMessageBundleEditorTypes.EditMode.DEFAULT, new EditorState(cols, true)); break; default: throw new IllegalArgumentException(); } }
java
private void initEditorStates() { m_editorState = new HashMap<CmsMessageBundleEditorTypes.EditMode, EditorState>(); List<TableProperty> cols = null; switch (m_bundleType) { case PROPERTY: case XML: if (hasDescriptor()) { // bundle descriptor is present, keys are not editable in default mode, maybe master mode is available m_editorState.put(CmsMessageBundleEditorTypes.EditMode.DEFAULT, getDefaultState()); if (hasMasterMode()) { // the bundle descriptor is editable m_editorState.put(CmsMessageBundleEditorTypes.EditMode.MASTER, getMasterState()); } } else { // no bundle descriptor given - implies no master mode cols = new ArrayList<TableProperty>(1); cols.add(TableProperty.KEY); cols.add(TableProperty.TRANSLATION); m_editorState.put(CmsMessageBundleEditorTypes.EditMode.DEFAULT, new EditorState(cols, true)); } break; case DESCRIPTOR: cols = new ArrayList<TableProperty>(3); cols.add(TableProperty.KEY); cols.add(TableProperty.DESCRIPTION); cols.add(TableProperty.DEFAULT); m_editorState.put(CmsMessageBundleEditorTypes.EditMode.DEFAULT, new EditorState(cols, true)); break; default: throw new IllegalArgumentException(); } }
[ "private", "void", "initEditorStates", "(", ")", "{", "m_editorState", "=", "new", "HashMap", "<", "CmsMessageBundleEditorTypes", ".", "EditMode", ",", "EditorState", ">", "(", ")", ";", "List", "<", "TableProperty", ">", "cols", "=", "null", ";", "switch", ...
Initializes the editor states for the different modes, depending on the type of the opened file.
[ "Initializes", "the", "editor", "states", "for", "the", "different", "modes", "depending", "on", "the", "type", "of", "the", "opened", "file", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1342-L1372
joniles/mpxj
src/main/java/net/sf/mpxj/ganttproject/GanttProjectReader.java
GanttProjectReader.addException
private void addException(ProjectCalendar mpxjCalendar, net.sf.mpxj.ganttproject.schema.Date date) { String year = date.getYear(); if (year == null || year.isEmpty()) { // In order to process recurring exceptions using MPXJ, we need a start and end date // to constrain the number of dates we generate. // May need to pre-process the tasks in order to calculate a start and finish date. // TODO: handle recurring exceptions } else { Calendar calendar = DateHelper.popCalendar(); calendar.set(Calendar.YEAR, Integer.parseInt(year)); calendar.set(Calendar.MONTH, NumberHelper.getInt(date.getMonth())); calendar.set(Calendar.DAY_OF_MONTH, NumberHelper.getInt(date.getDate())); Date exceptionDate = calendar.getTime(); DateHelper.pushCalendar(calendar); ProjectCalendarException exception = mpxjCalendar.addCalendarException(exceptionDate, exceptionDate); // TODO: not sure how NEUTRAL should be handled if ("WORKING_DAY".equals(date.getType())) { exception.addRange(ProjectCalendarWeek.DEFAULT_WORKING_MORNING); exception.addRange(ProjectCalendarWeek.DEFAULT_WORKING_AFTERNOON); } } }
java
private void addException(ProjectCalendar mpxjCalendar, net.sf.mpxj.ganttproject.schema.Date date) { String year = date.getYear(); if (year == null || year.isEmpty()) { // In order to process recurring exceptions using MPXJ, we need a start and end date // to constrain the number of dates we generate. // May need to pre-process the tasks in order to calculate a start and finish date. // TODO: handle recurring exceptions } else { Calendar calendar = DateHelper.popCalendar(); calendar.set(Calendar.YEAR, Integer.parseInt(year)); calendar.set(Calendar.MONTH, NumberHelper.getInt(date.getMonth())); calendar.set(Calendar.DAY_OF_MONTH, NumberHelper.getInt(date.getDate())); Date exceptionDate = calendar.getTime(); DateHelper.pushCalendar(calendar); ProjectCalendarException exception = mpxjCalendar.addCalendarException(exceptionDate, exceptionDate); // TODO: not sure how NEUTRAL should be handled if ("WORKING_DAY".equals(date.getType())) { exception.addRange(ProjectCalendarWeek.DEFAULT_WORKING_MORNING); exception.addRange(ProjectCalendarWeek.DEFAULT_WORKING_AFTERNOON); } } }
[ "private", "void", "addException", "(", "ProjectCalendar", "mpxjCalendar", ",", "net", ".", "sf", ".", "mpxj", ".", "ganttproject", ".", "schema", ".", "Date", "date", ")", "{", "String", "year", "=", "date", ".", "getYear", "(", ")", ";", "if", "(", "...
Add a single exception to a calendar. @param mpxjCalendar MPXJ calendar @param date calendar exception
[ "Add", "a", "single", "exception", "to", "a", "calendar", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ganttproject/GanttProjectReader.java#L307-L334
OpenLiberty/open-liberty
dev/com.ibm.json4j/src/com/ibm/json/xml/internal/JSONObject.java
JSONObject.writeObject
public void writeObject(Writer writer, int indentDepth, boolean contentOnly) throws IOException { if (logger.isLoggable(Level.FINER)) logger.entering(className, "writeObject(Writer, int, boolean)"); writeObject(writer,indentDepth,contentOnly, false); if (logger.isLoggable(Level.FINER)) logger.entering(className, "writeObject(Writer, int, boolean)"); }
java
public void writeObject(Writer writer, int indentDepth, boolean contentOnly) throws IOException { if (logger.isLoggable(Level.FINER)) logger.entering(className, "writeObject(Writer, int, boolean)"); writeObject(writer,indentDepth,contentOnly, false); if (logger.isLoggable(Level.FINER)) logger.entering(className, "writeObject(Writer, int, boolean)"); }
[ "public", "void", "writeObject", "(", "Writer", "writer", ",", "int", "indentDepth", ",", "boolean", "contentOnly", ")", "throws", "IOException", "{", "if", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINER", ")", ")", "logger", ".", "entering", ...
Method to write out the JSON formatted object. Same as calling writeObject(writer,indentDepth,contentOnly,false); @param writer The writer to use when serializing the JSON structure. @param indentDepth How far to indent the text for object's JSON format. @param contentOnly Flag to debnnote whether to assign this as an attribute name, or as a nameless object. Commonly used for serializing an array. The Array itself has the name, The contents are all nameless objects @throws IOException Trhown if an error occurs on write.
[ "Method", "to", "write", "out", "the", "JSON", "formatted", "object", ".", "Same", "as", "calling", "writeObject", "(", "writer", "indentDepth", "contentOnly", "false", ")", ";" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.json4j/src/com/ibm/json/xml/internal/JSONObject.java#L141-L147
Sciss/abc4j
abc/src/main/java/abc/xml/Abc2xml.java
Abc2xml.writeAsMusicXML
public void writeAsMusicXML(Tune tune, File file) throws IOException { BufferedWriter writer = new BufferedWriter(new FileWriter(file)); Document doc = createMusicXmlDOM(tune); // dumpDOM(doc); writeAsMusicXML(doc, writer); writer.flush(); writer.close(); }
java
public void writeAsMusicXML(Tune tune, File file) throws IOException { BufferedWriter writer = new BufferedWriter(new FileWriter(file)); Document doc = createMusicXmlDOM(tune); // dumpDOM(doc); writeAsMusicXML(doc, writer); writer.flush(); writer.close(); }
[ "public", "void", "writeAsMusicXML", "(", "Tune", "tune", ",", "File", "file", ")", "throws", "IOException", "{", "BufferedWriter", "writer", "=", "new", "BufferedWriter", "(", "new", "FileWriter", "(", "file", ")", ")", ";", "Document", "doc", "=", "createM...
Writes the specified tune to the specified file as MusicXML. @param file A file. @param tune A tune. @throws IOException Thrown if the file cannot be created.
[ "Writes", "the", "specified", "tune", "to", "the", "specified", "file", "as", "MusicXML", "." ]
train
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/xml/Abc2xml.java#L175-L182
nakamura5akihito/six-util
src/main/java/jp/go/aist/six/util/search/RelationalBinding.java
RelationalBinding.lessEqualBinding
public static RelationalBinding lessEqualBinding( final String property, final Object value ) { return (new RelationalBinding( property, Relation.LESS_EQUAL, value )); }
java
public static RelationalBinding lessEqualBinding( final String property, final Object value ) { return (new RelationalBinding( property, Relation.LESS_EQUAL, value )); }
[ "public", "static", "RelationalBinding", "lessEqualBinding", "(", "final", "String", "property", ",", "final", "Object", "value", ")", "{", "return", "(", "new", "RelationalBinding", "(", "property", ",", "Relation", ".", "LESS_EQUAL", ",", "value", ")", ")", ...
Creates a 'LESS_EQUAL' binding. @param property the property. @param value the value to which the property should be related. @return a 'LESS_EQUAL' binding.
[ "Creates", "a", "LESS_EQUAL", "binding", "." ]
train
https://github.com/nakamura5akihito/six-util/blob/a6db388a345e220cea2b1fa6324d15c80c6278b6/src/main/java/jp/go/aist/six/util/search/RelationalBinding.java#L110-L116
xerial/snappy-java
src/main/java/org/xerial/snappy/Snappy.java
Snappy.rawUncompress
public static int rawUncompress(byte[] input, int inputOffset, int inputLength, Object output, int outputOffset) throws IOException { if (input == null || output == null) { throw new NullPointerException("input or output is null"); } return impl.rawUncompress(input, inputOffset, inputLength, output, outputOffset); }
java
public static int rawUncompress(byte[] input, int inputOffset, int inputLength, Object output, int outputOffset) throws IOException { if (input == null || output == null) { throw new NullPointerException("input or output is null"); } return impl.rawUncompress(input, inputOffset, inputLength, output, outputOffset); }
[ "public", "static", "int", "rawUncompress", "(", "byte", "[", "]", "input", ",", "int", "inputOffset", ",", "int", "inputLength", ",", "Object", "output", ",", "int", "outputOffset", ")", "throws", "IOException", "{", "if", "(", "input", "==", "null", "||"...
Uncompress the content in the input buffer. The uncompressed data is written to the output buffer. <p/> Note that if you pass the wrong data or the range [inputOffset, inputOffset + inputLength) that cannot be uncompressed, your JVM might crash due to the access violation exception issued in the native code written in C++. To avoid this type of crash, use {@link #isValidCompressedBuffer(byte[], int, int)} first. @param input input byte array @param inputOffset byte offset in the input byte array @param inputLength byte length of the input data @param output output buffer, MUST be a primitive type array @param outputOffset byte offset in the output buffer @return the byte size of the uncompressed data @throws IOException when failed to uncompress the input data
[ "Uncompress", "the", "content", "in", "the", "input", "buffer", ".", "The", "uncompressed", "data", "is", "written", "to", "the", "output", "buffer", ".", "<p", "/", ">", "Note", "that", "if", "you", "pass", "the", "wrong", "data", "or", "the", "range", ...
train
https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/Snappy.java#L468-L475
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/application/session/ApplicationSession.java
ApplicationSession.setUserAttributes
public void setUserAttributes(Map<String, Object> attributes) { userAttributes.putAll(attributes); propertyChangeSupport.firePropertyChange(USER_ATTRIBUTES, null, userAttributes); }
java
public void setUserAttributes(Map<String, Object> attributes) { userAttributes.putAll(attributes); propertyChangeSupport.firePropertyChange(USER_ATTRIBUTES, null, userAttributes); }
[ "public", "void", "setUserAttributes", "(", "Map", "<", "String", ",", "Object", ">", "attributes", ")", "{", "userAttributes", ".", "putAll", "(", "attributes", ")", ";", "propertyChangeSupport", ".", "firePropertyChange", "(", "USER_ATTRIBUTES", ",", "null", "...
Add the given key/value pairs to the user attributes. @param attributes a map of key/value pairs.
[ "Add", "the", "given", "key", "/", "value", "pairs", "to", "the", "user", "attributes", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/session/ApplicationSession.java#L230-L234
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java
SDMath.clipByValue
public SDVariable clipByValue(SDVariable x, double clipValueMin, double clipValueMax) { return clipByValue(null, x, clipValueMin, clipValueMax); }
java
public SDVariable clipByValue(SDVariable x, double clipValueMin, double clipValueMax) { return clipByValue(null, x, clipValueMin, clipValueMax); }
[ "public", "SDVariable", "clipByValue", "(", "SDVariable", "x", ",", "double", "clipValueMin", ",", "double", "clipValueMax", ")", "{", "return", "clipByValue", "(", "null", ",", "x", ",", "clipValueMin", ",", "clipValueMax", ")", ";", "}" ]
Element-wise clipping function:<br> out[i] = in[i] if in[i] >= clipValueMin and in[i] <= clipValueMax<br> out[i] = clipValueMin if in[i] < clipValueMin<br> out[i] = clipValueMax if in[i] > clipValueMax<br> @param x Input variable @param clipValueMin Minimum value for clipping @param clipValueMax Maximum value for clipping @return Output variable
[ "Element", "-", "wise", "clipping", "function", ":", "<br", ">", "out", "[", "i", "]", "=", "in", "[", "i", "]", "if", "in", "[", "i", "]", ">", "=", "clipValueMin", "and", "in", "[", "i", "]", "<", "=", "clipValueMax<br", ">", "out", "[", "i",...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java#L447-L449
belaban/JGroups
src/org/jgroups/util/Promise.java
Promise._getResultWithTimeout
protected T _getResultWithTimeout(final long timeout) throws TimeoutException { if(timeout <= 0) cond.waitFor(this::hasResult); else if(!cond.waitFor(this::hasResult, timeout, TimeUnit.MILLISECONDS)) throw new TimeoutException(); return result; }
java
protected T _getResultWithTimeout(final long timeout) throws TimeoutException { if(timeout <= 0) cond.waitFor(this::hasResult); else if(!cond.waitFor(this::hasResult, timeout, TimeUnit.MILLISECONDS)) throw new TimeoutException(); return result; }
[ "protected", "T", "_getResultWithTimeout", "(", "final", "long", "timeout", ")", "throws", "TimeoutException", "{", "if", "(", "timeout", "<=", "0", ")", "cond", ".", "waitFor", "(", "this", "::", "hasResult", ")", ";", "else", "if", "(", "!", "cond", "....
Blocks until a result is available, or timeout milliseconds have elapsed. Needs to be called with lock held @param timeout in ms @return An object @throws TimeoutException If a timeout occurred (implies that timeout > 0)
[ "Blocks", "until", "a", "result", "is", "available", "or", "timeout", "milliseconds", "have", "elapsed", ".", "Needs", "to", "be", "called", "with", "lock", "held" ]
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Promise.java#L143-L149
Azure/azure-sdk-for-java
network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/ApplicationSecurityGroupsInner.java
ApplicationSecurityGroupsInner.getByResourceGroup
public ApplicationSecurityGroupInner getByResourceGroup(String resourceGroupName, String applicationSecurityGroupName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, applicationSecurityGroupName).toBlocking().single().body(); }
java
public ApplicationSecurityGroupInner getByResourceGroup(String resourceGroupName, String applicationSecurityGroupName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, applicationSecurityGroupName).toBlocking().single().body(); }
[ "public", "ApplicationSecurityGroupInner", "getByResourceGroup", "(", "String", "resourceGroupName", ",", "String", "applicationSecurityGroupName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "applicationSecurityGroupName", ")", ...
Gets information about the specified application security group. @param resourceGroupName The name of the resource group. @param applicationSecurityGroupName The name of the application security group. @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 ApplicationSecurityGroupInner object if successful.
[ "Gets", "information", "about", "the", "specified", "application", "security", "group", "." ]
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/ApplicationSecurityGroupsInner.java#L266-L268
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java
TreeScanner.visitIntersectionType
@Override public R visitIntersectionType(IntersectionTypeTree node, P p) { return scan(node.getBounds(), p); }
java
@Override public R visitIntersectionType(IntersectionTypeTree node, P p) { return scan(node.getBounds(), p); }
[ "@", "Override", "public", "R", "visitIntersectionType", "(", "IntersectionTypeTree", "node", ",", "P", "p", ")", "{", "return", "scan", "(", "node", ".", "getBounds", "(", ")", ",", "p", ")", ";", "}" ]
{@inheritDoc} This implementation scans the children in left to right order. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of scanning
[ "{", "@inheritDoc", "}", "This", "implementation", "scans", "the", "children", "in", "left", "to", "right", "order", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java#L778-L781
pravega/pravega
segmentstore/storage/src/main/java/io/pravega/segmentstore/storage/rolling/SegmentChunk.java
SegmentChunk.forSegment
static SegmentChunk forSegment(String segmentName, long startOffset) { return new SegmentChunk(StreamSegmentNameUtils.getSegmentChunkName(segmentName, startOffset), startOffset); }
java
static SegmentChunk forSegment(String segmentName, long startOffset) { return new SegmentChunk(StreamSegmentNameUtils.getSegmentChunkName(segmentName, startOffset), startOffset); }
[ "static", "SegmentChunk", "forSegment", "(", "String", "segmentName", ",", "long", "startOffset", ")", "{", "return", "new", "SegmentChunk", "(", "StreamSegmentNameUtils", ".", "getSegmentChunkName", "(", "segmentName", ",", "startOffset", ")", ",", "startOffset", "...
Creates a new instance of the SegmentChunk class. @param segmentName The name of the owning Segment (not the name of this SegmentChunk). @param startOffset The offset within the owning Segment where this SegmentChunk starts at. @return A new SegmentChunk.
[ "Creates", "a", "new", "instance", "of", "the", "SegmentChunk", "class", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/src/main/java/io/pravega/segmentstore/storage/rolling/SegmentChunk.java#L66-L68
sporniket/core
sporniket-core-lang/src/main/java/com/sporniket/libre/lang/functor/FunctorFactory.java
FunctorFactory.instanciateFunctorWithParameterAsAClassMethodWrapper
public static FunctorWithParameter instanciateFunctorWithParameterAsAClassMethodWrapper(Class<?> instanceClass, String methodName) throws Exception { if (null == instanceClass) { throw new NullPointerException("instanceClass is null"); } Method _method = instanceClass.getMethod(methodName, (Class<?>[]) null); return instanciateFunctorWithParameterAsAMethodWrapper(null, _method); }
java
public static FunctorWithParameter instanciateFunctorWithParameterAsAClassMethodWrapper(Class<?> instanceClass, String methodName) throws Exception { if (null == instanceClass) { throw new NullPointerException("instanceClass is null"); } Method _method = instanceClass.getMethod(methodName, (Class<?>[]) null); return instanciateFunctorWithParameterAsAMethodWrapper(null, _method); }
[ "public", "static", "FunctorWithParameter", "instanciateFunctorWithParameterAsAClassMethodWrapper", "(", "Class", "<", "?", ">", "instanceClass", ",", "String", "methodName", ")", "throws", "Exception", "{", "if", "(", "null", "==", "instanceClass", ")", "{", "throw",...
Create a functor with parameter, wrapping a call to another method. @param instanceClass class containing the method. @param methodName Name of the method, it must exist. @return a Functor with parameter that call the specified method on the specified instance. @throws Exception if there is a problem to deal with.
[ "Create", "a", "functor", "with", "parameter", "wrapping", "a", "call", "to", "another", "method", "." ]
train
https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-lang/src/main/java/com/sporniket/libre/lang/functor/FunctorFactory.java#L119-L128
spotify/scio
scio-bigquery/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/PatchedBigQueryTableRowIterator.java
PatchedBigQueryTableRowIterator.deleteTable
private void deleteTable(String datasetId, String tableId) throws IOException, InterruptedException { executeWithBackOff( client.tables().delete(projectId, datasetId, tableId), String.format( "Error when trying to delete the temporary table %s in dataset %s of project %s. " + "Manual deletion may be required.", tableId, datasetId, projectId)); }
java
private void deleteTable(String datasetId, String tableId) throws IOException, InterruptedException { executeWithBackOff( client.tables().delete(projectId, datasetId, tableId), String.format( "Error when trying to delete the temporary table %s in dataset %s of project %s. " + "Manual deletion may be required.", tableId, datasetId, projectId)); }
[ "private", "void", "deleteTable", "(", "String", "datasetId", ",", "String", "tableId", ")", "throws", "IOException", ",", "InterruptedException", "{", "executeWithBackOff", "(", "client", ".", "tables", "(", ")", ".", "delete", "(", "projectId", ",", "datasetId...
Delete the given table that is available in the given dataset.
[ "Delete", "the", "given", "table", "that", "is", "available", "in", "the", "given", "dataset", "." ]
train
https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-bigquery/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/PatchedBigQueryTableRowIterator.java#L360-L368
apache/incubator-shardingsphere
sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/datasource/JDBCBackendDataSource.java
JDBCBackendDataSource.getConnections
public List<Connection> getConnections(final ConnectionMode connectionMode, final String dataSourceName, final int connectionSize) throws SQLException { return getConnections(connectionMode, dataSourceName, connectionSize, TransactionType.LOCAL); }
java
public List<Connection> getConnections(final ConnectionMode connectionMode, final String dataSourceName, final int connectionSize) throws SQLException { return getConnections(connectionMode, dataSourceName, connectionSize, TransactionType.LOCAL); }
[ "public", "List", "<", "Connection", ">", "getConnections", "(", "final", "ConnectionMode", "connectionMode", ",", "final", "String", "dataSourceName", ",", "final", "int", "connectionSize", ")", "throws", "SQLException", "{", "return", "getConnections", "(", "conne...
Get connections. @param connectionMode connection mode @param dataSourceName data source name @param connectionSize size of connections to get @return connections @throws SQLException SQL exception
[ "Get", "connections", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/datasource/JDBCBackendDataSource.java#L97-L99
overturetool/overture
ide/debug/src/main/java/org/overture/ide/debug/utils/CharOperation.java
CharOperation.indexOf
public static final int indexOf(final char[] toBeFound, final char[] array, final boolean isCaseSensitive, final int start) { return indexOf(toBeFound, array, isCaseSensitive, start, array.length); }
java
public static final int indexOf(final char[] toBeFound, final char[] array, final boolean isCaseSensitive, final int start) { return indexOf(toBeFound, array, isCaseSensitive, start, array.length); }
[ "public", "static", "final", "int", "indexOf", "(", "final", "char", "[", "]", "toBeFound", ",", "final", "char", "[", "]", "array", ",", "final", "boolean", "isCaseSensitive", ",", "final", "int", "start", ")", "{", "return", "indexOf", "(", "toBeFound", ...
Answers the first index in the array for which the toBeFound array is a matching subarray following the case rule starting at the index start. Answers -1 if no match is found. <br> <br> For example: <ol> <li> <pre> toBeFound = { 'c' } array = { ' a', 'b', 'c', 'd' } result =&gt; 2 </pre> </li> <li> <pre> toBeFound = { 'e' } array = { ' a', 'b', 'c', 'd' } result =&gt; -1 </pre> </li> </ol> @param toBeFound the subarray to search @param array the array to be searched @param isCaseSensitive flag to know if the matching should be case sensitive @param start the starting index @return the first index in the array for which the toBeFound array is a matching subarray following the case rule starting at the index start, -1 otherwise @throws NullPointerException if array is null or toBeFound is null
[ "Answers", "the", "first", "index", "in", "the", "array", "for", "which", "the", "toBeFound", "array", "is", "a", "matching", "subarray", "following", "the", "case", "rule", "starting", "at", "the", "index", "start", ".", "Answers", "-", "1", "if", "no", ...
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/debug/src/main/java/org/overture/ide/debug/utils/CharOperation.java#L2135-L2139
jamesagnew/hapi-fhir
hapi-fhir-narrativegenerator/src/main/java/ca/uhn/fhir/narrative/template/filters/Join.java
Join.apply
@Override public Object apply(Object value, Object... params) { if (value == null) { return ""; } StringBuilder builder = new StringBuilder(); Object[] array = super.asArray(value); String glue = params.length == 0 ? " " : super.asString(super.get(0, params)); for (int i = 0; i < array.length; i++) { builder.append(super.asString(array[i])); if (i < array.length - 1) { builder.append(glue); } } return builder.toString(); }
java
@Override public Object apply(Object value, Object... params) { if (value == null) { return ""; } StringBuilder builder = new StringBuilder(); Object[] array = super.asArray(value); String glue = params.length == 0 ? " " : super.asString(super.get(0, params)); for (int i = 0; i < array.length; i++) { builder.append(super.asString(array[i])); if (i < array.length - 1) { builder.append(glue); } } return builder.toString(); }
[ "@", "Override", "public", "Object", "apply", "(", "Object", "value", ",", "Object", "...", "params", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "\"\"", ";", "}", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", "...
/* join(input, glue = ' ') Join elements of the array with certain character between them
[ "/", "*", "join", "(", "input", "glue", "=", ")" ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-narrativegenerator/src/main/java/ca/uhn/fhir/narrative/template/filters/Join.java#L12-L34
mgledi/DRUMS
src/main/java/com/unister/semweb/drums/file/AbstractHeaderFile.java
AbstractHeaderFile.checkRegions
protected long checkRegions(long offset, int length) throws IOException { if (offset + length > filledUpTo) throw new IOException("Can't access memory outside the file size (" + filledUpTo + " bytes). You've requested portion " + offset + "-" + (offset + length) + " bytes. File: " + osFile.getAbsolutePath() + "\n" + "actual Filesize: " + size + "\n" + "actual filledUpTo: " + filledUpTo); return offset; }
java
protected long checkRegions(long offset, int length) throws IOException { if (offset + length > filledUpTo) throw new IOException("Can't access memory outside the file size (" + filledUpTo + " bytes). You've requested portion " + offset + "-" + (offset + length) + " bytes. File: " + osFile.getAbsolutePath() + "\n" + "actual Filesize: " + size + "\n" + "actual filledUpTo: " + filledUpTo); return offset; }
[ "protected", "long", "checkRegions", "(", "long", "offset", ",", "int", "length", ")", "throws", "IOException", "{", "if", "(", "offset", "+", "length", ">", "filledUpTo", ")", "throw", "new", "IOException", "(", "\"Can't access memory outside the file size (\"", ...
checks if the accessed region is accessible @param offset the byte-offset where to start @param length the length of the region to access @return the offset, if the region is accessible @throws IOException
[ "checks", "if", "the", "accessed", "region", "is", "accessible" ]
train
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/file/AbstractHeaderFile.java#L314-L321
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.deleteSSHKey
public void deleteSSHKey(Integer targetUserId, Integer targetKeyId) throws IOException { String tailUrl = GitlabUser.USERS_URL + "/" + targetUserId + GitlabSSHKey.KEYS_URL + "/" + targetKeyId; retrieve().method(DELETE).to(tailUrl, Void.class); }
java
public void deleteSSHKey(Integer targetUserId, Integer targetKeyId) throws IOException { String tailUrl = GitlabUser.USERS_URL + "/" + targetUserId + GitlabSSHKey.KEYS_URL + "/" + targetKeyId; retrieve().method(DELETE).to(tailUrl, Void.class); }
[ "public", "void", "deleteSSHKey", "(", "Integer", "targetUserId", ",", "Integer", "targetKeyId", ")", "throws", "IOException", "{", "String", "tailUrl", "=", "GitlabUser", ".", "USERS_URL", "+", "\"/\"", "+", "targetUserId", "+", "GitlabSSHKey", ".", "KEYS_URL", ...
Delete user's ssh key @param targetUserId The id of the Gitlab user @param targetKeyId The id of the Gitlab ssh key @throws IOException on gitlab api call error
[ "Delete", "user", "s", "ssh", "key" ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L422-L425
petergeneric/stdlib
stdlib/src/main/java/com/peterphi/std/crypto/openssl/OpenSSLPKCS12.java
OpenSSLPKCS12.PEMtoP12
public static void PEMtoP12(File pem, String pemPassword, File toP12, String p12Password) throws IOException { if (!pem.exists()) throw new IllegalArgumentException("pem file does not exist: " + pem.getPath()); Execed openssl = Exec.utilityAs(null, OPENSSL, "pkcs12", "-nodes", "-in", pem.getPath(), "-out", toP12.getPath(), "-export", "-passin", "pass:" + pemPassword, "-passout", "pass:" + p12Password); int returnCode = openssl.waitForExit(); if (returnCode != 0) throw new IllegalStateException("Unexpected openssl exit code " + returnCode + "; output:\n" + openssl.getStandardOut()); }
java
public static void PEMtoP12(File pem, String pemPassword, File toP12, String p12Password) throws IOException { if (!pem.exists()) throw new IllegalArgumentException("pem file does not exist: " + pem.getPath()); Execed openssl = Exec.utilityAs(null, OPENSSL, "pkcs12", "-nodes", "-in", pem.getPath(), "-out", toP12.getPath(), "-export", "-passin", "pass:" + pemPassword, "-passout", "pass:" + p12Password); int returnCode = openssl.waitForExit(); if (returnCode != 0) throw new IllegalStateException("Unexpected openssl exit code " + returnCode + "; output:\n" + openssl.getStandardOut()); }
[ "public", "static", "void", "PEMtoP12", "(", "File", "pem", ",", "String", "pemPassword", ",", "File", "toP12", ",", "String", "p12Password", ")", "throws", "IOException", "{", "if", "(", "!", "pem", ".", "exists", "(", ")", ")", "throw", "new", "Illegal...
@param pem the PEM file containing the keys & certificates to put in a P12 @param pemPassword The password for any encrypted keys in the PEM @param toP12 The PKCS12 file @param p12Password the password to put on the PKCS12 keystore @throws IOException if a catastrophic unexpected failure occurs during execution @throws IllegalArgumentException if the PEM keystore doesn't exist @throws IllegalStateException if openssl exits with a failure condition
[ "@param", "pem", "the", "PEM", "file", "containing", "the", "keys", "&", "certificates", "to", "put", "in", "a", "P12", "@param", "pemPassword", "The", "password", "for", "any", "encrypted", "keys", "in", "the", "PEM", "@param", "toP12", "The", "PKCS12", "...
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/crypto/openssl/OpenSSLPKCS12.java#L116-L139
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/github/lgooddatepicker/components/TimePicker.java
TimePicker.initComponents
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents timeTextField = new JTextField(); toggleTimeMenuButton = new JButton(); spinnerPanel = new JPanel(); increaseButton = new JButton(); decreaseButton = new JButton(); //======== this ======== setLayout(new FormLayout( "pref:grow, 3*(pref)", "fill:pref:grow")); //---- timeTextField ---- timeTextField.setMargin(new Insets(1, 3, 2, 2)); timeTextField.setBorder(new CompoundBorder( new MatteBorder(1, 1, 1, 1, new Color(122, 138, 153)), new EmptyBorder(1, 3, 2, 2))); timeTextField.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { setTextFieldToValidStateIfNeeded(); } }); add(timeTextField, CC.xy(1, 1)); //---- toggleTimeMenuButton ---- toggleTimeMenuButton.setText("v"); toggleTimeMenuButton.setFocusPainted(false); toggleTimeMenuButton.setFocusable(false); toggleTimeMenuButton.setFont(new Font("Segoe UI", Font.PLAIN, 8)); toggleTimeMenuButton.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { zEventToggleTimeMenuButtonMousePressed(e); } }); add(toggleTimeMenuButton, CC.xy(3, 1)); //======== spinnerPanel ======== { spinnerPanel.setLayout(new FormLayout( "default", "fill:pref:grow, fill:default:grow")); ((FormLayout) spinnerPanel.getLayout()).setRowGroups(new int[][]{{1, 2}}); //---- increaseButton ---- increaseButton.setFocusPainted(false); increaseButton.setFocusable(false); increaseButton.setFont(new Font("Arial", Font.PLAIN, 8)); increaseButton.setText("+"); spinnerPanel.add(increaseButton, CC.xy(1, 1)); //---- decreaseButton ---- decreaseButton.setFocusPainted(false); decreaseButton.setFocusable(false); decreaseButton.setFont(new Font("Arial", Font.PLAIN, 8)); decreaseButton.setText("-"); spinnerPanel.add(decreaseButton, CC.xy(1, 2)); } add(spinnerPanel, CC.xy(4, 1)); // JFormDesigner - End of component initialization //GEN-END:initComponents }
java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents timeTextField = new JTextField(); toggleTimeMenuButton = new JButton(); spinnerPanel = new JPanel(); increaseButton = new JButton(); decreaseButton = new JButton(); //======== this ======== setLayout(new FormLayout( "pref:grow, 3*(pref)", "fill:pref:grow")); //---- timeTextField ---- timeTextField.setMargin(new Insets(1, 3, 2, 2)); timeTextField.setBorder(new CompoundBorder( new MatteBorder(1, 1, 1, 1, new Color(122, 138, 153)), new EmptyBorder(1, 3, 2, 2))); timeTextField.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { setTextFieldToValidStateIfNeeded(); } }); add(timeTextField, CC.xy(1, 1)); //---- toggleTimeMenuButton ---- toggleTimeMenuButton.setText("v"); toggleTimeMenuButton.setFocusPainted(false); toggleTimeMenuButton.setFocusable(false); toggleTimeMenuButton.setFont(new Font("Segoe UI", Font.PLAIN, 8)); toggleTimeMenuButton.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { zEventToggleTimeMenuButtonMousePressed(e); } }); add(toggleTimeMenuButton, CC.xy(3, 1)); //======== spinnerPanel ======== { spinnerPanel.setLayout(new FormLayout( "default", "fill:pref:grow, fill:default:grow")); ((FormLayout) spinnerPanel.getLayout()).setRowGroups(new int[][]{{1, 2}}); //---- increaseButton ---- increaseButton.setFocusPainted(false); increaseButton.setFocusable(false); increaseButton.setFont(new Font("Arial", Font.PLAIN, 8)); increaseButton.setText("+"); spinnerPanel.add(increaseButton, CC.xy(1, 1)); //---- decreaseButton ---- decreaseButton.setFocusPainted(false); decreaseButton.setFocusable(false); decreaseButton.setFont(new Font("Arial", Font.PLAIN, 8)); decreaseButton.setText("-"); spinnerPanel.add(decreaseButton, CC.xy(1, 2)); } add(spinnerPanel, CC.xy(4, 1)); // JFormDesigner - End of component initialization //GEN-END:initComponents }
[ "private", "void", "initComponents", "(", ")", "{", "// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents", "timeTextField", "=", "new", "JTextField", "(", ")", ";", "toggleTimeMenuButton", "=", "new", "JButton", "(", ")", ";", "spinnerPan...
initComponents, This initializes the components of the JFormDesigner panel. This function is automatically generated by JFormDesigner from the JFD form design file, and should not be modified by hand. This function can be modified, if needed, by using JFormDesigner.
[ "initComponents", "This", "initializes", "the", "components", "of", "the", "JFormDesigner", "panel", ".", "This", "function", "is", "automatically", "generated", "by", "JFormDesigner", "from", "the", "JFD", "form", "design", "file", "and", "should", "not", "be", ...
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/components/TimePicker.java#L1114-L1176
azkaban/azkaban
azkaban-web-server/src/main/java/azkaban/webapp/servlet/AbstractAzkabanServlet.java
AbstractAzkabanServlet.setErrorMessageInCookie
protected void setErrorMessageInCookie(final HttpServletResponse response, final String errorMsg) { final Cookie cookie = new Cookie(AZKABAN_FAILURE_MESSAGE, errorMsg); cookie.setPath("/"); response.addCookie(cookie); }
java
protected void setErrorMessageInCookie(final HttpServletResponse response, final String errorMsg) { final Cookie cookie = new Cookie(AZKABAN_FAILURE_MESSAGE, errorMsg); cookie.setPath("/"); response.addCookie(cookie); }
[ "protected", "void", "setErrorMessageInCookie", "(", "final", "HttpServletResponse", "response", ",", "final", "String", "errorMsg", ")", "{", "final", "Cookie", "cookie", "=", "new", "Cookie", "(", "AZKABAN_FAILURE_MESSAGE", ",", "errorMsg", ")", ";", "cookie", "...
Sets an error message in azkaban.failure.message in the cookie. This will be used by the web client javascript to somehow display the message
[ "Sets", "an", "error", "message", "in", "azkaban", ".", "failure", ".", "message", "in", "the", "cookie", ".", "This", "will", "be", "used", "by", "the", "web", "client", "javascript", "to", "somehow", "display", "the", "message" ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-web-server/src/main/java/azkaban/webapp/servlet/AbstractAzkabanServlet.java#L197-L202
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java
CommonOps_DDRM.diagR
public static DMatrixRMaj diagR(int numRows , int numCols , double ...diagEl ) { DMatrixRMaj ret = new DMatrixRMaj(numRows,numCols); int o = Math.min(numRows,numCols); for( int i = 0; i < o; i++ ) { ret.set(i, i, diagEl[i]); } return ret; }
java
public static DMatrixRMaj diagR(int numRows , int numCols , double ...diagEl ) { DMatrixRMaj ret = new DMatrixRMaj(numRows,numCols); int o = Math.min(numRows,numCols); for( int i = 0; i < o; i++ ) { ret.set(i, i, diagEl[i]); } return ret; }
[ "public", "static", "DMatrixRMaj", "diagR", "(", "int", "numRows", ",", "int", "numCols", ",", "double", "...", "diagEl", ")", "{", "DMatrixRMaj", "ret", "=", "new", "DMatrixRMaj", "(", "numRows", ",", "numCols", ")", ";", "int", "o", "=", "Math", ".", ...
<p> Creates a new rectangular matrix whose diagonal elements are specified by diagEl and all the other elements are zero.<br> <br> a<sub>ij</sub> = 0 if i &le; j<br> a<sub>ij</sub> = diag[i] if i = j<br> </p> @see #diag @param numRows Number of rows in the matrix. @param numCols Number of columns in the matrix. @param diagEl Contains the values of the diagonal elements of the resulting matrix. @return A new matrix.
[ "<p", ">", "Creates", "a", "new", "rectangular", "matrix", "whose", "diagonal", "elements", "are", "specified", "by", "diagEl", "and", "all", "the", "other", "elements", "are", "zero", ".", "<br", ">", "<br", ">", "a<sub", ">", "ij<", "/", "sub", ">", ...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L1056-L1067
Samsung/GearVRf
GVRf/Extensions/3DCursor/IODevices/gearwear/GearWearIoDevice/src/main/java/com/gearvrf/io/gearwear/GearWearableDevice.java
GearWearableDevice.isInMiddleCircle
private boolean isInMiddleCircle(float x, float y) { return GearWearableUtility.isInCircle(x, y, CENTER_X, CENTER_Y, MIDDLE_RADIUS); }
java
private boolean isInMiddleCircle(float x, float y) { return GearWearableUtility.isInCircle(x, y, CENTER_X, CENTER_Y, MIDDLE_RADIUS); }
[ "private", "boolean", "isInMiddleCircle", "(", "float", "x", ",", "float", "y", ")", "{", "return", "GearWearableUtility", ".", "isInCircle", "(", "x", ",", "y", ",", "CENTER_X", ",", "CENTER_Y", ",", "MIDDLE_RADIUS", ")", ";", "}" ]
Check if position is in middle circle (press region) @param x x position @param y y position @return true if in middle circle, false otherwise
[ "Check", "if", "position", "is", "in", "middle", "circle", "(", "press", "region", ")" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/3DCursor/IODevices/gearwear/GearWearIoDevice/src/main/java/com/gearvrf/io/gearwear/GearWearableDevice.java#L628-L630
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassSplitPaneDivider.java
SeaGlassSplitPaneDivider.createRightOneTouchButton
protected JButton createRightOneTouchButton() { SeaGlassArrowButton b = new SeaGlassArrowButton(SwingConstants.NORTH); int oneTouchSize = lookupOneTouchSize(); b.setName("SplitPaneDivider.rightOneTouchButton"); b.setMinimumSize(new Dimension(oneTouchSize, oneTouchSize)); // Rossi: Change cursors on "one touch" buttons. Better would be an mouse over effect b.setCursor(Cursor.getPredefinedCursor( splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT ? Cursor.E_RESIZE_CURSOR:Cursor.S_RESIZE_CURSOR)); b.setFocusPainted(false); b.setBorderPainted(false); b.setRequestFocusEnabled(false); b.setDirection(mapDirection(false)); return b; }
java
protected JButton createRightOneTouchButton() { SeaGlassArrowButton b = new SeaGlassArrowButton(SwingConstants.NORTH); int oneTouchSize = lookupOneTouchSize(); b.setName("SplitPaneDivider.rightOneTouchButton"); b.setMinimumSize(new Dimension(oneTouchSize, oneTouchSize)); // Rossi: Change cursors on "one touch" buttons. Better would be an mouse over effect b.setCursor(Cursor.getPredefinedCursor( splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT ? Cursor.E_RESIZE_CURSOR:Cursor.S_RESIZE_CURSOR)); b.setFocusPainted(false); b.setBorderPainted(false); b.setRequestFocusEnabled(false); b.setDirection(mapDirection(false)); return b; }
[ "protected", "JButton", "createRightOneTouchButton", "(", ")", "{", "SeaGlassArrowButton", "b", "=", "new", "SeaGlassArrowButton", "(", "SwingConstants", ".", "NORTH", ")", ";", "int", "oneTouchSize", "=", "lookupOneTouchSize", "(", ")", ";", "b", ".", "setName", ...
Creates and return an instance of JButton that can be used to collapse the right component in the split pane. @return a one-touch button
[ "Creates", "and", "return", "an", "instance", "of", "JButton", "that", "can", "be", "used", "to", "collapse", "the", "right", "component", "in", "the", "split", "pane", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassSplitPaneDivider.java#L213-L230
facebookarchive/hadoop-20
src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/HadoopLocationWizard.java
HadoopLocationWizard.createConfLabelText
private Text createConfLabelText(ModifyListener listener, Composite parent, ConfProp prop, String labelText) { Label label = new Label(parent, SWT.NONE); if (labelText == null) labelText = prop.name; label.setText(labelText); return createConfText(listener, parent, prop); }
java
private Text createConfLabelText(ModifyListener listener, Composite parent, ConfProp prop, String labelText) { Label label = new Label(parent, SWT.NONE); if (labelText == null) labelText = prop.name; label.setText(labelText); return createConfText(listener, parent, prop); }
[ "private", "Text", "createConfLabelText", "(", "ModifyListener", "listener", ",", "Composite", "parent", ",", "ConfProp", "prop", ",", "String", "labelText", ")", "{", "Label", "label", "=", "new", "Label", "(", "parent", ",", "SWT", ".", "NONE", ")", ";", ...
Create editor entry for the given configuration property. The editor is a couple (Label, Text). @param listener the listener to trigger on property change @param parent the SWT parent container @param prop the property to create an editor for @param labelText a label (null will defaults to the property name) @return a SWT Text field
[ "Create", "editor", "entry", "for", "the", "given", "configuration", "property", ".", "The", "editor", "is", "a", "couple", "(", "Label", "Text", ")", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/HadoopLocationWizard.java#L541-L550
alkacon/opencms-core
src/org/opencms/xml/content/CmsXmlContent.java
CmsXmlContent.hasChoiceOptions
public boolean hasChoiceOptions(String xpath, Locale locale) { List<I_CmsXmlSchemaType> options = getChoiceOptions(xpath, locale); if ((options == null) || (options.size() <= 1)) { return false; } return true; }
java
public boolean hasChoiceOptions(String xpath, Locale locale) { List<I_CmsXmlSchemaType> options = getChoiceOptions(xpath, locale); if ((options == null) || (options.size() <= 1)) { return false; } return true; }
[ "public", "boolean", "hasChoiceOptions", "(", "String", "xpath", ",", "Locale", "locale", ")", "{", "List", "<", "I_CmsXmlSchemaType", ">", "options", "=", "getChoiceOptions", "(", "xpath", ",", "locale", ")", ";", "if", "(", "(", "options", "==", "null", ...
Returns <code>true</code> if choice options exist for the given xpath in the selected locale.<p> In case the xpath does not select a nested choice content definition, or in case the xpath does not exist at all, <code>false</code> is returned.<p> @param xpath the xpath to check the choice options for @param locale the locale to check @return <code>true</code> if choice options exist for the given xpath in the selected locale
[ "Returns", "<code", ">", "true<", "/", "code", ">", "if", "choice", "options", "exist", "for", "the", "given", "xpath", "in", "the", "selected", "locale", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsXmlContent.java#L660-L667
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/subsystem/FeatureRepository.java
FeatureRepository.setInstalledFeatures
public void setInstalledFeatures(Set<String> newInstalledFeatures, Set<String> newConfiguredFeatures, boolean configurationError) { Set<String> current = installedFeatures; if (!current.equals(newInstalledFeatures)) { isDirty = true; } if (newInstalledFeatures.isEmpty()) installedFeatures = Collections.emptySet(); else installedFeatures = Collections.unmodifiableSet(new HashSet<String>(newInstalledFeatures)); current = configuredFeatures; if (!current.equals(newConfiguredFeatures)) { isDirty = true; } if (newConfiguredFeatures.isEmpty()) configuredFeatures = Collections.emptySet(); else configuredFeatures = Collections.unmodifiableSet(new HashSet<String>(newConfiguredFeatures)); this.configurationError = configurationError; }
java
public void setInstalledFeatures(Set<String> newInstalledFeatures, Set<String> newConfiguredFeatures, boolean configurationError) { Set<String> current = installedFeatures; if (!current.equals(newInstalledFeatures)) { isDirty = true; } if (newInstalledFeatures.isEmpty()) installedFeatures = Collections.emptySet(); else installedFeatures = Collections.unmodifiableSet(new HashSet<String>(newInstalledFeatures)); current = configuredFeatures; if (!current.equals(newConfiguredFeatures)) { isDirty = true; } if (newConfiguredFeatures.isEmpty()) configuredFeatures = Collections.emptySet(); else configuredFeatures = Collections.unmodifiableSet(new HashSet<String>(newConfiguredFeatures)); this.configurationError = configurationError; }
[ "public", "void", "setInstalledFeatures", "(", "Set", "<", "String", ">", "newInstalledFeatures", ",", "Set", "<", "String", ">", "newConfiguredFeatures", ",", "boolean", "configurationError", ")", "{", "Set", "<", "String", ">", "current", "=", "installedFeatures...
Change the active list of installed features @param newInstalledFeatures new set of installed features. Replaces the previous set.
[ "Change", "the", "active", "list", "of", "installed", "features" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/subsystem/FeatureRepository.java#L528-L548
BorderTech/wcomponents
wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WLabelExample.java
WLabelExample.addNestedFieldExamples
private void addNestedFieldExamples() { add(new WHeading(HeadingLevel.H2, "Label nesting which is technically OK")); /* Just because it is OK to do this does not mean you should! So these "examples" have far fewer comments. */ WPanel errorLayoutPanel = new WPanel(); errorLayoutPanel.setLayout(new FlowLayout(FlowLayout.VERTICAL, Size.LARGE)); errorLayoutPanel.setMargin(new Margin(null, null, Size.XL, null)); add(errorLayoutPanel); errorLayoutPanel.add(new ExplanatoryText("This example shows WLabels with a single nested simple form control WTextField." + " This is not a contravention of the HTML specification but you should not do it.")); WLabel outerLabel = new WLabel("Label with nested WTextField and not 'for' anything"); errorLayoutPanel.add(outerLabel); outerLabel.add(new WTextField()); WTextField innerField = new WTextField(); outerLabel = new WLabel("Label 'for' nested WTextField", innerField); errorLayoutPanel.add(outerLabel); outerLabel.add(innerField); }
java
private void addNestedFieldExamples() { add(new WHeading(HeadingLevel.H2, "Label nesting which is technically OK")); /* Just because it is OK to do this does not mean you should! So these "examples" have far fewer comments. */ WPanel errorLayoutPanel = new WPanel(); errorLayoutPanel.setLayout(new FlowLayout(FlowLayout.VERTICAL, Size.LARGE)); errorLayoutPanel.setMargin(new Margin(null, null, Size.XL, null)); add(errorLayoutPanel); errorLayoutPanel.add(new ExplanatoryText("This example shows WLabels with a single nested simple form control WTextField." + " This is not a contravention of the HTML specification but you should not do it.")); WLabel outerLabel = new WLabel("Label with nested WTextField and not 'for' anything"); errorLayoutPanel.add(outerLabel); outerLabel.add(new WTextField()); WTextField innerField = new WTextField(); outerLabel = new WLabel("Label 'for' nested WTextField", innerField); errorLayoutPanel.add(outerLabel); outerLabel.add(innerField); }
[ "private", "void", "addNestedFieldExamples", "(", ")", "{", "add", "(", "new", "WHeading", "(", "HeadingLevel", ".", "H2", ",", "\"Label nesting which is technically OK\"", ")", ")", ";", "/* Just because it is OK to do this does not mean you should! So these \"examples\" have ...
Examples showing WLabel with a nested input control WComponent. This is VERY dangerous as only a very few WComponents are valid for this scenario. If you go down this route: stop!! These are really here for framework testing, not as examples as to how to do things.
[ "Examples", "showing", "WLabel", "with", "a", "nested", "input", "control", "WComponent", ".", "This", "is", "VERY", "dangerous", "as", "only", "a", "very", "few", "WComponents", "are", "valid", "for", "this", "scenario", ".", "If", "you", "go", "down", "t...
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WLabelExample.java#L181-L197
UrielCh/ovh-java-sdk
ovh-java-sdk-caasregistry/src/main/java/net/minidev/ovh/api/ApiOvhCaasregistry.java
ApiOvhCaasregistry.serviceName_namespaces_namespaceId_images_imageId_PUT
public OvhImage serviceName_namespaces_namespaceId_images_imageId_PUT(String serviceName, String namespaceId, String imageId, OvhInputImage body) throws IOException { String qPath = "/caas/registry/{serviceName}/namespaces/{namespaceId}/images/{imageId}"; StringBuilder sb = path(qPath, serviceName, namespaceId, imageId); String resp = exec(qPath, "PUT", sb.toString(), body); return convertTo(resp, OvhImage.class); }
java
public OvhImage serviceName_namespaces_namespaceId_images_imageId_PUT(String serviceName, String namespaceId, String imageId, OvhInputImage body) throws IOException { String qPath = "/caas/registry/{serviceName}/namespaces/{namespaceId}/images/{imageId}"; StringBuilder sb = path(qPath, serviceName, namespaceId, imageId); String resp = exec(qPath, "PUT", sb.toString(), body); return convertTo(resp, OvhImage.class); }
[ "public", "OvhImage", "serviceName_namespaces_namespaceId_images_imageId_PUT", "(", "String", "serviceName", ",", "String", "namespaceId", ",", "String", "imageId", ",", "OvhInputImage", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/caas/registry/...
Update image REST: PUT /caas/registry/{serviceName}/namespaces/{namespaceId}/images/{imageId} @param body [required] A container image @param imageId [required] Image id @param namespaceId [required] Namespace id @param serviceName [required] Service name API beta
[ "Update", "image" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-caasregistry/src/main/java/net/minidev/ovh/api/ApiOvhCaasregistry.java#L286-L291
zamrokk/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/shim/ChaincodeStub.java
ChaincodeStub.invokeRawChaincode
public ByteString invokeRawChaincode(String chaincodeName, String function, List<ByteString> args) { return handler.handleInvokeChaincode(chaincodeName, function, args, uuid); }
java
public ByteString invokeRawChaincode(String chaincodeName, String function, List<ByteString> args) { return handler.handleInvokeChaincode(chaincodeName, function, args, uuid); }
[ "public", "ByteString", "invokeRawChaincode", "(", "String", "chaincodeName", ",", "String", "function", ",", "List", "<", "ByteString", ">", "args", ")", "{", "return", "handler", ".", "handleInvokeChaincode", "(", "chaincodeName", ",", "function", ",", "args", ...
Invokes the provided chaincode with the given function and arguments, and returns the raw ByteString value that invocation generated. @param chaincodeName The name of the chaincode to invoke @param function the function parameter to pass to the chaincode @param args the arguments to be provided in the chaincode call @return the value returned by the chaincode call
[ "Invokes", "the", "provided", "chaincode", "with", "the", "given", "function", "and", "arguments", "and", "returns", "the", "raw", "ByteString", "value", "that", "invocation", "generated", "." ]
train
https://github.com/zamrokk/fabric-sdk-java/blob/d4993ca602f72d412cd682e1b92e805e48b27afa/src/main/java/org/hyperledger/fabric/sdk/shim/ChaincodeStub.java#L185-L187
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/LinkedList.java
LinkedList.addAll
public boolean addAll(int index, Collection<? extends E> c) { checkPositionIndex(index); Object[] a = c.toArray(); int numNew = a.length; if (numNew == 0) return false; Node<E> pred, succ; if (index == size) { succ = null; pred = last; } else { succ = node(index); pred = succ.prev; } for (Object o : a) { @SuppressWarnings("unchecked") E e = (E) o; Node<E> newNode = new Node<>(pred, e, null); if (pred == null) first = newNode; else pred.next = newNode; pred = newNode; } if (succ == null) { last = pred; } else { pred.next = succ; succ.prev = pred; } size += numNew; modCount++; return true; }
java
public boolean addAll(int index, Collection<? extends E> c) { checkPositionIndex(index); Object[] a = c.toArray(); int numNew = a.length; if (numNew == 0) return false; Node<E> pred, succ; if (index == size) { succ = null; pred = last; } else { succ = node(index); pred = succ.prev; } for (Object o : a) { @SuppressWarnings("unchecked") E e = (E) o; Node<E> newNode = new Node<>(pred, e, null); if (pred == null) first = newNode; else pred.next = newNode; pred = newNode; } if (succ == null) { last = pred; } else { pred.next = succ; succ.prev = pred; } size += numNew; modCount++; return true; }
[ "public", "boolean", "addAll", "(", "int", "index", ",", "Collection", "<", "?", "extends", "E", ">", "c", ")", "{", "checkPositionIndex", "(", "index", ")", ";", "Object", "[", "]", "a", "=", "c", ".", "toArray", "(", ")", ";", "int", "numNew", "=...
Inserts all of the elements in the specified collection into this list, starting at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the list in the order that they are returned by the specified collection's iterator. @param index index at which to insert the first element from the specified collection @param c collection containing elements to be added to this list @return {@code true} if this list changed as a result of the call @throws IndexOutOfBoundsException {@inheritDoc} @throws NullPointerException if the specified collection is null
[ "Inserts", "all", "of", "the", "elements", "in", "the", "specified", "collection", "into", "this", "list", "starting", "at", "the", "specified", "position", ".", "Shifts", "the", "element", "currently", "at", "that", "position", "(", "if", "any", ")", "and",...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/LinkedList.java#L407-L444
xwiki/xwiki-commons
xwiki-commons-tools/xwiki-commons-tool-xar/xwiki-commons-tool-xar-plugin/src/main/java/org/xwiki/tool/xar/UnXARMojo.java
UnXARMojo.unpackDependentXars
protected void unpackDependentXars(Artifact artifact) throws MojoExecutionException { try { Set<Artifact> dependencies = resolveArtifactDependencies(artifact); for (Artifact dependency : dependencies) { unpack(dependency.getFile(), this.outputDirectory, "XAR Plugin", false, getIncludes(), getExcludes()); } } catch (Exception e) { throw new MojoExecutionException(String.format("Failed to unpack artifact [%s] dependencies", artifact), e); } }
java
protected void unpackDependentXars(Artifact artifact) throws MojoExecutionException { try { Set<Artifact> dependencies = resolveArtifactDependencies(artifact); for (Artifact dependency : dependencies) { unpack(dependency.getFile(), this.outputDirectory, "XAR Plugin", false, getIncludes(), getExcludes()); } } catch (Exception e) { throw new MojoExecutionException(String.format("Failed to unpack artifact [%s] dependencies", artifact), e); } }
[ "protected", "void", "unpackDependentXars", "(", "Artifact", "artifact", ")", "throws", "MojoExecutionException", "{", "try", "{", "Set", "<", "Artifact", ">", "dependencies", "=", "resolveArtifactDependencies", "(", "artifact", ")", ";", "for", "(", "Artifact", "...
Unpack xar dependencies of the provided artifact. @throws MojoExecutionException error when unpack dependencies.
[ "Unpack", "xar", "dependencies", "of", "the", "provided", "artifact", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-tools/xwiki-commons-tool-xar/xwiki-commons-tool-xar-plugin/src/main/java/org/xwiki/tool/xar/UnXARMojo.java#L125-L135
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java
VirtualMachineScaleSetsInner.beginUpdateAsync
public Observable<VirtualMachineScaleSetInner> beginUpdateAsync(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, parameters).map(new Func1<ServiceResponse<VirtualMachineScaleSetInner>, VirtualMachineScaleSetInner>() { @Override public VirtualMachineScaleSetInner call(ServiceResponse<VirtualMachineScaleSetInner> response) { return response.body(); } }); }
java
public Observable<VirtualMachineScaleSetInner> beginUpdateAsync(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, parameters).map(new Func1<ServiceResponse<VirtualMachineScaleSetInner>, VirtualMachineScaleSetInner>() { @Override public VirtualMachineScaleSetInner call(ServiceResponse<VirtualMachineScaleSetInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualMachineScaleSetInner", ">", "beginUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "vmScaleSetName", ",", "VirtualMachineScaleSetUpdate", "parameters", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "resour...
Update a VM scale set. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set to create or update. @param parameters The scale set object. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualMachineScaleSetInner object
[ "Update", "a", "VM", "scale", "set", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java#L481-L488
RestComm/sip-servlets
containers/sip-servlets-as10/src/main/java/org/mobicents/servlet/sip/undertow/security/authentication/SipDigestAuthenticationMechanism.java
SipDigestAuthenticationMechanism.removeQuotes
protected static String removeQuotes(String quotedString, boolean quotesRequired) { // support both quoted and non-quoted if (quotedString.length() > 0 && quotedString.charAt(0) != '"' && !quotesRequired) { return quotedString; } else if (quotedString.length() > 2) { return quotedString.substring(1, quotedString.length() - 1); } else { return ""; } }
java
protected static String removeQuotes(String quotedString, boolean quotesRequired) { // support both quoted and non-quoted if (quotedString.length() > 0 && quotedString.charAt(0) != '"' && !quotesRequired) { return quotedString; } else if (quotedString.length() > 2) { return quotedString.substring(1, quotedString.length() - 1); } else { return ""; } }
[ "protected", "static", "String", "removeQuotes", "(", "String", "quotedString", ",", "boolean", "quotesRequired", ")", "{", "// support both quoted and non-quoted", "if", "(", "quotedString", ".", "length", "(", ")", ">", "0", "&&", "quotedString", ".", "charAt", ...
Removes the quotes on a string. RFC2617 states quotes are optional for all parameters except realm.
[ "Removes", "the", "quotes", "on", "a", "string", ".", "RFC2617", "states", "quotes", "are", "optional", "for", "all", "parameters", "except", "realm", "." ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/containers/sip-servlets-as10/src/main/java/org/mobicents/servlet/sip/undertow/security/authentication/SipDigestAuthenticationMechanism.java#L549-L558
JOML-CI/JOML
src/org/joml/Matrix4d.java
Matrix4d.billboardSpherical
public Matrix4d billboardSpherical(Vector3dc objPos, Vector3dc targetPos) { double toDirX = targetPos.x() - objPos.x(); double toDirY = targetPos.y() - objPos.y(); double toDirZ = targetPos.z() - objPos.z(); double x = -toDirY; double y = toDirX; double w = Math.sqrt(toDirX * toDirX + toDirY * toDirY + toDirZ * toDirZ) + toDirZ; double invNorm = 1.0 / Math.sqrt(x * x + y * y + w * w); x *= invNorm; y *= invNorm; w *= invNorm; double q00 = (x + x) * x; double q11 = (y + y) * y; double q01 = (x + x) * y; double q03 = (x + x) * w; double q13 = (y + y) * w; m00 = 1.0 - q11; m01 = q01; m02 = -q13; m03 = 0.0; m10 = q01; m11 = 1.0 - q00; m12 = q03; m13 = 0.0; m20 = q13; m21 = -q03; m22 = 1.0 - q11 - q00; m23 = 0.0; m30 = objPos.x(); m31 = objPos.y(); m32 = objPos.z(); m33 = 1.0; properties = PROPERTY_AFFINE | PROPERTY_ORTHONORMAL; return this; }
java
public Matrix4d billboardSpherical(Vector3dc objPos, Vector3dc targetPos) { double toDirX = targetPos.x() - objPos.x(); double toDirY = targetPos.y() - objPos.y(); double toDirZ = targetPos.z() - objPos.z(); double x = -toDirY; double y = toDirX; double w = Math.sqrt(toDirX * toDirX + toDirY * toDirY + toDirZ * toDirZ) + toDirZ; double invNorm = 1.0 / Math.sqrt(x * x + y * y + w * w); x *= invNorm; y *= invNorm; w *= invNorm; double q00 = (x + x) * x; double q11 = (y + y) * y; double q01 = (x + x) * y; double q03 = (x + x) * w; double q13 = (y + y) * w; m00 = 1.0 - q11; m01 = q01; m02 = -q13; m03 = 0.0; m10 = q01; m11 = 1.0 - q00; m12 = q03; m13 = 0.0; m20 = q13; m21 = -q03; m22 = 1.0 - q11 - q00; m23 = 0.0; m30 = objPos.x(); m31 = objPos.y(); m32 = objPos.z(); m33 = 1.0; properties = PROPERTY_AFFINE | PROPERTY_ORTHONORMAL; return this; }
[ "public", "Matrix4d", "billboardSpherical", "(", "Vector3dc", "objPos", ",", "Vector3dc", "targetPos", ")", "{", "double", "toDirX", "=", "targetPos", ".", "x", "(", ")", "-", "objPos", ".", "x", "(", ")", ";", "double", "toDirY", "=", "targetPos", ".", ...
Set this matrix to a spherical billboard transformation that rotates the local +Z axis of a given object with position <code>objPos</code> towards a target position at <code>targetPos</code> using a shortest arc rotation by not preserving any <i>up</i> vector of the object. <p> This method can be used to create the complete model transformation for a given object, including the translation of the object to its position <code>objPos</code>. <p> In order to specify an <i>up</i> vector which needs to be maintained when rotating the +Z axis of the object, use {@link #billboardSpherical(Vector3dc, Vector3dc, Vector3dc)}. @see #billboardSpherical(Vector3dc, Vector3dc, Vector3dc) @param objPos the position of the object to rotate towards <code>targetPos</code> @param targetPos the position of the target (for example the camera) towards which to rotate the object @return this
[ "Set", "this", "matrix", "to", "a", "spherical", "billboard", "transformation", "that", "rotates", "the", "local", "+", "Z", "axis", "of", "a", "given", "object", "with", "position", "<code", ">", "objPos<", "/", "code", ">", "towards", "a", "target", "pos...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L14387-L14421
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPP8Reader.java
MPP8Reader.setTaskNotes
private void setTaskNotes(Task task, byte[] data, ExtendedData taskExtData, FixDeferFix taskVarData) { String notes = taskExtData.getString(TASK_NOTES); if (notes == null && data.length == 366) { byte[] offsetData = taskVarData.getByteArray(getOffset(data, 362)); if (offsetData != null && offsetData.length >= 12) { notes = taskVarData.getString(getOffset(offsetData, 8)); // We do pick up some random stuff with this approach, and // we don't know enough about the file format to know when to ignore it // so we'll use a heuristic here to ignore anything that // doesn't look like RTF. if (notes != null && notes.indexOf('{') == -1) { notes = null; } } } if (notes != null) { if (m_reader.getPreserveNoteFormatting() == false) { notes = RtfHelper.strip(notes); } task.setNotes(notes); } }
java
private void setTaskNotes(Task task, byte[] data, ExtendedData taskExtData, FixDeferFix taskVarData) { String notes = taskExtData.getString(TASK_NOTES); if (notes == null && data.length == 366) { byte[] offsetData = taskVarData.getByteArray(getOffset(data, 362)); if (offsetData != null && offsetData.length >= 12) { notes = taskVarData.getString(getOffset(offsetData, 8)); // We do pick up some random stuff with this approach, and // we don't know enough about the file format to know when to ignore it // so we'll use a heuristic here to ignore anything that // doesn't look like RTF. if (notes != null && notes.indexOf('{') == -1) { notes = null; } } } if (notes != null) { if (m_reader.getPreserveNoteFormatting() == false) { notes = RtfHelper.strip(notes); } task.setNotes(notes); } }
[ "private", "void", "setTaskNotes", "(", "Task", "task", ",", "byte", "[", "]", "data", ",", "ExtendedData", "taskExtData", ",", "FixDeferFix", "taskVarData", ")", "{", "String", "notes", "=", "taskExtData", ".", "getString", "(", "TASK_NOTES", ")", ";", "if"...
There appear to be two ways of representing task notes in an MPP8 file. This method tries to determine which has been used. @param task task @param data task data @param taskExtData extended task data @param taskVarData task var data
[ "There", "appear", "to", "be", "two", "ways", "of", "representing", "task", "notes", "in", "an", "MPP8", "file", ".", "This", "method", "tries", "to", "determine", "which", "has", "been", "used", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP8Reader.java#L742-L772
logic-ng/LogicNG
src/main/java/org/logicng/backbones/BackboneGeneration.java
BackboneGeneration.computeNegative
public static Backbone computeNegative(final Formula formula) { return compute(formula, formula.variables(), BackboneType.ONLY_NEGATIVE); }
java
public static Backbone computeNegative(final Formula formula) { return compute(formula, formula.variables(), BackboneType.ONLY_NEGATIVE); }
[ "public", "static", "Backbone", "computeNegative", "(", "final", "Formula", "formula", ")", "{", "return", "compute", "(", "formula", ",", "formula", ".", "variables", "(", ")", ",", "BackboneType", ".", "ONLY_NEGATIVE", ")", ";", "}" ]
Computes the negative backbone variables for a given formula. @param formula the given formula @return the negative backbone or {@code null} if the formula is UNSAT
[ "Computes", "the", "negative", "backbone", "variables", "for", "a", "given", "formula", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/backbones/BackboneGeneration.java#L230-L232
Azure/azure-sdk-for-java
postgresql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/postgresql/v2017_12_01/implementation/VirtualNetworkRulesInner.java
VirtualNetworkRulesInner.listByServerAsync
public Observable<Page<VirtualNetworkRuleInner>> listByServerAsync(final String resourceGroupName, final String serverName) { return listByServerWithServiceResponseAsync(resourceGroupName, serverName) .map(new Func1<ServiceResponse<Page<VirtualNetworkRuleInner>>, Page<VirtualNetworkRuleInner>>() { @Override public Page<VirtualNetworkRuleInner> call(ServiceResponse<Page<VirtualNetworkRuleInner>> response) { return response.body(); } }); }
java
public Observable<Page<VirtualNetworkRuleInner>> listByServerAsync(final String resourceGroupName, final String serverName) { return listByServerWithServiceResponseAsync(resourceGroupName, serverName) .map(new Func1<ServiceResponse<Page<VirtualNetworkRuleInner>>, Page<VirtualNetworkRuleInner>>() { @Override public Page<VirtualNetworkRuleInner> call(ServiceResponse<Page<VirtualNetworkRuleInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "VirtualNetworkRuleInner", ">", ">", "listByServerAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "serverName", ")", "{", "return", "listByServerWithServiceResponseAsync", "(", "resourceGroupName", "...
Gets a list of virtual network rules in a server. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;VirtualNetworkRuleInner&gt; object
[ "Gets", "a", "list", "of", "virtual", "network", "rules", "in", "a", "server", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/postgresql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/postgresql/v2017_12_01/implementation/VirtualNetworkRulesInner.java#L592-L600
looly/hutool
hutool-db/src/main/java/cn/hutool/db/DbUtil.java
DbUtil.setShowSqlGlobal
public static void setShowSqlGlobal(boolean isShowSql, boolean isFormatSql, boolean isShowParams, Level level) { SqlLog.INSTASNCE.init(isShowSql, isFormatSql, isShowParams, level); }
java
public static void setShowSqlGlobal(boolean isShowSql, boolean isFormatSql, boolean isShowParams, Level level) { SqlLog.INSTASNCE.init(isShowSql, isFormatSql, isShowParams, level); }
[ "public", "static", "void", "setShowSqlGlobal", "(", "boolean", "isShowSql", ",", "boolean", "isFormatSql", ",", "boolean", "isShowParams", ",", "Level", "level", ")", "{", "SqlLog", ".", "INSTASNCE", ".", "init", "(", "isShowSql", ",", "isFormatSql", ",", "is...
设置全局配置:是否通过debug日志显示SQL @param isShowSql 是否显示SQL @param isFormatSql 是否格式化显示的SQL @param isShowParams 是否打印参数 @param level SQL打印到的日志等级 @since 4.1.7
[ "设置全局配置:是否通过debug日志显示SQL" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/DbUtil.java#L259-L261
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java
VMath.setMatrix
public static void setMatrix(final double[][] m1, final int r0, final int r1, final int c0, final int c1, final double[][] m2) { assert r0 <= r1 && c0 <= c1 : ERR_INVALID_RANGE; assert r1 <= m1.length && c1 <= m1[0].length : ERR_MATRIX_DIMENSIONS; final int coldim = c1 - c0; for(int i = r0; i < r1; i++) { System.arraycopy(m2[i - r0], 0, m1[i], c0, coldim); } }
java
public static void setMatrix(final double[][] m1, final int r0, final int r1, final int c0, final int c1, final double[][] m2) { assert r0 <= r1 && c0 <= c1 : ERR_INVALID_RANGE; assert r1 <= m1.length && c1 <= m1[0].length : ERR_MATRIX_DIMENSIONS; final int coldim = c1 - c0; for(int i = r0; i < r1; i++) { System.arraycopy(m2[i - r0], 0, m1[i], c0, coldim); } }
[ "public", "static", "void", "setMatrix", "(", "final", "double", "[", "]", "[", "]", "m1", ",", "final", "int", "r0", ",", "final", "int", "r1", ",", "final", "int", "c0", ",", "final", "int", "c1", ",", "final", "double", "[", "]", "[", "]", "m2...
Set a submatrix. @param m1 Original matrix @param r0 Initial row index @param r1 Final row index (exclusive) @param c0 Initial column index @param c1 Final column index (exclusive) @param m2 New values for m1(r0:r1-1,c0:c1-1)
[ "Set", "a", "submatrix", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L997-L1004
OpenLiberty/open-liberty
dev/com.ibm.ws.org.apache.cxf.cxf.core.3.2/src/org/apache/cxf/staxutils/StaxUtils.java
StaxUtils.writeElement
public static void writeElement(Element e, XMLStreamWriter writer, boolean repairing) throws XMLStreamException { writeElement(e, writer, repairing, true); }
java
public static void writeElement(Element e, XMLStreamWriter writer, boolean repairing) throws XMLStreamException { writeElement(e, writer, repairing, true); }
[ "public", "static", "void", "writeElement", "(", "Element", "e", ",", "XMLStreamWriter", "writer", ",", "boolean", "repairing", ")", "throws", "XMLStreamException", "{", "writeElement", "(", "e", ",", "writer", ",", "repairing", ",", "true", ")", ";", "}" ]
Writes an Element to an XMLStreamWriter. The writer must already have started the document (via writeStartDocument()). Also, this probably won't work with just a fragment of a document. The Element should be the root element of the document. @param e @param writer @throws XMLStreamException
[ "Writes", "an", "Element", "to", "an", "XMLStreamWriter", ".", "The", "writer", "must", "already", "have", "started", "the", "document", "(", "via", "writeStartDocument", "()", ")", ".", "Also", "this", "probably", "won", "t", "work", "with", "just", "a", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.core.3.2/src/org/apache/cxf/staxutils/StaxUtils.java#L948-L951
Azure/azure-sdk-for-java
sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java
InstanceFailoverGroupsInner.beginFailoverAsync
public Observable<InstanceFailoverGroupInner> beginFailoverAsync(String resourceGroupName, String locationName, String failoverGroupName) { return beginFailoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1<ServiceResponse<InstanceFailoverGroupInner>, InstanceFailoverGroupInner>() { @Override public InstanceFailoverGroupInner call(ServiceResponse<InstanceFailoverGroupInner> response) { return response.body(); } }); }
java
public Observable<InstanceFailoverGroupInner> beginFailoverAsync(String resourceGroupName, String locationName, String failoverGroupName) { return beginFailoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1<ServiceResponse<InstanceFailoverGroupInner>, InstanceFailoverGroupInner>() { @Override public InstanceFailoverGroupInner call(ServiceResponse<InstanceFailoverGroupInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "InstanceFailoverGroupInner", ">", "beginFailoverAsync", "(", "String", "resourceGroupName", ",", "String", "locationName", ",", "String", "failoverGroupName", ")", "{", "return", "beginFailoverWithServiceResponseAsync", "(", "resourceGroupName", ...
Fails over from the current primary managed instance to this managed instance. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param locationName The name of the region where the resource is located. @param failoverGroupName The name of the failover group. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the InstanceFailoverGroupInner object
[ "Fails", "over", "from", "the", "current", "primary", "managed", "instance", "to", "this", "managed", "instance", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java#L797-L804
intive-FDV/DynamicJasper
src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java
DynamicReportBuilder.addAutoText
public DynamicReportBuilder addAutoText(String message, byte position, byte alignment) { HorizontalBandAlignment alignment_ = HorizontalBandAlignment.buildAligment(alignment); AutoText text = new AutoText(message, position, alignment_); text.setWidth(AutoText.WIDTH_NOT_SET); addAutoText(text); return this; }
java
public DynamicReportBuilder addAutoText(String message, byte position, byte alignment) { HorizontalBandAlignment alignment_ = HorizontalBandAlignment.buildAligment(alignment); AutoText text = new AutoText(message, position, alignment_); text.setWidth(AutoText.WIDTH_NOT_SET); addAutoText(text); return this; }
[ "public", "DynamicReportBuilder", "addAutoText", "(", "String", "message", ",", "byte", "position", ",", "byte", "alignment", ")", "{", "HorizontalBandAlignment", "alignment_", "=", "HorizontalBandAlignment", ".", "buildAligment", "(", "alignment", ")", ";", "AutoText...
Adds a custom fixed message (literal) in header or footer. The message width will be the page witdth<br> The parameters are all constants from the <code>ar.com.fdvs.dj.domain.AutoText</code> class <br> <br> @param message The text to show @param position POSITION_HEADER or POSITION_FOOTER @param alignment <br>ALIGMENT_LEFT <br> ALIGMENT_CENTER <br> ALIGMENT_RIGHT @return
[ "Adds", "a", "custom", "fixed", "message", "(", "literal", ")", "in", "header", "or", "footer", ".", "The", "message", "width", "will", "be", "the", "page", "witdth<br", ">", "The", "parameters", "are", "all", "constants", "from", "the", "<code", ">", "a...
train
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java#L200-L206
elki-project/elki
elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/strings/LevenshteinDistanceFunction.java
LevenshteinDistanceFunction.postfixLen
private static int postfixLen(String o1, String o2, int prefix) { int postfix = 0; int p1 = o1.length(), p2 = o2.length(); while(p1 > prefix && p2 > prefix && (o1.charAt(--p1) == o2.charAt(--p2))) { ++postfix; } return postfix; }
java
private static int postfixLen(String o1, String o2, int prefix) { int postfix = 0; int p1 = o1.length(), p2 = o2.length(); while(p1 > prefix && p2 > prefix && (o1.charAt(--p1) == o2.charAt(--p2))) { ++postfix; } return postfix; }
[ "private", "static", "int", "postfixLen", "(", "String", "o1", ",", "String", "o2", ",", "int", "prefix", ")", "{", "int", "postfix", "=", "0", ";", "int", "p1", "=", "o1", ".", "length", "(", ")", ",", "p2", "=", "o2", ".", "length", "(", ")", ...
Compute the postfix length. @param o1 First object @param o2 Second object @param prefix Known prefix length @return Postfix length
[ "Compute", "the", "postfix", "length", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/strings/LevenshteinDistanceFunction.java#L132-L139
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/StringUtils.java
StringUtils.equalsAny
public static boolean equalsAny(final CharSequence string, final CharSequence... searchStrings) { if (ArrayUtils.isNotEmpty(searchStrings)) { for (final CharSequence next : searchStrings) { if (equals(string, next)) { return true; } } } return false; }
java
public static boolean equalsAny(final CharSequence string, final CharSequence... searchStrings) { if (ArrayUtils.isNotEmpty(searchStrings)) { for (final CharSequence next : searchStrings) { if (equals(string, next)) { return true; } } } return false; }
[ "public", "static", "boolean", "equalsAny", "(", "final", "CharSequence", "string", ",", "final", "CharSequence", "...", "searchStrings", ")", "{", "if", "(", "ArrayUtils", ".", "isNotEmpty", "(", "searchStrings", ")", ")", "{", "for", "(", "final", "CharSeque...
<p>Compares given <code>string</code> to a CharSequences vararg of <code>searchStrings</code>, returning {@code true} if the <code>string</code> is equal to any of the <code>searchStrings</code>.</p> <pre> StringUtils.equalsAny(null, (CharSequence[]) null) = false StringUtils.equalsAny(null, null, null) = true StringUtils.equalsAny(null, "abc", "def") = false StringUtils.equalsAny("abc", null, "def") = false StringUtils.equalsAny("abc", "abc", "def") = true StringUtils.equalsAny("abc", "ABC", "DEF") = false </pre> @param string to compare, may be {@code null}. @param searchStrings a vararg of strings, may be {@code null}. @return {@code true} if the string is equal (case-sensitive) to any other element of <code>searchStrings</code>; {@code false} if <code>searchStrings</code> is null or contains no matches. @since 3.5
[ "<p", ">", "Compares", "given", "<code", ">", "string<", "/", "code", ">", "to", "a", "CharSequences", "vararg", "of", "<code", ">", "searchStrings<", "/", "code", ">", "returning", "{", "@code", "true", "}", "if", "the", "<code", ">", "string<", "/", ...
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L1243-L1252
google/error-prone
check_api/src/main/java/com/google/errorprone/apply/SourceFile.java
SourceFile.replaceChars
public void replaceChars(int startPosition, int endPosition, String replacement) { try { sourceBuilder.replace(startPosition, endPosition, replacement); } catch (StringIndexOutOfBoundsException e) { throw new IndexOutOfBoundsException( String.format( "Replacement cannot be made. Source file %s has length %d, requested start " + "position %d, requested end position %d, replacement %s", path, sourceBuilder.length(), startPosition, endPosition, replacement)); } }
java
public void replaceChars(int startPosition, int endPosition, String replacement) { try { sourceBuilder.replace(startPosition, endPosition, replacement); } catch (StringIndexOutOfBoundsException e) { throw new IndexOutOfBoundsException( String.format( "Replacement cannot be made. Source file %s has length %d, requested start " + "position %d, requested end position %d, replacement %s", path, sourceBuilder.length(), startPosition, endPosition, replacement)); } }
[ "public", "void", "replaceChars", "(", "int", "startPosition", ",", "int", "endPosition", ",", "String", "replacement", ")", "{", "try", "{", "sourceBuilder", ".", "replace", "(", "startPosition", ",", "endPosition", ",", "replacement", ")", ";", "}", "catch",...
Replace the source code between the start and end character positions with a new string. <p>This method uses the same conventions as {@link String#substring(int, int)} for its start and end parameters.
[ "Replace", "the", "source", "code", "between", "the", "start", "and", "end", "character", "positions", "with", "a", "new", "string", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/apply/SourceFile.java#L150-L160
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/factory/ComponentFactory.java
ComponentFactory.newComponentFeedbackPanel
public static ComponentFeedbackPanel newComponentFeedbackPanel(final String id, final Component filter) { final ComponentFeedbackPanel feedbackPanel = new ComponentFeedbackPanel(id, filter); feedbackPanel.setOutputMarkupId(true); return feedbackPanel; }
java
public static ComponentFeedbackPanel newComponentFeedbackPanel(final String id, final Component filter) { final ComponentFeedbackPanel feedbackPanel = new ComponentFeedbackPanel(id, filter); feedbackPanel.setOutputMarkupId(true); return feedbackPanel; }
[ "public", "static", "ComponentFeedbackPanel", "newComponentFeedbackPanel", "(", "final", "String", "id", ",", "final", "Component", "filter", ")", "{", "final", "ComponentFeedbackPanel", "feedbackPanel", "=", "new", "ComponentFeedbackPanel", "(", "id", ",", "filter", ...
Factory method for create a new {@link ComponentFeedbackPanel}. @param id the id @param filter the filter @return the {@link ComponentFeedbackPanel}
[ "Factory", "method", "for", "create", "a", "new", "{", "@link", "ComponentFeedbackPanel", "}", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/factory/ComponentFactory.java#L142-L148
emilsjolander/sprinkles
library/src/main/java/se/emilsjolander/sprinkles/Query.java
Query.all
public static <T extends Model> ManyQuery<T> all(Class<T> clazz) { return many(clazz, "SELECT * FROM " + Utils.getTableName(clazz)); }
java
public static <T extends Model> ManyQuery<T> all(Class<T> clazz) { return many(clazz, "SELECT * FROM " + Utils.getTableName(clazz)); }
[ "public", "static", "<", "T", "extends", "Model", ">", "ManyQuery", "<", "T", ">", "all", "(", "Class", "<", "T", ">", "clazz", ")", "{", "return", "many", "(", "clazz", ",", "\"SELECT * FROM \"", "+", "Utils", ".", "getTableName", "(", "clazz", ")", ...
Start a query for the entire list of instance of type T @param clazz The class representing the type of the list you want returned @param <T> The type of the list you want returned @return the query to execute
[ "Start", "a", "query", "for", "the", "entire", "list", "of", "instance", "of", "type", "T" ]
train
https://github.com/emilsjolander/sprinkles/blob/3a666f18ee5158db6fe3b4f4346b470481559606/library/src/main/java/se/emilsjolander/sprinkles/Query.java#L124-L126
knightliao/disconf
disconf-web/src/main/java/com/baidu/unbiz/common/genericdao/mapper/QueryGenerator.java
QueryGenerator.getCreateQuery
public Query getCreateQuery(boolean generateKey, boolean quick, ENTITY... entities) { return getCreateQuery(Arrays.asList(entities), generateKey, quick, null); }
java
public Query getCreateQuery(boolean generateKey, boolean quick, ENTITY... entities) { return getCreateQuery(Arrays.asList(entities), generateKey, quick, null); }
[ "public", "Query", "getCreateQuery", "(", "boolean", "generateKey", ",", "boolean", "quick", ",", "ENTITY", "...", "entities", ")", "{", "return", "getCreateQuery", "(", "Arrays", ".", "asList", "(", "entities", ")", ",", "generateKey", ",", "quick", ",", "n...
構造一個create語句的query @param generateKey 由數據庫autoincrement生成key,還是應用端指定key @param quick 時候用快速方式,快速方式無法將自動生成key填充到對象中。一般此參數為false,只有當批量創建,且由數據庫生成key時該處可選。 @param entities @return 下午1:26:37 created by Darwin(Tianxin)
[ "構造一個create語句的query" ]
train
https://github.com/knightliao/disconf/blob/d413cbce9334fe38a5a24982ce4db3a6ed8e98ea/disconf-web/src/main/java/com/baidu/unbiz/common/genericdao/mapper/QueryGenerator.java#L230-L232
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/VerboseFormatter.java
VerboseFormatter.appendLevel
private static void appendLevel(StringBuilder message, LogRecord event) { final String logLevel = event.getLevel().getName(); for (int i = logLevel.length(); i < LOG_LEVEL_LENGTH; i++) { message.append(Constant.SPACE); } message.append(logLevel).append(Constant.DOUBLE_DOT); }
java
private static void appendLevel(StringBuilder message, LogRecord event) { final String logLevel = event.getLevel().getName(); for (int i = logLevel.length(); i < LOG_LEVEL_LENGTH; i++) { message.append(Constant.SPACE); } message.append(logLevel).append(Constant.DOUBLE_DOT); }
[ "private", "static", "void", "appendLevel", "(", "StringBuilder", "message", ",", "LogRecord", "event", ")", "{", "final", "String", "logLevel", "=", "event", ".", "getLevel", "(", ")", ".", "getName", "(", ")", ";", "for", "(", "int", "i", "=", "logLeve...
Append log level. @param message The message builder. @param event The log record.
[ "Append", "log", "level", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/VerboseFormatter.java#L58-L66
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/convert/StringConverter.java
StringConverter.toStringWithDefault
public static String toStringWithDefault(Object value, String defaultValue) { String result = toNullableString(value); return result != null ? result : defaultValue; }
java
public static String toStringWithDefault(Object value, String defaultValue) { String result = toNullableString(value); return result != null ? result : defaultValue; }
[ "public", "static", "String", "toStringWithDefault", "(", "Object", "value", ",", "String", "defaultValue", ")", "{", "String", "result", "=", "toNullableString", "(", "value", ")", ";", "return", "result", "!=", "null", "?", "result", ":", "defaultValue", ";"...
Converts value into string or returns default when value is null. @param value the value to convert. @param defaultValue the default value. @return string value or default when value is null. @see StringConverter#toNullableString(Object)
[ "Converts", "value", "into", "string", "or", "returns", "default", "when", "value", "is", "null", "." ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/convert/StringConverter.java#L111-L114
arquillian/arquillian-container-chameleon
arquillian-chameleon-runner/runner/src/main/java/org/arquillian/container/chameleon/runner/AnnotationExtractor.java
AnnotationExtractor.findAndSortAnnotations
static Annotation[] findAndSortAnnotations(Annotation annotation) { final Annotation[] metaAnnotations = annotation.annotationType().getAnnotations(); Arrays.sort(metaAnnotations, new Comparator<Annotation>() { @Override public int compare(Annotation o1, Annotation o2) { if (o1 instanceof ChameleonTarget) { return -1; } if (o2 instanceof ChameleonTarget) { return 1; } return 0; } }); return metaAnnotations; }
java
static Annotation[] findAndSortAnnotations(Annotation annotation) { final Annotation[] metaAnnotations = annotation.annotationType().getAnnotations(); Arrays.sort(metaAnnotations, new Comparator<Annotation>() { @Override public int compare(Annotation o1, Annotation o2) { if (o1 instanceof ChameleonTarget) { return -1; } if (o2 instanceof ChameleonTarget) { return 1; } return 0; } }); return metaAnnotations; }
[ "static", "Annotation", "[", "]", "findAndSortAnnotations", "(", "Annotation", "annotation", ")", "{", "final", "Annotation", "[", "]", "metaAnnotations", "=", "annotation", ".", "annotationType", "(", ")", ".", "getAnnotations", "(", ")", ";", "Arrays", ".", ...
We need to sort annotations so the first one processed is ChameleonTarget so these properties has bigger preference that the inherit ones. @param annotation @return
[ "We", "need", "to", "sort", "annotations", "so", "the", "first", "one", "processed", "is", "ChameleonTarget", "so", "these", "properties", "has", "bigger", "preference", "that", "the", "inherit", "ones", "." ]
train
https://github.com/arquillian/arquillian-container-chameleon/blob/7e9bbd3eaab9b5dfab1fa6ffd8fb16c39b7cc856/arquillian-chameleon-runner/runner/src/main/java/org/arquillian/container/chameleon/runner/AnnotationExtractor.java#L40-L58
box/box-java-sdk
src/main/java/com/box/sdk/MetadataTemplate.java
MetadataTemplate.getMetadataTemplate
public static MetadataTemplate getMetadataTemplate( BoxAPIConnection api, String templateName, String scope, String ... fields) { QueryStringBuilder builder = new QueryStringBuilder(); if (fields.length > 0) { builder.appendParam("fields", fields); } URL url = METADATA_TEMPLATE_URL_TEMPLATE.buildWithQuery( api.getBaseURL(), builder.toString(), scope, templateName); BoxAPIRequest request = new BoxAPIRequest(api, url, "GET"); BoxJSONResponse response = (BoxJSONResponse) request.send(); return new MetadataTemplate(response.getJSON()); }
java
public static MetadataTemplate getMetadataTemplate( BoxAPIConnection api, String templateName, String scope, String ... fields) { QueryStringBuilder builder = new QueryStringBuilder(); if (fields.length > 0) { builder.appendParam("fields", fields); } URL url = METADATA_TEMPLATE_URL_TEMPLATE.buildWithQuery( api.getBaseURL(), builder.toString(), scope, templateName); BoxAPIRequest request = new BoxAPIRequest(api, url, "GET"); BoxJSONResponse response = (BoxJSONResponse) request.send(); return new MetadataTemplate(response.getJSON()); }
[ "public", "static", "MetadataTemplate", "getMetadataTemplate", "(", "BoxAPIConnection", "api", ",", "String", "templateName", ",", "String", "scope", ",", "String", "...", "fields", ")", "{", "QueryStringBuilder", "builder", "=", "new", "QueryStringBuilder", "(", ")...
Gets the metadata template of specified template type. @param api the API connection to be used. @param templateName the metadata template type name. @param scope the metadata template scope (global or enterprise). @param fields the fields to retrieve. @return the metadata template returned from the server.
[ "Gets", "the", "metadata", "template", "of", "specified", "template", "type", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/MetadataTemplate.java#L441-L452
lucee/Lucee
loader/src/main/java/lucee/loader/engine/CFMLEngineFactory.java
CFMLEngineFactory.removeUpdate
private boolean removeUpdate() throws IOException, ServletException { final File patchDir = getPatchDirectory(); final File[] patches = patchDir.listFiles(new ExtensionFilter(new String[] { "rc", "rcs" })); for (int i = 0; i < patches.length; i++) if (!patches[i].delete()) patches[i].deleteOnExit(); _restart(); return true; }
java
private boolean removeUpdate() throws IOException, ServletException { final File patchDir = getPatchDirectory(); final File[] patches = patchDir.listFiles(new ExtensionFilter(new String[] { "rc", "rcs" })); for (int i = 0; i < patches.length; i++) if (!patches[i].delete()) patches[i].deleteOnExit(); _restart(); return true; }
[ "private", "boolean", "removeUpdate", "(", ")", "throws", "IOException", ",", "ServletException", "{", "final", "File", "patchDir", "=", "getPatchDirectory", "(", ")", ";", "final", "File", "[", "]", "patches", "=", "patchDir", ".", "listFiles", "(", "new", ...
updates the engine when a update is available @return has updated @throws IOException @throws ServletException
[ "updates", "the", "engine", "when", "a", "update", "is", "available" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/loader/src/main/java/lucee/loader/engine/CFMLEngineFactory.java#L1082-L1090
pebble/pebble-android-sdk
PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/util/PebbleDictionary.java
PebbleDictionary.addUint32
public void addUint32(final int key, final int i) { PebbleTuple t = PebbleTuple.create(key, PebbleTuple.TupleType.UINT, PebbleTuple.Width.WORD, i); addTuple(t); }
java
public void addUint32(final int key, final int i) { PebbleTuple t = PebbleTuple.create(key, PebbleTuple.TupleType.UINT, PebbleTuple.Width.WORD, i); addTuple(t); }
[ "public", "void", "addUint32", "(", "final", "int", "key", ",", "final", "int", "i", ")", "{", "PebbleTuple", "t", "=", "PebbleTuple", ".", "create", "(", "key", ",", "PebbleTuple", ".", "TupleType", ".", "UINT", ",", "PebbleTuple", ".", "Width", ".", ...
Associate the specified unsigned int with the provided key in the dictionary. If another key-value pair with the same key is already present in the dictionary, it will be replaced. @param key key with which the specified value is associated @param i value to be associated with the specified key
[ "Associate", "the", "specified", "unsigned", "int", "with", "the", "provided", "key", "in", "the", "dictionary", ".", "If", "another", "key", "-", "value", "pair", "with", "the", "same", "key", "is", "already", "present", "in", "the", "dictionary", "it", "...
train
https://github.com/pebble/pebble-android-sdk/blob/ddfc53ecf3950deebb62a1f205aa21fbe9bce45d/PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/util/PebbleDictionary.java#L177-L180
onelogin/onelogin-java-sdk
src/main/java/com/onelogin/sdk/conn/Client.java
Client.deletePrivilege
public Boolean deletePrivilege(String id) throws OAuthSystemException, OAuthProblemException, URISyntaxException { cleanError(); prepareToken(); OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient(); OAuthClient oAuthClient = new OAuthClient(httpClient); URIBuilder url = new URIBuilder(settings.getURL(Constants.DELETE_PRIVILEGE_URL, id)); OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString()) .buildHeaderMessage(); Map<String, String> headers = getAuthorizedHeader(); bearerRequest.setHeaders(headers); Boolean removed = false; OneloginOAuth2JSONResourceResponse oAuth2Response = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.DELETE, OneloginOAuth2JSONResourceResponse.class); if (oAuth2Response.getResponseCode() == 204) { removed = true; } else { error = oAuth2Response.getError(); errorDescription = oAuth2Response.getErrorDescription(); } return removed; }
java
public Boolean deletePrivilege(String id) throws OAuthSystemException, OAuthProblemException, URISyntaxException { cleanError(); prepareToken(); OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient(); OAuthClient oAuthClient = new OAuthClient(httpClient); URIBuilder url = new URIBuilder(settings.getURL(Constants.DELETE_PRIVILEGE_URL, id)); OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString()) .buildHeaderMessage(); Map<String, String> headers = getAuthorizedHeader(); bearerRequest.setHeaders(headers); Boolean removed = false; OneloginOAuth2JSONResourceResponse oAuth2Response = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.DELETE, OneloginOAuth2JSONResourceResponse.class); if (oAuth2Response.getResponseCode() == 204) { removed = true; } else { error = oAuth2Response.getError(); errorDescription = oAuth2Response.getErrorDescription(); } return removed; }
[ "public", "Boolean", "deletePrivilege", "(", "String", "id", ")", "throws", "OAuthSystemException", ",", "OAuthProblemException", ",", "URISyntaxException", "{", "cleanError", "(", ")", ";", "prepareToken", "(", ")", ";", "OneloginURLConnectionClient", "httpClient", "...
Deletes a privilege @param id Id of the privilege to be deleted @return true if success @throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection @throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled @throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor @see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/privileges/delete-privilege">Delete Privilege documentation</a>
[ "Deletes", "a", "privilege" ]
train
https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L3416-L3440
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
ResourceGroovyMethods.eachByte
public static void eachByte(URL url, @ClosureParams(value = SimpleType.class, options = "byte") Closure closure) throws IOException { InputStream is = url.openConnection().getInputStream(); IOGroovyMethods.eachByte(is, closure); }
java
public static void eachByte(URL url, @ClosureParams(value = SimpleType.class, options = "byte") Closure closure) throws IOException { InputStream is = url.openConnection().getInputStream(); IOGroovyMethods.eachByte(is, closure); }
[ "public", "static", "void", "eachByte", "(", "URL", "url", ",", "@", "ClosureParams", "(", "value", "=", "SimpleType", ".", "class", ",", "options", "=", "\"byte\"", ")", "Closure", "closure", ")", "throws", "IOException", "{", "InputStream", "is", "=", "u...
Reads the InputStream from this URL, passing each byte to the given closure. The URL stream will be closed before this method returns. @param url url to iterate over @param closure closure to apply to each byte @throws IOException if an IOException occurs. @see IOGroovyMethods#eachByte(java.io.InputStream, groovy.lang.Closure) @since 1.0
[ "Reads", "the", "InputStream", "from", "this", "URL", "passing", "each", "byte", "to", "the", "given", "closure", ".", "The", "URL", "stream", "will", "be", "closed", "before", "this", "method", "returns", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L2338-L2341
indeedeng/util
varexport/src/main/java/com/indeed/util/varexport/VarExporter.java
VarExporter.dump
public void dump(final PrintWriter out, final boolean includeDoc) { visitVariables(new Visitor() { public void visit(Variable var) { var.write(out, includeDoc); } }); }
java
public void dump(final PrintWriter out, final boolean includeDoc) { visitVariables(new Visitor() { public void visit(Variable var) { var.write(out, includeDoc); } }); }
[ "public", "void", "dump", "(", "final", "PrintWriter", "out", ",", "final", "boolean", "includeDoc", ")", "{", "visitVariables", "(", "new", "Visitor", "(", ")", "{", "public", "void", "visit", "(", "Variable", "var", ")", "{", "var", ".", "write", "(", ...
Write all variables, one per line, to the given writer, in the format "name=value". Will escape values for compatibility with loading into {@link java.util.Properties}. @param out writer @param includeDoc true if documentation comments should be included
[ "Write", "all", "variables", "one", "per", "line", "to", "the", "given", "writer", "in", "the", "format", "name", "=", "value", ".", "Will", "escape", "values", "for", "compatibility", "with", "loading", "into", "{" ]
train
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/varexport/src/main/java/com/indeed/util/varexport/VarExporter.java#L414-L420
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/fit/SoapCallMapColumnFixture.java
SoapCallMapColumnFixture.callCheckServiceImpl
protected XmlHttpResponse callCheckServiceImpl(String urlSymbolKey, String soapAction) { String url = getSymbol(urlSymbolKey).toString(); XmlHttpResponse response = getEnvironment().createInstance(getCheckResponseClass()); callSoapService(url, getCheckTemplateName(), soapAction, response); return response; }
java
protected XmlHttpResponse callCheckServiceImpl(String urlSymbolKey, String soapAction) { String url = getSymbol(urlSymbolKey).toString(); XmlHttpResponse response = getEnvironment().createInstance(getCheckResponseClass()); callSoapService(url, getCheckTemplateName(), soapAction, response); return response; }
[ "protected", "XmlHttpResponse", "callCheckServiceImpl", "(", "String", "urlSymbolKey", ",", "String", "soapAction", ")", "{", "String", "url", "=", "getSymbol", "(", "urlSymbolKey", ")", ".", "toString", "(", ")", ";", "XmlHttpResponse", "response", "=", "getEnvir...
Creates check response, calls service using configured check template and current row's values and calls SOAP service. @param urlSymbolKey key of symbol containing check service's URL. @param soapAction SOAPAction header value (null if no header is required). @return filled check response
[ "Creates", "check", "response", "calls", "service", "using", "configured", "check", "template", "and", "current", "row", "s", "values", "and", "calls", "SOAP", "service", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/fit/SoapCallMapColumnFixture.java#L69-L74
gallandarakhneorg/afc
core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractTriangle3F.java
AbstractTriangle3F.getGroundHeight
public double getGroundHeight(double x, double y, CoordinateSystem3D system) { assert(system!=null); int idx = system.getHeightCoordinateIndex(); assert(idx==1 || idx==2); Point3D p1 = getP1(); assert(p1!=null); Vector3D v = getNormal(); assert(v!=null); if (idx==1 && v.getY()==0.) return p1.getY(); if (idx==2 && v.getZ()==0.) return p1.getZ(); double d = -(v.getX() * p1.getX() + v.getY() * p1.getY() + v.getZ() * p1.getZ()); if (idx==2) return -(v.getX() * x + v.getY() * y + d) / v.getZ(); return -(v.getX() * x + v.getZ() * y + d) / v.getY(); }
java
public double getGroundHeight(double x, double y, CoordinateSystem3D system) { assert(system!=null); int idx = system.getHeightCoordinateIndex(); assert(idx==1 || idx==2); Point3D p1 = getP1(); assert(p1!=null); Vector3D v = getNormal(); assert(v!=null); if (idx==1 && v.getY()==0.) return p1.getY(); if (idx==2 && v.getZ()==0.) return p1.getZ(); double d = -(v.getX() * p1.getX() + v.getY() * p1.getY() + v.getZ() * p1.getZ()); if (idx==2) return -(v.getX() * x + v.getY() * y + d) / v.getZ(); return -(v.getX() * x + v.getZ() * y + d) / v.getY(); }
[ "public", "double", "getGroundHeight", "(", "double", "x", ",", "double", "y", ",", "CoordinateSystem3D", "system", ")", "{", "assert", "(", "system", "!=", "null", ")", ";", "int", "idx", "=", "system", ".", "getHeightCoordinateIndex", "(", ")", ";", "ass...
Replies the height of the projection on the triangle that is representing a ground. <p> Assuming that the triangle is representing a face of a terrain/ground, this function compute the height of the ground just below the given position. The input of this function is the coordinate of a point on the horizontal plane. @param x is the x-coordinate on point to project on the horizontal plane. @param y is the y-coordinate of point to project on the horizontal plane. @param system is the coordinate system to use for determining the up coordinate. @return the height of the face at the given coordinate.
[ "Replies", "the", "height", "of", "the", "projection", "on", "the", "triangle", "that", "is", "representing", "a", "ground", ".", "<p", ">", "Assuming", "that", "the", "triangle", "is", "representing", "a", "face", "of", "a", "terrain", "/", "ground", "thi...
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractTriangle3F.java#L2140-L2160
Bedework/bw-util
bw-util-config/src/main/java/org/bedework/util/config/ConfigBase.java
ConfigBase.startElement
private QName startElement(final XmlEmit xml, final Class c, final ConfInfo ci) throws Throwable { QName qn; if (ci == null) { qn = new QName(ns, c.getName()); } else { qn = new QName(ns, ci.elementName()); } xml.openTag(qn, "type", c.getCanonicalName()); return qn; }
java
private QName startElement(final XmlEmit xml, final Class c, final ConfInfo ci) throws Throwable { QName qn; if (ci == null) { qn = new QName(ns, c.getName()); } else { qn = new QName(ns, ci.elementName()); } xml.openTag(qn, "type", c.getCanonicalName()); return qn; }
[ "private", "QName", "startElement", "(", "final", "XmlEmit", "xml", ",", "final", "Class", "c", ",", "final", "ConfInfo", "ci", ")", "throws", "Throwable", "{", "QName", "qn", ";", "if", "(", "ci", "==", "null", ")", "{", "qn", "=", "new", "QName", "...
/* Emit a start element with a name and type. The type is the name of the actual class.
[ "/", "*", "Emit", "a", "start", "element", "with", "a", "name", "and", "type", ".", "The", "type", "is", "the", "name", "of", "the", "actual", "class", "." ]
train
https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-config/src/main/java/org/bedework/util/config/ConfigBase.java#L697-L711
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryStatisticsInner.java
QueryStatisticsInner.listByQuery
public List<QueryStatisticInner> listByQuery(String resourceGroupName, String serverName, String databaseName, String queryId) { return listByQueryWithServiceResponseAsync(resourceGroupName, serverName, databaseName, queryId).toBlocking().single().body(); }
java
public List<QueryStatisticInner> listByQuery(String resourceGroupName, String serverName, String databaseName, String queryId) { return listByQueryWithServiceResponseAsync(resourceGroupName, serverName, databaseName, queryId).toBlocking().single().body(); }
[ "public", "List", "<", "QueryStatisticInner", ">", "listByQuery", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "String", "queryId", ")", "{", "return", "listByQueryWithServiceResponseAsync", "(", "resourceGroupName...
Lists a query's statistics. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database. @param queryId The id of the query @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;QueryStatisticInner&gt; object if successful.
[ "Lists", "a", "query", "s", "statistics", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryStatisticsInner.java#L73-L75
inkstand-io/scribble
scribble-inject/src/main/java/io/inkstand/scribble/inject/TypeUtil.java
TypeUtil.toPrimitive
private static Object toPrimitive(final String value, final Class<?> type) { final Class<?> objectType = objectTypeFor(type); final Object objectValue = valueOf(value, objectType); final Object primitiveValue; final String toValueMethodName = type.getSimpleName() + "Value"; try { final Method toValueMethod = objectType.getMethod(toValueMethodName); primitiveValue = toValueMethod.invoke(objectValue); } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { //this should never happen throw new RuntimeException("Can not convert to primitive type", e); //NOSONAR } return primitiveValue; }
java
private static Object toPrimitive(final String value, final Class<?> type) { final Class<?> objectType = objectTypeFor(type); final Object objectValue = valueOf(value, objectType); final Object primitiveValue; final String toValueMethodName = type.getSimpleName() + "Value"; try { final Method toValueMethod = objectType.getMethod(toValueMethodName); primitiveValue = toValueMethod.invoke(objectValue); } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { //this should never happen throw new RuntimeException("Can not convert to primitive type", e); //NOSONAR } return primitiveValue; }
[ "private", "static", "Object", "toPrimitive", "(", "final", "String", "value", ",", "final", "Class", "<", "?", ">", "type", ")", "{", "final", "Class", "<", "?", ">", "objectType", "=", "objectTypeFor", "(", "type", ")", ";", "final", "Object", "objectV...
Converts the given value to it's given primitive type. @param value the value to be converted @param type a primitive type class (i.e. {@code int.class}) . @return the converted value (will be a wrapper type)
[ "Converts", "the", "given", "value", "to", "it", "s", "given", "primitive", "type", "." ]
train
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-inject/src/main/java/io/inkstand/scribble/inject/TypeUtil.java#L123-L139
dmerkushov/os-helper
src/main/java/ru/dmerkushov/oshelper/OSHelper.java
OSHelper.procWait
public static int procWait (Process process) throws OSHelperException { try { return process.waitFor (); } catch (InterruptedException ex) { throw new OSHelperException ("Received an InterruptedException when waiting for an external process to terminate.", ex); } }
java
public static int procWait (Process process) throws OSHelperException { try { return process.waitFor (); } catch (InterruptedException ex) { throw new OSHelperException ("Received an InterruptedException when waiting for an external process to terminate.", ex); } }
[ "public", "static", "int", "procWait", "(", "Process", "process", ")", "throws", "OSHelperException", "{", "try", "{", "return", "process", ".", "waitFor", "(", ")", ";", "}", "catch", "(", "InterruptedException", "ex", ")", "{", "throw", "new", "OSHelperExc...
Waits for a specified process to terminate @param process @throws OSHelperException @deprecated Use ProcessReturn procWaitWithProcessReturn () instead
[ "Waits", "for", "a", "specified", "process", "to", "terminate" ]
train
https://github.com/dmerkushov/os-helper/blob/a7c2b72d289d9bc23ae106d1c5e11769cf3463d6/src/main/java/ru/dmerkushov/oshelper/OSHelper.java#L159-L165
dmfs/xmlobjects
src/org/dmfs/xmlobjects/pull/XmlObjectPull.java
XmlObjectPull.moveToNextSibling
public <T> boolean moveToNextSibling(ElementDescriptor<T> type, XmlPath path) throws XmlPullParserException, XmlObjectPullParserException, IOException { return pullInternal(type, null, path, true, true) != null || mParser.getDepth() == path.length() + 1; }
java
public <T> boolean moveToNextSibling(ElementDescriptor<T> type, XmlPath path) throws XmlPullParserException, XmlObjectPullParserException, IOException { return pullInternal(type, null, path, true, true) != null || mParser.getDepth() == path.length() + 1; }
[ "public", "<", "T", ">", "boolean", "moveToNextSibling", "(", "ElementDescriptor", "<", "T", ">", "type", ",", "XmlPath", "path", ")", "throws", "XmlPullParserException", ",", "XmlObjectPullParserException", ",", "IOException", "{", "return", "pullInternal", "(", ...
Moves forward to the start of the next element that matches the given type and path without leaving the current sub-tree. If there is no other element of that type in the current sub-tree, this mehtod will stop at the closing tab current sub-tree. Calling this methods with the same parameters won't get you any further. @return <code>true</code> if there is such an element, false otherwise. @throws XmlPullParserException @throws XmlObjectPullParserException @throws IOException
[ "Moves", "forward", "to", "the", "start", "of", "the", "next", "element", "that", "matches", "the", "given", "type", "and", "path", "without", "leaving", "the", "current", "sub", "-", "tree", ".", "If", "there", "is", "no", "other", "element", "of", "tha...
train
https://github.com/dmfs/xmlobjects/blob/b68ddd0ce994d804fc2ec6da1096bf0d883b37f9/src/org/dmfs/xmlobjects/pull/XmlObjectPull.java#L99-L102
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java
SqlDateTimeUtils.fromUnixtime
public static String fromUnixtime(long unixtime, String format, TimeZone tz) { SimpleDateFormat formatter = FORMATTER_CACHE.get(format); formatter.setTimeZone(tz); Date date = new Date(unixtime * 1000); try { return formatter.format(date); } catch (Exception e) { LOG.error("Exception when formatting.", e); return null; } }
java
public static String fromUnixtime(long unixtime, String format, TimeZone tz) { SimpleDateFormat formatter = FORMATTER_CACHE.get(format); formatter.setTimeZone(tz); Date date = new Date(unixtime * 1000); try { return formatter.format(date); } catch (Exception e) { LOG.error("Exception when formatting.", e); return null; } }
[ "public", "static", "String", "fromUnixtime", "(", "long", "unixtime", ",", "String", "format", ",", "TimeZone", "tz", ")", "{", "SimpleDateFormat", "formatter", "=", "FORMATTER_CACHE", ".", "get", "(", "format", ")", ";", "formatter", ".", "setTimeZone", "(",...
Convert unix timestamp (seconds since '1970-01-01 00:00:00' UTC) to datetime string in the given format.
[ "Convert", "unix", "timestamp", "(", "seconds", "since", "1970", "-", "01", "-", "01", "00", ":", "00", ":", "00", "UTC", ")", "to", "datetime", "string", "in", "the", "given", "format", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java#L849-L859
Harium/keel
src/main/java/com/harium/keel/effect/helper/Curve.java
Curve.Spline
public static float Spline(float x, int numKnots, int[] xknots, int[] yknots) { int span; int numSpans = numKnots - 3; float k0, k1, k2, k3; float c0, c1, c2, c3; if (numSpans < 1) throw new IllegalArgumentException("Too few knots in spline"); for (span = 0; span < numSpans; span++) if (xknots[span + 1] > x) break; if (span > numKnots - 3) span = numKnots - 3; float t = (float) (x - xknots[span]) / (xknots[span + 1] - xknots[span]); span--; if (span < 0) { span = 0; t = 0; } k0 = yknots[span]; k1 = yknots[span + 1]; k2 = yknots[span + 2]; k3 = yknots[span + 3]; c3 = -0.5f * k0 + 1.5f * k1 + -1.5f * k2 + 0.5f * k3; c2 = 1f * k0 + -2.5f * k1 + 2f * k2 + -0.5f * k3; c1 = -0.5f * k0 + 0f * k1 + 0.5f * k2 + 0f * k3; c0 = 0f * k0 + 1f * k1 + 0f * k2 + 0f * k3; return ((c3 * t + c2) * t + c1) * t + c0; }
java
public static float Spline(float x, int numKnots, int[] xknots, int[] yknots) { int span; int numSpans = numKnots - 3; float k0, k1, k2, k3; float c0, c1, c2, c3; if (numSpans < 1) throw new IllegalArgumentException("Too few knots in spline"); for (span = 0; span < numSpans; span++) if (xknots[span + 1] > x) break; if (span > numKnots - 3) span = numKnots - 3; float t = (float) (x - xknots[span]) / (xknots[span + 1] - xknots[span]); span--; if (span < 0) { span = 0; t = 0; } k0 = yknots[span]; k1 = yknots[span + 1]; k2 = yknots[span + 2]; k3 = yknots[span + 3]; c3 = -0.5f * k0 + 1.5f * k1 + -1.5f * k2 + 0.5f * k3; c2 = 1f * k0 + -2.5f * k1 + 2f * k2 + -0.5f * k3; c1 = -0.5f * k0 + 0f * k1 + 0.5f * k2 + 0f * k3; c0 = 0f * k0 + 1f * k1 + 0f * k2 + 0f * k3; return ((c3 * t + c2) * t + c1) * t + c0; }
[ "public", "static", "float", "Spline", "(", "float", "x", ",", "int", "numKnots", ",", "int", "[", "]", "xknots", ",", "int", "[", "]", "yknots", ")", "{", "int", "span", ";", "int", "numSpans", "=", "numKnots", "-", "3", ";", "float", "k0", ",", ...
compute a Catmull-Rom spline, but with variable knot spacing. @param x the input parameter @param numKnots the number of knots in the spline @param xknots the array of knot x values @param yknots the array of knot y values @return the spline value
[ "compute", "a", "Catmull", "-", "Rom", "spline", "but", "with", "variable", "knot", "spacing", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/effect/helper/Curve.java#L278-L310
coursera/courier
generator-api/src/main/java/org/coursera/courier/api/FileFormatDataSchemaParser.java
FileFormatDataSchemaParser.validateSchemaWithFilePath
private void validateSchemaWithFilePath(File schemaSourceFile, DataSchema schema) { if (schemaSourceFile != null && schemaSourceFile.isFile() && schema instanceof NamedDataSchema) { final NamedDataSchema namedDataSchema = (NamedDataSchema) schema; final String namespace = namedDataSchema.getNamespace(); if (!FileUtil.removeFileExtension(schemaSourceFile.getName()).equalsIgnoreCase(namedDataSchema.getName())) { throw new IllegalArgumentException(namedDataSchema.getFullName() + " has name that does not match filename '" + schemaSourceFile.getAbsolutePath() + "'"); } final String directory = schemaSourceFile.getParentFile().getAbsolutePath(); if (!directory.endsWith(namespace.replace('.', File.separatorChar))) { throw new IllegalArgumentException(namedDataSchema.getFullName() + " has namespace that does not match " + "file path '" + schemaSourceFile.getAbsolutePath() + "'"); } } }
java
private void validateSchemaWithFilePath(File schemaSourceFile, DataSchema schema) { if (schemaSourceFile != null && schemaSourceFile.isFile() && schema instanceof NamedDataSchema) { final NamedDataSchema namedDataSchema = (NamedDataSchema) schema; final String namespace = namedDataSchema.getNamespace(); if (!FileUtil.removeFileExtension(schemaSourceFile.getName()).equalsIgnoreCase(namedDataSchema.getName())) { throw new IllegalArgumentException(namedDataSchema.getFullName() + " has name that does not match filename '" + schemaSourceFile.getAbsolutePath() + "'"); } final String directory = schemaSourceFile.getParentFile().getAbsolutePath(); if (!directory.endsWith(namespace.replace('.', File.separatorChar))) { throw new IllegalArgumentException(namedDataSchema.getFullName() + " has namespace that does not match " + "file path '" + schemaSourceFile.getAbsolutePath() + "'"); } } }
[ "private", "void", "validateSchemaWithFilePath", "(", "File", "schemaSourceFile", ",", "DataSchema", "schema", ")", "{", "if", "(", "schemaSourceFile", "!=", "null", "&&", "schemaSourceFile", ".", "isFile", "(", ")", "&&", "schema", "instanceof", "NamedDataSchema", ...
Checks that the schema name and namespace match the file name and path. These must match for FileDataSchemaResolver to find a schema pdscs by fully qualified name.
[ "Checks", "that", "the", "schema", "name", "and", "namespace", "match", "the", "file", "name", "and", "path", ".", "These", "must", "match", "for", "FileDataSchemaResolver", "to", "find", "a", "schema", "pdscs", "by", "fully", "qualified", "name", "." ]
train
https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/generator-api/src/main/java/org/coursera/courier/api/FileFormatDataSchemaParser.java#L195-L215
ktoso/janbanery
janbanery-core/src/main/java/pl/project13/janbanery/config/auth/Base64Coder.java
Base64Coder.decodeLines
public static byte[] decodeLines(String s) { char[] buf = new char[s.length()]; int p = 0; for (int ip = 0; ip < s.length(); ip++) { char c = s.charAt(ip); if (c != ' ' && c != '\r' && c != '\n' && c != '\t') { buf[p++] = c; } } return decode(buf, 0, p); }
java
public static byte[] decodeLines(String s) { char[] buf = new char[s.length()]; int p = 0; for (int ip = 0; ip < s.length(); ip++) { char c = s.charAt(ip); if (c != ' ' && c != '\r' && c != '\n' && c != '\t') { buf[p++] = c; } } return decode(buf, 0, p); }
[ "public", "static", "byte", "[", "]", "decodeLines", "(", "String", "s", ")", "{", "char", "[", "]", "buf", "=", "new", "char", "[", "s", ".", "length", "(", ")", "]", ";", "int", "p", "=", "0", ";", "for", "(", "int", "ip", "=", "0", ";", ...
Decodes a byte array from Base64 format and ignores line separators, tabs and blanks. CR, LF, Tab and Space characters are ignored in the input data. This method is compatible with <code>sun.misc.BASE64Decoder.decodeBuffer(String)</code>. @param s A Base64 String to be decoded. @return An array containing the decoded data bytes. @throws IllegalArgumentException If the input is not valid Base64 encoded data.
[ "Decodes", "a", "byte", "array", "from", "Base64", "format", "and", "ignores", "line", "separators", "tabs", "and", "blanks", ".", "CR", "LF", "Tab", "and", "Space", "characters", "are", "ignored", "in", "the", "input", "data", ".", "This", "method", "is",...
train
https://github.com/ktoso/janbanery/blob/cd77b774814c7fbb2a0c9c55d4c3f7e76affa636/janbanery-core/src/main/java/pl/project13/janbanery/config/auth/Base64Coder.java#L193-L203
JavaMoney/jsr354-ri-bp
src/main/java/org/javamoney/moneta/spi/base/BaseMonetaryCurrenciesSingletonSpi.java
BaseMonetaryCurrenciesSingletonSpi.isCurrencyAvailable
public boolean isCurrencyAvailable(Locale locale, String... providers) { return !getCurrencies(CurrencyQueryBuilder.of().setCountries(locale).setProviderNames(providers).build()).isEmpty(); }
java
public boolean isCurrencyAvailable(Locale locale, String... providers) { return !getCurrencies(CurrencyQueryBuilder.of().setCountries(locale).setProviderNames(providers).build()).isEmpty(); }
[ "public", "boolean", "isCurrencyAvailable", "(", "Locale", "locale", ",", "String", "...", "providers", ")", "{", "return", "!", "getCurrencies", "(", "CurrencyQueryBuilder", ".", "of", "(", ")", ".", "setCountries", "(", "locale", ")", ".", "setProviderNames", ...
Allows to check if a {@link javax.money.CurrencyUnit} instance is defined, i.e. accessible from {@link #getCurrency(String, String...)}. @param locale the target {@link java.util.Locale}, not {@code null}. @param providers the (optional) specification of providers to consider. If not set (empty) the providers as defined by #getDefaultRoundingProviderChain() should be used. @return {@code true} if {@link #getCurrencies(java.util.Locale, String...)} would return a non empty result for the given code.
[ "Allows", "to", "check", "if", "a", "{", "@link", "javax", ".", "money", ".", "CurrencyUnit", "}", "instance", "is", "defined", "i", ".", "e", ".", "accessible", "from", "{", "@link", "#getCurrency", "(", "String", "String", "...", ")", "}", "." ]
train
https://github.com/JavaMoney/jsr354-ri-bp/blob/9c147ef5623d8032a6dc4c0e5eefdfb41641a9a2/src/main/java/org/javamoney/moneta/spi/base/BaseMonetaryCurrenciesSingletonSpi.java#L122-L124
qspin/qtaste
kernel/src/main/java/com/qspin/qtaste/toolbox/simulators/SimulatorImpl.java
SimulatorImpl.scheduleTaskAtFixedRate
public void scheduleTaskAtFixedRate(PyObject task, double delay, double period) { mTimer.scheduleAtFixedRate(new PythonCallTimerTask(task), Math.round(delay * 1000), Math.round(period * 1000)); }
java
public void scheduleTaskAtFixedRate(PyObject task, double delay, double period) { mTimer.scheduleAtFixedRate(new PythonCallTimerTask(task), Math.round(delay * 1000), Math.round(period * 1000)); }
[ "public", "void", "scheduleTaskAtFixedRate", "(", "PyObject", "task", ",", "double", "delay", ",", "double", "period", ")", "{", "mTimer", ".", "scheduleAtFixedRate", "(", "new", "PythonCallTimerTask", "(", "task", ")", ",", "Math", ".", "round", "(", "delay",...
Schedules the specified task for repeated <i>fixed-rate execution</i>, beginning after the specified delay. Subsequent executions take place at approximately regular intervals, separated by the specified period. <p> See {@link Timer} documentation for more information. @param task Python object callable without arguments, to schedule @param delay delay in seconds before task is to be executed @param period time in seconds between successive task executions
[ "Schedules", "the", "specified", "task", "for", "repeated", "<i", ">", "fixed", "-", "rate", "execution<", "/", "i", ">", "beginning", "after", "the", "specified", "delay", ".", "Subsequent", "executions", "take", "place", "at", "approximately", "regular", "in...
train
https://github.com/qspin/qtaste/blob/ba45d4d86eb29b92f157c6e98536dee2002ddfdc/kernel/src/main/java/com/qspin/qtaste/toolbox/simulators/SimulatorImpl.java#L144-L146
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/factory/feature/tracker/FactoryPointTracker.java
FactoryPointTracker.combined_FH_SURF_KLT
public static <I extends ImageGray<I>> PointTracker<I> combined_FH_SURF_KLT( PkltConfig kltConfig , int reactivateThreshold , ConfigFastHessian configDetector , ConfigSurfDescribe.Stability configDescribe , ConfigSlidingIntegral configOrientation , Class<I> imageType) { ScoreAssociation<TupleDesc_F64> score = FactoryAssociation.defaultScore(TupleDesc_F64.class); AssociateSurfBasic assoc = new AssociateSurfBasic(FactoryAssociation.greedy(score, 100000, true)); AssociateDescription<BrightFeature> generalAssoc = new WrapAssociateSurfBasic(assoc); DetectDescribePoint<I,BrightFeature> fused = FactoryDetectDescribe.surfStable(configDetector, configDescribe, configOrientation,imageType); return combined(fused,generalAssoc, kltConfig,reactivateThreshold, imageType); }
java
public static <I extends ImageGray<I>> PointTracker<I> combined_FH_SURF_KLT( PkltConfig kltConfig , int reactivateThreshold , ConfigFastHessian configDetector , ConfigSurfDescribe.Stability configDescribe , ConfigSlidingIntegral configOrientation , Class<I> imageType) { ScoreAssociation<TupleDesc_F64> score = FactoryAssociation.defaultScore(TupleDesc_F64.class); AssociateSurfBasic assoc = new AssociateSurfBasic(FactoryAssociation.greedy(score, 100000, true)); AssociateDescription<BrightFeature> generalAssoc = new WrapAssociateSurfBasic(assoc); DetectDescribePoint<I,BrightFeature> fused = FactoryDetectDescribe.surfStable(configDetector, configDescribe, configOrientation,imageType); return combined(fused,generalAssoc, kltConfig,reactivateThreshold, imageType); }
[ "public", "static", "<", "I", "extends", "ImageGray", "<", "I", ">", ">", "PointTracker", "<", "I", ">", "combined_FH_SURF_KLT", "(", "PkltConfig", "kltConfig", ",", "int", "reactivateThreshold", ",", "ConfigFastHessian", "configDetector", ",", "ConfigSurfDescribe",...
Creates a tracker which detects Fast-Hessian features, describes them with SURF, nominally tracks them using KLT. @see DescribePointSurf @see boofcv.abst.feature.tracker.DdaManagerDetectDescribePoint @param kltConfig Configuration for KLT tracker @param reactivateThreshold Tracks are reactivated after this many have been dropped. Try 10% of maxMatches @param configDetector Configuration for SURF detector @param configDescribe Configuration for SURF descriptor @param configOrientation Configuration for region orientation @param imageType Type of image the input is. @param <I> Input image type. @return SURF based tracker.
[ "Creates", "a", "tracker", "which", "detects", "Fast", "-", "Hessian", "features", "describes", "them", "with", "SURF", "nominally", "tracks", "them", "using", "KLT", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/factory/feature/tracker/FactoryPointTracker.java#L387-L404
guardtime/ksi-java-sdk
ksi-common/src/main/java/com/guardtime/ksi/hashing/DataHasher.java
DataHasher.addData
public final DataHasher addData(byte[] data, int offset, int length) { if (outputHash != null) { throw new IllegalStateException("Output hash has already been calculated"); } messageDigest.update(data, offset, length); return this; }
java
public final DataHasher addData(byte[] data, int offset, int length) { if (outputHash != null) { throw new IllegalStateException("Output hash has already been calculated"); } messageDigest.update(data, offset, length); return this; }
[ "public", "final", "DataHasher", "addData", "(", "byte", "[", "]", "data", ",", "int", "offset", ",", "int", "length", ")", "{", "if", "(", "outputHash", "!=", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Output hash has already been calc...
Updates the digest using the specified array of bytes, starting at the specified offset. @param data the array of bytes. @param offset the offset to start from in the array of bytes. @param length the number of bytes to use, starting at the offset. @return The same {@link DataHasher} object for chaining calls. @throws IllegalStateException when hash is already been calculated.
[ "Updates", "the", "digest", "using", "the", "specified", "array", "of", "bytes", "starting", "at", "the", "specified", "offset", "." ]
train
https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/hashing/DataHasher.java#L144-L150
census-instrumentation/opencensus-java
examples/src/main/java/io/opencensus/examples/grpc/helloworld/HelloWorldClient.java
HelloWorldClient.main
public static void main(String[] args) throws IOException, InterruptedException { // Add final keyword to pass checkStyle. final String user = getStringOrDefaultFromArgs(args, 0, "world"); final String host = getStringOrDefaultFromArgs(args, 1, "localhost"); final int serverPort = getPortOrDefaultFromArgs(args, 2, 50051); final String cloudProjectId = getStringOrDefaultFromArgs(args, 3, null); final int zPagePort = getPortOrDefaultFromArgs(args, 4, 3001); // Registers all RPC views. For demonstration all views are registered. You may want to // start with registering basic views and register other views as needed for your application. RpcViews.registerAllViews(); // Starts a HTTP server and registers all Zpages to it. ZPageHandlers.startHttpServerAndRegisterAll(zPagePort); logger.info("ZPages server starts at localhost:" + zPagePort); // Registers logging trace exporter. LoggingTraceExporter.register(); // Registers Stackdriver exporters. if (cloudProjectId != null) { StackdriverTraceExporter.createAndRegister( StackdriverTraceConfiguration.builder().setProjectId(cloudProjectId).build()); StackdriverStatsExporter.createAndRegister( StackdriverStatsConfiguration.builder() .setProjectId(cloudProjectId) .setExportInterval(Duration.create(60, 0)) .build()); } // Register Prometheus exporters and export metrics to a Prometheus HTTPServer. PrometheusStatsCollector.createAndRegister(); HelloWorldClient client = new HelloWorldClient(host, serverPort); try { client.greet(user); } finally { client.shutdown(); } logger.info("Client sleeping, ^C to exit. Meanwhile you can view stats and spans on zpages."); while (true) { try { Thread.sleep(10000); } catch (InterruptedException e) { logger.info("Exiting HelloWorldClient..."); } } }
java
public static void main(String[] args) throws IOException, InterruptedException { // Add final keyword to pass checkStyle. final String user = getStringOrDefaultFromArgs(args, 0, "world"); final String host = getStringOrDefaultFromArgs(args, 1, "localhost"); final int serverPort = getPortOrDefaultFromArgs(args, 2, 50051); final String cloudProjectId = getStringOrDefaultFromArgs(args, 3, null); final int zPagePort = getPortOrDefaultFromArgs(args, 4, 3001); // Registers all RPC views. For demonstration all views are registered. You may want to // start with registering basic views and register other views as needed for your application. RpcViews.registerAllViews(); // Starts a HTTP server and registers all Zpages to it. ZPageHandlers.startHttpServerAndRegisterAll(zPagePort); logger.info("ZPages server starts at localhost:" + zPagePort); // Registers logging trace exporter. LoggingTraceExporter.register(); // Registers Stackdriver exporters. if (cloudProjectId != null) { StackdriverTraceExporter.createAndRegister( StackdriverTraceConfiguration.builder().setProjectId(cloudProjectId).build()); StackdriverStatsExporter.createAndRegister( StackdriverStatsConfiguration.builder() .setProjectId(cloudProjectId) .setExportInterval(Duration.create(60, 0)) .build()); } // Register Prometheus exporters and export metrics to a Prometheus HTTPServer. PrometheusStatsCollector.createAndRegister(); HelloWorldClient client = new HelloWorldClient(host, serverPort); try { client.greet(user); } finally { client.shutdown(); } logger.info("Client sleeping, ^C to exit. Meanwhile you can view stats and spans on zpages."); while (true) { try { Thread.sleep(10000); } catch (InterruptedException e) { logger.info("Exiting HelloWorldClient..."); } } }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "IOException", ",", "InterruptedException", "{", "// Add final keyword to pass checkStyle.", "final", "String", "user", "=", "getStringOrDefaultFromArgs", "(", "args", ",", "0", ",",...
Greet server. If provided, the first element of {@code args} is the name to use in the greeting.
[ "Greet", "server", ".", "If", "provided", "the", "first", "element", "of", "{" ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/examples/src/main/java/io/opencensus/examples/grpc/helloworld/HelloWorldClient.java#L103-L151
square/okhttp
okhttp/src/main/java/okhttp3/internal/Util.java
Util.skipAll
public static boolean skipAll(Source source, int duration, TimeUnit timeUnit) throws IOException { long now = System.nanoTime(); long originalDuration = source.timeout().hasDeadline() ? source.timeout().deadlineNanoTime() - now : Long.MAX_VALUE; source.timeout().deadlineNanoTime(now + Math.min(originalDuration, timeUnit.toNanos(duration))); try { Buffer skipBuffer = new Buffer(); while (source.read(skipBuffer, 8192) != -1) { skipBuffer.clear(); } return true; // Success! The source has been exhausted. } catch (InterruptedIOException e) { return false; // We ran out of time before exhausting the source. } finally { if (originalDuration == Long.MAX_VALUE) { source.timeout().clearDeadline(); } else { source.timeout().deadlineNanoTime(now + originalDuration); } } }
java
public static boolean skipAll(Source source, int duration, TimeUnit timeUnit) throws IOException { long now = System.nanoTime(); long originalDuration = source.timeout().hasDeadline() ? source.timeout().deadlineNanoTime() - now : Long.MAX_VALUE; source.timeout().deadlineNanoTime(now + Math.min(originalDuration, timeUnit.toNanos(duration))); try { Buffer skipBuffer = new Buffer(); while (source.read(skipBuffer, 8192) != -1) { skipBuffer.clear(); } return true; // Success! The source has been exhausted. } catch (InterruptedIOException e) { return false; // We ran out of time before exhausting the source. } finally { if (originalDuration == Long.MAX_VALUE) { source.timeout().clearDeadline(); } else { source.timeout().deadlineNanoTime(now + originalDuration); } } }
[ "public", "static", "boolean", "skipAll", "(", "Source", "source", ",", "int", "duration", ",", "TimeUnit", "timeUnit", ")", "throws", "IOException", "{", "long", "now", "=", "System", ".", "nanoTime", "(", ")", ";", "long", "originalDuration", "=", "source"...
Reads until {@code in} is exhausted or the deadline has been reached. This is careful to not extend the deadline if one exists already.
[ "Reads", "until", "{" ]
train
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/Util.java#L173-L194
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildTasksInner.java
BuildTasksInner.beginCreateAsync
public Observable<BuildTaskInner> beginCreateAsync(String resourceGroupName, String registryName, String buildTaskName, BuildTaskInner buildTaskCreateParameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, buildTaskName, buildTaskCreateParameters).map(new Func1<ServiceResponse<BuildTaskInner>, BuildTaskInner>() { @Override public BuildTaskInner call(ServiceResponse<BuildTaskInner> response) { return response.body(); } }); }
java
public Observable<BuildTaskInner> beginCreateAsync(String resourceGroupName, String registryName, String buildTaskName, BuildTaskInner buildTaskCreateParameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, buildTaskName, buildTaskCreateParameters).map(new Func1<ServiceResponse<BuildTaskInner>, BuildTaskInner>() { @Override public BuildTaskInner call(ServiceResponse<BuildTaskInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "BuildTaskInner", ">", "beginCreateAsync", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "String", "buildTaskName", ",", "BuildTaskInner", "buildTaskCreateParameters", ")", "{", "return", "beginCreateWithServiceResponse...
Creates a build task for a container registry with the specified parameters. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param buildTaskName The name of the container registry build task. @param buildTaskCreateParameters The parameters for creating a build task. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the BuildTaskInner object
[ "Creates", "a", "build", "task", "for", "a", "container", "registry", "with", "the", "specified", "parameters", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildTasksInner.java#L570-L577
nostra13/Android-Universal-Image-Loader
library/src/main/java/com/nostra13/universalimageloader/utils/DiskCacheUtils.java
DiskCacheUtils.findInCache
public static File findInCache(String imageUri, DiskCache diskCache) { File image = diskCache.get(imageUri); return image != null && image.exists() ? image : null; }
java
public static File findInCache(String imageUri, DiskCache diskCache) { File image = diskCache.get(imageUri); return image != null && image.exists() ? image : null; }
[ "public", "static", "File", "findInCache", "(", "String", "imageUri", ",", "DiskCache", "diskCache", ")", "{", "File", "image", "=", "diskCache", ".", "get", "(", "imageUri", ")", ";", "return", "image", "!=", "null", "&&", "image", ".", "exists", "(", "...
Returns {@link File} of cached image or <b>null</b> if image was not cached in disk cache
[ "Returns", "{" ]
train
https://github.com/nostra13/Android-Universal-Image-Loader/blob/fc3c5f6779bb4f702e233653b61bd9d559e345cc/library/src/main/java/com/nostra13/universalimageloader/utils/DiskCacheUtils.java#L35-L38
VerbalExpressions/JavaVerbalExpressions
src/main/java/ru/lanwen/verbalregex/VerbalExpression.java
VerbalExpression.getText
public String getText(final String toTest, final int group) { Matcher m = pattern.matcher(toTest); StringBuilder result = new StringBuilder(); while (m.find()) { result.append(m.group(group)); } return result.toString(); }
java
public String getText(final String toTest, final int group) { Matcher m = pattern.matcher(toTest); StringBuilder result = new StringBuilder(); while (m.find()) { result.append(m.group(group)); } return result.toString(); }
[ "public", "String", "getText", "(", "final", "String", "toTest", ",", "final", "int", "group", ")", "{", "Matcher", "m", "=", "pattern", ".", "matcher", "(", "toTest", ")", ";", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "whil...
Extract exact group from string @param toTest - string to extract from @param group - group to extract @return extracted group @since 1.1
[ "Extract", "exact", "group", "from", "string" ]
train
https://github.com/VerbalExpressions/JavaVerbalExpressions/blob/4ee34e6c96ea2cf8335e3b425afa44c535229347/src/main/java/ru/lanwen/verbalregex/VerbalExpression.java#L742-L749
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.applyAliases
private void applyAliases(Map<FieldType, String> aliases) { CustomFieldContainer fields = m_project.getCustomFields(); for (Map.Entry<FieldType, String> entry : aliases.entrySet()) { fields.getCustomField(entry.getKey()).setAlias(entry.getValue()); } }
java
private void applyAliases(Map<FieldType, String> aliases) { CustomFieldContainer fields = m_project.getCustomFields(); for (Map.Entry<FieldType, String> entry : aliases.entrySet()) { fields.getCustomField(entry.getKey()).setAlias(entry.getValue()); } }
[ "private", "void", "applyAliases", "(", "Map", "<", "FieldType", ",", "String", ">", "aliases", ")", "{", "CustomFieldContainer", "fields", "=", "m_project", ".", "getCustomFields", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "FieldType", ",", "St...
Apply aliases to task and resource fields. @param aliases map of aliases
[ "Apply", "aliases", "to", "task", "and", "resource", "fields", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L1481-L1488
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java
HttpChannelConfig.parseAllowRetries
private void parseAllowRetries(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_ALLOW_RETRIES); if (null != value) { this.bAllowRetries = convertBoolean(value); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: allow retries is " + allowsRetries()); } } }
java
private void parseAllowRetries(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_ALLOW_RETRIES); if (null != value) { this.bAllowRetries = convertBoolean(value); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: allow retries is " + allowsRetries()); } } }
[ "private", "void", "parseAllowRetries", "(", "Map", "<", "Object", ",", "Object", ">", "props", ")", "{", "Object", "value", "=", "props", ".", "get", "(", "HttpConfigConstants", ".", "PROPNAME_ALLOW_RETRIES", ")", ";", "if", "(", "null", "!=", "value", ")...
Parse the input configuration for the flag on whether to allow retries or not. @param props
[ "Parse", "the", "input", "configuration", "for", "the", "flag", "on", "whether", "to", "allow", "retries", "or", "not", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java#L998-L1006
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/ST_AsGeoJSON.java
ST_AsGeoJSON.toGeojsonPoint
public static void toGeojsonPoint(Point point, StringBuilder sb) { Coordinate coord = point.getCoordinate(); sb.append("{\"type\":\"Point\",\"coordinates\":["); sb.append(coord.x).append(",").append(coord.y); if (!Double.isNaN(coord.z)) { sb.append(",").append(coord.z); } sb.append("]}"); }
java
public static void toGeojsonPoint(Point point, StringBuilder sb) { Coordinate coord = point.getCoordinate(); sb.append("{\"type\":\"Point\",\"coordinates\":["); sb.append(coord.x).append(",").append(coord.y); if (!Double.isNaN(coord.z)) { sb.append(",").append(coord.z); } sb.append("]}"); }
[ "public", "static", "void", "toGeojsonPoint", "(", "Point", "point", ",", "StringBuilder", "sb", ")", "{", "Coordinate", "coord", "=", "point", ".", "getCoordinate", "(", ")", ";", "sb", ".", "append", "(", "\"{\\\"type\\\":\\\"Point\\\",\\\"coordinates\\\":[\"", ...
For type "Point", the "coordinates" member must be a single position. A position is the fundamental geometry construct. The "coordinates" member of a geometry object is composed of one position (in the case of a Point geometry), an array of positions (LineString or MultiPoint geometries), an array of arrays of positions (Polygons, MultiLineStrings), or a multidimensional array of positions (MultiPolygon). A position is represented by an array of numbers. There must be at least two elements, and may be more. The order of elements must follow x, y, z order (easting, northing, altitude for coordinates in a projected coordinate reference system, or longitude, latitude, altitude for coordinates in a geographic coordinate reference system). Any number of additional elements are allowed -- interpretation and meaning of additional elements is beyond the scope of this specification. Syntax: { "type": "Point", "coordinates": [100.0, 0.0] } @param point @param sb
[ "For", "type", "Point", "the", "coordinates", "member", "must", "be", "a", "single", "position", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/ST_AsGeoJSON.java#L106-L114