repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
mcxiaoke/Android-Next | recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java | HeaderFooterRecyclerAdapter.notifyContentItemInserted | public final void notifyContentItemInserted(int position) {
int newHeaderItemCount = getHeaderItemCount();
int newContentItemCount = getContentItemCount();
if (position < 0 || position >= newContentItemCount) {
throw new IndexOutOfBoundsException("The given position " + position + " ... | java | public final void notifyContentItemInserted(int position) {
int newHeaderItemCount = getHeaderItemCount();
int newContentItemCount = getContentItemCount();
if (position < 0 || position >= newContentItemCount) {
throw new IndexOutOfBoundsException("The given position " + position + " ... | [
"public",
"final",
"void",
"notifyContentItemInserted",
"(",
"int",
"position",
")",
"{",
"int",
"newHeaderItemCount",
"=",
"getHeaderItemCount",
"(",
")",
";",
"int",
"newContentItemCount",
"=",
"getContentItemCount",
"(",
")",
";",
"if",
"(",
"position",
"<",
... | Notifies that a content item is inserted.
@param position the position of the content item. | [
"Notifies",
"that",
"a",
"content",
"item",
"is",
"inserted",
"."
] | 1bfdf99d0b81a849aa0fa6697c53ed673151ca39 | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java#L209-L216 | train |
mcxiaoke/Android-Next | recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java | HeaderFooterRecyclerAdapter.notifyContentItemRangeInserted | public final void notifyContentItemRangeInserted(int positionStart, int itemCount) {
int newHeaderItemCount = getHeaderItemCount();
int newContentItemCount = getContentItemCount();
if (positionStart < 0 || itemCount < 0 || positionStart + itemCount > newContentItemCount) {
throw new ... | java | public final void notifyContentItemRangeInserted(int positionStart, int itemCount) {
int newHeaderItemCount = getHeaderItemCount();
int newContentItemCount = getContentItemCount();
if (positionStart < 0 || itemCount < 0 || positionStart + itemCount > newContentItemCount) {
throw new ... | [
"public",
"final",
"void",
"notifyContentItemRangeInserted",
"(",
"int",
"positionStart",
",",
"int",
"itemCount",
")",
"{",
"int",
"newHeaderItemCount",
"=",
"getHeaderItemCount",
"(",
")",
";",
"int",
"newContentItemCount",
"=",
"getContentItemCount",
"(",
")",
";... | Notifies that multiple content items are inserted.
@param positionStart the position.
@param itemCount the item count. | [
"Notifies",
"that",
"multiple",
"content",
"items",
"are",
"inserted",
"."
] | 1bfdf99d0b81a849aa0fa6697c53ed673151ca39 | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java#L224-L233 | train |
mcxiaoke/Android-Next | recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java | HeaderFooterRecyclerAdapter.notifyContentItemChanged | public final void notifyContentItemChanged(int position) {
if (position < 0 || position >= contentItemCount) {
throw new IndexOutOfBoundsException("The given position " + position
+ " is not within the position bounds for content items [0 - " + (contentItemCount - 1) + "].");
... | java | public final void notifyContentItemChanged(int position) {
if (position < 0 || position >= contentItemCount) {
throw new IndexOutOfBoundsException("The given position " + position
+ " is not within the position bounds for content items [0 - " + (contentItemCount - 1) + "].");
... | [
"public",
"final",
"void",
"notifyContentItemChanged",
"(",
"int",
"position",
")",
"{",
"if",
"(",
"position",
"<",
"0",
"||",
"position",
">=",
"contentItemCount",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"The given position \"",
"+",
"posit... | Notifies that a content item is changed.
@param position the position. | [
"Notifies",
"that",
"a",
"content",
"item",
"is",
"changed",
"."
] | 1bfdf99d0b81a849aa0fa6697c53ed673151ca39 | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java#L240-L246 | train |
mcxiaoke/Android-Next | recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java | HeaderFooterRecyclerAdapter.notifyContentItemRangeChanged | public final void notifyContentItemRangeChanged(int positionStart, int itemCount) {
if (positionStart < 0 || itemCount < 0 || positionStart + itemCount > contentItemCount) {
throw new IndexOutOfBoundsException("The given range [" + positionStart + " - "
+ (positionStart + itemCou... | java | public final void notifyContentItemRangeChanged(int positionStart, int itemCount) {
if (positionStart < 0 || itemCount < 0 || positionStart + itemCount > contentItemCount) {
throw new IndexOutOfBoundsException("The given range [" + positionStart + " - "
+ (positionStart + itemCou... | [
"public",
"final",
"void",
"notifyContentItemRangeChanged",
"(",
"int",
"positionStart",
",",
"int",
"itemCount",
")",
"{",
"if",
"(",
"positionStart",
"<",
"0",
"||",
"itemCount",
"<",
"0",
"||",
"positionStart",
"+",
"itemCount",
">",
"contentItemCount",
")",
... | Notifies that multiple content items are changed.
@param positionStart the position.
@param itemCount the item count. | [
"Notifies",
"that",
"multiple",
"content",
"items",
"are",
"changed",
"."
] | 1bfdf99d0b81a849aa0fa6697c53ed673151ca39 | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java#L254-L261 | train |
mcxiaoke/Android-Next | recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java | HeaderFooterRecyclerAdapter.notifyContentItemMoved | public final void notifyContentItemMoved(int fromPosition, int toPosition) {
if (fromPosition < 0 || toPosition < 0 || fromPosition >= contentItemCount || toPosition >= contentItemCount) {
throw new IndexOutOfBoundsException("The given fromPosition " + fromPosition + " or toPosition "
... | java | public final void notifyContentItemMoved(int fromPosition, int toPosition) {
if (fromPosition < 0 || toPosition < 0 || fromPosition >= contentItemCount || toPosition >= contentItemCount) {
throw new IndexOutOfBoundsException("The given fromPosition " + fromPosition + " or toPosition "
... | [
"public",
"final",
"void",
"notifyContentItemMoved",
"(",
"int",
"fromPosition",
",",
"int",
"toPosition",
")",
"{",
"if",
"(",
"fromPosition",
"<",
"0",
"||",
"toPosition",
"<",
"0",
"||",
"fromPosition",
">=",
"contentItemCount",
"||",
"toPosition",
">=",
"c... | Notifies that an existing content item is moved to another position.
@param fromPosition the original position.
@param toPosition the new position. | [
"Notifies",
"that",
"an",
"existing",
"content",
"item",
"is",
"moved",
"to",
"another",
"position",
"."
] | 1bfdf99d0b81a849aa0fa6697c53ed673151ca39 | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java#L269-L275 | train |
mcxiaoke/Android-Next | recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java | HeaderFooterRecyclerAdapter.notifyContentItemRemoved | public final void notifyContentItemRemoved(int position) {
if (position < 0 || position >= contentItemCount) {
throw new IndexOutOfBoundsException("The given position " + position
+ " is not within the position bounds for content items [0 - "
+ (contentItemCou... | java | public final void notifyContentItemRemoved(int position) {
if (position < 0 || position >= contentItemCount) {
throw new IndexOutOfBoundsException("The given position " + position
+ " is not within the position bounds for content items [0 - "
+ (contentItemCou... | [
"public",
"final",
"void",
"notifyContentItemRemoved",
"(",
"int",
"position",
")",
"{",
"if",
"(",
"position",
"<",
"0",
"||",
"position",
">=",
"contentItemCount",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"The given position \"",
"+",
"posit... | Notifies that a content item is removed.
@param position the position. | [
"Notifies",
"that",
"a",
"content",
"item",
"is",
"removed",
"."
] | 1bfdf99d0b81a849aa0fa6697c53ed673151ca39 | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java#L282-L289 | train |
mcxiaoke/Android-Next | recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java | HeaderFooterRecyclerAdapter.notifyContentItemRangeRemoved | public final void notifyContentItemRangeRemoved(int positionStart, int itemCount) {
if (positionStart < 0 || itemCount < 0 || positionStart + itemCount > contentItemCount) {
throw new IndexOutOfBoundsException("The given range [" + positionStart + " - "
+ (positionStart + itemCou... | java | public final void notifyContentItemRangeRemoved(int positionStart, int itemCount) {
if (positionStart < 0 || itemCount < 0 || positionStart + itemCount > contentItemCount) {
throw new IndexOutOfBoundsException("The given range [" + positionStart + " - "
+ (positionStart + itemCou... | [
"public",
"final",
"void",
"notifyContentItemRangeRemoved",
"(",
"int",
"positionStart",
",",
"int",
"itemCount",
")",
"{",
"if",
"(",
"positionStart",
"<",
"0",
"||",
"itemCount",
"<",
"0",
"||",
"positionStart",
"+",
"itemCount",
">",
"contentItemCount",
")",
... | Notifies that multiple content items are removed.
@param positionStart the position.
@param itemCount the item count. | [
"Notifies",
"that",
"multiple",
"content",
"items",
"are",
"removed",
"."
] | 1bfdf99d0b81a849aa0fa6697c53ed673151ca39 | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java#L297-L304 | train |
mcxiaoke/Android-Next | recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java | HeaderFooterRecyclerAdapter.notifyFooterItemInserted | public final void notifyFooterItemInserted(int position) {
int newHeaderItemCount = getHeaderItemCount();
int newContentItemCount = getContentItemCount();
int newFooterItemCount = getFooterItemCount();
// if (position < 0 || position >= newFooterItemCount) {
// throw new IndexO... | java | public final void notifyFooterItemInserted(int position) {
int newHeaderItemCount = getHeaderItemCount();
int newContentItemCount = getContentItemCount();
int newFooterItemCount = getFooterItemCount();
// if (position < 0 || position >= newFooterItemCount) {
// throw new IndexO... | [
"public",
"final",
"void",
"notifyFooterItemInserted",
"(",
"int",
"position",
")",
"{",
"int",
"newHeaderItemCount",
"=",
"getHeaderItemCount",
"(",
")",
";",
"int",
"newContentItemCount",
"=",
"getContentItemCount",
"(",
")",
";",
"int",
"newFooterItemCount",
"=",... | Notifies that a footer item is inserted.
@param position the position of the content item. | [
"Notifies",
"that",
"a",
"footer",
"item",
"is",
"inserted",
"."
] | 1bfdf99d0b81a849aa0fa6697c53ed673151ca39 | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java#L311-L321 | train |
mcxiaoke/Android-Next | recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java | HeaderFooterRecyclerAdapter.notifyFooterItemRangeInserted | public final void notifyFooterItemRangeInserted(int positionStart, int itemCount) {
int newHeaderItemCount = getHeaderItemCount();
int newContentItemCount = getContentItemCount();
int newFooterItemCount = getFooterItemCount();
if (positionStart < 0 || itemCount < 0 || positionStart + ite... | java | public final void notifyFooterItemRangeInserted(int positionStart, int itemCount) {
int newHeaderItemCount = getHeaderItemCount();
int newContentItemCount = getContentItemCount();
int newFooterItemCount = getFooterItemCount();
if (positionStart < 0 || itemCount < 0 || positionStart + ite... | [
"public",
"final",
"void",
"notifyFooterItemRangeInserted",
"(",
"int",
"positionStart",
",",
"int",
"itemCount",
")",
"{",
"int",
"newHeaderItemCount",
"=",
"getHeaderItemCount",
"(",
")",
";",
"int",
"newContentItemCount",
"=",
"getContentItemCount",
"(",
")",
";"... | Notifies that multiple footer items are inserted.
@param positionStart the position.
@param itemCount the item count. | [
"Notifies",
"that",
"multiple",
"footer",
"items",
"are",
"inserted",
"."
] | 1bfdf99d0b81a849aa0fa6697c53ed673151ca39 | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java#L329-L339 | train |
mcxiaoke/Android-Next | recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java | HeaderFooterRecyclerAdapter.notifyFooterItemChanged | public final void notifyFooterItemChanged(int position) {
if (position < 0 || position >= footerItemCount) {
throw new IndexOutOfBoundsException("The given position " + position
+ " is not within the position bounds for footer items [0 - "
+ (footerItemCount -... | java | public final void notifyFooterItemChanged(int position) {
if (position < 0 || position >= footerItemCount) {
throw new IndexOutOfBoundsException("The given position " + position
+ " is not within the position bounds for footer items [0 - "
+ (footerItemCount -... | [
"public",
"final",
"void",
"notifyFooterItemChanged",
"(",
"int",
"position",
")",
"{",
"if",
"(",
"position",
"<",
"0",
"||",
"position",
">=",
"footerItemCount",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"The given position \"",
"+",
"positio... | Notifies that a footer item is changed.
@param position the position. | [
"Notifies",
"that",
"a",
"footer",
"item",
"is",
"changed",
"."
] | 1bfdf99d0b81a849aa0fa6697c53ed673151ca39 | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java#L346-L353 | train |
mcxiaoke/Android-Next | recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java | HeaderFooterRecyclerAdapter.notifyFooterItemRangeChanged | public final void notifyFooterItemRangeChanged(int positionStart, int itemCount) {
if (positionStart < 0 || itemCount < 0 || positionStart + itemCount > footerItemCount) {
throw new IndexOutOfBoundsException("The given range [" + positionStart + " - "
+ (positionStart + itemCount... | java | public final void notifyFooterItemRangeChanged(int positionStart, int itemCount) {
if (positionStart < 0 || itemCount < 0 || positionStart + itemCount > footerItemCount) {
throw new IndexOutOfBoundsException("The given range [" + positionStart + " - "
+ (positionStart + itemCount... | [
"public",
"final",
"void",
"notifyFooterItemRangeChanged",
"(",
"int",
"positionStart",
",",
"int",
"itemCount",
")",
"{",
"if",
"(",
"positionStart",
"<",
"0",
"||",
"itemCount",
"<",
"0",
"||",
"positionStart",
"+",
"itemCount",
">",
"footerItemCount",
")",
... | Notifies that multiple footer items are changed.
@param positionStart the position.
@param itemCount the item count. | [
"Notifies",
"that",
"multiple",
"footer",
"items",
"are",
"changed",
"."
] | 1bfdf99d0b81a849aa0fa6697c53ed673151ca39 | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java#L361-L368 | train |
mcxiaoke/Android-Next | recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java | HeaderFooterRecyclerAdapter.notifyFooterItemMoved | public final void notifyFooterItemMoved(int fromPosition, int toPosition) {
if (fromPosition < 0 || toPosition < 0 || fromPosition >= footerItemCount || toPosition >= footerItemCount) {
throw new IndexOutOfBoundsException("The given fromPosition " + fromPosition
+ " or toPosition... | java | public final void notifyFooterItemMoved(int fromPosition, int toPosition) {
if (fromPosition < 0 || toPosition < 0 || fromPosition >= footerItemCount || toPosition >= footerItemCount) {
throw new IndexOutOfBoundsException("The given fromPosition " + fromPosition
+ " or toPosition... | [
"public",
"final",
"void",
"notifyFooterItemMoved",
"(",
"int",
"fromPosition",
",",
"int",
"toPosition",
")",
"{",
"if",
"(",
"fromPosition",
"<",
"0",
"||",
"toPosition",
"<",
"0",
"||",
"fromPosition",
">=",
"footerItemCount",
"||",
"toPosition",
">=",
"foo... | Notifies that an existing footer item is moved to another position.
@param fromPosition the original position.
@param toPosition the new position. | [
"Notifies",
"that",
"an",
"existing",
"footer",
"item",
"is",
"moved",
"to",
"another",
"position",
"."
] | 1bfdf99d0b81a849aa0fa6697c53ed673151ca39 | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java#L376-L383 | train |
mcxiaoke/Android-Next | recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java | HeaderFooterRecyclerAdapter.notifyFooterItemRangeRemoved | public final void notifyFooterItemRangeRemoved(int positionStart, int itemCount) {
if (positionStart < 0 || itemCount < 0 || positionStart + itemCount > footerItemCount) {
throw new IndexOutOfBoundsException("The given range [" + positionStart + " - "
+ (positionStart + itemCount... | java | public final void notifyFooterItemRangeRemoved(int positionStart, int itemCount) {
if (positionStart < 0 || itemCount < 0 || positionStart + itemCount > footerItemCount) {
throw new IndexOutOfBoundsException("The given range [" + positionStart + " - "
+ (positionStart + itemCount... | [
"public",
"final",
"void",
"notifyFooterItemRangeRemoved",
"(",
"int",
"positionStart",
",",
"int",
"itemCount",
")",
"{",
"if",
"(",
"positionStart",
"<",
"0",
"||",
"itemCount",
"<",
"0",
"||",
"positionStart",
"+",
"itemCount",
">",
"footerItemCount",
")",
... | Notifies that multiple footer items are removed.
@param positionStart the position.
@param itemCount the item count. | [
"Notifies",
"that",
"multiple",
"footer",
"items",
"are",
"removed",
"."
] | 1bfdf99d0b81a849aa0fa6697c53ed673151ca39 | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java#L404-L411 | train |
mcxiaoke/Android-Next | ui/src/main/java/com/mcxiaoke/next/ui/list/AdapterExtend.java | AdapterExtend.getView | @Override
public View getView(int position, View convertView, ViewGroup parent) {
if (position == super.getCount() && isEnableRefreshing()) {
return (mFooter);
}
return (super.getView(position, convertView, parent));
} | java | @Override
public View getView(int position, View convertView, ViewGroup parent) {
if (position == super.getCount() && isEnableRefreshing()) {
return (mFooter);
}
return (super.getView(position, convertView, parent));
} | [
"@",
"Override",
"public",
"View",
"getView",
"(",
"int",
"position",
",",
"View",
"convertView",
",",
"ViewGroup",
"parent",
")",
"{",
"if",
"(",
"position",
"==",
"super",
".",
"getCount",
"(",
")",
"&&",
"isEnableRefreshing",
"(",
")",
")",
"{",
"retu... | Get a View that displays the data at the specified
position in the data set. In this case, if we are at
the end of the list and we are still in append mode, we
ask for a pending view and return it, plus kick off the
background task to append more data to the wrapped
adapter.
@param position Position of the item who... | [
"Get",
"a",
"View",
"that",
"displays",
"the",
"data",
"at",
"the",
"specified",
"position",
"in",
"the",
"data",
"set",
".",
"In",
"this",
"case",
"if",
"we",
"are",
"at",
"the",
"end",
"of",
"the",
"list",
"and",
"we",
"are",
"still",
"in",
"append... | 1bfdf99d0b81a849aa0fa6697c53ed673151ca39 | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/ui/src/main/java/com/mcxiaoke/next/ui/list/AdapterExtend.java#L146-L152 | train |
mcxiaoke/Android-Next | core/src/main/java/com/mcxiaoke/next/utils/StringUtils.java | StringUtils.addStringToArray | public static String[] addStringToArray(String[] array, String str) {
if (isEmpty(array)) {
return new String[]{str};
}
String[] newArr = new String[array.length + 1];
System.arraycopy(array, 0, newArr, 0, array.length);
newArr[array.length] = str;
return newA... | java | public static String[] addStringToArray(String[] array, String str) {
if (isEmpty(array)) {
return new String[]{str};
}
String[] newArr = new String[array.length + 1];
System.arraycopy(array, 0, newArr, 0, array.length);
newArr[array.length] = str;
return newA... | [
"public",
"static",
"String",
"[",
"]",
"addStringToArray",
"(",
"String",
"[",
"]",
"array",
",",
"String",
"str",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"array",
")",
")",
"{",
"return",
"new",
"String",
"[",
"]",
"{",
"str",
"}",
";",
"}",
"String... | Append the given String to the given String array, returning a new array
consisting of the input array contents plus the given String.
@param array the array to append to (can be <code>null</code>)
@param str the String to append
@return the new array (never <code>null</code>) | [
"Append",
"the",
"given",
"String",
"to",
"the",
"given",
"String",
"array",
"returning",
"a",
"new",
"array",
"consisting",
"of",
"the",
"input",
"array",
"contents",
"plus",
"the",
"given",
"String",
"."
] | 1bfdf99d0b81a849aa0fa6697c53ed673151ca39 | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/core/src/main/java/com/mcxiaoke/next/utils/StringUtils.java#L887-L895 | train |
mcxiaoke/Android-Next | core/src/main/java/com/mcxiaoke/next/utils/StringUtils.java | StringUtils.sortStringArray | public static String[] sortStringArray(String[] array) {
if (isEmpty(array)) {
return new String[0];
}
Arrays.sort(array);
return array;
} | java | public static String[] sortStringArray(String[] array) {
if (isEmpty(array)) {
return new String[0];
}
Arrays.sort(array);
return array;
} | [
"public",
"static",
"String",
"[",
"]",
"sortStringArray",
"(",
"String",
"[",
"]",
"array",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"array",
")",
")",
"{",
"return",
"new",
"String",
"[",
"0",
"]",
";",
"}",
"Arrays",
".",
"sort",
"(",
"array",
")",
... | Turn given source String array into sorted array.
@param array the source array
@return the sorted array (never <code>null</code>) | [
"Turn",
"given",
"source",
"String",
"array",
"into",
"sorted",
"array",
"."
] | 1bfdf99d0b81a849aa0fa6697c53ed673151ca39 | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/core/src/main/java/com/mcxiaoke/next/utils/StringUtils.java#L957-L963 | train |
mcxiaoke/Android-Next | core/src/main/java/com/mcxiaoke/next/utils/StringUtils.java | StringUtils.removeDuplicateStrings | public static String[] removeDuplicateStrings(String[] array) {
if (isEmpty(array)) {
return array;
}
Set<String> set = new TreeSet<String>();
Collections.addAll(set, array);
return toStringArray(set);
} | java | public static String[] removeDuplicateStrings(String[] array) {
if (isEmpty(array)) {
return array;
}
Set<String> set = new TreeSet<String>();
Collections.addAll(set, array);
return toStringArray(set);
} | [
"public",
"static",
"String",
"[",
"]",
"removeDuplicateStrings",
"(",
"String",
"[",
"]",
"array",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"array",
")",
")",
"{",
"return",
"array",
";",
"}",
"Set",
"<",
"String",
">",
"set",
"=",
"new",
"TreeSet",
"<"... | Remove duplicate Strings from the given array. Also sorts the array, as
it uses a TreeSet.
@param array the String array
@return an array without duplicates, in natural sort order | [
"Remove",
"duplicate",
"Strings",
"from",
"the",
"given",
"array",
".",
"Also",
"sorts",
"the",
"array",
"as",
"it",
"uses",
"a",
"TreeSet",
"."
] | 1bfdf99d0b81a849aa0fa6697c53ed673151ca39 | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/core/src/main/java/com/mcxiaoke/next/utils/StringUtils.java#L1022-L1029 | train |
mcxiaoke/Android-Next | core/src/main/java/com/mcxiaoke/next/utils/StringUtils.java | StringUtils.commaDelimitedListToSet | public static Set<String> commaDelimitedListToSet(String str) {
Set<String> set = new TreeSet<String>();
String[] tokens = commaDelimitedListToStringArray(str);
Collections.addAll(set, tokens);
return set;
} | java | public static Set<String> commaDelimitedListToSet(String str) {
Set<String> set = new TreeSet<String>();
String[] tokens = commaDelimitedListToStringArray(str);
Collections.addAll(set, tokens);
return set;
} | [
"public",
"static",
"Set",
"<",
"String",
">",
"commaDelimitedListToSet",
"(",
"String",
"str",
")",
"{",
"Set",
"<",
"String",
">",
"set",
"=",
"new",
"TreeSet",
"<",
"String",
">",
"(",
")",
";",
"String",
"[",
"]",
"tokens",
"=",
"commaDelimitedListTo... | Convenience method to convert a CSV string list to a set. Note that this
will suppress duplicates.
@param str the input String
@return a Set of String entries in the list | [
"Convenience",
"method",
"to",
"convert",
"a",
"CSV",
"string",
"list",
"to",
"a",
"set",
".",
"Note",
"that",
"this",
"will",
"suppress",
"duplicates",
"."
] | 1bfdf99d0b81a849aa0fa6697c53ed673151ca39 | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/core/src/main/java/com/mcxiaoke/next/utils/StringUtils.java#L1257-L1262 | train |
mcxiaoke/Android-Next | core/src/main/java/com/mcxiaoke/next/utils/StringUtils.java | StringUtils.toSafeFileName | public static String toSafeFileName(String name) {
int size = name.length();
StringBuilder builder = new StringBuilder(size * 2);
for (int i = 0; i < size; i++) {
char c = name.charAt(i);
boolean valid = c >= 'a' && c <= 'z';
valid = valid || (c >= 'A' && c <=... | java | public static String toSafeFileName(String name) {
int size = name.length();
StringBuilder builder = new StringBuilder(size * 2);
for (int i = 0; i < size; i++) {
char c = name.charAt(i);
boolean valid = c >= 'a' && c <= 'z';
valid = valid || (c >= 'A' && c <=... | [
"public",
"static",
"String",
"toSafeFileName",
"(",
"String",
"name",
")",
"{",
"int",
"size",
"=",
"name",
".",
"length",
"(",
")",
";",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
"size",
"*",
"2",
")",
";",
"for",
"(",
"int",
"i",... | Converts any string into a string that is safe to use as a file name.
The result will only include ascii characters and numbers, and the "-","_", and "." characters. | [
"Converts",
"any",
"string",
"into",
"a",
"string",
"that",
"is",
"safe",
"to",
"use",
"as",
"a",
"file",
"name",
".",
"The",
"result",
"will",
"only",
"include",
"ascii",
"characters",
"and",
"numbers",
"and",
"the",
"-",
"_",
"and",
".",
"characters",
... | 1bfdf99d0b81a849aa0fa6697c53ed673151ca39 | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/core/src/main/java/com/mcxiaoke/next/utils/StringUtils.java#L1525-L1544 | train |
taskadapter/trello-java-wrapper | src/main/java/com/julienvey/trello/impl/TrelloImpl.java | TrelloImpl.getBoardMemberActivity | @Override
@Deprecated
public List<CardWithActions> getBoardMemberActivity(String boardId, String memberId,
String actionFilter, Argument... args) {
if (actionFilter == null)
actionFilter = "all";
Argument[] argsAndFilter = Arrays.copyOf(args, args.length + 1);
arg... | java | @Override
@Deprecated
public List<CardWithActions> getBoardMemberActivity(String boardId, String memberId,
String actionFilter, Argument... args) {
if (actionFilter == null)
actionFilter = "all";
Argument[] argsAndFilter = Arrays.copyOf(args, args.length + 1);
arg... | [
"@",
"Override",
"@",
"Deprecated",
"public",
"List",
"<",
"CardWithActions",
">",
"getBoardMemberActivity",
"(",
"String",
"boardId",
",",
"String",
"memberId",
",",
"String",
"actionFilter",
",",
"Argument",
"...",
"args",
")",
"{",
"if",
"(",
"actionFilter",
... | FIXME Remove this method | [
"FIXME",
"Remove",
"this",
"method"
] | 70d57a890e54307eab81659a3d420d05ea48bd5d | https://github.com/taskadapter/trello-java-wrapper/blob/70d57a890e54307eab81659a3d420d05ea48bd5d/src/main/java/com/julienvey/trello/impl/TrelloImpl.java#L232-L243 | train |
codelibs/jcifs | src/main/java/jcifs/smb1/smb1/SigningDigest.java | SigningDigest.sign | void sign(byte[] data, int offset, int length,
ServerMessageBlock request, ServerMessageBlock response) {
request.signSeq = signSequence;
if( response != null ) {
response.signSeq = signSequence + 1;
response.verifyFailed = false;
}
try {
... | java | void sign(byte[] data, int offset, int length,
ServerMessageBlock request, ServerMessageBlock response) {
request.signSeq = signSequence;
if( response != null ) {
response.signSeq = signSequence + 1;
response.verifyFailed = false;
}
try {
... | [
"void",
"sign",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"int",
"length",
",",
"ServerMessageBlock",
"request",
",",
"ServerMessageBlock",
"response",
")",
"{",
"request",
".",
"signSeq",
"=",
"signSequence",
";",
"if",
"(",
"response",
"!... | Performs MAC signing of the SMB. This is done as follows.
The signature field of the SMB is overwritted with the sequence number;
The MD5 digest of the MAC signing key + the entire SMB is taken;
The first 8 bytes of this are placed in the signature field.
@param data The data.
@param offset The starting offset at whi... | [
"Performs",
"MAC",
"signing",
"of",
"the",
"SMB",
".",
"This",
"is",
"done",
"as",
"follows",
".",
"The",
"signature",
"field",
"of",
"the",
"SMB",
"is",
"overwritted",
"with",
"the",
"sequence",
"number",
";",
"The",
"MD5",
"digest",
"of",
"the",
"MAC",... | ac6a8ba2925648ae003ca2508aec32316065dc34 | https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/smb1/SigningDigest.java#L125-L150 | train |
codelibs/jcifs | src/main/java/jcifs/smb1/Config.java | Config.setProperty | public static Object setProperty( String key, String value ) {
return prp.setProperty( key, value );
} | java | public static Object setProperty( String key, String value ) {
return prp.setProperty( key, value );
} | [
"public",
"static",
"Object",
"setProperty",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"return",
"prp",
".",
"setProperty",
"(",
"key",
",",
"value",
")",
";",
"}"
] | Add a property. | [
"Add",
"a",
"property",
"."
] | ac6a8ba2925648ae003ca2508aec32316065dc34 | https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/Config.java#L187-L189 | train |
codelibs/jcifs | src/main/java/jcifs/smb1/netbios/NbtAddress.java | NbtAddress.getAllByAddress | public static NbtAddress[] getAllByAddress( NbtAddress addr )
throws UnknownHostException {
try {
NbtAddress[] addrs = CLIENT.getNodeStatus( addr );
cacheAddressArray( addrs );
return addrs;
} catch( UnknownHostException... | java | public static NbtAddress[] getAllByAddress( NbtAddress addr )
throws UnknownHostException {
try {
NbtAddress[] addrs = CLIENT.getNodeStatus( addr );
cacheAddressArray( addrs );
return addrs;
} catch( UnknownHostException... | [
"public",
"static",
"NbtAddress",
"[",
"]",
"getAllByAddress",
"(",
"NbtAddress",
"addr",
")",
"throws",
"UnknownHostException",
"{",
"try",
"{",
"NbtAddress",
"[",
"]",
"addrs",
"=",
"CLIENT",
".",
"getNodeStatus",
"(",
"addr",
")",
";",
"cacheAddressArray",
... | Retrieve all addresses of a host by it's address. NetBIOS hosts can
have many names for a given IP address. The name and IP address make the
NetBIOS address. This provides a way to retrieve the other names for a
host with the same IP address.
@param addr the address to query
@throws UnknownHostException if address can... | [
"Retrieve",
"all",
"addresses",
"of",
"a",
"host",
"by",
"it",
"s",
"address",
".",
"NetBIOS",
"hosts",
"can",
"have",
"many",
"names",
"for",
"a",
"given",
"IP",
"address",
".",
"The",
"name",
"and",
"IP",
"address",
"make",
"the",
"NetBIOS",
"address",... | ac6a8ba2925648ae003ca2508aec32316065dc34 | https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/netbios/NbtAddress.java#L517-L531 | train |
codelibs/jcifs | src/main/java/jcifs/smb1/UniAddress.java | UniAddress.getHostName | public String getHostName() {
if( addr instanceof NbtAddress ) {
return ((NbtAddress)addr).getHostName();
}
return ((InetAddress)addr).getHostName();
} | java | public String getHostName() {
if( addr instanceof NbtAddress ) {
return ((NbtAddress)addr).getHostName();
}
return ((InetAddress)addr).getHostName();
} | [
"public",
"String",
"getHostName",
"(",
")",
"{",
"if",
"(",
"addr",
"instanceof",
"NbtAddress",
")",
"{",
"return",
"(",
"(",
"NbtAddress",
")",
"addr",
")",
".",
"getHostName",
"(",
")",
";",
"}",
"return",
"(",
"(",
"InetAddress",
")",
"addr",
")",
... | Return the hostname of this address such as "MYCOMPUTER". | [
"Return",
"the",
"hostname",
"of",
"this",
"address",
"such",
"as",
"MYCOMPUTER",
"."
] | ac6a8ba2925648ae003ca2508aec32316065dc34 | https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/UniAddress.java#L445-L450 | train |
codelibs/jcifs | src/main/java/jcifs/smb1/UniAddress.java | UniAddress.getHostAddress | public String getHostAddress() {
if( addr instanceof NbtAddress ) {
return ((NbtAddress)addr).getHostAddress();
}
return ((InetAddress)addr).getHostAddress();
} | java | public String getHostAddress() {
if( addr instanceof NbtAddress ) {
return ((NbtAddress)addr).getHostAddress();
}
return ((InetAddress)addr).getHostAddress();
} | [
"public",
"String",
"getHostAddress",
"(",
")",
"{",
"if",
"(",
"addr",
"instanceof",
"NbtAddress",
")",
"{",
"return",
"(",
"(",
"NbtAddress",
")",
"addr",
")",
".",
"getHostAddress",
"(",
")",
";",
"}",
"return",
"(",
"(",
"InetAddress",
")",
"addr",
... | Return the IP address as text such as "192.168.1.15". | [
"Return",
"the",
"IP",
"address",
"as",
"text",
"such",
"as",
"192",
".",
"168",
".",
"1",
".",
"15",
"."
] | ac6a8ba2925648ae003ca2508aec32316065dc34 | https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/UniAddress.java#L456-L461 | train |
codelibs/jcifs | src/main/java/jcifs/smb1/smb1/SmbFile.java | SmbFile.getUncPath | public String getUncPath() {
getUncPath0();
if( share == null ) {
return "\\\\" + url.getHost();
}
return "\\\\" + url.getHost() + canon.replace( '/', '\\' );
} | java | public String getUncPath() {
getUncPath0();
if( share == null ) {
return "\\\\" + url.getHost();
}
return "\\\\" + url.getHost() + canon.replace( '/', '\\' );
} | [
"public",
"String",
"getUncPath",
"(",
")",
"{",
"getUncPath0",
"(",
")",
";",
"if",
"(",
"share",
"==",
"null",
")",
"{",
"return",
"\"\\\\\\\\\"",
"+",
"url",
".",
"getHost",
"(",
")",
";",
"}",
"return",
"\"\\\\\\\\\"",
"+",
"url",
".",
"getHost",
... | Retuns the Windows UNC style path with backslashs intead of forward slashes.
@return The UNC path. | [
"Retuns",
"the",
"Windows",
"UNC",
"style",
"path",
"with",
"backslashs",
"intead",
"of",
"forward",
"slashes",
"."
] | ac6a8ba2925648ae003ca2508aec32316065dc34 | https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/smb1/SmbFile.java#L1213-L1219 | train |
codelibs/jcifs | src/main/java/jcifs/smb1/smb1/SmbFile.java | SmbFile.createNewFile | public void createNewFile() throws SmbException {
if( getUncPath0().length() == 1 ) {
throw new SmbException( "Invalid operation for workgroups, servers, or shares" );
}
close( open0( O_RDWR | O_CREAT | O_EXCL, 0, ATTR_NORMAL, 0 ), 0L );
} | java | public void createNewFile() throws SmbException {
if( getUncPath0().length() == 1 ) {
throw new SmbException( "Invalid operation for workgroups, servers, or shares" );
}
close( open0( O_RDWR | O_CREAT | O_EXCL, 0, ATTR_NORMAL, 0 ), 0L );
} | [
"public",
"void",
"createNewFile",
"(",
")",
"throws",
"SmbException",
"{",
"if",
"(",
"getUncPath0",
"(",
")",
".",
"length",
"(",
")",
"==",
"1",
")",
"{",
"throw",
"new",
"SmbException",
"(",
"\"Invalid operation for workgroups, servers, or shares\"",
")",
";... | Create a new file but fail if it already exists. The check for
existance of the file and it's creation are an atomic operation with
respect to other filesystem activities. | [
"Create",
"a",
"new",
"file",
"but",
"fail",
"if",
"it",
"already",
"exists",
".",
"The",
"check",
"for",
"existance",
"of",
"the",
"file",
"and",
"it",
"s",
"creation",
"are",
"an",
"atomic",
"operation",
"with",
"respect",
"to",
"other",
"filesystem",
... | ac6a8ba2925648ae003ca2508aec32316065dc34 | https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/smb1/SmbFile.java#L2567-L2572 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/json/JsonReport.java | JsonReport.getProjectName | private String getProjectName() {
String pName = Strings.emptyToNull(projectName);
if (pName == null) {
pName = Strings.emptyToNull(junit4.getProject().getName());
}
if (pName == null) {
pName = "(unnamed project)";
}
return pName;
} | java | private String getProjectName() {
String pName = Strings.emptyToNull(projectName);
if (pName == null) {
pName = Strings.emptyToNull(junit4.getProject().getName());
}
if (pName == null) {
pName = "(unnamed project)";
}
return pName;
} | [
"private",
"String",
"getProjectName",
"(",
")",
"{",
"String",
"pName",
"=",
"Strings",
".",
"emptyToNull",
"(",
"projectName",
")",
";",
"if",
"(",
"pName",
"==",
"null",
")",
"{",
"pName",
"=",
"Strings",
".",
"emptyToNull",
"(",
"junit4",
".",
"getPr... | Return the project name or the default project name. | [
"Return",
"the",
"project",
"name",
"or",
"the",
"default",
"project",
"name",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/json/JsonReport.java#L184-L193 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/json/JsonReport.java | JsonReport.onSuiteResult | @Subscribe
@SuppressForbidden("legitimate printStackTrace().")
public void onSuiteResult(AggregatedSuiteResultEvent e) {
try {
if (jsonWriter == null)
return;
slaves.put(e.getSlave().id, e.getSlave());
e.serialize(jsonWriter, outputStreams);
} catch (Exception ex) {
ex.print... | java | @Subscribe
@SuppressForbidden("legitimate printStackTrace().")
public void onSuiteResult(AggregatedSuiteResultEvent e) {
try {
if (jsonWriter == null)
return;
slaves.put(e.getSlave().id, e.getSlave());
e.serialize(jsonWriter, outputStreams);
} catch (Exception ex) {
ex.print... | [
"@",
"Subscribe",
"@",
"SuppressForbidden",
"(",
"\"legitimate printStackTrace().\"",
")",
"public",
"void",
"onSuiteResult",
"(",
"AggregatedSuiteResultEvent",
"e",
")",
"{",
"try",
"{",
"if",
"(",
"jsonWriter",
"==",
"null",
")",
"return",
";",
"slaves",
".",
... | Emit information about a single suite and all of its tests. | [
"Emit",
"information",
"about",
"a",
"single",
"suite",
"and",
"all",
"of",
"its",
"tests",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/json/JsonReport.java#L198-L221 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/json/JsonReport.java | JsonReport.onQuit | @Subscribe
public void onQuit(AggregatedQuitEvent e) {
if (jsonWriter == null)
return;
try {
jsonWriter.endArray();
jsonWriter.name("slaves");
jsonWriter.beginObject();
for (Map.Entry<Integer, ForkedJvmInfo> entry : slaves.entrySet()) {
jsonWriter.name(Integer.toString(... | java | @Subscribe
public void onQuit(AggregatedQuitEvent e) {
if (jsonWriter == null)
return;
try {
jsonWriter.endArray();
jsonWriter.name("slaves");
jsonWriter.beginObject();
for (Map.Entry<Integer, ForkedJvmInfo> entry : slaves.entrySet()) {
jsonWriter.name(Integer.toString(... | [
"@",
"Subscribe",
"public",
"void",
"onQuit",
"(",
"AggregatedQuitEvent",
"e",
")",
"{",
"if",
"(",
"jsonWriter",
"==",
"null",
")",
"return",
";",
"try",
"{",
"jsonWriter",
".",
"endArray",
"(",
")",
";",
"jsonWriter",
".",
"name",
"(",
"\"slaves\"",
")... | All tests completed. | [
"All",
"tests",
"completed",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/json/JsonReport.java#L226-L259 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/JUnit4.java | JUnit4.setSeed | public void setSeed(String randomSeed) {
if (!Strings.isNullOrEmpty(getProject().getUserProperty(SYSPROP_RANDOM_SEED()))) {
String userProperty = getProject().getUserProperty(SYSPROP_RANDOM_SEED());
if (!userProperty.equals(randomSeed)) {
log("Ignoring seed attribute because it is overridden by ... | java | public void setSeed(String randomSeed) {
if (!Strings.isNullOrEmpty(getProject().getUserProperty(SYSPROP_RANDOM_SEED()))) {
String userProperty = getProject().getUserProperty(SYSPROP_RANDOM_SEED());
if (!userProperty.equals(randomSeed)) {
log("Ignoring seed attribute because it is overridden by ... | [
"public",
"void",
"setSeed",
"(",
"String",
"randomSeed",
")",
"{",
"if",
"(",
"!",
"Strings",
".",
"isNullOrEmpty",
"(",
"getProject",
"(",
")",
".",
"getUserProperty",
"(",
"SYSPROP_RANDOM_SEED",
"(",
")",
")",
")",
")",
"{",
"String",
"userProperty",
"=... | Initial random seed used for shuffling test suites and other sources
of pseudo-randomness. If not set, any random value is set.
<p>The seed's format is compatible with {@link RandomizedRunner} so that
seed can be fixed for suites and methods alike. | [
"Initial",
"random",
"seed",
"used",
"for",
"shuffling",
"test",
"suites",
"and",
"other",
"sources",
"of",
"pseudo",
"-",
"randomness",
".",
"If",
"not",
"set",
"any",
"random",
"value",
"is",
"set",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/JUnit4.java#L484-L493 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/JUnit4.java | JUnit4.setPrefix | public void setPrefix(String prefix) {
if (!Strings.isNullOrEmpty(getProject().getUserProperty(SYSPROP_PREFIX()))) {
log("Ignoring prefix attribute because it is overridden by user properties.", Project.MSG_WARN);
} else {
SysGlobals.initializeWith(prefix);
}
} | java | public void setPrefix(String prefix) {
if (!Strings.isNullOrEmpty(getProject().getUserProperty(SYSPROP_PREFIX()))) {
log("Ignoring prefix attribute because it is overridden by user properties.", Project.MSG_WARN);
} else {
SysGlobals.initializeWith(prefix);
}
} | [
"public",
"void",
"setPrefix",
"(",
"String",
"prefix",
")",
"{",
"if",
"(",
"!",
"Strings",
".",
"isNullOrEmpty",
"(",
"getProject",
"(",
")",
".",
"getUserProperty",
"(",
"SYSPROP_PREFIX",
"(",
")",
")",
")",
")",
"{",
"log",
"(",
"\"Ignoring prefix attr... | Initializes custom prefix for all junit4 properties. This must be consistent
across all junit4 invocations if done from the same classpath. Use only when REALLY needed. | [
"Initializes",
"custom",
"prefix",
"for",
"all",
"junit4",
"properties",
".",
"This",
"must",
"be",
"consistent",
"across",
"all",
"junit4",
"invocations",
"if",
"done",
"from",
"the",
"same",
"classpath",
".",
"Use",
"only",
"when",
"REALLY",
"needed",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/JUnit4.java#L499-L505 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/JUnit4.java | JUnit4.addFileSet | public void addFileSet(FileSet fs) {
add(fs);
if (fs.getProject() == null) {
fs.setProject(getProject());
}
} | java | public void addFileSet(FileSet fs) {
add(fs);
if (fs.getProject() == null) {
fs.setProject(getProject());
}
} | [
"public",
"void",
"addFileSet",
"(",
"FileSet",
"fs",
")",
"{",
"add",
"(",
"fs",
")",
";",
"if",
"(",
"fs",
".",
"getProject",
"(",
")",
"==",
"null",
")",
"{",
"fs",
".",
"setProject",
"(",
"getProject",
"(",
")",
")",
";",
"}",
"}"
] | Adds a set of tests based on pattern matching. | [
"Adds",
"a",
"set",
"of",
"tests",
"based",
"on",
"pattern",
"matching",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/JUnit4.java#L715-L720 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/JUnit4.java | JUnit4.addAssertions | public void addAssertions(Assertions asserts) {
if (getCommandline().getAssertions() != null) {
throw new BuildException("Only one assertion declaration is allowed");
}
getCommandline().setAssertions(asserts);
} | java | public void addAssertions(Assertions asserts) {
if (getCommandline().getAssertions() != null) {
throw new BuildException("Only one assertion declaration is allowed");
}
getCommandline().setAssertions(asserts);
} | [
"public",
"void",
"addAssertions",
"(",
"Assertions",
"asserts",
")",
"{",
"if",
"(",
"getCommandline",
"(",
")",
".",
"getAssertions",
"(",
")",
"!=",
"null",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"\"Only one assertion declaration is allowed\"",
")",
... | Add assertions to tests execution. | [
"Add",
"assertions",
"to",
"tests",
"execution",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/JUnit4.java#L746-L751 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/JUnit4.java | JUnit4.validateArguments | private void validateArguments() throws BuildException {
Path tempDir = getTempDir();
if (tempDir == null) {
throw new BuildException("Temporary directory cannot be null.");
}
if (Files.exists(tempDir)) {
if (!Files.isDirectory(tempDir)) {
throw new BuildException("Temporary di... | java | private void validateArguments() throws BuildException {
Path tempDir = getTempDir();
if (tempDir == null) {
throw new BuildException("Temporary directory cannot be null.");
}
if (Files.exists(tempDir)) {
if (!Files.isDirectory(tempDir)) {
throw new BuildException("Temporary di... | [
"private",
"void",
"validateArguments",
"(",
")",
"throws",
"BuildException",
"{",
"Path",
"tempDir",
"=",
"getTempDir",
"(",
")",
";",
"if",
"(",
"tempDir",
"==",
"null",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"\"Temporary directory cannot be null.\"",
... | Validate arguments. | [
"Validate",
"arguments",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/JUnit4.java#L1134-L1152 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/JUnit4.java | JUnit4.validateJUnit4 | private void validateJUnit4() throws BuildException {
try {
Class<?> clazz = Class.forName("org.junit.runner.Description");
if (!Serializable.class.isAssignableFrom(clazz)) {
throw new BuildException("At least JUnit version 4.10 is required on junit4's taskdef classpath.");
}
} catch (... | java | private void validateJUnit4() throws BuildException {
try {
Class<?> clazz = Class.forName("org.junit.runner.Description");
if (!Serializable.class.isAssignableFrom(clazz)) {
throw new BuildException("At least JUnit version 4.10 is required on junit4's taskdef classpath.");
}
} catch (... | [
"private",
"void",
"validateJUnit4",
"(",
")",
"throws",
"BuildException",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"Class",
".",
"forName",
"(",
"\"org.junit.runner.Description\"",
")",
";",
"if",
"(",
"!",
"Serializable",
".",
"class",
".",
... | Validate JUnit4 presence in a concrete version. | [
"Validate",
"JUnit4",
"presence",
"in",
"a",
"concrete",
"version",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/JUnit4.java#L1157-L1166 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/JUnit4.java | JUnit4.resolveFiles | private org.apache.tools.ant.types.Path resolveFiles(org.apache.tools.ant.types.Path path) {
org.apache.tools.ant.types.Path cloned = new org.apache.tools.ant.types.Path(getProject());
for (String location : path.list()) {
cloned.createPathElement().setLocation(new File(location));
}
return cloned... | java | private org.apache.tools.ant.types.Path resolveFiles(org.apache.tools.ant.types.Path path) {
org.apache.tools.ant.types.Path cloned = new org.apache.tools.ant.types.Path(getProject());
for (String location : path.list()) {
cloned.createPathElement().setLocation(new File(location));
}
return cloned... | [
"private",
"org",
".",
"apache",
".",
"tools",
".",
"ant",
".",
"types",
".",
"Path",
"resolveFiles",
"(",
"org",
".",
"apache",
".",
"tools",
".",
"ant",
".",
"types",
".",
"Path",
"path",
")",
"{",
"org",
".",
"apache",
".",
"tools",
".",
"ant",
... | Resolve all files from a given path and simplify its definition. | [
"Resolve",
"all",
"files",
"from",
"a",
"given",
"path",
"and",
"simplify",
"its",
"definition",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/JUnit4.java#L1334-L1340 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/JUnit4.java | JUnit4.determineForkedJvmCount | private int determineForkedJvmCount(TestsCollection testCollection) {
int cores = Runtime.getRuntime().availableProcessors();
int jvmCount;
if (this.parallelism.equals(PARALLELISM_AUTO)) {
if (cores >= 8) {
// Maximum parallel jvms is 4, conserve some memory and memory bandwidth.
jvmCo... | java | private int determineForkedJvmCount(TestsCollection testCollection) {
int cores = Runtime.getRuntime().availableProcessors();
int jvmCount;
if (this.parallelism.equals(PARALLELISM_AUTO)) {
if (cores >= 8) {
// Maximum parallel jvms is 4, conserve some memory and memory bandwidth.
jvmCo... | [
"private",
"int",
"determineForkedJvmCount",
"(",
"TestsCollection",
"testCollection",
")",
"{",
"int",
"cores",
"=",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"availableProcessors",
"(",
")",
";",
"int",
"jvmCount",
";",
"if",
"(",
"this",
".",
"parallelis... | Determine how many forked JVMs to use. | [
"Determine",
"how",
"many",
"forked",
"JVMs",
"to",
"use",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/JUnit4.java#L1345-L1378 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/JUnit4.java | JUnit4.escapeAndJoin | private String escapeAndJoin(String[] commandline) {
// TODO: we should try to escape special characters here, depending on the OS.
StringBuilder b = new StringBuilder();
Pattern specials = Pattern.compile("[\\ ]");
for (String arg : commandline) {
if (b.length() > 0) {
b.append(" ");
... | java | private String escapeAndJoin(String[] commandline) {
// TODO: we should try to escape special characters here, depending on the OS.
StringBuilder b = new StringBuilder();
Pattern specials = Pattern.compile("[\\ ]");
for (String arg : commandline) {
if (b.length() > 0) {
b.append(" ");
... | [
"private",
"String",
"escapeAndJoin",
"(",
"String",
"[",
"]",
"commandline",
")",
"{",
"// TODO: we should try to escape special characters here, depending on the OS.",
"StringBuilder",
"b",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"Pattern",
"specials",
"=",
"Pattern... | Try to provide an escaped, ready-to-use shell line to repeat a given command line. | [
"Try",
"to",
"provide",
"an",
"escaped",
"ready",
"-",
"to",
"-",
"use",
"shell",
"line",
"to",
"repeat",
"a",
"given",
"command",
"line",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/JUnit4.java#L1617-L1633 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/JUnit4.java | JUnit4.forkProcess | @SuppressForbidden("legitimate sysstreams.")
private Execute forkProcess(ForkedJvmInfo slaveInfo, EventBus eventBus,
CommandlineJava commandline,
TailInputStream eventStream, OutputStream sysout, OutputStream syserr, RandomAccessFile streamsBuffer) {
try {
String tempDir = commandline.getSyste... | java | @SuppressForbidden("legitimate sysstreams.")
private Execute forkProcess(ForkedJvmInfo slaveInfo, EventBus eventBus,
CommandlineJava commandline,
TailInputStream eventStream, OutputStream sysout, OutputStream syserr, RandomAccessFile streamsBuffer) {
try {
String tempDir = commandline.getSyste... | [
"@",
"SuppressForbidden",
"(",
"\"legitimate sysstreams.\"",
")",
"private",
"Execute",
"forkProcess",
"(",
"ForkedJvmInfo",
"slaveInfo",
",",
"EventBus",
"eventBus",
",",
"CommandlineJava",
"commandline",
",",
"TailInputStream",
"eventStream",
",",
"OutputStream",
"sysou... | Execute a slave process. Pump events to the given event bus. | [
"Execute",
"a",
"slave",
"process",
".",
"Pump",
"events",
"to",
"the",
"given",
"event",
"bus",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/JUnit4.java#L1638-L1699 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/JUnit4.java | JUnit4.getTempDir | private Path getTempDir() {
if (this.tempDir == null) {
if (this.dir != null) {
this.tempDir = dir;
} else {
this.tempDir = getProject().getBaseDir().toPath();
}
}
return tempDir;
} | java | private Path getTempDir() {
if (this.tempDir == null) {
if (this.dir != null) {
this.tempDir = dir;
} else {
this.tempDir = getProject().getBaseDir().toPath();
}
}
return tempDir;
} | [
"private",
"Path",
"getTempDir",
"(",
")",
"{",
"if",
"(",
"this",
".",
"tempDir",
"==",
"null",
")",
"{",
"if",
"(",
"this",
".",
"dir",
"!=",
"null",
")",
"{",
"this",
".",
"tempDir",
"=",
"dir",
";",
"}",
"else",
"{",
"this",
".",
"tempDir",
... | Resolve temporary folder. | [
"Resolve",
"temporary",
"folder",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/JUnit4.java#L1774-L1783 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/JUnit4.java | JUnit4.addSlaveClasspath | private org.apache.tools.ant.types.Path addSlaveClasspath() {
org.apache.tools.ant.types.Path path = new org.apache.tools.ant.types.Path(getProject());
String [] REQUIRED_SLAVE_CLASSES = {
SlaveMain.class.getName(),
Strings.class.getName(),
MethodGlobFilter.class.getName(),
TeeO... | java | private org.apache.tools.ant.types.Path addSlaveClasspath() {
org.apache.tools.ant.types.Path path = new org.apache.tools.ant.types.Path(getProject());
String [] REQUIRED_SLAVE_CLASSES = {
SlaveMain.class.getName(),
Strings.class.getName(),
MethodGlobFilter.class.getName(),
TeeO... | [
"private",
"org",
".",
"apache",
".",
"tools",
".",
"ant",
".",
"types",
".",
"Path",
"addSlaveClasspath",
"(",
")",
"{",
"org",
".",
"apache",
".",
"tools",
".",
"ant",
".",
"types",
".",
"Path",
"path",
"=",
"new",
"org",
".",
"apache",
".",
"too... | Adds a classpath source which contains the given resource.
TODO: [GH-213] this is extremely ugly; separate the code required to run on the
forked JVM into an isolated bundle and either create it on-demand (in temp.
files location?) or locate it in classpath somehow (in a portable way). | [
"Adds",
"a",
"classpath",
"source",
"which",
"contains",
"the",
"given",
"resource",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/JUnit4.java#L1891-L1911 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/PickFromListTask.java | PickFromListTask.validate | private void validate() {
if (Strings.emptyToNull(random) == null) {
random = Strings.emptyToNull(getProject().getProperty(SYSPROP_RANDOM_SEED()));
}
if (random == null) {
throw new BuildException("Required attribute 'seed' must not be empty. Look at <junit4:pickseed>.");
}
lo... | java | private void validate() {
if (Strings.emptyToNull(random) == null) {
random = Strings.emptyToNull(getProject().getProperty(SYSPROP_RANDOM_SEED()));
}
if (random == null) {
throw new BuildException("Required attribute 'seed' must not be empty. Look at <junit4:pickseed>.");
}
lo... | [
"private",
"void",
"validate",
"(",
")",
"{",
"if",
"(",
"Strings",
".",
"emptyToNull",
"(",
"random",
")",
"==",
"null",
")",
"{",
"random",
"=",
"Strings",
".",
"emptyToNull",
"(",
"getProject",
"(",
")",
".",
"getProperty",
"(",
"SYSPROP_RANDOM_SEED",
... | Validate arguments and state. | [
"Validate",
"arguments",
"and",
"state",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/PickFromListTask.java#L115-L132 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/balancers/TopHints.java | TopHints.add | public void add(ResourceCollection rc) {
if (rc instanceof FileSet) {
FileSet fs = (FileSet) rc;
fs.setProject(getProject());
}
resources.add(rc);
} | java | public void add(ResourceCollection rc) {
if (rc instanceof FileSet) {
FileSet fs = (FileSet) rc;
fs.setProject(getProject());
}
resources.add(rc);
} | [
"public",
"void",
"add",
"(",
"ResourceCollection",
"rc",
")",
"{",
"if",
"(",
"rc",
"instanceof",
"FileSet",
")",
"{",
"FileSet",
"fs",
"=",
"(",
"FileSet",
")",
"rc",
";",
"fs",
".",
"setProject",
"(",
"getProject",
"(",
")",
")",
";",
"}",
"resour... | Adds a resource collection with execution hints. | [
"Adds",
"a",
"resource",
"collection",
"with",
"execution",
"hints",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/balancers/TopHints.java#L61-L67 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/slave/SlaveMainSafe.java | SlaveMainSafe.verifyJUnit4Present | private static void verifyJUnit4Present() {
try {
Class<?> clazz = Class.forName("org.junit.runner.Description");
if (!Serializable.class.isAssignableFrom(clazz)) {
JvmExit.halt(SlaveMain.ERR_OLD_JUNIT);
}
} catch (ClassNotFoundException e) {
JvmExit.halt(SlaveMain.ERR_NO_JUNIT);... | java | private static void verifyJUnit4Present() {
try {
Class<?> clazz = Class.forName("org.junit.runner.Description");
if (!Serializable.class.isAssignableFrom(clazz)) {
JvmExit.halt(SlaveMain.ERR_OLD_JUNIT);
}
} catch (ClassNotFoundException e) {
JvmExit.halt(SlaveMain.ERR_NO_JUNIT);... | [
"private",
"static",
"void",
"verifyJUnit4Present",
"(",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"Class",
".",
"forName",
"(",
"\"org.junit.runner.Description\"",
")",
";",
"if",
"(",
"!",
"Serializable",
".",
"class",
".",
"isAssignableF... | Verify JUnit presence and version. | [
"Verify",
"JUnit",
"presence",
"and",
"version",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/slave/SlaveMainSafe.java#L29-L38 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/TextReport.java | TextReport.setShowOutput | public void setShowOutput(String mode) {
try {
this.outputMode = OutputMode.valueOf(mode.toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("showOutput accepts any of: "
+ Arrays.toString(OutputMode.values()) + ", value is not valid: " + mo... | java | public void setShowOutput(String mode) {
try {
this.outputMode = OutputMode.valueOf(mode.toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("showOutput accepts any of: "
+ Arrays.toString(OutputMode.values()) + ", value is not valid: " + mo... | [
"public",
"void",
"setShowOutput",
"(",
"String",
"mode",
")",
"{",
"try",
"{",
"this",
".",
"outputMode",
"=",
"OutputMode",
".",
"valueOf",
"(",
"mode",
".",
"toUpperCase",
"(",
"Locale",
".",
"ROOT",
")",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentE... | Display mode for output streams. | [
"Display",
"mode",
"for",
"output",
"streams",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/TextReport.java#L271-L278 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/TextReport.java | TextReport.flushOutput | private void flushOutput() throws IOException {
outStream.flush();
outWriter.completeLine();
errStream.flush();
errWriter.completeLine();
} | java | private void flushOutput() throws IOException {
outStream.flush();
outWriter.completeLine();
errStream.flush();
errWriter.completeLine();
} | [
"private",
"void",
"flushOutput",
"(",
")",
"throws",
"IOException",
"{",
"outStream",
".",
"flush",
"(",
")",
";",
"outWriter",
".",
"completeLine",
"(",
")",
";",
"errStream",
".",
"flush",
"(",
")",
";",
"errWriter",
".",
"completeLine",
"(",
")",
";"... | Flush output streams. | [
"Flush",
"output",
"streams",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/TextReport.java#L543-L548 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/TextReport.java | TextReport.emitSuiteStart | private void emitSuiteStart(Description description, long startTimestamp) throws IOException {
String suiteName = description.getDisplayName();
if (useSimpleNames) {
if (suiteName.lastIndexOf('.') >= 0) {
suiteName = suiteName.substring(suiteName.lastIndexOf('.') + 1);
}
}
logShort(s... | java | private void emitSuiteStart(Description description, long startTimestamp) throws IOException {
String suiteName = description.getDisplayName();
if (useSimpleNames) {
if (suiteName.lastIndexOf('.') >= 0) {
suiteName = suiteName.substring(suiteName.lastIndexOf('.') + 1);
}
}
logShort(s... | [
"private",
"void",
"emitSuiteStart",
"(",
"Description",
"description",
",",
"long",
"startTimestamp",
")",
"throws",
"IOException",
"{",
"String",
"suiteName",
"=",
"description",
".",
"getDisplayName",
"(",
")",
";",
"if",
"(",
"useSimpleNames",
")",
"{",
"if"... | Suite prologue. | [
"Suite",
"prologue",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/TextReport.java#L553-L563 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/TextReport.java | TextReport.emitSuiteEnd | private void emitSuiteEnd(AggregatedSuiteResultEvent e, int suitesCompleted) throws IOException {
assert showSuiteSummary;
final StringBuilder b = new StringBuilder();
final int totalErrors = this.totalErrors.addAndGet(e.isSuccessful() ? 0 : 1);
b.append(String.format(Locale.ROOT, "%sCompleted [%d/%d%s... | java | private void emitSuiteEnd(AggregatedSuiteResultEvent e, int suitesCompleted) throws IOException {
assert showSuiteSummary;
final StringBuilder b = new StringBuilder();
final int totalErrors = this.totalErrors.addAndGet(e.isSuccessful() ? 0 : 1);
b.append(String.format(Locale.ROOT, "%sCompleted [%d/%d%s... | [
"private",
"void",
"emitSuiteEnd",
"(",
"AggregatedSuiteResultEvent",
"e",
",",
"int",
"suitesCompleted",
")",
"throws",
"IOException",
"{",
"assert",
"showSuiteSummary",
";",
"final",
"StringBuilder",
"b",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"final",
"int... | Suite end. | [
"Suite",
"end",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/TextReport.java#L568-L603 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/TextReport.java | TextReport.emitStatusLine | private void emitStatusLine(AggregatedResultEvent result, TestStatus status, long timeMillis) throws IOException {
final StringBuilder line = new StringBuilder();
line.append(shortTimestamp(result.getStartTimestamp()));
line.append(Strings.padEnd(statusNames.get(status), 8, ' '));
line.append(formatDur... | java | private void emitStatusLine(AggregatedResultEvent result, TestStatus status, long timeMillis) throws IOException {
final StringBuilder line = new StringBuilder();
line.append(shortTimestamp(result.getStartTimestamp()));
line.append(Strings.padEnd(statusNames.get(status), 8, ' '));
line.append(formatDur... | [
"private",
"void",
"emitStatusLine",
"(",
"AggregatedResultEvent",
"result",
",",
"TestStatus",
"status",
",",
"long",
"timeMillis",
")",
"throws",
"IOException",
"{",
"final",
"StringBuilder",
"line",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"line",
".",
"ap... | Emit status line for an aggregated event. | [
"Emit",
"status",
"line",
"for",
"an",
"aggregated",
"event",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/TextReport.java#L608-L662 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/TextReport.java | TextReport.logShort | private void logShort(CharSequence message, boolean trim) throws IOException {
int length = message.length();
if (trim) {
while (length > 0 && Character.isWhitespace(message.charAt(length - 1))) {
length--;
}
}
char [] chars = new char [length + 1];
for (int i = 0; i < length; i... | java | private void logShort(CharSequence message, boolean trim) throws IOException {
int length = message.length();
if (trim) {
while (length > 0 && Character.isWhitespace(message.charAt(length - 1))) {
length--;
}
}
char [] chars = new char [length + 1];
for (int i = 0; i < length; i... | [
"private",
"void",
"logShort",
"(",
"CharSequence",
"message",
",",
"boolean",
"trim",
")",
"throws",
"IOException",
"{",
"int",
"length",
"=",
"message",
".",
"length",
"(",
")",
";",
"if",
"(",
"trim",
")",
"{",
"while",
"(",
"length",
">",
"0",
"&&"... | Log a message line to the output. | [
"Log",
"a",
"message",
"line",
"to",
"the",
"output",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/TextReport.java#L677-L692 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/events/aggregated/AggregatedSuiteResultEvent.java | AggregatedSuiteResultEvent.getIgnoredCount | public int getIgnoredCount() {
int count = 0;
for (AggregatedTestResultEvent t : getTests()) {
if (t.getStatus() == TestStatus.IGNORED ||
t.getStatus() == TestStatus.IGNORED_ASSUMPTION) {
count++;
}
}
return count;
} | java | public int getIgnoredCount() {
int count = 0;
for (AggregatedTestResultEvent t : getTests()) {
if (t.getStatus() == TestStatus.IGNORED ||
t.getStatus() == TestStatus.IGNORED_ASSUMPTION) {
count++;
}
}
return count;
} | [
"public",
"int",
"getIgnoredCount",
"(",
")",
"{",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"AggregatedTestResultEvent",
"t",
":",
"getTests",
"(",
")",
")",
"{",
"if",
"(",
"t",
".",
"getStatus",
"(",
")",
"==",
"TestStatus",
".",
"IGNORED",
"||",
... | Return the number of ignored or assumption-ignored tests. | [
"Return",
"the",
"number",
"of",
"ignored",
"or",
"assumption",
"-",
"ignored",
"tests",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/events/aggregated/AggregatedSuiteResultEvent.java#L153-L162 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/antxml/AntXmlReport.java | AntXmlReport.onQuit | @Subscribe
public void onQuit(AggregatedQuitEvent e) {
if (summaryFile != null) {
try {
Persister persister = new Persister();
persister.write(new MavenFailsafeSummaryModel(summaryListener.getResult()), summaryFile);
} catch (Exception x) {
junit4.log("Could not serialize summa... | java | @Subscribe
public void onQuit(AggregatedQuitEvent e) {
if (summaryFile != null) {
try {
Persister persister = new Persister();
persister.write(new MavenFailsafeSummaryModel(summaryListener.getResult()), summaryFile);
} catch (Exception x) {
junit4.log("Could not serialize summa... | [
"@",
"Subscribe",
"public",
"void",
"onQuit",
"(",
"AggregatedQuitEvent",
"e",
")",
"{",
"if",
"(",
"summaryFile",
"!=",
"null",
")",
"{",
"try",
"{",
"Persister",
"persister",
"=",
"new",
"Persister",
"(",
")",
";",
"persister",
".",
"write",
"(",
"new"... | Write the summary file, if requested. | [
"Write",
"the",
"summary",
"file",
"if",
"requested",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/antxml/AntXmlReport.java#L136-L146 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/antxml/AntXmlReport.java | AntXmlReport.onSuiteResult | @Subscribe
public void onSuiteResult(AggregatedSuiteResultEvent e) {
// Calculate summaries.
summaryListener.suiteSummary(e);
Description suiteDescription = e.getDescription();
String displayName = suiteDescription.getDisplayName();
if (displayName.trim().isEmpty()) {
junit4.log("Could not ... | java | @Subscribe
public void onSuiteResult(AggregatedSuiteResultEvent e) {
// Calculate summaries.
summaryListener.suiteSummary(e);
Description suiteDescription = e.getDescription();
String displayName = suiteDescription.getDisplayName();
if (displayName.trim().isEmpty()) {
junit4.log("Could not ... | [
"@",
"Subscribe",
"public",
"void",
"onSuiteResult",
"(",
"AggregatedSuiteResultEvent",
"e",
")",
"{",
"// Calculate summaries.",
"summaryListener",
".",
"suiteSummary",
"(",
"e",
")",
";",
"Description",
"suiteDescription",
"=",
"e",
".",
"getDescription",
"(",
")"... | Emit information about all of suite's tests. | [
"Emit",
"information",
"about",
"all",
"of",
"suite",
"s",
"tests",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/antxml/AntXmlReport.java#L151-L187 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/antxml/AntXmlReport.java | AntXmlReport.buildModel | private TestSuiteModel buildModel(AggregatedSuiteResultEvent e) throws IOException {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ROOT);
TestSuiteModel suite = new TestSuiteModel();
suite.hostname = "nohost.nodomain";
suite.name = e.getDescription().getDisplayName();
s... | java | private TestSuiteModel buildModel(AggregatedSuiteResultEvent e) throws IOException {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ROOT);
TestSuiteModel suite = new TestSuiteModel();
suite.hostname = "nohost.nodomain";
suite.name = e.getDescription().getDisplayName();
s... | [
"private",
"TestSuiteModel",
"buildModel",
"(",
"AggregatedSuiteResultEvent",
"e",
")",
"throws",
"IOException",
"{",
"SimpleDateFormat",
"df",
"=",
"new",
"SimpleDateFormat",
"(",
"\"yyyy-MM-dd'T'HH:mm:ss\"",
",",
"Locale",
".",
"ROOT",
")",
";",
"TestSuiteModel",
"s... | Build data model for serialization. | [
"Build",
"data",
"model",
"for",
"serialization",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/antxml/AntXmlReport.java#L192-L242 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/antxml/AntXmlReport.java | AntXmlReport.applyFilters | private String applyFilters(String methodName) {
if (filters.isEmpty()) {
return methodName;
}
Reader in = new StringReader(methodName);
for (TokenFilter tf : filters) {
in = tf.chain(in);
}
try {
return CharStreams.toString(in);
} catch (IOException e) {
junit4.log... | java | private String applyFilters(String methodName) {
if (filters.isEmpty()) {
return methodName;
}
Reader in = new StringReader(methodName);
for (TokenFilter tf : filters) {
in = tf.chain(in);
}
try {
return CharStreams.toString(in);
} catch (IOException e) {
junit4.log... | [
"private",
"String",
"applyFilters",
"(",
"String",
"methodName",
")",
"{",
"if",
"(",
"filters",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"methodName",
";",
"}",
"Reader",
"in",
"=",
"new",
"StringReader",
"(",
"methodName",
")",
";",
"for",
"(",
... | Apply filters to a method name.
@param methodName | [
"Apply",
"filters",
"to",
"a",
"method",
"name",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/antxml/AntXmlReport.java#L285-L302 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/LocalSlaveStreamHandler.java | LocalSlaveStreamHandler.pumpEvents | void pumpEvents(InputStream eventStream) {
try {
Deserializer deserializer = new Deserializer(eventStream, refLoader);
IEvent event = null;
while ((event = deserializer.deserialize()) != null) {
switch (event.getType()) {
case APPEND_STDERR:
case APPEND_STDOUT:
... | java | void pumpEvents(InputStream eventStream) {
try {
Deserializer deserializer = new Deserializer(eventStream, refLoader);
IEvent event = null;
while ((event = deserializer.deserialize()) != null) {
switch (event.getType()) {
case APPEND_STDERR:
case APPEND_STDOUT:
... | [
"void",
"pumpEvents",
"(",
"InputStream",
"eventStream",
")",
"{",
"try",
"{",
"Deserializer",
"deserializer",
"=",
"new",
"Deserializer",
"(",
"eventStream",
",",
"refLoader",
")",
";",
"IEvent",
"event",
"=",
"null",
";",
"while",
"(",
"(",
"event",
"=",
... | Pump events from event stream. | [
"Pump",
"events",
"from",
"event",
"stream",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/LocalSlaveStreamHandler.java#L215-L274 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/ExecutionTimesReport.java | ExecutionTimesReport.onSuiteResult | @Subscribe
public void onSuiteResult(AggregatedSuiteResultEvent e) {
long millis = e.getExecutionTime();
String suiteName = e.getDescription().getDisplayName();
List<Long> values = hints.get(suiteName);
if (values == null) {
hints.put(suiteName, values = new ArrayList<>());
}
values... | java | @Subscribe
public void onSuiteResult(AggregatedSuiteResultEvent e) {
long millis = e.getExecutionTime();
String suiteName = e.getDescription().getDisplayName();
List<Long> values = hints.get(suiteName);
if (values == null) {
hints.put(suiteName, values = new ArrayList<>());
}
values... | [
"@",
"Subscribe",
"public",
"void",
"onSuiteResult",
"(",
"AggregatedSuiteResultEvent",
"e",
")",
"{",
"long",
"millis",
"=",
"e",
".",
"getExecutionTime",
"(",
")",
";",
"String",
"suiteName",
"=",
"e",
".",
"getDescription",
"(",
")",
".",
"getDisplayName",
... | Remember execution time for all executed suites. | [
"Remember",
"execution",
"time",
"for",
"all",
"executed",
"suites",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/ExecutionTimesReport.java#L83-L95 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/ExecutionTimesReport.java | ExecutionTimesReport.onEnd | @Subscribe
public void onEnd(AggregatedQuitEvent e) {
try {
writeHints(hintsFile, hints);
} catch (IOException exception) {
outer.log("Could not write back the hints file.", exception, Project.MSG_ERR);
}
} | java | @Subscribe
public void onEnd(AggregatedQuitEvent e) {
try {
writeHints(hintsFile, hints);
} catch (IOException exception) {
outer.log("Could not write back the hints file.", exception, Project.MSG_ERR);
}
} | [
"@",
"Subscribe",
"public",
"void",
"onEnd",
"(",
"AggregatedQuitEvent",
"e",
")",
"{",
"try",
"{",
"writeHints",
"(",
"hintsFile",
",",
"hints",
")",
";",
"}",
"catch",
"(",
"IOException",
"exception",
")",
"{",
"outer",
".",
"log",
"(",
"\"Could not writ... | Write back to hints file. | [
"Write",
"back",
"to",
"hints",
"file",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/ExecutionTimesReport.java#L100-L107 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/ExecutionTimesReport.java | ExecutionTimesReport.readHints | public static Map<String,List<Long>> readHints(File hints) throws IOException {
Map<String,List<Long>> result = new HashMap<>();
InputStream is = new FileInputStream(hints);
mergeHints(is, result);
return result;
} | java | public static Map<String,List<Long>> readHints(File hints) throws IOException {
Map<String,List<Long>> result = new HashMap<>();
InputStream is = new FileInputStream(hints);
mergeHints(is, result);
return result;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"List",
"<",
"Long",
">",
">",
"readHints",
"(",
"File",
"hints",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
",",
"List",
"<",
"Long",
">",
">",
"result",
"=",
"new",
"HashMap",
"<>",
"(",
... | Read hints from a file. | [
"Read",
"hints",
"from",
"a",
"file",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/ExecutionTimesReport.java#L137-L142 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/ExecutionTimesReport.java | ExecutionTimesReport.mergeHints | public static void mergeHints(InputStream is, Map<String,List<Long>> hints) throws IOException {
final BufferedReader reader = new BufferedReader(
new InputStreamReader(is, Charsets.UTF_8));
String line;
while ((line = reader.readLine()) != null) {
line = line.trim();
if (line.isEmp... | java | public static void mergeHints(InputStream is, Map<String,List<Long>> hints) throws IOException {
final BufferedReader reader = new BufferedReader(
new InputStreamReader(is, Charsets.UTF_8));
String line;
while ((line = reader.readLine()) != null) {
line = line.trim();
if (line.isEmp... | [
"public",
"static",
"void",
"mergeHints",
"(",
"InputStream",
"is",
",",
"Map",
"<",
"String",
",",
"List",
"<",
"Long",
">",
">",
"hints",
")",
"throws",
"IOException",
"{",
"final",
"BufferedReader",
"reader",
"=",
"new",
"BufferedReader",
"(",
"new",
"I... | Read hints from a file and merge with the given hints map. | [
"Read",
"hints",
"from",
"a",
"file",
"and",
"merge",
"with",
"the",
"given",
"hints",
"map",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/ExecutionTimesReport.java#L147-L171 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/ExecutionTimesReport.java | ExecutionTimesReport.writeHints | public static void writeHints(File file, Map<String,List<Long>> hints) throws IOException {
Closer closer = Closer.create();
try {
BufferedWriter w = closer.register(Files.newWriter(file, Charsets.UTF_8));
if (!(hints instanceof SortedMap)) {
hints = new TreeMap<String,List<Long>>(hints);
... | java | public static void writeHints(File file, Map<String,List<Long>> hints) throws IOException {
Closer closer = Closer.create();
try {
BufferedWriter w = closer.register(Files.newWriter(file, Charsets.UTF_8));
if (!(hints instanceof SortedMap)) {
hints = new TreeMap<String,List<Long>>(hints);
... | [
"public",
"static",
"void",
"writeHints",
"(",
"File",
"file",
",",
"Map",
"<",
"String",
",",
"List",
"<",
"Long",
">",
">",
"hints",
")",
"throws",
"IOException",
"{",
"Closer",
"closer",
"=",
"Closer",
".",
"create",
"(",
")",
";",
"try",
"{",
"Bu... | Writes back hints file. | [
"Writes",
"back",
"hints",
"file",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/listeners/ExecutionTimesReport.java#L176-L196 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/slave/SlaveMain.java | SlaveMain.readArgsFile | private static String[] readArgsFile(String argsFile) throws IOException {
final ArrayList<String> lines = new ArrayList<String>();
final BufferedReader reader = new BufferedReader(
new InputStreamReader(
new FileInputStream(argsFile), "UTF-8"));
try {
String line;
while ((li... | java | private static String[] readArgsFile(String argsFile) throws IOException {
final ArrayList<String> lines = new ArrayList<String>();
final BufferedReader reader = new BufferedReader(
new InputStreamReader(
new FileInputStream(argsFile), "UTF-8"));
try {
String line;
while ((li... | [
"private",
"static",
"String",
"[",
"]",
"readArgsFile",
"(",
"String",
"argsFile",
")",
"throws",
"IOException",
"{",
"final",
"ArrayList",
"<",
"String",
">",
"lines",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"final",
"BufferedReader",
... | Read arguments from a file. Newline delimited, UTF-8 encoded. No fanciness to
avoid dependencies. | [
"Read",
"arguments",
"from",
"a",
"file",
".",
"Newline",
"delimited",
"UTF",
"-",
"8",
"encoded",
".",
"No",
"fanciness",
"to",
"avoid",
"dependencies",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/slave/SlaveMain.java#L448-L465 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/slave/SlaveMain.java | SlaveMain.redirectStreams | @SuppressForbidden("legitimate sysstreams.")
private static void redirectStreams(final Serializer serializer, final boolean flushFrequently) {
final PrintStream origSysOut = System.out;
final PrintStream origSysErr = System.err;
// Set warnings stream to System.err.
warnings = System.err;
AccessC... | java | @SuppressForbidden("legitimate sysstreams.")
private static void redirectStreams(final Serializer serializer, final boolean flushFrequently) {
final PrintStream origSysOut = System.out;
final PrintStream origSysErr = System.err;
// Set warnings stream to System.err.
warnings = System.err;
AccessC... | [
"@",
"SuppressForbidden",
"(",
"\"legitimate sysstreams.\"",
")",
"private",
"static",
"void",
"redirectStreams",
"(",
"final",
"Serializer",
"serializer",
",",
"final",
"boolean",
"flushFrequently",
")",
"{",
"final",
"PrintStream",
"origSysOut",
"=",
"System",
".",
... | Redirect standard streams so that the output can be passed to listeners. | [
"Redirect",
"standard",
"streams",
"so",
"that",
"the",
"output",
"can",
"be",
"passed",
"to",
"listeners",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/slave/SlaveMain.java#L470-L505 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/slave/SlaveMain.java | SlaveMain.warn | @SuppressForbidden("legitimate sysstreams.")
public static void warn(String message, Throwable t) {
PrintStream w = (warnings == null ? System.err : warnings);
try {
w.print("WARN: ");
w.print(message);
if (t != null) {
w.print(" -> ");
try {
t.printStackTrace(w);
... | java | @SuppressForbidden("legitimate sysstreams.")
public static void warn(String message, Throwable t) {
PrintStream w = (warnings == null ? System.err : warnings);
try {
w.print("WARN: ");
w.print(message);
if (t != null) {
w.print(" -> ");
try {
t.printStackTrace(w);
... | [
"@",
"SuppressForbidden",
"(",
"\"legitimate sysstreams.\"",
")",
"public",
"static",
"void",
"warn",
"(",
"String",
"message",
",",
"Throwable",
"t",
")",
"{",
"PrintStream",
"w",
"=",
"(",
"warnings",
"==",
"null",
"?",
"System",
".",
"err",
":",
"warnings... | Warning emitter. Uses whatever alternative non-event communication channel is. | [
"Warning",
"emitter",
".",
"Uses",
"whatever",
"alternative",
"non",
"-",
"event",
"communication",
"channel",
"is",
"."
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/slave/SlaveMain.java#L510-L537 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/slave/SlaveMain.java | SlaveMain.instantiateRunListeners | private ArrayList<RunListener> instantiateRunListeners() throws Exception {
ArrayList<RunListener> instances = new ArrayList<>();
if (runListeners != null) {
for (String className : Arrays.asList(runListeners.split(","))) {
instances.add((RunListener) this.instantiate(className).newInstance());
... | java | private ArrayList<RunListener> instantiateRunListeners() throws Exception {
ArrayList<RunListener> instances = new ArrayList<>();
if (runListeners != null) {
for (String className : Arrays.asList(runListeners.split(","))) {
instances.add((RunListener) this.instantiate(className).newInstance());
... | [
"private",
"ArrayList",
"<",
"RunListener",
">",
"instantiateRunListeners",
"(",
")",
"throws",
"Exception",
"{",
"ArrayList",
"<",
"RunListener",
">",
"instances",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"runListeners",
"!=",
"null",
")",
"... | Generates JUnit 4 RunListener instances for any user defined RunListeners | [
"Generates",
"JUnit",
"4",
"RunListener",
"instances",
"for",
"any",
"user",
"defined",
"RunListeners"
] | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/slave/SlaveMain.java#L542-L552 | train |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/balancers/ExecutionTimeBalancer.java | ExecutionTimeBalancer.assign | @Override
public List<Assignment> assign(Collection<String> suiteNames, int slaves, long seed) {
// Read hints first.
final Map<String,List<Long>> hints = ExecutionTimesReport.mergeHints(resources, suiteNames);
// Preprocess and sort costs. Take the median for each suite's measurements as the
// wei... | java | @Override
public List<Assignment> assign(Collection<String> suiteNames, int slaves, long seed) {
// Read hints first.
final Map<String,List<Long>> hints = ExecutionTimesReport.mergeHints(resources, suiteNames);
// Preprocess and sort costs. Take the median for each suite's measurements as the
// wei... | [
"@",
"Override",
"public",
"List",
"<",
"Assignment",
">",
"assign",
"(",
"Collection",
"<",
"String",
">",
"suiteNames",
",",
"int",
"slaves",
",",
"long",
"seed",
")",
"{",
"// Read hints first.",
"final",
"Map",
"<",
"String",
",",
"List",
"<",
"Long",
... | Assign based on execution time history. The algorithm is a greedy heuristic
assigning the longest remaining test to the slave with the
shortest-completion time so far. This is not optimal but fast and provides
a decent average assignment. | [
"Assign",
"based",
"on",
"execution",
"time",
"history",
".",
"The",
"algorithm",
"is",
"a",
"greedy",
"heuristic",
"assigning",
"the",
"longest",
"remaining",
"test",
"to",
"the",
"slave",
"with",
"the",
"shortest",
"-",
"completion",
"time",
"so",
"far",
"... | 85a0c7eff5d03d98da4d1f9502a11af74d26478a | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/balancers/ExecutionTimeBalancer.java#L76-L132 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/internal/views/PaginationToken.java | PaginationToken.mergeTokenAndQueryParameters | static <K, V> PageMetadata<K, V> mergeTokenAndQueryParameters(String paginationToken, final
ViewQueryParameters<K, V> initialParameters) {
// Decode the base64 token into JSON
String json = new String(Base64.decodeBase64(paginationToken), Charset.forName("UTF-8"));
// Get a suitable Gson, ... | java | static <K, V> PageMetadata<K, V> mergeTokenAndQueryParameters(String paginationToken, final
ViewQueryParameters<K, V> initialParameters) {
// Decode the base64 token into JSON
String json = new String(Base64.decodeBase64(paginationToken), Charset.forName("UTF-8"));
// Get a suitable Gson, ... | [
"static",
"<",
"K",
",",
"V",
">",
"PageMetadata",
"<",
"K",
",",
"V",
">",
"mergeTokenAndQueryParameters",
"(",
"String",
"paginationToken",
",",
"final",
"ViewQueryParameters",
"<",
"K",
",",
"V",
">",
"initialParameters",
")",
"{",
"// Decode the base64 token... | Generate a PageMetadata object for the page represented by the specified pagination token.
@param paginationToken opaque pagination token
@param initialParameters the initial view query parameters (i.e. for the page 1 request).
@param <K> the view key type
@param <V> the view value type
@... | [
"Generate",
"a",
"PageMetadata",
"object",
"for",
"the",
"page",
"represented",
"by",
"the",
"specified",
"pagination",
"token",
"."
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/internal/views/PaginationToken.java#L77-L102 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/internal/views/PaginationToken.java | PaginationToken.tokenize | static String tokenize(PageMetadata<?, ?> pageMetadata) {
try {
Gson g = getGsonWithKeyAdapter(pageMetadata.pageRequestParameters);
return new String(Base64.encodeBase64URLSafe(g.toJson(new PaginationToken
(pageMetadata)).getBytes("UTF-8")),
Charse... | java | static String tokenize(PageMetadata<?, ?> pageMetadata) {
try {
Gson g = getGsonWithKeyAdapter(pageMetadata.pageRequestParameters);
return new String(Base64.encodeBase64URLSafe(g.toJson(new PaginationToken
(pageMetadata)).getBytes("UTF-8")),
Charse... | [
"static",
"String",
"tokenize",
"(",
"PageMetadata",
"<",
"?",
",",
"?",
">",
"pageMetadata",
")",
"{",
"try",
"{",
"Gson",
"g",
"=",
"getGsonWithKeyAdapter",
"(",
"pageMetadata",
".",
"pageRequestParameters",
")",
";",
"return",
"new",
"String",
"(",
"Base6... | Generate an opaque pagination token from the supplied PageMetadata.
@param pageMetadata page metadata of the page for which the token should be generated
@return opaque pagination token | [
"Generate",
"an",
"opaque",
"pagination",
"token",
"from",
"the",
"supplied",
"PageMetadata",
"."
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/internal/views/PaginationToken.java#L110-L120 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/model/FindByIndexOptions.java | FindByIndexOptions.useIndex | public FindByIndexOptions useIndex(String designDocument, String indexName) {
assertNotNull(designDocument, "designDocument");
assertNotNull(indexName, "indexName");
JsonArray index = new JsonArray();
index.add(new JsonPrimitive(designDocument));
index.add(new JsonPrimitive(... | java | public FindByIndexOptions useIndex(String designDocument, String indexName) {
assertNotNull(designDocument, "designDocument");
assertNotNull(indexName, "indexName");
JsonArray index = new JsonArray();
index.add(new JsonPrimitive(designDocument));
index.add(new JsonPrimitive(... | [
"public",
"FindByIndexOptions",
"useIndex",
"(",
"String",
"designDocument",
",",
"String",
"indexName",
")",
"{",
"assertNotNull",
"(",
"designDocument",
",",
"\"designDocument\"",
")",
";",
"assertNotNull",
"(",
"indexName",
",",
"\"indexName\"",
")",
";",
"JsonAr... | Specify a specific index to run the query against
@param designDocument set the design document to use
@param indexName set the index name to use
@return this to set additional options | [
"Specify",
"a",
"specific",
"index",
"to",
"run",
"the",
"query",
"against"
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/model/FindByIndexOptions.java#L128-L136 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/internal/query/InternalIndex.java | InternalIndex.getPartialFilterSelector | @Override
public String getPartialFilterSelector() {
return (def.selector != null) ? def.selector.toString() : null;
} | java | @Override
public String getPartialFilterSelector() {
return (def.selector != null) ? def.selector.toString() : null;
} | [
"@",
"Override",
"public",
"String",
"getPartialFilterSelector",
"(",
")",
"{",
"return",
"(",
"def",
".",
"selector",
"!=",
"null",
")",
"?",
"def",
".",
"selector",
".",
"toString",
"(",
")",
":",
"null",
";",
"}"
] | Get the JSON string representation of the selector configured for this index.
@return selector JSON as string | [
"Get",
"the",
"JSON",
"string",
"representation",
"of",
"the",
"selector",
"configured",
"for",
"this",
"index",
"."
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/internal/query/InternalIndex.java#L74-L77 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/Replication.java | Replication.trigger | public com.cloudant.client.api.model.ReplicationResult trigger() {
ReplicationResult couchDbReplicationResult = replication.trigger();
com.cloudant.client.api.model.ReplicationResult replicationResult = new com.cloudant
.client.api.model.ReplicationResult(couchDbReplicationResult);
... | java | public com.cloudant.client.api.model.ReplicationResult trigger() {
ReplicationResult couchDbReplicationResult = replication.trigger();
com.cloudant.client.api.model.ReplicationResult replicationResult = new com.cloudant
.client.api.model.ReplicationResult(couchDbReplicationResult);
... | [
"public",
"com",
".",
"cloudant",
".",
"client",
".",
"api",
".",
"model",
".",
"ReplicationResult",
"trigger",
"(",
")",
"{",
"ReplicationResult",
"couchDbReplicationResult",
"=",
"replication",
".",
"trigger",
"(",
")",
";",
"com",
".",
"cloudant",
".",
"c... | Triggers a replication request, blocks while the replication is in progress.
@return ReplicationResult encapsulating the result | [
"Triggers",
"a",
"replication",
"request",
"blocks",
"while",
"the",
"replication",
"is",
"in",
"progress",
"."
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Replication.java#L58-L63 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/Replication.java | Replication.queryParams | public Replication queryParams(Map<String, Object> queryParams) {
this.replication = replication.queryParams(queryParams);
return this;
} | java | public Replication queryParams(Map<String, Object> queryParams) {
this.replication = replication.queryParams(queryParams);
return this;
} | [
"public",
"Replication",
"queryParams",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"queryParams",
")",
"{",
"this",
".",
"replication",
"=",
"replication",
".",
"queryParams",
"(",
"queryParams",
")",
";",
"return",
"this",
";",
"}"
] | Specify additional query parameters to be passed to the filter function.
@param queryParams map of key-value parameters
@return this Replication instance to set more options or trigger the replication | [
"Specify",
"additional",
"query",
"parameters",
"to",
"be",
"passed",
"to",
"the",
"filter",
"function",
"."
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Replication.java#L131-L134 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/Replication.java | Replication.targetOauth | public Replication targetOauth(String consumerSecret,
String consumerKey, String tokenSecret, String token) {
this.replication = replication.targetOauth(consumerSecret, consumerKey,
tokenSecret, token);
return this;
} | java | public Replication targetOauth(String consumerSecret,
String consumerKey, String tokenSecret, String token) {
this.replication = replication.targetOauth(consumerSecret, consumerKey,
tokenSecret, token);
return this;
} | [
"public",
"Replication",
"targetOauth",
"(",
"String",
"consumerSecret",
",",
"String",
"consumerKey",
",",
"String",
"tokenSecret",
",",
"String",
"token",
")",
"{",
"this",
".",
"replication",
"=",
"replication",
".",
"targetOauth",
"(",
"consumerSecret",
",",
... | Set OAuth 1 authentication credentials for the replication target
@param consumerSecret client secret
@param consumerKey client identifier
@param tokenSecret OAuth server token secret
@param token OAuth server issued token
@return this Replication instance to set more options or trigger the replication | [
"Set",
"OAuth",
"1",
"authentication",
"credentials",
"for",
"the",
"replication",
"target"
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Replication.java#L220-L225 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/CloudantClient.java | CloudantClient.getActiveTasks | public List<Task> getActiveTasks() {
InputStream response = null;
URI uri = new URIBase(getBaseUri()).path("_active_tasks").build();
try {
response = couchDbClient.get(uri);
return getResponseList(response, couchDbClient.getGson(), DeserializationTypes.TASKS);
} f... | java | public List<Task> getActiveTasks() {
InputStream response = null;
URI uri = new URIBase(getBaseUri()).path("_active_tasks").build();
try {
response = couchDbClient.get(uri);
return getResponseList(response, couchDbClient.getGson(), DeserializationTypes.TASKS);
} f... | [
"public",
"List",
"<",
"Task",
">",
"getActiveTasks",
"(",
")",
"{",
"InputStream",
"response",
"=",
"null",
";",
"URI",
"uri",
"=",
"new",
"URIBase",
"(",
"getBaseUri",
"(",
")",
")",
".",
"path",
"(",
"\"_active_tasks\"",
")",
".",
"build",
"(",
")",... | Get the list of active tasks from the server.
@return List of tasks
@see <a href="https://console.bluemix.net/docs/services/Cloudant/api/active_tasks.html">
Active tasks</a> | [
"Get",
"the",
"list",
"of",
"active",
"tasks",
"from",
"the",
"server",
"."
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/CloudantClient.java#L180-L189 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/CloudantClient.java | CloudantClient.getMembership | public Membership getMembership() {
URI uri = new URIBase(getBaseUri()).path("_membership").build();
Membership membership = couchDbClient.get(uri,
Membership.class);
return membership;
} | java | public Membership getMembership() {
URI uri = new URIBase(getBaseUri()).path("_membership").build();
Membership membership = couchDbClient.get(uri,
Membership.class);
return membership;
} | [
"public",
"Membership",
"getMembership",
"(",
")",
"{",
"URI",
"uri",
"=",
"new",
"URIBase",
"(",
"getBaseUri",
"(",
")",
")",
".",
"path",
"(",
"\"_membership\"",
")",
".",
"build",
"(",
")",
";",
"Membership",
"membership",
"=",
"couchDbClient",
".",
"... | Get the list of all nodes and the list of active nodes in the cluster.
@return Membership object encapsulating lists of all nodes and the cluster nodes
@see <a
href="https://console.bluemix.net/docs/services/Cloudant/api/advanced.html#-get-_membership-">
_membership</a> | [
"Get",
"the",
"list",
"of",
"all",
"nodes",
"and",
"the",
"list",
"of",
"active",
"nodes",
"in",
"the",
"cluster",
"."
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/CloudantClient.java#L199-L204 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/Changes.java | Changes.getChanges | public ChangesResult getChanges() {
final URI uri = this.databaseHelper.changesUri("feed", "normal");
return client.get(uri, ChangesResult.class);
} | java | public ChangesResult getChanges() {
final URI uri = this.databaseHelper.changesUri("feed", "normal");
return client.get(uri, ChangesResult.class);
} | [
"public",
"ChangesResult",
"getChanges",
"(",
")",
"{",
"final",
"URI",
"uri",
"=",
"this",
".",
"databaseHelper",
".",
"changesUri",
"(",
"\"feed\"",
",",
"\"normal\"",
")",
";",
"return",
"client",
".",
"get",
"(",
"uri",
",",
"ChangesResult",
".",
"clas... | Requests Change notifications of feed type normal.
@return {@link ChangesResult} encapsulating the normal feed changes | [
"Requests",
"Change",
"notifications",
"of",
"feed",
"type",
"normal",
"."
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Changes.java#L151-L154 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/Changes.java | Changes.parameter | public Changes parameter(String name, String value) {
this.databaseHelper.query(name, value);
return this;
} | java | public Changes parameter(String name, String value) {
this.databaseHelper.query(name, value);
return this;
} | [
"public",
"Changes",
"parameter",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"this",
".",
"databaseHelper",
".",
"query",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Add a custom query parameter to the _changes request. Useful for specifying extra parameters
to a filter function for example.
@param name the name of the query parameter
@param value the value of the query parameter
@return this Changes instance
@since 2.5.0 | [
"Add",
"a",
"custom",
"query",
"parameter",
"to",
"the",
"_changes",
"request",
".",
"Useful",
"for",
"specifying",
"extra",
"parameters",
"to",
"a",
"filter",
"function",
"for",
"example",
"."
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Changes.java#L255-L258 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/Changes.java | Changes.readNextRow | private boolean readNextRow() {
while (!stop) {
String row = getLineWrapped();
// end of stream - null indicates end of stream before we see last_seq which shouldn't
// be possible but we should handle it
if (row == null || row.startsWith("{\"last_seq\":")) {
... | java | private boolean readNextRow() {
while (!stop) {
String row = getLineWrapped();
// end of stream - null indicates end of stream before we see last_seq which shouldn't
// be possible but we should handle it
if (row == null || row.startsWith("{\"last_seq\":")) {
... | [
"private",
"boolean",
"readNextRow",
"(",
")",
"{",
"while",
"(",
"!",
"stop",
")",
"{",
"String",
"row",
"=",
"getLineWrapped",
"(",
")",
";",
"// end of stream - null indicates end of stream before we see last_seq which shouldn't",
"// be possible but we should handle it",
... | Reads and sets the next feed in the stream. | [
"Reads",
"and",
"sets",
"the",
"next",
"feed",
"in",
"the",
"stream",
"."
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Changes.java#L265-L283 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/Database.java | Database.getShards | public List<Shard> getShards() {
InputStream response = null;
try {
response = client.couchDbClient.get(new DatabaseURIHelper(db.getDBUri()).path("_shards")
.build());
return getResponseList(response, client.getGson(), DeserializationTypes.SHARDS);
} f... | java | public List<Shard> getShards() {
InputStream response = null;
try {
response = client.couchDbClient.get(new DatabaseURIHelper(db.getDBUri()).path("_shards")
.build());
return getResponseList(response, client.getGson(), DeserializationTypes.SHARDS);
} f... | [
"public",
"List",
"<",
"Shard",
">",
"getShards",
"(",
")",
"{",
"InputStream",
"response",
"=",
"null",
";",
"try",
"{",
"response",
"=",
"client",
".",
"couchDbClient",
".",
"get",
"(",
"new",
"DatabaseURIHelper",
"(",
"db",
".",
"getDBUri",
"(",
")",
... | Get info about the shards in the database.
@return List of shards
@see <a
href="https://console.bluemix.net/docs/services/Cloudant/api/advanced.html#-get-database-_shards-"
target="_blank">_shards</a> | [
"Get",
"info",
"about",
"the",
"shards",
"in",
"the",
"database",
"."
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Database.java#L244-L253 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/Database.java | Database.getShard | public Shard getShard(String docId) {
assertNotEmpty(docId, "docId");
return client.couchDbClient.get(new DatabaseURIHelper(db.getDBUri()).path("_shards")
.path(docId).build(),
Shard.class);
} | java | public Shard getShard(String docId) {
assertNotEmpty(docId, "docId");
return client.couchDbClient.get(new DatabaseURIHelper(db.getDBUri()).path("_shards")
.path(docId).build(),
Shard.class);
} | [
"public",
"Shard",
"getShard",
"(",
"String",
"docId",
")",
"{",
"assertNotEmpty",
"(",
"docId",
",",
"\"docId\"",
")",
";",
"return",
"client",
".",
"couchDbClient",
".",
"get",
"(",
"new",
"DatabaseURIHelper",
"(",
"db",
".",
"getDBUri",
"(",
")",
")",
... | Get info about the shard a document belongs to.
@param docId document ID
@return Shard info
@see <a
href="https://console.bluemix.net/docs/services/Cloudant/api/advanced.html#-get-database-_shards-"
target="_blank">_shards</a> | [
"Get",
"info",
"about",
"the",
"shard",
"a",
"document",
"belongs",
"to",
"."
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Database.java#L264-L269 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/Database.java | Database.findByIndex | @Deprecated
public <T> List<T> findByIndex(String selectorJson, Class<T> classOfT) {
return findByIndex(selectorJson, classOfT, new FindByIndexOptions());
} | java | @Deprecated
public <T> List<T> findByIndex(String selectorJson, Class<T> classOfT) {
return findByIndex(selectorJson, classOfT, new FindByIndexOptions());
} | [
"@",
"Deprecated",
"public",
"<",
"T",
">",
"List",
"<",
"T",
">",
"findByIndex",
"(",
"String",
"selectorJson",
",",
"Class",
"<",
"T",
">",
"classOfT",
")",
"{",
"return",
"findByIndex",
"(",
"selectorJson",
",",
"classOfT",
",",
"new",
"FindByIndexOptio... | Find documents using an index
@param selectorJson String representation of a JSON object describing criteria used to
select documents. For example:
{@code "{ \"selector\": {<your data here>} }"}.
@param classOfT The class of Java objects to be returned
@param <T> the type of the Java object to be returned... | [
"Find",
"documents",
"using",
"an",
"index"
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Database.java#L419-L422 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/Database.java | Database.query | public <T> QueryResult<T> query(String partitionKey, String query, final Class<T> classOfT) {
URI uri = new DatabaseURIHelper(db.getDBUri()).partition(partitionKey).path("_find").build();
return this.query(uri, query, classOfT);
} | java | public <T> QueryResult<T> query(String partitionKey, String query, final Class<T> classOfT) {
URI uri = new DatabaseURIHelper(db.getDBUri()).partition(partitionKey).path("_find").build();
return this.query(uri, query, classOfT);
} | [
"public",
"<",
"T",
">",
"QueryResult",
"<",
"T",
">",
"query",
"(",
"String",
"partitionKey",
",",
"String",
"query",
",",
"final",
"Class",
"<",
"T",
">",
"classOfT",
")",
"{",
"URI",
"uri",
"=",
"new",
"DatabaseURIHelper",
"(",
"db",
".",
"getDBUri"... | Execute a partitioned query using an index and a query selector.
Only available in partitioned databases. To verify a database is partitioned call
{@link Database#info()} and check that {@link DbInfo.Props#getPartitioned()} returns
{@code true}.
<p>Example usage:</p>
<pre>
{@code
// Query database partition 'Coppola'... | [
"Execute",
"a",
"partitioned",
"query",
"using",
"an",
"index",
"and",
"a",
"query",
"selector",
"."
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Database.java#L531-L534 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/Database.java | Database.listIndexes | public Indexes listIndexes() {
URI uri = new DatabaseURIHelper(db.getDBUri()).path("_index").build();
return client.couchDbClient.get(uri, Indexes.class);
} | java | public Indexes listIndexes() {
URI uri = new DatabaseURIHelper(db.getDBUri()).path("_index").build();
return client.couchDbClient.get(uri, Indexes.class);
} | [
"public",
"Indexes",
"listIndexes",
"(",
")",
"{",
"URI",
"uri",
"=",
"new",
"DatabaseURIHelper",
"(",
"db",
".",
"getDBUri",
"(",
")",
")",
".",
"path",
"(",
"\"_index\"",
")",
".",
"build",
"(",
")",
";",
"return",
"client",
".",
"couchDbClient",
"."... | List the indexes in the database. The returned object allows for listing indexes by type.
@return indexes object with methods for getting indexes of a particular type | [
"List",
"the",
"indexes",
"in",
"the",
"database",
".",
"The",
"returned",
"object",
"allows",
"for",
"listing",
"indexes",
"by",
"type",
"."
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Database.java#L582-L585 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/Database.java | Database.deleteIndex | public void deleteIndex(String indexName, String designDocId, String type) {
assertNotEmpty(indexName, "indexName");
assertNotEmpty(designDocId, "designDocId");
assertNotNull(type, "type");
if (!designDocId.startsWith("_design")) {
designDocId = "_design/" + designDocId;
... | java | public void deleteIndex(String indexName, String designDocId, String type) {
assertNotEmpty(indexName, "indexName");
assertNotEmpty(designDocId, "designDocId");
assertNotNull(type, "type");
if (!designDocId.startsWith("_design")) {
designDocId = "_design/" + designDocId;
... | [
"public",
"void",
"deleteIndex",
"(",
"String",
"indexName",
",",
"String",
"designDocId",
",",
"String",
"type",
")",
"{",
"assertNotEmpty",
"(",
"indexName",
",",
"\"indexName\"",
")",
";",
"assertNotEmpty",
"(",
"designDocId",
",",
"\"designDocId\"",
")",
";"... | Delete an index with the specified name and type in the given design document.
@param indexName name of the index
@param designDocId ID of the design doc (the _design prefix will be added if not present)
@param type type of the index, valid values or "text" or "json" | [
"Delete",
"an",
"index",
"with",
"the",
"specified",
"name",
"and",
"type",
"in",
"the",
"given",
"design",
"document",
"."
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Database.java#L604-L621 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/Database.java | Database.find | public <T> T find(Class<T> classType, String id) {
return db.find(classType, id);
} | java | public <T> T find(Class<T> classType, String id) {
return db.find(classType, id);
} | [
"public",
"<",
"T",
">",
"T",
"find",
"(",
"Class",
"<",
"T",
">",
"classType",
",",
"String",
"id",
")",
"{",
"return",
"db",
".",
"find",
"(",
"classType",
",",
"id",
")",
";",
"}"
] | Retrieve the document with the specified ID from the database and deserialize to an
instance of the POJO of type T.
@param <T> object type
@param classType the class of type T
@param id the document id
@return an object of type T
@throws NoDocumentException if the document is not found in the database
@se... | [
"Retrieve",
"the",
"document",
"with",
"the",
"specified",
"ID",
"from",
"the",
"database",
"and",
"deserialize",
"to",
"an",
"instance",
"of",
"the",
"POJO",
"of",
"type",
"T",
"."
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Database.java#L751-L753 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/Database.java | Database.info | public DbInfo info() {
return client.couchDbClient.get(new DatabaseURIHelper(db.getDBUri()).getDatabaseUri(),
DbInfo.class);
} | java | public DbInfo info() {
return client.couchDbClient.get(new DatabaseURIHelper(db.getDBUri()).getDatabaseUri(),
DbInfo.class);
} | [
"public",
"DbInfo",
"info",
"(",
")",
"{",
"return",
"client",
".",
"couchDbClient",
".",
"get",
"(",
"new",
"DatabaseURIHelper",
"(",
"db",
".",
"getDBUri",
"(",
")",
")",
".",
"getDatabaseUri",
"(",
")",
",",
"DbInfo",
".",
"class",
")",
";",
"}"
] | Get information about this database.
@return DbInfo encapsulating the database info
@see <a
href="https://console.bluemix.net/docs/services/Cloudant/api/database.html#getting-database-details"
target="_blank">Databases - read</a> | [
"Get",
"information",
"about",
"this",
"database",
"."
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Database.java#L1399-L1402 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/Database.java | Database.partitionInfo | public PartitionInfo partitionInfo(String partitionKey) {
if (partitionKey == null) {
throw new UnsupportedOperationException("Cannot get partition information for null partition key.");
}
URI uri = new DatabaseURIHelper(db.getDBUri()).partition(partitionKey).build();
return ... | java | public PartitionInfo partitionInfo(String partitionKey) {
if (partitionKey == null) {
throw new UnsupportedOperationException("Cannot get partition information for null partition key.");
}
URI uri = new DatabaseURIHelper(db.getDBUri()).partition(partitionKey).build();
return ... | [
"public",
"PartitionInfo",
"partitionInfo",
"(",
"String",
"partitionKey",
")",
"{",
"if",
"(",
"partitionKey",
"==",
"null",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Cannot get partition information for null partition key.\"",
")",
";",
"}",
"... | Get information about a partition in this database.
@param partitionKey database partition key
@return {@link com.cloudant.client.api.model.PartitionInfo} encapsulating the database partition info.
@throws UnsupportedOperationException if called with {@code null} partition key. | [
"Get",
"information",
"about",
"a",
"partition",
"in",
"this",
"database",
"."
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Database.java#L1411-L1417 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/query/Expression.java | Expression.type | public static Expression type(String lhs, Type rhs) {
return new Expression(lhs, "$type", rhs.toString());
} | java | public static Expression type(String lhs, Type rhs) {
return new Expression(lhs, "$type", rhs.toString());
} | [
"public",
"static",
"Expression",
"type",
"(",
"String",
"lhs",
",",
"Type",
"rhs",
")",
"{",
"return",
"new",
"Expression",
"(",
"lhs",
",",
"\"$type\"",
",",
"rhs",
".",
"toString",
"(",
")",
")",
";",
"}"
] | Check the document field's type
and object
@param lhs The field to check
@param rhs The type
@return Expression: lhs $type rhs | [
"Check",
"the",
"document",
"field",
"s",
"type",
"and",
"object"
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/query/Expression.java#L121-L123 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/query/PredicateExpression.java | PredicateExpression.nin | public static PredicateExpression nin(Object... rhs) {
PredicateExpression ex = new PredicateExpression("$nin", rhs);
if (rhs.length == 1) {
ex.single = true;
}
return ex;
} | java | public static PredicateExpression nin(Object... rhs) {
PredicateExpression ex = new PredicateExpression("$nin", rhs);
if (rhs.length == 1) {
ex.single = true;
}
return ex;
} | [
"public",
"static",
"PredicateExpression",
"nin",
"(",
"Object",
"...",
"rhs",
")",
"{",
"PredicateExpression",
"ex",
"=",
"new",
"PredicateExpression",
"(",
"\"$nin\"",
",",
"rhs",
")",
";",
"if",
"(",
"rhs",
".",
"length",
"==",
"1",
")",
"{",
"ex",
".... | The document field must not exist in the list provided
@param rhs The argument - one or more values
@return PredicateExpression: $nin rhs | [
"The",
"document",
"field",
"must",
"not",
"exist",
"in",
"the",
"list",
"provided"
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/query/PredicateExpression.java#L131-L137 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/query/PredicateExpression.java | PredicateExpression.all | public static PredicateExpression all(Object... rhs) {
PredicateExpression ex = new PredicateExpression( "$all", rhs);
if (rhs.length == 1) {
ex.single = true;
}
return ex;
} | java | public static PredicateExpression all(Object... rhs) {
PredicateExpression ex = new PredicateExpression( "$all", rhs);
if (rhs.length == 1) {
ex.single = true;
}
return ex;
} | [
"public",
"static",
"PredicateExpression",
"all",
"(",
"Object",
"...",
"rhs",
")",
"{",
"PredicateExpression",
"ex",
"=",
"new",
"PredicateExpression",
"(",
"\"$all\"",
",",
"rhs",
")",
";",
"if",
"(",
"rhs",
".",
"length",
"==",
"1",
")",
"{",
"ex",
".... | Matches an array value if it contains all the elements of the argument array
@param rhs The arguments
@return PredicateExpression: $all rhs | [
"Matches",
"an",
"array",
"value",
"if",
"it",
"contains",
"all",
"the",
"elements",
"of",
"the",
"argument",
"array"
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/query/PredicateExpression.java#L176-L182 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/Replication.java | Replication.trigger | public ReplicationResult trigger() {
assertNotEmpty(source, "Source");
assertNotEmpty(target, "Target");
InputStream response = null;
try {
JsonObject json = createJson();
if (log.isLoggable(Level.FINE)) {
log.fine(json.toString());
}
... | java | public ReplicationResult trigger() {
assertNotEmpty(source, "Source");
assertNotEmpty(target, "Target");
InputStream response = null;
try {
JsonObject json = createJson();
if (log.isLoggable(Level.FINE)) {
log.fine(json.toString());
}
... | [
"public",
"ReplicationResult",
"trigger",
"(",
")",
"{",
"assertNotEmpty",
"(",
"source",
",",
"\"Source\"",
")",
";",
"assertNotEmpty",
"(",
"target",
",",
"\"Target\"",
")",
";",
"InputStream",
"response",
"=",
"null",
";",
"try",
"{",
"JsonObject",
"json",
... | Triggers a replication request. | [
"Triggers",
"a",
"replication",
"request",
"."
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/Replication.java#L102-L123 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/Replication.java | Replication.targetOauth | public Replication targetOauth(String consumerSecret, String consumerKey, String tokenSecret,
String token) {
targetOauth = new JsonObject();
this.consumerSecret = consumerSecret;
this.consumerKey = consumerKey;
this.tokenSecret = tokenSecret;
t... | java | public Replication targetOauth(String consumerSecret, String consumerKey, String tokenSecret,
String token) {
targetOauth = new JsonObject();
this.consumerSecret = consumerSecret;
this.consumerKey = consumerKey;
this.tokenSecret = tokenSecret;
t... | [
"public",
"Replication",
"targetOauth",
"(",
"String",
"consumerSecret",
",",
"String",
"consumerKey",
",",
"String",
"tokenSecret",
",",
"String",
"token",
")",
"{",
"targetOauth",
"=",
"new",
"JsonObject",
"(",
")",
";",
"this",
".",
"consumerSecret",
"=",
"... | Authenticate with the target database using OAuth.
@param consumerSecret consumer secret
@param consumerKey consumer key
@param tokenSecret token secret
@param token token
@return this Replication instance to set more options
@deprecated OAuth 1.0 implementation has been <a href="http://docs.couchdb.org/en/stable/what... | [
"Authenticate",
"with",
"the",
"target",
"database",
"using",
"OAuth",
"."
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/Replication.java#L206-L214 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/internal/CouchDbUtil.java | CouchDbUtil.createPost | public static HttpConnection createPost(URI uri, String body, String contentType) {
HttpConnection connection = Http.POST(uri, "application/json");
if(body != null) {
setEntity(connection, body, contentType);
}
return connection;
} | java | public static HttpConnection createPost(URI uri, String body, String contentType) {
HttpConnection connection = Http.POST(uri, "application/json");
if(body != null) {
setEntity(connection, body, contentType);
}
return connection;
} | [
"public",
"static",
"HttpConnection",
"createPost",
"(",
"URI",
"uri",
",",
"String",
"body",
",",
"String",
"contentType",
")",
"{",
"HttpConnection",
"connection",
"=",
"Http",
".",
"POST",
"(",
"uri",
",",
"\"application/json\"",
")",
";",
"if",
"(",
"bod... | create a HTTP POST request.
@return {@link HttpConnection} | [
"create",
"a",
"HTTP",
"POST",
"request",
"."
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/internal/CouchDbUtil.java#L181-L187 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/internal/CouchDbUtil.java | CouchDbUtil.setEntity | public static void setEntity(HttpConnection connnection, String body, String contentType) {
connnection.requestProperties.put("Content-type", contentType);
connnection.setRequestBody(body);
} | java | public static void setEntity(HttpConnection connnection, String body, String contentType) {
connnection.requestProperties.put("Content-type", contentType);
connnection.setRequestBody(body);
} | [
"public",
"static",
"void",
"setEntity",
"(",
"HttpConnection",
"connnection",
",",
"String",
"body",
",",
"String",
"contentType",
")",
"{",
"connnection",
".",
"requestProperties",
".",
"put",
"(",
"\"Content-type\"",
",",
"contentType",
")",
";",
"connnection",... | Sets a JSON String as a request entity.
@param connnection The request of {@link HttpConnection}
@param body The JSON String to set. | [
"Sets",
"a",
"JSON",
"String",
"as",
"a",
"request",
"entity",
"."
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/internal/CouchDbUtil.java#L195-L198 | train |
cloudant/java-cloudant | cloudant-http/src/main/java/com/cloudant/http/HttpConnectionInterceptorContext.java | HttpConnectionInterceptorContext.setState | public <T> void setState(HttpConnectionInterceptor interceptor, String stateName, T
stateObjectToStore) {
Map<String, Object> state = interceptorStates.get(interceptor);
if (state == null) {
interceptorStates.put(interceptor, (state = new ConcurrentHashMap<String, Object>()));
... | java | public <T> void setState(HttpConnectionInterceptor interceptor, String stateName, T
stateObjectToStore) {
Map<String, Object> state = interceptorStates.get(interceptor);
if (state == null) {
interceptorStates.put(interceptor, (state = new ConcurrentHashMap<String, Object>()));
... | [
"public",
"<",
"T",
">",
"void",
"setState",
"(",
"HttpConnectionInterceptor",
"interceptor",
",",
"String",
"stateName",
",",
"T",
"stateObjectToStore",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"state",
"=",
"interceptorStates",
".",
"get",
"(",
... | Store some state on this request context associated with the specified interceptor instance.
Used where a single interceptor instance needs to associate state with each HTTP request.
@param interceptor the interceptor instance
@param stateName the key to store the state object under
@param stateObjectT... | [
"Store",
"some",
"state",
"on",
"this",
"request",
"context",
"associated",
"with",
"the",
"specified",
"interceptor",
"instance",
".",
"Used",
"where",
"a",
"single",
"interceptor",
"instance",
"needs",
"to",
"associate",
"state",
"with",
"each",
"HTTP",
"reque... | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-http/src/main/java/com/cloudant/http/HttpConnectionInterceptorContext.java#L84-L91 | train |
cloudant/java-cloudant | cloudant-http/src/main/java/com/cloudant/http/HttpConnectionInterceptorContext.java | HttpConnectionInterceptorContext.getState | public <T> T getState(HttpConnectionInterceptor interceptor, String stateName, Class<T>
stateType) {
Map<String, Object> state = interceptorStates.get(interceptor);
if (state != null) {
return stateType.cast(state.get(stateName));
} else {
return null;
... | java | public <T> T getState(HttpConnectionInterceptor interceptor, String stateName, Class<T>
stateType) {
Map<String, Object> state = interceptorStates.get(interceptor);
if (state != null) {
return stateType.cast(state.get(stateName));
} else {
return null;
... | [
"public",
"<",
"T",
">",
"T",
"getState",
"(",
"HttpConnectionInterceptor",
"interceptor",
",",
"String",
"stateName",
",",
"Class",
"<",
"T",
">",
"stateType",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"state",
"=",
"interceptorStates",
".",
"ge... | Retrieve the state object associated with the specified interceptor instance and property
name on this request context.
@param interceptor the interceptor instance
@param stateName the name key that the state object was stored under
@param stateType class of the type the stored state should be returned as
@param <... | [
"Retrieve",
"the",
"state",
"object",
"associated",
"with",
"the",
"specified",
"interceptor",
"instance",
"and",
"property",
"name",
"on",
"this",
"request",
"context",
"."
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-http/src/main/java/com/cloudant/http/HttpConnectionInterceptorContext.java#L105-L113 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/DesignDocumentManager.java | DesignDocumentManager.get | public DesignDocument get(String id) {
assertNotEmpty(id, "id");
return db.find(DesignDocument.class, ensureDesignPrefix(id));
} | java | public DesignDocument get(String id) {
assertNotEmpty(id, "id");
return db.find(DesignDocument.class, ensureDesignPrefix(id));
} | [
"public",
"DesignDocument",
"get",
"(",
"String",
"id",
")",
"{",
"assertNotEmpty",
"(",
"id",
",",
"\"id\"",
")",
";",
"return",
"db",
".",
"find",
"(",
"DesignDocument",
".",
"class",
",",
"ensureDesignPrefix",
"(",
"id",
")",
")",
";",
"}"
] | Gets a design document from the database.
@param id the design document id (optionally prefixed with "_design/")
@return {@link DesignDocument} | [
"Gets",
"a",
"design",
"document",
"from",
"the",
"database",
"."
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/DesignDocumentManager.java#L149-L152 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/DesignDocumentManager.java | DesignDocumentManager.get | public DesignDocument get(String id, String rev) {
assertNotEmpty(id, "id");
assertNotEmpty(id, "rev");
return db.find(DesignDocument.class, ensureDesignPrefix(id), rev);
} | java | public DesignDocument get(String id, String rev) {
assertNotEmpty(id, "id");
assertNotEmpty(id, "rev");
return db.find(DesignDocument.class, ensureDesignPrefix(id), rev);
} | [
"public",
"DesignDocument",
"get",
"(",
"String",
"id",
",",
"String",
"rev",
")",
"{",
"assertNotEmpty",
"(",
"id",
",",
"\"id\"",
")",
";",
"assertNotEmpty",
"(",
"id",
",",
"\"rev\"",
")",
";",
"return",
"db",
".",
"find",
"(",
"DesignDocument",
".",
... | Gets a design document using the id and revision from the database.
@param id the document id (optionally prefixed with "_design/")
@param rev the document revision
@return {@link DesignDocument} | [
"Gets",
"a",
"design",
"document",
"using",
"the",
"id",
"and",
"revision",
"from",
"the",
"database",
"."
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/DesignDocumentManager.java#L161-L165 | train |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/DesignDocumentManager.java | DesignDocumentManager.remove | public Response remove(String id) {
assertNotEmpty(id, "id");
id = ensureDesignPrefix(id);
String revision = null;
// Get the revision ID from ETag, removing leading and trailing "
revision = client.executeRequest(Http.HEAD(new DatabaseURIHelper(db.getDBUri()
).docu... | java | public Response remove(String id) {
assertNotEmpty(id, "id");
id = ensureDesignPrefix(id);
String revision = null;
// Get the revision ID from ETag, removing leading and trailing "
revision = client.executeRequest(Http.HEAD(new DatabaseURIHelper(db.getDBUri()
).docu... | [
"public",
"Response",
"remove",
"(",
"String",
"id",
")",
"{",
"assertNotEmpty",
"(",
"id",
",",
"\"id\"",
")",
";",
"id",
"=",
"ensureDesignPrefix",
"(",
"id",
")",
";",
"String",
"revision",
"=",
"null",
";",
"// Get the revision ID from ETag, removing leading... | Removes a design document from the database.
@param id the document id (optionally prefixed with "_design/")
@return {@link DesignDocument} | [
"Removes",
"a",
"design",
"document",
"from",
"the",
"database",
"."
] | 42c438654945361bded2cc0827afc046d535b31b | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/DesignDocumentManager.java#L173-L186 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.