repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/XbaseTypeComputer.java
XbaseTypeComputer.reassignCheckedType
protected ITypeComputationState reassignCheckedType(XExpression condition, /* @Nullable */ XExpression guardedExpression, ITypeComputationState state) { if (condition instanceof XInstanceOfExpression) { XInstanceOfExpression instanceOfExpression = (XInstanceOfExpression) condition; JvmTypeReference castedType = instanceOfExpression.getType(); if (castedType != null) { state = state.withTypeCheckpoint(guardedExpression); JvmIdentifiableElement refinable = getRefinableCandidate(instanceOfExpression.getExpression(), state); if (refinable != null) { state.reassignType(refinable, state.getReferenceOwner().toLightweightTypeReference(castedType)); } } } return state; }
java
protected ITypeComputationState reassignCheckedType(XExpression condition, /* @Nullable */ XExpression guardedExpression, ITypeComputationState state) { if (condition instanceof XInstanceOfExpression) { XInstanceOfExpression instanceOfExpression = (XInstanceOfExpression) condition; JvmTypeReference castedType = instanceOfExpression.getType(); if (castedType != null) { state = state.withTypeCheckpoint(guardedExpression); JvmIdentifiableElement refinable = getRefinableCandidate(instanceOfExpression.getExpression(), state); if (refinable != null) { state.reassignType(refinable, state.getReferenceOwner().toLightweightTypeReference(castedType)); } } } return state; }
[ "protected", "ITypeComputationState", "reassignCheckedType", "(", "XExpression", "condition", ",", "/* @Nullable */", "XExpression", "guardedExpression", ",", "ITypeComputationState", "state", ")", "{", "if", "(", "condition", "instanceof", "XInstanceOfExpression", ")", "{"...
If the condition is a {@link XInstanceOfExpression type check}, the checked expression will be automatically casted in the returned state.
[ "If", "the", "condition", "is", "a", "{" ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/XbaseTypeComputer.java#L279-L292
beihaifeiwu/dolphin
dolphin-common/src/main/java/com/freetmp/common/annotation/AnnotationUtils.java
AnnotationUtils.findAnnotation
@SuppressWarnings("unchecked") public static <A extends Annotation> A findAnnotation(Class<?> clazz, Class<A> annotationType) { AnnotationCacheKey cacheKey = new AnnotationCacheKey(clazz, annotationType); A result = (A) findAnnotationCache.get(cacheKey); if (result == null) { result = findAnnotation(clazz, annotationType, new HashSet<Annotation>()); if (result != null) { findAnnotationCache.put(cacheKey, result); } } return result; }
java
@SuppressWarnings("unchecked") public static <A extends Annotation> A findAnnotation(Class<?> clazz, Class<A> annotationType) { AnnotationCacheKey cacheKey = new AnnotationCacheKey(clazz, annotationType); A result = (A) findAnnotationCache.get(cacheKey); if (result == null) { result = findAnnotation(clazz, annotationType, new HashSet<Annotation>()); if (result != null) { findAnnotationCache.put(cacheKey, result); } } return result; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "A", "extends", "Annotation", ">", "A", "findAnnotation", "(", "Class", "<", "?", ">", "clazz", ",", "Class", "<", "A", ">", "annotationType", ")", "{", "AnnotationCacheKey", "cache...
Find a single {@link Annotation} of {@code annotationType} on the supplied {@link Class}, traversing its interfaces, annotations, and superclasses if the annotation is not <em>present</em> on the given class itself. <p>This method explicitly handles class-level annotations which are not declared as {@link java.lang.annotation.Inherited inherited} <em>as well as meta-annotations and annotations on interfaces</em>. <p>The algorithm operates as follows: <ol> <li>Search for the annotation on the given class and return it if found. <li>Recursively search through all interfaces that the given class declares. <li>Recursively search through all annotations that the given class declares. <li>Recursively search through the superclass hierarchy of the given class. </ol> <p>Note: in this context, the term <em>recursively</em> means that the search process continues by returning to step #1 with the current interface, annotation, or superclass as the class to look for annotations on. @param clazz the class to look for annotations on @param annotationType the type of annotation to look for @return the annotation if found, or {@code null} if not found
[ "Find", "a", "single", "{" ]
train
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/annotation/AnnotationUtils.java#L324-L335
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/TaskOperations.java
TaskOperations.listTasks
public PagedList<CloudTask> listTasks(String jobId, DetailLevel detailLevel) throws BatchErrorException, IOException { return listTasks(jobId, detailLevel, null); }
java
public PagedList<CloudTask> listTasks(String jobId, DetailLevel detailLevel) throws BatchErrorException, IOException { return listTasks(jobId, detailLevel, null); }
[ "public", "PagedList", "<", "CloudTask", ">", "listTasks", "(", "String", "jobId", ",", "DetailLevel", "detailLevel", ")", "throws", "BatchErrorException", ",", "IOException", "{", "return", "listTasks", "(", "jobId", ",", "detailLevel", ",", "null", ")", ";", ...
Lists the {@link CloudTask tasks} of the specified job. @param jobId The ID of the job. @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 CloudTask} 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", "CloudTask", "tasks", "}", "of", "the", "specified", "job", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/TaskOperations.java#L418-L421
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dimensionalityreduction/RandomProjection.java
RandomProjection.gaussianRandomMatrix
private INDArray gaussianRandomMatrix(long[] shape, Random rng){ Nd4j.checkShapeValues(shape); INDArray res = Nd4j.create(shape); GaussianDistribution op1 = new GaussianDistribution(res, 0.0, 1.0 / Math.sqrt(shape[0])); Nd4j.getExecutioner().exec(op1, rng); return res; }
java
private INDArray gaussianRandomMatrix(long[] shape, Random rng){ Nd4j.checkShapeValues(shape); INDArray res = Nd4j.create(shape); GaussianDistribution op1 = new GaussianDistribution(res, 0.0, 1.0 / Math.sqrt(shape[0])); Nd4j.getExecutioner().exec(op1, rng); return res; }
[ "private", "INDArray", "gaussianRandomMatrix", "(", "long", "[", "]", "shape", ",", "Random", "rng", ")", "{", "Nd4j", ".", "checkShapeValues", "(", "shape", ")", ";", "INDArray", "res", "=", "Nd4j", ".", "create", "(", "shape", ")", ";", "GaussianDistribu...
Generate a dense Gaussian random matrix. The n' components of the random matrix are drawn from N(0, 1.0 / n'). @param shape @param rng @return
[ "Generate", "a", "dense", "Gaussian", "random", "matrix", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dimensionalityreduction/RandomProjection.java#L132-L139
feedzai/pdb
src/main/java/com/feedzai/commons/sql/abstraction/dml/dialect/SqlBuilder.java
SqlBuilder.notIn
public static Expression notIn(final Expression e1, final Expression e2) { return new RepeatDelimiter(NOTIN, e1.isEnclosed() ? e1 : e1.enclose(), e2.isEnclosed() ? e2 : e2.enclose()); }
java
public static Expression notIn(final Expression e1, final Expression e2) { return new RepeatDelimiter(NOTIN, e1.isEnclosed() ? e1 : e1.enclose(), e2.isEnclosed() ? e2 : e2.enclose()); }
[ "public", "static", "Expression", "notIn", "(", "final", "Expression", "e1", ",", "final", "Expression", "e2", ")", "{", "return", "new", "RepeatDelimiter", "(", "NOTIN", ",", "e1", ".", "isEnclosed", "(", ")", "?", "e1", ":", "e1", ".", "enclose", "(", ...
The NOT IN expression. @param e1 The first expression. @param e2 The second expression. @return The expression.
[ "The", "NOT", "IN", "expression", "." ]
train
https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/dml/dialect/SqlBuilder.java#L694-L696
apache/incubator-gobblin
gobblin-api/src/main/java/org/apache/gobblin/configuration/WorkUnitState.java
WorkUnitState.getActualHighWatermark
public <T extends Watermark> T getActualHighWatermark(Class<T> watermarkClass, Gson gson) { JsonElement json = getActualHighWatermark(); if (json == null) { json = this.workUnit.getLowWatermark(); if (json == null) { return null; } } return gson.fromJson(json, watermarkClass); }
java
public <T extends Watermark> T getActualHighWatermark(Class<T> watermarkClass, Gson gson) { JsonElement json = getActualHighWatermark(); if (json == null) { json = this.workUnit.getLowWatermark(); if (json == null) { return null; } } return gson.fromJson(json, watermarkClass); }
[ "public", "<", "T", "extends", "Watermark", ">", "T", "getActualHighWatermark", "(", "Class", "<", "T", ">", "watermarkClass", ",", "Gson", "gson", ")", "{", "JsonElement", "json", "=", "getActualHighWatermark", "(", ")", ";", "if", "(", "json", "==", "nul...
Get the actual high {@link Watermark}. If the {@code WorkUnitState} does not contain the actual high watermark (which may be caused by task failures), the low watermark in the corresponding {@link WorkUnit} will be returned. @param watermarkClass the watermark class for this {@code WorkUnitState}. @param gson a {@link Gson} object used to deserialize the watermark. @return the actual high watermark in this {@code WorkUnitState}. null is returned if this {@code WorkUnitState} does not contain an actual high watermark, and the corresponding {@code WorkUnit} does not contain a low watermark.
[ "Get", "the", "actual", "high", "{", "@link", "Watermark", "}", ".", "If", "the", "{", "@code", "WorkUnitState", "}", "does", "not", "contain", "the", "actual", "high", "watermark", "(", "which", "may", "be", "caused", "by", "task", "failures", ")", "the...
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-api/src/main/java/org/apache/gobblin/configuration/WorkUnitState.java#L218-L227
gallandarakhneorg/afc
advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/Vector2dfx.java
Vector2dfx.lengthProperty
public ReadOnlyDoubleProperty lengthProperty() { if (this.lengthProperty == null) { this.lengthProperty = new ReadOnlyDoubleWrapper(this, MathFXAttributeNames.LENGTH); this.lengthProperty.bind(Bindings.createDoubleBinding(() -> Math.sqrt(lengthSquaredProperty().doubleValue()), lengthSquaredProperty())); } return this.lengthProperty.getReadOnlyProperty(); }
java
public ReadOnlyDoubleProperty lengthProperty() { if (this.lengthProperty == null) { this.lengthProperty = new ReadOnlyDoubleWrapper(this, MathFXAttributeNames.LENGTH); this.lengthProperty.bind(Bindings.createDoubleBinding(() -> Math.sqrt(lengthSquaredProperty().doubleValue()), lengthSquaredProperty())); } return this.lengthProperty.getReadOnlyProperty(); }
[ "public", "ReadOnlyDoubleProperty", "lengthProperty", "(", ")", "{", "if", "(", "this", ".", "lengthProperty", "==", "null", ")", "{", "this", ".", "lengthProperty", "=", "new", "ReadOnlyDoubleWrapper", "(", "this", ",", "MathFXAttributeNames", ".", "LENGTH", ")...
Replies the property that represents the length of the vector. @return the length property
[ "Replies", "the", "property", "that", "represents", "the", "length", "of", "the", "vector", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/Vector2dfx.java#L170-L177
brianwhu/xillium
data/src/main/java/org/xillium/data/CachedResultSet.java
CachedResultSet.chooseFields
public static <T> CachedResultSet chooseFields(Collection<T> collection, String... columns) { CachedResultSet rs = new CachedResultSet(columns, new ArrayList<Object[]>()); for (T object: collection) { Object[] row = new Object[columns.length]; for (int i = 0; i < columns.length; ++i) { try { Object value = Beans.getKnownField(object.getClass(), columns[i]).get(object); if (value != null) { if (value.getClass().isArray()) { row[i] = Strings.join(value, ';'); } else { row[i] = value.toString(); } } else { row[i] = null; } } catch (Exception x) { row[i] = null; } } rs.rows.add(row); } return rs; }
java
public static <T> CachedResultSet chooseFields(Collection<T> collection, String... columns) { CachedResultSet rs = new CachedResultSet(columns, new ArrayList<Object[]>()); for (T object: collection) { Object[] row = new Object[columns.length]; for (int i = 0; i < columns.length; ++i) { try { Object value = Beans.getKnownField(object.getClass(), columns[i]).get(object); if (value != null) { if (value.getClass().isArray()) { row[i] = Strings.join(value, ';'); } else { row[i] = value.toString(); } } else { row[i] = null; } } catch (Exception x) { row[i] = null; } } rs.rows.add(row); } return rs; }
[ "public", "static", "<", "T", ">", "CachedResultSet", "chooseFields", "(", "Collection", "<", "T", ">", "collection", ",", "String", "...", "columns", ")", "{", "CachedResultSet", "rs", "=", "new", "CachedResultSet", "(", "columns", ",", "new", "ArrayList", ...
Retrieves the rows from a collection of Objects, where a subset of the objects' (of type T) <i>public fields</i> are taken as result set columns. @param <T> the type of the objects in the collection @param collection a collection of objects @param columns names of a select subset of each object's public fields @return the result set from the list of objects
[ "Retrieves", "the", "rows", "from", "a", "collection", "of", "Objects", "where", "a", "subset", "of", "the", "objects", "(", "of", "type", "T", ")", "<i", ">", "public", "fields<", "/", "i", ">", "are", "taken", "as", "result", "set", "columns", "." ]
train
https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/data/src/main/java/org/xillium/data/CachedResultSet.java#L148-L172
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java
SftpSubsystemChannel.changePermissions
public void changePermissions(String filename, String permissions) throws SftpStatusException, SshException { SftpFileAttributes attrs = new SftpFileAttributes(this, SftpFileAttributes.SSH_FILEXFER_TYPE_UNKNOWN); attrs.setPermissions(permissions); setAttributes(filename, attrs); }
java
public void changePermissions(String filename, String permissions) throws SftpStatusException, SshException { SftpFileAttributes attrs = new SftpFileAttributes(this, SftpFileAttributes.SSH_FILEXFER_TYPE_UNKNOWN); attrs.setPermissions(permissions); setAttributes(filename, attrs); }
[ "public", "void", "changePermissions", "(", "String", "filename", ",", "String", "permissions", ")", "throws", "SftpStatusException", ",", "SshException", "{", "SftpFileAttributes", "attrs", "=", "new", "SftpFileAttributes", "(", "this", ",", "SftpFileAttributes", "."...
Change the permissions of a file. @param filename the path to the file. @param permissions a string containing the permissions, for example "rw-r--r--" @throws SftpStatusException , SshException
[ "Change", "the", "permissions", "of", "a", "file", "." ]
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java#L446-L454
vanilladb/vanillacore
src/main/java/org/vanilladb/core/storage/record/RecordPage.java
RecordPage.getVal
public Constant getVal(String fldName) { int position = fieldPos(fldName); return getVal(position, ti.schema().type(fldName)); }
java
public Constant getVal(String fldName) { int position = fieldPos(fldName); return getVal(position, ti.schema().type(fldName)); }
[ "public", "Constant", "getVal", "(", "String", "fldName", ")", "{", "int", "position", "=", "fieldPos", "(", "fldName", ")", ";", "return", "getVal", "(", "position", ",", "ti", ".", "schema", "(", ")", ".", "type", "(", "fldName", ")", ")", ";", "}"...
Returns the value stored in the specified field of this record. @param fldName the name of the field. @return the constant stored in that field
[ "Returns", "the", "value", "stored", "in", "the", "specified", "field", "of", "this", "record", "." ]
train
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/record/RecordPage.java#L187-L190
Netflix/astyanax
astyanax-cql/src/main/java/com/netflix/astyanax/cql/reads/CFRowRangeQueryGen.java
CFRowRangeQueryGen.getQueryStatement
public BoundStatement getQueryStatement(CqlRowSliceQueryImpl<?,?> rowSliceQuery, boolean useCaching) { switch (rowSliceQuery.getColQueryType()) { case AllColumns: return SelectAllColumnsForRowRange.getBoundStatement(rowSliceQuery, useCaching); case ColumnSet: return SelectColumnSetForRowRange.getBoundStatement(rowSliceQuery, useCaching); case ColumnRange: if (isCompositeColumn) { return SelectCompositeColumnRangeForRowRange.getBoundStatement(rowSliceQuery, useCaching); } else { return SelectColumnRangeForRowRange.getBoundStatement(rowSliceQuery, useCaching); } default : throw new RuntimeException("RowSliceQuery with row range use case not supported."); } }
java
public BoundStatement getQueryStatement(CqlRowSliceQueryImpl<?,?> rowSliceQuery, boolean useCaching) { switch (rowSliceQuery.getColQueryType()) { case AllColumns: return SelectAllColumnsForRowRange.getBoundStatement(rowSliceQuery, useCaching); case ColumnSet: return SelectColumnSetForRowRange.getBoundStatement(rowSliceQuery, useCaching); case ColumnRange: if (isCompositeColumn) { return SelectCompositeColumnRangeForRowRange.getBoundStatement(rowSliceQuery, useCaching); } else { return SelectColumnRangeForRowRange.getBoundStatement(rowSliceQuery, useCaching); } default : throw new RuntimeException("RowSliceQuery with row range use case not supported."); } }
[ "public", "BoundStatement", "getQueryStatement", "(", "CqlRowSliceQueryImpl", "<", "?", ",", "?", ">", "rowSliceQuery", ",", "boolean", "useCaching", ")", "{", "switch", "(", "rowSliceQuery", ".", "getColQueryType", "(", ")", ")", "{", "case", "AllColumns", ":",...
Main method used to generate the query for the specified row slice query. Note that depending on the query signature, the caller may choose to enable/disable caching @param rowSliceQuery: The Astaynax query for which we need to generate a java driver query @param useCaching: boolean condition indicating whether we should use a previously cached prepared stmt or not. If false, then the cache is ignored and we generate the prepared stmt for this query If true, then the cached prepared stmt is used. If the cache has not been inited, then the prepared stmt is constructed for this query and subsequently cached @return BoundStatement: they statement for this Astyanax query
[ "Main", "method", "used", "to", "generate", "the", "query", "for", "the", "specified", "row", "slice", "query", ".", "Note", "that", "depending", "on", "the", "query", "signature", "the", "caller", "may", "choose", "to", "enable", "/", "disable", "caching" ]
train
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-cql/src/main/java/com/netflix/astyanax/cql/reads/CFRowRangeQueryGen.java#L390-L407
apache/incubator-shardingsphere
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/SQLRewriteEngine.java
SQLRewriteEngine.generateSQL
public SQLUnit generateSQL(final TableUnit tableUnit, final SQLBuilder sqlBuilder, final ShardingDataSourceMetaData shardingDataSourceMetaData) { return sqlBuilder.toSQL(tableUnit, getTableTokens(tableUnit), shardingRule, shardingDataSourceMetaData); }
java
public SQLUnit generateSQL(final TableUnit tableUnit, final SQLBuilder sqlBuilder, final ShardingDataSourceMetaData shardingDataSourceMetaData) { return sqlBuilder.toSQL(tableUnit, getTableTokens(tableUnit), shardingRule, shardingDataSourceMetaData); }
[ "public", "SQLUnit", "generateSQL", "(", "final", "TableUnit", "tableUnit", ",", "final", "SQLBuilder", "sqlBuilder", ",", "final", "ShardingDataSourceMetaData", "shardingDataSourceMetaData", ")", "{", "return", "sqlBuilder", ".", "toSQL", "(", "tableUnit", ",", "getT...
Generate SQL string. @param tableUnit route table unit @param sqlBuilder SQL builder @param shardingDataSourceMetaData sharding data source meta data @return SQL unit
[ "Generate", "SQL", "string", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/SQLRewriteEngine.java#L514-L516
buschmais/jqa-java-plugin
src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/VisitorHelper.java
VisitorHelper.getMethodDescriptor
MethodDescriptor getMethodDescriptor(TypeCache.CachedType<?> cachedType, String signature) { MethodDescriptor methodDescriptor = cachedType.getMethod(signature); if (methodDescriptor == null) { if (signature.startsWith(CONSTRUCTOR_METHOD)) { methodDescriptor = scannerContext.getStore().create(ConstructorDescriptor.class); } else { methodDescriptor = scannerContext.getStore().create(MethodDescriptor.class); } methodDescriptor.setSignature(signature); cachedType.addMember(signature, methodDescriptor); } return methodDescriptor; }
java
MethodDescriptor getMethodDescriptor(TypeCache.CachedType<?> cachedType, String signature) { MethodDescriptor methodDescriptor = cachedType.getMethod(signature); if (methodDescriptor == null) { if (signature.startsWith(CONSTRUCTOR_METHOD)) { methodDescriptor = scannerContext.getStore().create(ConstructorDescriptor.class); } else { methodDescriptor = scannerContext.getStore().create(MethodDescriptor.class); } methodDescriptor.setSignature(signature); cachedType.addMember(signature, methodDescriptor); } return methodDescriptor; }
[ "MethodDescriptor", "getMethodDescriptor", "(", "TypeCache", ".", "CachedType", "<", "?", ">", "cachedType", ",", "String", "signature", ")", "{", "MethodDescriptor", "methodDescriptor", "=", "cachedType", ".", "getMethod", "(", "signature", ")", ";", "if", "(", ...
Return the method descriptor for the given type and method signature. @param cachedType The containing type. @param signature The method signature. @return The method descriptor.
[ "Return", "the", "method", "descriptor", "for", "the", "given", "type", "and", "method", "signature", "." ]
train
https://github.com/buschmais/jqa-java-plugin/blob/4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54/src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/VisitorHelper.java#L96-L108
pmlopes/yoke
framework/src/main/java/com/jetdrone/vertx/yoke/middleware/YokeRequest.java
YokeRequest.loadSession
public void loadSession(final String sessionId, final Handler<Object> handler) { if (sessionId == null) { handler.handle(null); return; } store.get(sessionId, new Handler<JsonObject>() { @Override public void handle(JsonObject session) { if (session != null) { put("session", session); } response().headersHandler(new Handler<Void>() { @Override public void handle(Void event) { int responseStatus = response().getStatusCode(); // Only save on success and redirect status codes if (responseStatus >= 200 && responseStatus < 400) { JsonObject session = get("session"); if (session != null) { store.set(sessionId, session, new Handler<Object>() { @Override public void handle(Object error) { if (error != null) { // TODO: better handling of errors System.err.println(error); } } }); } } } }); handler.handle(null); } }); }
java
public void loadSession(final String sessionId, final Handler<Object> handler) { if (sessionId == null) { handler.handle(null); return; } store.get(sessionId, new Handler<JsonObject>() { @Override public void handle(JsonObject session) { if (session != null) { put("session", session); } response().headersHandler(new Handler<Void>() { @Override public void handle(Void event) { int responseStatus = response().getStatusCode(); // Only save on success and redirect status codes if (responseStatus >= 200 && responseStatus < 400) { JsonObject session = get("session"); if (session != null) { store.set(sessionId, session, new Handler<Object>() { @Override public void handle(Object error) { if (error != null) { // TODO: better handling of errors System.err.println(error); } } }); } } } }); handler.handle(null); } }); }
[ "public", "void", "loadSession", "(", "final", "String", "sessionId", ",", "final", "Handler", "<", "Object", ">", "handler", ")", "{", "if", "(", "sessionId", "==", "null", ")", "{", "handler", ".", "handle", "(", "null", ")", ";", "return", ";", "}",...
Loads a session given its session id and sets the "session" property in the request context. @param sessionId the id to load @param handler the success/complete handler
[ "Loads", "a", "session", "given", "its", "session", "id", "and", "sets", "the", "session", "property", "in", "the", "request", "context", "." ]
train
https://github.com/pmlopes/yoke/blob/fe8a64036f09fb745f0644faddd46162d64faf3c/framework/src/main/java/com/jetdrone/vertx/yoke/middleware/YokeRequest.java#L346-L384
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AtomCache.java
AtomCache.getStructureForCathDomain
public Structure getStructureForCathDomain(StructureName structureName) throws IOException, StructureException { return getStructureForCathDomain(structureName, CathFactory.getCathDatabase()); }
java
public Structure getStructureForCathDomain(StructureName structureName) throws IOException, StructureException { return getStructureForCathDomain(structureName, CathFactory.getCathDatabase()); }
[ "public", "Structure", "getStructureForCathDomain", "(", "StructureName", "structureName", ")", "throws", "IOException", ",", "StructureException", "{", "return", "getStructureForCathDomain", "(", "structureName", ",", "CathFactory", ".", "getCathDatabase", "(", ")", ")",...
Returns a {@link Structure} corresponding to the CATH identifier supplied in {@code structureName}, using the the {@link CathDatabase} at {@link CathFactory#getCathDatabase()}.
[ "Returns", "a", "{" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AtomCache.java#L817-L819
zaproxy/zaproxy
src/org/parosproxy/paros/db/paros/ParosTableHistory.java
ParosTableHistory.getHistoryIdsExceptOfHistType
@Override public List<Integer> getHistoryIdsExceptOfHistType(long sessionId, int... histTypes) throws DatabaseException { return getHistoryIdsByParams(sessionId, 0, false, histTypes); }
java
@Override public List<Integer> getHistoryIdsExceptOfHistType(long sessionId, int... histTypes) throws DatabaseException { return getHistoryIdsByParams(sessionId, 0, false, histTypes); }
[ "@", "Override", "public", "List", "<", "Integer", ">", "getHistoryIdsExceptOfHistType", "(", "long", "sessionId", ",", "int", "...", "histTypes", ")", "throws", "DatabaseException", "{", "return", "getHistoryIdsByParams", "(", "sessionId", ",", "0", ",", "false",...
Returns all the history record IDs of the given session except the ones with the given history types. * @param sessionId the ID of session of the history records @param histTypes the history types of the history records that should be excluded @return a {@code List} with all the history IDs of the given session and history types, never {@code null} @throws DatabaseException if an error occurred while getting the history IDs @since 2.3.0 @see #getHistoryIdsOfHistType(long, int...)
[ "Returns", "all", "the", "history", "record", "IDs", "of", "the", "given", "session", "except", "the", "ones", "with", "the", "given", "history", "types", ".", "*" ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/db/paros/ParosTableHistory.java#L504-L507
grpc/grpc-java
core/src/main/java/io/grpc/internal/ServiceConfigUtil.java
ServiceConfigUtil.unwrapLoadBalancingConfig
@SuppressWarnings("unchecked") public static LbConfig unwrapLoadBalancingConfig(Map<String, ?> lbConfig) { if (lbConfig.size() != 1) { throw new RuntimeException( "There are " + lbConfig.size() + " fields in a LoadBalancingConfig object. Exactly one" + " is expected. Config=" + lbConfig); } String key = lbConfig.entrySet().iterator().next().getKey(); return new LbConfig(key, getObject(lbConfig, key)); }
java
@SuppressWarnings("unchecked") public static LbConfig unwrapLoadBalancingConfig(Map<String, ?> lbConfig) { if (lbConfig.size() != 1) { throw new RuntimeException( "There are " + lbConfig.size() + " fields in a LoadBalancingConfig object. Exactly one" + " is expected. Config=" + lbConfig); } String key = lbConfig.entrySet().iterator().next().getKey(); return new LbConfig(key, getObject(lbConfig, key)); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "LbConfig", "unwrapLoadBalancingConfig", "(", "Map", "<", "String", ",", "?", ">", "lbConfig", ")", "{", "if", "(", "lbConfig", ".", "size", "(", ")", "!=", "1", ")", "{", "throw", "...
Unwrap a LoadBalancingConfig JSON object into a {@link LbConfig}. The input is a JSON object (map) with exactly one entry, where the key is the policy name and the value is a config object for that policy.
[ "Unwrap", "a", "LoadBalancingConfig", "JSON", "object", "into", "a", "{" ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/ServiceConfigUtil.java#L356-L365
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/convert/MergeConverter.java
MergeConverter.setString
public int setString(String strString, boolean bDisplayOption, int iMoveMode) // init this field override for other value { if (this.getNextConverter() != null) return this.getNextConverter().setString(strString, bDisplayOption, iMoveMode); else return super.setString(strString, bDisplayOption, iMoveMode); }
java
public int setString(String strString, boolean bDisplayOption, int iMoveMode) // init this field override for other value { if (this.getNextConverter() != null) return this.getNextConverter().setString(strString, bDisplayOption, iMoveMode); else return super.setString(strString, bDisplayOption, iMoveMode); }
[ "public", "int", "setString", "(", "String", "strString", ",", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "// init this field override for other value", "{", "if", "(", "this", ".", "getNextConverter", "(", ")", "!=", "null", ")", "return", "this",...
Convert and move string to this field. Set the current string of the current next converter.. @param strString the state to set the data to. @param bDisplayOption Display the data on the screen if true. @param iMoveMode INIT, SCREEN, or READ move mode. @return The error code (or NORMAL_RETURN).
[ "Convert", "and", "move", "string", "to", "this", "field", ".", "Set", "the", "current", "string", "of", "the", "current", "next", "converter", ".." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/MergeConverter.java#L153-L159
google/closure-templates
java/src/com/google/template/soy/sharedpasses/render/RenderVisitorAssistantForMsgs.java
RenderVisitorAssistantForMsgs.renderMsgFromTranslation
private void renderMsgFromTranslation( MsgNode msg, ImmutableList<SoyMsgPart> msgParts, @Nullable ULocale locale) { SoyMsgPart firstPart = msgParts.get(0); if (firstPart instanceof SoyMsgPluralPart) { new PlrselMsgPartsVisitor(msg, locale).visitPart((SoyMsgPluralPart) firstPart); } else if (firstPart instanceof SoyMsgSelectPart) { new PlrselMsgPartsVisitor(msg, locale).visitPart((SoyMsgSelectPart) firstPart); } else { for (SoyMsgPart msgPart : msgParts) { if (msgPart instanceof SoyMsgRawTextPart) { RenderVisitor.append( master.getCurrOutputBufForUseByAssistants(), ((SoyMsgRawTextPart) msgPart).getRawText()); } else if (msgPart instanceof SoyMsgPlaceholderPart) { String placeholderName = ((SoyMsgPlaceholderPart) msgPart).getPlaceholderName(); visit(msg.getRepPlaceholderNode(placeholderName)); } else { throw new AssertionError(); } } } }
java
private void renderMsgFromTranslation( MsgNode msg, ImmutableList<SoyMsgPart> msgParts, @Nullable ULocale locale) { SoyMsgPart firstPart = msgParts.get(0); if (firstPart instanceof SoyMsgPluralPart) { new PlrselMsgPartsVisitor(msg, locale).visitPart((SoyMsgPluralPart) firstPart); } else if (firstPart instanceof SoyMsgSelectPart) { new PlrselMsgPartsVisitor(msg, locale).visitPart((SoyMsgSelectPart) firstPart); } else { for (SoyMsgPart msgPart : msgParts) { if (msgPart instanceof SoyMsgRawTextPart) { RenderVisitor.append( master.getCurrOutputBufForUseByAssistants(), ((SoyMsgRawTextPart) msgPart).getRawText()); } else if (msgPart instanceof SoyMsgPlaceholderPart) { String placeholderName = ((SoyMsgPlaceholderPart) msgPart).getPlaceholderName(); visit(msg.getRepPlaceholderNode(placeholderName)); } else { throw new AssertionError(); } } } }
[ "private", "void", "renderMsgFromTranslation", "(", "MsgNode", "msg", ",", "ImmutableList", "<", "SoyMsgPart", ">", "msgParts", ",", "@", "Nullable", "ULocale", "locale", ")", "{", "SoyMsgPart", "firstPart", "=", "msgParts", ".", "get", "(", "0", ")", ";", "...
Private helper for visitMsgFallbackGroupNode() to render a message from its translation.
[ "Private", "helper", "for", "visitMsgFallbackGroupNode", "()", "to", "render", "a", "message", "from", "its", "translation", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/sharedpasses/render/RenderVisitorAssistantForMsgs.java#L103-L130
zaproxy/zaproxy
src/org/zaproxy/zap/extension/httpsessions/ExtensionHttpSessions.java
ExtensionHttpSessions.isRemovedDefaultSessionToken
private boolean isRemovedDefaultSessionToken(String site, String token) { if (removedDefaultTokens == null) return false; HashSet<String> removed = removedDefaultTokens.get(site); if (removed == null || !removed.contains(token)) return false; return true; }
java
private boolean isRemovedDefaultSessionToken(String site, String token) { if (removedDefaultTokens == null) return false; HashSet<String> removed = removedDefaultTokens.get(site); if (removed == null || !removed.contains(token)) return false; return true; }
[ "private", "boolean", "isRemovedDefaultSessionToken", "(", "String", "site", ",", "String", "token", ")", "{", "if", "(", "removedDefaultTokens", "==", "null", ")", "return", "false", ";", "HashSet", "<", "String", ">", "removed", "=", "removedDefaultTokens", "....
Checks if a particular default session token was removed by an user as a session token for a site. @param site the site. This parameter has to be formed as defined in the {@link ExtensionHttpSessions} class documentation. @param token the token @return true, if it is a previously removed default session token
[ "Checks", "if", "a", "particular", "default", "session", "token", "was", "removed", "by", "an", "user", "as", "a", "session", "token", "for", "a", "site", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/httpsessions/ExtensionHttpSessions.java#L309-L316
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/odselement/StylesContainer.java
StylesContainer.writePageLayoutStyles
public void writePageLayoutStyles(final XMLUtil util, final Appendable appendable) throws IOException { for (final PageLayoutStyle ps : this.pageLayoutStylesContainer.getValues()) { assert ps.isHidden(); ps.appendXMLToAutomaticStyle(util, appendable); } }
java
public void writePageLayoutStyles(final XMLUtil util, final Appendable appendable) throws IOException { for (final PageLayoutStyle ps : this.pageLayoutStylesContainer.getValues()) { assert ps.isHidden(); ps.appendXMLToAutomaticStyle(util, appendable); } }
[ "public", "void", "writePageLayoutStyles", "(", "final", "XMLUtil", "util", ",", "final", "Appendable", "appendable", ")", "throws", "IOException", "{", "for", "(", "final", "PageLayoutStyle", "ps", ":", "this", ".", "pageLayoutStylesContainer", ".", "getValues", ...
Write the page layout styles. The page layout will always belong to to styles .xml/automatic-styles, since it's an automatic style (see 16.5) and it is not "used in a document" (3.1.3.2) @param util an util @param appendable the destination @throws IOException if an I/O error occurs
[ "Write", "the", "page", "layout", "styles", ".", "The", "page", "layout", "will", "always", "belong", "to", "to", "styles", ".", "xml", "/", "automatic", "-", "styles", "since", "it", "s", "an", "automatic", "style", "(", "see", "16", ".", "5", ")", ...
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/odselement/StylesContainer.java#L397-L403
openbase/jul
communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractRemoteClient.java
AbstractRemoteClient.applyDataUpdate
private void applyDataUpdate(final M data) { this.data = data; CompletableFutureLite<M> currentSyncFuture = null; Future<M> currentSyncTask = null; // Check if sync is in process. synchronized (syncMonitor) { if (syncFuture != null) { currentSyncFuture = syncFuture; currentSyncTask = syncTask; syncFuture = null; syncTask = null; } } if (currentSyncFuture != null) { currentSyncFuture.complete(data); } if (currentSyncTask != null && !currentSyncTask.isDone()) { currentSyncTask.cancel(false); } setConnectionState(CONNECTED); // Notify data update try { notifyPrioritizedObservers(data); } catch (CouldNotPerformException ex) { ExceptionPrinter.printHistory(new CouldNotPerformException("Could not notify data update!", ex), logger); } try { dataObservable.notifyObservers(data); } catch (CouldNotPerformException ex) { ExceptionPrinter.printHistory(new CouldNotPerformException("Could not notify data update to all observer!", ex), logger); } }
java
private void applyDataUpdate(final M data) { this.data = data; CompletableFutureLite<M> currentSyncFuture = null; Future<M> currentSyncTask = null; // Check if sync is in process. synchronized (syncMonitor) { if (syncFuture != null) { currentSyncFuture = syncFuture; currentSyncTask = syncTask; syncFuture = null; syncTask = null; } } if (currentSyncFuture != null) { currentSyncFuture.complete(data); } if (currentSyncTask != null && !currentSyncTask.isDone()) { currentSyncTask.cancel(false); } setConnectionState(CONNECTED); // Notify data update try { notifyPrioritizedObservers(data); } catch (CouldNotPerformException ex) { ExceptionPrinter.printHistory(new CouldNotPerformException("Could not notify data update!", ex), logger); } try { dataObservable.notifyObservers(data); } catch (CouldNotPerformException ex) { ExceptionPrinter.printHistory(new CouldNotPerformException("Could not notify data update to all observer!", ex), logger); } }
[ "private", "void", "applyDataUpdate", "(", "final", "M", "data", ")", "{", "this", ".", "data", "=", "data", ";", "CompletableFutureLite", "<", "M", ">", "currentSyncFuture", "=", "null", ";", "Future", "<", "M", ">", "currentSyncTask", "=", "null", ";", ...
Method is used to internally update the data object. @param data
[ "Method", "is", "used", "to", "internally", "update", "the", "data", "object", "." ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractRemoteClient.java#L1410-L1447
ThreeTen/threeten-extra
src/main/java/org/threeten/extra/chrono/DiscordianChronology.java
DiscordianChronology.dateYearDay
@Override public DiscordianDate dateYearDay(Era era, int yearOfEra, int dayOfYear) { return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear); }
java
@Override public DiscordianDate dateYearDay(Era era, int yearOfEra, int dayOfYear) { return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear); }
[ "@", "Override", "public", "DiscordianDate", "dateYearDay", "(", "Era", "era", ",", "int", "yearOfEra", ",", "int", "dayOfYear", ")", "{", "return", "dateYearDay", "(", "prolepticYear", "(", "era", ",", "yearOfEra", ")", ",", "dayOfYear", ")", ";", "}" ]
Obtains a local date in Discordian calendar system from the era, year-of-era and day-of-year fields. @param era the Discordian era, not null @param yearOfEra the year-of-era @param dayOfYear the day-of-year @return the Discordian local date, not null @throws DateTimeException if unable to create the date @throws ClassCastException if the {@code era} is not a {@code DiscordianEra}
[ "Obtains", "a", "local", "date", "in", "Discordian", "calendar", "system", "from", "the", "era", "year", "-", "of", "-", "era", "and", "day", "-", "of", "-", "year", "fields", "." ]
train
https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/chrono/DiscordianChronology.java#L245-L248
mapsforge/mapsforge
sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java
DatabaseUtils.queryNumEntries
public static long queryNumEntries(SQLiteDatabase db, String table, String selection) { return queryNumEntries(db, table, selection, null); }
java
public static long queryNumEntries(SQLiteDatabase db, String table, String selection) { return queryNumEntries(db, table, selection, null); }
[ "public", "static", "long", "queryNumEntries", "(", "SQLiteDatabase", "db", ",", "String", "table", ",", "String", "selection", ")", "{", "return", "queryNumEntries", "(", "db", ",", "table", ",", "selection", ",", "null", ")", ";", "}" ]
Query the table for the number of rows in the table. @param db the database the table is in @param table the name of the table to query @param selection A filter declaring which rows to return, formatted as an SQL WHERE clause (excluding the WHERE itself). Passing null will count all rows for the given table @return the number of rows in the table filtered by the selection
[ "Query", "the", "table", "for", "the", "number", "of", "rows", "in", "the", "table", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java#L792-L794
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/cache/JMapperCache.java
JMapperCache.getRelationalMapper
public static <T> IRelationalJMapper<T> getRelationalMapper(final Class<T> configuredClass){ return getRelationalMapper(configuredClass, undefinedXML()); }
java
public static <T> IRelationalJMapper<T> getRelationalMapper(final Class<T> configuredClass){ return getRelationalMapper(configuredClass, undefinedXML()); }
[ "public", "static", "<", "T", ">", "IRelationalJMapper", "<", "T", ">", "getRelationalMapper", "(", "final", "Class", "<", "T", ">", "configuredClass", ")", "{", "return", "getRelationalMapper", "(", "configuredClass", ",", "undefinedXML", "(", ")", ")", ";", ...
Returns an instance of RelationalJMapper from cache if exists, in alternative a new instance. <br>Takes in input only the annotated Class @param configuredClass configured class @param <T> Mapped class type @return the mapper instance
[ "Returns", "an", "instance", "of", "RelationalJMapper", "from", "cache", "if", "exists", "in", "alternative", "a", "new", "instance", ".", "<br", ">", "Takes", "in", "input", "only", "the", "annotated", "Class" ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/cache/JMapperCache.java#L154-L156
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/TimeRangeChecker.java
TimeRangeChecker.isTimeInRange
public static boolean isTimeInRange(List<String> days, String startTimeStr, String endTimeStr, DateTime currentTime) { if (!Iterables.any(days, new AreDaysEqual(DAYS_OF_WEEK.get(currentTime.getDayOfWeek())))) { return false; } DateTime startTime = null; DateTime endTime = null; try { startTime = HOUR_MINUTE_FORMATTER.withZone(DATE_TIME_ZONE).parseDateTime(startTimeStr); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("startTimeStr format is invalid, must be of format " + HOUR_MINUTE_FORMAT, e); } try { endTime = HOUR_MINUTE_FORMATTER.withZone(DATE_TIME_ZONE).parseDateTime(endTimeStr); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("endTimeStr format is invalid, must be of format " + HOUR_MINUTE_FORMAT, e); } startTime = startTime.withDate(currentTime.getYear(), currentTime.getMonthOfYear(), currentTime.getDayOfMonth()); endTime = endTime.withDate(currentTime.getYear(), currentTime.getMonthOfYear(), currentTime.getDayOfMonth()); Interval interval = new Interval(startTime.getMillis(), endTime.getMillis(), DATE_TIME_ZONE); return interval.contains(currentTime.getMillis()); }
java
public static boolean isTimeInRange(List<String> days, String startTimeStr, String endTimeStr, DateTime currentTime) { if (!Iterables.any(days, new AreDaysEqual(DAYS_OF_WEEK.get(currentTime.getDayOfWeek())))) { return false; } DateTime startTime = null; DateTime endTime = null; try { startTime = HOUR_MINUTE_FORMATTER.withZone(DATE_TIME_ZONE).parseDateTime(startTimeStr); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("startTimeStr format is invalid, must be of format " + HOUR_MINUTE_FORMAT, e); } try { endTime = HOUR_MINUTE_FORMATTER.withZone(DATE_TIME_ZONE).parseDateTime(endTimeStr); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("endTimeStr format is invalid, must be of format " + HOUR_MINUTE_FORMAT, e); } startTime = startTime.withDate(currentTime.getYear(), currentTime.getMonthOfYear(), currentTime.getDayOfMonth()); endTime = endTime.withDate(currentTime.getYear(), currentTime.getMonthOfYear(), currentTime.getDayOfMonth()); Interval interval = new Interval(startTime.getMillis(), endTime.getMillis(), DATE_TIME_ZONE); return interval.contains(currentTime.getMillis()); }
[ "public", "static", "boolean", "isTimeInRange", "(", "List", "<", "String", ">", "days", ",", "String", "startTimeStr", ",", "String", "endTimeStr", ",", "DateTime", "currentTime", ")", "{", "if", "(", "!", "Iterables", ".", "any", "(", "days", ",", "new",...
Checks if a specified time is on a day that is specified the a given {@link List} of acceptable days, and that the hours + minutes of the specified time fall into a range defined by startTimeStr and endTimeStr. @param days is a {@link List} of days, if the specified {@link DateTime} does not have a day that falls is in this {@link List} then this method will return false. @param startTimeStr defines the start range that the currentTime can fall into. This {@link String} should be of the pattern defined by {@link #HOUR_MINUTE_FORMAT}. @param endTimeStr defines the start range that the currentTime can fall into. This {@link String} should be of the pattern defined by {@link #HOUR_MINUTE_FORMAT}. @param currentTime is a {@link DateTime} for which this method will check if it is in the given {@link List} of days and falls into the time range defined by startTimeStr and endTimeStr. @return true if the given time is in the defined range, false otherwise.
[ "Checks", "if", "a", "specified", "time", "is", "on", "a", "day", "that", "is", "specified", "the", "a", "given", "{", "@link", "List", "}", "of", "acceptable", "days", "and", "that", "the", "hours", "+", "minutes", "of", "the", "specified", "time", "f...
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/TimeRangeChecker.java#L70-L96
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/NetworkManagementClientImpl.java
NetworkManagementClientImpl.checkDnsNameAvailability
public DnsNameAvailabilityResultInner checkDnsNameAvailability(String location, String domainNameLabel) { return checkDnsNameAvailabilityWithServiceResponseAsync(location, domainNameLabel).toBlocking().single().body(); }
java
public DnsNameAvailabilityResultInner checkDnsNameAvailability(String location, String domainNameLabel) { return checkDnsNameAvailabilityWithServiceResponseAsync(location, domainNameLabel).toBlocking().single().body(); }
[ "public", "DnsNameAvailabilityResultInner", "checkDnsNameAvailability", "(", "String", "location", ",", "String", "domainNameLabel", ")", "{", "return", "checkDnsNameAvailabilityWithServiceResponseAsync", "(", "location", ",", "domainNameLabel", ")", ".", "toBlocking", "(", ...
Checks whether a domain name in the cloudapp.azure.com zone is available for use. @param location The location of the domain name. @param domainNameLabel The domain name to be verified. It must conform to the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the DnsNameAvailabilityResultInner object if successful.
[ "Checks", "whether", "a", "domain", "name", "in", "the", "cloudapp", ".", "azure", ".", "com", "zone", "is", "available", "for", "use", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/NetworkManagementClientImpl.java#L1156-L1158
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/stat/aaa/aaa_stats.java
aaa_stats.get_nitro_response
protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception { aaa_stats[] resources = new aaa_stats[1]; aaa_response result = (aaa_response) service.get_payload_formatter().string_to_resource(aaa_response.class, response); if(result.errorcode != 0) { if (result.errorcode == 444) { service.clear_session(); } if(result.severity != null) { if (result.severity.equals("ERROR")) throw new nitro_exception(result.message,result.errorcode); } else { throw new nitro_exception(result.message,result.errorcode); } } resources[0] = result.aaa; return resources; }
java
protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception { aaa_stats[] resources = new aaa_stats[1]; aaa_response result = (aaa_response) service.get_payload_formatter().string_to_resource(aaa_response.class, response); if(result.errorcode != 0) { if (result.errorcode == 444) { service.clear_session(); } if(result.severity != null) { if (result.severity.equals("ERROR")) throw new nitro_exception(result.message,result.errorcode); } else { throw new nitro_exception(result.message,result.errorcode); } } resources[0] = result.aaa; return resources; }
[ "protected", "base_resource", "[", "]", "get_nitro_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "aaa_stats", "[", "]", "resources", "=", "new", "aaa_stats", "[", "1", "]", ";", "aaa_response", "result", ...
<pre> converts nitro response into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "converts", "nitro", "response", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/aaa/aaa_stats.java#L297-L316
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/checkouts/OrderItemUrl.java
OrderItemUrl.deleteCheckoutItemUrl
public static MozuUrl deleteCheckoutItemUrl(String checkoutId, String itemId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/items/{itemId}"); formatter.formatUrl("checkoutId", checkoutId); formatter.formatUrl("itemId", itemId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl deleteCheckoutItemUrl(String checkoutId, String itemId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/items/{itemId}"); formatter.formatUrl("checkoutId", checkoutId); formatter.formatUrl("itemId", itemId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "deleteCheckoutItemUrl", "(", "String", "checkoutId", ",", "String", "itemId", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/checkouts/{checkoutId}/items/{itemId}\"", ")", ";", "formatter", ".", "...
Get Resource Url for DeleteCheckoutItem @param checkoutId The unique identifier of the checkout. @param itemId The unique identifier of the item. @return String Resource Url
[ "Get", "Resource", "Url", "for", "DeleteCheckoutItem" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/checkouts/OrderItemUrl.java#L86-L92
OpenLiberty/open-liberty
dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/JavaScriptUtils.java
JavaScriptUtils.getHtmlCookieString
public String getHtmlCookieString(String name, String value) { return getHtmlCookieString(name, value, null); }
java
public String getHtmlCookieString(String name, String value) { return getHtmlCookieString(name, value, null); }
[ "public", "String", "getHtmlCookieString", "(", "String", "name", ",", "String", "value", ")", "{", "return", "getHtmlCookieString", "(", "name", ",", "value", ",", "null", ")", ";", "}" ]
Creates and returns a JavaScript line for setting a cookie with the specified name and value. Note: The name and value will be HTML-encoded.
[ "Creates", "and", "returns", "a", "JavaScript", "line", "for", "setting", "a", "cookie", "with", "the", "specified", "name", "and", "value", ".", "Note", ":", "The", "name", "and", "value", "will", "be", "HTML", "-", "encoded", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/JavaScriptUtils.java#L75-L77
twilio/twilio-java
src/main/java/com/twilio/jwt/validation/ValidationToken.java
ValidationToken.fromHttpRequest
public static ValidationToken fromHttpRequest( String accountSid, String credentialSid, String signingKeySid, PrivateKey privateKey, HttpRequest request, List<String> signedHeaders ) throws IOException { Builder builder = new Builder(accountSid, credentialSid, signingKeySid, privateKey); String method = request.getRequestLine().getMethod(); builder.method(method); String uri = request.getRequestLine().getUri(); if (uri.contains("?")) { String[] uriParts = uri.split("\\?"); builder.uri(uriParts[0]); builder.queryString(uriParts[1]); } else { builder.uri(uri); } builder.headers(request.getAllHeaders()); builder.signedHeaders(signedHeaders); /** * If the request encloses an "entity", use it for the body. Note that this is dependent on several factors * during request building and is not solely based on the specified method. * * @see org.apache.http.client.methods.RequestBuilder#build */ if (request instanceof HttpEntityEnclosingRequest) { HttpEntity entity = ((HttpEntityEnclosingRequest) request).getEntity(); builder.requestBody(CharStreams.toString(new InputStreamReader(entity.getContent(), Charsets.UTF_8))); } return builder.build(); }
java
public static ValidationToken fromHttpRequest( String accountSid, String credentialSid, String signingKeySid, PrivateKey privateKey, HttpRequest request, List<String> signedHeaders ) throws IOException { Builder builder = new Builder(accountSid, credentialSid, signingKeySid, privateKey); String method = request.getRequestLine().getMethod(); builder.method(method); String uri = request.getRequestLine().getUri(); if (uri.contains("?")) { String[] uriParts = uri.split("\\?"); builder.uri(uriParts[0]); builder.queryString(uriParts[1]); } else { builder.uri(uri); } builder.headers(request.getAllHeaders()); builder.signedHeaders(signedHeaders); /** * If the request encloses an "entity", use it for the body. Note that this is dependent on several factors * during request building and is not solely based on the specified method. * * @see org.apache.http.client.methods.RequestBuilder#build */ if (request instanceof HttpEntityEnclosingRequest) { HttpEntity entity = ((HttpEntityEnclosingRequest) request).getEntity(); builder.requestBody(CharStreams.toString(new InputStreamReader(entity.getContent(), Charsets.UTF_8))); } return builder.build(); }
[ "public", "static", "ValidationToken", "fromHttpRequest", "(", "String", "accountSid", ",", "String", "credentialSid", ",", "String", "signingKeySid", ",", "PrivateKey", "privateKey", ",", "HttpRequest", "request", ",", "List", "<", "String", ">", "signedHeaders", "...
Create a ValidationToken from an HTTP Request. @param accountSid Twilio Account SID @param credentialSid Twilio Credential SID @param signingKeySid Twilio Signing Key SID @param privateKey Private Key @param request HTTP Request @param signedHeaders Headers to sign @throws IOException when unable to generate @return The ValidationToken generated from the HttpRequest
[ "Create", "a", "ValidationToken", "from", "an", "HTTP", "Request", "." ]
train
https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/jwt/validation/ValidationToken.java#L102-L139
interedition/collatex
collatex-core/src/main/java/eu/interedition/collatex/suffixarray/SuffixArrays.java
SuffixArrays.createWithLCP
public static <T> SuffixData createWithLCP(T[] input, ISuffixArrayBuilder builder, Comparator<? super T> comparator) { final GenericArrayAdapter adapter = new GenericArrayAdapter(builder, comparator); final int[] sa = adapter.buildSuffixArray(input); final int[] lcp = computeLCP(adapter.input, 0, input.length, sa); return new SuffixData(sa, lcp); }
java
public static <T> SuffixData createWithLCP(T[] input, ISuffixArrayBuilder builder, Comparator<? super T> comparator) { final GenericArrayAdapter adapter = new GenericArrayAdapter(builder, comparator); final int[] sa = adapter.buildSuffixArray(input); final int[] lcp = computeLCP(adapter.input, 0, input.length, sa); return new SuffixData(sa, lcp); }
[ "public", "static", "<", "T", ">", "SuffixData", "createWithLCP", "(", "T", "[", "]", "input", ",", "ISuffixArrayBuilder", "builder", ",", "Comparator", "<", "?", "super", "T", ">", "comparator", ")", "{", "final", "GenericArrayAdapter", "adapter", "=", "new...
Create a suffix array and an LCP array for a given generic array and a custom suffix array building strategy, using the given T object comparator.
[ "Create", "a", "suffix", "array", "and", "an", "LCP", "array", "for", "a", "given", "generic", "array", "and", "a", "custom", "suffix", "array", "building", "strategy", "using", "the", "given", "T", "object", "comparator", "." ]
train
https://github.com/interedition/collatex/blob/76dd1fcc36047bc66a87d31142e72e98b5347821/collatex-core/src/main/java/eu/interedition/collatex/suffixarray/SuffixArrays.java#L106-L111
virgo47/javasimon
core/src/main/java/org/javasimon/EnabledManager.java
EnabledManager.createSimon
private synchronized Simon createSimon(String name, Class<? extends AbstractSimon> simonClass) { AbstractSimon simon = allSimons.get(name); if (simon == null) { SimonUtils.validateSimonName(name); simon = newSimon(name, simonClass); } else if (simon instanceof UnknownSimon) { simon = replaceUnknownSimon(simon, simonClass); } callback.onSimonCreated(simon); return simon; }
java
private synchronized Simon createSimon(String name, Class<? extends AbstractSimon> simonClass) { AbstractSimon simon = allSimons.get(name); if (simon == null) { SimonUtils.validateSimonName(name); simon = newSimon(name, simonClass); } else if (simon instanceof UnknownSimon) { simon = replaceUnknownSimon(simon, simonClass); } callback.onSimonCreated(simon); return simon; }
[ "private", "synchronized", "Simon", "createSimon", "(", "String", "name", ",", "Class", "<", "?", "extends", "AbstractSimon", ">", "simonClass", ")", "{", "AbstractSimon", "simon", "=", "allSimons", ".", "get", "(", "name", ")", ";", "if", "(", "simon", "=...
Even with ConcurrentHashMap we want to synchronize here, so newly created Simons can be fully set up with {@link Callback#onSimonCreated(Simon)}. ConcurrentHashMap still works fine for listing Simons, etc.
[ "Even", "with", "ConcurrentHashMap", "we", "want", "to", "synchronize", "here", "so", "newly", "created", "Simons", "can", "be", "fully", "set", "up", "with", "{" ]
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/EnabledManager.java#L134-L144
kenyee/android-ddp-client
src/com/keysolutions/ddpclient/android/DDPStateSingleton.java
DDPStateSingleton.initInstance
public static void initInstance(Context context, String meteorServerHostname, boolean useSsl) { initInstance(context, meteorServerHostname, sMeteorPort, useSsl); }
java
public static void initInstance(Context context, String meteorServerHostname, boolean useSsl) { initInstance(context, meteorServerHostname, sMeteorPort, useSsl); }
[ "public", "static", "void", "initInstance", "(", "Context", "context", ",", "String", "meteorServerHostname", ",", "boolean", "useSsl", ")", "{", "initInstance", "(", "context", ",", "meteorServerHostname", ",", "sMeteorPort", ",", "useSsl", ")", ";", "}" ]
Initializes instance to connect to given Meteor server @param context Android context @param meteorServerHostname Meteor hostname/IP @param useSsl whether to use SSL for connection
[ "Initializes", "instance", "to", "connect", "to", "given", "Meteor", "server" ]
train
https://github.com/kenyee/android-ddp-client/blob/6ab416e415570a03f96c383497144dd742de3f08/src/com/keysolutions/ddpclient/android/DDPStateSingleton.java#L166-L168
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/reflect/MethodInvocation.java
MethodInvocation.newMethodInvocation
public static MethodInvocation newMethodInvocation(Class<?> type, String methodName, Object... args) { Assert.notNull(type, "Class type cannot be null"); return new MethodInvocation(null, ClassUtils.findMethod(type, methodName, args), args); }
java
public static MethodInvocation newMethodInvocation(Class<?> type, String methodName, Object... args) { Assert.notNull(type, "Class type cannot be null"); return new MethodInvocation(null, ClassUtils.findMethod(type, methodName, args), args); }
[ "public", "static", "MethodInvocation", "newMethodInvocation", "(", "Class", "<", "?", ">", "type", ",", "String", "methodName", ",", "Object", "...", "args", ")", "{", "Assert", ".", "notNull", "(", "type", ",", "\"Class type cannot be null\"", ")", ";", "ret...
Factory method used to construct an instance of {@link MethodInvocation} initialized with the given {@link Class type} on which the {@code methodName named} {@link Method} accepting the given array of {@link Object arguments} is declared. The {@link String named} {@link Method} is expected to be a {@link java.lang.reflect.Modifier#STATIC}, {@link Class} member {@link Method}. @param type {@link Class type} declaring the {@link Method}. @param methodName {@link String name} of the {@link Method}. @param args array of {@link Object arguments} passed to the {@link Method}. @return an instance of {@link MethodInvocation} encapsulating all the necessary details to invoke the {@link java.lang.reflect.Modifier#STATIC} {@link Method}. @throws IllegalArgumentException if the {@link Class type} is {@literal null}. @see #MethodInvocation(Object, Method, Object...) @see java.lang.Class
[ "Factory", "method", "used", "to", "construct", "an", "instance", "of", "{", "@link", "MethodInvocation", "}", "initialized", "with", "the", "given", "{", "@link", "Class", "type", "}", "on", "which", "the", "{", "@code", "methodName", "named", "}", "{", "...
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/reflect/MethodInvocation.java#L99-L103
HubSpot/Singularity
SingularityClient/src/main/java/com/hubspot/singularity/client/SingularityClient.java
SingularityClient.saveRequestGroup
public Optional<SingularityRequestGroup> saveRequestGroup(SingularityRequestGroup requestGroup) { final Function<String, String> requestUri = (host) -> String.format(REQUEST_GROUPS_FORMAT, getApiBase(host)); return post(requestUri, "request group", Optional.of(requestGroup), Optional.of(SingularityRequestGroup.class)); }
java
public Optional<SingularityRequestGroup> saveRequestGroup(SingularityRequestGroup requestGroup) { final Function<String, String> requestUri = (host) -> String.format(REQUEST_GROUPS_FORMAT, getApiBase(host)); return post(requestUri, "request group", Optional.of(requestGroup), Optional.of(SingularityRequestGroup.class)); }
[ "public", "Optional", "<", "SingularityRequestGroup", ">", "saveRequestGroup", "(", "SingularityRequestGroup", "requestGroup", ")", "{", "final", "Function", "<", "String", ",", "String", ">", "requestUri", "=", "(", "host", ")", "-", ">", "String", ".", "format...
Update or add a {@link SingularityRequestGroup} @param requestGroup The request group to update or add @return A {@link SingularityRequestGroup} if the update was successful
[ "Update", "or", "add", "a", "{", "@link", "SingularityRequestGroup", "}" ]
train
https://github.com/HubSpot/Singularity/blob/384a8c16a10aa076af5ca45c8dfcedab9e5122c8/SingularityClient/src/main/java/com/hubspot/singularity/client/SingularityClient.java#L1418-L1422
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/CopyJobConfiguration.java
CopyJobConfiguration.newBuilder
public static Builder newBuilder(TableId destinationTable, TableId sourceTable) { return newBuilder(destinationTable, ImmutableList.of(checkNotNull(sourceTable))); }
java
public static Builder newBuilder(TableId destinationTable, TableId sourceTable) { return newBuilder(destinationTable, ImmutableList.of(checkNotNull(sourceTable))); }
[ "public", "static", "Builder", "newBuilder", "(", "TableId", "destinationTable", ",", "TableId", "sourceTable", ")", "{", "return", "newBuilder", "(", "destinationTable", ",", "ImmutableList", ".", "of", "(", "checkNotNull", "(", "sourceTable", ")", ")", ")", ";...
Creates a builder for a BigQuery Copy Job configuration given destination and source table.
[ "Creates", "a", "builder", "for", "a", "BigQuery", "Copy", "Job", "configuration", "given", "destination", "and", "source", "table", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/CopyJobConfiguration.java#L255-L257
FlyingHe/UtilsMaven
src/main/java/com/github/flyinghe/tools/ImgCompressUtils.java
ImgCompressUtils.imgCompressByWH
public static void imgCompressByWH(String srcFile, String desFile, int width, int height, Float quality, boolean isForceWh) { try { Image srcImg = ImageIO.read(new File(srcFile)); if (!isForceWh && (srcImg.getHeight(null) < height || srcImg.getWidth(null) < width)) { width = srcImg.getWidth(null); height = srcImg.getHeight(null); } //指定目标图片 BufferedImage desImg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); //根据源图片绘制目标图片 desImg.getGraphics().drawImage(srcImg, 0, 0, width, height, null); ImgCompressUtils.encodeImg(desFile, desImg, quality); } catch (Exception e) { throw new RuntimeException(e); } }
java
public static void imgCompressByWH(String srcFile, String desFile, int width, int height, Float quality, boolean isForceWh) { try { Image srcImg = ImageIO.read(new File(srcFile)); if (!isForceWh && (srcImg.getHeight(null) < height || srcImg.getWidth(null) < width)) { width = srcImg.getWidth(null); height = srcImg.getHeight(null); } //指定目标图片 BufferedImage desImg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); //根据源图片绘制目标图片 desImg.getGraphics().drawImage(srcImg, 0, 0, width, height, null); ImgCompressUtils.encodeImg(desFile, desImg, quality); } catch (Exception e) { throw new RuntimeException(e); } }
[ "public", "static", "void", "imgCompressByWH", "(", "String", "srcFile", ",", "String", "desFile", ",", "int", "width", ",", "int", "height", ",", "Float", "quality", ",", "boolean", "isForceWh", ")", "{", "try", "{", "Image", "srcImg", "=", "ImageIO", "."...
根据指定宽高和压缩质量进行压缩,当isForceWh为false时,如果指定宽或者高大于源图片则按照源图片大小宽高压缩, 当isForceWh为true时,不论怎样均按照指定宽高压缩 @param srcFile 指定原图片地址 @param desFile 指定压缩后图片存放地址,包括图片名称 @param width 指定压缩宽 @param height 指定压缩高 @param quality 指定压缩质量,范围[0.0,1.0],如果指定为null则按照默认值 @param isForceWh 指定是否强制使用指定宽高进行压缩,true代表强制,false反之
[ "根据指定宽高和压缩质量进行压缩,当isForceWh为false时", "如果指定宽或者高大于源图片则按照源图片大小宽高压缩", "当isForceWh为true时", "不论怎样均按照指定宽高压缩" ]
train
https://github.com/FlyingHe/UtilsMaven/blob/d9605b7bfe0c28a05289252e12d163e114080b4a/src/main/java/com/github/flyinghe/tools/ImgCompressUtils.java#L52-L68
jenetics/jpx
jpx/src/main/java/io/jenetics/jpx/IO.java
IO.readString
static String readString(final DataInput in) throws IOException { final byte[] bytes = new byte[readInt(in)]; in.readFully(bytes); return new String(bytes, "UTF-8"); }
java
static String readString(final DataInput in) throws IOException { final byte[] bytes = new byte[readInt(in)]; in.readFully(bytes); return new String(bytes, "UTF-8"); }
[ "static", "String", "readString", "(", "final", "DataInput", "in", ")", "throws", "IOException", "{", "final", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "readInt", "(", "in", ")", "]", ";", "in", ".", "readFully", "(", "bytes", ")", ";", "r...
Reads a string value from the given data input. @param in the data input @return the read string value @throws NullPointerException if one of the given arguments is {@code null} @throws IOException if an I/O error occurs
[ "Reads", "a", "string", "value", "from", "the", "given", "data", "input", "." ]
train
https://github.com/jenetics/jpx/blob/58fefc10580602d07f1480d6a5886d13a553ff8f/jpx/src/main/java/io/jenetics/jpx/IO.java#L129-L133
arangodb/spring-data
src/main/java/com/arangodb/springframework/repository/query/derived/DerivedQueryCreator.java
DerivedQueryCreator.ignorePropertyCase
private String ignorePropertyCase(final Part part, final String property) { if (!shouldIgnoreCase(part)) { return property; } if (!part.getProperty().getLeafProperty().isCollection()) { return "LOWER(" + property + ")"; } return format("(FOR i IN TO_ARRAY(%s) RETURN LOWER(i))", property); }
java
private String ignorePropertyCase(final Part part, final String property) { if (!shouldIgnoreCase(part)) { return property; } if (!part.getProperty().getLeafProperty().isCollection()) { return "LOWER(" + property + ")"; } return format("(FOR i IN TO_ARRAY(%s) RETURN LOWER(i))", property); }
[ "private", "String", "ignorePropertyCase", "(", "final", "Part", "part", ",", "final", "String", "property", ")", "{", "if", "(", "!", "shouldIgnoreCase", "(", "part", ")", ")", "{", "return", "property", ";", "}", "if", "(", "!", "part", ".", "getProper...
Wrapps property expression in order to lower case. Only properties of type String or Iterable<String> are lowered @param part @param property @return
[ "Wrapps", "property", "expression", "in", "order", "to", "lower", "case", ".", "Only", "properties", "of", "type", "String", "or", "Iterable<String", ">", "are", "lowered" ]
train
https://github.com/arangodb/spring-data/blob/ff8ae53986b353964b9b90bd8199996d5aabf0c1/src/main/java/com/arangodb/springframework/repository/query/derived/DerivedQueryCreator.java#L205-L213
lessthanoptimal/BoofCV
examples/src/main/java/boofcv/examples/features/ExampleDetectDescribe.java
ExampleDetectDescribe.createFromPremade
public static <T extends ImageGray<T>, TD extends TupleDesc> DetectDescribePoint<T, TD> createFromPremade( Class<T> imageType ) { return (DetectDescribePoint)FactoryDetectDescribe.surfStable( new ConfigFastHessian(1, 2, 200, 1, 9, 4, 4), null,null, imageType); // return (DetectDescribePoint)FactoryDetectDescribe.sift(new ConfigCompleteSift(-1,5,300)); }
java
public static <T extends ImageGray<T>, TD extends TupleDesc> DetectDescribePoint<T, TD> createFromPremade( Class<T> imageType ) { return (DetectDescribePoint)FactoryDetectDescribe.surfStable( new ConfigFastHessian(1, 2, 200, 1, 9, 4, 4), null,null, imageType); // return (DetectDescribePoint)FactoryDetectDescribe.sift(new ConfigCompleteSift(-1,5,300)); }
[ "public", "static", "<", "T", "extends", "ImageGray", "<", "T", ">", ",", "TD", "extends", "TupleDesc", ">", "DetectDescribePoint", "<", "T", ",", "TD", ">", "createFromPremade", "(", "Class", "<", "T", ">", "imageType", ")", "{", "return", "(", "DetectD...
For some features, there are pre-made implementations of DetectDescribePoint. This has only been done in situations where there was a performance advantage or that it was a very common combination.
[ "For", "some", "features", "there", "are", "pre", "-", "made", "implementations", "of", "DetectDescribePoint", ".", "This", "has", "only", "been", "done", "in", "situations", "where", "there", "was", "a", "performance", "advantage", "or", "that", "it", "was", ...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/features/ExampleDetectDescribe.java#L61-L66
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/ZealotKhala.java
ZealotKhala.andLessEqual
public ZealotKhala andLessEqual(String field, Object value) { return this.doNormal(ZealotConst.AND_PREFIX, field, value, ZealotConst.LTE_SUFFIX, true); }
java
public ZealotKhala andLessEqual(String field, Object value) { return this.doNormal(ZealotConst.AND_PREFIX, field, value, ZealotConst.LTE_SUFFIX, true); }
[ "public", "ZealotKhala", "andLessEqual", "(", "String", "field", ",", "Object", "value", ")", "{", "return", "this", ".", "doNormal", "(", "ZealotConst", ".", "AND_PREFIX", ",", "field", ",", "value", ",", "ZealotConst", ".", "LTE_SUFFIX", ",", "true", ")", ...
生成带" AND "前缀小于等于查询的SQL片段. @param field 数据库字段 @param value 值 @return ZealotKhala实例
[ "生成带", "AND", "前缀小于等于查询的SQL片段", "." ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L858-L860
apache/reef
lang/java/reef-experimental/src/main/java/org/apache/reef/experimental/parquet/ParquetReader.java
ParquetReader.createAvroSchema
private Schema createAvroSchema(final Configuration configuration, final MetadataFilter filter) throws IOException { final ParquetMetadata footer = ParquetFileReader.readFooter(configuration, parquetFilePath, filter); final AvroSchemaConverter converter = new AvroSchemaConverter(); final MessageType schema = footer.getFileMetaData().getSchema(); return converter.convert(schema); }
java
private Schema createAvroSchema(final Configuration configuration, final MetadataFilter filter) throws IOException { final ParquetMetadata footer = ParquetFileReader.readFooter(configuration, parquetFilePath, filter); final AvroSchemaConverter converter = new AvroSchemaConverter(); final MessageType schema = footer.getFileMetaData().getSchema(); return converter.convert(schema); }
[ "private", "Schema", "createAvroSchema", "(", "final", "Configuration", "configuration", ",", "final", "MetadataFilter", "filter", ")", "throws", "IOException", "{", "final", "ParquetMetadata", "footer", "=", "ParquetFileReader", ".", "readFooter", "(", "configuration",...
Retrieve avro schema from parquet file. @param configuration Hadoop configuration. @param filter Filter for Avro metadata. @return avro schema from parquet file. @throws IOException if the Avro schema couldn't be parsed from the parquet file.
[ "Retrieve", "avro", "schema", "from", "parquet", "file", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-experimental/src/main/java/org/apache/reef/experimental/parquet/ParquetReader.java#L95-L100
udoprog/ffwd-client-java
src/main/java/com/google/protobuf250/DynamicMessage.java
DynamicMessage.parseFrom
public static DynamicMessage parseFrom(Descriptor type, InputStream input) throws IOException { return newBuilder(type).mergeFrom(input).buildParsed(); }
java
public static DynamicMessage parseFrom(Descriptor type, InputStream input) throws IOException { return newBuilder(type).mergeFrom(input).buildParsed(); }
[ "public", "static", "DynamicMessage", "parseFrom", "(", "Descriptor", "type", ",", "InputStream", "input", ")", "throws", "IOException", "{", "return", "newBuilder", "(", "type", ")", ".", "mergeFrom", "(", "input", ")", ".", "buildParsed", "(", ")", ";", "}...
Parse a message of the given type from {@code input} and return it.
[ "Parse", "a", "message", "of", "the", "given", "type", "from", "{" ]
train
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/DynamicMessage.java#L115-L118
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java
HttpHeaders.containsValue
public boolean containsValue(CharSequence name, CharSequence value, boolean ignoreCase) { Iterator<? extends CharSequence> itr = valueCharSequenceIterator(name); while (itr.hasNext()) { if (containsCommaSeparatedTrimmed(itr.next(), value, ignoreCase)) { return true; } } return false; }
java
public boolean containsValue(CharSequence name, CharSequence value, boolean ignoreCase) { Iterator<? extends CharSequence> itr = valueCharSequenceIterator(name); while (itr.hasNext()) { if (containsCommaSeparatedTrimmed(itr.next(), value, ignoreCase)) { return true; } } return false; }
[ "public", "boolean", "containsValue", "(", "CharSequence", "name", ",", "CharSequence", "value", ",", "boolean", "ignoreCase", ")", "{", "Iterator", "<", "?", "extends", "CharSequence", ">", "itr", "=", "valueCharSequenceIterator", "(", "name", ")", ";", "while"...
Returns {@code true} if a header with the {@code name} and {@code value} exists, {@code false} otherwise. This also handles multiple values that are separated with a {@code ,}. <p> If {@code ignoreCase} is {@code true} then a case insensitive compare is done on the value. @param name the name of the header to find @param value the value of the header to find @param ignoreCase {@code true} then a case insensitive compare is run to compare values. otherwise a case sensitive compare is run to compare values.
[ "Returns", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L1598-L1606
prestodb/presto
presto-spi/src/main/java/com/facebook/presto/spi/block/BlockUtil.java
BlockUtil.arraySame
static boolean arraySame(Object[] array1, Object[] array2) { if (array1 == null || array2 == null || array1.length != array2.length) { throw new IllegalArgumentException("array1 and array2 cannot be null and should have same length"); } for (int i = 0; i < array1.length; i++) { if (array1[i] != array2[i]) { return false; } } return true; }
java
static boolean arraySame(Object[] array1, Object[] array2) { if (array1 == null || array2 == null || array1.length != array2.length) { throw new IllegalArgumentException("array1 and array2 cannot be null and should have same length"); } for (int i = 0; i < array1.length; i++) { if (array1[i] != array2[i]) { return false; } } return true; }
[ "static", "boolean", "arraySame", "(", "Object", "[", "]", "array1", ",", "Object", "[", "]", "array2", ")", "{", "if", "(", "array1", "==", "null", "||", "array2", "==", "null", "||", "array1", ".", "length", "!=", "array2", ".", "length", ")", "{",...
Returns <tt>true</tt> if the two specified arrays contain the same object in every position. Unlike the {@link Arrays#equals(Object[], Object[])} method, this method compares using reference equals.
[ "Returns", "<tt", ">", "true<", "/", "tt", ">", "if", "the", "two", "specified", "arrays", "contain", "the", "same", "object", "in", "every", "position", ".", "Unlike", "the", "{" ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/block/BlockUtil.java#L198-L210
Netflix/astyanax
astyanax-thrift/src/main/java/com/netflix/astyanax/thrift/ThriftConverter.java
ThriftConverter.getPredicate
public static <C> SlicePredicate getPredicate(ColumnSlice<C> columns, Serializer<C> colSer) { // Get all the columns if (columns == null) { SlicePredicate predicate = new SlicePredicate(); predicate.setSlice_range(new SliceRange(ByteBuffer.wrap(new byte[0]), ByteBuffer.wrap(new byte[0]), false, Integer.MAX_VALUE)); return predicate; } // Get a specific list of columns if (columns.getColumns() != null) { SlicePredicate predicate = new SlicePredicate(); predicate.setColumn_namesIsSet(true); predicate.column_names = colSer.toBytesList(columns.getColumns()); return predicate; } else { SlicePredicate predicate = new SlicePredicate(); predicate.setSlice_range(new SliceRange((columns.getStartColumn() == null) ? ByteBuffer.wrap(new byte[0]) : ByteBuffer.wrap(colSer.toBytes(columns.getStartColumn())), (columns.getEndColumn() == null) ? ByteBuffer.wrap(new byte[0]) : ByteBuffer.wrap(colSer .toBytes(columns.getEndColumn())), columns.getReversed(), columns.getLimit())); return predicate; } }
java
public static <C> SlicePredicate getPredicate(ColumnSlice<C> columns, Serializer<C> colSer) { // Get all the columns if (columns == null) { SlicePredicate predicate = new SlicePredicate(); predicate.setSlice_range(new SliceRange(ByteBuffer.wrap(new byte[0]), ByteBuffer.wrap(new byte[0]), false, Integer.MAX_VALUE)); return predicate; } // Get a specific list of columns if (columns.getColumns() != null) { SlicePredicate predicate = new SlicePredicate(); predicate.setColumn_namesIsSet(true); predicate.column_names = colSer.toBytesList(columns.getColumns()); return predicate; } else { SlicePredicate predicate = new SlicePredicate(); predicate.setSlice_range(new SliceRange((columns.getStartColumn() == null) ? ByteBuffer.wrap(new byte[0]) : ByteBuffer.wrap(colSer.toBytes(columns.getStartColumn())), (columns.getEndColumn() == null) ? ByteBuffer.wrap(new byte[0]) : ByteBuffer.wrap(colSer .toBytes(columns.getEndColumn())), columns.getReversed(), columns.getLimit())); return predicate; } }
[ "public", "static", "<", "C", ">", "SlicePredicate", "getPredicate", "(", "ColumnSlice", "<", "C", ">", "columns", ",", "Serializer", "<", "C", ">", "colSer", ")", "{", "// Get all the columns", "if", "(", "columns", "==", "null", ")", "{", "SlicePredicate",...
Return a Hector SlicePredicate based on the provided column slice @param <C> @param columns @param colSer @return
[ "Return", "a", "Hector", "SlicePredicate", "based", "on", "the", "provided", "column", "slice" ]
train
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-thrift/src/main/java/com/netflix/astyanax/thrift/ThriftConverter.java#L122-L145
Whiley/WhileyCompiler
src/main/java/wyil/interpreter/Interpreter.java
Interpreter.executeStatement
private Status executeStatement(Stmt stmt, CallStack frame, EnclosingScope scope) { switch (stmt.getOpcode()) { case WyilFile.STMT_assert: return executeAssert((Stmt.Assert) stmt, frame, scope); case WyilFile.STMT_assume: return executeAssume((Stmt.Assume) stmt, frame, scope); case WyilFile.STMT_assign: return executeAssign((Stmt.Assign) stmt, frame, scope); case WyilFile.STMT_break: return executeBreak((Stmt.Break) stmt, frame, scope); case WyilFile.STMT_continue: return executeContinue((Stmt.Continue) stmt, frame, scope); case WyilFile.STMT_debug: return executeDebug((Stmt.Debug) stmt, frame, scope); case WyilFile.STMT_dowhile: return executeDoWhile((Stmt.DoWhile) stmt, frame, scope); case WyilFile.STMT_fail: return executeFail((Stmt.Fail) stmt, frame, scope); case WyilFile.STMT_if: case WyilFile.STMT_ifelse: return executeIf((Stmt.IfElse) stmt, frame, scope); case WyilFile.EXPR_indirectinvoke: executeIndirectInvoke((Expr.IndirectInvoke) stmt, frame); return Status.NEXT; case WyilFile.EXPR_invoke: executeInvoke((Expr.Invoke) stmt, frame); return Status.NEXT; case WyilFile.STMT_namedblock: return executeNamedBlock((Stmt.NamedBlock) stmt, frame, scope); case WyilFile.STMT_while: return executeWhile((Stmt.While) stmt, frame, scope); case WyilFile.STMT_return: return executeReturn((Stmt.Return) stmt, frame, scope); case WyilFile.STMT_skip: return executeSkip((Stmt.Skip) stmt, frame, scope); case WyilFile.STMT_switch: return executeSwitch((Stmt.Switch) stmt, frame, scope); case WyilFile.DECL_variableinitialiser: case WyilFile.DECL_variable: return executeVariableDeclaration((Decl.Variable) stmt, frame); } deadCode(stmt); return null; // deadcode }
java
private Status executeStatement(Stmt stmt, CallStack frame, EnclosingScope scope) { switch (stmt.getOpcode()) { case WyilFile.STMT_assert: return executeAssert((Stmt.Assert) stmt, frame, scope); case WyilFile.STMT_assume: return executeAssume((Stmt.Assume) stmt, frame, scope); case WyilFile.STMT_assign: return executeAssign((Stmt.Assign) stmt, frame, scope); case WyilFile.STMT_break: return executeBreak((Stmt.Break) stmt, frame, scope); case WyilFile.STMT_continue: return executeContinue((Stmt.Continue) stmt, frame, scope); case WyilFile.STMT_debug: return executeDebug((Stmt.Debug) stmt, frame, scope); case WyilFile.STMT_dowhile: return executeDoWhile((Stmt.DoWhile) stmt, frame, scope); case WyilFile.STMT_fail: return executeFail((Stmt.Fail) stmt, frame, scope); case WyilFile.STMT_if: case WyilFile.STMT_ifelse: return executeIf((Stmt.IfElse) stmt, frame, scope); case WyilFile.EXPR_indirectinvoke: executeIndirectInvoke((Expr.IndirectInvoke) stmt, frame); return Status.NEXT; case WyilFile.EXPR_invoke: executeInvoke((Expr.Invoke) stmt, frame); return Status.NEXT; case WyilFile.STMT_namedblock: return executeNamedBlock((Stmt.NamedBlock) stmt, frame, scope); case WyilFile.STMT_while: return executeWhile((Stmt.While) stmt, frame, scope); case WyilFile.STMT_return: return executeReturn((Stmt.Return) stmt, frame, scope); case WyilFile.STMT_skip: return executeSkip((Stmt.Skip) stmt, frame, scope); case WyilFile.STMT_switch: return executeSwitch((Stmt.Switch) stmt, frame, scope); case WyilFile.DECL_variableinitialiser: case WyilFile.DECL_variable: return executeVariableDeclaration((Decl.Variable) stmt, frame); } deadCode(stmt); return null; // deadcode }
[ "private", "Status", "executeStatement", "(", "Stmt", "stmt", ",", "CallStack", "frame", ",", "EnclosingScope", "scope", ")", "{", "switch", "(", "stmt", ".", "getOpcode", "(", ")", ")", "{", "case", "WyilFile", ".", "STMT_assert", ":", "return", "executeAss...
Execute a statement at a given point in the function or method body @param stmt --- The statement to be executed @param frame --- The current stack frame @return
[ "Execute", "a", "statement", "at", "a", "given", "point", "in", "the", "function", "or", "method", "body" ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/interpreter/Interpreter.java#L183-L227
sothawo/mapjfx
src/main/java/com/sothawo/mapjfx/Extent.java
Extent.forCoordinates
public static Extent forCoordinates(Collection<? extends Coordinate> coordinates) { requireNonNull(coordinates); if (coordinates.size() < 2) { throw new IllegalArgumentException(); } double minLatitude = Double.MAX_VALUE; double maxLatitude = -Double.MAX_VALUE; double minLongitude = Double.MAX_VALUE; double maxLongitude = -Double.MAX_VALUE; for (Coordinate coordinate : coordinates) { minLatitude = Math.min(minLatitude, coordinate.getLatitude()); maxLatitude = Math.max(maxLatitude, coordinate.getLatitude()); minLongitude = Math.min(minLongitude, coordinate.getLongitude()); maxLongitude = Math.max(maxLongitude, coordinate.getLongitude()); } return new Extent(new Coordinate(minLatitude, minLongitude), new Coordinate(maxLatitude, maxLongitude)); }
java
public static Extent forCoordinates(Collection<? extends Coordinate> coordinates) { requireNonNull(coordinates); if (coordinates.size() < 2) { throw new IllegalArgumentException(); } double minLatitude = Double.MAX_VALUE; double maxLatitude = -Double.MAX_VALUE; double minLongitude = Double.MAX_VALUE; double maxLongitude = -Double.MAX_VALUE; for (Coordinate coordinate : coordinates) { minLatitude = Math.min(minLatitude, coordinate.getLatitude()); maxLatitude = Math.max(maxLatitude, coordinate.getLatitude()); minLongitude = Math.min(minLongitude, coordinate.getLongitude()); maxLongitude = Math.max(maxLongitude, coordinate.getLongitude()); } return new Extent(new Coordinate(minLatitude, minLongitude), new Coordinate(maxLatitude, maxLongitude)); }
[ "public", "static", "Extent", "forCoordinates", "(", "Collection", "<", "?", "extends", "Coordinate", ">", "coordinates", ")", "{", "requireNonNull", "(", "coordinates", ")", ";", "if", "(", "coordinates", ".", "size", "(", ")", "<", "2", ")", "{", "throw"...
creates the extent of the given coordinates. @param coordinates the coordinates @return Extent for the coorinates @throws java.lang.IllegalArgumentException when less than 2 coordinates or null are passed in @throws NullPointerException when coordinates is null
[ "creates", "the", "extent", "of", "the", "given", "coordinates", "." ]
train
https://github.com/sothawo/mapjfx/blob/202091de492ab7a8b000c77efd833029f7f0ef92/src/main/java/com/sothawo/mapjfx/Extent.java#L64-L81
mytechia/mytechia_commons
mytechia_commons_library/src/main/java/com/mytechia/commons/patterns/prototype/PrototypeContainer.java
PrototypeContainer.unregisterPrototype
public void unregisterPrototype( String key, Class c ) { prototypes.remove(new PrototypeKey(key, c)); }
java
public void unregisterPrototype( String key, Class c ) { prototypes.remove(new PrototypeKey(key, c)); }
[ "public", "void", "unregisterPrototype", "(", "String", "key", ",", "Class", "c", ")", "{", "prototypes", ".", "remove", "(", "new", "PrototypeKey", "(", "key", ",", "c", ")", ")", ";", "}" ]
Unregisters a prototype associated to the specified key NOTE: IPrototype pattern @param key key of the prototype @param c the prototype to unregister
[ "Unregisters", "a", "prototype", "associated", "to", "the", "specified", "key" ]
train
https://github.com/mytechia/mytechia_commons/blob/02251879085f271a1fb51663a1c8eddc8be78ae7/mytechia_commons_library/src/main/java/com/mytechia/commons/patterns/prototype/PrototypeContainer.java#L153-L158
graphhopper/graphhopper
core/src/main/java/com/graphhopper/util/BitUtil.java
BitUtil.toBitString
public String toBitString(long value, int bits) { StringBuilder sb = new StringBuilder(bits); long lastBit = 1L << 63; for (int i = 0; i < bits; i++) { if ((value & lastBit) == 0) sb.append('0'); else sb.append('1'); value <<= 1; } return sb.toString(); }
java
public String toBitString(long value, int bits) { StringBuilder sb = new StringBuilder(bits); long lastBit = 1L << 63; for (int i = 0; i < bits; i++) { if ((value & lastBit) == 0) sb.append('0'); else sb.append('1'); value <<= 1; } return sb.toString(); }
[ "public", "String", "toBitString", "(", "long", "value", ",", "int", "bits", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "bits", ")", ";", "long", "lastBit", "=", "1L", "<<", "63", ";", "for", "(", "int", "i", "=", "0", ";", ...
Higher order bits comes first in the returned string. <p> @param bits how many bits should be returned.
[ "Higher", "order", "bits", "comes", "first", "in", "the", "returned", "string", ".", "<p", ">" ]
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/util/BitUtil.java#L207-L219
offbynull/coroutines
instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java
GenericGenerators.throwRuntimeException
public static InsnList throwRuntimeException(String message) { Validate.notNull(message); InsnList ret = new InsnList(); ret.add(new TypeInsnNode(Opcodes.NEW, "java/lang/RuntimeException")); ret.add(new InsnNode(Opcodes.DUP)); ret.add(new LdcInsnNode(message)); ret.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, "java/lang/RuntimeException", "<init>", "(Ljava/lang/String;)V", false)); ret.add(new InsnNode(Opcodes.ATHROW)); return ret; }
java
public static InsnList throwRuntimeException(String message) { Validate.notNull(message); InsnList ret = new InsnList(); ret.add(new TypeInsnNode(Opcodes.NEW, "java/lang/RuntimeException")); ret.add(new InsnNode(Opcodes.DUP)); ret.add(new LdcInsnNode(message)); ret.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, "java/lang/RuntimeException", "<init>", "(Ljava/lang/String;)V", false)); ret.add(new InsnNode(Opcodes.ATHROW)); return ret; }
[ "public", "static", "InsnList", "throwRuntimeException", "(", "String", "message", ")", "{", "Validate", ".", "notNull", "(", "message", ")", ";", "InsnList", "ret", "=", "new", "InsnList", "(", ")", ";", "ret", ".", "add", "(", "new", "TypeInsnNode", "(",...
Generates instructions to throw an exception of type {@link RuntimeException} with a constant message. @param message message of exception @return instructions to throw an exception @throws NullPointerException if any argument is {@code null}
[ "Generates", "instructions", "to", "throw", "an", "exception", "of", "type", "{" ]
train
https://github.com/offbynull/coroutines/blob/b1b83c293945f53a2f63fca8f15a53e88b796bf5/instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java#L895-L907
groovy/groovy-core
subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java
Sql.withInstance
public static void withInstance(String url, Closure c) throws SQLException { Sql sql = null; try { sql = newInstance(url); c.call(sql); } finally { if (sql != null) sql.close(); } }
java
public static void withInstance(String url, Closure c) throws SQLException { Sql sql = null; try { sql = newInstance(url); c.call(sql); } finally { if (sql != null) sql.close(); } }
[ "public", "static", "void", "withInstance", "(", "String", "url", ",", "Closure", "c", ")", "throws", "SQLException", "{", "Sql", "sql", "=", "null", ";", "try", "{", "sql", "=", "newInstance", "(", "url", ")", ";", "c", ".", "call", "(", "sql", ")",...
Invokes a closure passing it a new Sql instance created from the given JDBC connection URL. The created connection will be closed if required. @param url a database url of the form <code>jdbc:<em>subprotocol</em>:<em>subname</em></code> @param c the Closure to call @see #newInstance(String) @throws SQLException if a database access error occurs
[ "Invokes", "a", "closure", "passing", "it", "a", "new", "Sql", "instance", "created", "from", "the", "given", "JDBC", "connection", "URL", ".", "The", "created", "connection", "will", "be", "closed", "if", "required", "." ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L293-L301
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.addInlineComment
public void addInlineComment(Doc doc, Content htmltree) { addCommentTags(doc, doc.inlineTags(), false, false, htmltree); }
java
public void addInlineComment(Doc doc, Content htmltree) { addCommentTags(doc, doc.inlineTags(), false, false, htmltree); }
[ "public", "void", "addInlineComment", "(", "Doc", "doc", ",", "Content", "htmltree", ")", "{", "addCommentTags", "(", "doc", ",", "doc", ".", "inlineTags", "(", ")", ",", "false", ",", "false", ",", "htmltree", ")", ";", "}" ]
Adds the inline comment. @param doc the doc for which the inline comments will be generated @param htmltree the documentation tree to which the inline comments will be added
[ "Adds", "the", "inline", "comment", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L1465-L1467
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java
JacksonUtils.readJson
public static JsonNode readJson(InputStream source, ClassLoader classLoader) { return SerializationUtils.readJson(source, classLoader); }
java
public static JsonNode readJson(InputStream source, ClassLoader classLoader) { return SerializationUtils.readJson(source, classLoader); }
[ "public", "static", "JsonNode", "readJson", "(", "InputStream", "source", ",", "ClassLoader", "classLoader", ")", "{", "return", "SerializationUtils", ".", "readJson", "(", "source", ",", "classLoader", ")", ";", "}" ]
Read a JSON string and parse to {@link JsonNode} instance, with a custom class loader. @param source @param classLoader @return
[ "Read", "a", "JSON", "string", "and", "parse", "to", "{", "@link", "JsonNode", "}", "instance", "with", "a", "custom", "class", "loader", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java#L159-L161
salesforce/Argus
ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/UserResources.java
UserResources.updateUserPreferences
@PUT @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Path("{userId}/preferences") @Description("Update user preferences.") public PrincipalUserDto updateUserPreferences(@Context HttpServletRequest req, @PathParam("userId") final BigInteger userId, final Map<Preference, String> prefs) { if (userId == null || userId.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("User Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } if (prefs == null) { throw new WebApplicationException("Cannot update with null prefs.", Status.BAD_REQUEST); } PrincipalUser remoteUser = getRemoteUser(req); PrincipalUser user = _uService.findUserByPrimaryKey(userId); validateResourceAuthorization(req, user, remoteUser); if (user == null) { throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND); } user.getPreferences().putAll(prefs); user = _uService.updateUser(user); return PrincipalUserDto.transformToDto(user); }
java
@PUT @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Path("{userId}/preferences") @Description("Update user preferences.") public PrincipalUserDto updateUserPreferences(@Context HttpServletRequest req, @PathParam("userId") final BigInteger userId, final Map<Preference, String> prefs) { if (userId == null || userId.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("User Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } if (prefs == null) { throw new WebApplicationException("Cannot update with null prefs.", Status.BAD_REQUEST); } PrincipalUser remoteUser = getRemoteUser(req); PrincipalUser user = _uService.findUserByPrimaryKey(userId); validateResourceAuthorization(req, user, remoteUser); if (user == null) { throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND); } user.getPreferences().putAll(prefs); user = _uService.updateUser(user); return PrincipalUserDto.transformToDto(user); }
[ "@", "PUT", "@", "Produces", "(", "MediaType", ".", "APPLICATION_JSON", ")", "@", "Consumes", "(", "MediaType", ".", "APPLICATION_JSON", ")", "@", "Path", "(", "\"{userId}/preferences\"", ")", "@", "Description", "(", "\"Update user preferences.\"", ")", "public",...
Updates user preferences. @param req The HTTP request. @param userId The ID of the user to update. @param prefs The updated preferences. @return The updated user DTO. @throws WebApplicationException If an error occurs.
[ "Updates", "user", "preferences", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/UserResources.java#L289-L313
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.updateClosedList
public OperationStatus updateClosedList(UUID appId, String versionId, UUID clEntityId, ClosedListModelUpdateObject closedListModelUpdateObject) { return updateClosedListWithServiceResponseAsync(appId, versionId, clEntityId, closedListModelUpdateObject).toBlocking().single().body(); }
java
public OperationStatus updateClosedList(UUID appId, String versionId, UUID clEntityId, ClosedListModelUpdateObject closedListModelUpdateObject) { return updateClosedListWithServiceResponseAsync(appId, versionId, clEntityId, closedListModelUpdateObject).toBlocking().single().body(); }
[ "public", "OperationStatus", "updateClosedList", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "clEntityId", ",", "ClosedListModelUpdateObject", "closedListModelUpdateObject", ")", "{", "return", "updateClosedListWithServiceResponseAsync", "(", "appId", ","...
Updates the closed list model. @param appId The application ID. @param versionId The version ID. @param clEntityId The closed list model ID. @param closedListModelUpdateObject The new entity name and words list. @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.
[ "Updates", "the", "closed", "list", "model", "." ]
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#L4310-L4312
json-path/JsonPath
json-path/src/main/java/com/jayway/jsonpath/JsonPath.java
JsonPath.read
@SuppressWarnings({"unchecked"}) @Deprecated public static <T> T read(URL jsonURL, String jsonPath, Predicate... filters) throws IOException { return new ParseContextImpl().parse(jsonURL).read(jsonPath, filters); }
java
@SuppressWarnings({"unchecked"}) @Deprecated public static <T> T read(URL jsonURL, String jsonPath, Predicate... filters) throws IOException { return new ParseContextImpl().parse(jsonURL).read(jsonPath, filters); }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", "}", ")", "@", "Deprecated", "public", "static", "<", "T", ">", "T", "read", "(", "URL", "jsonURL", ",", "String", "jsonPath", ",", "Predicate", "...", "filters", ")", "throws", "IOException", "{", "retur...
Creates a new JsonPath and applies it to the provided Json object @param jsonURL url pointing to json doc @param jsonPath the json path @param filters filters to be applied to the filter place holders [?] in the path @param <T> expected return type @return list of objects matched by the given path
[ "Creates", "a", "new", "JsonPath", "and", "applies", "it", "to", "the", "provided", "Json", "object" ]
train
https://github.com/json-path/JsonPath/blob/5a09489c3252b74bbf81992aadb3073be59c04f9/json-path/src/main/java/com/jayway/jsonpath/JsonPath.java#L511-L515
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/LinAlgExceptions.java
LinAlgExceptions.assertMultiplies
public static void assertMultiplies(INDArray nd1, INDArray nd2) { if (nd1.rank() == 2 && nd2.rank() == 2 && nd1.columns() == nd2.rows()) { return; } // 1D edge case if (nd1.rank() == 2 && nd2.rank() == 1 && nd1.columns() == nd2.length()) return; throw new ND4JIllegalStateException("Cannot execute matrix multiplication: " + Arrays.toString(nd1.shape()) + "x" + Arrays.toString(nd2.shape()) + (nd1.rank() != 2 || nd2.rank() != 2 ? ": inputs are not matrices" : ": Column of left array " + nd1.columns() + " != rows of right " + nd2.rows())); }
java
public static void assertMultiplies(INDArray nd1, INDArray nd2) { if (nd1.rank() == 2 && nd2.rank() == 2 && nd1.columns() == nd2.rows()) { return; } // 1D edge case if (nd1.rank() == 2 && nd2.rank() == 1 && nd1.columns() == nd2.length()) return; throw new ND4JIllegalStateException("Cannot execute matrix multiplication: " + Arrays.toString(nd1.shape()) + "x" + Arrays.toString(nd2.shape()) + (nd1.rank() != 2 || nd2.rank() != 2 ? ": inputs are not matrices" : ": Column of left array " + nd1.columns() + " != rows of right " + nd2.rows())); }
[ "public", "static", "void", "assertMultiplies", "(", "INDArray", "nd1", ",", "INDArray", "nd2", ")", "{", "if", "(", "nd1", ".", "rank", "(", ")", "==", "2", "&&", "nd2", ".", "rank", "(", ")", "==", "2", "&&", "nd1", ".", "columns", "(", ")", "=...
Asserts matrix multiply rules (columns of left == rows of right or rows of left == columns of right) @param nd1 the left ndarray @param nd2 the right ndarray
[ "Asserts", "matrix", "multiply", "rules", "(", "columns", "of", "left", "==", "rows", "of", "right", "or", "rows", "of", "left", "==", "columns", "of", "right", ")" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/LinAlgExceptions.java#L104-L118
schallee/alib4j
core/src/main/java/net/darkmist/alib/io/OutputStreamBitsOutput.java
OutputStreamBitsOutput.uncheckedWriteBits
protected void uncheckedWriteBits(int numAddBits, int addBits) throws IOException { int chunks; if(numAddBits < numBitsLeft) // not equal { // all added bits fit in currentBits // clean other bits addBits &= (0xFF >>> (8-numAddBits)); // move addBits to position addBits <<= numBitsLeft - numAddBits; // add addBits to currentBits currentBits |= addBits; // fixup numBitsLeft numBitsLeft -= numAddBits; return; } // all bits left, also cleans any high bits addBits <<= Integer.SIZE - numAddBits; // shift numBitsLeft bits to right, add to current bits currentBits |= addBits >>> (Integer.SIZE - numBitsLeft); // remove used bits from addBits numAddBits -= numBitsLeft; addBits <<= numBitsLeft; // write the now full current byte writeCurrent(); // how many byte sized chunks? numAddBits/8 chunks = numAddBits >> 3; // write out each byte directly for(int i=0;i<chunks;i++) { // next byte to lsb int tmpBits = addBits >>> (Integer.SIZE - Byte.SIZE); // write out byte wrappedWrite(tmpBits); // clear out byte addBits <<= Byte.SIZE; } // figure out what we have left. numAddBits%8 if((numAddBits &= 0x7)==0) return; // nothing left. // set current bits to what is left currentBits = addBits >>> (Integer.SIZE - Byte.SIZE); // set to however many bits are left. %8 numBitsLeft = Byte.SIZE - numAddBits; }
java
protected void uncheckedWriteBits(int numAddBits, int addBits) throws IOException { int chunks; if(numAddBits < numBitsLeft) // not equal { // all added bits fit in currentBits // clean other bits addBits &= (0xFF >>> (8-numAddBits)); // move addBits to position addBits <<= numBitsLeft - numAddBits; // add addBits to currentBits currentBits |= addBits; // fixup numBitsLeft numBitsLeft -= numAddBits; return; } // all bits left, also cleans any high bits addBits <<= Integer.SIZE - numAddBits; // shift numBitsLeft bits to right, add to current bits currentBits |= addBits >>> (Integer.SIZE - numBitsLeft); // remove used bits from addBits numAddBits -= numBitsLeft; addBits <<= numBitsLeft; // write the now full current byte writeCurrent(); // how many byte sized chunks? numAddBits/8 chunks = numAddBits >> 3; // write out each byte directly for(int i=0;i<chunks;i++) { // next byte to lsb int tmpBits = addBits >>> (Integer.SIZE - Byte.SIZE); // write out byte wrappedWrite(tmpBits); // clear out byte addBits <<= Byte.SIZE; } // figure out what we have left. numAddBits%8 if((numAddBits &= 0x7)==0) return; // nothing left. // set current bits to what is left currentBits = addBits >>> (Integer.SIZE - Byte.SIZE); // set to however many bits are left. %8 numBitsLeft = Byte.SIZE - numAddBits; }
[ "protected", "void", "uncheckedWriteBits", "(", "int", "numAddBits", ",", "int", "addBits", ")", "throws", "IOException", "{", "int", "chunks", ";", "if", "(", "numAddBits", "<", "numBitsLeft", ")", "// not equal", "{", "// all added bits fit in currentBits", "// cl...
Writes bits to the output without checking arguments. Any currently incomplete byte is first completed and written. Bits left after last full byte is writeen are buffered until the next write. @param numAddBits The number of bits to write @param addBits The integer containing the bits to write. @throws IOException if the underlying {@link OutputStream#write(int)} does.
[ "Writes", "bits", "to", "the", "output", "without", "checking", "arguments", ".", "Any", "currently", "incomplete", "byte", "is", "first", "completed", "and", "written", ".", "Bits", "left", "after", "last", "full", "byte", "is", "writeen", "are", "buffered", ...
train
https://github.com/schallee/alib4j/blob/0e0718aee574bbb62268e1cf58e99286529ce529/core/src/main/java/net/darkmist/alib/io/OutputStreamBitsOutput.java#L119-L178
kaazing/gateway
transport/ws/src/main/java/org/kaazing/gateway/transport/ws/bridge/filter/WsFrameEncodingSupport.java
WsFrameEncodingSupport.doEncode
public static IoBufferEx doEncode(IoBufferAllocatorEx<?> allocator, int flags, WsMessage message, int maskValue) { final boolean mask = true; IoBufferEx ioBuf = getBytes(allocator, flags, message); ByteBuffer buf = ioBuf.buf(); boolean fin = message.isFin(); int remaining = buf.remaining(); int offset = 2 + (mask ? 4 : 0) + calculateLengthSize(remaining); ByteBuffer b = allocator.allocate(offset + remaining, flags); int start = b.position(); byte b1 = (byte) (fin ? 0x80 : 0x00); byte b2 = (byte) (mask ? 0x80 : 0x00); b1 = doEncodeOpcode(b1, message); b2 |= lenBits(remaining); b.put(b1).put(b2); doEncodeLength(b, remaining); if (mask) { b.putInt(maskValue); } if ( mask ) { WsFrameUtils.xor(buf, b, maskValue); } // reset buffer position after write in case of reuse // (KG-8125) if shared, duplicate to ensure we don't affect other threads if (ioBuf.isShared()) { b.put(buf.duplicate()); } else { int bufPos = buf.position(); b.put(buf); buf.position(bufPos); } b.limit(b.position()); b.position(start); return allocator.wrap(b, flags); }
java
public static IoBufferEx doEncode(IoBufferAllocatorEx<?> allocator, int flags, WsMessage message, int maskValue) { final boolean mask = true; IoBufferEx ioBuf = getBytes(allocator, flags, message); ByteBuffer buf = ioBuf.buf(); boolean fin = message.isFin(); int remaining = buf.remaining(); int offset = 2 + (mask ? 4 : 0) + calculateLengthSize(remaining); ByteBuffer b = allocator.allocate(offset + remaining, flags); int start = b.position(); byte b1 = (byte) (fin ? 0x80 : 0x00); byte b2 = (byte) (mask ? 0x80 : 0x00); b1 = doEncodeOpcode(b1, message); b2 |= lenBits(remaining); b.put(b1).put(b2); doEncodeLength(b, remaining); if (mask) { b.putInt(maskValue); } if ( mask ) { WsFrameUtils.xor(buf, b, maskValue); } // reset buffer position after write in case of reuse // (KG-8125) if shared, duplicate to ensure we don't affect other threads if (ioBuf.isShared()) { b.put(buf.duplicate()); } else { int bufPos = buf.position(); b.put(buf); buf.position(bufPos); } b.limit(b.position()); b.position(start); return allocator.wrap(b, flags); }
[ "public", "static", "IoBufferEx", "doEncode", "(", "IoBufferAllocatorEx", "<", "?", ">", "allocator", ",", "int", "flags", ",", "WsMessage", "message", ",", "int", "maskValue", ")", "{", "final", "boolean", "mask", "=", "true", ";", "IoBufferEx", "ioBuf", "=...
Encode WebSocket message as a single frame, with the provided masking value applied.
[ "Encode", "WebSocket", "message", "as", "a", "single", "frame", "with", "the", "provided", "masking", "value", "applied", "." ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/ws/src/main/java/org/kaazing/gateway/transport/ws/bridge/filter/WsFrameEncodingSupport.java#L35-L80
jbundle/jbundle
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java
ThinTableModel.cacheCurrentLockedData
public BaseBuffer cacheCurrentLockedData(int iRowIndex, FieldList fieldList) { int iColumnCount = this.getColumnCount(); if ((m_buffCurrentLockedData == null) || (m_iCurrentLockedRowIndex != iRowIndex)) m_buffCurrentLockedData = new VectorBuffer(null, BaseBuffer.ALL_FIELDS); m_buffCurrentLockedData.fieldsToBuffer(fieldList); for (int i = 0; i < iColumnCount; i++) { // Cache the non-field data Field field = null; if (this.getFieldInfo(i) != null) field = this.getFieldInfo(i).getField(); if ((field != null) && (field.getRecord() != fieldList)) m_buffCurrentLockedData.addNextString(field.toString()); } m_iCurrentLockedRowIndex = iRowIndex; return m_buffCurrentLockedData; }
java
public BaseBuffer cacheCurrentLockedData(int iRowIndex, FieldList fieldList) { int iColumnCount = this.getColumnCount(); if ((m_buffCurrentLockedData == null) || (m_iCurrentLockedRowIndex != iRowIndex)) m_buffCurrentLockedData = new VectorBuffer(null, BaseBuffer.ALL_FIELDS); m_buffCurrentLockedData.fieldsToBuffer(fieldList); for (int i = 0; i < iColumnCount; i++) { // Cache the non-field data Field field = null; if (this.getFieldInfo(i) != null) field = this.getFieldInfo(i).getField(); if ((field != null) && (field.getRecord() != fieldList)) m_buffCurrentLockedData.addNextString(field.toString()); } m_iCurrentLockedRowIndex = iRowIndex; return m_buffCurrentLockedData; }
[ "public", "BaseBuffer", "cacheCurrentLockedData", "(", "int", "iRowIndex", ",", "FieldList", "fieldList", ")", "{", "int", "iColumnCount", "=", "this", ".", "getColumnCount", "(", ")", ";", "if", "(", "(", "m_buffCurrentLockedData", "==", "null", ")", "||", "(...
Get the array of changed values for the current row. I use a standard field buffer and append all the screen items which are not included in the field. @param iRowIndex The row to get the data for. @return The array of data for the currently locked row.
[ "Get", "the", "array", "of", "changed", "values", "for", "the", "current", "row", ".", "I", "use", "a", "standard", "field", "buffer", "and", "append", "all", "the", "screen", "items", "which", "are", "not", "included", "in", "the", "field", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java#L245-L261
jillesvangurp/jsonj
src/main/java/com/github/jsonj/tools/JsonBuilder.java
JsonBuilder.put
public @Nonnull JsonBuilder put(String key, String s) { object.put(key, primitive(s)); return this; }
java
public @Nonnull JsonBuilder put(String key, String s) { object.put(key, primitive(s)); return this; }
[ "public", "@", "Nonnull", "JsonBuilder", "put", "(", "String", "key", ",", "String", "s", ")", "{", "object", ".", "put", "(", "key", ",", "primitive", "(", "s", ")", ")", ";", "return", "this", ";", "}" ]
Add a string value to the object. @param key key @param s value @return the builder
[ "Add", "a", "string", "value", "to", "the", "object", "." ]
train
https://github.com/jillesvangurp/jsonj/blob/1da0c44c5bdb60c0cd806c48d2da5a8a75bf84af/src/main/java/com/github/jsonj/tools/JsonBuilder.java#L88-L91
landawn/AbacusUtil
src/com/landawn/abacus/android/util/SQLiteExecutor.java
SQLiteExecutor.query
@SafeVarargs public final DataSet query(Class<?> targetClass, String sql, Object... parameters) { return query(targetClass, sql, 0, Integer.MAX_VALUE, parameters); }
java
@SafeVarargs public final DataSet query(Class<?> targetClass, String sql, Object... parameters) { return query(targetClass, sql, 0, Integer.MAX_VALUE, parameters); }
[ "@", "SafeVarargs", "public", "final", "DataSet", "query", "(", "Class", "<", "?", ">", "targetClass", ",", "String", "sql", ",", "Object", "...", "parameters", ")", "{", "return", "query", "(", "targetClass", ",", "sql", ",", "0", ",", "Integer", ".", ...
Find the records from database with the specified <code>sql, parameters</code> and return the result set. @param targetClass an entity class with getter/setter methods. @param sql set <code>offset</code> and <code>limit</code> in sql with format: <li><code>SELECT * FROM account where id = ? LIMIT <i>offsetValue</i>, <i>limitValue</i></code></li> <br>or limit only:</br> <li><code>SELECT * FROM account where id = ? LIMIT <i>limitValue</i></code></li> @param parameters A Object Array/List, and Map/Entity with getter/setter methods for parameterized sql with named parameters @return
[ "Find", "the", "records", "from", "database", "with", "the", "specified", "<code", ">", "sql", "parameters<", "/", "code", ">", "and", "return", "the", "result", "set", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/android/util/SQLiteExecutor.java#L2002-L2005
flow/commons
src/main/java/com/flowpowered/commons/hashing/Int10TripleHashed.java
Int10TripleHashed.key
public final int key(int x, int y, int z) { return (((x - bx) & 0x3FF) << 22) | (((y - by) & 0x3FF) << 11) | ((z - bz) & 0x3FF); }
java
public final int key(int x, int y, int z) { return (((x - bx) & 0x3FF) << 22) | (((y - by) & 0x3FF) << 11) | ((z - bz) & 0x3FF); }
[ "public", "final", "int", "key", "(", "int", "x", ",", "int", "y", ",", "int", "z", ")", "{", "return", "(", "(", "(", "x", "-", "bx", ")", "&", "0x3FF", ")", "<<", "22", ")", "|", "(", "(", "(", "y", "-", "by", ")", "&", "0x3FF", ")", ...
Packs given x, y, z coordinates. The coords must represent a point within a 1024 sized cuboid with the base at the (bx, by, bz) @param x an <code>int</code> value @param y an <code>int</code> value @param z an <code>int</code> value @return the packed int
[ "Packs", "given", "x", "y", "z", "coordinates", ".", "The", "coords", "must", "represent", "a", "point", "within", "a", "1024", "sized", "cuboid", "with", "the", "base", "at", "the", "(", "bx", "by", "bz", ")" ]
train
https://github.com/flow/commons/blob/0690efdac06fd728fcd7e9cf10f2b1319379c45b/src/main/java/com/flowpowered/commons/hashing/Int10TripleHashed.java#L58-L60
acromusashi/acromusashi-stream
src/main/java/acromusashi/stream/bean/FieldExtractor.java
FieldExtractor.extractKeyHead
public static String extractKeyHead(String key, String delimeter) { int index = key.indexOf(delimeter); if (index == -1) { return key; } String result = key.substring(0, index); return result; }
java
public static String extractKeyHead(String key, String delimeter) { int index = key.indexOf(delimeter); if (index == -1) { return key; } String result = key.substring(0, index); return result; }
[ "public", "static", "String", "extractKeyHead", "(", "String", "key", ",", "String", "delimeter", ")", "{", "int", "index", "=", "key", ".", "indexOf", "(", "delimeter", ")", ";", "if", "(", "index", "==", "-", "1", ")", "{", "return", "key", ";", "}...
Extract the value of keyHead. @param key is used to get string. @param delimeter key delimeter @return the value of keyHead .
[ "Extract", "the", "value", "of", "keyHead", "." ]
train
https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/bean/FieldExtractor.java#L87-L97
OpenLiberty/open-liberty
dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/LoggingConfigUtils.java
LoggingConfigUtils.getDelegate
public static <T> T getDelegate(Class<T> delegateClass, String className, String defaultDelegateClass) { if (className == null) className = defaultDelegateClass; try { return Class.forName(className).asSubclass(delegateClass).newInstance(); } catch (Throwable e) { System.err.println("Unable to locate configured delegate: " + delegateClass + ", " + e); } return null; }
java
public static <T> T getDelegate(Class<T> delegateClass, String className, String defaultDelegateClass) { if (className == null) className = defaultDelegateClass; try { return Class.forName(className).asSubclass(delegateClass).newInstance(); } catch (Throwable e) { System.err.println("Unable to locate configured delegate: " + delegateClass + ", " + e); } return null; }
[ "public", "static", "<", "T", ">", "T", "getDelegate", "(", "Class", "<", "T", ">", "delegateClass", ",", "String", "className", ",", "String", "defaultDelegateClass", ")", "{", "if", "(", "className", "==", "null", ")", "className", "=", "defaultDelegateCla...
Create a delegate instance of the specified (or default) delegate class. @param delegate Specifically configured delegate class @param defaultDelegateClass Default delegate class @return constructed delegate instance
[ "Create", "a", "delegate", "instance", "of", "the", "specified", "(", "or", "default", ")", "delegate", "class", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/LoggingConfigUtils.java#L194-L204
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java
HttpOutboundServiceContextImpl.getRawResponseBodyBuffer
@Override public VirtualConnection getRawResponseBodyBuffer(InterChannelCallback callback, boolean bForce) throws BodyCompleteException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "getRawResponseBodyBuffer(async)"); } setRawBody(true); VirtualConnection vc = getResponseBodyBuffer(callback, bForce); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "getRawResponseBodyBuffer(async): " + vc); } return vc; }
java
@Override public VirtualConnection getRawResponseBodyBuffer(InterChannelCallback callback, boolean bForce) throws BodyCompleteException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "getRawResponseBodyBuffer(async)"); } setRawBody(true); VirtualConnection vc = getResponseBodyBuffer(callback, bForce); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "getRawResponseBodyBuffer(async): " + vc); } return vc; }
[ "@", "Override", "public", "VirtualConnection", "getRawResponseBodyBuffer", "(", "InterChannelCallback", "callback", ",", "boolean", "bForce", ")", "throws", "BodyCompleteException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", "...
Retrieve the next buffer of the body asynchronously. This will avoid any body modifications, such as decompression or removal of chunked-encoding markers. <p> If the read can be performed immediately, then a VirtualConnection will be returned and the provided callback will not be used. If the read is being done asychronously, then null will be returned and the callback used when complete. The force input flag allows the caller to force the asynchronous read to always occur, and thus the callback to always be used. <p> The caller is responsible for releasing these buffers when finished with them as the HTTP Channel keeps no reference to them. @param callback @param bForce @return VirtualConnection @throws BodyCompleteException -- if the entire body has already been read
[ "Retrieve", "the", "next", "buffer", "of", "the", "body", "asynchronously", ".", "This", "will", "avoid", "any", "body", "modifications", "such", "as", "decompression", "or", "removal", "of", "chunked", "-", "encoding", "markers", ".", "<p", ">", "If", "the"...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java#L2179-L2190
Azure/azure-sdk-for-java
resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/DeploymentsInner.java
DeploymentsInner.beginDelete
public void beginDelete(String resourceGroupName, String deploymentName) { beginDeleteWithServiceResponseAsync(resourceGroupName, deploymentName).toBlocking().single().body(); }
java
public void beginDelete(String resourceGroupName, String deploymentName) { beginDeleteWithServiceResponseAsync(resourceGroupName, deploymentName).toBlocking().single().body(); }
[ "public", "void", "beginDelete", "(", "String", "resourceGroupName", ",", "String", "deploymentName", ")", "{", "beginDeleteWithServiceResponseAsync", "(", "resourceGroupName", ",", "deploymentName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", ...
Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. @param resourceGroupName The name of the resource group with the deployment to delete. The name is case insensitive. @param deploymentName The name of the deployment to delete. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Deletes", "a", "deployment", "from", "the", "deployment", "history", ".", "A", "template", "deployment", "that", "is", "currently", "running", "cannot", "be", "deleted", ".", "Deleting", "a", "template", "deployment", "removes", "the", "associated", "deployment",...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/DeploymentsInner.java#L197-L199
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/TypesafeConfigUtils.java
TypesafeConfigUtils.getBoolean
public static Boolean getBoolean(Config config, String path) { try { return config.getBoolean(path) ? Boolean.TRUE : Boolean.FALSE; } catch (ConfigException.Missing | ConfigException.WrongType e) { if (e instanceof ConfigException.WrongType) { LOGGER.warn(e.getMessage(), e); } return null; } }
java
public static Boolean getBoolean(Config config, String path) { try { return config.getBoolean(path) ? Boolean.TRUE : Boolean.FALSE; } catch (ConfigException.Missing | ConfigException.WrongType e) { if (e instanceof ConfigException.WrongType) { LOGGER.warn(e.getMessage(), e); } return null; } }
[ "public", "static", "Boolean", "getBoolean", "(", "Config", "config", ",", "String", "path", ")", "{", "try", "{", "return", "config", ".", "getBoolean", "(", "path", ")", "?", "Boolean", ".", "TRUE", ":", "Boolean", ".", "FALSE", ";", "}", "catch", "(...
Get a configuration as Boolean. Return {@code null} if missing or wrong type. @param config @param path @return
[ "Get", "a", "configuration", "as", "Boolean", ".", "Return", "{", "@code", "null", "}", "if", "missing", "or", "wrong", "type", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/TypesafeConfigUtils.java#L247-L256
RestComm/sip-servlets
containers/tomcat-7/src/main/java/org/mobicents/servlet/sip/startup/SipNamingContextListener.java
SipNamingContextListener.removeTimerService
public static void removeTimerService(Context envCtx, String appName, TimerService timerService) { if(envCtx != null) { try { javax.naming.Context sipContext = (javax.naming.Context)envCtx.lookup(SIP_SUBCONTEXT + "/" + appName); sipContext.unbind(TIMER_SERVICE_JNDI_NAME); } catch (NamingException e) { logger.error(sm.getString("naming.unbindFailed", e)); } } }
java
public static void removeTimerService(Context envCtx, String appName, TimerService timerService) { if(envCtx != null) { try { javax.naming.Context sipContext = (javax.naming.Context)envCtx.lookup(SIP_SUBCONTEXT + "/" + appName); sipContext.unbind(TIMER_SERVICE_JNDI_NAME); } catch (NamingException e) { logger.error(sm.getString("naming.unbindFailed", e)); } } }
[ "public", "static", "void", "removeTimerService", "(", "Context", "envCtx", ",", "String", "appName", ",", "TimerService", "timerService", ")", "{", "if", "(", "envCtx", "!=", "null", ")", "{", "try", "{", "javax", ".", "naming", ".", "Context", "sipContext"...
Removes the Timer Service binding from the jndi mapping @param appName the application name subcontext @param timerService the Timer Service to remove
[ "Removes", "the", "Timer", "Service", "binding", "from", "the", "jndi", "mapping" ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/containers/tomcat-7/src/main/java/org/mobicents/servlet/sip/startup/SipNamingContextListener.java#L262-L271
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.getPackageLink
public Content getPackageLink(PackageElement packageElement, Content label) { boolean included = packageElement != null && utils.isIncluded(packageElement); if (!included) { for (PackageElement p : configuration.packages) { if (p.equals(packageElement)) { included = true; break; } } } if (included || packageElement == null) { return getHyperLink(pathString(packageElement, DocPaths.PACKAGE_SUMMARY), label); } else { DocLink crossPkgLink = getCrossPackageLink(utils.getPackageName(packageElement)); if (crossPkgLink != null) { return getHyperLink(crossPkgLink, label); } else { return label; } } }
java
public Content getPackageLink(PackageElement packageElement, Content label) { boolean included = packageElement != null && utils.isIncluded(packageElement); if (!included) { for (PackageElement p : configuration.packages) { if (p.equals(packageElement)) { included = true; break; } } } if (included || packageElement == null) { return getHyperLink(pathString(packageElement, DocPaths.PACKAGE_SUMMARY), label); } else { DocLink crossPkgLink = getCrossPackageLink(utils.getPackageName(packageElement)); if (crossPkgLink != null) { return getHyperLink(crossPkgLink, label); } else { return label; } } }
[ "public", "Content", "getPackageLink", "(", "PackageElement", "packageElement", ",", "Content", "label", ")", "{", "boolean", "included", "=", "packageElement", "!=", "null", "&&", "utils", ".", "isIncluded", "(", "packageElement", ")", ";", "if", "(", "!", "i...
Return the link to the given package. @param packageElement the package to link to. @param label the label for the link. @return a content tree for the package link.
[ "Return", "the", "link", "to", "the", "given", "package", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L1114-L1135
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/classreading/ClasspathReader.java
ClasspathReader.findResourcesByClasspath
@SuppressWarnings("deprecation") @Override public final URL[] findResourcesByClasspath() { List<URL> list = new ArrayList<URL>(); String classpath = System.getProperty("java.class.path"); StringTokenizer tokenizer = new StringTokenizer(classpath, File.pathSeparator); while (tokenizer.hasMoreTokens()) { String path = tokenizer.nextToken(); File fp = new File(path); if (!fp.exists()) throw new ResourceReadingException("File in java.class.path does not exist: " + fp); try { list.add(fp.toURL()); } catch (MalformedURLException e) { throw new ResourceReadingException(e); } } return list.toArray(new URL[list.size()]); }
java
@SuppressWarnings("deprecation") @Override public final URL[] findResourcesByClasspath() { List<URL> list = new ArrayList<URL>(); String classpath = System.getProperty("java.class.path"); StringTokenizer tokenizer = new StringTokenizer(classpath, File.pathSeparator); while (tokenizer.hasMoreTokens()) { String path = tokenizer.nextToken(); File fp = new File(path); if (!fp.exists()) throw new ResourceReadingException("File in java.class.path does not exist: " + fp); try { list.add(fp.toURL()); } catch (MalformedURLException e) { throw new ResourceReadingException(e); } } return list.toArray(new URL[list.size()]); }
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "@", "Override", "public", "final", "URL", "[", "]", "findResourcesByClasspath", "(", ")", "{", "List", "<", "URL", ">", "list", "=", "new", "ArrayList", "<", "URL", ">", "(", ")", ";", "String", "cla...
Uses the java.class.path system property to obtain a list of URLs that represent the CLASSPATH @return the URl[]
[ "Uses", "the", "java", ".", "class", ".", "path", "system", "property", "to", "obtain", "a", "list", "of", "URLs", "that", "represent", "the", "CLASSPATH" ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/classreading/ClasspathReader.java#L108-L133
spring-projects/spring-social
spring-social-config/src/main/java/org/springframework/social/config/support/ProviderConfigurationSupport.java
ProviderConfigurationSupport.getApiHelperBeanDefinitionBuilder
protected BeanDefinitionBuilder getApiHelperBeanDefinitionBuilder(Map<String, Object> allAttributes) { return BeanDefinitionBuilder.genericBeanDefinition(apiHelperClass) .addConstructorArgReference("usersConnectionRepository") .addConstructorArgReference("userIdSource"); }
java
protected BeanDefinitionBuilder getApiHelperBeanDefinitionBuilder(Map<String, Object> allAttributes) { return BeanDefinitionBuilder.genericBeanDefinition(apiHelperClass) .addConstructorArgReference("usersConnectionRepository") .addConstructorArgReference("userIdSource"); }
[ "protected", "BeanDefinitionBuilder", "getApiHelperBeanDefinitionBuilder", "(", "Map", "<", "String", ",", "Object", ">", "allAttributes", ")", "{", "return", "BeanDefinitionBuilder", ".", "genericBeanDefinition", "(", "apiHelperClass", ")", ".", "addConstructorArgReference...
Subclassing hook to allow api helper bean to be configured with attributes from annotation @param allAttributes additional attributes that may be used when creating the API helper bean. @return a {@link BeanDefinitionBuilder} for the API Helper
[ "Subclassing", "hook", "to", "allow", "api", "helper", "bean", "to", "be", "configured", "with", "attributes", "from", "annotation" ]
train
https://github.com/spring-projects/spring-social/blob/e41cfecb288022b83c79413b58f52511c3c9d4fc/spring-social-config/src/main/java/org/springframework/social/config/support/ProviderConfigurationSupport.java#L177-L182
BranchMetrics/android-branch-deep-linking
Branch-SDK/src/io/branch/indexing/BranchUniversalObject.java
BranchUniversalObject.generateShortUrl
public void generateShortUrl(@NonNull Context context, @NonNull LinkProperties linkProperties, @Nullable Branch.BranchLinkCreateListener callback) { getLinkBuilder(context, linkProperties).generateShortUrl(callback); }
java
public void generateShortUrl(@NonNull Context context, @NonNull LinkProperties linkProperties, @Nullable Branch.BranchLinkCreateListener callback) { getLinkBuilder(context, linkProperties).generateShortUrl(callback); }
[ "public", "void", "generateShortUrl", "(", "@", "NonNull", "Context", "context", ",", "@", "NonNull", "LinkProperties", "linkProperties", ",", "@", "Nullable", "Branch", ".", "BranchLinkCreateListener", "callback", ")", "{", "getLinkBuilder", "(", "context", ",", ...
Creates a short url for the BUO asynchronously @param context {@link Context} instance @param linkProperties An object of {@link LinkProperties} specifying the properties of this link @param callback An instance of {@link io.branch.referral.Branch.BranchLinkCreateListener} to receive the results
[ "Creates", "a", "short", "url", "for", "the", "BUO", "asynchronously" ]
train
https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/indexing/BranchUniversalObject.java#L621-L623
seedstack/i18n-addon
rest/src/it/java/org/seedstack/i18n/shared/AbstractI18nRestIT.java
AbstractI18nRestIT.httpPut
protected Response httpPut(String path, String body, int status) { return httpRequest(status, null).body(body).put(baseURL + PATH_PREFIX + path); }
java
protected Response httpPut(String path, String body, int status) { return httpRequest(status, null).body(body).put(baseURL + PATH_PREFIX + path); }
[ "protected", "Response", "httpPut", "(", "String", "path", ",", "String", "body", ",", "int", "status", ")", "{", "return", "httpRequest", "(", "status", ",", "null", ")", ".", "body", "(", "body", ")", ".", "put", "(", "baseURL", "+", "PATH_PREFIX", "...
Puts the body to the given path and expect a 200 status code. @param path the resource URI @param body the resource representation @return the http response
[ "Puts", "the", "body", "to", "the", "given", "path", "and", "expect", "a", "200", "status", "code", "." ]
train
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/it/java/org/seedstack/i18n/shared/AbstractI18nRestIT.java#L109-L111
Ordinastie/MalisisCore
src/main/java/net/malisis/core/registry/MalisisRegistry.java
MalisisRegistry.registerSound
public static SoundEvent registerSound(String modId, String soundId) { ResourceLocation rl = new ResourceLocation(modId, soundId); SoundEvent sound = new SoundEvent(rl); sound.setRegistryName(rl); ForgeRegistries.SOUND_EVENTS.register(sound); return sound; }
java
public static SoundEvent registerSound(String modId, String soundId) { ResourceLocation rl = new ResourceLocation(modId, soundId); SoundEvent sound = new SoundEvent(rl); sound.setRegistryName(rl); ForgeRegistries.SOUND_EVENTS.register(sound); return sound; }
[ "public", "static", "SoundEvent", "registerSound", "(", "String", "modId", ",", "String", "soundId", ")", "{", "ResourceLocation", "rl", "=", "new", "ResourceLocation", "(", "modId", ",", "soundId", ")", ";", "SoundEvent", "sound", "=", "new", "SoundEvent", "(...
Registers a new {@link SoundEvent}. @param modId the mod id @param soundId the sound id @return the sound event
[ "Registers", "a", "new", "{", "@link", "SoundEvent", "}", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/registry/MalisisRegistry.java#L260-L267
rhuss/jolokia
client/java/src/main/java/org/jolokia/client/request/J4pSearchResponse.java
J4pSearchResponse.getObjectNames
public List<ObjectName> getObjectNames() { List<String> names = getMBeanNames(); List<ObjectName> ret = new ArrayList<ObjectName>(names.size()); for (String name : names) { try { ret.add(new ObjectName(name)); } catch (MalformedObjectNameException e) { // Should never happen since the names returned by the server must // be valid ObjectNames for sure throw new IllegalStateException("Cannot convert search result '" + name + "' to an ObjectName",e); } } return ret; }
java
public List<ObjectName> getObjectNames() { List<String> names = getMBeanNames(); List<ObjectName> ret = new ArrayList<ObjectName>(names.size()); for (String name : names) { try { ret.add(new ObjectName(name)); } catch (MalformedObjectNameException e) { // Should never happen since the names returned by the server must // be valid ObjectNames for sure throw new IllegalStateException("Cannot convert search result '" + name + "' to an ObjectName",e); } } return ret; }
[ "public", "List", "<", "ObjectName", ">", "getObjectNames", "(", ")", "{", "List", "<", "String", ">", "names", "=", "getMBeanNames", "(", ")", ";", "List", "<", "ObjectName", ">", "ret", "=", "new", "ArrayList", "<", "ObjectName", ">", "(", "names", "...
Get the found names as a list of {@link ObjectName} objects. @return list of MBean object names or an empty list.
[ "Get", "the", "found", "names", "as", "a", "list", "of", "{", "@link", "ObjectName", "}", "objects", "." ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/client/java/src/main/java/org/jolokia/client/request/J4pSearchResponse.java#L45-L58
elki-project/elki
elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/optionhandling/parameterization/ListParameterization.java
ListParameterization.addFlag
public ListParameterization addFlag(OptionID optionid) { parameters.add(new ParameterPair(optionid, Flag.SET)); return this; }
java
public ListParameterization addFlag(OptionID optionid) { parameters.add(new ParameterPair(optionid, Flag.SET)); return this; }
[ "public", "ListParameterization", "addFlag", "(", "OptionID", "optionid", ")", "{", "parameters", ".", "add", "(", "new", "ParameterPair", "(", "optionid", ",", "Flag", ".", "SET", ")", ")", ";", "return", "this", ";", "}" ]
Add a flag to the parameter list @param optionid Option ID @return this, for chaining
[ "Add", "a", "flag", "to", "the", "parameter", "list" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/optionhandling/parameterization/ListParameterization.java#L77-L80
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/xml/XMLOutputUtil.java
XMLOutputUtil.writeCollection
public static void writeCollection(XMLOutput xmlOutput, Collection<? extends XMLWriteable> collection) throws IOException { for (XMLWriteable obj : collection) { obj.writeXML(xmlOutput); } }
java
public static void writeCollection(XMLOutput xmlOutput, Collection<? extends XMLWriteable> collection) throws IOException { for (XMLWriteable obj : collection) { obj.writeXML(xmlOutput); } }
[ "public", "static", "void", "writeCollection", "(", "XMLOutput", "xmlOutput", ",", "Collection", "<", "?", "extends", "XMLWriteable", ">", "collection", ")", "throws", "IOException", "{", "for", "(", "XMLWriteable", "obj", ":", "collection", ")", "{", "obj", "...
Write a Collection of XMLWriteable objects. @param xmlOutput the XMLOutput object to write to @param collection Collection of XMLWriteable objects
[ "Write", "a", "Collection", "of", "XMLWriteable", "objects", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/xml/XMLOutputUtil.java#L109-L113
grails/grails-core
grails-core/src/main/groovy/grails/util/GrailsClassUtils.java
GrailsClassUtils.isStaticProperty
@SuppressWarnings("rawtypes") public static boolean isStaticProperty(Class clazz, String propertyName) { Method getter = BeanUtils.findDeclaredMethod(clazz, getGetterName(propertyName), (Class[])null); if (getter != null) { return isPublicStatic(getter); } try { Field f = clazz.getDeclaredField(propertyName); if (f != null) { return isPublicStatic(f); } } catch (NoSuchFieldException ignored) { // ignored } return false; }
java
@SuppressWarnings("rawtypes") public static boolean isStaticProperty(Class clazz, String propertyName) { Method getter = BeanUtils.findDeclaredMethod(clazz, getGetterName(propertyName), (Class[])null); if (getter != null) { return isPublicStatic(getter); } try { Field f = clazz.getDeclaredField(propertyName); if (f != null) { return isPublicStatic(f); } } catch (NoSuchFieldException ignored) { // ignored } return false; }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "public", "static", "boolean", "isStaticProperty", "(", "Class", "clazz", ",", "String", "propertyName", ")", "{", "Method", "getter", "=", "BeanUtils", ".", "findDeclaredMethod", "(", "clazz", ",", "getGetterName...
<p>Work out if the specified property is readable and static. Java introspection does not recognize this concept of static properties but Groovy does. We also consider public static fields as static properties with no getters/setters</p> @param clazz The class to check for static property @param propertyName The property name @return true if the property with name propertyName has a static getter method
[ "<p", ">", "Work", "out", "if", "the", "specified", "property", "is", "readable", "and", "static", ".", "Java", "introspection", "does", "not", "recognize", "this", "concept", "of", "static", "properties", "but", "Groovy", "does", ".", "We", "also", "conside...
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/util/GrailsClassUtils.java#L524-L542
groupon/monsoon
expr/src/main/java/com/groupon/lex/metrics/timeseries/expression/SumExpression.java
SumExpression.sum_impl_
private static Number sum_impl_(Number x, Number y) { if (x instanceof Double || y instanceof Double) return Double.valueOf(x.doubleValue() + y.doubleValue()); else return Long.valueOf(x.longValue() + y.longValue()); }
java
private static Number sum_impl_(Number x, Number y) { if (x instanceof Double || y instanceof Double) return Double.valueOf(x.doubleValue() + y.doubleValue()); else return Long.valueOf(x.longValue() + y.longValue()); }
[ "private", "static", "Number", "sum_impl_", "(", "Number", "x", ",", "Number", "y", ")", "{", "if", "(", "x", "instanceof", "Double", "||", "y", "instanceof", "Double", ")", "return", "Double", ".", "valueOf", "(", "x", ".", "doubleValue", "(", ")", "+...
/* Calculate the sum of two numbers, preserving integral type if possible.
[ "/", "*", "Calculate", "the", "sum", "of", "two", "numbers", "preserving", "integral", "type", "if", "possible", "." ]
train
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/expr/src/main/java/com/groupon/lex/metrics/timeseries/expression/SumExpression.java#L56-L61
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/core/store/ValidationStore.java
ValidationStore.getValidationDatas
public List<ValidationData> getValidationDatas(ParamType paramType, String key) { if (this.urlMap == null || this.validationDataRuleListMap == null) { log.info("url map is empty :: " + key ); return null; } if (key == null || paramType == null) { throw new ValidationLibException("any parameter is null", HttpStatus.INTERNAL_SERVER_ERROR); } ReqUrl reqUrl = urlMap.get(key); if (reqUrl == null) { log.info("reqUrl is null :" + key); return null; } return validationDataRuleListMap.get(paramType.getUniqueKey(reqUrl.getUniqueKey())); }
java
public List<ValidationData> getValidationDatas(ParamType paramType, String key) { if (this.urlMap == null || this.validationDataRuleListMap == null) { log.info("url map is empty :: " + key ); return null; } if (key == null || paramType == null) { throw new ValidationLibException("any parameter is null", HttpStatus.INTERNAL_SERVER_ERROR); } ReqUrl reqUrl = urlMap.get(key); if (reqUrl == null) { log.info("reqUrl is null :" + key); return null; } return validationDataRuleListMap.get(paramType.getUniqueKey(reqUrl.getUniqueKey())); }
[ "public", "List", "<", "ValidationData", ">", "getValidationDatas", "(", "ParamType", "paramType", ",", "String", "key", ")", "{", "if", "(", "this", ".", "urlMap", "==", "null", "||", "this", ".", "validationDataRuleListMap", "==", "null", ")", "{", "log", ...
Gets validation datas. @param paramType the param type @param key the key @return the validation datas
[ "Gets", "validation", "datas", "." ]
train
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/core/store/ValidationStore.java#L83-L100
threerings/nenya
core/src/main/java/com/threerings/miso/client/SceneObjectTip.java
SceneObjectTip.registerTipLayout
public static void registerTipLayout (String prefix, TipLayout layout) { LayoutReg reg = new LayoutReg(); reg.prefix = prefix; reg.layout = layout; _layouts.insertSorted(reg); }
java
public static void registerTipLayout (String prefix, TipLayout layout) { LayoutReg reg = new LayoutReg(); reg.prefix = prefix; reg.layout = layout; _layouts.insertSorted(reg); }
[ "public", "static", "void", "registerTipLayout", "(", "String", "prefix", ",", "TipLayout", "layout", ")", "{", "LayoutReg", "reg", "=", "new", "LayoutReg", "(", ")", ";", "reg", ".", "prefix", "=", "prefix", ";", "reg", ".", "layout", "=", "layout", ";"...
It may be desirable to layout object tips specially depending on what sort of actions they represent, so we allow different tip layout algorithms to be registered for particular object prefixes. The registration is simply a list searched from longest string to shortest string for the first match to an object's action.
[ "It", "may", "be", "desirable", "to", "layout", "object", "tips", "specially", "depending", "on", "what", "sort", "of", "actions", "they", "represent", "so", "we", "allow", "different", "tip", "layout", "algorithms", "to", "be", "registered", "for", "particula...
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/SceneObjectTip.java#L144-L150
hypfvieh/java-utils
src/main/java/com/github/hypfvieh/util/TypeUtil.java
TypeUtil.isInteger
public static boolean isInteger(String _str, boolean _allowNegative) { if (_str == null) { return false; } String regex = "[0-9]+$"; if (_allowNegative) { regex = "^-?" + regex; } else { regex = "^" + regex; } return _str.matches(regex); }
java
public static boolean isInteger(String _str, boolean _allowNegative) { if (_str == null) { return false; } String regex = "[0-9]+$"; if (_allowNegative) { regex = "^-?" + regex; } else { regex = "^" + regex; } return _str.matches(regex); }
[ "public", "static", "boolean", "isInteger", "(", "String", "_str", ",", "boolean", "_allowNegative", ")", "{", "if", "(", "_str", "==", "null", ")", "{", "return", "false", ";", "}", "String", "regex", "=", "\"[0-9]+$\"", ";", "if", "(", "_allowNegative", ...
Check if string is an either positive or negative integer. @param _str string to validate @param _allowNegative negative integer allowed @return true if integer, false otherwise
[ "Check", "if", "string", "is", "an", "either", "positive", "or", "negative", "integer", "." ]
train
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/TypeUtil.java#L113-L125
prestodb/presto
presto-accumulo/src/main/java/com/facebook/presto/accumulo/conf/AccumuloTableProperties.java
AccumuloTableProperties.getSerializerClass
public static String getSerializerClass(Map<String, Object> tableProperties) { requireNonNull(tableProperties); @SuppressWarnings("unchecked") String serializerClass = (String) tableProperties.get(SERIALIZER); return serializerClass; }
java
public static String getSerializerClass(Map<String, Object> tableProperties) { requireNonNull(tableProperties); @SuppressWarnings("unchecked") String serializerClass = (String) tableProperties.get(SERIALIZER); return serializerClass; }
[ "public", "static", "String", "getSerializerClass", "(", "Map", "<", "String", ",", "Object", ">", "tableProperties", ")", "{", "requireNonNull", "(", "tableProperties", ")", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "String", "serializerClass", "="...
Gets the {@link AccumuloRowSerializer} class name to use for this table @param tableProperties The map of table properties @return The name of the AccumuloRowSerializer class
[ "Gets", "the", "{", "@link", "AccumuloRowSerializer", "}", "class", "name", "to", "use", "for", "this", "table" ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-accumulo/src/main/java/com/facebook/presto/accumulo/conf/AccumuloTableProperties.java#L234-L241
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/PassThruTable.java
PassThruTable.addTable
public void addTable(Object objKey, BaseTable table) { if (m_mapTable == null) m_mapTable = new Hashtable<Object,BaseTable>(); if (objKey == null) objKey = new Integer(m_mapTable.size()); m_mapTable.put(objKey, table); }
java
public void addTable(Object objKey, BaseTable table) { if (m_mapTable == null) m_mapTable = new Hashtable<Object,BaseTable>(); if (objKey == null) objKey = new Integer(m_mapTable.size()); m_mapTable.put(objKey, table); }
[ "public", "void", "addTable", "(", "Object", "objKey", ",", "BaseTable", "table", ")", "{", "if", "(", "m_mapTable", "==", "null", ")", "m_mapTable", "=", "new", "Hashtable", "<", "Object", ",", "BaseTable", ">", "(", ")", ";", "if", "(", "objKey", "==...
Add this record's table to the list of tables to pass commands to. @param table The table to add.
[ "Add", "this", "record", "s", "table", "to", "the", "list", "of", "tables", "to", "pass", "commands", "to", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/PassThruTable.java#L506-L513
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bos/BosClient.java
BosClient.generatePresignedUrl
public URL generatePresignedUrl(String bucketName, String key, int expirationInSeconds, HttpMethodName method) { GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucketName, key, method); request.setExpiration(expirationInSeconds); return this.generatePresignedUrl(request); }
java
public URL generatePresignedUrl(String bucketName, String key, int expirationInSeconds, HttpMethodName method) { GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucketName, key, method); request.setExpiration(expirationInSeconds); return this.generatePresignedUrl(request); }
[ "public", "URL", "generatePresignedUrl", "(", "String", "bucketName", ",", "String", "key", ",", "int", "expirationInSeconds", ",", "HttpMethodName", "method", ")", "{", "GeneratePresignedUrlRequest", "request", "=", "new", "GeneratePresignedUrlRequest", "(", "bucketNam...
Returns a pre-signed URL for accessing a Bos resource. @param bucketName The name of the bucket containing the desired object. @param key The key in the specified bucket under which the desired object is stored. @param expirationInSeconds The expiration after which the returned pre-signed URL will expire. @param method The HTTP method verb to use for this URL @return A pre-signed URL which expires at the specified time, and can be used to allow anyone to download the specified object from Bos, without exposing the owner's Bce secret access key.
[ "Returns", "a", "pre", "-", "signed", "URL", "for", "accessing", "a", "Bos", "resource", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bos/BosClient.java#L474-L479
b3dgs/lionengine
lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/MouseClickAwt.java
MouseClickAwt.addActionReleased
void addActionReleased(int click, EventAction action) { final Integer key = Integer.valueOf(click); final List<EventAction> list; if (actionsReleased.get(key) == null) { list = new ArrayList<>(); actionsReleased.put(key, list); } else { list = actionsReleased.get(key); } list.add(action); }
java
void addActionReleased(int click, EventAction action) { final Integer key = Integer.valueOf(click); final List<EventAction> list; if (actionsReleased.get(key) == null) { list = new ArrayList<>(); actionsReleased.put(key, list); } else { list = actionsReleased.get(key); } list.add(action); }
[ "void", "addActionReleased", "(", "int", "click", ",", "EventAction", "action", ")", "{", "final", "Integer", "key", "=", "Integer", ".", "valueOf", "(", "click", ")", ";", "final", "List", "<", "EventAction", ">", "list", ";", "if", "(", "actionsReleased"...
Add a released action. @param click The action click. @param action The associated action.
[ "Add", "a", "released", "action", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/MouseClickAwt.java#L139-L153
google/closure-templates
java/src/com/google/template/soy/SoyFileSetParser.java
SoyFileSetParser.parseSoyFileHelper
private SoyFileNode parseSoyFileHelper(SoyFileSupplier soyFileSupplier, IdGenerator nodeIdGen) throws IOException { // See copious comments above on this test if (soyFileSupplier instanceof HasAstOrErrors) { return ((HasAstOrErrors) soyFileSupplier).getAst(nodeIdGen, errorReporter()); } else { try (Reader soyFileReader = soyFileSupplier.open()) { String filePath = soyFileSupplier.getFilePath(); int lastBangIndex = filePath.lastIndexOf('!'); if (lastBangIndex != -1) { // This is a resource in a JAR file. Only keep everything after the bang. filePath = filePath.substring(lastBangIndex + 1); } // Think carefully before adding new parameters to the parser. // Currently the only parameters are the id generator, the file, and the errorReporter. // This // ensures that the file be cached without worrying about other compiler inputs. return new SoyFileParser(nodeIdGen, soyFileReader, filePath, errorReporter()) .parseSoyFile(); } } }
java
private SoyFileNode parseSoyFileHelper(SoyFileSupplier soyFileSupplier, IdGenerator nodeIdGen) throws IOException { // See copious comments above on this test if (soyFileSupplier instanceof HasAstOrErrors) { return ((HasAstOrErrors) soyFileSupplier).getAst(nodeIdGen, errorReporter()); } else { try (Reader soyFileReader = soyFileSupplier.open()) { String filePath = soyFileSupplier.getFilePath(); int lastBangIndex = filePath.lastIndexOf('!'); if (lastBangIndex != -1) { // This is a resource in a JAR file. Only keep everything after the bang. filePath = filePath.substring(lastBangIndex + 1); } // Think carefully before adding new parameters to the parser. // Currently the only parameters are the id generator, the file, and the errorReporter. // This // ensures that the file be cached without worrying about other compiler inputs. return new SoyFileParser(nodeIdGen, soyFileReader, filePath, errorReporter()) .parseSoyFile(); } } }
[ "private", "SoyFileNode", "parseSoyFileHelper", "(", "SoyFileSupplier", "soyFileSupplier", ",", "IdGenerator", "nodeIdGen", ")", "throws", "IOException", "{", "// See copious comments above on this test", "if", "(", "soyFileSupplier", "instanceof", "HasAstOrErrors", ")", "{",...
Private helper for {@code parseWithVersions()} to parse one Soy file. @param soyFileSupplier Supplier of the Soy file content and path. @param nodeIdGen The generator of node ids. @return The resulting parse tree for one Soy file and the version from which it was parsed.
[ "Private", "helper", "for", "{", "@code", "parseWithVersions", "()", "}", "to", "parse", "one", "Soy", "file", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/SoyFileSetParser.java#L229-L250
brianwhu/xillium
data/src/main/java/org/xillium/data/validation/Reifier.java
Reifier.addTypeSet
public Reifier addTypeSet(Class<?> spec) { for (Field field: spec.getDeclaredFields()) { if (Modifier.isPublic(field.getModifiers())) { String name = field.getName(); try { _named.put(name, new Validator(name, field.getType(), field)); } catch (IllegalArgumentException x) { Trace.g.std.note(Reifier.class, "Ignored " + name + ": " + x.getMessage()); } } else { Trace.g.std.note(Reifier.class, "Ignored non-public field: " + field.getName()); } } return this; }
java
public Reifier addTypeSet(Class<?> spec) { for (Field field: spec.getDeclaredFields()) { if (Modifier.isPublic(field.getModifiers())) { String name = field.getName(); try { _named.put(name, new Validator(name, field.getType(), field)); } catch (IllegalArgumentException x) { Trace.g.std.note(Reifier.class, "Ignored " + name + ": " + x.getMessage()); } } else { Trace.g.std.note(Reifier.class, "Ignored non-public field: " + field.getName()); } } return this; }
[ "public", "Reifier", "addTypeSet", "(", "Class", "<", "?", ">", "spec", ")", "{", "for", "(", "Field", "field", ":", "spec", ".", "getDeclaredFields", "(", ")", ")", "{", "if", "(", "Modifier", ".", "isPublic", "(", "field", ".", "getModifiers", "(", ...
Adds a set of data type specifications. @param spec - a class that defines data types as member fields
[ "Adds", "a", "set", "of", "data", "type", "specifications", "." ]
train
https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/data/src/main/java/org/xillium/data/validation/Reifier.java#L35-L50
VoltDB/voltdb
src/frontend/org/voltdb/sysprocs/UpdateApplicationBase.java
UpdateApplicationBase.addDDLToCatalog
protected static InMemoryJarfile addDDLToCatalog(Catalog oldCatalog, InMemoryJarfile jarfile, String[] adhocDDLStmts, boolean isXDCR) throws IOException, VoltCompilerException { StringBuilder sb = new StringBuilder(); compilerLog.info("Applying the following DDL to cluster:"); for (String stmt : adhocDDLStmts) { compilerLog.info("\t" + stmt); sb.append(stmt); sb.append(";\n"); } String newDDL = sb.toString(); compilerLog.trace("Adhoc-modified DDL:\n" + newDDL); VoltCompiler compiler = new VoltCompiler(isXDCR); compiler.compileInMemoryJarfileWithNewDDL(jarfile, newDDL, oldCatalog); return jarfile; }
java
protected static InMemoryJarfile addDDLToCatalog(Catalog oldCatalog, InMemoryJarfile jarfile, String[] adhocDDLStmts, boolean isXDCR) throws IOException, VoltCompilerException { StringBuilder sb = new StringBuilder(); compilerLog.info("Applying the following DDL to cluster:"); for (String stmt : adhocDDLStmts) { compilerLog.info("\t" + stmt); sb.append(stmt); sb.append(";\n"); } String newDDL = sb.toString(); compilerLog.trace("Adhoc-modified DDL:\n" + newDDL); VoltCompiler compiler = new VoltCompiler(isXDCR); compiler.compileInMemoryJarfileWithNewDDL(jarfile, newDDL, oldCatalog); return jarfile; }
[ "protected", "static", "InMemoryJarfile", "addDDLToCatalog", "(", "Catalog", "oldCatalog", ",", "InMemoryJarfile", "jarfile", ",", "String", "[", "]", "adhocDDLStmts", ",", "boolean", "isXDCR", ")", "throws", "IOException", ",", "VoltCompilerException", "{", "StringBu...
Append the supplied adhoc DDL to the current catalog's DDL and recompile the jarfile @throws VoltCompilerException
[ "Append", "the", "supplied", "adhoc", "DDL", "to", "the", "current", "catalog", "s", "DDL", "and", "recompile", "the", "jarfile" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/sysprocs/UpdateApplicationBase.java#L312-L328
aws/aws-sdk-java
aws-java-sdk-medialive/src/main/java/com/amazonaws/services/medialive/model/Reservation.java
Reservation.withTags
public Reservation withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
java
public Reservation withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "Reservation", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
A collection of key-value pairs @param tags A collection of key-value pairs @return Returns a reference to this object so that method calls can be chained together.
[ "A", "collection", "of", "key", "-", "value", "pairs" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-medialive/src/main/java/com/amazonaws/services/medialive/model/Reservation.java#L690-L693
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/execution/utils/ResponderTask.java
ResponderTask.chainResponder
private ResponderTask chainResponder(final Responder responder, final ResultHandler resultHandler) { return new ResponderTask(responder, reader, outputStream, resultHandler, partialLineBuffer); }
java
private ResponderTask chainResponder(final Responder responder, final ResultHandler resultHandler) { return new ResponderTask(responder, reader, outputStream, resultHandler, partialLineBuffer); }
[ "private", "ResponderTask", "chainResponder", "(", "final", "Responder", "responder", ",", "final", "ResultHandler", "resultHandler", ")", "{", "return", "new", "ResponderTask", "(", "responder", ",", "reader", ",", "outputStream", ",", "resultHandler", ",", "partia...
Set up a chained ResponderTask, where the new instance will use the same input/output streams and buffers. However they must both be invoked individually, use {@link #createSequence(Responder, ResponderTask.ResultHandler)} to set up a sequential invocation of another responder.
[ "Set", "up", "a", "chained", "ResponderTask", "where", "the", "new", "instance", "will", "use", "the", "same", "input", "/", "output", "streams", "and", "buffers", ".", "However", "they", "must", "both", "be", "invoked", "individually", "use", "{" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/execution/utils/ResponderTask.java#L217-L219
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java
BasePanel.makeWindow
public static BasePanel makeWindow(App application) { FrameScreen frameScreen = new FrameScreen(null, null, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, null); AppletScreen appletScreen = new AppletScreen(null, frameScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, null); appletScreen.setupDefaultTask((Application)application); return appletScreen; }
java
public static BasePanel makeWindow(App application) { FrameScreen frameScreen = new FrameScreen(null, null, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, null); AppletScreen appletScreen = new AppletScreen(null, frameScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, null); appletScreen.setupDefaultTask((Application)application); return appletScreen; }
[ "public", "static", "BasePanel", "makeWindow", "(", "App", "application", ")", "{", "FrameScreen", "frameScreen", "=", "new", "FrameScreen", "(", "null", ",", "null", ",", "null", ",", "ScreenConstants", ".", "DONT_DISPLAY_FIELD_DESC", ",", "null", ")", ";", "...
Make a screen window to put a screen in. <br/>NOTE: This method returns the AppletScreen NOT the FrameScreen, because the AppletScreen is where you add your controls!
[ "Make", "a", "screen", "window", "to", "put", "a", "screen", "in", ".", "<br", "/", ">", "NOTE", ":", "This", "method", "returns", "the", "AppletScreen", "NOT", "the", "FrameScreen", "because", "the", "AppletScreen", "is", "where", "you", "add", "your", ...
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java#L706-L714
lucee/Lucee
core/src/main/java/lucee/runtime/converter/JSConverter.java
JSConverter._serializeMap
private String _serializeMap(String name, Map map, StringBuilder sb, Set<Object> done) throws ConverterException { if (useShortcuts) sb.append("{}"); else sb.append("new Object();"); Iterator it = map.keySet().iterator(); while (it.hasNext()) { Object key = it.next(); String skey = StringUtil.toLowerCase(StringUtil.escapeJS(key.toString(), '"')); sb.append(name + "[" + skey + "]="); _serialize(name + "[" + skey + "]", map.get(key), sb, done); // sb.append(";"); } return sb.toString(); }
java
private String _serializeMap(String name, Map map, StringBuilder sb, Set<Object> done) throws ConverterException { if (useShortcuts) sb.append("{}"); else sb.append("new Object();"); Iterator it = map.keySet().iterator(); while (it.hasNext()) { Object key = it.next(); String skey = StringUtil.toLowerCase(StringUtil.escapeJS(key.toString(), '"')); sb.append(name + "[" + skey + "]="); _serialize(name + "[" + skey + "]", map.get(key), sb, done); // sb.append(";"); } return sb.toString(); }
[ "private", "String", "_serializeMap", "(", "String", "name", ",", "Map", "map", ",", "StringBuilder", "sb", ",", "Set", "<", "Object", ">", "done", ")", "throws", "ConverterException", "{", "if", "(", "useShortcuts", ")", "sb", ".", "append", "(", "\"{}\""...
serialize a Map (as Struct) @param name @param map Map to serialize @param done @param sb2 @return serialized map @throws ConverterException
[ "serialize", "a", "Map", "(", "as", "Struct", ")" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/converter/JSConverter.java#L244-L257
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_voicemail_serviceName_migrateOnNewVersion_POST
public void billingAccount_voicemail_serviceName_migrateOnNewVersion_POST(String billingAccount, String serviceName) throws IOException { String qPath = "/telephony/{billingAccount}/voicemail/{serviceName}/migrateOnNewVersion"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "POST", sb.toString(), null); }
java
public void billingAccount_voicemail_serviceName_migrateOnNewVersion_POST(String billingAccount, String serviceName) throws IOException { String qPath = "/telephony/{billingAccount}/voicemail/{serviceName}/migrateOnNewVersion"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "POST", sb.toString(), null); }
[ "public", "void", "billingAccount_voicemail_serviceName_migrateOnNewVersion_POST", "(", "String", "billingAccount", ",", "String", "serviceName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/voicemail/{serviceName}/migrateOnNewVersion\"", ...
Change the voicemail on a new version to manager greetings, directories and extra settings. REST: POST /telephony/{billingAccount}/voicemail/{serviceName}/migrateOnNewVersion @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Change", "the", "voicemail", "on", "a", "new", "version", "to", "manager", "greetings", "directories", "and", "extra", "settings", "." ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L7878-L7882
Abnaxos/markdown-doclet
doclet/jdk8/src/main/java/ch/raffael/mddoclet/mdtaglet/argval/PredefinedArgumentValidators.java
PredefinedArgumentValidators.allOf
public static ArgumentValidator allOf(String description, ArgumentValidator... argumentValidators) { return new AllOf(Arrays.asList(argumentValidators), description); }
java
public static ArgumentValidator allOf(String description, ArgumentValidator... argumentValidators) { return new AllOf(Arrays.asList(argumentValidators), description); }
[ "public", "static", "ArgumentValidator", "allOf", "(", "String", "description", ",", "ArgumentValidator", "...", "argumentValidators", ")", "{", "return", "new", "AllOf", "(", "Arrays", ".", "asList", "(", "argumentValidators", ")", ",", "description", ")", ";", ...
# Creates a {@link ArgumentValidator} which iterates over all `argumentValidators` until the first NOT {@link Type#VALID} has been found. This is of course a logical AND. - If all are `VALID` then the result is also `VALID`. - If at least one is *NOT VALID*, the first will be the result of the entire expression, but the error message will be replaced with `description` @param argumentValidators 1 or more argument validators @param description any description @return a AllOf validator
[ "#", "Creates", "a", "{", "@link", "ArgumentValidator", "}", "which", "iterates", "over", "all", "argumentValidators", "until", "the", "first", "NOT", "{", "@link", "Type#VALID", "}", "has", "been", "found", "." ]
train
https://github.com/Abnaxos/markdown-doclet/blob/e98a9630206fc9c8d813cf2349ff594be8630054/doclet/jdk8/src/main/java/ch/raffael/mddoclet/mdtaglet/argval/PredefinedArgumentValidators.java#L252-L254
medallia/Word2VecJava
src/main/java/com/medallia/word2vec/util/Common.java
Common.getResourceAsStream
public static InputStream getResourceAsStream(Class<?> clazz, String fn) throws IOException { InputStream stream = clazz.getResourceAsStream(fn); if (stream == null) { throw new IOException("resource \"" + fn + "\" relative to " + clazz + " not found."); } return unpackStream(stream, fn); }
java
public static InputStream getResourceAsStream(Class<?> clazz, String fn) throws IOException { InputStream stream = clazz.getResourceAsStream(fn); if (stream == null) { throw new IOException("resource \"" + fn + "\" relative to " + clazz + " not found."); } return unpackStream(stream, fn); }
[ "public", "static", "InputStream", "getResourceAsStream", "(", "Class", "<", "?", ">", "clazz", ",", "String", "fn", ")", "throws", "IOException", "{", "InputStream", "stream", "=", "clazz", ".", "getResourceAsStream", "(", "fn", ")", ";", "if", "(", "stream...
Get an input stream to read the raw contents of the given resource, remember to close it :)
[ "Get", "an", "input", "stream", "to", "read", "the", "raw", "contents", "of", "the", "given", "resource", "remember", "to", "close", "it", ":", ")" ]
train
https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/util/Common.java#L103-L109
nguillaumin/slick2d-maven
slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/GradientEditor.java
GradientEditor.selectPoint
private void selectPoint(int mx, int my) { if (!isEnabled()) { return; } for (int i=1;i<list.size()-1;i++) { if (checkPoint(mx,my,(ControlPoint) list.get(i))) { selected = (ControlPoint) list.get(i); return; } } if (checkPoint(mx,my,(ControlPoint) list.get(0))) { selected = (ControlPoint) list.get(0); return; } if (checkPoint(mx,my,(ControlPoint) list.get(list.size()-1))) { selected = (ControlPoint) list.get(list.size()-1); return; } selected = null; }
java
private void selectPoint(int mx, int my) { if (!isEnabled()) { return; } for (int i=1;i<list.size()-1;i++) { if (checkPoint(mx,my,(ControlPoint) list.get(i))) { selected = (ControlPoint) list.get(i); return; } } if (checkPoint(mx,my,(ControlPoint) list.get(0))) { selected = (ControlPoint) list.get(0); return; } if (checkPoint(mx,my,(ControlPoint) list.get(list.size()-1))) { selected = (ControlPoint) list.get(list.size()-1); return; } selected = null; }
[ "private", "void", "selectPoint", "(", "int", "mx", ",", "int", "my", ")", "{", "if", "(", "!", "isEnabled", "(", ")", ")", "{", "return", ";", "}", "for", "(", "int", "i", "=", "1", ";", "i", "<", "list", ".", "size", "(", ")", "-", "1", "...
Select the control point at the specified mouse coordinate @param mx The mouse x coordinate @param my The mouse y coordinate
[ "Select", "the", "control", "point", "at", "the", "specified", "mouse", "coordinate" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/GradientEditor.java#L241-L262