repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
alkacon/opencms-core
src/org/opencms/ui/components/CmsResourceIcon.java
CmsResourceIcon.getIconInnerHTML
private static String getIconInnerHTML( CmsResourceUtil resUtil, CmsResourceState state, boolean showLocks, boolean showDetailIcon) { """ Returns the icon inner HTML.<p> @param resUtil the resource util for the resource @param state the resource state @param showLocks <code>true</code> to show lock state overlay @param showDetailIcon <code>true</code> to show the detail icon overlay @return the icon inner HTML """ Resource iconResource = resUtil.getBigIconResource(); return getIconInnerHTML(resUtil, iconResource, state, showLocks, showDetailIcon); }
java
private static String getIconInnerHTML( CmsResourceUtil resUtil, CmsResourceState state, boolean showLocks, boolean showDetailIcon) { Resource iconResource = resUtil.getBigIconResource(); return getIconInnerHTML(resUtil, iconResource, state, showLocks, showDetailIcon); }
[ "private", "static", "String", "getIconInnerHTML", "(", "CmsResourceUtil", "resUtil", ",", "CmsResourceState", "state", ",", "boolean", "showLocks", ",", "boolean", "showDetailIcon", ")", "{", "Resource", "iconResource", "=", "resUtil", ".", "getBigIconResource", "(", ")", ";", "return", "getIconInnerHTML", "(", "resUtil", ",", "iconResource", ",", "state", ",", "showLocks", ",", "showDetailIcon", ")", ";", "}" ]
Returns the icon inner HTML.<p> @param resUtil the resource util for the resource @param state the resource state @param showLocks <code>true</code> to show lock state overlay @param showDetailIcon <code>true</code> to show the detail icon overlay @return the icon inner HTML
[ "Returns", "the", "icon", "inner", "HTML", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/CmsResourceIcon.java#L302-L311
emilsjolander/sprinkles
library/src/main/java/se/emilsjolander/sprinkles/ManyQuery.java
ManyQuery.getAsync
public int getAsync(android.support.v4.app.LoaderManager lm, ResultHandler<T> handler, Class<? extends Model>... respondsToUpdatedOf) { """ Execute the query asynchronously @param lm The loader manager to use for loading the data @param handler The ResultHandler to notify of the query result and any updates to that result. @param respondsToUpdatedOf A list of models excluding the queried model that should also trigger a update to the result if they change. @return the id of the loader. """ if (Model.class.isAssignableFrom(resultClass)) { respondsToUpdatedOf = Utils.concatArrays(respondsToUpdatedOf, new Class[]{resultClass}); } final int loaderId = placeholderQuery.hashCode(); lm.restartLoader(loaderId, null, getSupportLoaderCallbacks(rawQuery, resultClass, handler, respondsToUpdatedOf)); return loaderId; }
java
public int getAsync(android.support.v4.app.LoaderManager lm, ResultHandler<T> handler, Class<? extends Model>... respondsToUpdatedOf) { if (Model.class.isAssignableFrom(resultClass)) { respondsToUpdatedOf = Utils.concatArrays(respondsToUpdatedOf, new Class[]{resultClass}); } final int loaderId = placeholderQuery.hashCode(); lm.restartLoader(loaderId, null, getSupportLoaderCallbacks(rawQuery, resultClass, handler, respondsToUpdatedOf)); return loaderId; }
[ "public", "int", "getAsync", "(", "android", ".", "support", ".", "v4", ".", "app", ".", "LoaderManager", "lm", ",", "ResultHandler", "<", "T", ">", "handler", ",", "Class", "<", "?", "extends", "Model", ">", "...", "respondsToUpdatedOf", ")", "{", "if", "(", "Model", ".", "class", ".", "isAssignableFrom", "(", "resultClass", ")", ")", "{", "respondsToUpdatedOf", "=", "Utils", ".", "concatArrays", "(", "respondsToUpdatedOf", ",", "new", "Class", "[", "]", "{", "resultClass", "}", ")", ";", "}", "final", "int", "loaderId", "=", "placeholderQuery", ".", "hashCode", "(", ")", ";", "lm", ".", "restartLoader", "(", "loaderId", ",", "null", ",", "getSupportLoaderCallbacks", "(", "rawQuery", ",", "resultClass", ",", "handler", ",", "respondsToUpdatedOf", ")", ")", ";", "return", "loaderId", ";", "}" ]
Execute the query asynchronously @param lm The loader manager to use for loading the data @param handler The ResultHandler to notify of the query result and any updates to that result. @param respondsToUpdatedOf A list of models excluding the queried model that should also trigger a update to the result if they change. @return the id of the loader.
[ "Execute", "the", "query", "asynchronously" ]
train
https://github.com/emilsjolander/sprinkles/blob/3a666f18ee5158db6fe3b4f4346b470481559606/library/src/main/java/se/emilsjolander/sprinkles/ManyQuery.java#L94-L101
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java
ExpressionUtils.eq
public static <D> Predicate eq(Expression<D> left, Expression<? extends D> right) { """ Create a {@code left == right} expression @param <D> type of expressions @param left lhs of expression @param right rhs of expression @return left == right """ return predicate(Ops.EQ, left, right); }
java
public static <D> Predicate eq(Expression<D> left, Expression<? extends D> right) { return predicate(Ops.EQ, left, right); }
[ "public", "static", "<", "D", ">", "Predicate", "eq", "(", "Expression", "<", "D", ">", "left", ",", "Expression", "<", "?", "extends", "D", ">", "right", ")", "{", "return", "predicate", "(", "Ops", ".", "EQ", ",", "left", ",", "right", ")", ";", "}" ]
Create a {@code left == right} expression @param <D> type of expressions @param left lhs of expression @param right rhs of expression @return left == right
[ "Create", "a", "{", "@code", "left", "==", "right", "}", "expression" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java#L481-L483
Azure/azure-sdk-for-java
redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java
RedisInner.beginImportData
public void beginImportData(String resourceGroupName, String name, ImportRDBParameters parameters) { """ Import data into Redis cache. @param resourceGroupName The name of the resource group. @param name The name of the Redis cache. @param parameters Parameters for Redis import operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent """ beginImportDataWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().single().body(); }
java
public void beginImportData(String resourceGroupName, String name, ImportRDBParameters parameters) { beginImportDataWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().single().body(); }
[ "public", "void", "beginImportData", "(", "String", "resourceGroupName", ",", "String", "name", ",", "ImportRDBParameters", "parameters", ")", "{", "beginImportDataWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Import data into Redis cache. @param resourceGroupName The name of the resource group. @param name The name of the Redis cache. @param parameters Parameters for Redis import operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Import", "data", "into", "Redis", "cache", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java#L1413-L1415
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Validator.java
Validator.validateNotEmpty
public static <T> T validateNotEmpty(T value, String errorMsg) throws ValidateException { """ 验证是否为非空,为空时抛出异常<br> 对于String类型判定是否为empty(null 或 "")<br> @param value 值 @param errorMsg 验证错误的信息 @return 验证后的值,验证通过返回此值,非空值 @throws ValidateException 验证异常 """ if (isEmpty(value)) { throw new ValidateException(errorMsg); } return value; }
java
public static <T> T validateNotEmpty(T value, String errorMsg) throws ValidateException { if (isEmpty(value)) { throw new ValidateException(errorMsg); } return value; }
[ "public", "static", "<", "T", ">", "T", "validateNotEmpty", "(", "T", "value", ",", "String", "errorMsg", ")", "throws", "ValidateException", "{", "if", "(", "isEmpty", "(", "value", ")", ")", "{", "throw", "new", "ValidateException", "(", "errorMsg", ")", ";", "}", "return", "value", ";", "}" ]
验证是否为非空,为空时抛出异常<br> 对于String类型判定是否为empty(null 或 "")<br> @param value 值 @param errorMsg 验证错误的信息 @return 验证后的值,验证通过返回此值,非空值 @throws ValidateException 验证异常
[ "验证是否为非空,为空时抛出异常<br", ">", "对于String类型判定是否为empty", "(", "null", "或", ")", "<br", ">" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L220-L225
sriharshachilakapati/WebGL4J
webgl4j/src/main/java/com/shc/webgl4j/client/WebGL10.java
WebGL10.glBindTexture
public static void glBindTexture(int target, int textureID) { """ <p>{@code glBindTexture} lets you create or use a named texture. Calling {@code glBindTexture} with target set to {@link #GL_TEXTURE_2D}, {@link #GL_TEXTURE_CUBE_MAP}, and texture set to the name of the new texture binds the texture name to the target. When a texture is bound to a target, the previous binding for that target is automatically broken.</p> <p>{@link #GL_INVALID_ENUM} is generated if target is not one of the allowable values.</p> <p>{@link #GL_INVALID_VALUE} is generated if target is not a name returned from a previous call to {@link #glCreateTexture()}.</p> <p>{@link #GL_INVALID_OPERATION} is generated if texture was previously created with a {@code target} that doesn't match that of {@code target}.</p> @param target Specifies the target to which the texture is bound. Must be either {@link #GL_TEXTURE_2D} or {@link #GL_TEXTURE_CUBE_MAP}. @param textureID Specifies the name of a texture. """ checkContextCompatibility(); nglBindTexture(target, WebGLObjectMap.get().toTexture(textureID)); }
java
public static void glBindTexture(int target, int textureID) { checkContextCompatibility(); nglBindTexture(target, WebGLObjectMap.get().toTexture(textureID)); }
[ "public", "static", "void", "glBindTexture", "(", "int", "target", ",", "int", "textureID", ")", "{", "checkContextCompatibility", "(", ")", ";", "nglBindTexture", "(", "target", ",", "WebGLObjectMap", ".", "get", "(", ")", ".", "toTexture", "(", "textureID", ")", ")", ";", "}" ]
<p>{@code glBindTexture} lets you create or use a named texture. Calling {@code glBindTexture} with target set to {@link #GL_TEXTURE_2D}, {@link #GL_TEXTURE_CUBE_MAP}, and texture set to the name of the new texture binds the texture name to the target. When a texture is bound to a target, the previous binding for that target is automatically broken.</p> <p>{@link #GL_INVALID_ENUM} is generated if target is not one of the allowable values.</p> <p>{@link #GL_INVALID_VALUE} is generated if target is not a name returned from a previous call to {@link #glCreateTexture()}.</p> <p>{@link #GL_INVALID_OPERATION} is generated if texture was previously created with a {@code target} that doesn't match that of {@code target}.</p> @param target Specifies the target to which the texture is bound. Must be either {@link #GL_TEXTURE_2D} or {@link #GL_TEXTURE_CUBE_MAP}. @param textureID Specifies the name of a texture.
[ "<p", ">", "{", "@code", "glBindTexture", "}", "lets", "you", "create", "or", "use", "a", "named", "texture", ".", "Calling", "{", "@code", "glBindTexture", "}", "with", "target", "set", "to", "{", "@link", "#GL_TEXTURE_2D", "}", "{", "@link", "#GL_TEXTURE_CUBE_MAP", "}", "and", "texture", "set", "to", "the", "name", "of", "the", "new", "texture", "binds", "the", "texture", "name", "to", "the", "target", ".", "When", "a", "texture", "is", "bound", "to", "a", "target", "the", "previous", "binding", "for", "that", "target", "is", "automatically", "broken", ".", "<", "/", "p", ">" ]
train
https://github.com/sriharshachilakapati/WebGL4J/blob/7daa425300b08b338b50cef2935289849c92d415/webgl4j/src/main/java/com/shc/webgl4j/client/WebGL10.java#L642-L646
cqframework/clinical_quality_language
Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java
ElmBaseVisitor.visitTupleElementDefinition
public T visitTupleElementDefinition(TupleElementDefinition elm, C context) { """ Visit a TupleElementDefinition. This method will be called for every node in the tree that is a TupleElementDefinition. @param elm the ELM tree @param context the context passed to the visitor @return the visitor result """ visitElement(elm.getType(), context); return null; }
java
public T visitTupleElementDefinition(TupleElementDefinition elm, C context) { visitElement(elm.getType(), context); return null; }
[ "public", "T", "visitTupleElementDefinition", "(", "TupleElementDefinition", "elm", ",", "C", "context", ")", "{", "visitElement", "(", "elm", ".", "getType", "(", ")", ",", "context", ")", ";", "return", "null", ";", "}" ]
Visit a TupleElementDefinition. This method will be called for every node in the tree that is a TupleElementDefinition. @param elm the ELM tree @param context the context passed to the visitor @return the visitor result
[ "Visit", "a", "TupleElementDefinition", ".", "This", "method", "will", "be", "called", "for", "every", "node", "in", "the", "tree", "that", "is", "a", "TupleElementDefinition", "." ]
train
https://github.com/cqframework/clinical_quality_language/blob/67459d1ef453e49db8d7c5c86e87278377ed0a0b/Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java#L97-L100
baratine/baratine
kraken/src/main/java/com/caucho/v5/kraken/query/WatchQuery.java
WatchQuery.watch
@Override public void watch(DatabaseWatch watch, Result<Cancel> result, Object... args) { """ /* @Override public int partitionHash(Object[] args) { if (_keyExpr == null) { return -1; } return _keyExpr.partitionHash(args); } """ TableKelp tableKelp = _table.getTableKelp(); RowCursor minCursor = tableKelp.cursor(); RowCursor maxCursor = tableKelp.cursor(); minCursor.clear(); maxCursor.setKeyMax(); _whereKraken.fillMinCursor(minCursor, args); _whereKraken.fillMaxCursor(minCursor, args); //QueryKelp whereKelp = _whereExpr.bind(args); // XXX: binding should be with unique //EnvKelp whereKelp = new EnvKelp(_whereKelp, args); //tableKelp.findOne(minCursor, maxCursor, whereKelp, // new FindDeleteResult(result)); _table.addWatch(watch, minCursor.getKey(), result); // result.completed(null); }
java
@Override public void watch(DatabaseWatch watch, Result<Cancel> result, Object... args) { TableKelp tableKelp = _table.getTableKelp(); RowCursor minCursor = tableKelp.cursor(); RowCursor maxCursor = tableKelp.cursor(); minCursor.clear(); maxCursor.setKeyMax(); _whereKraken.fillMinCursor(minCursor, args); _whereKraken.fillMaxCursor(minCursor, args); //QueryKelp whereKelp = _whereExpr.bind(args); // XXX: binding should be with unique //EnvKelp whereKelp = new EnvKelp(_whereKelp, args); //tableKelp.findOne(minCursor, maxCursor, whereKelp, // new FindDeleteResult(result)); _table.addWatch(watch, minCursor.getKey(), result); // result.completed(null); }
[ "@", "Override", "public", "void", "watch", "(", "DatabaseWatch", "watch", ",", "Result", "<", "Cancel", ">", "result", ",", "Object", "...", "args", ")", "{", "TableKelp", "tableKelp", "=", "_table", ".", "getTableKelp", "(", ")", ";", "RowCursor", "minCursor", "=", "tableKelp", ".", "cursor", "(", ")", ";", "RowCursor", "maxCursor", "=", "tableKelp", ".", "cursor", "(", ")", ";", "minCursor", ".", "clear", "(", ")", ";", "maxCursor", ".", "setKeyMax", "(", ")", ";", "_whereKraken", ".", "fillMinCursor", "(", "minCursor", ",", "args", ")", ";", "_whereKraken", ".", "fillMaxCursor", "(", "minCursor", ",", "args", ")", ";", "//QueryKelp whereKelp = _whereExpr.bind(args);", "// XXX: binding should be with unique", "//EnvKelp whereKelp = new EnvKelp(_whereKelp, args);", "//tableKelp.findOne(minCursor, maxCursor, whereKelp,", "// new FindDeleteResult(result));", "_table", ".", "addWatch", "(", "watch", ",", "minCursor", ".", "getKey", "(", ")", ",", "result", ")", ";", "// result.completed(null);", "}" ]
/* @Override public int partitionHash(Object[] args) { if (_keyExpr == null) { return -1; } return _keyExpr.partitionHash(args); }
[ "/", "*", "@Override", "public", "int", "partitionHash", "(", "Object", "[]", "args", ")", "{", "if", "(", "_keyExpr", "==", "null", ")", "{", "return", "-", "1", ";", "}" ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kraken/query/WatchQuery.java#L89-L115
jcustenborder/connect-utils
connect-utils/src/main/java/com/github/jcustenborder/kafka/connect/utils/config/validators/Validators.java
Validators.validSSLContext
public static Validator validSSLContext() { """ Validator is used to ensure that the TrustManagerFactory Algorithm specified is valid. @return """ return (s, o) -> { if (!(o instanceof String)) { throw new ConfigException(s, o, "Must be a string."); } String keyStoreType = o.toString(); try { SSLContext.getInstance(keyStoreType); } catch (NoSuchAlgorithmException e) { ConfigException exception = new ConfigException(s, o, "Invalid Algorithm"); exception.initCause(e); throw exception; } }; }
java
public static Validator validSSLContext() { return (s, o) -> { if (!(o instanceof String)) { throw new ConfigException(s, o, "Must be a string."); } String keyStoreType = o.toString(); try { SSLContext.getInstance(keyStoreType); } catch (NoSuchAlgorithmException e) { ConfigException exception = new ConfigException(s, o, "Invalid Algorithm"); exception.initCause(e); throw exception; } }; }
[ "public", "static", "Validator", "validSSLContext", "(", ")", "{", "return", "(", "s", ",", "o", ")", "->", "{", "if", "(", "!", "(", "o", "instanceof", "String", ")", ")", "{", "throw", "new", "ConfigException", "(", "s", ",", "o", ",", "\"Must be a string.\"", ")", ";", "}", "String", "keyStoreType", "=", "o", ".", "toString", "(", ")", ";", "try", "{", "SSLContext", ".", "getInstance", "(", "keyStoreType", ")", ";", "}", "catch", "(", "NoSuchAlgorithmException", "e", ")", "{", "ConfigException", "exception", "=", "new", "ConfigException", "(", "s", ",", "o", ",", "\"Invalid Algorithm\"", ")", ";", "exception", ".", "initCause", "(", "e", ")", ";", "throw", "exception", ";", "}", "}", ";", "}" ]
Validator is used to ensure that the TrustManagerFactory Algorithm specified is valid. @return
[ "Validator", "is", "used", "to", "ensure", "that", "the", "TrustManagerFactory", "Algorithm", "specified", "is", "valid", "." ]
train
https://github.com/jcustenborder/connect-utils/blob/19add138921f59ffcc85282d7aad551eeb582370/connect-utils/src/main/java/com/github/jcustenborder/kafka/connect/utils/config/validators/Validators.java#L253-L268
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapComposedElement.java
MapComposedElement.containsPoint
@Pure public boolean containsPoint(Point2D<?, ?> point, int groupIndex) { """ Check if point p is contained in this coordinates collections. @param point the point to compare with this coordinates @param groupIndex into look for @return true if p is already part of coordinates """ final int grpCount = getGroupCount(); if (groupIndex < 0) { throw new IndexOutOfBoundsException(groupIndex + "<0"); //$NON-NLS-1$ } if (groupIndex > grpCount) { throw new IndexOutOfBoundsException(groupIndex + ">" + grpCount); //$NON-NLS-1$ } if (point == null) { return false; } for (int i = 0; i < getPointCountInGroup(groupIndex); ++i) { final Point2d cur = getPointAt(groupIndex, i); if (cur.epsilonEquals(point, MapElementConstants.POINT_FUSION_DISTANCE)) { return true; } } return false; }
java
@Pure public boolean containsPoint(Point2D<?, ?> point, int groupIndex) { final int grpCount = getGroupCount(); if (groupIndex < 0) { throw new IndexOutOfBoundsException(groupIndex + "<0"); //$NON-NLS-1$ } if (groupIndex > grpCount) { throw new IndexOutOfBoundsException(groupIndex + ">" + grpCount); //$NON-NLS-1$ } if (point == null) { return false; } for (int i = 0; i < getPointCountInGroup(groupIndex); ++i) { final Point2d cur = getPointAt(groupIndex, i); if (cur.epsilonEquals(point, MapElementConstants.POINT_FUSION_DISTANCE)) { return true; } } return false; }
[ "@", "Pure", "public", "boolean", "containsPoint", "(", "Point2D", "<", "?", ",", "?", ">", "point", ",", "int", "groupIndex", ")", "{", "final", "int", "grpCount", "=", "getGroupCount", "(", ")", ";", "if", "(", "groupIndex", "<", "0", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "groupIndex", "+", "\"<0\"", ")", ";", "//$NON-NLS-1$", "}", "if", "(", "groupIndex", ">", "grpCount", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "groupIndex", "+", "\">\"", "+", "grpCount", ")", ";", "//$NON-NLS-1$", "}", "if", "(", "point", "==", "null", ")", "{", "return", "false", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "getPointCountInGroup", "(", "groupIndex", ")", ";", "++", "i", ")", "{", "final", "Point2d", "cur", "=", "getPointAt", "(", "groupIndex", ",", "i", ")", ";", "if", "(", "cur", ".", "epsilonEquals", "(", "point", ",", "MapElementConstants", ".", "POINT_FUSION_DISTANCE", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Check if point p is contained in this coordinates collections. @param point the point to compare with this coordinates @param groupIndex into look for @return true if p is already part of coordinates
[ "Check", "if", "point", "p", "is", "contained", "in", "this", "coordinates", "collections", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapComposedElement.java#L295-L315
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/MbeanImplCodeGen.java
MbeanImplCodeGen.writeImport
@Override public void writeImport(Definition def, Writer out) throws IOException { """ Output class import @param def definition @param out Writer @throws IOException ioException """ out.write("package " + def.getRaPackage() + ".mbean;\n\n"); out.write("import javax.management.MBeanServer;\n"); out.write("import javax.management.ObjectName;\n"); out.write("import javax.naming.InitialContext;\n\n"); out.write("import " + def.getRaPackage() + "." + def.getMcfDefs().get(0).getConnInterfaceClass() + ";\n"); out.write("import " + def.getRaPackage() + "." + def.getMcfDefs().get(0).getCfInterfaceClass() + ";\n\n"); }
java
@Override public void writeImport(Definition def, Writer out) throws IOException { out.write("package " + def.getRaPackage() + ".mbean;\n\n"); out.write("import javax.management.MBeanServer;\n"); out.write("import javax.management.ObjectName;\n"); out.write("import javax.naming.InitialContext;\n\n"); out.write("import " + def.getRaPackage() + "." + def.getMcfDefs().get(0).getConnInterfaceClass() + ";\n"); out.write("import " + def.getRaPackage() + "." + def.getMcfDefs().get(0).getCfInterfaceClass() + ";\n\n"); }
[ "@", "Override", "public", "void", "writeImport", "(", "Definition", "def", ",", "Writer", "out", ")", "throws", "IOException", "{", "out", ".", "write", "(", "\"package \"", "+", "def", ".", "getRaPackage", "(", ")", "+", "\".mbean;\\n\\n\"", ")", ";", "out", ".", "write", "(", "\"import javax.management.MBeanServer;\\n\"", ")", ";", "out", ".", "write", "(", "\"import javax.management.ObjectName;\\n\"", ")", ";", "out", ".", "write", "(", "\"import javax.naming.InitialContext;\\n\\n\"", ")", ";", "out", ".", "write", "(", "\"import \"", "+", "def", ".", "getRaPackage", "(", ")", "+", "\".\"", "+", "def", ".", "getMcfDefs", "(", ")", ".", "get", "(", "0", ")", ".", "getConnInterfaceClass", "(", ")", "+", "\";\\n\"", ")", ";", "out", ".", "write", "(", "\"import \"", "+", "def", ".", "getRaPackage", "(", ")", "+", "\".\"", "+", "def", ".", "getMcfDefs", "(", ")", ".", "get", "(", "0", ")", ".", "getCfInterfaceClass", "(", ")", "+", "\";\\n\\n\"", ")", ";", "}" ]
Output class import @param def definition @param out Writer @throws IOException ioException
[ "Output", "class", "import" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/MbeanImplCodeGen.java#L92-L102
alkacon/opencms-core
src/org/opencms/util/CmsFileUtil.java
CmsFileUtil.readFully
public static byte[] readFully(InputStream in, boolean closeInputStream) throws IOException { """ Reads all bytes from the given input stream, conditionally closes the given input stream and returns the result in an array.<p> @param in the input stream to read the bytes from @return the byte content of the input stream @param closeInputStream if true the given stream will be closed afterwards @throws IOException in case of errors in the underlying java.io methods used """ if (in instanceof ByteArrayInputStream) { // content can be read in one pass return readFully(in, in.available(), closeInputStream); } // copy buffer byte[] xfer = new byte[2048]; // output buffer ByteArrayOutputStream out = new ByteArrayOutputStream(xfer.length); // transfer data from input to output in xfer-sized chunks. for (int bytesRead = in.read(xfer, 0, xfer.length); bytesRead >= 0; bytesRead = in.read(xfer, 0, xfer.length)) { if (bytesRead > 0) { out.write(xfer, 0, bytesRead); } } if (closeInputStream) { in.close(); } out.close(); return out.toByteArray(); }
java
public static byte[] readFully(InputStream in, boolean closeInputStream) throws IOException { if (in instanceof ByteArrayInputStream) { // content can be read in one pass return readFully(in, in.available(), closeInputStream); } // copy buffer byte[] xfer = new byte[2048]; // output buffer ByteArrayOutputStream out = new ByteArrayOutputStream(xfer.length); // transfer data from input to output in xfer-sized chunks. for (int bytesRead = in.read(xfer, 0, xfer.length); bytesRead >= 0; bytesRead = in.read(xfer, 0, xfer.length)) { if (bytesRead > 0) { out.write(xfer, 0, bytesRead); } } if (closeInputStream) { in.close(); } out.close(); return out.toByteArray(); }
[ "public", "static", "byte", "[", "]", "readFully", "(", "InputStream", "in", ",", "boolean", "closeInputStream", ")", "throws", "IOException", "{", "if", "(", "in", "instanceof", "ByteArrayInputStream", ")", "{", "// content can be read in one pass", "return", "readFully", "(", "in", ",", "in", ".", "available", "(", ")", ",", "closeInputStream", ")", ";", "}", "// copy buffer", "byte", "[", "]", "xfer", "=", "new", "byte", "[", "2048", "]", ";", "// output buffer", "ByteArrayOutputStream", "out", "=", "new", "ByteArrayOutputStream", "(", "xfer", ".", "length", ")", ";", "// transfer data from input to output in xfer-sized chunks.", "for", "(", "int", "bytesRead", "=", "in", ".", "read", "(", "xfer", ",", "0", ",", "xfer", ".", "length", ")", ";", "bytesRead", ">=", "0", ";", "bytesRead", "=", "in", ".", "read", "(", "xfer", ",", "0", ",", "xfer", ".", "length", ")", ")", "{", "if", "(", "bytesRead", ">", "0", ")", "{", "out", ".", "write", "(", "xfer", ",", "0", ",", "bytesRead", ")", ";", "}", "}", "if", "(", "closeInputStream", ")", "{", "in", ".", "close", "(", ")", ";", "}", "out", ".", "close", "(", ")", ";", "return", "out", ".", "toByteArray", "(", ")", ";", "}" ]
Reads all bytes from the given input stream, conditionally closes the given input stream and returns the result in an array.<p> @param in the input stream to read the bytes from @return the byte content of the input stream @param closeInputStream if true the given stream will be closed afterwards @throws IOException in case of errors in the underlying java.io methods used
[ "Reads", "all", "bytes", "from", "the", "given", "input", "stream", "conditionally", "closes", "the", "given", "input", "stream", "and", "returns", "the", "result", "in", "an", "array", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsFileUtil.java#L657-L680
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java
Widget.findChildByNameInAllGroups
private static Widget findChildByNameInAllGroups(final String name, List<Widget> groups) { """ Performs a breadth-first search of the {@link GroupWidget GroupWidgets} in {@code groups} for a {@link Widget} with the specified {@link Widget#getName() name}. @param name The name of the {@code Widget} to find. @param groups The {@code GroupWidgets} to search. @return The first {@code Widget} with the specified name or {@code null} if no child of {@code groups} has that name. """ if (groups.isEmpty()) { return null; } ArrayList<Widget> groupChildren = new ArrayList<>(); Widget result; for (Widget group : groups) { // Search the immediate children of 'groups' for a match, rathering // the children that are GroupWidgets themselves. result = findChildByNameInOneGroup(name, group, groupChildren); if (result != null) { return result; } } // No match; Search the children that are GroupWidgets. return findChildByNameInAllGroups(name, groupChildren); }
java
private static Widget findChildByNameInAllGroups(final String name, List<Widget> groups) { if (groups.isEmpty()) { return null; } ArrayList<Widget> groupChildren = new ArrayList<>(); Widget result; for (Widget group : groups) { // Search the immediate children of 'groups' for a match, rathering // the children that are GroupWidgets themselves. result = findChildByNameInOneGroup(name, group, groupChildren); if (result != null) { return result; } } // No match; Search the children that are GroupWidgets. return findChildByNameInAllGroups(name, groupChildren); }
[ "private", "static", "Widget", "findChildByNameInAllGroups", "(", "final", "String", "name", ",", "List", "<", "Widget", ">", "groups", ")", "{", "if", "(", "groups", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "ArrayList", "<", "Widget", ">", "groupChildren", "=", "new", "ArrayList", "<>", "(", ")", ";", "Widget", "result", ";", "for", "(", "Widget", "group", ":", "groups", ")", "{", "// Search the immediate children of 'groups' for a match, rathering", "// the children that are GroupWidgets themselves.", "result", "=", "findChildByNameInOneGroup", "(", "name", ",", "group", ",", "groupChildren", ")", ";", "if", "(", "result", "!=", "null", ")", "{", "return", "result", ";", "}", "}", "// No match; Search the children that are GroupWidgets.", "return", "findChildByNameInAllGroups", "(", "name", ",", "groupChildren", ")", ";", "}" ]
Performs a breadth-first search of the {@link GroupWidget GroupWidgets} in {@code groups} for a {@link Widget} with the specified {@link Widget#getName() name}. @param name The name of the {@code Widget} to find. @param groups The {@code GroupWidgets} to search. @return The first {@code Widget} with the specified name or {@code null} if no child of {@code groups} has that name.
[ "Performs", "a", "breadth", "-", "first", "search", "of", "the", "{", "@link", "GroupWidget", "GroupWidgets", "}", "in", "{", "@code", "groups", "}", "for", "a", "{", "@link", "Widget", "}", "with", "the", "specified", "{", "@link", "Widget#getName", "()", "name", "}", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java#L2634-L2653
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/api/JobExecutionState.java
JobExecutionState.awaitForStatePredicate
public void awaitForStatePredicate(Predicate<JobExecutionState> predicate, long timeoutMs) throws InterruptedException, TimeoutException { """ Waits till a predicate on {@link #getRunningState()} becomes true or timeout is reached. @param predicate the predicate to evaluate. Note that even though the predicate is applied on the entire object, it will be evaluated only when the running state changes. @param timeoutMs the number of milliseconds to wait for the predicate to become true; 0 means wait forever. @throws InterruptedException if the waiting was interrupted @throws TimeoutException if we reached the timeout before the predicate was satisfied. """ Preconditions.checkArgument(timeoutMs >= 0); if (0 == timeoutMs) { timeoutMs = Long.MAX_VALUE; } long startTimeMs = System.currentTimeMillis(); long millisRemaining = timeoutMs; this.changeLock.lock(); try { while (!predicate.apply(this) && millisRemaining > 0) { if (!this.runningStateChanged.await(millisRemaining, TimeUnit.MILLISECONDS)) { // Not necessary but shuts up FindBugs RV_RETURN_VALUE_IGNORED_BAD_PRACTICE break; } millisRemaining = timeoutMs - (System.currentTimeMillis() - startTimeMs); } if (!predicate.apply(this)) { throw new TimeoutException("Timeout waiting for state predicate: " + predicate); } } finally { this.changeLock.unlock(); } }
java
public void awaitForStatePredicate(Predicate<JobExecutionState> predicate, long timeoutMs) throws InterruptedException, TimeoutException { Preconditions.checkArgument(timeoutMs >= 0); if (0 == timeoutMs) { timeoutMs = Long.MAX_VALUE; } long startTimeMs = System.currentTimeMillis(); long millisRemaining = timeoutMs; this.changeLock.lock(); try { while (!predicate.apply(this) && millisRemaining > 0) { if (!this.runningStateChanged.await(millisRemaining, TimeUnit.MILLISECONDS)) { // Not necessary but shuts up FindBugs RV_RETURN_VALUE_IGNORED_BAD_PRACTICE break; } millisRemaining = timeoutMs - (System.currentTimeMillis() - startTimeMs); } if (!predicate.apply(this)) { throw new TimeoutException("Timeout waiting for state predicate: " + predicate); } } finally { this.changeLock.unlock(); } }
[ "public", "void", "awaitForStatePredicate", "(", "Predicate", "<", "JobExecutionState", ">", "predicate", ",", "long", "timeoutMs", ")", "throws", "InterruptedException", ",", "TimeoutException", "{", "Preconditions", ".", "checkArgument", "(", "timeoutMs", ">=", "0", ")", ";", "if", "(", "0", "==", "timeoutMs", ")", "{", "timeoutMs", "=", "Long", ".", "MAX_VALUE", ";", "}", "long", "startTimeMs", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "long", "millisRemaining", "=", "timeoutMs", ";", "this", ".", "changeLock", ".", "lock", "(", ")", ";", "try", "{", "while", "(", "!", "predicate", ".", "apply", "(", "this", ")", "&&", "millisRemaining", ">", "0", ")", "{", "if", "(", "!", "this", ".", "runningStateChanged", ".", "await", "(", "millisRemaining", ",", "TimeUnit", ".", "MILLISECONDS", ")", ")", "{", "// Not necessary but shuts up FindBugs RV_RETURN_VALUE_IGNORED_BAD_PRACTICE", "break", ";", "}", "millisRemaining", "=", "timeoutMs", "-", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "startTimeMs", ")", ";", "}", "if", "(", "!", "predicate", ".", "apply", "(", "this", ")", ")", "{", "throw", "new", "TimeoutException", "(", "\"Timeout waiting for state predicate: \"", "+", "predicate", ")", ";", "}", "}", "finally", "{", "this", ".", "changeLock", ".", "unlock", "(", ")", ";", "}", "}" ]
Waits till a predicate on {@link #getRunningState()} becomes true or timeout is reached. @param predicate the predicate to evaluate. Note that even though the predicate is applied on the entire object, it will be evaluated only when the running state changes. @param timeoutMs the number of milliseconds to wait for the predicate to become true; 0 means wait forever. @throws InterruptedException if the waiting was interrupted @throws TimeoutException if we reached the timeout before the predicate was satisfied.
[ "Waits", "till", "a", "predicate", "on", "{", "@link", "#getRunningState", "()", "}", "becomes", "true", "or", "timeout", "is", "reached", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/api/JobExecutionState.java#L257-L283
davidcarboni-archive/httpino
src/main/java/com/github/davidcarboni/httpino/Http.java
Http.deserialiseResponseMessage
protected <T> T deserialiseResponseMessage(CloseableHttpResponse response, Type type) throws IOException { """ Deserialises the given {@link CloseableHttpResponse} to the specified type. @param response The response. @param type The type to deserialise to. This can be null, in which case {@link EntityUtils#consume(HttpEntity)} will be used to consume the response body (if any). @param <T> The type to deserialise to. @return The deserialised response, or null if the response does not contain an entity. @throws IOException If an error occurs. """ T body = null; HttpEntity entity = response.getEntity(); if (entity != null && type != null) { try (InputStream inputStream = entity.getContent()) { try { body = Serialiser.deserialise(inputStream, type); } catch (JsonSyntaxException e) { // This can happen if an error HTTP code is received and the // body of the response doesn't contain the expected object: System.out.println(ExceptionUtils.getStackTrace(e)); body = null; } } } else { EntityUtils.consume(entity); } return body; }
java
protected <T> T deserialiseResponseMessage(CloseableHttpResponse response, Type type) throws IOException { T body = null; HttpEntity entity = response.getEntity(); if (entity != null && type != null) { try (InputStream inputStream = entity.getContent()) { try { body = Serialiser.deserialise(inputStream, type); } catch (JsonSyntaxException e) { // This can happen if an error HTTP code is received and the // body of the response doesn't contain the expected object: System.out.println(ExceptionUtils.getStackTrace(e)); body = null; } } } else { EntityUtils.consume(entity); } return body; }
[ "protected", "<", "T", ">", "T", "deserialiseResponseMessage", "(", "CloseableHttpResponse", "response", ",", "Type", "type", ")", "throws", "IOException", "{", "T", "body", "=", "null", ";", "HttpEntity", "entity", "=", "response", ".", "getEntity", "(", ")", ";", "if", "(", "entity", "!=", "null", "&&", "type", "!=", "null", ")", "{", "try", "(", "InputStream", "inputStream", "=", "entity", ".", "getContent", "(", ")", ")", "{", "try", "{", "body", "=", "Serialiser", ".", "deserialise", "(", "inputStream", ",", "type", ")", ";", "}", "catch", "(", "JsonSyntaxException", "e", ")", "{", "// This can happen if an error HTTP code is received and the", "// body of the response doesn't contain the expected object:", "System", ".", "out", ".", "println", "(", "ExceptionUtils", ".", "getStackTrace", "(", "e", ")", ")", ";", "body", "=", "null", ";", "}", "}", "}", "else", "{", "EntityUtils", ".", "consume", "(", "entity", ")", ";", "}", "return", "body", ";", "}" ]
Deserialises the given {@link CloseableHttpResponse} to the specified type. @param response The response. @param type The type to deserialise to. This can be null, in which case {@link EntityUtils#consume(HttpEntity)} will be used to consume the response body (if any). @param <T> The type to deserialise to. @return The deserialised response, or null if the response does not contain an entity. @throws IOException If an error occurs.
[ "Deserialises", "the", "given", "{", "@link", "CloseableHttpResponse", "}", "to", "the", "specified", "type", "." ]
train
https://github.com/davidcarboni-archive/httpino/blob/a78c91874e6d9b2e452cf3aa68d4fea804d977ca/src/main/java/com/github/davidcarboni/httpino/Http.java#L505-L525
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/dbinfo/DINameSpace.java
DINameSpace.classForMethodFQN
Class classForMethodFQN(String fqn) { """ Retrieves the declaring <code>Class</code> object for the specified fully qualified method name, using (if possible) the classLoader attribute of this object's database. <p> @param fqn the fully qualified name of the method for which to retrieve the declaring <code>Class</code> object. @return the declaring <code>Class</code> object for the specified fully qualified method name """ try { return classForName(fqn.substring(0, fqn.lastIndexOf('.'))); } catch (Exception e) { return null; } }
java
Class classForMethodFQN(String fqn) { try { return classForName(fqn.substring(0, fqn.lastIndexOf('.'))); } catch (Exception e) { return null; } }
[ "Class", "classForMethodFQN", "(", "String", "fqn", ")", "{", "try", "{", "return", "classForName", "(", "fqn", ".", "substring", "(", "0", ",", "fqn", ".", "lastIndexOf", "(", "'", "'", ")", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "null", ";", "}", "}" ]
Retrieves the declaring <code>Class</code> object for the specified fully qualified method name, using (if possible) the classLoader attribute of this object's database. <p> @param fqn the fully qualified name of the method for which to retrieve the declaring <code>Class</code> object. @return the declaring <code>Class</code> object for the specified fully qualified method name
[ "Retrieves", "the", "declaring", "<code", ">", "Class<", "/", "code", ">", "object", "for", "the", "specified", "fully", "qualified", "method", "name", "using", "(", "if", "possible", ")", "the", "classLoader", "attribute", "of", "this", "object", "s", "database", ".", "<p", ">" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/dbinfo/DINameSpace.java#L116-L123
jpush/jmessage-api-java-client
src/main/java/cn/jmessage/api/JMessageClient.java
JMessageClient.addCrossBlacklist
public ResponseWrapper addCrossBlacklist(String username, CrossBlacklist[] blacklists) throws APIConnectionException, APIRequestException { """ Add blacklist whose users belong to another app to a given user. @param username The owner of the blacklist @param blacklists CrossBlacklist array @return No Content @throws APIConnectionException connect exception @throws APIRequestException request exception """ return _crossAppClient.addCrossBlacklist(username, blacklists); }
java
public ResponseWrapper addCrossBlacklist(String username, CrossBlacklist[] blacklists) throws APIConnectionException, APIRequestException { return _crossAppClient.addCrossBlacklist(username, blacklists); }
[ "public", "ResponseWrapper", "addCrossBlacklist", "(", "String", "username", ",", "CrossBlacklist", "[", "]", "blacklists", ")", "throws", "APIConnectionException", ",", "APIRequestException", "{", "return", "_crossAppClient", ".", "addCrossBlacklist", "(", "username", ",", "blacklists", ")", ";", "}" ]
Add blacklist whose users belong to another app to a given user. @param username The owner of the blacklist @param blacklists CrossBlacklist array @return No Content @throws APIConnectionException connect exception @throws APIRequestException request exception
[ "Add", "blacklist", "whose", "users", "belong", "to", "another", "app", "to", "a", "given", "user", "." ]
train
https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L619-L622
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java
ClassUtil.invoke
public static <T> T invoke(String className, String methodName, Object[] args) { """ 执行方法<br> 可执行Private方法,也可执行static方法<br> 执行非static方法时,必须满足对象有默认构造方法<br> 非单例模式,如果是非静态方法,每次创建一个新对象 @param <T> 对象类型 @param className 类名,完整类路径 @param methodName 方法名 @param args 参数,必须严格对应指定方法的参数类型和数量 @return 返回结果 """ return invoke(className, methodName, false, args); }
java
public static <T> T invoke(String className, String methodName, Object[] args) { return invoke(className, methodName, false, args); }
[ "public", "static", "<", "T", ">", "T", "invoke", "(", "String", "className", ",", "String", "methodName", ",", "Object", "[", "]", "args", ")", "{", "return", "invoke", "(", "className", ",", "methodName", ",", "false", ",", "args", ")", ";", "}" ]
执行方法<br> 可执行Private方法,也可执行static方法<br> 执行非static方法时,必须满足对象有默认构造方法<br> 非单例模式,如果是非静态方法,每次创建一个新对象 @param <T> 对象类型 @param className 类名,完整类路径 @param methodName 方法名 @param args 参数,必须严格对应指定方法的参数类型和数量 @return 返回结果
[ "执行方法<br", ">", "可执行Private方法,也可执行static方法<br", ">", "执行非static方法时,必须满足对象有默认构造方法<br", ">", "非单例模式,如果是非静态方法,每次创建一个新对象" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L665-L667
Baidu-AIP/java-sdk
src/main/java/com/baidu/aip/ocr/AipOcr.java
AipOcr.generalUrl
public JSONObject generalUrl(String url, HashMap<String, String> options) { """ 通用文字识别(含位置信息版)接口 用户向服务请求识别某张图中的所有文字,并返回文字在图中的位置信息。 @param url - 图片完整URL,URL长度不超过1024字节,URL对应的图片base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式,当image字段存在时url字段失效 @param options - 可选参数对象,key: value都为string类型 options - options列表: recognize_granularity 是否定位单字符位置,big:不定位单字符位置,默认值;small:定位单字符位置 language_type 识别语言类型,默认为CHN_ENG。可选值包括:<br>- CHN_ENG:中英文混合;<br>- ENG:英文;<br>- POR:葡萄牙语;<br>- FRE:法语;<br>- GER:德语;<br>- ITA:意大利语;<br>- SPA:西班牙语;<br>- RUS:俄语;<br>- JAP:日语;<br>- KOR:韩语; detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:<br>- true:检测朝向;<br>- false:不检测朝向。 detect_language 是否检测语言,默认不检测。当前支持(中文、英语、日语、韩语) vertexes_location 是否返回文字外接多边形顶点位置,不支持单字位置。默认为false probability 是否返回识别结果中每一行的置信度 @return JSONObject """ AipRequest request = new AipRequest(); preOperation(request); request.addBody("url", url); if (options != null) { request.addBody(options); } request.setUri(OcrConsts.GENERAL); postOperation(request); return requestServer(request); }
java
public JSONObject generalUrl(String url, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("url", url); if (options != null) { request.addBody(options); } request.setUri(OcrConsts.GENERAL); postOperation(request); return requestServer(request); }
[ "public", "JSONObject", "generalUrl", "(", "String", "url", ",", "HashMap", "<", "String", ",", "String", ">", "options", ")", "{", "AipRequest", "request", "=", "new", "AipRequest", "(", ")", ";", "preOperation", "(", "request", ")", ";", "request", ".", "addBody", "(", "\"url\"", ",", "url", ")", ";", "if", "(", "options", "!=", "null", ")", "{", "request", ".", "addBody", "(", "options", ")", ";", "}", "request", ".", "setUri", "(", "OcrConsts", ".", "GENERAL", ")", ";", "postOperation", "(", "request", ")", ";", "return", "requestServer", "(", "request", ")", ";", "}" ]
通用文字识别(含位置信息版)接口 用户向服务请求识别某张图中的所有文字,并返回文字在图中的位置信息。 @param url - 图片完整URL,URL长度不超过1024字节,URL对应的图片base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式,当image字段存在时url字段失效 @param options - 可选参数对象,key: value都为string类型 options - options列表: recognize_granularity 是否定位单字符位置,big:不定位单字符位置,默认值;small:定位单字符位置 language_type 识别语言类型,默认为CHN_ENG。可选值包括:<br>- CHN_ENG:中英文混合;<br>- ENG:英文;<br>- POR:葡萄牙语;<br>- FRE:法语;<br>- GER:德语;<br>- ITA:意大利语;<br>- SPA:西班牙语;<br>- RUS:俄语;<br>- JAP:日语;<br>- KOR:韩语; detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:<br>- true:检测朝向;<br>- false:不检测朝向。 detect_language 是否检测语言,默认不检测。当前支持(中文、英语、日语、韩语) vertexes_location 是否返回文字外接多边形顶点位置,不支持单字位置。默认为false probability 是否返回识别结果中每一行的置信度 @return JSONObject
[ "通用文字识别(含位置信息版)接口", "用户向服务请求识别某张图中的所有文字,并返回文字在图中的位置信息。" ]
train
https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/ocr/AipOcr.java#L224-L235
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/dataobjects/Dataframe.java
Dataframe.index
public Iterable<Integer> index() { """ Returns a read-only Iterable on the keys of the Dataframe. @return """ return () -> new Iterator<Integer>() { private final Iterator<Integer> it = data.records.keySet().iterator(); /** {@inheritDoc} */ @Override public boolean hasNext() { return it.hasNext(); } /** {@inheritDoc} */ @Override public Integer next() { return it.next(); } /** {@inheritDoc} */ @Override public void remove() { throw new UnsupportedOperationException("This is a read-only iterator, remove operation is not supported."); } }; }
java
public Iterable<Integer> index() { return () -> new Iterator<Integer>() { private final Iterator<Integer> it = data.records.keySet().iterator(); /** {@inheritDoc} */ @Override public boolean hasNext() { return it.hasNext(); } /** {@inheritDoc} */ @Override public Integer next() { return it.next(); } /** {@inheritDoc} */ @Override public void remove() { throw new UnsupportedOperationException("This is a read-only iterator, remove operation is not supported."); } }; }
[ "public", "Iterable", "<", "Integer", ">", "index", "(", ")", "{", "return", "(", ")", "->", "new", "Iterator", "<", "Integer", ">", "(", ")", "{", "private", "final", "Iterator", "<", "Integer", ">", "it", "=", "data", ".", "records", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "/** {@inheritDoc} */", "@", "Override", "public", "boolean", "hasNext", "(", ")", "{", "return", "it", ".", "hasNext", "(", ")", ";", "}", "/** {@inheritDoc} */", "@", "Override", "public", "Integer", "next", "(", ")", "{", "return", "it", ".", "next", "(", ")", ";", "}", "/** {@inheritDoc} */", "@", "Override", "public", "void", "remove", "(", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"This is a read-only iterator, remove operation is not supported.\"", ")", ";", "}", "}", ";", "}" ]
Returns a read-only Iterable on the keys of the Dataframe. @return
[ "Returns", "a", "read", "-", "only", "Iterable", "on", "the", "keys", "of", "the", "Dataframe", "." ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/dataobjects/Dataframe.java#L804-L826
jboss/jboss-jsf-api_spec
src/main/java/javax/faces/component/ComponentStateHelper.java
ComponentStateHelper.saveState
public Object saveState(FacesContext context) { """ One and only implementation of save-state - makes all other implementations unnecessary. @param context @return the saved state """ if (context == null) { throw new NullPointerException(); } if(component.initialStateMarked()) { return saveMap(context, deltaMap); } else { return saveMap(context, defaultMap); } }
java
public Object saveState(FacesContext context) { if (context == null) { throw new NullPointerException(); } if(component.initialStateMarked()) { return saveMap(context, deltaMap); } else { return saveMap(context, defaultMap); } }
[ "public", "Object", "saveState", "(", "FacesContext", "context", ")", "{", "if", "(", "context", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "if", "(", "component", ".", "initialStateMarked", "(", ")", ")", "{", "return", "saveMap", "(", "context", ",", "deltaMap", ")", ";", "}", "else", "{", "return", "saveMap", "(", "context", ",", "defaultMap", ")", ";", "}", "}" ]
One and only implementation of save-state - makes all other implementations unnecessary. @param context @return the saved state
[ "One", "and", "only", "implementation", "of", "save", "-", "state", "-", "makes", "all", "other", "implementations", "unnecessary", "." ]
train
https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/component/ComponentStateHelper.java#L251-L261
qiujuer/Genius-Android
caprice/ui/src/main/java/net/qiujuer/genius/ui/widget/EditText.java
EditText.checkShowTitle
private void checkShowTitle(Editable s, boolean skipChange) { """ Check show hint title @param s The text, if the have same string we should move hint @param skipChange on showed we not refresh ui, but skipChange=true, we can skip the check """ // in this we can check width if (isShowTitle() && getWidth() > 0) { boolean have = s != null && s.length() > 0; if (have != isHaveText || (have && skipChange)) { isHaveText = have; animateShowTitle(isHaveText); } } }
java
private void checkShowTitle(Editable s, boolean skipChange) { // in this we can check width if (isShowTitle() && getWidth() > 0) { boolean have = s != null && s.length() > 0; if (have != isHaveText || (have && skipChange)) { isHaveText = have; animateShowTitle(isHaveText); } } }
[ "private", "void", "checkShowTitle", "(", "Editable", "s", ",", "boolean", "skipChange", ")", "{", "// in this we can check width", "if", "(", "isShowTitle", "(", ")", "&&", "getWidth", "(", ")", ">", "0", ")", "{", "boolean", "have", "=", "s", "!=", "null", "&&", "s", ".", "length", "(", ")", ">", "0", ";", "if", "(", "have", "!=", "isHaveText", "||", "(", "have", "&&", "skipChange", ")", ")", "{", "isHaveText", "=", "have", ";", "animateShowTitle", "(", "isHaveText", ")", ";", "}", "}", "}" ]
Check show hint title @param s The text, if the have same string we should move hint @param skipChange on showed we not refresh ui, but skipChange=true, we can skip the check
[ "Check", "show", "hint", "title" ]
train
https://github.com/qiujuer/Genius-Android/blob/babefaf1321f5883a21cada582b6fa5104adc648/caprice/ui/src/main/java/net/qiujuer/genius/ui/widget/EditText.java#L282-L291
JDBDT/jdbdt
src/main/java/org/jdbdt/DataSource.java
DataSource.executeQuery
final DataSet executeQuery(CallInfo callInfo, boolean takeSnapshot) { """ Execute query. @param callInfo Call info. @param takeSnapshot Indicates that a snapshot should be taken. @return Result of query. """ DataSet data = new DataSet(this); return db.access(callInfo, () -> { try (WrappedStatement ws = db.compile(getSQLForQuery())) { proceedWithQuery(ws.getStatement(), data); if (takeSnapshot) { setSnapshot(data); db.logSnapshot(callInfo, data); } else { db.logQuery(callInfo, data); } } return data; }); }
java
final DataSet executeQuery(CallInfo callInfo, boolean takeSnapshot) { DataSet data = new DataSet(this); return db.access(callInfo, () -> { try (WrappedStatement ws = db.compile(getSQLForQuery())) { proceedWithQuery(ws.getStatement(), data); if (takeSnapshot) { setSnapshot(data); db.logSnapshot(callInfo, data); } else { db.logQuery(callInfo, data); } } return data; }); }
[ "final", "DataSet", "executeQuery", "(", "CallInfo", "callInfo", ",", "boolean", "takeSnapshot", ")", "{", "DataSet", "data", "=", "new", "DataSet", "(", "this", ")", ";", "return", "db", ".", "access", "(", "callInfo", ",", "(", ")", "->", "{", "try", "(", "WrappedStatement", "ws", "=", "db", ".", "compile", "(", "getSQLForQuery", "(", ")", ")", ")", "{", "proceedWithQuery", "(", "ws", ".", "getStatement", "(", ")", ",", "data", ")", ";", "if", "(", "takeSnapshot", ")", "{", "setSnapshot", "(", "data", ")", ";", "db", ".", "logSnapshot", "(", "callInfo", ",", "data", ")", ";", "}", "else", "{", "db", ".", "logQuery", "(", "callInfo", ",", "data", ")", ";", "}", "}", "return", "data", ";", "}", ")", ";", "}" ]
Execute query. @param callInfo Call info. @param takeSnapshot Indicates that a snapshot should be taken. @return Result of query.
[ "Execute", "query", "." ]
train
https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/DataSource.java#L226-L240
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/Config.java
Config.setQueueConfigs
public Config setQueueConfigs(Map<String, QueueConfig> queueConfigs) { """ Sets the map of {@link com.hazelcast.core.IQueue} configurations, mapped by config name. The config name may be a pattern with which the configuration will be obtained in the future. @param queueConfigs the queue configuration map to set @return this config instance """ this.queueConfigs.clear(); this.queueConfigs.putAll(queueConfigs); for (Entry<String, QueueConfig> entry : queueConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; }
java
public Config setQueueConfigs(Map<String, QueueConfig> queueConfigs) { this.queueConfigs.clear(); this.queueConfigs.putAll(queueConfigs); for (Entry<String, QueueConfig> entry : queueConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; }
[ "public", "Config", "setQueueConfigs", "(", "Map", "<", "String", ",", "QueueConfig", ">", "queueConfigs", ")", "{", "this", ".", "queueConfigs", ".", "clear", "(", ")", ";", "this", ".", "queueConfigs", ".", "putAll", "(", "queueConfigs", ")", ";", "for", "(", "Entry", "<", "String", ",", "QueueConfig", ">", "entry", ":", "queueConfigs", ".", "entrySet", "(", ")", ")", "{", "entry", ".", "getValue", "(", ")", ".", "setName", "(", "entry", ".", "getKey", "(", ")", ")", ";", "}", "return", "this", ";", "}" ]
Sets the map of {@link com.hazelcast.core.IQueue} configurations, mapped by config name. The config name may be a pattern with which the configuration will be obtained in the future. @param queueConfigs the queue configuration map to set @return this config instance
[ "Sets", "the", "map", "of", "{", "@link", "com", ".", "hazelcast", ".", "core", ".", "IQueue", "}", "configurations", "mapped", "by", "config", "name", ".", "The", "config", "name", "may", "be", "a", "pattern", "with", "which", "the", "configuration", "will", "be", "obtained", "in", "the", "future", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L706-L713
tvesalainen/util
util/src/main/java/org/vesalainen/util/OrderedList.java
OrderedList.tailIterator
public Iterator<T> tailIterator(T key, boolean inclusive) { """ Returns iterator from key to end @param key @param inclusive @return """ int point = point(key, inclusive); return subList(point, size()).iterator(); }
java
public Iterator<T> tailIterator(T key, boolean inclusive) { int point = point(key, inclusive); return subList(point, size()).iterator(); }
[ "public", "Iterator", "<", "T", ">", "tailIterator", "(", "T", "key", ",", "boolean", "inclusive", ")", "{", "int", "point", "=", "point", "(", "key", ",", "inclusive", ")", ";", "return", "subList", "(", "point", ",", "size", "(", ")", ")", ".", "iterator", "(", ")", ";", "}" ]
Returns iterator from key to end @param key @param inclusive @return
[ "Returns", "iterator", "from", "key", "to", "end" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/OrderedList.java#L136-L140
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/quasinewton/QuasiNewtonBFGS.java
QuasiNewtonBFGS.setFunction
public void setFunction( GradientLineFunction function , double funcMinValue ) { """ Specify the function being optimized @param function Function to optimize @param funcMinValue Minimum possible function value. E.g. 0 for least squares. """ this.function = function; this.funcMinValue = funcMinValue; lineSearch.setFunction(function,funcMinValue); N = function.getN(); B = new DMatrixRMaj(N,N); searchVector = new DMatrixRMaj(N,1); g = new DMatrixRMaj(N,1); s = new DMatrixRMaj(N,1); y = new DMatrixRMaj(N,1); x = new DMatrixRMaj(N,1); temp0_Nx1 = new DMatrixRMaj(N,1); temp1_Nx1 = new DMatrixRMaj(N,1); }
java
public void setFunction( GradientLineFunction function , double funcMinValue ) { this.function = function; this.funcMinValue = funcMinValue; lineSearch.setFunction(function,funcMinValue); N = function.getN(); B = new DMatrixRMaj(N,N); searchVector = new DMatrixRMaj(N,1); g = new DMatrixRMaj(N,1); s = new DMatrixRMaj(N,1); y = new DMatrixRMaj(N,1); x = new DMatrixRMaj(N,1); temp0_Nx1 = new DMatrixRMaj(N,1); temp1_Nx1 = new DMatrixRMaj(N,1); }
[ "public", "void", "setFunction", "(", "GradientLineFunction", "function", ",", "double", "funcMinValue", ")", "{", "this", ".", "function", "=", "function", ";", "this", ".", "funcMinValue", "=", "funcMinValue", ";", "lineSearch", ".", "setFunction", "(", "function", ",", "funcMinValue", ")", ";", "N", "=", "function", ".", "getN", "(", ")", ";", "B", "=", "new", "DMatrixRMaj", "(", "N", ",", "N", ")", ";", "searchVector", "=", "new", "DMatrixRMaj", "(", "N", ",", "1", ")", ";", "g", "=", "new", "DMatrixRMaj", "(", "N", ",", "1", ")", ";", "s", "=", "new", "DMatrixRMaj", "(", "N", ",", "1", ")", ";", "y", "=", "new", "DMatrixRMaj", "(", "N", ",", "1", ")", ";", "x", "=", "new", "DMatrixRMaj", "(", "N", ",", "1", ")", ";", "temp0_Nx1", "=", "new", "DMatrixRMaj", "(", "N", ",", "1", ")", ";", "temp1_Nx1", "=", "new", "DMatrixRMaj", "(", "N", ",", "1", ")", ";", "}" ]
Specify the function being optimized @param function Function to optimize @param funcMinValue Minimum possible function value. E.g. 0 for least squares.
[ "Specify", "the", "function", "being", "optimized" ]
train
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/quasinewton/QuasiNewtonBFGS.java#L122-L138
srikalyc/Sql4D
Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/DruidNodeAccessor.java
DruidNodeAccessor.postJson
public CloseableHttpResponse postJson(String url, String json, Map<String, String> reqHeaders) throws IOException { """ Convenient method for POSTing json strings. It is the responsibility of the caller to call returnClient() to ensure clean state of the pool. @param url @param json @param reqHeaders @return @throws IOException """ CloseableHttpClient req = getClient(); CloseableHttpResponse resp = null; HttpPost post = new HttpPost(url); addHeaders(post, reqHeaders); post.setHeader(json, url); StringEntity input = new StringEntity(json, ContentType.APPLICATION_JSON); post.setEntity(input); resp = req.execute(post); return resp; }
java
public CloseableHttpResponse postJson(String url, String json, Map<String, String> reqHeaders) throws IOException { CloseableHttpClient req = getClient(); CloseableHttpResponse resp = null; HttpPost post = new HttpPost(url); addHeaders(post, reqHeaders); post.setHeader(json, url); StringEntity input = new StringEntity(json, ContentType.APPLICATION_JSON); post.setEntity(input); resp = req.execute(post); return resp; }
[ "public", "CloseableHttpResponse", "postJson", "(", "String", "url", ",", "String", "json", ",", "Map", "<", "String", ",", "String", ">", "reqHeaders", ")", "throws", "IOException", "{", "CloseableHttpClient", "req", "=", "getClient", "(", ")", ";", "CloseableHttpResponse", "resp", "=", "null", ";", "HttpPost", "post", "=", "new", "HttpPost", "(", "url", ")", ";", "addHeaders", "(", "post", ",", "reqHeaders", ")", ";", "post", ".", "setHeader", "(", "json", ",", "url", ")", ";", "StringEntity", "input", "=", "new", "StringEntity", "(", "json", ",", "ContentType", ".", "APPLICATION_JSON", ")", ";", "post", ".", "setEntity", "(", "input", ")", ";", "resp", "=", "req", ".", "execute", "(", "post", ")", ";", "return", "resp", ";", "}" ]
Convenient method for POSTing json strings. It is the responsibility of the caller to call returnClient() to ensure clean state of the pool. @param url @param json @param reqHeaders @return @throws IOException
[ "Convenient", "method", "for", "POSTing", "json", "strings", ".", "It", "is", "the", "responsibility", "of", "the", "caller", "to", "call", "returnClient", "()", "to", "ensure", "clean", "state", "of", "the", "pool", "." ]
train
https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/DruidNodeAccessor.java#L133-L143
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/ProxiedFileSystemUtils.java
ProxiedFileSystemUtils.canProxyAs
public static boolean canProxyAs(String userNameToProxyAs, String superUserName, Path superUserKeytabLocation) { """ Returns true if superUserName can proxy as userNameToProxyAs using the specified superUserKeytabLocation, false otherwise. """ try { loginAndProxyAsUser(userNameToProxyAs, superUserName, superUserKeytabLocation); } catch (IOException e) { return false; } return true; }
java
public static boolean canProxyAs(String userNameToProxyAs, String superUserName, Path superUserKeytabLocation) { try { loginAndProxyAsUser(userNameToProxyAs, superUserName, superUserKeytabLocation); } catch (IOException e) { return false; } return true; }
[ "public", "static", "boolean", "canProxyAs", "(", "String", "userNameToProxyAs", ",", "String", "superUserName", ",", "Path", "superUserKeytabLocation", ")", "{", "try", "{", "loginAndProxyAsUser", "(", "userNameToProxyAs", ",", "superUserName", ",", "superUserKeytabLocation", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
Returns true if superUserName can proxy as userNameToProxyAs using the specified superUserKeytabLocation, false otherwise.
[ "Returns", "true", "if", "superUserName", "can", "proxy", "as", "userNameToProxyAs", "using", "the", "specified", "superUserKeytabLocation", "false", "otherwise", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ProxiedFileSystemUtils.java#L189-L196
structr/structr
structr-core/src/main/java/org/structr/core/entity/LinkedListNodeImpl.java
LinkedListNodeImpl.listInsertBefore
@Override public void listInsertBefore(final T currentElement, final T newElement) throws FrameworkException { """ Inserts newElement before currentElement in the list defined by this LinkedListManager. @param currentElement the reference element @param newElement the new element @throws org.structr.common.error.FrameworkException """ if (currentElement.getUuid().equals(newElement.getUuid())) { throw new IllegalStateException("Cannot link a node to itself!"); } final T previousElement = listGetPrevious(currentElement); if (previousElement == null) { linkNodes(getSiblingLinkType(), newElement, currentElement); } else { // delete old relationship unlinkNodes(getSiblingLinkType(), previousElement, currentElement); // dont create self link if (!previousElement.getUuid().equals(newElement.getUuid())) { linkNodes(getSiblingLinkType(), previousElement, newElement); } // dont create self link if (!newElement.getUuid().equals(currentElement.getUuid())) { linkNodes(getSiblingLinkType(), newElement, currentElement); } } }
java
@Override public void listInsertBefore(final T currentElement, final T newElement) throws FrameworkException { if (currentElement.getUuid().equals(newElement.getUuid())) { throw new IllegalStateException("Cannot link a node to itself!"); } final T previousElement = listGetPrevious(currentElement); if (previousElement == null) { linkNodes(getSiblingLinkType(), newElement, currentElement); } else { // delete old relationship unlinkNodes(getSiblingLinkType(), previousElement, currentElement); // dont create self link if (!previousElement.getUuid().equals(newElement.getUuid())) { linkNodes(getSiblingLinkType(), previousElement, newElement); } // dont create self link if (!newElement.getUuid().equals(currentElement.getUuid())) { linkNodes(getSiblingLinkType(), newElement, currentElement); } } }
[ "@", "Override", "public", "void", "listInsertBefore", "(", "final", "T", "currentElement", ",", "final", "T", "newElement", ")", "throws", "FrameworkException", "{", "if", "(", "currentElement", ".", "getUuid", "(", ")", ".", "equals", "(", "newElement", ".", "getUuid", "(", ")", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Cannot link a node to itself!\"", ")", ";", "}", "final", "T", "previousElement", "=", "listGetPrevious", "(", "currentElement", ")", ";", "if", "(", "previousElement", "==", "null", ")", "{", "linkNodes", "(", "getSiblingLinkType", "(", ")", ",", "newElement", ",", "currentElement", ")", ";", "}", "else", "{", "// delete old relationship", "unlinkNodes", "(", "getSiblingLinkType", "(", ")", ",", "previousElement", ",", "currentElement", ")", ";", "// dont create self link", "if", "(", "!", "previousElement", ".", "getUuid", "(", ")", ".", "equals", "(", "newElement", ".", "getUuid", "(", ")", ")", ")", "{", "linkNodes", "(", "getSiblingLinkType", "(", ")", ",", "previousElement", ",", "newElement", ")", ";", "}", "// dont create self link", "if", "(", "!", "newElement", ".", "getUuid", "(", ")", ".", "equals", "(", "currentElement", ".", "getUuid", "(", ")", ")", ")", "{", "linkNodes", "(", "getSiblingLinkType", "(", ")", ",", "newElement", ",", "currentElement", ")", ";", "}", "}", "}" ]
Inserts newElement before currentElement in the list defined by this LinkedListManager. @param currentElement the reference element @param newElement the new element @throws org.structr.common.error.FrameworkException
[ "Inserts", "newElement", "before", "currentElement", "in", "the", "list", "defined", "by", "this", "LinkedListManager", "." ]
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/core/entity/LinkedListNodeImpl.java#L83-L109
liferay/com-liferay-commerce
commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationTemplatePersistenceImpl.java
CommerceNotificationTemplatePersistenceImpl.removeByUuid_C
@Override public void removeByUuid_C(String uuid, long companyId) { """ Removes all the commerce notification templates where uuid = &#63; and companyId = &#63; from the database. @param uuid the uuid @param companyId the company ID """ for (CommerceNotificationTemplate commerceNotificationTemplate : findByUuid_C( uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceNotificationTemplate); } }
java
@Override public void removeByUuid_C(String uuid, long companyId) { for (CommerceNotificationTemplate commerceNotificationTemplate : findByUuid_C( uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceNotificationTemplate); } }
[ "@", "Override", "public", "void", "removeByUuid_C", "(", "String", "uuid", ",", "long", "companyId", ")", "{", "for", "(", "CommerceNotificationTemplate", "commerceNotificationTemplate", ":", "findByUuid_C", "(", "uuid", ",", "companyId", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ")", "{", "remove", "(", "commerceNotificationTemplate", ")", ";", "}", "}" ]
Removes all the commerce notification templates where uuid = &#63; and companyId = &#63; from the database. @param uuid the uuid @param companyId the company ID
[ "Removes", "all", "the", "commerce", "notification", "templates", "where", "uuid", "=", "&#63", ";", "and", "companyId", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationTemplatePersistenceImpl.java#L1432-L1438
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WRowRenderer.java
WRowRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { """ Paints the given WButton. @param component the WRow to paint. @param renderContext the RenderContext to paint to. """ WRow row = (WRow) component; XmlStringBuilder xml = renderContext.getWriter(); int cols = row.getChildCount(); Size gap = row.getSpace(); String gapString = gap != null ? gap.toString() : null; if (cols > 0) { xml.appendTagOpen("ui:row"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("gap", gapString); xml.appendClose(); // Render margin MarginRendererUtil.renderMargin(row, renderContext); paintChildren(row, renderContext); xml.appendEndTag("ui:row"); } }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WRow row = (WRow) component; XmlStringBuilder xml = renderContext.getWriter(); int cols = row.getChildCount(); Size gap = row.getSpace(); String gapString = gap != null ? gap.toString() : null; if (cols > 0) { xml.appendTagOpen("ui:row"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("gap", gapString); xml.appendClose(); // Render margin MarginRendererUtil.renderMargin(row, renderContext); paintChildren(row, renderContext); xml.appendEndTag("ui:row"); } }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WRow", "row", "=", "(", "WRow", ")", "component", ";", "XmlStringBuilder", "xml", "=", "renderContext", ".", "getWriter", "(", ")", ";", "int", "cols", "=", "row", ".", "getChildCount", "(", ")", ";", "Size", "gap", "=", "row", ".", "getSpace", "(", ")", ";", "String", "gapString", "=", "gap", "!=", "null", "?", "gap", ".", "toString", "(", ")", ":", "null", ";", "if", "(", "cols", ">", "0", ")", "{", "xml", ".", "appendTagOpen", "(", "\"ui:row\"", ")", ";", "xml", ".", "appendAttribute", "(", "\"id\"", ",", "component", ".", "getId", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"class\"", ",", "component", ".", "getHtmlClass", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"track\"", ",", "component", ".", "isTracking", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"gap\"", ",", "gapString", ")", ";", "xml", ".", "appendClose", "(", ")", ";", "// Render margin", "MarginRendererUtil", ".", "renderMargin", "(", "row", ",", "renderContext", ")", ";", "paintChildren", "(", "row", ",", "renderContext", ")", ";", "xml", ".", "appendEndTag", "(", "\"ui:row\"", ")", ";", "}", "}" ]
Paints the given WButton. @param component the WRow to paint. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "given", "WButton", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WRowRenderer.java#L25-L48
BranchMetrics/android-branch-deep-linking
Branch-SDK/src/io/branch/referral/ServerRequestQueue.java
ServerRequestQueue.moveInstallOrOpenToFront
@SuppressWarnings("unused") void moveInstallOrOpenToFront(ServerRequest request, int networkCount, Branch.BranchReferralInitListener callback) { """ <p>Moves any {@link ServerRequest} of type {@link ServerRequestRegisterInstall} or {@link ServerRequestRegisterOpen} to the front of the queue.</p> @param request A {@link ServerRequest} of type open or install which need to be moved to the front of the queue. @param networkCount An {@link Integer} value that indicates whether or not to insert the request at the front of the queue or not. @param callback A {Branch.BranchReferralInitListener} instance for open or install callback. """ synchronized (reqQueueLockObject) { Iterator<ServerRequest> iter = queue.iterator(); while (iter.hasNext()) { ServerRequest req = iter.next(); if (req != null && (req instanceof ServerRequestRegisterInstall || req instanceof ServerRequestRegisterOpen)) { //Remove all install or open in queue. Since this method is called each time on Install/open there will be only one //instance of open/Install in queue. So we can break as we see the first open/install iter.remove(); break; } } } insert(request, networkCount == 0 ? 0 : 1); }
java
@SuppressWarnings("unused") void moveInstallOrOpenToFront(ServerRequest request, int networkCount, Branch.BranchReferralInitListener callback) { synchronized (reqQueueLockObject) { Iterator<ServerRequest> iter = queue.iterator(); while (iter.hasNext()) { ServerRequest req = iter.next(); if (req != null && (req instanceof ServerRequestRegisterInstall || req instanceof ServerRequestRegisterOpen)) { //Remove all install or open in queue. Since this method is called each time on Install/open there will be only one //instance of open/Install in queue. So we can break as we see the first open/install iter.remove(); break; } } } insert(request, networkCount == 0 ? 0 : 1); }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "void", "moveInstallOrOpenToFront", "(", "ServerRequest", "request", ",", "int", "networkCount", ",", "Branch", ".", "BranchReferralInitListener", "callback", ")", "{", "synchronized", "(", "reqQueueLockObject", ")", "{", "Iterator", "<", "ServerRequest", ">", "iter", "=", "queue", ".", "iterator", "(", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "ServerRequest", "req", "=", "iter", ".", "next", "(", ")", ";", "if", "(", "req", "!=", "null", "&&", "(", "req", "instanceof", "ServerRequestRegisterInstall", "||", "req", "instanceof", "ServerRequestRegisterOpen", ")", ")", "{", "//Remove all install or open in queue. Since this method is called each time on Install/open there will be only one", "//instance of open/Install in queue. So we can break as we see the first open/install", "iter", ".", "remove", "(", ")", ";", "break", ";", "}", "}", "}", "insert", "(", "request", ",", "networkCount", "==", "0", "?", "0", ":", "1", ")", ";", "}" ]
<p>Moves any {@link ServerRequest} of type {@link ServerRequestRegisterInstall} or {@link ServerRequestRegisterOpen} to the front of the queue.</p> @param request A {@link ServerRequest} of type open or install which need to be moved to the front of the queue. @param networkCount An {@link Integer} value that indicates whether or not to insert the request at the front of the queue or not. @param callback A {Branch.BranchReferralInitListener} instance for open or install callback.
[ "<p", ">", "Moves", "any", "{", "@link", "ServerRequest", "}", "of", "type", "{", "@link", "ServerRequestRegisterInstall", "}", "or", "{", "@link", "ServerRequestRegisterOpen", "}", "to", "the", "front", "of", "the", "queue", ".", "<", "/", "p", ">" ]
train
https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/ServerRequestQueue.java#L329-L346
Azure/azure-sdk-for-java
storage/resource-manager/v2018_11_01/src/main/java/com/microsoft/azure/management/storage/v2018_11_01/implementation/BlobServicesInner.java
BlobServicesInner.setServicePropertiesAsync
public Observable<BlobServicePropertiesInner> setServicePropertiesAsync(String resourceGroupName, String accountName, BlobServicePropertiesInner parameters) { """ Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @param parameters The properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the BlobServicePropertiesInner object """ return setServicePropertiesWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1<ServiceResponse<BlobServicePropertiesInner>, BlobServicePropertiesInner>() { @Override public BlobServicePropertiesInner call(ServiceResponse<BlobServicePropertiesInner> response) { return response.body(); } }); }
java
public Observable<BlobServicePropertiesInner> setServicePropertiesAsync(String resourceGroupName, String accountName, BlobServicePropertiesInner parameters) { return setServicePropertiesWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1<ServiceResponse<BlobServicePropertiesInner>, BlobServicePropertiesInner>() { @Override public BlobServicePropertiesInner call(ServiceResponse<BlobServicePropertiesInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "BlobServicePropertiesInner", ">", "setServicePropertiesAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "BlobServicePropertiesInner", "parameters", ")", "{", "return", "setServicePropertiesWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "BlobServicePropertiesInner", ">", ",", "BlobServicePropertiesInner", ">", "(", ")", "{", "@", "Override", "public", "BlobServicePropertiesInner", "call", "(", "ServiceResponse", "<", "BlobServicePropertiesInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @param parameters The properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the BlobServicePropertiesInner object
[ "Sets", "the", "properties", "of", "a", "storage", "account’s", "Blob", "service", "including", "properties", "for", "Storage", "Analytics", "and", "CORS", "(", "Cross", "-", "Origin", "Resource", "Sharing", ")", "rules", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_11_01/src/main/java/com/microsoft/azure/management/storage/v2018_11_01/implementation/BlobServicesInner.java#L105-L112
bingoohuang/excel2javabeans
src/main/java/com/github/bingoohuang/excel2beans/BeansToExcelOnTemplate.java
BeansToExcelOnTemplate.directMergeRows
private void directMergeRows(MergeRow mergeRowAnn, int fromRow, int lastRow, int col) { """ 直接纵向合并单元格。 @param mergeRowAnn 纵向合并单元格注解。 @param fromRow 开始合并行索引。 @param lastRow 结束合并行索引。 @param col 纵向列索引。 """ fixCellValue(mergeRowAnn, fromRow, col); if (lastRow < fromRow) return; if (lastRow == fromRow && mergeRowAnn.moreCols() == 0) return; val c1 = new CellRangeAddress(fromRow, lastRow, col, col + mergeRowAnn.moreCols()); sheet.addMergedRegion(c1); }
java
private void directMergeRows(MergeRow mergeRowAnn, int fromRow, int lastRow, int col) { fixCellValue(mergeRowAnn, fromRow, col); if (lastRow < fromRow) return; if (lastRow == fromRow && mergeRowAnn.moreCols() == 0) return; val c1 = new CellRangeAddress(fromRow, lastRow, col, col + mergeRowAnn.moreCols()); sheet.addMergedRegion(c1); }
[ "private", "void", "directMergeRows", "(", "MergeRow", "mergeRowAnn", ",", "int", "fromRow", ",", "int", "lastRow", ",", "int", "col", ")", "{", "fixCellValue", "(", "mergeRowAnn", ",", "fromRow", ",", "col", ")", ";", "if", "(", "lastRow", "<", "fromRow", ")", "return", ";", "if", "(", "lastRow", "==", "fromRow", "&&", "mergeRowAnn", ".", "moreCols", "(", ")", "==", "0", ")", "return", ";", "val", "c1", "=", "new", "CellRangeAddress", "(", "fromRow", ",", "lastRow", ",", "col", ",", "col", "+", "mergeRowAnn", ".", "moreCols", "(", ")", ")", ";", "sheet", ".", "addMergedRegion", "(", "c1", ")", ";", "}" ]
直接纵向合并单元格。 @param mergeRowAnn 纵向合并单元格注解。 @param fromRow 开始合并行索引。 @param lastRow 结束合并行索引。 @param col 纵向列索引。
[ "直接纵向合并单元格。" ]
train
https://github.com/bingoohuang/excel2javabeans/blob/db136d460b93b649814366c0d84a982698b96dc3/src/main/java/com/github/bingoohuang/excel2beans/BeansToExcelOnTemplate.java#L179-L187
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SDVariable.java
SDVariable.gte
public SDVariable gte(String name, SDVariable other) { """ Greater than or equal to operation: elementwise {@code this >= y}<br> If x and y arrays have equal shape, the output shape is the same as the inputs.<br> Supports broadcasting: if x and y have different shapes and are broadcastable, the output shape is broadcast.<br> Returns an array with values 1 where condition is satisfied, or value 0 otherwise. @param name Name of the output variable @param other Variable to compare values against @return Output SDVariable with values 0 (not satisfied) and 1 (where the condition is satisfied) """ return sameDiff.gte(name, this, other); }
java
public SDVariable gte(String name, SDVariable other){ return sameDiff.gte(name, this, other); }
[ "public", "SDVariable", "gte", "(", "String", "name", ",", "SDVariable", "other", ")", "{", "return", "sameDiff", ".", "gte", "(", "name", ",", "this", ",", "other", ")", ";", "}" ]
Greater than or equal to operation: elementwise {@code this >= y}<br> If x and y arrays have equal shape, the output shape is the same as the inputs.<br> Supports broadcasting: if x and y have different shapes and are broadcastable, the output shape is broadcast.<br> Returns an array with values 1 where condition is satisfied, or value 0 otherwise. @param name Name of the output variable @param other Variable to compare values against @return Output SDVariable with values 0 (not satisfied) and 1 (where the condition is satisfied)
[ "Greater", "than", "or", "equal", "to", "operation", ":", "elementwise", "{", "@code", "this", ">", "=", "y", "}", "<br", ">", "If", "x", "and", "y", "arrays", "have", "equal", "shape", "the", "output", "shape", "is", "the", "same", "as", "the", "inputs", ".", "<br", ">", "Supports", "broadcasting", ":", "if", "x", "and", "y", "have", "different", "shapes", "and", "are", "broadcastable", "the", "output", "shape", "is", "broadcast", ".", "<br", ">", "Returns", "an", "array", "with", "values", "1", "where", "condition", "is", "satisfied", "or", "value", "0", "otherwise", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SDVariable.java#L567-L569
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java
AtomicIntegerFieldUpdater.addAndGet
public int addAndGet(T obj, int delta) { """ Atomically adds the given value to the current value of the field of the given object managed by this updater. @param obj An object whose field to get and set @param delta the value to add @return the updated value """ int prev, next; do { prev = get(obj); next = prev + delta; } while (!compareAndSet(obj, prev, next)); return next; }
java
public int addAndGet(T obj, int delta) { int prev, next; do { prev = get(obj); next = prev + delta; } while (!compareAndSet(obj, prev, next)); return next; }
[ "public", "int", "addAndGet", "(", "T", "obj", ",", "int", "delta", ")", "{", "int", "prev", ",", "next", ";", "do", "{", "prev", "=", "get", "(", "obj", ")", ";", "next", "=", "prev", "+", "delta", ";", "}", "while", "(", "!", "compareAndSet", "(", "obj", ",", "prev", ",", "next", ")", ")", ";", "return", "next", ";", "}" ]
Atomically adds the given value to the current value of the field of the given object managed by this updater. @param obj An object whose field to get and set @param delta the value to add @return the updated value
[ "Atomically", "adds", "the", "given", "value", "to", "the", "current", "value", "of", "the", "field", "of", "the", "given", "object", "managed", "by", "this", "updater", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java#L265-L272
jbundle/jbundle
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java
ThinTableModel.setColumnValue
public boolean setColumnValue(int iColumnIndex, Object value, boolean bDisplay, int iMoveMode) { """ Set the value at the field at the column. Since this is only used by the restore current record method, pass dont_display and read_move when you set the data. This is NOT a TableModel override, this is my method. @param iColumnIndex The column. @param value The raw data value or string to set. @return True if the value at this cell changed. """ Convert fieldInfo = this.getFieldInfo(iColumnIndex); if (fieldInfo != null) { Object dataBefore = fieldInfo.getData(); if (!(value instanceof String)) fieldInfo.setData(value, bDisplay, iMoveMode); else fieldInfo.setString((String)value, bDisplay, iMoveMode); Object dataAfter = fieldInfo.getData(); if (dataBefore == null) return (dataAfter != null); else return (!dataBefore.equals(dataAfter)); } return false; }
java
public boolean setColumnValue(int iColumnIndex, Object value, boolean bDisplay, int iMoveMode) { Convert fieldInfo = this.getFieldInfo(iColumnIndex); if (fieldInfo != null) { Object dataBefore = fieldInfo.getData(); if (!(value instanceof String)) fieldInfo.setData(value, bDisplay, iMoveMode); else fieldInfo.setString((String)value, bDisplay, iMoveMode); Object dataAfter = fieldInfo.getData(); if (dataBefore == null) return (dataAfter != null); else return (!dataBefore.equals(dataAfter)); } return false; }
[ "public", "boolean", "setColumnValue", "(", "int", "iColumnIndex", ",", "Object", "value", ",", "boolean", "bDisplay", ",", "int", "iMoveMode", ")", "{", "Convert", "fieldInfo", "=", "this", ".", "getFieldInfo", "(", "iColumnIndex", ")", ";", "if", "(", "fieldInfo", "!=", "null", ")", "{", "Object", "dataBefore", "=", "fieldInfo", ".", "getData", "(", ")", ";", "if", "(", "!", "(", "value", "instanceof", "String", ")", ")", "fieldInfo", ".", "setData", "(", "value", ",", "bDisplay", ",", "iMoveMode", ")", ";", "else", "fieldInfo", ".", "setString", "(", "(", "String", ")", "value", ",", "bDisplay", ",", "iMoveMode", ")", ";", "Object", "dataAfter", "=", "fieldInfo", ".", "getData", "(", ")", ";", "if", "(", "dataBefore", "==", "null", ")", "return", "(", "dataAfter", "!=", "null", ")", ";", "else", "return", "(", "!", "dataBefore", ".", "equals", "(", "dataAfter", ")", ")", ";", "}", "return", "false", ";", "}" ]
Set the value at the field at the column. Since this is only used by the restore current record method, pass dont_display and read_move when you set the data. This is NOT a TableModel override, this is my method. @param iColumnIndex The column. @param value The raw data value or string to set. @return True if the value at this cell changed.
[ "Set", "the", "value", "at", "the", "field", "at", "the", "column", ".", "Since", "this", "is", "only", "used", "by", "the", "restore", "current", "record", "method", "pass", "dont_display", "and", "read_move", "when", "you", "set", "the", "data", ".", "This", "is", "NOT", "a", "TableModel", "override", "this", "is", "my", "method", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java#L291-L308
premium-minds/pm-wicket-utils
src/main/java/com/premiumminds/webapp/wicket/bootstrap/BootstrapDatePicker.java
BootstrapDatePicker.getDateTextField
public DateTextField getDateTextField() { """ Gets the DateTextField inside this datepicker wrapper. @return the date field """ DateTextField component = visitChildren(DateTextField.class, new IVisitor<DateTextField, DateTextField>() { @Override public void component(DateTextField arg0, IVisit<DateTextField> arg1) { arg1.stop(arg0); } }); if (component == null) throw new WicketRuntimeException("BootstrapDatepicker didn't have any DateTextField child!"); return component; }
java
public DateTextField getDateTextField(){ DateTextField component = visitChildren(DateTextField.class, new IVisitor<DateTextField, DateTextField>() { @Override public void component(DateTextField arg0, IVisit<DateTextField> arg1) { arg1.stop(arg0); } }); if (component == null) throw new WicketRuntimeException("BootstrapDatepicker didn't have any DateTextField child!"); return component; }
[ "public", "DateTextField", "getDateTextField", "(", ")", "{", "DateTextField", "component", "=", "visitChildren", "(", "DateTextField", ".", "class", ",", "new", "IVisitor", "<", "DateTextField", ",", "DateTextField", ">", "(", ")", "{", "@", "Override", "public", "void", "component", "(", "DateTextField", "arg0", ",", "IVisit", "<", "DateTextField", ">", "arg1", ")", "{", "arg1", ".", "stop", "(", "arg0", ")", ";", "}", "}", ")", ";", "if", "(", "component", "==", "null", ")", "throw", "new", "WicketRuntimeException", "(", "\"BootstrapDatepicker didn't have any DateTextField child!\"", ")", ";", "return", "component", ";", "}" ]
Gets the DateTextField inside this datepicker wrapper. @return the date field
[ "Gets", "the", "DateTextField", "inside", "this", "datepicker", "wrapper", "." ]
train
https://github.com/premium-minds/pm-wicket-utils/blob/ed28f4bfb2084dfb2649d9fa283754cb76894d2d/src/main/java/com/premiumminds/webapp/wicket/bootstrap/BootstrapDatePicker.java#L85-L97
FaritorKang/unmz-common-util
src/main/java/net/unmz/java/util/code/ImageCodeUtils.java
ImageCodeUtils.generateVerifyCode
public static String generateVerifyCode(int verifySize, String sources) { """ 使用指定源生成验证码 @param verifySize 验证码长度 @param sources 验证码字符源 @return """ if(sources == null || sources.length() == 0){ sources = VERIFY_CODES; } int codesLen = sources.length(); Random rand = new Random(System.currentTimeMillis()); StringBuilder verifyCode = new StringBuilder(verifySize); for(int i = 0; i < verifySize; i++){ verifyCode.append(sources.charAt(rand.nextInt(codesLen-1))); } return verifyCode.toString(); }
java
public static String generateVerifyCode(int verifySize, String sources){ if(sources == null || sources.length() == 0){ sources = VERIFY_CODES; } int codesLen = sources.length(); Random rand = new Random(System.currentTimeMillis()); StringBuilder verifyCode = new StringBuilder(verifySize); for(int i = 0; i < verifySize; i++){ verifyCode.append(sources.charAt(rand.nextInt(codesLen-1))); } return verifyCode.toString(); }
[ "public", "static", "String", "generateVerifyCode", "(", "int", "verifySize", ",", "String", "sources", ")", "{", "if", "(", "sources", "==", "null", "||", "sources", ".", "length", "(", ")", "==", "0", ")", "{", "sources", "=", "VERIFY_CODES", ";", "}", "int", "codesLen", "=", "sources", ".", "length", "(", ")", ";", "Random", "rand", "=", "new", "Random", "(", "System", ".", "currentTimeMillis", "(", ")", ")", ";", "StringBuilder", "verifyCode", "=", "new", "StringBuilder", "(", "verifySize", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "verifySize", ";", "i", "++", ")", "{", "verifyCode", ".", "append", "(", "sources", ".", "charAt", "(", "rand", ".", "nextInt", "(", "codesLen", "-", "1", ")", ")", ")", ";", "}", "return", "verifyCode", ".", "toString", "(", ")", ";", "}" ]
使用指定源生成验证码 @param verifySize 验证码长度 @param sources 验证码字符源 @return
[ "使用指定源生成验证码" ]
train
https://github.com/FaritorKang/unmz-common-util/blob/2912b8889b85ed910d536f85b24b6fa68035814a/src/main/java/net/unmz/java/util/code/ImageCodeUtils.java#L43-L54
gallandarakhneorg/afc
core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java
Path3d.lineTo
public void lineTo(double x, double y, double z) { """ Adds a point to the path by drawing a straight line from the current coordinates to the new specified coordinates specified in double precision. @param x the specified X coordinate @param y the specified Y coordinate @param z the specified Z coordinate """ ensureSlots(true, 3); this.types[this.numTypesProperty.get()] = PathElementType.LINE_TO; this.numTypesProperty.set(this.numTypesProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()].set(x); this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()].set(y); this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()].set(z); this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.isEmptyProperty = null; this.graphicalBounds = null; this.logicalBounds = null; }
java
public void lineTo(double x, double y, double z) { ensureSlots(true, 3); this.types[this.numTypesProperty.get()] = PathElementType.LINE_TO; this.numTypesProperty.set(this.numTypesProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()].set(x); this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()].set(y); this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()].set(z); this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.isEmptyProperty = null; this.graphicalBounds = null; this.logicalBounds = null; }
[ "public", "void", "lineTo", "(", "double", "x", ",", "double", "y", ",", "double", "z", ")", "{", "ensureSlots", "(", "true", ",", "3", ")", ";", "this", ".", "types", "[", "this", ".", "numTypesProperty", ".", "get", "(", ")", "]", "=", "PathElementType", ".", "LINE_TO", ";", "this", ".", "numTypesProperty", ".", "set", "(", "this", ".", "numTypesProperty", ".", "get", "(", ")", "+", "1", ")", ";", "this", ".", "coordsProperty", "[", "this", ".", "numCoordsProperty", ".", "get", "(", ")", "]", ".", "set", "(", "x", ")", ";", "this", ".", "numCoordsProperty", ".", "set", "(", "this", ".", "numCoordsProperty", ".", "get", "(", ")", "+", "1", ")", ";", "this", ".", "coordsProperty", "[", "this", ".", "numCoordsProperty", ".", "get", "(", ")", "]", ".", "set", "(", "y", ")", ";", "this", ".", "numCoordsProperty", ".", "set", "(", "this", ".", "numCoordsProperty", ".", "get", "(", ")", "+", "1", ")", ";", "this", ".", "coordsProperty", "[", "this", ".", "numCoordsProperty", ".", "get", "(", ")", "]", ".", "set", "(", "z", ")", ";", "this", ".", "numCoordsProperty", ".", "set", "(", "this", ".", "numCoordsProperty", ".", "get", "(", ")", "+", "1", ")", ";", "this", ".", "isEmptyProperty", "=", "null", ";", "this", ".", "graphicalBounds", "=", "null", ";", "this", ".", "logicalBounds", "=", "null", ";", "}" ]
Adds a point to the path by drawing a straight line from the current coordinates to the new specified coordinates specified in double precision. @param x the specified X coordinate @param y the specified Y coordinate @param z the specified Z coordinate
[ "Adds", "a", "point", "to", "the", "path", "by", "drawing", "a", "straight", "line", "from", "the", "current", "coordinates", "to", "the", "new", "specified", "coordinates", "specified", "in", "double", "precision", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java#L2106-L2123
JOML-CI/JOML
src/org/joml/Matrix4x3d.java
Matrix4x3d.translationRotateMul
public Matrix4x3d translationRotateMul(double tx, double ty, double tz, Quaternionfc quat, Matrix4x3dc mat) { """ Set <code>this</code> matrix to <code>T * R * M</code>, where <code>T</code> is a translation by the given <code>(tx, ty, tz)</code>, <code>R</code> is a rotation - and possibly scaling - transformation specified by the given quaternion and <code>M</code> is the given matrix <code>mat</code>. <p> When transforming a vector by the resulting matrix the transformation described by <code>M</code> will be applied first, then the scaling, then rotation and at last the translation. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> This method is equivalent to calling: <code>translation(tx, ty, tz).rotate(quat).mul(mat)</code> @see #translation(double, double, double) @see #rotate(Quaternionfc) @see #mul(Matrix4x3dc) @param tx the number of units by which to translate the x-component @param ty the number of units by which to translate the y-component @param tz the number of units by which to translate the z-component @param quat the quaternion representing a rotation @param mat the matrix to multiply with @return this """ return translationRotateMul(tx, ty, tz, quat.x(), quat.y(), quat.z(), quat.w(), mat); }
java
public Matrix4x3d translationRotateMul(double tx, double ty, double tz, Quaternionfc quat, Matrix4x3dc mat) { return translationRotateMul(tx, ty, tz, quat.x(), quat.y(), quat.z(), quat.w(), mat); }
[ "public", "Matrix4x3d", "translationRotateMul", "(", "double", "tx", ",", "double", "ty", ",", "double", "tz", ",", "Quaternionfc", "quat", ",", "Matrix4x3dc", "mat", ")", "{", "return", "translationRotateMul", "(", "tx", ",", "ty", ",", "tz", ",", "quat", ".", "x", "(", ")", ",", "quat", ".", "y", "(", ")", ",", "quat", ".", "z", "(", ")", ",", "quat", ".", "w", "(", ")", ",", "mat", ")", ";", "}" ]
Set <code>this</code> matrix to <code>T * R * M</code>, where <code>T</code> is a translation by the given <code>(tx, ty, tz)</code>, <code>R</code> is a rotation - and possibly scaling - transformation specified by the given quaternion and <code>M</code> is the given matrix <code>mat</code>. <p> When transforming a vector by the resulting matrix the transformation described by <code>M</code> will be applied first, then the scaling, then rotation and at last the translation. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> This method is equivalent to calling: <code>translation(tx, ty, tz).rotate(quat).mul(mat)</code> @see #translation(double, double, double) @see #rotate(Quaternionfc) @see #mul(Matrix4x3dc) @param tx the number of units by which to translate the x-component @param ty the number of units by which to translate the y-component @param tz the number of units by which to translate the z-component @param quat the quaternion representing a rotation @param mat the matrix to multiply with @return this
[ "Set", "<code", ">", "this<", "/", "code", ">", "matrix", "to", "<code", ">", "T", "*", "R", "*", "M<", "/", "code", ">", "where", "<code", ">", "T<", "/", "code", ">", "is", "a", "translation", "by", "the", "given", "<code", ">", "(", "tx", "ty", "tz", ")", "<", "/", "code", ">", "<code", ">", "R<", "/", "code", ">", "is", "a", "rotation", "-", "and", "possibly", "scaling", "-", "transformation", "specified", "by", "the", "given", "quaternion", "and", "<code", ">", "M<", "/", "code", ">", "is", "the", "given", "matrix", "<code", ">", "mat<", "/", "code", ">", ".", "<p", ">", "When", "transforming", "a", "vector", "by", "the", "resulting", "matrix", "the", "transformation", "described", "by", "<code", ">", "M<", "/", "code", ">", "will", "be", "applied", "first", "then", "the", "scaling", "then", "rotation", "and", "at", "last", "the", "translation", ".", "<p", ">", "When", "used", "with", "a", "right", "-", "handed", "coordinate", "system", "the", "produced", "rotation", "will", "rotate", "a", "vector", "counter", "-", "clockwise", "around", "the", "rotation", "axis", "when", "viewing", "along", "the", "negative", "axis", "direction", "towards", "the", "origin", ".", "When", "used", "with", "a", "left", "-", "handed", "coordinate", "system", "the", "rotation", "is", "clockwise", ".", "<p", ">", "This", "method", "is", "equivalent", "to", "calling", ":", "<code", ">", "translation", "(", "tx", "ty", "tz", ")", ".", "rotate", "(", "quat", ")", ".", "mul", "(", "mat", ")", "<", "/", "code", ">" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3d.java#L5140-L5142
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/dialog/SARLAgentMainLaunchConfigurationTab.java
SARLAgentMainLaunchConfigurationTab.createLaunchOptionEditor
protected void createLaunchOptionEditor(Composite parent, String text) { """ Creates the widgets for configuring the launch options. @param parent the parent composite. @param text the label of the group. """ final Group group = SWTFactory.createGroup(parent, text, 1, 1, GridData.FILL_HORIZONTAL); this.showLogoOptionButton = createCheckButton(group, Messages.MainLaunchConfigurationTab_14); this.showLogoOptionButton.addSelectionListener(this.defaultListener); this.showLogInfoButton = createCheckButton(group, Messages.MainLaunchConfigurationTab_15); this.showLogInfoButton.addSelectionListener(this.defaultListener); this.offlineButton = createCheckButton(group, Messages.MainLaunchConfigurationTab_16); this.offlineButton.addSelectionListener(this.defaultListener); this.enableAssertionsInRunModeButton = createCheckButton(group, Messages.SARLMainLaunchConfigurationTab_2); this.enableAssertionsInRunModeButton.addSelectionListener(this.defaultListener); this.enableAssertionsInDebugModeButton = createCheckButton(group, Messages.SARLMainLaunchConfigurationTab_1); this.enableAssertionsInDebugModeButton.addSelectionListener(this.defaultListener); this.runInEclipseButton = createCheckButton(group, Messages.SARLMainLaunchConfigurationTab_0); this.runInEclipseButton.addSelectionListener(this.defaultListener); }
java
protected void createLaunchOptionEditor(Composite parent, String text) { final Group group = SWTFactory.createGroup(parent, text, 1, 1, GridData.FILL_HORIZONTAL); this.showLogoOptionButton = createCheckButton(group, Messages.MainLaunchConfigurationTab_14); this.showLogoOptionButton.addSelectionListener(this.defaultListener); this.showLogInfoButton = createCheckButton(group, Messages.MainLaunchConfigurationTab_15); this.showLogInfoButton.addSelectionListener(this.defaultListener); this.offlineButton = createCheckButton(group, Messages.MainLaunchConfigurationTab_16); this.offlineButton.addSelectionListener(this.defaultListener); this.enableAssertionsInRunModeButton = createCheckButton(group, Messages.SARLMainLaunchConfigurationTab_2); this.enableAssertionsInRunModeButton.addSelectionListener(this.defaultListener); this.enableAssertionsInDebugModeButton = createCheckButton(group, Messages.SARLMainLaunchConfigurationTab_1); this.enableAssertionsInDebugModeButton.addSelectionListener(this.defaultListener); this.runInEclipseButton = createCheckButton(group, Messages.SARLMainLaunchConfigurationTab_0); this.runInEclipseButton.addSelectionListener(this.defaultListener); }
[ "protected", "void", "createLaunchOptionEditor", "(", "Composite", "parent", ",", "String", "text", ")", "{", "final", "Group", "group", "=", "SWTFactory", ".", "createGroup", "(", "parent", ",", "text", ",", "1", ",", "1", ",", "GridData", ".", "FILL_HORIZONTAL", ")", ";", "this", ".", "showLogoOptionButton", "=", "createCheckButton", "(", "group", ",", "Messages", ".", "MainLaunchConfigurationTab_14", ")", ";", "this", ".", "showLogoOptionButton", ".", "addSelectionListener", "(", "this", ".", "defaultListener", ")", ";", "this", ".", "showLogInfoButton", "=", "createCheckButton", "(", "group", ",", "Messages", ".", "MainLaunchConfigurationTab_15", ")", ";", "this", ".", "showLogInfoButton", ".", "addSelectionListener", "(", "this", ".", "defaultListener", ")", ";", "this", ".", "offlineButton", "=", "createCheckButton", "(", "group", ",", "Messages", ".", "MainLaunchConfigurationTab_16", ")", ";", "this", ".", "offlineButton", ".", "addSelectionListener", "(", "this", ".", "defaultListener", ")", ";", "this", ".", "enableAssertionsInRunModeButton", "=", "createCheckButton", "(", "group", ",", "Messages", ".", "SARLMainLaunchConfigurationTab_2", ")", ";", "this", ".", "enableAssertionsInRunModeButton", ".", "addSelectionListener", "(", "this", ".", "defaultListener", ")", ";", "this", ".", "enableAssertionsInDebugModeButton", "=", "createCheckButton", "(", "group", ",", "Messages", ".", "SARLMainLaunchConfigurationTab_1", ")", ";", "this", ".", "enableAssertionsInDebugModeButton", ".", "addSelectionListener", "(", "this", ".", "defaultListener", ")", ";", "this", ".", "runInEclipseButton", "=", "createCheckButton", "(", "group", ",", "Messages", ".", "SARLMainLaunchConfigurationTab_0", ")", ";", "this", ".", "runInEclipseButton", ".", "addSelectionListener", "(", "this", ".", "defaultListener", ")", ";", "}" ]
Creates the widgets for configuring the launch options. @param parent the parent composite. @param text the label of the group.
[ "Creates", "the", "widgets", "for", "configuring", "the", "launch", "options", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/dialog/SARLAgentMainLaunchConfigurationTab.java#L226-L240
mcxiaoke/Android-Next
core/src/main/java/com/mcxiaoke/next/utils/IOUtils.java
IOUtils.readStringFromRaw
public static String readStringFromRaw(Context context, int resId) throws IOException { """ get content from a raw resource. This can only be used with resources whose value is the name of an asset files -- that is, it can be used to open drawable, sound, and raw resources; it will fail on string and color resources. @param context @param resId The resource identifier to open, as generated by the appt tool. @return """ if (context == null) { return null; } StringBuilder s = new StringBuilder(); InputStreamReader in = new InputStreamReader(context.getResources().openRawResource(resId)); BufferedReader br = new BufferedReader(in); String line; while ((line = br.readLine()) != null) { s.append(line); } return s.toString(); }
java
public static String readStringFromRaw(Context context, int resId) throws IOException { if (context == null) { return null; } StringBuilder s = new StringBuilder(); InputStreamReader in = new InputStreamReader(context.getResources().openRawResource(resId)); BufferedReader br = new BufferedReader(in); String line; while ((line = br.readLine()) != null) { s.append(line); } return s.toString(); }
[ "public", "static", "String", "readStringFromRaw", "(", "Context", "context", ",", "int", "resId", ")", "throws", "IOException", "{", "if", "(", "context", "==", "null", ")", "{", "return", "null", ";", "}", "StringBuilder", "s", "=", "new", "StringBuilder", "(", ")", ";", "InputStreamReader", "in", "=", "new", "InputStreamReader", "(", "context", ".", "getResources", "(", ")", ".", "openRawResource", "(", "resId", ")", ")", ";", "BufferedReader", "br", "=", "new", "BufferedReader", "(", "in", ")", ";", "String", "line", ";", "while", "(", "(", "line", "=", "br", ".", "readLine", "(", ")", ")", "!=", "null", ")", "{", "s", ".", "append", "(", "line", ")", ";", "}", "return", "s", ".", "toString", "(", ")", ";", "}" ]
get content from a raw resource. This can only be used with resources whose value is the name of an asset files -- that is, it can be used to open drawable, sound, and raw resources; it will fail on string and color resources. @param context @param resId The resource identifier to open, as generated by the appt tool. @return
[ "get", "content", "from", "a", "raw", "resource", ".", "This", "can", "only", "be", "used", "with", "resources", "whose", "value", "is", "the", "name", "of", "an", "asset", "files", "--", "that", "is", "it", "can", "be", "used", "to", "open", "drawable", "sound", "and", "raw", "resources", ";", "it", "will", "fail", "on", "string", "and", "color", "resources", "." ]
train
https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/core/src/main/java/com/mcxiaoke/next/utils/IOUtils.java#L1086-L1099
sagiegurari/fax4j
src/main/java/org/fax4j/spi/hylafax/HylaFaxJob.java
HylaFaxJob.setSenderName
public void setSenderName(String senderName) { """ This function sets the fax job sender name. @param senderName The fax job sender name """ try { this.JOB.setFromUser(senderName); } catch(Exception exception) { throw new FaxException("Error while setting job sender name.",exception); } }
java
public void setSenderName(String senderName) { try { this.JOB.setFromUser(senderName); } catch(Exception exception) { throw new FaxException("Error while setting job sender name.",exception); } }
[ "public", "void", "setSenderName", "(", "String", "senderName", ")", "{", "try", "{", "this", ".", "JOB", ".", "setFromUser", "(", "senderName", ")", ";", "}", "catch", "(", "Exception", "exception", ")", "{", "throw", "new", "FaxException", "(", "\"Error while setting job sender name.\"", ",", "exception", ")", ";", "}", "}" ]
This function sets the fax job sender name. @param senderName The fax job sender name
[ "This", "function", "sets", "the", "fax", "job", "sender", "name", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/hylafax/HylaFaxJob.java#L246-L256
js-lib-com/commons
src/main/java/js/util/Params.java
Params.isFile
public static void isFile(File parameter, String name) throws IllegalArgumentException { """ Check if file parameter is an existing ordinary file, not a directory. This validator throws illegal argument if given file does not exist or is not an ordinary file. @param parameter invocation file parameter, @param name parameter name. @throws IllegalArgumentException if <code>parameter</code> file is null or does not exist or is a directory. """ if (parameter == null || !parameter.exists() || parameter.isDirectory()) { throw new IllegalArgumentException(String.format("%s |%s| is missing or is a directory.", name, parameter.getAbsolutePath())); } }
java
public static void isFile(File parameter, String name) throws IllegalArgumentException { if (parameter == null || !parameter.exists() || parameter.isDirectory()) { throw new IllegalArgumentException(String.format("%s |%s| is missing or is a directory.", name, parameter.getAbsolutePath())); } }
[ "public", "static", "void", "isFile", "(", "File", "parameter", ",", "String", "name", ")", "throws", "IllegalArgumentException", "{", "if", "(", "parameter", "==", "null", "||", "!", "parameter", ".", "exists", "(", ")", "||", "parameter", ".", "isDirectory", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"%s |%s| is missing or is a directory.\"", ",", "name", ",", "parameter", ".", "getAbsolutePath", "(", ")", ")", ")", ";", "}", "}" ]
Check if file parameter is an existing ordinary file, not a directory. This validator throws illegal argument if given file does not exist or is not an ordinary file. @param parameter invocation file parameter, @param name parameter name. @throws IllegalArgumentException if <code>parameter</code> file is null or does not exist or is a directory.
[ "Check", "if", "file", "parameter", "is", "an", "existing", "ordinary", "file", "not", "a", "directory", ".", "This", "validator", "throws", "illegal", "argument", "if", "given", "file", "does", "not", "exist", "or", "is", "not", "an", "ordinary", "file", "." ]
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Params.java#L176-L180
Axway/Grapes
utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java
GrapesClient.postBuildInfo
public void postBuildInfo(final String moduleName, final String moduleVersion, final Map<String, String> buildInfo, final String user, final String password) throws GrapesCommunicationException, AuthenticationException { """ Post a build info to the server @param moduleName String @param moduleVersion String @param buildInfo Map<String,String> @param user String @param password String @throws GrapesCommunicationException @throws javax.naming.AuthenticationException """ final Client client = getClient(user, password); final WebResource resource = client.resource(serverURL).path(RequestUtils.getBuildInfoPath(moduleName, moduleVersion)); final ClientResponse response = resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, buildInfo); client.destroy(); if(ClientResponse.Status.CREATED.getStatusCode() != response.getStatus()){ final String message = "Failed to POST buildInfo"; if(LOG.isErrorEnabled()) { LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus())); } throw new GrapesCommunicationException(message, response.getStatus()); } }
java
public void postBuildInfo(final String moduleName, final String moduleVersion, final Map<String, String> buildInfo, final String user, final String password) throws GrapesCommunicationException, AuthenticationException { final Client client = getClient(user, password); final WebResource resource = client.resource(serverURL).path(RequestUtils.getBuildInfoPath(moduleName, moduleVersion)); final ClientResponse response = resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, buildInfo); client.destroy(); if(ClientResponse.Status.CREATED.getStatusCode() != response.getStatus()){ final String message = "Failed to POST buildInfo"; if(LOG.isErrorEnabled()) { LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus())); } throw new GrapesCommunicationException(message, response.getStatus()); } }
[ "public", "void", "postBuildInfo", "(", "final", "String", "moduleName", ",", "final", "String", "moduleVersion", ",", "final", "Map", "<", "String", ",", "String", ">", "buildInfo", ",", "final", "String", "user", ",", "final", "String", "password", ")", "throws", "GrapesCommunicationException", ",", "AuthenticationException", "{", "final", "Client", "client", "=", "getClient", "(", "user", ",", "password", ")", ";", "final", "WebResource", "resource", "=", "client", ".", "resource", "(", "serverURL", ")", ".", "path", "(", "RequestUtils", ".", "getBuildInfoPath", "(", "moduleName", ",", "moduleVersion", ")", ")", ";", "final", "ClientResponse", "response", "=", "resource", ".", "type", "(", "MediaType", ".", "APPLICATION_JSON", ")", ".", "post", "(", "ClientResponse", ".", "class", ",", "buildInfo", ")", ";", "client", ".", "destroy", "(", ")", ";", "if", "(", "ClientResponse", ".", "Status", ".", "CREATED", ".", "getStatusCode", "(", ")", "!=", "response", ".", "getStatus", "(", ")", ")", "{", "final", "String", "message", "=", "\"Failed to POST buildInfo\"", ";", "if", "(", "LOG", ".", "isErrorEnabled", "(", ")", ")", "{", "LOG", ".", "error", "(", "String", ".", "format", "(", "HTTP_STATUS_TEMPLATE_MSG", ",", "message", ",", "response", ".", "getStatus", "(", ")", ")", ")", ";", "}", "throw", "new", "GrapesCommunicationException", "(", "message", ",", "response", ".", "getStatus", "(", ")", ")", ";", "}", "}" ]
Post a build info to the server @param moduleName String @param moduleVersion String @param buildInfo Map<String,String> @param user String @param password String @throws GrapesCommunicationException @throws javax.naming.AuthenticationException
[ "Post", "a", "build", "info", "to", "the", "server" ]
train
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L130-L143
Whiley/WhileyCompiler
src/main/java/wyc/io/WhileyFileParser.java
WhileyFileParser.parseQuantifierExpression
private Expr parseQuantifierExpression(Token lookahead, EnclosingScope scope, boolean terminated) { """ Parse a quantifier expression, which is of the form: <pre> QuantExpr ::= ("no" | "some" | "all") '{' Identifier "in" Expr (',' Identifier "in" Expr)+ '|' LogicalExpr '}' </pre> @param scope The enclosing scope for this statement, which determines the set of visible (i.e. declared) variables and also the current indentation level. @param terminated This indicates that the expression is known to be terminated (or not). An expression that's known to be terminated is one which is guaranteed to be followed by something. This is important because it means that we can ignore any newline characters encountered in parsing this expression, and that we'll never overrun the end of the expression (i.e. because there's guaranteed to be something which terminates this expression). A classic situation where terminated is true is when parsing an expression surrounded in braces. In such case, we know the right-brace will always terminate this expression. @return """ int start = index - 1; scope = scope.newEnclosingScope(); match(LeftCurly); // Parse one or more source variables / expressions Tuple<Decl.Variable> parameters = parseQuantifierParameters(scope); // Parse condition over source variables Expr condition = parseLogicalExpression(scope, true); // match(RightCurly); // Expr.Quantifier qf; if (lookahead.kind == All) { qf = new Expr.UniversalQuantifier(parameters, condition); } else { qf = new Expr.ExistentialQuantifier(parameters, condition); } return annotateSourceLocation(qf, start); }
java
private Expr parseQuantifierExpression(Token lookahead, EnclosingScope scope, boolean terminated) { int start = index - 1; scope = scope.newEnclosingScope(); match(LeftCurly); // Parse one or more source variables / expressions Tuple<Decl.Variable> parameters = parseQuantifierParameters(scope); // Parse condition over source variables Expr condition = parseLogicalExpression(scope, true); // match(RightCurly); // Expr.Quantifier qf; if (lookahead.kind == All) { qf = new Expr.UniversalQuantifier(parameters, condition); } else { qf = new Expr.ExistentialQuantifier(parameters, condition); } return annotateSourceLocation(qf, start); }
[ "private", "Expr", "parseQuantifierExpression", "(", "Token", "lookahead", ",", "EnclosingScope", "scope", ",", "boolean", "terminated", ")", "{", "int", "start", "=", "index", "-", "1", ";", "scope", "=", "scope", ".", "newEnclosingScope", "(", ")", ";", "match", "(", "LeftCurly", ")", ";", "// Parse one or more source variables / expressions", "Tuple", "<", "Decl", ".", "Variable", ">", "parameters", "=", "parseQuantifierParameters", "(", "scope", ")", ";", "// Parse condition over source variables", "Expr", "condition", "=", "parseLogicalExpression", "(", "scope", ",", "true", ")", ";", "//", "match", "(", "RightCurly", ")", ";", "//", "Expr", ".", "Quantifier", "qf", ";", "if", "(", "lookahead", ".", "kind", "==", "All", ")", "{", "qf", "=", "new", "Expr", ".", "UniversalQuantifier", "(", "parameters", ",", "condition", ")", ";", "}", "else", "{", "qf", "=", "new", "Expr", ".", "ExistentialQuantifier", "(", "parameters", ",", "condition", ")", ";", "}", "return", "annotateSourceLocation", "(", "qf", ",", "start", ")", ";", "}" ]
Parse a quantifier expression, which is of the form: <pre> QuantExpr ::= ("no" | "some" | "all") '{' Identifier "in" Expr (',' Identifier "in" Expr)+ '|' LogicalExpr '}' </pre> @param scope The enclosing scope for this statement, which determines the set of visible (i.e. declared) variables and also the current indentation level. @param terminated This indicates that the expression is known to be terminated (or not). An expression that's known to be terminated is one which is guaranteed to be followed by something. This is important because it means that we can ignore any newline characters encountered in parsing this expression, and that we'll never overrun the end of the expression (i.e. because there's guaranteed to be something which terminates this expression). A classic situation where terminated is true is when parsing an expression surrounded in braces. In such case, we know the right-brace will always terminate this expression. @return
[ "Parse", "a", "quantifier", "expression", "which", "is", "of", "the", "form", ":" ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L1932-L1950
Bearded-Hen/Android-Bootstrap
AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/utils/DimenUtils.java
DimenUtils.pixelsFromSpResource
public static float pixelsFromSpResource(Context context, @DimenRes int sizeRes) { """ Resolves a dimension resource that uses scaled pixels @param context the current context @param sizeRes the dimension resource holding an SP value @return the text size in pixels """ final Resources res = context.getResources(); return res.getDimension(sizeRes) / res.getDisplayMetrics().density; }
java
public static float pixelsFromSpResource(Context context, @DimenRes int sizeRes) { final Resources res = context.getResources(); return res.getDimension(sizeRes) / res.getDisplayMetrics().density; }
[ "public", "static", "float", "pixelsFromSpResource", "(", "Context", "context", ",", "@", "DimenRes", "int", "sizeRes", ")", "{", "final", "Resources", "res", "=", "context", ".", "getResources", "(", ")", ";", "return", "res", ".", "getDimension", "(", "sizeRes", ")", "/", "res", ".", "getDisplayMetrics", "(", ")", ".", "density", ";", "}" ]
Resolves a dimension resource that uses scaled pixels @param context the current context @param sizeRes the dimension resource holding an SP value @return the text size in pixels
[ "Resolves", "a", "dimension", "resource", "that", "uses", "scaled", "pixels" ]
train
https://github.com/Bearded-Hen/Android-Bootstrap/blob/b3d62cc1847e26d420c53c92665a4fe1e6ee7ecf/AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/utils/DimenUtils.java#L19-L22
jamesagnew/hapi-fhir
hapi-fhir-narrativegenerator/src/main/java/ca/uhn/fhir/narrative/template/filters/Capitalize.java
Capitalize.apply
@Override public Object apply(Object value, Object... params) { """ /* (Object) capitalize(input) capitalize words in the input sentence """ String original = super.asString(value); if (original.isEmpty()) { return original; } char first = original.charAt(0); return Character.toUpperCase(first) + original.substring(1); }
java
@Override public Object apply(Object value, Object... params) { String original = super.asString(value); if (original.isEmpty()) { return original; } char first = original.charAt(0); return Character.toUpperCase(first) + original.substring(1); }
[ "@", "Override", "public", "Object", "apply", "(", "Object", "value", ",", "Object", "...", "params", ")", "{", "String", "original", "=", "super", ".", "asString", "(", "value", ")", ";", "if", "(", "original", ".", "isEmpty", "(", ")", ")", "{", "return", "original", ";", "}", "char", "first", "=", "original", ".", "charAt", "(", "0", ")", ";", "return", "Character", ".", "toUpperCase", "(", "first", ")", "+", "original", ".", "substring", "(", "1", ")", ";", "}" ]
/* (Object) capitalize(input) capitalize words in the input sentence
[ "/", "*", "(", "Object", ")", "capitalize", "(", "input", ")" ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-narrativegenerator/src/main/java/ca/uhn/fhir/narrative/template/filters/Capitalize.java#L10-L22
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/convert/PercentConverter.java
PercentConverter.setString
public int setString(String strValue, boolean bDisplayOption, int iMoveMode) { """ Convert and move string to this field. @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). """ NumberField numberField = (NumberField)this.getField(); if ((strValue == null) || (strValue.length() == 0)) return super.setString(strValue, bDisplayOption, iMoveMode); // Don't trip change or display Number tempBinary = null; try { tempBinary = (Number)numberField.stringToBinary(strValue); } catch (Exception ex) { Task task = numberField.getRecord().getRecordOwner().getTask(); return task.setLastError(ex.getMessage()); } double dValue = tempBinary.doubleValue(); if (dValue != 0) dValue = dValue / 100; return this.setValue(dValue, bDisplayOption, iMoveMode); }
java
public int setString(String strValue, boolean bDisplayOption, int iMoveMode) { NumberField numberField = (NumberField)this.getField(); if ((strValue == null) || (strValue.length() == 0)) return super.setString(strValue, bDisplayOption, iMoveMode); // Don't trip change or display Number tempBinary = null; try { tempBinary = (Number)numberField.stringToBinary(strValue); } catch (Exception ex) { Task task = numberField.getRecord().getRecordOwner().getTask(); return task.setLastError(ex.getMessage()); } double dValue = tempBinary.doubleValue(); if (dValue != 0) dValue = dValue / 100; return this.setValue(dValue, bDisplayOption, iMoveMode); }
[ "public", "int", "setString", "(", "String", "strValue", ",", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "NumberField", "numberField", "=", "(", "NumberField", ")", "this", ".", "getField", "(", ")", ";", "if", "(", "(", "strValue", "==", "null", ")", "||", "(", "strValue", ".", "length", "(", ")", "==", "0", ")", ")", "return", "super", ".", "setString", "(", "strValue", ",", "bDisplayOption", ",", "iMoveMode", ")", ";", "// Don't trip change or display", "Number", "tempBinary", "=", "null", ";", "try", "{", "tempBinary", "=", "(", "Number", ")", "numberField", ".", "stringToBinary", "(", "strValue", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "Task", "task", "=", "numberField", ".", "getRecord", "(", ")", ".", "getRecordOwner", "(", ")", ".", "getTask", "(", ")", ";", "return", "task", ".", "setLastError", "(", "ex", ".", "getMessage", "(", ")", ")", ";", "}", "double", "dValue", "=", "tempBinary", ".", "doubleValue", "(", ")", ";", "if", "(", "dValue", "!=", "0", ")", "dValue", "=", "dValue", "/", "100", ";", "return", "this", ".", "setValue", "(", "dValue", ",", "bDisplayOption", ",", "iMoveMode", ")", ";", "}" ]
Convert and move string to this field. @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", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/PercentConverter.java#L68-L84
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/generalize/ST_PrecisionReducer.java
ST_PrecisionReducer.precisionReducer
public static Geometry precisionReducer(Geometry geometry, int nbDec) throws SQLException { """ Reduce the geometry precision. Decimal_Place is the number of decimals to keep. @param geometry @param nbDec @return @throws SQLException """ if(geometry == null){ return null; } if (nbDec < 0) { throw new SQLException("Decimal_places has to be >= 0."); } PrecisionModel pm = new PrecisionModel(scaleFactorForDecimalPlaces(nbDec)); GeometryPrecisionReducer geometryPrecisionReducer = new GeometryPrecisionReducer(pm); return geometryPrecisionReducer.reduce(geometry); }
java
public static Geometry precisionReducer(Geometry geometry, int nbDec) throws SQLException { if(geometry == null){ return null; } if (nbDec < 0) { throw new SQLException("Decimal_places has to be >= 0."); } PrecisionModel pm = new PrecisionModel(scaleFactorForDecimalPlaces(nbDec)); GeometryPrecisionReducer geometryPrecisionReducer = new GeometryPrecisionReducer(pm); return geometryPrecisionReducer.reduce(geometry); }
[ "public", "static", "Geometry", "precisionReducer", "(", "Geometry", "geometry", ",", "int", "nbDec", ")", "throws", "SQLException", "{", "if", "(", "geometry", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "nbDec", "<", "0", ")", "{", "throw", "new", "SQLException", "(", "\"Decimal_places has to be >= 0.\"", ")", ";", "}", "PrecisionModel", "pm", "=", "new", "PrecisionModel", "(", "scaleFactorForDecimalPlaces", "(", "nbDec", ")", ")", ";", "GeometryPrecisionReducer", "geometryPrecisionReducer", "=", "new", "GeometryPrecisionReducer", "(", "pm", ")", ";", "return", "geometryPrecisionReducer", ".", "reduce", "(", "geometry", ")", ";", "}" ]
Reduce the geometry precision. Decimal_Place is the number of decimals to keep. @param geometry @param nbDec @return @throws SQLException
[ "Reduce", "the", "geometry", "precision", ".", "Decimal_Place", "is", "the", "number", "of", "decimals", "to", "keep", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/generalize/ST_PrecisionReducer.java#L54-L64
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/AnnotationUtils.java
AnnotationUtils.memberEquals
@GwtIncompatible("incompatible method") private static boolean memberEquals(final Class<?> type, final Object o1, final Object o2) { """ Helper method for checking whether two objects of the given type are equal. This method is used to compare the parameters of two annotation instances. @param type the type of the objects to be compared @param o1 the first object @param o2 the second object @return a flag whether these objects are equal """ if (o1 == o2) { return true; } if (o1 == null || o2 == null) { return false; } if (type.isArray()) { return arrayMemberEquals(type.getComponentType(), o1, o2); } if (type.isAnnotation()) { return equals((Annotation) o1, (Annotation) o2); } return o1.equals(o2); }
java
@GwtIncompatible("incompatible method") private static boolean memberEquals(final Class<?> type, final Object o1, final Object o2) { if (o1 == o2) { return true; } if (o1 == null || o2 == null) { return false; } if (type.isArray()) { return arrayMemberEquals(type.getComponentType(), o1, o2); } if (type.isAnnotation()) { return equals((Annotation) o1, (Annotation) o2); } return o1.equals(o2); }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "private", "static", "boolean", "memberEquals", "(", "final", "Class", "<", "?", ">", "type", ",", "final", "Object", "o1", ",", "final", "Object", "o2", ")", "{", "if", "(", "o1", "==", "o2", ")", "{", "return", "true", ";", "}", "if", "(", "o1", "==", "null", "||", "o2", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "type", ".", "isArray", "(", ")", ")", "{", "return", "arrayMemberEquals", "(", "type", ".", "getComponentType", "(", ")", ",", "o1", ",", "o2", ")", ";", "}", "if", "(", "type", ".", "isAnnotation", "(", ")", ")", "{", "return", "equals", "(", "(", "Annotation", ")", "o1", ",", "(", "Annotation", ")", "o2", ")", ";", "}", "return", "o1", ".", "equals", "(", "o2", ")", ";", "}" ]
Helper method for checking whether two objects of the given type are equal. This method is used to compare the parameters of two annotation instances. @param type the type of the objects to be compared @param o1 the first object @param o2 the second object @return a flag whether these objects are equal
[ "Helper", "method", "for", "checking", "whether", "two", "objects", "of", "the", "given", "type", "are", "equal", ".", "This", "method", "is", "used", "to", "compare", "the", "parameters", "of", "two", "annotation", "instances", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/AnnotationUtils.java#L269-L284
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/KeyAgreement.java
KeyAgreement.generateSecret
public final int generateSecret(byte[] sharedSecret, int offset) throws IllegalStateException, ShortBufferException { """ Generates the shared secret, and places it into the buffer <code>sharedSecret</code>, beginning at <code>offset</code> inclusive. <p>If the <code>sharedSecret</code> buffer is too small to hold the result, a <code>ShortBufferException</code> is thrown. In this case, this call should be repeated with a larger output buffer. <p>This method resets this <code>KeyAgreement</code> object, so that it can be reused for further key agreements. Unless this key agreement is reinitialized with one of the <code>init</code> methods, the same private information and algorithm parameters will be used for subsequent key agreements. @param sharedSecret the buffer for the shared secret @param offset the offset in <code>sharedSecret</code> where the shared secret will be stored @return the number of bytes placed into <code>sharedSecret</code> @exception IllegalStateException if this key agreement has not been completed yet @exception ShortBufferException if the given output buffer is too small to hold the secret """ chooseFirstProvider(); return spi.engineGenerateSecret(sharedSecret, offset); }
java
public final int generateSecret(byte[] sharedSecret, int offset) throws IllegalStateException, ShortBufferException { chooseFirstProvider(); return spi.engineGenerateSecret(sharedSecret, offset); }
[ "public", "final", "int", "generateSecret", "(", "byte", "[", "]", "sharedSecret", ",", "int", "offset", ")", "throws", "IllegalStateException", ",", "ShortBufferException", "{", "chooseFirstProvider", "(", ")", ";", "return", "spi", ".", "engineGenerateSecret", "(", "sharedSecret", ",", "offset", ")", ";", "}" ]
Generates the shared secret, and places it into the buffer <code>sharedSecret</code>, beginning at <code>offset</code> inclusive. <p>If the <code>sharedSecret</code> buffer is too small to hold the result, a <code>ShortBufferException</code> is thrown. In this case, this call should be repeated with a larger output buffer. <p>This method resets this <code>KeyAgreement</code> object, so that it can be reused for further key agreements. Unless this key agreement is reinitialized with one of the <code>init</code> methods, the same private information and algorithm parameters will be used for subsequent key agreements. @param sharedSecret the buffer for the shared secret @param offset the offset in <code>sharedSecret</code> where the shared secret will be stored @return the number of bytes placed into <code>sharedSecret</code> @exception IllegalStateException if this key agreement has not been completed yet @exception ShortBufferException if the given output buffer is too small to hold the secret
[ "Generates", "the", "shared", "secret", "and", "places", "it", "into", "the", "buffer", "<code", ">", "sharedSecret<", "/", "code", ">", "beginning", "at", "<code", ">", "offset<", "/", "code", ">", "inclusive", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/KeyAgreement.java#L607-L612
Impetus/Kundera
src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java
CassandraSchemaManager.isCounterColumnType
private boolean isCounterColumnType(TableInfo tableInfo, String defaultValidationClass) { """ Checks if is counter column type. @param tableInfo the table info @param defaultValidationClass the default validation class @return true, if is counter column type """ return (csmd != null && csmd.isCounterColumn(databaseName, tableInfo.getTableName())) || (defaultValidationClass != null && (defaultValidationClass.equalsIgnoreCase(CounterColumnType.class.getSimpleName()) || defaultValidationClass .equalsIgnoreCase(CounterColumnType.class.getName())) || (tableInfo.getType() .equals(CounterColumnType.class.getSimpleName()))); }
java
private boolean isCounterColumnType(TableInfo tableInfo, String defaultValidationClass) { return (csmd != null && csmd.isCounterColumn(databaseName, tableInfo.getTableName())) || (defaultValidationClass != null && (defaultValidationClass.equalsIgnoreCase(CounterColumnType.class.getSimpleName()) || defaultValidationClass .equalsIgnoreCase(CounterColumnType.class.getName())) || (tableInfo.getType() .equals(CounterColumnType.class.getSimpleName()))); }
[ "private", "boolean", "isCounterColumnType", "(", "TableInfo", "tableInfo", ",", "String", "defaultValidationClass", ")", "{", "return", "(", "csmd", "!=", "null", "&&", "csmd", ".", "isCounterColumn", "(", "databaseName", ",", "tableInfo", ".", "getTableName", "(", ")", ")", ")", "||", "(", "defaultValidationClass", "!=", "null", "&&", "(", "defaultValidationClass", ".", "equalsIgnoreCase", "(", "CounterColumnType", ".", "class", ".", "getSimpleName", "(", ")", ")", "||", "defaultValidationClass", ".", "equalsIgnoreCase", "(", "CounterColumnType", ".", "class", ".", "getName", "(", ")", ")", ")", "||", "(", "tableInfo", ".", "getType", "(", ")", ".", "equals", "(", "CounterColumnType", ".", "class", ".", "getSimpleName", "(", ")", ")", ")", ")", ";", "}" ]
Checks if is counter column type. @param tableInfo the table info @param defaultValidationClass the default validation class @return true, if is counter column type
[ "Checks", "if", "is", "counter", "column", "type", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java#L3225-L3232
wcm-io/wcm-io-handler
media/src/main/java/io/wcm/handler/media/markup/ResponsiveImageMediaMarkupBuilder.java
ResponsiveImageMediaMarkupBuilder.toReponsiveImageSource
@SuppressWarnings("null") protected JSONObject toReponsiveImageSource(Media media, Rendition rendition) { """ Build JSON metadata for one rendition as image source. @param media Media @param rendition Rendition @return JSON metadata """ try { JSONObject source = new JSONObject(); MediaFormat mediaFormat = rendition.getMediaFormat(); source.put(MediaNameConstants.PROP_BREAKPOINT, mediaFormat.getProperties().get(MediaNameConstants.PROP_BREAKPOINT)); source.put(PROP_SRC, rendition.getUrl()); return source; } catch (JSONException ex) { throw new RuntimeException("Error building JSON source.", ex); } }
java
@SuppressWarnings("null") protected JSONObject toReponsiveImageSource(Media media, Rendition rendition) { try { JSONObject source = new JSONObject(); MediaFormat mediaFormat = rendition.getMediaFormat(); source.put(MediaNameConstants.PROP_BREAKPOINT, mediaFormat.getProperties().get(MediaNameConstants.PROP_BREAKPOINT)); source.put(PROP_SRC, rendition.getUrl()); return source; } catch (JSONException ex) { throw new RuntimeException("Error building JSON source.", ex); } }
[ "@", "SuppressWarnings", "(", "\"null\"", ")", "protected", "JSONObject", "toReponsiveImageSource", "(", "Media", "media", ",", "Rendition", "rendition", ")", "{", "try", "{", "JSONObject", "source", "=", "new", "JSONObject", "(", ")", ";", "MediaFormat", "mediaFormat", "=", "rendition", ".", "getMediaFormat", "(", ")", ";", "source", ".", "put", "(", "MediaNameConstants", ".", "PROP_BREAKPOINT", ",", "mediaFormat", ".", "getProperties", "(", ")", ".", "get", "(", "MediaNameConstants", ".", "PROP_BREAKPOINT", ")", ")", ";", "source", ".", "put", "(", "PROP_SRC", ",", "rendition", ".", "getUrl", "(", ")", ")", ";", "return", "source", ";", "}", "catch", "(", "JSONException", "ex", ")", "{", "throw", "new", "RuntimeException", "(", "\"Error building JSON source.\"", ",", "ex", ")", ";", "}", "}" ]
Build JSON metadata for one rendition as image source. @param media Media @param rendition Rendition @return JSON metadata
[ "Build", "JSON", "metadata", "for", "one", "rendition", "as", "image", "source", "." ]
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/media/markup/ResponsiveImageMediaMarkupBuilder.java#L131-L143
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/Broadcast.java
Broadcast.lte
public static INDArray lte(INDArray x, INDArray y, INDArray z, int... dimensions) { """ Broadcast less than or equal to op. See: {@link BroadcastLessThanOrEqual} """ if(dimensions == null || dimensions.length == 0) { validateShapesNoDimCase(x,y,z); return Nd4j.getExecutioner().exec(new OldLessThanOrEqual(x,y,z)); } return Nd4j.getExecutioner().exec(new BroadcastLessThanOrEqual(x,y,z,dimensions)); }
java
public static INDArray lte(INDArray x, INDArray y, INDArray z, int... dimensions) { if(dimensions == null || dimensions.length == 0) { validateShapesNoDimCase(x,y,z); return Nd4j.getExecutioner().exec(new OldLessThanOrEqual(x,y,z)); } return Nd4j.getExecutioner().exec(new BroadcastLessThanOrEqual(x,y,z,dimensions)); }
[ "public", "static", "INDArray", "lte", "(", "INDArray", "x", ",", "INDArray", "y", ",", "INDArray", "z", ",", "int", "...", "dimensions", ")", "{", "if", "(", "dimensions", "==", "null", "||", "dimensions", ".", "length", "==", "0", ")", "{", "validateShapesNoDimCase", "(", "x", ",", "y", ",", "z", ")", ";", "return", "Nd4j", ".", "getExecutioner", "(", ")", ".", "exec", "(", "new", "OldLessThanOrEqual", "(", "x", ",", "y", ",", "z", ")", ")", ";", "}", "return", "Nd4j", ".", "getExecutioner", "(", ")", ".", "exec", "(", "new", "BroadcastLessThanOrEqual", "(", "x", ",", "y", ",", "z", ",", "dimensions", ")", ")", ";", "}" ]
Broadcast less than or equal to op. See: {@link BroadcastLessThanOrEqual}
[ "Broadcast", "less", "than", "or", "equal", "to", "op", ".", "See", ":", "{" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/Broadcast.java#L125-L132
centic9/commons-dost
src/main/java/org/dstadler/commons/svn/SVNCommands.java
SVNCommands.getBranchRevision
public static long getBranchRevision(String branch, String baseUrl) throws IOException { """ Return the revision from which the branch was branched off. @param branch The name of the branch including the path to the branch, e.g. branches/4.2.x @param baseUrl The SVN url to connect to @return The revision where the branch was branched off from it's parent branch. @throws IOException Execution of the SVN sub-process failed or the sub-process returned a exit value indicating a failure """ CommandLine cmdLine = new CommandLine(SVN_CMD); cmdLine.addArgument(CMD_LOG); cmdLine.addArgument(OPT_XML); addDefaultArguments(cmdLine, null, null); cmdLine.addArgument("-v"); cmdLine.addArgument("-r0:HEAD"); cmdLine.addArgument("--stop-on-copy"); cmdLine.addArgument("--limit"); cmdLine.addArgument("1"); cmdLine.addArgument(baseUrl + branch); try (InputStream inStr = ExecutionHelper.getCommandResult(cmdLine, new File("."), 0, 120000)) { String xml = IOUtils.toString(inStr, "UTF-8"); log.info("XML:\n" + xml); // read the revision Matcher matcher = Pattern.compile("copyfrom-rev=\"([0-9]+)\"").matcher(xml); if (!matcher.find()) { throw new IOException("Could not find copyfrom-rev entry in xml: " + xml); } log.info("Found copyfrom-rev: " + matcher.group(1)); return Long.parseLong(matcher.group(1)); } }
java
public static long getBranchRevision(String branch, String baseUrl) throws IOException { CommandLine cmdLine = new CommandLine(SVN_CMD); cmdLine.addArgument(CMD_LOG); cmdLine.addArgument(OPT_XML); addDefaultArguments(cmdLine, null, null); cmdLine.addArgument("-v"); cmdLine.addArgument("-r0:HEAD"); cmdLine.addArgument("--stop-on-copy"); cmdLine.addArgument("--limit"); cmdLine.addArgument("1"); cmdLine.addArgument(baseUrl + branch); try (InputStream inStr = ExecutionHelper.getCommandResult(cmdLine, new File("."), 0, 120000)) { String xml = IOUtils.toString(inStr, "UTF-8"); log.info("XML:\n" + xml); // read the revision Matcher matcher = Pattern.compile("copyfrom-rev=\"([0-9]+)\"").matcher(xml); if (!matcher.find()) { throw new IOException("Could not find copyfrom-rev entry in xml: " + xml); } log.info("Found copyfrom-rev: " + matcher.group(1)); return Long.parseLong(matcher.group(1)); } }
[ "public", "static", "long", "getBranchRevision", "(", "String", "branch", ",", "String", "baseUrl", ")", "throws", "IOException", "{", "CommandLine", "cmdLine", "=", "new", "CommandLine", "(", "SVN_CMD", ")", ";", "cmdLine", ".", "addArgument", "(", "CMD_LOG", ")", ";", "cmdLine", ".", "addArgument", "(", "OPT_XML", ")", ";", "addDefaultArguments", "(", "cmdLine", ",", "null", ",", "null", ")", ";", "cmdLine", ".", "addArgument", "(", "\"-v\"", ")", ";", "cmdLine", ".", "addArgument", "(", "\"-r0:HEAD\"", ")", ";", "cmdLine", ".", "addArgument", "(", "\"--stop-on-copy\"", ")", ";", "cmdLine", ".", "addArgument", "(", "\"--limit\"", ")", ";", "cmdLine", ".", "addArgument", "(", "\"1\"", ")", ";", "cmdLine", ".", "addArgument", "(", "baseUrl", "+", "branch", ")", ";", "try", "(", "InputStream", "inStr", "=", "ExecutionHelper", ".", "getCommandResult", "(", "cmdLine", ",", "new", "File", "(", "\".\"", ")", ",", "0", ",", "120000", ")", ")", "{", "String", "xml", "=", "IOUtils", ".", "toString", "(", "inStr", ",", "\"UTF-8\"", ")", ";", "log", ".", "info", "(", "\"XML:\\n\"", "+", "xml", ")", ";", "// read the revision", "Matcher", "matcher", "=", "Pattern", ".", "compile", "(", "\"copyfrom-rev=\\\"([0-9]+)\\\"\"", ")", ".", "matcher", "(", "xml", ")", ";", "if", "(", "!", "matcher", ".", "find", "(", ")", ")", "{", "throw", "new", "IOException", "(", "\"Could not find copyfrom-rev entry in xml: \"", "+", "xml", ")", ";", "}", "log", ".", "info", "(", "\"Found copyfrom-rev: \"", "+", "matcher", ".", "group", "(", "1", ")", ")", ";", "return", "Long", ".", "parseLong", "(", "matcher", ".", "group", "(", "1", ")", ")", ";", "}", "}" ]
Return the revision from which the branch was branched off. @param branch The name of the branch including the path to the branch, e.g. branches/4.2.x @param baseUrl The SVN url to connect to @return The revision where the branch was branched off from it's parent branch. @throws IOException Execution of the SVN sub-process failed or the sub-process returned a exit value indicating a failure
[ "Return", "the", "revision", "from", "which", "the", "branch", "was", "branched", "off", "." ]
train
https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/svn/SVNCommands.java#L274-L299
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java
ExcelUtil.getReader
public static ExcelReader getReader(InputStream bookStream, boolean closeAfterRead) { """ 获取Excel读取器,通过调用{@link ExcelReader}的read或readXXX方法读取Excel内容<br> 默认调用第一个sheet @param bookStream Excel文件的流 @param closeAfterRead 读取结束是否关闭流 @return {@link ExcelReader} @since 4.0.3 """ try { return getReader(bookStream, 0, closeAfterRead); } catch (NoClassDefFoundError e) { throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG); } }
java
public static ExcelReader getReader(InputStream bookStream, boolean closeAfterRead) { try { return getReader(bookStream, 0, closeAfterRead); } catch (NoClassDefFoundError e) { throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG); } }
[ "public", "static", "ExcelReader", "getReader", "(", "InputStream", "bookStream", ",", "boolean", "closeAfterRead", ")", "{", "try", "{", "return", "getReader", "(", "bookStream", ",", "0", ",", "closeAfterRead", ")", ";", "}", "catch", "(", "NoClassDefFoundError", "e", ")", "{", "throw", "new", "DependencyException", "(", "ObjectUtil", ".", "defaultIfNull", "(", "e", ".", "getCause", "(", ")", ",", "e", ")", ",", "PoiChecker", ".", "NO_POI_ERROR_MSG", ")", ";", "}", "}" ]
获取Excel读取器,通过调用{@link ExcelReader}的read或readXXX方法读取Excel内容<br> 默认调用第一个sheet @param bookStream Excel文件的流 @param closeAfterRead 读取结束是否关闭流 @return {@link ExcelReader} @since 4.0.3
[ "获取Excel读取器,通过调用", "{", "@link", "ExcelReader", "}", "的read或readXXX方法读取Excel内容<br", ">", "默认调用第一个sheet" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java#L273-L279
yavijava/yavijava
src/main/java/com/vmware/vim25/mo/HostAccessManager.java
HostAccessManager.changeAccessMode
public void changeAccessMode(String principal, boolean isGroup, HostAccessMode accessMode) throws AuthMinimumAdminPermission, InvalidArgument, RuntimeFault, SecurityError, UserNotFound, RemoteException { """ Update the access mode for a user or group. If the host is in lockdown mode, this operation is allowed only on users in the exceptions list - see {@link com.vmware.vim25.mo.HostAccessManager#queryLockdownExceptions QueryLockdownExceptions}, and trying to change the access mode of other users or groups will fail with SecurityError. @param principal The affected user or group. @param isGroup True if principal refers to a group account, false otherwise. @param accessMode AccessMode to be granted. AccessMode#accessOther is meaningless and will result in InvalidArgument exception. @throws AuthMinimumAdminPermission @throws InvalidArgument @throws RuntimeFault @throws SecurityError @throws UserNotFound @throws RemoteException """ getVimService().changeAccessMode(getMOR(), principal, isGroup, accessMode); }
java
public void changeAccessMode(String principal, boolean isGroup, HostAccessMode accessMode) throws AuthMinimumAdminPermission, InvalidArgument, RuntimeFault, SecurityError, UserNotFound, RemoteException { getVimService().changeAccessMode(getMOR(), principal, isGroup, accessMode); }
[ "public", "void", "changeAccessMode", "(", "String", "principal", ",", "boolean", "isGroup", ",", "HostAccessMode", "accessMode", ")", "throws", "AuthMinimumAdminPermission", ",", "InvalidArgument", ",", "RuntimeFault", ",", "SecurityError", ",", "UserNotFound", ",", "RemoteException", "{", "getVimService", "(", ")", ".", "changeAccessMode", "(", "getMOR", "(", ")", ",", "principal", ",", "isGroup", ",", "accessMode", ")", ";", "}" ]
Update the access mode for a user or group. If the host is in lockdown mode, this operation is allowed only on users in the exceptions list - see {@link com.vmware.vim25.mo.HostAccessManager#queryLockdownExceptions QueryLockdownExceptions}, and trying to change the access mode of other users or groups will fail with SecurityError. @param principal The affected user or group. @param isGroup True if principal refers to a group account, false otherwise. @param accessMode AccessMode to be granted. AccessMode#accessOther is meaningless and will result in InvalidArgument exception. @throws AuthMinimumAdminPermission @throws InvalidArgument @throws RuntimeFault @throws SecurityError @throws UserNotFound @throws RemoteException
[ "Update", "the", "access", "mode", "for", "a", "user", "or", "group", ".", "If", "the", "host", "is", "in", "lockdown", "mode", "this", "operation", "is", "allowed", "only", "on", "users", "in", "the", "exceptions", "list", "-", "see", "{", "@link", "com", ".", "vmware", ".", "vim25", ".", "mo", ".", "HostAccessManager#queryLockdownExceptions", "QueryLockdownExceptions", "}", "and", "trying", "to", "change", "the", "access", "mode", "of", "other", "users", "or", "groups", "will", "fail", "with", "SecurityError", "." ]
train
https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/HostAccessManager.java#L61-L63
rundeck/rundeck
core/src/main/java/com/dtolabs/utils/Mapper.java
Mapper.mapEntries
public static Map mapEntries(Mapper mapper, Map map) { """ Create a new Map by mapping all values from the original map and mapping all keys. @param mapper a Mapper to map the values and keys @param map a Map @return a new Map with values mapped """ return mapEntries(mapper, map, false); }
java
public static Map mapEntries(Mapper mapper, Map map) { return mapEntries(mapper, map, false); }
[ "public", "static", "Map", "mapEntries", "(", "Mapper", "mapper", ",", "Map", "map", ")", "{", "return", "mapEntries", "(", "mapper", ",", "map", ",", "false", ")", ";", "}" ]
Create a new Map by mapping all values from the original map and mapping all keys. @param mapper a Mapper to map the values and keys @param map a Map @return a new Map with values mapped
[ "Create", "a", "new", "Map", "by", "mapping", "all", "values", "from", "the", "original", "map", "and", "mapping", "all", "keys", "." ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/utils/Mapper.java#L449-L451
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/spelling/SpellingCheckRule.java
SpellingCheckRule.ignoreWord
protected boolean ignoreWord(List<String> words, int idx) throws IOException { """ Returns true iff the word at the given position should be ignored by the spell checker. If possible, use {@link #ignoreToken(AnalyzedTokenReadings[], int)} instead. @since 2.6 """ return ignoreWord(words.get(idx)); }
java
protected boolean ignoreWord(List<String> words, int idx) throws IOException { return ignoreWord(words.get(idx)); }
[ "protected", "boolean", "ignoreWord", "(", "List", "<", "String", ">", "words", ",", "int", "idx", ")", "throws", "IOException", "{", "return", "ignoreWord", "(", "words", ".", "get", "(", "idx", ")", ")", ";", "}" ]
Returns true iff the word at the given position should be ignored by the spell checker. If possible, use {@link #ignoreToken(AnalyzedTokenReadings[], int)} instead. @since 2.6
[ "Returns", "true", "iff", "the", "word", "at", "the", "given", "position", "should", "be", "ignored", "by", "the", "spell", "checker", ".", "If", "possible", "use", "{" ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/spelling/SpellingCheckRule.java#L291-L293
liferay/com-liferay-commerce
commerce-product-type-virtual-order-service/src/main/java/com/liferay/commerce/product/type/virtual/order/service/persistence/impl/CommerceVirtualOrderItemPersistenceImpl.java
CommerceVirtualOrderItemPersistenceImpl.findAll
@Override public List<CommerceVirtualOrderItem> findAll(int start, int end) { """ Returns a range of all the commerce virtual order items. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceVirtualOrderItemModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param start the lower bound of the range of commerce virtual order items @param end the upper bound of the range of commerce virtual order items (not inclusive) @return the range of commerce virtual order items """ return findAll(start, end, null); }
java
@Override public List<CommerceVirtualOrderItem> findAll(int start, int end) { return findAll(start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceVirtualOrderItem", ">", "findAll", "(", "int", "start", ",", "int", "end", ")", "{", "return", "findAll", "(", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the commerce virtual order items. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceVirtualOrderItemModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param start the lower bound of the range of commerce virtual order items @param end the upper bound of the range of commerce virtual order items (not inclusive) @return the range of commerce virtual order items
[ "Returns", "a", "range", "of", "all", "the", "commerce", "virtual", "order", "items", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-type-virtual-order-service/src/main/java/com/liferay/commerce/product/type/virtual/order/service/persistence/impl/CommerceVirtualOrderItemPersistenceImpl.java#L2369-L2372
petergeneric/stdlib
stdlib/src/main/java/com/peterphi/std/types/TimecodeRange.java
TimecodeRange.merge
public static TimecodeRange merge(TimecodeRange a, TimecodeRange b) { """ Produce a new Timecode range which includes all timecodes from <code>a</code> and <code>b</code>. This may result in coverage of additional timecodes if the two ranges do not overlap. @param a @param b @return """ final Timecode start = TimecodeComparator.min(a.getStart(), b.getStart()); final Timecode end = TimecodeComparator.max(a.getEnd(), b.getEnd()); return new TimecodeRange(start, end); }
java
public static TimecodeRange merge(TimecodeRange a, TimecodeRange b) { final Timecode start = TimecodeComparator.min(a.getStart(), b.getStart()); final Timecode end = TimecodeComparator.max(a.getEnd(), b.getEnd()); return new TimecodeRange(start, end); }
[ "public", "static", "TimecodeRange", "merge", "(", "TimecodeRange", "a", ",", "TimecodeRange", "b", ")", "{", "final", "Timecode", "start", "=", "TimecodeComparator", ".", "min", "(", "a", ".", "getStart", "(", ")", ",", "b", ".", "getStart", "(", ")", ")", ";", "final", "Timecode", "end", "=", "TimecodeComparator", ".", "max", "(", "a", ".", "getEnd", "(", ")", ",", "b", ".", "getEnd", "(", ")", ")", ";", "return", "new", "TimecodeRange", "(", "start", ",", "end", ")", ";", "}" ]
Produce a new Timecode range which includes all timecodes from <code>a</code> and <code>b</code>. This may result in coverage of additional timecodes if the two ranges do not overlap. @param a @param b @return
[ "Produce", "a", "new", "Timecode", "range", "which", "includes", "all", "timecodes", "from", "<code", ">", "a<", "/", "code", ">", "and", "<code", ">", "b<", "/", "code", ">", ".", "This", "may", "result", "in", "coverage", "of", "additional", "timecodes", "if", "the", "two", "ranges", "do", "not", "overlap", "." ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/types/TimecodeRange.java#L183-L189
artikcloud/artikcloud-java
src/main/java/cloud/artik/api/DevicesManagementApi.java
DevicesManagementApi.getTasksAsync
public com.squareup.okhttp.Call getTasksAsync(String dtid, Integer count, Integer offset, String status, String order, String sort, final ApiCallback<TaskListEnvelope> callback) throws ApiException { """ Returns the all the tasks for a device type. (asynchronously) Returns the all the tasks for a device type. @param dtid Device Type ID. (required) @param count Max results count. (optional) @param offset Result starting offset. (optional) @param status Status filter. Comma-separated statuses. (optional) @param order Sort results by a field. Valid fields: createdOn. (optional) @param sort Sort order. Valid values: asc or desc. (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object """ ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getTasksValidateBeforeCall(dtid, count, offset, status, order, sort, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<TaskListEnvelope>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
java
public com.squareup.okhttp.Call getTasksAsync(String dtid, Integer count, Integer offset, String status, String order, String sort, final ApiCallback<TaskListEnvelope> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getTasksValidateBeforeCall(dtid, count, offset, status, order, sort, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<TaskListEnvelope>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
[ "public", "com", ".", "squareup", ".", "okhttp", ".", "Call", "getTasksAsync", "(", "String", "dtid", ",", "Integer", "count", ",", "Integer", "offset", ",", "String", "status", ",", "String", "order", ",", "String", "sort", ",", "final", "ApiCallback", "<", "TaskListEnvelope", ">", "callback", ")", "throws", "ApiException", "{", "ProgressResponseBody", ".", "ProgressListener", "progressListener", "=", "null", ";", "ProgressRequestBody", ".", "ProgressRequestListener", "progressRequestListener", "=", "null", ";", "if", "(", "callback", "!=", "null", ")", "{", "progressListener", "=", "new", "ProgressResponseBody", ".", "ProgressListener", "(", ")", "{", "@", "Override", "public", "void", "update", "(", "long", "bytesRead", ",", "long", "contentLength", ",", "boolean", "done", ")", "{", "callback", ".", "onDownloadProgress", "(", "bytesRead", ",", "contentLength", ",", "done", ")", ";", "}", "}", ";", "progressRequestListener", "=", "new", "ProgressRequestBody", ".", "ProgressRequestListener", "(", ")", "{", "@", "Override", "public", "void", "onRequestProgress", "(", "long", "bytesWritten", ",", "long", "contentLength", ",", "boolean", "done", ")", "{", "callback", ".", "onUploadProgress", "(", "bytesWritten", ",", "contentLength", ",", "done", ")", ";", "}", "}", ";", "}", "com", ".", "squareup", ".", "okhttp", ".", "Call", "call", "=", "getTasksValidateBeforeCall", "(", "dtid", ",", "count", ",", "offset", ",", "status", ",", "order", ",", "sort", ",", "progressListener", ",", "progressRequestListener", ")", ";", "Type", "localVarReturnType", "=", "new", "TypeToken", "<", "TaskListEnvelope", ">", "(", ")", "{", "}", ".", "getType", "(", ")", ";", "apiClient", ".", "executeAsync", "(", "call", ",", "localVarReturnType", ",", "callback", ")", ";", "return", "call", ";", "}" ]
Returns the all the tasks for a device type. (asynchronously) Returns the all the tasks for a device type. @param dtid Device Type ID. (required) @param count Max results count. (optional) @param offset Result starting offset. (optional) @param status Status filter. Comma-separated statuses. (optional) @param order Sort results by a field. Valid fields: createdOn. (optional) @param sort Sort order. Valid values: asc or desc. (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
[ "Returns", "the", "all", "the", "tasks", "for", "a", "device", "type", ".", "(", "asynchronously", ")", "Returns", "the", "all", "the", "tasks", "for", "a", "device", "type", "." ]
train
https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/DevicesManagementApi.java#L1315-L1340
languagetool-org/languagetool
languagetool-server/src/main/java/org/languagetool/server/PipelinePool.java
PipelinePool.createPipeline
Pipeline createPipeline(Language lang, Language motherTongue, TextChecker.QueryParams params, UserConfig userConfig) throws Exception { """ Create a JLanguageTool instance for a specific language, mother tongue, and rule configuration. Uses Pipeline wrapper to safely share objects @param lang the language to be used @param motherTongue the user's mother tongue or {@code null} """ // package-private for mocking Pipeline lt = new Pipeline(lang, params.altLanguages, motherTongue, cache, userConfig); lt.setMaxErrorsPerWordRate(config.getMaxErrorsPerWordRate()); if (config.getLanguageModelDir() != null) { lt.activateLanguageModelRules(config.getLanguageModelDir()); } if (config.getWord2VecModelDir () != null) { lt.activateWord2VecModelRules(config.getWord2VecModelDir()); } if (config.getRulesConfigFile() != null) { configureFromRulesFile(lt, lang); } else { configureFromGUI(lt, lang); } if (params.useQuerySettings) { Tools.selectRules(lt, new HashSet<>(params.disabledCategories), new HashSet<>(params.enabledCategories), new HashSet<>(params.disabledRules), new HashSet<>(params.enabledRules), params.useEnabledOnly); } if (pool != null) { lt.setupFinished(); } return lt; }
java
Pipeline createPipeline(Language lang, Language motherTongue, TextChecker.QueryParams params, UserConfig userConfig) throws Exception { // package-private for mocking Pipeline lt = new Pipeline(lang, params.altLanguages, motherTongue, cache, userConfig); lt.setMaxErrorsPerWordRate(config.getMaxErrorsPerWordRate()); if (config.getLanguageModelDir() != null) { lt.activateLanguageModelRules(config.getLanguageModelDir()); } if (config.getWord2VecModelDir () != null) { lt.activateWord2VecModelRules(config.getWord2VecModelDir()); } if (config.getRulesConfigFile() != null) { configureFromRulesFile(lt, lang); } else { configureFromGUI(lt, lang); } if (params.useQuerySettings) { Tools.selectRules(lt, new HashSet<>(params.disabledCategories), new HashSet<>(params.enabledCategories), new HashSet<>(params.disabledRules), new HashSet<>(params.enabledRules), params.useEnabledOnly); } if (pool != null) { lt.setupFinished(); } return lt; }
[ "Pipeline", "createPipeline", "(", "Language", "lang", ",", "Language", "motherTongue", ",", "TextChecker", ".", "QueryParams", "params", ",", "UserConfig", "userConfig", ")", "throws", "Exception", "{", "// package-private for mocking", "Pipeline", "lt", "=", "new", "Pipeline", "(", "lang", ",", "params", ".", "altLanguages", ",", "motherTongue", ",", "cache", ",", "userConfig", ")", ";", "lt", ".", "setMaxErrorsPerWordRate", "(", "config", ".", "getMaxErrorsPerWordRate", "(", ")", ")", ";", "if", "(", "config", ".", "getLanguageModelDir", "(", ")", "!=", "null", ")", "{", "lt", ".", "activateLanguageModelRules", "(", "config", ".", "getLanguageModelDir", "(", ")", ")", ";", "}", "if", "(", "config", ".", "getWord2VecModelDir", "(", ")", "!=", "null", ")", "{", "lt", ".", "activateWord2VecModelRules", "(", "config", ".", "getWord2VecModelDir", "(", ")", ")", ";", "}", "if", "(", "config", ".", "getRulesConfigFile", "(", ")", "!=", "null", ")", "{", "configureFromRulesFile", "(", "lt", ",", "lang", ")", ";", "}", "else", "{", "configureFromGUI", "(", "lt", ",", "lang", ")", ";", "}", "if", "(", "params", ".", "useQuerySettings", ")", "{", "Tools", ".", "selectRules", "(", "lt", ",", "new", "HashSet", "<>", "(", "params", ".", "disabledCategories", ")", ",", "new", "HashSet", "<>", "(", "params", ".", "enabledCategories", ")", ",", "new", "HashSet", "<>", "(", "params", ".", "disabledRules", ")", ",", "new", "HashSet", "<>", "(", "params", ".", "enabledRules", ")", ",", "params", ".", "useEnabledOnly", ")", ";", "}", "if", "(", "pool", "!=", "null", ")", "{", "lt", ".", "setupFinished", "(", ")", ";", "}", "return", "lt", ";", "}" ]
Create a JLanguageTool instance for a specific language, mother tongue, and rule configuration. Uses Pipeline wrapper to safely share objects @param lang the language to be used @param motherTongue the user's mother tongue or {@code null}
[ "Create", "a", "JLanguageTool", "instance", "for", "a", "specific", "language", "mother", "tongue", "and", "rule", "configuration", ".", "Uses", "Pipeline", "wrapper", "to", "safely", "share", "objects" ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-server/src/main/java/org/languagetool/server/PipelinePool.java#L185-L208
wildfly-extras/wildfly-camel
subsystem/core/src/main/java/org/wildfly/extension/camel/service/CamelEndpointDeployerService.java
CamelEndpointDeployerService.deploy
public void deploy(URI uri, final HttpHandler routingHandler) { """ Exposes an HTTP endpoint that will be served by the given {@link HttpHandler} under the given {@link URI}'s path. @param uri determines the path and protocol under which the HTTP endpoint should be exposed @param routingHandler an {@link HttpHandler} to use for handling HTTP requests sent to the given {@link URI}'s path """ final Set<Deployment> availableDeployments = hostSupplier.getValue().getDeployments(); if (!availableDeployments.stream().anyMatch( deployment -> deployment.getHandler() instanceof CamelEndpointDeployerHandler && ((CamelEndpointDeployerHandler) deployment.getHandler()).getRoutingHandler() == routingHandler)) { /* deploy only if the routing handler is not there already */ doDeploy( uri, servletInstance -> servletInstance.setEndpointHttpHandler(new DelegatingEndpointHttpHandler(routingHandler)), // plug the endpointHttpHandler into the servlet deploymentInfo -> deploymentInfo.addInnerHandlerChainWrapper(exchangeStoringHandlerWrapper), // add the handler to the chain deployment -> { // wrap the initial handler with our custom class so that we can recognize it at other places final HttpHandler servletHandler = new CamelEndpointDeployerHandler(deployment.getHandler(), routingHandler); deployment.setInitialHandler(servletHandler); }); } }
java
public void deploy(URI uri, final HttpHandler routingHandler) { final Set<Deployment> availableDeployments = hostSupplier.getValue().getDeployments(); if (!availableDeployments.stream().anyMatch( deployment -> deployment.getHandler() instanceof CamelEndpointDeployerHandler && ((CamelEndpointDeployerHandler) deployment.getHandler()).getRoutingHandler() == routingHandler)) { /* deploy only if the routing handler is not there already */ doDeploy( uri, servletInstance -> servletInstance.setEndpointHttpHandler(new DelegatingEndpointHttpHandler(routingHandler)), // plug the endpointHttpHandler into the servlet deploymentInfo -> deploymentInfo.addInnerHandlerChainWrapper(exchangeStoringHandlerWrapper), // add the handler to the chain deployment -> { // wrap the initial handler with our custom class so that we can recognize it at other places final HttpHandler servletHandler = new CamelEndpointDeployerHandler(deployment.getHandler(), routingHandler); deployment.setInitialHandler(servletHandler); }); } }
[ "public", "void", "deploy", "(", "URI", "uri", ",", "final", "HttpHandler", "routingHandler", ")", "{", "final", "Set", "<", "Deployment", ">", "availableDeployments", "=", "hostSupplier", ".", "getValue", "(", ")", ".", "getDeployments", "(", ")", ";", "if", "(", "!", "availableDeployments", ".", "stream", "(", ")", ".", "anyMatch", "(", "deployment", "->", "deployment", ".", "getHandler", "(", ")", "instanceof", "CamelEndpointDeployerHandler", "&&", "(", "(", "CamelEndpointDeployerHandler", ")", "deployment", ".", "getHandler", "(", ")", ")", ".", "getRoutingHandler", "(", ")", "==", "routingHandler", ")", ")", "{", "/* deploy only if the routing handler is not there already */", "doDeploy", "(", "uri", ",", "servletInstance", "->", "servletInstance", ".", "setEndpointHttpHandler", "(", "new", "DelegatingEndpointHttpHandler", "(", "routingHandler", ")", ")", ",", "// plug the endpointHttpHandler into the servlet", "deploymentInfo", "->", "deploymentInfo", ".", "addInnerHandlerChainWrapper", "(", "exchangeStoringHandlerWrapper", ")", ",", "// add the handler to the chain", "deployment", "->", "{", "// wrap the initial handler with our custom class so that we can recognize it at other places", "final", "HttpHandler", "servletHandler", "=", "new", "CamelEndpointDeployerHandler", "(", "deployment", ".", "getHandler", "(", ")", ",", "routingHandler", ")", ";", "deployment", ".", "setInitialHandler", "(", "servletHandler", ")", ";", "}", ")", ";", "}", "}" ]
Exposes an HTTP endpoint that will be served by the given {@link HttpHandler} under the given {@link URI}'s path. @param uri determines the path and protocol under which the HTTP endpoint should be exposed @param routingHandler an {@link HttpHandler} to use for handling HTTP requests sent to the given {@link URI}'s path
[ "Exposes", "an", "HTTP", "endpoint", "that", "will", "be", "served", "by", "the", "given", "{", "@link", "HttpHandler", "}", "under", "the", "given", "{", "@link", "URI", "}", "s", "path", "." ]
train
https://github.com/wildfly-extras/wildfly-camel/blob/9ebd7e28574f277a6d5b583e8a4c357e1538c370/subsystem/core/src/main/java/org/wildfly/extension/camel/service/CamelEndpointDeployerService.java#L440-L455
EsotericSoftware/jsonbeans
src/com/esotericsoftware/jsonbeans/Json.java
Json.writeValue
public void writeValue (Object value) { """ Writes the value, without writing the class of the object. @param value May be null. """ if (value == null) writeValue(value, null, null); else writeValue(value, value.getClass(), null); }
java
public void writeValue (Object value) { if (value == null) writeValue(value, null, null); else writeValue(value, value.getClass(), null); }
[ "public", "void", "writeValue", "(", "Object", "value", ")", "{", "if", "(", "value", "==", "null", ")", "writeValue", "(", "value", ",", "null", ",", "null", ")", ";", "else", "writeValue", "(", "value", ",", "value", ".", "getClass", "(", ")", ",", "null", ")", ";", "}" ]
Writes the value, without writing the class of the object. @param value May be null.
[ "Writes", "the", "value", "without", "writing", "the", "class", "of", "the", "object", "." ]
train
https://github.com/EsotericSoftware/jsonbeans/blob/ff4502d0ff86cc77aa5c61d47371d0c66c14fe2f/src/com/esotericsoftware/jsonbeans/Json.java#L423-L428
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.cart_cartId_domainTransfer_GET
public ArrayList<OvhProductInformation> cart_cartId_domainTransfer_GET(String cartId, String domain) throws IOException { """ Get informations about a domain name transfer REST: GET /order/cart/{cartId}/domainTransfer @param cartId [required] Cart identifier @param domain [required] Domain name requested API beta """ String qPath = "/order/cart/{cartId}/domainTransfer"; StringBuilder sb = path(qPath, cartId); query(sb, "domain", domain); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, t7); }
java
public ArrayList<OvhProductInformation> cart_cartId_domainTransfer_GET(String cartId, String domain) throws IOException { String qPath = "/order/cart/{cartId}/domainTransfer"; StringBuilder sb = path(qPath, cartId); query(sb, "domain", domain); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, t7); }
[ "public", "ArrayList", "<", "OvhProductInformation", ">", "cart_cartId_domainTransfer_GET", "(", "String", "cartId", ",", "String", "domain", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/cart/{cartId}/domainTransfer\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "cartId", ")", ";", "query", "(", "sb", ",", "\"domain\"", ",", "domain", ")", ";", "String", "resp", "=", "execN", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t7", ")", ";", "}" ]
Get informations about a domain name transfer REST: GET /order/cart/{cartId}/domainTransfer @param cartId [required] Cart identifier @param domain [required] Domain name requested API beta
[ "Get", "informations", "about", "a", "domain", "name", "transfer" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L10949-L10955
haifengl/smile
core/src/main/java/smile/taxonomy/Taxonomy.java
Taxonomy.lowestCommonAncestor
public Concept lowestCommonAncestor(Concept v, Concept w) { """ Returns the lowest common ancestor (LCA) of concepts v and w. The lowest common ancestor is defined between two nodes v and w as the lowest node that has both v and w as descendants (where we allow a node to be a descendant of itself). """ if (v.taxonomy != w.taxonomy) { throw new IllegalArgumentException("Concepts are not from the same taxonomy."); } List<Concept> vPath = v.getPathFromRoot(); List<Concept> wPath = w.getPathFromRoot(); Iterator<Concept> vIter = vPath.iterator(); Iterator<Concept> wIter = wPath.iterator(); Concept commonAncestor = null; while (vIter.hasNext() && wIter.hasNext()) { Concept vAncestor = vIter.next(); Concept wAncestor = wIter.next(); if (vAncestor != wAncestor) { return commonAncestor; } else { commonAncestor = vAncestor; } } return commonAncestor; }
java
public Concept lowestCommonAncestor(Concept v, Concept w) { if (v.taxonomy != w.taxonomy) { throw new IllegalArgumentException("Concepts are not from the same taxonomy."); } List<Concept> vPath = v.getPathFromRoot(); List<Concept> wPath = w.getPathFromRoot(); Iterator<Concept> vIter = vPath.iterator(); Iterator<Concept> wIter = wPath.iterator(); Concept commonAncestor = null; while (vIter.hasNext() && wIter.hasNext()) { Concept vAncestor = vIter.next(); Concept wAncestor = wIter.next(); if (vAncestor != wAncestor) { return commonAncestor; } else { commonAncestor = vAncestor; } } return commonAncestor; }
[ "public", "Concept", "lowestCommonAncestor", "(", "Concept", "v", ",", "Concept", "w", ")", "{", "if", "(", "v", ".", "taxonomy", "!=", "w", ".", "taxonomy", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Concepts are not from the same taxonomy.\"", ")", ";", "}", "List", "<", "Concept", ">", "vPath", "=", "v", ".", "getPathFromRoot", "(", ")", ";", "List", "<", "Concept", ">", "wPath", "=", "w", ".", "getPathFromRoot", "(", ")", ";", "Iterator", "<", "Concept", ">", "vIter", "=", "vPath", ".", "iterator", "(", ")", ";", "Iterator", "<", "Concept", ">", "wIter", "=", "wPath", ".", "iterator", "(", ")", ";", "Concept", "commonAncestor", "=", "null", ";", "while", "(", "vIter", ".", "hasNext", "(", ")", "&&", "wIter", ".", "hasNext", "(", ")", ")", "{", "Concept", "vAncestor", "=", "vIter", ".", "next", "(", ")", ";", "Concept", "wAncestor", "=", "wIter", ".", "next", "(", ")", ";", "if", "(", "vAncestor", "!=", "wAncestor", ")", "{", "return", "commonAncestor", ";", "}", "else", "{", "commonAncestor", "=", "vAncestor", ";", "}", "}", "return", "commonAncestor", ";", "}" ]
Returns the lowest common ancestor (LCA) of concepts v and w. The lowest common ancestor is defined between two nodes v and w as the lowest node that has both v and w as descendants (where we allow a node to be a descendant of itself).
[ "Returns", "the", "lowest", "common", "ancestor", "(", "LCA", ")", "of", "concepts", "v", "and", "w", ".", "The", "lowest", "common", "ancestor", "is", "defined", "between", "two", "nodes", "v", "and", "w", "as", "the", "lowest", "node", "that", "has", "both", "v", "and", "w", "as", "descendants", "(", "where", "we", "allow", "a", "node", "to", "be", "a", "descendant", "of", "itself", ")", "." ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/taxonomy/Taxonomy.java#L123-L147
OpenLiberty/open-liberty
dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/handlers/FileStatusTaskPropertyHandler.java
FileStatusTaskPropertyHandler.taskProperty
private void taskProperty(RESTRequest request, RESTResponse response) { """ Returns the value of the property. An IllegalArgument exception is thrown if the value is not an instance of java.lang.String. """ String taskID = RESTHelper.getRequiredParam(request, APIConstants.PARAM_TASK_ID); String property = RESTHelper.getRequiredParam(request, APIConstants.PARAM_PROPERTY); String taskPropertyText = getMultipleRoutingHelper().getTaskProperty(taskID, property); OutputHelper.writeTextOutput(response, taskPropertyText); }
java
private void taskProperty(RESTRequest request, RESTResponse response) { String taskID = RESTHelper.getRequiredParam(request, APIConstants.PARAM_TASK_ID); String property = RESTHelper.getRequiredParam(request, APIConstants.PARAM_PROPERTY); String taskPropertyText = getMultipleRoutingHelper().getTaskProperty(taskID, property); OutputHelper.writeTextOutput(response, taskPropertyText); }
[ "private", "void", "taskProperty", "(", "RESTRequest", "request", ",", "RESTResponse", "response", ")", "{", "String", "taskID", "=", "RESTHelper", ".", "getRequiredParam", "(", "request", ",", "APIConstants", ".", "PARAM_TASK_ID", ")", ";", "String", "property", "=", "RESTHelper", ".", "getRequiredParam", "(", "request", ",", "APIConstants", ".", "PARAM_PROPERTY", ")", ";", "String", "taskPropertyText", "=", "getMultipleRoutingHelper", "(", ")", ".", "getTaskProperty", "(", "taskID", ",", "property", ")", ";", "OutputHelper", ".", "writeTextOutput", "(", "response", ",", "taskPropertyText", ")", ";", "}" ]
Returns the value of the property. An IllegalArgument exception is thrown if the value is not an instance of java.lang.String.
[ "Returns", "the", "value", "of", "the", "property", ".", "An", "IllegalArgument", "exception", "is", "thrown", "if", "the", "value", "is", "not", "an", "instance", "of", "java", ".", "lang", ".", "String", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/handlers/FileStatusTaskPropertyHandler.java#L97-L103
thorntail/thorntail
core/container/src/main/java/org/wildfly/swarm/internal/wildfly/SelfContainedContainer.java
SelfContainedContainer.start
public ServiceContainer start(final List<ModelNode> containerDefinition, Collection<ServiceActivator> additionalActivators) throws ExecutionException, InterruptedException, ModuleLoadException { """ The main method. @param containerDefinition The container definition. """ final long startTime = System.currentTimeMillis(); if (java.util.logging.LogManager.getLogManager().getClass().getName().equals("org.jboss.logmanager.LogManager")) { try { Class.forName(org.jboss.logmanager.handlers.ConsoleHandler.class.getName(), true, org.jboss.logmanager.handlers.ConsoleHandler.class.getClassLoader()); // Install JBoss Stdio to avoid any nasty crosstalk, after command line arguments are processed. StdioContext.install(); final StdioContext context = StdioContext.create( new NullInputStream(), new LoggingOutputStream(org.jboss.logmanager.Logger.getLogger("stdout"), org.jboss.logmanager.Level.INFO), new LoggingOutputStream(org.jboss.logmanager.Logger.getLogger("stderr"), org.jboss.logmanager.Level.ERROR) ); StdioContext.setStdioContextSelector(new SimpleStdioContextSelector(context)); } catch (Throwable ignored) { } } Module.registerURLStreamHandlerFactoryModule(Module.getBootModuleLoader().loadModule("org.jboss.vfs")); ServerEnvironment serverEnvironment = determineEnvironment(WildFlySecurityManager.getSystemPropertiesPrivileged(), WildFlySecurityManager.getSystemEnvironmentPrivileged(), ServerEnvironment.LaunchType.SELF_CONTAINED, startTime); final Bootstrap bootstrap = Bootstrap.Factory.newInstance(); final Bootstrap.Configuration configuration = new Bootstrap.Configuration(serverEnvironment); configuration.setConfigurationPersisterFactory( new Bootstrap.ConfigurationPersisterFactory() { @Override public ExtensibleConfigurationPersister createConfigurationPersister(ServerEnvironment serverEnvironment, ExecutorService executorService) { ExtensibleConfigurationPersister delegate; delegate = persisterFactory.createConfigurationPersister(serverEnvironment, executorService); configuration.getExtensionRegistry().setWriterRegistry(delegate); return delegate; } }); configuration.setModuleLoader(Module.getBootModuleLoader()); List<ServiceActivator> activators = new ArrayList<>(); //activators.add(new ContentProviderServiceActivator(contentProvider)); activators.addAll(additionalActivators); serviceContainer = bootstrap.startup(configuration, activators).get(); return serviceContainer; }
java
public ServiceContainer start(final List<ModelNode> containerDefinition, Collection<ServiceActivator> additionalActivators) throws ExecutionException, InterruptedException, ModuleLoadException { final long startTime = System.currentTimeMillis(); if (java.util.logging.LogManager.getLogManager().getClass().getName().equals("org.jboss.logmanager.LogManager")) { try { Class.forName(org.jboss.logmanager.handlers.ConsoleHandler.class.getName(), true, org.jboss.logmanager.handlers.ConsoleHandler.class.getClassLoader()); // Install JBoss Stdio to avoid any nasty crosstalk, after command line arguments are processed. StdioContext.install(); final StdioContext context = StdioContext.create( new NullInputStream(), new LoggingOutputStream(org.jboss.logmanager.Logger.getLogger("stdout"), org.jboss.logmanager.Level.INFO), new LoggingOutputStream(org.jboss.logmanager.Logger.getLogger("stderr"), org.jboss.logmanager.Level.ERROR) ); StdioContext.setStdioContextSelector(new SimpleStdioContextSelector(context)); } catch (Throwable ignored) { } } Module.registerURLStreamHandlerFactoryModule(Module.getBootModuleLoader().loadModule("org.jboss.vfs")); ServerEnvironment serverEnvironment = determineEnvironment(WildFlySecurityManager.getSystemPropertiesPrivileged(), WildFlySecurityManager.getSystemEnvironmentPrivileged(), ServerEnvironment.LaunchType.SELF_CONTAINED, startTime); final Bootstrap bootstrap = Bootstrap.Factory.newInstance(); final Bootstrap.Configuration configuration = new Bootstrap.Configuration(serverEnvironment); configuration.setConfigurationPersisterFactory( new Bootstrap.ConfigurationPersisterFactory() { @Override public ExtensibleConfigurationPersister createConfigurationPersister(ServerEnvironment serverEnvironment, ExecutorService executorService) { ExtensibleConfigurationPersister delegate; delegate = persisterFactory.createConfigurationPersister(serverEnvironment, executorService); configuration.getExtensionRegistry().setWriterRegistry(delegate); return delegate; } }); configuration.setModuleLoader(Module.getBootModuleLoader()); List<ServiceActivator> activators = new ArrayList<>(); //activators.add(new ContentProviderServiceActivator(contentProvider)); activators.addAll(additionalActivators); serviceContainer = bootstrap.startup(configuration, activators).get(); return serviceContainer; }
[ "public", "ServiceContainer", "start", "(", "final", "List", "<", "ModelNode", ">", "containerDefinition", ",", "Collection", "<", "ServiceActivator", ">", "additionalActivators", ")", "throws", "ExecutionException", ",", "InterruptedException", ",", "ModuleLoadException", "{", "final", "long", "startTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "if", "(", "java", ".", "util", ".", "logging", ".", "LogManager", ".", "getLogManager", "(", ")", ".", "getClass", "(", ")", ".", "getName", "(", ")", ".", "equals", "(", "\"org.jboss.logmanager.LogManager\"", ")", ")", "{", "try", "{", "Class", ".", "forName", "(", "org", ".", "jboss", ".", "logmanager", ".", "handlers", ".", "ConsoleHandler", ".", "class", ".", "getName", "(", ")", ",", "true", ",", "org", ".", "jboss", ".", "logmanager", ".", "handlers", ".", "ConsoleHandler", ".", "class", ".", "getClassLoader", "(", ")", ")", ";", "// Install JBoss Stdio to avoid any nasty crosstalk, after command line arguments are processed.", "StdioContext", ".", "install", "(", ")", ";", "final", "StdioContext", "context", "=", "StdioContext", ".", "create", "(", "new", "NullInputStream", "(", ")", ",", "new", "LoggingOutputStream", "(", "org", ".", "jboss", ".", "logmanager", ".", "Logger", ".", "getLogger", "(", "\"stdout\"", ")", ",", "org", ".", "jboss", ".", "logmanager", ".", "Level", ".", "INFO", ")", ",", "new", "LoggingOutputStream", "(", "org", ".", "jboss", ".", "logmanager", ".", "Logger", ".", "getLogger", "(", "\"stderr\"", ")", ",", "org", ".", "jboss", ".", "logmanager", ".", "Level", ".", "ERROR", ")", ")", ";", "StdioContext", ".", "setStdioContextSelector", "(", "new", "SimpleStdioContextSelector", "(", "context", ")", ")", ";", "}", "catch", "(", "Throwable", "ignored", ")", "{", "}", "}", "Module", ".", "registerURLStreamHandlerFactoryModule", "(", "Module", ".", "getBootModuleLoader", "(", ")", ".", "loadModule", "(", "\"org.jboss.vfs\"", ")", ")", ";", "ServerEnvironment", "serverEnvironment", "=", "determineEnvironment", "(", "WildFlySecurityManager", ".", "getSystemPropertiesPrivileged", "(", ")", ",", "WildFlySecurityManager", ".", "getSystemEnvironmentPrivileged", "(", ")", ",", "ServerEnvironment", ".", "LaunchType", ".", "SELF_CONTAINED", ",", "startTime", ")", ";", "final", "Bootstrap", "bootstrap", "=", "Bootstrap", ".", "Factory", ".", "newInstance", "(", ")", ";", "final", "Bootstrap", ".", "Configuration", "configuration", "=", "new", "Bootstrap", ".", "Configuration", "(", "serverEnvironment", ")", ";", "configuration", ".", "setConfigurationPersisterFactory", "(", "new", "Bootstrap", ".", "ConfigurationPersisterFactory", "(", ")", "{", "@", "Override", "public", "ExtensibleConfigurationPersister", "createConfigurationPersister", "(", "ServerEnvironment", "serverEnvironment", ",", "ExecutorService", "executorService", ")", "{", "ExtensibleConfigurationPersister", "delegate", ";", "delegate", "=", "persisterFactory", ".", "createConfigurationPersister", "(", "serverEnvironment", ",", "executorService", ")", ";", "configuration", ".", "getExtensionRegistry", "(", ")", ".", "setWriterRegistry", "(", "delegate", ")", ";", "return", "delegate", ";", "}", "}", ")", ";", "configuration", ".", "setModuleLoader", "(", "Module", ".", "getBootModuleLoader", "(", ")", ")", ";", "List", "<", "ServiceActivator", ">", "activators", "=", "new", "ArrayList", "<>", "(", ")", ";", "//activators.add(new ContentProviderServiceActivator(contentProvider));", "activators", ".", "addAll", "(", "additionalActivators", ")", ";", "serviceContainer", "=", "bootstrap", ".", "startup", "(", "configuration", ",", "activators", ")", ".", "get", "(", ")", ";", "return", "serviceContainer", ";", "}" ]
The main method. @param containerDefinition The container definition.
[ "The", "main", "method", "." ]
train
https://github.com/thorntail/thorntail/blob/4a391b68ffae98c6e66d30a3bfb99dadc9509f14/core/container/src/main/java/org/wildfly/swarm/internal/wildfly/SelfContainedContainer.java#L95-L145
banq/jdonframework
JdonAccessory/jdon-struts1x/src/main/java/com/jdon/strutsutil/ModelViewAction.java
ModelViewAction.execute
public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { """ accept the form submit, action parameter must be : create or edit; if not, will directly forward the jsp page mapping for the action value; """ Debug.logVerbose("[JdonFramework]--> enter ModelViewAction process ", module); intContext(this.getServlet().getServletContext()); ModelForm modelForm = FormBeanUtil.getModelForm(actionMapping, actionForm, request); if ((UtilValidate.isEmpty(modelForm.getAction())) || modelForm.getAction().equalsIgnoreCase(ModelForm.CREATE_STR)) { Debug.logVerbose("[JdonFramework]--> enter create process ", module); modelForm.setAction(ModelForm.CREATE_STR); createViewPage.doCreate(actionMapping, modelForm, request); } else if (modelForm.getAction().equalsIgnoreCase(ModelForm.EDIT_STR)) { Debug.logVerbose("[JdonFramework]--> enter " + ModelForm.EDIT_STR + " process ", module); Object model = editeViewPage.getModelForEdit(actionMapping, modelForm, request, this.servlet.getServletContext()); if (model == null) // not found the model return errorsForward(modelForm.getAction(), actionMapping, request); } else if (modelForm.getAction().equalsIgnoreCase(ModelForm.VIEW_STR)) { Debug.logVerbose("[JdonFramework]--> enter " + ModelForm.VIEW_STR + " process ", module); Object model = editeViewPage.getModelForEdit(actionMapping, modelForm, request, this.servlet.getServletContext()); if (model == null) // not found the model return errorsForward(modelForm.getAction(), actionMapping, request); } else {// other regard as create Debug.logVerbose("[JdonFramework]-->action value not supported, enter create process2 ", module); modelForm.setAction(ModelForm.CREATE_STR); createViewPage.doCreate(actionMapping, modelForm, request); } Debug.logVerbose("[JdonFramework]--> push the jsp that forward name is '" + modelForm.getAction() + "'", module); return actionMapping.findForward(modelForm.getAction()); }
java
public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { Debug.logVerbose("[JdonFramework]--> enter ModelViewAction process ", module); intContext(this.getServlet().getServletContext()); ModelForm modelForm = FormBeanUtil.getModelForm(actionMapping, actionForm, request); if ((UtilValidate.isEmpty(modelForm.getAction())) || modelForm.getAction().equalsIgnoreCase(ModelForm.CREATE_STR)) { Debug.logVerbose("[JdonFramework]--> enter create process ", module); modelForm.setAction(ModelForm.CREATE_STR); createViewPage.doCreate(actionMapping, modelForm, request); } else if (modelForm.getAction().equalsIgnoreCase(ModelForm.EDIT_STR)) { Debug.logVerbose("[JdonFramework]--> enter " + ModelForm.EDIT_STR + " process ", module); Object model = editeViewPage.getModelForEdit(actionMapping, modelForm, request, this.servlet.getServletContext()); if (model == null) // not found the model return errorsForward(modelForm.getAction(), actionMapping, request); } else if (modelForm.getAction().equalsIgnoreCase(ModelForm.VIEW_STR)) { Debug.logVerbose("[JdonFramework]--> enter " + ModelForm.VIEW_STR + " process ", module); Object model = editeViewPage.getModelForEdit(actionMapping, modelForm, request, this.servlet.getServletContext()); if (model == null) // not found the model return errorsForward(modelForm.getAction(), actionMapping, request); } else {// other regard as create Debug.logVerbose("[JdonFramework]-->action value not supported, enter create process2 ", module); modelForm.setAction(ModelForm.CREATE_STR); createViewPage.doCreate(actionMapping, modelForm, request); } Debug.logVerbose("[JdonFramework]--> push the jsp that forward name is '" + modelForm.getAction() + "'", module); return actionMapping.findForward(modelForm.getAction()); }
[ "public", "ActionForward", "execute", "(", "ActionMapping", "actionMapping", ",", "ActionForm", "actionForm", ",", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "Exception", "{", "Debug", ".", "logVerbose", "(", "\"[JdonFramework]--> enter ModelViewAction process \"", ",", "module", ")", ";", "intContext", "(", "this", ".", "getServlet", "(", ")", ".", "getServletContext", "(", ")", ")", ";", "ModelForm", "modelForm", "=", "FormBeanUtil", ".", "getModelForm", "(", "actionMapping", ",", "actionForm", ",", "request", ")", ";", "if", "(", "(", "UtilValidate", ".", "isEmpty", "(", "modelForm", ".", "getAction", "(", ")", ")", ")", "||", "modelForm", ".", "getAction", "(", ")", ".", "equalsIgnoreCase", "(", "ModelForm", ".", "CREATE_STR", ")", ")", "{", "Debug", ".", "logVerbose", "(", "\"[JdonFramework]--> enter create process \"", ",", "module", ")", ";", "modelForm", ".", "setAction", "(", "ModelForm", ".", "CREATE_STR", ")", ";", "createViewPage", ".", "doCreate", "(", "actionMapping", ",", "modelForm", ",", "request", ")", ";", "}", "else", "if", "(", "modelForm", ".", "getAction", "(", ")", ".", "equalsIgnoreCase", "(", "ModelForm", ".", "EDIT_STR", ")", ")", "{", "Debug", ".", "logVerbose", "(", "\"[JdonFramework]--> enter \"", "+", "ModelForm", ".", "EDIT_STR", "+", "\" process \"", ",", "module", ")", ";", "Object", "model", "=", "editeViewPage", ".", "getModelForEdit", "(", "actionMapping", ",", "modelForm", ",", "request", ",", "this", ".", "servlet", ".", "getServletContext", "(", ")", ")", ";", "if", "(", "model", "==", "null", ")", "// not found the model\r", "return", "errorsForward", "(", "modelForm", ".", "getAction", "(", ")", ",", "actionMapping", ",", "request", ")", ";", "}", "else", "if", "(", "modelForm", ".", "getAction", "(", ")", ".", "equalsIgnoreCase", "(", "ModelForm", ".", "VIEW_STR", ")", ")", "{", "Debug", ".", "logVerbose", "(", "\"[JdonFramework]--> enter \"", "+", "ModelForm", ".", "VIEW_STR", "+", "\" process \"", ",", "module", ")", ";", "Object", "model", "=", "editeViewPage", ".", "getModelForEdit", "(", "actionMapping", ",", "modelForm", ",", "request", ",", "this", ".", "servlet", ".", "getServletContext", "(", ")", ")", ";", "if", "(", "model", "==", "null", ")", "// not found the model\r", "return", "errorsForward", "(", "modelForm", ".", "getAction", "(", ")", ",", "actionMapping", ",", "request", ")", ";", "}", "else", "{", "// other regard as create\r", "Debug", ".", "logVerbose", "(", "\"[JdonFramework]-->action value not supported, enter create process2 \"", ",", "module", ")", ";", "modelForm", ".", "setAction", "(", "ModelForm", ".", "CREATE_STR", ")", ";", "createViewPage", ".", "doCreate", "(", "actionMapping", ",", "modelForm", ",", "request", ")", ";", "}", "Debug", ".", "logVerbose", "(", "\"[JdonFramework]--> push the jsp that forward name is '\"", "+", "modelForm", ".", "getAction", "(", ")", "+", "\"'\"", ",", "module", ")", ";", "return", "actionMapping", ".", "findForward", "(", "modelForm", ".", "getAction", "(", ")", ")", ";", "}" ]
accept the form submit, action parameter must be : create or edit; if not, will directly forward the jsp page mapping for the action value;
[ "accept", "the", "form", "submit", "action", "parameter", "must", "be", ":", "create", "or", "edit", ";", "if", "not", "will", "directly", "forward", "the", "jsp", "page", "mapping", "for", "the", "action", "value", ";" ]
train
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-struts1x/src/main/java/com/jdon/strutsutil/ModelViewAction.java#L65-L98
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/decomposition/svd/implicitqr/SvdImplicitQrAlgorithm_DDRM.java
SvdImplicitQrAlgorithm_DDRM.performImplicitSingleStep
public void performImplicitSingleStep(double scale , double lambda , boolean byAngle) { """ Given the lambda value perform an implicit QR step on the matrix. B^T*B-lambda*I @param lambda Stepping factor. """ createBulge(x1,lambda,scale,byAngle); for( int i = x1; i < x2-1 && bulge != 0.0; i++ ) { removeBulgeLeft(i,true); if( bulge == 0 ) break; removeBulgeRight(i); } if( bulge != 0 ) removeBulgeLeft(x2-1,false); incrementSteps(); }
java
public void performImplicitSingleStep(double scale , double lambda , boolean byAngle) { createBulge(x1,lambda,scale,byAngle); for( int i = x1; i < x2-1 && bulge != 0.0; i++ ) { removeBulgeLeft(i,true); if( bulge == 0 ) break; removeBulgeRight(i); } if( bulge != 0 ) removeBulgeLeft(x2-1,false); incrementSteps(); }
[ "public", "void", "performImplicitSingleStep", "(", "double", "scale", ",", "double", "lambda", ",", "boolean", "byAngle", ")", "{", "createBulge", "(", "x1", ",", "lambda", ",", "scale", ",", "byAngle", ")", ";", "for", "(", "int", "i", "=", "x1", ";", "i", "<", "x2", "-", "1", "&&", "bulge", "!=", "0.0", ";", "i", "++", ")", "{", "removeBulgeLeft", "(", "i", ",", "true", ")", ";", "if", "(", "bulge", "==", "0", ")", "break", ";", "removeBulgeRight", "(", "i", ")", ";", "}", "if", "(", "bulge", "!=", "0", ")", "removeBulgeLeft", "(", "x2", "-", "1", ",", "false", ")", ";", "incrementSteps", "(", ")", ";", "}" ]
Given the lambda value perform an implicit QR step on the matrix. B^T*B-lambda*I @param lambda Stepping factor.
[ "Given", "the", "lambda", "value", "perform", "an", "implicit", "QR", "step", "on", "the", "matrix", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/decomposition/svd/implicitqr/SvdImplicitQrAlgorithm_DDRM.java#L356-L370
headius/invokebinder
src/main/java/com/headius/invokebinder/Binder.java
Binder.invokeConstructor
public MethodHandle invokeConstructor(MethodHandles.Lookup lookup, Class<?> target) throws NoSuchMethodException, IllegalAccessException { """ Apply the chain of transforms and bind them to a constructor specified using the end signature plus the given class. The constructor will be retrieved using the given Lookup and must match the end signature's arguments exactly. If the final handle's type does not exactly match the initial type for this Binder, an additional cast will be attempted. @param lookup the MethodHandles.Lookup to use to look up the constructor @param target the constructor's class @return the full handle chain, bound to the given constructor @throws java.lang.NoSuchMethodException if the constructor does not exist @throws java.lang.IllegalAccessException if the constructor is not accessible """ return invoke(lookup.findConstructor(target, type().changeReturnType(void.class))); }
java
public MethodHandle invokeConstructor(MethodHandles.Lookup lookup, Class<?> target) throws NoSuchMethodException, IllegalAccessException { return invoke(lookup.findConstructor(target, type().changeReturnType(void.class))); }
[ "public", "MethodHandle", "invokeConstructor", "(", "MethodHandles", ".", "Lookup", "lookup", ",", "Class", "<", "?", ">", "target", ")", "throws", "NoSuchMethodException", ",", "IllegalAccessException", "{", "return", "invoke", "(", "lookup", ".", "findConstructor", "(", "target", ",", "type", "(", ")", ".", "changeReturnType", "(", "void", ".", "class", ")", ")", ")", ";", "}" ]
Apply the chain of transforms and bind them to a constructor specified using the end signature plus the given class. The constructor will be retrieved using the given Lookup and must match the end signature's arguments exactly. If the final handle's type does not exactly match the initial type for this Binder, an additional cast will be attempted. @param lookup the MethodHandles.Lookup to use to look up the constructor @param target the constructor's class @return the full handle chain, bound to the given constructor @throws java.lang.NoSuchMethodException if the constructor does not exist @throws java.lang.IllegalAccessException if the constructor is not accessible
[ "Apply", "the", "chain", "of", "transforms", "and", "bind", "them", "to", "a", "constructor", "specified", "using", "the", "end", "signature", "plus", "the", "given", "class", ".", "The", "constructor", "will", "be", "retrieved", "using", "the", "given", "Lookup", "and", "must", "match", "the", "end", "signature", "s", "arguments", "exactly", "." ]
train
https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Binder.java#L1342-L1344
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java
KeyValueHandler.handleTouchRequest
private static BinaryMemcacheRequest handleTouchRequest(final ChannelHandlerContext ctx, final TouchRequest msg) { """ Encodes a {@link TouchRequest} into its lower level representation. @return a ready {@link BinaryMemcacheRequest}. """ ByteBuf extras = ctx.alloc().buffer(); extras.writeInt(msg.expiry()); byte[] key = msg.keyBytes(); short keyLength = (short) key.length; byte extrasLength = (byte) extras.readableBytes(); BinaryMemcacheRequest request = new DefaultBinaryMemcacheRequest(key); request.setExtras(extras); request.setOpcode(OP_TOUCH); request.setKeyLength(keyLength); request.setTotalBodyLength(keyLength + extrasLength); request.setExtrasLength(extrasLength); return request; }
java
private static BinaryMemcacheRequest handleTouchRequest(final ChannelHandlerContext ctx, final TouchRequest msg) { ByteBuf extras = ctx.alloc().buffer(); extras.writeInt(msg.expiry()); byte[] key = msg.keyBytes(); short keyLength = (short) key.length; byte extrasLength = (byte) extras.readableBytes(); BinaryMemcacheRequest request = new DefaultBinaryMemcacheRequest(key); request.setExtras(extras); request.setOpcode(OP_TOUCH); request.setKeyLength(keyLength); request.setTotalBodyLength(keyLength + extrasLength); request.setExtrasLength(extrasLength); return request; }
[ "private", "static", "BinaryMemcacheRequest", "handleTouchRequest", "(", "final", "ChannelHandlerContext", "ctx", ",", "final", "TouchRequest", "msg", ")", "{", "ByteBuf", "extras", "=", "ctx", ".", "alloc", "(", ")", ".", "buffer", "(", ")", ";", "extras", ".", "writeInt", "(", "msg", ".", "expiry", "(", ")", ")", ";", "byte", "[", "]", "key", "=", "msg", ".", "keyBytes", "(", ")", ";", "short", "keyLength", "=", "(", "short", ")", "key", ".", "length", ";", "byte", "extrasLength", "=", "(", "byte", ")", "extras", ".", "readableBytes", "(", ")", ";", "BinaryMemcacheRequest", "request", "=", "new", "DefaultBinaryMemcacheRequest", "(", "key", ")", ";", "request", ".", "setExtras", "(", "extras", ")", ";", "request", ".", "setOpcode", "(", "OP_TOUCH", ")", ";", "request", ".", "setKeyLength", "(", "keyLength", ")", ";", "request", ".", "setTotalBodyLength", "(", "keyLength", "+", "extrasLength", ")", ";", "request", ".", "setExtrasLength", "(", "extrasLength", ")", ";", "return", "request", ";", "}" ]
Encodes a {@link TouchRequest} into its lower level representation. @return a ready {@link BinaryMemcacheRequest}.
[ "Encodes", "a", "{", "@link", "TouchRequest", "}", "into", "its", "lower", "level", "representation", "." ]
train
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java#L647-L661
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/ContentKeyPoliciesInner.java
ContentKeyPoliciesInner.createOrUpdate
public ContentKeyPolicyInner createOrUpdate(String resourceGroupName, String accountName, String contentKeyPolicyName, ContentKeyPolicyInner parameters) { """ Create or update an Content Key Policy. Create or update a Content Key Policy in the Media Services account. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param contentKeyPolicyName The Content Key Policy name. @param parameters The request parameters @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ContentKeyPolicyInner object if successful. """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, contentKeyPolicyName, parameters).toBlocking().single().body(); }
java
public ContentKeyPolicyInner createOrUpdate(String resourceGroupName, String accountName, String contentKeyPolicyName, ContentKeyPolicyInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, contentKeyPolicyName, parameters).toBlocking().single().body(); }
[ "public", "ContentKeyPolicyInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "contentKeyPolicyName", ",", "ContentKeyPolicyInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "contentKeyPolicyName", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Create or update an Content Key Policy. Create or update a Content Key Policy in the Media Services account. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param contentKeyPolicyName The Content Key Policy name. @param parameters The request parameters @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ContentKeyPolicyInner object if successful.
[ "Create", "or", "update", "an", "Content", "Key", "Policy", ".", "Create", "or", "update", "a", "Content", "Key", "Policy", "in", "the", "Media", "Services", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/ContentKeyPoliciesInner.java#L474-L476
icode/ameba
src/main/java/ameba/core/Requests.java
Requests.readEntity
public static <T> T readEntity(Class<T> rawType, Annotation[] annotations) { """ <p>readEntity.</p> @param rawType a {@link java.lang.Class} object. @param annotations an array of {@link java.lang.annotation.Annotation} objects. @param <T> a T object. @return a T object. """ return getRequest().readEntity(rawType, annotations); }
java
public static <T> T readEntity(Class<T> rawType, Annotation[] annotations) { return getRequest().readEntity(rawType, annotations); }
[ "public", "static", "<", "T", ">", "T", "readEntity", "(", "Class", "<", "T", ">", "rawType", ",", "Annotation", "[", "]", "annotations", ")", "{", "return", "getRequest", "(", ")", ".", "readEntity", "(", "rawType", ",", "annotations", ")", ";", "}" ]
<p>readEntity.</p> @param rawType a {@link java.lang.Class} object. @param annotations an array of {@link java.lang.annotation.Annotation} objects. @param <T> a T object. @return a T object.
[ "<p", ">", "readEntity", ".", "<", "/", "p", ">" ]
train
https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/core/Requests.java#L626-L628
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/ManagedPropertyPersistenceHelper.java
ManagedPropertyPersistenceHelper.generateParamParser
public static void generateParamParser(BindTypeContext context, String methodName, TypeName parameterTypeName, PersistType persistType) { """ Generate param parser. @param context the context @param methodName the method name @param parameterTypeName the parameter type name @param persistType the persist type """ methodName = SQLiteDaoDefinition.PARAM_PARSER_PREFIX + methodName; MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder(methodName).addJavadoc("for param $L parsing\n", methodName).returns(parameterTypeName); methodBuilder.addModifiers(context.modifiers); switch (persistType) { case STRING: methodBuilder.addParameter(ParameterSpec.builder(className(String.class), "input").build()); break; case BYTE: methodBuilder.addParameter(ParameterSpec.builder(TypeUtility.arrayTypeName(Byte.TYPE), "input").build()); break; } methodBuilder.beginControlFlow("if (input==null)"); methodBuilder.addStatement("return null"); methodBuilder.endControlFlow(); methodBuilder.addStatement("$T context=$T.jsonBind()", KriptonJsonContext.class, KriptonBinder.class); methodBuilder.beginControlFlow("try ($T wrapper=context.createParser(input))", JacksonWrapperParser.class); methodBuilder.addStatement("$T jacksonParser=wrapper.jacksonParser", JsonParser.class); methodBuilder.addCode("// START_OBJECT\n"); methodBuilder.addStatement("jacksonParser.nextToken()"); methodBuilder.addCode("// value of \"element\"\n"); methodBuilder.addStatement("jacksonParser.nextValue()"); String parserName = "jacksonParser"; BindTransform bindTransform = BindTransformer.lookup(parameterTypeName); methodBuilder.addStatement("$T result=null", parameterTypeName); BindProperty property = BindProperty.builder(parameterTypeName).inCollection(false).elementName(DEFAULT_FIELD_NAME).build(); bindTransform.generateParseOnJackson(context, methodBuilder, parserName, null, "result", property); methodBuilder.addStatement("return result"); methodBuilder.nextControlFlow("catch($T e)", Exception.class); methodBuilder.addStatement("throw(new $T(e.getMessage()))", KriptonRuntimeException.class); methodBuilder.endControlFlow(); // typeBuilder. context.builder.addMethod(methodBuilder.build()); }
java
public static void generateParamParser(BindTypeContext context, String methodName, TypeName parameterTypeName, PersistType persistType) { methodName = SQLiteDaoDefinition.PARAM_PARSER_PREFIX + methodName; MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder(methodName).addJavadoc("for param $L parsing\n", methodName).returns(parameterTypeName); methodBuilder.addModifiers(context.modifiers); switch (persistType) { case STRING: methodBuilder.addParameter(ParameterSpec.builder(className(String.class), "input").build()); break; case BYTE: methodBuilder.addParameter(ParameterSpec.builder(TypeUtility.arrayTypeName(Byte.TYPE), "input").build()); break; } methodBuilder.beginControlFlow("if (input==null)"); methodBuilder.addStatement("return null"); methodBuilder.endControlFlow(); methodBuilder.addStatement("$T context=$T.jsonBind()", KriptonJsonContext.class, KriptonBinder.class); methodBuilder.beginControlFlow("try ($T wrapper=context.createParser(input))", JacksonWrapperParser.class); methodBuilder.addStatement("$T jacksonParser=wrapper.jacksonParser", JsonParser.class); methodBuilder.addCode("// START_OBJECT\n"); methodBuilder.addStatement("jacksonParser.nextToken()"); methodBuilder.addCode("// value of \"element\"\n"); methodBuilder.addStatement("jacksonParser.nextValue()"); String parserName = "jacksonParser"; BindTransform bindTransform = BindTransformer.lookup(parameterTypeName); methodBuilder.addStatement("$T result=null", parameterTypeName); BindProperty property = BindProperty.builder(parameterTypeName).inCollection(false).elementName(DEFAULT_FIELD_NAME).build(); bindTransform.generateParseOnJackson(context, methodBuilder, parserName, null, "result", property); methodBuilder.addStatement("return result"); methodBuilder.nextControlFlow("catch($T e)", Exception.class); methodBuilder.addStatement("throw(new $T(e.getMessage()))", KriptonRuntimeException.class); methodBuilder.endControlFlow(); // typeBuilder. context.builder.addMethod(methodBuilder.build()); }
[ "public", "static", "void", "generateParamParser", "(", "BindTypeContext", "context", ",", "String", "methodName", ",", "TypeName", "parameterTypeName", ",", "PersistType", "persistType", ")", "{", "methodName", "=", "SQLiteDaoDefinition", ".", "PARAM_PARSER_PREFIX", "+", "methodName", ";", "MethodSpec", ".", "Builder", "methodBuilder", "=", "MethodSpec", ".", "methodBuilder", "(", "methodName", ")", ".", "addJavadoc", "(", "\"for param $L parsing\\n\"", ",", "methodName", ")", ".", "returns", "(", "parameterTypeName", ")", ";", "methodBuilder", ".", "addModifiers", "(", "context", ".", "modifiers", ")", ";", "switch", "(", "persistType", ")", "{", "case", "STRING", ":", "methodBuilder", ".", "addParameter", "(", "ParameterSpec", ".", "builder", "(", "className", "(", "String", ".", "class", ")", ",", "\"input\"", ")", ".", "build", "(", ")", ")", ";", "break", ";", "case", "BYTE", ":", "methodBuilder", ".", "addParameter", "(", "ParameterSpec", ".", "builder", "(", "TypeUtility", ".", "arrayTypeName", "(", "Byte", ".", "TYPE", ")", ",", "\"input\"", ")", ".", "build", "(", ")", ")", ";", "break", ";", "}", "methodBuilder", ".", "beginControlFlow", "(", "\"if (input==null)\"", ")", ";", "methodBuilder", ".", "addStatement", "(", "\"return null\"", ")", ";", "methodBuilder", ".", "endControlFlow", "(", ")", ";", "methodBuilder", ".", "addStatement", "(", "\"$T context=$T.jsonBind()\"", ",", "KriptonJsonContext", ".", "class", ",", "KriptonBinder", ".", "class", ")", ";", "methodBuilder", ".", "beginControlFlow", "(", "\"try ($T wrapper=context.createParser(input))\"", ",", "JacksonWrapperParser", ".", "class", ")", ";", "methodBuilder", ".", "addStatement", "(", "\"$T jacksonParser=wrapper.jacksonParser\"", ",", "JsonParser", ".", "class", ")", ";", "methodBuilder", ".", "addCode", "(", "\"// START_OBJECT\\n\"", ")", ";", "methodBuilder", ".", "addStatement", "(", "\"jacksonParser.nextToken()\"", ")", ";", "methodBuilder", ".", "addCode", "(", "\"// value of \\\"element\\\"\\n\"", ")", ";", "methodBuilder", ".", "addStatement", "(", "\"jacksonParser.nextValue()\"", ")", ";", "String", "parserName", "=", "\"jacksonParser\"", ";", "BindTransform", "bindTransform", "=", "BindTransformer", ".", "lookup", "(", "parameterTypeName", ")", ";", "methodBuilder", ".", "addStatement", "(", "\"$T result=null\"", ",", "parameterTypeName", ")", ";", "BindProperty", "property", "=", "BindProperty", ".", "builder", "(", "parameterTypeName", ")", ".", "inCollection", "(", "false", ")", ".", "elementName", "(", "DEFAULT_FIELD_NAME", ")", ".", "build", "(", ")", ";", "bindTransform", ".", "generateParseOnJackson", "(", "context", ",", "methodBuilder", ",", "parserName", ",", "null", ",", "\"result\"", ",", "property", ")", ";", "methodBuilder", ".", "addStatement", "(", "\"return result\"", ")", ";", "methodBuilder", ".", "nextControlFlow", "(", "\"catch($T e)\"", ",", "Exception", ".", "class", ")", ";", "methodBuilder", ".", "addStatement", "(", "\"throw(new $T(e.getMessage()))\"", ",", "KriptonRuntimeException", ".", "class", ")", ";", "methodBuilder", ".", "endControlFlow", "(", ")", ";", "// typeBuilder.", "context", ".", "builder", ".", "addMethod", "(", "methodBuilder", ".", "build", "(", ")", ")", ";", "}" ]
Generate param parser. @param context the context @param methodName the method name @param parameterTypeName the parameter type name @param persistType the persist type
[ "Generate", "param", "parser", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/ManagedPropertyPersistenceHelper.java#L313-L360
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/BetterCFGBuilder2.java
BetterCFGBuilder2.handleExceptions
private void handleExceptions(Subroutine subroutine, InstructionHandle pei, BasicBlock etb) { """ Add exception edges for given instruction. @param subroutine the subroutine containing the instruction @param pei the instruction which throws an exception @param etb the exception thrower block (ETB) for the instruction """ etb.setExceptionThrower(pei); // Remember whether or not a universal exception handler // is reachable. If so, then we know that exceptions raised // at this instruction cannot propagate out of the method. boolean sawUniversalExceptionHandler = false; List<CodeExceptionGen> exceptionHandlerList = exceptionHandlerMap.getHandlerList(pei); if (exceptionHandlerList != null) { for (CodeExceptionGen exceptionHandler : exceptionHandlerList) { InstructionHandle handlerStart = exceptionHandler.getHandlerPC(); subroutine.addEdgeAndExplore(etb, handlerStart, HANDLED_EXCEPTION_EDGE); if (Hierarchy.isUniversalExceptionHandler(exceptionHandler.getCatchType())) { sawUniversalExceptionHandler = true; } } } // If required, mark this block as throwing an unhandled exception. // For now, we assume that if there is no reachable handler that handles // ANY exception type, then the exception can be thrown out of the // method. if (!sawUniversalExceptionHandler) { if (DEBUG) { System.out.println("Adding unhandled exception edge from " + pei); } subroutine.setUnhandledExceptionBlock(etb); } }
java
private void handleExceptions(Subroutine subroutine, InstructionHandle pei, BasicBlock etb) { etb.setExceptionThrower(pei); // Remember whether or not a universal exception handler // is reachable. If so, then we know that exceptions raised // at this instruction cannot propagate out of the method. boolean sawUniversalExceptionHandler = false; List<CodeExceptionGen> exceptionHandlerList = exceptionHandlerMap.getHandlerList(pei); if (exceptionHandlerList != null) { for (CodeExceptionGen exceptionHandler : exceptionHandlerList) { InstructionHandle handlerStart = exceptionHandler.getHandlerPC(); subroutine.addEdgeAndExplore(etb, handlerStart, HANDLED_EXCEPTION_EDGE); if (Hierarchy.isUniversalExceptionHandler(exceptionHandler.getCatchType())) { sawUniversalExceptionHandler = true; } } } // If required, mark this block as throwing an unhandled exception. // For now, we assume that if there is no reachable handler that handles // ANY exception type, then the exception can be thrown out of the // method. if (!sawUniversalExceptionHandler) { if (DEBUG) { System.out.println("Adding unhandled exception edge from " + pei); } subroutine.setUnhandledExceptionBlock(etb); } }
[ "private", "void", "handleExceptions", "(", "Subroutine", "subroutine", ",", "InstructionHandle", "pei", ",", "BasicBlock", "etb", ")", "{", "etb", ".", "setExceptionThrower", "(", "pei", ")", ";", "// Remember whether or not a universal exception handler", "// is reachable. If so, then we know that exceptions raised", "// at this instruction cannot propagate out of the method.", "boolean", "sawUniversalExceptionHandler", "=", "false", ";", "List", "<", "CodeExceptionGen", ">", "exceptionHandlerList", "=", "exceptionHandlerMap", ".", "getHandlerList", "(", "pei", ")", ";", "if", "(", "exceptionHandlerList", "!=", "null", ")", "{", "for", "(", "CodeExceptionGen", "exceptionHandler", ":", "exceptionHandlerList", ")", "{", "InstructionHandle", "handlerStart", "=", "exceptionHandler", ".", "getHandlerPC", "(", ")", ";", "subroutine", ".", "addEdgeAndExplore", "(", "etb", ",", "handlerStart", ",", "HANDLED_EXCEPTION_EDGE", ")", ";", "if", "(", "Hierarchy", ".", "isUniversalExceptionHandler", "(", "exceptionHandler", ".", "getCatchType", "(", ")", ")", ")", "{", "sawUniversalExceptionHandler", "=", "true", ";", "}", "}", "}", "// If required, mark this block as throwing an unhandled exception.", "// For now, we assume that if there is no reachable handler that handles", "// ANY exception type, then the exception can be thrown out of the", "// method.", "if", "(", "!", "sawUniversalExceptionHandler", ")", "{", "if", "(", "DEBUG", ")", "{", "System", ".", "out", ".", "println", "(", "\"Adding unhandled exception edge from \"", "+", "pei", ")", ";", "}", "subroutine", ".", "setUnhandledExceptionBlock", "(", "etb", ")", ";", "}", "}" ]
Add exception edges for given instruction. @param subroutine the subroutine containing the instruction @param pei the instruction which throws an exception @param etb the exception thrower block (ETB) for the instruction
[ "Add", "exception", "edges", "for", "given", "instruction", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/BetterCFGBuilder2.java#L941-L971
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacTypes.java
JavacTypes.validateTypeNotIn
private void validateTypeNotIn(TypeMirror t, Set<TypeKind> invalidKinds) { """ Throws an IllegalArgumentException if a type's kind is one of a set. """ if (invalidKinds.contains(t.getKind())) throw new IllegalArgumentException(t.toString()); }
java
private void validateTypeNotIn(TypeMirror t, Set<TypeKind> invalidKinds) { if (invalidKinds.contains(t.getKind())) throw new IllegalArgumentException(t.toString()); }
[ "private", "void", "validateTypeNotIn", "(", "TypeMirror", "t", ",", "Set", "<", "TypeKind", ">", "invalidKinds", ")", "{", "if", "(", "invalidKinds", ".", "contains", "(", "t", ".", "getKind", "(", ")", ")", ")", "throw", "new", "IllegalArgumentException", "(", "t", ".", "toString", "(", ")", ")", ";", "}" ]
Throws an IllegalArgumentException if a type's kind is one of a set.
[ "Throws", "an", "IllegalArgumentException", "if", "a", "type", "s", "kind", "is", "one", "of", "a", "set", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacTypes.java#L310-L313
alkacon/opencms-core
src/org/opencms/main/CmsSystemInfo.java
CmsSystemInfo.initVersion
private void initVersion() { """ Initializes the version for this OpenCms, will be called by {@link OpenCmsServlet} or {@link CmsShell} upon system startup.<p> """ // initialize version information with static defaults m_versionNumber = DEFAULT_VERSION_NUMBER; m_versionId = DEFAULT_VERSION_ID; m_version = "OpenCms/" + m_versionNumber; m_buildInfo = Collections.emptyMap(); // read the version-informations from properties Properties props = new Properties(); try { props.load(this.getClass().getClassLoader().getResourceAsStream("org/opencms/main/version.properties")); } catch (Throwable t) { // no properties found - we just use the defaults return; } // initialize OpenCms version information from the property values m_versionNumber = props.getProperty("version.number", DEFAULT_VERSION_NUMBER); m_versionId = props.getProperty("version.id", DEFAULT_VERSION_ID); m_version = "OpenCms/" + m_versionNumber; m_buildInfo = new TreeMap<String, BuildInfoItem>(); // iterate the properties and generate the build information from the entries for (String key : props.stringPropertyNames()) { if (!"version.number".equals(key) && !"version.id".equals(key) && !key.startsWith("nicename")) { String value = props.getProperty(key); String nicename = props.getProperty("nicename." + key, key); m_buildInfo.put(key, new BuildInfoItem(value, nicename, key)); } } // make the map unmodifiable m_buildInfo = Collections.unmodifiableMap(m_buildInfo); }
java
private void initVersion() { // initialize version information with static defaults m_versionNumber = DEFAULT_VERSION_NUMBER; m_versionId = DEFAULT_VERSION_ID; m_version = "OpenCms/" + m_versionNumber; m_buildInfo = Collections.emptyMap(); // read the version-informations from properties Properties props = new Properties(); try { props.load(this.getClass().getClassLoader().getResourceAsStream("org/opencms/main/version.properties")); } catch (Throwable t) { // no properties found - we just use the defaults return; } // initialize OpenCms version information from the property values m_versionNumber = props.getProperty("version.number", DEFAULT_VERSION_NUMBER); m_versionId = props.getProperty("version.id", DEFAULT_VERSION_ID); m_version = "OpenCms/" + m_versionNumber; m_buildInfo = new TreeMap<String, BuildInfoItem>(); // iterate the properties and generate the build information from the entries for (String key : props.stringPropertyNames()) { if (!"version.number".equals(key) && !"version.id".equals(key) && !key.startsWith("nicename")) { String value = props.getProperty(key); String nicename = props.getProperty("nicename." + key, key); m_buildInfo.put(key, new BuildInfoItem(value, nicename, key)); } } // make the map unmodifiable m_buildInfo = Collections.unmodifiableMap(m_buildInfo); }
[ "private", "void", "initVersion", "(", ")", "{", "// initialize version information with static defaults", "m_versionNumber", "=", "DEFAULT_VERSION_NUMBER", ";", "m_versionId", "=", "DEFAULT_VERSION_ID", ";", "m_version", "=", "\"OpenCms/\"", "+", "m_versionNumber", ";", "m_buildInfo", "=", "Collections", ".", "emptyMap", "(", ")", ";", "// read the version-informations from properties", "Properties", "props", "=", "new", "Properties", "(", ")", ";", "try", "{", "props", ".", "load", "(", "this", ".", "getClass", "(", ")", ".", "getClassLoader", "(", ")", ".", "getResourceAsStream", "(", "\"org/opencms/main/version.properties\"", ")", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "// no properties found - we just use the defaults", "return", ";", "}", "// initialize OpenCms version information from the property values", "m_versionNumber", "=", "props", ".", "getProperty", "(", "\"version.number\"", ",", "DEFAULT_VERSION_NUMBER", ")", ";", "m_versionId", "=", "props", ".", "getProperty", "(", "\"version.id\"", ",", "DEFAULT_VERSION_ID", ")", ";", "m_version", "=", "\"OpenCms/\"", "+", "m_versionNumber", ";", "m_buildInfo", "=", "new", "TreeMap", "<", "String", ",", "BuildInfoItem", ">", "(", ")", ";", "// iterate the properties and generate the build information from the entries", "for", "(", "String", "key", ":", "props", ".", "stringPropertyNames", "(", ")", ")", "{", "if", "(", "!", "\"version.number\"", ".", "equals", "(", "key", ")", "&&", "!", "\"version.id\"", ".", "equals", "(", "key", ")", "&&", "!", "key", ".", "startsWith", "(", "\"nicename\"", ")", ")", "{", "String", "value", "=", "props", ".", "getProperty", "(", "key", ")", ";", "String", "nicename", "=", "props", ".", "getProperty", "(", "\"nicename.\"", "+", "key", ",", "key", ")", ";", "m_buildInfo", ".", "put", "(", "key", ",", "new", "BuildInfoItem", "(", "value", ",", "nicename", ",", "key", ")", ")", ";", "}", "}", "// make the map unmodifiable", "m_buildInfo", "=", "Collections", ".", "unmodifiableMap", "(", "m_buildInfo", ")", ";", "}" ]
Initializes the version for this OpenCms, will be called by {@link OpenCmsServlet} or {@link CmsShell} upon system startup.<p>
[ "Initializes", "the", "version", "for", "this", "OpenCms", "will", "be", "called", "by", "{" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsSystemInfo.java#L850-L881
michael-rapp/AndroidUtil
library/src/main/java/de/mrapp/android/util/logging/Logger.java
Logger.logError
public final void logError(@NonNull final Class<?> tag, @NonNull final String message) { """ Logs a specific message on the log level ERROR. @param tag The tag, which identifies the source of the log message, as an instance of the class {@link Class}. The tag may not be null @param message The message, which should be logged, as a {@link String}. The message may neither be null, nor empty """ Condition.INSTANCE.ensureNotNull(tag, "The tag may not be null"); Condition.INSTANCE.ensureNotNull(message, "The message may not be null"); Condition.INSTANCE.ensureNotEmpty(message, "The message may not be empty"); if (LogLevel.ERROR.getRank() >= getLogLevel().getRank()) { Log.e(ClassUtil.INSTANCE.getTruncatedName(tag), message); } }
java
public final void logError(@NonNull final Class<?> tag, @NonNull final String message) { Condition.INSTANCE.ensureNotNull(tag, "The tag may not be null"); Condition.INSTANCE.ensureNotNull(message, "The message may not be null"); Condition.INSTANCE.ensureNotEmpty(message, "The message may not be empty"); if (LogLevel.ERROR.getRank() >= getLogLevel().getRank()) { Log.e(ClassUtil.INSTANCE.getTruncatedName(tag), message); } }
[ "public", "final", "void", "logError", "(", "@", "NonNull", "final", "Class", "<", "?", ">", "tag", ",", "@", "NonNull", "final", "String", "message", ")", "{", "Condition", ".", "INSTANCE", ".", "ensureNotNull", "(", "tag", ",", "\"The tag may not be null\"", ")", ";", "Condition", ".", "INSTANCE", ".", "ensureNotNull", "(", "message", ",", "\"The message may not be null\"", ")", ";", "Condition", ".", "INSTANCE", ".", "ensureNotEmpty", "(", "message", ",", "\"The message may not be empty\"", ")", ";", "if", "(", "LogLevel", ".", "ERROR", ".", "getRank", "(", ")", ">=", "getLogLevel", "(", ")", ".", "getRank", "(", ")", ")", "{", "Log", ".", "e", "(", "ClassUtil", ".", "INSTANCE", ".", "getTruncatedName", "(", "tag", ")", ",", "message", ")", ";", "}", "}" ]
Logs a specific message on the log level ERROR. @param tag The tag, which identifies the source of the log message, as an instance of the class {@link Class}. The tag may not be null @param message The message, which should be logged, as a {@link String}. The message may neither be null, nor empty
[ "Logs", "a", "specific", "message", "on", "the", "log", "level", "ERROR", "." ]
train
https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/logging/Logger.java#L262-L270
alkacon/opencms-core
src/org/opencms/db/generic/CmsSqlManager.java
CmsSqlManager.readQuery
public String readQuery(CmsProject project, String queryKey) { """ Searches for the SQL query with the specified key and CmsProject.<p> @param project the specified CmsProject @param queryKey the key of the SQL query @return the the SQL query in this property list with the specified key """ return readQuery(project.getUuid(), queryKey); }
java
public String readQuery(CmsProject project, String queryKey) { return readQuery(project.getUuid(), queryKey); }
[ "public", "String", "readQuery", "(", "CmsProject", "project", ",", "String", "queryKey", ")", "{", "return", "readQuery", "(", "project", ".", "getUuid", "(", ")", ",", "queryKey", ")", ";", "}" ]
Searches for the SQL query with the specified key and CmsProject.<p> @param project the specified CmsProject @param queryKey the key of the SQL query @return the the SQL query in this property list with the specified key
[ "Searches", "for", "the", "SQL", "query", "with", "the", "specified", "key", "and", "CmsProject", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsSqlManager.java#L313-L316
apptik/jus
rx-jus/src/main/java/io/apptik/comm/jus/rx/queue/RxRequestQueue.java
RxRequestQueue.errorObservable
public static Observable<ErrorEvent> errorObservable( RequestQueue queue, RequestQueue.RequestFilter filter) { """ Returns {@link Observable} of error events coming as {@link ErrorEvent} @param queue the {@link RequestQueue} to listen to @param filter the {@link io.apptik.comm.jus.RequestQueue.RequestFilter} which will filter the requests to hook to. Set null for no filtering. @return {@link Observable} of errors """ return Observable.create(new QRequestErrorOnSubscribe(queue, filter)); }
java
public static Observable<ErrorEvent> errorObservable( RequestQueue queue, RequestQueue.RequestFilter filter) { return Observable.create(new QRequestErrorOnSubscribe(queue, filter)); }
[ "public", "static", "Observable", "<", "ErrorEvent", ">", "errorObservable", "(", "RequestQueue", "queue", ",", "RequestQueue", ".", "RequestFilter", "filter", ")", "{", "return", "Observable", ".", "create", "(", "new", "QRequestErrorOnSubscribe", "(", "queue", ",", "filter", ")", ")", ";", "}" ]
Returns {@link Observable} of error events coming as {@link ErrorEvent} @param queue the {@link RequestQueue} to listen to @param filter the {@link io.apptik.comm.jus.RequestQueue.RequestFilter} which will filter the requests to hook to. Set null for no filtering. @return {@link Observable} of errors
[ "Returns", "{", "@link", "Observable", "}", "of", "error", "events", "coming", "as", "{", "@link", "ErrorEvent", "}" ]
train
https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/rx-jus/src/main/java/io/apptik/comm/jus/rx/queue/RxRequestQueue.java#L76-L79
powermock/powermock
powermock-api/powermock-api-mockito2/src/main/java/org/powermock/api/mockito/PowerMockito.java
PowerMockito.mockStatic
public static void mockStatic(Class<?> classToMock, MockSettings mockSettings) { """ Creates a class mock with some non-standard settings. <p> The number of configuration points for a mock grows so we need a fluent way to introduce new configuration without adding more and more overloaded PowerMockito.mockStatic() methods. Hence {@link MockSettings}. <p> <pre> mockStatic(Listener.class, withSettings() .name(&quot;firstListner&quot;).defaultBehavior(RETURNS_SMART_NULLS)); ); </pre> <p> <b>Use it carefully and occasionally</b>. What might be reason your test needs non-standard mocks? Is the code under test so complicated that it requires non-standard mocks? Wouldn't you prefer to refactor the code under test so it is testable in a simple way? <p> See also {@link Mockito#withSettings()} @param classToMock class to mock @param mockSettings additional mock settings """ DefaultMockCreator.mock(classToMock, true, false, null, mockSettings, (Method[]) null); }
java
public static void mockStatic(Class<?> classToMock, MockSettings mockSettings) { DefaultMockCreator.mock(classToMock, true, false, null, mockSettings, (Method[]) null); }
[ "public", "static", "void", "mockStatic", "(", "Class", "<", "?", ">", "classToMock", ",", "MockSettings", "mockSettings", ")", "{", "DefaultMockCreator", ".", "mock", "(", "classToMock", ",", "true", ",", "false", ",", "null", ",", "mockSettings", ",", "(", "Method", "[", "]", ")", "null", ")", ";", "}" ]
Creates a class mock with some non-standard settings. <p> The number of configuration points for a mock grows so we need a fluent way to introduce new configuration without adding more and more overloaded PowerMockito.mockStatic() methods. Hence {@link MockSettings}. <p> <pre> mockStatic(Listener.class, withSettings() .name(&quot;firstListner&quot;).defaultBehavior(RETURNS_SMART_NULLS)); ); </pre> <p> <b>Use it carefully and occasionally</b>. What might be reason your test needs non-standard mocks? Is the code under test so complicated that it requires non-standard mocks? Wouldn't you prefer to refactor the code under test so it is testable in a simple way? <p> See also {@link Mockito#withSettings()} @param classToMock class to mock @param mockSettings additional mock settings
[ "Creates", "a", "class", "mock", "with", "some", "non", "-", "standard", "settings", ".", "<p", ">", "The", "number", "of", "configuration", "points", "for", "a", "mock", "grows", "so", "we", "need", "a", "fluent", "way", "to", "introduce", "new", "configuration", "without", "adding", "more", "and", "more", "overloaded", "PowerMockito", ".", "mockStatic", "()", "methods", ".", "Hence", "{", "@link", "MockSettings", "}", ".", "<p", ">", "<pre", ">", "mockStatic", "(", "Listener", ".", "class", "withSettings", "()", ".", "name", "(", "&quot", ";", "firstListner&quot", ";", ")", ".", "defaultBehavior", "(", "RETURNS_SMART_NULLS", "))", ";", ")", ";", "<", "/", "pre", ">", "<p", ">", "<b", ">", "Use", "it", "carefully", "and", "occasionally<", "/", "b", ">", ".", "What", "might", "be", "reason", "your", "test", "needs", "non", "-", "standard", "mocks?", "Is", "the", "code", "under", "test", "so", "complicated", "that", "it", "requires", "non", "-", "standard", "mocks?", "Wouldn", "t", "you", "prefer", "to", "refactor", "the", "code", "under", "test", "so", "it", "is", "testable", "in", "a", "simple", "way?", "<p", ">", "See", "also", "{", "@link", "Mockito#withSettings", "()", "}" ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-mockito2/src/main/java/org/powermock/api/mockito/PowerMockito.java#L114-L116
VoltDB/voltdb
third_party/java/src/org/apache/zookeeper_voltpatches/server/DataTree.java
DataTree.updateCount
public void updateCount(String lastPrefix, int diff) { """ update the count of this stat datanode @param lastPrefix the path of the node that is quotaed. @param diff the diff to be added to the count """ String statNode = Quotas.statPath(lastPrefix); DataNode node = nodes.get(statNode); StatsTrack updatedStat = null; if (node == null) { // should not happen LOG.error("Missing count node for stat " + statNode); return; } synchronized (node) { updatedStat = new StatsTrack(new String(node.data)); updatedStat.setCount(updatedStat.getCount() + diff); node.data = updatedStat.toString().getBytes(); } // now check if the counts match the quota String quotaNode = Quotas.quotaPath(lastPrefix); node = nodes.get(quotaNode); StatsTrack thisStats = null; if (node == null) { // should not happen LOG.error("Missing count node for quota " + quotaNode); return; } synchronized (node) { thisStats = new StatsTrack(new String(node.data)); } if (thisStats.getCount() < updatedStat.getCount()) { LOG .warn("Quota exceeded: " + lastPrefix + " count=" + updatedStat.getCount() + " limit=" + thisStats.getCount()); } }
java
public void updateCount(String lastPrefix, int diff) { String statNode = Quotas.statPath(lastPrefix); DataNode node = nodes.get(statNode); StatsTrack updatedStat = null; if (node == null) { // should not happen LOG.error("Missing count node for stat " + statNode); return; } synchronized (node) { updatedStat = new StatsTrack(new String(node.data)); updatedStat.setCount(updatedStat.getCount() + diff); node.data = updatedStat.toString().getBytes(); } // now check if the counts match the quota String quotaNode = Quotas.quotaPath(lastPrefix); node = nodes.get(quotaNode); StatsTrack thisStats = null; if (node == null) { // should not happen LOG.error("Missing count node for quota " + quotaNode); return; } synchronized (node) { thisStats = new StatsTrack(new String(node.data)); } if (thisStats.getCount() < updatedStat.getCount()) { LOG .warn("Quota exceeded: " + lastPrefix + " count=" + updatedStat.getCount() + " limit=" + thisStats.getCount()); } }
[ "public", "void", "updateCount", "(", "String", "lastPrefix", ",", "int", "diff", ")", "{", "String", "statNode", "=", "Quotas", ".", "statPath", "(", "lastPrefix", ")", ";", "DataNode", "node", "=", "nodes", ".", "get", "(", "statNode", ")", ";", "StatsTrack", "updatedStat", "=", "null", ";", "if", "(", "node", "==", "null", ")", "{", "// should not happen", "LOG", ".", "error", "(", "\"Missing count node for stat \"", "+", "statNode", ")", ";", "return", ";", "}", "synchronized", "(", "node", ")", "{", "updatedStat", "=", "new", "StatsTrack", "(", "new", "String", "(", "node", ".", "data", ")", ")", ";", "updatedStat", ".", "setCount", "(", "updatedStat", ".", "getCount", "(", ")", "+", "diff", ")", ";", "node", ".", "data", "=", "updatedStat", ".", "toString", "(", ")", ".", "getBytes", "(", ")", ";", "}", "// now check if the counts match the quota", "String", "quotaNode", "=", "Quotas", ".", "quotaPath", "(", "lastPrefix", ")", ";", "node", "=", "nodes", ".", "get", "(", "quotaNode", ")", ";", "StatsTrack", "thisStats", "=", "null", ";", "if", "(", "node", "==", "null", ")", "{", "// should not happen", "LOG", ".", "error", "(", "\"Missing count node for quota \"", "+", "quotaNode", ")", ";", "return", ";", "}", "synchronized", "(", "node", ")", "{", "thisStats", "=", "new", "StatsTrack", "(", "new", "String", "(", "node", ".", "data", ")", ")", ";", "}", "if", "(", "thisStats", ".", "getCount", "(", ")", "<", "updatedStat", ".", "getCount", "(", ")", ")", "{", "LOG", ".", "warn", "(", "\"Quota exceeded: \"", "+", "lastPrefix", "+", "\" count=\"", "+", "updatedStat", ".", "getCount", "(", ")", "+", "\" limit=\"", "+", "thisStats", ".", "getCount", "(", ")", ")", ";", "}", "}" ]
update the count of this stat datanode @param lastPrefix the path of the node that is quotaed. @param diff the diff to be added to the count
[ "update", "the", "count", "of", "this", "stat", "datanode" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/zookeeper_voltpatches/server/DataTree.java#L351-L383
smallnest/fastjson-jaxrs-json-provider
src/main/java/com/colobu/fastjson/FastJsonProvider.java
FastJsonProvider.isReadable
public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { """ Method that JAX-RS container calls to try to check whether values of given type (and media type) can be deserialized by this provider. """ if (!hasMatchingMediaType(mediaType)) { return false; } return isValidType(type, annotations); }
java
public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (!hasMatchingMediaType(mediaType)) { return false; } return isValidType(type, annotations); }
[ "public", "boolean", "isReadable", "(", "Class", "<", "?", ">", "type", ",", "Type", "genericType", ",", "Annotation", "[", "]", "annotations", ",", "MediaType", "mediaType", ")", "{", "if", "(", "!", "hasMatchingMediaType", "(", "mediaType", ")", ")", "{", "return", "false", ";", "}", "return", "isValidType", "(", "type", ",", "annotations", ")", ";", "}" ]
Method that JAX-RS container calls to try to check whether values of given type (and media type) can be deserialized by this provider.
[ "Method", "that", "JAX", "-", "RS", "container", "calls", "to", "try", "to", "check", "whether", "values", "of", "given", "type", "(", "and", "media", "type", ")", "can", "be", "deserialized", "by", "this", "provider", "." ]
train
https://github.com/smallnest/fastjson-jaxrs-json-provider/blob/bbdb2e3d101069bf62c026976ff9d00967671ec0/src/main/java/com/colobu/fastjson/FastJsonProvider.java#L259-L265
msteiger/jxmapviewer2
jxmapviewer2/src/main/java/org/jxmapviewer/viewer/util/GeoUtil.java
GeoUtil.getPosition
public static GeoPosition getPosition(Point2D pixelCoordinate, int zoom, TileFactoryInfo info) { """ Convert an on screen pixel coordinate and a zoom level to a geo position @param pixelCoordinate the coordinate in pixels @param zoom the zoom level @param info the tile factory info @return a geo position """ // p(" --bitmap to latlon : " + coord + " " + zoom); double wx = pixelCoordinate.getX(); double wy = pixelCoordinate.getY(); // this reverses getBitmapCoordinates double flon = (wx - info.getMapCenterInPixelsAtZoom(zoom).getX()) / info.getLongitudeDegreeWidthInPixels(zoom); double e1 = (wy - info.getMapCenterInPixelsAtZoom(zoom).getY()) / (-1 * info.getLongitudeRadianWidthInPixels(zoom)); double e2 = (2 * Math.atan(Math.exp(e1)) - Math.PI / 2) / (Math.PI / 180.0); double flat = e2; GeoPosition wc = new GeoPosition(flat, flon); return wc; }
java
public static GeoPosition getPosition(Point2D pixelCoordinate, int zoom, TileFactoryInfo info) { // p(" --bitmap to latlon : " + coord + " " + zoom); double wx = pixelCoordinate.getX(); double wy = pixelCoordinate.getY(); // this reverses getBitmapCoordinates double flon = (wx - info.getMapCenterInPixelsAtZoom(zoom).getX()) / info.getLongitudeDegreeWidthInPixels(zoom); double e1 = (wy - info.getMapCenterInPixelsAtZoom(zoom).getY()) / (-1 * info.getLongitudeRadianWidthInPixels(zoom)); double e2 = (2 * Math.atan(Math.exp(e1)) - Math.PI / 2) / (Math.PI / 180.0); double flat = e2; GeoPosition wc = new GeoPosition(flat, flon); return wc; }
[ "public", "static", "GeoPosition", "getPosition", "(", "Point2D", "pixelCoordinate", ",", "int", "zoom", ",", "TileFactoryInfo", "info", ")", "{", "// p(\" --bitmap to latlon : \" + coord + \" \" + zoom);", "double", "wx", "=", "pixelCoordinate", ".", "getX", "(", ")", ";", "double", "wy", "=", "pixelCoordinate", ".", "getY", "(", ")", ";", "// this reverses getBitmapCoordinates", "double", "flon", "=", "(", "wx", "-", "info", ".", "getMapCenterInPixelsAtZoom", "(", "zoom", ")", ".", "getX", "(", ")", ")", "/", "info", ".", "getLongitudeDegreeWidthInPixels", "(", "zoom", ")", ";", "double", "e1", "=", "(", "wy", "-", "info", ".", "getMapCenterInPixelsAtZoom", "(", "zoom", ")", ".", "getY", "(", ")", ")", "/", "(", "-", "1", "*", "info", ".", "getLongitudeRadianWidthInPixels", "(", "zoom", ")", ")", ";", "double", "e2", "=", "(", "2", "*", "Math", ".", "atan", "(", "Math", ".", "exp", "(", "e1", ")", ")", "-", "Math", ".", "PI", "/", "2", ")", "/", "(", "Math", ".", "PI", "/", "180.0", ")", ";", "double", "flat", "=", "e2", ";", "GeoPosition", "wc", "=", "new", "GeoPosition", "(", "flat", ",", "flon", ")", ";", "return", "wc", ";", "}" ]
Convert an on screen pixel coordinate and a zoom level to a geo position @param pixelCoordinate the coordinate in pixels @param zoom the zoom level @param info the tile factory info @return a geo position
[ "Convert", "an", "on", "screen", "pixel", "coordinate", "and", "a", "zoom", "level", "to", "a", "geo", "position" ]
train
https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/viewer/util/GeoUtil.java#L123-L136
alkacon/opencms-core
src-gwt/org/opencms/ade/publish/client/CmsPublishDialog.java
CmsPublishDialog.getWorkflowActionParams
protected CmsWorkflowActionParams getWorkflowActionParams() { """ Gets the workflow action parameters to which the workflow action should be applied.<p> @return the workflow action parameters """ if (m_publishSelectPanel.isShowResources()) { List<CmsUUID> resourcesToPublish = new ArrayList<CmsUUID>(m_publishSelectPanel.getResourcesToPublish()); List<CmsUUID> resourcesToRemove = new ArrayList<CmsUUID>(m_publishSelectPanel.getResourcesToRemove()); CmsWorkflowActionParams actionParams = new CmsWorkflowActionParams(resourcesToPublish, resourcesToRemove); return actionParams; } else { CmsPublishOptions options = getPublishOptions(); CmsWorkflow workflow = getSelectedWorkflow(); return new CmsWorkflowActionParams(new CmsPublishListToken(workflow, options)); } }
java
protected CmsWorkflowActionParams getWorkflowActionParams() { if (m_publishSelectPanel.isShowResources()) { List<CmsUUID> resourcesToPublish = new ArrayList<CmsUUID>(m_publishSelectPanel.getResourcesToPublish()); List<CmsUUID> resourcesToRemove = new ArrayList<CmsUUID>(m_publishSelectPanel.getResourcesToRemove()); CmsWorkflowActionParams actionParams = new CmsWorkflowActionParams(resourcesToPublish, resourcesToRemove); return actionParams; } else { CmsPublishOptions options = getPublishOptions(); CmsWorkflow workflow = getSelectedWorkflow(); return new CmsWorkflowActionParams(new CmsPublishListToken(workflow, options)); } }
[ "protected", "CmsWorkflowActionParams", "getWorkflowActionParams", "(", ")", "{", "if", "(", "m_publishSelectPanel", ".", "isShowResources", "(", ")", ")", "{", "List", "<", "CmsUUID", ">", "resourcesToPublish", "=", "new", "ArrayList", "<", "CmsUUID", ">", "(", "m_publishSelectPanel", ".", "getResourcesToPublish", "(", ")", ")", ";", "List", "<", "CmsUUID", ">", "resourcesToRemove", "=", "new", "ArrayList", "<", "CmsUUID", ">", "(", "m_publishSelectPanel", ".", "getResourcesToRemove", "(", ")", ")", ";", "CmsWorkflowActionParams", "actionParams", "=", "new", "CmsWorkflowActionParams", "(", "resourcesToPublish", ",", "resourcesToRemove", ")", ";", "return", "actionParams", ";", "}", "else", "{", "CmsPublishOptions", "options", "=", "getPublishOptions", "(", ")", ";", "CmsWorkflow", "workflow", "=", "getSelectedWorkflow", "(", ")", ";", "return", "new", "CmsWorkflowActionParams", "(", "new", "CmsPublishListToken", "(", "workflow", ",", "options", ")", ")", ";", "}", "}" ]
Gets the workflow action parameters to which the workflow action should be applied.<p> @return the workflow action parameters
[ "Gets", "the", "workflow", "action", "parameters", "to", "which", "the", "workflow", "action", "should", "be", "applied", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/publish/client/CmsPublishDialog.java#L661-L674
awin/rabbiteasy
rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/consumer/ConsumerContainer.java
ConsumerContainer.addConsumer
public void addConsumer(Consumer consumer, String queue) { """ Adds a consumer to the container and binds it to the given queue with auto acknowledge disabled. Does NOT enable the consumer to consume from the message broker until the container is started. @param consumer The consumer @param queue The queue to bind the consume to """ addConsumer(consumer, new ConsumerConfiguration(queue), DEFAULT_AMOUNT_OF_INSTANCES); }
java
public void addConsumer(Consumer consumer, String queue) { addConsumer(consumer, new ConsumerConfiguration(queue), DEFAULT_AMOUNT_OF_INSTANCES); }
[ "public", "void", "addConsumer", "(", "Consumer", "consumer", ",", "String", "queue", ")", "{", "addConsumer", "(", "consumer", ",", "new", "ConsumerConfiguration", "(", "queue", ")", ",", "DEFAULT_AMOUNT_OF_INSTANCES", ")", ";", "}" ]
Adds a consumer to the container and binds it to the given queue with auto acknowledge disabled. Does NOT enable the consumer to consume from the message broker until the container is started. @param consumer The consumer @param queue The queue to bind the consume to
[ "Adds", "a", "consumer", "to", "the", "container", "and", "binds", "it", "to", "the", "given", "queue", "with", "auto", "acknowledge", "disabled", ".", "Does", "NOT", "enable", "the", "consumer", "to", "consume", "from", "the", "message", "broker", "until", "the", "container", "is", "started", "." ]
train
https://github.com/awin/rabbiteasy/blob/c161efda6c0f7ef319aedf09dfe40a4a90165510/rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/consumer/ConsumerContainer.java#L59-L61
DDTH/ddth-redis
src/main/java/com/github/ddth/redis/RedisClientFactory.java
RedisClientFactory.getRedisClient
public IRedisClient getRedisClient(String host) { """ Gets or Creates a {@link IRedisClient} object. @param host @return """ return getRedisClient(host, IRedisClient.DEFAULT_REDIS_PORT, null, null); }
java
public IRedisClient getRedisClient(String host) { return getRedisClient(host, IRedisClient.DEFAULT_REDIS_PORT, null, null); }
[ "public", "IRedisClient", "getRedisClient", "(", "String", "host", ")", "{", "return", "getRedisClient", "(", "host", ",", "IRedisClient", ".", "DEFAULT_REDIS_PORT", ",", "null", ",", "null", ")", ";", "}" ]
Gets or Creates a {@link IRedisClient} object. @param host @return
[ "Gets", "or", "Creates", "a", "{", "@link", "IRedisClient", "}", "object", "." ]
train
https://github.com/DDTH/ddth-redis/blob/7e6abc3e43c9efe7e9c293d421c94227253ded87/src/main/java/com/github/ddth/redis/RedisClientFactory.java#L151-L153
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/core/repository/index/util/ValidationIndexUtil.java
ValidationIndexUtil.removeIndexData
public static void removeIndexData(ValidationData data, ValidationDataIndex index) { """ Remove index data. @param data the data @param index the index """ String key = index.getKey(data); List<ValidationData> datas = index.get(key); if (!datas.isEmpty()) { datas = datas.stream().filter(d -> !d.getId().equals(data.getId())).collect(Collectors.toList()); } if (datas.isEmpty()) { index.getMap().remove(key); } else { index.getMap().put(key, datas); } }
java
public static void removeIndexData(ValidationData data, ValidationDataIndex index) { String key = index.getKey(data); List<ValidationData> datas = index.get(key); if (!datas.isEmpty()) { datas = datas.stream().filter(d -> !d.getId().equals(data.getId())).collect(Collectors.toList()); } if (datas.isEmpty()) { index.getMap().remove(key); } else { index.getMap().put(key, datas); } }
[ "public", "static", "void", "removeIndexData", "(", "ValidationData", "data", ",", "ValidationDataIndex", "index", ")", "{", "String", "key", "=", "index", ".", "getKey", "(", "data", ")", ";", "List", "<", "ValidationData", ">", "datas", "=", "index", ".", "get", "(", "key", ")", ";", "if", "(", "!", "datas", ".", "isEmpty", "(", ")", ")", "{", "datas", "=", "datas", ".", "stream", "(", ")", ".", "filter", "(", "d", "->", "!", "d", ".", "getId", "(", ")", ".", "equals", "(", "data", ".", "getId", "(", ")", ")", ")", ".", "collect", "(", "Collectors", ".", "toList", "(", ")", ")", ";", "}", "if", "(", "datas", ".", "isEmpty", "(", ")", ")", "{", "index", ".", "getMap", "(", ")", ".", "remove", "(", "key", ")", ";", "}", "else", "{", "index", ".", "getMap", "(", ")", ".", "put", "(", "key", ",", "datas", ")", ";", "}", "}" ]
Remove index data. @param data the data @param index the index
[ "Remove", "index", "data", "." ]
train
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/core/repository/index/util/ValidationIndexUtil.java#L37-L50
f2prateek/dart
henson/src/main/java/dart/henson/Bundler.java
Bundler.put
public Bundler put(String key, String value) { """ Inserts a String value into the mapping of the underlying Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value a String, or null @return this bundler instance to chain method calls """ delegate.putString(key, value); return this; }
java
public Bundler put(String key, String value) { delegate.putString(key, value); return this; }
[ "public", "Bundler", "put", "(", "String", "key", ",", "String", "value", ")", "{", "delegate", ".", "putString", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts a String value into the mapping of the underlying Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value a String, or null @return this bundler instance to chain method calls
[ "Inserts", "a", "String", "value", "into", "the", "mapping", "of", "the", "underlying", "Bundle", "replacing", "any", "existing", "value", "for", "the", "given", "key", ".", "Either", "key", "or", "value", "may", "be", "null", "." ]
train
https://github.com/f2prateek/dart/blob/7163b1b148e5141817975ae7dad99d58a8589aeb/henson/src/main/java/dart/henson/Bundler.java#L166-L169
graknlabs/grakn
server/src/graql/gremlin/TraversalPlanner.java
TraversalPlanner.createTraversal
public static GraqlTraversal createTraversal(Pattern pattern, TransactionOLTP tx) { """ Create a traversal plan. @param pattern a pattern to find a query plan for @return a semi-optimal traversal plan """ Collection<Conjunction<Statement>> patterns = pattern.getDisjunctiveNormalForm().getPatterns(); Set<? extends List<Fragment>> fragments = patterns.stream() .map(conjunction -> new ConjunctionQuery(conjunction, tx)) .map((ConjunctionQuery query) -> planForConjunction(query, tx)) .collect(toImmutableSet()); return GraqlTraversal.create(fragments); }
java
public static GraqlTraversal createTraversal(Pattern pattern, TransactionOLTP tx) { Collection<Conjunction<Statement>> patterns = pattern.getDisjunctiveNormalForm().getPatterns(); Set<? extends List<Fragment>> fragments = patterns.stream() .map(conjunction -> new ConjunctionQuery(conjunction, tx)) .map((ConjunctionQuery query) -> planForConjunction(query, tx)) .collect(toImmutableSet()); return GraqlTraversal.create(fragments); }
[ "public", "static", "GraqlTraversal", "createTraversal", "(", "Pattern", "pattern", ",", "TransactionOLTP", "tx", ")", "{", "Collection", "<", "Conjunction", "<", "Statement", ">>", "patterns", "=", "pattern", ".", "getDisjunctiveNormalForm", "(", ")", ".", "getPatterns", "(", ")", ";", "Set", "<", "?", "extends", "List", "<", "Fragment", ">", ">", "fragments", "=", "patterns", ".", "stream", "(", ")", ".", "map", "(", "conjunction", "->", "new", "ConjunctionQuery", "(", "conjunction", ",", "tx", ")", ")", ".", "map", "(", "(", "ConjunctionQuery", "query", ")", "->", "planForConjunction", "(", "query", ",", "tx", ")", ")", ".", "collect", "(", "toImmutableSet", "(", ")", ")", ";", "return", "GraqlTraversal", ".", "create", "(", "fragments", ")", ";", "}" ]
Create a traversal plan. @param pattern a pattern to find a query plan for @return a semi-optimal traversal plan
[ "Create", "a", "traversal", "plan", "." ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/TraversalPlanner.java#L77-L86
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/executiongraph/ExecutionGraph.java
ExecutionGraph.jobHasScheduledStatus
private boolean jobHasScheduledStatus() { """ Checks whether the job represented by the execution graph has the status <code>SCHEDULED</code>. @return <code>true</code> if the job has the status <code>SCHEDULED</code>, <code>false</code> otherwise """ final Iterator<ExecutionVertex> it = new ExecutionGraphIterator(this, true); while (it.hasNext()) { final ExecutionState s = it.next().getExecutionState(); if (s != ExecutionState.CREATED && s != ExecutionState.SCHEDULED && s != ExecutionState.READY) { return false; } } return true; }
java
private boolean jobHasScheduledStatus() { final Iterator<ExecutionVertex> it = new ExecutionGraphIterator(this, true); while (it.hasNext()) { final ExecutionState s = it.next().getExecutionState(); if (s != ExecutionState.CREATED && s != ExecutionState.SCHEDULED && s != ExecutionState.READY) { return false; } } return true; }
[ "private", "boolean", "jobHasScheduledStatus", "(", ")", "{", "final", "Iterator", "<", "ExecutionVertex", ">", "it", "=", "new", "ExecutionGraphIterator", "(", "this", ",", "true", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "final", "ExecutionState", "s", "=", "it", ".", "next", "(", ")", ".", "getExecutionState", "(", ")", ";", "if", "(", "s", "!=", "ExecutionState", ".", "CREATED", "&&", "s", "!=", "ExecutionState", ".", "SCHEDULED", "&&", "s", "!=", "ExecutionState", ".", "READY", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Checks whether the job represented by the execution graph has the status <code>SCHEDULED</code>. @return <code>true</code> if the job has the status <code>SCHEDULED</code>, <code>false</code> otherwise
[ "Checks", "whether", "the", "job", "represented", "by", "the", "execution", "graph", "has", "the", "status", "<code", ">", "SCHEDULED<", "/", "code", ">", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/executiongraph/ExecutionGraph.java#L1060-L1073
CodeNarc/CodeNarc
src/main/java/org/codenarc/util/AstUtil.java
AstUtil.isMethodCallOnObject
public static boolean isMethodCallOnObject(Expression expression, String methodObjectPattern) { """ Tells you if the expression is a method call on a particular object (which is represented as a String). For instance, you may ask isMethodCallOnObject(e, 'this') to find a this reference. @param expression - the expression @param methodObjectPattern - the name of the method object (receiver) such as 'this' @return as described """ if (expression instanceof MethodCallExpression) { Expression objectExpression = ((MethodCallExpression) expression).getObjectExpression(); if (objectExpression instanceof VariableExpression) { String name = ((VariableExpression) objectExpression).getName(); if (name != null && name.matches(methodObjectPattern)) { return true; } } if (objectExpression instanceof PropertyExpression && objectExpression.getText() != null && objectExpression.getText().matches(methodObjectPattern)) { return true; } if (objectExpression instanceof MethodCallExpression && isMethodNamed((MethodCallExpression) objectExpression, methodObjectPattern)) { return true; } } return false; }
java
public static boolean isMethodCallOnObject(Expression expression, String methodObjectPattern) { if (expression instanceof MethodCallExpression) { Expression objectExpression = ((MethodCallExpression) expression).getObjectExpression(); if (objectExpression instanceof VariableExpression) { String name = ((VariableExpression) objectExpression).getName(); if (name != null && name.matches(methodObjectPattern)) { return true; } } if (objectExpression instanceof PropertyExpression && objectExpression.getText() != null && objectExpression.getText().matches(methodObjectPattern)) { return true; } if (objectExpression instanceof MethodCallExpression && isMethodNamed((MethodCallExpression) objectExpression, methodObjectPattern)) { return true; } } return false; }
[ "public", "static", "boolean", "isMethodCallOnObject", "(", "Expression", "expression", ",", "String", "methodObjectPattern", ")", "{", "if", "(", "expression", "instanceof", "MethodCallExpression", ")", "{", "Expression", "objectExpression", "=", "(", "(", "MethodCallExpression", ")", "expression", ")", ".", "getObjectExpression", "(", ")", ";", "if", "(", "objectExpression", "instanceof", "VariableExpression", ")", "{", "String", "name", "=", "(", "(", "VariableExpression", ")", "objectExpression", ")", ".", "getName", "(", ")", ";", "if", "(", "name", "!=", "null", "&&", "name", ".", "matches", "(", "methodObjectPattern", ")", ")", "{", "return", "true", ";", "}", "}", "if", "(", "objectExpression", "instanceof", "PropertyExpression", "&&", "objectExpression", ".", "getText", "(", ")", "!=", "null", "&&", "objectExpression", ".", "getText", "(", ")", ".", "matches", "(", "methodObjectPattern", ")", ")", "{", "return", "true", ";", "}", "if", "(", "objectExpression", "instanceof", "MethodCallExpression", "&&", "isMethodNamed", "(", "(", "MethodCallExpression", ")", "objectExpression", ",", "methodObjectPattern", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Tells you if the expression is a method call on a particular object (which is represented as a String). For instance, you may ask isMethodCallOnObject(e, 'this') to find a this reference. @param expression - the expression @param methodObjectPattern - the name of the method object (receiver) such as 'this' @return as described
[ "Tells", "you", "if", "the", "expression", "is", "a", "method", "call", "on", "a", "particular", "object", "(", "which", "is", "represented", "as", "a", "String", ")", ".", "For", "instance", "you", "may", "ask", "isMethodCallOnObject", "(", "e", "this", ")", "to", "find", "a", "this", "reference", "." ]
train
https://github.com/CodeNarc/CodeNarc/blob/9a7cec02cb8cbaf845030f2434309e8968f5d7a7/src/main/java/org/codenarc/util/AstUtil.java#L264-L281
dustin/java-memcached-client
src/main/java/net/spy/memcached/MemcachedClient.java
MemcachedClient.getBulk
@Override public <T> Map<String, T> getBulk(Iterator<String> keyIter, Transcoder<T> tc) { """ Get the values for multiple keys from the cache. @param <T> @param keyIter Iterator that produces the keys @param tc the transcoder to serialize and unserialize value @return a map of the values (for each value that exists) @throws OperationTimeoutException if the global operation timeout is exceeded @throws CancellationException if operation was canceled @throws IllegalStateException in the rare circumstance where queue is too full to accept any more requests """ try { return asyncGetBulk(keyIter, tc).get(operationTimeout, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { throw new RuntimeException("Interrupted getting bulk values", e); } catch (ExecutionException e) { if(e.getCause() instanceof CancellationException) { throw (CancellationException) e.getCause(); } else { throw new RuntimeException("Exception waiting for bulk values", e); } } catch (TimeoutException e) { throw new OperationTimeoutException("Timeout waiting for bulk values: " + buildTimeoutMessage(operationTimeout, TimeUnit.MILLISECONDS), e); } }
java
@Override public <T> Map<String, T> getBulk(Iterator<String> keyIter, Transcoder<T> tc) { try { return asyncGetBulk(keyIter, tc).get(operationTimeout, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { throw new RuntimeException("Interrupted getting bulk values", e); } catch (ExecutionException e) { if(e.getCause() instanceof CancellationException) { throw (CancellationException) e.getCause(); } else { throw new RuntimeException("Exception waiting for bulk values", e); } } catch (TimeoutException e) { throw new OperationTimeoutException("Timeout waiting for bulk values: " + buildTimeoutMessage(operationTimeout, TimeUnit.MILLISECONDS), e); } }
[ "@", "Override", "public", "<", "T", ">", "Map", "<", "String", ",", "T", ">", "getBulk", "(", "Iterator", "<", "String", ">", "keyIter", ",", "Transcoder", "<", "T", ">", "tc", ")", "{", "try", "{", "return", "asyncGetBulk", "(", "keyIter", ",", "tc", ")", ".", "get", "(", "operationTimeout", ",", "TimeUnit", ".", "MILLISECONDS", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Interrupted getting bulk values\"", ",", "e", ")", ";", "}", "catch", "(", "ExecutionException", "e", ")", "{", "if", "(", "e", ".", "getCause", "(", ")", "instanceof", "CancellationException", ")", "{", "throw", "(", "CancellationException", ")", "e", ".", "getCause", "(", ")", ";", "}", "else", "{", "throw", "new", "RuntimeException", "(", "\"Exception waiting for bulk values\"", ",", "e", ")", ";", "}", "}", "catch", "(", "TimeoutException", "e", ")", "{", "throw", "new", "OperationTimeoutException", "(", "\"Timeout waiting for bulk values: \"", "+", "buildTimeoutMessage", "(", "operationTimeout", ",", "TimeUnit", ".", "MILLISECONDS", ")", ",", "e", ")", ";", "}", "}" ]
Get the values for multiple keys from the cache. @param <T> @param keyIter Iterator that produces the keys @param tc the transcoder to serialize and unserialize value @return a map of the values (for each value that exists) @throws OperationTimeoutException if the global operation timeout is exceeded @throws CancellationException if operation was canceled @throws IllegalStateException in the rare circumstance where queue is too full to accept any more requests
[ "Get", "the", "values", "for", "multiple", "keys", "from", "the", "cache", "." ]
train
https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/MemcachedClient.java#L1551-L1569
dropwizard/dropwizard
dropwizard-hibernate/src/main/java/io/dropwizard/hibernate/ScanningHibernateBundle.java
ScanningHibernateBundle.findEntityClassesFromDirectory
public static List<Class<?>> findEntityClassesFromDirectory(String[] pckgs) { """ Method scanning given directory for classes containing Hibernate @Entity annotation @param pckgs string array with packages containing Hibernate entities (classes annotated with @Entity annotation) e.g. com.codahale.fake.db.directory.entities @return ImmutableList with classes from given directory annotated with Hibernate @Entity annotation """ @SuppressWarnings("unchecked") final AnnotationAcceptingListener asl = new AnnotationAcceptingListener(Entity.class); try (final PackageNamesScanner scanner = new PackageNamesScanner(pckgs, true)) { while (scanner.hasNext()) { final String next = scanner.next(); if (asl.accept(next)) { try (final InputStream in = scanner.open()) { asl.process(next, in); } catch (IOException e) { throw new RuntimeException("AnnotationAcceptingListener failed to process scanned resource: " + next); } } } } return new ArrayList<>(asl.getAnnotatedClasses()); }
java
public static List<Class<?>> findEntityClassesFromDirectory(String[] pckgs) { @SuppressWarnings("unchecked") final AnnotationAcceptingListener asl = new AnnotationAcceptingListener(Entity.class); try (final PackageNamesScanner scanner = new PackageNamesScanner(pckgs, true)) { while (scanner.hasNext()) { final String next = scanner.next(); if (asl.accept(next)) { try (final InputStream in = scanner.open()) { asl.process(next, in); } catch (IOException e) { throw new RuntimeException("AnnotationAcceptingListener failed to process scanned resource: " + next); } } } } return new ArrayList<>(asl.getAnnotatedClasses()); }
[ "public", "static", "List", "<", "Class", "<", "?", ">", ">", "findEntityClassesFromDirectory", "(", "String", "[", "]", "pckgs", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "final", "AnnotationAcceptingListener", "asl", "=", "new", "AnnotationAcceptingListener", "(", "Entity", ".", "class", ")", ";", "try", "(", "final", "PackageNamesScanner", "scanner", "=", "new", "PackageNamesScanner", "(", "pckgs", ",", "true", ")", ")", "{", "while", "(", "scanner", ".", "hasNext", "(", ")", ")", "{", "final", "String", "next", "=", "scanner", ".", "next", "(", ")", ";", "if", "(", "asl", ".", "accept", "(", "next", ")", ")", "{", "try", "(", "final", "InputStream", "in", "=", "scanner", ".", "open", "(", ")", ")", "{", "asl", ".", "process", "(", "next", ",", "in", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"AnnotationAcceptingListener failed to process scanned resource: \"", "+", "next", ")", ";", "}", "}", "}", "}", "return", "new", "ArrayList", "<>", "(", "asl", ".", "getAnnotatedClasses", "(", ")", ")", ";", "}" ]
Method scanning given directory for classes containing Hibernate @Entity annotation @param pckgs string array with packages containing Hibernate entities (classes annotated with @Entity annotation) e.g. com.codahale.fake.db.directory.entities @return ImmutableList with classes from given directory annotated with Hibernate @Entity annotation
[ "Method", "scanning", "given", "directory", "for", "classes", "containing", "Hibernate", "@Entity", "annotation" ]
train
https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-hibernate/src/main/java/io/dropwizard/hibernate/ScanningHibernateBundle.java#L40-L57
infinispan/infinispan
hibernate/cache-commons/src/main/java/org/infinispan/hibernate/cache/commons/access/PutFromLoadValidator.java
PutFromLoadValidator.addToCache
public static void addToCache(AdvancedCache cache, PutFromLoadValidator validator) { """ Besides the call from constructor, this should be called only from tests when mocking the validator. """ AsyncInterceptorChain chain = cache.getAsyncInterceptorChain(); List<AsyncInterceptor> interceptors = chain.getInterceptors(); log.debugf("Interceptor chain was: ", interceptors); int position = 0; // add interceptor before uses exact match, not instanceof match int entryWrappingPosition = 0; for (AsyncInterceptor ci : interceptors) { if (ci instanceof EntryWrappingInterceptor) { entryWrappingPosition = position; } position++; } boolean transactional = cache.getCacheConfiguration().transaction().transactionMode().isTransactional(); BasicComponentRegistry componentRegistry = cache.getComponentRegistry().getComponent(BasicComponentRegistry.class); if (transactional) { TxInvalidationInterceptor txInvalidationInterceptor = new TxInvalidationInterceptor(); // We have to use replaceComponent because tests call addToCache more than once componentRegistry.replaceComponent(TxInvalidationInterceptor.class.getName(), txInvalidationInterceptor, true); componentRegistry.getComponent(TxInvalidationInterceptor.class).running(); chain.replaceInterceptor(txInvalidationInterceptor, InvalidationInterceptor.class); // Note that invalidation does *NOT* acquire locks; therefore, we have to start invalidating before // wrapping the entry, since if putFromLoad was invoked between wrap and beginInvalidatingKey, the invalidation // would not commit the entry removal (as during wrap the entry was not in cache) TxPutFromLoadInterceptor txPutFromLoadInterceptor = new TxPutFromLoadInterceptor(validator, ByteString.fromString(cache.getName())); componentRegistry.replaceComponent(TxPutFromLoadInterceptor.class.getName(), txPutFromLoadInterceptor, true); componentRegistry.getComponent(TxPutFromLoadInterceptor.class).running(); chain.addInterceptor(txPutFromLoadInterceptor, entryWrappingPosition); } else { NonTxPutFromLoadInterceptor nonTxPutFromLoadInterceptor = new NonTxPutFromLoadInterceptor(validator, ByteString.fromString(cache.getName())); componentRegistry.replaceComponent(NonTxPutFromLoadInterceptor.class.getName(), nonTxPutFromLoadInterceptor, true); componentRegistry.getComponent(NonTxPutFromLoadInterceptor.class).running(); chain.addInterceptor(nonTxPutFromLoadInterceptor, entryWrappingPosition); NonTxInvalidationInterceptor nonTxInvalidationInterceptor = new NonTxInvalidationInterceptor(); componentRegistry.replaceComponent(NonTxInvalidationInterceptor.class.getName(), nonTxInvalidationInterceptor, true); componentRegistry.getComponent(NonTxInvalidationInterceptor.class).running(); chain.replaceInterceptor(nonTxInvalidationInterceptor, InvalidationInterceptor.class); LockingInterceptor lockingInterceptor = new LockingInterceptor(); componentRegistry.replaceComponent(LockingInterceptor.class.getName(), lockingInterceptor, true); componentRegistry.getComponent(LockingInterceptor.class).running(); chain.replaceInterceptor(lockingInterceptor, NonTransactionalLockingInterceptor.class); } log.debugf("New interceptor chain is: ", cache.getAsyncInterceptorChain()); CacheCommandInitializer cacheCommandInitializer = componentRegistry.getComponent(CacheCommandInitializer.class).running(); cacheCommandInitializer.addPutFromLoadValidator(cache.getName(), validator); }
java
public static void addToCache(AdvancedCache cache, PutFromLoadValidator validator) { AsyncInterceptorChain chain = cache.getAsyncInterceptorChain(); List<AsyncInterceptor> interceptors = chain.getInterceptors(); log.debugf("Interceptor chain was: ", interceptors); int position = 0; // add interceptor before uses exact match, not instanceof match int entryWrappingPosition = 0; for (AsyncInterceptor ci : interceptors) { if (ci instanceof EntryWrappingInterceptor) { entryWrappingPosition = position; } position++; } boolean transactional = cache.getCacheConfiguration().transaction().transactionMode().isTransactional(); BasicComponentRegistry componentRegistry = cache.getComponentRegistry().getComponent(BasicComponentRegistry.class); if (transactional) { TxInvalidationInterceptor txInvalidationInterceptor = new TxInvalidationInterceptor(); // We have to use replaceComponent because tests call addToCache more than once componentRegistry.replaceComponent(TxInvalidationInterceptor.class.getName(), txInvalidationInterceptor, true); componentRegistry.getComponent(TxInvalidationInterceptor.class).running(); chain.replaceInterceptor(txInvalidationInterceptor, InvalidationInterceptor.class); // Note that invalidation does *NOT* acquire locks; therefore, we have to start invalidating before // wrapping the entry, since if putFromLoad was invoked between wrap and beginInvalidatingKey, the invalidation // would not commit the entry removal (as during wrap the entry was not in cache) TxPutFromLoadInterceptor txPutFromLoadInterceptor = new TxPutFromLoadInterceptor(validator, ByteString.fromString(cache.getName())); componentRegistry.replaceComponent(TxPutFromLoadInterceptor.class.getName(), txPutFromLoadInterceptor, true); componentRegistry.getComponent(TxPutFromLoadInterceptor.class).running(); chain.addInterceptor(txPutFromLoadInterceptor, entryWrappingPosition); } else { NonTxPutFromLoadInterceptor nonTxPutFromLoadInterceptor = new NonTxPutFromLoadInterceptor(validator, ByteString.fromString(cache.getName())); componentRegistry.replaceComponent(NonTxPutFromLoadInterceptor.class.getName(), nonTxPutFromLoadInterceptor, true); componentRegistry.getComponent(NonTxPutFromLoadInterceptor.class).running(); chain.addInterceptor(nonTxPutFromLoadInterceptor, entryWrappingPosition); NonTxInvalidationInterceptor nonTxInvalidationInterceptor = new NonTxInvalidationInterceptor(); componentRegistry.replaceComponent(NonTxInvalidationInterceptor.class.getName(), nonTxInvalidationInterceptor, true); componentRegistry.getComponent(NonTxInvalidationInterceptor.class).running(); chain.replaceInterceptor(nonTxInvalidationInterceptor, InvalidationInterceptor.class); LockingInterceptor lockingInterceptor = new LockingInterceptor(); componentRegistry.replaceComponent(LockingInterceptor.class.getName(), lockingInterceptor, true); componentRegistry.getComponent(LockingInterceptor.class).running(); chain.replaceInterceptor(lockingInterceptor, NonTransactionalLockingInterceptor.class); } log.debugf("New interceptor chain is: ", cache.getAsyncInterceptorChain()); CacheCommandInitializer cacheCommandInitializer = componentRegistry.getComponent(CacheCommandInitializer.class).running(); cacheCommandInitializer.addPutFromLoadValidator(cache.getName(), validator); }
[ "public", "static", "void", "addToCache", "(", "AdvancedCache", "cache", ",", "PutFromLoadValidator", "validator", ")", "{", "AsyncInterceptorChain", "chain", "=", "cache", ".", "getAsyncInterceptorChain", "(", ")", ";", "List", "<", "AsyncInterceptor", ">", "interceptors", "=", "chain", ".", "getInterceptors", "(", ")", ";", "log", ".", "debugf", "(", "\"Interceptor chain was: \"", ",", "interceptors", ")", ";", "int", "position", "=", "0", ";", "// add interceptor before uses exact match, not instanceof match", "int", "entryWrappingPosition", "=", "0", ";", "for", "(", "AsyncInterceptor", "ci", ":", "interceptors", ")", "{", "if", "(", "ci", "instanceof", "EntryWrappingInterceptor", ")", "{", "entryWrappingPosition", "=", "position", ";", "}", "position", "++", ";", "}", "boolean", "transactional", "=", "cache", ".", "getCacheConfiguration", "(", ")", ".", "transaction", "(", ")", ".", "transactionMode", "(", ")", ".", "isTransactional", "(", ")", ";", "BasicComponentRegistry", "componentRegistry", "=", "cache", ".", "getComponentRegistry", "(", ")", ".", "getComponent", "(", "BasicComponentRegistry", ".", "class", ")", ";", "if", "(", "transactional", ")", "{", "TxInvalidationInterceptor", "txInvalidationInterceptor", "=", "new", "TxInvalidationInterceptor", "(", ")", ";", "// We have to use replaceComponent because tests call addToCache more than once", "componentRegistry", ".", "replaceComponent", "(", "TxInvalidationInterceptor", ".", "class", ".", "getName", "(", ")", ",", "txInvalidationInterceptor", ",", "true", ")", ";", "componentRegistry", ".", "getComponent", "(", "TxInvalidationInterceptor", ".", "class", ")", ".", "running", "(", ")", ";", "chain", ".", "replaceInterceptor", "(", "txInvalidationInterceptor", ",", "InvalidationInterceptor", ".", "class", ")", ";", "// Note that invalidation does *NOT* acquire locks; therefore, we have to start invalidating before", "// wrapping the entry, since if putFromLoad was invoked between wrap and beginInvalidatingKey, the invalidation", "// would not commit the entry removal (as during wrap the entry was not in cache)", "TxPutFromLoadInterceptor", "txPutFromLoadInterceptor", "=", "new", "TxPutFromLoadInterceptor", "(", "validator", ",", "ByteString", ".", "fromString", "(", "cache", ".", "getName", "(", ")", ")", ")", ";", "componentRegistry", ".", "replaceComponent", "(", "TxPutFromLoadInterceptor", ".", "class", ".", "getName", "(", ")", ",", "txPutFromLoadInterceptor", ",", "true", ")", ";", "componentRegistry", ".", "getComponent", "(", "TxPutFromLoadInterceptor", ".", "class", ")", ".", "running", "(", ")", ";", "chain", ".", "addInterceptor", "(", "txPutFromLoadInterceptor", ",", "entryWrappingPosition", ")", ";", "}", "else", "{", "NonTxPutFromLoadInterceptor", "nonTxPutFromLoadInterceptor", "=", "new", "NonTxPutFromLoadInterceptor", "(", "validator", ",", "ByteString", ".", "fromString", "(", "cache", ".", "getName", "(", ")", ")", ")", ";", "componentRegistry", ".", "replaceComponent", "(", "NonTxPutFromLoadInterceptor", ".", "class", ".", "getName", "(", ")", ",", "nonTxPutFromLoadInterceptor", ",", "true", ")", ";", "componentRegistry", ".", "getComponent", "(", "NonTxPutFromLoadInterceptor", ".", "class", ")", ".", "running", "(", ")", ";", "chain", ".", "addInterceptor", "(", "nonTxPutFromLoadInterceptor", ",", "entryWrappingPosition", ")", ";", "NonTxInvalidationInterceptor", "nonTxInvalidationInterceptor", "=", "new", "NonTxInvalidationInterceptor", "(", ")", ";", "componentRegistry", ".", "replaceComponent", "(", "NonTxInvalidationInterceptor", ".", "class", ".", "getName", "(", ")", ",", "nonTxInvalidationInterceptor", ",", "true", ")", ";", "componentRegistry", ".", "getComponent", "(", "NonTxInvalidationInterceptor", ".", "class", ")", ".", "running", "(", ")", ";", "chain", ".", "replaceInterceptor", "(", "nonTxInvalidationInterceptor", ",", "InvalidationInterceptor", ".", "class", ")", ";", "LockingInterceptor", "lockingInterceptor", "=", "new", "LockingInterceptor", "(", ")", ";", "componentRegistry", ".", "replaceComponent", "(", "LockingInterceptor", ".", "class", ".", "getName", "(", ")", ",", "lockingInterceptor", ",", "true", ")", ";", "componentRegistry", ".", "getComponent", "(", "LockingInterceptor", ".", "class", ")", ".", "running", "(", ")", ";", "chain", ".", "replaceInterceptor", "(", "lockingInterceptor", ",", "NonTransactionalLockingInterceptor", ".", "class", ")", ";", "}", "log", ".", "debugf", "(", "\"New interceptor chain is: \"", ",", "cache", ".", "getAsyncInterceptorChain", "(", ")", ")", ";", "CacheCommandInitializer", "cacheCommandInitializer", "=", "componentRegistry", ".", "getComponent", "(", "CacheCommandInitializer", ".", "class", ")", ".", "running", "(", ")", ";", "cacheCommandInitializer", ".", "addPutFromLoadValidator", "(", "cache", ".", "getName", "(", ")", ",", "validator", ")", ";", "}" ]
Besides the call from constructor, this should be called only from tests when mocking the validator.
[ "Besides", "the", "call", "from", "constructor", "this", "should", "be", "called", "only", "from", "tests", "when", "mocking", "the", "validator", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/hibernate/cache-commons/src/main/java/org/infinispan/hibernate/cache/commons/access/PutFromLoadValidator.java#L183-L235
dmfs/xmlobjects
src/org/dmfs/xmlobjects/QualifiedName.java
QualifiedName.get
public static QualifiedName get(String namespace, String name) { """ Returns a {@link QualifiedName} with a specific name space. If the {@link QualifiedName} already exists, the existing instance is returned, otherwise it's created. @param namespace The namespace of the {@link QualifiedName}. @param name The name of the {@link QualifiedName}. @return The {@link QualifiedName} instance. """ if (namespace != null && namespace.length() == 0) { namespace = null; } synchronized (QUALIFIED_NAME_CACHE) { Map<String, QualifiedName> qualifiedNameMap = QUALIFIED_NAME_CACHE.get(namespace); QualifiedName qualifiedName; if (qualifiedNameMap == null) { qualifiedNameMap = new HashMap<String, QualifiedName>(); qualifiedName = new QualifiedName(namespace, name); qualifiedNameMap.put(name, qualifiedName); QUALIFIED_NAME_CACHE.put(namespace, qualifiedNameMap); } else { qualifiedName = qualifiedNameMap.get(name); if (qualifiedName == null) { qualifiedName = new QualifiedName(namespace, name); qualifiedNameMap.put(name, qualifiedName); } } return qualifiedName; } }
java
public static QualifiedName get(String namespace, String name) { if (namespace != null && namespace.length() == 0) { namespace = null; } synchronized (QUALIFIED_NAME_CACHE) { Map<String, QualifiedName> qualifiedNameMap = QUALIFIED_NAME_CACHE.get(namespace); QualifiedName qualifiedName; if (qualifiedNameMap == null) { qualifiedNameMap = new HashMap<String, QualifiedName>(); qualifiedName = new QualifiedName(namespace, name); qualifiedNameMap.put(name, qualifiedName); QUALIFIED_NAME_CACHE.put(namespace, qualifiedNameMap); } else { qualifiedName = qualifiedNameMap.get(name); if (qualifiedName == null) { qualifiedName = new QualifiedName(namespace, name); qualifiedNameMap.put(name, qualifiedName); } } return qualifiedName; } }
[ "public", "static", "QualifiedName", "get", "(", "String", "namespace", ",", "String", "name", ")", "{", "if", "(", "namespace", "!=", "null", "&&", "namespace", ".", "length", "(", ")", "==", "0", ")", "{", "namespace", "=", "null", ";", "}", "synchronized", "(", "QUALIFIED_NAME_CACHE", ")", "{", "Map", "<", "String", ",", "QualifiedName", ">", "qualifiedNameMap", "=", "QUALIFIED_NAME_CACHE", ".", "get", "(", "namespace", ")", ";", "QualifiedName", "qualifiedName", ";", "if", "(", "qualifiedNameMap", "==", "null", ")", "{", "qualifiedNameMap", "=", "new", "HashMap", "<", "String", ",", "QualifiedName", ">", "(", ")", ";", "qualifiedName", "=", "new", "QualifiedName", "(", "namespace", ",", "name", ")", ";", "qualifiedNameMap", ".", "put", "(", "name", ",", "qualifiedName", ")", ";", "QUALIFIED_NAME_CACHE", ".", "put", "(", "namespace", ",", "qualifiedNameMap", ")", ";", "}", "else", "{", "qualifiedName", "=", "qualifiedNameMap", ".", "get", "(", "name", ")", ";", "if", "(", "qualifiedName", "==", "null", ")", "{", "qualifiedName", "=", "new", "QualifiedName", "(", "namespace", ",", "name", ")", ";", "qualifiedNameMap", ".", "put", "(", "name", ",", "qualifiedName", ")", ";", "}", "}", "return", "qualifiedName", ";", "}", "}" ]
Returns a {@link QualifiedName} with a specific name space. If the {@link QualifiedName} already exists, the existing instance is returned, otherwise it's created. @param namespace The namespace of the {@link QualifiedName}. @param name The name of the {@link QualifiedName}. @return The {@link QualifiedName} instance.
[ "Returns", "a", "{", "@link", "QualifiedName", "}", "with", "a", "specific", "name", "space", ".", "If", "the", "{", "@link", "QualifiedName", "}", "already", "exists", "the", "existing", "instance", "is", "returned", "otherwise", "it", "s", "created", "." ]
train
https://github.com/dmfs/xmlobjects/blob/b68ddd0ce994d804fc2ec6da1096bf0d883b37f9/src/org/dmfs/xmlobjects/QualifiedName.java#L78-L107