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
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/stat/vpn/vpn_stats.java
vpn_stats.get_nitro_response
protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception { """ <pre> converts nitro response into object and returns the object array in case of get request. </pre> """ vpn_stats[] resources = new vpn_stats[1]; vpn_response result = (vpn_response) service.get_payload_formatter().string_to_resource(vpn_response.class, response); if(result.errorcode != 0) { if (result.errorcode == 444) { service.clear_session(); } if(result.severity != null) { if (result.severity.equals("ERROR")) throw new nitro_exception(result.message,result.errorcode); } else { throw new nitro_exception(result.message,result.errorcode); } } resources[0] = result.vpn; return resources; }
java
protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception { vpn_stats[] resources = new vpn_stats[1]; vpn_response result = (vpn_response) service.get_payload_formatter().string_to_resource(vpn_response.class, response); if(result.errorcode != 0) { if (result.errorcode == 444) { service.clear_session(); } if(result.severity != null) { if (result.severity.equals("ERROR")) throw new nitro_exception(result.message,result.errorcode); } else { throw new nitro_exception(result.message,result.errorcode); } } resources[0] = result.vpn; return resources; }
[ "protected", "base_resource", "[", "]", "get_nitro_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "vpn_stats", "[", "]", "resources", "=", "new", "vpn_stats", "[", "1", "]", ";", "vpn_response", "result", "=", "(", "vpn_response", ")", "service", ".", "get_payload_formatter", "(", ")", ".", "string_to_resource", "(", "vpn_response", ".", "class", ",", "response", ")", ";", "if", "(", "result", ".", "errorcode", "!=", "0", ")", "{", "if", "(", "result", ".", "errorcode", "==", "444", ")", "{", "service", ".", "clear_session", "(", ")", ";", "}", "if", "(", "result", ".", "severity", "!=", "null", ")", "{", "if", "(", "result", ".", "severity", ".", "equals", "(", "\"ERROR\"", ")", ")", "throw", "new", "nitro_exception", "(", "result", ".", "message", ",", "result", ".", "errorcode", ")", ";", "}", "else", "{", "throw", "new", "nitro_exception", "(", "result", ".", "message", ",", "result", ".", "errorcode", ")", ";", "}", "}", "resources", "[", "0", "]", "=", "result", ".", "vpn", ";", "return", "resources", ";", "}" ]
<pre> converts nitro response into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "converts", "nitro", "response", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/vpn/vpn_stats.java#L677-L696
micronaut-projects/micronaut-core
inject-java/src/main/java/io/micronaut/annotation/processing/ModelUtils.java
ModelUtils.isInheritedAndNotPublic
boolean isInheritedAndNotPublic(TypeElement concreteClass, TypeElement declaringClass, Element methodOrField) { """ Return whether the given method or field is inherited but not public. @param concreteClass The concrete class @param declaringClass The declaring class of the field @param methodOrField The method or field @return True if it is inherited and not public """ PackageElement packageOfDeclaringClass = elementUtils.getPackageOf(declaringClass); PackageElement packageOfConcreteClass = elementUtils.getPackageOf(concreteClass); return declaringClass != concreteClass && !packageOfDeclaringClass.getQualifiedName().equals(packageOfConcreteClass.getQualifiedName()) && (isProtected(methodOrField) || !isPublic(methodOrField)); }
java
boolean isInheritedAndNotPublic(TypeElement concreteClass, TypeElement declaringClass, Element methodOrField) { PackageElement packageOfDeclaringClass = elementUtils.getPackageOf(declaringClass); PackageElement packageOfConcreteClass = elementUtils.getPackageOf(concreteClass); return declaringClass != concreteClass && !packageOfDeclaringClass.getQualifiedName().equals(packageOfConcreteClass.getQualifiedName()) && (isProtected(methodOrField) || !isPublic(methodOrField)); }
[ "boolean", "isInheritedAndNotPublic", "(", "TypeElement", "concreteClass", ",", "TypeElement", "declaringClass", ",", "Element", "methodOrField", ")", "{", "PackageElement", "packageOfDeclaringClass", "=", "elementUtils", ".", "getPackageOf", "(", "declaringClass", ")", ";", "PackageElement", "packageOfConcreteClass", "=", "elementUtils", ".", "getPackageOf", "(", "concreteClass", ")", ";", "return", "declaringClass", "!=", "concreteClass", "&&", "!", "packageOfDeclaringClass", ".", "getQualifiedName", "(", ")", ".", "equals", "(", "packageOfConcreteClass", ".", "getQualifiedName", "(", ")", ")", "&&", "(", "isProtected", "(", "methodOrField", ")", "||", "!", "isPublic", "(", "methodOrField", ")", ")", ";", "}" ]
Return whether the given method or field is inherited but not public. @param concreteClass The concrete class @param declaringClass The declaring class of the field @param methodOrField The method or field @return True if it is inherited and not public
[ "Return", "whether", "the", "given", "method", "or", "field", "is", "inherited", "but", "not", "public", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject-java/src/main/java/io/micronaut/annotation/processing/ModelUtils.java#L419-L426
atomix/atomix
utils/src/main/java/io/atomix/utils/serializer/SerializerBuilder.java
SerializerBuilder.addSerializer
public SerializerBuilder addSerializer(com.esotericsoftware.kryo.Serializer serializer, Class<?>... types) { """ Adds a serializer to the builder. @param serializer the serializer to add @param types the serializable types @return the serializer builder """ namespaceBuilder.register(serializer, types); return this; }
java
public SerializerBuilder addSerializer(com.esotericsoftware.kryo.Serializer serializer, Class<?>... types) { namespaceBuilder.register(serializer, types); return this; }
[ "public", "SerializerBuilder", "addSerializer", "(", "com", ".", "esotericsoftware", ".", "kryo", ".", "Serializer", "serializer", ",", "Class", "<", "?", ">", "...", "types", ")", "{", "namespaceBuilder", ".", "register", "(", "serializer", ",", "types", ")", ";", "return", "this", ";", "}" ]
Adds a serializer to the builder. @param serializer the serializer to add @param types the serializable types @return the serializer builder
[ "Adds", "a", "serializer", "to", "the", "builder", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/utils/src/main/java/io/atomix/utils/serializer/SerializerBuilder.java#L117-L120
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.rotate
public static void rotate(Image image, int degree, ImageOutputStream out) throws IORuntimeException { """ 旋转图片为指定角度<br> 此方法不会关闭输出流,输出格式为JPG @param image 目标图像 @param degree 旋转角度 @param out 输出图像流 @since 3.2.2 @throws IORuntimeException IO异常 """ writeJpg(rotate(image, degree), out); }
java
public static void rotate(Image image, int degree, ImageOutputStream out) throws IORuntimeException { writeJpg(rotate(image, degree), out); }
[ "public", "static", "void", "rotate", "(", "Image", "image", ",", "int", "degree", ",", "ImageOutputStream", "out", ")", "throws", "IORuntimeException", "{", "writeJpg", "(", "rotate", "(", "image", ",", "degree", ")", ",", "out", ")", ";", "}" ]
旋转图片为指定角度<br> 此方法不会关闭输出流,输出格式为JPG @param image 目标图像 @param degree 旋转角度 @param out 输出图像流 @since 3.2.2 @throws IORuntimeException IO异常
[ "旋转图片为指定角度<br", ">", "此方法不会关闭输出流,输出格式为JPG" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1044-L1046
spotbugs/spotbugs
eclipsePlugin/src/de/tobject/findbugs/reporter/JdtUtils.java
JdtUtils.getAnonCompilePriority50
private static int getAnonCompilePriority50(IJavaElement javaElement, IJavaElement firstAncestor, IJavaElement topAncestor) { """ 1) from instance init 2) from deepest inner from instance init (deepest first) 3) from static init 4) from deepest inner from static init (deepest first) 5) from deepest inner (deepest first) 6) regular anon classes from main class <br> Note, that nested inner anon. classes which do not have different non-anon. inner class ancestors, are compiled in they nesting order, opposite to rule 2) @param javaElement @return priority - lesser mean wil be compiled later, a value > 0 """ // search for initializer block IJavaElement initBlock = getLastAncestor(javaElement, IJavaElement.INITIALIZER); // test is for anon. classes from initializer blocks if (initBlock != null) { return 10; // from inner from class init } // test for anon. classes from "regular" code return 5; }
java
private static int getAnonCompilePriority50(IJavaElement javaElement, IJavaElement firstAncestor, IJavaElement topAncestor) { // search for initializer block IJavaElement initBlock = getLastAncestor(javaElement, IJavaElement.INITIALIZER); // test is for anon. classes from initializer blocks if (initBlock != null) { return 10; // from inner from class init } // test for anon. classes from "regular" code return 5; }
[ "private", "static", "int", "getAnonCompilePriority50", "(", "IJavaElement", "javaElement", ",", "IJavaElement", "firstAncestor", ",", "IJavaElement", "topAncestor", ")", "{", "// search for initializer block", "IJavaElement", "initBlock", "=", "getLastAncestor", "(", "javaElement", ",", "IJavaElement", ".", "INITIALIZER", ")", ";", "// test is for anon. classes from initializer blocks", "if", "(", "initBlock", "!=", "null", ")", "{", "return", "10", ";", "// from inner from class init", "}", "// test for anon. classes from \"regular\" code", "return", "5", ";", "}" ]
1) from instance init 2) from deepest inner from instance init (deepest first) 3) from static init 4) from deepest inner from static init (deepest first) 5) from deepest inner (deepest first) 6) regular anon classes from main class <br> Note, that nested inner anon. classes which do not have different non-anon. inner class ancestors, are compiled in they nesting order, opposite to rule 2) @param javaElement @return priority - lesser mean wil be compiled later, a value > 0
[ "1", ")", "from", "instance", "init", "2", ")", "from", "deepest", "inner", "from", "instance", "init", "(", "deepest", "first", ")", "3", ")", "from", "static", "init", "4", ")", "from", "deepest", "inner", "from", "static", "init", "(", "deepest", "first", ")", "5", ")", "from", "deepest", "inner", "(", "deepest", "first", ")", "6", ")", "regular", "anon", "classes", "from", "main", "class" ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/reporter/JdtUtils.java#L424-L435
OpenLiberty/open-liberty
dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java
SelfExtractor.determineTargetUserDirectory
public static File determineTargetUserDirectory(File wlpInstallDir) { """ Get the user directory, defaulting to <installDir>/usr if WLP_USER_DIR is not set in server.env. @param extractor @return """ File defaultUserDir = new File(wlpInstallDir, "usr"); File serverEnvFile = new File(wlpInstallDir, "etc/server.env"); if (serverEnvFile.exists()) { //server.env wins, so check it first Properties serverEnvProps = new Properties(); FileInputStream serverEnvStream = null; try { serverEnvStream = new FileInputStream(serverEnvFile); serverEnvProps.load(serverEnvStream); } catch (Exception e) { //Do nothing at the moment, and fall back to default dir. } finally { SelfExtractUtils.tryToClose(serverEnvStream); } String customUserDir = serverEnvProps.getProperty("WLP_USER_DIR"); if (customUserDir != null && !"".equals(customUserDir)) { return new File(customUserDir); } } else { //No server.env, environment variables take next precedence String envVarUserDir = System.getenv("WLP_USER_DIR"); if (envVarUserDir != null && !"".equals(envVarUserDir)) { return new File(envVarUserDir); } } //No server.env setting, or environment variable, so take default return defaultUserDir; }
java
public static File determineTargetUserDirectory(File wlpInstallDir) { File defaultUserDir = new File(wlpInstallDir, "usr"); File serverEnvFile = new File(wlpInstallDir, "etc/server.env"); if (serverEnvFile.exists()) { //server.env wins, so check it first Properties serverEnvProps = new Properties(); FileInputStream serverEnvStream = null; try { serverEnvStream = new FileInputStream(serverEnvFile); serverEnvProps.load(serverEnvStream); } catch (Exception e) { //Do nothing at the moment, and fall back to default dir. } finally { SelfExtractUtils.tryToClose(serverEnvStream); } String customUserDir = serverEnvProps.getProperty("WLP_USER_DIR"); if (customUserDir != null && !"".equals(customUserDir)) { return new File(customUserDir); } } else { //No server.env, environment variables take next precedence String envVarUserDir = System.getenv("WLP_USER_DIR"); if (envVarUserDir != null && !"".equals(envVarUserDir)) { return new File(envVarUserDir); } } //No server.env setting, or environment variable, so take default return defaultUserDir; }
[ "public", "static", "File", "determineTargetUserDirectory", "(", "File", "wlpInstallDir", ")", "{", "File", "defaultUserDir", "=", "new", "File", "(", "wlpInstallDir", ",", "\"usr\"", ")", ";", "File", "serverEnvFile", "=", "new", "File", "(", "wlpInstallDir", ",", "\"etc/server.env\"", ")", ";", "if", "(", "serverEnvFile", ".", "exists", "(", ")", ")", "{", "//server.env wins, so check it first", "Properties", "serverEnvProps", "=", "new", "Properties", "(", ")", ";", "FileInputStream", "serverEnvStream", "=", "null", ";", "try", "{", "serverEnvStream", "=", "new", "FileInputStream", "(", "serverEnvFile", ")", ";", "serverEnvProps", ".", "load", "(", "serverEnvStream", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "//Do nothing at the moment, and fall back to default dir.", "}", "finally", "{", "SelfExtractUtils", ".", "tryToClose", "(", "serverEnvStream", ")", ";", "}", "String", "customUserDir", "=", "serverEnvProps", ".", "getProperty", "(", "\"WLP_USER_DIR\"", ")", ";", "if", "(", "customUserDir", "!=", "null", "&&", "!", "\"\"", ".", "equals", "(", "customUserDir", ")", ")", "{", "return", "new", "File", "(", "customUserDir", ")", ";", "}", "}", "else", "{", "//No server.env, environment variables take next precedence", "String", "envVarUserDir", "=", "System", ".", "getenv", "(", "\"WLP_USER_DIR\"", ")", ";", "if", "(", "envVarUserDir", "!=", "null", "&&", "!", "\"\"", ".", "equals", "(", "envVarUserDir", ")", ")", "{", "return", "new", "File", "(", "envVarUserDir", ")", ";", "}", "}", "//No server.env setting, or environment variable, so take default", "return", "defaultUserDir", ";", "}" ]
Get the user directory, defaulting to <installDir>/usr if WLP_USER_DIR is not set in server.env. @param extractor @return
[ "Get", "the", "user", "directory", "defaulting", "to", "<installDir", ">", "/", "usr", "if", "WLP_USER_DIR", "is", "not", "set", "in", "server", ".", "env", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java#L1041-L1069
apache/predictionio-sdk-java
client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java
EventClient.setItemAsFuture
public FutureAPIResponse setItemAsFuture(String iid, Map<String, Object> properties) throws IOException { """ Sends a set item properties request. Same as {@link #setItemAsFuture(String, Map, DateTime) setItemAsFuture(String, Map&lt;String, Object&gt;, DateTime)} except event time is not specified and recorded as the time when the function is called. """ return setItemAsFuture(iid, properties, new DateTime()); }
java
public FutureAPIResponse setItemAsFuture(String iid, Map<String, Object> properties) throws IOException { return setItemAsFuture(iid, properties, new DateTime()); }
[ "public", "FutureAPIResponse", "setItemAsFuture", "(", "String", "iid", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "throws", "IOException", "{", "return", "setItemAsFuture", "(", "iid", ",", "properties", ",", "new", "DateTime", "(", ")", ")", ";", "}" ]
Sends a set item properties request. Same as {@link #setItemAsFuture(String, Map, DateTime) setItemAsFuture(String, Map&lt;String, Object&gt;, DateTime)} except event time is not specified and recorded as the time when the function is called.
[ "Sends", "a", "set", "item", "properties", "request", ".", "Same", "as", "{" ]
train
https://github.com/apache/predictionio-sdk-java/blob/16052c96b136340c175c3f9c2692e720850df219/client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java#L469-L472
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IteratorExtensions.java
IteratorExtensions.minBy
public static <T, C extends Comparable<? super C>> T minBy(final Iterator<T> iterator, final Function1<? super T, C> compareBy) { """ Finds the element that yields the minimum value when passed to <code>compareBy</code>. If there are several maxima, the first one will be returned. @param iterator the elements to find the minimum of. May not be <code>null</code>. @param compareBy a function that returns a comparable characteristic to compare the elements by. May not be <code>null</code>. @return the minimum @throws NoSuchElementException if the iterator is empty @since 2.7 """ if (compareBy == null) throw new NullPointerException("compareBy"); return min(iterator, new KeyComparator<T, C>(compareBy)); }
java
public static <T, C extends Comparable<? super C>> T minBy(final Iterator<T> iterator, final Function1<? super T, C> compareBy) { if (compareBy == null) throw new NullPointerException("compareBy"); return min(iterator, new KeyComparator<T, C>(compareBy)); }
[ "public", "static", "<", "T", ",", "C", "extends", "Comparable", "<", "?", "super", "C", ">", ">", "T", "minBy", "(", "final", "Iterator", "<", "T", ">", "iterator", ",", "final", "Function1", "<", "?", "super", "T", ",", "C", ">", "compareBy", ")", "{", "if", "(", "compareBy", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"compareBy\"", ")", ";", "return", "min", "(", "iterator", ",", "new", "KeyComparator", "<", "T", ",", "C", ">", "(", "compareBy", ")", ")", ";", "}" ]
Finds the element that yields the minimum value when passed to <code>compareBy</code>. If there are several maxima, the first one will be returned. @param iterator the elements to find the minimum of. May not be <code>null</code>. @param compareBy a function that returns a comparable characteristic to compare the elements by. May not be <code>null</code>. @return the minimum @throws NoSuchElementException if the iterator is empty @since 2.7
[ "Finds", "the", "element", "that", "yields", "the", "minimum", "value", "when", "passed", "to", "<code", ">", "compareBy<", "/", "code", ">", ".", "If", "there", "are", "several", "maxima", "the", "first", "one", "will", "be", "returned", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IteratorExtensions.java#L959-L963
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.dedicatedCloud_serviceName_vdi_POST
public OvhOrder dedicatedCloud_serviceName_vdi_POST(String serviceName, Long datacenterId, String firstPublicIpAddress, String secondPublicIpAddress) throws IOException { """ Create order REST: POST /order/dedicatedCloud/{serviceName}/vdi @param secondPublicIpAddress [required] Another avaiable ip from one of your Private Cloud public IP blocks @param firstPublicIpAddress [required] An avaiable ip from one of your Private Cloud public IP blocks @param datacenterId [required] Datacenter where the VDI option will be enabled @param serviceName [required] API beta """ String qPath = "/order/dedicatedCloud/{serviceName}/vdi"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "datacenterId", datacenterId); addBody(o, "firstPublicIpAddress", firstPublicIpAddress); addBody(o, "secondPublicIpAddress", secondPublicIpAddress); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder dedicatedCloud_serviceName_vdi_POST(String serviceName, Long datacenterId, String firstPublicIpAddress, String secondPublicIpAddress) throws IOException { String qPath = "/order/dedicatedCloud/{serviceName}/vdi"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "datacenterId", datacenterId); addBody(o, "firstPublicIpAddress", firstPublicIpAddress); addBody(o, "secondPublicIpAddress", secondPublicIpAddress); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "dedicatedCloud_serviceName_vdi_POST", "(", "String", "serviceName", ",", "Long", "datacenterId", ",", "String", "firstPublicIpAddress", ",", "String", "secondPublicIpAddress", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/dedicatedCloud/{serviceName}/vdi\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"datacenterId\"", ",", "datacenterId", ")", ";", "addBody", "(", "o", ",", "\"firstPublicIpAddress\"", ",", "firstPublicIpAddress", ")", ";", "addBody", "(", "o", ",", "\"secondPublicIpAddress\"", ",", "secondPublicIpAddress", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOrder", ".", "class", ")", ";", "}" ]
Create order REST: POST /order/dedicatedCloud/{serviceName}/vdi @param secondPublicIpAddress [required] Another avaiable ip from one of your Private Cloud public IP blocks @param firstPublicIpAddress [required] An avaiable ip from one of your Private Cloud public IP blocks @param datacenterId [required] Datacenter where the VDI option will be enabled @param serviceName [required] API beta
[ "Create", "order" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L5896-L5905
Red5/red5-server-common
src/main/java/org/red5/server/so/SharedObject.java
SharedObject.removeAttribute
@Override public boolean removeAttribute(String name) { """ Removes attribute with given name @param name Attribute @return true if there's such an attribute and it was removed, false otherwise """ boolean result = true; // Send confirmation to client final SharedObjectEvent event = new SharedObjectEvent(Type.CLIENT_DELETE_DATA, name, null); if (ownerMessage.addEvent(event)) { if (super.removeAttribute(name)) { modified.set(true); syncEvents.add(event); deleteStats.incrementAndGet(); } else { result = false; } notifyModified(); } return result; }
java
@Override public boolean removeAttribute(String name) { boolean result = true; // Send confirmation to client final SharedObjectEvent event = new SharedObjectEvent(Type.CLIENT_DELETE_DATA, name, null); if (ownerMessage.addEvent(event)) { if (super.removeAttribute(name)) { modified.set(true); syncEvents.add(event); deleteStats.incrementAndGet(); } else { result = false; } notifyModified(); } return result; }
[ "@", "Override", "public", "boolean", "removeAttribute", "(", "String", "name", ")", "{", "boolean", "result", "=", "true", ";", "// Send confirmation to client\r", "final", "SharedObjectEvent", "event", "=", "new", "SharedObjectEvent", "(", "Type", ".", "CLIENT_DELETE_DATA", ",", "name", ",", "null", ")", ";", "if", "(", "ownerMessage", ".", "addEvent", "(", "event", ")", ")", "{", "if", "(", "super", ".", "removeAttribute", "(", "name", ")", ")", "{", "modified", ".", "set", "(", "true", ")", ";", "syncEvents", ".", "add", "(", "event", ")", ";", "deleteStats", ".", "incrementAndGet", "(", ")", ";", "}", "else", "{", "result", "=", "false", ";", "}", "notifyModified", "(", ")", ";", "}", "return", "result", ";", "}" ]
Removes attribute with given name @param name Attribute @return true if there's such an attribute and it was removed, false otherwise
[ "Removes", "attribute", "with", "given", "name" ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/so/SharedObject.java#L490-L506
gturri/aXMLRPC
src/main/java/de/timroes/axmlrpc/ResponseParser.java
ResponseParser.getReturnValueFromElement
private Object getReturnValueFromElement(SerializerHandler serializerHandler, Element element) throws XMLRPCException { """ This method takes an element (must be a param or fault element) and returns the deserialized object of this param tag. @param element An param element. @return The deserialized object within the given param element. @throws XMLRPCException Will be thrown when the structure of the document doesn't match the XML-RPC specification. """ Element childElement = XMLUtil.getOnlyChildElement(element.getChildNodes()); return serializerHandler.deserialize(childElement); }
java
private Object getReturnValueFromElement(SerializerHandler serializerHandler, Element element) throws XMLRPCException { Element childElement = XMLUtil.getOnlyChildElement(element.getChildNodes()); return serializerHandler.deserialize(childElement); }
[ "private", "Object", "getReturnValueFromElement", "(", "SerializerHandler", "serializerHandler", ",", "Element", "element", ")", "throws", "XMLRPCException", "{", "Element", "childElement", "=", "XMLUtil", ".", "getOnlyChildElement", "(", "element", ".", "getChildNodes", "(", ")", ")", ";", "return", "serializerHandler", ".", "deserialize", "(", "childElement", ")", ";", "}" ]
This method takes an element (must be a param or fault element) and returns the deserialized object of this param tag. @param element An param element. @return The deserialized object within the given param element. @throws XMLRPCException Will be thrown when the structure of the document doesn't match the XML-RPC specification.
[ "This", "method", "takes", "an", "element", "(", "must", "be", "a", "param", "or", "fault", "element", ")", "and", "returns", "the", "deserialized", "object", "of", "this", "param", "tag", "." ]
train
https://github.com/gturri/aXMLRPC/blob/8ca6f95f7eb3a28efaef3569d53adddeb32b6bda/src/main/java/de/timroes/axmlrpc/ResponseParser.java#L114-L119
mgm-tp/jfunk
jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java
WebDriverTool.sendKeys
public void sendKeys(final By by, final CharSequence... keysToSend) { """ Delegates to {@link #findElement(By)} and calls {@link WebElement#sendKeys(CharSequence...) sendKeys(CharSequence...)} on the returned element. @param by the {@link By} used to locate the element @param keysToSend the keys to send """ checkTopmostElement(by); findElement(by).sendKeys(keysToSend); }
java
public void sendKeys(final By by, final CharSequence... keysToSend) { checkTopmostElement(by); findElement(by).sendKeys(keysToSend); }
[ "public", "void", "sendKeys", "(", "final", "By", "by", ",", "final", "CharSequence", "...", "keysToSend", ")", "{", "checkTopmostElement", "(", "by", ")", ";", "findElement", "(", "by", ")", ".", "sendKeys", "(", "keysToSend", ")", ";", "}" ]
Delegates to {@link #findElement(By)} and calls {@link WebElement#sendKeys(CharSequence...) sendKeys(CharSequence...)} on the returned element. @param by the {@link By} used to locate the element @param keysToSend the keys to send
[ "Delegates", "to", "{", "@link", "#findElement", "(", "By", ")", "}", "and", "calls", "{", "@link", "WebElement#sendKeys", "(", "CharSequence", "...", ")", "sendKeys", "(", "CharSequence", "...", ")", "}", "on", "the", "returned", "element", "." ]
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java#L407-L410
code4everything/util
src/main/java/com/zhazhapan/util/Checker.java
Checker.replace
public static String replace(String string, char oldChar, char newChar) { """ 替换字符之前检查字符串是否为空 @param string 需要检测的字符串 @param oldChar 需要替换的字符 @param newChar 新的字符 @return {@link String} """ return checkNull(string).replace(oldChar, newChar); }
java
public static String replace(String string, char oldChar, char newChar) { return checkNull(string).replace(oldChar, newChar); }
[ "public", "static", "String", "replace", "(", "String", "string", ",", "char", "oldChar", ",", "char", "newChar", ")", "{", "return", "checkNull", "(", "string", ")", ".", "replace", "(", "oldChar", ",", "newChar", ")", ";", "}" ]
替换字符之前检查字符串是否为空 @param string 需要检测的字符串 @param oldChar 需要替换的字符 @param newChar 新的字符 @return {@link String}
[ "替换字符之前检查字符串是否为空" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/Checker.java#L821-L823
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java
EndianNumbers.toLEDouble
@Pure @Inline(value = "Double.longBitsToDouble(EndianNumbers.toLELong($1, $2, $3, $4, $5, $6, $7, $8))", imported = { """ Converting eight bytes to a Little Endian double. @param b1 the first byte. @param b2 the second byte. @param b3 the third byte. @param b4 the fourth byte. @param b5 the fifth byte. @param b6 the sixth byte. @param b7 the seventh byte. @param b8 the eighth byte. @return the conversion result """EndianNumbers.class}) public static double toLEDouble(int b1, int b2, int b3, int b4, int b5, int b6, int b7, int b8) { return Double.longBitsToDouble(toLELong(b1, b2, b3, b4, b5, b6, b7, b8)); }
java
@Pure @Inline(value = "Double.longBitsToDouble(EndianNumbers.toLELong($1, $2, $3, $4, $5, $6, $7, $8))", imported = {EndianNumbers.class}) public static double toLEDouble(int b1, int b2, int b3, int b4, int b5, int b6, int b7, int b8) { return Double.longBitsToDouble(toLELong(b1, b2, b3, b4, b5, b6, b7, b8)); }
[ "@", "Pure", "@", "Inline", "(", "value", "=", "\"Double.longBitsToDouble(EndianNumbers.toLELong($1, $2, $3, $4, $5, $6, $7, $8))\"", ",", "imported", "=", "{", "EndianNumbers", ".", "class", "}", ")", "public", "static", "double", "toLEDouble", "(", "int", "b1", ",", "int", "b2", ",", "int", "b3", ",", "int", "b4", ",", "int", "b5", ",", "int", "b6", ",", "int", "b7", ",", "int", "b8", ")", "{", "return", "Double", ".", "longBitsToDouble", "(", "toLELong", "(", "b1", ",", "b2", ",", "b3", ",", "b4", ",", "b5", ",", "b6", ",", "b7", ",", "b8", ")", ")", ";", "}" ]
Converting eight bytes to a Little Endian double. @param b1 the first byte. @param b2 the second byte. @param b3 the third byte. @param b4 the fourth byte. @param b5 the fifth byte. @param b6 the sixth byte. @param b7 the seventh byte. @param b8 the eighth byte. @return the conversion result
[ "Converting", "eight", "bytes", "to", "a", "Little", "Endian", "double", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java#L145-L150
looly/hutool
hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java
SqlConnRunner.insertForGeneratedKey
public Long insertForGeneratedKey(Connection conn, Entity record) throws SQLException { """ 插入数据<br> 此方法不会关闭Connection @param conn 数据库连接 @param record 记录 @return 自增主键 @throws SQLException SQL执行异常 """ checkConn(conn); if(CollectionUtil.isEmpty(record)){ throw new SQLException("Empty entity provided!"); } PreparedStatement ps = null; try { ps = dialect.psForInsert(conn, record); ps.executeUpdate(); return StatementUtil.getGeneratedKeyOfLong(ps); } catch (SQLException e) { throw e; } finally { DbUtil.close(ps); } }
java
public Long insertForGeneratedKey(Connection conn, Entity record) throws SQLException { checkConn(conn); if(CollectionUtil.isEmpty(record)){ throw new SQLException("Empty entity provided!"); } PreparedStatement ps = null; try { ps = dialect.psForInsert(conn, record); ps.executeUpdate(); return StatementUtil.getGeneratedKeyOfLong(ps); } catch (SQLException e) { throw e; } finally { DbUtil.close(ps); } }
[ "public", "Long", "insertForGeneratedKey", "(", "Connection", "conn", ",", "Entity", "record", ")", "throws", "SQLException", "{", "checkConn", "(", "conn", ")", ";", "if", "(", "CollectionUtil", ".", "isEmpty", "(", "record", ")", ")", "{", "throw", "new", "SQLException", "(", "\"Empty entity provided!\"", ")", ";", "}", "PreparedStatement", "ps", "=", "null", ";", "try", "{", "ps", "=", "dialect", ".", "psForInsert", "(", "conn", ",", "record", ")", ";", "ps", ".", "executeUpdate", "(", ")", ";", "return", "StatementUtil", ".", "getGeneratedKeyOfLong", "(", "ps", ")", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "throw", "e", ";", "}", "finally", "{", "DbUtil", ".", "close", "(", "ps", ")", ";", "}", "}" ]
插入数据<br> 此方法不会关闭Connection @param conn 数据库连接 @param record 记录 @return 自增主键 @throws SQLException SQL执行异常
[ "插入数据<br", ">", "此方法不会关闭Connection" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java#L209-L225
alipay/sofa-rpc
extension-impl/remoting-bolt/src/main/java/com/alipay/sofa/rpc/server/bolt/BoltServerProcessor.java
BoltServerProcessor.clientTimeoutWhenSendResponse
private SofaRpcException clientTimeoutWhenSendResponse(String appName, String serviceName, String remoteAddress) { """ 客户端已经超时了(例如在业务执行时间太长),丢弃这个返回值 @param appName 应用 @param serviceName 服务 @param remoteAddress 远程地址 @return 丢弃的异常 """ String errorMsg = LogCodes.getLog( LogCodes.ERROR_DISCARD_TIMEOUT_RESPONSE, serviceName, remoteAddress); if (LOGGER.isWarnEnabled(appName)) { LOGGER.warnWithApp(appName, errorMsg); } return new SofaRpcException(RpcErrorType.SERVER_UNDECLARED_ERROR, errorMsg); }
java
private SofaRpcException clientTimeoutWhenSendResponse(String appName, String serviceName, String remoteAddress) { String errorMsg = LogCodes.getLog( LogCodes.ERROR_DISCARD_TIMEOUT_RESPONSE, serviceName, remoteAddress); if (LOGGER.isWarnEnabled(appName)) { LOGGER.warnWithApp(appName, errorMsg); } return new SofaRpcException(RpcErrorType.SERVER_UNDECLARED_ERROR, errorMsg); }
[ "private", "SofaRpcException", "clientTimeoutWhenSendResponse", "(", "String", "appName", ",", "String", "serviceName", ",", "String", "remoteAddress", ")", "{", "String", "errorMsg", "=", "LogCodes", ".", "getLog", "(", "LogCodes", ".", "ERROR_DISCARD_TIMEOUT_RESPONSE", ",", "serviceName", ",", "remoteAddress", ")", ";", "if", "(", "LOGGER", ".", "isWarnEnabled", "(", "appName", ")", ")", "{", "LOGGER", ".", "warnWithApp", "(", "appName", ",", "errorMsg", ")", ";", "}", "return", "new", "SofaRpcException", "(", "RpcErrorType", ".", "SERVER_UNDECLARED_ERROR", ",", "errorMsg", ")", ";", "}" ]
客户端已经超时了(例如在业务执行时间太长),丢弃这个返回值 @param appName 应用 @param serviceName 服务 @param remoteAddress 远程地址 @return 丢弃的异常
[ "客户端已经超时了(例如在业务执行时间太长),丢弃这个返回值" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/remoting-bolt/src/main/java/com/alipay/sofa/rpc/server/bolt/BoltServerProcessor.java#L294-L301
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/util/Utils.java
Utils.createSocket
public static Socket createSocket(UrlParser urlParser, String host) throws IOException { """ Create socket accordingly to options. @param urlParser urlParser @param host hostName ( mandatory only for named pipe) @return a nex socket @throws IOException if connection error occur """ return socketHandler.apply(urlParser, host); }
java
public static Socket createSocket(UrlParser urlParser, String host) throws IOException { return socketHandler.apply(urlParser, host); }
[ "public", "static", "Socket", "createSocket", "(", "UrlParser", "urlParser", ",", "String", "host", ")", "throws", "IOException", "{", "return", "socketHandler", ".", "apply", "(", "urlParser", ",", "host", ")", ";", "}" ]
Create socket accordingly to options. @param urlParser urlParser @param host hostName ( mandatory only for named pipe) @return a nex socket @throws IOException if connection error occur
[ "Create", "socket", "accordingly", "to", "options", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/util/Utils.java#L602-L604
GoogleCloudPlatform/appengine-mapreduce
java/src/main/java/com/google/appengine/tools/mapreduce/impl/sort/SortWorker.java
SortWorker.addPointer
final void addPointer(int keyPos, int keySize, int valuePos, int valueSize) { """ Add a pointer to the key value pair with the provided parameters. """ assert keyPos + keySize == valuePos; int start = memoryBuffer.limit() - POINTER_SIZE_BYTES; memoryBuffer.putInt(start, keyPos); memoryBuffer.putInt(start + 4, valuePos); memoryBuffer.putInt(start + 8, valueSize); memoryBuffer.limit(start); valuesHeld++; }
java
final void addPointer(int keyPos, int keySize, int valuePos, int valueSize) { assert keyPos + keySize == valuePos; int start = memoryBuffer.limit() - POINTER_SIZE_BYTES; memoryBuffer.putInt(start, keyPos); memoryBuffer.putInt(start + 4, valuePos); memoryBuffer.putInt(start + 8, valueSize); memoryBuffer.limit(start); valuesHeld++; }
[ "final", "void", "addPointer", "(", "int", "keyPos", ",", "int", "keySize", ",", "int", "valuePos", ",", "int", "valueSize", ")", "{", "assert", "keyPos", "+", "keySize", "==", "valuePos", ";", "int", "start", "=", "memoryBuffer", ".", "limit", "(", ")", "-", "POINTER_SIZE_BYTES", ";", "memoryBuffer", ".", "putInt", "(", "start", ",", "keyPos", ")", ";", "memoryBuffer", ".", "putInt", "(", "start", "+", "4", ",", "valuePos", ")", ";", "memoryBuffer", ".", "putInt", "(", "start", "+", "8", ",", "valueSize", ")", ";", "memoryBuffer", ".", "limit", "(", "start", ")", ";", "valuesHeld", "++", ";", "}" ]
Add a pointer to the key value pair with the provided parameters.
[ "Add", "a", "pointer", "to", "the", "key", "value", "pair", "with", "the", "provided", "parameters", "." ]
train
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/java/src/main/java/com/google/appengine/tools/mapreduce/impl/sort/SortWorker.java#L348-L356
apptik/JustJson
json-core/src/main/java/io/apptik/json/JsonObject.java
JsonObject.put
public JsonObject put(String name, double value) throws JsonException { """ Maps {@code name} to {@code value}, clobbering any existing name/value mapping with the same name. @param value a finite value. May not be {@link Double#isNaN() NaNs} or {@link Double#isInfinite() infinities}. @return this object. """ return put(name, new JsonNumber(value)); }
java
public JsonObject put(String name, double value) throws JsonException { return put(name, new JsonNumber(value)); }
[ "public", "JsonObject", "put", "(", "String", "name", ",", "double", "value", ")", "throws", "JsonException", "{", "return", "put", "(", "name", ",", "new", "JsonNumber", "(", "value", ")", ")", ";", "}" ]
Maps {@code name} to {@code value}, clobbering any existing name/value mapping with the same name. @param value a finite value. May not be {@link Double#isNaN() NaNs} or {@link Double#isInfinite() infinities}. @return this object.
[ "Maps", "{", "@code", "name", "}", "to", "{", "@code", "value", "}", "clobbering", "any", "existing", "name", "/", "value", "mapping", "with", "the", "same", "name", "." ]
train
https://github.com/apptik/JustJson/blob/c90f0dd7f84df26da4749be8cd9b026fff499a79/json-core/src/main/java/io/apptik/json/JsonObject.java#L155-L157
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/transformer/AbstractObservableTransformerSource.java
AbstractObservableTransformerSource.onSourceErrorOccurred
protected void onSourceErrorOccurred(boolean isTerminating, Exception exception) { """ Called when an exception occurred. Fires the ErrorOccured event. @param isTerminating Indicates whether this TransformerSource can still provide further values (false) or will terminate completely (true). @param exception The exception that was thrown by the Transformation. """ for (TransformerSourceEventListener listener : transformerSourceEventListeners) { fireErrorEvent(listener, new TransformerSourceErrorEvent(this, exception, isTerminating)); } }
java
protected void onSourceErrorOccurred(boolean isTerminating, Exception exception) { for (TransformerSourceEventListener listener : transformerSourceEventListeners) { fireErrorEvent(listener, new TransformerSourceErrorEvent(this, exception, isTerminating)); } }
[ "protected", "void", "onSourceErrorOccurred", "(", "boolean", "isTerminating", ",", "Exception", "exception", ")", "{", "for", "(", "TransformerSourceEventListener", "listener", ":", "transformerSourceEventListeners", ")", "{", "fireErrorEvent", "(", "listener", ",", "new", "TransformerSourceErrorEvent", "(", "this", ",", "exception", ",", "isTerminating", ")", ")", ";", "}", "}" ]
Called when an exception occurred. Fires the ErrorOccured event. @param isTerminating Indicates whether this TransformerSource can still provide further values (false) or will terminate completely (true). @param exception The exception that was thrown by the Transformation.
[ "Called", "when", "an", "exception", "occurred", ".", "Fires", "the", "ErrorOccured", "event", "." ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/transformer/AbstractObservableTransformerSource.java#L67-L73
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java
HttpOutboundServiceContextImpl.callErrorCallback
void callErrorCallback(VirtualConnection inVC, IOException ioe) { """ Call the error callback of the app above. @param inVC @param ioe """ // otherwise pass the error along to the channel above us, or close // the connection if nobody is above setPersistent(false); if (this.bEarlyReads && null != getAppReadCallback()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Early read failure calling error() on appside"); } getAppReadCallback().error(inVC, ioe); } else if (null != getAppWriteCallback()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Calling write.error() on appside"); } getAppWriteCallback().error(inVC, ioe); } else { // nobody above us, just close the connection if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "No appside, closing connection"); } getLink().getDeviceLink().close(inVC, ioe); } }
java
void callErrorCallback(VirtualConnection inVC, IOException ioe) { // otherwise pass the error along to the channel above us, or close // the connection if nobody is above setPersistent(false); if (this.bEarlyReads && null != getAppReadCallback()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Early read failure calling error() on appside"); } getAppReadCallback().error(inVC, ioe); } else if (null != getAppWriteCallback()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Calling write.error() on appside"); } getAppWriteCallback().error(inVC, ioe); } else { // nobody above us, just close the connection if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "No appside, closing connection"); } getLink().getDeviceLink().close(inVC, ioe); } }
[ "void", "callErrorCallback", "(", "VirtualConnection", "inVC", ",", "IOException", "ioe", ")", "{", "// otherwise pass the error along to the channel above us, or close", "// the connection if nobody is above", "setPersistent", "(", "false", ")", ";", "if", "(", "this", ".", "bEarlyReads", "&&", "null", "!=", "getAppReadCallback", "(", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Early read failure calling error() on appside\"", ")", ";", "}", "getAppReadCallback", "(", ")", ".", "error", "(", "inVC", ",", "ioe", ")", ";", "}", "else", "if", "(", "null", "!=", "getAppWriteCallback", "(", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Calling write.error() on appside\"", ")", ";", "}", "getAppWriteCallback", "(", ")", ".", "error", "(", "inVC", ",", "ioe", ")", ";", "}", "else", "{", "// nobody above us, just close the connection", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"No appside, closing connection\"", ")", ";", "}", "getLink", "(", ")", ".", "getDeviceLink", "(", ")", ".", "close", "(", "inVC", ",", "ioe", ")", ";", "}", "}" ]
Call the error callback of the app above. @param inVC @param ioe
[ "Call", "the", "error", "callback", "of", "the", "app", "above", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java#L234-L255
ops4j/org.ops4j.pax.wicket
service/src/main/java/org/ops4j/pax/wicket/api/support/DefaultPageMounter.java
DefaultPageMounter.register
public void register() { """ Automatically regsiteres the {@link org.ops4j.pax.wicket.api.PageMounter} as OSGi service """ LOGGER.debug("Register mount tracker as OSGi service"); synchronized (this) { if (serviceRegistration != null) { throw new IllegalStateException(String.format("%s [%s] had been already registered.", getClass() .getSimpleName(), this)); } serviceRegistration = bundleContext.registerService(SERVICE_CLASSES, this, properties); } }
java
public void register() { LOGGER.debug("Register mount tracker as OSGi service"); synchronized (this) { if (serviceRegistration != null) { throw new IllegalStateException(String.format("%s [%s] had been already registered.", getClass() .getSimpleName(), this)); } serviceRegistration = bundleContext.registerService(SERVICE_CLASSES, this, properties); } }
[ "public", "void", "register", "(", ")", "{", "LOGGER", ".", "debug", "(", "\"Register mount tracker as OSGi service\"", ")", ";", "synchronized", "(", "this", ")", "{", "if", "(", "serviceRegistration", "!=", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "String", ".", "format", "(", "\"%s [%s] had been already registered.\"", ",", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ",", "this", ")", ")", ";", "}", "serviceRegistration", "=", "bundleContext", ".", "registerService", "(", "SERVICE_CLASSES", ",", "this", ",", "properties", ")", ";", "}", "}" ]
Automatically regsiteres the {@link org.ops4j.pax.wicket.api.PageMounter} as OSGi service
[ "Automatically", "regsiteres", "the", "{" ]
train
https://github.com/ops4j/org.ops4j.pax.wicket/blob/ef7cb4bdf918e9e61ec69789b9c690567616faa9/service/src/main/java/org/ops4j/pax/wicket/api/support/DefaultPageMounter.java#L72-L82
jhalterman/failsafe
src/main/java/net/jodah/failsafe/CircuitBreaker.java
CircuitBreaker.withSuccessThreshold
public CircuitBreaker<R> withSuccessThreshold(int successThreshold) { """ Sets the number of successive successful executions that must occur when in a half-open state in order to close the circuit, else the circuit is re-opened when a failure occurs. @throws IllegalArgumentException if {@code successThreshold} < 1 """ Assert.isTrue(successThreshold >= 1, "successThreshold must be greater than or equal to 1"); return withSuccessThreshold(successThreshold, successThreshold); }
java
public CircuitBreaker<R> withSuccessThreshold(int successThreshold) { Assert.isTrue(successThreshold >= 1, "successThreshold must be greater than or equal to 1"); return withSuccessThreshold(successThreshold, successThreshold); }
[ "public", "CircuitBreaker", "<", "R", ">", "withSuccessThreshold", "(", "int", "successThreshold", ")", "{", "Assert", ".", "isTrue", "(", "successThreshold", ">=", "1", ",", "\"successThreshold must be greater than or equal to 1\"", ")", ";", "return", "withSuccessThreshold", "(", "successThreshold", ",", "successThreshold", ")", ";", "}" ]
Sets the number of successive successful executions that must occur when in a half-open state in order to close the circuit, else the circuit is re-opened when a failure occurs. @throws IllegalArgumentException if {@code successThreshold} < 1
[ "Sets", "the", "number", "of", "successive", "successful", "executions", "that", "must", "occur", "when", "in", "a", "half", "-", "open", "state", "in", "order", "to", "close", "the", "circuit", "else", "the", "circuit", "is", "re", "-", "opened", "when", "a", "failure", "occurs", "." ]
train
https://github.com/jhalterman/failsafe/blob/65fcd3a82f7b232d2ff59bc525a59d693dd8e223/src/main/java/net/jodah/failsafe/CircuitBreaker.java#L328-L331
Netflix/zuul
zuul-core/src/main/java/com/netflix/zuul/netty/filter/BaseZuulFilterRunner.java
BaseZuulFilterRunner.shouldSkipFilter
protected final boolean shouldSkipFilter(final I inMesg, final ZuulFilter<I, O> filter) { """ /* This is typically set by a filter when wanting to reject a request and also reduce load on the server by not processing any more filterChain """ if (filter.filterType() == ENDPOINT) { //Endpoints may not be skipped return false; } final SessionContext zuulCtx = inMesg.getContext(); if ((zuulCtx.shouldStopFilterProcessing()) && (!filter.overrideStopFilterProcessing())) { return true; } if (zuulCtx.isCancelled()) { return true; } if (!filter.shouldFilter(inMesg)) { return true; } return false; }
java
protected final boolean shouldSkipFilter(final I inMesg, final ZuulFilter<I, O> filter) { if (filter.filterType() == ENDPOINT) { //Endpoints may not be skipped return false; } final SessionContext zuulCtx = inMesg.getContext(); if ((zuulCtx.shouldStopFilterProcessing()) && (!filter.overrideStopFilterProcessing())) { return true; } if (zuulCtx.isCancelled()) { return true; } if (!filter.shouldFilter(inMesg)) { return true; } return false; }
[ "protected", "final", "boolean", "shouldSkipFilter", "(", "final", "I", "inMesg", ",", "final", "ZuulFilter", "<", "I", ",", "O", ">", "filter", ")", "{", "if", "(", "filter", ".", "filterType", "(", ")", "==", "ENDPOINT", ")", "{", "//Endpoints may not be skipped", "return", "false", ";", "}", "final", "SessionContext", "zuulCtx", "=", "inMesg", ".", "getContext", "(", ")", ";", "if", "(", "(", "zuulCtx", ".", "shouldStopFilterProcessing", "(", ")", ")", "&&", "(", "!", "filter", ".", "overrideStopFilterProcessing", "(", ")", ")", ")", "{", "return", "true", ";", "}", "if", "(", "zuulCtx", ".", "isCancelled", "(", ")", ")", "{", "return", "true", ";", "}", "if", "(", "!", "filter", ".", "shouldFilter", "(", "inMesg", ")", ")", "{", "return", "true", ";", "}", "return", "false", ";", "}" ]
/* This is typically set by a filter when wanting to reject a request and also reduce load on the server by not processing any more filterChain
[ "/", "*", "This", "is", "typically", "set", "by", "a", "filter", "when", "wanting", "to", "reject", "a", "request", "and", "also", "reduce", "load", "on", "the", "server", "by", "not", "processing", "any", "more", "filterChain" ]
train
https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/netty/filter/BaseZuulFilterRunner.java#L202-L218
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/http/HttpMessage.java
HttpMessage.getFieldValues
public Enumeration getFieldValues(String name,String separators) { """ Get a multi valued message field. Get a field from a message header. @param name The field name @param separators String of separators. @return Enumeration of field values or null """ return _header.getValues(name,separators); }
java
public Enumeration getFieldValues(String name,String separators) { return _header.getValues(name,separators); }
[ "public", "Enumeration", "getFieldValues", "(", "String", "name", ",", "String", "separators", ")", "{", "return", "_header", ".", "getValues", "(", "name", ",", "separators", ")", ";", "}" ]
Get a multi valued message field. Get a field from a message header. @param name The field name @param separators String of separators. @return Enumeration of field values or null
[ "Get", "a", "multi", "valued", "message", "field", ".", "Get", "a", "field", "from", "a", "message", "header", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/http/HttpMessage.java#L252-L255
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMapMessageImpl.java
JsJmsMapMessageImpl.setFloat
public void setFloat(String name, float value) throws UnsupportedEncodingException { """ /* Set a float value with the given name, into the Map. Javadoc description supplied by JsJmsMessage interface. """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setFloat", new Float(value)); getBodyMap().put(name, new Float(value)); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setFloat"); }
java
public void setFloat(String name, float value) throws UnsupportedEncodingException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setFloat", new Float(value)); getBodyMap().put(name, new Float(value)); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setFloat"); }
[ "public", "void", "setFloat", "(", "String", "name", ",", "float", "value", ")", "throws", "UnsupportedEncodingException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"setFloat\"", ",", "new", "Float", "(", "value", ")", ")", ";", "getBodyMap", "(", ")", ".", "put", "(", "name", ",", "new", "Float", "(", "value", ")", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"setFloat\"", ")", ";", "}" ]
/* Set a float value with the given name, into the Map. Javadoc description supplied by JsJmsMessage interface.
[ "/", "*", "Set", "a", "float", "value", "with", "the", "given", "name", "into", "the", "Map", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMapMessageImpl.java#L342-L346
liferay/com-liferay-commerce
commerce-product-type-grouped-service/src/main/java/com/liferay/commerce/product/type/grouped/service/persistence/impl/CPDefinitionGroupedEntryPersistenceImpl.java
CPDefinitionGroupedEntryPersistenceImpl.fetchByUUID_G
@Override public CPDefinitionGroupedEntry fetchByUUID_G(String uuid, long groupId) { """ Returns the cp definition grouped entry where uuid = &#63; and groupId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache. @param uuid the uuid @param groupId the group ID @return the matching cp definition grouped entry, or <code>null</code> if a matching cp definition grouped entry could not be found """ return fetchByUUID_G(uuid, groupId, true); }
java
@Override public CPDefinitionGroupedEntry fetchByUUID_G(String uuid, long groupId) { return fetchByUUID_G(uuid, groupId, true); }
[ "@", "Override", "public", "CPDefinitionGroupedEntry", "fetchByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "{", "return", "fetchByUUID_G", "(", "uuid", ",", "groupId", ",", "true", ")", ";", "}" ]
Returns the cp definition grouped entry where uuid = &#63; and groupId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache. @param uuid the uuid @param groupId the group ID @return the matching cp definition grouped entry, or <code>null</code> if a matching cp definition grouped entry could not be found
[ "Returns", "the", "cp", "definition", "grouped", "entry", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "returns", "<code", ">", "null<", "/", "code", ">", "if", "it", "could", "not", "be", "found", ".", "Uses", "the", "finder", "cache", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-type-grouped-service/src/main/java/com/liferay/commerce/product/type/grouped/service/persistence/impl/CPDefinitionGroupedEntryPersistenceImpl.java#L706-L709
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/executiongraph/ExecutionVertex.java
ExecutionVertex.insertOutputGate
void insertOutputGate(final int pos, final ExecutionGate outputGate) { """ Inserts the output gate at the given position. @param pos the position to insert the output gate @param outputGate the output gate to be inserted """ if (this.outputGates[pos] != null) { throw new IllegalStateException("Output gate at position " + pos + " is not null"); } this.outputGates[pos] = outputGate; }
java
void insertOutputGate(final int pos, final ExecutionGate outputGate) { if (this.outputGates[pos] != null) { throw new IllegalStateException("Output gate at position " + pos + " is not null"); } this.outputGates[pos] = outputGate; }
[ "void", "insertOutputGate", "(", "final", "int", "pos", ",", "final", "ExecutionGate", "outputGate", ")", "{", "if", "(", "this", ".", "outputGates", "[", "pos", "]", "!=", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Output gate at position \"", "+", "pos", "+", "\" is not null\"", ")", ";", "}", "this", ".", "outputGates", "[", "pos", "]", "=", "outputGate", ";", "}" ]
Inserts the output gate at the given position. @param pos the position to insert the output gate @param outputGate the output gate to be inserted
[ "Inserts", "the", "output", "gate", "at", "the", "given", "position", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/executiongraph/ExecutionVertex.java#L251-L258
fcrepo3/fcrepo
fcrepo-webapp/fcrepo-webapp-saxon/src/main/java/org/fcrepo/localservices/saxon/SaxonServlet.java
SaxonServlet.doGet
@Override public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException { """ Accept a GET request and produce a response. HTTP Request Parameters: <ul> <li>source - URL of source document</li> <li>style - URL of stylesheet</li> <li>clear-stylesheet-cache - if set to yes, empties the cache before running. </ul> @param req The HTTP request @param res The HTTP response """ String source = req.getParameter("source"); String style = req.getParameter("style"); String clear = req.getParameter("clear-stylesheet-cache"); if (clear != null && clear.equals("yes")) { m_cache.remove(style); } try { apply(style, source, req, res); } catch (Exception e) { res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e .getMessage()); e.printStackTrace(); } }
java
@Override public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException { String source = req.getParameter("source"); String style = req.getParameter("style"); String clear = req.getParameter("clear-stylesheet-cache"); if (clear != null && clear.equals("yes")) { m_cache.remove(style); } try { apply(style, source, req, res); } catch (Exception e) { res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e .getMessage()); e.printStackTrace(); } }
[ "@", "Override", "public", "void", "doGet", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "res", ")", "throws", "IOException", "{", "String", "source", "=", "req", ".", "getParameter", "(", "\"source\"", ")", ";", "String", "style", "=", "req", ".", "getParameter", "(", "\"style\"", ")", ";", "String", "clear", "=", "req", ".", "getParameter", "(", "\"clear-stylesheet-cache\"", ")", ";", "if", "(", "clear", "!=", "null", "&&", "clear", ".", "equals", "(", "\"yes\"", ")", ")", "{", "m_cache", ".", "remove", "(", "style", ")", ";", "}", "try", "{", "apply", "(", "style", ",", "source", ",", "req", ",", "res", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "res", ".", "sendError", "(", "HttpServletResponse", ".", "SC_INTERNAL_SERVER_ERROR", ",", "e", ".", "getMessage", "(", ")", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
Accept a GET request and produce a response. HTTP Request Parameters: <ul> <li>source - URL of source document</li> <li>style - URL of stylesheet</li> <li>clear-stylesheet-cache - if set to yes, empties the cache before running. </ul> @param req The HTTP request @param res The HTTP response
[ "Accept", "a", "GET", "request", "and", "produce", "a", "response", ".", "HTTP", "Request", "Parameters", ":", "<ul", ">", "<li", ">", "source", "-", "URL", "of", "source", "document<", "/", "li", ">", "<li", ">", "style", "-", "URL", "of", "stylesheet<", "/", "li", ">", "<li", ">", "clear", "-", "stylesheet", "-", "cache", "-", "if", "set", "to", "yes", "empties", "the", "cache", "before", "running", ".", "<", "/", "ul", ">" ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-webapp/fcrepo-webapp-saxon/src/main/java/org/fcrepo/localservices/saxon/SaxonServlet.java#L151-L169
openengsb/openengsb
components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/performer/TransformationPerformer.java
TransformationPerformer.loadObjectFromTemporary
private Object loadObjectFromTemporary(String fieldname, String complete) throws Exception { """ Loads the object for the given field name from the temporary fields. If an error occurs, the complete path (inclusive nested names) are given in an exception. """ String realName = fieldname.substring(1); if (!temporaryFields.containsKey(realName)) { String message = String.format("The temporary field %s doesn't exist.", complete); throw new IllegalArgumentException(message); } return temporaryFields.get(realName); }
java
private Object loadObjectFromTemporary(String fieldname, String complete) throws Exception { String realName = fieldname.substring(1); if (!temporaryFields.containsKey(realName)) { String message = String.format("The temporary field %s doesn't exist.", complete); throw new IllegalArgumentException(message); } return temporaryFields.get(realName); }
[ "private", "Object", "loadObjectFromTemporary", "(", "String", "fieldname", ",", "String", "complete", ")", "throws", "Exception", "{", "String", "realName", "=", "fieldname", ".", "substring", "(", "1", ")", ";", "if", "(", "!", "temporaryFields", ".", "containsKey", "(", "realName", ")", ")", "{", "String", "message", "=", "String", ".", "format", "(", "\"The temporary field %s doesn't exist.\"", ",", "complete", ")", ";", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "}", "return", "temporaryFields", ".", "get", "(", "realName", ")", ";", "}" ]
Loads the object for the given field name from the temporary fields. If an error occurs, the complete path (inclusive nested names) are given in an exception.
[ "Loads", "the", "object", "for", "the", "given", "field", "name", "from", "the", "temporary", "fields", ".", "If", "an", "error", "occurs", "the", "complete", "path", "(", "inclusive", "nested", "names", ")", "are", "given", "in", "an", "exception", "." ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/performer/TransformationPerformer.java#L183-L190
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/ClassUtils.java
ClassUtils.getSimpleName
public static String getSimpleName(final Object object, final String valueIfNull) { """ <p>Null-safe version of <code>aClass.getSimpleName()</code></p> @param object the object for which to get the simple class name; may be null @param valueIfNull the value to return if <code>object</code> is <code>null</code> @return the simple class name or {@code valueIfNull} @since 3.0 @see Class#getSimpleName() """ return object == null ? valueIfNull : object.getClass().getSimpleName(); }
java
public static String getSimpleName(final Object object, final String valueIfNull) { return object == null ? valueIfNull : object.getClass().getSimpleName(); }
[ "public", "static", "String", "getSimpleName", "(", "final", "Object", "object", ",", "final", "String", "valueIfNull", ")", "{", "return", "object", "==", "null", "?", "valueIfNull", ":", "object", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ";", "}" ]
<p>Null-safe version of <code>aClass.getSimpleName()</code></p> @param object the object for which to get the simple class name; may be null @param valueIfNull the value to return if <code>object</code> is <code>null</code> @return the simple class name or {@code valueIfNull} @since 3.0 @see Class#getSimpleName()
[ "<p", ">", "Null", "-", "safe", "version", "of", "<code", ">", "aClass", ".", "getSimpleName", "()", "<", "/", "code", ">", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ClassUtils.java#L291-L293
CloudSlang/cs-actions
cs-commons/src/main/java/io/cloudslang/content/utils/NumberUtilities.java
NumberUtilities.toLong
public static long toLong(@Nullable final String longStr, final long defaultLong) { """ If the long integer string is null or empty, it returns the defaultLong otherwise it returns the long integer value (see toLong) @param longStr the long integer to convert @param defaultLong the default value if the longStr is null or the empty string @return the long integer value of the string or the defaultLong if the long integer string is empty @throws IllegalArgumentException if the passed long integer string is not a valid long integer """ return StringUtils.isNoneEmpty(longStr) ? toLong(longStr) : defaultLong; }
java
public static long toLong(@Nullable final String longStr, final long defaultLong) { return StringUtils.isNoneEmpty(longStr) ? toLong(longStr) : defaultLong; }
[ "public", "static", "long", "toLong", "(", "@", "Nullable", "final", "String", "longStr", ",", "final", "long", "defaultLong", ")", "{", "return", "StringUtils", ".", "isNoneEmpty", "(", "longStr", ")", "?", "toLong", "(", "longStr", ")", ":", "defaultLong", ";", "}" ]
If the long integer string is null or empty, it returns the defaultLong otherwise it returns the long integer value (see toLong) @param longStr the long integer to convert @param defaultLong the default value if the longStr is null or the empty string @return the long integer value of the string or the defaultLong if the long integer string is empty @throws IllegalArgumentException if the passed long integer string is not a valid long integer
[ "If", "the", "long", "integer", "string", "is", "null", "or", "empty", "it", "returns", "the", "defaultLong", "otherwise", "it", "returns", "the", "long", "integer", "value", "(", "see", "toLong", ")" ]
train
https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-commons/src/main/java/io/cloudslang/content/utils/NumberUtilities.java#L198-L200
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.getAttributeEnum
@Pure public static <T extends Enum<T>> T getAttributeEnum(Node document, Class<T> type, boolean caseSensitive, String... path) { """ Read an enumeration value. @param <T> is the type of the enumeration. @param document is the XML document to explore. @param type is the type of the enumeration. @param caseSensitive indicates of the {@code path}'s components are case sensitive. @param path is the list of and ended by the attribute's name. @return the value of the enumeration or <code>null</code> if none. """ assert document != null : AssertMessages.notNullParameter(0); return getAttributeEnumWithDefault(document, type, caseSensitive, null, path); }
java
@Pure public static <T extends Enum<T>> T getAttributeEnum(Node document, Class<T> type, boolean caseSensitive, String... path) { assert document != null : AssertMessages.notNullParameter(0); return getAttributeEnumWithDefault(document, type, caseSensitive, null, path); }
[ "@", "Pure", "public", "static", "<", "T", "extends", "Enum", "<", "T", ">", ">", "T", "getAttributeEnum", "(", "Node", "document", ",", "Class", "<", "T", ">", "type", ",", "boolean", "caseSensitive", ",", "String", "...", "path", ")", "{", "assert", "document", "!=", "null", ":", "AssertMessages", ".", "notNullParameter", "(", "0", ")", ";", "return", "getAttributeEnumWithDefault", "(", "document", ",", "type", ",", "caseSensitive", ",", "null", ",", "path", ")", ";", "}" ]
Read an enumeration value. @param <T> is the type of the enumeration. @param document is the XML document to explore. @param type is the type of the enumeration. @param caseSensitive indicates of the {@code path}'s components are case sensitive. @param path is the list of and ended by the attribute's name. @return the value of the enumeration or <code>null</code> if none.
[ "Read", "an", "enumeration", "value", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L651-L655
wisdom-framework/wisdom
core/application-configuration/src/main/java/org/wisdom/configuration/ConfigurationImpl.java
ConfigurationImpl.getList
@Override public List<String> getList(final String key) { """ Retrieves the values as a list of String, the format is: key=[myval1,myval2]. @param key the key the key used in the configuration file. @return an list containing the values of that key or empty if not found. """ return retrieve(new Callable<List<String>>() { @Override public List<String> call() throws Exception { try { return configuration.getStringList(key); } catch (ConfigException.WrongType e) { // Not a list. String s = get(key); if (s != null) { return ImmutableList.of(s); } else { throw new IllegalArgumentException("Cannot create a list for the key '" + key + "'", e); } } } }, Collections.<String>emptyList()); }
java
@Override public List<String> getList(final String key) { return retrieve(new Callable<List<String>>() { @Override public List<String> call() throws Exception { try { return configuration.getStringList(key); } catch (ConfigException.WrongType e) { // Not a list. String s = get(key); if (s != null) { return ImmutableList.of(s); } else { throw new IllegalArgumentException("Cannot create a list for the key '" + key + "'", e); } } } }, Collections.<String>emptyList()); }
[ "@", "Override", "public", "List", "<", "String", ">", "getList", "(", "final", "String", "key", ")", "{", "return", "retrieve", "(", "new", "Callable", "<", "List", "<", "String", ">", ">", "(", ")", "{", "@", "Override", "public", "List", "<", "String", ">", "call", "(", ")", "throws", "Exception", "{", "try", "{", "return", "configuration", ".", "getStringList", "(", "key", ")", ";", "}", "catch", "(", "ConfigException", ".", "WrongType", "e", ")", "{", "// Not a list.", "String", "s", "=", "get", "(", "key", ")", ";", "if", "(", "s", "!=", "null", ")", "{", "return", "ImmutableList", ".", "of", "(", "s", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "\"Cannot create a list for the key '\"", "+", "key", "+", "\"'\"", ",", "e", ")", ";", "}", "}", "}", "}", ",", "Collections", ".", "<", "String", ">", "emptyList", "(", ")", ")", ";", "}" ]
Retrieves the values as a list of String, the format is: key=[myval1,myval2]. @param key the key the key used in the configuration file. @return an list containing the values of that key or empty if not found.
[ "Retrieves", "the", "values", "as", "a", "list", "of", "String", "the", "format", "is", ":", "key", "=", "[", "myval1", "myval2", "]", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/application-configuration/src/main/java/org/wisdom/configuration/ConfigurationImpl.java#L405-L423
apereo/cas
core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java
AbstractCasWebflowConfigurer.containsFlowState
public boolean containsFlowState(final Flow flow, final String stateId) { """ Contains flow state? @param flow the flow @param stateId the state id @return true if flow contains the state. """ if (flow == null) { LOGGER.error("Flow is not configured correctly and cannot be null."); return false; } return flow.containsState(stateId); }
java
public boolean containsFlowState(final Flow flow, final String stateId) { if (flow == null) { LOGGER.error("Flow is not configured correctly and cannot be null."); return false; } return flow.containsState(stateId); }
[ "public", "boolean", "containsFlowState", "(", "final", "Flow", "flow", ",", "final", "String", "stateId", ")", "{", "if", "(", "flow", "==", "null", ")", "{", "LOGGER", ".", "error", "(", "\"Flow is not configured correctly and cannot be null.\"", ")", ";", "return", "false", ";", "}", "return", "flow", ".", "containsState", "(", "stateId", ")", ";", "}" ]
Contains flow state? @param flow the flow @param stateId the state id @return true if flow contains the state.
[ "Contains", "flow", "state?" ]
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#L546-L552
Berico-Technologies/CLAVIN
src/main/java/com/bericotech/clavin/gazetteer/query/QueryBuilder.java
QueryBuilder.addParentIds
public QueryBuilder addParentIds(final Integer id1, final Integer... ids) { """ Add the provided parent IDs to the set of query constraints. @param id1 the first parent ID to add @param ids the subsequent parent IDs to add @return this """ parentIds.add(id1); parentIds.addAll(Arrays.asList(ids)); return this; }
java
public QueryBuilder addParentIds(final Integer id1, final Integer... ids) { parentIds.add(id1); parentIds.addAll(Arrays.asList(ids)); return this; }
[ "public", "QueryBuilder", "addParentIds", "(", "final", "Integer", "id1", ",", "final", "Integer", "...", "ids", ")", "{", "parentIds", ".", "add", "(", "id1", ")", ";", "parentIds", ".", "addAll", "(", "Arrays", ".", "asList", "(", "ids", ")", ")", ";", "return", "this", ";", "}" ]
Add the provided parent IDs to the set of query constraints. @param id1 the first parent ID to add @param ids the subsequent parent IDs to add @return this
[ "Add", "the", "provided", "parent", "IDs", "to", "the", "set", "of", "query", "constraints", "." ]
train
https://github.com/Berico-Technologies/CLAVIN/blob/f73c741f33a01b91aa5b06e71860bc354ef3010d/src/main/java/com/bericotech/clavin/gazetteer/query/QueryBuilder.java#L288-L292
jfinal/jfinal
src/main/java/com/jfinal/core/Controller.java
Controller.getParaToLong
public Long getParaToLong(String name, Long defaultValue) { """ Returns the value of a request parameter and convert to Long with a default value if it is null. @param name a String specifying the name of the parameter @return a Integer representing the single value of the parameter """ return toLong(request.getParameter(name), defaultValue); }
java
public Long getParaToLong(String name, Long defaultValue) { return toLong(request.getParameter(name), defaultValue); }
[ "public", "Long", "getParaToLong", "(", "String", "name", ",", "Long", "defaultValue", ")", "{", "return", "toLong", "(", "request", ".", "getParameter", "(", "name", ")", ",", "defaultValue", ")", ";", "}" ]
Returns the value of a request parameter and convert to Long with a default value if it is null. @param name a String specifying the name of the parameter @return a Integer representing the single value of the parameter
[ "Returns", "the", "value", "of", "a", "request", "parameter", "and", "convert", "to", "Long", "with", "a", "default", "value", "if", "it", "is", "null", "." ]
train
https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/core/Controller.java#L351-L353
Alluxio/alluxio
core/common/src/main/java/alluxio/util/network/NetworkAddressUtils.java
NetworkAddressUtils.getDataPortSocketAddress
public static SocketAddress getDataPortSocketAddress(WorkerNetAddress netAddress, AlluxioConfiguration conf) { """ Extracts dataPort socket address from Alluxio representation of network address. @param netAddress the input network address representation @param conf Alluxio configuration @return the socket address """ SocketAddress address; if (NettyUtils.isDomainSocketSupported(netAddress, conf)) { address = new DomainSocketAddress(netAddress.getDomainSocketPath()); } else { String host = netAddress.getHost(); int port = netAddress.getDataPort(); address = new InetSocketAddress(host, port); } return address; }
java
public static SocketAddress getDataPortSocketAddress(WorkerNetAddress netAddress, AlluxioConfiguration conf) { SocketAddress address; if (NettyUtils.isDomainSocketSupported(netAddress, conf)) { address = new DomainSocketAddress(netAddress.getDomainSocketPath()); } else { String host = netAddress.getHost(); int port = netAddress.getDataPort(); address = new InetSocketAddress(host, port); } return address; }
[ "public", "static", "SocketAddress", "getDataPortSocketAddress", "(", "WorkerNetAddress", "netAddress", ",", "AlluxioConfiguration", "conf", ")", "{", "SocketAddress", "address", ";", "if", "(", "NettyUtils", ".", "isDomainSocketSupported", "(", "netAddress", ",", "conf", ")", ")", "{", "address", "=", "new", "DomainSocketAddress", "(", "netAddress", ".", "getDomainSocketPath", "(", ")", ")", ";", "}", "else", "{", "String", "host", "=", "netAddress", ".", "getHost", "(", ")", ";", "int", "port", "=", "netAddress", ".", "getDataPort", "(", ")", ";", "address", "=", "new", "InetSocketAddress", "(", "host", ",", "port", ")", ";", "}", "return", "address", ";", "}" ]
Extracts dataPort socket address from Alluxio representation of network address. @param netAddress the input network address representation @param conf Alluxio configuration @return the socket address
[ "Extracts", "dataPort", "socket", "address", "from", "Alluxio", "representation", "of", "network", "address", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/network/NetworkAddressUtils.java#L624-L635
everit-org/osgi-richconsole
src/main/java/org/everit/osgi/dev/richconsole/internal/upgrade/UpgradeProcess.java
UpgradeProcess.uninstallBundle
public void uninstallBundle(final String symbolicName, final String version) { """ Uninstalling an existing bundle @param symbolicName The symbolicName of the bundle @param version The version of the bundle, optional. In case this parameter is null, the first bundle with the given symbolic name will be uninstalled. """ Bundle bundle = bundleDeployerService.getExistingBundleBySymbolicName(symbolicName, version, null); if (bundle != null) { stateChanged = true; Logger.info("Uninstalling bundle: " + bundle); BundleStartLevel bundleStartLevel = bundle.adapt(BundleStartLevel.class); if (bundleStartLevel.getStartLevel() < currentFrameworkStartLevelValue) { setFrameworkStartLevel(bundleStartLevel.getStartLevel()); } try { bundle.uninstall(); } catch (BundleException e) { Logger.error("Error during uninstalling bundle: " + bundle.toString(), e); } } }
java
public void uninstallBundle(final String symbolicName, final String version) { Bundle bundle = bundleDeployerService.getExistingBundleBySymbolicName(symbolicName, version, null); if (bundle != null) { stateChanged = true; Logger.info("Uninstalling bundle: " + bundle); BundleStartLevel bundleStartLevel = bundle.adapt(BundleStartLevel.class); if (bundleStartLevel.getStartLevel() < currentFrameworkStartLevelValue) { setFrameworkStartLevel(bundleStartLevel.getStartLevel()); } try { bundle.uninstall(); } catch (BundleException e) { Logger.error("Error during uninstalling bundle: " + bundle.toString(), e); } } }
[ "public", "void", "uninstallBundle", "(", "final", "String", "symbolicName", ",", "final", "String", "version", ")", "{", "Bundle", "bundle", "=", "bundleDeployerService", ".", "getExistingBundleBySymbolicName", "(", "symbolicName", ",", "version", ",", "null", ")", ";", "if", "(", "bundle", "!=", "null", ")", "{", "stateChanged", "=", "true", ";", "Logger", ".", "info", "(", "\"Uninstalling bundle: \"", "+", "bundle", ")", ";", "BundleStartLevel", "bundleStartLevel", "=", "bundle", ".", "adapt", "(", "BundleStartLevel", ".", "class", ")", ";", "if", "(", "bundleStartLevel", ".", "getStartLevel", "(", ")", "<", "currentFrameworkStartLevelValue", ")", "{", "setFrameworkStartLevel", "(", "bundleStartLevel", ".", "getStartLevel", "(", ")", ")", ";", "}", "try", "{", "bundle", ".", "uninstall", "(", ")", ";", "}", "catch", "(", "BundleException", "e", ")", "{", "Logger", ".", "error", "(", "\"Error during uninstalling bundle: \"", "+", "bundle", ".", "toString", "(", ")", ",", "e", ")", ";", "}", "}", "}" ]
Uninstalling an existing bundle @param symbolicName The symbolicName of the bundle @param version The version of the bundle, optional. In case this parameter is null, the first bundle with the given symbolic name will be uninstalled.
[ "Uninstalling", "an", "existing", "bundle" ]
train
https://github.com/everit-org/osgi-richconsole/blob/417eaf497ec5f325576c2f4c05af7bd1243e5249/src/main/java/org/everit/osgi/dev/richconsole/internal/upgrade/UpgradeProcess.java#L361-L376
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/wan/merkletree/MerkleTreeUtil.java
MerkleTreeUtil.createRemoteMerkleTreeView
public static RemoteMerkleTreeView createRemoteMerkleTreeView(DataInput in) throws IOException { """ Creates a {@link RemoteMerkleTreeView} by reading the hashes of the leaves of a Merkle tree from the provided {@link DataInput} @param in The data input the hashes to be read from @return the view representing the remote Merkle tree @throws IOException if an I/O error occurs """ int numberOfLeaves = in.readInt(); int depth = QuickMath.log2(numberOfLeaves << 1); int[] leaves = new int[numberOfLeaves]; for (int i = 0; i < numberOfLeaves; i++) { leaves[i] = in.readInt(); } return new RemoteMerkleTreeView(leaves, depth); }
java
public static RemoteMerkleTreeView createRemoteMerkleTreeView(DataInput in) throws IOException { int numberOfLeaves = in.readInt(); int depth = QuickMath.log2(numberOfLeaves << 1); int[] leaves = new int[numberOfLeaves]; for (int i = 0; i < numberOfLeaves; i++) { leaves[i] = in.readInt(); } return new RemoteMerkleTreeView(leaves, depth); }
[ "public", "static", "RemoteMerkleTreeView", "createRemoteMerkleTreeView", "(", "DataInput", "in", ")", "throws", "IOException", "{", "int", "numberOfLeaves", "=", "in", ".", "readInt", "(", ")", ";", "int", "depth", "=", "QuickMath", ".", "log2", "(", "numberOfLeaves", "<<", "1", ")", ";", "int", "[", "]", "leaves", "=", "new", "int", "[", "numberOfLeaves", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numberOfLeaves", ";", "i", "++", ")", "{", "leaves", "[", "i", "]", "=", "in", ".", "readInt", "(", ")", ";", "}", "return", "new", "RemoteMerkleTreeView", "(", "leaves", ",", "depth", ")", ";", "}" ]
Creates a {@link RemoteMerkleTreeView} by reading the hashes of the leaves of a Merkle tree from the provided {@link DataInput} @param in The data input the hashes to be read from @return the view representing the remote Merkle tree @throws IOException if an I/O error occurs
[ "Creates", "a", "{", "@link", "RemoteMerkleTreeView", "}", "by", "reading", "the", "hashes", "of", "the", "leaves", "of", "a", "Merkle", "tree", "from", "the", "provided", "{", "@link", "DataInput", "}" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/wan/merkletree/MerkleTreeUtil.java#L368-L377
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.deleteStorageAccountAsync
public Observable<DeletedStorageBundle> deleteStorageAccountAsync(String vaultBaseUrl, String storageAccountName) { """ Deletes a storage account. This operation requires the storage/delete permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param storageAccountName The name of the storage account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DeletedStorageBundle object """ return deleteStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName).map(new Func1<ServiceResponse<DeletedStorageBundle>, DeletedStorageBundle>() { @Override public DeletedStorageBundle call(ServiceResponse<DeletedStorageBundle> response) { return response.body(); } }); }
java
public Observable<DeletedStorageBundle> deleteStorageAccountAsync(String vaultBaseUrl, String storageAccountName) { return deleteStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName).map(new Func1<ServiceResponse<DeletedStorageBundle>, DeletedStorageBundle>() { @Override public DeletedStorageBundle call(ServiceResponse<DeletedStorageBundle> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DeletedStorageBundle", ">", "deleteStorageAccountAsync", "(", "String", "vaultBaseUrl", ",", "String", "storageAccountName", ")", "{", "return", "deleteStorageAccountWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "storageAccountName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "DeletedStorageBundle", ">", ",", "DeletedStorageBundle", ">", "(", ")", "{", "@", "Override", "public", "DeletedStorageBundle", "call", "(", "ServiceResponse", "<", "DeletedStorageBundle", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Deletes a storage account. This operation requires the storage/delete permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param storageAccountName The name of the storage account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DeletedStorageBundle object
[ "Deletes", "a", "storage", "account", ".", "This", "operation", "requires", "the", "storage", "/", "delete", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L9722-L9729
albfernandez/itext2
src/main/java/com/lowagie/text/SimpleCell.java
SimpleCell.addElement
public void addElement(Element element) throws BadElementException { """ Adds content to this object. @param element @throws BadElementException """ if (cellgroup) { if (element instanceof SimpleCell) { if(((SimpleCell)element).isCellgroup()) { throw new BadElementException("You can't add one row to another row."); } content.add(element); return; } else { throw new BadElementException("You can only add cells to rows, no objects of type " + element.getClass().getName()); } } if (element.type() == Element.PARAGRAPH || element.type() == Element.PHRASE || element.type() == Element.ANCHOR || element.type() == Element.CHUNK || element.type() == Element.LIST || element.type() == Element.MARKED || element.type() == Element.JPEG || element.type() == Element.JPEG2000 || element.type() == Element.JBIG2 || element.type() == Element.IMGRAW || element.type() == Element.IMGTEMPLATE) { content.add(element); } else { throw new BadElementException("You can't add an element of type " + element.getClass().getName() + " to a SimpleCell."); } }
java
public void addElement(Element element) throws BadElementException { if (cellgroup) { if (element instanceof SimpleCell) { if(((SimpleCell)element).isCellgroup()) { throw new BadElementException("You can't add one row to another row."); } content.add(element); return; } else { throw new BadElementException("You can only add cells to rows, no objects of type " + element.getClass().getName()); } } if (element.type() == Element.PARAGRAPH || element.type() == Element.PHRASE || element.type() == Element.ANCHOR || element.type() == Element.CHUNK || element.type() == Element.LIST || element.type() == Element.MARKED || element.type() == Element.JPEG || element.type() == Element.JPEG2000 || element.type() == Element.JBIG2 || element.type() == Element.IMGRAW || element.type() == Element.IMGTEMPLATE) { content.add(element); } else { throw new BadElementException("You can't add an element of type " + element.getClass().getName() + " to a SimpleCell."); } }
[ "public", "void", "addElement", "(", "Element", "element", ")", "throws", "BadElementException", "{", "if", "(", "cellgroup", ")", "{", "if", "(", "element", "instanceof", "SimpleCell", ")", "{", "if", "(", "(", "(", "SimpleCell", ")", "element", ")", ".", "isCellgroup", "(", ")", ")", "{", "throw", "new", "BadElementException", "(", "\"You can't add one row to another row.\"", ")", ";", "}", "content", ".", "add", "(", "element", ")", ";", "return", ";", "}", "else", "{", "throw", "new", "BadElementException", "(", "\"You can only add cells to rows, no objects of type \"", "+", "element", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "}", "if", "(", "element", ".", "type", "(", ")", "==", "Element", ".", "PARAGRAPH", "||", "element", ".", "type", "(", ")", "==", "Element", ".", "PHRASE", "||", "element", ".", "type", "(", ")", "==", "Element", ".", "ANCHOR", "||", "element", ".", "type", "(", ")", "==", "Element", ".", "CHUNK", "||", "element", ".", "type", "(", ")", "==", "Element", ".", "LIST", "||", "element", ".", "type", "(", ")", "==", "Element", ".", "MARKED", "||", "element", ".", "type", "(", ")", "==", "Element", ".", "JPEG", "||", "element", ".", "type", "(", ")", "==", "Element", ".", "JPEG2000", "||", "element", ".", "type", "(", ")", "==", "Element", ".", "JBIG2", "||", "element", ".", "type", "(", ")", "==", "Element", ".", "IMGRAW", "||", "element", ".", "type", "(", ")", "==", "Element", ".", "IMGTEMPLATE", ")", "{", "content", ".", "add", "(", "element", ")", ";", "}", "else", "{", "throw", "new", "BadElementException", "(", "\"You can't add an element of type \"", "+", "element", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\" to a SimpleCell.\"", ")", ";", "}", "}" ]
Adds content to this object. @param element @throws BadElementException
[ "Adds", "content", "to", "this", "object", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/SimpleCell.java#L132-L161
Metatavu/edelphi
edelphi/src/main/java/fi/metatavu/edelphi/utils/GoogleDriveUtils.java
GoogleDriveUtils.exportSpreadsheet
public static DownloadResponse exportSpreadsheet(Drive drive, String fileId) throws IOException { """ Exports a spreadsheet in HTML format @param drive drive client @param fileId file id for file to be exported @return Spreadsheet in HTML format @throws IOException thrown when exporting fails unexpectedly """ try (InputStream inputStream = drive.files().export(fileId, "text/csv").executeAsInputStream()) { CSVRenderer csvRenderer = new CSVRenderer(inputStream, "google-spreadsheet", true); return new DownloadResponse(TEXT_HTML, csvRenderer.renderHtmlTable().getBytes("UTF-8")); } }
java
public static DownloadResponse exportSpreadsheet(Drive drive, String fileId) throws IOException { try (InputStream inputStream = drive.files().export(fileId, "text/csv").executeAsInputStream()) { CSVRenderer csvRenderer = new CSVRenderer(inputStream, "google-spreadsheet", true); return new DownloadResponse(TEXT_HTML, csvRenderer.renderHtmlTable().getBytes("UTF-8")); } }
[ "public", "static", "DownloadResponse", "exportSpreadsheet", "(", "Drive", "drive", ",", "String", "fileId", ")", "throws", "IOException", "{", "try", "(", "InputStream", "inputStream", "=", "drive", ".", "files", "(", ")", ".", "export", "(", "fileId", ",", "\"text/csv\"", ")", ".", "executeAsInputStream", "(", ")", ")", "{", "CSVRenderer", "csvRenderer", "=", "new", "CSVRenderer", "(", "inputStream", ",", "\"google-spreadsheet\"", ",", "true", ")", ";", "return", "new", "DownloadResponse", "(", "TEXT_HTML", ",", "csvRenderer", ".", "renderHtmlTable", "(", ")", ".", "getBytes", "(", "\"UTF-8\"", ")", ")", ";", "}", "}" ]
Exports a spreadsheet in HTML format @param drive drive client @param fileId file id for file to be exported @return Spreadsheet in HTML format @throws IOException thrown when exporting fails unexpectedly
[ "Exports", "a", "spreadsheet", "in", "HTML", "format" ]
train
https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/utils/GoogleDriveUtils.java#L304-L309
lessthanoptimal/BoofCV
examples/src/main/java/boofcv/examples/features/ExampleFitPolygon.java
ExampleFitPolygon.fitCannyEdges
public static void fitCannyEdges( GrayF32 input ) { """ Fits a sequence of line-segments into a sequence of points found using the Canny edge detector. In this case the points are not connected in a loop. The canny detector produces a more complex tree and the fitted points can be a bit noisy compared to the others. """ BufferedImage displayImage = new BufferedImage(input.width,input.height,BufferedImage.TYPE_INT_RGB); // Finds edges inside the image CannyEdge<GrayF32,GrayF32> canny = FactoryEdgeDetectors.canny(2, true, true, GrayF32.class, GrayF32.class); canny.process(input,0.1f,0.3f,null); List<EdgeContour> contours = canny.getContours(); Graphics2D g2 = displayImage.createGraphics(); g2.setStroke(new BasicStroke(2)); // used to select colors for each line Random rand = new Random(234); for( EdgeContour e : contours ) { g2.setColor(new Color(rand.nextInt())); for(EdgeSegment s : e.segments ) { // fit line segments to the point sequence. Note that loop is false List<PointIndex_I32> vertexes = ShapeFittingOps.fitPolygon(s.points,false, minSide,cornerPenalty); VisualizeShapes.drawPolygon(vertexes, false, g2); } } gui.addImage(displayImage, "Canny Trace"); }
java
public static void fitCannyEdges( GrayF32 input ) { BufferedImage displayImage = new BufferedImage(input.width,input.height,BufferedImage.TYPE_INT_RGB); // Finds edges inside the image CannyEdge<GrayF32,GrayF32> canny = FactoryEdgeDetectors.canny(2, true, true, GrayF32.class, GrayF32.class); canny.process(input,0.1f,0.3f,null); List<EdgeContour> contours = canny.getContours(); Graphics2D g2 = displayImage.createGraphics(); g2.setStroke(new BasicStroke(2)); // used to select colors for each line Random rand = new Random(234); for( EdgeContour e : contours ) { g2.setColor(new Color(rand.nextInt())); for(EdgeSegment s : e.segments ) { // fit line segments to the point sequence. Note that loop is false List<PointIndex_I32> vertexes = ShapeFittingOps.fitPolygon(s.points,false, minSide,cornerPenalty); VisualizeShapes.drawPolygon(vertexes, false, g2); } } gui.addImage(displayImage, "Canny Trace"); }
[ "public", "static", "void", "fitCannyEdges", "(", "GrayF32", "input", ")", "{", "BufferedImage", "displayImage", "=", "new", "BufferedImage", "(", "input", ".", "width", ",", "input", ".", "height", ",", "BufferedImage", ".", "TYPE_INT_RGB", ")", ";", "// Finds edges inside the image", "CannyEdge", "<", "GrayF32", ",", "GrayF32", ">", "canny", "=", "FactoryEdgeDetectors", ".", "canny", "(", "2", ",", "true", ",", "true", ",", "GrayF32", ".", "class", ",", "GrayF32", ".", "class", ")", ";", "canny", ".", "process", "(", "input", ",", "0.1f", ",", "0.3f", ",", "null", ")", ";", "List", "<", "EdgeContour", ">", "contours", "=", "canny", ".", "getContours", "(", ")", ";", "Graphics2D", "g2", "=", "displayImage", ".", "createGraphics", "(", ")", ";", "g2", ".", "setStroke", "(", "new", "BasicStroke", "(", "2", ")", ")", ";", "// used to select colors for each line", "Random", "rand", "=", "new", "Random", "(", "234", ")", ";", "for", "(", "EdgeContour", "e", ":", "contours", ")", "{", "g2", ".", "setColor", "(", "new", "Color", "(", "rand", ".", "nextInt", "(", ")", ")", ")", ";", "for", "(", "EdgeSegment", "s", ":", "e", ".", "segments", ")", "{", "// fit line segments to the point sequence. Note that loop is false", "List", "<", "PointIndex_I32", ">", "vertexes", "=", "ShapeFittingOps", ".", "fitPolygon", "(", "s", ".", "points", ",", "false", ",", "minSide", ",", "cornerPenalty", ")", ";", "VisualizeShapes", ".", "drawPolygon", "(", "vertexes", ",", "false", ",", "g2", ")", ";", "}", "}", "gui", ".", "addImage", "(", "displayImage", ",", "\"Canny Trace\"", ")", ";", "}" ]
Fits a sequence of line-segments into a sequence of points found using the Canny edge detector. In this case the points are not connected in a loop. The canny detector produces a more complex tree and the fitted points can be a bit noisy compared to the others.
[ "Fits", "a", "sequence", "of", "line", "-", "segments", "into", "a", "sequence", "of", "points", "found", "using", "the", "Canny", "edge", "detector", ".", "In", "this", "case", "the", "points", "are", "not", "connected", "in", "a", "loop", ".", "The", "canny", "detector", "produces", "a", "more", "complex", "tree", "and", "the", "fitted", "points", "can", "be", "a", "bit", "noisy", "compared", "to", "the", "others", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/features/ExampleFitPolygon.java#L111-L140
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/bucket/api/Utils.java
Utils.addDetails
@InterfaceAudience.Private @InterfaceStability.Uncommitted public static <X extends CouchbaseException, R extends CouchbaseResponse> X addDetails(X ex, R r) { """ Helper method to encapsulate the logic of enriching the exception with detailed status info. """ if (r.statusDetails() != null) { ex.details(r.statusDetails()); if (LOGGER.isDebugEnabled()) { LOGGER.debug("{} returned with enhanced error details {}", r, ex); } } return ex; }
java
@InterfaceAudience.Private @InterfaceStability.Uncommitted public static <X extends CouchbaseException, R extends CouchbaseResponse> X addDetails(X ex, R r) { if (r.statusDetails() != null) { ex.details(r.statusDetails()); if (LOGGER.isDebugEnabled()) { LOGGER.debug("{} returned with enhanced error details {}", r, ex); } } return ex; }
[ "@", "InterfaceAudience", ".", "Private", "@", "InterfaceStability", ".", "Uncommitted", "public", "static", "<", "X", "extends", "CouchbaseException", ",", "R", "extends", "CouchbaseResponse", ">", "X", "addDetails", "(", "X", "ex", ",", "R", "r", ")", "{", "if", "(", "r", ".", "statusDetails", "(", ")", "!=", "null", ")", "{", "ex", ".", "details", "(", "r", ".", "statusDetails", "(", ")", ")", ";", "if", "(", "LOGGER", ".", "isDebugEnabled", "(", ")", ")", "{", "LOGGER", ".", "debug", "(", "\"{} returned with enhanced error details {}\"", ",", "r", ",", "ex", ")", ";", "}", "}", "return", "ex", ";", "}" ]
Helper method to encapsulate the logic of enriching the exception with detailed status info.
[ "Helper", "method", "to", "encapsulate", "the", "logic", "of", "enriching", "the", "exception", "with", "detailed", "status", "info", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/bucket/api/Utils.java#L54-L64
real-logic/agrona
agrona/src/main/java/org/agrona/PrintBufferUtil.java
PrintBufferUtil.hexDump
public static String hexDump(final DirectBuffer buffer, final int fromIndex, final int length) { """ Returns a <a href="http://en.wikipedia.org/wiki/Hex_dump">hex dump</a> of the specified buffer's sub-region. @param buffer dumped buffer @param fromIndex where should we start to print @param length how much should we print @return hex dump in a string representation """ return HexUtil.hexDump(buffer, fromIndex, length); }
java
public static String hexDump(final DirectBuffer buffer, final int fromIndex, final int length) { return HexUtil.hexDump(buffer, fromIndex, length); }
[ "public", "static", "String", "hexDump", "(", "final", "DirectBuffer", "buffer", ",", "final", "int", "fromIndex", ",", "final", "int", "length", ")", "{", "return", "HexUtil", ".", "hexDump", "(", "buffer", ",", "fromIndex", ",", "length", ")", ";", "}" ]
Returns a <a href="http://en.wikipedia.org/wiki/Hex_dump">hex dump</a> of the specified buffer's sub-region. @param buffer dumped buffer @param fromIndex where should we start to print @param length how much should we print @return hex dump in a string representation
[ "Returns", "a", "<a", "href", "=", "http", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Hex_dump", ">", "hex", "dump<", "/", "a", ">", "of", "the", "specified", "buffer", "s", "sub", "-", "region", "." ]
train
https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/PrintBufferUtil.java#L72-L75
FXMisc/RichTextFX
richtextfx/src/main/java/org/fxmisc/richtext/ParagraphBox.java
ParagraphBox.hitTextLine
CharacterHit hitTextLine(CaretOffsetX x, int line) { """ Hits the embedded TextFlow at the given line and x offset. @param x x coordinate relative to the embedded TextFlow. @param line index of the line in the embedded TextFlow. @return hit info for the given line and x coordinate """ return text.hitLine(x.value, line); }
java
CharacterHit hitTextLine(CaretOffsetX x, int line) { return text.hitLine(x.value, line); }
[ "CharacterHit", "hitTextLine", "(", "CaretOffsetX", "x", ",", "int", "line", ")", "{", "return", "text", ".", "hitLine", "(", "x", ".", "value", ",", "line", ")", ";", "}" ]
Hits the embedded TextFlow at the given line and x offset. @param x x coordinate relative to the embedded TextFlow. @param line index of the line in the embedded TextFlow. @return hit info for the given line and x coordinate
[ "Hits", "the", "embedded", "TextFlow", "at", "the", "given", "line", "and", "x", "offset", "." ]
train
https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/ParagraphBox.java#L263-L265
jamesagnew/hapi-fhir
hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/utils/ProfileUtilities.java
ProfileUtilities.getChildList
public static List<ElementDefinition> getChildList(StructureDefinition profile, String path) { """ Given a Structure, navigate to the element given by the path and return the direct children of that element @param path The path of the element within the structure to get the children for @return A List containing the element children (all of them are Elements) """ List<ElementDefinition> res = new ArrayList<ElementDefinition>(); for (ElementDefinition e : profile.getSnapshot().getElement()) { String p = e.getPath(); if (!Utilities.noString(e.getContentReference()) && path.startsWith(p)) { if (path.length() > p.length()) return getChildList(profile, e.getContentReference()+"."+path.substring(p.length()+1)); else return getChildList(profile, e.getContentReference()); } else if (p.startsWith(path+".") && !p.equals(path)) { String tail = p.substring(path.length()+1); if (!tail.contains(".")) { res.add(e); } } } return res; }
java
public static List<ElementDefinition> getChildList(StructureDefinition profile, String path) { List<ElementDefinition> res = new ArrayList<ElementDefinition>(); for (ElementDefinition e : profile.getSnapshot().getElement()) { String p = e.getPath(); if (!Utilities.noString(e.getContentReference()) && path.startsWith(p)) { if (path.length() > p.length()) return getChildList(profile, e.getContentReference()+"."+path.substring(p.length()+1)); else return getChildList(profile, e.getContentReference()); } else if (p.startsWith(path+".") && !p.equals(path)) { String tail = p.substring(path.length()+1); if (!tail.contains(".")) { res.add(e); } } } return res; }
[ "public", "static", "List", "<", "ElementDefinition", ">", "getChildList", "(", "StructureDefinition", "profile", ",", "String", "path", ")", "{", "List", "<", "ElementDefinition", ">", "res", "=", "new", "ArrayList", "<", "ElementDefinition", ">", "(", ")", ";", "for", "(", "ElementDefinition", "e", ":", "profile", ".", "getSnapshot", "(", ")", ".", "getElement", "(", ")", ")", "{", "String", "p", "=", "e", ".", "getPath", "(", ")", ";", "if", "(", "!", "Utilities", ".", "noString", "(", "e", ".", "getContentReference", "(", ")", ")", "&&", "path", ".", "startsWith", "(", "p", ")", ")", "{", "if", "(", "path", ".", "length", "(", ")", ">", "p", ".", "length", "(", ")", ")", "return", "getChildList", "(", "profile", ",", "e", ".", "getContentReference", "(", ")", "+", "\".\"", "+", "path", ".", "substring", "(", "p", ".", "length", "(", ")", "+", "1", ")", ")", ";", "else", "return", "getChildList", "(", "profile", ",", "e", ".", "getContentReference", "(", ")", ")", ";", "}", "else", "if", "(", "p", ".", "startsWith", "(", "path", "+", "\".\"", ")", "&&", "!", "p", ".", "equals", "(", "path", ")", ")", "{", "String", "tail", "=", "p", ".", "substring", "(", "path", ".", "length", "(", ")", "+", "1", ")", ";", "if", "(", "!", "tail", ".", "contains", "(", "\".\"", ")", ")", "{", "res", ".", "add", "(", "e", ")", ";", "}", "}", "}", "return", "res", ";", "}" ]
Given a Structure, navigate to the element given by the path and return the direct children of that element @param path The path of the element within the structure to get the children for @return A List containing the element children (all of them are Elements)
[ "Given", "a", "Structure", "navigate", "to", "the", "element", "given", "by", "the", "path", "and", "return", "the", "direct", "children", "of", "that", "element" ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/utils/ProfileUtilities.java#L1547-L1572
TimotheeJeannin/ProviGen
ProviGenLib/src/com/tjeannin/provigen/helper/TableUpdater.java
TableUpdater.addMissingColumns
public static void addMissingColumns(SQLiteDatabase database, Class contractClass) { """ Adds missing table columns for the given contract class. @param database The database in which the updated table is. @param contractClass The contract class to work with. """ Contract contract = new Contract(contractClass); Cursor cursor = database.rawQuery("PRAGMA table_info(" + contract.getTable() + ")", null); for (ContractField field : contract.getFields()) { if (!fieldExistAsColumn(field.name, cursor)) { database.execSQL("ALTER TABLE " + contract.getTable() + " ADD COLUMN " + field.name + " " + field.type + ";"); } } }
java
public static void addMissingColumns(SQLiteDatabase database, Class contractClass) { Contract contract = new Contract(contractClass); Cursor cursor = database.rawQuery("PRAGMA table_info(" + contract.getTable() + ")", null); for (ContractField field : contract.getFields()) { if (!fieldExistAsColumn(field.name, cursor)) { database.execSQL("ALTER TABLE " + contract.getTable() + " ADD COLUMN " + field.name + " " + field.type + ";"); } } }
[ "public", "static", "void", "addMissingColumns", "(", "SQLiteDatabase", "database", ",", "Class", "contractClass", ")", "{", "Contract", "contract", "=", "new", "Contract", "(", "contractClass", ")", ";", "Cursor", "cursor", "=", "database", ".", "rawQuery", "(", "\"PRAGMA table_info(\"", "+", "contract", ".", "getTable", "(", ")", "+", "\")\"", ",", "null", ")", ";", "for", "(", "ContractField", "field", ":", "contract", ".", "getFields", "(", ")", ")", "{", "if", "(", "!", "fieldExistAsColumn", "(", "field", ".", "name", ",", "cursor", ")", ")", "{", "database", ".", "execSQL", "(", "\"ALTER TABLE \"", "+", "contract", ".", "getTable", "(", ")", "+", "\" ADD COLUMN \"", "+", "field", ".", "name", "+", "\" \"", "+", "field", ".", "type", "+", "\";\"", ")", ";", "}", "}", "}" ]
Adds missing table columns for the given contract class. @param database The database in which the updated table is. @param contractClass The contract class to work with.
[ "Adds", "missing", "table", "columns", "for", "the", "given", "contract", "class", "." ]
train
https://github.com/TimotheeJeannin/ProviGen/blob/80c8a2021434a44e8d38c69407e3e6abf70cf21e/ProviGenLib/src/com/tjeannin/provigen/helper/TableUpdater.java#L19-L29
structr/structr
structr-core/src/main/java/org/structr/core/entity/AbstractNode.java
AbstractNode.hasRelationship
public final <A extends NodeInterface, B extends NodeInterface, S extends Source, T extends Target> boolean hasRelationship(final Class<? extends Relation<A, B, S, T>> type) { """ Return true if this node has a relationship of given type and direction. @param <A> @param <B> @param <S> @param <T> @param type @return relationships """ return this.getRelationships(type).iterator().hasNext(); }
java
public final <A extends NodeInterface, B extends NodeInterface, S extends Source, T extends Target> boolean hasRelationship(final Class<? extends Relation<A, B, S, T>> type) { return this.getRelationships(type).iterator().hasNext(); }
[ "public", "final", "<", "A", "extends", "NodeInterface", ",", "B", "extends", "NodeInterface", ",", "S", "extends", "Source", ",", "T", "extends", "Target", ">", "boolean", "hasRelationship", "(", "final", "Class", "<", "?", "extends", "Relation", "<", "A", ",", "B", ",", "S", ",", "T", ">", ">", "type", ")", "{", "return", "this", ".", "getRelationships", "(", "type", ")", ".", "iterator", "(", ")", ".", "hasNext", "(", ")", ";", "}" ]
Return true if this node has a relationship of given type and direction. @param <A> @param <B> @param <S> @param <T> @param type @return relationships
[ "Return", "true", "if", "this", "node", "has", "a", "relationship", "of", "given", "type", "and", "direction", "." ]
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/core/entity/AbstractNode.java#L745-L747
carewebframework/carewebframework-core
org.carewebframework.plugin-parent/org.carewebframework.plugin.chat/src/main/java/org/carewebframework/plugin/chat/SessionService.java
SessionService.sendMessage
public ChatMessage sendMessage(String text) { """ Sends a message to a chat session. @param text The message text. @return The message that was sent (may be null if no text). """ if (text != null && !text.isEmpty()) { ChatMessage message = new ChatMessage(self, text); eventManager.fireRemoteEvent(sendEvent, message); return message; } return null; }
java
public ChatMessage sendMessage(String text) { if (text != null && !text.isEmpty()) { ChatMessage message = new ChatMessage(self, text); eventManager.fireRemoteEvent(sendEvent, message); return message; } return null; }
[ "public", "ChatMessage", "sendMessage", "(", "String", "text", ")", "{", "if", "(", "text", "!=", "null", "&&", "!", "text", ".", "isEmpty", "(", ")", ")", "{", "ChatMessage", "message", "=", "new", "ChatMessage", "(", "self", ",", "text", ")", ";", "eventManager", ".", "fireRemoteEvent", "(", "sendEvent", ",", "message", ")", ";", "return", "message", ";", "}", "return", "null", ";", "}" ]
Sends a message to a chat session. @param text The message text. @return The message that was sent (may be null if no text).
[ "Sends", "a", "message", "to", "a", "chat", "session", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.chat/src/main/java/org/carewebframework/plugin/chat/SessionService.java#L107-L115
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmetryAxes.java
SymmetryAxes.getSymmetryAxes
private void getSymmetryAxes(List<Axis> symmAxes, Matrix4d prior, int level, int firstRepeat) { """ Recursive helper @param symmAxes output list @param prior transformation aligning the first repeat of this axis with the first overall @param level current level """ if(level >= getNumLevels() ) { return; } Axis elem = axes.get(level); Matrix4d elemOp = elem.getOperator(); // Current axis: // elementary maps B -> A // prior maps I -> A and J -> B // want J -> I = J -> B -> A <- I= inv(prior) * elementary * prior Matrix4d currAxisOp = new Matrix4d(prior); currAxisOp.invert(); currAxisOp.mul(elemOp); currAxisOp.mul(prior); Axis currAxis = new Axis(currAxisOp,elem.getOrder(),elem.getSymmType(),level,firstRepeat); symmAxes.add(currAxis); //Remember that all degrees are at least 2 getSymmetryAxes(symmAxes,prior,level+1,firstRepeat); //New prior is elementary^d*prior Matrix4d newPrior = new Matrix4d(elemOp); newPrior.mul(prior); int childSize = getNumRepeats(level+1); getSymmetryAxes(symmAxes,newPrior,level+1,firstRepeat+childSize); for(int d=2;d<elem.getOrder();d++) { newPrior.mul(elemOp,newPrior); getSymmetryAxes(symmAxes,newPrior,level+1,firstRepeat+childSize*d); } }
java
private void getSymmetryAxes(List<Axis> symmAxes, Matrix4d prior, int level, int firstRepeat) { if(level >= getNumLevels() ) { return; } Axis elem = axes.get(level); Matrix4d elemOp = elem.getOperator(); // Current axis: // elementary maps B -> A // prior maps I -> A and J -> B // want J -> I = J -> B -> A <- I= inv(prior) * elementary * prior Matrix4d currAxisOp = new Matrix4d(prior); currAxisOp.invert(); currAxisOp.mul(elemOp); currAxisOp.mul(prior); Axis currAxis = new Axis(currAxisOp,elem.getOrder(),elem.getSymmType(),level,firstRepeat); symmAxes.add(currAxis); //Remember that all degrees are at least 2 getSymmetryAxes(symmAxes,prior,level+1,firstRepeat); //New prior is elementary^d*prior Matrix4d newPrior = new Matrix4d(elemOp); newPrior.mul(prior); int childSize = getNumRepeats(level+1); getSymmetryAxes(symmAxes,newPrior,level+1,firstRepeat+childSize); for(int d=2;d<elem.getOrder();d++) { newPrior.mul(elemOp,newPrior); getSymmetryAxes(symmAxes,newPrior,level+1,firstRepeat+childSize*d); } }
[ "private", "void", "getSymmetryAxes", "(", "List", "<", "Axis", ">", "symmAxes", ",", "Matrix4d", "prior", ",", "int", "level", ",", "int", "firstRepeat", ")", "{", "if", "(", "level", ">=", "getNumLevels", "(", ")", ")", "{", "return", ";", "}", "Axis", "elem", "=", "axes", ".", "get", "(", "level", ")", ";", "Matrix4d", "elemOp", "=", "elem", ".", "getOperator", "(", ")", ";", "// Current axis:", "// elementary maps B -> A", "// prior maps I -> A and J -> B", "// want J -> I = J -> B -> A <- I= inv(prior) * elementary * prior", "Matrix4d", "currAxisOp", "=", "new", "Matrix4d", "(", "prior", ")", ";", "currAxisOp", ".", "invert", "(", ")", ";", "currAxisOp", ".", "mul", "(", "elemOp", ")", ";", "currAxisOp", ".", "mul", "(", "prior", ")", ";", "Axis", "currAxis", "=", "new", "Axis", "(", "currAxisOp", ",", "elem", ".", "getOrder", "(", ")", ",", "elem", ".", "getSymmType", "(", ")", ",", "level", ",", "firstRepeat", ")", ";", "symmAxes", ".", "add", "(", "currAxis", ")", ";", "//Remember that all degrees are at least 2", "getSymmetryAxes", "(", "symmAxes", ",", "prior", ",", "level", "+", "1", ",", "firstRepeat", ")", ";", "//New prior is elementary^d*prior", "Matrix4d", "newPrior", "=", "new", "Matrix4d", "(", "elemOp", ")", ";", "newPrior", ".", "mul", "(", "prior", ")", ";", "int", "childSize", "=", "getNumRepeats", "(", "level", "+", "1", ")", ";", "getSymmetryAxes", "(", "symmAxes", ",", "newPrior", ",", "level", "+", "1", ",", "firstRepeat", "+", "childSize", ")", ";", "for", "(", "int", "d", "=", "2", ";", "d", "<", "elem", ".", "getOrder", "(", ")", ";", "d", "++", ")", "{", "newPrior", ".", "mul", "(", "elemOp", ",", "newPrior", ")", ";", "getSymmetryAxes", "(", "symmAxes", ",", "newPrior", ",", "level", "+", "1", ",", "firstRepeat", "+", "childSize", "*", "d", ")", ";", "}", "}" ]
Recursive helper @param symmAxes output list @param prior transformation aligning the first repeat of this axis with the first overall @param level current level
[ "Recursive", "helper" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmetryAxes.java#L469-L499
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/stats/Counters.java
Counters.klDivergence
public static <E> double klDivergence(Counter<E> from, Counter<E> to) { """ Calculates the KL divergence between the two counters. That is, it calculates KL(from || to). This method internally uses normalized counts (so they sum to one), but the value returned is meaningless if any of the counts are negative. In other words, how well can c1 be represented by c2. if there is some value in c1 that gets zero prob in c2, then return positive infinity. @return The KL divergence between the distributions """ double result = 0.0; double tot = (from.totalCount()); double tot2 = (to.totalCount()); // System.out.println("tot is " + tot + " tot2 is " + tot2); for (E key : from.keySet()) { double num = (from.getCount(key)); if (num == 0) { continue; } num /= tot; double num2 = (to.getCount(key)); num2 /= tot2; // System.out.println("num is " + num + " num2 is " + num2); double logFract = Math.log(num / num2); if (logFract == Double.NEGATIVE_INFINITY) { return Double.NEGATIVE_INFINITY; // can't recover } result += num * (logFract / LOG_E_2); // express it in log base 2 } return result; }
java
public static <E> double klDivergence(Counter<E> from, Counter<E> to) { double result = 0.0; double tot = (from.totalCount()); double tot2 = (to.totalCount()); // System.out.println("tot is " + tot + " tot2 is " + tot2); for (E key : from.keySet()) { double num = (from.getCount(key)); if (num == 0) { continue; } num /= tot; double num2 = (to.getCount(key)); num2 /= tot2; // System.out.println("num is " + num + " num2 is " + num2); double logFract = Math.log(num / num2); if (logFract == Double.NEGATIVE_INFINITY) { return Double.NEGATIVE_INFINITY; // can't recover } result += num * (logFract / LOG_E_2); // express it in log base 2 } return result; }
[ "public", "static", "<", "E", ">", "double", "klDivergence", "(", "Counter", "<", "E", ">", "from", ",", "Counter", "<", "E", ">", "to", ")", "{", "double", "result", "=", "0.0", ";", "double", "tot", "=", "(", "from", ".", "totalCount", "(", ")", ")", ";", "double", "tot2", "=", "(", "to", ".", "totalCount", "(", ")", ")", ";", "// System.out.println(\"tot is \" + tot + \" tot2 is \" + tot2);\r", "for", "(", "E", "key", ":", "from", ".", "keySet", "(", ")", ")", "{", "double", "num", "=", "(", "from", ".", "getCount", "(", "key", ")", ")", ";", "if", "(", "num", "==", "0", ")", "{", "continue", ";", "}", "num", "/=", "tot", ";", "double", "num2", "=", "(", "to", ".", "getCount", "(", "key", ")", ")", ";", "num2", "/=", "tot2", ";", "// System.out.println(\"num is \" + num + \" num2 is \" + num2);\r", "double", "logFract", "=", "Math", ".", "log", "(", "num", "/", "num2", ")", ";", "if", "(", "logFract", "==", "Double", ".", "NEGATIVE_INFINITY", ")", "{", "return", "Double", ".", "NEGATIVE_INFINITY", ";", "// can't recover\r", "}", "result", "+=", "num", "*", "(", "logFract", "/", "LOG_E_2", ")", ";", "// express it in log base 2\r", "}", "return", "result", ";", "}" ]
Calculates the KL divergence between the two counters. That is, it calculates KL(from || to). This method internally uses normalized counts (so they sum to one), but the value returned is meaningless if any of the counts are negative. In other words, how well can c1 be represented by c2. if there is some value in c1 that gets zero prob in c2, then return positive infinity. @return The KL divergence between the distributions
[ "Calculates", "the", "KL", "divergence", "between", "the", "two", "counters", ".", "That", "is", "it", "calculates", "KL", "(", "from", "||", "to", ")", ".", "This", "method", "internally", "uses", "normalized", "counts", "(", "so", "they", "sum", "to", "one", ")", "but", "the", "value", "returned", "is", "meaningless", "if", "any", "of", "the", "counts", "are", "negative", ".", "In", "other", "words", "how", "well", "can", "c1", "be", "represented", "by", "c2", ".", "if", "there", "is", "some", "value", "in", "c1", "that", "gets", "zero", "prob", "in", "c2", "then", "return", "positive", "infinity", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/Counters.java#L1205-L1226
OpenLiberty/open-liberty
dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/IfixParser.java
IfixParser.getProvides
private List<String> getProvides(IFixInfo iFixInfo, ParserBase.ExtractedFileInformation xmlInfo) throws RepositoryArchiveInvalidEntryException { """ Get a list of the APARs fixed by this iFix @param iFixInfo @return The list of fixed APARs @throws MassiveInvalidXmlException """ // check for null input if (null == iFixInfo) { throw new RepositoryArchiveInvalidEntryException("Null document provided", xmlInfo.getSourceArchive(), xmlInfo.getSelectedPathFromArchive()); } Resolves resolves = iFixInfo.getResolves(); if (null == resolves) { throw new RepositoryArchiveInvalidEntryException("Document does not contain a \"resolves\" node", xmlInfo.getSourceArchive(), xmlInfo.getSelectedPathFromArchive()); } // Get child nodes and look for APAR ids List<String> retList = new ArrayList<String>(); List<Problem> problems = resolves.getProblems(); if (problems != null) { for (Problem problem : problems) { String displayId = problem.getDisplayId(); if (null == displayId) { throw new RepositoryArchiveInvalidEntryException("Unexpected null getting APAR id", xmlInfo.getSourceArchive(), xmlInfo.getSelectedPathFromArchive()); } retList.add(displayId); } } return retList; }
java
private List<String> getProvides(IFixInfo iFixInfo, ParserBase.ExtractedFileInformation xmlInfo) throws RepositoryArchiveInvalidEntryException { // check for null input if (null == iFixInfo) { throw new RepositoryArchiveInvalidEntryException("Null document provided", xmlInfo.getSourceArchive(), xmlInfo.getSelectedPathFromArchive()); } Resolves resolves = iFixInfo.getResolves(); if (null == resolves) { throw new RepositoryArchiveInvalidEntryException("Document does not contain a \"resolves\" node", xmlInfo.getSourceArchive(), xmlInfo.getSelectedPathFromArchive()); } // Get child nodes and look for APAR ids List<String> retList = new ArrayList<String>(); List<Problem> problems = resolves.getProblems(); if (problems != null) { for (Problem problem : problems) { String displayId = problem.getDisplayId(); if (null == displayId) { throw new RepositoryArchiveInvalidEntryException("Unexpected null getting APAR id", xmlInfo.getSourceArchive(), xmlInfo.getSelectedPathFromArchive()); } retList.add(displayId); } } return retList; }
[ "private", "List", "<", "String", ">", "getProvides", "(", "IFixInfo", "iFixInfo", ",", "ParserBase", ".", "ExtractedFileInformation", "xmlInfo", ")", "throws", "RepositoryArchiveInvalidEntryException", "{", "// check for null input", "if", "(", "null", "==", "iFixInfo", ")", "{", "throw", "new", "RepositoryArchiveInvalidEntryException", "(", "\"Null document provided\"", ",", "xmlInfo", ".", "getSourceArchive", "(", ")", ",", "xmlInfo", ".", "getSelectedPathFromArchive", "(", ")", ")", ";", "}", "Resolves", "resolves", "=", "iFixInfo", ".", "getResolves", "(", ")", ";", "if", "(", "null", "==", "resolves", ")", "{", "throw", "new", "RepositoryArchiveInvalidEntryException", "(", "\"Document does not contain a \\\"resolves\\\" node\"", ",", "xmlInfo", ".", "getSourceArchive", "(", ")", ",", "xmlInfo", ".", "getSelectedPathFromArchive", "(", ")", ")", ";", "}", "// Get child nodes and look for APAR ids", "List", "<", "String", ">", "retList", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "List", "<", "Problem", ">", "problems", "=", "resolves", ".", "getProblems", "(", ")", ";", "if", "(", "problems", "!=", "null", ")", "{", "for", "(", "Problem", "problem", ":", "problems", ")", "{", "String", "displayId", "=", "problem", ".", "getDisplayId", "(", ")", ";", "if", "(", "null", "==", "displayId", ")", "{", "throw", "new", "RepositoryArchiveInvalidEntryException", "(", "\"Unexpected null getting APAR id\"", ",", "xmlInfo", ".", "getSourceArchive", "(", ")", ",", "xmlInfo", ".", "getSelectedPathFromArchive", "(", ")", ")", ";", "}", "retList", ".", "add", "(", "displayId", ")", ";", "}", "}", "return", "retList", ";", "}" ]
Get a list of the APARs fixed by this iFix @param iFixInfo @return The list of fixed APARs @throws MassiveInvalidXmlException
[ "Get", "a", "list", "of", "the", "APARs", "fixed", "by", "this", "iFix" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/IfixParser.java#L161-L187
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/MathUtils.java
MathUtils.differenceBetweenAngles
public static double differenceBetweenAngles(double alpha, double beta) { """ Returns the smallest angle between two angles. @param alpha First angle in degrees @param beta Second angle in degrees @return Smallest angle between two angles. """ double phi = Math.abs(beta - alpha) % 360; return phi > 180 ? 360 - phi : phi; }
java
public static double differenceBetweenAngles(double alpha, double beta) { double phi = Math.abs(beta - alpha) % 360; return phi > 180 ? 360 - phi : phi; }
[ "public", "static", "double", "differenceBetweenAngles", "(", "double", "alpha", ",", "double", "beta", ")", "{", "double", "phi", "=", "Math", ".", "abs", "(", "beta", "-", "alpha", ")", "%", "360", ";", "return", "phi", ">", "180", "?", "360", "-", "phi", ":", "phi", ";", "}" ]
Returns the smallest angle between two angles. @param alpha First angle in degrees @param beta Second angle in degrees @return Smallest angle between two angles.
[ "Returns", "the", "smallest", "angle", "between", "two", "angles", "." ]
train
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/MathUtils.java#L76-L79
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/accumulators/AccumulatorRegistry.java
AccumulatorRegistry.getSnapshot
public AccumulatorSnapshot getSnapshot() { """ Creates a snapshot of this accumulator registry. @return a serialized accumulator map """ try { return new AccumulatorSnapshot(jobID, taskID, userAccumulators); } catch (Throwable e) { LOG.warn("Failed to serialize accumulators for task.", e); return null; } }
java
public AccumulatorSnapshot getSnapshot() { try { return new AccumulatorSnapshot(jobID, taskID, userAccumulators); } catch (Throwable e) { LOG.warn("Failed to serialize accumulators for task.", e); return null; } }
[ "public", "AccumulatorSnapshot", "getSnapshot", "(", ")", "{", "try", "{", "return", "new", "AccumulatorSnapshot", "(", "jobID", ",", "taskID", ",", "userAccumulators", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "LOG", ".", "warn", "(", "\"Failed to serialize accumulators for task.\"", ",", "e", ")", ";", "return", "null", ";", "}", "}" ]
Creates a snapshot of this accumulator registry. @return a serialized accumulator map
[ "Creates", "a", "snapshot", "of", "this", "accumulator", "registry", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/accumulators/AccumulatorRegistry.java#L55-L62
ahome-it/lienzo-core
src/main/java/com/ait/lienzo/client/core/shape/Viewport.java
Viewport.viewLocalArea
public final void viewLocalArea(final double x, final double y, final double width, final double height) { """ Change the viewport's transform so that the specified area (in local or world coordinates) is visible. @param x @param y @param width @param height """ final Transform t = Transform.createViewportTransform(x, y, width, height, m_wide, m_high); if (t != null) { setTransform(t); } }
java
public final void viewLocalArea(final double x, final double y, final double width, final double height) { final Transform t = Transform.createViewportTransform(x, y, width, height, m_wide, m_high); if (t != null) { setTransform(t); } }
[ "public", "final", "void", "viewLocalArea", "(", "final", "double", "x", ",", "final", "double", "y", ",", "final", "double", "width", ",", "final", "double", "height", ")", "{", "final", "Transform", "t", "=", "Transform", ".", "createViewportTransform", "(", "x", ",", "y", ",", "width", ",", "height", ",", "m_wide", ",", "m_high", ")", ";", "if", "(", "t", "!=", "null", ")", "{", "setTransform", "(", "t", ")", ";", "}", "}" ]
Change the viewport's transform so that the specified area (in local or world coordinates) is visible. @param x @param y @param width @param height
[ "Change", "the", "viewport", "s", "transform", "so", "that", "the", "specified", "area", "(", "in", "local", "or", "world", "coordinates", ")", "is", "visible", "." ]
train
https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/shape/Viewport.java#L546-L554
googleapis/google-cloud-java
google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java
GrafeasV1Beta1Client.listOccurrences
public final ListOccurrencesPagedResponse listOccurrences(String parent, String filter) { """ Lists occurrences for the specified project. <p>Sample code: <pre><code> try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) { ProjectName parent = ProjectName.of("[PROJECT]"); String filter = ""; for (Occurrence element : grafeasV1Beta1Client.listOccurrences(parent.toString(), filter).iterateAll()) { // doThingsWith(element); } } </code></pre> @param parent The name of the project to list occurrences for in the form of `projects/[PROJECT_ID]`. @param filter The filter expression. @throws com.google.api.gax.rpc.ApiException if the remote call fails """ ListOccurrencesRequest request = ListOccurrencesRequest.newBuilder().setParent(parent).setFilter(filter).build(); return listOccurrences(request); }
java
public final ListOccurrencesPagedResponse listOccurrences(String parent, String filter) { ListOccurrencesRequest request = ListOccurrencesRequest.newBuilder().setParent(parent).setFilter(filter).build(); return listOccurrences(request); }
[ "public", "final", "ListOccurrencesPagedResponse", "listOccurrences", "(", "String", "parent", ",", "String", "filter", ")", "{", "ListOccurrencesRequest", "request", "=", "ListOccurrencesRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "parent", ")", ".", "setFilter", "(", "filter", ")", ".", "build", "(", ")", ";", "return", "listOccurrences", "(", "request", ")", ";", "}" ]
Lists occurrences for the specified project. <p>Sample code: <pre><code> try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) { ProjectName parent = ProjectName.of("[PROJECT]"); String filter = ""; for (Occurrence element : grafeasV1Beta1Client.listOccurrences(parent.toString(), filter).iterateAll()) { // doThingsWith(element); } } </code></pre> @param parent The name of the project to list occurrences for in the form of `projects/[PROJECT_ID]`. @param filter The filter expression. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Lists", "occurrences", "for", "the", "specified", "project", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java#L339-L343
jcuda/jcuda
JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java
JCudaDriver.cuModuleGetFunction
public static int cuModuleGetFunction(CUfunction hfunc, CUmodule hmod, String name) { """ Returns a function handle. <pre> CUresult cuModuleGetFunction ( CUfunction* hfunc, CUmodule hmod, const char* name ) </pre> <div> <p>Returns a function handle. Returns in <tt>*hfunc</tt> the handle of the function of name <tt>name</tt> located in module <tt>hmod</tt>. If no function of that name exists, cuModuleGetFunction() returns CUDA_ERROR_NOT_FOUND. </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param hfunc Returned function handle @param hmod Module to retrieve function from @param name Name of function to retrieve @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE, CUDA_ERROR_NOT_FOUND @see JCudaDriver#cuModuleGetGlobal @see JCudaDriver#cuModuleGetTexRef @see JCudaDriver#cuModuleLoad @see JCudaDriver#cuModuleLoadData @see JCudaDriver#cuModuleLoadDataEx @see JCudaDriver#cuModuleLoadFatBinary @see JCudaDriver#cuModuleUnload """ return checkResult(cuModuleGetFunctionNative(hfunc, hmod, name)); }
java
public static int cuModuleGetFunction(CUfunction hfunc, CUmodule hmod, String name) { return checkResult(cuModuleGetFunctionNative(hfunc, hmod, name)); }
[ "public", "static", "int", "cuModuleGetFunction", "(", "CUfunction", "hfunc", ",", "CUmodule", "hmod", ",", "String", "name", ")", "{", "return", "checkResult", "(", "cuModuleGetFunctionNative", "(", "hfunc", ",", "hmod", ",", "name", ")", ")", ";", "}" ]
Returns a function handle. <pre> CUresult cuModuleGetFunction ( CUfunction* hfunc, CUmodule hmod, const char* name ) </pre> <div> <p>Returns a function handle. Returns in <tt>*hfunc</tt> the handle of the function of name <tt>name</tt> located in module <tt>hmod</tt>. If no function of that name exists, cuModuleGetFunction() returns CUDA_ERROR_NOT_FOUND. </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param hfunc Returned function handle @param hmod Module to retrieve function from @param name Name of function to retrieve @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE, CUDA_ERROR_NOT_FOUND @see JCudaDriver#cuModuleGetGlobal @see JCudaDriver#cuModuleGetTexRef @see JCudaDriver#cuModuleLoad @see JCudaDriver#cuModuleLoadData @see JCudaDriver#cuModuleLoadDataEx @see JCudaDriver#cuModuleLoadFatBinary @see JCudaDriver#cuModuleUnload
[ "Returns", "a", "function", "handle", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L2585-L2588
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.copyRelations
private void copyRelations(CmsDbContext dbc, CmsResource source, CmsResource target) throws CmsException { """ Copies all relations from the source resource to the target resource.<p> @param dbc the database context @param source the source @param target the target @throws CmsException if something goes wrong """ // copy relations all relations CmsObject cms = new CmsObject(getSecurityManager(), dbc.getRequestContext()); Iterator<CmsRelation> itRelations = getRelationsForResource( dbc, source, CmsRelationFilter.TARGETS.filterNotDefinedInContent()).iterator(); while (itRelations.hasNext()) { CmsRelation relation = itRelations.next(); if (relation.getType().getCopyBehavior() == CopyBehavior.copy) { try { CmsResource relTarget = relation.getTarget(cms, CmsResourceFilter.ALL); addRelationToResource(dbc, target, relTarget, relation.getType(), true); } catch (CmsVfsResourceNotFoundException e) { // ignore this broken relation if (LOG.isWarnEnabled()) { LOG.warn(e.getLocalizedMessage(), e); } } } } // repair categories repairCategories(dbc, getProjectIdForContext(dbc), target); }
java
private void copyRelations(CmsDbContext dbc, CmsResource source, CmsResource target) throws CmsException { // copy relations all relations CmsObject cms = new CmsObject(getSecurityManager(), dbc.getRequestContext()); Iterator<CmsRelation> itRelations = getRelationsForResource( dbc, source, CmsRelationFilter.TARGETS.filterNotDefinedInContent()).iterator(); while (itRelations.hasNext()) { CmsRelation relation = itRelations.next(); if (relation.getType().getCopyBehavior() == CopyBehavior.copy) { try { CmsResource relTarget = relation.getTarget(cms, CmsResourceFilter.ALL); addRelationToResource(dbc, target, relTarget, relation.getType(), true); } catch (CmsVfsResourceNotFoundException e) { // ignore this broken relation if (LOG.isWarnEnabled()) { LOG.warn(e.getLocalizedMessage(), e); } } } } // repair categories repairCategories(dbc, getProjectIdForContext(dbc), target); }
[ "private", "void", "copyRelations", "(", "CmsDbContext", "dbc", ",", "CmsResource", "source", ",", "CmsResource", "target", ")", "throws", "CmsException", "{", "// copy relations all relations", "CmsObject", "cms", "=", "new", "CmsObject", "(", "getSecurityManager", "(", ")", ",", "dbc", ".", "getRequestContext", "(", ")", ")", ";", "Iterator", "<", "CmsRelation", ">", "itRelations", "=", "getRelationsForResource", "(", "dbc", ",", "source", ",", "CmsRelationFilter", ".", "TARGETS", ".", "filterNotDefinedInContent", "(", ")", ")", ".", "iterator", "(", ")", ";", "while", "(", "itRelations", ".", "hasNext", "(", ")", ")", "{", "CmsRelation", "relation", "=", "itRelations", ".", "next", "(", ")", ";", "if", "(", "relation", ".", "getType", "(", ")", ".", "getCopyBehavior", "(", ")", "==", "CopyBehavior", ".", "copy", ")", "{", "try", "{", "CmsResource", "relTarget", "=", "relation", ".", "getTarget", "(", "cms", ",", "CmsResourceFilter", ".", "ALL", ")", ";", "addRelationToResource", "(", "dbc", ",", "target", ",", "relTarget", ",", "relation", ".", "getType", "(", ")", ",", "true", ")", ";", "}", "catch", "(", "CmsVfsResourceNotFoundException", "e", ")", "{", "// ignore this broken relation", "if", "(", "LOG", ".", "isWarnEnabled", "(", ")", ")", "{", "LOG", ".", "warn", "(", "e", ".", "getLocalizedMessage", "(", ")", ",", "e", ")", ";", "}", "}", "}", "}", "// repair categories", "repairCategories", "(", "dbc", ",", "getProjectIdForContext", "(", "dbc", ")", ",", "target", ")", ";", "}" ]
Copies all relations from the source resource to the target resource.<p> @param dbc the database context @param source the source @param target the target @throws CmsException if something goes wrong
[ "Copies", "all", "relations", "from", "the", "source", "resource", "to", "the", "target", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L10855-L10879
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeysInner.java
ServerKeysInner.createOrUpdateAsync
public ServiceFuture<ServerKeyInner> createOrUpdateAsync(String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters, final ServiceCallback<ServerKeyInner> serviceCallback) { """ Creates or updates a server key. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param keyName The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901 @param parameters The requested server key resource state. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object """ return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, keyName, parameters), serviceCallback); }
java
public ServiceFuture<ServerKeyInner> createOrUpdateAsync(String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters, final ServiceCallback<ServerKeyInner> serviceCallback) { return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, keyName, parameters), serviceCallback); }
[ "public", "ServiceFuture", "<", "ServerKeyInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "keyName", ",", "ServerKeyInner", "parameters", ",", "final", "ServiceCallback", "<", "ServerKeyInner", ">", "serviceCallback", ")", "{", "return", "ServiceFuture", ".", "fromResponse", "(", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "keyName", ",", "parameters", ")", ",", "serviceCallback", ")", ";", "}" ]
Creates or updates a server key. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param keyName The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901 @param parameters The requested server key resource state. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Creates", "or", "updates", "a", "server", "key", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeysInner.java#L337-L339
whitesource/fs-agent
src/main/java/org/whitesource/scm/ScmConnector.java
ScmConnector.cloneRepository
public File cloneRepository() { """ Clones the given repository. @return The folder in which the specific branch/tag resides. """ String scmTempFolder = new FilesUtils().createTmpFolder(false, TempFolders.UNIQUE_SCM_TEMP_FOLDER); cloneDirectory = new File(scmTempFolder, getType().toString().toLowerCase() + Constants.UNDERSCORE + getUrlName() + Constants.UNDERSCORE + getBranch()); FilesUtils.deleteDirectory(cloneDirectory); // delete just in case it's not empty logger.info("Cloning repository {} ...this may take a few minutes", getUrl()); File branchDirectory = cloneRepository(cloneDirectory); return branchDirectory; }
java
public File cloneRepository() { String scmTempFolder = new FilesUtils().createTmpFolder(false, TempFolders.UNIQUE_SCM_TEMP_FOLDER); cloneDirectory = new File(scmTempFolder, getType().toString().toLowerCase() + Constants.UNDERSCORE + getUrlName() + Constants.UNDERSCORE + getBranch()); FilesUtils.deleteDirectory(cloneDirectory); // delete just in case it's not empty logger.info("Cloning repository {} ...this may take a few minutes", getUrl()); File branchDirectory = cloneRepository(cloneDirectory); return branchDirectory; }
[ "public", "File", "cloneRepository", "(", ")", "{", "String", "scmTempFolder", "=", "new", "FilesUtils", "(", ")", ".", "createTmpFolder", "(", "false", ",", "TempFolders", ".", "UNIQUE_SCM_TEMP_FOLDER", ")", ";", "cloneDirectory", "=", "new", "File", "(", "scmTempFolder", ",", "getType", "(", ")", ".", "toString", "(", ")", ".", "toLowerCase", "(", ")", "+", "Constants", ".", "UNDERSCORE", "+", "getUrlName", "(", ")", "+", "Constants", ".", "UNDERSCORE", "+", "getBranch", "(", ")", ")", ";", "FilesUtils", ".", "deleteDirectory", "(", "cloneDirectory", ")", ";", "// delete just in case it's not empty", "logger", ".", "info", "(", "\"Cloning repository {} ...this may take a few minutes\"", ",", "getUrl", "(", ")", ")", ";", "File", "branchDirectory", "=", "cloneRepository", "(", "cloneDirectory", ")", ";", "return", "branchDirectory", ";", "}" ]
Clones the given repository. @return The folder in which the specific branch/tag resides.
[ "Clones", "the", "given", "repository", "." ]
train
https://github.com/whitesource/fs-agent/blob/d6ee4842c4f08f4aeda7eb2307b24c49b6bed0e1/src/main/java/org/whitesource/scm/ScmConnector.java#L85-L94
amaembo/streamex
src/main/java/one/util/streamex/StreamEx.java
StreamEx.toMap
public <K, V> Map<K, V> toMap(Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valMapper) { """ Returns a {@link Map} whose keys and values are the result of applying the provided mapping functions to the input elements. <p> This is a <a href="package-summary.html#StreamOps">terminal</a> operation. <p> Returned {@code Map} is guaranteed to be modifiable. <p> For parallel stream the concurrent {@code Map} is created. @param <K> the output type of the key mapping function @param <V> the output type of the value mapping function @param keyMapper a mapping function to produce keys @param valMapper a mapping function to produce values @return a {@code Map} whose keys and values are the result of applying mapping functions to the input elements @throws IllegalStateException if duplicate mapped key is found (according to {@link Object#equals(Object)}) @see Collectors#toMap(Function, Function) @see Collectors#toConcurrentMap(Function, Function) @see #toMap(Function) """ Map<K, V> map = isParallel() ? new ConcurrentHashMap<>() : new HashMap<>(); return toMapThrowing(keyMapper, valMapper, map); }
java
public <K, V> Map<K, V> toMap(Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valMapper) { Map<K, V> map = isParallel() ? new ConcurrentHashMap<>() : new HashMap<>(); return toMapThrowing(keyMapper, valMapper, map); }
[ "public", "<", "K", ",", "V", ">", "Map", "<", "K", ",", "V", ">", "toMap", "(", "Function", "<", "?", "super", "T", ",", "?", "extends", "K", ">", "keyMapper", ",", "Function", "<", "?", "super", "T", ",", "?", "extends", "V", ">", "valMapper", ")", "{", "Map", "<", "K", ",", "V", ">", "map", "=", "isParallel", "(", ")", "?", "new", "ConcurrentHashMap", "<>", "(", ")", ":", "new", "HashMap", "<>", "(", ")", ";", "return", "toMapThrowing", "(", "keyMapper", ",", "valMapper", ",", "map", ")", ";", "}" ]
Returns a {@link Map} whose keys and values are the result of applying the provided mapping functions to the input elements. <p> This is a <a href="package-summary.html#StreamOps">terminal</a> operation. <p> Returned {@code Map} is guaranteed to be modifiable. <p> For parallel stream the concurrent {@code Map} is created. @param <K> the output type of the key mapping function @param <V> the output type of the value mapping function @param keyMapper a mapping function to produce keys @param valMapper a mapping function to produce values @return a {@code Map} whose keys and values are the result of applying mapping functions to the input elements @throws IllegalStateException if duplicate mapped key is found (according to {@link Object#equals(Object)}) @see Collectors#toMap(Function, Function) @see Collectors#toConcurrentMap(Function, Function) @see #toMap(Function)
[ "Returns", "a", "{", "@link", "Map", "}", "whose", "keys", "and", "values", "are", "the", "result", "of", "applying", "the", "provided", "mapping", "functions", "to", "the", "input", "elements", "." ]
train
https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L961-L964
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/PermissionsImpl.java
PermissionsImpl.deleteWithServiceResponseAsync
public Observable<ServiceResponse<OperationStatus>> deleteWithServiceResponseAsync(UUID appId, DeletePermissionsOptionalParameter deleteOptionalParameter) { """ Removes a user from the allowed list of users to access this LUIS application. Users are removed using their email address. @param appId The application ID. @param deleteOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object """ if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } final String email = deleteOptionalParameter != null ? deleteOptionalParameter.email() : null; return deleteWithServiceResponseAsync(appId, email); }
java
public Observable<ServiceResponse<OperationStatus>> deleteWithServiceResponseAsync(UUID appId, DeletePermissionsOptionalParameter deleteOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } final String email = deleteOptionalParameter != null ? deleteOptionalParameter.email() : null; return deleteWithServiceResponseAsync(appId, email); }
[ "public", "Observable", "<", "ServiceResponse", "<", "OperationStatus", ">", ">", "deleteWithServiceResponseAsync", "(", "UUID", "appId", ",", "DeletePermissionsOptionalParameter", "deleteOptionalParameter", ")", "{", "if", "(", "this", ".", "client", ".", "endpoint", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter this.client.endpoint() is required and cannot be null.\"", ")", ";", "}", "if", "(", "appId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter appId is required and cannot be null.\"", ")", ";", "}", "final", "String", "email", "=", "deleteOptionalParameter", "!=", "null", "?", "deleteOptionalParameter", ".", "email", "(", ")", ":", "null", ";", "return", "deleteWithServiceResponseAsync", "(", "appId", ",", "email", ")", ";", "}" ]
Removes a user from the allowed list of users to access this LUIS application. Users are removed using their email address. @param appId The application ID. @param deleteOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object
[ "Removes", "a", "user", "from", "the", "allowed", "list", "of", "users", "to", "access", "this", "LUIS", "application", ".", "Users", "are", "removed", "using", "their", "email", "address", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/PermissionsImpl.java#L370-L380
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/Jassimp.java
Jassimp.importFile
public static AiScene importFile(String filename) throws IOException { """ Imports a file via assimp without post processing. @param filename the file to import @return the loaded scene @throws IOException if an error occurs """ return importFile(filename, EnumSet.noneOf(AiPostProcessSteps.class)); }
java
public static AiScene importFile(String filename) throws IOException { return importFile(filename, EnumSet.noneOf(AiPostProcessSteps.class)); }
[ "public", "static", "AiScene", "importFile", "(", "String", "filename", ")", "throws", "IOException", "{", "return", "importFile", "(", "filename", ",", "EnumSet", ".", "noneOf", "(", "AiPostProcessSteps", ".", "class", ")", ")", ";", "}" ]
Imports a file via assimp without post processing. @param filename the file to import @return the loaded scene @throws IOException if an error occurs
[ "Imports", "a", "file", "via", "assimp", "without", "post", "processing", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/Jassimp.java#L77-L80
cdk/cdk
base/silent/src/main/java/org/openscience/cdk/silent/PDBPolymer.java
PDBPolymer.addAtom
@Override public void addAtom(IPDBAtom oAtom, IMonomer oMonomer, IStrand oStrand) { """ Adds the IPDBAtom oAtom to a specified Monomer of a specified Strand. Additionally, it keeps record of the iCode. @param oAtom The IPDBAtom to add @param oMonomer The monomer the atom belongs to """ super.addAtom(oAtom, oMonomer, oStrand); if (!sequentialListOfMonomers.contains(oMonomer.getMonomerName())) sequentialListOfMonomers.add(oMonomer.getMonomerName()); }
java
@Override public void addAtom(IPDBAtom oAtom, IMonomer oMonomer, IStrand oStrand) { super.addAtom(oAtom, oMonomer, oStrand); if (!sequentialListOfMonomers.contains(oMonomer.getMonomerName())) sequentialListOfMonomers.add(oMonomer.getMonomerName()); }
[ "@", "Override", "public", "void", "addAtom", "(", "IPDBAtom", "oAtom", ",", "IMonomer", "oMonomer", ",", "IStrand", "oStrand", ")", "{", "super", ".", "addAtom", "(", "oAtom", ",", "oMonomer", ",", "oStrand", ")", ";", "if", "(", "!", "sequentialListOfMonomers", ".", "contains", "(", "oMonomer", ".", "getMonomerName", "(", ")", ")", ")", "sequentialListOfMonomers", ".", "add", "(", "oMonomer", ".", "getMonomerName", "(", ")", ")", ";", "}" ]
Adds the IPDBAtom oAtom to a specified Monomer of a specified Strand. Additionally, it keeps record of the iCode. @param oAtom The IPDBAtom to add @param oMonomer The monomer the atom belongs to
[ "Adds", "the", "IPDBAtom", "oAtom", "to", "a", "specified", "Monomer", "of", "a", "specified", "Strand", ".", "Additionally", "it", "keeps", "record", "of", "the", "iCode", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/silent/src/main/java/org/openscience/cdk/silent/PDBPolymer.java#L106-L111
kevinherron/opc-ua-stack
stack-core/src/main/java/com/digitalpetri/opcua/stack/core/util/CertificateUtil.java
CertificateUtil.decodeCertificate
public static X509Certificate decodeCertificate(InputStream inputStream) throws UaException { """ Decode a DER-encoded X.509 certificate. @param inputStream {@link InputStream} containing DER-encoded certificate bytes. @return an {@link X509Certificate} @throws UaException if decoding the certificate fails. """ Preconditions.checkNotNull(inputStream, "inputStream cannot be null"); CertificateFactory factory; try { factory = CertificateFactory.getInstance("X.509"); } catch (CertificateException e) { throw new UaException(StatusCodes.Bad_InternalError, e); } try { return (X509Certificate) factory.generateCertificate(inputStream); } catch (CertificateException | ClassCastException e) { throw new UaException(StatusCodes.Bad_CertificateInvalid, e); } }
java
public static X509Certificate decodeCertificate(InputStream inputStream) throws UaException { Preconditions.checkNotNull(inputStream, "inputStream cannot be null"); CertificateFactory factory; try { factory = CertificateFactory.getInstance("X.509"); } catch (CertificateException e) { throw new UaException(StatusCodes.Bad_InternalError, e); } try { return (X509Certificate) factory.generateCertificate(inputStream); } catch (CertificateException | ClassCastException e) { throw new UaException(StatusCodes.Bad_CertificateInvalid, e); } }
[ "public", "static", "X509Certificate", "decodeCertificate", "(", "InputStream", "inputStream", ")", "throws", "UaException", "{", "Preconditions", ".", "checkNotNull", "(", "inputStream", ",", "\"inputStream cannot be null\"", ")", ";", "CertificateFactory", "factory", ";", "try", "{", "factory", "=", "CertificateFactory", ".", "getInstance", "(", "\"X.509\"", ")", ";", "}", "catch", "(", "CertificateException", "e", ")", "{", "throw", "new", "UaException", "(", "StatusCodes", ".", "Bad_InternalError", ",", "e", ")", ";", "}", "try", "{", "return", "(", "X509Certificate", ")", "factory", ".", "generateCertificate", "(", "inputStream", ")", ";", "}", "catch", "(", "CertificateException", "|", "ClassCastException", "e", ")", "{", "throw", "new", "UaException", "(", "StatusCodes", ".", "Bad_CertificateInvalid", ",", "e", ")", ";", "}", "}" ]
Decode a DER-encoded X.509 certificate. @param inputStream {@link InputStream} containing DER-encoded certificate bytes. @return an {@link X509Certificate} @throws UaException if decoding the certificate fails.
[ "Decode", "a", "DER", "-", "encoded", "X", ".", "509", "certificate", "." ]
train
https://github.com/kevinherron/opc-ua-stack/blob/007f4e5c4ff102814bec17bb7c41f27e2e52f2fd/stack-core/src/main/java/com/digitalpetri/opcua/stack/core/util/CertificateUtil.java#L62-L78
acromusashi/acromusashi-stream
src/main/java/acromusashi/stream/spout/DrpcFetchHelper.java
DrpcFetchHelper.ack
public void ack(String requestId, String resultMessage) throws TException { """ 処理が成功した場合の応答を返す。 @param requestId リクエストID @param resultMessage 応答メッセージ @throws TException 応答を返す際に失敗した場合 """ int index = this.requestedMap.remove(requestId); DRPCInvocationsClient client = this.clients.get(index); client.result(requestId, resultMessage); }
java
public void ack(String requestId, String resultMessage) throws TException { int index = this.requestedMap.remove(requestId); DRPCInvocationsClient client = this.clients.get(index); client.result(requestId, resultMessage); }
[ "public", "void", "ack", "(", "String", "requestId", ",", "String", "resultMessage", ")", "throws", "TException", "{", "int", "index", "=", "this", ".", "requestedMap", ".", "remove", "(", "requestId", ")", ";", "DRPCInvocationsClient", "client", "=", "this", ".", "clients", ".", "get", "(", "index", ")", ";", "client", ".", "result", "(", "requestId", ",", "resultMessage", ")", ";", "}" ]
処理が成功した場合の応答を返す。 @param requestId リクエストID @param resultMessage 応答メッセージ @throws TException 応答を返す際に失敗した場合
[ "処理が成功した場合の応答を返す。" ]
train
https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/spout/DrpcFetchHelper.java#L108-L113
infinispan/infinispan
core/src/main/java/org/infinispan/configuration/cache/AbstractSegmentedStoreConfiguration.java
AbstractSegmentedStoreConfiguration.fileLocationTransform
protected static String fileLocationTransform(String location, int segment) { """ Transforms a file location to a segment based one. This is useful for file based stores where all you need to do is append a segment to the name of the directory. If the provided location is a directory, that is that it is terminated by in {@link File#separatorChar}, it will add a new directory onto that that is the segment. If the location is a file, that is that it is not terminated by {@link File#separatorChar}, this will treat the location as a directory and append a segment file in it. The underlying store may or may not preseve this and could still turn the segment into a directory. @param location original file location @param segment the segment to append @return string with the segment appended to the file location """ if (location.endsWith(File.separator)) { return location.substring(0, location.length() - 1) + "-" + segment + File.separatorChar; } return location + File.separatorChar + segment; }
java
protected static String fileLocationTransform(String location, int segment) { if (location.endsWith(File.separator)) { return location.substring(0, location.length() - 1) + "-" + segment + File.separatorChar; } return location + File.separatorChar + segment; }
[ "protected", "static", "String", "fileLocationTransform", "(", "String", "location", ",", "int", "segment", ")", "{", "if", "(", "location", ".", "endsWith", "(", "File", ".", "separator", ")", ")", "{", "return", "location", ".", "substring", "(", "0", ",", "location", ".", "length", "(", ")", "-", "1", ")", "+", "\"-\"", "+", "segment", "+", "File", ".", "separatorChar", ";", "}", "return", "location", "+", "File", ".", "separatorChar", "+", "segment", ";", "}" ]
Transforms a file location to a segment based one. This is useful for file based stores where all you need to do is append a segment to the name of the directory. If the provided location is a directory, that is that it is terminated by in {@link File#separatorChar}, it will add a new directory onto that that is the segment. If the location is a file, that is that it is not terminated by {@link File#separatorChar}, this will treat the location as a directory and append a segment file in it. The underlying store may or may not preseve this and could still turn the segment into a directory. @param location original file location @param segment the segment to append @return string with the segment appended to the file location
[ "Transforms", "a", "file", "location", "to", "a", "segment", "based", "one", ".", "This", "is", "useful", "for", "file", "based", "stores", "where", "all", "you", "need", "to", "do", "is", "append", "a", "segment", "to", "the", "name", "of", "the", "directory", ".", "If", "the", "provided", "location", "is", "a", "directory", "that", "is", "that", "it", "is", "terminated", "by", "in", "{" ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/cache/AbstractSegmentedStoreConfiguration.java#L37-L42
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/bind/BindTypeBuilder.java
BindTypeBuilder.generateSerializeOnJackson
private static void generateSerializeOnJackson(BindTypeContext context, BindEntity entity) { """ Generate serialize on jackson. @param context the context @param entity the entity """ // @formatter:off MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder("serializeOnJackson").addAnnotation(Override.class) .addModifiers(Modifier.PUBLIC) // .addParameter(typeName(AbstractJacksonContext.class), // "context") .addParameter(typeName(entity.getElement()), "object") .addParameter(typeName(JsonGenerator.class), "jacksonSerializer").returns(Integer.TYPE) .addException(Exception.class); // @formatter:on // methodBuilder.beginControlFlow("try"); // methodBuilder.addStatement("$T jacksonSerializer = // wrapper.jacksonGenerator", className(JsonGenerator.class)); methodBuilder.addStatement("jacksonSerializer.writeStartObject()"); methodBuilder.addStatement("int fieldCount=0"); BindTransform bindTransform; methodBuilder.addCode("\n"); // fields methodBuilder.addCode("// Serialized Field:\n\n"); for (BindProperty item : entity.getCollection()) { bindTransform = BindTransformer.lookup(item); methodBuilder.addCode("// field $L (mapped with $S)\n", item.getName(), item.label); bindTransform.generateSerializeOnJackson(context, methodBuilder, "jacksonSerializer", item.getPropertyType().getTypeName(), "object", item); methodBuilder.addCode("\n"); } methodBuilder.addStatement("jacksonSerializer.writeEndObject()"); methodBuilder.addStatement("return fieldCount"); // methodBuilder.nextControlFlow("catch($T e)", // typeName(Exception.class)); // methodBuilder.addStatement("e.printStackTrace()"); // methodBuilder.addStatement("throw (new $T(e))", // typeName(KriptonRuntimeException.class)); // methodBuilder.endControlFlow(); context.builder.addMethod(methodBuilder.build()); }
java
private static void generateSerializeOnJackson(BindTypeContext context, BindEntity entity) { // @formatter:off MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder("serializeOnJackson").addAnnotation(Override.class) .addModifiers(Modifier.PUBLIC) // .addParameter(typeName(AbstractJacksonContext.class), // "context") .addParameter(typeName(entity.getElement()), "object") .addParameter(typeName(JsonGenerator.class), "jacksonSerializer").returns(Integer.TYPE) .addException(Exception.class); // @formatter:on // methodBuilder.beginControlFlow("try"); // methodBuilder.addStatement("$T jacksonSerializer = // wrapper.jacksonGenerator", className(JsonGenerator.class)); methodBuilder.addStatement("jacksonSerializer.writeStartObject()"); methodBuilder.addStatement("int fieldCount=0"); BindTransform bindTransform; methodBuilder.addCode("\n"); // fields methodBuilder.addCode("// Serialized Field:\n\n"); for (BindProperty item : entity.getCollection()) { bindTransform = BindTransformer.lookup(item); methodBuilder.addCode("// field $L (mapped with $S)\n", item.getName(), item.label); bindTransform.generateSerializeOnJackson(context, methodBuilder, "jacksonSerializer", item.getPropertyType().getTypeName(), "object", item); methodBuilder.addCode("\n"); } methodBuilder.addStatement("jacksonSerializer.writeEndObject()"); methodBuilder.addStatement("return fieldCount"); // methodBuilder.nextControlFlow("catch($T e)", // typeName(Exception.class)); // methodBuilder.addStatement("e.printStackTrace()"); // methodBuilder.addStatement("throw (new $T(e))", // typeName(KriptonRuntimeException.class)); // methodBuilder.endControlFlow(); context.builder.addMethod(methodBuilder.build()); }
[ "private", "static", "void", "generateSerializeOnJackson", "(", "BindTypeContext", "context", ",", "BindEntity", "entity", ")", "{", "// @formatter:off", "MethodSpec", ".", "Builder", "methodBuilder", "=", "MethodSpec", ".", "methodBuilder", "(", "\"serializeOnJackson\"", ")", ".", "addAnnotation", "(", "Override", ".", "class", ")", ".", "addModifiers", "(", "Modifier", ".", "PUBLIC", ")", "// .addParameter(typeName(AbstractJacksonContext.class),", "// \"context\")", ".", "addParameter", "(", "typeName", "(", "entity", ".", "getElement", "(", ")", ")", ",", "\"object\"", ")", ".", "addParameter", "(", "typeName", "(", "JsonGenerator", ".", "class", ")", ",", "\"jacksonSerializer\"", ")", ".", "returns", "(", "Integer", ".", "TYPE", ")", ".", "addException", "(", "Exception", ".", "class", ")", ";", "// @formatter:on", "// methodBuilder.beginControlFlow(\"try\");", "// methodBuilder.addStatement(\"$T jacksonSerializer =", "// wrapper.jacksonGenerator\", className(JsonGenerator.class));", "methodBuilder", ".", "addStatement", "(", "\"jacksonSerializer.writeStartObject()\"", ")", ";", "methodBuilder", ".", "addStatement", "(", "\"int fieldCount=0\"", ")", ";", "BindTransform", "bindTransform", ";", "methodBuilder", ".", "addCode", "(", "\"\\n\"", ")", ";", "// fields", "methodBuilder", ".", "addCode", "(", "\"// Serialized Field:\\n\\n\"", ")", ";", "for", "(", "BindProperty", "item", ":", "entity", ".", "getCollection", "(", ")", ")", "{", "bindTransform", "=", "BindTransformer", ".", "lookup", "(", "item", ")", ";", "methodBuilder", ".", "addCode", "(", "\"// field $L (mapped with $S)\\n\"", ",", "item", ".", "getName", "(", ")", ",", "item", ".", "label", ")", ";", "bindTransform", ".", "generateSerializeOnJackson", "(", "context", ",", "methodBuilder", ",", "\"jacksonSerializer\"", ",", "item", ".", "getPropertyType", "(", ")", ".", "getTypeName", "(", ")", ",", "\"object\"", ",", "item", ")", ";", "methodBuilder", ".", "addCode", "(", "\"\\n\"", ")", ";", "}", "methodBuilder", ".", "addStatement", "(", "\"jacksonSerializer.writeEndObject()\"", ")", ";", "methodBuilder", ".", "addStatement", "(", "\"return fieldCount\"", ")", ";", "// methodBuilder.nextControlFlow(\"catch($T e)\",", "// typeName(Exception.class));", "// methodBuilder.addStatement(\"e.printStackTrace()\");", "// methodBuilder.addStatement(\"throw (new $T(e))\",", "// typeName(KriptonRuntimeException.class));", "// methodBuilder.endControlFlow();", "context", ".", "builder", ".", "addMethod", "(", "methodBuilder", ".", "build", "(", ")", ")", ";", "}" ]
Generate serialize on jackson. @param context the context @param entity the entity
[ "Generate", "serialize", "on", "jackson", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/bind/BindTypeBuilder.java#L706-L749
google/closure-templates
java/src/com/google/template/soy/jbcsrc/PrintDirectives.java
PrintDirectives.applyStreamingEscapingDirectives
static AppendableAndOptions applyStreamingEscapingDirectives( List<SoyPrintDirective> directives, Expression appendable, JbcSrcPluginContext context, TemplateVariableManager variables) { """ Applies all the streaming print directives to the appendable. @param directives The directives. All are required to be {@link com.google.template.soy.jbcsrc.restricted.SoyJbcSrcPrintDirective.Streamable streamable} @param appendable The appendable to wrap @param context The render context for the plugins @param variables The local variable manager @return The wrapped appendable """ List<DirectiveWithArgs> directivesToApply = new ArrayList<>(); for (SoyPrintDirective directive : directives) { directivesToApply.add( DirectiveWithArgs.create((SoyJbcSrcPrintDirective.Streamable) directive)); } return applyStreamingPrintDirectivesTo(directivesToApply, appendable, context, variables); }
java
static AppendableAndOptions applyStreamingEscapingDirectives( List<SoyPrintDirective> directives, Expression appendable, JbcSrcPluginContext context, TemplateVariableManager variables) { List<DirectiveWithArgs> directivesToApply = new ArrayList<>(); for (SoyPrintDirective directive : directives) { directivesToApply.add( DirectiveWithArgs.create((SoyJbcSrcPrintDirective.Streamable) directive)); } return applyStreamingPrintDirectivesTo(directivesToApply, appendable, context, variables); }
[ "static", "AppendableAndOptions", "applyStreamingEscapingDirectives", "(", "List", "<", "SoyPrintDirective", ">", "directives", ",", "Expression", "appendable", ",", "JbcSrcPluginContext", "context", ",", "TemplateVariableManager", "variables", ")", "{", "List", "<", "DirectiveWithArgs", ">", "directivesToApply", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "SoyPrintDirective", "directive", ":", "directives", ")", "{", "directivesToApply", ".", "add", "(", "DirectiveWithArgs", ".", "create", "(", "(", "SoyJbcSrcPrintDirective", ".", "Streamable", ")", "directive", ")", ")", ";", "}", "return", "applyStreamingPrintDirectivesTo", "(", "directivesToApply", ",", "appendable", ",", "context", ",", "variables", ")", ";", "}" ]
Applies all the streaming print directives to the appendable. @param directives The directives. All are required to be {@link com.google.template.soy.jbcsrc.restricted.SoyJbcSrcPrintDirective.Streamable streamable} @param appendable The appendable to wrap @param context The render context for the plugins @param variables The local variable manager @return The wrapped appendable
[ "Applies", "all", "the", "streaming", "print", "directives", "to", "the", "appendable", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/PrintDirectives.java#L92-L103
abola/CrawlerPack
src/main/java/com/github/abola/crawler/CrawlerPack.java
CrawlerPack.addCookie
public CrawlerPack addCookie(String name, String value) { """ Creates a cookie with the given name and value. @param name the cookie name @param value the cookie value @return CrawlerPack """ if( null == name ) { log.warn("addCookie: Cookie name null."); return this; } cookies.add( new Cookie("", name, value) ); return this; }
java
public CrawlerPack addCookie(String name, String value){ if( null == name ) { log.warn("addCookie: Cookie name null."); return this; } cookies.add( new Cookie("", name, value) ); return this; }
[ "public", "CrawlerPack", "addCookie", "(", "String", "name", ",", "String", "value", ")", "{", "if", "(", "null", "==", "name", ")", "{", "log", ".", "warn", "(", "\"addCookie: Cookie name null.\"", ")", ";", "return", "this", ";", "}", "cookies", ".", "add", "(", "new", "Cookie", "(", "\"\"", ",", "name", ",", "value", ")", ")", ";", "return", "this", ";", "}" ]
Creates a cookie with the given name and value. @param name the cookie name @param value the cookie value @return CrawlerPack
[ "Creates", "a", "cookie", "with", "the", "given", "name", "and", "value", "." ]
train
https://github.com/abola/CrawlerPack/blob/a7b7703b7fad519994dc04a9c51d90adc11d618f/src/main/java/com/github/abola/crawler/CrawlerPack.java#L113-L122
pwall567/jsonutil
src/main/java/net/pwall/json/JSONObject.java
JSONObject.putValue
public JSONObject putValue(String key, int value) { """ Add a {@link JSONInteger} representing the supplied {@code int} to the {@code JSONObject}. @param key the key to use when storing the value @param value the value @return {@code this} (for chaining) @throws NullPointerException if key is {@code null} """ put(key, JSONInteger.valueOf(value)); return this; }
java
public JSONObject putValue(String key, int value) { put(key, JSONInteger.valueOf(value)); return this; }
[ "public", "JSONObject", "putValue", "(", "String", "key", ",", "int", "value", ")", "{", "put", "(", "key", ",", "JSONInteger", ".", "valueOf", "(", "value", ")", ")", ";", "return", "this", ";", "}" ]
Add a {@link JSONInteger} representing the supplied {@code int} to the {@code JSONObject}. @param key the key to use when storing the value @param value the value @return {@code this} (for chaining) @throws NullPointerException if key is {@code null}
[ "Add", "a", "{", "@link", "JSONInteger", "}", "representing", "the", "supplied", "{", "@code", "int", "}", "to", "the", "{", "@code", "JSONObject", "}", "." ]
train
https://github.com/pwall567/jsonutil/blob/dd5960b9b0bcc9acfe6c52b884fffd9ee5f422fe/src/main/java/net/pwall/json/JSONObject.java#L117-L120
ow2-chameleon/fuchsia
bases/knx/calimero/src/main/java/tuwien/auto/calimero/tools/IPConfig.java
IPConfig.createRemoteAdapter
private PropertyAdapter createRemoteAdapter(InetSocketAddress local, InetSocketAddress host, Map options) throws KNXException { """ Creates a remote property service adapter for one device in the KNX network. <p> The adapter uses a KNX network link for access, also is created by this method. @param local local socket address @param host remote socket address of host @param options contains parameters for property adapter creation @return remote property service adapter @throws KNXException on adapter creation problem """ final KNXMediumSettings medium = (KNXMediumSettings) options.get("medium"); if (options.containsKey("serial")) { // create FT1.2 network link final String p = (String) options.get("serial"); try { lnk = new KNXNetworkLinkFT12(Integer.parseInt(p), medium); } catch (final NumberFormatException e) { lnk = new KNXNetworkLinkFT12(p, medium); } } else { final int mode = options.containsKey("routing") ? KNXNetworkLinkIP.ROUTER : KNXNetworkLinkIP.TUNNEL; lnk = new KNXNetworkLinkIP(mode, local, host, options.containsKey("nat"), medium); } final IndividualAddress remote = (IndividualAddress) options.get("remote"); // if an authorization key was supplied, the adapter uses // connection oriented mode and tries to authenticate final byte[] authKey = (byte[]) options.get("authorize"); if (authKey != null) return new RemotePropertyServiceAdapter(lnk, remote, null, authKey); return new RemotePropertyServiceAdapter(lnk, remote, null, options .containsKey("connect")); }
java
private PropertyAdapter createRemoteAdapter(InetSocketAddress local, InetSocketAddress host, Map options) throws KNXException { final KNXMediumSettings medium = (KNXMediumSettings) options.get("medium"); if (options.containsKey("serial")) { // create FT1.2 network link final String p = (String) options.get("serial"); try { lnk = new KNXNetworkLinkFT12(Integer.parseInt(p), medium); } catch (final NumberFormatException e) { lnk = new KNXNetworkLinkFT12(p, medium); } } else { final int mode = options.containsKey("routing") ? KNXNetworkLinkIP.ROUTER : KNXNetworkLinkIP.TUNNEL; lnk = new KNXNetworkLinkIP(mode, local, host, options.containsKey("nat"), medium); } final IndividualAddress remote = (IndividualAddress) options.get("remote"); // if an authorization key was supplied, the adapter uses // connection oriented mode and tries to authenticate final byte[] authKey = (byte[]) options.get("authorize"); if (authKey != null) return new RemotePropertyServiceAdapter(lnk, remote, null, authKey); return new RemotePropertyServiceAdapter(lnk, remote, null, options .containsKey("connect")); }
[ "private", "PropertyAdapter", "createRemoteAdapter", "(", "InetSocketAddress", "local", ",", "InetSocketAddress", "host", ",", "Map", "options", ")", "throws", "KNXException", "{", "final", "KNXMediumSettings", "medium", "=", "(", "KNXMediumSettings", ")", "options", ".", "get", "(", "\"medium\"", ")", ";", "if", "(", "options", ".", "containsKey", "(", "\"serial\"", ")", ")", "{", "// create FT1.2 network link\r", "final", "String", "p", "=", "(", "String", ")", "options", ".", "get", "(", "\"serial\"", ")", ";", "try", "{", "lnk", "=", "new", "KNXNetworkLinkFT12", "(", "Integer", ".", "parseInt", "(", "p", ")", ",", "medium", ")", ";", "}", "catch", "(", "final", "NumberFormatException", "e", ")", "{", "lnk", "=", "new", "KNXNetworkLinkFT12", "(", "p", ",", "medium", ")", ";", "}", "}", "else", "{", "final", "int", "mode", "=", "options", ".", "containsKey", "(", "\"routing\"", ")", "?", "KNXNetworkLinkIP", ".", "ROUTER", ":", "KNXNetworkLinkIP", ".", "TUNNEL", ";", "lnk", "=", "new", "KNXNetworkLinkIP", "(", "mode", ",", "local", ",", "host", ",", "options", ".", "containsKey", "(", "\"nat\"", ")", ",", "medium", ")", ";", "}", "final", "IndividualAddress", "remote", "=", "(", "IndividualAddress", ")", "options", ".", "get", "(", "\"remote\"", ")", ";", "// if an authorization key was supplied, the adapter uses\r", "// connection oriented mode and tries to authenticate\r", "final", "byte", "[", "]", "authKey", "=", "(", "byte", "[", "]", ")", "options", ".", "get", "(", "\"authorize\"", ")", ";", "if", "(", "authKey", "!=", "null", ")", "return", "new", "RemotePropertyServiceAdapter", "(", "lnk", ",", "remote", ",", "null", ",", "authKey", ")", ";", "return", "new", "RemotePropertyServiceAdapter", "(", "lnk", ",", "remote", ",", "null", ",", "options", ".", "containsKey", "(", "\"connect\"", ")", ")", ";", "}" ]
Creates a remote property service adapter for one device in the KNX network. <p> The adapter uses a KNX network link for access, also is created by this method. @param local local socket address @param host remote socket address of host @param options contains parameters for property adapter creation @return remote property service adapter @throws KNXException on adapter creation problem
[ "Creates", "a", "remote", "property", "service", "adapter", "for", "one", "device", "in", "the", "KNX", "network", ".", "<p", ">", "The", "adapter", "uses", "a", "KNX", "network", "link", "for", "access", "also", "is", "created", "by", "this", "method", "." ]
train
https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/tools/IPConfig.java#L440-L468
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPAddressesInner.java
PublicIPAddressesInner.updateTags
public PublicIPAddressInner updateTags(String resourceGroupName, String publicIpAddressName, Map<String, String> tags) { """ Updates public IP address tags. @param resourceGroupName The name of the resource group. @param publicIpAddressName The name of the public IP address. @param tags Resource tags. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PublicIPAddressInner object if successful. """ return updateTagsWithServiceResponseAsync(resourceGroupName, publicIpAddressName, tags).toBlocking().last().body(); }
java
public PublicIPAddressInner updateTags(String resourceGroupName, String publicIpAddressName, Map<String, String> tags) { return updateTagsWithServiceResponseAsync(resourceGroupName, publicIpAddressName, tags).toBlocking().last().body(); }
[ "public", "PublicIPAddressInner", "updateTags", "(", "String", "resourceGroupName", ",", "String", "publicIpAddressName", ",", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "updateTagsWithServiceResponseAsync", "(", "resourceGroupName", ",", "publicIpAddressName", ",", "tags", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
Updates public IP address tags. @param resourceGroupName The name of the resource group. @param publicIpAddressName The name of the public IP address. @param tags Resource tags. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PublicIPAddressInner object if successful.
[ "Updates", "public", "IP", "address", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPAddressesInner.java#L701-L703
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/WaveformDetail.java
WaveformDetail.segmentColor
@SuppressWarnings("WeakerAccess") public Color segmentColor(final int segment, final int scale) { """ Determine the color of the waveform given an index into it. If {@code scale} is larger than 1 we are zoomed out, so we determine an average color of {@code scale} segments starting with the specified one. @param segment the index of the first waveform byte to examine @param scale the number of wave segments being drawn as a single pixel column @return the color of the waveform at that segment, which may be based on an average of a number of values starting there, determined by the scale """ final ByteBuffer waveBytes = getData(); final int limit = getFrameCount(); if (isColor) { int red = 0; int green = 0; int blue = 0; for (int i = segment; (i < segment + scale) && (i < limit); i++) { int bits = getColorWaveformBits(waveBytes, segment); red += (bits >> 13) & 7; green += (bits >> 10) & 7; blue += (bits >> 7) & 7; } return new Color(red * 255 / (scale * 7), blue * 255 / (scale * 7), green * 255 / (scale * 7)); } int sum = 0; for (int i = segment; (i < segment + scale) && (i < limit); i++) { sum += (waveBytes.get(i) & 0xe0) >> 5; } return COLOR_MAP[sum / scale]; }
java
@SuppressWarnings("WeakerAccess") public Color segmentColor(final int segment, final int scale) { final ByteBuffer waveBytes = getData(); final int limit = getFrameCount(); if (isColor) { int red = 0; int green = 0; int blue = 0; for (int i = segment; (i < segment + scale) && (i < limit); i++) { int bits = getColorWaveformBits(waveBytes, segment); red += (bits >> 13) & 7; green += (bits >> 10) & 7; blue += (bits >> 7) & 7; } return new Color(red * 255 / (scale * 7), blue * 255 / (scale * 7), green * 255 / (scale * 7)); } int sum = 0; for (int i = segment; (i < segment + scale) && (i < limit); i++) { sum += (waveBytes.get(i) & 0xe0) >> 5; } return COLOR_MAP[sum / scale]; }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "Color", "segmentColor", "(", "final", "int", "segment", ",", "final", "int", "scale", ")", "{", "final", "ByteBuffer", "waveBytes", "=", "getData", "(", ")", ";", "final", "int", "limit", "=", "getFrameCount", "(", ")", ";", "if", "(", "isColor", ")", "{", "int", "red", "=", "0", ";", "int", "green", "=", "0", ";", "int", "blue", "=", "0", ";", "for", "(", "int", "i", "=", "segment", ";", "(", "i", "<", "segment", "+", "scale", ")", "&&", "(", "i", "<", "limit", ")", ";", "i", "++", ")", "{", "int", "bits", "=", "getColorWaveformBits", "(", "waveBytes", ",", "segment", ")", ";", "red", "+=", "(", "bits", ">>", "13", ")", "&", "7", ";", "green", "+=", "(", "bits", ">>", "10", ")", "&", "7", ";", "blue", "+=", "(", "bits", ">>", "7", ")", "&", "7", ";", "}", "return", "new", "Color", "(", "red", "*", "255", "/", "(", "scale", "*", "7", ")", ",", "blue", "*", "255", "/", "(", "scale", "*", "7", ")", ",", "green", "*", "255", "/", "(", "scale", "*", "7", ")", ")", ";", "}", "int", "sum", "=", "0", ";", "for", "(", "int", "i", "=", "segment", ";", "(", "i", "<", "segment", "+", "scale", ")", "&&", "(", "i", "<", "limit", ")", ";", "i", "++", ")", "{", "sum", "+=", "(", "waveBytes", ".", "get", "(", "i", ")", "&", "0xe0", ")", ">>", "5", ";", "}", "return", "COLOR_MAP", "[", "sum", "/", "scale", "]", ";", "}" ]
Determine the color of the waveform given an index into it. If {@code scale} is larger than 1 we are zoomed out, so we determine an average color of {@code scale} segments starting with the specified one. @param segment the index of the first waveform byte to examine @param scale the number of wave segments being drawn as a single pixel column @return the color of the waveform at that segment, which may be based on an average of a number of values starting there, determined by the scale
[ "Determine", "the", "color", "of", "the", "waveform", "given", "an", "index", "into", "it", ".", "If", "{", "@code", "scale", "}", "is", "larger", "than", "1", "we", "are", "zoomed", "out", "so", "we", "determine", "an", "average", "color", "of", "{", "@code", "scale", "}", "segments", "starting", "with", "the", "specified", "one", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformDetail.java#L250-L271
spring-projects/spring-data-solr
src/main/java/org/springframework/data/solr/core/query/Criteria.java
Criteria.contains
public Criteria contains(String s) { """ Crates new {@link Predicate} with leading and trailing wildcards <br/> <strong>NOTE: </strong>mind your schema as leading wildcards may not be supported and/or execution might be slow. <strong>NOTE: </strong>Strings will not be automatically split on whitespace. @param s @return @throws InvalidDataAccessApiUsageException for strings with whitespace """ assertNoBlankInWildcardedQuery(s, true, true); predicates.add(new Predicate(OperationKey.CONTAINS, s)); return this; }
java
public Criteria contains(String s) { assertNoBlankInWildcardedQuery(s, true, true); predicates.add(new Predicate(OperationKey.CONTAINS, s)); return this; }
[ "public", "Criteria", "contains", "(", "String", "s", ")", "{", "assertNoBlankInWildcardedQuery", "(", "s", ",", "true", ",", "true", ")", ";", "predicates", ".", "add", "(", "new", "Predicate", "(", "OperationKey", ".", "CONTAINS", ",", "s", ")", ")", ";", "return", "this", ";", "}" ]
Crates new {@link Predicate} with leading and trailing wildcards <br/> <strong>NOTE: </strong>mind your schema as leading wildcards may not be supported and/or execution might be slow. <strong>NOTE: </strong>Strings will not be automatically split on whitespace. @param s @return @throws InvalidDataAccessApiUsageException for strings with whitespace
[ "Crates", "new", "{", "@link", "Predicate", "}", "with", "leading", "and", "trailing", "wildcards", "<br", "/", ">", "<strong", ">", "NOTE", ":", "<", "/", "strong", ">", "mind", "your", "schema", "as", "leading", "wildcards", "may", "not", "be", "supported", "and", "/", "or", "execution", "might", "be", "slow", ".", "<strong", ">", "NOTE", ":", "<", "/", "strong", ">", "Strings", "will", "not", "be", "automatically", "split", "on", "whitespace", "." ]
train
https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/query/Criteria.java#L176-L181
hibernate/hibernate-ogm
mongodb/src/main/java/org/hibernate/ogm/datastore/mongodb/MongoDBDialect.java
MongoDBDialect.doDistinct
private static ClosableIterator<Tuple> doDistinct(final MongoDBQueryDescriptor queryDescriptor, final MongoCollection<Document> collection) { """ do 'Distinct' operation @param queryDescriptor descriptor of MongoDB query @param collection collection for execute the operation @return result iterator @see <a href ="https://docs.mongodb.com/manual/reference/method/db.collection.distinct/">distinct</a> """ DistinctIterable<?> distinctFieldValues = collection.distinct( queryDescriptor.getDistinctFieldName(), queryDescriptor.getCriteria(), String.class ); Collation collation = getCollation( queryDescriptor.getOptions() ); distinctFieldValues = collation != null ? distinctFieldValues.collation( collation ) : distinctFieldValues; MongoCursor<?> cursor = distinctFieldValues.iterator(); List<Object> documents = new ArrayList<>(); while ( cursor.hasNext() ) { documents.add( cursor.next() ); } MapTupleSnapshot snapshot = new MapTupleSnapshot( Collections.<String, Object>singletonMap( "n", documents ) ); return CollectionHelper.newClosableIterator( Collections.singletonList( new Tuple( snapshot, SnapshotType.UNKNOWN ) ) ); }
java
private static ClosableIterator<Tuple> doDistinct(final MongoDBQueryDescriptor queryDescriptor, final MongoCollection<Document> collection) { DistinctIterable<?> distinctFieldValues = collection.distinct( queryDescriptor.getDistinctFieldName(), queryDescriptor.getCriteria(), String.class ); Collation collation = getCollation( queryDescriptor.getOptions() ); distinctFieldValues = collation != null ? distinctFieldValues.collation( collation ) : distinctFieldValues; MongoCursor<?> cursor = distinctFieldValues.iterator(); List<Object> documents = new ArrayList<>(); while ( cursor.hasNext() ) { documents.add( cursor.next() ); } MapTupleSnapshot snapshot = new MapTupleSnapshot( Collections.<String, Object>singletonMap( "n", documents ) ); return CollectionHelper.newClosableIterator( Collections.singletonList( new Tuple( snapshot, SnapshotType.UNKNOWN ) ) ); }
[ "private", "static", "ClosableIterator", "<", "Tuple", ">", "doDistinct", "(", "final", "MongoDBQueryDescriptor", "queryDescriptor", ",", "final", "MongoCollection", "<", "Document", ">", "collection", ")", "{", "DistinctIterable", "<", "?", ">", "distinctFieldValues", "=", "collection", ".", "distinct", "(", "queryDescriptor", ".", "getDistinctFieldName", "(", ")", ",", "queryDescriptor", ".", "getCriteria", "(", ")", ",", "String", ".", "class", ")", ";", "Collation", "collation", "=", "getCollation", "(", "queryDescriptor", ".", "getOptions", "(", ")", ")", ";", "distinctFieldValues", "=", "collation", "!=", "null", "?", "distinctFieldValues", ".", "collation", "(", "collation", ")", ":", "distinctFieldValues", ";", "MongoCursor", "<", "?", ">", "cursor", "=", "distinctFieldValues", ".", "iterator", "(", ")", ";", "List", "<", "Object", ">", "documents", "=", "new", "ArrayList", "<>", "(", ")", ";", "while", "(", "cursor", ".", "hasNext", "(", ")", ")", "{", "documents", ".", "add", "(", "cursor", ".", "next", "(", ")", ")", ";", "}", "MapTupleSnapshot", "snapshot", "=", "new", "MapTupleSnapshot", "(", "Collections", ".", "<", "String", ",", "Object", ">", "singletonMap", "(", "\"n\"", ",", "documents", ")", ")", ";", "return", "CollectionHelper", ".", "newClosableIterator", "(", "Collections", ".", "singletonList", "(", "new", "Tuple", "(", "snapshot", ",", "SnapshotType", ".", "UNKNOWN", ")", ")", ")", ";", "}" ]
do 'Distinct' operation @param queryDescriptor descriptor of MongoDB query @param collection collection for execute the operation @return result iterator @see <a href ="https://docs.mongodb.com/manual/reference/method/db.collection.distinct/">distinct</a>
[ "do", "Distinct", "operation" ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/mongodb/src/main/java/org/hibernate/ogm/datastore/mongodb/MongoDBDialect.java#L1106-L1119
CodeNarc/CodeNarc
src/main/java/org/codenarc/util/AstUtil.java
AstUtil.isMethodNamed
public static boolean isMethodNamed(MethodCallExpression methodCall, String methodNamePattern, Integer numArguments) { """ Return true only if the MethodCallExpression represents a method call for the specified method name @param methodCall - the AST MethodCallExpression @param methodNamePattern - the expected name of the method being called @param numArguments - The number of expected arguments @return true only if the method call name matches """ Expression method = methodCall.getMethod(); // !important: performance enhancement boolean IS_NAME_MATCH = false; if (method instanceof ConstantExpression) { if (((ConstantExpression) method).getValue() instanceof String) { IS_NAME_MATCH = ((String)((ConstantExpression) method).getValue()).matches(methodNamePattern); } } if (IS_NAME_MATCH && numArguments != null) { return AstUtil.getMethodArguments(methodCall).size() == numArguments; } return IS_NAME_MATCH; }
java
public static boolean isMethodNamed(MethodCallExpression methodCall, String methodNamePattern, Integer numArguments) { Expression method = methodCall.getMethod(); // !important: performance enhancement boolean IS_NAME_MATCH = false; if (method instanceof ConstantExpression) { if (((ConstantExpression) method).getValue() instanceof String) { IS_NAME_MATCH = ((String)((ConstantExpression) method).getValue()).matches(methodNamePattern); } } if (IS_NAME_MATCH && numArguments != null) { return AstUtil.getMethodArguments(methodCall).size() == numArguments; } return IS_NAME_MATCH; }
[ "public", "static", "boolean", "isMethodNamed", "(", "MethodCallExpression", "methodCall", ",", "String", "methodNamePattern", ",", "Integer", "numArguments", ")", "{", "Expression", "method", "=", "methodCall", ".", "getMethod", "(", ")", ";", "// !important: performance enhancement\r", "boolean", "IS_NAME_MATCH", "=", "false", ";", "if", "(", "method", "instanceof", "ConstantExpression", ")", "{", "if", "(", "(", "(", "ConstantExpression", ")", "method", ")", ".", "getValue", "(", ")", "instanceof", "String", ")", "{", "IS_NAME_MATCH", "=", "(", "(", "String", ")", "(", "(", "ConstantExpression", ")", "method", ")", ".", "getValue", "(", ")", ")", ".", "matches", "(", "methodNamePattern", ")", ";", "}", "}", "if", "(", "IS_NAME_MATCH", "&&", "numArguments", "!=", "null", ")", "{", "return", "AstUtil", ".", "getMethodArguments", "(", "methodCall", ")", ".", "size", "(", ")", "==", "numArguments", ";", "}", "return", "IS_NAME_MATCH", ";", "}" ]
Return true only if the MethodCallExpression represents a method call for the specified method name @param methodCall - the AST MethodCallExpression @param methodNamePattern - the expected name of the method being called @param numArguments - The number of expected arguments @return true only if the method call name matches
[ "Return", "true", "only", "if", "the", "MethodCallExpression", "represents", "a", "method", "call", "for", "the", "specified", "method", "name" ]
train
https://github.com/CodeNarc/CodeNarc/blob/9a7cec02cb8cbaf845030f2434309e8968f5d7a7/src/main/java/org/codenarc/util/AstUtil.java#L425-L440
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java
ByteUtils.memcpy
public static int memcpy( byte[] dst, int dst_offset, byte[] src, int src_offset, int length ) { """ Copy contents of one array of <code>bytes</code> into another. If either array is <code>null</code>, simply return the <code>length</code> parameter directly. @param dst the array to write, or <code>null</code> @param dst_offset the start offset in <code>dst</code> @param src the array to read, or <code>null</code> @param src_offset the start offset in <code>src</code> @param length the number of <code>byte</code>s to copy. @return DOCUMENT ME! """ if ((dst != null) && (src != null)) { if (dst.length < (dst_offset + length)) { croak("dst.length = " + dst.length + ", but " + "dst_offset = " + dst_offset + " and length = " + length + "."); } if (src.length < (src_offset + length)) { croak("src.length = " + src.length + ", but " + "src_offset = " + src_offset + " and length = " + length + "."); } for( int i = 0; i < length; ++i, ++dst_offset, ++src_offset ) dst[dst_offset] = src[src_offset]; } return length; }
java
public static int memcpy( byte[] dst, int dst_offset, byte[] src, int src_offset, int length ) { if ((dst != null) && (src != null)) { if (dst.length < (dst_offset + length)) { croak("dst.length = " + dst.length + ", but " + "dst_offset = " + dst_offset + " and length = " + length + "."); } if (src.length < (src_offset + length)) { croak("src.length = " + src.length + ", but " + "src_offset = " + src_offset + " and length = " + length + "."); } for( int i = 0; i < length; ++i, ++dst_offset, ++src_offset ) dst[dst_offset] = src[src_offset]; } return length; }
[ "public", "static", "int", "memcpy", "(", "byte", "[", "]", "dst", ",", "int", "dst_offset", ",", "byte", "[", "]", "src", ",", "int", "src_offset", ",", "int", "length", ")", "{", "if", "(", "(", "dst", "!=", "null", ")", "&&", "(", "src", "!=", "null", ")", ")", "{", "if", "(", "dst", ".", "length", "<", "(", "dst_offset", "+", "length", ")", ")", "{", "croak", "(", "\"dst.length = \"", "+", "dst", ".", "length", "+", "\", but \"", "+", "\"dst_offset = \"", "+", "dst_offset", "+", "\" and length = \"", "+", "length", "+", "\".\"", ")", ";", "}", "if", "(", "src", ".", "length", "<", "(", "src_offset", "+", "length", ")", ")", "{", "croak", "(", "\"src.length = \"", "+", "src", ".", "length", "+", "\", but \"", "+", "\"src_offset = \"", "+", "src_offset", "+", "\" and length = \"", "+", "length", "+", "\".\"", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "++", "i", ",", "++", "dst_offset", ",", "++", "src_offset", ")", "dst", "[", "dst_offset", "]", "=", "src", "[", "src_offset", "]", ";", "}", "return", "length", ";", "}" ]
Copy contents of one array of <code>bytes</code> into another. If either array is <code>null</code>, simply return the <code>length</code> parameter directly. @param dst the array to write, or <code>null</code> @param dst_offset the start offset in <code>dst</code> @param src the array to read, or <code>null</code> @param src_offset the start offset in <code>src</code> @param length the number of <code>byte</code>s to copy. @return DOCUMENT ME!
[ "Copy", "contents", "of", "one", "array", "of", "<code", ">", "bytes<", "/", "code", ">", "into", "another", ".", "If", "either", "array", "is", "<code", ">", "null<", "/", "code", ">", "simply", "return", "the", "<code", ">", "length<", "/", "code", ">", "parameter", "directly", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java#L482-L497
sdl/odata
odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java
EntityDataModelUtil.getAndCheckEntityType
public static EntityType getAndCheckEntityType(EntityDataModel entityDataModel, String typeName) { """ Gets the OData type with a specified name and checks if the OData type is an entity type; throws an exception if the OData type is not an entity type. @param entityDataModel The entity data model. @param typeName The type name. @return The OData entity type with the specified name. @throws ODataSystemException If there is no OData type with the specified name or if the OData type is not an entity type. """ return checkIsEntityType(getAndCheckType(entityDataModel, typeName)); }
java
public static EntityType getAndCheckEntityType(EntityDataModel entityDataModel, String typeName) { return checkIsEntityType(getAndCheckType(entityDataModel, typeName)); }
[ "public", "static", "EntityType", "getAndCheckEntityType", "(", "EntityDataModel", "entityDataModel", ",", "String", "typeName", ")", "{", "return", "checkIsEntityType", "(", "getAndCheckType", "(", "entityDataModel", ",", "typeName", ")", ")", ";", "}" ]
Gets the OData type with a specified name and checks if the OData type is an entity type; throws an exception if the OData type is not an entity type. @param entityDataModel The entity data model. @param typeName The type name. @return The OData entity type with the specified name. @throws ODataSystemException If there is no OData type with the specified name or if the OData type is not an entity type.
[ "Gets", "the", "OData", "type", "with", "a", "specified", "name", "and", "checks", "if", "the", "OData", "type", "is", "an", "entity", "type", ";", "throws", "an", "exception", "if", "the", "OData", "type", "is", "not", "an", "entity", "type", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java#L222-L224
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java
Frame.getInstance
public ValueType getInstance(Instruction ins, ConstantPoolGen cpg) throws DataflowAnalysisException { """ Get the value corresponding to the object instance used in the given instruction. This relies on the observation that in instructions which use an object instance (such as getfield, invokevirtual, etc.), the object instance is the first operand used by the instruction. @param ins the instruction @param cpg the ConstantPoolGen for the method """ return getStackValue(getInstanceStackLocation(ins, cpg)); }
java
public ValueType getInstance(Instruction ins, ConstantPoolGen cpg) throws DataflowAnalysisException { return getStackValue(getInstanceStackLocation(ins, cpg)); }
[ "public", "ValueType", "getInstance", "(", "Instruction", "ins", ",", "ConstantPoolGen", "cpg", ")", "throws", "DataflowAnalysisException", "{", "return", "getStackValue", "(", "getInstanceStackLocation", "(", "ins", ",", "cpg", ")", ")", ";", "}" ]
Get the value corresponding to the object instance used in the given instruction. This relies on the observation that in instructions which use an object instance (such as getfield, invokevirtual, etc.), the object instance is the first operand used by the instruction. @param ins the instruction @param cpg the ConstantPoolGen for the method
[ "Get", "the", "value", "corresponding", "to", "the", "object", "instance", "used", "in", "the", "given", "instruction", ".", "This", "relies", "on", "the", "observation", "that", "in", "instructions", "which", "use", "an", "object", "instance", "(", "such", "as", "getfield", "invokevirtual", "etc", ".", ")", "the", "object", "instance", "is", "the", "first", "operand", "used", "by", "the", "instruction", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java#L282-L284
googlearchive/firebase-simple-login-java
src/main/java/com/firebase/simplelogin/SimpleLogin.java
SimpleLogin.removeUser
public void removeUser(String email, String password, final SimpleLoginCompletionHandler handler) { """ Remove a Firebase "email/password" user. @param email Email address for user. @param password Password for user. @param handler Handler for asynchronous events. """ final SimpleLoginAuthenticatedHandler authHandler = new SimpleLoginAuthenticatedHandler() { public void authenticated(FirebaseSimpleLoginError error, FirebaseSimpleLoginUser user) { handler.completed(error, false); } }; if (!Validation.isValidEmail(email)) { handleInvalidEmail(authHandler); } else if (!Validation.isValidPassword(password)) { handleInvalidPassword(authHandler); } else { HashMap<String, String> data = new HashMap<String, String>(); data.put("email", email); data.put("password", password); makeRequest(Constants.FIREBASE_AUTH_REMOVEUSER_PATH, data, new RequestHandler() { public void handle(FirebaseSimpleLoginError error, JSONObject data) { if(error != null) { handler.completed(error, false); } else { try { JSONObject errorDetails = data.has("error") ? data.getJSONObject("error") : null; if(errorDetails != null) { handler.completed(FirebaseSimpleLoginError.errorFromResponse(errorDetails), false); } else { handler.completed(null, true); } } catch (JSONException e) { e.printStackTrace(); FirebaseSimpleLoginError theError = FirebaseSimpleLoginError.errorFromResponse(null); handler.completed(theError, false); } } } }); } }
java
public void removeUser(String email, String password, final SimpleLoginCompletionHandler handler) { final SimpleLoginAuthenticatedHandler authHandler = new SimpleLoginAuthenticatedHandler() { public void authenticated(FirebaseSimpleLoginError error, FirebaseSimpleLoginUser user) { handler.completed(error, false); } }; if (!Validation.isValidEmail(email)) { handleInvalidEmail(authHandler); } else if (!Validation.isValidPassword(password)) { handleInvalidPassword(authHandler); } else { HashMap<String, String> data = new HashMap<String, String>(); data.put("email", email); data.put("password", password); makeRequest(Constants.FIREBASE_AUTH_REMOVEUSER_PATH, data, new RequestHandler() { public void handle(FirebaseSimpleLoginError error, JSONObject data) { if(error != null) { handler.completed(error, false); } else { try { JSONObject errorDetails = data.has("error") ? data.getJSONObject("error") : null; if(errorDetails != null) { handler.completed(FirebaseSimpleLoginError.errorFromResponse(errorDetails), false); } else { handler.completed(null, true); } } catch (JSONException e) { e.printStackTrace(); FirebaseSimpleLoginError theError = FirebaseSimpleLoginError.errorFromResponse(null); handler.completed(theError, false); } } } }); } }
[ "public", "void", "removeUser", "(", "String", "email", ",", "String", "password", ",", "final", "SimpleLoginCompletionHandler", "handler", ")", "{", "final", "SimpleLoginAuthenticatedHandler", "authHandler", "=", "new", "SimpleLoginAuthenticatedHandler", "(", ")", "{", "public", "void", "authenticated", "(", "FirebaseSimpleLoginError", "error", ",", "FirebaseSimpleLoginUser", "user", ")", "{", "handler", ".", "completed", "(", "error", ",", "false", ")", ";", "}", "}", ";", "if", "(", "!", "Validation", ".", "isValidEmail", "(", "email", ")", ")", "{", "handleInvalidEmail", "(", "authHandler", ")", ";", "}", "else", "if", "(", "!", "Validation", ".", "isValidPassword", "(", "password", ")", ")", "{", "handleInvalidPassword", "(", "authHandler", ")", ";", "}", "else", "{", "HashMap", "<", "String", ",", "String", ">", "data", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "data", ".", "put", "(", "\"email\"", ",", "email", ")", ";", "data", ".", "put", "(", "\"password\"", ",", "password", ")", ";", "makeRequest", "(", "Constants", ".", "FIREBASE_AUTH_REMOVEUSER_PATH", ",", "data", ",", "new", "RequestHandler", "(", ")", "{", "public", "void", "handle", "(", "FirebaseSimpleLoginError", "error", ",", "JSONObject", "data", ")", "{", "if", "(", "error", "!=", "null", ")", "{", "handler", ".", "completed", "(", "error", ",", "false", ")", ";", "}", "else", "{", "try", "{", "JSONObject", "errorDetails", "=", "data", ".", "has", "(", "\"error\"", ")", "?", "data", ".", "getJSONObject", "(", "\"error\"", ")", ":", "null", ";", "if", "(", "errorDetails", "!=", "null", ")", "{", "handler", ".", "completed", "(", "FirebaseSimpleLoginError", ".", "errorFromResponse", "(", "errorDetails", ")", ",", "false", ")", ";", "}", "else", "{", "handler", ".", "completed", "(", "null", ",", "true", ")", ";", "}", "}", "catch", "(", "JSONException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "FirebaseSimpleLoginError", "theError", "=", "FirebaseSimpleLoginError", ".", "errorFromResponse", "(", "null", ")", ";", "handler", ".", "completed", "(", "theError", ",", "false", ")", ";", "}", "}", "}", "}", ")", ";", "}", "}" ]
Remove a Firebase "email/password" user. @param email Email address for user. @param password Password for user. @param handler Handler for asynchronous events.
[ "Remove", "a", "Firebase", "email", "/", "password", "user", "." ]
train
https://github.com/googlearchive/firebase-simple-login-java/blob/40498ad173b5fa69c869ba0d29cec187271fda13/src/main/java/com/firebase/simplelogin/SimpleLogin.java#L460-L502
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCrossConnectionsInner.java
ExpressRouteCrossConnectionsInner.getByResourceGroup
public ExpressRouteCrossConnectionInner getByResourceGroup(String resourceGroupName, String crossConnectionName) { """ Gets details about the specified ExpressRouteCrossConnection. @param resourceGroupName The name of the resource group (peering location of the circuit). @param crossConnectionName The name of the ExpressRouteCrossConnection (service key of the circuit). @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ExpressRouteCrossConnectionInner object if successful. """ return getByResourceGroupWithServiceResponseAsync(resourceGroupName, crossConnectionName).toBlocking().single().body(); }
java
public ExpressRouteCrossConnectionInner getByResourceGroup(String resourceGroupName, String crossConnectionName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, crossConnectionName).toBlocking().single().body(); }
[ "public", "ExpressRouteCrossConnectionInner", "getByResourceGroup", "(", "String", "resourceGroupName", ",", "String", "crossConnectionName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "crossConnectionName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Gets details about the specified ExpressRouteCrossConnection. @param resourceGroupName The name of the resource group (peering location of the circuit). @param crossConnectionName The name of the ExpressRouteCrossConnection (service key of the circuit). @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ExpressRouteCrossConnectionInner object if successful.
[ "Gets", "details", "about", "the", "specified", "ExpressRouteCrossConnection", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCrossConnectionsInner.java#L359-L361
tencentyun/cos-java-sdk
src/main/java/com/qcloud/cos/common_utils/CommonFileUtils.java
CommonFileUtils.getFileContent
public static String getFileContent(String filePath, long offset, int length) throws Exception { """ 获取文件指定块的内容 @param filePath 文件路径 @param offset 偏移量,即从哪里开始读取,单位为字节 @param length 读取的长度,单位为字节 @return 返回读取的内容,实际读取的长度小于等于length @throws Exception """ FileInputStream fileInputStream = null; try { fileInputStream = getFileInputStream(filePath); return getFileContent(fileInputStream, offset, length); } finally { closeFileStream(fileInputStream, filePath); } }
java
public static String getFileContent(String filePath, long offset, int length) throws Exception { FileInputStream fileInputStream = null; try { fileInputStream = getFileInputStream(filePath); return getFileContent(fileInputStream, offset, length); } finally { closeFileStream(fileInputStream, filePath); } }
[ "public", "static", "String", "getFileContent", "(", "String", "filePath", ",", "long", "offset", ",", "int", "length", ")", "throws", "Exception", "{", "FileInputStream", "fileInputStream", "=", "null", ";", "try", "{", "fileInputStream", "=", "getFileInputStream", "(", "filePath", ")", ";", "return", "getFileContent", "(", "fileInputStream", ",", "offset", ",", "length", ")", ";", "}", "finally", "{", "closeFileStream", "(", "fileInputStream", ",", "filePath", ")", ";", "}", "}" ]
获取文件指定块的内容 @param filePath 文件路径 @param offset 偏移量,即从哪里开始读取,单位为字节 @param length 读取的长度,单位为字节 @return 返回读取的内容,实际读取的长度小于等于length @throws Exception
[ "获取文件指定块的内容" ]
train
https://github.com/tencentyun/cos-java-sdk/blob/6709a48f67c1ea7b82a7215f5037d6ccf218b630/src/main/java/com/qcloud/cos/common_utils/CommonFileUtils.java#L96-L104
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/thread/ProcessRunnerTask.java
ProcessRunnerTask.runProcess
public void runProcess(BaseProcess job, Map<String,Object> properties) { """ Run this process. @param job The process to run. @param properties The properties to pass to this process. """ job.init(this, null, properties); job.run(); job.free(); }
java
public void runProcess(BaseProcess job, Map<String,Object> properties) { job.init(this, null, properties); job.run(); job.free(); }
[ "public", "void", "runProcess", "(", "BaseProcess", "job", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "job", ".", "init", "(", "this", ",", "null", ",", "properties", ")", ";", "job", ".", "run", "(", ")", ";", "job", ".", "free", "(", ")", ";", "}" ]
Run this process. @param job The process to run. @param properties The properties to pass to this process.
[ "Run", "this", "process", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/thread/ProcessRunnerTask.java#L149-L154
loldevs/riotapi
rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java
ThrottledApiHandler.getMatchHistory
public Future<List<MatchSummary>> getMatchHistory(long playerId, String[] championIds, QueueType... queueTypes) { """ Retrieve a player's match history, filtering out all games not in the specified queues. @param playerId The id of the player. @param championIds The championIds to use for retrieval. @param queueTypes The queue types to retrieve (must be one of RANKED_SOLO_5x5, RANKED_TEAM_3x3 or RANKED_TEAM_5x5). @return The match history of the player. @see <a href="https://developer.riotgames.com/api/methods#!/805/2847">Official API Documentation</a> """ return new ApiFuture<>(() -> handler.getMatchHistory(playerId, championIds, queueTypes)); }
java
public Future<List<MatchSummary>> getMatchHistory(long playerId, String[] championIds, QueueType... queueTypes) { return new ApiFuture<>(() -> handler.getMatchHistory(playerId, championIds, queueTypes)); }
[ "public", "Future", "<", "List", "<", "MatchSummary", ">", ">", "getMatchHistory", "(", "long", "playerId", ",", "String", "[", "]", "championIds", ",", "QueueType", "...", "queueTypes", ")", "{", "return", "new", "ApiFuture", "<>", "(", "(", ")", "->", "handler", ".", "getMatchHistory", "(", "playerId", ",", "championIds", ",", "queueTypes", ")", ")", ";", "}" ]
Retrieve a player's match history, filtering out all games not in the specified queues. @param playerId The id of the player. @param championIds The championIds to use for retrieval. @param queueTypes The queue types to retrieve (must be one of RANKED_SOLO_5x5, RANKED_TEAM_3x3 or RANKED_TEAM_5x5). @return The match history of the player. @see <a href="https://developer.riotgames.com/api/methods#!/805/2847">Official API Documentation</a>
[ "Retrieve", "a", "player", "s", "match", "history", "filtering", "out", "all", "games", "not", "in", "the", "specified", "queues", "." ]
train
https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L1014-L1016
osglworks/java-tool
src/main/java/org/osgl/util/E.java
E.unexpectedIf
public static void unexpectedIf(boolean tester, String msg, Object... args) { """ Throws out a {@link UnexpectedException} with message and cause specified when `tester` is evaluated to `true`. @param tester when `true` then throw out the exception. @param msg the error message format pattern. @param args the error message format arguments. """ if (tester) { unexpected(msg, args); } }
java
public static void unexpectedIf(boolean tester, String msg, Object... args) { if (tester) { unexpected(msg, args); } }
[ "public", "static", "void", "unexpectedIf", "(", "boolean", "tester", ",", "String", "msg", ",", "Object", "...", "args", ")", "{", "if", "(", "tester", ")", "{", "unexpected", "(", "msg", ",", "args", ")", ";", "}", "}" ]
Throws out a {@link UnexpectedException} with message and cause specified when `tester` is evaluated to `true`. @param tester when `true` then throw out the exception. @param msg the error message format pattern. @param args the error message format arguments.
[ "Throws", "out", "a", "{", "@link", "UnexpectedException", "}", "with", "message", "and", "cause", "specified", "when", "tester", "is", "evaluated", "to", "true", "." ]
train
https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/util/E.java#L217-L221
acromusashi/acromusashi-stream
src/main/java/acromusashi/stream/helper/SpringContextHelper.java
SpringContextHelper.getComponent
public <T> T getComponent(String componentName, Class<T> componentType) { """ アプリケーションコンテキストから指定した名称、型を持つコンポーネントを取得する。 @param componentName コンポーネント名称 @param componentType コンポーネント型 @param <T> 取得するコンポーネントの総称型パラメータ @return 取得コンポーネント """ BeanFactory factory = getBeanFactory(); T component = factory.getBean(componentName, componentType); return component; }
java
public <T> T getComponent(String componentName, Class<T> componentType) { BeanFactory factory = getBeanFactory(); T component = factory.getBean(componentName, componentType); return component; }
[ "public", "<", "T", ">", "T", "getComponent", "(", "String", "componentName", ",", "Class", "<", "T", ">", "componentType", ")", "{", "BeanFactory", "factory", "=", "getBeanFactory", "(", ")", ";", "T", "component", "=", "factory", ".", "getBean", "(", "componentName", ",", "componentType", ")", ";", "return", "component", ";", "}" ]
アプリケーションコンテキストから指定した名称、型を持つコンポーネントを取得する。 @param componentName コンポーネント名称 @param componentType コンポーネント型 @param <T> 取得するコンポーネントの総称型パラメータ @return 取得コンポーネント
[ "アプリケーションコンテキストから指定した名称、型を持つコンポーネントを取得する。" ]
train
https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/helper/SpringContextHelper.java#L71-L76
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationDescImpl.java
AnnotationDescImpl.elementValues
public ElementValuePair[] elementValues() { """ Returns this annotation's elements and their values. Only those explicitly present in the annotation are included, not those assuming their default values. Returns an empty array if there are none. """ List<Pair<MethodSymbol,Attribute>> vals = annotation.values; ElementValuePair res[] = new ElementValuePair[vals.length()]; int i = 0; for (Pair<MethodSymbol,Attribute> val : vals) { res[i++] = new ElementValuePairImpl(env, val.fst, val.snd); } return res; }
java
public ElementValuePair[] elementValues() { List<Pair<MethodSymbol,Attribute>> vals = annotation.values; ElementValuePair res[] = new ElementValuePair[vals.length()]; int i = 0; for (Pair<MethodSymbol,Attribute> val : vals) { res[i++] = new ElementValuePairImpl(env, val.fst, val.snd); } return res; }
[ "public", "ElementValuePair", "[", "]", "elementValues", "(", ")", "{", "List", "<", "Pair", "<", "MethodSymbol", ",", "Attribute", ">", ">", "vals", "=", "annotation", ".", "values", ";", "ElementValuePair", "res", "[", "]", "=", "new", "ElementValuePair", "[", "vals", ".", "length", "(", ")", "]", ";", "int", "i", "=", "0", ";", "for", "(", "Pair", "<", "MethodSymbol", ",", "Attribute", ">", "val", ":", "vals", ")", "{", "res", "[", "i", "++", "]", "=", "new", "ElementValuePairImpl", "(", "env", ",", "val", ".", "fst", ",", "val", ".", "snd", ")", ";", "}", "return", "res", ";", "}" ]
Returns this annotation's elements and their values. Only those explicitly present in the annotation are included, not those assuming their default values. Returns an empty array if there are none.
[ "Returns", "this", "annotation", "s", "elements", "and", "their", "values", ".", "Only", "those", "explicitly", "present", "in", "the", "annotation", "are", "included", "not", "those", "assuming", "their", "default", "values", ".", "Returns", "an", "empty", "array", "if", "there", "are", "none", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationDescImpl.java#L82-L90
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/distort/spherical/EquirectangularTools_F32.java
EquirectangularTools_F32.equiToLatLon
public void equiToLatLon(float x , float y , GeoLL_F32 geo ) { """ Converts the equirectangular coordinate into a latitude and longitude @param x pixel coordinate in equirectangular image @param y pixel coordinate in equirectangular image @param geo (output) """ geo.lon = (x/width - 0.5f)*GrlConstants.F_PI2; geo.lat = (y/(height-1) - 0.5f)*GrlConstants.F_PI; }
java
public void equiToLatLon(float x , float y , GeoLL_F32 geo ) { geo.lon = (x/width - 0.5f)*GrlConstants.F_PI2; geo.lat = (y/(height-1) - 0.5f)*GrlConstants.F_PI; }
[ "public", "void", "equiToLatLon", "(", "float", "x", ",", "float", "y", ",", "GeoLL_F32", "geo", ")", "{", "geo", ".", "lon", "=", "(", "x", "/", "width", "-", "0.5f", ")", "*", "GrlConstants", ".", "F_PI2", ";", "geo", ".", "lat", "=", "(", "y", "/", "(", "height", "-", "1", ")", "-", "0.5f", ")", "*", "GrlConstants", ".", "F_PI", ";", "}" ]
Converts the equirectangular coordinate into a latitude and longitude @param x pixel coordinate in equirectangular image @param y pixel coordinate in equirectangular image @param geo (output)
[ "Converts", "the", "equirectangular", "coordinate", "into", "a", "latitude", "and", "longitude" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/distort/spherical/EquirectangularTools_F32.java#L118-L121
wildfly/wildfly-core
patching/src/main/java/org/jboss/as/patching/metadata/ModificationBuilderTarget.java
ModificationBuilderTarget.removeBundle
public T removeBundle(final String moduleName, final String slot, final byte[] existingHash) { """ Remove a bundle. @param moduleName the module name @param slot the module slot @param existingHash the existing hash @return the builder """ final ContentItem item = createBundleItem(moduleName, slot, NO_CONTENT); addContentModification(createContentModification(item, ModificationType.REMOVE, existingHash)); return returnThis(); }
java
public T removeBundle(final String moduleName, final String slot, final byte[] existingHash) { final ContentItem item = createBundleItem(moduleName, slot, NO_CONTENT); addContentModification(createContentModification(item, ModificationType.REMOVE, existingHash)); return returnThis(); }
[ "public", "T", "removeBundle", "(", "final", "String", "moduleName", ",", "final", "String", "slot", ",", "final", "byte", "[", "]", "existingHash", ")", "{", "final", "ContentItem", "item", "=", "createBundleItem", "(", "moduleName", ",", "slot", ",", "NO_CONTENT", ")", ";", "addContentModification", "(", "createContentModification", "(", "item", ",", "ModificationType", ".", "REMOVE", ",", "existingHash", ")", ")", ";", "return", "returnThis", "(", ")", ";", "}" ]
Remove a bundle. @param moduleName the module name @param slot the module slot @param existingHash the existing hash @return the builder
[ "Remove", "a", "bundle", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/metadata/ModificationBuilderTarget.java#L101-L105
tvesalainen/util
util/src/main/java/org/vesalainen/util/concurrent/RingbufferSupport.java
RingbufferSupport.getBuffers
public ByteBuffer[] getBuffers(int start, int len) { """ Returns array of buffers that contains ringbuffers content in array of ByteBuffers ready for scattering read of gathering write @param start @param len @return @see java.nio.channels.ScatteringByteChannel @see java.nio.channels.GatheringByteChannel """ if (len == 0) { return ar0; } if (len > capacity) { throw new IllegalArgumentException("len="+len+" > capacity="+capacity); } int s = start % capacity; int e = (start+len) % capacity; return getBuffersForSpan(s, e); }
java
public ByteBuffer[] getBuffers(int start, int len) { if (len == 0) { return ar0; } if (len > capacity) { throw new IllegalArgumentException("len="+len+" > capacity="+capacity); } int s = start % capacity; int e = (start+len) % capacity; return getBuffersForSpan(s, e); }
[ "public", "ByteBuffer", "[", "]", "getBuffers", "(", "int", "start", ",", "int", "len", ")", "{", "if", "(", "len", "==", "0", ")", "{", "return", "ar0", ";", "}", "if", "(", "len", ">", "capacity", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"len=\"", "+", "len", "+", "\" > capacity=\"", "+", "capacity", ")", ";", "}", "int", "s", "=", "start", "%", "capacity", ";", "int", "e", "=", "(", "start", "+", "len", ")", "%", "capacity", ";", "return", "getBuffersForSpan", "(", "s", ",", "e", ")", ";", "}" ]
Returns array of buffers that contains ringbuffers content in array of ByteBuffers ready for scattering read of gathering write @param start @param len @return @see java.nio.channels.ScatteringByteChannel @see java.nio.channels.GatheringByteChannel
[ "Returns", "array", "of", "buffers", "that", "contains", "ringbuffers", "content", "in", "array", "of", "ByteBuffers", "ready", "for", "scattering", "read", "of", "gathering", "write" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/concurrent/RingbufferSupport.java#L59-L72
apereo/cas
core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/CoreAuthenticationUtils.java
CoreAuthenticationUtils.isRememberMeAuthentication
public static boolean isRememberMeAuthentication(final Authentication model, final Assertion assertion) { """ Is remember me authentication? looks at the authentication object to find {@link RememberMeCredential#AUTHENTICATION_ATTRIBUTE_REMEMBER_ME} and expects the assertion to also note a new login session. @param model the model @param assertion the assertion @return true if remember-me, false if otherwise. """ val authnAttributes = model.getAttributes(); val authnMethod = authnAttributes.get(RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME); return authnMethod != null && authnMethod.contains(Boolean.TRUE) && assertion.isFromNewLogin(); }
java
public static boolean isRememberMeAuthentication(final Authentication model, final Assertion assertion) { val authnAttributes = model.getAttributes(); val authnMethod = authnAttributes.get(RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME); return authnMethod != null && authnMethod.contains(Boolean.TRUE) && assertion.isFromNewLogin(); }
[ "public", "static", "boolean", "isRememberMeAuthentication", "(", "final", "Authentication", "model", ",", "final", "Assertion", "assertion", ")", "{", "val", "authnAttributes", "=", "model", ".", "getAttributes", "(", ")", ";", "val", "authnMethod", "=", "authnAttributes", ".", "get", "(", "RememberMeCredential", ".", "AUTHENTICATION_ATTRIBUTE_REMEMBER_ME", ")", ";", "return", "authnMethod", "!=", "null", "&&", "authnMethod", ".", "contains", "(", "Boolean", ".", "TRUE", ")", "&&", "assertion", ".", "isFromNewLogin", "(", ")", ";", "}" ]
Is remember me authentication? looks at the authentication object to find {@link RememberMeCredential#AUTHENTICATION_ATTRIBUTE_REMEMBER_ME} and expects the assertion to also note a new login session. @param model the model @param assertion the assertion @return true if remember-me, false if otherwise.
[ "Is", "remember", "me", "authentication?", "looks", "at", "the", "authentication", "object", "to", "find", "{", "@link", "RememberMeCredential#AUTHENTICATION_ATTRIBUTE_REMEMBER_ME", "}", "and", "expects", "the", "assertion", "to", "also", "note", "a", "new", "login", "session", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/CoreAuthenticationUtils.java#L143-L147
alkacon/opencms-core
src/org/opencms/flex/CmsFlexCacheEntry.java
CmsFlexCacheEntry.addHeaders
public void addHeaders(Map<String, List<String>> headers) { """ Add a map of headers to this cache entry, which are usually collected in the class CmsFlexResponse first.<p> @param headers the map of headers to add to the entry """ if (m_completed) { return; } m_headers = headers; Iterator<String> allHeaders = m_headers.keySet().iterator(); while (allHeaders.hasNext()) { m_byteSize += CmsMemoryMonitor.getMemorySize(allHeaders.next()); } }
java
public void addHeaders(Map<String, List<String>> headers) { if (m_completed) { return; } m_headers = headers; Iterator<String> allHeaders = m_headers.keySet().iterator(); while (allHeaders.hasNext()) { m_byteSize += CmsMemoryMonitor.getMemorySize(allHeaders.next()); } }
[ "public", "void", "addHeaders", "(", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "headers", ")", "{", "if", "(", "m_completed", ")", "{", "return", ";", "}", "m_headers", "=", "headers", ";", "Iterator", "<", "String", ">", "allHeaders", "=", "m_headers", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "allHeaders", ".", "hasNext", "(", ")", ")", "{", "m_byteSize", "+=", "CmsMemoryMonitor", ".", "getMemorySize", "(", "allHeaders", ".", "next", "(", ")", ")", ";", "}", "}" ]
Add a map of headers to this cache entry, which are usually collected in the class CmsFlexResponse first.<p> @param headers the map of headers to add to the entry
[ "Add", "a", "map", "of", "headers", "to", "this", "cache", "entry", "which", "are", "usually", "collected", "in", "the", "class", "CmsFlexResponse", "first", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/flex/CmsFlexCacheEntry.java#L195-L206
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectCalendar.java
ProjectCalendar.getDaysInRange
private int getDaysInRange(Date startDate, Date endDate) { """ This method calculates the absolute number of days between two dates. Note that where two date objects are provided that fall on the same day, this method will return one not zero. Note also that this method assumes that the dates are passed in the correct order, i.e. startDate < endDate. @param startDate Start date @param endDate End date @return number of days in the date range """ int result; Calendar cal = DateHelper.popCalendar(endDate); int endDateYear = cal.get(Calendar.YEAR); int endDateDayOfYear = cal.get(Calendar.DAY_OF_YEAR); cal.setTime(startDate); if (endDateYear == cal.get(Calendar.YEAR)) { result = (endDateDayOfYear - cal.get(Calendar.DAY_OF_YEAR)) + 1; } else { result = 0; do { result += (cal.getActualMaximum(Calendar.DAY_OF_YEAR) - cal.get(Calendar.DAY_OF_YEAR)) + 1; cal.roll(Calendar.YEAR, 1); cal.set(Calendar.DAY_OF_YEAR, 1); } while (cal.get(Calendar.YEAR) < endDateYear); result += endDateDayOfYear; } DateHelper.pushCalendar(cal); return result; }
java
private int getDaysInRange(Date startDate, Date endDate) { int result; Calendar cal = DateHelper.popCalendar(endDate); int endDateYear = cal.get(Calendar.YEAR); int endDateDayOfYear = cal.get(Calendar.DAY_OF_YEAR); cal.setTime(startDate); if (endDateYear == cal.get(Calendar.YEAR)) { result = (endDateDayOfYear - cal.get(Calendar.DAY_OF_YEAR)) + 1; } else { result = 0; do { result += (cal.getActualMaximum(Calendar.DAY_OF_YEAR) - cal.get(Calendar.DAY_OF_YEAR)) + 1; cal.roll(Calendar.YEAR, 1); cal.set(Calendar.DAY_OF_YEAR, 1); } while (cal.get(Calendar.YEAR) < endDateYear); result += endDateDayOfYear; } DateHelper.pushCalendar(cal); return result; }
[ "private", "int", "getDaysInRange", "(", "Date", "startDate", ",", "Date", "endDate", ")", "{", "int", "result", ";", "Calendar", "cal", "=", "DateHelper", ".", "popCalendar", "(", "endDate", ")", ";", "int", "endDateYear", "=", "cal", ".", "get", "(", "Calendar", ".", "YEAR", ")", ";", "int", "endDateDayOfYear", "=", "cal", ".", "get", "(", "Calendar", ".", "DAY_OF_YEAR", ")", ";", "cal", ".", "setTime", "(", "startDate", ")", ";", "if", "(", "endDateYear", "==", "cal", ".", "get", "(", "Calendar", ".", "YEAR", ")", ")", "{", "result", "=", "(", "endDateDayOfYear", "-", "cal", ".", "get", "(", "Calendar", ".", "DAY_OF_YEAR", ")", ")", "+", "1", ";", "}", "else", "{", "result", "=", "0", ";", "do", "{", "result", "+=", "(", "cal", ".", "getActualMaximum", "(", "Calendar", ".", "DAY_OF_YEAR", ")", "-", "cal", ".", "get", "(", "Calendar", ".", "DAY_OF_YEAR", ")", ")", "+", "1", ";", "cal", ".", "roll", "(", "Calendar", ".", "YEAR", ",", "1", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "DAY_OF_YEAR", ",", "1", ")", ";", "}", "while", "(", "cal", ".", "get", "(", "Calendar", ".", "YEAR", ")", "<", "endDateYear", ")", ";", "result", "+=", "endDateDayOfYear", ";", "}", "DateHelper", ".", "pushCalendar", "(", "cal", ")", ";", "return", "result", ";", "}" ]
This method calculates the absolute number of days between two dates. Note that where two date objects are provided that fall on the same day, this method will return one not zero. Note also that this method assumes that the dates are passed in the correct order, i.e. startDate < endDate. @param startDate Start date @param endDate End date @return number of days in the date range
[ "This", "method", "calculates", "the", "absolute", "number", "of", "days", "between", "two", "dates", ".", "Note", "that", "where", "two", "date", "objects", "are", "provided", "that", "fall", "on", "the", "same", "day", "this", "method", "will", "return", "one", "not", "zero", ".", "Note", "also", "that", "this", "method", "assumes", "that", "the", "dates", "are", "passed", "in", "the", "correct", "order", "i", ".", "e", ".", "startDate", "<", "endDate", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendar.java#L978-L1006
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/util/SequenceTools.java
SequenceTools.permuteCyclic
public static String permuteCyclic(String string, int n) { """ Cyclically permute the characters in {@code string} <em>forward</em> by {@code n} elements. @param string The string to permute @param n The number of characters to permute by; can be positive or negative; values greater than the length of the array are acceptable """ // single letters are char[]; full names are Character[] Character[] permuted = new Character[string.length()]; char[] c = string.toCharArray(); Character[] charArray = new Character[c.length]; for (int i = 0; i < c.length; i++) { charArray[i] = c[i]; } permuteCyclic(charArray, permuted, n); char[] p = new char[permuted.length]; for (int i = 0; i < p.length; i++) { p[i] = permuted[i]; } return String.valueOf(p); }
java
public static String permuteCyclic(String string, int n) { // single letters are char[]; full names are Character[] Character[] permuted = new Character[string.length()]; char[] c = string.toCharArray(); Character[] charArray = new Character[c.length]; for (int i = 0; i < c.length; i++) { charArray[i] = c[i]; } permuteCyclic(charArray, permuted, n); char[] p = new char[permuted.length]; for (int i = 0; i < p.length; i++) { p[i] = permuted[i]; } return String.valueOf(p); }
[ "public", "static", "String", "permuteCyclic", "(", "String", "string", ",", "int", "n", ")", "{", "// single letters are char[]; full names are Character[]", "Character", "[", "]", "permuted", "=", "new", "Character", "[", "string", ".", "length", "(", ")", "]", ";", "char", "[", "]", "c", "=", "string", ".", "toCharArray", "(", ")", ";", "Character", "[", "]", "charArray", "=", "new", "Character", "[", "c", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "c", ".", "length", ";", "i", "++", ")", "{", "charArray", "[", "i", "]", "=", "c", "[", "i", "]", ";", "}", "permuteCyclic", "(", "charArray", ",", "permuted", ",", "n", ")", ";", "char", "[", "]", "p", "=", "new", "char", "[", "permuted", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "p", ".", "length", ";", "i", "++", ")", "{", "p", "[", "i", "]", "=", "permuted", "[", "i", "]", ";", "}", "return", "String", ".", "valueOf", "(", "p", ")", ";", "}" ]
Cyclically permute the characters in {@code string} <em>forward</em> by {@code n} elements. @param string The string to permute @param n The number of characters to permute by; can be positive or negative; values greater than the length of the array are acceptable
[ "Cyclically", "permute", "the", "characters", "in", "{" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/util/SequenceTools.java#L37-L51
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/HistoryHandler.java
HistoryHandler.init
public void init(Record record, Record recHistory, String iHistoryDateSeq, BaseField fldSourceHistoryDate, boolean bCloseOnFree, String strRecHistoryClass, String iSourceHistoryDateSeq) { """ Constructor. @param record My owner (usually passed as null, and set on addListener in setOwner()). @param recHistory The history record. @param iHistoryDate The last changed date in the history record. @param fldSourceHistoryDate Where to get the date changed (if null, use current time). @param bConfirmOnChange If true, ask the user if the changes are okay before writing them. @param bCloseOnFree Close the history file when this record is freed (default true). """ if (iHistoryDateSeq == null) iHistoryDateSeq = recHistory.getField(recHistory.getFieldCount() - 1).getFieldName(); // Last field m_iHistoryDateSeq = iHistoryDateSeq; m_fldSourceHistoryDate = fldSourceHistoryDate; m_strRecHistoryClass = strRecHistoryClass; m_iSourceDateSeq = iSourceHistoryDateSeq; super.init(record, null, recHistory, bCloseOnFree); if (m_recDependent != null) { if (m_recDependent.getListener(RecordChangedHandler.class) != null) m_recDependent.removeListener(m_recDependent.getListener(RecordChangedHandler.class), true); // I replace this listener } this.setMasterSlaveFlag(FileListener.RUN_IN_SLAVE); // This runs on the slave (if there is a slave) }
java
public void init(Record record, Record recHistory, String iHistoryDateSeq, BaseField fldSourceHistoryDate, boolean bCloseOnFree, String strRecHistoryClass, String iSourceHistoryDateSeq) { if (iHistoryDateSeq == null) iHistoryDateSeq = recHistory.getField(recHistory.getFieldCount() - 1).getFieldName(); // Last field m_iHistoryDateSeq = iHistoryDateSeq; m_fldSourceHistoryDate = fldSourceHistoryDate; m_strRecHistoryClass = strRecHistoryClass; m_iSourceDateSeq = iSourceHistoryDateSeq; super.init(record, null, recHistory, bCloseOnFree); if (m_recDependent != null) { if (m_recDependent.getListener(RecordChangedHandler.class) != null) m_recDependent.removeListener(m_recDependent.getListener(RecordChangedHandler.class), true); // I replace this listener } this.setMasterSlaveFlag(FileListener.RUN_IN_SLAVE); // This runs on the slave (if there is a slave) }
[ "public", "void", "init", "(", "Record", "record", ",", "Record", "recHistory", ",", "String", "iHistoryDateSeq", ",", "BaseField", "fldSourceHistoryDate", ",", "boolean", "bCloseOnFree", ",", "String", "strRecHistoryClass", ",", "String", "iSourceHistoryDateSeq", ")", "{", "if", "(", "iHistoryDateSeq", "==", "null", ")", "iHistoryDateSeq", "=", "recHistory", ".", "getField", "(", "recHistory", ".", "getFieldCount", "(", ")", "-", "1", ")", ".", "getFieldName", "(", ")", ";", "// Last field", "m_iHistoryDateSeq", "=", "iHistoryDateSeq", ";", "m_fldSourceHistoryDate", "=", "fldSourceHistoryDate", ";", "m_strRecHistoryClass", "=", "strRecHistoryClass", ";", "m_iSourceDateSeq", "=", "iSourceHistoryDateSeq", ";", "super", ".", "init", "(", "record", ",", "null", ",", "recHistory", ",", "bCloseOnFree", ")", ";", "if", "(", "m_recDependent", "!=", "null", ")", "{", "if", "(", "m_recDependent", ".", "getListener", "(", "RecordChangedHandler", ".", "class", ")", "!=", "null", ")", "m_recDependent", ".", "removeListener", "(", "m_recDependent", ".", "getListener", "(", "RecordChangedHandler", ".", "class", ")", ",", "true", ")", ";", "// I replace this listener", "}", "this", ".", "setMasterSlaveFlag", "(", "FileListener", ".", "RUN_IN_SLAVE", ")", ";", "// This runs on the slave (if there is a slave)", "}" ]
Constructor. @param record My owner (usually passed as null, and set on addListener in setOwner()). @param recHistory The history record. @param iHistoryDate The last changed date in the history record. @param fldSourceHistoryDate Where to get the date changed (if null, use current time). @param bConfirmOnChange If true, ask the user if the changes are okay before writing them. @param bCloseOnFree Close the history file when this record is freed (default true).
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/HistoryHandler.java#L108-L125
UrielCh/ovh-java-sdk
ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java
ApiOvhIpLoadbalancing.serviceName_vrack_network_vrackNetworkId_PUT
public void serviceName_vrack_network_vrackNetworkId_PUT(String serviceName, Long vrackNetworkId, OvhVrackNetwork body) throws IOException { """ Alter this object properties REST: PUT /ipLoadbalancing/{serviceName}/vrack/network/{vrackNetworkId} @param body [required] New object properties @param serviceName [required] The internal name of your IP load balancing @param vrackNetworkId [required] Internal Load Balancer identifier of the vRack private network description API beta """ String qPath = "/ipLoadbalancing/{serviceName}/vrack/network/{vrackNetworkId}"; StringBuilder sb = path(qPath, serviceName, vrackNetworkId); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_vrack_network_vrackNetworkId_PUT(String serviceName, Long vrackNetworkId, OvhVrackNetwork body) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/vrack/network/{vrackNetworkId}"; StringBuilder sb = path(qPath, serviceName, vrackNetworkId); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_vrack_network_vrackNetworkId_PUT", "(", "String", "serviceName", ",", "Long", "vrackNetworkId", ",", "OvhVrackNetwork", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ipLoadbalancing/{serviceName}/vrack/network/{vrackNetworkId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "vrackNetworkId", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /ipLoadbalancing/{serviceName}/vrack/network/{vrackNetworkId} @param body [required] New object properties @param serviceName [required] The internal name of your IP load balancing @param vrackNetworkId [required] Internal Load Balancer identifier of the vRack private network description API beta
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L1126-L1130
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/executiongraph/ExecutionGraph.java
ExecutionGraph.jobHasFinishedStatus
private boolean jobHasFinishedStatus() { """ Checks whether the job represented by the execution graph has the status <code>FINISHED</code>. @return <code>true</code> if the job has the status <code>CREATED</code>, <code>false</code> otherwise """ final Iterator<ExecutionVertex> it = new ExecutionGraphIterator(this, true); while (it.hasNext()) { if (it.next().getExecutionState() != ExecutionState.FINISHED) { return false; } } return true; }
java
private boolean jobHasFinishedStatus() { final Iterator<ExecutionVertex> it = new ExecutionGraphIterator(this, true); while (it.hasNext()) { if (it.next().getExecutionState() != ExecutionState.FINISHED) { return false; } } return true; }
[ "private", "boolean", "jobHasFinishedStatus", "(", ")", "{", "final", "Iterator", "<", "ExecutionVertex", ">", "it", "=", "new", "ExecutionGraphIterator", "(", "this", ",", "true", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "if", "(", "it", ".", "next", "(", ")", ".", "getExecutionState", "(", ")", "!=", "ExecutionState", ".", "FINISHED", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Checks whether the job represented by the execution graph has the status <code>FINISHED</code>. @return <code>true</code> if the job has the status <code>CREATED</code>, <code>false</code> otherwise
[ "Checks", "whether", "the", "job", "represented", "by", "the", "execution", "graph", "has", "the", "status", "<code", ">", "FINISHED<", "/", "code", ">", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/executiongraph/ExecutionGraph.java#L1041-L1053