repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/pipeline/common/Utils.java
Utils.appendBuildInfo
public static BuildInfo appendBuildInfo(CpsScript cpsScript, Map<String, Object> stepVariables) { BuildInfo buildInfo = (BuildInfo) stepVariables.get(BUILD_INFO); if (buildInfo == null) { buildInfo = (BuildInfo) cpsScript.invokeMethod("newBuildInfo", Maps.newLinkedHashMap()); stepVariables.put(BUILD_INFO, buildInfo); } buildInfo.setCpsScript(cpsScript); return buildInfo; }
java
public static BuildInfo appendBuildInfo(CpsScript cpsScript, Map<String, Object> stepVariables) { BuildInfo buildInfo = (BuildInfo) stepVariables.get(BUILD_INFO); if (buildInfo == null) { buildInfo = (BuildInfo) cpsScript.invokeMethod("newBuildInfo", Maps.newLinkedHashMap()); stepVariables.put(BUILD_INFO, buildInfo); } buildInfo.setCpsScript(cpsScript); return buildInfo; }
[ "public", "static", "BuildInfo", "appendBuildInfo", "(", "CpsScript", "cpsScript", ",", "Map", "<", "String", ",", "Object", ">", "stepVariables", ")", "{", "BuildInfo", "buildInfo", "=", "(", "BuildInfo", ")", "stepVariables", ".", "get", "(", "BUILD_INFO", "...
Add the buildInfo to step variables if missing and set its cps script. @param cpsScript the cps script @param stepVariables step variables map @return the build info
[ "Add", "the", "buildInfo", "to", "step", "variables", "if", "missing", "and", "set", "its", "cps", "script", "." ]
train
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/Utils.java#L346-L354
Baidu-AIP/java-sdk
src/main/java/com/baidu/aip/imagesearch/AipImageSearch.java
AipImageSearch.similarUpdate
public JSONObject similarUpdate(byte[] image, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); String base64Content = Base64Util.encode(image); request.addBody("image", base64Content); if (options != null) { request.addBody(options); } request.setUri(ImageSearchConsts.SIMILAR_UPDATE); postOperation(request); return requestServer(request); }
java
public JSONObject similarUpdate(byte[] image, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); String base64Content = Base64Util.encode(image); request.addBody("image", base64Content); if (options != null) { request.addBody(options); } request.setUri(ImageSearchConsts.SIMILAR_UPDATE); postOperation(request); return requestServer(request); }
[ "public", "JSONObject", "similarUpdate", "(", "byte", "[", "]", "image", ",", "HashMap", "<", "String", ",", "String", ">", "options", ")", "{", "AipRequest", "request", "=", "new", "AipRequest", "(", ")", ";", "preOperation", "(", "request", ")", ";", "...
相似图检索—更新接口 **更新图库中图片的摘要和分类信息(具体变量为brief、tags)** @param image - 二进制图像数据 @param options - 可选参数对象,key: value都为string类型 options - options列表: brief 更新的摘要信息,最长256B。样例:{"name":"周杰伦", "id":"666"} tags 1 - 65535范围内的整数,tag间以逗号分隔,最多2个tag。样例:"100,11" ;检索时可圈定分类维度进行检索 @return JSONObject
[ "相似图检索—更新接口", "**", "更新图库中图片的摘要和分类信息(具体变量为brief、tags)", "**" ]
train
https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/imagesearch/AipImageSearch.java#L515-L527
recommenders/rival
rival-core/src/main/java/net/recommenders/rival/core/DataModelUtils.java
DataModelUtils.saveDataModel
public static <U, I> void saveDataModel(final TemporalDataModelIF<U, I> dm, final String outfile, final boolean overwrite, String delimiter) throws FileNotFoundException, UnsupportedEncodingException { if (new File(outfile).exists() && !overwrite) { System.out.println("Ignoring " + outfile); } else { PrintStream out = new PrintStream(outfile, "UTF-8"); for (U user : dm.getUsers()) { for (I item : dm.getUserItems(user)) { Double pref = dm.getUserItemPreference(user, item); Iterable<Long> time = dm.getUserItemTimestamps(user, item); if (time == null) { out.println(user + delimiter + item + delimiter + pref + delimiter + "-1"); } else { for (Long t : time) { out.println(user + delimiter + item + delimiter + pref + delimiter + t); } } } } out.close(); } }
java
public static <U, I> void saveDataModel(final TemporalDataModelIF<U, I> dm, final String outfile, final boolean overwrite, String delimiter) throws FileNotFoundException, UnsupportedEncodingException { if (new File(outfile).exists() && !overwrite) { System.out.println("Ignoring " + outfile); } else { PrintStream out = new PrintStream(outfile, "UTF-8"); for (U user : dm.getUsers()) { for (I item : dm.getUserItems(user)) { Double pref = dm.getUserItemPreference(user, item); Iterable<Long> time = dm.getUserItemTimestamps(user, item); if (time == null) { out.println(user + delimiter + item + delimiter + pref + delimiter + "-1"); } else { for (Long t : time) { out.println(user + delimiter + item + delimiter + pref + delimiter + t); } } } } out.close(); } }
[ "public", "static", "<", "U", ",", "I", ">", "void", "saveDataModel", "(", "final", "TemporalDataModelIF", "<", "U", ",", "I", ">", "dm", ",", "final", "String", "outfile", ",", "final", "boolean", "overwrite", ",", "String", "delimiter", ")", "throws", ...
Method that saves a temporal data model to a file. @param dm the data model @param outfile file where the model will be saved @param overwrite flag that indicates if the file should be overwritten @param delimiter field delimiter @param <U> type of users @param <I> type of items @throws FileNotFoundException when outfile cannot be used. @throws UnsupportedEncodingException when the requested encoding (UTF-8) is not available.
[ "Method", "that", "saves", "a", "temporal", "data", "model", "to", "a", "file", "." ]
train
https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-core/src/main/java/net/recommenders/rival/core/DataModelUtils.java#L78-L99
io7m/jcanephora
com.io7m.jcanephora.core/src/main/java/com/io7m/jcanephora/core/JCGLProjectionMatrices.java
JCGLProjectionMatrices.perspectiveProjectionRHP
public static <A, B> PMatrix4x4D<A, B> perspectiveProjectionRHP( final double z_near, final double z_far, final double aspect, final double horizontal_fov) { final double x_max = z_near * StrictMath.tan(horizontal_fov / 2.0); final double x_min = -x_max; final double y_max = x_max / aspect; final double y_min = -y_max; return frustumProjectionRHP(x_min, x_max, y_min, y_max, z_near, z_far); }
java
public static <A, B> PMatrix4x4D<A, B> perspectiveProjectionRHP( final double z_near, final double z_far, final double aspect, final double horizontal_fov) { final double x_max = z_near * StrictMath.tan(horizontal_fov / 2.0); final double x_min = -x_max; final double y_max = x_max / aspect; final double y_min = -y_max; return frustumProjectionRHP(x_min, x_max, y_min, y_max, z_near, z_far); }
[ "public", "static", "<", "A", ",", "B", ">", "PMatrix4x4D", "<", "A", ",", "B", ">", "perspectiveProjectionRHP", "(", "final", "double", "z_near", ",", "final", "double", "z_far", ",", "final", "double", "aspect", ",", "final", "double", "horizontal_fov", ...
<p>Calculate a matrix that will produce a perspective projection based on the given view frustum parameters, the aspect ratio of the viewport and a given horizontal field of view in radians. Note that {@code fov_radians} represents the full horizontal field of view: the angle at the base of the triangle formed by the frustum on the {@code x/z} plane.</p> <p>Note that iff {@code z_far &gt;= Double.POSITIVE_INFINITY}, the function produces an "infinite projection matrix", suitable for use in code that deals with shadow volumes.</p> <p>The function assumes a right-handed coordinate system.</p> <p>See <a href="http://http.developer.nvidia.com/GPUGems/gpugems_ch09.html">GPU Gems</a></p> @param z_near The near clipping plane coordinate @param z_far The far clipping plane coordinate @param aspect The aspect ratio of the viewport; the width divided by the height. For example, an aspect ratio of 2.0 indicates a viewport twice as wide as it is high @param horizontal_fov The horizontal field of view in radians @param <A> A phantom type parameter, possibly representing a source coordinate system @param <B> A phantom type parameter, possibly representing a target coordinate system @return A perspective projection matrix
[ "<p", ">", "Calculate", "a", "matrix", "that", "will", "produce", "a", "perspective", "projection", "based", "on", "the", "given", "view", "frustum", "parameters", "the", "aspect", "ratio", "of", "the", "viewport", "and", "a", "given", "horizontal", "field", ...
train
https://github.com/io7m/jcanephora/blob/0004c1744b7f0969841d04cd4fa693f402b10980/com.io7m.jcanephora.core/src/main/java/com/io7m/jcanephora/core/JCGLProjectionMatrices.java#L334-L345
Harium/keel
src/main/java/com/harium/keel/catalano/math/distance/Distance.java
Distance.Canberra
public static double Canberra(double x1, double y1, double x2, double y2) { double distance; distance = Math.abs(x1 - x2) / (Math.abs(x1) + Math.abs(x2)); distance += Math.abs(y1 - y2) / (Math.abs(y1) + Math.abs(y2)); return distance; }
java
public static double Canberra(double x1, double y1, double x2, double y2) { double distance; distance = Math.abs(x1 - x2) / (Math.abs(x1) + Math.abs(x2)); distance += Math.abs(y1 - y2) / (Math.abs(y1) + Math.abs(y2)); return distance; }
[ "public", "static", "double", "Canberra", "(", "double", "x1", ",", "double", "y1", ",", "double", "x2", ",", "double", "y2", ")", "{", "double", "distance", ";", "distance", "=", "Math", ".", "abs", "(", "x1", "-", "x2", ")", "/", "(", "Math", "."...
Gets the Canberra distance between two points. @param x1 X1 axis coordinate. @param y1 Y1 axis coordinate. @param x2 X2 axis coordinate. @param y2 Y2 axis coordinate. @return The Canberra distance between x and y.
[ "Gets", "the", "Canberra", "distance", "between", "two", "points", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/distance/Distance.java#L151-L158
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java
BugInstance.addCalledMethod
@Nonnull public BugInstance addCalledMethod(ConstantPoolGen cpg, InvokeInstruction inv) { String className = inv.getClassName(cpg); String methodName = inv.getMethodName(cpg); String methodSig = inv.getSignature(cpg); addMethod(className, methodName, methodSig, inv.getOpcode() == Const.INVOKESTATIC); describe(MethodAnnotation.METHOD_CALLED); return this; }
java
@Nonnull public BugInstance addCalledMethod(ConstantPoolGen cpg, InvokeInstruction inv) { String className = inv.getClassName(cpg); String methodName = inv.getMethodName(cpg); String methodSig = inv.getSignature(cpg); addMethod(className, methodName, methodSig, inv.getOpcode() == Const.INVOKESTATIC); describe(MethodAnnotation.METHOD_CALLED); return this; }
[ "@", "Nonnull", "public", "BugInstance", "addCalledMethod", "(", "ConstantPoolGen", "cpg", ",", "InvokeInstruction", "inv", ")", "{", "String", "className", "=", "inv", ".", "getClassName", "(", "cpg", ")", ";", "String", "methodName", "=", "inv", ".", "getMet...
Add a method annotation for the method which is called by given instruction. @param cpg the constant pool for the method containing the call @param inv the InvokeInstruction @return this object
[ "Add", "a", "method", "annotation", "for", "the", "method", "which", "is", "called", "by", "given", "instruction", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java#L1452-L1460
petergeneric/stdlib
stdlib/src/main/java/com/peterphi/std/types/Timebase.java
Timebase.resample
public long resample(final long samples, final Timebase oldRate) { try { return resample(samples, oldRate, false); } catch (ResamplingException e) { // should never happen throw new RuntimeException(e); } }
java
public long resample(final long samples, final Timebase oldRate) { try { return resample(samples, oldRate, false); } catch (ResamplingException e) { // should never happen throw new RuntimeException(e); } }
[ "public", "long", "resample", "(", "final", "long", "samples", ",", "final", "Timebase", "oldRate", ")", "{", "try", "{", "return", "resample", "(", "samples", ",", "oldRate", ",", "false", ")", ";", "}", "catch", "(", "ResamplingException", "e", ")", "{...
Convert a sample count from one timebase to another<br /> Note that this may result in data loss due to rounding. @param samples @param oldRate @return
[ "Convert", "a", "sample", "count", "from", "one", "timebase", "to", "another<br", "/", ">", "Note", "that", "this", "may", "result", "in", "data", "loss", "due", "to", "rounding", "." ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/types/Timebase.java#L158-L169
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/dialog/ApplicationDialog.java
ApplicationDialog.addActionKeyBinding
protected void addActionKeyBinding(KeyStroke key, String actionKey, Action action) { getInputMap().put(key, actionKey); getActionMap().put(actionKey, action); }
java
protected void addActionKeyBinding(KeyStroke key, String actionKey, Action action) { getInputMap().put(key, actionKey); getActionMap().put(actionKey, action); }
[ "protected", "void", "addActionKeyBinding", "(", "KeyStroke", "key", ",", "String", "actionKey", ",", "Action", "action", ")", "{", "getInputMap", "(", ")", ".", "put", "(", "key", ",", "actionKey", ")", ";", "getActionMap", "(", ")", ".", "put", "(", "a...
Add an action key binding to this dialog. @param key the {@link KeyStroke} that triggers the command/action. @param actionKey id of the action. @param action {@link Action} that will be triggered by the {@link KeyStroke}. @see #getActionMap() @see #getInputMap() @see ActionMap#put(Object, Action) @see InputMap#put(KeyStroke, Object)
[ "Add", "an", "action", "key", "binding", "to", "this", "dialog", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/dialog/ApplicationDialog.java#L679-L682
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/ZealotKhala.java
ZealotKhala.orBetween
public ZealotKhala orBetween(String field, Object startValue, Object endValue) { return this.doBetween(ZealotConst.OR_PREFIX, field, startValue, endValue, true); }
java
public ZealotKhala orBetween(String field, Object startValue, Object endValue) { return this.doBetween(ZealotConst.OR_PREFIX, field, startValue, endValue, true); }
[ "public", "ZealotKhala", "orBetween", "(", "String", "field", ",", "Object", "startValue", ",", "Object", "endValue", ")", "{", "return", "this", ".", "doBetween", "(", "ZealotConst", ".", "OR_PREFIX", ",", "field", ",", "startValue", ",", "endValue", ",", "...
生成带" OR "前缀的between区间查询的SQL片段(当某一个值为null时,会是大于等于或小于等于的情形). @param field 数据库字段 @param startValue 开始值 @param endValue 结束值 @return ZealotKhala实例
[ "生成带", "OR", "前缀的between区间查询的SQL片段", "(", "当某一个值为null时,会是大于等于或小于等于的情形", ")", "." ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L1241-L1243
linkhub-sdk/popbill.sdk.java
src/main/java/com/popbill/api/statement/StatementServiceImp.java
StatementServiceImp.deleteFile
@Override public Response deleteFile(String CorpNum, int ItemCode, String MgtKey, String FileID, String UserID) throws PopbillException { if (MgtKey == null || MgtKey.isEmpty()) throw new PopbillException(-99999999, "관리번호가 입력되지 않았습니다."); if (FileID == null || FileID.isEmpty()) throw new PopbillException(-99999999, "파일아이디가 입력되지 않았습니다."); return httppost("/Statement/" + ItemCode + "/" + MgtKey + "/Files/" + FileID, CorpNum, null, UserID, "DELETE", Response.class); }
java
@Override public Response deleteFile(String CorpNum, int ItemCode, String MgtKey, String FileID, String UserID) throws PopbillException { if (MgtKey == null || MgtKey.isEmpty()) throw new PopbillException(-99999999, "관리번호가 입력되지 않았습니다."); if (FileID == null || FileID.isEmpty()) throw new PopbillException(-99999999, "파일아이디가 입력되지 않았습니다."); return httppost("/Statement/" + ItemCode + "/" + MgtKey + "/Files/" + FileID, CorpNum, null, UserID, "DELETE", Response.class); }
[ "@", "Override", "public", "Response", "deleteFile", "(", "String", "CorpNum", ",", "int", "ItemCode", ",", "String", "MgtKey", ",", "String", "FileID", ",", "String", "UserID", ")", "throws", "PopbillException", "{", "if", "(", "MgtKey", "==", "null", "||",...
/* (non-Javadoc) @see com.popbill.api.StatementService#deleteFile(java.lang.String, java.number.Integer, java.lang.String, java.lang.String, java.lang.String)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
train
https://github.com/linkhub-sdk/popbill.sdk.java/blob/63a341fefe96d60a368776638f3d4c81888238b7/src/main/java/com/popbill/api/statement/StatementServiceImp.java#L589-L600
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java
BNFHeadersImpl.overlayBytes
private int overlayBytes(byte[] data, int inOffset, int inLength, int inIndex) { int length = inLength; int offset = inOffset; int index = inIndex; WsByteBuffer buffer = this.parseBuffers[index]; if (-1 == length) { length = data.length; } while (index <= this.parseIndex) { int remaining = buffer.remaining(); if (remaining >= length) { // it all fits now buffer.put(data, offset, length); return index; } // put what we can, loop through the next buffer buffer.put(data, offset, remaining); offset += remaining; length -= remaining; buffer = this.parseBuffers[++index]; buffer.position(0); } return index; }
java
private int overlayBytes(byte[] data, int inOffset, int inLength, int inIndex) { int length = inLength; int offset = inOffset; int index = inIndex; WsByteBuffer buffer = this.parseBuffers[index]; if (-1 == length) { length = data.length; } while (index <= this.parseIndex) { int remaining = buffer.remaining(); if (remaining >= length) { // it all fits now buffer.put(data, offset, length); return index; } // put what we can, loop through the next buffer buffer.put(data, offset, remaining); offset += remaining; length -= remaining; buffer = this.parseBuffers[++index]; buffer.position(0); } return index; }
[ "private", "int", "overlayBytes", "(", "byte", "[", "]", "data", ",", "int", "inOffset", ",", "int", "inLength", ",", "int", "inIndex", ")", "{", "int", "length", "=", "inLength", ";", "int", "offset", "=", "inOffset", ";", "int", "index", "=", "inInde...
Utility method to overlay the input bytes into the parse buffers, starting at the input index and moving forward as needed. @param data @param inOffset @param inLength @param inIndex @return index of last buffer updated
[ "Utility", "method", "to", "overlay", "the", "input", "bytes", "into", "the", "parse", "buffers", "starting", "at", "the", "input", "index", "and", "moving", "forward", "as", "needed", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L1267-L1290
prestodb/presto
presto-accumulo/src/main/java/com/facebook/presto/accumulo/io/AccumuloRecordSet.java
AccumuloRecordSet.getScanAuthorizations
private static Authorizations getScanAuthorizations(ConnectorSession session, AccumuloSplit split, Connector connector, String username) throws AccumuloException, AccumuloSecurityException { String sessionScanUser = AccumuloSessionProperties.getScanUsername(session); if (sessionScanUser != null) { Authorizations scanAuths = connector.securityOperations().getUserAuthorizations(sessionScanUser); LOG.debug("Using session scanner auths for user %s: %s", sessionScanUser, scanAuths); return scanAuths; } Optional<String> scanAuths = split.getScanAuthorizations(); if (scanAuths.isPresent()) { Authorizations auths = new Authorizations(Iterables.toArray(COMMA_SPLITTER.split(scanAuths.get()), String.class)); LOG.debug("scan_auths table property set: %s", auths); return auths; } else { Authorizations auths = connector.securityOperations().getUserAuthorizations(username); LOG.debug("scan_auths table property not set, using user auths: %s", auths); return auths; } }
java
private static Authorizations getScanAuthorizations(ConnectorSession session, AccumuloSplit split, Connector connector, String username) throws AccumuloException, AccumuloSecurityException { String sessionScanUser = AccumuloSessionProperties.getScanUsername(session); if (sessionScanUser != null) { Authorizations scanAuths = connector.securityOperations().getUserAuthorizations(sessionScanUser); LOG.debug("Using session scanner auths for user %s: %s", sessionScanUser, scanAuths); return scanAuths; } Optional<String> scanAuths = split.getScanAuthorizations(); if (scanAuths.isPresent()) { Authorizations auths = new Authorizations(Iterables.toArray(COMMA_SPLITTER.split(scanAuths.get()), String.class)); LOG.debug("scan_auths table property set: %s", auths); return auths; } else { Authorizations auths = connector.securityOperations().getUserAuthorizations(username); LOG.debug("scan_auths table property not set, using user auths: %s", auths); return auths; } }
[ "private", "static", "Authorizations", "getScanAuthorizations", "(", "ConnectorSession", "session", ",", "AccumuloSplit", "split", ",", "Connector", "connector", ",", "String", "username", ")", "throws", "AccumuloException", ",", "AccumuloSecurityException", "{", "String"...
Gets the scanner authorizations to use for scanning tables. <p> In order of priority: session username authorizations, then table property, then the default connector auths. @param session Current session @param split Accumulo split @param connector Accumulo connector @param username Accumulo username @return Scan authorizations @throws AccumuloException If a generic Accumulo error occurs @throws AccumuloSecurityException If a security exception occurs
[ "Gets", "the", "scanner", "authorizations", "to", "use", "for", "scanning", "tables", ".", "<p", ">", "In", "order", "of", "priority", ":", "session", "username", "authorizations", "then", "table", "property", "then", "the", "default", "connector", "auths", "....
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-accumulo/src/main/java/com/facebook/presto/accumulo/io/AccumuloRecordSet.java#L116-L137
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringHelper.java
StringHelper.getExplodedArray
@Nonnull public static String [] getExplodedArray (final char cSep, @Nullable final String sElements) { return getExplodedArray (cSep, sElements, -1); }
java
@Nonnull public static String [] getExplodedArray (final char cSep, @Nullable final String sElements) { return getExplodedArray (cSep, sElements, -1); }
[ "@", "Nonnull", "public", "static", "String", "[", "]", "getExplodedArray", "(", "final", "char", "cSep", ",", "@", "Nullable", "final", "String", "sElements", ")", "{", "return", "getExplodedArray", "(", "cSep", ",", "sElements", ",", "-", "1", ")", ";", ...
Take a concatenated String and return the passed String array of all elements in the passed string, using specified separator char. @param cSep The separator to use. @param sElements The concatenated String to convert. May be <code>null</code> or empty. @return The passed collection and never <code>null</code>.
[ "Take", "a", "concatenated", "String", "and", "return", "the", "passed", "String", "array", "of", "all", "elements", "in", "the", "passed", "string", "using", "specified", "separator", "char", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L1963-L1967
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/utils/FileUtils.java
FileUtils.deleteDirOnExit
public static void deleteDirOnExit(final File dir) { if (dir.isDirectory()) { final String[] children = dir.list(); for (int i = 0; i < children.length; i++) { deleteDirOnExit(new File(dir, children[i])); } } // The directory is now empty so delete it dir.deleteOnExit(); }
java
public static void deleteDirOnExit(final File dir) { if (dir.isDirectory()) { final String[] children = dir.list(); for (int i = 0; i < children.length; i++) { deleteDirOnExit(new File(dir, children[i])); } } // The directory is now empty so delete it dir.deleteOnExit(); }
[ "public", "static", "void", "deleteDirOnExit", "(", "final", "File", "dir", ")", "{", "if", "(", "dir", ".", "isDirectory", "(", ")", ")", "{", "final", "String", "[", "]", "children", "=", "dir", ".", "list", "(", ")", ";", "for", "(", "int", "i",...
Delete a directory recursively. This method will delete all files and subdirectories. @param dir Directory to delete @return If no error occurs, true is returned. false otherwise.
[ "Delete", "a", "directory", "recursively", ".", "This", "method", "will", "delete", "all", "files", "and", "subdirectories", "." ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/utils/FileUtils.java#L100-L110
JodaOrg/joda-time
src/main/java/org/joda/time/DateTime.java
DateTime.withDurationAdded
public DateTime withDurationAdded(long durationToAdd, int scalar) { if (durationToAdd == 0 || scalar == 0) { return this; } long instant = getChronology().add(getMillis(), durationToAdd, scalar); return withMillis(instant); }
java
public DateTime withDurationAdded(long durationToAdd, int scalar) { if (durationToAdd == 0 || scalar == 0) { return this; } long instant = getChronology().add(getMillis(), durationToAdd, scalar); return withMillis(instant); }
[ "public", "DateTime", "withDurationAdded", "(", "long", "durationToAdd", ",", "int", "scalar", ")", "{", "if", "(", "durationToAdd", "==", "0", "||", "scalar", "==", "0", ")", "{", "return", "this", ";", "}", "long", "instant", "=", "getChronology", "(", ...
Returns a copy of this datetime with the specified duration added. <p> If the addition is zero, then <code>this</code> is returned. @param durationToAdd the duration to add to this one @param scalar the amount of times to add, such as -1 to subtract once @return a copy of this datetime with the duration added @throws ArithmeticException if the new datetime exceeds the capacity of a long
[ "Returns", "a", "copy", "of", "this", "datetime", "with", "the", "specified", "duration", "added", ".", "<p", ">", "If", "the", "addition", "is", "zero", "then", "<code", ">", "this<", "/", "code", ">", "is", "returned", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/DateTime.java#L897-L903
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/text/RbnfScannerProviderImpl.java
RbnfScannerProviderImpl.get
@Deprecated public RbnfLenientScanner get(ULocale locale, String extras) { RbnfLenientScanner result = null; String key = locale.toString() + "/" + extras; synchronized(cache) { result = cache.get(key); if (result != null) { return result; } } result = createScanner(locale, extras); synchronized(cache) { cache.put(key, result); } return result; }
java
@Deprecated public RbnfLenientScanner get(ULocale locale, String extras) { RbnfLenientScanner result = null; String key = locale.toString() + "/" + extras; synchronized(cache) { result = cache.get(key); if (result != null) { return result; } } result = createScanner(locale, extras); synchronized(cache) { cache.put(key, result); } return result; }
[ "@", "Deprecated", "public", "RbnfLenientScanner", "get", "(", "ULocale", "locale", ",", "String", "extras", ")", "{", "RbnfLenientScanner", "result", "=", "null", ";", "String", "key", "=", "locale", ".", "toString", "(", ")", "+", "\"/\"", "+", "extras", ...
Returns a collation-based scanner. Only primary differences are treated as significant. This means that case differences, accent differences, alternate spellings of the same letter (e.g., ae and a-umlaut in German), ignorable characters, etc. are ignored in matching the text. In many cases, numerals will be accepted in place of words or phrases as well. For example, all of the following will correctly parse as 255 in English in lenient-parse mode: <br>"two hundred fifty-five" <br>"two hundred fifty five" <br>"TWO HUNDRED FIFTY-FIVE" <br>"twohundredfiftyfive" <br>"2 hundred fifty-5" The Collator used is determined by the locale that was passed to this object on construction. The description passed to this object on construction may supply additional collation rules that are appended to the end of the default collator for the locale, enabling additional equivalences (such as adding more ignorable characters or permitting spelled-out version of symbols; see the demo program for examples). It's important to emphasize that even strict parsing is relatively lenient: it will accept some text that it won't produce as output. In English, for example, it will correctly parse "two hundred zero" and "fifteen hundred". @deprecated This API is ICU internal only. @hide draft / provisional / internal are hidden on Android
[ "Returns", "a", "collation", "-", "based", "scanner", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/text/RbnfScannerProviderImpl.java#L76-L91
mapsforge/mapsforge
mapsforge-map-reader/src/main/java/org/mapsforge/map/reader/MapFile.java
MapFile.readLabels
@Override public MapReadResult readLabels(Tile tile) { return readMapData(tile, tile, Selector.LABELS); }
java
@Override public MapReadResult readLabels(Tile tile) { return readMapData(tile, tile, Selector.LABELS); }
[ "@", "Override", "public", "MapReadResult", "readLabels", "(", "Tile", "tile", ")", "{", "return", "readMapData", "(", "tile", ",", "tile", ",", "Selector", ".", "LABELS", ")", ";", "}" ]
Reads only labels for tile. @param tile tile for which data is requested. @return label data for the tile.
[ "Reads", "only", "labels", "for", "tile", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-reader/src/main/java/org/mapsforge/map/reader/MapFile.java#L837-L840
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/input/CmsMultiSelectBox.java
CmsMultiSelectBox.getTitle
protected String getTitle(String option, String defaultValue) { if ((option != null) && m_titles.containsKey(option)) { return m_titles.get(option); } return defaultValue; }
java
protected String getTitle(String option, String defaultValue) { if ((option != null) && m_titles.containsKey(option)) { return m_titles.get(option); } return defaultValue; }
[ "protected", "String", "getTitle", "(", "String", "option", ",", "String", "defaultValue", ")", "{", "if", "(", "(", "option", "!=", "null", ")", "&&", "m_titles", ".", "containsKey", "(", "option", ")", ")", "{", "return", "m_titles", ".", "get", "(", ...
Helper method to get the title for a given select option.<p> @param option the select option value @param defaultValue the value to return when no title for the value was found @return the title for the select option
[ "Helper", "method", "to", "get", "the", "title", "for", "a", "given", "select", "option", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/CmsMultiSelectBox.java#L364-L370
xmlunit/xmlunit
xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XpathNodeTracker.java
XpathNodeTracker.visitedNode
protected void visitedNode(Node visited, String value) { levels.getLast().trackNode(visited, value); }
java
protected void visitedNode(Node visited, String value) { levels.getLast().trackNode(visited, value); }
[ "protected", "void", "visitedNode", "(", "Node", "visited", ",", "String", "value", ")", "{", "levels", ".", "getLast", "(", ")", ".", "trackNode", "(", "visited", ",", "value", ")", ";", "}" ]
Invoked by {@link #visited visited} when visited is an element, text, CDATA section, comment or processing instruction. @param visited the visited node - Unit tests call this with null values, so it is not safe to assume it will never be null. It will never be null when the {@link #visited visited} method delegates here. @param value the local name of the element or an XPath identifier matching the type of node.
[ "Invoked", "by", "{", "@link", "#visited", "visited", "}", "when", "visited", "is", "an", "element", "text", "CDATA", "section", "comment", "or", "processing", "instruction", "." ]
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XpathNodeTracker.java#L188-L190
davidmoten/geo
geo/src/main/java/com/github/davidmoten/geo/GeoHash.java
GeoHash.refineInterval
private static void refineInterval(double[] interval, int cd, int mask) { if ((cd & mask) != 0) interval[0] = (interval[0] + interval[1]) / 2; else interval[1] = (interval[0] + interval[1]) / 2; }
java
private static void refineInterval(double[] interval, int cd, int mask) { if ((cd & mask) != 0) interval[0] = (interval[0] + interval[1]) / 2; else interval[1] = (interval[0] + interval[1]) / 2; }
[ "private", "static", "void", "refineInterval", "(", "double", "[", "]", "interval", ",", "int", "cd", ",", "int", "mask", ")", "{", "if", "(", "(", "cd", "&", "mask", ")", "!=", "0", ")", "interval", "[", "0", "]", "=", "(", "interval", "[", "0",...
Refines interval by a factor or 2 in either the 0 or 1 ordinate. @param interval two entry array of double values @param cd used with mask @param mask used with cd
[ "Refines", "interval", "by", "a", "factor", "or", "2", "in", "either", "the", "0", "or", "1", "ordinate", "." ]
train
https://github.com/davidmoten/geo/blob/e90d2f406133cd9b60d54a3e6bdb7423d7fcce37/geo/src/main/java/com/github/davidmoten/geo/GeoHash.java#L464-L469
isisaddons-legacy/isis-module-security
dom/src/main/java/org/isisaddons/module/security/dom/user/ApplicationUserRepository.java
ApplicationUserRepository.findOrCreateUserByUsername
@Programmatic public ApplicationUser findOrCreateUserByUsername( final String username) { // slightly unusual to cache a function that modifies state, but safe because this is idempotent return queryResultsCache.execute(new Callable<ApplicationUser>() { @Override public ApplicationUser call() throws Exception { final ApplicationUser applicationUser = findByUsername(username); if (applicationUser != null) { return applicationUser; } return newDelegateUser(username, null, null); } }, ApplicationUserRepository.class, "findOrCreateUserByUsername", username); }
java
@Programmatic public ApplicationUser findOrCreateUserByUsername( final String username) { // slightly unusual to cache a function that modifies state, but safe because this is idempotent return queryResultsCache.execute(new Callable<ApplicationUser>() { @Override public ApplicationUser call() throws Exception { final ApplicationUser applicationUser = findByUsername(username); if (applicationUser != null) { return applicationUser; } return newDelegateUser(username, null, null); } }, ApplicationUserRepository.class, "findOrCreateUserByUsername", username); }
[ "@", "Programmatic", "public", "ApplicationUser", "findOrCreateUserByUsername", "(", "final", "String", "username", ")", "{", "// slightly unusual to cache a function that modifies state, but safe because this is idempotent", "return", "queryResultsCache", ".", "execute", "(", "new...
Uses the {@link QueryResultsCache} in order to support multiple lookups from <code>org.isisaddons.module.security.app.user.UserPermissionViewModel</code>. <p> <p> If the user does not exist, it will be automatically created. </p>
[ "Uses", "the", "{" ]
train
https://github.com/isisaddons-legacy/isis-module-security/blob/a9deb1b003ba01e44c859085bd078be8df0c1863/dom/src/main/java/org/isisaddons/module/security/dom/user/ApplicationUserRepository.java#L57-L71
loldevs/riotapi
rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java
ThrottledApiHandler.getSummonerSpell
public Future<SummonerSpell> getSummonerSpell(int id, SpellData data) { return new DummyFuture<>(handler.getSummonerSpell(id, data)); }
java
public Future<SummonerSpell> getSummonerSpell(int id, SpellData data) { return new DummyFuture<>(handler.getSummonerSpell(id, data)); }
[ "public", "Future", "<", "SummonerSpell", ">", "getSummonerSpell", "(", "int", "id", ",", "SpellData", "data", ")", "{", "return", "new", "DummyFuture", "<>", "(", "handler", ".", "getSummonerSpell", "(", "id", ",", "data", ")", ")", ";", "}" ]
<p> Retrieve a specific summoner spell </p> This method does not count towards the rate limit and is not affected by the throttle @param id The id of the spell @param data Additional information to retrieve @return The spell @see <a href=https://developer.riotgames.com/api/methods#!/649/2167>Official API documentation</a>
[ "<p", ">", "Retrieve", "a", "specific", "summoner", "spell", "<", "/", "p", ">", "This", "method", "does", "not", "count", "towards", "the", "rate", "limit", "and", "is", "not", "affected", "by", "the", "throttle" ]
train
https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L809-L811
facebookarchive/hadoop-20
src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/NamespaceNotifierClient.java
NamespaceNotifierClient.placeWatch
public void placeWatch(String path, EventType watchType, long transactionId) throws TransactionIdTooOldException, NotConnectedToServerException, InterruptedException, WatchAlreadyPlacedException { NamespaceEventKey eventKey = new NamespaceEventKey(path, watchType); Object connectionLock = connectionManager.getConnectionLock(); LOG.info(listeningPort + ": Placing watch: " + NotifierUtils.asString(eventKey) + " ..."); if (watchedEvents.containsKey(eventKey)) { LOG.warn(listeningPort + ": Watch already exists at " + NotifierUtils.asString(eventKey)); throw new WatchAlreadyPlacedException(); } synchronized (connectionLock) { connectionManager.waitForTransparentConnect(); if (!subscribe(path, watchType, transactionId)) { connectionManager.failConnection(true); connectionManager.waitForTransparentConnect(); if (!subscribe(path, watchType, transactionId)) { // Since we are failing visible to the client, then there isn't // a need to request from a given txId watchedEvents.put(eventKey, -1L); connectionManager.failConnection(false); return; } } watchedEvents.put(eventKey, transactionId); } }
java
public void placeWatch(String path, EventType watchType, long transactionId) throws TransactionIdTooOldException, NotConnectedToServerException, InterruptedException, WatchAlreadyPlacedException { NamespaceEventKey eventKey = new NamespaceEventKey(path, watchType); Object connectionLock = connectionManager.getConnectionLock(); LOG.info(listeningPort + ": Placing watch: " + NotifierUtils.asString(eventKey) + " ..."); if (watchedEvents.containsKey(eventKey)) { LOG.warn(listeningPort + ": Watch already exists at " + NotifierUtils.asString(eventKey)); throw new WatchAlreadyPlacedException(); } synchronized (connectionLock) { connectionManager.waitForTransparentConnect(); if (!subscribe(path, watchType, transactionId)) { connectionManager.failConnection(true); connectionManager.waitForTransparentConnect(); if (!subscribe(path, watchType, transactionId)) { // Since we are failing visible to the client, then there isn't // a need to request from a given txId watchedEvents.put(eventKey, -1L); connectionManager.failConnection(false); return; } } watchedEvents.put(eventKey, transactionId); } }
[ "public", "void", "placeWatch", "(", "String", "path", ",", "EventType", "watchType", ",", "long", "transactionId", ")", "throws", "TransactionIdTooOldException", ",", "NotConnectedToServerException", ",", "InterruptedException", ",", "WatchAlreadyPlacedException", "{", "...
The watcher (given in the constructor) will be notified when an event of the given type and at the given path will happen. He will keep receiving notifications until the watch is removed with {@link #removeWatch(String, EventType)}. The subscription is considered done if the method doesn't throw an exception (even if Watcher.connectionFailed is called before this method returns). @param path the path where the watch is placed. For the FILE_ADDED event type, this represents the path of the directory under which the file will be created. @param watchType the type of the event for which we want to receive the notifications. @param transactionId the transaction id of the last received notification. Notifications will from and excluding the notification with this transaction id. If this is -1, then all notifications that happened after this method returns will be received and some of the notifications between the time the method was called and the time the method returns may be received. @throws WatchAlreadyPlacedException if the watch already exists for this path and type. @throws NotConnectedToServerException when the Watcher.connectionSuccessful method was not called (the connection to the server isn't established yet) at start-up or after a Watcher.connectionFailed call. The Watcher.connectionFailed could of happened anytime since the last Watcher.connectionSuccessful call until this method returns. @throws TransactionIdTooOldException when the requested transaction id is too old and not loosing notifications can't be guaranteed. A solution would be a manual scanning and then calling the method again with -1 as the transactionId parameter.
[ "The", "watcher", "(", "given", "in", "the", "constructor", ")", "will", "be", "notified", "when", "an", "event", "of", "the", "given", "type", "and", "at", "the", "given", "path", "will", "happen", ".", "He", "will", "keep", "receiving", "notifications", ...
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/NamespaceNotifierClient.java#L297-L329
landawn/AbacusUtil
src/com/landawn/abacus/util/CSVUtil.java
CSVUtil.importCSV
public static <E extends Exception> long importCSV(final InputStream is, long offset, final long count, final Try.Predicate<String[], E> filter, final PreparedStatement stmt, final int batchSize, final int batchInterval, final Try.BiConsumer<? super PreparedStatement, ? super String[], SQLException> stmtSetter) throws UncheckedSQLException, UncheckedIOException, E { final Reader reader = new InputStreamReader(is); return importCSV(reader, offset, count, filter, stmt, batchSize, batchInterval, stmtSetter); }
java
public static <E extends Exception> long importCSV(final InputStream is, long offset, final long count, final Try.Predicate<String[], E> filter, final PreparedStatement stmt, final int batchSize, final int batchInterval, final Try.BiConsumer<? super PreparedStatement, ? super String[], SQLException> stmtSetter) throws UncheckedSQLException, UncheckedIOException, E { final Reader reader = new InputStreamReader(is); return importCSV(reader, offset, count, filter, stmt, batchSize, batchInterval, stmtSetter); }
[ "public", "static", "<", "E", "extends", "Exception", ">", "long", "importCSV", "(", "final", "InputStream", "is", ",", "long", "offset", ",", "final", "long", "count", ",", "final", "Try", ".", "Predicate", "<", "String", "[", "]", ",", "E", ">", "fil...
Imports the data from CSV to database. @param is @param offset @param count @param filter @param stmt the column order in the sql should be consistent with the column order in the CSV file. @param batchSize @param batchInterval @param stmtSetter @return
[ "Imports", "the", "data", "from", "CSV", "to", "database", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/CSVUtil.java#L1644-L1649
ontop/ontop
core/obda/src/main/java/it/unibz/inf/ontop/spec/ontology/impl/OntologyBuilderImpl.java
OntologyBuilderImpl.createAnnotationAssertion
public static AnnotationAssertion createAnnotationAssertion(AnnotationProperty ap, ObjectConstant o, Constant c) { return new AnnotationAssertionImpl(ap,o,c); }
java
public static AnnotationAssertion createAnnotationAssertion(AnnotationProperty ap, ObjectConstant o, Constant c) { return new AnnotationAssertionImpl(ap,o,c); }
[ "public", "static", "AnnotationAssertion", "createAnnotationAssertion", "(", "AnnotationProperty", "ap", ",", "ObjectConstant", "o", ",", "Constant", "c", ")", "{", "return", "new", "AnnotationAssertionImpl", "(", "ap", ",", "o", ",", "c", ")", ";", "}" ]
Creates an annotation assertion AnnotationAssertion := 'AnnotationAssertion' '(' axiomAnnotations AnnotationProperty AnnotationSubject AnnotationValue ')' AnnotationSubject := IRI | AnonymousIndividual
[ "Creates", "an", "annotation", "assertion", "AnnotationAssertion", ":", "=", "AnnotationAssertion", "(", "axiomAnnotations", "AnnotationProperty", "AnnotationSubject", "AnnotationValue", ")", "AnnotationSubject", ":", "=", "IRI", "|", "AnonymousIndividual" ]
train
https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/core/obda/src/main/java/it/unibz/inf/ontop/spec/ontology/impl/OntologyBuilderImpl.java#L495-L497
Alluxio/alluxio
shell/src/main/java/alluxio/cli/fs/FileSystemShellUtils.java
FileSystemShellUtils.getFiles
public static List<File> getFiles(String inputPath) { File file = new File(inputPath); if (!inputPath.contains("*")) { List<File> res = new ArrayList<>(); if (file.exists()) { res.add(file); } return res; } else { String prefix = inputPath.substring(0, inputPath.indexOf(AlluxioURI.WILDCARD) + 1); String parent = new File(prefix).getParent(); return getFiles(inputPath, parent); } }
java
public static List<File> getFiles(String inputPath) { File file = new File(inputPath); if (!inputPath.contains("*")) { List<File> res = new ArrayList<>(); if (file.exists()) { res.add(file); } return res; } else { String prefix = inputPath.substring(0, inputPath.indexOf(AlluxioURI.WILDCARD) + 1); String parent = new File(prefix).getParent(); return getFiles(inputPath, parent); } }
[ "public", "static", "List", "<", "File", ">", "getFiles", "(", "String", "inputPath", ")", "{", "File", "file", "=", "new", "File", "(", "inputPath", ")", ";", "if", "(", "!", "inputPath", ".", "contains", "(", "\"*\"", ")", ")", "{", "List", "<", ...
Gets the files (on the local filesystem) that match the given input path. If the path is a regular path, the returned list only contains the corresponding file; Else if the path contains wildcards, the returned list contains all the matched Files. @param inputPath The input file path (could contain wildcards) @return a list of files that matches inputPath
[ "Gets", "the", "files", "(", "on", "the", "local", "filesystem", ")", "that", "match", "the", "given", "input", "path", ".", "If", "the", "path", "is", "a", "regular", "path", "the", "returned", "list", "only", "contains", "the", "corresponding", "file", ...
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fs/FileSystemShellUtils.java#L171-L184
JavaMoney/jsr354-ri-bp
src/main/java/org/javamoney/moneta/spi/base/BaseMonetaryFormatsSingletonSpi.java
BaseMonetaryFormatsSingletonSpi.isAvailable
public boolean isAvailable(Locale locale, String... providers) { return isAvailable(AmountFormatQuery.of(locale, providers)); }
java
public boolean isAvailable(Locale locale, String... providers) { return isAvailable(AmountFormatQuery.of(locale, providers)); }
[ "public", "boolean", "isAvailable", "(", "Locale", "locale", ",", "String", "...", "providers", ")", "{", "return", "isAvailable", "(", "AmountFormatQuery", ".", "of", "(", "locale", ",", "providers", ")", ")", ";", "}" ]
Checks if a {@link javax.money.format.MonetaryAmountFormat} is available given a {@link javax.money.format .AmountFormatQuery}. @param locale the target {@link java.util.Locale}, not {@code null}. @param providers The (optional) providers to be used, ordered correspondingly. @return true, if a t least one {@link javax.money.format.MonetaryAmountFormat} is matching the query.
[ "Checks", "if", "a", "{", "@link", "javax", ".", "money", ".", "format", ".", "MonetaryAmountFormat", "}", "is", "available", "given", "a", "{", "@link", "javax", ".", "money", ".", "format", ".", "AmountFormatQuery", "}", "." ]
train
https://github.com/JavaMoney/jsr354-ri-bp/blob/9c147ef5623d8032a6dc4c0e5eefdfb41641a9a2/src/main/java/org/javamoney/moneta/spi/base/BaseMonetaryFormatsSingletonSpi.java#L66-L68
sniffy/sniffy
sniffy-core/src/main/java/io/sniffy/LegacySpy.java
LegacySpy.expectAtMost
@Deprecated public C expectAtMost(int allowedStatements, Threads threadMatcher) { return expect(SqlQueries.maxQueries(allowedStatements).threads(threadMatcher)); }
java
@Deprecated public C expectAtMost(int allowedStatements, Threads threadMatcher) { return expect(SqlQueries.maxQueries(allowedStatements).threads(threadMatcher)); }
[ "@", "Deprecated", "public", "C", "expectAtMost", "(", "int", "allowedStatements", ",", "Threads", "threadMatcher", ")", "{", "return", "expect", "(", "SqlQueries", ".", "maxQueries", "(", "allowedStatements", ")", ".", "threads", "(", "threadMatcher", ")", ")",...
Alias for {@link #expectBetween(int, int, Threads, Query)} with arguments 0, {@code allowedStatements}, {@code threads}, {@link Query#ANY} @since 2.0
[ "Alias", "for", "{" ]
train
https://github.com/sniffy/sniffy/blob/7bdddb9593e6b6e9fe5c7c87519f864acbc3a5c0/sniffy-core/src/main/java/io/sniffy/LegacySpy.java#L319-L322
craftercms/profile
security-provider/src/main/java/org/craftercms/security/servlet/filters/RequestSecurityFilter.java
RequestSecurityFilter.createRequestContext
protected RequestContext createRequestContext(HttpServletRequest request, HttpServletResponse response) { return new RequestContext(request, response, getServletContext()); }
java
protected RequestContext createRequestContext(HttpServletRequest request, HttpServletResponse response) { return new RequestContext(request, response, getServletContext()); }
[ "protected", "RequestContext", "createRequestContext", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "{", "return", "new", "RequestContext", "(", "request", ",", "response", ",", "getServletContext", "(", ")", ")", ";", "}" ]
Returns a new {@link RequestContext}, using the specified {@link HttpServletRequest} and {@link HttpServletResponse}.
[ "Returns", "a", "new", "{" ]
train
https://github.com/craftercms/profile/blob/d829c1136b0fd21d87dc925cb7046cbd38a300a4/security-provider/src/main/java/org/craftercms/security/servlet/filters/RequestSecurityFilter.java#L181-L183
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesInner.java
ServerDnsAliasesInner.beginAcquire
public void beginAcquire(String resourceGroupName, String serverName, String dnsAliasName) { beginAcquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).toBlocking().single().body(); }
java
public void beginAcquire(String resourceGroupName, String serverName, String dnsAliasName) { beginAcquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).toBlocking().single().body(); }
[ "public", "void", "beginAcquire", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "dnsAliasName", ")", "{", "beginAcquireWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "dnsAliasName", ")", ".", "toBlocking", ...
Acquires server DNS alias from another server. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server that the alias is pointing to. @param dnsAliasName The name of the server dns alias. @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
[ "Acquires", "server", "DNS", "alias", "from", "another", "server", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesInner.java#L827-L829
kiegroup/droolsjbpm-integration
kie-server-parent/kie-server-common/src/main/java/org/kie/server/common/rest/KieServerHttpRequest.java
KieServerHttpRequest.encodeUrlToUTF8
static String encodeUrlToUTF8( final CharSequence url ) throws KieServerHttpRequestException { URL parsed; try { parsed = new URL(url.toString()); } catch( IOException ioe ) { throw new KieServerHttpRequestException("Unable to encode url '" + url.toString() + "'", ioe); } String host = parsed.getHost(); int port = parsed.getPort(); if( port != -1 ) host = host + ':' + Integer.toString(port); try { String encoded = new URI(parsed.getProtocol(), host, parsed.getPath(), parsed.getQuery(), null).toASCIIString(); int paramsStart = encoded.indexOf('?'); if( paramsStart > 0 && paramsStart + 1 < encoded.length() ) encoded = encoded.substring(0, paramsStart + 1) + encoded.substring(paramsStart + 1).replace("+", "%2B"); return encoded; } catch( URISyntaxException e ) { KieServerHttpRequestException krhre = new KieServerHttpRequestException("Unable to parse parse URI", e); throw krhre; } }
java
static String encodeUrlToUTF8( final CharSequence url ) throws KieServerHttpRequestException { URL parsed; try { parsed = new URL(url.toString()); } catch( IOException ioe ) { throw new KieServerHttpRequestException("Unable to encode url '" + url.toString() + "'", ioe); } String host = parsed.getHost(); int port = parsed.getPort(); if( port != -1 ) host = host + ':' + Integer.toString(port); try { String encoded = new URI(parsed.getProtocol(), host, parsed.getPath(), parsed.getQuery(), null).toASCIIString(); int paramsStart = encoded.indexOf('?'); if( paramsStart > 0 && paramsStart + 1 < encoded.length() ) encoded = encoded.substring(0, paramsStart + 1) + encoded.substring(paramsStart + 1).replace("+", "%2B"); return encoded; } catch( URISyntaxException e ) { KieServerHttpRequestException krhre = new KieServerHttpRequestException("Unable to parse parse URI", e); throw krhre; } }
[ "static", "String", "encodeUrlToUTF8", "(", "final", "CharSequence", "url", ")", "throws", "KieServerHttpRequestException", "{", "URL", "parsed", ";", "try", "{", "parsed", "=", "new", "URL", "(", "url", ".", "toString", "(", ")", ")", ";", "}", "catch", "...
Encode the given URL as an ASCII {@link String} <p> This method ensures the path and query segments of the URL are properly encoded such as ' ' characters being encoded to '%20' or any UTF-8 characters that are non-ASCII. No encoding of URLs is done by default by the {@link KieServerHttpRequest} constructors and so if URL encoding is needed this method should be called before calling the {@link KieServerHttpRequest} constructor. @param url @return encoded URL @throws KieServerHttpRequestException
[ "Encode", "the", "given", "URL", "as", "an", "ASCII", "{", "@link", "String", "}", "<p", ">", "This", "method", "ensures", "the", "path", "and", "query", "segments", "of", "the", "URL", "are", "properly", "encoded", "such", "as", "characters", "being", "...
train
https://github.com/kiegroup/droolsjbpm-integration/blob/6c26200ab03855dbb92b56ca0c6363cdec0eaf2c/kie-server-parent/kie-server-common/src/main/java/org/kie/server/common/rest/KieServerHttpRequest.java#L471-L494
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/datetime/PDTFormatter.java
PDTFormatter.getFormatterDateTime
@Nonnull public static DateTimeFormatter getFormatterDateTime (@Nonnull final FormatStyle eStyle, @Nullable final Locale aDisplayLocale, @Nonnull final EDTFormatterMode eMode) { return _getFormatter (new CacheKey (EDTType.LOCAL_DATE_TIME, aDisplayLocale, eStyle, eMode), aDisplayLocale); }
java
@Nonnull public static DateTimeFormatter getFormatterDateTime (@Nonnull final FormatStyle eStyle, @Nullable final Locale aDisplayLocale, @Nonnull final EDTFormatterMode eMode) { return _getFormatter (new CacheKey (EDTType.LOCAL_DATE_TIME, aDisplayLocale, eStyle, eMode), aDisplayLocale); }
[ "@", "Nonnull", "public", "static", "DateTimeFormatter", "getFormatterDateTime", "(", "@", "Nonnull", "final", "FormatStyle", "eStyle", ",", "@", "Nullable", "final", "Locale", "aDisplayLocale", ",", "@", "Nonnull", "final", "EDTFormatterMode", "eMode", ")", "{", ...
Get the date time formatter for the passed locale. @param eStyle The format style to be used. May not be <code>null</code>. @param aDisplayLocale The display locale to be used. May be <code>null</code>. @param eMode Print or parse? May not be <code>null</code>. @return The created date time formatter. Never <code>null</code>. @since 8.5.6
[ "Get", "the", "date", "time", "formatter", "for", "the", "passed", "locale", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/datetime/PDTFormatter.java#L297-L303
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/FieldListener.java
FieldListener.getSyncedListenersField
public BaseField getSyncedListenersField(BaseField field, FieldListener listener) { if (field != null) if (field.getRecord() == this.getOwner().getRecord()) field = listener.getOwner().getRecord().getField(field.getFieldName()); return field; }
java
public BaseField getSyncedListenersField(BaseField field, FieldListener listener) { if (field != null) if (field.getRecord() == this.getOwner().getRecord()) field = listener.getOwner().getRecord().getField(field.getFieldName()); return field; }
[ "public", "BaseField", "getSyncedListenersField", "(", "BaseField", "field", ",", "FieldListener", "listener", ")", "{", "if", "(", "field", "!=", "null", ")", "if", "(", "field", ".", "getRecord", "(", ")", "==", "this", ".", "getOwner", "(", ")", ".", ...
When cloning a listener, if the field is contained in the source record, get the same field is the new record. @param field @param listener @return
[ "When", "cloning", "a", "listener", "if", "the", "field", "is", "contained", "in", "the", "source", "record", "get", "the", "same", "field", "is", "the", "new", "record", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/FieldListener.java#L132-L138
alibaba/jstorm
jstorm-on-yarn/src/main/java/com/alibaba/jstorm/yarn/utils/MyScpClient.java
MyScpClient.put
public void put(byte[] data, String remoteFileName, String remoteTargetDirectory) throws IOException { put(data, remoteFileName, remoteTargetDirectory, "0600"); }
java
public void put(byte[] data, String remoteFileName, String remoteTargetDirectory) throws IOException { put(data, remoteFileName, remoteTargetDirectory, "0600"); }
[ "public", "void", "put", "(", "byte", "[", "]", "data", ",", "String", "remoteFileName", ",", "String", "remoteTargetDirectory", ")", "throws", "IOException", "{", "put", "(", "data", ",", "remoteFileName", ",", "remoteTargetDirectory", ",", "\"0600\"", ")", "...
Create a remote file and copy the contents of the passed byte array into it. Uses mode 0600 for creating the remote file. @param data the data to be copied into the remote file. @param remoteFileName The name of the file which will be created in the remote target directory. @param remoteTargetDirectory Remote target directory. @throws IOException
[ "Create", "a", "remote", "file", "and", "copy", "the", "contents", "of", "the", "passed", "byte", "array", "into", "it", ".", "Uses", "mode", "0600", "for", "creating", "the", "remote", "file", "." ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-on-yarn/src/main/java/com/alibaba/jstorm/yarn/utils/MyScpClient.java#L343-L345
arquillian/arquillian-algeron
common/git/src/main/java/org/arquillian/algeron/git/GitOperations.java
GitOperations.addAndCommit
public RevCommit addAndCommit(Git git, String message) { try { git.add() .addFilepattern(".") .call(); return git.commit() .setMessage(message) .call(); } catch (GitAPIException e) { throw new IllegalStateException(e); } }
java
public RevCommit addAndCommit(Git git, String message) { try { git.add() .addFilepattern(".") .call(); return git.commit() .setMessage(message) .call(); } catch (GitAPIException e) { throw new IllegalStateException(e); } }
[ "public", "RevCommit", "addAndCommit", "(", "Git", "git", ",", "String", "message", ")", "{", "try", "{", "git", ".", "add", "(", ")", ".", "addFilepattern", "(", "\".\"", ")", ".", "call", "(", ")", ";", "return", "git", ".", "commit", "(", ")", "...
Add all files and commit them with given message. This is equivalent as doing git add . git commit -m "message". @param git instance. @param message of the commit. @return RevCommit of this commit.
[ "Add", "all", "files", "and", "commit", "them", "with", "given", "message", ".", "This", "is", "equivalent", "as", "doing", "git", "add", ".", "git", "commit", "-", "m", "message", "." ]
train
https://github.com/arquillian/arquillian-algeron/blob/ec79372defdafe99ab2f7bb696f1c1eabdbbacb6/common/git/src/main/java/org/arquillian/algeron/git/GitOperations.java#L208-L219
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPChainer.java
AFPChainer.afpPairConn
public static boolean afpPairConn(int afp1, int afp2, FatCatParameters params, AFPChain afpChain) { Double conn = afpChain.getConn(); Double dvar = afpChain.getDVar(); double misScore = params.getMisScore(); double maxPenalty = params.getMaxPenalty(); double disCut = params.getDisCut(); double gapExtend = params.getGapExtend(); double torsionPenalty = params.getTorsionPenalty(); double disSmooth = params.getDisSmooth(); List<AFP> afpSet = afpChain.getAfpSet(); int m = calcGap(afpSet.get(afp2),afpSet.get(afp1)); int g = calcMismatch(afpSet.get(afp2),afpSet.get(afp1)); double gp = misScore * m; //on average, penalty for a mismatch is misScore, no modification on score if(g > 0) { gp += gapExtend * g; } if(gp < maxPenalty) gp = maxPenalty; //penalty cut-off //note: use < (smaller) instead of >, because maxPenalty is a negative number double d; d = calAfpDis(afp1, afp2,params, afpChain); //note: the 'dis' value is numerically equivalent to the 'rms' with exceptions boolean ch = false; double tp = 0.0; if(d >= disCut) { tp = torsionPenalty; ch = true; } //use the variation of the distances between AFPs else if(d > disCut - disSmooth) { double wt = Math.sqrt((d - disCut + disSmooth) / disSmooth); //using sqrt: penalty increase with dis more quicker than linear function tp = torsionPenalty * wt; } dvar = d; conn = tp + gp; afpChain.setConn(conn); afpChain.setDVar(dvar); return ch; }
java
public static boolean afpPairConn(int afp1, int afp2, FatCatParameters params, AFPChain afpChain) { Double conn = afpChain.getConn(); Double dvar = afpChain.getDVar(); double misScore = params.getMisScore(); double maxPenalty = params.getMaxPenalty(); double disCut = params.getDisCut(); double gapExtend = params.getGapExtend(); double torsionPenalty = params.getTorsionPenalty(); double disSmooth = params.getDisSmooth(); List<AFP> afpSet = afpChain.getAfpSet(); int m = calcGap(afpSet.get(afp2),afpSet.get(afp1)); int g = calcMismatch(afpSet.get(afp2),afpSet.get(afp1)); double gp = misScore * m; //on average, penalty for a mismatch is misScore, no modification on score if(g > 0) { gp += gapExtend * g; } if(gp < maxPenalty) gp = maxPenalty; //penalty cut-off //note: use < (smaller) instead of >, because maxPenalty is a negative number double d; d = calAfpDis(afp1, afp2,params, afpChain); //note: the 'dis' value is numerically equivalent to the 'rms' with exceptions boolean ch = false; double tp = 0.0; if(d >= disCut) { tp = torsionPenalty; ch = true; } //use the variation of the distances between AFPs else if(d > disCut - disSmooth) { double wt = Math.sqrt((d - disCut + disSmooth) / disSmooth); //using sqrt: penalty increase with dis more quicker than linear function tp = torsionPenalty * wt; } dvar = d; conn = tp + gp; afpChain.setConn(conn); afpChain.setDVar(dvar); return ch; }
[ "public", "static", "boolean", "afpPairConn", "(", "int", "afp1", ",", "int", "afp2", ",", "FatCatParameters", "params", ",", "AFPChain", "afpChain", ")", "{", "Double", "conn", "=", "afpChain", ".", "getConn", "(", ")", ";", "Double", "dvar", "=", "afpCha...
Key function: calculate the connectivity of AFP pairs no compatibility criteria is executed note: afp1 is previous to afp2 in terms of the position this module must be optimized @param afp1 @param afp2 @return flag if they are connected
[ "Key", "function", ":", "calculate", "the", "connectivity", "of", "AFP", "pairs", "no", "compatibility", "criteria", "is", "executed", "note", ":", "afp1", "is", "previous", "to", "afp2", "in", "terms", "of", "the", "position", "this", "module", "must", "be"...
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPChainer.java#L308-L357
looly/hutool
hutool-db/src/main/java/cn/hutool/db/StatementUtil.java
StatementUtil.prepareStatementForBatch
public static PreparedStatement prepareStatementForBatch(Connection conn, String sql, Iterable<Object[]> paramsBatch) throws SQLException { Assert.notBlank(sql, "Sql String must be not blank!"); sql = sql.trim(); SqlLog.INSTASNCE.log(sql, paramsBatch); PreparedStatement ps = conn.prepareStatement(sql); for (Object[] params : paramsBatch) { StatementUtil.fillParams(ps, params); ps.addBatch(); } return ps; }
java
public static PreparedStatement prepareStatementForBatch(Connection conn, String sql, Iterable<Object[]> paramsBatch) throws SQLException { Assert.notBlank(sql, "Sql String must be not blank!"); sql = sql.trim(); SqlLog.INSTASNCE.log(sql, paramsBatch); PreparedStatement ps = conn.prepareStatement(sql); for (Object[] params : paramsBatch) { StatementUtil.fillParams(ps, params); ps.addBatch(); } return ps; }
[ "public", "static", "PreparedStatement", "prepareStatementForBatch", "(", "Connection", "conn", ",", "String", "sql", ",", "Iterable", "<", "Object", "[", "]", ">", "paramsBatch", ")", "throws", "SQLException", "{", "Assert", ".", "notBlank", "(", "sql", ",", ...
创建批量操作的{@link PreparedStatement} @param conn 数据库连接 @param sql SQL语句,使用"?"做为占位符 @param paramsBatch "?"对应参数批次列表 @return {@link PreparedStatement} @throws SQLException SQL异常 @since 4.1.13
[ "创建批量操作的", "{", "@link", "PreparedStatement", "}" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/StatementUtil.java#L177-L188
tvesalainen/bcc
src/main/java/org/vesalainen/bcc/MethodCompiler.java
MethodCompiler.getField
public void getField(Class<?> cls, String name) throws IOException { getField(El.getField(cls, name)); }
java
public void getField(Class<?> cls, String name) throws IOException { getField(El.getField(cls, name)); }
[ "public", "void", "getField", "(", "Class", "<", "?", ">", "cls", ",", "String", "name", ")", "throws", "IOException", "{", "getField", "(", "El", ".", "getField", "(", "cls", ",", "name", ")", ")", ";", "}" ]
Get field from class <p>Stack: ..., =&gt; ..., value @param cls @param name @throws IOException
[ "Get", "field", "from", "class", "<p", ">", "Stack", ":", "...", "=", "&gt", ";", "...", "value" ]
train
https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/MethodCompiler.java#L917-L920
ltsopensource/light-task-scheduler
lts-core/src/main/java/com/github/ltsopensource/core/commons/utils/WebUtils.java
WebUtils.doPost
public static String doPost(String url, Map<String, String> params, String charset, int connectTimeout, int readTimeout) throws IOException { return doPost(url, params, charset, connectTimeout, readTimeout, null); }
java
public static String doPost(String url, Map<String, String> params, String charset, int connectTimeout, int readTimeout) throws IOException { return doPost(url, params, charset, connectTimeout, readTimeout, null); }
[ "public", "static", "String", "doPost", "(", "String", "url", ",", "Map", "<", "String", ",", "String", ">", "params", ",", "String", "charset", ",", "int", "connectTimeout", ",", "int", "readTimeout", ")", "throws", "IOException", "{", "return", "doPost", ...
执行HTTP POST请求。 @param url 请求地址 @param params 请求参数 @param charset 字符集,如UTF-8, GBK, GB2312 @return 响应字符串
[ "执行HTTP", "POST请求。" ]
train
https://github.com/ltsopensource/light-task-scheduler/blob/64d3aa000ff5022be5e94f511b58f405e5f4c8eb/lts-core/src/main/java/com/github/ltsopensource/core/commons/utils/WebUtils.java#L63-L65
spotbugs/spotbugs
eclipsePlugin/src/de/tobject/findbugs/nature/FindBugsNature.java
FindBugsNature.setFindBugsCommand
private void setFindBugsCommand(IProjectDescription description, ICommand newCommand) throws CoreException { ICommand[] oldCommands = description.getBuildSpec(); ICommand oldFindBugsCommand = getFindBugsCommand(description); ICommand[] newCommands; if (oldFindBugsCommand == null) { // Add the FindBugs build spec AFTER all other builders newCommands = new ICommand[oldCommands.length + 1]; System.arraycopy(oldCommands, 0, newCommands, 0, oldCommands.length); newCommands[oldCommands.length] = newCommand; } else { for (int i = 0, max = oldCommands.length; i < max; i++) { if (oldCommands[i] == oldFindBugsCommand) { oldCommands[i] = newCommand; break; } } newCommands = oldCommands; } // Commit the spec change into the project description.setBuildSpec(newCommands); getProject().setDescription(description, null); }
java
private void setFindBugsCommand(IProjectDescription description, ICommand newCommand) throws CoreException { ICommand[] oldCommands = description.getBuildSpec(); ICommand oldFindBugsCommand = getFindBugsCommand(description); ICommand[] newCommands; if (oldFindBugsCommand == null) { // Add the FindBugs build spec AFTER all other builders newCommands = new ICommand[oldCommands.length + 1]; System.arraycopy(oldCommands, 0, newCommands, 0, oldCommands.length); newCommands[oldCommands.length] = newCommand; } else { for (int i = 0, max = oldCommands.length; i < max; i++) { if (oldCommands[i] == oldFindBugsCommand) { oldCommands[i] = newCommand; break; } } newCommands = oldCommands; } // Commit the spec change into the project description.setBuildSpec(newCommands); getProject().setDescription(description, null); }
[ "private", "void", "setFindBugsCommand", "(", "IProjectDescription", "description", ",", "ICommand", "newCommand", ")", "throws", "CoreException", "{", "ICommand", "[", "]", "oldCommands", "=", "description", ".", "getBuildSpec", "(", ")", ";", "ICommand", "oldFindB...
Update the FindBugs command in the build spec (replace existing one if present, add one first if none).
[ "Update", "the", "FindBugs", "command", "in", "the", "build", "spec", "(", "replace", "existing", "one", "if", "present", "add", "one", "first", "if", "none", ")", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/nature/FindBugsNature.java#L126-L147
hazelcast/hazelcast
hazelcast-client/src/main/java/com/hazelcast/client/cache/impl/ClientCacheHelper.java
ClientCacheHelper.enableStatisticManagementOnNodes
static void enableStatisticManagementOnNodes(HazelcastClientInstanceImpl client, String cacheName, boolean statOrMan, boolean enabled) { Collection<Member> members = client.getClientClusterService().getMemberList(); Collection<Future> futures = new ArrayList<Future>(); for (Member member : members) { try { Address address = member.getAddress(); ClientMessage request = CacheManagementConfigCodec.encodeRequest(cacheName, statOrMan, enabled, address); ClientInvocation clientInvocation = new ClientInvocation(client, request, cacheName, address); Future<ClientMessage> future = clientInvocation.invoke(); futures.add(future); } catch (Exception e) { sneakyThrow(e); } } // make sure all configs are created FutureUtil.waitWithDeadline(futures, CacheProxyUtil.AWAIT_COMPLETION_TIMEOUT_SECONDS, TimeUnit.SECONDS); }
java
static void enableStatisticManagementOnNodes(HazelcastClientInstanceImpl client, String cacheName, boolean statOrMan, boolean enabled) { Collection<Member> members = client.getClientClusterService().getMemberList(); Collection<Future> futures = new ArrayList<Future>(); for (Member member : members) { try { Address address = member.getAddress(); ClientMessage request = CacheManagementConfigCodec.encodeRequest(cacheName, statOrMan, enabled, address); ClientInvocation clientInvocation = new ClientInvocation(client, request, cacheName, address); Future<ClientMessage> future = clientInvocation.invoke(); futures.add(future); } catch (Exception e) { sneakyThrow(e); } } // make sure all configs are created FutureUtil.waitWithDeadline(futures, CacheProxyUtil.AWAIT_COMPLETION_TIMEOUT_SECONDS, TimeUnit.SECONDS); }
[ "static", "void", "enableStatisticManagementOnNodes", "(", "HazelcastClientInstanceImpl", "client", ",", "String", "cacheName", ",", "boolean", "statOrMan", ",", "boolean", "enabled", ")", "{", "Collection", "<", "Member", ">", "members", "=", "client", ".", "getCli...
Enables/disables statistics or management support of cache on the all servers in the cluster. @param client the client instance which will send the operation to server @param cacheName full cache name with prefixes @param statOrMan flag that represents which one of the statistics or management will be enabled @param enabled flag which represents whether it is enable or disable
[ "Enables", "/", "disables", "statistics", "or", "management", "support", "of", "cache", "on", "the", "all", "servers", "in", "the", "cluster", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast-client/src/main/java/com/hazelcast/client/cache/impl/ClientCacheHelper.java#L242-L259
nats-io/java-nats-streaming
src/examples/java/io/nats/streaming/examples/Subscriber.java
Subscriber.parseDuration
private static Duration parseDuration(String duration) throws ParseException { Matcher matcher = pattern.matcher(duration); long nanoseconds = 0L; if (matcher.find() && matcher.groupCount() == 4) { int days = Integer.parseInt(matcher.group(1)); nanoseconds += TimeUnit.NANOSECONDS.convert(days, TimeUnit.DAYS); int hours = Integer.parseInt(matcher.group(2)); nanoseconds += TimeUnit.NANOSECONDS.convert(hours, TimeUnit.HOURS); int minutes = Integer.parseInt(matcher.group(3)); nanoseconds += TimeUnit.NANOSECONDS.convert(minutes, TimeUnit.MINUTES); int seconds = Integer.parseInt(matcher.group(4)); nanoseconds += TimeUnit.NANOSECONDS.convert(seconds, TimeUnit.SECONDS); long nanos = Long.parseLong(matcher.group(5)); nanoseconds += nanos; } else { throw new ParseException("Cannot parse duration " + duration, 0); } return Duration.ofNanos(nanoseconds); }
java
private static Duration parseDuration(String duration) throws ParseException { Matcher matcher = pattern.matcher(duration); long nanoseconds = 0L; if (matcher.find() && matcher.groupCount() == 4) { int days = Integer.parseInt(matcher.group(1)); nanoseconds += TimeUnit.NANOSECONDS.convert(days, TimeUnit.DAYS); int hours = Integer.parseInt(matcher.group(2)); nanoseconds += TimeUnit.NANOSECONDS.convert(hours, TimeUnit.HOURS); int minutes = Integer.parseInt(matcher.group(3)); nanoseconds += TimeUnit.NANOSECONDS.convert(minutes, TimeUnit.MINUTES); int seconds = Integer.parseInt(matcher.group(4)); nanoseconds += TimeUnit.NANOSECONDS.convert(seconds, TimeUnit.SECONDS); long nanos = Long.parseLong(matcher.group(5)); nanoseconds += nanos; } else { throw new ParseException("Cannot parse duration " + duration, 0); } return Duration.ofNanos(nanoseconds); }
[ "private", "static", "Duration", "parseDuration", "(", "String", "duration", ")", "throws", "ParseException", "{", "Matcher", "matcher", "=", "pattern", ".", "matcher", "(", "duration", ")", ";", "long", "nanoseconds", "=", "0L", ";", "if", "(", "matcher", "...
Parses a duration string of the form "98d 01h 23m 45s" into milliseconds. @throws ParseException if the duration can't be parsed
[ "Parses", "a", "duration", "string", "of", "the", "form", "98d", "01h", "23m", "45s", "into", "milliseconds", "." ]
train
https://github.com/nats-io/java-nats-streaming/blob/72f964e9093622875d7f1c85ce60820e028863e7/src/examples/java/io/nats/streaming/examples/Subscriber.java#L243-L264
codeprimate-software/cp-elements
src/main/java/org/cp/elements/util/ArrayUtils.java
ArrayUtils.deepCopy
@SuppressWarnings("unchecked") public static <T> T[] deepCopy(T[] array) { Assert.notNull(array, "Array is required"); return deepCopy(array, element -> element != null ? ObjectUtils.clone(element) : null); }
java
@SuppressWarnings("unchecked") public static <T> T[] deepCopy(T[] array) { Assert.notNull(array, "Array is required"); return deepCopy(array, element -> element != null ? ObjectUtils.clone(element) : null); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "[", "]", "deepCopy", "(", "T", "[", "]", "array", ")", "{", "Assert", ".", "notNull", "(", "array", ",", "\"Array is required\"", ")", ";", "return", "deepCopy",...
Deeply copies the given array into a new array of the same {@link Class type}. This function performs a deep copy by {@literal cloning} each element from the original array. @param <T> {@link Class type} of the array elements. @param array array to copy. @return a deep copy of the given array. @throws IllegalArgumentException if the given array is {@literal null}, or an individual element from the original array is not {@link Cloneable}. @see #deepCopy(Object[], Function) @see #shallowCopy(Object[])
[ "Deeply", "copies", "the", "given", "array", "into", "a", "new", "array", "of", "the", "same", "{", "@link", "Class", "type", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/ArrayUtils.java#L276-L282
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/task/RegularPactTask.java
RegularPactTask.logAndThrowException
public static void logAndThrowException(Exception ex, AbstractInvokable parent) throws Exception { String taskName; if (ex instanceof ExceptionInChainedStubException) { do { ExceptionInChainedStubException cex = (ExceptionInChainedStubException) ex; taskName = cex.getTaskName(); ex = cex.getWrappedException(); } while (ex instanceof ExceptionInChainedStubException); } else { taskName = parent.getEnvironment().getTaskName(); } if (LOG.isErrorEnabled()) { LOG.error(constructLogString("Error in task code", taskName, parent), ex); } throw ex; }
java
public static void logAndThrowException(Exception ex, AbstractInvokable parent) throws Exception { String taskName; if (ex instanceof ExceptionInChainedStubException) { do { ExceptionInChainedStubException cex = (ExceptionInChainedStubException) ex; taskName = cex.getTaskName(); ex = cex.getWrappedException(); } while (ex instanceof ExceptionInChainedStubException); } else { taskName = parent.getEnvironment().getTaskName(); } if (LOG.isErrorEnabled()) { LOG.error(constructLogString("Error in task code", taskName, parent), ex); } throw ex; }
[ "public", "static", "void", "logAndThrowException", "(", "Exception", "ex", ",", "AbstractInvokable", "parent", ")", "throws", "Exception", "{", "String", "taskName", ";", "if", "(", "ex", "instanceof", "ExceptionInChainedStubException", ")", "{", "do", "{", "Exce...
Prints an error message and throws the given exception. If the exception is of the type {@link ExceptionInChainedStubException} then the chain of contained exceptions is followed until an exception of a different type is found. @param ex The exception to be thrown. @param parent The parent task, whose information is included in the log message. @throws Exception Always thrown.
[ "Prints", "an", "error", "message", "and", "throws", "the", "given", "exception", ".", "If", "the", "exception", "is", "of", "the", "type", "{", "@link", "ExceptionInChainedStubException", "}", "then", "the", "chain", "of", "contained", "exceptions", "is", "fo...
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/task/RegularPactTask.java#L1193-L1210
minio/minio-java
api/src/main/java/io/minio/MinioClient.java
MinioClient.listObjects
public Iterable<Result<Item>> listObjects(final String bucketName, final String prefix) throws XmlPullParserException { // list all objects recursively return listObjects(bucketName, prefix, true); }
java
public Iterable<Result<Item>> listObjects(final String bucketName, final String prefix) throws XmlPullParserException { // list all objects recursively return listObjects(bucketName, prefix, true); }
[ "public", "Iterable", "<", "Result", "<", "Item", ">", ">", "listObjects", "(", "final", "String", "bucketName", ",", "final", "String", "prefix", ")", "throws", "XmlPullParserException", "{", "// list all objects recursively", "return", "listObjects", "(", "bucketN...
Lists object information in given bucket and prefix. @param bucketName Bucket name. @param prefix Prefix string. List objects whose name starts with `prefix`. @return an iterator of Result Items. @throws XmlPullParserException upon parsing response xml
[ "Lists", "object", "information", "in", "given", "bucket", "and", "prefix", "." ]
train
https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/MinioClient.java#L2812-L2816
devnied/EMV-NFC-Paycard-Enrollment
library/src/main/java/com/github/devnied/emvnfccard/parser/apdu/impl/DataFactory.java
DataFactory.getEnum
@SuppressWarnings("unchecked") private static IKeyEnum getEnum(final AnnotationData pAnnotation, final BitUtils pBit) { int val = 0; try { val = Integer.parseInt(pBit.getNextHexaString(pAnnotation.getSize()), pAnnotation.isReadHexa() ? 16 : 10); } catch (NumberFormatException nfe) { // do nothing } return EnumUtils.getValue(val, (Class<? extends IKeyEnum>) pAnnotation.getField().getType()); }
java
@SuppressWarnings("unchecked") private static IKeyEnum getEnum(final AnnotationData pAnnotation, final BitUtils pBit) { int val = 0; try { val = Integer.parseInt(pBit.getNextHexaString(pAnnotation.getSize()), pAnnotation.isReadHexa() ? 16 : 10); } catch (NumberFormatException nfe) { // do nothing } return EnumUtils.getValue(val, (Class<? extends IKeyEnum>) pAnnotation.getField().getType()); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "static", "IKeyEnum", "getEnum", "(", "final", "AnnotationData", "pAnnotation", ",", "final", "BitUtils", "pBit", ")", "{", "int", "val", "=", "0", ";", "try", "{", "val", "=", "Integer", ".", ...
This method is used to get an enum with his key @param pAnnotation annotation @param pBit bit array
[ "This", "method", "is", "used", "to", "get", "an", "enum", "with", "his", "key" ]
train
https://github.com/devnied/EMV-NFC-Paycard-Enrollment/blob/bfbd3960708689154a7a75c8a9a934197d738a5b/library/src/main/java/com/github/devnied/emvnfccard/parser/apdu/impl/DataFactory.java#L192-L201
Azure/azure-sdk-for-java
hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java
ClustersInner.beginRotateDiskEncryptionKeyAsync
public Observable<Void> beginRotateDiskEncryptionKeyAsync(String resourceGroupName, String clusterName, ClusterDiskEncryptionParameters parameters) { return beginRotateDiskEncryptionKeyWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> beginRotateDiskEncryptionKeyAsync(String resourceGroupName, String clusterName, ClusterDiskEncryptionParameters parameters) { return beginRotateDiskEncryptionKeyWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "beginRotateDiskEncryptionKeyAsync", "(", "String", "resourceGroupName", ",", "String", "clusterName", ",", "ClusterDiskEncryptionParameters", "parameters", ")", "{", "return", "beginRotateDiskEncryptionKeyWithServiceResponseAsync", "("...
Rotate disk encryption key of the specified HDInsight cluster. @param resourceGroupName The name of the resource group. @param clusterName The name of the cluster. @param parameters The parameters for the disk encryption operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Rotate", "disk", "encryption", "key", "of", "the", "specified", "HDInsight", "cluster", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java#L1396-L1403
dashorst/wicket-stuff-markup-validator
jing/src/main/java/com/thaiopensource/validate/nvdl/SchemaImpl.java
SchemaImpl.makeBuiltinMode
private Mode makeBuiltinMode(String name, Class cls) { // lookup/create a mode with the given name. Mode mode = lookupCreateMode(name); // Init the element action set for this mode. ActionSet actions = new ActionSet(); // from the current mode we will use further the built in mode. ModeUsage modeUsage = new ModeUsage(Mode.CURRENT, mode); // Add the action corresponding to the built in mode. if (cls == AttachAction.class) actions.setResultAction(new AttachAction(modeUsage)); else if (cls == AllowAction.class) actions.addNoResultAction(new AllowAction(modeUsage)); else if (cls == UnwrapAction.class) actions.setResultAction(new UnwrapAction(modeUsage)); else actions.addNoResultAction(new RejectAction(modeUsage)); // set the actions on any namespace. mode.bindElement(NamespaceSpecification.ANY_NAMESPACE, NamespaceSpecification.DEFAULT_WILDCARD, actions); // the mode is not defined in the script explicitelly mode.noteDefined(null); // creates attribute actions AttributeActionSet attributeActions = new AttributeActionSet(); // if we have a schema for attributes then in the built in modes // we reject attributes by default // otherwise we attach attributes by default in the built in modes if (attributesSchema) attributeActions.setReject(true); else attributeActions.setAttach(true); // set the attribute actions on any namespace mode.bindAttribute(NamespaceSpecification.ANY_NAMESPACE, NamespaceSpecification.DEFAULT_WILDCARD, attributeActions); return mode; }
java
private Mode makeBuiltinMode(String name, Class cls) { // lookup/create a mode with the given name. Mode mode = lookupCreateMode(name); // Init the element action set for this mode. ActionSet actions = new ActionSet(); // from the current mode we will use further the built in mode. ModeUsage modeUsage = new ModeUsage(Mode.CURRENT, mode); // Add the action corresponding to the built in mode. if (cls == AttachAction.class) actions.setResultAction(new AttachAction(modeUsage)); else if (cls == AllowAction.class) actions.addNoResultAction(new AllowAction(modeUsage)); else if (cls == UnwrapAction.class) actions.setResultAction(new UnwrapAction(modeUsage)); else actions.addNoResultAction(new RejectAction(modeUsage)); // set the actions on any namespace. mode.bindElement(NamespaceSpecification.ANY_NAMESPACE, NamespaceSpecification.DEFAULT_WILDCARD, actions); // the mode is not defined in the script explicitelly mode.noteDefined(null); // creates attribute actions AttributeActionSet attributeActions = new AttributeActionSet(); // if we have a schema for attributes then in the built in modes // we reject attributes by default // otherwise we attach attributes by default in the built in modes if (attributesSchema) attributeActions.setReject(true); else attributeActions.setAttach(true); // set the attribute actions on any namespace mode.bindAttribute(NamespaceSpecification.ANY_NAMESPACE, NamespaceSpecification.DEFAULT_WILDCARD, attributeActions); return mode; }
[ "private", "Mode", "makeBuiltinMode", "(", "String", "name", ",", "Class", "cls", ")", "{", "// lookup/create a mode with the given name.", "Mode", "mode", "=", "lookupCreateMode", "(", "name", ")", ";", "// Init the element action set for this mode.", "ActionSet", "actio...
Makes a built in mode. @param name The mode name. @param cls The action class. @return A Mode object.
[ "Makes", "a", "built", "in", "mode", "." ]
train
https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/validate/nvdl/SchemaImpl.java#L1170-L1202
geomajas/geomajas-project-server
impl/src/main/java/org/geomajas/internal/layer/feature/AttributeService.java
AttributeService.getAttributes
public InternalFeature getAttributes(VectorLayer layer, InternalFeature feature, Object featureBean) throws LayerException { String layerId = layer.getId(); Map<String, Attribute> featureAttributes = getRealAttributes(layer, featureBean); feature.setAttributes(featureAttributes); // to allow isAttributeReadable to see full object addSyntheticAttributes(feature, featureAttributes, layer); if (securityContext.isFeatureVisible(layerId, feature)) { feature.setAttributes(filterAttributes(layerId, layer.getLayerInfo().getFeatureInfo().getAttributesMap(), feature, featureAttributes)); feature.setEditable(securityContext.isFeatureUpdateAuthorized(layerId, feature)); feature.setDeletable(securityContext.isFeatureDeleteAuthorized(layerId, feature)); return feature; } return null; }
java
public InternalFeature getAttributes(VectorLayer layer, InternalFeature feature, Object featureBean) throws LayerException { String layerId = layer.getId(); Map<String, Attribute> featureAttributes = getRealAttributes(layer, featureBean); feature.setAttributes(featureAttributes); // to allow isAttributeReadable to see full object addSyntheticAttributes(feature, featureAttributes, layer); if (securityContext.isFeatureVisible(layerId, feature)) { feature.setAttributes(filterAttributes(layerId, layer.getLayerInfo().getFeatureInfo().getAttributesMap(), feature, featureAttributes)); feature.setEditable(securityContext.isFeatureUpdateAuthorized(layerId, feature)); feature.setDeletable(securityContext.isFeatureDeleteAuthorized(layerId, feature)); return feature; } return null; }
[ "public", "InternalFeature", "getAttributes", "(", "VectorLayer", "layer", ",", "InternalFeature", "feature", ",", "Object", "featureBean", ")", "throws", "LayerException", "{", "String", "layerId", "=", "layer", ".", "getId", "(", ")", ";", "Map", "<", "String"...
Get the attributes for a feature, and put them in the feature object. <p/> The attributes are converted lazily if requested by the layer. <p/> The feature is filled into the passed feature object. If the feature should not be visible according to security, null is returned (the original (passed) feature should be discarded in that case). The attributes are filtered according to security settings. The editable and deletable states for the feature are also set. @param layer layer which contains the feature @param feature feature for the result @param featureBean plain object for feature @return feature with filled attributes or null when feature not visible @throws LayerException problem converting attributes
[ "Get", "the", "attributes", "for", "a", "feature", "and", "put", "them", "in", "the", "feature", "object", ".", "<p", "/", ">", "The", "attributes", "are", "converted", "lazily", "if", "requested", "by", "the", "layer", ".", "<p", "/", ">", "The", "fea...
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/layer/feature/AttributeService.java#L79-L97
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ScheduleExpressionParser.java
ScheduleExpressionParser.findNamedValue
private int findNamedValue(int begin, String[] namedValues, int min) { int length = ivPos - begin; for (int i = 0; i < namedValues.length; i++) { String namedValue = namedValues[i]; if (length == namedValue.length() && ivString.regionMatches(true, begin, namedValue, 0, length)) { return min + i; } } return -1; }
java
private int findNamedValue(int begin, String[] namedValues, int min) { int length = ivPos - begin; for (int i = 0; i < namedValues.length; i++) { String namedValue = namedValues[i]; if (length == namedValue.length() && ivString.regionMatches(true, begin, namedValue, 0, length)) { return min + i; } } return -1; }
[ "private", "int", "findNamedValue", "(", "int", "begin", ",", "String", "[", "]", "namedValues", ",", "int", "min", ")", "{", "int", "length", "=", "ivPos", "-", "begin", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "namedValues", ".", "le...
Case-insensitively search the specified list of named values for a substring of the parse string. The substring of the parse string is the range [begin, ivPos). @param begin the beginning index of the substring, inclusive @param namedValues the values to search @param min the non-negative adjustment for the return value @return <tt>min</tt> plus the position in the values list matching the substring, or <tt>-1</tt> if the value was not found
[ "Case", "-", "insensitively", "search", "the", "specified", "list", "of", "named", "values", "for", "a", "substring", "of", "the", "parse", "string", ".", "The", "substring", "of", "the", "parse", "string", "is", "the", "range", "[", "begin", "ivPos", ")",...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ScheduleExpressionParser.java#L655-L670
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/GeomUtil.java
GeomUtil.getLine
public Line getLine(Shape shape, int s, int e) { float[] start = shape.getPoint(s); float[] end = shape.getPoint(e); Line line = new Line(start[0],start[1],end[0],end[1]); return line; }
java
public Line getLine(Shape shape, int s, int e) { float[] start = shape.getPoint(s); float[] end = shape.getPoint(e); Line line = new Line(start[0],start[1],end[0],end[1]); return line; }
[ "public", "Line", "getLine", "(", "Shape", "shape", ",", "int", "s", ",", "int", "e", ")", "{", "float", "[", "]", "start", "=", "shape", ".", "getPoint", "(", "s", ")", ";", "float", "[", "]", "end", "=", "shape", ".", "getPoint", "(", "e", ")...
Get a line between two points in a shape @param shape The shape @param s The index of the start point @param e The index of the end point @return The line between the two points
[ "Get", "a", "line", "between", "two", "points", "in", "a", "shape" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/GeomUtil.java#L411-L417
Drivemode/TypefaceHelper
TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java
TypefaceHelper.setTypeface
@TargetApi(Build.VERSION_CODES.HONEYCOMB) public <F extends android.app.Fragment> void setTypeface(F fragment, @StringRes int strResId) { setTypeface(fragment, mApplication.getString(strResId)); }
java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) public <F extends android.app.Fragment> void setTypeface(F fragment, @StringRes int strResId) { setTypeface(fragment, mApplication.getString(strResId)); }
[ "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "HONEYCOMB", ")", "public", "<", "F", "extends", "android", ".", "app", ".", "Fragment", ">", "void", "setTypeface", "(", "F", "fragment", ",", "@", "StringRes", "int", "strResId", ")", "{", "set...
Set the typeface to the all text views belong to the fragment. Make sure to call this method after fragment view creation. If you use fragments in the support package, call {@link com.drivemode.android.typeface.TypefaceHelper#supportSetTypeface(android.support.v4.app.Fragment, String)} instead. @param fragment the fragment. @param strResId string resource containing typeface name.
[ "Set", "the", "typeface", "to", "the", "all", "text", "views", "belong", "to", "the", "fragment", ".", "Make", "sure", "to", "call", "this", "method", "after", "fragment", "view", "creation", ".", "If", "you", "use", "fragments", "in", "the", "support", ...
train
https://github.com/Drivemode/TypefaceHelper/blob/86bef9ce16b9626b7076559e846db1b9f043c008/TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java#L372-L375
forge/core
facets/api/src/main/java/org/jboss/forge/addon/facets/constraints/FacetInspector.java
FacetInspector.getRequiredFacets
public static <FACETTYPE extends Facet<?>> Set<Class<FACETTYPE>> getRequiredFacets(final Class<?> inspectedType) { return getRelatedFacets(inspectedType, FacetConstraintType.REQUIRED); }
java
public static <FACETTYPE extends Facet<?>> Set<Class<FACETTYPE>> getRequiredFacets(final Class<?> inspectedType) { return getRelatedFacets(inspectedType, FacetConstraintType.REQUIRED); }
[ "public", "static", "<", "FACETTYPE", "extends", "Facet", "<", "?", ">", ">", "Set", "<", "Class", "<", "FACETTYPE", ">", ">", "getRequiredFacets", "(", "final", "Class", "<", "?", ">", "inspectedType", ")", "{", "return", "getRelatedFacets", "(", "inspect...
Inspect the given {@link Class} for any {@link FacetConstraintType#REQUIRED} dependency {@link Facet} types.
[ "Inspect", "the", "given", "{" ]
train
https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/facets/api/src/main/java/org/jboss/forge/addon/facets/constraints/FacetInspector.java#L71-L74
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/connect/NIODirectorySocket.java
NIODirectorySocket.registerAndConnect
void registerAndConnect(SocketChannel sock, InetSocketAddress addr) throws IOException { selectionKey = sock.register(selector, SelectionKey.OP_CONNECT); boolean immediateConnect = sock.connect(addr); if(LOGGER.isTraceEnabled()){ LOGGER.trace("Connect to host=" + addr.getHostName() + ", hostString=" + addr.getHostString() + ", port=" + addr.getPort() + ", all=" + addr.getAddress() + ", local=" + sock.socket().getLocalSocketAddress()); } if (immediateConnect) { onConnectSucceeded(); } }
java
void registerAndConnect(SocketChannel sock, InetSocketAddress addr) throws IOException { selectionKey = sock.register(selector, SelectionKey.OP_CONNECT); boolean immediateConnect = sock.connect(addr); if(LOGGER.isTraceEnabled()){ LOGGER.trace("Connect to host=" + addr.getHostName() + ", hostString=" + addr.getHostString() + ", port=" + addr.getPort() + ", all=" + addr.getAddress() + ", local=" + sock.socket().getLocalSocketAddress()); } if (immediateConnect) { onConnectSucceeded(); } }
[ "void", "registerAndConnect", "(", "SocketChannel", "sock", ",", "InetSocketAddress", "addr", ")", "throws", "IOException", "{", "selectionKey", "=", "sock", ".", "register", "(", "selector", ",", "SelectionKey", ".", "OP_CONNECT", ")", ";", "boolean", "immediateC...
Register a SocketChannel and connect the remote address. @param sock the SocketChannel. @param addr the remote address. @throws IOException the IOException.
[ "Register", "a", "SocketChannel", "and", "connect", "the", "remote", "address", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/connect/NIODirectorySocket.java#L152-L165
LearnLib/learnlib
oracles/parallelism/src/main/java/de/learnlib/oracle/parallelism/ParallelOracleBuilders.java
ParallelOracleBuilders.newDynamicParallelOracle
@Nonnull @SafeVarargs public static <I, D> DynamicParallelOracleBuilder<I, D> newDynamicParallelOracle(MembershipOracle<I, D> firstOracle, MembershipOracle<I, D>... otherOracles) { return newDynamicParallelOracle(Lists.asList(firstOracle, otherOracles)); }
java
@Nonnull @SafeVarargs public static <I, D> DynamicParallelOracleBuilder<I, D> newDynamicParallelOracle(MembershipOracle<I, D> firstOracle, MembershipOracle<I, D>... otherOracles) { return newDynamicParallelOracle(Lists.asList(firstOracle, otherOracles)); }
[ "@", "Nonnull", "@", "SafeVarargs", "public", "static", "<", "I", ",", "D", ">", "DynamicParallelOracleBuilder", "<", "I", ",", "D", ">", "newDynamicParallelOracle", "(", "MembershipOracle", "<", "I", ",", "D", ">", "firstOracle", ",", "MembershipOracle", "<",...
Convenience method for {@link #newDynamicParallelOracle(Collection)}. @param firstOracle the first (mandatory) oracle @param otherOracles further (optional) oracles to be used by other threads @param <I> input symbol type @param <D> output domain type @return a preconfigured oracle builder
[ "Convenience", "method", "for", "{", "@link", "#newDynamicParallelOracle", "(", "Collection", ")", "}", "." ]
train
https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/oracles/parallelism/src/main/java/de/learnlib/oracle/parallelism/ParallelOracleBuilders.java#L103-L108
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/DB2JCCHelper.java
DB2JCCHelper.setClientInformationArray
@Override public void setClientInformationArray(String[] clientInfoArray, WSRdbManagedConnectionImpl mc, boolean explicitCall) throws SQLException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isDebugEnabled()) Tr.debug(this, tc, "setClientInformationArray", clientInfoArray, mc, explicitCall); //Note that the clientInfoArray will never be null // set the flag here even if the call fails, safer that way. if (explicitCall) mc.clientInfoExplicitlySet = true; else mc.clientInfoImplicitlySet = true; try { invokeOnDB2Connection(mc.sqlConn, setDB2ClientUser, "setDB2ClientUser", TYPES_String, clientInfoArray[0]); invokeOnDB2Connection(mc.sqlConn, setDB2ClientWorkstation, "setDB2ClientWorkstation", TYPES_String, clientInfoArray[1]); invokeOnDB2Connection(mc.sqlConn, setDB2ClientApplicationInformation, "setDB2ClientApplicationInformation", TYPES_String, clientInfoArray[2]); invokeOnDB2Connection(mc.sqlConn, setDB2ClientAccountingInformation, "setDB2ClientAccountingInformation", TYPES_String, clientInfoArray[3]); } catch (SQLException ex) { FFDCFilter.processException(ex, getClass().getName(), "611", this); if (isTraceOn && tc.isDebugEnabled()) Tr.debug(this, tc, "setClientInformationArray - Exception", ex); throw AdapterUtil.mapSQLException(ex, mc); } }
java
@Override public void setClientInformationArray(String[] clientInfoArray, WSRdbManagedConnectionImpl mc, boolean explicitCall) throws SQLException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isDebugEnabled()) Tr.debug(this, tc, "setClientInformationArray", clientInfoArray, mc, explicitCall); //Note that the clientInfoArray will never be null // set the flag here even if the call fails, safer that way. if (explicitCall) mc.clientInfoExplicitlySet = true; else mc.clientInfoImplicitlySet = true; try { invokeOnDB2Connection(mc.sqlConn, setDB2ClientUser, "setDB2ClientUser", TYPES_String, clientInfoArray[0]); invokeOnDB2Connection(mc.sqlConn, setDB2ClientWorkstation, "setDB2ClientWorkstation", TYPES_String, clientInfoArray[1]); invokeOnDB2Connection(mc.sqlConn, setDB2ClientApplicationInformation, "setDB2ClientApplicationInformation", TYPES_String, clientInfoArray[2]); invokeOnDB2Connection(mc.sqlConn, setDB2ClientAccountingInformation, "setDB2ClientAccountingInformation", TYPES_String, clientInfoArray[3]); } catch (SQLException ex) { FFDCFilter.processException(ex, getClass().getName(), "611", this); if (isTraceOn && tc.isDebugEnabled()) Tr.debug(this, tc, "setClientInformationArray - Exception", ex); throw AdapterUtil.mapSQLException(ex, mc); } }
[ "@", "Override", "public", "void", "setClientInformationArray", "(", "String", "[", "]", "clientInfoArray", ",", "WSRdbManagedConnectionImpl", "mc", ",", "boolean", "explicitCall", ")", "throws", "SQLException", "{", "final", "boolean", "isTraceOn", "=", "TraceCompone...
/* order of array is: 0- clientId, 1- workstationid, 2- applicationname, 3- accounInfo
[ "/", "*", "order", "of", "array", "is", ":", "0", "-", "clientId", "1", "-", "workstationid", "2", "-", "applicationname", "3", "-", "accounInfo" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/DB2JCCHelper.java#L425-L451
gosu-lang/gosu-lang
gosu-core/src/main/java/gw/internal/gosu/parser/BeanAccess.java
BeanAccess.getPropertyInfoDirectly_NoException
public static IPropertyInfo getPropertyInfoDirectly_NoException( IType classBean, String strProperty ) { return getPropertyInfo_NoException( classBean, classBean, strProperty, null, null, null ); }
java
public static IPropertyInfo getPropertyInfoDirectly_NoException( IType classBean, String strProperty ) { return getPropertyInfo_NoException( classBean, classBean, strProperty, null, null, null ); }
[ "public", "static", "IPropertyInfo", "getPropertyInfoDirectly_NoException", "(", "IType", "classBean", ",", "String", "strProperty", ")", "{", "return", "getPropertyInfo_NoException", "(", "classBean", ",", "classBean", ",", "strProperty", ",", "null", ",", "null", ",...
Resolves the property directly, as if the type were requesting it, giving access to all properties
[ "Resolves", "the", "property", "directly", "as", "if", "the", "type", "were", "requesting", "it", "giving", "access", "to", "all", "properties" ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/BeanAccess.java#L416-L419
threerings/narya
core/src/main/java/com/threerings/crowd/server/PlaceManager.java
PlaceManager.registerMessageHandler
@Deprecated public void registerMessageHandler (String name, MessageHandler handler) { // create our handler map if necessary if (_msghandlers == null) { _msghandlers = Maps.newHashMap(); } _msghandlers.put(name, handler); }
java
@Deprecated public void registerMessageHandler (String name, MessageHandler handler) { // create our handler map if necessary if (_msghandlers == null) { _msghandlers = Maps.newHashMap(); } _msghandlers.put(name, handler); }
[ "@", "Deprecated", "public", "void", "registerMessageHandler", "(", "String", "name", ",", "MessageHandler", "handler", ")", "{", "// create our handler map if necessary", "if", "(", "_msghandlers", "==", "null", ")", "{", "_msghandlers", "=", "Maps", ".", "newHashM...
Registers a particular message handler instance to be used when processing message events with the specified name. @param name the message name of the message events that should be handled by this handler. @param handler the handler to be registered. @deprecated Use dynamically bound methods instead. See {@link DynamicListener}.
[ "Registers", "a", "particular", "message", "handler", "instance", "to", "be", "used", "when", "processing", "message", "events", "with", "the", "specified", "name", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/server/PlaceManager.java#L361-L369
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/config/ConfigurationFactory.java
ConfigurationFactory.getConfig
public final Configuration getConfig(final File configFile, final InputStream configData) throws IOException { final Configuration configuration = this.context.getBean(Configuration.class); configuration.setConfigurationFile(configFile); MapfishPrintConstructor.setConfigurationUnderConstruction(configuration); final Configuration config = this.yaml.load(new InputStreamReader(configData, "UTF-8")); if (this.doValidation) { final List<Throwable> validate = config.validate(); if (!validate.isEmpty()) { StringBuilder errors = new StringBuilder(); for (Throwable throwable: validate) { errors.append("\n\t* ").append(throwable.getMessage()); LOGGER.error("Configuration Error found", throwable); } throw new Error(errors.toString(), validate.get(0)); } } return config; }
java
public final Configuration getConfig(final File configFile, final InputStream configData) throws IOException { final Configuration configuration = this.context.getBean(Configuration.class); configuration.setConfigurationFile(configFile); MapfishPrintConstructor.setConfigurationUnderConstruction(configuration); final Configuration config = this.yaml.load(new InputStreamReader(configData, "UTF-8")); if (this.doValidation) { final List<Throwable> validate = config.validate(); if (!validate.isEmpty()) { StringBuilder errors = new StringBuilder(); for (Throwable throwable: validate) { errors.append("\n\t* ").append(throwable.getMessage()); LOGGER.error("Configuration Error found", throwable); } throw new Error(errors.toString(), validate.get(0)); } } return config; }
[ "public", "final", "Configuration", "getConfig", "(", "final", "File", "configFile", ",", "final", "InputStream", "configData", ")", "throws", "IOException", "{", "final", "Configuration", "configuration", "=", "this", ".", "context", ".", "getBean", "(", "Configu...
Create a configuration object from a config file. @param configFile the file that contains the configuration data. @param configData the config file data
[ "Create", "a", "configuration", "object", "from", "a", "config", "file", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/config/ConfigurationFactory.java#L56-L76
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/subdoc/MutateInBuilder.java
MutateInBuilder.arrayPrependAll
public <T> MutateInBuilder arrayPrependAll(String path, Collection<T> values, SubdocOptionsBuilder optionsBuilder) { asyncBuilder.arrayPrependAll(path, values, optionsBuilder); return this; }
java
public <T> MutateInBuilder arrayPrependAll(String path, Collection<T> values, SubdocOptionsBuilder optionsBuilder) { asyncBuilder.arrayPrependAll(path, values, optionsBuilder); return this; }
[ "public", "<", "T", ">", "MutateInBuilder", "arrayPrependAll", "(", "String", "path", ",", "Collection", "<", "T", ">", "values", ",", "SubdocOptionsBuilder", "optionsBuilder", ")", "{", "asyncBuilder", ".", "arrayPrependAll", "(", "path", ",", "values", ",", ...
Prepend multiple values at once in an existing array, pushing all values in the collection's iteration order to the front/start of the array. First value becomes the first element of the array, second value the second, etc... All existing values are shifted right in the array, by the number of inserted elements. Each item in the collection is inserted as an individual element of the array, but a bit of overhead is saved compared to individual {@link #arrayPrepend(String, Object, boolean)} (String, Object)} by grouping mutations in a single packet. For example given an array [ A, B, C ], prepending the values X and Y yields [ X, Y, A, B, C ] and not [ [ X, Y ], A, B, C ]. @param path the path of the array. @param values the collection of values to insert at the front of the array as individual elements. @param optionsBuilder {@link SubdocOptionsBuilder} @param <T> the type of data in the collection (must be JSON serializable).
[ "Prepend", "multiple", "values", "at", "once", "in", "an", "existing", "array", "pushing", "all", "values", "in", "the", "collection", "s", "iteration", "order", "to", "the", "front", "/", "start", "of", "the", "array", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/MutateInBuilder.java#L770-L773
micronaut-projects/micronaut-core
runtime/src/main/java/io/micronaut/scheduling/cron/CronExpression.java
CronExpression.nextTimeAfter
public ZonedDateTime nextTimeAfter(ZonedDateTime afterTime, long durationInMillis) { return nextTimeAfter(afterTime, afterTime.plus(Duration.ofMillis(durationInMillis))); }
java
public ZonedDateTime nextTimeAfter(ZonedDateTime afterTime, long durationInMillis) { return nextTimeAfter(afterTime, afterTime.plus(Duration.ofMillis(durationInMillis))); }
[ "public", "ZonedDateTime", "nextTimeAfter", "(", "ZonedDateTime", "afterTime", ",", "long", "durationInMillis", ")", "{", "return", "nextTimeAfter", "(", "afterTime", ",", "afterTime", ".", "plus", "(", "Duration", ".", "ofMillis", "(", "durationInMillis", ")", ")...
This will search for the next time within the next durationInMillis millisecond. Be aware that the duration is specified in millis, but in fact the limit is checked on a day-to-day basis. @param afterTime A date-time with a time-zone in the ISO-8601 calendar system @param durationInMillis The maximum duration in millis after a given time @return The next time within given duration
[ "This", "will", "search", "for", "the", "next", "time", "within", "the", "next", "durationInMillis", "millisecond", ".", "Be", "aware", "that", "the", "duration", "is", "specified", "in", "millis", "but", "in", "fact", "the", "limit", "is", "checked", "on", ...
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/runtime/src/main/java/io/micronaut/scheduling/cron/CronExpression.java#L240-L242
apache/incubator-heron
heron/packing/src/java/org/apache/heron/packing/roundrobin/ResourceCompliantRRPacking.java
ResourceCompliantRRPacking.repack
@Override public PackingPlan repack(PackingPlan currentPackingPlan, Map<String, Integer> componentChanges) { this.numContainers = currentPackingPlan.getContainers().size(); resetToFirstContainer(); int additionalContainers = computeNumAdditionalContainers(componentChanges, currentPackingPlan); if (additionalContainers > 0) { increaseNumContainers(additionalContainers); LOG.info(String.format( "Allocated %s additional containers for repack bring the number of containers to %s.", additionalContainers, this.numContainers)); } while (true) { try { PackingPlanBuilder planBuilder = newPackingPlanBuilder(currentPackingPlan); planBuilder.updateNumContainers(numContainers); planBuilder = getResourceCompliantRRAllocation(planBuilder, componentChanges); return planBuilder.build(); } catch (ConstraintViolationException e) { //Not enough containers. Adjust the number of containers. LOG.info(String.format( "%s Increasing the number of containers to %s and attempting to repack again.", e.getMessage(), this.numContainers + 1)); retryWithAdditionalContainer(); } } }
java
@Override public PackingPlan repack(PackingPlan currentPackingPlan, Map<String, Integer> componentChanges) { this.numContainers = currentPackingPlan.getContainers().size(); resetToFirstContainer(); int additionalContainers = computeNumAdditionalContainers(componentChanges, currentPackingPlan); if (additionalContainers > 0) { increaseNumContainers(additionalContainers); LOG.info(String.format( "Allocated %s additional containers for repack bring the number of containers to %s.", additionalContainers, this.numContainers)); } while (true) { try { PackingPlanBuilder planBuilder = newPackingPlanBuilder(currentPackingPlan); planBuilder.updateNumContainers(numContainers); planBuilder = getResourceCompliantRRAllocation(planBuilder, componentChanges); return planBuilder.build(); } catch (ConstraintViolationException e) { //Not enough containers. Adjust the number of containers. LOG.info(String.format( "%s Increasing the number of containers to %s and attempting to repack again.", e.getMessage(), this.numContainers + 1)); retryWithAdditionalContainer(); } } }
[ "@", "Override", "public", "PackingPlan", "repack", "(", "PackingPlan", "currentPackingPlan", ",", "Map", "<", "String", ",", "Integer", ">", "componentChanges", ")", "{", "this", ".", "numContainers", "=", "currentPackingPlan", ".", "getContainers", "(", ")", "...
Get a new packing plan given an existing packing plan and component-level changes. @return new packing plan
[ "Get", "a", "new", "packing", "plan", "given", "an", "existing", "packing", "plan", "and", "component", "-", "level", "changes", "." ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/packing/src/java/org/apache/heron/packing/roundrobin/ResourceCompliantRRPacking.java#L153-L182
cybazeitalia/emaze-dysfunctional
src/main/java/net/emaze/dysfunctional/Reductions.java
Reductions.maximum
public static <E extends Comparable<E>> E maximum(Iterator<E> iterator, E init) { return Reductions.reduce(iterator, BinaryOperator.maxBy(new ComparableComparator<E>()), init); }
java
public static <E extends Comparable<E>> E maximum(Iterator<E> iterator, E init) { return Reductions.reduce(iterator, BinaryOperator.maxBy(new ComparableComparator<E>()), init); }
[ "public", "static", "<", "E", "extends", "Comparable", "<", "E", ">", ">", "E", "maximum", "(", "Iterator", "<", "E", ">", "iterator", ",", "E", "init", ")", "{", "return", "Reductions", ".", "reduce", "(", "iterator", ",", "BinaryOperator", ".", "maxB...
Returns the max element contained in the iterator @param <E> the iterator element type parameter @param iterator the iterator to be consumed @param init the initial value to be used @return the max element contained in the iterator
[ "Returns", "the", "max", "element", "contained", "in", "the", "iterator" ]
train
https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Reductions.java#L225-L227
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getPvPStatInfo
public void getPvPStatInfo(String api, Callback<PvPStat> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, api)); gw2API.getPvPStatInfo(api).enqueue(callback); }
java
public void getPvPStatInfo(String api, Callback<PvPStat> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, api)); gw2API.getPvPStatInfo(api).enqueue(callback); }
[ "public", "void", "getPvPStatInfo", "(", "String", "api", ",", "Callback", "<", "PvPStat", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", "(", "ParamType", ".", "API", ",", "ap...
For more info on pvp stat API go <a href="https://wiki.guildwars2.com/wiki/API:2/pvp/stats">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param api Guild Wars 2 API key @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws NullPointerException if given {@link Callback} is empty @throws GuildWars2Exception invalid api key @see PvPStat pvp stat info
[ "For", "more", "info", "on", "pvp", "stat", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "pvp", "/", "stats", ">", "here<", "/", "a", ">", "<br", "/", ">", ...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L2192-L2195
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/transform/WrappedSQLTransformation.java
WrappedSQLTransformation.generateReadValueFromCursor
@Override public void generateReadValueFromCursor(Builder methodBuilder, SQLiteDaoDefinition daoDefinition, TypeName paramTypeName, String cursorName, String indexName) { methodBuilder.addCode(READ_FROM_CURSOR, cursorName, indexName); }
java
@Override public void generateReadValueFromCursor(Builder methodBuilder, SQLiteDaoDefinition daoDefinition, TypeName paramTypeName, String cursorName, String indexName) { methodBuilder.addCode(READ_FROM_CURSOR, cursorName, indexName); }
[ "@", "Override", "public", "void", "generateReadValueFromCursor", "(", "Builder", "methodBuilder", ",", "SQLiteDaoDefinition", "daoDefinition", ",", "TypeName", "paramTypeName", ",", "String", "cursorName", ",", "String", "indexName", ")", "{", "methodBuilder", ".", "...
/* (non-Javadoc) @see com.abubusoft.kripton.processor.sqlite.transform.AbstractSQLTransform#generateReadValueFromCursor(com.squareup.javapoet.MethodSpec.Builder, com.abubusoft.kripton.processor.sqlite.model.SQLiteDaoDefinition, com.squareup.javapoet.TypeName, java.lang.String, java.lang.String)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/transform/WrappedSQLTransformation.java#L52-L55
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/DataDecoder.java
DataDecoder.decodeShortObj
public static Short decodeShortObj(byte[] src, int srcOffset) throws CorruptEncodingException { try { int b = src[srcOffset]; if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) { return null; } return decodeShort(src, srcOffset + 1); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
java
public static Short decodeShortObj(byte[] src, int srcOffset) throws CorruptEncodingException { try { int b = src[srcOffset]; if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) { return null; } return decodeShort(src, srcOffset + 1); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
[ "public", "static", "Short", "decodeShortObj", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ")", "throws", "CorruptEncodingException", "{", "try", "{", "int", "b", "=", "src", "[", "srcOffset", "]", ";", "if", "(", "b", "==", "NULL_BYTE_HIGH", ...
Decodes a signed Short object from exactly 1 or 3 bytes. If null is returned, then 1 byte was read. @param src source of encoded bytes @param srcOffset offset into source array @return signed Short object or null
[ "Decodes", "a", "signed", "Short", "object", "from", "exactly", "1", "or", "3", "bytes", ".", "If", "null", "is", "returned", "then", "1", "byte", "was", "read", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataDecoder.java#L192-L204
jcuda/jcusolver
JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverSp.java
JCusolverSp.cusolverSpScsrlsqvqrHost
public static int cusolverSpScsrlsqvqrHost( cusolverSpHandle handle, int m, int n, int nnz, cusparseMatDescr descrA, Pointer csrValA, Pointer csrRowPtrA, Pointer csrColIndA, Pointer b, float tol, Pointer rankA, Pointer x, Pointer p, Pointer min_norm) { return checkResult(cusolverSpScsrlsqvqrHostNative(handle, m, n, nnz, descrA, csrValA, csrRowPtrA, csrColIndA, b, tol, rankA, x, p, min_norm)); }
java
public static int cusolverSpScsrlsqvqrHost( cusolverSpHandle handle, int m, int n, int nnz, cusparseMatDescr descrA, Pointer csrValA, Pointer csrRowPtrA, Pointer csrColIndA, Pointer b, float tol, Pointer rankA, Pointer x, Pointer p, Pointer min_norm) { return checkResult(cusolverSpScsrlsqvqrHostNative(handle, m, n, nnz, descrA, csrValA, csrRowPtrA, csrColIndA, b, tol, rankA, x, p, min_norm)); }
[ "public", "static", "int", "cusolverSpScsrlsqvqrHost", "(", "cusolverSpHandle", "handle", ",", "int", "m", ",", "int", "n", ",", "int", "nnz", ",", "cusparseMatDescr", "descrA", ",", "Pointer", "csrValA", ",", "Pointer", "csrRowPtrA", ",", "Pointer", "csrColIndA...
<pre> ----------- CPU least square solver by QR factorization solve min|b - A*x| [lsq] stands for least square [v] stands for vector [qr] stands for QR factorization </pre>
[ "<pre", ">", "-----------", "CPU", "least", "square", "solver", "by", "QR", "factorization", "solve", "min|b", "-", "A", "*", "x|", "[", "lsq", "]", "stands", "for", "least", "square", "[", "v", "]", "stands", "for", "vector", "[", "qr", "]", "stands",...
train
https://github.com/jcuda/jcusolver/blob/2600c7eca36a92a60ebcc78cae6e028e0c1d00b9/JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverSp.java#L816-L833
code4everything/util
src/main/java/com/zhazhapan/util/NetUtils.java
NetUtils.addCookie
public static boolean addCookie(HttpServletResponse response, String name, String value) { return addCookie(new Cookie(name, value), response); }
java
public static boolean addCookie(HttpServletResponse response, String name, String value) { return addCookie(new Cookie(name, value), response); }
[ "public", "static", "boolean", "addCookie", "(", "HttpServletResponse", "response", ",", "String", "name", ",", "String", "value", ")", "{", "return", "addCookie", "(", "new", "Cookie", "(", "name", ",", "value", ")", ",", "response", ")", ";", "}" ]
添加Cookie @param response {@link HttpServletResponse} @param name Cookie名 @param value Cookie值 @return {@link Boolean} @since 1.0.8
[ "添加Cookie" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/NetUtils.java#L591-L593
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfDocument.java
PdfDocument.setAction
void setAction(PdfAction action, float llx, float lly, float urx, float ury) { addAnnotation(new PdfAnnotation(writer, llx, lly, urx, ury, action)); }
java
void setAction(PdfAction action, float llx, float lly, float urx, float ury) { addAnnotation(new PdfAnnotation(writer, llx, lly, urx, ury, action)); }
[ "void", "setAction", "(", "PdfAction", "action", ",", "float", "llx", ",", "float", "lly", ",", "float", "urx", ",", "float", "ury", ")", "{", "addAnnotation", "(", "new", "PdfAnnotation", "(", "writer", ",", "llx", ",", "lly", ",", "urx", ",", "ury", ...
Implements an action in an area. @param action the <CODE>PdfAction</CODE> @param llx the lower left x corner of the activation area @param lly the lower left y corner of the activation area @param urx the upper right x corner of the activation area @param ury the upper right y corner of the activation area
[ "Implements", "an", "action", "in", "an", "area", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfDocument.java#L2051-L2053
comapi/comapi-sdk-android
COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java
InternalService.initialiseSessionController
public SessionController initialiseSessionController(@NonNull SessionCreateManager sessionCreateManager, @NonNull PushManager pushMgr, @NonNull AtomicInteger state, @NonNull ComapiAuthenticator auth, @NonNull RestApi restApi, @NonNull Handler handler, boolean fcmEnabled, @NonNull final ISessionListener sessionListener) { sessionController = new SessionController(sessionCreateManager, pushMgr, state, dataMgr, auth, restApi, packageName, handler, log, getTaskQueue(), fcmEnabled, sessionListener); return sessionController; }
java
public SessionController initialiseSessionController(@NonNull SessionCreateManager sessionCreateManager, @NonNull PushManager pushMgr, @NonNull AtomicInteger state, @NonNull ComapiAuthenticator auth, @NonNull RestApi restApi, @NonNull Handler handler, boolean fcmEnabled, @NonNull final ISessionListener sessionListener) { sessionController = new SessionController(sessionCreateManager, pushMgr, state, dataMgr, auth, restApi, packageName, handler, log, getTaskQueue(), fcmEnabled, sessionListener); return sessionController; }
[ "public", "SessionController", "initialiseSessionController", "(", "@", "NonNull", "SessionCreateManager", "sessionCreateManager", ",", "@", "NonNull", "PushManager", "pushMgr", ",", "@", "NonNull", "AtomicInteger", "state", ",", "@", "NonNull", "ComapiAuthenticator", "au...
Initialise controller for creating and managing session. @param sessionCreateManager Manager for the process of creation of a new session @param pushMgr Push messaging manager. @param state SDK global state. @param auth ComapiImplementation calls authentication request callback @param restApi Rest API definitions. @param handler Main thread handler. @param fcmEnabled True if Firebase initialised and configured. @param sessionListener Listener for new sessions. @return Controller for creating and managing session.
[ "Initialise", "controller", "for", "creating", "and", "managing", "session", "." ]
train
https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L149-L159
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java
CommandFactory.addChangePlayerTypeCommand
public void addChangePlayerTypeCommand(String teamName, int unum, int playerType) { StringBuilder buf = new StringBuilder(); buf.append("(change_player_type "); buf.append(teamName); buf.append(' '); buf.append(unum); buf.append(' '); buf.append(playerType); buf.append(')'); fifo.add(fifo.size(), buf.toString()); }
java
public void addChangePlayerTypeCommand(String teamName, int unum, int playerType) { StringBuilder buf = new StringBuilder(); buf.append("(change_player_type "); buf.append(teamName); buf.append(' '); buf.append(unum); buf.append(' '); buf.append(playerType); buf.append(')'); fifo.add(fifo.size(), buf.toString()); }
[ "public", "void", "addChangePlayerTypeCommand", "(", "String", "teamName", ",", "int", "unum", ",", "int", "playerType", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "buf", ".", "append", "(", "\"(change_player_type \"", ")", "...
Trainer only command. This command changes the specified players heterogeneous type. @param teamName The name of the team the player belongs to. @param unum The players uniform number (1~11 on pitch usually, subs <= 14). @param playerType A player type between 0 (the standard player) and 18. However, player.conf can change this.
[ "Trainer", "only", "command", ".", "This", "command", "changes", "the", "specified", "players", "heterogeneous", "type", "." ]
train
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java#L384-L394
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/InitDateOffsetHandler.java
InitDateOffsetHandler.init
public void init(BaseField field, BaseField fldSource, DateTimeField fldStartDate, int lYears, int lMonths, int lDays, boolean bCalcIfNull) { super.init(field, fldSource, null, true, false); m_lYears = lYears; m_lMonths = lMonths; m_lDays = lDays; m_fldStartDate = fldStartDate; m_bCalcIfNull = bCalcIfNull; }
java
public void init(BaseField field, BaseField fldSource, DateTimeField fldStartDate, int lYears, int lMonths, int lDays, boolean bCalcIfNull) { super.init(field, fldSource, null, true, false); m_lYears = lYears; m_lMonths = lMonths; m_lDays = lDays; m_fldStartDate = fldStartDate; m_bCalcIfNull = bCalcIfNull; }
[ "public", "void", "init", "(", "BaseField", "field", ",", "BaseField", "fldSource", ",", "DateTimeField", "fldStartDate", ",", "int", "lYears", ",", "int", "lMonths", ",", "int", "lDays", ",", "boolean", "bCalcIfNull", ")", "{", "super", ".", "init", "(", ...
Constructor. @param field The basefield owner of this listener (usually null and set on setOwner()). @param fldSource The field with the source number of days to use as an offset. @param lYears Offset by this number of years. @param lMonths Offset by this number of months. @param lDays Offset by this number of days.
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/InitDateOffsetHandler.java#L88-L96
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/repo/map/Key.java
Key.callSetPropertyValue
private static void callSetPropertyValue(CodeBuilder b, OrderedProperty<?> op) { StorableProperty<?> property = op.getChainedProperty().getLastProperty(); TypeDesc propType = TypeDesc.forClass(property.getType()); if (propType != TypeDesc.OBJECT) { TypeDesc objectType = propType.toObjectType(); b.checkCast(objectType); // Potentially unbox primitive. b.convert(objectType, propType); } b.invoke(property.getWriteMethod()); }
java
private static void callSetPropertyValue(CodeBuilder b, OrderedProperty<?> op) { StorableProperty<?> property = op.getChainedProperty().getLastProperty(); TypeDesc propType = TypeDesc.forClass(property.getType()); if (propType != TypeDesc.OBJECT) { TypeDesc objectType = propType.toObjectType(); b.checkCast(objectType); // Potentially unbox primitive. b.convert(objectType, propType); } b.invoke(property.getWriteMethod()); }
[ "private", "static", "void", "callSetPropertyValue", "(", "CodeBuilder", "b", ",", "OrderedProperty", "<", "?", ">", "op", ")", "{", "StorableProperty", "<", "?", ">", "property", "=", "op", ".", "getChainedProperty", "(", ")", ".", "getLastProperty", "(", "...
Creates code to call set method. Assumes Storable and property value are already on the stack.
[ "Creates", "code", "to", "call", "set", "method", ".", "Assumes", "Storable", "and", "property", "value", "are", "already", "on", "the", "stack", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/repo/map/Key.java#L257-L267
qiujuer/Genius-Android
caprice/ui/src/main/java/net/qiujuer/genius/ui/compat/UiCompat.java
UiCompat.setHotspotBounds
public static void setHotspotBounds(Drawable drawable, int left, int top, int right, int bottom) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { //We don't want the full size rect, Lollipop ripple would be too big int size = (right - left) / 8; drawable.setHotspotBounds(left + size, top + size, right - size, bottom - size); } else { drawable.setBounds(left, top, right, bottom); } }
java
public static void setHotspotBounds(Drawable drawable, int left, int top, int right, int bottom) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { //We don't want the full size rect, Lollipop ripple would be too big int size = (right - left) / 8; drawable.setHotspotBounds(left + size, top + size, right - size, bottom - size); } else { drawable.setBounds(left, top, right, bottom); } }
[ "public", "static", "void", "setHotspotBounds", "(", "Drawable", "drawable", ",", "int", "left", ",", "int", "top", ",", "int", "right", ",", "int", "bottom", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION_CODE...
As our DiscreteSeekBar implementation uses a circular drawable on API < 21 we want to use the same method to set its bounds as the Ripple's hotspot bounds. @param drawable Drawable @param left Left @param top Top @param right Right @param bottom Bottom
[ "As", "our", "DiscreteSeekBar", "implementation", "uses", "a", "circular", "drawable", "on", "API", "<", "21", "we", "want", "to", "use", "the", "same", "method", "to", "set", "its", "bounds", "as", "the", "Ripple", "s", "hotspot", "bounds", "." ]
train
https://github.com/qiujuer/Genius-Android/blob/babefaf1321f5883a21cada582b6fa5104adc648/caprice/ui/src/main/java/net/qiujuer/genius/ui/compat/UiCompat.java#L60-L68
sebastiangraf/treetank
interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/PipelineBuilder.java
PipelineBuilder.addIntExcExpression
public void addIntExcExpression(final INodeReadTrx mTransaction, final boolean mIsIntersect) { assert getPipeStack().size() >= 2; final INodeReadTrx rtx = mTransaction; final AbsAxis mOperand2 = getPipeStack().pop().getExpr(); final AbsAxis mOperand1 = getPipeStack().pop().getExpr(); final AbsAxis axis = mIsIntersect ? new IntersectAxis(rtx, mOperand1, mOperand2) : new ExceptAxis(rtx, mOperand1, mOperand2); if (getPipeStack().empty() || getExpression().getSize() != 0) { addExpressionSingle(); } getExpression().add(axis); }
java
public void addIntExcExpression(final INodeReadTrx mTransaction, final boolean mIsIntersect) { assert getPipeStack().size() >= 2; final INodeReadTrx rtx = mTransaction; final AbsAxis mOperand2 = getPipeStack().pop().getExpr(); final AbsAxis mOperand1 = getPipeStack().pop().getExpr(); final AbsAxis axis = mIsIntersect ? new IntersectAxis(rtx, mOperand1, mOperand2) : new ExceptAxis(rtx, mOperand1, mOperand2); if (getPipeStack().empty() || getExpression().getSize() != 0) { addExpressionSingle(); } getExpression().add(axis); }
[ "public", "void", "addIntExcExpression", "(", "final", "INodeReadTrx", "mTransaction", ",", "final", "boolean", "mIsIntersect", ")", "{", "assert", "getPipeStack", "(", ")", ".", "size", "(", ")", ">=", "2", ";", "final", "INodeReadTrx", "rtx", "=", "mTransact...
Adds a intersect or a exception expression to the pipeline. @param mTransaction Transaction to operate with. @param mIsIntersect true, if expression is an intersection
[ "Adds", "a", "intersect", "or", "a", "exception", "expression", "to", "the", "pipeline", "." ]
train
https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/PipelineBuilder.java#L458-L475
mgledi/DRUMS
src/main/java/com/unister/semweb/drums/api/DRUMSInstantiator.java
DRUMSInstantiator.forceCreateTable
public static <Data extends AbstractKVStorable> DRUMS<Data> forceCreateTable(AbstractHashFunction hashFunction, DRUMSParameterSet<Data> gp) throws IOException { File databaseDirectoryFile = new File(gp.DATABASE_DIRECTORY); databaseDirectoryFile.delete(); return createTable(hashFunction, gp); }
java
public static <Data extends AbstractKVStorable> DRUMS<Data> forceCreateTable(AbstractHashFunction hashFunction, DRUMSParameterSet<Data> gp) throws IOException { File databaseDirectoryFile = new File(gp.DATABASE_DIRECTORY); databaseDirectoryFile.delete(); return createTable(hashFunction, gp); }
[ "public", "static", "<", "Data", "extends", "AbstractKVStorable", ">", "DRUMS", "<", "Data", ">", "forceCreateTable", "(", "AbstractHashFunction", "hashFunction", ",", "DRUMSParameterSet", "<", "Data", ">", "gp", ")", "throws", "IOException", "{", "File", "databas...
This method creates a new {@link DRUMS} object. The old {@link DRUMS} will be overwritten. <br/> If the given directory doesn't exist, it will be created.<br/> @param hashFunction the hash function, decides where to store/search elements @param gp pointer to the {@link DRUMSParameterSet} used by the {@link DRUMS} to open @throws IOException if an error occurs while writing the configuration file @return new {@link DRUMS}-object
[ "This", "method", "creates", "a", "new", "{", "@link", "DRUMS", "}", "object", ".", "The", "old", "{", "@link", "DRUMS", "}", "will", "be", "overwritten", ".", "<br", "/", ">", "If", "the", "given", "directory", "doesn", "t", "exist", "it", "will", "...
train
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/api/DRUMSInstantiator.java#L85-L91
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.addExplicitListItemAsync
public Observable<Integer> addExplicitListItemAsync(UUID appId, String versionId, UUID entityId, AddExplicitListItemOptionalParameter addExplicitListItemOptionalParameter) { return addExplicitListItemWithServiceResponseAsync(appId, versionId, entityId, addExplicitListItemOptionalParameter).map(new Func1<ServiceResponse<Integer>, Integer>() { @Override public Integer call(ServiceResponse<Integer> response) { return response.body(); } }); }
java
public Observable<Integer> addExplicitListItemAsync(UUID appId, String versionId, UUID entityId, AddExplicitListItemOptionalParameter addExplicitListItemOptionalParameter) { return addExplicitListItemWithServiceResponseAsync(appId, versionId, entityId, addExplicitListItemOptionalParameter).map(new Func1<ServiceResponse<Integer>, Integer>() { @Override public Integer call(ServiceResponse<Integer> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Integer", ">", "addExplicitListItemAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ",", "AddExplicitListItemOptionalParameter", "addExplicitListItemOptionalParameter", ")", "{", "return", "addExplicitListItemW...
Add a new item to the explicit list for the Pattern.Any entity. @param appId The application ID. @param versionId The version ID. @param entityId The Pattern.Any entity extractor ID. @param addExplicitListItemOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the Integer object
[ "Add", "a", "new", "item", "to", "the", "explicit", "list", "for", "the", "Pattern", ".", "Any", "entity", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L10021-L10028
infinispan/infinispan
lucene/lucene-directory/src/main/java/org/infinispan/lucene/cacheloader/DirectoryLoaderAdaptor.java
DirectoryLoaderAdaptor.figureChunksNumber
private int figureChunksNumber(String fileName) throws IOException { long fileLength = directory.fileLength(fileName); return figureChunksNumber(fileName, fileLength, autoChunkSize); }
java
private int figureChunksNumber(String fileName) throws IOException { long fileLength = directory.fileLength(fileName); return figureChunksNumber(fileName, fileLength, autoChunkSize); }
[ "private", "int", "figureChunksNumber", "(", "String", "fileName", ")", "throws", "IOException", "{", "long", "fileLength", "=", "directory", ".", "fileLength", "(", "fileName", ")", ";", "return", "figureChunksNumber", "(", "fileName", ",", "fileLength", ",", "...
Guess in how many chunks we should split this file. Should return the same value consistently for the same file (segments are immutable) so that a full segment can be rebuilt from the upper layers without anyone actually specifying the chunks numbers.
[ "Guess", "in", "how", "many", "chunks", "we", "should", "split", "this", "file", ".", "Should", "return", "the", "same", "value", "consistently", "for", "the", "same", "file", "(", "segments", "are", "immutable", ")", "so", "that", "a", "full", "segment", ...
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/lucene-directory/src/main/java/org/infinispan/lucene/cacheloader/DirectoryLoaderAdaptor.java#L137-L140
lucee/Lucee
core/src/main/java/lucee/runtime/text/xml/XMLCaster.java
XMLCaster.toHTML
public static String toHTML(Node node) throws ExpressionException { if (Node.DOCUMENT_NODE == node.getNodeType()) return toHTML(XMLUtil.getRootElement(node, true)); StringBuilder sb = new StringBuilder(); toHTML(node, sb); return sb.toString(); }
java
public static String toHTML(Node node) throws ExpressionException { if (Node.DOCUMENT_NODE == node.getNodeType()) return toHTML(XMLUtil.getRootElement(node, true)); StringBuilder sb = new StringBuilder(); toHTML(node, sb); return sb.toString(); }
[ "public", "static", "String", "toHTML", "(", "Node", "node", ")", "throws", "ExpressionException", "{", "if", "(", "Node", ".", "DOCUMENT_NODE", "==", "node", ".", "getNodeType", "(", ")", ")", "return", "toHTML", "(", "XMLUtil", ".", "getRootElement", "(", ...
/* * cast a xml node to a String @param node @return xml node as String @throws ExpressionException / public static String toString(Node node) throws ExpressionException { //Transformer tf; try { OutputFormat format = new OutputFormat(); StringWriter writer = new StringWriter(); XMLSerializer serializer = new XMLSerializer(writer, format); if(node instanceof Element)serializer.serialize((Element)node); else serializer.serialize(XMLUtil.getDocument(node)); return writer.toString(); } catch (Exception e) { throw ExpressionException.newInstance(e); } } public static String toString(Node node,String defaultValue) { //Transformer tf; try { OutputFormat format = new OutputFormat(); StringWriter writer = new StringWriter(); XMLSerializer serializer = new XMLSerializer(writer, format); if(node instanceof Element)serializer.serialize((Element)node); else serializer.serialize(XMLUtil.getDocument(node)); return writer.toString(); } catch (Exception e) { return defaultValue; } }
[ "/", "*", "*", "cast", "a", "xml", "node", "to", "a", "String" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/text/xml/XMLCaster.java#L461-L467
lets-blade/blade
src/main/java/com/blade/kit/StringKit.java
StringKit.isNotBlankThen
public static void isNotBlankThen(String str, Consumer<String> consumer) { notBankAccept(str, Function.identity(), consumer); }
java
public static void isNotBlankThen(String str, Consumer<String> consumer) { notBankAccept(str, Function.identity(), consumer); }
[ "public", "static", "void", "isNotBlankThen", "(", "String", "str", ",", "Consumer", "<", "String", ">", "consumer", ")", "{", "notBankAccept", "(", "str", ",", "Function", ".", "identity", "(", ")", ",", "consumer", ")", ";", "}" ]
Execute consumer when the string is not empty @param str string value @param consumer consumer
[ "Execute", "consumer", "when", "the", "string", "is", "not", "empty" ]
train
https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/StringKit.java#L77-L79
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/LinearEquationSystem.java
LinearEquationSystem.permutePivot
private void permutePivot(IntIntPair pos1, IntIntPair pos2) { int r1 = pos1.first; int c1 = pos1.second; int r2 = pos2.first; int c2 = pos2.second; int index; index = row[r2]; row[r2] = row[r1]; row[r1] = index; index = col[c2]; col[c2] = col[c1]; col[c1] = index; }
java
private void permutePivot(IntIntPair pos1, IntIntPair pos2) { int r1 = pos1.first; int c1 = pos1.second; int r2 = pos2.first; int c2 = pos2.second; int index; index = row[r2]; row[r2] = row[r1]; row[r1] = index; index = col[c2]; col[c2] = col[c1]; col[c1] = index; }
[ "private", "void", "permutePivot", "(", "IntIntPair", "pos1", ",", "IntIntPair", "pos2", ")", "{", "int", "r1", "=", "pos1", ".", "first", ";", "int", "c1", "=", "pos1", ".", "second", ";", "int", "r2", "=", "pos2", ".", "first", ";", "int", "c2", ...
permutes two matrix rows and two matrix columns @param pos1 the fist position for the permutation @param pos2 the second position for the permutation
[ "permutes", "two", "matrix", "rows", "and", "two", "matrix", "columns" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/LinearEquationSystem.java#L526-L538
fhussonnois/storm-trident-elasticsearch
src/main/java/com/github/fhuss/storm/elasticsearch/mapper/impl/DefaultTupleMapper.java
DefaultTupleMapper.newBinaryDefaultTupleMapper
public static final DefaultTupleMapper newBinaryDefaultTupleMapper( ) { return new DefaultTupleMapper(new TupleMapper<String>() { @Override public String map(Tuple input) { try { return new String(input.getBinaryByField(FIELD_SOURCE), "UTF-8"); } catch (UnsupportedEncodingException e) { throw new MappingException("Error while processing source as a byte[]", e); } } }); }
java
public static final DefaultTupleMapper newBinaryDefaultTupleMapper( ) { return new DefaultTupleMapper(new TupleMapper<String>() { @Override public String map(Tuple input) { try { return new String(input.getBinaryByField(FIELD_SOURCE), "UTF-8"); } catch (UnsupportedEncodingException e) { throw new MappingException("Error while processing source as a byte[]", e); } } }); }
[ "public", "static", "final", "DefaultTupleMapper", "newBinaryDefaultTupleMapper", "(", ")", "{", "return", "new", "DefaultTupleMapper", "(", "new", "TupleMapper", "<", "String", ">", "(", ")", "{", "@", "Override", "public", "String", "map", "(", "Tuple", "input...
Returns a new {@link DefaultTupleMapper} that accept Byte[] as source field value.
[ "Returns", "a", "new", "{" ]
train
https://github.com/fhussonnois/storm-trident-elasticsearch/blob/1788157efff223800a92f17f79deb02c905230f7/src/main/java/com/github/fhuss/storm/elasticsearch/mapper/impl/DefaultTupleMapper.java#L63-L74
code4everything/util
src/main/java/com/zhazhapan/util/Checker.java
Checker.startsWith
public static boolean startsWith(String value, String... prefixes) { if (isNotEmpty(value) && isNotEmpty(prefixes)) { for (String prefix : prefixes) { if (value.startsWith(prefix)) { return true; } } } return false; }
java
public static boolean startsWith(String value, String... prefixes) { if (isNotEmpty(value) && isNotEmpty(prefixes)) { for (String prefix : prefixes) { if (value.startsWith(prefix)) { return true; } } } return false; }
[ "public", "static", "boolean", "startsWith", "(", "String", "value", ",", "String", "...", "prefixes", ")", "{", "if", "(", "isNotEmpty", "(", "value", ")", "&&", "isNotEmpty", "(", "prefixes", ")", ")", "{", "for", "(", "String", "prefix", ":", "prefixe...
检查字符串是否以某个前缀开头 @param value 字符串 @param prefixes 前缀 @return {@link Boolean} @since 1.1.0
[ "检查字符串是否以某个前缀开头" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/Checker.java#L111-L120
couchbase/java-dcp-client
src/main/java/com/couchbase/client/dcp/buffer/StreamEventBuffer.java
StreamEventBuffer.onSeqnoPersisted
void onSeqnoPersisted(final short vbucket, final long seqno) { final Queue<BufferedEvent> queue = partitionQueues.get(vbucket); synchronized (queue) { // while the head of the queue has a seqno <= the given seqno while (!queue.isEmpty() && Long.compareUnsigned(queue.peek().seqno, seqno) < 1) { final BufferedEvent event = queue.poll(); try { switch (event.type) { case DATA: // mutation, deletion, expiration dataEventHandler.onEvent(event.flowController, event.event); break; case CONTROL: // snapshot controlEventHandler.onEvent(event.flowController, event.event); break; case STREAM_END_OK: eventBus.publish(new StreamEndEvent(vbucket, StreamEndReason.OK)); break; default: throw new RuntimeException("Unexpected event type: " + event.type); } } catch (Throwable t) { LOGGER.error("Event handler threw exception", t); } } } }
java
void onSeqnoPersisted(final short vbucket, final long seqno) { final Queue<BufferedEvent> queue = partitionQueues.get(vbucket); synchronized (queue) { // while the head of the queue has a seqno <= the given seqno while (!queue.isEmpty() && Long.compareUnsigned(queue.peek().seqno, seqno) < 1) { final BufferedEvent event = queue.poll(); try { switch (event.type) { case DATA: // mutation, deletion, expiration dataEventHandler.onEvent(event.flowController, event.event); break; case CONTROL: // snapshot controlEventHandler.onEvent(event.flowController, event.event); break; case STREAM_END_OK: eventBus.publish(new StreamEndEvent(vbucket, StreamEndReason.OK)); break; default: throw new RuntimeException("Unexpected event type: " + event.type); } } catch (Throwable t) { LOGGER.error("Event handler threw exception", t); } } } }
[ "void", "onSeqnoPersisted", "(", "final", "short", "vbucket", ",", "final", "long", "seqno", ")", "{", "final", "Queue", "<", "BufferedEvent", ">", "queue", "=", "partitionQueues", ".", "get", "(", "vbucket", ")", ";", "synchronized", "(", "queue", ")", "{...
Send to the wrapped handler all events with sequence numbers <= the given sequence number.
[ "Send", "to", "the", "wrapped", "handler", "all", "events", "with", "sequence", "numbers", "<", "=", "the", "given", "sequence", "number", "." ]
train
https://github.com/couchbase/java-dcp-client/blob/75359d8c081d6c575f8087cf7c28d24ab24c6421/src/main/java/com/couchbase/client/dcp/buffer/StreamEventBuffer.java#L216-L247
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.loginUser
public String loginUser(String username, String password, String remoteAddress) throws CmsException { // login the user CmsUser newUser = m_securityManager.loginUser(m_context, username, password, remoteAddress); // set the project back to the "Online" project CmsProject newProject = m_securityManager.readProject(CmsProject.ONLINE_PROJECT_ID); // switch the cms context to the new user and project m_context.switchUser(newUser, newProject, newUser.getOuFqn()); // init this CmsObject with the new user init(m_securityManager, m_context); // fire a login event fireEvent(I_CmsEventListener.EVENT_LOGIN_USER, newUser); // return the users login name return newUser.getName(); }
java
public String loginUser(String username, String password, String remoteAddress) throws CmsException { // login the user CmsUser newUser = m_securityManager.loginUser(m_context, username, password, remoteAddress); // set the project back to the "Online" project CmsProject newProject = m_securityManager.readProject(CmsProject.ONLINE_PROJECT_ID); // switch the cms context to the new user and project m_context.switchUser(newUser, newProject, newUser.getOuFqn()); // init this CmsObject with the new user init(m_securityManager, m_context); // fire a login event fireEvent(I_CmsEventListener.EVENT_LOGIN_USER, newUser); // return the users login name return newUser.getName(); }
[ "public", "String", "loginUser", "(", "String", "username", ",", "String", "password", ",", "String", "remoteAddress", ")", "throws", "CmsException", "{", "// login the user", "CmsUser", "newUser", "=", "m_securityManager", ".", "loginUser", "(", "m_context", ",", ...
Logs a user with a given ip address into the Cms, if the password is correct.<p> @param username the name of the user @param password the password of the user @param remoteAddress the ip address @return the name of the logged in user @throws CmsException if the login was not successful
[ "Logs", "a", "user", "with", "a", "given", "ip", "address", "into", "the", "Cms", "if", "the", "password", "is", "correct", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L2186-L2200
dlemmermann/CalendarFX
CalendarFXView/src/main/java/com/calendarfx/view/DateControl.java
DateControl.showDateDetails
public void showDateDetails(Node owner, LocalDate date) { maybeHidePopOvers(); datePopOver = new DatePopOver(this, date); datePopOver.show(owner); }
java
public void showDateDetails(Node owner, LocalDate date) { maybeHidePopOvers(); datePopOver = new DatePopOver(this, date); datePopOver.show(owner); }
[ "public", "void", "showDateDetails", "(", "Node", "owner", ",", "LocalDate", "date", ")", "{", "maybeHidePopOvers", "(", ")", ";", "datePopOver", "=", "new", "DatePopOver", "(", "this", ",", "date", ")", ";", "datePopOver", ".", "show", "(", "owner", ")", ...
Creates a new {@link DatePopOver} and shows it attached to the given owner node. @param owner the owner node @param date the date for which to display more detail
[ "Creates", "a", "new", "{", "@link", "DatePopOver", "}", "and", "shows", "it", "attached", "to", "the", "given", "owner", "node", "." ]
train
https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/view/DateControl.java#L714-L718
eclipse/hawkbit
hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/tenantconfiguration/polling/DurationField.java
DurationField.compareTimeOfDates
private int compareTimeOfDates(final Date d1, final Date d2) { final LocalTime lt1 = LocalDateTime.ofInstant(d1.toInstant(), ZONEID_UTC).toLocalTime(); final LocalTime lt2 = LocalDateTime.ofInstant(d2.toInstant(), ZONEID_UTC).toLocalTime(); return lt1.compareTo(lt2); }
java
private int compareTimeOfDates(final Date d1, final Date d2) { final LocalTime lt1 = LocalDateTime.ofInstant(d1.toInstant(), ZONEID_UTC).toLocalTime(); final LocalTime lt2 = LocalDateTime.ofInstant(d2.toInstant(), ZONEID_UTC).toLocalTime(); return lt1.compareTo(lt2); }
[ "private", "int", "compareTimeOfDates", "(", "final", "Date", "d1", ",", "final", "Date", "d2", ")", "{", "final", "LocalTime", "lt1", "=", "LocalDateTime", ".", "ofInstant", "(", "d1", ".", "toInstant", "(", ")", ",", "ZONEID_UTC", ")", ".", "toLocalTime"...
Because parsing done by base class returns a different date than parsing done by the user or converting duration to a date. But for the DurationField comparison only the time is important. This function helps comparing the time and ignores the values for day, month and year. @param d1 date, which time will compared with the time of d2 @param d2 date, which time will compared with the time of d1 @return the value 0 if the time represented d1 is equal to the time represented by d2; a value less than 0 if the time of d1 is before the time of d2; and a value greater than 0 if the time of d1 is after the time represented by d2.
[ "Because", "parsing", "done", "by", "base", "class", "returns", "a", "different", "date", "than", "parsing", "done", "by", "the", "user", "or", "converting", "duration", "to", "a", "date", ".", "But", "for", "the", "DurationField", "comparison", "only", "the...
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/tenantconfiguration/polling/DurationField.java#L222-L227
synchronoss/cpo-api
cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java
JdbcCpoXaAdapter.updateObject
@Override public <T> long updateObject(String name, T obj) throws CpoException { return getCurrentResource().updateObject(name, obj); }
java
@Override public <T> long updateObject(String name, T obj) throws CpoException { return getCurrentResource().updateObject(name, obj); }
[ "@", "Override", "public", "<", "T", ">", "long", "updateObject", "(", "String", "name", ",", "T", "obj", ")", "throws", "CpoException", "{", "return", "getCurrentResource", "(", ")", ".", "updateObject", "(", "name", ",", "obj", ")", ";", "}" ]
Update the Object in the datasource. The CpoAdapter will check to see if the object exists in the datasource. If it exists then the object will be updated. If it does not exist, an exception will be thrown <p> <pre>Example: <code> <p> class SomeObject so = new SomeObject(); class CpoAdapter cpo = null; <p> try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; } <p> if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ cpo.updateObject("updateSomeObject",so); } catch (CpoException ce) { // Handle the error } } </code> </pre> @param name The String name of the UPDATE Function Group that will be used to create the object in the datasource. null signifies that the default rules will be used. @param obj This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. @return The number of objects updated in the datasource @throws CpoException Thrown if there are errors accessing the datasource
[ "Update", "the", "Object", "in", "the", "datasource", ".", "The", "CpoAdapter", "will", "check", "to", "see", "if", "the", "object", "exists", "in", "the", "datasource", ".", "If", "it", "exists", "then", "the", "object", "will", "be", "updated", ".", "I...
train
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java#L1624-L1627
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/i18n/list/HeaderContentListPanel.java
HeaderContentListPanel.newListPanel
protected Component newListPanel(final String id, final IModel<ContentListModelBean> model) { return new ResourceBundleKeysPanel(id, model.getObject().getContentResourceKeys()) { private static final long serialVersionUID = 1L; @Override protected Component newListComponent(final String id, final ListItem<ResourceBundleKey> item) { return HeaderContentListPanel.this.newListComponent(id, item); } }; }
java
protected Component newListPanel(final String id, final IModel<ContentListModelBean> model) { return new ResourceBundleKeysPanel(id, model.getObject().getContentResourceKeys()) { private static final long serialVersionUID = 1L; @Override protected Component newListComponent(final String id, final ListItem<ResourceBundleKey> item) { return HeaderContentListPanel.this.newListComponent(id, item); } }; }
[ "protected", "Component", "newListPanel", "(", "final", "String", "id", ",", "final", "IModel", "<", "ContentListModelBean", ">", "model", ")", "{", "return", "new", "ResourceBundleKeysPanel", "(", "id", ",", "model", ".", "getObject", "(", ")", ".", "getConte...
Factory method for creating the new {@link Component} for the list panel. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a new {@link Component} for the list panel. @param id the id @param model the model @return the new {@link Component} for the list panel.
[ "Factory", "method", "for", "creating", "the", "new", "{", "@link", "Component", "}", "for", "the", "list", "panel", ".", "This", "method", "is", "invoked", "in", "the", "constructor", "from", "the", "derived", "classes", "and", "can", "be", "overridden", ...
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/i18n/list/HeaderContentListPanel.java#L147-L161
aws/aws-sdk-java
aws-java-sdk-robomaker/src/main/java/com/amazonaws/services/robomaker/model/LaunchConfig.java
LaunchConfig.withEnvironmentVariables
public LaunchConfig withEnvironmentVariables(java.util.Map<String, String> environmentVariables) { setEnvironmentVariables(environmentVariables); return this; }
java
public LaunchConfig withEnvironmentVariables(java.util.Map<String, String> environmentVariables) { setEnvironmentVariables(environmentVariables); return this; }
[ "public", "LaunchConfig", "withEnvironmentVariables", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "environmentVariables", ")", "{", "setEnvironmentVariables", "(", "environmentVariables", ")", ";", "return", "this", ";", "}" ]
<p> The environment variables for the application launch. </p> @param environmentVariables The environment variables for the application launch. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "environment", "variables", "for", "the", "application", "launch", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-robomaker/src/main/java/com/amazonaws/services/robomaker/model/LaunchConfig.java#L165-L168
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/VertexLabel.java
VertexLabel.removeEdgeRole
void removeEdgeRole(EdgeRole er, boolean preserveData) { if (er.getVertexLabel() != this) { throw new IllegalStateException("Trying to remove a EdgeRole from a non owner VertexLabel"); } Collection<VertexLabel> ers; switch (er.getDirection()) { // we don't support both case BOTH: throw new IllegalStateException("BOTH is not a supported direction"); case IN: ers = er.getEdgeLabel().getInVertexLabels(); break; case OUT: ers = er.getEdgeLabel().getOutVertexLabels(); break; default: throw new IllegalStateException("Unknown direction!"); } if (!ers.contains(this)) { throw new IllegalStateException("Trying to remove a EdgeRole from a non owner VertexLabel"); } // the edge had only this vertex on that direction, remove the edge if (ers.size() == 1) { er.getEdgeLabel().remove(preserveData); } else { getSchema().getTopology().lock(); switch (er.getDirection()) { // we don't support both case BOTH: throw new IllegalStateException("BOTH is not a supported direction"); case IN: uncommittedRemovedInEdgeLabels.put(er.getEdgeLabel().getFullName(), EdgeRemoveType.ROLE); er.getEdgeLabel().removeInVertexLabel(this, preserveData); break; case OUT: uncommittedRemovedOutEdgeLabels.put(er.getEdgeLabel().getFullName(), EdgeRemoveType.ROLE); er.getEdgeLabel().removeOutVertexLabel(this, preserveData); break; } this.getSchema().getTopology().fire(er, "", TopologyChangeAction.DELETE); } }
java
void removeEdgeRole(EdgeRole er, boolean preserveData) { if (er.getVertexLabel() != this) { throw new IllegalStateException("Trying to remove a EdgeRole from a non owner VertexLabel"); } Collection<VertexLabel> ers; switch (er.getDirection()) { // we don't support both case BOTH: throw new IllegalStateException("BOTH is not a supported direction"); case IN: ers = er.getEdgeLabel().getInVertexLabels(); break; case OUT: ers = er.getEdgeLabel().getOutVertexLabels(); break; default: throw new IllegalStateException("Unknown direction!"); } if (!ers.contains(this)) { throw new IllegalStateException("Trying to remove a EdgeRole from a non owner VertexLabel"); } // the edge had only this vertex on that direction, remove the edge if (ers.size() == 1) { er.getEdgeLabel().remove(preserveData); } else { getSchema().getTopology().lock(); switch (er.getDirection()) { // we don't support both case BOTH: throw new IllegalStateException("BOTH is not a supported direction"); case IN: uncommittedRemovedInEdgeLabels.put(er.getEdgeLabel().getFullName(), EdgeRemoveType.ROLE); er.getEdgeLabel().removeInVertexLabel(this, preserveData); break; case OUT: uncommittedRemovedOutEdgeLabels.put(er.getEdgeLabel().getFullName(), EdgeRemoveType.ROLE); er.getEdgeLabel().removeOutVertexLabel(this, preserveData); break; } this.getSchema().getTopology().fire(er, "", TopologyChangeAction.DELETE); } }
[ "void", "removeEdgeRole", "(", "EdgeRole", "er", ",", "boolean", "preserveData", ")", "{", "if", "(", "er", ".", "getVertexLabel", "(", ")", "!=", "this", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Trying to remove a EdgeRole from a non owner VertexL...
remove a given edge role @param er the edge role @param preserveData should we keep the SQL data
[ "remove", "a", "given", "edge", "role" ]
train
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/VertexLabel.java#L1061-L1103
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfImportedPage.java
PdfImportedPage.addTemplate
public void addTemplate(PdfTemplate template, float a, float b, float c, float d, float e, float f) { throwError(); }
java
public void addTemplate(PdfTemplate template, float a, float b, float c, float d, float e, float f) { throwError(); }
[ "public", "void", "addTemplate", "(", "PdfTemplate", "template", ",", "float", "a", ",", "float", "b", ",", "float", "c", ",", "float", "d", ",", "float", "e", ",", "float", "f", ")", "{", "throwError", "(", ")", ";", "}" ]
Always throws an error. This operation is not allowed. @param template dummy @param a dummy @param b dummy @param c dummy @param d dummy @param e dummy @param f dummy
[ "Always", "throws", "an", "error", ".", "This", "operation", "is", "not", "allowed", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfImportedPage.java#L109-L111
ibm-bluemix-mobile-services/bms-clientsdk-android-core
lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/api/MCAAuthorizationManager.java
MCAAuthorizationManager.isAuthorizationRequired
public boolean isAuthorizationRequired(int statusCode, Map<String, List<String>> headers) { if (headers.containsKey(WWW_AUTHENTICATE_HEADER_NAME)){ String authHeader = headers.get(WWW_AUTHENTICATE_HEADER_NAME).get(0); return AuthorizationHeaderHelper.isAuthorizationRequired(statusCode, authHeader); } else { return false; } }
java
public boolean isAuthorizationRequired(int statusCode, Map<String, List<String>> headers) { if (headers.containsKey(WWW_AUTHENTICATE_HEADER_NAME)){ String authHeader = headers.get(WWW_AUTHENTICATE_HEADER_NAME).get(0); return AuthorizationHeaderHelper.isAuthorizationRequired(statusCode, authHeader); } else { return false; } }
[ "public", "boolean", "isAuthorizationRequired", "(", "int", "statusCode", ",", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "headers", ")", "{", "if", "(", "headers", ".", "containsKey", "(", "WWW_AUTHENTICATE_HEADER_NAME", ")", ")", "{", "Str...
Check if the params came from response that requires authorization @param statusCode of the response @param headers response headers @return true if status is 401 or 403 and The value of the header contains 'Bearer'
[ "Check", "if", "the", "params", "came", "from", "response", "that", "requires", "authorization" ]
train
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core/blob/8db4f00d0d564792397bfc0e5bd57d52a238b858/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/api/MCAAuthorizationManager.java#L164-L172
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java
PageFlowUtils.getModulePathForRelativeURI
public static String getModulePathForRelativeURI( String uri ) { if ( uri == null ) return null; assert uri.length() > 0; assert uri.charAt( 0 ) == '/' : uri; // Strip off the actual page name (e.g., some_page.jsp) int slash = uri.lastIndexOf( '/' ); uri = uri.substring( 0, slash ); return uri; }
java
public static String getModulePathForRelativeURI( String uri ) { if ( uri == null ) return null; assert uri.length() > 0; assert uri.charAt( 0 ) == '/' : uri; // Strip off the actual page name (e.g., some_page.jsp) int slash = uri.lastIndexOf( '/' ); uri = uri.substring( 0, slash ); return uri; }
[ "public", "static", "String", "getModulePathForRelativeURI", "(", "String", "uri", ")", "{", "if", "(", "uri", "==", "null", ")", "return", "null", ";", "assert", "uri", ".", "length", "(", ")", ">", "0", ";", "assert", "uri", ".", "charAt", "(", "0", ...
Get the Struts module path for a URI that is relative to the web application root. @param uri the URI for which to get the module path.
[ "Get", "the", "Struts", "module", "path", "for", "a", "URI", "that", "is", "relative", "to", "the", "web", "application", "root", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L116-L127
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/text/StrTokenizer.java
StrTokenizer.isQuote
private boolean isQuote(final char[] srcChars, final int pos, final int len, final int quoteStart, final int quoteLen) { for (int i = 0; i < quoteLen; i++) { if (pos + i >= len || srcChars[pos + i] != srcChars[quoteStart + i]) { return false; } } return true; }
java
private boolean isQuote(final char[] srcChars, final int pos, final int len, final int quoteStart, final int quoteLen) { for (int i = 0; i < quoteLen; i++) { if (pos + i >= len || srcChars[pos + i] != srcChars[quoteStart + i]) { return false; } } return true; }
[ "private", "boolean", "isQuote", "(", "final", "char", "[", "]", "srcChars", ",", "final", "int", "pos", ",", "final", "int", "len", ",", "final", "int", "quoteStart", ",", "final", "int", "quoteLen", ")", "{", "for", "(", "int", "i", "=", "0", ";", ...
Checks if the characters at the index specified match the quote already matched in readNextToken(). @param srcChars the character array being tokenized @param pos the position to check for a quote @param len the length of the character array being tokenized @param quoteStart the start position of the matched quote, 0 if no quoting @param quoteLen the length of the matched quote, 0 if no quoting @return true if a quote is matched
[ "Checks", "if", "the", "characters", "at", "the", "index", "specified", "match", "the", "quote", "already", "matched", "in", "readNextToken", "()", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java#L840-L847
aws/aws-sdk-java
aws-java-sdk-lambda/src/main/java/com/amazonaws/services/lambda/model/EnvironmentResponse.java
EnvironmentResponse.withVariables
public EnvironmentResponse withVariables(java.util.Map<String, String> variables) { setVariables(variables); return this; }
java
public EnvironmentResponse withVariables(java.util.Map<String, String> variables) { setVariables(variables); return this; }
[ "public", "EnvironmentResponse", "withVariables", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "variables", ")", "{", "setVariables", "(", "variables", ")", ";", "return", "this", ";", "}" ]
<p> Environment variable key-value pairs. </p> @param variables Environment variable key-value pairs. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Environment", "variable", "key", "-", "value", "pairs", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-lambda/src/main/java/com/amazonaws/services/lambda/model/EnvironmentResponse.java#L82-L85
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java
DateFunctions.strToZoneName
public static Expression strToZoneName(String expression, String zoneName) { return strToZoneName(x(expression), zoneName); }
java
public static Expression strToZoneName(String expression, String zoneName) { return strToZoneName(x(expression), zoneName); }
[ "public", "static", "Expression", "strToZoneName", "(", "String", "expression", ",", "String", "zoneName", ")", "{", "return", "strToZoneName", "(", "x", "(", "expression", ")", ",", "zoneName", ")", ";", "}" ]
Returned expression results in a conversion of the supported time stamp string to the named time zone.
[ "Returned", "expression", "results", "in", "a", "conversion", "of", "the", "supported", "time", "stamp", "string", "to", "the", "named", "time", "zone", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java#L325-L327
cqframework/clinical_quality_language
Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseClinicalVisitor.java
ElmBaseClinicalVisitor.visitUnaryExpression
@Override public T visitUnaryExpression(UnaryExpression elm, C context) { if (elm instanceof CalculateAge) return visitCalculateAge((CalculateAge)elm, context); else return super.visitUnaryExpression(elm, context); }
java
@Override public T visitUnaryExpression(UnaryExpression elm, C context) { if (elm instanceof CalculateAge) return visitCalculateAge((CalculateAge)elm, context); else return super.visitUnaryExpression(elm, context); }
[ "@", "Override", "public", "T", "visitUnaryExpression", "(", "UnaryExpression", "elm", ",", "C", "context", ")", "{", "if", "(", "elm", "instanceof", "CalculateAge", ")", "return", "visitCalculateAge", "(", "(", "CalculateAge", ")", "elm", ",", "context", ")",...
Visit a UnaryExpression. This method will be called for every node in the tree that is a UnaryExpression. @param elm the ELM tree @param context the context passed to the visitor @return the visitor result
[ "Visit", "a", "UnaryExpression", ".", "This", "method", "will", "be", "called", "for", "every", "node", "in", "the", "tree", "that", "is", "a", "UnaryExpression", "." ]
train
https://github.com/cqframework/clinical_quality_language/blob/67459d1ef453e49db8d7c5c86e87278377ed0a0b/Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseClinicalVisitor.java#L43-L47
gallandarakhneorg/afc
advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/astar/RoadAStar.java
RoadAStar.solve
public RoadPath solve(Point2D<?, ?> startPoint, Point2D<?, ?> endPoint, RoadNetwork network) { assert network != null && startPoint != null && endPoint != null; final RoadSegment startSegment = network.getNearestSegment(startPoint); if (startSegment != null) { final RoadSegment endSegment = network.getNearestSegment(endPoint); if (endSegment != null) { final VirtualPoint start = new VirtualPoint(startPoint, startSegment); final VirtualPoint end = new VirtualPoint(endPoint, endSegment); return solve(start, end); } } return null; }
java
public RoadPath solve(Point2D<?, ?> startPoint, Point2D<?, ?> endPoint, RoadNetwork network) { assert network != null && startPoint != null && endPoint != null; final RoadSegment startSegment = network.getNearestSegment(startPoint); if (startSegment != null) { final RoadSegment endSegment = network.getNearestSegment(endPoint); if (endSegment != null) { final VirtualPoint start = new VirtualPoint(startPoint, startSegment); final VirtualPoint end = new VirtualPoint(endPoint, endSegment); return solve(start, end); } } return null; }
[ "public", "RoadPath", "solve", "(", "Point2D", "<", "?", ",", "?", ">", "startPoint", ",", "Point2D", "<", "?", ",", "?", ">", "endPoint", ",", "RoadNetwork", "network", ")", "{", "assert", "network", "!=", "null", "&&", "startPoint", "!=", "null", "&&...
Run the A* algorithm from the nearest segment to <var>startPoint</var> to the nearest segment to <var>endPoint</var>. @param startPoint is the starting point. @param endPoint is the point to reach. @param network is the road network to explore. @return the found path, or <code>null</code> if none found.
[ "Run", "the", "A", "*", "algorithm", "from", "the", "nearest", "segment", "to", "<var", ">", "startPoint<", "/", "var", ">", "to", "the", "nearest", "segment", "to", "<var", ">", "endPoint<", "/", "var", ">", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/astar/RoadAStar.java#L160-L172
logic-ng/LogicNG
src/main/java/org/logicng/bdds/jbuddy/BDDKernel.java
BDDKernel.forAll
public int forAll(final int r, final int var) { final int res; if (var < 2) return r; varset2vartable(var); initRef(); res = quantRec(r, Operand.AND, (var << 3) | CACHEID_FORALL); return res; }
java
public int forAll(final int r, final int var) { final int res; if (var < 2) return r; varset2vartable(var); initRef(); res = quantRec(r, Operand.AND, (var << 3) | CACHEID_FORALL); return res; }
[ "public", "int", "forAll", "(", "final", "int", "r", ",", "final", "int", "var", ")", "{", "final", "int", "res", ";", "if", "(", "var", "<", "2", ")", "return", "r", ";", "varset2vartable", "(", "var", ")", ";", "initRef", "(", ")", ";", "res", ...
Universal quantifier elimination for the variables in {@code var}. @param r the BDD root node @param var the variables to eliminate @return the BDD with the eliminated variables
[ "Universal", "quantifier", "elimination", "for", "the", "variables", "in", "{" ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/bdds/jbuddy/BDDKernel.java#L757-L765