repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
Whiley/WhileyCompiler
src/main/java/wyil/type/util/ReadWriteTypeExtractor.java
ReadWriteTypeExtractor.intersectionHelper
protected static SemanticType intersectionHelper(SemanticType lhs, SemanticType rhs) { if (lhs.equals(rhs)) { return lhs; } else if (lhs instanceof Type.Void) { return lhs; } else if (rhs instanceof Type.Void) { return rhs; } else { return new SemanticType.Intersection(new SemanticType[] { lhs, rhs }); } }
java
protected static SemanticType intersectionHelper(SemanticType lhs, SemanticType rhs) { if (lhs.equals(rhs)) { return lhs; } else if (lhs instanceof Type.Void) { return lhs; } else if (rhs instanceof Type.Void) { return rhs; } else { return new SemanticType.Intersection(new SemanticType[] { lhs, rhs }); } }
[ "protected", "static", "SemanticType", "intersectionHelper", "(", "SemanticType", "lhs", ",", "SemanticType", "rhs", ")", "{", "if", "(", "lhs", ".", "equals", "(", "rhs", ")", ")", "{", "return", "lhs", ";", "}", "else", "if", "(", "lhs", "instanceof", ...
Provides a simplistic form of type intersect which, in some cases, does slightly better than simply creating a new intersection. For example, intersecting <code>int</code> with <code>int</code> will return <code>int</code> rather than <code>int&int</code>. @param lhs @param rhs @return
[ "Provides", "a", "simplistic", "form", "of", "type", "intersect", "which", "in", "some", "cases", "does", "slightly", "better", "than", "simply", "creating", "a", "new", "intersection", ".", "For", "example", "intersecting", "<code", ">", "int<", "/", "code", ...
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/type/util/ReadWriteTypeExtractor.java#L872-L882
rwl/CSparseJ
src/main/java/edu/emory/mathcs/csparsej/tdouble/Dcs_entry.java
Dcs_entry.cs_entry
public static boolean cs_entry(Dcs T, int i, int j, double x) { if (!Dcs_util.CS_TRIPLET(T) || i < 0 || j < 0) return (false); /* check inputs */ if (T.nz >= T.nzmax) { Dcs_util.cs_sprealloc(T, 2 * (T.nzmax)); } if (T.x != null) T.x[T.nz] = x; T.i[T.nz] = i; T.p[T.nz++] = j; T.m = Math.max(T.m, i + 1); T.n = Math.max(T.n, j + 1); return (true); }
java
public static boolean cs_entry(Dcs T, int i, int j, double x) { if (!Dcs_util.CS_TRIPLET(T) || i < 0 || j < 0) return (false); /* check inputs */ if (T.nz >= T.nzmax) { Dcs_util.cs_sprealloc(T, 2 * (T.nzmax)); } if (T.x != null) T.x[T.nz] = x; T.i[T.nz] = i; T.p[T.nz++] = j; T.m = Math.max(T.m, i + 1); T.n = Math.max(T.n, j + 1); return (true); }
[ "public", "static", "boolean", "cs_entry", "(", "Dcs", "T", ",", "int", "i", ",", "int", "j", ",", "double", "x", ")", "{", "if", "(", "!", "Dcs_util", ".", "CS_TRIPLET", "(", "T", ")", "||", "i", "<", "0", "||", "j", "<", "0", ")", "return", ...
Adds an entry to a triplet matrix. Memory-space and dimension of T are increased if necessary. @param T triplet matrix; new entry added on output @param i row index of new entry @param j column index of new entry @param x numerical value of new entry @return true if successful, false otherwise
[ "Adds", "an", "entry", "to", "a", "triplet", "matrix", ".", "Memory", "-", "space", "and", "dimension", "of", "T", "are", "increased", "if", "necessary", "." ]
train
https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tdouble/Dcs_entry.java#L50-L63
aws/aws-sdk-java
aws-java-sdk-simpledb/src/main/java/com/amazonaws/services/simpledb/util/SimpleDBUtils.java
SimpleDBUtils.decodeRealNumberRangeFloat
public static float decodeRealNumberRangeFloat(String value, int maxDigitsRight, int offsetValue) { long offsetNumber = Long.parseLong(value, 10); int shiftMultiplier = (int) Math.pow(10, maxDigitsRight); double tempVal = (double) (offsetNumber - offsetValue * shiftMultiplier); return (float) (tempVal / (double) (shiftMultiplier)); }
java
public static float decodeRealNumberRangeFloat(String value, int maxDigitsRight, int offsetValue) { long offsetNumber = Long.parseLong(value, 10); int shiftMultiplier = (int) Math.pow(10, maxDigitsRight); double tempVal = (double) (offsetNumber - offsetValue * shiftMultiplier); return (float) (tempVal / (double) (shiftMultiplier)); }
[ "public", "static", "float", "decodeRealNumberRangeFloat", "(", "String", "value", ",", "int", "maxDigitsRight", ",", "int", "offsetValue", ")", "{", "long", "offsetNumber", "=", "Long", ".", "parseLong", "(", "value", ",", "10", ")", ";", "int", "shiftMultipl...
Decodes float value from the string representation that was created by using encodeRealNumberRange(..) function. @param value string representation of the integer value @param maxDigitsRight maximum number of digits left of the decimal point in the largest absolute value in the data set (must be the same as the one used for encoding). @param offsetValue offset value that was used in the original encoding @return original float value
[ "Decodes", "float", "value", "from", "the", "string", "representation", "that", "was", "created", "by", "using", "encodeRealNumberRange", "(", "..", ")", "function", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-simpledb/src/main/java/com/amazonaws/services/simpledb/util/SimpleDBUtils.java#L274-L279
google/closure-compiler
src/com/google/javascript/jscomp/CheckAccessControls.java
CheckAccessControls.checkPropertyDeprecation
private void checkPropertyDeprecation(NodeTraversal t, PropertyReference propRef) { if (!shouldEmitDeprecationWarning(t, propRef)) { return; } // Don't bother checking constructors. if (propRef.getSourceNode().getParent().isNew()) { return; } ObjectType objectType = castToObject(dereference(propRef.getReceiverType())); String propertyName = propRef.getName(); if (objectType != null) { String deprecationInfo = getPropertyDeprecationInfo(objectType, propertyName); if (deprecationInfo != null) { if (!deprecationInfo.isEmpty()) { compiler.report( JSError.make( propRef.getSourceNode(), DEPRECATED_PROP_REASON, propertyName, propRef.getReadableTypeNameOrDefault(), deprecationInfo)); } else { compiler.report( JSError.make( propRef.getSourceNode(), DEPRECATED_PROP, propertyName, propRef.getReadableTypeNameOrDefault())); } } } }
java
private void checkPropertyDeprecation(NodeTraversal t, PropertyReference propRef) { if (!shouldEmitDeprecationWarning(t, propRef)) { return; } // Don't bother checking constructors. if (propRef.getSourceNode().getParent().isNew()) { return; } ObjectType objectType = castToObject(dereference(propRef.getReceiverType())); String propertyName = propRef.getName(); if (objectType != null) { String deprecationInfo = getPropertyDeprecationInfo(objectType, propertyName); if (deprecationInfo != null) { if (!deprecationInfo.isEmpty()) { compiler.report( JSError.make( propRef.getSourceNode(), DEPRECATED_PROP_REASON, propertyName, propRef.getReadableTypeNameOrDefault(), deprecationInfo)); } else { compiler.report( JSError.make( propRef.getSourceNode(), DEPRECATED_PROP, propertyName, propRef.getReadableTypeNameOrDefault())); } } } }
[ "private", "void", "checkPropertyDeprecation", "(", "NodeTraversal", "t", ",", "PropertyReference", "propRef", ")", "{", "if", "(", "!", "shouldEmitDeprecationWarning", "(", "t", ",", "propRef", ")", ")", "{", "return", ";", "}", "// Don't bother checking constructo...
Checks the given GETPROP node to ensure that access restrictions are obeyed.
[ "Checks", "the", "given", "GETPROP", "node", "to", "ensure", "that", "access", "restrictions", "are", "obeyed", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CheckAccessControls.java#L471-L508
xmlet/XsdAsmFaster
src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmVisitor.java
XsdAsmVisitor.generateVisitors
static void generateVisitors(Set<String> elementNames, List<XsdAttribute> attributes, String apiName){ generateVisitorInterface(elementNames, filterAttributes(attributes), apiName); }
java
static void generateVisitors(Set<String> elementNames, List<XsdAttribute> attributes, String apiName){ generateVisitorInterface(elementNames, filterAttributes(attributes), apiName); }
[ "static", "void", "generateVisitors", "(", "Set", "<", "String", ">", "elementNames", ",", "List", "<", "XsdAttribute", ">", "attributes", ",", "String", "apiName", ")", "{", "generateVisitorInterface", "(", "elementNames", ",", "filterAttributes", "(", "attribute...
Generates both the abstract visitor class with methods for each element from the list. @param elementNames The elements names list. @param apiName The name of the generated fluent interface.
[ "Generates", "both", "the", "abstract", "visitor", "class", "with", "methods", "for", "each", "element", "from", "the", "list", "." ]
train
https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmVisitor.java#L34-L36
infinispan/infinispan
core/src/main/java/org/infinispan/util/concurrent/locks/StripedLock.java
StripedLock.acquireAllLocks
public void acquireAllLocks(List<Object> keys, boolean exclusive) { for (Object k : keys) { acquireLock(k, exclusive); } }
java
public void acquireAllLocks(List<Object> keys, boolean exclusive) { for (Object k : keys) { acquireLock(k, exclusive); } }
[ "public", "void", "acquireAllLocks", "(", "List", "<", "Object", ">", "keys", ",", "boolean", "exclusive", ")", "{", "for", "(", "Object", "k", ":", "keys", ")", "{", "acquireLock", "(", "k", ",", "exclusive", ")", ";", "}", "}" ]
Acquires locks on keys passed in. Makes multiple calls to {@link #acquireLock(Object, boolean)} @param keys keys to unlock @param exclusive whether locks are exclusive.
[ "Acquires", "locks", "on", "keys", "passed", "in", ".", "Makes", "multiple", "calls", "to", "{", "@link", "#acquireLock", "(", "Object", "boolean", ")", "}" ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/util/concurrent/locks/StripedLock.java#L171-L175
JOML-CI/JOML
src/org/joml/Matrix4f.java
Matrix4f.setOrtho
public Matrix4f setOrtho(float left, float right, float bottom, float top, float zNear, float zFar, boolean zZeroToOne) { if ((properties & PROPERTY_IDENTITY) == 0) MemUtil.INSTANCE.identity(this); this._m00(2.0f / (right - left)); this._m11(2.0f / (top - bottom)); this._m22((zZeroToOne ? 1.0f : 2.0f) / (zNear - zFar)); this._m30((right + left) / (left - right)); this._m31((top + bottom) / (bottom - top)); this._m32((zZeroToOne ? zNear : (zFar + zNear)) / (zNear - zFar)); _properties(PROPERTY_AFFINE); return this; }
java
public Matrix4f setOrtho(float left, float right, float bottom, float top, float zNear, float zFar, boolean zZeroToOne) { if ((properties & PROPERTY_IDENTITY) == 0) MemUtil.INSTANCE.identity(this); this._m00(2.0f / (right - left)); this._m11(2.0f / (top - bottom)); this._m22((zZeroToOne ? 1.0f : 2.0f) / (zNear - zFar)); this._m30((right + left) / (left - right)); this._m31((top + bottom) / (bottom - top)); this._m32((zZeroToOne ? zNear : (zFar + zNear)) / (zNear - zFar)); _properties(PROPERTY_AFFINE); return this; }
[ "public", "Matrix4f", "setOrtho", "(", "float", "left", ",", "float", "right", ",", "float", "bottom", ",", "float", "top", ",", "float", "zNear", ",", "float", "zFar", ",", "boolean", "zZeroToOne", ")", "{", "if", "(", "(", "properties", "&", "PROPERTY_...
Set this matrix to be an orthographic projection transformation for a right-handed coordinate system using the given NDC z range. <p> In order to apply the orthographic projection to an already existing transformation, use {@link #ortho(float, float, float, float, float, float, boolean) ortho()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #ortho(float, float, float, float, float, float, boolean) @param left the distance from the center to the left frustum edge @param right the distance from the center to the right frustum edge @param bottom the distance from the center to the bottom frustum edge @param top the distance from the center to the top frustum edge @param zNear near clipping plane distance @param zFar far clipping plane distance @param zZeroToOne whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code> or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code> @return this
[ "Set", "this", "matrix", "to", "be", "an", "orthographic", "projection", "transformation", "for", "a", "right", "-", "handed", "coordinate", "system", "using", "the", "given", "NDC", "z", "range", ".", "<p", ">", "In", "order", "to", "apply", "the", "ortho...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L7188-L7199
kiswanij/jk-util
src/main/java/com/jk/util/exceptions/handler/JKExceptionHandlerFactory.java
JKExceptionHandlerFactory.setHandler
public void setHandler(final Class<? extends Throwable> clas, final JKExceptionHandler handler) { this.handlers.put(clas, handler); }
java
public void setHandler(final Class<? extends Throwable> clas, final JKExceptionHandler handler) { this.handlers.put(clas, handler); }
[ "public", "void", "setHandler", "(", "final", "Class", "<", "?", "extends", "Throwable", ">", "clas", ",", "final", "JKExceptionHandler", "handler", ")", "{", "this", ".", "handlers", ".", "put", "(", "clas", ",", "handler", ")", ";", "}" ]
Sets the handler. @param clas the clas @param handler the handler
[ "Sets", "the", "handler", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/exceptions/handler/JKExceptionHandlerFactory.java#L113-L115
Azure/azure-sdk-for-java
kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/EventHubConnectionsInner.java
EventHubConnectionsInner.beginUpdateAsync
public Observable<EventHubConnectionInner> beginUpdateAsync(String resourceGroupName, String clusterName, String databaseName, String eventHubConnectionName, EventHubConnectionUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, eventHubConnectionName, parameters).map(new Func1<ServiceResponse<EventHubConnectionInner>, EventHubConnectionInner>() { @Override public EventHubConnectionInner call(ServiceResponse<EventHubConnectionInner> response) { return response.body(); } }); }
java
public Observable<EventHubConnectionInner> beginUpdateAsync(String resourceGroupName, String clusterName, String databaseName, String eventHubConnectionName, EventHubConnectionUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, eventHubConnectionName, parameters).map(new Func1<ServiceResponse<EventHubConnectionInner>, EventHubConnectionInner>() { @Override public EventHubConnectionInner call(ServiceResponse<EventHubConnectionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "EventHubConnectionInner", ">", "beginUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "clusterName", ",", "String", "databaseName", ",", "String", "eventHubConnectionName", ",", "EventHubConnectionUpdate", "parameters", ")", "...
Updates a Event Hub connection. @param resourceGroupName The name of the resource group containing the Kusto cluster. @param clusterName The name of the Kusto cluster. @param databaseName The name of the database in the Kusto cluster. @param eventHubConnectionName The name of the event hub connection. @param parameters The Event Hub connection parameters supplied to the Update operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the EventHubConnectionInner object
[ "Updates", "a", "Event", "Hub", "connection", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/EventHubConnectionsInner.java#L736-L743
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/InsertRawHelper.java
InsertRawHelper.generateJavaDocReturnType
public static void generateJavaDocReturnType(MethodSpec.Builder methodBuilder, TypeName returnType) { if (returnType == TypeName.VOID) { } else if (TypeUtility.isTypeIncludedIn(returnType, Boolean.TYPE, Boolean.class)) { methodBuilder.addJavadoc("\n"); methodBuilder.addJavadoc("@return <code>true</code> if record is inserted, <code>false</code> otherwise"); } else if (TypeUtility.isTypeIncludedIn(returnType, Long.TYPE, Long.class)) { methodBuilder.addJavadoc("\n"); methodBuilder.addJavadoc("@return <strong>id</strong> of inserted record"); } else if (TypeUtility.isTypeIncludedIn(returnType, Integer.TYPE, Integer.class)) { methodBuilder.addJavadoc("\n"); methodBuilder.addJavadoc("@return <strong>id</strong> of inserted record"); } methodBuilder.addJavadoc("\n"); }
java
public static void generateJavaDocReturnType(MethodSpec.Builder methodBuilder, TypeName returnType) { if (returnType == TypeName.VOID) { } else if (TypeUtility.isTypeIncludedIn(returnType, Boolean.TYPE, Boolean.class)) { methodBuilder.addJavadoc("\n"); methodBuilder.addJavadoc("@return <code>true</code> if record is inserted, <code>false</code> otherwise"); } else if (TypeUtility.isTypeIncludedIn(returnType, Long.TYPE, Long.class)) { methodBuilder.addJavadoc("\n"); methodBuilder.addJavadoc("@return <strong>id</strong> of inserted record"); } else if (TypeUtility.isTypeIncludedIn(returnType, Integer.TYPE, Integer.class)) { methodBuilder.addJavadoc("\n"); methodBuilder.addJavadoc("@return <strong>id</strong> of inserted record"); } methodBuilder.addJavadoc("\n"); }
[ "public", "static", "void", "generateJavaDocReturnType", "(", "MethodSpec", ".", "Builder", "methodBuilder", ",", "TypeName", "returnType", ")", "{", "if", "(", "returnType", "==", "TypeName", ".", "VOID", ")", "{", "}", "else", "if", "(", "TypeUtility", ".", ...
Generate javadoc about return type of method. @param methodBuilder the method builder @param returnType the return type
[ "Generate", "javadoc", "about", "return", "type", "of", "method", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/InsertRawHelper.java#L287-L301
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/list/Interval.java
Interval.oneToBy
public static Interval oneToBy(int count, int step) { if (count < 1) { throw new IllegalArgumentException("Only positive ranges allowed using oneToBy"); } return Interval.fromToBy(1, count, step); }
java
public static Interval oneToBy(int count, int step) { if (count < 1) { throw new IllegalArgumentException("Only positive ranges allowed using oneToBy"); } return Interval.fromToBy(1, count, step); }
[ "public", "static", "Interval", "oneToBy", "(", "int", "count", ",", "int", "step", ")", "{", "if", "(", "count", "<", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Only positive ranges allowed using oneToBy\"", ")", ";", "}", "return", "I...
Returns an Interval starting from 1 to the specified count value with a step value of step.
[ "Returns", "an", "Interval", "starting", "from", "1", "to", "the", "specified", "count", "value", "with", "a", "step", "value", "of", "step", "." ]
train
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/Interval.java#L148-L155
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/misc/Pattern.java
Pattern.repeat
public static Pattern repeat(Pattern pattern, int min, int max) { if (pattern == null) { throw new IllegalArgumentException("Pattern can not be null"); } return new RepeatPattern(pattern, min, max); }
java
public static Pattern repeat(Pattern pattern, int min, int max) { if (pattern == null) { throw new IllegalArgumentException("Pattern can not be null"); } return new RepeatPattern(pattern, min, max); }
[ "public", "static", "Pattern", "repeat", "(", "Pattern", "pattern", ",", "int", "min", ",", "int", "max", ")", "{", "if", "(", "pattern", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Pattern can not be null\"", ")", ";", "}", ...
A pattern which matches <code>pattern</code> as many times as possible but at least <code>min</code> times and at most <code>max</code> times. @param pattern @param min @param max @return
[ "A", "pattern", "which", "matches", "<code", ">", "pattern<", "/", "code", ">", "as", "many", "times", "as", "possible", "but", "at", "least", "<code", ">", "min<", "/", "code", ">", "times", "and", "at", "most", "<code", ">", "max<", "/", "code", ">...
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/misc/Pattern.java#L209-L216
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java
DateFunctions.datePartStr
public static Expression datePartStr(String expression, DatePartExt part) { return datePartStr(x(expression), part); }
java
public static Expression datePartStr(String expression, DatePartExt part) { return datePartStr(x(expression), part); }
[ "public", "static", "Expression", "datePartStr", "(", "String", "expression", ",", "DatePartExt", "part", ")", "{", "return", "datePartStr", "(", "x", "(", "expression", ")", ",", "part", ")", ";", "}" ]
Returned expression results in Date part as an integer. The date expression is a string in a supported format, and part is one of the supported date part strings.
[ "Returned", "expression", "results", "in", "Date", "part", "as", "an", "integer", ".", "The", "date", "expression", "is", "a", "string", "in", "a", "supported", "format", "and", "part", "is", "one", "of", "the", "supported", "date", "part", "strings", "." ...
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java#L164-L166
anotheria/moskito
moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/AbstractMoskitoAspect.java
AbstractMoskitoAspect.createAccumulators
private void createAccumulators(final OnDemandStatsProducer<S> producer, final Class producerClass, AccumulateWithSubClasses... annotations) { for (final AccumulateWithSubClasses annotation : annotations) if (annotation != null) AccumulatorUtil.getInstance(producerClass).createAccumulator(producer, annotation); }
java
private void createAccumulators(final OnDemandStatsProducer<S> producer, final Class producerClass, AccumulateWithSubClasses... annotations) { for (final AccumulateWithSubClasses annotation : annotations) if (annotation != null) AccumulatorUtil.getInstance(producerClass).createAccumulator(producer, annotation); }
[ "private", "void", "createAccumulators", "(", "final", "OnDemandStatsProducer", "<", "S", ">", "producer", ",", "final", "Class", "producerClass", ",", "AccumulateWithSubClasses", "...", "annotations", ")", "{", "for", "(", "final", "AccumulateWithSubClasses", "annota...
Create class level accumulators from {@link AccumulateWithSubClasses} annotations. @param producer {@link OnDemandStatsProducer} @param producerClass producer class @param annotations {@link AccumulateWithSubClasses} annotations to process
[ "Create", "class", "level", "accumulators", "from", "{", "@link", "AccumulateWithSubClasses", "}", "annotations", "." ]
train
https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/AbstractMoskitoAspect.java#L281-L285
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.examplesMethodWithServiceResponseAsync
public Observable<ServiceResponse<List<LabelTextObject>>> examplesMethodWithServiceResponseAsync(UUID appId, String versionId, String modelId, ExamplesMethodOptionalParameter examplesMethodOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } if (modelId == null) { throw new IllegalArgumentException("Parameter modelId is required and cannot be null."); } final Integer skip = examplesMethodOptionalParameter != null ? examplesMethodOptionalParameter.skip() : null; final Integer take = examplesMethodOptionalParameter != null ? examplesMethodOptionalParameter.take() : null; return examplesMethodWithServiceResponseAsync(appId, versionId, modelId, skip, take); }
java
public Observable<ServiceResponse<List<LabelTextObject>>> examplesMethodWithServiceResponseAsync(UUID appId, String versionId, String modelId, ExamplesMethodOptionalParameter examplesMethodOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } if (modelId == null) { throw new IllegalArgumentException("Parameter modelId is required and cannot be null."); } final Integer skip = examplesMethodOptionalParameter != null ? examplesMethodOptionalParameter.skip() : null; final Integer take = examplesMethodOptionalParameter != null ? examplesMethodOptionalParameter.take() : null; return examplesMethodWithServiceResponseAsync(appId, versionId, modelId, skip, take); }
[ "public", "Observable", "<", "ServiceResponse", "<", "List", "<", "LabelTextObject", ">", ">", ">", "examplesMethodWithServiceResponseAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "String", "modelId", ",", "ExamplesMethodOptionalParameter", "examplesMet...
Gets the utterances for the given model in the given app version. @param appId The application ID. @param versionId The version ID. @param modelId The ID (GUID) of the model. @param examplesMethodOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;LabelTextObject&gt; object
[ "Gets", "the", "utterances", "for", "the", "given", "model", "in", "the", "given", "app", "version", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L2672-L2689
akquinet/needle
src/main/java/de/akquinet/jbosscc/needle/reflection/ReflectionUtil.java
ReflectionUtil.getFieldValue
public static Object getFieldValue(final Object object, final Class<?> clazz, final String fieldName) { try { final Field field = clazz.getDeclaredField(fieldName); return getFieldValue(object, field); } catch (final Exception e) { throw new IllegalArgumentException("Could not get field value: " + fieldName, e); } }
java
public static Object getFieldValue(final Object object, final Class<?> clazz, final String fieldName) { try { final Field field = clazz.getDeclaredField(fieldName); return getFieldValue(object, field); } catch (final Exception e) { throw new IllegalArgumentException("Could not get field value: " + fieldName, e); } }
[ "public", "static", "Object", "getFieldValue", "(", "final", "Object", "object", ",", "final", "Class", "<", "?", ">", "clazz", ",", "final", "String", "fieldName", ")", "{", "try", "{", "final", "Field", "field", "=", "clazz", ".", "getDeclaredField", "("...
Get the value of a given field on a given object via reflection. @param object -- target object of field access @param clazz -- type of argument object @param fieldName -- name of the field @return -- the value of the represented field in object; primitive values are wrapped in an appropriate object before being returned
[ "Get", "the", "value", "of", "a", "given", "field", "on", "a", "given", "object", "via", "reflection", "." ]
train
https://github.com/akquinet/needle/blob/8b411c521246b8212882485edc01644f9aac7e24/src/main/java/de/akquinet/jbosscc/needle/reflection/ReflectionUtil.java#L235-L242
mygreen/super-csv-annotation
src/main/java/com/github/mygreen/supercsv/cellprocessor/format/ParseProcessor.java
ParseProcessor.checkPreconditions
private static <T> void checkPreconditions(final Class<T> type, final TextParser<T> parser) { if(type == null) { throw new NullPointerException("type is null."); } if(parser == null) { throw new NullPointerException("parser is null."); } }
java
private static <T> void checkPreconditions(final Class<T> type, final TextParser<T> parser) { if(type == null) { throw new NullPointerException("type is null."); } if(parser == null) { throw new NullPointerException("parser is null."); } }
[ "private", "static", "<", "T", ">", "void", "checkPreconditions", "(", "final", "Class", "<", "T", ">", "type", ",", "final", "TextParser", "<", "T", ">", "parser", ")", "{", "if", "(", "type", "==", "null", ")", "{", "throw", "new", "NullPointerExcept...
コンスタによるインスタンスを生成する際の前提条件となる引数のチェックを行う。 @throws NullPointerException type or parser is null.
[ "コンスタによるインスタンスを生成する際の前提条件となる引数のチェックを行う。", "@throws", "NullPointerException", "type", "or", "parser", "is", "null", "." ]
train
https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/cellprocessor/format/ParseProcessor.java#L43-L51
Stratio/stratio-cassandra
src/java/org/apache/cassandra/config/TriggerDefinition.java
TriggerDefinition.fromSchema
public static List<TriggerDefinition> fromSchema(Row serializedTriggers) { List<TriggerDefinition> triggers = new ArrayList<>(); String query = String.format("SELECT * FROM %s.%s", Keyspace.SYSTEM_KS, SystemKeyspace.SCHEMA_TRIGGERS_CF); for (UntypedResultSet.Row row : QueryProcessor.resultify(query, serializedTriggers)) { String name = row.getString(TRIGGER_NAME); String classOption = row.getMap(TRIGGER_OPTIONS, UTF8Type.instance, UTF8Type.instance).get(CLASS); triggers.add(new TriggerDefinition(name, classOption)); } return triggers; }
java
public static List<TriggerDefinition> fromSchema(Row serializedTriggers) { List<TriggerDefinition> triggers = new ArrayList<>(); String query = String.format("SELECT * FROM %s.%s", Keyspace.SYSTEM_KS, SystemKeyspace.SCHEMA_TRIGGERS_CF); for (UntypedResultSet.Row row : QueryProcessor.resultify(query, serializedTriggers)) { String name = row.getString(TRIGGER_NAME); String classOption = row.getMap(TRIGGER_OPTIONS, UTF8Type.instance, UTF8Type.instance).get(CLASS); triggers.add(new TriggerDefinition(name, classOption)); } return triggers; }
[ "public", "static", "List", "<", "TriggerDefinition", ">", "fromSchema", "(", "Row", "serializedTriggers", ")", "{", "List", "<", "TriggerDefinition", ">", "triggers", "=", "new", "ArrayList", "<>", "(", ")", ";", "String", "query", "=", "String", ".", "form...
Deserialize triggers from storage-level representation. @param serializedTriggers storage-level partition containing the trigger definitions @return the list of processed TriggerDefinitions
[ "Deserialize", "triggers", "from", "storage", "-", "level", "representation", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/config/TriggerDefinition.java#L61-L72
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSchema.java
JSchema.setAccessors
private void setAccessors(int bias, JMFSchema schema) { int nextBoxBias = bias + fields.length + variants.length; for (int i = 0; i < fields.length; i++) { JSField field = fields[i]; if (field instanceof JSVariant) { JSchema boxed = (JSchema) ((JSVariant)field).getBoxed(); boxed.setAccessors(nextBoxBias, schema); // Copy accessors from the top type of the box to the visible variant JSVariant boxVar = (JSVariant) boxed.getJMFType(); field.setAccessor(boxVar.getAccessor(boxed), boxed); field.setAccessor(boxVar.getAccessor(schema), schema); ((JSVariant) field).setBoxAccessor(i + bias, schema); nextBoxBias += boxed.getAccessorCount(); } else field.setAccessor(i + bias, schema); } for (int i = 0; i < variants.length; i++) variants[i].setAccessor(i + bias + fields.length, schema); }
java
private void setAccessors(int bias, JMFSchema schema) { int nextBoxBias = bias + fields.length + variants.length; for (int i = 0; i < fields.length; i++) { JSField field = fields[i]; if (field instanceof JSVariant) { JSchema boxed = (JSchema) ((JSVariant)field).getBoxed(); boxed.setAccessors(nextBoxBias, schema); // Copy accessors from the top type of the box to the visible variant JSVariant boxVar = (JSVariant) boxed.getJMFType(); field.setAccessor(boxVar.getAccessor(boxed), boxed); field.setAccessor(boxVar.getAccessor(schema), schema); ((JSVariant) field).setBoxAccessor(i + bias, schema); nextBoxBias += boxed.getAccessorCount(); } else field.setAccessor(i + bias, schema); } for (int i = 0; i < variants.length; i++) variants[i].setAccessor(i + bias + fields.length, schema); }
[ "private", "void", "setAccessors", "(", "int", "bias", ",", "JMFSchema", "schema", ")", "{", "int", "nextBoxBias", "=", "bias", "+", "fields", ".", "length", "+", "variants", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "field...
permits retrieval of accessors relative to box schemas as well as the public schema.
[ "permits", "retrieval", "of", "accessors", "relative", "to", "box", "schemas", "as", "well", "as", "the", "public", "schema", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSchema.java#L672-L691
samskivert/samskivert
src/main/java/com/samskivert/util/ClassUtil.java
ClassUtil.getFields
public static void getFields (Class<?> clazz, List<Field> addTo) { // first get the fields of the superclass Class<?> pclazz = clazz.getSuperclass(); if (pclazz != null && !pclazz.equals(Object.class)) { getFields(pclazz, addTo); } // then reflect on this class's declared fields Field[] fields; try { fields = clazz.getDeclaredFields(); } catch (SecurityException se) { System.err.println("Unable to get declared fields of " + clazz.getName() + ": " + se); fields = new Field[0]; } // override the default accessibility check for the fields try { AccessibleObject.setAccessible(fields, true); } catch (SecurityException se) { // ah well, only publics for us } for (Field field : fields) { int mods = field.getModifiers(); if (Modifier.isStatic(mods) || Modifier.isTransient(mods)) { continue; // skip static and transient fields } addTo.add(field); } }
java
public static void getFields (Class<?> clazz, List<Field> addTo) { // first get the fields of the superclass Class<?> pclazz = clazz.getSuperclass(); if (pclazz != null && !pclazz.equals(Object.class)) { getFields(pclazz, addTo); } // then reflect on this class's declared fields Field[] fields; try { fields = clazz.getDeclaredFields(); } catch (SecurityException se) { System.err.println("Unable to get declared fields of " + clazz.getName() + ": " + se); fields = new Field[0]; } // override the default accessibility check for the fields try { AccessibleObject.setAccessible(fields, true); } catch (SecurityException se) { // ah well, only publics for us } for (Field field : fields) { int mods = field.getModifiers(); if (Modifier.isStatic(mods) || Modifier.isTransient(mods)) { continue; // skip static and transient fields } addTo.add(field); } }
[ "public", "static", "void", "getFields", "(", "Class", "<", "?", ">", "clazz", ",", "List", "<", "Field", ">", "addTo", ")", "{", "// first get the fields of the superclass", "Class", "<", "?", ">", "pclazz", "=", "clazz", ".", "getSuperclass", "(", ")", "...
Add all the fields of the specifed class (and its ancestors) to the list. Note, if we are running in a sandbox, this will only enumerate public members.
[ "Add", "all", "the", "fields", "of", "the", "specifed", "class", "(", "and", "its", "ancestors", ")", "to", "the", "list", ".", "Note", "if", "we", "are", "running", "in", "a", "sandbox", "this", "will", "only", "enumerate", "public", "members", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/ClassUtil.java#L48-L79
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/stats/StatsInterface.java
StatsInterface.getPhotostreamReferrers
public ReferrerList getPhotostreamReferrers(Date date, String domain, int perPage, int page) throws FlickrException { return getReferrers(METHOD_GET_PHOTOSTREAM_REFERRERS, domain, null, null, date, perPage, page); }
java
public ReferrerList getPhotostreamReferrers(Date date, String domain, int perPage, int page) throws FlickrException { return getReferrers(METHOD_GET_PHOTOSTREAM_REFERRERS, domain, null, null, date, perPage, page); }
[ "public", "ReferrerList", "getPhotostreamReferrers", "(", "Date", "date", ",", "String", "domain", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "return", "getReferrers", "(", "METHOD_GET_PHOTOSTREAM_REFERRERS", ",", "domain", ","...
Get a list of referrers from a given domain to a user's photostream. @param date (Required) Stats will be returned for this date. A day according to Flickr Stats starts at midnight GMT for all users, and timestamps will automatically be rounded down to the start of the day. @param domain (Required) The domain to return referrers for. This should be a hostname (eg: "flickr.com") with no protocol or pathname. @param perPage (Optional) Number of domains to return per page. If this argument is omitted, it defaults to 25. The maximum allowed value is 100. @param page (Optional) The page of results to return. If this argument is omitted, it defaults to 1. @see "http://www.flickr.com/services/api/flickr.stats.getPhotostreamReferrers.html"
[ "Get", "a", "list", "of", "referrers", "from", "a", "given", "domain", "to", "a", "user", "s", "photostream", "." ]
train
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/stats/StatsInterface.java#L289-L291
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/lang/AtomicBiInteger.java
AtomicBiInteger.compareAndSetLo
public boolean compareAndSetLo(int expectLo, int lo) { while (true) { long encoded = get(); if (getLo(encoded) != expectLo) return false; long update = encodeLo(encoded, lo); if (compareAndSet(encoded, update)) return true; } }
java
public boolean compareAndSetLo(int expectLo, int lo) { while (true) { long encoded = get(); if (getLo(encoded) != expectLo) return false; long update = encodeLo(encoded, lo); if (compareAndSet(encoded, update)) return true; } }
[ "public", "boolean", "compareAndSetLo", "(", "int", "expectLo", ",", "int", "lo", ")", "{", "while", "(", "true", ")", "{", "long", "encoded", "=", "get", "(", ")", ";", "if", "(", "getLo", "(", "encoded", ")", "!=", "expectLo", ")", "return", "false...
<p>Atomically sets the lo value to the given updated value only if the current value {@code ==} the expected value.</p> <p>Concurrent changes to the hi value result in a retry.</p> @param expectLo the expected lo value @param lo the new lo value @return {@code true} if successful. False return indicates that the actual lo value was not equal to the expected lo value.
[ "<p", ">", "Atomically", "sets", "the", "lo", "value", "to", "the", "given", "updated", "value", "only", "if", "the", "current", "value", "{", "@code", "==", "}", "the", "expected", "value", ".", "<", "/", "p", ">", "<p", ">", "Concurrent", "changes", ...
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/lang/AtomicBiInteger.java#L94-L103
liyiorg/weixin-popular
src/main/java/weixin/popular/api/MediaAPI.java
MediaAPI.mediaGet
public static MediaGetResult mediaGet(String access_token,String media_id,boolean use_http){ String http_s = use_http?BASE_URI.replace("https", "http"):BASE_URI; HttpUriRequest httpUriRequest = RequestBuilder.get() .setUri(http_s + "/cgi-bin/media/get") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .addParameter("media_id", media_id) .build(); return LocalHttpClient.execute(httpUriRequest,BytesOrJsonResponseHandler.createResponseHandler(MediaGetResult.class)); }
java
public static MediaGetResult mediaGet(String access_token,String media_id,boolean use_http){ String http_s = use_http?BASE_URI.replace("https", "http"):BASE_URI; HttpUriRequest httpUriRequest = RequestBuilder.get() .setUri(http_s + "/cgi-bin/media/get") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .addParameter("media_id", media_id) .build(); return LocalHttpClient.execute(httpUriRequest,BytesOrJsonResponseHandler.createResponseHandler(MediaGetResult.class)); }
[ "public", "static", "MediaGetResult", "mediaGet", "(", "String", "access_token", ",", "String", "media_id", ",", "boolean", "use_http", ")", "{", "String", "http_s", "=", "use_http", "?", "BASE_URI", ".", "replace", "(", "\"https\"", ",", "\"http\"", ")", ":",...
获取临时素材 @since 2.8.0 @param access_token access_token @param media_id media_id @param use_http 视频素材使用[http] true,其它使用[https] false. @return MediaGetResult
[ "获取临时素材" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/MediaAPI.java#L152-L160
astrapi69/mystic-crypt
crypt-data/src/main/java/de/alpharogroup/crypto/key/PrivateKeyExtensions.java
PrivateKeyExtensions.toPemFormat
public static String toPemFormat(final PrivateKey privateKey) throws IOException { return PemObjectReader.toPemFormat( new PemObject(PrivateKeyReader.RSA_PRIVATE_KEY, toPKCS1Format(privateKey))); }
java
public static String toPemFormat(final PrivateKey privateKey) throws IOException { return PemObjectReader.toPemFormat( new PemObject(PrivateKeyReader.RSA_PRIVATE_KEY, toPKCS1Format(privateKey))); }
[ "public", "static", "String", "toPemFormat", "(", "final", "PrivateKey", "privateKey", ")", "throws", "IOException", "{", "return", "PemObjectReader", ".", "toPemFormat", "(", "new", "PemObject", "(", "PrivateKeyReader", ".", "RSA_PRIVATE_KEY", ",", "toPKCS1Format", ...
Transform the given private key that is in PKCS1 format and returns a {@link String} object in pem format. @param privateKey the private key @return the {@link String} object in pem format generated from the given private key. @throws IOException Signals that an I/O exception has occurred.
[ "Transform", "the", "given", "private", "key", "that", "is", "in", "PKCS1", "format", "and", "returns", "a", "{", "@link", "String", "}", "object", "in", "pem", "format", "." ]
train
https://github.com/astrapi69/mystic-crypt/blob/7f51ef5e4457e24de7ff391f10bfc5609e6f1a34/crypt-data/src/main/java/de/alpharogroup/crypto/key/PrivateKeyExtensions.java#L213-L217
metafacture/metafacture-core
metafacture-biblio/src/main/java/org/metafacture/biblio/iso2709/Iso646ByteBuffer.java
Iso646ByteBuffer.distanceTo
int distanceTo(final byte byteValue, final int fromIndex) { assert 0 <= fromIndex && fromIndex < byteArray.length; int index = fromIndex; for (; index < byteArray.length; ++index) { if (byteValue == byteArray[index]) { break; } } return index - fromIndex; }
java
int distanceTo(final byte byteValue, final int fromIndex) { assert 0 <= fromIndex && fromIndex < byteArray.length; int index = fromIndex; for (; index < byteArray.length; ++index) { if (byteValue == byteArray[index]) { break; } } return index - fromIndex; }
[ "int", "distanceTo", "(", "final", "byte", "byteValue", ",", "final", "int", "fromIndex", ")", "{", "assert", "0", "<=", "fromIndex", "&&", "fromIndex", "<", "byteArray", ".", "length", ";", "int", "index", "=", "fromIndex", ";", "for", "(", ";", "index"...
Returns the distance from {@code fromIndex} to the next occurrence of {@code byteValue}. If the byte at {@code fromIndex} is equal to {@code byteValue} zero is returned. If there are no matching bytes between {@code fromIndex} and the end of the buffer then the distance to the end of the buffer is returned. @param byteValue byte to search for. @param fromIndex the position in the buffer from which to start searching. @return the distance in bytes to the next byte with the given value or if none is found to the end of the buffer.
[ "Returns", "the", "distance", "from", "{", "@code", "fromIndex", "}", "to", "the", "next", "occurrence", "of", "{", "@code", "byteValue", "}", ".", "If", "the", "byte", "at", "{", "@code", "fromIndex", "}", "is", "equal", "to", "{", "@code", "byteValue",...
train
https://github.com/metafacture/metafacture-core/blob/cb43933ec8eb01a4ddce4019c14b2415cc441918/metafacture-biblio/src/main/java/org/metafacture/biblio/iso2709/Iso646ByteBuffer.java#L82-L91
DV8FromTheWorld/JDA
src/main/java/net/dv8tion/jda/webhook/WebhookCluster.java
WebhookCluster.broadcast
public List<RequestFuture<?>> broadcast(MessageEmbed first, MessageEmbed... embeds) { return broadcast(WebhookMessage.embeds(first, embeds)); }
java
public List<RequestFuture<?>> broadcast(MessageEmbed first, MessageEmbed... embeds) { return broadcast(WebhookMessage.embeds(first, embeds)); }
[ "public", "List", "<", "RequestFuture", "<", "?", ">", ">", "broadcast", "(", "MessageEmbed", "first", ",", "MessageEmbed", "...", "embeds", ")", "{", "return", "broadcast", "(", "WebhookMessage", ".", "embeds", "(", "first", ",", "embeds", ")", ")", ";", ...
Sends the provided {@link net.dv8tion.jda.core.entities.MessageEmbed MessageEmbeds} to all registered {@link net.dv8tion.jda.webhook.WebhookClient WebhookClients}. <p><b>You can send up to 10 embeds per message! If more are sent they will not be displayed.</b> <p>Hint: Use {@link net.dv8tion.jda.core.EmbedBuilder EmbedBuilder} to create a {@link net.dv8tion.jda.core.entities.MessageEmbed MessageEmbeds} instance! @param first The first embed to send to the clients @param embeds The other embeds that should be sent to the clients @throws java.lang.IllegalArgumentException If any of the provided arguments is {@code null} @throws java.util.concurrent.RejectedExecutionException If any of the receivers has been shutdown @return A list of {@link java.util.concurrent.Future Future} instances representing all message tasks.
[ "Sends", "the", "provided", "{", "@link", "net", ".", "dv8tion", ".", "jda", ".", "core", ".", "entities", ".", "MessageEmbed", "MessageEmbeds", "}", "to", "all", "registered", "{", "@link", "net", ".", "dv8tion", ".", "jda", ".", "webhook", ".", "Webhoo...
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/webhook/WebhookCluster.java#L661-L664
myriadmobile/shove
library/src/main/java/com/myriadmobile/library/shove/SimpleNotificationDelegate.java
SimpleNotificationDelegate.onReceive
@Override public void onReceive(Context context, Intent notification) { GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(context); String messageType = gcm.getMessageType(notification); Bundle extras = notification.getExtras(); if (!extras.isEmpty() && GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)) { showNotification(context, extras); } }
java
@Override public void onReceive(Context context, Intent notification) { GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(context); String messageType = gcm.getMessageType(notification); Bundle extras = notification.getExtras(); if (!extras.isEmpty() && GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)) { showNotification(context, extras); } }
[ "@", "Override", "public", "void", "onReceive", "(", "Context", "context", ",", "Intent", "notification", ")", "{", "GoogleCloudMessaging", "gcm", "=", "GoogleCloudMessaging", ".", "getInstance", "(", "context", ")", ";", "String", "messageType", "=", "gcm", "."...
Called when a notification is received @param context the service context @param notification the notification intent
[ "Called", "when", "a", "notification", "is", "received" ]
train
https://github.com/myriadmobile/shove/blob/71ab329cdbaef5bdc2b75e43af1393308c4c1eed/library/src/main/java/com/myriadmobile/library/shove/SimpleNotificationDelegate.java#L79-L88
RestComm/sip-servlets
sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java
FacebookRestClient.feed_publishTemplatizedAction
public boolean feed_publishTemplatizedAction(CharSequence titleTemplate, Long pageActorId) throws FacebookException, IOException { return feed_publishTemplatizedAction(titleTemplate, null, null, null, null, null, null, pageActorId); }
java
public boolean feed_publishTemplatizedAction(CharSequence titleTemplate, Long pageActorId) throws FacebookException, IOException { return feed_publishTemplatizedAction(titleTemplate, null, null, null, null, null, null, pageActorId); }
[ "public", "boolean", "feed_publishTemplatizedAction", "(", "CharSequence", "titleTemplate", ",", "Long", "pageActorId", ")", "throws", "FacebookException", ",", "IOException", "{", "return", "feed_publishTemplatizedAction", "(", "titleTemplate", ",", "null", ",", "null", ...
Publishes a Mini-Feed story describing an action taken by the logged-in user (or, if <code>pageActorId</code> is provided, page), and publishes aggregating News Feed stories to the user's friends/page's fans. Stories are identified as being combinable if they have matching templates and substituted values. @param titleTemplate markup (up to 60 chars, tags excluded) for the feed story's title section. Must include the token <code>{actor}</code>. @param pageActorId (optional) the ID of the page into whose mini-feed the story is being published @return whether the action story was successfully published; false in case of a permission error @see <a href="http://wiki.developers.facebook.com/index.php/Feed.publishTemplatizedAction"> Developers Wiki: Feed.publishTemplatizedAction</a> @see <a href="http://developers.facebook.com/tools.php?feed"> Developers Resources: Feed Preview Console </a>
[ "Publishes", "a", "Mini", "-", "Feed", "story", "describing", "an", "action", "taken", "by", "the", "logged", "-", "in", "user", "(", "or", "if", "<code", ">", "pageActorId<", "/", "code", ">", "is", "provided", "page", ")", "and", "publishes", "aggregat...
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L427-L430
sagiegurari/fax4j
src/main/java/org/fax4j/spi/http/MultiPartFaxJob2HTTPRequestConverter.java
MultiPartFaxJob2HTTPRequestConverter.createHTTPRequest
public HTTPRequest createHTTPRequest(HTTPFaxClientSpi faxClientSpi,FaxActionType faxActionType,FaxJob faxJob) { //setup common request data HTTPRequest httpRequest=this.createCommonHTTPRequest(faxClientSpi,faxActionType); //create content List<ContentPart<?>> contentList=new LinkedList<HTTPRequest.ContentPart<?>>(); switch(faxActionType) { case SUBMIT_FAX_JOB: String value=faxJob.getTargetAddress(); this.addContentPart(contentList,this.submitTargetAddressParameter,value); value=faxJob.getTargetName(); this.addContentPart(contentList,this.submitTargetNameParameter,value); value=faxJob.getSenderName(); this.addContentPart(contentList,this.submitSenderNameParameter,value); value=faxJob.getSenderFaxNumber(); this.addContentPart(contentList,this.submitSenderFaxNumberParameter,value); value=faxJob.getSenderEmail(); this.addContentPart(contentList,this.submitSenderEMailParameter,value); File file=faxJob.getFile(); contentList.add(new ContentPart<File>(this.submitFileContentParameter,file,ContentPartType.FILE)); if(this.shouldAddFileNamePart()) { value=file.getName(); this.addContentPart(contentList,this.submitFileNameParameter,value); } break; case SUSPEND_FAX_JOB: this.addContentPart(contentList,this.suspendFaxJobIDParameter,faxJob.getID()); break; case RESUME_FAX_JOB: this.addContentPart(contentList,this.resumeFaxJobIDParameter,faxJob.getID()); break; case CANCEL_FAX_JOB: this.addContentPart(contentList,this.cancelFaxJobIDParameter,faxJob.getID()); break; case GET_FAX_JOB_STATUS: this.addContentPart(contentList,this.getStatusFaxJobIDParameter,faxJob.getID()); break; default: throw new FaxException("Fax action type: "+faxActionType+" not supported."); } //add additional parameters this.addAdditionalParameters(contentList); //add additional parts this.addAdditionalContentParts(faxClientSpi,faxActionType,faxJob,contentList); //convert to array ContentPart<?>[] content=contentList.toArray(new ContentPart<?>[contentList.size()]); //set content httpRequest.setContent(content); return httpRequest; }
java
public HTTPRequest createHTTPRequest(HTTPFaxClientSpi faxClientSpi,FaxActionType faxActionType,FaxJob faxJob) { //setup common request data HTTPRequest httpRequest=this.createCommonHTTPRequest(faxClientSpi,faxActionType); //create content List<ContentPart<?>> contentList=new LinkedList<HTTPRequest.ContentPart<?>>(); switch(faxActionType) { case SUBMIT_FAX_JOB: String value=faxJob.getTargetAddress(); this.addContentPart(contentList,this.submitTargetAddressParameter,value); value=faxJob.getTargetName(); this.addContentPart(contentList,this.submitTargetNameParameter,value); value=faxJob.getSenderName(); this.addContentPart(contentList,this.submitSenderNameParameter,value); value=faxJob.getSenderFaxNumber(); this.addContentPart(contentList,this.submitSenderFaxNumberParameter,value); value=faxJob.getSenderEmail(); this.addContentPart(contentList,this.submitSenderEMailParameter,value); File file=faxJob.getFile(); contentList.add(new ContentPart<File>(this.submitFileContentParameter,file,ContentPartType.FILE)); if(this.shouldAddFileNamePart()) { value=file.getName(); this.addContentPart(contentList,this.submitFileNameParameter,value); } break; case SUSPEND_FAX_JOB: this.addContentPart(contentList,this.suspendFaxJobIDParameter,faxJob.getID()); break; case RESUME_FAX_JOB: this.addContentPart(contentList,this.resumeFaxJobIDParameter,faxJob.getID()); break; case CANCEL_FAX_JOB: this.addContentPart(contentList,this.cancelFaxJobIDParameter,faxJob.getID()); break; case GET_FAX_JOB_STATUS: this.addContentPart(contentList,this.getStatusFaxJobIDParameter,faxJob.getID()); break; default: throw new FaxException("Fax action type: "+faxActionType+" not supported."); } //add additional parameters this.addAdditionalParameters(contentList); //add additional parts this.addAdditionalContentParts(faxClientSpi,faxActionType,faxJob,contentList); //convert to array ContentPart<?>[] content=contentList.toArray(new ContentPart<?>[contentList.size()]); //set content httpRequest.setContent(content); return httpRequest; }
[ "public", "HTTPRequest", "createHTTPRequest", "(", "HTTPFaxClientSpi", "faxClientSpi", ",", "FaxActionType", "faxActionType", ",", "FaxJob", "faxJob", ")", "{", "//setup common request data", "HTTPRequest", "httpRequest", "=", "this", ".", "createCommonHTTPRequest", "(", ...
Creates the HTTP request from the fax job data. @param faxClientSpi The HTTP fax client SPI @param faxActionType The fax action type @param faxJob The fax job object @return The HTTP request to send
[ "Creates", "the", "HTTP", "request", "from", "the", "fax", "job", "data", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/http/MultiPartFaxJob2HTTPRequestConverter.java#L392-L449
micronaut-projects/micronaut-core
http-netty/src/main/java/io/micronaut/http/netty/stream/HttpStreamsHandler.java
HttpStreamsHandler.removeHandlerIfActive
private void removeHandlerIfActive(ChannelHandlerContext ctx, String name) { if (ctx.channel().isActive()) { ChannelPipeline pipeline = ctx.pipeline(); ChannelHandler handler = pipeline.get(name); if (handler != null) { pipeline.remove(name); } } }
java
private void removeHandlerIfActive(ChannelHandlerContext ctx, String name) { if (ctx.channel().isActive()) { ChannelPipeline pipeline = ctx.pipeline(); ChannelHandler handler = pipeline.get(name); if (handler != null) { pipeline.remove(name); } } }
[ "private", "void", "removeHandlerIfActive", "(", "ChannelHandlerContext", "ctx", ",", "String", "name", ")", "{", "if", "(", "ctx", ".", "channel", "(", ")", ".", "isActive", "(", ")", ")", "{", "ChannelPipeline", "pipeline", "=", "ctx", ".", "pipeline", "...
Most operations we want to do even if the channel is not active, because if it's not, then we want to encounter the error that occurs when that operation happens and so that it can be passed up to the user. However, removing handlers should only be done if the channel is active, because the error that is encountered when they aren't makes no sense to the user (NoSuchElementException).
[ "Most", "operations", "we", "want", "to", "do", "even", "if", "the", "channel", "is", "not", "active", "because", "if", "it", "s", "not", "then", "we", "want", "to", "encounter", "the", "error", "that", "occurs", "when", "that", "operation", "happens", "...
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/http-netty/src/main/java/io/micronaut/http/netty/stream/HttpStreamsHandler.java#L379-L387
spotify/helios
helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java
ZooKeeperMasterModel.listHosts
@Override public List<String> listHosts() { try { // TODO (dano): only return hosts whose agents completed registration (i.e. has id nodes) return provider.get("listHosts").getChildren(Paths.configHosts()); } catch (KeeperException.NoNodeException e) { return emptyList(); } catch (KeeperException e) { throw new HeliosRuntimeException("listing hosts failed", e); } }
java
@Override public List<String> listHosts() { try { // TODO (dano): only return hosts whose agents completed registration (i.e. has id nodes) return provider.get("listHosts").getChildren(Paths.configHosts()); } catch (KeeperException.NoNodeException e) { return emptyList(); } catch (KeeperException e) { throw new HeliosRuntimeException("listing hosts failed", e); } }
[ "@", "Override", "public", "List", "<", "String", ">", "listHosts", "(", ")", "{", "try", "{", "// TODO (dano): only return hosts whose agents completed registration (i.e. has id nodes)", "return", "provider", ".", "get", "(", "\"listHosts\"", ")", ".", "getChildren", "...
Returns a list of the hosts/agents that have been registered.
[ "Returns", "a", "list", "of", "the", "hosts", "/", "agents", "that", "have", "been", "registered", "." ]
train
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java#L194-L204
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/grid/Grid.java
Grid.getGridCellsOn
@Pure public Iterable<GridCell<P>> getGridCellsOn(Rectangle2afp<?, ?, ?, ?, ?, ?> bounds) { return getGridCellsOn(bounds, false); }
java
@Pure public Iterable<GridCell<P>> getGridCellsOn(Rectangle2afp<?, ?, ?, ?, ?, ?> bounds) { return getGridCellsOn(bounds, false); }
[ "@", "Pure", "public", "Iterable", "<", "GridCell", "<", "P", ">", ">", "getGridCellsOn", "(", "Rectangle2afp", "<", "?", ",", "?", ",", "?", ",", "?", ",", "?", ",", "?", ">", "bounds", ")", "{", "return", "getGridCellsOn", "(", "bounds", ",", "fa...
Replies the grid cells that are intersecting the specified bounds. @param bounds the bounds. @return the grid cells.
[ "Replies", "the", "grid", "cells", "that", "are", "intersecting", "the", "specified", "bounds", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/grid/Grid.java#L278-L281
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.deleteCompositeEntityChild
public OperationStatus deleteCompositeEntityChild(UUID appId, String versionId, UUID cEntityId, UUID cChildId) { return deleteCompositeEntityChildWithServiceResponseAsync(appId, versionId, cEntityId, cChildId).toBlocking().single().body(); }
java
public OperationStatus deleteCompositeEntityChild(UUID appId, String versionId, UUID cEntityId, UUID cChildId) { return deleteCompositeEntityChildWithServiceResponseAsync(appId, versionId, cEntityId, cChildId).toBlocking().single().body(); }
[ "public", "OperationStatus", "deleteCompositeEntityChild", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "cEntityId", ",", "UUID", "cChildId", ")", "{", "return", "deleteCompositeEntityChildWithServiceResponseAsync", "(", "appId", ",", "versionId", ",",...
Deletes a composite entity extractor child from the application. @param appId The application ID. @param versionId The version ID. @param cEntityId The composite entity extractor ID. @param cChildId The hierarchical entity extractor child ID. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatus object if successful.
[ "Deletes", "a", "composite", "entity", "extractor", "child", "from", "the", "application", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L7022-L7024
mockito/mockito
src/main/java/org/mockito/AdditionalAnswers.java
AdditionalAnswers.answersWithDelay
@Incubating public static <T> Answer<T> answersWithDelay(long sleepyTime, Answer<T> answer) { return (Answer<T>) new AnswersWithDelay(sleepyTime, (Answer<Object>) answer); }
java
@Incubating public static <T> Answer<T> answersWithDelay(long sleepyTime, Answer<T> answer) { return (Answer<T>) new AnswersWithDelay(sleepyTime, (Answer<Object>) answer); }
[ "@", "Incubating", "public", "static", "<", "T", ">", "Answer", "<", "T", ">", "answersWithDelay", "(", "long", "sleepyTime", ",", "Answer", "<", "T", ">", "answer", ")", "{", "return", "(", "Answer", "<", "T", ">", ")", "new", "AnswersWithDelay", "(",...
Returns an answer after a delay with a defined length. @param <T> return type @param sleepyTime the delay in milliseconds @param answer interface to the answer which provides the intended return value. @return the answer object to use @since 2.8.44
[ "Returns", "an", "answer", "after", "a", "delay", "with", "a", "defined", "length", "." ]
train
https://github.com/mockito/mockito/blob/c5e2b80af76e3192cae7c9550b70c4d1ab312034/src/main/java/org/mockito/AdditionalAnswers.java#L333-L336
Esri/geometry-api-java
src/main/java/com/esri/core/geometry/GeometryEngine.java
GeometryEngine.geometryToJson
public static String geometryToJson(int wkid, Geometry geometry) { return GeometryEngine.geometryToJson( wkid > 0 ? SpatialReference.create(wkid) : null, geometry); }
java
public static String geometryToJson(int wkid, Geometry geometry) { return GeometryEngine.geometryToJson( wkid > 0 ? SpatialReference.create(wkid) : null, geometry); }
[ "public", "static", "String", "geometryToJson", "(", "int", "wkid", ",", "Geometry", "geometry", ")", "{", "return", "GeometryEngine", ".", "geometryToJson", "(", "wkid", ">", "0", "?", "SpatialReference", ".", "create", "(", "wkid", ")", ":", "null", ",", ...
Exports the specified geometry instance to it's JSON representation. See OperatorExportToJson. @see GeometryEngine#geometryToJson(SpatialReference spatialiReference, Geometry geometry) @param wkid The spatial reference Well Known ID to be used for the JSON representation. @param geometry The geometry to be exported to JSON. @return The JSON representation of the specified Geometry.
[ "Exports", "the", "specified", "geometry", "instance", "to", "it", "s", "JSON", "representation", "." ]
train
https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/GeometryEngine.java#L111-L114
youseries/urule
urule-core/src/main/java/com/bstek/urule/model/rete/builder/CriterionBuilder.java
CriterionBuilder.buildNamedCriteria
protected NamedCriteriaNode buildNamedCriteria(NamedCriteria criteria,ConditionNode prevNode,BuildContext context){ /*if(prevNode!=null){ NamedCriteriaNode targetNode=null; String objectType=context.getObjectType(criteria); String prevObjectType=context.getObjectType(criteria); if(objectType.equals(prevObjectType)){ List<ReteNode> prevChildrenNodes=prevNode.getChildrenNodes(); targetNode = fetchExistNamedCriteriaNode(criteria, prevChildrenNodes); if(targetNode==null){ targetNode=new NamedCriteriaNode(criteria,context.nextId()); prevNode.addLine(targetNode); } }else{ targetNode=buildNewTypeNamedCriteria(criteria,context); } return targetNode; }else{ NamedCriteriaNode node=buildNewTypeNamedCriteria(criteria,context); return node; }*/ NamedCriteriaNode node=buildNewTypeNamedCriteria(criteria,context); return node; }
java
protected NamedCriteriaNode buildNamedCriteria(NamedCriteria criteria,ConditionNode prevNode,BuildContext context){ /*if(prevNode!=null){ NamedCriteriaNode targetNode=null; String objectType=context.getObjectType(criteria); String prevObjectType=context.getObjectType(criteria); if(objectType.equals(prevObjectType)){ List<ReteNode> prevChildrenNodes=prevNode.getChildrenNodes(); targetNode = fetchExistNamedCriteriaNode(criteria, prevChildrenNodes); if(targetNode==null){ targetNode=new NamedCriteriaNode(criteria,context.nextId()); prevNode.addLine(targetNode); } }else{ targetNode=buildNewTypeNamedCriteria(criteria,context); } return targetNode; }else{ NamedCriteriaNode node=buildNewTypeNamedCriteria(criteria,context); return node; }*/ NamedCriteriaNode node=buildNewTypeNamedCriteria(criteria,context); return node; }
[ "protected", "NamedCriteriaNode", "buildNamedCriteria", "(", "NamedCriteria", "criteria", ",", "ConditionNode", "prevNode", ",", "BuildContext", "context", ")", "{", "/*if(prevNode!=null){\n\t\t\tNamedCriteriaNode targetNode=null;\n\t\t\tString objectType=context.getObjectType(criteria);...
带reference name的条件比较特殊,它不需要判断是否有父节点,需要将所有节点都直接挂在ObjectTypeNode下 @param criteria 命名条件对象 @param prevNode 上一节点对象 @param context 上下文对象 @return 返回命名条件节点对象
[ "带reference", "name的条件比较特殊,它不需要判断是否有父节点,需要将所有节点都直接挂在ObjectTypeNode下" ]
train
https://github.com/youseries/urule/blob/3fa0eb4439e97aa292e744bcbd88a9faa36661d8/urule-core/src/main/java/com/bstek/urule/model/rete/builder/CriterionBuilder.java#L79-L101
graknlabs/grakn
server/src/graql/gremlin/sets/EquivalentFragmentSets.java
EquivalentFragmentSets.dataType
public static EquivalentFragmentSet dataType(VarProperty varProperty, Variable resourceType, AttributeType.DataType<?> dataType) { return new AutoValue_DataTypeFragmentSet(varProperty, resourceType, dataType); }
java
public static EquivalentFragmentSet dataType(VarProperty varProperty, Variable resourceType, AttributeType.DataType<?> dataType) { return new AutoValue_DataTypeFragmentSet(varProperty, resourceType, dataType); }
[ "public", "static", "EquivalentFragmentSet", "dataType", "(", "VarProperty", "varProperty", ",", "Variable", "resourceType", ",", "AttributeType", ".", "DataType", "<", "?", ">", "dataType", ")", "{", "return", "new", "AutoValue_DataTypeFragmentSet", "(", "varProperty...
An {@link EquivalentFragmentSet} that indicates a variable representing a resource type with a data-type.
[ "An", "{" ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/sets/EquivalentFragmentSets.java#L157-L159
jayantk/jklol
src/com/jayantkrish/jklol/p3/P3Parse.java
P3Parse.getUnevaluatedLogicalForm
public Expression2 getUnevaluatedLogicalForm(Environment env, IndexedList<String> symbolTable) { List<String> newBindings = Lists.newArrayList(); return getUnevaluatedLogicalForm(env, symbolTable, newBindings); }
java
public Expression2 getUnevaluatedLogicalForm(Environment env, IndexedList<String> symbolTable) { List<String> newBindings = Lists.newArrayList(); return getUnevaluatedLogicalForm(env, symbolTable, newBindings); }
[ "public", "Expression2", "getUnevaluatedLogicalForm", "(", "Environment", "env", ",", "IndexedList", "<", "String", ">", "symbolTable", ")", "{", "List", "<", "String", ">", "newBindings", "=", "Lists", ".", "newArrayList", "(", ")", ";", "return", "getUnevaluat...
Gets an expression that evaluates to the denotation of this parse. The expression will not re-evaluate any already evaluated subexpressions of this parse. {@code env} may be extended with additional variable bindings to capture denotations of already-evaluated subparses. @param env @param symbolTable @return
[ "Gets", "an", "expression", "that", "evaluates", "to", "the", "denotation", "of", "this", "parse", ".", "The", "expression", "will", "not", "re", "-", "evaluate", "any", "already", "evaluated", "subexpressions", "of", "this", "parse", ".", "{", "@code", "env...
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/p3/P3Parse.java#L173-L176
JodaOrg/joda-beans
src/main/java/org/joda/beans/gen/BeanData.java
BeanData.getTypeGenericName
public String getTypeGenericName(int typeParamIndex, boolean includeBrackets) { String result = typeGenericName[typeParamIndex]; return includeBrackets && result.length() > 0 ? '<' + result + '>' : result; }
java
public String getTypeGenericName(int typeParamIndex, boolean includeBrackets) { String result = typeGenericName[typeParamIndex]; return includeBrackets && result.length() > 0 ? '<' + result + '>' : result; }
[ "public", "String", "getTypeGenericName", "(", "int", "typeParamIndex", ",", "boolean", "includeBrackets", ")", "{", "String", "result", "=", "typeGenericName", "[", "typeParamIndex", "]", ";", "return", "includeBrackets", "&&", "result", ".", "length", "(", ")", ...
Gets the name of the parameterisation of the bean, such as '{@code <T>}'. @param typeParamIndex the zero-based index of the type parameter @param includeBrackets whether to include brackets @return the generic type name, not null
[ "Gets", "the", "name", "of", "the", "parameterisation", "of", "the", "bean", "such", "as", "{" ]
train
https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/gen/BeanData.java#L883-L886
BlueBrain/bluima
modules/bluima_utils/src/main/java/ch/epfl/bbp/uima/BlueCasUtil.java
BlueCasUtil.fixNoSentences
public static void fixNoSentences(JCas jCas) { Collection<Sentence> sentences = select(jCas, Sentence.class); if (sentences.size() == 0) { String text = jCas.getDocumentText(); Sentence sentence = new Sentence(jCas, 0, text.length()); sentence.addToIndexes(); } }
java
public static void fixNoSentences(JCas jCas) { Collection<Sentence> sentences = select(jCas, Sentence.class); if (sentences.size() == 0) { String text = jCas.getDocumentText(); Sentence sentence = new Sentence(jCas, 0, text.length()); sentence.addToIndexes(); } }
[ "public", "static", "void", "fixNoSentences", "(", "JCas", "jCas", ")", "{", "Collection", "<", "Sentence", ">", "sentences", "=", "select", "(", "jCas", ",", "Sentence", ".", "class", ")", ";", "if", "(", "sentences", ".", "size", "(", ")", "==", "0",...
If this cas has no Sentence annotation, creates one with the whole cas text
[ "If", "this", "cas", "has", "no", "Sentence", "annotation", "creates", "one", "with", "the", "whole", "cas", "text" ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_utils/src/main/java/ch/epfl/bbp/uima/BlueCasUtil.java#L142-L149
imsweb/naaccr-xml
src/main/java/com/imsweb/naaccrxml/NaaccrXmlUtils.java
NaaccrXmlUtils.patientToLine
public static String patientToLine(Patient patient, NaaccrContext context) throws NaaccrIOException { if (patient == null) throw new NaaccrIOException("Patient is required"); if (context == null) throw new NaaccrIOException("Context is required"); // it wouldn't be very hard to support more than one tumor, but will do it only if needed if (patient.getTumors().size() > 1) throw new NaaccrIOException("This method requires a patient with 0 or 1 tumor."); StringWriter buf = new StringWriter(); try (PatientFlatWriter writer = new PatientFlatWriter(buf, new NaaccrData(context.getFormat()), context.getOptions(), context.getUserDictionaries(), context.getStreamConfiguration())) { writer.writePatient(patient); return buf.toString(); } }
java
public static String patientToLine(Patient patient, NaaccrContext context) throws NaaccrIOException { if (patient == null) throw new NaaccrIOException("Patient is required"); if (context == null) throw new NaaccrIOException("Context is required"); // it wouldn't be very hard to support more than one tumor, but will do it only if needed if (patient.getTumors().size() > 1) throw new NaaccrIOException("This method requires a patient with 0 or 1 tumor."); StringWriter buf = new StringWriter(); try (PatientFlatWriter writer = new PatientFlatWriter(buf, new NaaccrData(context.getFormat()), context.getOptions(), context.getUserDictionaries(), context.getStreamConfiguration())) { writer.writePatient(patient); return buf.toString(); } }
[ "public", "static", "String", "patientToLine", "(", "Patient", "patient", ",", "NaaccrContext", "context", ")", "throws", "NaaccrIOException", "{", "if", "(", "patient", "==", "null", ")", "throw", "new", "NaaccrIOException", "(", "\"Patient is required\"", ")", "...
Translates a single patient into a line representing a flat file line. This method expects a patient with 0 or 1 tumor. An exception will be raised if it has more. <br/><br/> Unlike the methods dealing with files, this method takes a context as a parameter. The reason for that difference is that this method uses a stream to convert the patient, and so the stream needs to be re-created every time the method is invoked on a given patient. This is very inefficient and would be too slow if this method was used in a loop (which is the common use-case). Having a shared context that is created once outside the loop avoids that inefficiency. <br/><br/> It is very important to not re-create the context when this method is called in a loop: <br><br/> This is NOT correct: <code> for (Patient patient : patients) NaaccrXmlUtils.patientToLine(patient, new NaaccrContext(NaaccrFormat.NAACCR_FORMAT_16_ABSTRACT)); </code> This is correct: <code> NaaccrContext context = new NaaccrContext(NaaccrFormat.NAACCR_FORMAT_16_ABSTRACT); for (Patient patient : patients) NaaccrXmlUtils.patientToLine(patient, context); </code> @param patient the patient to translate, required @param context the context to use for the translation, required @return the corresponding line, never null @throws NaaccrIOException if there is problem translating the patient
[ "Translates", "a", "single", "patient", "into", "a", "line", "representing", "a", "flat", "file", "line", ".", "This", "method", "expects", "a", "patient", "with", "0", "or", "1", "tumor", ".", "An", "exception", "will", "be", "raised", "if", "it", "has"...
train
https://github.com/imsweb/naaccr-xml/blob/a3a501faa2a0c3411dd5248b2c1379f279131696/src/main/java/com/imsweb/naaccrxml/NaaccrXmlUtils.java#L323-L338
google/error-prone
check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java
ASTHelpers.getGeneratedBy
public static ImmutableSet<String> getGeneratedBy(ClassSymbol symbol, VisitorState state) { checkNotNull(symbol); Optional<Compound> c = Stream.of("javax.annotation.Generated", "javax.annotation.processing.Generated") .map(state::getSymbolFromString) .filter(a -> a != null) .map(symbol::attribute) .filter(a -> a != null) .findFirst(); if (!c.isPresent()) { return ImmutableSet.of(); } Optional<Attribute> values = c.get().getElementValues().entrySet().stream() .filter(e -> e.getKey().getSimpleName().contentEquals("value")) .map(e -> e.getValue()) .findAny(); if (!values.isPresent()) { return ImmutableSet.of(); } ImmutableSet.Builder<String> suppressions = ImmutableSet.builder(); values .get() .accept( new SimpleAnnotationValueVisitor8<Void, Void>() { @Override public Void visitString(String s, Void aVoid) { suppressions.add(s); return super.visitString(s, aVoid); } @Override public Void visitArray(List<? extends AnnotationValue> vals, Void aVoid) { vals.stream().forEachOrdered(v -> v.accept(this, null)); return super.visitArray(vals, aVoid); } }, null); return suppressions.build(); }
java
public static ImmutableSet<String> getGeneratedBy(ClassSymbol symbol, VisitorState state) { checkNotNull(symbol); Optional<Compound> c = Stream.of("javax.annotation.Generated", "javax.annotation.processing.Generated") .map(state::getSymbolFromString) .filter(a -> a != null) .map(symbol::attribute) .filter(a -> a != null) .findFirst(); if (!c.isPresent()) { return ImmutableSet.of(); } Optional<Attribute> values = c.get().getElementValues().entrySet().stream() .filter(e -> e.getKey().getSimpleName().contentEquals("value")) .map(e -> e.getValue()) .findAny(); if (!values.isPresent()) { return ImmutableSet.of(); } ImmutableSet.Builder<String> suppressions = ImmutableSet.builder(); values .get() .accept( new SimpleAnnotationValueVisitor8<Void, Void>() { @Override public Void visitString(String s, Void aVoid) { suppressions.add(s); return super.visitString(s, aVoid); } @Override public Void visitArray(List<? extends AnnotationValue> vals, Void aVoid) { vals.stream().forEachOrdered(v -> v.accept(this, null)); return super.visitArray(vals, aVoid); } }, null); return suppressions.build(); }
[ "public", "static", "ImmutableSet", "<", "String", ">", "getGeneratedBy", "(", "ClassSymbol", "symbol", ",", "VisitorState", "state", ")", "{", "checkNotNull", "(", "symbol", ")", ";", "Optional", "<", "Compound", ">", "c", "=", "Stream", ".", "of", "(", "...
Returns the values of the given symbol's {@code javax.annotation.Generated} or {@code javax.annotation.processing.Generated} annotation, if present.
[ "Returns", "the", "values", "of", "the", "given", "symbol", "s", "{" ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java#L1189-L1228
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/Config.java
Config.setUserContext
public Config setUserContext(ConcurrentMap<String, Object> userContext) { if (userContext == null) { throw new IllegalArgumentException("userContext can't be null"); } this.userContext = userContext; return this; }
java
public Config setUserContext(ConcurrentMap<String, Object> userContext) { if (userContext == null) { throw new IllegalArgumentException("userContext can't be null"); } this.userContext = userContext; return this; }
[ "public", "Config", "setUserContext", "(", "ConcurrentMap", "<", "String", ",", "Object", ">", "userContext", ")", "{", "if", "(", "userContext", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"userContext can't be null\"", ")", ";", ...
Sets the user supplied context. This context can then be obtained from an instance of {@link com.hazelcast.core.HazelcastInstance}. @param userContext the user supplied context @return this config instance @see HazelcastInstance#getUserContext()
[ "Sets", "the", "user", "supplied", "context", ".", "This", "context", "can", "then", "be", "obtained", "from", "an", "instance", "of", "{", "@link", "com", ".", "hazelcast", ".", "core", ".", "HazelcastInstance", "}", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L3305-L3311
di2e/Argo
ProbeSender/src/main/java/ws/argo/transport/probe/standard/MulticastTransport.java
MulticastTransport.sendProbe
@Override public void sendProbe(Probe probe) throws TransportException { LOGGER.info("Sending probe [" + probe.getProbeID() + "] on network inteface [" + networkInterface.getName() + "] at port [" + multicastAddress + ":" + multicastPort + "]"); LOGGER.debug("Probe requesting TTL of [" + probe.getHopLimit() + "]"); try { String msg = probe.asXML(); LOGGER.debug("Probe payload (always XML): \n" + msg); byte[] msgBytes; msgBytes = msg.getBytes(StandardCharsets.UTF_8); // send discovery string InetAddress group = InetAddress.getByName(multicastAddress); DatagramPacket packet = new DatagramPacket(msgBytes, msgBytes.length, group, multicastPort); outboundSocket.setTimeToLive(probe.getHopLimit()); outboundSocket.send(packet); LOGGER.debug("Probe sent on port [" + multicastAddress + ":" + multicastPort + "]"); } catch (IOException e) { throw new TransportException("Unable to send probe. Issue sending UDP packets.", e); } catch (JAXBException e) { throw new TransportException("Unable to send probe because it could not be serialized to XML", e); } }
java
@Override public void sendProbe(Probe probe) throws TransportException { LOGGER.info("Sending probe [" + probe.getProbeID() + "] on network inteface [" + networkInterface.getName() + "] at port [" + multicastAddress + ":" + multicastPort + "]"); LOGGER.debug("Probe requesting TTL of [" + probe.getHopLimit() + "]"); try { String msg = probe.asXML(); LOGGER.debug("Probe payload (always XML): \n" + msg); byte[] msgBytes; msgBytes = msg.getBytes(StandardCharsets.UTF_8); // send discovery string InetAddress group = InetAddress.getByName(multicastAddress); DatagramPacket packet = new DatagramPacket(msgBytes, msgBytes.length, group, multicastPort); outboundSocket.setTimeToLive(probe.getHopLimit()); outboundSocket.send(packet); LOGGER.debug("Probe sent on port [" + multicastAddress + ":" + multicastPort + "]"); } catch (IOException e) { throw new TransportException("Unable to send probe. Issue sending UDP packets.", e); } catch (JAXBException e) { throw new TransportException("Unable to send probe because it could not be serialized to XML", e); } }
[ "@", "Override", "public", "void", "sendProbe", "(", "Probe", "probe", ")", "throws", "TransportException", "{", "LOGGER", ".", "info", "(", "\"Sending probe [\"", "+", "probe", ".", "getProbeID", "(", ")", "+", "\"] on network inteface [\"", "+", "networkInterfac...
Actually send the probe out on the wire. @param probe the Probe instance that has been pre-configured @throws TransportException if something bad happened when sending the probe
[ "Actually", "send", "the", "probe", "out", "on", "the", "wire", "." ]
train
https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/ProbeSender/src/main/java/ws/argo/transport/probe/standard/MulticastTransport.java#L226-L254
lucee/Lucee
core/src/main/java/lucee/runtime/text/xml/XMLCaster.java
XMLCaster._isAllOfSameType
private static boolean _isAllOfSameType(Node[] nodes, short type) { for (int i = 0; i < nodes.length; i++) { if (nodes[i].getNodeType() != type) return false; } return true; }
java
private static boolean _isAllOfSameType(Node[] nodes, short type) { for (int i = 0; i < nodes.length; i++) { if (nodes[i].getNodeType() != type) return false; } return true; }
[ "private", "static", "boolean", "_isAllOfSameType", "(", "Node", "[", "]", "nodes", ",", "short", "type", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nodes", ".", "length", ";", "i", "++", ")", "{", "if", "(", "nodes", "[", "i", ...
Check if all Node are of the type defnined by para,meter @param nodes nodes to check @param type to compare @return are all of the same type
[ "Check", "if", "all", "Node", "are", "of", "the", "type", "defnined", "by", "para", "meter" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/text/xml/XMLCaster.java#L730-L735
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/ThresholdBlock.java
ThresholdBlock.process
public void process(T input , GrayU8 output ) { output.reshape(input.width,input.height); int requestedBlockWidth = this.requestedBlockWidth.computeI(Math.min(input.width,input.height)); selectBlockSize(input.width,input.height,requestedBlockWidth); stats.reshape(input.width/blockWidth,input.height/blockHeight); int innerWidth = input.width%blockWidth == 0 ? input.width : input.width-blockWidth-input.width%blockWidth; int innerHeight = input.height%blockHeight == 0 ? input.height : input.height-blockHeight-input.height%blockHeight; computeStatistics(input, innerWidth, innerHeight); applyThreshold(input,output); }
java
public void process(T input , GrayU8 output ) { output.reshape(input.width,input.height); int requestedBlockWidth = this.requestedBlockWidth.computeI(Math.min(input.width,input.height)); selectBlockSize(input.width,input.height,requestedBlockWidth); stats.reshape(input.width/blockWidth,input.height/blockHeight); int innerWidth = input.width%blockWidth == 0 ? input.width : input.width-blockWidth-input.width%blockWidth; int innerHeight = input.height%blockHeight == 0 ? input.height : input.height-blockHeight-input.height%blockHeight; computeStatistics(input, innerWidth, innerHeight); applyThreshold(input,output); }
[ "public", "void", "process", "(", "T", "input", ",", "GrayU8", "output", ")", "{", "output", ".", "reshape", "(", "input", ".", "width", ",", "input", ".", "height", ")", ";", "int", "requestedBlockWidth", "=", "this", ".", "requestedBlockWidth", ".", "c...
Converts the gray scale input image into a binary image @param input Input image @param output Output binary image
[ "Converts", "the", "gray", "scale", "input", "image", "into", "a", "binary", "image" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/ThresholdBlock.java#L90-L107
spring-projects/spring-ldap
core/src/main/java/org/springframework/ldap/support/LdapUtils.java
LdapUtils.getRdn
public static Rdn getRdn(Name name, String key) { Assert.notNull(name, "name must not be null"); Assert.hasText(key, "key must not be blank"); LdapName ldapName = returnOrConstructLdapNameFromName(name); List<Rdn> rdns = ldapName.getRdns(); for (Rdn rdn : rdns) { NamingEnumeration<String> ids = rdn.toAttributes().getIDs(); while (ids.hasMoreElements()) { String id = ids.nextElement(); if(key.equalsIgnoreCase(id)) { return rdn; } } } throw new NoSuchElementException("No Rdn with the requested key: '" + key + "'"); }
java
public static Rdn getRdn(Name name, String key) { Assert.notNull(name, "name must not be null"); Assert.hasText(key, "key must not be blank"); LdapName ldapName = returnOrConstructLdapNameFromName(name); List<Rdn> rdns = ldapName.getRdns(); for (Rdn rdn : rdns) { NamingEnumeration<String> ids = rdn.toAttributes().getIDs(); while (ids.hasMoreElements()) { String id = ids.nextElement(); if(key.equalsIgnoreCase(id)) { return rdn; } } } throw new NoSuchElementException("No Rdn with the requested key: '" + key + "'"); }
[ "public", "static", "Rdn", "getRdn", "(", "Name", "name", ",", "String", "key", ")", "{", "Assert", ".", "notNull", "(", "name", ",", "\"name must not be null\"", ")", ";", "Assert", ".", "hasText", "(", "key", ",", "\"key must not be blank\"", ")", ";", "...
Find the Rdn with the requested key in the supplied Name. @param name the Name in which to search for the key. @param key the attribute key to search for. @return the rdn corresponding to the <b>first</b> occurrence of the requested key. @throws NoSuchElementException if no corresponding entry is found. @since 2.0
[ "Find", "the", "Rdn", "with", "the", "requested", "key", "in", "the", "supplied", "Name", "." ]
train
https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/support/LdapUtils.java#L506-L524
VoltDB/voltdb
src/frontend/org/voltdb/ProcedureStatsCollector.java
ProcedureStatsCollector.updateStatsRow
@Override protected void updateStatsRow(Object rowKey, Object rowValues[]) { super.updateStatsRow(rowKey, rowValues); rowValues[columnNameToIndex.get("PARTITION_ID")] = m_partitionId; rowValues[columnNameToIndex.get("PROCEDURE")] = m_procName; StatementStats currRow = (StatementStats)rowKey; assert(currRow != null); rowValues[columnNameToIndex.get("STATEMENT")] = currRow.m_stmtName; long invocations = currRow.getInvocations(); long timedInvocations = currRow.getTimedInvocations(); long totalTimedExecutionTime = currRow.getTotalTimedExecutionTime(); long minExecutionTime = currRow.getMinExecutionTime(); long maxExecutionTime = currRow.getMaxExecutionTime(); long abortCount = currRow.getAbortCount(); long failureCount = currRow.getFailureCount(); int minResultSize = currRow.getMinResultSize(); int maxResultSize = currRow.getMaxResultSize(); long totalResultSize = currRow.getTotalResultSize(); int minParameterSetSize = currRow.getMinParameterSetSize(); int maxParameterSetSize = currRow.getMaxParameterSetSize(); long totalParameterSetSize = currRow.getTotalParameterSetSize(); if (m_incremental) { abortCount -= currRow.getLastAbortCountAndReset(); failureCount -= currRow.getLastFailureCountAndReset(); totalTimedExecutionTime -= currRow.getLastTotalTimedExecutionTimeAndReset(); totalResultSize -= currRow.getLastTotalResultSizeAndReset(); totalParameterSetSize -= currRow.getLastTotalParameterSetSizeAndReset(); minExecutionTime = currRow.getIncrementalMinExecutionTimeAndReset(); maxExecutionTime = currRow.getIncrementalMaxExecutionTimeAndReset(); minResultSize = currRow.getIncrementalMinResultSizeAndReset(); maxResultSize = currRow.getIncrementalMaxResultSizeAndReset(); minParameterSetSize = currRow.getIncrementalMinParameterSetSizeAndReset(); maxParameterSetSize = currRow.getIncrementalMaxParameterSetSizeAndReset(); // Notice that invocation numbers must be updated in the end. // Other numbers depend on them for correct behavior. invocations -= currRow.getLastInvocationsAndReset(); timedInvocations -= currRow.getLastTimedInvocationsAndReset(); } rowValues[columnNameToIndex.get("INVOCATIONS")] = invocations; rowValues[columnNameToIndex.get("TIMED_INVOCATIONS")] = timedInvocations; rowValues[columnNameToIndex.get("MIN_EXECUTION_TIME")] = minExecutionTime; rowValues[columnNameToIndex.get("MAX_EXECUTION_TIME")] = maxExecutionTime; if (timedInvocations != 0) { rowValues[columnNameToIndex.get("AVG_EXECUTION_TIME")] = (totalTimedExecutionTime / timedInvocations); rowValues[columnNameToIndex.get("AVG_RESULT_SIZE")] = (totalResultSize / timedInvocations); rowValues[columnNameToIndex.get("AVG_PARAMETER_SET_SIZE")] = (totalParameterSetSize / timedInvocations); } else { rowValues[columnNameToIndex.get("AVG_EXECUTION_TIME")] = 0L; rowValues[columnNameToIndex.get("AVG_RESULT_SIZE")] = 0; rowValues[columnNameToIndex.get("AVG_PARAMETER_SET_SIZE")] = 0; } rowValues[columnNameToIndex.get("ABORTS")] = abortCount; rowValues[columnNameToIndex.get("FAILURES")] = failureCount; rowValues[columnNameToIndex.get("MIN_RESULT_SIZE")] = minResultSize; rowValues[columnNameToIndex.get("MAX_RESULT_SIZE")] = maxResultSize; rowValues[columnNameToIndex.get("MIN_PARAMETER_SET_SIZE")] = minParameterSetSize; rowValues[columnNameToIndex.get("MAX_PARAMETER_SET_SIZE")] = maxParameterSetSize; rowValues[columnNameToIndex.get("TRANSACTIONAL")] = (byte) (m_isTransactional ? 1 : 0); }
java
@Override protected void updateStatsRow(Object rowKey, Object rowValues[]) { super.updateStatsRow(rowKey, rowValues); rowValues[columnNameToIndex.get("PARTITION_ID")] = m_partitionId; rowValues[columnNameToIndex.get("PROCEDURE")] = m_procName; StatementStats currRow = (StatementStats)rowKey; assert(currRow != null); rowValues[columnNameToIndex.get("STATEMENT")] = currRow.m_stmtName; long invocations = currRow.getInvocations(); long timedInvocations = currRow.getTimedInvocations(); long totalTimedExecutionTime = currRow.getTotalTimedExecutionTime(); long minExecutionTime = currRow.getMinExecutionTime(); long maxExecutionTime = currRow.getMaxExecutionTime(); long abortCount = currRow.getAbortCount(); long failureCount = currRow.getFailureCount(); int minResultSize = currRow.getMinResultSize(); int maxResultSize = currRow.getMaxResultSize(); long totalResultSize = currRow.getTotalResultSize(); int minParameterSetSize = currRow.getMinParameterSetSize(); int maxParameterSetSize = currRow.getMaxParameterSetSize(); long totalParameterSetSize = currRow.getTotalParameterSetSize(); if (m_incremental) { abortCount -= currRow.getLastAbortCountAndReset(); failureCount -= currRow.getLastFailureCountAndReset(); totalTimedExecutionTime -= currRow.getLastTotalTimedExecutionTimeAndReset(); totalResultSize -= currRow.getLastTotalResultSizeAndReset(); totalParameterSetSize -= currRow.getLastTotalParameterSetSizeAndReset(); minExecutionTime = currRow.getIncrementalMinExecutionTimeAndReset(); maxExecutionTime = currRow.getIncrementalMaxExecutionTimeAndReset(); minResultSize = currRow.getIncrementalMinResultSizeAndReset(); maxResultSize = currRow.getIncrementalMaxResultSizeAndReset(); minParameterSetSize = currRow.getIncrementalMinParameterSetSizeAndReset(); maxParameterSetSize = currRow.getIncrementalMaxParameterSetSizeAndReset(); // Notice that invocation numbers must be updated in the end. // Other numbers depend on them for correct behavior. invocations -= currRow.getLastInvocationsAndReset(); timedInvocations -= currRow.getLastTimedInvocationsAndReset(); } rowValues[columnNameToIndex.get("INVOCATIONS")] = invocations; rowValues[columnNameToIndex.get("TIMED_INVOCATIONS")] = timedInvocations; rowValues[columnNameToIndex.get("MIN_EXECUTION_TIME")] = minExecutionTime; rowValues[columnNameToIndex.get("MAX_EXECUTION_TIME")] = maxExecutionTime; if (timedInvocations != 0) { rowValues[columnNameToIndex.get("AVG_EXECUTION_TIME")] = (totalTimedExecutionTime / timedInvocations); rowValues[columnNameToIndex.get("AVG_RESULT_SIZE")] = (totalResultSize / timedInvocations); rowValues[columnNameToIndex.get("AVG_PARAMETER_SET_SIZE")] = (totalParameterSetSize / timedInvocations); } else { rowValues[columnNameToIndex.get("AVG_EXECUTION_TIME")] = 0L; rowValues[columnNameToIndex.get("AVG_RESULT_SIZE")] = 0; rowValues[columnNameToIndex.get("AVG_PARAMETER_SET_SIZE")] = 0; } rowValues[columnNameToIndex.get("ABORTS")] = abortCount; rowValues[columnNameToIndex.get("FAILURES")] = failureCount; rowValues[columnNameToIndex.get("MIN_RESULT_SIZE")] = minResultSize; rowValues[columnNameToIndex.get("MAX_RESULT_SIZE")] = maxResultSize; rowValues[columnNameToIndex.get("MIN_PARAMETER_SET_SIZE")] = minParameterSetSize; rowValues[columnNameToIndex.get("MAX_PARAMETER_SET_SIZE")] = maxParameterSetSize; rowValues[columnNameToIndex.get("TRANSACTIONAL")] = (byte) (m_isTransactional ? 1 : 0); }
[ "@", "Override", "protected", "void", "updateStatsRow", "(", "Object", "rowKey", ",", "Object", "rowValues", "[", "]", ")", "{", "super", ".", "updateStatsRow", "(", "rowKey", ",", "rowValues", ")", ";", "rowValues", "[", "columnNameToIndex", ".", "get", "("...
Update the rowValues array with the latest statistical information. This method overrides the super class version which must also be called so that it can update its columns. @param rowKey The corresponding StatementStats structure for this row. @param rowValues Values of each column of the row of stats. Used as output.
[ "Update", "the", "rowValues", "array", "with", "the", "latest", "statistical", "information", ".", "This", "method", "overrides", "the", "super", "class", "version", "which", "must", "also", "be", "called", "so", "that", "it", "can", "update", "its", "columns"...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/ProcedureStatsCollector.java#L281-L345
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/db/cql/CQLService.java
CQLService.getPreparedUpdate
public PreparedStatement getPreparedUpdate(Update update, String storeName) { String tableName = storeToCQLName(storeName); return m_statementCache.getPreparedUpdate(tableName, update); }
java
public PreparedStatement getPreparedUpdate(Update update, String storeName) { String tableName = storeToCQLName(storeName); return m_statementCache.getPreparedUpdate(tableName, update); }
[ "public", "PreparedStatement", "getPreparedUpdate", "(", "Update", "update", ",", "String", "storeName", ")", "{", "String", "tableName", "=", "storeToCQLName", "(", "storeName", ")", ";", "return", "m_statementCache", ".", "getPreparedUpdate", "(", "tableName", ","...
Get the {@link PreparedStatement} for the given {@link CQLStatementCache.Update} to the given table name. If needed, the update statement is compiled and cached. @param update Update statement type. @param storeName Store (ColumnFamily) name. @return PreparedStatement for requested table/update.
[ "Get", "the", "{", "@link", "PreparedStatement", "}", "for", "the", "given", "{", "@link", "CQLStatementCache", ".", "Update", "}", "to", "the", "given", "table", "name", ".", "If", "needed", "the", "update", "statement", "is", "compiled", "and", "cached", ...
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/db/cql/CQLService.java#L262-L265
santhosh-tekuri/jlibs
core/src/main/java/jlibs/core/io/IOUtil.java
IOUtil.readFully
public static int readFully(Reader reader, char ch[], int off, int len) throws IOException{ if(len<0) throw new IndexOutOfBoundsException(); int n = 0; while(n<len){ int count = reader.read(ch, off+n, len-n); if(count<0) return n; n += count; } return n; }
java
public static int readFully(Reader reader, char ch[], int off, int len) throws IOException{ if(len<0) throw new IndexOutOfBoundsException(); int n = 0; while(n<len){ int count = reader.read(ch, off+n, len-n); if(count<0) return n; n += count; } return n; }
[ "public", "static", "int", "readFully", "(", "Reader", "reader", ",", "char", "ch", "[", "]", ",", "int", "off", ",", "int", "len", ")", "throws", "IOException", "{", "if", "(", "len", "<", "0", ")", "throw", "new", "IndexOutOfBoundsException", "(", ")...
Reads <code>len</code> chars from given reader into specified buffer.<br> If the given reader doesn't have <code>len</code> chars available, it simply reads only the availabel number of chars. @param reader input stream from which data is read @param ch the buffer into which the data is read. @param off an int specifying the offset into the data. @param len an int specifying the number of chars to read. @return the number of chars read. if the reader doen't have <code>len</code> chars available it returns the the number of chars read @throws IOException if an I/O error occurs.
[ "Reads", "<code", ">", "len<", "/", "code", ">", "chars", "from", "given", "reader", "into", "specified", "buffer", ".", "<br", ">", "If", "the", "given", "reader", "doesn", "t", "have", "<code", ">", "len<", "/", "code", ">", "chars", "available", "it...
train
https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/io/IOUtil.java#L278-L289
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java
AlbumUtils.setDrawableTint
public static void setDrawableTint(@NonNull Drawable drawable, @ColorInt int color) { DrawableCompat.setTint(DrawableCompat.wrap(drawable.mutate()), color); }
java
public static void setDrawableTint(@NonNull Drawable drawable, @ColorInt int color) { DrawableCompat.setTint(DrawableCompat.wrap(drawable.mutate()), color); }
[ "public", "static", "void", "setDrawableTint", "(", "@", "NonNull", "Drawable", "drawable", ",", "@", "ColorInt", "int", "color", ")", "{", "DrawableCompat", ".", "setTint", "(", "DrawableCompat", ".", "wrap", "(", "drawable", ".", "mutate", "(", ")", ")", ...
Specifies a tint for {@code drawable}. @param drawable drawable target, mutate. @param color color.
[ "Specifies", "a", "tint", "for", "{", "@code", "drawable", "}", "." ]
train
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java#L305-L307
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/ext/action/AbstractAdvancedAction.java
AbstractAdvancedAction.onError
public void onError(Exception parentException, Context context) throws AdvancedActionException { int eventId = (Integer)context.get(InvocationContext.EVENT); if (eventId != ExtendedEvent.READ) { Item item = (Item)context.get(InvocationContext.CURRENT_ITEM); try { item.getSession().refresh(false); } catch (RepositoryException e) { e.initCause(parentException); throw new AdvancedActionException(this.getClass().getName() + " changes rollback failed:", e); } } if (parentException instanceof AdvancedActionException) { throw (AdvancedActionException)parentException; } else { LOG.error(this.getClass().getName() + " throwed an exception:", parentException); } }
java
public void onError(Exception parentException, Context context) throws AdvancedActionException { int eventId = (Integer)context.get(InvocationContext.EVENT); if (eventId != ExtendedEvent.READ) { Item item = (Item)context.get(InvocationContext.CURRENT_ITEM); try { item.getSession().refresh(false); } catch (RepositoryException e) { e.initCause(parentException); throw new AdvancedActionException(this.getClass().getName() + " changes rollback failed:", e); } } if (parentException instanceof AdvancedActionException) { throw (AdvancedActionException)parentException; } else { LOG.error(this.getClass().getName() + " throwed an exception:", parentException); } }
[ "public", "void", "onError", "(", "Exception", "parentException", ",", "Context", "context", ")", "throws", "AdvancedActionException", "{", "int", "eventId", "=", "(", "Integer", ")", "context", ".", "get", "(", "InvocationContext", ".", "EVENT", ")", ";", "if...
Simple implementation of onError() method. It reverts all pending changes of the current JCR session for any kind of event corresponding to a write operation. Then in case the provided parentException is an instance of type AdvancedActionException, it will throw it otherwise it will log simply it. An AdvancedActionException will be thrown in case the changes could not be reverted. @see org.exoplatform.services.jcr.impl.ext.action.AdvancedAction#onError(java.lang.Exception, org.apache.commons.chain.Context)
[ "Simple", "implementation", "of", "onError", "()", "method", ".", "It", "reverts", "all", "pending", "changes", "of", "the", "current", "JCR", "session", "for", "any", "kind", "of", "event", "corresponding", "to", "a", "write", "operation", ".", "Then", "in"...
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/ext/action/AbstractAdvancedAction.java#L45-L69
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java
BugInstance.addUnknownSourceLine
@Nonnull public BugInstance addUnknownSourceLine(String className, String sourceFile) { SourceLineAnnotation sourceLineAnnotation = SourceLineAnnotation.createUnknown(className, sourceFile); if (sourceLineAnnotation != null) { add(sourceLineAnnotation); } return this; }
java
@Nonnull public BugInstance addUnknownSourceLine(String className, String sourceFile) { SourceLineAnnotation sourceLineAnnotation = SourceLineAnnotation.createUnknown(className, sourceFile); if (sourceLineAnnotation != null) { add(sourceLineAnnotation); } return this; }
[ "@", "Nonnull", "public", "BugInstance", "addUnknownSourceLine", "(", "String", "className", ",", "String", "sourceFile", ")", "{", "SourceLineAnnotation", "sourceLineAnnotation", "=", "SourceLineAnnotation", ".", "createUnknown", "(", "className", ",", "sourceFile", ")...
Add a non-specific source line annotation. This will result in the entire source file being displayed. @param className the class name @param sourceFile the source file name @return this object
[ "Add", "a", "non", "-", "specific", "source", "line", "annotation", ".", "This", "will", "result", "in", "the", "entire", "source", "file", "being", "displayed", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java#L1834-L1841
b3log/latke
latke-core/src/main/java/org/b3log/latke/plugin/AbstractPlugin.java
AbstractPlugin.getViewContent
private String getViewContent(final Map<String, Object> dataModel) { if (null == configuration) { initTemplateEngineCfg(); } try { final Template template = configuration.getTemplate("plugin.ftl"); final StringWriter sw = new StringWriter(); template.process(dataModel, sw); return sw.toString(); } catch (final Exception e) { // This plugin has no view return ""; } }
java
private String getViewContent(final Map<String, Object> dataModel) { if (null == configuration) { initTemplateEngineCfg(); } try { final Template template = configuration.getTemplate("plugin.ftl"); final StringWriter sw = new StringWriter(); template.process(dataModel, sw); return sw.toString(); } catch (final Exception e) { // This plugin has no view return ""; } }
[ "private", "String", "getViewContent", "(", "final", "Map", "<", "String", ",", "Object", ">", "dataModel", ")", "{", "if", "(", "null", "==", "configuration", ")", "{", "initTemplateEngineCfg", "(", ")", ";", "}", "try", "{", "final", "Template", "templat...
Gets view content of a plugin. The content is processed with the specified data model by template engine. @param dataModel the specified data model @return plugin view content
[ "Gets", "view", "content", "of", "a", "plugin", ".", "The", "content", "is", "processed", "with", "the", "specified", "data", "model", "by", "template", "engine", "." ]
train
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/plugin/AbstractPlugin.java#L356-L373
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java
SqlDateTimeUtils.toTimestamp
public static Long toTimestamp(String dateStr, TimeZone tz) { int length = dateStr.length(); String format; if (length == 21) { format = DEFAULT_DATETIME_FORMATS[1]; } else if (length == 22) { format = DEFAULT_DATETIME_FORMATS[2]; } else if (length == 23) { format = DEFAULT_DATETIME_FORMATS[3]; } else { // otherwise fall back to the default format = DEFAULT_DATETIME_FORMATS[0]; } return toTimestamp(dateStr, format, tz); }
java
public static Long toTimestamp(String dateStr, TimeZone tz) { int length = dateStr.length(); String format; if (length == 21) { format = DEFAULT_DATETIME_FORMATS[1]; } else if (length == 22) { format = DEFAULT_DATETIME_FORMATS[2]; } else if (length == 23) { format = DEFAULT_DATETIME_FORMATS[3]; } else { // otherwise fall back to the default format = DEFAULT_DATETIME_FORMATS[0]; } return toTimestamp(dateStr, format, tz); }
[ "public", "static", "Long", "toTimestamp", "(", "String", "dateStr", ",", "TimeZone", "tz", ")", "{", "int", "length", "=", "dateStr", ".", "length", "(", ")", ";", "String", "format", ";", "if", "(", "length", "==", "21", ")", "{", "format", "=", "D...
Parse date time string to timestamp based on the given time zone and "yyyy-MM-dd HH:mm:ss" format. Returns null if parsing failed. @param dateStr the date time string @param tz the time zone
[ "Parse", "date", "time", "string", "to", "timestamp", "based", "on", "the", "given", "time", "zone", "and", "yyyy", "-", "MM", "-", "dd", "HH", ":", "mm", ":", "ss", "format", ".", "Returns", "null", "if", "parsing", "failed", "." ]
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#L247-L261
Chorus-bdd/Chorus
interpreter/chorus-interpreter/src/main/java/org/chorusbdd/chorus/interpreter/interpreter/HandlerManager.java
HandlerManager.processStartOfScope
public void processStartOfScope(Scope scopeStarting, Iterable<Object> handlerInstances) throws Exception { for (Object handler : handlerInstances) { Handler handlerAnnotation = handler.getClass().getAnnotation(Handler.class); Scope handlerScope = handlerAnnotation.scope(); injectResourceFieldsForScope(scopeStarting, handler, handlerScope, handlerInstances); runLifecycleMethods(handler, handlerScope, scopeStarting, false); } }
java
public void processStartOfScope(Scope scopeStarting, Iterable<Object> handlerInstances) throws Exception { for (Object handler : handlerInstances) { Handler handlerAnnotation = handler.getClass().getAnnotation(Handler.class); Scope handlerScope = handlerAnnotation.scope(); injectResourceFieldsForScope(scopeStarting, handler, handlerScope, handlerInstances); runLifecycleMethods(handler, handlerScope, scopeStarting, false); } }
[ "public", "void", "processStartOfScope", "(", "Scope", "scopeStarting", ",", "Iterable", "<", "Object", ">", "handlerInstances", ")", "throws", "Exception", "{", "for", "(", "Object", "handler", ":", "handlerInstances", ")", "{", "Handler", "handlerAnnotation", "=...
Scope is starting, perform the required processing on the supplied handlers.
[ "Scope", "is", "starting", "perform", "the", "required", "processing", "on", "the", "supplied", "handlers", "." ]
train
https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-interpreter/src/main/java/org/chorusbdd/chorus/interpreter/interpreter/HandlerManager.java#L117-L125
ops4j/org.ops4j.pax.web
pax-web-undertow/src/main/java/org/ops4j/pax/web/service/undertow/internal/ServerControllerImpl.java
ServerControllerImpl.configureIdentityManager
private void configureIdentityManager(URL undertowResource) { try { Properties props = new Properties(); try (InputStream is = undertowResource.openStream()) { props.load(is); } Map<String, String> config = new LinkedHashMap<>(); for (Map.Entry<Object, Object> entry : props.entrySet()) { config.put(entry.getKey().toString(), entry.getValue().toString()); } identityManager = (IdentityManager)createConfigurationObject(config, "identityManager"); // String listeners = config.get("listeners"); // if (listeners != null) { // String[] names = listeners.split("(, )+"); // for (String name : names) { // String type = config.get("listeners." + name + ".type"); // String address = config.get("listeners." + name + ".address"); // String port = config.get("listeners." + name + ".port"); // if ("http".equals(type)) { // builder.addHttpListener(Integer.parseInt(port), address); // } // } // } } catch (Exception e) { LOG.error("Exception while starting Undertow", e); throw new RuntimeException("Exception while starting Undertow", e); } }
java
private void configureIdentityManager(URL undertowResource) { try { Properties props = new Properties(); try (InputStream is = undertowResource.openStream()) { props.load(is); } Map<String, String> config = new LinkedHashMap<>(); for (Map.Entry<Object, Object> entry : props.entrySet()) { config.put(entry.getKey().toString(), entry.getValue().toString()); } identityManager = (IdentityManager)createConfigurationObject(config, "identityManager"); // String listeners = config.get("listeners"); // if (listeners != null) { // String[] names = listeners.split("(, )+"); // for (String name : names) { // String type = config.get("listeners." + name + ".type"); // String address = config.get("listeners." + name + ".address"); // String port = config.get("listeners." + name + ".port"); // if ("http".equals(type)) { // builder.addHttpListener(Integer.parseInt(port), address); // } // } // } } catch (Exception e) { LOG.error("Exception while starting Undertow", e); throw new RuntimeException("Exception while starting Undertow", e); } }
[ "private", "void", "configureIdentityManager", "(", "URL", "undertowResource", ")", "{", "try", "{", "Properties", "props", "=", "new", "Properties", "(", ")", ";", "try", "(", "InputStream", "is", "=", "undertowResource", ".", "openStream", "(", ")", ")", "...
Loads additional properties and configure {@link ServerControllerImpl#identityManager} @param undertowResource
[ "Loads", "additional", "properties", "and", "configure", "{" ]
train
https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-undertow/src/main/java/org/ops4j/pax/web/service/undertow/internal/ServerControllerImpl.java#L312-L340
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java
VimGenerator2.generatePrimitiveTypes
protected void generatePrimitiveTypes(IStyleAppendable it, Iterable<String> types) { final Iterator<String> iterator = types.iterator(); if (iterator.hasNext()) { appendComment(it, "primitive types."); //$NON-NLS-1$ appendMatch(it, "sarlArrayDeclaration", "\\(\\s*\\[\\s*\\]\\)*", true); //$NON-NLS-1$//$NON-NLS-2$ it.append("syn keyword sarlPrimitiveType"); //$NON-NLS-1$ do { it.append(" "); //$NON-NLS-1$ it.append(iterator.next()); } while (iterator.hasNext()); it.append(" nextgroup=sarlArrayDeclaration").newLine(); //$NON-NLS-1$ appendCluster(it, "sarlPrimitiveType"); //$NON-NLS-1$ hilight("sarlPrimitiveType", VimSyntaxGroup.SPECIAL); //$NON-NLS-1$ hilight("sarlArrayDeclaration", VimSyntaxGroup.SPECIAL); //$NON-NLS-1$ it.newLine(); } }
java
protected void generatePrimitiveTypes(IStyleAppendable it, Iterable<String> types) { final Iterator<String> iterator = types.iterator(); if (iterator.hasNext()) { appendComment(it, "primitive types."); //$NON-NLS-1$ appendMatch(it, "sarlArrayDeclaration", "\\(\\s*\\[\\s*\\]\\)*", true); //$NON-NLS-1$//$NON-NLS-2$ it.append("syn keyword sarlPrimitiveType"); //$NON-NLS-1$ do { it.append(" "); //$NON-NLS-1$ it.append(iterator.next()); } while (iterator.hasNext()); it.append(" nextgroup=sarlArrayDeclaration").newLine(); //$NON-NLS-1$ appendCluster(it, "sarlPrimitiveType"); //$NON-NLS-1$ hilight("sarlPrimitiveType", VimSyntaxGroup.SPECIAL); //$NON-NLS-1$ hilight("sarlArrayDeclaration", VimSyntaxGroup.SPECIAL); //$NON-NLS-1$ it.newLine(); } }
[ "protected", "void", "generatePrimitiveTypes", "(", "IStyleAppendable", "it", ",", "Iterable", "<", "String", ">", "types", ")", "{", "final", "Iterator", "<", "String", ">", "iterator", "=", "types", ".", "iterator", "(", ")", ";", "if", "(", "iterator", ...
Generate the keywords for the primitive types. @param it the receiver of the generated elements. @param types the primitive types.
[ "Generate", "the", "keywords", "for", "the", "primitive", "types", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java#L222-L238
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Main.java
Main.execute
public static int execute(ClassLoader docletParentClassLoader, String... args) { Start jdoc = new Start(docletParentClassLoader); return jdoc.begin(args); }
java
public static int execute(ClassLoader docletParentClassLoader, String... args) { Start jdoc = new Start(docletParentClassLoader); return jdoc.begin(args); }
[ "public", "static", "int", "execute", "(", "ClassLoader", "docletParentClassLoader", ",", "String", "...", "args", ")", "{", "Start", "jdoc", "=", "new", "Start", "(", "docletParentClassLoader", ")", ";", "return", "jdoc", ".", "begin", "(", "args", ")", ";"...
Programmatic interface. @param args The command line parameters. @param docletParentClassLoader The parent class loader used when creating the doclet classloader. If null, the class loader used to instantiate doclets will be created without specifying a parent class loader. @return The return code. @since 1.7
[ "Programmatic", "interface", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Main.java#L88-L91
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/CertificateOperations.java
CertificateOperations.listCertificates
public PagedList<Certificate> listCertificates(DetailLevel detailLevel) throws BatchErrorException, IOException { return listCertificates(detailLevel, null); }
java
public PagedList<Certificate> listCertificates(DetailLevel detailLevel) throws BatchErrorException, IOException { return listCertificates(detailLevel, null); }
[ "public", "PagedList", "<", "Certificate", ">", "listCertificates", "(", "DetailLevel", "detailLevel", ")", "throws", "BatchErrorException", ",", "IOException", "{", "return", "listCertificates", "(", "detailLevel", ",", "null", ")", ";", "}" ]
Lists the {@link Certificate certificates} in the Batch account. @param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service. @return A list of {@link Certificate} objects. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Lists", "the", "{", "@link", "Certificate", "certificates", "}", "in", "the", "Batch", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/CertificateOperations.java#L301-L303
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/locale/LocaleFormatter.java
LocaleFormatter.getFormatted
@Nonnull public static String getFormatted (final double dValue, @Nonnull final Locale aDisplayLocale) { ValueEnforcer.notNull (aDisplayLocale, "DisplayLocale"); return NumberFormat.getNumberInstance (aDisplayLocale).format (dValue); }
java
@Nonnull public static String getFormatted (final double dValue, @Nonnull final Locale aDisplayLocale) { ValueEnforcer.notNull (aDisplayLocale, "DisplayLocale"); return NumberFormat.getNumberInstance (aDisplayLocale).format (dValue); }
[ "@", "Nonnull", "public", "static", "String", "getFormatted", "(", "final", "double", "dValue", ",", "@", "Nonnull", "final", "Locale", "aDisplayLocale", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aDisplayLocale", ",", "\"DisplayLocale\"", ")", ";", "retur...
Format the passed value according to the rules specified by the given locale. All calls to {@link Double#toString(double)} that are displayed to the user should instead use this method. @param dValue The value to be formatted. @param aDisplayLocale The locale to be used. May not be <code>null</code>. @return The formatted string.
[ "Format", "the", "passed", "value", "according", "to", "the", "rules", "specified", "by", "the", "given", "locale", ".", "All", "calls", "to", "{", "@link", "Double#toString", "(", "double", ")", "}", "that", "are", "displayed", "to", "the", "user", "shoul...
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/locale/LocaleFormatter.java#L56-L62
javagl/ND
nd-iteration/src/main/java/de/javagl/nd/iteration/tuples/i/IntTupleIterators.java
IntTupleIterators.clampingIterator
public static Iterator<MutableIntTuple> clampingIterator( IntTuple min, IntTuple max, Iterator<? extends MutableIntTuple> delegate) { Utils.checkForEqualSize(min, max); IntTuple localMin = IntTuples.copy(min); IntTuple localMax = IntTuples.copy(max); return clampingIteratorInternal(localMin, localMax, delegate); }
java
public static Iterator<MutableIntTuple> clampingIterator( IntTuple min, IntTuple max, Iterator<? extends MutableIntTuple> delegate) { Utils.checkForEqualSize(min, max); IntTuple localMin = IntTuples.copy(min); IntTuple localMax = IntTuples.copy(max); return clampingIteratorInternal(localMin, localMax, delegate); }
[ "public", "static", "Iterator", "<", "MutableIntTuple", ">", "clampingIterator", "(", "IntTuple", "min", ",", "IntTuple", "max", ",", "Iterator", "<", "?", "extends", "MutableIntTuple", ">", "delegate", ")", "{", "Utils", ".", "checkForEqualSize", "(", "min", ...
Returns an iterator that returns the {@link MutableIntTuple}s from the given delegate that are contained in the given bounds.<br> @param min The minimum, inclusive. A copy of this tuple will be stored internally. @param max The maximum, exclusive. A copy of this tuple will be stored internally. @param delegate The delegate iterator @return The iterator @throws IllegalArgumentException If the given tuples do not have the same {@link Tuple#getSize() size}
[ "Returns", "an", "iterator", "that", "returns", "the", "{", "@link", "MutableIntTuple", "}", "s", "from", "the", "given", "delegate", "that", "are", "contained", "in", "the", "given", "bounds", ".", "<br", ">" ]
train
https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-iteration/src/main/java/de/javagl/nd/iteration/tuples/i/IntTupleIterators.java#L197-L205
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java
PyExpressionGenerator._generate
protected XExpression _generate(XSynchronizedExpression synchronizedStatement, IAppendable it, IExtraLanguageGeneratorContext context) { return generate(synchronizedStatement.getExpression(), context.getExpectedExpressionType(), it, context); }
java
protected XExpression _generate(XSynchronizedExpression synchronizedStatement, IAppendable it, IExtraLanguageGeneratorContext context) { return generate(synchronizedStatement.getExpression(), context.getExpectedExpressionType(), it, context); }
[ "protected", "XExpression", "_generate", "(", "XSynchronizedExpression", "synchronizedStatement", ",", "IAppendable", "it", ",", "IExtraLanguageGeneratorContext", "context", ")", "{", "return", "generate", "(", "synchronizedStatement", ".", "getExpression", "(", ")", ",",...
Generate the given object. @param synchronizedStatement the synchronized statement. @param it the target for the generated content. @param context the context. @return the statement.
[ "Generate", "the", "given", "object", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java#L905-L907
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.classNotMapped
public static void classNotMapped(Class<?> aClass){ throw new ClassNotMappedException(MSG.INSTANCE.message(classNotMappedException1,aClass.getSimpleName())); }
java
public static void classNotMapped(Class<?> aClass){ throw new ClassNotMappedException(MSG.INSTANCE.message(classNotMappedException1,aClass.getSimpleName())); }
[ "public", "static", "void", "classNotMapped", "(", "Class", "<", "?", ">", "aClass", ")", "{", "throw", "new", "ClassNotMappedException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "classNotMappedException1", ",", "aClass", ".", "getSimpleName", "(", ")...
Thrown if the class isn't mapped. @param aClass class to analyze
[ "Thrown", "if", "the", "class", "isn", "t", "mapped", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L565-L567
quattor/pan
panc/src/main/java/org/quattor/pan/Compiler.java
Compiler.run
public static CompilerResults run(CompilerOptions options, List<String> objectNames, Collection<File> tplFiles) { return (new Compiler(options, objectNames, tplFiles)).process(); }
java
public static CompilerResults run(CompilerOptions options, List<String> objectNames, Collection<File> tplFiles) { return (new Compiler(options, objectNames, tplFiles)).process(); }
[ "public", "static", "CompilerResults", "run", "(", "CompilerOptions", "options", ",", "List", "<", "String", ">", "objectNames", ",", "Collection", "<", "File", ">", "tplFiles", ")", "{", "return", "(", "new", "Compiler", "(", "options", ",", "objectNames", ...
This is a convenience method which creates a compiler and then invokes the <code>process</code> method. @param options compiler options to use for the created compiler @param objectNames object template names to compile/build; these will be looked-up on the load path @param tplFiles absolute file names of templates to process @return results from the compilation/build
[ "This", "is", "a", "convenience", "method", "which", "creates", "a", "compiler", "and", "then", "invokes", "the", "<code", ">", "process<", "/", "code", ">", "method", "." ]
train
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/Compiler.java#L201-L203
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/trees/international/pennchinese/CTBTreeReaderFactory.java
CTBTreeReaderFactory.newTreeReader
public TreeReader newTreeReader(Reader in) { if (discardFrags) { return new FragDiscardingPennTreeReader(in, new LabeledScoredTreeFactory(), tn, new CHTBTokenizer(in)); } else { return new PennTreeReader(in, new LabeledScoredTreeFactory(), tn, new CHTBTokenizer(in)); } }
java
public TreeReader newTreeReader(Reader in) { if (discardFrags) { return new FragDiscardingPennTreeReader(in, new LabeledScoredTreeFactory(), tn, new CHTBTokenizer(in)); } else { return new PennTreeReader(in, new LabeledScoredTreeFactory(), tn, new CHTBTokenizer(in)); } }
[ "public", "TreeReader", "newTreeReader", "(", "Reader", "in", ")", "{", "if", "(", "discardFrags", ")", "{", "return", "new", "FragDiscardingPennTreeReader", "(", "in", ",", "new", "LabeledScoredTreeFactory", "(", ")", ",", "tn", ",", "new", "CHTBTokenizer", "...
Create a new <code>TreeReader</code> using the provided <code>Reader</code>. @param in The <code>Reader</code> to build on @return The new TreeReader
[ "Create", "a", "new", "<code", ">", "TreeReader<", "/", "code", ">", "using", "the", "provided", "<code", ">", "Reader<", "/", "code", ">", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/international/pennchinese/CTBTreeReaderFactory.java#L39-L45
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getGuildMemberInfo
public void getGuildMemberInfo(String id, String api, Callback<List<GuildMember>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.GUILD, id), new ParamChecker(ParamType.API, api)); gw2API.getGuildMemberInfo(id, api).enqueue(callback); }
java
public void getGuildMemberInfo(String id, String api, Callback<List<GuildMember>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.GUILD, id), new ParamChecker(ParamType.API, api)); gw2API.getGuildMemberInfo(id, api).enqueue(callback); }
[ "public", "void", "getGuildMemberInfo", "(", "String", "id", ",", "String", "api", ",", "Callback", "<", "List", "<", "GuildMember", ">", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamC...
For more info on guild member API go <a href="https://wiki.guildwars2.com/wiki/API:2/guild/:id/members">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions<br/> @param id guild id @param api Guild leader's Guild Wars 2 API key @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws NullPointerException if given {@link Callback} is empty @see GuildMember guild member info
[ "For", "more", "info", "on", "guild", "member", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "guild", "/", ":", "id", "/", "members", ">", "here<", "/", "a", ...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1501-L1504
Netflix/ndbench
ndbench-dyno-plugins/src/main/java/com/netflix/ndbench/plugin/dyno/DynoJedisUtils.java
DynoJedisUtils.nonpipelineWrite
public String nonpipelineWrite(String key, DataGenerator dataGenerator) { String value = key + "__" + dataGenerator.getRandomValue() + "__" + key; String result = this.jedisClient.get().set(key, value); if (!"OK".equals(result)) { logger.error("SET_ERROR: GOT " + result + " for SET operation"); throw new RuntimeException(String.format("DynoJedis: value %s for SET operation is NOT VALID", value, key)); } return result; }
java
public String nonpipelineWrite(String key, DataGenerator dataGenerator) { String value = key + "__" + dataGenerator.getRandomValue() + "__" + key; String result = this.jedisClient.get().set(key, value); if (!"OK".equals(result)) { logger.error("SET_ERROR: GOT " + result + " for SET operation"); throw new RuntimeException(String.format("DynoJedis: value %s for SET operation is NOT VALID", value, key)); } return result; }
[ "public", "String", "nonpipelineWrite", "(", "String", "key", ",", "DataGenerator", "dataGenerator", ")", "{", "String", "value", "=", "key", "+", "\"__\"", "+", "dataGenerator", ".", "getRandomValue", "(", ")", "+", "\"__\"", "+", "key", ";", "String", "res...
a simple write without a pipeline @param key @return the result of write (i.e. "OK" if it was successful
[ "a", "simple", "write", "without", "a", "pipeline" ]
train
https://github.com/Netflix/ndbench/blob/8d664244b5f9d01395248a296b86a3c822e6d764/ndbench-dyno-plugins/src/main/java/com/netflix/ndbench/plugin/dyno/DynoJedisUtils.java#L162-L173
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/PlacesApi.java
PlacesApi.findByLatLon
public Places findByLatLon(Float latitude, Float longitude, Integer accuracy) throws JinxException { JinxUtils.validateParams(latitude, longitude); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.places.findByLatLon"); params.put("lat", latitude.toString()); params.put("lon", longitude.toString()); if (accuracy != null) { params.put("accuracy", accuracy.toString()); } return jinx.flickrGet(params, Places.class, false); }
java
public Places findByLatLon(Float latitude, Float longitude, Integer accuracy) throws JinxException { JinxUtils.validateParams(latitude, longitude); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.places.findByLatLon"); params.put("lat", latitude.toString()); params.put("lon", longitude.toString()); if (accuracy != null) { params.put("accuracy", accuracy.toString()); } return jinx.flickrGet(params, Places.class, false); }
[ "public", "Places", "findByLatLon", "(", "Float", "latitude", ",", "Float", "longitude", ",", "Integer", "accuracy", ")", "throws", "JinxException", "{", "JinxUtils", ".", "validateParams", "(", "latitude", ",", "longitude", ")", ";", "Map", "<", "String", ","...
Return a place ID for a latitude, longitude and accuracy triple. <p> The flickr.places.findByLatLon method is not meant to be a (reverse) geocoder in the traditional sense. It is designed to allow users to find photos for "places" and will round up to the nearest place type to which corresponding place IDs apply. <p> For example, if you pass it a street level coordinate it will return the city that contains the point rather than the street, or building, itself. <p> It will also truncate latitudes and longitudes to three decimal points. Authentication <p> This method does not require authentication. @param latitude the latitude whose valid range is -90 to 90. Anything more than 4 decimal places will be truncated. (Required) @param longitude the longitude whose valid range is -180 to 180. Anything more than 4 decimal places will be truncated. (Required) @param accuracy Recorded accuracy level of the location information. World level is 1, Country is ~3, Region ~6, City ~11, Street ~16. Current range is 1-16. The default is 16. (Optional) @return places that match the location criteria. @throws JinxException if required parameters are missing, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.places.findByLatLon.html">flickr.places.findByLatLon</a>
[ "Return", "a", "place", "ID", "for", "a", "latitude", "longitude", "and", "accuracy", "triple", ".", "<p", ">", "The", "flickr", ".", "places", ".", "findByLatLon", "method", "is", "not", "meant", "to", "be", "a", "(", "reverse", ")", "geocoder", "in", ...
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PlacesApi.java#L101-L111
michel-kraemer/bson4jackson
src/main/java/de/undercouch/bson4jackson/io/StaticBuffers.java
StaticBuffers.byteBuffer
public ByteBuffer byteBuffer(Key key, int minSize) { minSize = Math.max(minSize, GLOBAL_MIN_SIZE); ByteBuffer r = _byteBuffers[key.ordinal()]; if (r == null || r.capacity() < minSize) { r = ByteBuffer.allocate(minSize); } else { _byteBuffers[key.ordinal()] = null; r.clear(); } return r; }
java
public ByteBuffer byteBuffer(Key key, int minSize) { minSize = Math.max(minSize, GLOBAL_MIN_SIZE); ByteBuffer r = _byteBuffers[key.ordinal()]; if (r == null || r.capacity() < minSize) { r = ByteBuffer.allocate(minSize); } else { _byteBuffers[key.ordinal()] = null; r.clear(); } return r; }
[ "public", "ByteBuffer", "byteBuffer", "(", "Key", "key", ",", "int", "minSize", ")", "{", "minSize", "=", "Math", ".", "max", "(", "minSize", ",", "GLOBAL_MIN_SIZE", ")", ";", "ByteBuffer", "r", "=", "_byteBuffers", "[", "key", ".", "ordinal", "(", ")", ...
Creates or re-uses a {@link ByteBuffer} that has a minimum size. Calling this method multiple times with the same key will always return the same buffer, as long as it has the minimum size and is marked to be re-used. Buffers that are allowed to be re-used should be released using {@link #releaseByteBuffer(Key, ByteBuffer)}. @param key the buffer's identifier @param minSize the minimum size @return the {@link ByteBuffer} instance @see #charBuffer(Key, int)
[ "Creates", "or", "re", "-", "uses", "a", "{" ]
train
https://github.com/michel-kraemer/bson4jackson/blob/32d2ab3c516b3c07490fdfcf0c5e4ed0a2ee3979/src/main/java/de/undercouch/bson4jackson/io/StaticBuffers.java#L129-L140
algolia/instantsearch-android
core/src/main/java/com/algolia/instantsearch/core/helpers/Searcher.java
Searcher.create
@SuppressWarnings({"WeakerAccess", "unused"}) // For library users public static Searcher create(@NonNull final String appId, @NonNull final String apiKey, @NonNull final String indexName) { return create(new Client(appId, apiKey).getIndex(indexName), indexName); }
java
@SuppressWarnings({"WeakerAccess", "unused"}) // For library users public static Searcher create(@NonNull final String appId, @NonNull final String apiKey, @NonNull final String indexName) { return create(new Client(appId, apiKey).getIndex(indexName), indexName); }
[ "@", "SuppressWarnings", "(", "{", "\"WeakerAccess\"", ",", "\"unused\"", "}", ")", "// For library users", "public", "static", "Searcher", "create", "(", "@", "NonNull", "final", "String", "appId", ",", "@", "NonNull", "final", "String", "apiKey", ",", "@", "...
Constructs a Searcher, creating its {@link Searcher#searchable} and {@link Searcher#client} with the given parameters. @param appId your Algolia Application ID. @param apiKey a search-only API Key. (never use API keys that could modify your records! see https://www.algolia.com/doc/guides/security/api-keys) @param indexName the name of the searchable to target. @return the new instance.
[ "Constructs", "a", "Searcher", "creating", "its", "{", "@link", "Searcher#searchable", "}", "and", "{", "@link", "Searcher#client", "}", "with", "the", "given", "parameters", "." ]
train
https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/core/src/main/java/com/algolia/instantsearch/core/helpers/Searcher.java#L182-L185
alkacon/opencms-core
src/org/opencms/ui/CmsVaadinUtils.java
CmsVaadinUtils.visitDescendants
public static void visitDescendants(Component component, Predicate<Component> handler) { List<Component> stack = Lists.newArrayList(); stack.add(component); while (!stack.isEmpty()) { Component currentComponent = stack.get(stack.size() - 1); stack.remove(stack.size() - 1); if (!handler.apply(currentComponent)) { return; } if (currentComponent instanceof HasComponents) { List<Component> children = Lists.newArrayList((HasComponents)currentComponent); Collections.reverse(children); stack.addAll(children); } } }
java
public static void visitDescendants(Component component, Predicate<Component> handler) { List<Component> stack = Lists.newArrayList(); stack.add(component); while (!stack.isEmpty()) { Component currentComponent = stack.get(stack.size() - 1); stack.remove(stack.size() - 1); if (!handler.apply(currentComponent)) { return; } if (currentComponent instanceof HasComponents) { List<Component> children = Lists.newArrayList((HasComponents)currentComponent); Collections.reverse(children); stack.addAll(children); } } }
[ "public", "static", "void", "visitDescendants", "(", "Component", "component", ",", "Predicate", "<", "Component", ">", "handler", ")", "{", "List", "<", "Component", ">", "stack", "=", "Lists", ".", "newArrayList", "(", ")", ";", "stack", ".", "add", "(",...
Visits all descendants of a given component (including the component itself) and applies a predicate to each.<p> If the predicate returns false for a component, no further descendants will be processed.<p> @param component the component @param handler the predicate
[ "Visits", "all", "descendants", "of", "a", "given", "component", "(", "including", "the", "component", "itself", ")", "and", "applies", "a", "predicate", "to", "each", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsVaadinUtils.java#L1251-L1267
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java
BinarySearch.searchDescending
public static int searchDescending(short[] shortArray, short value) { int start = 0; int end = shortArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == shortArray[middle]) { return middle; } if(value > shortArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
java
public static int searchDescending(short[] shortArray, short value) { int start = 0; int end = shortArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == shortArray[middle]) { return middle; } if(value > shortArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
[ "public", "static", "int", "searchDescending", "(", "short", "[", "]", "shortArray", ",", "short", "value", ")", "{", "int", "start", "=", "0", ";", "int", "end", "=", "shortArray", ".", "length", "-", "1", ";", "int", "middle", "=", "0", ";", "while...
Search for the value in the reverse sorted short array and return the index. @param shortArray array that we are searching in. @param value value that is being searched in the array. @return the index where the value is found in the array, else -1.
[ "Search", "for", "the", "value", "in", "the", "reverse", "sorted", "short", "array", "and", "return", "the", "index", "." ]
train
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java#L505-L527
litsec/eidas-opensaml
opensaml3/src/main/java/se/litsec/eidas/opensaml/ext/RequestedAttributeTemplates.java
RequestedAttributeTemplates.DATE_OF_BIRTH
public static RequestedAttribute DATE_OF_BIRTH(Boolean isRequired, boolean includeFriendlyName) { return create(AttributeConstants.EIDAS_DATE_OF_BIRTH_ATTRIBUTE_NAME, includeFriendlyName ? AttributeConstants.EIDAS_DATE_OF_BIRTH_ATTRIBUTE_FRIENDLY_NAME : null, Attribute.URI_REFERENCE, isRequired); }
java
public static RequestedAttribute DATE_OF_BIRTH(Boolean isRequired, boolean includeFriendlyName) { return create(AttributeConstants.EIDAS_DATE_OF_BIRTH_ATTRIBUTE_NAME, includeFriendlyName ? AttributeConstants.EIDAS_DATE_OF_BIRTH_ATTRIBUTE_FRIENDLY_NAME : null, Attribute.URI_REFERENCE, isRequired); }
[ "public", "static", "RequestedAttribute", "DATE_OF_BIRTH", "(", "Boolean", "isRequired", ",", "boolean", "includeFriendlyName", ")", "{", "return", "create", "(", "AttributeConstants", ".", "EIDAS_DATE_OF_BIRTH_ATTRIBUTE_NAME", ",", "includeFriendlyName", "?", "AttributeCon...
Creates a {@code RequestedAttribute} object for the DateOfBirth attribute. @param isRequired flag to tell whether the attribute is required @param includeFriendlyName flag that tells whether the friendly name should be included @return a {@code RequestedAttribute} object representing the DateOfBirth attribute
[ "Creates", "a", "{", "@code", "RequestedAttribute", "}", "object", "for", "the", "DateOfBirth", "attribute", "." ]
train
https://github.com/litsec/eidas-opensaml/blob/522ba6dba433a9524cb8a02464cc3b087b47a2b7/opensaml3/src/main/java/se/litsec/eidas/opensaml/ext/RequestedAttributeTemplates.java#L86-L90
googleapis/google-http-java-client
google-http-client/src/main/java/com/google/api/client/util/ArrayMap.java
ArrayMap.put
@Override public final V put(K key, V value) { int index = getIndexOfKey(key); if (index == -1) { index = this.size; } return set(index, key, value); }
java
@Override public final V put(K key, V value) { int index = getIndexOfKey(key); if (index == -1) { index = this.size; } return set(index, key, value); }
[ "@", "Override", "public", "final", "V", "put", "(", "K", "key", ",", "V", "value", ")", "{", "int", "index", "=", "getIndexOfKey", "(", "key", ")", ";", "if", "(", "index", "==", "-", "1", ")", "{", "index", "=", "this", ".", "size", ";", "}",...
Sets the value for the given key, overriding any existing value. @return previous value or {@code null} for none
[ "Sets", "the", "value", "for", "the", "given", "key", "overriding", "any", "existing", "value", "." ]
train
https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/util/ArrayMap.java#L198-L205
Azure/azure-sdk-for-java
recoveryservices.backup/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_06_01/implementation/BackupEnginesInner.java
BackupEnginesInner.getAsync
public Observable<Page<BackupEngineBaseResourceInner>> getAsync(final String vaultName, final String resourceGroupName, final String filter, final String skipToken) { return getWithServiceResponseAsync(vaultName, resourceGroupName, filter, skipToken) .map(new Func1<ServiceResponse<Page<BackupEngineBaseResourceInner>>, Page<BackupEngineBaseResourceInner>>() { @Override public Page<BackupEngineBaseResourceInner> call(ServiceResponse<Page<BackupEngineBaseResourceInner>> response) { return response.body(); } }); }
java
public Observable<Page<BackupEngineBaseResourceInner>> getAsync(final String vaultName, final String resourceGroupName, final String filter, final String skipToken) { return getWithServiceResponseAsync(vaultName, resourceGroupName, filter, skipToken) .map(new Func1<ServiceResponse<Page<BackupEngineBaseResourceInner>>, Page<BackupEngineBaseResourceInner>>() { @Override public Page<BackupEngineBaseResourceInner> call(ServiceResponse<Page<BackupEngineBaseResourceInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "BackupEngineBaseResourceInner", ">", ">", "getAsync", "(", "final", "String", "vaultName", ",", "final", "String", "resourceGroupName", ",", "final", "String", "filter", ",", "final", "String", "skipToken", ")", "{", "r...
The backup management servers registered to a Recovery Services vault. This returns a pageable list of servers. @param vaultName The name of the Recovery Services vault. @param resourceGroupName The name of the resource group associated with the Recovery Services vault. @param filter Use this filter to choose the specific backup management server. backupManagementType { AzureIaasVM, MAB, DPM, AzureBackupServer, AzureSql }. @param skipToken The Skip Token filter. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;BackupEngineBaseResourceInner&gt; object
[ "The", "backup", "management", "servers", "registered", "to", "a", "Recovery", "Services", "vault", ".", "This", "returns", "a", "pageable", "list", "of", "servers", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_06_01/implementation/BackupEnginesInner.java#L242-L250
BotMill/fb-botmill
src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/AirlineBoardingPassTemplateBuilder.java
AirlineBoardingPassTemplateBuilder.addQuickReply
public AirlineBoardingPassTemplateBuilder addQuickReply(String title, String payload) { this.messageBuilder.addQuickReply(title, payload); return this; }
java
public AirlineBoardingPassTemplateBuilder addQuickReply(String title, String payload) { this.messageBuilder.addQuickReply(title, payload); return this; }
[ "public", "AirlineBoardingPassTemplateBuilder", "addQuickReply", "(", "String", "title", ",", "String", "payload", ")", "{", "this", ".", "messageBuilder", ".", "addQuickReply", "(", "title", ",", "payload", ")", ";", "return", "this", ";", "}" ]
Adds a {@link QuickReply} to the current object. @param title the quick reply button label. It can't be empty. @param payload the payload sent back when the button is pressed. It can't be empty. @return this builder. @see <a href= "https://developers.facebook.com/docs/messenger-platform/send-api-reference/quick-replies" > Facebook's Messenger Platform Quick Replies Documentation</a>
[ "Adds", "a", "{", "@link", "QuickReply", "}", "to", "the", "current", "object", "." ]
train
https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/AirlineBoardingPassTemplateBuilder.java#L140-L144
fuinorg/utils4swing
src/main/java/org/fuin/utils4swing/common/Utils4Swing.java
Utils4Swing.createShowAndPosition
public static JFrame createShowAndPosition(final String title, final Container content, final boolean exitOnClose, final FramePositioner positioner) { return createShowAndPosition(title, content, exitOnClose, true, positioner); }
java
public static JFrame createShowAndPosition(final String title, final Container content, final boolean exitOnClose, final FramePositioner positioner) { return createShowAndPosition(title, content, exitOnClose, true, positioner); }
[ "public", "static", "JFrame", "createShowAndPosition", "(", "final", "String", "title", ",", "final", "Container", "content", ",", "final", "boolean", "exitOnClose", ",", "final", "FramePositioner", "positioner", ")", "{", "return", "createShowAndPosition", "(", "ti...
Create a new resizeable frame with a panel as it's content pane and position the frame. @param title Frame title. @param content Content. @param exitOnClose Exit the program on closing the frame? @param positioner FramePositioner. @return A visible frame at the preferred position.
[ "Create", "a", "new", "resizeable", "frame", "with", "a", "panel", "as", "it", "s", "content", "pane", "and", "position", "the", "frame", "." ]
train
https://github.com/fuinorg/utils4swing/blob/560fb69eac182e3473de9679c3c15433e524ef6b/src/main/java/org/fuin/utils4swing/common/Utils4Swing.java#L66-L69
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ScientificNumberFormatter.java
ScientificNumberFormatter.getMarkupInstance
public static ScientificNumberFormatter getMarkupInstance( ULocale locale, String beginMarkup, String endMarkup) { return getInstanceForLocale( locale, new MarkupStyle(beginMarkup, endMarkup)); }
java
public static ScientificNumberFormatter getMarkupInstance( ULocale locale, String beginMarkup, String endMarkup) { return getInstanceForLocale( locale, new MarkupStyle(beginMarkup, endMarkup)); }
[ "public", "static", "ScientificNumberFormatter", "getMarkupInstance", "(", "ULocale", "locale", ",", "String", "beginMarkup", ",", "String", "endMarkup", ")", "{", "return", "getInstanceForLocale", "(", "locale", ",", "new", "MarkupStyle", "(", "beginMarkup", ",", "...
Gets a ScientificNumberFormatter instance that uses markup for exponents for this locale. @param locale The locale @param beginMarkup the markup to start superscript e.g {@code <sup>} @param endMarkup the markup to end superscript e.g {@code </sup>} @return The ScientificNumberFormatter instance.
[ "Gets", "a", "ScientificNumberFormatter", "instance", "that", "uses", "markup", "for", "exponents", "for", "this", "locale", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ScientificNumberFormatter.java#L74-L80
puniverse/capsule
capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java
Jar.setAttribute
public final Jar setAttribute(String name, String value) { verifyNotSealed(); if (jos != null) throw new IllegalStateException("Manifest cannot be modified after entries are added."); getManifest().getMainAttributes().putValue(name, value); return this; }
java
public final Jar setAttribute(String name, String value) { verifyNotSealed(); if (jos != null) throw new IllegalStateException("Manifest cannot be modified after entries are added."); getManifest().getMainAttributes().putValue(name, value); return this; }
[ "public", "final", "Jar", "setAttribute", "(", "String", "name", ",", "String", "value", ")", "{", "verifyNotSealed", "(", ")", ";", "if", "(", "jos", "!=", "null", ")", "throw", "new", "IllegalStateException", "(", "\"Manifest cannot be modified after entries are...
Sets an attribute in the main section of the manifest. @param name the attribute's name @param value the attribute's value @return {@code this} @throws IllegalStateException if entries have been added or the JAR has been written prior to calling this methods.
[ "Sets", "an", "attribute", "in", "the", "main", "section", "of", "the", "manifest", "." ]
train
https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L135-L141
anotheria/moskito
moskito-core/src/main/java/net/anotheria/moskito/core/stats/impl/StatValueFactory.java
StatValueFactory.createStatValue
public static TypeAwareStatValue createStatValue(StatValueTypes aType, String aName, Interval[] aIntervals) { IValueHolderFactory valueHolderFactory = StatValueTypeUtility.createValueHolderFactory(aType); TypeAwareStatValue value = new TypeAwareStatValueImpl(aName, aType, valueHolderFactory); // now we have to add the Intervals to the new value.... for (int i = 0; i < aIntervals.length; i++) { value.addInterval(aIntervals[i]); } return value; }
java
public static TypeAwareStatValue createStatValue(StatValueTypes aType, String aName, Interval[] aIntervals) { IValueHolderFactory valueHolderFactory = StatValueTypeUtility.createValueHolderFactory(aType); TypeAwareStatValue value = new TypeAwareStatValueImpl(aName, aType, valueHolderFactory); // now we have to add the Intervals to the new value.... for (int i = 0; i < aIntervals.length; i++) { value.addInterval(aIntervals[i]); } return value; }
[ "public", "static", "TypeAwareStatValue", "createStatValue", "(", "StatValueTypes", "aType", ",", "String", "aName", ",", "Interval", "[", "]", "aIntervals", ")", "{", "IValueHolderFactory", "valueHolderFactory", "=", "StatValueTypeUtility", ".", "createValueHolderFactory...
This method creates a StatValue instance. @param aType the type of the value @param aName the name of the value @param aIntervals the list of Intervals to be used @return the StatValue instance
[ "This", "method", "creates", "a", "StatValue", "instance", "." ]
train
https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/stats/impl/StatValueFactory.java#L73-L81
samskivert/samskivert
src/main/java/com/samskivert/servlet/user/UserRepository.java
UserRepository.deleteUser
public void deleteUser (final User user) throws PersistenceException { if (user.isDeleted()) { return; } executeUpdate(new Operation<Object>() { public Object invoke (Connection conn, DatabaseLiaison liaison) throws PersistenceException, SQLException { // create our modified fields mask FieldMask mask = _utable.getFieldMask(); mask.setModified("username"); mask.setModified("password"); mask.setModified("email"); // set the password to unusable user.password = ""; // 'disable' their email address String newEmail = user.email.replace('@','#'); user.email = newEmail; String oldName = user.username; for (int ii = 0; ii < 100; ii++) { try { user.username = StringUtil.truncate(ii + "=" + oldName, 24); _utable.update(conn, user, mask); return null; // nothing to return } catch (SQLException se) { if (!liaison.isDuplicateRowException(se)) { throw se; } } } // ok we failed to rename the user, lets bust an error throw new PersistenceException("Failed to 'delete' the user"); } }); }
java
public void deleteUser (final User user) throws PersistenceException { if (user.isDeleted()) { return; } executeUpdate(new Operation<Object>() { public Object invoke (Connection conn, DatabaseLiaison liaison) throws PersistenceException, SQLException { // create our modified fields mask FieldMask mask = _utable.getFieldMask(); mask.setModified("username"); mask.setModified("password"); mask.setModified("email"); // set the password to unusable user.password = ""; // 'disable' their email address String newEmail = user.email.replace('@','#'); user.email = newEmail; String oldName = user.username; for (int ii = 0; ii < 100; ii++) { try { user.username = StringUtil.truncate(ii + "=" + oldName, 24); _utable.update(conn, user, mask); return null; // nothing to return } catch (SQLException se) { if (!liaison.isDuplicateRowException(se)) { throw se; } } } // ok we failed to rename the user, lets bust an error throw new PersistenceException("Failed to 'delete' the user"); } }); }
[ "public", "void", "deleteUser", "(", "final", "User", "user", ")", "throws", "PersistenceException", "{", "if", "(", "user", ".", "isDeleted", "(", ")", ")", "{", "return", ";", "}", "executeUpdate", "(", "new", "Operation", "<", "Object", ">", "(", ")",...
'Delete' the users account such that they can no longer access it, however we do not delete the record from the db. The name is changed such that the original name has XX=FOO if the name were FOO originally. If we have to lop off any of the name to get our prefix to fit we use a minus sign instead of a equals side. The password field is set to be the empty string so that no one can log in (since nothing hashes to the empty string. We also make sure their email address no longer works, so in case we don't ignore 'deleted' users when we do the sql to get emailaddresses for the mass mailings we still won't spam delete folk. We leave the emailaddress intact exect for the @ sign which gets turned to a #, so that we can see what their email was incase it was an accidently deletion and we have to verify through email.
[ "Delete", "the", "users", "account", "such", "that", "they", "can", "no", "longer", "access", "it", "however", "we", "do", "not", "delete", "the", "record", "from", "the", "db", ".", "The", "name", "is", "changed", "such", "that", "the", "original", "nam...
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/servlet/user/UserRepository.java#L200-L241
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/Assert.java
Assert.notEmpty
public static void notEmpty(Collection<?> collection, String message, Object... arguments) { notEmpty(collection, new IllegalArgumentException(format(message, arguments))); }
java
public static void notEmpty(Collection<?> collection, String message, Object... arguments) { notEmpty(collection, new IllegalArgumentException(format(message, arguments))); }
[ "public", "static", "void", "notEmpty", "(", "Collection", "<", "?", ">", "collection", ",", "String", "message", ",", "Object", "...", "arguments", ")", "{", "notEmpty", "(", "collection", ",", "new", "IllegalArgumentException", "(", "format", "(", "message",...
Asserts that the {@link Collection} is not empty. The assertion holds if and only if the {@link Collection} is not {@literal null} and contains at least 1 element. @param collection {@link Collection} to evaluate. @param message {@link String} containing the message using in the {@link IllegalArgumentException} thrown if the assertion fails. @param arguments array of {@link Object arguments} used as placeholder values when formatting the {@link String message}. @throws java.lang.IllegalArgumentException if the {@link Collection} is {@literal null} or empty. @see #notEmpty(java.util.Collection, RuntimeException) @see java.util.Collection#isEmpty()
[ "Asserts", "that", "the", "{", "@link", "Collection", "}", "is", "not", "empty", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/Assert.java#L1034-L1036
dwdyer/reportng
reportng/src/java/main/org/uncommons/reportng/HTMLReporter.java
HTMLReporter.createResults
private void createResults(List<ISuite> suites, File outputDirectory, boolean onlyShowFailures) throws Exception { int index = 1; for (ISuite suite : suites) { int index2 = 1; for (ISuiteResult result : suite.getResults().values()) { boolean failuresExist = result.getTestContext().getFailedTests().size() > 0 || result.getTestContext().getFailedConfigurations().size() > 0; if (!onlyShowFailures || failuresExist) { VelocityContext context = createContext(); context.put(RESULT_KEY, result); context.put(FAILED_CONFIG_KEY, sortByTestClass(result.getTestContext().getFailedConfigurations())); context.put(SKIPPED_CONFIG_KEY, sortByTestClass(result.getTestContext().getSkippedConfigurations())); context.put(FAILED_TESTS_KEY, sortByTestClass(result.getTestContext().getFailedTests())); context.put(SKIPPED_TESTS_KEY, sortByTestClass(result.getTestContext().getSkippedTests())); context.put(PASSED_TESTS_KEY, sortByTestClass(result.getTestContext().getPassedTests())); String fileName = String.format("suite%d_test%d_%s", index, index2, RESULTS_FILE); generateFile(new File(outputDirectory, fileName), RESULTS_FILE + TEMPLATE_EXTENSION, context); } ++index2; } ++index; } }
java
private void createResults(List<ISuite> suites, File outputDirectory, boolean onlyShowFailures) throws Exception { int index = 1; for (ISuite suite : suites) { int index2 = 1; for (ISuiteResult result : suite.getResults().values()) { boolean failuresExist = result.getTestContext().getFailedTests().size() > 0 || result.getTestContext().getFailedConfigurations().size() > 0; if (!onlyShowFailures || failuresExist) { VelocityContext context = createContext(); context.put(RESULT_KEY, result); context.put(FAILED_CONFIG_KEY, sortByTestClass(result.getTestContext().getFailedConfigurations())); context.put(SKIPPED_CONFIG_KEY, sortByTestClass(result.getTestContext().getSkippedConfigurations())); context.put(FAILED_TESTS_KEY, sortByTestClass(result.getTestContext().getFailedTests())); context.put(SKIPPED_TESTS_KEY, sortByTestClass(result.getTestContext().getSkippedTests())); context.put(PASSED_TESTS_KEY, sortByTestClass(result.getTestContext().getPassedTests())); String fileName = String.format("suite%d_test%d_%s", index, index2, RESULTS_FILE); generateFile(new File(outputDirectory, fileName), RESULTS_FILE + TEMPLATE_EXTENSION, context); } ++index2; } ++index; } }
[ "private", "void", "createResults", "(", "List", "<", "ISuite", ">", "suites", ",", "File", "outputDirectory", ",", "boolean", "onlyShowFailures", ")", "throws", "Exception", "{", "int", "index", "=", "1", ";", "for", "(", "ISuite", "suite", ":", "suites", ...
Generate a results file for each test in each suite. @param outputDirectory The target directory for the generated file(s).
[ "Generate", "a", "results", "file", "for", "each", "test", "in", "each", "suite", "." ]
train
https://github.com/dwdyer/reportng/blob/df11f9cd9ab3fb5847fbba94ed3098ae0448f770/reportng/src/java/main/org/uncommons/reportng/HTMLReporter.java#L170-L200
omadahealth/TypefaceView
lib/src/main/java/com/github/omadahealth/typefaceview/TypefaceTextView.java
TypefaceTextView.setCustomHtml
@BindingAdapter("bind:tv_html") public static void setCustomHtml(TypefaceTextView textView, Boolean isHtml) { isHtml = isHtml != null ? isHtml : false; textView.mHtmlEnabled = isHtml; textView.setText(textView.getText()); }
java
@BindingAdapter("bind:tv_html") public static void setCustomHtml(TypefaceTextView textView, Boolean isHtml) { isHtml = isHtml != null ? isHtml : false; textView.mHtmlEnabled = isHtml; textView.setText(textView.getText()); }
[ "@", "BindingAdapter", "(", "\"bind:tv_html\"", ")", "public", "static", "void", "setCustomHtml", "(", "TypefaceTextView", "textView", ",", "Boolean", "isHtml", ")", "{", "isHtml", "=", "isHtml", "!=", "null", "?", "isHtml", ":", "false", ";", "textView", ".",...
Data-binding method for custom attribute bind:tv_html to be set @param textView The instance of the object to set value on @param isHtml True if html text, false otherwise
[ "Data", "-", "binding", "method", "for", "custom", "attribute", "bind", ":", "tv_html", "to", "be", "set" ]
train
https://github.com/omadahealth/TypefaceView/blob/9a36a67b0fb26584c3e20a24f8f0bafad6a0badd/lib/src/main/java/com/github/omadahealth/typefaceview/TypefaceTextView.java#L91-L96
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java
ComputationGraph.evaluateRegression
public <T extends RegressionEvaluation> T evaluateRegression(DataSetIterator iterator, List<String> columnNames) { return (T)doEvaluation(iterator, new org.deeplearning4j.eval.RegressionEvaluation(columnNames))[0]; }
java
public <T extends RegressionEvaluation> T evaluateRegression(DataSetIterator iterator, List<String> columnNames) { return (T)doEvaluation(iterator, new org.deeplearning4j.eval.RegressionEvaluation(columnNames))[0]; }
[ "public", "<", "T", "extends", "RegressionEvaluation", ">", "T", "evaluateRegression", "(", "DataSetIterator", "iterator", ",", "List", "<", "String", ">", "columnNames", ")", "{", "return", "(", "T", ")", "doEvaluation", "(", "iterator", ",", "new", "org", ...
Evaluate the (single output layer only) network for regression performance @param iterator Data to evaluate on @param columnNames Column names for the regression evaluation. May be null. @return Regression evaluation
[ "Evaluate", "the", "(", "single", "output", "layer", "only", ")", "network", "for", "regression", "performance" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L3903-L3905
osglworks/java-tool
src/main/java/org/osgl/util/E.java
E.invalidArgIf
public static void invalidArgIf(boolean tester, String msg, Object... args) { if (tester) { throw invalidArg(msg, args); } }
java
public static void invalidArgIf(boolean tester, String msg, Object... args) { if (tester) { throw invalidArg(msg, args); } }
[ "public", "static", "void", "invalidArgIf", "(", "boolean", "tester", ",", "String", "msg", ",", "Object", "...", "args", ")", "{", "if", "(", "tester", ")", "{", "throw", "invalidArg", "(", "msg", ",", "args", ")", ";", "}", "}" ]
Throws out an {@link InvalidArgException} with error message specified when `tester` is `true`. @param tester when `true` then throws out the exception. @param msg the error message format pattern. @param args the error message format arguments.
[ "Throws", "out", "an", "{", "@link", "InvalidArgException", "}", "with", "error", "message", "specified", "when", "tester", "is", "true", "." ]
train
https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/util/E.java#L403-L407
alkacon/opencms-core
src/org/opencms/ui/components/CmsUserDataFormLayout.java
CmsUserDataFormLayout.submit
public void submit(CmsUser user, CmsObject cms, Runnable afterWrite) { submit(user, cms, afterWrite, false); }
java
public void submit(CmsUser user, CmsObject cms, Runnable afterWrite) { submit(user, cms, afterWrite, false); }
[ "public", "void", "submit", "(", "CmsUser", "user", ",", "CmsObject", "cms", ",", "Runnable", "afterWrite", ")", "{", "submit", "(", "user", ",", "cms", ",", "afterWrite", ",", "false", ")", ";", "}" ]
Store fields to given user.<p> @param user User to write information to @param cms CmsObject @param afterWrite runnable which gets called after writing user
[ "Store", "fields", "to", "given", "user", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/CmsUserDataFormLayout.java#L198-L201
kuali/ojb-1.0.4
src/java/org/apache/ojb/otm/copy/MetadataObjectCopyStrategy.java
MetadataObjectCopyStrategy.copy
public Object copy(final Object obj, final PersistenceBroker broker) { return clone(obj, IdentityMapFactory.getIdentityMap(), broker); }
java
public Object copy(final Object obj, final PersistenceBroker broker) { return clone(obj, IdentityMapFactory.getIdentityMap(), broker); }
[ "public", "Object", "copy", "(", "final", "Object", "obj", ",", "final", "PersistenceBroker", "broker", ")", "{", "return", "clone", "(", "obj", ",", "IdentityMapFactory", ".", "getIdentityMap", "(", ")", ",", "broker", ")", ";", "}" ]
Uses an IdentityMap to make sure we don't recurse infinitely on the same object in a cyclic object model. Proxies @param obj @return
[ "Uses", "an", "IdentityMap", "to", "make", "sure", "we", "don", "t", "recurse", "infinitely", "on", "the", "same", "object", "in", "a", "cyclic", "object", "model", ".", "Proxies" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/otm/copy/MetadataObjectCopyStrategy.java#L48-L51
AgNO3/jcifs-ng
src/main/java/jcifs/ntlmssp/Type3Message.java
Type3Message.setupMIC
public void setupMIC ( byte[] type1, byte[] type2 ) throws GeneralSecurityException, IOException { byte[] sk = this.masterKey; if ( sk == null ) { return; } MessageDigest mac = Crypto.getHMACT64(sk); mac.update(type1); mac.update(type2); byte[] type3 = toByteArray(); mac.update(type3); setMic(mac.digest()); }
java
public void setupMIC ( byte[] type1, byte[] type2 ) throws GeneralSecurityException, IOException { byte[] sk = this.masterKey; if ( sk == null ) { return; } MessageDigest mac = Crypto.getHMACT64(sk); mac.update(type1); mac.update(type2); byte[] type3 = toByteArray(); mac.update(type3); setMic(mac.digest()); }
[ "public", "void", "setupMIC", "(", "byte", "[", "]", "type1", ",", "byte", "[", "]", "type2", ")", "throws", "GeneralSecurityException", ",", "IOException", "{", "byte", "[", "]", "sk", "=", "this", ".", "masterKey", ";", "if", "(", "sk", "==", "null",...
Sets the MIC @param type1 @param type2 @throws GeneralSecurityException @throws IOException
[ "Sets", "the", "MIC" ]
train
https://github.com/AgNO3/jcifs-ng/blob/0311107a077ea372527ae74839eec8042197332f/src/main/java/jcifs/ntlmssp/Type3Message.java#L297-L308
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/xml/MetaCharacterMap.java
MetaCharacterMap.addMeta
public void addMeta(char meta, String replacement) { metaCharacterSet.set(meta); replacementMap.put(new String(new char[] { meta }), replacement); }
java
public void addMeta(char meta, String replacement) { metaCharacterSet.set(meta); replacementMap.put(new String(new char[] { meta }), replacement); }
[ "public", "void", "addMeta", "(", "char", "meta", ",", "String", "replacement", ")", "{", "metaCharacterSet", ".", "set", "(", "meta", ")", ";", "replacementMap", ".", "put", "(", "new", "String", "(", "new", "char", "[", "]", "{", "meta", "}", ")", ...
Add a metacharacter and its replacement. @param meta the metacharacter @param replacement the String to replace the metacharacter with
[ "Add", "a", "metacharacter", "and", "its", "replacement", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/xml/MetaCharacterMap.java#L53-L56
sagiegurari/fax4j
src/main/java/org/fax4j/util/SpiUtil.java
SpiUtil.urlDecode
public static String urlDecode(String text) { String urlEncodedString=text; if(text!=null) { try { urlEncodedString=URLDecoder.decode(text,SpiUtil.UTF_8_ENCODING_NAME); } catch(UnsupportedEncodingException exception) { throw new FaxException("Error while URL decoding text.",exception); } } return urlEncodedString; }
java
public static String urlDecode(String text) { String urlEncodedString=text; if(text!=null) { try { urlEncodedString=URLDecoder.decode(text,SpiUtil.UTF_8_ENCODING_NAME); } catch(UnsupportedEncodingException exception) { throw new FaxException("Error while URL decoding text.",exception); } } return urlEncodedString; }
[ "public", "static", "String", "urlDecode", "(", "String", "text", ")", "{", "String", "urlEncodedString", "=", "text", ";", "if", "(", "text", "!=", "null", ")", "{", "try", "{", "urlEncodedString", "=", "URLDecoder", ".", "decode", "(", "text", ",", "Sp...
This function URL decodes the given text. @param text The text to decode @return The decoded text
[ "This", "function", "URL", "decodes", "the", "given", "text", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/util/SpiUtil.java#L235-L251
apache/spark
sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedColumnReader.java
VectorizedColumnReader.readBooleanBatch
private void readBooleanBatch(int rowId, int num, WritableColumnVector column) throws IOException { if (column.dataType() != DataTypes.BooleanType) { throw constructConvertNotSupportedException(descriptor, column); } defColumn.readBooleans( num, column, rowId, maxDefLevel, (VectorizedValuesReader) dataColumn); }
java
private void readBooleanBatch(int rowId, int num, WritableColumnVector column) throws IOException { if (column.dataType() != DataTypes.BooleanType) { throw constructConvertNotSupportedException(descriptor, column); } defColumn.readBooleans( num, column, rowId, maxDefLevel, (VectorizedValuesReader) dataColumn); }
[ "private", "void", "readBooleanBatch", "(", "int", "rowId", ",", "int", "num", ",", "WritableColumnVector", "column", ")", "throws", "IOException", "{", "if", "(", "column", ".", "dataType", "(", ")", "!=", "DataTypes", ".", "BooleanType", ")", "{", "throw",...
For all the read*Batch functions, reads `num` values from this columnReader into column. It is guaranteed that num is smaller than the number of values left in the current page.
[ "For", "all", "the", "read", "*", "Batch", "functions", "reads", "num", "values", "from", "this", "columnReader", "into", "column", ".", "It", "is", "guaranteed", "that", "num", "is", "smaller", "than", "the", "number", "of", "values", "left", "in", "the",...
train
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedColumnReader.java#L397-L404
ahome-it/lienzo-core
src/main/java/com/ait/lienzo/client/core/shape/Scene.java
Scene.setPixelSize
public final Scene setPixelSize(final int wide, final int high) { m_wide = wide; m_high = high; getElement().getStyle().setWidth(wide, Unit.PX); getElement().getStyle().setHeight(high, Unit.PX); final NFastArrayList<Layer> layers = getChildNodes(); if (null != layers) { final int size = layers.size(); for (int i = 0; i < size; i++) { final Layer layer = layers.get(i); if (null != layer) { layer.setPixelSize(wide, high); } } } return this; }
java
public final Scene setPixelSize(final int wide, final int high) { m_wide = wide; m_high = high; getElement().getStyle().setWidth(wide, Unit.PX); getElement().getStyle().setHeight(high, Unit.PX); final NFastArrayList<Layer> layers = getChildNodes(); if (null != layers) { final int size = layers.size(); for (int i = 0; i < size; i++) { final Layer layer = layers.get(i); if (null != layer) { layer.setPixelSize(wide, high); } } } return this; }
[ "public", "final", "Scene", "setPixelSize", "(", "final", "int", "wide", ",", "final", "int", "high", ")", "{", "m_wide", "=", "wide", ";", "m_high", "=", "high", ";", "getElement", "(", ")", ".", "getStyle", "(", ")", ".", "setWidth", "(", "wide", "...
Sets this scene's size (width and height) in pixels. @param wide @param high @return this Scene
[ "Sets", "this", "scene", "s", "size", "(", "width", "and", "height", ")", "in", "pixels", "." ]
train
https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/shape/Scene.java#L160-L187
jbake-org/jbake
jbake-core/src/main/java/org/jbake/app/Crawler.java
Crawler.createUri
private String createUri(String uri) { try { return FileUtil.URI_SEPARATOR_CHAR + FilenameUtils.getPath(uri) + URLEncoder.encode(FilenameUtils.getBaseName(uri), StandardCharsets.UTF_8.name()) + config.getOutputExtension(); } catch (UnsupportedEncodingException e) { throw new RuntimeException("Missing UTF-8 encoding??", e); // Won't happen unless JDK is broken. } }
java
private String createUri(String uri) { try { return FileUtil.URI_SEPARATOR_CHAR + FilenameUtils.getPath(uri) + URLEncoder.encode(FilenameUtils.getBaseName(uri), StandardCharsets.UTF_8.name()) + config.getOutputExtension(); } catch (UnsupportedEncodingException e) { throw new RuntimeException("Missing UTF-8 encoding??", e); // Won't happen unless JDK is broken. } }
[ "private", "String", "createUri", "(", "String", "uri", ")", "{", "try", "{", "return", "FileUtil", ".", "URI_SEPARATOR_CHAR", "+", "FilenameUtils", ".", "getPath", "(", "uri", ")", "+", "URLEncoder", ".", "encode", "(", "FilenameUtils", ".", "getBaseName", ...
commons-codec's URLCodec could be used when we add that dependency.
[ "commons", "-", "codec", "s", "URLCodec", "could", "be", "used", "when", "we", "add", "that", "dependency", "." ]
train
https://github.com/jbake-org/jbake/blob/beb9042a54bf0eb168821d524c88b9ea0bee88dc/jbake-core/src/main/java/org/jbake/app/Crawler.java#L153-L162
casmi/casmi
src/main/java/casmi/graphics/element/Lines.java
Lines.vertex
public void vertex(double x, double y) { MODE = LINES; this.x.add(x); this.y.add(y); colors.add(this.strokeColor); calcG(); }
java
public void vertex(double x, double y) { MODE = LINES; this.x.add(x); this.y.add(y); colors.add(this.strokeColor); calcG(); }
[ "public", "void", "vertex", "(", "double", "x", ",", "double", "y", ")", "{", "MODE", "=", "LINES", ";", "this", ".", "x", ".", "add", "(", "x", ")", ";", "this", ".", "y", ".", "add", "(", "y", ")", ";", "colors", ".", "add", "(", "this", ...
Adds the point to Lines. @param x The x-coordinate of a new added point. @param y The y-coordinate of a new added point.
[ "Adds", "the", "point", "to", "Lines", "." ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Lines.java#L78-L84
Azure/azure-sdk-for-java
datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/AccountsInner.java
AccountsInner.checkNameAvailabilityAsync
public Observable<NameAvailabilityInformationInner> checkNameAvailabilityAsync(String location, CheckNameAvailabilityParameters parameters) { return checkNameAvailabilityWithServiceResponseAsync(location, parameters).map(new Func1<ServiceResponse<NameAvailabilityInformationInner>, NameAvailabilityInformationInner>() { @Override public NameAvailabilityInformationInner call(ServiceResponse<NameAvailabilityInformationInner> response) { return response.body(); } }); }
java
public Observable<NameAvailabilityInformationInner> checkNameAvailabilityAsync(String location, CheckNameAvailabilityParameters parameters) { return checkNameAvailabilityWithServiceResponseAsync(location, parameters).map(new Func1<ServiceResponse<NameAvailabilityInformationInner>, NameAvailabilityInformationInner>() { @Override public NameAvailabilityInformationInner call(ServiceResponse<NameAvailabilityInformationInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "NameAvailabilityInformationInner", ">", "checkNameAvailabilityAsync", "(", "String", "location", ",", "CheckNameAvailabilityParameters", "parameters", ")", "{", "return", "checkNameAvailabilityWithServiceResponseAsync", "(", "location", ",", "param...
Checks whether the specified account name is available or taken. @param location The resource location without whitespace. @param parameters Parameters supplied to check the Data Lake Analytics account name availability. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the NameAvailabilityInformationInner object
[ "Checks", "whether", "the", "specified", "account", "name", "is", "available", "or", "taken", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/AccountsInner.java#L1388-L1395
knightliao/disconf
disconf-web/src/main/java/com/baidu/unbiz/common/genericdao/dao/GenericDao.java
GenericDao.find
public List<ENTITY> find(String column, Object value) { return find(Operators.match(column, value)); }
java
public List<ENTITY> find(String column, Object value) { return find(Operators.match(column, value)); }
[ "public", "List", "<", "ENTITY", ">", "find", "(", "String", "column", ",", "Object", "value", ")", "{", "return", "find", "(", "Operators", ".", "match", "(", "column", ",", "value", ")", ")", ";", "}" ]
获取查询结果 @param column 条件字段 @param value 条件字段的值。支持集合对象,支持数组,会按照in 操作来组装条件 @return
[ "获取查询结果" ]
train
https://github.com/knightliao/disconf/blob/d413cbce9334fe38a5a24982ce4db3a6ed8e98ea/disconf-web/src/main/java/com/baidu/unbiz/common/genericdao/dao/GenericDao.java#L278-L280
zxing/zxing
core/src/main/java/com/google/zxing/oned/UPCEANReader.java
UPCEANReader.decodeDigit
static int decodeDigit(BitArray row, int[] counters, int rowOffset, int[][] patterns) throws NotFoundException { recordPattern(row, rowOffset, counters); float bestVariance = MAX_AVG_VARIANCE; // worst variance we'll accept int bestMatch = -1; int max = patterns.length; for (int i = 0; i < max; i++) { int[] pattern = patterns[i]; float variance = patternMatchVariance(counters, pattern, MAX_INDIVIDUAL_VARIANCE); if (variance < bestVariance) { bestVariance = variance; bestMatch = i; } } if (bestMatch >= 0) { return bestMatch; } else { throw NotFoundException.getNotFoundInstance(); } }
java
static int decodeDigit(BitArray row, int[] counters, int rowOffset, int[][] patterns) throws NotFoundException { recordPattern(row, rowOffset, counters); float bestVariance = MAX_AVG_VARIANCE; // worst variance we'll accept int bestMatch = -1; int max = patterns.length; for (int i = 0; i < max; i++) { int[] pattern = patterns[i]; float variance = patternMatchVariance(counters, pattern, MAX_INDIVIDUAL_VARIANCE); if (variance < bestVariance) { bestVariance = variance; bestMatch = i; } } if (bestMatch >= 0) { return bestMatch; } else { throw NotFoundException.getNotFoundInstance(); } }
[ "static", "int", "decodeDigit", "(", "BitArray", "row", ",", "int", "[", "]", "counters", ",", "int", "rowOffset", ",", "int", "[", "]", "[", "]", "patterns", ")", "throws", "NotFoundException", "{", "recordPattern", "(", "row", ",", "rowOffset", ",", "c...
Attempts to decode a single UPC/EAN-encoded digit. @param row row of black/white values to decode @param counters the counts of runs of observed black/white/black/... values @param rowOffset horizontal offset to start decoding from @param patterns the set of patterns to use to decode -- sometimes different encodings for the digits 0-9 are used, and this indicates the encodings for 0 to 9 that should be used @return horizontal offset of first pixel beyond the decoded digit @throws NotFoundException if digit cannot be decoded
[ "Attempts", "to", "decode", "a", "single", "UPC", "/", "EAN", "-", "encoded", "digit", "." ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/oned/UPCEANReader.java#L361-L380
Netflix/servo
servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java
Monitors.newTimer
public static Timer newTimer(String name, TaggingContext context) { return newTimer(name, TimeUnit.MILLISECONDS, context); }
java
public static Timer newTimer(String name, TaggingContext context) { return newTimer(name, TimeUnit.MILLISECONDS, context); }
[ "public", "static", "Timer", "newTimer", "(", "String", "name", ",", "TaggingContext", "context", ")", "{", "return", "newTimer", "(", "name", ",", "TimeUnit", ".", "MILLISECONDS", ",", "context", ")", ";", "}" ]
Create a new timer with a name and context. The returned timer will maintain separate sub-monitors for each distinct set of tags returned from the context on an update operation.
[ "Create", "a", "new", "timer", "with", "a", "name", "and", "context", ".", "The", "returned", "timer", "will", "maintain", "separate", "sub", "-", "monitors", "for", "each", "distinct", "set", "of", "tags", "returned", "from", "the", "context", "on", "an",...
train
https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java#L90-L92