id int32 0 252k | repo stringlengths 7 58 | path stringlengths 4 218 | func_name stringlengths 1 140 | original_string stringlengths 73 34.1k | language stringclasses 2
values | code stringlengths 73 34.1k | code_tokens listlengths 20 4.08k | docstring stringlengths 3 17.3k | docstring_tokens listlengths 3 222 | sha stringlengths 40 40 | url stringlengths 87 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
0 | wg/scrypt | src/main/java/com/lambdaworks/crypto/SCryptUtil.java | SCryptUtil.check | public static boolean check(String passwd, String hashed) {
try {
String[] parts = hashed.split("\\$");
if (parts.length != 5 || !parts[1].equals("s0")) {
throw new IllegalArgumentException("Invalid hashed value");
}
long params = Long.parseLong(... | java | public static boolean check(String passwd, String hashed) {
try {
String[] parts = hashed.split("\\$");
if (parts.length != 5 || !parts[1].equals("s0")) {
throw new IllegalArgumentException("Invalid hashed value");
}
long params = Long.parseLong(... | [
"public",
"static",
"boolean",
"check",
"(",
"String",
"passwd",
",",
"String",
"hashed",
")",
"{",
"try",
"{",
"String",
"[",
"]",
"parts",
"=",
"hashed",
".",
"split",
"(",
"\"\\\\$\"",
")",
";",
"if",
"(",
"parts",
".",
"length",
"!=",
"5",
"||",
... | Compare the supplied plaintext password to a hashed password.
@param passwd Plaintext password.
@param hashed scrypt hashed password.
@return true if passwd matches hashed value. | [
"Compare",
"the",
"supplied",
"plaintext",
"password",
"to",
"a",
"hashed",
"password",
"."
] | 0675236370458e819ee21e4427c5f7f3f9485d33 | https://github.com/wg/scrypt/blob/0675236370458e819ee21e4427c5f7f3f9485d33/src/main/java/com/lambdaworks/crypto/SCryptUtil.java#L72-L102 |
1 | wg/scrypt | src/main/java/com/lambdaworks/jni/Platform.java | Platform.detect | public static Platform detect() throws UnsupportedPlatformException {
String osArch = getProperty("os.arch");
String osName = getProperty("os.name");
for (Arch arch : Arch.values()) {
if (arch.pattern.matcher(osArch).matches()) {
for (OS os : OS.values()) {
... | java | public static Platform detect() throws UnsupportedPlatformException {
String osArch = getProperty("os.arch");
String osName = getProperty("os.name");
for (Arch arch : Arch.values()) {
if (arch.pattern.matcher(osArch).matches()) {
for (OS os : OS.values()) {
... | [
"public",
"static",
"Platform",
"detect",
"(",
")",
"throws",
"UnsupportedPlatformException",
"{",
"String",
"osArch",
"=",
"getProperty",
"(",
"\"os.arch\"",
")",
";",
"String",
"osName",
"=",
"getProperty",
"(",
"\"os.name\"",
")",
";",
"for",
"(",
"Arch",
"... | Attempt to detect the current platform.
@return The current platform.
@throws UnsupportedPlatformException if the platform cannot be detected. | [
"Attempt",
"to",
"detect",
"the",
"current",
"platform",
"."
] | 0675236370458e819ee21e4427c5f7f3f9485d33 | https://github.com/wg/scrypt/blob/0675236370458e819ee21e4427c5f7f3f9485d33/src/main/java/com/lambdaworks/jni/Platform.java#L56-L72 |
2 | groovy/groovy-core | src/main/org/codehaus/groovy/ast/ASTNode.java | ASTNode.getNodeMetaData | public <T> T getNodeMetaData(Object key) {
if (metaDataMap == null) {
return (T) null;
}
return (T) metaDataMap.get(key);
} | java | public <T> T getNodeMetaData(Object key) {
if (metaDataMap == null) {
return (T) null;
}
return (T) metaDataMap.get(key);
} | [
"public",
"<",
"T",
">",
"T",
"getNodeMetaData",
"(",
"Object",
"key",
")",
"{",
"if",
"(",
"metaDataMap",
"==",
"null",
")",
"{",
"return",
"(",
"T",
")",
"null",
";",
"}",
"return",
"(",
"T",
")",
"metaDataMap",
".",
"get",
"(",
"key",
")",
";"... | Gets the node meta data.
@param key - the meta data key
@return the node meta data value for this key | [
"Gets",
"the",
"node",
"meta",
"data",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/ast/ASTNode.java#L119-L124 |
3 | groovy/groovy-core | src/main/org/codehaus/groovy/ast/ASTNode.java | ASTNode.copyNodeMetaData | public void copyNodeMetaData(ASTNode other) {
if (other.metaDataMap == null) {
return;
}
if (metaDataMap == null) {
metaDataMap = new ListHashMap();
}
metaDataMap.putAll(other.metaDataMap);
} | java | public void copyNodeMetaData(ASTNode other) {
if (other.metaDataMap == null) {
return;
}
if (metaDataMap == null) {
metaDataMap = new ListHashMap();
}
metaDataMap.putAll(other.metaDataMap);
} | [
"public",
"void",
"copyNodeMetaData",
"(",
"ASTNode",
"other",
")",
"{",
"if",
"(",
"other",
".",
"metaDataMap",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"metaDataMap",
"==",
"null",
")",
"{",
"metaDataMap",
"=",
"new",
"ListHashMap",
"(",
... | Copies all node meta data from the other node to this one
@param other - the other node | [
"Copies",
"all",
"node",
"meta",
"data",
"from",
"the",
"other",
"node",
"to",
"this",
"one"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/ast/ASTNode.java#L130-L138 |
4 | groovy/groovy-core | src/main/org/codehaus/groovy/ast/ASTNode.java | ASTNode.setNodeMetaData | public void setNodeMetaData(Object key, Object value) {
if (key==null) throw new GroovyBugError("Tried to set meta data with null key on "+this+".");
if (metaDataMap == null) {
metaDataMap = new ListHashMap();
}
Object old = metaDataMap.put(key,value);
if (old!=null) ... | java | public void setNodeMetaData(Object key, Object value) {
if (key==null) throw new GroovyBugError("Tried to set meta data with null key on "+this+".");
if (metaDataMap == null) {
metaDataMap = new ListHashMap();
}
Object old = metaDataMap.put(key,value);
if (old!=null) ... | [
"public",
"void",
"setNodeMetaData",
"(",
"Object",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"throw",
"new",
"GroovyBugError",
"(",
"\"Tried to set meta data with null key on \"",
"+",
"this",
"+",
"\".\"",
")",
";",
"if",
... | Sets the node meta data.
@param key - the meta data key
@param value - the meta data value
@throws GroovyBugError if key is null or there is already meta
data under that key | [
"Sets",
"the",
"node",
"meta",
"data",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/ast/ASTNode.java#L148-L155 |
5 | groovy/groovy-core | src/main/org/codehaus/groovy/ast/ASTNode.java | ASTNode.putNodeMetaData | public Object putNodeMetaData(Object key, Object value) {
if (key == null) throw new GroovyBugError("Tried to set meta data with null key on " + this + ".");
if (metaDataMap == null) {
metaDataMap = new ListHashMap();
}
return metaDataMap.put(key, value);
} | java | public Object putNodeMetaData(Object key, Object value) {
if (key == null) throw new GroovyBugError("Tried to set meta data with null key on " + this + ".");
if (metaDataMap == null) {
metaDataMap = new ListHashMap();
}
return metaDataMap.put(key, value);
} | [
"public",
"Object",
"putNodeMetaData",
"(",
"Object",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"throw",
"new",
"GroovyBugError",
"(",
"\"Tried to set meta data with null key on \"",
"+",
"this",
"+",
"\".\"",
")",
";",
"if"... | Sets the node meta data but allows overwriting values.
@param key - the meta data key
@param value - the meta data value
@return the old node meta data value for this key
@throws GroovyBugError if key is null | [
"Sets",
"the",
"node",
"meta",
"data",
"but",
"allows",
"overwriting",
"values",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/ast/ASTNode.java#L165-L171 |
6 | groovy/groovy-core | src/main/org/codehaus/groovy/ast/ASTNode.java | ASTNode.removeNodeMetaData | public void removeNodeMetaData(Object key) {
if (key==null) throw new GroovyBugError("Tried to remove meta data with null key "+this+".");
if (metaDataMap == null) {
return;
}
metaDataMap.remove(key);
} | java | public void removeNodeMetaData(Object key) {
if (key==null) throw new GroovyBugError("Tried to remove meta data with null key "+this+".");
if (metaDataMap == null) {
return;
}
metaDataMap.remove(key);
} | [
"public",
"void",
"removeNodeMetaData",
"(",
"Object",
"key",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"throw",
"new",
"GroovyBugError",
"(",
"\"Tried to remove meta data with null key \"",
"+",
"this",
"+",
"\".\"",
")",
";",
"if",
"(",
"metaDataMap",
"... | Removes a node meta data entry.
@param key - the meta data key
@throws GroovyBugError if the key is null | [
"Removes",
"a",
"node",
"meta",
"data",
"entry",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/ast/ASTNode.java#L179-L185 |
7 | groovy/groovy-core | src/main/groovy/lang/IntRange.java | IntRange.subListBorders | public RangeInfo subListBorders(int size) {
if (inclusive == null) throw new IllegalStateException("Should not call subListBorders on a non-inclusive aware IntRange");
int tempFrom = from;
if (tempFrom < 0) {
tempFrom += size;
}
int tempTo = to;
if (tempTo < 0... | java | public RangeInfo subListBorders(int size) {
if (inclusive == null) throw new IllegalStateException("Should not call subListBorders on a non-inclusive aware IntRange");
int tempFrom = from;
if (tempFrom < 0) {
tempFrom += size;
}
int tempTo = to;
if (tempTo < 0... | [
"public",
"RangeInfo",
"subListBorders",
"(",
"int",
"size",
")",
"{",
"if",
"(",
"inclusive",
"==",
"null",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Should not call subListBorders on a non-inclusive aware IntRange\"",
")",
";",
"int",
"tempFrom",
"=",
"f... | A method for determining from and to information when using this IntRange to index an aggregate object of the specified size.
Normally only used internally within Groovy but useful if adding range indexing support for your own aggregates.
@param size the size of the aggregate being indexed
@return the calculated range... | [
"A",
"method",
"for",
"determining",
"from",
"and",
"to",
"information",
"when",
"using",
"this",
"IntRange",
"to",
"index",
"an",
"aggregate",
"object",
"of",
"the",
"specified",
"size",
".",
"Normally",
"only",
"used",
"internally",
"within",
"Groovy",
"but"... | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/groovy/lang/IntRange.java#L197-L211 |
8 | groovy/groovy-core | src/main/groovy/beans/BindableASTTransformation.java | BindableASTTransformation.createSetterMethod | protected void createSetterMethod(ClassNode declaringClass, PropertyNode propertyNode, String setterName, Statement setterBlock) {
MethodNode setter = new MethodNode(
setterName,
propertyNode.getModifiers(),
ClassHelper.VOID_TYPE,
params(param... | java | protected void createSetterMethod(ClassNode declaringClass, PropertyNode propertyNode, String setterName, Statement setterBlock) {
MethodNode setter = new MethodNode(
setterName,
propertyNode.getModifiers(),
ClassHelper.VOID_TYPE,
params(param... | [
"protected",
"void",
"createSetterMethod",
"(",
"ClassNode",
"declaringClass",
",",
"PropertyNode",
"propertyNode",
",",
"String",
"setterName",
",",
"Statement",
"setterBlock",
")",
"{",
"MethodNode",
"setter",
"=",
"new",
"MethodNode",
"(",
"setterName",
",",
"pro... | Creates a setter method with the given body.
@param declaringClass the class to which we will add the setter
@param propertyNode the field to back the setter
@param setterName the name of the setter
@param setterBlock the statement representing the setter block | [
"Creates",
"a",
"setter",
"method",
"with",
"the",
"given",
"body",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/groovy/beans/BindableASTTransformation.java#L247-L258 |
9 | groovy/groovy-core | src/main/org/codehaus/groovy/control/CompilationUnit.java | CompilationUnit.applyToPrimaryClassNodes | public void applyToPrimaryClassNodes(PrimaryClassNodeOperation body) throws CompilationFailedException {
Iterator classNodes = getPrimaryClassNodes(body.needSortedInput()).iterator();
while (classNodes.hasNext()) {
SourceUnit context = null;
try {
ClassNode classN... | java | public void applyToPrimaryClassNodes(PrimaryClassNodeOperation body) throws CompilationFailedException {
Iterator classNodes = getPrimaryClassNodes(body.needSortedInput()).iterator();
while (classNodes.hasNext()) {
SourceUnit context = null;
try {
ClassNode classN... | [
"public",
"void",
"applyToPrimaryClassNodes",
"(",
"PrimaryClassNodeOperation",
"body",
")",
"throws",
"CompilationFailedException",
"{",
"Iterator",
"classNodes",
"=",
"getPrimaryClassNodes",
"(",
"body",
".",
"needSortedInput",
"(",
")",
")",
".",
"iterator",
"(",
"... | A loop driver for applying operations to all primary ClassNodes in
our AST. Automatically skips units that have already been processed
through the current phase. | [
"A",
"loop",
"driver",
"for",
"applying",
"operations",
"to",
"all",
"primary",
"ClassNodes",
"in",
"our",
"AST",
".",
"Automatically",
"skips",
"units",
"that",
"have",
"already",
"been",
"processed",
"through",
"the",
"current",
"phase",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/control/CompilationUnit.java#L1041-L1076 |
10 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/SocketGroovyMethods.java | SocketGroovyMethods.withStreams | public static <T> T withStreams(Socket socket, @ClosureParams(value=SimpleType.class, options={"java.io.InputStream","java.io.OutputStream"}) Closure<T> closure) throws IOException {
InputStream input = socket.getInputStream();
OutputStream output = socket.getOutputStream();
try {
T ... | java | public static <T> T withStreams(Socket socket, @ClosureParams(value=SimpleType.class, options={"java.io.InputStream","java.io.OutputStream"}) Closure<T> closure) throws IOException {
InputStream input = socket.getInputStream();
OutputStream output = socket.getOutputStream();
try {
T ... | [
"public",
"static",
"<",
"T",
">",
"T",
"withStreams",
"(",
"Socket",
"socket",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"SimpleType",
".",
"class",
",",
"options",
"=",
"{",
"\"java.io.InputStream\"",
",",
"\"java.io.OutputStream\"",
"}",
")",
"Closure",... | Passes the Socket's InputStream and OutputStream to the closure. The
streams will be closed after the closure returns, even if an exception
is thrown.
@param socket a Socket
@param closure a Closure
@return the value returned by the closure
@throws IOException if an IOException occurs.
@since 1.5.2 | [
"Passes",
"the",
"Socket",
"s",
"InputStream",
"and",
"OutputStream",
"to",
"the",
"closure",
".",
"The",
"streams",
"will",
"be",
"closed",
"after",
"the",
"closure",
"returns",
"even",
"if",
"an",
"exception",
"is",
"thrown",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/SocketGroovyMethods.java#L61-L79 |
11 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/SocketGroovyMethods.java | SocketGroovyMethods.withObjectStreams | public static <T> T withObjectStreams(Socket socket, @ClosureParams(value=SimpleType.class, options={"java.io.ObjectInputStream","java.io.ObjectOutputStream"}) Closure<T> closure) throws IOException {
InputStream input = socket.getInputStream();
OutputStream output = socket.getOutputStream();
Ob... | java | public static <T> T withObjectStreams(Socket socket, @ClosureParams(value=SimpleType.class, options={"java.io.ObjectInputStream","java.io.ObjectOutputStream"}) Closure<T> closure) throws IOException {
InputStream input = socket.getInputStream();
OutputStream output = socket.getOutputStream();
Ob... | [
"public",
"static",
"<",
"T",
">",
"T",
"withObjectStreams",
"(",
"Socket",
"socket",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"SimpleType",
".",
"class",
",",
"options",
"=",
"{",
"\"java.io.ObjectInputStream\"",
",",
"\"java.io.ObjectOutputStream\"",
"}",
... | Creates an InputObjectStream and an OutputObjectStream from a Socket, and
passes them to the closure. The streams will be closed after the closure
returns, even if an exception is thrown.
@param socket this Socket
@param closure a Closure
@return the value returned by the closure
@throws IOException if an IOExceptio... | [
"Creates",
"an",
"InputObjectStream",
"and",
"an",
"OutputObjectStream",
"from",
"a",
"Socket",
"and",
"passes",
"them",
"to",
"the",
"closure",
".",
"The",
"streams",
"will",
"be",
"closed",
"after",
"the",
"closure",
"returns",
"even",
"if",
"an",
"exception... | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/SocketGroovyMethods.java#L92-L120 |
12 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/MethodKey.java | MethodKey.createCopy | public MethodKey createCopy() {
int size = getParameterCount();
Class[] paramTypes = new Class[size];
for (int i = 0; i < size; i++) {
paramTypes[i] = getParameterType(i);
}
return new DefaultMethodKey(sender, name, paramTypes, isCallToSuper);
} | java | public MethodKey createCopy() {
int size = getParameterCount();
Class[] paramTypes = new Class[size];
for (int i = 0; i < size; i++) {
paramTypes[i] = getParameterType(i);
}
return new DefaultMethodKey(sender, name, paramTypes, isCallToSuper);
} | [
"public",
"MethodKey",
"createCopy",
"(",
")",
"{",
"int",
"size",
"=",
"getParameterCount",
"(",
")",
";",
"Class",
"[",
"]",
"paramTypes",
"=",
"new",
"Class",
"[",
"size",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
... | Creates an immutable copy that we can cache. | [
"Creates",
"an",
"immutable",
"copy",
"that",
"we",
"can",
"cache",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/MethodKey.java#L49-L56 |
13 | groovy/groovy-core | src/main/org/codehaus/groovy/transform/trait/TraitComposer.java | TraitComposer.doExtendTraits | public static void doExtendTraits(final ClassNode cNode, final SourceUnit unit, final CompilationUnit cu) {
if (cNode.isInterface()) return;
boolean isItselfTrait = Traits.isTrait(cNode);
SuperCallTraitTransformer superCallTransformer = new SuperCallTraitTransformer(unit);
if (isItselfTr... | java | public static void doExtendTraits(final ClassNode cNode, final SourceUnit unit, final CompilationUnit cu) {
if (cNode.isInterface()) return;
boolean isItselfTrait = Traits.isTrait(cNode);
SuperCallTraitTransformer superCallTransformer = new SuperCallTraitTransformer(unit);
if (isItselfTr... | [
"public",
"static",
"void",
"doExtendTraits",
"(",
"final",
"ClassNode",
"cNode",
",",
"final",
"SourceUnit",
"unit",
",",
"final",
"CompilationUnit",
"cu",
")",
"{",
"if",
"(",
"cNode",
".",
"isInterface",
"(",
")",
")",
"return",
";",
"boolean",
"isItselfT... | Given a class node, if this class node implements a trait, then generate all the appropriate
code which delegates calls to the trait. It is safe to call this method on a class node which
does not implement a trait.
@param cNode a class node
@param unit the source unit | [
"Given",
"a",
"class",
"node",
"if",
"this",
"class",
"node",
"implements",
"a",
"trait",
"then",
"generate",
"all",
"the",
"appropriate",
"code",
"which",
"delegates",
"calls",
"to",
"the",
"trait",
".",
"It",
"is",
"safe",
"to",
"call",
"this",
"method",... | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/transform/trait/TraitComposer.java#L102-L122 |
14 | groovy/groovy-core | src/main/org/codehaus/groovy/control/ErrorCollector.java | ErrorCollector.getSyntaxError | public SyntaxException getSyntaxError(int index) {
SyntaxException exception = null;
Message message = getError(index);
if (message != null && message instanceof SyntaxErrorMessage) {
exception = ((SyntaxErrorMessage) message).getCause();
}
return exception;
} | java | public SyntaxException getSyntaxError(int index) {
SyntaxException exception = null;
Message message = getError(index);
if (message != null && message instanceof SyntaxErrorMessage) {
exception = ((SyntaxErrorMessage) message).getCause();
}
return exception;
} | [
"public",
"SyntaxException",
"getSyntaxError",
"(",
"int",
"index",
")",
"{",
"SyntaxException",
"exception",
"=",
"null",
";",
"Message",
"message",
"=",
"getError",
"(",
"index",
")",
";",
"if",
"(",
"message",
"!=",
"null",
"&&",
"message",
"instanceof",
... | Convenience routine to return the specified error's
underlying SyntaxException, or null if it isn't one. | [
"Convenience",
"routine",
"to",
"return",
"the",
"specified",
"error",
"s",
"underlying",
"SyntaxException",
"or",
"null",
"if",
"it",
"isn",
"t",
"one",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/control/ErrorCollector.java#L240-L248 |
15 | groovy/groovy-core | src/main/org/apache/commons/cli/GroovyInternalPosixParser.java | GroovyInternalPosixParser.gobble | private void gobble(Iterator iter)
{
if (eatTheRest)
{
while (iter.hasNext())
{
tokens.add(iter.next());
}
}
} | java | private void gobble(Iterator iter)
{
if (eatTheRest)
{
while (iter.hasNext())
{
tokens.add(iter.next());
}
}
} | [
"private",
"void",
"gobble",
"(",
"Iterator",
"iter",
")",
"{",
"if",
"(",
"eatTheRest",
")",
"{",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"tokens",
".",
"add",
"(",
"iter",
".",
"next",
"(",
")",
")",
";",
"}",
"}",
"}"
] | Adds the remaining tokens to the processed tokens list.
@param iter An iterator over the remaining tokens | [
"Adds",
"the",
"remaining",
"tokens",
"to",
"the",
"processed",
"tokens",
"list",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/apache/commons/cli/GroovyInternalPosixParser.java#L165-L174 |
16 | groovy/groovy-core | src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java | StaticTypeCheckingSupport.allParametersAndArgumentsMatch | public static int allParametersAndArgumentsMatch(Parameter[] params, ClassNode[] args) {
if (params==null) {
params = Parameter.EMPTY_ARRAY;
}
int dist = 0;
if (args.length<params.length) return -1;
// we already know the lengths are equal
for (int i = 0; i < ... | java | public static int allParametersAndArgumentsMatch(Parameter[] params, ClassNode[] args) {
if (params==null) {
params = Parameter.EMPTY_ARRAY;
}
int dist = 0;
if (args.length<params.length) return -1;
// we already know the lengths are equal
for (int i = 0; i < ... | [
"public",
"static",
"int",
"allParametersAndArgumentsMatch",
"(",
"Parameter",
"[",
"]",
"params",
",",
"ClassNode",
"[",
"]",
"args",
")",
"{",
"if",
"(",
"params",
"==",
"null",
")",
"{",
"params",
"=",
"Parameter",
".",
"EMPTY_ARRAY",
";",
"}",
"int",
... | Checks that arguments and parameter types match.
@param params method parameters
@param args type arguments
@return -1 if arguments do not match, 0 if arguments are of the exact type and >0 when one or more argument is
not of the exact type but still match | [
"Checks",
"that",
"arguments",
"and",
"parameter",
"types",
"match",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java#L216-L232 |
17 | groovy/groovy-core | src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java | StaticTypeCheckingSupport.excessArgumentsMatchesVargsParameter | static int excessArgumentsMatchesVargsParameter(Parameter[] params, ClassNode[] args) {
// we already know parameter length is bigger zero and last is a vargs
// the excess arguments are all put in an array for the vargs call
// so check against the component type
int dist = 0;
C... | java | static int excessArgumentsMatchesVargsParameter(Parameter[] params, ClassNode[] args) {
// we already know parameter length is bigger zero and last is a vargs
// the excess arguments are all put in an array for the vargs call
// so check against the component type
int dist = 0;
C... | [
"static",
"int",
"excessArgumentsMatchesVargsParameter",
"(",
"Parameter",
"[",
"]",
"params",
",",
"ClassNode",
"[",
"]",
"args",
")",
"{",
"// we already know parameter length is bigger zero and last is a vargs",
"// the excess arguments are all put in an array for the vargs call",... | Checks that excess arguments match the vararg signature parameter.
@param params
@param args
@return -1 if no match, 0 if all arguments matches the vararg type and >0 if one or more vararg argument is
assignable to the vararg type, but still not an exact match | [
"Checks",
"that",
"excess",
"arguments",
"match",
"the",
"vararg",
"signature",
"parameter",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java#L276-L287 |
18 | groovy/groovy-core | src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java | StaticTypeCheckingSupport.lastArgMatchesVarg | static int lastArgMatchesVarg(Parameter[] params, ClassNode... args) {
if (!isVargs(params)) return -1;
// case length ==0 handled already
// we have now two cases,
// the argument is wrapped in the vargs array or
// the argument is an array that can be used for the vargs part di... | java | static int lastArgMatchesVarg(Parameter[] params, ClassNode... args) {
if (!isVargs(params)) return -1;
// case length ==0 handled already
// we have now two cases,
// the argument is wrapped in the vargs array or
// the argument is an array that can be used for the vargs part di... | [
"static",
"int",
"lastArgMatchesVarg",
"(",
"Parameter",
"[",
"]",
"params",
",",
"ClassNode",
"...",
"args",
")",
"{",
"if",
"(",
"!",
"isVargs",
"(",
"params",
")",
")",
"return",
"-",
"1",
";",
"// case length ==0 handled already",
"// we have now two cases,"... | Checks if the last argument matches the vararg type.
@param params
@param args
@return -1 if no match, 0 if the last argument is exactly the vararg type and 1 if of an assignable type | [
"Checks",
"if",
"the",
"last",
"argument",
"matches",
"the",
"vararg",
"type",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java#L295-L307 |
19 | groovy/groovy-core | src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java | StaticTypeCheckingSupport.buildParameter | private static Parameter buildParameter(final Map<String, GenericsType> genericFromReceiver, final Map<String, GenericsType> placeholdersFromContext, final Parameter methodParameter, final ClassNode paramType) {
if (genericFromReceiver.isEmpty() && (placeholdersFromContext==null||placeholdersFromContext.isEmpty... | java | private static Parameter buildParameter(final Map<String, GenericsType> genericFromReceiver, final Map<String, GenericsType> placeholdersFromContext, final Parameter methodParameter, final ClassNode paramType) {
if (genericFromReceiver.isEmpty() && (placeholdersFromContext==null||placeholdersFromContext.isEmpty... | [
"private",
"static",
"Parameter",
"buildParameter",
"(",
"final",
"Map",
"<",
"String",
",",
"GenericsType",
">",
"genericFromReceiver",
",",
"final",
"Map",
"<",
"String",
",",
"GenericsType",
">",
"placeholdersFromContext",
",",
"final",
"Parameter",
"methodParame... | Given a parameter, builds a new parameter for which the known generics placeholders are resolved.
@param genericFromReceiver resolved generics from the receiver of the message
@param placeholdersFromContext, resolved generics from the method context
@param methodParameter the method parameter for which we want to resol... | [
"Given",
"a",
"parameter",
"builds",
"a",
"new",
"parameter",
"for",
"which",
"the",
"known",
"generics",
"placeholders",
"are",
"resolved",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java#L1170-L1183 |
20 | groovy/groovy-core | src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java | StaticTypeCheckingSupport.isClassClassNodeWrappingConcreteType | public static boolean isClassClassNodeWrappingConcreteType(ClassNode classNode) {
GenericsType[] genericsTypes = classNode.getGenericsTypes();
return ClassHelper.CLASS_Type.equals(classNode)
&& classNode.isUsingGenerics()
&& genericsTypes!=null
&& !generic... | java | public static boolean isClassClassNodeWrappingConcreteType(ClassNode classNode) {
GenericsType[] genericsTypes = classNode.getGenericsTypes();
return ClassHelper.CLASS_Type.equals(classNode)
&& classNode.isUsingGenerics()
&& genericsTypes!=null
&& !generic... | [
"public",
"static",
"boolean",
"isClassClassNodeWrappingConcreteType",
"(",
"ClassNode",
"classNode",
")",
"{",
"GenericsType",
"[",
"]",
"genericsTypes",
"=",
"classNode",
".",
"getGenericsTypes",
"(",
")",
";",
"return",
"ClassHelper",
".",
"CLASS_Type",
".",
"equ... | Returns true if the class node represents a the class node for the Class class
and if the parametrized type is a neither a placeholder or a wildcard. For example,
the class node Class<Foo> where Foo is a class would return true, but the class
node for Class<?> would return false.
@param classNode a class no... | [
"Returns",
"true",
"if",
"the",
"class",
"node",
"represents",
"a",
"the",
"class",
"node",
"for",
"the",
"Class",
"class",
"and",
"if",
"the",
"parametrized",
"type",
"is",
"a",
"neither",
"a",
"placeholder",
"or",
"a",
"wildcard",
".",
"For",
"example",
... | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java#L2069-L2076 |
21 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.splitEachLine | public static <T> T splitEachLine(InputStream stream, String regex, String charset, @ClosureParams(value=FromString.class,options="List<String>") Closure<T> closure) throws IOException {
return splitEachLine(new BufferedReader(new InputStreamReader(stream, charset)), regex, closure);
} | java | public static <T> T splitEachLine(InputStream stream, String regex, String charset, @ClosureParams(value=FromString.class,options="List<String>") Closure<T> closure) throws IOException {
return splitEachLine(new BufferedReader(new InputStreamReader(stream, charset)), regex, closure);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"splitEachLine",
"(",
"InputStream",
"stream",
",",
"String",
"regex",
",",
"String",
"charset",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"FromString",
".",
"class",
",",
"options",
"=",
"\"List<String>\"",
")",
... | Iterates through the given InputStream line by line using the specified
encoding, splitting each line using the given separator. The list of tokens
for each line is then passed to the given closure. Finally, the stream
is closed.
@param stream an InputStream
@param regex the delimiting regular expression
@param ch... | [
"Iterates",
"through",
"the",
"given",
"InputStream",
"line",
"by",
"line",
"using",
"the",
"specified",
"encoding",
"splitting",
"each",
"line",
"using",
"the",
"given",
"separator",
".",
"The",
"list",
"of",
"tokens",
"for",
"each",
"line",
"is",
"then",
"... | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java#L603-L605 |
22 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.transformChar | public static void transformChar(Reader self, Writer writer, @ClosureParams(value=SimpleType.class, options="java.lang.String") Closure closure) throws IOException {
int c;
try {
char[] chars = new char[1];
while ((c = self.read()) != -1) {
chars[0] = (char) c;
... | java | public static void transformChar(Reader self, Writer writer, @ClosureParams(value=SimpleType.class, options="java.lang.String") Closure closure) throws IOException {
int c;
try {
char[] chars = new char[1];
while ((c = self.read()) != -1) {
chars[0] = (char) c;
... | [
"public",
"static",
"void",
"transformChar",
"(",
"Reader",
"self",
",",
"Writer",
"writer",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"SimpleType",
".",
"class",
",",
"options",
"=",
"\"java.lang.String\"",
")",
"Closure",
"closure",
")",
"throws",
"IOExc... | Transforms each character from this reader by passing it to the given
closure. The Closure should return each transformed character, which
will be passed to the Writer. The reader and writer will be both be
closed before this method returns.
@param self a Reader object
@param writer a Writer to receive the trans... | [
"Transforms",
"each",
"character",
"from",
"this",
"reader",
"by",
"passing",
"it",
"to",
"the",
"given",
"closure",
".",
"The",
"Closure",
"should",
"return",
"each",
"transformed",
"character",
"which",
"will",
"be",
"passed",
"to",
"the",
"Writer",
".",
"... | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java#L1398-L1418 |
23 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.withCloseable | public static <T, U extends Closeable> T withCloseable(U self, @ClosureParams(value=FirstParam.class) Closure<T> action) throws IOException {
try {
T result = action.call(self);
Closeable temp = self;
self = null;
temp.close();
return result;
... | java | public static <T, U extends Closeable> T withCloseable(U self, @ClosureParams(value=FirstParam.class) Closure<T> action) throws IOException {
try {
T result = action.call(self);
Closeable temp = self;
self = null;
temp.close();
return result;
... | [
"public",
"static",
"<",
"T",
",",
"U",
"extends",
"Closeable",
">",
"T",
"withCloseable",
"(",
"U",
"self",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"FirstParam",
".",
"class",
")",
"Closure",
"<",
"T",
">",
"action",
")",
"throws",
"IOException",
... | Allows this closeable to be used within the closure, ensuring that it
is closed once the closure has been executed and before this method returns.
@param self the Closeable
@param action the closure taking the Closeable as parameter
@return the value returned by the closure
@throws IOException if an IOException occurs... | [
"Allows",
"this",
"closeable",
"to",
"be",
"used",
"within",
"the",
"closure",
"ensuring",
"that",
"it",
"is",
"closed",
"once",
"the",
"closure",
"has",
"been",
"executed",
"and",
"before",
"this",
"method",
"returns",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java#L1620-L1632 |
24 | groovy/groovy-core | src/main/groovy/lang/MetaArrayLengthProperty.java | MetaArrayLengthProperty.getProperty | public Object getProperty(Object object) {
return java.lang.reflect.Array.getLength(object);
} | java | public Object getProperty(Object object) {
return java.lang.reflect.Array.getLength(object);
} | [
"public",
"Object",
"getProperty",
"(",
"Object",
"object",
")",
"{",
"return",
"java",
".",
"lang",
".",
"reflect",
".",
"Array",
".",
"getLength",
"(",
"object",
")",
";",
"}"
] | Get this property from the given object.
@param object an array
@return the length of the array object
@throws IllegalArgumentException if object is not an array | [
"Get",
"this",
"property",
"from",
"the",
"given",
"object",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/groovy/lang/MetaArrayLengthProperty.java#L43-L45 |
25 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/ProxyGeneratorAdapter.java | ProxyGeneratorAdapter.makeDelegateCall | protected MethodVisitor makeDelegateCall(final String name, final String desc, final String signature, final String[] exceptions, final int accessFlags) {
MethodVisitor mv = super.visitMethod(accessFlags, name, desc, signature, exceptions);
mv.visitVarInsn(ALOAD, 0); // load this
mv.visitFieldIn... | java | protected MethodVisitor makeDelegateCall(final String name, final String desc, final String signature, final String[] exceptions, final int accessFlags) {
MethodVisitor mv = super.visitMethod(accessFlags, name, desc, signature, exceptions);
mv.visitVarInsn(ALOAD, 0); // load this
mv.visitFieldIn... | [
"protected",
"MethodVisitor",
"makeDelegateCall",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"desc",
",",
"final",
"String",
"signature",
",",
"final",
"String",
"[",
"]",
"exceptions",
",",
"final",
"int",
"accessFlags",
")",
"{",
"MethodVisitor",
... | Generate a call to the delegate object. | [
"Generate",
"a",
"call",
"to",
"the",
"delegate",
"object",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/ProxyGeneratorAdapter.java#L708-L741 |
26 | groovy/groovy-core | src/main/org/codehaus/groovy/reflection/stdclasses/CachedSAMClass.java | CachedSAMClass.getSAMMethod | public static Method getSAMMethod(Class<?> c) {
// SAM = single public abstract method
// if the class is not abstract there is no abstract method
if (!Modifier.isAbstract(c.getModifiers())) return null;
if (c.isInterface()) {
Method[] methods = c.getMethods();
//... | java | public static Method getSAMMethod(Class<?> c) {
// SAM = single public abstract method
// if the class is not abstract there is no abstract method
if (!Modifier.isAbstract(c.getModifiers())) return null;
if (c.isInterface()) {
Method[] methods = c.getMethods();
//... | [
"public",
"static",
"Method",
"getSAMMethod",
"(",
"Class",
"<",
"?",
">",
"c",
")",
"{",
"// SAM = single public abstract method",
"// if the class is not abstract there is no abstract method",
"if",
"(",
"!",
"Modifier",
".",
"isAbstract",
"(",
"c",
".",
"getModifiers... | returns the abstract method from a SAM type, if it is a SAM type.
@param c the SAM class
@return null if nothing was found, the method otherwise | [
"returns",
"the",
"abstract",
"method",
"from",
"a",
"SAM",
"type",
"if",
"it",
"is",
"a",
"SAM",
"type",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/reflection/stdclasses/CachedSAMClass.java#L159-L195 |
27 | groovy/groovy-core | src/main/org/codehaus/groovy/classgen/asm/MopWriter.java | MopWriter.generateMopCalls | protected void generateMopCalls(LinkedList<MethodNode> mopCalls, boolean useThis) {
for (MethodNode method : mopCalls) {
String name = getMopMethodName(method, useThis);
Parameter[] parameters = method.getParameters();
String methodDescriptor = BytecodeHelper.getMethodDescrip... | java | protected void generateMopCalls(LinkedList<MethodNode> mopCalls, boolean useThis) {
for (MethodNode method : mopCalls) {
String name = getMopMethodName(method, useThis);
Parameter[] parameters = method.getParameters();
String methodDescriptor = BytecodeHelper.getMethodDescrip... | [
"protected",
"void",
"generateMopCalls",
"(",
"LinkedList",
"<",
"MethodNode",
">",
"mopCalls",
",",
"boolean",
"useThis",
")",
"{",
"for",
"(",
"MethodNode",
"method",
":",
"mopCalls",
")",
"{",
"String",
"name",
"=",
"getMopMethodName",
"(",
"method",
",",
... | generates a Meta Object Protocol method, that is used to call a non public
method, or to make a call to super.
@param mopCalls list of methods a mop call method should be generated for
@param useThis true if "this" should be used for the naming | [
"generates",
"a",
"Meta",
"Object",
"Protocol",
"method",
"that",
"is",
"used",
"to",
"call",
"a",
"non",
"public",
"method",
"or",
"to",
"make",
"a",
"call",
"to",
"super",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/classgen/asm/MopWriter.java#L174-L202 |
28 | groovy/groovy-core | src/main/org/codehaus/groovy/ast/ClassHelper.java | ClassHelper.getWrapper | public static ClassNode getWrapper(ClassNode cn) {
cn = cn.redirect();
if (!isPrimitiveType(cn)) return cn;
if (cn==boolean_TYPE) {
return Boolean_TYPE;
} else if (cn==byte_TYPE) {
return Byte_TYPE;
} else if (cn==char_TYPE) {
return Character_... | java | public static ClassNode getWrapper(ClassNode cn) {
cn = cn.redirect();
if (!isPrimitiveType(cn)) return cn;
if (cn==boolean_TYPE) {
return Boolean_TYPE;
} else if (cn==byte_TYPE) {
return Byte_TYPE;
} else if (cn==char_TYPE) {
return Character_... | [
"public",
"static",
"ClassNode",
"getWrapper",
"(",
"ClassNode",
"cn",
")",
"{",
"cn",
"=",
"cn",
".",
"redirect",
"(",
")",
";",
"if",
"(",
"!",
"isPrimitiveType",
"(",
"cn",
")",
")",
"return",
"cn",
";",
"if",
"(",
"cn",
"==",
"boolean_TYPE",
")",... | Creates a ClassNode containing the wrapper of a ClassNode
of primitive type. Any ClassNode representing a primitive
type should be created using the predefined types used in
class. The method will check the parameter for known
references of ClassNode representing a primitive type. If
Reference is found, then a ClassNod... | [
"Creates",
"a",
"ClassNode",
"containing",
"the",
"wrapper",
"of",
"a",
"ClassNode",
"of",
"primitive",
"type",
".",
"Any",
"ClassNode",
"representing",
"a",
"primitive",
"type",
"should",
"be",
"created",
"using",
"the",
"predefined",
"types",
"used",
"in",
"... | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/ast/ClassHelper.java#L257-L282 |
29 | groovy/groovy-core | src/main/org/codehaus/groovy/ast/ClassHelper.java | ClassHelper.findSAM | public static MethodNode findSAM(ClassNode type) {
if (!Modifier.isAbstract(type.getModifiers())) return null;
if (type.isInterface()) {
List<MethodNode> methods = type.getMethods();
MethodNode found=null;
for (MethodNode mi : methods) {
// ignore meth... | java | public static MethodNode findSAM(ClassNode type) {
if (!Modifier.isAbstract(type.getModifiers())) return null;
if (type.isInterface()) {
List<MethodNode> methods = type.getMethods();
MethodNode found=null;
for (MethodNode mi : methods) {
// ignore meth... | [
"public",
"static",
"MethodNode",
"findSAM",
"(",
"ClassNode",
"type",
")",
"{",
"if",
"(",
"!",
"Modifier",
".",
"isAbstract",
"(",
"type",
".",
"getModifiers",
"(",
")",
")",
")",
"return",
"null",
";",
"if",
"(",
"type",
".",
"isInterface",
"(",
")"... | Returns the single abstract method of a class node, if it is a SAM type, or null otherwise.
@param type a type for which to search for a single abstract method
@return the method node if type is a SAM type, null otherwise | [
"Returns",
"the",
"single",
"abstract",
"method",
"of",
"a",
"class",
"node",
"if",
"it",
"is",
"a",
"SAM",
"type",
"or",
"null",
"otherwise",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/ast/ClassHelper.java#L395-L428 |
30 | groovy/groovy-core | src/main/org/codehaus/groovy/syntax/Types.java | Types.getPrecedence | public static int getPrecedence( int type, boolean throwIfInvalid ) {
switch( type ) {
case LEFT_PARENTHESIS:
return 0;
case EQUAL:
case PLUS_EQUAL:
case MINUS_EQUAL:
case MULTIPLY_EQUAL:
case DIVIDE_EQUAL:
ca... | java | public static int getPrecedence( int type, boolean throwIfInvalid ) {
switch( type ) {
case LEFT_PARENTHESIS:
return 0;
case EQUAL:
case PLUS_EQUAL:
case MINUS_EQUAL:
case MULTIPLY_EQUAL:
case DIVIDE_EQUAL:
ca... | [
"public",
"static",
"int",
"getPrecedence",
"(",
"int",
"type",
",",
"boolean",
"throwIfInvalid",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"LEFT_PARENTHESIS",
":",
"return",
"0",
";",
"case",
"EQUAL",
":",
"case",
"PLUS_EQUAL",
":",
"case",
"MINU... | Returns the precedence of the specified operator. Non-operator's will
receive -1 or a GroovyBugError, depending on your preference. | [
"Returns",
"the",
"precedence",
"of",
"the",
"specified",
"operator",
".",
"Non",
"-",
"operator",
"s",
"will",
"receive",
"-",
"1",
"or",
"a",
"GroovyBugError",
"depending",
"on",
"your",
"preference",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/syntax/Types.java#L976-L1089 |
31 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/NullObject.java | NullObject.with | public <T> T with( Closure<T> closure ) {
return DefaultGroovyMethods.with( null, closure ) ;
} | java | public <T> T with( Closure<T> closure ) {
return DefaultGroovyMethods.with( null, closure ) ;
} | [
"public",
"<",
"T",
">",
"T",
"with",
"(",
"Closure",
"<",
"T",
">",
"closure",
")",
"{",
"return",
"DefaultGroovyMethods",
".",
"with",
"(",
"null",
",",
"closure",
")",
";",
"}"
] | Allows the closure to be called for NullObject
@param closure the closure to call on the object
@return result of calling the closure | [
"Allows",
"the",
"closure",
"to",
"be",
"called",
"for",
"NullObject"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/NullObject.java#L69-L71 |
32 | groovy/groovy-core | src/examples/org/codehaus/groovy/grails/compiler/injection/DefaultGrailsDomainClassInjector.java | DefaultGrailsDomainClassInjector.implementsMethod | private static boolean implementsMethod(ClassNode classNode, String methodName, Class[] argTypes) {
List methods = classNode.getMethods();
if (argTypes == null || argTypes.length ==0) {
for (Iterator i = methods.iterator(); i.hasNext();) {
MethodNode mn = (MethodNode) i.n... | java | private static boolean implementsMethod(ClassNode classNode, String methodName, Class[] argTypes) {
List methods = classNode.getMethods();
if (argTypes == null || argTypes.length ==0) {
for (Iterator i = methods.iterator(); i.hasNext();) {
MethodNode mn = (MethodNode) i.n... | [
"private",
"static",
"boolean",
"implementsMethod",
"(",
"ClassNode",
"classNode",
",",
"String",
"methodName",
",",
"Class",
"[",
"]",
"argTypes",
")",
"{",
"List",
"methods",
"=",
"classNode",
".",
"getMethods",
"(",
")",
";",
"if",
"(",
"argTypes",
"==",
... | Tests whether the ClassNode implements the specified method name
@param classNode The ClassNode
@param methodName The method name
@param argTypes
@return True if it implements the method | [
"Tests",
"whether",
"the",
"ClassNode",
"implements",
"the",
"specified",
"method",
"name"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/examples/org/codehaus/groovy/grails/compiler/injection/DefaultGrailsDomainClassInjector.java#L243-L254 |
33 | groovy/groovy-core | src/main/org/codehaus/groovy/ast/MethodNode.java | MethodNode.getTypeDescriptor | public String getTypeDescriptor() {
if (typeDescriptor == null) {
StringBuilder buf = new StringBuilder(name.length() + parameters.length * 10);
buf.append(returnType.getName());
buf.append(' ');
buf.append(name);
buf.append('(');
for (int ... | java | public String getTypeDescriptor() {
if (typeDescriptor == null) {
StringBuilder buf = new StringBuilder(name.length() + parameters.length * 10);
buf.append(returnType.getName());
buf.append(' ');
buf.append(name);
buf.append('(');
for (int ... | [
"public",
"String",
"getTypeDescriptor",
"(",
")",
"{",
"if",
"(",
"typeDescriptor",
"==",
"null",
")",
"{",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
"name",
".",
"length",
"(",
")",
"+",
"parameters",
".",
"length",
"*",
"10",
")",
";",... | The type descriptor for a method node is a string containing the name of the method, its return type,
and its parameter types in a canonical form. For simplicity, I'm using the format of a Java declaration
without parameter names.
@return the type descriptor | [
"The",
"type",
"descriptor",
"for",
"a",
"method",
"node",
"is",
"a",
"string",
"containing",
"the",
"name",
"of",
"the",
"method",
"its",
"return",
"type",
"and",
"its",
"parameter",
"types",
"in",
"a",
"canonical",
"form",
".",
"For",
"simplicity",
"I",
... | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/ast/MethodNode.java#L76-L94 |
34 | groovy/groovy-core | src/main/org/codehaus/groovy/ast/MethodNode.java | MethodNode.getText | @Override
public String getText() {
String retType = AstToTextHelper.getClassText(returnType);
String exceptionTypes = AstToTextHelper.getThrowsClauseText(exceptions);
String parms = AstToTextHelper.getParametersText(parameters);
return AstToTextHelper.getModifiersText(modifiers) + "... | java | @Override
public String getText() {
String retType = AstToTextHelper.getClassText(returnType);
String exceptionTypes = AstToTextHelper.getThrowsClauseText(exceptions);
String parms = AstToTextHelper.getParametersText(parameters);
return AstToTextHelper.getModifiersText(modifiers) + "... | [
"@",
"Override",
"public",
"String",
"getText",
"(",
")",
"{",
"String",
"retType",
"=",
"AstToTextHelper",
".",
"getClassText",
"(",
"returnType",
")",
";",
"String",
"exceptionTypes",
"=",
"AstToTextHelper",
".",
"getThrowsClauseText",
"(",
"exceptions",
")",
... | Provides a nicely formatted string of the method definition. For simplicity, generic types on some of the elements
are not displayed.
@return
string form of node with some generic elements suppressed | [
"Provides",
"a",
"nicely",
"formatted",
"string",
"of",
"the",
"method",
"definition",
".",
"For",
"simplicity",
"generic",
"types",
"on",
"some",
"of",
"the",
"elements",
"are",
"not",
"displayed",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/ast/MethodNode.java#L300-L306 |
35 | groovy/groovy-core | subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDoc.java | SimpleGroovyClassDoc.constructors | public GroovyConstructorDoc[] constructors() {
Collections.sort(constructors);
return constructors.toArray(new GroovyConstructorDoc[constructors.size()]);
} | java | public GroovyConstructorDoc[] constructors() {
Collections.sort(constructors);
return constructors.toArray(new GroovyConstructorDoc[constructors.size()]);
} | [
"public",
"GroovyConstructorDoc",
"[",
"]",
"constructors",
"(",
")",
"{",
"Collections",
".",
"sort",
"(",
"constructors",
")",
";",
"return",
"constructors",
".",
"toArray",
"(",
"new",
"GroovyConstructorDoc",
"[",
"constructors",
".",
"size",
"(",
")",
"]",... | returns a sorted array of constructors | [
"returns",
"a",
"sorted",
"array",
"of",
"constructors"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDoc.java#L100-L103 |
36 | groovy/groovy-core | subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDoc.java | SimpleGroovyClassDoc.innerClasses | public GroovyClassDoc[] innerClasses() {
Collections.sort(nested);
return nested.toArray(new GroovyClassDoc[nested.size()]);
} | java | public GroovyClassDoc[] innerClasses() {
Collections.sort(nested);
return nested.toArray(new GroovyClassDoc[nested.size()]);
} | [
"public",
"GroovyClassDoc",
"[",
"]",
"innerClasses",
"(",
")",
"{",
"Collections",
".",
"sort",
"(",
"nested",
")",
";",
"return",
"nested",
".",
"toArray",
"(",
"new",
"GroovyClassDoc",
"[",
"nested",
".",
"size",
"(",
")",
"]",
")",
";",
"}"
] | returns a sorted array of nested classes and interfaces | [
"returns",
"a",
"sorted",
"array",
"of",
"nested",
"classes",
"and",
"interfaces"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDoc.java#L129-L132 |
37 | groovy/groovy-core | subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDoc.java | SimpleGroovyClassDoc.fields | public GroovyFieldDoc[] fields() {
Collections.sort(fields);
return fields.toArray(new GroovyFieldDoc[fields.size()]);
} | java | public GroovyFieldDoc[] fields() {
Collections.sort(fields);
return fields.toArray(new GroovyFieldDoc[fields.size()]);
} | [
"public",
"GroovyFieldDoc",
"[",
"]",
"fields",
"(",
")",
"{",
"Collections",
".",
"sort",
"(",
"fields",
")",
";",
"return",
"fields",
".",
"toArray",
"(",
"new",
"GroovyFieldDoc",
"[",
"fields",
".",
"size",
"(",
")",
"]",
")",
";",
"}"
] | returns a sorted array of fields | [
"returns",
"a",
"sorted",
"array",
"of",
"fields"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDoc.java#L141-L144 |
38 | groovy/groovy-core | subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDoc.java | SimpleGroovyClassDoc.properties | public GroovyFieldDoc[] properties() {
Collections.sort(properties);
return properties.toArray(new GroovyFieldDoc[properties.size()]);
} | java | public GroovyFieldDoc[] properties() {
Collections.sort(properties);
return properties.toArray(new GroovyFieldDoc[properties.size()]);
} | [
"public",
"GroovyFieldDoc",
"[",
"]",
"properties",
"(",
")",
"{",
"Collections",
".",
"sort",
"(",
"properties",
")",
";",
"return",
"properties",
".",
"toArray",
"(",
"new",
"GroovyFieldDoc",
"[",
"properties",
".",
"size",
"(",
")",
"]",
")",
";",
"}"... | returns a sorted array of properties | [
"returns",
"a",
"sorted",
"array",
"of",
"properties"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDoc.java#L153-L156 |
39 | groovy/groovy-core | subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDoc.java | SimpleGroovyClassDoc.enumConstants | public GroovyFieldDoc[] enumConstants() {
Collections.sort(enumConstants);
return enumConstants.toArray(new GroovyFieldDoc[enumConstants.size()]);
} | java | public GroovyFieldDoc[] enumConstants() {
Collections.sort(enumConstants);
return enumConstants.toArray(new GroovyFieldDoc[enumConstants.size()]);
} | [
"public",
"GroovyFieldDoc",
"[",
"]",
"enumConstants",
"(",
")",
"{",
"Collections",
".",
"sort",
"(",
"enumConstants",
")",
";",
"return",
"enumConstants",
".",
"toArray",
"(",
"new",
"GroovyFieldDoc",
"[",
"enumConstants",
".",
"size",
"(",
")",
"]",
")",
... | returns a sorted array of enum constants | [
"returns",
"a",
"sorted",
"array",
"of",
"enum",
"constants"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDoc.java#L165-L168 |
40 | groovy/groovy-core | subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDoc.java | SimpleGroovyClassDoc.methods | public GroovyMethodDoc[] methods() {
Collections.sort(methods);
return methods.toArray(new GroovyMethodDoc[methods.size()]);
} | java | public GroovyMethodDoc[] methods() {
Collections.sort(methods);
return methods.toArray(new GroovyMethodDoc[methods.size()]);
} | [
"public",
"GroovyMethodDoc",
"[",
"]",
"methods",
"(",
")",
"{",
"Collections",
".",
"sort",
"(",
"methods",
")",
";",
"return",
"methods",
".",
"toArray",
"(",
"new",
"GroovyMethodDoc",
"[",
"methods",
".",
"size",
"(",
")",
"]",
")",
";",
"}"
] | returns a sorted array of methods | [
"returns",
"a",
"sorted",
"array",
"of",
"methods"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDoc.java#L177-L180 |
41 | groovy/groovy-core | subprojects/groovy-sql/src/main/java/groovy/sql/DataSet.java | DataSet.add | public void add(Map<String, Object> map) throws SQLException {
if (withinDataSetBatch) {
if (batchData.size() == 0) {
batchKeys = map.keySet();
} else {
if (!map.keySet().equals(batchKeys)) {
throw new IllegalArgumentException("Inconsis... | java | public void add(Map<String, Object> map) throws SQLException {
if (withinDataSetBatch) {
if (batchData.size() == 0) {
batchKeys = map.keySet();
} else {
if (!map.keySet().equals(batchKeys)) {
throw new IllegalArgumentException("Inconsis... | [
"public",
"void",
"add",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"withinDataSetBatch",
")",
"{",
"if",
"(",
"batchData",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"batchKeys",
"=",
"map",... | Adds the provided map of key-value pairs as a new row in the table represented by this DataSet.
@param map the key (column-name), value pairs to add as a new row
@throws SQLException if a database error occurs | [
"Adds",
"the",
"provided",
"map",
"of",
"key",
"-",
"value",
"pairs",
"as",
"a",
"new",
"row",
"in",
"the",
"table",
"represented",
"by",
"this",
"DataSet",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-sql/src/main/java/groovy/sql/DataSet.java#L233-L249 |
42 | groovy/groovy-core | subprojects/groovy-sql/src/main/java/groovy/sql/DataSet.java | DataSet.each | public void each(int offset, int maxRows, Closure closure) throws SQLException {
eachRow(getSql(), getParameters(), offset, maxRows, closure);
} | java | public void each(int offset, int maxRows, Closure closure) throws SQLException {
eachRow(getSql(), getParameters(), offset, maxRows, closure);
} | [
"public",
"void",
"each",
"(",
"int",
"offset",
",",
"int",
"maxRows",
",",
"Closure",
"closure",
")",
"throws",
"SQLException",
"{",
"eachRow",
"(",
"getSql",
"(",
")",
",",
"getParameters",
"(",
")",
",",
"offset",
",",
"maxRows",
",",
"closure",
")",
... | Calls the provided closure for a "page" of rows from the table represented by this DataSet.
A page is defined as starting at a 1-based offset, and containing a maximum number of rows.
@param offset the 1-based offset for the first row to be processed
@param maxRows the maximum number of rows to be processed
@param cl... | [
"Calls",
"the",
"provided",
"closure",
"for",
"a",
"page",
"of",
"rows",
"from",
"the",
"table",
"represented",
"by",
"this",
"DataSet",
".",
"A",
"page",
"is",
"defined",
"as",
"starting",
"at",
"a",
"1",
"-",
"based",
"offset",
"and",
"containing",
"a"... | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-sql/src/main/java/groovy/sql/DataSet.java#L349-L351 |
43 | groovy/groovy-core | src/main/groovy/beans/VetoableASTTransformation.java | VetoableASTTransformation.wrapSetterMethod | private void wrapSetterMethod(ClassNode classNode, boolean bindable, String propertyName) {
String getterName = "get" + MetaClassHelper.capitalize(propertyName);
MethodNode setter = classNode.getSetterMethod("set" + MetaClassHelper.capitalize(propertyName));
if (setter != null) {
... | java | private void wrapSetterMethod(ClassNode classNode, boolean bindable, String propertyName) {
String getterName = "get" + MetaClassHelper.capitalize(propertyName);
MethodNode setter = classNode.getSetterMethod("set" + MetaClassHelper.capitalize(propertyName));
if (setter != null) {
... | [
"private",
"void",
"wrapSetterMethod",
"(",
"ClassNode",
"classNode",
",",
"boolean",
"bindable",
",",
"String",
"propertyName",
")",
"{",
"String",
"getterName",
"=",
"\"get\"",
"+",
"MetaClassHelper",
".",
"capitalize",
"(",
"propertyName",
")",
";",
"MethodNode... | Wrap an existing setter. | [
"Wrap",
"an",
"existing",
"setter",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/groovy/beans/VetoableASTTransformation.java#L169-L203 |
44 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/ResourceGroovyMethods.java | ResourceGroovyMethods.directorySize | public static long directorySize(File self) throws IOException, IllegalArgumentException
{
final long[] size = {0L};
eachFileRecurse(self, FileType.FILES, new Closure<Void>(null) {
public void doCall(Object[] args) {
size[0] += ((File) args[0]).length();
}
... | java | public static long directorySize(File self) throws IOException, IllegalArgumentException
{
final long[] size = {0L};
eachFileRecurse(self, FileType.FILES, new Closure<Void>(null) {
public void doCall(Object[] args) {
size[0] += ((File) args[0]).length();
}
... | [
"public",
"static",
"long",
"directorySize",
"(",
"File",
"self",
")",
"throws",
"IOException",
",",
"IllegalArgumentException",
"{",
"final",
"long",
"[",
"]",
"size",
"=",
"{",
"0L",
"}",
";",
"eachFileRecurse",
"(",
"self",
",",
"FileType",
".",
"FILES",
... | Calculates directory size as total size of all its files, recursively.
@param self a file object
@return directory size (length)
@since 2.1
@throws IOException if File object specified does not exist
@throws IllegalArgumentException if the provided File object does not represent a directory | [
"Calculates",
"directory",
"size",
"as",
"total",
"size",
"of",
"all",
"its",
"files",
"recursively",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L118-L129 |
45 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/ResourceGroovyMethods.java | ResourceGroovyMethods.splitEachLine | public static <T> T splitEachLine(File self, String regex, @ClosureParams(value=SimpleType.class, options="java.lang.String[]") Closure<T> closure) throws IOException {
return IOGroovyMethods.splitEachLine(newReader(self), regex, closure);
} | java | public static <T> T splitEachLine(File self, String regex, @ClosureParams(value=SimpleType.class, options="java.lang.String[]") Closure<T> closure) throws IOException {
return IOGroovyMethods.splitEachLine(newReader(self), regex, closure);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"splitEachLine",
"(",
"File",
"self",
",",
"String",
"regex",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"SimpleType",
".",
"class",
",",
"options",
"=",
"\"java.lang.String[]\"",
")",
"Closure",
"<",
"T",
">",
... | Iterates through this file line by line, splitting each line using
the given regex separator. For each line, the given closure is called with
a single parameter being the list of strings computed by splitting the line
around matches of the given regular expression.
Finally the resources used for processing the file are... | [
"Iterates",
"through",
"this",
"file",
"line",
"by",
"line",
"splitting",
"each",
"line",
"using",
"the",
"given",
"regex",
"separator",
".",
"For",
"each",
"line",
"the",
"given",
"closure",
"is",
"called",
"with",
"a",
"single",
"parameter",
"being",
"the"... | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L378-L380 |
46 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/ResourceGroovyMethods.java | ResourceGroovyMethods.write | public static void write(File file, String text, String charset) throws IOException {
Writer writer = null;
try {
FileOutputStream out = new FileOutputStream(file);
writeUTF16BomIfRequired(charset, out);
writer = new OutputStreamWriter(out, charset);
write... | java | public static void write(File file, String text, String charset) throws IOException {
Writer writer = null;
try {
FileOutputStream out = new FileOutputStream(file);
writeUTF16BomIfRequired(charset, out);
writer = new OutputStreamWriter(out, charset);
write... | [
"public",
"static",
"void",
"write",
"(",
"File",
"file",
",",
"String",
"text",
",",
"String",
"charset",
")",
"throws",
"IOException",
"{",
"Writer",
"writer",
"=",
"null",
";",
"try",
"{",
"FileOutputStream",
"out",
"=",
"new",
"FileOutputStream",
"(",
... | Write the text to the File, using the specified encoding.
@param file a File
@param text the text to write to the File
@param charset the charset used
@throws IOException if an IOException occurs.
@since 1.0 | [
"Write",
"the",
"text",
"to",
"the",
"File",
"using",
"the",
"specified",
"encoding",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L817-L832 |
47 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/ResourceGroovyMethods.java | ResourceGroovyMethods.append | public static void append(File file, Object text) throws IOException {
Writer writer = null;
try {
writer = new FileWriter(file, true);
InvokerHelper.write(writer, text);
writer.flush();
Writer temp = writer;
writer = null;
temp.cl... | java | public static void append(File file, Object text) throws IOException {
Writer writer = null;
try {
writer = new FileWriter(file, true);
InvokerHelper.write(writer, text);
writer.flush();
Writer temp = writer;
writer = null;
temp.cl... | [
"public",
"static",
"void",
"append",
"(",
"File",
"file",
",",
"Object",
"text",
")",
"throws",
"IOException",
"{",
"Writer",
"writer",
"=",
"null",
";",
"try",
"{",
"writer",
"=",
"new",
"FileWriter",
"(",
"file",
",",
"true",
")",
";",
"InvokerHelper"... | Append the text at the end of the File.
@param file a File
@param text the text to append at the end of the File
@throws IOException if an IOException occurs.
@since 1.0 | [
"Append",
"the",
"text",
"at",
"the",
"end",
"of",
"the",
"File",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L842-L855 |
48 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/ResourceGroovyMethods.java | ResourceGroovyMethods.append | public static void append(File file, Object text, String charset) throws IOException {
Writer writer = null;
try {
FileOutputStream out = new FileOutputStream(file, true);
if (!file.exists()) {
writeUTF16BomIfRequired(charset, out);
}
write... | java | public static void append(File file, Object text, String charset) throws IOException {
Writer writer = null;
try {
FileOutputStream out = new FileOutputStream(file, true);
if (!file.exists()) {
writeUTF16BomIfRequired(charset, out);
}
write... | [
"public",
"static",
"void",
"append",
"(",
"File",
"file",
",",
"Object",
"text",
",",
"String",
"charset",
")",
"throws",
"IOException",
"{",
"Writer",
"writer",
"=",
"null",
";",
"try",
"{",
"FileOutputStream",
"out",
"=",
"new",
"FileOutputStream",
"(",
... | Append the text at the end of the File, using a specified encoding.
@param file a File
@param text the text to append at the end of the File
@param charset the charset used
@throws IOException if an IOException occurs.
@since 1.0 | [
"Append",
"the",
"text",
"at",
"the",
"end",
"of",
"the",
"File",
"using",
"a",
"specified",
"encoding",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L946-L963 |
49 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/ResourceGroovyMethods.java | ResourceGroovyMethods.append | public static void append(File file, Writer writer, String charset) throws IOException {
appendBuffered(file, writer, charset);
} | java | public static void append(File file, Writer writer, String charset) throws IOException {
appendBuffered(file, writer, charset);
} | [
"public",
"static",
"void",
"append",
"(",
"File",
"file",
",",
"Writer",
"writer",
",",
"String",
"charset",
")",
"throws",
"IOException",
"{",
"appendBuffered",
"(",
"file",
",",
"writer",
",",
"charset",
")",
";",
"}"
] | Append the text supplied by the Writer at the end of the File, using a specified encoding.
@param file a File
@param writer the Writer supplying the text to append at the end of the File
@param charset the charset used
@throws IOException if an IOException occurs.
@since 2.3 | [
"Append",
"the",
"text",
"supplied",
"by",
"the",
"Writer",
"at",
"the",
"end",
"of",
"the",
"File",
"using",
"a",
"specified",
"encoding",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L974-L976 |
50 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/ResourceGroovyMethods.java | ResourceGroovyMethods.writeUtf16Bom | private static void writeUtf16Bom(OutputStream stream, boolean bigEndian) throws IOException {
if (bigEndian) {
stream.write(-2);
stream.write(-1);
} else {
stream.write(-1);
stream.write(-2);
}
} | java | private static void writeUtf16Bom(OutputStream stream, boolean bigEndian) throws IOException {
if (bigEndian) {
stream.write(-2);
stream.write(-1);
} else {
stream.write(-1);
stream.write(-2);
}
} | [
"private",
"static",
"void",
"writeUtf16Bom",
"(",
"OutputStream",
"stream",
",",
"boolean",
"bigEndian",
")",
"throws",
"IOException",
"{",
"if",
"(",
"bigEndian",
")",
"{",
"stream",
".",
"write",
"(",
"-",
"2",
")",
";",
"stream",
".",
"write",
"(",
"... | Write a Byte Order Mark at the beginning of the file
@param stream the FileOutputStream to write the BOM to
@param bigEndian true if UTF 16 Big Endian or false if Low Endian
@throws IOException if an IOException occurs.
@since 1.0 | [
"Write",
"a",
"Byte",
"Order",
"Mark",
"at",
"the",
"beginning",
"of",
"the",
"file"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L1825-L1833 |
51 | groovy/groovy-core | src/main/groovy/lang/GroovyClassLoader.java | GroovyClassLoader.getClassCacheEntry | protected Class getClassCacheEntry(String name) {
if (name == null) return null;
synchronized (classCache) {
return classCache.get(name);
}
} | java | protected Class getClassCacheEntry(String name) {
if (name == null) return null;
synchronized (classCache) {
return classCache.get(name);
}
} | [
"protected",
"Class",
"getClassCacheEntry",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"return",
"null",
";",
"synchronized",
"(",
"classCache",
")",
"{",
"return",
"classCache",
".",
"get",
"(",
"name",
")",
";",
"}",
"}"
] | gets a class from the class cache. This cache contains only classes loaded through
this class loader or an InnerLoader instance. If no class is stored for a
specific name, then the method should return null.
@param name of the class
@return the class stored for the given name
@see #removeClassCacheEntry(String)
@see #... | [
"gets",
"a",
"class",
"from",
"the",
"class",
"cache",
".",
"This",
"cache",
"contains",
"only",
"classes",
"loaded",
"through",
"this",
"class",
"loader",
"or",
"an",
"InnerLoader",
"instance",
".",
"If",
"no",
"class",
"is",
"stored",
"for",
"a",
"specif... | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/groovy/lang/GroovyClassLoader.java#L560-L565 |
52 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java | MetaClassRegistryImpl.getMetaClassRegistryChangeEventListeners | public MetaClassRegistryChangeEventListener[] getMetaClassRegistryChangeEventListeners() {
synchronized (changeListenerList) {
ArrayList<MetaClassRegistryChangeEventListener> ret =
new ArrayList<MetaClassRegistryChangeEventListener>(changeListenerList.size()+nonRemoveableChangeLi... | java | public MetaClassRegistryChangeEventListener[] getMetaClassRegistryChangeEventListeners() {
synchronized (changeListenerList) {
ArrayList<MetaClassRegistryChangeEventListener> ret =
new ArrayList<MetaClassRegistryChangeEventListener>(changeListenerList.size()+nonRemoveableChangeLi... | [
"public",
"MetaClassRegistryChangeEventListener",
"[",
"]",
"getMetaClassRegistryChangeEventListeners",
"(",
")",
"{",
"synchronized",
"(",
"changeListenerList",
")",
"{",
"ArrayList",
"<",
"MetaClassRegistryChangeEventListener",
">",
"ret",
"=",
"new",
"ArrayList",
"<",
... | Gets an array of of all registered ConstantMetaClassListener instances. | [
"Gets",
"an",
"array",
"of",
"of",
"all",
"registered",
"ConstantMetaClassListener",
"instances",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java#L400-L408 |
53 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java | MetaClassRegistryImpl.getInstance | public static MetaClassRegistry getInstance(int includeExtension) {
if (includeExtension != DONT_LOAD_DEFAULT) {
if (instanceInclude == null) {
instanceInclude = new MetaClassRegistryImpl();
}
return instanceInclude;
} else {
if (instanceEx... | java | public static MetaClassRegistry getInstance(int includeExtension) {
if (includeExtension != DONT_LOAD_DEFAULT) {
if (instanceInclude == null) {
instanceInclude = new MetaClassRegistryImpl();
}
return instanceInclude;
} else {
if (instanceEx... | [
"public",
"static",
"MetaClassRegistry",
"getInstance",
"(",
"int",
"includeExtension",
")",
"{",
"if",
"(",
"includeExtension",
"!=",
"DONT_LOAD_DEFAULT",
")",
"{",
"if",
"(",
"instanceInclude",
"==",
"null",
")",
"{",
"instanceInclude",
"=",
"new",
"MetaClassReg... | Singleton of MetaClassRegistry.
@param includeExtension
@return the registry | [
"Singleton",
"of",
"MetaClassRegistry",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java#L416-L428 |
54 | groovy/groovy-core | src/main/org/codehaus/groovy/syntax/Reduction.java | Reduction.get | public CSTNode get( int index )
{
CSTNode element = null;
if( index < size() )
{
element = (CSTNode)elements.get( index );
}
return element;
} | java | public CSTNode get( int index )
{
CSTNode element = null;
if( index < size() )
{
element = (CSTNode)elements.get( index );
}
return element;
} | [
"public",
"CSTNode",
"get",
"(",
"int",
"index",
")",
"{",
"CSTNode",
"element",
"=",
"null",
";",
"if",
"(",
"index",
"<",
"size",
"(",
")",
")",
"{",
"element",
"=",
"(",
"CSTNode",
")",
"elements",
".",
"get",
"(",
"index",
")",
";",
"}",
"ret... | Returns the specified element, or null. | [
"Returns",
"the",
"specified",
"element",
"or",
"null",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/syntax/Reduction.java#L118-L128 |
55 | groovy/groovy-core | src/main/org/codehaus/groovy/syntax/Reduction.java | Reduction.set | public CSTNode set( int index, CSTNode element )
{
if( elements == null )
{
throw new GroovyBugError( "attempt to set() on a EMPTY Reduction" );
}
if( index == 0 && !(element instanceof Token) )
{
//
// It's not the greatest o... | java | public CSTNode set( int index, CSTNode element )
{
if( elements == null )
{
throw new GroovyBugError( "attempt to set() on a EMPTY Reduction" );
}
if( index == 0 && !(element instanceof Token) )
{
//
// It's not the greatest o... | [
"public",
"CSTNode",
"set",
"(",
"int",
"index",
",",
"CSTNode",
"element",
")",
"{",
"if",
"(",
"elements",
"==",
"null",
")",
"{",
"throw",
"new",
"GroovyBugError",
"(",
"\"attempt to set() on a EMPTY Reduction\"",
")",
";",
"}",
"if",
"(",
"index",
"==",
... | Sets an element in at the specified index. | [
"Sets",
"an",
"element",
"in",
"at",
"the",
"specified",
"index",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/syntax/Reduction.java#L199-L236 |
56 | groovy/groovy-core | src/main/org/codehaus/groovy/util/ManagedLinkedList.java | ManagedLinkedList.add | public void add(T value) {
Element<T> element = new Element<T>(bundle, value);
element.previous = tail;
if (tail != null) tail.next = element;
tail = element;
if (head == null) head = element;
} | java | public void add(T value) {
Element<T> element = new Element<T>(bundle, value);
element.previous = tail;
if (tail != null) tail.next = element;
tail = element;
if (head == null) head = element;
} | [
"public",
"void",
"add",
"(",
"T",
"value",
")",
"{",
"Element",
"<",
"T",
">",
"element",
"=",
"new",
"Element",
"<",
"T",
">",
"(",
"bundle",
",",
"value",
")",
";",
"element",
".",
"previous",
"=",
"tail",
";",
"if",
"(",
"tail",
"!=",
"null",... | adds a value to the list
@param value the value | [
"adds",
"a",
"value",
"to",
"the",
"list"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/util/ManagedLinkedList.java#L100-L106 |
57 | groovy/groovy-core | src/main/org/codehaus/groovy/util/ManagedLinkedList.java | ManagedLinkedList.toArray | public T[] toArray(T[] tArray) {
List<T> array = new ArrayList<T>(100);
for (Iterator<T> it = iterator(); it.hasNext();) {
T val = it.next();
if (val != null) array.add(val);
}
return array.toArray(tArray);
} | java | public T[] toArray(T[] tArray) {
List<T> array = new ArrayList<T>(100);
for (Iterator<T> it = iterator(); it.hasNext();) {
T val = it.next();
if (val != null) array.add(val);
}
return array.toArray(tArray);
} | [
"public",
"T",
"[",
"]",
"toArray",
"(",
"T",
"[",
"]",
"tArray",
")",
"{",
"List",
"<",
"T",
">",
"array",
"=",
"new",
"ArrayList",
"<",
"T",
">",
"(",
"100",
")",
";",
"for",
"(",
"Iterator",
"<",
"T",
">",
"it",
"=",
"iterator",
"(",
")",
... | Returns an array of non null elements from the source array.
@param tArray the source array
@return the array | [
"Returns",
"an",
"array",
"of",
"non",
"null",
"elements",
"from",
"the",
"source",
"array",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/util/ManagedLinkedList.java#L125-L132 |
58 | groovy/groovy-core | subprojects/groovy-json/src/main/java/groovy/json/internal/ValueMapImpl.java | ValueMapImpl.get | public Value get(Object key) {
/* If the length is under and we are asking for the key, then just look for the key. Don't build the map. */
if (map == null && items.length < 20) {
for (Object item : items) {
MapItemValue miv = (MapItemValue) item;
if (key.equa... | java | public Value get(Object key) {
/* If the length is under and we are asking for the key, then just look for the key. Don't build the map. */
if (map == null && items.length < 20) {
for (Object item : items) {
MapItemValue miv = (MapItemValue) item;
if (key.equa... | [
"public",
"Value",
"get",
"(",
"Object",
"key",
")",
"{",
"/* If the length is under and we are asking for the key, then just look for the key. Don't build the map. */",
"if",
"(",
"map",
"==",
"null",
"&&",
"items",
".",
"length",
"<",
"20",
")",
"{",
"for",
"(",
"Ob... | Get the items for the key.
@param key
@return the items for the given key | [
"Get",
"the",
"items",
"for",
"the",
"key",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-json/src/main/java/groovy/json/internal/ValueMapImpl.java#L80-L94 |
59 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.unique | public static <T> Iterator<T> unique(Iterator<T> self) {
return toList((Iterable<T>) unique(toList(self))).listIterator();
} | java | public static <T> Iterator<T> unique(Iterator<T> self) {
return toList((Iterable<T>) unique(toList(self))).listIterator();
} | [
"public",
"static",
"<",
"T",
">",
"Iterator",
"<",
"T",
">",
"unique",
"(",
"Iterator",
"<",
"T",
">",
"self",
")",
"{",
"return",
"toList",
"(",
"(",
"Iterable",
"<",
"T",
">",
")",
"unique",
"(",
"toList",
"(",
"self",
")",
")",
")",
".",
"l... | Returns an iterator equivalent to this iterator with all duplicated items removed
by using the default comparator. The original iterator will become
exhausted of elements after determining the unique values. A new iterator
for the unique values will be returned.
@param self an Iterator
@return the modified Iterator
@s... | [
"Returns",
"an",
"iterator",
"equivalent",
"to",
"this",
"iterator",
"with",
"all",
"duplicated",
"items",
"removed",
"by",
"using",
"the",
"default",
"comparator",
".",
"The",
"original",
"iterator",
"will",
"become",
"exhausted",
"of",
"elements",
"after",
"de... | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L1014-L1016 |
60 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.numberAwareCompareTo | public static int numberAwareCompareTo(Comparable self, Comparable other) {
NumberAwareComparator<Comparable> numberAwareComparator = new NumberAwareComparator<Comparable>();
return numberAwareComparator.compare(self, other);
} | java | public static int numberAwareCompareTo(Comparable self, Comparable other) {
NumberAwareComparator<Comparable> numberAwareComparator = new NumberAwareComparator<Comparable>();
return numberAwareComparator.compare(self, other);
} | [
"public",
"static",
"int",
"numberAwareCompareTo",
"(",
"Comparable",
"self",
",",
"Comparable",
"other",
")",
"{",
"NumberAwareComparator",
"<",
"Comparable",
">",
"numberAwareComparator",
"=",
"new",
"NumberAwareComparator",
"<",
"Comparable",
">",
"(",
")",
";",
... | Provides a method that compares two comparables using Groovy's
default number aware comparator.
@param self a Comparable
@param other another Comparable
@return a -ve number, 0 or a +ve number according to Groovy's compareTo contract
@since 1.6.0 | [
"Provides",
"a",
"method",
"that",
"compares",
"two",
"comparables",
"using",
"Groovy",
"s",
"default",
"number",
"aware",
"comparator",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L1117-L1120 |
61 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.any | public static boolean any(Object self, Closure closure) {
BooleanClosureWrapper bcw = new BooleanClosureWrapper(closure);
for (Iterator iter = InvokerHelper.asIterator(self); iter.hasNext();) {
if (bcw.call(iter.next())) return true;
}
return false;
} | java | public static boolean any(Object self, Closure closure) {
BooleanClosureWrapper bcw = new BooleanClosureWrapper(closure);
for (Iterator iter = InvokerHelper.asIterator(self); iter.hasNext();) {
if (bcw.call(iter.next())) return true;
}
return false;
} | [
"public",
"static",
"boolean",
"any",
"(",
"Object",
"self",
",",
"Closure",
"closure",
")",
"{",
"BooleanClosureWrapper",
"bcw",
"=",
"new",
"BooleanClosureWrapper",
"(",
"closure",
")",
";",
"for",
"(",
"Iterator",
"iter",
"=",
"InvokerHelper",
".",
"asItera... | Iterates over the contents of an object or collection, and checks whether a
predicate is valid for at least one element.
@param self the object over which we iterate
@param closure the closure predicate used for matching
@return true if any iteration for the object matches the closure predicate
@since 1.0 | [
"Iterates",
"over",
"the",
"contents",
"of",
"an",
"object",
"or",
"collection",
"and",
"checks",
"whether",
"a",
"predicate",
"is",
"valid",
"for",
"at",
"least",
"one",
"element",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L2306-L2312 |
62 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.findResult | public static Object findResult(Object self, Object defaultResult, Closure closure) {
Object result = findResult(self, closure);
if (result == null) return defaultResult;
return result;
} | java | public static Object findResult(Object self, Object defaultResult, Closure closure) {
Object result = findResult(self, closure);
if (result == null) return defaultResult;
return result;
} | [
"public",
"static",
"Object",
"findResult",
"(",
"Object",
"self",
",",
"Object",
"defaultResult",
",",
"Closure",
"closure",
")",
"{",
"Object",
"result",
"=",
"findResult",
"(",
"self",
",",
"closure",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
... | Treats the object as iterable, iterating through the values it represents and returns the first non-null result obtained from calling the closure, otherwise returns the defaultResult.
@param self an Object with an iterator returning its values
@param defaultResult an Object that should be returned if all closure re... | [
"Treats",
"the",
"object",
"as",
"iterable",
"iterating",
"through",
"the",
"values",
"it",
"represents",
"and",
"returns",
"the",
"first",
"non",
"-",
"null",
"result",
"obtained",
"from",
"calling",
"the",
"closure",
"otherwise",
"returns",
"the",
"defaultResu... | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L3845-L3849 |
63 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.groupAnswer | protected static <K, T> void groupAnswer(final Map<K, List<T>> answer, T element, K value) {
if (answer.containsKey(value)) {
answer.get(value).add(element);
} else {
List<T> groupedElements = new ArrayList<T>();
groupedElements.add(element);
answer.put(va... | java | protected static <K, T> void groupAnswer(final Map<K, List<T>> answer, T element, K value) {
if (answer.containsKey(value)) {
answer.get(value).add(element);
} else {
List<T> groupedElements = new ArrayList<T>();
groupedElements.add(element);
answer.put(va... | [
"protected",
"static",
"<",
"K",
",",
"T",
">",
"void",
"groupAnswer",
"(",
"final",
"Map",
"<",
"K",
",",
"List",
"<",
"T",
">",
">",
"answer",
",",
"T",
"element",
",",
"K",
"value",
")",
"{",
"if",
"(",
"answer",
".",
"containsKey",
"(",
"valu... | Groups the current element according to the value
@param answer the map containing the results
@param element the element to be placed
@param value the value according to which the element will be placed
@since 1.5.0 | [
"Groups",
"the",
"current",
"element",
"according",
"to",
"the",
"value"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L5205-L5213 |
64 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.asImmutable | public static <K,V> Map<K,V> asImmutable(Map<? extends K, ? extends V> self) {
return Collections.unmodifiableMap(self);
} | java | public static <K,V> Map<K,V> asImmutable(Map<? extends K, ? extends V> self) {
return Collections.unmodifiableMap(self);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"K",
",",
"V",
">",
"asImmutable",
"(",
"Map",
"<",
"?",
"extends",
"K",
",",
"?",
"extends",
"V",
">",
"self",
")",
"{",
"return",
"Collections",
".",
"unmodifiableMap",
"(",
"self",
")",
... | A convenience method for creating an immutable map.
@param self a Map
@return an immutable Map
@see java.util.Collections#unmodifiableMap(java.util.Map)
@since 1.0 | [
"A",
"convenience",
"method",
"for",
"creating",
"an",
"immutable",
"map",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L7493-L7495 |
65 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.asImmutable | public static <K,V> SortedMap<K,V> asImmutable(SortedMap<K, ? extends V> self) {
return Collections.unmodifiableSortedMap(self);
} | java | public static <K,V> SortedMap<K,V> asImmutable(SortedMap<K, ? extends V> self) {
return Collections.unmodifiableSortedMap(self);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"SortedMap",
"<",
"K",
",",
"V",
">",
"asImmutable",
"(",
"SortedMap",
"<",
"K",
",",
"?",
"extends",
"V",
">",
"self",
")",
"{",
"return",
"Collections",
".",
"unmodifiableSortedMap",
"(",
"self",
")",
";... | A convenience method for creating an immutable sorted map.
@param self a SortedMap
@return an immutable SortedMap
@see java.util.Collections#unmodifiableSortedMap(java.util.SortedMap)
@since 1.0 | [
"A",
"convenience",
"method",
"for",
"creating",
"an",
"immutable",
"sorted",
"map",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L7505-L7507 |
66 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.asImmutable | public static <T> List<T> asImmutable(List<? extends T> self) {
return Collections.unmodifiableList(self);
} | java | public static <T> List<T> asImmutable(List<? extends T> self) {
return Collections.unmodifiableList(self);
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"asImmutable",
"(",
"List",
"<",
"?",
"extends",
"T",
">",
"self",
")",
"{",
"return",
"Collections",
".",
"unmodifiableList",
"(",
"self",
")",
";",
"}"
] | A convenience method for creating an immutable list
@param self a List
@return an immutable List
@see java.util.Collections#unmodifiableList(java.util.List)
@since 1.0 | [
"A",
"convenience",
"method",
"for",
"creating",
"an",
"immutable",
"list"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L7517-L7519 |
67 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.asImmutable | public static <T> Set<T> asImmutable(Set<? extends T> self) {
return Collections.unmodifiableSet(self);
} | java | public static <T> Set<T> asImmutable(Set<? extends T> self) {
return Collections.unmodifiableSet(self);
} | [
"public",
"static",
"<",
"T",
">",
"Set",
"<",
"T",
">",
"asImmutable",
"(",
"Set",
"<",
"?",
"extends",
"T",
">",
"self",
")",
"{",
"return",
"Collections",
".",
"unmodifiableSet",
"(",
"self",
")",
";",
"}"
] | A convenience method for creating an immutable list.
@param self a Set
@return an immutable Set
@see java.util.Collections#unmodifiableSet(java.util.Set)
@since 1.0 | [
"A",
"convenience",
"method",
"for",
"creating",
"an",
"immutable",
"list",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L7529-L7531 |
68 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.asImmutable | public static <T> SortedSet<T> asImmutable(SortedSet<T> self) {
return Collections.unmodifiableSortedSet(self);
} | java | public static <T> SortedSet<T> asImmutable(SortedSet<T> self) {
return Collections.unmodifiableSortedSet(self);
} | [
"public",
"static",
"<",
"T",
">",
"SortedSet",
"<",
"T",
">",
"asImmutable",
"(",
"SortedSet",
"<",
"T",
">",
"self",
")",
"{",
"return",
"Collections",
".",
"unmodifiableSortedSet",
"(",
"self",
")",
";",
"}"
] | A convenience method for creating an immutable sorted set.
@param self a SortedSet
@return an immutable SortedSet
@see java.util.Collections#unmodifiableSortedSet(java.util.SortedSet)
@since 1.0 | [
"A",
"convenience",
"method",
"for",
"creating",
"an",
"immutable",
"sorted",
"set",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L7541-L7543 |
69 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.sort | public static <T> T[] sort(T[] self, Comparator<T> comparator) {
return sort(self, true, comparator);
} | java | public static <T> T[] sort(T[] self, Comparator<T> comparator) {
return sort(self, true, comparator);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"sort",
"(",
"T",
"[",
"]",
"self",
",",
"Comparator",
"<",
"T",
">",
"comparator",
")",
"{",
"return",
"sort",
"(",
"self",
",",
"true",
",",
"comparator",
")",
";",
"}"
] | Sorts the given array into sorted order using the given comparator.
@param self the array to be sorted
@param comparator a Comparator used for the comparison
@return the sorted array
@since 1.5.5 | [
"Sorts",
"the",
"given",
"array",
"into",
"sorted",
"order",
"using",
"the",
"given",
"comparator",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L8292-L8294 |
70 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.addAll | public static <T> boolean addAll(Collection<T> self, Iterator<T> items) {
boolean changed = false;
while (items.hasNext()) {
T next = items.next();
if (self.add(next)) changed = true;
}
return changed;
} | java | public static <T> boolean addAll(Collection<T> self, Iterator<T> items) {
boolean changed = false;
while (items.hasNext()) {
T next = items.next();
if (self.add(next)) changed = true;
}
return changed;
} | [
"public",
"static",
"<",
"T",
">",
"boolean",
"addAll",
"(",
"Collection",
"<",
"T",
">",
"self",
",",
"Iterator",
"<",
"T",
">",
"items",
")",
"{",
"boolean",
"changed",
"=",
"false",
";",
"while",
"(",
"items",
".",
"hasNext",
"(",
")",
")",
"{",... | Adds all items from the iterator to the Collection.
@param self the collection
@param items the items to add
@return true if the collection changed | [
"Adds",
"all",
"items",
"from",
"the",
"iterator",
"to",
"the",
"Collection",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L9371-L9378 |
71 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.addAll | public static <T> boolean addAll(Collection<T> self, Iterable<T> items) {
boolean changed = false;
for (T next : items) {
if (self.add(next)) changed = true;
}
return changed;
} | java | public static <T> boolean addAll(Collection<T> self, Iterable<T> items) {
boolean changed = false;
for (T next : items) {
if (self.add(next)) changed = true;
}
return changed;
} | [
"public",
"static",
"<",
"T",
">",
"boolean",
"addAll",
"(",
"Collection",
"<",
"T",
">",
"self",
",",
"Iterable",
"<",
"T",
">",
"items",
")",
"{",
"boolean",
"changed",
"=",
"false",
";",
"for",
"(",
"T",
"next",
":",
"items",
")",
"{",
"if",
"... | Adds all items from the iterable to the Collection.
@param self the collection
@param items the items to add
@return true if the collection changed | [
"Adds",
"all",
"items",
"from",
"the",
"iterable",
"to",
"the",
"Collection",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L9387-L9393 |
72 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.minus | public static <K,V> Map<K,V> minus(Map<K,V> self, Map removeMe) {
final Map<K,V> ansMap = createSimilarMap(self);
ansMap.putAll(self);
if (removeMe != null && removeMe.size() > 0) {
for (Map.Entry<K, V> e1 : self.entrySet()) {
for (Object e2 : removeMe.entrySet()) {
... | java | public static <K,V> Map<K,V> minus(Map<K,V> self, Map removeMe) {
final Map<K,V> ansMap = createSimilarMap(self);
ansMap.putAll(self);
if (removeMe != null && removeMe.size() > 0) {
for (Map.Entry<K, V> e1 : self.entrySet()) {
for (Object e2 : removeMe.entrySet()) {
... | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"K",
",",
"V",
">",
"minus",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"self",
",",
"Map",
"removeMe",
")",
"{",
"final",
"Map",
"<",
"K",
",",
"V",
">",
"ansMap",
"=",
"createSimilarMap",
"... | Create a Map composed of the entries of the first map minus the
entries of the given map.
@param self a map object
@param removeMe the entries to remove from the map
@return the resulting map
@since 1.7.4 | [
"Create",
"a",
"Map",
"composed",
"of",
"the",
"entries",
"of",
"the",
"first",
"map",
"minus",
"the",
"entries",
"of",
"the",
"given",
"map",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L11931-L11944 |
73 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.findLastIndexOf | public static int findLastIndexOf(Object self, int startIndex, Closure closure) {
int result = -1;
int i = 0;
BooleanClosureWrapper bcw = new BooleanClosureWrapper(closure);
for (Iterator iter = InvokerHelper.asIterator(self); iter.hasNext(); i++) {
Object value = iter.next()... | java | public static int findLastIndexOf(Object self, int startIndex, Closure closure) {
int result = -1;
int i = 0;
BooleanClosureWrapper bcw = new BooleanClosureWrapper(closure);
for (Iterator iter = InvokerHelper.asIterator(self); iter.hasNext(); i++) {
Object value = iter.next()... | [
"public",
"static",
"int",
"findLastIndexOf",
"(",
"Object",
"self",
",",
"int",
"startIndex",
",",
"Closure",
"closure",
")",
"{",
"int",
"result",
"=",
"-",
"1",
";",
"int",
"i",
"=",
"0",
";",
"BooleanClosureWrapper",
"bcw",
"=",
"new",
"BooleanClosureW... | Iterates over the elements of an iterable collection 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 closure ... | [
"Iterates",
"over",
"the",
"elements",
"of",
"an",
"iterable",
"collection",
"of",
"items",
"starting",
"from",
"a",
"specified",
"startIndex",
"and",
"returns",
"the",
"index",
"of",
"the",
"last",
"item",
"that",
"matches",
"the",
"condition",
"specified",
"... | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L15414-L15428 |
74 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.findIndexValues | public static List<Number> findIndexValues(Object self, Closure closure) {
return findIndexValues(self, 0, closure);
} | java | public static List<Number> findIndexValues(Object self, Closure closure) {
return findIndexValues(self, 0, closure);
} | [
"public",
"static",
"List",
"<",
"Number",
">",
"findIndexValues",
"(",
"Object",
"self",
",",
"Closure",
"closure",
")",
"{",
"return",
"findIndexValues",
"(",
"self",
",",
"0",
",",
"closure",
")",
";",
"}"
] | Iterates over the elements of an iterable collection 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 closure the filter to perform a match on the collection
@return a list of numbers corresponding to ... | [
"Iterates",
"over",
"the",
"elements",
"of",
"an",
"iterable",
"collection",
"of",
"items",
"and",
"returns",
"the",
"index",
"values",
"of",
"the",
"items",
"that",
"match",
"the",
"condition",
"specified",
"in",
"the",
"closure",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L15439-L15441 |
75 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.findIndexValues | public static List<Number> findIndexValues(Object self, Number startIndex, Closure closure) {
List<Number> result = new ArrayList<Number>();
long count = 0;
long startCount = startIndex.longValue();
BooleanClosureWrapper bcw = new BooleanClosureWrapper(closure);
for (Iterator ite... | java | public static List<Number> findIndexValues(Object self, Number startIndex, Closure closure) {
List<Number> result = new ArrayList<Number>();
long count = 0;
long startCount = startIndex.longValue();
BooleanClosureWrapper bcw = new BooleanClosureWrapper(closure);
for (Iterator ite... | [
"public",
"static",
"List",
"<",
"Number",
">",
"findIndexValues",
"(",
"Object",
"self",
",",
"Number",
"startIndex",
",",
"Closure",
"closure",
")",
"{",
"List",
"<",
"Number",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"Number",
">",
"(",
")",
";",
... | Iterates over the elements of an iterable collection 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 closure ... | [
"Iterates",
"over",
"the",
"elements",
"of",
"an",
"iterable",
"collection",
"of",
"items",
"starting",
"from",
"a",
"specified",
"startIndex",
"and",
"returns",
"the",
"index",
"values",
"of",
"the",
"items",
"that",
"match",
"the",
"condition",
"specified",
... | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L15454-L15469 |
76 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/HandleMetaClass.java | HandleMetaClass.getProperty | public Object getProperty(String property) {
if(ExpandoMetaClass.isValidExpandoProperty(property)) {
if(property.equals(ExpandoMetaClass.STATIC_QUALIFIER) ||
property.equals(ExpandoMetaClass.CONSTRUCTOR) ||
myMetaClass.hasProperty(this, property) == null) {
... | java | public Object getProperty(String property) {
if(ExpandoMetaClass.isValidExpandoProperty(property)) {
if(property.equals(ExpandoMetaClass.STATIC_QUALIFIER) ||
property.equals(ExpandoMetaClass.CONSTRUCTOR) ||
myMetaClass.hasProperty(this, property) == null) {
... | [
"public",
"Object",
"getProperty",
"(",
"String",
"property",
")",
"{",
"if",
"(",
"ExpandoMetaClass",
".",
"isValidExpandoProperty",
"(",
"property",
")",
")",
"{",
"if",
"(",
"property",
".",
"equals",
"(",
"ExpandoMetaClass",
".",
"STATIC_QUALIFIER",
")",
"... | this method mimics EMC behavior | [
"this",
"method",
"mimics",
"EMC",
"behavior"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/HandleMetaClass.java#L82-L91 |
77 | groovy/groovy-core | src/main/org/codehaus/groovy/control/messages/Message.java | Message.create | public static Message create( String text, Object data, ProcessingUnit owner )
{
return new SimpleMessage( text, data, owner);
} | java | public static Message create( String text, Object data, ProcessingUnit owner )
{
return new SimpleMessage( text, data, owner);
} | [
"public",
"static",
"Message",
"create",
"(",
"String",
"text",
",",
"Object",
"data",
",",
"ProcessingUnit",
"owner",
")",
"{",
"return",
"new",
"SimpleMessage",
"(",
"text",
",",
"data",
",",
"owner",
")",
";",
"}"
] | Creates a new Message from the specified text. | [
"Creates",
"a",
"new",
"Message",
"from",
"the",
"specified",
"text",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/control/messages/Message.java#L80-L83 |
78 | groovy/groovy-core | subprojects/groovy-json/src/main/java/groovy/json/JsonDelegate.java | JsonDelegate.invokeMethod | public Object invokeMethod(String name, Object args) {
Object val = null;
if (args != null && Object[].class.isAssignableFrom(args.getClass())) {
Object[] arr = (Object[]) args;
if (arr.length == 1) {
val = arr[0];
} else if (arr.length == 2 && arr[0]... | java | public Object invokeMethod(String name, Object args) {
Object val = null;
if (args != null && Object[].class.isAssignableFrom(args.getClass())) {
Object[] arr = (Object[]) args;
if (arr.length == 1) {
val = arr[0];
} else if (arr.length == 2 && arr[0]... | [
"public",
"Object",
"invokeMethod",
"(",
"String",
"name",
",",
"Object",
"args",
")",
"{",
"Object",
"val",
"=",
"null",
";",
"if",
"(",
"args",
"!=",
"null",
"&&",
"Object",
"[",
"]",
".",
"class",
".",
"isAssignableFrom",
"(",
"args",
".",
"getClass... | Intercepts calls for setting a key and value for a JSON object
@param name the key name
@param args the value associated with the key | [
"Intercepts",
"calls",
"for",
"setting",
"a",
"key",
"and",
"value",
"for",
"a",
"JSON",
"object"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-json/src/main/java/groovy/json/JsonDelegate.java#L43-L65 |
79 | groovy/groovy-core | src/main/groovy/lang/Binding.java | Binding.setVariable | public void setVariable(String name, Object value) {
if (variables == null)
variables = new LinkedHashMap();
variables.put(name, value);
} | java | public void setVariable(String name, Object value) {
if (variables == null)
variables = new LinkedHashMap();
variables.put(name, value);
} | [
"public",
"void",
"setVariable",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"variables",
"==",
"null",
")",
"variables",
"=",
"new",
"LinkedHashMap",
"(",
")",
";",
"variables",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
... | Sets the value of the given variable
@param name the name of the variable to set
@param value the new value for the given variable | [
"Sets",
"the",
"value",
"of",
"the",
"given",
"variable"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/groovy/lang/Binding.java#L76-L80 |
80 | groovy/groovy-core | src/main/groovy/lang/MetaBeanProperty.java | MetaBeanProperty.getProperty | public Object getProperty(Object object) {
MetaMethod getter = getGetter();
if (getter == null) {
if (field != null) return field.getProperty(object);
//TODO: create a WriteOnlyException class?
throw new GroovyRuntimeException("Cannot read write-only property: " + nam... | java | public Object getProperty(Object object) {
MetaMethod getter = getGetter();
if (getter == null) {
if (field != null) return field.getProperty(object);
//TODO: create a WriteOnlyException class?
throw new GroovyRuntimeException("Cannot read write-only property: " + nam... | [
"public",
"Object",
"getProperty",
"(",
"Object",
"object",
")",
"{",
"MetaMethod",
"getter",
"=",
"getGetter",
"(",
")",
";",
"if",
"(",
"getter",
"==",
"null",
")",
"{",
"if",
"(",
"field",
"!=",
"null",
")",
"return",
"field",
".",
"getProperty",
"(... | Get the property of the given object.
@param object which to be got
@return the property of the given object
@throws RuntimeException if the property could not be evaluated | [
"Get",
"the",
"property",
"of",
"the",
"given",
"object",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/groovy/lang/MetaBeanProperty.java#L56-L64 |
81 | groovy/groovy-core | src/main/groovy/lang/MetaBeanProperty.java | MetaBeanProperty.setProperty | public void setProperty(Object object, Object newValue) {
MetaMethod setter = getSetter();
if (setter == null) {
if (field != null && !Modifier.isFinal(field.getModifiers())) {
field.setProperty(object, newValue);
return;
}
throw new Gr... | java | public void setProperty(Object object, Object newValue) {
MetaMethod setter = getSetter();
if (setter == null) {
if (field != null && !Modifier.isFinal(field.getModifiers())) {
field.setProperty(object, newValue);
return;
}
throw new Gr... | [
"public",
"void",
"setProperty",
"(",
"Object",
"object",
",",
"Object",
"newValue",
")",
"{",
"MetaMethod",
"setter",
"=",
"getSetter",
"(",
")",
";",
"if",
"(",
"setter",
"==",
"null",
")",
"{",
"if",
"(",
"field",
"!=",
"null",
"&&",
"!",
"Modifier"... | Set the property on the given object to the new value.
@param object on which to set the property
@param newValue the new value of the property
@throws RuntimeException if the property could not be set | [
"Set",
"the",
"property",
"on",
"the",
"given",
"object",
"to",
"the",
"new",
"value",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/groovy/lang/MetaBeanProperty.java#L73-L84 |
82 | groovy/groovy-core | src/main/groovy/lang/MetaBeanProperty.java | MetaBeanProperty.getModifiers | public int getModifiers() {
MetaMethod getter = getGetter();
MetaMethod setter = getSetter();
if (setter != null && getter == null) return setter.getModifiers();
if (getter != null && setter == null) return getter.getModifiers();
int modifiers = getter.getModifiers() | setter.get... | java | public int getModifiers() {
MetaMethod getter = getGetter();
MetaMethod setter = getSetter();
if (setter != null && getter == null) return setter.getModifiers();
if (getter != null && setter == null) return getter.getModifiers();
int modifiers = getter.getModifiers() | setter.get... | [
"public",
"int",
"getModifiers",
"(",
")",
"{",
"MetaMethod",
"getter",
"=",
"getGetter",
"(",
")",
";",
"MetaMethod",
"setter",
"=",
"getSetter",
"(",
")",
";",
"if",
"(",
"setter",
"!=",
"null",
"&&",
"getter",
"==",
"null",
")",
"return",
"setter",
... | Gets the visibility modifiers for the property as defined by the getter and setter methods.
@return the visibility modifer of the getter, the setter, or both depending on which exist | [
"Gets",
"the",
"visibility",
"modifiers",
"for",
"the",
"property",
"as",
"defined",
"by",
"the",
"getter",
"and",
"setter",
"methods",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/groovy/lang/MetaBeanProperty.java#L127-L141 |
83 | groovy/groovy-core | src/main/org/codehaus/groovy/transform/trait/Traits.java | Traits.isTrait | public static boolean isTrait(final ClassNode cNode) {
return cNode!=null
&& ((cNode.isInterface() && !cNode.getAnnotations(TRAIT_CLASSNODE).isEmpty())
|| isAnnotatedWithTrait(cNode));
} | java | public static boolean isTrait(final ClassNode cNode) {
return cNode!=null
&& ((cNode.isInterface() && !cNode.getAnnotations(TRAIT_CLASSNODE).isEmpty())
|| isAnnotatedWithTrait(cNode));
} | [
"public",
"static",
"boolean",
"isTrait",
"(",
"final",
"ClassNode",
"cNode",
")",
"{",
"return",
"cNode",
"!=",
"null",
"&&",
"(",
"(",
"cNode",
".",
"isInterface",
"(",
")",
"&&",
"!",
"cNode",
".",
"getAnnotations",
"(",
"TRAIT_CLASSNODE",
")",
".",
"... | Returns true if the specified class node is a trait.
@param cNode a class node to test
@return true if the classnode represents a trait | [
"Returns",
"true",
"if",
"the",
"specified",
"class",
"node",
"is",
"a",
"trait",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/transform/trait/Traits.java#L149-L153 |
84 | groovy/groovy-core | src/main/org/codehaus/groovy/transform/trait/Traits.java | Traits.getBridgeMethodTarget | public static Method getBridgeMethodTarget(Method someMethod) {
TraitBridge annotation = someMethod.getAnnotation(TraitBridge.class);
if (annotation==null) {
return null;
}
Class aClass = annotation.traitClass();
String desc = annotation.desc();
for (Method me... | java | public static Method getBridgeMethodTarget(Method someMethod) {
TraitBridge annotation = someMethod.getAnnotation(TraitBridge.class);
if (annotation==null) {
return null;
}
Class aClass = annotation.traitClass();
String desc = annotation.desc();
for (Method me... | [
"public",
"static",
"Method",
"getBridgeMethodTarget",
"(",
"Method",
"someMethod",
")",
"{",
"TraitBridge",
"annotation",
"=",
"someMethod",
".",
"getAnnotation",
"(",
"TraitBridge",
".",
"class",
")",
";",
"if",
"(",
"annotation",
"==",
"null",
")",
"{",
"re... | Reflection API to find the method corresponding to the default implementation of a trait, given a bridge method.
@param someMethod a method node
@return null if it is not a method implemented in a trait. If it is, returns the method from the trait class. | [
"Reflection",
"API",
"to",
"find",
"the",
"method",
"corresponding",
"to",
"the",
"default",
"implementation",
"of",
"a",
"trait",
"given",
"a",
"bridge",
"method",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/transform/trait/Traits.java#L209-L223 |
85 | groovy/groovy-core | subprojects/groovy-console/src/main/groovy/groovy/ui/text/FindReplaceUtility.java | FindReplaceUtility.findNext | private static int findNext(boolean reverse, int pos) {
boolean backwards = IS_BACKWARDS_CHECKBOX.isSelected();
backwards = backwards ? !reverse : reverse;
String pattern = (String) FIND_FIELD.getSelectedItem();
if (pattern != null && pattern.length() > 0) {
try {
... | java | private static int findNext(boolean reverse, int pos) {
boolean backwards = IS_BACKWARDS_CHECKBOX.isSelected();
backwards = backwards ? !reverse : reverse;
String pattern = (String) FIND_FIELD.getSelectedItem();
if (pattern != null && pattern.length() > 0) {
try {
... | [
"private",
"static",
"int",
"findNext",
"(",
"boolean",
"reverse",
",",
"int",
"pos",
")",
"{",
"boolean",
"backwards",
"=",
"IS_BACKWARDS_CHECKBOX",
".",
"isSelected",
"(",
")",
";",
"backwards",
"=",
"backwards",
"?",
"!",
"reverse",
":",
"reverse",
";",
... | Find and select the next searchable matching text.
@param reverse look forwards or backwards
@param pos the starting index to start finding from
@return the location of the next selected, or -1 if not found | [
"Find",
"and",
"select",
"the",
"next",
"searchable",
"matching",
"text",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-console/src/main/groovy/groovy/ui/text/FindReplaceUtility.java#L261-L326 |
86 | groovy/groovy-core | src/main/org/codehaus/groovy/vmplugin/v7/IndyInterface.java | IndyInterface.invalidateSwitchPoints | protected static void invalidateSwitchPoints() {
if (LOG_ENABLED) {
LOG.info("invalidating switch point");
}
SwitchPoint old = switchPoint;
switchPoint = new SwitchPoint();
synchronized(IndyInterface.class) { SwitchPoint.invalidateAll(new SwitchP... | java | protected static void invalidateSwitchPoints() {
if (LOG_ENABLED) {
LOG.info("invalidating switch point");
}
SwitchPoint old = switchPoint;
switchPoint = new SwitchPoint();
synchronized(IndyInterface.class) { SwitchPoint.invalidateAll(new SwitchP... | [
"protected",
"static",
"void",
"invalidateSwitchPoints",
"(",
")",
"{",
"if",
"(",
"LOG_ENABLED",
")",
"{",
"LOG",
".",
"info",
"(",
"\"invalidating switch point\"",
")",
";",
"}",
"SwitchPoint",
"old",
"=",
"switchPoint",
";",
"switchPoint",
"=",
"new",
"Swit... | Callback for constant meta class update change | [
"Callback",
"for",
"constant",
"meta",
"class",
"update",
"change"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/vmplugin/v7/IndyInterface.java#L108-L115 |
87 | groovy/groovy-core | src/main/org/codehaus/groovy/vmplugin/v7/IndyInterface.java | IndyInterface.bootstrapCurrent | public static CallSite bootstrapCurrent(Lookup caller, String name, MethodType type) {
return realBootstrap(caller, name, CALL_TYPES.METHOD.ordinal(), type, false, true, false);
} | java | public static CallSite bootstrapCurrent(Lookup caller, String name, MethodType type) {
return realBootstrap(caller, name, CALL_TYPES.METHOD.ordinal(), type, false, true, false);
} | [
"public",
"static",
"CallSite",
"bootstrapCurrent",
"(",
"Lookup",
"caller",
",",
"String",
"name",
",",
"MethodType",
"type",
")",
"{",
"return",
"realBootstrap",
"(",
"caller",
",",
"name",
",",
"CALL_TYPES",
".",
"METHOD",
".",
"ordinal",
"(",
")",
",",
... | bootstrap method for method calls with "this" as receiver
@deprecated since Groovy 2.1.0 | [
"bootstrap",
"method",
"for",
"method",
"calls",
"with",
"this",
"as",
"receiver"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/vmplugin/v7/IndyInterface.java#L157-L159 |
88 | groovy/groovy-core | src/main/org/codehaus/groovy/vmplugin/v7/IndyInterface.java | IndyInterface.realBootstrap | private static CallSite realBootstrap(Lookup caller, String name, int callID, MethodType type, boolean safe, boolean thisCall, boolean spreadCall) {
// since indy does not give us the runtime types
// we produce first a dummy call site, which then changes the target to one,
// that d... | java | private static CallSite realBootstrap(Lookup caller, String name, int callID, MethodType type, boolean safe, boolean thisCall, boolean spreadCall) {
// since indy does not give us the runtime types
// we produce first a dummy call site, which then changes the target to one,
// that d... | [
"private",
"static",
"CallSite",
"realBootstrap",
"(",
"Lookup",
"caller",
",",
"String",
"name",
",",
"int",
"callID",
",",
"MethodType",
"type",
",",
"boolean",
"safe",
",",
"boolean",
"thisCall",
",",
"boolean",
"spreadCall",
")",
"{",
"// since indy does not... | backing bootstrap method with all parameters | [
"backing",
"bootstrap",
"method",
"with",
"all",
"parameters"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/vmplugin/v7/IndyInterface.java#L188-L197 |
89 | groovy/groovy-core | subprojects/groovy-swing/src/main/groovy/groovy/swing/impl/TableLayout.java | TableLayout.addCell | public void addCell(TableLayoutCell cell) {
GridBagConstraints constraints = cell.getConstraints();
constraints.insets = new Insets(cellpadding, cellpadding, cellpadding, cellpadding);
add(cell.getComponent(), constraints);
} | java | public void addCell(TableLayoutCell cell) {
GridBagConstraints constraints = cell.getConstraints();
constraints.insets = new Insets(cellpadding, cellpadding, cellpadding, cellpadding);
add(cell.getComponent(), constraints);
} | [
"public",
"void",
"addCell",
"(",
"TableLayoutCell",
"cell",
")",
"{",
"GridBagConstraints",
"constraints",
"=",
"cell",
".",
"getConstraints",
"(",
")",
";",
"constraints",
".",
"insets",
"=",
"new",
"Insets",
"(",
"cellpadding",
",",
"cellpadding",
",",
"cel... | Adds a new cell to the current grid
@param cell the td component | [
"Adds",
"a",
"new",
"cell",
"to",
"the",
"current",
"grid"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-swing/src/main/groovy/groovy/swing/impl/TableLayout.java#L54-L58 |
90 | groovy/groovy-core | src/main/org/codehaus/groovy/ast/CompileUnit.java | CompileUnit.addClass | public void addClass(ClassNode node) {
node = node.redirect();
String name = node.getName();
ClassNode stored = classes.get(name);
if (stored != null && stored != node) {
// we have a duplicate class!
// One possibility for this is, that we declared a script and a... | java | public void addClass(ClassNode node) {
node = node.redirect();
String name = node.getName();
ClassNode stored = classes.get(name);
if (stored != null && stored != node) {
// we have a duplicate class!
// One possibility for this is, that we declared a script and a... | [
"public",
"void",
"addClass",
"(",
"ClassNode",
"node",
")",
"{",
"node",
"=",
"node",
".",
"redirect",
"(",
")",
";",
"String",
"name",
"=",
"node",
".",
"getName",
"(",
")",
";",
"ClassNode",
"stored",
"=",
"classes",
".",
"get",
"(",
"name",
")",
... | Adds a class to the unit. | [
"Adds",
"a",
"class",
"to",
"the",
"unit",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/ast/CompileUnit.java#L127-L159 |
91 | groovy/groovy-core | src/main/org/codehaus/groovy/tools/LoaderConfiguration.java | LoaderConfiguration.getSlashyPath | private String getSlashyPath(final String path) {
String changedPath = path;
if (File.separatorChar != '/')
changedPath = changedPath.replace(File.separatorChar, '/');
return changedPath;
} | java | private String getSlashyPath(final String path) {
String changedPath = path;
if (File.separatorChar != '/')
changedPath = changedPath.replace(File.separatorChar, '/');
return changedPath;
} | [
"private",
"String",
"getSlashyPath",
"(",
"final",
"String",
"path",
")",
"{",
"String",
"changedPath",
"=",
"path",
";",
"if",
"(",
"File",
".",
"separatorChar",
"!=",
"'",
"'",
")",
"changedPath",
"=",
"changedPath",
".",
"replace",
"(",
"File",
".",
... | This solution is based on an absolute path | [
"This",
"solution",
"is",
"based",
"on",
"an",
"absolute",
"path"
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/tools/LoaderConfiguration.java#L259-L265 |
92 | groovy/groovy-core | subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java | NioGroovyMethods.write | public static void write(Path self, String text, String charset) throws IOException {
Writer writer = null;
try {
writer = new OutputStreamWriter(Files.newOutputStream(self, CREATE, APPEND), Charset.forName(charset));
writer.write(text);
writer.flush();
W... | java | public static void write(Path self, String text, String charset) throws IOException {
Writer writer = null;
try {
writer = new OutputStreamWriter(Files.newOutputStream(self, CREATE, APPEND), Charset.forName(charset));
writer.write(text);
writer.flush();
W... | [
"public",
"static",
"void",
"write",
"(",
"Path",
"self",
",",
"String",
"text",
",",
"String",
"charset",
")",
"throws",
"IOException",
"{",
"Writer",
"writer",
"=",
"null",
";",
"try",
"{",
"writer",
"=",
"new",
"OutputStreamWriter",
"(",
"Files",
".",
... | Write the text to the Path, using the specified encoding.
@param self a Path
@param text the text to write to the Path
@param charset the charset used
@throws java.io.IOException if an IOException occurs.
@since 2.3.0 | [
"Write",
"the",
"text",
"to",
"the",
"Path",
"using",
"the",
"specified",
"encoding",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java#L558-L571 |
93 | groovy/groovy-core | subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java | NioGroovyMethods.append | public static void append(Path self, Object text) throws IOException {
Writer writer = null;
try {
writer = new OutputStreamWriter(Files.newOutputStream(self, CREATE, APPEND), Charset.defaultCharset());
InvokerHelper.write(writer, text);
writer.flush();
W... | java | public static void append(Path self, Object text) throws IOException {
Writer writer = null;
try {
writer = new OutputStreamWriter(Files.newOutputStream(self, CREATE, APPEND), Charset.defaultCharset());
InvokerHelper.write(writer, text);
writer.flush();
W... | [
"public",
"static",
"void",
"append",
"(",
"Path",
"self",
",",
"Object",
"text",
")",
"throws",
"IOException",
"{",
"Writer",
"writer",
"=",
"null",
";",
"try",
"{",
"writer",
"=",
"new",
"OutputStreamWriter",
"(",
"Files",
".",
"newOutputStream",
"(",
"s... | Append the text at the end of the Path.
@param self a Path
@param text the text to append at the end of the Path
@throws java.io.IOException if an IOException occurs.
@since 2.3.0 | [
"Append",
"the",
"text",
"at",
"the",
"end",
"of",
"the",
"Path",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java#L581-L594 |
94 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.count | public static int count(CharSequence self, CharSequence text) {
int answer = 0;
for (int idx = 0; true; idx++) {
idx = self.toString().indexOf(text.toString(), idx);
// break once idx goes to -1 or for case of empty string once
// we get to the end to avoid JDK librar... | java | public static int count(CharSequence self, CharSequence text) {
int answer = 0;
for (int idx = 0; true; idx++) {
idx = self.toString().indexOf(text.toString(), idx);
// break once idx goes to -1 or for case of empty string once
// we get to the end to avoid JDK librar... | [
"public",
"static",
"int",
"count",
"(",
"CharSequence",
"self",
",",
"CharSequence",
"text",
")",
"{",
"int",
"answer",
"=",
"0",
";",
"for",
"(",
"int",
"idx",
"=",
"0",
";",
"true",
";",
"idx",
"++",
")",
"{",
"idx",
"=",
"self",
".",
"toString"... | Count the number of occurrences of a sub CharSequence.
@param self a CharSequence
@param text a sub CharSequence
@return the number of occurrences of the given CharSequence inside this CharSequence
@see #count(String, String)
@since 1.8.2 | [
"Count",
"the",
"number",
"of",
"occurrences",
"of",
"a",
"sub",
"CharSequence",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L387-L397 |
95 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.eachMatch | public static <T extends CharSequence> T eachMatch(T self, CharSequence regex, @ClosureParams(value=FromString.class, options={"List<String>","String[]"}) Closure closure) {
eachMatch(self.toString(), regex.toString(), closure);
return self;
} | java | public static <T extends CharSequence> T eachMatch(T self, CharSequence regex, @ClosureParams(value=FromString.class, options={"List<String>","String[]"}) Closure closure) {
eachMatch(self.toString(), regex.toString(), closure);
return self;
} | [
"public",
"static",
"<",
"T",
"extends",
"CharSequence",
">",
"T",
"eachMatch",
"(",
"T",
"self",
",",
"CharSequence",
"regex",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"FromString",
".",
"class",
",",
"options",
"=",
"{",
"\"List<String>\"",
",",
"\"... | Process each regex group matched substring of the given CharSequence. If the closure
parameter takes one argument, an array with all match groups is passed to it.
If the closure takes as many arguments as there are match groups, then each
parameter will be one match group.
@param self the source CharSequence
@param... | [
"Process",
"each",
"regex",
"group",
"matched",
"substring",
"of",
"the",
"given",
"CharSequence",
".",
"If",
"the",
"closure",
"parameter",
"takes",
"one",
"argument",
"an",
"array",
"with",
"all",
"match",
"groups",
"is",
"passed",
"to",
"it",
".",
"If",
... | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L692-L695 |
96 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.eachMatch | public static String eachMatch(String self, String regex, @ClosureParams(value=FromString.class, options={"List<String>","String[]"}) Closure closure) {
return eachMatch(self, Pattern.compile(regex), closure);
} | java | public static String eachMatch(String self, String regex, @ClosureParams(value=FromString.class, options={"List<String>","String[]"}) Closure closure) {
return eachMatch(self, Pattern.compile(regex), closure);
} | [
"public",
"static",
"String",
"eachMatch",
"(",
"String",
"self",
",",
"String",
"regex",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"FromString",
".",
"class",
",",
"options",
"=",
"{",
"\"List<String>\"",
",",
"\"String[]\"",
"}",
")",
"Closure",
"closu... | Process each regex group matched substring of the given string. If the closure
parameter takes one argument, an array with all match groups is passed to it.
If the closure takes as many arguments as there are match groups, then each
parameter will be one match group.
@param self the source string
@param regex a R... | [
"Process",
"each",
"regex",
"group",
"matched",
"substring",
"of",
"the",
"given",
"string",
".",
"If",
"the",
"closure",
"parameter",
"takes",
"one",
"argument",
"an",
"array",
"with",
"all",
"match",
"groups",
"is",
"passed",
"to",
"it",
".",
"If",
"the"... | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L745-L747 |
97 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.expandLine | public static String expandLine(CharSequence self, int tabStop) {
String s = self.toString();
int index;
while ((index = s.indexOf('\t')) != -1) {
StringBuilder builder = new StringBuilder(s);
int count = tabStop - index % tabStop;
builder.deleteCharAt(index);... | java | public static String expandLine(CharSequence self, int tabStop) {
String s = self.toString();
int index;
while ((index = s.indexOf('\t')) != -1) {
StringBuilder builder = new StringBuilder(s);
int count = tabStop - index % tabStop;
builder.deleteCharAt(index);... | [
"public",
"static",
"String",
"expandLine",
"(",
"CharSequence",
"self",
",",
"int",
"tabStop",
")",
"{",
"String",
"s",
"=",
"self",
".",
"toString",
"(",
")",
";",
"int",
"index",
";",
"while",
"(",
"(",
"index",
"=",
"s",
".",
"indexOf",
"(",
"'",... | Expands all tabs into spaces. Assumes the CharSequence represents a single line of text.
@param self A line to expand
@param tabStop The number of spaces a tab represents
@return The expanded toString() of this CharSequence
@see #expandLine(String, int)
@since 1.8.2 | [
"Expands",
"all",
"tabs",
"into",
"spaces",
".",
"Assumes",
"the",
"CharSequence",
"represents",
"a",
"single",
"line",
"of",
"text",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L819-L830 |
98 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.find | public static String find(CharSequence self, CharSequence regex, @ClosureParams(value=SimpleType.class, options="java.lang.String[]") Closure closure) {
return find(self.toString(), Pattern.compile(regex.toString()), closure);
} | java | public static String find(CharSequence self, CharSequence regex, @ClosureParams(value=SimpleType.class, options="java.lang.String[]") Closure closure) {
return find(self.toString(), Pattern.compile(regex.toString()), closure);
} | [
"public",
"static",
"String",
"find",
"(",
"CharSequence",
"self",
",",
"CharSequence",
"regex",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"SimpleType",
".",
"class",
",",
"options",
"=",
"\"java.lang.String[]\"",
")",
"Closure",
"closure",
")",
"{",
"retu... | Returns the result of calling a closure with the first occurrence of a regular expression found within a CharSequence.
If the regex doesn't match, the closure will not be called and find will return null.
@param self a CharSequence
@param regex the capturing regex CharSequence
@param closure the closure that will... | [
"Returns",
"the",
"result",
"of",
"calling",
"a",
"closure",
"with",
"the",
"first",
"occurrence",
"of",
"a",
"regular",
"expression",
"found",
"within",
"a",
"CharSequence",
".",
"If",
"the",
"regex",
"doesn",
"t",
"match",
"the",
"closure",
"will",
"not",
... | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L881-L883 |
99 | groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.getAt | public static String getAt(CharSequence self, Collection indices) {
StringBuilder answer = new StringBuilder();
for (Object value : indices) {
if (value instanceof Range) {
answer.append(getAt(self, (Range) value));
} else if (value instanceof Collection) {
... | java | public static String getAt(CharSequence self, Collection indices) {
StringBuilder answer = new StringBuilder();
for (Object value : indices) {
if (value instanceof Range) {
answer.append(getAt(self, (Range) value));
} else if (value instanceof Collection) {
... | [
"public",
"static",
"String",
"getAt",
"(",
"CharSequence",
"self",
",",
"Collection",
"indices",
")",
"{",
"StringBuilder",
"answer",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"Object",
"value",
":",
"indices",
")",
"{",
"if",
"(",
"value",
... | Select a List of characters from a CharSequence using a Collection
to identify the indices to be selected.
@param self a CharSequence
@param indices a Collection of indices
@return a String consisting of the characters at the given indices
@since 1.0 | [
"Select",
"a",
"List",
"of",
"characters",
"from",
"a",
"CharSequence",
"using",
"a",
"Collection",
"to",
"identify",
"the",
"indices",
"to",
"be",
"selected",
"."
] | 01309f9d4be34ddf93c4a9943b5a97843bff6181 | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1205-L1218 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.