repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
sirthias/parboiled
parboiled-core/src/main/java/org/parboiled/common/StringUtils.java
StringUtils.startsWith
public static boolean startsWith(String string, String prefix) { return string != null && (prefix == null || string.startsWith(prefix)); }
java
public static boolean startsWith(String string, String prefix) { return string != null && (prefix == null || string.startsWith(prefix)); }
[ "public", "static", "boolean", "startsWith", "(", "String", "string", ",", "String", "prefix", ")", "{", "return", "string", "!=", "null", "&&", "(", "prefix", "==", "null", "||", "string", ".", "startsWith", "(", "prefix", ")", ")", ";", "}" ]
Test whether a string starts with a given prefix, handling null values without exceptions. StringUtils.startsWith(null, null) = false StringUtils.startsWith(null, "abc") = false StringUtils.startsWith("abc", null) = true StringUtils.startsWith("abc", "ab") = true StringUtils.startsWith("abc", "abc") = true @param string the string @param prefix the prefix @return true if string starts with prefix
[ "Test", "whether", "a", "string", "starts", "with", "a", "given", "prefix", "handling", "null", "values", "without", "exceptions", "." ]
train
https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/common/StringUtils.java#L306-L308
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/widget/attribute/DefaultFeatureForm.java
DefaultFeatureForm.setValue
@Api public void setValue(String name, ShortAttribute attribute) { FormItem item = formWidget.getField(name); if (item != null) { item.setValue(attribute.getValue()); } }
java
@Api public void setValue(String name, ShortAttribute attribute) { FormItem item = formWidget.getField(name); if (item != null) { item.setValue(attribute.getValue()); } }
[ "@", "Api", "public", "void", "setValue", "(", "String", "name", ",", "ShortAttribute", "attribute", ")", "{", "FormItem", "item", "=", "formWidget", ".", "getField", "(", "name", ")", ";", "if", "(", "item", "!=", "null", ")", "{", "item", ".", "setVa...
Apply a short attribute value on the form, with the given name. @param name attribute name @param attribute attribute value @since 1.11.1
[ "Apply", "a", "short", "attribute", "value", "on", "the", "form", "with", "the", "given", "name", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/attribute/DefaultFeatureForm.java#L497-L503
asciidoctor/asciidoctor-maven-plugin
src/main/java/org/asciidoctor/maven/AsciidoctorHelper.java
AsciidoctorHelper.addAttribute
public static void addAttribute(String attribute, Object value, AttributesBuilder attributesBuilder) { // NOTE Maven interprets an empty value as null, so we need to explicitly convert it to empty string (see #36) // NOTE In Asciidoctor, an empty string represents a true value if (value == null || "true".equals(value)) { attributesBuilder.attribute(attribute, ""); } // NOTE a value of false is effectively the same as a null value, so recommend the use of the string "false" else if ("false".equals(value)) { attributesBuilder.attribute(attribute, null); } // NOTE Maven can't assign a Boolean value from the XML-based configuration, but a client may else if (value instanceof Boolean) { attributesBuilder.attribute(attribute, Attributes.toAsciidoctorFlag((Boolean) value)); } else { // Can't do anything about dates and times because all that logic is private in Attributes attributesBuilder.attribute(attribute, value); } }
java
public static void addAttribute(String attribute, Object value, AttributesBuilder attributesBuilder) { // NOTE Maven interprets an empty value as null, so we need to explicitly convert it to empty string (see #36) // NOTE In Asciidoctor, an empty string represents a true value if (value == null || "true".equals(value)) { attributesBuilder.attribute(attribute, ""); } // NOTE a value of false is effectively the same as a null value, so recommend the use of the string "false" else if ("false".equals(value)) { attributesBuilder.attribute(attribute, null); } // NOTE Maven can't assign a Boolean value from the XML-based configuration, but a client may else if (value instanceof Boolean) { attributesBuilder.attribute(attribute, Attributes.toAsciidoctorFlag((Boolean) value)); } else { // Can't do anything about dates and times because all that logic is private in Attributes attributesBuilder.attribute(attribute, value); } }
[ "public", "static", "void", "addAttribute", "(", "String", "attribute", ",", "Object", "value", ",", "AttributesBuilder", "attributesBuilder", ")", "{", "// NOTE Maven interprets an empty value as null, so we need to explicitly convert it to empty string (see #36)", "// NOTE In Ascii...
Adds an attribute into a {@link AttributesBuilder} taking care of Maven's XML parsing special cases like toggles toggles, nulls, etc. @param attribute Asciidoctor attribute name @param value Asciidoctor attribute value @param attributesBuilder AsciidoctorJ AttributesBuilder
[ "Adds", "an", "attribute", "into", "a", "{", "@link", "AttributesBuilder", "}", "taking", "care", "of", "Maven", "s", "XML", "parsing", "special", "cases", "like", "toggles", "toggles", "nulls", "etc", "." ]
train
https://github.com/asciidoctor/asciidoctor-maven-plugin/blob/880938df1c638aaabedb3c944cd3e0ea1844109e/src/main/java/org/asciidoctor/maven/AsciidoctorHelper.java#L47-L64
google/closure-compiler
src/com/google/javascript/jscomp/AliasStrings.java
AliasStrings.shouldReplaceWithAlias
private static boolean shouldReplaceWithAlias(String str, StringInfo info) { // Optimize for code size. Are aliases smaller than strings? // // This logic optimizes for the size of uncompressed code, but it tends to // get good results for the size of the gzipped code too. // // gzip actually prefers that strings are not aliased - it compresses N // string literals better than 1 string literal and N+1 short variable // names, provided each string is within 32k of the previous copy. We // follow the uncompressed logic as insurance against there being multiple // strings more than 32k apart. int sizeOfLiteral = 2 + str.length(); int sizeOfStrings = info.numOccurrences * sizeOfLiteral; int sizeOfVariable = 3; // '6' comes from: 'var =;' in var XXX="..."; int sizeOfAliases = 6 + sizeOfVariable + sizeOfLiteral // declaration + info.numOccurrences * sizeOfVariable; // + uses return sizeOfAliases < sizeOfStrings; }
java
private static boolean shouldReplaceWithAlias(String str, StringInfo info) { // Optimize for code size. Are aliases smaller than strings? // // This logic optimizes for the size of uncompressed code, but it tends to // get good results for the size of the gzipped code too. // // gzip actually prefers that strings are not aliased - it compresses N // string literals better than 1 string literal and N+1 short variable // names, provided each string is within 32k of the previous copy. We // follow the uncompressed logic as insurance against there being multiple // strings more than 32k apart. int sizeOfLiteral = 2 + str.length(); int sizeOfStrings = info.numOccurrences * sizeOfLiteral; int sizeOfVariable = 3; // '6' comes from: 'var =;' in var XXX="..."; int sizeOfAliases = 6 + sizeOfVariable + sizeOfLiteral // declaration + info.numOccurrences * sizeOfVariable; // + uses return sizeOfAliases < sizeOfStrings; }
[ "private", "static", "boolean", "shouldReplaceWithAlias", "(", "String", "str", ",", "StringInfo", "info", ")", "{", "// Optimize for code size. Are aliases smaller than strings?", "//", "// This logic optimizes for the size of uncompressed code, but it tends to", "// get good results...
Dictates the policy for replacing a string with an alias. @param str The string literal @param info Accumulated information about a string
[ "Dictates", "the", "policy", "for", "replacing", "a", "string", "with", "an", "alias", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AliasStrings.java#L257-L277
Nexmo/nexmo-java
src/main/java/com/nexmo/client/insight/AdvancedInsightRequest.java
AdvancedInsightRequest.withNumberAndCountry
public static AdvancedInsightRequest withNumberAndCountry(String number, String country) { return new Builder(number).country(country).build(); }
java
public static AdvancedInsightRequest withNumberAndCountry(String number, String country) { return new Builder(number).country(country).build(); }
[ "public", "static", "AdvancedInsightRequest", "withNumberAndCountry", "(", "String", "number", ",", "String", "country", ")", "{", "return", "new", "Builder", "(", "number", ")", ".", "country", "(", "country", ")", ".", "build", "(", ")", ";", "}" ]
Construct a AdvancedInsightRequest with a number and country. @param number A single phone number that you need insight about in national or international format. @param country If a number does not have a country code or it is uncertain, set the two-character country code. @return A new {@link AdvancedInsightRequest} object.
[ "Construct", "a", "AdvancedInsightRequest", "with", "a", "number", "and", "country", "." ]
train
https://github.com/Nexmo/nexmo-java/blob/7427eff6d6baa5a5bd9197fa096bcf2564191cf5/src/main/java/com/nexmo/client/insight/AdvancedInsightRequest.java#L63-L65
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/ContinuousDistributions.java
ContinuousDistributions.multinomialGaussianPdf
public static double multinomialGaussianPdf(double[] mean, double[][] covariance, double[] x) { MultivariateNormalDistribution gaussian = new MultivariateNormalDistribution(mean, covariance); return gaussian.density(x); }
java
public static double multinomialGaussianPdf(double[] mean, double[][] covariance, double[] x) { MultivariateNormalDistribution gaussian = new MultivariateNormalDistribution(mean, covariance); return gaussian.density(x); }
[ "public", "static", "double", "multinomialGaussianPdf", "(", "double", "[", "]", "mean", ",", "double", "[", "]", "[", "]", "covariance", ",", "double", "[", "]", "x", ")", "{", "MultivariateNormalDistribution", "gaussian", "=", "new", "MultivariateNormalDistrib...
Calculates the PDF of Multinomial Normal Distribution for a particular x. @param mean @param covariance @param x The x record @return The multinomialGaussianPdf of x
[ "Calculates", "the", "PDF", "of", "Multinomial", "Normal", "Distribution", "for", "a", "particular", "x", "." ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/ContinuousDistributions.java#L658-L662
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/security/support/AuthorityConfigurableSecurityController.java
AuthorityConfigurableSecurityController.setIdAuthorityMap
public void setIdAuthorityMap(Map<String, String> idAuthorityMap) { idConfigAttributeDefinitionMap = new HashMap<String, List<ConfigAttribute>>(idAuthorityMap .size()); for (Map.Entry<String, String> entry : idAuthorityMap.entrySet()) { idConfigAttributeDefinitionMap.put(entry.getKey(), SecurityConfig.createListFromCommaDelimitedString(entry.getValue())); } }
java
public void setIdAuthorityMap(Map<String, String> idAuthorityMap) { idConfigAttributeDefinitionMap = new HashMap<String, List<ConfigAttribute>>(idAuthorityMap .size()); for (Map.Entry<String, String> entry : idAuthorityMap.entrySet()) { idConfigAttributeDefinitionMap.put(entry.getKey(), SecurityConfig.createListFromCommaDelimitedString(entry.getValue())); } }
[ "public", "void", "setIdAuthorityMap", "(", "Map", "<", "String", ",", "String", ">", "idAuthorityMap", ")", "{", "idConfigAttributeDefinitionMap", "=", "new", "HashMap", "<", "String", ",", "List", "<", "ConfigAttribute", ">", ">", "(", "idAuthorityMap", ".", ...
Each entry of the idConfigAttributeDefinitionMap contains a SecurityControllerId together with its actionClusters. When using this SecurityController as FallBack, this map can be used to configure commands that are declared/used in code. @param idAuthorityMap
[ "Each", "entry", "of", "the", "idConfigAttributeDefinitionMap", "contains", "a", "SecurityControllerId", "together", "with", "its", "actionClusters", ".", "When", "using", "this", "SecurityController", "as", "FallBack", "this", "map", "can", "be", "used", "to", "con...
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/security/support/AuthorityConfigurableSecurityController.java#L85-L93
strator-dev/greenpepper
greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/RepositoryType.java
RepositoryType.asFactoryArguments
public String asFactoryArguments(Repository repository, EnvironmentType env, boolean withStyle, String user, String pwd) { StringBuilder sb = new StringBuilder(); sb.append(getRepositoryTypeClass(env)).append(";"); sb.append(withStyle || name.equals("FILE") ? repository.getBaseTestUrl() : withNoStyle(repository.getBaseTestUrl())); if(user == null) { if(!StringUtil.isEmpty(repository.getUsername())) sb.append(";").append(repository.getUsername()).append(";").append(escapeSemiColon(repository.getPassword())); } else { sb.append(";").append(user).append(";").append(escapeSemiColon(pwd)); } return sb.toString(); }
java
public String asFactoryArguments(Repository repository, EnvironmentType env, boolean withStyle, String user, String pwd) { StringBuilder sb = new StringBuilder(); sb.append(getRepositoryTypeClass(env)).append(";"); sb.append(withStyle || name.equals("FILE") ? repository.getBaseTestUrl() : withNoStyle(repository.getBaseTestUrl())); if(user == null) { if(!StringUtil.isEmpty(repository.getUsername())) sb.append(";").append(repository.getUsername()).append(";").append(escapeSemiColon(repository.getPassword())); } else { sb.append(";").append(user).append(";").append(escapeSemiColon(pwd)); } return sb.toString(); }
[ "public", "String", "asFactoryArguments", "(", "Repository", "repository", ",", "EnvironmentType", "env", ",", "boolean", "withStyle", ",", "String", "user", ",", "String", "pwd", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb...
<p>asFactoryArguments.</p> @param repository a {@link com.greenpepper.server.domain.Repository} object. @param env a {@link com.greenpepper.server.domain.EnvironmentType} object. @param withStyle a boolean. @param user a {@link java.lang.String} object. @param pwd a {@link java.lang.String} object. @return a {@link java.lang.String} object.
[ "<p", ">", "asFactoryArguments", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/RepositoryType.java#L223-L240
fabric8io/kubernetes-client
kubernetes-client/src/main/java/io/fabric8/kubernetes/client/Config.java
Config.fromKubeconfig
public static Config fromKubeconfig(String context, String kubeconfigContents, String kubeconfigPath) { // we allow passing context along here, since downstream accepts it Config config = new Config(); Config.loadFromKubeconfig(config, context, kubeconfigContents, kubeconfigPath); return config; }
java
public static Config fromKubeconfig(String context, String kubeconfigContents, String kubeconfigPath) { // we allow passing context along here, since downstream accepts it Config config = new Config(); Config.loadFromKubeconfig(config, context, kubeconfigContents, kubeconfigPath); return config; }
[ "public", "static", "Config", "fromKubeconfig", "(", "String", "context", ",", "String", "kubeconfigContents", ",", "String", "kubeconfigPath", ")", "{", "// we allow passing context along here, since downstream accepts it", "Config", "config", "=", "new", "Config", "(", ...
Note: kubeconfigPath is optional (see note on loadFromKubeConfig)
[ "Note", ":", "kubeconfigPath", "is", "optional", "(", "see", "note", "on", "loadFromKubeConfig", ")" ]
train
https://github.com/fabric8io/kubernetes-client/blob/141668a882ed8e902c045a5cd0a80f14bd17d132/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/Config.java#L446-L451
gosu-lang/gosu-lang
gosu-core-api/src/main/java/gw/date/GosuDateUtil.java
GosuDateUtil.addMinutes
public static Date addMinutes(Date date, int iMinutes ) { Calendar dateTime = dateToCalendar(date); dateTime.add(Calendar.MINUTE, iMinutes); return dateTime.getTime(); }
java
public static Date addMinutes(Date date, int iMinutes ) { Calendar dateTime = dateToCalendar(date); dateTime.add(Calendar.MINUTE, iMinutes); return dateTime.getTime(); }
[ "public", "static", "Date", "addMinutes", "(", "Date", "date", ",", "int", "iMinutes", ")", "{", "Calendar", "dateTime", "=", "dateToCalendar", "(", "date", ")", ";", "dateTime", ".", "add", "(", "Calendar", ".", "MINUTE", ",", "iMinutes", ")", ";", "ret...
Adds the specified (signed) amount of minutes to the given date. For example, to subtract 5 minutes from the current time of the date, you can achieve it by calling: <code>addMinutes(Date, -5)</code>. @param date The time. @param iMinutes The amount of minutes to add. @return A new date with the minutes added.
[ "Adds", "the", "specified", "(", "signed", ")", "amount", "of", "minutes", "to", "the", "given", "date", ".", "For", "example", "to", "subtract", "5", "minutes", "from", "the", "current", "time", "of", "the", "date", "you", "can", "achieve", "it", "by", ...
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/date/GosuDateUtil.java#L44-L48
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/core/ServerParams.java
ServerParams.getModuleParamString
public String getModuleParamString(String moduleName, String paramName) { Map<String, Object> moduleParams = getModuleParams(moduleName); if (moduleParams == null || !moduleParams.containsKey(paramName)) { return null; } return moduleParams.get(paramName).toString(); }
java
public String getModuleParamString(String moduleName, String paramName) { Map<String, Object> moduleParams = getModuleParams(moduleName); if (moduleParams == null || !moduleParams.containsKey(paramName)) { return null; } return moduleParams.get(paramName).toString(); }
[ "public", "String", "getModuleParamString", "(", "String", "moduleName", ",", "String", "paramName", ")", "{", "Map", "<", "String", ",", "Object", ">", "moduleParams", "=", "getModuleParams", "(", "moduleName", ")", ";", "if", "(", "moduleParams", "==", "null...
Get the String value of the given parameter name belonging to the given module name. If no such module/parameter name is known, null is returned. If the parameter exists, a string is created by calling toString(). @param moduleName Name of module to get parameter for. @param paramName Name of parameter to get value of. @return Parameter value as a String or null if known.
[ "Get", "the", "String", "value", "of", "the", "given", "parameter", "name", "belonging", "to", "the", "given", "module", "name", ".", "If", "no", "such", "module", "/", "parameter", "name", "is", "known", "null", "is", "returned", ".", "If", "the", "para...
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/core/ServerParams.java#L405-L411
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/stat/protocol/protocolhttp_stats.java
protocolhttp_stats.get
public static protocolhttp_stats get(nitro_service service, options option) throws Exception{ protocolhttp_stats obj = new protocolhttp_stats(); protocolhttp_stats[] response = (protocolhttp_stats[])obj.stat_resources(service,option); return response[0]; }
java
public static protocolhttp_stats get(nitro_service service, options option) throws Exception{ protocolhttp_stats obj = new protocolhttp_stats(); protocolhttp_stats[] response = (protocolhttp_stats[])obj.stat_resources(service,option); return response[0]; }
[ "public", "static", "protocolhttp_stats", "get", "(", "nitro_service", "service", ",", "options", "option", ")", "throws", "Exception", "{", "protocolhttp_stats", "obj", "=", "new", "protocolhttp_stats", "(", ")", ";", "protocolhttp_stats", "[", "]", "response", "...
Use this API to fetch the statistics of all protocolhttp_stats resources that are configured on netscaler.
[ "Use", "this", "API", "to", "fetch", "the", "statistics", "of", "all", "protocolhttp_stats", "resources", "that", "are", "configured", "on", "netscaler", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/protocol/protocolhttp_stats.java#L610-L614
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/crypto/DeterministicKey.java
DeterministicKey.deserializeB58
public static DeterministicKey deserializeB58(@Nullable DeterministicKey parent, String base58, NetworkParameters params) { return deserialize(params, Base58.decodeChecked(base58), parent); }
java
public static DeterministicKey deserializeB58(@Nullable DeterministicKey parent, String base58, NetworkParameters params) { return deserialize(params, Base58.decodeChecked(base58), parent); }
[ "public", "static", "DeterministicKey", "deserializeB58", "(", "@", "Nullable", "DeterministicKey", "parent", ",", "String", "base58", ",", "NetworkParameters", "params", ")", "{", "return", "deserialize", "(", "params", ",", "Base58", ".", "decodeChecked", "(", "...
Deserialize a base-58-encoded HD Key. @param parent The parent node in the given key's deterministic hierarchy. @throws IllegalArgumentException if the base58 encoded key could not be parsed.
[ "Deserialize", "a", "base", "-", "58", "-", "encoded", "HD", "Key", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/crypto/DeterministicKey.java#L529-L531
BioPAX/Paxtools
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConBox.java
ConBox.moreControllerThanParticipant
public static Constraint moreControllerThanParticipant() { return new ConstraintAdapter(1) { PathAccessor partConv = new PathAccessor("PhysicalEntity/participantOf:Conversion"); PathAccessor partCompAss = new PathAccessor("PhysicalEntity/participantOf:ComplexAssembly"); PathAccessor effects = new PathAccessor("PhysicalEntity/controllerOf/controlled*:Conversion"); @Override public boolean satisfies(Match match, int... ind) { PhysicalEntity pe = (PhysicalEntity) match.get(ind[0]); int partCnvCnt = partConv.getValueFromBean(pe).size(); int partCACnt = partCompAss.getValueFromBean(pe).size(); int effCnt = effects.getValueFromBean(pe).size(); return (partCnvCnt - partCACnt) <= effCnt; } }; }
java
public static Constraint moreControllerThanParticipant() { return new ConstraintAdapter(1) { PathAccessor partConv = new PathAccessor("PhysicalEntity/participantOf:Conversion"); PathAccessor partCompAss = new PathAccessor("PhysicalEntity/participantOf:ComplexAssembly"); PathAccessor effects = new PathAccessor("PhysicalEntity/controllerOf/controlled*:Conversion"); @Override public boolean satisfies(Match match, int... ind) { PhysicalEntity pe = (PhysicalEntity) match.get(ind[0]); int partCnvCnt = partConv.getValueFromBean(pe).size(); int partCACnt = partCompAss.getValueFromBean(pe).size(); int effCnt = effects.getValueFromBean(pe).size(); return (partCnvCnt - partCACnt) <= effCnt; } }; }
[ "public", "static", "Constraint", "moreControllerThanParticipant", "(", ")", "{", "return", "new", "ConstraintAdapter", "(", "1", ")", "{", "PathAccessor", "partConv", "=", "new", "PathAccessor", "(", "\"PhysicalEntity/participantOf:Conversion\"", ")", ";", "PathAccesso...
Makes sure that the PhysicalEntity is controlling more reactions than it participates (excluding complex assembly). @return non-generative constraint
[ "Makes", "sure", "that", "the", "PhysicalEntity", "is", "controlling", "more", "reactions", "than", "it", "participates", "(", "excluding", "complex", "assembly", ")", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConBox.java#L619-L639
zeromq/jeromq
src/main/java/org/zeromq/ZProxy.java
ZProxy.newZProxy
public static ZProxy newZProxy(ZContext ctx, String name, Proxy sockets, String motdelafin, Object... args) { return new ZProxy(ctx, name, sockets, new ZPump(), motdelafin, args); }
java
public static ZProxy newZProxy(ZContext ctx, String name, Proxy sockets, String motdelafin, Object... args) { return new ZProxy(ctx, name, sockets, new ZPump(), motdelafin, args); }
[ "public", "static", "ZProxy", "newZProxy", "(", "ZContext", "ctx", ",", "String", "name", ",", "Proxy", "sockets", ",", "String", "motdelafin", ",", "Object", "...", "args", ")", "{", "return", "new", "ZProxy", "(", "ctx", ",", "name", ",", "sockets", ",...
Creates a new proxy in a ZeroMQ way. This proxy will be less efficient than the {@link #newZProxy(ZContext, String, org.zeromq.ZProxy.Proxy, String, Object...) low-level one}. @param ctx the context used for the proxy. Possibly null, in this case a new context will be created and automatically destroyed afterwards. @param name the name of the proxy. Possibly null. @param sockets the sockets creator of the proxy. Not null. @param motdelafin the final word used to mark the end of the proxy. Null to disable this mechanism. @param args an optional array of arguments that will be passed at the creation. @return the created proxy.
[ "Creates", "a", "new", "proxy", "in", "a", "ZeroMQ", "way", ".", "This", "proxy", "will", "be", "less", "efficient", "than", "the", "{", "@link", "#newZProxy", "(", "ZContext", "String", "org", ".", "zeromq", ".", "ZProxy", ".", "Proxy", "String", "Objec...
train
https://github.com/zeromq/jeromq/blob/8b4a2960b468d08b7aebb0d40bfb947e08fed040/src/main/java/org/zeromq/ZProxy.java#L260-L263
googleapis/google-cloud-java
google-cloud-clients/google-cloud-securitycenter/src/main/java/com/google/cloud/securitycenter/v1/SecurityCenterClient.java
SecurityCenterClient.createSource
public final Source createSource(OrganizationName parent, Source source) { CreateSourceRequest request = CreateSourceRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setSource(source) .build(); return createSource(request); }
java
public final Source createSource(OrganizationName parent, Source source) { CreateSourceRequest request = CreateSourceRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setSource(source) .build(); return createSource(request); }
[ "public", "final", "Source", "createSource", "(", "OrganizationName", "parent", ",", "Source", "source", ")", "{", "CreateSourceRequest", "request", "=", "CreateSourceRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "parent", "==", "null", "?", "nul...
Creates a source. <p>Sample code: <pre><code> try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) { OrganizationName parent = OrganizationName.of("[ORGANIZATION]"); Source source = Source.newBuilder().build(); Source response = securityCenterClient.createSource(parent, source); } </code></pre> @param parent Resource name of the new source's parent. Its format should be "organizations/[organization_id]". @param source The Source being created, only the display_name and description will be used. All other fields will be ignored. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "source", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-securitycenter/src/main/java/com/google/cloud/securitycenter/v1/SecurityCenterClient.java#L201-L209
intuit/QuickBooks-V3-Java-SDK
payments-api/src/main/java/com/intuit/payment/services/base/ServiceBase.java
ServiceBase.prepareResponse
public void prepareResponse(Request request, Response response, Entity entity) { entity.setIntuit_tid(response.getIntuit_tid()); entity.setRequestId(request.getContext().getRequestId()); }
java
public void prepareResponse(Request request, Response response, Entity entity) { entity.setIntuit_tid(response.getIntuit_tid()); entity.setRequestId(request.getContext().getRequestId()); }
[ "public", "void", "prepareResponse", "(", "Request", "request", ",", "Response", "response", ",", "Entity", "entity", ")", "{", "entity", ".", "setIntuit_tid", "(", "response", ".", "getIntuit_tid", "(", ")", ")", ";", "entity", ".", "setRequestId", "(", "re...
Sets additional attributes to the entity @param request @param res @param entity
[ "Sets", "additional", "attributes", "to", "the", "entity" ]
train
https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/payments-api/src/main/java/com/intuit/payment/services/base/ServiceBase.java#L165-L168
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/cmp/cmppolicy_binding.java
cmppolicy_binding.get
public static cmppolicy_binding get(nitro_service service, String name) throws Exception{ cmppolicy_binding obj = new cmppolicy_binding(); obj.set_name(name); cmppolicy_binding response = (cmppolicy_binding) obj.get_resource(service); return response; }
java
public static cmppolicy_binding get(nitro_service service, String name) throws Exception{ cmppolicy_binding obj = new cmppolicy_binding(); obj.set_name(name); cmppolicy_binding response = (cmppolicy_binding) obj.get_resource(service); return response; }
[ "public", "static", "cmppolicy_binding", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "cmppolicy_binding", "obj", "=", "new", "cmppolicy_binding", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", ...
Use this API to fetch cmppolicy_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "cmppolicy_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/cmp/cmppolicy_binding.java#L136-L141
GistLabs/mechanize
src/main/java/com/gistlabs/mechanize/cookie/Cookies.java
Cookies.get
public Cookie get(String name, String domain) { for(Cookie cookie : this) { if(cookie.getName().equals(name) && cookie.getDomain().equals(domain)) return cookie; } return null; }
java
public Cookie get(String name, String domain) { for(Cookie cookie : this) { if(cookie.getName().equals(name) && cookie.getDomain().equals(domain)) return cookie; } return null; }
[ "public", "Cookie", "get", "(", "String", "name", ",", "String", "domain", ")", "{", "for", "(", "Cookie", "cookie", ":", "this", ")", "{", "if", "(", "cookie", ".", "getName", "(", ")", ".", "equals", "(", "name", ")", "&&", "cookie", ".", "getDom...
Returns the cookie with the given name and for the given domain or null.
[ "Returns", "the", "cookie", "with", "the", "given", "name", "and", "for", "the", "given", "domain", "or", "null", "." ]
train
https://github.com/GistLabs/mechanize/blob/32ddd0774439a4c08513c05d7ac7416a3899efed/src/main/java/com/gistlabs/mechanize/cookie/Cookies.java#L47-L53
nmorel/gwt-jackson
extensions/guava/src/main/java/com/github/nmorel/gwtjackson/guava/client/ser/MultimapJsonSerializer.java
MultimapJsonSerializer.newInstance
public static <M extends Multimap<?, ?>> MultimapJsonSerializer<M, ?, ?> newInstance( KeySerializer<?> keySerializer, JsonSerializer<?> valueSerializer ) { return new MultimapJsonSerializer( keySerializer, valueSerializer ); }
java
public static <M extends Multimap<?, ?>> MultimapJsonSerializer<M, ?, ?> newInstance( KeySerializer<?> keySerializer, JsonSerializer<?> valueSerializer ) { return new MultimapJsonSerializer( keySerializer, valueSerializer ); }
[ "public", "static", "<", "M", "extends", "Multimap", "<", "?", ",", "?", ">", ">", "MultimapJsonSerializer", "<", "M", ",", "?", ",", "?", ">", "newInstance", "(", "KeySerializer", "<", "?", ">", "keySerializer", ",", "JsonSerializer", "<", "?", ">", "...
@param keySerializer {@link KeySerializer} used to serialize the keys. @param valueSerializer {@link JsonSerializer} used to serialize the values. @param <M> Type of the {@link Multimap} @return a new instance of {@link MultimapJsonSerializer}
[ "@param", "keySerializer", "{", "@link", "KeySerializer", "}", "used", "to", "serialize", "the", "keys", ".", "@param", "valueSerializer", "{", "@link", "JsonSerializer", "}", "used", "to", "serialize", "the", "values", ".", "@param", "<M", ">", "Type", "of", ...
train
https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/extensions/guava/src/main/java/com/github/nmorel/gwtjackson/guava/client/ser/MultimapJsonSerializer.java#L47-L50
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/tiles/user/TileDaoUtils.java
TileDaoUtils.getClosestZoomLevel
public static Long getClosestZoomLevel(double[] widths, double[] heights, List<TileMatrix> tileMatrices, double length) { return getZoomLevel(widths, heights, tileMatrices, length, false); }
java
public static Long getClosestZoomLevel(double[] widths, double[] heights, List<TileMatrix> tileMatrices, double length) { return getZoomLevel(widths, heights, tileMatrices, length, false); }
[ "public", "static", "Long", "getClosestZoomLevel", "(", "double", "[", "]", "widths", ",", "double", "[", "]", "heights", ",", "List", "<", "TileMatrix", ">", "tileMatrices", ",", "double", "length", ")", "{", "return", "getZoomLevel", "(", "widths", ",", ...
Get the closest zoom level for the provided width and height in the default units @param widths sorted widths @param heights sorted heights @param tileMatrices tile matrices @param length in default units @return tile matrix zoom level @since 1.2.1
[ "Get", "the", "closest", "zoom", "level", "for", "the", "provided", "width", "and", "height", "in", "the", "default", "units" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/tiles/user/TileDaoUtils.java#L100-L103
aws/aws-sdk-java
aws-java-sdk-devicefarm/src/main/java/com/amazonaws/services/devicefarm/model/AccountSettings.java
AccountSettings.withUnmeteredDevices
public AccountSettings withUnmeteredDevices(java.util.Map<String, Integer> unmeteredDevices) { setUnmeteredDevices(unmeteredDevices); return this; }
java
public AccountSettings withUnmeteredDevices(java.util.Map<String, Integer> unmeteredDevices) { setUnmeteredDevices(unmeteredDevices); return this; }
[ "public", "AccountSettings", "withUnmeteredDevices", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "Integer", ">", "unmeteredDevices", ")", "{", "setUnmeteredDevices", "(", "unmeteredDevices", ")", ";", "return", "this", ";", "}" ]
<p> Returns the unmetered devices you have purchased or want to purchase. </p> @param unmeteredDevices Returns the unmetered devices you have purchased or want to purchase. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Returns", "the", "unmetered", "devices", "you", "have", "purchased", "or", "want", "to", "purchase", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-devicefarm/src/main/java/com/amazonaws/services/devicefarm/model/AccountSettings.java#L163-L166
FasterXML/woodstox
src/main/java/com/ctc/wstx/dtd/MinimalDTDReader.java
MinimalDTDReader.skipInternalSubset
public static void skipInternalSubset(WstxInputData srcData, WstxInputSource input, ReaderConfig cfg) throws XMLStreamException { MinimalDTDReader r = new MinimalDTDReader(input, cfg); // Need to read from same source as the master (owning stream reader) r.copyBufferStateFrom(srcData); try { r.skipInternalSubset(); } finally { /* And then need to restore changes back to srcData (line nrs etc); * effectively means that we'll stop reading internal DTD subset, * if so. */ srcData.copyBufferStateFrom(r); } }
java
public static void skipInternalSubset(WstxInputData srcData, WstxInputSource input, ReaderConfig cfg) throws XMLStreamException { MinimalDTDReader r = new MinimalDTDReader(input, cfg); // Need to read from same source as the master (owning stream reader) r.copyBufferStateFrom(srcData); try { r.skipInternalSubset(); } finally { /* And then need to restore changes back to srcData (line nrs etc); * effectively means that we'll stop reading internal DTD subset, * if so. */ srcData.copyBufferStateFrom(r); } }
[ "public", "static", "void", "skipInternalSubset", "(", "WstxInputData", "srcData", ",", "WstxInputSource", "input", ",", "ReaderConfig", "cfg", ")", "throws", "XMLStreamException", "{", "MinimalDTDReader", "r", "=", "new", "MinimalDTDReader", "(", "input", ",", "cfg...
Method that just skims through structure of internal subset, but without doing any sort of validation, or parsing of contents. Method may still throw an exception, if skipping causes EOF or there's an I/O problem. @param srcData Link back to the input buffer shared with the owning stream reader.
[ "Method", "that", "just", "skims", "through", "structure", "of", "internal", "subset", "but", "without", "doing", "any", "sort", "of", "validation", "or", "parsing", "of", "contents", ".", "Method", "may", "still", "throw", "an", "exception", "if", "skipping",...
train
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/MinimalDTDReader.java#L83-L99
ReactiveX/RxNetty
rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/server/HttpServer.java
HttpServer.newServer
public static HttpServer<ByteBuf, ByteBuf> newServer(int port, EventLoopGroup serverGroup, EventLoopGroup clientGroup, Class<? extends ServerChannel> channelClass) { return _newServer(TcpServer.newServer(port, serverGroup, clientGroup, channelClass)); }
java
public static HttpServer<ByteBuf, ByteBuf> newServer(int port, EventLoopGroup serverGroup, EventLoopGroup clientGroup, Class<? extends ServerChannel> channelClass) { return _newServer(TcpServer.newServer(port, serverGroup, clientGroup, channelClass)); }
[ "public", "static", "HttpServer", "<", "ByteBuf", ",", "ByteBuf", ">", "newServer", "(", "int", "port", ",", "EventLoopGroup", "serverGroup", ",", "EventLoopGroup", "clientGroup", ",", "Class", "<", "?", "extends", "ServerChannel", ">", "channelClass", ")", "{",...
Creates a new server using the passed port. @param port Port for the server. {@code 0} to use ephemeral port. @param serverGroup Eventloop group to be used for server sockets. @param clientGroup Eventloop group to be used for client sockets. @param channelClass The class to be used for server channel. @return A new {@link HttpServer}
[ "Creates", "a", "new", "server", "using", "the", "passed", "port", "." ]
train
https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/server/HttpServer.java#L396-L400
jMetal/jMetal
jmetal-problem/src/main/java/org/uma/jmetal/problem/multiobjective/zdt/ZDT1.java
ZDT1.evalH
protected double evalH(double f, double g) { double h ; h = 1.0 - Math.sqrt(f / g); return h; }
java
protected double evalH(double f, double g) { double h ; h = 1.0 - Math.sqrt(f / g); return h; }
[ "protected", "double", "evalH", "(", "double", "f", ",", "double", "g", ")", "{", "double", "h", ";", "h", "=", "1.0", "-", "Math", ".", "sqrt", "(", "f", "/", "g", ")", ";", "return", "h", ";", "}" ]
Returns the value of the ZDT1 function H. @param f First argument of the function H. @param g Second argument of the function H.
[ "Returns", "the", "value", "of", "the", "ZDT1", "function", "H", "." ]
train
https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-problem/src/main/java/org/uma/jmetal/problem/multiobjective/zdt/ZDT1.java#L95-L99
pvanassen/ns-api
src/main/java/nl/pvanassen/ns/NsApi.java
NsApi.getApiResponse
public <T extends NsResult> T getApiResponse(ApiRequest<T> request) throws NsApiException { try (InputStream stream = httpConnection .getContent(NsApi.BASE_URL + request.getPath() + "?" + request.getRequestString())){ @SuppressWarnings("unchecked") Handle<T> handle = (Handle<T>) handleMap.get(request.getClass()); if (handle == null) { throw new NsApiException("Unknown request type " + request.getClass()); } return handle.getModel(stream); } catch (IOException e) { throw new NsApiException("IO Exception occurred", e); } }
java
public <T extends NsResult> T getApiResponse(ApiRequest<T> request) throws NsApiException { try (InputStream stream = httpConnection .getContent(NsApi.BASE_URL + request.getPath() + "?" + request.getRequestString())){ @SuppressWarnings("unchecked") Handle<T> handle = (Handle<T>) handleMap.get(request.getClass()); if (handle == null) { throw new NsApiException("Unknown request type " + request.getClass()); } return handle.getModel(stream); } catch (IOException e) { throw new NsApiException("IO Exception occurred", e); } }
[ "public", "<", "T", "extends", "NsResult", ">", "T", "getApiResponse", "(", "ApiRequest", "<", "T", ">", "request", ")", "throws", "NsApiException", "{", "try", "(", "InputStream", "stream", "=", "httpConnection", ".", "getContent", "(", "NsApi", ".", "BASE_...
Method that makes a call to the NS. The request parameter defines what data to pull. The serialized data of the request is returned, or an exception is thrown. For all request types, see <a href="http://www.ns.nl/api/api">NS API</a> and {@link nl.pvanassen.ns.RequestBuilder} @see nl.pvanassen.ns.RequestBuilder @param request Data to request @param <T> Type of response @return Serialized response @throws NsApiException In case of any other error than a network error
[ "Method", "that", "makes", "a", "call", "to", "the", "NS", ".", "The", "request", "parameter", "defines", "what", "data", "to", "pull", ".", "The", "serialized", "data", "of", "the", "request", "is", "returned", "or", "an", "exception", "is", "thrown", "...
train
https://github.com/pvanassen/ns-api/blob/e90e01028a0eb24006e4fddd4c85e7a25c4fe0ae/src/main/java/nl/pvanassen/ns/NsApi.java#L67-L80
alibaba/ARouter
arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java
Postcard.withInt
public Postcard withInt(@Nullable String key, int value) { mBundle.putInt(key, value); return this; }
java
public Postcard withInt(@Nullable String key, int value) { mBundle.putInt(key, value); return this; }
[ "public", "Postcard", "withInt", "(", "@", "Nullable", "String", "key", ",", "int", "value", ")", "{", "mBundle", ".", "putInt", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts an int value into the mapping of this Bundle, replacing any existing value for the given key. @param key a String, or null @param value an int @return current
[ "Inserts", "an", "int", "value", "into", "the", "mapping", "of", "this", "Bundle", "replacing", "any", "existing", "value", "for", "the", "given", "key", "." ]
train
https://github.com/alibaba/ARouter/blob/1a06912a6e14a57112db1204b43f81c43d721732/arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java#L283-L286
osglworks/java-mvc
src/main/java/org/osgl/mvc/result/PreconditionRequired.java
PreconditionRequired.of
public static PreconditionRequired of(Throwable cause) { if (_localizedErrorMsg()) { return of(cause, defaultMessage(PRECONDITION_REQUIRED)); } else { touchPayload().cause(cause); return _INSTANCE; } }
java
public static PreconditionRequired of(Throwable cause) { if (_localizedErrorMsg()) { return of(cause, defaultMessage(PRECONDITION_REQUIRED)); } else { touchPayload().cause(cause); return _INSTANCE; } }
[ "public", "static", "PreconditionRequired", "of", "(", "Throwable", "cause", ")", "{", "if", "(", "_localizedErrorMsg", "(", ")", ")", "{", "return", "of", "(", "cause", ",", "defaultMessage", "(", "PRECONDITION_REQUIRED", ")", ")", ";", "}", "else", "{", ...
Returns a static PreconditionRequired instance and set the {@link #payload} thread local with cause specified. When calling the instance on {@link #getMessage()} method, it will return whatever stored in the {@link #payload} thread local @param cause the cause @return a static PreconditionRequired instance as described above
[ "Returns", "a", "static", "PreconditionRequired", "instance", "and", "set", "the", "{", "@link", "#payload", "}", "thread", "local", "with", "cause", "specified", "." ]
train
https://github.com/osglworks/java-mvc/blob/4d2b2ec40498ac6ee7040c0424377cbeacab124b/src/main/java/org/osgl/mvc/result/PreconditionRequired.java#L125-L132
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverter.java
TypeConverter.convertToInt
public static int convertToInt (@Nullable final Object aSrcValue, final int nDefault) { final Integer aValue = convert (aSrcValue, Integer.class, null); return aValue == null ? nDefault : aValue.intValue (); }
java
public static int convertToInt (@Nullable final Object aSrcValue, final int nDefault) { final Integer aValue = convert (aSrcValue, Integer.class, null); return aValue == null ? nDefault : aValue.intValue (); }
[ "public", "static", "int", "convertToInt", "(", "@", "Nullable", "final", "Object", "aSrcValue", ",", "final", "int", "nDefault", ")", "{", "final", "Integer", "aValue", "=", "convert", "(", "aSrcValue", ",", "Integer", ".", "class", ",", "null", ")", ";",...
Convert the passed source value to int @param aSrcValue The source value. May be <code>null</code>. @param nDefault The default value to be returned if an error occurs during type conversion. @return The converted value. @throws RuntimeException If the converter itself throws an exception @see TypeConverterProviderBestMatch
[ "Convert", "the", "passed", "source", "value", "to", "int" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverter.java#L335-L339
zaproxy/zaproxy
src/org/zaproxy/zap/control/AddOnInstaller.java
AddOnInstaller.softUninstall
public static boolean softUninstall(AddOn addOn, AddOnUninstallationProgressCallback callback) { Validate.notNull(addOn, "Parameter addOn must not be null."); validateCallbackNotNull(callback); try { boolean uninstalledWithoutErrors = true; uninstalledWithoutErrors &= uninstallAddOnPassiveScanRules(addOn, callback); uninstalledWithoutErrors &= uninstallAddOnActiveScanRules(addOn, callback); uninstalledWithoutErrors &= uninstallAddOnExtensions(addOn, callback); return uninstalledWithoutErrors; } catch (Throwable e) { logger.error("An error occurred while uninstalling the add-on: " + addOn.getId(), e); return false; } }
java
public static boolean softUninstall(AddOn addOn, AddOnUninstallationProgressCallback callback) { Validate.notNull(addOn, "Parameter addOn must not be null."); validateCallbackNotNull(callback); try { boolean uninstalledWithoutErrors = true; uninstalledWithoutErrors &= uninstallAddOnPassiveScanRules(addOn, callback); uninstalledWithoutErrors &= uninstallAddOnActiveScanRules(addOn, callback); uninstalledWithoutErrors &= uninstallAddOnExtensions(addOn, callback); return uninstalledWithoutErrors; } catch (Throwable e) { logger.error("An error occurred while uninstalling the add-on: " + addOn.getId(), e); return false; } }
[ "public", "static", "boolean", "softUninstall", "(", "AddOn", "addOn", ",", "AddOnUninstallationProgressCallback", "callback", ")", "{", "Validate", ".", "notNull", "(", "addOn", ",", "\"Parameter addOn must not be null.\"", ")", ";", "validateCallbackNotNull", "(", "ca...
Uninstalls Java classes ({@code Extension}s, {@code Plugin}s, {@code PassiveScanner}s) of the given {@code addOn}. Should be called when the add-on must be temporarily uninstalled for an update of a dependency. <p> The Java classes are uninstalled in the following order (inverse to installation): <ol> <li>Passive scanners;</li> <li>Active scanners;</li> <li>Extensions.</li> </ol> @param addOn the add-on that will be softly uninstalled @param callback the callback that will be notified of the progress of the uninstallation @return {@code true} if the add-on was uninstalled without errors, {@code false} otherwise. @since 2.4.0 @see Extension @see PassiveScanner @see org.parosproxy.paros.core.scanner.Plugin
[ "Uninstalls", "Java", "classes", "(", "{", "@code", "Extension", "}", "s", "{", "@code", "Plugin", "}", "s", "{", "@code", "PassiveScanner", "}", "s", ")", "of", "the", "given", "{", "@code", "addOn", "}", ".", "Should", "be", "called", "when", "the", ...
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/control/AddOnInstaller.java#L200-L215
trajano/caliper
caliper/src/main/java/com/google/caliper/runner/ServerSocketService.java
ServerSocketService.getInputStream
private static InputStream getInputStream(final Socket socket) throws IOException { final InputStream delegate = socket.getInputStream(); return new InputStream() { @Override public void close() throws IOException { synchronized (socket) { socket.shutdownInput(); if (socket.isOutputShutdown()) { socket.close(); } } } // Boring delegates from here on down @Override public int read() throws IOException { return delegate.read(); } @Override public int read(byte[] b) throws IOException { return delegate.read(b); } @Override public int read(byte[] b, int off, int len) throws IOException { return delegate.read(b, off, len); } @Override public long skip(long n) throws IOException { return delegate.skip(n); } @Override public int available() throws IOException { return delegate.available(); } @Override public void mark(int readlimit) { delegate.mark(readlimit); } @Override public void reset() throws IOException { delegate.reset(); } @Override public boolean markSupported() { return delegate.markSupported(); } }; }
java
private static InputStream getInputStream(final Socket socket) throws IOException { final InputStream delegate = socket.getInputStream(); return new InputStream() { @Override public void close() throws IOException { synchronized (socket) { socket.shutdownInput(); if (socket.isOutputShutdown()) { socket.close(); } } } // Boring delegates from here on down @Override public int read() throws IOException { return delegate.read(); } @Override public int read(byte[] b) throws IOException { return delegate.read(b); } @Override public int read(byte[] b, int off, int len) throws IOException { return delegate.read(b, off, len); } @Override public long skip(long n) throws IOException { return delegate.skip(n); } @Override public int available() throws IOException { return delegate.available(); } @Override public void mark(int readlimit) { delegate.mark(readlimit); } @Override public void reset() throws IOException { delegate.reset(); } @Override public boolean markSupported() { return delegate.markSupported(); } }; }
[ "private", "static", "InputStream", "getInputStream", "(", "final", "Socket", "socket", ")", "throws", "IOException", "{", "final", "InputStream", "delegate", "=", "socket", ".", "getInputStream", "(", ")", ";", "return", "new", "InputStream", "(", ")", "{", "...
Returns an {@link InputStream} for the socket, but unlike {@link Socket#getInputStream()} when you call {@link InputStream#close() close} it only closes the input end of the socket instead of the entire socket.
[ "Returns", "an", "{" ]
train
https://github.com/trajano/caliper/blob/a8bcfd84fa9d7b893b3edfadc3b13240ae5cd658/caliper/src/main/java/com/google/caliper/runner/ServerSocketService.java#L293-L338
guardtime/ksi-java-sdk
ksi-service-ha/src/main/java/com/guardtime/ksi/service/ha/HAConfUtil.java
HAConfUtil.isBefore
static boolean isBefore(Date a, Date b) { return a == null || (b != null && b.before(a)); }
java
static boolean isBefore(Date a, Date b) { return a == null || (b != null && b.before(a)); }
[ "static", "boolean", "isBefore", "(", "Date", "a", ",", "Date", "b", ")", "{", "return", "a", "==", "null", "||", "(", "b", "!=", "null", "&&", "b", ".", "before", "(", "a", ")", ")", ";", "}" ]
Is value of b before value of a. @return True, if b is before a. Always true, if value of a is null.
[ "Is", "value", "of", "b", "before", "value", "of", "a", "." ]
train
https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-ha/src/main/java/com/guardtime/ksi/service/ha/HAConfUtil.java#L61-L63
zaproxy/zaproxy
src/org/zaproxy/zap/extension/alert/AlertAddDialog.java
AlertAddDialog.setHttpMessage
public void setHttpMessage(HttpMessage httpMessage, int historyType) { this.historyRef = null; this.httpMessage = httpMessage; this.historyType = historyType; alertViewPanel.setHttpMessage(httpMessage); }
java
public void setHttpMessage(HttpMessage httpMessage, int historyType) { this.historyRef = null; this.httpMessage = httpMessage; this.historyType = historyType; alertViewPanel.setHttpMessage(httpMessage); }
[ "public", "void", "setHttpMessage", "(", "HttpMessage", "httpMessage", ",", "int", "historyType", ")", "{", "this", ".", "historyRef", "=", "null", ";", "this", ".", "httpMessage", "=", "httpMessage", ";", "this", ".", "historyType", "=", "historyType", ";", ...
Sets the {@code HttpMessage} and the history type of the {@code HistoryReference} that will be created if the user creates the alert. The current session will be used to create the {@code HistoryReference}. The alert created will be added to the newly created {@code HistoryReference}. <p> Should be used when the alert is added to a temporary {@code HistoryReference} as the temporary {@code HistoryReference}s are deleted when the session is closed. </p> @param httpMessage the {@code HttpMessage} that will be used to create the {@code HistoryReference}, must not be {@code null} @param historyType the type of the history reference that will be used to create the {@code HistoryReference} @see Model#getSession() @see HistoryReference#HistoryReference(org.parosproxy.paros.model.Session, int, HttpMessage)
[ "Sets", "the", "{", "@code", "HttpMessage", "}", "and", "the", "history", "type", "of", "the", "{", "@code", "HistoryReference", "}", "that", "will", "be", "created", "if", "the", "user", "creates", "the", "alert", ".", "The", "current", "session", "will",...
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/alert/AlertAddDialog.java#L297-L302
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java
SVGPath.relativeMoveTo
public SVGPath relativeMoveTo(double x, double y) { return append(PATH_MOVE_RELATIVE).append(x).append(y); }
java
public SVGPath relativeMoveTo(double x, double y) { return append(PATH_MOVE_RELATIVE).append(x).append(y); }
[ "public", "SVGPath", "relativeMoveTo", "(", "double", "x", ",", "double", "y", ")", "{", "return", "append", "(", "PATH_MOVE_RELATIVE", ")", ".", "append", "(", "x", ")", ".", "append", "(", "y", ")", ";", "}" ]
Move to the given relative coordinates. @param x new coordinates @param y new coordinates @return path object, for compact syntax.
[ "Move", "to", "the", "given", "relative", "coordinates", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L332-L334
codelibs/fess
src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java
FessMessages.addConstraintsMod11CheckMessage
public FessMessages addConstraintsMod11CheckMessage(String property, String value) { assertPropertyNotNull(property); add(property, new UserMessage(CONSTRAINTS_Mod11Check_MESSAGE, value)); return this; }
java
public FessMessages addConstraintsMod11CheckMessage(String property, String value) { assertPropertyNotNull(property); add(property, new UserMessage(CONSTRAINTS_Mod11Check_MESSAGE, value)); return this; }
[ "public", "FessMessages", "addConstraintsMod11CheckMessage", "(", "String", "property", ",", "String", "value", ")", "{", "assertPropertyNotNull", "(", "property", ")", ";", "add", "(", "property", ",", "new", "UserMessage", "(", "CONSTRAINTS_Mod11Check_MESSAGE", ",",...
Add the created action message for the key 'constraints.Mod11Check.message' with parameters. <pre> message: The check digit for ${value} is invalid, Modulo 11 checksum failed. </pre> @param property The property name for the message. (NotNull) @param value The parameter value for message. (NotNull) @return this. (NotNull)
[ "Add", "the", "created", "action", "message", "for", "the", "key", "constraints", ".", "Mod11Check", ".", "message", "with", "parameters", ".", "<pre", ">", "message", ":", "The", "check", "digit", "for", "$", "{", "value", "}", "is", "invalid", "Modulo", ...
train
https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L889-L893
grails/grails-core
grails-core/src/main/groovy/grails/util/GrailsClassUtils.java
GrailsClassUtils.isGetter
public static boolean isGetter(String name, Class returnType, Class<?>[] args) { return GrailsNameUtils.isGetter(name, returnType, args); }
java
public static boolean isGetter(String name, Class returnType, Class<?>[] args) { return GrailsNameUtils.isGetter(name, returnType, args); }
[ "public", "static", "boolean", "isGetter", "(", "String", "name", ",", "Class", "returnType", ",", "Class", "<", "?", ">", "[", "]", "args", ")", "{", "return", "GrailsNameUtils", ".", "isGetter", "(", "name", ",", "returnType", ",", "args", ")", ";", ...
Returns true if the name of the method specified and the number of arguments make it a javabean property getter. The name is assumed to be a valid Java method name, that is not verified. @param name The name of the method @param returnType The return type of the method @param args The arguments @return true if it is a javabean property getter
[ "Returns", "true", "if", "the", "name", "of", "the", "method", "specified", "and", "the", "number", "of", "arguments", "make", "it", "a", "javabean", "property", "getter", ".", "The", "name", "is", "assumed", "to", "be", "a", "valid", "Java", "method", "...
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/util/GrailsClassUtils.java#L893-L895
wonderpush/wonderpush-android-sdk
sdk/src/main/java/com/wonderpush/sdk/WonderPushRestClient.java
WonderPushRestClient.fetchAnonymousAccessTokenAndRunRequest
protected static void fetchAnonymousAccessTokenAndRunRequest(final Request request) { fetchAnonymousAccessToken(request.getUserId(), new ResponseHandler() { @Override public void onSuccess(Response response) { requestAuthenticated(request); } @Override public void onFailure(Throwable e, Response errorResponse) { } }); }
java
protected static void fetchAnonymousAccessTokenAndRunRequest(final Request request) { fetchAnonymousAccessToken(request.getUserId(), new ResponseHandler() { @Override public void onSuccess(Response response) { requestAuthenticated(request); } @Override public void onFailure(Throwable e, Response errorResponse) { } }); }
[ "protected", "static", "void", "fetchAnonymousAccessTokenAndRunRequest", "(", "final", "Request", "request", ")", "{", "fetchAnonymousAccessToken", "(", "request", ".", "getUserId", "(", ")", ",", "new", "ResponseHandler", "(", ")", "{", "@", "Override", "public", ...
Fetches an anonymous access token and run the given request with that token. Retries when access token cannot be fetched. @param request The request to be run
[ "Fetches", "an", "anonymous", "access", "token", "and", "run", "the", "given", "request", "with", "that", "token", ".", "Retries", "when", "access", "token", "cannot", "be", "fetched", "." ]
train
https://github.com/wonderpush/wonderpush-android-sdk/blob/ba0a1568f705cdd6206639bfab1e5cf529084b59/sdk/src/main/java/com/wonderpush/sdk/WonderPushRestClient.java#L530-L541
msgpack/msgpack-java
msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java
MessageUnpacker.readPayload
public void readPayload(byte[] dst, int off, int len) throws IOException { while (true) { int bufferRemaining = buffer.size() - position; if (bufferRemaining >= len) { buffer.getBytes(position, dst, off, len); position += len; return; } buffer.getBytes(position, dst, off, bufferRemaining); off += bufferRemaining; len -= bufferRemaining; position += bufferRemaining; nextBuffer(); } }
java
public void readPayload(byte[] dst, int off, int len) throws IOException { while (true) { int bufferRemaining = buffer.size() - position; if (bufferRemaining >= len) { buffer.getBytes(position, dst, off, len); position += len; return; } buffer.getBytes(position, dst, off, bufferRemaining); off += bufferRemaining; len -= bufferRemaining; position += bufferRemaining; nextBuffer(); } }
[ "public", "void", "readPayload", "(", "byte", "[", "]", "dst", ",", "int", "off", ",", "int", "len", ")", "throws", "IOException", "{", "while", "(", "true", ")", "{", "int", "bufferRemaining", "=", "buffer", ".", "size", "(", ")", "-", "position", "...
Reads payload bytes of binary, extension, or raw string types. This consumes specified amount of bytes into the specified byte array. @param dst the byte array into which the data is read @param off the offset in the dst array @param len the number of bytes to read @throws IOException when underlying input throws IOException
[ "Reads", "payload", "bytes", "of", "binary", "extension", "or", "raw", "string", "types", "." ]
train
https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java#L1597-L1614
apache/groovy
src/main/java/org/apache/groovy/ast/tools/ExpressionUtils.java
ExpressionUtils.isTypeOrArrayOfType
public static boolean isTypeOrArrayOfType(ClassNode targetType, ClassNode type, boolean recurse) { if (targetType == null) return false; return type.equals(targetType) || (targetType.isArray() && recurse ? isTypeOrArrayOfType(targetType.getComponentType(), type, recurse) : type.equals(targetType.getComponentType())); }
java
public static boolean isTypeOrArrayOfType(ClassNode targetType, ClassNode type, boolean recurse) { if (targetType == null) return false; return type.equals(targetType) || (targetType.isArray() && recurse ? isTypeOrArrayOfType(targetType.getComponentType(), type, recurse) : type.equals(targetType.getComponentType())); }
[ "public", "static", "boolean", "isTypeOrArrayOfType", "(", "ClassNode", "targetType", ",", "ClassNode", "type", ",", "boolean", "recurse", ")", "{", "if", "(", "targetType", "==", "null", ")", "return", "false", ";", "return", "type", ".", "equals", "(", "ta...
Determine if a type matches another type (or array thereof). @param targetType the candidate type @param type the type we are checking against @param recurse true if we can have multi-dimension arrays; should be false for annotation member types @return true if the type equals the targetType or array thereof
[ "Determine", "if", "a", "type", "matches", "another", "type", "(", "or", "array", "thereof", ")", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/apache/groovy/ast/tools/ExpressionUtils.java#L181-L187
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/TileGroup.java
TileGroup.contains
public boolean contains(Integer sheet, int number) { for (final TileRef current : tiles) { if (current.getSheet().equals(sheet) && current.getNumber() == number) { return true; } } return false; }
java
public boolean contains(Integer sheet, int number) { for (final TileRef current : tiles) { if (current.getSheet().equals(sheet) && current.getNumber() == number) { return true; } } return false; }
[ "public", "boolean", "contains", "(", "Integer", "sheet", ",", "int", "number", ")", "{", "for", "(", "final", "TileRef", "current", ":", "tiles", ")", "{", "if", "(", "current", ".", "getSheet", "(", ")", ".", "equals", "(", "sheet", ")", "&&", "cur...
Check if tile is contained by the group. @param sheet The sheet number. @param number The tile number. @return <code>true</code> if part of the group, <code>false</code> else.
[ "Check", "if", "tile", "is", "contained", "by", "the", "group", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/TileGroup.java#L87-L97
jnidzwetzki/bitfinex-v2-wss-api-java
src/main/java/com/github/jnidzwetzki/bitfinex/v2/BitfinexApiCallbackListeners.java
BitfinexApiCallbackListeners.onMyOrderNotification
public Closeable onMyOrderNotification(final BiConsumer<BitfinexAccountSymbol, BitfinexSubmittedOrder> listener) { newOrderConsumers.offer(listener); return () -> newOrderConsumers.remove(listener); }
java
public Closeable onMyOrderNotification(final BiConsumer<BitfinexAccountSymbol, BitfinexSubmittedOrder> listener) { newOrderConsumers.offer(listener); return () -> newOrderConsumers.remove(listener); }
[ "public", "Closeable", "onMyOrderNotification", "(", "final", "BiConsumer", "<", "BitfinexAccountSymbol", ",", "BitfinexSubmittedOrder", ">", "listener", ")", "{", "newOrderConsumers", ".", "offer", "(", "listener", ")", ";", "return", "(", ")", "->", "newOrderConsu...
registers listener for my order notifications @param listener of event @return hook of this listener
[ "registers", "listener", "for", "my", "order", "notifications" ]
train
https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/BitfinexApiCallbackListeners.java#L98-L101
aws/aws-sdk-java
aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/IdentityProviderType.java
IdentityProviderType.withAttributeMapping
public IdentityProviderType withAttributeMapping(java.util.Map<String, String> attributeMapping) { setAttributeMapping(attributeMapping); return this; }
java
public IdentityProviderType withAttributeMapping(java.util.Map<String, String> attributeMapping) { setAttributeMapping(attributeMapping); return this; }
[ "public", "IdentityProviderType", "withAttributeMapping", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "attributeMapping", ")", "{", "setAttributeMapping", "(", "attributeMapping", ")", ";", "return", "this", ";", "}" ]
<p> A mapping of identity provider attributes to standard and custom user pool attributes. </p> @param attributeMapping A mapping of identity provider attributes to standard and custom user pool attributes. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "mapping", "of", "identity", "provider", "attributes", "to", "standard", "and", "custom", "user", "pool", "attributes", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/IdentityProviderType.java#L329-L332
Azure/azure-sdk-for-java
iotcentral/resource-manager/v2017_07_01_privatepreview/src/main/java/com/microsoft/azure/management/iotcentral/v2017_07_01_privatepreview/implementation/AppsInner.java
AppsInner.updateAsync
public Observable<AppInner> updateAsync(String resourceGroupName, String resourceName, AppPatch appPatch) { return updateWithServiceResponseAsync(resourceGroupName, resourceName, appPatch).map(new Func1<ServiceResponse<AppInner>, AppInner>() { @Override public AppInner call(ServiceResponse<AppInner> response) { return response.body(); } }); }
java
public Observable<AppInner> updateAsync(String resourceGroupName, String resourceName, AppPatch appPatch) { return updateWithServiceResponseAsync(resourceGroupName, resourceName, appPatch).map(new Func1<ServiceResponse<AppInner>, AppInner>() { @Override public AppInner call(ServiceResponse<AppInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "AppInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "AppPatch", "appPatch", ")", "{", "return", "updateWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ",", "appP...
Update the metadata of an IoT Central application. @param resourceGroupName The name of the resource group that contains the IoT Central application. @param resourceName The ARM resource name of the IoT Central application. @param appPatch The IoT Central application metadata and security metadata. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Update", "the", "metadata", "of", "an", "IoT", "Central", "application", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iotcentral/resource-manager/v2017_07_01_privatepreview/src/main/java/com/microsoft/azure/management/iotcentral/v2017_07_01_privatepreview/implementation/AppsInner.java#L418-L425
scireum/server-sass
src/main/java/org/serversass/Functions.java
Functions.adjusthue
public static Expression adjusthue(Generator generator, FunctionCall input) { Color color = input.getExpectedColorParam(0); int changeInDegrees = input.getExpectedIntParam(1); Color.HSL hsl = color.getHSL(); hsl.setH(hsl.getH() + changeInDegrees); return hsl.getColor(); }
java
public static Expression adjusthue(Generator generator, FunctionCall input) { Color color = input.getExpectedColorParam(0); int changeInDegrees = input.getExpectedIntParam(1); Color.HSL hsl = color.getHSL(); hsl.setH(hsl.getH() + changeInDegrees); return hsl.getColor(); }
[ "public", "static", "Expression", "adjusthue", "(", "Generator", "generator", ",", "FunctionCall", "input", ")", "{", "Color", "color", "=", "input", ".", "getExpectedColorParam", "(", "0", ")", ";", "int", "changeInDegrees", "=", "input", ".", "getExpectedIntPa...
Adjusts the hue of the given color by the given number of degrees. @param generator the surrounding generator @param input the function call to evaluate @return the result of the evaluation
[ "Adjusts", "the", "hue", "of", "the", "given", "color", "by", "the", "given", "number", "of", "degrees", "." ]
train
https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/Functions.java#L78-L84
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/linalg/jcublas/buffer/factory/CudaDataBufferFactory.java
CudaDataBufferFactory.createDouble
@Override public DataBuffer createDouble(double[] data, boolean copy, MemoryWorkspace workspace) { return new CudaDoubleDataBuffer(data, copy, workspace); }
java
@Override public DataBuffer createDouble(double[] data, boolean copy, MemoryWorkspace workspace) { return new CudaDoubleDataBuffer(data, copy, workspace); }
[ "@", "Override", "public", "DataBuffer", "createDouble", "(", "double", "[", "]", "data", ",", "boolean", "copy", ",", "MemoryWorkspace", "workspace", ")", "{", "return", "new", "CudaDoubleDataBuffer", "(", "data", ",", "copy", ",", "workspace", ")", ";", "}...
Creates a double data buffer @param data the data to create the buffer from @param copy @param workspace @return the new buffer
[ "Creates", "a", "double", "data", "buffer" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/linalg/jcublas/buffer/factory/CudaDataBufferFactory.java#L840-L843
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.listCustomPrebuiltIntents
public List<IntentClassifier> listCustomPrebuiltIntents(UUID appId, String versionId) { return listCustomPrebuiltIntentsWithServiceResponseAsync(appId, versionId).toBlocking().single().body(); }
java
public List<IntentClassifier> listCustomPrebuiltIntents(UUID appId, String versionId) { return listCustomPrebuiltIntentsWithServiceResponseAsync(appId, versionId).toBlocking().single().body(); }
[ "public", "List", "<", "IntentClassifier", ">", "listCustomPrebuiltIntents", "(", "UUID", "appId", ",", "String", "versionId", ")", "{", "return", "listCustomPrebuiltIntentsWithServiceResponseAsync", "(", "appId", ",", "versionId", ")", ".", "toBlocking", "(", ")", ...
Gets custom prebuilt intents information of this application. @param appId The application ID. @param versionId The version ID. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;IntentClassifier&gt; object if successful.
[ "Gets", "custom", "prebuilt", "intents", "information", "of", "this", "application", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L5804-L5806
alkacon/opencms-core
src/org/opencms/jsp/CmsJspTagContainer.java
CmsJspTagContainer.getNestedContainerName
public static String getNestedContainerName(String name, String parentIstanceId, String namePrefix) { String prefix; if (CmsStringUtil.isEmptyOrWhitespaceOnly(namePrefix)) { prefix = parentIstanceId + "-"; } else if ("none".equals(namePrefix)) { prefix = ""; } else { prefix = namePrefix + "-"; } return prefix + name; }
java
public static String getNestedContainerName(String name, String parentIstanceId, String namePrefix) { String prefix; if (CmsStringUtil.isEmptyOrWhitespaceOnly(namePrefix)) { prefix = parentIstanceId + "-"; } else if ("none".equals(namePrefix)) { prefix = ""; } else { prefix = namePrefix + "-"; } return prefix + name; }
[ "public", "static", "String", "getNestedContainerName", "(", "String", "name", ",", "String", "parentIstanceId", ",", "String", "namePrefix", ")", "{", "String", "prefix", ";", "if", "(", "CmsStringUtil", ".", "isEmptyOrWhitespaceOnly", "(", "namePrefix", ")", ")"...
Returns the prefixed nested container name.<p> This will be either {parentInstanceId}-{name} or {namePrefix}-{name} or in case namePrefix equals 'none' {name} only.<p> @param name the container name @param parentIstanceId the parent instance id @param namePrefix the name prefix attribute @return the nested container name
[ "Returns", "the", "prefixed", "nested", "container", "name", ".", "<p", ">", "This", "will", "be", "either", "{", "parentInstanceId", "}", "-", "{", "name", "}", "or", "{", "namePrefix", "}", "-", "{", "name", "}", "or", "in", "case", "namePrefix", "eq...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagContainer.java#L351-L362
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/workers/AbstractJsonObjectWork.java
AbstractJsonObjectWork.perform
protected void perform(JSONObject json, Coordinator coordinator, Provider provider) { logger.trace("Extracting event from JSON."); GerritEvent event = GerritJsonEventFactory.getEvent(json); if (event != null) { if (event instanceof GerritTriggeredEvent) { GerritTriggeredEvent gerritTriggeredEvent = (GerritTriggeredEvent)event; gerritTriggeredEvent.setProvider(provider); gerritTriggeredEvent.setReceivedOn(createdOn); } logger.debug("Event is: {}", event); perform(event, coordinator); } else { logger.debug("No event extracted!"); } }
java
protected void perform(JSONObject json, Coordinator coordinator, Provider provider) { logger.trace("Extracting event from JSON."); GerritEvent event = GerritJsonEventFactory.getEvent(json); if (event != null) { if (event instanceof GerritTriggeredEvent) { GerritTriggeredEvent gerritTriggeredEvent = (GerritTriggeredEvent)event; gerritTriggeredEvent.setProvider(provider); gerritTriggeredEvent.setReceivedOn(createdOn); } logger.debug("Event is: {}", event); perform(event, coordinator); } else { logger.debug("No event extracted!"); } }
[ "protected", "void", "perform", "(", "JSONObject", "json", ",", "Coordinator", "coordinator", ",", "Provider", "provider", ")", "{", "logger", ".", "trace", "(", "\"Extracting event from JSON.\"", ")", ";", "GerritEvent", "event", "=", "GerritJsonEventFactory", ".",...
Parses the JSONObject into a Java bean and sends the parsed {@link GerritEvent} down the inheritance chain. @param json the JSONObject to work on. @param coordinator the coordinator. @param provider the Gerrit server info
[ "Parses", "the", "JSONObject", "into", "a", "Java", "bean", "and", "sends", "the", "parsed", "{" ]
train
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/workers/AbstractJsonObjectWork.java#L67-L81
Azure/azure-sdk-for-java
streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/StreamingJobsInner.java
StreamingJobsInner.getByResourceGroupAsync
public Observable<StreamingJobInner> getByResourceGroupAsync(String resourceGroupName, String jobName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, jobName).map(new Func1<ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsGetHeaders>, StreamingJobInner>() { @Override public StreamingJobInner call(ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsGetHeaders> response) { return response.body(); } }); }
java
public Observable<StreamingJobInner> getByResourceGroupAsync(String resourceGroupName, String jobName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, jobName).map(new Func1<ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsGetHeaders>, StreamingJobInner>() { @Override public StreamingJobInner call(ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsGetHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "StreamingJobInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "jobName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "jobName", ")", ".", "map", "...
Gets details about the specified streaming job. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param jobName The name of the streaming job. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the StreamingJobInner object
[ "Gets", "details", "about", "the", "specified", "streaming", "job", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/StreamingJobsInner.java#L863-L870
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/FlinkZooKeeperQuorumPeer.java
FlinkZooKeeperQuorumPeer.writeMyIdToDataDir
private static void writeMyIdToDataDir(Properties zkProps, int id) throws IOException { // Check dataDir and create if necessary if (zkProps.getProperty("dataDir") == null) { throw new IllegalConfigurationException("No dataDir configured."); } File dataDir = new File(zkProps.getProperty("dataDir")); if (!dataDir.isDirectory() && !dataDir.mkdirs()) { throw new IOException("Cannot create dataDir '" + dataDir + "'."); } dataDir.deleteOnExit(); LOG.info("Writing {} to myid file in 'dataDir'.", id); // Write myid to file. We use a File Writer, because that properly propagates errors, // while the PrintWriter swallows errors try (FileWriter writer = new FileWriter(new File(dataDir, "myid"))) { writer.write(String.valueOf(id)); } }
java
private static void writeMyIdToDataDir(Properties zkProps, int id) throws IOException { // Check dataDir and create if necessary if (zkProps.getProperty("dataDir") == null) { throw new IllegalConfigurationException("No dataDir configured."); } File dataDir = new File(zkProps.getProperty("dataDir")); if (!dataDir.isDirectory() && !dataDir.mkdirs()) { throw new IOException("Cannot create dataDir '" + dataDir + "'."); } dataDir.deleteOnExit(); LOG.info("Writing {} to myid file in 'dataDir'.", id); // Write myid to file. We use a File Writer, because that properly propagates errors, // while the PrintWriter swallows errors try (FileWriter writer = new FileWriter(new File(dataDir, "myid"))) { writer.write(String.valueOf(id)); } }
[ "private", "static", "void", "writeMyIdToDataDir", "(", "Properties", "zkProps", ",", "int", "id", ")", "throws", "IOException", "{", "// Check dataDir and create if necessary", "if", "(", "zkProps", ".", "getProperty", "(", "\"dataDir\"", ")", "==", "null", ")", ...
Write 'myid' file to the 'dataDir' in the given ZooKeeper configuration. <blockquote> Every machine that is part of the ZooKeeper ensemble should know about every other machine in the ensemble. You accomplish this with the series of lines of the form server.id=host:port:port. The parameters host and port are straightforward. You attribute the server id to each machine by creating a file named myid, one for each server, which resides in that server's data directory, as specified by the configuration file parameter dataDir. </blockquote> @param zkProps ZooKeeper configuration. @param id The ID of this {@link QuorumPeer}. @throws IllegalConfigurationException Thrown, if 'dataDir' property not set in given ZooKeeper properties. @throws IOException Thrown, if 'dataDir' does not exist and cannot be created. @see <a href="http://zookeeper.apache.org/doc/r3.4.6/zookeeperAdmin.html"> ZooKeeper Administrator's Guide</a>
[ "Write", "myid", "file", "to", "the", "dataDir", "in", "the", "given", "ZooKeeper", "configuration", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/FlinkZooKeeperQuorumPeer.java#L220-L242
Coveros/selenified
src/main/java/com/coveros/selenified/Selenified.java
Selenified.loadInitialPage
private void loadInitialPage(App app, String url, Reporter reporter) { String startingPage = "The initial url of <i>"; String act = "Opening new browser and loading up initial url"; String expected = startingPage + url + "</i> will successfully load"; if (app != null) { try { app.getDriver().get(url); if (!app.get().url().contains(url)) { reporter.fail(act, expected, startingPage + app.get().url() + "</i> loaded instead of <i>" + url + "</i>"); return; } reporter.pass(act, expected, startingPage + url + "</i> loaded successfully"); } catch (Exception e) { log.warn(e); reporter.fail(act, expected, startingPage + url + "</i> did not load successfully"); } app.acceptCertificate(); } }
java
private void loadInitialPage(App app, String url, Reporter reporter) { String startingPage = "The initial url of <i>"; String act = "Opening new browser and loading up initial url"; String expected = startingPage + url + "</i> will successfully load"; if (app != null) { try { app.getDriver().get(url); if (!app.get().url().contains(url)) { reporter.fail(act, expected, startingPage + app.get().url() + "</i> loaded instead of <i>" + url + "</i>"); return; } reporter.pass(act, expected, startingPage + url + "</i> loaded successfully"); } catch (Exception e) { log.warn(e); reporter.fail(act, expected, startingPage + url + "</i> did not load successfully"); } app.acceptCertificate(); } }
[ "private", "void", "loadInitialPage", "(", "App", "app", ",", "String", "url", ",", "Reporter", "reporter", ")", "{", "String", "startingPage", "=", "\"The initial url of <i>\"", ";", "String", "act", "=", "\"Opening new browser and loading up initial url\"", ";", "St...
Loads the initial app specified by the url, and ensures the app loads successfully @param app - the application to be tested, contains all control elements @param url - the initial url to load @param reporter - the output file to write everything to
[ "Loads", "the", "initial", "app", "specified", "by", "the", "url", "and", "ensures", "the", "app", "loads", "successfully" ]
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/Selenified.java#L405-L425
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.updateKeyAsync
public ServiceFuture<KeyBundle> updateKeyAsync(String vaultBaseUrl, String keyName, String keyVersion, final ServiceCallback<KeyBundle> serviceCallback) { return ServiceFuture.fromResponse(updateKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion), serviceCallback); }
java
public ServiceFuture<KeyBundle> updateKeyAsync(String vaultBaseUrl, String keyName, String keyVersion, final ServiceCallback<KeyBundle> serviceCallback) { return ServiceFuture.fromResponse(updateKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion), serviceCallback); }
[ "public", "ServiceFuture", "<", "KeyBundle", ">", "updateKeyAsync", "(", "String", "vaultBaseUrl", ",", "String", "keyName", ",", "String", "keyVersion", ",", "final", "ServiceCallback", "<", "KeyBundle", ">", "serviceCallback", ")", "{", "return", "ServiceFuture", ...
The update key operation changes specified attributes of a stored key and can be applied to any key type and key version stored in Azure Key Vault. In order to perform this operation, the key must already exist in the Key Vault. Note: The cryptographic material of a key itself cannot be changed. This operation requires the keys/update permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyName The name of key to update. @param keyVersion The version of the key to update. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "The", "update", "key", "operation", "changes", "specified", "attributes", "of", "a", "stored", "key", "and", "can", "be", "applied", "to", "any", "key", "type", "and", "key", "version", "stored", "in", "Azure", "Key", "Vault", ".", "In", "order", "to", ...
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#L1191-L1193
arquillian/arquillian-algeron
common/git/src/main/java/org/arquillian/algeron/git/GitOperations.java
GitOperations.cloneRepository
public Git cloneRepository(final String remoteUrl, final Path localPath, final String passphrase, final Path privateKey) { SshSessionFactory sshSessionFactory = new JschConfigSessionFactory() { @Override protected void configure(OpenSshConfig.Host host, Session session) { session.setUserInfo(new PassphraseUserInfo(passphrase)); } @Override protected JSch createDefaultJSch(FS fs) throws JSchException { if (privateKey != null) { JSch defaultJSch = super.createDefaultJSch(fs); defaultJSch.addIdentity(privateKey.toFile().getAbsolutePath()); return defaultJSch; } else { return super.createDefaultJSch(fs); } } }; try { return Git.cloneRepository() .setURI(remoteUrl) .setTransportConfigCallback(transport -> { SshTransport sshTransport = (SshTransport) transport; sshTransport.setSshSessionFactory(sshSessionFactory); }) .setDirectory(localPath.toFile()) .call(); } catch (GitAPIException e) { throw new IllegalStateException(e); } }
java
public Git cloneRepository(final String remoteUrl, final Path localPath, final String passphrase, final Path privateKey) { SshSessionFactory sshSessionFactory = new JschConfigSessionFactory() { @Override protected void configure(OpenSshConfig.Host host, Session session) { session.setUserInfo(new PassphraseUserInfo(passphrase)); } @Override protected JSch createDefaultJSch(FS fs) throws JSchException { if (privateKey != null) { JSch defaultJSch = super.createDefaultJSch(fs); defaultJSch.addIdentity(privateKey.toFile().getAbsolutePath()); return defaultJSch; } else { return super.createDefaultJSch(fs); } } }; try { return Git.cloneRepository() .setURI(remoteUrl) .setTransportConfigCallback(transport -> { SshTransport sshTransport = (SshTransport) transport; sshTransport.setSshSessionFactory(sshSessionFactory); }) .setDirectory(localPath.toFile()) .call(); } catch (GitAPIException e) { throw new IllegalStateException(e); } }
[ "public", "Git", "cloneRepository", "(", "final", "String", "remoteUrl", ",", "final", "Path", "localPath", ",", "final", "String", "passphrase", ",", "final", "Path", "privateKey", ")", "{", "SshSessionFactory", "sshSessionFactory", "=", "new", "JschConfigSessionFa...
Clones a private remote git repository. Caller is responsible of closing git repository. @param remoteUrl to connect. @param localPath where to clone the repo. @param passphrase to access private key. @param privateKey file location. If null default (~.ssh/id_rsa) location is used. @return Git instance. Caller is responsible to close the connection.
[ "Clones", "a", "private", "remote", "git", "repository", ".", "Caller", "is", "responsible", "of", "closing", "git", "repository", "." ]
train
https://github.com/arquillian/arquillian-algeron/blob/ec79372defdafe99ab2f7bb696f1c1eabdbbacb6/common/git/src/main/java/org/arquillian/algeron/git/GitOperations.java#L522-L555
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/asserts/AssertMessages.java
AssertMessages.lowerEqualParameter
@Pure public static String lowerEqualParameter(int aindex, Object avalue, Object value) { return msg("A11", aindex, avalue, value); //$NON-NLS-1$ }
java
@Pure public static String lowerEqualParameter(int aindex, Object avalue, Object value) { return msg("A11", aindex, avalue, value); //$NON-NLS-1$ }
[ "@", "Pure", "public", "static", "String", "lowerEqualParameter", "(", "int", "aindex", ",", "Object", "avalue", ",", "Object", "value", ")", "{", "return", "msg", "(", "\"A11\"", ",", "aindex", ",", "avalue", ",", "value", ")", ";", "//$NON-NLS-1$", "}" ]
Parameter A must be lower than or equal to the given value. @param aindex the index of the parameter A. @param avalue the value of the parameter A. @param value the value. @return the error message.
[ "Parameter", "A", "must", "be", "lower", "than", "or", "equal", "to", "the", "given", "value", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/asserts/AssertMessages.java#L126-L129
SimiaCryptus/utilities
java-util/src/main/java/com/simiacryptus/text/TextGenerator.java
TextGenerator.generateMarkov
public String generateMarkov(int length, int context, String seed) { String str = seed; while (str.length() < length) { String prefix = str.substring(Math.max(str.length() - context, 0), str.length()); TrieNode node = inner.matchPredictor(prefix); long cursorCount = node.getCursorCount(); long fate = CompressionUtil.random.nextLong() % cursorCount; String next = null; Stream<TrieNode> stream = node.getChildren().map(x -> x); List<TrieNode> children = stream.collect(Collectors.toList()); for (TrieNode child : children) { fate -= child.getCursorCount(); if (fate <= 0) { if (child.getChar() != NodewalkerCodec.END_OF_STRING) { next = child.getToken(); } break; } } if (null != next) { str += next; } else { break; } } return str; }
java
public String generateMarkov(int length, int context, String seed) { String str = seed; while (str.length() < length) { String prefix = str.substring(Math.max(str.length() - context, 0), str.length()); TrieNode node = inner.matchPredictor(prefix); long cursorCount = node.getCursorCount(); long fate = CompressionUtil.random.nextLong() % cursorCount; String next = null; Stream<TrieNode> stream = node.getChildren().map(x -> x); List<TrieNode> children = stream.collect(Collectors.toList()); for (TrieNode child : children) { fate -= child.getCursorCount(); if (fate <= 0) { if (child.getChar() != NodewalkerCodec.END_OF_STRING) { next = child.getToken(); } break; } } if (null != next) { str += next; } else { break; } } return str; }
[ "public", "String", "generateMarkov", "(", "int", "length", ",", "int", "context", ",", "String", "seed", ")", "{", "String", "str", "=", "seed", ";", "while", "(", "str", ".", "length", "(", ")", "<", "length", ")", "{", "String", "prefix", "=", "st...
Generate markov string. @param length the length @param context the context @param seed the seed @return the string
[ "Generate", "markov", "string", "." ]
train
https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/text/TextGenerator.java#L53-L80
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericMessageImpl.java
GenericMessageImpl.parseMessage
public boolean parseMessage(WsByteBuffer buffer, boolean bExtractValue) throws Exception { final boolean bTrace = TraceComponent.isAnyTracingEnabled(); boolean rc = false; if (!isFirstLineComplete()) { if (bTrace && tc.isDebugEnabled()) { Tr.debug(tc, "Parsing First Line"); } rc = parseLine(buffer); } // if we've read the first line, then parse the headers // Note: we may come in with it true or it might be set to true above if (isFirstLineComplete()) { // keep parsing headers until that returns the "finished" response rc = parseHeaders(buffer, bExtractValue); } if (bTrace && tc.isDebugEnabled()) { Tr.debug(tc, "parseMessage returning " + rc); } return rc; }
java
public boolean parseMessage(WsByteBuffer buffer, boolean bExtractValue) throws Exception { final boolean bTrace = TraceComponent.isAnyTracingEnabled(); boolean rc = false; if (!isFirstLineComplete()) { if (bTrace && tc.isDebugEnabled()) { Tr.debug(tc, "Parsing First Line"); } rc = parseLine(buffer); } // if we've read the first line, then parse the headers // Note: we may come in with it true or it might be set to true above if (isFirstLineComplete()) { // keep parsing headers until that returns the "finished" response rc = parseHeaders(buffer, bExtractValue); } if (bTrace && tc.isDebugEnabled()) { Tr.debug(tc, "parseMessage returning " + rc); } return rc; }
[ "public", "boolean", "parseMessage", "(", "WsByteBuffer", "buffer", ",", "boolean", "bExtractValue", ")", "throws", "Exception", "{", "final", "boolean", "bTrace", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "boolean", "rc", "=", "false", "...
Parse a message from the input buffer. The input flag is whether or not to save the header value immediately or delay the extraction until the header value is queried. @param buffer @param bExtractValue @return boolean (true means parsed entire message) @throws Exception
[ "Parse", "a", "message", "from", "the", "input", "buffer", ".", "The", "input", "flag", "is", "whether", "or", "not", "to", "save", "the", "header", "value", "immediately", "or", "delay", "the", "extraction", "until", "the", "header", "value", "is", "queri...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericMessageImpl.java#L328-L349
rythmengine/rythmengine
src/main/java/org/rythmengine/Rythm.java
Rythm.getTemplate
public static final ITemplate getTemplate(String tmpl, Object ... args) { return engine().getTemplate(tmpl, args); }
java
public static final ITemplate getTemplate(String tmpl, Object ... args) { return engine().getTemplate(tmpl, args); }
[ "public", "static", "final", "ITemplate", "getTemplate", "(", "String", "tmpl", ",", "Object", "...", "args", ")", "{", "return", "engine", "(", ")", ".", "getTemplate", "(", "tmpl", ",", "args", ")", ";", "}" ]
get a template with the given params @param tmpl @param args @return the template
[ "get", "a", "template", "with", "the", "given", "params" ]
train
https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/Rythm.java#L279-L281
netty/netty
buffer/src/main/java/io/netty/buffer/Unpooled.java
Unpooled.wrappedBuffer
public static ByteBuf wrappedBuffer(int maxNumComponents, ByteBuffer... buffers) { return wrappedBuffer(maxNumComponents, CompositeByteBuf.BYTE_BUFFER_WRAPPER, buffers); }
java
public static ByteBuf wrappedBuffer(int maxNumComponents, ByteBuffer... buffers) { return wrappedBuffer(maxNumComponents, CompositeByteBuf.BYTE_BUFFER_WRAPPER, buffers); }
[ "public", "static", "ByteBuf", "wrappedBuffer", "(", "int", "maxNumComponents", ",", "ByteBuffer", "...", "buffers", ")", "{", "return", "wrappedBuffer", "(", "maxNumComponents", ",", "CompositeByteBuf", ".", "BYTE_BUFFER_WRAPPER", ",", "buffers", ")", ";", "}" ]
Creates a new big-endian composite buffer which wraps the slices of the specified NIO buffers without copying them. A modification on the content of the specified buffers will be visible to the returned buffer.
[ "Creates", "a", "new", "big", "-", "endian", "composite", "buffer", "which", "wraps", "the", "slices", "of", "the", "specified", "NIO", "buffers", "without", "copying", "them", ".", "A", "modification", "on", "the", "content", "of", "the", "specified", "buff...
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/Unpooled.java#L336-L338
jenkinsci/blueocean-display-url-plugin
src/main/java/org/jenkinsci/plugins/blueoceandisplayurl/BlueOceanDisplayURLImpl.java
BlueOceanDisplayURLImpl.getFullNameForItem
private static String getFullNameForItem(@Nullable BlueOrganization org, @Nonnull Item item) { ItemGroup<?> group = getBaseGroup(org); return Functions.getRelativeNameFrom(item, group); }
java
private static String getFullNameForItem(@Nullable BlueOrganization org, @Nonnull Item item) { ItemGroup<?> group = getBaseGroup(org); return Functions.getRelativeNameFrom(item, group); }
[ "private", "static", "String", "getFullNameForItem", "(", "@", "Nullable", "BlueOrganization", "org", ",", "@", "Nonnull", "Item", "item", ")", "{", "ItemGroup", "<", "?", ">", "group", "=", "getBaseGroup", "(", "org", ")", ";", "return", "Functions", ".", ...
Returns full name relative to the <code>BlueOrganization</code> base. Each name is separated by '/' @param org the organization the item belongs to @param item to return the full name of @return
[ "Returns", "full", "name", "relative", "to", "the", "<code", ">", "BlueOrganization<", "/", "code", ">", "base", ".", "Each", "name", "is", "separated", "by", "/" ]
train
https://github.com/jenkinsci/blueocean-display-url-plugin/blob/d6515117712c9b30a32f32bb6e1a977711b9b037/src/main/java/org/jenkinsci/plugins/blueoceandisplayurl/BlueOceanDisplayURLImpl.java#L136-L139
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/grid/Grid.java
Grid.getGridCellsAround
@Pure public AroundCellIterable<P> getGridCellsAround(Point2D<?, ?> position, double maximalDistance) { final int column = getColumnFor(position.getX()); final int row = getRowFor(position.getY()); return new AroundIterable(row, column, position, maximalDistance); }
java
@Pure public AroundCellIterable<P> getGridCellsAround(Point2D<?, ?> position, double maximalDistance) { final int column = getColumnFor(position.getX()); final int row = getRowFor(position.getY()); return new AroundIterable(row, column, position, maximalDistance); }
[ "@", "Pure", "public", "AroundCellIterable", "<", "P", ">", "getGridCellsAround", "(", "Point2D", "<", "?", ",", "?", ">", "position", ",", "double", "maximalDistance", ")", "{", "final", "int", "column", "=", "getColumnFor", "(", "position", ".", "getX", ...
Replies the cells around the specified point. The order of the replied cells follows cocentric circles around the cell that contains the specified point. @param position the position. @param maximalDistance is the distance above which the cells are not replied. @return the iterator on the cells.
[ "Replies", "the", "cells", "around", "the", "specified", "point", ".", "The", "order", "of", "the", "replied", "cells", "follows", "cocentric", "circles", "around", "the", "cell", "that", "contains", "the", "specified", "point", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/grid/Grid.java#L364-L369
aws/aws-sdk-java
aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/MessageRequest.java
MessageRequest.withAddresses
public MessageRequest withAddresses(java.util.Map<String, AddressConfiguration> addresses) { setAddresses(addresses); return this; }
java
public MessageRequest withAddresses(java.util.Map<String, AddressConfiguration> addresses) { setAddresses(addresses); return this; }
[ "public", "MessageRequest", "withAddresses", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "AddressConfiguration", ">", "addresses", ")", "{", "setAddresses", "(", "addresses", ")", ";", "return", "this", ";", "}" ]
A map of key-value pairs, where each key is an address and each value is an AddressConfiguration object. An address can be a push notification token, a phone number, or an email address. @param addresses A map of key-value pairs, where each key is an address and each value is an AddressConfiguration object. An address can be a push notification token, a phone number, or an email address. @return Returns a reference to this object so that method calls can be chained together.
[ "A", "map", "of", "key", "-", "value", "pairs", "where", "each", "key", "is", "an", "address", "and", "each", "value", "is", "an", "AddressConfiguration", "object", ".", "An", "address", "can", "be", "a", "push", "notification", "token", "a", "phone", "n...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/MessageRequest.java#L85-L88
alkacon/opencms-core
src/org/opencms/configuration/CmsConfigurationManager.java
CmsConfigurationManager.loadXmlConfiguration
private void loadXmlConfiguration(URL url, I_CmsXmlConfiguration configuration) throws SAXException, IOException { // generate the file URL for the XML input URL fileUrl = new URL(url, configuration.getXmlFileName()); CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_LOAD_CONFIG_XMLFILE_1, fileUrl)); // Check transformation rule here so we have the XML file / XSLT file log output together boolean hasTransformation = hasTransformation(); // create a backup of the configuration backupXmlConfiguration(configuration); // instantiate Digester and enable XML validation m_digester = new Digester(); m_digester.setUseContextClassLoader(true); //TODO: For this to work with transformed configurations, we need to add the correct DOCTYPE declarations to the transformed files m_digester.setValidating(true); m_digester.setEntityResolver(new CmsXmlEntityResolver(null)); m_digester.setRuleNamespaceURI(null); m_digester.setErrorHandler(new CmsXmlErrorHandler(fileUrl.getFile())); // add this class to the Digester m_digester.push(configuration); configuration.addXmlDigesterRules(m_digester); InputSource inputSource = null; if (hasTransformation) { try { inputSource = transformConfiguration(url, configuration); } catch (Exception e) { LOG.error("Error transforming " + configuration.getXmlFileName() + ": " + e.getLocalizedMessage(), e); } } if (inputSource == null) { inputSource = new InputSource(fileUrl.openStream()); } // start the parsing process m_digester.parse(inputSource); }
java
private void loadXmlConfiguration(URL url, I_CmsXmlConfiguration configuration) throws SAXException, IOException { // generate the file URL for the XML input URL fileUrl = new URL(url, configuration.getXmlFileName()); CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_LOAD_CONFIG_XMLFILE_1, fileUrl)); // Check transformation rule here so we have the XML file / XSLT file log output together boolean hasTransformation = hasTransformation(); // create a backup of the configuration backupXmlConfiguration(configuration); // instantiate Digester and enable XML validation m_digester = new Digester(); m_digester.setUseContextClassLoader(true); //TODO: For this to work with transformed configurations, we need to add the correct DOCTYPE declarations to the transformed files m_digester.setValidating(true); m_digester.setEntityResolver(new CmsXmlEntityResolver(null)); m_digester.setRuleNamespaceURI(null); m_digester.setErrorHandler(new CmsXmlErrorHandler(fileUrl.getFile())); // add this class to the Digester m_digester.push(configuration); configuration.addXmlDigesterRules(m_digester); InputSource inputSource = null; if (hasTransformation) { try { inputSource = transformConfiguration(url, configuration); } catch (Exception e) { LOG.error("Error transforming " + configuration.getXmlFileName() + ": " + e.getLocalizedMessage(), e); } } if (inputSource == null) { inputSource = new InputSource(fileUrl.openStream()); } // start the parsing process m_digester.parse(inputSource); }
[ "private", "void", "loadXmlConfiguration", "(", "URL", "url", ",", "I_CmsXmlConfiguration", "configuration", ")", "throws", "SAXException", ",", "IOException", "{", "// generate the file URL for the XML input", "URL", "fileUrl", "=", "new", "URL", "(", "url", ",", "co...
Loads the OpenCms configuration from the given XML URL.<p> @param url the base URL of the XML configuration to load @param configuration the configuration to load @throws SAXException in case of XML parse errors @throws IOException in case of file IO errors
[ "Loads", "the", "OpenCms", "configuration", "from", "the", "given", "XML", "URL", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/CmsConfigurationManager.java#L636-L674
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/Stream.java
Stream.takeUntilIndexed
@NotNull public Stream<T> takeUntilIndexed(@NotNull IndexedPredicate<? super T> stopPredicate) { return takeUntilIndexed(0, 1, stopPredicate); }
java
@NotNull public Stream<T> takeUntilIndexed(@NotNull IndexedPredicate<? super T> stopPredicate) { return takeUntilIndexed(0, 1, stopPredicate); }
[ "@", "NotNull", "public", "Stream", "<", "T", ">", "takeUntilIndexed", "(", "@", "NotNull", "IndexedPredicate", "<", "?", "super", "T", ">", "stopPredicate", ")", "{", "return", "takeUntilIndexed", "(", "0", ",", "1", ",", "stopPredicate", ")", ";", "}" ]
Takes elements while the {@code IndexedPredicate} returns {@code false}. Once predicate condition is satisfied by an element, the stream finishes with this element. <p>This is an intermediate operation. <p>Example: <pre> stopPredicate: (index, value) -&gt; (index + value) &gt; 4 stream: [1, 2, 3, 4, 0, 1, 2] index: [0, 1, 2, 3, 4, 5, 6] sum: [1, 3, 5, 7, 4, 6, 8] result: [1, 2, 3] </pre> @param stopPredicate the {@code IndexedPredicate} used to take elements @return the new stream @since 1.1.6
[ "Takes", "elements", "while", "the", "{", "@code", "IndexedPredicate", "}", "returns", "{", "@code", "false", "}", ".", "Once", "predicate", "condition", "is", "satisfied", "by", "an", "element", "the", "stream", "finishes", "with", "this", "element", "." ]
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/Stream.java#L1401-L1404
intendia-oss/rxjava-gwt
src/main/modified/io/reactivex/super/io/reactivex/Maybe.java
Maybe.flatMapSingleElement
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <R> Maybe<R> flatMapSingleElement(final Function<? super T, ? extends SingleSource<? extends R>> mapper) { ObjectHelper.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new MaybeFlatMapSingleElement<T, R>(this, mapper)); }
java
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <R> Maybe<R> flatMapSingleElement(final Function<? super T, ? extends SingleSource<? extends R>> mapper) { ObjectHelper.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new MaybeFlatMapSingleElement<T, R>(this, mapper)); }
[ "@", "CheckReturnValue", "@", "SchedulerSupport", "(", "SchedulerSupport", ".", "NONE", ")", "public", "final", "<", "R", ">", "Maybe", "<", "R", ">", "flatMapSingleElement", "(", "final", "Function", "<", "?", "super", "T", ",", "?", "extends", "SingleSourc...
Returns a {@link Maybe} based on applying a specified function to the item emitted by the source {@link Maybe}, where that function returns a {@link Single}. When this Maybe just completes the resulting {@code Maybe} completes as well. <p> <img width="640" height="356" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Maybe.flatMapSingle.png" alt=""> <dl> <dt><b>Scheduler:</b></dt> <dd>{@code flatMapSingleElement} does not operate by default on a particular {@link Scheduler}.</dd> </dl> <p>History: 2.0.2 - experimental @param <R> the result value type @param mapper a function that, when applied to the item emitted by the source Maybe, returns a Single @return the new Maybe instance @see <a href="http://reactivex.io/documentation/operators/flatmap.html">ReactiveX operators documentation: FlatMap</a> @since 2.1
[ "Returns", "a", "{", "@link", "Maybe", "}", "based", "on", "applying", "a", "specified", "function", "to", "the", "item", "emitted", "by", "the", "source", "{", "@link", "Maybe", "}", "where", "that", "function", "returns", "a", "{", "@link", "Single", "...
train
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Maybe.java#L3118-L3123
akamai/AkamaiOPEN-edgegrid-java
edgerc-reader/src/main/java/com/akamai/edgegrid/signer/EdgeRcClientCredentialProvider.java
EdgeRcClientCredentialProvider.fromEdgeRc
public static EdgeRcClientCredentialProvider fromEdgeRc(String filename, String section) throws ConfigurationException, IOException { if (filename == null || "".equals(filename)) { throw new IllegalArgumentException("filename cannot be null"); } filename = filename.replaceFirst("^~", System.getProperty("user.home")); File file = new File(filename); return fromEdgeRc(new FileReader(file), section); }
java
public static EdgeRcClientCredentialProvider fromEdgeRc(String filename, String section) throws ConfigurationException, IOException { if (filename == null || "".equals(filename)) { throw new IllegalArgumentException("filename cannot be null"); } filename = filename.replaceFirst("^~", System.getProperty("user.home")); File file = new File(filename); return fromEdgeRc(new FileReader(file), section); }
[ "public", "static", "EdgeRcClientCredentialProvider", "fromEdgeRc", "(", "String", "filename", ",", "String", "section", ")", "throws", "ConfigurationException", ",", "IOException", "{", "if", "(", "filename", "==", "null", "||", "\"\"", ".", "equals", "(", "filen...
Loads an EdgeRc configuration file and returns an {@link EdgeRcClientCredentialProvider} to read {@link ClientCredential}s from it. @param filename a filename pointing to an EdgeRc file @param section a config section ({@code null} for the default section) @return a {@link EdgeRcClientCredentialProvider} @throws ConfigurationException If an error occurs while reading the configuration @throws IOException if an I/O error occurs
[ "Loads", "an", "EdgeRc", "configuration", "file", "and", "returns", "an", "{", "@link", "EdgeRcClientCredentialProvider", "}", "to", "read", "{", "@link", "ClientCredential", "}", "s", "from", "it", "." ]
train
https://github.com/akamai/AkamaiOPEN-edgegrid-java/blob/29aa39f0f70f62503e6a434c4470ee25cb640f58/edgerc-reader/src/main/java/com/akamai/edgegrid/signer/EdgeRcClientCredentialProvider.java#L110-L118
rhuss/jolokia
agent/core/src/main/java/org/jolokia/handler/ExecHandler.java
ExecHandler.doHandleRequest
@Override public Object doHandleRequest(MBeanServerConnection server, JmxExecRequest request) throws InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, IOException { OperationAndParamType types = extractOperationTypes(server,request); int nrParams = types.paramClasses.length; Object[] params = new Object[nrParams]; List<Object> args = request.getArguments(); verifyArguments(request, types, nrParams, args); for (int i = 0;i < nrParams; i++) { if (types.paramOpenTypes != null && types.paramOpenTypes[i] != null) { params[i] = converters.getToOpenTypeConverter().convertToObject(types.paramOpenTypes[i], args.get(i)); } else { params[i] = converters.getToObjectConverter().prepareValue(types.paramClasses[i], args.get(i)); } } // TODO: Maybe allow for a path as well which could be applied on the return value ... return server.invoke(request.getObjectName(),types.operationName,params,types.paramClasses); }
java
@Override public Object doHandleRequest(MBeanServerConnection server, JmxExecRequest request) throws InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, IOException { OperationAndParamType types = extractOperationTypes(server,request); int nrParams = types.paramClasses.length; Object[] params = new Object[nrParams]; List<Object> args = request.getArguments(); verifyArguments(request, types, nrParams, args); for (int i = 0;i < nrParams; i++) { if (types.paramOpenTypes != null && types.paramOpenTypes[i] != null) { params[i] = converters.getToOpenTypeConverter().convertToObject(types.paramOpenTypes[i], args.get(i)); } else { params[i] = converters.getToObjectConverter().prepareValue(types.paramClasses[i], args.get(i)); } } // TODO: Maybe allow for a path as well which could be applied on the return value ... return server.invoke(request.getObjectName(),types.operationName,params,types.paramClasses); }
[ "@", "Override", "public", "Object", "doHandleRequest", "(", "MBeanServerConnection", "server", ",", "JmxExecRequest", "request", ")", "throws", "InstanceNotFoundException", ",", "AttributeNotFoundException", ",", "ReflectionException", ",", "MBeanException", ",", "IOExcept...
Execute an JMX operation. The operation name is taken from the request, as well as the arguments to use. If the operation is given in the format "op(type1,type2,...)" (e.g "getText(java.lang.String,int)" then the argument types are taken into account as well. This way, overloaded JMX operation can be used. If an overloaded JMX operation is called without specifying the argument types, then an exception is raised. @param server server to try @param request request to process from where the operation and its arguments are extracted. @return the return value of the operation call
[ "Execute", "an", "JMX", "operation", ".", "The", "operation", "name", "is", "taken", "from", "the", "request", "as", "well", "as", "the", "arguments", "to", "use", ".", "If", "the", "operation", "is", "given", "in", "the", "format", "op", "(", "type1", ...
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/handler/ExecHandler.java#L81-L99
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/util/MirrorTable.java
MirrorTable.syncTables
public Record syncTables(BaseTable tblTarget, Record recSource) throws DBException { tblTarget.getRecord().readSameRecord(recSource, false, false); return tblTarget.getRecord(); }
java
public Record syncTables(BaseTable tblTarget, Record recSource) throws DBException { tblTarget.getRecord().readSameRecord(recSource, false, false); return tblTarget.getRecord(); }
[ "public", "Record", "syncTables", "(", "BaseTable", "tblTarget", ",", "Record", "recSource", ")", "throws", "DBException", "{", "tblTarget", ".", "getRecord", "(", ")", ".", "readSameRecord", "(", "recSource", ",", "false", ",", "false", ")", ";", "return", ...
Read the mirrored record. @param tblTarget The table to read the same record from. @param recSource Source record @return The target table's record.
[ "Read", "the", "mirrored", "record", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/util/MirrorTable.java#L372-L376
google/closure-compiler
src/com/google/javascript/jscomp/ControlFlowAnalysis.java
ControlFlowAnalysis.isBreakTarget
public static boolean isBreakTarget(Node target, String label) { return isBreakStructure(target, label != null) && matchLabel(target.getParent(), label); }
java
public static boolean isBreakTarget(Node target, String label) { return isBreakStructure(target, label != null) && matchLabel(target.getParent(), label); }
[ "public", "static", "boolean", "isBreakTarget", "(", "Node", "target", ",", "String", "label", ")", "{", "return", "isBreakStructure", "(", "target", ",", "label", "!=", "null", ")", "&&", "matchLabel", "(", "target", ".", "getParent", "(", ")", ",", "labe...
Checks if target is actually the break target of labeled continue. The label can be null if it is an unlabeled break.
[ "Checks", "if", "target", "is", "actually", "the", "break", "target", "of", "labeled", "continue", ".", "The", "label", "can", "be", "null", "if", "it", "is", "an", "unlabeled", "break", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ControlFlowAnalysis.java#L928-L931
googleapis/google-cloud-java
google-cloud-clients/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerClient.java
WebSecurityScannerClient.createScanConfig
public final ScanConfig createScanConfig(ProjectName parent, ScanConfig scanConfig) { CreateScanConfigRequest request = CreateScanConfigRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setScanConfig(scanConfig) .build(); return createScanConfig(request); }
java
public final ScanConfig createScanConfig(ProjectName parent, ScanConfig scanConfig) { CreateScanConfigRequest request = CreateScanConfigRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setScanConfig(scanConfig) .build(); return createScanConfig(request); }
[ "public", "final", "ScanConfig", "createScanConfig", "(", "ProjectName", "parent", ",", "ScanConfig", "scanConfig", ")", "{", "CreateScanConfigRequest", "request", "=", "CreateScanConfigRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "parent", "==", "n...
Creates a new ScanConfig. <p>Sample code: <pre><code> try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) { ProjectName parent = ProjectName.of("[PROJECT]"); ScanConfig scanConfig = ScanConfig.newBuilder().build(); ScanConfig response = webSecurityScannerClient.createScanConfig(parent, scanConfig); } </code></pre> @param parent Required. The parent resource name where the scan is created, which should be a project resource name in the format 'projects/{projectId}'. @param scanConfig Required. The ScanConfig to be created. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "new", "ScanConfig", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerClient.java#L181-L189
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/Zealot.java
Zealot.getSqlInfo
public static SqlInfo getSqlInfo(String nameSpace, String zealotId) { return getSqlInfo(nameSpace, zealotId, null); }
java
public static SqlInfo getSqlInfo(String nameSpace, String zealotId) { return getSqlInfo(nameSpace, zealotId, null); }
[ "public", "static", "SqlInfo", "getSqlInfo", "(", "String", "nameSpace", ",", "String", "zealotId", ")", "{", "return", "getSqlInfo", "(", "nameSpace", ",", "zealotId", ",", "null", ")", ";", "}" ]
通过传入zealot xml文件对应的命名空间和zealot节点的ID来生成和获取sqlInfo信息(无参的SQL). @param nameSpace xml命名空间 @param zealotId xml中的zealotId @return 返回SqlInfo对象
[ "通过传入zealot", "xml文件对应的命名空间和zealot节点的ID来生成和获取sqlInfo信息", "(", "无参的SQL", ")", "." ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/Zealot.java#L68-L70
zaproxy/zaproxy
src/org/parosproxy/paros/core/scanner/HostProcess.java
HostProcess.performScannerHookBeforeScan
protected synchronized void performScannerHookBeforeScan(HttpMessage msg, AbstractPlugin plugin) { Iterator<ScannerHook> iter = this.parentScanner.getScannerHooks().iterator(); while(iter.hasNext()){ ScannerHook hook = iter.next(); if(hook != null) { try { hook.beforeScan(msg, plugin, this.parentScanner); } catch (Exception e) { log.info("An exception occurred while trying to call beforeScan(msg, plugin) for one of the ScannerHooks: " + e.getMessage(), e); } } } }
java
protected synchronized void performScannerHookBeforeScan(HttpMessage msg, AbstractPlugin plugin) { Iterator<ScannerHook> iter = this.parentScanner.getScannerHooks().iterator(); while(iter.hasNext()){ ScannerHook hook = iter.next(); if(hook != null) { try { hook.beforeScan(msg, plugin, this.parentScanner); } catch (Exception e) { log.info("An exception occurred while trying to call beforeScan(msg, plugin) for one of the ScannerHooks: " + e.getMessage(), e); } } } }
[ "protected", "synchronized", "void", "performScannerHookBeforeScan", "(", "HttpMessage", "msg", ",", "AbstractPlugin", "plugin", ")", "{", "Iterator", "<", "ScannerHook", ">", "iter", "=", "this", ".", "parentScanner", ".", "getScannerHooks", "(", ")", ".", "itera...
ZAP: abstract plugin will call this method in order to invoke any extensions that have hooked into the active scanner @param msg the message being scanned @param plugin the plugin being run
[ "ZAP", ":", "abstract", "plugin", "will", "call", "this", "method", "in", "order", "to", "invoke", "any", "extensions", "that", "have", "hooked", "into", "the", "active", "scanner" ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/core/scanner/HostProcess.java#L1068-L1080
rhuss/jolokia
agent/osgi/src/main/java/org/jolokia/osgi/JolokiaActivator.java
JolokiaActivator.getHttpContext
public synchronized HttpContext getHttpContext() { if (jolokiaHttpContext == null) { final String user = getConfiguration(USER); final String authMode = getConfiguration(AUTH_MODE); if (user == null) { if (ServiceAuthenticationHttpContext.shouldBeUsed(authMode)) { jolokiaHttpContext = new ServiceAuthenticationHttpContext(bundleContext, authMode); } else { jolokiaHttpContext = new DefaultHttpContext(); } } else { jolokiaHttpContext = new BasicAuthenticationHttpContext(getConfiguration(REALM), createAuthenticator(authMode)); } } return jolokiaHttpContext; }
java
public synchronized HttpContext getHttpContext() { if (jolokiaHttpContext == null) { final String user = getConfiguration(USER); final String authMode = getConfiguration(AUTH_MODE); if (user == null) { if (ServiceAuthenticationHttpContext.shouldBeUsed(authMode)) { jolokiaHttpContext = new ServiceAuthenticationHttpContext(bundleContext, authMode); } else { jolokiaHttpContext = new DefaultHttpContext(); } } else { jolokiaHttpContext = new BasicAuthenticationHttpContext(getConfiguration(REALM), createAuthenticator(authMode)); } } return jolokiaHttpContext; }
[ "public", "synchronized", "HttpContext", "getHttpContext", "(", ")", "{", "if", "(", "jolokiaHttpContext", "==", "null", ")", "{", "final", "String", "user", "=", "getConfiguration", "(", "USER", ")", ";", "final", "String", "authMode", "=", "getConfiguration", ...
Get the security context for out servlet. Dependent on the configuration, this is either a no-op context or one which authenticates with a given user @return the HttpContext with which the agent servlet gets registered.
[ "Get", "the", "security", "context", "for", "out", "servlet", ".", "Dependent", "on", "the", "configuration", "this", "is", "either", "a", "no", "-", "op", "context", "or", "one", "which", "authenticates", "with", "a", "given", "user" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/osgi/src/main/java/org/jolokia/osgi/JolokiaActivator.java#L147-L164
JOML-CI/JOML
src/org/joml/Matrix4x3f.java
Matrix4x3f.setOrthoSymmetric
public Matrix4x3f setOrthoSymmetric(float width, float height, float zNear, float zFar, boolean zZeroToOne) { MemUtil.INSTANCE.identity(this); m00 = 2.0f / width; m11 = 2.0f / height; m22 = (zZeroToOne ? 1.0f : 2.0f) / (zNear - zFar); m32 = (zZeroToOne ? zNear : (zFar + zNear)) / (zNear - zFar); properties = 0; return this; }
java
public Matrix4x3f setOrthoSymmetric(float width, float height, float zNear, float zFar, boolean zZeroToOne) { MemUtil.INSTANCE.identity(this); m00 = 2.0f / width; m11 = 2.0f / height; m22 = (zZeroToOne ? 1.0f : 2.0f) / (zNear - zFar); m32 = (zZeroToOne ? zNear : (zFar + zNear)) / (zNear - zFar); properties = 0; return this; }
[ "public", "Matrix4x3f", "setOrthoSymmetric", "(", "float", "width", ",", "float", "height", ",", "float", "zNear", ",", "float", "zFar", ",", "boolean", "zZeroToOne", ")", "{", "MemUtil", ".", "INSTANCE", ".", "identity", "(", "this", ")", ";", "m00", "=",...
Set this matrix to be a symmetric orthographic projection transformation for a right-handed coordinate system using the given NDC z range. <p> This method is equivalent to calling {@link #setOrtho(float, float, float, float, float, float, boolean) setOrtho()} with <code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>. <p> In order to apply the symmetric orthographic projection to an already existing transformation, use {@link #orthoSymmetric(float, float, float, float, boolean) orthoSymmetric()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #orthoSymmetric(float, float, float, float, boolean) @param width the distance between the right and left frustum edges @param height the distance between the top and bottom frustum edges @param zNear near clipping plane distance @param zFar far clipping plane distance @param zZeroToOne whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code> or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code> @return this
[ "Set", "this", "matrix", "to", "be", "a", "symmetric", "orthographic", "projection", "transformation", "for", "a", "right", "-", "handed", "coordinate", "system", "using", "the", "given", "NDC", "z", "range", ".", "<p", ">", "This", "method", "is", "equivale...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L5550-L5558
BlueBrain/bluima
utils/blue_commons/src/main/java/ch/epfl/bbp/StringUtils.java
StringUtils.maxTruncStr
public static String maxTruncStr(String source, int maxNrChars) { if (source != null && source.length() > maxNrChars) { return source.substring(0, maxNrChars); } else { return source; } }
java
public static String maxTruncStr(String source, int maxNrChars) { if (source != null && source.length() > maxNrChars) { return source.substring(0, maxNrChars); } else { return source; } }
[ "public", "static", "String", "maxTruncStr", "(", "String", "source", ",", "int", "maxNrChars", ")", "{", "if", "(", "source", "!=", "null", "&&", "source", ".", "length", "(", ")", ">", "maxNrChars", ")", "{", "return", "source", ".", "substring", "(", ...
Truncates the String at maxNrChars. @param source @param maxNrChars @return
[ "Truncates", "the", "String", "at", "maxNrChars", "." ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/utils/blue_commons/src/main/java/ch/epfl/bbp/StringUtils.java#L259-L265
opencb/biodata
biodata-tools/src/main/java/org/opencb/biodata/tools/variant/stats/VariantAggregatedStatsCalculator.java
VariantAggregatedStatsCalculator.getGenotype
public static void getGenotype(int index, Integer alleles[]) { // index++; // double value = (-3 + Math.sqrt(1 + 8 * index)) / 2; // slower than the iterating version, right? // alleles[1] = new Double(Math.ceil(value)).intValue(); // alleles[0] = alleles[1] - ((alleles[1] + 1) * (alleles[1] +2) / 2 - index); int cursor = 0; final int MAX_ALLOWED_ALLELES = 100; // should we allow more than 100 alleles? for (int i = 0; i < MAX_ALLOWED_ALLELES; i++) { for (int j = 0; j <= i; j++) { if (cursor == index) { alleles[0] = j; alleles[1] = i; return; } cursor++; } } }
java
public static void getGenotype(int index, Integer alleles[]) { // index++; // double value = (-3 + Math.sqrt(1 + 8 * index)) / 2; // slower than the iterating version, right? // alleles[1] = new Double(Math.ceil(value)).intValue(); // alleles[0] = alleles[1] - ((alleles[1] + 1) * (alleles[1] +2) / 2 - index); int cursor = 0; final int MAX_ALLOWED_ALLELES = 100; // should we allow more than 100 alleles? for (int i = 0; i < MAX_ALLOWED_ALLELES; i++) { for (int j = 0; j <= i; j++) { if (cursor == index) { alleles[0] = j; alleles[1] = i; return; } cursor++; } } }
[ "public", "static", "void", "getGenotype", "(", "int", "index", ",", "Integer", "alleles", "[", "]", ")", "{", "// index++;", "// double value = (-3 + Math.sqrt(1 + 8 * index)) / 2; // slower than the iterating version, right?", "// alleles[1] = new Double(Mat...
returns in alleles[] the genotype specified in index in the sequence: 0/0, 0/1, 1/1, 0/2, 1/2, 2/2, 0/3... @param index in this sequence, starting in 0 @param alleles returned genotype.
[ "returns", "in", "alleles", "[]", "the", "genotype", "specified", "in", "index", "in", "the", "sequence", ":", "0", "/", "0", "0", "/", "1", "1", "/", "1", "0", "/", "2", "1", "/", "2", "2", "/", "2", "0", "/", "3", "..." ]
train
https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/stats/VariantAggregatedStatsCalculator.java#L389-L407
podio/podio-java
src/main/java/com/podio/user/UserAPI.java
UserAPI.updateProfileField
public <F> void updateProfileField(ProfileField<F, ?> field, List<F> values) { if (field.isSingle()) { throw new IllegalArgumentException( "Field is only valid for single value"); } else { getResourceFactory() .getApiResource("/user/profile/" + field.getName()) .entity(new ProfileFieldMultiValue<F>(values), MediaType.APPLICATION_JSON_TYPE).put(); } }
java
public <F> void updateProfileField(ProfileField<F, ?> field, List<F> values) { if (field.isSingle()) { throw new IllegalArgumentException( "Field is only valid for single value"); } else { getResourceFactory() .getApiResource("/user/profile/" + field.getName()) .entity(new ProfileFieldMultiValue<F>(values), MediaType.APPLICATION_JSON_TYPE).put(); } }
[ "public", "<", "F", ">", "void", "updateProfileField", "(", "ProfileField", "<", "F", ",", "?", ">", "field", ",", "List", "<", "F", ">", "values", ")", "{", "if", "(", "field", ".", "isSingle", "(", ")", ")", "{", "throw", "new", "IllegalArgumentExc...
Updates a single field on the profile of the user @param field The field that should be updated @param values The new values of the field
[ "Updates", "a", "single", "field", "on", "the", "profile", "of", "the", "user" ]
train
https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/user/UserAPI.java#L132-L142
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Currency.java
Currency.isAvailable
public static boolean isAvailable(String code, Date from, Date to) { if (!isAlpha3Code(code)) { return false; } if (from != null && to != null && from.after(to)) { throw new IllegalArgumentException("To is before from"); } code = code.toUpperCase(Locale.ENGLISH); boolean isKnown = getAllCurrenciesAsSet().contains(code); if (isKnown == false) { return false; } else if (from == null && to == null) { return true; } // If caller passed a date range, we cannot rely solely on the cache CurrencyMetaInfo info = CurrencyMetaInfo.getInstance(); List<String> allActive = info.currencies( CurrencyFilter.onDateRange(from, to).withCurrency(code)); return allActive.contains(code); }
java
public static boolean isAvailable(String code, Date from, Date to) { if (!isAlpha3Code(code)) { return false; } if (from != null && to != null && from.after(to)) { throw new IllegalArgumentException("To is before from"); } code = code.toUpperCase(Locale.ENGLISH); boolean isKnown = getAllCurrenciesAsSet().contains(code); if (isKnown == false) { return false; } else if (from == null && to == null) { return true; } // If caller passed a date range, we cannot rely solely on the cache CurrencyMetaInfo info = CurrencyMetaInfo.getInstance(); List<String> allActive = info.currencies( CurrencyFilter.onDateRange(from, to).withCurrency(code)); return allActive.contains(code); }
[ "public", "static", "boolean", "isAvailable", "(", "String", "code", ",", "Date", "from", ",", "Date", "to", ")", "{", "if", "(", "!", "isAlpha3Code", "(", "code", ")", ")", "{", "return", "false", ";", "}", "if", "(", "from", "!=", "null", "&&", "...
Queries if the given ISO 4217 3-letter code is available on the specified date range. <p> Note: For checking availability of a currency on a specific date, specify the date on both <code>from</code> and <code>to</code>. When both <code>from</code> and <code>to</code> are null, this method checks if the specified currency is available all time. @param code The ISO 4217 3-letter code. @param from The lower bound of the date range, inclusive. When <code>from</code> is null, check the availability of the currency any date before <code>to</code> @param to The upper bound of the date range, inclusive. When <code>to</code> is null, check the availability of the currency any date after <code>from</code> @return true if the given ISO 4217 3-letter code is supported on the specified date range. @throws IllegalArgumentException when <code>to</code> is before <code>from</code>.
[ "Queries", "if", "the", "given", "ISO", "4217", "3", "-", "letter", "code", "is", "available", "on", "the", "specified", "date", "range", ".", "<p", ">", "Note", ":", "For", "checking", "availability", "of", "a", "currency", "on", "a", "specific", "date"...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Currency.java#L899-L921
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/misc/PixelMath.java
PixelMath.negative
public static void negative( InterleavedS16 input , InterleavedS16 output ) { output.reshape(input.width,input.height); int columns = input.width*input.numBands; if(BoofConcurrency.USE_CONCURRENT ) { ImplPixelMath_MT.negative(input.data, input.startIndex, input.stride, output.data, output.startIndex, output.stride, input.height, columns); } else { ImplPixelMath.negative(input.data, input.startIndex, input.stride, output.data, output.startIndex, output.stride, input.height, columns); } }
java
public static void negative( InterleavedS16 input , InterleavedS16 output ) { output.reshape(input.width,input.height); int columns = input.width*input.numBands; if(BoofConcurrency.USE_CONCURRENT ) { ImplPixelMath_MT.negative(input.data, input.startIndex, input.stride, output.data, output.startIndex, output.stride, input.height, columns); } else { ImplPixelMath.negative(input.data, input.startIndex, input.stride, output.data, output.startIndex, output.stride, input.height, columns); } }
[ "public", "static", "void", "negative", "(", "InterleavedS16", "input", ",", "InterleavedS16", "output", ")", "{", "output", ".", "reshape", "(", "input", ".", "width", ",", "input", ".", "height", ")", ";", "int", "columns", "=", "input", ".", "width", ...
Changes the sign of every pixel in the image: output[x,y] = -input[x,y] @param input The input image. Not modified. @param output Where the negated image is written to. Modified.
[ "Changes", "the", "sign", "of", "every", "pixel", "in", "the", "image", ":", "output", "[", "x", "y", "]", "=", "-", "input", "[", "x", "y", "]" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/PixelMath.java#L387-L401
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/GridBagLayoutFormBuilder.java
GridBagLayoutFormBuilder.appendLabeledField
public GridBagLayoutFormBuilder appendLabeledField(String propertyName, final JComponent field, LabelOrientation labelOrientation) { return appendLabeledField(propertyName, field, labelOrientation, 1); }
java
public GridBagLayoutFormBuilder appendLabeledField(String propertyName, final JComponent field, LabelOrientation labelOrientation) { return appendLabeledField(propertyName, field, labelOrientation, 1); }
[ "public", "GridBagLayoutFormBuilder", "appendLabeledField", "(", "String", "propertyName", ",", "final", "JComponent", "field", ",", "LabelOrientation", "labelOrientation", ")", "{", "return", "appendLabeledField", "(", "propertyName", ",", "field", ",", "labelOrientation...
Appends a label and field to the end of the current line. <p /> The label will be to the left of the field, and be right-justified. <br /> The field will "grow" horizontally as space allows. <p /> @param propertyName the name of the property to create the controls for @return "this" to make it easier to string together append calls
[ "Appends", "a", "label", "and", "field", "to", "the", "end", "of", "the", "current", "line", ".", "<p", "/", ">" ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/GridBagLayoutFormBuilder.java#L134-L137
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/packet/JivePropertiesExtension.java
JivePropertiesExtension.setProperty
public synchronized void setProperty(String name, Object value) { if (!(value instanceof Serializable)) { throw new IllegalArgumentException("Value must be serializable"); } properties.put(name, value); }
java
public synchronized void setProperty(String name, Object value) { if (!(value instanceof Serializable)) { throw new IllegalArgumentException("Value must be serializable"); } properties.put(name, value); }
[ "public", "synchronized", "void", "setProperty", "(", "String", "name", ",", "Object", "value", ")", "{", "if", "(", "!", "(", "value", "instanceof", "Serializable", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Value must be serializable\"", ...
Sets a property with an Object as the value. The value must be Serializable or an IllegalArgumentException will be thrown. @param name the name of the property. @param value the value of the property.
[ "Sets", "a", "property", "with", "an", "Object", "as", "the", "value", ".", "The", "value", "must", "be", "Serializable", "or", "an", "IllegalArgumentException", "will", "be", "thrown", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/packet/JivePropertiesExtension.java#L85-L90
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/odselement/OdsElements.java
OdsElements.addTableToContent
public Table addTableToContent(final String name, final int rowCapacity, final int columnCapacity) throws IOException { final Table previousTable = this.contentElement.getLastTable(); final Table table = this.contentElement.addTable(name, rowCapacity, columnCapacity); this.settingsElement.addTableConfig(table.getConfigEntry()); if (this.observer != null) { if (previousTable == null) this.observer.update(new MetaAndStylesElementsFlusher(this, this.contentElement)); else previousTable.flush(); table.addObserver(this.observer); } return table; }
java
public Table addTableToContent(final String name, final int rowCapacity, final int columnCapacity) throws IOException { final Table previousTable = this.contentElement.getLastTable(); final Table table = this.contentElement.addTable(name, rowCapacity, columnCapacity); this.settingsElement.addTableConfig(table.getConfigEntry()); if (this.observer != null) { if (previousTable == null) this.observer.update(new MetaAndStylesElementsFlusher(this, this.contentElement)); else previousTable.flush(); table.addObserver(this.observer); } return table; }
[ "public", "Table", "addTableToContent", "(", "final", "String", "name", ",", "final", "int", "rowCapacity", ",", "final", "int", "columnCapacity", ")", "throws", "IOException", "{", "final", "Table", "previousTable", "=", "this", ".", "contentElement", ".", "get...
Add a new table to content. The config for this table is added to the settings. If the OdsElements is observed, the previous table is flushed. If there is no previous table, meta.xml, styles.xml and the preamble of content.xml are written to destination. @param name name of the table @param rowCapacity estimated rows @param columnCapacity estimated columns @return the table @throws IOException if the OdsElements is observed and there is a write exception
[ "Add", "a", "new", "table", "to", "content", ".", "The", "config", "for", "this", "table", "is", "added", "to", "the", "settings", ".", "If", "the", "OdsElements", "is", "observed", "the", "previous", "table", "is", "flushed", ".", "If", "there", "is", ...
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/odselement/OdsElements.java#L214-L226
m-m-m/util
cli/src/main/java/net/sf/mmm/util/cli/base/CliValueMap.java
CliValueMap.getOrCreate
@SuppressWarnings("unchecked") public CliValueContainer getOrCreate(CliParameterContainer parameterContainer) { CliValueContainer result = this.map.get(parameterContainer); if (result == null) { PojoPropertyAccessorOneArg setter = parameterContainer.getSetter(); Class<?> propertyClass = setter.getPropertyClass(); if (propertyClass.isArray()) { result = new CliValueContainerArray(parameterContainer, this.cliState, this.dependencies, this.logger); } else if (Collection.class.isAssignableFrom(propertyClass)) { Class<? extends Collection<?>> collectionClass = (Class<? extends Collection<?>>) propertyClass; Collection<Object> collection = this.dependencies.getCollectionFactoryManager() .getCollectionFactory(collectionClass).create(); result = new CliValueContainerCollection(parameterContainer, this.cliState, this.dependencies, this.logger, collection); } else if (Map.class.isAssignableFrom(propertyClass)) { Class<? extends Map<?, ?>> mapClass = (Class<? extends Map<?, ?>>) propertyClass; Map<Object, Object> mapValue = this.dependencies.getCollectionFactoryManager().getMapFactory(mapClass) .create(); result = new CliValueContainerMap(parameterContainer, this.cliState, this.dependencies, this.logger, mapValue); } else { result = new CliValueContainerObject(parameterContainer, this.cliState, this.dependencies, this.logger); } this.map.put(parameterContainer, result); } return result; }
java
@SuppressWarnings("unchecked") public CliValueContainer getOrCreate(CliParameterContainer parameterContainer) { CliValueContainer result = this.map.get(parameterContainer); if (result == null) { PojoPropertyAccessorOneArg setter = parameterContainer.getSetter(); Class<?> propertyClass = setter.getPropertyClass(); if (propertyClass.isArray()) { result = new CliValueContainerArray(parameterContainer, this.cliState, this.dependencies, this.logger); } else if (Collection.class.isAssignableFrom(propertyClass)) { Class<? extends Collection<?>> collectionClass = (Class<? extends Collection<?>>) propertyClass; Collection<Object> collection = this.dependencies.getCollectionFactoryManager() .getCollectionFactory(collectionClass).create(); result = new CliValueContainerCollection(parameterContainer, this.cliState, this.dependencies, this.logger, collection); } else if (Map.class.isAssignableFrom(propertyClass)) { Class<? extends Map<?, ?>> mapClass = (Class<? extends Map<?, ?>>) propertyClass; Map<Object, Object> mapValue = this.dependencies.getCollectionFactoryManager().getMapFactory(mapClass) .create(); result = new CliValueContainerMap(parameterContainer, this.cliState, this.dependencies, this.logger, mapValue); } else { result = new CliValueContainerObject(parameterContainer, this.cliState, this.dependencies, this.logger); } this.map.put(parameterContainer, result); } return result; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "CliValueContainer", "getOrCreate", "(", "CliParameterContainer", "parameterContainer", ")", "{", "CliValueContainer", "result", "=", "this", ".", "map", ".", "get", "(", "parameterContainer", ")", ";", "...
This method gets the {@link CliValueContainer} for the given {@link CliParameterContainer}. In advance to {@link #get(CliParameterContainer)} this method will create an according {@link CliValueContainerObject} if not present and the {@link CliParameterContainer} has a {@link CliParameterContainer#getSetter() setter} with a {@link PojoPropertyAccessorOneArg#getPropertyType() property-type} reflecting an array, {@link Collection} or {@link Map}. @param parameterContainer is the {@link CliParameterContainer} that acts as key to the requested {@link CliValueContainerObject}. @return the requested {@link CliValueContainerObject} or {@code null} if NOT present and NOT created.
[ "This", "method", "gets", "the", "{", "@link", "CliValueContainer", "}", "for", "the", "given", "{", "@link", "CliParameterContainer", "}", ".", "In", "advance", "to", "{", "@link", "#get", "(", "CliParameterContainer", ")", "}", "this", "method", "will", "c...
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/cli/src/main/java/net/sf/mmm/util/cli/base/CliValueMap.java#L73-L100
vvakame/JsonPullParser
jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonUtil.java
JsonUtil.putDoubleList
public static void putDoubleList(Writer writer, List<Double> values) throws IOException { if (values == null) { writer.write("null"); } else { startArray(writer); for (int i = 0; i < values.size(); i++) { put(writer, values.get(i)); if (i != values.size() - 1) { addSeparator(writer); } } endArray(writer); } }
java
public static void putDoubleList(Writer writer, List<Double> values) throws IOException { if (values == null) { writer.write("null"); } else { startArray(writer); for (int i = 0; i < values.size(); i++) { put(writer, values.get(i)); if (i != values.size() - 1) { addSeparator(writer); } } endArray(writer); } }
[ "public", "static", "void", "putDoubleList", "(", "Writer", "writer", ",", "List", "<", "Double", ">", "values", ")", "throws", "IOException", "{", "if", "(", "values", "==", "null", ")", "{", "writer", ".", "write", "(", "\"null\"", ")", ";", "}", "el...
Writes the given value with the given writer. @param writer @param values @throws IOException @author vvakame
[ "Writes", "the", "given", "value", "with", "the", "given", "writer", "." ]
train
https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonUtil.java#L500-L513
apache/reef
lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/client/DriverFiles.java
DriverFiles.copyTo
public void copyTo(final File destinationFolder) throws IOException { if (!destinationFolder.exists() && !destinationFolder.mkdirs()) { LOG.log(Level.WARNING, "Failed to create [{0}]", destinationFolder.getAbsolutePath()); } final File reefFolder = new File(destinationFolder, fileNames.getREEFFolderName()); final File localFolder = new File(reefFolder, fileNames.getLocalFolderName()); final File globalFolder = new File(reefFolder, fileNames.getGlobalFolderName()); if (!localFolder.exists() && !localFolder.mkdirs()) { LOG.log(Level.WARNING, "Failed to create [{0}]", localFolder.getAbsolutePath()); } if (!globalFolder.exists() && !globalFolder.mkdirs()) { LOG.log(Level.WARNING, "Failed to create [{0}]", globalFolder.getAbsolutePath()); } try { this.localFiles.createSymbolicLinkTo(localFolder); this.localLibs.createSymbolicLinkTo(localFolder); this.globalLibs.createSymbolicLinkTo(globalFolder); this.globalFiles.createSymbolicLinkTo(globalFolder); } catch (final IOException e) { LOG.log(Level.FINE, "Can't symlink the files, copying them instead.", e); this.localFiles.copyTo(localFolder); this.localLibs.copyTo(localFolder); this.globalLibs.copyTo(globalFolder); this.globalFiles.copyTo(globalFolder); } }
java
public void copyTo(final File destinationFolder) throws IOException { if (!destinationFolder.exists() && !destinationFolder.mkdirs()) { LOG.log(Level.WARNING, "Failed to create [{0}]", destinationFolder.getAbsolutePath()); } final File reefFolder = new File(destinationFolder, fileNames.getREEFFolderName()); final File localFolder = new File(reefFolder, fileNames.getLocalFolderName()); final File globalFolder = new File(reefFolder, fileNames.getGlobalFolderName()); if (!localFolder.exists() && !localFolder.mkdirs()) { LOG.log(Level.WARNING, "Failed to create [{0}]", localFolder.getAbsolutePath()); } if (!globalFolder.exists() && !globalFolder.mkdirs()) { LOG.log(Level.WARNING, "Failed to create [{0}]", globalFolder.getAbsolutePath()); } try { this.localFiles.createSymbolicLinkTo(localFolder); this.localLibs.createSymbolicLinkTo(localFolder); this.globalLibs.createSymbolicLinkTo(globalFolder); this.globalFiles.createSymbolicLinkTo(globalFolder); } catch (final IOException e) { LOG.log(Level.FINE, "Can't symlink the files, copying them instead.", e); this.localFiles.copyTo(localFolder); this.localLibs.copyTo(localFolder); this.globalLibs.copyTo(globalFolder); this.globalFiles.copyTo(globalFolder); } }
[ "public", "void", "copyTo", "(", "final", "File", "destinationFolder", ")", "throws", "IOException", "{", "if", "(", "!", "destinationFolder", ".", "exists", "(", ")", "&&", "!", "destinationFolder", ".", "mkdirs", "(", ")", ")", "{", "LOG", ".", "log", ...
Copies this set of files to the destination folder given. <p> Will attempt to create symbolic links for the files to the destination folder. If the filesystem does not support symbolic links or the user does not have appropriate permissions, the entire file will be copied instead. @param destinationFolder the folder the files shall be copied to. @throws IOException if one or more of the copies fail.
[ "Copies", "this", "set", "of", "files", "to", "the", "destination", "folder", "given", ".", "<p", ">", "Will", "attempt", "to", "create", "symbolic", "links", "for", "the", "files", "to", "the", "destination", "folder", ".", "If", "the", "filesystem", "doe...
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/client/DriverFiles.java#L131-L158
Azure/azure-sdk-for-java
policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyEventsInner.java
PolicyEventsInner.listQueryResultsForResourceGroupLevelPolicyAssignmentAsync
public Observable<PolicyEventsQueryResultsInner> listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions) { return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName, queryOptions).map(new Func1<ServiceResponse<PolicyEventsQueryResultsInner>, PolicyEventsQueryResultsInner>() { @Override public PolicyEventsQueryResultsInner call(ServiceResponse<PolicyEventsQueryResultsInner> response) { return response.body(); } }); }
java
public Observable<PolicyEventsQueryResultsInner> listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions) { return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName, queryOptions).map(new Func1<ServiceResponse<PolicyEventsQueryResultsInner>, PolicyEventsQueryResultsInner>() { @Override public PolicyEventsQueryResultsInner call(ServiceResponse<PolicyEventsQueryResultsInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "PolicyEventsQueryResultsInner", ">", "listQueryResultsForResourceGroupLevelPolicyAssignmentAsync", "(", "String", "subscriptionId", ",", "String", "resourceGroupName", ",", "String", "policyAssignmentName", ",", "QueryOptions", "queryOptions", ")", ...
Queries policy events for the resource group level policy assignment. @param subscriptionId Microsoft Azure subscription ID. @param resourceGroupName Resource group name. @param policyAssignmentName Policy assignment name. @param queryOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PolicyEventsQueryResultsInner object
[ "Queries", "policy", "events", "for", "the", "resource", "group", "level", "policy", "assignment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyEventsInner.java#L1610-L1617
SonarSource/sonarqube
sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java
DateUtils.addDays
public static Date addDays(Date date, int numberOfDays) { return Date.from(date.toInstant().plus(numberOfDays, ChronoUnit.DAYS)); }
java
public static Date addDays(Date date, int numberOfDays) { return Date.from(date.toInstant().plus(numberOfDays, ChronoUnit.DAYS)); }
[ "public", "static", "Date", "addDays", "(", "Date", "date", ",", "int", "numberOfDays", ")", "{", "return", "Date", ".", "from", "(", "date", ".", "toInstant", "(", ")", ".", "plus", "(", "numberOfDays", ",", "ChronoUnit", ".", "DAYS", ")", ")", ";", ...
Adds a number of days to a date returning a new object. The original date object is unchanged. @param date the date, not null @param numberOfDays the amount to add, may be negative @return the new date object with the amount added
[ "Adds", "a", "number", "of", "days", "to", "a", "date", "returning", "a", "new", "object", ".", "The", "original", "date", "object", "is", "unchanged", "." ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java#L297-L299
ihaolin/session
session-redis/src/main/java/me/hao0/session/redis/RedisSessionManager.java
RedisSessionManager.loadById
public Map<String, Object> loadById(String id) { final String sid = sessionPrefix + ":" + id; try { return this.executor.execute(new RedisCallback<Map<String, Object>>() { public Map<String, Object> execute(Jedis jedis) { String session = jedis.get(sid); if (!Strings.isNullOrEmpty(session)) { return serializer.deserialize(session); } return Collections.emptyMap(); } }); } catch (Exception e) { log.error("failed to load session(key={}), cause:{}", sid, Throwables.getStackTraceAsString(e)); throw new SessionException("load session failed", e); } }
java
public Map<String, Object> loadById(String id) { final String sid = sessionPrefix + ":" + id; try { return this.executor.execute(new RedisCallback<Map<String, Object>>() { public Map<String, Object> execute(Jedis jedis) { String session = jedis.get(sid); if (!Strings.isNullOrEmpty(session)) { return serializer.deserialize(session); } return Collections.emptyMap(); } }); } catch (Exception e) { log.error("failed to load session(key={}), cause:{}", sid, Throwables.getStackTraceAsString(e)); throw new SessionException("load session failed", e); } }
[ "public", "Map", "<", "String", ",", "Object", ">", "loadById", "(", "String", "id", ")", "{", "final", "String", "sid", "=", "sessionPrefix", "+", "\":\"", "+", "id", ";", "try", "{", "return", "this", ".", "executor", ".", "execute", "(", "new", "R...
load session by id @param id session id @return session map object
[ "load", "session", "by", "id" ]
train
https://github.com/ihaolin/session/blob/322c3a9f47b305a39345135fa8163dd7e065b4f8/session-redis/src/main/java/me/hao0/session/redis/RedisSessionManager.java#L109-L125
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/IndexWriter.java
IndexWriter.generateAttributeUpdates
private void generateAttributeUpdates(BucketUpdate bucketUpdate, UpdateInstructions update) { if (!bucketUpdate.hasUpdates()) { // Nothing to do. return; } // Sanity check: If we get an existing bucket (that points to a Table Entry), then it must have at least one existing // key, otherwise (index buckets) must not have any. TableBucket bucket = bucketUpdate.getBucket(); Preconditions.checkArgument(bucket.exists() != bucketUpdate.getExistingKeys().isEmpty(), "Non-existing buckets must have no existing keys, while non-index Buckets must have at least one."); // All Keys in this bucket have the same hash. If there is more than one key per such hash, then we have // a collision, which must be resolved (this also handles removed keys). generateBackpointerUpdates(bucketUpdate, update); // Backpointers help us create a linked list (of keys) for those buckets which have collisions (in reverse // order, by offset). At this point, we only need to figure out the highest offset of a Key in each bucket, // which will then become the Bucket's offset. val bucketOffset = bucketUpdate.getBucketOffset(); if (bucketOffset >= 0) { // We have an update. generateBucketUpdate(bucket, bucketOffset, update); } else { // We have a deletion. generateBucketDelete(bucket, update); } }
java
private void generateAttributeUpdates(BucketUpdate bucketUpdate, UpdateInstructions update) { if (!bucketUpdate.hasUpdates()) { // Nothing to do. return; } // Sanity check: If we get an existing bucket (that points to a Table Entry), then it must have at least one existing // key, otherwise (index buckets) must not have any. TableBucket bucket = bucketUpdate.getBucket(); Preconditions.checkArgument(bucket.exists() != bucketUpdate.getExistingKeys().isEmpty(), "Non-existing buckets must have no existing keys, while non-index Buckets must have at least one."); // All Keys in this bucket have the same hash. If there is more than one key per such hash, then we have // a collision, which must be resolved (this also handles removed keys). generateBackpointerUpdates(bucketUpdate, update); // Backpointers help us create a linked list (of keys) for those buckets which have collisions (in reverse // order, by offset). At this point, we only need to figure out the highest offset of a Key in each bucket, // which will then become the Bucket's offset. val bucketOffset = bucketUpdate.getBucketOffset(); if (bucketOffset >= 0) { // We have an update. generateBucketUpdate(bucket, bucketOffset, update); } else { // We have a deletion. generateBucketDelete(bucket, update); } }
[ "private", "void", "generateAttributeUpdates", "(", "BucketUpdate", "bucketUpdate", ",", "UpdateInstructions", "update", ")", "{", "if", "(", "!", "bucketUpdate", ".", "hasUpdates", "(", ")", ")", "{", "// Nothing to do.", "return", ";", "}", "// Sanity check: If we...
Generates the necessary {@link AttributeUpdate}s to index updates to the given {@link BucketUpdate}. Backpointer updates: - Backpointers are used to resolve collisions when we have exhausted the full hash (so we cannot grow the tree anymore). As such, we only calculate backpointers after we group the keys based on their full hashes. - We need to handle overwritten Keys, as well as linking the new Keys. - When an existing Key is overwritten, the Key after it needs to be linked to the Key before it (and its link to the Key before it removed). No other links between existing Keys need to be changed. - New Keys need to be linked between each other, and the first one linked to the last of existing Keys. TableBucket updates: - We need to have the {@link TableBucket} point to the last key in updatedKeys. Backpointers will complete the data structure by providing collision resolution for those remaining cases. @param bucketUpdate The {@link BucketUpdate} to generate updates for. @param update A {@link UpdateInstructions} object to collect updates into.
[ "Generates", "the", "necessary", "{", "@link", "AttributeUpdate", "}", "s", "to", "index", "updates", "to", "the", "given", "{", "@link", "BucketUpdate", "}", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/IndexWriter.java#L159-L186
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/APIClient.java
APIClient.enableRateLimitForward
public void enableRateLimitForward(String adminAPIKey, String endUserIP, String rateLimitAPIKey) { this.forwardAdminAPIKey = adminAPIKey; this.forwardEndUserIP = endUserIP; this.forwardRateLimitAPIKey = rateLimitAPIKey; }
java
public void enableRateLimitForward(String adminAPIKey, String endUserIP, String rateLimitAPIKey) { this.forwardAdminAPIKey = adminAPIKey; this.forwardEndUserIP = endUserIP; this.forwardRateLimitAPIKey = rateLimitAPIKey; }
[ "public", "void", "enableRateLimitForward", "(", "String", "adminAPIKey", ",", "String", "endUserIP", ",", "String", "rateLimitAPIKey", ")", "{", "this", ".", "forwardAdminAPIKey", "=", "adminAPIKey", ";", "this", ".", "forwardEndUserIP", "=", "endUserIP", ";", "t...
Allow to use IP rate limit when you have a proxy between end-user and Algolia. This option will set the X-Forwarded-For HTTP header with the client IP and the X-Forwarded-API-Key with the API Key having rate limits. @param adminAPIKey the admin API Key you can find in your dashboard @param endUserIP the end user IP (you can use both IPV4 or IPV6 syntax) @param rateLimitAPIKey the API key on which you have a rate limit
[ "Allow", "to", "use", "IP", "rate", "limit", "when", "you", "have", "a", "proxy", "between", "end", "-", "user", "and", "Algolia", ".", "This", "option", "will", "set", "the", "X", "-", "Forwarded", "-", "For", "HTTP", "header", "with", "the", "client"...
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/APIClient.java#L237-L241
roboconf/roboconf-platform
core/roboconf-target-docker/src/main/java/net/roboconf/target/docker/internal/DockerUtils.java
DockerUtils.findImageById
public static Image findImageById( String imageId, List<Image> images ) { Image result = null; for( Image img : images ) { if( img.getId().equals(imageId)) { result = img; break; } } return result; }
java
public static Image findImageById( String imageId, List<Image> images ) { Image result = null; for( Image img : images ) { if( img.getId().equals(imageId)) { result = img; break; } } return result; }
[ "public", "static", "Image", "findImageById", "(", "String", "imageId", ",", "List", "<", "Image", ">", "images", ")", "{", "Image", "result", "=", "null", ";", "for", "(", "Image", "img", ":", "images", ")", "{", "if", "(", "img", ".", "getId", "(",...
Finds an image by ID. @param imageId the image ID (not null) @param images a non-null list of images @return an image, or null if none was found
[ "Finds", "an", "image", "by", "ID", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-docker/src/main/java/net/roboconf/target/docker/internal/DockerUtils.java#L141-L152
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/sampling/ReservoirItemsUnion.java
ReservoirItemsUnion.update
public void update(final long n, final int k, final ArrayList<T> input) { ReservoirItemsSketch<T> ris = ReservoirItemsSketch.newInstance(input, n, ResizeFactor.X8, k); // forcing a resize factor ris = (ris.getK() <= maxK_ ? ris : ris.downsampledCopy(maxK_)); if (gadget_ == null) { createNewGadget(ris, true); } else { twoWayMergeInternal(ris, true); } }
java
public void update(final long n, final int k, final ArrayList<T> input) { ReservoirItemsSketch<T> ris = ReservoirItemsSketch.newInstance(input, n, ResizeFactor.X8, k); // forcing a resize factor ris = (ris.getK() <= maxK_ ? ris : ris.downsampledCopy(maxK_)); if (gadget_ == null) { createNewGadget(ris, true); } else { twoWayMergeInternal(ris, true); } }
[ "public", "void", "update", "(", "final", "long", "n", ",", "final", "int", "k", ",", "final", "ArrayList", "<", "T", ">", "input", ")", "{", "ReservoirItemsSketch", "<", "T", ">", "ris", "=", "ReservoirItemsSketch", ".", "newInstance", "(", "input", ","...
Present this union with raw elements of a sketch. Useful when operating in a distributed environment like Pig Latin scripts, where an explicit SerDe may be overly complicated but keeping raw values is simple. Values are <em>not</em> copied and the input array may be modified. @param n Total items seen @param k Reservoir size @param input Reservoir samples
[ "Present", "this", "union", "with", "raw", "elements", "of", "a", "sketch", ".", "Useful", "when", "operating", "in", "a", "distributed", "environment", "like", "Pig", "Latin", "scripts", "where", "an", "explicit", "SerDe", "may", "be", "overly", "complicated"...
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/ReservoirItemsUnion.java#L201-L211
spring-cloud/spring-cloud-contract
spring-cloud-contract-spec/src/main/groovy/repackaged/nl/flotsam/xeger/Xeger.java
Xeger.getRandomInt
static int getRandomInt(int min, int max, Random random) { // Use random.nextInt as it guarantees a uniform distribution int maxForRandom = max - min + 1; return random.nextInt(maxForRandom) + min; }
java
static int getRandomInt(int min, int max, Random random) { // Use random.nextInt as it guarantees a uniform distribution int maxForRandom = max - min + 1; return random.nextInt(maxForRandom) + min; }
[ "static", "int", "getRandomInt", "(", "int", "min", ",", "int", "max", ",", "Random", "random", ")", "{", "// Use random.nextInt as it guarantees a uniform distribution", "int", "maxForRandom", "=", "max", "-", "min", "+", "1", ";", "return", "random", ".", "nex...
Generates a random number within the given bounds. @param min The minimum number (inclusive). @param max The maximum number (inclusive). @param random The object used as the randomizer. @return A random number in the given range.
[ "Generates", "a", "random", "number", "within", "the", "given", "bounds", "." ]
train
https://github.com/spring-cloud/spring-cloud-contract/blob/857da51950a87b393286e3bb1b2208c420c01087/spring-cloud-contract-spec/src/main/groovy/repackaged/nl/flotsam/xeger/Xeger.java#L94-L98
xdcrafts/flower
flower-tools/src/main/java/com/github/xdcrafts/flower/tools/ListApi.java
ListApi.getNullable
public static Object getNullable(final List list, final Integer... path) { return getNullable(list, Object.class, path); }
java
public static Object getNullable(final List list, final Integer... path) { return getNullable(list, Object.class, path); }
[ "public", "static", "Object", "getNullable", "(", "final", "List", "list", ",", "final", "Integer", "...", "path", ")", "{", "return", "getNullable", "(", "list", ",", "Object", ".", "class", ",", "path", ")", ";", "}" ]
Get object value by path. @param list subject @param path nodes to walk in map @return value
[ "Get", "object", "value", "by", "path", "." ]
train
https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/ListApi.java#L140-L142
beangle/beangle3
ioc/spring/src/main/java/org/beangle/inject/spring/config/BeanDefinitionParser.java
BeanDefinitionParser.parsePropertyElement
public void parsePropertyElement(Element ele, BeanDefinition bd) { String propertyName = ele.getAttribute(NAME_ATTRIBUTE); if (!StringUtils.hasLength(propertyName)) { error("Tag 'property' must have a 'name' attribute", ele); return; } this.parseState.push(new PropertyEntry(propertyName)); try { if (bd.getPropertyValues().contains(propertyName)) { error("Multiple 'property' definitions for property '" + propertyName + "'", ele); return; } Object val = parsePropertyValue(ele, bd, propertyName); PropertyValue pv = new PropertyValue(propertyName, val); parseMetaElements(ele, pv); pv.setSource(extractSource(ele)); bd.getPropertyValues().addPropertyValue(pv); } finally { this.parseState.pop(); } }
java
public void parsePropertyElement(Element ele, BeanDefinition bd) { String propertyName = ele.getAttribute(NAME_ATTRIBUTE); if (!StringUtils.hasLength(propertyName)) { error("Tag 'property' must have a 'name' attribute", ele); return; } this.parseState.push(new PropertyEntry(propertyName)); try { if (bd.getPropertyValues().contains(propertyName)) { error("Multiple 'property' definitions for property '" + propertyName + "'", ele); return; } Object val = parsePropertyValue(ele, bd, propertyName); PropertyValue pv = new PropertyValue(propertyName, val); parseMetaElements(ele, pv); pv.setSource(extractSource(ele)); bd.getPropertyValues().addPropertyValue(pv); } finally { this.parseState.pop(); } }
[ "public", "void", "parsePropertyElement", "(", "Element", "ele", ",", "BeanDefinition", "bd", ")", "{", "String", "propertyName", "=", "ele", ".", "getAttribute", "(", "NAME_ATTRIBUTE", ")", ";", "if", "(", "!", "StringUtils", ".", "hasLength", "(", "propertyN...
Parse a property element. @param ele a {@link org.w3c.dom.Element} object. @param bd a {@link org.springframework.beans.factory.config.BeanDefinition} object.
[ "Parse", "a", "property", "element", "." ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/ioc/spring/src/main/java/org/beangle/inject/spring/config/BeanDefinitionParser.java#L520-L540
undera/jmeter-plugins
plugins/functions/src/main/java/kg/apc/jmeter/functions/CaseFormat.java
CaseFormat.camelFormat
private static String camelFormat(String str, boolean isFirstCapitalized) { StringBuilder builder = new StringBuilder(str.length()); String[] tokens = NOT_ALPHANUMERIC_REGEX.split(str); for (int i = 0; i < tokens.length; i++) { String lowerCased = StringUtils.lowerCase(tokens[i]); if (i == 0) { builder.append(isFirstCapitalized ? StringUtils.capitalize(lowerCased) : lowerCased); } else { builder.append(StringUtils.capitalize(lowerCased)); } } return builder.toString(); }
java
private static String camelFormat(String str, boolean isFirstCapitalized) { StringBuilder builder = new StringBuilder(str.length()); String[] tokens = NOT_ALPHANUMERIC_REGEX.split(str); for (int i = 0; i < tokens.length; i++) { String lowerCased = StringUtils.lowerCase(tokens[i]); if (i == 0) { builder.append(isFirstCapitalized ? StringUtils.capitalize(lowerCased) : lowerCased); } else { builder.append(StringUtils.capitalize(lowerCased)); } } return builder.toString(); }
[ "private", "static", "String", "camelFormat", "(", "String", "str", ",", "boolean", "isFirstCapitalized", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", "str", ".", "length", "(", ")", ")", ";", "String", "[", "]", "tokens", "=", "...
Camel format string @param str @param isFirstCapitalized @return String in camelFormat
[ "Camel", "format", "string" ]
train
https://github.com/undera/jmeter-plugins/blob/416d2a77249ab921c7e4134c3e6a9639901ef7e8/plugins/functions/src/main/java/kg/apc/jmeter/functions/CaseFormat.java#L155-L167
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/HeapCache.java
HeapCache.insertOrUpdateAndCalculateExpiry
protected final void insertOrUpdateAndCalculateExpiry(Entry<K, V> e, V v, long t0, long t, final long _refreshTime, byte _updateStatistics) { long _nextRefreshTime; try { _nextRefreshTime = timing.calculateNextRefreshTime(e, v, _refreshTime); } catch (Exception ex) { RuntimeException _wrappedException = new ExpiryPolicyException(ex); if (_updateStatistics == INSERT_STAT_LOAD) { loadGotException(e, t0, t, _wrappedException); return; } insertUpdateStats(e, v, t0, t, _updateStatistics, Long.MAX_VALUE, false); throw _wrappedException; } insert(e, v, t0, t, _refreshTime, _updateStatistics, _nextRefreshTime); }
java
protected final void insertOrUpdateAndCalculateExpiry(Entry<K, V> e, V v, long t0, long t, final long _refreshTime, byte _updateStatistics) { long _nextRefreshTime; try { _nextRefreshTime = timing.calculateNextRefreshTime(e, v, _refreshTime); } catch (Exception ex) { RuntimeException _wrappedException = new ExpiryPolicyException(ex); if (_updateStatistics == INSERT_STAT_LOAD) { loadGotException(e, t0, t, _wrappedException); return; } insertUpdateStats(e, v, t0, t, _updateStatistics, Long.MAX_VALUE, false); throw _wrappedException; } insert(e, v, t0, t, _refreshTime, _updateStatistics, _nextRefreshTime); }
[ "protected", "final", "void", "insertOrUpdateAndCalculateExpiry", "(", "Entry", "<", "K", ",", "V", ">", "e", ",", "V", "v", ",", "long", "t0", ",", "long", "t", ",", "final", "long", "_refreshTime", ",", "byte", "_updateStatistics", ")", "{", "long", "_...
Calculate the next refresh time if a timer / expiry is needed and call insert.
[ "Calculate", "the", "next", "refresh", "time", "if", "a", "timer", "/", "expiry", "is", "needed", "and", "call", "insert", "." ]
train
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/HeapCache.java#L1459-L1473
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java
SARLQuickfixProvider.fixDuplicateMethod
@Fix(IssueCodes.DUPLICATE_METHOD) public void fixDuplicateMethod(Issue issue, IssueResolutionAcceptor acceptor) { MemberRemoveModification.accept(this, issue, acceptor); }
java
@Fix(IssueCodes.DUPLICATE_METHOD) public void fixDuplicateMethod(Issue issue, IssueResolutionAcceptor acceptor) { MemberRemoveModification.accept(this, issue, acceptor); }
[ "@", "Fix", "(", "IssueCodes", ".", "DUPLICATE_METHOD", ")", "public", "void", "fixDuplicateMethod", "(", "Issue", "issue", ",", "IssueResolutionAcceptor", "acceptor", ")", "{", "MemberRemoveModification", ".", "accept", "(", "this", ",", "issue", ",", "acceptor",...
Quick fix for "Duplicate method". @param issue the issue. @param acceptor the quick fix acceptor.
[ "Quick", "fix", "for", "Duplicate", "method", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L687-L690
spotify/async-google-pubsub-client
src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java
Pubsub.createSubscription
public PubsubFuture<Subscription> createSubscription(final String canonicalSubscriptionName, final String canonicalTopic) { return createSubscription(Subscription.of(canonicalSubscriptionName, canonicalTopic)); }
java
public PubsubFuture<Subscription> createSubscription(final String canonicalSubscriptionName, final String canonicalTopic) { return createSubscription(Subscription.of(canonicalSubscriptionName, canonicalTopic)); }
[ "public", "PubsubFuture", "<", "Subscription", ">", "createSubscription", "(", "final", "String", "canonicalSubscriptionName", ",", "final", "String", "canonicalTopic", ")", "{", "return", "createSubscription", "(", "Subscription", ".", "of", "(", "canonicalSubscription...
Create a Pub/Sub subscription. @param canonicalSubscriptionName The canonical (including project) name of the scubscription to create. @param canonicalTopic The canonical (including project) name of the topic to subscribe to. @return A future that is completed when this request is completed.
[ "Create", "a", "Pub", "/", "Sub", "subscription", "." ]
train
https://github.com/spotify/async-google-pubsub-client/blob/7d021528fa5bc29be458e6f210fa62f59b71d004/src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java#L395-L398
spring-projects/spring-shell
spring-shell-core/src/main/java/org/springframework/shell/Utils.java
Utils.createMethodParameter
public static MethodParameter createMethodParameter(Executable executable, int i) { MethodParameter methodParameter; if (executable instanceof Method) { methodParameter = new MethodParameter((Method) executable, i); } else if (executable instanceof Constructor){ methodParameter = new MethodParameter((Constructor) executable, i); } else { throw new IllegalArgumentException("Unsupported Executable: " + executable); } methodParameter.initParameterNameDiscovery(new DefaultParameterNameDiscoverer()); return methodParameter; }
java
public static MethodParameter createMethodParameter(Executable executable, int i) { MethodParameter methodParameter; if (executable instanceof Method) { methodParameter = new MethodParameter((Method) executable, i); } else if (executable instanceof Constructor){ methodParameter = new MethodParameter((Constructor) executable, i); } else { throw new IllegalArgumentException("Unsupported Executable: " + executable); } methodParameter.initParameterNameDiscovery(new DefaultParameterNameDiscoverer()); return methodParameter; }
[ "public", "static", "MethodParameter", "createMethodParameter", "(", "Executable", "executable", ",", "int", "i", ")", "{", "MethodParameter", "methodParameter", ";", "if", "(", "executable", "instanceof", "Method", ")", "{", "methodParameter", "=", "new", "MethodPa...
Return a properly initialized MethodParameter for the given executable and index.
[ "Return", "a", "properly", "initialized", "MethodParameter", "for", "the", "given", "executable", "and", "index", "." ]
train
https://github.com/spring-projects/spring-shell/blob/23d99f45eb8f487e31a1f080c837061313bbfafa/spring-shell-core/src/main/java/org/springframework/shell/Utils.java#L68-L79
OpenLiberty/open-liberty
dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java
InjectionBinding.addOrRemoveProperty
protected static <K, V> void addOrRemoveProperty(Map<K, V> props, K key, V value) { if (value == null) { // Generic properties have already been added to the map. Remove them // so they aren't confused with the builtin properties. props.remove(key); } else { props.put(key, value); } }
java
protected static <K, V> void addOrRemoveProperty(Map<K, V> props, K key, V value) { if (value == null) { // Generic properties have already been added to the map. Remove them // so they aren't confused with the builtin properties. props.remove(key); } else { props.put(key, value); } }
[ "protected", "static", "<", "K", ",", "V", ">", "void", "addOrRemoveProperty", "(", "Map", "<", "K", ",", "V", ">", "props", ",", "K", "key", ",", "V", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "// Generic properties have already b...
Add the specified property if the value is non-null, or remove it from the map if it is null. @param props the properties to update @param key the key @param value the value
[ "Add", "the", "specified", "property", "if", "the", "value", "is", "non", "-", "null", "or", "remove", "it", "from", "the", "map", "if", "it", "is", "null", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java#L1203-L1212