repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
gosu-lang/gosu-lang | gosu-lab/src/main/java/editor/GosuStyleContext.java | GosuStyleContext.getFont | public Font getFont( int code )
{
Style s = _tokenStyles.get( new Integer( code ) );
if( s == null )
{
s = getStyle( DEFAULT_STYLE );
}
return getFont( s );
} | java | public Font getFont( int code )
{
Style s = _tokenStyles.get( new Integer( code ) );
if( s == null )
{
s = getStyle( DEFAULT_STYLE );
}
return getFont( s );
} | [
"public",
"Font",
"getFont",
"(",
"int",
"code",
")",
"{",
"Style",
"s",
"=",
"_tokenStyles",
".",
"get",
"(",
"new",
"Integer",
"(",
"code",
")",
")",
";",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"s",
"=",
"getStyle",
"(",
"DEFAULT_STYLE",
")",
... | Fetch the font to use for a lexical token with the given scan value. | [
"Fetch",
"the",
"font",
"to",
"use",
"for",
"a",
"lexical",
"token",
"with",
"the",
"given",
"scan",
"value",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/GosuStyleContext.java#L343-L351 | train |
gosu-lang/gosu-lang | gosu-lab/src/main/java/editor/GosuStyleContext.java | GosuStyleContext.getStyleForScanValue | public Style getStyleForScanValue( int code )
{
Style s = _tokenStyles.get( new Integer( code ) );
if( s == null )
{
s = getStyle( DEFAULT_STYLE );
}
return s;
} | java | public Style getStyleForScanValue( int code )
{
Style s = _tokenStyles.get( new Integer( code ) );
if( s == null )
{
s = getStyle( DEFAULT_STYLE );
}
return s;
} | [
"public",
"Style",
"getStyleForScanValue",
"(",
"int",
"code",
")",
"{",
"Style",
"s",
"=",
"_tokenStyles",
".",
"get",
"(",
"new",
"Integer",
"(",
"code",
")",
")",
";",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"s",
"=",
"getStyle",
"(",
"DEFAULT_STY... | Fetches the attribute set to use for the given scan code. The set is
stored in a table to facilitate relatively fast access to use in
conjunction with the scanner. | [
"Fetches",
"the",
"attribute",
"set",
"to",
"use",
"for",
"the",
"given",
"scan",
"code",
".",
"The",
"set",
"is",
"stored",
"in",
"a",
"table",
"to",
"facilitate",
"relatively",
"fast",
"access",
"to",
"use",
"in",
"conjunction",
"with",
"the",
"scanner",... | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/GosuStyleContext.java#L358-L366 | train |
gosu-lang/gosu-lang | gosu-lab/src/main/java/editor/GosuStyleContext.java | GosuStyleContext.getFont | @Override
public Font getFont( AttributeSet attr )
{
boolean bUnderline = StyleConstants.isUnderline( attr );
boolean bStrikethrough = StyleConstants.isStrikeThrough( attr );
if( !bUnderline && !bStrikethrough )
{
// StyleContext ignores the Underline and Strikethrough attribute
return ... | java | @Override
public Font getFont( AttributeSet attr )
{
boolean bUnderline = StyleConstants.isUnderline( attr );
boolean bStrikethrough = StyleConstants.isStrikeThrough( attr );
if( !bUnderline && !bStrikethrough )
{
// StyleContext ignores the Underline and Strikethrough attribute
return ... | [
"@",
"Override",
"public",
"Font",
"getFont",
"(",
"AttributeSet",
"attr",
")",
"{",
"boolean",
"bUnderline",
"=",
"StyleConstants",
".",
"isUnderline",
"(",
"attr",
")",
";",
"boolean",
"bStrikethrough",
"=",
"StyleConstants",
".",
"isStrikeThrough",
"(",
"attr... | Fetch the font to use for a given attribute set. | [
"Fetch",
"the",
"font",
"to",
"use",
"for",
"a",
"given",
"attribute",
"set",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/GosuStyleContext.java#L371-L411 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/init/ModuleFileUtil.java | ModuleFileUtil.createPathEntryForModuleFile | public static GosuPathEntry createPathEntryForModuleFile(IFile moduleFile) {
try {
InputStream is = moduleFile.openInputStream();
try {
SimpleXmlNode moduleNode = SimpleXmlNode.parse(is);
IDirectory rootDir = moduleFile.getParent();
List<IDirectory> sourceDirs = new ArrayList<ID... | java | public static GosuPathEntry createPathEntryForModuleFile(IFile moduleFile) {
try {
InputStream is = moduleFile.openInputStream();
try {
SimpleXmlNode moduleNode = SimpleXmlNode.parse(is);
IDirectory rootDir = moduleFile.getParent();
List<IDirectory> sourceDirs = new ArrayList<ID... | [
"public",
"static",
"GosuPathEntry",
"createPathEntryForModuleFile",
"(",
"IFile",
"moduleFile",
")",
"{",
"try",
"{",
"InputStream",
"is",
"=",
"moduleFile",
".",
"openInputStream",
"(",
")",
";",
"try",
"{",
"SimpleXmlNode",
"moduleNode",
"=",
"SimpleXmlNode",
"... | Reads a pom.xml file into a GosuPathEntry object
@param moduleFile the pom.xml file to convert to GosuPathEntry
@return an ordered list of GosuPathEntries created based on the algorithm described above | [
"Reads",
"a",
"pom",
".",
"xml",
"file",
"into",
"a",
"GosuPathEntry",
"object"
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/init/ModuleFileUtil.java#L26-L47 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/internal/gosu/util/RabinKarpHash.java | RabinKarpHash.minLen | private static int minLen(String... patterns) {
int minLen = patterns[0].length();
for (String str : patterns) {
if (str.length() < minLen) {
minLen = str.length();
}
}
return minLen;
} | java | private static int minLen(String... patterns) {
int minLen = patterns[0].length();
for (String str : patterns) {
if (str.length() < minLen) {
minLen = str.length();
}
}
return minLen;
} | [
"private",
"static",
"int",
"minLen",
"(",
"String",
"...",
"patterns",
")",
"{",
"int",
"minLen",
"=",
"patterns",
"[",
"0",
"]",
".",
"length",
"(",
")",
";",
"for",
"(",
"String",
"str",
":",
"patterns",
")",
"{",
"if",
"(",
"str",
".",
"length"... | Find the shortest of all patterns.
@param patterns
@return | [
"Find",
"the",
"shortest",
"of",
"all",
"patterns",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/internal/gosu/util/RabinKarpHash.java#L65-L73 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/internal/gosu/util/RabinKarpHash.java | RabinKarpHash.rollHash | private int rollHash(int hashvalue, String str, int i) {
// 'roll' hash
char outchar = str.charAt(str.length() - 1 - i);
char inchar = str.charAt(str.length() - _block - 1 - i);
hashvalue = A * hashvalue + CHAR_HASHES[inchar] - _Apowblock * CHAR_HASHES[outchar];
return hashvalue;
} | java | private int rollHash(int hashvalue, String str, int i) {
// 'roll' hash
char outchar = str.charAt(str.length() - 1 - i);
char inchar = str.charAt(str.length() - _block - 1 - i);
hashvalue = A * hashvalue + CHAR_HASHES[inchar] - _Apowblock * CHAR_HASHES[outchar];
return hashvalue;
} | [
"private",
"int",
"rollHash",
"(",
"int",
"hashvalue",
",",
"String",
"str",
",",
"int",
"i",
")",
"{",
"// 'roll' hash",
"char",
"outchar",
"=",
"str",
".",
"charAt",
"(",
"str",
".",
"length",
"(",
")",
"-",
"1",
"-",
"i",
")",
";",
"char",
"inch... | Update rolling hash values.
@param hashvalue
@param str
@param i
@return | [
"Update",
"rolling",
"hash",
"values",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/internal/gosu/util/RabinKarpHash.java#L121-L127 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/internal/gosu/util/RabinKarpHash.java | RabinKarpHash.reverseHash | private int reverseHash(String str) {
int hash = 0;
int len = str.length();
for (int i = 0; i < _block; i++) {
char c = str.charAt(len - i - 1);
hash = A * hash + CHAR_HASHES[c];
}
return hash;
} | java | private int reverseHash(String str) {
int hash = 0;
int len = str.length();
for (int i = 0; i < _block; i++) {
char c = str.charAt(len - i - 1);
hash = A * hash + CHAR_HASHES[c];
}
return hash;
} | [
"private",
"int",
"reverseHash",
"(",
"String",
"str",
")",
"{",
"int",
"hash",
"=",
"0",
";",
"int",
"len",
"=",
"str",
".",
"length",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"_block",
";",
"i",
"++",
")",
"{",
"char"... | Take rolling hash of last 'block' characters. Start from the end of the string.
@param str
@return | [
"Take",
"rolling",
"hash",
"of",
"last",
"block",
"characters",
".",
"Start",
"from",
"the",
"end",
"of",
"the",
"string",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/internal/gosu/util/RabinKarpHash.java#L134-L142 | train |
gosu-lang/gosu-lang | gosu-lab/src/main/java/editor/plugin/typeloader/java/JavaDocument.java | JavaDocument.insertString | @Override
public void insertString( int offset, String str, AttributeSet a ) throws BadLocationException
{
switch( str )
{
case "(":
str = addParenthesis();
break;
case "\n":
str = addWhiteSpace( offset );
break;
case "\"":
str = addMatchingQuotation... | java | @Override
public void insertString( int offset, String str, AttributeSet a ) throws BadLocationException
{
switch( str )
{
case "(":
str = addParenthesis();
break;
case "\n":
str = addWhiteSpace( offset );
break;
case "\"":
str = addMatchingQuotation... | [
"@",
"Override",
"public",
"void",
"insertString",
"(",
"int",
"offset",
",",
"String",
"str",
",",
"AttributeSet",
"a",
")",
"throws",
"BadLocationException",
"{",
"switch",
"(",
"str",
")",
"{",
"case",
"\"(\"",
":",
"str",
"=",
"addParenthesis",
"(",
")... | Override to apply syntax highlighting after the document has been updated | [
"Override",
"to",
"apply",
"syntax",
"highlighting",
"after",
"the",
"document",
"has",
"been",
"updated"
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/plugin/typeloader/java/JavaDocument.java#L114-L134 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/fs/watcher/DirectoryWatcher.java | DirectoryWatcher.stopWatching | public void stopWatching() {
try {
_watchService.close();
_watchService = null;
_watchedDirectories = null;
} catch (IOException e) {
throw new RuntimeException("Could not stop watching directories!", e);
}
} | java | public void stopWatching() {
try {
_watchService.close();
_watchService = null;
_watchedDirectories = null;
} catch (IOException e) {
throw new RuntimeException("Could not stop watching directories!", e);
}
} | [
"public",
"void",
"stopWatching",
"(",
")",
"{",
"try",
"{",
"_watchService",
".",
"close",
"(",
")",
";",
"_watchService",
"=",
"null",
";",
"_watchedDirectories",
"=",
"null",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"Runti... | Close the watch service. Releases resources. After calling, this instance becomes invalid and can't be used any more. | [
"Close",
"the",
"watch",
"service",
".",
"Releases",
"resources",
".",
"After",
"calling",
"this",
"instance",
"becomes",
"invalid",
"and",
"can",
"t",
"be",
"used",
"any",
"more",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/fs/watcher/DirectoryWatcher.java#L45-L53 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/fs/watcher/DirectoryWatcher.java | DirectoryWatcher.watchDirectoryTree | public void watchDirectoryTree(Path dir) {
if (_watchedDirectories == null) {
throw new IllegalStateException("DirectoryWatcher.close() was called. Please make a new instance.");
}
try {
if (Files.exists(dir)) {
Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
@Override
... | java | public void watchDirectoryTree(Path dir) {
if (_watchedDirectories == null) {
throw new IllegalStateException("DirectoryWatcher.close() was called. Please make a new instance.");
}
try {
if (Files.exists(dir)) {
Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
@Override
... | [
"public",
"void",
"watchDirectoryTree",
"(",
"Path",
"dir",
")",
"{",
"if",
"(",
"_watchedDirectories",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"DirectoryWatcher.close() was called. Please make a new instance.\"",
")",
";",
"}",
"try",
... | Walk the directories under given path, and register a watcher for every directory.
@param dir the starting point under which to listen for changes, if it doesn't exist, do nothing. | [
"Walk",
"the",
"directories",
"under",
"given",
"path",
"and",
"register",
"a",
"watcher",
"for",
"every",
"directory",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/fs/watcher/DirectoryWatcher.java#L60-L77 | train |
gosu-lang/gosu-lang | gosu-lab/src/main/java/editor/PopupListModel.java | PopupListModel.getModelUpdatedOrFilteredByPredicate | public List getModelUpdatedOrFilteredByPredicate()
{
List model = getModel();
if( _filter != null )
{
model = new ArrayList( model ); //duplicate because, insanely, ColUtil.filter is destructive
for( Iterator it = model.iterator(); it.hasNext(); )
{
Object o = it.next();
... | java | public List getModelUpdatedOrFilteredByPredicate()
{
List model = getModel();
if( _filter != null )
{
model = new ArrayList( model ); //duplicate because, insanely, ColUtil.filter is destructive
for( Iterator it = model.iterator(); it.hasNext(); )
{
Object o = it.next();
... | [
"public",
"List",
"getModelUpdatedOrFilteredByPredicate",
"(",
")",
"{",
"List",
"model",
"=",
"getModel",
"(",
")",
";",
"if",
"(",
"_filter",
"!=",
"null",
")",
"{",
"model",
"=",
"new",
"ArrayList",
"(",
"model",
")",
";",
"//duplicate because, insanely, Co... | Returns the underlying list, filtered by the predicate if it exists | [
"Returns",
"the",
"underlying",
"list",
"filtered",
"by",
"the",
"predicate",
"if",
"it",
"exists"
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/PopupListModel.java#L106-L125 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/ir/transform/expression/MapInitializerExpressionTransformer.java | MapInitializerExpressionTransformer.getMapType | private Class getMapType()
{
Class mapType = Map.class;
IParsedElement parent = getParsedElement().getParent();
if( parent instanceof NewExpression )
{
IType newType = ((NewExpression)parent).getType();
IJavaClassInfo classInfo = IRTypeResolver.getJavaBackedClass(newType);
Class java... | java | private Class getMapType()
{
Class mapType = Map.class;
IParsedElement parent = getParsedElement().getParent();
if( parent instanceof NewExpression )
{
IType newType = ((NewExpression)parent).getType();
IJavaClassInfo classInfo = IRTypeResolver.getJavaBackedClass(newType);
Class java... | [
"private",
"Class",
"getMapType",
"(",
")",
"{",
"Class",
"mapType",
"=",
"Map",
".",
"class",
";",
"IParsedElement",
"parent",
"=",
"getParsedElement",
"(",
")",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"parent",
"instanceof",
"NewExpression",
")",
"{"... | Try to get a more specific class instead of using the Map interface
i.e., invokevirtual is significantly faster then invokeinterface. | [
"Try",
"to",
"get",
"a",
"more",
"specific",
"class",
"instead",
"of",
"using",
"the",
"Map",
"interface",
"i",
".",
"e",
".",
"invokevirtual",
"is",
"significantly",
"faster",
"then",
"invokeinterface",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/ir/transform/expression/MapInitializerExpressionTransformer.java#L64-L83 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/ir/transform/expression/CollectionInitializerExpressionTransformer.java | CollectionInitializerExpressionTransformer.getCollectionType | private Class getCollectionType()
{
Class collectionType = Collection.class;
IParsedElement parent = getParsedElement().getParent();
if( parent instanceof NewExpression )
{
IType newType = ((NewExpression)parent).getType();
IJavaClassInfo classInfo = IRTypeResolver.getJavaBackedClass(newTy... | java | private Class getCollectionType()
{
Class collectionType = Collection.class;
IParsedElement parent = getParsedElement().getParent();
if( parent instanceof NewExpression )
{
IType newType = ((NewExpression)parent).getType();
IJavaClassInfo classInfo = IRTypeResolver.getJavaBackedClass(newTy... | [
"private",
"Class",
"getCollectionType",
"(",
")",
"{",
"Class",
"collectionType",
"=",
"Collection",
".",
"class",
";",
"IParsedElement",
"parent",
"=",
"getParsedElement",
"(",
")",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"parent",
"instanceof",
"NewExpr... | Try to get a more specific class instead of using the Collection interface
i.e., invokevirtual is significantly faster then invokeinterface. | [
"Try",
"to",
"get",
"a",
"more",
"specific",
"class",
"instead",
"of",
"using",
"the",
"Collection",
"interface",
"i",
".",
"e",
".",
"invokevirtual",
"is",
"significantly",
"faster",
"then",
"invokeinterface",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/ir/transform/expression/CollectionInitializerExpressionTransformer.java#L59-L78 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/ir/transform/StatementTransformer.java | StatementTransformer.compileInitializerAssignment | public static IRStatement compileInitializerAssignment( TopLevelTransformationContext context, InitializerAssignment stmt, IRExpression root )
{
return InitializerAssignmentTransformer.compile( context, stmt, root );
} | java | public static IRStatement compileInitializerAssignment( TopLevelTransformationContext context, InitializerAssignment stmt, IRExpression root )
{
return InitializerAssignmentTransformer.compile( context, stmt, root );
} | [
"public",
"static",
"IRStatement",
"compileInitializerAssignment",
"(",
"TopLevelTransformationContext",
"context",
",",
"InitializerAssignment",
"stmt",
",",
"IRExpression",
"root",
")",
"{",
"return",
"InitializerAssignmentTransformer",
".",
"compile",
"(",
"context",
","... | This is in its own method because it requires additional context | [
"This",
"is",
"in",
"its",
"own",
"method",
"because",
"it",
"requires",
"additional",
"context"
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/ir/transform/StatementTransformer.java#L154-L157 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/parser/ParseTree.java | ParseTree.setParent | public void setParent( IParseTree l )
{
if( l != null && !l.contains( this ) && getLength() > 0 )
{
throw new IllegalArgumentException( "Attempted set the parent location, but the parent location's area is not a superset of this location's area." );
}
if( _pe != null )
{
ParsedElement ... | java | public void setParent( IParseTree l )
{
if( l != null && !l.contains( this ) && getLength() > 0 )
{
throw new IllegalArgumentException( "Attempted set the parent location, but the parent location's area is not a superset of this location's area." );
}
if( _pe != null )
{
ParsedElement ... | [
"public",
"void",
"setParent",
"(",
"IParseTree",
"l",
")",
"{",
"if",
"(",
"l",
"!=",
"null",
"&&",
"!",
"l",
".",
"contains",
"(",
"this",
")",
"&&",
"getLength",
"(",
")",
">",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Att... | Sets the parent location. Note the parent location must cover a superset of the
specified location's area.
@param l The parent location. | [
"Sets",
"the",
"parent",
"location",
".",
"Note",
"the",
"parent",
"location",
"must",
"cover",
"a",
"superset",
"of",
"the",
"specified",
"location",
"s",
"area",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/ParseTree.java#L373-L392 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/parser/ParseTree.java | ParseTree.areOffsetAndExtentEqual | public boolean areOffsetAndExtentEqual( IParseTree location )
{
return location != null &&
location.getOffset() == getOffset() &&
location.getExtent() == getExtent();
} | java | public boolean areOffsetAndExtentEqual( IParseTree location )
{
return location != null &&
location.getOffset() == getOffset() &&
location.getExtent() == getExtent();
} | [
"public",
"boolean",
"areOffsetAndExtentEqual",
"(",
"IParseTree",
"location",
")",
"{",
"return",
"location",
"!=",
"null",
"&&",
"location",
".",
"getOffset",
"(",
")",
"==",
"getOffset",
"(",
")",
"&&",
"location",
".",
"getExtent",
"(",
")",
"==",
"getEx... | Is just the physical location equal?
@param location Location to check
@return True if the given physical location's offset and extents are equal to this one's | [
"Is",
"just",
"the",
"physical",
"location",
"equal?"
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/ParseTree.java#L420-L425 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/parser/ArrayExpansionPropertyInfo.java | ArrayExpansionPropertyInfo.getFeatureType | public IType getFeatureType()
{
if( _delegate.getFeatureType().isArray() )
{
return _delegate.getFeatureType();
}
return _delegate.getFeatureType().getArrayType();
} | java | public IType getFeatureType()
{
if( _delegate.getFeatureType().isArray() )
{
return _delegate.getFeatureType();
}
return _delegate.getFeatureType().getArrayType();
} | [
"public",
"IType",
"getFeatureType",
"(",
")",
"{",
"if",
"(",
"_delegate",
".",
"getFeatureType",
"(",
")",
".",
"isArray",
"(",
")",
")",
"{",
"return",
"_delegate",
".",
"getFeatureType",
"(",
")",
";",
"}",
"return",
"_delegate",
".",
"getFeatureType",... | Make an array type from the delegate's type, if it's not already an array.
The idea with array expansion is to allow access to properties of X from an
array of X. We call the accessor For each X in the array we call the | [
"Make",
"an",
"array",
"type",
"from",
"the",
"delegate",
"s",
"type",
"if",
"it",
"s",
"not",
"already",
"an",
"array",
".",
"The",
"idea",
"with",
"array",
"expansion",
"is",
"to",
"allow",
"access",
"to",
"properties",
"of",
"X",
"from",
"an",
"arra... | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/ArrayExpansionPropertyInfo.java#L198-L205 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/util/StringUtil.java | StringUtil.join | public static <E> StringBuffer join( String glue, Collection<E> charSequences )
{
StringBuffer buf = new StringBuffer();
int i = 0;
for( Object charSequence : charSequences )
{
if( i > 0 )
{
buf.append( glue );
}
buf.append( charSequence );
i++;
}
return b... | java | public static <E> StringBuffer join( String glue, Collection<E> charSequences )
{
StringBuffer buf = new StringBuffer();
int i = 0;
for( Object charSequence : charSequences )
{
if( i > 0 )
{
buf.append( glue );
}
buf.append( charSequence );
i++;
}
return b... | [
"public",
"static",
"<",
"E",
">",
"StringBuffer",
"join",
"(",
"String",
"glue",
",",
"Collection",
"<",
"E",
">",
"charSequences",
")",
"{",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"O... | Takes a string 'glue' and collection of CharSequences, and returns a StringBuffer containing the CharSequences
joined with the glue between each of them. They are joined in the order returned by the iterator of the colection
@param glue The glue string
@param charSequences The CharSequences to join
@return a... | [
"Takes",
"a",
"string",
"glue",
"and",
"collection",
"of",
"CharSequences",
"and",
"returns",
"a",
"StringBuffer",
"containing",
"the",
"CharSequences",
"joined",
"with",
"the",
"glue",
"between",
"each",
"of",
"them",
".",
"They",
"are",
"joined",
"in",
"the"... | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/util/StringUtil.java#L96-L110 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/GosuEscapeUtil.java | GosuEscapeUtil.escapeForJava | public static String escapeForJava( String string )
{
String result;
StringBuffer resultBuffer = null;
for( int i = 0, length = string.length(); i < length; i++ )
{
char ch = string.charAt( i );
String escape = escapeForJava( ch );
if( escape != null )
{
if( resultBuffe... | java | public static String escapeForJava( String string )
{
String result;
StringBuffer resultBuffer = null;
for( int i = 0, length = string.length(); i < length; i++ )
{
char ch = string.charAt( i );
String escape = escapeForJava( ch );
if( escape != null )
{
if( resultBuffe... | [
"public",
"static",
"String",
"escapeForJava",
"(",
"String",
"string",
")",
"{",
"String",
"result",
";",
"StringBuffer",
"resultBuffer",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"string",
".",
"length",
"(",
")",
";",
"... | Escape any special characters in the string, using the Java escape syntax.
For example any tabs become \t, newlines become \n etc.
@return the escaped string. Returns the original string unchanged if it
contains no special characters. | [
"Escape",
"any",
"special",
"characters",
"in",
"the",
"string",
"using",
"the",
"Java",
"escape",
"syntax",
".",
"For",
"example",
"any",
"tabs",
"become",
"\\",
"t",
"newlines",
"become",
"\\",
"n",
"etc",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuEscapeUtil.java#L16-L40 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/concurrent/LockingLazyVar.java | LockingLazyVar.make | public static <Q> LockingLazyVar<Q> make( final LazyVarInit<Q> init ) {
return new LockingLazyVar<Q>(){
protected Q init()
{
return init.init();
}
};
} | java | public static <Q> LockingLazyVar<Q> make( final LazyVarInit<Q> init ) {
return new LockingLazyVar<Q>(){
protected Q init()
{
return init.init();
}
};
} | [
"public",
"static",
"<",
"Q",
">",
"LockingLazyVar",
"<",
"Q",
">",
"make",
"(",
"final",
"LazyVarInit",
"<",
"Q",
">",
"init",
")",
"{",
"return",
"new",
"LockingLazyVar",
"<",
"Q",
">",
"(",
")",
"{",
"protected",
"Q",
"init",
"(",
")",
"{",
"ret... | Creates a new LockingLazyVar based on the type of the LazyVarInit passed in.
This method is intended to be called with blocks from Gosu. | [
"Creates",
"a",
"new",
"LockingLazyVar",
"based",
"on",
"the",
"type",
"of",
"the",
"LazyVarInit",
"passed",
"in",
".",
"This",
"method",
"is",
"intended",
"to",
"be",
"called",
"with",
"blocks",
"from",
"Gosu",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/concurrent/LockingLazyVar.java#L124-L131 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/parser/GosuParser.java | GosuParser.extractContextTypes | private List<List<IType>> extractContextTypes( List<? extends IInvocableType> funcTypes )
{
if( funcTypes != null )
{
ArrayList<List<IType>> returnList = new ArrayList<>();
for( IInvocableType funcType : funcTypes )
{
for( int i = 0; i < funcType.getParameterTypes().length; i++ )
... | java | private List<List<IType>> extractContextTypes( List<? extends IInvocableType> funcTypes )
{
if( funcTypes != null )
{
ArrayList<List<IType>> returnList = new ArrayList<>();
for( IInvocableType funcType : funcTypes )
{
for( int i = 0; i < funcType.getParameterTypes().length; i++ )
... | [
"private",
"List",
"<",
"List",
"<",
"IType",
">",
">",
"extractContextTypes",
"(",
"List",
"<",
"?",
"extends",
"IInvocableType",
">",
"funcTypes",
")",
"{",
"if",
"(",
"funcTypes",
"!=",
"null",
")",
"{",
"ArrayList",
"<",
"List",
"<",
"IType",
">>",
... | returns a list of lists of unique types at each argument position, | [
"returns",
"a",
"list",
"of",
"lists",
"of",
"unique",
"types",
"at",
"each",
"argument",
"position"
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/GosuParser.java#L8676-L8703 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/parser/GosuParser.java | GosuParser.maybeAddPrivateFunctionsIfSuperInSamePackage | private List<IFunctionSymbol> maybeAddPrivateFunctionsIfSuperInSamePackage( String name, List<IFunctionSymbol> functions )
{
ICompilableTypeInternal gsClass = getGosuClass();
if( gsClass == null )
{
return functions;
}
IType supertype = gsClass.getSupertype();
if( gsClass instanceof IGo... | java | private List<IFunctionSymbol> maybeAddPrivateFunctionsIfSuperInSamePackage( String name, List<IFunctionSymbol> functions )
{
ICompilableTypeInternal gsClass = getGosuClass();
if( gsClass == null )
{
return functions;
}
IType supertype = gsClass.getSupertype();
if( gsClass instanceof IGo... | [
"private",
"List",
"<",
"IFunctionSymbol",
">",
"maybeAddPrivateFunctionsIfSuperInSamePackage",
"(",
"String",
"name",
",",
"List",
"<",
"IFunctionSymbol",
">",
"functions",
")",
"{",
"ICompilableTypeInternal",
"gsClass",
"=",
"getGosuClass",
"(",
")",
";",
"if",
"(... | the super class is in the same package as the subclass. | [
"the",
"super",
"class",
"is",
"in",
"the",
"same",
"package",
"as",
"the",
"subclass",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/GosuParser.java#L14673-L14692 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/parser/GosuParser.java | GosuParser.getConstructorType | public IConstructorType getConstructorType( IType classBean, Expression[] eArgs, List<IConstructorType> listAllMatchingMethods, ParserBase parserState ) throws ParseException
{
if( classBean == null )
{
throw new ParseException( parserState == null ? null : parserState.makeFullParserState(), Res.MSG_BEA... | java | public IConstructorType getConstructorType( IType classBean, Expression[] eArgs, List<IConstructorType> listAllMatchingMethods, ParserBase parserState ) throws ParseException
{
if( classBean == null )
{
throw new ParseException( parserState == null ? null : parserState.makeFullParserState(), Res.MSG_BEA... | [
"public",
"IConstructorType",
"getConstructorType",
"(",
"IType",
"classBean",
",",
"Expression",
"[",
"]",
"eArgs",
",",
"List",
"<",
"IConstructorType",
">",
"listAllMatchingMethods",
",",
"ParserBase",
"parserState",
")",
"throws",
"ParseException",
"{",
"if",
"(... | Get the type of the method specified in the member path.
@param classBean The declaring class of the constructor.
@param parserState The parserState that may be involved in the process of parsing a constructor. Can be null.
@return A Gosu type for the constructor. | [
"Get",
"the",
"type",
"of",
"the",
"method",
"specified",
"in",
"the",
"member",
"path",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/GosuParser.java#L16262-L16335 | train |
gosu-lang/gosu-lang | gosu-lab/src/main/java/editor/debugger/DebuggerExpression.java | DebuggerExpression.evaluate | public Value evaluate( Debugger debugger ) throws InvocationException
{
RuntimeState runtimeState = getRuntimeState( debugger );
Location suspendedLoc = debugger.getSuspendedLocation();
VirtualMachine vm = suspendedLoc.virtualMachine();
ClassType classType = runtimeState.getCodeRunnerClass( vm );
... | java | public Value evaluate( Debugger debugger ) throws InvocationException
{
RuntimeState runtimeState = getRuntimeState( debugger );
Location suspendedLoc = debugger.getSuspendedLocation();
VirtualMachine vm = suspendedLoc.virtualMachine();
ClassType classType = runtimeState.getCodeRunnerClass( vm );
... | [
"public",
"Value",
"evaluate",
"(",
"Debugger",
"debugger",
")",
"throws",
"InvocationException",
"{",
"RuntimeState",
"runtimeState",
"=",
"getRuntimeState",
"(",
"debugger",
")",
";",
"Location",
"suspendedLoc",
"=",
"debugger",
".",
"getSuspendedLocation",
"(",
"... | EvaluationContextImpl should be at the same stackFrame as it was in the call to EvaluatorBuilderImpl.build | [
"EvaluationContextImpl",
"should",
"be",
"at",
"the",
"same",
"stackFrame",
"as",
"it",
"was",
"in",
"the",
"call",
"to",
"EvaluatorBuilderImpl",
".",
"build"
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/debugger/DebuggerExpression.java#L61-L89 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/gosuc/GosucUtil.java | GosucUtil.getJreJars | public static List<String> getJreJars() {
String javaHome = System.getProperty("java.home");
Path libsDir = FileSystems.getDefault().getPath(javaHome, "/lib");
List<String> retval = GosucUtil.getIbmClasspath();
try {
retval.addAll(Files.walk(libsDir)
.filter( path -> path.toFile().is... | java | public static List<String> getJreJars() {
String javaHome = System.getProperty("java.home");
Path libsDir = FileSystems.getDefault().getPath(javaHome, "/lib");
List<String> retval = GosucUtil.getIbmClasspath();
try {
retval.addAll(Files.walk(libsDir)
.filter( path -> path.toFile().is... | [
"public",
"static",
"List",
"<",
"String",
">",
"getJreJars",
"(",
")",
"{",
"String",
"javaHome",
"=",
"System",
".",
"getProperty",
"(",
"\"java.home\"",
")",
";",
"Path",
"libsDir",
"=",
"FileSystems",
".",
"getDefault",
"(",
")",
".",
"getPath",
"(",
... | Get all JARs from the lib directory of the System's java.home property
@return List of absolute paths to all JRE libraries | [
"Get",
"all",
"JARs",
"from",
"the",
"lib",
"directory",
"of",
"the",
"System",
"s",
"java",
".",
"home",
"property"
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/gosuc/GosucUtil.java#L76-L91 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/gosuc/GosucUtil.java | GosucUtil.getIbmClasspath | protected static List<String> getIbmClasspath() {
List<String> retval = new ArrayList<>();
if(System.getProperty("java.vendor").equals("IBM Corporation")) {
String fileSeparator = System.getProperty("file.separator");
String classpathSeparator = System.getProperty("path.separator");
String[] b... | java | protected static List<String> getIbmClasspath() {
List<String> retval = new ArrayList<>();
if(System.getProperty("java.vendor").equals("IBM Corporation")) {
String fileSeparator = System.getProperty("file.separator");
String classpathSeparator = System.getProperty("path.separator");
String[] b... | [
"protected",
"static",
"List",
"<",
"String",
">",
"getIbmClasspath",
"(",
")",
"{",
"List",
"<",
"String",
">",
"retval",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"System",
".",
"getProperty",
"(",
"\"java.vendor\"",
")",
".",
"equals",
... | Special handling for the unusual structure of the IBM JDK.
@return A list containing the special 'vm.jar' absolute path if we are using an IBM JDK; otherwise an empty list is returned. | [
"Special",
"handling",
"for",
"the",
"unusual",
"structure",
"of",
"the",
"IBM",
"JDK",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/gosuc/GosucUtil.java#L97-L111 | train |
gosu-lang/gosu-lang | gosu-lab/src/main/java/editor/GosuPanel.java | GosuPanel.refresh | public void refresh( Path file )
{
EditorHost editor = findTab( file );
if( editor != null )
{
// The file is open in an editor, refresh it with the contents of the file
try( Reader reader = PathUtil.createReader( file ) )
{
editor.refresh( StreamUtil.getContent( reader ) );
... | java | public void refresh( Path file )
{
EditorHost editor = findTab( file );
if( editor != null )
{
// The file is open in an editor, refresh it with the contents of the file
try( Reader reader = PathUtil.createReader( file ) )
{
editor.refresh( StreamUtil.getContent( reader ) );
... | [
"public",
"void",
"refresh",
"(",
"Path",
"file",
")",
"{",
"EditorHost",
"editor",
"=",
"findTab",
"(",
"file",
")",
";",
"if",
"(",
"editor",
"!=",
"null",
")",
"{",
"// The file is open in an editor, refresh it with the contents of the file",
"try",
"(",
"Reade... | This should only be called when either the file's contents change externally,
or when the file saves to disk. | [
"This",
"should",
"only",
"be",
"called",
"when",
"either",
"the",
"file",
"s",
"contents",
"change",
"externally",
"or",
"when",
"the",
"file",
"saves",
"to",
"disk",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/GosuPanel.java#L1716-L1746 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/parser/ContextInferenceManager.java | ContextInferenceManager.getUnwrappedExpression | public static Expression getUnwrappedExpression( Expression expression )
{
while( expression instanceof ImplicitTypeAsExpression )
{
expression = ((ImplicitTypeAsExpression) expression).getLHS();
}
return expression;
} | java | public static Expression getUnwrappedExpression( Expression expression )
{
while( expression instanceof ImplicitTypeAsExpression )
{
expression = ((ImplicitTypeAsExpression) expression).getLHS();
}
return expression;
} | [
"public",
"static",
"Expression",
"getUnwrappedExpression",
"(",
"Expression",
"expression",
")",
"{",
"while",
"(",
"expression",
"instanceof",
"ImplicitTypeAsExpression",
")",
"{",
"expression",
"=",
"(",
"(",
"ImplicitTypeAsExpression",
")",
"expression",
")",
".",... | If the expression is wrapped in ImplicitTypeAsExpressions, this will will unwrap them back
down to the original expression.
@param expression
@return | [
"If",
"the",
"expression",
"is",
"wrapped",
"in",
"ImplicitTypeAsExpressions",
"this",
"will",
"will",
"unwrap",
"them",
"back",
"down",
"to",
"the",
"original",
"expression",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/ContextInferenceManager.java#L319-L326 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/ir/transform/AbstractElementTransformer.java | AbstractElementTransformer.isReadObjectOrWriteObjectMethod | private boolean isReadObjectOrWriteObjectMethod( Symbol symbol ) {
if ( symbol instanceof DynamicFunctionSymbol ) {
DynamicFunctionSymbol dfs = (DynamicFunctionSymbol) symbol;
if (dfs.getDisplayName().equals("readObject")) {
IType[] argTypes = dfs.getArgTypes();
return argTypes != null &... | java | private boolean isReadObjectOrWriteObjectMethod( Symbol symbol ) {
if ( symbol instanceof DynamicFunctionSymbol ) {
DynamicFunctionSymbol dfs = (DynamicFunctionSymbol) symbol;
if (dfs.getDisplayName().equals("readObject")) {
IType[] argTypes = dfs.getArgTypes();
return argTypes != null &... | [
"private",
"boolean",
"isReadObjectOrWriteObjectMethod",
"(",
"Symbol",
"symbol",
")",
"{",
"if",
"(",
"symbol",
"instanceof",
"DynamicFunctionSymbol",
")",
"{",
"DynamicFunctionSymbol",
"dfs",
"=",
"(",
"DynamicFunctionSymbol",
")",
"symbol",
";",
"if",
"(",
"dfs",... | Returns true if that is the case, false otherwise | [
"Returns",
"true",
"if",
"that",
"is",
"the",
"case",
"false",
"otherwise"
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/ir/transform/AbstractElementTransformer.java#L1224-L1246 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/javadoc/ClassDocNode.java | ClassDocNode.areTypeNamesEqual | private boolean areTypeNamesEqual(String name1, String name2) {
return name1.replace('$', '.').equals(name2.replace('$', '.'));
} | java | private boolean areTypeNamesEqual(String name1, String name2) {
return name1.replace('$', '.').equals(name2.replace('$', '.'));
} | [
"private",
"boolean",
"areTypeNamesEqual",
"(",
"String",
"name1",
",",
"String",
"name2",
")",
"{",
"return",
"name1",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
".",
"equals",
"(",
"name2",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")... | rather we just didn't care about the difference | [
"rather",
"we",
"just",
"didn",
"t",
"care",
"about",
"the",
"difference"
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/javadoc/ClassDocNode.java#L322-L324 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/parser/Expression.java | Expression.getType | public IType getType()
{
IType type = getTypeImpl();
if (TypeSystem.isDeleted(type)) {
type = TypeSystem.getErrorType();
}
return type;
} | java | public IType getType()
{
IType type = getTypeImpl();
if (TypeSystem.isDeleted(type)) {
type = TypeSystem.getErrorType();
}
return type;
} | [
"public",
"IType",
"getType",
"(",
")",
"{",
"IType",
"type",
"=",
"getTypeImpl",
"(",
")",
";",
"if",
"(",
"TypeSystem",
".",
"isDeleted",
"(",
"type",
")",
")",
"{",
"type",
"=",
"TypeSystem",
".",
"getErrorType",
"(",
")",
";",
"}",
"return",
"typ... | Returns this Expression's IType. | [
"Returns",
"this",
"Expression",
"s",
"IType",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/Expression.java#L26-L33 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/xml/simple/SimpleXmlNodeWriter.java | SimpleXmlNodeWriter.xmlEncode | private static String xmlEncode(String input, boolean attribute) {
if (input == null || input.length() == 0) {
return attribute ? "\"\"" : input;
}
StringBuilder output = new StringBuilder();
if (attribute) {
output.append(0); // reserve space for leading quote
}
char quoteChar = 0;
... | java | private static String xmlEncode(String input, boolean attribute) {
if (input == null || input.length() == 0) {
return attribute ? "\"\"" : input;
}
StringBuilder output = new StringBuilder();
if (attribute) {
output.append(0); // reserve space for leading quote
}
char quoteChar = 0;
... | [
"private",
"static",
"String",
"xmlEncode",
"(",
"String",
"input",
",",
"boolean",
"attribute",
")",
"{",
"if",
"(",
"input",
"==",
"null",
"||",
"input",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"attribute",
"?",
"\"\\\"\\\"\"",
":",
"... | Properly encodes user input for inclusion in an XML document.
@param input the input to encode
@param attribute is this for an attribute? (returned value will be pre-quoted)
@return the XML-encoded input | [
"Properly",
"encodes",
"user",
"input",
"for",
"inclusion",
"in",
"an",
"XML",
"document",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/xml/simple/SimpleXmlNodeWriter.java#L90-L156 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/parser/ClassCache.java | ClassCache.reassignClassLoader | public void reassignClassLoader() {
ClassLoader loader = _module.getModuleClassLoader();
if( loader.getParent() instanceof IInjectableClassLoader ) {
// Dispose the GosuPluginContainer "singleton" and create a new one
((IInjectableClassLoader)loader.getParent()).dispose();
// Dispose the Modul... | java | public void reassignClassLoader() {
ClassLoader loader = _module.getModuleClassLoader();
if( loader.getParent() instanceof IInjectableClassLoader ) {
// Dispose the GosuPluginContainer "singleton" and create a new one
((IInjectableClassLoader)loader.getParent()).dispose();
// Dispose the Modul... | [
"public",
"void",
"reassignClassLoader",
"(",
")",
"{",
"ClassLoader",
"loader",
"=",
"_module",
".",
"getModuleClassLoader",
"(",
")",
";",
"if",
"(",
"loader",
".",
"getParent",
"(",
")",
"instanceof",
"IInjectableClassLoader",
")",
"{",
"// Dispose the GosuPlug... | Called in Single module mode. If the parent loader of the ModuleClassLoader is the GosuPluginContainer,
we drop the ModuleClassLoader and its parent, the GosuPluginContainer. New ones are created and assigned here.
Note, this is a giant hack among many gianter hacks that keep the old test framework floating. | [
"Called",
"in",
"Single",
"module",
"mode",
".",
"If",
"the",
"parent",
"loader",
"of",
"the",
"ModuleClassLoader",
"is",
"the",
"GosuPluginContainer",
"we",
"drop",
"the",
"ModuleClassLoader",
"and",
"its",
"parent",
"the",
"GosuPluginContainer",
".",
"New",
"o... | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/ClassCache.java#L330-L339 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/parser/Symbol.java | Symbol.invoke | public Object invoke( Object[] args )
{
Object value = getValue();
if( value instanceof ISymbol )
{
return ((Symbol)value).invoke( args );
}
if( value instanceof IBlock )
{
return ((IBlock) value).invokeWithArgs( args );
}
Method method = (Method)value;
Object ret;
... | java | public Object invoke( Object[] args )
{
Object value = getValue();
if( value instanceof ISymbol )
{
return ((Symbol)value).invoke( args );
}
if( value instanceof IBlock )
{
return ((IBlock) value).invokeWithArgs( args );
}
Method method = (Method)value;
Object ret;
... | [
"public",
"Object",
"invoke",
"(",
"Object",
"[",
"]",
"args",
")",
"{",
"Object",
"value",
"=",
"getValue",
"(",
")",
";",
"if",
"(",
"value",
"instanceof",
"ISymbol",
")",
"{",
"return",
"(",
"(",
"Symbol",
")",
"value",
")",
".",
"invoke",
"(",
... | Invokes function. | [
"Invokes",
"function",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/Symbol.java#L259-L282 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/perf/objectsize/ObjectSizeUtil.java | ObjectSizeUtil.deepSizeOf | public static ObjectSize deepSizeOf(Object obj, IObjectSizeFilter filter, int maxObjects) {
Map<Object, Object> visited = new IdentityHashMap<Object, Object>();
Stack<ObjectEntry> stack = new Stack<ObjectEntry>();
InvocationCounter sizeHistogram = new InvocationCounter(false);
long result = interna... | java | public static ObjectSize deepSizeOf(Object obj, IObjectSizeFilter filter, int maxObjects) {
Map<Object, Object> visited = new IdentityHashMap<Object, Object>();
Stack<ObjectEntry> stack = new Stack<ObjectEntry>();
InvocationCounter sizeHistogram = new InvocationCounter(false);
long result = interna... | [
"public",
"static",
"ObjectSize",
"deepSizeOf",
"(",
"Object",
"obj",
",",
"IObjectSizeFilter",
"filter",
",",
"int",
"maxObjects",
")",
"{",
"Map",
"<",
"Object",
",",
"Object",
">",
"visited",
"=",
"new",
"IdentityHashMap",
"<",
"Object",
",",
"Object",
">... | Calculates full size of object iterating over its hierarchy graph.
@param obj object to calculate size of
@param filter the filter used to ignore fields or objects
@param maxObjects the max numbers of objects to traverse
@return object size
@throws Exception | [
"Calculates",
"full",
"size",
"of",
"object",
"iterating",
"over",
"its",
"hierarchy",
"graph",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/perf/objectsize/ObjectSizeUtil.java#L57-L84 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/parser/expressions/ConditionalTernaryExpression.java | ConditionalTernaryExpression.evaluate | public Object evaluate()
{
if( !isCompileTimeConstant() )
{
return super.evaluate();
}
return (Boolean)getCondition().evaluate() ? getFirst().evaluate() : getSecond().evaluate();
} | java | public Object evaluate()
{
if( !isCompileTimeConstant() )
{
return super.evaluate();
}
return (Boolean)getCondition().evaluate() ? getFirst().evaluate() : getSecond().evaluate();
} | [
"public",
"Object",
"evaluate",
"(",
")",
"{",
"if",
"(",
"!",
"isCompileTimeConstant",
"(",
")",
")",
"{",
"return",
"super",
".",
"evaluate",
"(",
")",
";",
"}",
"return",
"(",
"Boolean",
")",
"getCondition",
"(",
")",
".",
"evaluate",
"(",
")",
"?... | Evaluates this Expression and returns the result. | [
"Evaluates",
"this",
"Expression",
"and",
"returns",
"the",
"result",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/expressions/ConditionalTernaryExpression.java#L83-L91 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/GosuObjectUtil.java | GosuObjectUtil.arrayHashCode | public static int arrayHashCode(Object array) {
if (array == null) {
return 0;
}
IType arrayType = TypeSystem.getFromObject(array);
int iLen = arrayType.getArrayLength(array);
int hashCode = 0;
for (int i = 0; i < iLen; i++) {
Object value = arrayType.getArrayComponent(array, i);
... | java | public static int arrayHashCode(Object array) {
if (array == null) {
return 0;
}
IType arrayType = TypeSystem.getFromObject(array);
int iLen = arrayType.getArrayLength(array);
int hashCode = 0;
for (int i = 0; i < iLen; i++) {
Object value = arrayType.getArrayComponent(array, i);
... | [
"public",
"static",
"int",
"arrayHashCode",
"(",
"Object",
"array",
")",
"{",
"if",
"(",
"array",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"IType",
"arrayType",
"=",
"TypeSystem",
".",
"getFromObject",
"(",
"array",
")",
";",
"int",
"iLen",
"="... | Return the hash code for an array
@param array the array to compute the hash code. | [
"Return",
"the",
"hash",
"code",
"for",
"an",
"array"
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuObjectUtil.java#L334-L353 | train |
gosu-lang/gosu-lang | gosu-lab/src/main/java/editor/GosuDocument.java | GosuDocument.getStyleCodeAtPosition | public Integer getStyleCodeAtPosition( int iPosition )
{
if( _locations == null || _locations.isEmpty() )
{
return null;
}
IParseTree l;
try
{
l = IParseTree.Search.getDeepestLocation( _locations, iPosition - _locationsOffset, true );
}
catch( Throwable t )
{
// O... | java | public Integer getStyleCodeAtPosition( int iPosition )
{
if( _locations == null || _locations.isEmpty() )
{
return null;
}
IParseTree l;
try
{
l = IParseTree.Search.getDeepestLocation( _locations, iPosition - _locationsOffset, true );
}
catch( Throwable t )
{
// O... | [
"public",
"Integer",
"getStyleCodeAtPosition",
"(",
"int",
"iPosition",
")",
"{",
"if",
"(",
"_locations",
"==",
"null",
"||",
"_locations",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"IParseTree",
"l",
";",
"try",
"{",
"l",
"=",
"... | Returns a style code for the absolute position in the document or null if
no code is mapped. | [
"Returns",
"a",
"style",
"code",
"for",
"the",
"absolute",
"position",
"in",
"the",
"document",
"or",
"null",
"if",
"no",
"code",
"is",
"mapped",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/GosuDocument.java#L151-L193 | train |
gosu-lang/gosu-lang | gosu-lab/src/main/java/editor/GosuDocument.java | GosuDocument.getStyleCodeForParsedElement | private Integer getStyleCodeForParsedElement( int iPosition, IParsedElement parsedElem )
{
if( parsedElem instanceof IBeanMethodCallStatement )
{
// Always inspect the IBeanMethodCallExpression rather than the corresponding statement
parsedElem = ((IBeanMethodCallStatement)parsedElem).getBeanMetho... | java | private Integer getStyleCodeForParsedElement( int iPosition, IParsedElement parsedElem )
{
if( parsedElem instanceof IBeanMethodCallStatement )
{
// Always inspect the IBeanMethodCallExpression rather than the corresponding statement
parsedElem = ((IBeanMethodCallStatement)parsedElem).getBeanMetho... | [
"private",
"Integer",
"getStyleCodeForParsedElement",
"(",
"int",
"iPosition",
",",
"IParsedElement",
"parsedElem",
")",
"{",
"if",
"(",
"parsedElem",
"instanceof",
"IBeanMethodCallStatement",
")",
"{",
"// Always inspect the IBeanMethodCallExpression rather than the correspondin... | Given a IParsedElement return a special Style. Or return null if no special
style exists for the IParsedElement. | [
"Given",
"a",
"IParsedElement",
"return",
"a",
"special",
"Style",
".",
"Or",
"return",
"null",
"if",
"no",
"special",
"style",
"exists",
"for",
"the",
"IParsedElement",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/GosuDocument.java#L199-L352 | train |
gosu-lang/gosu-lang | gosu-lab/src/main/java/editor/GosuDocument.java | GosuDocument.getScannerStart | public int getScannerStart( int p )
{
Element elem = getDefaultRootElement();
int lineNum = elem.getElementIndex( p );
Element line = elem.getElement( lineNum );
AttributeSet a = line.getAttributes();
while( a.isDefined( CommentAttribute ) && lineNum > 0 )
{
lineNum -= 1;
line = el... | java | public int getScannerStart( int p )
{
Element elem = getDefaultRootElement();
int lineNum = elem.getElementIndex( p );
Element line = elem.getElement( lineNum );
AttributeSet a = line.getAttributes();
while( a.isDefined( CommentAttribute ) && lineNum > 0 )
{
lineNum -= 1;
line = el... | [
"public",
"int",
"getScannerStart",
"(",
"int",
"p",
")",
"{",
"Element",
"elem",
"=",
"getDefaultRootElement",
"(",
")",
";",
"int",
"lineNum",
"=",
"elem",
".",
"getElementIndex",
"(",
"p",
")",
";",
"Element",
"line",
"=",
"elem",
".",
"getElement",
"... | Fetch a reasonable location to start scanning
given the desired start location. This allows
for adjustments needed to accomodate multiline
comments. | [
"Fetch",
"a",
"reasonable",
"location",
"to",
"start",
"scanning",
"given",
"the",
"desired",
"start",
"location",
".",
"This",
"allows",
"for",
"adjustments",
"needed",
"to",
"accomodate",
"multiline",
"comments",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/GosuDocument.java#L360-L373 | train |
gosu-lang/gosu-lang | gosu-lab/src/main/java/editor/GosuDocument.java | GosuDocument.insertUpdate | @Override
protected void insertUpdate( DefaultDocumentEvent chng, AttributeSet attr )
{
super.insertUpdate( chng, attr );
// Update comment marks
Element root = getDefaultRootElement();
DocumentEvent.ElementChange ec = chng.getChange( root );
if( ec != null )
{
Element[] added = ec.ge... | java | @Override
protected void insertUpdate( DefaultDocumentEvent chng, AttributeSet attr )
{
super.insertUpdate( chng, attr );
// Update comment marks
Element root = getDefaultRootElement();
DocumentEvent.ElementChange ec = chng.getChange( root );
if( ec != null )
{
Element[] added = ec.ge... | [
"@",
"Override",
"protected",
"void",
"insertUpdate",
"(",
"DefaultDocumentEvent",
"chng",
",",
"AttributeSet",
"attr",
")",
"{",
"super",
".",
"insertUpdate",
"(",
"chng",
",",
"attr",
")",
";",
"// Update comment marks",
"Element",
"root",
"=",
"getDefaultRootEl... | Updates document structure as a result of text insertion. This
will happen within a write lock. The superclass behavior of
updating the line map is executed followed by marking any comment
areas that should backtracked before scanning.
@param chng the change event
@param attr the set of attributes | [
"Updates",
"document",
"structure",
"as",
"a",
"result",
"of",
"text",
"insertion",
".",
"This",
"will",
"happen",
"within",
"a",
"write",
"lock",
".",
"The",
"superclass",
"behavior",
"of",
"updating",
"the",
"line",
"map",
"is",
"executed",
"followed",
"by... | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/GosuDocument.java#L386-L439 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/concurrent/LocklessLazyVar.java | LocklessLazyVar.make | public static <Q> LocklessLazyVar<Q> make( final LazyVarInit<Q> closure ) {
return new LocklessLazyVar<Q>(){
protected Q init()
{
return closure.init();
}
};
} | java | public static <Q> LocklessLazyVar<Q> make( final LazyVarInit<Q> closure ) {
return new LocklessLazyVar<Q>(){
protected Q init()
{
return closure.init();
}
};
} | [
"public",
"static",
"<",
"Q",
">",
"LocklessLazyVar",
"<",
"Q",
">",
"make",
"(",
"final",
"LazyVarInit",
"<",
"Q",
">",
"closure",
")",
"{",
"return",
"new",
"LocklessLazyVar",
"<",
"Q",
">",
"(",
")",
"{",
"protected",
"Q",
"init",
"(",
")",
"{",
... | Creates a new LockingLazyVar based on the type of the LazyVarInit passed in.
This method is intended to be called with a lambda or block from Gosu. | [
"Creates",
"a",
"new",
"LockingLazyVar",
"based",
"on",
"the",
"type",
"of",
"the",
"LazyVarInit",
"passed",
"in",
".",
"This",
"method",
"is",
"intended",
"to",
"be",
"called",
"with",
"a",
"lambda",
"or",
"block",
"from",
"Gosu",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/concurrent/LocklessLazyVar.java#L71-L78 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/GosuRefactorUtil.java | GosuRefactorUtil.boundingParent | public static IParsedElement boundingParent( List<IParseTree> locations, int position, Class<? extends IParsedElement>... possibleTypes )
{
IParseTree location = IParseTree.Search.getDeepestLocation( locations, position, true );
IParsedElement pe = null;
if( location != null )
{
pe = location.g... | java | public static IParsedElement boundingParent( List<IParseTree> locations, int position, Class<? extends IParsedElement>... possibleTypes )
{
IParseTree location = IParseTree.Search.getDeepestLocation( locations, position, true );
IParsedElement pe = null;
if( location != null )
{
pe = location.g... | [
"public",
"static",
"IParsedElement",
"boundingParent",
"(",
"List",
"<",
"IParseTree",
">",
"locations",
",",
"int",
"position",
",",
"Class",
"<",
"?",
"extends",
"IParsedElement",
">",
"...",
"possibleTypes",
")",
"{",
"IParseTree",
"location",
"=",
"IParseTr... | Finds a bounding parent of any of the possible types passed in from the list of locations, starting at the position
given. | [
"Finds",
"a",
"bounding",
"parent",
"of",
"any",
"of",
"the",
"possible",
"types",
"passed",
"in",
"from",
"the",
"list",
"of",
"locations",
"starting",
"at",
"the",
"position",
"given",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuRefactorUtil.java#L23-L37 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/GosuRefactorUtil.java | GosuRefactorUtil.findSpanningLogicalRange | public static IParseTree[] findSpanningLogicalRange( IParseTree start, IParseTree end )
{
while( end != null )
{
IParseTree deepestAtStart = start;
while( deepestAtStart != null )
{
if( deepestAtStart.isSiblingOf( end ) )
{
IParseTree[] returnVal = new IParseTree[2]... | java | public static IParseTree[] findSpanningLogicalRange( IParseTree start, IParseTree end )
{
while( end != null )
{
IParseTree deepestAtStart = start;
while( deepestAtStart != null )
{
if( deepestAtStart.isSiblingOf( end ) )
{
IParseTree[] returnVal = new IParseTree[2]... | [
"public",
"static",
"IParseTree",
"[",
"]",
"findSpanningLogicalRange",
"(",
"IParseTree",
"start",
",",
"IParseTree",
"end",
")",
"{",
"while",
"(",
"end",
"!=",
"null",
")",
"{",
"IParseTree",
"deepestAtStart",
"=",
"start",
";",
"while",
"(",
"deepestAtStar... | Given two parse tree positions, find the bounding pair that captures the start and end in one logical unit | [
"Given",
"two",
"parse",
"tree",
"positions",
"find",
"the",
"bounding",
"pair",
"that",
"captures",
"the",
"start",
"and",
"end",
"in",
"one",
"logical",
"unit"
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuRefactorUtil.java#L54-L90 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/init/ClasspathToGosuPathEntryUtil.java | ClasspathToGosuPathEntryUtil.convertClasspathToGosuPathEntries | public static List<GosuPathEntry> convertClasspathToGosuPathEntries(List<File> classpath) {
// this is a hack to prevent loading of gosu directly from jar files in Diamond,
// which prevents people from just embedding it in src and thus possibly having ND problems
// it can be removed once "modules" are fig... | java | public static List<GosuPathEntry> convertClasspathToGosuPathEntries(List<File> classpath) {
// this is a hack to prevent loading of gosu directly from jar files in Diamond,
// which prevents people from just embedding it in src and thus possibly having ND problems
// it can be removed once "modules" are fig... | [
"public",
"static",
"List",
"<",
"GosuPathEntry",
">",
"convertClasspathToGosuPathEntries",
"(",
"List",
"<",
"File",
">",
"classpath",
")",
"{",
"// this is a hack to prevent loading of gosu directly from jar files in Diamond,",
"// which prevents people from just embedding it in sr... | Converts a set of Files into a list of GosuPathEntries. The algorithm is as follows. For each File in the list,
if that file is a directory or a jar file, see if there's a module.xml file in the root. If so, parse that file
and add in a GosuPathEntry based on the module definition. If not, if the file is a director... | [
"Converts",
"a",
"set",
"of",
"Files",
"into",
"a",
"list",
"of",
"GosuPathEntries",
".",
"The",
"algorithm",
"is",
"as",
"follows",
".",
"For",
"each",
"File",
"in",
"the",
"list",
"if",
"that",
"file",
"is",
"a",
"directory",
"or",
"a",
"jar",
"file"... | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/init/ClasspathToGosuPathEntryUtil.java#L38-L53 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/parser/statements/SwitchStatement.java | SwitchStatement.getLeastSignificantTerminalStatement_internal | @Override
protected ITerminalStatement getLeastSignificantTerminalStatement_internal( boolean[] bAbsolute )
{
ITerminalStatement termRet = null;
bAbsolute[0] = true;
boolean bBreak = false;
ITerminalStatement lastCaseTerm = null;
if( _cases != null )
{
for( int i = 0; i < _cases.length... | java | @Override
protected ITerminalStatement getLeastSignificantTerminalStatement_internal( boolean[] bAbsolute )
{
ITerminalStatement termRet = null;
bAbsolute[0] = true;
boolean bBreak = false;
ITerminalStatement lastCaseTerm = null;
if( _cases != null )
{
for( int i = 0; i < _cases.length... | [
"@",
"Override",
"protected",
"ITerminalStatement",
"getLeastSignificantTerminalStatement_internal",
"(",
"boolean",
"[",
"]",
"bAbsolute",
")",
"{",
"ITerminalStatement",
"termRet",
"=",
"null",
";",
"bAbsolute",
"[",
"0",
"]",
"=",
"true",
";",
"boolean",
"bBreak"... | bAbsolute is true iff there are no break terminals anywhere in any cases and
the default clause's terminator is non-break and absolute | [
"bAbsolute",
"is",
"true",
"iff",
"there",
"are",
"no",
"break",
"terminals",
"anywhere",
"in",
"any",
"cases",
"and",
"the",
"default",
"clause",
"s",
"terminator",
"is",
"non",
"-",
"break",
"and",
"absolute"
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/statements/SwitchStatement.java#L94-L167 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/annotation/Annotations.java | Annotations.builder | public static <T extends Annotation> Builder<T> builder(Class<T> annotationType) {
return new Builder<T>(annotationType);
} | java | public static <T extends Annotation> Builder<T> builder(Class<T> annotationType) {
return new Builder<T>(annotationType);
} | [
"public",
"static",
"<",
"T",
"extends",
"Annotation",
">",
"Builder",
"<",
"T",
">",
"builder",
"(",
"Class",
"<",
"T",
">",
"annotationType",
")",
"{",
"return",
"new",
"Builder",
"<",
"T",
">",
"(",
"annotationType",
")",
";",
"}"
] | Returns a builder that can be used to construct an annotation instance. | [
"Returns",
"a",
"builder",
"that",
"can",
"be",
"used",
"to",
"construct",
"an",
"annotation",
"instance",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/annotation/Annotations.java#L27-L29 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/annotation/Annotations.java | Annotations.create | public static <T extends Annotation> T create(Class<T> annotationType, Object value) {
return new Builder<T>(annotationType).withValue(value).create();
} | java | public static <T extends Annotation> T create(Class<T> annotationType, Object value) {
return new Builder<T>(annotationType).withValue(value).create();
} | [
"public",
"static",
"<",
"T",
"extends",
"Annotation",
">",
"T",
"create",
"(",
"Class",
"<",
"T",
">",
"annotationType",
",",
"Object",
"value",
")",
"{",
"return",
"new",
"Builder",
"<",
"T",
">",
"(",
"annotationType",
")",
".",
"withValue",
"(",
"v... | Convenience method that constructs an annotation instance with a single "value" element. | [
"Convenience",
"method",
"that",
"constructs",
"an",
"annotation",
"instance",
"with",
"a",
"single",
"value",
"element",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/annotation/Annotations.java#L34-L36 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/annotation/Annotations.java | Annotations.create | public static <T extends Annotation> T create(Class<T> annotationType) {
return new Builder<T>(annotationType).create();
} | java | public static <T extends Annotation> T create(Class<T> annotationType) {
return new Builder<T>(annotationType).create();
} | [
"public",
"static",
"<",
"T",
"extends",
"Annotation",
">",
"T",
"create",
"(",
"Class",
"<",
"T",
">",
"annotationType",
")",
"{",
"return",
"new",
"Builder",
"<",
"T",
">",
"(",
"annotationType",
")",
".",
"create",
"(",
")",
";",
"}"
] | Convenience method that constructs an annotation instance with no elements. | [
"Convenience",
"method",
"that",
"constructs",
"an",
"annotation",
"instance",
"with",
"no",
"elements",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/annotation/Annotations.java#L41-L43 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/parser/expressions/RelationalExpression.java | RelationalExpression.evaluate | public Object evaluate()
{
if( !isCompileTimeConstant() )
{
return super.evaluate();
}
Object lhsValue = getLHS().evaluate();
Object rhsValue = getRHS().evaluate();
IType lhsType = getLHS().getType();
IType rhsType = getRHS().getType();
if( _strOperator.equals( ">" ) )
... | java | public Object evaluate()
{
if( !isCompileTimeConstant() )
{
return super.evaluate();
}
Object lhsValue = getLHS().evaluate();
Object rhsValue = getRHS().evaluate();
IType lhsType = getLHS().getType();
IType rhsType = getRHS().getType();
if( _strOperator.equals( ">" ) )
... | [
"public",
"Object",
"evaluate",
"(",
")",
"{",
"if",
"(",
"!",
"isCompileTimeConstant",
"(",
")",
")",
"{",
"return",
"super",
".",
"evaluate",
"(",
")",
";",
"}",
"Object",
"lhsValue",
"=",
"getLHS",
"(",
")",
".",
"evaluate",
"(",
")",
";",
"Object... | Perform a relational comparison. | [
"Perform",
"a",
"relational",
"comparison",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/expressions/RelationalExpression.java#L48-L160 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/StreamUtil.java | StreamUtil.toBytes | public static byte[] toBytes(CharSequence seq) {
try {
return seq.toString().getBytes("UTF-8");
}
catch (UnsupportedEncodingException ex) {
throw new RuntimeException(ex); // shouldn't happen since UTF-8 is supported by all JVMs per spec
}
} | java | public static byte[] toBytes(CharSequence seq) {
try {
return seq.toString().getBytes("UTF-8");
}
catch (UnsupportedEncodingException ex) {
throw new RuntimeException(ex); // shouldn't happen since UTF-8 is supported by all JVMs per spec
}
} | [
"public",
"static",
"byte",
"[",
"]",
"toBytes",
"(",
"CharSequence",
"seq",
")",
"{",
"try",
"{",
"return",
"seq",
".",
"toString",
"(",
")",
".",
"getBytes",
"(",
"\"UTF-8\"",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"ex",
")",
"{",... | Converts the specified character sequence to bytes using UTF-8.
@param seq the character sequence to convert
@return the UTF-8 encoded result | [
"Converts",
"the",
"specified",
"character",
"sequence",
"to",
"bytes",
"using",
"UTF",
"-",
"8",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/StreamUtil.java#L46-L53 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/StreamUtil.java | StreamUtil.toProperties | public static Properties toProperties(String propFileText) throws CharacterCodingException {
CharsetEncoder encoder = Charset.forName("ISO-8859-1").newEncoder().onUnmappableCharacter(CodingErrorAction.REPORT);
byte[] bytes = encoder.encode(CharBuffer.wrap(propFileText)).array();
Properties props = new Prope... | java | public static Properties toProperties(String propFileText) throws CharacterCodingException {
CharsetEncoder encoder = Charset.forName("ISO-8859-1").newEncoder().onUnmappableCharacter(CodingErrorAction.REPORT);
byte[] bytes = encoder.encode(CharBuffer.wrap(propFileText)).array();
Properties props = new Prope... | [
"public",
"static",
"Properties",
"toProperties",
"(",
"String",
"propFileText",
")",
"throws",
"CharacterCodingException",
"{",
"CharsetEncoder",
"encoder",
"=",
"Charset",
".",
"forName",
"(",
"\"ISO-8859-1\"",
")",
".",
"newEncoder",
"(",
")",
".",
"onUnmappableC... | Converts the specified property file text to a Properties object.
@param propFileText the property file text in standard property file format
@return the resulting Properties object
@throws java.nio.charset.CharacterCodingException if invalid encoding | [
"Converts",
"the",
"specified",
"property",
"file",
"text",
"to",
"a",
"Properties",
"object",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/StreamUtil.java#L91-L102 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/StreamUtil.java | StreamUtil.getInputStreamReader | public static Reader getInputStreamReader(InputStream in, String charset) {
try {
return new InputStreamReader(in, charset);
}
catch (UnsupportedEncodingException ex) {
throw new RuntimeException(ex); // shouldn't happen since UTF-8 is supported by all JVMs per spec
}
} | java | public static Reader getInputStreamReader(InputStream in, String charset) {
try {
return new InputStreamReader(in, charset);
}
catch (UnsupportedEncodingException ex) {
throw new RuntimeException(ex); // shouldn't happen since UTF-8 is supported by all JVMs per spec
}
} | [
"public",
"static",
"Reader",
"getInputStreamReader",
"(",
"InputStream",
"in",
",",
"String",
"charset",
")",
"{",
"try",
"{",
"return",
"new",
"InputStreamReader",
"(",
"in",
",",
"charset",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"ex",
... | Returns a reader for the specified input stream, using specified encoding.
@param in the input stream to wrap
@param charset the input stream to wrap
@return a reader for this input stream | [
"Returns",
"a",
"reader",
"for",
"the",
"specified",
"input",
"stream",
"using",
"specified",
"encoding",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/StreamUtil.java#L119-L126 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/StreamUtil.java | StreamUtil.getOutputStreamWriter | public static Writer getOutputStreamWriter(OutputStream out) {
try {
return new OutputStreamWriter(out, "UTF-8");
}
catch (UnsupportedEncodingException ex) {
throw new RuntimeException(ex); // shouldn't happen since UTF-8 is supported by all JVMs per spec
}
} | java | public static Writer getOutputStreamWriter(OutputStream out) {
try {
return new OutputStreamWriter(out, "UTF-8");
}
catch (UnsupportedEncodingException ex) {
throw new RuntimeException(ex); // shouldn't happen since UTF-8 is supported by all JVMs per spec
}
} | [
"public",
"static",
"Writer",
"getOutputStreamWriter",
"(",
"OutputStream",
"out",
")",
"{",
"try",
"{",
"return",
"new",
"OutputStreamWriter",
"(",
"out",
",",
"\"UTF-8\"",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"ex",
")",
"{",
"throw",
... | Returns a writer for the specified output stream, using UTF-8 encoding.
@param out the output stream to wrap
@return a writer for this output stream | [
"Returns",
"a",
"writer",
"for",
"the",
"specified",
"output",
"stream",
"using",
"UTF",
"-",
"8",
"encoding",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/StreamUtil.java#L133-L140 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/StreamUtil.java | StreamUtil.getContent | public static byte[] getContent(InputStream in) throws IOException {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
copy(in, baos);
return baos.toByteArray();
}
finally {
in.close();
}
} | java | public static byte[] getContent(InputStream in) throws IOException {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
copy(in, baos);
return baos.toByteArray();
}
finally {
in.close();
}
} | [
"public",
"static",
"byte",
"[",
"]",
"getContent",
"(",
"InputStream",
"in",
")",
"throws",
"IOException",
"{",
"try",
"{",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"copy",
"(",
"in",
",",
"baos",
")",
";",
"ret... | Returns the content of the specified input stream. The stream will be closed after calling this method.
@param in the input stream to read
@return the content of the input stream
@throws java.io.IOException if an I/O error occurs | [
"Returns",
"the",
"content",
"of",
"the",
"specified",
"input",
"stream",
".",
"The",
"stream",
"will",
"be",
"closed",
"after",
"calling",
"this",
"method",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/StreamUtil.java#L157-L166 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/StreamUtil.java | StreamUtil.getContent | public static String getContent(Reader in) throws IOException {
try {
StringWriter sw = new StringWriter();
copy(in, sw);
return sw.toString();
}
finally {
in.close();
}
} | java | public static String getContent(Reader in) throws IOException {
try {
StringWriter sw = new StringWriter();
copy(in, sw);
return sw.toString();
}
finally {
in.close();
}
} | [
"public",
"static",
"String",
"getContent",
"(",
"Reader",
"in",
")",
"throws",
"IOException",
"{",
"try",
"{",
"StringWriter",
"sw",
"=",
"new",
"StringWriter",
"(",
")",
";",
"copy",
"(",
"in",
",",
"sw",
")",
";",
"return",
"sw",
".",
"toString",
"(... | Returns the content of the specified reader. The reader will be closed after calling this method.
@param in the reader to read
@return the content of the reader
@throws java.io.IOException if an I/O error occurs | [
"Returns",
"the",
"content",
"of",
"the",
"specified",
"reader",
".",
"The",
"reader",
"will",
"be",
"closed",
"after",
"calling",
"this",
"method",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/StreamUtil.java#L174-L183 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/StreamUtil.java | StreamUtil.copy | public static void copy(InputStream in, Writer writer) throws IOException {
copy(getInputStreamReader(in), writer);
writer.flush();
} | java | public static void copy(InputStream in, Writer writer) throws IOException {
copy(getInputStreamReader(in), writer);
writer.flush();
} | [
"public",
"static",
"void",
"copy",
"(",
"InputStream",
"in",
",",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"copy",
"(",
"getInputStreamReader",
"(",
"in",
")",
",",
"writer",
")",
";",
"writer",
".",
"flush",
"(",
")",
";",
"}"
] | Copies the content of an input stream to a writer.
@param in the input stream to read
@param writer the writer to write
@throws java.io.IOException if an I/O error occurs | [
"Copies",
"the",
"content",
"of",
"an",
"input",
"stream",
"to",
"a",
"writer",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/StreamUtil.java#L209-L212 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/StreamUtil.java | StreamUtil.copy | public static void copy(Reader reader, OutputStream out) throws IOException {
copy(reader, getOutputStreamWriter(out));
out.flush();
} | java | public static void copy(Reader reader, OutputStream out) throws IOException {
copy(reader, getOutputStreamWriter(out));
out.flush();
} | [
"public",
"static",
"void",
"copy",
"(",
"Reader",
"reader",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"copy",
"(",
"reader",
",",
"getOutputStreamWriter",
"(",
"out",
")",
")",
";",
"out",
".",
"flush",
"(",
")",
";",
"}"
] | Copies the content of a reader to an output stream.
@param reader the reader to read
@param out the output stream to write
@throws java.io.IOException if an I/O error occurs | [
"Copies",
"the",
"content",
"of",
"a",
"reader",
"to",
"an",
"output",
"stream",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/StreamUtil.java#L220-L223 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/StreamUtil.java | StreamUtil.copy | public static void copy(Reader in, Writer out) throws IOException {
char[] buf = new char[1024];
while (true) {
int count = in.read(buf);
if (count < 0) {
break;
}
out.write(buf, 0, count);
}
out.flush();
} | java | public static void copy(Reader in, Writer out) throws IOException {
char[] buf = new char[1024];
while (true) {
int count = in.read(buf);
if (count < 0) {
break;
}
out.write(buf, 0, count);
}
out.flush();
} | [
"public",
"static",
"void",
"copy",
"(",
"Reader",
"in",
",",
"Writer",
"out",
")",
"throws",
"IOException",
"{",
"char",
"[",
"]",
"buf",
"=",
"new",
"char",
"[",
"1024",
"]",
";",
"while",
"(",
"true",
")",
"{",
"int",
"count",
"=",
"in",
".",
... | Copies the content of a reader to a writer.
@param in the reader to read
@param out the writer to write
@throws java.io.IOException if an I/O error occurs | [
"Copies",
"the",
"content",
"of",
"a",
"reader",
"to",
"a",
"writer",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/StreamUtil.java#L231-L241 | train |
gosu-lang/gosu-lang | gosu-lab/src/main/java/editor/ScriptEditorMouseWheelHandler.java | ScriptEditorMouseWheelHandler.forward | private void forward( MouseWheelEvent e )
{
e = new MouseWheelEvent( e.getComponent().getParent(), e.getID(), e.getWhen(), e.getModifiers(), e.getX(), e.getY(), e.getClickCount(), e.isPopupTrigger(), e.getScrollType(), e.getScrollAmount(), e.getWheelRotation() );
Toolkit.getDefaultToolkit().getSystemEventQueu... | java | private void forward( MouseWheelEvent e )
{
e = new MouseWheelEvent( e.getComponent().getParent(), e.getID(), e.getWhen(), e.getModifiers(), e.getX(), e.getY(), e.getClickCount(), e.isPopupTrigger(), e.getScrollType(), e.getScrollAmount(), e.getWheelRotation() );
Toolkit.getDefaultToolkit().getSystemEventQueu... | [
"private",
"void",
"forward",
"(",
"MouseWheelEvent",
"e",
")",
"{",
"e",
"=",
"new",
"MouseWheelEvent",
"(",
"e",
".",
"getComponent",
"(",
")",
".",
"getParent",
"(",
")",
",",
"e",
".",
"getID",
"(",
")",
",",
"e",
".",
"getWhen",
"(",
")",
",",... | For some reason the parent does not get mouse wheel | [
"For",
"some",
"reason",
"the",
"parent",
"does",
"not",
"get",
"mouse",
"wheel"
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/ScriptEditorMouseWheelHandler.java#L54-L58 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/reflect/TypeSystem.java | TypeSystem.parseTypeLiteral | public static IType parseTypeLiteral(String typeName) {
try {
IType type = GosuParserFactory.createParser(typeName).parseTypeLiteral(null).getType().getType();
if (type instanceof IErrorType) {
throw new RuntimeException("Type not found: " + typeName);
}
return type;
} catch (Par... | java | public static IType parseTypeLiteral(String typeName) {
try {
IType type = GosuParserFactory.createParser(typeName).parseTypeLiteral(null).getType().getType();
if (type instanceof IErrorType) {
throw new RuntimeException("Type not found: " + typeName);
}
return type;
} catch (Par... | [
"public",
"static",
"IType",
"parseTypeLiteral",
"(",
"String",
"typeName",
")",
"{",
"try",
"{",
"IType",
"type",
"=",
"GosuParserFactory",
".",
"createParser",
"(",
"typeName",
")",
".",
"parseTypeLiteral",
"(",
"null",
")",
".",
"getType",
"(",
")",
".",
... | Parses a type name such as Iterable<Claim>.
@param typeName the name to parse
@return the type | [
"Parses",
"a",
"type",
"name",
"such",
"as",
"Iterable<",
";",
"Claim>",
";",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/reflect/TypeSystem.java#L709-L719 | train |
gosu-lang/gosu-lang | gosu-lab/src/main/java/editor/util/TaskQueue.java | TaskQueue.getInstance | public static TaskQueue getInstance( ILogger logger, String strQueueName )
{
if( strQueueName == null )
{
return null;
}
TaskQueue taskQueue = QUEUE_MAP.get( strQueueName );
if( taskQueue == null )
{
taskQueue = new TaskQueue( logger, strQueueName );
QUEUE_MAP.put( strQueueN... | java | public static TaskQueue getInstance( ILogger logger, String strQueueName )
{
if( strQueueName == null )
{
return null;
}
TaskQueue taskQueue = QUEUE_MAP.get( strQueueName );
if( taskQueue == null )
{
taskQueue = new TaskQueue( logger, strQueueName );
QUEUE_MAP.put( strQueueN... | [
"public",
"static",
"TaskQueue",
"getInstance",
"(",
"ILogger",
"logger",
",",
"String",
"strQueueName",
")",
"{",
"if",
"(",
"strQueueName",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"TaskQueue",
"taskQueue",
"=",
"QUEUE_MAP",
".",
"get",
"(",
"... | Fetch a TaskQueue by name. If the TaskQueue doesn't already exist,
creates the TaskQueue.
@param logger An optional logger.
@param strQueueName The unique name for the queue.
@return The TaskQueue associated with the specified name. | [
"Fetch",
"a",
"TaskQueue",
"by",
"name",
".",
"If",
"the",
"TaskQueue",
"doesn",
"t",
"already",
"exist",
"creates",
"the",
"TaskQueue",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/util/TaskQueue.java#L67-L82 | train |
gosu-lang/gosu-lang | gosu-lab/src/main/java/editor/util/TaskQueue.java | TaskQueue.emptyAndRemoveQueue | public static void emptyAndRemoveQueue( String strQueueName )
{
TaskQueue taskQueue = QUEUE_MAP.get( strQueueName );
if( taskQueue != null )
{
taskQueue.emptyQueue();
synchronized( taskQueue._queue )
{
taskQueue._shutdown = true;
taskQueue._queue.notifyAll();
}
... | java | public static void emptyAndRemoveQueue( String strQueueName )
{
TaskQueue taskQueue = QUEUE_MAP.get( strQueueName );
if( taskQueue != null )
{
taskQueue.emptyQueue();
synchronized( taskQueue._queue )
{
taskQueue._shutdown = true;
taskQueue._queue.notifyAll();
}
... | [
"public",
"static",
"void",
"emptyAndRemoveQueue",
"(",
"String",
"strQueueName",
")",
"{",
"TaskQueue",
"taskQueue",
"=",
"QUEUE_MAP",
".",
"get",
"(",
"strQueueName",
")",
";",
"if",
"(",
"taskQueue",
"!=",
"null",
")",
"{",
"taskQueue",
".",
"emptyQueue",
... | Clears all the inactive tasks in the specified queue. | [
"Clears",
"all",
"the",
"inactive",
"tasks",
"in",
"the",
"specified",
"queue",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/util/TaskQueue.java#L87-L100 | train |
gosu-lang/gosu-lang | gosu-lab/src/main/java/editor/util/TaskQueue.java | TaskQueue.run | @Override
public void run()
{
while( !_shutdown )
{
try
{
Runnable task;
synchronized( _queue )
{
while( _queue.isEmpty() )
{
if( _shutdown )
{
return;
}
_queue.wait();
}
... | java | @Override
public void run()
{
while( !_shutdown )
{
try
{
Runnable task;
synchronized( _queue )
{
while( _queue.isEmpty() )
{
if( _shutdown )
{
return;
}
_queue.wait();
}
... | [
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"while",
"(",
"!",
"_shutdown",
")",
"{",
"try",
"{",
"Runnable",
"task",
";",
"synchronized",
"(",
"_queue",
")",
"{",
"while",
"(",
"_queue",
".",
"isEmpty",
"(",
")",
")",
"{",
"if",
"(",
... | Do NOT ever call this! Public only by contract. | [
"Do",
"NOT",
"ever",
"call",
"this!",
"Public",
"only",
"by",
"contract",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/util/TaskQueue.java#L215-L262 | train |
gosu-lang/gosu-lang | gosu-lab/src/main/java/editor/util/TaskQueue.java | TaskQueue.log | protected void log( Throwable t )
{
if( _logger == null )
{
t.printStackTrace();
}
else
{
_logger.warn( "Error running job.", t );
}
} | java | protected void log( Throwable t )
{
if( _logger == null )
{
t.printStackTrace();
}
else
{
_logger.warn( "Error running job.", t );
}
} | [
"protected",
"void",
"log",
"(",
"Throwable",
"t",
")",
"{",
"if",
"(",
"_logger",
"==",
"null",
")",
"{",
"t",
".",
"printStackTrace",
"(",
")",
";",
"}",
"else",
"{",
"_logger",
".",
"warn",
"(",
"\"Error running job.\"",
",",
"t",
")",
";",
"}",
... | Log an exception or error. | [
"Log",
"an",
"exception",
"or",
"error",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/util/TaskQueue.java#L267-L277 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/init/GosuPathEntry.java | GosuPathEntry.toDebugString | public String toDebugString() {
StringBuilder sb = new StringBuilder();
sb.append("GosuPathEntry:\n");
sb.append(" root: ").append(_root.toJavaFile().getAbsolutePath()).append("\n");
for (IDirectory src : _srcs) {
sb.append(" src: ").append(src.toJavaFile().getAbsolutePath()).append("\n");
}... | java | public String toDebugString() {
StringBuilder sb = new StringBuilder();
sb.append("GosuPathEntry:\n");
sb.append(" root: ").append(_root.toJavaFile().getAbsolutePath()).append("\n");
for (IDirectory src : _srcs) {
sb.append(" src: ").append(src.toJavaFile().getAbsolutePath()).append("\n");
}... | [
"public",
"String",
"toDebugString",
"(",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"GosuPathEntry:\\n\"",
")",
";",
"sb",
".",
"append",
"(",
"\" root: \"",
")",
".",
"append",
"(",
"_root",
... | Returns a String representation of this path entry suitable for use in debugging.
@return a debug String representation of this object | [
"Returns",
"a",
"String",
"representation",
"of",
"this",
"path",
"entry",
"suitable",
"for",
"use",
"in",
"debugging",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/init/GosuPathEntry.java#L59-L67 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/reflect/BeanInfoUtil.java | BeanInfoUtil.buildScriptableMethodDescriptorNoArgs | public static MethodDescriptor buildScriptableMethodDescriptorNoArgs( Class actionClass, String methodName )
{
MethodDescriptor md = _buildMethodDescriptor( actionClass, methodName, EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_CLASS_ARRAY );
makeScriptable( md );
return md;
} | java | public static MethodDescriptor buildScriptableMethodDescriptorNoArgs( Class actionClass, String methodName )
{
MethodDescriptor md = _buildMethodDescriptor( actionClass, methodName, EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_CLASS_ARRAY );
makeScriptable( md );
return md;
} | [
"public",
"static",
"MethodDescriptor",
"buildScriptableMethodDescriptorNoArgs",
"(",
"Class",
"actionClass",
",",
"String",
"methodName",
")",
"{",
"MethodDescriptor",
"md",
"=",
"_buildMethodDescriptor",
"(",
"actionClass",
",",
"methodName",
",",
"EMPTY_STRING_ARRAY",
... | Builds a no-arg method descriptor that is exposed for scripting everywhere. | [
"Builds",
"a",
"no",
"-",
"arg",
"method",
"descriptor",
"that",
"is",
"exposed",
"for",
"scripting",
"everywhere",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/reflect/BeanInfoUtil.java#L33-L38 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/reflect/BeanInfoUtil.java | BeanInfoUtil.buildScriptableMethodDescriptor | public static MethodDescriptor buildScriptableMethodDescriptor(
Class actionClass, String methodName, String[] parameterNames, Class[] parameterTypes )
{
MethodDescriptor md = _buildMethodDescriptor( actionClass, methodName, parameterNames, parameterTypes, parameterTypes );
makeScriptable( md );
retur... | java | public static MethodDescriptor buildScriptableMethodDescriptor(
Class actionClass, String methodName, String[] parameterNames, Class[] parameterTypes )
{
MethodDescriptor md = _buildMethodDescriptor( actionClass, methodName, parameterNames, parameterTypes, parameterTypes );
makeScriptable( md );
retur... | [
"public",
"static",
"MethodDescriptor",
"buildScriptableMethodDescriptor",
"(",
"Class",
"actionClass",
",",
"String",
"methodName",
",",
"String",
"[",
"]",
"parameterNames",
",",
"Class",
"[",
"]",
"parameterTypes",
")",
"{",
"MethodDescriptor",
"md",
"=",
"_build... | Builds a method descriptor that is exposed for scripting everywhere. | [
"Builds",
"a",
"method",
"descriptor",
"that",
"is",
"exposed",
"for",
"scripting",
"everywhere",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/reflect/BeanInfoUtil.java#L43-L49 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/reflect/BeanInfoUtil.java | BeanInfoUtil.buildScriptableDeprecatedMethodDescriptor | public static MethodDescriptor buildScriptableDeprecatedMethodDescriptor(
Class actionClass, String methodName, String[] parameterNames, Class[] parameterTypes )
{
MethodDescriptor md = _buildMethodDescriptor( actionClass, methodName, parameterNames, parameterTypes, parameterTypes );
makeScriptableDepreca... | java | public static MethodDescriptor buildScriptableDeprecatedMethodDescriptor(
Class actionClass, String methodName, String[] parameterNames, Class[] parameterTypes )
{
MethodDescriptor md = _buildMethodDescriptor( actionClass, methodName, parameterNames, parameterTypes, parameterTypes );
makeScriptableDepreca... | [
"public",
"static",
"MethodDescriptor",
"buildScriptableDeprecatedMethodDescriptor",
"(",
"Class",
"actionClass",
",",
"String",
"methodName",
",",
"String",
"[",
"]",
"parameterNames",
",",
"Class",
"[",
"]",
"parameterTypes",
")",
"{",
"MethodDescriptor",
"md",
"=",... | Builds a deprecated method descriptor that is exposed for scripting everywhere. | [
"Builds",
"a",
"deprecated",
"method",
"descriptor",
"that",
"is",
"exposed",
"for",
"scripting",
"everywhere",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/reflect/BeanInfoUtil.java#L54-L60 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/reflect/BeanInfoUtil.java | BeanInfoUtil.buildHiddenMethodDescriptor | public static MethodDescriptor buildHiddenMethodDescriptor(
Class actionClass, String methodName, String[] parameterNames, Class[] parameterTypes )
{
MethodDescriptor md = _buildMethodDescriptor( actionClass, methodName, parameterNames, parameterTypes, parameterTypes );
md.setHidden( true );
return md... | java | public static MethodDescriptor buildHiddenMethodDescriptor(
Class actionClass, String methodName, String[] parameterNames, Class[] parameterTypes )
{
MethodDescriptor md = _buildMethodDescriptor( actionClass, methodName, parameterNames, parameterTypes, parameterTypes );
md.setHidden( true );
return md... | [
"public",
"static",
"MethodDescriptor",
"buildHiddenMethodDescriptor",
"(",
"Class",
"actionClass",
",",
"String",
"methodName",
",",
"String",
"[",
"]",
"parameterNames",
",",
"Class",
"[",
"]",
"parameterTypes",
")",
"{",
"MethodDescriptor",
"md",
"=",
"_buildMeth... | Completely hides a method from scripting. | [
"Completely",
"hides",
"a",
"method",
"from",
"scripting",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/reflect/BeanInfoUtil.java#L65-L71 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/reflect/BeanInfoUtil.java | BeanInfoUtil.buildScriptablePropertyDescriptor | static public TypedPropertyDescriptor buildScriptablePropertyDescriptor(
String propertyName, Class beanClass, String getterName, String setterName )
{
TypedPropertyDescriptor pd = _buildPropertyDescriptor( propertyName, beanClass, getterName, setterName );
makeScriptable( pd );
return pd;
} | java | static public TypedPropertyDescriptor buildScriptablePropertyDescriptor(
String propertyName, Class beanClass, String getterName, String setterName )
{
TypedPropertyDescriptor pd = _buildPropertyDescriptor( propertyName, beanClass, getterName, setterName );
makeScriptable( pd );
return pd;
} | [
"static",
"public",
"TypedPropertyDescriptor",
"buildScriptablePropertyDescriptor",
"(",
"String",
"propertyName",
",",
"Class",
"beanClass",
",",
"String",
"getterName",
",",
"String",
"setterName",
")",
"{",
"TypedPropertyDescriptor",
"pd",
"=",
"_buildPropertyDescriptor"... | Builds a scriptable property descriptor with the given information.
@param propertyName name of the property
@param beanClass class of the bean on which the property is found
@param getterName name of the getter method, or null if write-only
@param propertyName name of the setter method, or null if read-only | [
"Builds",
"a",
"scriptable",
"property",
"descriptor",
"with",
"the",
"given",
"information",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/reflect/BeanInfoUtil.java#L90-L96 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/reflect/BeanInfoUtil.java | BeanInfoUtil.isVisible | public static boolean isVisible( FeatureDescriptor descriptor, IScriptabilityModifier constraint )
{
if( constraint == null )
{
return true;
}
IScriptabilityModifier modifier = getVisibilityModifier( descriptor );
if( modifier == null )
{
return true;
}
return modifier.sa... | java | public static boolean isVisible( FeatureDescriptor descriptor, IScriptabilityModifier constraint )
{
if( constraint == null )
{
return true;
}
IScriptabilityModifier modifier = getVisibilityModifier( descriptor );
if( modifier == null )
{
return true;
}
return modifier.sa... | [
"public",
"static",
"boolean",
"isVisible",
"(",
"FeatureDescriptor",
"descriptor",
",",
"IScriptabilityModifier",
"constraint",
")",
"{",
"if",
"(",
"constraint",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"IScriptabilityModifier",
"modifier",
"=",
"getV... | Determine if the descriptor is visible given a visibility constraint. | [
"Determine",
"if",
"the",
"descriptor",
"is",
"visible",
"given",
"a",
"visibility",
"constraint",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/reflect/BeanInfoUtil.java#L148-L162 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/reflect/BeanInfoUtil.java | BeanInfoUtil._buildMethodDescriptor | protected static MethodDescriptor _buildMethodDescriptor(
Class actionClass, String methodName, String[] parameterNames, Class[] parameterTypes, Class[] actualParameterTypes )
{
MethodDescriptor method;
assert (parameterNames.length == parameterTypes.length) : "Number of parameter names different from num... | java | protected static MethodDescriptor _buildMethodDescriptor(
Class actionClass, String methodName, String[] parameterNames, Class[] parameterTypes, Class[] actualParameterTypes )
{
MethodDescriptor method;
assert (parameterNames.length == parameterTypes.length) : "Number of parameter names different from num... | [
"protected",
"static",
"MethodDescriptor",
"_buildMethodDescriptor",
"(",
"Class",
"actionClass",
",",
"String",
"methodName",
",",
"String",
"[",
"]",
"parameterNames",
",",
"Class",
"[",
"]",
"parameterTypes",
",",
"Class",
"[",
"]",
"actualParameterTypes",
")",
... | Builds a method descriptor with no explicit visibility. | [
"Builds",
"a",
"method",
"descriptor",
"with",
"no",
"explicit",
"visibility",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/reflect/BeanInfoUtil.java#L185-L213 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/reflect/BeanInfoUtil.java | BeanInfoUtil._buildPropertyDescriptor | protected static TypedPropertyDescriptor _buildPropertyDescriptor(
String propertyName, Class beanClass, String getterName, String setterName )
{
try
{
return new TypedPropertyDescriptor( propertyName, beanClass, getterName, setterName );
}
catch( IntrospectionException e )
{
throw... | java | protected static TypedPropertyDescriptor _buildPropertyDescriptor(
String propertyName, Class beanClass, String getterName, String setterName )
{
try
{
return new TypedPropertyDescriptor( propertyName, beanClass, getterName, setterName );
}
catch( IntrospectionException e )
{
throw... | [
"protected",
"static",
"TypedPropertyDescriptor",
"_buildPropertyDescriptor",
"(",
"String",
"propertyName",
",",
"Class",
"beanClass",
",",
"String",
"getterName",
",",
"String",
"setterName",
")",
"{",
"try",
"{",
"return",
"new",
"TypedPropertyDescriptor",
"(",
"pr... | Builds a property descriptor with no explicit visibility. | [
"Builds",
"a",
"property",
"descriptor",
"with",
"no",
"explicit",
"visibility",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/reflect/BeanInfoUtil.java#L218-L230 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/Gosu.java | Gosu.makeFqn | private static String makeFqn( File file )
{
String path = file.getAbsolutePath();
int srcIndex = path.indexOf( "src" + File.separatorChar );
if( srcIndex >= 0 )
{
String fqn = path.substring( srcIndex + 4 ).replace( File.separatorChar, '.' );
return fqn.substring( 0, fqn.lastIndexOf( '.' ... | java | private static String makeFqn( File file )
{
String path = file.getAbsolutePath();
int srcIndex = path.indexOf( "src" + File.separatorChar );
if( srcIndex >= 0 )
{
String fqn = path.substring( srcIndex + 4 ).replace( File.separatorChar, '.' );
return fqn.substring( 0, fqn.lastIndexOf( '.' ... | [
"private",
"static",
"String",
"makeFqn",
"(",
"File",
"file",
")",
"{",
"String",
"path",
"=",
"file",
".",
"getAbsolutePath",
"(",
")",
";",
"int",
"srcIndex",
"=",
"path",
".",
"indexOf",
"(",
"\"src\"",
"+",
"File",
".",
"separatorChar",
")",
";",
... | Note this is a giant hack, we need to instead get the type name from the psiClass | [
"Note",
"this",
"is",
"a",
"giant",
"hack",
"we",
"need",
"to",
"instead",
"get",
"the",
"type",
"name",
"from",
"the",
"psiClass"
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/Gosu.java#L249-L264 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/parser/ParameterizedDynamicFunctionSymbol.java | ParameterizedDynamicFunctionSymbol.assignSuperDfs | private void assignSuperDfs( IDynamicFunctionSymbol dfsDelegate, IGosuClass owner )
{
IDynamicFunctionSymbol rawSuperDfs = dfsDelegate.getSuperDfs();
if( rawSuperDfs instanceof DynamicFunctionSymbol )
{
while( rawSuperDfs.getBackingDfs() instanceof DynamicFunctionSymbol && rawSuperDfs.getBackingDfs(... | java | private void assignSuperDfs( IDynamicFunctionSymbol dfsDelegate, IGosuClass owner )
{
IDynamicFunctionSymbol rawSuperDfs = dfsDelegate.getSuperDfs();
if( rawSuperDfs instanceof DynamicFunctionSymbol )
{
while( rawSuperDfs.getBackingDfs() instanceof DynamicFunctionSymbol && rawSuperDfs.getBackingDfs(... | [
"private",
"void",
"assignSuperDfs",
"(",
"IDynamicFunctionSymbol",
"dfsDelegate",
",",
"IGosuClass",
"owner",
")",
"{",
"IDynamicFunctionSymbol",
"rawSuperDfs",
"=",
"dfsDelegate",
".",
"getSuperDfs",
"(",
")",
";",
"if",
"(",
"rawSuperDfs",
"instanceof",
"DynamicFun... | Assign the super dfs in terms of the deriving class's type parameters | [
"Assign",
"the",
"super",
"dfs",
"in",
"terms",
"of",
"the",
"deriving",
"class",
"s",
"type",
"parameters"
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/ParameterizedDynamicFunctionSymbol.java#L41-L61 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/GosuExceptionUtil.java | GosuExceptionUtil.findExceptionCause | public static Throwable findExceptionCause( Throwable e )
{
Throwable error = e;
Throwable cause = e;
while( (error.getCause() != null) && (error.getCause() != error) )
{
cause = error.getCause();
error = cause;
}
return cause;
} | java | public static Throwable findExceptionCause( Throwable e )
{
Throwable error = e;
Throwable cause = e;
while( (error.getCause() != null) && (error.getCause() != error) )
{
cause = error.getCause();
error = cause;
}
return cause;
} | [
"public",
"static",
"Throwable",
"findExceptionCause",
"(",
"Throwable",
"e",
")",
"{",
"Throwable",
"error",
"=",
"e",
";",
"Throwable",
"cause",
"=",
"e",
";",
"while",
"(",
"(",
"error",
".",
"getCause",
"(",
")",
"!=",
"null",
")",
"&&",
"(",
"erro... | Given an Exception, finds the root cause and returns it. This may end up
returning the originally passed exception if that was the root cause.
@param e the Throwable whose root cause should be located.
@return the root Throwable, or e if it is the root. | [
"Given",
"an",
"Exception",
"finds",
"the",
"root",
"cause",
"and",
"returns",
"it",
".",
"This",
"may",
"end",
"up",
"returning",
"the",
"originally",
"passed",
"exception",
"if",
"that",
"was",
"the",
"root",
"cause",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuExceptionUtil.java#L31-L41 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/GosuExceptionUtil.java | GosuExceptionUtil.throwArgMismatchException | public static void throwArgMismatchException( IllegalArgumentException exceptionToWrap, String featureName, Class[] actualParameters, Object[] args )
{
String argTypes = "(";
for( int i = 0; i < actualParameters.length; i++ )
{
Class aClass = actualParameters[i];
if( i > 0 )
{
ar... | java | public static void throwArgMismatchException( IllegalArgumentException exceptionToWrap, String featureName, Class[] actualParameters, Object[] args )
{
String argTypes = "(";
for( int i = 0; i < actualParameters.length; i++ )
{
Class aClass = actualParameters[i];
if( i > 0 )
{
ar... | [
"public",
"static",
"void",
"throwArgMismatchException",
"(",
"IllegalArgumentException",
"exceptionToWrap",
",",
"String",
"featureName",
",",
"Class",
"[",
"]",
"actualParameters",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"String",
"argTypes",
"=",
"\"(\"",
";... | This method can be used to provide a more informative type-mismatch exception message than the standard java reflection
does with its IllegalArgumentException.
@param exceptionToWrap - exception to wrap
@param featureName - feature being executed when the (e.g. "method" or "constructor")
@param actualParameters ... | [
"This",
"method",
"can",
"be",
"used",
"to",
"provide",
"a",
"more",
"informative",
"type",
"-",
"mismatch",
"exception",
"message",
"than",
"the",
"standard",
"java",
"reflection",
"does",
"with",
"its",
"IllegalArgumentException",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuExceptionUtil.java#L52-L85 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/GosuExceptionUtil.java | GosuExceptionUtil.findException | public static <T extends Throwable> T findException(Class<T> exceptionTypeToFind, Throwable t) {
Throwable cause = t;
while (cause != null)
{
if( exceptionTypeToFind.isAssignableFrom( cause.getClass() ) )
{
//noinspection unchecked
return (T)cause;
}
if( cause == ca... | java | public static <T extends Throwable> T findException(Class<T> exceptionTypeToFind, Throwable t) {
Throwable cause = t;
while (cause != null)
{
if( exceptionTypeToFind.isAssignableFrom( cause.getClass() ) )
{
//noinspection unchecked
return (T)cause;
}
if( cause == ca... | [
"public",
"static",
"<",
"T",
"extends",
"Throwable",
">",
"T",
"findException",
"(",
"Class",
"<",
"T",
">",
"exceptionTypeToFind",
",",
"Throwable",
"t",
")",
"{",
"Throwable",
"cause",
"=",
"t",
";",
"while",
"(",
"cause",
"!=",
"null",
")",
"{",
"i... | Given an Exception and an Exception type to look for, finds the exception of that type
or returns null if none of that type exist. | [
"Given",
"an",
"Exception",
"and",
"an",
"Exception",
"type",
"to",
"look",
"for",
"finds",
"the",
"exception",
"of",
"that",
"type",
"or",
"returns",
"null",
"if",
"none",
"of",
"that",
"type",
"exist",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuExceptionUtil.java#L91-L110 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/parser/ParsedElement.java | ParsedElement.removeParseException | public ParseException removeParseException( ResourceKey keyToRemove )
{
if( _lnf != null )
{
return (ParseException)removeParseIssue( keyToRemove, _lnf._parseExceptions );
}
return null;
} | java | public ParseException removeParseException( ResourceKey keyToRemove )
{
if( _lnf != null )
{
return (ParseException)removeParseIssue( keyToRemove, _lnf._parseExceptions );
}
return null;
} | [
"public",
"ParseException",
"removeParseException",
"(",
"ResourceKey",
"keyToRemove",
")",
"{",
"if",
"(",
"_lnf",
"!=",
"null",
")",
"{",
"return",
"(",
"ParseException",
")",
"removeParseIssue",
"(",
"keyToRemove",
",",
"_lnf",
".",
"_parseExceptions",
")",
"... | Removes the specified parse exception or removes them all if the specified
exception is null. | [
"Removes",
"the",
"specified",
"parse",
"exception",
"or",
"removes",
"them",
"all",
"if",
"the",
"specified",
"exception",
"is",
"null",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/ParsedElement.java#L393-L400 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/parser/ParsedElement.java | ParsedElement.getContainedParsedElementsByType | @SuppressWarnings("unchecked" )
public <E extends IParsedElement> boolean getContainedParsedElementsByType( Class<E> parsedElementType, List<E> listResults )
{
return getContainedParsedElementsByTypes( (List<IParsedElement>)listResults, parsedElementType );
} | java | @SuppressWarnings("unchecked" )
public <E extends IParsedElement> boolean getContainedParsedElementsByType( Class<E> parsedElementType, List<E> listResults )
{
return getContainedParsedElementsByTypes( (List<IParsedElement>)listResults, parsedElementType );
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"E",
"extends",
"IParsedElement",
">",
"boolean",
"getContainedParsedElementsByType",
"(",
"Class",
"<",
"E",
">",
"parsedElementType",
",",
"List",
"<",
"E",
">",
"listResults",
")",
"{",
"retur... | Find all the parsed elements of a given type contained within this parsed
element.
@param parsedElementType The type of parsed element to find.
@param listResults A list of all the contained parsed elements matching the
specified type. Can be null if you are only interested in whether or not
parsedElementType ex... | [
"Find",
"all",
"the",
"parsed",
"elements",
"of",
"a",
"given",
"type",
"contained",
"within",
"this",
"parsed",
"element",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/ParsedElement.java#L765-L769 | train |
gosu-lang/gosu-lang | gosu-process/src/main/java/gw/util/ShellProcess.java | ShellProcess.readUntil | public String readUntil(String character, boolean includeDeliminator) {
return readStreamUntil(_javaProcess.getInputStream(), includeDeliminator, character.toCharArray());
} | java | public String readUntil(String character, boolean includeDeliminator) {
return readStreamUntil(_javaProcess.getInputStream(), includeDeliminator, character.toCharArray());
} | [
"public",
"String",
"readUntil",
"(",
"String",
"character",
",",
"boolean",
"includeDeliminator",
")",
"{",
"return",
"readStreamUntil",
"(",
"_javaProcess",
".",
"getInputStream",
"(",
")",
",",
"includeDeliminator",
",",
"character",
".",
"toCharArray",
"(",
")... | Reads a group of text from stdout. The line will start from the previous point until the read character. This
method will block until the specified character is read.
@param character the character to read until
@param includeDeliminator true to include the deliminator in the returned text, false to not.
@return The ... | [
"Reads",
"a",
"group",
"of",
"text",
"from",
"stdout",
".",
"The",
"line",
"will",
"start",
"from",
"the",
"previous",
"point",
"until",
"the",
"read",
"character",
".",
"This",
"method",
"will",
"block",
"until",
"the",
"specified",
"character",
"is",
"re... | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-process/src/main/java/gw/util/ShellProcess.java#L36-L38 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/config/ServiceKernel.java | ServiceKernel.defineService | protected <T extends IService, Q extends T> void defineService(Class<? extends T> service, Q defaultImplementation)
{
if( !_definingServices )
{
throw new IllegalStateException( "Service definition must be done only in the defineServices() method." );
}
if( !service.isInterface() )
{
t... | java | protected <T extends IService, Q extends T> void defineService(Class<? extends T> service, Q defaultImplementation)
{
if( !_definingServices )
{
throw new IllegalStateException( "Service definition must be done only in the defineServices() method." );
}
if( !service.isInterface() )
{
t... | [
"protected",
"<",
"T",
"extends",
"IService",
",",
"Q",
"extends",
"T",
">",
"void",
"defineService",
"(",
"Class",
"<",
"?",
"extends",
"T",
">",
"service",
",",
"Q",
"defaultImplementation",
")",
"{",
"if",
"(",
"!",
"_definingServices",
")",
"{",
"thr... | Defines a service provided by this ServiceKernel
@param service - the service to provide
@param defaultImplementation - the default implementation of this service | [
"Defines",
"a",
"service",
"provided",
"by",
"this",
"ServiceKernel"
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/config/ServiceKernel.java#L123-L143 | train |
gosu-lang/gosu-lang | gosu-lab/src/main/java/editor/SmartFixManager.java | SmartFixManager.updateState | public void updateState()
{
/*
if( _editor.getCaretPosition() == _iCaretPos )
{
if( isOtherPopupShowing() )
{
resetSmartHelpState();
}
return;
}
*/
resetSmartHelpState();
if( isOtherPopupShowing() )
{
return; //don't clobber existing popups
}
... | java | public void updateState()
{
/*
if( _editor.getCaretPosition() == _iCaretPos )
{
if( isOtherPopupShowing() )
{
resetSmartHelpState();
}
return;
}
*/
resetSmartHelpState();
if( isOtherPopupShowing() )
{
return; //don't clobber existing popups
}
... | [
"public",
"void",
"updateState",
"(",
")",
"{",
"/*\n if( _editor.getCaretPosition() == _iCaretPos )\n {\n if( isOtherPopupShowing() )\n {\n resetSmartHelpState();\n } \n return;\n }\n\n*/",
"resetSmartHelpState",
"(",
")",
";",
"if",
"(",
"isOtherP... | Updates the state of the SmartFixManager, which may display tool tips and offer to fix issues in the
gosu program. | [
"Updates",
"the",
"state",
"of",
"the",
"SmartFixManager",
"which",
"may",
"display",
"tool",
"tips",
"and",
"offer",
"to",
"fix",
"issues",
"in",
"the",
"gosu",
"program",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/SmartFixManager.java#L690-L811 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/ir/transform/TransformationContextBase.java | TransformationContextBase.getCurrentFunctionName | @Override
public String getCurrentFunctionName() {
DynamicFunctionSymbol functionSymbol = _bodyContext.getCurrentDFS();
return (functionSymbol == null ? null : functionSymbol.getName());
} | java | @Override
public String getCurrentFunctionName() {
DynamicFunctionSymbol functionSymbol = _bodyContext.getCurrentDFS();
return (functionSymbol == null ? null : functionSymbol.getName());
} | [
"@",
"Override",
"public",
"String",
"getCurrentFunctionName",
"(",
")",
"{",
"DynamicFunctionSymbol",
"functionSymbol",
"=",
"_bodyContext",
".",
"getCurrentDFS",
"(",
")",
";",
"return",
"(",
"functionSymbol",
"==",
"null",
"?",
"null",
":",
"functionSymbol",
".... | These methods should all be rolled directly onto FunctionBodyContext, I believe | [
"These",
"methods",
"should",
"all",
"be",
"rolled",
"directly",
"onto",
"FunctionBodyContext",
"I",
"believe"
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/ir/transform/TransformationContextBase.java#L202-L206 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/ir/transform/util/RequiresReflectionDeterminer.java | RequiresReflectionDeterminer.isGosuClassAccessingProtectedOrInternalMethodOfClassInDifferentClassloader | private static boolean isGosuClassAccessingProtectedOrInternalMethodOfClassInDifferentClassloader( ICompilableTypeInternal callingClass, IType declaringClass, IRelativeTypeInfo.Accessibility accessibility )
{
return (accessibility != IRelativeTypeInfo.Accessibility.PUBLIC ||
AccessibilityUtil.forType(... | java | private static boolean isGosuClassAccessingProtectedOrInternalMethodOfClassInDifferentClassloader( ICompilableTypeInternal callingClass, IType declaringClass, IRelativeTypeInfo.Accessibility accessibility )
{
return (accessibility != IRelativeTypeInfo.Accessibility.PUBLIC ||
AccessibilityUtil.forType(... | [
"private",
"static",
"boolean",
"isGosuClassAccessingProtectedOrInternalMethodOfClassInDifferentClassloader",
"(",
"ICompilableTypeInternal",
"callingClass",
",",
"IType",
"declaringClass",
",",
"IRelativeTypeInfo",
".",
"Accessibility",
"accessibility",
")",
"{",
"return",
"(",
... | Java will blow up if the package-level access is relied upon across class loaders, though, so we make the call reflectively. | [
"Java",
"will",
"blow",
"up",
"if",
"the",
"package",
"-",
"level",
"access",
"is",
"relied",
"upon",
"across",
"class",
"loaders",
"though",
"so",
"we",
"make",
"the",
"call",
"reflectively",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/ir/transform/util/RequiresReflectionDeterminer.java#L173-L182 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/reflect/json/Json.java | Json.fromJson | @SuppressWarnings("UnusedDeclaration")
public static Bindings fromJson( String json )
{
try
{
return PARSER.get().parseJson( json );
}
catch( ScriptException e )
{
throw new RuntimeException( e );
}
} | java | @SuppressWarnings("UnusedDeclaration")
public static Bindings fromJson( String json )
{
try
{
return PARSER.get().parseJson( json );
}
catch( ScriptException e )
{
throw new RuntimeException( e );
}
} | [
"@",
"SuppressWarnings",
"(",
"\"UnusedDeclaration\"",
")",
"public",
"static",
"Bindings",
"fromJson",
"(",
"String",
"json",
")",
"{",
"try",
"{",
"return",
"PARSER",
".",
"get",
"(",
")",
".",
"parseJson",
"(",
"json",
")",
";",
"}",
"catch",
"(",
"Sc... | Parse the JSON string as one of a javax.script.Bindings instance.
@param json A Standard JSON formatted string
@return A javax.script.Bindings instance | [
"Parse",
"the",
"JSON",
"string",
"as",
"one",
"of",
"a",
"javax",
".",
"script",
".",
"Bindings",
"instance",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/reflect/json/Json.java#L55-L66 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/GosuCollectionUtil.java | GosuCollectionUtil.compactAndLockHashMap | public static <S, T> Map<S, T> compactAndLockHashMap( HashMap<S, T> map )
{
if( map == null || map.isEmpty() )
{
return Collections.emptyMap();
}
if( map.size() == 1 )
{
Map.Entry<S, T> stEntry = map.entrySet().iterator().next();
return Collections.singletonMap( stEntry.getKey()... | java | public static <S, T> Map<S, T> compactAndLockHashMap( HashMap<S, T> map )
{
if( map == null || map.isEmpty() )
{
return Collections.emptyMap();
}
if( map.size() == 1 )
{
Map.Entry<S, T> stEntry = map.entrySet().iterator().next();
return Collections.singletonMap( stEntry.getKey()... | [
"public",
"static",
"<",
"S",
",",
"T",
">",
"Map",
"<",
"S",
",",
"T",
">",
"compactAndLockHashMap",
"(",
"HashMap",
"<",
"S",
",",
"T",
">",
"map",
")",
"{",
"if",
"(",
"map",
"==",
"null",
"||",
"map",
".",
"isEmpty",
"(",
")",
")",
"{",
"... | Returns a compacted and locked map representing the map passed in. This method can freely change the
implementation type of the map. I.e. it can return an emptyMap, singletonMap, or even a completely different map implementation. | [
"Returns",
"a",
"compacted",
"and",
"locked",
"map",
"representing",
"the",
"map",
"passed",
"in",
".",
"This",
"method",
"can",
"freely",
"change",
"the",
"implementation",
"type",
"of",
"the",
"map",
".",
"I",
".",
"e",
".",
"it",
"can",
"return",
"an"... | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuCollectionUtil.java#L23-L39 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/parser/ParserBase.java | ParserBase.parseDotPathWord | public String parseDotPathWord( String t )
{
StringBuilder sb = t == null ? null : new StringBuilder( t == null ? "" : t );
SourceCodeTokenizer tokenizer = getTokenizer();
while( match( null, '.' ) )
{
if( sb != null )
{
sb.append( '.' );
}
int mark = tokenizer.mark();
... | java | public String parseDotPathWord( String t )
{
StringBuilder sb = t == null ? null : new StringBuilder( t == null ? "" : t );
SourceCodeTokenizer tokenizer = getTokenizer();
while( match( null, '.' ) )
{
if( sb != null )
{
sb.append( '.' );
}
int mark = tokenizer.mark();
... | [
"public",
"String",
"parseDotPathWord",
"(",
"String",
"t",
")",
"{",
"StringBuilder",
"sb",
"=",
"t",
"==",
"null",
"?",
"null",
":",
"new",
"StringBuilder",
"(",
"t",
"==",
"null",
"?",
"\"\"",
":",
"t",
")",
";",
"SourceCodeTokenizer",
"tokenizer",
"=... | Parse a dot separated path as a single logical token | [
"Parse",
"a",
"dot",
"separated",
"path",
"as",
"a",
"single",
"logical",
"token"
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/ParserBase.java#L420-L444 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/parser/ParserBase.java | ParserBase.addError | final void addError( ParsedElement parsedElement, ResourceKey errorMsg )
{
verify( parsedElement, false, errorMsg, EMPTY_ARRAY );
} | java | final void addError( ParsedElement parsedElement, ResourceKey errorMsg )
{
verify( parsedElement, false, errorMsg, EMPTY_ARRAY );
} | [
"final",
"void",
"addError",
"(",
"ParsedElement",
"parsedElement",
",",
"ResourceKey",
"errorMsg",
")",
"{",
"verify",
"(",
"parsedElement",
",",
"false",
",",
"errorMsg",
",",
"EMPTY_ARRAY",
")",
";",
"}"
] | Optimizations to avoid creating vararg array | [
"Optimizations",
"to",
"avoid",
"creating",
"vararg",
"array"
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/ParserBase.java#L544-L547 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/ir/transform/expression/AbstractMemberExpansionTransformer.java | AbstractMemberExpansionTransformer.compileExpansionUsingArrayList | protected IRExpression compileExpansionUsingArrayList( IType rootType, IType rootComponentType, IType resultType, IType resultCompType, IType propertyType ) {
// Evaluate the root and assign it to a temp variable
IRSymbol tempRoot = _cc().makeAndIndexTempSymbol( getDescriptor( rootType ) );
IRStatement temp... | java | protected IRExpression compileExpansionUsingArrayList( IType rootType, IType rootComponentType, IType resultType, IType resultCompType, IType propertyType ) {
// Evaluate the root and assign it to a temp variable
IRSymbol tempRoot = _cc().makeAndIndexTempSymbol( getDescriptor( rootType ) );
IRStatement temp... | [
"protected",
"IRExpression",
"compileExpansionUsingArrayList",
"(",
"IType",
"rootType",
",",
"IType",
"rootComponentType",
",",
"IType",
"resultType",
",",
"IType",
"resultCompType",
",",
"IType",
"propertyType",
")",
"{",
"// Evaluate the root and assign it to a temp variab... | This method will compile the expansion using an ArrayList to collect temporary results. This is appropriate if the right-hand-side
is a Collection or array, if the root is an Iterable or Iterator or other object whose size can't easily be determined up-front,
or if the root is a nested Collection or array that will re... | [
"This",
"method",
"will",
"compile",
"the",
"expansion",
"using",
"an",
"ArrayList",
"to",
"collect",
"temporary",
"results",
".",
"This",
"is",
"appropriate",
"if",
"the",
"right",
"-",
"hand",
"-",
"side",
"is",
"a",
"Collection",
"or",
"array",
"if",
"t... | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/ir/transform/expression/AbstractMemberExpansionTransformer.java#L221-L238 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/parser/ModuleTypeLoader.java | ModuleTypeLoader.cacheType | private IType cacheType(String name, Pair<IType, ITypeLoader> pair)
{
if( pair != null )
{
IType type = pair.getFirst();
// We have to make sure we aren't replacing an existing type so we obey the return from the put.
IType oldType = _typesByName.get(name);
if( oldType != null && oldTy... | java | private IType cacheType(String name, Pair<IType, ITypeLoader> pair)
{
if( pair != null )
{
IType type = pair.getFirst();
// We have to make sure we aren't replacing an existing type so we obey the return from the put.
IType oldType = _typesByName.get(name);
if( oldType != null && oldTy... | [
"private",
"IType",
"cacheType",
"(",
"String",
"name",
",",
"Pair",
"<",
"IType",
",",
"ITypeLoader",
">",
"pair",
")",
"{",
"if",
"(",
"pair",
"!=",
"null",
")",
"{",
"IType",
"type",
"=",
"pair",
".",
"getFirst",
"(",
")",
";",
"// We have to make s... | Adds the type to the cache. | [
"Adds",
"the",
"type",
"to",
"the",
"cache",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/ModuleTypeLoader.java#L661-L680 | train |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/parser/TypeRefFactory.java | TypeRefFactory.create | @Override
public ITypeRef create( IType type )
{
// already a proxy? return as is then
if( type instanceof ITypeRef )
{
return (ITypeRef)type;
}
if( type instanceof INonLoadableType )
{
throw new UnsupportedOperationException( "Type references are not supported for nonloadable t... | java | @Override
public ITypeRef create( IType type )
{
// already a proxy? return as is then
if( type instanceof ITypeRef )
{
return (ITypeRef)type;
}
if( type instanceof INonLoadableType )
{
throw new UnsupportedOperationException( "Type references are not supported for nonloadable t... | [
"@",
"Override",
"public",
"ITypeRef",
"create",
"(",
"IType",
"type",
")",
"{",
"// already a proxy? return as is then",
"if",
"(",
"type",
"instanceof",
"ITypeRef",
")",
"{",
"return",
"(",
"ITypeRef",
")",
"type",
";",
"}",
"if",
"(",
"type",
"instanceof",
... | Wraps the actual class with a proxy. | [
"Wraps",
"the",
"actual",
"class",
"with",
"a",
"proxy",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/TypeRefFactory.java#L65-L92 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/reflect/gs/GosuClassPathThing.java | GosuClassPathThing.setupLoaderChainWithGosuUrl | private static void setupLoaderChainWithGosuUrl( ClassLoader loader ) {
UrlClassLoaderWrapper wrapped = UrlClassLoaderWrapper.wrapIfNotAlreadyVisited( loader );
if( wrapped == null ) {
return;
}
addGosuClassUrl( wrapped );
if( canWrapChain() ) {
if( loader != ClassLoader.getSystemClassLo... | java | private static void setupLoaderChainWithGosuUrl( ClassLoader loader ) {
UrlClassLoaderWrapper wrapped = UrlClassLoaderWrapper.wrapIfNotAlreadyVisited( loader );
if( wrapped == null ) {
return;
}
addGosuClassUrl( wrapped );
if( canWrapChain() ) {
if( loader != ClassLoader.getSystemClassLo... | [
"private",
"static",
"void",
"setupLoaderChainWithGosuUrl",
"(",
"ClassLoader",
"loader",
")",
"{",
"UrlClassLoaderWrapper",
"wrapped",
"=",
"UrlClassLoaderWrapper",
".",
"wrapIfNotAlreadyVisited",
"(",
"loader",
")",
";",
"if",
"(",
"wrapped",
"==",
"null",
")",
"{... | = null; | [
"=",
"null",
";"
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/reflect/gs/GosuClassPathThing.java#L25-L39 | train |
gosu-lang/gosu-lang | gosu-lab/src/main/java/editor/ParserFeedbackPanel.java | ParserFeedbackPanel.update | public void update( EditorHost editor )
{
_editor = editor;
_icon.setIcon( findIconForResults() );
_feedback.repaint();
repaint();
editor.repaint();
} | java | public void update( EditorHost editor )
{
_editor = editor;
_icon.setIcon( findIconForResults() );
_feedback.repaint();
repaint();
editor.repaint();
} | [
"public",
"void",
"update",
"(",
"EditorHost",
"editor",
")",
"{",
"_editor",
"=",
"editor",
";",
"_icon",
".",
"setIcon",
"(",
"findIconForResults",
"(",
")",
")",
";",
"_feedback",
".",
"repaint",
"(",
")",
";",
"repaint",
"(",
")",
";",
"editor",
".... | Updates this panel with current parser feedback.
@param editor The Gosu editor | [
"Updates",
"this",
"panel",
"with",
"current",
"parser",
"feedback",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/ParserFeedbackPanel.java#L42-L49 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/parser/StandardCoercionManager.java | StandardCoercionManager.convertValue | public final Object convertValue(Object value, IType intrType)
{
//==================================================================================
// Null handling
//==================================================================================
if( intrType == null )
{
return null;
... | java | public final Object convertValue(Object value, IType intrType)
{
//==================================================================================
// Null handling
//==================================================================================
if( intrType == null )
{
return null;
... | [
"public",
"final",
"Object",
"convertValue",
"(",
"Object",
"value",
",",
"IType",
"intrType",
")",
"{",
"//==================================================================================",
"// Null handling",
"//========================================================================... | Given a value and a target Class, return a compatible value via the target Class. | [
"Given",
"a",
"value",
"and",
"a",
"target",
"Class",
"return",
"a",
"compatible",
"value",
"via",
"the",
"target",
"Class",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/parser/StandardCoercionManager.java#L1066-L1175 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/parser/StandardCoercionManager.java | StandardCoercionManager.makeDateFrom | public Date makeDateFrom( Object obj )
{
if( obj == null )
{
return null;
}
if( obj instanceof IDimension )
{
obj = ((IDimension)obj).toNumber();
}
if( obj instanceof Date )
{
return (Date)obj;
}
if( obj instanceof Number )
{
return new Date( ((Nu... | java | public Date makeDateFrom( Object obj )
{
if( obj == null )
{
return null;
}
if( obj instanceof IDimension )
{
obj = ((IDimension)obj).toNumber();
}
if( obj instanceof Date )
{
return (Date)obj;
}
if( obj instanceof Number )
{
return new Date( ((Nu... | [
"public",
"Date",
"makeDateFrom",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"obj",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"obj",
"instanceof",
"IDimension",
")",
"{",
"obj",
"=",
"(",
"(",
"IDimension",
")",
"obj",
")",
"."... | Returns a new Date instance representing the object. | [
"Returns",
"a",
"new",
"Date",
"instance",
"representing",
"the",
"object",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/parser/StandardCoercionManager.java#L1816-L1858 | train |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/parser/StandardCoercionManager.java | StandardCoercionManager.parseDateTime | public Date parseDateTime( String str ) throws java.text.ParseException
{
if( str == null )
{
return null;
}
return DateFormat.getDateInstance().parse(str);
} | java | public Date parseDateTime( String str ) throws java.text.ParseException
{
if( str == null )
{
return null;
}
return DateFormat.getDateInstance().parse(str);
} | [
"public",
"Date",
"parseDateTime",
"(",
"String",
"str",
")",
"throws",
"java",
".",
"text",
".",
"ParseException",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"DateFormat",
".",
"getDateInstance",
"(",
")",
".",
... | Produce a date from a string using standard DateFormat parsing. | [
"Produce",
"a",
"date",
"from",
"a",
"string",
"using",
"standard",
"DateFormat",
"parsing",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/parser/StandardCoercionManager.java#L1869-L1877 | train |
gosu-lang/gosu-lang | gosu-lab/src/main/java/editor/util/TextComponentUtil.java | TextComponentUtil.getLineAtPosition | public static int getLineAtPosition( JTextComponent editor, int position )
{
if( position <= 0 )
{
return 1;
}
String s = editor.getText();
if( position > s.length() )
{
position = s.length();
}
try
{
return GosuStringUtil.countMatches( editor.getText( 0, positi... | java | public static int getLineAtPosition( JTextComponent editor, int position )
{
if( position <= 0 )
{
return 1;
}
String s = editor.getText();
if( position > s.length() )
{
position = s.length();
}
try
{
return GosuStringUtil.countMatches( editor.getText( 0, positi... | [
"public",
"static",
"int",
"getLineAtPosition",
"(",
"JTextComponent",
"editor",
",",
"int",
"position",
")",
"{",
"if",
"(",
"position",
"<=",
"0",
")",
"{",
"return",
"1",
";",
"}",
"String",
"s",
"=",
"editor",
".",
"getText",
"(",
")",
";",
"if",
... | Gets the line at a given position in the editor | [
"Gets",
"the",
"line",
"at",
"a",
"given",
"position",
"in",
"the",
"editor"
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/util/TextComponentUtil.java#L721-L742 | train |
gosu-lang/gosu-lang | gosu-lab/src/main/java/editor/util/TextComponentUtil.java | TextComponentUtil.getDeepestWhiteSpaceLineStartAfter | public static int getDeepestWhiteSpaceLineStartAfter( String script, int offset )
{
if( offset < 0 )
{
return offset;
}
int i = offset;
while( true )
{
int lineStartAfter = getWhiteSpaceLineStartAfter( script, i );
if( lineStartAfter == -1 )
{
return i;
... | java | public static int getDeepestWhiteSpaceLineStartAfter( String script, int offset )
{
if( offset < 0 )
{
return offset;
}
int i = offset;
while( true )
{
int lineStartAfter = getWhiteSpaceLineStartAfter( script, i );
if( lineStartAfter == -1 )
{
return i;
... | [
"public",
"static",
"int",
"getDeepestWhiteSpaceLineStartAfter",
"(",
"String",
"script",
",",
"int",
"offset",
")",
"{",
"if",
"(",
"offset",
"<",
"0",
")",
"{",
"return",
"offset",
";",
"}",
"int",
"i",
"=",
"offset",
";",
"while",
"(",
"true",
")",
... | Eats whitespace lines after the given offset until it finds a non-whitespace line and
returns the start of the last whitespace line found, or the initial value if none was. | [
"Eats",
"whitespace",
"lines",
"after",
"the",
"given",
"offset",
"until",
"it",
"finds",
"a",
"non",
"-",
"whitespace",
"line",
"and",
"returns",
"the",
"start",
"of",
"the",
"last",
"whitespace",
"line",
"found",
"or",
"the",
"initial",
"value",
"if",
"n... | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/util/TextComponentUtil.java#L858-L879 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.