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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ixa-ehu/ixa-pipe-pos | src/main/java/eus/ixa/ixa/pipe/pos/dict/MultiWordMatcher.java | MultiWordMatcher.multiWordsToSpans | public final Span[] multiWordsToSpans(final String[] tokens) {
final List<Span> multiWordsFound = new LinkedList<Span>();
for (int offsetFrom = 0; offsetFrom < tokens.length; offsetFrom++) {
Span multiwordFound = null;
String tokensSearching[] = new String[] {};
for (int offsetTo = offsetFrom; offsetTo < tokens.length; offsetTo++) {
final int lengthSearching = offsetTo - offsetFrom + 1;
if (lengthSearching > getMaxTokenCount()) {
break;
} else {
tokensSearching = new String[lengthSearching];
System.arraycopy(tokens, offsetFrom, tokensSearching, 0,
lengthSearching);
final String entryForSearch = StringUtils
.getStringFromTokens(tokensSearching);
final String entryValue = dictionary
.get(entryForSearch.toLowerCase());
if (entryValue != null) {
multiwordFound = new Span(offsetFrom, offsetTo + 1, entryValue);
}
}
}
if (multiwordFound != null) {
multiWordsFound.add(multiwordFound);
offsetFrom += multiwordFound.length() - 1;
}
}
return multiWordsFound.toArray(new Span[multiWordsFound.size()]);
} | java | public final Span[] multiWordsToSpans(final String[] tokens) {
final List<Span> multiWordsFound = new LinkedList<Span>();
for (int offsetFrom = 0; offsetFrom < tokens.length; offsetFrom++) {
Span multiwordFound = null;
String tokensSearching[] = new String[] {};
for (int offsetTo = offsetFrom; offsetTo < tokens.length; offsetTo++) {
final int lengthSearching = offsetTo - offsetFrom + 1;
if (lengthSearching > getMaxTokenCount()) {
break;
} else {
tokensSearching = new String[lengthSearching];
System.arraycopy(tokens, offsetFrom, tokensSearching, 0,
lengthSearching);
final String entryForSearch = StringUtils
.getStringFromTokens(tokensSearching);
final String entryValue = dictionary
.get(entryForSearch.toLowerCase());
if (entryValue != null) {
multiwordFound = new Span(offsetFrom, offsetTo + 1, entryValue);
}
}
}
if (multiwordFound != null) {
multiWordsFound.add(multiwordFound);
offsetFrom += multiwordFound.length() - 1;
}
}
return multiWordsFound.toArray(new Span[multiWordsFound.size()]);
} | [
"public",
"final",
"Span",
"[",
"]",
"multiWordsToSpans",
"(",
"final",
"String",
"[",
"]",
"tokens",
")",
"{",
"final",
"List",
"<",
"Span",
">",
"multiWordsFound",
"=",
"new",
"LinkedList",
"<",
"Span",
">",
"(",
")",
";",
"for",
"(",
"int",
"offsetF... | Detects multiword expressions ignoring case.
@param tokens
the tokenized sentence
@return spans of the multiword | [
"Detects",
"multiword",
"expressions",
"ignoring",
"case",
"."
] | 083c986103f95ae8063b8ddc89a2caa8047d29b9 | https://github.com/ixa-ehu/ixa-pipe-pos/blob/083c986103f95ae8063b8ddc89a2caa8047d29b9/src/main/java/eus/ixa/ixa/pipe/pos/dict/MultiWordMatcher.java#L184-L216 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/resources/org/apache/commons/jre/java/util/GregorianCalendar.java | GregorianCalendar.compareDate | private int compareDate(Date a, Date b) {
final Date ta = new Date(a.getTime());
final Date tb = new Date(b.getTime());
final long d1 = setHourToZero(ta).getTime();
final long d2 = setHourToZero(tb).getTime();
return (int) Math.round((d2 - d1) / 1000.0 / 60.0 / 60.0 / 24.0);
} | java | private int compareDate(Date a, Date b) {
final Date ta = new Date(a.getTime());
final Date tb = new Date(b.getTime());
final long d1 = setHourToZero(ta).getTime();
final long d2 = setHourToZero(tb).getTime();
return (int) Math.round((d2 - d1) / 1000.0 / 60.0 / 60.0 / 24.0);
} | [
"private",
"int",
"compareDate",
"(",
"Date",
"a",
",",
"Date",
"b",
")",
"{",
"final",
"Date",
"ta",
"=",
"new",
"Date",
"(",
"a",
".",
"getTime",
"(",
")",
")",
";",
"final",
"Date",
"tb",
"=",
"new",
"Date",
"(",
"b",
".",
"getTime",
"(",
")... | Calculate the number of days between two dates
@param a Date
@param b Date
@return the difference in days between b and a (b - a) | [
"Calculate",
"the",
"number",
"of",
"days",
"between",
"two",
"dates"
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/resources/org/apache/commons/jre/java/util/GregorianCalendar.java#L365-L371 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/resources/org/apache/commons/jre/java/util/GregorianCalendar.java | GregorianCalendar.setHourToZero | @SuppressWarnings("deprecation")
private Date setHourToZero(Date in) {
final Date d = new Date(in.getTime());
d.setHours(0);
d.setMinutes(0);
d.setSeconds(0);
// a trick to set milliseconds to zero
long t = d.getTime() / 1000;
t = t * 1000;
return new Date(t);
} | java | @SuppressWarnings("deprecation")
private Date setHourToZero(Date in) {
final Date d = new Date(in.getTime());
d.setHours(0);
d.setMinutes(0);
d.setSeconds(0);
// a trick to set milliseconds to zero
long t = d.getTime() / 1000;
t = t * 1000;
return new Date(t);
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"private",
"Date",
"setHourToZero",
"(",
"Date",
"in",
")",
"{",
"final",
"Date",
"d",
"=",
"new",
"Date",
"(",
"in",
".",
"getTime",
"(",
")",
")",
";",
"d",
".",
"setHours",
"(",
"0",
")",
";",
... | Set hour, minutes, second and milliseconds to zero.
@param d Date
@return Modified date | [
"Set",
"hour",
"minutes",
"second",
"and",
"milliseconds",
"to",
"zero",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/resources/org/apache/commons/jre/java/util/GregorianCalendar.java#L379-L389 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/resources/org/apache/commons/jre/java/util/GregorianCalendar.java | GregorianCalendar.getWeekOne | @SuppressWarnings("deprecation")
private Date getWeekOne(int year) {
GregorianCalendar weekOne = new GregorianCalendar();
weekOne.setFirstDayOfWeek(getFirstDayOfWeek());
weekOne.setMinimalDaysInFirstWeek(getMinimalDaysInFirstWeek());
weekOne.setTime(new Date(year, 0, 1));
// can we use the week of 1/1/year as week one?
int dow = weekOne.get(DAY_OF_WEEK);
if (dow < weekOne.getFirstDayOfWeek()) dow += 7;
int eow = weekOne.getFirstDayOfWeek() + 7;
if ((eow - dow) < weekOne.getMinimalDaysInFirstWeek()) {
// nope, week one is the following week
weekOne.add(DATE, 7);
}
weekOne.set(DAY_OF_WEEK, weekOne.getFirstDayOfWeek());
return weekOne.getTime();
} | java | @SuppressWarnings("deprecation")
private Date getWeekOne(int year) {
GregorianCalendar weekOne = new GregorianCalendar();
weekOne.setFirstDayOfWeek(getFirstDayOfWeek());
weekOne.setMinimalDaysInFirstWeek(getMinimalDaysInFirstWeek());
weekOne.setTime(new Date(year, 0, 1));
// can we use the week of 1/1/year as week one?
int dow = weekOne.get(DAY_OF_WEEK);
if (dow < weekOne.getFirstDayOfWeek()) dow += 7;
int eow = weekOne.getFirstDayOfWeek() + 7;
if ((eow - dow) < weekOne.getMinimalDaysInFirstWeek()) {
// nope, week one is the following week
weekOne.add(DATE, 7);
}
weekOne.set(DAY_OF_WEEK, weekOne.getFirstDayOfWeek());
return weekOne.getTime();
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"private",
"Date",
"getWeekOne",
"(",
"int",
"year",
")",
"{",
"GregorianCalendar",
"weekOne",
"=",
"new",
"GregorianCalendar",
"(",
")",
";",
"weekOne",
".",
"setFirstDayOfWeek",
"(",
"getFirstDayOfWeek",
"(",... | Gets the date of the first week for the specified year.
@param year This is year - 1900 as returned by Date.getYear()
@return | [
"Gets",
"the",
"date",
"of",
"the",
"first",
"week",
"for",
"the",
"specified",
"year",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/resources/org/apache/commons/jre/java/util/GregorianCalendar.java#L396-L412 | train |
ixa-ehu/ixa-pipe-pos | src/main/java/eus/ixa/ixa/pipe/pos/train/AbstractTaggerTrainer.java | AbstractTaggerTrainer.createTagDictionary | protected final void createTagDictionary(final String dictPath) {
if (!dictPath.equalsIgnoreCase(Flags.DEFAULT_DICT_PATH)) {
try {
getPosTaggerFactory().setTagDictionary(
getPosTaggerFactory().createTagDictionary(new File(dictPath)));
} catch (final IOException e) {
throw new TerminateToolException(-1,
"IO error while loading POS Dictionary: " + e.getMessage(), e);
}
}
} | java | protected final void createTagDictionary(final String dictPath) {
if (!dictPath.equalsIgnoreCase(Flags.DEFAULT_DICT_PATH)) {
try {
getPosTaggerFactory().setTagDictionary(
getPosTaggerFactory().createTagDictionary(new File(dictPath)));
} catch (final IOException e) {
throw new TerminateToolException(-1,
"IO error while loading POS Dictionary: " + e.getMessage(), e);
}
}
} | [
"protected",
"final",
"void",
"createTagDictionary",
"(",
"final",
"String",
"dictPath",
")",
"{",
"if",
"(",
"!",
"dictPath",
".",
"equalsIgnoreCase",
"(",
"Flags",
".",
"DEFAULT_DICT_PATH",
")",
")",
"{",
"try",
"{",
"getPosTaggerFactory",
"(",
")",
".",
"... | Create a tag dictionary with the dictionary contained in the dictPath.
@param dictPath
the string pointing to the tag dictionary | [
"Create",
"a",
"tag",
"dictionary",
"with",
"the",
"dictionary",
"contained",
"in",
"the",
"dictPath",
"."
] | 083c986103f95ae8063b8ddc89a2caa8047d29b9 | https://github.com/ixa-ehu/ixa-pipe-pos/blob/083c986103f95ae8063b8ddc89a2caa8047d29b9/src/main/java/eus/ixa/ixa/pipe/pos/train/AbstractTaggerTrainer.java#L140-L150 | train |
ixa-ehu/ixa-pipe-pos | src/main/java/eus/ixa/ixa/pipe/pos/train/AbstractTaggerTrainer.java | AbstractTaggerTrainer.createAutomaticDictionary | protected final void createAutomaticDictionary(
final ObjectStream<POSSample> aDictSamples, final int aDictCutOff) {
if (aDictCutOff != Flags.DEFAULT_DICT_CUTOFF) {
try {
TagDictionary dict = getPosTaggerFactory().getTagDictionary();
if (dict == null) {
dict = getPosTaggerFactory().createEmptyTagDictionary();
getPosTaggerFactory().setTagDictionary(dict);
}
if (dict instanceof MutableTagDictionary) {
POSTaggerME.populatePOSDictionary(aDictSamples,
(MutableTagDictionary) dict, aDictCutOff);
} else {
throw new IllegalArgumentException("Can't extend a POSDictionary"
+ " that does not implement MutableTagDictionary.");
}
this.dictSamples.reset();
} catch (final IOException e) {
throw new TerminateToolException(-1,
"IO error while creating/extending POS Dictionary: "
+ e.getMessage(), e);
}
}
} | java | protected final void createAutomaticDictionary(
final ObjectStream<POSSample> aDictSamples, final int aDictCutOff) {
if (aDictCutOff != Flags.DEFAULT_DICT_CUTOFF) {
try {
TagDictionary dict = getPosTaggerFactory().getTagDictionary();
if (dict == null) {
dict = getPosTaggerFactory().createEmptyTagDictionary();
getPosTaggerFactory().setTagDictionary(dict);
}
if (dict instanceof MutableTagDictionary) {
POSTaggerME.populatePOSDictionary(aDictSamples,
(MutableTagDictionary) dict, aDictCutOff);
} else {
throw new IllegalArgumentException("Can't extend a POSDictionary"
+ " that does not implement MutableTagDictionary.");
}
this.dictSamples.reset();
} catch (final IOException e) {
throw new TerminateToolException(-1,
"IO error while creating/extending POS Dictionary: "
+ e.getMessage(), e);
}
}
} | [
"protected",
"final",
"void",
"createAutomaticDictionary",
"(",
"final",
"ObjectStream",
"<",
"POSSample",
">",
"aDictSamples",
",",
"final",
"int",
"aDictCutOff",
")",
"{",
"if",
"(",
"aDictCutOff",
"!=",
"Flags",
".",
"DEFAULT_DICT_CUTOFF",
")",
"{",
"try",
"{... | Automatically create a tag dictionary from training data.
@param aDictSamples
the dictSamples created from training data
@param aDictCutOff
the cutoff to create the dictionary | [
"Automatically",
"create",
"a",
"tag",
"dictionary",
"from",
"training",
"data",
"."
] | 083c986103f95ae8063b8ddc89a2caa8047d29b9 | https://github.com/ixa-ehu/ixa-pipe-pos/blob/083c986103f95ae8063b8ddc89a2caa8047d29b9/src/main/java/eus/ixa/ixa/pipe/pos/train/AbstractTaggerTrainer.java#L160-L183 | train |
ixa-ehu/ixa-pipe-pos | src/main/java/eus/ixa/ixa/pipe/pos/train/AbstractTaggerTrainer.java | AbstractTaggerTrainer.createNgramDictionary | protected final Dictionary createNgramDictionary(
final ObjectStream<POSSample> aDictSamples, final int aNgramCutoff) {
Dictionary ngramDict = null;
if (aNgramCutoff != Flags.DEFAULT_DICT_CUTOFF) {
System.err.print("Building ngram dictionary ... ");
try {
ngramDict = POSTaggerME
.buildNGramDictionary(aDictSamples, aNgramCutoff);
this.dictSamples.reset();
} catch (final IOException e) {
throw new TerminateToolException(-1,
"IO error while building NGram Dictionary: " + e.getMessage(), e);
}
System.err.println("done");
}
return ngramDict;
} | java | protected final Dictionary createNgramDictionary(
final ObjectStream<POSSample> aDictSamples, final int aNgramCutoff) {
Dictionary ngramDict = null;
if (aNgramCutoff != Flags.DEFAULT_DICT_CUTOFF) {
System.err.print("Building ngram dictionary ... ");
try {
ngramDict = POSTaggerME
.buildNGramDictionary(aDictSamples, aNgramCutoff);
this.dictSamples.reset();
} catch (final IOException e) {
throw new TerminateToolException(-1,
"IO error while building NGram Dictionary: " + e.getMessage(), e);
}
System.err.println("done");
}
return ngramDict;
} | [
"protected",
"final",
"Dictionary",
"createNgramDictionary",
"(",
"final",
"ObjectStream",
"<",
"POSSample",
">",
"aDictSamples",
",",
"final",
"int",
"aNgramCutoff",
")",
"{",
"Dictionary",
"ngramDict",
"=",
"null",
";",
"if",
"(",
"aNgramCutoff",
"!=",
"Flags",
... | Create ngram dictionary from training data.
@param aDictSamples
the training data
@param aNgramCutoff
the cutoff
@return ngram dictionary | [
"Create",
"ngram",
"dictionary",
"from",
"training",
"data",
"."
] | 083c986103f95ae8063b8ddc89a2caa8047d29b9 | https://github.com/ixa-ehu/ixa-pipe-pos/blob/083c986103f95ae8063b8ddc89a2caa8047d29b9/src/main/java/eus/ixa/ixa/pipe/pos/train/AbstractTaggerTrainer.java#L194-L210 | train |
sockeqwe/sqlbrite-dao | objectmapper-processor/src/main/java/com/hannesdorfmann/sqlbrite/objectmapper/processor/ColumnAnnotatedField.java | ColumnAnnotatedField.getQualifiedSurroundingClassName | @Override public String getQualifiedSurroundingClassName() {
TypeElement typeElement = (TypeElement) field.getEnclosingElement();
return typeElement.getQualifiedName().toString();
} | java | @Override public String getQualifiedSurroundingClassName() {
TypeElement typeElement = (TypeElement) field.getEnclosingElement();
return typeElement.getQualifiedName().toString();
} | [
"@",
"Override",
"public",
"String",
"getQualifiedSurroundingClassName",
"(",
")",
"{",
"TypeElement",
"typeElement",
"=",
"(",
"TypeElement",
")",
"field",
".",
"getEnclosingElement",
"(",
")",
";",
"return",
"typeElement",
".",
"getQualifiedName",
"(",
")",
".",... | Get the full qualified class name this field is part of.
@return The full qualified class name | [
"Get",
"the",
"full",
"qualified",
"class",
"name",
"this",
"field",
"is",
"part",
"of",
"."
] | 8d02b76f00bd2f8997a58d33146b98b2eec35452 | https://github.com/sockeqwe/sqlbrite-dao/blob/8d02b76f00bd2f8997a58d33146b98b2eec35452/objectmapper-processor/src/main/java/com/hannesdorfmann/sqlbrite/objectmapper/processor/ColumnAnnotatedField.java#L101-L104 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/resources/org/apache/commons/jre/java/util/BitSet.java | BitSet.setInternal | private static void setInternal(int[] array, int fromIndex, int toIndex) {
int first = wordIndex(fromIndex);
int last = wordIndex(toIndex);
maybeGrowArrayToIndex(array, last);
int startBit = bitOffset(fromIndex);
int endBit = bitOffset(toIndex);
if (first == last) {
// Set the bits in between first and last.
maskInWord(array, first, startBit, endBit);
} else {
// Set the bits from fromIndex to the next 31 bit boundary.
maskInWord(array, first, startBit, BITS_PER_WORD);
// Set the bits from the last 31 bit boundary to toIndex.
maskInWord(array, last, 0, endBit);
// Set everything in between.
for (int i = first + 1; i < last; i++) {
array[i] = WORD_MASK;
}
}
} | java | private static void setInternal(int[] array, int fromIndex, int toIndex) {
int first = wordIndex(fromIndex);
int last = wordIndex(toIndex);
maybeGrowArrayToIndex(array, last);
int startBit = bitOffset(fromIndex);
int endBit = bitOffset(toIndex);
if (first == last) {
// Set the bits in between first and last.
maskInWord(array, first, startBit, endBit);
} else {
// Set the bits from fromIndex to the next 31 bit boundary.
maskInWord(array, first, startBit, BITS_PER_WORD);
// Set the bits from the last 31 bit boundary to toIndex.
maskInWord(array, last, 0, endBit);
// Set everything in between.
for (int i = first + 1; i < last; i++) {
array[i] = WORD_MASK;
}
}
} | [
"private",
"static",
"void",
"setInternal",
"(",
"int",
"[",
"]",
"array",
",",
"int",
"fromIndex",
",",
"int",
"toIndex",
")",
"{",
"int",
"first",
"=",
"wordIndex",
"(",
"fromIndex",
")",
";",
"int",
"last",
"=",
"wordIndex",
"(",
"toIndex",
")",
";"... | Sets all bits to true within the given range.
@param fromIndex The lower bit index.
@param toIndex The upper bit index. | [
"Sets",
"all",
"bits",
"to",
"true",
"within",
"the",
"given",
"range",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/resources/org/apache/commons/jre/java/util/BitSet.java#L99-L123 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/resources/org/apache/commons/jre/java/util/BitSet.java | BitSet.lastSetWordIndex | private static int lastSetWordIndex(int[] array) {
int i = array.length - 1;
for (; i >= 0 && wordAt(array, i) == 0; --i) { }
return i;
} | java | private static int lastSetWordIndex(int[] array) {
int i = array.length - 1;
for (; i >= 0 && wordAt(array, i) == 0; --i) { }
return i;
} | [
"private",
"static",
"int",
"lastSetWordIndex",
"(",
"int",
"[",
"]",
"array",
")",
"{",
"int",
"i",
"=",
"array",
".",
"length",
"-",
"1",
";",
"for",
"(",
";",
"i",
">=",
"0",
"&&",
"wordAt",
"(",
"array",
",",
"i",
")",
"==",
"0",
";",
"--",... | Returns the index of the last word containing a true bit in an array, or -1 if none.
@param array The array.
@return The index of the last word containing a true bit, or -1 if none. | [
"Returns",
"the",
"index",
"of",
"the",
"last",
"word",
"containing",
"a",
"true",
"bit",
"in",
"an",
"array",
"or",
"-",
"1",
"if",
"none",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/resources/org/apache/commons/jre/java/util/BitSet.java#L141-L145 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/resources/org/apache/commons/jre/java/util/BitSet.java | BitSet.flipMaskedWord | private static void flipMaskedWord(int[] array, int index, int from, int to) {
if (from == to) {
return;
}
to = 32 - to;
int word = wordAt(array, index);
word ^= ((0xffffffff >>> from) << (from + to)) >>> to;
array[index] = word & WORD_MASK;
} | java | private static void flipMaskedWord(int[] array, int index, int from, int to) {
if (from == to) {
return;
}
to = 32 - to;
int word = wordAt(array, index);
word ^= ((0xffffffff >>> from) << (from + to)) >>> to;
array[index] = word & WORD_MASK;
} | [
"private",
"static",
"void",
"flipMaskedWord",
"(",
"int",
"[",
"]",
"array",
",",
"int",
"index",
",",
"int",
"from",
",",
"int",
"to",
")",
"{",
"if",
"(",
"from",
"==",
"to",
")",
"{",
"return",
";",
"}",
"to",
"=",
"32",
"-",
"to",
";",
"in... | Flips all bits in a word within the given range.
@param array The array.
@param index The word index.
@param from The lower bit index.
@param to The upper bit index. | [
"Flips",
"all",
"bits",
"in",
"a",
"word",
"within",
"the",
"given",
"range",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/resources/org/apache/commons/jre/java/util/BitSet.java#L155-L164 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/resources/org/apache/commons/jre/java/util/BitSet.java | BitSet.maskInWord | private static void maskInWord(int[] array, int index, int from, int to) {
if (from == to) {
return;
}
to = 32 - to;
int word = wordAt(array, index);
word |= ((0xffffffff >>> from) << (from + to)) >>> to;
array[index] = word & WORD_MASK;
} | java | private static void maskInWord(int[] array, int index, int from, int to) {
if (from == to) {
return;
}
to = 32 - to;
int word = wordAt(array, index);
word |= ((0xffffffff >>> from) << (from + to)) >>> to;
array[index] = word & WORD_MASK;
} | [
"private",
"static",
"void",
"maskInWord",
"(",
"int",
"[",
"]",
"array",
",",
"int",
"index",
",",
"int",
"from",
",",
"int",
"to",
")",
"{",
"if",
"(",
"from",
"==",
"to",
")",
"{",
"return",
";",
"}",
"to",
"=",
"32",
"-",
"to",
";",
"int",
... | Sets all bits to true in a word within the given bit range.
@param array The array.
@param index The word index.
@param from The lower bit index.
@param to The upper bit index. | [
"Sets",
"all",
"bits",
"to",
"true",
"in",
"a",
"word",
"within",
"the",
"given",
"bit",
"range",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/resources/org/apache/commons/jre/java/util/BitSet.java#L174-L183 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/resources/org/apache/commons/jre/java/util/BitSet.java | BitSet.maskOutWord | private static void maskOutWord(int[] array, int index, int from, int to) {
if (from == to) {
return;
}
int word = wordAt(array, index);
if (word == 0) {
return;
}
int mask;
if (from != 0) {
mask = 0xffffffff >>> (32 - from);
} else {
mask = 0;
}
// Shifting by 32 is the same as shifting by 0.
if (to != 32) {
mask |= 0xffffffff << to;
}
word &= mask;
array[index] = word & WORD_MASK;
} | java | private static void maskOutWord(int[] array, int index, int from, int to) {
if (from == to) {
return;
}
int word = wordAt(array, index);
if (word == 0) {
return;
}
int mask;
if (from != 0) {
mask = 0xffffffff >>> (32 - from);
} else {
mask = 0;
}
// Shifting by 32 is the same as shifting by 0.
if (to != 32) {
mask |= 0xffffffff << to;
}
word &= mask;
array[index] = word & WORD_MASK;
} | [
"private",
"static",
"void",
"maskOutWord",
"(",
"int",
"[",
"]",
"array",
",",
"int",
"index",
",",
"int",
"from",
",",
"int",
"to",
")",
"{",
"if",
"(",
"from",
"==",
"to",
")",
"{",
"return",
";",
"}",
"int",
"word",
"=",
"wordAt",
"(",
"array... | Sets all bits to false in a word within the given bit range.
@param array The array.
@param index The word index.
@param from The lower bit index.
@param to The upper bit index. | [
"Sets",
"all",
"bits",
"to",
"false",
"in",
"a",
"word",
"within",
"the",
"given",
"bit",
"range",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/resources/org/apache/commons/jre/java/util/BitSet.java#L193-L216 | train |
ixa-ehu/ixa-pipe-pos | src/main/java/eus/ixa/ixa/pipe/pos/StatisticalTagger.java | StatisticalTagger.getMorphemes | public final List<Morpheme> getMorphemes(final String[] tokens) {
final List<String> origPosTags = posAnnotate(tokens);
final List<Morpheme> morphemes = getMorphemesFromStrings(origPosTags,
tokens);
return morphemes;
} | java | public final List<Morpheme> getMorphemes(final String[] tokens) {
final List<String> origPosTags = posAnnotate(tokens);
final List<Morpheme> morphemes = getMorphemesFromStrings(origPosTags,
tokens);
return morphemes;
} | [
"public",
"final",
"List",
"<",
"Morpheme",
">",
"getMorphemes",
"(",
"final",
"String",
"[",
"]",
"tokens",
")",
"{",
"final",
"List",
"<",
"String",
">",
"origPosTags",
"=",
"posAnnotate",
"(",
"tokens",
")",
";",
"final",
"List",
"<",
"Morpheme",
">",... | Get morphological analysis from a tokenized sentence.
@param tokens
the tokenized sentence
@return a list of {@code Morpheme} objects containing morphological info | [
"Get",
"morphological",
"analysis",
"from",
"a",
"tokenized",
"sentence",
"."
] | 083c986103f95ae8063b8ddc89a2caa8047d29b9 | https://github.com/ixa-ehu/ixa-pipe-pos/blob/083c986103f95ae8063b8ddc89a2caa8047d29b9/src/main/java/eus/ixa/ixa/pipe/pos/StatisticalTagger.java#L87-L92 | train |
ixa-ehu/ixa-pipe-pos | src/main/java/eus/ixa/ixa/pipe/pos/StatisticalTagger.java | StatisticalTagger.posAnnotate | public final List<String> posAnnotate(final String[] tokens) {
final String[] annotatedText = this.posTagger.tag(tokens);
final List<String> posTags = new ArrayList<String>(
Arrays.asList(annotatedText));
return posTags;
} | java | public final List<String> posAnnotate(final String[] tokens) {
final String[] annotatedText = this.posTagger.tag(tokens);
final List<String> posTags = new ArrayList<String>(
Arrays.asList(annotatedText));
return posTags;
} | [
"public",
"final",
"List",
"<",
"String",
">",
"posAnnotate",
"(",
"final",
"String",
"[",
"]",
"tokens",
")",
"{",
"final",
"String",
"[",
"]",
"annotatedText",
"=",
"this",
".",
"posTagger",
".",
"tag",
"(",
"tokens",
")",
";",
"final",
"List",
"<",
... | Produce postags from a tokenized sentence.
@param tokens
the sentence
@return a list containing the postags | [
"Produce",
"postags",
"from",
"a",
"tokenized",
"sentence",
"."
] | 083c986103f95ae8063b8ddc89a2caa8047d29b9 | https://github.com/ixa-ehu/ixa-pipe-pos/blob/083c986103f95ae8063b8ddc89a2caa8047d29b9/src/main/java/eus/ixa/ixa/pipe/pos/StatisticalTagger.java#L101-L106 | train |
ixa-ehu/ixa-pipe-pos | src/main/java/eus/ixa/ixa/pipe/pos/StatisticalTagger.java | StatisticalTagger.getAllPosTags | public final String[][] getAllPosTags(final String[] tokens) {
final String[][] allPosTags = this.posTagger.tag(13, tokens);
return allPosTags;
} | java | public final String[][] getAllPosTags(final String[] tokens) {
final String[][] allPosTags = this.posTagger.tag(13, tokens);
return allPosTags;
} | [
"public",
"final",
"String",
"[",
"]",
"[",
"]",
"getAllPosTags",
"(",
"final",
"String",
"[",
"]",
"tokens",
")",
"{",
"final",
"String",
"[",
"]",
"[",
"]",
"allPosTags",
"=",
"this",
".",
"posTagger",
".",
"tag",
"(",
"13",
",",
"tokens",
")",
"... | Produces a multidimensional array containing all the tagging
possible for a given sentence.
@param tokens the tokens
@return the array containing for each row the tags | [
"Produces",
"a",
"multidimensional",
"array",
"containing",
"all",
"the",
"tagging",
"possible",
"for",
"a",
"given",
"sentence",
"."
] | 083c986103f95ae8063b8ddc89a2caa8047d29b9 | https://github.com/ixa-ehu/ixa-pipe-pos/blob/083c986103f95ae8063b8ddc89a2caa8047d29b9/src/main/java/eus/ixa/ixa/pipe/pos/StatisticalTagger.java#L114-L117 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/ObjectUtils.java | ObjectUtils.median | @GwtIncompatible("incompatible method")
@SafeVarargs
public static <T extends Comparable<? super T>> T median(final T... items) {
Validate.notEmpty(items);
Validate.noNullElements(items);
final TreeSet<T> sort = new TreeSet<>();
Collections.addAll(sort, items);
@SuppressWarnings("unchecked") //we know all items added were T instances
final T result = (T) sort.toArray()[(sort.size() - 1) / 2];
return result;
} | java | @GwtIncompatible("incompatible method")
@SafeVarargs
public static <T extends Comparable<? super T>> T median(final T... items) {
Validate.notEmpty(items);
Validate.noNullElements(items);
final TreeSet<T> sort = new TreeSet<>();
Collections.addAll(sort, items);
@SuppressWarnings("unchecked") //we know all items added were T instances
final T result = (T) sort.toArray()[(sort.size() - 1) / 2];
return result;
} | [
"@",
"GwtIncompatible",
"(",
"\"incompatible method\"",
")",
"@",
"SafeVarargs",
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"T",
"median",
"(",
"final",
"T",
"...",
"items",
")",
"{",
"Validate",
".",
"notEmpty... | Find the "best guess" middle value among comparables. If there is an even
number of total values, the lower of the two middle values will be returned.
@param <T> type of values processed by this method
@param items to compare
@return T at middle position
@throws NullPointerException if items is {@code null}
@throws IllegalArgumentException if items is empty or contains {@code null} values
@since 3.0.1 | [
"Find",
"the",
"best",
"guess",
"middle",
"value",
"among",
"comparables",
".",
"If",
"there",
"is",
"an",
"even",
"number",
"of",
"total",
"values",
"the",
"lower",
"of",
"the",
"two",
"middle",
"values",
"will",
"be",
"returned",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ObjectUtils.java#L588-L598 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/ObjectUtils.java | ObjectUtils.mode | @SafeVarargs
public static <T> T mode(final T... items) {
if (ArrayUtils.isNotEmpty(items)) {
final HashMap<T, MutableInt> occurrences = new HashMap<>(items.length);
for (final T t : items) {
final MutableInt count = occurrences.get(t);
if (count == null) {
occurrences.put(t, new MutableInt(1));
} else {
count.increment();
}
}
T result = null;
int max = 0;
for (final Map.Entry<T, MutableInt> e : occurrences.entrySet()) {
final int cmp = e.getValue().intValue();
if (cmp == max) {
result = null;
} else if (cmp > max) {
max = cmp;
result = e.getKey();
}
}
return result;
}
return null;
} | java | @SafeVarargs
public static <T> T mode(final T... items) {
if (ArrayUtils.isNotEmpty(items)) {
final HashMap<T, MutableInt> occurrences = new HashMap<>(items.length);
for (final T t : items) {
final MutableInt count = occurrences.get(t);
if (count == null) {
occurrences.put(t, new MutableInt(1));
} else {
count.increment();
}
}
T result = null;
int max = 0;
for (final Map.Entry<T, MutableInt> e : occurrences.entrySet()) {
final int cmp = e.getValue().intValue();
if (cmp == max) {
result = null;
} else if (cmp > max) {
max = cmp;
result = e.getKey();
}
}
return result;
}
return null;
} | [
"@",
"SafeVarargs",
"public",
"static",
"<",
"T",
">",
"T",
"mode",
"(",
"final",
"T",
"...",
"items",
")",
"{",
"if",
"(",
"ArrayUtils",
".",
"isNotEmpty",
"(",
"items",
")",
")",
"{",
"final",
"HashMap",
"<",
"T",
",",
"MutableInt",
">",
"occurrenc... | Find the most frequently occurring item.
@param <T> type of values processed by this method
@param items to check
@return most populous T, {@code null} if non-unique or no items supplied
@since 3.0.1 | [
"Find",
"the",
"most",
"frequently",
"occurring",
"item",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ObjectUtils.java#L635-L661 | train |
ixa-ehu/ixa-pipe-pos | src/main/java/eus/ixa/ixa/pipe/pos/eval/POSCrossValidator.java | POSCrossValidator.crossValidate | public final void crossValidate(final TrainingParameters params) {
POSTaggerCrossValidator validator = null;
try {
validator = getPOSTaggerCrossValidator(params);
validator.evaluate(this.trainSamples, this.folds);
} catch (final IOException e) {
System.err.println("IO error while loading training set!");
e.printStackTrace();
System.exit(1);
} finally {
try {
this.trainSamples.close();
} catch (final IOException e) {
System.err.println("IO error with the train samples!");
}
}
if (this.detailedListener == null) {
System.out.println(validator.getWordAccuracy());
} else {
// TODO add detailed evaluation here
System.out.println(validator.getWordAccuracy());
}
} | java | public final void crossValidate(final TrainingParameters params) {
POSTaggerCrossValidator validator = null;
try {
validator = getPOSTaggerCrossValidator(params);
validator.evaluate(this.trainSamples, this.folds);
} catch (final IOException e) {
System.err.println("IO error while loading training set!");
e.printStackTrace();
System.exit(1);
} finally {
try {
this.trainSamples.close();
} catch (final IOException e) {
System.err.println("IO error with the train samples!");
}
}
if (this.detailedListener == null) {
System.out.println(validator.getWordAccuracy());
} else {
// TODO add detailed evaluation here
System.out.println(validator.getWordAccuracy());
}
} | [
"public",
"final",
"void",
"crossValidate",
"(",
"final",
"TrainingParameters",
"params",
")",
"{",
"POSTaggerCrossValidator",
"validator",
"=",
"null",
";",
"try",
"{",
"validator",
"=",
"getPOSTaggerCrossValidator",
"(",
"params",
")",
";",
"validator",
".",
"ev... | Cross validate when no separate testset is available.
@param params
the training parameters | [
"Cross",
"validate",
"when",
"no",
"separate",
"testset",
"is",
"available",
"."
] | 083c986103f95ae8063b8ddc89a2caa8047d29b9 | https://github.com/ixa-ehu/ixa-pipe-pos/blob/083c986103f95ae8063b8ddc89a2caa8047d29b9/src/main/java/eus/ixa/ixa/pipe/pos/eval/POSCrossValidator.java#L121-L144 | train |
ixa-ehu/ixa-pipe-pos | src/main/java/eus/ixa/ixa/pipe/pos/eval/POSCrossValidator.java | POSCrossValidator.getPOSTaggerCrossValidator | private POSTaggerCrossValidator getPOSTaggerCrossValidator(
final TrainingParameters params) {
final File dictPath = new File(Flags.getDictionaryFeatures(params));
// features
if (this.posTaggerFactory == null) {
throw new IllegalStateException(
"You must create the POSTaggerFactory features!");
}
POSTaggerCrossValidator validator = null;
if (dictPath.getName().equals(Flags.DEFAULT_DICT_PATH)) {
if (this.dictCutOff == Flags.DEFAULT_DICT_CUTOFF) {
validator = new POSTaggerCrossValidator(this.lang, params, null, null,
null, this.posTaggerFactory.getClass().getName(),
this.listeners
.toArray(new POSTaggerEvaluationMonitor[this.listeners.size()]));
} else {
validator = new POSTaggerCrossValidator(this.lang, params, null, null,
this.dictCutOff, this.posTaggerFactory.getClass().getName(),
this.listeners
.toArray(new POSTaggerEvaluationMonitor[this.listeners.size()]));
}
} else {
if (this.dictCutOff == Flags.DEFAULT_DICT_CUTOFF) {
validator = new POSTaggerCrossValidator(this.lang, params, dictPath,
null, null, this.posTaggerFactory.getClass().getName(),
this.listeners
.toArray(new POSTaggerEvaluationMonitor[this.listeners.size()]));
} else {
validator = new POSTaggerCrossValidator(this.lang, params, dictPath,
null, this.dictCutOff, this.posTaggerFactory.getClass().getName(),
this.listeners
.toArray(new POSTaggerEvaluationMonitor[this.listeners.size()]));
}
}
return validator;
} | java | private POSTaggerCrossValidator getPOSTaggerCrossValidator(
final TrainingParameters params) {
final File dictPath = new File(Flags.getDictionaryFeatures(params));
// features
if (this.posTaggerFactory == null) {
throw new IllegalStateException(
"You must create the POSTaggerFactory features!");
}
POSTaggerCrossValidator validator = null;
if (dictPath.getName().equals(Flags.DEFAULT_DICT_PATH)) {
if (this.dictCutOff == Flags.DEFAULT_DICT_CUTOFF) {
validator = new POSTaggerCrossValidator(this.lang, params, null, null,
null, this.posTaggerFactory.getClass().getName(),
this.listeners
.toArray(new POSTaggerEvaluationMonitor[this.listeners.size()]));
} else {
validator = new POSTaggerCrossValidator(this.lang, params, null, null,
this.dictCutOff, this.posTaggerFactory.getClass().getName(),
this.listeners
.toArray(new POSTaggerEvaluationMonitor[this.listeners.size()]));
}
} else {
if (this.dictCutOff == Flags.DEFAULT_DICT_CUTOFF) {
validator = new POSTaggerCrossValidator(this.lang, params, dictPath,
null, null, this.posTaggerFactory.getClass().getName(),
this.listeners
.toArray(new POSTaggerEvaluationMonitor[this.listeners.size()]));
} else {
validator = new POSTaggerCrossValidator(this.lang, params, dictPath,
null, this.dictCutOff, this.posTaggerFactory.getClass().getName(),
this.listeners
.toArray(new POSTaggerEvaluationMonitor[this.listeners.size()]));
}
}
return validator;
} | [
"private",
"POSTaggerCrossValidator",
"getPOSTaggerCrossValidator",
"(",
"final",
"TrainingParameters",
"params",
")",
"{",
"final",
"File",
"dictPath",
"=",
"new",
"File",
"(",
"Flags",
".",
"getDictionaryFeatures",
"(",
"params",
")",
")",
";",
"// features",
"if"... | Get the postagger cross validator.
@param params
the training parameters
@return the pos tagger cross validator | [
"Get",
"the",
"postagger",
"cross",
"validator",
"."
] | 083c986103f95ae8063b8ddc89a2caa8047d29b9 | https://github.com/ixa-ehu/ixa-pipe-pos/blob/083c986103f95ae8063b8ddc89a2caa8047d29b9/src/main/java/eus/ixa/ixa/pipe/pos/eval/POSCrossValidator.java#L153-L188 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | TypeUtils.extractTypeArgumentsFrom | private static Type[] extractTypeArgumentsFrom(final Map<TypeVariable<?>, Type> mappings, final TypeVariable<?>[] variables) {
final Type[] result = new Type[variables.length];
int index = 0;
for (final TypeVariable<?> var : variables) {
Validate.isTrue(mappings.containsKey(var), "missing argument mapping for %s", toString(var));
result[index++] = mappings.get(var);
}
return result;
} | java | private static Type[] extractTypeArgumentsFrom(final Map<TypeVariable<?>, Type> mappings, final TypeVariable<?>[] variables) {
final Type[] result = new Type[variables.length];
int index = 0;
for (final TypeVariable<?> var : variables) {
Validate.isTrue(mappings.containsKey(var), "missing argument mapping for %s", toString(var));
result[index++] = mappings.get(var);
}
return result;
} | [
"private",
"static",
"Type",
"[",
"]",
"extractTypeArgumentsFrom",
"(",
"final",
"Map",
"<",
"TypeVariable",
"<",
"?",
">",
",",
"Type",
">",
"mappings",
",",
"final",
"TypeVariable",
"<",
"?",
">",
"[",
"]",
"variables",
")",
"{",
"final",
"Type",
"[",
... | Helper method to establish the formal parameters for a parameterized type.
@param mappings map containing the assignments
@param variables expected map keys
@return array of map values corresponding to specified keys | [
"Helper",
"method",
"to",
"establish",
"the",
"formal",
"parameters",
"for",
"a",
"parameterized",
"type",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java#L1537-L1545 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java | StrSubstitutor.replace | public static <V> String replace(final Object source, final Map<String, V> valueMap) {
return new StrSubstitutor(valueMap).replace(source);
} | java | public static <V> String replace(final Object source, final Map<String, V> valueMap) {
return new StrSubstitutor(valueMap).replace(source);
} | [
"public",
"static",
"<",
"V",
">",
"String",
"replace",
"(",
"final",
"Object",
"source",
",",
"final",
"Map",
"<",
"String",
",",
"V",
">",
"valueMap",
")",
"{",
"return",
"new",
"StrSubstitutor",
"(",
"valueMap",
")",
".",
"replace",
"(",
"source",
"... | Replaces all the occurrences of variables in the given source object with
their matching values from the map.
@param <V> the type of the values in the map
@param source the source text containing the variables to substitute, null returns null
@param valueMap the map with the values, may be null
@return the result of the replace operation | [
"Replaces",
"all",
"the",
"occurrences",
"of",
"variables",
"in",
"the",
"given",
"source",
"object",
"with",
"their",
"matching",
"values",
"from",
"the",
"map",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java#L191-L193 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java | StrSubstitutor.replace | public static <V> String replace(final Object source, final Map<String, V> valueMap, final String prefix, final String suffix) {
return new StrSubstitutor(valueMap, prefix, suffix).replace(source);
} | java | public static <V> String replace(final Object source, final Map<String, V> valueMap, final String prefix, final String suffix) {
return new StrSubstitutor(valueMap, prefix, suffix).replace(source);
} | [
"public",
"static",
"<",
"V",
">",
"String",
"replace",
"(",
"final",
"Object",
"source",
",",
"final",
"Map",
"<",
"String",
",",
"V",
">",
"valueMap",
",",
"final",
"String",
"prefix",
",",
"final",
"String",
"suffix",
")",
"{",
"return",
"new",
"Str... | Replaces all the occurrences of variables in the given source object with
their matching values from the map. This method allows to specify a
custom variable prefix and suffix
@param <V> the type of the values in the map
@param source the source text containing the variables to substitute, null returns null
@param valueMap the map with the values, may be null
@param prefix the prefix of variables, not null
@param suffix the suffix of variables, not null
@return the result of the replace operation
@throws IllegalArgumentException if the prefix or suffix is null | [
"Replaces",
"all",
"the",
"occurrences",
"of",
"variables",
"in",
"the",
"given",
"source",
"object",
"with",
"their",
"matching",
"values",
"from",
"the",
"map",
".",
"This",
"method",
"allows",
"to",
"specify",
"a",
"custom",
"variable",
"prefix",
"and",
"... | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java#L208-L210 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java | StrSubstitutor.replace | public static String replace(final Object source, final Properties valueProperties) {
if (valueProperties == null) {
return source.toString();
}
final Map<String,String> valueMap = new HashMap<>();
final Enumeration<?> propNames = valueProperties.propertyNames();
while (propNames.hasMoreElements()) {
final String propName = (String)propNames.nextElement();
final String propValue = valueProperties.getProperty(propName);
valueMap.put(propName, propValue);
}
return StrSubstitutor.replace(source, valueMap);
} | java | public static String replace(final Object source, final Properties valueProperties) {
if (valueProperties == null) {
return source.toString();
}
final Map<String,String> valueMap = new HashMap<>();
final Enumeration<?> propNames = valueProperties.propertyNames();
while (propNames.hasMoreElements()) {
final String propName = (String)propNames.nextElement();
final String propValue = valueProperties.getProperty(propName);
valueMap.put(propName, propValue);
}
return StrSubstitutor.replace(source, valueMap);
} | [
"public",
"static",
"String",
"replace",
"(",
"final",
"Object",
"source",
",",
"final",
"Properties",
"valueProperties",
")",
"{",
"if",
"(",
"valueProperties",
"==",
"null",
")",
"{",
"return",
"source",
".",
"toString",
"(",
")",
";",
"}",
"final",
"Map... | Replaces all the occurrences of variables in the given source object with their matching
values from the properties.
@param source the source text containing the variables to substitute, null returns null
@param valueProperties the properties with values, may be null
@return the result of the replace operation | [
"Replaces",
"all",
"the",
"occurrences",
"of",
"variables",
"in",
"the",
"given",
"source",
"object",
"with",
"their",
"matching",
"values",
"from",
"the",
"properties",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java#L220-L232 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java | StrSubstitutor.replace | public String replace(final CharSequence source) {
if (source == null) {
return null;
}
return replace(source, 0, source.length());
} | java | public String replace(final CharSequence source) {
if (source == null) {
return null;
}
return replace(source, 0, source.length());
} | [
"public",
"String",
"replace",
"(",
"final",
"CharSequence",
"source",
")",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"replace",
"(",
"source",
",",
"0",
",",
"source",
".",
"length",
"(",
")",
")",
";",
... | Replaces all the occurrences of variables with their matching values
from the resolver using the given source as a template.
The source is not altered by this method.
@param source the buffer to use as a template, not changed, null returns null
@return the result of the replace operation
@since 3.2 | [
"Replaces",
"all",
"the",
"occurrences",
"of",
"variables",
"with",
"their",
"matching",
"values",
"from",
"the",
"resolver",
"using",
"the",
"given",
"source",
"as",
"a",
"template",
".",
"The",
"source",
"is",
"not",
"altered",
"by",
"this",
"method",
"."
... | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java#L524-L529 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java | StrSubstitutor.replace | public String replace(final StrBuilder source) {
if (source == null) {
return null;
}
final StrBuilder buf = new StrBuilder(source.length()).append(source);
substitute(buf, 0, buf.length());
return buf.toString();
} | java | public String replace(final StrBuilder source) {
if (source == null) {
return null;
}
final StrBuilder buf = new StrBuilder(source.length()).append(source);
substitute(buf, 0, buf.length());
return buf.toString();
} | [
"public",
"String",
"replace",
"(",
"final",
"StrBuilder",
"source",
")",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"StrBuilder",
"buf",
"=",
"new",
"StrBuilder",
"(",
"source",
".",
"length",
"(",
")",
")",... | Replaces all the occurrences of variables with their matching values
from the resolver using the given source builder as a template.
The builder is not altered by this method.
@param source the builder to use as a template, not changed, null returns null
@return the result of the replace operation | [
"Replaces",
"all",
"the",
"occurrences",
"of",
"variables",
"with",
"their",
"matching",
"values",
"from",
"the",
"resolver",
"using",
"the",
"given",
"source",
"builder",
"as",
"a",
"template",
".",
"The",
"builder",
"is",
"not",
"altered",
"by",
"this",
"m... | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java#L563-L570 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java | StrSubstitutor.replaceIn | public boolean replaceIn(final StrBuilder source) {
if (source == null) {
return false;
}
return substitute(source, 0, source.length());
} | java | public boolean replaceIn(final StrBuilder source) {
if (source == null) {
return false;
}
return substitute(source, 0, source.length());
} | [
"public",
"boolean",
"replaceIn",
"(",
"final",
"StrBuilder",
"source",
")",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"return",
"substitute",
"(",
"source",
",",
"0",
",",
"source",
".",
"length",
"(",
")",
")",
... | Replaces all the occurrences of variables within the given source
builder with their matching values from the resolver.
@param source the builder to replace in, updated, null returns zero
@return true if altered | [
"Replaces",
"all",
"the",
"occurrences",
"of",
"variables",
"within",
"the",
"given",
"source",
"builder",
"with",
"their",
"matching",
"values",
"from",
"the",
"resolver",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java#L704-L709 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/tuple/ImmutableTriple.java | ImmutableTriple.nullTriple | @SuppressWarnings("unchecked")
public static <L, M, R> ImmutableTriple<L, M, R> nullTriple() {
return NULL;
} | java | @SuppressWarnings("unchecked")
public static <L, M, R> ImmutableTriple<L, M, R> nullTriple() {
return NULL;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"L",
",",
"M",
",",
"R",
">",
"ImmutableTriple",
"<",
"L",
",",
"M",
",",
"R",
">",
"nullTriple",
"(",
")",
"{",
"return",
"NULL",
";",
"}"
] | Returns an immutable triple of nulls.
@param <L> the left element of this triple. Value is {@code null}.
@param <M> the middle element of this triple. Value is {@code null}.
@param <R> the right element of this triple. Value is {@code null}.
@return an immutable triple of nulls.
@since 3.6 | [
"Returns",
"an",
"immutable",
"triple",
"of",
"nulls",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/tuple/ImmutableTriple.java#L56-L59 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java | DurationFormatUtils.lexx | static Token[] lexx(final String format) {
final ArrayList<Token> list = new ArrayList<>(format.length());
boolean inLiteral = false;
// Although the buffer is stored in a Token, the Tokens are only
// used internally, so cannot be accessed by other threads
StringBuilder buffer = null;
Token previous = null;
for (int i = 0; i < format.length(); i++) {
final char ch = format.charAt(i);
if (inLiteral && ch != '\'') {
buffer.append(ch); // buffer can't be null if inLiteral is true
continue;
}
Object value = null;
switch (ch) {
// TODO: Need to handle escaping of '
case '\'':
if (inLiteral) {
buffer = null;
inLiteral = false;
} else {
buffer = new StringBuilder();
list.add(new Token(buffer));
inLiteral = true;
}
break;
case 'y':
value = y;
break;
case 'M':
value = M;
break;
case 'd':
value = d;
break;
case 'H':
value = H;
break;
case 'm':
value = m;
break;
case 's':
value = s;
break;
case 'S':
value = S;
break;
default:
if (buffer == null) {
buffer = new StringBuilder();
list.add(new Token(buffer));
}
buffer.append(ch);
}
if (value != null) {
if (previous != null && previous.getValue().equals(value)) {
previous.increment();
} else {
final Token token = new Token(value);
list.add(token);
previous = token;
}
buffer = null;
}
}
if (inLiteral) { // i.e. we have not found the end of the literal
throw new IllegalArgumentException("Unmatched quote in format: " + format);
}
return list.toArray(new Token[list.size()]);
} | java | static Token[] lexx(final String format) {
final ArrayList<Token> list = new ArrayList<>(format.length());
boolean inLiteral = false;
// Although the buffer is stored in a Token, the Tokens are only
// used internally, so cannot be accessed by other threads
StringBuilder buffer = null;
Token previous = null;
for (int i = 0; i < format.length(); i++) {
final char ch = format.charAt(i);
if (inLiteral && ch != '\'') {
buffer.append(ch); // buffer can't be null if inLiteral is true
continue;
}
Object value = null;
switch (ch) {
// TODO: Need to handle escaping of '
case '\'':
if (inLiteral) {
buffer = null;
inLiteral = false;
} else {
buffer = new StringBuilder();
list.add(new Token(buffer));
inLiteral = true;
}
break;
case 'y':
value = y;
break;
case 'M':
value = M;
break;
case 'd':
value = d;
break;
case 'H':
value = H;
break;
case 'm':
value = m;
break;
case 's':
value = s;
break;
case 'S':
value = S;
break;
default:
if (buffer == null) {
buffer = new StringBuilder();
list.add(new Token(buffer));
}
buffer.append(ch);
}
if (value != null) {
if (previous != null && previous.getValue().equals(value)) {
previous.increment();
} else {
final Token token = new Token(value);
list.add(token);
previous = token;
}
buffer = null;
}
}
if (inLiteral) { // i.e. we have not found the end of the literal
throw new IllegalArgumentException("Unmatched quote in format: " + format);
}
return list.toArray(new Token[list.size()]);
} | [
"static",
"Token",
"[",
"]",
"lexx",
"(",
"final",
"String",
"format",
")",
"{",
"final",
"ArrayList",
"<",
"Token",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
"format",
".",
"length",
"(",
")",
")",
";",
"boolean",
"inLiteral",
"=",
"false",
"... | Parses a classic date format string into Tokens
@param format the format to parse, not null
@return array of Token[] | [
"Parses",
"a",
"classic",
"date",
"format",
"string",
"into",
"Tokens"
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java#L499-L570 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.setNullText | public StrBuilder setNullText(String nullText) {
if (nullText != null && nullText.isEmpty()) {
nullText = null;
}
this.nullText = nullText;
return this;
} | java | public StrBuilder setNullText(String nullText) {
if (nullText != null && nullText.isEmpty()) {
nullText = null;
}
this.nullText = nullText;
return this;
} | [
"public",
"StrBuilder",
"setNullText",
"(",
"String",
"nullText",
")",
"{",
"if",
"(",
"nullText",
"!=",
"null",
"&&",
"nullText",
".",
"isEmpty",
"(",
")",
")",
"{",
"nullText",
"=",
"null",
";",
"}",
"this",
".",
"nullText",
"=",
"nullText",
";",
"re... | Sets the text to be appended when null is added.
@param nullText the null text, null means no append
@return this, to enable chaining | [
"Sets",
"the",
"text",
"to",
"be",
"appended",
"when",
"null",
"is",
"added",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L180-L186 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.setLength | public StrBuilder setLength(final int length) {
if (length < 0) {
throw new StringIndexOutOfBoundsException(length);
}
if (length < size) {
size = length;
} else if (length > size) {
ensureCapacity(length);
final int oldEnd = size;
final int newEnd = length;
size = length;
for (int i = oldEnd; i < newEnd; i++) {
buffer[i] = CharUtils.NUL;
}
}
return this;
} | java | public StrBuilder setLength(final int length) {
if (length < 0) {
throw new StringIndexOutOfBoundsException(length);
}
if (length < size) {
size = length;
} else if (length > size) {
ensureCapacity(length);
final int oldEnd = size;
final int newEnd = length;
size = length;
for (int i = oldEnd; i < newEnd; i++) {
buffer[i] = CharUtils.NUL;
}
}
return this;
} | [
"public",
"StrBuilder",
"setLength",
"(",
"final",
"int",
"length",
")",
"{",
"if",
"(",
"length",
"<",
"0",
")",
"{",
"throw",
"new",
"StringIndexOutOfBoundsException",
"(",
"length",
")",
";",
"}",
"if",
"(",
"length",
"<",
"size",
")",
"{",
"size",
... | Updates the length of the builder by either dropping the last characters
or adding filler of Unicode zero.
@param length the length to set to, must be zero or positive
@return this, to enable chaining
@throws IndexOutOfBoundsException if the length is negative | [
"Updates",
"the",
"length",
"of",
"the",
"builder",
"by",
"either",
"dropping",
"the",
"last",
"characters",
"or",
"adding",
"filler",
"of",
"Unicode",
"zero",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L207-L223 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.ensureCapacity | public StrBuilder ensureCapacity(final int capacity) {
if (capacity > buffer.length) {
final char[] old = buffer;
buffer = new char[capacity * 2];
System.arraycopy(old, 0, buffer, 0, size);
}
return this;
} | java | public StrBuilder ensureCapacity(final int capacity) {
if (capacity > buffer.length) {
final char[] old = buffer;
buffer = new char[capacity * 2];
System.arraycopy(old, 0, buffer, 0, size);
}
return this;
} | [
"public",
"StrBuilder",
"ensureCapacity",
"(",
"final",
"int",
"capacity",
")",
"{",
"if",
"(",
"capacity",
">",
"buffer",
".",
"length",
")",
"{",
"final",
"char",
"[",
"]",
"old",
"=",
"buffer",
";",
"buffer",
"=",
"new",
"char",
"[",
"capacity",
"*"... | Checks the capacity and ensures that it is at least the size specified.
@param capacity the capacity to ensure
@return this, to enable chaining | [
"Checks",
"the",
"capacity",
"and",
"ensures",
"that",
"it",
"is",
"at",
"least",
"the",
"size",
"specified",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L241-L248 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.minimizeCapacity | public StrBuilder minimizeCapacity() {
if (buffer.length > length()) {
final char[] old = buffer;
buffer = new char[length()];
System.arraycopy(old, 0, buffer, 0, size);
}
return this;
} | java | public StrBuilder minimizeCapacity() {
if (buffer.length > length()) {
final char[] old = buffer;
buffer = new char[length()];
System.arraycopy(old, 0, buffer, 0, size);
}
return this;
} | [
"public",
"StrBuilder",
"minimizeCapacity",
"(",
")",
"{",
"if",
"(",
"buffer",
".",
"length",
">",
"length",
"(",
")",
")",
"{",
"final",
"char",
"[",
"]",
"old",
"=",
"buffer",
";",
"buffer",
"=",
"new",
"char",
"[",
"length",
"(",
")",
"]",
";",... | Minimizes the capacity to the actual length of the string.
@return this, to enable chaining | [
"Minimizes",
"the",
"capacity",
"to",
"the",
"actual",
"length",
"of",
"the",
"string",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L255-L262 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.setCharAt | public StrBuilder setCharAt(final int index, final char ch) {
if (index < 0 || index >= length()) {
throw new StringIndexOutOfBoundsException(index);
}
buffer[index] = ch;
return this;
} | java | public StrBuilder setCharAt(final int index, final char ch) {
if (index < 0 || index >= length()) {
throw new StringIndexOutOfBoundsException(index);
}
buffer[index] = ch;
return this;
} | [
"public",
"StrBuilder",
"setCharAt",
"(",
"final",
"int",
"index",
",",
"final",
"char",
"ch",
")",
"{",
"if",
"(",
"index",
"<",
"0",
"||",
"index",
">=",
"length",
"(",
")",
")",
"{",
"throw",
"new",
"StringIndexOutOfBoundsException",
"(",
"index",
")"... | Sets the character at the specified index.
@see #charAt(int)
@see #deleteCharAt(int)
@param index the index to set
@param ch the new character
@return this, to enable chaining
@throws IndexOutOfBoundsException if the index is invalid | [
"Sets",
"the",
"character",
"at",
"the",
"specified",
"index",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L333-L339 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.deleteCharAt | public StrBuilder deleteCharAt(final int index) {
if (index < 0 || index >= size) {
throw new StringIndexOutOfBoundsException(index);
}
deleteImpl(index, index + 1, 1);
return this;
} | java | public StrBuilder deleteCharAt(final int index) {
if (index < 0 || index >= size) {
throw new StringIndexOutOfBoundsException(index);
}
deleteImpl(index, index + 1, 1);
return this;
} | [
"public",
"StrBuilder",
"deleteCharAt",
"(",
"final",
"int",
"index",
")",
"{",
"if",
"(",
"index",
"<",
"0",
"||",
"index",
">=",
"size",
")",
"{",
"throw",
"new",
"StringIndexOutOfBoundsException",
"(",
"index",
")",
";",
"}",
"deleteImpl",
"(",
"index",... | Deletes the character at the specified index.
@see #charAt(int)
@see #setCharAt(int, char)
@param index the index to delete
@return this, to enable chaining
@throws IndexOutOfBoundsException if the index is invalid | [
"Deletes",
"the",
"character",
"at",
"the",
"specified",
"index",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L350-L356 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.toCharArray | public char[] toCharArray() {
if (size == 0) {
return ArrayUtils.EMPTY_CHAR_ARRAY;
}
final char chars[] = new char[size];
System.arraycopy(buffer, 0, chars, 0, size);
return chars;
} | java | public char[] toCharArray() {
if (size == 0) {
return ArrayUtils.EMPTY_CHAR_ARRAY;
}
final char chars[] = new char[size];
System.arraycopy(buffer, 0, chars, 0, size);
return chars;
} | [
"public",
"char",
"[",
"]",
"toCharArray",
"(",
")",
"{",
"if",
"(",
"size",
"==",
"0",
")",
"{",
"return",
"ArrayUtils",
".",
"EMPTY_CHAR_ARRAY",
";",
"}",
"final",
"char",
"chars",
"[",
"]",
"=",
"new",
"char",
"[",
"size",
"]",
";",
"System",
".... | Copies the builder's character array into a new character array.
@return a new array that represents the contents of the builder | [
"Copies",
"the",
"builder",
"s",
"character",
"array",
"into",
"a",
"new",
"character",
"array",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L364-L371 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.toCharArray | public char[] toCharArray(final int startIndex, int endIndex) {
endIndex = validateRange(startIndex, endIndex);
final int len = endIndex - startIndex;
if (len == 0) {
return ArrayUtils.EMPTY_CHAR_ARRAY;
}
final char chars[] = new char[len];
System.arraycopy(buffer, startIndex, chars, 0, len);
return chars;
} | java | public char[] toCharArray(final int startIndex, int endIndex) {
endIndex = validateRange(startIndex, endIndex);
final int len = endIndex - startIndex;
if (len == 0) {
return ArrayUtils.EMPTY_CHAR_ARRAY;
}
final char chars[] = new char[len];
System.arraycopy(buffer, startIndex, chars, 0, len);
return chars;
} | [
"public",
"char",
"[",
"]",
"toCharArray",
"(",
"final",
"int",
"startIndex",
",",
"int",
"endIndex",
")",
"{",
"endIndex",
"=",
"validateRange",
"(",
"startIndex",
",",
"endIndex",
")",
";",
"final",
"int",
"len",
"=",
"endIndex",
"-",
"startIndex",
";",
... | Copies part of the builder's character array into a new character array.
@param startIndex the start index, inclusive, must be valid
@param endIndex the end index, exclusive, must be valid except that
if too large it is treated as end of string
@return a new array that holds part of the contents of the builder
@throws IndexOutOfBoundsException if startIndex is invalid,
or if endIndex is invalid (but endIndex greater than size is valid) | [
"Copies",
"part",
"of",
"the",
"builder",
"s",
"character",
"array",
"into",
"a",
"new",
"character",
"array",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L383-L392 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.append | public StrBuilder append(final boolean value) {
if (value) {
ensureCapacity(size + 4);
buffer[size++] = 't';
buffer[size++] = 'r';
buffer[size++] = 'u';
buffer[size++] = 'e';
} else {
ensureCapacity(size + 5);
buffer[size++] = 'f';
buffer[size++] = 'a';
buffer[size++] = 'l';
buffer[size++] = 's';
buffer[size++] = 'e';
}
return this;
} | java | public StrBuilder append(final boolean value) {
if (value) {
ensureCapacity(size + 4);
buffer[size++] = 't';
buffer[size++] = 'r';
buffer[size++] = 'u';
buffer[size++] = 'e';
} else {
ensureCapacity(size + 5);
buffer[size++] = 'f';
buffer[size++] = 'a';
buffer[size++] = 'l';
buffer[size++] = 's';
buffer[size++] = 'e';
}
return this;
} | [
"public",
"StrBuilder",
"append",
"(",
"final",
"boolean",
"value",
")",
"{",
"if",
"(",
"value",
")",
"{",
"ensureCapacity",
"(",
"size",
"+",
"4",
")",
";",
"buffer",
"[",
"size",
"++",
"]",
"=",
"'",
"'",
";",
"buffer",
"[",
"size",
"++",
"]",
... | Appends a boolean value to the string builder.
@param value the value to append
@return this, to enable chaining | [
"Appends",
"a",
"boolean",
"value",
"to",
"the",
"string",
"builder",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L882-L898 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.append | @Override
public StrBuilder append(final char ch) {
final int len = length();
ensureCapacity(len + 1);
buffer[size++] = ch;
return this;
} | java | @Override
public StrBuilder append(final char ch) {
final int len = length();
ensureCapacity(len + 1);
buffer[size++] = ch;
return this;
} | [
"@",
"Override",
"public",
"StrBuilder",
"append",
"(",
"final",
"char",
"ch",
")",
"{",
"final",
"int",
"len",
"=",
"length",
"(",
")",
";",
"ensureCapacity",
"(",
"len",
"+",
"1",
")",
";",
"buffer",
"[",
"size",
"++",
"]",
"=",
"ch",
";",
"retur... | Appends a char value to the string builder.
@param ch the value to append
@return this, to enable chaining
@since 3.0 | [
"Appends",
"a",
"char",
"value",
"to",
"the",
"string",
"builder",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L907-L913 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.appendSeparator | public StrBuilder appendSeparator(final String standard, final String defaultIfEmpty) {
final String str = isEmpty() ? defaultIfEmpty : standard;
if (str != null) {
append(str);
}
return this;
} | java | public StrBuilder appendSeparator(final String standard, final String defaultIfEmpty) {
final String str = isEmpty() ? defaultIfEmpty : standard;
if (str != null) {
append(str);
}
return this;
} | [
"public",
"StrBuilder",
"appendSeparator",
"(",
"final",
"String",
"standard",
",",
"final",
"String",
"defaultIfEmpty",
")",
"{",
"final",
"String",
"str",
"=",
"isEmpty",
"(",
")",
"?",
"defaultIfEmpty",
":",
"standard",
";",
"if",
"(",
"str",
"!=",
"null"... | Appends one of both separators to the StrBuilder.
If the builder is currently empty it will append the defaultIfEmpty-separator
Otherwise it will append the standard-separator
Appending a null separator will have no effect.
The separator is appended using {@link #append(String)}.
<p>
This method is for example useful for constructing queries
<pre>
StrBuilder whereClause = new StrBuilder();
if(searchCommand.getPriority() != null) {
whereClause.appendSeparator(" and", " where");
whereClause.append(" priority = ?")
}
if(searchCommand.getComponent() != null) {
whereClause.appendSeparator(" and", " where");
whereClause.append(" component = ?")
}
selectClause.append(whereClause)
</pre>
@param standard the separator if builder is not empty, null means no separator
@param defaultIfEmpty the separator if builder is empty, null means no separator
@return this, to enable chaining
@since 2.5 | [
"Appends",
"one",
"of",
"both",
"separators",
"to",
"the",
"StrBuilder",
".",
"If",
"the",
"builder",
"is",
"currently",
"empty",
"it",
"will",
"append",
"the",
"defaultIfEmpty",
"-",
"separator",
"Otherwise",
"it",
"will",
"append",
"the",
"standard",
"-",
... | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L1362-L1368 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.appendPadding | public StrBuilder appendPadding(final int length, final char padChar) {
if (length >= 0) {
ensureCapacity(size + length);
for (int i = 0; i < length; i++) {
buffer[size++] = padChar;
}
}
return this;
} | java | public StrBuilder appendPadding(final int length, final char padChar) {
if (length >= 0) {
ensureCapacity(size + length);
for (int i = 0; i < length; i++) {
buffer[size++] = padChar;
}
}
return this;
} | [
"public",
"StrBuilder",
"appendPadding",
"(",
"final",
"int",
"length",
",",
"final",
"char",
"padChar",
")",
"{",
"if",
"(",
"length",
">=",
"0",
")",
"{",
"ensureCapacity",
"(",
"size",
"+",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";"... | Appends the pad character to the builder the specified number of times.
@param length the length to append, negative means no append
@param padChar the character to append
@return this, to enable chaining | [
"Appends",
"the",
"pad",
"character",
"to",
"the",
"builder",
"the",
"specified",
"number",
"of",
"times",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L1480-L1488 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.insert | public StrBuilder insert(final int index, final Object obj) {
if (obj == null) {
return insert(index, nullText);
}
return insert(index, obj.toString());
} | java | public StrBuilder insert(final int index, final Object obj) {
if (obj == null) {
return insert(index, nullText);
}
return insert(index, obj.toString());
} | [
"public",
"StrBuilder",
"insert",
"(",
"final",
"int",
"index",
",",
"final",
"Object",
"obj",
")",
"{",
"if",
"(",
"obj",
"==",
"null",
")",
"{",
"return",
"insert",
"(",
"index",
",",
"nullText",
")",
";",
"}",
"return",
"insert",
"(",
"index",
","... | Inserts the string representation of an object into this builder.
Inserting null will use the stored null text value.
@param index the index to add at, must be valid
@param obj the object to insert
@return this, to enable chaining
@throws IndexOutOfBoundsException if the index is invalid | [
"Inserts",
"the",
"string",
"representation",
"of",
"an",
"object",
"into",
"this",
"builder",
".",
"Inserting",
"null",
"will",
"use",
"the",
"stored",
"null",
"text",
"value",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L1595-L1600 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.insert | public StrBuilder insert(final int index, String str) {
validateIndex(index);
if (str == null) {
str = nullText;
}
if (str != null) {
final int strLen = str.length();
if (strLen > 0) {
final int newSize = size + strLen;
ensureCapacity(newSize);
System.arraycopy(buffer, index, buffer, index + strLen, size - index);
size = newSize;
str.getChars(0, strLen, buffer, index);
}
}
return this;
} | java | public StrBuilder insert(final int index, String str) {
validateIndex(index);
if (str == null) {
str = nullText;
}
if (str != null) {
final int strLen = str.length();
if (strLen > 0) {
final int newSize = size + strLen;
ensureCapacity(newSize);
System.arraycopy(buffer, index, buffer, index + strLen, size - index);
size = newSize;
str.getChars(0, strLen, buffer, index);
}
}
return this;
} | [
"public",
"StrBuilder",
"insert",
"(",
"final",
"int",
"index",
",",
"String",
"str",
")",
"{",
"validateIndex",
"(",
"index",
")",
";",
"if",
"(",
"str",
"==",
"null",
")",
"{",
"str",
"=",
"nullText",
";",
"}",
"if",
"(",
"str",
"!=",
"null",
")"... | Inserts the string into this builder.
Inserting null will use the stored null text value.
@param index the index to add at, must be valid
@param str the string to insert
@return this, to enable chaining
@throws IndexOutOfBoundsException if the index is invalid | [
"Inserts",
"the",
"string",
"into",
"this",
"builder",
".",
"Inserting",
"null",
"will",
"use",
"the",
"stored",
"null",
"text",
"value",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L1611-L1627 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.insert | public StrBuilder insert(final int index, final char chars[]) {
validateIndex(index);
if (chars == null) {
return insert(index, nullText);
}
final int len = chars.length;
if (len > 0) {
ensureCapacity(size + len);
System.arraycopy(buffer, index, buffer, index + len, size - index);
System.arraycopy(chars, 0, buffer, index, len);
size += len;
}
return this;
} | java | public StrBuilder insert(final int index, final char chars[]) {
validateIndex(index);
if (chars == null) {
return insert(index, nullText);
}
final int len = chars.length;
if (len > 0) {
ensureCapacity(size + len);
System.arraycopy(buffer, index, buffer, index + len, size - index);
System.arraycopy(chars, 0, buffer, index, len);
size += len;
}
return this;
} | [
"public",
"StrBuilder",
"insert",
"(",
"final",
"int",
"index",
",",
"final",
"char",
"chars",
"[",
"]",
")",
"{",
"validateIndex",
"(",
"index",
")",
";",
"if",
"(",
"chars",
"==",
"null",
")",
"{",
"return",
"insert",
"(",
"index",
",",
"nullText",
... | Inserts the character array into this builder.
Inserting null will use the stored null text value.
@param index the index to add at, must be valid
@param chars the char array to insert
@return this, to enable chaining
@throws IndexOutOfBoundsException if the index is invalid | [
"Inserts",
"the",
"character",
"array",
"into",
"this",
"builder",
".",
"Inserting",
"null",
"will",
"use",
"the",
"stored",
"null",
"text",
"value",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L1638-L1651 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.insert | public StrBuilder insert(final int index, final char chars[], final int offset, final int length) {
validateIndex(index);
if (chars == null) {
return insert(index, nullText);
}
if (offset < 0 || offset > chars.length) {
throw new StringIndexOutOfBoundsException("Invalid offset: " + offset);
}
if (length < 0 || offset + length > chars.length) {
throw new StringIndexOutOfBoundsException("Invalid length: " + length);
}
if (length > 0) {
ensureCapacity(size + length);
System.arraycopy(buffer, index, buffer, index + length, size - index);
System.arraycopy(chars, offset, buffer, index, length);
size += length;
}
return this;
} | java | public StrBuilder insert(final int index, final char chars[], final int offset, final int length) {
validateIndex(index);
if (chars == null) {
return insert(index, nullText);
}
if (offset < 0 || offset > chars.length) {
throw new StringIndexOutOfBoundsException("Invalid offset: " + offset);
}
if (length < 0 || offset + length > chars.length) {
throw new StringIndexOutOfBoundsException("Invalid length: " + length);
}
if (length > 0) {
ensureCapacity(size + length);
System.arraycopy(buffer, index, buffer, index + length, size - index);
System.arraycopy(chars, offset, buffer, index, length);
size += length;
}
return this;
} | [
"public",
"StrBuilder",
"insert",
"(",
"final",
"int",
"index",
",",
"final",
"char",
"chars",
"[",
"]",
",",
"final",
"int",
"offset",
",",
"final",
"int",
"length",
")",
"{",
"validateIndex",
"(",
"index",
")",
";",
"if",
"(",
"chars",
"==",
"null",
... | Inserts part of the character array into this builder.
Inserting null will use the stored null text value.
@param index the index to add at, must be valid
@param chars the char array to insert
@param offset the offset into the character array to start at, must be valid
@param length the length of the character array part to copy, must be positive
@return this, to enable chaining
@throws IndexOutOfBoundsException if any index is invalid | [
"Inserts",
"part",
"of",
"the",
"character",
"array",
"into",
"this",
"builder",
".",
"Inserting",
"null",
"will",
"use",
"the",
"stored",
"null",
"text",
"value",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L1664-L1682 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.delete | public StrBuilder delete(final int startIndex, int endIndex) {
endIndex = validateRange(startIndex, endIndex);
final int len = endIndex - startIndex;
if (len > 0) {
deleteImpl(startIndex, endIndex, len);
}
return this;
} | java | public StrBuilder delete(final int startIndex, int endIndex) {
endIndex = validateRange(startIndex, endIndex);
final int len = endIndex - startIndex;
if (len > 0) {
deleteImpl(startIndex, endIndex, len);
}
return this;
} | [
"public",
"StrBuilder",
"delete",
"(",
"final",
"int",
"startIndex",
",",
"int",
"endIndex",
")",
"{",
"endIndex",
"=",
"validateRange",
"(",
"startIndex",
",",
"endIndex",
")",
";",
"final",
"int",
"len",
"=",
"endIndex",
"-",
"startIndex",
";",
"if",
"("... | Deletes the characters between the two specified indices.
@param startIndex the start index, inclusive, must be valid
@param endIndex the end index, exclusive, must be valid except
that if too large it is treated as end of string
@return this, to enable chaining
@throws IndexOutOfBoundsException if the index is invalid | [
"Deletes",
"the",
"characters",
"between",
"the",
"two",
"specified",
"indices",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L1803-L1810 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.deleteAll | public StrBuilder deleteAll(final String str) {
final int len = (str == null ? 0 : str.length());
if (len > 0) {
int index = indexOf(str, 0);
while (index >= 0) {
deleteImpl(index, index + len, len);
index = indexOf(str, index);
}
}
return this;
} | java | public StrBuilder deleteAll(final String str) {
final int len = (str == null ? 0 : str.length());
if (len > 0) {
int index = indexOf(str, 0);
while (index >= 0) {
deleteImpl(index, index + len, len);
index = indexOf(str, index);
}
}
return this;
} | [
"public",
"StrBuilder",
"deleteAll",
"(",
"final",
"String",
"str",
")",
"{",
"final",
"int",
"len",
"=",
"(",
"str",
"==",
"null",
"?",
"0",
":",
"str",
".",
"length",
"(",
")",
")",
";",
"if",
"(",
"len",
">",
"0",
")",
"{",
"int",
"index",
"... | Deletes the string wherever it occurs in the builder.
@param str the string to delete, null causes no action
@return this, to enable chaining | [
"Deletes",
"the",
"string",
"wherever",
"it",
"occurs",
"in",
"the",
"builder",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L1859-L1869 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.replace | public StrBuilder replace(final int startIndex, int endIndex, final String replaceStr) {
endIndex = validateRange(startIndex, endIndex);
final int insertLen = (replaceStr == null ? 0 : replaceStr.length());
replaceImpl(startIndex, endIndex, endIndex - startIndex, replaceStr, insertLen);
return this;
} | java | public StrBuilder replace(final int startIndex, int endIndex, final String replaceStr) {
endIndex = validateRange(startIndex, endIndex);
final int insertLen = (replaceStr == null ? 0 : replaceStr.length());
replaceImpl(startIndex, endIndex, endIndex - startIndex, replaceStr, insertLen);
return this;
} | [
"public",
"StrBuilder",
"replace",
"(",
"final",
"int",
"startIndex",
",",
"int",
"endIndex",
",",
"final",
"String",
"replaceStr",
")",
"{",
"endIndex",
"=",
"validateRange",
"(",
"startIndex",
",",
"endIndex",
")",
";",
"final",
"int",
"insertLen",
"=",
"(... | Replaces a portion of the string builder with another string.
The length of the inserted string does not have to match the removed length.
@param startIndex the start index, inclusive, must be valid
@param endIndex the end index, exclusive, must be valid except
that if too large it is treated as end of string
@param replaceStr the string to replace with, null means delete range
@return this, to enable chaining
@throws IndexOutOfBoundsException if the index is invalid | [
"Replaces",
"a",
"portion",
"of",
"the",
"string",
"builder",
"with",
"another",
"string",
".",
"The",
"length",
"of",
"the",
"inserted",
"string",
"does",
"not",
"have",
"to",
"match",
"the",
"removed",
"length",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L1951-L1956 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.replaceAll | public StrBuilder replaceAll(final char search, final char replace) {
if (search != replace) {
for (int i = 0; i < size; i++) {
if (buffer[i] == search) {
buffer[i] = replace;
}
}
}
return this;
} | java | public StrBuilder replaceAll(final char search, final char replace) {
if (search != replace) {
for (int i = 0; i < size; i++) {
if (buffer[i] == search) {
buffer[i] = replace;
}
}
}
return this;
} | [
"public",
"StrBuilder",
"replaceAll",
"(",
"final",
"char",
"search",
",",
"final",
"char",
"replace",
")",
"{",
"if",
"(",
"search",
"!=",
"replace",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"i... | Replaces the search character with the replace character
throughout the builder.
@param search the search character
@param replace the replace character
@return this, to enable chaining | [
"Replaces",
"the",
"search",
"character",
"with",
"the",
"replace",
"character",
"throughout",
"the",
"builder",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L1967-L1976 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.replaceFirst | public StrBuilder replaceFirst(final char search, final char replace) {
if (search != replace) {
for (int i = 0; i < size; i++) {
if (buffer[i] == search) {
buffer[i] = replace;
break;
}
}
}
return this;
} | java | public StrBuilder replaceFirst(final char search, final char replace) {
if (search != replace) {
for (int i = 0; i < size; i++) {
if (buffer[i] == search) {
buffer[i] = replace;
break;
}
}
}
return this;
} | [
"public",
"StrBuilder",
"replaceFirst",
"(",
"final",
"char",
"search",
",",
"final",
"char",
"replace",
")",
"{",
"if",
"(",
"search",
"!=",
"replace",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
... | Replaces the first instance of the search character with the
replace character in the builder.
@param search the search character
@param replace the replace character
@return this, to enable chaining | [
"Replaces",
"the",
"first",
"instance",
"of",
"the",
"search",
"character",
"with",
"the",
"replace",
"character",
"in",
"the",
"builder",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L1986-L1996 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.replaceAll | public StrBuilder replaceAll(final String searchStr, final String replaceStr) {
final int searchLen = (searchStr == null ? 0 : searchStr.length());
if (searchLen > 0) {
final int replaceLen = (replaceStr == null ? 0 : replaceStr.length());
int index = indexOf(searchStr, 0);
while (index >= 0) {
replaceImpl(index, index + searchLen, searchLen, replaceStr, replaceLen);
index = indexOf(searchStr, index + replaceLen);
}
}
return this;
} | java | public StrBuilder replaceAll(final String searchStr, final String replaceStr) {
final int searchLen = (searchStr == null ? 0 : searchStr.length());
if (searchLen > 0) {
final int replaceLen = (replaceStr == null ? 0 : replaceStr.length());
int index = indexOf(searchStr, 0);
while (index >= 0) {
replaceImpl(index, index + searchLen, searchLen, replaceStr, replaceLen);
index = indexOf(searchStr, index + replaceLen);
}
}
return this;
} | [
"public",
"StrBuilder",
"replaceAll",
"(",
"final",
"String",
"searchStr",
",",
"final",
"String",
"replaceStr",
")",
"{",
"final",
"int",
"searchLen",
"=",
"(",
"searchStr",
"==",
"null",
"?",
"0",
":",
"searchStr",
".",
"length",
"(",
")",
")",
";",
"i... | Replaces the search string with the replace string throughout the builder.
@param searchStr the search string, null causes no action to occur
@param replaceStr the replace string, null is equivalent to an empty string
@return this, to enable chaining | [
"Replaces",
"the",
"search",
"string",
"with",
"the",
"replace",
"string",
"throughout",
"the",
"builder",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L2006-L2017 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.reverse | public StrBuilder reverse() {
if (size == 0) {
return this;
}
final int half = size / 2;
final char[] buf = buffer;
for (int leftIdx = 0, rightIdx = size - 1; leftIdx < half; leftIdx++,rightIdx--) {
final char swap = buf[leftIdx];
buf[leftIdx] = buf[rightIdx];
buf[rightIdx] = swap;
}
return this;
} | java | public StrBuilder reverse() {
if (size == 0) {
return this;
}
final int half = size / 2;
final char[] buf = buffer;
for (int leftIdx = 0, rightIdx = size - 1; leftIdx < half; leftIdx++,rightIdx--) {
final char swap = buf[leftIdx];
buf[leftIdx] = buf[rightIdx];
buf[rightIdx] = swap;
}
return this;
} | [
"public",
"StrBuilder",
"reverse",
"(",
")",
"{",
"if",
"(",
"size",
"==",
"0",
")",
"{",
"return",
"this",
";",
"}",
"final",
"int",
"half",
"=",
"size",
"/",
"2",
";",
"final",
"char",
"[",
"]",
"buf",
"=",
"buffer",
";",
"for",
"(",
"int",
"... | Reverses the string builder placing each character in the opposite index.
@return this, to enable chaining | [
"Reverses",
"the",
"string",
"builder",
"placing",
"each",
"character",
"in",
"the",
"opposite",
"index",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L2136-L2149 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.trim | public StrBuilder trim() {
if (size == 0) {
return this;
}
int len = size;
final char[] buf = buffer;
int pos = 0;
while (pos < len && buf[pos] <= ' ') {
pos++;
}
while (pos < len && buf[len - 1] <= ' ') {
len--;
}
if (len < size) {
delete(len, size);
}
if (pos > 0) {
delete(0, pos);
}
return this;
} | java | public StrBuilder trim() {
if (size == 0) {
return this;
}
int len = size;
final char[] buf = buffer;
int pos = 0;
while (pos < len && buf[pos] <= ' ') {
pos++;
}
while (pos < len && buf[len - 1] <= ' ') {
len--;
}
if (len < size) {
delete(len, size);
}
if (pos > 0) {
delete(0, pos);
}
return this;
} | [
"public",
"StrBuilder",
"trim",
"(",
")",
"{",
"if",
"(",
"size",
"==",
"0",
")",
"{",
"return",
"this",
";",
"}",
"int",
"len",
"=",
"size",
";",
"final",
"char",
"[",
"]",
"buf",
"=",
"buffer",
";",
"int",
"pos",
"=",
"0",
";",
"while",
"(",
... | Trims the builder by removing characters less than or equal to a space
from the beginning and end.
@return this, to enable chaining | [
"Trims",
"the",
"builder",
"by",
"removing",
"characters",
"less",
"than",
"or",
"equal",
"to",
"a",
"space",
"from",
"the",
"beginning",
"and",
"end",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L2158-L2178 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.contains | public boolean contains(final char ch) {
final char[] thisBuf = buffer;
for (int i = 0; i < this.size; i++) {
if (thisBuf[i] == ch) {
return true;
}
}
return false;
} | java | public boolean contains(final char ch) {
final char[] thisBuf = buffer;
for (int i = 0; i < this.size; i++) {
if (thisBuf[i] == ch) {
return true;
}
}
return false;
} | [
"public",
"boolean",
"contains",
"(",
"final",
"char",
"ch",
")",
"{",
"final",
"char",
"[",
"]",
"thisBuf",
"=",
"buffer",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"size",
";",
"i",
"++",
")",
"{",
"if",
"(",
"thisBuf... | Checks if the string builder contains the specified char.
@param ch the character to find
@return true if the builder contains the character | [
"Checks",
"if",
"the",
"string",
"builder",
"contains",
"the",
"specified",
"char",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L2364-L2372 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.indexOf | public int indexOf(final char ch, int startIndex) {
startIndex = (startIndex < 0 ? 0 : startIndex);
if (startIndex >= size) {
return -1;
}
final char[] thisBuf = buffer;
for (int i = startIndex; i < size; i++) {
if (thisBuf[i] == ch) {
return i;
}
}
return -1;
} | java | public int indexOf(final char ch, int startIndex) {
startIndex = (startIndex < 0 ? 0 : startIndex);
if (startIndex >= size) {
return -1;
}
final char[] thisBuf = buffer;
for (int i = startIndex; i < size; i++) {
if (thisBuf[i] == ch) {
return i;
}
}
return -1;
} | [
"public",
"int",
"indexOf",
"(",
"final",
"char",
"ch",
",",
"int",
"startIndex",
")",
"{",
"startIndex",
"=",
"(",
"startIndex",
"<",
"0",
"?",
"0",
":",
"startIndex",
")",
";",
"if",
"(",
"startIndex",
">=",
"size",
")",
"{",
"return",
"-",
"1",
... | Searches the string builder to find the first reference to the specified char.
@param ch the character to find
@param startIndex the index to start at, invalid index rounded to edge
@return the first index of the character, or -1 if not found | [
"Searches",
"the",
"string",
"builder",
"to",
"find",
"the",
"first",
"reference",
"to",
"the",
"specified",
"char",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L2417-L2429 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.lastIndexOf | public int lastIndexOf(final char ch, int startIndex) {
startIndex = (startIndex >= size ? size - 1 : startIndex);
if (startIndex < 0) {
return -1;
}
for (int i = startIndex; i >= 0; i--) {
if (buffer[i] == ch) {
return i;
}
}
return -1;
} | java | public int lastIndexOf(final char ch, int startIndex) {
startIndex = (startIndex >= size ? size - 1 : startIndex);
if (startIndex < 0) {
return -1;
}
for (int i = startIndex; i >= 0; i--) {
if (buffer[i] == ch) {
return i;
}
}
return -1;
} | [
"public",
"int",
"lastIndexOf",
"(",
"final",
"char",
"ch",
",",
"int",
"startIndex",
")",
"{",
"startIndex",
"=",
"(",
"startIndex",
">=",
"size",
"?",
"size",
"-",
"1",
":",
"startIndex",
")",
";",
"if",
"(",
"startIndex",
"<",
"0",
")",
"{",
"retu... | Searches the string builder to find the last reference to the specified char.
@param ch the character to find
@param startIndex the index to start at, invalid index rounded to edge
@return the last index of the character, or -1 if not found | [
"Searches",
"the",
"string",
"builder",
"to",
"find",
"the",
"last",
"reference",
"to",
"the",
"specified",
"char",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L2541-L2552 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.equalsIgnoreCase | public boolean equalsIgnoreCase(final StrBuilder other) {
if (this == other) {
return true;
}
if (this.size != other.size) {
return false;
}
final char thisBuf[] = this.buffer;
final char otherBuf[] = other.buffer;
for (int i = size - 1; i >= 0; i--) {
final char c1 = thisBuf[i];
final char c2 = otherBuf[i];
if (c1 != c2 && Character.toUpperCase(c1) != Character.toUpperCase(c2)) {
return false;
}
}
return true;
} | java | public boolean equalsIgnoreCase(final StrBuilder other) {
if (this == other) {
return true;
}
if (this.size != other.size) {
return false;
}
final char thisBuf[] = this.buffer;
final char otherBuf[] = other.buffer;
for (int i = size - 1; i >= 0; i--) {
final char c1 = thisBuf[i];
final char c2 = otherBuf[i];
if (c1 != c2 && Character.toUpperCase(c1) != Character.toUpperCase(c2)) {
return false;
}
}
return true;
} | [
"public",
"boolean",
"equalsIgnoreCase",
"(",
"final",
"StrBuilder",
"other",
")",
"{",
"if",
"(",
"this",
"==",
"other",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"this",
".",
"size",
"!=",
"other",
".",
"size",
")",
"{",
"return",
"false",
"... | Checks the contents of this builder against another to see if they
contain the same character content ignoring case.
@param other the object to check, null returns false
@return true if the builders contain the same characters in the same order | [
"Checks",
"the",
"contents",
"of",
"this",
"builder",
"against",
"another",
"to",
"see",
"if",
"they",
"contain",
"the",
"same",
"character",
"content",
"ignoring",
"case",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L2766-L2783 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.validateRange | protected int validateRange(final int startIndex, int endIndex) {
if (startIndex < 0) {
throw new StringIndexOutOfBoundsException(startIndex);
}
if (endIndex > size) {
endIndex = size;
}
if (startIndex > endIndex) {
throw new StringIndexOutOfBoundsException("end < start");
}
return endIndex;
} | java | protected int validateRange(final int startIndex, int endIndex) {
if (startIndex < 0) {
throw new StringIndexOutOfBoundsException(startIndex);
}
if (endIndex > size) {
endIndex = size;
}
if (startIndex > endIndex) {
throw new StringIndexOutOfBoundsException("end < start");
}
return endIndex;
} | [
"protected",
"int",
"validateRange",
"(",
"final",
"int",
"startIndex",
",",
"int",
"endIndex",
")",
"{",
"if",
"(",
"startIndex",
"<",
"0",
")",
"{",
"throw",
"new",
"StringIndexOutOfBoundsException",
"(",
"startIndex",
")",
";",
"}",
"if",
"(",
"endIndex",... | Validates parameters defining a range of the builder.
@param startIndex the start index, inclusive, must be valid
@param endIndex the end index, exclusive, must be valid except
that if too large it is treated as end of string
@return the new string
@throws IndexOutOfBoundsException if the index is invalid | [
"Validates",
"parameters",
"defining",
"a",
"range",
"of",
"the",
"builder",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L2897-L2908 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/concurrent/LazyInitializer.java | LazyInitializer.get | @Override
public T get() throws ConcurrentException {
// use a temporary variable to reduce the number of reads of the
// volatile field
T result = object;
if (result == NO_INIT) {
synchronized (this) {
result = object;
if (result == NO_INIT) {
object = result = initialize();
}
}
}
return result;
} | java | @Override
public T get() throws ConcurrentException {
// use a temporary variable to reduce the number of reads of the
// volatile field
T result = object;
if (result == NO_INIT) {
synchronized (this) {
result = object;
if (result == NO_INIT) {
object = result = initialize();
}
}
}
return result;
} | [
"@",
"Override",
"public",
"T",
"get",
"(",
")",
"throws",
"ConcurrentException",
"{",
"// use a temporary variable to reduce the number of reads of the",
"// volatile field",
"T",
"result",
"=",
"object",
";",
"if",
"(",
"result",
"==",
"NO_INIT",
")",
"{",
"synchron... | Returns the object wrapped by this instance. On first access the object
is created. After that it is cached and can be accessed pretty fast.
@return the object initialized by this {@code LazyInitializer}
@throws ConcurrentException if an error occurred during initialization of
the object | [
"Returns",
"the",
"object",
"wrapped",
"by",
"this",
"instance",
".",
"On",
"first",
"access",
"the",
"object",
"is",
"created",
".",
"After",
"that",
"it",
"is",
"cached",
"and",
"can",
"be",
"accessed",
"pretty",
"fast",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/concurrent/LazyInitializer.java#L99-L115 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/ThreadUtils.java | ThreadUtils.findThreadById | public static Thread findThreadById(final long threadId, final ThreadGroup threadGroup) {
Validate.isTrue(threadGroup != null, "The thread group must not be null");
final Thread thread = findThreadById(threadId);
if(thread != null && threadGroup.equals(thread.getThreadGroup())) {
return thread;
}
return null;
} | java | public static Thread findThreadById(final long threadId, final ThreadGroup threadGroup) {
Validate.isTrue(threadGroup != null, "The thread group must not be null");
final Thread thread = findThreadById(threadId);
if(thread != null && threadGroup.equals(thread.getThreadGroup())) {
return thread;
}
return null;
} | [
"public",
"static",
"Thread",
"findThreadById",
"(",
"final",
"long",
"threadId",
",",
"final",
"ThreadGroup",
"threadGroup",
")",
"{",
"Validate",
".",
"isTrue",
"(",
"threadGroup",
"!=",
"null",
",",
"\"The thread group must not be null\"",
")",
";",
"final",
"T... | Return the active thread with the specified id if it belongs to the specified thread group.
@param threadId The thread id
@param threadGroup The thread group
@return The thread which belongs to a specified thread group and the thread's id match the specified id.
{@code null} is returned if no such thread exists
@throws IllegalArgumentException if the specified id is zero or negative or the group is null
@throws SecurityException
if the current thread cannot access the system thread group
@throws SecurityException if the current thread cannot modify
thread groups from this thread's thread group up to the system thread group | [
"Return",
"the",
"active",
"thread",
"with",
"the",
"specified",
"id",
"if",
"it",
"belongs",
"to",
"the",
"specified",
"thread",
"group",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ThreadUtils.java#L55-L62 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/ThreadUtils.java | ThreadUtils.findThreadById | public static Thread findThreadById(final long threadId, final String threadGroupName) {
Validate.isTrue(threadGroupName != null, "The thread group name must not be null");
final Thread thread = findThreadById(threadId);
if(thread != null && thread.getThreadGroup() != null && thread.getThreadGroup().getName().equals(threadGroupName)) {
return thread;
}
return null;
} | java | public static Thread findThreadById(final long threadId, final String threadGroupName) {
Validate.isTrue(threadGroupName != null, "The thread group name must not be null");
final Thread thread = findThreadById(threadId);
if(thread != null && thread.getThreadGroup() != null && thread.getThreadGroup().getName().equals(threadGroupName)) {
return thread;
}
return null;
} | [
"public",
"static",
"Thread",
"findThreadById",
"(",
"final",
"long",
"threadId",
",",
"final",
"String",
"threadGroupName",
")",
"{",
"Validate",
".",
"isTrue",
"(",
"threadGroupName",
"!=",
"null",
",",
"\"The thread group name must not be null\"",
")",
";",
"fina... | Return the active thread with the specified id if it belongs to a thread group with the specified group name.
@param threadId The thread id
@param threadGroupName The thread group name
@return The threads which belongs to a thread group with the specified group name and the thread's id match the specified id.
{@code null} is returned if no such thread exists
@throws IllegalArgumentException if the specified id is zero or negative or the group name is null
@throws SecurityException
if the current thread cannot access the system thread group
@throws SecurityException if the current thread cannot modify
thread groups from this thread's thread group up to the system thread group | [
"Return",
"the",
"active",
"thread",
"with",
"the",
"specified",
"id",
"if",
"it",
"belongs",
"to",
"a",
"thread",
"group",
"with",
"the",
"specified",
"group",
"name",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ThreadUtils.java#L78-L85 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/ThreadUtils.java | ThreadUtils.findThreadsByName | public static Collection<Thread> findThreadsByName(final String threadName, final ThreadGroup threadGroup) {
return findThreads(threadGroup, false, new NamePredicate(threadName));
} | java | public static Collection<Thread> findThreadsByName(final String threadName, final ThreadGroup threadGroup) {
return findThreads(threadGroup, false, new NamePredicate(threadName));
} | [
"public",
"static",
"Collection",
"<",
"Thread",
">",
"findThreadsByName",
"(",
"final",
"String",
"threadName",
",",
"final",
"ThreadGroup",
"threadGroup",
")",
"{",
"return",
"findThreads",
"(",
"threadGroup",
",",
"false",
",",
"new",
"NamePredicate",
"(",
"t... | Return active threads with the specified name if they belong to a specified thread group.
@param threadName The thread name
@param threadGroup The thread group
@return The threads which belongs to a thread group and the thread's name match the specified name,
An empty collection is returned if no such thread exists. The collection returned is always unmodifiable.
@throws IllegalArgumentException if the specified thread name or group is null
@throws SecurityException
if the current thread cannot access the system thread group
@throws SecurityException if the current thread cannot modify
thread groups from this thread's thread group up to the system thread group | [
"Return",
"active",
"threads",
"with",
"the",
"specified",
"name",
"if",
"they",
"belong",
"to",
"a",
"specified",
"thread",
"group",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ThreadUtils.java#L101-L103 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/ThreadUtils.java | ThreadUtils.findThreadsByName | public static Collection<Thread> findThreadsByName(final String threadName, final String threadGroupName) {
Validate.isTrue(threadName != null, "The thread name must not be null");
Validate.isTrue(threadGroupName != null, "The thread group name must not be null");
final Collection<ThreadGroup> threadGroups = findThreadGroups(new NamePredicate(threadGroupName));
if(threadGroups.isEmpty()) {
return Collections.emptyList();
}
final Collection<Thread> result = new ArrayList<>();
final NamePredicate threadNamePredicate = new NamePredicate(threadName);
for(final ThreadGroup group : threadGroups) {
result.addAll(findThreads(group, false, threadNamePredicate));
}
return Collections.unmodifiableCollection(result);
} | java | public static Collection<Thread> findThreadsByName(final String threadName, final String threadGroupName) {
Validate.isTrue(threadName != null, "The thread name must not be null");
Validate.isTrue(threadGroupName != null, "The thread group name must not be null");
final Collection<ThreadGroup> threadGroups = findThreadGroups(new NamePredicate(threadGroupName));
if(threadGroups.isEmpty()) {
return Collections.emptyList();
}
final Collection<Thread> result = new ArrayList<>();
final NamePredicate threadNamePredicate = new NamePredicate(threadName);
for(final ThreadGroup group : threadGroups) {
result.addAll(findThreads(group, false, threadNamePredicate));
}
return Collections.unmodifiableCollection(result);
} | [
"public",
"static",
"Collection",
"<",
"Thread",
">",
"findThreadsByName",
"(",
"final",
"String",
"threadName",
",",
"final",
"String",
"threadGroupName",
")",
"{",
"Validate",
".",
"isTrue",
"(",
"threadName",
"!=",
"null",
",",
"\"The thread name must not be null... | Return active threads with the specified name if they belong to a thread group with the specified group name.
@param threadName The thread name
@param threadGroupName The thread group name
@return The threads which belongs to a thread group with the specified group name and the thread's name match the specified name,
An empty collection is returned if no such thread exists. The collection returned is always unmodifiable.
@throws IllegalArgumentException if the specified thread name or group name is null
@throws SecurityException
if the current thread cannot access the system thread group
@throws SecurityException if the current thread cannot modify
thread groups from this thread's thread group up to the system thread group | [
"Return",
"active",
"threads",
"with",
"the",
"specified",
"name",
"if",
"they",
"belong",
"to",
"a",
"thread",
"group",
"with",
"the",
"specified",
"group",
"name",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ThreadUtils.java#L119-L135 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/ThreadUtils.java | ThreadUtils.findThreadById | public static Thread findThreadById(final long threadId) {
final Collection<Thread> result = findThreads(new ThreadIdPredicate(threadId));
return result.isEmpty() ? null : result.iterator().next();
} | java | public static Thread findThreadById(final long threadId) {
final Collection<Thread> result = findThreads(new ThreadIdPredicate(threadId));
return result.isEmpty() ? null : result.iterator().next();
} | [
"public",
"static",
"Thread",
"findThreadById",
"(",
"final",
"long",
"threadId",
")",
"{",
"final",
"Collection",
"<",
"Thread",
">",
"result",
"=",
"findThreads",
"(",
"new",
"ThreadIdPredicate",
"(",
"threadId",
")",
")",
";",
"return",
"result",
".",
"is... | Return the active thread with the specified id.
@param threadId The thread id
@return The thread with the specified id or {@code null} if no such thread exists
@throws IllegalArgumentException if the specified id is zero or negative
@throws SecurityException
if the current thread cannot access the system thread group
@throws SecurityException if the current thread cannot modify
thread groups from this thread's thread group up to the system thread group | [
"Return",
"the",
"active",
"thread",
"with",
"the",
"specified",
"id",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ThreadUtils.java#L224-L227 | train |
alexheretic/dynamics | src/main/java/alexh/weak/OptionalWeak.java | OptionalWeak.as | public <T> Optional<T> as(Class<T> type) {
return inner.filter(d -> d.is(type)).map(d -> d.as(type));
} | java | public <T> Optional<T> as(Class<T> type) {
return inner.filter(d -> d.is(type)).map(d -> d.as(type));
} | [
"public",
"<",
"T",
">",
"Optional",
"<",
"T",
">",
"as",
"(",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"inner",
".",
"filter",
"(",
"d",
"->",
"d",
".",
"is",
"(",
"type",
")",
")",
".",
"map",
"(",
"d",
"->",
"d",
".",
"as",
... | Returns inner value as optional of input type, if the inner value is absent or not an instance of the input
type an empty optional is returned
@param type cast type
@param <T> cast type
@return inner value as optional of input type | [
"Returns",
"inner",
"value",
"as",
"optional",
"of",
"input",
"type",
"if",
"the",
"inner",
"value",
"is",
"absent",
"or",
"not",
"an",
"instance",
"of",
"the",
"input",
"type",
"an",
"empty",
"optional",
"is",
"returned"
] | aa46ca76247d43f399eb9c2037c9b4c2549b3722 | https://github.com/alexheretic/dynamics/blob/aa46ca76247d43f399eb9c2037c9b4c2549b3722/src/main/java/alexh/weak/OptionalWeak.java#L89-L91 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java | ExceptionUtils.typeErasure | @SuppressWarnings("unchecked")
private static <R, T extends Throwable> R typeErasure(final Throwable throwable) throws T {
throw (T) throwable;
} | java | @SuppressWarnings("unchecked")
private static <R, T extends Throwable> R typeErasure(final Throwable throwable) throws T {
throw (T) throwable;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"static",
"<",
"R",
",",
"T",
"extends",
"Throwable",
">",
"R",
"typeErasure",
"(",
"final",
"Throwable",
"throwable",
")",
"throws",
"T",
"{",
"throw",
"(",
"T",
")",
"throwable",
";",
"}"
] | Claim a Throwable is another Exception type using type erasure. This
hides a checked exception from the java compiler, allowing a checked
exception to be thrown without having the exception in the method's throw
clause. | [
"Claim",
"a",
"Throwable",
"is",
"another",
"Exception",
"type",
"using",
"type",
"erasure",
".",
"This",
"hides",
"a",
"checked",
"exception",
"from",
"the",
"java",
"compiler",
"allowing",
"a",
"checked",
"exception",
"to",
"be",
"thrown",
"without",
"having... | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java#L781-L784 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java | ExceptionUtils.hasCause | @GwtIncompatible("incompatible method")
public static boolean hasCause(Throwable chain,
final Class<? extends Throwable> type) {
if (chain instanceof UndeclaredThrowableException) {
chain = chain.getCause();
}
return type.isInstance(chain);
} | java | @GwtIncompatible("incompatible method")
public static boolean hasCause(Throwable chain,
final Class<? extends Throwable> type) {
if (chain instanceof UndeclaredThrowableException) {
chain = chain.getCause();
}
return type.isInstance(chain);
} | [
"@",
"GwtIncompatible",
"(",
"\"incompatible method\"",
")",
"public",
"static",
"boolean",
"hasCause",
"(",
"Throwable",
"chain",
",",
"final",
"Class",
"<",
"?",
"extends",
"Throwable",
">",
"type",
")",
"{",
"if",
"(",
"chain",
"instanceof",
"UndeclaredThrowa... | Does the throwable's causal chain have an immediate or wrapped exception
of the given type?
@param chain
The root of a Throwable causal chain.
@param type
The exception type to test.
@return true, if chain is an instance of type or is an
UndeclaredThrowableException wrapping a cause.
@since 3.5
@see #wrapAndThrow(Throwable) | [
"Does",
"the",
"throwable",
"s",
"causal",
"chain",
"have",
"an",
"immediate",
"or",
"wrapped",
"exception",
"of",
"the",
"given",
"type?"
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java#L830-L837 | train |
StrongJoshua/libgdx-inGameConsole | src/com/strongjoshua/console/GUIConsole.java | GUIConsole.hasStage | private boolean hasStage (InputProcessor processor) {
if (!(processor instanceof InputMultiplexer)) {
return processor == stage;
}
InputMultiplexer im = (InputMultiplexer)processor;
SnapshotArray<InputProcessor> ips = im.getProcessors();
for (InputProcessor ip : ips) {
if (hasStage(ip)) {
return true;
}
}
return false;
} | java | private boolean hasStage (InputProcessor processor) {
if (!(processor instanceof InputMultiplexer)) {
return processor == stage;
}
InputMultiplexer im = (InputMultiplexer)processor;
SnapshotArray<InputProcessor> ips = im.getProcessors();
for (InputProcessor ip : ips) {
if (hasStage(ip)) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"hasStage",
"(",
"InputProcessor",
"processor",
")",
"{",
"if",
"(",
"!",
"(",
"processor",
"instanceof",
"InputMultiplexer",
")",
")",
"{",
"return",
"processor",
"==",
"stage",
";",
"}",
"InputMultiplexer",
"im",
"=",
"(",
"InputMultipl... | Compares the given processor to the console's stage. If given a multiplexer, it is iterated through recursively to check all
of the multiplexer's processors for comparison.
@param processor
@return processor == this.stage | [
"Compares",
"the",
"given",
"processor",
"to",
"the",
"console",
"s",
"stage",
".",
"If",
"given",
"a",
"multiplexer",
"it",
"is",
"iterated",
"through",
"recursively",
"to",
"check",
"all",
"of",
"the",
"multiplexer",
"s",
"processors",
"for",
"comparison",
... | f8e3353b7084b686949192d5d415db37dba36df5 | https://github.com/StrongJoshua/libgdx-inGameConsole/blob/f8e3353b7084b686949192d5d415db37dba36df5/src/com/strongjoshua/console/GUIConsole.java#L255-L267 | train |
ixa-ehu/ixa-pipe-pos | src/main/java/eus/ixa/ixa/pipe/pos/dict/MorfologikTagger.java | MorfologikTagger.tag | public String tag(final String word, final String posTag) {
final List<WordData> wdList = this.dictLookup.lookup(word.toLowerCase());
String newPosTag = null;
for (final WordData wd : wdList) {
newPosTag = wd.getTag().toString();
}
if (newPosTag == null) {
newPosTag = posTag;
}
return newPosTag;
} | java | public String tag(final String word, final String posTag) {
final List<WordData> wdList = this.dictLookup.lookup(word.toLowerCase());
String newPosTag = null;
for (final WordData wd : wdList) {
newPosTag = wd.getTag().toString();
}
if (newPosTag == null) {
newPosTag = posTag;
}
return newPosTag;
} | [
"public",
"String",
"tag",
"(",
"final",
"String",
"word",
",",
"final",
"String",
"posTag",
")",
"{",
"final",
"List",
"<",
"WordData",
">",
"wdList",
"=",
"this",
".",
"dictLookup",
".",
"lookup",
"(",
"word",
".",
"toLowerCase",
"(",
")",
")",
";",
... | Get the postag for a surface form from a FSA morfologik generated
dictionary.
@param word
the surface form
@return the hashmap with the word as key and the postag as value | [
"Get",
"the",
"postag",
"for",
"a",
"surface",
"form",
"from",
"a",
"FSA",
"morfologik",
"generated",
"dictionary",
"."
] | 083c986103f95ae8063b8ddc89a2caa8047d29b9 | https://github.com/ixa-ehu/ixa-pipe-pos/blob/083c986103f95ae8063b8ddc89a2caa8047d29b9/src/main/java/eus/ixa/ixa/pipe/pos/dict/MorfologikTagger.java#L67-L77 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/StringUtils.java | StringUtils.appendIfMissing | private static String appendIfMissing(final String str, final CharSequence suffix, final boolean ignoreCase, final CharSequence... suffixes) {
if (str == null || isEmpty(suffix) || endsWith(str, suffix, ignoreCase)) {
return str;
}
if (suffixes != null && suffixes.length > 0) {
for (final CharSequence s : suffixes) {
if (endsWith(str, s, ignoreCase)) {
return str;
}
}
}
return str + suffix.toString();
} | java | private static String appendIfMissing(final String str, final CharSequence suffix, final boolean ignoreCase, final CharSequence... suffixes) {
if (str == null || isEmpty(suffix) || endsWith(str, suffix, ignoreCase)) {
return str;
}
if (suffixes != null && suffixes.length > 0) {
for (final CharSequence s : suffixes) {
if (endsWith(str, s, ignoreCase)) {
return str;
}
}
}
return str + suffix.toString();
} | [
"private",
"static",
"String",
"appendIfMissing",
"(",
"final",
"String",
"str",
",",
"final",
"CharSequence",
"suffix",
",",
"final",
"boolean",
"ignoreCase",
",",
"final",
"CharSequence",
"...",
"suffixes",
")",
"{",
"if",
"(",
"str",
"==",
"null",
"||",
"... | Appends the suffix to the end of the string if the string does not
already end with the suffix.
@param str The string.
@param suffix The suffix to append to the end of the string.
@param ignoreCase Indicates whether the compare should ignore case.
@param suffixes Additional suffixes that are valid terminators (optional).
@return A new String if suffix was appended, the same string otherwise. | [
"Appends",
"the",
"suffix",
"to",
"the",
"end",
"of",
"the",
"string",
"if",
"the",
"string",
"does",
"not",
"already",
"end",
"with",
"the",
"suffix",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L8766-L8778 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/StringUtils.java | StringUtils.appendIfMissing | public static String appendIfMissing(final String str, final CharSequence suffix, final CharSequence... suffixes) {
return appendIfMissing(str, suffix, false, suffixes);
} | java | public static String appendIfMissing(final String str, final CharSequence suffix, final CharSequence... suffixes) {
return appendIfMissing(str, suffix, false, suffixes);
} | [
"public",
"static",
"String",
"appendIfMissing",
"(",
"final",
"String",
"str",
",",
"final",
"CharSequence",
"suffix",
",",
"final",
"CharSequence",
"...",
"suffixes",
")",
"{",
"return",
"appendIfMissing",
"(",
"str",
",",
"suffix",
",",
"false",
",",
"suffi... | Appends the suffix to the end of the string if the string does not
already end with any of the suffixes.
<pre>
StringUtils.appendIfMissing(null, null) = null
StringUtils.appendIfMissing("abc", null) = "abc"
StringUtils.appendIfMissing("", "xyz") = "xyz"
StringUtils.appendIfMissing("abc", "xyz") = "abcxyz"
StringUtils.appendIfMissing("abcxyz", "xyz") = "abcxyz"
StringUtils.appendIfMissing("abcXYZ", "xyz") = "abcXYZxyz"
</pre>
<p>With additional suffixes,</p>
<pre>
StringUtils.appendIfMissing(null, null, null) = null
StringUtils.appendIfMissing("abc", null, null) = "abc"
StringUtils.appendIfMissing("", "xyz", null) = "xyz"
StringUtils.appendIfMissing("abc", "xyz", new CharSequence[]{null}) = "abcxyz"
StringUtils.appendIfMissing("abc", "xyz", "") = "abc"
StringUtils.appendIfMissing("abc", "xyz", "mno") = "abcxyz"
StringUtils.appendIfMissing("abcxyz", "xyz", "mno") = "abcxyz"
StringUtils.appendIfMissing("abcmno", "xyz", "mno") = "abcmno"
StringUtils.appendIfMissing("abcXYZ", "xyz", "mno") = "abcXYZxyz"
StringUtils.appendIfMissing("abcMNO", "xyz", "mno") = "abcMNOxyz"
</pre>
@param str The string.
@param suffix The suffix to append to the end of the string.
@param suffixes Additional suffixes that are valid terminators.
@return A new String if suffix was appended, the same string otherwise.
@since 3.2 | [
"Appends",
"the",
"suffix",
"to",
"the",
"end",
"of",
"the",
"string",
"if",
"the",
"string",
"does",
"not",
"already",
"end",
"with",
"any",
"of",
"the",
"suffixes",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L8814-L8816 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/StringUtils.java | StringUtils.appendIfMissingIgnoreCase | public static String appendIfMissingIgnoreCase(final String str, final CharSequence suffix, final CharSequence... suffixes) {
return appendIfMissing(str, suffix, true, suffixes);
} | java | public static String appendIfMissingIgnoreCase(final String str, final CharSequence suffix, final CharSequence... suffixes) {
return appendIfMissing(str, suffix, true, suffixes);
} | [
"public",
"static",
"String",
"appendIfMissingIgnoreCase",
"(",
"final",
"String",
"str",
",",
"final",
"CharSequence",
"suffix",
",",
"final",
"CharSequence",
"...",
"suffixes",
")",
"{",
"return",
"appendIfMissing",
"(",
"str",
",",
"suffix",
",",
"true",
",",... | Appends the suffix to the end of the string if the string does not
already end, case insensitive, with any of the suffixes.
<pre>
StringUtils.appendIfMissingIgnoreCase(null, null) = null
StringUtils.appendIfMissingIgnoreCase("abc", null) = "abc"
StringUtils.appendIfMissingIgnoreCase("", "xyz") = "xyz"
StringUtils.appendIfMissingIgnoreCase("abc", "xyz") = "abcxyz"
StringUtils.appendIfMissingIgnoreCase("abcxyz", "xyz") = "abcxyz"
StringUtils.appendIfMissingIgnoreCase("abcXYZ", "xyz") = "abcXYZ"
</pre>
<p>With additional suffixes,</p>
<pre>
StringUtils.appendIfMissingIgnoreCase(null, null, null) = null
StringUtils.appendIfMissingIgnoreCase("abc", null, null) = "abc"
StringUtils.appendIfMissingIgnoreCase("", "xyz", null) = "xyz"
StringUtils.appendIfMissingIgnoreCase("abc", "xyz", new CharSequence[]{null}) = "abcxyz"
StringUtils.appendIfMissingIgnoreCase("abc", "xyz", "") = "abc"
StringUtils.appendIfMissingIgnoreCase("abc", "xyz", "mno") = "axyz"
StringUtils.appendIfMissingIgnoreCase("abcxyz", "xyz", "mno") = "abcxyz"
StringUtils.appendIfMissingIgnoreCase("abcmno", "xyz", "mno") = "abcmno"
StringUtils.appendIfMissingIgnoreCase("abcXYZ", "xyz", "mno") = "abcXYZ"
StringUtils.appendIfMissingIgnoreCase("abcMNO", "xyz", "mno") = "abcMNO"
</pre>
@param str The string.
@param suffix The suffix to append to the end of the string.
@param suffixes Additional suffixes that are valid terminators.
@return A new String if suffix was appended, the same string otherwise.
@since 3.2 | [
"Appends",
"the",
"suffix",
"to",
"the",
"end",
"of",
"the",
"string",
"if",
"the",
"string",
"does",
"not",
"already",
"end",
"case",
"insensitive",
"with",
"any",
"of",
"the",
"suffixes",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L8852-L8854 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/StringUtils.java | StringUtils.prependIfMissingIgnoreCase | public static String prependIfMissingIgnoreCase(final String str, final CharSequence prefix, final CharSequence... prefixes) {
return prependIfMissing(str, prefix, true, prefixes);
} | java | public static String prependIfMissingIgnoreCase(final String str, final CharSequence prefix, final CharSequence... prefixes) {
return prependIfMissing(str, prefix, true, prefixes);
} | [
"public",
"static",
"String",
"prependIfMissingIgnoreCase",
"(",
"final",
"String",
"str",
",",
"final",
"CharSequence",
"prefix",
",",
"final",
"CharSequence",
"...",
"prefixes",
")",
"{",
"return",
"prependIfMissing",
"(",
"str",
",",
"prefix",
",",
"true",
",... | Prepends the prefix to the start of the string if the string does not
already start, case insensitive, with any of the prefixes.
<pre>
StringUtils.prependIfMissingIgnoreCase(null, null) = null
StringUtils.prependIfMissingIgnoreCase("abc", null) = "abc"
StringUtils.prependIfMissingIgnoreCase("", "xyz") = "xyz"
StringUtils.prependIfMissingIgnoreCase("abc", "xyz") = "xyzabc"
StringUtils.prependIfMissingIgnoreCase("xyzabc", "xyz") = "xyzabc"
StringUtils.prependIfMissingIgnoreCase("XYZabc", "xyz") = "XYZabc"
</pre>
<p>With additional prefixes,</p>
<pre>
StringUtils.prependIfMissingIgnoreCase(null, null, null) = null
StringUtils.prependIfMissingIgnoreCase("abc", null, null) = "abc"
StringUtils.prependIfMissingIgnoreCase("", "xyz", null) = "xyz"
StringUtils.prependIfMissingIgnoreCase("abc", "xyz", new CharSequence[]{null}) = "xyzabc"
StringUtils.prependIfMissingIgnoreCase("abc", "xyz", "") = "abc"
StringUtils.prependIfMissingIgnoreCase("abc", "xyz", "mno") = "xyzabc"
StringUtils.prependIfMissingIgnoreCase("xyzabc", "xyz", "mno") = "xyzabc"
StringUtils.prependIfMissingIgnoreCase("mnoabc", "xyz", "mno") = "mnoabc"
StringUtils.prependIfMissingIgnoreCase("XYZabc", "xyz", "mno") = "XYZabc"
StringUtils.prependIfMissingIgnoreCase("MNOabc", "xyz", "mno") = "MNOabc"
</pre>
@param str The string.
@param prefix The prefix to prepend to the start of the string.
@param prefixes Additional prefixes that are valid (optional).
@return A new String if prefix was prepended, the same string otherwise.
@since 3.2 | [
"Prepends",
"the",
"prefix",
"to",
"the",
"start",
"of",
"the",
"string",
"if",
"the",
"string",
"does",
"not",
"already",
"start",
"case",
"insensitive",
"with",
"any",
"of",
"the",
"prefixes",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L8953-L8955 | train |
ixa-ehu/ixa-pipe-pos | src/main/java/eus/ixa/ixa/pipe/pos/Annotate.java | Annotate.getAllTagsLemmasToNAF | public final void getAllTagsLemmasToNAF(final KAFDocument kaf) {
final List<List<WF>> sentences = kaf.getSentences();
for (final List<WF> wfs : sentences) {
final List<ixa.kaflib.Span<WF>> tokenSpans = new ArrayList<ixa.kaflib.Span<WF>>();
final String[] tokens = new String[wfs.size()];
for (int i = 0; i < wfs.size(); i++) {
tokens[i] = wfs.get(i).getForm();
final List<WF> wfTarget = new ArrayList<WF>();
wfTarget.add(wfs.get(i));
tokenSpans.add(KAFDocument.newWFSpan(wfTarget));
}
String[][] allPosTags = this.posTagger.getAllPosTags(tokens);
ListMultimap<String, String> morphMap = lemmatizer.getMultipleLemmas(tokens, allPosTags);
for (int i = 0; i < tokens.length; i++) {
final Term term = kaf.newTerm(tokenSpans.get(i));
List<String> posLemmaValues = morphMap.get(tokens[i]);
if (this.dictLemmatizer != null) {
dictLemmatizer.getAllPosLemmas(tokens[i], posLemmaValues);
}
String allPosLemmasSet = StringUtils.getSetStringFromList(posLemmaValues);
final String posId = Resources.getKafTagSet(allPosTags[0][i], lang);
final String type = Resources.setTermType(posId);
term.setType(type);
term.setLemma(posLemmaValues.get(0).split("#")[1]);
term.setPos(posId);
term.setMorphofeat(allPosLemmasSet);
}
}
} | java | public final void getAllTagsLemmasToNAF(final KAFDocument kaf) {
final List<List<WF>> sentences = kaf.getSentences();
for (final List<WF> wfs : sentences) {
final List<ixa.kaflib.Span<WF>> tokenSpans = new ArrayList<ixa.kaflib.Span<WF>>();
final String[] tokens = new String[wfs.size()];
for (int i = 0; i < wfs.size(); i++) {
tokens[i] = wfs.get(i).getForm();
final List<WF> wfTarget = new ArrayList<WF>();
wfTarget.add(wfs.get(i));
tokenSpans.add(KAFDocument.newWFSpan(wfTarget));
}
String[][] allPosTags = this.posTagger.getAllPosTags(tokens);
ListMultimap<String, String> morphMap = lemmatizer.getMultipleLemmas(tokens, allPosTags);
for (int i = 0; i < tokens.length; i++) {
final Term term = kaf.newTerm(tokenSpans.get(i));
List<String> posLemmaValues = morphMap.get(tokens[i]);
if (this.dictLemmatizer != null) {
dictLemmatizer.getAllPosLemmas(tokens[i], posLemmaValues);
}
String allPosLemmasSet = StringUtils.getSetStringFromList(posLemmaValues);
final String posId = Resources.getKafTagSet(allPosTags[0][i], lang);
final String type = Resources.setTermType(posId);
term.setType(type);
term.setLemma(posLemmaValues.get(0).split("#")[1]);
term.setPos(posId);
term.setMorphofeat(allPosLemmasSet);
}
}
} | [
"public",
"final",
"void",
"getAllTagsLemmasToNAF",
"(",
"final",
"KAFDocument",
"kaf",
")",
"{",
"final",
"List",
"<",
"List",
"<",
"WF",
">",
">",
"sentences",
"=",
"kaf",
".",
"getSentences",
"(",
")",
";",
"for",
"(",
"final",
"List",
"<",
"WF",
">... | Add all postags and lemmas to morphofeat attribute.
@param kaf the NAF document | [
"Add",
"all",
"postags",
"and",
"lemmas",
"to",
"morphofeat",
"attribute",
"."
] | 083c986103f95ae8063b8ddc89a2caa8047d29b9 | https://github.com/ixa-ehu/ixa-pipe-pos/blob/083c986103f95ae8063b8ddc89a2caa8047d29b9/src/main/java/eus/ixa/ixa/pipe/pos/Annotate.java#L327-L358 | train |
ixa-ehu/ixa-pipe-pos | src/main/java/eus/ixa/ixa/pipe/pos/Annotate.java | Annotate.getAllTagsLemmasToCoNLL | public final String getAllTagsLemmasToCoNLL(final KAFDocument kaf) {
final StringBuilder sb = new StringBuilder();
final List<List<WF>> sentences = kaf.getSentences();
for (final List<WF> wfs : sentences) {
final List<ixa.kaflib.Span<WF>> tokenSpans = new ArrayList<ixa.kaflib.Span<WF>>();
final String[] tokens = new String[wfs.size()];
for (int i = 0; i < wfs.size(); i++) {
tokens[i] = wfs.get(i).getForm();
final List<WF> wfTarget = new ArrayList<WF>();
wfTarget.add(wfs.get(i));
tokenSpans.add(KAFDocument.newWFSpan(wfTarget));
}
String[][] allPosTags = this.posTagger.getAllPosTags(tokens);
ListMultimap<String, String> morphMap = lemmatizer.getMultipleLemmas(tokens, allPosTags);
for (int i = 0; i < tokens.length; i++) {
List<String> posLemmaValues = morphMap.get(tokens[i]);
if (this.dictLemmatizer != null) {
dictLemmatizer.getAllPosLemmas(tokens[i], posLemmaValues);
}
String allPosLemmasSet = StringUtils.getSetStringFromList(posLemmaValues);
sb.append(tokens[i]).append("\t").append(allPosLemmasSet).append("\n");
}
sb.append("\n");
}
return sb.toString();
} | java | public final String getAllTagsLemmasToCoNLL(final KAFDocument kaf) {
final StringBuilder sb = new StringBuilder();
final List<List<WF>> sentences = kaf.getSentences();
for (final List<WF> wfs : sentences) {
final List<ixa.kaflib.Span<WF>> tokenSpans = new ArrayList<ixa.kaflib.Span<WF>>();
final String[] tokens = new String[wfs.size()];
for (int i = 0; i < wfs.size(); i++) {
tokens[i] = wfs.get(i).getForm();
final List<WF> wfTarget = new ArrayList<WF>();
wfTarget.add(wfs.get(i));
tokenSpans.add(KAFDocument.newWFSpan(wfTarget));
}
String[][] allPosTags = this.posTagger.getAllPosTags(tokens);
ListMultimap<String, String> morphMap = lemmatizer.getMultipleLemmas(tokens, allPosTags);
for (int i = 0; i < tokens.length; i++) {
List<String> posLemmaValues = morphMap.get(tokens[i]);
if (this.dictLemmatizer != null) {
dictLemmatizer.getAllPosLemmas(tokens[i], posLemmaValues);
}
String allPosLemmasSet = StringUtils.getSetStringFromList(posLemmaValues);
sb.append(tokens[i]).append("\t").append(allPosLemmasSet).append("\n");
}
sb.append("\n");
}
return sb.toString();
} | [
"public",
"final",
"String",
"getAllTagsLemmasToCoNLL",
"(",
"final",
"KAFDocument",
"kaf",
")",
"{",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"final",
"List",
"<",
"List",
"<",
"WF",
">",
">",
"sentences",
"=",
"kaf",
".... | Give all lemmas and tags possible for a sentence in conll tabulated format.
@param kaf the NAF document
@return the output in tabulated format | [
"Give",
"all",
"lemmas",
"and",
"tags",
"possible",
"for",
"a",
"sentence",
"in",
"conll",
"tabulated",
"format",
"."
] | 083c986103f95ae8063b8ddc89a2caa8047d29b9 | https://github.com/ixa-ehu/ixa-pipe-pos/blob/083c986103f95ae8063b8ddc89a2caa8047d29b9/src/main/java/eus/ixa/ixa/pipe/pos/Annotate.java#L365-L392 | train |
sockeqwe/sqlbrite-dao | objectmapper-processor/src/main/java/com/hannesdorfmann/sqlbrite/objectmapper/processor/ObjectMappableAnnotatedClass.java | ObjectMappableAnnotatedClass.isSetterForField | private boolean isSetterForField(ExecutableElement setter, VariableElement field) {
return setter.getParameters() != null
&& setter.getParameters().size() == 1
&& setter.getParameters().get(0).asType().equals(field.asType());
// TODO inheritance? TypeUtils is applicable?
} | java | private boolean isSetterForField(ExecutableElement setter, VariableElement field) {
return setter.getParameters() != null
&& setter.getParameters().size() == 1
&& setter.getParameters().get(0).asType().equals(field.asType());
// TODO inheritance? TypeUtils is applicable?
} | [
"private",
"boolean",
"isSetterForField",
"(",
"ExecutableElement",
"setter",
",",
"VariableElement",
"field",
")",
"{",
"return",
"setter",
".",
"getParameters",
"(",
")",
"!=",
"null",
"&&",
"setter",
".",
"getParameters",
"(",
")",
".",
"size",
"(",
")",
... | Checks if the setter method is valid for the given field
@param setter The setter method
@param field The field
@return true if setter works for given field, otherwise false | [
"Checks",
"if",
"the",
"setter",
"method",
"is",
"valid",
"for",
"the",
"given",
"field"
] | 8d02b76f00bd2f8997a58d33146b98b2eec35452 | https://github.com/sockeqwe/sqlbrite-dao/blob/8d02b76f00bd2f8997a58d33146b98b2eec35452/objectmapper-processor/src/main/java/com/hannesdorfmann/sqlbrite/objectmapper/processor/ObjectMappableAnnotatedClass.java#L262-L267 | train |
sockeqwe/sqlbrite-dao | objectmapper-processor/src/main/java/com/hannesdorfmann/sqlbrite/objectmapper/processor/ObjectMappableProcessor.java | ObjectMappableProcessor.getSurroundingClass | private TypeElement getSurroundingClass(Element e) throws ProcessingException {
if (e.getEnclosingElement().getKind() == ElementKind.CLASS) {
return (TypeElement) e.getEnclosingElement();
}
throw new ProcessingException(e,
"Field %s is not part of a class. Only fields in a class can be annotated with %s",
e.getSimpleName().toString(), Column.class.getSimpleName());
} | java | private TypeElement getSurroundingClass(Element e) throws ProcessingException {
if (e.getEnclosingElement().getKind() == ElementKind.CLASS) {
return (TypeElement) e.getEnclosingElement();
}
throw new ProcessingException(e,
"Field %s is not part of a class. Only fields in a class can be annotated with %s",
e.getSimpleName().toString(), Column.class.getSimpleName());
} | [
"private",
"TypeElement",
"getSurroundingClass",
"(",
"Element",
"e",
")",
"throws",
"ProcessingException",
"{",
"if",
"(",
"e",
".",
"getEnclosingElement",
"(",
")",
".",
"getKind",
"(",
")",
"==",
"ElementKind",
".",
"CLASS",
")",
"{",
"return",
"(",
"Type... | Checks if a Element is in class and returns the TypeElement of the surrounding class
@param e The element to check
@return The TypeElement of the surroungin class
@throws ProcessingException if surround class is not a element | [
"Checks",
"if",
"a",
"Element",
"is",
"in",
"class",
"and",
"returns",
"the",
"TypeElement",
"of",
"the",
"surrounding",
"class"
] | 8d02b76f00bd2f8997a58d33146b98b2eec35452 | https://github.com/sockeqwe/sqlbrite-dao/blob/8d02b76f00bd2f8997a58d33146b98b2eec35452/objectmapper-processor/src/main/java/com/hannesdorfmann/sqlbrite/objectmapper/processor/ObjectMappableProcessor.java#L71-L79 | train |
sockeqwe/sqlbrite-dao | objectmapper-processor/src/main/java/com/hannesdorfmann/sqlbrite/objectmapper/processor/ObjectMappableProcessor.java | ObjectMappableProcessor.checkAndGetClass | private TypeElement checkAndGetClass(Element e) throws ProcessingException {
if (e.getKind() != ElementKind.CLASS) {
throw new ProcessingException(e,
"%s is annotated with @%s but only classes can be annotated with this annotation",
e.toString(), ObjectMappable.class.getSimpleName());
}
return (TypeElement) e;
} | java | private TypeElement checkAndGetClass(Element e) throws ProcessingException {
if (e.getKind() != ElementKind.CLASS) {
throw new ProcessingException(e,
"%s is annotated with @%s but only classes can be annotated with this annotation",
e.toString(), ObjectMappable.class.getSimpleName());
}
return (TypeElement) e;
} | [
"private",
"TypeElement",
"checkAndGetClass",
"(",
"Element",
"e",
")",
"throws",
"ProcessingException",
"{",
"if",
"(",
"e",
".",
"getKind",
"(",
")",
"!=",
"ElementKind",
".",
"CLASS",
")",
"{",
"throw",
"new",
"ProcessingException",
"(",
"e",
",",
"\"%s i... | Check the Element if it's a class and returns the corresponding TypeElement
@param e The element to check
@return The {@link TypeElement} representing the annotated class
@throws ProcessingException If element is not a CLASS | [
"Check",
"the",
"Element",
"if",
"it",
"s",
"a",
"class",
"and",
"returns",
"the",
"corresponding",
"TypeElement"
] | 8d02b76f00bd2f8997a58d33146b98b2eec35452 | https://github.com/sockeqwe/sqlbrite-dao/blob/8d02b76f00bd2f8997a58d33146b98b2eec35452/objectmapper-processor/src/main/java/com/hannesdorfmann/sqlbrite/objectmapper/processor/ObjectMappableProcessor.java#L88-L97 | train |
sockeqwe/sqlbrite-dao | objectmapper-processor/src/main/java/com/hannesdorfmann/sqlbrite/objectmapper/processor/ObjectMappableProcessor.java | ObjectMappableProcessor.generateRxMappingMethod | private FieldSpec generateRxMappingMethod(ObjectMappableAnnotatedClass clazz) {
String objectVarName = "item";
String cursorVarName = "cursor";
TypeName elementType = ClassName.get(clazz.getElement().asType());
// new Func1<Cursor, ListsItem>()
CodeBlock.Builder initBlockBuilder = CodeBlock.builder()
.add("new $L<$L, $L>() {\n", Func1.class.getSimpleName(), Cursor.class.getSimpleName(),
elementType)
.indent()
.add("@Override public $L call($L cursor) {\n", elementType, Cursor.class.getSimpleName())
.indent();
// assign the columns indexes
generateColumnIndexCode(initBlockBuilder, clazz.getColumnAnnotatedElements(), cursorVarName);
// Instantiate element
initBlockBuilder.addStatement("$T $L = new $T()", elementType, objectVarName, elementType);
// read cursor into element variable
for (ColumnAnnotateable e : clazz.getColumnAnnotatedElements()) {
String indexVaName = e.getColumnName() + "Index";
initBlockBuilder.beginControlFlow("if ($L >= 0)", indexVaName);
e.generateAssignStatement(initBlockBuilder, objectVarName, cursorVarName, indexVaName);
initBlockBuilder.endControlFlow();
}
initBlockBuilder.addStatement("return $L", objectVarName)
.unindent()
.add("}\n") // end call () method
.unindent()
.add("}") // end anonymous class
.build();
ParameterizedTypeName fieldType =
ParameterizedTypeName.get(ClassName.get(Func1.class), ClassName.get(Cursor.class),
elementType);
return FieldSpec.builder(fieldType, "MAPPER", Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL)
.initializer(initBlockBuilder.build())
.build();
} | java | private FieldSpec generateRxMappingMethod(ObjectMappableAnnotatedClass clazz) {
String objectVarName = "item";
String cursorVarName = "cursor";
TypeName elementType = ClassName.get(clazz.getElement().asType());
// new Func1<Cursor, ListsItem>()
CodeBlock.Builder initBlockBuilder = CodeBlock.builder()
.add("new $L<$L, $L>() {\n", Func1.class.getSimpleName(), Cursor.class.getSimpleName(),
elementType)
.indent()
.add("@Override public $L call($L cursor) {\n", elementType, Cursor.class.getSimpleName())
.indent();
// assign the columns indexes
generateColumnIndexCode(initBlockBuilder, clazz.getColumnAnnotatedElements(), cursorVarName);
// Instantiate element
initBlockBuilder.addStatement("$T $L = new $T()", elementType, objectVarName, elementType);
// read cursor into element variable
for (ColumnAnnotateable e : clazz.getColumnAnnotatedElements()) {
String indexVaName = e.getColumnName() + "Index";
initBlockBuilder.beginControlFlow("if ($L >= 0)", indexVaName);
e.generateAssignStatement(initBlockBuilder, objectVarName, cursorVarName, indexVaName);
initBlockBuilder.endControlFlow();
}
initBlockBuilder.addStatement("return $L", objectVarName)
.unindent()
.add("}\n") // end call () method
.unindent()
.add("}") // end anonymous class
.build();
ParameterizedTypeName fieldType =
ParameterizedTypeName.get(ClassName.get(Func1.class), ClassName.get(Cursor.class),
elementType);
return FieldSpec.builder(fieldType, "MAPPER", Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL)
.initializer(initBlockBuilder.build())
.build();
} | [
"private",
"FieldSpec",
"generateRxMappingMethod",
"(",
"ObjectMappableAnnotatedClass",
"clazz",
")",
"{",
"String",
"objectVarName",
"=",
"\"item\"",
";",
"String",
"cursorVarName",
"=",
"\"cursor\"",
";",
"TypeName",
"elementType",
"=",
"ClassName",
".",
"get",
"(",... | Generates the field that can be used as RxJava method
@param clazz The {@link ObjectMappableAnnotatedClass}
@return MethodSpec | [
"Generates",
"the",
"field",
"that",
"can",
"be",
"used",
"as",
"RxJava",
"method"
] | 8d02b76f00bd2f8997a58d33146b98b2eec35452 | https://github.com/sockeqwe/sqlbrite-dao/blob/8d02b76f00bd2f8997a58d33146b98b2eec35452/objectmapper-processor/src/main/java/com/hannesdorfmann/sqlbrite/objectmapper/processor/ObjectMappableProcessor.java#L172-L216 | train |
sockeqwe/sqlbrite-dao | objectmapper-processor/src/main/java/com/hannesdorfmann/sqlbrite/objectmapper/processor/ObjectMappableProcessor.java | ObjectMappableProcessor.generateContentValuesBuilderClass | private TypeSpec generateContentValuesBuilderClass(ObjectMappableAnnotatedClass clazz,
String mapperClassName, String className) {
String cvVarName = "contentValues";
MethodSpec constructor = MethodSpec.constructorBuilder()
.addModifiers(Modifier.PRIVATE)
.addStatement("$L = new $T()", cvVarName, ClassName.get(ContentValues.class))
.build();
TypeSpec.Builder builder = TypeSpec.classBuilder(className)
.addJavadoc(
"Builder class to generate type sage {@link $T } . At the end you have to call {@link #build()}\n",
TypeName.get(ContentValues.class))
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
.addField(ContentValues.class, cvVarName, Modifier.PRIVATE)
.addMethod(constructor)
.addMethod(MethodSpec.methodBuilder("build")
.addJavadoc("Creates and returns a $T from the builder\n",
TypeName.get(ContentValues.class))
.addJavadoc("@return $T", TypeName.get(ContentValues.class))
.addModifiers(Modifier.PUBLIC)
.addStatement("return $L", cvVarName)
.returns(ContentValues.class)
.build());
String packageName = getPackageName(clazz);
for (ColumnAnnotateable e : clazz.getColumnAnnotatedElements()) {
e.generateContentValuesBuilderMethod(builder,
ClassName.get(packageName, mapperClassName, className), cvVarName);
}
return builder.build();
} | java | private TypeSpec generateContentValuesBuilderClass(ObjectMappableAnnotatedClass clazz,
String mapperClassName, String className) {
String cvVarName = "contentValues";
MethodSpec constructor = MethodSpec.constructorBuilder()
.addModifiers(Modifier.PRIVATE)
.addStatement("$L = new $T()", cvVarName, ClassName.get(ContentValues.class))
.build();
TypeSpec.Builder builder = TypeSpec.classBuilder(className)
.addJavadoc(
"Builder class to generate type sage {@link $T } . At the end you have to call {@link #build()}\n",
TypeName.get(ContentValues.class))
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
.addField(ContentValues.class, cvVarName, Modifier.PRIVATE)
.addMethod(constructor)
.addMethod(MethodSpec.methodBuilder("build")
.addJavadoc("Creates and returns a $T from the builder\n",
TypeName.get(ContentValues.class))
.addJavadoc("@return $T", TypeName.get(ContentValues.class))
.addModifiers(Modifier.PUBLIC)
.addStatement("return $L", cvVarName)
.returns(ContentValues.class)
.build());
String packageName = getPackageName(clazz);
for (ColumnAnnotateable e : clazz.getColumnAnnotatedElements()) {
e.generateContentValuesBuilderMethod(builder,
ClassName.get(packageName, mapperClassName, className), cvVarName);
}
return builder.build();
} | [
"private",
"TypeSpec",
"generateContentValuesBuilderClass",
"(",
"ObjectMappableAnnotatedClass",
"clazz",
",",
"String",
"mapperClassName",
",",
"String",
"className",
")",
"{",
"String",
"cvVarName",
"=",
"\"contentValues\"",
";",
"MethodSpec",
"constructor",
"=",
"Metho... | Generates the ContentValues Builder Class
@param clazz The class you want to create a builder for
@param className The classname @return The Builder class | [
"Generates",
"the",
"ContentValues",
"Builder",
"Class"
] | 8d02b76f00bd2f8997a58d33146b98b2eec35452 | https://github.com/sockeqwe/sqlbrite-dao/blob/8d02b76f00bd2f8997a58d33146b98b2eec35452/objectmapper-processor/src/main/java/com/hannesdorfmann/sqlbrite/objectmapper/processor/ObjectMappableProcessor.java#L269-L302 | train |
sockeqwe/sqlbrite-dao | objectmapper-processor/src/main/java/com/hannesdorfmann/sqlbrite/objectmapper/processor/ObjectMappableProcessor.java | ObjectMappableProcessor.generateContentValuesMethod | private MethodSpec generateContentValuesMethod(ObjectMappableAnnotatedClass clazz,
String mapperClassName, String className) {
ClassName typeName = ClassName.get(getPackageName(clazz), mapperClassName, className);
return MethodSpec.methodBuilder("contentValues")
.addJavadoc("Get a typesafe ContentValues Builder \n")
.addJavadoc("@return The ContentValues Builder \n")
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
.returns(typeName)
.addStatement("return new $T()", typeName)
.build();
} | java | private MethodSpec generateContentValuesMethod(ObjectMappableAnnotatedClass clazz,
String mapperClassName, String className) {
ClassName typeName = ClassName.get(getPackageName(clazz), mapperClassName, className);
return MethodSpec.methodBuilder("contentValues")
.addJavadoc("Get a typesafe ContentValues Builder \n")
.addJavadoc("@return The ContentValues Builder \n")
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
.returns(typeName)
.addStatement("return new $T()", typeName)
.build();
} | [
"private",
"MethodSpec",
"generateContentValuesMethod",
"(",
"ObjectMappableAnnotatedClass",
"clazz",
",",
"String",
"mapperClassName",
",",
"String",
"className",
")",
"{",
"ClassName",
"typeName",
"=",
"ClassName",
".",
"get",
"(",
"getPackageName",
"(",
"clazz",
")... | Generates a static file to get | [
"Generates",
"a",
"static",
"file",
"to",
"get"
] | 8d02b76f00bd2f8997a58d33146b98b2eec35452 | https://github.com/sockeqwe/sqlbrite-dao/blob/8d02b76f00bd2f8997a58d33146b98b2eec35452/objectmapper-processor/src/main/java/com/hannesdorfmann/sqlbrite/objectmapper/processor/ObjectMappableProcessor.java#L307-L319 | train |
sockeqwe/sqlbrite-dao | objectmapper-processor/src/main/java/com/hannesdorfmann/sqlbrite/objectmapper/processor/ObjectMappableProcessor.java | ObjectMappableProcessor.getPackageName | private String getPackageName(ObjectMappableAnnotatedClass clazz) {
PackageElement pkg = elements.getPackageOf(clazz.getElement());
return pkg.isUnnamed() ? "" : pkg.getQualifiedName().toString();
} | java | private String getPackageName(ObjectMappableAnnotatedClass clazz) {
PackageElement pkg = elements.getPackageOf(clazz.getElement());
return pkg.isUnnamed() ? "" : pkg.getQualifiedName().toString();
} | [
"private",
"String",
"getPackageName",
"(",
"ObjectMappableAnnotatedClass",
"clazz",
")",
"{",
"PackageElement",
"pkg",
"=",
"elements",
".",
"getPackageOf",
"(",
"clazz",
".",
"getElement",
"(",
")",
")",
";",
"return",
"pkg",
".",
"isUnnamed",
"(",
")",
"?",... | Get the package name of a certain clazz
@param clazz The class you want the packagename for
@return The package name | [
"Get",
"the",
"package",
"name",
"of",
"a",
"certain",
"clazz"
] | 8d02b76f00bd2f8997a58d33146b98b2eec35452 | https://github.com/sockeqwe/sqlbrite-dao/blob/8d02b76f00bd2f8997a58d33146b98b2eec35452/objectmapper-processor/src/main/java/com/hannesdorfmann/sqlbrite/objectmapper/processor/ObjectMappableProcessor.java#L327-L330 | train |
sockeqwe/sqlbrite-dao | dao/src/main/java/com/hannesdorfmann/sqlbrite/dao/Dao.java | Dao.rawQueryOnManyTables | protected QueryBuilder rawQueryOnManyTables(@Nullable final Iterable<String> tables,
@NonNull final String sql) {
return new QueryBuilder(tables, sql);
} | java | protected QueryBuilder rawQueryOnManyTables(@Nullable final Iterable<String> tables,
@NonNull final String sql) {
return new QueryBuilder(tables, sql);
} | [
"protected",
"QueryBuilder",
"rawQueryOnManyTables",
"(",
"@",
"Nullable",
"final",
"Iterable",
"<",
"String",
">",
"tables",
",",
"@",
"NonNull",
"final",
"String",
"sql",
")",
"{",
"return",
"new",
"QueryBuilder",
"(",
"tables",
",",
"sql",
")",
";",
"}"
] | Creates a raw query and enables auto updates for the given tables
@param tables The affected table. updates get triggered if the observed tables changes. Use
{@code null} or
{@link #rawQuery(String)} if you don't want to register for automatic updates
@param sql The sql query statement
@return Observable of this query | [
"Creates",
"a",
"raw",
"query",
"and",
"enables",
"auto",
"updates",
"for",
"the",
"given",
"tables"
] | 8d02b76f00bd2f8997a58d33146b98b2eec35452 | https://github.com/sockeqwe/sqlbrite-dao/blob/8d02b76f00bd2f8997a58d33146b98b2eec35452/dao/src/main/java/com/hannesdorfmann/sqlbrite/dao/Dao.java#L169-L172 | train |
sockeqwe/sqlbrite-dao | dao/src/main/java/com/hannesdorfmann/sqlbrite/dao/Dao.java | Dao.executeQuery | private QueryObservable executeQuery(QueryBuilder queryBuilder) {
// Raw query properties as default
String sql = queryBuilder.rawStatement;
Iterable<String> affectedTables = queryBuilder.rawStatementAffectedTables;
// If SqlFinishedStatement is set then use that one
if (queryBuilder.statement != null) {
SqlCompileable.CompileableStatement compileableStatement =
queryBuilder.statement.asCompileableStatement();
sql = compileableStatement.sql;
affectedTables = compileableStatement.tables;
}
// Check for auto update
if (!queryBuilder.autoUpdate || affectedTables == null) {
affectedTables = Collections.emptySet();
}
return db.createQuery(affectedTables, sql, queryBuilder.args);
} | java | private QueryObservable executeQuery(QueryBuilder queryBuilder) {
// Raw query properties as default
String sql = queryBuilder.rawStatement;
Iterable<String> affectedTables = queryBuilder.rawStatementAffectedTables;
// If SqlFinishedStatement is set then use that one
if (queryBuilder.statement != null) {
SqlCompileable.CompileableStatement compileableStatement =
queryBuilder.statement.asCompileableStatement();
sql = compileableStatement.sql;
affectedTables = compileableStatement.tables;
}
// Check for auto update
if (!queryBuilder.autoUpdate || affectedTables == null) {
affectedTables = Collections.emptySet();
}
return db.createQuery(affectedTables, sql, queryBuilder.args);
} | [
"private",
"QueryObservable",
"executeQuery",
"(",
"QueryBuilder",
"queryBuilder",
")",
"{",
"// Raw query properties as default",
"String",
"sql",
"=",
"queryBuilder",
".",
"rawStatement",
";",
"Iterable",
"<",
"String",
">",
"affectedTables",
"=",
"queryBuilder",
".",... | Executes the a query | [
"Executes",
"the",
"a",
"query"
] | 8d02b76f00bd2f8997a58d33146b98b2eec35452 | https://github.com/sockeqwe/sqlbrite-dao/blob/8d02b76f00bd2f8997a58d33146b98b2eec35452/dao/src/main/java/com/hannesdorfmann/sqlbrite/dao/Dao.java#L200-L222 | train |
sockeqwe/sqlbrite-dao | dao/src/main/java/com/hannesdorfmann/sqlbrite/dao/Dao.java | Dao.insert | @CheckResult protected Observable<Long> insert(final String table, final ContentValues contentValues) {
return Observable.defer(new Func0<Observable<Long>>() {
@Override
public Observable<Long> call() {
return Observable.just(db.insert(table, contentValues));
}
});
} | java | @CheckResult protected Observable<Long> insert(final String table, final ContentValues contentValues) {
return Observable.defer(new Func0<Observable<Long>>() {
@Override
public Observable<Long> call() {
return Observable.just(db.insert(table, contentValues));
}
});
} | [
"@",
"CheckResult",
"protected",
"Observable",
"<",
"Long",
">",
"insert",
"(",
"final",
"String",
"table",
",",
"final",
"ContentValues",
"contentValues",
")",
"{",
"return",
"Observable",
".",
"defer",
"(",
"new",
"Func0",
"<",
"Observable",
"<",
"Long",
"... | Insert a row into the given table
@param table the table name
@param contentValues The content values
@return An <b>deferred</b> observable with the row Id of the new inserted row | [
"Insert",
"a",
"row",
"into",
"the",
"given",
"table"
] | 8d02b76f00bd2f8997a58d33146b98b2eec35452 | https://github.com/sockeqwe/sqlbrite-dao/blob/8d02b76f00bd2f8997a58d33146b98b2eec35452/dao/src/main/java/com/hannesdorfmann/sqlbrite/dao/Dao.java#L231-L238 | train |
sockeqwe/sqlbrite-dao | dao/src/main/java/com/hannesdorfmann/sqlbrite/dao/Dao.java | Dao.delete | @CheckResult protected Observable<Integer> delete(@NonNull final String table) {
return delete(table, null);
} | java | @CheckResult protected Observable<Integer> delete(@NonNull final String table) {
return delete(table, null);
} | [
"@",
"CheckResult",
"protected",
"Observable",
"<",
"Integer",
">",
"delete",
"(",
"@",
"NonNull",
"final",
"String",
"table",
")",
"{",
"return",
"delete",
"(",
"table",
",",
"null",
")",
";",
"}"
] | Deletes all rows from a table
@param table The table to delete
@return <b>deferred</b> Observable with the number of deleted rows | [
"Deletes",
"all",
"rows",
"from",
"a",
"table"
] | 8d02b76f00bd2f8997a58d33146b98b2eec35452 | https://github.com/sockeqwe/sqlbrite-dao/blob/8d02b76f00bd2f8997a58d33146b98b2eec35452/dao/src/main/java/com/hannesdorfmann/sqlbrite/dao/Dao.java#L305-L307 | train |
sockeqwe/sqlbrite-dao | dao/src/main/java/com/hannesdorfmann/sqlbrite/dao/Dao.java | Dao.delete | @CheckResult protected Observable<Integer> delete(@NonNull final String table,
@Nullable final String whereClause, @Nullable final String... whereArgs) {
return Observable.defer(new Func0<Observable<Integer>>() {
@Override
public Observable<Integer> call() {
return Observable.just(db.delete(table, whereClause, whereArgs));
}
});
} | java | @CheckResult protected Observable<Integer> delete(@NonNull final String table,
@Nullable final String whereClause, @Nullable final String... whereArgs) {
return Observable.defer(new Func0<Observable<Integer>>() {
@Override
public Observable<Integer> call() {
return Observable.just(db.delete(table, whereClause, whereArgs));
}
});
} | [
"@",
"CheckResult",
"protected",
"Observable",
"<",
"Integer",
">",
"delete",
"(",
"@",
"NonNull",
"final",
"String",
"table",
",",
"@",
"Nullable",
"final",
"String",
"whereClause",
",",
"@",
"Nullable",
"final",
"String",
"...",
"whereArgs",
")",
"{",
"ret... | Delete data from a table
@param table The table name
@param whereClause the where clause
@param whereArgs the where clause arguments
@return <b>deferred</b> Observable with the number of deleted rows | [
"Delete",
"data",
"from",
"a",
"table"
] | 8d02b76f00bd2f8997a58d33146b98b2eec35452 | https://github.com/sockeqwe/sqlbrite-dao/blob/8d02b76f00bd2f8997a58d33146b98b2eec35452/dao/src/main/java/com/hannesdorfmann/sqlbrite/dao/Dao.java#L317-L325 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/LocaleUtils.java | LocaleUtils.parseLocale | private static Locale parseLocale(final String str) {
if (isISO639LanguageCode(str)) {
return new Locale(str);
}
final String[] segments = str.split("_", -1);
final String language = segments[0];
if (segments.length == 2) {
final String country = segments[1];
if (isISO639LanguageCode(language) && isISO3166CountryCode(country) ||
isNumericAreaCode(country)) {
return new Locale(language, country);
}
} else if (segments.length == 3) {
final String country = segments[1];
final String variant = segments[2];
if (isISO639LanguageCode(language) &&
(country.length() == 0 || isISO3166CountryCode(country) || isNumericAreaCode(country)) &&
variant.length() > 0) {
return new Locale(language, country, variant);
}
}
throw new IllegalArgumentException("Invalid locale format: " + str);
} | java | private static Locale parseLocale(final String str) {
if (isISO639LanguageCode(str)) {
return new Locale(str);
}
final String[] segments = str.split("_", -1);
final String language = segments[0];
if (segments.length == 2) {
final String country = segments[1];
if (isISO639LanguageCode(language) && isISO3166CountryCode(country) ||
isNumericAreaCode(country)) {
return new Locale(language, country);
}
} else if (segments.length == 3) {
final String country = segments[1];
final String variant = segments[2];
if (isISO639LanguageCode(language) &&
(country.length() == 0 || isISO3166CountryCode(country) || isNumericAreaCode(country)) &&
variant.length() > 0) {
return new Locale(language, country, variant);
}
}
throw new IllegalArgumentException("Invalid locale format: " + str);
} | [
"private",
"static",
"Locale",
"parseLocale",
"(",
"final",
"String",
"str",
")",
"{",
"if",
"(",
"isISO639LanguageCode",
"(",
"str",
")",
")",
"{",
"return",
"new",
"Locale",
"(",
"str",
")",
";",
"}",
"final",
"String",
"[",
"]",
"segments",
"=",
"st... | Tries to parse a locale from the given String.
@param str the String to parse a locale from.
@return a Locale instance parsed from the given String.
@throws IllegalArgumentException if the given String can not be parsed. | [
"Tries",
"to",
"parse",
"a",
"locale",
"from",
"the",
"given",
"String",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/LocaleUtils.java#L139-L162 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/LocaleUtils.java | LocaleUtils.isISO639LanguageCode | private static boolean isISO639LanguageCode(final String str) {
return StringUtils.isAllLowerCase(str) && (str.length() == 2 || str.length() == 3);
} | java | private static boolean isISO639LanguageCode(final String str) {
return StringUtils.isAllLowerCase(str) && (str.length() == 2 || str.length() == 3);
} | [
"private",
"static",
"boolean",
"isISO639LanguageCode",
"(",
"final",
"String",
"str",
")",
"{",
"return",
"StringUtils",
".",
"isAllLowerCase",
"(",
"str",
")",
"&&",
"(",
"str",
".",
"length",
"(",
")",
"==",
"2",
"||",
"str",
".",
"length",
"(",
")",
... | Checks whether the given String is a ISO 639 compliant language code.
@param str the String to check.
@return true, if the given String is a ISO 639 compliant language code. | [
"Checks",
"whether",
"the",
"given",
"String",
"is",
"a",
"ISO",
"639",
"compliant",
"language",
"code",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/LocaleUtils.java#L170-L172 | train |
sockeqwe/sqlbrite-dao | objectmapper-processor/src/main/java/com/hannesdorfmann/sqlbrite/objectmapper/processor/ModifierUtils.java | ModifierUtils.compareModifierVisibility | public static int compareModifierVisibility(Element a, Element b) {
// a better
if (a.getModifiers().contains(Modifier.PUBLIC) && !b.getModifiers().contains(Modifier.PUBLIC)) {
return -1;
}
if (isDefaultModifier(a.getModifiers()) && !isDefaultModifier(b.getModifiers())) {
return -1;
}
if (a.getModifiers().contains(Modifier.PROTECTED) && !b.getModifiers().contains(Modifier.PROTECTED)) {
return -1;
}
// b better
if (b.getModifiers().contains(Modifier.PUBLIC) && !a.getModifiers().contains(Modifier.PUBLIC)) {
return 1;
}
if (isDefaultModifier(b.getModifiers()) && !isDefaultModifier(a.getModifiers())) {
return 1;
}
if (b.getModifiers().contains(Modifier.PROTECTED) && !a.getModifiers().contains(Modifier.PROTECTED)) {
return 1;
}
// Same
return 0;
} | java | public static int compareModifierVisibility(Element a, Element b) {
// a better
if (a.getModifiers().contains(Modifier.PUBLIC) && !b.getModifiers().contains(Modifier.PUBLIC)) {
return -1;
}
if (isDefaultModifier(a.getModifiers()) && !isDefaultModifier(b.getModifiers())) {
return -1;
}
if (a.getModifiers().contains(Modifier.PROTECTED) && !b.getModifiers().contains(Modifier.PROTECTED)) {
return -1;
}
// b better
if (b.getModifiers().contains(Modifier.PUBLIC) && !a.getModifiers().contains(Modifier.PUBLIC)) {
return 1;
}
if (isDefaultModifier(b.getModifiers()) && !isDefaultModifier(a.getModifiers())) {
return 1;
}
if (b.getModifiers().contains(Modifier.PROTECTED) && !a.getModifiers().contains(Modifier.PROTECTED)) {
return 1;
}
// Same
return 0;
} | [
"public",
"static",
"int",
"compareModifierVisibility",
"(",
"Element",
"a",
",",
"Element",
"b",
")",
"{",
"// a better",
"if",
"(",
"a",
".",
"getModifiers",
"(",
")",
".",
"contains",
"(",
"Modifier",
".",
"PUBLIC",
")",
"&&",
"!",
"b",
".",
"getModif... | Compare the modifier of two elements
@return -1 if element a has better visibility, 0 if both have the same visibility, +1 if b has
the better visibility. The "best" visibility is PUBLIC | [
"Compare",
"the",
"modifier",
"of",
"two",
"elements"
] | 8d02b76f00bd2f8997a58d33146b98b2eec35452 | https://github.com/sockeqwe/sqlbrite-dao/blob/8d02b76f00bd2f8997a58d33146b98b2eec35452/objectmapper-processor/src/main/java/com/hannesdorfmann/sqlbrite/objectmapper/processor/ModifierUtils.java#L25-L57 | train |
ixa-ehu/ixa-pipe-pos | src/main/java/eus/ixa/ixa/pipe/pos/eval/POSEvaluate.java | POSEvaluate.evaluate | public final void evaluate() {
final POSEvaluator evaluator = new POSEvaluator(this.posTagger);
try {
evaluator.evaluate(this.testSamples);
} catch (IOException e) {
e.printStackTrace();
}
System.out.println(evaluator.getWordAccuracy());
} | java | public final void evaluate() {
final POSEvaluator evaluator = new POSEvaluator(this.posTagger);
try {
evaluator.evaluate(this.testSamples);
} catch (IOException e) {
e.printStackTrace();
}
System.out.println(evaluator.getWordAccuracy());
} | [
"public",
"final",
"void",
"evaluate",
"(",
")",
"{",
"final",
"POSEvaluator",
"evaluator",
"=",
"new",
"POSEvaluator",
"(",
"this",
".",
"posTagger",
")",
";",
"try",
"{",
"evaluator",
".",
"evaluate",
"(",
"this",
".",
"testSamples",
")",
";",
"}",
"ca... | Evaluate word accuracy. | [
"Evaluate",
"word",
"accuracy",
"."
] | 083c986103f95ae8063b8ddc89a2caa8047d29b9 | https://github.com/ixa-ehu/ixa-pipe-pos/blob/083c986103f95ae8063b8ddc89a2caa8047d29b9/src/main/java/eus/ixa/ixa/pipe/pos/eval/POSEvaluate.java#L96-L104 | train |
ixa-ehu/ixa-pipe-pos | src/main/java/eus/ixa/ixa/pipe/pos/eval/POSEvaluate.java | POSEvaluate.detailEvaluate | public final void detailEvaluate() {
final List<EvaluationMonitor<POSSample>> listeners = new LinkedList<EvaluationMonitor<POSSample>>();
final POSTaggerFineGrainedReportListener detailedFListener = new POSTaggerFineGrainedReportListener(
System.out);
listeners.add(detailedFListener);
final POSEvaluator evaluator = new POSEvaluator(this.posTagger,
listeners.toArray(new POSTaggerEvaluationMonitor[listeners.size()]));
try {
evaluator.evaluate(this.testSamples);
} catch (IOException e) {
e.printStackTrace();
}
detailedFListener.writeReport();
} | java | public final void detailEvaluate() {
final List<EvaluationMonitor<POSSample>> listeners = new LinkedList<EvaluationMonitor<POSSample>>();
final POSTaggerFineGrainedReportListener detailedFListener = new POSTaggerFineGrainedReportListener(
System.out);
listeners.add(detailedFListener);
final POSEvaluator evaluator = new POSEvaluator(this.posTagger,
listeners.toArray(new POSTaggerEvaluationMonitor[listeners.size()]));
try {
evaluator.evaluate(this.testSamples);
} catch (IOException e) {
e.printStackTrace();
}
detailedFListener.writeReport();
} | [
"public",
"final",
"void",
"detailEvaluate",
"(",
")",
"{",
"final",
"List",
"<",
"EvaluationMonitor",
"<",
"POSSample",
">",
">",
"listeners",
"=",
"new",
"LinkedList",
"<",
"EvaluationMonitor",
"<",
"POSSample",
">",
">",
"(",
")",
";",
"final",
"POSTagger... | Detail evaluation of a model, outputting the report a file. | [
"Detail",
"evaluation",
"of",
"a",
"model",
"outputting",
"the",
"report",
"a",
"file",
"."
] | 083c986103f95ae8063b8ddc89a2caa8047d29b9 | https://github.com/ixa-ehu/ixa-pipe-pos/blob/083c986103f95ae8063b8ddc89a2caa8047d29b9/src/main/java/eus/ixa/ixa/pipe/pos/eval/POSEvaluate.java#L109-L122 | train |
alexheretic/dynamics | src/main/java/alexh/weak/XmlDynamic.java | XmlDynamic.streamChildNodes | private static Stream<Node> streamChildNodes(Node node) {
int children = node.getChildNodes().getLength();
Node firstChild = node.getFirstChild();
if (firstChild == null) return Stream.empty();
return Stream.iterate(firstChild, prev -> prev != null ? prev.getNextSibling() : null)
.limit(children)
.filter(n -> n != null);
} | java | private static Stream<Node> streamChildNodes(Node node) {
int children = node.getChildNodes().getLength();
Node firstChild = node.getFirstChild();
if (firstChild == null) return Stream.empty();
return Stream.iterate(firstChild, prev -> prev != null ? prev.getNextSibling() : null)
.limit(children)
.filter(n -> n != null);
} | [
"private",
"static",
"Stream",
"<",
"Node",
">",
"streamChildNodes",
"(",
"Node",
"node",
")",
"{",
"int",
"children",
"=",
"node",
".",
"getChildNodes",
"(",
")",
".",
"getLength",
"(",
")",
";",
"Node",
"firstChild",
"=",
"node",
".",
"getFirstChild",
... | Needs to be thread-safe, childNodes NodeList is not! | [
"Needs",
"to",
"be",
"thread",
"-",
"safe",
"childNodes",
"NodeList",
"is",
"not!"
] | aa46ca76247d43f399eb9c2037c9b4c2549b3722 | https://github.com/alexheretic/dynamics/blob/aa46ca76247d43f399eb9c2037c9b4c2549b3722/src/main/java/alexh/weak/XmlDynamic.java#L72-L79 | train |
alexheretic/dynamics | src/main/java/alexh/weak/XmlDynamic.java | XmlDynamic.streamAttributes | private static Stream<Node> streamAttributes(Node node) {
final NamedNodeMap attributes = node.getAttributes();
if (attributes == null) return Stream.empty();
return IntStream.range(0, attributes.getLength()).mapToObj(attributes::item);
} | java | private static Stream<Node> streamAttributes(Node node) {
final NamedNodeMap attributes = node.getAttributes();
if (attributes == null) return Stream.empty();
return IntStream.range(0, attributes.getLength()).mapToObj(attributes::item);
} | [
"private",
"static",
"Stream",
"<",
"Node",
">",
"streamAttributes",
"(",
"Node",
"node",
")",
"{",
"final",
"NamedNodeMap",
"attributes",
"=",
"node",
".",
"getAttributes",
"(",
")",
";",
"if",
"(",
"attributes",
"==",
"null",
")",
"return",
"Stream",
"."... | Needs to be thread-safe | [
"Needs",
"to",
"be",
"thread",
"-",
"safe"
] | aa46ca76247d43f399eb9c2037c9b4c2549b3722 | https://github.com/alexheretic/dynamics/blob/aa46ca76247d43f399eb9c2037c9b4c2549b3722/src/main/java/alexh/weak/XmlDynamic.java#L82-L86 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/concurrent/AbstractCircuitBreaker.java | AbstractCircuitBreaker.changeState | protected void changeState(final State newState) {
if (state.compareAndSet(newState.oppositeState(), newState)) {
changeSupport.firePropertyChange(PROPERTY_NAME, !isOpen(newState), isOpen(newState));
}
} | java | protected void changeState(final State newState) {
if (state.compareAndSet(newState.oppositeState(), newState)) {
changeSupport.firePropertyChange(PROPERTY_NAME, !isOpen(newState), isOpen(newState));
}
} | [
"protected",
"void",
"changeState",
"(",
"final",
"State",
"newState",
")",
"{",
"if",
"(",
"state",
".",
"compareAndSet",
"(",
"newState",
".",
"oppositeState",
"(",
")",
",",
"newState",
")",
")",
"{",
"changeSupport",
".",
"firePropertyChange",
"(",
"PROP... | Changes the internal state of this circuit breaker. If there is actually a change
of the state value, all registered change listeners are notified.
@param newState the new state to be set | [
"Changes",
"the",
"internal",
"state",
"of",
"this",
"circuit",
"breaker",
".",
"If",
"there",
"is",
"actually",
"a",
"change",
"of",
"the",
"state",
"value",
"all",
"registered",
"change",
"listeners",
"are",
"notified",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/concurrent/AbstractCircuitBreaker.java#L112-L116 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/WordUtils.java | WordUtils.isDelimiter | private static boolean isDelimiter(final char ch, final char[] delimiters) {
if (delimiters == null) {
return CharUtils.isWhitespace(ch);
}
for (final char delimiter : delimiters) {
if (ch == delimiter) {
return true;
}
}
return false;
} | java | private static boolean isDelimiter(final char ch, final char[] delimiters) {
if (delimiters == null) {
return CharUtils.isWhitespace(ch);
}
for (final char delimiter : delimiters) {
if (ch == delimiter) {
return true;
}
}
return false;
} | [
"private",
"static",
"boolean",
"isDelimiter",
"(",
"final",
"char",
"ch",
",",
"final",
"char",
"[",
"]",
"delimiters",
")",
"{",
"if",
"(",
"delimiters",
"==",
"null",
")",
"{",
"return",
"CharUtils",
".",
"isWhitespace",
"(",
"ch",
")",
";",
"}",
"f... | Is the character a delimiter.
@param ch the character to check
@param delimiters the delimiters
@return true if it is a delimiter | [
"Is",
"the",
"character",
"a",
"delimiter",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/WordUtils.java#L743-L753 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/concurrent/AtomicInitializer.java | AtomicInitializer.get | @Override
public T get() throws ConcurrentException {
T result = reference.get();
if (result == null) {
result = initialize();
if (!reference.compareAndSet(null, result)) {
// another thread has initialized the reference
result = reference.get();
}
}
return result;
} | java | @Override
public T get() throws ConcurrentException {
T result = reference.get();
if (result == null) {
result = initialize();
if (!reference.compareAndSet(null, result)) {
// another thread has initialized the reference
result = reference.get();
}
}
return result;
} | [
"@",
"Override",
"public",
"T",
"get",
"(",
")",
"throws",
"ConcurrentException",
"{",
"T",
"result",
"=",
"reference",
".",
"get",
"(",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"initialize",
"(",
")",
";",
"if",
"(",
"... | Returns the object managed by this initializer. The object is created if
it is not available yet and stored internally. This method always returns
the same object.
@return the object created by this {@code AtomicInitializer}
@throws ConcurrentException if an error occurred during initialization of
the object | [
"Returns",
"the",
"object",
"managed",
"by",
"this",
"initializer",
".",
"The",
"object",
"is",
"created",
"if",
"it",
"is",
"not",
"available",
"yet",
"and",
"stored",
"internally",
".",
"This",
"method",
"always",
"returns",
"the",
"same",
"object",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/concurrent/AtomicInitializer.java#L82-L95 | train |
ixa-ehu/ixa-pipe-pos | src/main/java/eus/ixa/ixa/pipe/lemma/StatisticalLemmatizer.java | StatisticalLemmatizer.getMorphemes | public final List<Morpheme> getMorphemes(final String[] tokens, final String[] posTags) {
final List<String> lemmas = lemmatize(tokens, posTags);
final List<Morpheme> morphemes = getMorphemesFromStrings(tokens, posTags, lemmas);
return morphemes;
} | java | public final List<Morpheme> getMorphemes(final String[] tokens, final String[] posTags) {
final List<String> lemmas = lemmatize(tokens, posTags);
final List<Morpheme> morphemes = getMorphemesFromStrings(tokens, posTags, lemmas);
return morphemes;
} | [
"public",
"final",
"List",
"<",
"Morpheme",
">",
"getMorphemes",
"(",
"final",
"String",
"[",
"]",
"tokens",
",",
"final",
"String",
"[",
"]",
"posTags",
")",
"{",
"final",
"List",
"<",
"String",
">",
"lemmas",
"=",
"lemmatize",
"(",
"tokens",
",",
"po... | Get lemmas from a tokenized and pos tagged sentence.
@param tokens
the tokenized sentence
@param posTags the pos tags of the sentence
@return a list of {@code Morpheme} objects containing morphological info | [
"Get",
"lemmas",
"from",
"a",
"tokenized",
"and",
"pos",
"tagged",
"sentence",
"."
] | 083c986103f95ae8063b8ddc89a2caa8047d29b9 | https://github.com/ixa-ehu/ixa-pipe-pos/blob/083c986103f95ae8063b8ddc89a2caa8047d29b9/src/main/java/eus/ixa/ixa/pipe/lemma/StatisticalLemmatizer.java#L91-L95 | train |
ixa-ehu/ixa-pipe-pos | src/main/java/eus/ixa/ixa/pipe/lemma/StatisticalLemmatizer.java | StatisticalLemmatizer.lemmatize | public List<String> lemmatize(String[] tokens, String[] posTags) {
String[] annotatedLemmas = lemmatizer.lemmatize(tokens, posTags);
String[] decodedLemmas = lemmatizer.decodeLemmas(tokens, annotatedLemmas);
final List<String> lemmas = new ArrayList<String>(Arrays.asList(decodedLemmas));
return lemmas;
} | java | public List<String> lemmatize(String[] tokens, String[] posTags) {
String[] annotatedLemmas = lemmatizer.lemmatize(tokens, posTags);
String[] decodedLemmas = lemmatizer.decodeLemmas(tokens, annotatedLemmas);
final List<String> lemmas = new ArrayList<String>(Arrays.asList(decodedLemmas));
return lemmas;
} | [
"public",
"List",
"<",
"String",
">",
"lemmatize",
"(",
"String",
"[",
"]",
"tokens",
",",
"String",
"[",
"]",
"posTags",
")",
"{",
"String",
"[",
"]",
"annotatedLemmas",
"=",
"lemmatizer",
".",
"lemmatize",
"(",
"tokens",
",",
"posTags",
")",
";",
"St... | Produce lemmas from a tokenized sentence and its postags.
@param tokens the tokens
@param posTags the pos tags
@return the lemmas | [
"Produce",
"lemmas",
"from",
"a",
"tokenized",
"sentence",
"and",
"its",
"postags",
"."
] | 083c986103f95ae8063b8ddc89a2caa8047d29b9 | https://github.com/ixa-ehu/ixa-pipe-pos/blob/083c986103f95ae8063b8ddc89a2caa8047d29b9/src/main/java/eus/ixa/ixa/pipe/lemma/StatisticalLemmatizer.java#L103-L108 | train |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/event/EventListenerSupport.java | EventListenerSupport.initializeTransientFields | private void initializeTransientFields(final Class<L> listenerInterface, final ClassLoader classLoader) {
@SuppressWarnings("unchecked") // Will throw CCE here if not correct
final
L[] array = (L[]) Array.newInstance(listenerInterface, 0);
this.prototypeArray = array;
createProxy(listenerInterface, classLoader);
} | java | private void initializeTransientFields(final Class<L> listenerInterface, final ClassLoader classLoader) {
@SuppressWarnings("unchecked") // Will throw CCE here if not correct
final
L[] array = (L[]) Array.newInstance(listenerInterface, 0);
this.prototypeArray = array;
createProxy(listenerInterface, classLoader);
} | [
"private",
"void",
"initializeTransientFields",
"(",
"final",
"Class",
"<",
"L",
">",
"listenerInterface",
",",
"final",
"ClassLoader",
"classLoader",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"// Will throw CCE here if not correct",
"final",
"L",
... | Initialize transient fields.
@param listenerInterface the class of the listener interface
@param classLoader the class loader to be used | [
"Initialize",
"transient",
"fields",
"."
] | 9e2dfbbda3668cfa5d935fe76479d1426c294504 | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/event/EventListenerSupport.java#L291-L297 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.