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
buschmais/jqa-core-framework
rule/src/main/java/com/buschmais/jqassistant/core/rule/impl/reader/AsciidocRuleParserPlugin.java
AsciidocRuleParserPlugin.extractRules
private void extractRules(RuleSource ruleSource, Collection<?> blocks, RuleSetBuilder builder) throws RuleException { """ Find all content parts representing source code listings with a role that represents a rule. @param ruleSource The rule source. @param blocks The content parts of the document. @param builder The {@link RuleSetBuilder}. """ for (Object element : blocks) { if (element instanceof AbstractBlock) { AbstractBlock block = (AbstractBlock) element; if (EXECUTABLE_RULE_TYPES.contains(block.getRole())) { extractExecutableRule(ruleSource, block, builder); } else if (GROUP.equals(block.getRole())) { extractGroup(ruleSource, block, builder); } extractRules(ruleSource, block.getBlocks(), builder); } else if (element instanceof Collection<?>) { extractRules(ruleSource, (Collection<?>) element, builder); } } }
java
private void extractRules(RuleSource ruleSource, Collection<?> blocks, RuleSetBuilder builder) throws RuleException { for (Object element : blocks) { if (element instanceof AbstractBlock) { AbstractBlock block = (AbstractBlock) element; if (EXECUTABLE_RULE_TYPES.contains(block.getRole())) { extractExecutableRule(ruleSource, block, builder); } else if (GROUP.equals(block.getRole())) { extractGroup(ruleSource, block, builder); } extractRules(ruleSource, block.getBlocks(), builder); } else if (element instanceof Collection<?>) { extractRules(ruleSource, (Collection<?>) element, builder); } } }
[ "private", "void", "extractRules", "(", "RuleSource", "ruleSource", ",", "Collection", "<", "?", ">", "blocks", ",", "RuleSetBuilder", "builder", ")", "throws", "RuleException", "{", "for", "(", "Object", "element", ":", "blocks", ")", "{", "if", "(", "element", "instanceof", "AbstractBlock", ")", "{", "AbstractBlock", "block", "=", "(", "AbstractBlock", ")", "element", ";", "if", "(", "EXECUTABLE_RULE_TYPES", ".", "contains", "(", "block", ".", "getRole", "(", ")", ")", ")", "{", "extractExecutableRule", "(", "ruleSource", ",", "block", ",", "builder", ")", ";", "}", "else", "if", "(", "GROUP", ".", "equals", "(", "block", ".", "getRole", "(", ")", ")", ")", "{", "extractGroup", "(", "ruleSource", ",", "block", ",", "builder", ")", ";", "}", "extractRules", "(", "ruleSource", ",", "block", ".", "getBlocks", "(", ")", ",", "builder", ")", ";", "}", "else", "if", "(", "element", "instanceof", "Collection", "<", "?", ">", ")", "{", "extractRules", "(", "ruleSource", ",", "(", "Collection", "<", "?", ">", ")", "element", ",", "builder", ")", ";", "}", "}", "}" ]
Find all content parts representing source code listings with a role that represents a rule. @param ruleSource The rule source. @param blocks The content parts of the document. @param builder The {@link RuleSetBuilder}.
[ "Find", "all", "content", "parts", "representing", "source", "code", "listings", "with", "a", "role", "that", "represents", "a", "rule", "." ]
train
https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/rule/src/main/java/com/buschmais/jqassistant/core/rule/impl/reader/AsciidocRuleParserPlugin.java#L152-L166
looly/hutool
hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java
DateUtil.betweenMonth
public static long betweenMonth(Date beginDate, Date endDate, boolean isReset) { """ 计算两个日期相差月数<br> 在非重置情况下,如果起始日期的天小于结束日期的天,月数要少算1(不足1个月) @param beginDate 起始日期 @param endDate 结束日期 @param isReset 是否重置时间为起始时间(重置天时分秒) @return 相差月数 @since 3.0.8 """ return new DateBetween(beginDate, endDate).betweenMonth(isReset); }
java
public static long betweenMonth(Date beginDate, Date endDate, boolean isReset) { return new DateBetween(beginDate, endDate).betweenMonth(isReset); }
[ "public", "static", "long", "betweenMonth", "(", "Date", "beginDate", ",", "Date", "endDate", ",", "boolean", "isReset", ")", "{", "return", "new", "DateBetween", "(", "beginDate", ",", "endDate", ")", ".", "betweenMonth", "(", "isReset", ")", ";", "}" ]
计算两个日期相差月数<br> 在非重置情况下,如果起始日期的天小于结束日期的天,月数要少算1(不足1个月) @param beginDate 起始日期 @param endDate 结束日期 @param isReset 是否重置时间为起始时间(重置天时分秒) @return 相差月数 @since 3.0.8
[ "计算两个日期相差月数<br", ">", "在非重置情况下,如果起始日期的天小于结束日期的天,月数要少算1(不足1个月)" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L1292-L1294
codelibs/jcifs
src/main/java/jcifs/smb1/smb1/NtlmPasswordAuthentication.java
NtlmPasswordAuthentication.getAnsiHash
public byte[] getAnsiHash( byte[] challenge ) { """ Computes the 24 byte ANSI password hash given the 8 byte server challenge. """ if( hashesExternal ) { return ansiHash; } switch (LM_COMPATIBILITY) { case 0: case 1: return getPreNTLMResponse( password, challenge ); case 2: return getNTLMResponse( password, challenge ); case 3: case 4: case 5: if( clientChallenge == null ) { clientChallenge = new byte[8]; RANDOM.nextBytes( clientChallenge ); } return getLMv2Response(domain, username, password, challenge, clientChallenge); default: return getPreNTLMResponse( password, challenge ); } }
java
public byte[] getAnsiHash( byte[] challenge ) { if( hashesExternal ) { return ansiHash; } switch (LM_COMPATIBILITY) { case 0: case 1: return getPreNTLMResponse( password, challenge ); case 2: return getNTLMResponse( password, challenge ); case 3: case 4: case 5: if( clientChallenge == null ) { clientChallenge = new byte[8]; RANDOM.nextBytes( clientChallenge ); } return getLMv2Response(domain, username, password, challenge, clientChallenge); default: return getPreNTLMResponse( password, challenge ); } }
[ "public", "byte", "[", "]", "getAnsiHash", "(", "byte", "[", "]", "challenge", ")", "{", "if", "(", "hashesExternal", ")", "{", "return", "ansiHash", ";", "}", "switch", "(", "LM_COMPATIBILITY", ")", "{", "case", "0", ":", "case", "1", ":", "return", "getPreNTLMResponse", "(", "password", ",", "challenge", ")", ";", "case", "2", ":", "return", "getNTLMResponse", "(", "password", ",", "challenge", ")", ";", "case", "3", ":", "case", "4", ":", "case", "5", ":", "if", "(", "clientChallenge", "==", "null", ")", "{", "clientChallenge", "=", "new", "byte", "[", "8", "]", ";", "RANDOM", ".", "nextBytes", "(", "clientChallenge", ")", ";", "}", "return", "getLMv2Response", "(", "domain", ",", "username", ",", "password", ",", "challenge", ",", "clientChallenge", ")", ";", "default", ":", "return", "getPreNTLMResponse", "(", "password", ",", "challenge", ")", ";", "}", "}" ]
Computes the 24 byte ANSI password hash given the 8 byte server challenge.
[ "Computes", "the", "24", "byte", "ANSI", "password", "hash", "given", "the", "8", "byte", "server", "challenge", "." ]
train
https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/smb1/NtlmPasswordAuthentication.java#L414-L436
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/SimpleGroupMember.java
SimpleGroupMember.findMenu
protected JMenuItem findMenu(AbstractCommand attachedCommand, List abstractButtons) { """ Searches the given list of {@link AbstractButton}s for one that is an instance of a {@link JMenuItem} and has the given command attached to it. If found, the menu item will be removed from the list. @param attachedCommand The command that we are checking to see if it attached to any item in the list. @param abstractButtons The collection of {@link AbstractButton}s that will be checked to see if they have the given command attached to them. May be null or empty. @return The element from the list that the given command is attached to, or null if no such element could be found. """ if (abstractButtons == null) { return null; } for (Iterator it = abstractButtons.iterator(); it.hasNext();) { AbstractButton button = (AbstractButton)it.next(); if (button instanceof JMenuItem && attachedCommand.isAttached(button)) { it.remove(); return (JMenuItem)button; } } return null; }
java
protected JMenuItem findMenu(AbstractCommand attachedCommand, List abstractButtons) { if (abstractButtons == null) { return null; } for (Iterator it = abstractButtons.iterator(); it.hasNext();) { AbstractButton button = (AbstractButton)it.next(); if (button instanceof JMenuItem && attachedCommand.isAttached(button)) { it.remove(); return (JMenuItem)button; } } return null; }
[ "protected", "JMenuItem", "findMenu", "(", "AbstractCommand", "attachedCommand", ",", "List", "abstractButtons", ")", "{", "if", "(", "abstractButtons", "==", "null", ")", "{", "return", "null", ";", "}", "for", "(", "Iterator", "it", "=", "abstractButtons", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "AbstractButton", "button", "=", "(", "AbstractButton", ")", "it", ".", "next", "(", ")", ";", "if", "(", "button", "instanceof", "JMenuItem", "&&", "attachedCommand", ".", "isAttached", "(", "button", ")", ")", "{", "it", ".", "remove", "(", ")", ";", "return", "(", "JMenuItem", ")", "button", ";", "}", "}", "return", "null", ";", "}" ]
Searches the given list of {@link AbstractButton}s for one that is an instance of a {@link JMenuItem} and has the given command attached to it. If found, the menu item will be removed from the list. @param attachedCommand The command that we are checking to see if it attached to any item in the list. @param abstractButtons The collection of {@link AbstractButton}s that will be checked to see if they have the given command attached to them. May be null or empty. @return The element from the list that the given command is attached to, or null if no such element could be found.
[ "Searches", "the", "given", "list", "of", "{", "@link", "AbstractButton", "}", "s", "for", "one", "that", "is", "an", "instance", "of", "a", "{", "@link", "JMenuItem", "}", "and", "has", "the", "given", "command", "attached", "to", "it", ".", "If", "found", "the", "menu", "item", "will", "be", "removed", "from", "the", "list", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/SimpleGroupMember.java#L135-L149
m-m-m/util
lang/src/main/java/net/sf/mmm/util/lang/api/ComparatorHelper.java
ComparatorHelper.evalComparable
@SuppressWarnings( { """ Logic for {@link CompareOperator#eval(Object, Object)} with {@link Comparable} arguments. @param comparator is the {@link CompareOperator}. @param arg1 is the first argument. @param arg2 is the second argument. @return the result of the {@link CompareOperator} applied to the given arguments. """ "rawtypes", "unchecked" }) static boolean evalComparable(CompareOperator comparator, Comparable arg1, Comparable arg2) { Class<?> type1 = arg1.getClass(); Class<?> type2 = arg2.getClass(); int delta; if (type1.equals(type2) || type1.isAssignableFrom(type2)) { delta = signum(arg1.compareTo(arg2)); } else if (type2.isAssignableFrom(type1)) { delta = -signum(arg2.compareTo(arg1)); } else { // incompatible comparables return (arg1.equals(arg2) == comparator.isTrueIfEquals()); } return comparator.eval(delta); }
java
@SuppressWarnings({ "rawtypes", "unchecked" }) static boolean evalComparable(CompareOperator comparator, Comparable arg1, Comparable arg2) { Class<?> type1 = arg1.getClass(); Class<?> type2 = arg2.getClass(); int delta; if (type1.equals(type2) || type1.isAssignableFrom(type2)) { delta = signum(arg1.compareTo(arg2)); } else if (type2.isAssignableFrom(type1)) { delta = -signum(arg2.compareTo(arg1)); } else { // incompatible comparables return (arg1.equals(arg2) == comparator.isTrueIfEquals()); } return comparator.eval(delta); }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "static", "boolean", "evalComparable", "(", "CompareOperator", "comparator", ",", "Comparable", "arg1", ",", "Comparable", "arg2", ")", "{", "Class", "<", "?", ">", "type1", "=", "arg1", ".", "getClass", "(", ")", ";", "Class", "<", "?", ">", "type2", "=", "arg2", ".", "getClass", "(", ")", ";", "int", "delta", ";", "if", "(", "type1", ".", "equals", "(", "type2", ")", "||", "type1", ".", "isAssignableFrom", "(", "type2", ")", ")", "{", "delta", "=", "signum", "(", "arg1", ".", "compareTo", "(", "arg2", ")", ")", ";", "}", "else", "if", "(", "type2", ".", "isAssignableFrom", "(", "type1", ")", ")", "{", "delta", "=", "-", "signum", "(", "arg2", ".", "compareTo", "(", "arg1", ")", ")", ";", "}", "else", "{", "// incompatible comparables", "return", "(", "arg1", ".", "equals", "(", "arg2", ")", "==", "comparator", ".", "isTrueIfEquals", "(", ")", ")", ";", "}", "return", "comparator", ".", "eval", "(", "delta", ")", ";", "}" ]
Logic for {@link CompareOperator#eval(Object, Object)} with {@link Comparable} arguments. @param comparator is the {@link CompareOperator}. @param arg1 is the first argument. @param arg2 is the second argument. @return the result of the {@link CompareOperator} applied to the given arguments.
[ "Logic", "for", "{", "@link", "CompareOperator#eval", "(", "Object", "Object", ")", "}", "with", "{", "@link", "Comparable", "}", "arguments", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/lang/src/main/java/net/sf/mmm/util/lang/api/ComparatorHelper.java#L68-L83
aequologica/geppaequo
geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/auth/MethodUtils.java
MethodUtils.getAccessibleMethod
public static Method getAccessibleMethod( Class<?> clazz, String methodName, Class<?> parameterType) { """ <p>Return an accessible method (that is, one that can be invoked via reflection) with given name and a single parameter. If no such method can be found, return <code>null</code>. Basically, a convenience wrapper that constructs a <code>Class</code> array for you.</p> @param clazz get method from this class @param methodName get method with this name @param parameterType taking this type of parameter @return The accessible method """ Class<?>[] parameterTypes = {parameterType}; return getAccessibleMethod(clazz, methodName, parameterTypes); }
java
public static Method getAccessibleMethod( Class<?> clazz, String methodName, Class<?> parameterType) { Class<?>[] parameterTypes = {parameterType}; return getAccessibleMethod(clazz, methodName, parameterTypes); }
[ "public", "static", "Method", "getAccessibleMethod", "(", "Class", "<", "?", ">", "clazz", ",", "String", "methodName", ",", "Class", "<", "?", ">", "parameterType", ")", "{", "Class", "<", "?", ">", "[", "]", "parameterTypes", "=", "{", "parameterType", "}", ";", "return", "getAccessibleMethod", "(", "clazz", ",", "methodName", ",", "parameterTypes", ")", ";", "}" ]
<p>Return an accessible method (that is, one that can be invoked via reflection) with given name and a single parameter. If no such method can be found, return <code>null</code>. Basically, a convenience wrapper that constructs a <code>Class</code> array for you.</p> @param clazz get method from this class @param methodName get method with this name @param parameterType taking this type of parameter @return The accessible method
[ "<p", ">", "Return", "an", "accessible", "method", "(", "that", "is", "one", "that", "can", "be", "invoked", "via", "reflection", ")", "with", "given", "name", "and", "a", "single", "parameter", ".", "If", "no", "such", "method", "can", "be", "found", "return", "<code", ">", "null<", "/", "code", ">", ".", "Basically", "a", "convenience", "wrapper", "that", "constructs", "a", "<code", ">", "Class<", "/", "code", ">", "array", "for", "you", ".", "<", "/", "p", ">" ]
train
https://github.com/aequologica/geppaequo/blob/b72e5f6356535fd045a931f8c544d4a8ea6e35a2/geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/auth/MethodUtils.java#L705-L712
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF3.java
CommonOps_DDF3.multAddOuter
public static void multAddOuter( double alpha , DMatrix3x3 A , double beta , DMatrix3 u , DMatrix3 v , DMatrix3x3 C ) { """ C = &alpha;A + &beta;u*v<sup>T</sup> @param alpha scale factor applied to A @param A matrix @param beta scale factor applies to outer product @param u vector @param v vector @param C Storage for solution. Can be same instance as A. """ C.a11 = alpha*A.a11 + beta*u.a1*v.a1; C.a12 = alpha*A.a12 + beta*u.a1*v.a2; C.a13 = alpha*A.a13 + beta*u.a1*v.a3; C.a21 = alpha*A.a21 + beta*u.a2*v.a1; C.a22 = alpha*A.a22 + beta*u.a2*v.a2; C.a23 = alpha*A.a23 + beta*u.a2*v.a3; C.a31 = alpha*A.a31 + beta*u.a3*v.a1; C.a32 = alpha*A.a32 + beta*u.a3*v.a2; C.a33 = alpha*A.a33 + beta*u.a3*v.a3; }
java
public static void multAddOuter( double alpha , DMatrix3x3 A , double beta , DMatrix3 u , DMatrix3 v , DMatrix3x3 C ) { C.a11 = alpha*A.a11 + beta*u.a1*v.a1; C.a12 = alpha*A.a12 + beta*u.a1*v.a2; C.a13 = alpha*A.a13 + beta*u.a1*v.a3; C.a21 = alpha*A.a21 + beta*u.a2*v.a1; C.a22 = alpha*A.a22 + beta*u.a2*v.a2; C.a23 = alpha*A.a23 + beta*u.a2*v.a3; C.a31 = alpha*A.a31 + beta*u.a3*v.a1; C.a32 = alpha*A.a32 + beta*u.a3*v.a2; C.a33 = alpha*A.a33 + beta*u.a3*v.a3; }
[ "public", "static", "void", "multAddOuter", "(", "double", "alpha", ",", "DMatrix3x3", "A", ",", "double", "beta", ",", "DMatrix3", "u", ",", "DMatrix3", "v", ",", "DMatrix3x3", "C", ")", "{", "C", ".", "a11", "=", "alpha", "*", "A", ".", "a11", "+", "beta", "*", "u", ".", "a1", "*", "v", ".", "a1", ";", "C", ".", "a12", "=", "alpha", "*", "A", ".", "a12", "+", "beta", "*", "u", ".", "a1", "*", "v", ".", "a2", ";", "C", ".", "a13", "=", "alpha", "*", "A", ".", "a13", "+", "beta", "*", "u", ".", "a1", "*", "v", ".", "a3", ";", "C", ".", "a21", "=", "alpha", "*", "A", ".", "a21", "+", "beta", "*", "u", ".", "a2", "*", "v", ".", "a1", ";", "C", ".", "a22", "=", "alpha", "*", "A", ".", "a22", "+", "beta", "*", "u", ".", "a2", "*", "v", ".", "a2", ";", "C", ".", "a23", "=", "alpha", "*", "A", ".", "a23", "+", "beta", "*", "u", ".", "a2", "*", "v", ".", "a3", ";", "C", ".", "a31", "=", "alpha", "*", "A", ".", "a31", "+", "beta", "*", "u", ".", "a3", "*", "v", ".", "a1", ";", "C", ".", "a32", "=", "alpha", "*", "A", ".", "a32", "+", "beta", "*", "u", ".", "a3", "*", "v", ".", "a2", ";", "C", ".", "a33", "=", "alpha", "*", "A", ".", "a33", "+", "beta", "*", "u", ".", "a3", "*", "v", ".", "a3", ";", "}" ]
C = &alpha;A + &beta;u*v<sup>T</sup> @param alpha scale factor applied to A @param A matrix @param beta scale factor applies to outer product @param u vector @param v vector @param C Storage for solution. Can be same instance as A.
[ "C", "=", "&alpha", ";", "A", "+", "&beta", ";", "u", "*", "v<sup", ">", "T<", "/", "sup", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF3.java#L648-L658
js-lib-com/dom
src/main/java/js/dom/w3c/DocumentBuilderImpl.java
DocumentBuilderImpl.createXML
private static Document createXML(String root, boolean useNamespace) { """ Helper method for XML document creation. @param root name of the root element, @param useNamespace flag to control name space awareness. @return newly create document. """ try { org.w3c.dom.Document doc = getDocumentBuilder(null, useNamespace).newDocument(); doc.appendChild(doc.createElement(root)); return new DocumentImpl(doc); } catch (Exception e) { throw new DomException(e); } }
java
private static Document createXML(String root, boolean useNamespace) { try { org.w3c.dom.Document doc = getDocumentBuilder(null, useNamespace).newDocument(); doc.appendChild(doc.createElement(root)); return new DocumentImpl(doc); } catch (Exception e) { throw new DomException(e); } }
[ "private", "static", "Document", "createXML", "(", "String", "root", ",", "boolean", "useNamespace", ")", "{", "try", "{", "org", ".", "w3c", ".", "dom", ".", "Document", "doc", "=", "getDocumentBuilder", "(", "null", ",", "useNamespace", ")", ".", "newDocument", "(", ")", ";", "doc", ".", "appendChild", "(", "doc", ".", "createElement", "(", "root", ")", ")", ";", "return", "new", "DocumentImpl", "(", "doc", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "DomException", "(", "e", ")", ";", "}", "}" ]
Helper method for XML document creation. @param root name of the root element, @param useNamespace flag to control name space awareness. @return newly create document.
[ "Helper", "method", "for", "XML", "document", "creation", "." ]
train
https://github.com/js-lib-com/dom/blob/8c7cd7c802977f210674dec7c2a8f61e8de05b63/src/main/java/js/dom/w3c/DocumentBuilderImpl.java#L74-L82
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPoliciesInner.java
ServiceEndpointPoliciesInner.createOrUpdateAsync
public Observable<ServiceEndpointPolicyInner> createOrUpdateAsync(String resourceGroupName, String serviceEndpointPolicyName, ServiceEndpointPolicyInner parameters) { """ Creates or updates a service Endpoint Policies. @param resourceGroupName The name of the resource group. @param serviceEndpointPolicyName The name of the service endpoint policy. @param parameters Parameters supplied to the create or update service endpoint policy operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName, parameters).map(new Func1<ServiceResponse<ServiceEndpointPolicyInner>, ServiceEndpointPolicyInner>() { @Override public ServiceEndpointPolicyInner call(ServiceResponse<ServiceEndpointPolicyInner> response) { return response.body(); } }); }
java
public Observable<ServiceEndpointPolicyInner> createOrUpdateAsync(String resourceGroupName, String serviceEndpointPolicyName, ServiceEndpointPolicyInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName, parameters).map(new Func1<ServiceResponse<ServiceEndpointPolicyInner>, ServiceEndpointPolicyInner>() { @Override public ServiceEndpointPolicyInner call(ServiceResponse<ServiceEndpointPolicyInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ServiceEndpointPolicyInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "serviceEndpointPolicyName", ",", "ServiceEndpointPolicyInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "serviceEndpointPolicyName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ServiceEndpointPolicyInner", ">", ",", "ServiceEndpointPolicyInner", ">", "(", ")", "{", "@", "Override", "public", "ServiceEndpointPolicyInner", "call", "(", "ServiceResponse", "<", "ServiceEndpointPolicyInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates or updates a service Endpoint Policies. @param resourceGroupName The name of the resource group. @param serviceEndpointPolicyName The name of the service endpoint policy. @param parameters Parameters supplied to the create or update service endpoint policy operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "or", "updates", "a", "service", "Endpoint", "Policies", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPoliciesInner.java#L471-L478
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/core/ServerParams.java
ServerParams.getModuleParamInt
public int getModuleParamInt(String moduleName, String paramName, int defaultValue) { """ Get the value of the given parameter name belonging to the given module as integer. If no such module/parameter exists, defaultValue is returned. If the given value is not an integer, a RuntimeException is thrown. @param moduleName Name of module to get parameter for. @param paramName Name of parameter to get value of. @return Parameter value as a integer or defaultValue if tha parameter does not exis. """ Map<String, Object> moduleParams = getModuleParams(moduleName); if (moduleParams == null || !moduleParams.containsValue(paramName)) { return defaultValue; } Object value = moduleParams.get(paramName); try { return Integer.parseInt(value.toString()); } catch (Exception e) { throw new RuntimeException("Configuration parameter '" + moduleName + "." + paramName + "' must be a number: " + value); } }
java
public int getModuleParamInt(String moduleName, String paramName, int defaultValue) { Map<String, Object> moduleParams = getModuleParams(moduleName); if (moduleParams == null || !moduleParams.containsValue(paramName)) { return defaultValue; } Object value = moduleParams.get(paramName); try { return Integer.parseInt(value.toString()); } catch (Exception e) { throw new RuntimeException("Configuration parameter '" + moduleName + "." + paramName + "' must be a number: " + value); } }
[ "public", "int", "getModuleParamInt", "(", "String", "moduleName", ",", "String", "paramName", ",", "int", "defaultValue", ")", "{", "Map", "<", "String", ",", "Object", ">", "moduleParams", "=", "getModuleParams", "(", "moduleName", ")", ";", "if", "(", "moduleParams", "==", "null", "||", "!", "moduleParams", ".", "containsValue", "(", "paramName", ")", ")", "{", "return", "defaultValue", ";", "}", "Object", "value", "=", "moduleParams", ".", "get", "(", "paramName", ")", ";", "try", "{", "return", "Integer", ".", "parseInt", "(", "value", ".", "toString", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Configuration parameter '\"", "+", "moduleName", "+", "\".\"", "+", "paramName", "+", "\"' must be a number: \"", "+", "value", ")", ";", "}", "}" ]
Get the value of the given parameter name belonging to the given module as integer. If no such module/parameter exists, defaultValue is returned. If the given value is not an integer, a RuntimeException is thrown. @param moduleName Name of module to get parameter for. @param paramName Name of parameter to get value of. @return Parameter value as a integer or defaultValue if tha parameter does not exis.
[ "Get", "the", "value", "of", "the", "given", "parameter", "name", "belonging", "to", "the", "given", "module", "as", "integer", ".", "If", "no", "such", "module", "/", "parameter", "exists", "defaultValue", "is", "returned", ".", "If", "the", "given", "value", "is", "not", "an", "integer", "a", "RuntimeException", "is", "thrown", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/core/ServerParams.java#L382-L394
bbossgroups/bboss-elasticsearch
bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/RestClientUtil.java
RestClientUtil.mgetDocumentsNew
public String mgetDocumentsNew(String index, Object... ids) throws ElasticSearchException { """ For Elasticsearch 7 and 7+ https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html @param index _mget test/_mget test/type/_mget test/type/_mget?stored_fields=field1,field2 _mget?routing=key1 @param ids @return @throws ElasticSearchException """ return mgetDocuments(index, _doc,ids); }
java
public String mgetDocumentsNew(String index, Object... ids) throws ElasticSearchException{ return mgetDocuments(index, _doc,ids); }
[ "public", "String", "mgetDocumentsNew", "(", "String", "index", ",", "Object", "...", "ids", ")", "throws", "ElasticSearchException", "{", "return", "mgetDocuments", "(", "index", ",", "_doc", ",", "ids", ")", ";", "}" ]
For Elasticsearch 7 and 7+ https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html @param index _mget test/_mget test/type/_mget test/type/_mget?stored_fields=field1,field2 _mget?routing=key1 @param ids @return @throws ElasticSearchException
[ "For", "Elasticsearch", "7", "and", "7", "+", "https", ":", "//", "www", ".", "elastic", ".", "co", "/", "guide", "/", "en", "/", "elasticsearch", "/", "reference", "/", "current", "/", "docs", "-", "multi", "-", "get", ".", "html" ]
train
https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/RestClientUtil.java#L5100-L5102
Netflix/conductor
es6-persistence/src/main/java/com/netflix/conductor/dao/es6/index/ElasticSearchRestDAOV6.java
ElasticSearchRestDAOV6.addMappingToIndex
private void addMappingToIndex(final String index, final String mappingType, final String mappingFilename) throws IOException { """ Adds a mapping type to an index if it does not exist. @param index The name of the index. @param mappingType The name of the mapping type. @param mappingFilename The name of the mapping file to use to add the mapping if it does not exist. @throws IOException If an error occurred during requests to ES. """ logger.info("Adding '{}' mapping to index '{}'...", mappingType, index); String resourcePath = "/" + index + "/_mapping/" + mappingType; if (doesResourceNotExist(resourcePath)) { HttpEntity entity = new NByteArrayEntity(loadTypeMappingSource(mappingFilename).getBytes(), ContentType.APPLICATION_JSON); elasticSearchAdminClient.performRequest(HttpMethod.PUT, resourcePath, Collections.emptyMap(), entity); logger.info("Added '{}' mapping", mappingType); } else { logger.info("Mapping '{}' already exists", mappingType); } }
java
private void addMappingToIndex(final String index, final String mappingType, final String mappingFilename) throws IOException { logger.info("Adding '{}' mapping to index '{}'...", mappingType, index); String resourcePath = "/" + index + "/_mapping/" + mappingType; if (doesResourceNotExist(resourcePath)) { HttpEntity entity = new NByteArrayEntity(loadTypeMappingSource(mappingFilename).getBytes(), ContentType.APPLICATION_JSON); elasticSearchAdminClient.performRequest(HttpMethod.PUT, resourcePath, Collections.emptyMap(), entity); logger.info("Added '{}' mapping", mappingType); } else { logger.info("Mapping '{}' already exists", mappingType); } }
[ "private", "void", "addMappingToIndex", "(", "final", "String", "index", ",", "final", "String", "mappingType", ",", "final", "String", "mappingFilename", ")", "throws", "IOException", "{", "logger", ".", "info", "(", "\"Adding '{}' mapping to index '{}'...\"", ",", "mappingType", ",", "index", ")", ";", "String", "resourcePath", "=", "\"/\"", "+", "index", "+", "\"/_mapping/\"", "+", "mappingType", ";", "if", "(", "doesResourceNotExist", "(", "resourcePath", ")", ")", "{", "HttpEntity", "entity", "=", "new", "NByteArrayEntity", "(", "loadTypeMappingSource", "(", "mappingFilename", ")", ".", "getBytes", "(", ")", ",", "ContentType", ".", "APPLICATION_JSON", ")", ";", "elasticSearchAdminClient", ".", "performRequest", "(", "HttpMethod", ".", "PUT", ",", "resourcePath", ",", "Collections", ".", "emptyMap", "(", ")", ",", "entity", ")", ";", "logger", ".", "info", "(", "\"Added '{}' mapping\"", ",", "mappingType", ")", ";", "}", "else", "{", "logger", ".", "info", "(", "\"Mapping '{}' already exists\"", ",", "mappingType", ")", ";", "}", "}" ]
Adds a mapping type to an index if it does not exist. @param index The name of the index. @param mappingType The name of the mapping type. @param mappingFilename The name of the mapping file to use to add the mapping if it does not exist. @throws IOException If an error occurred during requests to ES.
[ "Adds", "a", "mapping", "type", "to", "an", "index", "if", "it", "does", "not", "exist", "." ]
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/es6-persistence/src/main/java/com/netflix/conductor/dao/es6/index/ElasticSearchRestDAOV6.java#L310-L323
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/SubCountHandler.java
SubCountHandler.setCount
public int setCount(double dFieldCount, boolean bDisableListeners, int iMoveMode) { """ Reset the field count. @param bDisableListeners Disable the field listeners (used for grid count verification) @param iMoveMode Move mode. """ int iErrorCode = DBConstants.NORMAL_RETURN; if (m_fldMain != null) { boolean[] rgbEnabled = null; if (bDisableListeners) rgbEnabled = m_fldMain.setEnableListeners(false); int iOriginalValue = (int)m_fldMain.getValue(); boolean bOriginalModified = m_fldMain.isModified(); int iOldOpenMode = m_fldMain.getRecord().setOpenMode(m_fldMain.getRecord().getOpenMode() & ~DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY); // don't trigger refresh and write iErrorCode = m_fldMain.setValue(dFieldCount, true, iMoveMode); // Set in main file's field if the record is not current m_fldMain.getRecord().setOpenMode(iOldOpenMode); if (iOriginalValue == (int)m_fldMain.getValue()) if (bOriginalModified == false) m_fldMain.setModified(bOriginalModified); // Make sure this didn't change if change was just null to 0. if (rgbEnabled != null) m_fldMain.setEnableListeners(rgbEnabled); } return iErrorCode; }
java
public int setCount(double dFieldCount, boolean bDisableListeners, int iMoveMode) { int iErrorCode = DBConstants.NORMAL_RETURN; if (m_fldMain != null) { boolean[] rgbEnabled = null; if (bDisableListeners) rgbEnabled = m_fldMain.setEnableListeners(false); int iOriginalValue = (int)m_fldMain.getValue(); boolean bOriginalModified = m_fldMain.isModified(); int iOldOpenMode = m_fldMain.getRecord().setOpenMode(m_fldMain.getRecord().getOpenMode() & ~DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY); // don't trigger refresh and write iErrorCode = m_fldMain.setValue(dFieldCount, true, iMoveMode); // Set in main file's field if the record is not current m_fldMain.getRecord().setOpenMode(iOldOpenMode); if (iOriginalValue == (int)m_fldMain.getValue()) if (bOriginalModified == false) m_fldMain.setModified(bOriginalModified); // Make sure this didn't change if change was just null to 0. if (rgbEnabled != null) m_fldMain.setEnableListeners(rgbEnabled); } return iErrorCode; }
[ "public", "int", "setCount", "(", "double", "dFieldCount", ",", "boolean", "bDisableListeners", ",", "int", "iMoveMode", ")", "{", "int", "iErrorCode", "=", "DBConstants", ".", "NORMAL_RETURN", ";", "if", "(", "m_fldMain", "!=", "null", ")", "{", "boolean", "[", "]", "rgbEnabled", "=", "null", ";", "if", "(", "bDisableListeners", ")", "rgbEnabled", "=", "m_fldMain", ".", "setEnableListeners", "(", "false", ")", ";", "int", "iOriginalValue", "=", "(", "int", ")", "m_fldMain", ".", "getValue", "(", ")", ";", "boolean", "bOriginalModified", "=", "m_fldMain", ".", "isModified", "(", ")", ";", "int", "iOldOpenMode", "=", "m_fldMain", ".", "getRecord", "(", ")", ".", "setOpenMode", "(", "m_fldMain", ".", "getRecord", "(", ")", ".", "getOpenMode", "(", ")", "&", "~", "DBConstants", ".", "OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY", ")", ";", "// don't trigger refresh and write", "iErrorCode", "=", "m_fldMain", ".", "setValue", "(", "dFieldCount", ",", "true", ",", "iMoveMode", ")", ";", "// Set in main file's field if the record is not current", "m_fldMain", ".", "getRecord", "(", ")", ".", "setOpenMode", "(", "iOldOpenMode", ")", ";", "if", "(", "iOriginalValue", "==", "(", "int", ")", "m_fldMain", ".", "getValue", "(", ")", ")", "if", "(", "bOriginalModified", "==", "false", ")", "m_fldMain", ".", "setModified", "(", "bOriginalModified", ")", ";", "// Make sure this didn't change if change was just null to 0.", "if", "(", "rgbEnabled", "!=", "null", ")", "m_fldMain", ".", "setEnableListeners", "(", "rgbEnabled", ")", ";", "}", "return", "iErrorCode", ";", "}" ]
Reset the field count. @param bDisableListeners Disable the field listeners (used for grid count verification) @param iMoveMode Move mode.
[ "Reset", "the", "field", "count", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/SubCountHandler.java#L312-L332
tvesalainen/util
util/src/main/java/org/vesalainen/nio/RingBuffer.java
RingBuffer.writeTo
protected int writeTo(SparseBufferOperator<B> op, Splitter<SparseBufferOperator<B>> splitter) throws IOException { """ Write buffers content from mark (included) @param op @param splitter @return @throws IOException """ return writeTo(op, splitter, mark, marked); }
java
protected int writeTo(SparseBufferOperator<B> op, Splitter<SparseBufferOperator<B>> splitter) throws IOException { return writeTo(op, splitter, mark, marked); }
[ "protected", "int", "writeTo", "(", "SparseBufferOperator", "<", "B", ">", "op", ",", "Splitter", "<", "SparseBufferOperator", "<", "B", ">", ">", "splitter", ")", "throws", "IOException", "{", "return", "writeTo", "(", "op", ",", "splitter", ",", "mark", ",", "marked", ")", ";", "}" ]
Write buffers content from mark (included) @param op @param splitter @return @throws IOException
[ "Write", "buffers", "content", "from", "mark", "(", "included", ")" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/RingBuffer.java#L270-L273
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/classify/LinearClassifierFactory.java
LinearClassifierFactory.crossValidateSetSigma
public void crossValidateSetSigma(GeneralDataset<L, F> dataset,int kfold) { """ callls the method {@link #crossValidateSetSigma(GeneralDataset, int, Scorer, LineSearcher)} with multi-class log-likelihood scoring (see {@link MultiClassAccuracyStats}) and golden-section line search (see {@link GoldenSectionLineSearch}). @param dataset the data set to optimize sigma on. """ System.err.println("##you are here."); crossValidateSetSigma(dataset, kfold, new MultiClassAccuracyStats<L>(MultiClassAccuracyStats.USE_LOGLIKELIHOOD), new GoldenSectionLineSearch(true, 1e-2, min, max)); }
java
public void crossValidateSetSigma(GeneralDataset<L, F> dataset,int kfold) { System.err.println("##you are here."); crossValidateSetSigma(dataset, kfold, new MultiClassAccuracyStats<L>(MultiClassAccuracyStats.USE_LOGLIKELIHOOD), new GoldenSectionLineSearch(true, 1e-2, min, max)); }
[ "public", "void", "crossValidateSetSigma", "(", "GeneralDataset", "<", "L", ",", "F", ">", "dataset", ",", "int", "kfold", ")", "{", "System", ".", "err", ".", "println", "(", "\"##you are here.\"", ")", ";", "crossValidateSetSigma", "(", "dataset", ",", "kfold", ",", "new", "MultiClassAccuracyStats", "<", "L", ">", "(", "MultiClassAccuracyStats", ".", "USE_LOGLIKELIHOOD", ")", ",", "new", "GoldenSectionLineSearch", "(", "true", ",", "1e-2", ",", "min", ",", "max", ")", ")", ";", "}" ]
callls the method {@link #crossValidateSetSigma(GeneralDataset, int, Scorer, LineSearcher)} with multi-class log-likelihood scoring (see {@link MultiClassAccuracyStats}) and golden-section line search (see {@link GoldenSectionLineSearch}). @param dataset the data set to optimize sigma on.
[ "callls", "the", "method", "{" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/LinearClassifierFactory.java#L546-L549
broadinstitute/barclay
src/main/java/org/broadinstitute/barclay/argparser/ArgumentDefinition.java
ArgumentDefinition.getEnumOptions
private static <T extends Enum<T>> String getEnumOptions(final Class<T> clazz) { """ Composes the help string on the possible options an {@link Enum} typed argument can take. @param clazz target enum class. Assumed no to be {@code null}. @param <T> enum class type. @throws CommandLineException if {@code &lt;T&gt;} has no constants. @return never {@code null}. """ // We assume that clazz is guaranteed to be a Class<? extends Enum>, thus // getEnumConstants() won't ever return a null. final T[] enumConstants = clazz.getEnumConstants(); if (enumConstants.length == 0) { throw new CommandLineException(String.format("Bad argument enum type '%s' with no options", clazz.getName())); } if (CommandLineParser.ClpEnum.class.isAssignableFrom(clazz)) { return Stream.of(enumConstants) .map(c -> String.format("%s (%s)", c.name(), ((CommandLineParser.ClpEnum) c).getHelpDoc())) .collect(Collectors.joining("\n")); } else { return Stream.of(enumConstants) .map(T::name) .collect(Collectors.joining(", ", OPTION_DOC_PREFIX, OPTION_DOC_SUFFIX)); } }
java
private static <T extends Enum<T>> String getEnumOptions(final Class<T> clazz) { // We assume that clazz is guaranteed to be a Class<? extends Enum>, thus // getEnumConstants() won't ever return a null. final T[] enumConstants = clazz.getEnumConstants(); if (enumConstants.length == 0) { throw new CommandLineException(String.format("Bad argument enum type '%s' with no options", clazz.getName())); } if (CommandLineParser.ClpEnum.class.isAssignableFrom(clazz)) { return Stream.of(enumConstants) .map(c -> String.format("%s (%s)", c.name(), ((CommandLineParser.ClpEnum) c).getHelpDoc())) .collect(Collectors.joining("\n")); } else { return Stream.of(enumConstants) .map(T::name) .collect(Collectors.joining(", ", OPTION_DOC_PREFIX, OPTION_DOC_SUFFIX)); } }
[ "private", "static", "<", "T", "extends", "Enum", "<", "T", ">", ">", "String", "getEnumOptions", "(", "final", "Class", "<", "T", ">", "clazz", ")", "{", "// We assume that clazz is guaranteed to be a Class<? extends Enum>, thus", "// getEnumConstants() won't ever return a null.", "final", "T", "[", "]", "enumConstants", "=", "clazz", ".", "getEnumConstants", "(", ")", ";", "if", "(", "enumConstants", ".", "length", "==", "0", ")", "{", "throw", "new", "CommandLineException", "(", "String", ".", "format", "(", "\"Bad argument enum type '%s' with no options\"", ",", "clazz", ".", "getName", "(", ")", ")", ")", ";", "}", "if", "(", "CommandLineParser", ".", "ClpEnum", ".", "class", ".", "isAssignableFrom", "(", "clazz", ")", ")", "{", "return", "Stream", ".", "of", "(", "enumConstants", ")", ".", "map", "(", "c", "->", "String", ".", "format", "(", "\"%s (%s)\"", ",", "c", ".", "name", "(", ")", ",", "(", "(", "CommandLineParser", ".", "ClpEnum", ")", "c", ")", ".", "getHelpDoc", "(", ")", ")", ")", ".", "collect", "(", "Collectors", ".", "joining", "(", "\"\\n\"", ")", ")", ";", "}", "else", "{", "return", "Stream", ".", "of", "(", "enumConstants", ")", ".", "map", "(", "T", "::", "name", ")", ".", "collect", "(", "Collectors", ".", "joining", "(", "\", \"", ",", "OPTION_DOC_PREFIX", ",", "OPTION_DOC_SUFFIX", ")", ")", ";", "}", "}" ]
Composes the help string on the possible options an {@link Enum} typed argument can take. @param clazz target enum class. Assumed no to be {@code null}. @param <T> enum class type. @throws CommandLineException if {@code &lt;T&gt;} has no constants. @return never {@code null}.
[ "Composes", "the", "help", "string", "on", "the", "possible", "options", "an", "{", "@link", "Enum", "}", "typed", "argument", "can", "take", "." ]
train
https://github.com/broadinstitute/barclay/blob/7e56d725766b0da3baff23e79a31c3d01c3589c2/src/main/java/org/broadinstitute/barclay/argparser/ArgumentDefinition.java#L308-L325
steveash/jopenfst
src/main/java/com/github/steveash/jopenfst/io/Convert.java
Convert.importSymbols
private static Optional<MutableSymbolTable> importSymbols(String filename) { """ Imports an openfst's symbols file @param filename the symbols' filename @return HashMap containing the impprted string-to-id mapping """ URL resource; try { resource = Resources.getResource(filename); } catch (IllegalArgumentException e) { return Optional.absent(); } return importSymbolsFrom(asCharSource(resource, Charsets.UTF_8)); }
java
private static Optional<MutableSymbolTable> importSymbols(String filename) { URL resource; try { resource = Resources.getResource(filename); } catch (IllegalArgumentException e) { return Optional.absent(); } return importSymbolsFrom(asCharSource(resource, Charsets.UTF_8)); }
[ "private", "static", "Optional", "<", "MutableSymbolTable", ">", "importSymbols", "(", "String", "filename", ")", "{", "URL", "resource", ";", "try", "{", "resource", "=", "Resources", ".", "getResource", "(", "filename", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "return", "Optional", ".", "absent", "(", ")", ";", "}", "return", "importSymbolsFrom", "(", "asCharSource", "(", "resource", ",", "Charsets", ".", "UTF_8", ")", ")", ";", "}" ]
Imports an openfst's symbols file @param filename the symbols' filename @return HashMap containing the impprted string-to-id mapping
[ "Imports", "an", "openfst", "s", "symbols", "file" ]
train
https://github.com/steveash/jopenfst/blob/4c675203015c1cfad2072556cb532b6edc73261d/src/main/java/com/github/steveash/jopenfst/io/Convert.java#L235-L244
CleverTap/clevertap-android-sdk
clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/CleverTapAPI.java
CleverTapAPI.attachMeta
private void attachMeta(final JSONObject o, final Context context) { """ Attaches meta info about the current state of the device to an event. Typically, this meta is added only to the ping event. """ // Memory consumption try { o.put("mc", Utils.getMemoryConsumption()); } catch (Throwable t) { // Ignore } // Attach the network type try { o.put("nt", Utils.getCurrentNetworkType(context)); } catch (Throwable t) { // Ignore } }
java
private void attachMeta(final JSONObject o, final Context context) { // Memory consumption try { o.put("mc", Utils.getMemoryConsumption()); } catch (Throwable t) { // Ignore } // Attach the network type try { o.put("nt", Utils.getCurrentNetworkType(context)); } catch (Throwable t) { // Ignore } }
[ "private", "void", "attachMeta", "(", "final", "JSONObject", "o", ",", "final", "Context", "context", ")", "{", "// Memory consumption", "try", "{", "o", ".", "put", "(", "\"mc\"", ",", "Utils", ".", "getMemoryConsumption", "(", ")", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "// Ignore", "}", "// Attach the network type", "try", "{", "o", ".", "put", "(", "\"nt\"", ",", "Utils", ".", "getCurrentNetworkType", "(", "context", ")", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "// Ignore", "}", "}" ]
Attaches meta info about the current state of the device to an event. Typically, this meta is added only to the ping event.
[ "Attaches", "meta", "info", "about", "the", "current", "state", "of", "the", "device", "to", "an", "event", ".", "Typically", "this", "meta", "is", "added", "only", "to", "the", "ping", "event", "." ]
train
https://github.com/CleverTap/clevertap-android-sdk/blob/be134c06a4f07494c398335ad9ff4976633743e1/clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/CleverTapAPI.java#L1490-L1504
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassTableUI.java
SeaGlassTableUI.createTableHeaderEmptyColumnPainter
private static Border createTableHeaderEmptyColumnPainter(final JTable table) { """ Creates a {@link Border} that paints any empty space to the right of the last column header in the given {@link JTable}'s {@link JTableHeader}. @param table DOCUMENT ME! @return DOCUMENT ME! """ return new AbstractBorder() { @Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { // if this JTableHeader is parented in a JViewport, then paint // the table header background to the right of the last column // if neccessary. Container viewport = table.getParent(); if ((viewport instanceof JViewport) && table.getWidth() < viewport.getWidth()) { int startX = table.getWidth(); int emptyColumnWidth = viewport.getWidth() - table.getWidth(); TableCellRenderer renderer = table.getTableHeader().getDefaultRenderer(); // Rossi: Fix for indexoutofbounds exception: A try catch might be good too? Component component = renderer.getTableCellRendererComponent(table, "", false, false, 0, table.getColumnCount()-1); component.setBounds(0, 0, emptyColumnWidth, table.getTableHeader().getHeight()); ((JComponent) component).setOpaque(true); CELL_RENDER_PANE.paintComponent(g, component, null, startX, 0, emptyColumnWidth + 1, table.getTableHeader().getHeight(), true); } } }; }
java
private static Border createTableHeaderEmptyColumnPainter(final JTable table) { return new AbstractBorder() { @Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { // if this JTableHeader is parented in a JViewport, then paint // the table header background to the right of the last column // if neccessary. Container viewport = table.getParent(); if ((viewport instanceof JViewport) && table.getWidth() < viewport.getWidth()) { int startX = table.getWidth(); int emptyColumnWidth = viewport.getWidth() - table.getWidth(); TableCellRenderer renderer = table.getTableHeader().getDefaultRenderer(); // Rossi: Fix for indexoutofbounds exception: A try catch might be good too? Component component = renderer.getTableCellRendererComponent(table, "", false, false, 0, table.getColumnCount()-1); component.setBounds(0, 0, emptyColumnWidth, table.getTableHeader().getHeight()); ((JComponent) component).setOpaque(true); CELL_RENDER_PANE.paintComponent(g, component, null, startX, 0, emptyColumnWidth + 1, table.getTableHeader().getHeight(), true); } } }; }
[ "private", "static", "Border", "createTableHeaderEmptyColumnPainter", "(", "final", "JTable", "table", ")", "{", "return", "new", "AbstractBorder", "(", ")", "{", "@", "Override", "public", "void", "paintBorder", "(", "Component", "c", ",", "Graphics", "g", ",", "int", "x", ",", "int", "y", ",", "int", "width", ",", "int", "height", ")", "{", "// if this JTableHeader is parented in a JViewport, then paint", "// the table header background to the right of the last column", "// if neccessary.", "Container", "viewport", "=", "table", ".", "getParent", "(", ")", ";", "if", "(", "(", "viewport", "instanceof", "JViewport", ")", "&&", "table", ".", "getWidth", "(", ")", "<", "viewport", ".", "getWidth", "(", ")", ")", "{", "int", "startX", "=", "table", ".", "getWidth", "(", ")", ";", "int", "emptyColumnWidth", "=", "viewport", ".", "getWidth", "(", ")", "-", "table", ".", "getWidth", "(", ")", ";", "TableCellRenderer", "renderer", "=", "table", ".", "getTableHeader", "(", ")", ".", "getDefaultRenderer", "(", ")", ";", "// Rossi: Fix for indexoutofbounds exception: A try catch might be good too?", "Component", "component", "=", "renderer", ".", "getTableCellRendererComponent", "(", "table", ",", "\"\"", ",", "false", ",", "false", ",", "0", ",", "table", ".", "getColumnCount", "(", ")", "-", "1", ")", ";", "component", ".", "setBounds", "(", "0", ",", "0", ",", "emptyColumnWidth", ",", "table", ".", "getTableHeader", "(", ")", ".", "getHeight", "(", ")", ")", ";", "(", "(", "JComponent", ")", "component", ")", ".", "setOpaque", "(", "true", ")", ";", "CELL_RENDER_PANE", ".", "paintComponent", "(", "g", ",", "component", ",", "null", ",", "startX", ",", "0", ",", "emptyColumnWidth", "+", "1", ",", "table", ".", "getTableHeader", "(", ")", ".", "getHeight", "(", ")", ",", "true", ")", ";", "}", "}", "}", ";", "}" ]
Creates a {@link Border} that paints any empty space to the right of the last column header in the given {@link JTable}'s {@link JTableHeader}. @param table DOCUMENT ME! @return DOCUMENT ME!
[ "Creates", "a", "{", "@link", "Border", "}", "that", "paints", "any", "empty", "space", "to", "the", "right", "of", "the", "last", "column", "header", "in", "the", "given", "{", "@link", "JTable", "}", "s", "{", "@link", "JTableHeader", "}", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassTableUI.java#L1008-L1033
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.getCopyWorkSheetSelectedRows
static public WorkSheet getCopyWorkSheetSelectedRows(WorkSheet copyWorkSheet, ArrayList<String> rows) throws Exception { """ Create a copy of a worksheet. If shuffling of columns or row for testing a way to duplicate original worksheet @param copyWorkSheet @param rows @return @throws Exception """ ArrayList<String> columns = copyWorkSheet.getColumns(); WorkSheet workSheet = new WorkSheet(rows, columns); for (String row : rows) { for (String col : columns) { workSheet.addCell(row, col, copyWorkSheet.getCell(row, col)); } } workSheet.setMetaDataColumns(copyWorkSheet.getMetaDataColumns()); workSheet.setMetaDataRows(copyWorkSheet.getMetaDataRows()); return workSheet; }
java
static public WorkSheet getCopyWorkSheetSelectedRows(WorkSheet copyWorkSheet, ArrayList<String> rows) throws Exception { ArrayList<String> columns = copyWorkSheet.getColumns(); WorkSheet workSheet = new WorkSheet(rows, columns); for (String row : rows) { for (String col : columns) { workSheet.addCell(row, col, copyWorkSheet.getCell(row, col)); } } workSheet.setMetaDataColumns(copyWorkSheet.getMetaDataColumns()); workSheet.setMetaDataRows(copyWorkSheet.getMetaDataRows()); return workSheet; }
[ "static", "public", "WorkSheet", "getCopyWorkSheetSelectedRows", "(", "WorkSheet", "copyWorkSheet", ",", "ArrayList", "<", "String", ">", "rows", ")", "throws", "Exception", "{", "ArrayList", "<", "String", ">", "columns", "=", "copyWorkSheet", ".", "getColumns", "(", ")", ";", "WorkSheet", "workSheet", "=", "new", "WorkSheet", "(", "rows", ",", "columns", ")", ";", "for", "(", "String", "row", ":", "rows", ")", "{", "for", "(", "String", "col", ":", "columns", ")", "{", "workSheet", ".", "addCell", "(", "row", ",", "col", ",", "copyWorkSheet", ".", "getCell", "(", "row", ",", "col", ")", ")", ";", "}", "}", "workSheet", ".", "setMetaDataColumns", "(", "copyWorkSheet", ".", "getMetaDataColumns", "(", ")", ")", ";", "workSheet", ".", "setMetaDataRows", "(", "copyWorkSheet", ".", "getMetaDataRows", "(", ")", ")", ";", "return", "workSheet", ";", "}" ]
Create a copy of a worksheet. If shuffling of columns or row for testing a way to duplicate original worksheet @param copyWorkSheet @param rows @return @throws Exception
[ "Create", "a", "copy", "of", "a", "worksheet", ".", "If", "shuffling", "of", "columns", "or", "row", "for", "testing", "a", "way", "to", "duplicate", "original", "worksheet" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L171-L186
alkacon/opencms-core
src/org/opencms/ade/configuration/CmsResourceTypeConfig.java
CmsResourceTypeConfig.checkViewable
public boolean checkViewable(CmsObject cms, String referenceUri) { """ Checks if a resource type is viewable for the current user. If not, this resource type should not be available at all within the ADE 'add-wizard'.<p> @param cms the current CMS context @param referenceUri the resource URI to check permissions for @return <code>true</code> if the resource type is viewable """ try { CmsExplorerTypeSettings settings = OpenCms.getWorkplaceManager().getExplorerTypeSetting(m_typeName); CmsResource referenceResource = cms.readResource(referenceUri); if (settings == null) { // no explorer type return false; } return settings.getAccess().getPermissions(cms, referenceResource).requiresViewPermission(); } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); return false; } }
java
public boolean checkViewable(CmsObject cms, String referenceUri) { try { CmsExplorerTypeSettings settings = OpenCms.getWorkplaceManager().getExplorerTypeSetting(m_typeName); CmsResource referenceResource = cms.readResource(referenceUri); if (settings == null) { // no explorer type return false; } return settings.getAccess().getPermissions(cms, referenceResource).requiresViewPermission(); } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); return false; } }
[ "public", "boolean", "checkViewable", "(", "CmsObject", "cms", ",", "String", "referenceUri", ")", "{", "try", "{", "CmsExplorerTypeSettings", "settings", "=", "OpenCms", ".", "getWorkplaceManager", "(", ")", ".", "getExplorerTypeSetting", "(", "m_typeName", ")", ";", "CmsResource", "referenceResource", "=", "cms", ".", "readResource", "(", "referenceUri", ")", ";", "if", "(", "settings", "==", "null", ")", "{", "// no explorer type", "return", "false", ";", "}", "return", "settings", ".", "getAccess", "(", ")", ".", "getPermissions", "(", "cms", ",", "referenceResource", ")", ".", "requiresViewPermission", "(", ")", ";", "}", "catch", "(", "CmsException", "e", ")", "{", "LOG", ".", "error", "(", "e", ".", "getLocalizedMessage", "(", ")", ",", "e", ")", ";", "return", "false", ";", "}", "}" ]
Checks if a resource type is viewable for the current user. If not, this resource type should not be available at all within the ADE 'add-wizard'.<p> @param cms the current CMS context @param referenceUri the resource URI to check permissions for @return <code>true</code> if the resource type is viewable
[ "Checks", "if", "a", "resource", "type", "is", "viewable", "for", "the", "current", "user", ".", "If", "not", "this", "resource", "type", "should", "not", "be", "available", "at", "all", "within", "the", "ADE", "add", "-", "wizard", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsResourceTypeConfig.java#L308-L322
apache/incubator-gobblin
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/trash/Trash.java
Trash.safeFsMkdir
private boolean safeFsMkdir(FileSystem fs, Path f, FsPermission permission) throws IOException { """ Safe creation of trash folder to ensure thread-safe. @throws IOException """ try { return fs.mkdirs(f, permission); } catch (IOException e) { // To handle the case when trash folder is created by other threads // The case is rare and we don't put synchronized keywords for performance consideration. if (!fs.exists(f)) { throw new IOException("Failed to create trash folder while it is still not existed yet."); } else { LOG.debug("Target folder %s has been created by other threads.", f.toString()); return true; } } }
java
private boolean safeFsMkdir(FileSystem fs, Path f, FsPermission permission) throws IOException { try { return fs.mkdirs(f, permission); } catch (IOException e) { // To handle the case when trash folder is created by other threads // The case is rare and we don't put synchronized keywords for performance consideration. if (!fs.exists(f)) { throw new IOException("Failed to create trash folder while it is still not existed yet."); } else { LOG.debug("Target folder %s has been created by other threads.", f.toString()); return true; } } }
[ "private", "boolean", "safeFsMkdir", "(", "FileSystem", "fs", ",", "Path", "f", ",", "FsPermission", "permission", ")", "throws", "IOException", "{", "try", "{", "return", "fs", ".", "mkdirs", "(", "f", ",", "permission", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "// To handle the case when trash folder is created by other threads", "// The case is rare and we don't put synchronized keywords for performance consideration.", "if", "(", "!", "fs", ".", "exists", "(", "f", ")", ")", "{", "throw", "new", "IOException", "(", "\"Failed to create trash folder while it is still not existed yet.\"", ")", ";", "}", "else", "{", "LOG", ".", "debug", "(", "\"Target folder %s has been created by other threads.\"", ",", "f", ".", "toString", "(", ")", ")", ";", "return", "true", ";", "}", "}", "}" ]
Safe creation of trash folder to ensure thread-safe. @throws IOException
[ "Safe", "creation", "of", "trash", "folder", "to", "ensure", "thread", "-", "safe", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/trash/Trash.java#L287-L300
Alluxio/alluxio
core/server/worker/src/main/java/alluxio/worker/block/BlockMetadataManager.java
BlockMetadataManager.getBlockMeta
public BlockMeta getBlockMeta(long blockId) throws BlockDoesNotExistException { """ Gets the metadata of a block given its block id. @param blockId the block id @return metadata of the block @throws BlockDoesNotExistException if no BlockMeta for this block id is found """ for (StorageTier tier : mTiers) { for (StorageDir dir : tier.getStorageDirs()) { if (dir.hasBlockMeta(blockId)) { return dir.getBlockMeta(blockId); } } } throw new BlockDoesNotExistException(ExceptionMessage.BLOCK_META_NOT_FOUND, blockId); }
java
public BlockMeta getBlockMeta(long blockId) throws BlockDoesNotExistException { for (StorageTier tier : mTiers) { for (StorageDir dir : tier.getStorageDirs()) { if (dir.hasBlockMeta(blockId)) { return dir.getBlockMeta(blockId); } } } throw new BlockDoesNotExistException(ExceptionMessage.BLOCK_META_NOT_FOUND, blockId); }
[ "public", "BlockMeta", "getBlockMeta", "(", "long", "blockId", ")", "throws", "BlockDoesNotExistException", "{", "for", "(", "StorageTier", "tier", ":", "mTiers", ")", "{", "for", "(", "StorageDir", "dir", ":", "tier", ".", "getStorageDirs", "(", ")", ")", "{", "if", "(", "dir", ".", "hasBlockMeta", "(", "blockId", ")", ")", "{", "return", "dir", ".", "getBlockMeta", "(", "blockId", ")", ";", "}", "}", "}", "throw", "new", "BlockDoesNotExistException", "(", "ExceptionMessage", ".", "BLOCK_META_NOT_FOUND", ",", "blockId", ")", ";", "}" ]
Gets the metadata of a block given its block id. @param blockId the block id @return metadata of the block @throws BlockDoesNotExistException if no BlockMeta for this block id is found
[ "Gets", "the", "metadata", "of", "a", "block", "given", "its", "block", "id", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/BlockMetadataManager.java#L186-L195
OpenLiberty/open-liberty
dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/TypeConversion.java
TypeConversion.writeIntAsVarIntBytes
public static int writeIntAsVarIntBytes(int intVal, byte[] bytes, int offset) { """ Writes an integer to the byte array in the Varint format. @param intVal - integer value to write to the bytes buffer in the Varint format @param bytes - byte buffer to write to - must contain enough space for maximum length which is 5 bytes. @param offset - the offset within the bytes buffer to start writing @return - returns the number of bytes used from the bytes buffer """ int pos = offset; int v = intVal; if ((v & ~0x7F) == 0) { bytes[pos++] = ((byte) v); return 1 + offset; } while (true) { if ((v & ~0x7F) == 0) { bytes[pos++] = ((byte) v); return pos; } else { bytes[pos++] = (byte) ((v & 0x7F) | 0x80); v >>>= 7; } } }
java
public static int writeIntAsVarIntBytes(int intVal, byte[] bytes, int offset) { int pos = offset; int v = intVal; if ((v & ~0x7F) == 0) { bytes[pos++] = ((byte) v); return 1 + offset; } while (true) { if ((v & ~0x7F) == 0) { bytes[pos++] = ((byte) v); return pos; } else { bytes[pos++] = (byte) ((v & 0x7F) | 0x80); v >>>= 7; } } }
[ "public", "static", "int", "writeIntAsVarIntBytes", "(", "int", "intVal", ",", "byte", "[", "]", "bytes", ",", "int", "offset", ")", "{", "int", "pos", "=", "offset", ";", "int", "v", "=", "intVal", ";", "if", "(", "(", "v", "&", "~", "0x7F", ")", "==", "0", ")", "{", "bytes", "[", "pos", "++", "]", "=", "(", "(", "byte", ")", "v", ")", ";", "return", "1", "+", "offset", ";", "}", "while", "(", "true", ")", "{", "if", "(", "(", "v", "&", "~", "0x7F", ")", "==", "0", ")", "{", "bytes", "[", "pos", "++", "]", "=", "(", "(", "byte", ")", "v", ")", ";", "return", "pos", ";", "}", "else", "{", "bytes", "[", "pos", "++", "]", "=", "(", "byte", ")", "(", "(", "v", "&", "0x7F", ")", "|", "0x80", ")", ";", "v", ">>>=", "7", ";", "}", "}", "}" ]
Writes an integer to the byte array in the Varint format. @param intVal - integer value to write to the bytes buffer in the Varint format @param bytes - byte buffer to write to - must contain enough space for maximum length which is 5 bytes. @param offset - the offset within the bytes buffer to start writing @return - returns the number of bytes used from the bytes buffer
[ "Writes", "an", "integer", "to", "the", "byte", "array", "in", "the", "Varint", "format", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/TypeConversion.java#L244-L262
drewwills/cernunnos
cernunnos-core/src/main/java/org/danann/cernunnos/runtime/ScriptRunner.java
ScriptRunner.run
public TaskResponse run(String location, TaskRequest req) { """ Invokes the script found at the specified location (file system or URL). @param location A file on the file system or a URL. @param req A <code>TaskRequest</code> prepared externally. @return The <code>TaskResponse</code> that results from invoking the specified script. """ // Assertions. if (location == null) { String msg = "Argument 'location' cannot be null."; throw new IllegalArgumentException(msg); } return run(compileTask(location), req); }
java
public TaskResponse run(String location, TaskRequest req) { // Assertions. if (location == null) { String msg = "Argument 'location' cannot be null."; throw new IllegalArgumentException(msg); } return run(compileTask(location), req); }
[ "public", "TaskResponse", "run", "(", "String", "location", ",", "TaskRequest", "req", ")", "{", "// Assertions.", "if", "(", "location", "==", "null", ")", "{", "String", "msg", "=", "\"Argument 'location' cannot be null.\"", ";", "throw", "new", "IllegalArgumentException", "(", "msg", ")", ";", "}", "return", "run", "(", "compileTask", "(", "location", ")", ",", "req", ")", ";", "}" ]
Invokes the script found at the specified location (file system or URL). @param location A file on the file system or a URL. @param req A <code>TaskRequest</code> prepared externally. @return The <code>TaskResponse</code> that results from invoking the specified script.
[ "Invokes", "the", "script", "found", "at", "the", "specified", "location", "(", "file", "system", "or", "URL", ")", "." ]
train
https://github.com/drewwills/cernunnos/blob/dc6848e0253775e22b6c869fd06506d4ddb6d728/cernunnos-core/src/main/java/org/danann/cernunnos/runtime/ScriptRunner.java#L150-L160
Red5/red5-io
src/main/java/org/red5/io/mp3/impl/MP3Stream.java
MP3Stream.skipStream
private static void skipStream(InputStream in, long count) throws IOException { """ Skips the given number of bytes from the specified input stream. @param in the input stream @param count the number of bytes to skip @throws IOException if an IO error occurs """ long size = count; long skipped = 0; while (size > 0 && skipped >= 0) { skipped = in.skip(size); if (skipped != -1) { size -= skipped; } } }
java
private static void skipStream(InputStream in, long count) throws IOException { long size = count; long skipped = 0; while (size > 0 && skipped >= 0) { skipped = in.skip(size); if (skipped != -1) { size -= skipped; } } }
[ "private", "static", "void", "skipStream", "(", "InputStream", "in", ",", "long", "count", ")", "throws", "IOException", "{", "long", "size", "=", "count", ";", "long", "skipped", "=", "0", ";", "while", "(", "size", ">", "0", "&&", "skipped", ">=", "0", ")", "{", "skipped", "=", "in", ".", "skip", "(", "size", ")", ";", "if", "(", "skipped", "!=", "-", "1", ")", "{", "size", "-=", "skipped", ";", "}", "}", "}" ]
Skips the given number of bytes from the specified input stream. @param in the input stream @param count the number of bytes to skip @throws IOException if an IO error occurs
[ "Skips", "the", "given", "number", "of", "bytes", "from", "the", "specified", "input", "stream", "." ]
train
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/mp3/impl/MP3Stream.java#L240-L249
carewebframework/carewebframework-core
org.carewebframework.plugin-parent/org.carewebframework.plugin.statuspanel/src/main/java/org/carewebframework/plugin/statuspanel/StatusPanel.java
StatusPanel.eventCallback
@Override public void eventCallback(String eventName, Object eventData) { """ Handler for the STATUS event. The second level of the event name identifies the pane where the status information (the event data) is to be displayed. For example, the event STATUS.TIMING would display the status information in the pane whose associated label has an id of "TIMING", creating one dynamically if necessary. If there is no second level event name, the default pane is used. """ String pane = StrUtil.piece(eventName, ".", 2); Label lbl = getLabel(pane.isEmpty() ? "default" : pane); lbl.setLabel(eventData.toString()); lbl.setHint(eventData.toString()); }
java
@Override public void eventCallback(String eventName, Object eventData) { String pane = StrUtil.piece(eventName, ".", 2); Label lbl = getLabel(pane.isEmpty() ? "default" : pane); lbl.setLabel(eventData.toString()); lbl.setHint(eventData.toString()); }
[ "@", "Override", "public", "void", "eventCallback", "(", "String", "eventName", ",", "Object", "eventData", ")", "{", "String", "pane", "=", "StrUtil", ".", "piece", "(", "eventName", ",", "\".\"", ",", "2", ")", ";", "Label", "lbl", "=", "getLabel", "(", "pane", ".", "isEmpty", "(", ")", "?", "\"default\"", ":", "pane", ")", ";", "lbl", ".", "setLabel", "(", "eventData", ".", "toString", "(", ")", ")", ";", "lbl", ".", "setHint", "(", "eventData", ".", "toString", "(", ")", ")", ";", "}" ]
Handler for the STATUS event. The second level of the event name identifies the pane where the status information (the event data) is to be displayed. For example, the event STATUS.TIMING would display the status information in the pane whose associated label has an id of "TIMING", creating one dynamically if necessary. If there is no second level event name, the default pane is used.
[ "Handler", "for", "the", "STATUS", "event", ".", "The", "second", "level", "of", "the", "event", "name", "identifies", "the", "pane", "where", "the", "status", "information", "(", "the", "event", "data", ")", "is", "to", "be", "displayed", ".", "For", "example", "the", "event", "STATUS", ".", "TIMING", "would", "display", "the", "status", "information", "in", "the", "pane", "whose", "associated", "label", "has", "an", "id", "of", "TIMING", "creating", "one", "dynamically", "if", "necessary", ".", "If", "there", "is", "no", "second", "level", "event", "name", "the", "default", "pane", "is", "used", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.statuspanel/src/main/java/org/carewebframework/plugin/statuspanel/StatusPanel.java#L58-L64
DDTH/ddth-queue
ddth-queue-core/src/main/java/com/github/ddth/queue/impl/DisruptorQueue.java
DisruptorQueue.putToRingBuffer
protected void putToRingBuffer(IQueueMessage<ID, DATA> msg) throws QueueException.QueueIsFull { """ Put a message to the ring buffer. @param msg @throws QueueException.QueueIsFull if the ring buffer is full """ if (msg == null) { throw new NullPointerException("Supplied queue message is null!"); } LOCK_PUT.lock(); try { if (!ringBuffer.tryPublishEvent((event, _seq) -> { event.set(msg); knownPublishedSeq = _seq > knownPublishedSeq ? _seq : knownPublishedSeq; })) { throw new QueueException.QueueIsFull(getRingSize()); } } finally { LOCK_PUT.unlock(); } }
java
protected void putToRingBuffer(IQueueMessage<ID, DATA> msg) throws QueueException.QueueIsFull { if (msg == null) { throw new NullPointerException("Supplied queue message is null!"); } LOCK_PUT.lock(); try { if (!ringBuffer.tryPublishEvent((event, _seq) -> { event.set(msg); knownPublishedSeq = _seq > knownPublishedSeq ? _seq : knownPublishedSeq; })) { throw new QueueException.QueueIsFull(getRingSize()); } } finally { LOCK_PUT.unlock(); } }
[ "protected", "void", "putToRingBuffer", "(", "IQueueMessage", "<", "ID", ",", "DATA", ">", "msg", ")", "throws", "QueueException", ".", "QueueIsFull", "{", "if", "(", "msg", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"Supplied queue message is null!\"", ")", ";", "}", "LOCK_PUT", ".", "lock", "(", ")", ";", "try", "{", "if", "(", "!", "ringBuffer", ".", "tryPublishEvent", "(", "(", "event", ",", "_seq", ")", "->", "{", "event", ".", "set", "(", "msg", ")", ";", "knownPublishedSeq", "=", "_seq", ">", "knownPublishedSeq", "?", "_seq", ":", "knownPublishedSeq", ";", "}", ")", ")", "{", "throw", "new", "QueueException", ".", "QueueIsFull", "(", "getRingSize", "(", ")", ")", ";", "}", "}", "finally", "{", "LOCK_PUT", ".", "unlock", "(", ")", ";", "}", "}" ]
Put a message to the ring buffer. @param msg @throws QueueException.QueueIsFull if the ring buffer is full
[ "Put", "a", "message", "to", "the", "ring", "buffer", "." ]
train
https://github.com/DDTH/ddth-queue/blob/b20776850d23111d3d71fc8ed6023c590bc3621f/ddth-queue-core/src/main/java/com/github/ddth/queue/impl/DisruptorQueue.java#L138-L153
OpenLiberty/open-liberty
dev/com.ibm.ws.security.utility/src/com/ibm/ws/security/utility/utils/CommandUtils.java
CommandUtils.getOption
public static String getOption(String key, boolean forceFormat, Object... args) { """ get the string from options resource bundle. if forceFormat is set to true or args has value, the code invokes MessageFormat.format method even args is not set. This is for processing double single quotes. Since NLS_MESSAGEFORMAT_ALL is set for options resource bundle, every single quote ' character which needs to be treated as a single quote, is escaped by another single quote. Otherwise, MessageFormat.format method will treat a single quote as the beginning and ending of the quote. So all of the texts needs to be processed by MessageFormat no matter whether it has variables. """ String option = options.getString(key); if (forceFormat || args.length > 0) { return MessageFormat.format(option, args); } else { return option; } }
java
public static String getOption(String key, boolean forceFormat, Object... args) { String option = options.getString(key); if (forceFormat || args.length > 0) { return MessageFormat.format(option, args); } else { return option; } }
[ "public", "static", "String", "getOption", "(", "String", "key", ",", "boolean", "forceFormat", ",", "Object", "...", "args", ")", "{", "String", "option", "=", "options", ".", "getString", "(", "key", ")", ";", "if", "(", "forceFormat", "||", "args", ".", "length", ">", "0", ")", "{", "return", "MessageFormat", ".", "format", "(", "option", ",", "args", ")", ";", "}", "else", "{", "return", "option", ";", "}", "}" ]
get the string from options resource bundle. if forceFormat is set to true or args has value, the code invokes MessageFormat.format method even args is not set. This is for processing double single quotes. Since NLS_MESSAGEFORMAT_ALL is set for options resource bundle, every single quote ' character which needs to be treated as a single quote, is escaped by another single quote. Otherwise, MessageFormat.format method will treat a single quote as the beginning and ending of the quote. So all of the texts needs to be processed by MessageFormat no matter whether it has variables.
[ "get", "the", "string", "from", "options", "resource", "bundle", ".", "if", "forceFormat", "is", "set", "to", "true", "or", "args", "has", "value", "the", "code", "invokes", "MessageFormat", ".", "format", "method", "even", "args", "is", "not", "set", ".", "This", "is", "for", "processing", "double", "single", "quotes", ".", "Since", "NLS_MESSAGEFORMAT_ALL", "is", "set", "for", "options", "resource", "bundle", "every", "single", "quote", "character", "which", "needs", "to", "be", "treated", "as", "a", "single", "quote", "is", "escaped", "by", "another", "single", "quote", ".", "Otherwise", "MessageFormat", ".", "format", "method", "will", "treat", "a", "single", "quote", "as", "the", "beginning", "and", "ending", "of", "the", "quote", ".", "So", "all", "of", "the", "texts", "needs", "to", "be", "processed", "by", "MessageFormat", "no", "matter", "whether", "it", "has", "variables", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.utility/src/com/ibm/ws/security/utility/utils/CommandUtils.java#L37-L44
beanshell/beanshell
src/main/java/bsh/NameSpace.java
NameSpace.getVariableImpl
protected Variable getVariableImpl(final String name, final boolean recurse) throws UtilEvalError { """ Locate a variable and return the Variable object with optional recursion through parent name spaces. <p/> If this namespace is static, return only static variables. @param name the name @param recurse the recurse @return the Variable value or null if it is not defined @throws UtilEvalError the util eval error """ Variable var = null; if (this.variables.containsKey(name)) return this.variables.get(name); else var = this.getImportedVar(name); // try parent if (recurse && var == null && this.parent != null) var = this.parent.getVariableImpl(name, recurse); return var; }
java
protected Variable getVariableImpl(final String name, final boolean recurse) throws UtilEvalError { Variable var = null; if (this.variables.containsKey(name)) return this.variables.get(name); else var = this.getImportedVar(name); // try parent if (recurse && var == null && this.parent != null) var = this.parent.getVariableImpl(name, recurse); return var; }
[ "protected", "Variable", "getVariableImpl", "(", "final", "String", "name", ",", "final", "boolean", "recurse", ")", "throws", "UtilEvalError", "{", "Variable", "var", "=", "null", ";", "if", "(", "this", ".", "variables", ".", "containsKey", "(", "name", ")", ")", "return", "this", ".", "variables", ".", "get", "(", "name", ")", ";", "else", "var", "=", "this", ".", "getImportedVar", "(", "name", ")", ";", "// try parent", "if", "(", "recurse", "&&", "var", "==", "null", "&&", "this", ".", "parent", "!=", "null", ")", "var", "=", "this", ".", "parent", ".", "getVariableImpl", "(", "name", ",", "recurse", ")", ";", "return", "var", ";", "}" ]
Locate a variable and return the Variable object with optional recursion through parent name spaces. <p/> If this namespace is static, return only static variables. @param name the name @param recurse the recurse @return the Variable value or null if it is not defined @throws UtilEvalError the util eval error
[ "Locate", "a", "variable", "and", "return", "the", "Variable", "object", "with", "optional", "recursion", "through", "parent", "name", "spaces", ".", "<p", "/", ">", "If", "this", "namespace", "is", "static", "return", "only", "static", "variables", "." ]
train
https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/NameSpace.java#L627-L638
FitLayout/segmentation
src/main/java/org/fit/segm/grouping/op/GroupAnalyzer.java
GroupAnalyzer.findSuperArea
public AreaImpl findSuperArea(AreaImpl sub, Vector<AreaImpl> selected) { """ Starts with a specified subarea and finds all the subareas that may be joined with the first one. Returns an empty area and the vector of the areas inside. The subareas are not automatically added to the new area because this would cause their removal from the parent area. @param sub the subnode to start with @param selected a vector that will be filled with the selected subnodes that should be contained in the new area @return the new empty area """ /* This is a simple testing SuperArea implementation. It groups each * subarea with its first sibling area.*/ AreaImpl ret = new AreaImpl(0, 0, 0, 0); ret.setPage(sub.getPage()); AreaImpl sibl = (AreaImpl) sub.getNextSibling(); selected.removeAllElements(); selected.add(sub); if (sibl != null) { selected.add(sibl); } return ret; }
java
public AreaImpl findSuperArea(AreaImpl sub, Vector<AreaImpl> selected) { /* This is a simple testing SuperArea implementation. It groups each * subarea with its first sibling area.*/ AreaImpl ret = new AreaImpl(0, 0, 0, 0); ret.setPage(sub.getPage()); AreaImpl sibl = (AreaImpl) sub.getNextSibling(); selected.removeAllElements(); selected.add(sub); if (sibl != null) { selected.add(sibl); } return ret; }
[ "public", "AreaImpl", "findSuperArea", "(", "AreaImpl", "sub", ",", "Vector", "<", "AreaImpl", ">", "selected", ")", "{", "/* This is a simple testing SuperArea implementation. It groups each \n \t * subarea with its first sibling area.*/", "AreaImpl", "ret", "=", "new", "AreaImpl", "(", "0", ",", "0", ",", "0", ",", "0", ")", ";", "ret", ".", "setPage", "(", "sub", ".", "getPage", "(", ")", ")", ";", "AreaImpl", "sibl", "=", "(", "AreaImpl", ")", "sub", ".", "getNextSibling", "(", ")", ";", "selected", ".", "removeAllElements", "(", ")", ";", "selected", ".", "add", "(", "sub", ")", ";", "if", "(", "sibl", "!=", "null", ")", "{", "selected", ".", "add", "(", "sibl", ")", ";", "}", "return", "ret", ";", "}" ]
Starts with a specified subarea and finds all the subareas that may be joined with the first one. Returns an empty area and the vector of the areas inside. The subareas are not automatically added to the new area because this would cause their removal from the parent area. @param sub the subnode to start with @param selected a vector that will be filled with the selected subnodes that should be contained in the new area @return the new empty area
[ "Starts", "with", "a", "specified", "subarea", "and", "finds", "all", "the", "subareas", "that", "may", "be", "joined", "with", "the", "first", "one", ".", "Returns", "an", "empty", "area", "and", "the", "vector", "of", "the", "areas", "inside", ".", "The", "subareas", "are", "not", "automatically", "added", "to", "the", "new", "area", "because", "this", "would", "cause", "their", "removal", "from", "the", "parent", "area", "." ]
train
https://github.com/FitLayout/segmentation/blob/12998087d576640c2f2a6360cf6088af95eea5f4/src/main/java/org/fit/segm/grouping/op/GroupAnalyzer.java#L47-L61
buschmais/jqa-java-plugin
src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/VisitorHelper.java
VisitorHelper.addReads
void addReads(MethodDescriptor methodDescriptor, final Integer lineNumber, FieldDescriptor fieldDescriptor) { """ Add a reads relation between a method and a field. @param methodDescriptor The method. @param lineNumber The line number. @param fieldDescriptor The field. """ ReadsDescriptor readsDescriptor = scannerContext.getStore().create(methodDescriptor, ReadsDescriptor.class, fieldDescriptor); readsDescriptor.setLineNumber(lineNumber); }
java
void addReads(MethodDescriptor methodDescriptor, final Integer lineNumber, FieldDescriptor fieldDescriptor) { ReadsDescriptor readsDescriptor = scannerContext.getStore().create(methodDescriptor, ReadsDescriptor.class, fieldDescriptor); readsDescriptor.setLineNumber(lineNumber); }
[ "void", "addReads", "(", "MethodDescriptor", "methodDescriptor", ",", "final", "Integer", "lineNumber", ",", "FieldDescriptor", "fieldDescriptor", ")", "{", "ReadsDescriptor", "readsDescriptor", "=", "scannerContext", ".", "getStore", "(", ")", ".", "create", "(", "methodDescriptor", ",", "ReadsDescriptor", ".", "class", ",", "fieldDescriptor", ")", ";", "readsDescriptor", ".", "setLineNumber", "(", "lineNumber", ")", ";", "}" ]
Add a reads relation between a method and a field. @param methodDescriptor The method. @param lineNumber The line number. @param fieldDescriptor The field.
[ "Add", "a", "reads", "relation", "between", "a", "method", "and", "a", "field", "." ]
train
https://github.com/buschmais/jqa-java-plugin/blob/4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54/src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/VisitorHelper.java#L151-L154
ironjacamar/ironjacamar
sjc/src/main/java/org/ironjacamar/sjc/Main.java
Main.configurationInteger
private static int configurationInteger(Properties properties, String key, int defaultValue) { """ Get configuration integer @param properties The properties @param key The key @param defaultValue The default value @return The value """ if (properties != null) { if (properties.containsKey(key)) return Integer.valueOf(properties.getProperty(key)); } return defaultValue; }
java
private static int configurationInteger(Properties properties, String key, int defaultValue) { if (properties != null) { if (properties.containsKey(key)) return Integer.valueOf(properties.getProperty(key)); } return defaultValue; }
[ "private", "static", "int", "configurationInteger", "(", "Properties", "properties", ",", "String", "key", ",", "int", "defaultValue", ")", "{", "if", "(", "properties", "!=", "null", ")", "{", "if", "(", "properties", ".", "containsKey", "(", "key", ")", ")", "return", "Integer", ".", "valueOf", "(", "properties", ".", "getProperty", "(", "key", ")", ")", ";", "}", "return", "defaultValue", ";", "}" ]
Get configuration integer @param properties The properties @param key The key @param defaultValue The default value @return The value
[ "Get", "configuration", "integer" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/sjc/src/main/java/org/ironjacamar/sjc/Main.java#L463-L472
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java
Configuration.registerType
public void registerType(String typeName, Class<?> clazz) { """ Register a typeName to Class mapping @param typeName SQL type name @param clazz java type """ typeToName.put(typeName.toLowerCase(), clazz); }
java
public void registerType(String typeName, Class<?> clazz) { typeToName.put(typeName.toLowerCase(), clazz); }
[ "public", "void", "registerType", "(", "String", "typeName", ",", "Class", "<", "?", ">", "clazz", ")", "{", "typeToName", ".", "put", "(", "typeName", ".", "toLowerCase", "(", ")", ",", "clazz", ")", ";", "}" ]
Register a typeName to Class mapping @param typeName SQL type name @param clazz java type
[ "Register", "a", "typeName", "to", "Class", "mapping" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java#L434-L436
mnlipp/jgrapes
org.jgrapes.http/src/org/jgrapes/http/HttpConnector.java
HttpConnector.onOutput
@Handler public void onOutput(Output<?> event, WebAppMsgChannel appChannel) throws InterruptedException { """ Handles output from the application. This may be the payload of e.g. a POST or data to be transferes on a websocket connection. @param event the event @param appChannel the application layer channel @throws InterruptedException the interrupted exception """ appChannel.handleAppOutput(event); }
java
@Handler public void onOutput(Output<?> event, WebAppMsgChannel appChannel) throws InterruptedException { appChannel.handleAppOutput(event); }
[ "@", "Handler", "public", "void", "onOutput", "(", "Output", "<", "?", ">", "event", ",", "WebAppMsgChannel", "appChannel", ")", "throws", "InterruptedException", "{", "appChannel", ".", "handleAppOutput", "(", "event", ")", ";", "}" ]
Handles output from the application. This may be the payload of e.g. a POST or data to be transferes on a websocket connection. @param event the event @param appChannel the application layer channel @throws InterruptedException the interrupted exception
[ "Handles", "output", "from", "the", "application", ".", "This", "may", "be", "the", "payload", "of", "e", ".", "g", ".", "a", "POST", "or", "data", "to", "be", "transferes", "on", "a", "websocket", "connection", "." ]
train
https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.http/src/org/jgrapes/http/HttpConnector.java#L155-L159
jenkinsci/jenkins
core/src/main/java/jenkins/security/UserDetailsCache.java
UserDetailsCache.getCached
@CheckForNull public UserDetails getCached(String idOrFullName) throws UsernameNotFoundException { """ Gets the cached UserDetails for the given username. Similar to {@link #loadUserByUsername(String)} except it doesn't perform the actual lookup if there is a cache miss. @param idOrFullName the username @return {@code null} if the cache doesn't contain any data for the key or the user details cached for the key. @throws UsernameNotFoundException if a previous lookup resulted in the same """ Boolean exists = existenceCache.getIfPresent(idOrFullName); if (exists != null && !exists) { throw new UserMayOrMayNotExistException(String.format("\"%s\" does not exist", idOrFullName)); } else { return detailsCache.getIfPresent(idOrFullName); } }
java
@CheckForNull public UserDetails getCached(String idOrFullName) throws UsernameNotFoundException { Boolean exists = existenceCache.getIfPresent(idOrFullName); if (exists != null && !exists) { throw new UserMayOrMayNotExistException(String.format("\"%s\" does not exist", idOrFullName)); } else { return detailsCache.getIfPresent(idOrFullName); } }
[ "@", "CheckForNull", "public", "UserDetails", "getCached", "(", "String", "idOrFullName", ")", "throws", "UsernameNotFoundException", "{", "Boolean", "exists", "=", "existenceCache", ".", "getIfPresent", "(", "idOrFullName", ")", ";", "if", "(", "exists", "!=", "null", "&&", "!", "exists", ")", "{", "throw", "new", "UserMayOrMayNotExistException", "(", "String", ".", "format", "(", "\"\\\"%s\\\" does not exist\"", ",", "idOrFullName", ")", ")", ";", "}", "else", "{", "return", "detailsCache", ".", "getIfPresent", "(", "idOrFullName", ")", ";", "}", "}" ]
Gets the cached UserDetails for the given username. Similar to {@link #loadUserByUsername(String)} except it doesn't perform the actual lookup if there is a cache miss. @param idOrFullName the username @return {@code null} if the cache doesn't contain any data for the key or the user details cached for the key. @throws UsernameNotFoundException if a previous lookup resulted in the same
[ "Gets", "the", "cached", "UserDetails", "for", "the", "given", "username", ".", "Similar", "to", "{", "@link", "#loadUserByUsername", "(", "String", ")", "}", "except", "it", "doesn", "t", "perform", "the", "actual", "lookup", "if", "there", "is", "a", "cache", "miss", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/security/UserDetailsCache.java#L98-L106
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/MutableArray.java
MutableArray.setDictionary
@NonNull @Override public MutableArray setDictionary(int index, Dictionary value) { """ Sets a Dictionary object at the given index. @param index the index. This value must not exceed the bounds of the array. @param value the Dictionary object @return The self object """ return setValue(index, value); }
java
@NonNull @Override public MutableArray setDictionary(int index, Dictionary value) { return setValue(index, value); }
[ "@", "NonNull", "@", "Override", "public", "MutableArray", "setDictionary", "(", "int", "index", ",", "Dictionary", "value", ")", "{", "return", "setValue", "(", "index", ",", "value", ")", ";", "}" ]
Sets a Dictionary object at the given index. @param index the index. This value must not exceed the bounds of the array. @param value the Dictionary object @return The self object
[ "Sets", "a", "Dictionary", "object", "at", "the", "given", "index", "." ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/MutableArray.java#L247-L251
johncarl81/transfuse
transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java
Contract.instanceOf
public static void instanceOf(final Object input, Class<?> classType, final String inputName) { """ Check that an input of a given class @param input the input @param classType the class to check for @param inputName the name of the input """ notNull(input, "input"); notNull(classType, "classType"); if (!classType.isInstance(input)) { throw new IllegalArgumentException("Expecting " + maskNullArgument(inputName) + " to an instance of " + classType.getName() + "."); } }
java
public static void instanceOf(final Object input, Class<?> classType, final String inputName) { notNull(input, "input"); notNull(classType, "classType"); if (!classType.isInstance(input)) { throw new IllegalArgumentException("Expecting " + maskNullArgument(inputName) + " to an instance of " + classType.getName() + "."); } }
[ "public", "static", "void", "instanceOf", "(", "final", "Object", "input", ",", "Class", "<", "?", ">", "classType", ",", "final", "String", "inputName", ")", "{", "notNull", "(", "input", ",", "\"input\"", ")", ";", "notNull", "(", "classType", ",", "\"classType\"", ")", ";", "if", "(", "!", "classType", ".", "isInstance", "(", "input", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Expecting \"", "+", "maskNullArgument", "(", "inputName", ")", "+", "\" to an instance of \"", "+", "classType", ".", "getName", "(", ")", "+", "\".\"", ")", ";", "}", "}" ]
Check that an input of a given class @param input the input @param classType the class to check for @param inputName the name of the input
[ "Check", "that", "an", "input", "of", "a", "given", "class" ]
train
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java#L205-L212
googleapis/cloud-bigtable-client
bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/adapters/filters/SingleFilterAdapter.java
SingleFilterAdapter.isSupported
public FilterSupportStatus isSupported(FilterAdapterContext context, Filter hbaseFilter) { """ Determine if the untyped filter is supported. @param context a {@link com.google.cloud.bigtable.hbase.adapters.filters.FilterAdapterContext} object. @param hbaseFilter a {@link org.apache.hadoop.hbase.filter.Filter} object. @return a {@link com.google.cloud.bigtable.hbase.adapters.filters.FilterSupportStatus} object. """ Preconditions.checkArgument(isFilterAProperSublcass(hbaseFilter)); return adapter.isFilterSupported(context, getTypedFilter(hbaseFilter)); }
java
public FilterSupportStatus isSupported(FilterAdapterContext context, Filter hbaseFilter) { Preconditions.checkArgument(isFilterAProperSublcass(hbaseFilter)); return adapter.isFilterSupported(context, getTypedFilter(hbaseFilter)); }
[ "public", "FilterSupportStatus", "isSupported", "(", "FilterAdapterContext", "context", ",", "Filter", "hbaseFilter", ")", "{", "Preconditions", ".", "checkArgument", "(", "isFilterAProperSublcass", "(", "hbaseFilter", ")", ")", ";", "return", "adapter", ".", "isFilterSupported", "(", "context", ",", "getTypedFilter", "(", "hbaseFilter", ")", ")", ";", "}" ]
Determine if the untyped filter is supported. @param context a {@link com.google.cloud.bigtable.hbase.adapters.filters.FilterAdapterContext} object. @param hbaseFilter a {@link org.apache.hadoop.hbase.filter.Filter} object. @return a {@link com.google.cloud.bigtable.hbase.adapters.filters.FilterSupportStatus} object.
[ "Determine", "if", "the", "untyped", "filter", "is", "supported", "." ]
train
https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/adapters/filters/SingleFilterAdapter.java#L88-L91
hawtio/hawtio
platforms/hawtio-osgi-jmx/src/main/java/io/hawt/osgi/jmx/RBACDecorator.java
RBACDecorator.pidListKey
static String pidListKey(List<String> allJmxAclPids, ObjectName objectName) throws NoSuchAlgorithmException, UnsupportedEncodingException { """ Converts {@link ObjectName} to a key that helps verifying whether different MBeans can produce same RBAC info @param allJmxAclPids @param objectName @return """ List<String> pidCandidates = iterateDownPids(nameSegments(objectName)); MessageDigest md = MessageDigest.getInstance("MD5"); for (String pc : pidCandidates) { String generalPid = getGeneralPid(allJmxAclPids, pc); if (generalPid.length() > 0) { md.update(generalPid.getBytes("UTF-8")); } } return Hex.encodeHexString(md.digest()); }
java
static String pidListKey(List<String> allJmxAclPids, ObjectName objectName) throws NoSuchAlgorithmException, UnsupportedEncodingException { List<String> pidCandidates = iterateDownPids(nameSegments(objectName)); MessageDigest md = MessageDigest.getInstance("MD5"); for (String pc : pidCandidates) { String generalPid = getGeneralPid(allJmxAclPids, pc); if (generalPid.length() > 0) { md.update(generalPid.getBytes("UTF-8")); } } return Hex.encodeHexString(md.digest()); }
[ "static", "String", "pidListKey", "(", "List", "<", "String", ">", "allJmxAclPids", ",", "ObjectName", "objectName", ")", "throws", "NoSuchAlgorithmException", ",", "UnsupportedEncodingException", "{", "List", "<", "String", ">", "pidCandidates", "=", "iterateDownPids", "(", "nameSegments", "(", "objectName", ")", ")", ";", "MessageDigest", "md", "=", "MessageDigest", ".", "getInstance", "(", "\"MD5\"", ")", ";", "for", "(", "String", "pc", ":", "pidCandidates", ")", "{", "String", "generalPid", "=", "getGeneralPid", "(", "allJmxAclPids", ",", "pc", ")", ";", "if", "(", "generalPid", ".", "length", "(", ")", ">", "0", ")", "{", "md", ".", "update", "(", "generalPid", ".", "getBytes", "(", "\"UTF-8\"", ")", ")", ";", "}", "}", "return", "Hex", ".", "encodeHexString", "(", "md", ".", "digest", "(", ")", ")", ";", "}" ]
Converts {@link ObjectName} to a key that helps verifying whether different MBeans can produce same RBAC info @param allJmxAclPids @param objectName @return
[ "Converts", "{" ]
train
https://github.com/hawtio/hawtio/blob/d8b1c8f246307c0313ba297a494106d0859f3ffd/platforms/hawtio-osgi-jmx/src/main/java/io/hawt/osgi/jmx/RBACDecorator.java#L314-L325
esigate/esigate
esigate-core/src/main/java/org/esigate/extension/ExtensionFactory.java
ExtensionFactory.getExtension
public static <T extends Extension> T getExtension(Properties properties, Parameter<String> parameter, Driver d) { """ Get an extension as configured in properties. @param properties properties @param parameter the class name parameter @param d driver @param <T> class which extends Extension class which extends Extension @return instance of {@link Extension} or null. """ T result; String className = parameter.getValue(properties); if (className == null) { return null; } try { if (LOG.isDebugEnabled()) { LOG.debug("Creating extension " + className); } result = (T) Class.forName(className).newInstance(); result.init(d, properties); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { throw new ConfigurationException(e); } return result; }
java
public static <T extends Extension> T getExtension(Properties properties, Parameter<String> parameter, Driver d) { T result; String className = parameter.getValue(properties); if (className == null) { return null; } try { if (LOG.isDebugEnabled()) { LOG.debug("Creating extension " + className); } result = (T) Class.forName(className).newInstance(); result.init(d, properties); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { throw new ConfigurationException(e); } return result; }
[ "public", "static", "<", "T", "extends", "Extension", ">", "T", "getExtension", "(", "Properties", "properties", ",", "Parameter", "<", "String", ">", "parameter", ",", "Driver", "d", ")", "{", "T", "result", ";", "String", "className", "=", "parameter", ".", "getValue", "(", "properties", ")", ";", "if", "(", "className", "==", "null", ")", "{", "return", "null", ";", "}", "try", "{", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{", "LOG", ".", "debug", "(", "\"Creating extension \"", "+", "className", ")", ";", "}", "result", "=", "(", "T", ")", "Class", ".", "forName", "(", "className", ")", ".", "newInstance", "(", ")", ";", "result", ".", "init", "(", "d", ",", "properties", ")", ";", "}", "catch", "(", "InstantiationException", "|", "IllegalAccessException", "|", "ClassNotFoundException", "e", ")", "{", "throw", "new", "ConfigurationException", "(", "e", ")", ";", "}", "return", "result", ";", "}" ]
Get an extension as configured in properties. @param properties properties @param parameter the class name parameter @param d driver @param <T> class which extends Extension class which extends Extension @return instance of {@link Extension} or null.
[ "Get", "an", "extension", "as", "configured", "in", "properties", "." ]
train
https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/extension/ExtensionFactory.java#L57-L73
hypercube1024/firefly
firefly/src/main/java/com/firefly/codec/http2/model/MultiPartContentProvider.java
MultiPartContentProvider.addFilePart
public void addFilePart(String name, String fileName, ContentProvider content, HttpFields fields) { """ <p>Adds a file part with the given {@code name} as field name, the given {@code fileName} as file name, and the given {@code content} as part content.</p> @param name the part name @param fileName the file name associated to this part @param content the part content @param fields the headers associated with this part """ addPart(new Part(name, fileName, "application/octet-stream", content, fields)); }
java
public void addFilePart(String name, String fileName, ContentProvider content, HttpFields fields) { addPart(new Part(name, fileName, "application/octet-stream", content, fields)); }
[ "public", "void", "addFilePart", "(", "String", "name", ",", "String", "fileName", ",", "ContentProvider", "content", ",", "HttpFields", "fields", ")", "{", "addPart", "(", "new", "Part", "(", "name", ",", "fileName", ",", "\"application/octet-stream\"", ",", "content", ",", "fields", ")", ")", ";", "}" ]
<p>Adds a file part with the given {@code name} as field name, the given {@code fileName} as file name, and the given {@code content} as part content.</p> @param name the part name @param fileName the file name associated to this part @param content the part content @param fields the headers associated with this part
[ "<p", ">", "Adds", "a", "file", "part", "with", "the", "given", "{", "@code", "name", "}", "as", "field", "name", "the", "given", "{", "@code", "fileName", "}", "as", "file", "name", "and", "the", "given", "{", "@code", "content", "}", "as", "part", "content", ".", "<", "/", "p", ">" ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/http2/model/MultiPartContentProvider.java#L83-L85
Azure/azure-sdk-for-java
compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetsInner.java
VirtualMachineScaleSetsInner.getOSUpgradeHistoryAsync
public Observable<Page<UpgradeOperationHistoricalStatusInfoInner>> getOSUpgradeHistoryAsync(final String resourceGroupName, final String vmScaleSetName) { """ Gets list of OS upgrades on a VM scale set instance. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;UpgradeOperationHistoricalStatusInfoInner&gt; object """ return getOSUpgradeHistoryWithServiceResponseAsync(resourceGroupName, vmScaleSetName) .map(new Func1<ServiceResponse<Page<UpgradeOperationHistoricalStatusInfoInner>>, Page<UpgradeOperationHistoricalStatusInfoInner>>() { @Override public Page<UpgradeOperationHistoricalStatusInfoInner> call(ServiceResponse<Page<UpgradeOperationHistoricalStatusInfoInner>> response) { return response.body(); } }); }
java
public Observable<Page<UpgradeOperationHistoricalStatusInfoInner>> getOSUpgradeHistoryAsync(final String resourceGroupName, final String vmScaleSetName) { return getOSUpgradeHistoryWithServiceResponseAsync(resourceGroupName, vmScaleSetName) .map(new Func1<ServiceResponse<Page<UpgradeOperationHistoricalStatusInfoInner>>, Page<UpgradeOperationHistoricalStatusInfoInner>>() { @Override public Page<UpgradeOperationHistoricalStatusInfoInner> call(ServiceResponse<Page<UpgradeOperationHistoricalStatusInfoInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "UpgradeOperationHistoricalStatusInfoInner", ">", ">", "getOSUpgradeHistoryAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "vmScaleSetName", ")", "{", "return", "getOSUpgradeHistoryWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmScaleSetName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "UpgradeOperationHistoricalStatusInfoInner", ">", ">", ",", "Page", "<", "UpgradeOperationHistoricalStatusInfoInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "UpgradeOperationHistoricalStatusInfoInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "UpgradeOperationHistoricalStatusInfoInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets list of OS upgrades on a VM scale set instance. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;UpgradeOperationHistoricalStatusInfoInner&gt; object
[ "Gets", "list", "of", "OS", "upgrades", "on", "a", "VM", "scale", "set", "instance", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetsInner.java#L1793-L1801
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemTemplateElement.java
ElemTemplateElement.containsExcludeResultPrefix
public boolean containsExcludeResultPrefix(String prefix, String uri) { """ Get whether or not the passed URL is contained flagged by the "extension-element-prefixes" property. This method is overridden by {@link ElemLiteralResult#containsExcludeResultPrefix}. @see <a href="http://www.w3.org/TR/xslt#extension-element">extension-element in XSLT Specification</a> @param prefix non-null reference to prefix that might be excluded. @return true if the prefix should normally be excluded. """ ElemTemplateElement parent = this.getParentElem(); if(null != parent) return parent.containsExcludeResultPrefix(prefix, uri); return false; }
java
public boolean containsExcludeResultPrefix(String prefix, String uri) { ElemTemplateElement parent = this.getParentElem(); if(null != parent) return parent.containsExcludeResultPrefix(prefix, uri); return false; }
[ "public", "boolean", "containsExcludeResultPrefix", "(", "String", "prefix", ",", "String", "uri", ")", "{", "ElemTemplateElement", "parent", "=", "this", ".", "getParentElem", "(", ")", ";", "if", "(", "null", "!=", "parent", ")", "return", "parent", ".", "containsExcludeResultPrefix", "(", "prefix", ",", "uri", ")", ";", "return", "false", ";", "}" ]
Get whether or not the passed URL is contained flagged by the "extension-element-prefixes" property. This method is overridden by {@link ElemLiteralResult#containsExcludeResultPrefix}. @see <a href="http://www.w3.org/TR/xslt#extension-element">extension-element in XSLT Specification</a> @param prefix non-null reference to prefix that might be excluded. @return true if the prefix should normally be excluded.
[ "Get", "whether", "or", "not", "the", "passed", "URL", "is", "contained", "flagged", "by", "the", "extension", "-", "element", "-", "prefixes", "property", ".", "This", "method", "is", "overridden", "by", "{", "@link", "ElemLiteralResult#containsExcludeResultPrefix", "}", ".", "@see", "<a", "href", "=", "http", ":", "//", "www", ".", "w3", ".", "org", "/", "TR", "/", "xslt#extension", "-", "element", ">", "extension", "-", "element", "in", "XSLT", "Specification<", "/", "a", ">" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemTemplateElement.java#L980-L987
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/tools/HttpTools.java
HttpTools.deleteRequest
public String deleteRequest(final URL url) throws MovieDbException { """ Execute a DELETE on the URL @param url URL to use in the request @return String content @throws MovieDbException exception """ try { HttpDelete httpDel = new HttpDelete(url.toURI()); return validateResponse(DigestedResponseReader.deleteContent(httpClient, httpDel, CHARSET), url); } catch (URISyntaxException | IOException ex) { throw new MovieDbException(ApiExceptionType.CONNECTION_ERROR, null, url, ex); } }
java
public String deleteRequest(final URL url) throws MovieDbException { try { HttpDelete httpDel = new HttpDelete(url.toURI()); return validateResponse(DigestedResponseReader.deleteContent(httpClient, httpDel, CHARSET), url); } catch (URISyntaxException | IOException ex) { throw new MovieDbException(ApiExceptionType.CONNECTION_ERROR, null, url, ex); } }
[ "public", "String", "deleteRequest", "(", "final", "URL", "url", ")", "throws", "MovieDbException", "{", "try", "{", "HttpDelete", "httpDel", "=", "new", "HttpDelete", "(", "url", ".", "toURI", "(", ")", ")", ";", "return", "validateResponse", "(", "DigestedResponseReader", ".", "deleteContent", "(", "httpClient", ",", "httpDel", ",", "CHARSET", ")", ",", "url", ")", ";", "}", "catch", "(", "URISyntaxException", "|", "IOException", "ex", ")", "{", "throw", "new", "MovieDbException", "(", "ApiExceptionType", ".", "CONNECTION_ERROR", ",", "null", ",", "url", ",", "ex", ")", ";", "}", "}" ]
Execute a DELETE on the URL @param url URL to use in the request @return String content @throws MovieDbException exception
[ "Execute", "a", "DELETE", "on", "the", "URL" ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/tools/HttpTools.java#L110-L117
cdk/cdk
storage/io/src/main/java/org/openscience/cdk/io/cml/CMLResolver.java
CMLResolver.resolveEntity
@Override public InputSource resolveEntity(String publicId, String systemId) { """ Resolves SYSTEM and PUBLIC identifiers for CML DTDs. @param publicId the PUBLIC identifier of the DTD (unused) @param systemId the SYSTEM identifier of the DTD @return the CML DTD as an InputSource or null if id's unresolvable """ logger.debug("CMLResolver: resolving ", publicId, ", ", systemId); systemId = systemId.toLowerCase(); if ((systemId.indexOf("cml-1999-05-15.dtd") != -1) || (systemId.indexOf("cml.dtd") != -1) || (systemId.indexOf("cml1_0.dtd") != -1)) { logger.info("File has CML 1.0 DTD"); return getCMLType("cml1_0.dtd"); } else if ((systemId.indexOf("cml-2001-04-06.dtd") != -1) || (systemId.indexOf("cml1_0_1.dtd") != -1) || (systemId.indexOf("cml_1_0_1.dtd") != -1)) { logger.info("File has CML 1.0.1 DTD"); return getCMLType("cml1_0_1.dtd"); } else { logger.warn("Could not resolve systemID: ", systemId); return null; } }
java
@Override public InputSource resolveEntity(String publicId, String systemId) { logger.debug("CMLResolver: resolving ", publicId, ", ", systemId); systemId = systemId.toLowerCase(); if ((systemId.indexOf("cml-1999-05-15.dtd") != -1) || (systemId.indexOf("cml.dtd") != -1) || (systemId.indexOf("cml1_0.dtd") != -1)) { logger.info("File has CML 1.0 DTD"); return getCMLType("cml1_0.dtd"); } else if ((systemId.indexOf("cml-2001-04-06.dtd") != -1) || (systemId.indexOf("cml1_0_1.dtd") != -1) || (systemId.indexOf("cml_1_0_1.dtd") != -1)) { logger.info("File has CML 1.0.1 DTD"); return getCMLType("cml1_0_1.dtd"); } else { logger.warn("Could not resolve systemID: ", systemId); return null; } }
[ "@", "Override", "public", "InputSource", "resolveEntity", "(", "String", "publicId", ",", "String", "systemId", ")", "{", "logger", ".", "debug", "(", "\"CMLResolver: resolving \"", ",", "publicId", ",", "\", \"", ",", "systemId", ")", ";", "systemId", "=", "systemId", ".", "toLowerCase", "(", ")", ";", "if", "(", "(", "systemId", ".", "indexOf", "(", "\"cml-1999-05-15.dtd\"", ")", "!=", "-", "1", ")", "||", "(", "systemId", ".", "indexOf", "(", "\"cml.dtd\"", ")", "!=", "-", "1", ")", "||", "(", "systemId", ".", "indexOf", "(", "\"cml1_0.dtd\"", ")", "!=", "-", "1", ")", ")", "{", "logger", ".", "info", "(", "\"File has CML 1.0 DTD\"", ")", ";", "return", "getCMLType", "(", "\"cml1_0.dtd\"", ")", ";", "}", "else", "if", "(", "(", "systemId", ".", "indexOf", "(", "\"cml-2001-04-06.dtd\"", ")", "!=", "-", "1", ")", "||", "(", "systemId", ".", "indexOf", "(", "\"cml1_0_1.dtd\"", ")", "!=", "-", "1", ")", "||", "(", "systemId", ".", "indexOf", "(", "\"cml_1_0_1.dtd\"", ")", "!=", "-", "1", ")", ")", "{", "logger", ".", "info", "(", "\"File has CML 1.0.1 DTD\"", ")", ";", "return", "getCMLType", "(", "\"cml1_0_1.dtd\"", ")", ";", "}", "else", "{", "logger", ".", "warn", "(", "\"Could not resolve systemID: \"", ",", "systemId", ")", ";", "return", "null", ";", "}", "}" ]
Resolves SYSTEM and PUBLIC identifiers for CML DTDs. @param publicId the PUBLIC identifier of the DTD (unused) @param systemId the SYSTEM identifier of the DTD @return the CML DTD as an InputSource or null if id's unresolvable
[ "Resolves", "SYSTEM", "and", "PUBLIC", "identifiers", "for", "CML", "DTDs", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/storage/io/src/main/java/org/openscience/cdk/io/cml/CMLResolver.java#L69-L85
radkovo/jStyleParser
src/main/java/cz/vutbr/web/domassign/DeclarationTransformerImpl.java
DeclarationTransformerImpl.processAdditionalCSSGenericProperty
private boolean processAdditionalCSSGenericProperty(Declaration d, Map<String, CSSProperty> properties, Map<String, Term<?>> values) { """ Processes an unknown property and stores its value. Unknown properties containing multiple values are ignored (the interpretation is not clear). @param d the declaration. @param properties the properties. @param values the values. @return <code>true</code>, if the property has been pared successfully """ if (d.size() == 1) { Term<?> term = d.get(0); if (term instanceof TermIdent) return genericProperty(GenericCSSPropertyProxy.class, (TermIdent) term, true, properties, d.getProperty()); else return genericTerm(TermLength.class, term, d.getProperty(), null, ValueRange.ALLOW_ALL, properties, values) || genericTerm(TermPercent.class, term, d.getProperty(), null, ValueRange.ALLOW_ALL, properties, values) || genericTerm(TermInteger.class, term, d.getProperty(), null, ValueRange.ALLOW_ALL, properties, values) || genericTermColor(term, d.getProperty(), null, properties, values); } else { log.warn("Ignoring unsupported property " + d.getProperty() + " with multiple values"); return false; } }
java
private boolean processAdditionalCSSGenericProperty(Declaration d, Map<String, CSSProperty> properties, Map<String, Term<?>> values) { if (d.size() == 1) { Term<?> term = d.get(0); if (term instanceof TermIdent) return genericProperty(GenericCSSPropertyProxy.class, (TermIdent) term, true, properties, d.getProperty()); else return genericTerm(TermLength.class, term, d.getProperty(), null, ValueRange.ALLOW_ALL, properties, values) || genericTerm(TermPercent.class, term, d.getProperty(), null, ValueRange.ALLOW_ALL, properties, values) || genericTerm(TermInteger.class, term, d.getProperty(), null, ValueRange.ALLOW_ALL, properties, values) || genericTermColor(term, d.getProperty(), null, properties, values); } else { log.warn("Ignoring unsupported property " + d.getProperty() + " with multiple values"); return false; } }
[ "private", "boolean", "processAdditionalCSSGenericProperty", "(", "Declaration", "d", ",", "Map", "<", "String", ",", "CSSProperty", ">", "properties", ",", "Map", "<", "String", ",", "Term", "<", "?", ">", ">", "values", ")", "{", "if", "(", "d", ".", "size", "(", ")", "==", "1", ")", "{", "Term", "<", "?", ">", "term", "=", "d", ".", "get", "(", "0", ")", ";", "if", "(", "term", "instanceof", "TermIdent", ")", "return", "genericProperty", "(", "GenericCSSPropertyProxy", ".", "class", ",", "(", "TermIdent", ")", "term", ",", "true", ",", "properties", ",", "d", ".", "getProperty", "(", ")", ")", ";", "else", "return", "genericTerm", "(", "TermLength", ".", "class", ",", "term", ",", "d", ".", "getProperty", "(", ")", ",", "null", ",", "ValueRange", ".", "ALLOW_ALL", ",", "properties", ",", "values", ")", "||", "genericTerm", "(", "TermPercent", ".", "class", ",", "term", ",", "d", ".", "getProperty", "(", ")", ",", "null", ",", "ValueRange", ".", "ALLOW_ALL", ",", "properties", ",", "values", ")", "||", "genericTerm", "(", "TermInteger", ".", "class", ",", "term", ",", "d", ".", "getProperty", "(", ")", ",", "null", ",", "ValueRange", ".", "ALLOW_ALL", ",", "properties", ",", "values", ")", "||", "genericTermColor", "(", "term", ",", "d", ".", "getProperty", "(", ")", ",", "null", ",", "properties", ",", "values", ")", ";", "}", "else", "{", "log", ".", "warn", "(", "\"Ignoring unsupported property \"", "+", "d", ".", "getProperty", "(", ")", "+", "\" with multiple values\"", ")", ";", "return", "false", ";", "}", "}" ]
Processes an unknown property and stores its value. Unknown properties containing multiple values are ignored (the interpretation is not clear). @param d the declaration. @param properties the properties. @param values the values. @return <code>true</code>, if the property has been pared successfully
[ "Processes", "an", "unknown", "property", "and", "stores", "its", "value", ".", "Unknown", "properties", "containing", "multiple", "values", "are", "ignored", "(", "the", "interpretation", "is", "not", "clear", ")", "." ]
train
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/DeclarationTransformerImpl.java#L1949-L1968
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java
StringUtil.compressQuotes
public static String compressQuotes(String source, String quotes) { """ Compress 2 adjacent (single or double) quotes into a single (s or d) quote when found in the middle of a String. NOTE: """" or '''' will be compressed into "" or ''. This function assumes that the leading and trailing quote from a string or delimited identifier have already been removed. @param source string to be compressed @param quotes string containing two single or double quotes. @return String where quotes have been compressed """ String result = source; int index; /* Find the first occurrence of adjacent quotes. */ index = result.indexOf(quotes); /* Replace each occurrence with a single quote and begin the * search for the next occurrence from where we left off. */ while (index != -1) { result = result.substring(0, index + 1) + result.substring(index + 2); index = result.indexOf(quotes, index + 1); } return result; }
java
public static String compressQuotes(String source, String quotes) { String result = source; int index; /* Find the first occurrence of adjacent quotes. */ index = result.indexOf(quotes); /* Replace each occurrence with a single quote and begin the * search for the next occurrence from where we left off. */ while (index != -1) { result = result.substring(0, index + 1) + result.substring(index + 2); index = result.indexOf(quotes, index + 1); } return result; }
[ "public", "static", "String", "compressQuotes", "(", "String", "source", ",", "String", "quotes", ")", "{", "String", "result", "=", "source", ";", "int", "index", ";", "/* Find the first occurrence of adjacent quotes. */", "index", "=", "result", ".", "indexOf", "(", "quotes", ")", ";", "/* Replace each occurrence with a single quote and begin the\n * search for the next occurrence from where we left off.\n */", "while", "(", "index", "!=", "-", "1", ")", "{", "result", "=", "result", ".", "substring", "(", "0", ",", "index", "+", "1", ")", "+", "result", ".", "substring", "(", "index", "+", "2", ")", ";", "index", "=", "result", ".", "indexOf", "(", "quotes", ",", "index", "+", "1", ")", ";", "}", "return", "result", ";", "}" ]
Compress 2 adjacent (single or double) quotes into a single (s or d) quote when found in the middle of a String. NOTE: """" or '''' will be compressed into "" or ''. This function assumes that the leading and trailing quote from a string or delimited identifier have already been removed. @param source string to be compressed @param quotes string containing two single or double quotes. @return String where quotes have been compressed
[ "Compress", "2", "adjacent", "(", "single", "or", "double", ")", "quotes", "into", "a", "single", "(", "s", "or", "d", ")", "quote", "when", "found", "in", "the", "middle", "of", "a", "String", "." ]
train
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java#L734-L751
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.mergeCertificateAsync
public ServiceFuture<CertificateBundle> mergeCertificateAsync(String vaultBaseUrl, String certificateName, List<byte[]> x509Certificates, CertificateAttributes certificateAttributes, Map<String, String> tags, final ServiceCallback<CertificateBundle> serviceCallback) { """ Merges a certificate or a certificate chain with a key pair existing on the server. The MergeCertificate operation performs the merging of a certificate or certificate chain with a key pair currently available in the service. This operation requires the certificates/create permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param certificateName The name of the certificate. @param x509Certificates The certificate or the certificate chain to merge. @param certificateAttributes The attributes of the certificate (optional). @param tags Application specific metadata in the form of key-value pairs. @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(mergeCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, x509Certificates, certificateAttributes, tags), serviceCallback); }
java
public ServiceFuture<CertificateBundle> mergeCertificateAsync(String vaultBaseUrl, String certificateName, List<byte[]> x509Certificates, CertificateAttributes certificateAttributes, Map<String, String> tags, final ServiceCallback<CertificateBundle> serviceCallback) { return ServiceFuture.fromResponse(mergeCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, x509Certificates, certificateAttributes, tags), serviceCallback); }
[ "public", "ServiceFuture", "<", "CertificateBundle", ">", "mergeCertificateAsync", "(", "String", "vaultBaseUrl", ",", "String", "certificateName", ",", "List", "<", "byte", "[", "]", ">", "x509Certificates", ",", "CertificateAttributes", "certificateAttributes", ",", "Map", "<", "String", ",", "String", ">", "tags", ",", "final", "ServiceCallback", "<", "CertificateBundle", ">", "serviceCallback", ")", "{", "return", "ServiceFuture", ".", "fromResponse", "(", "mergeCertificateWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "certificateName", ",", "x509Certificates", ",", "certificateAttributes", ",", "tags", ")", ",", "serviceCallback", ")", ";", "}" ]
Merges a certificate or a certificate chain with a key pair existing on the server. The MergeCertificate operation performs the merging of a certificate or certificate chain with a key pair currently available in the service. This operation requires the certificates/create permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param certificateName The name of the certificate. @param x509Certificates The certificate or the certificate chain to merge. @param certificateAttributes The attributes of the certificate (optional). @param tags Application specific metadata in the form of key-value pairs. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Merges", "a", "certificate", "or", "a", "certificate", "chain", "with", "a", "key", "pair", "existing", "on", "the", "server", ".", "The", "MergeCertificate", "operation", "performs", "the", "merging", "of", "a", "certificate", "or", "certificate", "chain", "with", "a", "key", "pair", "currently", "available", "in", "the", "service", ".", "This", "operation", "requires", "the", "certificates", "/", "create", "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#L8025-L8027
alkacon/opencms-core
src/org/opencms/main/CmsShellCommands.java
CmsShellCommands.setSiteParam
public void setSiteParam(String siteRoot, String key, String value) { """ Sets a site parameter and writes back the updated system configuration.<p> @param siteRoot the root path used to identify the site @param key the parameter key @param value the parameter value """ CmsSite site = OpenCms.getSiteManager().getSiteForRootPath(siteRoot); if (site == null) { throw new IllegalArgumentException("No site found for path: " + siteRoot); } else { site.getParameters().put(key, value); OpenCms.writeConfiguration(CmsSitesConfiguration.class); } }
java
public void setSiteParam(String siteRoot, String key, String value) { CmsSite site = OpenCms.getSiteManager().getSiteForRootPath(siteRoot); if (site == null) { throw new IllegalArgumentException("No site found for path: " + siteRoot); } else { site.getParameters().put(key, value); OpenCms.writeConfiguration(CmsSitesConfiguration.class); } }
[ "public", "void", "setSiteParam", "(", "String", "siteRoot", ",", "String", "key", ",", "String", "value", ")", "{", "CmsSite", "site", "=", "OpenCms", ".", "getSiteManager", "(", ")", ".", "getSiteForRootPath", "(", "siteRoot", ")", ";", "if", "(", "site", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"No site found for path: \"", "+", "siteRoot", ")", ";", "}", "else", "{", "site", ".", "getParameters", "(", ")", ".", "put", "(", "key", ",", "value", ")", ";", "OpenCms", ".", "writeConfiguration", "(", "CmsSitesConfiguration", ".", "class", ")", ";", "}", "}" ]
Sets a site parameter and writes back the updated system configuration.<p> @param siteRoot the root path used to identify the site @param key the parameter key @param value the parameter value
[ "Sets", "a", "site", "parameter", "and", "writes", "back", "the", "updated", "system", "configuration", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsShellCommands.java#L1569-L1578
hdbeukel/james-core
src/main/java/org/jamesframework/core/subset/algo/tabu/IDBasedSubsetTabuMemory.java
IDBasedSubsetTabuMemory.registerVisitedSolution
@Override public void registerVisitedSolution(SubsetSolution visitedSolution, Move<? super SubsetSolution> appliedMove) { """ Registers an applied subset move by storing all involved IDs (added or deleted) in the tabu memory. It is required that the given move is of type {@link SubsetMove}, else an {@link IncompatibleTabuMemoryException} will be thrown. The argument <code>visitedSolution</code> is ignored, as the applied move contains all necessary information, and may be <code>null</code>. If <code>appliedMove</code> is <code>null</code>, calling this method does not have any effect. @param visitedSolution newly visited solution (not used here, allowed be <code>null</code>) @param appliedMove applied move of which all involved IDs are stored in the tabu memory @throws IncompatibleTabuMemoryException if the given move is not of type {@link SubsetMove} """ // don't do anything if move is null if(appliedMove != null){ // check move type if(appliedMove instanceof SubsetMove){ // cast SubsetMove sMove = (SubsetMove) appliedMove; // store involved IDs memory.addAll(sMove.getAddedIDs()); memory.addAll(sMove.getDeletedIDs()); } else { // wrong move type throw new IncompatibleTabuMemoryException("ID based subset tabu memory can only be used in combination with " + "neighbourhoods that generate moves of type SubsetMove. Received: " + appliedMove.getClass().getName()); } } }
java
@Override public void registerVisitedSolution(SubsetSolution visitedSolution, Move<? super SubsetSolution> appliedMove) { // don't do anything if move is null if(appliedMove != null){ // check move type if(appliedMove instanceof SubsetMove){ // cast SubsetMove sMove = (SubsetMove) appliedMove; // store involved IDs memory.addAll(sMove.getAddedIDs()); memory.addAll(sMove.getDeletedIDs()); } else { // wrong move type throw new IncompatibleTabuMemoryException("ID based subset tabu memory can only be used in combination with " + "neighbourhoods that generate moves of type SubsetMove. Received: " + appliedMove.getClass().getName()); } } }
[ "@", "Override", "public", "void", "registerVisitedSolution", "(", "SubsetSolution", "visitedSolution", ",", "Move", "<", "?", "super", "SubsetSolution", ">", "appliedMove", ")", "{", "// don't do anything if move is null", "if", "(", "appliedMove", "!=", "null", ")", "{", "// check move type", "if", "(", "appliedMove", "instanceof", "SubsetMove", ")", "{", "// cast", "SubsetMove", "sMove", "=", "(", "SubsetMove", ")", "appliedMove", ";", "// store involved IDs", "memory", ".", "addAll", "(", "sMove", ".", "getAddedIDs", "(", ")", ")", ";", "memory", ".", "addAll", "(", "sMove", ".", "getDeletedIDs", "(", ")", ")", ";", "}", "else", "{", "// wrong move type", "throw", "new", "IncompatibleTabuMemoryException", "(", "\"ID based subset tabu memory can only be used in combination with \"", "+", "\"neighbourhoods that generate moves of type SubsetMove. Received: \"", "+", "appliedMove", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "}", "}" ]
Registers an applied subset move by storing all involved IDs (added or deleted) in the tabu memory. It is required that the given move is of type {@link SubsetMove}, else an {@link IncompatibleTabuMemoryException} will be thrown. The argument <code>visitedSolution</code> is ignored, as the applied move contains all necessary information, and may be <code>null</code>. If <code>appliedMove</code> is <code>null</code>, calling this method does not have any effect. @param visitedSolution newly visited solution (not used here, allowed be <code>null</code>) @param appliedMove applied move of which all involved IDs are stored in the tabu memory @throws IncompatibleTabuMemoryException if the given move is not of type {@link SubsetMove}
[ "Registers", "an", "applied", "subset", "move", "by", "storing", "all", "involved", "IDs", "(", "added", "or", "deleted", ")", "in", "the", "tabu", "memory", ".", "It", "is", "required", "that", "the", "given", "move", "is", "of", "type", "{", "@link", "SubsetMove", "}", "else", "an", "{", "@link", "IncompatibleTabuMemoryException", "}", "will", "be", "thrown", ".", "The", "argument", "<code", ">", "visitedSolution<", "/", "code", ">", "is", "ignored", "as", "the", "applied", "move", "contains", "all", "necessary", "information", "and", "may", "be", "<code", ">", "null<", "/", "code", ">", ".", "If", "<code", ">", "appliedMove<", "/", "code", ">", "is", "<code", ">", "null<", "/", "code", ">", "calling", "this", "method", "does", "not", "have", "any", "effect", "." ]
train
https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/subset/algo/tabu/IDBasedSubsetTabuMemory.java#L106-L124
nemerosa/ontrack
ontrack-model/src/main/java/net/nemerosa/ontrack/model/structure/TemplateDefinition.java
TemplateDefinition.templateInstanceExecution
public TemplateInstanceExecution templateInstanceExecution(String sourceName, ExpressionEngine expressionEngine) { """ Gets the execution context for the creation of a template instance. @param sourceName Input for the expression @param expressionEngine Expression engine to use @return Transformed string """ // Transforms each parameter in a name/value pair, using only the source name as input Map<String, String> sourceNameInput = Collections.singletonMap("sourceName", sourceName); Map<String, String> parameterMap = Maps.transformValues( Maps.uniqueIndex( parameters, TemplateParameter::getName ), parameter -> expressionEngine.render(parameter.getExpression(), sourceNameInput) ); // Concatenates the maps Map<String, String> inputMap = new HashMap<>(sourceNameInput); inputMap.putAll(parameterMap); // Resolves the final expression return new TemplateInstanceExecution( value -> expressionEngine.render(value, inputMap), parameterMap ); }
java
public TemplateInstanceExecution templateInstanceExecution(String sourceName, ExpressionEngine expressionEngine) { // Transforms each parameter in a name/value pair, using only the source name as input Map<String, String> sourceNameInput = Collections.singletonMap("sourceName", sourceName); Map<String, String> parameterMap = Maps.transformValues( Maps.uniqueIndex( parameters, TemplateParameter::getName ), parameter -> expressionEngine.render(parameter.getExpression(), sourceNameInput) ); // Concatenates the maps Map<String, String> inputMap = new HashMap<>(sourceNameInput); inputMap.putAll(parameterMap); // Resolves the final expression return new TemplateInstanceExecution( value -> expressionEngine.render(value, inputMap), parameterMap ); }
[ "public", "TemplateInstanceExecution", "templateInstanceExecution", "(", "String", "sourceName", ",", "ExpressionEngine", "expressionEngine", ")", "{", "// Transforms each parameter in a name/value pair, using only the source name as input", "Map", "<", "String", ",", "String", ">", "sourceNameInput", "=", "Collections", ".", "singletonMap", "(", "\"sourceName\"", ",", "sourceName", ")", ";", "Map", "<", "String", ",", "String", ">", "parameterMap", "=", "Maps", ".", "transformValues", "(", "Maps", ".", "uniqueIndex", "(", "parameters", ",", "TemplateParameter", "::", "getName", ")", ",", "parameter", "->", "expressionEngine", ".", "render", "(", "parameter", ".", "getExpression", "(", ")", ",", "sourceNameInput", ")", ")", ";", "// Concatenates the maps", "Map", "<", "String", ",", "String", ">", "inputMap", "=", "new", "HashMap", "<>", "(", "sourceNameInput", ")", ";", "inputMap", ".", "putAll", "(", "parameterMap", ")", ";", "// Resolves the final expression", "return", "new", "TemplateInstanceExecution", "(", "value", "->", "expressionEngine", ".", "render", "(", "value", ",", "inputMap", ")", ",", "parameterMap", ")", ";", "}" ]
Gets the execution context for the creation of a template instance. @param sourceName Input for the expression @param expressionEngine Expression engine to use @return Transformed string
[ "Gets", "the", "execution", "context", "for", "the", "creation", "of", "a", "template", "instance", "." ]
train
https://github.com/nemerosa/ontrack/blob/37b0874cbf387b58aba95cd3c1bc3b15e11bc913/ontrack-model/src/main/java/net/nemerosa/ontrack/model/structure/TemplateDefinition.java#L53-L71
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/MetadataFinder.java
MetadataFinder.getCueList
CueList getCueList(int rekordboxId, CdjStatus.TrackSourceSlot slot, Client client) throws IOException { """ Requests the cue list for a specific track ID, given a dbserver connection to a player that has already been set up. @param rekordboxId the track of interest @param slot identifies the media slot we are querying @param client the dbserver client that is communicating with the appropriate player @return the retrieved cue list, or {@code null} if none was available @throws IOException if there is a communication problem """ Message response = client.simpleRequest(Message.KnownType.CUE_LIST_REQ, null, client.buildRMST(Message.MenuIdentifier.DATA, slot), new NumberField(rekordboxId)); if (response.knownType == Message.KnownType.CUE_LIST) { return new CueList(response); } logger.error("Unexpected response type when requesting cue list: {}", response); return null; }
java
CueList getCueList(int rekordboxId, CdjStatus.TrackSourceSlot slot, Client client) throws IOException { Message response = client.simpleRequest(Message.KnownType.CUE_LIST_REQ, null, client.buildRMST(Message.MenuIdentifier.DATA, slot), new NumberField(rekordboxId)); if (response.knownType == Message.KnownType.CUE_LIST) { return new CueList(response); } logger.error("Unexpected response type when requesting cue list: {}", response); return null; }
[ "CueList", "getCueList", "(", "int", "rekordboxId", ",", "CdjStatus", ".", "TrackSourceSlot", "slot", ",", "Client", "client", ")", "throws", "IOException", "{", "Message", "response", "=", "client", ".", "simpleRequest", "(", "Message", ".", "KnownType", ".", "CUE_LIST_REQ", ",", "null", ",", "client", ".", "buildRMST", "(", "Message", ".", "MenuIdentifier", ".", "DATA", ",", "slot", ")", ",", "new", "NumberField", "(", "rekordboxId", ")", ")", ";", "if", "(", "response", ".", "knownType", "==", "Message", ".", "KnownType", ".", "CUE_LIST", ")", "{", "return", "new", "CueList", "(", "response", ")", ";", "}", "logger", ".", "error", "(", "\"Unexpected response type when requesting cue list: {}\"", ",", "response", ")", ";", "return", "null", ";", "}" ]
Requests the cue list for a specific track ID, given a dbserver connection to a player that has already been set up. @param rekordboxId the track of interest @param slot identifies the media slot we are querying @param client the dbserver client that is communicating with the appropriate player @return the retrieved cue list, or {@code null} if none was available @throws IOException if there is a communication problem
[ "Requests", "the", "cue", "list", "for", "a", "specific", "track", "ID", "given", "a", "dbserver", "connection", "to", "a", "player", "that", "has", "already", "been", "set", "up", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/MetadataFinder.java#L188-L197
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/utils/ManifestUtils.java
ManifestUtils.findManifestProperty
public static String findManifestProperty( Properties props, String propertyName ) { """ Finds a property in the MANIFEST properties. @param props the properties @param propertyName the property's name @return the property's value, or null if it was not found """ String result = null; for( Map.Entry<Object,Object> entry : props.entrySet()) { if( propertyName.equalsIgnoreCase( String.valueOf( entry.getKey()))) { result = String.valueOf( entry.getValue()); break; } } return result; }
java
public static String findManifestProperty( Properties props, String propertyName ) { String result = null; for( Map.Entry<Object,Object> entry : props.entrySet()) { if( propertyName.equalsIgnoreCase( String.valueOf( entry.getKey()))) { result = String.valueOf( entry.getValue()); break; } } return result; }
[ "public", "static", "String", "findManifestProperty", "(", "Properties", "props", ",", "String", "propertyName", ")", "{", "String", "result", "=", "null", ";", "for", "(", "Map", ".", "Entry", "<", "Object", ",", "Object", ">", "entry", ":", "props", ".", "entrySet", "(", ")", ")", "{", "if", "(", "propertyName", ".", "equalsIgnoreCase", "(", "String", ".", "valueOf", "(", "entry", ".", "getKey", "(", ")", ")", ")", ")", "{", "result", "=", "String", ".", "valueOf", "(", "entry", ".", "getValue", "(", ")", ")", ";", "break", ";", "}", "}", "return", "result", ";", "}" ]
Finds a property in the MANIFEST properties. @param props the properties @param propertyName the property's name @return the property's value, or null if it was not found
[ "Finds", "a", "property", "in", "the", "MANIFEST", "properties", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/utils/ManifestUtils.java#L126-L137
Drivemode/TypefaceHelper
TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java
TypefaceHelper.setTypeface
public void setTypeface(Paint paint, @StringRes int strResId) { """ Set the typeface to the target paint. @param paint the set typeface. @param strResId string resource containing typeface name. """ setTypeface(paint, mApplication.getString(strResId)); }
java
public void setTypeface(Paint paint, @StringRes int strResId) { setTypeface(paint, mApplication.getString(strResId)); }
[ "public", "void", "setTypeface", "(", "Paint", "paint", ",", "@", "StringRes", "int", "strResId", ")", "{", "setTypeface", "(", "paint", ",", "mApplication", ".", "getString", "(", "strResId", ")", ")", ";", "}" ]
Set the typeface to the target paint. @param paint the set typeface. @param strResId string resource containing typeface name.
[ "Set", "the", "typeface", "to", "the", "target", "paint", "." ]
train
https://github.com/Drivemode/TypefaceHelper/blob/86bef9ce16b9626b7076559e846db1b9f043c008/TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java#L205-L207
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/BigIntegerExtensions.java
BigIntegerExtensions.operator_minus
@Inline(value="$1.subtract($2)") @Pure public static BigInteger operator_minus(BigInteger a, BigInteger b) { """ The binary <code>minus</code> operator. @param a a BigInteger. May not be <code>null</code>. @param b a BigInteger. May not be <code>null</code>. @return <code>a.subtract(b)</code> @throws NullPointerException if {@code a} or {@code b} is <code>null</code>. """ return a.subtract(b); }
java
@Inline(value="$1.subtract($2)") @Pure public static BigInteger operator_minus(BigInteger a, BigInteger b) { return a.subtract(b); }
[ "@", "Inline", "(", "value", "=", "\"$1.subtract($2)\"", ")", "@", "Pure", "public", "static", "BigInteger", "operator_minus", "(", "BigInteger", "a", ",", "BigInteger", "b", ")", "{", "return", "a", ".", "subtract", "(", "b", ")", ";", "}" ]
The binary <code>minus</code> operator. @param a a BigInteger. May not be <code>null</code>. @param b a BigInteger. May not be <code>null</code>. @return <code>a.subtract(b)</code> @throws NullPointerException if {@code a} or {@code b} is <code>null</code>.
[ "The", "binary", "<code", ">", "minus<", "/", "code", ">", "operator", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/BigIntegerExtensions.java#L65-L69
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/nio/NodeIOService.java
NodeIOService.initRestApiConfig
@SuppressWarnings("deprecation") private static RestApiConfig initRestApiConfig(HazelcastProperties properties, Config config) { """ Initializes {@link RestApiConfig} if not provided based on legacy group properties. Also checks (fails fast) if both the {@link RestApiConfig} and system properties are used. """ boolean isAdvancedNetwork = config.getAdvancedNetworkConfig().isEnabled(); RestApiConfig restApiConfig = config.getNetworkConfig().getRestApiConfig(); boolean isRestConfigPresent = isAdvancedNetwork ? config.getAdvancedNetworkConfig().getEndpointConfigs().get(EndpointQualifier.REST) != null : restApiConfig != null; if (isRestConfigPresent) { // ensure the legacy Hazelcast group properties are not provided ensurePropertyNotConfigured(properties, GroupProperty.REST_ENABLED); ensurePropertyNotConfigured(properties, GroupProperty.HTTP_HEALTHCHECK_ENABLED); } if (isRestConfigPresent && isAdvancedNetwork) { restApiConfig = new RestApiConfig(); restApiConfig.setEnabled(true); RestServerEndpointConfig restServerEndpointConfig = config.getAdvancedNetworkConfig().getRestEndpointConfig(); restApiConfig.setEnabledGroups(restServerEndpointConfig.getEnabledGroups()); } else if (!isRestConfigPresent) { restApiConfig = new RestApiConfig(); if (checkAndLogPropertyDeprecated(properties, GroupProperty.REST_ENABLED)) { restApiConfig.setEnabled(true); restApiConfig.enableAllGroups(); } if (checkAndLogPropertyDeprecated(properties, GroupProperty.HTTP_HEALTHCHECK_ENABLED)) { restApiConfig.setEnabled(true); restApiConfig.enableGroups(RestEndpointGroup.HEALTH_CHECK); } } return restApiConfig; }
java
@SuppressWarnings("deprecation") private static RestApiConfig initRestApiConfig(HazelcastProperties properties, Config config) { boolean isAdvancedNetwork = config.getAdvancedNetworkConfig().isEnabled(); RestApiConfig restApiConfig = config.getNetworkConfig().getRestApiConfig(); boolean isRestConfigPresent = isAdvancedNetwork ? config.getAdvancedNetworkConfig().getEndpointConfigs().get(EndpointQualifier.REST) != null : restApiConfig != null; if (isRestConfigPresent) { // ensure the legacy Hazelcast group properties are not provided ensurePropertyNotConfigured(properties, GroupProperty.REST_ENABLED); ensurePropertyNotConfigured(properties, GroupProperty.HTTP_HEALTHCHECK_ENABLED); } if (isRestConfigPresent && isAdvancedNetwork) { restApiConfig = new RestApiConfig(); restApiConfig.setEnabled(true); RestServerEndpointConfig restServerEndpointConfig = config.getAdvancedNetworkConfig().getRestEndpointConfig(); restApiConfig.setEnabledGroups(restServerEndpointConfig.getEnabledGroups()); } else if (!isRestConfigPresent) { restApiConfig = new RestApiConfig(); if (checkAndLogPropertyDeprecated(properties, GroupProperty.REST_ENABLED)) { restApiConfig.setEnabled(true); restApiConfig.enableAllGroups(); } if (checkAndLogPropertyDeprecated(properties, GroupProperty.HTTP_HEALTHCHECK_ENABLED)) { restApiConfig.setEnabled(true); restApiConfig.enableGroups(RestEndpointGroup.HEALTH_CHECK); } } return restApiConfig; }
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "private", "static", "RestApiConfig", "initRestApiConfig", "(", "HazelcastProperties", "properties", ",", "Config", "config", ")", "{", "boolean", "isAdvancedNetwork", "=", "config", ".", "getAdvancedNetworkConfig", "(", ")", ".", "isEnabled", "(", ")", ";", "RestApiConfig", "restApiConfig", "=", "config", ".", "getNetworkConfig", "(", ")", ".", "getRestApiConfig", "(", ")", ";", "boolean", "isRestConfigPresent", "=", "isAdvancedNetwork", "?", "config", ".", "getAdvancedNetworkConfig", "(", ")", ".", "getEndpointConfigs", "(", ")", ".", "get", "(", "EndpointQualifier", ".", "REST", ")", "!=", "null", ":", "restApiConfig", "!=", "null", ";", "if", "(", "isRestConfigPresent", ")", "{", "// ensure the legacy Hazelcast group properties are not provided", "ensurePropertyNotConfigured", "(", "properties", ",", "GroupProperty", ".", "REST_ENABLED", ")", ";", "ensurePropertyNotConfigured", "(", "properties", ",", "GroupProperty", ".", "HTTP_HEALTHCHECK_ENABLED", ")", ";", "}", "if", "(", "isRestConfigPresent", "&&", "isAdvancedNetwork", ")", "{", "restApiConfig", "=", "new", "RestApiConfig", "(", ")", ";", "restApiConfig", ".", "setEnabled", "(", "true", ")", ";", "RestServerEndpointConfig", "restServerEndpointConfig", "=", "config", ".", "getAdvancedNetworkConfig", "(", ")", ".", "getRestEndpointConfig", "(", ")", ";", "restApiConfig", ".", "setEnabledGroups", "(", "restServerEndpointConfig", ".", "getEnabledGroups", "(", ")", ")", ";", "}", "else", "if", "(", "!", "isRestConfigPresent", ")", "{", "restApiConfig", "=", "new", "RestApiConfig", "(", ")", ";", "if", "(", "checkAndLogPropertyDeprecated", "(", "properties", ",", "GroupProperty", ".", "REST_ENABLED", ")", ")", "{", "restApiConfig", ".", "setEnabled", "(", "true", ")", ";", "restApiConfig", ".", "enableAllGroups", "(", ")", ";", "}", "if", "(", "checkAndLogPropertyDeprecated", "(", "properties", ",", "GroupProperty", ".", "HTTP_HEALTHCHECK_ENABLED", ")", ")", "{", "restApiConfig", ".", "setEnabled", "(", "true", ")", ";", "restApiConfig", ".", "enableGroups", "(", "RestEndpointGroup", ".", "HEALTH_CHECK", ")", ";", "}", "}", "return", "restApiConfig", ";", "}" ]
Initializes {@link RestApiConfig} if not provided based on legacy group properties. Also checks (fails fast) if both the {@link RestApiConfig} and system properties are used.
[ "Initializes", "{" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/nio/NodeIOService.java#L82-L116
tinosteinort/beanrepository
src/main/java/com/github/tinosteinort/beanrepository/BeanRepository.java
BeanRepository.getPrototypeBean
public <T> T getPrototypeBean(final Function<BeanAccessor, T> creator) { """ Returns a new created Object with the given {@code creator}. This equates to a {@code prototype} Bean. It is not required to configure a {@code prototype} Bean in the BeanRepository before. This Method can be used to pass Parameters to the Constructor of an Object. It is also possible to provide References to other Beans in the Constructor, because a {@link BeanAccessor} is provided. The Method {@link PostConstructible#onPostConstruct(BeanRepository)} is executed for every Call of this Method. @param creator The Code to create the new Object @param <T> The Type of the Bean @see BeanAccessor @see PostConstructible @return a new created Object """ final PrototypeProvider provider = new PrototypeProvider(name, creator); return provider.getBean(this, dryRun); }
java
public <T> T getPrototypeBean(final Function<BeanAccessor, T> creator) { final PrototypeProvider provider = new PrototypeProvider(name, creator); return provider.getBean(this, dryRun); }
[ "public", "<", "T", ">", "T", "getPrototypeBean", "(", "final", "Function", "<", "BeanAccessor", ",", "T", ">", "creator", ")", "{", "final", "PrototypeProvider", "provider", "=", "new", "PrototypeProvider", "(", "name", ",", "creator", ")", ";", "return", "provider", ".", "getBean", "(", "this", ",", "dryRun", ")", ";", "}" ]
Returns a new created Object with the given {@code creator}. This equates to a {@code prototype} Bean. It is not required to configure a {@code prototype} Bean in the BeanRepository before. This Method can be used to pass Parameters to the Constructor of an Object. It is also possible to provide References to other Beans in the Constructor, because a {@link BeanAccessor} is provided. The Method {@link PostConstructible#onPostConstruct(BeanRepository)} is executed for every Call of this Method. @param creator The Code to create the new Object @param <T> The Type of the Bean @see BeanAccessor @see PostConstructible @return a new created Object
[ "Returns", "a", "new", "created", "Object", "with", "the", "given", "{", "@code", "creator", "}", ".", "This", "equates", "to", "a", "{", "@code", "prototype", "}", "Bean", ".", "It", "is", "not", "required", "to", "configure", "a", "{", "@code", "prototype", "}", "Bean", "in", "the", "BeanRepository", "before", ".", "This", "Method", "can", "be", "used", "to", "pass", "Parameters", "to", "the", "Constructor", "of", "an", "Object", ".", "It", "is", "also", "possible", "to", "provide", "References", "to", "other", "Beans", "in", "the", "Constructor", "because", "a", "{", "@link", "BeanAccessor", "}", "is", "provided", ".", "The", "Method", "{", "@link", "PostConstructible#onPostConstruct", "(", "BeanRepository", ")", "}", "is", "executed", "for", "every", "Call", "of", "this", "Method", "." ]
train
https://github.com/tinosteinort/beanrepository/blob/4131d1e380ebc511392f3bda9d0966997bb34a62/src/main/java/com/github/tinosteinort/beanrepository/BeanRepository.java#L96-L99
apiman/apiman
gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/DefaultComponentRegistry.java
DefaultComponentRegistry.addComponent
protected <T extends IComponent> void addComponent(Class<T> componentType, T component) { """ Adds a component to the registry. @param componentType @param component """ components.put(componentType, component); }
java
protected <T extends IComponent> void addComponent(Class<T> componentType, T component) { components.put(componentType, component); }
[ "protected", "<", "T", "extends", "IComponent", ">", "void", "addComponent", "(", "Class", "<", "T", ">", "componentType", ",", "T", "component", ")", "{", "components", ".", "put", "(", "componentType", ",", "component", ")", ";", "}" ]
Adds a component to the registry. @param componentType @param component
[ "Adds", "a", "component", "to", "the", "registry", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/DefaultComponentRegistry.java#L107-L109
alipay/sofa-rpc
extension-impl/remoting-http/src/main/java/com/alipay/sofa/rpc/transport/http/AbstractHttp2ClientTransport.java
AbstractHttp2ClientTransport.doInvokeAsync
protected ResponseFuture doInvokeAsync(SofaRequest request, RpcInternalContext rpcContext, int timeoutMillis) { """ 异步调用 @param request 请求对象 @param rpcContext RPC内置上下文 @param timeoutMillis 超时时间(毫秒) """ SofaResponseCallback listener = request.getSofaResponseCallback(); if (listener != null) { AbstractHttpClientHandler callback = new CallbackInvokeClientHandler(transportConfig.getConsumerConfig(), transportConfig.getProviderInfo(), listener, request, rpcContext, ClassLoaderUtils.getCurrentClassLoader()); doSend(request, callback, timeoutMillis); return null; } else { HttpResponseFuture future = new HttpResponseFuture(request, timeoutMillis); AbstractHttpClientHandler callback = new FutureInvokeClientHandler(transportConfig.getConsumerConfig(), transportConfig.getProviderInfo(), future, request, rpcContext, ClassLoaderUtils.getCurrentClassLoader()); doSend(request, callback, timeoutMillis); future.setSentTime(); return future; } }
java
protected ResponseFuture doInvokeAsync(SofaRequest request, RpcInternalContext rpcContext, int timeoutMillis) { SofaResponseCallback listener = request.getSofaResponseCallback(); if (listener != null) { AbstractHttpClientHandler callback = new CallbackInvokeClientHandler(transportConfig.getConsumerConfig(), transportConfig.getProviderInfo(), listener, request, rpcContext, ClassLoaderUtils.getCurrentClassLoader()); doSend(request, callback, timeoutMillis); return null; } else { HttpResponseFuture future = new HttpResponseFuture(request, timeoutMillis); AbstractHttpClientHandler callback = new FutureInvokeClientHandler(transportConfig.getConsumerConfig(), transportConfig.getProviderInfo(), future, request, rpcContext, ClassLoaderUtils.getCurrentClassLoader()); doSend(request, callback, timeoutMillis); future.setSentTime(); return future; } }
[ "protected", "ResponseFuture", "doInvokeAsync", "(", "SofaRequest", "request", ",", "RpcInternalContext", "rpcContext", ",", "int", "timeoutMillis", ")", "{", "SofaResponseCallback", "listener", "=", "request", ".", "getSofaResponseCallback", "(", ")", ";", "if", "(", "listener", "!=", "null", ")", "{", "AbstractHttpClientHandler", "callback", "=", "new", "CallbackInvokeClientHandler", "(", "transportConfig", ".", "getConsumerConfig", "(", ")", ",", "transportConfig", ".", "getProviderInfo", "(", ")", ",", "listener", ",", "request", ",", "rpcContext", ",", "ClassLoaderUtils", ".", "getCurrentClassLoader", "(", ")", ")", ";", "doSend", "(", "request", ",", "callback", ",", "timeoutMillis", ")", ";", "return", "null", ";", "}", "else", "{", "HttpResponseFuture", "future", "=", "new", "HttpResponseFuture", "(", "request", ",", "timeoutMillis", ")", ";", "AbstractHttpClientHandler", "callback", "=", "new", "FutureInvokeClientHandler", "(", "transportConfig", ".", "getConsumerConfig", "(", ")", ",", "transportConfig", ".", "getProviderInfo", "(", ")", ",", "future", ",", "request", ",", "rpcContext", ",", "ClassLoaderUtils", ".", "getCurrentClassLoader", "(", ")", ")", ";", "doSend", "(", "request", ",", "callback", ",", "timeoutMillis", ")", ";", "future", ".", "setSentTime", "(", ")", ";", "return", "future", ";", "}", "}" ]
异步调用 @param request 请求对象 @param rpcContext RPC内置上下文 @param timeoutMillis 超时时间(毫秒)
[ "异步调用" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/remoting-http/src/main/java/com/alipay/sofa/rpc/transport/http/AbstractHttp2ClientTransport.java#L227-L244
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/windows/MultiSourceColumnComboBoxPanel.java
MultiSourceColumnComboBoxPanel.updateSourceComboBoxes
public void updateSourceComboBoxes(final Datastore datastore, final Table table) { """ updates the SourceColumnComboBoxes with the provided datastore and table """ _datastore = datastore; _table = table; for (final SourceColumnComboBox sourceColComboBox : _sourceColumnComboBoxes) { sourceColComboBox.setModel(datastore, table); } }
java
public void updateSourceComboBoxes(final Datastore datastore, final Table table) { _datastore = datastore; _table = table; for (final SourceColumnComboBox sourceColComboBox : _sourceColumnComboBoxes) { sourceColComboBox.setModel(datastore, table); } }
[ "public", "void", "updateSourceComboBoxes", "(", "final", "Datastore", "datastore", ",", "final", "Table", "table", ")", "{", "_datastore", "=", "datastore", ";", "_table", "=", "table", ";", "for", "(", "final", "SourceColumnComboBox", "sourceColComboBox", ":", "_sourceColumnComboBoxes", ")", "{", "sourceColComboBox", ".", "setModel", "(", "datastore", ",", "table", ")", ";", "}", "}" ]
updates the SourceColumnComboBoxes with the provided datastore and table
[ "updates", "the", "SourceColumnComboBoxes", "with", "the", "provided", "datastore", "and", "table" ]
train
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/windows/MultiSourceColumnComboBoxPanel.java#L163-L169
groupon/odo
client/src/main/java/com/groupon/odo/client/Client.java
Client.setCustomForDefaultClient
protected static boolean setCustomForDefaultClient(String profileName, String pathName, Boolean isResponse, String customData) { """ set custom response or request for a profile's default client, ensures profile and path are enabled @param profileName profileName to modift, default client is used @param pathName friendly name of path @param isResponse true if response, false for request @param customData custom response/request data @return true if success, false otherwise """ try { Client client = new Client(profileName, false); client.toggleProfile(true); client.setCustom(isResponse, pathName, customData); if (isResponse) { client.toggleResponseOverride(pathName, true); } else { client.toggleRequestOverride(pathName, true); } return true; } catch (Exception e) { e.printStackTrace(); } return false; }
java
protected static boolean setCustomForDefaultClient(String profileName, String pathName, Boolean isResponse, String customData) { try { Client client = new Client(profileName, false); client.toggleProfile(true); client.setCustom(isResponse, pathName, customData); if (isResponse) { client.toggleResponseOverride(pathName, true); } else { client.toggleRequestOverride(pathName, true); } return true; } catch (Exception e) { e.printStackTrace(); } return false; }
[ "protected", "static", "boolean", "setCustomForDefaultClient", "(", "String", "profileName", ",", "String", "pathName", ",", "Boolean", "isResponse", ",", "String", "customData", ")", "{", "try", "{", "Client", "client", "=", "new", "Client", "(", "profileName", ",", "false", ")", ";", "client", ".", "toggleProfile", "(", "true", ")", ";", "client", ".", "setCustom", "(", "isResponse", ",", "pathName", ",", "customData", ")", ";", "if", "(", "isResponse", ")", "{", "client", ".", "toggleResponseOverride", "(", "pathName", ",", "true", ")", ";", "}", "else", "{", "client", ".", "toggleRequestOverride", "(", "pathName", ",", "true", ")", ";", "}", "return", "true", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "false", ";", "}" ]
set custom response or request for a profile's default client, ensures profile and path are enabled @param profileName profileName to modift, default client is used @param pathName friendly name of path @param isResponse true if response, false for request @param customData custom response/request data @return true if success, false otherwise
[ "set", "custom", "response", "or", "request", "for", "a", "profile", "s", "default", "client", "ensures", "profile", "and", "path", "are", "enabled" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/client/src/main/java/com/groupon/odo/client/Client.java#L793-L808
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/tx/narayana/XAResourceRecoveryImpl.java
XAResourceRecoveryImpl.openConnection
private Object openConnection(ManagedConnection mc, Subject s) throws ResourceException { """ Open a connection @param mc The managed connection @param s The subject @return The connection handle @exception ResourceException Thrown in case of an error """ if (plugin == null) return null; log.debugf("Open connection (%s, %s)", mc, s); return mc.getConnection(s, null); }
java
private Object openConnection(ManagedConnection mc, Subject s) throws ResourceException { if (plugin == null) return null; log.debugf("Open connection (%s, %s)", mc, s); return mc.getConnection(s, null); }
[ "private", "Object", "openConnection", "(", "ManagedConnection", "mc", ",", "Subject", "s", ")", "throws", "ResourceException", "{", "if", "(", "plugin", "==", "null", ")", "return", "null", ";", "log", ".", "debugf", "(", "\"Open connection (%s, %s)\"", ",", "mc", ",", "s", ")", ";", "return", "mc", ".", "getConnection", "(", "s", ",", "null", ")", ";", "}" ]
Open a connection @param mc The managed connection @param s The subject @return The connection handle @exception ResourceException Thrown in case of an error
[ "Open", "a", "connection" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/tx/narayana/XAResourceRecoveryImpl.java#L407-L415
jfinal/jfinal
src/main/java/com/jfinal/plugin/activerecord/DbPro.java
DbPro.batchUpdate
public int[] batchUpdate(String tableName, List<Record> recordList, int batchSize) { """ Batch update records with default primary key, using the columns names of the first record in recordList. Ensure all the records can use the same sql as the first record. @param tableName the table name """ return batchUpdate(tableName, config.dialect.getDefaultPrimaryKey(),recordList, batchSize); }
java
public int[] batchUpdate(String tableName, List<Record> recordList, int batchSize) { return batchUpdate(tableName, config.dialect.getDefaultPrimaryKey(),recordList, batchSize); }
[ "public", "int", "[", "]", "batchUpdate", "(", "String", "tableName", ",", "List", "<", "Record", ">", "recordList", ",", "int", "batchSize", ")", "{", "return", "batchUpdate", "(", "tableName", ",", "config", ".", "dialect", ".", "getDefaultPrimaryKey", "(", ")", ",", "recordList", ",", "batchSize", ")", ";", "}" ]
Batch update records with default primary key, using the columns names of the first record in recordList. Ensure all the records can use the same sql as the first record. @param tableName the table name
[ "Batch", "update", "records", "with", "default", "primary", "key", "using", "the", "columns", "names", "of", "the", "first", "record", "in", "recordList", ".", "Ensure", "all", "the", "records", "can", "use", "the", "same", "sql", "as", "the", "first", "record", "." ]
train
https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/DbPro.java#L1257-L1259
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.moveResource
public void moveResource(CmsRequestContext context, CmsResource source, String destination) throws CmsException, CmsSecurityException { """ Moves a resource.<p> You must ensure that the destination path is an absolute, valid and existing VFS path. Relative paths from the source are currently not supported.<p> The moved resource will always be locked to the current user after the move operation.<p> In case the target resource already exists, it is overwritten with the source resource.<p> @param context the current request context @param source the resource to copy @param destination the name of the copy destination with complete path @throws CmsException if something goes wrong @throws CmsSecurityException if resource could not be copied @see CmsObject#moveResource(String, String) @see org.opencms.file.types.I_CmsResourceType#moveResource(CmsObject, CmsSecurityManager, CmsResource, String) """ CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkOfflineProject(dbc); // checking if the destination folder exists and is not marked as deleted readResource(context, CmsResource.getParentFolder(destination), CmsResourceFilter.IGNORE_EXPIRATION); checkPermissions(dbc, source, CmsPermissionSet.ACCESS_READ, true, CmsResourceFilter.ALL); checkPermissions(dbc, source, CmsPermissionSet.ACCESS_WRITE, true, CmsResourceFilter.ALL); checkSystemLocks(dbc, source); // check write permissions for subresources in case of moving a folder if (source.isFolder()) { dbc.getRequestContext().setAttribute(I_CmsVfsDriver.REQ_ATTR_CHECK_PERMISSIONS, Boolean.TRUE); try { m_driverManager.getVfsDriver( dbc).moveResource(dbc, dbc.currentProject().getUuid(), source, destination); } catch (CmsDataAccessException e) { // unwrap the permission violation exception if (e.getCause() instanceof CmsPermissionViolationException) { throw (CmsPermissionViolationException)e.getCause(); } else { throw e; } } dbc.getRequestContext().removeAttribute(I_CmsVfsDriver.REQ_ATTR_CHECK_PERMISSIONS); } moveResource(dbc, source, destination); } catch (Exception e) { dbc.report( null, Messages.get().container( Messages.ERR_MOVE_RESOURCE_2, dbc.removeSiteRoot(source.getRootPath()), dbc.removeSiteRoot(destination)), e); } finally { dbc.clear(); } }
java
public void moveResource(CmsRequestContext context, CmsResource source, String destination) throws CmsException, CmsSecurityException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkOfflineProject(dbc); // checking if the destination folder exists and is not marked as deleted readResource(context, CmsResource.getParentFolder(destination), CmsResourceFilter.IGNORE_EXPIRATION); checkPermissions(dbc, source, CmsPermissionSet.ACCESS_READ, true, CmsResourceFilter.ALL); checkPermissions(dbc, source, CmsPermissionSet.ACCESS_WRITE, true, CmsResourceFilter.ALL); checkSystemLocks(dbc, source); // check write permissions for subresources in case of moving a folder if (source.isFolder()) { dbc.getRequestContext().setAttribute(I_CmsVfsDriver.REQ_ATTR_CHECK_PERMISSIONS, Boolean.TRUE); try { m_driverManager.getVfsDriver( dbc).moveResource(dbc, dbc.currentProject().getUuid(), source, destination); } catch (CmsDataAccessException e) { // unwrap the permission violation exception if (e.getCause() instanceof CmsPermissionViolationException) { throw (CmsPermissionViolationException)e.getCause(); } else { throw e; } } dbc.getRequestContext().removeAttribute(I_CmsVfsDriver.REQ_ATTR_CHECK_PERMISSIONS); } moveResource(dbc, source, destination); } catch (Exception e) { dbc.report( null, Messages.get().container( Messages.ERR_MOVE_RESOURCE_2, dbc.removeSiteRoot(source.getRootPath()), dbc.removeSiteRoot(destination)), e); } finally { dbc.clear(); } }
[ "public", "void", "moveResource", "(", "CmsRequestContext", "context", ",", "CmsResource", "source", ",", "String", "destination", ")", "throws", "CmsException", ",", "CmsSecurityException", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "getDbContext", "(", "context", ")", ";", "try", "{", "checkOfflineProject", "(", "dbc", ")", ";", "// checking if the destination folder exists and is not marked as deleted", "readResource", "(", "context", ",", "CmsResource", ".", "getParentFolder", "(", "destination", ")", ",", "CmsResourceFilter", ".", "IGNORE_EXPIRATION", ")", ";", "checkPermissions", "(", "dbc", ",", "source", ",", "CmsPermissionSet", ".", "ACCESS_READ", ",", "true", ",", "CmsResourceFilter", ".", "ALL", ")", ";", "checkPermissions", "(", "dbc", ",", "source", ",", "CmsPermissionSet", ".", "ACCESS_WRITE", ",", "true", ",", "CmsResourceFilter", ".", "ALL", ")", ";", "checkSystemLocks", "(", "dbc", ",", "source", ")", ";", "// check write permissions for subresources in case of moving a folder", "if", "(", "source", ".", "isFolder", "(", ")", ")", "{", "dbc", ".", "getRequestContext", "(", ")", ".", "setAttribute", "(", "I_CmsVfsDriver", ".", "REQ_ATTR_CHECK_PERMISSIONS", ",", "Boolean", ".", "TRUE", ")", ";", "try", "{", "m_driverManager", ".", "getVfsDriver", "(", "dbc", ")", ".", "moveResource", "(", "dbc", ",", "dbc", ".", "currentProject", "(", ")", ".", "getUuid", "(", ")", ",", "source", ",", "destination", ")", ";", "}", "catch", "(", "CmsDataAccessException", "e", ")", "{", "// unwrap the permission violation exception", "if", "(", "e", ".", "getCause", "(", ")", "instanceof", "CmsPermissionViolationException", ")", "{", "throw", "(", "CmsPermissionViolationException", ")", "e", ".", "getCause", "(", ")", ";", "}", "else", "{", "throw", "e", ";", "}", "}", "dbc", ".", "getRequestContext", "(", ")", ".", "removeAttribute", "(", "I_CmsVfsDriver", ".", "REQ_ATTR_CHECK_PERMISSIONS", ")", ";", "}", "moveResource", "(", "dbc", ",", "source", ",", "destination", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "dbc", ".", "report", "(", "null", ",", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_MOVE_RESOURCE_2", ",", "dbc", ".", "removeSiteRoot", "(", "source", ".", "getRootPath", "(", ")", ")", ",", "dbc", ".", "removeSiteRoot", "(", "destination", ")", ")", ",", "e", ")", ";", "}", "finally", "{", "dbc", ".", "clear", "(", ")", ";", "}", "}" ]
Moves a resource.<p> You must ensure that the destination path is an absolute, valid and existing VFS path. Relative paths from the source are currently not supported.<p> The moved resource will always be locked to the current user after the move operation.<p> In case the target resource already exists, it is overwritten with the source resource.<p> @param context the current request context @param source the resource to copy @param destination the name of the copy destination with complete path @throws CmsException if something goes wrong @throws CmsSecurityException if resource could not be copied @see CmsObject#moveResource(String, String) @see org.opencms.file.types.I_CmsResourceType#moveResource(CmsObject, CmsSecurityManager, CmsResource, String)
[ "Moves", "a", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L3749-L3790
elki-project/elki
elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkapp/MkAppTree.java
MkAppTree.adjustApproximatedKNNDistances
private void adjustApproximatedKNNDistances(MkAppEntry entry, Map<DBID, KNNList> knnLists) { """ Adjusts the knn distance in the subtree of the specified root entry. @param entry the root entry of the current subtree @param knnLists a map of knn lists for each leaf entry """ MkAppTreeNode<O> node = getNode(entry); if(node.isLeaf()) { for(int i = 0; i < node.getNumEntries(); i++) { MkAppLeafEntry leafEntry = (MkAppLeafEntry) node.getEntry(i); // approximateKnnDistances(leafEntry, // getKNNList(leafEntry.getRoutingObjectID(), knnLists)); PolynomialApproximation approx = approximateKnnDistances(getMeanKNNList(leafEntry.getDBID(), knnLists)); leafEntry.setKnnDistanceApproximation(approx); } } else { for(int i = 0; i < node.getNumEntries(); i++) { MkAppEntry dirEntry = node.getEntry(i); adjustApproximatedKNNDistances(dirEntry, knnLists); } } // PolynomialApproximation approx1 = node.knnDistanceApproximation(); ArrayModifiableDBIDs ids = DBIDUtil.newArray(); leafEntryIDs(node, ids); PolynomialApproximation approx = approximateKnnDistances(getMeanKNNList(ids, knnLists)); entry.setKnnDistanceApproximation(approx); }
java
private void adjustApproximatedKNNDistances(MkAppEntry entry, Map<DBID, KNNList> knnLists) { MkAppTreeNode<O> node = getNode(entry); if(node.isLeaf()) { for(int i = 0; i < node.getNumEntries(); i++) { MkAppLeafEntry leafEntry = (MkAppLeafEntry) node.getEntry(i); // approximateKnnDistances(leafEntry, // getKNNList(leafEntry.getRoutingObjectID(), knnLists)); PolynomialApproximation approx = approximateKnnDistances(getMeanKNNList(leafEntry.getDBID(), knnLists)); leafEntry.setKnnDistanceApproximation(approx); } } else { for(int i = 0; i < node.getNumEntries(); i++) { MkAppEntry dirEntry = node.getEntry(i); adjustApproximatedKNNDistances(dirEntry, knnLists); } } // PolynomialApproximation approx1 = node.knnDistanceApproximation(); ArrayModifiableDBIDs ids = DBIDUtil.newArray(); leafEntryIDs(node, ids); PolynomialApproximation approx = approximateKnnDistances(getMeanKNNList(ids, knnLists)); entry.setKnnDistanceApproximation(approx); }
[ "private", "void", "adjustApproximatedKNNDistances", "(", "MkAppEntry", "entry", ",", "Map", "<", "DBID", ",", "KNNList", ">", "knnLists", ")", "{", "MkAppTreeNode", "<", "O", ">", "node", "=", "getNode", "(", "entry", ")", ";", "if", "(", "node", ".", "isLeaf", "(", ")", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "node", ".", "getNumEntries", "(", ")", ";", "i", "++", ")", "{", "MkAppLeafEntry", "leafEntry", "=", "(", "MkAppLeafEntry", ")", "node", ".", "getEntry", "(", "i", ")", ";", "// approximateKnnDistances(leafEntry,", "// getKNNList(leafEntry.getRoutingObjectID(), knnLists));", "PolynomialApproximation", "approx", "=", "approximateKnnDistances", "(", "getMeanKNNList", "(", "leafEntry", ".", "getDBID", "(", ")", ",", "knnLists", ")", ")", ";", "leafEntry", ".", "setKnnDistanceApproximation", "(", "approx", ")", ";", "}", "}", "else", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "node", ".", "getNumEntries", "(", ")", ";", "i", "++", ")", "{", "MkAppEntry", "dirEntry", "=", "node", ".", "getEntry", "(", "i", ")", ";", "adjustApproximatedKNNDistances", "(", "dirEntry", ",", "knnLists", ")", ";", "}", "}", "// PolynomialApproximation approx1 = node.knnDistanceApproximation();", "ArrayModifiableDBIDs", "ids", "=", "DBIDUtil", ".", "newArray", "(", ")", ";", "leafEntryIDs", "(", "node", ",", "ids", ")", ";", "PolynomialApproximation", "approx", "=", "approximateKnnDistances", "(", "getMeanKNNList", "(", "ids", ",", "knnLists", ")", ")", ";", "entry", ".", "setKnnDistanceApproximation", "(", "approx", ")", ";", "}" ]
Adjusts the knn distance in the subtree of the specified root entry. @param entry the root entry of the current subtree @param knnLists a map of knn lists for each leaf entry
[ "Adjusts", "the", "knn", "distance", "in", "the", "subtree", "of", "the", "specified", "root", "entry", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkapp/MkAppTree.java#L271-L295
looly/hutool
hutool-cron/src/main/java/cn/hutool/cron/pattern/matcher/ValueMatcherBuilder.java
ValueMatcherBuilder.parseStep
private static List<Integer> parseStep(String value, ValueParser parser) { """ 处理间隔形式的表达式<br> 处理的形式包括: <ul> <li><strong>a</strong> 或 <strong>*</strong></li> <li><strong>a&#47;b</strong> 或 <strong>*&#47;b</strong></li> <li><strong>a-b/2</strong></li> </ul> @param value 表达式值 @param parser 针对这个时间字段的解析器 @return List """ final List<String> parts = StrUtil.split(value, StrUtil.C_SLASH); int size = parts.size(); List<Integer> results; if (size == 1) {// 普通形式 results = parseRange(value, -1, parser); } else if (size == 2) {// 间隔形式 final int step = parser.parse(parts.get(1)); if (step < 1) { throw new CronException("Non positive divisor for field: [{}]", value); } results = parseRange(parts.get(0), step, parser); } else { throw new CronException("Invalid syntax of field: [{}]", value); } return results; }
java
private static List<Integer> parseStep(String value, ValueParser parser) { final List<String> parts = StrUtil.split(value, StrUtil.C_SLASH); int size = parts.size(); List<Integer> results; if (size == 1) {// 普通形式 results = parseRange(value, -1, parser); } else if (size == 2) {// 间隔形式 final int step = parser.parse(parts.get(1)); if (step < 1) { throw new CronException("Non positive divisor for field: [{}]", value); } results = parseRange(parts.get(0), step, parser); } else { throw new CronException("Invalid syntax of field: [{}]", value); } return results; }
[ "private", "static", "List", "<", "Integer", ">", "parseStep", "(", "String", "value", ",", "ValueParser", "parser", ")", "{", "final", "List", "<", "String", ">", "parts", "=", "StrUtil", ".", "split", "(", "value", ",", "StrUtil", ".", "C_SLASH", ")", ";", "int", "size", "=", "parts", ".", "size", "(", ")", ";", "List", "<", "Integer", ">", "results", ";", "if", "(", "size", "==", "1", ")", "{", "// 普通形式\r", "results", "=", "parseRange", "(", "value", ",", "-", "1", ",", "parser", ")", ";", "}", "else", "if", "(", "size", "==", "2", ")", "{", "// 间隔形式\r", "final", "int", "step", "=", "parser", ".", "parse", "(", "parts", ".", "get", "(", "1", ")", ")", ";", "if", "(", "step", "<", "1", ")", "{", "throw", "new", "CronException", "(", "\"Non positive divisor for field: [{}]\"", ",", "value", ")", ";", "}", "results", "=", "parseRange", "(", "parts", ".", "get", "(", "0", ")", ",", "step", ",", "parser", ")", ";", "}", "else", "{", "throw", "new", "CronException", "(", "\"Invalid syntax of field: [{}]\"", ",", "value", ")", ";", "}", "return", "results", ";", "}" ]
处理间隔形式的表达式<br> 处理的形式包括: <ul> <li><strong>a</strong> 或 <strong>*</strong></li> <li><strong>a&#47;b</strong> 或 <strong>*&#47;b</strong></li> <li><strong>a-b/2</strong></li> </ul> @param value 表达式值 @param parser 针对这个时间字段的解析器 @return List
[ "处理间隔形式的表达式<br", ">", "处理的形式包括:", "<ul", ">", "<li", ">", "<strong", ">", "a<", "/", "strong", ">", "或", "<strong", ">", "*", "<", "/", "strong", ">", "<", "/", "li", ">", "<li", ">", "<strong", ">", "a&#47", ";", "b<", "/", "strong", ">", "或", "<strong", ">", "*", "&#47", ";", "b<", "/", "strong", ">", "<", "/", "li", ">", "<li", ">", "<strong", ">", "a", "-", "b", "/", "2<", "/", "strong", ">", "<", "/", "li", ">", "<", "/", "ul", ">" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/pattern/matcher/ValueMatcherBuilder.java#L85-L102
naver/android-utilset
UtilSet/src/com/navercorp/utilset/input/KeyboardUtils.java
KeyboardUtils.showSoftKeyboard
public static void showSoftKeyboard(Context context, View view) { """ Shows keypad @param context @param view View to have keypad control """ InputMethodManager imm = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(view, InputMethodManager.SHOW_FORCED); }
java
public static void showSoftKeyboard(Context context, View view) { InputMethodManager imm = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(view, InputMethodManager.SHOW_FORCED); }
[ "public", "static", "void", "showSoftKeyboard", "(", "Context", "context", ",", "View", "view", ")", "{", "InputMethodManager", "imm", "=", "(", "InputMethodManager", ")", "context", ".", "getSystemService", "(", "Context", ".", "INPUT_METHOD_SERVICE", ")", ";", "imm", ".", "showSoftInput", "(", "view", ",", "InputMethodManager", ".", "SHOW_FORCED", ")", ";", "}" ]
Shows keypad @param context @param view View to have keypad control
[ "Shows", "keypad" ]
train
https://github.com/naver/android-utilset/blob/4af5f821466bc5bec4ea221ca6d87e0ac9b87e0b/UtilSet/src/com/navercorp/utilset/input/KeyboardUtils.java#L28-L32
hdbeukel/james-core
src/main/java/org/jamesframework/core/subset/neigh/SinglePerturbationNeighbourhood.java
SinglePerturbationNeighbourhood.getRandomMove
@Override public SubsetMove getRandomMove(SubsetSolution solution, Random rnd) { """ <p> Generates a random swap, deletion or addition move that transforms the given subset solution into a neighbour within the minimum and maximum allowed subset size. If no valid move can be generated, <code>null</code> is returned. If any fixed IDs have been specified, these will not be considered for deletion nor addition. </p> <p> Note that every individual move is generated with equal probability, taking into account the different number of possible moves of each type. </p> @param solution solution for which a random move is generated @param rnd source of randomness used to generate random move @return random move, <code>null</code> if no valid move can be generated """ // get set of candidate IDs for deletion and addition (fixed IDs are discarded) Set<Integer> removeCandidates = getRemoveCandidates(solution); Set<Integer> addCandidates = getAddCandidates(solution); // compute number of possible moves of each type (addition, deletion, swap) int numAdd = canAdd(solution, addCandidates) ? addCandidates.size() : 0; int numDel = canRemove(solution, removeCandidates) ? removeCandidates.size(): 0; int numSwap = canSwap(solution, addCandidates, removeCandidates) ? addCandidates.size()*removeCandidates.size() : 0; // pick move type using roulette selector MoveType selectedMoveType = RouletteSelector.select( Arrays.asList(MoveType.ADDITION, MoveType.DELETION, MoveType.SWAP), Arrays.asList((double) numAdd, (double) numDel, (double) numSwap), rnd ); // in case of no valid moves: return null if(selectedMoveType == null){ return null; } else { // generate random move of chosen type switch(selectedMoveType){ case ADDITION : return new AdditionMove(SetUtilities.getRandomElement(addCandidates, rnd)); case DELETION : return new DeletionMove(SetUtilities.getRandomElement(removeCandidates, rnd)); case SWAP : return new SwapMove( SetUtilities.getRandomElement(addCandidates, rnd), SetUtilities.getRandomElement(removeCandidates, rnd) ); default : throw new Error("This should never happen. If this exception is thrown, " + "there is a serious bug in SinglePerturbationNeighbourhood."); } } }
java
@Override public SubsetMove getRandomMove(SubsetSolution solution, Random rnd) { // get set of candidate IDs for deletion and addition (fixed IDs are discarded) Set<Integer> removeCandidates = getRemoveCandidates(solution); Set<Integer> addCandidates = getAddCandidates(solution); // compute number of possible moves of each type (addition, deletion, swap) int numAdd = canAdd(solution, addCandidates) ? addCandidates.size() : 0; int numDel = canRemove(solution, removeCandidates) ? removeCandidates.size(): 0; int numSwap = canSwap(solution, addCandidates, removeCandidates) ? addCandidates.size()*removeCandidates.size() : 0; // pick move type using roulette selector MoveType selectedMoveType = RouletteSelector.select( Arrays.asList(MoveType.ADDITION, MoveType.DELETION, MoveType.SWAP), Arrays.asList((double) numAdd, (double) numDel, (double) numSwap), rnd ); // in case of no valid moves: return null if(selectedMoveType == null){ return null; } else { // generate random move of chosen type switch(selectedMoveType){ case ADDITION : return new AdditionMove(SetUtilities.getRandomElement(addCandidates, rnd)); case DELETION : return new DeletionMove(SetUtilities.getRandomElement(removeCandidates, rnd)); case SWAP : return new SwapMove( SetUtilities.getRandomElement(addCandidates, rnd), SetUtilities.getRandomElement(removeCandidates, rnd) ); default : throw new Error("This should never happen. If this exception is thrown, " + "there is a serious bug in SinglePerturbationNeighbourhood."); } } }
[ "@", "Override", "public", "SubsetMove", "getRandomMove", "(", "SubsetSolution", "solution", ",", "Random", "rnd", ")", "{", "// get set of candidate IDs for deletion and addition (fixed IDs are discarded)", "Set", "<", "Integer", ">", "removeCandidates", "=", "getRemoveCandidates", "(", "solution", ")", ";", "Set", "<", "Integer", ">", "addCandidates", "=", "getAddCandidates", "(", "solution", ")", ";", "// compute number of possible moves of each type (addition, deletion, swap)", "int", "numAdd", "=", "canAdd", "(", "solution", ",", "addCandidates", ")", "?", "addCandidates", ".", "size", "(", ")", ":", "0", ";", "int", "numDel", "=", "canRemove", "(", "solution", ",", "removeCandidates", ")", "?", "removeCandidates", ".", "size", "(", ")", ":", "0", ";", "int", "numSwap", "=", "canSwap", "(", "solution", ",", "addCandidates", ",", "removeCandidates", ")", "?", "addCandidates", ".", "size", "(", ")", "*", "removeCandidates", ".", "size", "(", ")", ":", "0", ";", "// pick move type using roulette selector", "MoveType", "selectedMoveType", "=", "RouletteSelector", ".", "select", "(", "Arrays", ".", "asList", "(", "MoveType", ".", "ADDITION", ",", "MoveType", ".", "DELETION", ",", "MoveType", ".", "SWAP", ")", ",", "Arrays", ".", "asList", "(", "(", "double", ")", "numAdd", ",", "(", "double", ")", "numDel", ",", "(", "double", ")", "numSwap", ")", ",", "rnd", ")", ";", "// in case of no valid moves: return null", "if", "(", "selectedMoveType", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "// generate random move of chosen type", "switch", "(", "selectedMoveType", ")", "{", "case", "ADDITION", ":", "return", "new", "AdditionMove", "(", "SetUtilities", ".", "getRandomElement", "(", "addCandidates", ",", "rnd", ")", ")", ";", "case", "DELETION", ":", "return", "new", "DeletionMove", "(", "SetUtilities", ".", "getRandomElement", "(", "removeCandidates", ",", "rnd", ")", ")", ";", "case", "SWAP", ":", "return", "new", "SwapMove", "(", "SetUtilities", ".", "getRandomElement", "(", "addCandidates", ",", "rnd", ")", ",", "SetUtilities", ".", "getRandomElement", "(", "removeCandidates", ",", "rnd", ")", ")", ";", "default", ":", "throw", "new", "Error", "(", "\"This should never happen. If this exception is thrown, \"", "+", "\"there is a serious bug in SinglePerturbationNeighbourhood.\"", ")", ";", "}", "}", "}" ]
<p> Generates a random swap, deletion or addition move that transforms the given subset solution into a neighbour within the minimum and maximum allowed subset size. If no valid move can be generated, <code>null</code> is returned. If any fixed IDs have been specified, these will not be considered for deletion nor addition. </p> <p> Note that every individual move is generated with equal probability, taking into account the different number of possible moves of each type. </p> @param solution solution for which a random move is generated @param rnd source of randomness used to generate random move @return random move, <code>null</code> if no valid move can be generated
[ "<p", ">", "Generates", "a", "random", "swap", "deletion", "or", "addition", "move", "that", "transforms", "the", "given", "subset", "solution", "into", "a", "neighbour", "within", "the", "minimum", "and", "maximum", "allowed", "subset", "size", ".", "If", "no", "valid", "move", "can", "be", "generated", "<code", ">", "null<", "/", "code", ">", "is", "returned", ".", "If", "any", "fixed", "IDs", "have", "been", "specified", "these", "will", "not", "be", "considered", "for", "deletion", "nor", "addition", ".", "<", "/", "p", ">", "<p", ">", "Note", "that", "every", "individual", "move", "is", "generated", "with", "equal", "probability", "taking", "into", "account", "the", "different", "number", "of", "possible", "moves", "of", "each", "type", ".", "<", "/", "p", ">" ]
train
https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/subset/neigh/SinglePerturbationNeighbourhood.java#L142-L173
wildfly/wildfly-core
patching/src/main/java/org/jboss/as/patching/IoUtils.java
IoUtils.copyStream
private static void copyStream(InputStream is, OutputStream os, int bufferSize) throws IOException { """ Copy input stream to output stream without closing streams. Flushes output stream when done. @param is input stream @param os output stream @param bufferSize the buffer size to use @throws IOException for any error """ Assert.checkNotNullParam("is", is); Assert.checkNotNullParam("os", os); byte[] buff = new byte[bufferSize]; int rc; while ((rc = is.read(buff)) != -1) os.write(buff, 0, rc); os.flush(); }
java
private static void copyStream(InputStream is, OutputStream os, int bufferSize) throws IOException { Assert.checkNotNullParam("is", is); Assert.checkNotNullParam("os", os); byte[] buff = new byte[bufferSize]; int rc; while ((rc = is.read(buff)) != -1) os.write(buff, 0, rc); os.flush(); }
[ "private", "static", "void", "copyStream", "(", "InputStream", "is", ",", "OutputStream", "os", ",", "int", "bufferSize", ")", "throws", "IOException", "{", "Assert", ".", "checkNotNullParam", "(", "\"is\"", ",", "is", ")", ";", "Assert", ".", "checkNotNullParam", "(", "\"os\"", ",", "os", ")", ";", "byte", "[", "]", "buff", "=", "new", "byte", "[", "bufferSize", "]", ";", "int", "rc", ";", "while", "(", "(", "rc", "=", "is", ".", "read", "(", "buff", ")", ")", "!=", "-", "1", ")", "os", ".", "write", "(", "buff", ",", "0", ",", "rc", ")", ";", "os", ".", "flush", "(", ")", ";", "}" ]
Copy input stream to output stream without closing streams. Flushes output stream when done. @param is input stream @param os output stream @param bufferSize the buffer size to use @throws IOException for any error
[ "Copy", "input", "stream", "to", "output", "stream", "without", "closing", "streams", ".", "Flushes", "output", "stream", "when", "done", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/IoUtils.java#L93-L101
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hll/HllEstimators.java
HllEstimators.hllLowerBound
static final double hllLowerBound(final AbstractHllArray absHllArr, final int numStdDev) { """ /* The upper and lower bounds are not symmetric and thus are treated slightly differently. For the lower bound, when the unique count is <= k, LB >= numNonZeros, where numNonZeros = k - numAtCurMin AND curMin == 0. For HLL6 and HLL8, curMin is always 0 and numAtCurMin is initialized to k and is decremented down for each valid update until it reaches 0, where it stays. Thus, for these two isomorphs, when numAtCurMin = 0, means the true curMin is > 0 and the unique count must be greater than k. HLL4 always maintains both curMin and numAtCurMin dynamically. Nonetheless, the rules for the very small values <= k where curMin = 0 still apply. """ final int lgConfigK = absHllArr.lgConfigK; final int configK = 1 << lgConfigK; final double numNonZeros = (absHllArr.getCurMin() == 0) ? configK - absHllArr.getNumAtCurMin() : configK; final double estimate; final double rseFactor; final boolean oooFlag = absHllArr.isOutOfOrderFlag(); if (oooFlag) { estimate = absHllArr.getCompositeEstimate(); rseFactor = HLL_NON_HIP_RSE_FACTOR; } else { estimate = absHllArr.getHipAccum(); rseFactor = HLL_HIP_RSE_FACTOR; } final double relErr = (lgConfigK > 12) ? (numStdDev * rseFactor) / Math.sqrt(configK) : RelativeErrorTables.getRelErr(false, oooFlag, lgConfigK, numStdDev); return Math.max(estimate / (1.0 + relErr), numNonZeros); }
java
static final double hllLowerBound(final AbstractHllArray absHllArr, final int numStdDev) { final int lgConfigK = absHllArr.lgConfigK; final int configK = 1 << lgConfigK; final double numNonZeros = (absHllArr.getCurMin() == 0) ? configK - absHllArr.getNumAtCurMin() : configK; final double estimate; final double rseFactor; final boolean oooFlag = absHllArr.isOutOfOrderFlag(); if (oooFlag) { estimate = absHllArr.getCompositeEstimate(); rseFactor = HLL_NON_HIP_RSE_FACTOR; } else { estimate = absHllArr.getHipAccum(); rseFactor = HLL_HIP_RSE_FACTOR; } final double relErr = (lgConfigK > 12) ? (numStdDev * rseFactor) / Math.sqrt(configK) : RelativeErrorTables.getRelErr(false, oooFlag, lgConfigK, numStdDev); return Math.max(estimate / (1.0 + relErr), numNonZeros); }
[ "static", "final", "double", "hllLowerBound", "(", "final", "AbstractHllArray", "absHllArr", ",", "final", "int", "numStdDev", ")", "{", "final", "int", "lgConfigK", "=", "absHllArr", ".", "lgConfigK", ";", "final", "int", "configK", "=", "1", "<<", "lgConfigK", ";", "final", "double", "numNonZeros", "=", "(", "absHllArr", ".", "getCurMin", "(", ")", "==", "0", ")", "?", "configK", "-", "absHllArr", ".", "getNumAtCurMin", "(", ")", ":", "configK", ";", "final", "double", "estimate", ";", "final", "double", "rseFactor", ";", "final", "boolean", "oooFlag", "=", "absHllArr", ".", "isOutOfOrderFlag", "(", ")", ";", "if", "(", "oooFlag", ")", "{", "estimate", "=", "absHllArr", ".", "getCompositeEstimate", "(", ")", ";", "rseFactor", "=", "HLL_NON_HIP_RSE_FACTOR", ";", "}", "else", "{", "estimate", "=", "absHllArr", ".", "getHipAccum", "(", ")", ";", "rseFactor", "=", "HLL_HIP_RSE_FACTOR", ";", "}", "final", "double", "relErr", "=", "(", "lgConfigK", ">", "12", ")", "?", "(", "numStdDev", "*", "rseFactor", ")", "/", "Math", ".", "sqrt", "(", "configK", ")", ":", "RelativeErrorTables", ".", "getRelErr", "(", "false", ",", "oooFlag", ",", "lgConfigK", ",", "numStdDev", ")", ";", "return", "Math", ".", "max", "(", "estimate", "/", "(", "1.0", "+", "relErr", ")", ",", "numNonZeros", ")", ";", "}" ]
/* The upper and lower bounds are not symmetric and thus are treated slightly differently. For the lower bound, when the unique count is <= k, LB >= numNonZeros, where numNonZeros = k - numAtCurMin AND curMin == 0. For HLL6 and HLL8, curMin is always 0 and numAtCurMin is initialized to k and is decremented down for each valid update until it reaches 0, where it stays. Thus, for these two isomorphs, when numAtCurMin = 0, means the true curMin is > 0 and the unique count must be greater than k. HLL4 always maintains both curMin and numAtCurMin dynamically. Nonetheless, the rules for the very small values <= k where curMin = 0 still apply.
[ "/", "*", "The", "upper", "and", "lower", "bounds", "are", "not", "symmetric", "and", "thus", "are", "treated", "slightly", "differently", ".", "For", "the", "lower", "bound", "when", "the", "unique", "count", "is", "<", "=", "k", "LB", ">", "=", "numNonZeros", "where", "numNonZeros", "=", "k", "-", "numAtCurMin", "AND", "curMin", "==", "0", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hll/HllEstimators.java#L34-L53
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/property/A_CmsPropertyEditor.java
A_CmsPropertyEditor.checkWidgetRequirements
public static void checkWidgetRequirements(String key, I_CmsFormWidget widget) { """ Checks whether a widget can be used in the sitemap entry editor, and throws an exception otherwise.<p> @param key the widget key @param widget the created widget """ if (widget instanceof CmsTinyMCEWidget) { return; } if (!((widget instanceof I_CmsHasGhostValue) && (widget instanceof HasValueChangeHandlers<?>))) { throw new CmsWidgetNotSupportedException(key); } }
java
public static void checkWidgetRequirements(String key, I_CmsFormWidget widget) { if (widget instanceof CmsTinyMCEWidget) { return; } if (!((widget instanceof I_CmsHasGhostValue) && (widget instanceof HasValueChangeHandlers<?>))) { throw new CmsWidgetNotSupportedException(key); } }
[ "public", "static", "void", "checkWidgetRequirements", "(", "String", "key", ",", "I_CmsFormWidget", "widget", ")", "{", "if", "(", "widget", "instanceof", "CmsTinyMCEWidget", ")", "{", "return", ";", "}", "if", "(", "!", "(", "(", "widget", "instanceof", "I_CmsHasGhostValue", ")", "&&", "(", "widget", "instanceof", "HasValueChangeHandlers", "<", "?", ">", ")", ")", ")", "{", "throw", "new", "CmsWidgetNotSupportedException", "(", "key", ")", ";", "}", "}" ]
Checks whether a widget can be used in the sitemap entry editor, and throws an exception otherwise.<p> @param key the widget key @param widget the created widget
[ "Checks", "whether", "a", "widget", "can", "be", "used", "in", "the", "sitemap", "entry", "editor", "and", "throws", "an", "exception", "otherwise", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/property/A_CmsPropertyEditor.java#L115-L123
before/quality-check
modules/quality-check/src/main/java/net/sf/qualitycheck/ConditionalCheck.java
ConditionalCheck.noNullElements
@ArgumentsChecked @Throws( { """ Ensures that an array does not contain {@code null}. @param condition condition must be {@code true}^ so that the check will be performed @param array reference to an array @param name name of object reference (in source code) @throws IllegalNullElementsException if the given argument {@code array} contains {@code null} """ IllegalNullArgumentException.class, IllegalNullElementsException.class }) public static <T> void noNullElements(final boolean condition, @Nonnull final T[] array, @Nullable final String name) { if (condition) { Check.noNullElements(array, name); } }
java
@ArgumentsChecked @Throws({ IllegalNullArgumentException.class, IllegalNullElementsException.class }) public static <T> void noNullElements(final boolean condition, @Nonnull final T[] array, @Nullable final String name) { if (condition) { Check.noNullElements(array, name); } }
[ "@", "ArgumentsChecked", "@", "Throws", "(", "{", "IllegalNullArgumentException", ".", "class", ",", "IllegalNullElementsException", ".", "class", "}", ")", "public", "static", "<", "T", ">", "void", "noNullElements", "(", "final", "boolean", "condition", ",", "@", "Nonnull", "final", "T", "[", "]", "array", ",", "@", "Nullable", "final", "String", "name", ")", "{", "if", "(", "condition", ")", "{", "Check", ".", "noNullElements", "(", "array", ",", "name", ")", ";", "}", "}" ]
Ensures that an array does not contain {@code null}. @param condition condition must be {@code true}^ so that the check will be performed @param array reference to an array @param name name of object reference (in source code) @throws IllegalNullElementsException if the given argument {@code array} contains {@code null}
[ "Ensures", "that", "an", "array", "does", "not", "contain", "{", "@code", "null", "}", "." ]
train
https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/ConditionalCheck.java#L1133-L1139
dyu/protostuff-1.0.x
protostuff-me/src/main/java/com/dyuproject/protostuff/me/GraphIOUtil.java
GraphIOUtil.mergeFrom
public static void mergeFrom(byte[] data, Object message, Schema schema) { """ Merges the {@code message} with the byte array using the given {@code schema}. """ mergeFrom(data, 0, data.length, message, schema); }
java
public static void mergeFrom(byte[] data, Object message, Schema schema) { mergeFrom(data, 0, data.length, message, schema); }
[ "public", "static", "void", "mergeFrom", "(", "byte", "[", "]", "data", ",", "Object", "message", ",", "Schema", "schema", ")", "{", "mergeFrom", "(", "data", ",", "0", ",", "data", ".", "length", ",", "message", ",", "schema", ")", ";", "}" ]
Merges the {@code message} with the byte array using the given {@code schema}.
[ "Merges", "the", "{" ]
train
https://github.com/dyu/protostuff-1.0.x/blob/d7c964ec20da3fe44699d86ee95c2677ddffde96/protostuff-me/src/main/java/com/dyuproject/protostuff/me/GraphIOUtil.java#L37-L40
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java
ApiOvhHostingweb.serviceName_cdn_serviceInfosUpdate_POST
public void serviceName_cdn_serviceInfosUpdate_POST(String serviceName, OvhRenewType renew) throws IOException { """ Alter this object properties REST: POST /hosting/web/{serviceName}/cdn/serviceInfosUpdate @param renew [required] Renew type @param serviceName [required] The internal name of your hosting """ String qPath = "/hosting/web/{serviceName}/cdn/serviceInfosUpdate"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "renew", renew); exec(qPath, "POST", sb.toString(), o); }
java
public void serviceName_cdn_serviceInfosUpdate_POST(String serviceName, OvhRenewType renew) throws IOException { String qPath = "/hosting/web/{serviceName}/cdn/serviceInfosUpdate"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "renew", renew); exec(qPath, "POST", sb.toString(), o); }
[ "public", "void", "serviceName_cdn_serviceInfosUpdate_POST", "(", "String", "serviceName", ",", "OvhRenewType", "renew", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/hosting/web/{serviceName}/cdn/serviceInfosUpdate\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"renew\"", ",", "renew", ")", ";", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "}" ]
Alter this object properties REST: POST /hosting/web/{serviceName}/cdn/serviceInfosUpdate @param renew [required] Renew type @param serviceName [required] The internal name of your hosting
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L1494-L1500
iipc/webarchive-commons
src/main/java/org/archive/util/FileUtils.java
FileUtils.copyFile
public static boolean copyFile(final File src, final File dest) throws FileNotFoundException, IOException { """ Copy the src file to the destination. Deletes any preexisting file at destination. @param src @param dest @return True if the extent was greater than actual bytes copied. @throws FileNotFoundException @throws IOException """ return copyFile(src, dest, -1, true); }
java
public static boolean copyFile(final File src, final File dest) throws FileNotFoundException, IOException { return copyFile(src, dest, -1, true); }
[ "public", "static", "boolean", "copyFile", "(", "final", "File", "src", ",", "final", "File", "dest", ")", "throws", "FileNotFoundException", ",", "IOException", "{", "return", "copyFile", "(", "src", ",", "dest", ",", "-", "1", ",", "true", ")", ";", "}" ]
Copy the src file to the destination. Deletes any preexisting file at destination. @param src @param dest @return True if the extent was greater than actual bytes copied. @throws FileNotFoundException @throws IOException
[ "Copy", "the", "src", "file", "to", "the", "destination", ".", "Deletes", "any", "preexisting", "file", "at", "destination", "." ]
train
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/FileUtils.java#L71-L74
stevespringett/Alpine
alpine/src/main/java/alpine/resources/AlpineResource.java
AlpineResource.contOnValidationError
@SafeVarargs protected final List<ValidationError> contOnValidationError(final Set<ConstraintViolation<Object>>... violationsArray) { """ Accepts the result from one of the many validation methods available and returns a List of ValidationErrors. If the size of the List is 0, no errors were encounter during validation. Usage: <pre> Validator validator = getValidator(); List&lt;ValidationError&gt; errors = contOnValidationError( validator.validateProperty(myObject, "uuid"), validator.validateProperty(myObject, "name") ); // If validation fails, this line will be reached. </pre> @param violationsArray a Set of one or more ConstraintViolations @return a List of zero or more ValidationErrors @since 1.0.0 """ final List<ValidationError> errors = new ArrayList<>(); for (final Set<ConstraintViolation<Object>> violations : violationsArray) { for (final ConstraintViolation violation : violations) { if (violation.getPropertyPath().iterator().next().getName() != null) { final String path = violation.getPropertyPath() != null ? violation.getPropertyPath().toString() : null; final String message = violation.getMessage() != null ? StringUtils.removeStart(violation.getMessage(), path + ".") : null; final String messageTemplate = violation.getMessageTemplate(); final String invalidValue = violation.getInvalidValue() != null ? violation.getInvalidValue().toString() : null; final ValidationError error = new ValidationError(message, messageTemplate, path, invalidValue); errors.add(error); } } } return errors; }
java
@SafeVarargs protected final List<ValidationError> contOnValidationError(final Set<ConstraintViolation<Object>>... violationsArray) { final List<ValidationError> errors = new ArrayList<>(); for (final Set<ConstraintViolation<Object>> violations : violationsArray) { for (final ConstraintViolation violation : violations) { if (violation.getPropertyPath().iterator().next().getName() != null) { final String path = violation.getPropertyPath() != null ? violation.getPropertyPath().toString() : null; final String message = violation.getMessage() != null ? StringUtils.removeStart(violation.getMessage(), path + ".") : null; final String messageTemplate = violation.getMessageTemplate(); final String invalidValue = violation.getInvalidValue() != null ? violation.getInvalidValue().toString() : null; final ValidationError error = new ValidationError(message, messageTemplate, path, invalidValue); errors.add(error); } } } return errors; }
[ "@", "SafeVarargs", "protected", "final", "List", "<", "ValidationError", ">", "contOnValidationError", "(", "final", "Set", "<", "ConstraintViolation", "<", "Object", ">", ">", "...", "violationsArray", ")", "{", "final", "List", "<", "ValidationError", ">", "errors", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "final", "Set", "<", "ConstraintViolation", "<", "Object", ">", ">", "violations", ":", "violationsArray", ")", "{", "for", "(", "final", "ConstraintViolation", "violation", ":", "violations", ")", "{", "if", "(", "violation", ".", "getPropertyPath", "(", ")", ".", "iterator", "(", ")", ".", "next", "(", ")", ".", "getName", "(", ")", "!=", "null", ")", "{", "final", "String", "path", "=", "violation", ".", "getPropertyPath", "(", ")", "!=", "null", "?", "violation", ".", "getPropertyPath", "(", ")", ".", "toString", "(", ")", ":", "null", ";", "final", "String", "message", "=", "violation", ".", "getMessage", "(", ")", "!=", "null", "?", "StringUtils", ".", "removeStart", "(", "violation", ".", "getMessage", "(", ")", ",", "path", "+", "\".\"", ")", ":", "null", ";", "final", "String", "messageTemplate", "=", "violation", ".", "getMessageTemplate", "(", ")", ";", "final", "String", "invalidValue", "=", "violation", ".", "getInvalidValue", "(", ")", "!=", "null", "?", "violation", ".", "getInvalidValue", "(", ")", ".", "toString", "(", ")", ":", "null", ";", "final", "ValidationError", "error", "=", "new", "ValidationError", "(", "message", ",", "messageTemplate", ",", "path", ",", "invalidValue", ")", ";", "errors", ".", "add", "(", "error", ")", ";", "}", "}", "}", "return", "errors", ";", "}" ]
Accepts the result from one of the many validation methods available and returns a List of ValidationErrors. If the size of the List is 0, no errors were encounter during validation. Usage: <pre> Validator validator = getValidator(); List&lt;ValidationError&gt; errors = contOnValidationError( validator.validateProperty(myObject, "uuid"), validator.validateProperty(myObject, "name") ); // If validation fails, this line will be reached. </pre> @param violationsArray a Set of one or more ConstraintViolations @return a List of zero or more ValidationErrors @since 1.0.0
[ "Accepts", "the", "result", "from", "one", "of", "the", "many", "validation", "methods", "available", "and", "returns", "a", "List", "of", "ValidationErrors", ".", "If", "the", "size", "of", "the", "List", "is", "0", "no", "errors", "were", "encounter", "during", "validation", "." ]
train
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/resources/AlpineResource.java#L168-L184
hyperledger/fabric-chaincode-java
fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/ext/sbe/impl/StateBasedEndorsementUtils.java
StateBasedEndorsementUtils.nOutOf
static SignaturePolicy nOutOf(int n, List<SignaturePolicy> policies) { """ Creates a policy which requires N out of the slice of policies to evaluate to true @param n @param policies @return """ return SignaturePolicy .newBuilder() .setNOutOf(NOutOf .newBuilder() .setN(n) .addAllRules(policies) .build()) .build(); }
java
static SignaturePolicy nOutOf(int n, List<SignaturePolicy> policies) { return SignaturePolicy .newBuilder() .setNOutOf(NOutOf .newBuilder() .setN(n) .addAllRules(policies) .build()) .build(); }
[ "static", "SignaturePolicy", "nOutOf", "(", "int", "n", ",", "List", "<", "SignaturePolicy", ">", "policies", ")", "{", "return", "SignaturePolicy", ".", "newBuilder", "(", ")", ".", "setNOutOf", "(", "NOutOf", ".", "newBuilder", "(", ")", ".", "setN", "(", "n", ")", ".", "addAllRules", "(", "policies", ")", ".", "build", "(", ")", ")", ".", "build", "(", ")", ";", "}" ]
Creates a policy which requires N out of the slice of policies to evaluate to true @param n @param policies @return
[ "Creates", "a", "policy", "which", "requires", "N", "out", "of", "the", "slice", "of", "policies", "to", "evaluate", "to", "true" ]
train
https://github.com/hyperledger/fabric-chaincode-java/blob/1c688a3c7824758448fec31daaf0a1410a427e91/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/ext/sbe/impl/StateBasedEndorsementUtils.java#L41-L50
bpsm/edn-java
src/main/java/us/bpsm/edn/TaggedValue.java
TaggedValue.newTaggedValue
public static TaggedValue newTaggedValue(Tag tag, Object value) { """ Return a tagged value for the given tag and value (some edn data). The tag must not be null. @param tag not null. @param value may be null. @return a TaggedValue, never null. """ if (tag == null) { throw new IllegalArgumentException("tag must not be null"); } return new TaggedValue(tag, value); }
java
public static TaggedValue newTaggedValue(Tag tag, Object value) { if (tag == null) { throw new IllegalArgumentException("tag must not be null"); } return new TaggedValue(tag, value); }
[ "public", "static", "TaggedValue", "newTaggedValue", "(", "Tag", "tag", ",", "Object", "value", ")", "{", "if", "(", "tag", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"tag must not be null\"", ")", ";", "}", "return", "new", "TaggedValue", "(", "tag", ",", "value", ")", ";", "}" ]
Return a tagged value for the given tag and value (some edn data). The tag must not be null. @param tag not null. @param value may be null. @return a TaggedValue, never null.
[ "Return", "a", "tagged", "value", "for", "the", "given", "tag", "and", "value", "(", "some", "edn", "data", ")", ".", "The", "tag", "must", "not", "be", "null", "." ]
train
https://github.com/bpsm/edn-java/blob/c5dfdb77431da1aca3c257599b237a21575629b2/src/main/java/us/bpsm/edn/TaggedValue.java#L26-L31
icon-Systemhaus-GmbH/javassist-maven-plugin
src/main/java/de/icongmbh/oss/maven/plugin/javassist/JavassistTransformerExecutor.java
JavassistTransformerExecutor.evaluateOutputDirectory
protected String evaluateOutputDirectory(final String outputDir, final String inputDir) { """ Evaluates and returns the output directory. <p> If the passed {@code outputDir} is {@code null} or empty, the passed {@code inputDir} otherwise the {@code outputDir} will returned. @param outputDir could be {@code null} or empty @param inputDir must not be {@code null} @return never {@code null} @throws NullPointerException if passed {@code inputDir} is {@code null} @since 1.2.0 """ return outputDir != null && !outputDir.trim().isEmpty() ? outputDir : inputDir.trim(); }
java
protected String evaluateOutputDirectory(final String outputDir, final String inputDir) { return outputDir != null && !outputDir.trim().isEmpty() ? outputDir : inputDir.trim(); }
[ "protected", "String", "evaluateOutputDirectory", "(", "final", "String", "outputDir", ",", "final", "String", "inputDir", ")", "{", "return", "outputDir", "!=", "null", "&&", "!", "outputDir", ".", "trim", "(", ")", ".", "isEmpty", "(", ")", "?", "outputDir", ":", "inputDir", ".", "trim", "(", ")", ";", "}" ]
Evaluates and returns the output directory. <p> If the passed {@code outputDir} is {@code null} or empty, the passed {@code inputDir} otherwise the {@code outputDir} will returned. @param outputDir could be {@code null} or empty @param inputDir must not be {@code null} @return never {@code null} @throws NullPointerException if passed {@code inputDir} is {@code null} @since 1.2.0
[ "Evaluates", "and", "returns", "the", "output", "directory", "." ]
train
https://github.com/icon-Systemhaus-GmbH/javassist-maven-plugin/blob/798368f79a0bd641648bebd8546388daf013a50e/src/main/java/de/icongmbh/oss/maven/plugin/javassist/JavassistTransformerExecutor.java#L316-L318
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Assert.java
Assert.isInstanceOf
public static <T> T isInstanceOf(Class<?> type, T obj) { """ 断言给定对象是否是给定类的实例 <pre class="code"> Assert.instanceOf(Foo.class, foo); </pre> @param <T> 被检查对象泛型类型 @param type 被检查对象匹配的类型 @param obj 被检查对象 @return 被检查的对象 @throws IllegalArgumentException if the object is not an instance of clazz @see Class#isInstance(Object) """ return isInstanceOf(type, obj, "Object [{}] is not instanceof [{}]", obj, type); }
java
public static <T> T isInstanceOf(Class<?> type, T obj) { return isInstanceOf(type, obj, "Object [{}] is not instanceof [{}]", obj, type); }
[ "public", "static", "<", "T", ">", "T", "isInstanceOf", "(", "Class", "<", "?", ">", "type", ",", "T", "obj", ")", "{", "return", "isInstanceOf", "(", "type", ",", "obj", ",", "\"Object [{}] is not instanceof [{}]\"", ",", "obj", ",", "type", ")", ";", "}" ]
断言给定对象是否是给定类的实例 <pre class="code"> Assert.instanceOf(Foo.class, foo); </pre> @param <T> 被检查对象泛型类型 @param type 被检查对象匹配的类型 @param obj 被检查对象 @return 被检查的对象 @throws IllegalArgumentException if the object is not an instance of clazz @see Class#isInstance(Object)
[ "断言给定对象是否是给定类的实例" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L429-L431
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.addPreQualifiedClassLink
public void addPreQualifiedClassLink(LinkInfoImpl.Kind context, TypeElement typeElement, boolean isStrong, Content contentTree) { """ Add the class link with the package portion of the label in plain text. If the qualifier is excluded, it will not be included in the link label. @param context the id of the context where the link will be added @param typeElement the class to link to @param isStrong true if the link should be strong @param contentTree the content tree to which the link with be added """ PackageElement pkg = utils.containingPackage(typeElement); if(pkg != null && ! configuration.shouldExcludeQualifier(pkg.getSimpleName().toString())) { contentTree.addContent(getEnclosingPackageName(typeElement)); } LinkInfoImpl linkinfo = new LinkInfoImpl(configuration, context, typeElement) .label(utils.getSimpleName(typeElement)) .strong(isStrong); Content link = getLink(linkinfo); contentTree.addContent(link); }
java
public void addPreQualifiedClassLink(LinkInfoImpl.Kind context, TypeElement typeElement, boolean isStrong, Content contentTree) { PackageElement pkg = utils.containingPackage(typeElement); if(pkg != null && ! configuration.shouldExcludeQualifier(pkg.getSimpleName().toString())) { contentTree.addContent(getEnclosingPackageName(typeElement)); } LinkInfoImpl linkinfo = new LinkInfoImpl(configuration, context, typeElement) .label(utils.getSimpleName(typeElement)) .strong(isStrong); Content link = getLink(linkinfo); contentTree.addContent(link); }
[ "public", "void", "addPreQualifiedClassLink", "(", "LinkInfoImpl", ".", "Kind", "context", ",", "TypeElement", "typeElement", ",", "boolean", "isStrong", ",", "Content", "contentTree", ")", "{", "PackageElement", "pkg", "=", "utils", ".", "containingPackage", "(", "typeElement", ")", ";", "if", "(", "pkg", "!=", "null", "&&", "!", "configuration", ".", "shouldExcludeQualifier", "(", "pkg", ".", "getSimpleName", "(", ")", ".", "toString", "(", ")", ")", ")", "{", "contentTree", ".", "addContent", "(", "getEnclosingPackageName", "(", "typeElement", ")", ")", ";", "}", "LinkInfoImpl", "linkinfo", "=", "new", "LinkInfoImpl", "(", "configuration", ",", "context", ",", "typeElement", ")", ".", "label", "(", "utils", ".", "getSimpleName", "(", "typeElement", ")", ")", ".", "strong", "(", "isStrong", ")", ";", "Content", "link", "=", "getLink", "(", "linkinfo", ")", ";", "contentTree", ".", "addContent", "(", "link", ")", ";", "}" ]
Add the class link with the package portion of the label in plain text. If the qualifier is excluded, it will not be included in the link label. @param context the id of the context where the link will be added @param typeElement the class to link to @param isStrong true if the link should be strong @param contentTree the content tree to which the link with be added
[ "Add", "the", "class", "link", "with", "the", "package", "portion", "of", "the", "label", "in", "plain", "text", ".", "If", "the", "qualifier", "is", "excluded", "it", "will", "not", "be", "included", "in", "the", "link", "label", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L1318-L1329
spothero/volley-jackson-extension
Library/src/com/spothero/volley/JacksonNetwork.java
JacksonNetwork.entityToBytes
private byte[] entityToBytes(HttpEntity entity) throws IOException, ServerError { """ Copied from {@link com.android.volley.toolbox.BasicNetwork} Reads the contents of HttpEntity into a byte[]. """ PoolingByteArrayOutputStream bytes = new PoolingByteArrayOutputStream(mPool, (int) entity.getContentLength()); byte[] buffer = null; try { InputStream in = entity.getContent(); if (in == null) { throw new ServerError(); } buffer = mPool.getBuf(1024); int count; while ((count = in.read(buffer)) != -1) { bytes.write(buffer, 0, count); } return bytes.toByteArray(); } finally { try { // Close the InputStream and release the resources by "consuming the content". entity.consumeContent(); } catch (IOException e) { // This can happen if there was an exception above that left the entity in // an invalid state. VolleyLog.v("Error occured when calling consumingContent"); } mPool.returnBuf(buffer); bytes.close(); } }
java
private byte[] entityToBytes(HttpEntity entity) throws IOException, ServerError { PoolingByteArrayOutputStream bytes = new PoolingByteArrayOutputStream(mPool, (int) entity.getContentLength()); byte[] buffer = null; try { InputStream in = entity.getContent(); if (in == null) { throw new ServerError(); } buffer = mPool.getBuf(1024); int count; while ((count = in.read(buffer)) != -1) { bytes.write(buffer, 0, count); } return bytes.toByteArray(); } finally { try { // Close the InputStream and release the resources by "consuming the content". entity.consumeContent(); } catch (IOException e) { // This can happen if there was an exception above that left the entity in // an invalid state. VolleyLog.v("Error occured when calling consumingContent"); } mPool.returnBuf(buffer); bytes.close(); } }
[ "private", "byte", "[", "]", "entityToBytes", "(", "HttpEntity", "entity", ")", "throws", "IOException", ",", "ServerError", "{", "PoolingByteArrayOutputStream", "bytes", "=", "new", "PoolingByteArrayOutputStream", "(", "mPool", ",", "(", "int", ")", "entity", ".", "getContentLength", "(", ")", ")", ";", "byte", "[", "]", "buffer", "=", "null", ";", "try", "{", "InputStream", "in", "=", "entity", ".", "getContent", "(", ")", ";", "if", "(", "in", "==", "null", ")", "{", "throw", "new", "ServerError", "(", ")", ";", "}", "buffer", "=", "mPool", ".", "getBuf", "(", "1024", ")", ";", "int", "count", ";", "while", "(", "(", "count", "=", "in", ".", "read", "(", "buffer", ")", ")", "!=", "-", "1", ")", "{", "bytes", ".", "write", "(", "buffer", ",", "0", ",", "count", ")", ";", "}", "return", "bytes", ".", "toByteArray", "(", ")", ";", "}", "finally", "{", "try", "{", "// Close the InputStream and release the resources by \"consuming the content\".", "entity", ".", "consumeContent", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "// This can happen if there was an exception above that left the entity in", "// an invalid state.", "VolleyLog", ".", "v", "(", "\"Error occured when calling consumingContent\"", ")", ";", "}", "mPool", ".", "returnBuf", "(", "buffer", ")", ";", "bytes", ".", "close", "(", ")", ";", "}", "}" ]
Copied from {@link com.android.volley.toolbox.BasicNetwork} Reads the contents of HttpEntity into a byte[].
[ "Copied", "from", "{", "@link", "com", ".", "android", ".", "volley", ".", "toolbox", ".", "BasicNetwork", "}" ]
train
https://github.com/spothero/volley-jackson-extension/blob/9b02df3e3e8fc648c80aec2dfae456de949fb74b/Library/src/com/spothero/volley/JacksonNetwork.java#L127-L153
mabe02/lanterna
src/main/java/com/googlecode/lanterna/gui2/table/TableModel.java
TableModel.getCell
public synchronized V getCell(int columnIndex, int rowIndex) { """ Returns the cell value stored at a specific column/row coordinate. @param columnIndex Column index of the cell @param rowIndex Row index of the cell @return The data value stored in this cell """ if(rowIndex < 0 || columnIndex < 0) { throw new IndexOutOfBoundsException("Invalid row or column index: " + rowIndex + " " + columnIndex); } else if (rowIndex >= getRowCount()) { throw new IndexOutOfBoundsException("TableModel has " + getRowCount() + " rows, invalid access at rowIndex " + rowIndex); } if(columnIndex >= getColumnCount()) { throw new IndexOutOfBoundsException("TableModel has " + columnIndex + " columns, invalid access at columnIndex " + columnIndex); } return rows.get(rowIndex).get(columnIndex); }
java
public synchronized V getCell(int columnIndex, int rowIndex) { if(rowIndex < 0 || columnIndex < 0) { throw new IndexOutOfBoundsException("Invalid row or column index: " + rowIndex + " " + columnIndex); } else if (rowIndex >= getRowCount()) { throw new IndexOutOfBoundsException("TableModel has " + getRowCount() + " rows, invalid access at rowIndex " + rowIndex); } if(columnIndex >= getColumnCount()) { throw new IndexOutOfBoundsException("TableModel has " + columnIndex + " columns, invalid access at columnIndex " + columnIndex); } return rows.get(rowIndex).get(columnIndex); }
[ "public", "synchronized", "V", "getCell", "(", "int", "columnIndex", ",", "int", "rowIndex", ")", "{", "if", "(", "rowIndex", "<", "0", "||", "columnIndex", "<", "0", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "\"Invalid row or column index: \"", "+", "rowIndex", "+", "\" \"", "+", "columnIndex", ")", ";", "}", "else", "if", "(", "rowIndex", ">=", "getRowCount", "(", ")", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "\"TableModel has \"", "+", "getRowCount", "(", ")", "+", "\" rows, invalid access at rowIndex \"", "+", "rowIndex", ")", ";", "}", "if", "(", "columnIndex", ">=", "getColumnCount", "(", ")", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "\"TableModel has \"", "+", "columnIndex", "+", "\" columns, invalid access at columnIndex \"", "+", "columnIndex", ")", ";", "}", "return", "rows", ".", "get", "(", "rowIndex", ")", ".", "get", "(", "columnIndex", ")", ";", "}" ]
Returns the cell value stored at a specific column/row coordinate. @param columnIndex Column index of the cell @param rowIndex Row index of the cell @return The data value stored in this cell
[ "Returns", "the", "cell", "value", "stored", "at", "a", "specific", "column", "/", "row", "coordinate", "." ]
train
https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/gui2/table/TableModel.java#L284-L295
mapsforge/mapsforge
sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteProgram.java
SQLiteProgram.bindBlob
public void bindBlob(int index, byte[] value) { """ Bind a byte array value to this statement. The value remains bound until {@link #clearBindings} is called. @param index The 1-based index to the parameter to bind @param value The value to bind, must not be null """ if (value == null) { throw new IllegalArgumentException("the bind value at index " + index + " is null"); } bind(index, value); }
java
public void bindBlob(int index, byte[] value) { if (value == null) { throw new IllegalArgumentException("the bind value at index " + index + " is null"); } bind(index, value); }
[ "public", "void", "bindBlob", "(", "int", "index", ",", "byte", "[", "]", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"the bind value at index \"", "+", "index", "+", "\" is null\"", ")", ";", "}", "bind", "(", "index", ",", "value", ")", ";", "}" ]
Bind a byte array value to this statement. The value remains bound until {@link #clearBindings} is called. @param index The 1-based index to the parameter to bind @param value The value to bind, must not be null
[ "Bind", "a", "byte", "array", "value", "to", "this", "statement", ".", "The", "value", "remains", "bound", "until", "{", "@link", "#clearBindings", "}", "is", "called", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteProgram.java#L180-L185
Azure/azure-sdk-for-java
datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/AccountsInner.java
AccountsInner.checkNameAvailability
public NameAvailabilityInformationInner checkNameAvailability(String location, CheckNameAvailabilityParameters parameters) { """ Checks whether the specified account name is available or taken. @param location The resource location without whitespace. @param parameters Parameters supplied to check the Data Lake Analytics account name availability. @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 NameAvailabilityInformationInner object if successful. """ return checkNameAvailabilityWithServiceResponseAsync(location, parameters).toBlocking().single().body(); }
java
public NameAvailabilityInformationInner checkNameAvailability(String location, CheckNameAvailabilityParameters parameters) { return checkNameAvailabilityWithServiceResponseAsync(location, parameters).toBlocking().single().body(); }
[ "public", "NameAvailabilityInformationInner", "checkNameAvailability", "(", "String", "location", ",", "CheckNameAvailabilityParameters", "parameters", ")", "{", "return", "checkNameAvailabilityWithServiceResponseAsync", "(", "location", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Checks whether the specified account name is available or taken. @param location The resource location without whitespace. @param parameters Parameters supplied to check the Data Lake Analytics account name availability. @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 NameAvailabilityInformationInner object if successful.
[ "Checks", "whether", "the", "specified", "account", "name", "is", "available", "or", "taken", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/AccountsInner.java#L1363-L1365
dnsjava/dnsjava
org/xbill/DNS/ZoneTransferIn.java
ZoneTransferIn.newIXFR
public static ZoneTransferIn newIXFR(Name zone, long serial, boolean fallback, String host, int port, TSIG key) throws UnknownHostException { """ Instantiates a ZoneTransferIn object to do an IXFR (incremental zone transfer). @param zone The zone to transfer. @param serial The existing serial number. @param fallback If true, fall back to AXFR if IXFR is not supported. @param host The host from which to transfer the zone. @param port The port to connect to on the server, or 0 for the default. @param key The TSIG key used to authenticate the transfer, or null. @return The ZoneTransferIn object. @throws UnknownHostException The host does not exist. """ if (port == 0) port = SimpleResolver.DEFAULT_PORT; return newIXFR(zone, serial, fallback, new InetSocketAddress(host, port), key); }
java
public static ZoneTransferIn newIXFR(Name zone, long serial, boolean fallback, String host, int port, TSIG key) throws UnknownHostException { if (port == 0) port = SimpleResolver.DEFAULT_PORT; return newIXFR(zone, serial, fallback, new InetSocketAddress(host, port), key); }
[ "public", "static", "ZoneTransferIn", "newIXFR", "(", "Name", "zone", ",", "long", "serial", ",", "boolean", "fallback", ",", "String", "host", ",", "int", "port", ",", "TSIG", "key", ")", "throws", "UnknownHostException", "{", "if", "(", "port", "==", "0", ")", "port", "=", "SimpleResolver", ".", "DEFAULT_PORT", ";", "return", "newIXFR", "(", "zone", ",", "serial", ",", "fallback", ",", "new", "InetSocketAddress", "(", "host", ",", "port", ")", ",", "key", ")", ";", "}" ]
Instantiates a ZoneTransferIn object to do an IXFR (incremental zone transfer). @param zone The zone to transfer. @param serial The existing serial number. @param fallback If true, fall back to AXFR if IXFR is not supported. @param host The host from which to transfer the zone. @param port The port to connect to on the server, or 0 for the default. @param key The TSIG key used to authenticate the transfer, or null. @return The ZoneTransferIn object. @throws UnknownHostException The host does not exist.
[ "Instantiates", "a", "ZoneTransferIn", "object", "to", "do", "an", "IXFR", "(", "incremental", "zone", "transfer", ")", "." ]
train
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/ZoneTransferIn.java#L268-L277
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/CrystalCell.java
CrystalCell.getCellIndices
public Point3i getCellIndices(Tuple3d pt) { """ Get the index of a unit cell to which the query point belongs. <p>For instance, all points in the unit cell at the origin will return (0,0,0); Points in the unit cell one unit further along the `a` axis will return (1,0,0), etc. @param pt Input point (in orthonormal coordinates) @return A new point with the three indices of the cell containing pt """ Point3d p = new Point3d(pt); this.transfToCrystal(p); int x = (int)Math.floor(p.x); int y = (int)Math.floor(p.y); int z = (int)Math.floor(p.z); return new Point3i(x,y,z); }
java
public Point3i getCellIndices(Tuple3d pt) { Point3d p = new Point3d(pt); this.transfToCrystal(p); int x = (int)Math.floor(p.x); int y = (int)Math.floor(p.y); int z = (int)Math.floor(p.z); return new Point3i(x,y,z); }
[ "public", "Point3i", "getCellIndices", "(", "Tuple3d", "pt", ")", "{", "Point3d", "p", "=", "new", "Point3d", "(", "pt", ")", ";", "this", ".", "transfToCrystal", "(", "p", ")", ";", "int", "x", "=", "(", "int", ")", "Math", ".", "floor", "(", "p", ".", "x", ")", ";", "int", "y", "=", "(", "int", ")", "Math", ".", "floor", "(", "p", ".", "y", ")", ";", "int", "z", "=", "(", "int", ")", "Math", ".", "floor", "(", "p", ".", "z", ")", ";", "return", "new", "Point3i", "(", "x", ",", "y", ",", "z", ")", ";", "}" ]
Get the index of a unit cell to which the query point belongs. <p>For instance, all points in the unit cell at the origin will return (0,0,0); Points in the unit cell one unit further along the `a` axis will return (1,0,0), etc. @param pt Input point (in orthonormal coordinates) @return A new point with the three indices of the cell containing pt
[ "Get", "the", "index", "of", "a", "unit", "cell", "to", "which", "the", "query", "point", "belongs", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/CrystalCell.java#L155-L163
cdk/cdk
base/data/src/main/java/org/openscience/cdk/Ring.java
Ring.getNextBond
@Override public IBond getNextBond(IBond bond, IAtom atom) { """ Returns the next bond in order, relative to a given bond and atom. Example: Let the ring be composed of 0-1, 1-2, 2-3 and 3-0. A request getNextBond(1-2, 2) will return Bond 2-3. @param bond A bond for which an atom from a consecutive bond is sought @param atom A atom from the bond above to assign a search direction @return The next bond in the order given by the above assignment """ IBond tempBond; for (int f = 0; f < getBondCount(); f++) { tempBond = getBond(f); if (tempBond.contains(atom) && !tempBond.equals(bond)) return tempBond; } return null; }
java
@Override public IBond getNextBond(IBond bond, IAtom atom) { IBond tempBond; for (int f = 0; f < getBondCount(); f++) { tempBond = getBond(f); if (tempBond.contains(atom) && !tempBond.equals(bond)) return tempBond; } return null; }
[ "@", "Override", "public", "IBond", "getNextBond", "(", "IBond", "bond", ",", "IAtom", "atom", ")", "{", "IBond", "tempBond", ";", "for", "(", "int", "f", "=", "0", ";", "f", "<", "getBondCount", "(", ")", ";", "f", "++", ")", "{", "tempBond", "=", "getBond", "(", "f", ")", ";", "if", "(", "tempBond", ".", "contains", "(", "atom", ")", "&&", "!", "tempBond", ".", "equals", "(", "bond", ")", ")", "return", "tempBond", ";", "}", "return", "null", ";", "}" ]
Returns the next bond in order, relative to a given bond and atom. Example: Let the ring be composed of 0-1, 1-2, 2-3 and 3-0. A request getNextBond(1-2, 2) will return Bond 2-3. @param bond A bond for which an atom from a consecutive bond is sought @param atom A atom from the bond above to assign a search direction @return The next bond in the order given by the above assignment
[ "Returns", "the", "next", "bond", "in", "order", "relative", "to", "a", "given", "bond", "and", "atom", ".", "Example", ":", "Let", "the", "ring", "be", "composed", "of", "0", "-", "1", "1", "-", "2", "2", "-", "3", "and", "3", "-", "0", ".", "A", "request", "getNextBond", "(", "1", "-", "2", "2", ")", "will", "return", "Bond", "2", "-", "3", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/data/src/main/java/org/openscience/cdk/Ring.java#L114-L122
rhuss/jolokia
agent/jvm/src/main/java/org/jolokia/jvmagent/client/util/VirtualMachineHandler.java
VirtualMachineHandler.detachAgent
public void detachAgent(Object pVm) { """ Detach from the virtual machine @param pVm the virtual machine to detach from """ try { if (pVm != null) { Class clazz = pVm.getClass(); Method method = clazz.getMethod("detach"); method.setAccessible(true); // on J9 you get IllegalAccessException otherwise. method.invoke(pVm); } } catch (InvocationTargetException e) { throw new ProcessingException("Error while detaching",e, options); } catch (NoSuchMethodException e) { throw new ProcessingException("Error while detaching",e, options); } catch (IllegalAccessException e) { throw new ProcessingException("Error while detaching",e, options); } }
java
public void detachAgent(Object pVm) { try { if (pVm != null) { Class clazz = pVm.getClass(); Method method = clazz.getMethod("detach"); method.setAccessible(true); // on J9 you get IllegalAccessException otherwise. method.invoke(pVm); } } catch (InvocationTargetException e) { throw new ProcessingException("Error while detaching",e, options); } catch (NoSuchMethodException e) { throw new ProcessingException("Error while detaching",e, options); } catch (IllegalAccessException e) { throw new ProcessingException("Error while detaching",e, options); } }
[ "public", "void", "detachAgent", "(", "Object", "pVm", ")", "{", "try", "{", "if", "(", "pVm", "!=", "null", ")", "{", "Class", "clazz", "=", "pVm", ".", "getClass", "(", ")", ";", "Method", "method", "=", "clazz", ".", "getMethod", "(", "\"detach\"", ")", ";", "method", ".", "setAccessible", "(", "true", ")", ";", "// on J9 you get IllegalAccessException otherwise.", "method", ".", "invoke", "(", "pVm", ")", ";", "}", "}", "catch", "(", "InvocationTargetException", "e", ")", "{", "throw", "new", "ProcessingException", "(", "\"Error while detaching\"", ",", "e", ",", "options", ")", ";", "}", "catch", "(", "NoSuchMethodException", "e", ")", "{", "throw", "new", "ProcessingException", "(", "\"Error while detaching\"", ",", "e", ",", "options", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "throw", "new", "ProcessingException", "(", "\"Error while detaching\"", ",", "e", ",", "options", ")", ";", "}", "}" ]
Detach from the virtual machine @param pVm the virtual machine to detach from
[ "Detach", "from", "the", "virtual", "machine" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/jvm/src/main/java/org/jolokia/jvmagent/client/util/VirtualMachineHandler.java#L92-L107
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsStringWithDefault
public String getAsStringWithDefault(String key, String defaultValue) { """ Converts map element into a string or returns default value if conversion is not possible. @param key a key of element to get. @param defaultValue the default value @return string value of the element or default value if conversion is not supported. @see StringConverter#toStringWithDefault(Object, String) """ Object value = getAsObject(key); return StringConverter.toStringWithDefault(value, defaultValue); }
java
public String getAsStringWithDefault(String key, String defaultValue) { Object value = getAsObject(key); return StringConverter.toStringWithDefault(value, defaultValue); }
[ "public", "String", "getAsStringWithDefault", "(", "String", "key", ",", "String", "defaultValue", ")", "{", "Object", "value", "=", "getAsObject", "(", "key", ")", ";", "return", "StringConverter", ".", "toStringWithDefault", "(", "value", ",", "defaultValue", ")", ";", "}" ]
Converts map element into a string or returns default value if conversion is not possible. @param key a key of element to get. @param defaultValue the default value @return string value of the element or default value if conversion is not supported. @see StringConverter#toStringWithDefault(Object, String)
[ "Converts", "map", "element", "into", "a", "string", "or", "returns", "default", "value", "if", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L162-L165
buschmais/jqa-core-framework
scanner/src/main/java/com/buschmais/jqassistant/core/scanner/impl/ScannerImpl.java
ScannerImpl.popDescriptor
private <D extends Descriptor> void popDescriptor(Class<D> type, D descriptor) { """ Pop the given descriptor from the context. @param descriptor The descriptor. @param <D> The descriptor type. """ if (descriptor != null) { scannerContext.setCurrentDescriptor(null); scannerContext.pop(type); } }
java
private <D extends Descriptor> void popDescriptor(Class<D> type, D descriptor) { if (descriptor != null) { scannerContext.setCurrentDescriptor(null); scannerContext.pop(type); } }
[ "private", "<", "D", "extends", "Descriptor", ">", "void", "popDescriptor", "(", "Class", "<", "D", ">", "type", ",", "D", "descriptor", ")", "{", "if", "(", "descriptor", "!=", "null", ")", "{", "scannerContext", ".", "setCurrentDescriptor", "(", "null", ")", ";", "scannerContext", ".", "pop", "(", "type", ")", ";", "}", "}" ]
Pop the given descriptor from the context. @param descriptor The descriptor. @param <D> The descriptor type.
[ "Pop", "the", "given", "descriptor", "from", "the", "context", "." ]
train
https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/scanner/src/main/java/com/buschmais/jqassistant/core/scanner/impl/ScannerImpl.java#L201-L206
before/uadetector
modules/uadetector-core/src/main/java/net/sf/uadetector/datastore/UpdateOperationWithCacheFileTask.java
UpdateOperationWithCacheFileTask.readAndSave
protected static void readAndSave(@Nonnull final File file, @Nonnull final DataStore store) throws IOException { """ Reads the content from the given {@link URL} and saves it to the passed file. @param file file in which the entire contents from the given URL can be saved @param store a data store for <em>UAS data</em> @throws net.sf.qualitycheck.exception.IllegalNullArgumentException if any of the passed arguments is {@code null} @throws IOException if an I/O error occurs """ Check.notNull(file, "file"); Check.notNull(store, "store"); final URL url = store.getDataUrl(); final Charset charset = store.getCharset(); final boolean isEqual = url.toExternalForm().equals(UrlUtil.toUrl(file).toExternalForm()); if (!isEqual) { // check if the data can be read in successfully final String data = UrlUtil.read(url, charset); if (Data.EMPTY.equals(store.getDataReader().read(data))) { throw new IllegalStateException("The read in content can not be transformed to an instance of 'Data'."); } final File tempFile = createTemporaryFile(file); FileOutputStream outputStream = null; boolean threw = true; try { // write data to temporary file outputStream = new FileOutputStream(tempFile); outputStream.write(data.getBytes(charset)); // delete the original file deleteFile(file); threw = false; } finally { Closeables.close(outputStream, threw); } // rename the new file to the original one renameFile(tempFile, file); } else { LOG.debug(MSG_SAME_RESOURCES); } }
java
protected static void readAndSave(@Nonnull final File file, @Nonnull final DataStore store) throws IOException { Check.notNull(file, "file"); Check.notNull(store, "store"); final URL url = store.getDataUrl(); final Charset charset = store.getCharset(); final boolean isEqual = url.toExternalForm().equals(UrlUtil.toUrl(file).toExternalForm()); if (!isEqual) { // check if the data can be read in successfully final String data = UrlUtil.read(url, charset); if (Data.EMPTY.equals(store.getDataReader().read(data))) { throw new IllegalStateException("The read in content can not be transformed to an instance of 'Data'."); } final File tempFile = createTemporaryFile(file); FileOutputStream outputStream = null; boolean threw = true; try { // write data to temporary file outputStream = new FileOutputStream(tempFile); outputStream.write(data.getBytes(charset)); // delete the original file deleteFile(file); threw = false; } finally { Closeables.close(outputStream, threw); } // rename the new file to the original one renameFile(tempFile, file); } else { LOG.debug(MSG_SAME_RESOURCES); } }
[ "protected", "static", "void", "readAndSave", "(", "@", "Nonnull", "final", "File", "file", ",", "@", "Nonnull", "final", "DataStore", "store", ")", "throws", "IOException", "{", "Check", ".", "notNull", "(", "file", ",", "\"file\"", ")", ";", "Check", ".", "notNull", "(", "store", ",", "\"store\"", ")", ";", "final", "URL", "url", "=", "store", ".", "getDataUrl", "(", ")", ";", "final", "Charset", "charset", "=", "store", ".", "getCharset", "(", ")", ";", "final", "boolean", "isEqual", "=", "url", ".", "toExternalForm", "(", ")", ".", "equals", "(", "UrlUtil", ".", "toUrl", "(", "file", ")", ".", "toExternalForm", "(", ")", ")", ";", "if", "(", "!", "isEqual", ")", "{", "// check if the data can be read in successfully", "final", "String", "data", "=", "UrlUtil", ".", "read", "(", "url", ",", "charset", ")", ";", "if", "(", "Data", ".", "EMPTY", ".", "equals", "(", "store", ".", "getDataReader", "(", ")", ".", "read", "(", "data", ")", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"The read in content can not be transformed to an instance of 'Data'.\"", ")", ";", "}", "final", "File", "tempFile", "=", "createTemporaryFile", "(", "file", ")", ";", "FileOutputStream", "outputStream", "=", "null", ";", "boolean", "threw", "=", "true", ";", "try", "{", "// write data to temporary file", "outputStream", "=", "new", "FileOutputStream", "(", "tempFile", ")", ";", "outputStream", ".", "write", "(", "data", ".", "getBytes", "(", "charset", ")", ")", ";", "// delete the original file", "deleteFile", "(", "file", ")", ";", "threw", "=", "false", ";", "}", "finally", "{", "Closeables", ".", "close", "(", "outputStream", ",", "threw", ")", ";", "}", "// rename the new file to the original one", "renameFile", "(", "tempFile", ",", "file", ")", ";", "}", "else", "{", "LOG", ".", "debug", "(", "MSG_SAME_RESOURCES", ")", ";", "}", "}" ]
Reads the content from the given {@link URL} and saves it to the passed file. @param file file in which the entire contents from the given URL can be saved @param store a data store for <em>UAS data</em> @throws net.sf.qualitycheck.exception.IllegalNullArgumentException if any of the passed arguments is {@code null} @throws IOException if an I/O error occurs
[ "Reads", "the", "content", "from", "the", "given", "{", "@link", "URL", "}", "and", "saves", "it", "to", "the", "passed", "file", "." ]
train
https://github.com/before/uadetector/blob/215fb652723c52866572cff885f52a3fe67b9db5/modules/uadetector-core/src/main/java/net/sf/uadetector/datastore/UpdateOperationWithCacheFileTask.java#L131-L169
etnetera/seb
src/main/java/cz/etnetera/seb/listener/SebListener.java
SebListener.saveFile
protected void saveFile(SebEvent event, String content, String name, String extension) { """ Save string content into output file with given name and extension. @param event @param content @param name @param extension """ event.saveFile(content, getListenerFileName(name), extension); }
java
protected void saveFile(SebEvent event, String content, String name, String extension) { event.saveFile(content, getListenerFileName(name), extension); }
[ "protected", "void", "saveFile", "(", "SebEvent", "event", ",", "String", "content", ",", "String", "name", ",", "String", "extension", ")", "{", "event", ".", "saveFile", "(", "content", ",", "getListenerFileName", "(", "name", ")", ",", "extension", ")", ";", "}" ]
Save string content into output file with given name and extension. @param event @param content @param name @param extension
[ "Save", "string", "content", "into", "output", "file", "with", "given", "name", "and", "extension", "." ]
train
https://github.com/etnetera/seb/blob/6aed29c7726db12f440c60cfd253de229064ed04/src/main/java/cz/etnetera/seb/listener/SebListener.java#L437-L439
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java
SimpleRandomSampling.pbarVariance
public static double pbarVariance(double pbar, int sampleN, int populationN) { """ Calculates Variance for Pbar for a finite population size @param pbar @param sampleN @param populationN @return """ if(populationN<=0 || sampleN<=0 || sampleN>populationN) { throw new IllegalArgumentException("All the parameters must be positive and sampleN smaller than populationN."); } double f = (double)sampleN/populationN; double pbarVariance=((1.0 - f)*pbar*(1.0 - pbar))/(sampleN-1.0); return pbarVariance; }
java
public static double pbarVariance(double pbar, int sampleN, int populationN) { if(populationN<=0 || sampleN<=0 || sampleN>populationN) { throw new IllegalArgumentException("All the parameters must be positive and sampleN smaller than populationN."); } double f = (double)sampleN/populationN; double pbarVariance=((1.0 - f)*pbar*(1.0 - pbar))/(sampleN-1.0); return pbarVariance; }
[ "public", "static", "double", "pbarVariance", "(", "double", "pbar", ",", "int", "sampleN", ",", "int", "populationN", ")", "{", "if", "(", "populationN", "<=", "0", "||", "sampleN", "<=", "0", "||", "sampleN", ">", "populationN", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"All the parameters must be positive and sampleN smaller than populationN.\"", ")", ";", "}", "double", "f", "=", "(", "double", ")", "sampleN", "/", "populationN", ";", "double", "pbarVariance", "=", "(", "(", "1.0", "-", "f", ")", "*", "pbar", "*", "(", "1.0", "-", "pbar", ")", ")", "/", "(", "sampleN", "-", "1.0", ")", ";", "return", "pbarVariance", ";", "}" ]
Calculates Variance for Pbar for a finite population size @param pbar @param sampleN @param populationN @return
[ "Calculates", "Variance", "for", "Pbar", "for", "a", "finite", "population", "size" ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java#L213-L221
UrielCh/ovh-java-sdk
ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java
ApiOvhPackxdsl.packName_services_GET
public ArrayList<OvhServiceInformation> packName_services_GET(String packName) throws IOException { """ Informations about the services included in the pack REST: GET /pack/xdsl/{packName}/services @param packName [required] The internal name of your pack """ String qPath = "/pack/xdsl/{packName}/services"; StringBuilder sb = path(qPath, packName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
java
public ArrayList<OvhServiceInformation> packName_services_GET(String packName) throws IOException { String qPath = "/pack/xdsl/{packName}/services"; StringBuilder sb = path(qPath, packName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
[ "public", "ArrayList", "<", "OvhServiceInformation", ">", "packName_services_GET", "(", "String", "packName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/pack/xdsl/{packName}/services\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "packName", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t2", ")", ";", "}" ]
Informations about the services included in the pack REST: GET /pack/xdsl/{packName}/services @param packName [required] The internal name of your pack
[ "Informations", "about", "the", "services", "included", "in", "the", "pack" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L133-L138
michael-rapp/AndroidUtil
library/src/main/java/de/mrapp/android/util/logging/Logger.java
Logger.logVerbose
public final void logVerbose(@NonNull final Class<?> tag, @NonNull final String message) { """ Logs a specific message on the log level VERBOSE. @param tag The tag, which identifies the source of the log message, as an instance of the class {@link Class}. The tag may not be null @param message The message, which should be logged, as a {@link String}. The message may neither be null, nor empty """ Condition.INSTANCE.ensureNotNull(tag, "The tag may not be null"); Condition.INSTANCE.ensureNotNull(message, "The message may not be null"); Condition.INSTANCE.ensureNotEmpty(message, "The message may not be empty"); if (LogLevel.VERBOSE.getRank() >= getLogLevel().getRank()) { Log.v(ClassUtil.INSTANCE.getTruncatedName(tag), message); } }
java
public final void logVerbose(@NonNull final Class<?> tag, @NonNull final String message) { Condition.INSTANCE.ensureNotNull(tag, "The tag may not be null"); Condition.INSTANCE.ensureNotNull(message, "The message may not be null"); Condition.INSTANCE.ensureNotEmpty(message, "The message may not be empty"); if (LogLevel.VERBOSE.getRank() >= getLogLevel().getRank()) { Log.v(ClassUtil.INSTANCE.getTruncatedName(tag), message); } }
[ "public", "final", "void", "logVerbose", "(", "@", "NonNull", "final", "Class", "<", "?", ">", "tag", ",", "@", "NonNull", "final", "String", "message", ")", "{", "Condition", ".", "INSTANCE", ".", "ensureNotNull", "(", "tag", ",", "\"The tag may not be null\"", ")", ";", "Condition", ".", "INSTANCE", ".", "ensureNotNull", "(", "message", ",", "\"The message may not be null\"", ")", ";", "Condition", ".", "INSTANCE", ".", "ensureNotEmpty", "(", "message", ",", "\"The message may not be empty\"", ")", ";", "if", "(", "LogLevel", ".", "VERBOSE", ".", "getRank", "(", ")", ">=", "getLogLevel", "(", ")", ".", "getRank", "(", ")", ")", "{", "Log", ".", "v", "(", "ClassUtil", ".", "INSTANCE", ".", "getTruncatedName", "(", "tag", ")", ",", "message", ")", ";", "}", "}" ]
Logs a specific message on the log level VERBOSE. @param tag The tag, which identifies the source of the log message, as an instance of the class {@link Class}. The tag may not be null @param message The message, which should be logged, as a {@link String}. The message may neither be null, nor empty
[ "Logs", "a", "specific", "message", "on", "the", "log", "level", "VERBOSE", "." ]
train
https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/logging/Logger.java#L82-L90
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.api_logs_self_logId_GET
public OvhLog api_logs_self_logId_GET(Long logId) throws IOException { """ Get this object properties REST: GET /me/api/logs/self/{logId} @param logId [required] """ String qPath = "/me/api/logs/self/{logId}"; StringBuilder sb = path(qPath, logId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhLog.class); }
java
public OvhLog api_logs_self_logId_GET(Long logId) throws IOException { String qPath = "/me/api/logs/self/{logId}"; StringBuilder sb = path(qPath, logId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhLog.class); }
[ "public", "OvhLog", "api_logs_self_logId_GET", "(", "Long", "logId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/api/logs/self/{logId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "logId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhLog", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /me/api/logs/self/{logId} @param logId [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L400-L405
reactor/reactor-netty
src/main/java/reactor/netty/http/client/HttpClient.java
HttpClient.doOnResponseError
public final HttpClient doOnResponseError(BiConsumer<? super HttpClientResponse, ? super Throwable> doOnResponse) { """ Setup a callback called when {@link HttpClientResponse} has not been fully received. @param doOnResponse a consumer observing response failures @return a new {@link HttpClient} """ Objects.requireNonNull(doOnResponse, "doOnResponse"); return new HttpClientDoOnError(this, null, doOnResponse); }
java
public final HttpClient doOnResponseError(BiConsumer<? super HttpClientResponse, ? super Throwable> doOnResponse) { Objects.requireNonNull(doOnResponse, "doOnResponse"); return new HttpClientDoOnError(this, null, doOnResponse); }
[ "public", "final", "HttpClient", "doOnResponseError", "(", "BiConsumer", "<", "?", "super", "HttpClientResponse", ",", "?", "super", "Throwable", ">", "doOnResponse", ")", "{", "Objects", ".", "requireNonNull", "(", "doOnResponse", ",", "\"doOnResponse\"", ")", ";", "return", "new", "HttpClientDoOnError", "(", "this", ",", "null", ",", "doOnResponse", ")", ";", "}" ]
Setup a callback called when {@link HttpClientResponse} has not been fully received. @param doOnResponse a consumer observing response failures @return a new {@link HttpClient}
[ "Setup", "a", "callback", "called", "when", "{", "@link", "HttpClientResponse", "}", "has", "not", "been", "fully", "received", "." ]
train
https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/http/client/HttpClient.java#L569-L572
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4ClientConnection.java
JDBC4ClientConnection.saveStatistics
public void saveStatistics(ClientStats stats, String file) throws IOException { """ Save statistics to a CSV file. @param file File path @throws IOException """ this.client.get().writeSummaryCSV(stats, file); }
java
public void saveStatistics(ClientStats stats, String file) throws IOException { this.client.get().writeSummaryCSV(stats, file); }
[ "public", "void", "saveStatistics", "(", "ClientStats", "stats", ",", "String", "file", ")", "throws", "IOException", "{", "this", ".", "client", ".", "get", "(", ")", ".", "writeSummaryCSV", "(", "stats", ",", "file", ")", ";", "}" ]
Save statistics to a CSV file. @param file File path @throws IOException
[ "Save", "statistics", "to", "a", "CSV", "file", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4ClientConnection.java#L484-L486