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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
groovy/groovy-core | subprojects/groovy-console/src/main/groovy/groovy/ui/text/FindReplaceUtility.java | FindReplaceUtility.findNext | private static int findNext(boolean reverse, int pos) {
boolean backwards = IS_BACKWARDS_CHECKBOX.isSelected();
backwards = backwards ? !reverse : reverse;
String pattern = (String) FIND_FIELD.getSelectedItem();
if (pattern != null && pattern.length() > 0) {
try {
... | java | private static int findNext(boolean reverse, int pos) {
boolean backwards = IS_BACKWARDS_CHECKBOX.isSelected();
backwards = backwards ? !reverse : reverse;
String pattern = (String) FIND_FIELD.getSelectedItem();
if (pattern != null && pattern.length() > 0) {
try {
... | [
"private",
"static",
"int",
"findNext",
"(",
"boolean",
"reverse",
",",
"int",
"pos",
")",
"{",
"boolean",
"backwards",
"=",
"IS_BACKWARDS_CHECKBOX",
".",
"isSelected",
"(",
")",
";",
"backwards",
"=",
"backwards",
"?",
"!",
"reverse",
":",
"reverse",
";",
... | Find and select the next searchable matching text.
@param reverse look forwards or backwards
@param pos the starting index to start finding from
@return the location of the next selected, or -1 if not found | [
"Find",
"and",
"select",
"the",
"next",
"searchable",
"matching",
"text",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-console/src/main/groovy/groovy/ui/text/FindReplaceUtility.java#L261-L326 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/vmplugin/v7/IndyInterface.java | IndyInterface.invalidateSwitchPoints | protected static void invalidateSwitchPoints() {
if (LOG_ENABLED) {
LOG.info("invalidating switch point");
}
SwitchPoint old = switchPoint;
switchPoint = new SwitchPoint();
synchronized(IndyInterface.class) { SwitchPoint.invalidateAll(new SwitchP... | java | protected static void invalidateSwitchPoints() {
if (LOG_ENABLED) {
LOG.info("invalidating switch point");
}
SwitchPoint old = switchPoint;
switchPoint = new SwitchPoint();
synchronized(IndyInterface.class) { SwitchPoint.invalidateAll(new SwitchP... | [
"protected",
"static",
"void",
"invalidateSwitchPoints",
"(",
")",
"{",
"if",
"(",
"LOG_ENABLED",
")",
"{",
"LOG",
".",
"info",
"(",
"\"invalidating switch point\"",
")",
";",
"}",
"SwitchPoint",
"old",
"=",
"switchPoint",
";",
"switchPoint",
"=",
"new",
"Swit... | Callback for constant meta class update change | [
"Callback",
"for",
"constant",
"meta",
"class",
"update",
"change"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/vmplugin/v7/IndyInterface.java#L108-L115 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/vmplugin/v7/IndyInterface.java | IndyInterface.bootstrapCurrent | public static CallSite bootstrapCurrent(Lookup caller, String name, MethodType type) {
return realBootstrap(caller, name, CALL_TYPES.METHOD.ordinal(), type, false, true, false);
} | java | public static CallSite bootstrapCurrent(Lookup caller, String name, MethodType type) {
return realBootstrap(caller, name, CALL_TYPES.METHOD.ordinal(), type, false, true, false);
} | [
"public",
"static",
"CallSite",
"bootstrapCurrent",
"(",
"Lookup",
"caller",
",",
"String",
"name",
",",
"MethodType",
"type",
")",
"{",
"return",
"realBootstrap",
"(",
"caller",
",",
"name",
",",
"CALL_TYPES",
".",
"METHOD",
".",
"ordinal",
"(",
")",
",",
... | bootstrap method for method calls with "this" as receiver
@deprecated since Groovy 2.1.0 | [
"bootstrap",
"method",
"for",
"method",
"calls",
"with",
"this",
"as",
"receiver"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/vmplugin/v7/IndyInterface.java#L157-L159 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/vmplugin/v7/IndyInterface.java | IndyInterface.realBootstrap | private static CallSite realBootstrap(Lookup caller, String name, int callID, MethodType type, boolean safe, boolean thisCall, boolean spreadCall) {
// since indy does not give us the runtime types
// we produce first a dummy call site, which then changes the target to one,
// that d... | java | private static CallSite realBootstrap(Lookup caller, String name, int callID, MethodType type, boolean safe, boolean thisCall, boolean spreadCall) {
// since indy does not give us the runtime types
// we produce first a dummy call site, which then changes the target to one,
// that d... | [
"private",
"static",
"CallSite",
"realBootstrap",
"(",
"Lookup",
"caller",
",",
"String",
"name",
",",
"int",
"callID",
",",
"MethodType",
"type",
",",
"boolean",
"safe",
",",
"boolean",
"thisCall",
",",
"boolean",
"spreadCall",
")",
"{",
"// since indy does not... | backing bootstrap method with all parameters | [
"backing",
"bootstrap",
"method",
"with",
"all",
"parameters"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/vmplugin/v7/IndyInterface.java#L188-L197 | train |
groovy/groovy-core | subprojects/groovy-swing/src/main/groovy/groovy/swing/impl/TableLayout.java | TableLayout.addCell | public void addCell(TableLayoutCell cell) {
GridBagConstraints constraints = cell.getConstraints();
constraints.insets = new Insets(cellpadding, cellpadding, cellpadding, cellpadding);
add(cell.getComponent(), constraints);
} | java | public void addCell(TableLayoutCell cell) {
GridBagConstraints constraints = cell.getConstraints();
constraints.insets = new Insets(cellpadding, cellpadding, cellpadding, cellpadding);
add(cell.getComponent(), constraints);
} | [
"public",
"void",
"addCell",
"(",
"TableLayoutCell",
"cell",
")",
"{",
"GridBagConstraints",
"constraints",
"=",
"cell",
".",
"getConstraints",
"(",
")",
";",
"constraints",
".",
"insets",
"=",
"new",
"Insets",
"(",
"cellpadding",
",",
"cellpadding",
",",
"cel... | Adds a new cell to the current grid
@param cell the td component | [
"Adds",
"a",
"new",
"cell",
"to",
"the",
"current",
"grid"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-swing/src/main/groovy/groovy/swing/impl/TableLayout.java#L54-L58 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/ast/CompileUnit.java | CompileUnit.addClass | public void addClass(ClassNode node) {
node = node.redirect();
String name = node.getName();
ClassNode stored = classes.get(name);
if (stored != null && stored != node) {
// we have a duplicate class!
// One possibility for this is, that we declared a script and a... | java | public void addClass(ClassNode node) {
node = node.redirect();
String name = node.getName();
ClassNode stored = classes.get(name);
if (stored != null && stored != node) {
// we have a duplicate class!
// One possibility for this is, that we declared a script and a... | [
"public",
"void",
"addClass",
"(",
"ClassNode",
"node",
")",
"{",
"node",
"=",
"node",
".",
"redirect",
"(",
")",
";",
"String",
"name",
"=",
"node",
".",
"getName",
"(",
")",
";",
"ClassNode",
"stored",
"=",
"classes",
".",
"get",
"(",
"name",
")",
... | Adds a class to the unit. | [
"Adds",
"a",
"class",
"to",
"the",
"unit",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/ast/CompileUnit.java#L127-L159 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/tools/LoaderConfiguration.java | LoaderConfiguration.getSlashyPath | private String getSlashyPath(final String path) {
String changedPath = path;
if (File.separatorChar != '/')
changedPath = changedPath.replace(File.separatorChar, '/');
return changedPath;
} | java | private String getSlashyPath(final String path) {
String changedPath = path;
if (File.separatorChar != '/')
changedPath = changedPath.replace(File.separatorChar, '/');
return changedPath;
} | [
"private",
"String",
"getSlashyPath",
"(",
"final",
"String",
"path",
")",
"{",
"String",
"changedPath",
"=",
"path",
";",
"if",
"(",
"File",
".",
"separatorChar",
"!=",
"'",
"'",
")",
"changedPath",
"=",
"changedPath",
".",
"replace",
"(",
"File",
".",
... | This solution is based on an absolute path | [
"This",
"solution",
"is",
"based",
"on",
"an",
"absolute",
"path"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/tools/LoaderConfiguration.java#L259-L265 | train |
groovy/groovy-core | subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java | NioGroovyMethods.write | public static void write(Path self, String text, String charset) throws IOException {
Writer writer = null;
try {
writer = new OutputStreamWriter(Files.newOutputStream(self, CREATE, APPEND), Charset.forName(charset));
writer.write(text);
writer.flush();
W... | java | public static void write(Path self, String text, String charset) throws IOException {
Writer writer = null;
try {
writer = new OutputStreamWriter(Files.newOutputStream(self, CREATE, APPEND), Charset.forName(charset));
writer.write(text);
writer.flush();
W... | [
"public",
"static",
"void",
"write",
"(",
"Path",
"self",
",",
"String",
"text",
",",
"String",
"charset",
")",
"throws",
"IOException",
"{",
"Writer",
"writer",
"=",
"null",
";",
"try",
"{",
"writer",
"=",
"new",
"OutputStreamWriter",
"(",
"Files",
".",
... | Write the text to the Path, using the specified encoding.
@param self a Path
@param text the text to write to the Path
@param charset the charset used
@throws java.io.IOException if an IOException occurs.
@since 2.3.0 | [
"Write",
"the",
"text",
"to",
"the",
"Path",
"using",
"the",
"specified",
"encoding",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java#L558-L571 | train |
groovy/groovy-core | subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java | NioGroovyMethods.append | public static void append(Path self, Object text) throws IOException {
Writer writer = null;
try {
writer = new OutputStreamWriter(Files.newOutputStream(self, CREATE, APPEND), Charset.defaultCharset());
InvokerHelper.write(writer, text);
writer.flush();
W... | java | public static void append(Path self, Object text) throws IOException {
Writer writer = null;
try {
writer = new OutputStreamWriter(Files.newOutputStream(self, CREATE, APPEND), Charset.defaultCharset());
InvokerHelper.write(writer, text);
writer.flush();
W... | [
"public",
"static",
"void",
"append",
"(",
"Path",
"self",
",",
"Object",
"text",
")",
"throws",
"IOException",
"{",
"Writer",
"writer",
"=",
"null",
";",
"try",
"{",
"writer",
"=",
"new",
"OutputStreamWriter",
"(",
"Files",
".",
"newOutputStream",
"(",
"s... | Append the text at the end of the Path.
@param self a Path
@param text the text to append at the end of the Path
@throws java.io.IOException if an IOException occurs.
@since 2.3.0 | [
"Append",
"the",
"text",
"at",
"the",
"end",
"of",
"the",
"Path",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java#L581-L594 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.count | public static int count(CharSequence self, CharSequence text) {
int answer = 0;
for (int idx = 0; true; idx++) {
idx = self.toString().indexOf(text.toString(), idx);
// break once idx goes to -1 or for case of empty string once
// we get to the end to avoid JDK librar... | java | public static int count(CharSequence self, CharSequence text) {
int answer = 0;
for (int idx = 0; true; idx++) {
idx = self.toString().indexOf(text.toString(), idx);
// break once idx goes to -1 or for case of empty string once
// we get to the end to avoid JDK librar... | [
"public",
"static",
"int",
"count",
"(",
"CharSequence",
"self",
",",
"CharSequence",
"text",
")",
"{",
"int",
"answer",
"=",
"0",
";",
"for",
"(",
"int",
"idx",
"=",
"0",
";",
"true",
";",
"idx",
"++",
")",
"{",
"idx",
"=",
"self",
".",
"toString"... | Count the number of occurrences of a sub CharSequence.
@param self a CharSequence
@param text a sub CharSequence
@return the number of occurrences of the given CharSequence inside this CharSequence
@see #count(String, String)
@since 1.8.2 | [
"Count",
"the",
"number",
"of",
"occurrences",
"of",
"a",
"sub",
"CharSequence",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L387-L397 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.eachMatch | public static <T extends CharSequence> T eachMatch(T self, CharSequence regex, @ClosureParams(value=FromString.class, options={"List<String>","String[]"}) Closure closure) {
eachMatch(self.toString(), regex.toString(), closure);
return self;
} | java | public static <T extends CharSequence> T eachMatch(T self, CharSequence regex, @ClosureParams(value=FromString.class, options={"List<String>","String[]"}) Closure closure) {
eachMatch(self.toString(), regex.toString(), closure);
return self;
} | [
"public",
"static",
"<",
"T",
"extends",
"CharSequence",
">",
"T",
"eachMatch",
"(",
"T",
"self",
",",
"CharSequence",
"regex",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"FromString",
".",
"class",
",",
"options",
"=",
"{",
"\"List<String>\"",
",",
"\"... | Process each regex group matched substring of the given CharSequence. If the closure
parameter takes one argument, an array with all match groups is passed to it.
If the closure takes as many arguments as there are match groups, then each
parameter will be one match group.
@param self the source CharSequence
@param... | [
"Process",
"each",
"regex",
"group",
"matched",
"substring",
"of",
"the",
"given",
"CharSequence",
".",
"If",
"the",
"closure",
"parameter",
"takes",
"one",
"argument",
"an",
"array",
"with",
"all",
"match",
"groups",
"is",
"passed",
"to",
"it",
".",
"If",
... | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L692-L695 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.eachMatch | public static String eachMatch(String self, String regex, @ClosureParams(value=FromString.class, options={"List<String>","String[]"}) Closure closure) {
return eachMatch(self, Pattern.compile(regex), closure);
} | java | public static String eachMatch(String self, String regex, @ClosureParams(value=FromString.class, options={"List<String>","String[]"}) Closure closure) {
return eachMatch(self, Pattern.compile(regex), closure);
} | [
"public",
"static",
"String",
"eachMatch",
"(",
"String",
"self",
",",
"String",
"regex",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"FromString",
".",
"class",
",",
"options",
"=",
"{",
"\"List<String>\"",
",",
"\"String[]\"",
"}",
")",
"Closure",
"closu... | Process each regex group matched substring of the given string. If the closure
parameter takes one argument, an array with all match groups is passed to it.
If the closure takes as many arguments as there are match groups, then each
parameter will be one match group.
@param self the source string
@param regex a R... | [
"Process",
"each",
"regex",
"group",
"matched",
"substring",
"of",
"the",
"given",
"string",
".",
"If",
"the",
"closure",
"parameter",
"takes",
"one",
"argument",
"an",
"array",
"with",
"all",
"match",
"groups",
"is",
"passed",
"to",
"it",
".",
"If",
"the"... | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L745-L747 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.expandLine | public static String expandLine(CharSequence self, int tabStop) {
String s = self.toString();
int index;
while ((index = s.indexOf('\t')) != -1) {
StringBuilder builder = new StringBuilder(s);
int count = tabStop - index % tabStop;
builder.deleteCharAt(index);... | java | public static String expandLine(CharSequence self, int tabStop) {
String s = self.toString();
int index;
while ((index = s.indexOf('\t')) != -1) {
StringBuilder builder = new StringBuilder(s);
int count = tabStop - index % tabStop;
builder.deleteCharAt(index);... | [
"public",
"static",
"String",
"expandLine",
"(",
"CharSequence",
"self",
",",
"int",
"tabStop",
")",
"{",
"String",
"s",
"=",
"self",
".",
"toString",
"(",
")",
";",
"int",
"index",
";",
"while",
"(",
"(",
"index",
"=",
"s",
".",
"indexOf",
"(",
"'",... | Expands all tabs into spaces. Assumes the CharSequence represents a single line of text.
@param self A line to expand
@param tabStop The number of spaces a tab represents
@return The expanded toString() of this CharSequence
@see #expandLine(String, int)
@since 1.8.2 | [
"Expands",
"all",
"tabs",
"into",
"spaces",
".",
"Assumes",
"the",
"CharSequence",
"represents",
"a",
"single",
"line",
"of",
"text",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L819-L830 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.find | public static String find(CharSequence self, CharSequence regex, @ClosureParams(value=SimpleType.class, options="java.lang.String[]") Closure closure) {
return find(self.toString(), Pattern.compile(regex.toString()), closure);
} | java | public static String find(CharSequence self, CharSequence regex, @ClosureParams(value=SimpleType.class, options="java.lang.String[]") Closure closure) {
return find(self.toString(), Pattern.compile(regex.toString()), closure);
} | [
"public",
"static",
"String",
"find",
"(",
"CharSequence",
"self",
",",
"CharSequence",
"regex",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"SimpleType",
".",
"class",
",",
"options",
"=",
"\"java.lang.String[]\"",
")",
"Closure",
"closure",
")",
"{",
"retu... | Returns the result of calling a closure with the first occurrence of a regular expression found within a CharSequence.
If the regex doesn't match, the closure will not be called and find will return null.
@param self a CharSequence
@param regex the capturing regex CharSequence
@param closure the closure that will... | [
"Returns",
"the",
"result",
"of",
"calling",
"a",
"closure",
"with",
"the",
"first",
"occurrence",
"of",
"a",
"regular",
"expression",
"found",
"within",
"a",
"CharSequence",
".",
"If",
"the",
"regex",
"doesn",
"t",
"match",
"the",
"closure",
"will",
"not",
... | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L881-L883 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.getAt | public static String getAt(CharSequence self, Collection indices) {
StringBuilder answer = new StringBuilder();
for (Object value : indices) {
if (value instanceof Range) {
answer.append(getAt(self, (Range) value));
} else if (value instanceof Collection) {
... | java | public static String getAt(CharSequence self, Collection indices) {
StringBuilder answer = new StringBuilder();
for (Object value : indices) {
if (value instanceof Range) {
answer.append(getAt(self, (Range) value));
} else if (value instanceof Collection) {
... | [
"public",
"static",
"String",
"getAt",
"(",
"CharSequence",
"self",
",",
"Collection",
"indices",
")",
"{",
"StringBuilder",
"answer",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"Object",
"value",
":",
"indices",
")",
"{",
"if",
"(",
"value",
... | Select a List of characters from a CharSequence using a Collection
to identify the indices to be selected.
@param self a CharSequence
@param indices a Collection of indices
@return a String consisting of the characters at the given indices
@since 1.0 | [
"Select",
"a",
"List",
"of",
"characters",
"from",
"a",
"CharSequence",
"using",
"a",
"Collection",
"to",
"identify",
"the",
"indices",
"to",
"be",
"selected",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1205-L1218 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.getAt | public static CharSequence getAt(CharSequence text, int index) {
index = normaliseIndex(index, text.length());
return text.subSequence(index, index + 1);
} | java | public static CharSequence getAt(CharSequence text, int index) {
index = normaliseIndex(index, text.length());
return text.subSequence(index, index + 1);
} | [
"public",
"static",
"CharSequence",
"getAt",
"(",
"CharSequence",
"text",
",",
"int",
"index",
")",
"{",
"index",
"=",
"normaliseIndex",
"(",
"index",
",",
"text",
".",
"length",
"(",
")",
")",
";",
"return",
"text",
".",
"subSequence",
"(",
"index",
","... | Support the subscript operator for CharSequence.
@param text a CharSequence
@param index the index of the Character to get
@return the Character at the given index
@since 1.0 | [
"Support",
"the",
"subscript",
"operator",
"for",
"CharSequence",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1240-L1243 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.getAt | public static String getAt(GString text, int index) {
return (String) getAt(text.toString(), index);
} | java | public static String getAt(GString text, int index) {
return (String) getAt(text.toString(), index);
} | [
"public",
"static",
"String",
"getAt",
"(",
"GString",
"text",
",",
"int",
"index",
")",
"{",
"return",
"(",
"String",
")",
"getAt",
"(",
"text",
".",
"toString",
"(",
")",
",",
"index",
")",
";",
"}"
] | Support the subscript operator for GString.
@param text a GString
@param index the index of the Character to get
@return the Character at the given index
@since 2.3.7 | [
"Support",
"the",
"subscript",
"operator",
"for",
"GString",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1253-L1255 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.getAt | public static CharSequence getAt(CharSequence text, IntRange range) {
return getAt(text, (Range) range);
} | java | public static CharSequence getAt(CharSequence text, IntRange range) {
return getAt(text, (Range) range);
} | [
"public",
"static",
"CharSequence",
"getAt",
"(",
"CharSequence",
"text",
",",
"IntRange",
"range",
")",
"{",
"return",
"getAt",
"(",
"text",
",",
"(",
"Range",
")",
"range",
")",
";",
"}"
] | Support the range subscript operator for CharSequence with IntRange
@param text a CharSequence
@param range an IntRange
@return the subsequence CharSequence
@since 1.0 | [
"Support",
"the",
"range",
"subscript",
"operator",
"for",
"CharSequence",
"with",
"IntRange"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1265-L1267 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.getAt | public static CharSequence getAt(CharSequence text, Range range) {
RangeInfo info = subListBorders(text.length(), range);
CharSequence sequence = text.subSequence(info.from, info.to);
return info.reverse ? reverse(sequence) : sequence;
} | java | public static CharSequence getAt(CharSequence text, Range range) {
RangeInfo info = subListBorders(text.length(), range);
CharSequence sequence = text.subSequence(info.from, info.to);
return info.reverse ? reverse(sequence) : sequence;
} | [
"public",
"static",
"CharSequence",
"getAt",
"(",
"CharSequence",
"text",
",",
"Range",
"range",
")",
"{",
"RangeInfo",
"info",
"=",
"subListBorders",
"(",
"text",
".",
"length",
"(",
")",
",",
"range",
")",
";",
"CharSequence",
"sequence",
"=",
"text",
".... | Support the range subscript operator for CharSequence
@param text a CharSequence
@param range a Range
@return the subsequence CharSequence
@since 1.0 | [
"Support",
"the",
"range",
"subscript",
"operator",
"for",
"CharSequence"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1289-L1293 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.getAt | public static String getAt(GString text, Range range) {
return getAt(text.toString(), range);
} | java | public static String getAt(GString text, Range range) {
return getAt(text.toString(), range);
} | [
"public",
"static",
"String",
"getAt",
"(",
"GString",
"text",
",",
"Range",
"range",
")",
"{",
"return",
"getAt",
"(",
"text",
".",
"toString",
"(",
")",
",",
"range",
")",
";",
"}"
] | Support the range subscript operator for GString
@param text a GString
@param range a Range
@return the String of characters corresponding to the provided range
@since 2.3.7 | [
"Support",
"the",
"range",
"subscript",
"operator",
"for",
"GString"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1303-L1305 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.getAt | public static List getAt(Matcher self, Collection indices) {
List result = new ArrayList();
for (Object value : indices) {
if (value instanceof Range) {
result.addAll(getAt(self, (Range) value));
} else {
int idx = DefaultTypeTransformation.intUnbo... | java | public static List getAt(Matcher self, Collection indices) {
List result = new ArrayList();
for (Object value : indices) {
if (value instanceof Range) {
result.addAll(getAt(self, (Range) value));
} else {
int idx = DefaultTypeTransformation.intUnbo... | [
"public",
"static",
"List",
"getAt",
"(",
"Matcher",
"self",
",",
"Collection",
"indices",
")",
"{",
"List",
"result",
"=",
"new",
"ArrayList",
"(",
")",
";",
"for",
"(",
"Object",
"value",
":",
"indices",
")",
"{",
"if",
"(",
"value",
"instanceof",
"R... | Select a List of values from a Matcher using a Collection
to identify the indices to be selected.
@param self a Matcher
@param indices a Collection of indices
@return a String of the values at the given indices
@since 1.6.0 | [
"Select",
"a",
"List",
"of",
"values",
"from",
"a",
"Matcher",
"using",
"a",
"Collection",
"to",
"identify",
"the",
"indices",
"to",
"be",
"selected",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1316-L1327 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.getAt | public static String getAt(String text, int index) {
index = normaliseIndex(index, text.length());
return text.substring(index, index + 1);
} | java | public static String getAt(String text, int index) {
index = normaliseIndex(index, text.length());
return text.substring(index, index + 1);
} | [
"public",
"static",
"String",
"getAt",
"(",
"String",
"text",
",",
"int",
"index",
")",
"{",
"index",
"=",
"normaliseIndex",
"(",
"index",
",",
"text",
".",
"length",
"(",
")",
")",
";",
"return",
"text",
".",
"substring",
"(",
"index",
",",
"index",
... | Support the subscript operator for String.
@param text a String
@param index the index of the Character to get
@return the Character at the given index
@since 1.0 | [
"Support",
"the",
"subscript",
"operator",
"for",
"String",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1449-L1452 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.getAt | public static String getAt(String text, IntRange range) {
return getAt(text, (Range) range);
} | java | public static String getAt(String text, IntRange range) {
return getAt(text, (Range) range);
} | [
"public",
"static",
"String",
"getAt",
"(",
"String",
"text",
",",
"IntRange",
"range",
")",
"{",
"return",
"getAt",
"(",
"text",
",",
"(",
"Range",
")",
"range",
")",
";",
"}"
] | Support the range subscript operator for String with IntRange
@param text a String
@param range an IntRange
@return the resulting String
@since 1.0 | [
"Support",
"the",
"range",
"subscript",
"operator",
"for",
"String",
"with",
"IntRange"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1462-L1464 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.getAt | public static String getAt(String text, Range range) {
RangeInfo info = subListBorders(text.length(), range);
String answer = text.substring(info.from, info.to);
if (info.reverse) {
answer = reverse(answer);
}
return answer;
} | java | public static String getAt(String text, Range range) {
RangeInfo info = subListBorders(text.length(), range);
String answer = text.substring(info.from, info.to);
if (info.reverse) {
answer = reverse(answer);
}
return answer;
} | [
"public",
"static",
"String",
"getAt",
"(",
"String",
"text",
",",
"Range",
"range",
")",
"{",
"RangeInfo",
"info",
"=",
"subListBorders",
"(",
"text",
".",
"length",
"(",
")",
",",
"range",
")",
";",
"String",
"answer",
"=",
"text",
".",
"substring",
... | Support the range subscript operator for String
@param text a String
@param range a Range
@return a substring corresponding to the Range
@since 1.0 | [
"Support",
"the",
"range",
"subscript",
"operator",
"for",
"String"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1474-L1481 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.getCount | public static int getCount(Matcher matcher) {
int counter = 0;
matcher.reset();
while (matcher.find()) {
counter++;
}
return counter;
} | java | public static int getCount(Matcher matcher) {
int counter = 0;
matcher.reset();
while (matcher.find()) {
counter++;
}
return counter;
} | [
"public",
"static",
"int",
"getCount",
"(",
"Matcher",
"matcher",
")",
"{",
"int",
"counter",
"=",
"0",
";",
"matcher",
".",
"reset",
"(",
")",
";",
"while",
"(",
"matcher",
".",
"find",
"(",
")",
")",
"{",
"counter",
"++",
";",
"}",
"return",
"cou... | Find the number of Strings matched to the given Matcher.
@param matcher a Matcher
@return int the number of Strings matched to the given matcher.
@since 1.0 | [
"Find",
"the",
"number",
"of",
"Strings",
"matched",
"to",
"the",
"given",
"Matcher",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1511-L1518 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.isAllWhitespace | public static boolean isAllWhitespace(CharSequence self) {
String s = self.toString();
for (int i = 0; i < s.length(); i++) {
if (!Character.isWhitespace(s.charAt(i)))
return false;
}
return true;
} | java | public static boolean isAllWhitespace(CharSequence self) {
String s = self.toString();
for (int i = 0; i < s.length(); i++) {
if (!Character.isWhitespace(s.charAt(i)))
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"isAllWhitespace",
"(",
"CharSequence",
"self",
")",
"{",
"String",
"s",
"=",
"self",
".",
"toString",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"s",
".",
"length",
"(",
")",
";",
"i",
"++",
")... | True if a CharSequence only contains whitespace characters.
@param self The CharSequence to check the characters in
@return true If all characters are whitespace characters
@see #isAllWhitespace(String)
@since 1.8.2 | [
"True",
"if",
"a",
"CharSequence",
"only",
"contains",
"whitespace",
"characters",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1578-L1585 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.isBigDecimal | public static boolean isBigDecimal(CharSequence self) {
try {
new BigDecimal(self.toString().trim());
return true;
} catch (NumberFormatException nfe) {
return false;
}
} | java | public static boolean isBigDecimal(CharSequence self) {
try {
new BigDecimal(self.toString().trim());
return true;
} catch (NumberFormatException nfe) {
return false;
}
} | [
"public",
"static",
"boolean",
"isBigDecimal",
"(",
"CharSequence",
"self",
")",
"{",
"try",
"{",
"new",
"BigDecimal",
"(",
"self",
".",
"toString",
"(",
")",
".",
"trim",
"(",
")",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"NumberFormatExcepti... | Determine if a CharSequence can be parsed as a BigDecimal.
@param self a CharSequence
@return true if the CharSequence can be parsed
@see #isBigDecimal(String)
@since 1.8.2 | [
"Determine",
"if",
"a",
"CharSequence",
"can",
"be",
"parsed",
"as",
"a",
"BigDecimal",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1604-L1611 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.isBigInteger | public static boolean isBigInteger(CharSequence self) {
try {
new BigInteger(self.toString().trim());
return true;
} catch (NumberFormatException nfe) {
return false;
}
} | java | public static boolean isBigInteger(CharSequence self) {
try {
new BigInteger(self.toString().trim());
return true;
} catch (NumberFormatException nfe) {
return false;
}
} | [
"public",
"static",
"boolean",
"isBigInteger",
"(",
"CharSequence",
"self",
")",
"{",
"try",
"{",
"new",
"BigInteger",
"(",
"self",
".",
"toString",
"(",
")",
".",
"trim",
"(",
")",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"NumberFormatExcepti... | Determine if a CharSequence can be parsed as a BigInteger.
@param self a CharSequence
@return true if the CharSequence can be parsed
@see #isBigInteger(String)
@since 1.8.2 | [
"Determine",
"if",
"a",
"CharSequence",
"can",
"be",
"parsed",
"as",
"a",
"BigInteger",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1630-L1637 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.isDouble | public static boolean isDouble(CharSequence self) {
try {
Double.valueOf(self.toString().trim());
return true;
} catch (NumberFormatException nfe) {
return false;
}
} | java | public static boolean isDouble(CharSequence self) {
try {
Double.valueOf(self.toString().trim());
return true;
} catch (NumberFormatException nfe) {
return false;
}
} | [
"public",
"static",
"boolean",
"isDouble",
"(",
"CharSequence",
"self",
")",
"{",
"try",
"{",
"Double",
".",
"valueOf",
"(",
"self",
".",
"toString",
"(",
")",
".",
"trim",
"(",
")",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"NumberFormatExce... | Determine if a CharSequence can be parsed as a Double.
@param self a CharSequence
@return true if the CharSequence can be parsed
@see #isDouble(String)
@since 1.8.2 | [
"Determine",
"if",
"a",
"CharSequence",
"can",
"be",
"parsed",
"as",
"a",
"Double",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1730-L1737 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.isFloat | public static boolean isFloat(CharSequence self) {
try {
Float.valueOf(self.toString().trim());
return true;
} catch (NumberFormatException nfe) {
return false;
}
} | java | public static boolean isFloat(CharSequence self) {
try {
Float.valueOf(self.toString().trim());
return true;
} catch (NumberFormatException nfe) {
return false;
}
} | [
"public",
"static",
"boolean",
"isFloat",
"(",
"CharSequence",
"self",
")",
"{",
"try",
"{",
"Float",
".",
"valueOf",
"(",
"self",
".",
"toString",
"(",
")",
".",
"trim",
"(",
")",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"NumberFormatExcept... | Determine if a CharSequence can be parsed as a Float.
@param self a CharSequence
@return true if the CharSequence can be parsed
@see #isFloat(String)
@since 1.8.2 | [
"Determine",
"if",
"a",
"CharSequence",
"can",
"be",
"parsed",
"as",
"a",
"Float",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1756-L1763 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.isInteger | public static boolean isInteger(CharSequence self) {
try {
Integer.valueOf(self.toString().trim());
return true;
} catch (NumberFormatException nfe) {
return false;
}
} | java | public static boolean isInteger(CharSequence self) {
try {
Integer.valueOf(self.toString().trim());
return true;
} catch (NumberFormatException nfe) {
return false;
}
} | [
"public",
"static",
"boolean",
"isInteger",
"(",
"CharSequence",
"self",
")",
"{",
"try",
"{",
"Integer",
".",
"valueOf",
"(",
"self",
".",
"toString",
"(",
")",
".",
"trim",
"(",
")",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"NumberFormatEx... | Determine if a CharSequence can be parsed as an Integer.
@param self a CharSequence
@return true if the CharSequence can be parsed
@see #isInteger(String)
@since 1.8.2 | [
"Determine",
"if",
"a",
"CharSequence",
"can",
"be",
"parsed",
"as",
"an",
"Integer",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1782-L1789 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.isLong | public static boolean isLong(CharSequence self) {
try {
Long.valueOf(self.toString().trim());
return true;
} catch (NumberFormatException nfe) {
return false;
}
} | java | public static boolean isLong(CharSequence self) {
try {
Long.valueOf(self.toString().trim());
return true;
} catch (NumberFormatException nfe) {
return false;
}
} | [
"public",
"static",
"boolean",
"isLong",
"(",
"CharSequence",
"self",
")",
"{",
"try",
"{",
"Long",
".",
"valueOf",
"(",
"self",
".",
"toString",
"(",
")",
".",
"trim",
"(",
")",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"NumberFormatExceptio... | Determine if a CharSequence can be parsed as a Long.
@param self a CharSequence
@return true if the CharSequence can be parsed
@see #isLong(String)
@since 1.8.2 | [
"Determine",
"if",
"a",
"CharSequence",
"can",
"be",
"parsed",
"as",
"a",
"Long",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1808-L1815 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.leftShift | public static StringBuffer leftShift(String self, Object value) {
return new StringBuffer(self).append(value);
} | java | public static StringBuffer leftShift(String self, Object value) {
return new StringBuffer(self).append(value);
} | [
"public",
"static",
"StringBuffer",
"leftShift",
"(",
"String",
"self",
",",
"Object",
"value",
")",
"{",
"return",
"new",
"StringBuffer",
"(",
"self",
")",
".",
"append",
"(",
"value",
")",
";",
"}"
] | Overloads the left shift operator to provide an easy way to append multiple
objects as string representations to a String.
@param self a String
@param value an Object
@return a StringBuffer built from this string
@since 1.0 | [
"Overloads",
"the",
"left",
"shift",
"operator",
"to",
"provide",
"an",
"easy",
"way",
"to",
"append",
"multiple",
"objects",
"as",
"string",
"representations",
"to",
"a",
"String",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1926-L1928 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.leftShift | public static StringBuilder leftShift(StringBuilder self, Object value) {
self.append(value);
return self;
} | java | public static StringBuilder leftShift(StringBuilder self, Object value) {
self.append(value);
return self;
} | [
"public",
"static",
"StringBuilder",
"leftShift",
"(",
"StringBuilder",
"self",
",",
"Object",
"value",
")",
"{",
"self",
".",
"append",
"(",
"value",
")",
";",
"return",
"self",
";",
"}"
] | Overloads the left shift operator to provide syntactic sugar for appending to a StringBuilder.
@param self a StringBuilder
@param value an Object
@return the original StringBuilder
@since 1.8.2 | [
"Overloads",
"the",
"left",
"shift",
"operator",
"to",
"provide",
"syntactic",
"sugar",
"for",
"appending",
"to",
"a",
"StringBuilder",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1952-L1955 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.minus | public static String minus(CharSequence self, Object target) {
String s = self.toString();
String text = DefaultGroovyMethods.toString(target);
int index = s.indexOf(text);
if (index == -1) return s;
int end = index + text.length();
if (s.length() > end) {
ret... | java | public static String minus(CharSequence self, Object target) {
String s = self.toString();
String text = DefaultGroovyMethods.toString(target);
int index = s.indexOf(text);
if (index == -1) return s;
int end = index + text.length();
if (s.length() > end) {
ret... | [
"public",
"static",
"String",
"minus",
"(",
"CharSequence",
"self",
",",
"Object",
"target",
")",
"{",
"String",
"s",
"=",
"self",
".",
"toString",
"(",
")",
";",
"String",
"text",
"=",
"DefaultGroovyMethods",
".",
"toString",
"(",
"target",
")",
";",
"i... | Remove a part of a CharSequence by replacing the first occurrence
of target within self with '' and returns the result.
@param self a CharSequence
@param target an object representing the part to remove
@return a String containing the original minus the part to be removed
@see #minus(String, Object)
@since 1.8.2 | [
"Remove",
"a",
"part",
"of",
"a",
"CharSequence",
"by",
"replacing",
"the",
"first",
"occurrence",
"of",
"target",
"within",
"self",
"with",
"and",
"returns",
"the",
"result",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1990-L2000 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.minus | public static String minus(CharSequence self, Pattern pattern) {
return pattern.matcher(self).replaceFirst("");
} | java | public static String minus(CharSequence self, Pattern pattern) {
return pattern.matcher(self).replaceFirst("");
} | [
"public",
"static",
"String",
"minus",
"(",
"CharSequence",
"self",
",",
"Pattern",
"pattern",
")",
"{",
"return",
"pattern",
".",
"matcher",
"(",
"self",
")",
".",
"replaceFirst",
"(",
"\"\"",
")",
";",
"}"
] | Remove a part of a CharSequence. This replaces the first occurrence
of the pattern within self with '' and returns the result.
@param self a String
@param pattern a Pattern representing the part to remove
@return a String minus the part to be removed
@since 2.2.0 | [
"Remove",
"a",
"part",
"of",
"a",
"CharSequence",
".",
"This",
"replaces",
"the",
"first",
"occurrence",
"of",
"the",
"pattern",
"within",
"self",
"with",
"and",
"returns",
"the",
"result",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L2011-L2013 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.multiply | public static String multiply(CharSequence self, Number factor) {
String s = self.toString();
int size = factor.intValue();
if (size == 0)
return "";
else if (size < 0) {
throw new IllegalArgumentException("multiply() should be called with a number of 0 or greater... | java | public static String multiply(CharSequence self, Number factor) {
String s = self.toString();
int size = factor.intValue();
if (size == 0)
return "";
else if (size < 0) {
throw new IllegalArgumentException("multiply() should be called with a number of 0 or greater... | [
"public",
"static",
"String",
"multiply",
"(",
"CharSequence",
"self",
",",
"Number",
"factor",
")",
"{",
"String",
"s",
"=",
"self",
".",
"toString",
"(",
")",
";",
"int",
"size",
"=",
"factor",
".",
"intValue",
"(",
")",
";",
"if",
"(",
"size",
"==... | Repeat a CharSequence a certain number of times.
@param self a CharSequence to be repeated
@param factor the number of times the CharSequence should be repeated
@return a String composed of a repetition
@throws IllegalArgumentException if the number of repetitions is < 0
@since 1.8.2 | [
"Repeat",
"a",
"CharSequence",
"a",
"certain",
"number",
"of",
"times",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L2042-L2055 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.next | public static String next(CharSequence self) {
StringBuilder buffer = new StringBuilder(self);
if (buffer.length() == 0) {
buffer.append(Character.MIN_VALUE);
} else {
char last = buffer.charAt(buffer.length() - 1);
if (last == Character.MAX_VALUE) {
... | java | public static String next(CharSequence self) {
StringBuilder buffer = new StringBuilder(self);
if (buffer.length() == 0) {
buffer.append(Character.MIN_VALUE);
} else {
char last = buffer.charAt(buffer.length() - 1);
if (last == Character.MAX_VALUE) {
... | [
"public",
"static",
"String",
"next",
"(",
"CharSequence",
"self",
")",
"{",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
"self",
")",
";",
"if",
"(",
"buffer",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"buffer",
".",
"append",
"(",... | This method is called by the ++ operator for the class CharSequence.
It increments the last character in the given CharSequence. If the last
character in the CharSequence is Character.MAX_VALUE a Character.MIN_VALUE
will be appended. The empty CharSequence is incremented to a string
consisting of the character Characte... | [
"This",
"method",
"is",
"called",
"by",
"the",
"++",
"operator",
"for",
"the",
"class",
"CharSequence",
".",
"It",
"increments",
"the",
"last",
"character",
"in",
"the",
"given",
"CharSequence",
".",
"If",
"the",
"last",
"character",
"in",
"the",
"CharSequen... | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L2077-L2092 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.normalize | public static String normalize(final CharSequence self) {
final String s = self.toString();
int nx = s.indexOf('\r');
if (nx < 0) {
return s;
}
final int len = s.length();
final StringBuilder sb = new StringBuilder(len);
int i = 0;
do {
... | java | public static String normalize(final CharSequence self) {
final String s = self.toString();
int nx = s.indexOf('\r');
if (nx < 0) {
return s;
}
final int len = s.length();
final StringBuilder sb = new StringBuilder(len);
int i = 0;
do {
... | [
"public",
"static",
"String",
"normalize",
"(",
"final",
"CharSequence",
"self",
")",
"{",
"final",
"String",
"s",
"=",
"self",
".",
"toString",
"(",
")",
";",
"int",
"nx",
"=",
"s",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"nx",
"<",
... | Return a String with linefeeds and carriage returns normalized to linefeeds.
@param self a CharSequence object
@return the normalized toString() for the CharSequence
@see #normalize(String)
@since 1.8.2 | [
"Return",
"a",
"String",
"with",
"linefeeds",
"and",
"carriage",
"returns",
"normalized",
"to",
"linefeeds",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L2111-L2141 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.plus | public static String plus(CharSequence left, Object value) {
return left + DefaultGroovyMethods.toString(value);
} | java | public static String plus(CharSequence left, Object value) {
return left + DefaultGroovyMethods.toString(value);
} | [
"public",
"static",
"String",
"plus",
"(",
"CharSequence",
"left",
",",
"Object",
"value",
")",
"{",
"return",
"left",
"+",
"DefaultGroovyMethods",
".",
"toString",
"(",
"value",
")",
";",
"}"
] | Appends the String representation of the given operand to this CharSequence.
@param left a CharSequence
@param value any Object
@return the original toString() of the CharSequence with the object appended
@since 1.8.2 | [
"Appends",
"the",
"String",
"representation",
"of",
"the",
"given",
"operand",
"to",
"this",
"CharSequence",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L2325-L2327 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.plus | public static String plus(Number value, String right) {
return DefaultGroovyMethods.toString(value) + right;
} | java | public static String plus(Number value, String right) {
return DefaultGroovyMethods.toString(value) + right;
} | [
"public",
"static",
"String",
"plus",
"(",
"Number",
"value",
",",
"String",
"right",
")",
"{",
"return",
"DefaultGroovyMethods",
".",
"toString",
"(",
"value",
")",
"+",
"right",
";",
"}"
] | Appends a String to the string representation of this number.
@param value a Number
@param right a String
@return a String
@since 1.0 | [
"Appends",
"a",
"String",
"to",
"the",
"string",
"representation",
"of",
"this",
"number",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L2337-L2339 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.readLines | public static List<String> readLines(CharSequence self) throws IOException {
return IOGroovyMethods.readLines(new StringReader(self.toString()));
} | java | public static List<String> readLines(CharSequence self) throws IOException {
return IOGroovyMethods.readLines(new StringReader(self.toString()));
} | [
"public",
"static",
"List",
"<",
"String",
">",
"readLines",
"(",
"CharSequence",
"self",
")",
"throws",
"IOException",
"{",
"return",
"IOGroovyMethods",
".",
"readLines",
"(",
"new",
"StringReader",
"(",
"self",
".",
"toString",
"(",
")",
")",
")",
";",
"... | Return the lines of a CharSequence as a List of String.
@param self a CharSequence object
@return a list of lines
@throws java.io.IOException if an error occurs
@since 1.8.2 | [
"Return",
"the",
"lines",
"of",
"a",
"CharSequence",
"as",
"a",
"List",
"of",
"String",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L2443-L2445 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.replaceAll | public static String replaceAll(final CharSequence self, final CharSequence regex, final CharSequence replacement) {
return self.toString().replaceAll(regex.toString(), replacement.toString());
} | java | public static String replaceAll(final CharSequence self, final CharSequence regex, final CharSequence replacement) {
return self.toString().replaceAll(regex.toString(), replacement.toString());
} | [
"public",
"static",
"String",
"replaceAll",
"(",
"final",
"CharSequence",
"self",
",",
"final",
"CharSequence",
"regex",
",",
"final",
"CharSequence",
"replacement",
")",
"{",
"return",
"self",
".",
"toString",
"(",
")",
".",
"replaceAll",
"(",
"regex",
".",
... | Replaces each substring of this CharSequence that matches the given
regular expression with the given replacement.
@param self a CharSequence
@param regex the capturing regex
@param replacement the string to be substituted for each match
@return the toString() of the CharSequence with content replaced
@th... | [
"Replaces",
"each",
"substring",
"of",
"this",
"CharSequence",
"that",
"matches",
"the",
"given",
"regular",
"expression",
"with",
"the",
"given",
"replacement",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L2468-L2470 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.replaceFirst | public static String replaceFirst(final CharSequence self, final CharSequence regex, final CharSequence replacement) {
return self.toString().replaceFirst(regex.toString(), replacement.toString());
} | java | public static String replaceFirst(final CharSequence self, final CharSequence regex, final CharSequence replacement) {
return self.toString().replaceFirst(regex.toString(), replacement.toString());
} | [
"public",
"static",
"String",
"replaceFirst",
"(",
"final",
"CharSequence",
"self",
",",
"final",
"CharSequence",
"regex",
",",
"final",
"CharSequence",
"replacement",
")",
"{",
"return",
"self",
".",
"toString",
"(",
")",
".",
"replaceFirst",
"(",
"regex",
".... | Replaces the first substring of this CharSequence that matches the given
regular expression with the given replacement.
@param self a CharSequence
@param regex the capturing regex
@param replacement the CharSequence to be substituted for each match
@return a CharSequence with replaced content
@throws java... | [
"Replaces",
"the",
"first",
"substring",
"of",
"this",
"CharSequence",
"that",
"matches",
"the",
"given",
"regular",
"expression",
"with",
"the",
"given",
"replacement",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L2629-L2631 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.setIndex | public static void setIndex(Matcher matcher, int idx) {
int count = getCount(matcher);
if (idx < -count || idx >= count) {
throw new IndexOutOfBoundsException("index is out of range " + (-count) + ".." + (count - 1) + " (index = " + idx + ")");
}
if (idx == 0) {
m... | java | public static void setIndex(Matcher matcher, int idx) {
int count = getCount(matcher);
if (idx < -count || idx >= count) {
throw new IndexOutOfBoundsException("index is out of range " + (-count) + ".." + (count - 1) + " (index = " + idx + ")");
}
if (idx == 0) {
m... | [
"public",
"static",
"void",
"setIndex",
"(",
"Matcher",
"matcher",
",",
"int",
"idx",
")",
"{",
"int",
"count",
"=",
"getCount",
"(",
"matcher",
")",
";",
"if",
"(",
"idx",
"<",
"-",
"count",
"||",
"idx",
">=",
"count",
")",
"{",
"throw",
"new",
"I... | Set the position of the given Matcher to the given index.
@param matcher a Matcher
@param idx the index number
@since 1.0 | [
"Set",
"the",
"position",
"of",
"the",
"given",
"Matcher",
"to",
"the",
"given",
"index",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L2770-L2789 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.splitEachLine | public static <T> T splitEachLine(CharSequence self, CharSequence regex, @ClosureParams(value=FromString.class,options="List<String>") Closure<T> closure) throws IOException {
return splitEachLine(self, Pattern.compile(regex.toString()), closure);
} | java | public static <T> T splitEachLine(CharSequence self, CharSequence regex, @ClosureParams(value=FromString.class,options="List<String>") Closure<T> closure) throws IOException {
return splitEachLine(self, Pattern.compile(regex.toString()), closure);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"splitEachLine",
"(",
"CharSequence",
"self",
",",
"CharSequence",
"regex",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"FromString",
".",
"class",
",",
"options",
"=",
"\"List<String>\"",
")",
"Closure",
"<",
"T",
... | Iterates through the given CharSequence line by line, splitting each line using
the given regex delimiter. The list of tokens for each line is then passed to
the given closure.
@param self a CharSequence
@param regex the delimiting regular expression
@param closure a closure
@return the last value returned by th... | [
"Iterates",
"through",
"the",
"given",
"CharSequence",
"line",
"by",
"line",
"splitting",
"each",
"line",
"using",
"the",
"given",
"regex",
"delimiter",
".",
"The",
"list",
"of",
"tokens",
"for",
"each",
"line",
"is",
"then",
"passed",
"to",
"the",
"given",
... | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L2885-L2887 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.splitEachLine | public static <T> T splitEachLine(CharSequence self, Pattern pattern, @ClosureParams(value=FromString.class,options="List<String>") Closure<T> closure) throws IOException {
final List<String> list = readLines(self);
T result = null;
for (String line : list) {
List vals = Arrays.asLis... | java | public static <T> T splitEachLine(CharSequence self, Pattern pattern, @ClosureParams(value=FromString.class,options="List<String>") Closure<T> closure) throws IOException {
final List<String> list = readLines(self);
T result = null;
for (String line : list) {
List vals = Arrays.asLis... | [
"public",
"static",
"<",
"T",
">",
"T",
"splitEachLine",
"(",
"CharSequence",
"self",
",",
"Pattern",
"pattern",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"FromString",
".",
"class",
",",
"options",
"=",
"\"List<String>\"",
")",
"Closure",
"<",
"T",
">... | Iterates through the given CharSequence line by line, splitting each line using
the given separator Pattern. The list of tokens for each line is then passed to
the given closure.
@param self a CharSequence
@param pattern the regular expression Pattern for the delimiter
@param closure a closure
@return the last val... | [
"Iterates",
"through",
"the",
"given",
"CharSequence",
"line",
"by",
"line",
"splitting",
"each",
"line",
"using",
"the",
"given",
"separator",
"Pattern",
".",
"The",
"list",
"of",
"tokens",
"for",
"each",
"line",
"is",
"then",
"passed",
"to",
"the",
"given"... | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L2901-L2909 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.takeWhile | public static String takeWhile(GString self, @ClosureParams(value=SimpleType.class, options="char") Closure condition) {
return (String) takeWhile(self.toString(), condition);
} | java | public static String takeWhile(GString self, @ClosureParams(value=SimpleType.class, options="char") Closure condition) {
return (String) takeWhile(self.toString(), condition);
} | [
"public",
"static",
"String",
"takeWhile",
"(",
"GString",
"self",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"SimpleType",
".",
"class",
",",
"options",
"=",
"\"char\"",
")",
"Closure",
"condition",
")",
"{",
"return",
"(",
"String",
")",
"takeWhile",
... | A GString variant of the equivalent GString method.
@param self the original GString
@param condition the closure that must evaluate to true to continue taking elements
@return a prefix of elements in the GString where each
element passed to the given closure evaluates to true
@since 2.3.7 | [
"A",
"GString",
"variant",
"of",
"the",
"equivalent",
"GString",
"method",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L3206-L3208 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.toList | public static List<String> toList(CharSequence self) {
String s = self.toString();
int size = s.length();
List<String> answer = new ArrayList<String>(size);
for (int i = 0; i < size; i++) {
answer.add(s.substring(i, i + 1));
}
return answer;
} | java | public static List<String> toList(CharSequence self) {
String s = self.toString();
int size = s.length();
List<String> answer = new ArrayList<String>(size);
for (int i = 0; i < size; i++) {
answer.add(s.substring(i, i + 1));
}
return answer;
} | [
"public",
"static",
"List",
"<",
"String",
">",
"toList",
"(",
"CharSequence",
"self",
")",
"{",
"String",
"s",
"=",
"self",
".",
"toString",
"(",
")",
";",
"int",
"size",
"=",
"s",
".",
"length",
"(",
")",
";",
"List",
"<",
"String",
">",
"answer"... | Converts the given CharSequence into a List of Strings of one character.
@param self a CharSequence
@return a List of characters (a 1-character String)
@see #toSet(String)
@since 1.8.2 | [
"Converts",
"the",
"given",
"CharSequence",
"into",
"a",
"List",
"of",
"Strings",
"of",
"one",
"character",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L3425-L3433 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.unexpand | public static String unexpand(CharSequence self, int tabStop) {
String s = self.toString();
if (s.length() == 0) return s;
try {
StringBuilder builder = new StringBuilder();
for (String line : readLines((CharSequence) s)) {
builder.append(unexpandLine(line... | java | public static String unexpand(CharSequence self, int tabStop) {
String s = self.toString();
if (s.length() == 0) return s;
try {
StringBuilder builder = new StringBuilder();
for (String line : readLines((CharSequence) s)) {
builder.append(unexpandLine(line... | [
"public",
"static",
"String",
"unexpand",
"(",
"CharSequence",
"self",
",",
"int",
"tabStop",
")",
"{",
"String",
"s",
"=",
"self",
".",
"toString",
"(",
")",
";",
"if",
"(",
"s",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"s",
";",
"try",
... | Replaces sequences of whitespaces with tabs.
@param self A CharSequence to unexpand
@param tabStop The number of spaces a tab represents
@return an unexpanded String
@since 1.8.2 | [
"Replaces",
"sequences",
"of",
"whitespaces",
"with",
"tabs",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L3580-L3598 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.unexpandLine | public static String unexpandLine(CharSequence self, int tabStop) {
StringBuilder builder = new StringBuilder(self.toString());
int index = 0;
while (index + tabStop < builder.length()) {
// cut original string in tabstop-length pieces
String piece = builder.substring(ind... | java | public static String unexpandLine(CharSequence self, int tabStop) {
StringBuilder builder = new StringBuilder(self.toString());
int index = 0;
while (index + tabStop < builder.length()) {
// cut original string in tabstop-length pieces
String piece = builder.substring(ind... | [
"public",
"static",
"String",
"unexpandLine",
"(",
"CharSequence",
"self",
",",
"int",
"tabStop",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
"self",
".",
"toString",
"(",
")",
")",
";",
"int",
"index",
"=",
"0",
";",
"while",
... | Replaces sequences of whitespaces with tabs within a line.
@param self A line to unexpand
@param tabStop The number of spaces a tab represents
@return an unexpanded String
@since 1.8.2 | [
"Replaces",
"sequences",
"of",
"whitespaces",
"with",
"tabs",
"within",
"a",
"line",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L3626-L3645 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/ast/ClassNode.java | ClassNode.hasPossibleMethod | public boolean hasPossibleMethod(String name, Expression arguments) {
int count = 0;
if (arguments instanceof TupleExpression) {
TupleExpression tuple = (TupleExpression) arguments;
// TODO this won't strictly be true when using list expansion in argument calls
count... | java | public boolean hasPossibleMethod(String name, Expression arguments) {
int count = 0;
if (arguments instanceof TupleExpression) {
TupleExpression tuple = (TupleExpression) arguments;
// TODO this won't strictly be true when using list expansion in argument calls
count... | [
"public",
"boolean",
"hasPossibleMethod",
"(",
"String",
"name",
",",
"Expression",
"arguments",
")",
"{",
"int",
"count",
"=",
"0",
";",
"if",
"(",
"arguments",
"instanceof",
"TupleExpression",
")",
"{",
"TupleExpression",
"tuple",
"=",
"(",
"TupleExpression",
... | Returns true if the given method has a possibly matching instance method with the given name and arguments.
@param name the name of the method of interest
@param arguments the arguments to match against
@return true if a matching method was found | [
"Returns",
"true",
"if",
"the",
"given",
"method",
"has",
"a",
"possibly",
"matching",
"instance",
"method",
"with",
"the",
"given",
"name",
"and",
"arguments",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/ast/ClassNode.java#L1221-L1240 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java | StaticTypeCheckingVisitor.checkOrMarkPrivateAccess | private void checkOrMarkPrivateAccess(Expression source, FieldNode fn) {
if (fn!=null && Modifier.isPrivate(fn.getModifiers()) &&
(fn.getDeclaringClass() != typeCheckingContext.getEnclosingClassNode() || typeCheckingContext.getEnclosingClosure()!=null) &&
fn.getDeclaringClass().getModule... | java | private void checkOrMarkPrivateAccess(Expression source, FieldNode fn) {
if (fn!=null && Modifier.isPrivate(fn.getModifiers()) &&
(fn.getDeclaringClass() != typeCheckingContext.getEnclosingClassNode() || typeCheckingContext.getEnclosingClosure()!=null) &&
fn.getDeclaringClass().getModule... | [
"private",
"void",
"checkOrMarkPrivateAccess",
"(",
"Expression",
"source",
",",
"FieldNode",
"fn",
")",
"{",
"if",
"(",
"fn",
"!=",
"null",
"&&",
"Modifier",
".",
"isPrivate",
"(",
"fn",
".",
"getModifiers",
"(",
")",
")",
"&&",
"(",
"fn",
".",
"getDecl... | Given a field node, checks if we are calling a private field from an inner class. | [
"Given",
"a",
"field",
"node",
"checks",
"if",
"we",
"are",
"calling",
"a",
"private",
"field",
"from",
"an",
"inner",
"class",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java#L347-L353 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java | StaticTypeCheckingVisitor.checkOrMarkPrivateAccess | private void checkOrMarkPrivateAccess(Expression source, MethodNode mn) {
if (mn==null) {
return;
}
ClassNode declaringClass = mn.getDeclaringClass();
ClassNode enclosingClassNode = typeCheckingContext.getEnclosingClassNode();
if (declaringClass != enclosingClassNode ... | java | private void checkOrMarkPrivateAccess(Expression source, MethodNode mn) {
if (mn==null) {
return;
}
ClassNode declaringClass = mn.getDeclaringClass();
ClassNode enclosingClassNode = typeCheckingContext.getEnclosingClassNode();
if (declaringClass != enclosingClassNode ... | [
"private",
"void",
"checkOrMarkPrivateAccess",
"(",
"Expression",
"source",
",",
"MethodNode",
"mn",
")",
"{",
"if",
"(",
"mn",
"==",
"null",
")",
"{",
"return",
";",
"}",
"ClassNode",
"declaringClass",
"=",
"mn",
".",
"getDeclaringClass",
"(",
")",
";",
"... | Given a method node, checks if we are calling a private method from an inner class. | [
"Given",
"a",
"method",
"node",
"checks",
"if",
"we",
"are",
"calling",
"a",
"private",
"method",
"from",
"an",
"inner",
"class",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java#L358-L376 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java | StaticTypeCheckingVisitor.ensureValidSetter | private boolean ensureValidSetter(final Expression expression, final Expression leftExpression, final Expression rightExpression, final SetterInfo setterInfo) {
// for expressions like foo = { ... }
// we know that the RHS type is a closure
// but we must check if the binary expression is an ass... | java | private boolean ensureValidSetter(final Expression expression, final Expression leftExpression, final Expression rightExpression, final SetterInfo setterInfo) {
// for expressions like foo = { ... }
// we know that the RHS type is a closure
// but we must check if the binary expression is an ass... | [
"private",
"boolean",
"ensureValidSetter",
"(",
"final",
"Expression",
"expression",
",",
"final",
"Expression",
"leftExpression",
",",
"final",
"Expression",
"rightExpression",
",",
"final",
"SetterInfo",
"setterInfo",
")",
"{",
"// for expressions like foo = { ... }",
"... | Given a binary expression corresponding to an assignment, will check that the type of the RHS matches one
of the possible setters and if not, throw a type checking error.
@param expression the assignment expression
@param leftExpression left expression of the assignment
@param rightExpression right expression of the as... | [
"Given",
"a",
"binary",
"expression",
"corresponding",
"to",
"an",
"assignment",
"will",
"check",
"that",
"the",
"type",
"of",
"the",
"RHS",
"matches",
"one",
"of",
"the",
"possible",
"setters",
"and",
"if",
"not",
"throw",
"a",
"type",
"checking",
"error",
... | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java#L704-L752 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java | StaticTypeCheckingVisitor.addArrayMethods | private void addArrayMethods(List<MethodNode> methods, ClassNode receiver, String name, ClassNode[] args) {
if (args.length!=1) return;
if (!receiver.isArray()) return;
if (!isIntCategory(getUnwrapper(args[0]))) return;
if ("getAt".equals(name)) {
MethodNode node = new Method... | java | private void addArrayMethods(List<MethodNode> methods, ClassNode receiver, String name, ClassNode[] args) {
if (args.length!=1) return;
if (!receiver.isArray()) return;
if (!isIntCategory(getUnwrapper(args[0]))) return;
if ("getAt".equals(name)) {
MethodNode node = new Method... | [
"private",
"void",
"addArrayMethods",
"(",
"List",
"<",
"MethodNode",
">",
"methods",
",",
"ClassNode",
"receiver",
",",
"String",
"name",
",",
"ClassNode",
"[",
"]",
"args",
")",
"{",
"if",
"(",
"args",
".",
"length",
"!=",
"1",
")",
"return",
";",
"i... | add various getAt and setAt methods for primitive arrays
@param receiver the receiver class
@param name the name of the method
@param args the argument classes | [
"add",
"various",
"getAt",
"and",
"setAt",
"methods",
"for",
"primitive",
"arrays"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java#L3011-L3024 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java | StaticTypeCheckingVisitor.getGenericsResolvedTypeOfFieldOrProperty | private ClassNode getGenericsResolvedTypeOfFieldOrProperty(AnnotatedNode an, ClassNode type) {
if (!type.isUsingGenerics()) return type;
Map<String, GenericsType> connections = new HashMap();
//TODO: inner classes mean a different this-type. This is ignored here!
extractGenericsConnectio... | java | private ClassNode getGenericsResolvedTypeOfFieldOrProperty(AnnotatedNode an, ClassNode type) {
if (!type.isUsingGenerics()) return type;
Map<String, GenericsType> connections = new HashMap();
//TODO: inner classes mean a different this-type. This is ignored here!
extractGenericsConnectio... | [
"private",
"ClassNode",
"getGenericsResolvedTypeOfFieldOrProperty",
"(",
"AnnotatedNode",
"an",
",",
"ClassNode",
"type",
")",
"{",
"if",
"(",
"!",
"type",
".",
"isUsingGenerics",
"(",
")",
")",
"return",
"type",
";",
"Map",
"<",
"String",
",",
"GenericsType",
... | resolves a Field or Property node generics by using the current class and
the declaring class to extract the right meaning of the generics symbols
@param an a FieldNode or PropertyNode
@param type the origin type
@return the new ClassNode with corrected generics | [
"resolves",
"a",
"Field",
"or",
"Property",
"node",
"generics",
"by",
"using",
"the",
"current",
"class",
"and",
"the",
"declaring",
"class",
"to",
"extract",
"the",
"right",
"meaning",
"of",
"the",
"generics",
"symbols"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java#L4000-L4007 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/EncodingGroovyMethods.java | EncodingGroovyMethods.decodeBase64 | public static byte[] decodeBase64(String value) {
int byteShift = 4;
int tmp = 0;
boolean done = false;
final StringBuilder buffer = new StringBuilder();
for (int i = 0; i != value.length(); i++) {
final char c = value.charAt(i);
final int sixBit = (c < 1... | java | public static byte[] decodeBase64(String value) {
int byteShift = 4;
int tmp = 0;
boolean done = false;
final StringBuilder buffer = new StringBuilder();
for (int i = 0; i != value.length(); i++) {
final char c = value.charAt(i);
final int sixBit = (c < 1... | [
"public",
"static",
"byte",
"[",
"]",
"decodeBase64",
"(",
"String",
"value",
")",
"{",
"int",
"byteShift",
"=",
"4",
";",
"int",
"tmp",
"=",
"0",
";",
"boolean",
"done",
"=",
"false",
";",
"final",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",... | Decode the String from Base64 into a byte array.
@param value the string to be decoded
@return the decoded bytes as an array
@since 1.0 | [
"Decode",
"the",
"String",
"from",
"Base64",
"into",
"a",
"byte",
"array",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/EncodingGroovyMethods.java#L151-L191 | train |
groovy/groovy-core | subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovy.java | Groovy.runStatements | protected void runStatements(Reader reader, PrintStream out)
throws IOException {
log.debug("runStatements()");
StringBuilder txt = new StringBuilder();
String line = "";
BufferedReader in = new BufferedReader(reader);
while ((line = in.readLine()) != null) {
... | java | protected void runStatements(Reader reader, PrintStream out)
throws IOException {
log.debug("runStatements()");
StringBuilder txt = new StringBuilder();
String line = "";
BufferedReader in = new BufferedReader(reader);
while ((line = in.readLine()) != null) {
... | [
"protected",
"void",
"runStatements",
"(",
"Reader",
"reader",
",",
"PrintStream",
"out",
")",
"throws",
"IOException",
"{",
"log",
".",
"debug",
"(",
"\"runStatements()\"",
")",
";",
"StringBuilder",
"txt",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"String"... | Read in lines and execute them.
@param reader the reader from which to get the groovy source to exec
@param out the outputstream to use
@throws java.io.IOException if something goes wrong | [
"Read",
"in",
"lines",
"and",
"execute",
"them",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovy.java#L354-L371 | train |
groovy/groovy-core | subprojects/groovy-json/src/main/java/groovy/json/JsonOutput.java | JsonOutput.toJson | public static String toJson(Date date) {
if (date == null) {
return NULL_VALUE;
}
CharBuf buffer = CharBuf.create(26);
writeDate(date, buffer);
return buffer.toString();
} | java | public static String toJson(Date date) {
if (date == null) {
return NULL_VALUE;
}
CharBuf buffer = CharBuf.create(26);
writeDate(date, buffer);
return buffer.toString();
} | [
"public",
"static",
"String",
"toJson",
"(",
"Date",
"date",
")",
"{",
"if",
"(",
"date",
"==",
"null",
")",
"{",
"return",
"NULL_VALUE",
";",
"}",
"CharBuf",
"buffer",
"=",
"CharBuf",
".",
"create",
"(",
"26",
")",
";",
"writeDate",
"(",
"date",
","... | Format a date that is parseable from JavaScript, according to ISO-8601.
@param date the date to format to a JSON string
@return a formatted date in the form of a string | [
"Format",
"a",
"date",
"that",
"is",
"parseable",
"from",
"JavaScript",
"according",
"to",
"ISO",
"-",
"8601",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-json/src/main/java/groovy/json/JsonOutput.java#L105-L114 | train |
groovy/groovy-core | subprojects/groovy-json/src/main/java/groovy/json/JsonOutput.java | JsonOutput.toJson | public static String toJson(Calendar cal) {
if (cal == null) {
return NULL_VALUE;
}
CharBuf buffer = CharBuf.create(26);
writeDate(cal.getTime(), buffer);
return buffer.toString();
} | java | public static String toJson(Calendar cal) {
if (cal == null) {
return NULL_VALUE;
}
CharBuf buffer = CharBuf.create(26);
writeDate(cal.getTime(), buffer);
return buffer.toString();
} | [
"public",
"static",
"String",
"toJson",
"(",
"Calendar",
"cal",
")",
"{",
"if",
"(",
"cal",
"==",
"null",
")",
"{",
"return",
"NULL_VALUE",
";",
"}",
"CharBuf",
"buffer",
"=",
"CharBuf",
".",
"create",
"(",
"26",
")",
";",
"writeDate",
"(",
"cal",
".... | Format a calendar instance that is parseable from JavaScript, according to ISO-8601.
@param cal the calendar to format to a JSON string
@return a formatted date in the form of a string | [
"Format",
"a",
"calendar",
"instance",
"that",
"is",
"parseable",
"from",
"JavaScript",
"according",
"to",
"ISO",
"-",
"8601",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-json/src/main/java/groovy/json/JsonOutput.java#L122-L131 | train |
groovy/groovy-core | subprojects/groovy-json/src/main/java/groovy/json/JsonOutput.java | JsonOutput.writeNumber | private static void writeNumber(Class<?> numberClass, Number value, CharBuf buffer) {
if (numberClass == Integer.class) {
buffer.addInt((Integer) value);
} else if (numberClass == Long.class) {
buffer.addLong((Long) value);
} else if (numberClass == BigInteger.class) {
... | java | private static void writeNumber(Class<?> numberClass, Number value, CharBuf buffer) {
if (numberClass == Integer.class) {
buffer.addInt((Integer) value);
} else if (numberClass == Long.class) {
buffer.addLong((Long) value);
} else if (numberClass == BigInteger.class) {
... | [
"private",
"static",
"void",
"writeNumber",
"(",
"Class",
"<",
"?",
">",
"numberClass",
",",
"Number",
"value",
",",
"CharBuf",
"buffer",
")",
"{",
"if",
"(",
"numberClass",
"==",
"Integer",
".",
"class",
")",
"{",
"buffer",
".",
"addInt",
"(",
"(",
"I... | Serializes Number value and writes it into specified buffer. | [
"Serializes",
"Number",
"value",
"and",
"writes",
"it",
"into",
"specified",
"buffer",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-json/src/main/java/groovy/json/JsonOutput.java#L209-L245 | train |
groovy/groovy-core | subprojects/groovy-json/src/main/java/groovy/json/JsonOutput.java | JsonOutput.writeCharSequence | private static void writeCharSequence(CharSequence seq, CharBuf buffer) {
if (seq.length() > 0) {
buffer.addJsonEscapedString(seq.toString());
} else {
buffer.addChars(EMPTY_STRING_CHARS);
}
} | java | private static void writeCharSequence(CharSequence seq, CharBuf buffer) {
if (seq.length() > 0) {
buffer.addJsonEscapedString(seq.toString());
} else {
buffer.addChars(EMPTY_STRING_CHARS);
}
} | [
"private",
"static",
"void",
"writeCharSequence",
"(",
"CharSequence",
"seq",
",",
"CharBuf",
"buffer",
")",
"{",
"if",
"(",
"seq",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"buffer",
".",
"addJsonEscapedString",
"(",
"seq",
".",
"toString",
"(",
")",... | Serializes any char sequence and writes it into specified buffer. | [
"Serializes",
"any",
"char",
"sequence",
"and",
"writes",
"it",
"into",
"specified",
"buffer",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-json/src/main/java/groovy/json/JsonOutput.java#L304-L310 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/typehandling/ShortTypeHandling.java | ShortTypeHandling.castToEnum | public static Enum castToEnum(Object object, Class<? extends Enum> type) {
if (object==null) return null;
if (type.isInstance(object)) return (Enum) object;
if (object instanceof String || object instanceof GString) {
return Enum.valueOf(type, object.toString());
}
th... | java | public static Enum castToEnum(Object object, Class<? extends Enum> type) {
if (object==null) return null;
if (type.isInstance(object)) return (Enum) object;
if (object instanceof String || object instanceof GString) {
return Enum.valueOf(type, object.toString());
}
th... | [
"public",
"static",
"Enum",
"castToEnum",
"(",
"Object",
"object",
",",
"Class",
"<",
"?",
"extends",
"Enum",
">",
"type",
")",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"type",
".",
"isInstance",
"(",
"object",
"... | this class requires that the supplied enum is not fitting a
Collection case for casting | [
"this",
"class",
"requires",
"that",
"the",
"supplied",
"enum",
"is",
"not",
"fitting",
"a",
"Collection",
"case",
"for",
"casting"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/typehandling/ShortTypeHandling.java#L52-L59 | train |
groovy/groovy-core | subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java | Groovyc.setTargetBytecode | public void setTargetBytecode(String version) {
if (CompilerConfiguration.PRE_JDK5.equals(version) || CompilerConfiguration.POST_JDK5.equals(version)) {
this.targetBytecode = version;
}
} | java | public void setTargetBytecode(String version) {
if (CompilerConfiguration.PRE_JDK5.equals(version) || CompilerConfiguration.POST_JDK5.equals(version)) {
this.targetBytecode = version;
}
} | [
"public",
"void",
"setTargetBytecode",
"(",
"String",
"version",
")",
"{",
"if",
"(",
"CompilerConfiguration",
".",
"PRE_JDK5",
".",
"equals",
"(",
"version",
")",
"||",
"CompilerConfiguration",
".",
"POST_JDK5",
".",
"equals",
"(",
"version",
")",
")",
"{",
... | Sets the bytecode compatibility mode
@param version the bytecode compatibility mode | [
"Sets",
"the",
"bytecode",
"compatibility",
"mode"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java#L292-L296 | train |
groovy/groovy-core | src/main/groovy/util/Node.java | Node.depthFirst | public List depthFirst() {
List answer = new NodeList();
answer.add(this);
answer.addAll(depthFirstRest());
return answer;
} | java | public List depthFirst() {
List answer = new NodeList();
answer.add(this);
answer.addAll(depthFirstRest());
return answer;
} | [
"public",
"List",
"depthFirst",
"(",
")",
"{",
"List",
"answer",
"=",
"new",
"NodeList",
"(",
")",
";",
"answer",
".",
"add",
"(",
"this",
")",
";",
"answer",
".",
"addAll",
"(",
"depthFirstRest",
"(",
")",
")",
";",
"return",
"answer",
";",
"}"
] | Provides a collection of all the nodes in the tree
using a depth first traversal.
@return the list of (depth-first) ordered nodes | [
"Provides",
"a",
"collection",
"of",
"all",
"the",
"nodes",
"in",
"the",
"tree",
"using",
"a",
"depth",
"first",
"traversal",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/groovy/util/Node.java#L544-L549 | train |
groovy/groovy-core | src/main/groovy/lang/MetaProperty.java | MetaProperty.getGetterName | public static String getGetterName(String propertyName, Class type) {
String prefix = type == boolean.class || type == Boolean.class ? "is" : "get";
return prefix + MetaClassHelper.capitalize(propertyName);
} | java | public static String getGetterName(String propertyName, Class type) {
String prefix = type == boolean.class || type == Boolean.class ? "is" : "get";
return prefix + MetaClassHelper.capitalize(propertyName);
} | [
"public",
"static",
"String",
"getGetterName",
"(",
"String",
"propertyName",
",",
"Class",
"type",
")",
"{",
"String",
"prefix",
"=",
"type",
"==",
"boolean",
".",
"class",
"||",
"type",
"==",
"Boolean",
".",
"class",
"?",
"\"is\"",
":",
"\"get\"",
";",
... | Gets the name for the getter for this property
@return The name of the property. The name is "get"+ the capitalized propertyName
or, in the case of boolean values, "is" + the capitalized propertyName | [
"Gets",
"the",
"name",
"for",
"the",
"getter",
"for",
"this",
"property"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/groovy/lang/MetaProperty.java#L90-L93 | train |
groovy/groovy-core | src/main/groovy/lang/ProxyMetaClass.java | ProxyMetaClass.getInstance | public static ProxyMetaClass getInstance(Class theClass) throws IntrospectionException {
MetaClassRegistry metaRegistry = GroovySystem.getMetaClassRegistry();
MetaClass meta = metaRegistry.getMetaClass(theClass);
return new ProxyMetaClass(metaRegistry, theClass, meta);
} | java | public static ProxyMetaClass getInstance(Class theClass) throws IntrospectionException {
MetaClassRegistry metaRegistry = GroovySystem.getMetaClassRegistry();
MetaClass meta = metaRegistry.getMetaClass(theClass);
return new ProxyMetaClass(metaRegistry, theClass, meta);
} | [
"public",
"static",
"ProxyMetaClass",
"getInstance",
"(",
"Class",
"theClass",
")",
"throws",
"IntrospectionException",
"{",
"MetaClassRegistry",
"metaRegistry",
"=",
"GroovySystem",
".",
"getMetaClassRegistry",
"(",
")",
";",
"MetaClass",
"meta",
"=",
"metaRegistry",
... | convenience factory method for the most usual case. | [
"convenience",
"factory",
"method",
"for",
"the",
"most",
"usual",
"case",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/groovy/lang/ProxyMetaClass.java#L47-L51 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/control/ResolveVisitor.java | ResolveVisitor.correctClassClassChain | private Expression correctClassClassChain(PropertyExpression pe) {
LinkedList<Expression> stack = new LinkedList<Expression>();
ClassExpression found = null;
for (Expression it = pe; it != null; it = ((PropertyExpression) it).getObjectExpression()) {
if (it instanceof ClassExpression... | java | private Expression correctClassClassChain(PropertyExpression pe) {
LinkedList<Expression> stack = new LinkedList<Expression>();
ClassExpression found = null;
for (Expression it = pe; it != null; it = ((PropertyExpression) it).getObjectExpression()) {
if (it instanceof ClassExpression... | [
"private",
"Expression",
"correctClassClassChain",
"(",
"PropertyExpression",
"pe",
")",
"{",
"LinkedList",
"<",
"Expression",
">",
"stack",
"=",
"new",
"LinkedList",
"<",
"Expression",
">",
"(",
")",
";",
"ClassExpression",
"found",
"=",
"null",
";",
"for",
"... | and class as property | [
"and",
"class",
"as",
"property"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/control/ResolveVisitor.java#L781-L810 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/DefaultGroovyMethodsSupport.java | DefaultGroovyMethodsSupport.closeWithWarning | public static void closeWithWarning(Closeable c) {
if (c != null) {
try {
c.close();
} catch (IOException e) {
LOG.warning("Caught exception during close(): " + e);
}
}
} | java | public static void closeWithWarning(Closeable c) {
if (c != null) {
try {
c.close();
} catch (IOException e) {
LOG.warning("Caught exception during close(): " + e);
}
}
} | [
"public",
"static",
"void",
"closeWithWarning",
"(",
"Closeable",
"c",
")",
"{",
"if",
"(",
"c",
"!=",
"null",
")",
"{",
"try",
"{",
"c",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"LOG",
".",
"warning",
"(",
"\... | Close the Closeable. Logging a warning if any problems occur.
@param c the thing to close | [
"Close",
"the",
"Closeable",
".",
"Logging",
"a",
"warning",
"if",
"any",
"problems",
"occur",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethodsSupport.java#L88-L96 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/util/ManagedConcurrentValueMap.java | ManagedConcurrentValueMap.get | public V get(K key) {
ManagedReference<V> ref = internalMap.get(key);
if (ref!=null) return ref.get();
return null;
} | java | public V get(K key) {
ManagedReference<V> ref = internalMap.get(key);
if (ref!=null) return ref.get();
return null;
} | [
"public",
"V",
"get",
"(",
"K",
"key",
")",
"{",
"ManagedReference",
"<",
"V",
">",
"ref",
"=",
"internalMap",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"ref",
"!=",
"null",
")",
"return",
"ref",
".",
"get",
"(",
")",
";",
"return",
"null",
... | Returns the value stored for the given key at the point of call.
@param key a non null key
@return the value stored in the map for the given key | [
"Returns",
"the",
"value",
"stored",
"for",
"the",
"given",
"key",
"at",
"the",
"point",
"of",
"call",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/util/ManagedConcurrentValueMap.java#L55-L59 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/util/ManagedConcurrentValueMap.java | ManagedConcurrentValueMap.put | public void put(final K key, V value) {
ManagedReference<V> ref = new ManagedReference<V>(bundle, value) {
@Override
public void finalizeReference() {
super.finalizeReference();
internalMap.remove(key, get());
}
};
internalMap.p... | java | public void put(final K key, V value) {
ManagedReference<V> ref = new ManagedReference<V>(bundle, value) {
@Override
public void finalizeReference() {
super.finalizeReference();
internalMap.remove(key, get());
}
};
internalMap.p... | [
"public",
"void",
"put",
"(",
"final",
"K",
"key",
",",
"V",
"value",
")",
"{",
"ManagedReference",
"<",
"V",
">",
"ref",
"=",
"new",
"ManagedReference",
"<",
"V",
">",
"(",
"bundle",
",",
"value",
")",
"{",
"@",
"Override",
"public",
"void",
"finali... | Sets a new value for a given key. an older value is overwritten.
@param key a non null key
@param value the new value | [
"Sets",
"a",
"new",
"value",
"for",
"a",
"given",
"key",
".",
"an",
"older",
"value",
"is",
"overwritten",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/util/ManagedConcurrentValueMap.java#L66-L75 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/control/SourceUnit.java | SourceUnit.getSample | public String getSample(int line, int column, Janitor janitor) {
String sample = null;
String text = source.getLine(line, janitor);
if (text != null) {
if (column > 0) {
String marker = Utilities.repeatString(" ", column - 1) + "^";
if (column > 40) ... | java | public String getSample(int line, int column, Janitor janitor) {
String sample = null;
String text = source.getLine(line, janitor);
if (text != null) {
if (column > 0) {
String marker = Utilities.repeatString(" ", column - 1) + "^";
if (column > 40) ... | [
"public",
"String",
"getSample",
"(",
"int",
"line",
",",
"int",
"column",
",",
"Janitor",
"janitor",
")",
"{",
"String",
"sample",
"=",
"null",
";",
"String",
"text",
"=",
"source",
".",
"getLine",
"(",
"line",
",",
"janitor",
")",
";",
"if",
"(",
"... | Returns a sampling of the source at the specified line and column,
of null if it is unavailable. | [
"Returns",
"a",
"sampling",
"of",
"the",
"source",
"at",
"the",
"specified",
"line",
"and",
"column",
"of",
"null",
"if",
"it",
"is",
"unavailable",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/control/SourceUnit.java#L313-L335 | train |
groovy/groovy-core | subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java | Sql.withInstance | public static void withInstance(String url, Closure c) throws SQLException {
Sql sql = null;
try {
sql = newInstance(url);
c.call(sql);
} finally {
if (sql != null) sql.close();
}
} | java | public static void withInstance(String url, Closure c) throws SQLException {
Sql sql = null;
try {
sql = newInstance(url);
c.call(sql);
} finally {
if (sql != null) sql.close();
}
} | [
"public",
"static",
"void",
"withInstance",
"(",
"String",
"url",
",",
"Closure",
"c",
")",
"throws",
"SQLException",
"{",
"Sql",
"sql",
"=",
"null",
";",
"try",
"{",
"sql",
"=",
"newInstance",
"(",
"url",
")",
";",
"c",
".",
"call",
"(",
"sql",
")",... | Invokes a closure passing it a new Sql instance created from the given JDBC connection URL.
The created connection will be closed if required.
@param url a database url of the form
<code>jdbc:<em>subprotocol</em>:<em>subname</em></code>
@param c the Closure to call
@see #newInstance(String)
@throws SQLException if a d... | [
"Invokes",
"a",
"closure",
"passing",
"it",
"a",
"new",
"Sql",
"instance",
"created",
"from",
"the",
"given",
"JDBC",
"connection",
"URL",
".",
"The",
"created",
"connection",
"will",
"be",
"closed",
"if",
"required",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L293-L301 | train |
groovy/groovy-core | subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java | Sql.withTransaction | public synchronized void withTransaction(Closure closure) throws SQLException {
boolean savedCacheConnection = cacheConnection;
cacheConnection = true;
Connection connection = null;
boolean savedAutoCommit = true;
try {
connection = createConnection();
sav... | java | public synchronized void withTransaction(Closure closure) throws SQLException {
boolean savedCacheConnection = cacheConnection;
cacheConnection = true;
Connection connection = null;
boolean savedAutoCommit = true;
try {
connection = createConnection();
sav... | [
"public",
"synchronized",
"void",
"withTransaction",
"(",
"Closure",
"closure",
")",
"throws",
"SQLException",
"{",
"boolean",
"savedCacheConnection",
"=",
"cacheConnection",
";",
"cacheConnection",
"=",
"true",
";",
"Connection",
"connection",
"=",
"null",
";",
"bo... | Performs the closure within a transaction using a cached connection.
If the closure takes a single argument, it will be called
with the connection, otherwise it will be called with no arguments.
@param closure the given closure
@throws SQLException if a database error occurs | [
"Performs",
"the",
"closure",
"within",
"a",
"transaction",
"using",
"a",
"cached",
"connection",
".",
"If",
"the",
"closure",
"takes",
"a",
"single",
"argument",
"it",
"will",
"be",
"called",
"with",
"the",
"connection",
"otherwise",
"it",
"will",
"be",
"ca... | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L3515-L3554 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/ReflectionMethodInvoker.java | ReflectionMethodInvoker.invoke | public static Object invoke(Object object, String methodName, Object[] parameters) {
try {
Class[] classTypes = new Class[parameters.length];
for (int i = 0; i < classTypes.length; i++) {
classTypes[i] = parameters[i].getClass();
}
Method method = ... | java | public static Object invoke(Object object, String methodName, Object[] parameters) {
try {
Class[] classTypes = new Class[parameters.length];
for (int i = 0; i < classTypes.length; i++) {
classTypes[i] = parameters[i].getClass();
}
Method method = ... | [
"public",
"static",
"Object",
"invoke",
"(",
"Object",
"object",
",",
"String",
"methodName",
",",
"Object",
"[",
"]",
"parameters",
")",
"{",
"try",
"{",
"Class",
"[",
"]",
"classTypes",
"=",
"new",
"Class",
"[",
"parameters",
".",
"length",
"]",
";",
... | Invoke a method through reflection.
Falls through to using the Invoker to call the method in case the reflection call fails..
@param object the object on which to invoke a method
@param methodName the name of the method to invoke
@param parameters the parameters of the method call
@return the result of the method call | [
"Invoke",
"a",
"method",
"through",
"reflection",
".",
"Falls",
"through",
"to",
"using",
"the",
"Invoker",
"to",
"call",
"the",
"method",
"in",
"case",
"the",
"reflection",
"call",
"fails",
".."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/ReflectionMethodInvoker.java#L43-L54 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/tools/StringHelper.java | StringHelper.tokenizeUnquoted | public static String[] tokenizeUnquoted(String s) {
List tokens = new LinkedList();
int first = 0;
while (first < s.length()) {
first = skipWhitespace(s, first);
int last = scanToken(s, first);
if (first < last) {
tokens.add(s.substring(... | java | public static String[] tokenizeUnquoted(String s) {
List tokens = new LinkedList();
int first = 0;
while (first < s.length()) {
first = skipWhitespace(s, first);
int last = scanToken(s, first);
if (first < last) {
tokens.add(s.substring(... | [
"public",
"static",
"String",
"[",
"]",
"tokenizeUnquoted",
"(",
"String",
"s",
")",
"{",
"List",
"tokens",
"=",
"new",
"LinkedList",
"(",
")",
";",
"int",
"first",
"=",
"0",
";",
"while",
"(",
"first",
"<",
"s",
".",
"length",
"(",
")",
")",
"{",
... | This method tokenizes a string by space characters,
but ignores spaces in quoted parts,that are parts in
'' or "". The method does allows the usage of "" in ''
and '' in "". The space character between tokens is not
returned.
@param s the string to tokenize
@return the tokens | [
"This",
"method",
"tokenizes",
"a",
"string",
"by",
"space",
"characters",
"but",
"ignores",
"spaces",
"in",
"quoted",
"parts",
"that",
"are",
"parts",
"in",
"or",
".",
"The",
"method",
"does",
"allows",
"the",
"usage",
"of",
"in",
"and",
"in",
".",
"The... | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/tools/StringHelper.java#L38-L50 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/transform/sc/StaticCompilationVisitor.java | StaticCompilationVisitor.addPrivateFieldsAccessors | @SuppressWarnings("unchecked")
private void addPrivateFieldsAccessors(ClassNode node) {
Set<ASTNode> accessedFields = (Set<ASTNode>) node.getNodeMetaData(StaticTypesMarker.PV_FIELDS_ACCESS);
if (accessedFields==null) return;
Map<String, MethodNode> privateConstantAccessors = (Map<String, Met... | java | @SuppressWarnings("unchecked")
private void addPrivateFieldsAccessors(ClassNode node) {
Set<ASTNode> accessedFields = (Set<ASTNode>) node.getNodeMetaData(StaticTypesMarker.PV_FIELDS_ACCESS);
if (accessedFields==null) return;
Map<String, MethodNode> privateConstantAccessors = (Map<String, Met... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"void",
"addPrivateFieldsAccessors",
"(",
"ClassNode",
"node",
")",
"{",
"Set",
"<",
"ASTNode",
">",
"accessedFields",
"=",
"(",
"Set",
"<",
"ASTNode",
">",
")",
"node",
".",
"getNodeMetaData",
"("... | Adds special accessors for private constants so that inner classes can retrieve them. | [
"Adds",
"special",
"accessors",
"for",
"private",
"constants",
"so",
"that",
"inner",
"classes",
"can",
"retrieve",
"them",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/transform/sc/StaticCompilationVisitor.java#L170-L197 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/control/CompilerConfiguration.java | CompilerConfiguration.isPostJDK5 | public static boolean isPostJDK5(String bytecodeVersion) {
return JDK5.equals(bytecodeVersion)
|| JDK6.equals(bytecodeVersion)
|| JDK7.equals(bytecodeVersion)
|| JDK8.equals(bytecodeVersion);
} | java | public static boolean isPostJDK5(String bytecodeVersion) {
return JDK5.equals(bytecodeVersion)
|| JDK6.equals(bytecodeVersion)
|| JDK7.equals(bytecodeVersion)
|| JDK8.equals(bytecodeVersion);
} | [
"public",
"static",
"boolean",
"isPostJDK5",
"(",
"String",
"bytecodeVersion",
")",
"{",
"return",
"JDK5",
".",
"equals",
"(",
"bytecodeVersion",
")",
"||",
"JDK6",
".",
"equals",
"(",
"bytecodeVersion",
")",
"||",
"JDK7",
".",
"equals",
"(",
"bytecodeVersion"... | Checks if the specified bytecode version string represents a JDK 1.5+ compatible
bytecode version.
@param bytecodeVersion the bytecode version string (1.4, 1.5, 1.6, 1.7 or 1.8)
@return true if the bytecode version is JDK 1.5+ | [
"Checks",
"if",
"the",
"specified",
"bytecode",
"version",
"string",
"represents",
"a",
"JDK",
"1",
".",
"5",
"+",
"compatible",
"bytecode",
"version",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/control/CompilerConfiguration.java#L363-L368 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/control/CompilerConfiguration.java | CompilerConfiguration.setTargetDirectory | public void setTargetDirectory(String directory) {
if (directory != null && directory.length() > 0) {
this.targetDirectory = new File(directory);
} else {
this.targetDirectory = null;
}
} | java | public void setTargetDirectory(String directory) {
if (directory != null && directory.length() > 0) {
this.targetDirectory = new File(directory);
} else {
this.targetDirectory = null;
}
} | [
"public",
"void",
"setTargetDirectory",
"(",
"String",
"directory",
")",
"{",
"if",
"(",
"directory",
"!=",
"null",
"&&",
"directory",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"this",
".",
"targetDirectory",
"=",
"new",
"File",
"(",
"directory",
")",... | Sets the target directory. | [
"Sets",
"the",
"target",
"directory",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/control/CompilerConfiguration.java#L566-L572 | train |
groovy/groovy-core | src/main/org/codehaus/groovy/tools/RootLoader.java | RootLoader.loadClass | protected synchronized Class loadClass(final String name, boolean resolve) throws ClassNotFoundException {
Class c = this.findLoadedClass(name);
if (c != null) return c;
c = (Class) customClasses.get(name);
if (c != null) return c;
try {
c = oldFindClass(name);
... | java | protected synchronized Class loadClass(final String name, boolean resolve) throws ClassNotFoundException {
Class c = this.findLoadedClass(name);
if (c != null) return c;
c = (Class) customClasses.get(name);
if (c != null) return c;
try {
c = oldFindClass(name);
... | [
"protected",
"synchronized",
"Class",
"loadClass",
"(",
"final",
"String",
"name",
",",
"boolean",
"resolve",
")",
"throws",
"ClassNotFoundException",
"{",
"Class",
"c",
"=",
"this",
".",
"findLoadedClass",
"(",
"name",
")",
";",
"if",
"(",
"c",
"!=",
"null"... | loads a class using the name of the class | [
"loads",
"a",
"class",
"using",
"the",
"name",
"of",
"the",
"class"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/tools/RootLoader.java#L140-L156 | train |
groovy/groovy-core | src/main/groovy/util/NodeList.java | NodeList.getAt | public NodeList getAt(String name) {
NodeList answer = new NodeList();
for (Object child : this) {
if (child instanceof Node) {
Node childNode = (Node) child;
Object temp = childNode.get(name);
if (temp instanceof Collection) {
... | java | public NodeList getAt(String name) {
NodeList answer = new NodeList();
for (Object child : this) {
if (child instanceof Node) {
Node childNode = (Node) child;
Object temp = childNode.get(name);
if (temp instanceof Collection) {
... | [
"public",
"NodeList",
"getAt",
"(",
"String",
"name",
")",
"{",
"NodeList",
"answer",
"=",
"new",
"NodeList",
"(",
")",
";",
"for",
"(",
"Object",
"child",
":",
"this",
")",
"{",
"if",
"(",
"child",
"instanceof",
"Node",
")",
"{",
"Node",
"childNode",
... | Provides lookup of elements by non-namespaced name.
@param name the name or shortcut key for nodes of interest
@return the nodes of interest which match name | [
"Provides",
"lookup",
"of",
"elements",
"by",
"non",
"-",
"namespaced",
"name",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/groovy/util/NodeList.java#L118-L132 | train |
groovy/groovy-core | src/main/groovy/util/NodeList.java | NodeList.text | public String text() {
String previousText = null;
StringBuilder buffer = null;
for (Object child : this) {
String text = null;
if (child instanceof String) {
text = (String) child;
} else if (child instanceof Node) {
text = ((N... | java | public String text() {
String previousText = null;
StringBuilder buffer = null;
for (Object child : this) {
String text = null;
if (child instanceof String) {
text = (String) child;
} else if (child instanceof Node) {
text = ((N... | [
"public",
"String",
"text",
"(",
")",
"{",
"String",
"previousText",
"=",
"null",
";",
"StringBuilder",
"buffer",
"=",
"null",
";",
"for",
"(",
"Object",
"child",
":",
"this",
")",
"{",
"String",
"text",
"=",
"null",
";",
"if",
"(",
"child",
"instanceo... | Returns the text value of all of the elements in the collection.
@return the text value of all the elements in the collection or null | [
"Returns",
"the",
"text",
"value",
"of",
"all",
"of",
"the",
"elements",
"in",
"the",
"collection",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/groovy/util/NodeList.java#L157-L186 | train |
joestelmach/natty | src/main/java/com/joestelmach/natty/Parser.java | Parser.isAllNumeric | private boolean isAllNumeric(TokenStream stream) {
List<Token> tokens = ((NattyTokenSource) stream.getTokenSource()).getTokens();
for(Token token:tokens) {
try {
Integer.parseInt(token.getText());
} catch(NumberFormatException e) {
return false;
}
}
return true;
} | java | private boolean isAllNumeric(TokenStream stream) {
List<Token> tokens = ((NattyTokenSource) stream.getTokenSource()).getTokens();
for(Token token:tokens) {
try {
Integer.parseInt(token.getText());
} catch(NumberFormatException e) {
return false;
}
}
return true;
} | [
"private",
"boolean",
"isAllNumeric",
"(",
"TokenStream",
"stream",
")",
"{",
"List",
"<",
"Token",
">",
"tokens",
"=",
"(",
"(",
"NattyTokenSource",
")",
"stream",
".",
"getTokenSource",
"(",
")",
")",
".",
"getTokens",
"(",
")",
";",
"for",
"(",
"Token... | Determines if a token stream contains only numeric tokens
@param stream
@return true if all tokens in the given stream can be parsed as an integer | [
"Determines",
"if",
"a",
"token",
"stream",
"contains",
"only",
"numeric",
"tokens"
] | 74389feb4c9372e51cd51eb0800a0177fec3e5a0 | https://github.com/joestelmach/natty/blob/74389feb4c9372e51cd51eb0800a0177fec3e5a0/src/main/java/com/joestelmach/natty/Parser.java#L166-L176 | train |
joestelmach/natty | src/main/java/com/joestelmach/natty/Parser.java | Parser.collectTokenStreams | private List<TokenStream> collectTokenStreams(TokenStream stream) {
// walk through the token stream and build a collection
// of sub token streams that represent possible date locations
List<Token> currentGroup = null;
List<List<Token>> groups = new ArrayList<List<Token>>();
Token currentToke... | java | private List<TokenStream> collectTokenStreams(TokenStream stream) {
// walk through the token stream and build a collection
// of sub token streams that represent possible date locations
List<Token> currentGroup = null;
List<List<Token>> groups = new ArrayList<List<Token>>();
Token currentToke... | [
"private",
"List",
"<",
"TokenStream",
">",
"collectTokenStreams",
"(",
"TokenStream",
"stream",
")",
"{",
"// walk through the token stream and build a collection ",
"// of sub token streams that represent possible date locations",
"List",
"<",
"Token",
">",
"currentGroup",
"=",... | Scans the given token global token stream for a list of sub-token
streams representing those portions of the global stream that
may contain date time information
@param stream
@return | [
"Scans",
"the",
"given",
"token",
"global",
"token",
"stream",
"for",
"a",
"list",
"of",
"sub",
"-",
"token",
"streams",
"representing",
"those",
"portions",
"of",
"the",
"global",
"stream",
"that",
"may",
"contain",
"date",
"time",
"information"
] | 74389feb4c9372e51cd51eb0800a0177fec3e5a0 | https://github.com/joestelmach/natty/blob/74389feb4c9372e51cd51eb0800a0177fec3e5a0/src/main/java/com/joestelmach/natty/Parser.java#L260-L326 | train |
joestelmach/natty | src/main/java/com/joestelmach/natty/Parser.java | Parser.addGroup | private void addGroup(List<Token> group, List<List<Token>> groups) {
if(group.isEmpty()) return;
// remove trailing tokens that should be ignored
while(!group.isEmpty() && IGNORED_TRAILING_TOKENS.contains(
group.get(group.size() - 1).getType())) {
group.remove(group.size() - 1);
}
/... | java | private void addGroup(List<Token> group, List<List<Token>> groups) {
if(group.isEmpty()) return;
// remove trailing tokens that should be ignored
while(!group.isEmpty() && IGNORED_TRAILING_TOKENS.contains(
group.get(group.size() - 1).getType())) {
group.remove(group.size() - 1);
}
/... | [
"private",
"void",
"addGroup",
"(",
"List",
"<",
"Token",
">",
"group",
",",
"List",
"<",
"List",
"<",
"Token",
">",
">",
"groups",
")",
"{",
"if",
"(",
"group",
".",
"isEmpty",
"(",
")",
")",
"return",
";",
"// remove trailing tokens that should be ignore... | Cleans up the given group and adds it to the list of groups if still valid
@param group
@param groups | [
"Cleans",
"up",
"the",
"given",
"group",
"and",
"adds",
"it",
"to",
"the",
"list",
"of",
"groups",
"if",
"still",
"valid"
] | 74389feb4c9372e51cd51eb0800a0177fec3e5a0 | https://github.com/joestelmach/natty/blob/74389feb4c9372e51cd51eb0800a0177fec3e5a0/src/main/java/com/joestelmach/natty/Parser.java#L333-L347 | train |
joestelmach/natty | src/main/java/com/joestelmach/natty/WalkerState.java | WalkerState.seekToDayOfWeek | public void seekToDayOfWeek(String direction, String seekType, String seekAmount, String dayOfWeek) {
int dayOfWeekInt = Integer.parseInt(dayOfWeek);
int seekAmountInt = Integer.parseInt(seekAmount);
assert(direction.equals(DIR_LEFT) || direction.equals(DIR_RIGHT));
assert(seekType.equals(SEEK_BY_DAY) |... | java | public void seekToDayOfWeek(String direction, String seekType, String seekAmount, String dayOfWeek) {
int dayOfWeekInt = Integer.parseInt(dayOfWeek);
int seekAmountInt = Integer.parseInt(seekAmount);
assert(direction.equals(DIR_LEFT) || direction.equals(DIR_RIGHT));
assert(seekType.equals(SEEK_BY_DAY) |... | [
"public",
"void",
"seekToDayOfWeek",
"(",
"String",
"direction",
",",
"String",
"seekType",
",",
"String",
"seekAmount",
",",
"String",
"dayOfWeek",
")",
"{",
"int",
"dayOfWeekInt",
"=",
"Integer",
".",
"parseInt",
"(",
"dayOfWeek",
")",
";",
"int",
"seekAmoun... | seeks to a specified day of the week in the past or future.
@param direction the direction to seek: two possibilities
'<' go backward
'>' go forward
@param seekType the type of seek to perform (by_day or by_week)
by_day means we seek to the very next occurrence of the given day
by_week means we seek to the first occu... | [
"seeks",
"to",
"a",
"specified",
"day",
"of",
"the",
"week",
"in",
"the",
"past",
"or",
"future",
"."
] | 74389feb4c9372e51cd51eb0800a0177fec3e5a0 | https://github.com/joestelmach/natty/blob/74389feb4c9372e51cd51eb0800a0177fec3e5a0/src/main/java/com/joestelmach/natty/WalkerState.java#L80-L108 | train |
joestelmach/natty | src/main/java/com/joestelmach/natty/WalkerState.java | WalkerState.seekToDayOfMonth | public void seekToDayOfMonth(String dayOfMonth) {
int dayOfMonthInt = Integer.parseInt(dayOfMonth);
assert(dayOfMonthInt >= 1 && dayOfMonthInt <= 31);
markDateInvocation();
dayOfMonthInt = Math.min(dayOfMonthInt, _calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
_calendar.set(Calendar.DA... | java | public void seekToDayOfMonth(String dayOfMonth) {
int dayOfMonthInt = Integer.parseInt(dayOfMonth);
assert(dayOfMonthInt >= 1 && dayOfMonthInt <= 31);
markDateInvocation();
dayOfMonthInt = Math.min(dayOfMonthInt, _calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
_calendar.set(Calendar.DA... | [
"public",
"void",
"seekToDayOfMonth",
"(",
"String",
"dayOfMonth",
")",
"{",
"int",
"dayOfMonthInt",
"=",
"Integer",
".",
"parseInt",
"(",
"dayOfMonth",
")",
";",
"assert",
"(",
"dayOfMonthInt",
">=",
"1",
"&&",
"dayOfMonthInt",
"<=",
"31",
")",
";",
"markDa... | Seeks to the given day within the current month
@param dayOfMonth the day of the month to seek to, represented as an integer
from 1 to 31. Must be guaranteed to parse as an Integer. If this day is
beyond the last day of the current month, the actual last day of the month
will be used. | [
"Seeks",
"to",
"the",
"given",
"day",
"within",
"the",
"current",
"month"
] | 74389feb4c9372e51cd51eb0800a0177fec3e5a0 | https://github.com/joestelmach/natty/blob/74389feb4c9372e51cd51eb0800a0177fec3e5a0/src/main/java/com/joestelmach/natty/WalkerState.java#L117-L125 | train |
joestelmach/natty | src/main/java/com/joestelmach/natty/WalkerState.java | WalkerState.seekToDayOfYear | public void seekToDayOfYear(String dayOfYear) {
int dayOfYearInt = Integer.parseInt(dayOfYear);
assert(dayOfYearInt >= 1 && dayOfYearInt <= 366);
markDateInvocation();
dayOfYearInt = Math.min(dayOfYearInt, _calendar.getActualMaximum(Calendar.DAY_OF_YEAR));
_calendar.set(Calendar.DAY_OF_YEA... | java | public void seekToDayOfYear(String dayOfYear) {
int dayOfYearInt = Integer.parseInt(dayOfYear);
assert(dayOfYearInt >= 1 && dayOfYearInt <= 366);
markDateInvocation();
dayOfYearInt = Math.min(dayOfYearInt, _calendar.getActualMaximum(Calendar.DAY_OF_YEAR));
_calendar.set(Calendar.DAY_OF_YEA... | [
"public",
"void",
"seekToDayOfYear",
"(",
"String",
"dayOfYear",
")",
"{",
"int",
"dayOfYearInt",
"=",
"Integer",
".",
"parseInt",
"(",
"dayOfYear",
")",
";",
"assert",
"(",
"dayOfYearInt",
">=",
"1",
"&&",
"dayOfYearInt",
"<=",
"366",
")",
";",
"markDateInv... | Seeks to the given day within the current year
@param dayOfYear the day of the year to seek to, represented as an integer
from 1 to 366. Must be guaranteed to parse as an Integer. If this day is
beyond the last day of the current year, the actual last day of the year
will be used. | [
"Seeks",
"to",
"the",
"given",
"day",
"within",
"the",
"current",
"year"
] | 74389feb4c9372e51cd51eb0800a0177fec3e5a0 | https://github.com/joestelmach/natty/blob/74389feb4c9372e51cd51eb0800a0177fec3e5a0/src/main/java/com/joestelmach/natty/WalkerState.java#L134-L142 | train |
joestelmach/natty | src/main/java/com/joestelmach/natty/WalkerState.java | WalkerState.seekToMonth | public void seekToMonth(String direction, String seekAmount, String month) {
int seekAmountInt = Integer.parseInt(seekAmount);
int monthInt = Integer.parseInt(month);
assert(direction.equals(DIR_LEFT) || direction.equals(DIR_RIGHT));
assert(monthInt >= 1 && monthInt <= 12);
markDateInvocation()... | java | public void seekToMonth(String direction, String seekAmount, String month) {
int seekAmountInt = Integer.parseInt(seekAmount);
int monthInt = Integer.parseInt(month);
assert(direction.equals(DIR_LEFT) || direction.equals(DIR_RIGHT));
assert(monthInt >= 1 && monthInt <= 12);
markDateInvocation()... | [
"public",
"void",
"seekToMonth",
"(",
"String",
"direction",
",",
"String",
"seekAmount",
",",
"String",
"month",
")",
"{",
"int",
"seekAmountInt",
"=",
"Integer",
".",
"parseInt",
"(",
"seekAmount",
")",
";",
"int",
"monthInt",
"=",
"Integer",
".",
"parseIn... | seeks to a particular month
@param direction the direction to seek: two possibilities
'<' go backward
'>' go forward
@param seekAmount the amount to seek. Must be guaranteed to parse as an integer
@param month the month to seek to. Must be guaranteed to parse as an integer
between 1 and 12 | [
"seeks",
"to",
"a",
"particular",
"month"
] | 74389feb4c9372e51cd51eb0800a0177fec3e5a0 | https://github.com/joestelmach/natty/blob/74389feb4c9372e51cd51eb0800a0177fec3e5a0/src/main/java/com/joestelmach/natty/WalkerState.java#L169-L194 | train |
joestelmach/natty | src/main/java/com/joestelmach/natty/WalkerState.java | WalkerState.setExplicitTime | public void setExplicitTime(String hours, String minutes, String seconds, String amPm, String zoneString) {
int hoursInt = Integer.parseInt(hours);
int minutesInt = minutes != null ? Integer.parseInt(minutes) : 0;
assert(amPm == null || amPm.equals(AM) || amPm.equals(PM));
assert(hoursInt >= 0);
ass... | java | public void setExplicitTime(String hours, String minutes, String seconds, String amPm, String zoneString) {
int hoursInt = Integer.parseInt(hours);
int minutesInt = minutes != null ? Integer.parseInt(minutes) : 0;
assert(amPm == null || amPm.equals(AM) || amPm.equals(PM));
assert(hoursInt >= 0);
ass... | [
"public",
"void",
"setExplicitTime",
"(",
"String",
"hours",
",",
"String",
"minutes",
",",
"String",
"seconds",
",",
"String",
"amPm",
",",
"String",
"zoneString",
")",
"{",
"int",
"hoursInt",
"=",
"Integer",
".",
"parseInt",
"(",
"hours",
")",
";",
"int"... | Sets the the time of day
@param hours the hours to set. Must be guaranteed to parse as an
integer between 0 and 23
@param minutes the minutes to set. Must be guaranteed to parse as
an integer between 0 and 59
@param seconds the optional seconds to set. Must be guaranteed to parse as
an integer between 0 and 59
@... | [
"Sets",
"the",
"the",
"time",
"of",
"day"
] | 74389feb4c9372e51cd51eb0800a0177fec3e5a0 | https://github.com/joestelmach/natty/blob/74389feb4c9372e51cd51eb0800a0177fec3e5a0/src/main/java/com/joestelmach/natty/WalkerState.java#L334-L380 | train |
joestelmach/natty | src/main/java/com/joestelmach/natty/WalkerState.java | WalkerState.seekToHoliday | public void seekToHoliday(String holidayString, String direction, String seekAmount) {
Holiday holiday = Holiday.valueOf(holidayString);
assert(holiday != null);
seekToIcsEvent(HOLIDAY_ICS_FILE, holiday.getSummary(), direction, seekAmount);
} | java | public void seekToHoliday(String holidayString, String direction, String seekAmount) {
Holiday holiday = Holiday.valueOf(holidayString);
assert(holiday != null);
seekToIcsEvent(HOLIDAY_ICS_FILE, holiday.getSummary(), direction, seekAmount);
} | [
"public",
"void",
"seekToHoliday",
"(",
"String",
"holidayString",
",",
"String",
"direction",
",",
"String",
"seekAmount",
")",
"{",
"Holiday",
"holiday",
"=",
"Holiday",
".",
"valueOf",
"(",
"holidayString",
")",
";",
"assert",
"(",
"holiday",
"!=",
"null",
... | Seeks forward or backwards to a particular holiday based on the current date
@param holidayString The holiday to seek to
@param direction The direction to seek
@param seekAmount The number of years to seek | [
"Seeks",
"forward",
"or",
"backwards",
"to",
"a",
"particular",
"holiday",
"based",
"on",
"the",
"current",
"date"
] | 74389feb4c9372e51cd51eb0800a0177fec3e5a0 | https://github.com/joestelmach/natty/blob/74389feb4c9372e51cd51eb0800a0177fec3e5a0/src/main/java/com/joestelmach/natty/WalkerState.java#L389-L394 | train |
joestelmach/natty | src/main/java/com/joestelmach/natty/WalkerState.java | WalkerState.seekToHolidayYear | public void seekToHolidayYear(String holidayString, String yearString) {
Holiday holiday = Holiday.valueOf(holidayString);
assert(holiday != null);
seekToIcsEventYear(HOLIDAY_ICS_FILE, yearString, holiday.getSummary());
} | java | public void seekToHolidayYear(String holidayString, String yearString) {
Holiday holiday = Holiday.valueOf(holidayString);
assert(holiday != null);
seekToIcsEventYear(HOLIDAY_ICS_FILE, yearString, holiday.getSummary());
} | [
"public",
"void",
"seekToHolidayYear",
"(",
"String",
"holidayString",
",",
"String",
"yearString",
")",
"{",
"Holiday",
"holiday",
"=",
"Holiday",
".",
"valueOf",
"(",
"holidayString",
")",
";",
"assert",
"(",
"holiday",
"!=",
"null",
")",
";",
"seekToIcsEven... | Seeks to the given holiday within the given year
@param holidayString
@param yearString | [
"Seeks",
"to",
"the",
"given",
"holiday",
"within",
"the",
"given",
"year"
] | 74389feb4c9372e51cd51eb0800a0177fec3e5a0 | https://github.com/joestelmach/natty/blob/74389feb4c9372e51cd51eb0800a0177fec3e5a0/src/main/java/com/joestelmach/natty/WalkerState.java#L402-L407 | train |
joestelmach/natty | src/main/java/com/joestelmach/natty/WalkerState.java | WalkerState.seekToSeason | public void seekToSeason(String seasonString, String direction, String seekAmount) {
Season season = Season.valueOf(seasonString);
assert(season!= null);
seekToIcsEvent(SEASON_ICS_FILE, season.getSummary(), direction, seekAmount);
} | java | public void seekToSeason(String seasonString, String direction, String seekAmount) {
Season season = Season.valueOf(seasonString);
assert(season!= null);
seekToIcsEvent(SEASON_ICS_FILE, season.getSummary(), direction, seekAmount);
} | [
"public",
"void",
"seekToSeason",
"(",
"String",
"seasonString",
",",
"String",
"direction",
",",
"String",
"seekAmount",
")",
"{",
"Season",
"season",
"=",
"Season",
".",
"valueOf",
"(",
"seasonString",
")",
";",
"assert",
"(",
"season",
"!=",
"null",
")",
... | Seeks forward or backwards to a particular season based on the current date
@param seasonString The season to seek to
@param direction The direction to seek
@param seekAmount The number of years to seek | [
"Seeks",
"forward",
"or",
"backwards",
"to",
"a",
"particular",
"season",
"based",
"on",
"the",
"current",
"date"
] | 74389feb4c9372e51cd51eb0800a0177fec3e5a0 | https://github.com/joestelmach/natty/blob/74389feb4c9372e51cd51eb0800a0177fec3e5a0/src/main/java/com/joestelmach/natty/WalkerState.java#L416-L421 | train |
joestelmach/natty | src/main/java/com/joestelmach/natty/WalkerState.java | WalkerState.seekToSeasonYear | public void seekToSeasonYear(String seasonString, String yearString) {
Season season = Season.valueOf(seasonString);
assert(season != null);
seekToIcsEventYear(SEASON_ICS_FILE, yearString, season.getSummary());
} | java | public void seekToSeasonYear(String seasonString, String yearString) {
Season season = Season.valueOf(seasonString);
assert(season != null);
seekToIcsEventYear(SEASON_ICS_FILE, yearString, season.getSummary());
} | [
"public",
"void",
"seekToSeasonYear",
"(",
"String",
"seasonString",
",",
"String",
"yearString",
")",
"{",
"Season",
"season",
"=",
"Season",
".",
"valueOf",
"(",
"seasonString",
")",
";",
"assert",
"(",
"season",
"!=",
"null",
")",
";",
"seekToIcsEventYear",... | Seeks to the given season within the given year
@param seasonString
@param yearString | [
"Seeks",
"to",
"the",
"given",
"season",
"within",
"the",
"given",
"year"
] | 74389feb4c9372e51cd51eb0800a0177fec3e5a0 | https://github.com/joestelmach/natty/blob/74389feb4c9372e51cd51eb0800a0177fec3e5a0/src/main/java/com/joestelmach/natty/WalkerState.java#L429-L434 | train |
joestelmach/natty | src/main/java/com/joestelmach/natty/WalkerState.java | WalkerState.resetCalendar | private void resetCalendar() {
_calendar = getCalendar();
if (_defaultTimeZone != null) {
_calendar.setTimeZone(_defaultTimeZone);
}
_currentYear = _calendar.get(Calendar.YEAR);
} | java | private void resetCalendar() {
_calendar = getCalendar();
if (_defaultTimeZone != null) {
_calendar.setTimeZone(_defaultTimeZone);
}
_currentYear = _calendar.get(Calendar.YEAR);
} | [
"private",
"void",
"resetCalendar",
"(",
")",
"{",
"_calendar",
"=",
"getCalendar",
"(",
")",
";",
"if",
"(",
"_defaultTimeZone",
"!=",
"null",
")",
"{",
"_calendar",
".",
"setTimeZone",
"(",
"_defaultTimeZone",
")",
";",
"}",
"_currentYear",
"=",
"_calendar... | Resets the calendar | [
"Resets",
"the",
"calendar"
] | 74389feb4c9372e51cd51eb0800a0177fec3e5a0 | https://github.com/joestelmach/natty/blob/74389feb4c9372e51cd51eb0800a0177fec3e5a0/src/main/java/com/joestelmach/natty/WalkerState.java#L543-L549 | train |
joestelmach/natty | src/main/java/com/joestelmach/natty/WalkerState.java | WalkerState.seasonalDateFromIcs | private Date seasonalDateFromIcs(String icsFileName, String eventSummary, int year) {
Map<Integer, Date> dates = getDatesFromIcs(icsFileName, eventSummary, year, year);
return dates.get(year - (eventSummary.equals(Holiday.NEW_YEARS_EVE.getSummary()) ? 1 : 0));
} | java | private Date seasonalDateFromIcs(String icsFileName, String eventSummary, int year) {
Map<Integer, Date> dates = getDatesFromIcs(icsFileName, eventSummary, year, year);
return dates.get(year - (eventSummary.equals(Holiday.NEW_YEARS_EVE.getSummary()) ? 1 : 0));
} | [
"private",
"Date",
"seasonalDateFromIcs",
"(",
"String",
"icsFileName",
",",
"String",
"eventSummary",
",",
"int",
"year",
")",
"{",
"Map",
"<",
"Integer",
",",
"Date",
">",
"dates",
"=",
"getDatesFromIcs",
"(",
"icsFileName",
",",
"eventSummary",
",",
"year",... | Finds and returns the date for the given event summary and year within the given ics file,
or null if not present. | [
"Finds",
"and",
"returns",
"the",
"date",
"for",
"the",
"given",
"event",
"summary",
"and",
"year",
"within",
"the",
"given",
"ics",
"file",
"or",
"null",
"if",
"not",
"present",
"."
] | 74389feb4c9372e51cd51eb0800a0177fec3e5a0 | https://github.com/joestelmach/natty/blob/74389feb4c9372e51cd51eb0800a0177fec3e5a0/src/main/java/com/joestelmach/natty/WalkerState.java#L619-L622 | train |
joestelmach/natty | src/main/java/com/joestelmach/natty/WalkerState.java | WalkerState.markDateInvocation | private void markDateInvocation() {
_updatePreviousDates = !_dateGivenInGroup;
_dateGivenInGroup = true;
_dateGroup.setDateInferred(false);
if(_firstDateInvocationInGroup) {
// if a time has been given within the current date group,
// we capture the current time before resetting the cale... | java | private void markDateInvocation() {
_updatePreviousDates = !_dateGivenInGroup;
_dateGivenInGroup = true;
_dateGroup.setDateInferred(false);
if(_firstDateInvocationInGroup) {
// if a time has been given within the current date group,
// we capture the current time before resetting the cale... | [
"private",
"void",
"markDateInvocation",
"(",
")",
"{",
"_updatePreviousDates",
"=",
"!",
"_dateGivenInGroup",
";",
"_dateGivenInGroup",
"=",
"true",
";",
"_dateGroup",
".",
"setDateInferred",
"(",
"false",
")",
";",
"if",
"(",
"_firstDateInvocationInGroup",
")",
... | ensures that the first invocation of a date seeking
rule is captured | [
"ensures",
"that",
"the",
"first",
"invocation",
"of",
"a",
"date",
"seeking",
"rule",
"is",
"captured"
] | 74389feb4c9372e51cd51eb0800a0177fec3e5a0 | https://github.com/joestelmach/natty/blob/74389feb4c9372e51cd51eb0800a0177fec3e5a0/src/main/java/com/joestelmach/natty/WalkerState.java#L628-L651 | train |
sstrickx/yahoofinance-api | src/main/java/yahoofinance/histquotes/HistQuotesRequest.java | HistQuotesRequest.cleanHistCalendar | private Calendar cleanHistCalendar(Calendar cal) {
cal.set(Calendar.MILLISECOND, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.HOUR, 0);
return cal;
} | java | private Calendar cleanHistCalendar(Calendar cal) {
cal.set(Calendar.MILLISECOND, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.HOUR, 0);
return cal;
} | [
"private",
"Calendar",
"cleanHistCalendar",
"(",
"Calendar",
"cal",
")",
"{",
"cal",
".",
"set",
"(",
"Calendar",
".",
"MILLISECOND",
",",
"0",
")",
";",
"cal",
".",
"set",
"(",
"Calendar",
".",
"SECOND",
",",
"0",
")",
";",
"cal",
".",
"set",
"(",
... | Put everything smaller than days at 0
@param cal calendar to be cleaned | [
"Put",
"everything",
"smaller",
"than",
"days",
"at",
"0"
] | 2766ba52fc5cccf9b4da5c06423d68059cf0a6e6 | https://github.com/sstrickx/yahoofinance-api/blob/2766ba52fc5cccf9b4da5c06423d68059cf0a6e6/src/main/java/yahoofinance/histquotes/HistQuotesRequest.java#L79-L85 | train |
sstrickx/yahoofinance-api | src/main/java/yahoofinance/Utils.java | Utils.parseDividendDate | public static Calendar parseDividendDate(String date) {
if (!Utils.isParseable(date)) {
return null;
}
date = date.trim();
SimpleDateFormat format = new SimpleDateFormat(Utils.getDividendDateFormat(date), Locale.US);
format.setTimeZone(TimeZone.getTimeZone(YahooFinanc... | java | public static Calendar parseDividendDate(String date) {
if (!Utils.isParseable(date)) {
return null;
}
date = date.trim();
SimpleDateFormat format = new SimpleDateFormat(Utils.getDividendDateFormat(date), Locale.US);
format.setTimeZone(TimeZone.getTimeZone(YahooFinanc... | [
"public",
"static",
"Calendar",
"parseDividendDate",
"(",
"String",
"date",
")",
"{",
"if",
"(",
"!",
"Utils",
".",
"isParseable",
"(",
"date",
")",
")",
"{",
"return",
"null",
";",
"}",
"date",
"=",
"date",
".",
"trim",
"(",
")",
";",
"SimpleDateForma... | Used to parse the dividend dates. Returns null if the date cannot be
parsed.
@param date String received that represents the date
@return Calendar object representing the parsed date | [
"Used",
"to",
"parse",
"the",
"dividend",
"dates",
".",
"Returns",
"null",
"if",
"the",
"date",
"cannot",
"be",
"parsed",
"."
] | 2766ba52fc5cccf9b4da5c06423d68059cf0a6e6 | https://github.com/sstrickx/yahoofinance-api/blob/2766ba52fc5cccf9b4da5c06423d68059cf0a6e6/src/main/java/yahoofinance/Utils.java#L194-L224 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.