id
int32 0
165k
| 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
|
|---|---|---|---|---|---|---|---|---|---|---|---|
12,700
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.minus
|
public static <T> SortedSet<T> minus(SortedSet<T> self, Object removeMe) {
return (SortedSet<T>) minus((Set<T>) self, removeMe);
}
|
java
|
public static <T> SortedSet<T> minus(SortedSet<T> self, Object removeMe) {
return (SortedSet<T>) minus((Set<T>) self, removeMe);
}
|
[
"public",
"static",
"<",
"T",
">",
"SortedSet",
"<",
"T",
">",
"minus",
"(",
"SortedSet",
"<",
"T",
">",
"self",
",",
"Object",
"removeMe",
")",
"{",
"return",
"(",
"SortedSet",
"<",
"T",
">",
")",
"minus",
"(",
"(",
"Set",
"<",
"T",
">",
")",
"self",
",",
"removeMe",
")",
";",
"}"
] |
Create a SortedSet composed of the elements of the first SortedSet minus the given element.
@param self a SortedSet object
@param removeMe the element to remove from the SortedSet
@return the resulting SortedSet
@since 2.4.0
|
[
"Create",
"a",
"SortedSet",
"composed",
"of",
"the",
"elements",
"of",
"the",
"first",
"SortedSet",
"minus",
"the",
"given",
"element",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L12979-L12981
|
12,701
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.minus
|
@SuppressWarnings("unchecked")
public static <T> T[] minus(T[] self, Iterable removeMe) {
return (T[]) minus(toList(self), removeMe).toArray();
}
|
java
|
@SuppressWarnings("unchecked")
public static <T> T[] minus(T[] self, Iterable removeMe) {
return (T[]) minus(toList(self), removeMe).toArray();
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"minus",
"(",
"T",
"[",
"]",
"self",
",",
"Iterable",
"removeMe",
")",
"{",
"return",
"(",
"T",
"[",
"]",
")",
"minus",
"(",
"toList",
"(",
"self",
")",
",",
"removeMe",
")",
".",
"toArray",
"(",
")",
";",
"}"
] |
Create an array composed of the elements of the first array minus the
elements of the given Iterable.
@param self an array
@param removeMe a Collection of elements to remove
@return an array with the supplied elements removed
@since 1.5.5
|
[
"Create",
"an",
"array",
"composed",
"of",
"the",
"elements",
"of",
"the",
"first",
"array",
"minus",
"the",
"elements",
"of",
"the",
"given",
"Iterable",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L12992-L12995
|
12,702
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.leftShift
|
public static <K, V> Map<K, V> leftShift(Map<K, V> self, Map.Entry<K, V> entry) {
self.put(entry.getKey(), entry.getValue());
return self;
}
|
java
|
public static <K, V> Map<K, V> leftShift(Map<K, V> self, Map.Entry<K, V> entry) {
self.put(entry.getKey(), entry.getValue());
return self;
}
|
[
"public",
"static",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"K",
",",
"V",
">",
"leftShift",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"self",
",",
"Map",
".",
"Entry",
"<",
"K",
",",
"V",
">",
"entry",
")",
"{",
"self",
".",
"put",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"return",
"self",
";",
"}"
] |
Overloads the left shift operator to provide an easy way to append
Map.Entry values to a Map.
@param self a Map
@param entry a Map.Entry to be added to the Map.
@return same map, after the value has been added to it.
@since 1.6.0
|
[
"Overloads",
"the",
"left",
"shift",
"operator",
"to",
"provide",
"an",
"easy",
"way",
"to",
"append",
"Map",
".",
"Entry",
"values",
"to",
"a",
"Map",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13535-L13538
|
12,703
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.leftShift
|
public static Number leftShift(Number self, Number operand) {
return NumberMath.leftShift(self, operand);
}
|
java
|
public static Number leftShift(Number self, Number operand) {
return NumberMath.leftShift(self, operand);
}
|
[
"public",
"static",
"Number",
"leftShift",
"(",
"Number",
"self",
",",
"Number",
"operand",
")",
"{",
"return",
"NumberMath",
".",
"leftShift",
"(",
"self",
",",
"operand",
")",
";",
"}"
] |
Implementation of the left shift operator for integral types. Non integral
Number types throw UnsupportedOperationException.
@param self a Number object
@param operand the shift distance by which to left shift the number
@return the resulting number
@since 1.5.0
|
[
"Implementation",
"of",
"the",
"left",
"shift",
"operator",
"for",
"integral",
"types",
".",
"Non",
"integral",
"Number",
"types",
"throw",
"UnsupportedOperationException",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13569-L13571
|
12,704
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.rightShift
|
public static Number rightShift(Number self, Number operand) {
return NumberMath.rightShift(self, operand);
}
|
java
|
public static Number rightShift(Number self, Number operand) {
return NumberMath.rightShift(self, operand);
}
|
[
"public",
"static",
"Number",
"rightShift",
"(",
"Number",
"self",
",",
"Number",
"operand",
")",
"{",
"return",
"NumberMath",
".",
"rightShift",
"(",
"self",
",",
"operand",
")",
";",
"}"
] |
Implementation of the right shift operator for integral types. Non integral
Number types throw UnsupportedOperationException.
@param self a Number object
@param operand the shift distance by which to right shift the number
@return the resulting number
@since 1.5.0
|
[
"Implementation",
"of",
"the",
"right",
"shift",
"operator",
"for",
"integral",
"types",
".",
"Non",
"integral",
"Number",
"types",
"throw",
"UnsupportedOperationException",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13582-L13584
|
12,705
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.getAt
|
@SuppressWarnings("unchecked")
public static List<Byte> getAt(byte[] array, Range range) {
return primitiveArrayGet(array, range);
}
|
java
|
@SuppressWarnings("unchecked")
public static List<Byte> getAt(byte[] array, Range range) {
return primitiveArrayGet(array, range);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Byte",
">",
"getAt",
"(",
"byte",
"[",
"]",
"array",
",",
"Range",
"range",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"range",
")",
";",
"}"
] |
Support the subscript operator with a range for a byte array
@param array a byte array
@param range a range indicating the indices for the items to retrieve
@return list of the retrieved bytes
@since 1.0
|
[
"Support",
"the",
"subscript",
"operator",
"with",
"a",
"range",
"for",
"a",
"byte",
"array"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13610-L13613
|
12,706
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.getAt
|
@SuppressWarnings("unchecked")
public static List<Character> getAt(char[] array, Range range) {
return primitiveArrayGet(array, range);
}
|
java
|
@SuppressWarnings("unchecked")
public static List<Character> getAt(char[] array, Range range) {
return primitiveArrayGet(array, range);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Character",
">",
"getAt",
"(",
"char",
"[",
"]",
"array",
",",
"Range",
"range",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"range",
")",
";",
"}"
] |
Support the subscript operator with a range for a char array
@param array a char array
@param range a range indicating the indices for the items to retrieve
@return list of the retrieved chars
@since 1.5.0
|
[
"Support",
"the",
"subscript",
"operator",
"with",
"a",
"range",
"for",
"a",
"char",
"array"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13623-L13626
|
12,707
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.getAt
|
@SuppressWarnings("unchecked")
public static List<Short> getAt(short[] array, Range range) {
return primitiveArrayGet(array, range);
}
|
java
|
@SuppressWarnings("unchecked")
public static List<Short> getAt(short[] array, Range range) {
return primitiveArrayGet(array, range);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Short",
">",
"getAt",
"(",
"short",
"[",
"]",
"array",
",",
"Range",
"range",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"range",
")",
";",
"}"
] |
Support the subscript operator with a range for a short array
@param array a short array
@param range a range indicating the indices for the items to retrieve
@return list of the retrieved shorts
@since 1.0
|
[
"Support",
"the",
"subscript",
"operator",
"with",
"a",
"range",
"for",
"a",
"short",
"array"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13636-L13639
|
12,708
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.getAt
|
@SuppressWarnings("unchecked")
public static List<Integer> getAt(int[] array, Range range) {
return primitiveArrayGet(array, range);
}
|
java
|
@SuppressWarnings("unchecked")
public static List<Integer> getAt(int[] array, Range range) {
return primitiveArrayGet(array, range);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Integer",
">",
"getAt",
"(",
"int",
"[",
"]",
"array",
",",
"Range",
"range",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"range",
")",
";",
"}"
] |
Support the subscript operator with a range for an int array
@param array an int array
@param range a range indicating the indices for the items to retrieve
@return list of the ints at the given indices
@since 1.0
|
[
"Support",
"the",
"subscript",
"operator",
"with",
"a",
"range",
"for",
"an",
"int",
"array"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13649-L13652
|
12,709
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.getAt
|
@SuppressWarnings("unchecked")
public static List<Long> getAt(long[] array, Range range) {
return primitiveArrayGet(array, range);
}
|
java
|
@SuppressWarnings("unchecked")
public static List<Long> getAt(long[] array, Range range) {
return primitiveArrayGet(array, range);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Long",
">",
"getAt",
"(",
"long",
"[",
"]",
"array",
",",
"Range",
"range",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"range",
")",
";",
"}"
] |
Support the subscript operator with a range for a long array
@param array a long array
@param range a range indicating the indices for the items to retrieve
@return list of the retrieved longs
@since 1.0
|
[
"Support",
"the",
"subscript",
"operator",
"with",
"a",
"range",
"for",
"a",
"long",
"array"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13662-L13665
|
12,710
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.getAt
|
@SuppressWarnings("unchecked")
public static List<Float> getAt(float[] array, Range range) {
return primitiveArrayGet(array, range);
}
|
java
|
@SuppressWarnings("unchecked")
public static List<Float> getAt(float[] array, Range range) {
return primitiveArrayGet(array, range);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Float",
">",
"getAt",
"(",
"float",
"[",
"]",
"array",
",",
"Range",
"range",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"range",
")",
";",
"}"
] |
Support the subscript operator with a range for a float array
@param array a float array
@param range a range indicating the indices for the items to retrieve
@return list of the retrieved floats
@since 1.0
|
[
"Support",
"the",
"subscript",
"operator",
"with",
"a",
"range",
"for",
"a",
"float",
"array"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13675-L13678
|
12,711
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.getAt
|
@SuppressWarnings("unchecked")
public static List<Double> getAt(double[] array, Range range) {
return primitiveArrayGet(array, range);
}
|
java
|
@SuppressWarnings("unchecked")
public static List<Double> getAt(double[] array, Range range) {
return primitiveArrayGet(array, range);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Double",
">",
"getAt",
"(",
"double",
"[",
"]",
"array",
",",
"Range",
"range",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"range",
")",
";",
"}"
] |
Support the subscript operator with a range for a double array
@param array a double array
@param range a range indicating the indices for the items to retrieve
@return list of the retrieved doubles
@since 1.0
|
[
"Support",
"the",
"subscript",
"operator",
"with",
"a",
"range",
"for",
"a",
"double",
"array"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13688-L13691
|
12,712
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.getAt
|
@SuppressWarnings("unchecked")
public static List<Boolean> getAt(boolean[] array, Range range) {
return primitiveArrayGet(array, range);
}
|
java
|
@SuppressWarnings("unchecked")
public static List<Boolean> getAt(boolean[] array, Range range) {
return primitiveArrayGet(array, range);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Boolean",
">",
"getAt",
"(",
"boolean",
"[",
"]",
"array",
",",
"Range",
"range",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"range",
")",
";",
"}"
] |
Support the subscript operator with a range for a boolean array
@param array a boolean array
@param range a range indicating the indices for the items to retrieve
@return list of the retrieved booleans
@since 1.0
|
[
"Support",
"the",
"subscript",
"operator",
"with",
"a",
"range",
"for",
"a",
"boolean",
"array"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13701-L13704
|
12,713
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.getAt
|
@SuppressWarnings("unchecked")
public static List<Long> getAt(long[] array, IntRange range) {
RangeInfo info = subListBorders(array.length, range);
List<Long> answer = primitiveArrayGet(array, new IntRange(true, info.from, info.to - 1));
return info.reverse ? reverse(answer) : answer;
}
|
java
|
@SuppressWarnings("unchecked")
public static List<Long> getAt(long[] array, IntRange range) {
RangeInfo info = subListBorders(array.length, range);
List<Long> answer = primitiveArrayGet(array, new IntRange(true, info.from, info.to - 1));
return info.reverse ? reverse(answer) : answer;
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Long",
">",
"getAt",
"(",
"long",
"[",
"]",
"array",
",",
"IntRange",
"range",
")",
"{",
"RangeInfo",
"info",
"=",
"subListBorders",
"(",
"array",
".",
"length",
",",
"range",
")",
";",
"List",
"<",
"Long",
">",
"answer",
"=",
"primitiveArrayGet",
"(",
"array",
",",
"new",
"IntRange",
"(",
"true",
",",
"info",
".",
"from",
",",
"info",
".",
"to",
"-",
"1",
")",
")",
";",
"return",
"info",
".",
"reverse",
"?",
"reverse",
"(",
"answer",
")",
":",
"answer",
";",
"}"
] |
Support the subscript operator with an IntRange for a long array
@param array a long array
@param range an IntRange indicating the indices for the items to retrieve
@return list of the retrieved longs
@since 1.0
|
[
"Support",
"the",
"subscript",
"operator",
"with",
"an",
"IntRange",
"for",
"a",
"long",
"array"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13774-L13779
|
12,714
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.getAt
|
@SuppressWarnings("unchecked")
public static List<Character> getAt(char[] array, ObjectRange range) {
return primitiveArrayGet(array, range);
}
|
java
|
@SuppressWarnings("unchecked")
public static List<Character> getAt(char[] array, ObjectRange range) {
return primitiveArrayGet(array, range);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Character",
">",
"getAt",
"(",
"char",
"[",
"]",
"array",
",",
"ObjectRange",
"range",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"range",
")",
";",
"}"
] |
Support the subscript operator with an ObjectRange for a char array
@param array a char array
@param range an ObjectRange indicating the indices for the items to retrieve
@return list of the retrieved chars
@since 1.0
|
[
"Support",
"the",
"subscript",
"operator",
"with",
"an",
"ObjectRange",
"for",
"a",
"char",
"array"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13847-L13850
|
12,715
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.getAt
|
@SuppressWarnings("unchecked")
public static List<Short> getAt(short[] array, ObjectRange range) {
return primitiveArrayGet(array, range);
}
|
java
|
@SuppressWarnings("unchecked")
public static List<Short> getAt(short[] array, ObjectRange range) {
return primitiveArrayGet(array, range);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Short",
">",
"getAt",
"(",
"short",
"[",
"]",
"array",
",",
"ObjectRange",
"range",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"range",
")",
";",
"}"
] |
Support the subscript operator with an ObjectRange for a short array
@param array a short array
@param range an ObjectRange indicating the indices for the items to retrieve
@return list of the retrieved shorts
@since 1.0
|
[
"Support",
"the",
"subscript",
"operator",
"with",
"an",
"ObjectRange",
"for",
"a",
"short",
"array"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13860-L13863
|
12,716
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.getAt
|
@SuppressWarnings("unchecked")
public static List<Integer> getAt(int[] array, ObjectRange range) {
return primitiveArrayGet(array, range);
}
|
java
|
@SuppressWarnings("unchecked")
public static List<Integer> getAt(int[] array, ObjectRange range) {
return primitiveArrayGet(array, range);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Integer",
">",
"getAt",
"(",
"int",
"[",
"]",
"array",
",",
"ObjectRange",
"range",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"range",
")",
";",
"}"
] |
Support the subscript operator with an ObjectRange for an int array
@param array an int array
@param range an ObjectRange indicating the indices for the items to retrieve
@return list of the retrieved ints
@since 1.0
|
[
"Support",
"the",
"subscript",
"operator",
"with",
"an",
"ObjectRange",
"for",
"an",
"int",
"array"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13873-L13876
|
12,717
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.getAt
|
@SuppressWarnings("unchecked")
public static List<Long> getAt(long[] array, ObjectRange range) {
return primitiveArrayGet(array, range);
}
|
java
|
@SuppressWarnings("unchecked")
public static List<Long> getAt(long[] array, ObjectRange range) {
return primitiveArrayGet(array, range);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Long",
">",
"getAt",
"(",
"long",
"[",
"]",
"array",
",",
"ObjectRange",
"range",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"range",
")",
";",
"}"
] |
Support the subscript operator with an ObjectRange for a long array
@param array a long array
@param range an ObjectRange indicating the indices for the items to retrieve
@return list of the retrieved longs
@since 1.0
|
[
"Support",
"the",
"subscript",
"operator",
"with",
"an",
"ObjectRange",
"for",
"a",
"long",
"array"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13886-L13889
|
12,718
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.getAt
|
@SuppressWarnings("unchecked")
public static List<Float> getAt(float[] array, ObjectRange range) {
return primitiveArrayGet(array, range);
}
|
java
|
@SuppressWarnings("unchecked")
public static List<Float> getAt(float[] array, ObjectRange range) {
return primitiveArrayGet(array, range);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Float",
">",
"getAt",
"(",
"float",
"[",
"]",
"array",
",",
"ObjectRange",
"range",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"range",
")",
";",
"}"
] |
Support the subscript operator with an ObjectRange for a float array
@param array a float array
@param range an ObjectRange indicating the indices for the items to retrieve
@return list of the retrieved floats
@since 1.0
|
[
"Support",
"the",
"subscript",
"operator",
"with",
"an",
"ObjectRange",
"for",
"a",
"float",
"array"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13899-L13902
|
12,719
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.getAt
|
@SuppressWarnings("unchecked")
public static List<Double> getAt(double[] array, ObjectRange range) {
return primitiveArrayGet(array, range);
}
|
java
|
@SuppressWarnings("unchecked")
public static List<Double> getAt(double[] array, ObjectRange range) {
return primitiveArrayGet(array, range);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Double",
">",
"getAt",
"(",
"double",
"[",
"]",
"array",
",",
"ObjectRange",
"range",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"range",
")",
";",
"}"
] |
Support the subscript operator with an ObjectRange for a double array
@param array a double array
@param range an ObjectRange indicating the indices for the items to retrieve
@return list of the retrieved doubles
@since 1.0
|
[
"Support",
"the",
"subscript",
"operator",
"with",
"an",
"ObjectRange",
"for",
"a",
"double",
"array"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13912-L13915
|
12,720
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.getAt
|
@SuppressWarnings("unchecked")
public static List<Byte> getAt(byte[] array, Collection indices) {
return primitiveArrayGet(array, indices);
}
|
java
|
@SuppressWarnings("unchecked")
public static List<Byte> getAt(byte[] array, Collection indices) {
return primitiveArrayGet(array, indices);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Byte",
">",
"getAt",
"(",
"byte",
"[",
"]",
"array",
",",
"Collection",
"indices",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"indices",
")",
";",
"}"
] |
Support the subscript operator with a collection for a byte array
@param array a byte array
@param indices a collection of indices for the items to retrieve
@return list of the bytes at the given indices
@since 1.0
|
[
"Support",
"the",
"subscript",
"operator",
"with",
"a",
"collection",
"for",
"a",
"byte",
"array"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13938-L13941
|
12,721
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.getAt
|
@SuppressWarnings("unchecked")
public static List<Character> getAt(char[] array, Collection indices) {
return primitiveArrayGet(array, indices);
}
|
java
|
@SuppressWarnings("unchecked")
public static List<Character> getAt(char[] array, Collection indices) {
return primitiveArrayGet(array, indices);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Character",
">",
"getAt",
"(",
"char",
"[",
"]",
"array",
",",
"Collection",
"indices",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"indices",
")",
";",
"}"
] |
Support the subscript operator with a collection for a char array
@param array a char array
@param indices a collection of indices for the items to retrieve
@return list of the chars at the given indices
@since 1.0
|
[
"Support",
"the",
"subscript",
"operator",
"with",
"a",
"collection",
"for",
"a",
"char",
"array"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13951-L13954
|
12,722
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.getAt
|
@SuppressWarnings("unchecked")
public static List<Short> getAt(short[] array, Collection indices) {
return primitiveArrayGet(array, indices);
}
|
java
|
@SuppressWarnings("unchecked")
public static List<Short> getAt(short[] array, Collection indices) {
return primitiveArrayGet(array, indices);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Short",
">",
"getAt",
"(",
"short",
"[",
"]",
"array",
",",
"Collection",
"indices",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"indices",
")",
";",
"}"
] |
Support the subscript operator with a collection for a short array
@param array a short array
@param indices a collection of indices for the items to retrieve
@return list of the shorts at the given indices
@since 1.0
|
[
"Support",
"the",
"subscript",
"operator",
"with",
"a",
"collection",
"for",
"a",
"short",
"array"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13964-L13967
|
12,723
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.getAt
|
@SuppressWarnings("unchecked")
public static List<Integer> getAt(int[] array, Collection indices) {
return primitiveArrayGet(array, indices);
}
|
java
|
@SuppressWarnings("unchecked")
public static List<Integer> getAt(int[] array, Collection indices) {
return primitiveArrayGet(array, indices);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Integer",
">",
"getAt",
"(",
"int",
"[",
"]",
"array",
",",
"Collection",
"indices",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"indices",
")",
";",
"}"
] |
Support the subscript operator with a collection for an int array
@param array an int array
@param indices a collection of indices for the items to retrieve
@return list of the ints at the given indices
@since 1.0
|
[
"Support",
"the",
"subscript",
"operator",
"with",
"a",
"collection",
"for",
"an",
"int",
"array"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13977-L13980
|
12,724
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.getAt
|
@SuppressWarnings("unchecked")
public static List<Long> getAt(long[] array, Collection indices) {
return primitiveArrayGet(array, indices);
}
|
java
|
@SuppressWarnings("unchecked")
public static List<Long> getAt(long[] array, Collection indices) {
return primitiveArrayGet(array, indices);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Long",
">",
"getAt",
"(",
"long",
"[",
"]",
"array",
",",
"Collection",
"indices",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"indices",
")",
";",
"}"
] |
Support the subscript operator with a collection for a long array
@param array a long array
@param indices a collection of indices for the items to retrieve
@return list of the longs at the given indices
@since 1.0
|
[
"Support",
"the",
"subscript",
"operator",
"with",
"a",
"collection",
"for",
"a",
"long",
"array"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13990-L13993
|
12,725
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.getAt
|
@SuppressWarnings("unchecked")
public static List<Float> getAt(float[] array, Collection indices) {
return primitiveArrayGet(array, indices);
}
|
java
|
@SuppressWarnings("unchecked")
public static List<Float> getAt(float[] array, Collection indices) {
return primitiveArrayGet(array, indices);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Float",
">",
"getAt",
"(",
"float",
"[",
"]",
"array",
",",
"Collection",
"indices",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"indices",
")",
";",
"}"
] |
Support the subscript operator with a collection for a float array
@param array a float array
@param indices a collection of indices for the items to retrieve
@return list of the floats at the given indices
@since 1.0
|
[
"Support",
"the",
"subscript",
"operator",
"with",
"a",
"collection",
"for",
"a",
"float",
"array"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L14003-L14006
|
12,726
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.getAt
|
@SuppressWarnings("unchecked")
public static List<Double> getAt(double[] array, Collection indices) {
return primitiveArrayGet(array, indices);
}
|
java
|
@SuppressWarnings("unchecked")
public static List<Double> getAt(double[] array, Collection indices) {
return primitiveArrayGet(array, indices);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Double",
">",
"getAt",
"(",
"double",
"[",
"]",
"array",
",",
"Collection",
"indices",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"indices",
")",
";",
"}"
] |
Support the subscript operator with a collection for a double array
@param array a double array
@param indices a collection of indices for the items to retrieve
@return list of the doubles at the given indices
@since 1.0
|
[
"Support",
"the",
"subscript",
"operator",
"with",
"a",
"collection",
"for",
"a",
"double",
"array"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L14016-L14019
|
12,727
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.getAt
|
@SuppressWarnings("unchecked")
public static List<Boolean> getAt(boolean[] array, Collection indices) {
return primitiveArrayGet(array, indices);
}
|
java
|
@SuppressWarnings("unchecked")
public static List<Boolean> getAt(boolean[] array, Collection indices) {
return primitiveArrayGet(array, indices);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Boolean",
">",
"getAt",
"(",
"boolean",
"[",
"]",
"array",
",",
"Collection",
"indices",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"indices",
")",
";",
"}"
] |
Support the subscript operator with a collection for a boolean array
@param array a boolean array
@param indices a collection of indices for the items to retrieve
@return list of the booleans at the given indices
@since 1.0
|
[
"Support",
"the",
"subscript",
"operator",
"with",
"a",
"collection",
"for",
"a",
"boolean",
"array"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L14029-L14032
|
12,728
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.getAt
|
public static boolean getAt(BitSet self, int index) {
int i = normaliseIndex(index, self.length());
return self.get(i);
}
|
java
|
public static boolean getAt(BitSet self, int index) {
int i = normaliseIndex(index, self.length());
return self.get(i);
}
|
[
"public",
"static",
"boolean",
"getAt",
"(",
"BitSet",
"self",
",",
"int",
"index",
")",
"{",
"int",
"i",
"=",
"normaliseIndex",
"(",
"index",
",",
"self",
".",
"length",
"(",
")",
")",
";",
"return",
"self",
".",
"get",
"(",
"i",
")",
";",
"}"
] |
Support the subscript operator for a Bitset
@param self a BitSet
@param index index to retrieve
@return value of the bit at the given index
@see java.util.BitSet
@since 1.5.0
|
[
"Support",
"the",
"subscript",
"operator",
"for",
"a",
"Bitset"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L14043-L14046
|
12,729
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.getAt
|
public static BitSet getAt(BitSet self, IntRange range) {
RangeInfo info = subListBorders(self.length(), range);
BitSet result = new BitSet();
int numberOfBits = info.to - info.from;
int adjuster = 1;
int offset = info.from;
if (info.reverse) {
adjuster = -1;
offset = info.to - 1;
}
for (int i = 0; i < numberOfBits; i++) {
result.set(i, self.get(offset + (adjuster * i)));
}
return result;
}
|
java
|
public static BitSet getAt(BitSet self, IntRange range) {
RangeInfo info = subListBorders(self.length(), range);
BitSet result = new BitSet();
int numberOfBits = info.to - info.from;
int adjuster = 1;
int offset = info.from;
if (info.reverse) {
adjuster = -1;
offset = info.to - 1;
}
for (int i = 0; i < numberOfBits; i++) {
result.set(i, self.get(offset + (adjuster * i)));
}
return result;
}
|
[
"public",
"static",
"BitSet",
"getAt",
"(",
"BitSet",
"self",
",",
"IntRange",
"range",
")",
"{",
"RangeInfo",
"info",
"=",
"subListBorders",
"(",
"self",
".",
"length",
"(",
")",
",",
"range",
")",
";",
"BitSet",
"result",
"=",
"new",
"BitSet",
"(",
")",
";",
"int",
"numberOfBits",
"=",
"info",
".",
"to",
"-",
"info",
".",
"from",
";",
"int",
"adjuster",
"=",
"1",
";",
"int",
"offset",
"=",
"info",
".",
"from",
";",
"if",
"(",
"info",
".",
"reverse",
")",
"{",
"adjuster",
"=",
"-",
"1",
";",
"offset",
"=",
"info",
".",
"to",
"-",
"1",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numberOfBits",
";",
"i",
"++",
")",
"{",
"result",
".",
"set",
"(",
"i",
",",
"self",
".",
"get",
"(",
"offset",
"+",
"(",
"adjuster",
"*",
"i",
")",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Support retrieving a subset of a BitSet using a Range
@param self a BitSet
@param range a Range defining the desired subset
@return a new BitSet that represents the requested subset
@see java.util.BitSet
@see groovy.lang.IntRange
@since 1.5.0
|
[
"Support",
"retrieving",
"a",
"subset",
"of",
"a",
"BitSet",
"using",
"a",
"Range"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L14058-L14076
|
12,730
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.putAt
|
public static void putAt(BitSet self, IntRange range, boolean value) {
RangeInfo info = subListBorders(self.length(), range);
self.set(info.from, info.to, value);
}
|
java
|
public static void putAt(BitSet self, IntRange range, boolean value) {
RangeInfo info = subListBorders(self.length(), range);
self.set(info.from, info.to, value);
}
|
[
"public",
"static",
"void",
"putAt",
"(",
"BitSet",
"self",
",",
"IntRange",
"range",
",",
"boolean",
"value",
")",
"{",
"RangeInfo",
"info",
"=",
"subListBorders",
"(",
"self",
".",
"length",
"(",
")",
",",
"range",
")",
";",
"self",
".",
"set",
"(",
"info",
".",
"from",
",",
"info",
".",
"to",
",",
"value",
")",
";",
"}"
] |
Support assigning a range of values with a single assignment statement.
@param self a BitSet
@param range the range of values to set
@param value value
@see java.util.BitSet
@see groovy.lang.Range
@since 1.5.0
|
[
"Support",
"assigning",
"a",
"range",
"of",
"values",
"with",
"a",
"single",
"assignment",
"statement",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L14151-L14154
|
12,731
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.toSet
|
public static <T> Set<T> toSet(Iterator<T> self) {
Set<T> answer = new HashSet<T>();
while (self.hasNext()) {
answer.add(self.next());
}
return answer;
}
|
java
|
public static <T> Set<T> toSet(Iterator<T> self) {
Set<T> answer = new HashSet<T>();
while (self.hasNext()) {
answer.add(self.next());
}
return answer;
}
|
[
"public",
"static",
"<",
"T",
">",
"Set",
"<",
"T",
">",
"toSet",
"(",
"Iterator",
"<",
"T",
">",
"self",
")",
"{",
"Set",
"<",
"T",
">",
"answer",
"=",
"new",
"HashSet",
"<",
"T",
">",
"(",
")",
";",
"while",
"(",
"self",
".",
"hasNext",
"(",
")",
")",
"{",
"answer",
".",
"add",
"(",
"self",
".",
"next",
"(",
")",
")",
";",
"}",
"return",
"answer",
";",
"}"
] |
Convert an iterator to a Set. The iterator will become
exhausted of elements after making this conversion.
@param self an iterator
@return a Set
@since 1.8.0
|
[
"Convert",
"an",
"iterator",
"to",
"a",
"Set",
".",
"The",
"iterator",
"will",
"become",
"exhausted",
"of",
"elements",
"after",
"making",
"this",
"conversion",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L14513-L14519
|
12,732
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.toSet
|
public static <T> Set<T> toSet(Enumeration<T> self) {
Set<T> answer = new HashSet<T>();
while (self.hasMoreElements()) {
answer.add(self.nextElement());
}
return answer;
}
|
java
|
public static <T> Set<T> toSet(Enumeration<T> self) {
Set<T> answer = new HashSet<T>();
while (self.hasMoreElements()) {
answer.add(self.nextElement());
}
return answer;
}
|
[
"public",
"static",
"<",
"T",
">",
"Set",
"<",
"T",
">",
"toSet",
"(",
"Enumeration",
"<",
"T",
">",
"self",
")",
"{",
"Set",
"<",
"T",
">",
"answer",
"=",
"new",
"HashSet",
"<",
"T",
">",
"(",
")",
";",
"while",
"(",
"self",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"answer",
".",
"add",
"(",
"self",
".",
"nextElement",
"(",
")",
")",
";",
"}",
"return",
"answer",
";",
"}"
] |
Convert an enumeration to a Set.
@param self an enumeration
@return a Set
@since 1.8.0
|
[
"Convert",
"an",
"enumeration",
"to",
"a",
"Set",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L14528-L14534
|
12,733
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.contains
|
public static boolean contains(byte[] self, Object value) {
for (byte next : self) {
if (DefaultTypeTransformation.compareEqual(value, next)) return true;
}
return false;
}
|
java
|
public static boolean contains(byte[] self, Object value) {
for (byte next : self) {
if (DefaultTypeTransformation.compareEqual(value, next)) return true;
}
return false;
}
|
[
"public",
"static",
"boolean",
"contains",
"(",
"byte",
"[",
"]",
"self",
",",
"Object",
"value",
")",
"{",
"for",
"(",
"byte",
"next",
":",
"self",
")",
"{",
"if",
"(",
"DefaultTypeTransformation",
".",
"compareEqual",
"(",
"value",
",",
"next",
")",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Checks whether the array contains the given value.
@param self the array we are searching
@param value the value being searched for
@return true if the array contains the value
@since 1.8.6
|
[
"Checks",
"whether",
"the",
"array",
"contains",
"the",
"given",
"value",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L14728-L14733
|
12,734
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.intdiv
|
public static Number intdiv(Number left, Number right) {
return NumberMath.intdiv(left, right);
}
|
java
|
public static Number intdiv(Number left, Number right) {
return NumberMath.intdiv(left, right);
}
|
[
"public",
"static",
"Number",
"intdiv",
"(",
"Number",
"left",
",",
"Number",
"right",
")",
"{",
"return",
"NumberMath",
".",
"intdiv",
"(",
"left",
",",
"right",
")",
";",
"}"
] |
Integer Divide two Numbers.
@param left a Number
@param right another Number
@return a Number (an Integer) resulting from the integer division operation
@since 1.0
|
[
"Integer",
"Divide",
"two",
"Numbers",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L15434-L15436
|
12,735
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.or
|
public static Number or(Number left, Number right) {
return NumberMath.or(left, right);
}
|
java
|
public static Number or(Number left, Number right) {
return NumberMath.or(left, right);
}
|
[
"public",
"static",
"Number",
"or",
"(",
"Number",
"left",
",",
"Number",
"right",
")",
"{",
"return",
"NumberMath",
".",
"or",
"(",
"left",
",",
"right",
")",
";",
"}"
] |
Bitwise OR together two numbers.
@param left a Number
@param right another Number to bitwise OR
@return the bitwise OR of both Numbers
@since 1.0
|
[
"Bitwise",
"OR",
"together",
"two",
"numbers",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L15446-L15448
|
12,736
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.and
|
public static Number and(Number left, Number right) {
return NumberMath.and(left, right);
}
|
java
|
public static Number and(Number left, Number right) {
return NumberMath.and(left, right);
}
|
[
"public",
"static",
"Number",
"and",
"(",
"Number",
"left",
",",
"Number",
"right",
")",
"{",
"return",
"NumberMath",
".",
"and",
"(",
"left",
",",
"right",
")",
";",
"}"
] |
Bitwise AND together two Numbers.
@param left a Number
@param right another Number to bitwise AND
@return the bitwise AND of both Numbers
@since 1.0
|
[
"Bitwise",
"AND",
"together",
"two",
"Numbers",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L15458-L15460
|
12,737
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.and
|
public static BitSet and(BitSet left, BitSet right) {
BitSet result = (BitSet) left.clone();
result.and(right);
return result;
}
|
java
|
public static BitSet and(BitSet left, BitSet right) {
BitSet result = (BitSet) left.clone();
result.and(right);
return result;
}
|
[
"public",
"static",
"BitSet",
"and",
"(",
"BitSet",
"left",
",",
"BitSet",
"right",
")",
"{",
"BitSet",
"result",
"=",
"(",
"BitSet",
")",
"left",
".",
"clone",
"(",
")",
";",
"result",
".",
"and",
"(",
"right",
")",
";",
"return",
"result",
";",
"}"
] |
Bitwise AND together two BitSets.
@param left a BitSet
@param right another BitSet to bitwise AND
@return the bitwise AND of both BitSets
@since 1.5.0
|
[
"Bitwise",
"AND",
"together",
"two",
"BitSets",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L15470-L15474
|
12,738
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.xor
|
public static BitSet xor(BitSet left, BitSet right) {
BitSet result = (BitSet) left.clone();
result.xor(right);
return result;
}
|
java
|
public static BitSet xor(BitSet left, BitSet right) {
BitSet result = (BitSet) left.clone();
result.xor(right);
return result;
}
|
[
"public",
"static",
"BitSet",
"xor",
"(",
"BitSet",
"left",
",",
"BitSet",
"right",
")",
"{",
"BitSet",
"result",
"=",
"(",
"BitSet",
")",
"left",
".",
"clone",
"(",
")",
";",
"result",
".",
"xor",
"(",
"right",
")",
";",
"return",
"result",
";",
"}"
] |
Bitwise XOR together two BitSets. Called when the '^' operator is used
between two bit sets.
@param left a BitSet
@param right another BitSet to bitwise AND
@return the bitwise XOR of both BitSets
@since 1.5.0
|
[
"Bitwise",
"XOR",
"together",
"two",
"BitSets",
".",
"Called",
"when",
"the",
"^",
"operator",
"is",
"used",
"between",
"two",
"bit",
"sets",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L15485-L15489
|
12,739
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.bitwiseNegate
|
public static BitSet bitwiseNegate(BitSet self) {
BitSet result = (BitSet) self.clone();
result.flip(0, result.size() - 1);
return result;
}
|
java
|
public static BitSet bitwiseNegate(BitSet self) {
BitSet result = (BitSet) self.clone();
result.flip(0, result.size() - 1);
return result;
}
|
[
"public",
"static",
"BitSet",
"bitwiseNegate",
"(",
"BitSet",
"self",
")",
"{",
"BitSet",
"result",
"=",
"(",
"BitSet",
")",
"self",
".",
"clone",
"(",
")",
";",
"result",
".",
"flip",
"(",
"0",
",",
"result",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"return",
"result",
";",
"}"
] |
Bitwise NEGATE a BitSet.
@param self a BitSet
@return the bitwise NEGATE of the BitSet
@since 1.5.0
|
[
"Bitwise",
"NEGATE",
"a",
"BitSet",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L15498-L15502
|
12,740
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.or
|
public static BitSet or(BitSet left, BitSet right) {
BitSet result = (BitSet) left.clone();
result.or(right);
return result;
}
|
java
|
public static BitSet or(BitSet left, BitSet right) {
BitSet result = (BitSet) left.clone();
result.or(right);
return result;
}
|
[
"public",
"static",
"BitSet",
"or",
"(",
"BitSet",
"left",
",",
"BitSet",
"right",
")",
"{",
"BitSet",
"result",
"=",
"(",
"BitSet",
")",
"left",
".",
"clone",
"(",
")",
";",
"result",
".",
"or",
"(",
"right",
")",
";",
"return",
"result",
";",
"}"
] |
Bitwise OR together two BitSets. Called when the '|' operator is used
between two bit sets.
@param left a BitSet
@param right another BitSet to bitwise AND
@return the bitwise OR of both BitSets
@since 1.5.0
|
[
"Bitwise",
"OR",
"together",
"two",
"BitSets",
".",
"Called",
"when",
"the",
"|",
"operator",
"is",
"used",
"between",
"two",
"bit",
"sets",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L15524-L15528
|
12,741
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.xor
|
public static Number xor(Number left, Number right) {
return NumberMath.xor(left, right);
}
|
java
|
public static Number xor(Number left, Number right) {
return NumberMath.xor(left, right);
}
|
[
"public",
"static",
"Number",
"xor",
"(",
"Number",
"left",
",",
"Number",
"right",
")",
"{",
"return",
"NumberMath",
".",
"xor",
"(",
"left",
",",
"right",
")",
";",
"}"
] |
Bitwise XOR together two Numbers. Called when the '^' operator is used.
@param left a Number
@param right another Number to bitwse XOR
@return the bitwise XOR of both Numbers
@since 1.0
|
[
"Bitwise",
"XOR",
"together",
"two",
"Numbers",
".",
"Called",
"when",
"the",
"^",
"operator",
"is",
"used",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L15538-L15540
|
12,742
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.mod
|
public static Number mod(Number left, Number right) {
return NumberMath.mod(left, right);
}
|
java
|
public static Number mod(Number left, Number right) {
return NumberMath.mod(left, right);
}
|
[
"public",
"static",
"Number",
"mod",
"(",
"Number",
"left",
",",
"Number",
"right",
")",
"{",
"return",
"NumberMath",
".",
"mod",
"(",
"left",
",",
"right",
")",
";",
"}"
] |
Performs a division modulus operation. Called by the '%' operator.
@param left a Number
@param right another Number to mod
@return the modulus result
@since 1.0
|
[
"Performs",
"a",
"division",
"modulus",
"operation",
".",
"Called",
"by",
"the",
"%",
"operator",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L15550-L15552
|
12,743
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.downto
|
public static void downto(Float self, Number to, @ClosureParams(FirstParam.class) Closure closure) {
float to1 = to.floatValue();
if (self >= to1) {
for (float i = self; i >= to1; i--) {
closure.call(i);
}
} else
throw new GroovyRuntimeException("The argument (" + to +
") to downto() cannot be greater than the value (" + self + ") it's called on."); }
|
java
|
public static void downto(Float self, Number to, @ClosureParams(FirstParam.class) Closure closure) {
float to1 = to.floatValue();
if (self >= to1) {
for (float i = self; i >= to1; i--) {
closure.call(i);
}
} else
throw new GroovyRuntimeException("The argument (" + to +
") to downto() cannot be greater than the value (" + self + ") it's called on."); }
|
[
"public",
"static",
"void",
"downto",
"(",
"Float",
"self",
",",
"Number",
"to",
",",
"@",
"ClosureParams",
"(",
"FirstParam",
".",
"class",
")",
"Closure",
"closure",
")",
"{",
"float",
"to1",
"=",
"to",
".",
"floatValue",
"(",
")",
";",
"if",
"(",
"self",
">=",
"to1",
")",
"{",
"for",
"(",
"float",
"i",
"=",
"self",
";",
"i",
">=",
"to1",
";",
"i",
"--",
")",
"{",
"closure",
".",
"call",
"(",
"i",
")",
";",
"}",
"}",
"else",
"throw",
"new",
"GroovyRuntimeException",
"(",
"\"The argument (\"",
"+",
"to",
"+",
"\") to downto() cannot be greater than the value (\"",
"+",
"self",
"+",
"\") it's called on.\"",
")",
";",
"}"
] |
Iterates from this number down to the given number, inclusive,
decrementing by one each time.
@param self a Float
@param to the end number
@param closure the code to execute for each number
@since 1.0
|
[
"Iterates",
"from",
"this",
"number",
"down",
"to",
"the",
"given",
"number",
"inclusive",
"decrementing",
"by",
"one",
"each",
"time",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L15928-L15936
|
12,744
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.toDouble
|
public static Double toDouble(Number self) {
// Conversions in which all decimal digits are known to be good.
if ((self instanceof Double)
|| (self instanceof Long)
|| (self instanceof Integer)
|| (self instanceof Short)
|| (self instanceof Byte))
{
return self.doubleValue();
}
// Chances are this is a Float or a Big.
// With Float we're extending binary precision and that gets ugly in decimal.
// If we used Float.doubleValue() on 0.1f we get 0.10000000149011612.
// Note that this is different than casting '(double) 0.1f' which will do the
// binary extension just like in Java.
// With Bigs and other unknowns, this is likely to be the same.
return Double.valueOf(self.toString());
}
|
java
|
public static Double toDouble(Number self) {
// Conversions in which all decimal digits are known to be good.
if ((self instanceof Double)
|| (self instanceof Long)
|| (self instanceof Integer)
|| (self instanceof Short)
|| (self instanceof Byte))
{
return self.doubleValue();
}
// Chances are this is a Float or a Big.
// With Float we're extending binary precision and that gets ugly in decimal.
// If we used Float.doubleValue() on 0.1f we get 0.10000000149011612.
// Note that this is different than casting '(double) 0.1f' which will do the
// binary extension just like in Java.
// With Bigs and other unknowns, this is likely to be the same.
return Double.valueOf(self.toString());
}
|
[
"public",
"static",
"Double",
"toDouble",
"(",
"Number",
"self",
")",
"{",
"// Conversions in which all decimal digits are known to be good.",
"if",
"(",
"(",
"self",
"instanceof",
"Double",
")",
"||",
"(",
"self",
"instanceof",
"Long",
")",
"||",
"(",
"self",
"instanceof",
"Integer",
")",
"||",
"(",
"self",
"instanceof",
"Short",
")",
"||",
"(",
"self",
"instanceof",
"Byte",
")",
")",
"{",
"return",
"self",
".",
"doubleValue",
"(",
")",
";",
"}",
"// Chances are this is a Float or a Big.",
"// With Float we're extending binary precision and that gets ugly in decimal.",
"// If we used Float.doubleValue() on 0.1f we get 0.10000000149011612.",
"// Note that this is different than casting '(double) 0.1f' which will do the",
"// binary extension just like in Java.",
"// With Bigs and other unknowns, this is likely to be the same.",
"return",
"Double",
".",
"valueOf",
"(",
"self",
".",
"toString",
"(",
")",
")",
";",
"}"
] |
Transform a Number into a Double
@param self a Number
@return a Double
@since 1.0
|
[
"Transform",
"a",
"Number",
"into",
"a",
"Double"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16494-L16513
|
12,745
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.toBigDecimal
|
public static BigDecimal toBigDecimal(Number self) {
// Quick method for scalars.
if ((self instanceof Long)
|| (self instanceof Integer)
|| (self instanceof Short)
|| (self instanceof Byte))
{
return BigDecimal.valueOf(self.longValue());
}
return new BigDecimal(self.toString());
}
|
java
|
public static BigDecimal toBigDecimal(Number self) {
// Quick method for scalars.
if ((self instanceof Long)
|| (self instanceof Integer)
|| (self instanceof Short)
|| (self instanceof Byte))
{
return BigDecimal.valueOf(self.longValue());
}
return new BigDecimal(self.toString());
}
|
[
"public",
"static",
"BigDecimal",
"toBigDecimal",
"(",
"Number",
"self",
")",
"{",
"// Quick method for scalars.",
"if",
"(",
"(",
"self",
"instanceof",
"Long",
")",
"||",
"(",
"self",
"instanceof",
"Integer",
")",
"||",
"(",
"self",
"instanceof",
"Short",
")",
"||",
"(",
"self",
"instanceof",
"Byte",
")",
")",
"{",
"return",
"BigDecimal",
".",
"valueOf",
"(",
"self",
".",
"longValue",
"(",
")",
")",
";",
"}",
"return",
"new",
"BigDecimal",
"(",
"self",
".",
"toString",
"(",
")",
")",
";",
"}"
] |
Transform a Number into a BigDecimal
@param self a Number
@return a BigDecimal
@since 1.0
|
[
"Transform",
"a",
"Number",
"into",
"a",
"BigDecimal"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16522-L16533
|
12,746
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.toBigInteger
|
public static BigInteger toBigInteger(Number self) {
if (self instanceof BigInteger) {
return (BigInteger) self;
} else if (self instanceof BigDecimal) {
return ((BigDecimal) self).toBigInteger();
} else if (self instanceof Double) {
return new BigDecimal((Double)self).toBigInteger();
} else if (self instanceof Float) {
return new BigDecimal((Float)self).toBigInteger();
} else {
return new BigInteger(Long.toString(self.longValue()));
}
}
|
java
|
public static BigInteger toBigInteger(Number self) {
if (self instanceof BigInteger) {
return (BigInteger) self;
} else if (self instanceof BigDecimal) {
return ((BigDecimal) self).toBigInteger();
} else if (self instanceof Double) {
return new BigDecimal((Double)self).toBigInteger();
} else if (self instanceof Float) {
return new BigDecimal((Float)self).toBigInteger();
} else {
return new BigInteger(Long.toString(self.longValue()));
}
}
|
[
"public",
"static",
"BigInteger",
"toBigInteger",
"(",
"Number",
"self",
")",
"{",
"if",
"(",
"self",
"instanceof",
"BigInteger",
")",
"{",
"return",
"(",
"BigInteger",
")",
"self",
";",
"}",
"else",
"if",
"(",
"self",
"instanceof",
"BigDecimal",
")",
"{",
"return",
"(",
"(",
"BigDecimal",
")",
"self",
")",
".",
"toBigInteger",
"(",
")",
";",
"}",
"else",
"if",
"(",
"self",
"instanceof",
"Double",
")",
"{",
"return",
"new",
"BigDecimal",
"(",
"(",
"Double",
")",
"self",
")",
".",
"toBigInteger",
"(",
")",
";",
"}",
"else",
"if",
"(",
"self",
"instanceof",
"Float",
")",
"{",
"return",
"new",
"BigDecimal",
"(",
"(",
"Float",
")",
"self",
")",
".",
"toBigInteger",
"(",
")",
";",
"}",
"else",
"{",
"return",
"new",
"BigInteger",
"(",
"Long",
".",
"toString",
"(",
"self",
".",
"longValue",
"(",
")",
")",
")",
";",
"}",
"}"
] |
Transform this Number into a BigInteger.
@param self a Number
@return a BigInteger
@since 1.0
|
[
"Transform",
"this",
"Number",
"into",
"a",
"BigInteger",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16571-L16583
|
12,747
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.and
|
public static Boolean and(Boolean left, Boolean right) {
return left && Boolean.TRUE.equals(right);
}
|
java
|
public static Boolean and(Boolean left, Boolean right) {
return left && Boolean.TRUE.equals(right);
}
|
[
"public",
"static",
"Boolean",
"and",
"(",
"Boolean",
"left",
",",
"Boolean",
"right",
")",
"{",
"return",
"left",
"&&",
"Boolean",
".",
"TRUE",
".",
"equals",
"(",
"right",
")",
";",
"}"
] |
Logical conjunction of two boolean operators.
@param left left operator
@param right right operator
@return result of logical conjunction
@since 1.0
|
[
"Logical",
"conjunction",
"of",
"two",
"boolean",
"operators",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16597-L16599
|
12,748
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.or
|
public static Boolean or(Boolean left, Boolean right) {
return left || Boolean.TRUE.equals(right);
}
|
java
|
public static Boolean or(Boolean left, Boolean right) {
return left || Boolean.TRUE.equals(right);
}
|
[
"public",
"static",
"Boolean",
"or",
"(",
"Boolean",
"left",
",",
"Boolean",
"right",
")",
"{",
"return",
"left",
"||",
"Boolean",
".",
"TRUE",
".",
"equals",
"(",
"right",
")",
";",
"}"
] |
Logical disjunction of two boolean operators
@param left left operator
@param right right operator
@return result of logical disjunction
@since 1.0
|
[
"Logical",
"disjunction",
"of",
"two",
"boolean",
"operators"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16609-L16611
|
12,749
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.implies
|
public static Boolean implies(Boolean left, Boolean right) {
return !left || Boolean.TRUE.equals(right);
}
|
java
|
public static Boolean implies(Boolean left, Boolean right) {
return !left || Boolean.TRUE.equals(right);
}
|
[
"public",
"static",
"Boolean",
"implies",
"(",
"Boolean",
"left",
",",
"Boolean",
"right",
")",
"{",
"return",
"!",
"left",
"||",
"Boolean",
".",
"TRUE",
".",
"equals",
"(",
"right",
")",
";",
"}"
] |
Logical implication of two boolean operators
@param left left operator
@param right right operator
@return result of logical implication
@since 1.8.3
|
[
"Logical",
"implication",
"of",
"two",
"boolean",
"operators"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16621-L16623
|
12,750
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.xor
|
public static Boolean xor(Boolean left, Boolean right) {
return left ^ Boolean.TRUE.equals(right);
}
|
java
|
public static Boolean xor(Boolean left, Boolean right) {
return left ^ Boolean.TRUE.equals(right);
}
|
[
"public",
"static",
"Boolean",
"xor",
"(",
"Boolean",
"left",
",",
"Boolean",
"right",
")",
"{",
"return",
"left",
"^",
"Boolean",
".",
"TRUE",
".",
"equals",
"(",
"right",
")",
";",
"}"
] |
Exclusive disjunction of two boolean operators
@param left left operator
@param right right operator
@return result of exclusive disjunction
@since 1.0
|
[
"Exclusive",
"disjunction",
"of",
"two",
"boolean",
"operators"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16633-L16635
|
12,751
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.runAfter
|
public static TimerTask runAfter(Timer timer, int delay, final Closure closure) {
TimerTask timerTask = new TimerTask() {
public void run() {
closure.call();
}
};
timer.schedule(timerTask, delay);
return timerTask;
}
|
java
|
public static TimerTask runAfter(Timer timer, int delay, final Closure closure) {
TimerTask timerTask = new TimerTask() {
public void run() {
closure.call();
}
};
timer.schedule(timerTask, delay);
return timerTask;
}
|
[
"public",
"static",
"TimerTask",
"runAfter",
"(",
"Timer",
"timer",
",",
"int",
"delay",
",",
"final",
"Closure",
"closure",
")",
"{",
"TimerTask",
"timerTask",
"=",
"new",
"TimerTask",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"closure",
".",
"call",
"(",
")",
";",
"}",
"}",
";",
"timer",
".",
"schedule",
"(",
"timerTask",
",",
"delay",
")",
";",
"return",
"timerTask",
";",
"}"
] |
Allows a simple syntax for using timers. This timer will execute the
given closure after the given delay.
@param timer a timer object
@param delay the delay in milliseconds before running the closure code
@param closure the closure to invoke
@return The timer task which has been scheduled.
@since 1.5.0
|
[
"Allows",
"a",
"simple",
"syntax",
"for",
"using",
"timers",
".",
"This",
"timer",
"will",
"execute",
"the",
"given",
"closure",
"after",
"the",
"given",
"delay",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16651-L16659
|
12,752
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.eachByte
|
public static void eachByte(Byte[] self, @ClosureParams(FirstParam.Component.class) Closure closure) {
each(self, closure);
}
|
java
|
public static void eachByte(Byte[] self, @ClosureParams(FirstParam.Component.class) Closure closure) {
each(self, closure);
}
|
[
"public",
"static",
"void",
"eachByte",
"(",
"Byte",
"[",
"]",
"self",
",",
"@",
"ClosureParams",
"(",
"FirstParam",
".",
"Component",
".",
"class",
")",
"Closure",
"closure",
")",
"{",
"each",
"(",
"self",
",",
"closure",
")",
";",
"}"
] |
Traverse through each byte of this Byte array. Alias for each.
@param self a Byte array
@param closure a closure
@see #each(java.lang.Object, groovy.lang.Closure)
@since 1.5.5
|
[
"Traverse",
"through",
"each",
"byte",
"of",
"this",
"Byte",
"array",
".",
"Alias",
"for",
"each",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16669-L16671
|
12,753
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.findIndexOf
|
public static int findIndexOf(Object self, int startIndex, Closure condition) {
return findIndexOf(InvokerHelper.asIterator(self), condition);
}
|
java
|
public static int findIndexOf(Object self, int startIndex, Closure condition) {
return findIndexOf(InvokerHelper.asIterator(self), condition);
}
|
[
"public",
"static",
"int",
"findIndexOf",
"(",
"Object",
"self",
",",
"int",
"startIndex",
",",
"Closure",
"condition",
")",
"{",
"return",
"findIndexOf",
"(",
"InvokerHelper",
".",
"asIterator",
"(",
"self",
")",
",",
"condition",
")",
";",
"}"
] |
Iterates over the elements of an aggregate of items, starting from a
specified startIndex, and returns the index of the first item that matches the
condition specified in the closure.
@param self the iteration object over which to iterate
@param startIndex start matching from this index
@param condition the matching condition
@return an integer that is the index of the first matched object or -1 if no match was found
@since 1.5.0
|
[
"Iterates",
"over",
"the",
"elements",
"of",
"an",
"aggregate",
"of",
"items",
"starting",
"from",
"a",
"specified",
"startIndex",
"and",
"returns",
"the",
"index",
"of",
"the",
"first",
"item",
"that",
"matches",
"the",
"condition",
"specified",
"in",
"the",
"closure",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16709-L16711
|
12,754
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.findIndexOf
|
public static <T> int findIndexOf(Iterator<T> self, @ClosureParams(FirstParam.FirstGenericType.class) Closure condition) {
return findIndexOf(self, 0, condition);
}
|
java
|
public static <T> int findIndexOf(Iterator<T> self, @ClosureParams(FirstParam.FirstGenericType.class) Closure condition) {
return findIndexOf(self, 0, condition);
}
|
[
"public",
"static",
"<",
"T",
">",
"int",
"findIndexOf",
"(",
"Iterator",
"<",
"T",
">",
"self",
",",
"@",
"ClosureParams",
"(",
"FirstParam",
".",
"FirstGenericType",
".",
"class",
")",
"Closure",
"condition",
")",
"{",
"return",
"findIndexOf",
"(",
"self",
",",
"0",
",",
"condition",
")",
";",
"}"
] |
Iterates over the elements of an Iterator and returns the index of the first item that satisfies the
condition specified by the closure.
@param self an Iterator
@param condition the matching condition
@return an integer that is the index of the first matched object or -1 if no match was found
@since 2.5.0
|
[
"Iterates",
"over",
"the",
"elements",
"of",
"an",
"Iterator",
"and",
"returns",
"the",
"index",
"of",
"the",
"first",
"item",
"that",
"satisfies",
"the",
"condition",
"specified",
"by",
"the",
"closure",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16722-L16724
|
12,755
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.findIndexOf
|
public static <T> int findIndexOf(Iterator<T> self, int startIndex, @ClosureParams(FirstParam.FirstGenericType.class) Closure condition) {
int result = -1;
int i = 0;
BooleanClosureWrapper bcw = new BooleanClosureWrapper(condition);
while (self.hasNext()) {
Object value = self.next();
if (i++ < startIndex) {
continue;
}
if (bcw.call(value)) {
result = i - 1;
break;
}
}
return result;
}
|
java
|
public static <T> int findIndexOf(Iterator<T> self, int startIndex, @ClosureParams(FirstParam.FirstGenericType.class) Closure condition) {
int result = -1;
int i = 0;
BooleanClosureWrapper bcw = new BooleanClosureWrapper(condition);
while (self.hasNext()) {
Object value = self.next();
if (i++ < startIndex) {
continue;
}
if (bcw.call(value)) {
result = i - 1;
break;
}
}
return result;
}
|
[
"public",
"static",
"<",
"T",
">",
"int",
"findIndexOf",
"(",
"Iterator",
"<",
"T",
">",
"self",
",",
"int",
"startIndex",
",",
"@",
"ClosureParams",
"(",
"FirstParam",
".",
"FirstGenericType",
".",
"class",
")",
"Closure",
"condition",
")",
"{",
"int",
"result",
"=",
"-",
"1",
";",
"int",
"i",
"=",
"0",
";",
"BooleanClosureWrapper",
"bcw",
"=",
"new",
"BooleanClosureWrapper",
"(",
"condition",
")",
";",
"while",
"(",
"self",
".",
"hasNext",
"(",
")",
")",
"{",
"Object",
"value",
"=",
"self",
".",
"next",
"(",
")",
";",
"if",
"(",
"i",
"++",
"<",
"startIndex",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"bcw",
".",
"call",
"(",
"value",
")",
")",
"{",
"result",
"=",
"i",
"-",
"1",
";",
"break",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Iterates over the elements of an Iterator, starting from a
specified startIndex, and returns the index of the first item that satisfies the
condition specified by the closure.
@param self an Iterator
@param startIndex start matching from this index
@param condition the matching condition
@return an integer that is the index of the first matched object or -1 if no match was found
@since 2.5.0
|
[
"Iterates",
"over",
"the",
"elements",
"of",
"an",
"Iterator",
"starting",
"from",
"a",
"specified",
"startIndex",
"and",
"returns",
"the",
"index",
"of",
"the",
"first",
"item",
"that",
"satisfies",
"the",
"condition",
"specified",
"by",
"the",
"closure",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16737-L16752
|
12,756
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.findIndexOf
|
public static <T> int findIndexOf(T[] self, int startIndex, @ClosureParams(FirstParam.Component.class) Closure condition) {
return findIndexOf(new ArrayIterator<T>(self), startIndex, condition);
}
|
java
|
public static <T> int findIndexOf(T[] self, int startIndex, @ClosureParams(FirstParam.Component.class) Closure condition) {
return findIndexOf(new ArrayIterator<T>(self), startIndex, condition);
}
|
[
"public",
"static",
"<",
"T",
">",
"int",
"findIndexOf",
"(",
"T",
"[",
"]",
"self",
",",
"int",
"startIndex",
",",
"@",
"ClosureParams",
"(",
"FirstParam",
".",
"Component",
".",
"class",
")",
"Closure",
"condition",
")",
"{",
"return",
"findIndexOf",
"(",
"new",
"ArrayIterator",
"<",
"T",
">",
"(",
"self",
")",
",",
"startIndex",
",",
"condition",
")",
";",
"}"
] |
Iterates over the elements of an Array, starting from a
specified startIndex, and returns the index of the first item that satisfies the
condition specified by the closure.
@param self an Array
@param startIndex start matching from this index
@param condition the matching condition
@return an integer that is the index of the first matched object or -1 if no match was found
@since 2.5.0
|
[
"Iterates",
"over",
"the",
"elements",
"of",
"an",
"Array",
"starting",
"from",
"a",
"specified",
"startIndex",
"and",
"returns",
"the",
"index",
"of",
"the",
"first",
"item",
"that",
"satisfies",
"the",
"condition",
"specified",
"by",
"the",
"closure",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16806-L16808
|
12,757
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.findLastIndexOf
|
public static int findLastIndexOf(Object self, int startIndex, Closure condition) {
return findLastIndexOf(InvokerHelper.asIterator(self), startIndex, condition);
}
|
java
|
public static int findLastIndexOf(Object self, int startIndex, Closure condition) {
return findLastIndexOf(InvokerHelper.asIterator(self), startIndex, condition);
}
|
[
"public",
"static",
"int",
"findLastIndexOf",
"(",
"Object",
"self",
",",
"int",
"startIndex",
",",
"Closure",
"condition",
")",
"{",
"return",
"findLastIndexOf",
"(",
"InvokerHelper",
".",
"asIterator",
"(",
"self",
")",
",",
"startIndex",
",",
"condition",
")",
";",
"}"
] |
Iterates over the elements of an aggregate of items, starting
from a specified startIndex, and returns the index of the last item that
matches the condition specified in the closure.
@param self the iteration object over which to iterate
@param startIndex start matching from this index
@param condition the matching condition
@return an integer that is the index of the last matched object or -1 if no match was found
@since 1.5.2
|
[
"Iterates",
"over",
"the",
"elements",
"of",
"an",
"aggregate",
"of",
"items",
"starting",
"from",
"a",
"specified",
"startIndex",
"and",
"returns",
"the",
"index",
"of",
"the",
"last",
"item",
"that",
"matches",
"the",
"condition",
"specified",
"in",
"the",
"closure",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16834-L16836
|
12,758
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.findIndexValues
|
public static List<Number> findIndexValues(Object self, Closure condition) {
return findIndexValues(self, 0, condition);
}
|
java
|
public static List<Number> findIndexValues(Object self, Closure condition) {
return findIndexValues(self, 0, condition);
}
|
[
"public",
"static",
"List",
"<",
"Number",
">",
"findIndexValues",
"(",
"Object",
"self",
",",
"Closure",
"condition",
")",
"{",
"return",
"findIndexValues",
"(",
"self",
",",
"0",
",",
"condition",
")",
";",
"}"
] |
Iterates over the elements of an aggregate of items and returns
the index values of the items that match the condition specified in the closure.
@param self the iteration object over which to iterate
@param condition the matching condition
@return a list of numbers corresponding to the index values of all matched objects
@since 1.5.2
|
[
"Iterates",
"over",
"the",
"elements",
"of",
"an",
"aggregate",
"of",
"items",
"and",
"returns",
"the",
"index",
"values",
"of",
"the",
"items",
"that",
"match",
"the",
"condition",
"specified",
"in",
"the",
"closure",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16944-L16946
|
12,759
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.findIndexValues
|
public static List<Number> findIndexValues(Object self, Number startIndex, Closure condition) {
return findIndexValues(InvokerHelper.asIterator(self), startIndex, condition);
}
|
java
|
public static List<Number> findIndexValues(Object self, Number startIndex, Closure condition) {
return findIndexValues(InvokerHelper.asIterator(self), startIndex, condition);
}
|
[
"public",
"static",
"List",
"<",
"Number",
">",
"findIndexValues",
"(",
"Object",
"self",
",",
"Number",
"startIndex",
",",
"Closure",
"condition",
")",
"{",
"return",
"findIndexValues",
"(",
"InvokerHelper",
".",
"asIterator",
"(",
"self",
")",
",",
"startIndex",
",",
"condition",
")",
";",
"}"
] |
Iterates over the elements of an aggregate of items, starting from
a specified startIndex, and returns the index values of the items that match
the condition specified in the closure.
@param self the iteration object over which to iterate
@param startIndex start matching from this index
@param condition the matching condition
@return a list of numbers corresponding to the index values of all matched objects
@since 1.5.2
|
[
"Iterates",
"over",
"the",
"elements",
"of",
"an",
"aggregate",
"of",
"items",
"starting",
"from",
"a",
"specified",
"startIndex",
"and",
"returns",
"the",
"index",
"values",
"of",
"the",
"items",
"that",
"match",
"the",
"condition",
"specified",
"in",
"the",
"closure",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16959-L16961
|
12,760
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.findIndexValues
|
public static <T> List<Number> findIndexValues(Iterator<T> self, Number startIndex, @ClosureParams(FirstParam.FirstGenericType.class) Closure condition) {
List<Number> result = new ArrayList<Number>();
long count = 0;
long startCount = startIndex.longValue();
BooleanClosureWrapper bcw = new BooleanClosureWrapper(condition);
while (self.hasNext()) {
Object value = self.next();
if (count++ < startCount) {
continue;
}
if (bcw.call(value)) {
result.add(count - 1);
}
}
return result;
}
|
java
|
public static <T> List<Number> findIndexValues(Iterator<T> self, Number startIndex, @ClosureParams(FirstParam.FirstGenericType.class) Closure condition) {
List<Number> result = new ArrayList<Number>();
long count = 0;
long startCount = startIndex.longValue();
BooleanClosureWrapper bcw = new BooleanClosureWrapper(condition);
while (self.hasNext()) {
Object value = self.next();
if (count++ < startCount) {
continue;
}
if (bcw.call(value)) {
result.add(count - 1);
}
}
return result;
}
|
[
"public",
"static",
"<",
"T",
">",
"List",
"<",
"Number",
">",
"findIndexValues",
"(",
"Iterator",
"<",
"T",
">",
"self",
",",
"Number",
"startIndex",
",",
"@",
"ClosureParams",
"(",
"FirstParam",
".",
"FirstGenericType",
".",
"class",
")",
"Closure",
"condition",
")",
"{",
"List",
"<",
"Number",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"Number",
">",
"(",
")",
";",
"long",
"count",
"=",
"0",
";",
"long",
"startCount",
"=",
"startIndex",
".",
"longValue",
"(",
")",
";",
"BooleanClosureWrapper",
"bcw",
"=",
"new",
"BooleanClosureWrapper",
"(",
"condition",
")",
";",
"while",
"(",
"self",
".",
"hasNext",
"(",
")",
")",
"{",
"Object",
"value",
"=",
"self",
".",
"next",
"(",
")",
";",
"if",
"(",
"count",
"++",
"<",
"startCount",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"bcw",
".",
"call",
"(",
"value",
")",
")",
"{",
"result",
".",
"add",
"(",
"count",
"-",
"1",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Iterates over the elements of an Iterator, starting from
a specified startIndex, and returns the index values of the items that match
the condition specified in the closure.
@param self an Iterator
@param startIndex start matching from this index
@param condition the matching condition
@return a list of numbers corresponding to the index values of all matched objects
@since 2.5.0
|
[
"Iterates",
"over",
"the",
"elements",
"of",
"an",
"Iterator",
"starting",
"from",
"a",
"specified",
"startIndex",
"and",
"returns",
"the",
"index",
"values",
"of",
"the",
"items",
"that",
"match",
"the",
"condition",
"specified",
"in",
"the",
"closure",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16987-L17002
|
12,761
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.findIndexValues
|
public static <T> List<Number> findIndexValues(Iterable<T> self, @ClosureParams(FirstParam.FirstGenericType.class) Closure condition) {
return findIndexValues(self, 0, condition);
}
|
java
|
public static <T> List<Number> findIndexValues(Iterable<T> self, @ClosureParams(FirstParam.FirstGenericType.class) Closure condition) {
return findIndexValues(self, 0, condition);
}
|
[
"public",
"static",
"<",
"T",
">",
"List",
"<",
"Number",
">",
"findIndexValues",
"(",
"Iterable",
"<",
"T",
">",
"self",
",",
"@",
"ClosureParams",
"(",
"FirstParam",
".",
"FirstGenericType",
".",
"class",
")",
"Closure",
"condition",
")",
"{",
"return",
"findIndexValues",
"(",
"self",
",",
"0",
",",
"condition",
")",
";",
"}"
] |
Iterates over the elements of an Iterable and returns
the index values of the items that match the condition specified in the closure.
@param self an Iterable
@param condition the matching condition
@return a list of numbers corresponding to the index values of all matched objects
@since 2.5.0
|
[
"Iterates",
"over",
"the",
"elements",
"of",
"an",
"Iterable",
"and",
"returns",
"the",
"index",
"values",
"of",
"the",
"items",
"that",
"match",
"the",
"condition",
"specified",
"in",
"the",
"closure",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L17013-L17015
|
12,762
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.findIndexValues
|
public static <T> List<Number> findIndexValues(T[] self, @ClosureParams(FirstParam.Component.class) Closure condition) {
return findIndexValues(self, 0, condition);
}
|
java
|
public static <T> List<Number> findIndexValues(T[] self, @ClosureParams(FirstParam.Component.class) Closure condition) {
return findIndexValues(self, 0, condition);
}
|
[
"public",
"static",
"<",
"T",
">",
"List",
"<",
"Number",
">",
"findIndexValues",
"(",
"T",
"[",
"]",
"self",
",",
"@",
"ClosureParams",
"(",
"FirstParam",
".",
"Component",
".",
"class",
")",
"Closure",
"condition",
")",
"{",
"return",
"findIndexValues",
"(",
"self",
",",
"0",
",",
"condition",
")",
";",
"}"
] |
Iterates over the elements of an Array and returns
the index values of the items that match the condition specified in the closure.
@param self an Array
@param condition the matching condition
@return a list of numbers corresponding to the index values of all matched objects
@since 2.5.0
|
[
"Iterates",
"over",
"the",
"elements",
"of",
"an",
"Array",
"and",
"returns",
"the",
"index",
"values",
"of",
"the",
"items",
"that",
"match",
"the",
"condition",
"specified",
"in",
"the",
"closure",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L17041-L17043
|
12,763
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.asType
|
@SuppressWarnings("unchecked")
public static <T> T asType(Object obj, Class<T> type) {
if (String.class == type) {
return (T) InvokerHelper.toString(obj);
}
// fall back to cast
try {
return (T) DefaultTypeTransformation.castToType(obj, type);
}
catch (GroovyCastException e) {
MetaClass mc = InvokerHelper.getMetaClass(obj);
if (mc instanceof ExpandoMetaClass) {
ExpandoMetaClass emc = (ExpandoMetaClass) mc;
Object mixedIn = emc.castToMixedType(obj, type);
if (mixedIn != null)
return (T) mixedIn;
}
if (type.isInterface()) {
try {
List<Class> interfaces = new ArrayList<Class>();
interfaces.add(type);
return (T) ProxyGenerator.INSTANCE.instantiateDelegate(interfaces, obj);
} catch (GroovyRuntimeException cause) {
// ignore
}
}
throw e;
}
}
|
java
|
@SuppressWarnings("unchecked")
public static <T> T asType(Object obj, Class<T> type) {
if (String.class == type) {
return (T) InvokerHelper.toString(obj);
}
// fall back to cast
try {
return (T) DefaultTypeTransformation.castToType(obj, type);
}
catch (GroovyCastException e) {
MetaClass mc = InvokerHelper.getMetaClass(obj);
if (mc instanceof ExpandoMetaClass) {
ExpandoMetaClass emc = (ExpandoMetaClass) mc;
Object mixedIn = emc.castToMixedType(obj, type);
if (mixedIn != null)
return (T) mixedIn;
}
if (type.isInterface()) {
try {
List<Class> interfaces = new ArrayList<Class>();
interfaces.add(type);
return (T) ProxyGenerator.INSTANCE.instantiateDelegate(interfaces, obj);
} catch (GroovyRuntimeException cause) {
// ignore
}
}
throw e;
}
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"asType",
"(",
"Object",
"obj",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"if",
"(",
"String",
".",
"class",
"==",
"type",
")",
"{",
"return",
"(",
"T",
")",
"InvokerHelper",
".",
"toString",
"(",
"obj",
")",
";",
"}",
"// fall back to cast",
"try",
"{",
"return",
"(",
"T",
")",
"DefaultTypeTransformation",
".",
"castToType",
"(",
"obj",
",",
"type",
")",
";",
"}",
"catch",
"(",
"GroovyCastException",
"e",
")",
"{",
"MetaClass",
"mc",
"=",
"InvokerHelper",
".",
"getMetaClass",
"(",
"obj",
")",
";",
"if",
"(",
"mc",
"instanceof",
"ExpandoMetaClass",
")",
"{",
"ExpandoMetaClass",
"emc",
"=",
"(",
"ExpandoMetaClass",
")",
"mc",
";",
"Object",
"mixedIn",
"=",
"emc",
".",
"castToMixedType",
"(",
"obj",
",",
"type",
")",
";",
"if",
"(",
"mixedIn",
"!=",
"null",
")",
"return",
"(",
"T",
")",
"mixedIn",
";",
"}",
"if",
"(",
"type",
".",
"isInterface",
"(",
")",
")",
"{",
"try",
"{",
"List",
"<",
"Class",
">",
"interfaces",
"=",
"new",
"ArrayList",
"<",
"Class",
">",
"(",
")",
";",
"interfaces",
".",
"add",
"(",
"type",
")",
";",
"return",
"(",
"T",
")",
"ProxyGenerator",
".",
"INSTANCE",
".",
"instantiateDelegate",
"(",
"interfaces",
",",
"obj",
")",
";",
"}",
"catch",
"(",
"GroovyRuntimeException",
"cause",
")",
"{",
"// ignore",
"}",
"}",
"throw",
"e",
";",
"}",
"}"
] |
Converts a given object to a type. This method is used through
the "as" operator and is overloadable as any other operator.
@param obj the object to convert
@param type the goal type
@return the resulting object
@since 1.0
|
[
"Converts",
"a",
"given",
"object",
"to",
"a",
"type",
".",
"This",
"method",
"is",
"used",
"through",
"the",
"as",
"operator",
"and",
"is",
"overloadable",
"as",
"any",
"other",
"operator",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L17100-L17129
|
12,764
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.newInstance
|
@SuppressWarnings("unchecked")
public static <T> T newInstance(Class<T> c) {
return (T) InvokerHelper.invokeConstructorOf(c, null);
}
|
java
|
@SuppressWarnings("unchecked")
public static <T> T newInstance(Class<T> c) {
return (T) InvokerHelper.invokeConstructorOf(c, null);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"newInstance",
"(",
"Class",
"<",
"T",
">",
"c",
")",
"{",
"return",
"(",
"T",
")",
"InvokerHelper",
".",
"invokeConstructorOf",
"(",
"c",
",",
"null",
")",
";",
"}"
] |
Convenience method to dynamically create a new instance of this
class. Calls the default constructor.
@param c a class
@return a new instance of this class
@since 1.0
|
[
"Convenience",
"method",
"to",
"dynamically",
"create",
"a",
"new",
"instance",
"of",
"this",
"class",
".",
"Calls",
"the",
"default",
"constructor",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L17196-L17199
|
12,765
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.getMetaClass
|
public static MetaClass getMetaClass(Object obj) {
MetaClass mc = InvokerHelper.getMetaClass(obj);
return new HandleMetaClass(mc, obj);
}
|
java
|
public static MetaClass getMetaClass(Object obj) {
MetaClass mc = InvokerHelper.getMetaClass(obj);
return new HandleMetaClass(mc, obj);
}
|
[
"public",
"static",
"MetaClass",
"getMetaClass",
"(",
"Object",
"obj",
")",
"{",
"MetaClass",
"mc",
"=",
"InvokerHelper",
".",
"getMetaClass",
"(",
"obj",
")",
";",
"return",
"new",
"HandleMetaClass",
"(",
"mc",
",",
"obj",
")",
";",
"}"
] |
Obtains a MetaClass for an object either from the registry or in the case of
a GroovyObject from the object itself.
@param obj The object in question
@return The MetaClass
@since 1.5.0
|
[
"Obtains",
"a",
"MetaClass",
"for",
"an",
"object",
"either",
"from",
"the",
"registry",
"or",
"in",
"the",
"case",
"of",
"a",
"GroovyObject",
"from",
"the",
"object",
"itself",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L17245-L17248
|
12,766
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.setMetaClass
|
public static void setMetaClass(Class self, MetaClass metaClass) {
final MetaClassRegistry metaClassRegistry = GroovySystem.getMetaClassRegistry();
if (metaClass == null)
metaClassRegistry.removeMetaClass(self);
else {
if (metaClass instanceof HandleMetaClass) {
metaClassRegistry.setMetaClass(self, ((HandleMetaClass)metaClass).getAdaptee());
} else {
metaClassRegistry.setMetaClass(self, metaClass);
}
if (self==NullObject.class) {
NullObject.getNullObject().setMetaClass(metaClass);
}
}
}
|
java
|
public static void setMetaClass(Class self, MetaClass metaClass) {
final MetaClassRegistry metaClassRegistry = GroovySystem.getMetaClassRegistry();
if (metaClass == null)
metaClassRegistry.removeMetaClass(self);
else {
if (metaClass instanceof HandleMetaClass) {
metaClassRegistry.setMetaClass(self, ((HandleMetaClass)metaClass).getAdaptee());
} else {
metaClassRegistry.setMetaClass(self, metaClass);
}
if (self==NullObject.class) {
NullObject.getNullObject().setMetaClass(metaClass);
}
}
}
|
[
"public",
"static",
"void",
"setMetaClass",
"(",
"Class",
"self",
",",
"MetaClass",
"metaClass",
")",
"{",
"final",
"MetaClassRegistry",
"metaClassRegistry",
"=",
"GroovySystem",
".",
"getMetaClassRegistry",
"(",
")",
";",
"if",
"(",
"metaClass",
"==",
"null",
")",
"metaClassRegistry",
".",
"removeMetaClass",
"(",
"self",
")",
";",
"else",
"{",
"if",
"(",
"metaClass",
"instanceof",
"HandleMetaClass",
")",
"{",
"metaClassRegistry",
".",
"setMetaClass",
"(",
"self",
",",
"(",
"(",
"HandleMetaClass",
")",
"metaClass",
")",
".",
"getAdaptee",
"(",
")",
")",
";",
"}",
"else",
"{",
"metaClassRegistry",
".",
"setMetaClass",
"(",
"self",
",",
"metaClass",
")",
";",
"}",
"if",
"(",
"self",
"==",
"NullObject",
".",
"class",
")",
"{",
"NullObject",
".",
"getNullObject",
"(",
")",
".",
"setMetaClass",
"(",
"metaClass",
")",
";",
"}",
"}",
"}"
] |
Sets the metaclass for a given class.
@param self the class whose metaclass we wish to set
@param metaClass the new MetaClass
@since 1.6.0
|
[
"Sets",
"the",
"metaclass",
"for",
"a",
"given",
"class",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L17270-L17284
|
12,767
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.setMetaClass
|
public static void setMetaClass(Object self, MetaClass metaClass) {
if (metaClass instanceof HandleMetaClass)
metaClass = ((HandleMetaClass)metaClass).getAdaptee();
if (self instanceof Class) {
GroovySystem.getMetaClassRegistry().setMetaClass((Class) self, metaClass);
} else {
((MetaClassRegistryImpl)GroovySystem.getMetaClassRegistry()).setMetaClass(self, metaClass);
}
}
|
java
|
public static void setMetaClass(Object self, MetaClass metaClass) {
if (metaClass instanceof HandleMetaClass)
metaClass = ((HandleMetaClass)metaClass).getAdaptee();
if (self instanceof Class) {
GroovySystem.getMetaClassRegistry().setMetaClass((Class) self, metaClass);
} else {
((MetaClassRegistryImpl)GroovySystem.getMetaClassRegistry()).setMetaClass(self, metaClass);
}
}
|
[
"public",
"static",
"void",
"setMetaClass",
"(",
"Object",
"self",
",",
"MetaClass",
"metaClass",
")",
"{",
"if",
"(",
"metaClass",
"instanceof",
"HandleMetaClass",
")",
"metaClass",
"=",
"(",
"(",
"HandleMetaClass",
")",
"metaClass",
")",
".",
"getAdaptee",
"(",
")",
";",
"if",
"(",
"self",
"instanceof",
"Class",
")",
"{",
"GroovySystem",
".",
"getMetaClassRegistry",
"(",
")",
".",
"setMetaClass",
"(",
"(",
"Class",
")",
"self",
",",
"metaClass",
")",
";",
"}",
"else",
"{",
"(",
"(",
"MetaClassRegistryImpl",
")",
"GroovySystem",
".",
"getMetaClassRegistry",
"(",
")",
")",
".",
"setMetaClass",
"(",
"self",
",",
"metaClass",
")",
";",
"}",
"}"
] |
Set the metaclass for an object.
@param self the object whose metaclass we want to set
@param metaClass the new metaclass value
@since 1.6.0
|
[
"Set",
"the",
"metaclass",
"for",
"an",
"object",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L17292-L17301
|
12,768
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.setMetaClass
|
public static void setMetaClass(GroovyObject self, MetaClass metaClass) {
// this method was introduced as to prevent from a stack overflow, described in GROOVY-5285
if (metaClass instanceof HandleMetaClass)
metaClass = ((HandleMetaClass)metaClass).getAdaptee();
self.setMetaClass(metaClass);
disablePrimitiveOptimization(self);
}
|
java
|
public static void setMetaClass(GroovyObject self, MetaClass metaClass) {
// this method was introduced as to prevent from a stack overflow, described in GROOVY-5285
if (metaClass instanceof HandleMetaClass)
metaClass = ((HandleMetaClass)metaClass).getAdaptee();
self.setMetaClass(metaClass);
disablePrimitiveOptimization(self);
}
|
[
"public",
"static",
"void",
"setMetaClass",
"(",
"GroovyObject",
"self",
",",
"MetaClass",
"metaClass",
")",
"{",
"// this method was introduced as to prevent from a stack overflow, described in GROOVY-5285",
"if",
"(",
"metaClass",
"instanceof",
"HandleMetaClass",
")",
"metaClass",
"=",
"(",
"(",
"HandleMetaClass",
")",
"metaClass",
")",
".",
"getAdaptee",
"(",
")",
";",
"self",
".",
"setMetaClass",
"(",
"metaClass",
")",
";",
"disablePrimitiveOptimization",
"(",
"self",
")",
";",
"}"
] |
Set the metaclass for a GroovyObject.
@param self the object whose metaclass we want to set
@param metaClass the new metaclass value
@since 2.0.0
|
[
"Set",
"the",
"metaclass",
"for",
"a",
"GroovyObject",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L17309-L17316
|
12,769
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.iterator
|
public static <T> Iterator<T> iterator(T[] a) {
return DefaultTypeTransformation.asCollection(a).iterator();
}
|
java
|
public static <T> Iterator<T> iterator(T[] a) {
return DefaultTypeTransformation.asCollection(a).iterator();
}
|
[
"public",
"static",
"<",
"T",
">",
"Iterator",
"<",
"T",
">",
"iterator",
"(",
"T",
"[",
"]",
"a",
")",
"{",
"return",
"DefaultTypeTransformation",
".",
"asCollection",
"(",
"a",
")",
".",
"iterator",
"(",
")",
";",
"}"
] |
Attempts to create an Iterator for the given object by first
converting it to a Collection.
@param a an array
@return an Iterator for the given Array.
@see org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation#asCollection(java.lang.Object[])
@since 1.6.4
|
[
"Attempts",
"to",
"create",
"an",
"Iterator",
"for",
"the",
"given",
"object",
"by",
"first",
"converting",
"it",
"to",
"a",
"Collection",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L17444-L17446
|
12,770
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
|
DefaultGroovyMethods.getGroovydoc
|
public static groovy.lang.groovydoc.Groovydoc getGroovydoc(AnnotatedElement holder) {
Groovydoc groovydocAnnotation = holder.<Groovydoc>getAnnotation(Groovydoc.class);
return null == groovydocAnnotation
? EMPTY_GROOVYDOC
: new groovy.lang.groovydoc.Groovydoc(groovydocAnnotation.value(), holder);
}
|
java
|
public static groovy.lang.groovydoc.Groovydoc getGroovydoc(AnnotatedElement holder) {
Groovydoc groovydocAnnotation = holder.<Groovydoc>getAnnotation(Groovydoc.class);
return null == groovydocAnnotation
? EMPTY_GROOVYDOC
: new groovy.lang.groovydoc.Groovydoc(groovydocAnnotation.value(), holder);
}
|
[
"public",
"static",
"groovy",
".",
"lang",
".",
"groovydoc",
".",
"Groovydoc",
"getGroovydoc",
"(",
"AnnotatedElement",
"holder",
")",
"{",
"Groovydoc",
"groovydocAnnotation",
"=",
"holder",
".",
"<",
"Groovydoc",
">",
"getAnnotation",
"(",
"Groovydoc",
".",
"class",
")",
";",
"return",
"null",
"==",
"groovydocAnnotation",
"?",
"EMPTY_GROOVYDOC",
":",
"new",
"groovy",
".",
"lang",
".",
"groovydoc",
".",
"Groovydoc",
"(",
"groovydocAnnotation",
".",
"value",
"(",
")",
",",
"holder",
")",
";",
"}"
] |
Get runtime groovydoc
@param holder the groovydoc hold
@return runtime groovydoc
@since 2.6.0
|
[
"Get",
"runtime",
"groovydoc"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L17877-L17883
|
12,771
|
apache/groovy
|
src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberMultiply.java
|
NumberNumberMultiply.multiply
|
public static Number multiply(Number left, Number right) {
return NumberMath.multiply(left, right);
}
|
java
|
public static Number multiply(Number left, Number right) {
return NumberMath.multiply(left, right);
}
|
[
"public",
"static",
"Number",
"multiply",
"(",
"Number",
"left",
",",
"Number",
"right",
")",
"{",
"return",
"NumberMath",
".",
"multiply",
"(",
"left",
",",
"right",
")",
";",
"}"
] |
those classes implement a method with a better exact match.
|
[
"those",
"classes",
"implement",
"a",
"method",
"with",
"a",
"better",
"exact",
"match",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberMultiply.java#L44-L46
|
12,772
|
apache/groovy
|
subprojects/groovy-servlet/src/main/java/groovy/servlet/AbstractHttpServlet.java
|
AbstractHttpServlet.getResourceConnection
|
public URLConnection getResourceConnection (String name) throws ResourceException {
name = removeNamePrefix(name).replace('\\', '/');
//remove the leading / as we are trying with a leading / now
if (name.startsWith("WEB-INF/groovy/")) {
name = name.substring(15);//just for uniformity
} else if (name.startsWith("/")) {
name = name.substring(1);
}
/*
* Try to locate the resource and return an opened connection to it.
*/
try {
URL url = servletContext.getResource('/' + name);
if (url == null) {
url = servletContext.getResource("/WEB-INF/groovy/" + name);
}
if (url == null) {
throw new ResourceException("Resource \"" + name + "\" not found!");
}
return url.openConnection();
} catch (IOException e) {
throw new ResourceException("Problems getting resource named \"" + name + "\"!", e);
}
}
|
java
|
public URLConnection getResourceConnection (String name) throws ResourceException {
name = removeNamePrefix(name).replace('\\', '/');
//remove the leading / as we are trying with a leading / now
if (name.startsWith("WEB-INF/groovy/")) {
name = name.substring(15);//just for uniformity
} else if (name.startsWith("/")) {
name = name.substring(1);
}
/*
* Try to locate the resource and return an opened connection to it.
*/
try {
URL url = servletContext.getResource('/' + name);
if (url == null) {
url = servletContext.getResource("/WEB-INF/groovy/" + name);
}
if (url == null) {
throw new ResourceException("Resource \"" + name + "\" not found!");
}
return url.openConnection();
} catch (IOException e) {
throw new ResourceException("Problems getting resource named \"" + name + "\"!", e);
}
}
|
[
"public",
"URLConnection",
"getResourceConnection",
"(",
"String",
"name",
")",
"throws",
"ResourceException",
"{",
"name",
"=",
"removeNamePrefix",
"(",
"name",
")",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"//remove the leading / as we are trying with a leading / now",
"if",
"(",
"name",
".",
"startsWith",
"(",
"\"WEB-INF/groovy/\"",
")",
")",
"{",
"name",
"=",
"name",
".",
"substring",
"(",
"15",
")",
";",
"//just for uniformity",
"}",
"else",
"if",
"(",
"name",
".",
"startsWith",
"(",
"\"/\"",
")",
")",
"{",
"name",
"=",
"name",
".",
"substring",
"(",
"1",
")",
";",
"}",
"/*\n * Try to locate the resource and return an opened connection to it.\n */",
"try",
"{",
"URL",
"url",
"=",
"servletContext",
".",
"getResource",
"(",
"'",
"'",
"+",
"name",
")",
";",
"if",
"(",
"url",
"==",
"null",
")",
"{",
"url",
"=",
"servletContext",
".",
"getResource",
"(",
"\"/WEB-INF/groovy/\"",
"+",
"name",
")",
";",
"}",
"if",
"(",
"url",
"==",
"null",
")",
"{",
"throw",
"new",
"ResourceException",
"(",
"\"Resource \\\"\"",
"+",
"name",
"+",
"\"\\\" not found!\"",
")",
";",
"}",
"return",
"url",
".",
"openConnection",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"ResourceException",
"(",
"\"Problems getting resource named \\\"\"",
"+",
"name",
"+",
"\"\\\"!\"",
",",
"e",
")",
";",
"}",
"}"
] |
Interface method for ResourceContainer. This is used by the GroovyScriptEngine.
|
[
"Interface",
"method",
"for",
"ResourceContainer",
".",
"This",
"is",
"used",
"by",
"the",
"GroovyScriptEngine",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-servlet/src/main/java/groovy/servlet/AbstractHttpServlet.java#L206-L231
|
12,773
|
apache/groovy
|
subprojects/groovy-servlet/src/main/java/groovy/servlet/AbstractHttpServlet.java
|
AbstractHttpServlet.getScriptUri
|
protected String getScriptUri(HttpServletRequest request) {
/*
* Log some debug information for https://issues.apache.org/jira/browse/GROOVY-861
*/
if (logGROOVY861) {
log("Logging request class and its class loader:");
log(" c = request.getClass() :\"" + request.getClass() + "\"");
log(" l = c.getClassLoader() :\"" + request.getClass().getClassLoader() + "\"");
log(" l.getClass() :\"" + request.getClass().getClassLoader().getClass() + "\"");
/*
* Keep logging, if we're verbose. Else turn it off.
*/
logGROOVY861 = verbose;
}
//
// NOTE: This piece of code is heavily inspired by Apaches Jasper2!
//
// http://cvs.apache.org/viewcvs.cgi/jakarta-tomcat-jasper/jasper2/ \
// src/share/org/apache/jasper/servlet/JspServlet.java?view=markup
//
// Why doesn't it use request.getRequestURI() or INC_REQUEST_URI?
//
String uri = null;
String info = null;
//
// Check to see if the requested script/template source file has been the
// target of a RequestDispatcher.include().
//
uri = (String) request.getAttribute(INC_SERVLET_PATH);
if (uri != null) {
//
// Requested script/template file has been target of
// RequestDispatcher.include(). Its path is assembled from the relevant
// javax.servlet.include.* request attributes and returned!
//
info = (String) request.getAttribute(INC_PATH_INFO);
if (info != null) {
uri += info;
}
return applyResourceNameMatcher(uri);
}
//
// Requested script/template file has not been the target of a
// RequestDispatcher.include(). Reconstruct its path from the request's
// getServletPath() and getPathInfo() results.
//
uri = request.getServletPath();
info = request.getPathInfo();
if (info != null) {
uri += info;
}
/*
* TODO : Enable auto ".groovy" extension replacing here!
* http://cvs.groovy.codehaus.org/viewrep/groovy/groovy/groovy-core/src/main/groovy/servlet/GroovyServlet.java?r=1.10#l259
*/
return applyResourceNameMatcher(uri);
}
|
java
|
protected String getScriptUri(HttpServletRequest request) {
/*
* Log some debug information for https://issues.apache.org/jira/browse/GROOVY-861
*/
if (logGROOVY861) {
log("Logging request class and its class loader:");
log(" c = request.getClass() :\"" + request.getClass() + "\"");
log(" l = c.getClassLoader() :\"" + request.getClass().getClassLoader() + "\"");
log(" l.getClass() :\"" + request.getClass().getClassLoader().getClass() + "\"");
/*
* Keep logging, if we're verbose. Else turn it off.
*/
logGROOVY861 = verbose;
}
//
// NOTE: This piece of code is heavily inspired by Apaches Jasper2!
//
// http://cvs.apache.org/viewcvs.cgi/jakarta-tomcat-jasper/jasper2/ \
// src/share/org/apache/jasper/servlet/JspServlet.java?view=markup
//
// Why doesn't it use request.getRequestURI() or INC_REQUEST_URI?
//
String uri = null;
String info = null;
//
// Check to see if the requested script/template source file has been the
// target of a RequestDispatcher.include().
//
uri = (String) request.getAttribute(INC_SERVLET_PATH);
if (uri != null) {
//
// Requested script/template file has been target of
// RequestDispatcher.include(). Its path is assembled from the relevant
// javax.servlet.include.* request attributes and returned!
//
info = (String) request.getAttribute(INC_PATH_INFO);
if (info != null) {
uri += info;
}
return applyResourceNameMatcher(uri);
}
//
// Requested script/template file has not been the target of a
// RequestDispatcher.include(). Reconstruct its path from the request's
// getServletPath() and getPathInfo() results.
//
uri = request.getServletPath();
info = request.getPathInfo();
if (info != null) {
uri += info;
}
/*
* TODO : Enable auto ".groovy" extension replacing here!
* http://cvs.groovy.codehaus.org/viewrep/groovy/groovy/groovy-core/src/main/groovy/servlet/GroovyServlet.java?r=1.10#l259
*/
return applyResourceNameMatcher(uri);
}
|
[
"protected",
"String",
"getScriptUri",
"(",
"HttpServletRequest",
"request",
")",
"{",
"/*\n * Log some debug information for https://issues.apache.org/jira/browse/GROOVY-861\n */",
"if",
"(",
"logGROOVY861",
")",
"{",
"log",
"(",
"\"Logging request class and its class loader:\"",
")",
";",
"log",
"(",
"\" c = request.getClass() :\\\"\"",
"+",
"request",
".",
"getClass",
"(",
")",
"+",
"\"\\\"\"",
")",
";",
"log",
"(",
"\" l = c.getClassLoader() :\\\"\"",
"+",
"request",
".",
"getClass",
"(",
")",
".",
"getClassLoader",
"(",
")",
"+",
"\"\\\"\"",
")",
";",
"log",
"(",
"\" l.getClass() :\\\"\"",
"+",
"request",
".",
"getClass",
"(",
")",
".",
"getClassLoader",
"(",
")",
".",
"getClass",
"(",
")",
"+",
"\"\\\"\"",
")",
";",
"/*\n * Keep logging, if we're verbose. Else turn it off.\n */",
"logGROOVY861",
"=",
"verbose",
";",
"}",
"//",
"// NOTE: This piece of code is heavily inspired by Apaches Jasper2!",
"// ",
"// http://cvs.apache.org/viewcvs.cgi/jakarta-tomcat-jasper/jasper2/ \\",
"// src/share/org/apache/jasper/servlet/JspServlet.java?view=markup",
"//",
"// Why doesn't it use request.getRequestURI() or INC_REQUEST_URI?",
"//",
"String",
"uri",
"=",
"null",
";",
"String",
"info",
"=",
"null",
";",
"//",
"// Check to see if the requested script/template source file has been the",
"// target of a RequestDispatcher.include().",
"//",
"uri",
"=",
"(",
"String",
")",
"request",
".",
"getAttribute",
"(",
"INC_SERVLET_PATH",
")",
";",
"if",
"(",
"uri",
"!=",
"null",
")",
"{",
"//",
"// Requested script/template file has been target of ",
"// RequestDispatcher.include(). Its path is assembled from the relevant",
"// javax.servlet.include.* request attributes and returned!",
"//",
"info",
"=",
"(",
"String",
")",
"request",
".",
"getAttribute",
"(",
"INC_PATH_INFO",
")",
";",
"if",
"(",
"info",
"!=",
"null",
")",
"{",
"uri",
"+=",
"info",
";",
"}",
"return",
"applyResourceNameMatcher",
"(",
"uri",
")",
";",
"}",
"//",
"// Requested script/template file has not been the target of a ",
"// RequestDispatcher.include(). Reconstruct its path from the request's",
"// getServletPath() and getPathInfo() results.",
"//",
"uri",
"=",
"request",
".",
"getServletPath",
"(",
")",
";",
"info",
"=",
"request",
".",
"getPathInfo",
"(",
")",
";",
"if",
"(",
"info",
"!=",
"null",
")",
"{",
"uri",
"+=",
"info",
";",
"}",
"/*\n * TODO : Enable auto \".groovy\" extension replacing here!\n * http://cvs.groovy.codehaus.org/viewrep/groovy/groovy/groovy-core/src/main/groovy/servlet/GroovyServlet.java?r=1.10#l259\n */",
"return",
"applyResourceNameMatcher",
"(",
"uri",
")",
";",
"}"
] |
Returns the include-aware uri of the script or template file.
@param request the http request to analyze
@return the include-aware uri either parsed from request attributes or
hints provided by the servlet container
|
[
"Returns",
"the",
"include",
"-",
"aware",
"uri",
"of",
"the",
"script",
"or",
"template",
"file",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-servlet/src/main/java/groovy/servlet/AbstractHttpServlet.java#L240-L302
|
12,774
|
apache/groovy
|
subprojects/groovy-servlet/src/main/java/groovy/servlet/AbstractHttpServlet.java
|
AbstractHttpServlet.getScriptUriAsFile
|
protected File getScriptUriAsFile(HttpServletRequest request) {
String uri = getScriptUri(request);
String real = servletContext.getRealPath(uri);
if (real == null) {
return null;
}
return new File(real).getAbsoluteFile();
}
|
java
|
protected File getScriptUriAsFile(HttpServletRequest request) {
String uri = getScriptUri(request);
String real = servletContext.getRealPath(uri);
if (real == null) {
return null;
}
return new File(real).getAbsoluteFile();
}
|
[
"protected",
"File",
"getScriptUriAsFile",
"(",
"HttpServletRequest",
"request",
")",
"{",
"String",
"uri",
"=",
"getScriptUri",
"(",
"request",
")",
";",
"String",
"real",
"=",
"servletContext",
".",
"getRealPath",
"(",
"uri",
")",
";",
"if",
"(",
"real",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"File",
"(",
"real",
")",
".",
"getAbsoluteFile",
"(",
")",
";",
"}"
] |
Parses the http request for the real script or template source file.
@param request
the http request to analyze
@return a file object using an absolute file path name, or <code>null</code> if the
servlet container cannot translate the virtual path to a real
path for any reason (such as when the content is being made
available from a .war archive).
|
[
"Parses",
"the",
"http",
"request",
"for",
"the",
"real",
"script",
"or",
"template",
"source",
"file",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-servlet/src/main/java/groovy/servlet/AbstractHttpServlet.java#L334-L341
|
12,775
|
apache/groovy
|
subprojects/groovy-servlet/src/main/java/groovy/servlet/AbstractHttpServlet.java
|
AbstractHttpServlet.init
|
public void init(ServletConfig config) throws ServletException {
/*
* Never forget super.init()!
*/
super.init(config);
/*
* Grab the servlet context.
*/
this.servletContext = config.getServletContext();
// Get verbosity hint.
String value = config.getInitParameter("verbose");
if (value != null) {
this.verbose = Boolean.valueOf(value);
}
// get encoding
value = config.getInitParameter("encoding");
if (value != null) {
this.encoding = value;
}
// And now the real init work...
if (verbose) {
log("Parsing init parameters...");
}
String regex = config.getInitParameter(INIT_PARAM_RESOURCE_NAME_REGEX);
if (regex != null) {
String replacement = config.getInitParameter("resource.name.replacement");
if (replacement == null) {
Exception npex = new NullPointerException("resource.name.replacement");
String message = "Init-param 'resource.name.replacement' not specified!";
log(message, npex);
throw new ServletException(message, npex);
} else if ("EMPTY_STRING".equals(replacement)) {//<param-value></param-value> is prohibited
replacement = "";
}
int flags = 0; // TODO : Parse pattern compile flags (literal names).
String flagsStr = config.getInitParameter(INIT_PARAM_RESOURCE_NAME_REGEX_FLAGS);
if (flagsStr != null && flagsStr.length() > 0) {
flags = Integer.decode(flagsStr.trim());//throws NumberFormatException
}
resourceNamePattern = Pattern.compile(regex, flags);
this.resourceNameReplacement = replacement;
String all = config.getInitParameter("resource.name.replace.all");
if (all != null) {
this.resourceNameReplaceAll = Boolean.valueOf(all.trim());
}
}
value = config.getInitParameter("logGROOVY861");
if (value != null) {
this.logGROOVY861 = Boolean.valueOf(value);
// nothing else to do here
}
/*
* If verbose, log the parameter values.
*/
if (verbose) {
log("(Abstract) init done. Listing some parameter name/value pairs:");
log("verbose = " + verbose); // this *is* verbose! ;)
log("reflection = " + reflection);
log("logGROOVY861 = " + logGROOVY861);
log(INIT_PARAM_RESOURCE_NAME_REGEX + " = " + resourceNamePattern);//toString == pattern
log("resource.name.replacement = " + resourceNameReplacement);
}
}
|
java
|
public void init(ServletConfig config) throws ServletException {
/*
* Never forget super.init()!
*/
super.init(config);
/*
* Grab the servlet context.
*/
this.servletContext = config.getServletContext();
// Get verbosity hint.
String value = config.getInitParameter("verbose");
if (value != null) {
this.verbose = Boolean.valueOf(value);
}
// get encoding
value = config.getInitParameter("encoding");
if (value != null) {
this.encoding = value;
}
// And now the real init work...
if (verbose) {
log("Parsing init parameters...");
}
String regex = config.getInitParameter(INIT_PARAM_RESOURCE_NAME_REGEX);
if (regex != null) {
String replacement = config.getInitParameter("resource.name.replacement");
if (replacement == null) {
Exception npex = new NullPointerException("resource.name.replacement");
String message = "Init-param 'resource.name.replacement' not specified!";
log(message, npex);
throw new ServletException(message, npex);
} else if ("EMPTY_STRING".equals(replacement)) {//<param-value></param-value> is prohibited
replacement = "";
}
int flags = 0; // TODO : Parse pattern compile flags (literal names).
String flagsStr = config.getInitParameter(INIT_PARAM_RESOURCE_NAME_REGEX_FLAGS);
if (flagsStr != null && flagsStr.length() > 0) {
flags = Integer.decode(flagsStr.trim());//throws NumberFormatException
}
resourceNamePattern = Pattern.compile(regex, flags);
this.resourceNameReplacement = replacement;
String all = config.getInitParameter("resource.name.replace.all");
if (all != null) {
this.resourceNameReplaceAll = Boolean.valueOf(all.trim());
}
}
value = config.getInitParameter("logGROOVY861");
if (value != null) {
this.logGROOVY861 = Boolean.valueOf(value);
// nothing else to do here
}
/*
* If verbose, log the parameter values.
*/
if (verbose) {
log("(Abstract) init done. Listing some parameter name/value pairs:");
log("verbose = " + verbose); // this *is* verbose! ;)
log("reflection = " + reflection);
log("logGROOVY861 = " + logGROOVY861);
log(INIT_PARAM_RESOURCE_NAME_REGEX + " = " + resourceNamePattern);//toString == pattern
log("resource.name.replacement = " + resourceNameReplacement);
}
}
|
[
"public",
"void",
"init",
"(",
"ServletConfig",
"config",
")",
"throws",
"ServletException",
"{",
"/*\n * Never forget super.init()!\n */",
"super",
".",
"init",
"(",
"config",
")",
";",
"/*\n * Grab the servlet context.\n */",
"this",
".",
"servletContext",
"=",
"config",
".",
"getServletContext",
"(",
")",
";",
"// Get verbosity hint.",
"String",
"value",
"=",
"config",
".",
"getInitParameter",
"(",
"\"verbose\"",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"this",
".",
"verbose",
"=",
"Boolean",
".",
"valueOf",
"(",
"value",
")",
";",
"}",
"// get encoding",
"value",
"=",
"config",
".",
"getInitParameter",
"(",
"\"encoding\"",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"this",
".",
"encoding",
"=",
"value",
";",
"}",
"// And now the real init work...",
"if",
"(",
"verbose",
")",
"{",
"log",
"(",
"\"Parsing init parameters...\"",
")",
";",
"}",
"String",
"regex",
"=",
"config",
".",
"getInitParameter",
"(",
"INIT_PARAM_RESOURCE_NAME_REGEX",
")",
";",
"if",
"(",
"regex",
"!=",
"null",
")",
"{",
"String",
"replacement",
"=",
"config",
".",
"getInitParameter",
"(",
"\"resource.name.replacement\"",
")",
";",
"if",
"(",
"replacement",
"==",
"null",
")",
"{",
"Exception",
"npex",
"=",
"new",
"NullPointerException",
"(",
"\"resource.name.replacement\"",
")",
";",
"String",
"message",
"=",
"\"Init-param 'resource.name.replacement' not specified!\"",
";",
"log",
"(",
"message",
",",
"npex",
")",
";",
"throw",
"new",
"ServletException",
"(",
"message",
",",
"npex",
")",
";",
"}",
"else",
"if",
"(",
"\"EMPTY_STRING\"",
".",
"equals",
"(",
"replacement",
")",
")",
"{",
"//<param-value></param-value> is prohibited",
"replacement",
"=",
"\"\"",
";",
"}",
"int",
"flags",
"=",
"0",
";",
"// TODO : Parse pattern compile flags (literal names).",
"String",
"flagsStr",
"=",
"config",
".",
"getInitParameter",
"(",
"INIT_PARAM_RESOURCE_NAME_REGEX_FLAGS",
")",
";",
"if",
"(",
"flagsStr",
"!=",
"null",
"&&",
"flagsStr",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"flags",
"=",
"Integer",
".",
"decode",
"(",
"flagsStr",
".",
"trim",
"(",
")",
")",
";",
"//throws NumberFormatException",
"}",
"resourceNamePattern",
"=",
"Pattern",
".",
"compile",
"(",
"regex",
",",
"flags",
")",
";",
"this",
".",
"resourceNameReplacement",
"=",
"replacement",
";",
"String",
"all",
"=",
"config",
".",
"getInitParameter",
"(",
"\"resource.name.replace.all\"",
")",
";",
"if",
"(",
"all",
"!=",
"null",
")",
"{",
"this",
".",
"resourceNameReplaceAll",
"=",
"Boolean",
".",
"valueOf",
"(",
"all",
".",
"trim",
"(",
")",
")",
";",
"}",
"}",
"value",
"=",
"config",
".",
"getInitParameter",
"(",
"\"logGROOVY861\"",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"this",
".",
"logGROOVY861",
"=",
"Boolean",
".",
"valueOf",
"(",
"value",
")",
";",
"// nothing else to do here",
"}",
"/*\n * If verbose, log the parameter values.\n */",
"if",
"(",
"verbose",
")",
"{",
"log",
"(",
"\"(Abstract) init done. Listing some parameter name/value pairs:\"",
")",
";",
"log",
"(",
"\"verbose = \"",
"+",
"verbose",
")",
";",
"// this *is* verbose! ;)",
"log",
"(",
"\"reflection = \"",
"+",
"reflection",
")",
";",
"log",
"(",
"\"logGROOVY861 = \"",
"+",
"logGROOVY861",
")",
";",
"log",
"(",
"INIT_PARAM_RESOURCE_NAME_REGEX",
"+",
"\" = \"",
"+",
"resourceNamePattern",
")",
";",
"//toString == pattern",
"log",
"(",
"\"resource.name.replacement = \"",
"+",
"resourceNameReplacement",
")",
";",
"}",
"}"
] |
Overrides the generic init method to set some debug flags.
@param config the servlet configuration provided by the container
@throws ServletException if init() method defined in super class
javax.servlet.GenericServlet throws it
|
[
"Overrides",
"the",
"generic",
"init",
"method",
"to",
"set",
"some",
"debug",
"flags",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-servlet/src/main/java/groovy/servlet/AbstractHttpServlet.java#L350-L419
|
12,776
|
apache/groovy
|
src/main/groovy/groovy/lang/GroovyClassLoader.java
|
GroovyClassLoader.parseClass
|
public Class parseClass(File file) throws CompilationFailedException, IOException {
return parseClass(new GroovyCodeSource(file, config.getSourceEncoding()));
}
|
java
|
public Class parseClass(File file) throws CompilationFailedException, IOException {
return parseClass(new GroovyCodeSource(file, config.getSourceEncoding()));
}
|
[
"public",
"Class",
"parseClass",
"(",
"File",
"file",
")",
"throws",
"CompilationFailedException",
",",
"IOException",
"{",
"return",
"parseClass",
"(",
"new",
"GroovyCodeSource",
"(",
"file",
",",
"config",
".",
"getSourceEncoding",
"(",
")",
")",
")",
";",
"}"
] |
Parses the given file into a Java class capable of being run
@param file the file name to parse
@return the main class defined in the given script
|
[
"Parses",
"the",
"given",
"file",
"into",
"a",
"Java",
"class",
"capable",
"of",
"being",
"run"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/GroovyClassLoader.java#L233-L235
|
12,777
|
apache/groovy
|
src/main/groovy/groovy/lang/GroovyClassLoader.java
|
GroovyClassLoader.getClassPath
|
protected String[] getClassPath() {
//workaround for Groovy-835
URL[] urls = getURLs();
String[] ret = new String[urls.length];
for (int i = 0; i < ret.length; i++) {
ret[i] = urls[i].getFile();
}
return ret;
}
|
java
|
protected String[] getClassPath() {
//workaround for Groovy-835
URL[] urls = getURLs();
String[] ret = new String[urls.length];
for (int i = 0; i < ret.length; i++) {
ret[i] = urls[i].getFile();
}
return ret;
}
|
[
"protected",
"String",
"[",
"]",
"getClassPath",
"(",
")",
"{",
"//workaround for Groovy-835",
"URL",
"[",
"]",
"urls",
"=",
"getURLs",
"(",
")",
";",
"String",
"[",
"]",
"ret",
"=",
"new",
"String",
"[",
"urls",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ret",
".",
"length",
";",
"i",
"++",
")",
"{",
"ret",
"[",
"i",
"]",
"=",
"urls",
"[",
"i",
"]",
".",
"getFile",
"(",
")",
";",
"}",
"return",
"ret",
";",
"}"
] |
gets the currently used classpath.
@return a String[] containing the file information of the urls
@see #getURLs()
|
[
"gets",
"the",
"currently",
"used",
"classpath",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/GroovyClassLoader.java#L428-L436
|
12,778
|
apache/groovy
|
src/main/groovy/groovy/lang/GroovyClassLoader.java
|
GroovyClassLoader.createCollector
|
protected ClassCollector createCollector(CompilationUnit unit, SourceUnit su) {
InnerLoader loader = AccessController.doPrivileged(new PrivilegedAction<InnerLoader>() {
public InnerLoader run() {
return new InnerLoader(GroovyClassLoader.this);
}
});
return new ClassCollector(loader, unit, su);
}
|
java
|
protected ClassCollector createCollector(CompilationUnit unit, SourceUnit su) {
InnerLoader loader = AccessController.doPrivileged(new PrivilegedAction<InnerLoader>() {
public InnerLoader run() {
return new InnerLoader(GroovyClassLoader.this);
}
});
return new ClassCollector(loader, unit, su);
}
|
[
"protected",
"ClassCollector",
"createCollector",
"(",
"CompilationUnit",
"unit",
",",
"SourceUnit",
"su",
")",
"{",
"InnerLoader",
"loader",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"InnerLoader",
">",
"(",
")",
"{",
"public",
"InnerLoader",
"run",
"(",
")",
"{",
"return",
"new",
"InnerLoader",
"(",
"GroovyClassLoader",
".",
"this",
")",
";",
"}",
"}",
")",
";",
"return",
"new",
"ClassCollector",
"(",
"loader",
",",
"unit",
",",
"su",
")",
";",
"}"
] |
creates a ClassCollector for a new compilation.
@param unit the compilationUnit
@param su the SourceUnit
@return the ClassCollector
|
[
"creates",
"a",
"ClassCollector",
"for",
"a",
"new",
"compilation",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/GroovyClassLoader.java#L557-L564
|
12,779
|
apache/groovy
|
src/main/groovy/groovy/lang/GroovyClassLoader.java
|
GroovyClassLoader.loadClass
|
public Class loadClass(final String name, boolean lookupScriptFiles, boolean preferClassOverScript, boolean resolve)
throws ClassNotFoundException, CompilationFailedException {
// look into cache
Class cls = getClassCacheEntry(name);
// enable recompilation?
boolean recompile = isRecompilable(cls);
if (!recompile) return cls;
// try parent loader
ClassNotFoundException last = null;
try {
Class parentClassLoaderClass = super.loadClass(name, resolve);
// always return if the parent loader was successful
if (cls != parentClassLoaderClass) return parentClassLoaderClass;
} catch (ClassNotFoundException cnfe) {
last = cnfe;
} catch (NoClassDefFoundError ncdfe) {
if (ncdfe.getMessage().indexOf("wrong name") > 0) {
last = new ClassNotFoundException(name);
} else {
throw ncdfe;
}
}
// check security manager
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
String className = name.replace('/', '.');
int i = className.lastIndexOf('.');
// no checks on the sun.reflect classes for reflection speed-up
// in particular ConstructorAccessorImpl, MethodAccessorImpl, FieldAccessorImpl and SerializationConstructorAccessorImpl
// which are generated at runtime by the JDK
if (i != -1 && !className.startsWith("sun.reflect.")) {
sm.checkPackageAccess(className.substring(0, i));
}
}
// prefer class if no recompilation
if (cls != null && preferClassOverScript) return cls;
// at this point the loading from a parent loader failed
// and we want to recompile if needed.
if (lookupScriptFiles) {
// try groovy file
try {
// check if recompilation already happened.
final Class classCacheEntry = getClassCacheEntry(name);
if (classCacheEntry != cls) return classCacheEntry;
URL source = resourceLoader.loadGroovySource(name);
// if recompilation fails, we want cls==null
Class oldClass = cls;
cls = null;
cls = recompile(source, name, oldClass);
} catch (IOException ioe) {
last = new ClassNotFoundException("IOException while opening groovy source: " + name, ioe);
} finally {
if (cls == null) {
removeClassCacheEntry(name);
} else {
setClassCacheEntry(cls);
}
}
}
if (cls == null) {
// no class found, there should have been an exception before now
if (last == null) throw new AssertionError(true);
throw last;
}
return cls;
}
|
java
|
public Class loadClass(final String name, boolean lookupScriptFiles, boolean preferClassOverScript, boolean resolve)
throws ClassNotFoundException, CompilationFailedException {
// look into cache
Class cls = getClassCacheEntry(name);
// enable recompilation?
boolean recompile = isRecompilable(cls);
if (!recompile) return cls;
// try parent loader
ClassNotFoundException last = null;
try {
Class parentClassLoaderClass = super.loadClass(name, resolve);
// always return if the parent loader was successful
if (cls != parentClassLoaderClass) return parentClassLoaderClass;
} catch (ClassNotFoundException cnfe) {
last = cnfe;
} catch (NoClassDefFoundError ncdfe) {
if (ncdfe.getMessage().indexOf("wrong name") > 0) {
last = new ClassNotFoundException(name);
} else {
throw ncdfe;
}
}
// check security manager
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
String className = name.replace('/', '.');
int i = className.lastIndexOf('.');
// no checks on the sun.reflect classes for reflection speed-up
// in particular ConstructorAccessorImpl, MethodAccessorImpl, FieldAccessorImpl and SerializationConstructorAccessorImpl
// which are generated at runtime by the JDK
if (i != -1 && !className.startsWith("sun.reflect.")) {
sm.checkPackageAccess(className.substring(0, i));
}
}
// prefer class if no recompilation
if (cls != null && preferClassOverScript) return cls;
// at this point the loading from a parent loader failed
// and we want to recompile if needed.
if (lookupScriptFiles) {
// try groovy file
try {
// check if recompilation already happened.
final Class classCacheEntry = getClassCacheEntry(name);
if (classCacheEntry != cls) return classCacheEntry;
URL source = resourceLoader.loadGroovySource(name);
// if recompilation fails, we want cls==null
Class oldClass = cls;
cls = null;
cls = recompile(source, name, oldClass);
} catch (IOException ioe) {
last = new ClassNotFoundException("IOException while opening groovy source: " + name, ioe);
} finally {
if (cls == null) {
removeClassCacheEntry(name);
} else {
setClassCacheEntry(cls);
}
}
}
if (cls == null) {
// no class found, there should have been an exception before now
if (last == null) throw new AssertionError(true);
throw last;
}
return cls;
}
|
[
"public",
"Class",
"loadClass",
"(",
"final",
"String",
"name",
",",
"boolean",
"lookupScriptFiles",
",",
"boolean",
"preferClassOverScript",
",",
"boolean",
"resolve",
")",
"throws",
"ClassNotFoundException",
",",
"CompilationFailedException",
"{",
"// look into cache",
"Class",
"cls",
"=",
"getClassCacheEntry",
"(",
"name",
")",
";",
"// enable recompilation?",
"boolean",
"recompile",
"=",
"isRecompilable",
"(",
"cls",
")",
";",
"if",
"(",
"!",
"recompile",
")",
"return",
"cls",
";",
"// try parent loader",
"ClassNotFoundException",
"last",
"=",
"null",
";",
"try",
"{",
"Class",
"parentClassLoaderClass",
"=",
"super",
".",
"loadClass",
"(",
"name",
",",
"resolve",
")",
";",
"// always return if the parent loader was successful",
"if",
"(",
"cls",
"!=",
"parentClassLoaderClass",
")",
"return",
"parentClassLoaderClass",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"cnfe",
")",
"{",
"last",
"=",
"cnfe",
";",
"}",
"catch",
"(",
"NoClassDefFoundError",
"ncdfe",
")",
"{",
"if",
"(",
"ncdfe",
".",
"getMessage",
"(",
")",
".",
"indexOf",
"(",
"\"wrong name\"",
")",
">",
"0",
")",
"{",
"last",
"=",
"new",
"ClassNotFoundException",
"(",
"name",
")",
";",
"}",
"else",
"{",
"throw",
"ncdfe",
";",
"}",
"}",
"// check security manager",
"SecurityManager",
"sm",
"=",
"System",
".",
"getSecurityManager",
"(",
")",
";",
"if",
"(",
"sm",
"!=",
"null",
")",
"{",
"String",
"className",
"=",
"name",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"int",
"i",
"=",
"className",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"// no checks on the sun.reflect classes for reflection speed-up",
"// in particular ConstructorAccessorImpl, MethodAccessorImpl, FieldAccessorImpl and SerializationConstructorAccessorImpl",
"// which are generated at runtime by the JDK",
"if",
"(",
"i",
"!=",
"-",
"1",
"&&",
"!",
"className",
".",
"startsWith",
"(",
"\"sun.reflect.\"",
")",
")",
"{",
"sm",
".",
"checkPackageAccess",
"(",
"className",
".",
"substring",
"(",
"0",
",",
"i",
")",
")",
";",
"}",
"}",
"// prefer class if no recompilation",
"if",
"(",
"cls",
"!=",
"null",
"&&",
"preferClassOverScript",
")",
"return",
"cls",
";",
"// at this point the loading from a parent loader failed",
"// and we want to recompile if needed.",
"if",
"(",
"lookupScriptFiles",
")",
"{",
"// try groovy file",
"try",
"{",
"// check if recompilation already happened.",
"final",
"Class",
"classCacheEntry",
"=",
"getClassCacheEntry",
"(",
"name",
")",
";",
"if",
"(",
"classCacheEntry",
"!=",
"cls",
")",
"return",
"classCacheEntry",
";",
"URL",
"source",
"=",
"resourceLoader",
".",
"loadGroovySource",
"(",
"name",
")",
";",
"// if recompilation fails, we want cls==null",
"Class",
"oldClass",
"=",
"cls",
";",
"cls",
"=",
"null",
";",
"cls",
"=",
"recompile",
"(",
"source",
",",
"name",
",",
"oldClass",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"last",
"=",
"new",
"ClassNotFoundException",
"(",
"\"IOException while opening groovy source: \"",
"+",
"name",
",",
"ioe",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"cls",
"==",
"null",
")",
"{",
"removeClassCacheEntry",
"(",
"name",
")",
";",
"}",
"else",
"{",
"setClassCacheEntry",
"(",
"cls",
")",
";",
"}",
"}",
"}",
"if",
"(",
"cls",
"==",
"null",
")",
"{",
"// no class found, there should have been an exception before now",
"if",
"(",
"last",
"==",
"null",
")",
"throw",
"new",
"AssertionError",
"(",
"true",
")",
";",
"throw",
"last",
";",
"}",
"return",
"cls",
";",
"}"
] |
loads a class from a file or a parent classloader.
@param name of the class to be loaded
@param lookupScriptFiles if false no lookup at files is done at all
@param preferClassOverScript if true the file lookup is only done if there is no class
@param resolve see {@link java.lang.ClassLoader#loadClass(java.lang.String, boolean)}
@return the class found or the class created from a file lookup
@throws ClassNotFoundException if the class could not be found
@throws CompilationFailedException if the source file could not be compiled
|
[
"loads",
"a",
"class",
"from",
"a",
"file",
"or",
"a",
"parent",
"classloader",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/GroovyClassLoader.java#L749-L820
|
12,780
|
apache/groovy
|
src/main/groovy/groovy/lang/GroovyClassLoader.java
|
GroovyClassLoader.loadClass
|
protected Class loadClass(final String name, boolean resolve) throws ClassNotFoundException {
return loadClass(name, true, true, resolve);
}
|
java
|
protected Class loadClass(final String name, boolean resolve) throws ClassNotFoundException {
return loadClass(name, true, true, resolve);
}
|
[
"protected",
"Class",
"loadClass",
"(",
"final",
"String",
"name",
",",
"boolean",
"resolve",
")",
"throws",
"ClassNotFoundException",
"{",
"return",
"loadClass",
"(",
"name",
",",
"true",
",",
"true",
",",
"resolve",
")",
";",
"}"
] |
Implemented here to check package access prior to returning an
already loaded class.
@throws CompilationFailedException if the compilation failed
@throws ClassNotFoundException if the class was not found
@see java.lang.ClassLoader#loadClass(java.lang.String, boolean)
|
[
"Implemented",
"here",
"to",
"check",
"package",
"access",
"prior",
"to",
"returning",
"an",
"already",
"loaded",
"class",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/GroovyClassLoader.java#L870-L872
|
12,781
|
apache/groovy
|
src/main/groovy/groovy/lang/GroovyClassLoader.java
|
GroovyClassLoader.isSourceNewer
|
protected boolean isSourceNewer(URL source, Class cls) throws IOException {
long lastMod;
// Special handling for file:// protocol, as getLastModified() often reports
// incorrect results (-1)
if (isFile(source)) {
// Coerce the file URL to a File
// See ClassNodeResolver.isSourceNewer for another method that replaces '|' with ':'.
// WTF: Why is this done and where is it documented?
String path = source.getPath().replace('/', File.separatorChar).replace('|', ':');
File file = new File(path);
lastMod = file.lastModified();
} else {
URLConnection conn = source.openConnection();
lastMod = conn.getLastModified();
conn.getInputStream().close();
}
long classTime = getTimeStamp(cls);
return classTime + config.getMinimumRecompilationInterval() < lastMod;
}
|
java
|
protected boolean isSourceNewer(URL source, Class cls) throws IOException {
long lastMod;
// Special handling for file:// protocol, as getLastModified() often reports
// incorrect results (-1)
if (isFile(source)) {
// Coerce the file URL to a File
// See ClassNodeResolver.isSourceNewer for another method that replaces '|' with ':'.
// WTF: Why is this done and where is it documented?
String path = source.getPath().replace('/', File.separatorChar).replace('|', ':');
File file = new File(path);
lastMod = file.lastModified();
} else {
URLConnection conn = source.openConnection();
lastMod = conn.getLastModified();
conn.getInputStream().close();
}
long classTime = getTimeStamp(cls);
return classTime + config.getMinimumRecompilationInterval() < lastMod;
}
|
[
"protected",
"boolean",
"isSourceNewer",
"(",
"URL",
"source",
",",
"Class",
"cls",
")",
"throws",
"IOException",
"{",
"long",
"lastMod",
";",
"// Special handling for file:// protocol, as getLastModified() often reports",
"// incorrect results (-1)",
"if",
"(",
"isFile",
"(",
"source",
")",
")",
"{",
"// Coerce the file URL to a File",
"// See ClassNodeResolver.isSourceNewer for another method that replaces '|' with ':'.",
"// WTF: Why is this done and where is it documented?",
"String",
"path",
"=",
"source",
".",
"getPath",
"(",
")",
".",
"replace",
"(",
"'",
"'",
",",
"File",
".",
"separatorChar",
")",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"File",
"file",
"=",
"new",
"File",
"(",
"path",
")",
";",
"lastMod",
"=",
"file",
".",
"lastModified",
"(",
")",
";",
"}",
"else",
"{",
"URLConnection",
"conn",
"=",
"source",
".",
"openConnection",
"(",
")",
";",
"lastMod",
"=",
"conn",
".",
"getLastModified",
"(",
")",
";",
"conn",
".",
"getInputStream",
"(",
")",
".",
"close",
"(",
")",
";",
"}",
"long",
"classTime",
"=",
"getTimeStamp",
"(",
"cls",
")",
";",
"return",
"classTime",
"+",
"config",
".",
"getMinimumRecompilationInterval",
"(",
")",
"<",
"lastMod",
";",
"}"
] |
Decides if the given source is newer than a class.
@param source the source we may want to compile
@param cls the former class
@return true if the source is newer, false else
@throws IOException if it is not possible to open an
connection for the given source
@see #getTimeStamp(Class)
|
[
"Decides",
"if",
"the",
"given",
"source",
"is",
"newer",
"than",
"a",
"class",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/GroovyClassLoader.java#L962-L981
|
12,782
|
apache/groovy
|
src/main/groovy/groovy/lang/GroovyClassLoader.java
|
GroovyClassLoader.addClasspath
|
public void addClasspath(final String path) {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
URI newURI;
try {
newURI = new URI(path);
// check if we can create a URL from that URI
newURI.toURL();
} catch (URISyntaxException | IllegalArgumentException | MalformedURLException e) {
// the URI has a false format, so lets try it with files ...
newURI=new File(path).toURI();
}
URL[] urls = getURLs();
for (URL url : urls) {
// Do not use URL.equals. It uses the network to resolve names and compares ip addresses!
// That is a violation of RFC and just plain evil.
// http://michaelscharf.blogspot.com/2006/11/javaneturlequals-and-hashcode-make.html
// http://docs.oracle.com/javase/7/docs/api/java/net/URL.html#equals(java.lang.Object)
// "Since hosts comparison requires name resolution, this operation is a blocking operation.
// Note: The defined behavior for equals is known to be inconsistent with virtual hosting in HTTP."
try {
if (newURI.equals(url.toURI())) return null;
} catch (URISyntaxException e) {
// fail fast! if we got a malformed URI the Classloader has to tell it
throw new RuntimeException( e );
}
}
try {
addURL(newURI.toURL());
} catch (MalformedURLException e) {
// fail fast! if we got a malformed URL the Classloader has to tell it
throw new RuntimeException( e );
}
return null;
}
});
}
|
java
|
public void addClasspath(final String path) {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
URI newURI;
try {
newURI = new URI(path);
// check if we can create a URL from that URI
newURI.toURL();
} catch (URISyntaxException | IllegalArgumentException | MalformedURLException e) {
// the URI has a false format, so lets try it with files ...
newURI=new File(path).toURI();
}
URL[] urls = getURLs();
for (URL url : urls) {
// Do not use URL.equals. It uses the network to resolve names and compares ip addresses!
// That is a violation of RFC and just plain evil.
// http://michaelscharf.blogspot.com/2006/11/javaneturlequals-and-hashcode-make.html
// http://docs.oracle.com/javase/7/docs/api/java/net/URL.html#equals(java.lang.Object)
// "Since hosts comparison requires name resolution, this operation is a blocking operation.
// Note: The defined behavior for equals is known to be inconsistent with virtual hosting in HTTP."
try {
if (newURI.equals(url.toURI())) return null;
} catch (URISyntaxException e) {
// fail fast! if we got a malformed URI the Classloader has to tell it
throw new RuntimeException( e );
}
}
try {
addURL(newURI.toURL());
} catch (MalformedURLException e) {
// fail fast! if we got a malformed URL the Classloader has to tell it
throw new RuntimeException( e );
}
return null;
}
});
}
|
[
"public",
"void",
"addClasspath",
"(",
"final",
"String",
"path",
")",
"{",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"Void",
">",
"(",
")",
"{",
"public",
"Void",
"run",
"(",
")",
"{",
"URI",
"newURI",
";",
"try",
"{",
"newURI",
"=",
"new",
"URI",
"(",
"path",
")",
";",
"// check if we can create a URL from that URI",
"newURI",
".",
"toURL",
"(",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"|",
"IllegalArgumentException",
"|",
"MalformedURLException",
"e",
")",
"{",
"// the URI has a false format, so lets try it with files ...",
"newURI",
"=",
"new",
"File",
"(",
"path",
")",
".",
"toURI",
"(",
")",
";",
"}",
"URL",
"[",
"]",
"urls",
"=",
"getURLs",
"(",
")",
";",
"for",
"(",
"URL",
"url",
":",
"urls",
")",
"{",
"// Do not use URL.equals. It uses the network to resolve names and compares ip addresses!",
"// That is a violation of RFC and just plain evil.",
"// http://michaelscharf.blogspot.com/2006/11/javaneturlequals-and-hashcode-make.html",
"// http://docs.oracle.com/javase/7/docs/api/java/net/URL.html#equals(java.lang.Object)",
"// \"Since hosts comparison requires name resolution, this operation is a blocking operation.",
"// Note: The defined behavior for equals is known to be inconsistent with virtual hosting in HTTP.\"",
"try",
"{",
"if",
"(",
"newURI",
".",
"equals",
"(",
"url",
".",
"toURI",
"(",
")",
")",
")",
"return",
"null",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"// fail fast! if we got a malformed URI the Classloader has to tell it",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}",
"try",
"{",
"addURL",
"(",
"newURI",
".",
"toURL",
"(",
")",
")",
";",
"}",
"catch",
"(",
"MalformedURLException",
"e",
")",
"{",
"// fail fast! if we got a malformed URL the Classloader has to tell it",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"return",
"null",
";",
"}",
"}",
")",
";",
"}"
] |
adds a classpath to this classloader.
@param path is a jar file or a directory.
@see #addURL(URL)
|
[
"adds",
"a",
"classpath",
"to",
"this",
"classloader",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/GroovyClassLoader.java#L989-L1027
|
12,783
|
apache/groovy
|
src/main/java/org/codehaus/groovy/util/CharSequenceReader.java
|
CharSequenceReader.read
|
@Override
public int read(final char[] array, final int offset, final int length) {
if (idx >= charSequence.length()) {
return EOF;
}
if (array == null) {
throw new NullPointerException("Character array is missing");
}
if (length < 0 || offset < 0 || offset + length > array.length) {
throw new IndexOutOfBoundsException("Array Size=" + array.length +
", offset=" + offset + ", length=" + length);
}
int count = 0;
for (int i = 0; i < length; i++) {
final int c = read();
if (c == EOF) {
return count;
}
array[offset + i] = (char)c;
count++;
}
return count;
}
|
java
|
@Override
public int read(final char[] array, final int offset, final int length) {
if (idx >= charSequence.length()) {
return EOF;
}
if (array == null) {
throw new NullPointerException("Character array is missing");
}
if (length < 0 || offset < 0 || offset + length > array.length) {
throw new IndexOutOfBoundsException("Array Size=" + array.length +
", offset=" + offset + ", length=" + length);
}
int count = 0;
for (int i = 0; i < length; i++) {
final int c = read();
if (c == EOF) {
return count;
}
array[offset + i] = (char)c;
count++;
}
return count;
}
|
[
"@",
"Override",
"public",
"int",
"read",
"(",
"final",
"char",
"[",
"]",
"array",
",",
"final",
"int",
"offset",
",",
"final",
"int",
"length",
")",
"{",
"if",
"(",
"idx",
">=",
"charSequence",
".",
"length",
"(",
")",
")",
"{",
"return",
"EOF",
";",
"}",
"if",
"(",
"array",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Character array is missing\"",
")",
";",
"}",
"if",
"(",
"length",
"<",
"0",
"||",
"offset",
"<",
"0",
"||",
"offset",
"+",
"length",
">",
"array",
".",
"length",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"Array Size=\"",
"+",
"array",
".",
"length",
"+",
"\", offset=\"",
"+",
"offset",
"+",
"\", length=\"",
"+",
"length",
")",
";",
"}",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"final",
"int",
"c",
"=",
"read",
"(",
")",
";",
"if",
"(",
"c",
"==",
"EOF",
")",
"{",
"return",
"count",
";",
"}",
"array",
"[",
"offset",
"+",
"i",
"]",
"=",
"(",
"char",
")",
"c",
";",
"count",
"++",
";",
"}",
"return",
"count",
";",
"}"
] |
Read the sepcified number of characters into the array.
@param array The array to store the characters in
@param offset The starting position in the array to store
@param length The maximum number of characters to read
@return The number of characters read or -1 if there are
no more
|
[
"Read",
"the",
"sepcified",
"number",
"of",
"characters",
"into",
"the",
"array",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/util/CharSequenceReader.java#L106-L128
|
12,784
|
apache/groovy
|
src/main/java/org/codehaus/groovy/util/CharSequenceReader.java
|
CharSequenceReader.skip
|
@Override
public long skip(final long n) {
if (n < 0) {
throw new IllegalArgumentException(
"Number of characters to skip is less than zero: " + n);
}
if (idx >= charSequence.length()) {
return EOF;
}
final int dest = (int)Math.min(charSequence.length(), idx + n);
final int count = dest - idx;
idx = dest;
return count;
}
|
java
|
@Override
public long skip(final long n) {
if (n < 0) {
throw new IllegalArgumentException(
"Number of characters to skip is less than zero: " + n);
}
if (idx >= charSequence.length()) {
return EOF;
}
final int dest = (int)Math.min(charSequence.length(), idx + n);
final int count = dest - idx;
idx = dest;
return count;
}
|
[
"@",
"Override",
"public",
"long",
"skip",
"(",
"final",
"long",
"n",
")",
"{",
"if",
"(",
"n",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Number of characters to skip is less than zero: \"",
"+",
"n",
")",
";",
"}",
"if",
"(",
"idx",
">=",
"charSequence",
".",
"length",
"(",
")",
")",
"{",
"return",
"EOF",
";",
"}",
"final",
"int",
"dest",
"=",
"(",
"int",
")",
"Math",
".",
"min",
"(",
"charSequence",
".",
"length",
"(",
")",
",",
"idx",
"+",
"n",
")",
";",
"final",
"int",
"count",
"=",
"dest",
"-",
"idx",
";",
"idx",
"=",
"dest",
";",
"return",
"count",
";",
"}"
] |
Skip the specified number of characters.
@param n The number of characters to skip
@return The actual number of characters skipped
|
[
"Skip",
"the",
"specified",
"number",
"of",
"characters",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/util/CharSequenceReader.java#L145-L158
|
12,785
|
apache/groovy
|
src/main/groovy/groovy/lang/ListWithDefault.java
|
ListWithDefault.subList
|
public ListWithDefault<T> subList(int fromIndex, int toIndex) {
return new ListWithDefault<T>(delegate.subList(fromIndex, toIndex), lazyDefaultValues, (Closure) initClosure.clone());
}
|
java
|
public ListWithDefault<T> subList(int fromIndex, int toIndex) {
return new ListWithDefault<T>(delegate.subList(fromIndex, toIndex), lazyDefaultValues, (Closure) initClosure.clone());
}
|
[
"public",
"ListWithDefault",
"<",
"T",
">",
"subList",
"(",
"int",
"fromIndex",
",",
"int",
"toIndex",
")",
"{",
"return",
"new",
"ListWithDefault",
"<",
"T",
">",
"(",
"delegate",
".",
"subList",
"(",
"fromIndex",
",",
"toIndex",
")",
",",
"lazyDefaultValues",
",",
"(",
"Closure",
")",
"initClosure",
".",
"clone",
"(",
")",
")",
";",
"}"
] |
Returns a view of a portion of this list. This method returns a list with the same
lazy list settings as the original list.
@param fromIndex low endpoint of the subList (inclusive)
@param toIndex upper endpoint of the subList (exclusive)
@return a view of a specified range within this list, keeping all lazy list settings
|
[
"Returns",
"a",
"view",
"of",
"a",
"portion",
"of",
"this",
"list",
".",
"This",
"method",
"returns",
"a",
"list",
"with",
"the",
"same",
"lazy",
"list",
"settings",
"as",
"the",
"original",
"list",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/ListWithDefault.java#L253-L255
|
12,786
|
apache/groovy
|
subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDoc.java
|
SimpleGroovyClassDoc.encodeAngleBracketsInTagBody
|
public static String encodeAngleBracketsInTagBody(String text, Pattern regex) {
Matcher matcher = regex.matcher(text);
if (matcher.find()) {
matcher.reset();
StringBuffer sb = new StringBuffer();
while (matcher.find()) {
String tagName = matcher.group(1);
String tagBody = matcher.group(2);
String encodedBody = Matcher.quoteReplacement(encodeAngleBrackets(tagBody));
String replacement = "{@" + tagName + " " + encodedBody + "}";
matcher.appendReplacement(sb, replacement);
}
matcher.appendTail(sb);
return sb.toString();
} else {
return text;
}
}
|
java
|
public static String encodeAngleBracketsInTagBody(String text, Pattern regex) {
Matcher matcher = regex.matcher(text);
if (matcher.find()) {
matcher.reset();
StringBuffer sb = new StringBuffer();
while (matcher.find()) {
String tagName = matcher.group(1);
String tagBody = matcher.group(2);
String encodedBody = Matcher.quoteReplacement(encodeAngleBrackets(tagBody));
String replacement = "{@" + tagName + " " + encodedBody + "}";
matcher.appendReplacement(sb, replacement);
}
matcher.appendTail(sb);
return sb.toString();
} else {
return text;
}
}
|
[
"public",
"static",
"String",
"encodeAngleBracketsInTagBody",
"(",
"String",
"text",
",",
"Pattern",
"regex",
")",
"{",
"Matcher",
"matcher",
"=",
"regex",
".",
"matcher",
"(",
"text",
")",
";",
"if",
"(",
"matcher",
".",
"find",
"(",
")",
")",
"{",
"matcher",
".",
"reset",
"(",
")",
";",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"while",
"(",
"matcher",
".",
"find",
"(",
")",
")",
"{",
"String",
"tagName",
"=",
"matcher",
".",
"group",
"(",
"1",
")",
";",
"String",
"tagBody",
"=",
"matcher",
".",
"group",
"(",
"2",
")",
";",
"String",
"encodedBody",
"=",
"Matcher",
".",
"quoteReplacement",
"(",
"encodeAngleBrackets",
"(",
"tagBody",
")",
")",
";",
"String",
"replacement",
"=",
"\"{@\"",
"+",
"tagName",
"+",
"\" \"",
"+",
"encodedBody",
"+",
"\"}\"",
";",
"matcher",
".",
"appendReplacement",
"(",
"sb",
",",
"replacement",
")",
";",
"}",
"matcher",
".",
"appendTail",
"(",
"sb",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"else",
"{",
"return",
"text",
";",
"}",
"}"
] |
Replaces angle brackets inside a tag.
@param text GroovyDoc text to process
@param regex has to capture tag name in group 1 and tag body in group 2
|
[
"Replaces",
"angle",
"brackets",
"inside",
"a",
"tag",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDoc.java#L952-L969
|
12,787
|
apache/groovy
|
src/main/groovy/groovy/util/ConfigObject.java
|
ConfigObject.getProperty
|
public Object getProperty(String name) {
if ("configFile".equals(name))
return this.configFile;
if (!containsKey(name)) {
ConfigObject prop = new ConfigObject(this.configFile);
put(name, prop);
return prop;
}
return get(name);
}
|
java
|
public Object getProperty(String name) {
if ("configFile".equals(name))
return this.configFile;
if (!containsKey(name)) {
ConfigObject prop = new ConfigObject(this.configFile);
put(name, prop);
return prop;
}
return get(name);
}
|
[
"public",
"Object",
"getProperty",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"\"configFile\"",
".",
"equals",
"(",
"name",
")",
")",
"return",
"this",
".",
"configFile",
";",
"if",
"(",
"!",
"containsKey",
"(",
"name",
")",
")",
"{",
"ConfigObject",
"prop",
"=",
"new",
"ConfigObject",
"(",
"this",
".",
"configFile",
")",
";",
"put",
"(",
"name",
",",
"prop",
")",
";",
"return",
"prop",
";",
"}",
"return",
"get",
"(",
"name",
")",
";",
"}"
] |
Overrides the default getProperty implementation to create nested ConfigObject instances on demand
for non-existent keys
|
[
"Overrides",
"the",
"default",
"getProperty",
"implementation",
"to",
"create",
"nested",
"ConfigObject",
"instances",
"on",
"demand",
"for",
"non",
"-",
"existent",
"keys"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/util/ConfigObject.java#L99-L111
|
12,788
|
apache/groovy
|
src/main/groovy/groovy/util/ConfigObject.java
|
ConfigObject.flatten
|
public Map flatten(Map target) {
if (target == null)
target = new ConfigObject();
populate("", target, this);
return target;
}
|
java
|
public Map flatten(Map target) {
if (target == null)
target = new ConfigObject();
populate("", target, this);
return target;
}
|
[
"public",
"Map",
"flatten",
"(",
"Map",
"target",
")",
"{",
"if",
"(",
"target",
"==",
"null",
")",
"target",
"=",
"new",
"ConfigObject",
"(",
")",
";",
"populate",
"(",
"\"\"",
",",
"target",
",",
"this",
")",
";",
"return",
"target",
";",
"}"
] |
Flattens this ConfigObject populating the results into the target Map
@see ConfigObject#flatten()
|
[
"Flattens",
"this",
"ConfigObject",
"populating",
"the",
"results",
"into",
"the",
"target",
"Map"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/util/ConfigObject.java#L126-L132
|
12,789
|
apache/groovy
|
src/main/groovy/groovy/util/ConfigObject.java
|
ConfigObject.toProperties
|
public Properties toProperties() {
Properties props = new Properties();
flatten(props);
props = convertValuesToString(props);
return props;
}
|
java
|
public Properties toProperties() {
Properties props = new Properties();
flatten(props);
props = convertValuesToString(props);
return props;
}
|
[
"public",
"Properties",
"toProperties",
"(",
")",
"{",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"flatten",
"(",
"props",
")",
";",
"props",
"=",
"convertValuesToString",
"(",
"props",
")",
";",
"return",
"props",
";",
"}"
] |
Converts this ConfigObject into a the java.util.Properties format, flattening the tree structure beforehand
@return A java.util.Properties instance
|
[
"Converts",
"this",
"ConfigObject",
"into",
"a",
"the",
"java",
".",
"util",
".",
"Properties",
"format",
"flattening",
"the",
"tree",
"structure",
"beforehand"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/util/ConfigObject.java#L150-L157
|
12,790
|
apache/groovy
|
src/main/groovy/groovy/util/ConfigObject.java
|
ConfigObject.toProperties
|
public Properties toProperties(String prefix) {
Properties props = new Properties();
populate(prefix + ".", props, this);
props = convertValuesToString(props);
return props;
}
|
java
|
public Properties toProperties(String prefix) {
Properties props = new Properties();
populate(prefix + ".", props, this);
props = convertValuesToString(props);
return props;
}
|
[
"public",
"Properties",
"toProperties",
"(",
"String",
"prefix",
")",
"{",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"populate",
"(",
"prefix",
"+",
"\".\"",
",",
"props",
",",
"this",
")",
";",
"props",
"=",
"convertValuesToString",
"(",
"props",
")",
";",
"return",
"props",
";",
"}"
] |
Converts this ConfigObject ino the java.util.Properties format, flatten the tree and prefixing all entries with the given prefix
@param prefix The prefix to append before property entries
@return A java.util.Properties instance
|
[
"Converts",
"this",
"ConfigObject",
"ino",
"the",
"java",
".",
"util",
".",
"Properties",
"format",
"flatten",
"the",
"tree",
"and",
"prefixing",
"all",
"entries",
"with",
"the",
"given",
"prefix"
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/util/ConfigObject.java#L165-L172
|
12,791
|
apache/groovy
|
src/main/java/org/codehaus/groovy/tools/FileSystemCompiler.java
|
FileSystemCompiler.displayVersion
|
public static void displayVersion(final PrintWriter writer) {
for (String line : new VersionProvider().getVersion()) {
writer.println(line);
}
}
|
java
|
public static void displayVersion(final PrintWriter writer) {
for (String line : new VersionProvider().getVersion()) {
writer.println(line);
}
}
|
[
"public",
"static",
"void",
"displayVersion",
"(",
"final",
"PrintWriter",
"writer",
")",
"{",
"for",
"(",
"String",
"line",
":",
"new",
"VersionProvider",
"(",
")",
".",
"getVersion",
"(",
")",
")",
"{",
"writer",
".",
"println",
"(",
"line",
")",
";",
"}",
"}"
] |
Prints version information to the specified PrintWriter.
@since 2.5
|
[
"Prints",
"version",
"information",
"to",
"the",
"specified",
"PrintWriter",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/tools/FileSystemCompiler.java#L101-L105
|
12,792
|
apache/groovy
|
subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java
|
SwingGroovyMethods.leftShift
|
public static Container leftShift(Container self, Component c) {
self.add(c);
return self;
}
|
java
|
public static Container leftShift(Container self, Component c) {
self.add(c);
return self;
}
|
[
"public",
"static",
"Container",
"leftShift",
"(",
"Container",
"self",
",",
"Component",
"c",
")",
"{",
"self",
".",
"add",
"(",
"c",
")",
";",
"return",
"self",
";",
"}"
] |
Overloads the left shift operator to provide an easy way to add
components to a Container.
@param self a Container
@param c a Component to be added to the container.
@return same container, after the value was added to it.
@since 1.6.4
|
[
"Overloads",
"the",
"left",
"shift",
"operator",
"to",
"provide",
"an",
"easy",
"way",
"to",
"add",
"components",
"to",
"a",
"Container",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L76-L79
|
12,793
|
apache/groovy
|
subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java
|
SwingGroovyMethods.getAt
|
public static AbstractButton getAt(ButtonGroup self, int index) {
int size = self.getButtonCount();
if (index < 0 || index >= size) return null;
Enumeration buttons = self.getElements();
for (int i = 0; i <= index; i++) {
AbstractButton b = (AbstractButton) buttons.nextElement();
if (i == index) return b;
}
return null;
}
|
java
|
public static AbstractButton getAt(ButtonGroup self, int index) {
int size = self.getButtonCount();
if (index < 0 || index >= size) return null;
Enumeration buttons = self.getElements();
for (int i = 0; i <= index; i++) {
AbstractButton b = (AbstractButton) buttons.nextElement();
if (i == index) return b;
}
return null;
}
|
[
"public",
"static",
"AbstractButton",
"getAt",
"(",
"ButtonGroup",
"self",
",",
"int",
"index",
")",
"{",
"int",
"size",
"=",
"self",
".",
"getButtonCount",
"(",
")",
";",
"if",
"(",
"index",
"<",
"0",
"||",
"index",
">=",
"size",
")",
"return",
"null",
";",
"Enumeration",
"buttons",
"=",
"self",
".",
"getElements",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<=",
"index",
";",
"i",
"++",
")",
"{",
"AbstractButton",
"b",
"=",
"(",
"AbstractButton",
")",
"buttons",
".",
"nextElement",
"(",
")",
";",
"if",
"(",
"i",
"==",
"index",
")",
"return",
"b",
";",
"}",
"return",
"null",
";",
"}"
] |
Support the subscript operator for ButtonGroup.
@param self a ButtonGroup
@param index the index of the AbstractButton to get
@return the button at the given index
@since 1.6.4
|
[
"Support",
"the",
"subscript",
"operator",
"for",
"ButtonGroup",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L121-L130
|
12,794
|
apache/groovy
|
subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java
|
SwingGroovyMethods.leftShift
|
public static ButtonGroup leftShift(ButtonGroup self, AbstractButton b) {
self.add(b);
return self;
}
|
java
|
public static ButtonGroup leftShift(ButtonGroup self, AbstractButton b) {
self.add(b);
return self;
}
|
[
"public",
"static",
"ButtonGroup",
"leftShift",
"(",
"ButtonGroup",
"self",
",",
"AbstractButton",
"b",
")",
"{",
"self",
".",
"add",
"(",
"b",
")",
";",
"return",
"self",
";",
"}"
] |
Overloads the left shift operator to provide an easy way to add
buttons to a ButtonGroup.
@param self a ButtonGroup
@param b an AbstractButton to be added to the buttonGroup.
@return same buttonGroup, after the value was added to it.
@since 1.6.4
|
[
"Overloads",
"the",
"left",
"shift",
"operator",
"to",
"provide",
"an",
"easy",
"way",
"to",
"add",
"buttons",
"to",
"a",
"ButtonGroup",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L141-L144
|
12,795
|
apache/groovy
|
subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java
|
SwingGroovyMethods.leftShift
|
public static DefaultListModel leftShift(DefaultListModel self, Object e) {
self.addElement(e);
return self;
}
|
java
|
public static DefaultListModel leftShift(DefaultListModel self, Object e) {
self.addElement(e);
return self;
}
|
[
"public",
"static",
"DefaultListModel",
"leftShift",
"(",
"DefaultListModel",
"self",
",",
"Object",
"e",
")",
"{",
"self",
".",
"addElement",
"(",
"e",
")",
";",
"return",
"self",
";",
"}"
] |
Overloads the left shift operator to provide an easy way to add
elements to a DefaultListModel.
@param self a DefaultListModel
@param e an element to be added to the listModel.
@return same listModel, after the value was added to it.
@since 1.6.4
|
[
"Overloads",
"the",
"left",
"shift",
"operator",
"to",
"provide",
"an",
"easy",
"way",
"to",
"add",
"elements",
"to",
"a",
"DefaultListModel",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L214-L217
|
12,796
|
apache/groovy
|
subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java
|
SwingGroovyMethods.leftShift
|
public static JComboBox leftShift(JComboBox self, Object i) {
self.addItem(i);
return self;
}
|
java
|
public static JComboBox leftShift(JComboBox self, Object i) {
self.addItem(i);
return self;
}
|
[
"public",
"static",
"JComboBox",
"leftShift",
"(",
"JComboBox",
"self",
",",
"Object",
"i",
")",
"{",
"self",
".",
"addItem",
"(",
"i",
")",
";",
"return",
"self",
";",
"}"
] |
Overloads the left shift operator to provide an easy way to add
items to a JComboBox.
@param self a JComboBox
@param i an item to be added to the comboBox.
@return same comboBox, after the value was added to it.
@since 1.6.4
|
[
"Overloads",
"the",
"left",
"shift",
"operator",
"to",
"provide",
"an",
"easy",
"way",
"to",
"add",
"items",
"to",
"a",
"JComboBox",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L301-L304
|
12,797
|
apache/groovy
|
subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java
|
SwingGroovyMethods.leftShift
|
public static MutableComboBoxModel leftShift(MutableComboBoxModel self, Object i) {
self.addElement(i);
return self;
}
|
java
|
public static MutableComboBoxModel leftShift(MutableComboBoxModel self, Object i) {
self.addElement(i);
return self;
}
|
[
"public",
"static",
"MutableComboBoxModel",
"leftShift",
"(",
"MutableComboBoxModel",
"self",
",",
"Object",
"i",
")",
"{",
"self",
".",
"addElement",
"(",
"i",
")",
";",
"return",
"self",
";",
"}"
] |
Overloads the left shift operator to provide an easy way to add
items to a MutableComboBoxModel.
@param self a MutableComboBoxModel
@param i an item to be added to the model.
@return same model, after the value was added to it.
@since 1.6.4
|
[
"Overloads",
"the",
"left",
"shift",
"operator",
"to",
"provide",
"an",
"easy",
"way",
"to",
"add",
"items",
"to",
"a",
"MutableComboBoxModel",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L336-L339
|
12,798
|
apache/groovy
|
subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java
|
SwingGroovyMethods.getAt
|
public static Object[] getAt(TableModel self, int index) {
int cols = self.getColumnCount();
Object[] rowData = new Object[cols];
for (int col = 0; col < cols; col++) {
rowData[col] = self.getValueAt(index, col);
}
return rowData;
}
|
java
|
public static Object[] getAt(TableModel self, int index) {
int cols = self.getColumnCount();
Object[] rowData = new Object[cols];
for (int col = 0; col < cols; col++) {
rowData[col] = self.getValueAt(index, col);
}
return rowData;
}
|
[
"public",
"static",
"Object",
"[",
"]",
"getAt",
"(",
"TableModel",
"self",
",",
"int",
"index",
")",
"{",
"int",
"cols",
"=",
"self",
".",
"getColumnCount",
"(",
")",
";",
"Object",
"[",
"]",
"rowData",
"=",
"new",
"Object",
"[",
"cols",
"]",
";",
"for",
"(",
"int",
"col",
"=",
"0",
";",
"col",
"<",
"cols",
";",
"col",
"++",
")",
"{",
"rowData",
"[",
"col",
"]",
"=",
"self",
".",
"getValueAt",
"(",
"index",
",",
"col",
")",
";",
"}",
"return",
"rowData",
";",
"}"
] |
Support the subscript operator for TableModel.
@param self a TableModel
@param index the index of the row to get
@return the row at the given index
@since 1.6.4
|
[
"Support",
"the",
"subscript",
"operator",
"for",
"TableModel",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L410-L417
|
12,799
|
apache/groovy
|
subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java
|
SwingGroovyMethods.leftShift
|
public static TableColumnModel leftShift(TableColumnModel self, TableColumn column) {
self.addColumn(column);
return self;
}
|
java
|
public static TableColumnModel leftShift(TableColumnModel self, TableColumn column) {
self.addColumn(column);
return self;
}
|
[
"public",
"static",
"TableColumnModel",
"leftShift",
"(",
"TableColumnModel",
"self",
",",
"TableColumn",
"column",
")",
"{",
"self",
".",
"addColumn",
"(",
"column",
")",
";",
"return",
"self",
";",
"}"
] |
Overloads the left shift operator to provide an easy way to add
columns to a TableColumnModel.
@param self a TableColumnModel
@param column a TableColumn to be added to the model.
@return same model, after the value was added to it.
@since 1.6.4
|
[
"Overloads",
"the",
"left",
"shift",
"operator",
"to",
"provide",
"an",
"easy",
"way",
"to",
"add",
"columns",
"to",
"a",
"TableColumnModel",
"."
] |
71cf20addb611bb8d097a59e395fd20bc7f31772
|
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L593-L596
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.