repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
jbundle/jbundle | base/screen/model/src/main/java/org/jbundle/base/screen/model/BaseGridTableScreen.java | BaseGridTableScreen.setSelectQuery | public boolean setSelectQuery(Rec recMaint, boolean bUpdateOnSelect)
{
if (recMaint == null)
return true; // BaseTable Set!
if (this.getMainRecord() != null)
if (this.getMainRecord() != recMaint)
if (this.getMainRecord().getBaseRecord().getTableNames(false).equals(recMaint.getTableNames(false)))
{ // Only trigger when the grid table sends the selection message
this.getMainRecord().addListener(new OnSelectHandler((Record)recMaint, bUpdateOnSelect, DBConstants.USER_DEFINED_TYPE));
return true; // BaseTable Set!
}
return false;
} | java | public boolean setSelectQuery(Rec recMaint, boolean bUpdateOnSelect)
{
if (recMaint == null)
return true; // BaseTable Set!
if (this.getMainRecord() != null)
if (this.getMainRecord() != recMaint)
if (this.getMainRecord().getBaseRecord().getTableNames(false).equals(recMaint.getTableNames(false)))
{ // Only trigger when the grid table sends the selection message
this.getMainRecord().addListener(new OnSelectHandler((Record)recMaint, bUpdateOnSelect, DBConstants.USER_DEFINED_TYPE));
return true; // BaseTable Set!
}
return false;
} | [
"public",
"boolean",
"setSelectQuery",
"(",
"Rec",
"recMaint",
",",
"boolean",
"bUpdateOnSelect",
")",
"{",
"if",
"(",
"recMaint",
"==",
"null",
")",
"return",
"true",
";",
"// BaseTable Set!",
"if",
"(",
"this",
".",
"getMainRecord",
"(",
")",
"!=",
"null",... | Find the sub-screen that uses this grid query and set for selection.
When you select a new record here, you read the same record in the SelectQuery.
@param recMaint The record which is synced on record change.
@param bUpdateOnSelect Do I update the current record if a selection occurs.
@return True if successful. | [
"Find",
"the",
"sub",
"-",
"screen",
"that",
"uses",
"this",
"grid",
"query",
"and",
"set",
"for",
"selection",
".",
"When",
"you",
"select",
"a",
"new",
"record",
"here",
"you",
"read",
"the",
"same",
"record",
"in",
"the",
"SelectQuery",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BaseGridTableScreen.java#L164-L176 |
phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/JJDocMojo.java | JJDocMojo.scanForGrammars | private GrammarInfo [] scanForGrammars (final File sourceDirectory) throws MavenReportException
{
if (!sourceDirectory.isDirectory ())
{
return null;
}
GrammarInfo [] grammarInfos;
getLog ().debug ("Scanning for grammars: " + sourceDirectory);
try
{
final String [] includes = { "**/*.jj", "**/*.JJ", "**/*.jjt", "**/*.JJT", "**/*.jtb", "**/*.JTB" };
final GrammarDirectoryScanner scanner = new GrammarDirectoryScanner ();
scanner.setSourceDirectory (sourceDirectory);
scanner.setIncludes (includes);
scanner.scan ();
grammarInfos = scanner.getIncludedGrammars ();
}
catch (final Exception e)
{
throw new MavenReportException ("Failed to scan for grammars: " + sourceDirectory, e);
}
getLog ().debug ("Found grammars: " + Arrays.asList (grammarInfos));
return grammarInfos;
} | java | private GrammarInfo [] scanForGrammars (final File sourceDirectory) throws MavenReportException
{
if (!sourceDirectory.isDirectory ())
{
return null;
}
GrammarInfo [] grammarInfos;
getLog ().debug ("Scanning for grammars: " + sourceDirectory);
try
{
final String [] includes = { "**/*.jj", "**/*.JJ", "**/*.jjt", "**/*.JJT", "**/*.jtb", "**/*.JTB" };
final GrammarDirectoryScanner scanner = new GrammarDirectoryScanner ();
scanner.setSourceDirectory (sourceDirectory);
scanner.setIncludes (includes);
scanner.scan ();
grammarInfos = scanner.getIncludedGrammars ();
}
catch (final Exception e)
{
throw new MavenReportException ("Failed to scan for grammars: " + sourceDirectory, e);
}
getLog ().debug ("Found grammars: " + Arrays.asList (grammarInfos));
return grammarInfos;
} | [
"private",
"GrammarInfo",
"[",
"]",
"scanForGrammars",
"(",
"final",
"File",
"sourceDirectory",
")",
"throws",
"MavenReportException",
"{",
"if",
"(",
"!",
"sourceDirectory",
".",
"isDirectory",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"GrammarInfo",
"[... | Searches the specified source directory to find grammar files that can be
documented.
@param sourceDirectory
The source directory to scan for grammar files.
@return An array of grammar infos describing the found grammar files or
<code>null</code> if the source directory does not exist.
@throws MavenReportException
If there is a problem while scanning for .jj files. | [
"Searches",
"the",
"specified",
"source",
"directory",
"to",
"find",
"grammar",
"files",
"that",
"can",
"be",
"documented",
"."
] | train | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/JJDocMojo.java#L519-L545 |
drinkjava2/jBeanBox | jbeanbox/src/main/java/com/github/drinkjava2/jbeanbox/AopUtils.java | AopUtils.createProxyBean | public static Object createProxyBean(Class<?> clazz, BeanBox box, BeanBoxContext ctx) {
BeanBoxException.assureNotNull(clazz, "Try to create a proxy bean, but beanClass not found.");
Enhancer enhancer = new Enhancer();
enhancer.setSuperclass(clazz);
if (box.getConstructorParams() != null && box.getConstructorParams().length > 0) {
BeanBox[] boxes = box.getConstructorParams();
Class<?>[] argsTypes = new Class<?>[boxes.length];
Object[] realArgsValue = new Object[boxes.length];
for (int i = 0; i < boxes.length; i++) {
argsTypes[i] = boxes[i].getType();
Object realValue = ctx.getBean(boxes[i]);
if (realValue != null && realValue instanceof String)
realValue = ctx.getValueTranslator().translate((String) realValue, boxes[i].getType());
realArgsValue[i] = realValue;
}
enhancer.setCallback(new ProxyBean(box, ctx));
return enhancer.create(argsTypes, realArgsValue);
} else {
enhancer.setCallback(new ProxyBean(box, ctx));
return enhancer.create();
}
} | java | public static Object createProxyBean(Class<?> clazz, BeanBox box, BeanBoxContext ctx) {
BeanBoxException.assureNotNull(clazz, "Try to create a proxy bean, but beanClass not found.");
Enhancer enhancer = new Enhancer();
enhancer.setSuperclass(clazz);
if (box.getConstructorParams() != null && box.getConstructorParams().length > 0) {
BeanBox[] boxes = box.getConstructorParams();
Class<?>[] argsTypes = new Class<?>[boxes.length];
Object[] realArgsValue = new Object[boxes.length];
for (int i = 0; i < boxes.length; i++) {
argsTypes[i] = boxes[i].getType();
Object realValue = ctx.getBean(boxes[i]);
if (realValue != null && realValue instanceof String)
realValue = ctx.getValueTranslator().translate((String) realValue, boxes[i].getType());
realArgsValue[i] = realValue;
}
enhancer.setCallback(new ProxyBean(box, ctx));
return enhancer.create(argsTypes, realArgsValue);
} else {
enhancer.setCallback(new ProxyBean(box, ctx));
return enhancer.create();
}
} | [
"public",
"static",
"Object",
"createProxyBean",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"BeanBox",
"box",
",",
"BeanBoxContext",
"ctx",
")",
"{",
"BeanBoxException",
".",
"assureNotNull",
"(",
"clazz",
",",
"\"Try to create a proxy bean, but beanClass not found.\"... | Create a ProxyBean
@param clazz
The target class
@param box
The BeanBox of target class
@param ctx
The BeanBoxContext
@return A Proxy Bean with AOP support | [
"Create",
"a",
"ProxyBean"
] | train | https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/jbeanbox/AopUtils.java#L34-L55 |
citrusframework/citrus | modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/endpoint/SeleniumBrowser.java | SeleniumBrowser.getStoredFile | public String getStoredFile(String filename) {
try {
File stored = new File(temporaryStorage.toFile(), filename);
if (!stored.exists()) {
throw new CitrusRuntimeException("Failed to access stored file: " + stored.getCanonicalPath());
}
return stored.getCanonicalPath();
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to retrieve file: " + filename, e);
}
} | java | public String getStoredFile(String filename) {
try {
File stored = new File(temporaryStorage.toFile(), filename);
if (!stored.exists()) {
throw new CitrusRuntimeException("Failed to access stored file: " + stored.getCanonicalPath());
}
return stored.getCanonicalPath();
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to retrieve file: " + filename, e);
}
} | [
"public",
"String",
"getStoredFile",
"(",
"String",
"filename",
")",
"{",
"try",
"{",
"File",
"stored",
"=",
"new",
"File",
"(",
"temporaryStorage",
".",
"toFile",
"(",
")",
",",
"filename",
")",
";",
"if",
"(",
"!",
"stored",
".",
"exists",
"(",
")",
... | Retrieve resource object
@param filename Resource to retrieve.
@return String with the path to the resource. | [
"Retrieve",
"resource",
"object"
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/endpoint/SeleniumBrowser.java#L181-L193 |
awin/rabbiteasy | rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/MessageReader.java | MessageReader.readBodyAsString | public String readBodyAsString() {
Charset charset = readCharset();
byte[] bodyContent = message.getBodyContent();
return new String(bodyContent, charset);
} | java | public String readBodyAsString() {
Charset charset = readCharset();
byte[] bodyContent = message.getBodyContent();
return new String(bodyContent, charset);
} | [
"public",
"String",
"readBodyAsString",
"(",
")",
"{",
"Charset",
"charset",
"=",
"readCharset",
"(",
")",
";",
"byte",
"[",
"]",
"bodyContent",
"=",
"message",
".",
"getBodyContent",
"(",
")",
";",
"return",
"new",
"String",
"(",
"bodyContent",
",",
"char... | Extracts the message body and interprets it
as a string.
@return The message body as string | [
"Extracts",
"the",
"message",
"body",
"and",
"interprets",
"it",
"as",
"a",
"string",
"."
] | train | https://github.com/awin/rabbiteasy/blob/c161efda6c0f7ef319aedf09dfe40a4a90165510/rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/MessageReader.java#L80-L84 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/db/cql/CQLService.java | CQLService.executeQuery | private ResultSet executeQuery(Query query, String tableName, Object... values) {
m_logger.debug("Executing statement {} on table {}.{}; total params={}",
new Object[]{query, m_keyspace, tableName, values.length});
try {
PreparedStatement prepState = getPreparedQuery(query, tableName);
BoundStatement boundState = prepState.bind(values);
return m_session.execute(boundState);
} catch (Exception e) {
String params = "[" + Utils.concatenate(Arrays.asList(values), ",") + "]";
m_logger.error("Query failed: query={}, keyspace={}, table={}, params={}; error: {}",
query, m_keyspace, tableName, params, e);
throw e;
}
} | java | private ResultSet executeQuery(Query query, String tableName, Object... values) {
m_logger.debug("Executing statement {} on table {}.{}; total params={}",
new Object[]{query, m_keyspace, tableName, values.length});
try {
PreparedStatement prepState = getPreparedQuery(query, tableName);
BoundStatement boundState = prepState.bind(values);
return m_session.execute(boundState);
} catch (Exception e) {
String params = "[" + Utils.concatenate(Arrays.asList(values), ",") + "]";
m_logger.error("Query failed: query={}, keyspace={}, table={}, params={}; error: {}",
query, m_keyspace, tableName, params, e);
throw e;
}
} | [
"private",
"ResultSet",
"executeQuery",
"(",
"Query",
"query",
",",
"String",
"tableName",
",",
"Object",
"...",
"values",
")",
"{",
"m_logger",
".",
"debug",
"(",
"\"Executing statement {} on table {}.{}; total params={}\"",
",",
"new",
"Object",
"[",
"]",
"{",
"... | Execute the given query for the given table using the given values. | [
"Execute",
"the",
"given",
"query",
"for",
"the",
"given",
"table",
"using",
"the",
"given",
"values",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/db/cql/CQLService.java#L309-L322 |
glyptodon/guacamole-client | guacamole-ext/src/main/java/org/apache/guacamole/token/TokenFilter.java | TokenFilter.setTokens | public void setTokens(Map<String, String> tokens) {
tokenValues.clear();
tokenValues.putAll(tokens);
} | java | public void setTokens(Map<String, String> tokens) {
tokenValues.clear();
tokenValues.putAll(tokens);
} | [
"public",
"void",
"setTokens",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"tokens",
")",
"{",
"tokenValues",
".",
"clear",
"(",
")",
";",
"tokenValues",
".",
"putAll",
"(",
"tokens",
")",
";",
"}"
] | Replaces all current token values with the contents of the given map,
where each map key represents a token name, and each map value
represents a token value.
@param tokens
A map containing the token names and corresponding values to
assign. | [
"Replaces",
"all",
"current",
"token",
"values",
"with",
"the",
"contents",
"of",
"the",
"given",
"map",
"where",
"each",
"map",
"key",
"represents",
"a",
"token",
"name",
"and",
"each",
"map",
"value",
"represents",
"a",
"token",
"value",
"."
] | train | https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/guacamole-ext/src/main/java/org/apache/guacamole/token/TokenFilter.java#L155-L158 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.writeString | public static File writeString(String content, File file, String charset) throws IORuntimeException {
return FileWriter.create(file, CharsetUtil.charset(charset)).write(content);
} | java | public static File writeString(String content, File file, String charset) throws IORuntimeException {
return FileWriter.create(file, CharsetUtil.charset(charset)).write(content);
} | [
"public",
"static",
"File",
"writeString",
"(",
"String",
"content",
",",
"File",
"file",
",",
"String",
"charset",
")",
"throws",
"IORuntimeException",
"{",
"return",
"FileWriter",
".",
"create",
"(",
"file",
",",
"CharsetUtil",
".",
"charset",
"(",
"charset"... | 将String写入文件,覆盖模式
@param content 写入的内容
@param file 文件
@param charset 字符集
@return 被写入的文件
@throws IORuntimeException IO异常 | [
"将String写入文件,覆盖模式"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2747-L2749 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/privatejgoodies/forms/layout/FormLayout.java | FormLayout.setRowSpec | public void setRowSpec(int rowIndex, RowSpec rowSpec) {
checkNotNull(rowSpec, "The row spec must not be null.");
rowSpecs.set(rowIndex - 1, rowSpec);
} | java | public void setRowSpec(int rowIndex, RowSpec rowSpec) {
checkNotNull(rowSpec, "The row spec must not be null.");
rowSpecs.set(rowIndex - 1, rowSpec);
} | [
"public",
"void",
"setRowSpec",
"(",
"int",
"rowIndex",
",",
"RowSpec",
"rowSpec",
")",
"{",
"checkNotNull",
"(",
"rowSpec",
",",
"\"The row spec must not be null.\"",
")",
";",
"rowSpecs",
".",
"set",
"(",
"rowIndex",
"-",
"1",
",",
"rowSpec",
")",
";",
"}"... | Sets the RowSpec at the specified row index.
@param rowIndex the index of the row to be changed
@param rowSpec the RowSpec to be set
@throws NullPointerException if {@code rowSpec} is {@code null}
@throws IndexOutOfBoundsException if the row index is out of range | [
"Sets",
"the",
"RowSpec",
"at",
"the",
"specified",
"row",
"index",
"."
] | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/forms/layout/FormLayout.java#L566-L569 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java | Expressions.stringTemplate | @Deprecated
public static StringTemplate stringTemplate(String template, ImmutableList<?> args) {
return stringTemplate(createTemplate(template), args);
} | java | @Deprecated
public static StringTemplate stringTemplate(String template, ImmutableList<?> args) {
return stringTemplate(createTemplate(template), args);
} | [
"@",
"Deprecated",
"public",
"static",
"StringTemplate",
"stringTemplate",
"(",
"String",
"template",
",",
"ImmutableList",
"<",
"?",
">",
"args",
")",
"{",
"return",
"stringTemplate",
"(",
"createTemplate",
"(",
"template",
")",
",",
"args",
")",
";",
"}"
] | Create a new Template expression
@deprecated Use {@link #stringTemplate(String, List)} instead.
@param template template
@param args template parameters
@return template expression | [
"Create",
"a",
"new",
"Template",
"expression"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L901-L904 |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/js/JSMarshaller.java | JSMarshaller.javaScriptEscapeForRegEx | @Nullable
public static String javaScriptEscapeForRegEx (@Nullable final String sInput)
{
if (StringHelper.hasNoText (sInput))
return sInput;
final char [] aInput = sInput.toCharArray ();
if (!StringHelper.containsAny (aInput, CHARS_TO_MASK_REGEX))
return sInput;
// At last each character has one masking character
final char [] ret = new char [aInput.length * 2];
int nIndex = 0;
for (final char cCurrent : aInput)
if (ArrayHelper.contains (CHARS_TO_MASK_REGEX, cCurrent))
{
ret[nIndex++] = MASK_CHAR_REGEX;
ret[nIndex++] = cCurrent;
}
else
ret[nIndex++] = cCurrent;
return new String (ret, 0, nIndex);
} | java | @Nullable
public static String javaScriptEscapeForRegEx (@Nullable final String sInput)
{
if (StringHelper.hasNoText (sInput))
return sInput;
final char [] aInput = sInput.toCharArray ();
if (!StringHelper.containsAny (aInput, CHARS_TO_MASK_REGEX))
return sInput;
// At last each character has one masking character
final char [] ret = new char [aInput.length * 2];
int nIndex = 0;
for (final char cCurrent : aInput)
if (ArrayHelper.contains (CHARS_TO_MASK_REGEX, cCurrent))
{
ret[nIndex++] = MASK_CHAR_REGEX;
ret[nIndex++] = cCurrent;
}
else
ret[nIndex++] = cCurrent;
return new String (ret, 0, nIndex);
} | [
"@",
"Nullable",
"public",
"static",
"String",
"javaScriptEscapeForRegEx",
"(",
"@",
"Nullable",
"final",
"String",
"sInput",
")",
"{",
"if",
"(",
"StringHelper",
".",
"hasNoText",
"(",
"sInput",
")",
")",
"return",
"sInput",
";",
"final",
"char",
"[",
"]",
... | Turn special regular expression characters into escaped characters
conforming to JavaScript.<br>
Reference: <a href=
"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions"
>MDN Regular Expressions</a>
@param sInput
the input string
@return the escaped string | [
"Turn",
"special",
"regular",
"expression",
"characters",
"into",
"escaped",
"characters",
"conforming",
"to",
"JavaScript",
".",
"<br",
">",
"Reference",
":",
"<a",
"href",
"=",
"https",
":",
"//",
"developer",
".",
"mozilla",
".",
"org",
"/",
"en",
"-",
... | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/js/JSMarshaller.java#L186-L209 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java | CommerceCountryPersistenceImpl.removeByG_Tw | @Override
public CommerceCountry removeByG_Tw(long groupId, String twoLettersISOCode)
throws NoSuchCountryException {
CommerceCountry commerceCountry = findByG_Tw(groupId, twoLettersISOCode);
return remove(commerceCountry);
} | java | @Override
public CommerceCountry removeByG_Tw(long groupId, String twoLettersISOCode)
throws NoSuchCountryException {
CommerceCountry commerceCountry = findByG_Tw(groupId, twoLettersISOCode);
return remove(commerceCountry);
} | [
"@",
"Override",
"public",
"CommerceCountry",
"removeByG_Tw",
"(",
"long",
"groupId",
",",
"String",
"twoLettersISOCode",
")",
"throws",
"NoSuchCountryException",
"{",
"CommerceCountry",
"commerceCountry",
"=",
"findByG_Tw",
"(",
"groupId",
",",
"twoLettersISOCode",
")"... | Removes the commerce country where groupId = ? and twoLettersISOCode = ? from the database.
@param groupId the group ID
@param twoLettersISOCode the two letters iso code
@return the commerce country that was removed | [
"Removes",
"the",
"commerce",
"country",
"where",
"groupId",
"=",
"?",
";",
"and",
"twoLettersISOCode",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java#L2156-L2162 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/BaseField.java | BaseField.setupTablePopup | public ScreenComponent setupTablePopup(ScreenLoc itsLocation, ComponentParent targetScreen, int iDisplayFieldDesc, Rec record, String displayFieldName, boolean bIncludeBlankOption)
{
return this.setupTablePopup(itsLocation, targetScreen, this, iDisplayFieldDesc, record, null, displayFieldName, bIncludeBlankOption, false);
} | java | public ScreenComponent setupTablePopup(ScreenLoc itsLocation, ComponentParent targetScreen, int iDisplayFieldDesc, Rec record, String displayFieldName, boolean bIncludeBlankOption)
{
return this.setupTablePopup(itsLocation, targetScreen, this, iDisplayFieldDesc, record, null, displayFieldName, bIncludeBlankOption, false);
} | [
"public",
"ScreenComponent",
"setupTablePopup",
"(",
"ScreenLoc",
"itsLocation",
",",
"ComponentParent",
"targetScreen",
",",
"int",
"iDisplayFieldDesc",
",",
"Rec",
"record",
",",
"String",
"displayFieldName",
",",
"boolean",
"bIncludeBlankOption",
")",
"{",
"return",
... | Add a popup for the table tied to this field.
@return Return the component or ScreenField that is created for this field. | [
"Add",
"a",
"popup",
"for",
"the",
"table",
"tied",
"to",
"this",
"field",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BaseField.java#L1185-L1188 |
ical4j/ical4j | src/main/java/net/fortuna/ical4j/util/Dates.java | Dates.getAbsMonthDay | public static int getAbsMonthDay(final java.util.Date date, final int monthDay) {
if (monthDay == 0 || monthDay < -MAX_DAYS_PER_MONTH || monthDay > MAX_DAYS_PER_MONTH) {
throw new IllegalArgumentException(MessageFormat.format(INVALID_MONTH_DAY_MESSAGE,
monthDay));
}
if (monthDay > 0) {
return monthDay;
}
final Calendar cal = Calendar.getInstance();
cal.setTime(date);
final int month = cal.get(Calendar.MONTH);
// construct a list of possible month days..
final List<Integer> days = new ArrayList<Integer>();
cal.set(Calendar.DAY_OF_MONTH, 1);
while (cal.get(Calendar.MONTH) == month) {
days.add(cal.get(Calendar.DAY_OF_MONTH));
cal.add(Calendar.DAY_OF_MONTH, 1);
}
return days.get(days.size() + monthDay);
} | java | public static int getAbsMonthDay(final java.util.Date date, final int monthDay) {
if (monthDay == 0 || monthDay < -MAX_DAYS_PER_MONTH || monthDay > MAX_DAYS_PER_MONTH) {
throw new IllegalArgumentException(MessageFormat.format(INVALID_MONTH_DAY_MESSAGE,
monthDay));
}
if (monthDay > 0) {
return monthDay;
}
final Calendar cal = Calendar.getInstance();
cal.setTime(date);
final int month = cal.get(Calendar.MONTH);
// construct a list of possible month days..
final List<Integer> days = new ArrayList<Integer>();
cal.set(Calendar.DAY_OF_MONTH, 1);
while (cal.get(Calendar.MONTH) == month) {
days.add(cal.get(Calendar.DAY_OF_MONTH));
cal.add(Calendar.DAY_OF_MONTH, 1);
}
return days.get(days.size() + monthDay);
} | [
"public",
"static",
"int",
"getAbsMonthDay",
"(",
"final",
"java",
".",
"util",
".",
"Date",
"date",
",",
"final",
"int",
"monthDay",
")",
"{",
"if",
"(",
"monthDay",
"==",
"0",
"||",
"monthDay",
"<",
"-",
"MAX_DAYS_PER_MONTH",
"||",
"monthDay",
">",
"MA... | Returns the absolute month day for the month specified by the
supplied date. Note that a value of zero (0) is invalid for the
monthDay parameter and an <code>IllegalArgumentException</code>
will be thrown.
@param date a date instance representing a day of the month
@param monthDay a day of month offset
@return the absolute day of month for the specified offset | [
"Returns",
"the",
"absolute",
"month",
"day",
"for",
"the",
"month",
"specified",
"by",
"the",
"supplied",
"date",
".",
"Note",
"that",
"a",
"value",
"of",
"zero",
"(",
"0",
")",
"is",
"invalid",
"for",
"the",
"monthDay",
"parameter",
"and",
"an",
"<code... | train | https://github.com/ical4j/ical4j/blob/7ac4bd1ce2bb2e0a2906fb69a56fbd2d9d974156/src/main/java/net/fortuna/ical4j/util/Dates.java#L192-L211 |
infinispan/infinispan | query/src/main/java/org/infinispan/query/dsl/embedded/impl/HibernateSearchPropertyHelper.java | HibernateSearchPropertyHelper.convertToPropertyType | @Override
public Object convertToPropertyType(Class<?> entityType, String[] propertyPath, String value) {
EntityIndexBinding indexBinding = searchFactory.getIndexBindings().get(entityType);
if (indexBinding != null) {
DocumentFieldMetadata fieldMetadata = getDocumentFieldMetadata(indexBinding, propertyPath);
if (fieldMetadata != null) {
FieldBridge bridge = fieldMetadata.getFieldBridge();
return convertToPropertyType(value, bridge);
}
}
return super.convertToPropertyType(entityType, propertyPath, value);
} | java | @Override
public Object convertToPropertyType(Class<?> entityType, String[] propertyPath, String value) {
EntityIndexBinding indexBinding = searchFactory.getIndexBindings().get(entityType);
if (indexBinding != null) {
DocumentFieldMetadata fieldMetadata = getDocumentFieldMetadata(indexBinding, propertyPath);
if (fieldMetadata != null) {
FieldBridge bridge = fieldMetadata.getFieldBridge();
return convertToPropertyType(value, bridge);
}
}
return super.convertToPropertyType(entityType, propertyPath, value);
} | [
"@",
"Override",
"public",
"Object",
"convertToPropertyType",
"(",
"Class",
"<",
"?",
">",
"entityType",
",",
"String",
"[",
"]",
"propertyPath",
",",
"String",
"value",
")",
"{",
"EntityIndexBinding",
"indexBinding",
"=",
"searchFactory",
".",
"getIndexBindings",... | Returns the given value converted into the type of the given property as determined via the field bridge of the
property.
@param value the value to convert
@param entityType the type hosting the property
@param propertyPath the name of the property
@return the given value converted into the type of the given property | [
"Returns",
"the",
"given",
"value",
"converted",
"into",
"the",
"type",
"of",
"the",
"given",
"property",
"as",
"determined",
"via",
"the",
"field",
"bridge",
"of",
"the",
"property",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/query/src/main/java/org/infinispan/query/dsl/embedded/impl/HibernateSearchPropertyHelper.java#L98-L109 |
kstateome/canvas-api | src/main/java/edu/ksu/canvas/CanvasApiFactory.java | CanvasApiFactory.getReader | public <T extends CanvasReader> T getReader(Class<T> type, OauthToken oauthToken, Integer paginationPageSize) {
LOG.debug("Factory call to instantiate class: " + type.getName());
RestClient restClient = new RefreshingRestClient();
@SuppressWarnings("unchecked")
Class<T> concreteClass = (Class<T>)readerMap.get(type);
if (concreteClass == null) {
throw new UnsupportedOperationException("No implementation for requested interface found: " + type.getName());
}
LOG.debug("got class: " + concreteClass);
try {
Constructor<T> constructor = concreteClass.getConstructor(String.class, Integer.class,
OauthToken.class, RestClient.class, Integer.TYPE, Integer.TYPE, Integer.class, Boolean.class);
return constructor.newInstance(canvasBaseUrl, CANVAS_API_VERSION, oauthToken, restClient,
connectTimeout, readTimeout, paginationPageSize, false);
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException | InstantiationException e) {
throw new UnsupportedOperationException("Unknown error instantiating the concrete API class: " + type.getName(), e);
}
} | java | public <T extends CanvasReader> T getReader(Class<T> type, OauthToken oauthToken, Integer paginationPageSize) {
LOG.debug("Factory call to instantiate class: " + type.getName());
RestClient restClient = new RefreshingRestClient();
@SuppressWarnings("unchecked")
Class<T> concreteClass = (Class<T>)readerMap.get(type);
if (concreteClass == null) {
throw new UnsupportedOperationException("No implementation for requested interface found: " + type.getName());
}
LOG.debug("got class: " + concreteClass);
try {
Constructor<T> constructor = concreteClass.getConstructor(String.class, Integer.class,
OauthToken.class, RestClient.class, Integer.TYPE, Integer.TYPE, Integer.class, Boolean.class);
return constructor.newInstance(canvasBaseUrl, CANVAS_API_VERSION, oauthToken, restClient,
connectTimeout, readTimeout, paginationPageSize, false);
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException | InstantiationException e) {
throw new UnsupportedOperationException("Unknown error instantiating the concrete API class: " + type.getName(), e);
}
} | [
"public",
"<",
"T",
"extends",
"CanvasReader",
">",
"T",
"getReader",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"OauthToken",
"oauthToken",
",",
"Integer",
"paginationPageSize",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Factory call to instantiate class: \"",
"+",
... | Get a reader implementation class to perform API calls with while specifying
an explicit page size for paginated API calls. This gets translated to a per_page=
parameter on API requests. Note that Canvas does not guarantee it will honor this page size request.
There is an explicit maximum page size on the server side which could change. The default page size
is 10 which can be limiting when, for example, trying to get all users in a 800 person course.
@param type Interface type you wish to get an implementation for
@param oauthToken An OAuth token to use for authentication when making API calls
@param paginationPageSize Requested pagination page size
@param <T> The reader type to request an instance of
@return An instance of the requested reader class | [
"Get",
"a",
"reader",
"implementation",
"class",
"to",
"perform",
"API",
"calls",
"with",
"while",
"specifying",
"an",
"explicit",
"page",
"size",
"for",
"paginated",
"API",
"calls",
".",
"This",
"gets",
"translated",
"to",
"a",
"per_page",
"=",
"parameter",
... | train | https://github.com/kstateome/canvas-api/blob/426bf403a8fd7aca3f170348005feda25b374e5a/src/main/java/edu/ksu/canvas/CanvasApiFactory.java#L83-L103 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java | Widget.setPosition | public void setPosition(float x, float y, float z) {
getTransform().setPosition(x, y, z);
if (mTransformCache.setPosition(x, y, z)) {
onTransformChanged();
}
} | java | public void setPosition(float x, float y, float z) {
getTransform().setPosition(x, y, z);
if (mTransformCache.setPosition(x, y, z)) {
onTransformChanged();
}
} | [
"public",
"void",
"setPosition",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
")",
"{",
"getTransform",
"(",
")",
".",
"setPosition",
"(",
"x",
",",
"y",
",",
"z",
")",
";",
"if",
"(",
"mTransformCache",
".",
"setPosition",
"(",
"x",
",... | Set absolute position.
Use {@link #translate(float, float, float)} to <em>move</em> the object.
@param x
'X' component of the absolute position.
@param y
'Y' component of the absolute position.
@param z
'Z' component of the absolute position. | [
"Set",
"absolute",
"position",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java#L1259-L1264 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_trend_microvpx_image.java | xen_trend_microvpx_image.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
xen_trend_microvpx_image_responses result = (xen_trend_microvpx_image_responses) service.get_payload_formatter().string_to_resource(xen_trend_microvpx_image_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_trend_microvpx_image_response_array);
}
xen_trend_microvpx_image[] result_xen_trend_microvpx_image = new xen_trend_microvpx_image[result.xen_trend_microvpx_image_response_array.length];
for(int i = 0; i < result.xen_trend_microvpx_image_response_array.length; i++)
{
result_xen_trend_microvpx_image[i] = result.xen_trend_microvpx_image_response_array[i].xen_trend_microvpx_image[0];
}
return result_xen_trend_microvpx_image;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
xen_trend_microvpx_image_responses result = (xen_trend_microvpx_image_responses) service.get_payload_formatter().string_to_resource(xen_trend_microvpx_image_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_trend_microvpx_image_response_array);
}
xen_trend_microvpx_image[] result_xen_trend_microvpx_image = new xen_trend_microvpx_image[result.xen_trend_microvpx_image_response_array.length];
for(int i = 0; i < result.xen_trend_microvpx_image_response_array.length; i++)
{
result_xen_trend_microvpx_image[i] = result.xen_trend_microvpx_image_response_array[i].xen_trend_microvpx_image[0];
}
return result_xen_trend_microvpx_image;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"xen_trend_microvpx_image_responses",
"result",
"=",
"(",
"xen_trend_microvpx_image_responses",
")",
"service",
... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_trend_microvpx_image.java#L264-L281 |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/support/Filters.java | Filters.onlyMismatches | public static Predicate<Tuple2<Context<?>, Boolean>> onlyMismatches() {
return new Predicate<Tuple2<Context<?>, Boolean>>() {
public boolean apply(Tuple2<Context<?>, Boolean> tuple) {
return !tuple.b;
}
};
} | java | public static Predicate<Tuple2<Context<?>, Boolean>> onlyMismatches() {
return new Predicate<Tuple2<Context<?>, Boolean>>() {
public boolean apply(Tuple2<Context<?>, Boolean> tuple) {
return !tuple.b;
}
};
} | [
"public",
"static",
"Predicate",
"<",
"Tuple2",
"<",
"Context",
"<",
"?",
">",
",",
"Boolean",
">",
">",
"onlyMismatches",
"(",
")",
"{",
"return",
"new",
"Predicate",
"<",
"Tuple2",
"<",
"Context",
"<",
"?",
">",
",",
"Boolean",
">",
">",
"(",
")",
... | A predicate usable as a filter (element) of a {@link org.parboiled.parserunners.TracingParseRunner}.
Enables printing of rule tracing log messages for all mismatched rules.
@return a predicate | [
"A",
"predicate",
"usable",
"as",
"a",
"filter",
"(",
"element",
")",
"of",
"a",
"{",
"@link",
"org",
".",
"parboiled",
".",
"parserunners",
".",
"TracingParseRunner",
"}",
".",
"Enables",
"printing",
"of",
"rule",
"tracing",
"log",
"messages",
"for",
"all... | train | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/Filters.java#L205-L211 |
geomajas/geomajas-project-server | plugin/layer-geotools/geotools/src/main/java/org/geomajas/layer/shapeinmem/ShapeInMemLayer.java | ShapeInMemLayer.getBounds | public Envelope getBounds(Filter filter) throws LayerException {
try {
FeatureCollection<SimpleFeatureType, SimpleFeature> fc = getFeatureSource().getFeatures(filter);
return fc.getBounds();
} catch (IOException ioe) {
throw new LayerException(ioe, ExceptionCode.FEATURE_MODEL_PROBLEM);
}
} | java | public Envelope getBounds(Filter filter) throws LayerException {
try {
FeatureCollection<SimpleFeatureType, SimpleFeature> fc = getFeatureSource().getFeatures(filter);
return fc.getBounds();
} catch (IOException ioe) {
throw new LayerException(ioe, ExceptionCode.FEATURE_MODEL_PROBLEM);
}
} | [
"public",
"Envelope",
"getBounds",
"(",
"Filter",
"filter",
")",
"throws",
"LayerException",
"{",
"try",
"{",
"FeatureCollection",
"<",
"SimpleFeatureType",
",",
"SimpleFeature",
">",
"fc",
"=",
"getFeatureSource",
"(",
")",
".",
"getFeatures",
"(",
"filter",
")... | Retrieve the bounds of the specified features.
@param filter filter
@return the bounds of the specified features
@throws LayerException cannot read features | [
"Retrieve",
"the",
"bounds",
"of",
"the",
"specified",
"features",
"."
] | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/layer-geotools/geotools/src/main/java/org/geomajas/layer/shapeinmem/ShapeInMemLayer.java#L176-L183 |
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.checkConnectivity | public ConnectivityInformationInner checkConnectivity(String resourceGroupName, String networkWatcherName, ConnectivityParameters parameters) {
return checkConnectivityWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().last().body();
} | java | public ConnectivityInformationInner checkConnectivity(String resourceGroupName, String networkWatcherName, ConnectivityParameters parameters) {
return checkConnectivityWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().last().body();
} | [
"public",
"ConnectivityInformationInner",
"checkConnectivity",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkWatcherName",
",",
"ConnectivityParameters",
"parameters",
")",
"{",
"return",
"checkConnectivityWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"... | Verifies the possibility of establishing a direct TCP connection from a virtual machine to a given endpoint including another VM or an arbitrary remote server.
@param resourceGroupName The name of the network watcher resource group.
@param networkWatcherName The name of the network watcher resource.
@param parameters Parameters that determine how the connectivity check will be performed.
@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 ConnectivityInformationInner object if successful. | [
"Verifies",
"the",
"possibility",
"of",
"establishing",
"a",
"direct",
"TCP",
"connection",
"from",
"a",
"virtual",
"machine",
"to",
"a",
"given",
"endpoint",
"including",
"another",
"VM",
"or",
"an",
"arbitrary",
"remote",
"server",
"."
] | 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#L2140-L2142 |
jbundle/jbundle | base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XTEView.java | XTEView.printData | public boolean printData(PrintWriter out, int iPrintOptions)
{
if ((this.getScreenField().getConverter().getField() instanceof XmlField)
|| (this.getScreenField().getConverter().getField() instanceof HtmlField)
|| (this.getScreenField().getConverter().getField() instanceof XMLPropertiesField))
{
boolean bFieldsFound = false;
String strFieldName = this.getScreenField().getSFieldParam();
// Do NOT encode the data!
String strFieldData = this.getScreenField().getSFieldValue(true, false);
out.println(" <" + strFieldName + '>' + strFieldData + "</" + strFieldName + '>');
return bFieldsFound;
}
else
return super.printData(out, iPrintOptions);
} | java | public boolean printData(PrintWriter out, int iPrintOptions)
{
if ((this.getScreenField().getConverter().getField() instanceof XmlField)
|| (this.getScreenField().getConverter().getField() instanceof HtmlField)
|| (this.getScreenField().getConverter().getField() instanceof XMLPropertiesField))
{
boolean bFieldsFound = false;
String strFieldName = this.getScreenField().getSFieldParam();
// Do NOT encode the data!
String strFieldData = this.getScreenField().getSFieldValue(true, false);
out.println(" <" + strFieldName + '>' + strFieldData + "</" + strFieldName + '>');
return bFieldsFound;
}
else
return super.printData(out, iPrintOptions);
} | [
"public",
"boolean",
"printData",
"(",
"PrintWriter",
"out",
",",
"int",
"iPrintOptions",
")",
"{",
"if",
"(",
"(",
"this",
".",
"getScreenField",
"(",
")",
".",
"getConverter",
"(",
")",
".",
"getField",
"(",
")",
"instanceof",
"XmlField",
")",
"||",
"(... | Print this field's data in XML format.
@return true if default params were found for this form.
@param out The http output stream.
@exception DBException File exception. | [
"Print",
"this",
"field",
"s",
"data",
"in",
"XML",
"format",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XTEView.java#L73-L88 |
roboconf/roboconf-platform | core/roboconf-target-docker/src/main/java/net/roboconf/target/docker/internal/DockerUtils.java | DockerUtils.findImageByTag | public static Image findImageByTag( String imageTag, List<Image> images ) {
Image result = null;
for( Image img : images ) {
String[] tags = img.getRepoTags();
if( tags == null )
continue;
for( String s : tags ) {
if( s.contains( imageTag )) {
result = img;
break;
}
}
}
return result;
} | java | public static Image findImageByTag( String imageTag, List<Image> images ) {
Image result = null;
for( Image img : images ) {
String[] tags = img.getRepoTags();
if( tags == null )
continue;
for( String s : tags ) {
if( s.contains( imageTag )) {
result = img;
break;
}
}
}
return result;
} | [
"public",
"static",
"Image",
"findImageByTag",
"(",
"String",
"imageTag",
",",
"List",
"<",
"Image",
">",
"images",
")",
"{",
"Image",
"result",
"=",
"null",
";",
"for",
"(",
"Image",
"img",
":",
"images",
")",
"{",
"String",
"[",
"]",
"tags",
"=",
"... | Finds an image by tag.
@param imageTag the image tag (not null)
@param images a non-null list of images
@return an image, or null if none was found | [
"Finds",
"an",
"image",
"by",
"tag",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-docker/src/main/java/net/roboconf/target/docker/internal/DockerUtils.java#L161-L178 |
SonarSource/sonarqube | sonar-core/src/main/java/org/sonar/core/util/Protobuf.java | Protobuf.writeStream | public static <MSG extends Message> void writeStream(Iterable<MSG> messages, OutputStream output) {
try {
for (Message message : messages) {
message.writeDelimitedTo(output);
}
} catch (Exception e) {
throw ContextException.of("Unable to write messages", e);
}
} | java | public static <MSG extends Message> void writeStream(Iterable<MSG> messages, OutputStream output) {
try {
for (Message message : messages) {
message.writeDelimitedTo(output);
}
} catch (Exception e) {
throw ContextException.of("Unable to write messages", e);
}
} | [
"public",
"static",
"<",
"MSG",
"extends",
"Message",
">",
"void",
"writeStream",
"(",
"Iterable",
"<",
"MSG",
">",
"messages",
",",
"OutputStream",
"output",
")",
"{",
"try",
"{",
"for",
"(",
"Message",
"message",
":",
"messages",
")",
"{",
"message",
"... | Streams multiple messages to {@code output}. Reading the messages back requires to
call methods {@code readStream(...)}.
<p>
See https://developers.google.com/protocol-buffers/docs/techniques#streaming
</p> | [
"Streams",
"multiple",
"messages",
"to",
"{"
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-core/src/main/java/org/sonar/core/util/Protobuf.java#L111-L119 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepository.java | JDBCRepository.selectIsolationLevel | IsolationLevel selectIsolationLevel(Transaction parent, IsolationLevel desiredLevel) {
if (desiredLevel == null) {
if (parent == null) {
desiredLevel = mDefaultIsolationLevel;
} else {
desiredLevel = parent.getIsolationLevel();
}
} else if (parent != null) {
IsolationLevel parentLevel = parent.getIsolationLevel();
// Can promote to higher level, but not lower.
if (parentLevel.compareTo(desiredLevel) >= 0) {
desiredLevel = parentLevel;
} else {
return null;
}
}
switch (desiredLevel) {
case NONE:
return IsolationLevel.NONE;
case READ_UNCOMMITTED:
return mReadUncommittedLevel;
case READ_COMMITTED:
return mReadCommittedLevel;
case REPEATABLE_READ:
return mRepeatableReadLevel;
case SERIALIZABLE:
return mSerializableLevel;
}
return null;
} | java | IsolationLevel selectIsolationLevel(Transaction parent, IsolationLevel desiredLevel) {
if (desiredLevel == null) {
if (parent == null) {
desiredLevel = mDefaultIsolationLevel;
} else {
desiredLevel = parent.getIsolationLevel();
}
} else if (parent != null) {
IsolationLevel parentLevel = parent.getIsolationLevel();
// Can promote to higher level, but not lower.
if (parentLevel.compareTo(desiredLevel) >= 0) {
desiredLevel = parentLevel;
} else {
return null;
}
}
switch (desiredLevel) {
case NONE:
return IsolationLevel.NONE;
case READ_UNCOMMITTED:
return mReadUncommittedLevel;
case READ_COMMITTED:
return mReadCommittedLevel;
case REPEATABLE_READ:
return mRepeatableReadLevel;
case SERIALIZABLE:
return mSerializableLevel;
}
return null;
} | [
"IsolationLevel",
"selectIsolationLevel",
"(",
"Transaction",
"parent",
",",
"IsolationLevel",
"desiredLevel",
")",
"{",
"if",
"(",
"desiredLevel",
"==",
"null",
")",
"{",
"if",
"(",
"parent",
"==",
"null",
")",
"{",
"desiredLevel",
"=",
"mDefaultIsolationLevel",
... | Returns the highest supported level for the given desired level.
@return null if not supported | [
"Returns",
"the",
"highest",
"supported",
"level",
"for",
"the",
"given",
"desired",
"level",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepository.java#L548-L579 |
sdl/Testy | src/main/java/com/sdl/selenium/web/XPathBuilder.java | XPathBuilder.setLabel | @SuppressWarnings("unchecked")
public <T extends XPathBuilder> T setLabel(final String label, final SearchType... searchTypes) {
this.label = label;
if (searchTypes != null && searchTypes.length > 0) {
setSearchLabelType(searchTypes);
}
return (T) this;
} | java | @SuppressWarnings("unchecked")
public <T extends XPathBuilder> T setLabel(final String label, final SearchType... searchTypes) {
this.label = label;
if (searchTypes != null && searchTypes.length > 0) {
setSearchLabelType(searchTypes);
}
return (T) this;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
"extends",
"XPathBuilder",
">",
"T",
"setLabel",
"(",
"final",
"String",
"label",
",",
"final",
"SearchType",
"...",
"searchTypes",
")",
"{",
"this",
".",
"label",
"=",
"label",
";",
"... | <p><b>Used for finding element process (to generate xpath address)</b></p>
@param label text label element
@param searchTypes type search text element: see more details see {@link SearchType}
@param <T> the element which calls this method
@return this element | [
"<p",
">",
"<b",
">",
"Used",
"for",
"finding",
"element",
"process",
"(",
"to",
"generate",
"xpath",
"address",
")",
"<",
"/",
"b",
">",
"<",
"/",
"p",
">"
] | train | https://github.com/sdl/Testy/blob/b3ae061554016f926f04694a39ff00dab7576609/src/main/java/com/sdl/selenium/web/XPathBuilder.java#L525-L532 |
wildfly/wildfly-core | embedded/src/main/java/org/wildfly/core/embedded/EmbeddedProcessFactory.java | EmbeddedProcessFactory.createStandaloneServer | public static StandaloneServer createStandaloneServer(ModuleLoader moduleLoader, File jbossHomeDir, String... cmdargs) {
return createStandaloneServer(
Configuration.Builder.of(jbossHomeDir)
.setCommandArguments(cmdargs)
.setModuleLoader(moduleLoader)
.build()
);
} | java | public static StandaloneServer createStandaloneServer(ModuleLoader moduleLoader, File jbossHomeDir, String... cmdargs) {
return createStandaloneServer(
Configuration.Builder.of(jbossHomeDir)
.setCommandArguments(cmdargs)
.setModuleLoader(moduleLoader)
.build()
);
} | [
"public",
"static",
"StandaloneServer",
"createStandaloneServer",
"(",
"ModuleLoader",
"moduleLoader",
",",
"File",
"jbossHomeDir",
",",
"String",
"...",
"cmdargs",
")",
"{",
"return",
"createStandaloneServer",
"(",
"Configuration",
".",
"Builder",
".",
"of",
"(",
"... | Create an embedded standalone server with an already established module loader.
@param moduleLoader the module loader. Cannot be {@code null}
@param jbossHomeDir the location of the root of server installation. Cannot be {@code null} or empty.
@param cmdargs any additional arguments to pass to the embedded server (e.g. -b=192.168.100.10)
@return the running embedded server. Will not be {@code null} | [
"Create",
"an",
"embedded",
"standalone",
"server",
"with",
"an",
"already",
"established",
"module",
"loader",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/embedded/src/main/java/org/wildfly/core/embedded/EmbeddedProcessFactory.java#L133-L140 |
ACRA/acra | acra-core/src/main/java/org/acra/util/ToastSender.java | ToastSender.sendToast | public static void sendToast(@NonNull Context context, String toast, @IntRange(from = 0, to = 1) int toastLength) {
try {
Toast.makeText(context, toast, toastLength).show();
} catch (RuntimeException e) {
ACRA.log.w(LOG_TAG, "Could not send crash Toast", e);
}
} | java | public static void sendToast(@NonNull Context context, String toast, @IntRange(from = 0, to = 1) int toastLength) {
try {
Toast.makeText(context, toast, toastLength).show();
} catch (RuntimeException e) {
ACRA.log.w(LOG_TAG, "Could not send crash Toast", e);
}
} | [
"public",
"static",
"void",
"sendToast",
"(",
"@",
"NonNull",
"Context",
"context",
",",
"String",
"toast",
",",
"@",
"IntRange",
"(",
"from",
"=",
"0",
",",
"to",
"=",
"1",
")",
"int",
"toastLength",
")",
"{",
"try",
"{",
"Toast",
".",
"makeText",
"... | Sends a Toast and ensures that any Exception thrown during sending is handled.
@param context Application context.
@param toast toast message.
@param toastLength Length of the Toast. | [
"Sends",
"a",
"Toast",
"and",
"ensures",
"that",
"any",
"Exception",
"thrown",
"during",
"sending",
"is",
"handled",
"."
] | train | https://github.com/ACRA/acra/blob/bfa3235ab110328c5ab2f792ddf8ee87be4a32d1/acra-core/src/main/java/org/acra/util/ToastSender.java#L45-L51 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/ExpressRouteCircuitAuthorizationsInner.java | ExpressRouteCircuitAuthorizationsInner.beginCreateOrUpdateAsync | public Observable<ExpressRouteCircuitAuthorizationInner> beginCreateOrUpdateAsync(String resourceGroupName, String circuitName, String authorizationName, ExpressRouteCircuitAuthorizationInner authorizationParameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, circuitName, authorizationName, authorizationParameters).map(new Func1<ServiceResponse<ExpressRouteCircuitAuthorizationInner>, ExpressRouteCircuitAuthorizationInner>() {
@Override
public ExpressRouteCircuitAuthorizationInner call(ServiceResponse<ExpressRouteCircuitAuthorizationInner> response) {
return response.body();
}
});
} | java | public Observable<ExpressRouteCircuitAuthorizationInner> beginCreateOrUpdateAsync(String resourceGroupName, String circuitName, String authorizationName, ExpressRouteCircuitAuthorizationInner authorizationParameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, circuitName, authorizationName, authorizationParameters).map(new Func1<ServiceResponse<ExpressRouteCircuitAuthorizationInner>, ExpressRouteCircuitAuthorizationInner>() {
@Override
public ExpressRouteCircuitAuthorizationInner call(ServiceResponse<ExpressRouteCircuitAuthorizationInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ExpressRouteCircuitAuthorizationInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"circuitName",
",",
"String",
"authorizationName",
",",
"ExpressRouteCircuitAuthorizationInner",
"authorizationParameters",
")... | Creates or updates an authorization in the specified express route circuit.
@param resourceGroupName The name of the resource group.
@param circuitName The name of the express route circuit.
@param authorizationName The name of the authorization.
@param authorizationParameters Parameters supplied to the create or update express route circuit authorization operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ExpressRouteCircuitAuthorizationInner object | [
"Creates",
"or",
"updates",
"an",
"authorization",
"in",
"the",
"specified",
"express",
"route",
"circuit",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/ExpressRouteCircuitAuthorizationsInner.java#L473-L480 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.task_contactChange_id_GET | public net.minidev.ovh.api.nichandle.contactchange.OvhTask task_contactChange_id_GET(Long id) throws IOException {
String qPath = "/me/task/contactChange/{id}";
StringBuilder sb = path(qPath, id);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, net.minidev.ovh.api.nichandle.contactchange.OvhTask.class);
} | java | public net.minidev.ovh.api.nichandle.contactchange.OvhTask task_contactChange_id_GET(Long id) throws IOException {
String qPath = "/me/task/contactChange/{id}";
StringBuilder sb = path(qPath, id);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, net.minidev.ovh.api.nichandle.contactchange.OvhTask.class);
} | [
"public",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"nichandle",
".",
"contactchange",
".",
"OvhTask",
"task_contactChange_id_GET",
"(",
"Long",
"id",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/task/contactChange/{id}\"",
";",
"S... | Get this object properties
REST: GET /me/task/contactChange/{id}
@param id [required] | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L2491-L2496 |
Alluxio/alluxio | shell/src/main/java/alluxio/cli/GetConf.java | GetConf.getConf | public static int getConf(ClientContext ctx, String... args) {
return getConfImpl(
() -> new RetryHandlingMetaMasterConfigClient(MasterClientContext.newBuilder(ctx).build()),
ctx.getConf(), args);
} | java | public static int getConf(ClientContext ctx, String... args) {
return getConfImpl(
() -> new RetryHandlingMetaMasterConfigClient(MasterClientContext.newBuilder(ctx).build()),
ctx.getConf(), args);
} | [
"public",
"static",
"int",
"getConf",
"(",
"ClientContext",
"ctx",
",",
"String",
"...",
"args",
")",
"{",
"return",
"getConfImpl",
"(",
"(",
")",
"->",
"new",
"RetryHandlingMetaMasterConfigClient",
"(",
"MasterClientContext",
".",
"newBuilder",
"(",
"ctx",
")",... | Implements get configuration.
@param ctx Alluxio client configuration
@param args list of arguments
@return 0 on success, 1 on failures | [
"Implements",
"get",
"configuration",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/GetConf.java#L143-L147 |
strator-dev/greenpepper | greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java | ConfluenceGreenPepper.setPageProperty | public void setPageProperty(String key, String value, String identifier) {
Space space = getSpaceManager().getSpace(identifier);
ContentEntityObject entityObject = getContentEntityManager().getById(space.getHomePage().getId());
getContentPropertyManager().setStringProperty(entityObject, ServerPropertiesManager.SEQUENCE + key, value);
} | java | public void setPageProperty(String key, String value, String identifier) {
Space space = getSpaceManager().getSpace(identifier);
ContentEntityObject entityObject = getContentEntityManager().getById(space.getHomePage().getId());
getContentPropertyManager().setStringProperty(entityObject, ServerPropertiesManager.SEQUENCE + key, value);
} | [
"public",
"void",
"setPageProperty",
"(",
"String",
"key",
",",
"String",
"value",
",",
"String",
"identifier",
")",
"{",
"Space",
"space",
"=",
"getSpaceManager",
"(",
")",
".",
"getSpace",
"(",
"identifier",
")",
";",
"ContentEntityObject",
"entityObject",
"... | <p>setPageProperty.</p>
@param key a {@link java.lang.String} object.
@param value a {@link java.lang.String} object.
@param identifier a {@link java.lang.String} object. | [
"<p",
">",
"setPageProperty",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java#L853-L857 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java | MapIterate.collectIf | public static <K1, V1, K2, V2> MutableMap<K2, V2> collectIf(
Map<K1, V1> map,
final Function2<? super K1, ? super V1, Pair<K2, V2>> function,
final Predicate2<? super K1, ? super V1> predicate,
Map<K2, V2> target)
{
final MutableMap<K2, V2> result = MapAdapter.adapt(target);
MapIterate.forEachKeyValue(map, new Procedure2<K1, V1>()
{
public void value(K1 key, V1 value)
{
if (predicate.accept(key, value))
{
Pair<K2, V2> pair = function.value(key, value);
result.put(pair.getOne(), pair.getTwo());
}
}
});
return result;
} | java | public static <K1, V1, K2, V2> MutableMap<K2, V2> collectIf(
Map<K1, V1> map,
final Function2<? super K1, ? super V1, Pair<K2, V2>> function,
final Predicate2<? super K1, ? super V1> predicate,
Map<K2, V2> target)
{
final MutableMap<K2, V2> result = MapAdapter.adapt(target);
MapIterate.forEachKeyValue(map, new Procedure2<K1, V1>()
{
public void value(K1 key, V1 value)
{
if (predicate.accept(key, value))
{
Pair<K2, V2> pair = function.value(key, value);
result.put(pair.getOne(), pair.getTwo());
}
}
});
return result;
} | [
"public",
"static",
"<",
"K1",
",",
"V1",
",",
"K2",
",",
"V2",
">",
"MutableMap",
"<",
"K2",
",",
"V2",
">",
"collectIf",
"(",
"Map",
"<",
"K1",
",",
"V1",
">",
"map",
",",
"final",
"Function2",
"<",
"?",
"super",
"K1",
",",
"?",
"super",
"V1"... | For each value of the map, the Predicate2 is evaluated with the key and value as the parameter,
and if true, then {@code function} is applied.
The results of these evaluations are collected into the target map. | [
"For",
"each",
"value",
"of",
"the",
"map",
"the",
"Predicate2",
"is",
"evaluated",
"with",
"the",
"key",
"and",
"value",
"as",
"the",
"parameter",
"and",
"if",
"true",
"then",
"{"
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java#L702-L723 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java | TrainingsImpl.getIteration | public Iteration getIteration(UUID projectId, UUID iterationId) {
return getIterationWithServiceResponseAsync(projectId, iterationId).toBlocking().single().body();
} | java | public Iteration getIteration(UUID projectId, UUID iterationId) {
return getIterationWithServiceResponseAsync(projectId, iterationId).toBlocking().single().body();
} | [
"public",
"Iteration",
"getIteration",
"(",
"UUID",
"projectId",
",",
"UUID",
"iterationId",
")",
"{",
"return",
"getIterationWithServiceResponseAsync",
"(",
"projectId",
",",
"iterationId",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",... | Get a specific iteration.
@param projectId The id of the project the iteration belongs to
@param iterationId The id of the iteration to get
@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 Iteration object if successful. | [
"Get",
"a",
"specific",
"iteration",
"."
] | 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/implementation/TrainingsImpl.java#L1964-L1966 |
OpenLiberty/open-liberty | dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/java2sec/PermissionManager.java | PermissionManager.addPermissionsXMLPermission | public void addPermissionsXMLPermission(CodeSource codeSource, Permission permission) {
ArrayList<Permission> permissions = null;
String codeBase = codeSource.getLocation().getPath();
if (!isRestricted(permission)) {
if (permissionXMLPermissionMap.containsKey(codeBase)) {
permissions = permissionXMLPermissionMap.get(codeBase);
permissions.add(permission);
} else {
permissions = new ArrayList<Permission>();
permissions.add(permission);
permissionXMLPermissionMap.put(codeBase, permissions);
}
}
} | java | public void addPermissionsXMLPermission(CodeSource codeSource, Permission permission) {
ArrayList<Permission> permissions = null;
String codeBase = codeSource.getLocation().getPath();
if (!isRestricted(permission)) {
if (permissionXMLPermissionMap.containsKey(codeBase)) {
permissions = permissionXMLPermissionMap.get(codeBase);
permissions.add(permission);
} else {
permissions = new ArrayList<Permission>();
permissions.add(permission);
permissionXMLPermissionMap.put(codeBase, permissions);
}
}
} | [
"public",
"void",
"addPermissionsXMLPermission",
"(",
"CodeSource",
"codeSource",
",",
"Permission",
"permission",
")",
"{",
"ArrayList",
"<",
"Permission",
">",
"permissions",
"=",
"null",
";",
"String",
"codeBase",
"=",
"codeSource",
".",
"getLocation",
"(",
")"... | Adds a permission from the permissions.xml file for the given CodeSource.
@param codeSource - The CodeSource of the code the specified permission was granted to.
@param permissions - The permissions granted in the permissions.xml of the application.
@return the effective granted permissions | [
"Adds",
"a",
"permission",
"from",
"the",
"permissions",
".",
"xml",
"file",
"for",
"the",
"given",
"CodeSource",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/java2sec/PermissionManager.java#L618-L632 |
cesarferreira/AndroidQuickUtils | library/src/main/java/quickutils/core/categories/sdcard.java | sdcard.writeToFile | public void writeToFile(File file, String fileContent) {
if (!file.exists()) {
try {
FileWriter writer = new FileWriter(file);
writer.write(fileContent);
writer.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
}
}
} | java | public void writeToFile(File file, String fileContent) {
if (!file.exists()) {
try {
FileWriter writer = new FileWriter(file);
writer.write(fileContent);
writer.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
}
}
} | [
"public",
"void",
"writeToFile",
"(",
"File",
"file",
",",
"String",
"fileContent",
")",
"{",
"if",
"(",
"!",
"file",
".",
"exists",
"(",
")",
")",
"{",
"try",
"{",
"FileWriter",
"writer",
"=",
"new",
"FileWriter",
"(",
"file",
")",
";",
"writer",
".... | Writes a file to Disk.
This is an I/O operation and this method executes in the main thread, so it is recommended to
perform this operation using another thread.
@param file The file to write to Disk. | [
"Writes",
"a",
"file",
"to",
"Disk",
".",
"This",
"is",
"an",
"I",
"/",
"O",
"operation",
"and",
"this",
"method",
"executes",
"in",
"the",
"main",
"thread",
"so",
"it",
"is",
"recommended",
"to",
"perform",
"this",
"operation",
"using",
"another",
"thre... | train | https://github.com/cesarferreira/AndroidQuickUtils/blob/73a91daedbb9f7be7986ea786fbc441c9e5a881c/library/src/main/java/quickutils/core/categories/sdcard.java#L270-L284 |
stephenc/redmine-java-api | src/main/java/org/redmine/ta/RedmineManager.java | RedmineManager.createIssue | public Issue createIssue(String projectKey, Issue issue) throws RedmineException {
final Project oldProject = issue.getProject();
final Project newProject = new Project();
newProject.setIdentifier(projectKey);
issue.setProject(newProject);
try {
return transport.addObject(issue, new BasicNameValuePair("include",
INCLUDE.attachments.toString()));
} finally {
issue.setProject(oldProject);
}
} | java | public Issue createIssue(String projectKey, Issue issue) throws RedmineException {
final Project oldProject = issue.getProject();
final Project newProject = new Project();
newProject.setIdentifier(projectKey);
issue.setProject(newProject);
try {
return transport.addObject(issue, new BasicNameValuePair("include",
INCLUDE.attachments.toString()));
} finally {
issue.setProject(oldProject);
}
} | [
"public",
"Issue",
"createIssue",
"(",
"String",
"projectKey",
",",
"Issue",
"issue",
")",
"throws",
"RedmineException",
"{",
"final",
"Project",
"oldProject",
"=",
"issue",
".",
"getProject",
"(",
")",
";",
"final",
"Project",
"newProject",
"=",
"new",
"Proje... | Sample usage:
<p/>
<p/>
<pre>
{@code
Issue issueToCreate = new Issue();
issueToCreate.setSubject("This is the summary line 123");
Issue newIssue = mgr.createIssue(PROJECT_KEY, issueToCreate);
}
@param projectKey The project "identifier". This is a string key like "project-ABC", NOT a database numeric ID.
@param issue the Issue object to create on the server.
@return the newly created Issue.
@throws RedmineAuthenticationException invalid or no API access key is used with the server, which
requires authorization. Check the constructor arguments.
@throws NotFoundException the project with the given projectKey is not found
@throws RedmineException | [
"Sample",
"usage",
":",
"<p",
"/",
">",
"<p",
"/",
">",
"<pre",
">",
"{",
"@code",
"Issue",
"issueToCreate",
"=",
"new",
"Issue",
"()",
";",
"issueToCreate",
".",
"setSubject",
"(",
"This",
"is",
"the",
"summary",
"line",
"123",
")",
";",
"Issue",
"n... | train | https://github.com/stephenc/redmine-java-api/blob/7e5270c84aba32d74a506260ec47ff86ab6c9d84/src/main/java/org/redmine/ta/RedmineManager.java#L133-L144 |
CycloneDX/cyclonedx-core-java | src/main/java/org/cyclonedx/BomParser.java | BomParser.isValid | public boolean isValid(File file, CycloneDxSchema.Version schemaVersion) {
return validate(file, schemaVersion).isEmpty();
} | java | public boolean isValid(File file, CycloneDxSchema.Version schemaVersion) {
return validate(file, schemaVersion).isEmpty();
} | [
"public",
"boolean",
"isValid",
"(",
"File",
"file",
",",
"CycloneDxSchema",
".",
"Version",
"schemaVersion",
")",
"{",
"return",
"validate",
"(",
"file",
",",
"schemaVersion",
")",
".",
"isEmpty",
"(",
")",
";",
"}"
] | Verifies a CycloneDX BoM conforms to the specification through XML validation.
@param file the CycloneDX BoM file to validate
@param schemaVersion the schema version to validate against
@return true is the file is a valid BoM, false if not
@since 2.0.0 | [
"Verifies",
"a",
"CycloneDX",
"BoM",
"conforms",
"to",
"the",
"specification",
"through",
"XML",
"validation",
"."
] | train | https://github.com/CycloneDX/cyclonedx-core-java/blob/45f8f55a7f308f41280b834f179b48ea852b8c20/src/main/java/org/cyclonedx/BomParser.java#L159-L161 |
apache/spark | core/src/main/java/org/apache/spark/util/collection/TimSort.java | TimSort.binarySort | @SuppressWarnings("fallthrough")
private void binarySort(Buffer a, int lo, int hi, int start, Comparator<? super K> c) {
assert lo <= start && start <= hi;
if (start == lo)
start++;
K key0 = s.newKey();
K key1 = s.newKey();
Buffer pivotStore = s.allocate(1);
for ( ; start < hi; start++) {
s.copyElement(a, start, pivotStore, 0);
K pivot = s.getKey(pivotStore, 0, key0);
// Set left (and right) to the index where a[start] (pivot) belongs
int left = lo;
int right = start;
assert left <= right;
/*
* Invariants:
* pivot >= all in [lo, left).
* pivot < all in [right, start).
*/
while (left < right) {
int mid = (left + right) >>> 1;
if (c.compare(pivot, s.getKey(a, mid, key1)) < 0)
right = mid;
else
left = mid + 1;
}
assert left == right;
/*
* The invariants still hold: pivot >= all in [lo, left) and
* pivot < all in [left, start), so pivot belongs at left. Note
* that if there are elements equal to pivot, left points to the
* first slot after them -- that's why this sort is stable.
* Slide elements over to make room for pivot.
*/
int n = start - left; // The number of elements to move
// Switch is just an optimization for arraycopy in default case
switch (n) {
case 2: s.copyElement(a, left + 1, a, left + 2);
case 1: s.copyElement(a, left, a, left + 1);
break;
default: s.copyRange(a, left, a, left + 1, n);
}
s.copyElement(pivotStore, 0, a, left);
}
} | java | @SuppressWarnings("fallthrough")
private void binarySort(Buffer a, int lo, int hi, int start, Comparator<? super K> c) {
assert lo <= start && start <= hi;
if (start == lo)
start++;
K key0 = s.newKey();
K key1 = s.newKey();
Buffer pivotStore = s.allocate(1);
for ( ; start < hi; start++) {
s.copyElement(a, start, pivotStore, 0);
K pivot = s.getKey(pivotStore, 0, key0);
// Set left (and right) to the index where a[start] (pivot) belongs
int left = lo;
int right = start;
assert left <= right;
/*
* Invariants:
* pivot >= all in [lo, left).
* pivot < all in [right, start).
*/
while (left < right) {
int mid = (left + right) >>> 1;
if (c.compare(pivot, s.getKey(a, mid, key1)) < 0)
right = mid;
else
left = mid + 1;
}
assert left == right;
/*
* The invariants still hold: pivot >= all in [lo, left) and
* pivot < all in [left, start), so pivot belongs at left. Note
* that if there are elements equal to pivot, left points to the
* first slot after them -- that's why this sort is stable.
* Slide elements over to make room for pivot.
*/
int n = start - left; // The number of elements to move
// Switch is just an optimization for arraycopy in default case
switch (n) {
case 2: s.copyElement(a, left + 1, a, left + 2);
case 1: s.copyElement(a, left, a, left + 1);
break;
default: s.copyRange(a, left, a, left + 1, n);
}
s.copyElement(pivotStore, 0, a, left);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"fallthrough\"",
")",
"private",
"void",
"binarySort",
"(",
"Buffer",
"a",
",",
"int",
"lo",
",",
"int",
"hi",
",",
"int",
"start",
",",
"Comparator",
"<",
"?",
"super",
"K",
">",
"c",
")",
"{",
"assert",
"lo",
"<=",
"... | Sorts the specified portion of the specified array using a binary
insertion sort. This is the best method for sorting small numbers
of elements. It requires O(n log n) compares, but O(n^2) data
movement (worst case).
If the initial part of the specified range is already sorted,
this method can take advantage of it: the method assumes that the
elements from index {@code lo}, inclusive, to {@code start},
exclusive are already sorted.
@param a the array in which a range is to be sorted
@param lo the index of the first element in the range to be sorted
@param hi the index after the last element in the range to be sorted
@param start the index of the first element in the range that is
not already known to be sorted ({@code lo <= start <= hi})
@param c comparator to used for the sort | [
"Sorts",
"the",
"specified",
"portion",
"of",
"the",
"specified",
"array",
"using",
"a",
"binary",
"insertion",
"sort",
".",
"This",
"is",
"the",
"best",
"method",
"for",
"sorting",
"small",
"numbers",
"of",
"elements",
".",
"It",
"requires",
"O",
"(",
"n"... | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/TimSort.java#L184-L233 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java | GoogleMapShapeConverter.toMultiLineStringFromList | public MultiLineString toMultiLineStringFromList(
List<List<LatLng>> polylineList, boolean hasZ, boolean hasM) {
MultiLineString multiLineString = new MultiLineString(hasZ, hasM);
for (List<LatLng> polyline : polylineList) {
LineString lineString = toLineString(polyline);
multiLineString.addLineString(lineString);
}
return multiLineString;
} | java | public MultiLineString toMultiLineStringFromList(
List<List<LatLng>> polylineList, boolean hasZ, boolean hasM) {
MultiLineString multiLineString = new MultiLineString(hasZ, hasM);
for (List<LatLng> polyline : polylineList) {
LineString lineString = toLineString(polyline);
multiLineString.addLineString(lineString);
}
return multiLineString;
} | [
"public",
"MultiLineString",
"toMultiLineStringFromList",
"(",
"List",
"<",
"List",
"<",
"LatLng",
">",
">",
"polylineList",
",",
"boolean",
"hasZ",
",",
"boolean",
"hasM",
")",
"{",
"MultiLineString",
"multiLineString",
"=",
"new",
"MultiLineString",
"(",
"hasZ",... | Convert a list of List<LatLng> to a {@link MultiLineString}
@param polylineList polyline list
@param hasZ has z flag
@param hasM has m flag
@return multi line string | [
"Convert",
"a",
"list",
"of",
"List<LatLng",
">",
"to",
"a",
"{",
"@link",
"MultiLineString",
"}"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L872-L883 |
elastic/elasticsearch-hadoop | mr/src/main/java/org/elasticsearch/hadoop/serialization/dto/mapping/FieldParser.java | FieldParser.parseMappings | public static MappingSet parseMappings(Map<String, Object> content, boolean includeTypeName) {
Iterator<Map.Entry<String, Object>> indices = content.entrySet().iterator();
List<Mapping> indexMappings = new ArrayList<Mapping>();
while(indices.hasNext()) {
// These mappings are ordered by index, then optionally type.
parseIndexMappings(indices.next(), indexMappings, includeTypeName);
}
return new MappingSet(indexMappings);
} | java | public static MappingSet parseMappings(Map<String, Object> content, boolean includeTypeName) {
Iterator<Map.Entry<String, Object>> indices = content.entrySet().iterator();
List<Mapping> indexMappings = new ArrayList<Mapping>();
while(indices.hasNext()) {
// These mappings are ordered by index, then optionally type.
parseIndexMappings(indices.next(), indexMappings, includeTypeName);
}
return new MappingSet(indexMappings);
} | [
"public",
"static",
"MappingSet",
"parseMappings",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"content",
",",
"boolean",
"includeTypeName",
")",
"{",
"Iterator",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"Object",
">",
">",
"indices",
"=",
"content... | Convert the deserialized mapping request body into an object
@param content entire mapping request body for all indices and types
@param includeTypeName true if the given content to be parsed includes type names within the structure,
or false if it is in the typeless format
@return MappingSet for that response. | [
"Convert",
"the",
"deserialized",
"mapping",
"request",
"body",
"into",
"an",
"object"
] | train | https://github.com/elastic/elasticsearch-hadoop/blob/f3acaba268ff96efae8eb946088c748c777c22cc/mr/src/main/java/org/elasticsearch/hadoop/serialization/dto/mapping/FieldParser.java#L54-L62 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/Dater.java | Dater.setClock | public Dater setClock(int hour, int minute, int second) {
return set().hours(hour).minutes(minute).second(second);
} | java | public Dater setClock(int hour, int minute, int second) {
return set().hours(hour).minutes(minute).second(second);
} | [
"public",
"Dater",
"setClock",
"(",
"int",
"hour",
",",
"int",
"minute",
",",
"int",
"second",
")",
"{",
"return",
"set",
"(",
")",
".",
"hours",
"(",
"hour",
")",
".",
"minutes",
"(",
"minute",
")",
".",
"second",
"(",
"second",
")",
";",
"}"
] | Sets the hour, minute, second to the delegate date
@param hour
@param minute
@param second
@return | [
"Sets",
"the",
"hour",
"minute",
"second",
"to",
"the",
"delegate",
"date"
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/Dater.java#L524-L526 |
belaban/JGroups | src/org/jgroups/conf/ConfiguratorFactory.java | ConfiguratorFactory.getStackConfigurator | public static ProtocolStackConfigurator getStackConfigurator(String properties) throws Exception {
if(properties == null)
properties=Global.DEFAULT_PROTOCOL_STACK;
// Attempt to treat the properties string as a pointer to an XML configuration.
XmlConfigurator configurator = null;
checkForNullConfiguration(properties);
configurator=getXmlConfigurator(properties);
if(configurator != null) // did the properties string point to a JGroups XML configuration ?
return configurator;
throw new IllegalStateException(String.format("configuration %s not found or invalid", properties));
} | java | public static ProtocolStackConfigurator getStackConfigurator(String properties) throws Exception {
if(properties == null)
properties=Global.DEFAULT_PROTOCOL_STACK;
// Attempt to treat the properties string as a pointer to an XML configuration.
XmlConfigurator configurator = null;
checkForNullConfiguration(properties);
configurator=getXmlConfigurator(properties);
if(configurator != null) // did the properties string point to a JGroups XML configuration ?
return configurator;
throw new IllegalStateException(String.format("configuration %s not found or invalid", properties));
} | [
"public",
"static",
"ProtocolStackConfigurator",
"getStackConfigurator",
"(",
"String",
"properties",
")",
"throws",
"Exception",
"{",
"if",
"(",
"properties",
"==",
"null",
")",
"properties",
"=",
"Global",
".",
"DEFAULT_PROTOCOL_STACK",
";",
"// Attempt to treat the p... | Returns a protocol stack configurator based on the provided properties string.
@param properties a string representing a system resource containing a JGroups XML configuration, a URL pointing
to a JGroups XML configuration or a string representing a file name that contains a JGroups
XML configuration. | [
"Returns",
"a",
"protocol",
"stack",
"configurator",
"based",
"on",
"the",
"provided",
"properties",
"string",
"."
] | train | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/conf/ConfiguratorFactory.java#L83-L96 |
threerings/nenya | core/src/main/java/com/threerings/miso/client/MisoScenePanel.java | MisoScenePanel.getBlock | public SceneBlock getBlock (int tx, int ty)
{
int bx = MathUtil.floorDiv(tx, _metrics.blockwid);
int by = MathUtil.floorDiv(ty, _metrics.blockhei);
return _blocks.get(compose(bx, by));
} | java | public SceneBlock getBlock (int tx, int ty)
{
int bx = MathUtil.floorDiv(tx, _metrics.blockwid);
int by = MathUtil.floorDiv(ty, _metrics.blockhei);
return _blocks.get(compose(bx, by));
} | [
"public",
"SceneBlock",
"getBlock",
"(",
"int",
"tx",
",",
"int",
"ty",
")",
"{",
"int",
"bx",
"=",
"MathUtil",
".",
"floorDiv",
"(",
"tx",
",",
"_metrics",
".",
"blockwid",
")",
";",
"int",
"by",
"=",
"MathUtil",
".",
"floorDiv",
"(",
"ty",
",",
"... | Returns the resolved block that contains the specified tile coordinate or null if no block
is resolved for that coordinate. | [
"Returns",
"the",
"resolved",
"block",
"that",
"contains",
"the",
"specified",
"tile",
"coordinate",
"or",
"null",
"if",
"no",
"block",
"is",
"resolved",
"for",
"that",
"coordinate",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L265-L270 |
roboconf/roboconf-platform | core/roboconf-dm/src/main/java/net/roboconf/dm/internal/api/impl/RandomMngrImpl.java | RandomMngrImpl.acknowledgePort | private boolean acknowledgePort( Application application, Instance instance, String exportedVariableName ) {
boolean acknowledged = false;
String value = instance.overriddenExports.get( exportedVariableName );
if( value != null ) {
// If there is an overridden value, use it
this.logger.fine( "Acknowledging random port value for " + exportedVariableName + " in instance " + instance + " of " + application );
Integer portValue = Integer.parseInt( value );
InstanceContext ctx = findAgentContext( application, instance );
List<Integer> associatedPorts = this.agentToRandomPorts.get( ctx );
if( associatedPorts == null ) {
associatedPorts = new ArrayList<> ();
this.agentToRandomPorts.put( ctx, associatedPorts );
}
// Verify it is not already used.
// And cache it so that we do not pick it up later.
if( associatedPorts.contains( portValue )) {
this.logger.warning( "Random port already used! Failed to acknowledge/restore " + exportedVariableName + " in instance " + instance + " of " + application );
acknowledged = false;
} else {
associatedPorts.add( portValue );
acknowledged = true;
}
}
return acknowledged;
} | java | private boolean acknowledgePort( Application application, Instance instance, String exportedVariableName ) {
boolean acknowledged = false;
String value = instance.overriddenExports.get( exportedVariableName );
if( value != null ) {
// If there is an overridden value, use it
this.logger.fine( "Acknowledging random port value for " + exportedVariableName + " in instance " + instance + " of " + application );
Integer portValue = Integer.parseInt( value );
InstanceContext ctx = findAgentContext( application, instance );
List<Integer> associatedPorts = this.agentToRandomPorts.get( ctx );
if( associatedPorts == null ) {
associatedPorts = new ArrayList<> ();
this.agentToRandomPorts.put( ctx, associatedPorts );
}
// Verify it is not already used.
// And cache it so that we do not pick it up later.
if( associatedPorts.contains( portValue )) {
this.logger.warning( "Random port already used! Failed to acknowledge/restore " + exportedVariableName + " in instance " + instance + " of " + application );
acknowledged = false;
} else {
associatedPorts.add( portValue );
acknowledged = true;
}
}
return acknowledged;
} | [
"private",
"boolean",
"acknowledgePort",
"(",
"Application",
"application",
",",
"Instance",
"instance",
",",
"String",
"exportedVariableName",
")",
"{",
"boolean",
"acknowledged",
"=",
"false",
";",
"String",
"value",
"=",
"instance",
".",
"overriddenExports",
".",... | If the instance already has a value (overridden export) for a random variable, then use it.
<p>
Basically, we do not have to define an overridden export.
We only have to update the cache to not pick up the same port later.
</p>
@param application the application
@param instance the instance
@param exportedVariableName the name of the exported variable
@return | [
"If",
"the",
"instance",
"already",
"has",
"a",
"value",
"(",
"overridden",
"export",
")",
"for",
"a",
"random",
"variable",
"then",
"use",
"it",
".",
"<p",
">",
"Basically",
"we",
"do",
"not",
"have",
"to",
"define",
"an",
"overridden",
"export",
".",
... | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-dm/src/main/java/net/roboconf/dm/internal/api/impl/RandomMngrImpl.java#L264-L294 |
CenturyLinkCloud/mdw | mdw-common/src/com/centurylink/mdw/util/file/FileHelper.java | FileHelper.readFile | public static InputStream readFile(String filename, ClassLoader classLoader) throws IOException {
// first option: specified through system property
String configDir = System.getProperty(PropertyManager.MDW_CONFIG_LOCATION);
File file;
if (configDir == null)
file = new File(filename); // maybe fully-qualified file name
else if (configDir.endsWith("/"))
file = new File(configDir + filename);
else
file = new File(configDir + "/" + filename);
// next option: etc directory
if (!file.exists())
file = new File("etc/" + filename);
if (file.exists())
return new FileInputStream(file);
// not overridden so load from bundle classpath
String path = BUNDLE_CLASSPATH_BASE + "/" + filename;
return classLoader.getResourceAsStream(path);
} | java | public static InputStream readFile(String filename, ClassLoader classLoader) throws IOException {
// first option: specified through system property
String configDir = System.getProperty(PropertyManager.MDW_CONFIG_LOCATION);
File file;
if (configDir == null)
file = new File(filename); // maybe fully-qualified file name
else if (configDir.endsWith("/"))
file = new File(configDir + filename);
else
file = new File(configDir + "/" + filename);
// next option: etc directory
if (!file.exists())
file = new File("etc/" + filename);
if (file.exists())
return new FileInputStream(file);
// not overridden so load from bundle classpath
String path = BUNDLE_CLASSPATH_BASE + "/" + filename;
return classLoader.getResourceAsStream(path);
} | [
"public",
"static",
"InputStream",
"readFile",
"(",
"String",
"filename",
",",
"ClassLoader",
"classLoader",
")",
"throws",
"IOException",
"{",
"// first option: specified through system property",
"String",
"configDir",
"=",
"System",
".",
"getProperty",
"(",
"PropertyMa... | Read file according to the follow precedence:
- From directory specified by system property mdw.config.location
- From fully qualified file name if mdw.config.location is null
- From etc/ directory relative to java startup dir
- From META-INF/mdw using the designated class loader | [
"Read",
"file",
"according",
"to",
"the",
"follow",
"precedence",
":",
"-",
"From",
"directory",
"specified",
"by",
"system",
"property",
"mdw",
".",
"config",
".",
"location",
"-",
"From",
"fully",
"qualified",
"file",
"name",
"if",
"mdw",
".",
"config",
... | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/util/file/FileHelper.java#L372-L393 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/DateTimeField.java | DateTimeField.setValue | public int setValue(double value, boolean bDisplayOption, int iMoveMode)
{ // Set this field's value
java.util.Date dateTemp = new java.util.Date((long)value);
int iErrorCode = this.setData(dateTemp, bDisplayOption, iMoveMode);
return iErrorCode;
} | java | public int setValue(double value, boolean bDisplayOption, int iMoveMode)
{ // Set this field's value
java.util.Date dateTemp = new java.util.Date((long)value);
int iErrorCode = this.setData(dateTemp, bDisplayOption, iMoveMode);
return iErrorCode;
} | [
"public",
"int",
"setValue",
"(",
"double",
"value",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"// Set this field's value",
"java",
".",
"util",
".",
"Date",
"dateTemp",
"=",
"new",
"java",
".",
"util",
".",
"Date",
"(",
"(",
"lo... | Set the Value of this field as a double.
@param value The value of this field.
@param iDisplayOption If true, display the new field.
@param iMoveMove The move mode.
@return An error code (NORMAL_RETURN for success). | [
"Set",
"the",
"Value",
"of",
"this",
"field",
"as",
"a",
"double",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/DateTimeField.java#L251-L256 |
kiegroup/drools | drools-model/drools-canonical-model/src/main/java/org/drools/model/bitmask/OpenBitSet.java | OpenBitSet.andNotCount | public static long andNotCount(OpenBitSet a, OpenBitSet b) {
long tot = BitUtil.pop_andnot( a.bits, b.bits, 0, Math.min( a.wlen, b.wlen ) );
if (a.wlen > b.wlen) {
tot += BitUtil.pop_array( a.bits, b.wlen, a.wlen - b.wlen );
}
return tot;
} | java | public static long andNotCount(OpenBitSet a, OpenBitSet b) {
long tot = BitUtil.pop_andnot( a.bits, b.bits, 0, Math.min( a.wlen, b.wlen ) );
if (a.wlen > b.wlen) {
tot += BitUtil.pop_array( a.bits, b.wlen, a.wlen - b.wlen );
}
return tot;
} | [
"public",
"static",
"long",
"andNotCount",
"(",
"OpenBitSet",
"a",
",",
"OpenBitSet",
"b",
")",
"{",
"long",
"tot",
"=",
"BitUtil",
".",
"pop_andnot",
"(",
"a",
".",
"bits",
",",
"b",
".",
"bits",
",",
"0",
",",
"Math",
".",
"min",
"(",
"a",
".",
... | Returns the popcount or cardinality of "a and not b"
or "intersection(a, not(b))".
Neither set is modified. | [
"Returns",
"the",
"popcount",
"or",
"cardinality",
"of",
"a",
"and",
"not",
"b",
"or",
"intersection",
"(",
"a",
"not",
"(",
"b",
"))",
".",
"Neither",
"set",
"is",
"modified",
"."
] | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-model/drools-canonical-model/src/main/java/org/drools/model/bitmask/OpenBitSet.java#L588-L594 |
VoltDB/voltdb | src/frontend/org/voltdb/planner/SubPlanAssembler.java | SubPlanAssembler.filterPostPredicateForPartialIndex | private void filterPostPredicateForPartialIndex(AccessPath path, List<AbstractExpression> exprToRemove) {
path.otherExprs.removeAll(exprToRemove);
// Keep the eliminated expressions for cost estimating purpose
path.eliminatedPostExprs.addAll(exprToRemove);
} | java | private void filterPostPredicateForPartialIndex(AccessPath path, List<AbstractExpression> exprToRemove) {
path.otherExprs.removeAll(exprToRemove);
// Keep the eliminated expressions for cost estimating purpose
path.eliminatedPostExprs.addAll(exprToRemove);
} | [
"private",
"void",
"filterPostPredicateForPartialIndex",
"(",
"AccessPath",
"path",
",",
"List",
"<",
"AbstractExpression",
">",
"exprToRemove",
")",
"{",
"path",
".",
"otherExprs",
".",
"removeAll",
"(",
"exprToRemove",
")",
";",
"// Keep the eliminated expressions for... | Partial index optimization: Remove query expressions that exactly match the index WHERE expression(s)
from the access path.
@param path - Partial Index access path
@param exprToRemove - expressions to remove | [
"Partial",
"index",
"optimization",
":",
"Remove",
"query",
"expressions",
"that",
"exactly",
"match",
"the",
"index",
"WHERE",
"expression",
"(",
"s",
")",
"from",
"the",
"access",
"path",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/planner/SubPlanAssembler.java#L2309-L2313 |
kite-sdk/kite | kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/Compatibility.java | Compatibility.checkDatasetName | public static void checkDatasetName(String namespace, String name) {
Preconditions.checkNotNull(namespace, "Namespace cannot be null");
Preconditions.checkNotNull(name, "Dataset name cannot be null");
ValidationException.check(Compatibility.isCompatibleName(namespace),
"Namespace %s is not alphanumeric (plus '_')",
namespace);
ValidationException.check(Compatibility.isCompatibleName(name),
"Dataset name %s is not alphanumeric (plus '_')",
name);
} | java | public static void checkDatasetName(String namespace, String name) {
Preconditions.checkNotNull(namespace, "Namespace cannot be null");
Preconditions.checkNotNull(name, "Dataset name cannot be null");
ValidationException.check(Compatibility.isCompatibleName(namespace),
"Namespace %s is not alphanumeric (plus '_')",
namespace);
ValidationException.check(Compatibility.isCompatibleName(name),
"Dataset name %s is not alphanumeric (plus '_')",
name);
} | [
"public",
"static",
"void",
"checkDatasetName",
"(",
"String",
"namespace",
",",
"String",
"name",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"namespace",
",",
"\"Namespace cannot be null\"",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"name",
"... | Precondition-style validation that a dataset name is compatible.
@param namespace a String namespace
@param name a String name | [
"Precondition",
"-",
"style",
"validation",
"that",
"a",
"dataset",
"name",
"is",
"compatible",
"."
] | train | https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/Compatibility.java#L99-L108 |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/data/clock/Day.java | Day.getLastOfMonth | public static Day getLastOfMonth(int dayOfWeek, int month, int year)
{
Day day = Day.getNthOfMonth(5, dayOfWeek, month, year);
return day != null ? day : Day.getNthOfMonth(4, dayOfWeek, month, year);
} | java | public static Day getLastOfMonth(int dayOfWeek, int month, int year)
{
Day day = Day.getNthOfMonth(5, dayOfWeek, month, year);
return day != null ? day : Day.getNthOfMonth(4, dayOfWeek, month, year);
} | [
"public",
"static",
"Day",
"getLastOfMonth",
"(",
"int",
"dayOfWeek",
",",
"int",
"month",
",",
"int",
"year",
")",
"{",
"Day",
"day",
"=",
"Day",
".",
"getNthOfMonth",
"(",
"5",
",",
"dayOfWeek",
",",
"month",
",",
"year",
")",
";",
"return",
"day",
... | Find the last of a specific day in a given month. For instance
last Tuesday of May:
getLastOfMonth (Calendar.TUESDAY, Calendar.MAY, 2005);
@param dayOfWeek Weekday to get.
@param month Month of day to get.
@param year Year of day to get.
@return The requested day. | [
"Find",
"the",
"last",
"of",
"a",
"specific",
"day",
"in",
"a",
"given",
"month",
".",
"For",
"instance",
"last",
"Tuesday",
"of",
"May",
":",
"getLastOfMonth",
"(",
"Calendar",
".",
"TUESDAY",
"Calendar",
".",
"MAY",
"2005",
")",
";"
] | train | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/data/clock/Day.java#L605-L609 |
EvidentSolutions/dalesbred | dalesbred/src/main/java/org/dalesbred/Database.java | Database.findUnique | public <T> T findUnique(@NotNull Class<T> cl, @NotNull @SQL String sql, Object... args) {
return findUnique(cl, SqlQuery.query(sql, args));
} | java | public <T> T findUnique(@NotNull Class<T> cl, @NotNull @SQL String sql, Object... args) {
return findUnique(cl, SqlQuery.query(sql, args));
} | [
"public",
"<",
"T",
">",
"T",
"findUnique",
"(",
"@",
"NotNull",
"Class",
"<",
"T",
">",
"cl",
",",
"@",
"NotNull",
"@",
"SQL",
"String",
"sql",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"findUnique",
"(",
"cl",
",",
"SqlQuery",
".",
"query... | Finds a unique result from database, converting the database row to given class using default mechanisms.
@throws NonUniqueResultException if there is more then one row
@throws EmptyResultException if there are no rows | [
"Finds",
"a",
"unique",
"result",
"from",
"database",
"converting",
"the",
"database",
"row",
"to",
"given",
"class",
"using",
"default",
"mechanisms",
"."
] | train | https://github.com/EvidentSolutions/dalesbred/blob/713f5b6e152d97e1672ca68b9ff9c7c6c288ceb1/dalesbred/src/main/java/org/dalesbred/Database.java#L362-L364 |
auth0/java-jwt | lib/src/main/java/com/auth0/jwt/TokenUtils.java | TokenUtils.splitToken | static String[] splitToken(String token) throws JWTDecodeException {
String[] parts = token.split("\\.");
if (parts.length == 2 && token.endsWith(".")) {
//Tokens with alg='none' have empty String as Signature.
parts = new String[]{parts[0], parts[1], ""};
}
if (parts.length != 3) {
throw new JWTDecodeException(String.format("The token was expected to have 3 parts, but got %s.", parts.length));
}
return parts;
} | java | static String[] splitToken(String token) throws JWTDecodeException {
String[] parts = token.split("\\.");
if (parts.length == 2 && token.endsWith(".")) {
//Tokens with alg='none' have empty String as Signature.
parts = new String[]{parts[0], parts[1], ""};
}
if (parts.length != 3) {
throw new JWTDecodeException(String.format("The token was expected to have 3 parts, but got %s.", parts.length));
}
return parts;
} | [
"static",
"String",
"[",
"]",
"splitToken",
"(",
"String",
"token",
")",
"throws",
"JWTDecodeException",
"{",
"String",
"[",
"]",
"parts",
"=",
"token",
".",
"split",
"(",
"\"\\\\.\"",
")",
";",
"if",
"(",
"parts",
".",
"length",
"==",
"2",
"&&",
"toke... | Splits the given token on the "." chars into a String array with 3 parts.
@param token the string to split.
@return the array representing the 3 parts of the token.
@throws JWTDecodeException if the Token doesn't have 3 parts. | [
"Splits",
"the",
"given",
"token",
"on",
"the",
".",
"chars",
"into",
"a",
"String",
"array",
"with",
"3",
"parts",
"."
] | train | https://github.com/auth0/java-jwt/blob/890538970a9699b7251a4bfe4f26e8d7605ad530/lib/src/main/java/com/auth0/jwt/TokenUtils.java#L14-L24 |
Azure/azure-sdk-for-java | datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java | ServicesInner.beginCreateOrUpdateAsync | public Observable<DataMigrationServiceInner> beginCreateOrUpdateAsync(String groupName, String serviceName, DataMigrationServiceInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(groupName, serviceName, parameters).map(new Func1<ServiceResponse<DataMigrationServiceInner>, DataMigrationServiceInner>() {
@Override
public DataMigrationServiceInner call(ServiceResponse<DataMigrationServiceInner> response) {
return response.body();
}
});
} | java | public Observable<DataMigrationServiceInner> beginCreateOrUpdateAsync(String groupName, String serviceName, DataMigrationServiceInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(groupName, serviceName, parameters).map(new Func1<ServiceResponse<DataMigrationServiceInner>, DataMigrationServiceInner>() {
@Override
public DataMigrationServiceInner call(ServiceResponse<DataMigrationServiceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DataMigrationServiceInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"groupName",
",",
"String",
"serviceName",
",",
"DataMigrationServiceInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"groupN... | Create or update DMS Instance.
The services resource is the top-level resource that represents the Data Migration Service. The PUT method creates a new service or updates an existing one. When a service is updated, existing child resources (i.e. tasks) are unaffected. Services currently support a single kind, "vm", which refers to a VM-based service, although other kinds may be added in the future. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). The provider will reply when successful with 200 OK or 201 Created. Long-running operations use the provisioningState property.
@param groupName Name of the resource group
@param serviceName Name of the service
@param parameters Information about the service
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DataMigrationServiceInner object | [
"Create",
"or",
"update",
"DMS",
"Instance",
".",
"The",
"services",
"resource",
"is",
"the",
"top",
"-",
"level",
"resource",
"that",
"represents",
"the",
"Data",
"Migration",
"Service",
".",
"The",
"PUT",
"method",
"creates",
"a",
"new",
"service",
"or",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java#L274-L281 |
mnlipp/jgrapes | org.jgrapes.http/src/org/jgrapes/http/LanguageSelector.java | LanguageSelector.onRequest | @SuppressWarnings({ "PMD.DataflowAnomalyAnalysis", "PMD.EmptyCatchBlock" })
@RequestHandler(priority = 990, dynamic = true)
public void onRequest(Request.In event) {
@SuppressWarnings("PMD.AccessorClassGeneration")
final Selection selection = event.associated(Session.class)
.map(session -> (Selection) session.computeIfAbsent(
Selection.class, newKey -> new Selection(cookieName, path)))
.orElseGet(() -> new Selection(cookieName, path));
selection.setCurrentEvent(event);
event.setAssociated(Selection.class, selection);
if (selection.isExplicitlySet()) {
return;
}
// Try to get locale from cookies
final HttpRequest request = event.httpRequest();
Optional<String> localeNames = request.findValue(
HttpField.COOKIE, Converters.COOKIE_LIST)
.flatMap(cookieList -> cookieList.valueForName(cookieName));
if (localeNames.isPresent()) {
try {
List<Locale> cookieLocales = LOCALE_LIST
.fromFieldValue(localeNames.get());
if (!cookieLocales.isEmpty()) {
Collections.reverse(cookieLocales);
cookieLocales.stream()
.forEach(locale -> selection.prefer(locale));
return;
}
} catch (ParseException e) {
// Unusable
}
}
// Last resport: Accept-Language header field
Optional<List<ParameterizedValue<Locale>>> accepted = request.findValue(
HttpField.ACCEPT_LANGUAGE, Converters.LANGUAGE_LIST);
if (accepted.isPresent()) {
Locale[] locales = accepted.get().stream()
.sorted(ParameterizedValue.WEIGHT_COMPARATOR)
.map(value -> value.value()).toArray(Locale[]::new);
selection.updateFallbacks(locales);
}
} | java | @SuppressWarnings({ "PMD.DataflowAnomalyAnalysis", "PMD.EmptyCatchBlock" })
@RequestHandler(priority = 990, dynamic = true)
public void onRequest(Request.In event) {
@SuppressWarnings("PMD.AccessorClassGeneration")
final Selection selection = event.associated(Session.class)
.map(session -> (Selection) session.computeIfAbsent(
Selection.class, newKey -> new Selection(cookieName, path)))
.orElseGet(() -> new Selection(cookieName, path));
selection.setCurrentEvent(event);
event.setAssociated(Selection.class, selection);
if (selection.isExplicitlySet()) {
return;
}
// Try to get locale from cookies
final HttpRequest request = event.httpRequest();
Optional<String> localeNames = request.findValue(
HttpField.COOKIE, Converters.COOKIE_LIST)
.flatMap(cookieList -> cookieList.valueForName(cookieName));
if (localeNames.isPresent()) {
try {
List<Locale> cookieLocales = LOCALE_LIST
.fromFieldValue(localeNames.get());
if (!cookieLocales.isEmpty()) {
Collections.reverse(cookieLocales);
cookieLocales.stream()
.forEach(locale -> selection.prefer(locale));
return;
}
} catch (ParseException e) {
// Unusable
}
}
// Last resport: Accept-Language header field
Optional<List<ParameterizedValue<Locale>>> accepted = request.findValue(
HttpField.ACCEPT_LANGUAGE, Converters.LANGUAGE_LIST);
if (accepted.isPresent()) {
Locale[] locales = accepted.get().stream()
.sorted(ParameterizedValue.WEIGHT_COMPARATOR)
.map(value -> value.value()).toArray(Locale[]::new);
selection.updateFallbacks(locales);
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"PMD.DataflowAnomalyAnalysis\"",
",",
"\"PMD.EmptyCatchBlock\"",
"}",
")",
"@",
"RequestHandler",
"(",
"priority",
"=",
"990",
",",
"dynamic",
"=",
"true",
")",
"public",
"void",
"onRequest",
"(",
"Request",
".",
"In",
"event... | Associates the event with a {@link Selection} object
using `Selection.class` as association identifier.
@param event the event | [
"Associates",
"the",
"event",
"with",
"a",
"{",
"@link",
"Selection",
"}",
"object",
"using",
"Selection",
".",
"class",
"as",
"association",
"identifier",
"."
] | train | https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.http/src/org/jgrapes/http/LanguageSelector.java#L162-L205 |
Wikidata/Wikidata-Toolkit | wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/StatementUpdate.java | StatementUpdate.equivalentClaims | protected boolean equivalentClaims(Claim claim1, Claim claim2) {
return claim1.getMainSnak().equals(claim2.getMainSnak())
&& isSameSnakSet(claim1.getAllQualifiers(),
claim2.getAllQualifiers());
} | java | protected boolean equivalentClaims(Claim claim1, Claim claim2) {
return claim1.getMainSnak().equals(claim2.getMainSnak())
&& isSameSnakSet(claim1.getAllQualifiers(),
claim2.getAllQualifiers());
} | [
"protected",
"boolean",
"equivalentClaims",
"(",
"Claim",
"claim1",
",",
"Claim",
"claim2",
")",
"{",
"return",
"claim1",
".",
"getMainSnak",
"(",
")",
".",
"equals",
"(",
"claim2",
".",
"getMainSnak",
"(",
")",
")",
"&&",
"isSameSnakSet",
"(",
"claim1",
"... | Checks if two claims are equivalent in the sense that they have the same
main snak and the same qualifiers, but possibly in a different order.
@param claim1
@param claim2
@return true if claims are equivalent | [
"Checks",
"if",
"two",
"claims",
"are",
"equivalent",
"in",
"the",
"sense",
"that",
"they",
"have",
"the",
"same",
"main",
"snak",
"and",
"the",
"same",
"qualifiers",
"but",
"possibly",
"in",
"a",
"different",
"order",
"."
] | train | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/StatementUpdate.java#L535-L539 |
drinkjava2/jDialects | core/src/main/java/com/github/drinkjava2/jdialects/springsrc/utils/ReflectionUtils.java | ReflectionUtils.doWithLocalFields | public static void doWithLocalFields(Class<?> clazz, FieldCallback fc) {
for (Field field : getDeclaredFields(clazz)) {
try {
fc.doWith(field);
}
catch (IllegalAccessException ex) {
throw new IllegalStateException("Not allowed to access field '" + field.getName() + "': " + ex);
}
}
} | java | public static void doWithLocalFields(Class<?> clazz, FieldCallback fc) {
for (Field field : getDeclaredFields(clazz)) {
try {
fc.doWith(field);
}
catch (IllegalAccessException ex) {
throw new IllegalStateException("Not allowed to access field '" + field.getName() + "': " + ex);
}
}
} | [
"public",
"static",
"void",
"doWithLocalFields",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"FieldCallback",
"fc",
")",
"{",
"for",
"(",
"Field",
"field",
":",
"getDeclaredFields",
"(",
"clazz",
")",
")",
"{",
"try",
"{",
"fc",
".",
"doWith",
"(",
"fie... | Invoke the given callback on all fields in the target class, going up the
class hierarchy to get all declared fields.
@param clazz the target class to analyze
@param fc the callback to invoke for each field
@since 4.2
@see #doWithFields | [
"Invoke",
"the",
"given",
"callback",
"on",
"all",
"fields",
"in",
"the",
"target",
"class",
"going",
"up",
"the",
"class",
"hierarchy",
"to",
"get",
"all",
"declared",
"fields",
"."
] | train | https://github.com/drinkjava2/jDialects/blob/1c165f09c6042a599b681c279024abcc1b848b88/core/src/main/java/com/github/drinkjava2/jdialects/springsrc/utils/ReflectionUtils.java#L656-L665 |
networknt/light-4j | utility/src/main/java/com/networknt/utility/RegExUtils.java | RegExUtils.replaceFirst | public static String replaceFirst(final String text, final String regex, final String replacement) {
if (text == null || regex == null|| replacement == null ) {
return text;
}
return text.replaceFirst(regex, replacement);
} | java | public static String replaceFirst(final String text, final String regex, final String replacement) {
if (text == null || regex == null|| replacement == null ) {
return text;
}
return text.replaceFirst(regex, replacement);
} | [
"public",
"static",
"String",
"replaceFirst",
"(",
"final",
"String",
"text",
",",
"final",
"String",
"regex",
",",
"final",
"String",
"replacement",
")",
"{",
"if",
"(",
"text",
"==",
"null",
"||",
"regex",
"==",
"null",
"||",
"replacement",
"==",
"null",... | <p>Replaces the first substring of the text string that matches the given regular expression
with the given replacement.</p>
This method is a {@code null} safe equivalent to:
<ul>
<li>{@code text.replaceFirst(regex, replacement)}</li>
<li>{@code Pattern.compile(regex).matcher(text).replaceFirst(replacement)}</li>
</ul>
<p>A {@code null} reference passed to this method is a no-op.</p>
<p>The {@link Pattern#DOTALL} option is NOT automatically added.
To use the DOTALL option prepend <code>"(?s)"</code> to the regex.
DOTALL is also known as single-line mode in Perl.</p>
<pre>
StringUtils.replaceFirst(null, *, *) = null
StringUtils.replaceFirst("any", (String) null, *) = "any"
StringUtils.replaceFirst("any", *, null) = "any"
StringUtils.replaceFirst("", "", "zzz") = "zzz"
StringUtils.replaceFirst("", ".*", "zzz") = "zzz"
StringUtils.replaceFirst("", ".+", "zzz") = ""
StringUtils.replaceFirst("abc", "", "ZZ") = "ZZabc"
StringUtils.replaceFirst("<__>\n<__>", "<.*>", "z") = "z\n<__>"
StringUtils.replaceFirst("<__>\n<__>", "(?s)<.*>", "z") = "z"
StringUtils.replaceFirst("ABCabc123", "[a-z]", "_") = "ABC_bc123"
StringUtils.replaceFirst("ABCabc123abc", "[^A-Z0-9]+", "_") = "ABC_123abc"
StringUtils.replaceFirst("ABCabc123abc", "[^A-Z0-9]+", "") = "ABC123abc"
StringUtils.replaceFirst("Lorem ipsum dolor sit", "( +)([a-z]+)", "_$2") = "Lorem_ipsum dolor sit"
</pre>
@param text text to search and replace in, may be null
@param regex the regular expression to which this string is to be matched
@param replacement the string to be substituted for the first match
@return the text with the first replacement processed,
{@code null} if null String input
@throws java.util.regex.PatternSyntaxException
if the regular expression's syntax is invalid
@see String#replaceFirst(String, String)
@see java.util.regex.Pattern
@see java.util.regex.Pattern#DOTALL | [
"<p",
">",
"Replaces",
"the",
"first",
"substring",
"of",
"the",
"text",
"string",
"that",
"matches",
"the",
"given",
"regular",
"expression",
"with",
"the",
"given",
"replacement",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/RegExUtils.java#L407-L412 |
camunda/camunda-bpm-platform | engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/scope/ProcessScope.java | ProcessScope.createSharedProcessInstance | private Object createSharedProcessInstance() {
ProxyFactory proxyFactoryBean = new ProxyFactory(ProcessInstance.class, new MethodInterceptor() {
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
String methodName = methodInvocation.getMethod().getName() ;
logger.info("method invocation for " + methodName+ ".");
if(methodName.equals("toString"))
return "SharedProcessInstance";
ProcessInstance processInstance = Context.getExecutionContext().getProcessInstance();
Method method = methodInvocation.getMethod();
Object[] args = methodInvocation.getArguments();
Object result = method.invoke(processInstance, args);
return result;
}
});
return proxyFactoryBean.getProxy(this.classLoader);
} | java | private Object createSharedProcessInstance() {
ProxyFactory proxyFactoryBean = new ProxyFactory(ProcessInstance.class, new MethodInterceptor() {
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
String methodName = methodInvocation.getMethod().getName() ;
logger.info("method invocation for " + methodName+ ".");
if(methodName.equals("toString"))
return "SharedProcessInstance";
ProcessInstance processInstance = Context.getExecutionContext().getProcessInstance();
Method method = methodInvocation.getMethod();
Object[] args = methodInvocation.getArguments();
Object result = method.invoke(processInstance, args);
return result;
}
});
return proxyFactoryBean.getProxy(this.classLoader);
} | [
"private",
"Object",
"createSharedProcessInstance",
"(",
")",
"{",
"ProxyFactory",
"proxyFactoryBean",
"=",
"new",
"ProxyFactory",
"(",
"ProcessInstance",
".",
"class",
",",
"new",
"MethodInterceptor",
"(",
")",
"{",
"public",
"Object",
"invoke",
"(",
"MethodInvocat... | creates a proxy that dispatches invocations to the currently bound {@link ProcessInstance}
@return shareable {@link ProcessInstance} | [
"creates",
"a",
"proxy",
"that",
"dispatches",
"invocations",
"to",
"the",
"currently",
"bound",
"{",
"@link",
"ProcessInstance",
"}"
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/scope/ProcessScope.java#L148-L166 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java | CacheOnDisk.readTemplate | public ValueSet readTemplate(String template, boolean delete) {
Result result = htod.readTemplate(template, delete);
if (result.returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(result.diskException);
this.htod.returnToResultPool(result);
return HTODDynacache.EMPTY_VS;
}
ValueSet valueSet = (ValueSet) result.data;
if (valueSet == null) {
valueSet = HTODDynacache.EMPTY_VS;
}
this.htod.returnToResultPool(result);
return valueSet;
} | java | public ValueSet readTemplate(String template, boolean delete) {
Result result = htod.readTemplate(template, delete);
if (result.returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(result.diskException);
this.htod.returnToResultPool(result);
return HTODDynacache.EMPTY_VS;
}
ValueSet valueSet = (ValueSet) result.data;
if (valueSet == null) {
valueSet = HTODDynacache.EMPTY_VS;
}
this.htod.returnToResultPool(result);
return valueSet;
} | [
"public",
"ValueSet",
"readTemplate",
"(",
"String",
"template",
",",
"boolean",
"delete",
")",
"{",
"Result",
"result",
"=",
"htod",
".",
"readTemplate",
"(",
"template",
",",
"delete",
")",
";",
"if",
"(",
"result",
".",
"returnCode",
"==",
"HTODDynacache"... | Call this method to read a specified template which contains the cache ids from the disk.
@param template
- template id.
@param delete
- boolean to delete the template after reading
@return valueSet - the collection of cache ids. | [
"Call",
"this",
"method",
"to",
"read",
"a",
"specified",
"template",
"which",
"contains",
"the",
"cache",
"ids",
"from",
"the",
"disk",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1334-L1347 |
elibom/jogger | src/main/java/com/elibom/jogger/middleware/router/loader/AbstractFileRoutesLoader.java | AbstractFileRoutesLoader.validateHttpMethod | private String validateHttpMethod(String httpMethod, int line) throws ParseException {
if (!httpMethod.equalsIgnoreCase("GET") &&
!httpMethod.equalsIgnoreCase("POST") &&
!httpMethod.equalsIgnoreCase("PUT") &&
!httpMethod.equalsIgnoreCase("DELETE")) {
throw new ParseException("Unrecognized HTTP method: " + httpMethod, line);
}
return httpMethod;
} | java | private String validateHttpMethod(String httpMethod, int line) throws ParseException {
if (!httpMethod.equalsIgnoreCase("GET") &&
!httpMethod.equalsIgnoreCase("POST") &&
!httpMethod.equalsIgnoreCase("PUT") &&
!httpMethod.equalsIgnoreCase("DELETE")) {
throw new ParseException("Unrecognized HTTP method: " + httpMethod, line);
}
return httpMethod;
} | [
"private",
"String",
"validateHttpMethod",
"(",
"String",
"httpMethod",
",",
"int",
"line",
")",
"throws",
"ParseException",
"{",
"if",
"(",
"!",
"httpMethod",
".",
"equalsIgnoreCase",
"(",
"\"GET\"",
")",
"&&",
"!",
"httpMethod",
".",
"equalsIgnoreCase",
"(",
... | Helper method. It validates if the HTTP method is valid (i.e. is a GET, POST, PUT or DELETE).
@param httpMethod the HTTP method to validate.
@return the same httpMethod that was received as an argument.
@throws ParseException if the HTTP method is not recognized. | [
"Helper",
"method",
".",
"It",
"validates",
"if",
"the",
"HTTP",
"method",
"is",
"valid",
"(",
"i",
".",
"e",
".",
"is",
"a",
"GET",
"POST",
"PUT",
"or",
"DELETE",
")",
"."
] | train | https://github.com/elibom/jogger/blob/d5892ff45e76328d444a68b5a38c26e7bdd0692b/src/main/java/com/elibom/jogger/middleware/router/loader/AbstractFileRoutesLoader.java#L147-L157 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transaction.cdi/src/com/ibm/tx/jta/cdi/interceptors/NotSupported.java | NotSupported.notSupported | @AroundInvoke
public Object notSupported(final InvocationContext context) throws Exception {
return runUnderUOWNoEnablement(UOWSynchronizationRegistry.UOW_TYPE_LOCAL_TRANSACTION, true, context, "NOT_SUPPORTED");
} | java | @AroundInvoke
public Object notSupported(final InvocationContext context) throws Exception {
return runUnderUOWNoEnablement(UOWSynchronizationRegistry.UOW_TYPE_LOCAL_TRANSACTION, true, context, "NOT_SUPPORTED");
} | [
"@",
"AroundInvoke",
"public",
"Object",
"notSupported",
"(",
"final",
"InvocationContext",
"context",
")",
"throws",
"Exception",
"{",
"return",
"runUnderUOWNoEnablement",
"(",
"UOWSynchronizationRegistry",
".",
"UOW_TYPE_LOCAL_TRANSACTION",
",",
"true",
",",
"context",
... | <p>If called outside a transaction context, managed bean method execution
must then continue outside a transaction context.</p>
<p>If called inside a transaction context, the current transaction context must
be suspended, the managed bean method execution must then continue
outside a transaction context, and the previously suspended transaction
must be resumed by the interceptor that suspended it after the method
execution has completed.</p> | [
"<p",
">",
"If",
"called",
"outside",
"a",
"transaction",
"context",
"managed",
"bean",
"method",
"execution",
"must",
"then",
"continue",
"outside",
"a",
"transaction",
"context",
".",
"<",
"/",
"p",
">",
"<p",
">",
"If",
"called",
"inside",
"a",
"transac... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transaction.cdi/src/com/ibm/tx/jta/cdi/interceptors/NotSupported.java#L38-L43 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/painter/ScrollBarButtonPainter.java | ScrollBarButtonPainter.paintBackgroundCap | private void paintBackgroundCap(Graphics2D g, int width, int height) {
Shape s = shapeGenerator.createScrollCap(0, 0, width, height);
dropShadow.fill(g, s);
fillScrollBarButtonInteriorColors(g, s, isIncrease, buttonsTogether);
} | java | private void paintBackgroundCap(Graphics2D g, int width, int height) {
Shape s = shapeGenerator.createScrollCap(0, 0, width, height);
dropShadow.fill(g, s);
fillScrollBarButtonInteriorColors(g, s, isIncrease, buttonsTogether);
} | [
"private",
"void",
"paintBackgroundCap",
"(",
"Graphics2D",
"g",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"Shape",
"s",
"=",
"shapeGenerator",
".",
"createScrollCap",
"(",
"0",
",",
"0",
",",
"width",
",",
"height",
")",
";",
"dropShadow",
".... | DOCUMENT ME!
@param g DOCUMENT ME!
@param width DOCUMENT ME!
@param height DOCUMENT ME! | [
"DOCUMENT",
"ME!"
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/ScrollBarButtonPainter.java#L241-L246 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java | PageFlowUtils.addActionOutput | public static void addActionOutput( String name, Object value, ServletRequest request )
{
Map map = InternalUtils.getActionOutputMap( request, true );
if ( map.containsKey( name ) )
{
if ( _log.isWarnEnabled() )
{
_log.warn( "Overwriting action output\"" + name + "\"." );
}
}
map.put( name, value );
} | java | public static void addActionOutput( String name, Object value, ServletRequest request )
{
Map map = InternalUtils.getActionOutputMap( request, true );
if ( map.containsKey( name ) )
{
if ( _log.isWarnEnabled() )
{
_log.warn( "Overwriting action output\"" + name + "\"." );
}
}
map.put( name, value );
} | [
"public",
"static",
"void",
"addActionOutput",
"(",
"String",
"name",
",",
"Object",
"value",
",",
"ServletRequest",
"request",
")",
"{",
"Map",
"map",
"=",
"InternalUtils",
".",
"getActionOutputMap",
"(",
"request",
",",
"true",
")",
";",
"if",
"(",
"map",
... | Set a named action output, which corresponds to an input declared by the <code>pageInput</code> JSP tag.
The actual value can be read from within a JSP using the <code>"pageInput"</code> databinding context.
@param name the name of the action output.
@param value the value of the action output.
@param request the current ServletRequest. | [
"Set",
"a",
"named",
"action",
"output",
"which",
"corresponds",
"to",
"an",
"input",
"declared",
"by",
"the",
"<code",
">",
"pageInput<",
"/",
"code",
">",
"JSP",
"tag",
".",
"The",
"actual",
"value",
"can",
"be",
"read",
"from",
"within",
"a",
"JSP",
... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L934-L947 |
cycorp/api-suite | core-api/src/main/java/com/cyc/kb/exception/VariableArityException.java | VariableArityException.fromThrowable | public static VariableArityException fromThrowable(String message, Throwable cause) {
return (cause instanceof VariableArityException && Objects.equals(message, cause.getMessage()))
? (VariableArityException) cause
: new VariableArityException(message, cause);
} | java | public static VariableArityException fromThrowable(String message, Throwable cause) {
return (cause instanceof VariableArityException && Objects.equals(message, cause.getMessage()))
? (VariableArityException) cause
: new VariableArityException(message, cause);
} | [
"public",
"static",
"VariableArityException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"VariableArityException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"cause",
".",
"getMes... | Converts a Throwable to a VariableArityException with the specified detail message. If the
Throwable is a VariableArityException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new VariableArityException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a VariableArityException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"VariableArityException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"VariableArityException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
"to",
"the... | train | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/VariableArityException.java#L50-L54 |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java | GenericIHEAuditEventMessage.addDocumentParticipantObject | public void addDocumentParticipantObject(String documentUniqueId, String repositoryUniqueId, String homeCommunityId)
{
List<TypeValuePairType> tvp = new LinkedList<>();
//SEK - 10/19/2011 - added check for empty or null, RE: Issue Tracker artifact artf2295 (was Issue 135)
if (!EventUtils.isEmptyOrNull(repositoryUniqueId)) {
tvp.add(getTypeValuePair("Repository Unique Id", repositoryUniqueId.getBytes()));
}
if (!EventUtils.isEmptyOrNull(homeCommunityId)) {
tvp.add(getTypeValuePair("ihe:homeCommunityID", homeCommunityId.getBytes()));
}
addParticipantObjectIdentification(
new RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectIDTypeCodes.ReportNumber(),
null,
null,
tvp,
documentUniqueId,
RFC3881ParticipantObjectTypeCodes.SYSTEM,
RFC3881ParticipantObjectTypeRoleCodes.REPORT,
null,
null);
} | java | public void addDocumentParticipantObject(String documentUniqueId, String repositoryUniqueId, String homeCommunityId)
{
List<TypeValuePairType> tvp = new LinkedList<>();
//SEK - 10/19/2011 - added check for empty or null, RE: Issue Tracker artifact artf2295 (was Issue 135)
if (!EventUtils.isEmptyOrNull(repositoryUniqueId)) {
tvp.add(getTypeValuePair("Repository Unique Id", repositoryUniqueId.getBytes()));
}
if (!EventUtils.isEmptyOrNull(homeCommunityId)) {
tvp.add(getTypeValuePair("ihe:homeCommunityID", homeCommunityId.getBytes()));
}
addParticipantObjectIdentification(
new RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectIDTypeCodes.ReportNumber(),
null,
null,
tvp,
documentUniqueId,
RFC3881ParticipantObjectTypeCodes.SYSTEM,
RFC3881ParticipantObjectTypeRoleCodes.REPORT,
null,
null);
} | [
"public",
"void",
"addDocumentParticipantObject",
"(",
"String",
"documentUniqueId",
",",
"String",
"repositoryUniqueId",
",",
"String",
"homeCommunityId",
")",
"{",
"List",
"<",
"TypeValuePairType",
">",
"tvp",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"//SE... | Adds a Participant Object representing a document for XDS Exports
@param documentUniqueId The Document Entry Unique Id
@param repositoryUniqueId The Repository Unique Id of the Repository housing the document
@param homeCommunityId The Home Community Id | [
"Adds",
"a",
"Participant",
"Object",
"representing",
"a",
"document",
"for",
"XDS",
"Exports"
] | train | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java#L233-L254 |
greatman/GreatmancodeTools | src/main/java/com/greatmancode/tools/utils/Vector.java | Vector.getMaximum | public static Vector getMaximum(Vector v1, Vector v2) {
return new Vector(Math.max(v1.x, v2.x), Math.max(v1.y, v2.y), Math.max(v1.z, v2.z));
} | java | public static Vector getMaximum(Vector v1, Vector v2) {
return new Vector(Math.max(v1.x, v2.x), Math.max(v1.y, v2.y), Math.max(v1.z, v2.z));
} | [
"public",
"static",
"Vector",
"getMaximum",
"(",
"Vector",
"v1",
",",
"Vector",
"v2",
")",
"{",
"return",
"new",
"Vector",
"(",
"Math",
".",
"max",
"(",
"v1",
".",
"x",
",",
"v2",
".",
"x",
")",
",",
"Math",
".",
"max",
"(",
"v1",
".",
"y",
","... | Gets the maximum components of two vectors.
@param v1 The first vector.
@param v2 The second vector.
@return maximum | [
"Gets",
"the",
"maximum",
"components",
"of",
"two",
"vectors",
"."
] | train | https://github.com/greatman/GreatmancodeTools/blob/4c9d2656c5c8298ff9e1f235c9be8b148e43c9f1/src/main/java/com/greatmancode/tools/utils/Vector.java#L610-L612 |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/dynamic/output/CommandOutputResolverSupport.java | CommandOutputResolverSupport.isAssignableFrom | protected boolean isAssignableFrom(OutputSelector selector, OutputType provider) {
ResolvableType selectorType = selector.getOutputType();
ResolvableType resolvableType = provider.withCodec(selector.getRedisCodec());
return selectorType.isAssignableFrom(resolvableType);
} | java | protected boolean isAssignableFrom(OutputSelector selector, OutputType provider) {
ResolvableType selectorType = selector.getOutputType();
ResolvableType resolvableType = provider.withCodec(selector.getRedisCodec());
return selectorType.isAssignableFrom(resolvableType);
} | [
"protected",
"boolean",
"isAssignableFrom",
"(",
"OutputSelector",
"selector",
",",
"OutputType",
"provider",
")",
"{",
"ResolvableType",
"selectorType",
"=",
"selector",
".",
"getOutputType",
"(",
")",
";",
"ResolvableType",
"resolvableType",
"=",
"provider",
".",
... | Overridable hook to check whether {@code selector} can be assigned from the provider type {@code provider}.
<p>
This method descends the component type hierarchy and considers primitive/wrapper type conversion.
@param selector must not be {@literal null}.
@param provider must not be {@literal null}.
@return {@literal true} if selector can be assigned from its provider type. | [
"Overridable",
"hook",
"to",
"check",
"whether",
"{",
"@code",
"selector",
"}",
"can",
"be",
"assigned",
"from",
"the",
"provider",
"type",
"{",
"@code",
"provider",
"}",
".",
"<p",
">",
"This",
"method",
"descends",
"the",
"component",
"type",
"hierarchy",
... | train | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/dynamic/output/CommandOutputResolverSupport.java#L39-L45 |
JodaOrg/joda-time | src/main/java/org/joda/time/chrono/GJDayOfWeekDateTimeField.java | GJDayOfWeekDateTimeField.convertText | protected int convertText(String text, Locale locale) {
return GJLocaleSymbols.forLocale(locale).dayOfWeekTextToValue(text);
} | java | protected int convertText(String text, Locale locale) {
return GJLocaleSymbols.forLocale(locale).dayOfWeekTextToValue(text);
} | [
"protected",
"int",
"convertText",
"(",
"String",
"text",
",",
"Locale",
"locale",
")",
"{",
"return",
"GJLocaleSymbols",
".",
"forLocale",
"(",
"locale",
")",
".",
"dayOfWeekTextToValue",
"(",
"text",
")",
";",
"}"
] | Convert the specified text and locale into a value.
@param text the text to convert
@param locale the locale to convert using
@return the value extracted from the text
@throws IllegalArgumentException if the text is invalid | [
"Convert",
"the",
"specified",
"text",
"and",
"locale",
"into",
"a",
"value",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/chrono/GJDayOfWeekDateTimeField.java#L90-L92 |
rterp/GMapsFX | GMapsFX/src/main/java/com/lynden/gmapsfx/javascript/JavascriptArray.java | JavascriptArray.lastIndexOf | public int lastIndexOf(Object obj) {
if (obj instanceof JavascriptObject) {
return checkInteger(invokeJavascript("lastIndexOf", ((JavascriptObject) obj).getJSObject()), -1);
}
return checkInteger(invokeJavascript("lastIndexOf", obj), -1);
} | java | public int lastIndexOf(Object obj) {
if (obj instanceof JavascriptObject) {
return checkInteger(invokeJavascript("lastIndexOf", ((JavascriptObject) obj).getJSObject()), -1);
}
return checkInteger(invokeJavascript("lastIndexOf", obj), -1);
} | [
"public",
"int",
"lastIndexOf",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"obj",
"instanceof",
"JavascriptObject",
")",
"{",
"return",
"checkInteger",
"(",
"invokeJavascript",
"(",
"\"lastIndexOf\"",
",",
"(",
"(",
"JavascriptObject",
")",
"obj",
")",
".",
... | lastIndexOf() Search the array for an element, starting at the end, and returns its position | [
"lastIndexOf",
"()",
"Search",
"the",
"array",
"for",
"an",
"element",
"starting",
"at",
"the",
"end",
"and",
"returns",
"its",
"position"
] | train | https://github.com/rterp/GMapsFX/blob/4623d3f768e8ad78fc50ee32dd204d236e01059f/GMapsFX/src/main/java/com/lynden/gmapsfx/javascript/JavascriptArray.java#L62-L67 |
sniggle/simple-pgp | simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/internal/BasePGPCommon.java | BasePGPCommon.retrievePublicKey | protected PGPPublicKey retrievePublicKey(PGPPublicKeyRing publicKeyRing, KeyFilter<PGPPublicKey> keyFilter) {
LOGGER.trace("retrievePublicKey(PGPPublicKeyRing, KeyFilter<PGPPublicKey>)");
PGPPublicKey result = null;
Iterator<PGPPublicKey> publicKeyIterator = publicKeyRing.getPublicKeys();
LOGGER.debug("Iterating through public keys in public key ring");
while( result == null && publicKeyIterator.hasNext() ) {
PGPPublicKey key = publicKeyIterator.next();
LOGGER.info("Found secret key: {}", key.getKeyID());
LOGGER.debug("Checking public key with filter");
if( keyFilter.accept(key) ) {
LOGGER.info("Public key {} selected from key ring", key.getKeyID());
result = key;
}
}
return result;
} | java | protected PGPPublicKey retrievePublicKey(PGPPublicKeyRing publicKeyRing, KeyFilter<PGPPublicKey> keyFilter) {
LOGGER.trace("retrievePublicKey(PGPPublicKeyRing, KeyFilter<PGPPublicKey>)");
PGPPublicKey result = null;
Iterator<PGPPublicKey> publicKeyIterator = publicKeyRing.getPublicKeys();
LOGGER.debug("Iterating through public keys in public key ring");
while( result == null && publicKeyIterator.hasNext() ) {
PGPPublicKey key = publicKeyIterator.next();
LOGGER.info("Found secret key: {}", key.getKeyID());
LOGGER.debug("Checking public key with filter");
if( keyFilter.accept(key) ) {
LOGGER.info("Public key {} selected from key ring", key.getKeyID());
result = key;
}
}
return result;
} | [
"protected",
"PGPPublicKey",
"retrievePublicKey",
"(",
"PGPPublicKeyRing",
"publicKeyRing",
",",
"KeyFilter",
"<",
"PGPPublicKey",
">",
"keyFilter",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"\"retrievePublicKey(PGPPublicKeyRing, KeyFilter<PGPPublicKey>)\"",
")",
";",
"PGPPubl... | reads the PGP public key from a PublicKeyRing
@param publicKeyRing
the source public key ring
@param keyFilter
the filter to apply
@return the matching PGP public or null if none matches | [
"reads",
"the",
"PGP",
"public",
"key",
"from",
"a",
"PublicKeyRing"
] | train | https://github.com/sniggle/simple-pgp/blob/2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3/simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/internal/BasePGPCommon.java#L298-L313 |
alipay/sofa-rpc | core/api/src/main/java/com/alipay/sofa/rpc/config/ConfigValueHelper.java | ConfigValueHelper.checkPositiveInteger | protected static void checkPositiveInteger(String configKey, int configValue) throws SofaRpcRuntimeException {
if (configValue <= 0) {
throw ExceptionUtils.buildRuntime(configKey, configValue + "", "must > 0");
}
} | java | protected static void checkPositiveInteger(String configKey, int configValue) throws SofaRpcRuntimeException {
if (configValue <= 0) {
throw ExceptionUtils.buildRuntime(configKey, configValue + "", "must > 0");
}
} | [
"protected",
"static",
"void",
"checkPositiveInteger",
"(",
"String",
"configKey",
",",
"int",
"configValue",
")",
"throws",
"SofaRpcRuntimeException",
"{",
"if",
"(",
"configValue",
"<=",
"0",
")",
"{",
"throw",
"ExceptionUtils",
".",
"buildRuntime",
"(",
"config... | 检查数字是否为正整数(>0)
@param configKey 配置项
@param configValue 配置值
@throws SofaRpcRuntimeException 非法异常 | [
"检查数字是否为正整数(",
">",
"0",
")"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/config/ConfigValueHelper.java#L158-L162 |
huahin/huahin-core | src/main/java/org/huahinframework/core/Runner.java | Runner.addJob | public void addJob(String name, Class<? extends SimpleJobTool> clazz) {
jobMap.put(name, clazz);
} | java | public void addJob(String name, Class<? extends SimpleJobTool> clazz) {
jobMap.put(name, clazz);
} | [
"public",
"void",
"addJob",
"(",
"String",
"name",
",",
"Class",
"<",
"?",
"extends",
"SimpleJobTool",
">",
"clazz",
")",
"{",
"jobMap",
".",
"put",
"(",
"name",
",",
"clazz",
")",
";",
"}"
] | Add job sequence.
@param name job sequence name
@param clazz SimpleJobTool class | [
"Add",
"job",
"sequence",
"."
] | train | https://github.com/huahin/huahin-core/blob/a87921b5a12be92a822f753c075ab2431036e6f5/src/main/java/org/huahinframework/core/Runner.java#L86-L88 |
ReactiveX/RxJavaComputationExpressions | src/main/java/rx/Statement.java | Statement.ifThen | public static <R> Observable<R> ifThen(Func0<Boolean> condition, Observable<? extends R> then,
Observable<? extends R> orElse) {
return Observable.create(new OperatorIfThen<R>(condition, then, orElse));
} | java | public static <R> Observable<R> ifThen(Func0<Boolean> condition, Observable<? extends R> then,
Observable<? extends R> orElse) {
return Observable.create(new OperatorIfThen<R>(condition, then, orElse));
} | [
"public",
"static",
"<",
"R",
">",
"Observable",
"<",
"R",
">",
"ifThen",
"(",
"Func0",
"<",
"Boolean",
">",
"condition",
",",
"Observable",
"<",
"?",
"extends",
"R",
">",
"then",
",",
"Observable",
"<",
"?",
"extends",
"R",
">",
"orElse",
")",
"{",
... | Return an Observable that emits the emissions from one specified
Observable if a condition evaluates to true, or from another specified
Observable otherwise.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/ifThen.e.png" alt="">
@param <R>
the result value type
@param condition
the condition that decides which Observable to emit the
emissions from
@param then
the Observable sequence to emit to if {@code condition} is {@code true}
@param orElse
the Observable sequence to emit to if {@code condition} is {@code false}
@return an Observable that mimics either the {@code then} or {@code orElse} Observables depending on a condition function | [
"Return",
"an",
"Observable",
"that",
"emits",
"the",
"emissions",
"from",
"one",
"specified",
"Observable",
"if",
"a",
"condition",
"evaluates",
"to",
"true",
"or",
"from",
"another",
"specified",
"Observable",
"otherwise",
".",
"<p",
">",
"<img",
"width",
"=... | train | https://github.com/ReactiveX/RxJavaComputationExpressions/blob/f9d04ab762223b36fad47402ac36ce7969320d69/src/main/java/rx/Statement.java#L203-L206 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java | BpmnParse.parseSequenceFlowConditionExpression | public void parseSequenceFlowConditionExpression(Element seqFlowElement, TransitionImpl seqFlow) {
Element conditionExprElement = seqFlowElement.element(CONDITION_EXPRESSION);
if (conditionExprElement != null) {
Condition condition = parseConditionExpression(conditionExprElement);
seqFlow.setProperty(PROPERTYNAME_CONDITION_TEXT, conditionExprElement.getText().trim());
seqFlow.setProperty(PROPERTYNAME_CONDITION, condition);
}
} | java | public void parseSequenceFlowConditionExpression(Element seqFlowElement, TransitionImpl seqFlow) {
Element conditionExprElement = seqFlowElement.element(CONDITION_EXPRESSION);
if (conditionExprElement != null) {
Condition condition = parseConditionExpression(conditionExprElement);
seqFlow.setProperty(PROPERTYNAME_CONDITION_TEXT, conditionExprElement.getText().trim());
seqFlow.setProperty(PROPERTYNAME_CONDITION, condition);
}
} | [
"public",
"void",
"parseSequenceFlowConditionExpression",
"(",
"Element",
"seqFlowElement",
",",
"TransitionImpl",
"seqFlow",
")",
"{",
"Element",
"conditionExprElement",
"=",
"seqFlowElement",
".",
"element",
"(",
"CONDITION_EXPRESSION",
")",
";",
"if",
"(",
"condition... | Parses a condition expression on a sequence flow.
@param seqFlowElement
The 'sequenceFlow' element that can contain a condition.
@param seqFlow
The sequenceFlow object representation to which the condition must
be added. | [
"Parses",
"a",
"condition",
"expression",
"on",
"a",
"sequence",
"flow",
"."
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java#L4070-L4077 |
Harium/keel | src/main/java/com/harium/keel/catalano/math/distance/Distance.java | Distance.Chessboard | public static double Chessboard(double[] x, double[] y) {
double d = 0;
for (int i = 0; i < x.length; i++) {
d = Math.max(d, x[i] - y[i]);
}
return d;
} | java | public static double Chessboard(double[] x, double[] y) {
double d = 0;
for (int i = 0; i < x.length; i++) {
d = Math.max(d, x[i] - y[i]);
}
return d;
} | [
"public",
"static",
"double",
"Chessboard",
"(",
"double",
"[",
"]",
"x",
",",
"double",
"[",
"]",
"y",
")",
"{",
"double",
"d",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"x",
".",
"length",
";",
"i",
"++",
")",
"{",
"... | Gets the Chessboard distance between two points.
@param x A point in space.
@param y A point in space.
@return The Chessboard distance between x and y. | [
"Gets",
"the",
"Chessboard",
"distance",
"between",
"two",
"points",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/distance/Distance.java#L221-L229 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java | ServerBuilder.gracefulShutdownTimeout | public ServerBuilder gracefulShutdownTimeout(long quietPeriodMillis, long timeoutMillis) {
return gracefulShutdownTimeout(
Duration.ofMillis(quietPeriodMillis), Duration.ofMillis(timeoutMillis));
} | java | public ServerBuilder gracefulShutdownTimeout(long quietPeriodMillis, long timeoutMillis) {
return gracefulShutdownTimeout(
Duration.ofMillis(quietPeriodMillis), Duration.ofMillis(timeoutMillis));
} | [
"public",
"ServerBuilder",
"gracefulShutdownTimeout",
"(",
"long",
"quietPeriodMillis",
",",
"long",
"timeoutMillis",
")",
"{",
"return",
"gracefulShutdownTimeout",
"(",
"Duration",
".",
"ofMillis",
"(",
"quietPeriodMillis",
")",
",",
"Duration",
".",
"ofMillis",
"(",... | Sets the amount of time to wait after calling {@link Server#stop()} for
requests to go away before actually shutting down.
@param quietPeriodMillis the number of milliseconds to wait for active
requests to go end before shutting down. 0 means the server will
stop right away without waiting.
@param timeoutMillis the number of milliseconds to wait before shutting
down the server regardless of active requests. This should be set to
a time greater than {@code quietPeriodMillis} to ensure the server
shuts down even if there is a stuck request. | [
"Sets",
"the",
"amount",
"of",
"time",
"to",
"wait",
"after",
"calling",
"{",
"@link",
"Server#stop",
"()",
"}",
"for",
"requests",
"to",
"go",
"away",
"before",
"actually",
"shutting",
"down",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java#L622-L625 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/CertificatesImpl.java | CertificatesImpl.listNextAsync | public ServiceFuture<List<Certificate>> listNextAsync(final String nextPageLink, final CertificateListNextOptions certificateListNextOptions, final ServiceFuture<List<Certificate>> serviceFuture, final ListOperationCallback<Certificate> serviceCallback) {
return AzureServiceFuture.fromHeaderPageResponse(
listNextSinglePageAsync(nextPageLink, certificateListNextOptions),
new Func1<String, Observable<ServiceResponseWithHeaders<Page<Certificate>, CertificateListHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<Certificate>, CertificateListHeaders>> call(String nextPageLink) {
return listNextSinglePageAsync(nextPageLink, certificateListNextOptions);
}
},
serviceCallback);
} | java | public ServiceFuture<List<Certificate>> listNextAsync(final String nextPageLink, final CertificateListNextOptions certificateListNextOptions, final ServiceFuture<List<Certificate>> serviceFuture, final ListOperationCallback<Certificate> serviceCallback) {
return AzureServiceFuture.fromHeaderPageResponse(
listNextSinglePageAsync(nextPageLink, certificateListNextOptions),
new Func1<String, Observable<ServiceResponseWithHeaders<Page<Certificate>, CertificateListHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<Certificate>, CertificateListHeaders>> call(String nextPageLink) {
return listNextSinglePageAsync(nextPageLink, certificateListNextOptions);
}
},
serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"List",
"<",
"Certificate",
">",
">",
"listNextAsync",
"(",
"final",
"String",
"nextPageLink",
",",
"final",
"CertificateListNextOptions",
"certificateListNextOptions",
",",
"final",
"ServiceFuture",
"<",
"List",
"<",
"Certificate",
">"... | Lists all of the certificates that have been added to the specified account.
@param nextPageLink The NextLink from the previous successful call to List operation.
@param certificateListNextOptions Additional parameters for the operation
@param serviceFuture the ServiceFuture object tracking the Retrofit calls
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Lists",
"all",
"of",
"the",
"certificates",
"that",
"have",
"been",
"added",
"to",
"the",
"specified",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/CertificatesImpl.java#L1334-L1344 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/spillover/spilloverpolicy.java | spilloverpolicy.get | public static spilloverpolicy get(nitro_service service, String name) throws Exception{
spilloverpolicy obj = new spilloverpolicy();
obj.set_name(name);
spilloverpolicy response = (spilloverpolicy) obj.get_resource(service);
return response;
} | java | public static spilloverpolicy get(nitro_service service, String name) throws Exception{
spilloverpolicy obj = new spilloverpolicy();
obj.set_name(name);
spilloverpolicy response = (spilloverpolicy) obj.get_resource(service);
return response;
} | [
"public",
"static",
"spilloverpolicy",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"spilloverpolicy",
"obj",
"=",
"new",
"spilloverpolicy",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"spi... | Use this API to fetch spilloverpolicy resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"spilloverpolicy",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/spillover/spilloverpolicy.java#L400-L405 |
dmurph/jgoogleanalyticstracker | src/main/java/com/dmurph/tracking/JGoogleAnalyticsTracker.java | JGoogleAnalyticsTracker.setProxy | public static void setProxy(String proxyAddr) {
if (proxyAddr != null) {
Scanner s = new Scanner(proxyAddr);
// Split into "proxyAddr:proxyPort".
proxyAddr = null;
int proxyPort = 8080;
try {
s.findInLine("(http://|)([^:/]+)(:|)([0-9]*)(/|)");
MatchResult m = s.match();
if (m.groupCount() >= 2) {
proxyAddr = m.group(2);
}
if ((m.groupCount() >= 4) && (!m.group(4).isEmpty())) {
proxyPort = Integer.parseInt(m.group(4));
}
} finally {
s.close();
}
if (proxyAddr != null) {
SocketAddress sa = new InetSocketAddress(proxyAddr, proxyPort);
setProxy(new Proxy(Type.HTTP, sa));
}
}
} | java | public static void setProxy(String proxyAddr) {
if (proxyAddr != null) {
Scanner s = new Scanner(proxyAddr);
// Split into "proxyAddr:proxyPort".
proxyAddr = null;
int proxyPort = 8080;
try {
s.findInLine("(http://|)([^:/]+)(:|)([0-9]*)(/|)");
MatchResult m = s.match();
if (m.groupCount() >= 2) {
proxyAddr = m.group(2);
}
if ((m.groupCount() >= 4) && (!m.group(4).isEmpty())) {
proxyPort = Integer.parseInt(m.group(4));
}
} finally {
s.close();
}
if (proxyAddr != null) {
SocketAddress sa = new InetSocketAddress(proxyAddr, proxyPort);
setProxy(new Proxy(Type.HTTP, sa));
}
}
} | [
"public",
"static",
"void",
"setProxy",
"(",
"String",
"proxyAddr",
")",
"{",
"if",
"(",
"proxyAddr",
"!=",
"null",
")",
"{",
"Scanner",
"s",
"=",
"new",
"Scanner",
"(",
"proxyAddr",
")",
";",
"// Split into \"proxyAddr:proxyPort\".",
"proxyAddr",
"=",
"null",... | Define the proxy to use for all GA tracking requests.
<p>
Call this static method early (before creating any tracking requests).
@param proxyAddr "addr:port" of the proxy to use; may also be given as URL ("http://addr:port/"). | [
"Define",
"the",
"proxy",
"to",
"use",
"for",
"all",
"GA",
"tracking",
"requests",
".",
"<p",
">",
"Call",
"this",
"static",
"method",
"early",
"(",
"before",
"creating",
"any",
"tracking",
"requests",
")",
"."
] | train | https://github.com/dmurph/jgoogleanalyticstracker/blob/69f68caf8e09a53e6f6076477bf05b84bc80e386/src/main/java/com/dmurph/tracking/JGoogleAnalyticsTracker.java#L221-L248 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/CLINK.java | CLINK.clinkstep8 | private void clinkstep8(DBIDRef id, DBIDArrayIter it, int n, WritableDBIDDataStore pi, WritableDoubleDataStore lambda, WritableDoubleDataStore m) {
DBIDVar p_i = DBIDUtil.newVar(), pp_i = DBIDUtil.newVar();
for(it.seek(0); it.getOffset() < n; it.advance()) {
p_i.from(pi, it); // p_i = pi[i]
pp_i.from(pi, p_i); // pp_i = pi[pi[i]]
if(DBIDUtil.equal(pp_i, id) && lambda.doubleValue(it) >= lambda.doubleValue(p_i)) {
pi.putDBID(it, id);
}
}
} | java | private void clinkstep8(DBIDRef id, DBIDArrayIter it, int n, WritableDBIDDataStore pi, WritableDoubleDataStore lambda, WritableDoubleDataStore m) {
DBIDVar p_i = DBIDUtil.newVar(), pp_i = DBIDUtil.newVar();
for(it.seek(0); it.getOffset() < n; it.advance()) {
p_i.from(pi, it); // p_i = pi[i]
pp_i.from(pi, p_i); // pp_i = pi[pi[i]]
if(DBIDUtil.equal(pp_i, id) && lambda.doubleValue(it) >= lambda.doubleValue(p_i)) {
pi.putDBID(it, id);
}
}
} | [
"private",
"void",
"clinkstep8",
"(",
"DBIDRef",
"id",
",",
"DBIDArrayIter",
"it",
",",
"int",
"n",
",",
"WritableDBIDDataStore",
"pi",
",",
"WritableDoubleDataStore",
"lambda",
",",
"WritableDoubleDataStore",
"m",
")",
"{",
"DBIDVar",
"p_i",
"=",
"DBIDUtil",
".... | Update hierarchy.
@param id Current object
@param it Iterator
@param n Last object to process
@param pi Parent data store
@param lambda Height data store
@param m Distance data store | [
"Update",
"hierarchy",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/CLINK.java#L195-L204 |
liferay/com-liferay-commerce | commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListPersistenceImpl.java | CommercePriceListPersistenceImpl.findByGroupId | @Override
public List<CommercePriceList> findByGroupId(long groupId) {
return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CommercePriceList> findByGroupId(long groupId) {
return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommercePriceList",
">",
"findByGroupId",
"(",
"long",
"groupId",
")",
"{",
"return",
"findByGroupId",
"(",
"groupId",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"
] | Returns all the commerce price lists where groupId = ?.
@param groupId the group ID
@return the matching commerce price lists | [
"Returns",
"all",
"the",
"commerce",
"price",
"lists",
"where",
"groupId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListPersistenceImpl.java#L1524-L1527 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java | VirtualNetworkGatewaysInner.beginGetVpnProfilePackageUrlAsync | public Observable<String> beginGetVpnProfilePackageUrlAsync(String resourceGroupName, String virtualNetworkGatewayName) {
return beginGetVpnProfilePackageUrlWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).map(new Func1<ServiceResponse<String>, String>() {
@Override
public String call(ServiceResponse<String> response) {
return response.body();
}
});
} | java | public Observable<String> beginGetVpnProfilePackageUrlAsync(String resourceGroupName, String virtualNetworkGatewayName) {
return beginGetVpnProfilePackageUrlWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).map(new Func1<ServiceResponse<String>, String>() {
@Override
public String call(ServiceResponse<String> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"String",
">",
"beginGetVpnProfilePackageUrlAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkGatewayName",
")",
"{",
"return",
"beginGetVpnProfilePackageUrlWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualNe... | Gets pre-generated VPN profile for P2S client of the virtual network gateway in the specified resource group. The profile needs to be generated first using generateVpnProfile.
@param resourceGroupName The name of the resource group.
@param virtualNetworkGatewayName The name of the virtual network gateway.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the String object | [
"Gets",
"pre",
"-",
"generated",
"VPN",
"profile",
"for",
"P2S",
"client",
"of",
"the",
"virtual",
"network",
"gateway",
"in",
"the",
"specified",
"resource",
"group",
".",
"The",
"profile",
"needs",
"to",
"be",
"generated",
"first",
"using",
"generateVpnProfi... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L1891-L1898 |
apiman/apiman | manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java | EsMarshalling.unmarshallPlugin | public static PluginBean unmarshallPlugin(Map<String, Object> source) {
if (source == null) {
return null;
}
PluginBean bean = new PluginBean();
bean.setId(asLong(source.get("id")));
bean.setName(asString(source.get("name")));
bean.setDescription(asString(source.get("description")));
bean.setCreatedBy(asString(source.get("createdBy")));
bean.setCreatedOn(asDate(source.get("createdOn")));
bean.setGroupId(asString(source.get("groupId")));
bean.setArtifactId(asString(source.get("artifactId")));
bean.setVersion(asString(source.get("version")));
bean.setType(asString(source.get("type")));
bean.setClassifier(asString(source.get("classifier")));
bean.setDeleted(asBoolean(source.get("deleted")));
postMarshall(bean);
return bean;
} | java | public static PluginBean unmarshallPlugin(Map<String, Object> source) {
if (source == null) {
return null;
}
PluginBean bean = new PluginBean();
bean.setId(asLong(source.get("id")));
bean.setName(asString(source.get("name")));
bean.setDescription(asString(source.get("description")));
bean.setCreatedBy(asString(source.get("createdBy")));
bean.setCreatedOn(asDate(source.get("createdOn")));
bean.setGroupId(asString(source.get("groupId")));
bean.setArtifactId(asString(source.get("artifactId")));
bean.setVersion(asString(source.get("version")));
bean.setType(asString(source.get("type")));
bean.setClassifier(asString(source.get("classifier")));
bean.setDeleted(asBoolean(source.get("deleted")));
postMarshall(bean);
return bean;
} | [
"public",
"static",
"PluginBean",
"unmarshallPlugin",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"source",
")",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"PluginBean",
"bean",
"=",
"new",
"PluginBean",
"(",
")",
... | Unmarshals the given map source into a bean.
@param source the source
@return the plugin | [
"Unmarshals",
"the",
"given",
"map",
"source",
"into",
"a",
"bean",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java#L1310-L1328 |
axibase/atsd-api-java | src/main/java/com/axibase/tsd/client/AtsdServerExceptionFactory.java | AtsdServerExceptionFactory.fromResponse | static AtsdServerException fromResponse(final Response response) {
final int status = response.getStatus();
try {
final ServerError serverError = response.readEntity(ServerError.class);
final String message = AtsdServerMessageFactory.from(serverError);
return new AtsdServerException(message, status);
} catch (ProcessingException e) {
throw new IllegalArgumentException("Failed to extract server error", e);
}
} | java | static AtsdServerException fromResponse(final Response response) {
final int status = response.getStatus();
try {
final ServerError serverError = response.readEntity(ServerError.class);
final String message = AtsdServerMessageFactory.from(serverError);
return new AtsdServerException(message, status);
} catch (ProcessingException e) {
throw new IllegalArgumentException("Failed to extract server error", e);
}
} | [
"static",
"AtsdServerException",
"fromResponse",
"(",
"final",
"Response",
"response",
")",
"{",
"final",
"int",
"status",
"=",
"response",
".",
"getStatus",
"(",
")",
";",
"try",
"{",
"final",
"ServerError",
"serverError",
"=",
"response",
".",
"readEntity",
... | Generate {@link AtsdServerException} from Http Response.
@param response {@link Response} class from jersey.
@return AtsdServerException instance with extracted message from response. | [
"Generate",
"{",
"@link",
"AtsdServerException",
"}",
"from",
"Http",
"Response",
"."
] | train | https://github.com/axibase/atsd-api-java/blob/63a0767d08b202dad2ebef4372ff947d6fba0246/src/main/java/com/axibase/tsd/client/AtsdServerExceptionFactory.java#L22-L31 |
ocelotds/ocelot | ocelot-web/src/main/java/org/ocelotds/topic/topicAccess/TopicAccessManager.java | TopicAccessManager.checkAccessTopicGlobalAC | boolean checkAccessTopicGlobalAC(UserContext ctx, String topic) throws IllegalAccessException {
logger.debug("Looking for accessController for topic '{}' from GlobalAccess", topic);
Iterable<JsTopicAccessController> accessControls = topicAccessController.select(DEFAULT_AT);
return checkAccessTopicFromControllers(ctx, topic, accessControls);
} | java | boolean checkAccessTopicGlobalAC(UserContext ctx, String topic) throws IllegalAccessException {
logger.debug("Looking for accessController for topic '{}' from GlobalAccess", topic);
Iterable<JsTopicAccessController> accessControls = topicAccessController.select(DEFAULT_AT);
return checkAccessTopicFromControllers(ctx, topic, accessControls);
} | [
"boolean",
"checkAccessTopicGlobalAC",
"(",
"UserContext",
"ctx",
",",
"String",
"topic",
")",
"throws",
"IllegalAccessException",
"{",
"logger",
".",
"debug",
"(",
"\"Looking for accessController for topic '{}' from GlobalAccess\"",
",",
"topic",
")",
";",
"Iterable",
"<... | Check if global access control is allowed
@param ctx
@param topic
@return true if at least one global topicAccessControl exist
@throws IllegalAccessException | [
"Check",
"if",
"global",
"access",
"control",
"is",
"allowed"
] | train | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/topicAccess/TopicAccessManager.java#L67-L71 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java | PageFlowUtils.addPageInput | public static void addPageInput( String name, Object value, ServletRequest request )
{
addActionOutput( name, value, request );
} | java | public static void addPageInput( String name, Object value, ServletRequest request )
{
addActionOutput( name, value, request );
} | [
"public",
"static",
"void",
"addPageInput",
"(",
"String",
"name",
",",
"Object",
"value",
",",
"ServletRequest",
"request",
")",
"{",
"addActionOutput",
"(",
"name",
",",
"value",
",",
"request",
")",
";",
"}"
] | Set a named action output, which corresponds to an input declared by the <code>pageInput</code> JSP tag.
The actual value can be read from within a JSP using the <code>"pageInput"</code> databinding context.
@deprecated Use {@link #addActionOutput} instead.
@param name the name of the action output.
@param value the value of the action output.
@param request the current ServletRequest. | [
"Set",
"a",
"named",
"action",
"output",
"which",
"corresponds",
"to",
"an",
"input",
"declared",
"by",
"the",
"<code",
">",
"pageInput<",
"/",
"code",
">",
"JSP",
"tag",
".",
"The",
"actual",
"value",
"can",
"be",
"read",
"from",
"within",
"a",
"JSP",
... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L921-L924 |
brianwhu/xillium | base/src/main/java/org/xillium/base/Singleton.java | Singleton.get | public T get(Factory<T> factory, Object... args) throws Exception {
T result = _value;
if (isMissing(result)) synchronized(this) {
result = _value;
if (isMissing(result)) {
_value = result = factory.make(args);
}
}
return result;
} | java | public T get(Factory<T> factory, Object... args) throws Exception {
T result = _value;
if (isMissing(result)) synchronized(this) {
result = _value;
if (isMissing(result)) {
_value = result = factory.make(args);
}
}
return result;
} | [
"public",
"T",
"get",
"(",
"Factory",
"<",
"T",
">",
"factory",
",",
"Object",
"...",
"args",
")",
"throws",
"Exception",
"{",
"T",
"result",
"=",
"_value",
";",
"if",
"(",
"isMissing",
"(",
"result",
")",
")",
"synchronized",
"(",
"this",
")",
"{",
... | Retrieves the singleton object, creating it by calling a provider if it is not created yet. This method uses
double-checked locking to ensure that only one instance will ever be created, while keeping retrieval cost at
minimum.
@see <a href="http://en.wikipedia.org/wiki/Double-checked_locking">Double-checked locking</a>
@param factory a {@link org.xillium.base.Factory Factory} that can be called to create a new value with more than 1 arguments
@param args the arguments to pass to the factory
@return the singleton object
@throws Exception if the factory fails to create a new value | [
"Retrieves",
"the",
"singleton",
"object",
"creating",
"it",
"by",
"calling",
"a",
"provider",
"if",
"it",
"is",
"not",
"created",
"yet",
".",
"This",
"method",
"uses",
"double",
"-",
"checked",
"locking",
"to",
"ensure",
"that",
"only",
"one",
"instance",
... | train | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/base/src/main/java/org/xillium/base/Singleton.java#L82-L91 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RelativeDateTimeFormatter.java | RelativeDateTimeFormatter.getAbsoluteUnitString | private String getAbsoluteUnitString(Style style, AbsoluteUnit unit, Direction direction) {
EnumMap<AbsoluteUnit, EnumMap<Direction, String>> unitMap;
EnumMap<Direction, String> dirMap;
do {
unitMap = qualitativeUnitMap.get(style);
if (unitMap != null) {
dirMap = unitMap.get(unit);
if (dirMap != null) {
String result = dirMap.get(direction);
if (result != null) {
return result;
}
}
}
// Consider other styles from alias fallback.
// Data loading guaranteed no endless loops.
} while ((style = fallbackCache[style.ordinal()]) != null);
return null;
} | java | private String getAbsoluteUnitString(Style style, AbsoluteUnit unit, Direction direction) {
EnumMap<AbsoluteUnit, EnumMap<Direction, String>> unitMap;
EnumMap<Direction, String> dirMap;
do {
unitMap = qualitativeUnitMap.get(style);
if (unitMap != null) {
dirMap = unitMap.get(unit);
if (dirMap != null) {
String result = dirMap.get(direction);
if (result != null) {
return result;
}
}
}
// Consider other styles from alias fallback.
// Data loading guaranteed no endless loops.
} while ((style = fallbackCache[style.ordinal()]) != null);
return null;
} | [
"private",
"String",
"getAbsoluteUnitString",
"(",
"Style",
"style",
",",
"AbsoluteUnit",
"unit",
",",
"Direction",
"direction",
")",
"{",
"EnumMap",
"<",
"AbsoluteUnit",
",",
"EnumMap",
"<",
"Direction",
",",
"String",
">",
">",
"unitMap",
";",
"EnumMap",
"<"... | Gets the string value from qualitativeUnitMap with fallback based on style. | [
"Gets",
"the",
"string",
"value",
"from",
"qualitativeUnitMap",
"with",
"fallback",
"based",
"on",
"style",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RelativeDateTimeFormatter.java#L636-L657 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuModuleLoadDataEx | public static int cuModuleLoadDataEx(CUmodule phMod, String string, int numOptions, int options[], Pointer optionValues)
{
byte bytes[] = string.getBytes();
byte image[] = Arrays.copyOf(bytes, bytes.length+1);
return cuModuleLoadDataEx(phMod, Pointer.to(image), numOptions, options, optionValues);
} | java | public static int cuModuleLoadDataEx(CUmodule phMod, String string, int numOptions, int options[], Pointer optionValues)
{
byte bytes[] = string.getBytes();
byte image[] = Arrays.copyOf(bytes, bytes.length+1);
return cuModuleLoadDataEx(phMod, Pointer.to(image), numOptions, options, optionValues);
} | [
"public",
"static",
"int",
"cuModuleLoadDataEx",
"(",
"CUmodule",
"phMod",
",",
"String",
"string",
",",
"int",
"numOptions",
",",
"int",
"options",
"[",
"]",
",",
"Pointer",
"optionValues",
")",
"{",
"byte",
"bytes",
"[",
"]",
"=",
"string",
".",
"getByte... | A wrapper function for
{@link JCudaDriver#cuModuleLoadDataEx(CUmodule, Pointer, int, int[], Pointer)}
which allows passing in the image data as a string.
@param module Returned module
@param image Module data to load
@param numOptions Number of options
@param options Options for JIT
@param optionValues Option values for JIT
@return The return code from <code>cuModuleLoadDataEx</code>
@see #cuModuleLoadDataEx(CUmodule, Pointer, int, int[], Pointer) | [
"A",
"wrapper",
"function",
"for",
"{",
"@link",
"JCudaDriver#cuModuleLoadDataEx",
"(",
"CUmodule",
"Pointer",
"int",
"int",
"[]",
"Pointer",
")",
"}",
"which",
"allows",
"passing",
"in",
"the",
"image",
"data",
"as",
"a",
"string",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L416-L421 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/painter/AbstractRegionPainter.java | AbstractRegionPainter.deriveARGB | public static int deriveARGB(Color color1, Color color2, float midPoint) {
int r = color1.getRed() + (int) ((color2.getRed() - color1.getRed()) * midPoint + 0.5f);
int g = color1.getGreen() + (int) ((color2.getGreen() - color1.getGreen()) * midPoint + 0.5f);
int b = color1.getBlue() + (int) ((color2.getBlue() - color1.getBlue()) * midPoint + 0.5f);
int a = color1.getAlpha() + (int) ((color2.getAlpha() - color1.getAlpha()) * midPoint + 0.5f);
return ((a & 0xFF) << 24) | ((r & 0xFF) << 16) | ((g & 0xFF) << 8) | (b & 0xFF);
} | java | public static int deriveARGB(Color color1, Color color2, float midPoint) {
int r = color1.getRed() + (int) ((color2.getRed() - color1.getRed()) * midPoint + 0.5f);
int g = color1.getGreen() + (int) ((color2.getGreen() - color1.getGreen()) * midPoint + 0.5f);
int b = color1.getBlue() + (int) ((color2.getBlue() - color1.getBlue()) * midPoint + 0.5f);
int a = color1.getAlpha() + (int) ((color2.getAlpha() - color1.getAlpha()) * midPoint + 0.5f);
return ((a & 0xFF) << 24) | ((r & 0xFF) << 16) | ((g & 0xFF) << 8) | (b & 0xFF);
} | [
"public",
"static",
"int",
"deriveARGB",
"(",
"Color",
"color1",
",",
"Color",
"color2",
",",
"float",
"midPoint",
")",
"{",
"int",
"r",
"=",
"color1",
".",
"getRed",
"(",
")",
"+",
"(",
"int",
")",
"(",
"(",
"color2",
".",
"getRed",
"(",
")",
"-",... | Derives the ARGB value for a color based on an offset between two other
colors.
@param color1 The first color
@param color2 The second color
@param midPoint The offset between color 1 and color 2, a value of 0.0
is color 1 and 1.0 is color 2;
@return the ARGB value for a new color based on this derivation | [
"Derives",
"the",
"ARGB",
"value",
"for",
"a",
"color",
"based",
"on",
"an",
"offset",
"between",
"two",
"other",
"colors",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/AbstractRegionPainter.java#L311-L318 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLNegativeDataPropertyAssertionAxiomImpl_CustomFieldSerializer.java | OWLNegativeDataPropertyAssertionAxiomImpl_CustomFieldSerializer.deserializeInstance | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLNegativeDataPropertyAssertionAxiomImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} | java | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLNegativeDataPropertyAssertionAxiomImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} | [
"@",
"Override",
"public",
"void",
"deserializeInstance",
"(",
"SerializationStreamReader",
"streamReader",
",",
"OWLNegativeDataPropertyAssertionAxiomImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"deserialize",
"(",
"streamReader",
",",
"instance",
")",
... | Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the deserialization operation is not
successful | [
"Deserializes",
"the",
"content",
"of",
"the",
"object",
"from",
"the",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamReader",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLNegativeDataPropertyAssertionAxiomImpl_CustomFieldSerializer.java#L101-L104 |
javagl/Common | src/main/java/de/javagl/common/beans/FullPersistenceDelegate.java | FullPersistenceDelegate.initializeProperty | private void initializeProperty(
Class<?> type, PropertyDescriptor pd, Object oldInstance, Encoder encoder)
throws Exception
{
Method getter = pd.getReadMethod();
Method setter = pd.getWriteMethod();
if (getter != null && setter != null)
{
Expression oldGetExpression =
new Expression(oldInstance, getter.getName(), new Object[] {});
Object oldValue = oldGetExpression.getValue();
Statement setStatement =
new Statement(oldInstance, setter.getName(),
new Object[] { oldValue });
encoder.writeStatement(setStatement);
}
} | java | private void initializeProperty(
Class<?> type, PropertyDescriptor pd, Object oldInstance, Encoder encoder)
throws Exception
{
Method getter = pd.getReadMethod();
Method setter = pd.getWriteMethod();
if (getter != null && setter != null)
{
Expression oldGetExpression =
new Expression(oldInstance, getter.getName(), new Object[] {});
Object oldValue = oldGetExpression.getValue();
Statement setStatement =
new Statement(oldInstance, setter.getName(),
new Object[] { oldValue });
encoder.writeStatement(setStatement);
}
} | [
"private",
"void",
"initializeProperty",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"PropertyDescriptor",
"pd",
",",
"Object",
"oldInstance",
",",
"Encoder",
"encoder",
")",
"throws",
"Exception",
"{",
"Method",
"getter",
"=",
"pd",
".",
"getReadMethod",
"(",
... | Write the statement to initialize the specified property of the given
Java Bean Type, based on the given instance, using the given
encoder
@param type The Java Bean Type
@param pd The property descriptor
@param oldInstance The base instance
@param encoder The encoder
@throws Exception If the value can not be obtained | [
"Write",
"the",
"statement",
"to",
"initialize",
"the",
"specified",
"property",
"of",
"the",
"given",
"Java",
"Bean",
"Type",
"based",
"on",
"the",
"given",
"instance",
"using",
"the",
"given",
"encoder"
] | train | https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/beans/FullPersistenceDelegate.java#L124-L140 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLChecker.java | JQLChecker.extractPlaceHoldersFromVariableStatementAsSet | public Set<JQLPlaceHolder> extractPlaceHoldersFromVariableStatementAsSet(JQLContext jqlContext, String jql) {
return extractPlaceHoldersFromVariableStatement(jqlContext, jql, new LinkedHashSet<JQLPlaceHolder>());
} | java | public Set<JQLPlaceHolder> extractPlaceHoldersFromVariableStatementAsSet(JQLContext jqlContext, String jql) {
return extractPlaceHoldersFromVariableStatement(jqlContext, jql, new LinkedHashSet<JQLPlaceHolder>());
} | [
"public",
"Set",
"<",
"JQLPlaceHolder",
">",
"extractPlaceHoldersFromVariableStatementAsSet",
"(",
"JQLContext",
"jqlContext",
",",
"String",
"jql",
")",
"{",
"return",
"extractPlaceHoldersFromVariableStatement",
"(",
"jqlContext",
",",
"jql",
",",
"new",
"LinkedHashSet",... | Extract all bind parameters and dynamic part used in query.
@param jqlContext
the jql context
@param jql
the jql
@return the sets the | [
"Extract",
"all",
"bind",
"parameters",
"and",
"dynamic",
"part",
"used",
"in",
"query",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLChecker.java#L846-L848 |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/PHS398FellowshipSupplementalV3_1Generator.java | PHS398FellowshipSupplementalV3_1Generator.getSupplementationFromOtherSources | protected void getSupplementationFromOtherSources(Budget budget, Map<Integer, String> hmBudgetQuestions) {
if (!hmBudgetQuestions.isEmpty()) {
if (hmBudgetQuestions.get(OTHER_SUPP_SOURCE) != null) {
if (hmBudgetQuestions.get(OTHER_SUPP_SOURCE).toString().toUpperCase().equals("Y")) {
SupplementationFromOtherSources supplementationFromOtherSources = budget
.addNewSupplementationFromOtherSources();
if (hmBudgetQuestions.get(SUPP_SOURCE) != null) {
supplementationFromOtherSources.setSource(hmBudgetQuestions.get(SUPP_SOURCE).toString());
supplementationFromOtherSources.setAmount(new BigDecimal(hmBudgetQuestions.get(SUPP_FUNDING_AMT).toString()));
try {
supplementationFromOtherSources.setNumberOfMonths(new BigDecimal(hmBudgetQuestions.get(SUPP_MONTHS).toString()));
} catch (Exception ex) {
}
supplementationFromOtherSources.setType(hmBudgetQuestions.get(SUPP_TYPE).toString());
}
}
}
}
} | java | protected void getSupplementationFromOtherSources(Budget budget, Map<Integer, String> hmBudgetQuestions) {
if (!hmBudgetQuestions.isEmpty()) {
if (hmBudgetQuestions.get(OTHER_SUPP_SOURCE) != null) {
if (hmBudgetQuestions.get(OTHER_SUPP_SOURCE).toString().toUpperCase().equals("Y")) {
SupplementationFromOtherSources supplementationFromOtherSources = budget
.addNewSupplementationFromOtherSources();
if (hmBudgetQuestions.get(SUPP_SOURCE) != null) {
supplementationFromOtherSources.setSource(hmBudgetQuestions.get(SUPP_SOURCE).toString());
supplementationFromOtherSources.setAmount(new BigDecimal(hmBudgetQuestions.get(SUPP_FUNDING_AMT).toString()));
try {
supplementationFromOtherSources.setNumberOfMonths(new BigDecimal(hmBudgetQuestions.get(SUPP_MONTHS).toString()));
} catch (Exception ex) {
}
supplementationFromOtherSources.setType(hmBudgetQuestions.get(SUPP_TYPE).toString());
}
}
}
}
} | [
"protected",
"void",
"getSupplementationFromOtherSources",
"(",
"Budget",
"budget",
",",
"Map",
"<",
"Integer",
",",
"String",
">",
"hmBudgetQuestions",
")",
"{",
"if",
"(",
"!",
"hmBudgetQuestions",
".",
"isEmpty",
"(",
")",
")",
"{",
"if",
"(",
"hmBudgetQues... | /*
This method is used to set data to SupplementationFromOtherSources XMLObject from budgetMap data for Budget | [
"/",
"*",
"This",
"method",
"is",
"used",
"to",
"set",
"data",
"to",
"SupplementationFromOtherSources",
"XMLObject",
"from",
"budgetMap",
"data",
"for",
"Budget"
] | train | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/PHS398FellowshipSupplementalV3_1Generator.java#L639-L659 |
hypercube1024/firefly | firefly-common/src/main/java/com/firefly/utils/io/BufferUtils.java | BufferUtils.toBuffer | public static ByteBuffer toBuffer(byte[] array) {
if (array == null)
return EMPTY_BUFFER;
return toBuffer(array, 0, array.length);
} | java | public static ByteBuffer toBuffer(byte[] array) {
if (array == null)
return EMPTY_BUFFER;
return toBuffer(array, 0, array.length);
} | [
"public",
"static",
"ByteBuffer",
"toBuffer",
"(",
"byte",
"[",
"]",
"array",
")",
"{",
"if",
"(",
"array",
"==",
"null",
")",
"return",
"EMPTY_BUFFER",
";",
"return",
"toBuffer",
"(",
"array",
",",
"0",
",",
"array",
".",
"length",
")",
";",
"}"
] | Create a new ByteBuffer using provided byte array.
@param array the byte array to back buffer with.
@return ByteBuffer with provided byte array, in flush mode | [
"Create",
"a",
"new",
"ByteBuffer",
"using",
"provided",
"byte",
"array",
"."
] | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/io/BufferUtils.java#L795-L799 |
katjahahn/PortEx | src/main/java/com/github/katjahahn/parser/ByteArrayUtil.java | ByteArrayUtil.byteToHex | public static String byteToHex(byte[] array, String separator) {
assert array != null;
StringBuilder buffer = new StringBuilder();
for (int i = 0; i < array.length; i++) {
// add separator in between, not before the first byte
if (i != 0) {
buffer.append(separator);
}
// (b & 0xff) treats b as unsigned byte
// first nibble is 0 if byte is less than 0x10
if ((array[i] & 0xff) < 0x10) {
buffer.append("0");
}
// use java's hex conversion for the rest
buffer.append(Integer.toString(array[i] & 0xff, 16));
}
return buffer.toString();
} | java | public static String byteToHex(byte[] array, String separator) {
assert array != null;
StringBuilder buffer = new StringBuilder();
for (int i = 0; i < array.length; i++) {
// add separator in between, not before the first byte
if (i != 0) {
buffer.append(separator);
}
// (b & 0xff) treats b as unsigned byte
// first nibble is 0 if byte is less than 0x10
if ((array[i] & 0xff) < 0x10) {
buffer.append("0");
}
// use java's hex conversion for the rest
buffer.append(Integer.toString(array[i] & 0xff, 16));
}
return buffer.toString();
} | [
"public",
"static",
"String",
"byteToHex",
"(",
"byte",
"[",
"]",
"array",
",",
"String",
"separator",
")",
"{",
"assert",
"array",
"!=",
"null",
";",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"... | Converts a byte array to a hex string.
<p>
Every single byte is shown in the string, also prepended zero bytes.
Single bytes are delimited with the separator.
@param array
byte array to convert
@param separator
the delimiter of the bytes
@return hexadecimal string representation of the byte array | [
"Converts",
"a",
"byte",
"array",
"to",
"a",
"hex",
"string",
".",
"<p",
">",
"Every",
"single",
"byte",
"is",
"shown",
"in",
"the",
"string",
"also",
"prepended",
"zero",
"bytes",
".",
"Single",
"bytes",
"are",
"delimited",
"with",
"the",
"separator",
"... | train | https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/ByteArrayUtil.java#L168-L185 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderItemPersistenceImpl.java | CommerceOrderItemPersistenceImpl.findByC_I | @Override
public List<CommerceOrderItem> findByC_I(long commerceOrderId,
long CPInstanceId, int start, int end) {
return findByC_I(commerceOrderId, CPInstanceId, start, end, null);
} | java | @Override
public List<CommerceOrderItem> findByC_I(long commerceOrderId,
long CPInstanceId, int start, int end) {
return findByC_I(commerceOrderId, CPInstanceId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceOrderItem",
">",
"findByC_I",
"(",
"long",
"commerceOrderId",
",",
"long",
"CPInstanceId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByC_I",
"(",
"commerceOrderId",
",",
"CPInstanceId",
",... | Returns a range of all the commerce order items where commerceOrderId = ? and CPInstanceId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceOrderItemModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param commerceOrderId the commerce order ID
@param CPInstanceId the cp instance ID
@param start the lower bound of the range of commerce order items
@param end the upper bound of the range of commerce order items (not inclusive)
@return the range of matching commerce order items | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"order",
"items",
"where",
"commerceOrderId",
"=",
"?",
";",
"and",
"CPInstanceId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderItemPersistenceImpl.java#L1692-L1696 |
Azure/azure-sdk-for-java | mysql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/mysql/v2017_12_01/implementation/DatabasesInner.java | DatabasesInner.createOrUpdateAsync | public Observable<DatabaseInner> createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1<ServiceResponse<DatabaseInner>, DatabaseInner>() {
@Override
public DatabaseInner call(ServiceResponse<DatabaseInner> response) {
return response.body();
}
});
} | java | public Observable<DatabaseInner> createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1<ServiceResponse<DatabaseInner>, DatabaseInner>() {
@Override
public DatabaseInner call(ServiceResponse<DatabaseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DatabaseInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"DatabaseInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",... | Creates a new database or updates an existing database.
@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 databaseName The name of the database.
@param parameters The required parameters for creating or updating a database.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"a",
"new",
"database",
"or",
"updates",
"an",
"existing",
"database",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mysql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/mysql/v2017_12_01/implementation/DatabasesInner.java#L126-L133 |
acromusashi/acromusashi-stream | src/main/java/acromusashi/stream/bean/FieldExtractor.java | FieldExtractor.extractKeyTail | public static String extractKeyTail(String key, String delimeter)
{
int index = key.indexOf(delimeter);
if (index == -1)
{
return null;
}
String result = key.substring(index + delimeter.length());
return result;
} | java | public static String extractKeyTail(String key, String delimeter)
{
int index = key.indexOf(delimeter);
if (index == -1)
{
return null;
}
String result = key.substring(index + delimeter.length());
return result;
} | [
"public",
"static",
"String",
"extractKeyTail",
"(",
"String",
"key",
",",
"String",
"delimeter",
")",
"{",
"int",
"index",
"=",
"key",
".",
"indexOf",
"(",
"delimeter",
")",
";",
"if",
"(",
"index",
"==",
"-",
"1",
")",
"{",
"return",
"null",
";",
"... | Extract the value of keyTail.
@param key is used to get string.
@param delimeter key delimeter
@return the value of keyTail . | [
"Extract",
"the",
"value",
"of",
"keyTail",
"."
] | train | https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/bean/FieldExtractor.java#L106-L115 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.