repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
CodeNarc/CodeNarc
src/main/java/org/codenarc/rule/AbstractMethodVisitor.java
AbstractMethodVisitor.addViolation
protected void addViolation(ClassNode node, String message) { """ Add a new Violation to the list of violations found by this visitor. Only add the violation if the node lineNumber >= 0. @param node - the Groovy AST Node @param message - the message for the violation; defaults to null """ addViolation((ASTNode) node, String.format( "Violation in class %s. %s", node.getNameWithoutPackage(), message )); }
java
protected void addViolation(ClassNode node, String message) { addViolation((ASTNode) node, String.format( "Violation in class %s. %s", node.getNameWithoutPackage(), message )); }
[ "protected", "void", "addViolation", "(", "ClassNode", "node", ",", "String", "message", ")", "{", "addViolation", "(", "(", "ASTNode", ")", "node", ",", "String", ".", "format", "(", "\"Violation in class %s. %s\"", ",", "node", ".", "getNameWithoutPackage", "(", ")", ",", "message", ")", ")", ";", "}" ]
Add a new Violation to the list of violations found by this visitor. Only add the violation if the node lineNumber >= 0. @param node - the Groovy AST Node @param message - the message for the violation; defaults to null
[ "Add", "a", "new", "Violation", "to", "the", "list", "of", "violations", "found", "by", "this", "visitor", ".", "Only", "add", "the", "violation", "if", "the", "node", "lineNumber", ">", "=", "0", "." ]
train
https://github.com/CodeNarc/CodeNarc/blob/9a7cec02cb8cbaf845030f2434309e8968f5d7a7/src/main/java/org/codenarc/rule/AbstractMethodVisitor.java#L89-L93
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java
SerializedFormBuilder.buildSerialUIDInfo
public void buildSerialUIDInfo(XMLNode node, Content classTree) { """ Build the serial UID information for the given class. @param node the XML element that specifies which components to document @param classTree content tree to which the serial UID information will be added """ Content serialUidTree = writer.getSerialUIDInfoHeader(); for (FieldDoc field : currentClass.fields(false)) { if (field.name().equals("serialVersionUID") && field.constantValueExpression() != null) { writer.addSerialUIDInfo(SERIAL_VERSION_UID_HEADER, field.constantValueExpression(), serialUidTree); break; } } classTree.addContent(serialUidTree); }
java
public void buildSerialUIDInfo(XMLNode node, Content classTree) { Content serialUidTree = writer.getSerialUIDInfoHeader(); for (FieldDoc field : currentClass.fields(false)) { if (field.name().equals("serialVersionUID") && field.constantValueExpression() != null) { writer.addSerialUIDInfo(SERIAL_VERSION_UID_HEADER, field.constantValueExpression(), serialUidTree); break; } } classTree.addContent(serialUidTree); }
[ "public", "void", "buildSerialUIDInfo", "(", "XMLNode", "node", ",", "Content", "classTree", ")", "{", "Content", "serialUidTree", "=", "writer", ".", "getSerialUIDInfoHeader", "(", ")", ";", "for", "(", "FieldDoc", "field", ":", "currentClass", ".", "fields", "(", "false", ")", ")", "{", "if", "(", "field", ".", "name", "(", ")", ".", "equals", "(", "\"serialVersionUID\"", ")", "&&", "field", ".", "constantValueExpression", "(", ")", "!=", "null", ")", "{", "writer", ".", "addSerialUIDInfo", "(", "SERIAL_VERSION_UID_HEADER", ",", "field", ".", "constantValueExpression", "(", ")", ",", "serialUidTree", ")", ";", "break", ";", "}", "}", "classTree", ".", "addContent", "(", "serialUidTree", ")", ";", "}" ]
Build the serial UID information for the given class. @param node the XML element that specifies which components to document @param classTree content tree to which the serial UID information will be added
[ "Build", "the", "serial", "UID", "information", "for", "the", "given", "class", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java#L240-L251
lotaris/rox-client-junit
src/main/java/com/lotaris/rox/client/junit/AbstractRoxListener.java
AbstractRoxListener.getCategory
protected String getCategory(RoxableTestClass classAnnotation, RoxableTest methodAnnotation) { """ Retrieve the category to apply to the test @param classAnnotation The roxable class annotation to get the override category @param methodAnnotation The roxable annotation to get the override category @return The category found """ if (methodAnnotation != null && methodAnnotation.category() != null && !methodAnnotation.category().isEmpty()) { return methodAnnotation.category(); } else if (classAnnotation != null && classAnnotation.category() != null && !classAnnotation.category().isEmpty()) { return classAnnotation.category(); } else if (configuration.getCategory() != null && !configuration.getCategory().isEmpty()) { return configuration.getCategory(); } else if (category != null) { return category; } else { return DEFAULT_CATEGORY; } }
java
protected String getCategory(RoxableTestClass classAnnotation, RoxableTest methodAnnotation) { if (methodAnnotation != null && methodAnnotation.category() != null && !methodAnnotation.category().isEmpty()) { return methodAnnotation.category(); } else if (classAnnotation != null && classAnnotation.category() != null && !classAnnotation.category().isEmpty()) { return classAnnotation.category(); } else if (configuration.getCategory() != null && !configuration.getCategory().isEmpty()) { return configuration.getCategory(); } else if (category != null) { return category; } else { return DEFAULT_CATEGORY; } }
[ "protected", "String", "getCategory", "(", "RoxableTestClass", "classAnnotation", ",", "RoxableTest", "methodAnnotation", ")", "{", "if", "(", "methodAnnotation", "!=", "null", "&&", "methodAnnotation", ".", "category", "(", ")", "!=", "null", "&&", "!", "methodAnnotation", ".", "category", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "return", "methodAnnotation", ".", "category", "(", ")", ";", "}", "else", "if", "(", "classAnnotation", "!=", "null", "&&", "classAnnotation", ".", "category", "(", ")", "!=", "null", "&&", "!", "classAnnotation", ".", "category", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "return", "classAnnotation", ".", "category", "(", ")", ";", "}", "else", "if", "(", "configuration", ".", "getCategory", "(", ")", "!=", "null", "&&", "!", "configuration", ".", "getCategory", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "return", "configuration", ".", "getCategory", "(", ")", ";", "}", "else", "if", "(", "category", "!=", "null", ")", "{", "return", "category", ";", "}", "else", "{", "return", "DEFAULT_CATEGORY", ";", "}", "}" ]
Retrieve the category to apply to the test @param classAnnotation The roxable class annotation to get the override category @param methodAnnotation The roxable annotation to get the override category @return The category found
[ "Retrieve", "the", "category", "to", "apply", "to", "the", "test" ]
train
https://github.com/lotaris/rox-client-junit/blob/1bc5fd99feb1a4467788128c9486737ad8e47bb8/src/main/java/com/lotaris/rox/client/junit/AbstractRoxListener.java#L202-L218
phax/ph-oton
ph-oton-app/src/main/java/com/helger/photon/app/resource/WebSiteResourceWithCondition.java
WebSiteResourceWithCondition.createForJS
@Nonnull public static WebSiteResourceWithCondition createForJS (@Nonnull final IJSPathProvider aPP, final boolean bRegular) { """ Factory method for JavaScript resources. @param aPP The path provider. @param bRegular <code>true</code> for regular version, <code>false</code> for the minified/optimized version. @return New {@link WebSiteResourceWithCondition} object. Never <code>null</code>. """ return createForJS (aPP.getJSItemPath (bRegular), aPP.getConditionalComment (), aPP.isBundlable ()); }
java
@Nonnull public static WebSiteResourceWithCondition createForJS (@Nonnull final IJSPathProvider aPP, final boolean bRegular) { return createForJS (aPP.getJSItemPath (bRegular), aPP.getConditionalComment (), aPP.isBundlable ()); }
[ "@", "Nonnull", "public", "static", "WebSiteResourceWithCondition", "createForJS", "(", "@", "Nonnull", "final", "IJSPathProvider", "aPP", ",", "final", "boolean", "bRegular", ")", "{", "return", "createForJS", "(", "aPP", ".", "getJSItemPath", "(", "bRegular", ")", ",", "aPP", ".", "getConditionalComment", "(", ")", ",", "aPP", ".", "isBundlable", "(", ")", ")", ";", "}" ]
Factory method for JavaScript resources. @param aPP The path provider. @param bRegular <code>true</code> for regular version, <code>false</code> for the minified/optimized version. @return New {@link WebSiteResourceWithCondition} object. Never <code>null</code>.
[ "Factory", "method", "for", "JavaScript", "resources", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-app/src/main/java/com/helger/photon/app/resource/WebSiteResourceWithCondition.java#L243-L247
ModeShape/modeshape
modeshape-common/src/main/java/org/modeshape/common/util/Reflection.java
Reflection.getInstance
@SuppressWarnings( "unchecked" ) public static <T> T getInstance(String classname, ClassLoader cl) { """ Instantiates a class based on the class name provided. Instantiation is attempted via an appropriate, static factory method named <tt>getInstance()</tt> first, and failing the existence of an appropriate factory, falls back to an empty constructor. <p /> @param classname class to instantiate @return an instance of classname """ if (classname == null) throw new IllegalArgumentException("Cannot load null class!"); Class<T> clazz = null; try { clazz = (Class<T>)Class.forName(classname, true, cl); // first look for a getInstance() constructor T instance = null; try { Method factoryMethod = getFactoryMethod(clazz); if (factoryMethod != null) instance = (T) factoryMethod.invoke(null); } catch (Exception e) { // no factory method or factory method failed. Try a constructor. instance = null; } if (instance == null) { instance = clazz.newInstance(); } return instance; } catch (Exception e) { throw new RuntimeException(e); } }
java
@SuppressWarnings( "unchecked" ) public static <T> T getInstance(String classname, ClassLoader cl) { if (classname == null) throw new IllegalArgumentException("Cannot load null class!"); Class<T> clazz = null; try { clazz = (Class<T>)Class.forName(classname, true, cl); // first look for a getInstance() constructor T instance = null; try { Method factoryMethod = getFactoryMethod(clazz); if (factoryMethod != null) instance = (T) factoryMethod.invoke(null); } catch (Exception e) { // no factory method or factory method failed. Try a constructor. instance = null; } if (instance == null) { instance = clazz.newInstance(); } return instance; } catch (Exception e) { throw new RuntimeException(e); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "getInstance", "(", "String", "classname", ",", "ClassLoader", "cl", ")", "{", "if", "(", "classname", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"Cannot load null class!\"", ")", ";", "Class", "<", "T", ">", "clazz", "=", "null", ";", "try", "{", "clazz", "=", "(", "Class", "<", "T", ">", ")", "Class", ".", "forName", "(", "classname", ",", "true", ",", "cl", ")", ";", "// first look for a getInstance() constructor", "T", "instance", "=", "null", ";", "try", "{", "Method", "factoryMethod", "=", "getFactoryMethod", "(", "clazz", ")", ";", "if", "(", "factoryMethod", "!=", "null", ")", "instance", "=", "(", "T", ")", "factoryMethod", ".", "invoke", "(", "null", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// no factory method or factory method failed. Try a constructor.", "instance", "=", "null", ";", "}", "if", "(", "instance", "==", "null", ")", "{", "instance", "=", "clazz", ".", "newInstance", "(", ")", ";", "}", "return", "instance", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Instantiates a class based on the class name provided. Instantiation is attempted via an appropriate, static factory method named <tt>getInstance()</tt> first, and failing the existence of an appropriate factory, falls back to an empty constructor. <p /> @param classname class to instantiate @return an instance of classname
[ "Instantiates", "a", "class", "based", "on", "the", "class", "name", "provided", ".", "Instantiation", "is", "attempted", "via", "an", "appropriate", "static", "factory", "method", "named", "<tt", ">", "getInstance", "()", "<", "/", "tt", ">", "first", "and", "failing", "the", "existence", "of", "an", "appropriate", "factory", "falls", "back", "to", "an", "empty", "constructor", ".", "<p", "/", ">" ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/Reflection.java#L286-L309
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/util/IOUtils.java
IOUtils.getPDBCharacter
public static String getPDBCharacter(boolean web, char c1, char c2, boolean similar, char c) { """ Creates formatted String for a single character of PDB output @param web true for HTML display @param c1 character in first sequence @param c2 character in second sequence @param similar true if c1 and c2 are considered similar compounds @param c character to display @return formatted String """ String s = String.valueOf(c); return getPDBString(web, c1, c2, similar, s, s, s, s); }
java
public static String getPDBCharacter(boolean web, char c1, char c2, boolean similar, char c) { String s = String.valueOf(c); return getPDBString(web, c1, c2, similar, s, s, s, s); }
[ "public", "static", "String", "getPDBCharacter", "(", "boolean", "web", ",", "char", "c1", ",", "char", "c2", ",", "boolean", "similar", ",", "char", "c", ")", "{", "String", "s", "=", "String", ".", "valueOf", "(", "c", ")", ";", "return", "getPDBString", "(", "web", ",", "c1", ",", "c2", ",", "similar", ",", "s", ",", "s", ",", "s", ",", "s", ")", ";", "}" ]
Creates formatted String for a single character of PDB output @param web true for HTML display @param c1 character in first sequence @param c2 character in second sequence @param similar true if c1 and c2 are considered similar compounds @param c character to display @return formatted String
[ "Creates", "formatted", "String", "for", "a", "single", "character", "of", "PDB", "output" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/util/IOUtils.java#L278-L281
xmlunit/xmlunit
xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/DifferenceEngine.java
DifferenceEngine.unequal
private boolean unequal(Object expected, Object actual) { """ Test two possibly null values for inequality @param expected @param actual @return TRUE if the values are neither both null, nor equals() equal """ return expected==null ? actual!=null : unequalNotNull(expected, actual); }
java
private boolean unequal(Object expected, Object actual) { return expected==null ? actual!=null : unequalNotNull(expected, actual); }
[ "private", "boolean", "unequal", "(", "Object", "expected", ",", "Object", "actual", ")", "{", "return", "expected", "==", "null", "?", "actual", "!=", "null", ":", "unequalNotNull", "(", "expected", ",", "actual", ")", ";", "}" ]
Test two possibly null values for inequality @param expected @param actual @return TRUE if the values are neither both null, nor equals() equal
[ "Test", "two", "possibly", "null", "values", "for", "inequality" ]
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/DifferenceEngine.java#L897-L899
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/mps/task_log.java
task_log.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { """ <pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre> """ task_log_responses result = (task_log_responses) service.get_payload_formatter().string_to_resource(task_log_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.task_log_response_array); } task_log[] result_task_log = new task_log[result.task_log_response_array.length]; for(int i = 0; i < result.task_log_response_array.length; i++) { result_task_log[i] = result.task_log_response_array[i].task_log[0]; } return result_task_log; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { task_log_responses result = (task_log_responses) service.get_payload_formatter().string_to_resource(task_log_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.task_log_response_array); } task_log[] result_task_log = new task_log[result.task_log_response_array.length]; for(int i = 0; i < result.task_log_response_array.length; i++) { result_task_log[i] = result.task_log_response_array[i].task_log[0]; } return result_task_log; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "task_log_responses", "result", "=", "(", "task_log_responses", ")", "service", ".", "get_payload_formatter", "(", ")", ".", "string_to_resource", "(", "task_log_responses", ".", "class", ",", "response", ")", ";", "if", "(", "result", ".", "errorcode", "!=", "0", ")", "{", "if", "(", "result", ".", "errorcode", "==", "SESSION_NOT_EXISTS", ")", "service", ".", "clear_session", "(", ")", ";", "throw", "new", "nitro_exception", "(", "result", ".", "message", ",", "result", ".", "errorcode", ",", "(", "base_response", "[", "]", ")", "result", ".", "task_log_response_array", ")", ";", "}", "task_log", "[", "]", "result_task_log", "=", "new", "task_log", "[", "result", ".", "task_log_response_array", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "result", ".", "task_log_response_array", ".", "length", ";", "i", "++", ")", "{", "result_task_log", "[", "i", "]", "=", "result", ".", "task_log_response_array", "[", "i", "]", ".", "task_log", "[", "0", "]", ";", "}", "return", "result_task_log", ";", "}" ]
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/task_log.java#L269-L286
liyiorg/weixin-popular
src/main/java/weixin/popular/api/MaterialAPI.java
MaterialAPI.add_material
public static Media add_material(String access_token,MediaType mediaType,InputStream inputStream,Description description) { """ 新增其他类型永久素材 @param access_token access_token @param mediaType mediaType @param inputStream 多媒体文件有格式和大小限制,如下: 图片(image): 2M,支持bmp/png/jpeg/jpg/gif格式 语音(voice):5M,播放长度不超过60s,支持AMR\MP3格式 视频(video):10MB,支持MP4格式 缩略图(thumb):64KB,支持JPG格式 @param description 视频文件类型额外字段,其它类型不用添加 @return Media """ HttpPost httpPost = new HttpPost(BASE_URI+"/cgi-bin/material/add_material"); byte[] data = null; try { data = StreamUtils.copyToByteArray(inputStream); } catch (IOException e) { logger.error("", e); } MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create() .addBinaryBody("media",data,ContentType.DEFAULT_BINARY,"temp."+mediaType.fileSuffix()); if(description != null){ multipartEntityBuilder.addTextBody("description", JsonUtil.toJSONString(description),ContentType.create("text/plain",Charset.forName("utf-8"))); } HttpEntity reqEntity = multipartEntityBuilder.addTextBody(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .addTextBody("type",mediaType.uploadType()) .build(); httpPost.setEntity(reqEntity); return LocalHttpClient.executeJsonResult(httpPost,Media.class); }
java
public static Media add_material(String access_token,MediaType mediaType,InputStream inputStream,Description description){ HttpPost httpPost = new HttpPost(BASE_URI+"/cgi-bin/material/add_material"); byte[] data = null; try { data = StreamUtils.copyToByteArray(inputStream); } catch (IOException e) { logger.error("", e); } MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create() .addBinaryBody("media",data,ContentType.DEFAULT_BINARY,"temp."+mediaType.fileSuffix()); if(description != null){ multipartEntityBuilder.addTextBody("description", JsonUtil.toJSONString(description),ContentType.create("text/plain",Charset.forName("utf-8"))); } HttpEntity reqEntity = multipartEntityBuilder.addTextBody(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .addTextBody("type",mediaType.uploadType()) .build(); httpPost.setEntity(reqEntity); return LocalHttpClient.executeJsonResult(httpPost,Media.class); }
[ "public", "static", "Media", "add_material", "(", "String", "access_token", ",", "MediaType", "mediaType", ",", "InputStream", "inputStream", ",", "Description", "description", ")", "{", "HttpPost", "httpPost", "=", "new", "HttpPost", "(", "BASE_URI", "+", "\"/cgi-bin/material/add_material\"", ")", ";", "byte", "[", "]", "data", "=", "null", ";", "try", "{", "data", "=", "StreamUtils", ".", "copyToByteArray", "(", "inputStream", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "}", "MultipartEntityBuilder", "multipartEntityBuilder", "=", "MultipartEntityBuilder", ".", "create", "(", ")", ".", "addBinaryBody", "(", "\"media\"", ",", "data", ",", "ContentType", ".", "DEFAULT_BINARY", ",", "\"temp.\"", "+", "mediaType", ".", "fileSuffix", "(", ")", ")", ";", "if", "(", "description", "!=", "null", ")", "{", "multipartEntityBuilder", ".", "addTextBody", "(", "\"description\"", ",", "JsonUtil", ".", "toJSONString", "(", "description", ")", ",", "ContentType", ".", "create", "(", "\"text/plain\"", ",", "Charset", ".", "forName", "(", "\"utf-8\"", ")", ")", ")", ";", "}", "HttpEntity", "reqEntity", "=", "multipartEntityBuilder", ".", "addTextBody", "(", "PARAM_ACCESS_TOKEN", ",", "API", ".", "accessToken", "(", "access_token", ")", ")", ".", "addTextBody", "(", "\"type\"", ",", "mediaType", ".", "uploadType", "(", ")", ")", ".", "build", "(", ")", ";", "httpPost", ".", "setEntity", "(", "reqEntity", ")", ";", "return", "LocalHttpClient", ".", "executeJsonResult", "(", "httpPost", ",", "Media", ".", "class", ")", ";", "}" ]
新增其他类型永久素材 @param access_token access_token @param mediaType mediaType @param inputStream 多媒体文件有格式和大小限制,如下: 图片(image): 2M,支持bmp/png/jpeg/jpg/gif格式 语音(voice):5M,播放长度不超过60s,支持AMR\MP3格式 视频(video):10MB,支持MP4格式 缩略图(thumb):64KB,支持JPG格式 @param description 视频文件类型额外字段,其它类型不用添加 @return Media
[ "新增其他类型永久素材" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/MaterialAPI.java#L107-L125
jingwei/krati
krati-main/src/main/java/krati/core/array/AddressArrayFactory.java
AddressArrayFactory.createStaticAddressArray
public AddressArray createStaticAddressArray(File homeDir, int length, int batchSize, int numSyncBatches) throws Exception { """ Creates a fixed-length {@link AddressArray}. @param homeDir - the home directory where the <code>indexes.dat</code> is located. @param length - the length of {@link AddressArray}. @param batchSize - the number of updates per update batch. @param numSyncBatches - the number of update batches required for updating the underlying indexes. @return an instance of {@link AddressArray}. @throws Exception if an instance of {@link AddressArray} cannot be created. """ AddressArray addrArray; if(_indexesCached) { addrArray = new StaticLongArray(length, batchSize, numSyncBatches, homeDir); } else { addrArray = new IOTypeLongArray( Array.Type.STATIC, length, batchSize, numSyncBatches, homeDir); } return addrArray; }
java
public AddressArray createStaticAddressArray(File homeDir, int length, int batchSize, int numSyncBatches) throws Exception { AddressArray addrArray; if(_indexesCached) { addrArray = new StaticLongArray(length, batchSize, numSyncBatches, homeDir); } else { addrArray = new IOTypeLongArray( Array.Type.STATIC, length, batchSize, numSyncBatches, homeDir); } return addrArray; }
[ "public", "AddressArray", "createStaticAddressArray", "(", "File", "homeDir", ",", "int", "length", ",", "int", "batchSize", ",", "int", "numSyncBatches", ")", "throws", "Exception", "{", "AddressArray", "addrArray", ";", "if", "(", "_indexesCached", ")", "{", "addrArray", "=", "new", "StaticLongArray", "(", "length", ",", "batchSize", ",", "numSyncBatches", ",", "homeDir", ")", ";", "}", "else", "{", "addrArray", "=", "new", "IOTypeLongArray", "(", "Array", ".", "Type", ".", "STATIC", ",", "length", ",", "batchSize", ",", "numSyncBatches", ",", "homeDir", ")", ";", "}", "return", "addrArray", ";", "}" ]
Creates a fixed-length {@link AddressArray}. @param homeDir - the home directory where the <code>indexes.dat</code> is located. @param length - the length of {@link AddressArray}. @param batchSize - the number of updates per update batch. @param numSyncBatches - the number of update batches required for updating the underlying indexes. @return an instance of {@link AddressArray}. @throws Exception if an instance of {@link AddressArray} cannot be created.
[ "Creates", "a", "fixed", "-", "length", "{", "@link", "AddressArray", "}", "." ]
train
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/AddressArrayFactory.java#L57-L72
schallee/alib4j
core/src/main/java/net/darkmist/alib/res/PkgRes.java
PkgRes.appendResourcePathPrefixFor
protected static StringBuilder appendResourcePathPrefixFor(StringBuilder sb, Class<?> cls) { """ Apend a package name converted to a resource path prefix. @param sb what to append to. If this is null, a new StringBuilder is created. @param cls The class to get the package name from. @return Path, starting and ending with a slash, for resources prefixed by the package name. @throws NullPointerException if cls is null. """ if(cls == null) throw new NullPointerException("cls is null"); return appendResourcePathPrefixFor(sb, getPackageName(cls)); }
java
protected static StringBuilder appendResourcePathPrefixFor(StringBuilder sb, Class<?> cls) { if(cls == null) throw new NullPointerException("cls is null"); return appendResourcePathPrefixFor(sb, getPackageName(cls)); }
[ "protected", "static", "StringBuilder", "appendResourcePathPrefixFor", "(", "StringBuilder", "sb", ",", "Class", "<", "?", ">", "cls", ")", "{", "if", "(", "cls", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"cls is null\"", ")", ";", "return", "appendResourcePathPrefixFor", "(", "sb", ",", "getPackageName", "(", "cls", ")", ")", ";", "}" ]
Apend a package name converted to a resource path prefix. @param sb what to append to. If this is null, a new StringBuilder is created. @param cls The class to get the package name from. @return Path, starting and ending with a slash, for resources prefixed by the package name. @throws NullPointerException if cls is null.
[ "Apend", "a", "package", "name", "converted", "to", "a", "resource", "path", "prefix", "." ]
train
https://github.com/schallee/alib4j/blob/0e0718aee574bbb62268e1cf58e99286529ce529/core/src/main/java/net/darkmist/alib/res/PkgRes.java#L156-L161
jeremylong/DependencyCheck
utils/src/main/java/org/owasp/dependencycheck/utils/Checksum.java
Checksum.getMessageDigest
private static MessageDigest getMessageDigest(String algorithm) { """ Returns the message digest. @param algorithm the algorithm for the message digest @return the message digest """ try { return MessageDigest.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { LOGGER.error(e.getMessage()); final String msg = String.format("Failed to obtain the %s message digest.", algorithm); throw new IllegalStateException(msg, e); } }
java
private static MessageDigest getMessageDigest(String algorithm) { try { return MessageDigest.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { LOGGER.error(e.getMessage()); final String msg = String.format("Failed to obtain the %s message digest.", algorithm); throw new IllegalStateException(msg, e); } }
[ "private", "static", "MessageDigest", "getMessageDigest", "(", "String", "algorithm", ")", "{", "try", "{", "return", "MessageDigest", ".", "getInstance", "(", "algorithm", ")", ";", "}", "catch", "(", "NoSuchAlgorithmException", "e", ")", "{", "LOGGER", ".", "error", "(", "e", ".", "getMessage", "(", ")", ")", ";", "final", "String", "msg", "=", "String", ".", "format", "(", "\"Failed to obtain the %s message digest.\"", ",", "algorithm", ")", ";", "throw", "new", "IllegalStateException", "(", "msg", ",", "e", ")", ";", "}", "}" ]
Returns the message digest. @param algorithm the algorithm for the message digest @return the message digest
[ "Returns", "the", "message", "digest", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/utils/src/main/java/org/owasp/dependencycheck/utils/Checksum.java#L229-L237
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-core/src/main/java/org/deeplearning4j/evaluation/EvaluationTools.java
EvaluationTools.rocChartToHtml
public static String rocChartToHtml(ROCMultiClass rocMultiClass, List<String> classNames) { """ Given a {@link ROCMultiClass} instance and (optionally) names for each class, render the ROC chart to a stand-alone HTML file (returned as a String) @param rocMultiClass ROC to render @param classNames Names of the classes. May be null """ int n = rocMultiClass.getNumClasses(); List<Component> components = new ArrayList<>(n); for (int i = 0; i < n; i++) { RocCurve roc = rocMultiClass.getRocCurve(i); String headerText = "Class " + i; if (classNames != null && classNames.size() > i) { headerText += " (" + classNames.get(i) + ")"; } headerText += " vs. All";; Component headerDivPad = new ComponentDiv(HEADER_DIV_PAD_STYLE); components.add(headerDivPad); Component headerDivLeft = new ComponentDiv(HEADER_DIV_TEXT_PAD_STYLE); Component headerDiv = new ComponentDiv(HEADER_DIV_STYLE, new ComponentText(headerText, HEADER_TEXT_STYLE)); Component c = getRocFromPoints(ROC_TITLE, roc, rocMultiClass.getCountActualPositive(i), rocMultiClass.getCountActualNegative(i), rocMultiClass.calculateAUC(i), rocMultiClass.calculateAUCPR(i)); Component c2 = getPRCharts(PR_TITLE, PR_THRESHOLD_TITLE, rocMultiClass.getPrecisionRecallCurve(i)); components.add(headerDivLeft); components.add(headerDiv); components.add(c); components.add(c2); } return StaticPageUtil.renderHTML(components); }
java
public static String rocChartToHtml(ROCMultiClass rocMultiClass, List<String> classNames) { int n = rocMultiClass.getNumClasses(); List<Component> components = new ArrayList<>(n); for (int i = 0; i < n; i++) { RocCurve roc = rocMultiClass.getRocCurve(i); String headerText = "Class " + i; if (classNames != null && classNames.size() > i) { headerText += " (" + classNames.get(i) + ")"; } headerText += " vs. All";; Component headerDivPad = new ComponentDiv(HEADER_DIV_PAD_STYLE); components.add(headerDivPad); Component headerDivLeft = new ComponentDiv(HEADER_DIV_TEXT_PAD_STYLE); Component headerDiv = new ComponentDiv(HEADER_DIV_STYLE, new ComponentText(headerText, HEADER_TEXT_STYLE)); Component c = getRocFromPoints(ROC_TITLE, roc, rocMultiClass.getCountActualPositive(i), rocMultiClass.getCountActualNegative(i), rocMultiClass.calculateAUC(i), rocMultiClass.calculateAUCPR(i)); Component c2 = getPRCharts(PR_TITLE, PR_THRESHOLD_TITLE, rocMultiClass.getPrecisionRecallCurve(i)); components.add(headerDivLeft); components.add(headerDiv); components.add(c); components.add(c2); } return StaticPageUtil.renderHTML(components); }
[ "public", "static", "String", "rocChartToHtml", "(", "ROCMultiClass", "rocMultiClass", ",", "List", "<", "String", ">", "classNames", ")", "{", "int", "n", "=", "rocMultiClass", ".", "getNumClasses", "(", ")", ";", "List", "<", "Component", ">", "components", "=", "new", "ArrayList", "<>", "(", "n", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "{", "RocCurve", "roc", "=", "rocMultiClass", ".", "getRocCurve", "(", "i", ")", ";", "String", "headerText", "=", "\"Class \"", "+", "i", ";", "if", "(", "classNames", "!=", "null", "&&", "classNames", ".", "size", "(", ")", ">", "i", ")", "{", "headerText", "+=", "\" (\"", "+", "classNames", ".", "get", "(", "i", ")", "+", "\")\"", ";", "}", "headerText", "+=", "\" vs. All\"", ";", ";", "Component", "headerDivPad", "=", "new", "ComponentDiv", "(", "HEADER_DIV_PAD_STYLE", ")", ";", "components", ".", "add", "(", "headerDivPad", ")", ";", "Component", "headerDivLeft", "=", "new", "ComponentDiv", "(", "HEADER_DIV_TEXT_PAD_STYLE", ")", ";", "Component", "headerDiv", "=", "new", "ComponentDiv", "(", "HEADER_DIV_STYLE", ",", "new", "ComponentText", "(", "headerText", ",", "HEADER_TEXT_STYLE", ")", ")", ";", "Component", "c", "=", "getRocFromPoints", "(", "ROC_TITLE", ",", "roc", ",", "rocMultiClass", ".", "getCountActualPositive", "(", "i", ")", ",", "rocMultiClass", ".", "getCountActualNegative", "(", "i", ")", ",", "rocMultiClass", ".", "calculateAUC", "(", "i", ")", ",", "rocMultiClass", ".", "calculateAUCPR", "(", "i", ")", ")", ";", "Component", "c2", "=", "getPRCharts", "(", "PR_TITLE", ",", "PR_THRESHOLD_TITLE", ",", "rocMultiClass", ".", "getPrecisionRecallCurve", "(", "i", ")", ")", ";", "components", ".", "add", "(", "headerDivLeft", ")", ";", "components", ".", "add", "(", "headerDiv", ")", ";", "components", ".", "add", "(", "c", ")", ";", "components", ".", "add", "(", "c2", ")", ";", "}", "return", "StaticPageUtil", ".", "renderHTML", "(", "components", ")", ";", "}" ]
Given a {@link ROCMultiClass} instance and (optionally) names for each class, render the ROC chart to a stand-alone HTML file (returned as a String) @param rocMultiClass ROC to render @param classNames Names of the classes. May be null
[ "Given", "a", "{" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-core/src/main/java/org/deeplearning4j/evaluation/EvaluationTools.java#L166-L195
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java
AiMesh.getTexCoordW
public float getTexCoordW(int vertex, int coords) { """ Returns the w component of a coordinate from a texture coordinate set.<p> This method may only be called on 3-dimensional coordinate sets. Call <code>getNumUVComponents(coords)</code> to determine how may coordinate components are available. @param vertex the vertex index @param coords the texture coordinate set @return the w component """ if (!hasTexCoords(coords)) { throw new IllegalStateException( "mesh has no texture coordinate set " + coords); } checkVertexIndexBounds(vertex); /* bound checks for coords are done by java for us */ if (getNumUVComponents(coords) < 3) { throw new IllegalArgumentException("coordinate set " + coords + " does not contain 3D texture coordinates"); } return m_texcoords[coords].getFloat( (vertex * m_numUVComponents[coords] + 1) * SIZEOF_FLOAT); }
java
public float getTexCoordW(int vertex, int coords) { if (!hasTexCoords(coords)) { throw new IllegalStateException( "mesh has no texture coordinate set " + coords); } checkVertexIndexBounds(vertex); /* bound checks for coords are done by java for us */ if (getNumUVComponents(coords) < 3) { throw new IllegalArgumentException("coordinate set " + coords + " does not contain 3D texture coordinates"); } return m_texcoords[coords].getFloat( (vertex * m_numUVComponents[coords] + 1) * SIZEOF_FLOAT); }
[ "public", "float", "getTexCoordW", "(", "int", "vertex", ",", "int", "coords", ")", "{", "if", "(", "!", "hasTexCoords", "(", "coords", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"mesh has no texture coordinate set \"", "+", "coords", ")", ";", "}", "checkVertexIndexBounds", "(", "vertex", ")", ";", "/* bound checks for coords are done by java for us */", "if", "(", "getNumUVComponents", "(", "coords", ")", "<", "3", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"coordinate set \"", "+", "coords", "+", "\" does not contain 3D texture coordinates\"", ")", ";", "}", "return", "m_texcoords", "[", "coords", "]", ".", "getFloat", "(", "(", "vertex", "*", "m_numUVComponents", "[", "coords", "]", "+", "1", ")", "*", "SIZEOF_FLOAT", ")", ";", "}" ]
Returns the w component of a coordinate from a texture coordinate set.<p> This method may only be called on 3-dimensional coordinate sets. Call <code>getNumUVComponents(coords)</code> to determine how may coordinate components are available. @param vertex the vertex index @param coords the texture coordinate set @return the w component
[ "Returns", "the", "w", "component", "of", "a", "coordinate", "from", "a", "texture", "coordinate", "set", ".", "<p", ">" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java#L1002-L1019
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/Objects.java
Objects.deepEquals
@Contract(pure = true) public static boolean deepEquals(@Nullable Object a, @Nullable Object b) { """ Checks deep equality of two objects. @param a an object @param b an object @return {@code true} if objects are deeply equals, {@code false} otherwise @see Arrays#deepEquals(Object[], Object[]) @see Objects#equals(Object, Object) @since 1.2.0 """ return (a == b) || (a != null && b != null) && Arrays.deepEquals(new Object[] { a }, new Object[] { b }); }
java
@Contract(pure = true) public static boolean deepEquals(@Nullable Object a, @Nullable Object b) { return (a == b) || (a != null && b != null) && Arrays.deepEquals(new Object[] { a }, new Object[] { b }); }
[ "@", "Contract", "(", "pure", "=", "true", ")", "public", "static", "boolean", "deepEquals", "(", "@", "Nullable", "Object", "a", ",", "@", "Nullable", "Object", "b", ")", "{", "return", "(", "a", "==", "b", ")", "||", "(", "a", "!=", "null", "&&", "b", "!=", "null", ")", "&&", "Arrays", ".", "deepEquals", "(", "new", "Object", "[", "]", "{", "a", "}", ",", "new", "Object", "[", "]", "{", "b", "}", ")", ";", "}" ]
Checks deep equality of two objects. @param a an object @param b an object @return {@code true} if objects are deeply equals, {@code false} otherwise @see Arrays#deepEquals(Object[], Object[]) @see Objects#equals(Object, Object) @since 1.2.0
[ "Checks", "deep", "equality", "of", "two", "objects", "." ]
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/Objects.java#L42-L47
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/task/RegularPactTask.java
RegularPactTask.initOutputs
@SuppressWarnings("unchecked") public static <T> Collector<T> initOutputs(AbstractInvokable nepheleTask, ClassLoader cl, TaskConfig config, List<ChainedDriver<?, ?>> chainedTasksTarget, List<BufferWriter> eventualOutputs) throws Exception { """ Creates a writer for each output. Creates an OutputCollector which forwards its input to all writers. The output collector applies the configured shipping strategy. """ final int numOutputs = config.getNumOutputs(); // check whether we got any chained tasks final int numChained = config.getNumberOfChainedStubs(); if (numChained > 0) { // got chained stubs. that means that this one may only have a single forward connection if (numOutputs != 1 || config.getOutputShipStrategy(0) != ShipStrategyType.FORWARD) { throw new RuntimeException("Plan Generation Bug: Found a chained stub that is not connected via an only forward connection."); } // instantiate each task @SuppressWarnings("rawtypes") Collector previous = null; for (int i = numChained - 1; i >= 0; --i) { // get the task first final ChainedDriver<?, ?> ct; try { Class<? extends ChainedDriver<?, ?>> ctc = config.getChainedTask(i); ct = ctc.newInstance(); } catch (Exception ex) { throw new RuntimeException("Could not instantiate chained task driver.", ex); } // get the configuration for the task final TaskConfig chainedStubConf = config.getChainedStubConfig(i); final String taskName = config.getChainedTaskName(i); if (i == numChained -1) { // last in chain, instantiate the output collector for this task previous = getOutputCollector(nepheleTask, chainedStubConf, cl, eventualOutputs, chainedStubConf.getNumOutputs()); } ct.setup(chainedStubConf, taskName, previous, nepheleTask, cl); chainedTasksTarget.add(0, ct); previous = ct; } // the collector of the first in the chain is the collector for the nephele task return (Collector<T>) previous; } // else // instantiate the output collector the default way from this configuration return getOutputCollector(nepheleTask , config, cl, eventualOutputs, numOutputs); }
java
@SuppressWarnings("unchecked") public static <T> Collector<T> initOutputs(AbstractInvokable nepheleTask, ClassLoader cl, TaskConfig config, List<ChainedDriver<?, ?>> chainedTasksTarget, List<BufferWriter> eventualOutputs) throws Exception { final int numOutputs = config.getNumOutputs(); // check whether we got any chained tasks final int numChained = config.getNumberOfChainedStubs(); if (numChained > 0) { // got chained stubs. that means that this one may only have a single forward connection if (numOutputs != 1 || config.getOutputShipStrategy(0) != ShipStrategyType.FORWARD) { throw new RuntimeException("Plan Generation Bug: Found a chained stub that is not connected via an only forward connection."); } // instantiate each task @SuppressWarnings("rawtypes") Collector previous = null; for (int i = numChained - 1; i >= 0; --i) { // get the task first final ChainedDriver<?, ?> ct; try { Class<? extends ChainedDriver<?, ?>> ctc = config.getChainedTask(i); ct = ctc.newInstance(); } catch (Exception ex) { throw new RuntimeException("Could not instantiate chained task driver.", ex); } // get the configuration for the task final TaskConfig chainedStubConf = config.getChainedStubConfig(i); final String taskName = config.getChainedTaskName(i); if (i == numChained -1) { // last in chain, instantiate the output collector for this task previous = getOutputCollector(nepheleTask, chainedStubConf, cl, eventualOutputs, chainedStubConf.getNumOutputs()); } ct.setup(chainedStubConf, taskName, previous, nepheleTask, cl); chainedTasksTarget.add(0, ct); previous = ct; } // the collector of the first in the chain is the collector for the nephele task return (Collector<T>) previous; } // else // instantiate the output collector the default way from this configuration return getOutputCollector(nepheleTask , config, cl, eventualOutputs, numOutputs); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "Collector", "<", "T", ">", "initOutputs", "(", "AbstractInvokable", "nepheleTask", ",", "ClassLoader", "cl", ",", "TaskConfig", "config", ",", "List", "<", "ChainedDriver", "<", "?", ",", "?", ">", ">", "chainedTasksTarget", ",", "List", "<", "BufferWriter", ">", "eventualOutputs", ")", "throws", "Exception", "{", "final", "int", "numOutputs", "=", "config", ".", "getNumOutputs", "(", ")", ";", "// check whether we got any chained tasks", "final", "int", "numChained", "=", "config", ".", "getNumberOfChainedStubs", "(", ")", ";", "if", "(", "numChained", ">", "0", ")", "{", "// got chained stubs. that means that this one may only have a single forward connection", "if", "(", "numOutputs", "!=", "1", "||", "config", ".", "getOutputShipStrategy", "(", "0", ")", "!=", "ShipStrategyType", ".", "FORWARD", ")", "{", "throw", "new", "RuntimeException", "(", "\"Plan Generation Bug: Found a chained stub that is not connected via an only forward connection.\"", ")", ";", "}", "// instantiate each task", "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "Collector", "previous", "=", "null", ";", "for", "(", "int", "i", "=", "numChained", "-", "1", ";", "i", ">=", "0", ";", "--", "i", ")", "{", "// get the task first", "final", "ChainedDriver", "<", "?", ",", "?", ">", "ct", ";", "try", "{", "Class", "<", "?", "extends", "ChainedDriver", "<", "?", ",", "?", ">", ">", "ctc", "=", "config", ".", "getChainedTask", "(", "i", ")", ";", "ct", "=", "ctc", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "throw", "new", "RuntimeException", "(", "\"Could not instantiate chained task driver.\"", ",", "ex", ")", ";", "}", "// get the configuration for the task", "final", "TaskConfig", "chainedStubConf", "=", "config", ".", "getChainedStubConfig", "(", "i", ")", ";", "final", "String", "taskName", "=", "config", ".", "getChainedTaskName", "(", "i", ")", ";", "if", "(", "i", "==", "numChained", "-", "1", ")", "{", "// last in chain, instantiate the output collector for this task", "previous", "=", "getOutputCollector", "(", "nepheleTask", ",", "chainedStubConf", ",", "cl", ",", "eventualOutputs", ",", "chainedStubConf", ".", "getNumOutputs", "(", ")", ")", ";", "}", "ct", ".", "setup", "(", "chainedStubConf", ",", "taskName", ",", "previous", ",", "nepheleTask", ",", "cl", ")", ";", "chainedTasksTarget", ".", "add", "(", "0", ",", "ct", ")", ";", "previous", "=", "ct", ";", "}", "// the collector of the first in the chain is the collector for the nephele task", "return", "(", "Collector", "<", "T", ">", ")", "previous", ";", "}", "// else", "// instantiate the output collector the default way from this configuration", "return", "getOutputCollector", "(", "nepheleTask", ",", "config", ",", "cl", ",", "eventualOutputs", ",", "numOutputs", ")", ";", "}" ]
Creates a writer for each output. Creates an OutputCollector which forwards its input to all writers. The output collector applies the configured shipping strategy.
[ "Creates", "a", "writer", "for", "each", "output", ".", "Creates", "an", "OutputCollector", "which", "forwards", "its", "input", "to", "all", "writers", ".", "The", "output", "collector", "applies", "the", "configured", "shipping", "strategy", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/task/RegularPactTask.java#L1314-L1365
lucee/Lucee
core/src/main/java/lucee/runtime/type/ref/NativeReference.java
NativeReference.getInstance
public static Reference getInstance(Object o, String key) { """ returns a Reference Instance @param o @param key @return Reference Instance """ if (o instanceof Reference) { return new ReferenceReference((Reference) o, key); } Collection coll = Caster.toCollection(o, null); if (coll != null) return new VariableReference(coll, key); return new NativeReference(o, key); }
java
public static Reference getInstance(Object o, String key) { if (o instanceof Reference) { return new ReferenceReference((Reference) o, key); } Collection coll = Caster.toCollection(o, null); if (coll != null) return new VariableReference(coll, key); return new NativeReference(o, key); }
[ "public", "static", "Reference", "getInstance", "(", "Object", "o", ",", "String", "key", ")", "{", "if", "(", "o", "instanceof", "Reference", ")", "{", "return", "new", "ReferenceReference", "(", "(", "Reference", ")", "o", ",", "key", ")", ";", "}", "Collection", "coll", "=", "Caster", ".", "toCollection", "(", "o", ",", "null", ")", ";", "if", "(", "coll", "!=", "null", ")", "return", "new", "VariableReference", "(", "coll", ",", "key", ")", ";", "return", "new", "NativeReference", "(", "o", ",", "key", ")", ";", "}" ]
returns a Reference Instance @param o @param key @return Reference Instance
[ "returns", "a", "Reference", "Instance" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/ref/NativeReference.java#L54-L61
czyzby/gdx-lml
mvc/src/main/java/com/github/czyzby/autumn/mvc/application/AutumnApplication.java
AutumnApplication.registerComponents
protected void registerComponents(final ClassScanner componentScanner, final Class<?> scanningRoot) { """ Can be called only before {@link #create()} is invoked. @param componentScanner used to scan for annotated classes. @param scanningRoot root of the scanning. """ componentScanners.add(new Pair<Class<?>, ClassScanner>(scanningRoot, componentScanner)); }
java
protected void registerComponents(final ClassScanner componentScanner, final Class<?> scanningRoot) { componentScanners.add(new Pair<Class<?>, ClassScanner>(scanningRoot, componentScanner)); }
[ "protected", "void", "registerComponents", "(", "final", "ClassScanner", "componentScanner", ",", "final", "Class", "<", "?", ">", "scanningRoot", ")", "{", "componentScanners", ".", "add", "(", "new", "Pair", "<", "Class", "<", "?", ">", ",", "ClassScanner", ">", "(", "scanningRoot", ",", "componentScanner", ")", ")", ";", "}" ]
Can be called only before {@link #create()} is invoked. @param componentScanner used to scan for annotated classes. @param scanningRoot root of the scanning.
[ "Can", "be", "called", "only", "before", "{", "@link", "#create", "()", "}", "is", "invoked", "." ]
train
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/mvc/src/main/java/com/github/czyzby/autumn/mvc/application/AutumnApplication.java#L59-L61
alkacon/opencms-core
src-gwt/org/opencms/acacia/client/CmsAttributeHandler.java
CmsAttributeHandler.addNewChoiceAttributeValue
public void addNewChoiceAttributeValue(CmsAttributeValueView reference, List<String> choicePath) { """ Adds a new choice attribute value.<p> @param reference the reference value view @param choicePath the path of the selected (possibly nested) choice attribute, consisting of attribute names """ CmsValueFocusHandler.getInstance().clearFocus(); m_widgetService.addChangedOrderPath(getSimplePath(-1)); if (isChoiceHandler()) { addChoiceOption(reference, choicePath); } else { addComplexChoiceValue(reference, choicePath); } updateButtonVisisbility(); CmsUndoRedoHandler handler = CmsUndoRedoHandler.getInstance(); if (handler.isIntitalized()) { handler.addChange(m_entity.getId(), m_attributeName, reference.getValueIndex() + 1, ChangeType.choice); } }
java
public void addNewChoiceAttributeValue(CmsAttributeValueView reference, List<String> choicePath) { CmsValueFocusHandler.getInstance().clearFocus(); m_widgetService.addChangedOrderPath(getSimplePath(-1)); if (isChoiceHandler()) { addChoiceOption(reference, choicePath); } else { addComplexChoiceValue(reference, choicePath); } updateButtonVisisbility(); CmsUndoRedoHandler handler = CmsUndoRedoHandler.getInstance(); if (handler.isIntitalized()) { handler.addChange(m_entity.getId(), m_attributeName, reference.getValueIndex() + 1, ChangeType.choice); } }
[ "public", "void", "addNewChoiceAttributeValue", "(", "CmsAttributeValueView", "reference", ",", "List", "<", "String", ">", "choicePath", ")", "{", "CmsValueFocusHandler", ".", "getInstance", "(", ")", ".", "clearFocus", "(", ")", ";", "m_widgetService", ".", "addChangedOrderPath", "(", "getSimplePath", "(", "-", "1", ")", ")", ";", "if", "(", "isChoiceHandler", "(", ")", ")", "{", "addChoiceOption", "(", "reference", ",", "choicePath", ")", ";", "}", "else", "{", "addComplexChoiceValue", "(", "reference", ",", "choicePath", ")", ";", "}", "updateButtonVisisbility", "(", ")", ";", "CmsUndoRedoHandler", "handler", "=", "CmsUndoRedoHandler", ".", "getInstance", "(", ")", ";", "if", "(", "handler", ".", "isIntitalized", "(", ")", ")", "{", "handler", ".", "addChange", "(", "m_entity", ".", "getId", "(", ")", ",", "m_attributeName", ",", "reference", ".", "getValueIndex", "(", ")", "+", "1", ",", "ChangeType", ".", "choice", ")", ";", "}", "}" ]
Adds a new choice attribute value.<p> @param reference the reference value view @param choicePath the path of the selected (possibly nested) choice attribute, consisting of attribute names
[ "Adds", "a", "new", "choice", "attribute", "value", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/CmsAttributeHandler.java#L369-L383
h2oai/h2o-3
h2o-extensions/xgboost/src/main/java/hex/tree/xgboost/XGBoostUtils.java
XGBoostUtils.enlargeTables
private static void enlargeTables(float[][] data, int[][] rowIndex, int cols, int currentRow, int currentCol) { """ Assumes both matrices are getting filled at the same rate and will require the same amount of space """ while (data[currentRow].length < currentCol + cols) { if(data[currentRow].length == SPARSE_MATRIX_DIM) { currentCol = 0; cols -= (data[currentRow].length - currentCol); currentRow++; data[currentRow] = malloc4f(ALLOCATED_ARRAY_LEN); rowIndex[currentRow] = malloc4(ALLOCATED_ARRAY_LEN); } else { int newLen = (int) Math.min((long) data[currentRow].length << 1L, (long) SPARSE_MATRIX_DIM); data[currentRow] = Arrays.copyOf(data[currentRow], newLen); rowIndex[currentRow] = Arrays.copyOf(rowIndex[currentRow], newLen); } } }
java
private static void enlargeTables(float[][] data, int[][] rowIndex, int cols, int currentRow, int currentCol) { while (data[currentRow].length < currentCol + cols) { if(data[currentRow].length == SPARSE_MATRIX_DIM) { currentCol = 0; cols -= (data[currentRow].length - currentCol); currentRow++; data[currentRow] = malloc4f(ALLOCATED_ARRAY_LEN); rowIndex[currentRow] = malloc4(ALLOCATED_ARRAY_LEN); } else { int newLen = (int) Math.min((long) data[currentRow].length << 1L, (long) SPARSE_MATRIX_DIM); data[currentRow] = Arrays.copyOf(data[currentRow], newLen); rowIndex[currentRow] = Arrays.copyOf(rowIndex[currentRow], newLen); } } }
[ "private", "static", "void", "enlargeTables", "(", "float", "[", "]", "[", "]", "data", ",", "int", "[", "]", "[", "]", "rowIndex", ",", "int", "cols", ",", "int", "currentRow", ",", "int", "currentCol", ")", "{", "while", "(", "data", "[", "currentRow", "]", ".", "length", "<", "currentCol", "+", "cols", ")", "{", "if", "(", "data", "[", "currentRow", "]", ".", "length", "==", "SPARSE_MATRIX_DIM", ")", "{", "currentCol", "=", "0", ";", "cols", "-=", "(", "data", "[", "currentRow", "]", ".", "length", "-", "currentCol", ")", ";", "currentRow", "++", ";", "data", "[", "currentRow", "]", "=", "malloc4f", "(", "ALLOCATED_ARRAY_LEN", ")", ";", "rowIndex", "[", "currentRow", "]", "=", "malloc4", "(", "ALLOCATED_ARRAY_LEN", ")", ";", "}", "else", "{", "int", "newLen", "=", "(", "int", ")", "Math", ".", "min", "(", "(", "long", ")", "data", "[", "currentRow", "]", ".", "length", "<<", "1L", ",", "(", "long", ")", "SPARSE_MATRIX_DIM", ")", ";", "data", "[", "currentRow", "]", "=", "Arrays", ".", "copyOf", "(", "data", "[", "currentRow", "]", ",", "newLen", ")", ";", "rowIndex", "[", "currentRow", "]", "=", "Arrays", ".", "copyOf", "(", "rowIndex", "[", "currentRow", "]", ",", "newLen", ")", ";", "}", "}", "}" ]
Assumes both matrices are getting filled at the same rate and will require the same amount of space
[ "Assumes", "both", "matrices", "are", "getting", "filled", "at", "the", "same", "rate", "and", "will", "require", "the", "same", "amount", "of", "space" ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-extensions/xgboost/src/main/java/hex/tree/xgboost/XGBoostUtils.java#L784-L798
hypfvieh/java-utils
src/main/java/com/github/hypfvieh/util/CompareUtil.java
CompareUtil.startsWithAny
public static boolean startsWithAny(String _str, String... _startStrings) { """ Checks if given String starts with any of the other given parameters. @param _str string to check @param _startStrings start strings to compare @return true if any match, false otherwise """ if (_str == null || _startStrings == null || _startStrings.length == 0) { return false; } for (String start : _startStrings) { if (_str.startsWith(start)) { return true; } } return false; }
java
public static boolean startsWithAny(String _str, String... _startStrings) { if (_str == null || _startStrings == null || _startStrings.length == 0) { return false; } for (String start : _startStrings) { if (_str.startsWith(start)) { return true; } } return false; }
[ "public", "static", "boolean", "startsWithAny", "(", "String", "_str", ",", "String", "...", "_startStrings", ")", "{", "if", "(", "_str", "==", "null", "||", "_startStrings", "==", "null", "||", "_startStrings", ".", "length", "==", "0", ")", "{", "return", "false", ";", "}", "for", "(", "String", "start", ":", "_startStrings", ")", "{", "if", "(", "_str", ".", "startsWith", "(", "start", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Checks if given String starts with any of the other given parameters. @param _str string to check @param _startStrings start strings to compare @return true if any match, false otherwise
[ "Checks", "if", "given", "String", "starts", "with", "any", "of", "the", "other", "given", "parameters", "." ]
train
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/CompareUtil.java#L135-L147
jqm4gwt/jqm4gwt
library/src/main/java/com/sksamuel/jqm4gwt/JQMCommon.java
JQMCommon.indexOfName
public static int indexOfName(String nameList, String name) { """ Exact copy of com.google.gwt.dom.client.Element.indexOfName() <p> Returns the index of the first occurrence of name in a space-separated list of names, or -1 if not found. </p> @param nameList list of space delimited names @param name a non-empty string. Should be already trimmed. """ int idx = nameList.indexOf(name); // Calculate matching index. while (idx != -1) { if (idx == 0 || nameList.charAt(idx - 1) == ' ') { int last = idx + name.length(); int lastPos = nameList.length(); if ((last == lastPos) || ((last < lastPos) && (nameList.charAt(last) == ' '))) { break; } } idx = nameList.indexOf(name, idx + 1); } return idx; }
java
public static int indexOfName(String nameList, String name) { int idx = nameList.indexOf(name); // Calculate matching index. while (idx != -1) { if (idx == 0 || nameList.charAt(idx - 1) == ' ') { int last = idx + name.length(); int lastPos = nameList.length(); if ((last == lastPos) || ((last < lastPos) && (nameList.charAt(last) == ' '))) { break; } } idx = nameList.indexOf(name, idx + 1); } return idx; }
[ "public", "static", "int", "indexOfName", "(", "String", "nameList", ",", "String", "name", ")", "{", "int", "idx", "=", "nameList", ".", "indexOf", "(", "name", ")", ";", "// Calculate matching index.", "while", "(", "idx", "!=", "-", "1", ")", "{", "if", "(", "idx", "==", "0", "||", "nameList", ".", "charAt", "(", "idx", "-", "1", ")", "==", "'", "'", ")", "{", "int", "last", "=", "idx", "+", "name", ".", "length", "(", ")", ";", "int", "lastPos", "=", "nameList", ".", "length", "(", ")", ";", "if", "(", "(", "last", "==", "lastPos", ")", "||", "(", "(", "last", "<", "lastPos", ")", "&&", "(", "nameList", ".", "charAt", "(", "last", ")", "==", "'", "'", ")", ")", ")", "{", "break", ";", "}", "}", "idx", "=", "nameList", ".", "indexOf", "(", "name", ",", "idx", "+", "1", ")", ";", "}", "return", "idx", ";", "}" ]
Exact copy of com.google.gwt.dom.client.Element.indexOfName() <p> Returns the index of the first occurrence of name in a space-separated list of names, or -1 if not found. </p> @param nameList list of space delimited names @param name a non-empty string. Should be already trimmed.
[ "Exact", "copy", "of", "com", ".", "google", ".", "gwt", ".", "dom", ".", "client", ".", "Element", ".", "indexOfName", "()", "<p", ">", "Returns", "the", "index", "of", "the", "first", "occurrence", "of", "name", "in", "a", "space", "-", "separated", "list", "of", "names", "or", "-", "1", "if", "not", "found", ".", "<", "/", "p", ">" ]
train
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/JQMCommon.java#L129-L143
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/CharacterEncoder.java
CharacterEncoder.encodeBuffer
public void encodeBuffer(byte aBuffer[], OutputStream aStream) throws IOException { """ Encode the buffer in <i>aBuffer</i> and write the encoded result to the OutputStream <i>aStream</i>. """ ByteArrayInputStream inStream = new ByteArrayInputStream(aBuffer); encodeBuffer(inStream, aStream); }
java
public void encodeBuffer(byte aBuffer[], OutputStream aStream) throws IOException { ByteArrayInputStream inStream = new ByteArrayInputStream(aBuffer); encodeBuffer(inStream, aStream); }
[ "public", "void", "encodeBuffer", "(", "byte", "aBuffer", "[", "]", ",", "OutputStream", "aStream", ")", "throws", "IOException", "{", "ByteArrayInputStream", "inStream", "=", "new", "ByteArrayInputStream", "(", "aBuffer", ")", ";", "encodeBuffer", "(", "inStream", ",", "aStream", ")", ";", "}" ]
Encode the buffer in <i>aBuffer</i> and write the encoded result to the OutputStream <i>aStream</i>.
[ "Encode", "the", "buffer", "in", "<i", ">", "aBuffer<", "/", "i", ">", "and", "write", "the", "encoded", "result", "to", "the", "OutputStream", "<i", ">", "aStream<", "/", "i", ">", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/CharacterEncoder.java#L309-L313
rhuss/jolokia
agent/core/src/main/java/org/jolokia/request/JmxReadRequest.java
JmxReadRequest.newCreator
static RequestCreator<JmxReadRequest> newCreator() { """ Creator for {@link JmxReadRequest}s @return the creator implementation """ return new RequestCreator<JmxReadRequest>() { /** {@inheritDoc} */ public JmxReadRequest create(Stack<String> pStack, ProcessingParameters pParams) throws MalformedObjectNameException { return new JmxReadRequest( pStack.pop(), // object name popOrNull(pStack), // attribute(s) (can be null) prepareExtraArgs(pStack), // path pParams); } /** {@inheritDoc} */ public JmxReadRequest create(Map<String, ?> requestMap, ProcessingParameters pParams) throws MalformedObjectNameException { return new JmxReadRequest(requestMap,pParams); } }; }
java
static RequestCreator<JmxReadRequest> newCreator() { return new RequestCreator<JmxReadRequest>() { /** {@inheritDoc} */ public JmxReadRequest create(Stack<String> pStack, ProcessingParameters pParams) throws MalformedObjectNameException { return new JmxReadRequest( pStack.pop(), // object name popOrNull(pStack), // attribute(s) (can be null) prepareExtraArgs(pStack), // path pParams); } /** {@inheritDoc} */ public JmxReadRequest create(Map<String, ?> requestMap, ProcessingParameters pParams) throws MalformedObjectNameException { return new JmxReadRequest(requestMap,pParams); } }; }
[ "static", "RequestCreator", "<", "JmxReadRequest", ">", "newCreator", "(", ")", "{", "return", "new", "RequestCreator", "<", "JmxReadRequest", ">", "(", ")", "{", "/** {@inheritDoc} */", "public", "JmxReadRequest", "create", "(", "Stack", "<", "String", ">", "pStack", ",", "ProcessingParameters", "pParams", ")", "throws", "MalformedObjectNameException", "{", "return", "new", "JmxReadRequest", "(", "pStack", ".", "pop", "(", ")", ",", "// object name", "popOrNull", "(", "pStack", ")", ",", "// attribute(s) (can be null)", "prepareExtraArgs", "(", "pStack", ")", ",", "// path", "pParams", ")", ";", "}", "/** {@inheritDoc} */", "public", "JmxReadRequest", "create", "(", "Map", "<", "String", ",", "?", ">", "requestMap", ",", "ProcessingParameters", "pParams", ")", "throws", "MalformedObjectNameException", "{", "return", "new", "JmxReadRequest", "(", "requestMap", ",", "pParams", ")", ";", "}", "}", ";", "}" ]
Creator for {@link JmxReadRequest}s @return the creator implementation
[ "Creator", "for", "{", "@link", "JmxReadRequest", "}", "s" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/request/JmxReadRequest.java#L150-L167
seedstack/i18n-addon
rest/src/it/java/org/seedstack/i18n/shared/AbstractI18nRestIT.java
AbstractI18nRestIT.httpPost
protected Response httpPost(String path, String body, int status) { """ Posts the body to the given path and expect a 200 status code. @param path the resource URI @param body the resource representation @return the http response """ return httpRequest(status, null).body(body).post(baseURL + PATH_PREFIX + path); }
java
protected Response httpPost(String path, String body, int status) { return httpRequest(status, null).body(body).post(baseURL + PATH_PREFIX + path); }
[ "protected", "Response", "httpPost", "(", "String", "path", ",", "String", "body", ",", "int", "status", ")", "{", "return", "httpRequest", "(", "status", ",", "null", ")", ".", "body", "(", "body", ")", ".", "post", "(", "baseURL", "+", "PATH_PREFIX", "+", "path", ")", ";", "}" ]
Posts the body to the given path and expect a 200 status code. @param path the resource URI @param body the resource representation @return the http response
[ "Posts", "the", "body", "to", "the", "given", "path", "and", "expect", "a", "200", "status", "code", "." ]
train
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/it/java/org/seedstack/i18n/shared/AbstractI18nRestIT.java#L70-L72
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/math/SloppyMath.java
SloppyMath.intPow
public static double intPow(double b, int e) { """ Exponentiation like we learned in grade school: multiply b by itself e times. Uses power of two trick. e must be nonnegative!!! no checking!!! @param b base @param e exponent @return b^e """ double result = 1.0; double currPow = b; while (e > 0) { if ((e & 1) != 0) { result *= currPow; } currPow *= currPow; e >>= 1; } return result; }
java
public static double intPow(double b, int e) { double result = 1.0; double currPow = b; while (e > 0) { if ((e & 1) != 0) { result *= currPow; } currPow *= currPow; e >>= 1; } return result; }
[ "public", "static", "double", "intPow", "(", "double", "b", ",", "int", "e", ")", "{", "double", "result", "=", "1.0", ";", "double", "currPow", "=", "b", ";", "while", "(", "e", ">", "0", ")", "{", "if", "(", "(", "e", "&", "1", ")", "!=", "0", ")", "{", "result", "*=", "currPow", ";", "}", "currPow", "*=", "currPow", ";", "e", ">>=", "1", ";", "}", "return", "result", ";", "}" ]
Exponentiation like we learned in grade school: multiply b by itself e times. Uses power of two trick. e must be nonnegative!!! no checking!!! @param b base @param e exponent @return b^e
[ "Exponentiation", "like", "we", "learned", "in", "grade", "school", ":", "multiply", "b", "by", "itself", "e", "times", ".", "Uses", "power", "of", "two", "trick", ".", "e", "must", "be", "nonnegative!!!", "no", "checking!!!" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/SloppyMath.java#L383-L394
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/XmlReader.java
XmlReader.readBoolean
public boolean readBoolean(boolean defaultValue, String attribute) { """ Read a boolean. @param defaultValue The value returned if attribute not found. @param attribute The boolean name (must not be <code>null</code>). @return The boolean value. """ return Boolean.parseBoolean(getValue(String.valueOf(defaultValue), attribute)); }
java
public boolean readBoolean(boolean defaultValue, String attribute) { return Boolean.parseBoolean(getValue(String.valueOf(defaultValue), attribute)); }
[ "public", "boolean", "readBoolean", "(", "boolean", "defaultValue", ",", "String", "attribute", ")", "{", "return", "Boolean", ".", "parseBoolean", "(", "getValue", "(", "String", ".", "valueOf", "(", "defaultValue", ")", ",", "attribute", ")", ")", ";", "}" ]
Read a boolean. @param defaultValue The value returned if attribute not found. @param attribute The boolean name (must not be <code>null</code>). @return The boolean value.
[ "Read", "a", "boolean", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/XmlReader.java#L136-L139
OpenNTF/JavascriptAggregator
jaggr-core/src/main/java/com/ibm/jaggr/core/util/SignalUtil.java
SignalUtil.logWaiting
static boolean logWaiting(Logger log, String callerClass, String callerMethod, Object waitObj, long start, Object... extraArgs) { """ Logs a warning message. If the elapsed time is greater than {@link #SIGNAL_LOG_QUIESCE_TIMEOUT_MINUTES} then the log message will indicate that wait logging for the thread is being quiesced, and a value of true is returned. Otherwise, false is returned. @param log the logger (for unit testing) @param callerClass the class name of the caller @param callerMethod the method name of the caller @param waitObj the object that is being waited on @param start the time that the wait began @param extraArgs caller provided extra arguments @return true if the elapsed time is greater than {@link #SIGNAL_LOG_QUIESCE_TIMEOUT_MINUTES} """ long elapsed = (System.currentTimeMillis() - start)/1000; boolean quiesced = false; if (elapsed <= SIGNAL_LOG_QUIESCE_TIMEOUT_MINUTES * 60) { ArrayList<Object> args = new ArrayList<Object>(); args.add(Thread.currentThread().getId()); args.add(elapsed); args.add(waitObj); if (extraArgs != null) { args.addAll(Arrays.asList(extraArgs)); } String msg = SignalUtil.formatMessage(Messages.SignalUtil_0, args.toArray(new Object[args.size()])); log.logp(Level.WARNING, callerClass, callerMethod, msg.toString()); } else { if (!quiesced) { quiesced = true; log.logp(Level.WARNING, callerClass, callerMethod, MessageFormat.format( Messages.SignalUtil_1, new Object[]{Thread.currentThread().getId(), elapsed, waitObj} ) ); } } return quiesced; }
java
static boolean logWaiting(Logger log, String callerClass, String callerMethod, Object waitObj, long start, Object... extraArgs) { long elapsed = (System.currentTimeMillis() - start)/1000; boolean quiesced = false; if (elapsed <= SIGNAL_LOG_QUIESCE_TIMEOUT_MINUTES * 60) { ArrayList<Object> args = new ArrayList<Object>(); args.add(Thread.currentThread().getId()); args.add(elapsed); args.add(waitObj); if (extraArgs != null) { args.addAll(Arrays.asList(extraArgs)); } String msg = SignalUtil.formatMessage(Messages.SignalUtil_0, args.toArray(new Object[args.size()])); log.logp(Level.WARNING, callerClass, callerMethod, msg.toString()); } else { if (!quiesced) { quiesced = true; log.logp(Level.WARNING, callerClass, callerMethod, MessageFormat.format( Messages.SignalUtil_1, new Object[]{Thread.currentThread().getId(), elapsed, waitObj} ) ); } } return quiesced; }
[ "static", "boolean", "logWaiting", "(", "Logger", "log", ",", "String", "callerClass", ",", "String", "callerMethod", ",", "Object", "waitObj", ",", "long", "start", ",", "Object", "...", "extraArgs", ")", "{", "long", "elapsed", "=", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "start", ")", "/", "1000", ";", "boolean", "quiesced", "=", "false", ";", "if", "(", "elapsed", "<=", "SIGNAL_LOG_QUIESCE_TIMEOUT_MINUTES", "*", "60", ")", "{", "ArrayList", "<", "Object", ">", "args", "=", "new", "ArrayList", "<", "Object", ">", "(", ")", ";", "args", ".", "add", "(", "Thread", ".", "currentThread", "(", ")", ".", "getId", "(", ")", ")", ";", "args", ".", "add", "(", "elapsed", ")", ";", "args", ".", "add", "(", "waitObj", ")", ";", "if", "(", "extraArgs", "!=", "null", ")", "{", "args", ".", "addAll", "(", "Arrays", ".", "asList", "(", "extraArgs", ")", ")", ";", "}", "String", "msg", "=", "SignalUtil", ".", "formatMessage", "(", "Messages", ".", "SignalUtil_0", ",", "args", ".", "toArray", "(", "new", "Object", "[", "args", ".", "size", "(", ")", "]", ")", ")", ";", "log", ".", "logp", "(", "Level", ".", "WARNING", ",", "callerClass", ",", "callerMethod", ",", "msg", ".", "toString", "(", ")", ")", ";", "}", "else", "{", "if", "(", "!", "quiesced", ")", "{", "quiesced", "=", "true", ";", "log", ".", "logp", "(", "Level", ".", "WARNING", ",", "callerClass", ",", "callerMethod", ",", "MessageFormat", ".", "format", "(", "Messages", ".", "SignalUtil_1", ",", "new", "Object", "[", "]", "{", "Thread", ".", "currentThread", "(", ")", ".", "getId", "(", ")", ",", "elapsed", ",", "waitObj", "}", ")", ")", ";", "}", "}", "return", "quiesced", ";", "}" ]
Logs a warning message. If the elapsed time is greater than {@link #SIGNAL_LOG_QUIESCE_TIMEOUT_MINUTES} then the log message will indicate that wait logging for the thread is being quiesced, and a value of true is returned. Otherwise, false is returned. @param log the logger (for unit testing) @param callerClass the class name of the caller @param callerMethod the method name of the caller @param waitObj the object that is being waited on @param start the time that the wait began @param extraArgs caller provided extra arguments @return true if the elapsed time is greater than {@link #SIGNAL_LOG_QUIESCE_TIMEOUT_MINUTES}
[ "Logs", "a", "warning", "message", ".", "If", "the", "elapsed", "time", "is", "greater", "than", "{", "@link", "#SIGNAL_LOG_QUIESCE_TIMEOUT_MINUTES", "}", "then", "the", "log", "message", "will", "indicate", "that", "wait", "logging", "for", "the", "thread", "is", "being", "quiesced", "and", "a", "value", "of", "true", "is", "returned", ".", "Otherwise", "false", "is", "returned", "." ]
train
https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/util/SignalUtil.java#L122-L147
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/util/XpathUtils.java
XpathUtils.asDate
public static Date asDate(String expression, Node node) throws XPathExpressionException { """ Evaluates the specified XPath expression and returns the result as a Date. Assumes that the node's text is formatted as an ISO 8601 date, as specified by xs:dateTime. <p> This method can be expensive as a new xpath is instantiated per invocation. Consider passing in the xpath explicitly via { {@link #asDouble(String, Node, XPath)} instead. Note {@link XPath} is not thread-safe and not reentrant. @param expression The XPath expression to evaluate. @param node The node to run the expression on. @return The Date result. @throws XPathExpressionException If there was a problem processing the specified XPath expression. """ return asDate(expression, node, xpath()); }
java
public static Date asDate(String expression, Node node) throws XPathExpressionException { return asDate(expression, node, xpath()); }
[ "public", "static", "Date", "asDate", "(", "String", "expression", ",", "Node", "node", ")", "throws", "XPathExpressionException", "{", "return", "asDate", "(", "expression", ",", "node", ",", "xpath", "(", ")", ")", ";", "}" ]
Evaluates the specified XPath expression and returns the result as a Date. Assumes that the node's text is formatted as an ISO 8601 date, as specified by xs:dateTime. <p> This method can be expensive as a new xpath is instantiated per invocation. Consider passing in the xpath explicitly via { {@link #asDouble(String, Node, XPath)} instead. Note {@link XPath} is not thread-safe and not reentrant. @param expression The XPath expression to evaluate. @param node The node to run the expression on. @return The Date result. @throws XPathExpressionException If there was a problem processing the specified XPath expression.
[ "Evaluates", "the", "specified", "XPath", "expression", "and", "returns", "the", "result", "as", "a", "Date", ".", "Assumes", "that", "the", "node", "s", "text", "is", "formatted", "as", "an", "ISO", "8601", "date", "as", "specified", "by", "xs", ":", "dateTime", ".", "<p", ">", "This", "method", "can", "be", "expensive", "as", "a", "new", "xpath", "is", "instantiated", "per", "invocation", ".", "Consider", "passing", "in", "the", "xpath", "explicitly", "via", "{", "{", "@link", "#asDouble", "(", "String", "Node", "XPath", ")", "}", "instead", ".", "Note", "{", "@link", "XPath", "}", "is", "not", "thread", "-", "safe", "and", "not", "reentrant", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/XpathUtils.java#L453-L456
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java
SftpSubsystemChannel.getFile
public SftpFile getFile(String path) throws SftpStatusException, SshException { """ Utility method to obtain an {@link SftpFile} instance for a given path. @param path @return SftpFile @throws SftpStatusException @throws SshException """ String absolute = getAbsolutePath(path); SftpFile file = new SftpFile(absolute, getAttributes(absolute)); file.sftp = this; return file; }
java
public SftpFile getFile(String path) throws SftpStatusException, SshException { String absolute = getAbsolutePath(path); SftpFile file = new SftpFile(absolute, getAttributes(absolute)); file.sftp = this; return file; }
[ "public", "SftpFile", "getFile", "(", "String", "path", ")", "throws", "SftpStatusException", ",", "SshException", "{", "String", "absolute", "=", "getAbsolutePath", "(", "path", ")", ";", "SftpFile", "file", "=", "new", "SftpFile", "(", "absolute", ",", "getAttributes", "(", "absolute", ")", ")", ";", "file", ".", "sftp", "=", "this", ";", "return", "file", ";", "}" ]
Utility method to obtain an {@link SftpFile} instance for a given path. @param path @return SftpFile @throws SftpStatusException @throws SshException
[ "Utility", "method", "to", "obtain", "an", "{", "@link", "SftpFile", "}", "instance", "for", "a", "given", "path", "." ]
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java#L1175-L1181
jronrun/benayn
benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Retryer.java
Retryer.randomWait
public Retryer<R> randomWait(long maximum, TimeUnit timeUnit) { """ Sets the strategy that sleeps a random amount of time before retrying @param maximum @param timeUnit @return """ return randomWait(0L, checkNotNull(timeUnit).toMillis(maximum)); }
java
public Retryer<R> randomWait(long maximum, TimeUnit timeUnit) { return randomWait(0L, checkNotNull(timeUnit).toMillis(maximum)); }
[ "public", "Retryer", "<", "R", ">", "randomWait", "(", "long", "maximum", ",", "TimeUnit", "timeUnit", ")", "{", "return", "randomWait", "(", "0L", ",", "checkNotNull", "(", "timeUnit", ")", ".", "toMillis", "(", "maximum", ")", ")", ";", "}" ]
Sets the strategy that sleeps a random amount of time before retrying @param maximum @param timeUnit @return
[ "Sets", "the", "strategy", "that", "sleeps", "a", "random", "amount", "of", "time", "before", "retrying" ]
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Retryer.java#L390-L392
samskivert/samskivert
src/main/java/com/samskivert/util/QuickSort.java
QuickSort.rsort
public static <T> void rsort (T[] a, Comparator<? super T> comp) { """ Sorts the supplied array of objects from greatest to least, using the supplied comparator. """ rsort(a, 0, a.length - 1, comp); }
java
public static <T> void rsort (T[] a, Comparator<? super T> comp) { rsort(a, 0, a.length - 1, comp); }
[ "public", "static", "<", "T", ">", "void", "rsort", "(", "T", "[", "]", "a", ",", "Comparator", "<", "?", "super", "T", ">", "comp", ")", "{", "rsort", "(", "a", ",", "0", ",", "a", ".", "length", "-", "1", ",", "comp", ")", ";", "}" ]
Sorts the supplied array of objects from greatest to least, using the supplied comparator.
[ "Sorts", "the", "supplied", "array", "of", "objects", "from", "greatest", "to", "least", "using", "the", "supplied", "comparator", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/QuickSort.java#L36-L39
jhy/jsoup
src/main/java/org/jsoup/nodes/Entities.java
Entities.canEncode
private static boolean canEncode(final CoreCharset charset, final char c, final CharsetEncoder fallback) { """ /* Provides a fast-path for Encoder.canEncode, which drastically improves performance on Android post JellyBean. After KitKat, the implementation of canEncode degrades to the point of being useless. For non ASCII or UTF, performance may be bad. We can add more encoders for common character sets that are impacted by performance issues on Android if required. Benchmarks: * OLD toHtml() impl v New (fastpath) in millis Wiki: 1895, 16 CNN: 6378, 55 Alterslash: 3013, 28 Jsoup: 167, 2 """ // todo add more charset tests if impacted by Android's bad perf in canEncode switch (charset) { case ascii: return c < 0x80; case utf: return true; // real is:!(Character.isLowSurrogate(c) || Character.isHighSurrogate(c)); - but already check above default: return fallback.canEncode(c); } }
java
private static boolean canEncode(final CoreCharset charset, final char c, final CharsetEncoder fallback) { // todo add more charset tests if impacted by Android's bad perf in canEncode switch (charset) { case ascii: return c < 0x80; case utf: return true; // real is:!(Character.isLowSurrogate(c) || Character.isHighSurrogate(c)); - but already check above default: return fallback.canEncode(c); } }
[ "private", "static", "boolean", "canEncode", "(", "final", "CoreCharset", "charset", ",", "final", "char", "c", ",", "final", "CharsetEncoder", "fallback", ")", "{", "// todo add more charset tests if impacted by Android's bad perf in canEncode", "switch", "(", "charset", ")", "{", "case", "ascii", ":", "return", "c", "<", "0x80", ";", "case", "utf", ":", "return", "true", ";", "// real is:!(Character.isLowSurrogate(c) || Character.isHighSurrogate(c)); - but already check above", "default", ":", "return", "fallback", ".", "canEncode", "(", "c", ")", ";", "}", "}" ]
/* Provides a fast-path for Encoder.canEncode, which drastically improves performance on Android post JellyBean. After KitKat, the implementation of canEncode degrades to the point of being useless. For non ASCII or UTF, performance may be bad. We can add more encoders for common character sets that are impacted by performance issues on Android if required. Benchmarks: * OLD toHtml() impl v New (fastpath) in millis Wiki: 1895, 16 CNN: 6378, 55 Alterslash: 3013, 28 Jsoup: 167, 2
[ "/", "*", "Provides", "a", "fast", "-", "path", "for", "Encoder", ".", "canEncode", "which", "drastically", "improves", "performance", "on", "Android", "post", "JellyBean", ".", "After", "KitKat", "the", "implementation", "of", "canEncode", "degrades", "to", "the", "point", "of", "being", "useless", ".", "For", "non", "ASCII", "or", "UTF", "performance", "may", "be", "bad", ".", "We", "can", "add", "more", "encoders", "for", "common", "character", "sets", "that", "are", "impacted", "by", "performance", "issues", "on", "Android", "if", "required", "." ]
train
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Entities.java#L290-L300
Azure/autorest-clientruntime-for-java
azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java
AzureClient.getPutOrPatchResultAsync
public <T> Observable<ServiceResponse<T>> getPutOrPatchResultAsync(Observable<Response<ResponseBody>> observable, final Type resourceType) { """ Handles an initial response from a PUT or PATCH operation response by polling the status of the operation asynchronously, once the operation finishes emits the final response. @param observable the initial observable from the PUT or PATCH operation. @param resourceType the java.lang.reflect.Type of the resource. @param <T> the return type of the caller. @return the observable of which a subscription will lead to a final response. """ return this.<T>beginPutOrPatchAsync(observable, resourceType) .toObservable() .flatMap(new Func1<PollingState<T>, Observable<PollingState<T>>>() { @Override public Observable<PollingState<T>> call(PollingState<T> pollingState) { return pollPutOrPatchAsync(pollingState, resourceType); } }) .last() .map(new Func1<PollingState<T>, ServiceResponse<T>>() { @Override public ServiceResponse<T> call(PollingState<T> pollingState) { return new ServiceResponse<>(pollingState.resource(), pollingState.response()); } }); }
java
public <T> Observable<ServiceResponse<T>> getPutOrPatchResultAsync(Observable<Response<ResponseBody>> observable, final Type resourceType) { return this.<T>beginPutOrPatchAsync(observable, resourceType) .toObservable() .flatMap(new Func1<PollingState<T>, Observable<PollingState<T>>>() { @Override public Observable<PollingState<T>> call(PollingState<T> pollingState) { return pollPutOrPatchAsync(pollingState, resourceType); } }) .last() .map(new Func1<PollingState<T>, ServiceResponse<T>>() { @Override public ServiceResponse<T> call(PollingState<T> pollingState) { return new ServiceResponse<>(pollingState.resource(), pollingState.response()); } }); }
[ "public", "<", "T", ">", "Observable", "<", "ServiceResponse", "<", "T", ">", ">", "getPutOrPatchResultAsync", "(", "Observable", "<", "Response", "<", "ResponseBody", ">", ">", "observable", ",", "final", "Type", "resourceType", ")", "{", "return", "this", ".", "<", "T", ">", "beginPutOrPatchAsync", "(", "observable", ",", "resourceType", ")", ".", "toObservable", "(", ")", ".", "flatMap", "(", "new", "Func1", "<", "PollingState", "<", "T", ">", ",", "Observable", "<", "PollingState", "<", "T", ">", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "PollingState", "<", "T", ">", ">", "call", "(", "PollingState", "<", "T", ">", "pollingState", ")", "{", "return", "pollPutOrPatchAsync", "(", "pollingState", ",", "resourceType", ")", ";", "}", "}", ")", ".", "last", "(", ")", ".", "map", "(", "new", "Func1", "<", "PollingState", "<", "T", ">", ",", "ServiceResponse", "<", "T", ">", ">", "(", ")", "{", "@", "Override", "public", "ServiceResponse", "<", "T", ">", "call", "(", "PollingState", "<", "T", ">", "pollingState", ")", "{", "return", "new", "ServiceResponse", "<>", "(", "pollingState", ".", "resource", "(", ")", ",", "pollingState", ".", "response", "(", ")", ")", ";", "}", "}", ")", ";", "}" ]
Handles an initial response from a PUT or PATCH operation response by polling the status of the operation asynchronously, once the operation finishes emits the final response. @param observable the initial observable from the PUT or PATCH operation. @param resourceType the java.lang.reflect.Type of the resource. @param <T> the return type of the caller. @return the observable of which a subscription will lead to a final response.
[ "Handles", "an", "initial", "response", "from", "a", "PUT", "or", "PATCH", "operation", "response", "by", "polling", "the", "status", "of", "the", "operation", "asynchronously", "once", "the", "operation", "finishes", "emits", "the", "final", "response", "." ]
train
https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java#L125-L141
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/text/StrBuilder.java
StrBuilder.leftString
public String leftString(final int length) { """ Extracts the leftmost characters from the string builder without throwing an exception. <p> This method extracts the left <code>length</code> characters from the builder. If this many characters are not available, the whole builder is returned. Thus the returned string may be shorter than the length requested. @param length the number of characters to extract, negative returns empty string @return the new string """ if (length <= 0) { return StringUtils.EMPTY; } else if (length >= size) { return new String(buffer, 0, size); } else { return new String(buffer, 0, length); } }
java
public String leftString(final int length) { if (length <= 0) { return StringUtils.EMPTY; } else if (length >= size) { return new String(buffer, 0, size); } else { return new String(buffer, 0, length); } }
[ "public", "String", "leftString", "(", "final", "int", "length", ")", "{", "if", "(", "length", "<=", "0", ")", "{", "return", "StringUtils", ".", "EMPTY", ";", "}", "else", "if", "(", "length", ">=", "size", ")", "{", "return", "new", "String", "(", "buffer", ",", "0", ",", "size", ")", ";", "}", "else", "{", "return", "new", "String", "(", "buffer", ",", "0", ",", "length", ")", ";", "}", "}" ]
Extracts the leftmost characters from the string builder without throwing an exception. <p> This method extracts the left <code>length</code> characters from the builder. If this many characters are not available, the whole builder is returned. Thus the returned string may be shorter than the length requested. @param length the number of characters to extract, negative returns empty string @return the new string
[ "Extracts", "the", "leftmost", "characters", "from", "the", "string", "builder", "without", "throwing", "an", "exception", ".", "<p", ">", "This", "method", "extracts", "the", "left", "<code", ">", "length<", "/", "code", ">", "characters", "from", "the", "builder", ".", "If", "this", "many", "characters", "are", "not", "available", "the", "whole", "builder", "is", "returned", ".", "Thus", "the", "returned", "string", "may", "be", "shorter", "than", "the", "length", "requested", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L2296-L2304
hankcs/HanLP
src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java
MDAG.replaceOrRegister
private void replaceOrRegister(MDAGNode originNode, String str) { """ 在从给定节点开始的一段路径上执行最小化<br> Performs minimization processing on a _transition path starting from a given node. <p/> This entails either replacing a node in the path with one that has an equivalent right language/equivalence class (defined as set of _transition paths that can be traversed and nodes able to be reached from it), or making it a representative of a right language/equivalence class if a such a node does not already exist. @param originNode the MDAGNode that the _transition path corresponding to str starts from @param str a String related to a _transition path """ char transitionLabelChar = str.charAt(0); MDAGNode relevantTargetNode = originNode.transition(transitionLabelChar); //If relevantTargetNode has transitions and there is at least one char left to process, recursively call //this on the next char in order to further processing down the _transition path corresponding to str if (relevantTargetNode.hasTransitions() && !str.substring(1).isEmpty()) replaceOrRegister(relevantTargetNode, str.substring(1)); ///// //Get the node representing the equivalence class that relevantTargetNode belongs to. MDAGNodes hash on the //transitions paths that can be traversed from them and nodes able to be reached from them; //nodes with the same equivalence classes will hash to the same bucket. MDAGNode equivalentNode = equivalenceClassMDAGNodeHashMap.get(relevantTargetNode); if (equivalentNode == null) //if there is no node with the same right language as relevantTargetNode equivalenceClassMDAGNodeHashMap.put(relevantTargetNode, relevantTargetNode); else if (equivalentNode != relevantTargetNode) //if there is another node with the same right language as relevantTargetNode, reassign the { //_transition between originNode and relevantTargetNode, to originNode and the node representing the equivalence class of interest relevantTargetNode.decrementTargetIncomingTransitionCounts(); transitionCount -= relevantTargetNode.getOutgoingTransitionCount(); //Since this method is recursive, the outgoing transitions of all of relevantTargetNode's child nodes have already been reassigned, //so we only need to decrement the _transition count by the relevantTargetNode's outgoing _transition count originNode.reassignOutgoingTransition(transitionLabelChar, relevantTargetNode, equivalentNode); } }
java
private void replaceOrRegister(MDAGNode originNode, String str) { char transitionLabelChar = str.charAt(0); MDAGNode relevantTargetNode = originNode.transition(transitionLabelChar); //If relevantTargetNode has transitions and there is at least one char left to process, recursively call //this on the next char in order to further processing down the _transition path corresponding to str if (relevantTargetNode.hasTransitions() && !str.substring(1).isEmpty()) replaceOrRegister(relevantTargetNode, str.substring(1)); ///// //Get the node representing the equivalence class that relevantTargetNode belongs to. MDAGNodes hash on the //transitions paths that can be traversed from them and nodes able to be reached from them; //nodes with the same equivalence classes will hash to the same bucket. MDAGNode equivalentNode = equivalenceClassMDAGNodeHashMap.get(relevantTargetNode); if (equivalentNode == null) //if there is no node with the same right language as relevantTargetNode equivalenceClassMDAGNodeHashMap.put(relevantTargetNode, relevantTargetNode); else if (equivalentNode != relevantTargetNode) //if there is another node with the same right language as relevantTargetNode, reassign the { //_transition between originNode and relevantTargetNode, to originNode and the node representing the equivalence class of interest relevantTargetNode.decrementTargetIncomingTransitionCounts(); transitionCount -= relevantTargetNode.getOutgoingTransitionCount(); //Since this method is recursive, the outgoing transitions of all of relevantTargetNode's child nodes have already been reassigned, //so we only need to decrement the _transition count by the relevantTargetNode's outgoing _transition count originNode.reassignOutgoingTransition(transitionLabelChar, relevantTargetNode, equivalentNode); } }
[ "private", "void", "replaceOrRegister", "(", "MDAGNode", "originNode", ",", "String", "str", ")", "{", "char", "transitionLabelChar", "=", "str", ".", "charAt", "(", "0", ")", ";", "MDAGNode", "relevantTargetNode", "=", "originNode", ".", "transition", "(", "transitionLabelChar", ")", ";", "//If relevantTargetNode has transitions and there is at least one char left to process, recursively call ", "//this on the next char in order to further processing down the _transition path corresponding to str", "if", "(", "relevantTargetNode", ".", "hasTransitions", "(", ")", "&&", "!", "str", ".", "substring", "(", "1", ")", ".", "isEmpty", "(", ")", ")", "replaceOrRegister", "(", "relevantTargetNode", ",", "str", ".", "substring", "(", "1", ")", ")", ";", "/////", "//Get the node representing the equivalence class that relevantTargetNode belongs to. MDAGNodes hash on the", "//transitions paths that can be traversed from them and nodes able to be reached from them;", "//nodes with the same equivalence classes will hash to the same bucket.", "MDAGNode", "equivalentNode", "=", "equivalenceClassMDAGNodeHashMap", ".", "get", "(", "relevantTargetNode", ")", ";", "if", "(", "equivalentNode", "==", "null", ")", "//if there is no node with the same right language as relevantTargetNode", "equivalenceClassMDAGNodeHashMap", ".", "put", "(", "relevantTargetNode", ",", "relevantTargetNode", ")", ";", "else", "if", "(", "equivalentNode", "!=", "relevantTargetNode", ")", "//if there is another node with the same right language as relevantTargetNode, reassign the", "{", "//_transition between originNode and relevantTargetNode, to originNode and the node representing the equivalence class of interest", "relevantTargetNode", ".", "decrementTargetIncomingTransitionCounts", "(", ")", ";", "transitionCount", "-=", "relevantTargetNode", ".", "getOutgoingTransitionCount", "(", ")", ";", "//Since this method is recursive, the outgoing transitions of all of relevantTargetNode's child nodes have already been reassigned, ", "//so we only need to decrement the _transition count by the relevantTargetNode's outgoing _transition count", "originNode", ".", "reassignOutgoingTransition", "(", "transitionLabelChar", ",", "relevantTargetNode", ",", "equivalentNode", ")", ";", "}", "}" ]
在从给定节点开始的一段路径上执行最小化<br> Performs minimization processing on a _transition path starting from a given node. <p/> This entails either replacing a node in the path with one that has an equivalent right language/equivalence class (defined as set of _transition paths that can be traversed and nodes able to be reached from it), or making it a representative of a right language/equivalence class if a such a node does not already exist. @param originNode the MDAGNode that the _transition path corresponding to str starts from @param str a String related to a _transition path
[ "在从给定节点开始的一段路径上执行最小化<br", ">", "Performs", "minimization", "processing", "on", "a", "_transition", "path", "starting", "from", "a", "given", "node", ".", "<p", "/", ">", "This", "entails", "either", "replacing", "a", "node", "in", "the", "path", "with", "one", "that", "has", "an", "equivalent", "right", "language", "/", "equivalence", "class", "(", "defined", "as", "set", "of", "_transition", "paths", "that", "can", "be", "traversed", "and", "nodes", "able", "to", "be", "reached", "from", "it", ")", "or", "making", "it", "a", "representative", "of", "a", "right", "language", "/", "equivalence", "class", "if", "a", "such", "a", "node", "does", "not", "already", "exist", "." ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java#L539-L564
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.defineInternalFrameMaximizeButton
private void defineInternalFrameMaximizeButton(UIDefaults d) { """ Initialize the internal frame maximize button settings. @param d the UI defaults map. """ String p = "InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.maximizeButton\""; String c = PAINTER_PREFIX + "TitlePaneMaximizeButtonPainter"; d.put(p + ".WindowNotFocused", new TitlePaneMaximizeButtonWindowNotFocusedState()); d.put(p + ".WindowMaximized", new TitlePaneMaximizeButtonWindowMaximizedState()); d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0)); // Set the maximize button states. d.put(p + "[Disabled].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_DISABLED)); d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_ENABLED)); d.put(p + "[MouseOver].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MOUSEOVER)); d.put(p + "[Pressed].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_PRESSED)); d.put(p + "[Enabled+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_ENABLED_WINDOWNOTFOCUSED)); d.put(p + "[MouseOver+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MOUSEOVER_WINDOWNOTFOCUSED)); d.put(p + "[Pressed+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_PRESSED_WINDOWNOTFOCUSED)); // Set the restore button states. d.put(p + "[Disabled+WindowMaximized].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_DISABLED)); d.put(p + "[Enabled+WindowMaximized].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_ENABLED)); d.put(p + "[MouseOver+WindowMaximized].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_MOUSEOVER)); d.put(p + "[Pressed+WindowMaximized].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_PRESSED)); d.put(p + "[Enabled+WindowMaximized+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_ENABLED_WINDOWNOTFOCUSED)); d.put(p + "[MouseOver+WindowMaximized+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_MOUSEOVER_WINDOWNOTFOCUSED)); d.put(p + "[Pressed+WindowMaximized+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_PRESSED_WINDOWNOTFOCUSED)); d.put(p + ".icon", new SeaGlassIcon(p, "iconPainter", 25, 18)); }
java
private void defineInternalFrameMaximizeButton(UIDefaults d) { String p = "InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.maximizeButton\""; String c = PAINTER_PREFIX + "TitlePaneMaximizeButtonPainter"; d.put(p + ".WindowNotFocused", new TitlePaneMaximizeButtonWindowNotFocusedState()); d.put(p + ".WindowMaximized", new TitlePaneMaximizeButtonWindowMaximizedState()); d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0)); // Set the maximize button states. d.put(p + "[Disabled].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_DISABLED)); d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_ENABLED)); d.put(p + "[MouseOver].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MOUSEOVER)); d.put(p + "[Pressed].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_PRESSED)); d.put(p + "[Enabled+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_ENABLED_WINDOWNOTFOCUSED)); d.put(p + "[MouseOver+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MOUSEOVER_WINDOWNOTFOCUSED)); d.put(p + "[Pressed+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_PRESSED_WINDOWNOTFOCUSED)); // Set the restore button states. d.put(p + "[Disabled+WindowMaximized].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_DISABLED)); d.put(p + "[Enabled+WindowMaximized].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_ENABLED)); d.put(p + "[MouseOver+WindowMaximized].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_MOUSEOVER)); d.put(p + "[Pressed+WindowMaximized].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_PRESSED)); d.put(p + "[Enabled+WindowMaximized+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_ENABLED_WINDOWNOTFOCUSED)); d.put(p + "[MouseOver+WindowMaximized+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_MOUSEOVER_WINDOWNOTFOCUSED)); d.put(p + "[Pressed+WindowMaximized+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_PRESSED_WINDOWNOTFOCUSED)); d.put(p + ".icon", new SeaGlassIcon(p, "iconPainter", 25, 18)); }
[ "private", "void", "defineInternalFrameMaximizeButton", "(", "UIDefaults", "d", ")", "{", "String", "p", "=", "\"InternalFrame:InternalFrameTitlePane:\\\"InternalFrameTitlePane.maximizeButton\\\"\"", ";", "String", "c", "=", "PAINTER_PREFIX", "+", "\"TitlePaneMaximizeButtonPainter\"", ";", "d", ".", "put", "(", "p", "+", "\".WindowNotFocused\"", ",", "new", "TitlePaneMaximizeButtonWindowNotFocusedState", "(", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".WindowMaximized\"", ",", "new", "TitlePaneMaximizeButtonWindowMaximizedState", "(", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".contentMargins\"", ",", "new", "InsetsUIResource", "(", "0", ",", "0", ",", "0", ",", "0", ")", ")", ";", "// Set the maximize button states.", "d", ".", "put", "(", "p", "+", "\"[Disabled].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_DISABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_ENABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[MouseOver].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_MOUSEOVER", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Pressed].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_PRESSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled+WindowNotFocused].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_ENABLED_WINDOWNOTFOCUSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[MouseOver+WindowNotFocused].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_MOUSEOVER_WINDOWNOTFOCUSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Pressed+WindowNotFocused].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_PRESSED_WINDOWNOTFOCUSED", ")", ")", ";", "// Set the restore button states.", "d", ".", "put", "(", "p", "+", "\"[Disabled+WindowMaximized].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_MAXIMIZED_DISABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled+WindowMaximized].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_MAXIMIZED_ENABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[MouseOver+WindowMaximized].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_MAXIMIZED_MOUSEOVER", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Pressed+WindowMaximized].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_MAXIMIZED_PRESSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled+WindowMaximized+WindowNotFocused].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_MAXIMIZED_ENABLED_WINDOWNOTFOCUSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[MouseOver+WindowMaximized+WindowNotFocused].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_MAXIMIZED_MOUSEOVER_WINDOWNOTFOCUSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Pressed+WindowMaximized+WindowNotFocused].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_MAXIMIZED_PRESSED_WINDOWNOTFOCUSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".icon\"", ",", "new", "SeaGlassIcon", "(", "p", ",", "\"iconPainter\"", ",", "25", ",", "18", ")", ")", ";", "}" ]
Initialize the internal frame maximize button settings. @param d the UI defaults map.
[ "Initialize", "the", "internal", "frame", "maximize", "button", "settings", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L1308-L1355
aws/aws-sdk-java
aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/UpdateGatewayResponseResult.java
UpdateGatewayResponseResult.withResponseTemplates
public UpdateGatewayResponseResult withResponseTemplates(java.util.Map<String, String> responseTemplates) { """ <p> Response templates of the <a>GatewayResponse</a> as a string-to-string map of key-value pairs. </p> @param responseTemplates Response templates of the <a>GatewayResponse</a> as a string-to-string map of key-value pairs. @return Returns a reference to this object so that method calls can be chained together. """ setResponseTemplates(responseTemplates); return this; }
java
public UpdateGatewayResponseResult withResponseTemplates(java.util.Map<String, String> responseTemplates) { setResponseTemplates(responseTemplates); return this; }
[ "public", "UpdateGatewayResponseResult", "withResponseTemplates", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "responseTemplates", ")", "{", "setResponseTemplates", "(", "responseTemplates", ")", ";", "return", "this", ";", "}" ]
<p> Response templates of the <a>GatewayResponse</a> as a string-to-string map of key-value pairs. </p> @param responseTemplates Response templates of the <a>GatewayResponse</a> as a string-to-string map of key-value pairs. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Response", "templates", "of", "the", "<a", ">", "GatewayResponse<", "/", "a", ">", "as", "a", "string", "-", "to", "-", "string", "map", "of", "key", "-", "value", "pairs", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/UpdateGatewayResponseResult.java#L544-L547
hazelcast/hazelcast
hazelcast-client/src/main/java/com/hazelcast/client/config/ClientConfig.java
ClientConfig.setReliableTopicConfigMap
public ClientConfig setReliableTopicConfigMap(Map<String, ClientReliableTopicConfig> map) { """ Sets the map of {@link ClientReliableTopicConfig}, mapped by config name. The config name may be a pattern with which the configuration will be obtained in the future. @param map the FlakeIdGenerator configuration map to set @return this config instance """ Preconditions.isNotNull(map, "reliableTopicConfigMap"); reliableTopicConfigMap.clear(); reliableTopicConfigMap.putAll(map); for (Entry<String, ClientReliableTopicConfig> entry : map.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; }
java
public ClientConfig setReliableTopicConfigMap(Map<String, ClientReliableTopicConfig> map) { Preconditions.isNotNull(map, "reliableTopicConfigMap"); reliableTopicConfigMap.clear(); reliableTopicConfigMap.putAll(map); for (Entry<String, ClientReliableTopicConfig> entry : map.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; }
[ "public", "ClientConfig", "setReliableTopicConfigMap", "(", "Map", "<", "String", ",", "ClientReliableTopicConfig", ">", "map", ")", "{", "Preconditions", ".", "isNotNull", "(", "map", ",", "\"reliableTopicConfigMap\"", ")", ";", "reliableTopicConfigMap", ".", "clear", "(", ")", ";", "reliableTopicConfigMap", ".", "putAll", "(", "map", ")", ";", "for", "(", "Entry", "<", "String", ",", "ClientReliableTopicConfig", ">", "entry", ":", "map", ".", "entrySet", "(", ")", ")", "{", "entry", ".", "getValue", "(", ")", ".", "setName", "(", "entry", ".", "getKey", "(", ")", ")", ";", "}", "return", "this", ";", "}" ]
Sets the map of {@link ClientReliableTopicConfig}, mapped by config name. The config name may be a pattern with which the configuration will be obtained in the future. @param map the FlakeIdGenerator configuration map to set @return this config instance
[ "Sets", "the", "map", "of", "{", "@link", "ClientReliableTopicConfig", "}", "mapped", "by", "config", "name", ".", "The", "config", "name", "may", "be", "a", "pattern", "with", "which", "the", "configuration", "will", "be", "obtained", "in", "the", "future", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast-client/src/main/java/com/hazelcast/client/config/ClientConfig.java#L523-L531
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/csv/CSVParser.java
CSVParser.parseLineMulti
@Nullable public ICommonsList <String> parseLineMulti (@Nullable final String sNextLine) throws IOException { """ Parses an incoming String and returns an array of elements. This method is used when the data spans multiple lines. @param sNextLine current line to be processed @return the tokenized list of elements, or <code>null</code> if nextLine is <code>null</code> @throws IOException if bad things happen during the read """ return _parseLine (sNextLine, true); }
java
@Nullable public ICommonsList <String> parseLineMulti (@Nullable final String sNextLine) throws IOException { return _parseLine (sNextLine, true); }
[ "@", "Nullable", "public", "ICommonsList", "<", "String", ">", "parseLineMulti", "(", "@", "Nullable", "final", "String", "sNextLine", ")", "throws", "IOException", "{", "return", "_parseLine", "(", "sNextLine", ",", "true", ")", ";", "}" ]
Parses an incoming String and returns an array of elements. This method is used when the data spans multiple lines. @param sNextLine current line to be processed @return the tokenized list of elements, or <code>null</code> if nextLine is <code>null</code> @throws IOException if bad things happen during the read
[ "Parses", "an", "incoming", "String", "and", "returns", "an", "array", "of", "elements", ".", "This", "method", "is", "used", "when", "the", "data", "spans", "multiple", "lines", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/csv/CSVParser.java#L286-L290
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Times.java
Times.isSameWeek
public static boolean isSameWeek(final Date date1, final Date date2) { """ Determines whether the specified date1 is the same week with the specified date2. @param date1 the specified date1 @param date2 the specified date2 @return {@code true} if it is the same week, returns {@code false} otherwise """ final Calendar cal1 = Calendar.getInstance(); cal1.setFirstDayOfWeek(Calendar.MONDAY); cal1.setTime(date1); final Calendar cal2 = Calendar.getInstance(); cal2.setFirstDayOfWeek(Calendar.MONDAY); cal2.setTime(date2); return cal1.get(Calendar.ERA) == cal2.get(Calendar.ERA) && cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) && cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR); }
java
public static boolean isSameWeek(final Date date1, final Date date2) { final Calendar cal1 = Calendar.getInstance(); cal1.setFirstDayOfWeek(Calendar.MONDAY); cal1.setTime(date1); final Calendar cal2 = Calendar.getInstance(); cal2.setFirstDayOfWeek(Calendar.MONDAY); cal2.setTime(date2); return cal1.get(Calendar.ERA) == cal2.get(Calendar.ERA) && cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) && cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR); }
[ "public", "static", "boolean", "isSameWeek", "(", "final", "Date", "date1", ",", "final", "Date", "date2", ")", "{", "final", "Calendar", "cal1", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal1", ".", "setFirstDayOfWeek", "(", "Calendar", ".", "MONDAY", ")", ";", "cal1", ".", "setTime", "(", "date1", ")", ";", "final", "Calendar", "cal2", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal2", ".", "setFirstDayOfWeek", "(", "Calendar", ".", "MONDAY", ")", ";", "cal2", ".", "setTime", "(", "date2", ")", ";", "return", "cal1", ".", "get", "(", "Calendar", ".", "ERA", ")", "==", "cal2", ".", "get", "(", "Calendar", ".", "ERA", ")", "&&", "cal1", ".", "get", "(", "Calendar", ".", "YEAR", ")", "==", "cal2", ".", "get", "(", "Calendar", ".", "YEAR", ")", "&&", "cal1", ".", "get", "(", "Calendar", ".", "WEEK_OF_YEAR", ")", "==", "cal2", ".", "get", "(", "Calendar", ".", "WEEK_OF_YEAR", ")", ";", "}" ]
Determines whether the specified date1 is the same week with the specified date2. @param date1 the specified date1 @param date2 the specified date2 @return {@code true} if it is the same week, returns {@code false} otherwise
[ "Determines", "whether", "the", "specified", "date1", "is", "the", "same", "week", "with", "the", "specified", "date2", "." ]
train
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Times.java#L142-L154
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ModelSerializer.java
ModelSerializer.writeModel
public static void writeModel(@NonNull Model model, @NonNull OutputStream stream, boolean saveUpdater) throws IOException { """ Write a model to an output stream @param model the model to save @param stream the output stream to write to @param saveUpdater whether to save the updater for the model or not @throws IOException """ writeModel(model,stream,saveUpdater,null); }
java
public static void writeModel(@NonNull Model model, @NonNull OutputStream stream, boolean saveUpdater) throws IOException { writeModel(model,stream,saveUpdater,null); }
[ "public", "static", "void", "writeModel", "(", "@", "NonNull", "Model", "model", ",", "@", "NonNull", "OutputStream", "stream", ",", "boolean", "saveUpdater", ")", "throws", "IOException", "{", "writeModel", "(", "model", ",", "stream", ",", "saveUpdater", ",", "null", ")", ";", "}" ]
Write a model to an output stream @param model the model to save @param stream the output stream to write to @param saveUpdater whether to save the updater for the model or not @throws IOException
[ "Write", "a", "model", "to", "an", "output", "stream" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ModelSerializer.java#L117-L120
hsiafan/requests
src/main/java/net/dongliu/requests/body/Part.java
Part.param
@Deprecated public static Part<String> param(String name, String value) { """ Create a (name, value) text multi-part field. This return a part equivalent to &lt;input type="text" /&gt; field in multi part form. @deprecated use {@link #text(String, String)} instead. """ return text(name, value); }
java
@Deprecated public static Part<String> param(String name, String value) { return text(name, value); }
[ "@", "Deprecated", "public", "static", "Part", "<", "String", ">", "param", "(", "String", "name", ",", "String", "value", ")", "{", "return", "text", "(", "name", ",", "value", ")", ";", "}" ]
Create a (name, value) text multi-part field. This return a part equivalent to &lt;input type="text" /&gt; field in multi part form. @deprecated use {@link #text(String, String)} instead.
[ "Create", "a", "(", "name", "value", ")", "text", "multi", "-", "part", "field", ".", "This", "return", "a", "part", "equivalent", "to", "&lt", ";", "input", "type", "=", "text", "/", "&gt", ";", "field", "in", "multi", "part", "form", "." ]
train
https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/body/Part.java#L157-L160
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/version/Version.java
Version.isBetween
public boolean isBetween(Version from, Version to) { """ Checks if the version is between specified version (both ends inclusive) @param from @param to @return true if the version is between from and to (both ends inclusive) """ int thisVersion = this.pack(); int fromVersion = from.pack(); int toVersion = to.pack(); return thisVersion >= fromVersion && thisVersion <= toVersion; }
java
public boolean isBetween(Version from, Version to) { int thisVersion = this.pack(); int fromVersion = from.pack(); int toVersion = to.pack(); return thisVersion >= fromVersion && thisVersion <= toVersion; }
[ "public", "boolean", "isBetween", "(", "Version", "from", ",", "Version", "to", ")", "{", "int", "thisVersion", "=", "this", ".", "pack", "(", ")", ";", "int", "fromVersion", "=", "from", ".", "pack", "(", ")", ";", "int", "toVersion", "=", "to", ".", "pack", "(", ")", ";", "return", "thisVersion", ">=", "fromVersion", "&&", "thisVersion", "<=", "toVersion", ";", "}" ]
Checks if the version is between specified version (both ends inclusive) @param from @param to @return true if the version is between from and to (both ends inclusive)
[ "Checks", "if", "the", "version", "is", "between", "specified", "version", "(", "both", "ends", "inclusive", ")" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/version/Version.java#L239-L244
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/ellipse/BinaryEllipseDetectorPixel.java
BinaryEllipseDetectorPixel.isApproximatelyElliptical
boolean isApproximatelyElliptical(EllipseRotated_F64 ellipse , List<Point2D_F64> points , int maxSamples ) { """ Look at the maximum distance contour points are from the ellipse and see if they exceed a maximum threshold """ closestPoint.setEllipse(ellipse); double maxDistance2 = maxDistanceFromEllipse*maxDistanceFromEllipse; if( points.size() <= maxSamples ) { for( int i = 0; i < points.size(); i++ ) { Point2D_F64 p = points.get(i); closestPoint.process(p); double d = closestPoint.getClosest().distance2(p); if( d > maxDistance2 ) { return false; } } } else { for (int i = 0; i < maxSamples; i++) { Point2D_F64 p = points.get( i*points.size()/maxSamples ); closestPoint.process(p); double d = closestPoint.getClosest().distance2(p); if( d > maxDistance2 ) { return false; } } } return true; }
java
boolean isApproximatelyElliptical(EllipseRotated_F64 ellipse , List<Point2D_F64> points , int maxSamples ) { closestPoint.setEllipse(ellipse); double maxDistance2 = maxDistanceFromEllipse*maxDistanceFromEllipse; if( points.size() <= maxSamples ) { for( int i = 0; i < points.size(); i++ ) { Point2D_F64 p = points.get(i); closestPoint.process(p); double d = closestPoint.getClosest().distance2(p); if( d > maxDistance2 ) { return false; } } } else { for (int i = 0; i < maxSamples; i++) { Point2D_F64 p = points.get( i*points.size()/maxSamples ); closestPoint.process(p); double d = closestPoint.getClosest().distance2(p); if( d > maxDistance2 ) { return false; } } } return true; }
[ "boolean", "isApproximatelyElliptical", "(", "EllipseRotated_F64", "ellipse", ",", "List", "<", "Point2D_F64", ">", "points", ",", "int", "maxSamples", ")", "{", "closestPoint", ".", "setEllipse", "(", "ellipse", ")", ";", "double", "maxDistance2", "=", "maxDistanceFromEllipse", "*", "maxDistanceFromEllipse", ";", "if", "(", "points", ".", "size", "(", ")", "<=", "maxSamples", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "points", ".", "size", "(", ")", ";", "i", "++", ")", "{", "Point2D_F64", "p", "=", "points", ".", "get", "(", "i", ")", ";", "closestPoint", ".", "process", "(", "p", ")", ";", "double", "d", "=", "closestPoint", ".", "getClosest", "(", ")", ".", "distance2", "(", "p", ")", ";", "if", "(", "d", ">", "maxDistance2", ")", "{", "return", "false", ";", "}", "}", "}", "else", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "maxSamples", ";", "i", "++", ")", "{", "Point2D_F64", "p", "=", "points", ".", "get", "(", "i", "*", "points", ".", "size", "(", ")", "/", "maxSamples", ")", ";", "closestPoint", ".", "process", "(", "p", ")", ";", "double", "d", "=", "closestPoint", ".", "getClosest", "(", ")", ".", "distance2", "(", "p", ")", ";", "if", "(", "d", ">", "maxDistance2", ")", "{", "return", "false", ";", "}", "}", "}", "return", "true", ";", "}" ]
Look at the maximum distance contour points are from the ellipse and see if they exceed a maximum threshold
[ "Look", "at", "the", "maximum", "distance", "contour", "points", "are", "from", "the", "ellipse", "and", "see", "if", "they", "exceed", "a", "maximum", "threshold" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/ellipse/BinaryEllipseDetectorPixel.java#L255-L283
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/module/engagement/logic/ConditionalClause.java
ConditionalClause.evaluate
@Override public boolean evaluate(FieldManager fieldManager, IndentPrinter printer) { """ The test in this conditional clause are implicitly ANDed together, so return false if any of them is false, and continue the loop for each test that is true; @return """ Comparable fieldValue = fieldManager.getValue(fieldName); for (ConditionalTest test : conditionalTests) { boolean result = test.operator.apply(fieldValue, test.parameter); printer.print("- %s => %b", test.operator.description(fieldManager.getDescription(fieldName), fieldValue, test.parameter), result); if (!result) { return false; } } return true; }
java
@Override public boolean evaluate(FieldManager fieldManager, IndentPrinter printer) { Comparable fieldValue = fieldManager.getValue(fieldName); for (ConditionalTest test : conditionalTests) { boolean result = test.operator.apply(fieldValue, test.parameter); printer.print("- %s => %b", test.operator.description(fieldManager.getDescription(fieldName), fieldValue, test.parameter), result); if (!result) { return false; } } return true; }
[ "@", "Override", "public", "boolean", "evaluate", "(", "FieldManager", "fieldManager", ",", "IndentPrinter", "printer", ")", "{", "Comparable", "fieldValue", "=", "fieldManager", ".", "getValue", "(", "fieldName", ")", ";", "for", "(", "ConditionalTest", "test", ":", "conditionalTests", ")", "{", "boolean", "result", "=", "test", ".", "operator", ".", "apply", "(", "fieldValue", ",", "test", ".", "parameter", ")", ";", "printer", ".", "print", "(", "\"- %s => %b\"", ",", "test", ".", "operator", ".", "description", "(", "fieldManager", ".", "getDescription", "(", "fieldName", ")", ",", "fieldValue", ",", "test", ".", "parameter", ")", ",", "result", ")", ";", "if", "(", "!", "result", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
The test in this conditional clause are implicitly ANDed together, so return false if any of them is false, and continue the loop for each test that is true; @return
[ "The", "test", "in", "this", "conditional", "clause", "are", "implicitly", "ANDed", "together", "so", "return", "false", "if", "any", "of", "them", "is", "false", "and", "continue", "the", "loop", "for", "each", "test", "that", "is", "true", ";" ]
train
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/module/engagement/logic/ConditionalClause.java#L66-L77
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTree.java
WTree.selectionsEqual
private boolean selectionsEqual(final Set<?> set1, final Set<?> set2) { """ Selection lists are considered equal if they have the same items (order is not important). An empty list is considered equal to a null list. @param set1 the first list to check. @param set2 the second list to check. @return true if the lists are equal, false otherwise. """ // Empty or null lists if ((set1 == null || set1.isEmpty()) && (set2 == null || set2.isEmpty())) { return true; } // Same size and contain same entries return set1 != null && set2 != null && set1.size() == set2.size() && set1. containsAll(set2); }
java
private boolean selectionsEqual(final Set<?> set1, final Set<?> set2) { // Empty or null lists if ((set1 == null || set1.isEmpty()) && (set2 == null || set2.isEmpty())) { return true; } // Same size and contain same entries return set1 != null && set2 != null && set1.size() == set2.size() && set1. containsAll(set2); }
[ "private", "boolean", "selectionsEqual", "(", "final", "Set", "<", "?", ">", "set1", ",", "final", "Set", "<", "?", ">", "set2", ")", "{", "// Empty or null lists", "if", "(", "(", "set1", "==", "null", "||", "set1", ".", "isEmpty", "(", ")", ")", "&&", "(", "set2", "==", "null", "||", "set2", ".", "isEmpty", "(", ")", ")", ")", "{", "return", "true", ";", "}", "// Same size and contain same entries", "return", "set1", "!=", "null", "&&", "set2", "!=", "null", "&&", "set1", ".", "size", "(", ")", "==", "set2", ".", "size", "(", ")", "&&", "set1", ".", "containsAll", "(", "set2", ")", ";", "}" ]
Selection lists are considered equal if they have the same items (order is not important). An empty list is considered equal to a null list. @param set1 the first list to check. @param set2 the second list to check. @return true if the lists are equal, false otherwise.
[ "Selection", "lists", "are", "considered", "equal", "if", "they", "have", "the", "same", "items", "(", "order", "is", "not", "important", ")", ".", "An", "empty", "list", "is", "considered", "equal", "to", "a", "null", "list", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTree.java#L851-L860
UrielCh/ovh-java-sdk
ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java
ApiOvhIp.ip_delegation_target_DELETE
public void ip_delegation_target_DELETE(String ip, String target) throws IOException { """ Delete a target for reverse delegation on IPv6 subnet REST: DELETE /ip/{ip}/delegation/{target} @param ip [required] @param target [required] NS target for delegation """ String qPath = "/ip/{ip}/delegation/{target}"; StringBuilder sb = path(qPath, ip, target); exec(qPath, "DELETE", sb.toString(), null); }
java
public void ip_delegation_target_DELETE(String ip, String target) throws IOException { String qPath = "/ip/{ip}/delegation/{target}"; StringBuilder sb = path(qPath, ip, target); exec(qPath, "DELETE", sb.toString(), null); }
[ "public", "void", "ip_delegation_target_DELETE", "(", "String", "ip", ",", "String", "target", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ip/{ip}/delegation/{target}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "ip", ",", "target", ")", ";", "exec", "(", "qPath", ",", "\"DELETE\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "}" ]
Delete a target for reverse delegation on IPv6 subnet REST: DELETE /ip/{ip}/delegation/{target} @param ip [required] @param target [required] NS target for delegation
[ "Delete", "a", "target", "for", "reverse", "delegation", "on", "IPv6", "subnet" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L126-L130
alkacon/opencms-core
src/org/opencms/util/CmsRequestUtil.java
CmsRequestUtil.redirectPermanently
public static void redirectPermanently(CmsJspActionElement jsp, String target) { """ Redirects the response to the target link using a "301 - Moved Permanently" header.<p> This implementation will work only on JSP pages in OpenCms that use the default JSP loader implementation.<p> @param jsp the OpenCms JSP context @param target the target link """ target = OpenCms.getLinkManager().substituteLink(jsp.getCmsObject(), target); jsp.getResponse().setHeader(HEADER_CONNECTION, "close"); try { HttpServletResponse response = jsp.getResponse(); if (response instanceof CmsFlexResponse) { ((CmsFlexResponse)jsp.getResponse()).sendRedirect(target, true); } else { response.setHeader("Location", target); response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); } } catch (IOException e) { LOG.error(Messages.get().getBundle().key(Messages.ERR_IOERROR_0), e); } }
java
public static void redirectPermanently(CmsJspActionElement jsp, String target) { target = OpenCms.getLinkManager().substituteLink(jsp.getCmsObject(), target); jsp.getResponse().setHeader(HEADER_CONNECTION, "close"); try { HttpServletResponse response = jsp.getResponse(); if (response instanceof CmsFlexResponse) { ((CmsFlexResponse)jsp.getResponse()).sendRedirect(target, true); } else { response.setHeader("Location", target); response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); } } catch (IOException e) { LOG.error(Messages.get().getBundle().key(Messages.ERR_IOERROR_0), e); } }
[ "public", "static", "void", "redirectPermanently", "(", "CmsJspActionElement", "jsp", ",", "String", "target", ")", "{", "target", "=", "OpenCms", ".", "getLinkManager", "(", ")", ".", "substituteLink", "(", "jsp", ".", "getCmsObject", "(", ")", ",", "target", ")", ";", "jsp", ".", "getResponse", "(", ")", ".", "setHeader", "(", "HEADER_CONNECTION", ",", "\"close\"", ")", ";", "try", "{", "HttpServletResponse", "response", "=", "jsp", ".", "getResponse", "(", ")", ";", "if", "(", "response", "instanceof", "CmsFlexResponse", ")", "{", "(", "(", "CmsFlexResponse", ")", "jsp", ".", "getResponse", "(", ")", ")", ".", "sendRedirect", "(", "target", ",", "true", ")", ";", "}", "else", "{", "response", ".", "setHeader", "(", "\"Location\"", ",", "target", ")", ";", "response", ".", "setStatus", "(", "HttpServletResponse", ".", "SC_MOVED_PERMANENTLY", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "LOG", ".", "error", "(", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", ")", ".", "key", "(", "Messages", ".", "ERR_IOERROR_0", ")", ",", "e", ")", ";", "}", "}" ]
Redirects the response to the target link using a "301 - Moved Permanently" header.<p> This implementation will work only on JSP pages in OpenCms that use the default JSP loader implementation.<p> @param jsp the OpenCms JSP context @param target the target link
[ "Redirects", "the", "response", "to", "the", "target", "link", "using", "a", "301", "-", "Moved", "Permanently", "header", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsRequestUtil.java#L842-L857
windup/windup
utils/src/main/java/org/jboss/windup/util/xml/XmlUtil.java
XmlUtil.executeXPath
public static Object executeXPath(Node document, XPathExpression expr, QName result) throws XPathException, MarshallingException { """ Executes the given {@link XPathExpression} and returns the result with the type specified. """ try { return expr.evaluate(document, result); } catch (Exception e) { throw new MarshallingException("Exception unmarshalling XML.", e); } }
java
public static Object executeXPath(Node document, XPathExpression expr, QName result) throws XPathException, MarshallingException { try { return expr.evaluate(document, result); } catch (Exception e) { throw new MarshallingException("Exception unmarshalling XML.", e); } }
[ "public", "static", "Object", "executeXPath", "(", "Node", "document", ",", "XPathExpression", "expr", ",", "QName", "result", ")", "throws", "XPathException", ",", "MarshallingException", "{", "try", "{", "return", "expr", ".", "evaluate", "(", "document", ",", "result", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "MarshallingException", "(", "\"Exception unmarshalling XML.\"", ",", "e", ")", ";", "}", "}" ]
Executes the given {@link XPathExpression} and returns the result with the type specified.
[ "Executes", "the", "given", "{" ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/utils/src/main/java/org/jboss/windup/util/xml/XmlUtil.java#L199-L209
UrielCh/ovh-java-sdk
ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java
ApiOvhPackxdsl.packName_addressMove_eligibility_POST
public OvhAsyncTask<OvhEligibility> packName_addressMove_eligibility_POST(String packName, OvhAddress address, String lineNumber) throws IOException { """ Eligibility to move the access REST: POST /pack/xdsl/{packName}/addressMove/eligibility @param address [required] The address to test, if no lineNumber @param lineNumber [required] The line number to test, if no address @param packName [required] The internal name of your pack """ String qPath = "/pack/xdsl/{packName}/addressMove/eligibility"; StringBuilder sb = path(qPath, packName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "address", address); addBody(o, "lineNumber", lineNumber); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, t6); }
java
public OvhAsyncTask<OvhEligibility> packName_addressMove_eligibility_POST(String packName, OvhAddress address, String lineNumber) throws IOException { String qPath = "/pack/xdsl/{packName}/addressMove/eligibility"; StringBuilder sb = path(qPath, packName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "address", address); addBody(o, "lineNumber", lineNumber); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, t6); }
[ "public", "OvhAsyncTask", "<", "OvhEligibility", ">", "packName_addressMove_eligibility_POST", "(", "String", "packName", ",", "OvhAddress", "address", ",", "String", "lineNumber", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/pack/xdsl/{packName}/addressMove/eligibility\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "packName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"address\"", ",", "address", ")", ";", "addBody", "(", "o", ",", "\"lineNumber\"", ",", "lineNumber", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "t6", ")", ";", "}" ]
Eligibility to move the access REST: POST /pack/xdsl/{packName}/addressMove/eligibility @param address [required] The address to test, if no lineNumber @param lineNumber [required] The line number to test, if no address @param packName [required] The internal name of your pack
[ "Eligibility", "to", "move", "the", "access" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L341-L349
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/conf/Configuration.java
Configuration.setFirstMemory
public Configuration setFirstMemory(@NonNull AllocationStatus initialMemory) { """ This method allows to specify initial memory to be used within system. HOST: all data is located on host memory initially, and gets into DEVICE, if used frequent enough DEVICE: all memory is located on device. DELAYED: memory allocated on HOST first, and on first use gets moved to DEVICE PLEASE NOTE: For device memory all data still retains on host side as well. Default value: DEVICE @param initialMemory @return """ if (initialMemory != AllocationStatus.DEVICE && initialMemory != AllocationStatus.HOST && initialMemory != AllocationStatus.DELAYED) throw new IllegalStateException("First memory should be either [HOST], [DEVICE] or [DELAYED]"); this.firstMemory = initialMemory; return this; }
java
public Configuration setFirstMemory(@NonNull AllocationStatus initialMemory) { if (initialMemory != AllocationStatus.DEVICE && initialMemory != AllocationStatus.HOST && initialMemory != AllocationStatus.DELAYED) throw new IllegalStateException("First memory should be either [HOST], [DEVICE] or [DELAYED]"); this.firstMemory = initialMemory; return this; }
[ "public", "Configuration", "setFirstMemory", "(", "@", "NonNull", "AllocationStatus", "initialMemory", ")", "{", "if", "(", "initialMemory", "!=", "AllocationStatus", ".", "DEVICE", "&&", "initialMemory", "!=", "AllocationStatus", ".", "HOST", "&&", "initialMemory", "!=", "AllocationStatus", ".", "DELAYED", ")", "throw", "new", "IllegalStateException", "(", "\"First memory should be either [HOST], [DEVICE] or [DELAYED]\"", ")", ";", "this", ".", "firstMemory", "=", "initialMemory", ";", "return", "this", ";", "}" ]
This method allows to specify initial memory to be used within system. HOST: all data is located on host memory initially, and gets into DEVICE, if used frequent enough DEVICE: all memory is located on device. DELAYED: memory allocated on HOST first, and on first use gets moved to DEVICE PLEASE NOTE: For device memory all data still retains on host side as well. Default value: DEVICE @param initialMemory @return
[ "This", "method", "allows", "to", "specify", "initial", "memory", "to", "be", "used", "within", "system", ".", "HOST", ":", "all", "data", "is", "located", "on", "host", "memory", "initially", "and", "gets", "into", "DEVICE", "if", "used", "frequent", "enough", "DEVICE", ":", "all", "memory", "is", "located", "on", "device", ".", "DELAYED", ":", "memory", "allocated", "on", "HOST", "first", "and", "on", "first", "use", "gets", "moved", "to", "DEVICE" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/conf/Configuration.java#L643-L651
landawn/AbacusUtil
src/com/landawn/abacus/util/FileSystemUtil.java
FileSystemUtil.freeSpaceOS
long freeSpaceOS(final String path, final int os, final boolean kb, final long timeout) throws IOException { """ Returns the free space on a drive or volume in a cross-platform manner. Note that some OS's are NOT currently supported, including OS/390. <pre> FileSystemUtils.freeSpace("C:"); // Windows FileSystemUtils.freeSpace("/volume"); // *nix </pre> The free space is calculated via the command line. It uses 'dir /-c' on Windows and 'df' on *nix. @param path the path to get free space for, not null, not empty on Unix @param os the operating system code @param kb whether to normalize to kilobytes @param timeout The timeout amount in milliseconds or no timeout if the value is zero or less @return the amount of free drive space on the drive or volume @throws IllegalArgumentException if the path is invalid @throws IllegalStateException if an error occurred in initialisation @throws IOException if an error occurs when finding the free space """ if (path == null) { throw new IllegalArgumentException("Path must not be null"); } switch (os) { case WINDOWS: return kb ? freeSpaceWindows(path, timeout) / 1024 : freeSpaceWindows(path, timeout); case UNIX: return freeSpaceUnix(path, kb, false, timeout); case POSIX_UNIX: return freeSpaceUnix(path, kb, true, timeout); case OTHER: throw new IllegalStateException("Unsupported operating system"); default: throw new IllegalStateException("Exception caught when determining operating system"); } }
java
long freeSpaceOS(final String path, final int os, final boolean kb, final long timeout) throws IOException { if (path == null) { throw new IllegalArgumentException("Path must not be null"); } switch (os) { case WINDOWS: return kb ? freeSpaceWindows(path, timeout) / 1024 : freeSpaceWindows(path, timeout); case UNIX: return freeSpaceUnix(path, kb, false, timeout); case POSIX_UNIX: return freeSpaceUnix(path, kb, true, timeout); case OTHER: throw new IllegalStateException("Unsupported operating system"); default: throw new IllegalStateException("Exception caught when determining operating system"); } }
[ "long", "freeSpaceOS", "(", "final", "String", "path", ",", "final", "int", "os", ",", "final", "boolean", "kb", ",", "final", "long", "timeout", ")", "throws", "IOException", "{", "if", "(", "path", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Path must not be null\"", ")", ";", "}", "switch", "(", "os", ")", "{", "case", "WINDOWS", ":", "return", "kb", "?", "freeSpaceWindows", "(", "path", ",", "timeout", ")", "/", "1024", ":", "freeSpaceWindows", "(", "path", ",", "timeout", ")", ";", "case", "UNIX", ":", "return", "freeSpaceUnix", "(", "path", ",", "kb", ",", "false", ",", "timeout", ")", ";", "case", "POSIX_UNIX", ":", "return", "freeSpaceUnix", "(", "path", ",", "kb", ",", "true", ",", "timeout", ")", ";", "case", "OTHER", ":", "throw", "new", "IllegalStateException", "(", "\"Unsupported operating system\"", ")", ";", "default", ":", "throw", "new", "IllegalStateException", "(", "\"Exception caught when determining operating system\"", ")", ";", "}", "}" ]
Returns the free space on a drive or volume in a cross-platform manner. Note that some OS's are NOT currently supported, including OS/390. <pre> FileSystemUtils.freeSpace("C:"); // Windows FileSystemUtils.freeSpace("/volume"); // *nix </pre> The free space is calculated via the command line. It uses 'dir /-c' on Windows and 'df' on *nix. @param path the path to get free space for, not null, not empty on Unix @param os the operating system code @param kb whether to normalize to kilobytes @param timeout The timeout amount in milliseconds or no timeout if the value is zero or less @return the amount of free drive space on the drive or volume @throws IllegalArgumentException if the path is invalid @throws IllegalStateException if an error occurred in initialisation @throws IOException if an error occurs when finding the free space
[ "Returns", "the", "free", "space", "on", "a", "drive", "or", "volume", "in", "a", "cross", "-", "platform", "manner", ".", "Note", "that", "some", "OS", "s", "are", "NOT", "currently", "supported", "including", "OS", "/", "390", ".", "<pre", ">", "FileSystemUtils", ".", "freeSpace", "(", "C", ":", ")", ";", "//", "Windows", "FileSystemUtils", ".", "freeSpace", "(", "/", "volume", ")", ";", "//", "*", "nix", "<", "/", "pre", ">", "The", "free", "space", "is", "calculated", "via", "the", "command", "line", ".", "It", "uses", "dir", "/", "-", "c", "on", "Windows", "and", "df", "on", "*", "nix", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/FileSystemUtil.java#L220-L236
apache/incubator-heron
heron/common/src/java/org/apache/heron/common/utils/logging/LoggingHelper.java
LoggingHelper.getFileHandler
public static FileHandler getFileHandler(String processId, String loggingDir, boolean append, ByteAmount limit, int count) throws IOException, SecurityException { """ Initialize a <tt>FileHandler</tt> to write to a set of files with optional append. When (approximately) the given limit has been written to one file, another file will be opened. The output will cycle through a set of count files. The pattern of file name should be: ${processId}.log.index <p> The <tt>FileHandler</tt> is configured based on <tt>LogManager</tt> properties (or their default values) except that the given pattern argument is used as the filename pattern, the file limit is set to the limit argument, and the file count is set to the given count argument, and the append mode is set to the given <tt>append</tt> argument. <p> The count must be at least 1. @param limit the maximum number of bytes to write to any one file @param count the number of files to use @param append specifies append mode @throws IOException if there are IO problems opening the files. @throws SecurityException if a security manager exists and if the caller does not have <tt>LoggingPermission("control")</tt>. @throws IllegalArgumentException if {@code limit < 0}, or {@code count < 1}. @throws IllegalArgumentException if pattern is an empty string """ String pattern = loggingDir + "/" + processId + ".log.%g"; FileHandler fileHandler = new FileHandler(pattern, (int) limit.asBytes(), count, append); fileHandler.setFormatter(new SimpleFormatter()); fileHandler.setEncoding(StandardCharsets.UTF_8.toString()); return fileHandler; }
java
public static FileHandler getFileHandler(String processId, String loggingDir, boolean append, ByteAmount limit, int count) throws IOException, SecurityException { String pattern = loggingDir + "/" + processId + ".log.%g"; FileHandler fileHandler = new FileHandler(pattern, (int) limit.asBytes(), count, append); fileHandler.setFormatter(new SimpleFormatter()); fileHandler.setEncoding(StandardCharsets.UTF_8.toString()); return fileHandler; }
[ "public", "static", "FileHandler", "getFileHandler", "(", "String", "processId", ",", "String", "loggingDir", ",", "boolean", "append", ",", "ByteAmount", "limit", ",", "int", "count", ")", "throws", "IOException", ",", "SecurityException", "{", "String", "pattern", "=", "loggingDir", "+", "\"/\"", "+", "processId", "+", "\".log.%g\"", ";", "FileHandler", "fileHandler", "=", "new", "FileHandler", "(", "pattern", ",", "(", "int", ")", "limit", ".", "asBytes", "(", ")", ",", "count", ",", "append", ")", ";", "fileHandler", ".", "setFormatter", "(", "new", "SimpleFormatter", "(", ")", ")", ";", "fileHandler", ".", "setEncoding", "(", "StandardCharsets", ".", "UTF_8", ".", "toString", "(", ")", ")", ";", "return", "fileHandler", ";", "}" ]
Initialize a <tt>FileHandler</tt> to write to a set of files with optional append. When (approximately) the given limit has been written to one file, another file will be opened. The output will cycle through a set of count files. The pattern of file name should be: ${processId}.log.index <p> The <tt>FileHandler</tt> is configured based on <tt>LogManager</tt> properties (or their default values) except that the given pattern argument is used as the filename pattern, the file limit is set to the limit argument, and the file count is set to the given count argument, and the append mode is set to the given <tt>append</tt> argument. <p> The count must be at least 1. @param limit the maximum number of bytes to write to any one file @param count the number of files to use @param append specifies append mode @throws IOException if there are IO problems opening the files. @throws SecurityException if a security manager exists and if the caller does not have <tt>LoggingPermission("control")</tt>. @throws IllegalArgumentException if {@code limit < 0}, or {@code count < 1}. @throws IllegalArgumentException if pattern is an empty string
[ "Initialize", "a", "<tt", ">", "FileHandler<", "/", "tt", ">", "to", "write", "to", "a", "set", "of", "files", "with", "optional", "append", ".", "When", "(", "approximately", ")", "the", "given", "limit", "has", "been", "written", "to", "one", "file", "another", "file", "will", "be", "opened", ".", "The", "output", "will", "cycle", "through", "a", "set", "of", "count", "files", ".", "The", "pattern", "of", "file", "name", "should", "be", ":", "$", "{", "processId", "}", ".", "log", ".", "index", "<p", ">", "The", "<tt", ">", "FileHandler<", "/", "tt", ">", "is", "configured", "based", "on", "<tt", ">", "LogManager<", "/", "tt", ">", "properties", "(", "or", "their", "default", "values", ")", "except", "that", "the", "given", "pattern", "argument", "is", "used", "as", "the", "filename", "pattern", "the", "file", "limit", "is", "set", "to", "the", "limit", "argument", "and", "the", "file", "count", "is", "set", "to", "the", "given", "count", "argument", "and", "the", "append", "mode", "is", "set", "to", "the", "given", "<tt", ">", "append<", "/", "tt", ">", "argument", ".", "<p", ">", "The", "count", "must", "be", "at", "least", "1", "." ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/common/src/java/org/apache/heron/common/utils/logging/LoggingHelper.java#L154-L168
JDBDT/jdbdt
src/main/java/org/jdbdt/Log.java
Log.writeSQL
void writeSQL(CallInfo callInfo, String sql) { """ Log SQL code. @param callInfo Call info. @param sql SQL code. """ Element rootNode = root(callInfo); writeSQL(rootNode, sql); flush(rootNode); }
java
void writeSQL(CallInfo callInfo, String sql) { Element rootNode = root(callInfo); writeSQL(rootNode, sql); flush(rootNode); }
[ "void", "writeSQL", "(", "CallInfo", "callInfo", ",", "String", "sql", ")", "{", "Element", "rootNode", "=", "root", "(", "callInfo", ")", ";", "writeSQL", "(", "rootNode", ",", "sql", ")", ";", "flush", "(", "rootNode", ")", ";", "}" ]
Log SQL code. @param callInfo Call info. @param sql SQL code.
[ "Log", "SQL", "code", "." ]
train
https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/Log.java#L236-L240
networknt/light-4j
service/src/main/java/com/networknt/service/SingletonServiceFactory.java
SingletonServiceFactory.handleSingletonClass
private static void handleSingletonClass(String key, String value) throws Exception { """ For each singleton definition, create object with the initializer class and method, and push it into the service map with the key of the class name. @param key String class name of the object that needs to be initialized @param value String class name of initializer class and method separated by "::" @throws Exception exception thrown from the object creation """ Object object = handleValue(value); if(key.contains(",")) { String[] interfaces = key.split(","); for (String anInterface : interfaces) { serviceMap.put(anInterface, object); } } else { serviceMap.put(key, object); } }
java
private static void handleSingletonClass(String key, String value) throws Exception { Object object = handleValue(value); if(key.contains(",")) { String[] interfaces = key.split(","); for (String anInterface : interfaces) { serviceMap.put(anInterface, object); } } else { serviceMap.put(key, object); } }
[ "private", "static", "void", "handleSingletonClass", "(", "String", "key", ",", "String", "value", ")", "throws", "Exception", "{", "Object", "object", "=", "handleValue", "(", "value", ")", ";", "if", "(", "key", ".", "contains", "(", "\",\"", ")", ")", "{", "String", "[", "]", "interfaces", "=", "key", ".", "split", "(", "\",\"", ")", ";", "for", "(", "String", "anInterface", ":", "interfaces", ")", "{", "serviceMap", ".", "put", "(", "anInterface", ",", "object", ")", ";", "}", "}", "else", "{", "serviceMap", ".", "put", "(", "key", ",", "object", ")", ";", "}", "}" ]
For each singleton definition, create object with the initializer class and method, and push it into the service map with the key of the class name. @param key String class name of the object that needs to be initialized @param value String class name of initializer class and method separated by "::" @throws Exception exception thrown from the object creation
[ "For", "each", "singleton", "definition", "create", "object", "with", "the", "initializer", "class", "and", "method", "and", "push", "it", "into", "the", "service", "map", "with", "the", "key", "of", "the", "class", "name", "." ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/service/src/main/java/com/networknt/service/SingletonServiceFactory.java#L178-L188
thymeleaf/thymeleaf
src/main/java/org/thymeleaf/util/TextUtils.java
TextUtils.startsWith
public static boolean startsWith(final boolean caseSensitive, final CharSequence text, final char[] prefix) { """ <p> Checks whether a text starts with a specified prefix. </p> @param caseSensitive whether the comparison must be done in a case-sensitive or case-insensitive way. @param text the text to be checked for prefixes. @param prefix the prefix to be searched. @return whether the text starts with the prefix or not. """ return startsWith(caseSensitive, text, 0, text.length(), prefix, 0, prefix.length); }
java
public static boolean startsWith(final boolean caseSensitive, final CharSequence text, final char[] prefix) { return startsWith(caseSensitive, text, 0, text.length(), prefix, 0, prefix.length); }
[ "public", "static", "boolean", "startsWith", "(", "final", "boolean", "caseSensitive", ",", "final", "CharSequence", "text", ",", "final", "char", "[", "]", "prefix", ")", "{", "return", "startsWith", "(", "caseSensitive", ",", "text", ",", "0", ",", "text", ".", "length", "(", ")", ",", "prefix", ",", "0", ",", "prefix", ".", "length", ")", ";", "}" ]
<p> Checks whether a text starts with a specified prefix. </p> @param caseSensitive whether the comparison must be done in a case-sensitive or case-insensitive way. @param text the text to be checked for prefixes. @param prefix the prefix to be searched. @return whether the text starts with the prefix or not.
[ "<p", ">", "Checks", "whether", "a", "text", "starts", "with", "a", "specified", "prefix", ".", "<", "/", "p", ">" ]
train
https://github.com/thymeleaf/thymeleaf/blob/2b0e6d6d7571fbe638904b5fd222fc9e77188879/src/main/java/org/thymeleaf/util/TextUtils.java#L362-L364
apereo/cas
core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java
AbstractCasWebflowConfigurer.prependActionsToActionStateExecutionList
public void prependActionsToActionStateExecutionList(final Flow flow, final String actionStateId, final String... actions) { """ Prepend actions to action state execution list. @param flow the flow @param actionStateId the action state id @param actions the actions """ val evalActions = Arrays.stream(actions) .map(this::createEvaluateAction) .toArray(EvaluateAction[]::new); addActionsToActionStateExecutionListAt(flow, actionStateId, 0, evalActions); }
java
public void prependActionsToActionStateExecutionList(final Flow flow, final String actionStateId, final String... actions) { val evalActions = Arrays.stream(actions) .map(this::createEvaluateAction) .toArray(EvaluateAction[]::new); addActionsToActionStateExecutionListAt(flow, actionStateId, 0, evalActions); }
[ "public", "void", "prependActionsToActionStateExecutionList", "(", "final", "Flow", "flow", ",", "final", "String", "actionStateId", ",", "final", "String", "...", "actions", ")", "{", "val", "evalActions", "=", "Arrays", ".", "stream", "(", "actions", ")", ".", "map", "(", "this", "::", "createEvaluateAction", ")", ".", "toArray", "(", "EvaluateAction", "[", "]", "::", "new", ")", ";", "addActionsToActionStateExecutionListAt", "(", "flow", ",", "actionStateId", ",", "0", ",", "evalActions", ")", ";", "}" ]
Prepend actions to action state execution list. @param flow the flow @param actionStateId the action state id @param actions the actions
[ "Prepend", "actions", "to", "action", "state", "execution", "list", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java#L808-L813
ops4j/org.ops4j.pax.web
pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/parser/WebAppParser.java
WebAppParser.parseListeners
private static void parseListeners(final ListenerType listenerType, final WebApp webApp) { """ Parses listeners out of web.xml. @param listenerType listenerType element from web.xml @param webApp model for web.xml """ addWebListener(webApp, listenerType.getListenerClass().getValue()); }
java
private static void parseListeners(final ListenerType listenerType, final WebApp webApp) { addWebListener(webApp, listenerType.getListenerClass().getValue()); }
[ "private", "static", "void", "parseListeners", "(", "final", "ListenerType", "listenerType", ",", "final", "WebApp", "webApp", ")", "{", "addWebListener", "(", "webApp", ",", "listenerType", ".", "getListenerClass", "(", ")", ".", "getValue", "(", ")", ")", ";", "}" ]
Parses listeners out of web.xml. @param listenerType listenerType element from web.xml @param webApp model for web.xml
[ "Parses", "listeners", "out", "of", "web", ".", "xml", "." ]
train
https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/parser/WebAppParser.java#L732-L734
RoaringBitmap/RoaringBitmap
roaringbitmap/src/main/java/org/roaringbitmap/buffer/MappeableRunContainer.java
MappeableRunContainer.prependValueLength
private void prependValueLength(int value, int index) { """ Prepend a value length with all values starting from a given value """ int initialValue = toIntUnsigned(getValue(index)); int length = toIntUnsigned(getLength(index)); setValue(index, (short) value); setLength(index, (short) (initialValue - value + length)); }
java
private void prependValueLength(int value, int index) { int initialValue = toIntUnsigned(getValue(index)); int length = toIntUnsigned(getLength(index)); setValue(index, (short) value); setLength(index, (short) (initialValue - value + length)); }
[ "private", "void", "prependValueLength", "(", "int", "value", ",", "int", "index", ")", "{", "int", "initialValue", "=", "toIntUnsigned", "(", "getValue", "(", "index", ")", ")", ";", "int", "length", "=", "toIntUnsigned", "(", "getLength", "(", "index", ")", ")", ";", "setValue", "(", "index", ",", "(", "short", ")", "value", ")", ";", "setLength", "(", "index", ",", "(", "short", ")", "(", "initialValue", "-", "value", "+", "length", ")", ")", ";", "}" ]
Prepend a value length with all values starting from a given value
[ "Prepend", "a", "value", "length", "with", "all", "values", "starting", "from", "a", "given", "value" ]
train
https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/buffer/MappeableRunContainer.java#L1920-L1925
SonarSource/sonarqube
sonar-plugin-api/src/main/java/org/sonar/api/utils/System2.java
System2.setProperty
public System2 setProperty(String key, String value) { """ Shortcut for {@code System{@link #setProperty(String, String)}} @since 6.4 """ System.setProperty(key, value); return this; }
java
public System2 setProperty(String key, String value) { System.setProperty(key, value); return this; }
[ "public", "System2", "setProperty", "(", "String", "key", ",", "String", "value", ")", "{", "System", ".", "setProperty", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Shortcut for {@code System{@link #setProperty(String, String)}} @since 6.4
[ "Shortcut", "for", "{" ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/utils/System2.java#L103-L106
alkacon/opencms-core
src/org/opencms/xml/templatemapper/CmsTemplateMapper.java
CmsTemplateMapper.transformContainerpageBean
public CmsContainerPageBean transformContainerpageBean(CmsObject cms, CmsContainerPageBean input, String rootPath) { """ Transforms a container page bean.<p> @param cms the current CMS context @param input the bean to be transformed @param rootPath the root path of the page @return the transformed bean """ CmsTemplateMapperConfiguration config = getConfiguration(cms); if ((config == null) || !config.isEnabledForPath(rootPath)) { return input; } List<CmsContainerBean> newContainers = new ArrayList<>(); for (CmsContainerBean container : input.getContainers().values()) { List<CmsContainerElementBean> elements = container.getElements(); List<CmsContainerElementBean> newElements = new ArrayList<>(); for (CmsContainerElementBean element : elements) { CmsContainerElementBean newElement = transformContainerElement(cms, config, element); if (newElement != null) { newElements.add(newElement); } } CmsContainerBean newContainer = new CmsContainerBean( container.getName(), container.getType(), container.getParentInstanceId(), container.isRootContainer(), newElements); newContainers.add(newContainer); } CmsContainerPageBean result = new CmsContainerPageBean(newContainers); return result; }
java
public CmsContainerPageBean transformContainerpageBean(CmsObject cms, CmsContainerPageBean input, String rootPath) { CmsTemplateMapperConfiguration config = getConfiguration(cms); if ((config == null) || !config.isEnabledForPath(rootPath)) { return input; } List<CmsContainerBean> newContainers = new ArrayList<>(); for (CmsContainerBean container : input.getContainers().values()) { List<CmsContainerElementBean> elements = container.getElements(); List<CmsContainerElementBean> newElements = new ArrayList<>(); for (CmsContainerElementBean element : elements) { CmsContainerElementBean newElement = transformContainerElement(cms, config, element); if (newElement != null) { newElements.add(newElement); } } CmsContainerBean newContainer = new CmsContainerBean( container.getName(), container.getType(), container.getParentInstanceId(), container.isRootContainer(), newElements); newContainers.add(newContainer); } CmsContainerPageBean result = new CmsContainerPageBean(newContainers); return result; }
[ "public", "CmsContainerPageBean", "transformContainerpageBean", "(", "CmsObject", "cms", ",", "CmsContainerPageBean", "input", ",", "String", "rootPath", ")", "{", "CmsTemplateMapperConfiguration", "config", "=", "getConfiguration", "(", "cms", ")", ";", "if", "(", "(", "config", "==", "null", ")", "||", "!", "config", ".", "isEnabledForPath", "(", "rootPath", ")", ")", "{", "return", "input", ";", "}", "List", "<", "CmsContainerBean", ">", "newContainers", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "CmsContainerBean", "container", ":", "input", ".", "getContainers", "(", ")", ".", "values", "(", ")", ")", "{", "List", "<", "CmsContainerElementBean", ">", "elements", "=", "container", ".", "getElements", "(", ")", ";", "List", "<", "CmsContainerElementBean", ">", "newElements", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "CmsContainerElementBean", "element", ":", "elements", ")", "{", "CmsContainerElementBean", "newElement", "=", "transformContainerElement", "(", "cms", ",", "config", ",", "element", ")", ";", "if", "(", "newElement", "!=", "null", ")", "{", "newElements", ".", "add", "(", "newElement", ")", ";", "}", "}", "CmsContainerBean", "newContainer", "=", "new", "CmsContainerBean", "(", "container", ".", "getName", "(", ")", ",", "container", ".", "getType", "(", ")", ",", "container", ".", "getParentInstanceId", "(", ")", ",", "container", ".", "isRootContainer", "(", ")", ",", "newElements", ")", ";", "newContainers", ".", "add", "(", "newContainer", ")", ";", "}", "CmsContainerPageBean", "result", "=", "new", "CmsContainerPageBean", "(", "newContainers", ")", ";", "return", "result", ";", "}" ]
Transforms a container page bean.<p> @param cms the current CMS context @param input the bean to be transformed @param rootPath the root path of the page @return the transformed bean
[ "Transforms", "a", "container", "page", "bean", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/templatemapper/CmsTemplateMapper.java#L168-L194
KayLerch/alexa-skills-kit-tellask-java
src/main/java/io/klerch/alexa/tellask/model/wrapper/AlexaRequestStreamHandler.java
AlexaRequestStreamHandler.handleRequest
@Override public void handleRequest(final InputStream input, final OutputStream output, final Context context) throws IOException { """ The handler method is called on a Lambda execution. @param input the input stream containing the Lambda request payload @param output the output stream containing the Lambda response payload @param context a context for a Lambda execution. @throws IOException exception is thrown on invalid request payload or on a provided speechlet handler having no public constructor taking a String containing the locale """ byte[] serializedSpeechletRequest = IOUtils.toByteArray(input); final AlexaSpeechlet speechlet = AlexaSpeechletFactory.createSpeechletFromRequest(serializedSpeechletRequest, getSpeechlet(), getUtteranceReader()); final SpeechletRequestHandler handler = getRequestStreamHandler(); try { byte[] outputBytes = handler.handleSpeechletCall(speechlet, serializedSpeechletRequest); output.write(outputBytes); } catch (SpeechletRequestHandlerException | SpeechletException e) { // wrap actual exception in expected IOException throw new IOException(e); } }
java
@Override public void handleRequest(final InputStream input, final OutputStream output, final Context context) throws IOException { byte[] serializedSpeechletRequest = IOUtils.toByteArray(input); final AlexaSpeechlet speechlet = AlexaSpeechletFactory.createSpeechletFromRequest(serializedSpeechletRequest, getSpeechlet(), getUtteranceReader()); final SpeechletRequestHandler handler = getRequestStreamHandler(); try { byte[] outputBytes = handler.handleSpeechletCall(speechlet, serializedSpeechletRequest); output.write(outputBytes); } catch (SpeechletRequestHandlerException | SpeechletException e) { // wrap actual exception in expected IOException throw new IOException(e); } }
[ "@", "Override", "public", "void", "handleRequest", "(", "final", "InputStream", "input", ",", "final", "OutputStream", "output", ",", "final", "Context", "context", ")", "throws", "IOException", "{", "byte", "[", "]", "serializedSpeechletRequest", "=", "IOUtils", ".", "toByteArray", "(", "input", ")", ";", "final", "AlexaSpeechlet", "speechlet", "=", "AlexaSpeechletFactory", ".", "createSpeechletFromRequest", "(", "serializedSpeechletRequest", ",", "getSpeechlet", "(", ")", ",", "getUtteranceReader", "(", ")", ")", ";", "final", "SpeechletRequestHandler", "handler", "=", "getRequestStreamHandler", "(", ")", ";", "try", "{", "byte", "[", "]", "outputBytes", "=", "handler", ".", "handleSpeechletCall", "(", "speechlet", ",", "serializedSpeechletRequest", ")", ";", "output", ".", "write", "(", "outputBytes", ")", ";", "}", "catch", "(", "SpeechletRequestHandlerException", "|", "SpeechletException", "e", ")", "{", "// wrap actual exception in expected IOException", "throw", "new", "IOException", "(", "e", ")", ";", "}", "}" ]
The handler method is called on a Lambda execution. @param input the input stream containing the Lambda request payload @param output the output stream containing the Lambda response payload @param context a context for a Lambda execution. @throws IOException exception is thrown on invalid request payload or on a provided speechlet handler having no public constructor taking a String containing the locale
[ "The", "handler", "method", "is", "called", "on", "a", "Lambda", "execution", "." ]
train
https://github.com/KayLerch/alexa-skills-kit-tellask-java/blob/2c19028e775c2512dd4649d12962c0b48bf7f2bc/src/main/java/io/klerch/alexa/tellask/model/wrapper/AlexaRequestStreamHandler.java#L82-L94
GoogleCloudPlatform/bigdata-interop
gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageFileSystem.java
GoogleCloudStorageFileSystem.listFileInfo
public List<FileInfo> listFileInfo(URI path) throws IOException { """ If the given path points to a directory then the information about its children is returned, otherwise information about the given file is returned. <p>Note: This function is expensive to call, especially for a directory with many children. Use the alternative {@link GoogleCloudStorageFileSystem#listFileNames(FileInfo)} if you only need names of children and no other attributes. @param path Given path. @return Information about a file or children of a directory. @throws FileNotFoundException if the given path does not exist. @throws IOException """ Preconditions.checkNotNull(path, "path can not be null"); logger.atFine().log("listFileInfo(%s)", path); StorageResourceId pathId = pathCodec.validatePathAndGetId(path, true); StorageResourceId dirId = pathCodec.validatePathAndGetId(FileInfo.convertToDirectoryPath(pathCodec, path), true); // To improve performance start to list directory items right away. ExecutorService dirExecutor = Executors.newSingleThreadExecutor(DAEMON_THREAD_FACTORY); try { Future<GoogleCloudStorageItemInfo> dirFuture = dirExecutor.submit(() -> gcs.getItemInfo(dirId)); dirExecutor.shutdown(); if (!pathId.isDirectory()) { GoogleCloudStorageItemInfo pathInfo = gcs.getItemInfo(pathId); if (pathInfo.exists()) { List<FileInfo> listedInfo = new ArrayList<>(); listedInfo.add(FileInfo.fromItemInfo(pathCodec, pathInfo)); return listedInfo; } } try { GoogleCloudStorageItemInfo dirInfo = dirFuture.get(); List<GoogleCloudStorageItemInfo> dirItemInfos = dirId.isRoot() ? gcs.listBucketInfo() : gcs.listObjectInfo(dirId.getBucketName(), dirId.getObjectName(), PATH_DELIMITER); if (!dirInfo.exists() && dirItemInfos.isEmpty()) { throw new FileNotFoundException("Item not found: " + path); } List<FileInfo> fileInfos = FileInfo.fromItemInfos(pathCodec, dirItemInfos); fileInfos.sort(FILE_INFO_PATH_COMPARATOR); return fileInfos; } catch (InterruptedException | ExecutionException e) { if (e instanceof InterruptedException) { Thread.currentThread().interrupt(); } throw new IOException(String.format("Failed to listFileInfo for '%s'", path), e); } } finally { dirExecutor.shutdownNow(); } }
java
public List<FileInfo> listFileInfo(URI path) throws IOException { Preconditions.checkNotNull(path, "path can not be null"); logger.atFine().log("listFileInfo(%s)", path); StorageResourceId pathId = pathCodec.validatePathAndGetId(path, true); StorageResourceId dirId = pathCodec.validatePathAndGetId(FileInfo.convertToDirectoryPath(pathCodec, path), true); // To improve performance start to list directory items right away. ExecutorService dirExecutor = Executors.newSingleThreadExecutor(DAEMON_THREAD_FACTORY); try { Future<GoogleCloudStorageItemInfo> dirFuture = dirExecutor.submit(() -> gcs.getItemInfo(dirId)); dirExecutor.shutdown(); if (!pathId.isDirectory()) { GoogleCloudStorageItemInfo pathInfo = gcs.getItemInfo(pathId); if (pathInfo.exists()) { List<FileInfo> listedInfo = new ArrayList<>(); listedInfo.add(FileInfo.fromItemInfo(pathCodec, pathInfo)); return listedInfo; } } try { GoogleCloudStorageItemInfo dirInfo = dirFuture.get(); List<GoogleCloudStorageItemInfo> dirItemInfos = dirId.isRoot() ? gcs.listBucketInfo() : gcs.listObjectInfo(dirId.getBucketName(), dirId.getObjectName(), PATH_DELIMITER); if (!dirInfo.exists() && dirItemInfos.isEmpty()) { throw new FileNotFoundException("Item not found: " + path); } List<FileInfo> fileInfos = FileInfo.fromItemInfos(pathCodec, dirItemInfos); fileInfos.sort(FILE_INFO_PATH_COMPARATOR); return fileInfos; } catch (InterruptedException | ExecutionException e) { if (e instanceof InterruptedException) { Thread.currentThread().interrupt(); } throw new IOException(String.format("Failed to listFileInfo for '%s'", path), e); } } finally { dirExecutor.shutdownNow(); } }
[ "public", "List", "<", "FileInfo", ">", "listFileInfo", "(", "URI", "path", ")", "throws", "IOException", "{", "Preconditions", ".", "checkNotNull", "(", "path", ",", "\"path can not be null\"", ")", ";", "logger", ".", "atFine", "(", ")", ".", "log", "(", "\"listFileInfo(%s)\"", ",", "path", ")", ";", "StorageResourceId", "pathId", "=", "pathCodec", ".", "validatePathAndGetId", "(", "path", ",", "true", ")", ";", "StorageResourceId", "dirId", "=", "pathCodec", ".", "validatePathAndGetId", "(", "FileInfo", ".", "convertToDirectoryPath", "(", "pathCodec", ",", "path", ")", ",", "true", ")", ";", "// To improve performance start to list directory items right away.", "ExecutorService", "dirExecutor", "=", "Executors", ".", "newSingleThreadExecutor", "(", "DAEMON_THREAD_FACTORY", ")", ";", "try", "{", "Future", "<", "GoogleCloudStorageItemInfo", ">", "dirFuture", "=", "dirExecutor", ".", "submit", "(", "(", ")", "->", "gcs", ".", "getItemInfo", "(", "dirId", ")", ")", ";", "dirExecutor", ".", "shutdown", "(", ")", ";", "if", "(", "!", "pathId", ".", "isDirectory", "(", ")", ")", "{", "GoogleCloudStorageItemInfo", "pathInfo", "=", "gcs", ".", "getItemInfo", "(", "pathId", ")", ";", "if", "(", "pathInfo", ".", "exists", "(", ")", ")", "{", "List", "<", "FileInfo", ">", "listedInfo", "=", "new", "ArrayList", "<>", "(", ")", ";", "listedInfo", ".", "add", "(", "FileInfo", ".", "fromItemInfo", "(", "pathCodec", ",", "pathInfo", ")", ")", ";", "return", "listedInfo", ";", "}", "}", "try", "{", "GoogleCloudStorageItemInfo", "dirInfo", "=", "dirFuture", ".", "get", "(", ")", ";", "List", "<", "GoogleCloudStorageItemInfo", ">", "dirItemInfos", "=", "dirId", ".", "isRoot", "(", ")", "?", "gcs", ".", "listBucketInfo", "(", ")", ":", "gcs", ".", "listObjectInfo", "(", "dirId", ".", "getBucketName", "(", ")", ",", "dirId", ".", "getObjectName", "(", ")", ",", "PATH_DELIMITER", ")", ";", "if", "(", "!", "dirInfo", ".", "exists", "(", ")", "&&", "dirItemInfos", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "FileNotFoundException", "(", "\"Item not found: \"", "+", "path", ")", ";", "}", "List", "<", "FileInfo", ">", "fileInfos", "=", "FileInfo", ".", "fromItemInfos", "(", "pathCodec", ",", "dirItemInfos", ")", ";", "fileInfos", ".", "sort", "(", "FILE_INFO_PATH_COMPARATOR", ")", ";", "return", "fileInfos", ";", "}", "catch", "(", "InterruptedException", "|", "ExecutionException", "e", ")", "{", "if", "(", "e", "instanceof", "InterruptedException", ")", "{", "Thread", ".", "currentThread", "(", ")", ".", "interrupt", "(", ")", ";", "}", "throw", "new", "IOException", "(", "String", ".", "format", "(", "\"Failed to listFileInfo for '%s'\"", ",", "path", ")", ",", "e", ")", ";", "}", "}", "finally", "{", "dirExecutor", ".", "shutdownNow", "(", ")", ";", "}", "}" ]
If the given path points to a directory then the information about its children is returned, otherwise information about the given file is returned. <p>Note: This function is expensive to call, especially for a directory with many children. Use the alternative {@link GoogleCloudStorageFileSystem#listFileNames(FileInfo)} if you only need names of children and no other attributes. @param path Given path. @return Information about a file or children of a directory. @throws FileNotFoundException if the given path does not exist. @throws IOException
[ "If", "the", "given", "path", "points", "to", "a", "directory", "then", "the", "information", "about", "its", "children", "is", "returned", "otherwise", "information", "about", "the", "given", "file", "is", "returned", "." ]
train
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageFileSystem.java#L1050-L1096
jpush/jmessage-api-java-client
src/main/java/cn/jmessage/api/crossapp/CrossAppClient.java
CrossAppClient.addCrossFriends
public ResponseWrapper addCrossFriends(String username, CrossFriendPayload payload) throws APIConnectionException, APIRequestException { """ Add users from cross app. @param username Necessary @param payload CrossFriendPayload @return No content @throws APIConnectionException connect exception @throws APIRequestException request exception """ StringUtils.checkUsername(username); Preconditions.checkArgument(null != payload, "CrossFriendPayload should not be null"); return _httpClient.sendPost(_baseUrl + crossUserPath + "/" + username + "/friends", payload.toString()); }
java
public ResponseWrapper addCrossFriends(String username, CrossFriendPayload payload) throws APIConnectionException, APIRequestException { StringUtils.checkUsername(username); Preconditions.checkArgument(null != payload, "CrossFriendPayload should not be null"); return _httpClient.sendPost(_baseUrl + crossUserPath + "/" + username + "/friends", payload.toString()); }
[ "public", "ResponseWrapper", "addCrossFriends", "(", "String", "username", ",", "CrossFriendPayload", "payload", ")", "throws", "APIConnectionException", ",", "APIRequestException", "{", "StringUtils", ".", "checkUsername", "(", "username", ")", ";", "Preconditions", ".", "checkArgument", "(", "null", "!=", "payload", ",", "\"CrossFriendPayload should not be null\"", ")", ";", "return", "_httpClient", ".", "sendPost", "(", "_baseUrl", "+", "crossUserPath", "+", "\"/\"", "+", "username", "+", "\"/friends\"", ",", "payload", ".", "toString", "(", ")", ")", ";", "}" ]
Add users from cross app. @param username Necessary @param payload CrossFriendPayload @return No content @throws APIConnectionException connect exception @throws APIRequestException request exception
[ "Add", "users", "from", "cross", "app", "." ]
train
https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/crossapp/CrossAppClient.java#L149-L154
sockeqwe/SwipeBack
library/src/com/hannesdorfmann/swipeback/Scroller.java
Scroller.startScroll
public void startScroll(int startX, int startY, int dx, int dy) { """ Start scrolling by providing a starting point and the distance to travel. The scroll will use the default value of 250 milliseconds for the duration. @param startX Starting horizontal scroll offset in pixels. Positive numbers will scroll the content to the left. @param startY Starting vertical scroll offset in pixels. Positive numbers will scroll the content up. @param dx Horizontal distance to travel. Positive numbers will scroll the content to the left. @param dy Vertical distance to travel. Positive numbers will scroll the content up. """ startScroll(startX, startY, dx, dy, DEFAULT_DURATION); }
java
public void startScroll(int startX, int startY, int dx, int dy) { startScroll(startX, startY, dx, dy, DEFAULT_DURATION); }
[ "public", "void", "startScroll", "(", "int", "startX", ",", "int", "startY", ",", "int", "dx", ",", "int", "dy", ")", "{", "startScroll", "(", "startX", ",", "startY", ",", "dx", ",", "dy", ",", "DEFAULT_DURATION", ")", ";", "}" ]
Start scrolling by providing a starting point and the distance to travel. The scroll will use the default value of 250 milliseconds for the duration. @param startX Starting horizontal scroll offset in pixels. Positive numbers will scroll the content to the left. @param startY Starting vertical scroll offset in pixels. Positive numbers will scroll the content up. @param dx Horizontal distance to travel. Positive numbers will scroll the content to the left. @param dy Vertical distance to travel. Positive numbers will scroll the content up.
[ "Start", "scrolling", "by", "providing", "a", "starting", "point", "and", "the", "distance", "to", "travel", ".", "The", "scroll", "will", "use", "the", "default", "value", "of", "250", "milliseconds", "for", "the", "duration", "." ]
train
https://github.com/sockeqwe/SwipeBack/blob/09ed11f48e930ed47fd4f07ad1c786fc9fff3c48/library/src/com/hannesdorfmann/swipeback/Scroller.java#L315-L317
Ordinastie/MalisisCore
src/main/java/net/malisis/core/renderer/font/MalisisFont.java
MalisisFont.clipString
public String clipString(String str, int width, FontOptions options) { """ Clips a string to fit in the specified width. @param str the str @param width the width @param options the options @return the string """ return clipString(str, width, options, false); }
java
public String clipString(String str, int width, FontOptions options) { return clipString(str, width, options, false); }
[ "public", "String", "clipString", "(", "String", "str", ",", "int", "width", ",", "FontOptions", "options", ")", "{", "return", "clipString", "(", "str", ",", "width", ",", "options", ",", "false", ")", ";", "}" ]
Clips a string to fit in the specified width. @param str the str @param width the width @param options the options @return the string
[ "Clips", "a", "string", "to", "fit", "in", "the", "specified", "width", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/font/MalisisFont.java#L426-L429
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleIO.java
ParticleIO.getFirstNamedElement
private static Element getFirstNamedElement(Element element, String name) { """ Get the first child named as specified from the passed XML element @param element The element whose children are interogated @param name The name of the element to retrieve @return The requested element """ NodeList list = element.getElementsByTagName(name); if (list.getLength() == 0) { return null; } return (Element) list.item(0); }
java
private static Element getFirstNamedElement(Element element, String name) { NodeList list = element.getElementsByTagName(name); if (list.getLength() == 0) { return null; } return (Element) list.item(0); }
[ "private", "static", "Element", "getFirstNamedElement", "(", "Element", "element", ",", "String", "name", ")", "{", "NodeList", "list", "=", "element", ".", "getElementsByTagName", "(", "name", ")", ";", "if", "(", "list", ".", "getLength", "(", ")", "==", "0", ")", "{", "return", "null", ";", "}", "return", "(", "Element", ")", "list", ".", "item", "(", "0", ")", ";", "}" ]
Get the first child named as specified from the passed XML element @param element The element whose children are interogated @param name The name of the element to retrieve @return The requested element
[ "Get", "the", "first", "child", "named", "as", "specified", "from", "the", "passed", "XML", "element" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleIO.java#L479-L486
zaproxy/zaproxy
src/org/zaproxy/zap/extension/httppanel/view/syntaxhighlight/lexers/WwwFormTokenMaker.java
WwwFormTokenMaker.getTokenList
@Override public Token getTokenList(Segment text, int initialTokenType, int startOffset) { """ Returns the first token in the linked list of tokens generated from <code>text</code>. This method must be implemented by subclasses so they can correctly implement syntax highlighting. @param text The text from which to get tokens. @param initialTokenType The token type we should start with. @param startOffset The offset into the document at which <code>text</code> starts. @return The first <code>Token</code> in a linked list representing the syntax highlighted text. """ resetTokenList(); this.offsetShift = -text.offset + startOffset; // Start off in the proper state. s = text; yyreset(zzReader); yybegin(YYINITIAL); return yylex(); }
java
@Override public Token getTokenList(Segment text, int initialTokenType, int startOffset) { resetTokenList(); this.offsetShift = -text.offset + startOffset; // Start off in the proper state. s = text; yyreset(zzReader); yybegin(YYINITIAL); return yylex(); }
[ "@", "Override", "public", "Token", "getTokenList", "(", "Segment", "text", ",", "int", "initialTokenType", ",", "int", "startOffset", ")", "{", "resetTokenList", "(", ")", ";", "this", ".", "offsetShift", "=", "-", "text", ".", "offset", "+", "startOffset", ";", "// Start off in the proper state.", "s", "=", "text", ";", "yyreset", "(", "zzReader", ")", ";", "yybegin", "(", "YYINITIAL", ")", ";", "return", "yylex", "(", ")", ";", "}" ]
Returns the first token in the linked list of tokens generated from <code>text</code>. This method must be implemented by subclasses so they can correctly implement syntax highlighting. @param text The text from which to get tokens. @param initialTokenType The token type we should start with. @param startOffset The offset into the document at which <code>text</code> starts. @return The first <code>Token</code> in a linked list representing the syntax highlighted text.
[ "Returns", "the", "first", "token", "in", "the", "linked", "list", "of", "tokens", "generated", "from", "<code", ">", "text<", "/", "code", ">", ".", "This", "method", "must", "be", "implemented", "by", "subclasses", "so", "they", "can", "correctly", "implement", "syntax", "highlighting", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/httppanel/view/syntaxhighlight/lexers/WwwFormTokenMaker.java#L301-L311
apache/groovy
src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java
IOGroovyMethods.eachByte
public static void eachByte(InputStream is, int bufferLen, @ClosureParams(value=FromString.class, options="byte[],Integer") Closure closure) throws IOException { """ Traverse through each the specified stream reading bytes into a buffer and calling the 2 parameter closure with this buffer and the number of bytes. @param is stream to iterate over, closed after the method call. @param bufferLen the length of the buffer to use. @param closure a 2 parameter closure which is passed the byte[] and a number of bytes successfully read. @throws IOException if an IOException occurs. @since 1.8 """ byte[] buffer = new byte[bufferLen]; int bytesRead; try { while ((bytesRead = is.read(buffer, 0, bufferLen)) > 0) { closure.call(buffer, bytesRead); } InputStream temp = is; is = null; temp.close(); } finally { closeWithWarning(is); } }
java
public static void eachByte(InputStream is, int bufferLen, @ClosureParams(value=FromString.class, options="byte[],Integer") Closure closure) throws IOException { byte[] buffer = new byte[bufferLen]; int bytesRead; try { while ((bytesRead = is.read(buffer, 0, bufferLen)) > 0) { closure.call(buffer, bytesRead); } InputStream temp = is; is = null; temp.close(); } finally { closeWithWarning(is); } }
[ "public", "static", "void", "eachByte", "(", "InputStream", "is", ",", "int", "bufferLen", ",", "@", "ClosureParams", "(", "value", "=", "FromString", ".", "class", ",", "options", "=", "\"byte[],Integer\"", ")", "Closure", "closure", ")", "throws", "IOException", "{", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "bufferLen", "]", ";", "int", "bytesRead", ";", "try", "{", "while", "(", "(", "bytesRead", "=", "is", ".", "read", "(", "buffer", ",", "0", ",", "bufferLen", ")", ")", ">", "0", ")", "{", "closure", ".", "call", "(", "buffer", ",", "bytesRead", ")", ";", "}", "InputStream", "temp", "=", "is", ";", "is", "=", "null", ";", "temp", ".", "close", "(", ")", ";", "}", "finally", "{", "closeWithWarning", "(", "is", ")", ";", "}", "}" ]
Traverse through each the specified stream reading bytes into a buffer and calling the 2 parameter closure with this buffer and the number of bytes. @param is stream to iterate over, closed after the method call. @param bufferLen the length of the buffer to use. @param closure a 2 parameter closure which is passed the byte[] and a number of bytes successfully read. @throws IOException if an IOException occurs. @since 1.8
[ "Traverse", "through", "each", "the", "specified", "stream", "reading", "bytes", "into", "a", "buffer", "and", "calling", "the", "2", "parameter", "closure", "with", "this", "buffer", "and", "the", "number", "of", "bytes", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L1348-L1362
haraldk/TwelveMonkeys
sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/NetUtil.java
NetUtil.createHttpURLConnection
public static HttpURLConnection createHttpURLConnection(URL pURL, Properties pProperties, boolean pFollowRedirects, int pTimeout) throws IOException { """ Creates a HTTP connection to the given URL. @param pURL the URL to get. @param pProperties connection properties. @param pFollowRedirects specifies whether we should follow redirects. @param pTimeout the specified timeout, in milliseconds. @return a HttpURLConnection @throws UnknownHostException if the hostname in the URL cannot be found. @throws IOException if an I/O exception occurs. """ // Open the connection, and get the stream HttpURLConnection conn; if (pTimeout > 0) { // Supports timeout conn = new com.twelvemonkeys.net.HttpURLConnection(pURL, pTimeout); } else { // Faster, more compatible conn = (HttpURLConnection) pURL.openConnection(); } // Set user agent if ((pProperties == null) || !pProperties.containsKey("User-Agent")) { conn.setRequestProperty("User-Agent", VERSION_ID + " (" + System.getProperty("os.name") + "/" + System.getProperty("os.version") + "; " + System.getProperty("os.arch") + "; " + System.getProperty("java.vm.name") + "/" + System.getProperty("java.vm.version") + ")"); } // Set request properties if (pProperties != null) { for (Map.Entry<Object, Object> entry : pProperties.entrySet()) { // Properties key/values can be safely cast to strings conn.setRequestProperty((String) entry.getKey(), entry.getValue().toString()); } } try { // Breaks with JRE1.2? conn.setInstanceFollowRedirects(pFollowRedirects); } catch (LinkageError le) { // This is the best we can do... HttpURLConnection.setFollowRedirects(pFollowRedirects); System.err.println("You are using an old Java Spec, consider upgrading."); System.err.println("java.net.HttpURLConnection.setInstanceFollowRedirects(" + pFollowRedirects + ") failed."); //le.printStackTrace(System.err); } conn.setDoInput(true); conn.setDoOutput(true); //conn.setUseCaches(true); return conn; }
java
public static HttpURLConnection createHttpURLConnection(URL pURL, Properties pProperties, boolean pFollowRedirects, int pTimeout) throws IOException { // Open the connection, and get the stream HttpURLConnection conn; if (pTimeout > 0) { // Supports timeout conn = new com.twelvemonkeys.net.HttpURLConnection(pURL, pTimeout); } else { // Faster, more compatible conn = (HttpURLConnection) pURL.openConnection(); } // Set user agent if ((pProperties == null) || !pProperties.containsKey("User-Agent")) { conn.setRequestProperty("User-Agent", VERSION_ID + " (" + System.getProperty("os.name") + "/" + System.getProperty("os.version") + "; " + System.getProperty("os.arch") + "; " + System.getProperty("java.vm.name") + "/" + System.getProperty("java.vm.version") + ")"); } // Set request properties if (pProperties != null) { for (Map.Entry<Object, Object> entry : pProperties.entrySet()) { // Properties key/values can be safely cast to strings conn.setRequestProperty((String) entry.getKey(), entry.getValue().toString()); } } try { // Breaks with JRE1.2? conn.setInstanceFollowRedirects(pFollowRedirects); } catch (LinkageError le) { // This is the best we can do... HttpURLConnection.setFollowRedirects(pFollowRedirects); System.err.println("You are using an old Java Spec, consider upgrading."); System.err.println("java.net.HttpURLConnection.setInstanceFollowRedirects(" + pFollowRedirects + ") failed."); //le.printStackTrace(System.err); } conn.setDoInput(true); conn.setDoOutput(true); //conn.setUseCaches(true); return conn; }
[ "public", "static", "HttpURLConnection", "createHttpURLConnection", "(", "URL", "pURL", ",", "Properties", "pProperties", ",", "boolean", "pFollowRedirects", ",", "int", "pTimeout", ")", "throws", "IOException", "{", "// Open the connection, and get the stream", "HttpURLConnection", "conn", ";", "if", "(", "pTimeout", ">", "0", ")", "{", "// Supports timeout", "conn", "=", "new", "com", ".", "twelvemonkeys", ".", "net", ".", "HttpURLConnection", "(", "pURL", ",", "pTimeout", ")", ";", "}", "else", "{", "// Faster, more compatible", "conn", "=", "(", "HttpURLConnection", ")", "pURL", ".", "openConnection", "(", ")", ";", "}", "// Set user agent", "if", "(", "(", "pProperties", "==", "null", ")", "||", "!", "pProperties", ".", "containsKey", "(", "\"User-Agent\"", ")", ")", "{", "conn", ".", "setRequestProperty", "(", "\"User-Agent\"", ",", "VERSION_ID", "+", "\" (\"", "+", "System", ".", "getProperty", "(", "\"os.name\"", ")", "+", "\"/\"", "+", "System", ".", "getProperty", "(", "\"os.version\"", ")", "+", "\"; \"", "+", "System", ".", "getProperty", "(", "\"os.arch\"", ")", "+", "\"; \"", "+", "System", ".", "getProperty", "(", "\"java.vm.name\"", ")", "+", "\"/\"", "+", "System", ".", "getProperty", "(", "\"java.vm.version\"", ")", "+", "\")\"", ")", ";", "}", "// Set request properties", "if", "(", "pProperties", "!=", "null", ")", "{", "for", "(", "Map", ".", "Entry", "<", "Object", ",", "Object", ">", "entry", ":", "pProperties", ".", "entrySet", "(", ")", ")", "{", "// Properties key/values can be safely cast to strings", "conn", ".", "setRequestProperty", "(", "(", "String", ")", "entry", ".", "getKey", "(", ")", ",", "entry", ".", "getValue", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "}", "try", "{", "// Breaks with JRE1.2?", "conn", ".", "setInstanceFollowRedirects", "(", "pFollowRedirects", ")", ";", "}", "catch", "(", "LinkageError", "le", ")", "{", "// This is the best we can do...", "HttpURLConnection", ".", "setFollowRedirects", "(", "pFollowRedirects", ")", ";", "System", ".", "err", ".", "println", "(", "\"You are using an old Java Spec, consider upgrading.\"", ")", ";", "System", ".", "err", ".", "println", "(", "\"java.net.HttpURLConnection.setInstanceFollowRedirects(\"", "+", "pFollowRedirects", "+", "\") failed.\"", ")", ";", "//le.printStackTrace(System.err);", "}", "conn", ".", "setDoInput", "(", "true", ")", ";", "conn", ".", "setDoOutput", "(", "true", ")", ";", "//conn.setUseCaches(true);", "return", "conn", ";", "}" ]
Creates a HTTP connection to the given URL. @param pURL the URL to get. @param pProperties connection properties. @param pFollowRedirects specifies whether we should follow redirects. @param pTimeout the specified timeout, in milliseconds. @return a HttpURLConnection @throws UnknownHostException if the hostname in the URL cannot be found. @throws IOException if an I/O exception occurs.
[ "Creates", "a", "HTTP", "connection", "to", "the", "given", "URL", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/NetUtil.java#L869-L919
VoltDB/voltdb
src/frontend/org/voltdb/planner/AbstractParsedStmt.java
AbstractParsedStmt.addSimplifiedSubqueryToStmtCache
private StmtTargetTableScan addSimplifiedSubqueryToStmtCache( StmtSubqueryScan subqueryScan, StmtTargetTableScan tableScan) { """ Replace an existing subquery scan with its underlying table scan. The subquery has already passed all the checks from the canSimplifySubquery method. Subquery ORDER BY clause is ignored if such exists. @param subqueryScan subquery scan to simplify @param tableAlias @return StmtTargetTableScan """ String tableAlias = subqueryScan.getTableAlias(); assert(tableAlias != null); // It is guaranteed by the canSimplifySubquery that there is // one and only one TABLE in the subquery's FROM clause. Table promotedTable = tableScan.getTargetTable(); StmtTargetTableScan promotedScan = new StmtTargetTableScan(promotedTable, tableAlias, m_stmtId); // Keep the original subquery scan to be able to tie the parent // statement column/table names and aliases to the table's. promotedScan.setOriginalSubqueryScan(subqueryScan); // Replace the subquery scan with the table scan StmtTableScan prior = m_tableAliasMap.put(tableAlias, promotedScan); assert(prior == subqueryScan); m_tableList.add(promotedTable); return promotedScan; }
java
private StmtTargetTableScan addSimplifiedSubqueryToStmtCache( StmtSubqueryScan subqueryScan, StmtTargetTableScan tableScan) { String tableAlias = subqueryScan.getTableAlias(); assert(tableAlias != null); // It is guaranteed by the canSimplifySubquery that there is // one and only one TABLE in the subquery's FROM clause. Table promotedTable = tableScan.getTargetTable(); StmtTargetTableScan promotedScan = new StmtTargetTableScan(promotedTable, tableAlias, m_stmtId); // Keep the original subquery scan to be able to tie the parent // statement column/table names and aliases to the table's. promotedScan.setOriginalSubqueryScan(subqueryScan); // Replace the subquery scan with the table scan StmtTableScan prior = m_tableAliasMap.put(tableAlias, promotedScan); assert(prior == subqueryScan); m_tableList.add(promotedTable); return promotedScan; }
[ "private", "StmtTargetTableScan", "addSimplifiedSubqueryToStmtCache", "(", "StmtSubqueryScan", "subqueryScan", ",", "StmtTargetTableScan", "tableScan", ")", "{", "String", "tableAlias", "=", "subqueryScan", ".", "getTableAlias", "(", ")", ";", "assert", "(", "tableAlias", "!=", "null", ")", ";", "// It is guaranteed by the canSimplifySubquery that there is", "// one and only one TABLE in the subquery's FROM clause.", "Table", "promotedTable", "=", "tableScan", ".", "getTargetTable", "(", ")", ";", "StmtTargetTableScan", "promotedScan", "=", "new", "StmtTargetTableScan", "(", "promotedTable", ",", "tableAlias", ",", "m_stmtId", ")", ";", "// Keep the original subquery scan to be able to tie the parent", "// statement column/table names and aliases to the table's.", "promotedScan", ".", "setOriginalSubqueryScan", "(", "subqueryScan", ")", ";", "// Replace the subquery scan with the table scan", "StmtTableScan", "prior", "=", "m_tableAliasMap", ".", "put", "(", "tableAlias", ",", "promotedScan", ")", ";", "assert", "(", "prior", "==", "subqueryScan", ")", ";", "m_tableList", ".", "add", "(", "promotedTable", ")", ";", "return", "promotedScan", ";", "}" ]
Replace an existing subquery scan with its underlying table scan. The subquery has already passed all the checks from the canSimplifySubquery method. Subquery ORDER BY clause is ignored if such exists. @param subqueryScan subquery scan to simplify @param tableAlias @return StmtTargetTableScan
[ "Replace", "an", "existing", "subquery", "scan", "with", "its", "underlying", "table", "scan", ".", "The", "subquery", "has", "already", "passed", "all", "the", "checks", "from", "the", "canSimplifySubquery", "method", ".", "Subquery", "ORDER", "BY", "clause", "is", "ignored", "if", "such", "exists", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/planner/AbstractParsedStmt.java#L894-L911
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnServerConfigurationsInner.java
P2sVpnServerConfigurationsInner.beginDelete
public void beginDelete(String resourceGroupName, String virtualWanName, String p2SVpnServerConfigurationName) { """ Deletes a P2SVpnServerConfiguration. @param resourceGroupName The resource group name of the P2SVpnServerConfiguration. @param virtualWanName The name of the VirtualWan. @param p2SVpnServerConfigurationName The name of the P2SVpnServerConfiguration. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent """ beginDeleteWithServiceResponseAsync(resourceGroupName, virtualWanName, p2SVpnServerConfigurationName).toBlocking().single().body(); }
java
public void beginDelete(String resourceGroupName, String virtualWanName, String p2SVpnServerConfigurationName) { beginDeleteWithServiceResponseAsync(resourceGroupName, virtualWanName, p2SVpnServerConfigurationName).toBlocking().single().body(); }
[ "public", "void", "beginDelete", "(", "String", "resourceGroupName", ",", "String", "virtualWanName", ",", "String", "p2SVpnServerConfigurationName", ")", "{", "beginDeleteWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualWanName", ",", "p2SVpnServerConfigurationName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Deletes a P2SVpnServerConfiguration. @param resourceGroupName The resource group name of the P2SVpnServerConfiguration. @param virtualWanName The name of the VirtualWan. @param p2SVpnServerConfigurationName The name of the P2SVpnServerConfiguration. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Deletes", "a", "P2SVpnServerConfiguration", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnServerConfigurationsInner.java#L450-L452
sarl/sarl
main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/appenders/FormalParameterSourceAppender.java
FormalParameterSourceAppender.eInit
public void eInit(XtendExecutable context, String name, IJvmTypeProvider typeContext) { """ Initialize the formal parameter. @param context the context of the formal parameter. @param name the name of the formal parameter. """ this.builder.eInit(context, name, typeContext); }
java
public void eInit(XtendExecutable context, String name, IJvmTypeProvider typeContext) { this.builder.eInit(context, name, typeContext); }
[ "public", "void", "eInit", "(", "XtendExecutable", "context", ",", "String", "name", ",", "IJvmTypeProvider", "typeContext", ")", "{", "this", ".", "builder", ".", "eInit", "(", "context", ",", "name", ",", "typeContext", ")", ";", "}" ]
Initialize the formal parameter. @param context the context of the formal parameter. @param name the name of the formal parameter.
[ "Initialize", "the", "formal", "parameter", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/appenders/FormalParameterSourceAppender.java#L79-L81
dkpro/dkpro-argumentation
dkpro-argumentation-types/src/main/java/org/dkpro/argumentation/types/ArgumentUnitUtils.java
ArgumentUnitUtils.setProperties
public static void setProperties(ArgumentUnit argumentUnit, Properties properties) throws IllegalArgumentException { """ Sets the given properties to the argumentUnit (into the {@code properties} field). @param argumentUnit argumentUnit @param properties properties @throws IllegalArgumentException if params are null """ if (argumentUnit == null) { throw new IllegalArgumentException("argumentUnit is null"); } if (properties == null) { throw new IllegalArgumentException("properties is null"); } argumentUnit.setProperties(propertiesToString(properties)); }
java
public static void setProperties(ArgumentUnit argumentUnit, Properties properties) throws IllegalArgumentException { if (argumentUnit == null) { throw new IllegalArgumentException("argumentUnit is null"); } if (properties == null) { throw new IllegalArgumentException("properties is null"); } argumentUnit.setProperties(propertiesToString(properties)); }
[ "public", "static", "void", "setProperties", "(", "ArgumentUnit", "argumentUnit", ",", "Properties", "properties", ")", "throws", "IllegalArgumentException", "{", "if", "(", "argumentUnit", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"argumentUnit is null\"", ")", ";", "}", "if", "(", "properties", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"properties is null\"", ")", ";", "}", "argumentUnit", ".", "setProperties", "(", "propertiesToString", "(", "properties", ")", ")", ";", "}" ]
Sets the given properties to the argumentUnit (into the {@code properties} field). @param argumentUnit argumentUnit @param properties properties @throws IllegalArgumentException if params are null
[ "Sets", "the", "given", "properties", "to", "the", "argumentUnit", "(", "into", "the", "{", "@code", "properties", "}", "field", ")", "." ]
train
https://github.com/dkpro/dkpro-argumentation/blob/57ce6f5e73d8075b7088aeeebb107c85b3d4bbcb/dkpro-argumentation-types/src/main/java/org/dkpro/argumentation/types/ArgumentUnitUtils.java#L112-L124
voldemort/voldemort
src/java/voldemort/store/StoreUtils.java
StoreUtils.getStoreDef
public static StoreDefinition getStoreDef(List<StoreDefinition> list, String name) { """ Get a store definition from the given list of store definitions @param list A list of store definitions @param name The name of the store @return The store definition """ for(StoreDefinition def: list) if(def.getName().equals(name)) return def; return null; }
java
public static StoreDefinition getStoreDef(List<StoreDefinition> list, String name) { for(StoreDefinition def: list) if(def.getName().equals(name)) return def; return null; }
[ "public", "static", "StoreDefinition", "getStoreDef", "(", "List", "<", "StoreDefinition", ">", "list", ",", "String", "name", ")", "{", "for", "(", "StoreDefinition", "def", ":", "list", ")", "if", "(", "def", ".", "getName", "(", ")", ".", "equals", "(", "name", ")", ")", "return", "def", ";", "return", "null", ";", "}" ]
Get a store definition from the given list of store definitions @param list A list of store definitions @param name The name of the store @return The store definition
[ "Get", "a", "store", "definition", "from", "the", "given", "list", "of", "store", "definitions" ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/StoreUtils.java#L210-L215
box/box-java-sdk
src/main/java/com/box/sdk/BoxFile.java
BoxFile.canUploadVersion
@Deprecated public void canUploadVersion(String name, long fileSize, String parentID) { """ Checks if the file can be successfully uploaded by using the preflight check. @param name the name to give the uploaded file or null to use existing name. @param fileSize the size of the file used for account capacity calculations. @param parentID the ID of the parent folder that the new version is being uploaded to. @deprecated This method will be removed in future versions of the SDK; use canUploadVersion(String, long) instead """ URL url = CONTENT_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID()); BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, "OPTIONS"); JsonObject parent = new JsonObject(); parent.add("id", parentID); JsonObject preflightInfo = new JsonObject(); preflightInfo.add("parent", parent); if (name != null) { preflightInfo.add("name", name); } preflightInfo.add("size", fileSize); request.setBody(preflightInfo.toString()); BoxAPIResponse response = request.send(); response.disconnect(); }
java
@Deprecated public void canUploadVersion(String name, long fileSize, String parentID) { URL url = CONTENT_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID()); BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, "OPTIONS"); JsonObject parent = new JsonObject(); parent.add("id", parentID); JsonObject preflightInfo = new JsonObject(); preflightInfo.add("parent", parent); if (name != null) { preflightInfo.add("name", name); } preflightInfo.add("size", fileSize); request.setBody(preflightInfo.toString()); BoxAPIResponse response = request.send(); response.disconnect(); }
[ "@", "Deprecated", "public", "void", "canUploadVersion", "(", "String", "name", ",", "long", "fileSize", ",", "String", "parentID", ")", "{", "URL", "url", "=", "CONTENT_URL_TEMPLATE", ".", "build", "(", "this", ".", "getAPI", "(", ")", ".", "getBaseURL", "(", ")", ",", "this", ".", "getID", "(", ")", ")", ";", "BoxJSONRequest", "request", "=", "new", "BoxJSONRequest", "(", "this", ".", "getAPI", "(", ")", ",", "url", ",", "\"OPTIONS\"", ")", ";", "JsonObject", "parent", "=", "new", "JsonObject", "(", ")", ";", "parent", ".", "add", "(", "\"id\"", ",", "parentID", ")", ";", "JsonObject", "preflightInfo", "=", "new", "JsonObject", "(", ")", ";", "preflightInfo", ".", "add", "(", "\"parent\"", ",", "parent", ")", ";", "if", "(", "name", "!=", "null", ")", "{", "preflightInfo", ".", "add", "(", "\"name\"", ",", "name", ")", ";", "}", "preflightInfo", ".", "add", "(", "\"size\"", ",", "fileSize", ")", ";", "request", ".", "setBody", "(", "preflightInfo", ".", "toString", "(", ")", ")", ";", "BoxAPIResponse", "response", "=", "request", ".", "send", "(", ")", ";", "response", ".", "disconnect", "(", ")", ";", "}" ]
Checks if the file can be successfully uploaded by using the preflight check. @param name the name to give the uploaded file or null to use existing name. @param fileSize the size of the file used for account capacity calculations. @param parentID the ID of the parent folder that the new version is being uploaded to. @deprecated This method will be removed in future versions of the SDK; use canUploadVersion(String, long) instead
[ "Checks", "if", "the", "file", "can", "be", "successfully", "uploaded", "by", "using", "the", "preflight", "check", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxFile.java#L652-L671
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaCommonEndpointActivation.java
SibRaCommonEndpointActivation.connectionError
@Override void connectionError(SibRaMessagingEngineConnection connection, SIException exception) { """ An error has been detected on the connection, drop the connection and, if necessary, try to create a new connection """ String methodName = "connectionError"; if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, methodName, new Object[] { connection, exception }); } /* * We have lost our remote connection, output a warning to the * admin console, close the connection and schedule an attempt * to create a new one */ SibTr.warning(TRACE, "CONNECTION_ERROR_CWSIV0776", new Object[] { connection.getConnection().getMeName(), _endpointConfiguration.getBusName(), this, exception }); dropConnection(connection, false, true, true); if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, methodName); } }
java
@Override void connectionError(SibRaMessagingEngineConnection connection, SIException exception) { String methodName = "connectionError"; if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, methodName, new Object[] { connection, exception }); } /* * We have lost our remote connection, output a warning to the * admin console, close the connection and schedule an attempt * to create a new one */ SibTr.warning(TRACE, "CONNECTION_ERROR_CWSIV0776", new Object[] { connection.getConnection().getMeName(), _endpointConfiguration.getBusName(), this, exception }); dropConnection(connection, false, true, true); if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, methodName); } }
[ "@", "Override", "void", "connectionError", "(", "SibRaMessagingEngineConnection", "connection", ",", "SIException", "exception", ")", "{", "String", "methodName", "=", "\"connectionError\"", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "TRACE", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "this", ",", "TRACE", ",", "methodName", ",", "new", "Object", "[", "]", "{", "connection", ",", "exception", "}", ")", ";", "}", "/*\n * We have lost our remote connection, output a warning to the\n * admin console, close the connection and schedule an attempt\n * to create a new one\n */", "SibTr", ".", "warning", "(", "TRACE", ",", "\"CONNECTION_ERROR_CWSIV0776\"", ",", "new", "Object", "[", "]", "{", "connection", ".", "getConnection", "(", ")", ".", "getMeName", "(", ")", ",", "_endpointConfiguration", ".", "getBusName", "(", ")", ",", "this", ",", "exception", "}", ")", ";", "dropConnection", "(", "connection", ",", "false", ",", "true", ",", "true", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "TRACE", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "exit", "(", "this", ",", "TRACE", ",", "methodName", ")", ";", "}", "}" ]
An error has been detected on the connection, drop the connection and, if necessary, try to create a new connection
[ "An", "error", "has", "been", "detected", "on", "the", "connection", "drop", "the", "connection", "and", "if", "necessary", "try", "to", "create", "a", "new", "connection" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaCommonEndpointActivation.java#L1106-L1132
rythmengine/rythmengine
src/main/java/org/rythmengine/RythmEngine.java
RythmEngine.getTemplate
@SuppressWarnings("unchecked") public ITemplate getTemplate(String template, Object... args) { """ Get an new {@link ITemplate template} instance from a String and an array of render args. The string parameter could be either a template file path or the inline template source content. <p/> <p>When the args array contains only one element and is of {@link java.util.Map} type the the render args are passed to template {@link ITemplate#__setRenderArgs(java.util.Map) by name}, otherwise they passes to template instance by position</p> @param template @param args @return template instance """ return getTemplate(null, template, args); }
java
@SuppressWarnings("unchecked") public ITemplate getTemplate(String template, Object... args) { return getTemplate(null, template, args); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "ITemplate", "getTemplate", "(", "String", "template", ",", "Object", "...", "args", ")", "{", "return", "getTemplate", "(", "null", ",", "template", ",", "args", ")", ";", "}" ]
Get an new {@link ITemplate template} instance from a String and an array of render args. The string parameter could be either a template file path or the inline template source content. <p/> <p>When the args array contains only one element and is of {@link java.util.Map} type the the render args are passed to template {@link ITemplate#__setRenderArgs(java.util.Map) by name}, otherwise they passes to template instance by position</p> @param template @param args @return template instance
[ "Get", "an", "new", "{", "@link", "ITemplate", "template", "}", "instance", "from", "a", "String", "and", "an", "array", "of", "render", "args", ".", "The", "string", "parameter", "could", "be", "either", "a", "template", "file", "path", "or", "the", "inline", "template", "source", "content", ".", "<p", "/", ">", "<p", ">", "When", "the", "args", "array", "contains", "only", "one", "element", "and", "is", "of", "{", "@link", "java", ".", "util", ".", "Map", "}", "type", "the", "the", "render", "args", "are", "passed", "to", "template", "{", "@link", "ITemplate#__setRenderArgs", "(", "java", ".", "util", ".", "Map", ")", "by", "name", "}", "otherwise", "they", "passes", "to", "template", "instance", "by", "position<", "/", "p", ">" ]
train
https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/RythmEngine.java#L918-L921
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/util/BrokerHelper.java
BrokerHelper.setAutoIncrementValue
private Object setAutoIncrementValue(FieldDescriptor fd, Object obj) { """ Set an autoincremented value in given object field that has already had a field conversion run on it, if an value for the given field is already set, it will be overridden - no further checks are done. <p> The data type of the value that is returned by this method is compatible with the java-world. The return value has <b>NOT</b> been run through a field conversion and converted to a corresponding sql-type. @return the autoincremented value set on given object @throws PersistenceBrokerException if there is an erros accessing obj field values """ PersistentField f = fd.getPersistentField(); try { // lookup SeqMan for a value matching db column an Object result = m_broker.serviceSequenceManager().getUniqueValue(fd); // reflect autoincrement value back into object f.set(obj, result); return result; } catch(MetadataException e) { throw new PersistenceBrokerException( "Error while trying to autoincrement field " + f.getDeclaringClass() + "#" + f.getName(), e); } catch(SequenceManagerException e) { throw new PersistenceBrokerException("Could not get key value", e); } }
java
private Object setAutoIncrementValue(FieldDescriptor fd, Object obj) { PersistentField f = fd.getPersistentField(); try { // lookup SeqMan for a value matching db column an Object result = m_broker.serviceSequenceManager().getUniqueValue(fd); // reflect autoincrement value back into object f.set(obj, result); return result; } catch(MetadataException e) { throw new PersistenceBrokerException( "Error while trying to autoincrement field " + f.getDeclaringClass() + "#" + f.getName(), e); } catch(SequenceManagerException e) { throw new PersistenceBrokerException("Could not get key value", e); } }
[ "private", "Object", "setAutoIncrementValue", "(", "FieldDescriptor", "fd", ",", "Object", "obj", ")", "{", "PersistentField", "f", "=", "fd", ".", "getPersistentField", "(", ")", ";", "try", "{", "// lookup SeqMan for a value matching db column an\r", "Object", "result", "=", "m_broker", ".", "serviceSequenceManager", "(", ")", ".", "getUniqueValue", "(", "fd", ")", ";", "// reflect autoincrement value back into object\r", "f", ".", "set", "(", "obj", ",", "result", ")", ";", "return", "result", ";", "}", "catch", "(", "MetadataException", "e", ")", "{", "throw", "new", "PersistenceBrokerException", "(", "\"Error while trying to autoincrement field \"", "+", "f", ".", "getDeclaringClass", "(", ")", "+", "\"#\"", "+", "f", ".", "getName", "(", ")", ",", "e", ")", ";", "}", "catch", "(", "SequenceManagerException", "e", ")", "{", "throw", "new", "PersistenceBrokerException", "(", "\"Could not get key value\"", ",", "e", ")", ";", "}", "}" ]
Set an autoincremented value in given object field that has already had a field conversion run on it, if an value for the given field is already set, it will be overridden - no further checks are done. <p> The data type of the value that is returned by this method is compatible with the java-world. The return value has <b>NOT</b> been run through a field conversion and converted to a corresponding sql-type. @return the autoincremented value set on given object @throws PersistenceBrokerException if there is an erros accessing obj field values
[ "Set", "an", "autoincremented", "value", "in", "given", "object", "field", "that", "has", "already", "had", "a", "field", "conversion", "run", "on", "it", "if", "an", "value", "for", "the", "given", "field", "is", "already", "set", "it", "will", "be", "overridden", "-", "no", "further", "checks", "are", "done", ".", "<p", ">", "The", "data", "type", "of", "the", "value", "that", "is", "returned", "by", "this", "method", "is", "compatible", "with", "the", "java", "-", "world", ".", "The", "return", "value", "has", "<b", ">", "NOT<", "/", "b", ">", "been", "run", "through", "a", "field", "conversion", "and", "converted", "to", "a", "corresponding", "sql", "-", "type", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/BrokerHelper.java#L319-L340
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/frontier/WorkbenchVirtualizer.java
WorkbenchVirtualizer.collectIf
public void collectIf(final double threshold, final double targetRatio) throws IOException { """ Performs a garbage collection if the space used is below a given threshold, reaching a given target ratio. @param threshold if {@link ByteArrayDiskQueues#ratio()} is below this value, a garbage collection will be performed. @param targetRatio passed to {@link ByteArrayDiskQueues#count(Object)}. """ if (byteArrayDiskQueues.ratio() < threshold) { LOGGER.info("Starting collection..."); byteArrayDiskQueues.collect(targetRatio); LOGGER.info("Completed collection."); } }
java
public void collectIf(final double threshold, final double targetRatio) throws IOException { if (byteArrayDiskQueues.ratio() < threshold) { LOGGER.info("Starting collection..."); byteArrayDiskQueues.collect(targetRatio); LOGGER.info("Completed collection."); } }
[ "public", "void", "collectIf", "(", "final", "double", "threshold", ",", "final", "double", "targetRatio", ")", "throws", "IOException", "{", "if", "(", "byteArrayDiskQueues", ".", "ratio", "(", ")", "<", "threshold", ")", "{", "LOGGER", ".", "info", "(", "\"Starting collection...\"", ")", ";", "byteArrayDiskQueues", ".", "collect", "(", "targetRatio", ")", ";", "LOGGER", ".", "info", "(", "\"Completed collection.\"", ")", ";", "}", "}" ]
Performs a garbage collection if the space used is below a given threshold, reaching a given target ratio. @param threshold if {@link ByteArrayDiskQueues#ratio()} is below this value, a garbage collection will be performed. @param targetRatio passed to {@link ByteArrayDiskQueues#count(Object)}.
[ "Performs", "a", "garbage", "collection", "if", "the", "space", "used", "is", "below", "a", "given", "threshold", "reaching", "a", "given", "target", "ratio", "." ]
train
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/frontier/WorkbenchVirtualizer.java#L137-L143
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/ProxiedFileSystemWrapper.java
ProxiedFileSystemWrapper.getProxiedFileSystem
public FileSystem getProxiedFileSystem(State properties, AuthType authType, String authPath, String uri, final Configuration conf) throws IOException, InterruptedException, URISyntaxException { """ Getter for proxiedFs, using the passed parameters to create an instance of a proxiedFs. @param properties @param authType is either TOKEN or KEYTAB. @param authPath is the KEYTAB location if the authType is KEYTAB; otherwise, it is the token file. @param uri File system URI. @throws IOException @throws InterruptedException @throws URISyntaxException @return proxiedFs """ Preconditions.checkArgument(StringUtils.isNotBlank(properties.getProp(ConfigurationKeys.FS_PROXY_AS_USER_NAME)), "State does not contain a proper proxy user name"); String proxyUserName = properties.getProp(ConfigurationKeys.FS_PROXY_AS_USER_NAME); UserGroupInformation proxyUser; switch (authType) { case KEYTAB: // If the authentication type is KEYTAB, log in a super user first before creating a proxy user. Preconditions.checkArgument( StringUtils.isNotBlank(properties.getProp(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS)), "State does not contain a proper proxy token file name"); String superUser = properties.getProp(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS); UserGroupInformation.loginUserFromKeytab(superUser, authPath); proxyUser = UserGroupInformation.createProxyUser(proxyUserName, UserGroupInformation.getLoginUser()); break; case TOKEN: // If the authentication type is TOKEN, create a proxy user and then add the token to the user. proxyUser = UserGroupInformation.createProxyUser(proxyUserName, UserGroupInformation.getLoginUser()); Optional<Token<?>> proxyToken = getTokenFromSeqFile(authPath, proxyUserName); if (proxyToken.isPresent()) { proxyUser.addToken(proxyToken.get()); } else { LOG.warn("No delegation token found for the current proxy user."); } break; default: LOG.warn("Creating a proxy user without authentication, which could not perform File system operations."); proxyUser = UserGroupInformation.createProxyUser(proxyUserName, UserGroupInformation.getLoginUser()); break; } final URI fsURI = URI.create(uri); proxyUser.doAs(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws IOException { LOG.debug("Now performing file system operations as :" + UserGroupInformation.getCurrentUser()); proxiedFs = FileSystem.get(fsURI, conf); return null; } }); return this.proxiedFs; }
java
public FileSystem getProxiedFileSystem(State properties, AuthType authType, String authPath, String uri, final Configuration conf) throws IOException, InterruptedException, URISyntaxException { Preconditions.checkArgument(StringUtils.isNotBlank(properties.getProp(ConfigurationKeys.FS_PROXY_AS_USER_NAME)), "State does not contain a proper proxy user name"); String proxyUserName = properties.getProp(ConfigurationKeys.FS_PROXY_AS_USER_NAME); UserGroupInformation proxyUser; switch (authType) { case KEYTAB: // If the authentication type is KEYTAB, log in a super user first before creating a proxy user. Preconditions.checkArgument( StringUtils.isNotBlank(properties.getProp(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS)), "State does not contain a proper proxy token file name"); String superUser = properties.getProp(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS); UserGroupInformation.loginUserFromKeytab(superUser, authPath); proxyUser = UserGroupInformation.createProxyUser(proxyUserName, UserGroupInformation.getLoginUser()); break; case TOKEN: // If the authentication type is TOKEN, create a proxy user and then add the token to the user. proxyUser = UserGroupInformation.createProxyUser(proxyUserName, UserGroupInformation.getLoginUser()); Optional<Token<?>> proxyToken = getTokenFromSeqFile(authPath, proxyUserName); if (proxyToken.isPresent()) { proxyUser.addToken(proxyToken.get()); } else { LOG.warn("No delegation token found for the current proxy user."); } break; default: LOG.warn("Creating a proxy user without authentication, which could not perform File system operations."); proxyUser = UserGroupInformation.createProxyUser(proxyUserName, UserGroupInformation.getLoginUser()); break; } final URI fsURI = URI.create(uri); proxyUser.doAs(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws IOException { LOG.debug("Now performing file system operations as :" + UserGroupInformation.getCurrentUser()); proxiedFs = FileSystem.get(fsURI, conf); return null; } }); return this.proxiedFs; }
[ "public", "FileSystem", "getProxiedFileSystem", "(", "State", "properties", ",", "AuthType", "authType", ",", "String", "authPath", ",", "String", "uri", ",", "final", "Configuration", "conf", ")", "throws", "IOException", ",", "InterruptedException", ",", "URISyntaxException", "{", "Preconditions", ".", "checkArgument", "(", "StringUtils", ".", "isNotBlank", "(", "properties", ".", "getProp", "(", "ConfigurationKeys", ".", "FS_PROXY_AS_USER_NAME", ")", ")", ",", "\"State does not contain a proper proxy user name\"", ")", ";", "String", "proxyUserName", "=", "properties", ".", "getProp", "(", "ConfigurationKeys", ".", "FS_PROXY_AS_USER_NAME", ")", ";", "UserGroupInformation", "proxyUser", ";", "switch", "(", "authType", ")", "{", "case", "KEYTAB", ":", "// If the authentication type is KEYTAB, log in a super user first before creating a proxy user.", "Preconditions", ".", "checkArgument", "(", "StringUtils", ".", "isNotBlank", "(", "properties", ".", "getProp", "(", "ConfigurationKeys", ".", "SUPER_USER_NAME_TO_PROXY_AS_OTHERS", ")", ")", ",", "\"State does not contain a proper proxy token file name\"", ")", ";", "String", "superUser", "=", "properties", ".", "getProp", "(", "ConfigurationKeys", ".", "SUPER_USER_NAME_TO_PROXY_AS_OTHERS", ")", ";", "UserGroupInformation", ".", "loginUserFromKeytab", "(", "superUser", ",", "authPath", ")", ";", "proxyUser", "=", "UserGroupInformation", ".", "createProxyUser", "(", "proxyUserName", ",", "UserGroupInformation", ".", "getLoginUser", "(", ")", ")", ";", "break", ";", "case", "TOKEN", ":", "// If the authentication type is TOKEN, create a proxy user and then add the token to the user.", "proxyUser", "=", "UserGroupInformation", ".", "createProxyUser", "(", "proxyUserName", ",", "UserGroupInformation", ".", "getLoginUser", "(", ")", ")", ";", "Optional", "<", "Token", "<", "?", ">", ">", "proxyToken", "=", "getTokenFromSeqFile", "(", "authPath", ",", "proxyUserName", ")", ";", "if", "(", "proxyToken", ".", "isPresent", "(", ")", ")", "{", "proxyUser", ".", "addToken", "(", "proxyToken", ".", "get", "(", ")", ")", ";", "}", "else", "{", "LOG", ".", "warn", "(", "\"No delegation token found for the current proxy user.\"", ")", ";", "}", "break", ";", "default", ":", "LOG", ".", "warn", "(", "\"Creating a proxy user without authentication, which could not perform File system operations.\"", ")", ";", "proxyUser", "=", "UserGroupInformation", ".", "createProxyUser", "(", "proxyUserName", ",", "UserGroupInformation", ".", "getLoginUser", "(", ")", ")", ";", "break", ";", "}", "final", "URI", "fsURI", "=", "URI", ".", "create", "(", "uri", ")", ";", "proxyUser", ".", "doAs", "(", "new", "PrivilegedExceptionAction", "<", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "run", "(", ")", "throws", "IOException", "{", "LOG", ".", "debug", "(", "\"Now performing file system operations as :\"", "+", "UserGroupInformation", ".", "getCurrentUser", "(", ")", ")", ";", "proxiedFs", "=", "FileSystem", ".", "get", "(", "fsURI", ",", "conf", ")", ";", "return", "null", ";", "}", "}", ")", ";", "return", "this", ".", "proxiedFs", ";", "}" ]
Getter for proxiedFs, using the passed parameters to create an instance of a proxiedFs. @param properties @param authType is either TOKEN or KEYTAB. @param authPath is the KEYTAB location if the authType is KEYTAB; otherwise, it is the token file. @param uri File system URI. @throws IOException @throws InterruptedException @throws URISyntaxException @return proxiedFs
[ "Getter", "for", "proxiedFs", "using", "the", "passed", "parameters", "to", "create", "an", "instance", "of", "a", "proxiedFs", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ProxiedFileSystemWrapper.java#L101-L141
rundeck/rundeck
core/src/main/java/com/dtolabs/utils/Mapper.java
Mapper.makeMap
public static Map makeMap(Mapper mapper, Collection c) { """ Create a new Map by using the collection objects as keys, and the mapping result as values. Discard keys which return null values from the mapper. @param mapper a Mapper to map the values @param c Collection of items @return a new Map with values mapped """ return makeMap(mapper, c.iterator(), false); }
java
public static Map makeMap(Mapper mapper, Collection c) { return makeMap(mapper, c.iterator(), false); }
[ "public", "static", "Map", "makeMap", "(", "Mapper", "mapper", ",", "Collection", "c", ")", "{", "return", "makeMap", "(", "mapper", ",", "c", ".", "iterator", "(", ")", ",", "false", ")", ";", "}" ]
Create a new Map by using the collection objects as keys, and the mapping result as values. Discard keys which return null values from the mapper. @param mapper a Mapper to map the values @param c Collection of items @return a new Map with values mapped
[ "Create", "a", "new", "Map", "by", "using", "the", "collection", "objects", "as", "keys", "and", "the", "mapping", "result", "as", "values", ".", "Discard", "keys", "which", "return", "null", "values", "from", "the", "mapper", "." ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/utils/Mapper.java#L519-L521
mangstadt/biweekly
src/main/java/biweekly/util/com/google/ical/iter/RecurrenceIteratorFactory.java
RecurrenceIteratorFactory.createRecurrenceIterable
public static RecurrenceIterable createRecurrenceIterable(final Recurrence rrule, final DateValue dtStart, final TimeZone tzid) { """ Creates a recurrence iterable from an RRULE. @param rrule the recurrence rule @param dtStart the start date of the series @param tzid the timezone that the start date is in, as well as the timezone to iterate in @return the iterable """ return new RecurrenceIterable() { public RecurrenceIterator iterator() { return createRecurrenceIterator(rrule, dtStart, tzid); } }; }
java
public static RecurrenceIterable createRecurrenceIterable(final Recurrence rrule, final DateValue dtStart, final TimeZone tzid) { return new RecurrenceIterable() { public RecurrenceIterator iterator() { return createRecurrenceIterator(rrule, dtStart, tzid); } }; }
[ "public", "static", "RecurrenceIterable", "createRecurrenceIterable", "(", "final", "Recurrence", "rrule", ",", "final", "DateValue", "dtStart", ",", "final", "TimeZone", "tzid", ")", "{", "return", "new", "RecurrenceIterable", "(", ")", "{", "public", "RecurrenceIterator", "iterator", "(", ")", "{", "return", "createRecurrenceIterator", "(", "rrule", ",", "dtStart", ",", "tzid", ")", ";", "}", "}", ";", "}" ]
Creates a recurrence iterable from an RRULE. @param rrule the recurrence rule @param dtStart the start date of the series @param tzid the timezone that the start date is in, as well as the timezone to iterate in @return the iterable
[ "Creates", "a", "recurrence", "iterable", "from", "an", "RRULE", "." ]
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/util/com/google/ical/iter/RecurrenceIteratorFactory.java#L117-L123
OpenLiberty/open-liberty
dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/notification/NotificationManager.java
NotificationManager.deleteRegisteredListeners
public void deleteRegisteredListeners(RESTRequest request, int clientID, ObjectName source_objName, JSONConverter converter) { """ Delete all registered server-side notifications for the given object name. This can only be called from HTTP-direct clients """ //Get the client area ClientNotificationArea clientArea = getInboxIfAvailable(clientID, null); clientArea.removeAllListeners(request, source_objName, converter); }
java
public void deleteRegisteredListeners(RESTRequest request, int clientID, ObjectName source_objName, JSONConverter converter) { //Get the client area ClientNotificationArea clientArea = getInboxIfAvailable(clientID, null); clientArea.removeAllListeners(request, source_objName, converter); }
[ "public", "void", "deleteRegisteredListeners", "(", "RESTRequest", "request", ",", "int", "clientID", ",", "ObjectName", "source_objName", ",", "JSONConverter", "converter", ")", "{", "//Get the client area", "ClientNotificationArea", "clientArea", "=", "getInboxIfAvailable", "(", "clientID", ",", "null", ")", ";", "clientArea", ".", "removeAllListeners", "(", "request", ",", "source_objName", ",", "converter", ")", ";", "}" ]
Delete all registered server-side notifications for the given object name. This can only be called from HTTP-direct clients
[ "Delete", "all", "registered", "server", "-", "side", "notifications", "for", "the", "given", "object", "name", ".", "This", "can", "only", "be", "called", "from", "HTTP", "-", "direct", "clients" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/notification/NotificationManager.java#L303-L308
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/util/ClassGraphUtil.java
ClassGraphUtil.getSubclassInstances
public synchronized static <T> Set<T> getSubclassInstances(Class<T> parentClass, String... packageNames) { """ search and create new instances of concrete subclasses, 1 for each. Note that we only initiate subclasses which are with default constructor, those without default constructors we judge them as canInitiate=false. @param parentClass parent class @param packageNames package name prefix @param <T> class generic type @return a set of subclass instances """ return getNonAbstractSubClasses(parentClass, packageNames).stream() .filter(subclass -> { if (Reflection.canInitiate(subclass)) { return true; } else { System.out.println(subclass + " can not be initiated, ignored."); return false; } }) .map(subclass -> { try { return subclass.newInstance(); } catch (InstantiationException | IllegalAccessException e) { e.printStackTrace(); return null; } }).collect(Collectors.toSet()); }
java
public synchronized static <T> Set<T> getSubclassInstances(Class<T> parentClass, String... packageNames) { return getNonAbstractSubClasses(parentClass, packageNames).stream() .filter(subclass -> { if (Reflection.canInitiate(subclass)) { return true; } else { System.out.println(subclass + " can not be initiated, ignored."); return false; } }) .map(subclass -> { try { return subclass.newInstance(); } catch (InstantiationException | IllegalAccessException e) { e.printStackTrace(); return null; } }).collect(Collectors.toSet()); }
[ "public", "synchronized", "static", "<", "T", ">", "Set", "<", "T", ">", "getSubclassInstances", "(", "Class", "<", "T", ">", "parentClass", ",", "String", "...", "packageNames", ")", "{", "return", "getNonAbstractSubClasses", "(", "parentClass", ",", "packageNames", ")", ".", "stream", "(", ")", ".", "filter", "(", "subclass", "->", "{", "if", "(", "Reflection", ".", "canInitiate", "(", "subclass", ")", ")", "{", "return", "true", ";", "}", "else", "{", "System", ".", "out", ".", "println", "(", "subclass", "+", "\" can not be initiated, ignored.\"", ")", ";", "return", "false", ";", "}", "}", ")", ".", "map", "(", "subclass", "->", "{", "try", "{", "return", "subclass", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "InstantiationException", "|", "IllegalAccessException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "return", "null", ";", "}", "}", ")", ".", "collect", "(", "Collectors", ".", "toSet", "(", ")", ")", ";", "}" ]
search and create new instances of concrete subclasses, 1 for each. Note that we only initiate subclasses which are with default constructor, those without default constructors we judge them as canInitiate=false. @param parentClass parent class @param packageNames package name prefix @param <T> class generic type @return a set of subclass instances
[ "search", "and", "create", "new", "instances", "of", "concrete", "subclasses", "1", "for", "each", ".", "Note", "that", "we", "only", "initiate", "subclasses", "which", "are", "with", "default", "constructor", "those", "without", "default", "constructors", "we", "judge", "them", "as", "canInitiate", "=", "false", "." ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/util/ClassGraphUtil.java#L102-L120
brianwhu/xillium
base/src/main/java/org/xillium/base/beans/Strings.java
Strings.toHexString
public static String toHexString(byte[] raw) { """ Converts an array of bytes into a hexadecimal representation. This implementation is significantly faster than DatatypeConverter.printHexBinary(). @param raw the byte array to convert to a hexadecimal String @return a hexadecimal String representing the bytes """ byte[] hex = new byte[2 * raw.length]; int index = 0; for (byte b : raw) { int v = b & 0x00ff; hex[index++] = HEX_CHARS[v >>> 4]; hex[index++] = HEX_CHARS[v & 0xf]; } try { return new String(hex, "ASCII"); } catch (java.io.UnsupportedEncodingException x) { throw new RuntimeException(x.getMessage(), x); } }
java
public static String toHexString(byte[] raw) { byte[] hex = new byte[2 * raw.length]; int index = 0; for (byte b : raw) { int v = b & 0x00ff; hex[index++] = HEX_CHARS[v >>> 4]; hex[index++] = HEX_CHARS[v & 0xf]; } try { return new String(hex, "ASCII"); } catch (java.io.UnsupportedEncodingException x) { throw new RuntimeException(x.getMessage(), x); } }
[ "public", "static", "String", "toHexString", "(", "byte", "[", "]", "raw", ")", "{", "byte", "[", "]", "hex", "=", "new", "byte", "[", "2", "*", "raw", ".", "length", "]", ";", "int", "index", "=", "0", ";", "for", "(", "byte", "b", ":", "raw", ")", "{", "int", "v", "=", "b", "&", "0x00ff", ";", "hex", "[", "index", "++", "]", "=", "HEX_CHARS", "[", "v", ">>>", "4", "]", ";", "hex", "[", "index", "++", "]", "=", "HEX_CHARS", "[", "v", "&", "0xf", "]", ";", "}", "try", "{", "return", "new", "String", "(", "hex", ",", "\"ASCII\"", ")", ";", "}", "catch", "(", "java", ".", "io", ".", "UnsupportedEncodingException", "x", ")", "{", "throw", "new", "RuntimeException", "(", "x", ".", "getMessage", "(", ")", ",", "x", ")", ";", "}", "}" ]
Converts an array of bytes into a hexadecimal representation. This implementation is significantly faster than DatatypeConverter.printHexBinary(). @param raw the byte array to convert to a hexadecimal String @return a hexadecimal String representing the bytes
[ "Converts", "an", "array", "of", "bytes", "into", "a", "hexadecimal", "representation", "." ]
train
https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/base/src/main/java/org/xillium/base/beans/Strings.java#L32-L45
Azure/azure-sdk-for-java
compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/DisksInner.java
DisksInner.getByResourceGroupAsync
public Observable<DiskInner> getByResourceGroupAsync(String resourceGroupName, String diskName) { """ Gets information about a disk. @param resourceGroupName The name of the resource group. @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DiskInner object """ return getByResourceGroupWithServiceResponseAsync(resourceGroupName, diskName).map(new Func1<ServiceResponse<DiskInner>, DiskInner>() { @Override public DiskInner call(ServiceResponse<DiskInner> response) { return response.body(); } }); }
java
public Observable<DiskInner> getByResourceGroupAsync(String resourceGroupName, String diskName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, diskName).map(new Func1<ServiceResponse<DiskInner>, DiskInner>() { @Override public DiskInner call(ServiceResponse<DiskInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DiskInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "diskName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "diskName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "DiskInner", ">", ",", "DiskInner", ">", "(", ")", "{", "@", "Override", "public", "DiskInner", "call", "(", "ServiceResponse", "<", "DiskInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets information about a disk. @param resourceGroupName The name of the resource group. @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DiskInner object
[ "Gets", "information", "about", "a", "disk", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/DisksInner.java#L512-L519
banq/jdonframework
src/main/java/com/jdon/util/UtilDateTime.java
UtilDateTime.toTimestamp
public static java.sql.Timestamp toTimestamp(String monthStr, String dayStr, String yearStr, String hourStr, String minuteStr, String secondStr) { """ Makes a Timestamp from separate Strings for month, day, year, hour, minute, and second. @param monthStr The month String @param dayStr The day String @param yearStr The year String @param hourStr The hour String @param minuteStr The minute String @param secondStr The second String @return A Timestamp made from separate Strings for month, day, year, hour, minute, and second. """ java.util.Date newDate = toDate(monthStr, dayStr, yearStr, hourStr, minuteStr, secondStr); if (newDate != null) return new java.sql.Timestamp(newDate.getTime()); else return null; }
java
public static java.sql.Timestamp toTimestamp(String monthStr, String dayStr, String yearStr, String hourStr, String minuteStr, String secondStr) { java.util.Date newDate = toDate(monthStr, dayStr, yearStr, hourStr, minuteStr, secondStr); if (newDate != null) return new java.sql.Timestamp(newDate.getTime()); else return null; }
[ "public", "static", "java", ".", "sql", ".", "Timestamp", "toTimestamp", "(", "String", "monthStr", ",", "String", "dayStr", ",", "String", "yearStr", ",", "String", "hourStr", ",", "String", "minuteStr", ",", "String", "secondStr", ")", "{", "java", ".", "util", ".", "Date", "newDate", "=", "toDate", "(", "monthStr", ",", "dayStr", ",", "yearStr", ",", "hourStr", ",", "minuteStr", ",", "secondStr", ")", ";", "if", "(", "newDate", "!=", "null", ")", "return", "new", "java", ".", "sql", ".", "Timestamp", "(", "newDate", ".", "getTime", "(", ")", ")", ";", "else", "return", "null", ";", "}" ]
Makes a Timestamp from separate Strings for month, day, year, hour, minute, and second. @param monthStr The month String @param dayStr The day String @param yearStr The year String @param hourStr The hour String @param minuteStr The minute String @param secondStr The second String @return A Timestamp made from separate Strings for month, day, year, hour, minute, and second.
[ "Makes", "a", "Timestamp", "from", "separate", "Strings", "for", "month", "day", "year", "hour", "minute", "and", "second", "." ]
train
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilDateTime.java#L258-L265
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/imports/RewritableImportSection.java
RewritableImportSection.addStaticImport
public boolean addStaticImport(final String typeFqn, final String member) { """ @param typeFqn The fully qualified name of the type to import. E.g. <code>java.util.List</code>. May not be <code>null</code>. @param member member name to import. May not be <code>null</code>. For wildcard use <code>*</code> """ if (typeFqn == null || member == null) { throw new IllegalArgumentException("Type name " + typeFqn + ". Member name: " + member); } if (hasStaticImport(typeFqn, member, false)) { return false; } XImportDeclaration importDecl = createImport(typeFqn, member); importDecl.setStatic(true); return addedImportDeclarations.add(importDecl); }
java
public boolean addStaticImport(final String typeFqn, final String member) { if (typeFqn == null || member == null) { throw new IllegalArgumentException("Type name " + typeFqn + ". Member name: " + member); } if (hasStaticImport(typeFqn, member, false)) { return false; } XImportDeclaration importDecl = createImport(typeFqn, member); importDecl.setStatic(true); return addedImportDeclarations.add(importDecl); }
[ "public", "boolean", "addStaticImport", "(", "final", "String", "typeFqn", ",", "final", "String", "member", ")", "{", "if", "(", "typeFqn", "==", "null", "||", "member", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Type name \"", "+", "typeFqn", "+", "\". Member name: \"", "+", "member", ")", ";", "}", "if", "(", "hasStaticImport", "(", "typeFqn", ",", "member", ",", "false", ")", ")", "{", "return", "false", ";", "}", "XImportDeclaration", "importDecl", "=", "createImport", "(", "typeFqn", ",", "member", ")", ";", "importDecl", ".", "setStatic", "(", "true", ")", ";", "return", "addedImportDeclarations", ".", "add", "(", "importDecl", ")", ";", "}" ]
@param typeFqn The fully qualified name of the type to import. E.g. <code>java.util.List</code>. May not be <code>null</code>. @param member member name to import. May not be <code>null</code>. For wildcard use <code>*</code>
[ "@param", "typeFqn", "The", "fully", "qualified", "name", "of", "the", "type", "to", "import", ".", "E", ".", "g", ".", "<code", ">", "java", ".", "util", ".", "List<", "/", "code", ">", ".", "May", "not", "be", "<code", ">", "null<", "/", "code", ">", ".", "@param", "member", "member", "name", "to", "import", ".", "May", "not", "be", "<code", ">", "null<", "/", "code", ">", ".", "For", "wildcard", "use", "<code", ">", "*", "<", "/", "code", ">" ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/imports/RewritableImportSection.java#L302-L312
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/sql/SqlGeneratorDefaultImpl.java
SqlGeneratorDefaultImpl.getPreparedUpdateStatement
public SqlStatement getPreparedUpdateStatement(ClassDescriptor cld) { """ generate a prepared UPDATE-Statement for the Class described by cld @param cld the ClassDescriptor """ SqlForClass sfc = getSqlForClass(cld); SqlStatement result = sfc.getUpdateSql(); if(result == null) { ProcedureDescriptor pd = cld.getUpdateProcedure(); if(pd == null) { result = new SqlUpdateStatement(cld, logger); } else { result = new SqlProcedureStatement(pd, logger); } // set the sql string sfc.setUpdateSql(result); if(logger.isDebugEnabled()) { logger.debug("SQL:" + result.getStatement()); } } return result; }
java
public SqlStatement getPreparedUpdateStatement(ClassDescriptor cld) { SqlForClass sfc = getSqlForClass(cld); SqlStatement result = sfc.getUpdateSql(); if(result == null) { ProcedureDescriptor pd = cld.getUpdateProcedure(); if(pd == null) { result = new SqlUpdateStatement(cld, logger); } else { result = new SqlProcedureStatement(pd, logger); } // set the sql string sfc.setUpdateSql(result); if(logger.isDebugEnabled()) { logger.debug("SQL:" + result.getStatement()); } } return result; }
[ "public", "SqlStatement", "getPreparedUpdateStatement", "(", "ClassDescriptor", "cld", ")", "{", "SqlForClass", "sfc", "=", "getSqlForClass", "(", "cld", ")", ";", "SqlStatement", "result", "=", "sfc", ".", "getUpdateSql", "(", ")", ";", "if", "(", "result", "==", "null", ")", "{", "ProcedureDescriptor", "pd", "=", "cld", ".", "getUpdateProcedure", "(", ")", ";", "if", "(", "pd", "==", "null", ")", "{", "result", "=", "new", "SqlUpdateStatement", "(", "cld", ",", "logger", ")", ";", "}", "else", "{", "result", "=", "new", "SqlProcedureStatement", "(", "pd", ",", "logger", ")", ";", "}", "// set the sql string\r", "sfc", ".", "setUpdateSql", "(", "result", ")", ";", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"SQL:\"", "+", "result", ".", "getStatement", "(", ")", ")", ";", "}", "}", "return", "result", ";", "}" ]
generate a prepared UPDATE-Statement for the Class described by cld @param cld the ClassDescriptor
[ "generate", "a", "prepared", "UPDATE", "-", "Statement", "for", "the", "Class", "described", "by", "cld" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlGeneratorDefaultImpl.java#L201-L226
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/apache/logging/log4j/spi/LoggerRegistry.java
LoggerRegistry.hasLogger
public boolean hasLogger(final String name, final Class<? extends MessageFactory> messageFactoryClass) { """ Detects if a Logger with the specified name and MessageFactory type exists. @param name The Logger name to search for. @param messageFactoryClass The message factory class to search for. @return true if the Logger exists, false otherwise. @since 2.5 """ return getOrCreateInnerMap(factoryClassKey(messageFactoryClass)).containsKey(name); }
java
public boolean hasLogger(final String name, final Class<? extends MessageFactory> messageFactoryClass) { return getOrCreateInnerMap(factoryClassKey(messageFactoryClass)).containsKey(name); }
[ "public", "boolean", "hasLogger", "(", "final", "String", "name", ",", "final", "Class", "<", "?", "extends", "MessageFactory", ">", "messageFactoryClass", ")", "{", "return", "getOrCreateInnerMap", "(", "factoryClassKey", "(", "messageFactoryClass", ")", ")", ".", "containsKey", "(", "name", ")", ";", "}" ]
Detects if a Logger with the specified name and MessageFactory type exists. @param name The Logger name to search for. @param messageFactoryClass The message factory class to search for. @return true if the Logger exists, false otherwise. @since 2.5
[ "Detects", "if", "a", "Logger", "with", "the", "specified", "name", "and", "MessageFactory", "type", "exists", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/spi/LoggerRegistry.java#L175-L177
unbescape/unbescape
src/main/java/org/unbescape/html/HtmlEscape.java
HtmlEscape.escapeHtml4Xml
public static void escapeHtml4Xml(final Reader reader, final Writer writer) throws IOException { """ <p> Perform an HTML 4 level 1 (XML-style) <strong>escape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> <em>Level 1</em> means this method will only escape the five markup-significant characters: <tt>&lt;</tt>, <tt>&gt;</tt>, <tt>&amp;</tt>, <tt>&quot;</tt> and <tt>&#39;</tt>. It is called <em>XML-style</em> in order to link it with JSP's <tt>escapeXml</tt> attribute in JSTL's <tt>&lt;c:out ... /&gt;</tt> tags. </p> <p> Note this method may <strong>not</strong> produce the same results as {@link #escapeHtml5Xml(Reader, Writer)} because it will escape the apostrophe as <tt>&amp;#39;</tt>, whereas in HTML5 there is a specific NCR for such character (<tt>&amp;apos;</tt>). </p> <p> This method calls {@link #escapeHtml(Reader, Writer, HtmlEscapeType, HtmlEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>type</tt>: {@link org.unbescape.html.HtmlEscapeType#HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL}</li> <li><tt>level</tt>: {@link org.unbescape.html.HtmlEscapeLevel#LEVEL_1_ONLY_MARKUP_SIGNIFICANT}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2 """ escapeHtml(reader, writer, HtmlEscapeType.HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL, HtmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT); }
java
public static void escapeHtml4Xml(final Reader reader, final Writer writer) throws IOException { escapeHtml(reader, writer, HtmlEscapeType.HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL, HtmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT); }
[ "public", "static", "void", "escapeHtml4Xml", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapeHtml", "(", "reader", ",", "writer", ",", "HtmlEscapeType", ".", "HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL", ",", "HtmlEscapeLevel", ".", "LEVEL_1_ONLY_MARKUP_SIGNIFICANT", ")", ";", "}" ]
<p> Perform an HTML 4 level 1 (XML-style) <strong>escape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> <em>Level 1</em> means this method will only escape the five markup-significant characters: <tt>&lt;</tt>, <tt>&gt;</tt>, <tt>&amp;</tt>, <tt>&quot;</tt> and <tt>&#39;</tt>. It is called <em>XML-style</em> in order to link it with JSP's <tt>escapeXml</tt> attribute in JSTL's <tt>&lt;c:out ... /&gt;</tt> tags. </p> <p> Note this method may <strong>not</strong> produce the same results as {@link #escapeHtml5Xml(Reader, Writer)} because it will escape the apostrophe as <tt>&amp;#39;</tt>, whereas in HTML5 there is a specific NCR for such character (<tt>&amp;apos;</tt>). </p> <p> This method calls {@link #escapeHtml(Reader, Writer, HtmlEscapeType, HtmlEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>type</tt>: {@link org.unbescape.html.HtmlEscapeType#HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL}</li> <li><tt>level</tt>: {@link org.unbescape.html.HtmlEscapeLevel#LEVEL_1_ONLY_MARKUP_SIGNIFICANT}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "an", "HTML", "4", "level", "1", "(", "XML", "-", "style", ")", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "Reader<", "/", "tt", ">", "input", "writing", "results", "to", "a", "<tt", ">", "Writer<", "/", "tt", ">", ".", "<", "/", "p", ">", "<p", ">", "<em", ">", "Level", "1<", "/", "em", ">", "means", "this", "method", "will", "only", "escape", "the", "five", "markup", "-", "significant", "characters", ":", "<tt", ">", "&lt", ";", "<", "/", "tt", ">", "<tt", ">", "&gt", ";", "<", "/", "tt", ">", "<tt", ">", "&amp", ";", "<", "/", "tt", ">", "<tt", ">", "&quot", ";", "<", "/", "tt", ">", "and", "<tt", ">", "&#39", ";", "<", "/", "tt", ">", ".", "It", "is", "called", "<em", ">", "XML", "-", "style<", "/", "em", ">", "in", "order", "to", "link", "it", "with", "JSP", "s", "<tt", ">", "escapeXml<", "/", "tt", ">", "attribute", "in", "JSTL", "s", "<tt", ">", "&lt", ";", "c", ":", "out", "...", "/", "&gt", ";", "<", "/", "tt", ">", "tags", ".", "<", "/", "p", ">", "<p", ">", "Note", "this", "method", "may", "<strong", ">", "not<", "/", "strong", ">", "produce", "the", "same", "results", "as", "{", "@link", "#escapeHtml5Xml", "(", "Reader", "Writer", ")", "}", "because", "it", "will", "escape", "the", "apostrophe", "as", "<tt", ">", "&amp", ";", "#39", ";", "<", "/", "tt", ">", "whereas", "in", "HTML5", "there", "is", "a", "specific", "NCR", "for", "such", "character", "(", "<tt", ">", "&amp", ";", "apos", ";", "<", "/", "tt", ">", ")", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "calls", "{", "@link", "#escapeHtml", "(", "Reader", "Writer", "HtmlEscapeType", "HtmlEscapeLevel", ")", "}", "with", "the", "following", "preconfigured", "values", ":", "<", "/", "p", ">", "<ul", ">", "<li", ">", "<tt", ">", "type<", "/", "tt", ">", ":", "{", "@link", "org", ".", "unbescape", ".", "html", ".", "HtmlEscapeType#HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL", "}", "<", "/", "li", ">", "<li", ">", "<tt", ">", "level<", "/", "tt", ">", ":", "{", "@link", "org", ".", "unbescape", ".", "html", ".", "HtmlEscapeLevel#LEVEL_1_ONLY_MARKUP_SIGNIFICANT", "}", "<", "/", "li", ">", "<", "/", "ul", ">", "<p", ">", "This", "method", "is", "<strong", ">", "thread", "-", "safe<", "/", "strong", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/html/HtmlEscape.java#L771-L775
kiswanij/jk-util
src/main/java/com/jk/util/JKIOUtil.java
JKIOUtil.readPropertiesStream
public static Properties readPropertiesStream(InputStream inputStream) { """ Read properties stream. @param inputStream the input stream @return the properties """ try { final Properties prop = new Properties(); // try to read in utf 8 prop.load(new InputStreamReader(inputStream, Charset.forName("utf-8"))); JKCollectionUtil.fixPropertiesKeys(prop); return prop; } catch (IOException e) { JKExceptionUtil.handle(e); return null; } finally { close(inputStream); } }
java
public static Properties readPropertiesStream(InputStream inputStream) { try { final Properties prop = new Properties(); // try to read in utf 8 prop.load(new InputStreamReader(inputStream, Charset.forName("utf-8"))); JKCollectionUtil.fixPropertiesKeys(prop); return prop; } catch (IOException e) { JKExceptionUtil.handle(e); return null; } finally { close(inputStream); } }
[ "public", "static", "Properties", "readPropertiesStream", "(", "InputStream", "inputStream", ")", "{", "try", "{", "final", "Properties", "prop", "=", "new", "Properties", "(", ")", ";", "// try to read in utf 8\r", "prop", ".", "load", "(", "new", "InputStreamReader", "(", "inputStream", ",", "Charset", ".", "forName", "(", "\"utf-8\"", ")", ")", ")", ";", "JKCollectionUtil", ".", "fixPropertiesKeys", "(", "prop", ")", ";", "return", "prop", ";", "}", "catch", "(", "IOException", "e", ")", "{", "JKExceptionUtil", ".", "handle", "(", "e", ")", ";", "return", "null", ";", "}", "finally", "{", "close", "(", "inputStream", ")", ";", "}", "}" ]
Read properties stream. @param inputStream the input stream @return the properties
[ "Read", "properties", "stream", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKIOUtil.java#L368-L381
ihaolin/wepay
wepay-core/src/main/java/me/hao0/wepay/core/Bills.java
Bills.query
public String query(String deviceInfo, String date, BillType type) { """ 查询账单 @param deviceInfo 微信支付分配的终端设备号,填写此字段,只下载该设备号的对账单 @param date 账单的日期 @param type 账单类型 @see me.hao0.wepay.model.enums.BillType @return 账单数据 """ checkNotNullAndEmpty(date, "date"); checkNotNull(type, "bill type can't be null"); Map<String, String> downloadParams = buildDownloadParams(deviceInfo, date, type); String billData = Http.post(DOWNLOAD).body(Maps.toXml(downloadParams)).request(); if (billData.startsWith("<xml>")){ XmlReaders readers = XmlReaders.create(billData); throw new WepayException( readers.getNodeStr(WepayField.RETURN_CODE), readers.getNodeStr(WepayField.RETURN_MSG)); } return billData; }
java
public String query(String deviceInfo, String date, BillType type){ checkNotNullAndEmpty(date, "date"); checkNotNull(type, "bill type can't be null"); Map<String, String> downloadParams = buildDownloadParams(deviceInfo, date, type); String billData = Http.post(DOWNLOAD).body(Maps.toXml(downloadParams)).request(); if (billData.startsWith("<xml>")){ XmlReaders readers = XmlReaders.create(billData); throw new WepayException( readers.getNodeStr(WepayField.RETURN_CODE), readers.getNodeStr(WepayField.RETURN_MSG)); } return billData; }
[ "public", "String", "query", "(", "String", "deviceInfo", ",", "String", "date", ",", "BillType", "type", ")", "{", "checkNotNullAndEmpty", "(", "date", ",", "\"date\"", ")", ";", "checkNotNull", "(", "type", ",", "\"bill type can't be null\"", ")", ";", "Map", "<", "String", ",", "String", ">", "downloadParams", "=", "buildDownloadParams", "(", "deviceInfo", ",", "date", ",", "type", ")", ";", "String", "billData", "=", "Http", ".", "post", "(", "DOWNLOAD", ")", ".", "body", "(", "Maps", ".", "toXml", "(", "downloadParams", ")", ")", ".", "request", "(", ")", ";", "if", "(", "billData", ".", "startsWith", "(", "\"<xml>\"", ")", ")", "{", "XmlReaders", "readers", "=", "XmlReaders", ".", "create", "(", "billData", ")", ";", "throw", "new", "WepayException", "(", "readers", ".", "getNodeStr", "(", "WepayField", ".", "RETURN_CODE", ")", ",", "readers", ".", "getNodeStr", "(", "WepayField", ".", "RETURN_MSG", ")", ")", ";", "}", "return", "billData", ";", "}" ]
查询账单 @param deviceInfo 微信支付分配的终端设备号,填写此字段,只下载该设备号的对账单 @param date 账单的日期 @param type 账单类型 @see me.hao0.wepay.model.enums.BillType @return 账单数据
[ "查询账单" ]
train
https://github.com/ihaolin/wepay/blob/3360b6a57493d879d5a19def833db36fb455f859/wepay-core/src/main/java/me/hao0/wepay/core/Bills.java#L127-L139
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/util/ReferenceMap.java
ReferenceMap.put
public Object put(Object key, Object value) { """ Associates the given key with the given value.<P> Neither the key nor the value may be null. @param key the key of the mapping @param value the value of the mapping @return the last value associated with that key, or null if no value was associated with the key @throws java.lang.NullPointerException if either the key or value is null """ if (key == null) throw new NullPointerException("null keys not allowed"); if (value == null) throw new NullPointerException("null values not allowed"); purge(); if (size + 1 > threshold) resize(); int hash = hashCode(key); int index = indexFor(hash); Entry entry = table[index]; while (entry != null) { if ((hash == entry.hash) && equals(key, entry.getKey())) { Object result = entry.getValue(); entry.setValue(value); return result; } entry = entry.next; } this.size++; modCount++; key = toReference(keyType, key, hash); value = toReference(valueType, value, hash); table[index] = new Entry(key, hash, value, table[index]); return null; }
java
public Object put(Object key, Object value) { if (key == null) throw new NullPointerException("null keys not allowed"); if (value == null) throw new NullPointerException("null values not allowed"); purge(); if (size + 1 > threshold) resize(); int hash = hashCode(key); int index = indexFor(hash); Entry entry = table[index]; while (entry != null) { if ((hash == entry.hash) && equals(key, entry.getKey())) { Object result = entry.getValue(); entry.setValue(value); return result; } entry = entry.next; } this.size++; modCount++; key = toReference(keyType, key, hash); value = toReference(valueType, value, hash); table[index] = new Entry(key, hash, value, table[index]); return null; }
[ "public", "Object", "put", "(", "Object", "key", ",", "Object", "value", ")", "{", "if", "(", "key", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"null keys not allowed\"", ")", ";", "if", "(", "value", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"null values not allowed\"", ")", ";", "purge", "(", ")", ";", "if", "(", "size", "+", "1", ">", "threshold", ")", "resize", "(", ")", ";", "int", "hash", "=", "hashCode", "(", "key", ")", ";", "int", "index", "=", "indexFor", "(", "hash", ")", ";", "Entry", "entry", "=", "table", "[", "index", "]", ";", "while", "(", "entry", "!=", "null", ")", "{", "if", "(", "(", "hash", "==", "entry", ".", "hash", ")", "&&", "equals", "(", "key", ",", "entry", ".", "getKey", "(", ")", ")", ")", "{", "Object", "result", "=", "entry", ".", "getValue", "(", ")", ";", "entry", ".", "setValue", "(", "value", ")", ";", "return", "result", ";", "}", "entry", "=", "entry", ".", "next", ";", "}", "this", ".", "size", "++", ";", "modCount", "++", ";", "key", "=", "toReference", "(", "keyType", ",", "key", ",", "hash", ")", ";", "value", "=", "toReference", "(", "valueType", ",", "value", ",", "hash", ")", ";", "table", "[", "index", "]", "=", "new", "Entry", "(", "key", ",", "hash", ",", "value", ",", "table", "[", "index", "]", ")", ";", "return", "null", ";", "}" ]
Associates the given key with the given value.<P> Neither the key nor the value may be null. @param key the key of the mapping @param value the value of the mapping @return the last value associated with that key, or null if no value was associated with the key @throws java.lang.NullPointerException if either the key or value is null
[ "Associates", "the", "given", "key", "with", "the", "given", "value", ".", "<P", ">", "Neither", "the", "key", "nor", "the", "value", "may", "be", "null", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/ReferenceMap.java#L541-L568
jamesagnew/hapi-fhir
hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/RestfulServerUtils.java
RestfulServerUtils.determineResponseEncodingNoDefault
public static ResponseEncoding determineResponseEncodingNoDefault(RequestDetails theReq, EncodingEnum thePrefer) { """ Returns null if the request doesn't express that it wants FHIR. If it expresses that it wants XML and JSON equally, returns thePrefer. """ return determineResponseEncodingNoDefault(theReq, thePrefer, null); }
java
public static ResponseEncoding determineResponseEncodingNoDefault(RequestDetails theReq, EncodingEnum thePrefer) { return determineResponseEncodingNoDefault(theReq, thePrefer, null); }
[ "public", "static", "ResponseEncoding", "determineResponseEncodingNoDefault", "(", "RequestDetails", "theReq", ",", "EncodingEnum", "thePrefer", ")", "{", "return", "determineResponseEncodingNoDefault", "(", "theReq", ",", "thePrefer", ",", "null", ")", ";", "}" ]
Returns null if the request doesn't express that it wants FHIR. If it expresses that it wants XML and JSON equally, returns thePrefer.
[ "Returns", "null", "if", "the", "request", "doesn", "t", "express", "that", "it", "wants", "FHIR", ".", "If", "it", "expresses", "that", "it", "wants", "XML", "and", "JSON", "equally", "returns", "thePrefer", "." ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/RestfulServerUtils.java#L365-L367
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/internal/jshell/debug/InternalDebugControl.java
InternalDebugControl.setDebugFlags
public static void setDebugFlags(JShell state, int flags) { """ Sets which debug flags are enabled for a given JShell instance. The flags are or'ed bits as defined in {@code DBG_*}. @param state the JShell instance @param flags the or'ed debug bits """ if (debugMap == null) { debugMap = new HashMap<>(); } debugMap.put(state, flags); }
java
public static void setDebugFlags(JShell state, int flags) { if (debugMap == null) { debugMap = new HashMap<>(); } debugMap.put(state, flags); }
[ "public", "static", "void", "setDebugFlags", "(", "JShell", "state", ",", "int", "flags", ")", "{", "if", "(", "debugMap", "==", "null", ")", "{", "debugMap", "=", "new", "HashMap", "<>", "(", ")", ";", "}", "debugMap", ".", "put", "(", "state", ",", "flags", ")", ";", "}" ]
Sets which debug flags are enabled for a given JShell instance. The flags are or'ed bits as defined in {@code DBG_*}. @param state the JShell instance @param flags the or'ed debug bits
[ "Sets", "which", "debug", "flags", "are", "enabled", "for", "a", "given", "JShell", "instance", ".", "The", "flags", "are", "or", "ed", "bits", "as", "defined", "in", "{", "@code", "DBG_", "*", "}", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/debug/InternalDebugControl.java#L85-L90
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/Controller.java
Controller.mapInVal
void mapInVal(Object val, Object to, String to_in) { """ Directly map a value to a input field. @param val @param to @param to_in """ if (val == null) { throw new ComponentException("Null value for " + name(to, to_in)); } if (to == ca.getComponent()) { throw new ComponentException("field and component ar ethe same for mapping :" + to_in); } ComponentAccess ca_to = lookup(to); Access to_access = ca_to.input(to_in); checkFA(to_access, to, to_in); ca_to.setInput(to_in, new FieldValueAccess(to_access, val)); if (log.isLoggable(Level.CONFIG)) { log.config(String.format("Value(%s) -> @In(%s)", val.toString(), to_access.toString())); } }
java
void mapInVal(Object val, Object to, String to_in) { if (val == null) { throw new ComponentException("Null value for " + name(to, to_in)); } if (to == ca.getComponent()) { throw new ComponentException("field and component ar ethe same for mapping :" + to_in); } ComponentAccess ca_to = lookup(to); Access to_access = ca_to.input(to_in); checkFA(to_access, to, to_in); ca_to.setInput(to_in, new FieldValueAccess(to_access, val)); if (log.isLoggable(Level.CONFIG)) { log.config(String.format("Value(%s) -> @In(%s)", val.toString(), to_access.toString())); } }
[ "void", "mapInVal", "(", "Object", "val", ",", "Object", "to", ",", "String", "to_in", ")", "{", "if", "(", "val", "==", "null", ")", "{", "throw", "new", "ComponentException", "(", "\"Null value for \"", "+", "name", "(", "to", ",", "to_in", ")", ")", ";", "}", "if", "(", "to", "==", "ca", ".", "getComponent", "(", ")", ")", "{", "throw", "new", "ComponentException", "(", "\"field and component ar ethe same for mapping :\"", "+", "to_in", ")", ";", "}", "ComponentAccess", "ca_to", "=", "lookup", "(", "to", ")", ";", "Access", "to_access", "=", "ca_to", ".", "input", "(", "to_in", ")", ";", "checkFA", "(", "to_access", ",", "to", ",", "to_in", ")", ";", "ca_to", ".", "setInput", "(", "to_in", ",", "new", "FieldValueAccess", "(", "to_access", ",", "val", ")", ")", ";", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "CONFIG", ")", ")", "{", "log", ".", "config", "(", "String", ".", "format", "(", "\"Value(%s) -> @In(%s)\"", ",", "val", ".", "toString", "(", ")", ",", "to_access", ".", "toString", "(", ")", ")", ")", ";", "}", "}" ]
Directly map a value to a input field. @param val @param to @param to_in
[ "Directly", "map", "a", "value", "to", "a", "input", "field", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/Controller.java#L142-L156
jurmous/etcd4j
src/main/java/mousio/etcd4j/security/SecurityContextBuilder.java
SecurityContextBuilder.forKeystoreAndTruststore
public static SslContext forKeystoreAndTruststore(InputStream keystore, String keystorePassword, InputStream truststore, String truststorePassword, String keyManagerAlgorithm) throws SecurityContextException { """ Builds SslContext using protected keystore and truststores, overriding default key manger algorithm. Adequate for mutual TLS connections. @param keystore Keystore inputstream (file, binaries, etc) @param keystorePassword Password for protected keystore file @param truststore Truststore inputstream (file, binaries, etc) @param truststorePassword Password for protected truststore file @param keyManagerAlgorithm Algorithm for keyManager used to process keystorefile @return SslContext ready to use @throws SecurityContextException """ try { final KeyStore ks = KeyStore.getInstance(KEYSTORE_JKS); final KeyStore ts = KeyStore.getInstance(KEYSTORE_JKS); final KeyManagerFactory keystoreKmf = KeyManagerFactory.getInstance(keyManagerAlgorithm); final TrustManagerFactory truststoreKmf = TrustManagerFactory.getInstance(keyManagerAlgorithm); ks.load(keystore, keystorePassword.toCharArray()); ts.load(truststore, truststorePassword.toCharArray()); keystoreKmf.init(ks, keystorePassword.toCharArray()); truststoreKmf.init(ts); SslContextBuilder ctxBuilder = SslContextBuilder.forClient().keyManager(keystoreKmf); ctxBuilder.trustManager(truststoreKmf); return ctxBuilder.build(); } catch (Exception e) { throw new SecurityContextException(e); } }
java
public static SslContext forKeystoreAndTruststore(InputStream keystore, String keystorePassword, InputStream truststore, String truststorePassword, String keyManagerAlgorithm) throws SecurityContextException { try { final KeyStore ks = KeyStore.getInstance(KEYSTORE_JKS); final KeyStore ts = KeyStore.getInstance(KEYSTORE_JKS); final KeyManagerFactory keystoreKmf = KeyManagerFactory.getInstance(keyManagerAlgorithm); final TrustManagerFactory truststoreKmf = TrustManagerFactory.getInstance(keyManagerAlgorithm); ks.load(keystore, keystorePassword.toCharArray()); ts.load(truststore, truststorePassword.toCharArray()); keystoreKmf.init(ks, keystorePassword.toCharArray()); truststoreKmf.init(ts); SslContextBuilder ctxBuilder = SslContextBuilder.forClient().keyManager(keystoreKmf); ctxBuilder.trustManager(truststoreKmf); return ctxBuilder.build(); } catch (Exception e) { throw new SecurityContextException(e); } }
[ "public", "static", "SslContext", "forKeystoreAndTruststore", "(", "InputStream", "keystore", ",", "String", "keystorePassword", ",", "InputStream", "truststore", ",", "String", "truststorePassword", ",", "String", "keyManagerAlgorithm", ")", "throws", "SecurityContextException", "{", "try", "{", "final", "KeyStore", "ks", "=", "KeyStore", ".", "getInstance", "(", "KEYSTORE_JKS", ")", ";", "final", "KeyStore", "ts", "=", "KeyStore", ".", "getInstance", "(", "KEYSTORE_JKS", ")", ";", "final", "KeyManagerFactory", "keystoreKmf", "=", "KeyManagerFactory", ".", "getInstance", "(", "keyManagerAlgorithm", ")", ";", "final", "TrustManagerFactory", "truststoreKmf", "=", "TrustManagerFactory", ".", "getInstance", "(", "keyManagerAlgorithm", ")", ";", "ks", ".", "load", "(", "keystore", ",", "keystorePassword", ".", "toCharArray", "(", ")", ")", ";", "ts", ".", "load", "(", "truststore", ",", "truststorePassword", ".", "toCharArray", "(", ")", ")", ";", "keystoreKmf", ".", "init", "(", "ks", ",", "keystorePassword", ".", "toCharArray", "(", ")", ")", ";", "truststoreKmf", ".", "init", "(", "ts", ")", ";", "SslContextBuilder", "ctxBuilder", "=", "SslContextBuilder", ".", "forClient", "(", ")", ".", "keyManager", "(", "keystoreKmf", ")", ";", "ctxBuilder", ".", "trustManager", "(", "truststoreKmf", ")", ";", "return", "ctxBuilder", ".", "build", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "SecurityContextException", "(", "e", ")", ";", "}", "}" ]
Builds SslContext using protected keystore and truststores, overriding default key manger algorithm. Adequate for mutual TLS connections. @param keystore Keystore inputstream (file, binaries, etc) @param keystorePassword Password for protected keystore file @param truststore Truststore inputstream (file, binaries, etc) @param truststorePassword Password for protected truststore file @param keyManagerAlgorithm Algorithm for keyManager used to process keystorefile @return SslContext ready to use @throws SecurityContextException
[ "Builds", "SslContext", "using", "protected", "keystore", "and", "truststores", "overriding", "default", "key", "manger", "algorithm", ".", "Adequate", "for", "mutual", "TLS", "connections", "." ]
train
https://github.com/jurmous/etcd4j/blob/ffb1d574cf85bbab025dd566ce250f1860bbcbc7/src/main/java/mousio/etcd4j/security/SecurityContextBuilder.java#L121-L143