id
int32 0
165k
| repo
stringlengths 7
58
| path
stringlengths 12
218
| func_name
stringlengths 3
140
| original_string
stringlengths 73
34.1k
| language
stringclasses 1
value | code
stringlengths 73
34.1k
| code_tokens
list | docstring
stringlengths 3
16k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 105
339
|
|---|---|---|---|---|---|---|---|---|---|---|---|
150,400
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mod/ModConfigPanel.java
|
ModConfigPanel.setLoopValue
|
public void setLoopValue(int newLoopValue)
{
if (newLoopValue==Helpers.PLAYER_LOOP_DEACTIVATED)
{
getPlayerSetUp_fadeOutLoops().setSelected(false);
getPlayerSetUp_ignoreLoops().setSelected(false);
}
else
if (newLoopValue==Helpers.PLAYER_LOOP_FADEOUT)
{
getPlayerSetUp_fadeOutLoops().setSelected(true);
getPlayerSetUp_ignoreLoops().setSelected(false);
}
else
if (newLoopValue==Helpers.PLAYER_LOOP_IGNORE)
{
getPlayerSetUp_fadeOutLoops().setSelected(false);
getPlayerSetUp_ignoreLoops().setSelected(true);
}
}
|
java
|
public void setLoopValue(int newLoopValue)
{
if (newLoopValue==Helpers.PLAYER_LOOP_DEACTIVATED)
{
getPlayerSetUp_fadeOutLoops().setSelected(false);
getPlayerSetUp_ignoreLoops().setSelected(false);
}
else
if (newLoopValue==Helpers.PLAYER_LOOP_FADEOUT)
{
getPlayerSetUp_fadeOutLoops().setSelected(true);
getPlayerSetUp_ignoreLoops().setSelected(false);
}
else
if (newLoopValue==Helpers.PLAYER_LOOP_IGNORE)
{
getPlayerSetUp_fadeOutLoops().setSelected(false);
getPlayerSetUp_ignoreLoops().setSelected(true);
}
}
|
[
"public",
"void",
"setLoopValue",
"(",
"int",
"newLoopValue",
")",
"{",
"if",
"(",
"newLoopValue",
"==",
"Helpers",
".",
"PLAYER_LOOP_DEACTIVATED",
")",
"{",
"getPlayerSetUp_fadeOutLoops",
"(",
")",
".",
"setSelected",
"(",
"false",
")",
";",
"getPlayerSetUp_ignoreLoops",
"(",
")",
".",
"setSelected",
"(",
"false",
")",
";",
"}",
"else",
"if",
"(",
"newLoopValue",
"==",
"Helpers",
".",
"PLAYER_LOOP_FADEOUT",
")",
"{",
"getPlayerSetUp_fadeOutLoops",
"(",
")",
".",
"setSelected",
"(",
"true",
")",
";",
"getPlayerSetUp_ignoreLoops",
"(",
")",
".",
"setSelected",
"(",
"false",
")",
";",
"}",
"else",
"if",
"(",
"newLoopValue",
"==",
"Helpers",
".",
"PLAYER_LOOP_IGNORE",
")",
"{",
"getPlayerSetUp_fadeOutLoops",
"(",
")",
".",
"setSelected",
"(",
"false",
")",
";",
"getPlayerSetUp_ignoreLoops",
"(",
")",
".",
"setSelected",
"(",
"true",
")",
";",
"}",
"}"
] |
Never ever call this Method from an event handler for those
two buttons - endless loop!
@param newLoopValue
@since 11.01.2012
|
[
"Never",
"ever",
"call",
"this",
"Method",
"from",
"an",
"event",
"handler",
"for",
"those",
"two",
"buttons",
"-",
"endless",
"loop!"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/ModConfigPanel.java#L228-L247
|
150,401
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java
|
MP3FileID3Controller.removeTags
|
public void removeTags(int type) throws FileNotFoundException, IOException
{
RandomAccessFile raf = null;
try
{
raf = new RandomAccessFile(mp3File, "rw");
if (allow(type&ID3V1))
{
id3v1.removeTag(raf);
}
if (allow(type&ID3V2))
{
id3v2.removeTag(raf);
}
}
finally
{
if (raf != null) raf.close();
}
}
|
java
|
public void removeTags(int type) throws FileNotFoundException, IOException
{
RandomAccessFile raf = null;
try
{
raf = new RandomAccessFile(mp3File, "rw");
if (allow(type&ID3V1))
{
id3v1.removeTag(raf);
}
if (allow(type&ID3V2))
{
id3v2.removeTag(raf);
}
}
finally
{
if (raf != null) raf.close();
}
}
|
[
"public",
"void",
"removeTags",
"(",
"int",
"type",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
"{",
"RandomAccessFile",
"raf",
"=",
"null",
";",
"try",
"{",
"raf",
"=",
"new",
"RandomAccessFile",
"(",
"mp3File",
",",
"\"rw\"",
")",
";",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V1",
")",
")",
"{",
"id3v1",
".",
"removeTag",
"(",
"raf",
")",
";",
"}",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V2",
")",
")",
"{",
"id3v2",
".",
"removeTag",
"(",
"raf",
")",
";",
"}",
"}",
"finally",
"{",
"if",
"(",
"raf",
"!=",
"null",
")",
"raf",
".",
"close",
"(",
")",
";",
"}",
"}"
] |
Removes id3 tags from the file. The argument specifies which tags to
remove. This can either be BOTH_TAGS, ID3V1_ONLY, ID3V2_ONLY, or
EXISTING_TAGS_ONLY.
@param type specifies what tag(s) to remove
@exception FileNotFoundException if an error occurs
@exception IOException if an error occurs
|
[
"Removes",
"id3",
"tags",
"from",
"the",
"file",
".",
"The",
"argument",
"specifies",
"which",
"tags",
"to",
"remove",
".",
"This",
"can",
"either",
"be",
"BOTH_TAGS",
"ID3V1_ONLY",
"ID3V2_ONLY",
"or",
"EXISTING_TAGS_ONLY",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java#L101-L121
|
150,402
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java
|
MP3FileID3Controller.writeTags
|
public void writeTags() throws FileNotFoundException, IOException
{
RandomAccessFile raf = null;
try
{
raf = new RandomAccessFile(mp3File, "rw");
// Write out id3v2 first because if the filesize is changed when an
// id3v2 is written then the id3v1 may be moved away from the end
// of the file which would cause it to not be recognized.
if (id3v2.tagExists())
{
id3v2.writeTag(raf);
}
if (id3v1.tagExists())
{
id3v1.writeTag(raf);
}
}
finally
{
if (raf != null) raf.close();
}
}
|
java
|
public void writeTags() throws FileNotFoundException, IOException
{
RandomAccessFile raf = null;
try
{
raf = new RandomAccessFile(mp3File, "rw");
// Write out id3v2 first because if the filesize is changed when an
// id3v2 is written then the id3v1 may be moved away from the end
// of the file which would cause it to not be recognized.
if (id3v2.tagExists())
{
id3v2.writeTag(raf);
}
if (id3v1.tagExists())
{
id3v1.writeTag(raf);
}
}
finally
{
if (raf != null) raf.close();
}
}
|
[
"public",
"void",
"writeTags",
"(",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
"{",
"RandomAccessFile",
"raf",
"=",
"null",
";",
"try",
"{",
"raf",
"=",
"new",
"RandomAccessFile",
"(",
"mp3File",
",",
"\"rw\"",
")",
";",
"// Write out id3v2 first because if the filesize is changed when an",
"// id3v2 is written then the id3v1 may be moved away from the end",
"// of the file which would cause it to not be recognized.",
"if",
"(",
"id3v2",
".",
"tagExists",
"(",
")",
")",
"{",
"id3v2",
".",
"writeTag",
"(",
"raf",
")",
";",
"}",
"if",
"(",
"id3v1",
".",
"tagExists",
"(",
")",
")",
"{",
"id3v1",
".",
"writeTag",
"(",
"raf",
")",
";",
"}",
"}",
"finally",
"{",
"if",
"(",
"raf",
"!=",
"null",
")",
"raf",
".",
"close",
"(",
")",
";",
"}",
"}"
] |
Writes the current state of the id3 tags to the file. What tags are
written depends upon the tagType passed to the constructor.
@exception FileNotFoundException if an error occurs
@exception IOException if an error occurs
|
[
"Writes",
"the",
"current",
"state",
"of",
"the",
"id3",
"tags",
"to",
"the",
"file",
".",
"What",
"tags",
"are",
"written",
"depends",
"upon",
"the",
"tagType",
"passed",
"to",
"the",
"constructor",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java#L130-L152
|
150,403
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java
|
MP3FileID3Controller.setTitle
|
public void setTitle(String title, int type)
{
if (allow(type&ID3V1))
{
id3v1.setTitle(title);
}
if (allow(type&ID3V2))
{
id3v2.setTextFrame(ID3v2Frames.TITLE, title);
}
}
|
java
|
public void setTitle(String title, int type)
{
if (allow(type&ID3V1))
{
id3v1.setTitle(title);
}
if (allow(type&ID3V2))
{
id3v2.setTextFrame(ID3v2Frames.TITLE, title);
}
}
|
[
"public",
"void",
"setTitle",
"(",
"String",
"title",
",",
"int",
"type",
")",
"{",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V1",
")",
")",
"{",
"id3v1",
".",
"setTitle",
"(",
"title",
")",
";",
"}",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V2",
")",
")",
"{",
"id3v2",
".",
"setTextFrame",
"(",
"ID3v2Frames",
".",
"TITLE",
",",
"title",
")",
";",
"}",
"}"
] |
Set the title of this mp3.
@param title the title of the mp3
|
[
"Set",
"the",
"title",
"of",
"this",
"mp3",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java#L159-L169
|
150,404
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java
|
MP3FileID3Controller.setAlbum
|
public void setAlbum(String album, int type)
{
if (allow(type&ID3V1))
{
id3v1.setAlbum(album);
}
if (allow(type&ID3V2))
{
id3v2.setTextFrame(ID3v2Frames.ALBUM, album);
}
}
|
java
|
public void setAlbum(String album, int type)
{
if (allow(type&ID3V1))
{
id3v1.setAlbum(album);
}
if (allow(type&ID3V2))
{
id3v2.setTextFrame(ID3v2Frames.ALBUM, album);
}
}
|
[
"public",
"void",
"setAlbum",
"(",
"String",
"album",
",",
"int",
"type",
")",
"{",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V1",
")",
")",
"{",
"id3v1",
".",
"setAlbum",
"(",
"album",
")",
";",
"}",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V2",
")",
")",
"{",
"id3v2",
".",
"setTextFrame",
"(",
"ID3v2Frames",
".",
"ALBUM",
",",
"album",
")",
";",
"}",
"}"
] |
Set the album of this mp3.
@param album the album of the mp3
|
[
"Set",
"the",
"album",
"of",
"this",
"mp3",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java#L176-L186
|
150,405
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java
|
MP3FileID3Controller.setArtist
|
public void setArtist(String artist, int type)
{
if (allow(type&ID3V1))
{
id3v1.setArtist(artist);
}
if (allow(type&ID3V2))
{
id3v2.setTextFrame(ID3v2Frames.LEAD_PERFORMERS, artist);
}
}
|
java
|
public void setArtist(String artist, int type)
{
if (allow(type&ID3V1))
{
id3v1.setArtist(artist);
}
if (allow(type&ID3V2))
{
id3v2.setTextFrame(ID3v2Frames.LEAD_PERFORMERS, artist);
}
}
|
[
"public",
"void",
"setArtist",
"(",
"String",
"artist",
",",
"int",
"type",
")",
"{",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V1",
")",
")",
"{",
"id3v1",
".",
"setArtist",
"(",
"artist",
")",
";",
"}",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V2",
")",
")",
"{",
"id3v2",
".",
"setTextFrame",
"(",
"ID3v2Frames",
".",
"LEAD_PERFORMERS",
",",
"artist",
")",
";",
"}",
"}"
] |
Set the artist of this mp3.
@param artist the artist of the mp3
|
[
"Set",
"the",
"artist",
"of",
"this",
"mp3",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java#L193-L203
|
150,406
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java
|
MP3FileID3Controller.setComment
|
public void setComment(String comment, int type)
{
if (allow(type&ID3V1))
{
id3v1.setComment(comment);
}
if (allow(type&ID3V2))
{
id3v2.setCommentFrame("", comment);
}
}
|
java
|
public void setComment(String comment, int type)
{
if (allow(type&ID3V1))
{
id3v1.setComment(comment);
}
if (allow(type&ID3V2))
{
id3v2.setCommentFrame("", comment);
}
}
|
[
"public",
"void",
"setComment",
"(",
"String",
"comment",
",",
"int",
"type",
")",
"{",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V1",
")",
")",
"{",
"id3v1",
".",
"setComment",
"(",
"comment",
")",
";",
"}",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V2",
")",
")",
"{",
"id3v2",
".",
"setCommentFrame",
"(",
"\"\"",
",",
"comment",
")",
";",
"}",
"}"
] |
Add a comment to this mp3.
@param comment a comment to add to the mp3
|
[
"Add",
"a",
"comment",
"to",
"this",
"mp3",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java#L210-L220
|
150,407
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java
|
MP3FileID3Controller.setGenre
|
public void setGenre(String genre, int type)
{
if (allow(type&ID3V1))
{
id3v1.setGenreString(genre);
}
if (allow(type&ID3V2))
{
id3v2.setTextFrame(ID3v2Frames.CONTENT_TYPE, genre);
}
}
|
java
|
public void setGenre(String genre, int type)
{
if (allow(type&ID3V1))
{
id3v1.setGenreString(genre);
}
if (allow(type&ID3V2))
{
id3v2.setTextFrame(ID3v2Frames.CONTENT_TYPE, genre);
}
}
|
[
"public",
"void",
"setGenre",
"(",
"String",
"genre",
",",
"int",
"type",
")",
"{",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V1",
")",
")",
"{",
"id3v1",
".",
"setGenreString",
"(",
"genre",
")",
";",
"}",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V2",
")",
")",
"{",
"id3v2",
".",
"setTextFrame",
"(",
"ID3v2Frames",
".",
"CONTENT_TYPE",
",",
"genre",
")",
";",
"}",
"}"
] |
Set the genre of this mp3.
@param genre the genre of the mp3
|
[
"Set",
"the",
"genre",
"of",
"this",
"mp3",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java#L227-L237
|
150,408
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java
|
MP3FileID3Controller.setYear
|
public void setYear(String year, int type)
{
if (allow(type&ID3V1))
{
id3v1.setYear(year);
}
if (allow(type&ID3V2))
{
id3v2.setTextFrame(ID3v2Frames.YEAR, year);
}
}
|
java
|
public void setYear(String year, int type)
{
if (allow(type&ID3V1))
{
id3v1.setYear(year);
}
if (allow(type&ID3V2))
{
id3v2.setTextFrame(ID3v2Frames.YEAR, year);
}
}
|
[
"public",
"void",
"setYear",
"(",
"String",
"year",
",",
"int",
"type",
")",
"{",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V1",
")",
")",
"{",
"id3v1",
".",
"setYear",
"(",
"year",
")",
";",
"}",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V2",
")",
")",
"{",
"id3v2",
".",
"setTextFrame",
"(",
"ID3v2Frames",
".",
"YEAR",
",",
"year",
")",
";",
"}",
"}"
] |
Set the year of this mp3.
@param year of the mp3
|
[
"Set",
"the",
"year",
"of",
"this",
"mp3",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java#L244-L254
|
150,409
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java
|
MP3FileID3Controller.setTrack
|
public void setTrack(int track, int type)
{
if (allow(type&ID3V1))
{
id3v1.setTrack(track);
}
if (allow(type&ID3V2))
{
id3v2.setTextFrame(ID3v2Frames.TRACK_NUMBER, String.valueOf(track));
}
}
|
java
|
public void setTrack(int track, int type)
{
if (allow(type&ID3V1))
{
id3v1.setTrack(track);
}
if (allow(type&ID3V2))
{
id3v2.setTextFrame(ID3v2Frames.TRACK_NUMBER, String.valueOf(track));
}
}
|
[
"public",
"void",
"setTrack",
"(",
"int",
"track",
",",
"int",
"type",
")",
"{",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V1",
")",
")",
"{",
"id3v1",
".",
"setTrack",
"(",
"track",
")",
";",
"}",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V2",
")",
")",
"{",
"id3v2",
".",
"setTextFrame",
"(",
"ID3v2Frames",
".",
"TRACK_NUMBER",
",",
"String",
".",
"valueOf",
"(",
"track",
")",
")",
";",
"}",
"}"
] |
Set the track number of this mp3.
@param track the track number of this mp3
|
[
"Set",
"the",
"track",
"number",
"of",
"this",
"mp3",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java#L261-L271
|
150,410
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java
|
MP3FileID3Controller.getArtist
|
public String getArtist(int type)
{
if (allow(type&ID3V1))
{
return id3v1.getArtist();
}
if (allow(type&ID3V2))
{
return id3v2.getFrameDataString(ID3v2Frames.LEAD_PERFORMERS);
}
return null;
}
|
java
|
public String getArtist(int type)
{
if (allow(type&ID3V1))
{
return id3v1.getArtist();
}
if (allow(type&ID3V2))
{
return id3v2.getFrameDataString(ID3v2Frames.LEAD_PERFORMERS);
}
return null;
}
|
[
"public",
"String",
"getArtist",
"(",
"int",
"type",
")",
"{",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V1",
")",
")",
"{",
"return",
"id3v1",
".",
"getArtist",
"(",
")",
";",
"}",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V2",
")",
")",
"{",
"return",
"id3v2",
".",
"getFrameDataString",
"(",
"ID3v2Frames",
".",
"LEAD_PERFORMERS",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Returns the artist of the mp3 if set and the empty string if not.
@return the artist of the mp3
@exception ID3v2FormatException if the data of the field is incorrect
|
[
"Returns",
"the",
"artist",
"of",
"the",
"mp3",
"if",
"set",
"and",
"the",
"empty",
"string",
"if",
"not",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java#L548-L559
|
150,411
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java
|
MP3FileID3Controller.getAlbum
|
public String getAlbum(int type)
{
if (allow(type&ID3V1))
{
return id3v1.getAlbum();
}
if (allow(type&ID3V2))
{
return id3v2.getFrameDataString(ID3v2Frames.ALBUM);
}
return null;
}
|
java
|
public String getAlbum(int type)
{
if (allow(type&ID3V1))
{
return id3v1.getAlbum();
}
if (allow(type&ID3V2))
{
return id3v2.getFrameDataString(ID3v2Frames.ALBUM);
}
return null;
}
|
[
"public",
"String",
"getAlbum",
"(",
"int",
"type",
")",
"{",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V1",
")",
")",
"{",
"return",
"id3v1",
".",
"getAlbum",
"(",
")",
";",
"}",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V2",
")",
")",
"{",
"return",
"id3v2",
".",
"getFrameDataString",
"(",
"ID3v2Frames",
".",
"ALBUM",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Returns the album of the mp3 if set and the empty string if not.
@return the album of the mp3
@exception ID3v2FormatException if the data of the field is incorrect
|
[
"Returns",
"the",
"album",
"of",
"the",
"mp3",
"if",
"set",
"and",
"the",
"empty",
"string",
"if",
"not",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java#L567-L578
|
150,412
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java
|
MP3FileID3Controller.getComment
|
public String getComment(int type)
{
if (allow(type&ID3V1))
{
return id3v1.getComment();
}
if (allow(type&ID3V2))
{
return id3v2.getFrameDataString(ID3v2Frames.COMMENTS);
}
return null;
}
|
java
|
public String getComment(int type)
{
if (allow(type&ID3V1))
{
return id3v1.getComment();
}
if (allow(type&ID3V2))
{
return id3v2.getFrameDataString(ID3v2Frames.COMMENTS);
}
return null;
}
|
[
"public",
"String",
"getComment",
"(",
"int",
"type",
")",
"{",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V1",
")",
")",
"{",
"return",
"id3v1",
".",
"getComment",
"(",
")",
";",
"}",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V2",
")",
")",
"{",
"return",
"id3v2",
".",
"getFrameDataString",
"(",
"ID3v2Frames",
".",
"COMMENTS",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Returns the comment field of this mp3 if set and the empty string if
not.
@return the comment field of this mp3
@exception ID3v2FormatException if the data of the field is incorrect
|
[
"Returns",
"the",
"comment",
"field",
"of",
"this",
"mp3",
"if",
"set",
"and",
"the",
"empty",
"string",
"if",
"not",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java#L587-L598
|
150,413
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java
|
MP3FileID3Controller.getGenre
|
public String getGenre(int type)
{
if (allow(type&ID3V1))
{
return id3v1.getGenreString();
}
if (allow(type&ID3V2))
{
return id3v2.getFrameDataString(ID3v2Frames.CONTENT_TYPE);
}
return null;
}
|
java
|
public String getGenre(int type)
{
if (allow(type&ID3V1))
{
return id3v1.getGenreString();
}
if (allow(type&ID3V2))
{
return id3v2.getFrameDataString(ID3v2Frames.CONTENT_TYPE);
}
return null;
}
|
[
"public",
"String",
"getGenre",
"(",
"int",
"type",
")",
"{",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V1",
")",
")",
"{",
"return",
"id3v1",
".",
"getGenreString",
"(",
")",
";",
"}",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V2",
")",
")",
"{",
"return",
"id3v2",
".",
"getFrameDataString",
"(",
"ID3v2Frames",
".",
"CONTENT_TYPE",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Returns the genre of this mp3 if set and the empty string if not.
@return the genre of this mp3
@exception ID3v2FormatException if the data of this field is incorrect
|
[
"Returns",
"the",
"genre",
"of",
"this",
"mp3",
"if",
"set",
"and",
"the",
"empty",
"string",
"if",
"not",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java#L606-L617
|
150,414
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java
|
MP3FileID3Controller.getTitle
|
public String getTitle(int type)
{
if (allow(type&ID3V1))
{
return id3v1.getTitle();
}
if (allow(type&ID3V2))
{
return id3v2.getFrameDataString(ID3v2Frames.TITLE);
}
return null;
}
|
java
|
public String getTitle(int type)
{
if (allow(type&ID3V1))
{
return id3v1.getTitle();
}
if (allow(type&ID3V2))
{
return id3v2.getFrameDataString(ID3v2Frames.TITLE);
}
return null;
}
|
[
"public",
"String",
"getTitle",
"(",
"int",
"type",
")",
"{",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V1",
")",
")",
"{",
"return",
"id3v1",
".",
"getTitle",
"(",
")",
";",
"}",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V2",
")",
")",
"{",
"return",
"id3v2",
".",
"getFrameDataString",
"(",
"ID3v2Frames",
".",
"TITLE",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Returns the title of this mp3 if set and the empty string if not.
@return the title of this mp3
@exception ID3v2FormatException if the data of this field is incorrect
|
[
"Returns",
"the",
"title",
"of",
"this",
"mp3",
"if",
"set",
"and",
"the",
"empty",
"string",
"if",
"not",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java#L625-L636
|
150,415
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java
|
MP3FileID3Controller.getTrack
|
public String getTrack(int type)
{
if (allow(type&ID3V1))
{
return Integer.toString(id3v1.getTrack());
}
if (allow(type&ID3V2))
{
return id3v2.getFrameDataString(ID3v2Frames.TRACK_NUMBER);
}
return null;
}
|
java
|
public String getTrack(int type)
{
if (allow(type&ID3V1))
{
return Integer.toString(id3v1.getTrack());
}
if (allow(type&ID3V2))
{
return id3v2.getFrameDataString(ID3v2Frames.TRACK_NUMBER);
}
return null;
}
|
[
"public",
"String",
"getTrack",
"(",
"int",
"type",
")",
"{",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V1",
")",
")",
"{",
"return",
"Integer",
".",
"toString",
"(",
"id3v1",
".",
"getTrack",
"(",
")",
")",
";",
"}",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V2",
")",
")",
"{",
"return",
"id3v2",
".",
"getFrameDataString",
"(",
"ID3v2Frames",
".",
"TRACK_NUMBER",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Returns the track of this mp3 if set and the empty string if not.
@return the track of this mp3
@exception ID3v2FormatException if the data of this field is incorrect
|
[
"Returns",
"the",
"track",
"of",
"this",
"mp3",
"if",
"set",
"and",
"the",
"empty",
"string",
"if",
"not",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java#L644-L655
|
150,416
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java
|
MP3FileID3Controller.getYear
|
public String getYear(int type)
{
if (allow(type&ID3V1))
{
return id3v1.getYear();
}
if (allow(type&ID3V2))
{
return id3v2.getFrameDataString(ID3v2Frames.YEAR);
}
return null;
}
|
java
|
public String getYear(int type)
{
if (allow(type&ID3V1))
{
return id3v1.getYear();
}
if (allow(type&ID3V2))
{
return id3v2.getFrameDataString(ID3v2Frames.YEAR);
}
return null;
}
|
[
"public",
"String",
"getYear",
"(",
"int",
"type",
")",
"{",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V1",
")",
")",
"{",
"return",
"id3v1",
".",
"getYear",
"(",
")",
";",
"}",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V2",
")",
")",
"{",
"return",
"id3v2",
".",
"getFrameDataString",
"(",
"ID3v2Frames",
".",
"YEAR",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Returns the year of this mp3 if set and the empty string if not.
@return the year of this mp3
@exception ID3v2FormatException if the data of this field is incorrect
|
[
"Returns",
"the",
"year",
"of",
"this",
"mp3",
"if",
"set",
"and",
"the",
"empty",
"string",
"if",
"not",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java#L663-L674
|
150,417
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java
|
MP3FileID3Controller.getFileName
|
public String getFileName()
{
if (mp3File==null) return "";
try
{
return mp3File.getCanonicalPath();
}
catch (IOException ex)
{
return mp3File.getAbsolutePath();
}
}
|
java
|
public String getFileName()
{
if (mp3File==null) return "";
try
{
return mp3File.getCanonicalPath();
}
catch (IOException ex)
{
return mp3File.getAbsolutePath();
}
}
|
[
"public",
"String",
"getFileName",
"(",
")",
"{",
"if",
"(",
"mp3File",
"==",
"null",
")",
"return",
"\"\"",
";",
"try",
"{",
"return",
"mp3File",
".",
"getCanonicalPath",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"return",
"mp3File",
".",
"getAbsolutePath",
"(",
")",
";",
"}",
"}"
] |
returns the full path of this mp3 file
@since 26.12.2008
@return
|
[
"returns",
"the",
"full",
"path",
"of",
"this",
"mp3",
"file"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java#L862-L873
|
150,418
|
hawkular/hawkular-inventory
|
hawkular-inventory-rest-api/src/main/java/org/hawkular/inventory/rest/json/LinkDeserializer.java
|
LinkDeserializer.deserialize
|
@Override
public Link deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
String tmp = jp.getText(); // {
validate(jp, tmp, "{");
jp.nextToken(); // skip over { to the rel
String rel = jp.getText();
validateText(jp, rel);
jp.nextToken(); // skip over {
tmp = jp.getText();
validate(jp, tmp, "{");
jp.nextToken(); // skip over "href"
tmp = jp.getText();
validate(jp, tmp, "href");
jp.nextToken(); // skip to "http:// ... "
String href = jp.getText();
validateText(jp, href);
jp.nextToken(); // skip }
tmp = jp.getText();
validate(jp, tmp, "}");
jp.nextToken(); // skip }
tmp = jp.getText();
validate(jp, tmp, "}");
Link link = new Link(rel, href);
return link;
}
|
java
|
@Override
public Link deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
String tmp = jp.getText(); // {
validate(jp, tmp, "{");
jp.nextToken(); // skip over { to the rel
String rel = jp.getText();
validateText(jp, rel);
jp.nextToken(); // skip over {
tmp = jp.getText();
validate(jp, tmp, "{");
jp.nextToken(); // skip over "href"
tmp = jp.getText();
validate(jp, tmp, "href");
jp.nextToken(); // skip to "http:// ... "
String href = jp.getText();
validateText(jp, href);
jp.nextToken(); // skip }
tmp = jp.getText();
validate(jp, tmp, "}");
jp.nextToken(); // skip }
tmp = jp.getText();
validate(jp, tmp, "}");
Link link = new Link(rel, href);
return link;
}
|
[
"@",
"Override",
"public",
"Link",
"deserialize",
"(",
"JsonParser",
"jp",
",",
"DeserializationContext",
"ctxt",
")",
"throws",
"IOException",
"{",
"String",
"tmp",
"=",
"jp",
".",
"getText",
"(",
")",
";",
"// {",
"validate",
"(",
"jp",
",",
"tmp",
",",
"\"{\"",
")",
";",
"jp",
".",
"nextToken",
"(",
")",
";",
"// skip over { to the rel",
"String",
"rel",
"=",
"jp",
".",
"getText",
"(",
")",
";",
"validateText",
"(",
"jp",
",",
"rel",
")",
";",
"jp",
".",
"nextToken",
"(",
")",
";",
"// skip over {",
"tmp",
"=",
"jp",
".",
"getText",
"(",
")",
";",
"validate",
"(",
"jp",
",",
"tmp",
",",
"\"{\"",
")",
";",
"jp",
".",
"nextToken",
"(",
")",
";",
"// skip over \"href\"",
"tmp",
"=",
"jp",
".",
"getText",
"(",
")",
";",
"validate",
"(",
"jp",
",",
"tmp",
",",
"\"href\"",
")",
";",
"jp",
".",
"nextToken",
"(",
")",
";",
"// skip to \"http:// ... \"",
"String",
"href",
"=",
"jp",
".",
"getText",
"(",
")",
";",
"validateText",
"(",
"jp",
",",
"href",
")",
";",
"jp",
".",
"nextToken",
"(",
")",
";",
"// skip }",
"tmp",
"=",
"jp",
".",
"getText",
"(",
")",
";",
"validate",
"(",
"jp",
",",
"tmp",
",",
"\"}\"",
")",
";",
"jp",
".",
"nextToken",
"(",
")",
";",
"// skip }",
"tmp",
"=",
"jp",
".",
"getText",
"(",
")",
";",
"validate",
"(",
"jp",
",",
"tmp",
",",
"\"}\"",
")",
";",
"Link",
"link",
"=",
"new",
"Link",
"(",
"rel",
",",
"href",
")",
";",
"return",
"link",
";",
"}"
] |
Non whitespace; could possibly be narrowed
|
[
"Non",
"whitespace",
";",
"could",
"possibly",
"be",
"narrowed"
] |
f56dc10323dca21777feb5b609a9e9cc70ffaf62
|
https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-rest-api/src/main/java/org/hawkular/inventory/rest/json/LinkDeserializer.java#L49-L76
|
150,419
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/io/text/FullReadLines.java
|
FullReadLines.start
|
public final AsyncWork<T, Exception> start() {
AsyncWork<T, Exception> result = new AsyncWork<>();
resume(result);
return result;
}
|
java
|
public final AsyncWork<T, Exception> start() {
AsyncWork<T, Exception> result = new AsyncWork<>();
resume(result);
return result;
}
|
[
"public",
"final",
"AsyncWork",
"<",
"T",
",",
"Exception",
">",
"start",
"(",
")",
"{",
"AsyncWork",
"<",
"T",
",",
"Exception",
">",
"result",
"=",
"new",
"AsyncWork",
"<>",
"(",
")",
";",
"resume",
"(",
"result",
")",
";",
"return",
"result",
";",
"}"
] |
Start to read lines in a separate task.
|
[
"Start",
"to",
"read",
"lines",
"in",
"a",
"separate",
"task",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/io/text/FullReadLines.java#L31-L35
|
150,420
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/AsyncWork.java
|
AsyncWork.listenInline
|
public final void listenInline(AsyncWorkListener<T,TError> listener) {
synchronized (this) {
if (!unblocked || listenersInline != null) {
if (listenersInline == null) listenersInline = new ArrayList<>(5);
listenersInline.add(listener);
return;
}
}
if (error != null) listener.error(error);
else if (cancel != null) listener.cancelled(cancel);
else listener.ready(result);
}
|
java
|
public final void listenInline(AsyncWorkListener<T,TError> listener) {
synchronized (this) {
if (!unblocked || listenersInline != null) {
if (listenersInline == null) listenersInline = new ArrayList<>(5);
listenersInline.add(listener);
return;
}
}
if (error != null) listener.error(error);
else if (cancel != null) listener.cancelled(cancel);
else listener.ready(result);
}
|
[
"public",
"final",
"void",
"listenInline",
"(",
"AsyncWorkListener",
"<",
"T",
",",
"TError",
">",
"listener",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"!",
"unblocked",
"||",
"listenersInline",
"!=",
"null",
")",
"{",
"if",
"(",
"listenersInline",
"==",
"null",
")",
"listenersInline",
"=",
"new",
"ArrayList",
"<>",
"(",
"5",
")",
";",
"listenersInline",
".",
"add",
"(",
"listener",
")",
";",
"return",
";",
"}",
"}",
"if",
"(",
"error",
"!=",
"null",
")",
"listener",
".",
"error",
"(",
"error",
")",
";",
"else",
"if",
"(",
"cancel",
"!=",
"null",
")",
"listener",
".",
"cancelled",
"(",
"cancel",
")",
";",
"else",
"listener",
".",
"ready",
"(",
"result",
")",
";",
"}"
] |
Add a listener to be called when this AsyncWork is unblocked.
|
[
"Add",
"a",
"listener",
"to",
"be",
"called",
"when",
"this",
"AsyncWork",
"is",
"unblocked",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/AsyncWork.java#L136-L147
|
150,421
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/AsyncWork.java
|
AsyncWork.listenInline
|
public final void listenInline(Listener<T> onready, Listener<TError> onerror, Listener<CancelException> oncancel) {
listenInline(new AsyncWorkListener<T,TError>() {
@Override
public void ready(T result) {
onready.fire(result);
}
@Override
public void error(TError error) {
onerror.fire(error);
}
@Override
public void cancelled(CancelException event) {
oncancel.fire(event);
}
@Override
public String toString() {
return "AsyncWork.listenInline: " + onready;
}
});
}
|
java
|
public final void listenInline(Listener<T> onready, Listener<TError> onerror, Listener<CancelException> oncancel) {
listenInline(new AsyncWorkListener<T,TError>() {
@Override
public void ready(T result) {
onready.fire(result);
}
@Override
public void error(TError error) {
onerror.fire(error);
}
@Override
public void cancelled(CancelException event) {
oncancel.fire(event);
}
@Override
public String toString() {
return "AsyncWork.listenInline: " + onready;
}
});
}
|
[
"public",
"final",
"void",
"listenInline",
"(",
"Listener",
"<",
"T",
">",
"onready",
",",
"Listener",
"<",
"TError",
">",
"onerror",
",",
"Listener",
"<",
"CancelException",
">",
"oncancel",
")",
"{",
"listenInline",
"(",
"new",
"AsyncWorkListener",
"<",
"T",
",",
"TError",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"ready",
"(",
"T",
"result",
")",
"{",
"onready",
".",
"fire",
"(",
"result",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"error",
"(",
"TError",
"error",
")",
"{",
"onerror",
".",
"fire",
"(",
"error",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"cancelled",
"(",
"CancelException",
"event",
")",
"{",
"oncancel",
".",
"fire",
"(",
"event",
")",
";",
"}",
"@",
"Override",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"AsyncWork.listenInline: \"",
"+",
"onready",
";",
"}",
"}",
")",
";",
"}"
] |
Call one of the given listener depending on result.
|
[
"Call",
"one",
"of",
"the",
"given",
"listener",
"depending",
"on",
"result",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/AsyncWork.java#L190-L212
|
150,422
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/AsyncWork.java
|
AsyncWork.listenInline
|
public final void listenInline(Listener<T> onSuccess) {
listenInline(new AsyncWorkListener<T,TError>() {
@Override
public void ready(T result) {
onSuccess.fire(result);
}
@Override
public void error(TError error) {
}
@Override
public void cancelled(CancelException event) {
}
@Override
public String toString() {
return "AsyncWork.listenInline: " + onSuccess;
}
});
}
|
java
|
public final void listenInline(Listener<T> onSuccess) {
listenInline(new AsyncWorkListener<T,TError>() {
@Override
public void ready(T result) {
onSuccess.fire(result);
}
@Override
public void error(TError error) {
}
@Override
public void cancelled(CancelException event) {
}
@Override
public String toString() {
return "AsyncWork.listenInline: " + onSuccess;
}
});
}
|
[
"public",
"final",
"void",
"listenInline",
"(",
"Listener",
"<",
"T",
">",
"onSuccess",
")",
"{",
"listenInline",
"(",
"new",
"AsyncWorkListener",
"<",
"T",
",",
"TError",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"ready",
"(",
"T",
"result",
")",
"{",
"onSuccess",
".",
"fire",
"(",
"result",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"error",
"(",
"TError",
"error",
")",
"{",
"}",
"@",
"Override",
"public",
"void",
"cancelled",
"(",
"CancelException",
"event",
")",
"{",
"}",
"@",
"Override",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"AsyncWork.listenInline: \"",
"+",
"onSuccess",
";",
"}",
"}",
")",
";",
"}"
] |
Register a listener to be called only on success, with the result.
|
[
"Register",
"a",
"listener",
"to",
"be",
"called",
"only",
"on",
"success",
"with",
"the",
"result",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/AsyncWork.java#L290-L310
|
150,423
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/AsyncWork.java
|
AsyncWork.listenInlineGenericError
|
public final void listenInlineGenericError(AsyncWork<T, Exception> sp) {
listenInline(new AsyncWorkListener<T,TError>() {
@Override
public void ready(T result) {
sp.unblockSuccess(result);
}
@Override
public void error(TError error) {
sp.unblockError(error);
}
@Override
public void cancelled(CancelException event) {
sp.unblockCancel(event);
}
});
}
|
java
|
public final void listenInlineGenericError(AsyncWork<T, Exception> sp) {
listenInline(new AsyncWorkListener<T,TError>() {
@Override
public void ready(T result) {
sp.unblockSuccess(result);
}
@Override
public void error(TError error) {
sp.unblockError(error);
}
@Override
public void cancelled(CancelException event) {
sp.unblockCancel(event);
}
});
}
|
[
"public",
"final",
"void",
"listenInlineGenericError",
"(",
"AsyncWork",
"<",
"T",
",",
"Exception",
">",
"sp",
")",
"{",
"listenInline",
"(",
"new",
"AsyncWorkListener",
"<",
"T",
",",
"TError",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"ready",
"(",
"T",
"result",
")",
"{",
"sp",
".",
"unblockSuccess",
"(",
"result",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"error",
"(",
"TError",
"error",
")",
"{",
"sp",
".",
"unblockError",
"(",
"error",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"cancelled",
"(",
"CancelException",
"event",
")",
"{",
"sp",
".",
"unblockCancel",
"(",
"event",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Forward the result, error, or cancellation to the given AsyncWork.
|
[
"Forward",
"the",
"result",
"error",
"or",
"cancellation",
"to",
"the",
"given",
"AsyncWork",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/AsyncWork.java#L313-L330
|
150,424
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/AsyncWork.java
|
AsyncWork.unblockSuccess
|
public final void unblockSuccess(T result) {
ArrayList<AsyncWorkListener<T,TError>> listeners;
synchronized (this) {
if (unblocked) return;
unblocked = true;
this.result = result;
if (listenersInline == null) {
this.notifyAll();
return;
}
listeners = listenersInline;
listenersInline = new ArrayList<>(2);
}
Logger log = LCCore.getApplication().getLoggerFactory().getLogger(SynchronizationPoint.class);
while (true) {
if (!log.debug())
for (int i = 0; i < listeners.size(); ++i)
try { listeners.get(i).ready(result); }
catch (Throwable t) { log.error(
"Exception thrown by an inline listener of AsyncWork: " + listeners.get(i), t); }
else
for (int i = 0; i < listeners.size(); ++i) {
long start = System.nanoTime();
try { listeners.get(i).ready(result); }
catch (Throwable t) { log.error(
"Exception thrown by an inline listener of AsyncWork: " + listeners.get(i), t); }
long time = System.nanoTime() - start;
if (time > 1000000) // more than 1ms
log.debug("Listener ready took " + (time / 1000000.0d) + "ms: " + listeners.get(i));
}
synchronized (this) {
if (listenersInline.isEmpty()) {
listenersInline = null;
listeners = null;
this.notifyAll();
break;
}
listeners.clear();
ArrayList<AsyncWorkListener<T,TError>> tmp = listeners;
listeners = listenersInline;
listenersInline = tmp;
}
}
}
|
java
|
public final void unblockSuccess(T result) {
ArrayList<AsyncWorkListener<T,TError>> listeners;
synchronized (this) {
if (unblocked) return;
unblocked = true;
this.result = result;
if (listenersInline == null) {
this.notifyAll();
return;
}
listeners = listenersInline;
listenersInline = new ArrayList<>(2);
}
Logger log = LCCore.getApplication().getLoggerFactory().getLogger(SynchronizationPoint.class);
while (true) {
if (!log.debug())
for (int i = 0; i < listeners.size(); ++i)
try { listeners.get(i).ready(result); }
catch (Throwable t) { log.error(
"Exception thrown by an inline listener of AsyncWork: " + listeners.get(i), t); }
else
for (int i = 0; i < listeners.size(); ++i) {
long start = System.nanoTime();
try { listeners.get(i).ready(result); }
catch (Throwable t) { log.error(
"Exception thrown by an inline listener of AsyncWork: " + listeners.get(i), t); }
long time = System.nanoTime() - start;
if (time > 1000000) // more than 1ms
log.debug("Listener ready took " + (time / 1000000.0d) + "ms: " + listeners.get(i));
}
synchronized (this) {
if (listenersInline.isEmpty()) {
listenersInline = null;
listeners = null;
this.notifyAll();
break;
}
listeners.clear();
ArrayList<AsyncWorkListener<T,TError>> tmp = listeners;
listeners = listenersInline;
listenersInline = tmp;
}
}
}
|
[
"public",
"final",
"void",
"unblockSuccess",
"(",
"T",
"result",
")",
"{",
"ArrayList",
"<",
"AsyncWorkListener",
"<",
"T",
",",
"TError",
">",
">",
"listeners",
";",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"unblocked",
")",
"return",
";",
"unblocked",
"=",
"true",
";",
"this",
".",
"result",
"=",
"result",
";",
"if",
"(",
"listenersInline",
"==",
"null",
")",
"{",
"this",
".",
"notifyAll",
"(",
")",
";",
"return",
";",
"}",
"listeners",
"=",
"listenersInline",
";",
"listenersInline",
"=",
"new",
"ArrayList",
"<>",
"(",
"2",
")",
";",
"}",
"Logger",
"log",
"=",
"LCCore",
".",
"getApplication",
"(",
")",
".",
"getLoggerFactory",
"(",
")",
".",
"getLogger",
"(",
"SynchronizationPoint",
".",
"class",
")",
";",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"!",
"log",
".",
"debug",
"(",
")",
")",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"listeners",
".",
"size",
"(",
")",
";",
"++",
"i",
")",
"try",
"{",
"listeners",
".",
"get",
"(",
"i",
")",
".",
"ready",
"(",
"result",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"log",
".",
"error",
"(",
"\"Exception thrown by an inline listener of AsyncWork: \"",
"+",
"listeners",
".",
"get",
"(",
"i",
")",
",",
"t",
")",
";",
"}",
"else",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"listeners",
".",
"size",
"(",
")",
";",
"++",
"i",
")",
"{",
"long",
"start",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"try",
"{",
"listeners",
".",
"get",
"(",
"i",
")",
".",
"ready",
"(",
"result",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"log",
".",
"error",
"(",
"\"Exception thrown by an inline listener of AsyncWork: \"",
"+",
"listeners",
".",
"get",
"(",
"i",
")",
",",
"t",
")",
";",
"}",
"long",
"time",
"=",
"System",
".",
"nanoTime",
"(",
")",
"-",
"start",
";",
"if",
"(",
"time",
">",
"1000000",
")",
"// more than 1ms\r",
"log",
".",
"debug",
"(",
"\"Listener ready took \"",
"+",
"(",
"time",
"/",
"1000000.0d",
")",
"+",
"\"ms: \"",
"+",
"listeners",
".",
"get",
"(",
"i",
")",
")",
";",
"}",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"listenersInline",
".",
"isEmpty",
"(",
")",
")",
"{",
"listenersInline",
"=",
"null",
";",
"listeners",
"=",
"null",
";",
"this",
".",
"notifyAll",
"(",
")",
";",
"break",
";",
"}",
"listeners",
".",
"clear",
"(",
")",
";",
"ArrayList",
"<",
"AsyncWorkListener",
"<",
"T",
",",
"TError",
">",
">",
"tmp",
"=",
"listeners",
";",
"listeners",
"=",
"listenersInline",
";",
"listenersInline",
"=",
"tmp",
";",
"}",
"}",
"}"
] |
Unblock this AsyncWork with the given result.
|
[
"Unblock",
"this",
"AsyncWork",
"with",
"the",
"given",
"result",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/AsyncWork.java#L333-L376
|
150,425
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/AsyncWork.java
|
AsyncWork.unblockError
|
public final void unblockError(TError error) {
ArrayList<AsyncWorkListener<T,TError>> listeners;
synchronized (this) {
if (unblocked) return;
unblocked = true;
this.error = error;
if (listenersInline == null) {
this.notifyAll();
return;
}
listeners = listenersInline;
listenersInline = new ArrayList<>(2);
}
Logger log = LCCore.getApplication().getLoggerFactory().getLogger(SynchronizationPoint.class);
while (true) {
if (!log.debug())
for (int i = 0; i < listeners.size(); ++i)
try { listeners.get(i).error(error); }
catch (Throwable t) { log.error(
"Exception thrown by an inline listener of AsyncWork, cancel it: " + listeners.get(i), t);
try { listeners.get(i).cancelled(new CancelException("Error in listener", t)); }
catch (Throwable t2) { log.error(
"Exception thrown while cancelling inline listener of AsyncWork after error: "
+ listeners.get(i), t2); }
}
else
for (int i = 0; i < listeners.size(); ++i) {
long start = System.nanoTime();
try { listeners.get(i).error(error); }
catch (Throwable t) { log.error(
"Exception thrown by an inline listener of AsyncWork, cancel it: "
+ listeners.get(i), t);
try { listeners.get(i).cancelled(new CancelException("Error in listener", t)); }
catch (Throwable t2) { log.error(
"Exception thrown while cancelling inline listener of AsyncWork after error: "
+ listeners.get(i), t2); }
}
long time = System.nanoTime() - start;
if (time > 1000000) // more than 1ms
log.debug("Listener error took " + (time / 1000000.0d) + "ms: " + listeners.get(i));
}
synchronized (this) {
if (listenersInline.isEmpty()) {
listenersInline = null;
listeners = null;
this.notifyAll();
break;
}
listeners.clear();
ArrayList<AsyncWorkListener<T,TError>> tmp = listeners;
listeners = listenersInline;
listenersInline = tmp;
}
}
}
|
java
|
public final void unblockError(TError error) {
ArrayList<AsyncWorkListener<T,TError>> listeners;
synchronized (this) {
if (unblocked) return;
unblocked = true;
this.error = error;
if (listenersInline == null) {
this.notifyAll();
return;
}
listeners = listenersInline;
listenersInline = new ArrayList<>(2);
}
Logger log = LCCore.getApplication().getLoggerFactory().getLogger(SynchronizationPoint.class);
while (true) {
if (!log.debug())
for (int i = 0; i < listeners.size(); ++i)
try { listeners.get(i).error(error); }
catch (Throwable t) { log.error(
"Exception thrown by an inline listener of AsyncWork, cancel it: " + listeners.get(i), t);
try { listeners.get(i).cancelled(new CancelException("Error in listener", t)); }
catch (Throwable t2) { log.error(
"Exception thrown while cancelling inline listener of AsyncWork after error: "
+ listeners.get(i), t2); }
}
else
for (int i = 0; i < listeners.size(); ++i) {
long start = System.nanoTime();
try { listeners.get(i).error(error); }
catch (Throwable t) { log.error(
"Exception thrown by an inline listener of AsyncWork, cancel it: "
+ listeners.get(i), t);
try { listeners.get(i).cancelled(new CancelException("Error in listener", t)); }
catch (Throwable t2) { log.error(
"Exception thrown while cancelling inline listener of AsyncWork after error: "
+ listeners.get(i), t2); }
}
long time = System.nanoTime() - start;
if (time > 1000000) // more than 1ms
log.debug("Listener error took " + (time / 1000000.0d) + "ms: " + listeners.get(i));
}
synchronized (this) {
if (listenersInline.isEmpty()) {
listenersInline = null;
listeners = null;
this.notifyAll();
break;
}
listeners.clear();
ArrayList<AsyncWorkListener<T,TError>> tmp = listeners;
listeners = listenersInline;
listenersInline = tmp;
}
}
}
|
[
"public",
"final",
"void",
"unblockError",
"(",
"TError",
"error",
")",
"{",
"ArrayList",
"<",
"AsyncWorkListener",
"<",
"T",
",",
"TError",
">",
">",
"listeners",
";",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"unblocked",
")",
"return",
";",
"unblocked",
"=",
"true",
";",
"this",
".",
"error",
"=",
"error",
";",
"if",
"(",
"listenersInline",
"==",
"null",
")",
"{",
"this",
".",
"notifyAll",
"(",
")",
";",
"return",
";",
"}",
"listeners",
"=",
"listenersInline",
";",
"listenersInline",
"=",
"new",
"ArrayList",
"<>",
"(",
"2",
")",
";",
"}",
"Logger",
"log",
"=",
"LCCore",
".",
"getApplication",
"(",
")",
".",
"getLoggerFactory",
"(",
")",
".",
"getLogger",
"(",
"SynchronizationPoint",
".",
"class",
")",
";",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"!",
"log",
".",
"debug",
"(",
")",
")",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"listeners",
".",
"size",
"(",
")",
";",
"++",
"i",
")",
"try",
"{",
"listeners",
".",
"get",
"(",
"i",
")",
".",
"error",
"(",
"error",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"log",
".",
"error",
"(",
"\"Exception thrown by an inline listener of AsyncWork, cancel it: \"",
"+",
"listeners",
".",
"get",
"(",
"i",
")",
",",
"t",
")",
";",
"try",
"{",
"listeners",
".",
"get",
"(",
"i",
")",
".",
"cancelled",
"(",
"new",
"CancelException",
"(",
"\"Error in listener\"",
",",
"t",
")",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t2",
")",
"{",
"log",
".",
"error",
"(",
"\"Exception thrown while cancelling inline listener of AsyncWork after error: \"",
"+",
"listeners",
".",
"get",
"(",
"i",
")",
",",
"t2",
")",
";",
"}",
"}",
"else",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"listeners",
".",
"size",
"(",
")",
";",
"++",
"i",
")",
"{",
"long",
"start",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"try",
"{",
"listeners",
".",
"get",
"(",
"i",
")",
".",
"error",
"(",
"error",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"log",
".",
"error",
"(",
"\"Exception thrown by an inline listener of AsyncWork, cancel it: \"",
"+",
"listeners",
".",
"get",
"(",
"i",
")",
",",
"t",
")",
";",
"try",
"{",
"listeners",
".",
"get",
"(",
"i",
")",
".",
"cancelled",
"(",
"new",
"CancelException",
"(",
"\"Error in listener\"",
",",
"t",
")",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t2",
")",
"{",
"log",
".",
"error",
"(",
"\"Exception thrown while cancelling inline listener of AsyncWork after error: \"",
"+",
"listeners",
".",
"get",
"(",
"i",
")",
",",
"t2",
")",
";",
"}",
"}",
"long",
"time",
"=",
"System",
".",
"nanoTime",
"(",
")",
"-",
"start",
";",
"if",
"(",
"time",
">",
"1000000",
")",
"// more than 1ms\r",
"log",
".",
"debug",
"(",
"\"Listener error took \"",
"+",
"(",
"time",
"/",
"1000000.0d",
")",
"+",
"\"ms: \"",
"+",
"listeners",
".",
"get",
"(",
"i",
")",
")",
";",
"}",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"listenersInline",
".",
"isEmpty",
"(",
")",
")",
"{",
"listenersInline",
"=",
"null",
";",
"listeners",
"=",
"null",
";",
"this",
".",
"notifyAll",
"(",
")",
";",
"break",
";",
"}",
"listeners",
".",
"clear",
"(",
")",
";",
"ArrayList",
"<",
"AsyncWorkListener",
"<",
"T",
",",
"TError",
">",
">",
"tmp",
"=",
"listeners",
";",
"listeners",
"=",
"listenersInline",
";",
"listenersInline",
"=",
"tmp",
";",
"}",
"}",
"}"
] |
Unblock this AsyncWork with an error. Equivalent to the method error.
|
[
"Unblock",
"this",
"AsyncWork",
"with",
"an",
"error",
".",
"Equivalent",
"to",
"the",
"method",
"error",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/AsyncWork.java#L379-L433
|
150,426
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/AsyncWork.java
|
AsyncWork.unblockCancel
|
public void unblockCancel(CancelException event) {
ArrayList<AsyncWorkListener<T,TError>> listeners;
synchronized (this) {
if (unblocked) return;
unblocked = true;
this.cancel = event;
if (listenersInline == null) {
this.notifyAll();
return;
}
listeners = listenersInline;
listenersInline = new ArrayList<>(2);
}
Logger log = LCCore.getApplication().getLoggerFactory().getLogger(SynchronizationPoint.class);
while (true) {
if (!log.debug())
for (int i = 0; i < listeners.size(); ++i)
try { listeners.get(i).cancelled(event); }
catch (Throwable t) { log.error(
"Exception thrown by an inline listener of AsyncWork: " + listeners.get(i), t); }
else
for (int i = 0; i < listeners.size(); ++i) {
long start = System.nanoTime();
try { listeners.get(i).cancelled(event); }
catch (Throwable t) { log.error(
"Exception thrown by an inline listener of AsyncWork: " + listeners.get(i), t); }
long time = System.nanoTime() - start;
if (time > 1000000) // more than 1ms
log.debug("Listener cancelled took " + (time / 1000000.0d) + "ms: " + listeners.get(i));
}
synchronized (this) {
if (listenersInline.isEmpty()) {
listenersInline = null;
listeners = null;
this.notifyAll();
break;
}
listeners.clear();
ArrayList<AsyncWorkListener<T,TError>> tmp = listeners;
listeners = listenersInline;
listenersInline = tmp;
}
}
}
|
java
|
public void unblockCancel(CancelException event) {
ArrayList<AsyncWorkListener<T,TError>> listeners;
synchronized (this) {
if (unblocked) return;
unblocked = true;
this.cancel = event;
if (listenersInline == null) {
this.notifyAll();
return;
}
listeners = listenersInline;
listenersInline = new ArrayList<>(2);
}
Logger log = LCCore.getApplication().getLoggerFactory().getLogger(SynchronizationPoint.class);
while (true) {
if (!log.debug())
for (int i = 0; i < listeners.size(); ++i)
try { listeners.get(i).cancelled(event); }
catch (Throwable t) { log.error(
"Exception thrown by an inline listener of AsyncWork: " + listeners.get(i), t); }
else
for (int i = 0; i < listeners.size(); ++i) {
long start = System.nanoTime();
try { listeners.get(i).cancelled(event); }
catch (Throwable t) { log.error(
"Exception thrown by an inline listener of AsyncWork: " + listeners.get(i), t); }
long time = System.nanoTime() - start;
if (time > 1000000) // more than 1ms
log.debug("Listener cancelled took " + (time / 1000000.0d) + "ms: " + listeners.get(i));
}
synchronized (this) {
if (listenersInline.isEmpty()) {
listenersInline = null;
listeners = null;
this.notifyAll();
break;
}
listeners.clear();
ArrayList<AsyncWorkListener<T,TError>> tmp = listeners;
listeners = listenersInline;
listenersInline = tmp;
}
}
}
|
[
"public",
"void",
"unblockCancel",
"(",
"CancelException",
"event",
")",
"{",
"ArrayList",
"<",
"AsyncWorkListener",
"<",
"T",
",",
"TError",
">",
">",
"listeners",
";",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"unblocked",
")",
"return",
";",
"unblocked",
"=",
"true",
";",
"this",
".",
"cancel",
"=",
"event",
";",
"if",
"(",
"listenersInline",
"==",
"null",
")",
"{",
"this",
".",
"notifyAll",
"(",
")",
";",
"return",
";",
"}",
"listeners",
"=",
"listenersInline",
";",
"listenersInline",
"=",
"new",
"ArrayList",
"<>",
"(",
"2",
")",
";",
"}",
"Logger",
"log",
"=",
"LCCore",
".",
"getApplication",
"(",
")",
".",
"getLoggerFactory",
"(",
")",
".",
"getLogger",
"(",
"SynchronizationPoint",
".",
"class",
")",
";",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"!",
"log",
".",
"debug",
"(",
")",
")",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"listeners",
".",
"size",
"(",
")",
";",
"++",
"i",
")",
"try",
"{",
"listeners",
".",
"get",
"(",
"i",
")",
".",
"cancelled",
"(",
"event",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"log",
".",
"error",
"(",
"\"Exception thrown by an inline listener of AsyncWork: \"",
"+",
"listeners",
".",
"get",
"(",
"i",
")",
",",
"t",
")",
";",
"}",
"else",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"listeners",
".",
"size",
"(",
")",
";",
"++",
"i",
")",
"{",
"long",
"start",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"try",
"{",
"listeners",
".",
"get",
"(",
"i",
")",
".",
"cancelled",
"(",
"event",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"log",
".",
"error",
"(",
"\"Exception thrown by an inline listener of AsyncWork: \"",
"+",
"listeners",
".",
"get",
"(",
"i",
")",
",",
"t",
")",
";",
"}",
"long",
"time",
"=",
"System",
".",
"nanoTime",
"(",
")",
"-",
"start",
";",
"if",
"(",
"time",
">",
"1000000",
")",
"// more than 1ms\r",
"log",
".",
"debug",
"(",
"\"Listener cancelled took \"",
"+",
"(",
"time",
"/",
"1000000.0d",
")",
"+",
"\"ms: \"",
"+",
"listeners",
".",
"get",
"(",
"i",
")",
")",
";",
"}",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"listenersInline",
".",
"isEmpty",
"(",
")",
")",
"{",
"listenersInline",
"=",
"null",
";",
"listeners",
"=",
"null",
";",
"this",
".",
"notifyAll",
"(",
")",
";",
"break",
";",
"}",
"listeners",
".",
"clear",
"(",
")",
";",
"ArrayList",
"<",
"AsyncWorkListener",
"<",
"T",
",",
"TError",
">",
">",
"tmp",
"=",
"listeners",
";",
"listeners",
"=",
"listenersInline",
";",
"listenersInline",
"=",
"tmp",
";",
"}",
"}",
"}"
] |
Cancel this AsyncWork. Equivalent to the method cancel.
|
[
"Cancel",
"this",
"AsyncWork",
".",
"Equivalent",
"to",
"the",
"method",
"cancel",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/AsyncWork.java#L441-L484
|
150,427
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/AsyncWork.java
|
AsyncWork.blockResult
|
public final T blockResult(long timeout) throws TError, CancelException {
Thread t;
BlockedThreadHandler blockedHandler;
synchronized (this) {
if (unblocked && listenersInline == null) {
if (error != null) throw error;
if (cancel != null) throw cancel;
return result;
}
t = Thread.currentThread();
blockedHandler = Threading.getBlockedThreadHandler(t);
if (blockedHandler == null)
while (!unblocked || listenersInline != null)
try { this.wait(timeout < 0 ? 0 : timeout); }
catch (InterruptedException e) { return null; }
}
if (blockedHandler != null)
blockedHandler.blocked(this, timeout);
if (error != null) throw error;
if (cancel != null) throw cancel;
return result;
}
|
java
|
public final T blockResult(long timeout) throws TError, CancelException {
Thread t;
BlockedThreadHandler blockedHandler;
synchronized (this) {
if (unblocked && listenersInline == null) {
if (error != null) throw error;
if (cancel != null) throw cancel;
return result;
}
t = Thread.currentThread();
blockedHandler = Threading.getBlockedThreadHandler(t);
if (blockedHandler == null)
while (!unblocked || listenersInline != null)
try { this.wait(timeout < 0 ? 0 : timeout); }
catch (InterruptedException e) { return null; }
}
if (blockedHandler != null)
blockedHandler.blocked(this, timeout);
if (error != null) throw error;
if (cancel != null) throw cancel;
return result;
}
|
[
"public",
"final",
"T",
"blockResult",
"(",
"long",
"timeout",
")",
"throws",
"TError",
",",
"CancelException",
"{",
"Thread",
"t",
";",
"BlockedThreadHandler",
"blockedHandler",
";",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"unblocked",
"&&",
"listenersInline",
"==",
"null",
")",
"{",
"if",
"(",
"error",
"!=",
"null",
")",
"throw",
"error",
";",
"if",
"(",
"cancel",
"!=",
"null",
")",
"throw",
"cancel",
";",
"return",
"result",
";",
"}",
"t",
"=",
"Thread",
".",
"currentThread",
"(",
")",
";",
"blockedHandler",
"=",
"Threading",
".",
"getBlockedThreadHandler",
"(",
"t",
")",
";",
"if",
"(",
"blockedHandler",
"==",
"null",
")",
"while",
"(",
"!",
"unblocked",
"||",
"listenersInline",
"!=",
"null",
")",
"try",
"{",
"this",
".",
"wait",
"(",
"timeout",
"<",
"0",
"?",
"0",
":",
"timeout",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}",
"if",
"(",
"blockedHandler",
"!=",
"null",
")",
"blockedHandler",
".",
"blocked",
"(",
"this",
",",
"timeout",
")",
";",
"if",
"(",
"error",
"!=",
"null",
")",
"throw",
"error",
";",
"if",
"(",
"cancel",
"!=",
"null",
")",
"throw",
"cancel",
";",
"return",
"result",
";",
"}"
] |
Block until this AsyncWork is unblocked or the given timeout expired,
and return the result in case of success, or throw the error or cancellation.
@param timeout in milliseconds. 0 or negative value means infinite.
|
[
"Block",
"until",
"this",
"AsyncWork",
"is",
"unblocked",
"or",
"the",
"given",
"timeout",
"expired",
"and",
"return",
"the",
"result",
"in",
"case",
"of",
"success",
"or",
"throw",
"the",
"error",
"or",
"cancellation",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/AsyncWork.java#L517-L538
|
150,428
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/AsyncWork.java
|
AsyncWork.reset
|
public final void reset() {
unblocked = false;
result = null;
error = null;
cancel = null;
listenersInline = null;
}
|
java
|
public final void reset() {
unblocked = false;
result = null;
error = null;
cancel = null;
listenersInline = null;
}
|
[
"public",
"final",
"void",
"reset",
"(",
")",
"{",
"unblocked",
"=",
"false",
";",
"result",
"=",
"null",
";",
"error",
"=",
"null",
";",
"cancel",
"=",
"null",
";",
"listenersInline",
"=",
"null",
";",
"}"
] |
Reset this AsyncWork point to reuse it.
This method remove any previous result, error or cancellation, and mark this AsyncWork as blocked.
Any previous listener is also removed.
|
[
"Reset",
"this",
"AsyncWork",
"point",
"to",
"reuse",
"it",
".",
"This",
"method",
"remove",
"any",
"previous",
"result",
"error",
"or",
"cancellation",
"and",
"mark",
"this",
"AsyncWork",
"as",
"blocked",
".",
"Any",
"previous",
"listener",
"is",
"also",
"removed",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/AsyncWork.java#L564-L570
|
150,429
|
mytechia/mytechia_commons
|
mytechia_commons_library/src/main/java/com/mytechia/commons/util/id/GUID.java
|
GUID.generarIdentificador
|
public String generarIdentificador( ) {
String UUID = Long.toHexString(System.currentTimeMillis());
UUID = UUID.concat(obtenerDireccionIP());
UUID = UUID.concat(identityHashCode);
UUID = UUID.concat(Integer.toHexString(_oAleatorioSeguro.nextInt()));
return UUID;
}
|
java
|
public String generarIdentificador( ) {
String UUID = Long.toHexString(System.currentTimeMillis());
UUID = UUID.concat(obtenerDireccionIP());
UUID = UUID.concat(identityHashCode);
UUID = UUID.concat(Integer.toHexString(_oAleatorioSeguro.nextInt()));
return UUID;
}
|
[
"public",
"String",
"generarIdentificador",
"(",
")",
"{",
"String",
"UUID",
"=",
"Long",
".",
"toHexString",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
";",
"UUID",
"=",
"UUID",
".",
"concat",
"(",
"obtenerDireccionIP",
"(",
")",
")",
";",
"UUID",
"=",
"UUID",
".",
"concat",
"(",
"identityHashCode",
")",
";",
"UUID",
"=",
"UUID",
".",
"concat",
"(",
"Integer",
".",
"toHexString",
"(",
"_oAleatorioSeguro",
".",
"nextInt",
"(",
")",
")",
")",
";",
"return",
"UUID",
";",
"}"
] |
Este metodo genera una nueva cadena de identificador Unico.
La cadena devuelta tiene un maximo de 40 caracteres.
@return un identificador unico
|
[
"Este",
"metodo",
"genera",
"una",
"nueva",
"cadena",
"de",
"identificador",
"Unico",
".",
"La",
"cadena",
"devuelta",
"tiene",
"un",
"maximo",
"de",
"40",
"caracteres",
"."
] |
02251879085f271a1fb51663a1c8eddc8be78ae7
|
https://github.com/mytechia/mytechia_commons/blob/02251879085f271a1fb51663a1c8eddc8be78ae7/mytechia_commons_library/src/main/java/com/mytechia/commons/util/id/GUID.java#L112-L118
|
150,430
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/midi/MidiInfoPanel.java
|
MidiInfoPanel.fillInfoPanelWith
|
public void fillInfoPanelWith(Sequence currentSequence, String songName)
{
getMidiDuration().setText(Helpers.getTimeStringFromMilliseconds(currentSequence.getMicrosecondLength() / 1000L));
getMidiName().setText(songName);
Track[] tracks = currentSequence.getTracks();
StringBuilder fullText = new StringBuilder();
for (int t=0; t<tracks.length; t++)
{
int size = tracks[t].size();
for (int ticks=0; ticks<size; ticks++)
{
MidiEvent event = tracks[t].get(ticks);
MidiMessage message = event.getMessage();
if (message instanceof MetaMessage)
{
int type = ((MetaMessage)message).getType();
if (type <= 0x04)
{
fullText.append(new String(((MetaMessage)message).getData())).append('\n');
}
}
}
}
getMidiInfo().setText(fullText.toString());
getMidiInfo().select(0, 0);
}
|
java
|
public void fillInfoPanelWith(Sequence currentSequence, String songName)
{
getMidiDuration().setText(Helpers.getTimeStringFromMilliseconds(currentSequence.getMicrosecondLength() / 1000L));
getMidiName().setText(songName);
Track[] tracks = currentSequence.getTracks();
StringBuilder fullText = new StringBuilder();
for (int t=0; t<tracks.length; t++)
{
int size = tracks[t].size();
for (int ticks=0; ticks<size; ticks++)
{
MidiEvent event = tracks[t].get(ticks);
MidiMessage message = event.getMessage();
if (message instanceof MetaMessage)
{
int type = ((MetaMessage)message).getType();
if (type <= 0x04)
{
fullText.append(new String(((MetaMessage)message).getData())).append('\n');
}
}
}
}
getMidiInfo().setText(fullText.toString());
getMidiInfo().select(0, 0);
}
|
[
"public",
"void",
"fillInfoPanelWith",
"(",
"Sequence",
"currentSequence",
",",
"String",
"songName",
")",
"{",
"getMidiDuration",
"(",
")",
".",
"setText",
"(",
"Helpers",
".",
"getTimeStringFromMilliseconds",
"(",
"currentSequence",
".",
"getMicrosecondLength",
"(",
")",
"/",
"1000L",
")",
")",
";",
"getMidiName",
"(",
")",
".",
"setText",
"(",
"songName",
")",
";",
"Track",
"[",
"]",
"tracks",
"=",
"currentSequence",
".",
"getTracks",
"(",
")",
";",
"StringBuilder",
"fullText",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"t",
"=",
"0",
";",
"t",
"<",
"tracks",
".",
"length",
";",
"t",
"++",
")",
"{",
"int",
"size",
"=",
"tracks",
"[",
"t",
"]",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"ticks",
"=",
"0",
";",
"ticks",
"<",
"size",
";",
"ticks",
"++",
")",
"{",
"MidiEvent",
"event",
"=",
"tracks",
"[",
"t",
"]",
".",
"get",
"(",
"ticks",
")",
";",
"MidiMessage",
"message",
"=",
"event",
".",
"getMessage",
"(",
")",
";",
"if",
"(",
"message",
"instanceof",
"MetaMessage",
")",
"{",
"int",
"type",
"=",
"(",
"(",
"MetaMessage",
")",
"message",
")",
".",
"getType",
"(",
")",
";",
"if",
"(",
"type",
"<=",
"0x04",
")",
"{",
"fullText",
".",
"append",
"(",
"new",
"String",
"(",
"(",
"(",
"MetaMessage",
")",
"message",
")",
".",
"getData",
"(",
")",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"}",
"}",
"}",
"getMidiInfo",
"(",
")",
".",
"setText",
"(",
"fullText",
".",
"toString",
"(",
")",
")",
";",
"getMidiInfo",
"(",
")",
".",
"select",
"(",
"0",
",",
"0",
")",
";",
"}"
] |
private static final int INSTRUMENTNAME = 0x04;
|
[
"private",
"static",
"final",
"int",
"INSTRUMENTNAME",
"=",
"0x04",
";"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/midi/MidiInfoPanel.java#L176-L201
|
150,431
|
mytechia/mytechia_commons
|
mytechia_commons_library/src/main/java/com/mytechia/commons/patterns/prototype/PrototypeContainer.java
|
PrototypeContainer.getClone
|
public <T> T getClone( String key, Class<T> c )
{
IPrototype prototype = prototypes.get(new PrototypeKey(key, c));
if (prototype != null) {
return (T) prototype.clone();
}
else
return null;
}
|
java
|
public <T> T getClone( String key, Class<T> c )
{
IPrototype prototype = prototypes.get(new PrototypeKey(key, c));
if (prototype != null) {
return (T) prototype.clone();
}
else
return null;
}
|
[
"public",
"<",
"T",
">",
"T",
"getClone",
"(",
"String",
"key",
",",
"Class",
"<",
"T",
">",
"c",
")",
"{",
"IPrototype",
"prototype",
"=",
"prototypes",
".",
"get",
"(",
"new",
"PrototypeKey",
"(",
"key",
",",
"c",
")",
")",
";",
"if",
"(",
"prototype",
"!=",
"null",
")",
"{",
"return",
"(",
"T",
")",
"prototype",
".",
"clone",
"(",
")",
";",
"}",
"else",
"return",
"null",
";",
"}"
] |
Obtains a key associated clone of the prototype for
the specified class and key
NOTE: IPrototype pattern
@param c class of the clone to be obtained
|
[
"Obtains",
"a",
"key",
"associated",
"clone",
"of",
"the",
"prototype",
"for",
"the",
"specified",
"class",
"and",
"key"
] |
02251879085f271a1fb51663a1c8eddc8be78ae7
|
https://github.com/mytechia/mytechia_commons/blob/02251879085f271a1fb51663a1c8eddc8be78ae7/mytechia_commons_library/src/main/java/com/mytechia/commons/patterns/prototype/PrototypeContainer.java#L89-L100
|
150,432
|
mytechia/mytechia_commons
|
mytechia_commons_library/src/main/java/com/mytechia/commons/patterns/prototype/PrototypeContainer.java
|
PrototypeContainer.registerPrototype
|
public void registerPrototype( String key, IPrototype prototype )
{
prototypes.put(new PrototypeKey(key, prototype.getClass()), prototype);
}
|
java
|
public void registerPrototype( String key, IPrototype prototype )
{
prototypes.put(new PrototypeKey(key, prototype.getClass()), prototype);
}
|
[
"public",
"void",
"registerPrototype",
"(",
"String",
"key",
",",
"IPrototype",
"prototype",
")",
"{",
"prototypes",
".",
"put",
"(",
"new",
"PrototypeKey",
"(",
"key",
",",
"prototype",
".",
"getClass",
"(",
")",
")",
",",
"prototype",
")",
";",
"}"
] |
Registers a new prototype associated to the specified key
NOTE: IPrototype pattern
@param key key for the new prototype
@param prototype the prototype to register
|
[
"Registers",
"a",
"new",
"prototype",
"associated",
"to",
"the",
"specified",
"key"
] |
02251879085f271a1fb51663a1c8eddc8be78ae7
|
https://github.com/mytechia/mytechia_commons/blob/02251879085f271a1fb51663a1c8eddc8be78ae7/mytechia_commons_library/src/main/java/com/mytechia/commons/patterns/prototype/PrototypeContainer.java#L138-L143
|
150,433
|
mytechia/mytechia_commons
|
mytechia_commons_library/src/main/java/com/mytechia/commons/patterns/prototype/PrototypeContainer.java
|
PrototypeContainer.unregisterPrototype
|
public void unregisterPrototype( String key, Class c )
{
prototypes.remove(new PrototypeKey(key, c));
}
|
java
|
public void unregisterPrototype( String key, Class c )
{
prototypes.remove(new PrototypeKey(key, c));
}
|
[
"public",
"void",
"unregisterPrototype",
"(",
"String",
"key",
",",
"Class",
"c",
")",
"{",
"prototypes",
".",
"remove",
"(",
"new",
"PrototypeKey",
"(",
"key",
",",
"c",
")",
")",
";",
"}"
] |
Unregisters a prototype associated to the specified key
NOTE: IPrototype pattern
@param key key of the prototype
@param c the prototype to unregister
|
[
"Unregisters",
"a",
"prototype",
"associated",
"to",
"the",
"specified",
"key"
] |
02251879085f271a1fb51663a1c8eddc8be78ae7
|
https://github.com/mytechia/mytechia_commons/blob/02251879085f271a1fb51663a1c8eddc8be78ae7/mytechia_commons_library/src/main/java/com/mytechia/commons/patterns/prototype/PrototypeContainer.java#L153-L158
|
150,434
|
lkwg82/enforcer-rules
|
src/main/java/org/apache/maven/plugins/enforcer/RequireOS.java
|
RequireOS.displayOSInfo
|
public void displayOSInfo( Log log, boolean info )
{
String string =
"OS Info: Arch: " + Os.OS_ARCH + " Family: " + Os.OS_FAMILY + " Name: " + Os.OS_NAME + " Version: "
+ Os.OS_VERSION;
if ( !info )
{
log.debug( string );
}
else
{
log.info( string );
}
}
|
java
|
public void displayOSInfo( Log log, boolean info )
{
String string =
"OS Info: Arch: " + Os.OS_ARCH + " Family: " + Os.OS_FAMILY + " Name: " + Os.OS_NAME + " Version: "
+ Os.OS_VERSION;
if ( !info )
{
log.debug( string );
}
else
{
log.info( string );
}
}
|
[
"public",
"void",
"displayOSInfo",
"(",
"Log",
"log",
",",
"boolean",
"info",
")",
"{",
"String",
"string",
"=",
"\"OS Info: Arch: \"",
"+",
"Os",
".",
"OS_ARCH",
"+",
"\" Family: \"",
"+",
"Os",
".",
"OS_FAMILY",
"+",
"\" Name: \"",
"+",
"Os",
".",
"OS_NAME",
"+",
"\" Version: \"",
"+",
"Os",
".",
"OS_VERSION",
";",
"if",
"(",
"!",
"info",
")",
"{",
"log",
".",
"debug",
"(",
"string",
")",
";",
"}",
"else",
"{",
"log",
".",
"info",
"(",
"string",
")",
";",
"}",
"}"
] |
Log the current OS information.
@param log the log
@param info the info
|
[
"Log",
"the",
"current",
"OS",
"information",
"."
] |
fa2d309af7907b17fc8eaf386f8056d77b654749
|
https://github.com/lkwg82/enforcer-rules/blob/fa2d309af7907b17fc8eaf386f8056d77b654749/src/main/java/org/apache/maven/plugins/enforcer/RequireOS.java#L161-L175
|
150,435
|
lkwg82/enforcer-rules
|
src/main/java/org/apache/maven/plugins/enforcer/RequireOS.java
|
RequireOS.allParamsEmpty
|
public boolean allParamsEmpty()
{
return ( StringUtils.isEmpty( family ) && StringUtils.isEmpty( arch ) && StringUtils.isEmpty( name ) && StringUtils.isEmpty( version ) );
}
|
java
|
public boolean allParamsEmpty()
{
return ( StringUtils.isEmpty( family ) && StringUtils.isEmpty( arch ) && StringUtils.isEmpty( name ) && StringUtils.isEmpty( version ) );
}
|
[
"public",
"boolean",
"allParamsEmpty",
"(",
")",
"{",
"return",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"family",
")",
"&&",
"StringUtils",
".",
"isEmpty",
"(",
"arch",
")",
"&&",
"StringUtils",
".",
"isEmpty",
"(",
"name",
")",
"&&",
"StringUtils",
".",
"isEmpty",
"(",
"version",
")",
")",
";",
"}"
] |
Helper method to check that at least one of family, name, version or arch is set.
@return true if all parameters are empty.
|
[
"Helper",
"method",
"to",
"check",
"that",
"at",
"least",
"one",
"of",
"family",
"name",
"version",
"or",
"arch",
"is",
"set",
"."
] |
fa2d309af7907b17fc8eaf386f8056d77b654749
|
https://github.com/lkwg82/enforcer-rules/blob/fa2d309af7907b17fc8eaf386f8056d77b654749/src/main/java/org/apache/maven/plugins/enforcer/RequireOS.java#L195-L199
|
150,436
|
lkwg82/enforcer-rules
|
src/main/java/org/apache/maven/plugins/enforcer/RequireOS.java
|
RequireOS.createActivation
|
private Activation createActivation()
{
Activation activation = new Activation();
activation.setActiveByDefault( false );
activation.setOs( createOsBean() );
return activation;
}
|
java
|
private Activation createActivation()
{
Activation activation = new Activation();
activation.setActiveByDefault( false );
activation.setOs( createOsBean() );
return activation;
}
|
[
"private",
"Activation",
"createActivation",
"(",
")",
"{",
"Activation",
"activation",
"=",
"new",
"Activation",
"(",
")",
";",
"activation",
".",
"setActiveByDefault",
"(",
"false",
")",
";",
"activation",
".",
"setOs",
"(",
"createOsBean",
"(",
")",
")",
";",
"return",
"activation",
";",
"}"
] |
Creates an Activation object that contains the ActivationOS information.
@return a properly populated Activation object.
|
[
"Creates",
"an",
"Activation",
"object",
"that",
"contains",
"the",
"ActivationOS",
"information",
"."
] |
fa2d309af7907b17fc8eaf386f8056d77b654749
|
https://github.com/lkwg82/enforcer-rules/blob/fa2d309af7907b17fc8eaf386f8056d77b654749/src/main/java/org/apache/maven/plugins/enforcer/RequireOS.java#L218-L224
|
150,437
|
lkwg82/enforcer-rules
|
src/main/java/org/apache/maven/plugins/enforcer/RequireOS.java
|
RequireOS.createOsBean
|
private ActivationOS createOsBean()
{
ActivationOS os = new ActivationOS();
os.setArch( arch );
os.setFamily( family );
os.setName( name );
os.setVersion( version );
return os;
}
|
java
|
private ActivationOS createOsBean()
{
ActivationOS os = new ActivationOS();
os.setArch( arch );
os.setFamily( family );
os.setName( name );
os.setVersion( version );
return os;
}
|
[
"private",
"ActivationOS",
"createOsBean",
"(",
")",
"{",
"ActivationOS",
"os",
"=",
"new",
"ActivationOS",
"(",
")",
";",
"os",
".",
"setArch",
"(",
"arch",
")",
";",
"os",
".",
"setFamily",
"(",
"family",
")",
";",
"os",
".",
"setName",
"(",
"name",
")",
";",
"os",
".",
"setVersion",
"(",
"version",
")",
";",
"return",
"os",
";",
"}"
] |
Creates an ActivationOS object containing family, name, version and arch.
@return a properly populated ActivationOS object.
|
[
"Creates",
"an",
"ActivationOS",
"object",
"containing",
"family",
"name",
"version",
"and",
"arch",
"."
] |
fa2d309af7907b17fc8eaf386f8056d77b654749
|
https://github.com/lkwg82/enforcer-rules/blob/fa2d309af7907b17fc8eaf386f8056d77b654749/src/main/java/org/apache/maven/plugins/enforcer/RequireOS.java#L231-L241
|
150,438
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/graphic/misc/RegularPolygon.java
|
RegularPolygon.determineCoordinates
|
protected void determineCoordinates(){
for (int i=0; i<numPoints; i++){
coordinates.set(i, getPointCoordinate(i));
}
}
|
java
|
protected void determineCoordinates(){
for (int i=0; i<numPoints; i++){
coordinates.set(i, getPointCoordinate(i));
}
}
|
[
"protected",
"void",
"determineCoordinates",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numPoints",
";",
"i",
"++",
")",
"{",
"coordinates",
".",
"set",
"(",
"i",
",",
"getPointCoordinate",
"(",
"i",
")",
")",
";",
"}",
"}"
] |
Determines the properties of the underlying circle and the point coordinates.
|
[
"Determines",
"the",
"properties",
"of",
"the",
"underlying",
"circle",
"and",
"the",
"point",
"coordinates",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/graphic/misc/RegularPolygon.java#L50-L54
|
150,439
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/managers/MessageTypeHandler.java
|
MessageTypeHandler.handleMessage
|
public void handleMessage(String message, E_MessageType type, ST max100, Object appID){
this.count++;
boolean doMax = false;
if(this.maxCount!=-1 && this.count>this.maxCount){
max100.add("name", appID);
max100.add("number", this.maxCount);
doMax = true;
}
if(this.useSkbConsole==true){
switch(type){
case ERROR:
MessageConsole.conError(message);
if(doMax==true){
MessageConsole.conError(max100.render());
}
break;
case INFO:
MessageConsole.conInfo(message);
if(doMax==true){
MessageConsole.conError(max100.render());
}
break;
case WARNING:
MessageConsole.conWarn(message);
if(doMax==true){
MessageConsole.conError(max100.render());
}
break;
}
}
else{
switch(type){
case ERROR:
this.logger.error(message);
if(doMax==true){
this.logger.error(max100.render());
}
break;
case INFO:
this.logger.info(message);
if(doMax==true){
this.logger.error(max100.render());
}
break;
case WARNING:
this.logger.warn(message);
if(doMax==true){
this.logger.error(max100.render());
}
break;
}
}
}
|
java
|
public void handleMessage(String message, E_MessageType type, ST max100, Object appID){
this.count++;
boolean doMax = false;
if(this.maxCount!=-1 && this.count>this.maxCount){
max100.add("name", appID);
max100.add("number", this.maxCount);
doMax = true;
}
if(this.useSkbConsole==true){
switch(type){
case ERROR:
MessageConsole.conError(message);
if(doMax==true){
MessageConsole.conError(max100.render());
}
break;
case INFO:
MessageConsole.conInfo(message);
if(doMax==true){
MessageConsole.conError(max100.render());
}
break;
case WARNING:
MessageConsole.conWarn(message);
if(doMax==true){
MessageConsole.conError(max100.render());
}
break;
}
}
else{
switch(type){
case ERROR:
this.logger.error(message);
if(doMax==true){
this.logger.error(max100.render());
}
break;
case INFO:
this.logger.info(message);
if(doMax==true){
this.logger.error(max100.render());
}
break;
case WARNING:
this.logger.warn(message);
if(doMax==true){
this.logger.error(max100.render());
}
break;
}
}
}
|
[
"public",
"void",
"handleMessage",
"(",
"String",
"message",
",",
"E_MessageType",
"type",
",",
"ST",
"max100",
",",
"Object",
"appID",
")",
"{",
"this",
".",
"count",
"++",
";",
"boolean",
"doMax",
"=",
"false",
";",
"if",
"(",
"this",
".",
"maxCount",
"!=",
"-",
"1",
"&&",
"this",
".",
"count",
">",
"this",
".",
"maxCount",
")",
"{",
"max100",
".",
"add",
"(",
"\"name\"",
",",
"appID",
")",
";",
"max100",
".",
"add",
"(",
"\"number\"",
",",
"this",
".",
"maxCount",
")",
";",
"doMax",
"=",
"true",
";",
"}",
"if",
"(",
"this",
".",
"useSkbConsole",
"==",
"true",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"ERROR",
":",
"MessageConsole",
".",
"conError",
"(",
"message",
")",
";",
"if",
"(",
"doMax",
"==",
"true",
")",
"{",
"MessageConsole",
".",
"conError",
"(",
"max100",
".",
"render",
"(",
")",
")",
";",
"}",
"break",
";",
"case",
"INFO",
":",
"MessageConsole",
".",
"conInfo",
"(",
"message",
")",
";",
"if",
"(",
"doMax",
"==",
"true",
")",
"{",
"MessageConsole",
".",
"conError",
"(",
"max100",
".",
"render",
"(",
")",
")",
";",
"}",
"break",
";",
"case",
"WARNING",
":",
"MessageConsole",
".",
"conWarn",
"(",
"message",
")",
";",
"if",
"(",
"doMax",
"==",
"true",
")",
"{",
"MessageConsole",
".",
"conError",
"(",
"max100",
".",
"render",
"(",
")",
")",
";",
"}",
"break",
";",
"}",
"}",
"else",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"ERROR",
":",
"this",
".",
"logger",
".",
"error",
"(",
"message",
")",
";",
"if",
"(",
"doMax",
"==",
"true",
")",
"{",
"this",
".",
"logger",
".",
"error",
"(",
"max100",
".",
"render",
"(",
")",
")",
";",
"}",
"break",
";",
"case",
"INFO",
":",
"this",
".",
"logger",
".",
"info",
"(",
"message",
")",
";",
"if",
"(",
"doMax",
"==",
"true",
")",
"{",
"this",
".",
"logger",
".",
"error",
"(",
"max100",
".",
"render",
"(",
")",
")",
";",
"}",
"break",
";",
"case",
"WARNING",
":",
"this",
".",
"logger",
".",
"warn",
"(",
"message",
")",
";",
"if",
"(",
"doMax",
"==",
"true",
")",
"{",
"this",
".",
"logger",
".",
"error",
"(",
"max100",
".",
"render",
"(",
")",
")",
";",
"}",
"break",
";",
"}",
"}",
"}"
] |
Handles the message.
@param message the message to be handled
@param type message type
@param appID application identifier for max message count
|
[
"Handles",
"the",
"message",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/managers/MessageTypeHandler.java#L124-L178
|
150,440
|
mytechia/mytechia_commons
|
mytechia-commons-modelaction/src/main/java/com/mytechia/commons/framework/modelaction/action/background/BackgroundAction.java
|
BackgroundAction.executeInBackground
|
public void executeInBackground()
{
Thread t = new Thread() {
public void run() {
try{
execute();
}catch(Exception e) {
notifyException(e);
}
}
};
t.start();
}
|
java
|
public void executeInBackground()
{
Thread t = new Thread() {
public void run() {
try{
execute();
}catch(Exception e) {
notifyException(e);
}
}
};
t.start();
}
|
[
"public",
"void",
"executeInBackground",
"(",
")",
"{",
"Thread",
"t",
"=",
"new",
"Thread",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"execute",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"notifyException",
"(",
"e",
")",
";",
"}",
"}",
"}",
";",
"t",
".",
"start",
"(",
")",
";",
"}"
] |
A new thread is automatically created to execute the action
|
[
"A",
"new",
"thread",
"is",
"automatically",
"created",
"to",
"execute",
"the",
"action"
] |
02251879085f271a1fb51663a1c8eddc8be78ae7
|
https://github.com/mytechia/mytechia_commons/blob/02251879085f271a1fb51663a1c8eddc8be78ae7/mytechia-commons-modelaction/src/main/java/com/mytechia/commons/framework/modelaction/action/background/BackgroundAction.java#L85-L101
|
150,441
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/misc/valuegeneration/StochasticValueGenerator.java
|
StochasticValueGenerator.getNextValue
|
public E getNextValue() throws ValueGenerationException{
if(!isValid())
throw new ValueGenerationException("Cannot provide elements in invalid state.");
Double random = rand.nextDouble();
for(int i=0; i<limits.size(); i++)
if(random <= limits.get(i)){
return keys.get(i);
}
return null;
}
|
java
|
public E getNextValue() throws ValueGenerationException{
if(!isValid())
throw new ValueGenerationException("Cannot provide elements in invalid state.");
Double random = rand.nextDouble();
for(int i=0; i<limits.size(); i++)
if(random <= limits.get(i)){
return keys.get(i);
}
return null;
}
|
[
"public",
"E",
"getNextValue",
"(",
")",
"throws",
"ValueGenerationException",
"{",
"if",
"(",
"!",
"isValid",
"(",
")",
")",
"throw",
"new",
"ValueGenerationException",
"(",
"\"Cannot provide elements in invalid state.\"",
")",
";",
"Double",
"random",
"=",
"rand",
".",
"nextDouble",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"limits",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"if",
"(",
"random",
"<=",
"limits",
".",
"get",
"(",
"i",
")",
")",
"{",
"return",
"keys",
".",
"get",
"(",
"i",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Conducts a stochastic element choice based on the maintained occurrence probabilities.
@return A randomly chosen element based on occurrence probabilities.
@throws ValueGenerationException Thrown, if the chooser is in an invalid state.
|
[
"Conducts",
"a",
"stochastic",
"element",
"choice",
"based",
"on",
"the",
"maintained",
"occurrence",
"probabilities",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/valuegeneration/StochasticValueGenerator.java#L135-L144
|
150,442
|
livetribe/livetribe-slp
|
core/src/main/java/org/livetribe/slp/spi/msg/Extension.java
|
Extension.deserialize
|
public static Extension deserialize(byte[] extensionBytes) throws ServiceLocationException
{
int extensionId = readInt(extensionBytes, 0, ID_BYTES_LENGTH);
Extension extension = createExtension(extensionId);
if (extension != null)
{
byte[] bodyBytes = new byte[extensionBytes.length - ID_BYTES_LENGTH - NEXT_EXTENSION_OFFSET_BYTES_LENGTH];
System.arraycopy(extensionBytes, ID_BYTES_LENGTH + NEXT_EXTENSION_OFFSET_BYTES_LENGTH, bodyBytes, 0, bodyBytes.length);
extension.deserializeBody(bodyBytes);
}
return extension;
}
|
java
|
public static Extension deserialize(byte[] extensionBytes) throws ServiceLocationException
{
int extensionId = readInt(extensionBytes, 0, ID_BYTES_LENGTH);
Extension extension = createExtension(extensionId);
if (extension != null)
{
byte[] bodyBytes = new byte[extensionBytes.length - ID_BYTES_LENGTH - NEXT_EXTENSION_OFFSET_BYTES_LENGTH];
System.arraycopy(extensionBytes, ID_BYTES_LENGTH + NEXT_EXTENSION_OFFSET_BYTES_LENGTH, bodyBytes, 0, bodyBytes.length);
extension.deserializeBody(bodyBytes);
}
return extension;
}
|
[
"public",
"static",
"Extension",
"deserialize",
"(",
"byte",
"[",
"]",
"extensionBytes",
")",
"throws",
"ServiceLocationException",
"{",
"int",
"extensionId",
"=",
"readInt",
"(",
"extensionBytes",
",",
"0",
",",
"ID_BYTES_LENGTH",
")",
";",
"Extension",
"extension",
"=",
"createExtension",
"(",
"extensionId",
")",
";",
"if",
"(",
"extension",
"!=",
"null",
")",
"{",
"byte",
"[",
"]",
"bodyBytes",
"=",
"new",
"byte",
"[",
"extensionBytes",
".",
"length",
"-",
"ID_BYTES_LENGTH",
"-",
"NEXT_EXTENSION_OFFSET_BYTES_LENGTH",
"]",
";",
"System",
".",
"arraycopy",
"(",
"extensionBytes",
",",
"ID_BYTES_LENGTH",
"+",
"NEXT_EXTENSION_OFFSET_BYTES_LENGTH",
",",
"bodyBytes",
",",
"0",
",",
"bodyBytes",
".",
"length",
")",
";",
"extension",
".",
"deserializeBody",
"(",
"bodyBytes",
")",
";",
"}",
"return",
"extension",
";",
"}"
] |
Returns an Extension subclass object obtained deserializing the given bytes, or null
if the bytes contain an extension that is not understood.
@param extensionBytes The bytes to deserialize
@throws ServiceLocationException If the deserialization fails
|
[
"Returns",
"an",
"Extension",
"subclass",
"object",
"obtained",
"deserializing",
"the",
"given",
"bytes",
"or",
"null",
"if",
"the",
"bytes",
"contain",
"an",
"extension",
"that",
"is",
"not",
"understood",
"."
] |
6cc13dbe81feab133fe3dd291ca081cbc6e1f591
|
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/spi/msg/Extension.java#L77-L88
|
150,443
|
lukas-krecan/rest-fire
|
src/main/java/net/javacrumbs/restfire/impl/DefaultHeaders.java
|
DefaultHeaders.addHeader
|
public void addHeader(String name, String value) {
headers.add(name, value);
List<String> list = caseSensitiveHeaders.get(name);
if (list == null) {
list = new ArrayList<String>();
caseSensitiveHeaders.put(name, list);
}
list.add(value);
}
|
java
|
public void addHeader(String name, String value) {
headers.add(name, value);
List<String> list = caseSensitiveHeaders.get(name);
if (list == null) {
list = new ArrayList<String>();
caseSensitiveHeaders.put(name, list);
}
list.add(value);
}
|
[
"public",
"void",
"addHeader",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"headers",
".",
"add",
"(",
"name",
",",
"value",
")",
";",
"List",
"<",
"String",
">",
"list",
"=",
"caseSensitiveHeaders",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"list",
"==",
"null",
")",
"{",
"list",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"caseSensitiveHeaders",
".",
"put",
"(",
"name",
",",
"list",
")",
";",
"}",
"list",
".",
"add",
"(",
"value",
")",
";",
"}"
] |
Adds and normalizes the header.
@param name
@param value
|
[
"Adds",
"and",
"normalizes",
"the",
"header",
"."
] |
2fcc9d451122413900ef44337527abaa75d930a2
|
https://github.com/lukas-krecan/rest-fire/blob/2fcc9d451122413900ef44337527abaa75d930a2/src/main/java/net/javacrumbs/restfire/impl/DefaultHeaders.java#L42-L50
|
150,444
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/console/NonBlockingReader.java
|
NonBlockingReader.getCallWTimeout
|
public static Callable<String> getCallWTimeout(BufferedReader reader, HasPrompt emptyPrint){
return NonBlockingReader.getCallWTimeout(reader, 200, emptyPrint);
}
|
java
|
public static Callable<String> getCallWTimeout(BufferedReader reader, HasPrompt emptyPrint){
return NonBlockingReader.getCallWTimeout(reader, 200, emptyPrint);
}
|
[
"public",
"static",
"Callable",
"<",
"String",
">",
"getCallWTimeout",
"(",
"BufferedReader",
"reader",
",",
"HasPrompt",
"emptyPrint",
")",
"{",
"return",
"NonBlockingReader",
".",
"getCallWTimeout",
"(",
"reader",
",",
"200",
",",
"emptyPrint",
")",
";",
"}"
] |
Returns a new callable for reading strings from a reader with a set timeout of 200ms.
@param reader input stream to read from
@param emptyPrint a printout to realize on an empty readline string, for prompts, set null if not required
@return null if input stream is null, results of read on input stream otherwise
|
[
"Returns",
"a",
"new",
"callable",
"for",
"reading",
"strings",
"from",
"a",
"reader",
"with",
"a",
"set",
"timeout",
"of",
"200ms",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/console/NonBlockingReader.java#L46-L48
|
150,445
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/console/NonBlockingReader.java
|
NonBlockingReader.getCallWTimeout
|
public static Callable<String> getCallWTimeout(BufferedReader reader, int timeout, HasPrompt emptyPrint){
return new Callable<String>() {
@Override
public String call() throws IOException {
String ret = "";
while("".equals(ret)){
try{
while(!reader.ready()){
Thread.sleep(timeout);
}
ret = reader.readLine();
if("".equals(ret) && emptyPrint!=null){
System.out.print(emptyPrint.prompt());
}
}
catch (InterruptedException e) {
return null;
}
}
return ret;
}
};
}
|
java
|
public static Callable<String> getCallWTimeout(BufferedReader reader, int timeout, HasPrompt emptyPrint){
return new Callable<String>() {
@Override
public String call() throws IOException {
String ret = "";
while("".equals(ret)){
try{
while(!reader.ready()){
Thread.sleep(timeout);
}
ret = reader.readLine();
if("".equals(ret) && emptyPrint!=null){
System.out.print(emptyPrint.prompt());
}
}
catch (InterruptedException e) {
return null;
}
}
return ret;
}
};
}
|
[
"public",
"static",
"Callable",
"<",
"String",
">",
"getCallWTimeout",
"(",
"BufferedReader",
"reader",
",",
"int",
"timeout",
",",
"HasPrompt",
"emptyPrint",
")",
"{",
"return",
"new",
"Callable",
"<",
"String",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"call",
"(",
")",
"throws",
"IOException",
"{",
"String",
"ret",
"=",
"\"\"",
";",
"while",
"(",
"\"\"",
".",
"equals",
"(",
"ret",
")",
")",
"{",
"try",
"{",
"while",
"(",
"!",
"reader",
".",
"ready",
"(",
")",
")",
"{",
"Thread",
".",
"sleep",
"(",
"timeout",
")",
";",
"}",
"ret",
"=",
"reader",
".",
"readLine",
"(",
")",
";",
"if",
"(",
"\"\"",
".",
"equals",
"(",
"ret",
")",
"&&",
"emptyPrint",
"!=",
"null",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"emptyPrint",
".",
"prompt",
"(",
")",
")",
";",
"}",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}",
"return",
"ret",
";",
"}",
"}",
";",
"}"
] |
Returns a new callable for reading strings from a reader with a given timeout.
@param reader input stream to read from
@param timeout read timeout in milliseconds, very low numbers and 0 are accepted but might result in strange behavior
@param emptyPrint a printout to realize on an empty readline string, for prompts, set null if not required
@return null if input stream is null, results of read on input stream otherwise
|
[
"Returns",
"a",
"new",
"callable",
"for",
"reading",
"strings",
"from",
"a",
"reader",
"with",
"a",
"given",
"timeout",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/console/NonBlockingReader.java#L57-L79
|
150,446
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/xml/dom/XMLNode.java
|
XMLNode.isAncestor
|
public boolean isAncestor(XMLNode node) {
return node == parent || (parent != null && parent.isAncestor(node));
}
|
java
|
public boolean isAncestor(XMLNode node) {
return node == parent || (parent != null && parent.isAncestor(node));
}
|
[
"public",
"boolean",
"isAncestor",
"(",
"XMLNode",
"node",
")",
"{",
"return",
"node",
"==",
"parent",
"||",
"(",
"parent",
"!=",
"null",
"&&",
"parent",
".",
"isAncestor",
"(",
"node",
")",
")",
";",
"}"
] |
Check if the given node is an ancestor of this node.
|
[
"Check",
"if",
"the",
"given",
"node",
"is",
"an",
"ancestor",
"of",
"this",
"node",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/xml/dom/XMLNode.java#L43-L45
|
150,447
|
sahan/RoboZombie
|
robozombie/src/main/java/org/apache/http42/client/utils/URIBuilder.java
|
URIBuilder.addParameter
|
public URIBuilder addParameter(final String param, final String value) {
if (this.queryParams == null) {
this.queryParams = new ArrayList<NameValuePair>();
}
this.queryParams.add(new BasicNameValuePair(param, value));
this.encodedQuery = null;
this.encodedSchemeSpecificPart = null;
return this;
}
|
java
|
public URIBuilder addParameter(final String param, final String value) {
if (this.queryParams == null) {
this.queryParams = new ArrayList<NameValuePair>();
}
this.queryParams.add(new BasicNameValuePair(param, value));
this.encodedQuery = null;
this.encodedSchemeSpecificPart = null;
return this;
}
|
[
"public",
"URIBuilder",
"addParameter",
"(",
"final",
"String",
"param",
",",
"final",
"String",
"value",
")",
"{",
"if",
"(",
"this",
".",
"queryParams",
"==",
"null",
")",
"{",
"this",
".",
"queryParams",
"=",
"new",
"ArrayList",
"<",
"NameValuePair",
">",
"(",
")",
";",
"}",
"this",
".",
"queryParams",
".",
"add",
"(",
"new",
"BasicNameValuePair",
"(",
"param",
",",
"value",
")",
")",
";",
"this",
".",
"encodedQuery",
"=",
"null",
";",
"this",
".",
"encodedSchemeSpecificPart",
"=",
"null",
";",
"return",
"this",
";",
"}"
] |
Adds parameter to URI query. The parameter name and value are expected to be unescaped
and may contain non ASCII characters.
|
[
"Adds",
"parameter",
"to",
"URI",
"query",
".",
"The",
"parameter",
"name",
"and",
"value",
"are",
"expected",
"to",
"be",
"unescaped",
"and",
"may",
"contain",
"non",
"ASCII",
"characters",
"."
] |
2e02f0d41647612e9d89360c5c48811ea86b33c8
|
https://github.com/sahan/RoboZombie/blob/2e02f0d41647612e9d89360c5c48811ea86b33c8/robozombie/src/main/java/org/apache/http42/client/utils/URIBuilder.java#L269-L277
|
150,448
|
sahan/RoboZombie
|
robozombie/src/main/java/org/apache/http42/client/utils/URIBuilder.java
|
URIBuilder.setParameter
|
public URIBuilder setParameter(final String param, final String value) {
if (this.queryParams == null) {
this.queryParams = new ArrayList<NameValuePair>();
}
if (!this.queryParams.isEmpty()) {
for (Iterator<NameValuePair> it = this.queryParams.iterator(); it.hasNext(); ) {
NameValuePair nvp = it.next();
if (nvp.getName().equals(param)) {
it.remove();
}
}
}
this.queryParams.add(new BasicNameValuePair(param, value));
this.encodedQuery = null;
this.encodedSchemeSpecificPart = null;
return this;
}
|
java
|
public URIBuilder setParameter(final String param, final String value) {
if (this.queryParams == null) {
this.queryParams = new ArrayList<NameValuePair>();
}
if (!this.queryParams.isEmpty()) {
for (Iterator<NameValuePair> it = this.queryParams.iterator(); it.hasNext(); ) {
NameValuePair nvp = it.next();
if (nvp.getName().equals(param)) {
it.remove();
}
}
}
this.queryParams.add(new BasicNameValuePair(param, value));
this.encodedQuery = null;
this.encodedSchemeSpecificPart = null;
return this;
}
|
[
"public",
"URIBuilder",
"setParameter",
"(",
"final",
"String",
"param",
",",
"final",
"String",
"value",
")",
"{",
"if",
"(",
"this",
".",
"queryParams",
"==",
"null",
")",
"{",
"this",
".",
"queryParams",
"=",
"new",
"ArrayList",
"<",
"NameValuePair",
">",
"(",
")",
";",
"}",
"if",
"(",
"!",
"this",
".",
"queryParams",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"Iterator",
"<",
"NameValuePair",
">",
"it",
"=",
"this",
".",
"queryParams",
".",
"iterator",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"NameValuePair",
"nvp",
"=",
"it",
".",
"next",
"(",
")",
";",
"if",
"(",
"nvp",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"param",
")",
")",
"{",
"it",
".",
"remove",
"(",
")",
";",
"}",
"}",
"}",
"this",
".",
"queryParams",
".",
"add",
"(",
"new",
"BasicNameValuePair",
"(",
"param",
",",
"value",
")",
")",
";",
"this",
".",
"encodedQuery",
"=",
"null",
";",
"this",
".",
"encodedSchemeSpecificPart",
"=",
"null",
";",
"return",
"this",
";",
"}"
] |
Sets parameter of URI query overriding existing value if set. The parameter name and value
are expected to be unescaped and may contain non ASCII characters.
|
[
"Sets",
"parameter",
"of",
"URI",
"query",
"overriding",
"existing",
"value",
"if",
"set",
".",
"The",
"parameter",
"name",
"and",
"value",
"are",
"expected",
"to",
"be",
"unescaped",
"and",
"may",
"contain",
"non",
"ASCII",
"characters",
"."
] |
2e02f0d41647612e9d89360c5c48811ea86b33c8
|
https://github.com/sahan/RoboZombie/blob/2e02f0d41647612e9d89360c5c48811ea86b33c8/robozombie/src/main/java/org/apache/http42/client/utils/URIBuilder.java#L283-L299
|
150,449
|
hycos/regex2smtlib
|
src/main/java/com/github/hycos/regex2smtlib/translator/TranslationMap.java
|
TranslationMap.has
|
public boolean has(Element ele) {
return tmap.containsKey(ele) && !tmap.get(ele).isEmpty();
}
|
java
|
public boolean has(Element ele) {
return tmap.containsKey(ele) && !tmap.get(ele).isEmpty();
}
|
[
"public",
"boolean",
"has",
"(",
"Element",
"ele",
")",
"{",
"return",
"tmap",
".",
"containsKey",
"(",
"ele",
")",
"&&",
"!",
"tmap",
".",
"get",
"(",
"ele",
")",
".",
"isEmpty",
"(",
")",
";",
"}"
] |
check the presence of ele in translation map
@param ele regular expression element
@return true, in case ele is present in translation map
|
[
"check",
"the",
"presence",
"of",
"ele",
"in",
"translation",
"map"
] |
627013396cc42d12298b02d13aadef9706956081
|
https://github.com/hycos/regex2smtlib/blob/627013396cc42d12298b02d13aadef9706956081/src/main/java/com/github/hycos/regex2smtlib/translator/TranslationMap.java#L82-L84
|
150,450
|
netarchivesuite/heritrix3-wrapper
|
src/main/java/org/netarchivesuite/heritrix3wrapper/xmlutils/XslErrorListenerAbstract.java
|
XslErrorListenerAbstract.reset
|
public void reset() {
numberOfErrors = 0;
numberOfFatalErrors = 0;
numberOfWarnings = 0;
errors.clear();
fatalErrors.clear();
warnings.clear();
}
|
java
|
public void reset() {
numberOfErrors = 0;
numberOfFatalErrors = 0;
numberOfWarnings = 0;
errors.clear();
fatalErrors.clear();
warnings.clear();
}
|
[
"public",
"void",
"reset",
"(",
")",
"{",
"numberOfErrors",
"=",
"0",
";",
"numberOfFatalErrors",
"=",
"0",
";",
"numberOfWarnings",
"=",
"0",
";",
"errors",
".",
"clear",
"(",
")",
";",
"fatalErrors",
".",
"clear",
"(",
")",
";",
"warnings",
".",
"clear",
"(",
")",
";",
"}"
] |
Reset accumulated errors counters.
|
[
"Reset",
"accumulated",
"errors",
"counters",
"."
] |
e53ec5736cbac0bdd3925b5331737dc905871629
|
https://github.com/netarchivesuite/heritrix3-wrapper/blob/e53ec5736cbac0bdd3925b5331737dc905871629/src/main/java/org/netarchivesuite/heritrix3wrapper/xmlutils/XslErrorListenerAbstract.java#L34-L41
|
150,451
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/file/FileWriter.java
|
FileWriter.initialize
|
private synchronized void initialize(String fileName, String path) throws ParameterException {
if(!path.equals(this.path)){
checkPath(path);
this.path = path;
}
if(!fileName.equals(this.fileName)){
checkFileName(fileName);
this.fileName = fileName;
}
}
|
java
|
private synchronized void initialize(String fileName, String path) throws ParameterException {
if(!path.equals(this.path)){
checkPath(path);
this.path = path;
}
if(!fileName.equals(this.fileName)){
checkFileName(fileName);
this.fileName = fileName;
}
}
|
[
"private",
"synchronized",
"void",
"initialize",
"(",
"String",
"fileName",
",",
"String",
"path",
")",
"throws",
"ParameterException",
"{",
"if",
"(",
"!",
"path",
".",
"equals",
"(",
"this",
".",
"path",
")",
")",
"{",
"checkPath",
"(",
"path",
")",
";",
"this",
".",
"path",
"=",
"path",
";",
"}",
"if",
"(",
"!",
"fileName",
".",
"equals",
"(",
"this",
".",
"fileName",
")",
")",
"{",
"checkFileName",
"(",
"fileName",
")",
";",
"this",
".",
"fileName",
"=",
"fileName",
";",
"}",
"}"
] |
Initializes the file writer with the given file and path names.
@param fileName
@param path
@throws ParameterException if some parameters are <code>null</code>, <br>
the file path is not a directory or the file name is an empty string.
|
[
"Initializes",
"the",
"file",
"writer",
"with",
"the",
"given",
"file",
"and",
"path",
"names",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/file/FileWriter.java#L286-L295
|
150,452
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/file/FileWriter.java
|
FileWriter.checkPath
|
private synchronized void checkPath(String logPath) throws ParameterException {
Validate.notNull(path);
File cPath = new File(logPath);
if(!cPath.exists())
cPath.mkdirs();
if(!cPath.isDirectory())
throw new ParameterException(ErrorCode.INCOMPATIBILITY, logPath + " is not a valid path!");
}
|
java
|
private synchronized void checkPath(String logPath) throws ParameterException {
Validate.notNull(path);
File cPath = new File(logPath);
if(!cPath.exists())
cPath.mkdirs();
if(!cPath.isDirectory())
throw new ParameterException(ErrorCode.INCOMPATIBILITY, logPath + " is not a valid path!");
}
|
[
"private",
"synchronized",
"void",
"checkPath",
"(",
"String",
"logPath",
")",
"throws",
"ParameterException",
"{",
"Validate",
".",
"notNull",
"(",
"path",
")",
";",
"File",
"cPath",
"=",
"new",
"File",
"(",
"logPath",
")",
";",
"if",
"(",
"!",
"cPath",
".",
"exists",
"(",
")",
")",
"cPath",
".",
"mkdirs",
"(",
")",
";",
"if",
"(",
"!",
"cPath",
".",
"isDirectory",
"(",
")",
")",
"throw",
"new",
"ParameterException",
"(",
"ErrorCode",
".",
"INCOMPATIBILITY",
",",
"logPath",
"+",
"\" is not a valid path!\"",
")",
";",
"}"
] |
Sets the path for the file writer where output files are put in.
@param logPath Desired log path.
@throws ParameterException if the given path is <code>null</null> or not a directory.
|
[
"Sets",
"the",
"path",
"for",
"the",
"file",
"writer",
"where",
"output",
"files",
"are",
"put",
"in",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/file/FileWriter.java#L302-L309
|
150,453
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/file/FileWriter.java
|
FileWriter.checkFileName
|
private synchronized void checkFileName(String fileName) throws ParameterException{
Validate.notNull(fileName);
File cFile = new File(fileName);
if(cFile.getName().length()==0)
throw new ParameterException(ErrorCode.INCOMPATIBILITY, fileName + " is not a valid file-name!");
}
|
java
|
private synchronized void checkFileName(String fileName) throws ParameterException{
Validate.notNull(fileName);
File cFile = new File(fileName);
if(cFile.getName().length()==0)
throw new ParameterException(ErrorCode.INCOMPATIBILITY, fileName + " is not a valid file-name!");
}
|
[
"private",
"synchronized",
"void",
"checkFileName",
"(",
"String",
"fileName",
")",
"throws",
"ParameterException",
"{",
"Validate",
".",
"notNull",
"(",
"fileName",
")",
";",
"File",
"cFile",
"=",
"new",
"File",
"(",
"fileName",
")",
";",
"if",
"(",
"cFile",
".",
"getName",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
"throw",
"new",
"ParameterException",
"(",
"ErrorCode",
".",
"INCOMPATIBILITY",
",",
"fileName",
"+",
"\" is not a valid file-name!\"",
")",
";",
"}"
] |
Sets the name for the output file.
@param fileName Desired file name.
@throws IllegalArgumentException if the given file name is empty.
|
[
"Sets",
"the",
"name",
"for",
"the",
"output",
"file",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/file/FileWriter.java#L316-L321
|
150,454
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/file/FileWriter.java
|
FileWriter.prepareFile
|
private synchronized void prepareFile() throws IOException{
outputFile = new File(getFileName());
if(outputFile.exists())
outputFile.delete();
if(outputFile.isDirectory())
throw new IOException("I/O Error on creating file: File is a directory!");
outputFile.createNewFile();
if(!outputFile.canWrite())
throw new IOException("I/O Error on creating file: Unable to write into file!");
}
|
java
|
private synchronized void prepareFile() throws IOException{
outputFile = new File(getFileName());
if(outputFile.exists())
outputFile.delete();
if(outputFile.isDirectory())
throw new IOException("I/O Error on creating file: File is a directory!");
outputFile.createNewFile();
if(!outputFile.canWrite())
throw new IOException("I/O Error on creating file: Unable to write into file!");
}
|
[
"private",
"synchronized",
"void",
"prepareFile",
"(",
")",
"throws",
"IOException",
"{",
"outputFile",
"=",
"new",
"File",
"(",
"getFileName",
"(",
")",
")",
";",
"if",
"(",
"outputFile",
".",
"exists",
"(",
")",
")",
"outputFile",
".",
"delete",
"(",
")",
";",
"if",
"(",
"outputFile",
".",
"isDirectory",
"(",
")",
")",
"throw",
"new",
"IOException",
"(",
"\"I/O Error on creating file: File is a directory!\"",
")",
";",
"outputFile",
".",
"createNewFile",
"(",
")",
";",
"if",
"(",
"!",
"outputFile",
".",
"canWrite",
"(",
")",
")",
"throw",
"new",
"IOException",
"(",
"\"I/O Error on creating file: Unable to write into file!\"",
")",
";",
"}"
] |
Creates the output file on the file system.
@throws IOException if the output file is a directory or not writable.
|
[
"Creates",
"the",
"output",
"file",
"on",
"the",
"file",
"system",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/file/FileWriter.java#L327-L336
|
150,455
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java
|
Entity.getAllFields
|
public ArrayList<Field> getAllFields() {
final ArrayList<Field> r = new ArrayList<Field>();
final List<String> ids = new ArrayList<String>();
if (getFields() != null) {
for (Field field : getFields()) {
r.add(field);
ids.add(field.getId());
}
}
if (getExtendzEntity() != null) {
for (Field field : getExtendzEntity().getAllFields()) {
if (!ids.contains(field.getId())) {
r.add(field);
}
}
}
return r;
}
|
java
|
public ArrayList<Field> getAllFields() {
final ArrayList<Field> r = new ArrayList<Field>();
final List<String> ids = new ArrayList<String>();
if (getFields() != null) {
for (Field field : getFields()) {
r.add(field);
ids.add(field.getId());
}
}
if (getExtendzEntity() != null) {
for (Field field : getExtendzEntity().getAllFields()) {
if (!ids.contains(field.getId())) {
r.add(field);
}
}
}
return r;
}
|
[
"public",
"ArrayList",
"<",
"Field",
">",
"getAllFields",
"(",
")",
"{",
"final",
"ArrayList",
"<",
"Field",
">",
"r",
"=",
"new",
"ArrayList",
"<",
"Field",
">",
"(",
")",
";",
"final",
"List",
"<",
"String",
">",
"ids",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"if",
"(",
"getFields",
"(",
")",
"!=",
"null",
")",
"{",
"for",
"(",
"Field",
"field",
":",
"getFields",
"(",
")",
")",
"{",
"r",
".",
"add",
"(",
"field",
")",
";",
"ids",
".",
"add",
"(",
"field",
".",
"getId",
"(",
")",
")",
";",
"}",
"}",
"if",
"(",
"getExtendzEntity",
"(",
")",
"!=",
"null",
")",
"{",
"for",
"(",
"Field",
"field",
":",
"getExtendzEntity",
"(",
")",
".",
"getAllFields",
"(",
")",
")",
"{",
"if",
"(",
"!",
"ids",
".",
"contains",
"(",
"field",
".",
"getId",
"(",
")",
")",
")",
"{",
"r",
".",
"add",
"(",
"field",
")",
";",
"}",
"}",
"}",
"return",
"r",
";",
"}"
] |
Return the list of fields including inherited ones.
@return The list
|
[
"Return",
"the",
"list",
"of",
"fields",
"including",
"inherited",
"ones",
"."
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java#L118-L135
|
150,456
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java
|
Entity.getList
|
public List<?> getList(PMContext ctx, EntityFilter filter) throws PMException {
return getList(ctx, filter, null, null, null);
}
|
java
|
public List<?> getList(PMContext ctx, EntityFilter filter) throws PMException {
return getList(ctx, filter, null, null, null);
}
|
[
"public",
"List",
"<",
"?",
">",
"getList",
"(",
"PMContext",
"ctx",
",",
"EntityFilter",
"filter",
")",
"throws",
"PMException",
"{",
"return",
"getList",
"(",
"ctx",
",",
"filter",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"}"
] |
Returns a list of this entity instances with null from and count and with
the given filter
@param ctx The context
@param filter The filter
@return The list
@throws PMException
|
[
"Returns",
"a",
"list",
"of",
"this",
"entity",
"instances",
"with",
"null",
"from",
"and",
"count",
"and",
"with",
"the",
"given",
"filter"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java#L146-L148
|
150,457
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java
|
Entity.getList
|
public List<?> getList(PMContext ctx) throws PMException {
final EntityFilter filter = (ctx != null && this.equals(ctx.getEntity())) ? ctx.getEntityContainer().getFilter() : null;
return getList(ctx, filter, null, null, null);
}
|
java
|
public List<?> getList(PMContext ctx) throws PMException {
final EntityFilter filter = (ctx != null && this.equals(ctx.getEntity())) ? ctx.getEntityContainer().getFilter() : null;
return getList(ctx, filter, null, null, null);
}
|
[
"public",
"List",
"<",
"?",
">",
"getList",
"(",
"PMContext",
"ctx",
")",
"throws",
"PMException",
"{",
"final",
"EntityFilter",
"filter",
"=",
"(",
"ctx",
"!=",
"null",
"&&",
"this",
".",
"equals",
"(",
"ctx",
".",
"getEntity",
"(",
")",
")",
")",
"?",
"ctx",
".",
"getEntityContainer",
"(",
")",
".",
"getFilter",
"(",
")",
":",
"null",
";",
"return",
"getList",
"(",
"ctx",
",",
"filter",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"}"
] |
Return a list of this entity instances with null from and count and the
filter took from the entity container of the context
@param ctx The context
@return The list
@throws PMException
|
[
"Return",
"a",
"list",
"of",
"this",
"entity",
"instances",
"with",
"null",
"from",
"and",
"count",
"and",
"the",
"filter",
"took",
"from",
"the",
"entity",
"container",
"of",
"the",
"context"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java#L158-L161
|
150,458
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java
|
Entity.getList
|
public List<?> getList(PMContext ctx, EntityFilter filter, ListSort sort, Integer from, Integer count) throws PMException {
return getDataAccess().list(ctx, filter, null, sort, from, count);
}
|
java
|
public List<?> getList(PMContext ctx, EntityFilter filter, ListSort sort, Integer from, Integer count) throws PMException {
return getDataAccess().list(ctx, filter, null, sort, from, count);
}
|
[
"public",
"List",
"<",
"?",
">",
"getList",
"(",
"PMContext",
"ctx",
",",
"EntityFilter",
"filter",
",",
"ListSort",
"sort",
",",
"Integer",
"from",
",",
"Integer",
"count",
")",
"throws",
"PMException",
"{",
"return",
"getDataAccess",
"(",
")",
".",
"list",
"(",
"ctx",
",",
"filter",
",",
"null",
",",
"sort",
",",
"from",
",",
"count",
")",
";",
"}"
] |
Returns a list taken from data access with the given parameters.
@param ctx The context
@param filter A filter
@param from The index of the first element
@param count The maximun number of items retrieved
@return The list
@throws PMException
|
[
"Returns",
"a",
"list",
"taken",
"from",
"data",
"access",
"with",
"the",
"given",
"parameters",
"."
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java#L173-L175
|
150,459
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java
|
Entity.getFieldsbyid
|
private Map<String, Field> getFieldsbyid() {
if (fieldsbyid == null) {
fieldsbyid = new HashMap<String, Field>();
for (Field f : getAllFields()) {
fieldsbyid.put(f.getId(), f);
}
}
return fieldsbyid;
}
|
java
|
private Map<String, Field> getFieldsbyid() {
if (fieldsbyid == null) {
fieldsbyid = new HashMap<String, Field>();
for (Field f : getAllFields()) {
fieldsbyid.put(f.getId(), f);
}
}
return fieldsbyid;
}
|
[
"private",
"Map",
"<",
"String",
",",
"Field",
">",
"getFieldsbyid",
"(",
")",
"{",
"if",
"(",
"fieldsbyid",
"==",
"null",
")",
"{",
"fieldsbyid",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Field",
">",
"(",
")",
";",
"for",
"(",
"Field",
"f",
":",
"getAllFields",
"(",
")",
")",
"{",
"fieldsbyid",
".",
"put",
"(",
"f",
".",
"getId",
"(",
")",
",",
"f",
")",
";",
"}",
"}",
"return",
"fieldsbyid",
";",
"}"
] |
Getter for fieldsbyid. If its null, this methods fill it
@return The mapped field list
|
[
"Getter",
"for",
"fieldsbyid",
".",
"If",
"its",
"null",
"this",
"methods",
"fill",
"it"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java#L207-L215
|
150,460
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java
|
Entity.getOrderedFields
|
public ArrayList<Field> getOrderedFields() {
try {
if (isOrdered()) {
ArrayList<Field> r = new ArrayList<Field>(getAllFields());
Collections.sort(r, new FieldComparator(getOrder()));
return r;
}
} catch (Exception e) {
getPm().error(e);
}
return getAllFields();
}
|
java
|
public ArrayList<Field> getOrderedFields() {
try {
if (isOrdered()) {
ArrayList<Field> r = new ArrayList<Field>(getAllFields());
Collections.sort(r, new FieldComparator(getOrder()));
return r;
}
} catch (Exception e) {
getPm().error(e);
}
return getAllFields();
}
|
[
"public",
"ArrayList",
"<",
"Field",
">",
"getOrderedFields",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"isOrdered",
"(",
")",
")",
"{",
"ArrayList",
"<",
"Field",
">",
"r",
"=",
"new",
"ArrayList",
"<",
"Field",
">",
"(",
"getAllFields",
"(",
")",
")",
";",
"Collections",
".",
"sort",
"(",
"r",
",",
"new",
"FieldComparator",
"(",
"getOrder",
"(",
")",
")",
")",
";",
"return",
"r",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"getPm",
"(",
")",
".",
"error",
"(",
"e",
")",
";",
"}",
"return",
"getAllFields",
"(",
")",
";",
"}"
] |
This method sorts the fields and returns them
@return fields ordered
|
[
"This",
"method",
"sorts",
"the",
"fields",
"and",
"returns",
"them"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java#L223-L234
|
150,461
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java
|
Entity.fillFields
|
@Deprecated
public void fillFields(Entity entity) {
for (Field field : entity.getAllFields()) {
if (!containsField(field.getId())) {
getFields().add(field);
}
}
}
|
java
|
@Deprecated
public void fillFields(Entity entity) {
for (Field field : entity.getAllFields()) {
if (!containsField(field.getId())) {
getFields().add(field);
}
}
}
|
[
"@",
"Deprecated",
"public",
"void",
"fillFields",
"(",
"Entity",
"entity",
")",
"{",
"for",
"(",
"Field",
"field",
":",
"entity",
".",
"getAllFields",
"(",
")",
")",
"{",
"if",
"(",
"!",
"containsField",
"(",
"field",
".",
"getId",
"(",
")",
")",
")",
"{",
"getFields",
"(",
")",
".",
"add",
"(",
"field",
")",
";",
"}",
"}",
"}"
] |
This method fills the extendsFields variable with the parent Fields. If
some field is redefined, parent field is ignored
@param entity The parent entity given by PM engine
|
[
"This",
"method",
"fills",
"the",
"extendsFields",
"variable",
"with",
"the",
"parent",
"Fields",
".",
"If",
"some",
"field",
"is",
"redefined",
"parent",
"field",
"is",
"ignored"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java#L261-L268
|
150,462
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java
|
Entity.getWeak
|
public Entity getWeak(Field field) {
for (Entity entity : getWeaks()) {
if (entity.getOwner().getEntityProperty().equals(field.getProperty())) {
return entity;
}
}
return null;
}
|
java
|
public Entity getWeak(Field field) {
for (Entity entity : getWeaks()) {
if (entity.getOwner().getEntityProperty().equals(field.getProperty())) {
return entity;
}
}
return null;
}
|
[
"public",
"Entity",
"getWeak",
"(",
"Field",
"field",
")",
"{",
"for",
"(",
"Entity",
"entity",
":",
"getWeaks",
"(",
")",
")",
"{",
"if",
"(",
"entity",
".",
"getOwner",
"(",
")",
".",
"getEntityProperty",
"(",
")",
".",
"equals",
"(",
"field",
".",
"getProperty",
"(",
")",
")",
")",
"{",
"return",
"entity",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Looks for the weak entity corresponding to the given field in this string
entity
@param field
@return the weak entity
|
[
"Looks",
"for",
"the",
"weak",
"entity",
"corresponding",
"to",
"the",
"given",
"field",
"in",
"this",
"string",
"entity"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java#L483-L490
|
150,463
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java
|
Entity.getHighlight
|
public Highlight getHighlight(Field field, Object instance) {
if (getHighlights() == null) {
return null;
}
return getHighlights().getHighlight(this, field, instance);
}
|
java
|
public Highlight getHighlight(Field field, Object instance) {
if (getHighlights() == null) {
return null;
}
return getHighlights().getHighlight(this, field, instance);
}
|
[
"public",
"Highlight",
"getHighlight",
"(",
"Field",
"field",
",",
"Object",
"instance",
")",
"{",
"if",
"(",
"getHighlights",
"(",
")",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"getHighlights",
"(",
")",
".",
"getHighlight",
"(",
"this",
",",
"field",
",",
"instance",
")",
";",
"}"
] |
Looks for an apropiate highlight for this field+instance
@param field
@param instance
@return the highlight
|
[
"Looks",
"for",
"an",
"apropiate",
"highlight",
"for",
"this",
"field",
"+",
"instance"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java#L556-L561
|
150,464
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java
|
Entity.getHighlights
|
public List<Highlight> getHighlights(Field field, Object instance) {
if (getHighlights() == null) {
return null;
}
return getHighlights().getHighlights(this, field, instance);
}
|
java
|
public List<Highlight> getHighlights(Field field, Object instance) {
if (getHighlights() == null) {
return null;
}
return getHighlights().getHighlights(this, field, instance);
}
|
[
"public",
"List",
"<",
"Highlight",
">",
"getHighlights",
"(",
"Field",
"field",
",",
"Object",
"instance",
")",
"{",
"if",
"(",
"getHighlights",
"(",
")",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"getHighlights",
"(",
")",
".",
"getHighlights",
"(",
"this",
",",
"field",
",",
"instance",
")",
";",
"}"
] |
Looks for all the apropiate highlight for this field+instance
@param field
@param instance
@return the highlight
|
[
"Looks",
"for",
"all",
"the",
"apropiate",
"highlight",
"for",
"this",
"field",
"+",
"instance"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java#L570-L575
|
150,465
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java
|
Entity.getTitle
|
public String getTitle() {
final String key = String.format("pm.entity.%s", getId());
final String message = pm.message(key);
if (key.equals(message)) {
if (getExtendzEntity() != null) {
return getExtendzEntity().getTitle();
}
}
return message;
}
|
java
|
public String getTitle() {
final String key = String.format("pm.entity.%s", getId());
final String message = pm.message(key);
if (key.equals(message)) {
if (getExtendzEntity() != null) {
return getExtendzEntity().getTitle();
}
}
return message;
}
|
[
"public",
"String",
"getTitle",
"(",
")",
"{",
"final",
"String",
"key",
"=",
"String",
".",
"format",
"(",
"\"pm.entity.%s\"",
",",
"getId",
"(",
")",
")",
";",
"final",
"String",
"message",
"=",
"pm",
".",
"message",
"(",
"key",
")",
";",
"if",
"(",
"key",
".",
"equals",
"(",
"message",
")",
")",
"{",
"if",
"(",
"getExtendzEntity",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"getExtendzEntity",
"(",
")",
".",
"getTitle",
"(",
")",
";",
"}",
"}",
"return",
"message",
";",
"}"
] |
Returns the internationalized entity title
|
[
"Returns",
"the",
"internationalized",
"entity",
"title"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java#L596-L605
|
150,466
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/tasks/drives/DriveOperationsSequence.java
|
DriveOperationsSequence.add
|
public void add(Operation operation) {
synchronized (operations) {
operations.addLast(operation);
if (waiting)
sp.unblock();
}
if (autoStart && operations.size() == 1 && getStatus() == Task.STATUS_NOT_STARTED)
start();
}
|
java
|
public void add(Operation operation) {
synchronized (operations) {
operations.addLast(operation);
if (waiting)
sp.unblock();
}
if (autoStart && operations.size() == 1 && getStatus() == Task.STATUS_NOT_STARTED)
start();
}
|
[
"public",
"void",
"add",
"(",
"Operation",
"operation",
")",
"{",
"synchronized",
"(",
"operations",
")",
"{",
"operations",
".",
"addLast",
"(",
"operation",
")",
";",
"if",
"(",
"waiting",
")",
"sp",
".",
"unblock",
"(",
")",
";",
"}",
"if",
"(",
"autoStart",
"&&",
"operations",
".",
"size",
"(",
")",
"==",
"1",
"&&",
"getStatus",
"(",
")",
"==",
"Task",
".",
"STATUS_NOT_STARTED",
")",
"start",
"(",
")",
";",
"}"
] |
Append an operation.
|
[
"Append",
"an",
"operation",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/tasks/drives/DriveOperationsSequence.java#L36-L44
|
150,467
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/menu/MenuItem.java
|
MenuItem.parseLocation
|
public void parseLocation(String location, String value) {
setLocationValue(value);
setLocation(PresentationManager.getPm().getLocation(location));
}
|
java
|
public void parseLocation(String location, String value) {
setLocationValue(value);
setLocation(PresentationManager.getPm().getLocation(location));
}
|
[
"public",
"void",
"parseLocation",
"(",
"String",
"location",
",",
"String",
"value",
")",
"{",
"setLocationValue",
"(",
"value",
")",
";",
"setLocation",
"(",
"PresentationManager",
".",
"getPm",
"(",
")",
".",
"getLocation",
"(",
"location",
")",
")",
";",
"}"
] |
Recover from the service the location object and set it and the value to
this item.
@param location The id to look into the conficuration file pm.locations.xml
@param value The location value
|
[
"Recover",
"from",
"the",
"service",
"the",
"location",
"object",
"and",
"set",
"it",
"and",
"the",
"value",
"to",
"this",
"item",
"."
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/menu/MenuItem.java#L60-L63
|
150,468
|
xebia-france/xebia-management-extras
|
src/main/java/fr/xebia/management/jms/leak/LeakDetectorConnectionFactory.java
|
LeakDetectorConnectionFactory.dumpAllOpenedResources
|
public List<String> dumpAllOpenedResources() {
List<String> dumps = new ArrayList<String>();
for (LeakDetectorConnection connection : openConnections) {
dumps.add(connection.dumpCreationContext(""));
for (LeakDetectorSession session : connection.getOpenSessions()) {
dumps.add(session.dumpCreationContext(" "));
for (LeakDetectorMessageProducer producer : session.getOpenMessageProducers()) {
dumps.add(producer.dumpCreationContext(" "));
}
for (LeakDetectorMessageConsumer consumer : session.getOpenMessageConsumers()) {
dumps.add(consumer.dumpCreationContext(" "));
}
}
}
return dumps;
}
|
java
|
public List<String> dumpAllOpenedResources() {
List<String> dumps = new ArrayList<String>();
for (LeakDetectorConnection connection : openConnections) {
dumps.add(connection.dumpCreationContext(""));
for (LeakDetectorSession session : connection.getOpenSessions()) {
dumps.add(session.dumpCreationContext(" "));
for (LeakDetectorMessageProducer producer : session.getOpenMessageProducers()) {
dumps.add(producer.dumpCreationContext(" "));
}
for (LeakDetectorMessageConsumer consumer : session.getOpenMessageConsumers()) {
dumps.add(consumer.dumpCreationContext(" "));
}
}
}
return dumps;
}
|
[
"public",
"List",
"<",
"String",
">",
"dumpAllOpenedResources",
"(",
")",
"{",
"List",
"<",
"String",
">",
"dumps",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"LeakDetectorConnection",
"connection",
":",
"openConnections",
")",
"{",
"dumps",
".",
"add",
"(",
"connection",
".",
"dumpCreationContext",
"(",
"\"\"",
")",
")",
";",
"for",
"(",
"LeakDetectorSession",
"session",
":",
"connection",
".",
"getOpenSessions",
"(",
")",
")",
"{",
"dumps",
".",
"add",
"(",
"session",
".",
"dumpCreationContext",
"(",
"\" \"",
")",
")",
";",
"for",
"(",
"LeakDetectorMessageProducer",
"producer",
":",
"session",
".",
"getOpenMessageProducers",
"(",
")",
")",
"{",
"dumps",
".",
"add",
"(",
"producer",
".",
"dumpCreationContext",
"(",
"\" \"",
")",
")",
";",
"}",
"for",
"(",
"LeakDetectorMessageConsumer",
"consumer",
":",
"session",
".",
"getOpenMessageConsumers",
"(",
")",
")",
"{",
"dumps",
".",
"add",
"(",
"consumer",
".",
"dumpCreationContext",
"(",
"\" \"",
")",
")",
";",
"}",
"}",
"}",
"return",
"dumps",
";",
"}"
] |
List all the currently opened connection, session, message producer,
message consumer
@return
|
[
"List",
"all",
"the",
"currently",
"opened",
"connection",
"session",
"message",
"producer",
"message",
"consumer"
] |
09f52a0ddb898e402a04f0adfacda74a5d0556e8
|
https://github.com/xebia-france/xebia-management-extras/blob/09f52a0ddb898e402a04f0adfacda74a5d0556e8/src/main/java/fr/xebia/management/jms/leak/LeakDetectorConnectionFactory.java#L81-L96
|
150,469
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/application/libraries/classloader/AppClassLoader.java
|
AppClassLoader.add
|
public AbstractClassLoader add(File location, Collection<String> exportedJars) {
AbstractClassLoader cl;
if (location.isDirectory())
cl = new DirectoryClassLoader(this, location);
else
cl = new ZipClassLoader(this, new FileIOProvider(location));
if (exportedJars != null)
for (String jar : exportedJars)
cl.addSubLoader(new ZipClassLoader(this, new InnerJARProvider(cl, jar)));
synchronized (libs) {
libs.add(cl);
}
return cl;
}
|
java
|
public AbstractClassLoader add(File location, Collection<String> exportedJars) {
AbstractClassLoader cl;
if (location.isDirectory())
cl = new DirectoryClassLoader(this, location);
else
cl = new ZipClassLoader(this, new FileIOProvider(location));
if (exportedJars != null)
for (String jar : exportedJars)
cl.addSubLoader(new ZipClassLoader(this, new InnerJARProvider(cl, jar)));
synchronized (libs) {
libs.add(cl);
}
return cl;
}
|
[
"public",
"AbstractClassLoader",
"add",
"(",
"File",
"location",
",",
"Collection",
"<",
"String",
">",
"exportedJars",
")",
"{",
"AbstractClassLoader",
"cl",
";",
"if",
"(",
"location",
".",
"isDirectory",
"(",
")",
")",
"cl",
"=",
"new",
"DirectoryClassLoader",
"(",
"this",
",",
"location",
")",
";",
"else",
"cl",
"=",
"new",
"ZipClassLoader",
"(",
"this",
",",
"new",
"FileIOProvider",
"(",
"location",
")",
")",
";",
"if",
"(",
"exportedJars",
"!=",
"null",
")",
"for",
"(",
"String",
"jar",
":",
"exportedJars",
")",
"cl",
".",
"addSubLoader",
"(",
"new",
"ZipClassLoader",
"(",
"this",
",",
"new",
"InnerJARProvider",
"(",
"cl",
",",
"jar",
")",
")",
")",
";",
"synchronized",
"(",
"libs",
")",
"{",
"libs",
".",
"add",
"(",
"cl",
")",
";",
"}",
"return",
"cl",
";",
"}"
] |
Add a library.
|
[
"Add",
"a",
"library",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/application/libraries/classloader/AppClassLoader.java#L47-L60
|
150,470
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/application/libraries/classloader/AppClassLoader.java
|
AppClassLoader.getResourceURL
|
public URL getResourceURL(String name) {
if (name.length() == 0) return null;
if (name.charAt(0) == '/') name = name.substring(1);
for (int i = 0; i < libs.size(); i++) {
AbstractClassLoader cl = libs.get(i);
URL url = cl.loadResourceURL(name);
if (url != null) return url;
}
// then try on the core one
return AppClassLoader.class.getClassLoader().getResource(name);
}
|
java
|
public URL getResourceURL(String name) {
if (name.length() == 0) return null;
if (name.charAt(0) == '/') name = name.substring(1);
for (int i = 0; i < libs.size(); i++) {
AbstractClassLoader cl = libs.get(i);
URL url = cl.loadResourceURL(name);
if (url != null) return url;
}
// then try on the core one
return AppClassLoader.class.getClassLoader().getResource(name);
}
|
[
"public",
"URL",
"getResourceURL",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"name",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"null",
";",
"if",
"(",
"name",
".",
"charAt",
"(",
"0",
")",
"==",
"'",
"'",
")",
"name",
"=",
"name",
".",
"substring",
"(",
"1",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"libs",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"AbstractClassLoader",
"cl",
"=",
"libs",
".",
"get",
"(",
"i",
")",
";",
"URL",
"url",
"=",
"cl",
".",
"loadResourceURL",
"(",
"name",
")",
";",
"if",
"(",
"url",
"!=",
"null",
")",
"return",
"url",
";",
"}",
"// then try on the core one\r",
"return",
"AppClassLoader",
".",
"class",
".",
"getClassLoader",
"(",
")",
".",
"getResource",
"(",
"name",
")",
";",
"}"
] |
Search a resource.
|
[
"Search",
"a",
"resource",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/application/libraries/classloader/AppClassLoader.java#L146-L156
|
150,471
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/application/libraries/classloader/AppClassLoader.java
|
AppClassLoader.getResourceAsStreamFrom
|
@SuppressWarnings("resource")
public InputStream getResourceAsStreamFrom(String name, AbstractClassLoader first) {
if (name.length() == 0) return null;
if (name.charAt(0) == '/') name = name.substring(1);
IO.Readable io = null;
// try with the first one
if (first != null)
try { io = first.open(name, Task.PRIORITY_RATHER_IMPORTANT); }
catch (IOException e) { /* not there */ }
// then, try on other libraries
if (io == null) {
for (int i = 0; i < libs.size(); i++) {
AbstractClassLoader cl = libs.get(i);
if (cl == first) continue;
try { io = cl.open(name, Task.PRIORITY_RATHER_IMPORTANT); }
catch (IOException e) { /* not there */ }
if (io != null) break;
}
}
if (io != null)
return IOAsInputStream.get(io, true);
// then try on the core one
return AppClassLoader.class.getClassLoader().getResourceAsStream(name);
}
|
java
|
@SuppressWarnings("resource")
public InputStream getResourceAsStreamFrom(String name, AbstractClassLoader first) {
if (name.length() == 0) return null;
if (name.charAt(0) == '/') name = name.substring(1);
IO.Readable io = null;
// try with the first one
if (first != null)
try { io = first.open(name, Task.PRIORITY_RATHER_IMPORTANT); }
catch (IOException e) { /* not there */ }
// then, try on other libraries
if (io == null) {
for (int i = 0; i < libs.size(); i++) {
AbstractClassLoader cl = libs.get(i);
if (cl == first) continue;
try { io = cl.open(name, Task.PRIORITY_RATHER_IMPORTANT); }
catch (IOException e) { /* not there */ }
if (io != null) break;
}
}
if (io != null)
return IOAsInputStream.get(io, true);
// then try on the core one
return AppClassLoader.class.getClassLoader().getResourceAsStream(name);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"resource\"",
")",
"public",
"InputStream",
"getResourceAsStreamFrom",
"(",
"String",
"name",
",",
"AbstractClassLoader",
"first",
")",
"{",
"if",
"(",
"name",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"null",
";",
"if",
"(",
"name",
".",
"charAt",
"(",
"0",
")",
"==",
"'",
"'",
")",
"name",
"=",
"name",
".",
"substring",
"(",
"1",
")",
";",
"IO",
".",
"Readable",
"io",
"=",
"null",
";",
"// try with the first one\r",
"if",
"(",
"first",
"!=",
"null",
")",
"try",
"{",
"io",
"=",
"first",
".",
"open",
"(",
"name",
",",
"Task",
".",
"PRIORITY_RATHER_IMPORTANT",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"/* not there */",
"}",
"// then, try on other libraries\r",
"if",
"(",
"io",
"==",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"libs",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"AbstractClassLoader",
"cl",
"=",
"libs",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"cl",
"==",
"first",
")",
"continue",
";",
"try",
"{",
"io",
"=",
"cl",
".",
"open",
"(",
"name",
",",
"Task",
".",
"PRIORITY_RATHER_IMPORTANT",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"/* not there */",
"}",
"if",
"(",
"io",
"!=",
"null",
")",
"break",
";",
"}",
"}",
"if",
"(",
"io",
"!=",
"null",
")",
"return",
"IOAsInputStream",
".",
"get",
"(",
"io",
",",
"true",
")",
";",
"// then try on the core one\r",
"return",
"AppClassLoader",
".",
"class",
".",
"getClassLoader",
"(",
")",
".",
"getResourceAsStream",
"(",
"name",
")",
";",
"}"
] |
Load a resource, looking first into the given library.
|
[
"Load",
"a",
"resource",
"looking",
"first",
"into",
"the",
"given",
"library",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/application/libraries/classloader/AppClassLoader.java#L159-L182
|
150,472
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/application/libraries/classloader/AppClassLoader.java
|
AppClassLoader.getResourceFrom
|
public URL getResourceFrom(String name, AbstractClassLoader first) {
if (name.length() == 0) return null;
if (name.charAt(0) == '/') name = name.substring(1);
URL url = null;
// try with the first one
if (first != null)
url = first.getResourceURL(name);
// then, try on other libraries
if (url == null) {
for (int i = 0; i < libs.size(); i++) {
AbstractClassLoader cl = libs.get(i);
if (cl == first) continue;
url = cl.getResourceURL(name);
if (url != null) break;
}
}
if (url == null)
url = AppClassLoader.class.getClassLoader().getResource(name);
return url;
}
|
java
|
public URL getResourceFrom(String name, AbstractClassLoader first) {
if (name.length() == 0) return null;
if (name.charAt(0) == '/') name = name.substring(1);
URL url = null;
// try with the first one
if (first != null)
url = first.getResourceURL(name);
// then, try on other libraries
if (url == null) {
for (int i = 0; i < libs.size(); i++) {
AbstractClassLoader cl = libs.get(i);
if (cl == first) continue;
url = cl.getResourceURL(name);
if (url != null) break;
}
}
if (url == null)
url = AppClassLoader.class.getClassLoader().getResource(name);
return url;
}
|
[
"public",
"URL",
"getResourceFrom",
"(",
"String",
"name",
",",
"AbstractClassLoader",
"first",
")",
"{",
"if",
"(",
"name",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"null",
";",
"if",
"(",
"name",
".",
"charAt",
"(",
"0",
")",
"==",
"'",
"'",
")",
"name",
"=",
"name",
".",
"substring",
"(",
"1",
")",
";",
"URL",
"url",
"=",
"null",
";",
"// try with the first one\r",
"if",
"(",
"first",
"!=",
"null",
")",
"url",
"=",
"first",
".",
"getResourceURL",
"(",
"name",
")",
";",
"// then, try on other libraries\r",
"if",
"(",
"url",
"==",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"libs",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"AbstractClassLoader",
"cl",
"=",
"libs",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"cl",
"==",
"first",
")",
"continue",
";",
"url",
"=",
"cl",
".",
"getResourceURL",
"(",
"name",
")",
";",
"if",
"(",
"url",
"!=",
"null",
")",
"break",
";",
"}",
"}",
"if",
"(",
"url",
"==",
"null",
")",
"url",
"=",
"AppClassLoader",
".",
"class",
".",
"getClassLoader",
"(",
")",
".",
"getResource",
"(",
"name",
")",
";",
"return",
"url",
";",
"}"
] |
Search a resource, looking first into the given library.
|
[
"Search",
"a",
"resource",
"looking",
"first",
"into",
"the",
"given",
"library",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/application/libraries/classloader/AppClassLoader.java#L185-L204
|
150,473
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/application/libraries/classloader/AppClassLoader.java
|
AppClassLoader.getResources
|
public Enumeration<URL> getResources(String name) throws IOException {
if (name.length() == 0) return null;
if (name.charAt(0) == '/') name = name.substring(1);
CompoundCollection<URL> list = new CompoundCollection<>();
for (int i = 0; i < libs.size(); i++) {
AbstractClassLoader cl = libs.get(i);
Iterable<URL> urls = cl.getResourcesURL(name);
if (urls != null) list.add(urls);
}
list.add(AppClassLoader.class.getClassLoader().getResources(name));
return list.enumeration();
}
|
java
|
public Enumeration<URL> getResources(String name) throws IOException {
if (name.length() == 0) return null;
if (name.charAt(0) == '/') name = name.substring(1);
CompoundCollection<URL> list = new CompoundCollection<>();
for (int i = 0; i < libs.size(); i++) {
AbstractClassLoader cl = libs.get(i);
Iterable<URL> urls = cl.getResourcesURL(name);
if (urls != null) list.add(urls);
}
list.add(AppClassLoader.class.getClassLoader().getResources(name));
return list.enumeration();
}
|
[
"public",
"Enumeration",
"<",
"URL",
">",
"getResources",
"(",
"String",
"name",
")",
"throws",
"IOException",
"{",
"if",
"(",
"name",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"null",
";",
"if",
"(",
"name",
".",
"charAt",
"(",
"0",
")",
"==",
"'",
"'",
")",
"name",
"=",
"name",
".",
"substring",
"(",
"1",
")",
";",
"CompoundCollection",
"<",
"URL",
">",
"list",
"=",
"new",
"CompoundCollection",
"<>",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"libs",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"AbstractClassLoader",
"cl",
"=",
"libs",
".",
"get",
"(",
"i",
")",
";",
"Iterable",
"<",
"URL",
">",
"urls",
"=",
"cl",
".",
"getResourcesURL",
"(",
"name",
")",
";",
"if",
"(",
"urls",
"!=",
"null",
")",
"list",
".",
"add",
"(",
"urls",
")",
";",
"}",
"list",
".",
"add",
"(",
"AppClassLoader",
".",
"class",
".",
"getClassLoader",
"(",
")",
".",
"getResources",
"(",
"name",
")",
")",
";",
"return",
"list",
".",
"enumeration",
"(",
")",
";",
"}"
] |
Search for resources.
|
[
"Search",
"for",
"resources",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/application/libraries/classloader/AppClassLoader.java#L207-L218
|
150,474
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/application/libraries/classloader/AppClassLoader.java
|
AppClassLoader.scanLibraries
|
public void scanLibraries(
String rootPackage, boolean includeSubPackages,
Filter<String> packageFilter, Filter<String> classFilter, Listener<Class<?>> classScanner
) {
for (AbstractClassLoader cl : libs)
cl.scan(rootPackage, includeSubPackages, packageFilter, classFilter, classScanner);
}
|
java
|
public void scanLibraries(
String rootPackage, boolean includeSubPackages,
Filter<String> packageFilter, Filter<String> classFilter, Listener<Class<?>> classScanner
) {
for (AbstractClassLoader cl : libs)
cl.scan(rootPackage, includeSubPackages, packageFilter, classFilter, classScanner);
}
|
[
"public",
"void",
"scanLibraries",
"(",
"String",
"rootPackage",
",",
"boolean",
"includeSubPackages",
",",
"Filter",
"<",
"String",
">",
"packageFilter",
",",
"Filter",
"<",
"String",
">",
"classFilter",
",",
"Listener",
"<",
"Class",
"<",
"?",
">",
">",
"classScanner",
")",
"{",
"for",
"(",
"AbstractClassLoader",
"cl",
":",
"libs",
")",
"cl",
".",
"scan",
"(",
"rootPackage",
",",
"includeSubPackages",
",",
"packageFilter",
",",
"classFilter",
",",
"classScanner",
")",
";",
"}"
] |
Scan libraries to find classes.
|
[
"Scan",
"libraries",
"to",
"find",
"classes",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/application/libraries/classloader/AppClassLoader.java#L259-L265
|
150,475
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/io/text/Decoder.java
|
Decoder.get
|
public static Decoder get(Charset charset) throws Exception {
Class<? extends Decoder> cl = decoders.get(charset.name());
if (cl == null) {
CharsetDecoder decoder = charset.newDecoder();
decoder.onMalformedInput(CodingErrorAction.REPLACE);
decoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
return new DefaultDecoder(decoder);
}
return cl.newInstance();
}
|
java
|
public static Decoder get(Charset charset) throws Exception {
Class<? extends Decoder> cl = decoders.get(charset.name());
if (cl == null) {
CharsetDecoder decoder = charset.newDecoder();
decoder.onMalformedInput(CodingErrorAction.REPLACE);
decoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
return new DefaultDecoder(decoder);
}
return cl.newInstance();
}
|
[
"public",
"static",
"Decoder",
"get",
"(",
"Charset",
"charset",
")",
"throws",
"Exception",
"{",
"Class",
"<",
"?",
"extends",
"Decoder",
">",
"cl",
"=",
"decoders",
".",
"get",
"(",
"charset",
".",
"name",
"(",
")",
")",
";",
"if",
"(",
"cl",
"==",
"null",
")",
"{",
"CharsetDecoder",
"decoder",
"=",
"charset",
".",
"newDecoder",
"(",
")",
";",
"decoder",
".",
"onMalformedInput",
"(",
"CodingErrorAction",
".",
"REPLACE",
")",
";",
"decoder",
".",
"onUnmappableCharacter",
"(",
"CodingErrorAction",
".",
"REPLACE",
")",
";",
"return",
"new",
"DefaultDecoder",
"(",
"decoder",
")",
";",
"}",
"return",
"cl",
".",
"newInstance",
"(",
")",
";",
"}"
] |
Get a decoder for the given charset.
|
[
"Get",
"a",
"decoder",
"for",
"the",
"given",
"charset",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/io/text/Decoder.java#L25-L34
|
150,476
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/io/text/Decoder.java
|
Decoder.register
|
public static void register(Charset charset, Class<? extends Decoder> decoder) {
decoders.put(charset.name(), decoder);
}
|
java
|
public static void register(Charset charset, Class<? extends Decoder> decoder) {
decoders.put(charset.name(), decoder);
}
|
[
"public",
"static",
"void",
"register",
"(",
"Charset",
"charset",
",",
"Class",
"<",
"?",
"extends",
"Decoder",
">",
"decoder",
")",
"{",
"decoders",
".",
"put",
"(",
"charset",
".",
"name",
"(",
")",
",",
"decoder",
")",
";",
"}"
] |
Register a decoder implementation.
|
[
"Register",
"a",
"decoder",
"implementation",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/io/text/Decoder.java#L37-L39
|
150,477
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/io/text/Decoder.java
|
Decoder.setInput
|
public void setInput(IO.Readable.Buffered io) {
this.io = io;
this.nextBuffer = io.readNextBufferAsync();
}
|
java
|
public void setInput(IO.Readable.Buffered io) {
this.io = io;
this.nextBuffer = io.readNextBufferAsync();
}
|
[
"public",
"void",
"setInput",
"(",
"IO",
".",
"Readable",
".",
"Buffered",
"io",
")",
"{",
"this",
".",
"io",
"=",
"io",
";",
"this",
".",
"nextBuffer",
"=",
"io",
".",
"readNextBufferAsync",
"(",
")",
";",
"}"
] |
Set readable IO to decode.
|
[
"Set",
"readable",
"IO",
"to",
"decode",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/io/text/Decoder.java#L58-L61
|
150,478
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/io/text/Decoder.java
|
Decoder.transferTo
|
public void transferTo(Decoder newDecoder) {
newDecoder.io = io;
newDecoder.nextBuffer = nextBuffer;
newDecoder.currentBuffer = currentBuffer;
}
|
java
|
public void transferTo(Decoder newDecoder) {
newDecoder.io = io;
newDecoder.nextBuffer = nextBuffer;
newDecoder.currentBuffer = currentBuffer;
}
|
[
"public",
"void",
"transferTo",
"(",
"Decoder",
"newDecoder",
")",
"{",
"newDecoder",
".",
"io",
"=",
"io",
";",
"newDecoder",
".",
"nextBuffer",
"=",
"nextBuffer",
";",
"newDecoder",
".",
"currentBuffer",
"=",
"currentBuffer",
";",
"}"
] |
Change charset by transfering the current state of this decoder to the new one.
|
[
"Change",
"charset",
"by",
"transfering",
"the",
"current",
"state",
"of",
"this",
"decoder",
"to",
"the",
"new",
"one",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/io/text/Decoder.java#L64-L68
|
150,479
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/io/text/Decoder.java
|
Decoder.decode
|
public int decode(char[] chars, int pos, int len, MutableBoolean interrupt, int min) throws IOException, CancelException {
if (min > len) min = len;
int nb = 0;
do {
if (currentBuffer == null) {
if (nextBuffer.isUnblocked())
currentBuffer = nextBuffer.blockResult(0);
else
return nb > 0 ? nb : -2;
if (currentBuffer != null)
nextBuffer = io.readNextBufferAsync();
}
int decoded = decode(currentBuffer, chars, pos + nb, len - nb, interrupt, min - nb);
if (decoded < 0 || (decoded == 0 && currentBuffer == null))
return nb > 0 ? nb : -1;
nb += decoded;
if (currentBuffer != null && !currentBuffer.hasRemaining())
currentBuffer = null;
if (nb == len)
return nb;
if (nb >= min && interrupt.get())
return nb;
} while (true);
}
|
java
|
public int decode(char[] chars, int pos, int len, MutableBoolean interrupt, int min) throws IOException, CancelException {
if (min > len) min = len;
int nb = 0;
do {
if (currentBuffer == null) {
if (nextBuffer.isUnblocked())
currentBuffer = nextBuffer.blockResult(0);
else
return nb > 0 ? nb : -2;
if (currentBuffer != null)
nextBuffer = io.readNextBufferAsync();
}
int decoded = decode(currentBuffer, chars, pos + nb, len - nb, interrupt, min - nb);
if (decoded < 0 || (decoded == 0 && currentBuffer == null))
return nb > 0 ? nb : -1;
nb += decoded;
if (currentBuffer != null && !currentBuffer.hasRemaining())
currentBuffer = null;
if (nb == len)
return nb;
if (nb >= min && interrupt.get())
return nb;
} while (true);
}
|
[
"public",
"int",
"decode",
"(",
"char",
"[",
"]",
"chars",
",",
"int",
"pos",
",",
"int",
"len",
",",
"MutableBoolean",
"interrupt",
",",
"int",
"min",
")",
"throws",
"IOException",
",",
"CancelException",
"{",
"if",
"(",
"min",
">",
"len",
")",
"min",
"=",
"len",
";",
"int",
"nb",
"=",
"0",
";",
"do",
"{",
"if",
"(",
"currentBuffer",
"==",
"null",
")",
"{",
"if",
"(",
"nextBuffer",
".",
"isUnblocked",
"(",
")",
")",
"currentBuffer",
"=",
"nextBuffer",
".",
"blockResult",
"(",
"0",
")",
";",
"else",
"return",
"nb",
">",
"0",
"?",
"nb",
":",
"-",
"2",
";",
"if",
"(",
"currentBuffer",
"!=",
"null",
")",
"nextBuffer",
"=",
"io",
".",
"readNextBufferAsync",
"(",
")",
";",
"}",
"int",
"decoded",
"=",
"decode",
"(",
"currentBuffer",
",",
"chars",
",",
"pos",
"+",
"nb",
",",
"len",
"-",
"nb",
",",
"interrupt",
",",
"min",
"-",
"nb",
")",
";",
"if",
"(",
"decoded",
"<",
"0",
"||",
"(",
"decoded",
"==",
"0",
"&&",
"currentBuffer",
"==",
"null",
")",
")",
"return",
"nb",
">",
"0",
"?",
"nb",
":",
"-",
"1",
";",
"nb",
"+=",
"decoded",
";",
"if",
"(",
"currentBuffer",
"!=",
"null",
"&&",
"!",
"currentBuffer",
".",
"hasRemaining",
"(",
")",
")",
"currentBuffer",
"=",
"null",
";",
"if",
"(",
"nb",
"==",
"len",
")",
"return",
"nb",
";",
"if",
"(",
"nb",
">=",
"min",
"&&",
"interrupt",
".",
"get",
"(",
")",
")",
"return",
"nb",
";",
"}",
"while",
"(",
"true",
")",
";",
"}"
] |
Decode characters from the IO.
@param chars array to fill
@param pos offset in the array to fill
@param len maximum number of characters to fill
@param interrupt when true, the decoding will stop as soon as possible
@param min minimum number of characters to fill, regardless of the interrupt value
@return number of decoded characters, -1 if no more characters can be decoded, -2 if we need to wait for next buffer from the IO
@throws IOException error reading from IO
@throws CancelException IO has been cancelled
|
[
"Decode",
"characters",
"from",
"the",
"IO",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/io/text/Decoder.java#L91-L114
|
150,480
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/io/text/Decoder.java
|
Decoder.decode
|
public int decode(ByteBuffer b, char[] chars, int pos, int len) {
if (io != null)
throw new IllegalStateException();
return decode(b, chars, pos, len, null, 1);
}
|
java
|
public int decode(ByteBuffer b, char[] chars, int pos, int len) {
if (io != null)
throw new IllegalStateException();
return decode(b, chars, pos, len, null, 1);
}
|
[
"public",
"int",
"decode",
"(",
"ByteBuffer",
"b",
",",
"char",
"[",
"]",
"chars",
",",
"int",
"pos",
",",
"int",
"len",
")",
"{",
"if",
"(",
"io",
"!=",
"null",
")",
"throw",
"new",
"IllegalStateException",
"(",
")",
";",
"return",
"decode",
"(",
"b",
",",
"chars",
",",
"pos",
",",
"len",
",",
"null",
",",
"1",
")",
";",
"}"
] |
Decode characters without IO.
|
[
"Decode",
"characters",
"without",
"IO",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/io/text/Decoder.java#L117-L121
|
150,481
|
xfcjscn/sudoor-server-lib
|
src/main/java/net/gplatform/sudoor/server/cors/StringManager.java
|
StringManager.getString
|
public String getString(String key) {
if(key == null){
String msg = "key may not have a null value";
throw new IllegalArgumentException(msg);
}
String str = null;
try {
// Avoid NPE if bundle is null and treat it like an MRE
if (bundle != null) {
str = bundle.getString(key);
}
} catch(MissingResourceException mre) {
//bad: shouldn't mask an exception the following way:
// str = "[cannot find message associated with key '" + key +
// "' due to " + mre + "]";
// because it hides the fact that the String was missing
// from the calling code.
//good: could just throw the exception (or wrap it in another)
// but that would probably cause much havoc on existing
// code.
//better: consistent with container pattern to
// simply return null. Calling code can then do
// a null check.
str = null;
}
return str;
}
|
java
|
public String getString(String key) {
if(key == null){
String msg = "key may not have a null value";
throw new IllegalArgumentException(msg);
}
String str = null;
try {
// Avoid NPE if bundle is null and treat it like an MRE
if (bundle != null) {
str = bundle.getString(key);
}
} catch(MissingResourceException mre) {
//bad: shouldn't mask an exception the following way:
// str = "[cannot find message associated with key '" + key +
// "' due to " + mre + "]";
// because it hides the fact that the String was missing
// from the calling code.
//good: could just throw the exception (or wrap it in another)
// but that would probably cause much havoc on existing
// code.
//better: consistent with container pattern to
// simply return null. Calling code can then do
// a null check.
str = null;
}
return str;
}
|
[
"public",
"String",
"getString",
"(",
"String",
"key",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"String",
"msg",
"=",
"\"key may not have a null value\"",
";",
"throw",
"new",
"IllegalArgumentException",
"(",
"msg",
")",
";",
"}",
"String",
"str",
"=",
"null",
";",
"try",
"{",
"// Avoid NPE if bundle is null and treat it like an MRE\r",
"if",
"(",
"bundle",
"!=",
"null",
")",
"{",
"str",
"=",
"bundle",
".",
"getString",
"(",
"key",
")",
";",
"}",
"}",
"catch",
"(",
"MissingResourceException",
"mre",
")",
"{",
"//bad: shouldn't mask an exception the following way:\r",
"// str = \"[cannot find message associated with key '\" + key +\r",
"// \"' due to \" + mre + \"]\";\r",
"// because it hides the fact that the String was missing\r",
"// from the calling code.\r",
"//good: could just throw the exception (or wrap it in another)\r",
"// but that would probably cause much havoc on existing\r",
"// code.\r",
"//better: consistent with container pattern to\r",
"// simply return null. Calling code can then do\r",
"// a null check.\r",
"str",
"=",
"null",
";",
"}",
"return",
"str",
";",
"}"
] |
Get a string from the underlying resource bundle or return
null if the String is not found.
@param key to desired resource String
@return resource String matching <i>key</i> from underlying
bundle or null if not found.
@throws IllegalArgumentException if <i>key</i> is null.
|
[
"Get",
"a",
"string",
"from",
"the",
"underlying",
"resource",
"bundle",
"or",
"return",
"null",
"if",
"the",
"String",
"is",
"not",
"found",
"."
] |
37dc1996eaa9cad25c82abd1de315ba565e32097
|
https://github.com/xfcjscn/sudoor-server-lib/blob/37dc1996eaa9cad25c82abd1de315ba565e32097/src/main/java/net/gplatform/sudoor/server/cors/StringManager.java#L138-L168
|
150,482
|
xfcjscn/sudoor-server-lib
|
src/main/java/net/gplatform/sudoor/server/cors/StringManager.java
|
StringManager.getManager
|
public static StringManager getManager(String packageName,
Enumeration<Locale> requestedLocales) {
while (requestedLocales.hasMoreElements()) {
Locale locale = requestedLocales.nextElement();
StringManager result = getManager(packageName, locale);
if (result.getLocale().equals(locale)) {
return result;
}
}
// Return the default
return getManager(packageName);
}
|
java
|
public static StringManager getManager(String packageName,
Enumeration<Locale> requestedLocales) {
while (requestedLocales.hasMoreElements()) {
Locale locale = requestedLocales.nextElement();
StringManager result = getManager(packageName, locale);
if (result.getLocale().equals(locale)) {
return result;
}
}
// Return the default
return getManager(packageName);
}
|
[
"public",
"static",
"StringManager",
"getManager",
"(",
"String",
"packageName",
",",
"Enumeration",
"<",
"Locale",
">",
"requestedLocales",
")",
"{",
"while",
"(",
"requestedLocales",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"Locale",
"locale",
"=",
"requestedLocales",
".",
"nextElement",
"(",
")",
";",
"StringManager",
"result",
"=",
"getManager",
"(",
"packageName",
",",
"locale",
")",
";",
"if",
"(",
"result",
".",
"getLocale",
"(",
")",
".",
"equals",
"(",
"locale",
")",
")",
"{",
"return",
"result",
";",
"}",
"}",
"// Return the default\r",
"return",
"getManager",
"(",
"packageName",
")",
";",
"}"
] |
Retrieve the StringManager for a list of Locales. The first StringManager
found will be returned.
@param requestedLocales the list of Locales
@return the found StringManager or the default StringManager
|
[
"Retrieve",
"the",
"StringManager",
"for",
"a",
"list",
"of",
"Locales",
".",
"The",
"first",
"StringManager",
"found",
"will",
"be",
"returned",
"."
] |
37dc1996eaa9cad25c82abd1de315ba565e32097
|
https://github.com/xfcjscn/sudoor-server-lib/blob/37dc1996eaa9cad25c82abd1de315ba565e32097/src/main/java/net/gplatform/sudoor/server/cors/StringManager.java#L265-L276
|
150,483
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/io/IOWritePool.java
|
IOWritePool.write
|
public void write(ByteBuffer buffer) throws IOException {
synchronized (buffers) {
if (writing == null) {
writing = io.writeAsync(buffer);
writing.listenInline(listener);
return;
}
if (writing.hasError()) throw writing.getError();
buffers.add(buffer);
}
}
|
java
|
public void write(ByteBuffer buffer) throws IOException {
synchronized (buffers) {
if (writing == null) {
writing = io.writeAsync(buffer);
writing.listenInline(listener);
return;
}
if (writing.hasError()) throw writing.getError();
buffers.add(buffer);
}
}
|
[
"public",
"void",
"write",
"(",
"ByteBuffer",
"buffer",
")",
"throws",
"IOException",
"{",
"synchronized",
"(",
"buffers",
")",
"{",
"if",
"(",
"writing",
"==",
"null",
")",
"{",
"writing",
"=",
"io",
".",
"writeAsync",
"(",
"buffer",
")",
";",
"writing",
".",
"listenInline",
"(",
"listener",
")",
";",
"return",
";",
"}",
"if",
"(",
"writing",
".",
"hasError",
"(",
")",
")",
"throw",
"writing",
".",
"getError",
"(",
")",
";",
"buffers",
".",
"add",
"(",
"buffer",
")",
";",
"}",
"}"
] |
Write the given buffer.
|
[
"Write",
"the",
"given",
"buffer",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/io/IOWritePool.java#L36-L46
|
150,484
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/io/IOWritePool.java
|
IOWritePool.onDone
|
public SynchronizationPoint<IOException> onDone() {
synchronized (buffers) {
if (writing == null) return new SynchronizationPoint<>(true);
if (writing.hasError()) return new SynchronizationPoint<IOException>(writing.getError());
if (writing.isCancelled()) return new SynchronizationPoint<IOException>(writing.getCancelEvent());
if (waitDone == null) waitDone = new SynchronizationPoint<>();
}
return waitDone;
}
|
java
|
public SynchronizationPoint<IOException> onDone() {
synchronized (buffers) {
if (writing == null) return new SynchronizationPoint<>(true);
if (writing.hasError()) return new SynchronizationPoint<IOException>(writing.getError());
if (writing.isCancelled()) return new SynchronizationPoint<IOException>(writing.getCancelEvent());
if (waitDone == null) waitDone = new SynchronizationPoint<>();
}
return waitDone;
}
|
[
"public",
"SynchronizationPoint",
"<",
"IOException",
">",
"onDone",
"(",
")",
"{",
"synchronized",
"(",
"buffers",
")",
"{",
"if",
"(",
"writing",
"==",
"null",
")",
"return",
"new",
"SynchronizationPoint",
"<>",
"(",
"true",
")",
";",
"if",
"(",
"writing",
".",
"hasError",
"(",
")",
")",
"return",
"new",
"SynchronizationPoint",
"<",
"IOException",
">",
"(",
"writing",
".",
"getError",
"(",
")",
")",
";",
"if",
"(",
"writing",
".",
"isCancelled",
"(",
")",
")",
"return",
"new",
"SynchronizationPoint",
"<",
"IOException",
">",
"(",
"writing",
".",
"getCancelEvent",
"(",
")",
")",
";",
"if",
"(",
"waitDone",
"==",
"null",
")",
"waitDone",
"=",
"new",
"SynchronizationPoint",
"<>",
"(",
")",
";",
"}",
"return",
"waitDone",
";",
"}"
] |
Must be called once all write operations have been done, and only one time.
|
[
"Must",
"be",
"called",
"once",
"all",
"write",
"operations",
"have",
"been",
"done",
"and",
"only",
"one",
"time",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/io/IOWritePool.java#L51-L59
|
150,485
|
mgledi/DRUMS
|
src/main/java/com/unister/semweb/drums/bucket/hashfunction/RangeHashFunction.java
|
RangeHashFunction.sort
|
private void sort() {
RangeHashSorter sortMachine;
sortMachine = new RangeHashSorter(maxRangeValues, filenames);
sortMachine.quickSort();
generateBucketIds();
}
|
java
|
private void sort() {
RangeHashSorter sortMachine;
sortMachine = new RangeHashSorter(maxRangeValues, filenames);
sortMachine.quickSort();
generateBucketIds();
}
|
[
"private",
"void",
"sort",
"(",
")",
"{",
"RangeHashSorter",
"sortMachine",
";",
"sortMachine",
"=",
"new",
"RangeHashSorter",
"(",
"maxRangeValues",
",",
"filenames",
")",
";",
"sortMachine",
".",
"quickSort",
"(",
")",
";",
"generateBucketIds",
"(",
")",
";",
"}"
] |
Sorts the max range values corresponding to the file names and the bucket sizes.
|
[
"Sorts",
"the",
"max",
"range",
"values",
"corresponding",
"to",
"the",
"file",
"names",
"and",
"the",
"bucket",
"sizes",
"."
] |
a670f17a2186c9a15725f26617d77ce8e444e072
|
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/bucket/hashfunction/RangeHashFunction.java#L127-L132
|
150,486
|
mgledi/DRUMS
|
src/main/java/com/unister/semweb/drums/bucket/hashfunction/RangeHashFunction.java
|
RangeHashFunction.generateBucketIds
|
private void generateBucketIds() {
// generate indexes for buckets, needed if two different ranges belong to the same file
this.buckets = 0;
bucketIds = new int[filenames.length];
HashMap<String, Integer> tmpSeenFilenames = new HashMap<String, Integer>();
for (int i = 0; i < filenames.length; i++) {
if (!tmpSeenFilenames.containsKey(filenames[i])) {
tmpSeenFilenames.put(filenames[i], this.buckets++);
}
bucketIds[i] = tmpSeenFilenames.get(filenames[i]);
}
this.buckets = bucketIds.length;
}
|
java
|
private void generateBucketIds() {
// generate indexes for buckets, needed if two different ranges belong to the same file
this.buckets = 0;
bucketIds = new int[filenames.length];
HashMap<String, Integer> tmpSeenFilenames = new HashMap<String, Integer>();
for (int i = 0; i < filenames.length; i++) {
if (!tmpSeenFilenames.containsKey(filenames[i])) {
tmpSeenFilenames.put(filenames[i], this.buckets++);
}
bucketIds[i] = tmpSeenFilenames.get(filenames[i]);
}
this.buckets = bucketIds.length;
}
|
[
"private",
"void",
"generateBucketIds",
"(",
")",
"{",
"// generate indexes for buckets, needed if two different ranges belong to the same file",
"this",
".",
"buckets",
"=",
"0",
";",
"bucketIds",
"=",
"new",
"int",
"[",
"filenames",
".",
"length",
"]",
";",
"HashMap",
"<",
"String",
",",
"Integer",
">",
"tmpSeenFilenames",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Integer",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"filenames",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"tmpSeenFilenames",
".",
"containsKey",
"(",
"filenames",
"[",
"i",
"]",
")",
")",
"{",
"tmpSeenFilenames",
".",
"put",
"(",
"filenames",
"[",
"i",
"]",
",",
"this",
".",
"buckets",
"++",
")",
";",
"}",
"bucketIds",
"[",
"i",
"]",
"=",
"tmpSeenFilenames",
".",
"get",
"(",
"filenames",
"[",
"i",
"]",
")",
";",
"}",
"this",
".",
"buckets",
"=",
"bucketIds",
".",
"length",
";",
"}"
] |
generates the correct index structure, namely the bucketIds to the already initialized filenames and
maxRangeValues
|
[
"generates",
"the",
"correct",
"index",
"structure",
"namely",
"the",
"bucketIds",
"to",
"the",
"already",
"initialized",
"filenames",
"and",
"maxRangeValues"
] |
a670f17a2186c9a15725f26617d77ce8e444e072
|
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/bucket/hashfunction/RangeHashFunction.java#L161-L174
|
150,487
|
mgledi/DRUMS
|
src/main/java/com/unister/semweb/drums/bucket/hashfunction/RangeHashFunction.java
|
RangeHashFunction.makeOneLine
|
private String makeOneLine(byte[] value, String filename) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < value.length; i++) {
sb.append(value[i]).append('\t');
}
sb.append(filename);
return sb.toString();
}
|
java
|
private String makeOneLine(byte[] value, String filename) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < value.length; i++) {
sb.append(value[i]).append('\t');
}
sb.append(filename);
return sb.toString();
}
|
[
"private",
"String",
"makeOneLine",
"(",
"byte",
"[",
"]",
"value",
",",
"String",
"filename",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"value",
".",
"length",
";",
"i",
"++",
")",
"{",
"sb",
".",
"append",
"(",
"value",
"[",
"i",
"]",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"sb",
".",
"append",
"(",
"filename",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
Concatenates the given range value and the file name to one string. It is used to write the hash function file.
|
[
"Concatenates",
"the",
"given",
"range",
"value",
"and",
"the",
"file",
"name",
"to",
"one",
"string",
".",
"It",
"is",
"used",
"to",
"write",
"the",
"hash",
"function",
"file",
"."
] |
a670f17a2186c9a15725f26617d77ce8e444e072
|
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/bucket/hashfunction/RangeHashFunction.java#L237-L244
|
150,488
|
mgledi/DRUMS
|
src/main/java/com/unister/semweb/drums/bucket/hashfunction/RangeHashFunction.java
|
RangeHashFunction.generateFileName
|
protected String generateFileName(int subBucket, String oldName) {
int dotPos = oldName.lastIndexOf(".");
int slashPos = Math.max(oldName.lastIndexOf("/"), oldName.lastIndexOf("\\"));
String prefix;
String suffix;
if (dotPos > slashPos) {
prefix = oldName.substring(0, dotPos);
suffix = oldName.substring(dotPos);
} else {
prefix = oldName;
suffix = "";
}
return prefix + "_" + subBucket + suffix;
}
|
java
|
protected String generateFileName(int subBucket, String oldName) {
int dotPos = oldName.lastIndexOf(".");
int slashPos = Math.max(oldName.lastIndexOf("/"), oldName.lastIndexOf("\\"));
String prefix;
String suffix;
if (dotPos > slashPos) {
prefix = oldName.substring(0, dotPos);
suffix = oldName.substring(dotPos);
} else {
prefix = oldName;
suffix = "";
}
return prefix + "_" + subBucket + suffix;
}
|
[
"protected",
"String",
"generateFileName",
"(",
"int",
"subBucket",
",",
"String",
"oldName",
")",
"{",
"int",
"dotPos",
"=",
"oldName",
".",
"lastIndexOf",
"(",
"\".\"",
")",
";",
"int",
"slashPos",
"=",
"Math",
".",
"max",
"(",
"oldName",
".",
"lastIndexOf",
"(",
"\"/\"",
")",
",",
"oldName",
".",
"lastIndexOf",
"(",
"\"\\\\\"",
")",
")",
";",
"String",
"prefix",
";",
"String",
"suffix",
";",
"if",
"(",
"dotPos",
">",
"slashPos",
")",
"{",
"prefix",
"=",
"oldName",
".",
"substring",
"(",
"0",
",",
"dotPos",
")",
";",
"suffix",
"=",
"oldName",
".",
"substring",
"(",
"dotPos",
")",
";",
"}",
"else",
"{",
"prefix",
"=",
"oldName",
";",
"suffix",
"=",
"\"\"",
";",
"}",
"return",
"prefix",
"+",
"\"_\"",
"+",
"subBucket",
"+",
"suffix",
";",
"}"
] |
generates a new filename for a subbucket from the given oldName
@param subBucket
@param oldName
@return
|
[
"generates",
"a",
"new",
"filename",
"for",
"a",
"subbucket",
"from",
"the",
"given",
"oldName"
] |
a670f17a2186c9a15725f26617d77ce8e444e072
|
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/bucket/hashfunction/RangeHashFunction.java#L307-L321
|
150,489
|
mgledi/DRUMS
|
src/main/java/com/unister/semweb/drums/bucket/hashfunction/RangeHashFunction.java
|
RangeHashFunction.stringToByteCount
|
public static int stringToByteCount(String code) {
@SuppressWarnings("serial")
HashMap<String, Integer> codingMap = new HashMap<String, Integer>() {
{
put("b", 1);
put("byte", 1);
put("bool", 1);
put("boolean", 1);
put("c", 2);
put("char", 2);
put("character", 2);
put("i", 4);
put("int", 4);
put("integer", 4);
put("f", 4);
put("float", 4);
put("d", 8);
put("double", 8);
put("l", 8);
put("long", 8);
put("1", 1);
put("2", 2);
put("3", 3);
put("4", 4);
put("5", 5);
put("6", 6);
put("7", 7);
put("8", 8);
}
};
if (codingMap.containsKey(code)) {
return codingMap.get(code.toLowerCase());
} else {
return 0;
}
}
|
java
|
public static int stringToByteCount(String code) {
@SuppressWarnings("serial")
HashMap<String, Integer> codingMap = new HashMap<String, Integer>() {
{
put("b", 1);
put("byte", 1);
put("bool", 1);
put("boolean", 1);
put("c", 2);
put("char", 2);
put("character", 2);
put("i", 4);
put("int", 4);
put("integer", 4);
put("f", 4);
put("float", 4);
put("d", 8);
put("double", 8);
put("l", 8);
put("long", 8);
put("1", 1);
put("2", 2);
put("3", 3);
put("4", 4);
put("5", 5);
put("6", 6);
put("7", 7);
put("8", 8);
}
};
if (codingMap.containsKey(code)) {
return codingMap.get(code.toLowerCase());
} else {
return 0;
}
}
|
[
"public",
"static",
"int",
"stringToByteCount",
"(",
"String",
"code",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"serial\"",
")",
"HashMap",
"<",
"String",
",",
"Integer",
">",
"codingMap",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Integer",
">",
"(",
")",
"{",
"{",
"put",
"(",
"\"b\"",
",",
"1",
")",
";",
"put",
"(",
"\"byte\"",
",",
"1",
")",
";",
"put",
"(",
"\"bool\"",
",",
"1",
")",
";",
"put",
"(",
"\"boolean\"",
",",
"1",
")",
";",
"put",
"(",
"\"c\"",
",",
"2",
")",
";",
"put",
"(",
"\"char\"",
",",
"2",
")",
";",
"put",
"(",
"\"character\"",
",",
"2",
")",
";",
"put",
"(",
"\"i\"",
",",
"4",
")",
";",
"put",
"(",
"\"int\"",
",",
"4",
")",
";",
"put",
"(",
"\"integer\"",
",",
"4",
")",
";",
"put",
"(",
"\"f\"",
",",
"4",
")",
";",
"put",
"(",
"\"float\"",
",",
"4",
")",
";",
"put",
"(",
"\"d\"",
",",
"8",
")",
";",
"put",
"(",
"\"double\"",
",",
"8",
")",
";",
"put",
"(",
"\"l\"",
",",
"8",
")",
";",
"put",
"(",
"\"long\"",
",",
"8",
")",
";",
"put",
"(",
"\"1\"",
",",
"1",
")",
";",
"put",
"(",
"\"2\"",
",",
"2",
")",
";",
"put",
"(",
"\"3\"",
",",
"3",
")",
";",
"put",
"(",
"\"4\"",
",",
"4",
")",
";",
"put",
"(",
"\"5\"",
",",
"5",
")",
";",
"put",
"(",
"\"6\"",
",",
"6",
")",
";",
"put",
"(",
"\"7\"",
",",
"7",
")",
";",
"put",
"(",
"\"8\"",
",",
"8",
")",
";",
"}",
"}",
";",
"if",
"(",
"codingMap",
".",
"containsKey",
"(",
"code",
")",
")",
"{",
"return",
"codingMap",
".",
"get",
"(",
"code",
".",
"toLowerCase",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"0",
";",
"}",
"}"
] |
The header of could contain characters which are not numbers. Some of them can be translated into bytes. E.g.
char would be two byte.
@param code
the code to look for
@return the size of the given code
|
[
"The",
"header",
"of",
"could",
"contain",
"characters",
"which",
"are",
"not",
"numbers",
".",
"Some",
"of",
"them",
"can",
"be",
"translated",
"into",
"bytes",
".",
"E",
".",
"g",
".",
"char",
"would",
"be",
"two",
"byte",
"."
] |
a670f17a2186c9a15725f26617d77ce8e444e072
|
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/bucket/hashfunction/RangeHashFunction.java#L342-L377
|
150,490
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/validator/ValidatorSupport.java
|
ValidatorSupport.get
|
public String get (String name, String def) {
if (properties != null) {
Object obj = properties.get (name);
if (obj instanceof String)
return obj.toString();
}
return def;
}
|
java
|
public String get (String name, String def) {
if (properties != null) {
Object obj = properties.get (name);
if (obj instanceof String)
return obj.toString();
}
return def;
}
|
[
"public",
"String",
"get",
"(",
"String",
"name",
",",
"String",
"def",
")",
"{",
"if",
"(",
"properties",
"!=",
"null",
")",
"{",
"Object",
"obj",
"=",
"properties",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"obj",
"instanceof",
"String",
")",
"return",
"obj",
".",
"toString",
"(",
")",
";",
"}",
"return",
"def",
";",
"}"
] |
Helper for a property
@param name Property name
@param def Default value
@return Property value
|
[
"Helper",
"for",
"a",
"property"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/validator/ValidatorSupport.java#L30-L37
|
150,491
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/validator/ValidatorSupport.java
|
ValidatorSupport.getInt
|
public Integer getInt (String name) {
try {
return Integer.parseInt(get(name, "").trim());
} catch (Exception e) {
return null;
}
}
|
java
|
public Integer getInt (String name) {
try {
return Integer.parseInt(get(name, "").trim());
} catch (Exception e) {
return null;
}
}
|
[
"public",
"Integer",
"getInt",
"(",
"String",
"name",
")",
"{",
"try",
"{",
"return",
"Integer",
".",
"parseInt",
"(",
"get",
"(",
"name",
",",
"\"\"",
")",
".",
"trim",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}"
] |
Helper for an int property
@param name Property name
@return Property value as int
|
[
"Helper",
"for",
"an",
"int",
"property"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/validator/ValidatorSupport.java#L42-L48
|
150,492
|
jtrfp/javamod
|
src/main/java/de/quippy/ogg/jorbis/StaticCodeBook.java
|
StaticCodeBook.unquantize
|
float[] unquantize(){
if(maptype==1||maptype==2){
int quantvals;
float mindel=float32_unpack(q_min);
float delta=float32_unpack(q_delta);
float[] r=new float[entries*dim];
// maptype 1 and 2 both use a quantized value vector, but
// different sizes
switch(maptype){
case 1:
// most of the time, entries%dimensions == 0, but we need to be
// well defined. We define that the possible vales at each
// scalar is values == entries/dim. If entries%dim != 0, we'll
// have 'too few' values (values*dim<entries), which means that
// we'll have 'left over' entries; left over entries use zeroed
// values (and are wasted). So don't generate codebooks like that
quantvals=maptype1_quantvals();
for(int j=0; j<entries; j++){
float last=0.f;
int indexdiv=1;
for(int k=0; k<dim; k++){
int index=(j/indexdiv)%quantvals;
float val=quantlist[index];
val=Math.abs(val)*delta+mindel+last;
if(q_sequencep!=0)
last=val;
r[j*dim+k]=val;
indexdiv*=quantvals;
}
}
break;
case 2:
for(int j=0; j<entries; j++){
float last=0.f;
for(int k=0; k<dim; k++){
float val=quantlist[j*dim+k];
//if((j*dim+k)==0){System.err.println(" | 0 -> "+val+" | ");}
val=Math.abs(val)*delta+mindel+last;
if(q_sequencep!=0)
last=val;
r[j*dim+k]=val;
//if((j*dim+k)==0){System.err.println(" $ r[0] -> "+r[0]+" | ");}
}
}
//System.err.println("\nr[0]="+r[0]);
}
return (r);
}
return (null);
}
|
java
|
float[] unquantize(){
if(maptype==1||maptype==2){
int quantvals;
float mindel=float32_unpack(q_min);
float delta=float32_unpack(q_delta);
float[] r=new float[entries*dim];
// maptype 1 and 2 both use a quantized value vector, but
// different sizes
switch(maptype){
case 1:
// most of the time, entries%dimensions == 0, but we need to be
// well defined. We define that the possible vales at each
// scalar is values == entries/dim. If entries%dim != 0, we'll
// have 'too few' values (values*dim<entries), which means that
// we'll have 'left over' entries; left over entries use zeroed
// values (and are wasted). So don't generate codebooks like that
quantvals=maptype1_quantvals();
for(int j=0; j<entries; j++){
float last=0.f;
int indexdiv=1;
for(int k=0; k<dim; k++){
int index=(j/indexdiv)%quantvals;
float val=quantlist[index];
val=Math.abs(val)*delta+mindel+last;
if(q_sequencep!=0)
last=val;
r[j*dim+k]=val;
indexdiv*=quantvals;
}
}
break;
case 2:
for(int j=0; j<entries; j++){
float last=0.f;
for(int k=0; k<dim; k++){
float val=quantlist[j*dim+k];
//if((j*dim+k)==0){System.err.println(" | 0 -> "+val+" | ");}
val=Math.abs(val)*delta+mindel+last;
if(q_sequencep!=0)
last=val;
r[j*dim+k]=val;
//if((j*dim+k)==0){System.err.println(" $ r[0] -> "+r[0]+" | ");}
}
}
//System.err.println("\nr[0]="+r[0]);
}
return (r);
}
return (null);
}
|
[
"float",
"[",
"]",
"unquantize",
"(",
")",
"{",
"if",
"(",
"maptype",
"==",
"1",
"||",
"maptype",
"==",
"2",
")",
"{",
"int",
"quantvals",
";",
"float",
"mindel",
"=",
"float32_unpack",
"(",
"q_min",
")",
";",
"float",
"delta",
"=",
"float32_unpack",
"(",
"q_delta",
")",
";",
"float",
"[",
"]",
"r",
"=",
"new",
"float",
"[",
"entries",
"*",
"dim",
"]",
";",
"// maptype 1 and 2 both use a quantized value vector, but",
"// different sizes",
"switch",
"(",
"maptype",
")",
"{",
"case",
"1",
":",
"// most of the time, entries%dimensions == 0, but we need to be",
"// well defined. We define that the possible vales at each",
"// scalar is values == entries/dim. If entries%dim != 0, we'll",
"// have 'too few' values (values*dim<entries), which means that",
"// we'll have 'left over' entries; left over entries use zeroed",
"// values (and are wasted). So don't generate codebooks like that",
"quantvals",
"=",
"maptype1_quantvals",
"(",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"entries",
";",
"j",
"++",
")",
"{",
"float",
"last",
"=",
"0.f",
";",
"int",
"indexdiv",
"=",
"1",
";",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"dim",
";",
"k",
"++",
")",
"{",
"int",
"index",
"=",
"(",
"j",
"/",
"indexdiv",
")",
"%",
"quantvals",
";",
"float",
"val",
"=",
"quantlist",
"[",
"index",
"]",
";",
"val",
"=",
"Math",
".",
"abs",
"(",
"val",
")",
"*",
"delta",
"+",
"mindel",
"+",
"last",
";",
"if",
"(",
"q_sequencep",
"!=",
"0",
")",
"last",
"=",
"val",
";",
"r",
"[",
"j",
"*",
"dim",
"+",
"k",
"]",
"=",
"val",
";",
"indexdiv",
"*=",
"quantvals",
";",
"}",
"}",
"break",
";",
"case",
"2",
":",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"entries",
";",
"j",
"++",
")",
"{",
"float",
"last",
"=",
"0.f",
";",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"dim",
";",
"k",
"++",
")",
"{",
"float",
"val",
"=",
"quantlist",
"[",
"j",
"*",
"dim",
"+",
"k",
"]",
";",
"//if((j*dim+k)==0){System.err.println(\" | 0 -> \"+val+\" | \");}",
"val",
"=",
"Math",
".",
"abs",
"(",
"val",
")",
"*",
"delta",
"+",
"mindel",
"+",
"last",
";",
"if",
"(",
"q_sequencep",
"!=",
"0",
")",
"last",
"=",
"val",
";",
"r",
"[",
"j",
"*",
"dim",
"+",
"k",
"]",
"=",
"val",
";",
"//if((j*dim+k)==0){System.err.println(\" $ r[0] -> \"+r[0]+\" | \");}",
"}",
"}",
"//System.err.println(\"\\nr[0]=\"+r[0]);",
"}",
"return",
"(",
"r",
")",
";",
"}",
"return",
"(",
"null",
")",
";",
"}"
] |
in in an explicit list. Both value lists must be unpacked
|
[
"in",
"in",
"an",
"explicit",
"list",
".",
"Both",
"value",
"lists",
"must",
"be",
"unpacked"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/ogg/jorbis/StaticCodeBook.java#L356-L407
|
150,493
|
mytechia/mytechia_commons
|
mytechia-commons-modelaction/src/main/java/com/mytechia/commons/framework/modelaction/action/changeaction/ChangeModelAction.java
|
ChangeModelAction.execute
|
@Override
public Object execute() throws Exception
{
Object ret = executeChange();
if (changesManager != null)
changesManager.modelChanged();
return ret;
}
|
java
|
@Override
public Object execute() throws Exception
{
Object ret = executeChange();
if (changesManager != null)
changesManager.modelChanged();
return ret;
}
|
[
"@",
"Override",
"public",
"Object",
"execute",
"(",
")",
"throws",
"Exception",
"{",
"Object",
"ret",
"=",
"executeChange",
"(",
")",
";",
"if",
"(",
"changesManager",
"!=",
"null",
")",
"changesManager",
".",
"modelChanged",
"(",
")",
";",
"return",
"ret",
";",
"}"
] |
Template method to factorize the execution of the change model
notification.
@return
@throws java.lang.Exception
|
[
"Template",
"method",
"to",
"factorize",
"the",
"execution",
"of",
"the",
"change",
"model",
"notification",
"."
] |
02251879085f271a1fb51663a1c8eddc8be78ae7
|
https://github.com/mytechia/mytechia_commons/blob/02251879085f271a1fb51663a1c8eddc8be78ae7/mytechia-commons-modelaction/src/main/java/com/mytechia/commons/framework/modelaction/action/changeaction/ChangeModelAction.java#L68-L75
|
150,494
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/tasks/LoadPropertiesFileTask.java
|
LoadPropertiesFileTask.loadPropertiesFile
|
public static AsyncWork<Properties, Exception> loadPropertiesFile(
IO.Readable input, Charset charset, byte priority, IO.OperationType closeInputAtEnd, Listener<Properties> onDone
) {
if (!(input instanceof IO.Readable.Buffered))
input = new PreBufferedReadable(input, 512, priority, 1024, priority, 16);
return loadPropertiesFile((IO.Readable.Buffered)input, charset, priority, closeInputAtEnd, onDone);
}
|
java
|
public static AsyncWork<Properties, Exception> loadPropertiesFile(
IO.Readable input, Charset charset, byte priority, IO.OperationType closeInputAtEnd, Listener<Properties> onDone
) {
if (!(input instanceof IO.Readable.Buffered))
input = new PreBufferedReadable(input, 512, priority, 1024, priority, 16);
return loadPropertiesFile((IO.Readable.Buffered)input, charset, priority, closeInputAtEnd, onDone);
}
|
[
"public",
"static",
"AsyncWork",
"<",
"Properties",
",",
"Exception",
">",
"loadPropertiesFile",
"(",
"IO",
".",
"Readable",
"input",
",",
"Charset",
"charset",
",",
"byte",
"priority",
",",
"IO",
".",
"OperationType",
"closeInputAtEnd",
",",
"Listener",
"<",
"Properties",
">",
"onDone",
")",
"{",
"if",
"(",
"!",
"(",
"input",
"instanceof",
"IO",
".",
"Readable",
".",
"Buffered",
")",
")",
"input",
"=",
"new",
"PreBufferedReadable",
"(",
"input",
",",
"512",
",",
"priority",
",",
"1024",
",",
"priority",
",",
"16",
")",
";",
"return",
"loadPropertiesFile",
"(",
"(",
"IO",
".",
"Readable",
".",
"Buffered",
")",
"input",
",",
"charset",
",",
"priority",
",",
"closeInputAtEnd",
",",
"onDone",
")",
";",
"}"
] |
Load properties from a Readable IO.
|
[
"Load",
"properties",
"from",
"a",
"Readable",
"IO",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/tasks/LoadPropertiesFileTask.java#L34-L40
|
150,495
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/tasks/LoadPropertiesFileTask.java
|
LoadPropertiesFileTask.loadPropertiesFile
|
@SuppressWarnings("resource")
public static AsyncWork<Properties, Exception> loadPropertiesFile(
IO.Readable.Buffered input, Charset charset, byte priority, IO.OperationType closeInputAtEnd, Listener<Properties> onDone
) {
BufferedReadableCharacterStream cs = new BufferedReadableCharacterStream(input, charset, 512, 32);
return loadPropertiesFile(cs, priority, closeInputAtEnd, onDone);
}
|
java
|
@SuppressWarnings("resource")
public static AsyncWork<Properties, Exception> loadPropertiesFile(
IO.Readable.Buffered input, Charset charset, byte priority, IO.OperationType closeInputAtEnd, Listener<Properties> onDone
) {
BufferedReadableCharacterStream cs = new BufferedReadableCharacterStream(input, charset, 512, 32);
return loadPropertiesFile(cs, priority, closeInputAtEnd, onDone);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"resource\"",
")",
"public",
"static",
"AsyncWork",
"<",
"Properties",
",",
"Exception",
">",
"loadPropertiesFile",
"(",
"IO",
".",
"Readable",
".",
"Buffered",
"input",
",",
"Charset",
"charset",
",",
"byte",
"priority",
",",
"IO",
".",
"OperationType",
"closeInputAtEnd",
",",
"Listener",
"<",
"Properties",
">",
"onDone",
")",
"{",
"BufferedReadableCharacterStream",
"cs",
"=",
"new",
"BufferedReadableCharacterStream",
"(",
"input",
",",
"charset",
",",
"512",
",",
"32",
")",
";",
"return",
"loadPropertiesFile",
"(",
"cs",
",",
"priority",
",",
"closeInputAtEnd",
",",
"onDone",
")",
";",
"}"
] |
Load properties from a Buffered IO.
|
[
"Load",
"properties",
"from",
"a",
"Buffered",
"IO",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/tasks/LoadPropertiesFileTask.java#L43-L49
|
150,496
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/tasks/LoadPropertiesFileTask.java
|
LoadPropertiesFileTask.loadPropertiesFile
|
public static AsyncWork<Properties, Exception> loadPropertiesFile(
BufferedReadableCharacterStream stream, byte priority, IO.OperationType closeStreamAtEnd, Listener<Properties> onDone
) {
LoadPropertiesFileTask task = new LoadPropertiesFileTask(stream, priority, closeStreamAtEnd, onDone);
return task.start();
}
|
java
|
public static AsyncWork<Properties, Exception> loadPropertiesFile(
BufferedReadableCharacterStream stream, byte priority, IO.OperationType closeStreamAtEnd, Listener<Properties> onDone
) {
LoadPropertiesFileTask task = new LoadPropertiesFileTask(stream, priority, closeStreamAtEnd, onDone);
return task.start();
}
|
[
"public",
"static",
"AsyncWork",
"<",
"Properties",
",",
"Exception",
">",
"loadPropertiesFile",
"(",
"BufferedReadableCharacterStream",
"stream",
",",
"byte",
"priority",
",",
"IO",
".",
"OperationType",
"closeStreamAtEnd",
",",
"Listener",
"<",
"Properties",
">",
"onDone",
")",
"{",
"LoadPropertiesFileTask",
"task",
"=",
"new",
"LoadPropertiesFileTask",
"(",
"stream",
",",
"priority",
",",
"closeStreamAtEnd",
",",
"onDone",
")",
";",
"return",
"task",
".",
"start",
"(",
")",
";",
"}"
] |
Load properties from a character stream.
|
[
"Load",
"properties",
"from",
"a",
"character",
"stream",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/tasks/LoadPropertiesFileTask.java#L52-L57
|
150,497
|
diegossilveira/jcors
|
src/main/java/org/jcors/web/PreflightRequestHandler.java
|
PreflightRequestHandler.checkRequestMethod
|
private String checkRequestMethod(HttpServletRequest request, JCorsConfig config) {
String requestMethod = request.getHeader(CorsHeaders.ACCESS_CONTROL_REQUEST_METHOD_HEADER);
Constraint.ensureNotEmpty(requestMethod, "Request Method Header must be supplied");
Constraint.ensureTrue(config.isMethodAllowed(requestMethod),
String.format("The specified method is not allowed: '%s'", requestMethod));
return requestMethod;
}
|
java
|
private String checkRequestMethod(HttpServletRequest request, JCorsConfig config) {
String requestMethod = request.getHeader(CorsHeaders.ACCESS_CONTROL_REQUEST_METHOD_HEADER);
Constraint.ensureNotEmpty(requestMethod, "Request Method Header must be supplied");
Constraint.ensureTrue(config.isMethodAllowed(requestMethod),
String.format("The specified method is not allowed: '%s'", requestMethod));
return requestMethod;
}
|
[
"private",
"String",
"checkRequestMethod",
"(",
"HttpServletRequest",
"request",
",",
"JCorsConfig",
"config",
")",
"{",
"String",
"requestMethod",
"=",
"request",
".",
"getHeader",
"(",
"CorsHeaders",
".",
"ACCESS_CONTROL_REQUEST_METHOD_HEADER",
")",
";",
"Constraint",
".",
"ensureNotEmpty",
"(",
"requestMethod",
",",
"\"Request Method Header must be supplied\"",
")",
";",
"Constraint",
".",
"ensureTrue",
"(",
"config",
".",
"isMethodAllowed",
"(",
"requestMethod",
")",
",",
"String",
".",
"format",
"(",
"\"The specified method is not allowed: '%s'\"",
",",
"requestMethod",
")",
")",
";",
"return",
"requestMethod",
";",
"}"
] |
Checks if the requested method is allowed
@param request
@param config
|
[
"Checks",
"if",
"the",
"requested",
"method",
"is",
"allowed"
] |
cd56a9e2055d629baa42f93b27dd5615ced9632f
|
https://github.com/diegossilveira/jcors/blob/cd56a9e2055d629baa42f93b27dd5615ced9632f/src/main/java/org/jcors/web/PreflightRequestHandler.java#L80-L89
|
150,498
|
diegossilveira/jcors
|
src/main/java/org/jcors/util/Constraint.java
|
Constraint.ensureNotEmpty
|
public static void ensureNotEmpty(String string, String errorMessage) {
ensureNotNull(string, errorMessage);
ensure(string.trim().length() > 0, errorMessage);
}
|
java
|
public static void ensureNotEmpty(String string, String errorMessage) {
ensureNotNull(string, errorMessage);
ensure(string.trim().length() > 0, errorMessage);
}
|
[
"public",
"static",
"void",
"ensureNotEmpty",
"(",
"String",
"string",
",",
"String",
"errorMessage",
")",
"{",
"ensureNotNull",
"(",
"string",
",",
"errorMessage",
")",
";",
"ensure",
"(",
"string",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
">",
"0",
",",
"errorMessage",
")",
";",
"}"
] |
Ensures that a String is not empty
@param string
@param errorMessage
|
[
"Ensures",
"that",
"a",
"String",
"is",
"not",
"empty"
] |
cd56a9e2055d629baa42f93b27dd5615ced9632f
|
https://github.com/diegossilveira/jcors/blob/cd56a9e2055d629baa42f93b27dd5615ced9632f/src/main/java/org/jcors/util/Constraint.java#L30-L34
|
150,499
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/tasks/drives/RenameFileTask.java
|
RenameFileTask.rename
|
public static ISynchronizationPoint<IOException> rename(File source, File destination, byte priority) {
// TODO we should use the roots instead of drive
TaskManager t1 = Threading.getDrivesTaskManager().getTaskManager(source);
TaskManager t2 = Threading.getDrivesTaskManager().getTaskManager(destination);
if (t1 == t2)
return new RenameFileTask(t1, source, destination, priority).start().getOutput();
AsyncWork<Long, IOException> copy = IOUtil.copy(source, destination, priority, source.length(), null, 0, null);
SynchronizationPoint<IOException> result = new SynchronizationPoint<>();
copy.listenInline(() -> {
new RemoveFileTask(source, priority).start().getOutput().listenInline(result);
}, result);
return result;
}
|
java
|
public static ISynchronizationPoint<IOException> rename(File source, File destination, byte priority) {
// TODO we should use the roots instead of drive
TaskManager t1 = Threading.getDrivesTaskManager().getTaskManager(source);
TaskManager t2 = Threading.getDrivesTaskManager().getTaskManager(destination);
if (t1 == t2)
return new RenameFileTask(t1, source, destination, priority).start().getOutput();
AsyncWork<Long, IOException> copy = IOUtil.copy(source, destination, priority, source.length(), null, 0, null);
SynchronizationPoint<IOException> result = new SynchronizationPoint<>();
copy.listenInline(() -> {
new RemoveFileTask(source, priority).start().getOutput().listenInline(result);
}, result);
return result;
}
|
[
"public",
"static",
"ISynchronizationPoint",
"<",
"IOException",
">",
"rename",
"(",
"File",
"source",
",",
"File",
"destination",
",",
"byte",
"priority",
")",
"{",
"// TODO we should use the roots instead of drive",
"TaskManager",
"t1",
"=",
"Threading",
".",
"getDrivesTaskManager",
"(",
")",
".",
"getTaskManager",
"(",
"source",
")",
";",
"TaskManager",
"t2",
"=",
"Threading",
".",
"getDrivesTaskManager",
"(",
")",
".",
"getTaskManager",
"(",
"destination",
")",
";",
"if",
"(",
"t1",
"==",
"t2",
")",
"return",
"new",
"RenameFileTask",
"(",
"t1",
",",
"source",
",",
"destination",
",",
"priority",
")",
".",
"start",
"(",
")",
".",
"getOutput",
"(",
")",
";",
"AsyncWork",
"<",
"Long",
",",
"IOException",
">",
"copy",
"=",
"IOUtil",
".",
"copy",
"(",
"source",
",",
"destination",
",",
"priority",
",",
"source",
".",
"length",
"(",
")",
",",
"null",
",",
"0",
",",
"null",
")",
";",
"SynchronizationPoint",
"<",
"IOException",
">",
"result",
"=",
"new",
"SynchronizationPoint",
"<>",
"(",
")",
";",
"copy",
".",
"listenInline",
"(",
"(",
")",
"->",
"{",
"new",
"RemoveFileTask",
"(",
"source",
",",
"priority",
")",
".",
"start",
"(",
")",
".",
"getOutput",
"(",
")",
".",
"listenInline",
"(",
"result",
")",
";",
"}",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] |
Rename a file.
It may do a copy then a delete, or a simple rename, depending if the source and destination are
on the same drive or not.
|
[
"Rename",
"a",
"file",
".",
"It",
"may",
"do",
"a",
"copy",
"then",
"a",
"delete",
"or",
"a",
"simple",
"rename",
"depending",
"if",
"the",
"source",
"and",
"destination",
"are",
"on",
"the",
"same",
"drive",
"or",
"not",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/tasks/drives/RenameFileTask.java#L23-L35
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.