repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/QueryRecord.java | QueryRecord.setGridFile | public int setGridFile(Record record, String keyAreaName)
{
KeyArea recordKeyArea = record.getKeyArea(keyAreaName);
KeyArea newKeyArea = this.makeIndex(recordKeyArea.getUniqueKeyCode(), recordKeyArea.getKeyName());
for (int iKeyField = 0; iKeyField < recordKeyArea.getKeyFields(); iKeyField++)
{
BaseField field = recordKeyArea.getField(iKeyField);
boolean bOrder = recordKeyArea.getKeyOrder(iKeyField);
newKeyArea.addKeyField(field, bOrder);
}
return this.getKeyAreaCount() - 1; // Index of new key area
} | java | public int setGridFile(Record record, String keyAreaName)
{
KeyArea recordKeyArea = record.getKeyArea(keyAreaName);
KeyArea newKeyArea = this.makeIndex(recordKeyArea.getUniqueKeyCode(), recordKeyArea.getKeyName());
for (int iKeyField = 0; iKeyField < recordKeyArea.getKeyFields(); iKeyField++)
{
BaseField field = recordKeyArea.getField(iKeyField);
boolean bOrder = recordKeyArea.getKeyOrder(iKeyField);
newKeyArea.addKeyField(field, bOrder);
}
return this.getKeyAreaCount() - 1; // Index of new key area
} | [
"public",
"int",
"setGridFile",
"(",
"Record",
"record",
",",
"String",
"keyAreaName",
")",
"{",
"KeyArea",
"recordKeyArea",
"=",
"record",
".",
"getKeyArea",
"(",
"keyAreaName",
")",
";",
"KeyArea",
"newKeyArea",
"=",
"this",
".",
"makeIndex",
"(",
"recordKey... | Mark the main grid file and key order.<p>
Included as a utility for backward compatibility (Use SetupKeys now).
Basically, this method clones the key area for this record.
@param record The record in my list to get the key area from.
@param iKeyNo The key area in the record to retrieve.
@param The index of this key area. | [
"Mark",
"the",
"main",
"grid",
"file",
"and",
"key",
"order",
".",
"<p",
">",
"Included",
"as",
"a",
"utility",
"for",
"backward",
"compatibility",
"(",
"Use",
"SetupKeys",
"now",
")",
".",
"Basically",
"this",
"method",
"clones",
"the",
"key",
"area",
"... | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/QueryRecord.java#L534-L545 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/LocaleUtils.java | LocaleUtils.parseLocale | private static Locale parseLocale(final String str) {
if (isISO639LanguageCode(str)) {
return new Locale(str);
}
final String[] segments = str.split("_", -1);
final String language = segments[0];
if (segments.length == 2) {
final String country = segments[1];
if (isISO639LanguageCode(language) && isISO3166CountryCode(country) ||
isNumericAreaCode(country)) {
return new Locale(language, country);
}
} else if (segments.length == 3) {
final String country = segments[1];
final String variant = segments[2];
if (isISO639LanguageCode(language) &&
(country.length() == 0 || isISO3166CountryCode(country) || isNumericAreaCode(country)) &&
variant.length() > 0) {
return new Locale(language, country, variant);
}
}
throw new IllegalArgumentException("Invalid locale format: " + str);
} | java | private static Locale parseLocale(final String str) {
if (isISO639LanguageCode(str)) {
return new Locale(str);
}
final String[] segments = str.split("_", -1);
final String language = segments[0];
if (segments.length == 2) {
final String country = segments[1];
if (isISO639LanguageCode(language) && isISO3166CountryCode(country) ||
isNumericAreaCode(country)) {
return new Locale(language, country);
}
} else if (segments.length == 3) {
final String country = segments[1];
final String variant = segments[2];
if (isISO639LanguageCode(language) &&
(country.length() == 0 || isISO3166CountryCode(country) || isNumericAreaCode(country)) &&
variant.length() > 0) {
return new Locale(language, country, variant);
}
}
throw new IllegalArgumentException("Invalid locale format: " + str);
} | [
"private",
"static",
"Locale",
"parseLocale",
"(",
"final",
"String",
"str",
")",
"{",
"if",
"(",
"isISO639LanguageCode",
"(",
"str",
")",
")",
"{",
"return",
"new",
"Locale",
"(",
"str",
")",
";",
"}",
"final",
"String",
"[",
"]",
"segments",
"=",
"st... | Tries to parse a locale from the given String.
@param str the String to parse a locale from.
@return a Locale instance parsed from the given String.
@throws IllegalArgumentException if the given String can not be parsed. | [
"Tries",
"to",
"parse",
"a",
"locale",
"from",
"the",
"given",
"String",
"."
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/LocaleUtils.java#L139-L162 |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/helpers/DateHelper.java | DateHelper.getUTCMilliseconds | public static long getUTCMilliseconds(@NonNull final String dateStr) {
if (!TextUtils.isEmpty(dateStr)) {
DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.ENGLISH);
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
Date date = null;
try {
date = sdf.parse(dateStr);
} catch (ParseException e) {
e.printStackTrace();
}
if (date != null) {
return date.getTime();
}
}
return -1;
} | java | public static long getUTCMilliseconds(@NonNull final String dateStr) {
if (!TextUtils.isEmpty(dateStr)) {
DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.ENGLISH);
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
Date date = null;
try {
date = sdf.parse(dateStr);
} catch (ParseException e) {
e.printStackTrace();
}
if (date != null) {
return date.getTime();
}
}
return -1;
} | [
"public",
"static",
"long",
"getUTCMilliseconds",
"(",
"@",
"NonNull",
"final",
"String",
"dateStr",
")",
"{",
"if",
"(",
"!",
"TextUtils",
".",
"isEmpty",
"(",
"dateStr",
")",
")",
"{",
"DateFormat",
"sdf",
"=",
"new",
"SimpleDateFormat",
"(",
"\"yyyy-MM-dd... | Gets the UTC time in milliseconds from 'yyyy-MM-dd'T'HH:mm:ss.SSS'Z'' formatted date string.
@param dateStr 'yyyy-MM-dd'T'HH:mm:ss.SSSz' formatted date string.
@return UTC time in milliseconds. | [
"Gets",
"the",
"UTC",
"time",
"in",
"milliseconds",
"from",
"yyyy",
"-",
"MM",
"-",
"dd",
"T",
"HH",
":",
"mm",
":",
"ss",
".",
"SSS",
"Z",
"formatted",
"date",
"string",
"."
] | train | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/helpers/DateHelper.java#L59-L78 |
apereo/cas | core/cas-server-core-configuration-metadata-repository/src/main/java/org/springframework/boot/configurationmetadata/CasConfigurationMetadataRepositoryJsonBuilder.java | CasConfigurationMetadataRepositoryJsonBuilder.withJsonResource | public CasConfigurationMetadataRepositoryJsonBuilder withJsonResource(final InputStream inputStream, final Charset charset) {
if (inputStream == null) {
throw new IllegalArgumentException("InputStream must not be null.");
}
this.repositories.add(add(inputStream, charset));
return this;
} | java | public CasConfigurationMetadataRepositoryJsonBuilder withJsonResource(final InputStream inputStream, final Charset charset) {
if (inputStream == null) {
throw new IllegalArgumentException("InputStream must not be null.");
}
this.repositories.add(add(inputStream, charset));
return this;
} | [
"public",
"CasConfigurationMetadataRepositoryJsonBuilder",
"withJsonResource",
"(",
"final",
"InputStream",
"inputStream",
",",
"final",
"Charset",
"charset",
")",
"{",
"if",
"(",
"inputStream",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
... | Add the content of a {@link ConfigurationMetadataRepository} defined by the
specified {@link InputStream} json document using the specified {@link Charset}. If
this metadata repository holds items that were loaded previously, these are
ignored.
<p>
Leaves the stream open when done.
@param inputStream the source input stream
@param charset the charset of the input
@return this builder | [
"Add",
"the",
"content",
"of",
"a",
"{",
"@link",
"ConfigurationMetadataRepository",
"}",
"defined",
"by",
"the",
"specified",
"{",
"@link",
"InputStream",
"}",
"json",
"document",
"using",
"the",
"specified",
"{",
"@link",
"Charset",
"}",
".",
"If",
"this",
... | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-configuration-metadata-repository/src/main/java/org/springframework/boot/configurationmetadata/CasConfigurationMetadataRepositoryJsonBuilder.java#L58-L64 |
google/closure-templates | java/src/com/google/template/soy/jbcsrc/internal/InnerClasses.java | InnerClasses.registerInnerClassWithGeneratedName | public TypeInfo registerInnerClassWithGeneratedName(String simpleName, int accessModifiers) {
simpleName = classNames.generateName(simpleName);
TypeInfo innerClass = outer.innerClass(simpleName);
innerClassesAccessModifiers.put(innerClass, accessModifiers);
return innerClass;
} | java | public TypeInfo registerInnerClassWithGeneratedName(String simpleName, int accessModifiers) {
simpleName = classNames.generateName(simpleName);
TypeInfo innerClass = outer.innerClass(simpleName);
innerClassesAccessModifiers.put(innerClass, accessModifiers);
return innerClass;
} | [
"public",
"TypeInfo",
"registerInnerClassWithGeneratedName",
"(",
"String",
"simpleName",
",",
"int",
"accessModifiers",
")",
"{",
"simpleName",
"=",
"classNames",
".",
"generateName",
"(",
"simpleName",
")",
";",
"TypeInfo",
"innerClass",
"=",
"outer",
".",
"innerC... | Register the name (or a simpl mangling of it) as an inner class with the given access
modifiers.
@return A {@link TypeInfo} with the full (possibly mangled) class name | [
"Register",
"the",
"name",
"(",
"or",
"a",
"simpl",
"mangling",
"of",
"it",
")",
"as",
"an",
"inner",
"class",
"with",
"the",
"given",
"access",
"modifiers",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/internal/InnerClasses.java#L64-L69 |
apereo/cas | support/cas-server-support-token-tickets/src/main/java/org/apereo/cas/token/authentication/principal/TokenWebApplicationServiceResponseBuilder.java | TokenWebApplicationServiceResponseBuilder.generateToken | @SneakyThrows
protected String generateToken(final Service service, final Map<String, String> parameters) {
val ticketId = parameters.get(CasProtocolConstants.PARAMETER_TICKET);
return this.tokenTicketBuilder.build(ticketId, service);
} | java | @SneakyThrows
protected String generateToken(final Service service, final Map<String, String> parameters) {
val ticketId = parameters.get(CasProtocolConstants.PARAMETER_TICKET);
return this.tokenTicketBuilder.build(ticketId, service);
} | [
"@",
"SneakyThrows",
"protected",
"String",
"generateToken",
"(",
"final",
"Service",
"service",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"{",
"val",
"ticketId",
"=",
"parameters",
".",
"get",
"(",
"CasProtocolConstants",
".",... | Generate token string.
@param service the service
@param parameters the parameters
@return the jwt | [
"Generate",
"token",
"string",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-token-tickets/src/main/java/org/apereo/cas/token/authentication/principal/TokenWebApplicationServiceResponseBuilder.java#L69-L73 |
facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/NodeManager.java | NodeManager.deleteAppFromNode | public Set<ClusterNode.GrantId> deleteAppFromNode(
String nodeName, ResourceType type) {
ClusterNode node = nameToNode.get(nodeName);
if (node == null) {
LOG.warn("Trying to delete type " + type +
" from non-existent node: " + nodeName);
return null;
}
return deleteAppFromNode(node, type);
} | java | public Set<ClusterNode.GrantId> deleteAppFromNode(
String nodeName, ResourceType type) {
ClusterNode node = nameToNode.get(nodeName);
if (node == null) {
LOG.warn("Trying to delete type " + type +
" from non-existent node: " + nodeName);
return null;
}
return deleteAppFromNode(node, type);
} | [
"public",
"Set",
"<",
"ClusterNode",
".",
"GrantId",
">",
"deleteAppFromNode",
"(",
"String",
"nodeName",
",",
"ResourceType",
"type",
")",
"{",
"ClusterNode",
"node",
"=",
"nameToNode",
".",
"get",
"(",
"nodeName",
")",
";",
"if",
"(",
"node",
"==",
"null... | Remove one application type from the node. Happens when the daemon
responsible for handling this application type on the node goes down
@param nodeName the name of the node
@param type the type of the resource
@return the list of grants that belonged to the application on this node | [
"Remove",
"one",
"application",
"type",
"from",
"the",
"node",
".",
"Happens",
"when",
"the",
"daemon",
"responsible",
"for",
"handling",
"this",
"application",
"type",
"on",
"the",
"node",
"goes",
"down"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/NodeManager.java#L787-L796 |
kite-sdk/kite | kite-data/kite-data-hive/src/main/java/org/kitesdk/data/spi/hive/HiveAbstractMetadataProvider.java | HiveAbstractMetadataProvider.isExternal | protected boolean isExternal(String namespace, String name) {
String resolved = resolveNamespace(namespace, name);
if (resolved != null) {
return isExternal(getMetaStoreUtil().getTable(resolved, name));
}
return false;
} | java | protected boolean isExternal(String namespace, String name) {
String resolved = resolveNamespace(namespace, name);
if (resolved != null) {
return isExternal(getMetaStoreUtil().getTable(resolved, name));
}
return false;
} | [
"protected",
"boolean",
"isExternal",
"(",
"String",
"namespace",
",",
"String",
"name",
")",
"{",
"String",
"resolved",
"=",
"resolveNamespace",
"(",
"namespace",
",",
"name",
")",
";",
"if",
"(",
"resolved",
"!=",
"null",
")",
"{",
"return",
"isExternal",
... | Returns whether the table is a managed hive table.
@param name a Table name
@return true if the table is managed, false otherwise
@throws DatasetNotFoundException If the table does not exist in Hive | [
"Returns",
"whether",
"the",
"table",
"is",
"a",
"managed",
"hive",
"table",
"."
] | train | https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-hive/src/main/java/org/kitesdk/data/spi/hive/HiveAbstractMetadataProvider.java#L90-L96 |
BlueBrain/bluima | modules/bluima_typesystem/src/main/java/ch/epfl/bbp/uima/types/TopicDistribution.java | TopicDistribution.setProbability | public void setProbability(int i, double v) {
if (TopicDistribution_Type.featOkTst && ((TopicDistribution_Type)jcasType).casFeat_probability == null)
jcasType.jcas.throwFeatMissing("probability", "ch.epfl.bbp.uima.types.TopicDistribution");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((TopicDistribution_Type)jcasType).casFeatCode_probability), i);
jcasType.ll_cas.ll_setDoubleArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((TopicDistribution_Type)jcasType).casFeatCode_probability), i, v);} | java | public void setProbability(int i, double v) {
if (TopicDistribution_Type.featOkTst && ((TopicDistribution_Type)jcasType).casFeat_probability == null)
jcasType.jcas.throwFeatMissing("probability", "ch.epfl.bbp.uima.types.TopicDistribution");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((TopicDistribution_Type)jcasType).casFeatCode_probability), i);
jcasType.ll_cas.ll_setDoubleArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((TopicDistribution_Type)jcasType).casFeatCode_probability), i, v);} | [
"public",
"void",
"setProbability",
"(",
"int",
"i",
",",
"double",
"v",
")",
"{",
"if",
"(",
"TopicDistribution_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"TopicDistribution_Type",
")",
"jcasType",
")",
".",
"casFeat_probability",
"==",
"null",
")",
"jcasType",... | indexed setter for probability - sets an indexed value -
@generated
@param i index in the array to set
@param v value to set into the array | [
"indexed",
"setter",
"for",
"probability",
"-",
"sets",
"an",
"indexed",
"value",
"-"
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/ch/epfl/bbp/uima/types/TopicDistribution.java#L117-L121 |
jenkinsci/ssh-slaves-plugin | src/main/java/hudson/plugins/sshslaves/verifiers/HostKeyHelper.java | HostKeyHelper.saveHostKey | public void saveHostKey(Computer host, HostKey hostKey) throws IOException {
XmlFile xmlHostKeyFile = new XmlFile(getSshHostKeyFile(host.getNode()));
xmlHostKeyFile.write(hostKey);
cache.put(host, hostKey);
} | java | public void saveHostKey(Computer host, HostKey hostKey) throws IOException {
XmlFile xmlHostKeyFile = new XmlFile(getSshHostKeyFile(host.getNode()));
xmlHostKeyFile.write(hostKey);
cache.put(host, hostKey);
} | [
"public",
"void",
"saveHostKey",
"(",
"Computer",
"host",
",",
"HostKey",
"hostKey",
")",
"throws",
"IOException",
"{",
"XmlFile",
"xmlHostKeyFile",
"=",
"new",
"XmlFile",
"(",
"getSshHostKeyFile",
"(",
"host",
".",
"getNode",
"(",
")",
")",
")",
";",
"xmlHo... | Persists an SSH key to disk for the requested host. This effectively marks
the requested key as trusted for all future connections to the host, until
any future save attempt replaces this key.
@param host the host the key is being saved for
@param hostKey the key to be saved as the trusted key for this host
@throws IOException on failure saving the key for the host | [
"Persists",
"an",
"SSH",
"key",
"to",
"disk",
"for",
"the",
"requested",
"host",
".",
"This",
"effectively",
"marks",
"the",
"requested",
"key",
"as",
"trusted",
"for",
"all",
"future",
"connections",
"to",
"the",
"host",
"until",
"any",
"future",
"save",
... | train | https://github.com/jenkinsci/ssh-slaves-plugin/blob/95f528730fc1e01b25983459927b7516ead3ee00/src/main/java/hudson/plugins/sshslaves/verifiers/HostKeyHelper.java#L90-L94 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java | PageFlowUtils.getFormBeanName | public static String getFormBeanName( Class formBeanClass, HttpServletRequest request )
{
ModuleConfig moduleConfig = RequestUtils.getRequestModuleConfig( request );
List/*< String >*/ names = getFormNamesFromModuleConfig( formBeanClass.getName(), moduleConfig );
if ( names != null )
{
assert names.size() > 0; // getFormNamesFromModuleConfig returns null or a nonempty list
return ( String ) names.get( 0 );
}
return generateFormBeanName( formBeanClass, request );
} | java | public static String getFormBeanName( Class formBeanClass, HttpServletRequest request )
{
ModuleConfig moduleConfig = RequestUtils.getRequestModuleConfig( request );
List/*< String >*/ names = getFormNamesFromModuleConfig( formBeanClass.getName(), moduleConfig );
if ( names != null )
{
assert names.size() > 0; // getFormNamesFromModuleConfig returns null or a nonempty list
return ( String ) names.get( 0 );
}
return generateFormBeanName( formBeanClass, request );
} | [
"public",
"static",
"String",
"getFormBeanName",
"(",
"Class",
"formBeanClass",
",",
"HttpServletRequest",
"request",
")",
"{",
"ModuleConfig",
"moduleConfig",
"=",
"RequestUtils",
".",
"getRequestModuleConfig",
"(",
"request",
")",
";",
"List",
"/*< String >*/",
"nam... | Get the name for an ActionForm type. Use a name looked up from the current Struts module, or,
if none is found, create one.
@param formBeanClass the ActionForm-derived class whose type will determine the name.
@param request the current HttpServletRequest, which contains a reference to the current Struts module.
@return the name found in the Struts module, or, if none is found, a name that is either:
<ul>
<li>a camel-cased version of the base class name (minus any package or outer-class
qualifiers, or, if that name is already taken,</li>
<li>the full class name, with '.' and '$' replaced by '_'.</li>
</ul> | [
"Get",
"the",
"name",
"for",
"an",
"ActionForm",
"type",
".",
"Use",
"a",
"name",
"looked",
"up",
"from",
"the",
"current",
"Struts",
"module",
"or",
"if",
"none",
"is",
"found",
"create",
"one",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L733-L745 |
jenkinsci/jenkins | core/src/main/java/hudson/Util.java | Util.deleteRecursive | @Restricted(NoExternalUse.class)
public static void deleteRecursive(@Nonnull Path dir, @Nonnull PathRemover.PathChecker pathChecker) throws IOException {
newPathRemover(pathChecker).forceRemoveRecursive(dir);
} | java | @Restricted(NoExternalUse.class)
public static void deleteRecursive(@Nonnull Path dir, @Nonnull PathRemover.PathChecker pathChecker) throws IOException {
newPathRemover(pathChecker).forceRemoveRecursive(dir);
} | [
"@",
"Restricted",
"(",
"NoExternalUse",
".",
"class",
")",
"public",
"static",
"void",
"deleteRecursive",
"(",
"@",
"Nonnull",
"Path",
"dir",
",",
"@",
"Nonnull",
"PathRemover",
".",
"PathChecker",
"pathChecker",
")",
"throws",
"IOException",
"{",
"newPathRemov... | Deletes the given directory and contents recursively using a filter.
@param dir a directory to delete
@param pathChecker a security check to validate a path before deleting
@throws IOException if the operation fails | [
"Deletes",
"the",
"given",
"directory",
"and",
"contents",
"recursively",
"using",
"a",
"filter",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/Util.java#L291-L294 |
bazaarvoice/emodb | sor/src/main/java/com/bazaarvoice/emodb/sor/db/astyanax/SplitFormat.java | SplitFormat.decode | static ByteBufferRange decode(String string) {
int prefix = string.indexOf(':');
int sep = string.indexOf('-', prefix + 1);
checkArgument(prefix >= 0 && sep >= 0, "Invalid split string: %s", string);
char[] start = new char[prefix + sep - (prefix + 1)];
string.getChars(0, prefix, start, 0);
string.getChars(prefix + 1, sep, start, prefix);
char[] end = new char[prefix + string.length() - (sep + 1)];
string.getChars(0, prefix, end, 0);
string.getChars(sep + 1, string.length(), end, prefix);
byte[] startBytes, endBytes;
try {
startBytes = Hex.decodeHex(start);
endBytes = Hex.decodeHex(end);
} catch (DecoderException e) {
throw new IllegalArgumentException(format("Invalid split string: %s", string));
}
return new ByteBufferRangeImpl(ByteBuffer.wrap(startBytes), ByteBuffer.wrap(endBytes), -1, false);
} | java | static ByteBufferRange decode(String string) {
int prefix = string.indexOf(':');
int sep = string.indexOf('-', prefix + 1);
checkArgument(prefix >= 0 && sep >= 0, "Invalid split string: %s", string);
char[] start = new char[prefix + sep - (prefix + 1)];
string.getChars(0, prefix, start, 0);
string.getChars(prefix + 1, sep, start, prefix);
char[] end = new char[prefix + string.length() - (sep + 1)];
string.getChars(0, prefix, end, 0);
string.getChars(sep + 1, string.length(), end, prefix);
byte[] startBytes, endBytes;
try {
startBytes = Hex.decodeHex(start);
endBytes = Hex.decodeHex(end);
} catch (DecoderException e) {
throw new IllegalArgumentException(format("Invalid split string: %s", string));
}
return new ByteBufferRangeImpl(ByteBuffer.wrap(startBytes), ByteBuffer.wrap(endBytes), -1, false);
} | [
"static",
"ByteBufferRange",
"decode",
"(",
"String",
"string",
")",
"{",
"int",
"prefix",
"=",
"string",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"int",
"sep",
"=",
"string",
".",
"indexOf",
"(",
"'",
"'",
",",
"prefix",
"+",
"1",
")",
";",
"check... | Parses a hex string that looks like "commonPrefix:startSuffix-endSuffix". | [
"Parses",
"a",
"hex",
"string",
"that",
"looks",
"like",
"commonPrefix",
":",
"startSuffix",
"-",
"endSuffix",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/sor/src/main/java/com/bazaarvoice/emodb/sor/db/astyanax/SplitFormat.java#L31-L53 |
beanshell/beanshell | src/main/java/bsh/Types.java | Types.isJavaBoxTypesAssignable | static boolean isJavaBoxTypesAssignable(
Class lhsType, Class rhsType )
{
// Assignment to loose type... defer to bsh extensions
if ( lhsType == null )
return false;
// prim can be boxed and assigned to Object
if ( lhsType == Object.class )
return true;
// null rhs type corresponds to type of Primitive.NULL
// assignable to any object type but not array
if (rhsType == null)
return !lhsType.isPrimitive() && !lhsType.isArray();
// prim numeric type can be boxed and assigned to number
if ( lhsType == Number.class
&& rhsType != Character.TYPE
&& rhsType != Boolean.TYPE
)
return true;
// General case prim type to wrapper or vice versa.
// I don't know if this is faster than a flat list of 'if's like above.
// wrapperMap maps both prim to wrapper and wrapper to prim types,
// so this test is symmetric
if ( Primitive.wrapperMap.get( lhsType ) == rhsType )
return true;
return isJavaBaseAssignable(lhsType, rhsType);
} | java | static boolean isJavaBoxTypesAssignable(
Class lhsType, Class rhsType )
{
// Assignment to loose type... defer to bsh extensions
if ( lhsType == null )
return false;
// prim can be boxed and assigned to Object
if ( lhsType == Object.class )
return true;
// null rhs type corresponds to type of Primitive.NULL
// assignable to any object type but not array
if (rhsType == null)
return !lhsType.isPrimitive() && !lhsType.isArray();
// prim numeric type can be boxed and assigned to number
if ( lhsType == Number.class
&& rhsType != Character.TYPE
&& rhsType != Boolean.TYPE
)
return true;
// General case prim type to wrapper or vice versa.
// I don't know if this is faster than a flat list of 'if's like above.
// wrapperMap maps both prim to wrapper and wrapper to prim types,
// so this test is symmetric
if ( Primitive.wrapperMap.get( lhsType ) == rhsType )
return true;
return isJavaBaseAssignable(lhsType, rhsType);
} | [
"static",
"boolean",
"isJavaBoxTypesAssignable",
"(",
"Class",
"lhsType",
",",
"Class",
"rhsType",
")",
"{",
"// Assignment to loose type... defer to bsh extensions",
"if",
"(",
"lhsType",
"==",
"null",
")",
"return",
"false",
";",
"// prim can be boxed and assigned to Obje... | Determine if the type is assignable via Java boxing/unboxing rules. | [
"Determine",
"if",
"the",
"type",
"is",
"assignable",
"via",
"Java",
"boxing",
"/",
"unboxing",
"rules",
"."
] | train | https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/Types.java#L333-L364 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/QuickSelect.java | QuickSelect.insertionSort | private static void insertionSort(double[] data, int start, int end) {
for(int i = start + 1; i < end; i++) {
for(int j = i; j > start && data[j - 1] > data[j]; j--) {
swap(data, j, j - 1);
}
}
} | java | private static void insertionSort(double[] data, int start, int end) {
for(int i = start + 1; i < end; i++) {
for(int j = i; j > start && data[j - 1] > data[j]; j--) {
swap(data, j, j - 1);
}
}
} | [
"private",
"static",
"void",
"insertionSort",
"(",
"double",
"[",
"]",
"data",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"start",
"+",
"1",
";",
"i",
"<",
"end",
";",
"i",
"++",
")",
"{",
"for",
"(",
"int",
... | Sort a small array using repetitive insertion sort.
@param data Data to sort
@param start Interval start
@param end Interval end | [
"Sort",
"a",
"small",
"array",
"using",
"repetitive",
"insertion",
"sort",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/QuickSelect.java#L563-L569 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java | NetworkWatchersInner.setFlowLogConfiguration | public FlowLogInformationInner setFlowLogConfiguration(String resourceGroupName, String networkWatcherName, FlowLogInformationInner parameters) {
return setFlowLogConfigurationWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().last().body();
} | java | public FlowLogInformationInner setFlowLogConfiguration(String resourceGroupName, String networkWatcherName, FlowLogInformationInner parameters) {
return setFlowLogConfigurationWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().last().body();
} | [
"public",
"FlowLogInformationInner",
"setFlowLogConfiguration",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkWatcherName",
",",
"FlowLogInformationInner",
"parameters",
")",
"{",
"return",
"setFlowLogConfigurationWithServiceResponseAsync",
"(",
"resourceGroupName",
... | Configures flow log on a specified resource.
@param resourceGroupName The name of the network watcher resource group.
@param networkWatcherName The name of the network watcher resource.
@param parameters Parameters that define the configuration of flow log.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the FlowLogInformationInner object if successful. | [
"Configures",
"flow",
"log",
"on",
"a",
"specified",
"resource",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L1802-L1804 |
landawn/AbacusUtil | src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java | PoolablePreparedStatement.setNClob | @Override
public void setNClob(int parameterIndex, NClob value) throws SQLException {
internalStmt.setNClob(parameterIndex, value);
} | java | @Override
public void setNClob(int parameterIndex, NClob value) throws SQLException {
internalStmt.setNClob(parameterIndex, value);
} | [
"@",
"Override",
"public",
"void",
"setNClob",
"(",
"int",
"parameterIndex",
",",
"NClob",
"value",
")",
"throws",
"SQLException",
"{",
"internalStmt",
".",
"setNClob",
"(",
"parameterIndex",
",",
"value",
")",
";",
"}"
] | Method setNClob.
@param parameterIndex
@param value
@throws SQLException
@see java.sql.PreparedStatement#setNClob(int, NClob) | [
"Method",
"setNClob",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java#L817-L820 |
Jasig/uPortal | uPortal-core/src/main/java/org/apereo/portal/properties/PropertiesManager.java | PropertiesManager.getPropertyAsInt | public static int getPropertyAsInt(String name)
throws MissingPropertyException, BadPropertyException {
if (PropertiesManager.props == null) loadProps();
try {
return Integer.parseInt(getProperty(name));
} catch (NumberFormatException nfe) {
throw new BadPropertyException(name, getProperty(name), "int");
}
} | java | public static int getPropertyAsInt(String name)
throws MissingPropertyException, BadPropertyException {
if (PropertiesManager.props == null) loadProps();
try {
return Integer.parseInt(getProperty(name));
} catch (NumberFormatException nfe) {
throw new BadPropertyException(name, getProperty(name), "int");
}
} | [
"public",
"static",
"int",
"getPropertyAsInt",
"(",
"String",
"name",
")",
"throws",
"MissingPropertyException",
",",
"BadPropertyException",
"{",
"if",
"(",
"PropertiesManager",
".",
"props",
"==",
"null",
")",
"loadProps",
"(",
")",
";",
"try",
"{",
"return",
... | Returns the value of a property for a given name as an <code>int</code>
@param name the name of the requested property
@return value the property's value as an <code>int</code>
@throws MissingPropertyException - if the property is not set
@throws BadPropertyException - if the property cannot be parsed as an int | [
"Returns",
"the",
"value",
"of",
"a",
"property",
"for",
"a",
"given",
"name",
"as",
"an",
"<code",
">",
"int<",
"/",
"code",
">"
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-core/src/main/java/org/apereo/portal/properties/PropertiesManager.java#L237-L245 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.recoverDeletedCertificateAsync | public ServiceFuture<CertificateBundle> recoverDeletedCertificateAsync(String vaultBaseUrl, String certificateName, final ServiceCallback<CertificateBundle> serviceCallback) {
return ServiceFuture.fromResponse(recoverDeletedCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName), serviceCallback);
} | java | public ServiceFuture<CertificateBundle> recoverDeletedCertificateAsync(String vaultBaseUrl, String certificateName, final ServiceCallback<CertificateBundle> serviceCallback) {
return ServiceFuture.fromResponse(recoverDeletedCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"CertificateBundle",
">",
"recoverDeletedCertificateAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"certificateName",
",",
"final",
"ServiceCallback",
"<",
"CertificateBundle",
">",
"serviceCallback",
")",
"{",
"return",
"ServiceFutu... | Recovers the deleted certificate back to its current version under /certificates.
The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The operation is applicable in vaults enabled for soft-delete, and must be issued during the retention interval (available in the deleted certificate's attributes). This operation requires the certificates/recover permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param certificateName The name of the deleted certificate
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Recovers",
"the",
"deleted",
"certificate",
"back",
"to",
"its",
"current",
"version",
"under",
"/",
"certificates",
".",
"The",
"RecoverDeletedCertificate",
"operation",
"performs",
"the",
"reversal",
"of",
"the",
"Delete",
"operation",
".",
"The",
"operation",
... | 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#L8723-L8725 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/input/form/CmsForm.java | CmsForm.createValidationHandler | private I_CmsValidationHandler createValidationHandler() {
return new I_CmsValidationHandler() {
/**
* @see org.opencms.gwt.client.validation.I_CmsValidationHandler#onValidationFinished(boolean)
*/
public void onValidationFinished(boolean ok) {
m_formHandler.onValidationResult(CmsForm.this, noFieldsInvalid(m_fields.values()));
}
/**
* @see org.opencms.gwt.client.validation.I_CmsValidationHandler#onValidationResult(java.lang.String, org.opencms.gwt.shared.CmsValidationResult)
*/
public void onValidationResult(String fieldId, CmsValidationResult result) {
I_CmsFormField field = m_fields.get(fieldId);
String modelId = field.getModelId();
updateModelValidationStatus(modelId, result);
}
};
} | java | private I_CmsValidationHandler createValidationHandler() {
return new I_CmsValidationHandler() {
/**
* @see org.opencms.gwt.client.validation.I_CmsValidationHandler#onValidationFinished(boolean)
*/
public void onValidationFinished(boolean ok) {
m_formHandler.onValidationResult(CmsForm.this, noFieldsInvalid(m_fields.values()));
}
/**
* @see org.opencms.gwt.client.validation.I_CmsValidationHandler#onValidationResult(java.lang.String, org.opencms.gwt.shared.CmsValidationResult)
*/
public void onValidationResult(String fieldId, CmsValidationResult result) {
I_CmsFormField field = m_fields.get(fieldId);
String modelId = field.getModelId();
updateModelValidationStatus(modelId, result);
}
};
} | [
"private",
"I_CmsValidationHandler",
"createValidationHandler",
"(",
")",
"{",
"return",
"new",
"I_CmsValidationHandler",
"(",
")",
"{",
"/**\n * @see org.opencms.gwt.client.validation.I_CmsValidationHandler#onValidationFinished(boolean)\n */",
"public",
"void",
... | Creates a validation handler which updates the OK button state when validation results come in.<p>
@return a validation handler | [
"Creates",
"a",
"validation",
"handler",
"which",
"updates",
"the",
"OK",
"button",
"state",
"when",
"validation",
"results",
"come",
"in",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/form/CmsForm.java#L546-L568 |
acromusashi/acromusashi-stream | src/main/java/acromusashi/stream/topology/CommonMessagePrintTopology.java | CommonMessagePrintTopology.main | public static void main(String[] args) throws Exception
{
// プログラム引数の不足をチェック
if (args.length < 2)
{
System.out.println("Usage: java acromusashi.stream.topology.CommonMessagePrintTopology ConfigPath isExecuteLocal(true|false)");
return;
}
// 起動引数として使用したパスからStorm設定オブジェクトを生成
Config conf = StormConfigGenerator.loadStormConfig(args[0]);
// プログラム引数から設定値を取得(ローカル環境or分散環境)
boolean isLocal = Boolean.valueOf(args[1]);
// Topologyを起動する
BaseTopology topology = new CommonMessagePrintTopology("CommonMessagePrintTopology", conf);
topology.buildTopology();
topology.submitTopology(isLocal);
} | java | public static void main(String[] args) throws Exception
{
// プログラム引数の不足をチェック
if (args.length < 2)
{
System.out.println("Usage: java acromusashi.stream.topology.CommonMessagePrintTopology ConfigPath isExecuteLocal(true|false)");
return;
}
// 起動引数として使用したパスからStorm設定オブジェクトを生成
Config conf = StormConfigGenerator.loadStormConfig(args[0]);
// プログラム引数から設定値を取得(ローカル環境or分散環境)
boolean isLocal = Boolean.valueOf(args[1]);
// Topologyを起動する
BaseTopology topology = new CommonMessagePrintTopology("CommonMessagePrintTopology", conf);
topology.buildTopology();
topology.submitTopology(isLocal);
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"// プログラム引数の不足をチェック",
"if",
"(",
"args",
".",
"length",
"<",
"2",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Usage: java acromusashi.stream.top... | プログラムエントリポイント<br>
<ul>
<li>起動引数:arg[0] 設定値を記述したyamlファイルパス</li>
<li>起動引数:arg[1] Stormの起動モード(true:LocalMode、false:DistributeMode)</li>
</ul>
@param args 起動引数
@throws Exception 初期化例外発生時 | [
"プログラムエントリポイント<br",
">",
"<ul",
">",
"<li",
">",
"起動引数",
":",
"arg",
"[",
"0",
"]",
"設定値を記述したyamlファイルパス<",
"/",
"li",
">",
"<li",
">",
"起動引数",
":",
"arg",
"[",
"1",
"]",
"Stormの起動モード",
"(",
"true",
":",
"LocalMode、false",
":",
"DistributeMode",
")",
"<... | train | https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/topology/CommonMessagePrintTopology.java#L69-L88 |
azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/HadoopJobUtils.java | HadoopJobUtils.addAdditionalNamenodesToPropsFromMRJob | public static void addAdditionalNamenodesToPropsFromMRJob(Props props, Logger log) {
String additionalNamenodes =
(new Configuration()).get(MAPREDUCE_JOB_OTHER_NAMENODES);
if (additionalNamenodes != null && additionalNamenodes.length() > 0) {
log.info("Found property " + MAPREDUCE_JOB_OTHER_NAMENODES +
" = " + additionalNamenodes + "; setting additional namenodes");
HadoopJobUtils.addAdditionalNamenodesToProps(props, additionalNamenodes);
}
} | java | public static void addAdditionalNamenodesToPropsFromMRJob(Props props, Logger log) {
String additionalNamenodes =
(new Configuration()).get(MAPREDUCE_JOB_OTHER_NAMENODES);
if (additionalNamenodes != null && additionalNamenodes.length() > 0) {
log.info("Found property " + MAPREDUCE_JOB_OTHER_NAMENODES +
" = " + additionalNamenodes + "; setting additional namenodes");
HadoopJobUtils.addAdditionalNamenodesToProps(props, additionalNamenodes);
}
} | [
"public",
"static",
"void",
"addAdditionalNamenodesToPropsFromMRJob",
"(",
"Props",
"props",
",",
"Logger",
"log",
")",
"{",
"String",
"additionalNamenodes",
"=",
"(",
"new",
"Configuration",
"(",
")",
")",
".",
"get",
"(",
"MAPREDUCE_JOB_OTHER_NAMENODES",
")",
";... | The same as {@link #addAdditionalNamenodesToProps}, but assumes that the
calling job is MapReduce-based and so uses the
{@link #MAPREDUCE_JOB_OTHER_NAMENODES} from a {@link Configuration} object
to get the list of additional namenodes.
@param props Props to add the new Namenode URIs to.
@see #addAdditionalNamenodesToProps(Props, String) | [
"The",
"same",
"as",
"{",
"@link",
"#addAdditionalNamenodesToProps",
"}",
"but",
"assumes",
"that",
"the",
"calling",
"job",
"is",
"MapReduce",
"-",
"based",
"and",
"so",
"uses",
"the",
"{",
"@link",
"#MAPREDUCE_JOB_OTHER_NAMENODES",
"}",
"from",
"a",
"{",
"@l... | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/HadoopJobUtils.java#L152-L160 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/android/Facebook.java | Facebook.extendAccessTokenIfNeeded | @Deprecated
public boolean extendAccessTokenIfNeeded(Context context, ServiceListener serviceListener) {
checkUserSession("extendAccessTokenIfNeeded");
if (shouldExtendAccessToken()) {
return extendAccessToken(context, serviceListener);
}
return true;
} | java | @Deprecated
public boolean extendAccessTokenIfNeeded(Context context, ServiceListener serviceListener) {
checkUserSession("extendAccessTokenIfNeeded");
if (shouldExtendAccessToken()) {
return extendAccessToken(context, serviceListener);
}
return true;
} | [
"@",
"Deprecated",
"public",
"boolean",
"extendAccessTokenIfNeeded",
"(",
"Context",
"context",
",",
"ServiceListener",
"serviceListener",
")",
"{",
"checkUserSession",
"(",
"\"extendAccessTokenIfNeeded\"",
")",
";",
"if",
"(",
"shouldExtendAccessToken",
"(",
")",
")",
... | Calls extendAccessToken if shouldExtendAccessToken returns true.
<p/>
This method is deprecated. See {@link Facebook} and {@link Session} for more info.
@return the same value as extendAccessToken if the the token requires
refreshing, true otherwise | [
"Calls",
"extendAccessToken",
"if",
"shouldExtendAccessToken",
"returns",
"true",
".",
"<p",
"/",
">",
"This",
"method",
"is",
"deprecated",
".",
"See",
"{",
"@link",
"Facebook",
"}",
"and",
"{",
"@link",
"Session",
"}",
"for",
"more",
"info",
"."
] | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/android/Facebook.java#L482-L489 |
contentful/contentful-management.java | src/main/java/com/contentful/java/cma/ModuleUiExtensions.java | ModuleUiExtensions.fetchAll | public CMAArray<CMAUiExtension> fetchAll(Map<String, String> query) {
return fetchAll(spaceId, environmentId, query);
} | java | public CMAArray<CMAUiExtension> fetchAll(Map<String, String> query) {
return fetchAll(spaceId, environmentId, query);
} | [
"public",
"CMAArray",
"<",
"CMAUiExtension",
">",
"fetchAll",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"query",
")",
"{",
"return",
"fetchAll",
"(",
"spaceId",
",",
"environmentId",
",",
"query",
")",
";",
"}"
] | Fetch all ui extensions from the configured space by a query.
@param query controls what to return.
@return specific ui extensions for a specific space.
@throws IllegalArgumentException if configured space id is null.
@throws IllegalArgumentException if configured environment id is null.
@see CMAClient.Builder#setSpaceId(String)
@see CMAClient.Builder#setEnvironmentId(String) | [
"Fetch",
"all",
"ui",
"extensions",
"from",
"the",
"configured",
"space",
"by",
"a",
"query",
"."
] | train | https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/ModuleUiExtensions.java#L122-L124 |
sachin-handiekar/jMusixMatch | src/main/java/org/jmusixmatch/MusixMatch.java | MusixMatch.getTrackResponse | private Track getTrackResponse(String methodName, Map<String, Object> params)
throws MusixMatchException {
Track track = new Track();
String response = null;
TrackGetMessage message = null;
response = MusixMatchRequest.sendRequest(Helper.getURLString(
methodName, params));
Gson gson = new Gson();
try {
message = gson.fromJson(response, TrackGetMessage.class);
} catch (JsonParseException jpe) {
handleErrorResponse(response);
}
TrackData data = message.getTrackMessage().getBody().getTrack();
track.setTrack(data);
return track;
} | java | private Track getTrackResponse(String methodName, Map<String, Object> params)
throws MusixMatchException {
Track track = new Track();
String response = null;
TrackGetMessage message = null;
response = MusixMatchRequest.sendRequest(Helper.getURLString(
methodName, params));
Gson gson = new Gson();
try {
message = gson.fromJson(response, TrackGetMessage.class);
} catch (JsonParseException jpe) {
handleErrorResponse(response);
}
TrackData data = message.getTrackMessage().getBody().getTrack();
track.setTrack(data);
return track;
} | [
"private",
"Track",
"getTrackResponse",
"(",
"String",
"methodName",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
")",
"throws",
"MusixMatchException",
"{",
"Track",
"track",
"=",
"new",
"Track",
"(",
")",
";",
"String",
"response",
"=",
"null",
... | Returns the track response which was returned through the query.
@param methodName
the name of the API method.
@param params
a map which contains the key-value pair
@return the track details.
@throws MusixMatchException
if any error occurs. | [
"Returns",
"the",
"track",
"response",
"which",
"was",
"returned",
"through",
"the",
"query",
"."
] | train | https://github.com/sachin-handiekar/jMusixMatch/blob/da909f7732053a801ea7282fe9a8bce385fa3763/src/main/java/org/jmusixmatch/MusixMatch.java#L263-L285 |
qmx/jitescript | src/main/java/me/qmx/jitescript/CodeBlock.java | CodeBlock.frame_same | public CodeBlock frame_same(final Object... stackArguments) {
final int type;
switch (stackArguments.length) {
case 0:
type = Opcodes.F_SAME;
break;
case 1:
type = Opcodes.F_SAME1;
break;
default:
throw new IllegalArgumentException("same frame should have 0" + " or 1 arguments on stack");
}
instructionList.add(new FrameNode(type, 0, null, stackArguments.length, stackArguments));
return this;
} | java | public CodeBlock frame_same(final Object... stackArguments) {
final int type;
switch (stackArguments.length) {
case 0:
type = Opcodes.F_SAME;
break;
case 1:
type = Opcodes.F_SAME1;
break;
default:
throw new IllegalArgumentException("same frame should have 0" + " or 1 arguments on stack");
}
instructionList.add(new FrameNode(type, 0, null, stackArguments.length, stackArguments));
return this;
} | [
"public",
"CodeBlock",
"frame_same",
"(",
"final",
"Object",
"...",
"stackArguments",
")",
"{",
"final",
"int",
"type",
";",
"switch",
"(",
"stackArguments",
".",
"length",
")",
"{",
"case",
"0",
":",
"type",
"=",
"Opcodes",
".",
"F_SAME",
";",
"break",
... | adds a compressed frame to the stack
@param stackArguments the argument types on the stack, represented as
"class path names" e.g java/lang/RuntimeException | [
"adds",
"a",
"compressed",
"frame",
"to",
"the",
"stack"
] | train | https://github.com/qmx/jitescript/blob/bda6d02f37a8083248d9a0c80ea76bb5a63151ae/src/main/java/me/qmx/jitescript/CodeBlock.java#L1112-L1128 |
versionone/VersionOne.SDK.Java.ObjectModel | src/main/java/com/versionone/om/Project.java | Project.createIteration | public Iteration createIteration(Map<String, Object> attributes) {
return getInstance().create().iteration(this, attributes);
} | java | public Iteration createIteration(Map<String, Object> attributes) {
return getInstance().create().iteration(this, attributes);
} | [
"public",
"Iteration",
"createIteration",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"attributes",
")",
"{",
"return",
"getInstance",
"(",
")",
".",
"create",
"(",
")",
".",
"iteration",
"(",
"this",
",",
"attributes",
")",
";",
"}"
] | Create a new Iteration in the Project where the schedule is defined. Use
the suggested system values for the new iteration.
@param attributes additional attributes for the Iteration.
@return A new Iteration. | [
"Create",
"a",
"new",
"Iteration",
"in",
"the",
"Project",
"where",
"the",
"schedule",
"is",
"defined",
".",
"Use",
"the",
"suggested",
"system",
"values",
"for",
"the",
"new",
"iteration",
"."
] | train | https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/Project.java#L356-L358 |
icode/ameba-utils | src/main/java/ameba/util/MimeType.java | MimeType.getByFilename | public static String getByFilename(String fileName, String defaultType) {
String extn = getExtension(fileName);
if (extn != null) {
return get(extn, defaultType);
} else {
// no extension, no content type
return null;
}
} | java | public static String getByFilename(String fileName, String defaultType) {
String extn = getExtension(fileName);
if (extn != null) {
return get(extn, defaultType);
} else {
// no extension, no content type
return null;
}
} | [
"public",
"static",
"String",
"getByFilename",
"(",
"String",
"fileName",
",",
"String",
"defaultType",
")",
"{",
"String",
"extn",
"=",
"getExtension",
"(",
"fileName",
")",
";",
"if",
"(",
"extn",
"!=",
"null",
")",
"{",
"return",
"get",
"(",
"extn",
"... | <p>getByFilename.</p>
@param fileName the filename
@param defaultType default Type
@return the content type associated with <code>extension</code> of the
given filename or if no associate is found, returns
<code>defaultType</code> | [
"<p",
">",
"getByFilename",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba-utils/blob/1aad5317a22e546c83dfe2dc0c80a1dc1fa0ea35/src/main/java/ameba/util/MimeType.java#L91-L99 |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/markdown/MarkdownHelper.java | MarkdownHelper.readUntil | public static int readUntil (final StringBuilder out, final String in, final int start, final char... end)
{
int pos = start;
while (pos < in.length ())
{
final char ch = in.charAt (pos);
if (ch == '\\' && pos + 1 < in.length ())
{
pos = _escape (out, in.charAt (pos + 1), pos);
}
else
{
boolean endReached = false;
for (final char element : end)
{
if (ch == element)
{
endReached = true;
break;
}
}
if (endReached)
break;
out.append (ch);
}
pos++;
}
return pos == in.length () ? -1 : pos;
} | java | public static int readUntil (final StringBuilder out, final String in, final int start, final char... end)
{
int pos = start;
while (pos < in.length ())
{
final char ch = in.charAt (pos);
if (ch == '\\' && pos + 1 < in.length ())
{
pos = _escape (out, in.charAt (pos + 1), pos);
}
else
{
boolean endReached = false;
for (final char element : end)
{
if (ch == element)
{
endReached = true;
break;
}
}
if (endReached)
break;
out.append (ch);
}
pos++;
}
return pos == in.length () ? -1 : pos;
} | [
"public",
"static",
"int",
"readUntil",
"(",
"final",
"StringBuilder",
"out",
",",
"final",
"String",
"in",
",",
"final",
"int",
"start",
",",
"final",
"char",
"...",
"end",
")",
"{",
"int",
"pos",
"=",
"start",
";",
"while",
"(",
"pos",
"<",
"in",
"... | Reads characters until any 'end' character is encountered.
@param out
The StringBuilder to write to.
@param in
The Input String.
@param start
Starting position.
@param end
End characters.
@return The new position or -1 if no 'end' char was found. | [
"Reads",
"characters",
"until",
"any",
"end",
"character",
"is",
"encountered",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/markdown/MarkdownHelper.java#L120-L149 |
fommil/matrix-toolkits-java | src/main/java/no/uib/cipr/matrix/AbstractBandMatrix.java | AbstractBandMatrix.getIndex | int getIndex(int row, int column) {
check(row, column);
return ku + row - column + column * (kl + ku + 1);
} | java | int getIndex(int row, int column) {
check(row, column);
return ku + row - column + column * (kl + ku + 1);
} | [
"int",
"getIndex",
"(",
"int",
"row",
",",
"int",
"column",
")",
"{",
"check",
"(",
"row",
",",
"column",
")",
";",
"return",
"ku",
"+",
"row",
"-",
"column",
"+",
"column",
"*",
"(",
"kl",
"+",
"ku",
"+",
"1",
")",
";",
"}"
] | Checks the row and column indices, and returns the linear data index | [
"Checks",
"the",
"row",
"and",
"column",
"indices",
"and",
"returns",
"the",
"linear",
"data",
"index"
] | train | https://github.com/fommil/matrix-toolkits-java/blob/6157618bc86bcda3749af2a60bf869d8f3292960/src/main/java/no/uib/cipr/matrix/AbstractBandMatrix.java#L172-L175 |
Samsung/GearVRf | GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRPhysicsAvatar.java | GVRPhysicsAvatar.loadPhysics | public void loadPhysics(String filename, GVRScene scene) throws IOException
{
GVRPhysicsLoader.loadPhysicsFile(getGVRContext(), filename, true, scene);
} | java | public void loadPhysics(String filename, GVRScene scene) throws IOException
{
GVRPhysicsLoader.loadPhysicsFile(getGVRContext(), filename, true, scene);
} | [
"public",
"void",
"loadPhysics",
"(",
"String",
"filename",
",",
"GVRScene",
"scene",
")",
"throws",
"IOException",
"{",
"GVRPhysicsLoader",
".",
"loadPhysicsFile",
"(",
"getGVRContext",
"(",
")",
",",
"filename",
",",
"true",
",",
"scene",
")",
";",
"}"
] | Load physics information for the current avatar
@param filename name of physics file
@param scene scene the avatar is part of
@throws IOException if physics file cannot be parsed | [
"Load",
"physics",
"information",
"for",
"the",
"current",
"avatar"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRPhysicsAvatar.java#L62-L65 |
BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/ButtonOptionsExample.java | ButtonOptionsExample.getButtonControls | private WFieldSet getButtonControls(final WValidationErrors errors) {
// Options Layout
WFieldSet fieldSet = new WFieldSet("Button configuration");
WFieldLayout layout = new WFieldLayout();
layout.setLabelWidth(30);
layout.addField("Text", tfButtonLabel);
layout.addField("AccessKey", tfAccesskey);
layout.addField("Render as link", cbRenderAsLink);
layout.addField("Disabled", cbDisabled);
layout.addField("setImage ('/image/pencil.png')", cbSetImage);
layout.addField("Image Position", ddImagePosition);
// Apply Button
WButton apply = new WButton("Apply");
apply.setAction(new ValidatingAction(errors, fieldSet) {
@Override
public void executeOnValid(final ActionEvent event) {
applySettings();
}
});
fieldSet.add(layout);
fieldSet.add(apply);
return fieldSet;
} | java | private WFieldSet getButtonControls(final WValidationErrors errors) {
// Options Layout
WFieldSet fieldSet = new WFieldSet("Button configuration");
WFieldLayout layout = new WFieldLayout();
layout.setLabelWidth(30);
layout.addField("Text", tfButtonLabel);
layout.addField("AccessKey", tfAccesskey);
layout.addField("Render as link", cbRenderAsLink);
layout.addField("Disabled", cbDisabled);
layout.addField("setImage ('/image/pencil.png')", cbSetImage);
layout.addField("Image Position", ddImagePosition);
// Apply Button
WButton apply = new WButton("Apply");
apply.setAction(new ValidatingAction(errors, fieldSet) {
@Override
public void executeOnValid(final ActionEvent event) {
applySettings();
}
});
fieldSet.add(layout);
fieldSet.add(apply);
return fieldSet;
} | [
"private",
"WFieldSet",
"getButtonControls",
"(",
"final",
"WValidationErrors",
"errors",
")",
"{",
"// Options Layout",
"WFieldSet",
"fieldSet",
"=",
"new",
"WFieldSet",
"(",
"\"Button configuration\"",
")",
";",
"WFieldLayout",
"layout",
"=",
"new",
"WFieldLayout",
... | build the button controls field set.
@param errors the error pane from the page.
@return a field set for the controls. | [
"build",
"the",
"button",
"controls",
"field",
"set",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/ButtonOptionsExample.java#L100-L125 |
UrielCh/ovh-java-sdk | ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java | ApiOvhSms.serviceName_templatesControl_POST | public void serviceName_templatesControl_POST(String serviceName, OvhTypeTemplateEnum activity, String description, String message, String name, String reason) throws IOException {
String qPath = "/sms/{serviceName}/templatesControl";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "activity", activity);
addBody(o, "description", description);
addBody(o, "message", message);
addBody(o, "name", name);
addBody(o, "reason", reason);
exec(qPath, "POST", sb.toString(), o);
} | java | public void serviceName_templatesControl_POST(String serviceName, OvhTypeTemplateEnum activity, String description, String message, String name, String reason) throws IOException {
String qPath = "/sms/{serviceName}/templatesControl";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "activity", activity);
addBody(o, "description", description);
addBody(o, "message", message);
addBody(o, "name", name);
addBody(o, "reason", reason);
exec(qPath, "POST", sb.toString(), o);
} | [
"public",
"void",
"serviceName_templatesControl_POST",
"(",
"String",
"serviceName",
",",
"OvhTypeTemplateEnum",
"activity",
",",
"String",
"description",
",",
"String",
"message",
",",
"String",
"name",
",",
"String",
"reason",
")",
"throws",
"IOException",
"{",
"S... | Create the sms template control given
REST: POST /sms/{serviceName}/templatesControl
@param message [required] Message pattern to be moderated. Use "#VALUE#" format for dynamic text area.
@param description [required] Template description
@param name [required] Name of the template
@param reason [required] Message seen by the moderator
@param activity [required] Specify the kind of template
@param serviceName [required] The internal name of your SMS offer | [
"Create",
"the",
"sms",
"template",
"control",
"given"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L1682-L1692 |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/protocol/CommandArgsAccessor.java | CommandArgsAccessor.getFirstInteger | @SuppressWarnings("unchecked")
public static <K, V> Long getFirstInteger(CommandArgs<K, V> commandArgs) {
for (SingularArgument singularArgument : commandArgs.singularArguments) {
if (singularArgument instanceof CommandArgs.IntegerArgument) {
return ((CommandArgs.IntegerArgument) singularArgument).val;
}
}
return null;
} | java | @SuppressWarnings("unchecked")
public static <K, V> Long getFirstInteger(CommandArgs<K, V> commandArgs) {
for (SingularArgument singularArgument : commandArgs.singularArguments) {
if (singularArgument instanceof CommandArgs.IntegerArgument) {
return ((CommandArgs.IntegerArgument) singularArgument).val;
}
}
return null;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"K",
",",
"V",
">",
"Long",
"getFirstInteger",
"(",
"CommandArgs",
"<",
"K",
",",
"V",
">",
"commandArgs",
")",
"{",
"for",
"(",
"SingularArgument",
"singularArgument",
":",
"comman... | Get the first {@link Long integer} argument.
@param commandArgs must not be null.
@return the first {@link Long integer} argument or {@literal null}. | [
"Get",
"the",
"first",
"{",
"@link",
"Long",
"integer",
"}",
"argument",
"."
] | train | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/protocol/CommandArgsAccessor.java#L96-L107 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getExchangeInfo | public void getExchangeInfo(Exchange.Type currency, long quantity, Callback<Exchange> callback) throws GuildWars2Exception, NullPointerException {
isValueValid(quantity);
gw2API.getExchangeInfo(currency.name(), Long.toString(quantity)).enqueue(callback);
} | java | public void getExchangeInfo(Exchange.Type currency, long quantity, Callback<Exchange> callback) throws GuildWars2Exception, NullPointerException {
isValueValid(quantity);
gw2API.getExchangeInfo(currency.name(), Long.toString(quantity)).enqueue(callback);
} | [
"public",
"void",
"getExchangeInfo",
"(",
"Exchange",
".",
"Type",
"currency",
",",
"long",
"quantity",
",",
"Callback",
"<",
"Exchange",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isValueValid",
"(",
"quantity",
")",... | For more info on exchange coins API go <a href="https://wiki.guildwars2.com/wiki/API:2/commerce/exchange/coins">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param currency exchange currency type
@param quantity The amount to exchange
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws GuildWars2Exception invalid value
@throws NullPointerException if given {@link Callback} is empty
@see Exchange Exchange info | [
"For",
"more",
"info",
"on",
"exchange",
"coins",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"commerce",
"/",
"exchange",
"/",
"coins",
">",
"here<",
"/",
"a",
... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L933-L936 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/Record.java | Record.handleLocalCriteria | public boolean handleLocalCriteria(StringBuffer strFilter, boolean bIncludeFileName, Vector<BaseField> vParamList)
{
BaseListener nextListener = this.getNextEnabledListener();
boolean bDontSkip = true;
if (nextListener != null)
bDontSkip = ((FileListener)nextListener).doLocalCriteria(strFilter, bIncludeFileName, vParamList);
else
bDontSkip = this.doLocalCriteria(strFilter, bIncludeFileName, vParamList);
if (bDontSkip == false)
return bDontSkip; // skip it
return this.getTable().doLocalCriteria(strFilter, bIncludeFileName, vParamList); // Give the table a shot at it
} | java | public boolean handleLocalCriteria(StringBuffer strFilter, boolean bIncludeFileName, Vector<BaseField> vParamList)
{
BaseListener nextListener = this.getNextEnabledListener();
boolean bDontSkip = true;
if (nextListener != null)
bDontSkip = ((FileListener)nextListener).doLocalCriteria(strFilter, bIncludeFileName, vParamList);
else
bDontSkip = this.doLocalCriteria(strFilter, bIncludeFileName, vParamList);
if (bDontSkip == false)
return bDontSkip; // skip it
return this.getTable().doLocalCriteria(strFilter, bIncludeFileName, vParamList); // Give the table a shot at it
} | [
"public",
"boolean",
"handleLocalCriteria",
"(",
"StringBuffer",
"strFilter",
",",
"boolean",
"bIncludeFileName",
",",
"Vector",
"<",
"BaseField",
">",
"vParamList",
")",
"{",
"BaseListener",
"nextListener",
"=",
"this",
".",
"getNextEnabledListener",
"(",
")",
";",... | Check to see if this record should be skipped.
Generally, you use a remote criteria.
@param strFilter The current SQL WHERE string.
@param bIncludeFileName Include the Filename.fieldName in the string.
@param vParamList The list of params.
@return true if the criteria passes.
@return false if the criteria fails, and returns without checking further. | [
"Check",
"to",
"see",
"if",
"this",
"record",
"should",
"be",
"skipped",
".",
"Generally",
"you",
"use",
"a",
"remote",
"criteria",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/Record.java#L1647-L1658 |
GwtMaterialDesign/gwt-material | gwt-material/src/main/java/gwt/material/design/client/base/helper/UiHelper.java | UiHelper.addMousePressedHandlers | public static void addMousePressedHandlers(final Widget widget, final String cssStyleName) {
widget.sinkEvents(Event.ONMOUSEDOWN);
widget.sinkEvents(Event.ONMOUSEUP);
widget.sinkEvents(Event.ONMOUSEOUT);
widget.sinkEvents(Event.TOUCHEVENTS);
handlerRegistry = new DefaultHandlerRegistry(widget);
handlerRegistry.registerHandler(widget.addHandler(event -> widget.addStyleName(cssStyleName), MouseDownEvent.getType()));
handlerRegistry.registerHandler(widget.addHandler(event -> widget.removeStyleName(cssStyleName), MouseUpEvent.getType()));
handlerRegistry.registerHandler(widget.addHandler(event -> widget.removeStyleName(cssStyleName), MouseOutEvent.getType()));
// Touch Events
handlerRegistry.registerHandler(widget.addHandler(event -> widget.addStyleName(cssStyleName), TouchStartEvent.getType()));
handlerRegistry.registerHandler(widget.addHandler(event -> widget.removeStyleName(cssStyleName), TouchEndEvent.getType()));
handlerRegistry.registerHandler(widget.addHandler(event -> widget.removeStyleName(cssStyleName), TouchCancelEvent.getType()));
} | java | public static void addMousePressedHandlers(final Widget widget, final String cssStyleName) {
widget.sinkEvents(Event.ONMOUSEDOWN);
widget.sinkEvents(Event.ONMOUSEUP);
widget.sinkEvents(Event.ONMOUSEOUT);
widget.sinkEvents(Event.TOUCHEVENTS);
handlerRegistry = new DefaultHandlerRegistry(widget);
handlerRegistry.registerHandler(widget.addHandler(event -> widget.addStyleName(cssStyleName), MouseDownEvent.getType()));
handlerRegistry.registerHandler(widget.addHandler(event -> widget.removeStyleName(cssStyleName), MouseUpEvent.getType()));
handlerRegistry.registerHandler(widget.addHandler(event -> widget.removeStyleName(cssStyleName), MouseOutEvent.getType()));
// Touch Events
handlerRegistry.registerHandler(widget.addHandler(event -> widget.addStyleName(cssStyleName), TouchStartEvent.getType()));
handlerRegistry.registerHandler(widget.addHandler(event -> widget.removeStyleName(cssStyleName), TouchEndEvent.getType()));
handlerRegistry.registerHandler(widget.addHandler(event -> widget.removeStyleName(cssStyleName), TouchCancelEvent.getType()));
} | [
"public",
"static",
"void",
"addMousePressedHandlers",
"(",
"final",
"Widget",
"widget",
",",
"final",
"String",
"cssStyleName",
")",
"{",
"widget",
".",
"sinkEvents",
"(",
"Event",
".",
"ONMOUSEDOWN",
")",
";",
"widget",
".",
"sinkEvents",
"(",
"Event",
".",
... | Adds a mouse pressed handler to a widget. Adds a CSS style to the widget
as long as the mouse is pressed (or the user touches the widget on mobile browser).
@param widget The widget to which the style must be applied for mouse/touch event
@param cssStyleName CSS style name to be applied | [
"Adds",
"a",
"mouse",
"pressed",
"handler",
"to",
"a",
"widget",
".",
"Adds",
"a",
"CSS",
"style",
"to",
"the",
"widget",
"as",
"long",
"as",
"the",
"mouse",
"is",
"pressed",
"(",
"or",
"the",
"user",
"touches",
"the",
"widget",
"on",
"mobile",
"browse... | train | https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/base/helper/UiHelper.java#L57-L72 |
xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheMapUtil.java | CacheMapUtil.batchRemove | @SuppressWarnings("unused")
public static Completable batchRemove(Map<String, List<String>> batchRemoves) {
return batchRemove(CacheService.CACHE_CONFIG_BEAN, batchRemoves);
} | java | @SuppressWarnings("unused")
public static Completable batchRemove(Map<String, List<String>> batchRemoves) {
return batchRemove(CacheService.CACHE_CONFIG_BEAN, batchRemoves);
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"public",
"static",
"Completable",
"batchRemove",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"batchRemoves",
")",
"{",
"return",
"batchRemove",
"(",
"CacheService",
".",
"CACHE_CONFIG_BEAN",
... | batch remove the elements in the cached map
@param batchRemoves Map(key, fields) the sub map you want to remvoe | [
"batch",
"remove",
"the",
"elements",
"in",
"the",
"cached",
"map"
] | train | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheMapUtil.java#L242-L245 |
spotbugs/spotbugs | eclipsePlugin/src/edu/umd/cs/findbugs/plugin/eclipse/quickfix/CreateRemainderOddnessCheckResolution.java | CreateRemainderOddnessCheckResolution.createCorrectOddnessCheck | @Override
protected InfixExpression createCorrectOddnessCheck(ASTRewrite rewrite, Expression numberExpression) {
Assert.isNotNull(rewrite);
Assert.isNotNull(numberExpression);
final AST ast = rewrite.getAST();
InfixExpression correctOddnessCheck = ast.newInfixExpression();
InfixExpression remainderExp = ast.newInfixExpression();
correctOddnessCheck.setLeftOperand(remainderExp);
correctOddnessCheck.setOperator(NOT_EQUALS);
correctOddnessCheck.setRightOperand(ast.newNumberLiteral("0"));
remainderExp.setLeftOperand((Expression) rewrite.createMoveTarget(numberExpression));
remainderExp.setOperator(REMAINDER);
remainderExp.setRightOperand(ast.newNumberLiteral("2"));
return correctOddnessCheck;
} | java | @Override
protected InfixExpression createCorrectOddnessCheck(ASTRewrite rewrite, Expression numberExpression) {
Assert.isNotNull(rewrite);
Assert.isNotNull(numberExpression);
final AST ast = rewrite.getAST();
InfixExpression correctOddnessCheck = ast.newInfixExpression();
InfixExpression remainderExp = ast.newInfixExpression();
correctOddnessCheck.setLeftOperand(remainderExp);
correctOddnessCheck.setOperator(NOT_EQUALS);
correctOddnessCheck.setRightOperand(ast.newNumberLiteral("0"));
remainderExp.setLeftOperand((Expression) rewrite.createMoveTarget(numberExpression));
remainderExp.setOperator(REMAINDER);
remainderExp.setRightOperand(ast.newNumberLiteral("2"));
return correctOddnessCheck;
} | [
"@",
"Override",
"protected",
"InfixExpression",
"createCorrectOddnessCheck",
"(",
"ASTRewrite",
"rewrite",
",",
"Expression",
"numberExpression",
")",
"{",
"Assert",
".",
"isNotNull",
"(",
"rewrite",
")",
";",
"Assert",
".",
"isNotNull",
"(",
"numberExpression",
")... | Creates the new <CODE>InfixExpression</CODE> <CODE>x % 2 != 0</CODE> | [
"Creates",
"the",
"new",
"<CODE",
">",
"InfixExpression<",
"/",
"CODE",
">",
"<CODE",
">",
"x",
"%",
"2",
"!",
"=",
"0<",
"/",
"CODE",
">"
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/edu/umd/cs/findbugs/plugin/eclipse/quickfix/CreateRemainderOddnessCheckResolution.java#L49-L67 |
gallandarakhneorg/afc | core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java | MathUtil.isEpsilonZero | @Pure
@Inline(value = "Math.abs($1) < (Double.isNaN($2) ? Math.ulp($1) : ($2))", imported = Math.class)
public static boolean isEpsilonZero(double value, double epsilon) {
final double eps = Double.isNaN(epsilon) ? Math.ulp(value) : epsilon;
return Math.abs(value) <= eps;
} | java | @Pure
@Inline(value = "Math.abs($1) < (Double.isNaN($2) ? Math.ulp($1) : ($2))", imported = Math.class)
public static boolean isEpsilonZero(double value, double epsilon) {
final double eps = Double.isNaN(epsilon) ? Math.ulp(value) : epsilon;
return Math.abs(value) <= eps;
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"Math.abs($1) < (Double.isNaN($2) ? Math.ulp($1) : ($2))\"",
",",
"imported",
"=",
"Math",
".",
"class",
")",
"public",
"static",
"boolean",
"isEpsilonZero",
"(",
"double",
"value",
",",
"double",
"epsilon",
")",
"{... | Replies if the given value is near zero.
@param value is the value to test.
@param epsilon the approximation epsilon. If {@link Double#NaN}, the function {@link Math#ulp(double)} is
used for evaluating the epsilon.
@return <code>true</code> if the given {@code value}
is near zero, otherwise <code>false</code>. | [
"Replies",
"if",
"the",
"given",
"value",
"is",
"near",
"zero",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java#L136-L141 |
OpenLiberty/open-liberty | dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/TypeConversion.java | TypeConversion.intToBytes | public static void intToBytes(int value, byte[] bytes, int offset) {
bytes[offset + 3] = (byte) (value >>> 0);
bytes[offset + 2] = (byte) (value >>> 8);
bytes[offset + 1] = (byte) (value >>> 16);
bytes[offset + 0] = (byte) (value >>> 24);
} | java | public static void intToBytes(int value, byte[] bytes, int offset) {
bytes[offset + 3] = (byte) (value >>> 0);
bytes[offset + 2] = (byte) (value >>> 8);
bytes[offset + 1] = (byte) (value >>> 16);
bytes[offset + 0] = (byte) (value >>> 24);
} | [
"public",
"static",
"void",
"intToBytes",
"(",
"int",
"value",
",",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
")",
"{",
"bytes",
"[",
"offset",
"+",
"3",
"]",
"=",
"(",
"byte",
")",
"(",
"value",
">>>",
"0",
")",
";",
"bytes",
"[",
"offset... | A utility method to convert an int into bytes in an array.
@param value
An int.
@param bytes
The byte array to which the int should be copied.
@param offset
The index where the int should start. | [
"A",
"utility",
"method",
"to",
"convert",
"an",
"int",
"into",
"bytes",
"in",
"an",
"array",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/TypeConversion.java#L109-L114 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/effect/Effect.java | Effect.fill | public void fill(Graphics2D g, Shape s) {
Rectangle bounds = s.getBounds();
int width = bounds.width;
int height = bounds.height;
BufferedImage bimage = Effect.createBufferedImage(width, height, true);
Graphics2D gbi = bimage.createGraphics();
gbi.setColor(Color.BLACK);
gbi.fill(s);
g.drawImage(applyEffect(bimage, null, width, height), 0, 0, null);
} | java | public void fill(Graphics2D g, Shape s) {
Rectangle bounds = s.getBounds();
int width = bounds.width;
int height = bounds.height;
BufferedImage bimage = Effect.createBufferedImage(width, height, true);
Graphics2D gbi = bimage.createGraphics();
gbi.setColor(Color.BLACK);
gbi.fill(s);
g.drawImage(applyEffect(bimage, null, width, height), 0, 0, null);
} | [
"public",
"void",
"fill",
"(",
"Graphics2D",
"g",
",",
"Shape",
"s",
")",
"{",
"Rectangle",
"bounds",
"=",
"s",
".",
"getBounds",
"(",
")",
";",
"int",
"width",
"=",
"bounds",
".",
"width",
";",
"int",
"height",
"=",
"bounds",
".",
"height",
";",
"... | Paint the effect based around a solid shape in the graphics supplied.
@param g the graphics to paint into.
@param s the shape to base the effect around. | [
"Paint",
"the",
"effect",
"based",
"around",
"a",
"solid",
"shape",
"in",
"the",
"graphics",
"supplied",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/effect/Effect.java#L104-L116 |
noties/Scrollable | library/src/main/java/ru/noties/scrollable/ScrollableLayout.java | ScrollableLayout.initScroller | protected ScrollableScroller initScroller(Context context, Interpolator interpolator, boolean flywheel) {
return new ScrollableScroller(context, interpolator, flywheel);
} | java | protected ScrollableScroller initScroller(Context context, Interpolator interpolator, boolean flywheel) {
return new ScrollableScroller(context, interpolator, flywheel);
} | [
"protected",
"ScrollableScroller",
"initScroller",
"(",
"Context",
"context",
",",
"Interpolator",
"interpolator",
",",
"boolean",
"flywheel",
")",
"{",
"return",
"new",
"ScrollableScroller",
"(",
"context",
",",
"interpolator",
",",
"flywheel",
")",
";",
"}"
] | Override this method if you wish to create own {@link android.widget.Scroller}
@param context {@link android.content.Context}
@param interpolator {@link android.view.animation.Interpolator}, the default implementation passes <code>null</code>
@param flywheel {@link android.widget.Scroller#Scroller(android.content.Context, android.view.animation.Interpolator, boolean)}
@return new instance of {@link android.widget.Scroller} must not bu null | [
"Override",
"this",
"method",
"if",
"you",
"wish",
"to",
"create",
"own",
"{"
] | train | https://github.com/noties/Scrollable/blob/e93213f04b41870b282dc810db70e29f7d225d5d/library/src/main/java/ru/noties/scrollable/ScrollableLayout.java#L289-L291 |
intellimate/Izou | src/main/java/org/intellimate/izou/security/SecurityFunctions.java | SecurityFunctions.decryptAES | public String decryptAES(byte[] cipherBytes, SecretKey key) {
String plainText = null;
Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
try {
Cipher cipher = Cipher.getInstance("AES", "BC");
cipher.init(Cipher.DECRYPT_MODE, key);
byte[] bytePlainText = cipher.doFinal(cipherBytes);
plainText = new String(bytePlainText, "UTF-8");
} catch (IllegalBlockSizeException | InvalidKeyException | NoSuchAlgorithmException | BadPaddingException
| NoSuchPaddingException | UnsupportedEncodingException | NoSuchProviderException e) {
logger.error("Unable to apply AES decryption", e);
}
return plainText;
} | java | public String decryptAES(byte[] cipherBytes, SecretKey key) {
String plainText = null;
Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
try {
Cipher cipher = Cipher.getInstance("AES", "BC");
cipher.init(Cipher.DECRYPT_MODE, key);
byte[] bytePlainText = cipher.doFinal(cipherBytes);
plainText = new String(bytePlainText, "UTF-8");
} catch (IllegalBlockSizeException | InvalidKeyException | NoSuchAlgorithmException | BadPaddingException
| NoSuchPaddingException | UnsupportedEncodingException | NoSuchProviderException e) {
logger.error("Unable to apply AES decryption", e);
}
return plainText;
} | [
"public",
"String",
"decryptAES",
"(",
"byte",
"[",
"]",
"cipherBytes",
",",
"SecretKey",
"key",
")",
"{",
"String",
"plainText",
"=",
"null",
";",
"Security",
".",
"addProvider",
"(",
"new",
"org",
".",
"bouncycastle",
".",
"jce",
".",
"provider",
".",
... | Applies an AES decryption on the byte array {@code cipherBytes} with they given key. The key has to be the same
key used during encryption, else null is returned
@param cipherBytes the byte array to decrypt
@param key the key to use during the decryption
@return the decrypted string if everything was successful, else null | [
"Applies",
"an",
"AES",
"decryption",
"on",
"the",
"byte",
"array",
"{",
"@code",
"cipherBytes",
"}",
"with",
"they",
"given",
"key",
".",
"The",
"key",
"has",
"to",
"be",
"the",
"same",
"key",
"used",
"during",
"encryption",
"else",
"null",
"is",
"retur... | train | https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/security/SecurityFunctions.java#L73-L87 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/map/impl/mapstore/MapDataStores.java | MapDataStores.createWriteBehindStore | public static <K, V> MapDataStore<K, V> createWriteBehindStore(MapStoreContext mapStoreContext, int partitionId,
WriteBehindProcessor writeBehindProcessor) {
MapServiceContext mapServiceContext = mapStoreContext.getMapServiceContext();
NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
MapStoreConfig mapStoreConfig = mapStoreContext.getMapStoreConfig();
InternalSerializationService serializationService
= ((InternalSerializationService) nodeEngine.getSerializationService());
WriteBehindStore mapDataStore = new WriteBehindStore(mapStoreContext, partitionId, serializationService);
mapDataStore.setWriteBehindQueue(newWriteBehindQueue(mapServiceContext, mapStoreConfig.isWriteCoalescing()));
mapDataStore.setWriteBehindProcessor(writeBehindProcessor);
return (MapDataStore<K, V>) mapDataStore;
} | java | public static <K, V> MapDataStore<K, V> createWriteBehindStore(MapStoreContext mapStoreContext, int partitionId,
WriteBehindProcessor writeBehindProcessor) {
MapServiceContext mapServiceContext = mapStoreContext.getMapServiceContext();
NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
MapStoreConfig mapStoreConfig = mapStoreContext.getMapStoreConfig();
InternalSerializationService serializationService
= ((InternalSerializationService) nodeEngine.getSerializationService());
WriteBehindStore mapDataStore = new WriteBehindStore(mapStoreContext, partitionId, serializationService);
mapDataStore.setWriteBehindQueue(newWriteBehindQueue(mapServiceContext, mapStoreConfig.isWriteCoalescing()));
mapDataStore.setWriteBehindProcessor(writeBehindProcessor);
return (MapDataStore<K, V>) mapDataStore;
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"MapDataStore",
"<",
"K",
",",
"V",
">",
"createWriteBehindStore",
"(",
"MapStoreContext",
"mapStoreContext",
",",
"int",
"partitionId",
",",
"WriteBehindProcessor",
"writeBehindProcessor",
")",
"{",
"MapServiceContext",
... | Creates a write behind data store.
@param mapStoreContext context for map store operations
@param partitionId partition ID of partition
@param writeBehindProcessor the {@link WriteBehindProcessor}
@param <K> type of key to store
@param <V> type of value to store
@return new write behind store manager | [
"Creates",
"a",
"write",
"behind",
"data",
"store",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/mapstore/MapDataStores.java#L58-L69 |
yavijava/yavijava | src/main/java/com/vmware/vim25/mo/VRPResourceManager.java | VRPResourceManager.setManagedByVDC | public void setManagedByVDC(ClusterComputeResource cluster, boolean status) throws InvalidState, NotFound, RuntimeFault, RemoteException {
getVimService().setManagedByVDC(getMOR(), cluster.getMOR(), status);
} | java | public void setManagedByVDC(ClusterComputeResource cluster, boolean status) throws InvalidState, NotFound, RuntimeFault, RemoteException {
getVimService().setManagedByVDC(getMOR(), cluster.getMOR(), status);
} | [
"public",
"void",
"setManagedByVDC",
"(",
"ClusterComputeResource",
"cluster",
",",
"boolean",
"status",
")",
"throws",
"InvalidState",
",",
"NotFound",
",",
"RuntimeFault",
",",
"RemoteException",
"{",
"getVimService",
"(",
")",
".",
"setManagedByVDC",
"(",
"getMOR... | Sets whether a cluster is managed by a Virtual Datacenter. Setting this to true will prevent users from disabling
DRS for the cluster.
@param cluster Cluster object
@param status True if the cluster is managed by a Virtual Datacenter
@throws InvalidState
@throws NotFound
@throws RuntimeFault
@throws RemoteException | [
"Sets",
"whether",
"a",
"cluster",
"is",
"managed",
"by",
"a",
"Virtual",
"Datacenter",
".",
"Setting",
"this",
"to",
"true",
"will",
"prevent",
"users",
"from",
"disabling",
"DRS",
"for",
"the",
"cluster",
"."
] | train | https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/VRPResourceManager.java#L180-L182 |
JOML-CI/JOML | src/org/joml/Matrix4d.java | Matrix4d.perspectiveRect | public Matrix4d perspectiveRect(double width, double height, double zNear, double zFar, Matrix4d dest) {
return perspectiveRect(width, height, zNear, zFar, false, dest);
} | java | public Matrix4d perspectiveRect(double width, double height, double zNear, double zFar, Matrix4d dest) {
return perspectiveRect(width, height, zNear, zFar, false, dest);
} | [
"public",
"Matrix4d",
"perspectiveRect",
"(",
"double",
"width",
",",
"double",
"height",
",",
"double",
"zNear",
",",
"double",
"zFar",
",",
"Matrix4d",
"dest",
")",
"{",
"return",
"perspectiveRect",
"(",
"width",
",",
"height",
",",
"zNear",
",",
"zFar",
... | Apply a symmetric perspective projection frustum transformation for a right-handed coordinate system
using OpenGL's NDC z range of <code>[-1..+1]</code> to this matrix and store the result in <code>dest</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>P</code> the perspective projection matrix,
then the new matrix will be <code>M * P</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * P * v</code>,
the perspective projection will be applied first!
<p>
In order to set the matrix to a perspective frustum transformation without post-multiplying,
use {@link #setPerspectiveRect(double, double, double, double) setPerspectiveRect}.
@see #setPerspectiveRect(double, double, double, double)
@param width
the width of the near frustum plane
@param height
the height of the near frustum plane
@param zNear
near clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}.
@param zFar
far clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}.
@param dest
will hold the result
@return dest | [
"Apply",
"a",
"symmetric",
"perspective",
"projection",
"frustum",
"transformation",
"for",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"using",
"OpenGL",
"s",
"NDC",
"z",
"range",
"of",
"<code",
">",
"[",
"-",
"1",
"..",
"+",
"1",
"]",
"<",
"/"... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L12261-L12263 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-talent/src/main/java/com/google/cloud/talent/v4beta1/EventServiceClient.java | EventServiceClient.createClientEvent | public final ClientEvent createClientEvent(String parent, ClientEvent clientEvent) {
CreateClientEventRequest request =
CreateClientEventRequest.newBuilder().setParent(parent).setClientEvent(clientEvent).build();
return createClientEvent(request);
} | java | public final ClientEvent createClientEvent(String parent, ClientEvent clientEvent) {
CreateClientEventRequest request =
CreateClientEventRequest.newBuilder().setParent(parent).setClientEvent(clientEvent).build();
return createClientEvent(request);
} | [
"public",
"final",
"ClientEvent",
"createClientEvent",
"(",
"String",
"parent",
",",
"ClientEvent",
"clientEvent",
")",
"{",
"CreateClientEventRequest",
"request",
"=",
"CreateClientEventRequest",
".",
"newBuilder",
"(",
")",
".",
"setParent",
"(",
"parent",
")",
".... | Report events issued when end user interacts with customer's application that uses Cloud Talent
Solution. You may inspect the created events in [self service
tools](https://console.cloud.google.com/talent-solution/overview). [Learn
more](https://cloud.google.com/talent-solution/docs/management-tools) about self service tools.
<p>Sample code:
<pre><code>
try (EventServiceClient eventServiceClient = EventServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
ClientEvent clientEvent = ClientEvent.newBuilder().build();
ClientEvent response = eventServiceClient.createClientEvent(parent.toString(), clientEvent);
}
</code></pre>
@param parent Required.
<p>Resource name of the tenant under which the event is created.
<p>The format is "projects/{project_id}/tenants/{tenant_id}", for example,
"projects/api-test-project/tenant/foo".
<p>Tenant id is optional and a default tenant is created if unspecified, for example,
"projects/api-test-project".
@param clientEvent Required.
<p>Events issued when end user interacts with customer's application that uses Cloud Talent
Solution.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Report",
"events",
"issued",
"when",
"end",
"user",
"interacts",
"with",
"customer",
"s",
"application",
"that",
"uses",
"Cloud",
"Talent",
"Solution",
".",
"You",
"may",
"inspect",
"the",
"created",
"events",
"in",
"[",
"self",
"service",
"tools",
"]",
"("... | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-talent/src/main/java/com/google/cloud/talent/v4beta1/EventServiceClient.java#L213-L218 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/ListWidget.java | ListWidget.selectItem | public boolean selectItem(int dataIndex, boolean select) {
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "selectItem [%d] select [%b]", dataIndex, select);
if (dataIndex < 0 || dataIndex >= mContent.size()) {
throw new IndexOutOfBoundsException("Selection index [" + dataIndex + "] is out of bounds!");
}
updateSelectedItemsList(dataIndex, select);
ListItemHostWidget hostWidget = getHostView(dataIndex, false);
if (hostWidget != null) {
hostWidget.setSelected(select);
hostWidget.requestLayout();
return true;
}
return false;
} | java | public boolean selectItem(int dataIndex, boolean select) {
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "selectItem [%d] select [%b]", dataIndex, select);
if (dataIndex < 0 || dataIndex >= mContent.size()) {
throw new IndexOutOfBoundsException("Selection index [" + dataIndex + "] is out of bounds!");
}
updateSelectedItemsList(dataIndex, select);
ListItemHostWidget hostWidget = getHostView(dataIndex, false);
if (hostWidget != null) {
hostWidget.setSelected(select);
hostWidget.requestLayout();
return true;
}
return false;
} | [
"public",
"boolean",
"selectItem",
"(",
"int",
"dataIndex",
",",
"boolean",
"select",
")",
"{",
"Log",
".",
"d",
"(",
"Log",
".",
"SUBSYSTEM",
".",
"LAYOUT",
",",
"TAG",
",",
"\"selectItem [%d] select [%b]\"",
",",
"dataIndex",
",",
"select",
")",
";",
"if... | Select or deselect an item at position {@code pos}.
@param dataIndex
item position in the adapter
@param select
operation to perform select or deselect.
@return {@code true} if the requested operation is successful,
{@code false} otherwise. | [
"Select",
"or",
"deselect",
"an",
"item",
"at",
"position",
"{",
"@code",
"pos",
"}",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/ListWidget.java#L497-L513 |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/AbstractAuditEventMessageImpl.java | AbstractAuditEventMessageImpl.getTypeValuePair | protected TypeValuePairType getTypeValuePair(String type, byte[] value) {
TypeValuePairType tvp = new TypeValuePairType();
tvp.setType(type);
//tvp.setValue(Base64.encodeBase64Chunked(value));
// the TVP itself base64 encodes now, no need for this
tvp.setValue(value);
return tvp;
} | java | protected TypeValuePairType getTypeValuePair(String type, byte[] value) {
TypeValuePairType tvp = new TypeValuePairType();
tvp.setType(type);
//tvp.setValue(Base64.encodeBase64Chunked(value));
// the TVP itself base64 encodes now, no need for this
tvp.setValue(value);
return tvp;
} | [
"protected",
"TypeValuePairType",
"getTypeValuePair",
"(",
"String",
"type",
",",
"byte",
"[",
"]",
"value",
")",
"{",
"TypeValuePairType",
"tvp",
"=",
"new",
"TypeValuePairType",
"(",
")",
";",
"tvp",
".",
"setType",
"(",
"type",
")",
";",
"//tvp.setValue(Bas... | Create and set a Type Value Pair instance for a given type and value
@param type The type to set
@param value The value to set
@return The Type Value Pair instance | [
"Create",
"and",
"set",
"a",
"Type",
"Value",
"Pair",
"instance",
"for",
"a",
"given",
"type",
"and",
"value"
] | train | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/AbstractAuditEventMessageImpl.java#L423-L430 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeysInner.java | ServerKeysInner.createOrUpdate | public ServerKeyInner createOrUpdate(String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, keyName, parameters).toBlocking().last().body();
} | java | public ServerKeyInner createOrUpdate(String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, keyName, parameters).toBlocking().last().body();
} | [
"public",
"ServerKeyInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"keyName",
",",
"ServerKeyInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serv... | Creates or updates a server key.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param keyName The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901
@param parameters The requested server key resource state.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ServerKeyInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"server",
"key",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeysInner.java#L322-L324 |
ibm-bluemix-mobile-services/bms-clientsdk-android-core | lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/api/MCAAuthorizationManager.java | MCAAuthorizationManager.createInstance | public static synchronized MCAAuthorizationManager createInstance(Context context, String tenantId, String bluemixRegion) {
instance = createInstance(context, tenantId);
if (null != bluemixRegion) {
instance.bluemixRegionSuffix = bluemixRegion;
}
return instance;
} | java | public static synchronized MCAAuthorizationManager createInstance(Context context, String tenantId, String bluemixRegion) {
instance = createInstance(context, tenantId);
if (null != bluemixRegion) {
instance.bluemixRegionSuffix = bluemixRegion;
}
return instance;
} | [
"public",
"static",
"synchronized",
"MCAAuthorizationManager",
"createInstance",
"(",
"Context",
"context",
",",
"String",
"tenantId",
",",
"String",
"bluemixRegion",
")",
"{",
"instance",
"=",
"createInstance",
"(",
"context",
",",
"tenantId",
")",
";",
"if",
"("... | Init singleton instance with context, tenantId and Bluemix region.
@param context Application context
@param tenantId the unique tenant id of the MCA service instance that the application connects to.
@param bluemixRegion Specifies the Bluemix deployment to use.
@return The singleton instance | [
"Init",
"singleton",
"instance",
"with",
"context",
"tenantId",
"and",
"Bluemix",
"region",
"."
] | train | https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core/blob/8db4f00d0d564792397bfc0e5bd57d52a238b858/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/api/MCAAuthorizationManager.java#L116-L123 |
rzwitserloot/lombok | src/core/lombok/core/handlers/HandlerUtil.java | HandlerUtil.toWitherName | public static String toWitherName(AST<?, ?, ?> ast, AnnotationValues<Accessors> accessors, CharSequence fieldName, boolean isBoolean) {
return toAccessorName(ast, accessors, fieldName, isBoolean, "with", "with", false);
} | java | public static String toWitherName(AST<?, ?, ?> ast, AnnotationValues<Accessors> accessors, CharSequence fieldName, boolean isBoolean) {
return toAccessorName(ast, accessors, fieldName, isBoolean, "with", "with", false);
} | [
"public",
"static",
"String",
"toWitherName",
"(",
"AST",
"<",
"?",
",",
"?",
",",
"?",
">",
"ast",
",",
"AnnotationValues",
"<",
"Accessors",
">",
"accessors",
",",
"CharSequence",
"fieldName",
",",
"boolean",
"isBoolean",
")",
"{",
"return",
"toAccessorNam... | Generates a wither name from a given field name.
Strategy:
<ul>
<li>Reduce the field's name to its base name by stripping off any prefix (from {@code Accessors}). If the field name does not fit
the prefix list, this method immediately returns {@code null}.</li>
<li>Only if {@code isBoolean} is true: Check if the field starts with {@code is} followed by a non-lowercase character.
If so, replace {@code is} with {@code with} and return that.</li>
<li>Check if the first character of the field is lowercase. If so, check if the second character
exists and is title or upper case. If so, uppercase the first character. If not, titlecase the first character.</li>
<li>Return {@code "with"} plus the possibly title/uppercased first character, and the rest of the field name.</li>
</ul>
@param accessors Accessors configuration.
@param fieldName the name of the field.
@param isBoolean if the field is of type 'boolean'. For fields of type {@code java.lang.Boolean}, you should provide {@code false}.
@return The wither name for this field, or {@code null} if this field does not fit expected patterns and therefore cannot be turned into a getter name. | [
"Generates",
"a",
"wither",
"name",
"from",
"a",
"given",
"field",
"name",
"."
] | train | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/core/handlers/HandlerUtil.java#L519-L521 |
casmi/casmi | src/main/java/casmi/image/Image.java | Image.getRed | public final double getRed(int x, int y) {
int[] pixels = ((DataBufferInt)img.getRaster().getDataBuffer()).getData();
int idx = x + y * width;
return (pixels[idx] >> 16 & 0x000000ff);
} | java | public final double getRed(int x, int y) {
int[] pixels = ((DataBufferInt)img.getRaster().getDataBuffer()).getData();
int idx = x + y * width;
return (pixels[idx] >> 16 & 0x000000ff);
} | [
"public",
"final",
"double",
"getRed",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"int",
"[",
"]",
"pixels",
"=",
"(",
"(",
"DataBufferInt",
")",
"img",
".",
"getRaster",
"(",
")",
".",
"getDataBuffer",
"(",
")",
")",
".",
"getData",
"(",
")",
"... | Returns the red color value of the pixel data in this Image.
@param x
The x-coordinate of the pixel.
@param y
The y-coordinate of the pixel.
@return
The red color value of the pixel. | [
"Returns",
"the",
"red",
"color",
"value",
"of",
"the",
"pixel",
"data",
"in",
"this",
"Image",
"."
] | train | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/image/Image.java#L271-L276 |
aws/aws-sdk-java | src/samples/AmazonEC2SpotInstances-Advanced/Requests.java | Requests.init | private void init(String instanceType, String amiID, String bidPrice, String securityGroup) throws Exception {
/*
* The ProfileCredentialsProvider will return your [default]
* credential profile by reading from the credentials file located at
* (~/.aws/credentials).
*/
AWSCredentials credentials = null;
try {
credentials = new ProfileCredentialsProvider().getCredentials();
} catch (Exception e) {
throw new AmazonClientException(
"Cannot load the credentials from the credential profiles file. " +
"Please make sure that your credentials file is at the correct " +
"location (~/.aws/credentials), and is in valid format.",
e);
}
ec2 = AmazonEC2ClientBuilder.standard()
.withCredentials(new AWSStaticCredentialsProvider(credentials))
.withRegion("us-west-2")
.build();
this.instanceType = instanceType;
this.amiID = amiID;
this.bidPrice = bidPrice;
this.securityGroup = securityGroup;
this.deleteOnTermination = true;
this.placementGroupName = null;
} | java | private void init(String instanceType, String amiID, String bidPrice, String securityGroup) throws Exception {
/*
* The ProfileCredentialsProvider will return your [default]
* credential profile by reading from the credentials file located at
* (~/.aws/credentials).
*/
AWSCredentials credentials = null;
try {
credentials = new ProfileCredentialsProvider().getCredentials();
} catch (Exception e) {
throw new AmazonClientException(
"Cannot load the credentials from the credential profiles file. " +
"Please make sure that your credentials file is at the correct " +
"location (~/.aws/credentials), and is in valid format.",
e);
}
ec2 = AmazonEC2ClientBuilder.standard()
.withCredentials(new AWSStaticCredentialsProvider(credentials))
.withRegion("us-west-2")
.build();
this.instanceType = instanceType;
this.amiID = amiID;
this.bidPrice = bidPrice;
this.securityGroup = securityGroup;
this.deleteOnTermination = true;
this.placementGroupName = null;
} | [
"private",
"void",
"init",
"(",
"String",
"instanceType",
",",
"String",
"amiID",
",",
"String",
"bidPrice",
",",
"String",
"securityGroup",
")",
"throws",
"Exception",
"{",
"/*\r\n * The ProfileCredentialsProvider will return your [default]\r\n * credential pro... | The only information needed to create a client are security credentials
consisting of the AWS Access Key ID and Secret Access Key. All other
configuration, such as the service endpoints, are performed
automatically. Client parameters, such as proxies, can be specified in an
optional ClientConfiguration object when constructing a client.
@see com.amazonaws.auth.BasicAWSCredentials
@see com.amazonaws.auth.PropertiesCredentials
@see com.amazonaws.ClientConfiguration | [
"The",
"only",
"information",
"needed",
"to",
"create",
"a",
"client",
"are",
"security",
"credentials",
"consisting",
"of",
"the",
"AWS",
"Access",
"Key",
"ID",
"and",
"Secret",
"Access",
"Key",
".",
"All",
"other",
"configuration",
"such",
"as",
"the",
"se... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/src/samples/AmazonEC2SpotInstances-Advanced/Requests.java#L82-L110 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/dataflow/ImportNodeData.java | ImportNodeData.createNodeData | public static ImportNodeData createNodeData(NodeData parent, InternalQName name, InternalQName primaryTypeName,
int index, int orderNumber)
{
ImportNodeData nodeData = null;
QPath path = QPath.makeChildPath(parent.getQPath(), name, index);
nodeData =
new ImportNodeData(path, IdGenerator.generate(), -1, primaryTypeName, new InternalQName[0], orderNumber,
parent.getIdentifier(), parent.getACL());
return nodeData;
} | java | public static ImportNodeData createNodeData(NodeData parent, InternalQName name, InternalQName primaryTypeName,
int index, int orderNumber)
{
ImportNodeData nodeData = null;
QPath path = QPath.makeChildPath(parent.getQPath(), name, index);
nodeData =
new ImportNodeData(path, IdGenerator.generate(), -1, primaryTypeName, new InternalQName[0], orderNumber,
parent.getIdentifier(), parent.getACL());
return nodeData;
} | [
"public",
"static",
"ImportNodeData",
"createNodeData",
"(",
"NodeData",
"parent",
",",
"InternalQName",
"name",
",",
"InternalQName",
"primaryTypeName",
",",
"int",
"index",
",",
"int",
"orderNumber",
")",
"{",
"ImportNodeData",
"nodeData",
"=",
"null",
";",
"QPa... | Factory method
@param parent NodeData
@param name InternalQName
@param primaryTypeName InternalQName
@param index int
@param orderNumber int
@return | [
"Factory",
"method"
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/dataflow/ImportNodeData.java#L396-L405 |
JodaOrg/joda-time | src/main/java/org/joda/time/Interval.java | Interval.withDurationBeforeEnd | public Interval withDurationBeforeEnd(ReadableDuration duration) {
long durationMillis = DateTimeUtils.getDurationMillis(duration);
if (durationMillis == toDurationMillis()) {
return this;
}
Chronology chrono = getChronology();
long endMillis = getEndMillis();
long startMillis = chrono.add(endMillis, durationMillis, -1);
return new Interval(startMillis, endMillis, chrono);
} | java | public Interval withDurationBeforeEnd(ReadableDuration duration) {
long durationMillis = DateTimeUtils.getDurationMillis(duration);
if (durationMillis == toDurationMillis()) {
return this;
}
Chronology chrono = getChronology();
long endMillis = getEndMillis();
long startMillis = chrono.add(endMillis, durationMillis, -1);
return new Interval(startMillis, endMillis, chrono);
} | [
"public",
"Interval",
"withDurationBeforeEnd",
"(",
"ReadableDuration",
"duration",
")",
"{",
"long",
"durationMillis",
"=",
"DateTimeUtils",
".",
"getDurationMillis",
"(",
"duration",
")",
";",
"if",
"(",
"durationMillis",
"==",
"toDurationMillis",
"(",
")",
")",
... | Creates a new interval with the specified duration before the end instant.
@param duration the duration to subtract from the end to get the new start instant, null means zero
@return an interval with the end from this interval and a calculated start
@throws IllegalArgumentException if the duration is negative | [
"Creates",
"a",
"new",
"interval",
"with",
"the",
"specified",
"duration",
"before",
"the",
"end",
"instant",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Interval.java#L516-L525 |
google/closure-templates | java/src/com/google/template/soy/jbcsrc/restricted/Expression.java | Expression.asNonNullable | public Expression asNonNullable() {
if (isNonNullable()) {
return this;
}
return new Expression(resultType, features.plus(Feature.NON_NULLABLE)) {
@Override
protected void doGen(CodeBuilder adapter) {
Expression.this.gen(adapter);
}
};
} | java | public Expression asNonNullable() {
if (isNonNullable()) {
return this;
}
return new Expression(resultType, features.plus(Feature.NON_NULLABLE)) {
@Override
protected void doGen(CodeBuilder adapter) {
Expression.this.gen(adapter);
}
};
} | [
"public",
"Expression",
"asNonNullable",
"(",
")",
"{",
"if",
"(",
"isNonNullable",
"(",
")",
")",
"{",
"return",
"this",
";",
"}",
"return",
"new",
"Expression",
"(",
"resultType",
",",
"features",
".",
"plus",
"(",
"Feature",
".",
"NON_NULLABLE",
")",
... | Returns an equivalent expression where {@link #isNonNullable()} returns {@code true}. | [
"Returns",
"an",
"equivalent",
"expression",
"where",
"{"
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/Expression.java#L312-L322 |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/location/S2SLocationServiceImpl.java | S2SLocationServiceImpl.getStateFromName | @Override
public StateContract getStateFromName(String countryAlternateCode, String stateName) {
CountryContract country = getCountryFromCode(countryAlternateCode);
return getKcStateService().getState(country.getCode(), stateName);
} | java | @Override
public StateContract getStateFromName(String countryAlternateCode, String stateName) {
CountryContract country = getCountryFromCode(countryAlternateCode);
return getKcStateService().getState(country.getCode(), stateName);
} | [
"@",
"Override",
"public",
"StateContract",
"getStateFromName",
"(",
"String",
"countryAlternateCode",
",",
"String",
"stateName",
")",
"{",
"CountryContract",
"country",
"=",
"getCountryFromCode",
"(",
"countryAlternateCode",
")",
";",
"return",
"getKcStateService",
"(... | This method is to get a State object from the state name
@param stateName Name of the state
@return State object matching the name. | [
"This",
"method",
"is",
"to",
"get",
"a",
"State",
"object",
"from",
"the",
"state",
"name"
] | train | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/location/S2SLocationServiceImpl.java#L65-L70 |
OpenVidu/openvidu | openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/MediaEndpoint.java | MediaEndpoint.addIceCandidate | public synchronized void addIceCandidate(IceCandidate candidate) throws OpenViduException {
if (!this.isWeb()) {
throw new OpenViduException(Code.MEDIA_NOT_A_WEB_ENDPOINT_ERROR_CODE, "Operation not supported");
}
if (webEndpoint == null) {
candidates.addLast(candidate);
} else {
internalAddIceCandidate(candidate);
}
} | java | public synchronized void addIceCandidate(IceCandidate candidate) throws OpenViduException {
if (!this.isWeb()) {
throw new OpenViduException(Code.MEDIA_NOT_A_WEB_ENDPOINT_ERROR_CODE, "Operation not supported");
}
if (webEndpoint == null) {
candidates.addLast(candidate);
} else {
internalAddIceCandidate(candidate);
}
} | [
"public",
"synchronized",
"void",
"addIceCandidate",
"(",
"IceCandidate",
"candidate",
")",
"throws",
"OpenViduException",
"{",
"if",
"(",
"!",
"this",
".",
"isWeb",
"(",
")",
")",
"{",
"throw",
"new",
"OpenViduException",
"(",
"Code",
".",
"MEDIA_NOT_A_WEB_ENDP... | Add a new {@link IceCandidate} received gathered by the remote peer of this
{@link WebRtcEndpoint}.
@param candidate the remote candidate | [
"Add",
"a",
"new",
"{",
"@link",
"IceCandidate",
"}",
"received",
"gathered",
"by",
"the",
"remote",
"peer",
"of",
"this",
"{",
"@link",
"WebRtcEndpoint",
"}",
"."
] | train | https://github.com/OpenVidu/openvidu/blob/89db47dd37949ceab29e5228371a8fcab04d8d55/openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/MediaEndpoint.java#L300-L309 |
prestodb/presto | presto-main/src/main/java/com/facebook/presto/operator/aggregation/NumericHistogram.java | NumericHistogram.initializeQueue | private static PriorityQueue<Entry> initializeQueue(double[] values, double[] weights, int nextIndex)
{
checkArgument(nextIndex > 0, "nextIndex must be > 0");
PriorityQueue<Entry> queue = new PriorityQueue<>(nextIndex);
Entry right = new Entry(nextIndex - 1, values[nextIndex - 1], weights[nextIndex - 1], null);
queue.add(right);
for (int i = nextIndex - 2; i >= 0; i--) {
Entry current = new Entry(i, values[i], weights[i], right);
queue.add(current);
right = current;
}
return queue;
} | java | private static PriorityQueue<Entry> initializeQueue(double[] values, double[] weights, int nextIndex)
{
checkArgument(nextIndex > 0, "nextIndex must be > 0");
PriorityQueue<Entry> queue = new PriorityQueue<>(nextIndex);
Entry right = new Entry(nextIndex - 1, values[nextIndex - 1], weights[nextIndex - 1], null);
queue.add(right);
for (int i = nextIndex - 2; i >= 0; i--) {
Entry current = new Entry(i, values[i], weights[i], right);
queue.add(current);
right = current;
}
return queue;
} | [
"private",
"static",
"PriorityQueue",
"<",
"Entry",
">",
"initializeQueue",
"(",
"double",
"[",
"]",
"values",
",",
"double",
"[",
"]",
"weights",
",",
"int",
"nextIndex",
")",
"{",
"checkArgument",
"(",
"nextIndex",
">",
"0",
",",
"\"nextIndex must be > 0\"",... | Create a priority queue with an entry for each bucket, ordered by the penalty score with respect to the bucket to its right
The inputs must be sorted by "value" in increasing order
The last bucket has a penalty of infinity
Entries are doubly-linked to keep track of the relative position of each bucket | [
"Create",
"a",
"priority",
"queue",
"with",
"an",
"entry",
"for",
"each",
"bucket",
"ordered",
"by",
"the",
"penalty",
"score",
"with",
"respect",
"to",
"the",
"bucket",
"to",
"its",
"right",
"The",
"inputs",
"must",
"be",
"sorted",
"by",
"value",
"in",
... | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/aggregation/NumericHistogram.java#L271-L286 |
stratosphere/stratosphere | stratosphere-compiler/src/main/java/eu/stratosphere/compiler/dataproperties/RequestedGlobalProperties.java | RequestedGlobalProperties.parameterizeChannel | public void parameterizeChannel(Channel channel, boolean globalDopChange, boolean localDopChange) {
// if we request nothing, then we need no special strategy. forward, if the number of instances remains
// the same, randomly repartition otherwise
if (isTrivial()) {
channel.setShipStrategy(globalDopChange ? ShipStrategyType.PARTITION_RANDOM : ShipStrategyType.FORWARD);
return;
}
final GlobalProperties inGlobals = channel.getSource().getGlobalProperties();
// if we have no global parallelism change, check if we have already compatible global properties
if (!globalDopChange && isMetBy(inGlobals)) {
if (localDopChange) {
// if the local degree of parallelism changes, we need to adjust
if (inGlobals.getPartitioning() == PartitioningProperty.HASH_PARTITIONED) {
// to preserve the hash partitioning, we need to locally hash re-partition
channel.setShipStrategy(ShipStrategyType.PARTITION_LOCAL_HASH, inGlobals.getPartitioningFields());
return;
}
// else fall though
} else {
// we meet already everything, so go forward
channel.setShipStrategy(ShipStrategyType.FORWARD);
return;
}
}
// if we fall through the conditions until here, we need to re-establish
switch (this.partitioning) {
case FULL_REPLICATION:
channel.setShipStrategy(ShipStrategyType.BROADCAST);
break;
case ANY_PARTITIONING:
case HASH_PARTITIONED:
channel.setShipStrategy(ShipStrategyType.PARTITION_HASH, Utils.createOrderedFromSet(this.partitioningFields));
break;
case RANGE_PARTITIONED:
channel.setShipStrategy(ShipStrategyType.PARTITION_RANGE, this.ordering.getInvolvedIndexes(), this.ordering.getFieldSortDirections());
if(this.dataDistribution != null) {
channel.setDataDistribution(this.dataDistribution);
}
break;
default:
throw new CompilerException();
}
} | java | public void parameterizeChannel(Channel channel, boolean globalDopChange, boolean localDopChange) {
// if we request nothing, then we need no special strategy. forward, if the number of instances remains
// the same, randomly repartition otherwise
if (isTrivial()) {
channel.setShipStrategy(globalDopChange ? ShipStrategyType.PARTITION_RANDOM : ShipStrategyType.FORWARD);
return;
}
final GlobalProperties inGlobals = channel.getSource().getGlobalProperties();
// if we have no global parallelism change, check if we have already compatible global properties
if (!globalDopChange && isMetBy(inGlobals)) {
if (localDopChange) {
// if the local degree of parallelism changes, we need to adjust
if (inGlobals.getPartitioning() == PartitioningProperty.HASH_PARTITIONED) {
// to preserve the hash partitioning, we need to locally hash re-partition
channel.setShipStrategy(ShipStrategyType.PARTITION_LOCAL_HASH, inGlobals.getPartitioningFields());
return;
}
// else fall though
} else {
// we meet already everything, so go forward
channel.setShipStrategy(ShipStrategyType.FORWARD);
return;
}
}
// if we fall through the conditions until here, we need to re-establish
switch (this.partitioning) {
case FULL_REPLICATION:
channel.setShipStrategy(ShipStrategyType.BROADCAST);
break;
case ANY_PARTITIONING:
case HASH_PARTITIONED:
channel.setShipStrategy(ShipStrategyType.PARTITION_HASH, Utils.createOrderedFromSet(this.partitioningFields));
break;
case RANGE_PARTITIONED:
channel.setShipStrategy(ShipStrategyType.PARTITION_RANGE, this.ordering.getInvolvedIndexes(), this.ordering.getFieldSortDirections());
if(this.dataDistribution != null) {
channel.setDataDistribution(this.dataDistribution);
}
break;
default:
throw new CompilerException();
}
} | [
"public",
"void",
"parameterizeChannel",
"(",
"Channel",
"channel",
",",
"boolean",
"globalDopChange",
",",
"boolean",
"localDopChange",
")",
"{",
"// if we request nothing, then we need no special strategy. forward, if the number of instances remains",
"// the same, randomly repartiti... | Parameterizes the ship strategy fields of a channel such that the channel produces the desired global properties.
@param channel The channel to parameterize.
@param globalDopChange
@param localDopChange | [
"Parameterizes",
"the",
"ship",
"strategy",
"fields",
"of",
"a",
"channel",
"such",
"that",
"the",
"channel",
"produces",
"the",
"desired",
"global",
"properties",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-compiler/src/main/java/eu/stratosphere/compiler/dataproperties/RequestedGlobalProperties.java#L223-L268 |
wigforss/Ka-Commons-Reflection | src/main/java/org/kasource/commons/reflection/util/AnnotationScanner.java | AnnotationScanner.addClass | @SuppressWarnings("unchecked")
private <T> void addClass(Set<Class<? extends T>> classes,
String includeRegExp,
String className,
Class<T> ofType,
Class<? extends Annotation> annotationClass) {
if (className.matches(includeRegExp)) {
try {
Class<?> matchingClass = Class.forName(className);
matchingClass.asSubclass(ofType);
classes.add((Class<T>) matchingClass);
} catch (ClassNotFoundException cnfe) {
throw new IllegalStateException("Scannotation found a class that does not exist " + className + " !", cnfe);
} catch (ClassCastException cce) {
throw new IllegalStateException("Class " + className
+ " is annoted with @"+annotationClass+" but does not extend or implement "+ofType);
}
}
} | java | @SuppressWarnings("unchecked")
private <T> void addClass(Set<Class<? extends T>> classes,
String includeRegExp,
String className,
Class<T> ofType,
Class<? extends Annotation> annotationClass) {
if (className.matches(includeRegExp)) {
try {
Class<?> matchingClass = Class.forName(className);
matchingClass.asSubclass(ofType);
classes.add((Class<T>) matchingClass);
} catch (ClassNotFoundException cnfe) {
throw new IllegalStateException("Scannotation found a class that does not exist " + className + " !", cnfe);
} catch (ClassCastException cce) {
throw new IllegalStateException("Class " + className
+ " is annoted with @"+annotationClass+" but does not extend or implement "+ofType);
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"<",
"T",
">",
"void",
"addClass",
"(",
"Set",
"<",
"Class",
"<",
"?",
"extends",
"T",
">",
">",
"classes",
",",
"String",
"includeRegExp",
",",
"String",
"className",
",",
"Class",
"<",
"T",... | Created and adds the event to the eventsFound set, if its package matches the includeRegExp.
@param eventBuilderFactory Event Factory used to create the EventConfig instance with.
@param eventsFound Set of events found, to add the newly created EventConfig to.
@param includeRegExp Regular expression to test eventClassName with.
@param eventClassName Name of the class. | [
"Created",
"and",
"adds",
"the",
"event",
"to",
"the",
"eventsFound",
"set",
"if",
"its",
"package",
"matches",
"the",
"includeRegExp",
"."
] | train | https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/util/AnnotationScanner.java#L70-L89 |
padrig64/ValidationFramework | validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/IconComponentDecoration.java | IconComponentDecoration.createToolTipDialogIfNeeded | private void createToolTipDialogIfNeeded() {
// Not need to create the dialog if there is not text to show
if ((toolTipDialog == null) && (toolTipText != null) && !toolTipText.isEmpty()) {
toolTipDialog = new ToolTipDialog(decorationPainter, anchorLinkWithToolTip);
toolTipDialog.addMouseListener(toolTipVisibilityAdapter);
toolTipDialog.addMouseMotionListener(toolTipVisibilityAdapter);
toolTipDialog.addComponentListener(toolTipVisibilityAdapter);
}
// But if there is (already) a dialog, update it with the text
if (toolTipDialog != null) {
toolTipDialog.setText(toolTipText);
}
} | java | private void createToolTipDialogIfNeeded() {
// Not need to create the dialog if there is not text to show
if ((toolTipDialog == null) && (toolTipText != null) && !toolTipText.isEmpty()) {
toolTipDialog = new ToolTipDialog(decorationPainter, anchorLinkWithToolTip);
toolTipDialog.addMouseListener(toolTipVisibilityAdapter);
toolTipDialog.addMouseMotionListener(toolTipVisibilityAdapter);
toolTipDialog.addComponentListener(toolTipVisibilityAdapter);
}
// But if there is (already) a dialog, update it with the text
if (toolTipDialog != null) {
toolTipDialog.setText(toolTipText);
}
} | [
"private",
"void",
"createToolTipDialogIfNeeded",
"(",
")",
"{",
"// Not need to create the dialog if there is not text to show",
"if",
"(",
"(",
"toolTipDialog",
"==",
"null",
")",
"&&",
"(",
"toolTipText",
"!=",
"null",
")",
"&&",
"!",
"toolTipText",
".",
"isEmpty",... | Creates the dialog showing the tooltip if it is not created yet.
<p>
We do this only here to make sure that we have a parent and to make sure that we actually have a window
ancestor.
<p>
If we create the dialog before having a window ancestor, it will have no owner (see {@link
ToolTipDialog#ToolTipDialog(JComponent, AnchorLink)} and that will result in having the tooltip behind the
other windows of the application. | [
"Creates",
"the",
"dialog",
"showing",
"the",
"tooltip",
"if",
"it",
"is",
"not",
"created",
"yet",
".",
"<p",
">",
"We",
"do",
"this",
"only",
"here",
"to",
"make",
"sure",
"that",
"we",
"have",
"a",
"parent",
"and",
"to",
"make",
"sure",
"that",
"w... | train | https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/IconComponentDecoration.java#L356-L369 |
davetcc/tcMenu | tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/AnalogMenuItem.java | AnalogMenuItem.newMenuState | @Override
public MenuState<Integer> newMenuState(Integer value, boolean changed, boolean active) {
return new IntegerMenuState(changed, active, value);
} | java | @Override
public MenuState<Integer> newMenuState(Integer value, boolean changed, boolean active) {
return new IntegerMenuState(changed, active, value);
} | [
"@",
"Override",
"public",
"MenuState",
"<",
"Integer",
">",
"newMenuState",
"(",
"Integer",
"value",
",",
"boolean",
"changed",
",",
"boolean",
"active",
")",
"{",
"return",
"new",
"IntegerMenuState",
"(",
"changed",
",",
"active",
",",
"value",
")",
";",
... | returns a new state object that represents the current value for the menu. Current values are
held separately to the items, see MenuTree
@param value the new value
@param changed if the value has changed
@param active if the menu item is active, can be used for your own purposes.
@return | [
"returns",
"a",
"new",
"state",
"object",
"that",
"represents",
"the",
"current",
"value",
"for",
"the",
"menu",
".",
"Current",
"values",
"are",
"held",
"separately",
"to",
"the",
"items",
"see",
"MenuTree"
] | train | https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/AnalogMenuItem.java#L85-L88 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java | HtmlDocWriter.getDocLink | public DocLink getDocLink(SectionName sectionName, String where) {
return DocLink.fragment(sectionName.getName() + getName(where));
} | java | public DocLink getDocLink(SectionName sectionName, String where) {
return DocLink.fragment(sectionName.getName() + getName(where));
} | [
"public",
"DocLink",
"getDocLink",
"(",
"SectionName",
"sectionName",
",",
"String",
"where",
")",
"{",
"return",
"DocLink",
".",
"fragment",
"(",
"sectionName",
".",
"getName",
"(",
")",
"+",
"getName",
"(",
"where",
")",
")",
";",
"}"
] | Get the link.
@param sectionName The section name combined with where to which the link
will be created.
@param where The fragment combined with sectionName to which the link
will be created.
@return a DocLink object for the hyper link | [
"Get",
"the",
"link",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java#L155-L157 |
mygreen/excel-cellformatter | src/main/java/com/github/mygreen/cellformatter/lang/MessageResolver.java | MessageResolver.getMessage | public String getMessage(final MSLocale locale, final String key, final String defaultValue) {
String message = getMessage(locale, key);
return message == null ? defaultValue : message;
} | java | public String getMessage(final MSLocale locale, final String key, final String defaultValue) {
String message = getMessage(locale, key);
return message == null ? defaultValue : message;
} | [
"public",
"String",
"getMessage",
"(",
"final",
"MSLocale",
"locale",
",",
"final",
"String",
"key",
",",
"final",
"String",
"defaultValue",
")",
"{",
"String",
"message",
"=",
"getMessage",
"(",
"locale",
",",
"key",
")",
";",
"return",
"message",
"==",
"... | ロケールとキーを指定してメッセージを取得する。
@param locale ロケール
@param key メッセージキー
@param defaultValue
@return 該当するロケールのメッセージが見つからない場合は、引数で指定した'defaultValue'の値を返す。 | [
"ロケールとキーを指定してメッセージを取得する。"
] | train | https://github.com/mygreen/excel-cellformatter/blob/e802af273d49889500591e03799c9262cbf29185/src/main/java/com/github/mygreen/cellformatter/lang/MessageResolver.java#L300-L303 |
paypal/SeLion | client/src/main/java/com/paypal/selion/internal/reports/runtimereport/JsonRuntimeReporterHelper.java | JsonRuntimeReporterHelper.generateLocalConfigSummary | public void generateLocalConfigSummary(String suiteName, String testName) {
logger.entering(new Object[] { suiteName, testName });
try {
Map<String, String> testLocalConfigValues = ConfigSummaryData.getLocalConfigSummary(testName);
JsonObject json = new JsonObject();
if (testLocalConfigValues == null) {
json.addProperty(ReporterDateFormatter.CURRENTDATE, ReporterDateFormatter.getISO8601String(new Date()));
} else {
for (Entry<String, String> temp : testLocalConfigValues.entrySet()) {
json.addProperty(temp.getKey(), temp.getValue());
}
}
json.addProperty("suite", suiteName);
json.addProperty("test", testName);
// Sometimes json objects getting null value when data provider parallelism enabled
// To solve this added synchronized block
synchronized (this) {
this.testJsonLocalConfigSummary.add(json);
}
} catch (JsonParseException e) {
logger.log(Level.SEVERE, e.getMessage(), e);
throw new ReporterException(e);
}
logger.exiting();
} | java | public void generateLocalConfigSummary(String suiteName, String testName) {
logger.entering(new Object[] { suiteName, testName });
try {
Map<String, String> testLocalConfigValues = ConfigSummaryData.getLocalConfigSummary(testName);
JsonObject json = new JsonObject();
if (testLocalConfigValues == null) {
json.addProperty(ReporterDateFormatter.CURRENTDATE, ReporterDateFormatter.getISO8601String(new Date()));
} else {
for (Entry<String, String> temp : testLocalConfigValues.entrySet()) {
json.addProperty(temp.getKey(), temp.getValue());
}
}
json.addProperty("suite", suiteName);
json.addProperty("test", testName);
// Sometimes json objects getting null value when data provider parallelism enabled
// To solve this added synchronized block
synchronized (this) {
this.testJsonLocalConfigSummary.add(json);
}
} catch (JsonParseException e) {
logger.log(Level.SEVERE, e.getMessage(), e);
throw new ReporterException(e);
}
logger.exiting();
} | [
"public",
"void",
"generateLocalConfigSummary",
"(",
"String",
"suiteName",
",",
"String",
"testName",
")",
"{",
"logger",
".",
"entering",
"(",
"new",
"Object",
"[",
"]",
"{",
"suiteName",
",",
"testName",
"}",
")",
";",
"try",
"{",
"Map",
"<",
"String",
... | This method will generate local Configuration summary by fetching the details from ReportDataGenerator
@param suiteName
suite name of the test method.
@param testName
test name of the test method. | [
"This",
"method",
"will",
"generate",
"local",
"Configuration",
"summary",
"by",
"fetching",
"the",
"details",
"from",
"ReportDataGenerator"
] | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/internal/reports/runtimereport/JsonRuntimeReporterHelper.java#L124-L152 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/RegionOperationId.java | RegionOperationId.of | public static RegionOperationId of(String region, String operation) {
return new RegionOperationId(null, region, operation);
} | java | public static RegionOperationId of(String region, String operation) {
return new RegionOperationId(null, region, operation);
} | [
"public",
"static",
"RegionOperationId",
"of",
"(",
"String",
"region",
",",
"String",
"operation",
")",
"{",
"return",
"new",
"RegionOperationId",
"(",
"null",
",",
"region",
",",
"operation",
")",
";",
"}"
] | Returns a region operation identity given the region and operation names. | [
"Returns",
"a",
"region",
"operation",
"identity",
"given",
"the",
"region",
"and",
"operation",
"names",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/RegionOperationId.java#L96-L98 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/FastHessianFeatureDetector.java | FastHessianFeatureDetector.detectOctave | protected void detectOctave( II integral , int skip , int ...featureSize ) {
int w = integral.width/skip;
int h = integral.height/skip;
// resize the output intensity image taking in account subsampling
for( int i = 0; i < intensity.length; i++ ) {
intensity[i].reshape(w,h);
}
// compute feature intensity in each level
for( int i = 0; i < featureSize.length; i++ ) {
GIntegralImageFeatureIntensity.hessian(integral,skip,featureSize[i],intensity[spaceIndex]);
spaceIndex++;
if( spaceIndex >= 3 )
spaceIndex = 0;
// find maximum in scale space
if( i >= 2 ) {
findLocalScaleSpaceMax(featureSize,i-1,skip);
}
}
} | java | protected void detectOctave( II integral , int skip , int ...featureSize ) {
int w = integral.width/skip;
int h = integral.height/skip;
// resize the output intensity image taking in account subsampling
for( int i = 0; i < intensity.length; i++ ) {
intensity[i].reshape(w,h);
}
// compute feature intensity in each level
for( int i = 0; i < featureSize.length; i++ ) {
GIntegralImageFeatureIntensity.hessian(integral,skip,featureSize[i],intensity[spaceIndex]);
spaceIndex++;
if( spaceIndex >= 3 )
spaceIndex = 0;
// find maximum in scale space
if( i >= 2 ) {
findLocalScaleSpaceMax(featureSize,i-1,skip);
}
}
} | [
"protected",
"void",
"detectOctave",
"(",
"II",
"integral",
",",
"int",
"skip",
",",
"int",
"...",
"featureSize",
")",
"{",
"int",
"w",
"=",
"integral",
".",
"width",
"/",
"skip",
";",
"int",
"h",
"=",
"integral",
".",
"height",
"/",
"skip",
";",
"//... | Computes feature intensities for all the specified feature sizes and finds features
inside of the middle feature sizes.
@param integral Integral image.
@param skip Pixel skip factor
@param featureSize which feature sizes should be detected. | [
"Computes",
"feature",
"intensities",
"for",
"all",
"the",
"specified",
"feature",
"sizes",
"and",
"finds",
"features",
"inside",
"of",
"the",
"middle",
"feature",
"sizes",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/FastHessianFeatureDetector.java#L198-L221 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/CustomVisionTrainingManager.java | CustomVisionTrainingManager.authenticate | public static TrainingApi authenticate(String baseUrl, ServiceClientCredentials credentials, final String apiKey) {
return new TrainingApiImpl(baseUrl, credentials).withApiKey(apiKey);
} | java | public static TrainingApi authenticate(String baseUrl, ServiceClientCredentials credentials, final String apiKey) {
return new TrainingApiImpl(baseUrl, credentials).withApiKey(apiKey);
} | [
"public",
"static",
"TrainingApi",
"authenticate",
"(",
"String",
"baseUrl",
",",
"ServiceClientCredentials",
"credentials",
",",
"final",
"String",
"apiKey",
")",
"{",
"return",
"new",
"TrainingApiImpl",
"(",
"baseUrl",
",",
"credentials",
")",
".",
"withApiKey",
... | Initializes an instance of Custom Vision Training API client.
@param baseUrl the base URL of the service
@param credentials the management credentials for Azure
@param apiKey the Custom Vision Training API key
@return the Custom Vision Training API client | [
"Initializes",
"an",
"instance",
"of",
"Custom",
"Vision",
"Training",
"API",
"client",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/CustomVisionTrainingManager.java#L63-L65 |
NessComputing/components-ness-core | src/main/java/com/nesscomputing/callback/Callbacks.java | Callbacks.stream | public static <T> void stream(Callback<T> callback, Iterable<T> iterable) throws Exception
{
for (T item : iterable) {
try {
callback.call(item);
} catch (CallbackRefusedException e) {
return;
}
}
} | java | public static <T> void stream(Callback<T> callback, Iterable<T> iterable) throws Exception
{
for (T item : iterable) {
try {
callback.call(item);
} catch (CallbackRefusedException e) {
return;
}
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"stream",
"(",
"Callback",
"<",
"T",
">",
"callback",
",",
"Iterable",
"<",
"T",
">",
"iterable",
")",
"throws",
"Exception",
"{",
"for",
"(",
"T",
"item",
":",
"iterable",
")",
"{",
"try",
"{",
"callback",
... | For every element in the iterable, invoke the given callback.
Stops if {@link CallbackRefusedException} is thrown. | [
"For",
"every",
"element",
"in",
"the",
"iterable",
"invoke",
"the",
"given",
"callback",
".",
"Stops",
"if",
"{"
] | train | https://github.com/NessComputing/components-ness-core/blob/980db2925e5f9085c75ad3682d5314a973209297/src/main/java/com/nesscomputing/callback/Callbacks.java#L40-L49 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/jca/ProviderList.java | ProviderList.removeInvalid | ProviderList removeInvalid() {
int n = loadAll();
if (n == configs.length) {
return this;
}
ProviderConfig[] newConfigs = new ProviderConfig[n];
for (int i = 0, j = 0; i < configs.length; i++) {
ProviderConfig config = configs[i];
if (config.isLoaded()) {
newConfigs[j++] = config;
}
}
return new ProviderList(newConfigs, true);
} | java | ProviderList removeInvalid() {
int n = loadAll();
if (n == configs.length) {
return this;
}
ProviderConfig[] newConfigs = new ProviderConfig[n];
for (int i = 0, j = 0; i < configs.length; i++) {
ProviderConfig config = configs[i];
if (config.isLoaded()) {
newConfigs[j++] = config;
}
}
return new ProviderList(newConfigs, true);
} | [
"ProviderList",
"removeInvalid",
"(",
")",
"{",
"int",
"n",
"=",
"loadAll",
"(",
")",
";",
"if",
"(",
"n",
"==",
"configs",
".",
"length",
")",
"{",
"return",
"this",
";",
"}",
"ProviderConfig",
"[",
"]",
"newConfigs",
"=",
"new",
"ProviderConfig",
"["... | Try to load all Providers and return the ProviderList. If one or
more Providers could not be loaded, a new ProviderList with those
entries removed is returned. Otherwise, the method returns this. | [
"Try",
"to",
"load",
"all",
"Providers",
"and",
"return",
"the",
"ProviderList",
".",
"If",
"one",
"or",
"more",
"Providers",
"could",
"not",
"be",
"loaded",
"a",
"new",
"ProviderList",
"with",
"those",
"entries",
"removed",
"is",
"returned",
".",
"Otherwise... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/jca/ProviderList.java#L304-L317 |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/bond/Bond.java | Bond.getCouponPayment | public double getCouponPayment(int periodIndex, AnalyticModel model) {
ForwardCurve forwardCurve = model.getForwardCurve(forwardCurveName);
if(forwardCurve == null && forwardCurveName != null && forwardCurveName.length() > 0) {
throw new IllegalArgumentException("No forward curve with name '" + forwardCurveName + "' was found in the model:\n" + model.toString());
}
double periodLength = schedule.getPeriodLength(periodIndex);
double couponPayment=fixedCoupon ;
if(forwardCurve != null ) {
couponPayment = floatingSpread+forwardCurve.getForward(model, schedule.getFixing(periodIndex));
}
return couponPayment*periodLength;
} | java | public double getCouponPayment(int periodIndex, AnalyticModel model) {
ForwardCurve forwardCurve = model.getForwardCurve(forwardCurveName);
if(forwardCurve == null && forwardCurveName != null && forwardCurveName.length() > 0) {
throw new IllegalArgumentException("No forward curve with name '" + forwardCurveName + "' was found in the model:\n" + model.toString());
}
double periodLength = schedule.getPeriodLength(periodIndex);
double couponPayment=fixedCoupon ;
if(forwardCurve != null ) {
couponPayment = floatingSpread+forwardCurve.getForward(model, schedule.getFixing(periodIndex));
}
return couponPayment*periodLength;
} | [
"public",
"double",
"getCouponPayment",
"(",
"int",
"periodIndex",
",",
"AnalyticModel",
"model",
")",
"{",
"ForwardCurve",
"forwardCurve",
"=",
"model",
".",
"getForwardCurve",
"(",
"forwardCurveName",
")",
";",
"if",
"(",
"forwardCurve",
"==",
"null",
"&&",
"f... | Returns the coupon payment of the period with the given index. The analytic model is needed in case of floating bonds.
@param periodIndex The index of the period of interest.
@param model The model under which the product is valued.
@return The value of the coupon payment in the given period. | [
"Returns",
"the",
"coupon",
"payment",
"of",
"the",
"period",
"with",
"the",
"given",
"index",
".",
"The",
"analytic",
"model",
"is",
"needed",
"in",
"case",
"of",
"floating",
"bonds",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/bond/Bond.java#L209-L222 |
SeleniumHQ/selenium | java/server/src/org/openqa/grid/internal/utils/configuration/StandaloneConfiguration.java | StandaloneConfiguration.isMergeAble | protected boolean isMergeAble(Class<?> targetType, Object other, Object target) {
// don't merge a null value
if (other == null) {
return false;
} else {
// allow any non-null value to merge over a null target.
if (target == null) {
return true;
}
}
// we know we have two objects with value.. Make sure the types are the same and
// perform additional checks.
if (!targetType.isAssignableFrom(target.getClass()) ||
!targetType.isAssignableFrom(other.getClass())) {
return false;
}
if (target instanceof Collection) {
return !((Collection<?>) other).isEmpty();
}
if (target instanceof Map) {
return !((Map<?, ?>) other).isEmpty();
}
return true;
} | java | protected boolean isMergeAble(Class<?> targetType, Object other, Object target) {
// don't merge a null value
if (other == null) {
return false;
} else {
// allow any non-null value to merge over a null target.
if (target == null) {
return true;
}
}
// we know we have two objects with value.. Make sure the types are the same and
// perform additional checks.
if (!targetType.isAssignableFrom(target.getClass()) ||
!targetType.isAssignableFrom(other.getClass())) {
return false;
}
if (target instanceof Collection) {
return !((Collection<?>) other).isEmpty();
}
if (target instanceof Map) {
return !((Map<?, ?>) other).isEmpty();
}
return true;
} | [
"protected",
"boolean",
"isMergeAble",
"(",
"Class",
"<",
"?",
">",
"targetType",
",",
"Object",
"other",
",",
"Object",
"target",
")",
"{",
"// don't merge a null value",
"if",
"(",
"other",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{"... | Determines if one object can be merged onto another object. Checks for {@code null},
and empty (Collections & Maps) to make decision.
@param targetType The type that both {@code other} and {@code target} must be assignable to.
@param other the object to merge. must be the same type as the 'target'.
@param target the object to merge on to. must be the same type as the 'other'.
@return whether the 'other' can be merged onto the 'target'. | [
"Determines",
"if",
"one",
"object",
"can",
"be",
"merged",
"onto",
"another",
"object",
".",
"Checks",
"for",
"{",
"@code",
"null",
"}",
"and",
"empty",
"(",
"Collections",
"&",
"Maps",
")",
"to",
"make",
"decision",
"."
] | train | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/internal/utils/configuration/StandaloneConfiguration.java#L207-L234 |
icode/ameba | src/main/java/ameba/db/ebean/internal/ModelInterceptor.java | ModelInterceptor.applyPageList | public static FutureRowCount applyPageList(MultivaluedMap<String, String> queryParams, Query query) {
FutureRowCount futureRowCount = fetchRowCount(queryParams, query);
applyPageConfig(queryParams, query);
return futureRowCount;
} | java | public static FutureRowCount applyPageList(MultivaluedMap<String, String> queryParams, Query query) {
FutureRowCount futureRowCount = fetchRowCount(queryParams, query);
applyPageConfig(queryParams, query);
return futureRowCount;
} | [
"public",
"static",
"FutureRowCount",
"applyPageList",
"(",
"MultivaluedMap",
"<",
"String",
",",
"String",
">",
"queryParams",
",",
"Query",
"query",
")",
"{",
"FutureRowCount",
"futureRowCount",
"=",
"fetchRowCount",
"(",
"queryParams",
",",
"query",
")",
";",
... | <p>applyPageList.</p>
@param queryParams a {@link javax.ws.rs.core.MultivaluedMap} object.
@param query a {@link io.ebean.Query} object.
@return a {@link io.ebean.FutureRowCount} object. | [
"<p",
">",
"applyPageList",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/internal/ModelInterceptor.java#L268-L275 |
networknt/light-4j | utility/src/main/java/com/networknt/utility/StringUtils.java | StringUtils.substringBeforeLast | public static String substringBeforeLast(final String str, final String separator) {
if (isEmpty(str) || isEmpty(separator)) {
return str;
}
final int pos = str.lastIndexOf(separator);
if (pos == INDEX_NOT_FOUND) {
return str;
}
return str.substring(0, pos);
} | java | public static String substringBeforeLast(final String str, final String separator) {
if (isEmpty(str) || isEmpty(separator)) {
return str;
}
final int pos = str.lastIndexOf(separator);
if (pos == INDEX_NOT_FOUND) {
return str;
}
return str.substring(0, pos);
} | [
"public",
"static",
"String",
"substringBeforeLast",
"(",
"final",
"String",
"str",
",",
"final",
"String",
"separator",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"str",
")",
"||",
"isEmpty",
"(",
"separator",
")",
")",
"{",
"return",
"str",
";",
"}",
"final"... | <p>Gets the substring before the last occurrence of a separator.
The separator is not returned.</p>
<p>A {@code null} string input will return {@code null}.
An empty ("") string input will return the empty string.
An empty or {@code null} separator will return the input string.</p>
<p>If nothing is found, the string input is returned.</p>
<pre>
StringUtils.substringBeforeLast(null, *) = null
StringUtils.substringBeforeLast("", *) = ""
StringUtils.substringBeforeLast("abcba", "b") = "abc"
StringUtils.substringBeforeLast("abc", "c") = "ab"
StringUtils.substringBeforeLast("a", "a") = ""
StringUtils.substringBeforeLast("a", "z") = "a"
StringUtils.substringBeforeLast("a", null) = "a"
StringUtils.substringBeforeLast("a", "") = "a"
</pre>
@param str the String to get a substring from, may be null
@param separator the String to search for, may be null
@return the substring before the last occurrence of the separator,
{@code null} if null String input
@since 2.0 | [
"<p",
">",
"Gets",
"the",
"substring",
"before",
"the",
"last",
"occurrence",
"of",
"a",
"separator",
".",
"The",
"separator",
"is",
"not",
"returned",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/StringUtils.java#L572-L581 |
phax/ph-commons | ph-jaxb/src/main/java/com/helger/jaxb/JAXBMarshallerHelper.java | JAXBMarshallerHelper.setSunXMLHeaders | public static void setSunXMLHeaders (@Nonnull final Marshaller aMarshaller, @Nonnull final String sXMLHeaders)
{
final String sPropertyName = SUN_XML_HEADERS;
_setProperty (aMarshaller, sPropertyName, sXMLHeaders);
} | java | public static void setSunXMLHeaders (@Nonnull final Marshaller aMarshaller, @Nonnull final String sXMLHeaders)
{
final String sPropertyName = SUN_XML_HEADERS;
_setProperty (aMarshaller, sPropertyName, sXMLHeaders);
} | [
"public",
"static",
"void",
"setSunXMLHeaders",
"(",
"@",
"Nonnull",
"final",
"Marshaller",
"aMarshaller",
",",
"@",
"Nonnull",
"final",
"String",
"sXMLHeaders",
")",
"{",
"final",
"String",
"sPropertyName",
"=",
"SUN_XML_HEADERS",
";",
"_setProperty",
"(",
"aMars... | Set the Sun specific XML header string.
@param aMarshaller
The marshaller to set the property. May not be <code>null</code>.
@param sXMLHeaders
the value to be set | [
"Set",
"the",
"Sun",
"specific",
"XML",
"header",
"string",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-jaxb/src/main/java/com/helger/jaxb/JAXBMarshallerHelper.java#L293-L297 |
netceteragroup/trema-core | src/main/java/com/netcetera/trema/core/XMLDatabase.java | XMLDatabase.writeXML | public void writeXML(OutputStream outputStream, String encoding, String indent, String lineSeparator)
throws IOException {
XMLOutputter outputter = new XMLOutputter();
Format format = Format.getPrettyFormat();
format.setEncoding(encoding);
format.setIndent(indent);
format.setLineSeparator(lineSeparator);
outputter.setFormat(format);
outputter.output(getDocument(), outputStream);
} | java | public void writeXML(OutputStream outputStream, String encoding, String indent, String lineSeparator)
throws IOException {
XMLOutputter outputter = new XMLOutputter();
Format format = Format.getPrettyFormat();
format.setEncoding(encoding);
format.setIndent(indent);
format.setLineSeparator(lineSeparator);
outputter.setFormat(format);
outputter.output(getDocument(), outputStream);
} | [
"public",
"void",
"writeXML",
"(",
"OutputStream",
"outputStream",
",",
"String",
"encoding",
",",
"String",
"indent",
",",
"String",
"lineSeparator",
")",
"throws",
"IOException",
"{",
"XMLOutputter",
"outputter",
"=",
"new",
"XMLOutputter",
"(",
")",
";",
"For... | Serializes the database to the output stream.
@param outputStream the output
@param encoding the encoding to use
@param indent the indent
@param lineSeparator the lineSeparator
@throws IOException in case the xml could not be written | [
"Serializes",
"the",
"database",
"to",
"the",
"output",
"stream",
"."
] | train | https://github.com/netceteragroup/trema-core/blob/e5367f4b80b38038d462627aa146a62bc34fc489/src/main/java/com/netcetera/trema/core/XMLDatabase.java#L281-L290 |
foundation-runtime/service-directory | 2.0/sd-core/src/main/java/com/cisco/oss/foundation/directory/Configurations.java | Configurations.getInt | public static int getInt(String name, int defaultVal){
if(getConfiguration().containsKey(name)){
return getConfiguration().getInt(name);
} else {
return defaultVal;
}
} | java | public static int getInt(String name, int defaultVal){
if(getConfiguration().containsKey(name)){
return getConfiguration().getInt(name);
} else {
return defaultVal;
}
} | [
"public",
"static",
"int",
"getInt",
"(",
"String",
"name",
",",
"int",
"defaultVal",
")",
"{",
"if",
"(",
"getConfiguration",
"(",
")",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"return",
"getConfiguration",
"(",
")",
".",
"getInt",
"(",
"name",
... | Get the property object as int, or return defaultVal if property is not defined.
@param name
property name.
@param defaultVal
default property value.
@return
property value as int, return defaultVal if property is undefined. | [
"Get",
"the",
"property",
"object",
"as",
"int",
"or",
"return",
"defaultVal",
"if",
"property",
"is",
"not",
"defined",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-core/src/main/java/com/cisco/oss/foundation/directory/Configurations.java#L230-L236 |
johncarl81/transfuse | transfuse-core/src/main/java/org/androidtransfuse/analysis/InjectionPointFactory.java | InjectionPointFactory.buildInjectionPoint | public FieldInjectionPoint buildInjectionPoint(ASTType rootContainingType, ASTType containingType, ASTField astField, AnalysisContext context) {
return new FieldInjectionPoint(rootContainingType, containingType, astField, buildInjectionNode(astField.getAnnotations(), astField, astField.getASTType(), context));
} | java | public FieldInjectionPoint buildInjectionPoint(ASTType rootContainingType, ASTType containingType, ASTField astField, AnalysisContext context) {
return new FieldInjectionPoint(rootContainingType, containingType, astField, buildInjectionNode(astField.getAnnotations(), astField, astField.getASTType(), context));
} | [
"public",
"FieldInjectionPoint",
"buildInjectionPoint",
"(",
"ASTType",
"rootContainingType",
",",
"ASTType",
"containingType",
",",
"ASTField",
"astField",
",",
"AnalysisContext",
"context",
")",
"{",
"return",
"new",
"FieldInjectionPoint",
"(",
"rootContainingType",
","... | Build a Field InjectionPoint from the given ASTField
@param containingType
@param astField required ASTField
@param context analysis context
@return FieldInjectionPoint | [
"Build",
"a",
"Field",
"InjectionPoint",
"from",
"the",
"given",
"ASTField"
] | train | https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-core/src/main/java/org/androidtransfuse/analysis/InjectionPointFactory.java#L126-L128 |
dadoonet/fscrawler | framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java | FsCrawlerUtil.isIndexable | private static boolean isIndexable(String filename, List<String> includes, List<String> excludes) {
boolean excluded = isExcluded(filename, excludes);
if (excluded) return false;
return isIncluded(filename, includes);
} | java | private static boolean isIndexable(String filename, List<String> includes, List<String> excludes) {
boolean excluded = isExcluded(filename, excludes);
if (excluded) return false;
return isIncluded(filename, includes);
} | [
"private",
"static",
"boolean",
"isIndexable",
"(",
"String",
"filename",
",",
"List",
"<",
"String",
">",
"includes",
",",
"List",
"<",
"String",
">",
"excludes",
")",
"{",
"boolean",
"excluded",
"=",
"isExcluded",
"(",
"filename",
",",
"excludes",
")",
"... | We check if we can index the file or if we should ignore it
@param filename The filename to scan
@param includes include rules, may be empty not null
@param excludes exclude rules, may be empty not null | [
"We",
"check",
"if",
"we",
"can",
"index",
"the",
"file",
"or",
"if",
"we",
"should",
"ignore",
"it"
] | train | https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java#L165-L170 |
gocd/gocd | server/src/main/java/com/thoughtworks/go/server/service/PipelineHistoryService.java | PipelineHistoryService.loadMinimalData | public PipelineInstanceModels loadMinimalData(String pipelineName, Pagination pagination, Username username, OperationResult result) {
if (!goConfigService.currentCruiseConfig().hasPipelineNamed(new CaseInsensitiveString(pipelineName))) {
result.notFound("Not Found", "Pipeline " + pipelineName + " not found", HealthStateType.general(HealthStateScope.GLOBAL));
return null;
}
if (!securityService.hasViewPermissionForPipeline(username, pipelineName)) {
result.forbidden("Forbidden", NOT_AUTHORIZED_TO_VIEW_PIPELINE, HealthStateType.general(HealthStateScope.forPipeline(pipelineName)));
return null;
}
PipelineInstanceModels history = pipelineDao.loadHistory(pipelineName, pagination.getPageSize(), pagination.getOffset());
for (PipelineInstanceModel pipelineInstanceModel : history) {
populateMaterialRevisionsOnBuildCause(pipelineInstanceModel);
populatePlaceHolderStages(pipelineInstanceModel);
populateCanRunStatus(username, pipelineInstanceModel);
populateStageOperatePermission(pipelineInstanceModel, username);
}
return history;
} | java | public PipelineInstanceModels loadMinimalData(String pipelineName, Pagination pagination, Username username, OperationResult result) {
if (!goConfigService.currentCruiseConfig().hasPipelineNamed(new CaseInsensitiveString(pipelineName))) {
result.notFound("Not Found", "Pipeline " + pipelineName + " not found", HealthStateType.general(HealthStateScope.GLOBAL));
return null;
}
if (!securityService.hasViewPermissionForPipeline(username, pipelineName)) {
result.forbidden("Forbidden", NOT_AUTHORIZED_TO_VIEW_PIPELINE, HealthStateType.general(HealthStateScope.forPipeline(pipelineName)));
return null;
}
PipelineInstanceModels history = pipelineDao.loadHistory(pipelineName, pagination.getPageSize(), pagination.getOffset());
for (PipelineInstanceModel pipelineInstanceModel : history) {
populateMaterialRevisionsOnBuildCause(pipelineInstanceModel);
populatePlaceHolderStages(pipelineInstanceModel);
populateCanRunStatus(username, pipelineInstanceModel);
populateStageOperatePermission(pipelineInstanceModel, username);
}
return history;
} | [
"public",
"PipelineInstanceModels",
"loadMinimalData",
"(",
"String",
"pipelineName",
",",
"Pagination",
"pagination",
",",
"Username",
"username",
",",
"OperationResult",
"result",
")",
"{",
"if",
"(",
"!",
"goConfigService",
".",
"currentCruiseConfig",
"(",
")",
"... | /*
Load just enough data for Pipeline History API. The API is complete enough to build Pipeline History Page. Does following:
Exists check, Authorized check, Loads paginated pipeline data, Populates build-cause,
Populates future stages as empty, Populates can run for pipeline & each stage, Populate stage run permission | [
"/",
"*",
"Load",
"just",
"enough",
"data",
"for",
"Pipeline",
"History",
"API",
".",
"The",
"API",
"is",
"complete",
"enough",
"to",
"build",
"Pipeline",
"History",
"Page",
".",
"Does",
"following",
":",
"Exists",
"check",
"Authorized",
"check",
"Loads",
... | train | https://github.com/gocd/gocd/blob/59a8480e23d6c06de39127635108dff57603cb71/server/src/main/java/com/thoughtworks/go/server/service/PipelineHistoryService.java#L128-L149 |
Netflix/spectator | spectator-ext-ipc/src/main/java/com/netflix/spectator/ipc/IpcLogEntry.java | IpcLogEntry.addTag | public IpcLogEntry addTag(String k, String v) {
this.additionalTags.put(k, v);
return this;
} | java | public IpcLogEntry addTag(String k, String v) {
this.additionalTags.put(k, v);
return this;
} | [
"public",
"IpcLogEntry",
"addTag",
"(",
"String",
"k",
",",
"String",
"v",
")",
"{",
"this",
".",
"additionalTags",
".",
"put",
"(",
"k",
",",
"v",
")",
";",
"return",
"this",
";",
"}"
] | Add custom tags to the request metrics. Note, IPC metrics already have many tags and it
is not recommended for users to tack on additional context. In particular, any additional
tags should have a <b>guaranteed</b> low cardinality. If additional tagging causes these
metrics to exceed limits, then you may lose all visibility into requests. | [
"Add",
"custom",
"tags",
"to",
"the",
"request",
"metrics",
".",
"Note",
"IPC",
"metrics",
"already",
"have",
"many",
"tags",
"and",
"it",
"is",
"not",
"recommended",
"for",
"users",
"to",
"tack",
"on",
"additional",
"context",
".",
"In",
"particular",
"an... | train | https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-ipc/src/main/java/com/netflix/spectator/ipc/IpcLogEntry.java#L570-L573 |
igniterealtime/Smack | smack-im/src/main/java/org/jivesoftware/smack/roster/RosterEntry.java | RosterEntry.toRosterItem | static RosterPacket.Item toRosterItem(RosterEntry entry) {
return toRosterItem(entry, entry.getName(), false);
} | java | static RosterPacket.Item toRosterItem(RosterEntry entry) {
return toRosterItem(entry, entry.getName(), false);
} | [
"static",
"RosterPacket",
".",
"Item",
"toRosterItem",
"(",
"RosterEntry",
"entry",
")",
"{",
"return",
"toRosterItem",
"(",
"entry",
",",
"entry",
".",
"getName",
"(",
")",
",",
"false",
")",
";",
"}"
] | Convert the RosterEntry to a Roster stanza <item/> element.
@param entry the roster entry.
@return the roster item. | [
"Convert",
"the",
"RosterEntry",
"to",
"a",
"Roster",
"stanza",
"<",
";",
"item",
"/",
">",
";",
"element",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-im/src/main/java/org/jivesoftware/smack/roster/RosterEntry.java#L291-L293 |
alibaba/jstorm | jstorm-core/src/main/java/com/alibaba/jstorm/message/netty/NettyServer.java | NettyServer.recv | public Object recv(Integer taskId, int flags) {
try {
DisruptorQueue recvQueue = deserializeQueues.get(taskId);
if ((flags & 0x01) == 0x01) {
return recvQueue.poll();
// non-blocking
} else {
return recvQueue.take();
}
} catch (Exception e) {
LOG.warn("Unknown exception ", e);
return null;
}
} | java | public Object recv(Integer taskId, int flags) {
try {
DisruptorQueue recvQueue = deserializeQueues.get(taskId);
if ((flags & 0x01) == 0x01) {
return recvQueue.poll();
// non-blocking
} else {
return recvQueue.take();
}
} catch (Exception e) {
LOG.warn("Unknown exception ", e);
return null;
}
} | [
"public",
"Object",
"recv",
"(",
"Integer",
"taskId",
",",
"int",
"flags",
")",
"{",
"try",
"{",
"DisruptorQueue",
"recvQueue",
"=",
"deserializeQueues",
".",
"get",
"(",
"taskId",
")",
";",
"if",
"(",
"(",
"flags",
"&",
"0x01",
")",
"==",
"0x01",
")",... | fetch a message from message queue synchronously (flags != 1) or asynchronously (flags==1) | [
"fetch",
"a",
"message",
"from",
"message",
"queue",
"synchronously",
"(",
"flags",
"!",
"=",
"1",
")",
"or",
"asynchronously",
"(",
"flags",
"==",
"1",
")"
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/com/alibaba/jstorm/message/netty/NettyServer.java#L164-L177 |
hdbeukel/james-core | src/main/java/org/jamesframework/core/util/SetUtilities.java | SetUtilities.getRandomSubset | public static <T> Set<T> getRandomSubset(Set<? extends T> set, int size, Random rg) {
Set<T> subset = new LinkedHashSet<>();
getRandomSubset(set, size, rg, subset);
return subset;
} | java | public static <T> Set<T> getRandomSubset(Set<? extends T> set, int size, Random rg) {
Set<T> subset = new LinkedHashSet<>();
getRandomSubset(set, size, rg, subset);
return subset;
} | [
"public",
"static",
"<",
"T",
">",
"Set",
"<",
"T",
">",
"getRandomSubset",
"(",
"Set",
"<",
"?",
"extends",
"T",
">",
"set",
",",
"int",
"size",
",",
"Random",
"rg",
")",
"{",
"Set",
"<",
"T",
">",
"subset",
"=",
"new",
"LinkedHashSet",
"<>",
"(... | <p>
Selects a random subset of a specific size from a given set (uniformly distributed).
Applies a full scan algorithm that iterates once through the given set and selects each item with probability
(#remaining to select)/(#remaining to scan). It can be proven that this algorithm creates uniformly distributed
random subsets (for example, a proof is given <a href="http://eyalsch.wordpress.com/2010/04/01/random-sample">here</a>).
In the worst case, this algorithm has linear time complexity with respect to the size of the given set.
</p>
<p>
The generated subset is stored in a newly allocated {@link LinkedHashSet}.
</p>
@see <a href="http://eyalsch.wordpress.com/2010/04/01/random-sample">http://eyalsch.wordpress.com/2010/04/01/random-sample</a>
@param <T> type of elements in randomly selected subset
@param set set from which a random subset is to be selected
@param size desired subset size, should be a number in [0,|set|]
@param rg random generator
@throws IllegalArgumentException if an invalid subset size outside [0,|set|] is specified
@return random subset stored in a newly allocated {@link LinkedHashSet}. | [
"<p",
">",
"Selects",
"a",
"random",
"subset",
"of",
"a",
"specific",
"size",
"from",
"a",
"given",
"set",
"(",
"uniformly",
"distributed",
")",
".",
"Applies",
"a",
"full",
"scan",
"algorithm",
"that",
"iterates",
"once",
"through",
"the",
"given",
"set",... | train | https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/util/SetUtilities.java#L126-L130 |
mcxiaoke/Android-Next | core/src/main/java/com/mcxiaoke/next/utils/AssertUtils.java | AssertUtils.notEmpty | public static void notEmpty(Collection<?> collection, String message) {
if (collection == null || collection.isEmpty()) {
throw new IllegalArgumentException(message);
}
} | java | public static void notEmpty(Collection<?> collection, String message) {
if (collection == null || collection.isEmpty()) {
throw new IllegalArgumentException(message);
}
} | [
"public",
"static",
"void",
"notEmpty",
"(",
"Collection",
"<",
"?",
">",
"collection",
",",
"String",
"message",
")",
"{",
"if",
"(",
"collection",
"==",
"null",
"||",
"collection",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentExcep... | Assert that a collection has elements; that is, it must not be
<code>null</code> and must have at least one element.
<p/>
<pre class="code">
Assert.notEmpty(collection, "Collection must have elements");
</pre>
@param collection the collection to check
@param message the exception message to use if the assertion fails
@throws IllegalArgumentException if the collection is <code>null</code> or has no elements | [
"Assert",
"that",
"a",
"collection",
"has",
"elements",
";",
"that",
"is",
"it",
"must",
"not",
"be",
"<code",
">",
"null<",
"/",
"code",
">",
"and",
"must",
"have",
"at",
"least",
"one",
"element",
".",
"<p",
"/",
">",
"<pre",
"class",
"=",
"code",
... | train | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/core/src/main/java/com/mcxiaoke/next/utils/AssertUtils.java#L372-L376 |
lessthanoptimal/ejml | main/ejml-core/src/org/ejml/UtilEjml.java | UtilEjml.fancyStringF | public static String fancyStringF(double value, DecimalFormat format, int length, int significant) {
String formatted = fancyString(value, format, length, significant);
int n = length-formatted.length();
if( n > 0 ) {
StringBuilder builder = new StringBuilder(n);
for (int i = 0; i < n; i++) {
builder.append(' ');
}
return formatted + builder.toString();
} else {
return formatted;
}
} | java | public static String fancyStringF(double value, DecimalFormat format, int length, int significant) {
String formatted = fancyString(value, format, length, significant);
int n = length-formatted.length();
if( n > 0 ) {
StringBuilder builder = new StringBuilder(n);
for (int i = 0; i < n; i++) {
builder.append(' ');
}
return formatted + builder.toString();
} else {
return formatted;
}
} | [
"public",
"static",
"String",
"fancyStringF",
"(",
"double",
"value",
",",
"DecimalFormat",
"format",
",",
"int",
"length",
",",
"int",
"significant",
")",
"{",
"String",
"formatted",
"=",
"fancyString",
"(",
"value",
",",
"format",
",",
"length",
",",
"sign... | Fixed length fancy formatting for doubles. If possible decimal notation is used. If all the significant digits
can't be shown then it will switch to exponential notation. If not all the space is needed then it will
be filled in to ensure it has the specified length.
@param value value being formatted
@param format default format before exponential
@param length Maximum number of characters it can take.
@param significant Number of significant decimal digits to show at a minimum.
@return formatted string | [
"Fixed",
"length",
"fancy",
"formatting",
"for",
"doubles",
".",
"If",
"possible",
"decimal",
"notation",
"is",
"used",
".",
"If",
"all",
"the",
"significant",
"digits",
"can",
"t",
"be",
"shown",
"then",
"it",
"will",
"switch",
"to",
"exponential",
"notatio... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/UtilEjml.java#L336-L350 |
vincentk/joptimizer | src/main/java/com/joptimizer/util/ColtUtils.java | ColtUtils.add | public static final DoubleMatrix1D add(DoubleMatrix1D v1, DoubleMatrix1D v2, double c){
if(v1.size()!=v2.size()){
throw new IllegalArgumentException("wrong vectors dimensions");
}
DoubleMatrix1D ret = DoubleFactory1D.dense.make(v1.size());
for(int i=0; i<ret.size(); i++){
ret.setQuick(i, v1.getQuick(i) + c*v2.getQuick(i));
}
return ret;
} | java | public static final DoubleMatrix1D add(DoubleMatrix1D v1, DoubleMatrix1D v2, double c){
if(v1.size()!=v2.size()){
throw new IllegalArgumentException("wrong vectors dimensions");
}
DoubleMatrix1D ret = DoubleFactory1D.dense.make(v1.size());
for(int i=0; i<ret.size(); i++){
ret.setQuick(i, v1.getQuick(i) + c*v2.getQuick(i));
}
return ret;
} | [
"public",
"static",
"final",
"DoubleMatrix1D",
"add",
"(",
"DoubleMatrix1D",
"v1",
",",
"DoubleMatrix1D",
"v2",
",",
"double",
"c",
")",
"{",
"if",
"(",
"v1",
".",
"size",
"(",
")",
"!=",
"v2",
".",
"size",
"(",
")",
")",
"{",
"throw",
"new",
"Illega... | Returns v = v1 + c*v2.
Useful in avoiding the need of the copy() in the colt api. | [
"Returns",
"v",
"=",
"v1",
"+",
"c",
"*",
"v2",
".",
"Useful",
"in",
"avoiding",
"the",
"need",
"of",
"the",
"copy",
"()",
"in",
"the",
"colt",
"api",
"."
] | train | https://github.com/vincentk/joptimizer/blob/65064c1bb0b26c7261358021e4c93d06dd43564f/src/main/java/com/joptimizer/util/ColtUtils.java#L368-L378 |
twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java | HexUtil.toByteArray | public static byte[] toByteArray(CharSequence hexString) {
if (hexString == null) {
return null;
}
return toByteArray(hexString, 0, hexString.length());
} | java | public static byte[] toByteArray(CharSequence hexString) {
if (hexString == null) {
return null;
}
return toByteArray(hexString, 0, hexString.length());
} | [
"public",
"static",
"byte",
"[",
"]",
"toByteArray",
"(",
"CharSequence",
"hexString",
")",
"{",
"if",
"(",
"hexString",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"toByteArray",
"(",
"hexString",
",",
"0",
",",
"hexString",
".",
"leng... | Creates a byte array from a CharSequence (String, StringBuilder, etc.)
containing only valid hexidecimal formatted characters.
Each grouping of 2 characters represent a byte in "Big Endian" format.
The hex CharSequence must be an even length of characters. For example, a String
of "1234" would return the byte array { 0x12, 0x34 }.
@param hexString The String, StringBuilder, etc. that contains the
sequence of hexidecimal character values.
@return A new byte array representing the sequence of bytes created from
the sequence of hexidecimal characters. If the hexString is null,
then this method will return null. | [
"Creates",
"a",
"byte",
"array",
"from",
"a",
"CharSequence",
"(",
"String",
"StringBuilder",
"etc",
".",
")",
"containing",
"only",
"valid",
"hexidecimal",
"formatted",
"characters",
".",
"Each",
"grouping",
"of",
"2",
"characters",
"represent",
"a",
"byte",
... | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java#L328-L333 |
jayantk/jklol | src/com/jayantkrish/jklol/preprocessing/FeatureStandardizer.java | FeatureStandardizer.getMeans | public static DiscreteFactor getMeans(DiscreteFactor featureFactor, int featureVariableNum) {
return getMeans(Arrays.asList(featureFactor), featureVariableNum);
} | java | public static DiscreteFactor getMeans(DiscreteFactor featureFactor, int featureVariableNum) {
return getMeans(Arrays.asList(featureFactor), featureVariableNum);
} | [
"public",
"static",
"DiscreteFactor",
"getMeans",
"(",
"DiscreteFactor",
"featureFactor",
",",
"int",
"featureVariableNum",
")",
"{",
"return",
"getMeans",
"(",
"Arrays",
".",
"asList",
"(",
"featureFactor",
")",
",",
"featureVariableNum",
")",
";",
"}"
] | Gets the mean value of each assignment to {@code featureVariableNum} in
{@code featureFactor}.
@param featureFactor
@param featureVariableNum
@return | [
"Gets",
"the",
"mean",
"value",
"of",
"each",
"assignment",
"to",
"{",
"@code",
"featureVariableNum",
"}",
"in",
"{",
"@code",
"featureFactor",
"}",
"."
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/preprocessing/FeatureStandardizer.java#L129-L131 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslPolicyClient.java | SslPolicyClient.insertSslPolicy | @BetaApi
public final Operation insertSslPolicy(String project, SslPolicy sslPolicyResource) {
InsertSslPolicyHttpRequest request =
InsertSslPolicyHttpRequest.newBuilder()
.setProject(project)
.setSslPolicyResource(sslPolicyResource)
.build();
return insertSslPolicy(request);
} | java | @BetaApi
public final Operation insertSslPolicy(String project, SslPolicy sslPolicyResource) {
InsertSslPolicyHttpRequest request =
InsertSslPolicyHttpRequest.newBuilder()
.setProject(project)
.setSslPolicyResource(sslPolicyResource)
.build();
return insertSslPolicy(request);
} | [
"@",
"BetaApi",
"public",
"final",
"Operation",
"insertSslPolicy",
"(",
"String",
"project",
",",
"SslPolicy",
"sslPolicyResource",
")",
"{",
"InsertSslPolicyHttpRequest",
"request",
"=",
"InsertSslPolicyHttpRequest",
".",
"newBuilder",
"(",
")",
".",
"setProject",
"(... | Returns the specified SSL policy resource. Gets a list of available SSL policies by making a
list() request.
<p>Sample code:
<pre><code>
try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
SslPolicy sslPolicyResource = SslPolicy.newBuilder().build();
Operation response = sslPolicyClient.insertSslPolicy(project.toString(), sslPolicyResource);
}
</code></pre>
@param project Project ID for this request.
@param sslPolicyResource A SSL policy specifies the server-side support for SSL features. This
can be attached to a TargetHttpsProxy or a TargetSslProxy. This affects connections between
clients and the HTTPS or SSL proxy load balancer. They do not affect the connection between
the load balancers and the backends.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Returns",
"the",
"specified",
"SSL",
"policy",
"resource",
".",
"Gets",
"a",
"list",
"of",
"available",
"SSL",
"policies",
"by",
"making",
"a",
"list",
"()",
"request",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslPolicyClient.java#L411-L420 |
google/closure-compiler | src/com/google/javascript/jscomp/NodeUtil.java | NodeUtil.markNewScopesChanged | static void markNewScopesChanged(Node node, AbstractCompiler compiler) {
if (node.isFunction()) {
compiler.reportChangeToChangeScope(node);
}
for (Node child = node.getFirstChild(); child != null; child = child.getNext()) {
markNewScopesChanged(child, compiler);
}
} | java | static void markNewScopesChanged(Node node, AbstractCompiler compiler) {
if (node.isFunction()) {
compiler.reportChangeToChangeScope(node);
}
for (Node child = node.getFirstChild(); child != null; child = child.getNext()) {
markNewScopesChanged(child, compiler);
}
} | [
"static",
"void",
"markNewScopesChanged",
"(",
"Node",
"node",
",",
"AbstractCompiler",
"compiler",
")",
"{",
"if",
"(",
"node",
".",
"isFunction",
"(",
")",
")",
"{",
"compiler",
".",
"reportChangeToChangeScope",
"(",
"node",
")",
";",
"}",
"for",
"(",
"N... | Recurses through a tree, marking all function nodes as changed. | [
"Recurses",
"through",
"a",
"tree",
"marking",
"all",
"function",
"nodes",
"as",
"changed",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L5822-L5829 |
indeedeng/util | util-core/src/main/java/com/indeed/util/core/TreeTimer.java | TreeTimer.leftpad | @Nonnull
private static String leftpad(@Nonnull String s, int n) {
return leftpad(s, n, ' ');
} | java | @Nonnull
private static String leftpad(@Nonnull String s, int n) {
return leftpad(s, n, ' ');
} | [
"@",
"Nonnull",
"private",
"static",
"String",
"leftpad",
"(",
"@",
"Nonnull",
"String",
"s",
",",
"int",
"n",
")",
"{",
"return",
"leftpad",
"(",
"s",
",",
"n",
",",
"'",
"'",
")",
";",
"}"
] | Left-pads a String with spaces so it is length <code>n</code>. If the String
is already at least length n, no padding is done. | [
"Left",
"-",
"pads",
"a",
"String",
"with",
"spaces",
"so",
"it",
"is",
"length",
"<code",
">",
"n<",
"/",
"code",
">",
".",
"If",
"the",
"String",
"is",
"already",
"at",
"least",
"length",
"n",
"no",
"padding",
"is",
"done",
"."
] | train | https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/TreeTimer.java#L81-L84 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnServerConfigurationsInner.java | P2sVpnServerConfigurationsInner.getAsync | public Observable<P2SVpnServerConfigurationInner> getAsync(String resourceGroupName, String virtualWanName, String p2SVpnServerConfigurationName) {
return getWithServiceResponseAsync(resourceGroupName, virtualWanName, p2SVpnServerConfigurationName).map(new Func1<ServiceResponse<P2SVpnServerConfigurationInner>, P2SVpnServerConfigurationInner>() {
@Override
public P2SVpnServerConfigurationInner call(ServiceResponse<P2SVpnServerConfigurationInner> response) {
return response.body();
}
});
} | java | public Observable<P2SVpnServerConfigurationInner> getAsync(String resourceGroupName, String virtualWanName, String p2SVpnServerConfigurationName) {
return getWithServiceResponseAsync(resourceGroupName, virtualWanName, p2SVpnServerConfigurationName).map(new Func1<ServiceResponse<P2SVpnServerConfigurationInner>, P2SVpnServerConfigurationInner>() {
@Override
public P2SVpnServerConfigurationInner call(ServiceResponse<P2SVpnServerConfigurationInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"P2SVpnServerConfigurationInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualWanName",
",",
"String",
"p2SVpnServerConfigurationName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
... | Retrieves the details of a P2SVpnServerConfiguration.
@param resourceGroupName The resource group name of the P2SVpnServerConfiguration.
@param virtualWanName The name of the VirtualWan.
@param p2SVpnServerConfigurationName The name of the P2SVpnServerConfiguration.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the P2SVpnServerConfigurationInner object | [
"Retrieves",
"the",
"details",
"of",
"a",
"P2SVpnServerConfiguration",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnServerConfigurationsInner.java#L132-L139 |
jfrog/artifactory-client-java | httpClient/src/main/java/org/jfrog/artifactory/client/httpClient/http/HttpBuilderBase.java | HttpBuilderBase.createConnectionMgr | private PoolingHttpClientConnectionManager createConnectionMgr() {
PoolingHttpClientConnectionManager connectionMgr;
// prepare SSLContext
SSLContext sslContext = buildSslContext();
ConnectionSocketFactory plainsf = PlainConnectionSocketFactory.getSocketFactory();
// we allow to disable host name verification against CA certificate,
// notice: in general this is insecure and should be avoided in production,
// (this type of configuration is useful for development purposes)
boolean noHostVerification = false;
LayeredConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
sslContext,
noHostVerification ? NoopHostnameVerifier.INSTANCE : new DefaultHostnameVerifier()
);
Registry<ConnectionSocketFactory> r = RegistryBuilder.<ConnectionSocketFactory>create()
.register("http", plainsf)
.register("https", sslsf)
.build();
connectionMgr = new PoolingHttpClientConnectionManager(r, null, null,
null, connectionPoolTimeToLive, TimeUnit.SECONDS);
connectionMgr.setMaxTotal(maxConnectionsTotal);
connectionMgr.setDefaultMaxPerRoute(maxConnectionsPerRoute);
HttpHost localhost = new HttpHost("localhost", 80);
connectionMgr.setMaxPerRoute(new HttpRoute(localhost), maxConnectionsPerRoute);
return connectionMgr;
} | java | private PoolingHttpClientConnectionManager createConnectionMgr() {
PoolingHttpClientConnectionManager connectionMgr;
// prepare SSLContext
SSLContext sslContext = buildSslContext();
ConnectionSocketFactory plainsf = PlainConnectionSocketFactory.getSocketFactory();
// we allow to disable host name verification against CA certificate,
// notice: in general this is insecure and should be avoided in production,
// (this type of configuration is useful for development purposes)
boolean noHostVerification = false;
LayeredConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
sslContext,
noHostVerification ? NoopHostnameVerifier.INSTANCE : new DefaultHostnameVerifier()
);
Registry<ConnectionSocketFactory> r = RegistryBuilder.<ConnectionSocketFactory>create()
.register("http", plainsf)
.register("https", sslsf)
.build();
connectionMgr = new PoolingHttpClientConnectionManager(r, null, null,
null, connectionPoolTimeToLive, TimeUnit.SECONDS);
connectionMgr.setMaxTotal(maxConnectionsTotal);
connectionMgr.setDefaultMaxPerRoute(maxConnectionsPerRoute);
HttpHost localhost = new HttpHost("localhost", 80);
connectionMgr.setMaxPerRoute(new HttpRoute(localhost), maxConnectionsPerRoute);
return connectionMgr;
} | [
"private",
"PoolingHttpClientConnectionManager",
"createConnectionMgr",
"(",
")",
"{",
"PoolingHttpClientConnectionManager",
"connectionMgr",
";",
"// prepare SSLContext",
"SSLContext",
"sslContext",
"=",
"buildSslContext",
"(",
")",
";",
"ConnectionSocketFactory",
"plainsf",
"... | Creates custom Http Client connection pool to be used by Http Client
@return {@link PoolingHttpClientConnectionManager} | [
"Creates",
"custom",
"Http",
"Client",
"connection",
"pool",
"to",
"be",
"used",
"by",
"Http",
"Client"
] | train | https://github.com/jfrog/artifactory-client-java/blob/e7443f4ffa8bf7d3b161f9cdc59bfc3036e9b46e/httpClient/src/main/java/org/jfrog/artifactory/client/httpClient/http/HttpBuilderBase.java#L269-L295 |
vlingo/vlingo-actors | src/main/java/io/vlingo/actors/World.java | World.start | public static World start(final String name) {
return start(name, io.vlingo.actors.Properties.properties);
} | java | public static World start(final String name) {
return start(name, io.vlingo.actors.Properties.properties);
} | [
"public",
"static",
"World",
"start",
"(",
"final",
"String",
"name",
")",
"{",
"return",
"start",
"(",
"name",
",",
"io",
".",
"vlingo",
".",
"actors",
".",
"Properties",
".",
"properties",
")",
";",
"}"
] | Answers a new {@code World} with the given {@code name} and that is configured with
the contents of the {@code vlingo-actors.properties} file.
@param name the {@code String} name to assign to the new {@code World} instance
@return {@code World} | [
"Answers",
"a",
"new",
"{"
] | train | https://github.com/vlingo/vlingo-actors/blob/c7d046fd139c0490cf0fd2588d7dc2f792f13493/src/main/java/io/vlingo/actors/World.java#L56-L58 |
abel533/Mapper | core/src/main/java/tk/mybatis/mapper/mapperhelper/SqlHelper.java | SqlHelper.getBindValue | public static String getBindValue(EntityColumn column, String value) {
StringBuilder sql = new StringBuilder();
sql.append("<bind name=\"");
sql.append(column.getProperty()).append("_bind\" ");
sql.append("value='").append(value).append("'/>");
return sql.toString();
} | java | public static String getBindValue(EntityColumn column, String value) {
StringBuilder sql = new StringBuilder();
sql.append("<bind name=\"");
sql.append(column.getProperty()).append("_bind\" ");
sql.append("value='").append(value).append("'/>");
return sql.toString();
} | [
"public",
"static",
"String",
"getBindValue",
"(",
"EntityColumn",
"column",
",",
"String",
"value",
")",
"{",
"StringBuilder",
"sql",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sql",
".",
"append",
"(",
"\"<bind name=\\\"\"",
")",
";",
"sql",
".",
"append... | <bind name="pattern" value="'%' + _parameter.getTitle() + '%'" />
@param column
@return | [
"<bind",
"name",
"=",
"pattern",
"value",
"=",
"%",
"+",
"_parameter",
".",
"getTitle",
"()",
"+",
"%",
"/",
">"
] | train | https://github.com/abel533/Mapper/blob/45c3d716583cba3680e03f1f6790fab5e1f4f668/core/src/main/java/tk/mybatis/mapper/mapperhelper/SqlHelper.java#L121-L127 |
DV8FromTheWorld/JDA | src/main/java/com/iwebpp/crypto/TweetNaclFast.java | Signature.detached_verify | public boolean detached_verify(byte [] message, byte [] signature) {
if (signature.length != signatureLength)
return false;
if (theirPublicKey.length != publicKeyLength)
return false;
byte [] sm = new byte[signatureLength + message.length];
byte [] m = new byte[signatureLength + message.length];
for (int i = 0; i < signatureLength; i++)
sm[i] = signature[i];
for (int i = 0; i < message.length; i++)
sm[i + signatureLength] = message[i];
return (crypto_sign_open(m, -1, sm, 0, sm.length, theirPublicKey) >= 0);
} | java | public boolean detached_verify(byte [] message, byte [] signature) {
if (signature.length != signatureLength)
return false;
if (theirPublicKey.length != publicKeyLength)
return false;
byte [] sm = new byte[signatureLength + message.length];
byte [] m = new byte[signatureLength + message.length];
for (int i = 0; i < signatureLength; i++)
sm[i] = signature[i];
for (int i = 0; i < message.length; i++)
sm[i + signatureLength] = message[i];
return (crypto_sign_open(m, -1, sm, 0, sm.length, theirPublicKey) >= 0);
} | [
"public",
"boolean",
"detached_verify",
"(",
"byte",
"[",
"]",
"message",
",",
"byte",
"[",
"]",
"signature",
")",
"{",
"if",
"(",
"signature",
".",
"length",
"!=",
"signatureLength",
")",
"return",
"false",
";",
"if",
"(",
"theirPublicKey",
".",
"length",... | /*
@description
Verifies the signature for the message and
returns true if verification succeeded or false if it failed. | [
"/",
"*"
] | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/com/iwebpp/crypto/TweetNaclFast.java#L779-L791 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.