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,700
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/info/AbstractFileInfo.java
|
AbstractFileInfo.tryResource
|
protected final boolean tryResource(String directory, String fileName){
String path = directory + "/" + fileName;
if(directory==null){
path = fileName;
}
URL url;
ClassLoader loader = Thread.currentThread().getContextClassLoader();
url = loader.getResource(path);
if(url==null){
loader = AbstractFileInfo.class.getClassLoader();
url = loader.getResource(path);
}
if(url==null){
this.errors.addError("could not get Resource URL");
return false;
}
this.url = url;
this.fullFileName = FilenameUtils.getName(fileName);
if(directory!=null){
this.setRootPath = directory;
}
return true;
}
|
java
|
protected final boolean tryResource(String directory, String fileName){
String path = directory + "/" + fileName;
if(directory==null){
path = fileName;
}
URL url;
ClassLoader loader = Thread.currentThread().getContextClassLoader();
url = loader.getResource(path);
if(url==null){
loader = AbstractFileInfo.class.getClassLoader();
url = loader.getResource(path);
}
if(url==null){
this.errors.addError("could not get Resource URL");
return false;
}
this.url = url;
this.fullFileName = FilenameUtils.getName(fileName);
if(directory!=null){
this.setRootPath = directory;
}
return true;
}
|
[
"protected",
"final",
"boolean",
"tryResource",
"(",
"String",
"directory",
",",
"String",
"fileName",
")",
"{",
"String",
"path",
"=",
"directory",
"+",
"\"/\"",
"+",
"fileName",
";",
"if",
"(",
"directory",
"==",
"null",
")",
"{",
"path",
"=",
"fileName",
";",
"}",
"URL",
"url",
";",
"ClassLoader",
"loader",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
";",
"url",
"=",
"loader",
".",
"getResource",
"(",
"path",
")",
";",
"if",
"(",
"url",
"==",
"null",
")",
"{",
"loader",
"=",
"AbstractFileInfo",
".",
"class",
".",
"getClassLoader",
"(",
")",
";",
"url",
"=",
"loader",
".",
"getResource",
"(",
"path",
")",
";",
"}",
"if",
"(",
"url",
"==",
"null",
")",
"{",
"this",
".",
"errors",
".",
"addError",
"(",
"\"could not get Resource URL\"",
")",
";",
"return",
"false",
";",
"}",
"this",
".",
"url",
"=",
"url",
";",
"this",
".",
"fullFileName",
"=",
"FilenameUtils",
".",
"getName",
"(",
"fileName",
")",
";",
"if",
"(",
"directory",
"!=",
"null",
")",
"{",
"this",
".",
"setRootPath",
"=",
"directory",
";",
"}",
"return",
"true",
";",
"}"
] |
Try to locate a file as resource.
@param directory a directory to locate the file in
@param fileName a file name with optional path information
@return true if the file was found, false otherwise
|
[
"Try",
"to",
"locate",
"a",
"file",
"as",
"resource",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/info/AbstractFileInfo.java#L357-L383
|
150,701
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/info/AbstractFileInfo.java
|
AbstractFileInfo.getAbsolutePath
|
public String getAbsolutePath(){
if(this.isValid()){
if(this.asFile()!=null){
return FilenameUtils.getFullPathNoEndSeparator(this.file.getAbsolutePath());
}
else{
return FilenameUtils.getFullPathNoEndSeparator(this.url.getPath());
}
}
return null;
}
|
java
|
public String getAbsolutePath(){
if(this.isValid()){
if(this.asFile()!=null){
return FilenameUtils.getFullPathNoEndSeparator(this.file.getAbsolutePath());
}
else{
return FilenameUtils.getFullPathNoEndSeparator(this.url.getPath());
}
}
return null;
}
|
[
"public",
"String",
"getAbsolutePath",
"(",
")",
"{",
"if",
"(",
"this",
".",
"isValid",
"(",
")",
")",
"{",
"if",
"(",
"this",
".",
"asFile",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"FilenameUtils",
".",
"getFullPathNoEndSeparator",
"(",
"this",
".",
"file",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"FilenameUtils",
".",
"getFullPathNoEndSeparator",
"(",
"this",
".",
"url",
".",
"getPath",
"(",
")",
")",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Returns the absolute path of the file, without the file name
@return absolute path if the file info object is valid, null otherwise
|
[
"Returns",
"the",
"absolute",
"path",
"of",
"the",
"file",
"without",
"the",
"file",
"name"
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/info/AbstractFileInfo.java#L446-L456
|
150,702
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/log/LogPattern.java
|
LogPattern.generate
|
public StringBuilder generate(Log log) {
StringBuilder s = new StringBuilder();
for (int i = 0; i < parts.length; ++i)
parts[i].append(s, log);
if (log.trace != null)
appendStack(s, log.trace);
return s;
}
|
java
|
public StringBuilder generate(Log log) {
StringBuilder s = new StringBuilder();
for (int i = 0; i < parts.length; ++i)
parts[i].append(s, log);
if (log.trace != null)
appendStack(s, log.trace);
return s;
}
|
[
"public",
"StringBuilder",
"generate",
"(",
"Log",
"log",
")",
"{",
"StringBuilder",
"s",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"parts",
".",
"length",
";",
"++",
"i",
")",
"parts",
"[",
"i",
"]",
".",
"append",
"(",
"s",
",",
"log",
")",
";",
"if",
"(",
"log",
".",
"trace",
"!=",
"null",
")",
"appendStack",
"(",
"s",
",",
"log",
".",
"trace",
")",
";",
"return",
"s",
";",
"}"
] |
Generate a log string.
|
[
"Generate",
"a",
"log",
"string",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/log/LogPattern.java#L164-L171
|
150,703
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/application/SplashScreen.java
|
SplashScreen.close
|
public void close() {
JWindow w;
synchronized (this) {
if (!synch.isUnblocked()) synch.unblock();
if (win == null) return;
w = win;
win = null;
}
if (event != null)
event.fire();
w.setVisible(false);
w.removeAll();
w.dispose();
RepaintManager.setCurrentManager(null);
logoContainer = null;
titleContainer = null;
bottom = null;
progressText = null;
progressSubText = null;
progressBar = null;
poweredBy = null;
logo = null;
title = null;
text = null;
subText = null;
event = null;
}
|
java
|
public void close() {
JWindow w;
synchronized (this) {
if (!synch.isUnblocked()) synch.unblock();
if (win == null) return;
w = win;
win = null;
}
if (event != null)
event.fire();
w.setVisible(false);
w.removeAll();
w.dispose();
RepaintManager.setCurrentManager(null);
logoContainer = null;
titleContainer = null;
bottom = null;
progressText = null;
progressSubText = null;
progressBar = null;
poweredBy = null;
logo = null;
title = null;
text = null;
subText = null;
event = null;
}
|
[
"public",
"void",
"close",
"(",
")",
"{",
"JWindow",
"w",
";",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"!",
"synch",
".",
"isUnblocked",
"(",
")",
")",
"synch",
".",
"unblock",
"(",
")",
";",
"if",
"(",
"win",
"==",
"null",
")",
"return",
";",
"w",
"=",
"win",
";",
"win",
"=",
"null",
";",
"}",
"if",
"(",
"event",
"!=",
"null",
")",
"event",
".",
"fire",
"(",
")",
";",
"w",
".",
"setVisible",
"(",
"false",
")",
";",
"w",
".",
"removeAll",
"(",
")",
";",
"w",
".",
"dispose",
"(",
")",
";",
"RepaintManager",
".",
"setCurrentManager",
"(",
"null",
")",
";",
"logoContainer",
"=",
"null",
";",
"titleContainer",
"=",
"null",
";",
"bottom",
"=",
"null",
";",
"progressText",
"=",
"null",
";",
"progressSubText",
"=",
"null",
";",
"progressBar",
"=",
"null",
";",
"poweredBy",
"=",
"null",
";",
"logo",
"=",
"null",
";",
"title",
"=",
"null",
";",
"text",
"=",
"null",
";",
"subText",
"=",
"null",
";",
"event",
"=",
"null",
";",
"}"
] |
Close this window.
|
[
"Close",
"this",
"window",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/application/SplashScreen.java#L68-L94
|
150,704
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/application/SplashScreen.java
|
SplashScreen.setLogo
|
public synchronized void setLogo(ImageIcon logo, boolean isCustom) {
if (win == null) return;
this.logo = new JLabel(logo);
Dimension dim = new Dimension(logo.getIconWidth(), logo.getIconHeight());
if (dim.width > 400) dim.width = 400;
if (dim.height > 300) dim.height = 300;
this.logo.setMaximumSize(dim);
this.logo.setMinimumSize(dim);
this.logo.setPreferredSize(dim);
this.isCustomLogo = isCustom;
update();
}
|
java
|
public synchronized void setLogo(ImageIcon logo, boolean isCustom) {
if (win == null) return;
this.logo = new JLabel(logo);
Dimension dim = new Dimension(logo.getIconWidth(), logo.getIconHeight());
if (dim.width > 400) dim.width = 400;
if (dim.height > 300) dim.height = 300;
this.logo.setMaximumSize(dim);
this.logo.setMinimumSize(dim);
this.logo.setPreferredSize(dim);
this.isCustomLogo = isCustom;
update();
}
|
[
"public",
"synchronized",
"void",
"setLogo",
"(",
"ImageIcon",
"logo",
",",
"boolean",
"isCustom",
")",
"{",
"if",
"(",
"win",
"==",
"null",
")",
"return",
";",
"this",
".",
"logo",
"=",
"new",
"JLabel",
"(",
"logo",
")",
";",
"Dimension",
"dim",
"=",
"new",
"Dimension",
"(",
"logo",
".",
"getIconWidth",
"(",
")",
",",
"logo",
".",
"getIconHeight",
"(",
")",
")",
";",
"if",
"(",
"dim",
".",
"width",
">",
"400",
")",
"dim",
".",
"width",
"=",
"400",
";",
"if",
"(",
"dim",
".",
"height",
">",
"300",
")",
"dim",
".",
"height",
"=",
"300",
";",
"this",
".",
"logo",
".",
"setMaximumSize",
"(",
"dim",
")",
";",
"this",
".",
"logo",
".",
"setMinimumSize",
"(",
"dim",
")",
";",
"this",
".",
"logo",
".",
"setPreferredSize",
"(",
"dim",
")",
";",
"this",
".",
"isCustomLogo",
"=",
"isCustom",
";",
"update",
"(",
")",
";",
"}"
] |
Change the logo.
|
[
"Change",
"the",
"logo",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/application/SplashScreen.java#L248-L259
|
150,705
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/application/SplashScreen.java
|
SplashScreen.loadDefaultLogo
|
public void loadDefaultLogo() {
int pos = 0;
int size = 18296;
byte[] buffer = new byte[size];
try (InputStream in = getClass().getClassLoader().getResourceAsStream("net/lecousin/framework/core/logo_200x200.png")) {
do {
int nb = in.read(buffer, pos, size - pos);
if (nb <= 0) break;
pos += nb;
} while (pos < size);
} catch (IOException e) {
// ignore, no logo
}
if (pos == size)
setLogo(new ImageIcon(buffer), false);
}
|
java
|
public void loadDefaultLogo() {
int pos = 0;
int size = 18296;
byte[] buffer = new byte[size];
try (InputStream in = getClass().getClassLoader().getResourceAsStream("net/lecousin/framework/core/logo_200x200.png")) {
do {
int nb = in.read(buffer, pos, size - pos);
if (nb <= 0) break;
pos += nb;
} while (pos < size);
} catch (IOException e) {
// ignore, no logo
}
if (pos == size)
setLogo(new ImageIcon(buffer), false);
}
|
[
"public",
"void",
"loadDefaultLogo",
"(",
")",
"{",
"int",
"pos",
"=",
"0",
";",
"int",
"size",
"=",
"18296",
";",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"size",
"]",
";",
"try",
"(",
"InputStream",
"in",
"=",
"getClass",
"(",
")",
".",
"getClassLoader",
"(",
")",
".",
"getResourceAsStream",
"(",
"\"net/lecousin/framework/core/logo_200x200.png\"",
")",
")",
"{",
"do",
"{",
"int",
"nb",
"=",
"in",
".",
"read",
"(",
"buffer",
",",
"pos",
",",
"size",
"-",
"pos",
")",
";",
"if",
"(",
"nb",
"<=",
"0",
")",
"break",
";",
"pos",
"+=",
"nb",
";",
"}",
"while",
"(",
"pos",
"<",
"size",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"// ignore, no logo\r",
"}",
"if",
"(",
"pos",
"==",
"size",
")",
"setLogo",
"(",
"new",
"ImageIcon",
"(",
"buffer",
")",
",",
"false",
")",
";",
"}"
] |
Load the default logo.
|
[
"Load",
"the",
"default",
"logo",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/application/SplashScreen.java#L262-L277
|
150,706
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/application/SplashScreen.java
|
SplashScreen.endInit
|
public synchronized void endInit() {
if (win == null) return;
progressText.setText("Starting framework...");
progressBar.setMinimum(0);
progressBar.setMaximum(10050);
progressBar.setValue(50);
bottom.invalidate();
}
|
java
|
public synchronized void endInit() {
if (win == null) return;
progressText.setText("Starting framework...");
progressBar.setMinimum(0);
progressBar.setMaximum(10050);
progressBar.setValue(50);
bottom.invalidate();
}
|
[
"public",
"synchronized",
"void",
"endInit",
"(",
")",
"{",
"if",
"(",
"win",
"==",
"null",
")",
"return",
";",
"progressText",
".",
"setText",
"(",
"\"Starting framework...\"",
")",
";",
"progressBar",
".",
"setMinimum",
"(",
"0",
")",
";",
"progressBar",
".",
"setMaximum",
"(",
"10050",
")",
";",
"progressBar",
".",
"setValue",
"(",
"50",
")",
";",
"bottom",
".",
"invalidate",
"(",
")",
";",
"}"
] |
End of initial startup.
|
[
"End",
"of",
"initial",
"startup",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/application/SplashScreen.java#L287-L294
|
150,707
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/managers/MessageRenderer.java
|
MessageRenderer.validateSTG
|
protected void validateSTG(){
if(this.stg==null){
throw new IllegalArgumentException("stg is null");
}
STGroupValidator stgv = new STGroupValidator(this.stg, MessageRenderer.STG_CHUNKS);
if(stgv.getValidationErrors().hasErrors()){
throw new IllegalArgumentException(stgv.getValidationErrors().render());
}
}
|
java
|
protected void validateSTG(){
if(this.stg==null){
throw new IllegalArgumentException("stg is null");
}
STGroupValidator stgv = new STGroupValidator(this.stg, MessageRenderer.STG_CHUNKS);
if(stgv.getValidationErrors().hasErrors()){
throw new IllegalArgumentException(stgv.getValidationErrors().render());
}
}
|
[
"protected",
"void",
"validateSTG",
"(",
")",
"{",
"if",
"(",
"this",
".",
"stg",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"stg is null\"",
")",
";",
"}",
"STGroupValidator",
"stgv",
"=",
"new",
"STGroupValidator",
"(",
"this",
".",
"stg",
",",
"MessageRenderer",
".",
"STG_CHUNKS",
")",
";",
"if",
"(",
"stgv",
".",
"getValidationErrors",
"(",
")",
".",
"hasErrors",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"stgv",
".",
"getValidationErrors",
"(",
")",
".",
"render",
"(",
")",
")",
";",
"}",
"}"
] |
Validates the local STGroup
@throws IllegalArgumentException if the local STGroup was null or not valid
|
[
"Validates",
"the",
"local",
"STGroup"
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/managers/MessageRenderer.java#L111-L120
|
150,708
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/managers/MessageRenderer.java
|
MessageRenderer.render
|
public String render(Message5WH msg) {
if(msg!=null){
ST ret = this.stg.getInstanceOf("message5wh");
if(msg.getWhereLocation()!=null){
ST where = this.stg.getInstanceOf("where");
where.add("location", msg.getWhereLocation());
if(msg.getWhereLine()>0){
where.add("line", msg.getWhereLine());
}
if(msg.getWhereColumn()>0){
where.add("column", msg.getWhereColumn());
}
ret.add("where", where);
}
ret.add("reporter", msg.getReporter());
if(msg.getType()!=null){
Map<String, Boolean> typeMap = new HashMap<>();
typeMap.put(msg.getType().toString(), true);
ret.add("type", typeMap);
}
if(msg.getWhat()!=null && !StringUtils.isBlank(msg.getWhat().toString())){
ret.add("what", msg.getWhat());
}
ret.add("who", msg.getWho());
ret.add("when", msg.getWhen());
ret.add("why", msg.getWhy());
ret.add("how", msg.getHow());
return ret.render();
}
return "";
}
|
java
|
public String render(Message5WH msg) {
if(msg!=null){
ST ret = this.stg.getInstanceOf("message5wh");
if(msg.getWhereLocation()!=null){
ST where = this.stg.getInstanceOf("where");
where.add("location", msg.getWhereLocation());
if(msg.getWhereLine()>0){
where.add("line", msg.getWhereLine());
}
if(msg.getWhereColumn()>0){
where.add("column", msg.getWhereColumn());
}
ret.add("where", where);
}
ret.add("reporter", msg.getReporter());
if(msg.getType()!=null){
Map<String, Boolean> typeMap = new HashMap<>();
typeMap.put(msg.getType().toString(), true);
ret.add("type", typeMap);
}
if(msg.getWhat()!=null && !StringUtils.isBlank(msg.getWhat().toString())){
ret.add("what", msg.getWhat());
}
ret.add("who", msg.getWho());
ret.add("when", msg.getWhen());
ret.add("why", msg.getWhy());
ret.add("how", msg.getHow());
return ret.render();
}
return "";
}
|
[
"public",
"String",
"render",
"(",
"Message5WH",
"msg",
")",
"{",
"if",
"(",
"msg",
"!=",
"null",
")",
"{",
"ST",
"ret",
"=",
"this",
".",
"stg",
".",
"getInstanceOf",
"(",
"\"message5wh\"",
")",
";",
"if",
"(",
"msg",
".",
"getWhereLocation",
"(",
")",
"!=",
"null",
")",
"{",
"ST",
"where",
"=",
"this",
".",
"stg",
".",
"getInstanceOf",
"(",
"\"where\"",
")",
";",
"where",
".",
"add",
"(",
"\"location\"",
",",
"msg",
".",
"getWhereLocation",
"(",
")",
")",
";",
"if",
"(",
"msg",
".",
"getWhereLine",
"(",
")",
">",
"0",
")",
"{",
"where",
".",
"add",
"(",
"\"line\"",
",",
"msg",
".",
"getWhereLine",
"(",
")",
")",
";",
"}",
"if",
"(",
"msg",
".",
"getWhereColumn",
"(",
")",
">",
"0",
")",
"{",
"where",
".",
"add",
"(",
"\"column\"",
",",
"msg",
".",
"getWhereColumn",
"(",
")",
")",
";",
"}",
"ret",
".",
"add",
"(",
"\"where\"",
",",
"where",
")",
";",
"}",
"ret",
".",
"add",
"(",
"\"reporter\"",
",",
"msg",
".",
"getReporter",
"(",
")",
")",
";",
"if",
"(",
"msg",
".",
"getType",
"(",
")",
"!=",
"null",
")",
"{",
"Map",
"<",
"String",
",",
"Boolean",
">",
"typeMap",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"typeMap",
".",
"put",
"(",
"msg",
".",
"getType",
"(",
")",
".",
"toString",
"(",
")",
",",
"true",
")",
";",
"ret",
".",
"add",
"(",
"\"type\"",
",",
"typeMap",
")",
";",
"}",
"if",
"(",
"msg",
".",
"getWhat",
"(",
")",
"!=",
"null",
"&&",
"!",
"StringUtils",
".",
"isBlank",
"(",
"msg",
".",
"getWhat",
"(",
")",
".",
"toString",
"(",
")",
")",
")",
"{",
"ret",
".",
"add",
"(",
"\"what\"",
",",
"msg",
".",
"getWhat",
"(",
")",
")",
";",
"}",
"ret",
".",
"add",
"(",
"\"who\"",
",",
"msg",
".",
"getWho",
"(",
")",
")",
";",
"ret",
".",
"add",
"(",
"\"when\"",
",",
"msg",
".",
"getWhen",
"(",
")",
")",
";",
"ret",
".",
"add",
"(",
"\"why\"",
",",
"msg",
".",
"getWhy",
"(",
")",
")",
";",
"ret",
".",
"add",
"(",
"\"how\"",
",",
"msg",
".",
"getHow",
"(",
")",
")",
";",
"return",
"ret",
".",
"render",
"(",
")",
";",
"}",
"return",
"\"\"",
";",
"}"
] |
Renders a single message
@param msg message to render
@return string with the rendered message, empty if parameter was null
|
[
"Renders",
"a",
"single",
"message"
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/managers/MessageRenderer.java#L127-L163
|
150,709
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/managers/MessageRenderer.java
|
MessageRenderer.render
|
public String render(Collection<Message5WH> messages){
StrBuilder ret = new StrBuilder(50);
for(Message5WH msg : messages){
ret.appendln(this.render(msg));
}
return ret.toString();
}
|
java
|
public String render(Collection<Message5WH> messages){
StrBuilder ret = new StrBuilder(50);
for(Message5WH msg : messages){
ret.appendln(this.render(msg));
}
return ret.toString();
}
|
[
"public",
"String",
"render",
"(",
"Collection",
"<",
"Message5WH",
">",
"messages",
")",
"{",
"StrBuilder",
"ret",
"=",
"new",
"StrBuilder",
"(",
"50",
")",
";",
"for",
"(",
"Message5WH",
"msg",
":",
"messages",
")",
"{",
"ret",
".",
"appendln",
"(",
"this",
".",
"render",
"(",
"msg",
")",
")",
";",
"}",
"return",
"ret",
".",
"toString",
"(",
")",
";",
"}"
] |
Renders a collection of messages.
@param messages the collection of messages to render
@return string with rendered messages
|
[
"Renders",
"a",
"collection",
"of",
"messages",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/managers/MessageRenderer.java#L170-L176
|
150,710
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLStreamEventsSync.java
|
XMLStreamEventsSync.nextStartElement
|
public boolean nextStartElement() throws XMLException, IOException {
try {
do {
next();
} while (!Type.START_ELEMENT.equals(event.type));
return true;
} catch (EOFException e) {
return false;
}
}
|
java
|
public boolean nextStartElement() throws XMLException, IOException {
try {
do {
next();
} while (!Type.START_ELEMENT.equals(event.type));
return true;
} catch (EOFException e) {
return false;
}
}
|
[
"public",
"boolean",
"nextStartElement",
"(",
")",
"throws",
"XMLException",
",",
"IOException",
"{",
"try",
"{",
"do",
"{",
"next",
"(",
")",
";",
"}",
"while",
"(",
"!",
"Type",
".",
"START_ELEMENT",
".",
"equals",
"(",
"event",
".",
"type",
")",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"EOFException",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}"
] |
Shortcut to move forward to the next START_ELEMENT, return false if no START_ELEMENT event was found.
|
[
"Shortcut",
"to",
"move",
"forward",
"to",
"the",
"next",
"START_ELEMENT",
"return",
"false",
"if",
"no",
"START_ELEMENT",
"event",
"was",
"found",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLStreamEventsSync.java#L27-L36
|
150,711
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLStreamEventsSync.java
|
XMLStreamEventsSync.nextInnerElement
|
public boolean nextInnerElement(ElementContext parent) throws XMLException, IOException {
if (event.context.isEmpty()) return false;
if (Type.START_ELEMENT.equals(event.type) && event.context.getFirst() == parent && event.isClosed)
return false; // we are one the opening tag of the parent, and it is closed, so it has no content
if (Type.END_ELEMENT.equals(event.type) && event.context.getFirst() == parent)
return false;
try {
do {
next();
if (Type.END_ELEMENT.equals(event.type)) {
if (event.context.getFirst() == parent)
return false;
}
if (Type.START_ELEMENT.equals(event.type)) {
if (event.context.size() > 1 && event.context.get(1) == parent)
return true;
}
} while (true);
} catch (EOFException e) {
return false;
}
}
|
java
|
public boolean nextInnerElement(ElementContext parent) throws XMLException, IOException {
if (event.context.isEmpty()) return false;
if (Type.START_ELEMENT.equals(event.type) && event.context.getFirst() == parent && event.isClosed)
return false; // we are one the opening tag of the parent, and it is closed, so it has no content
if (Type.END_ELEMENT.equals(event.type) && event.context.getFirst() == parent)
return false;
try {
do {
next();
if (Type.END_ELEMENT.equals(event.type)) {
if (event.context.getFirst() == parent)
return false;
}
if (Type.START_ELEMENT.equals(event.type)) {
if (event.context.size() > 1 && event.context.get(1) == parent)
return true;
}
} while (true);
} catch (EOFException e) {
return false;
}
}
|
[
"public",
"boolean",
"nextInnerElement",
"(",
"ElementContext",
"parent",
")",
"throws",
"XMLException",
",",
"IOException",
"{",
"if",
"(",
"event",
".",
"context",
".",
"isEmpty",
"(",
")",
")",
"return",
"false",
";",
"if",
"(",
"Type",
".",
"START_ELEMENT",
".",
"equals",
"(",
"event",
".",
"type",
")",
"&&",
"event",
".",
"context",
".",
"getFirst",
"(",
")",
"==",
"parent",
"&&",
"event",
".",
"isClosed",
")",
"return",
"false",
";",
"// we are one the opening tag of the parent, and it is closed, so it has no content\r",
"if",
"(",
"Type",
".",
"END_ELEMENT",
".",
"equals",
"(",
"event",
".",
"type",
")",
"&&",
"event",
".",
"context",
".",
"getFirst",
"(",
")",
"==",
"parent",
")",
"return",
"false",
";",
"try",
"{",
"do",
"{",
"next",
"(",
")",
";",
"if",
"(",
"Type",
".",
"END_ELEMENT",
".",
"equals",
"(",
"event",
".",
"type",
")",
")",
"{",
"if",
"(",
"event",
".",
"context",
".",
"getFirst",
"(",
")",
"==",
"parent",
")",
"return",
"false",
";",
"}",
"if",
"(",
"Type",
".",
"START_ELEMENT",
".",
"equals",
"(",
"event",
".",
"type",
")",
")",
"{",
"if",
"(",
"event",
".",
"context",
".",
"size",
"(",
")",
">",
"1",
"&&",
"event",
".",
"context",
".",
"get",
"(",
"1",
")",
"==",
"parent",
")",
"return",
"true",
";",
"}",
"}",
"while",
"(",
"true",
")",
";",
"}",
"catch",
"(",
"EOFException",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}"
] |
Go to the next inner element. Return true if one is found, false if the closing tag of the parent is found.
|
[
"Go",
"to",
"the",
"next",
"inner",
"element",
".",
"Return",
"true",
"if",
"one",
"is",
"found",
"false",
"if",
"the",
"closing",
"tag",
"of",
"the",
"parent",
"is",
"found",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLStreamEventsSync.java#L39-L60
|
150,712
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLStreamEventsSync.java
|
XMLStreamEventsSync.nextInnerElement
|
public boolean nextInnerElement(ElementContext parent, String childName) throws XMLException, IOException {
while (nextInnerElement(parent)) {
if (event.text.equals(childName))
return true;
}
return false;
}
|
java
|
public boolean nextInnerElement(ElementContext parent, String childName) throws XMLException, IOException {
while (nextInnerElement(parent)) {
if (event.text.equals(childName))
return true;
}
return false;
}
|
[
"public",
"boolean",
"nextInnerElement",
"(",
"ElementContext",
"parent",
",",
"String",
"childName",
")",
"throws",
"XMLException",
",",
"IOException",
"{",
"while",
"(",
"nextInnerElement",
"(",
"parent",
")",
")",
"{",
"if",
"(",
"event",
".",
"text",
".",
"equals",
"(",
"childName",
")",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Go to the next inner element having the given name. Return true if one is found, false if the closing tag of the parent is found.
|
[
"Go",
"to",
"the",
"next",
"inner",
"element",
"having",
"the",
"given",
"name",
".",
"Return",
"true",
"if",
"one",
"is",
"found",
"false",
"if",
"the",
"closing",
"tag",
"of",
"the",
"parent",
"is",
"found",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLStreamEventsSync.java#L63-L69
|
150,713
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/application/ArtifactReference.java
|
ArtifactReference.matches
|
public boolean matches(String groupId, String artifactId) {
if (!"*".equals(this.groupId) && !this.groupId.equals(groupId))
return false;
if (!"*".equals(this.artifactId) && !this.artifactId.equals(artifactId))
return false;
return true;
}
|
java
|
public boolean matches(String groupId, String artifactId) {
if (!"*".equals(this.groupId) && !this.groupId.equals(groupId))
return false;
if (!"*".equals(this.artifactId) && !this.artifactId.equals(artifactId))
return false;
return true;
}
|
[
"public",
"boolean",
"matches",
"(",
"String",
"groupId",
",",
"String",
"artifactId",
")",
"{",
"if",
"(",
"!",
"\"*\"",
".",
"equals",
"(",
"this",
".",
"groupId",
")",
"&&",
"!",
"this",
".",
"groupId",
".",
"equals",
"(",
"groupId",
")",
")",
"return",
"false",
";",
"if",
"(",
"!",
"\"*\"",
".",
"equals",
"(",
"this",
".",
"artifactId",
")",
"&&",
"!",
"this",
".",
"artifactId",
".",
"equals",
"(",
"artifactId",
")",
")",
"return",
"false",
";",
"return",
"true",
";",
"}"
] |
Check the artifact referenced by this instance matches the given group and artifact id.
@param groupId group id
@param artifactId artifact id
@return true if it matches
|
[
"Check",
"the",
"artifact",
"referenced",
"by",
"this",
"instance",
"matches",
"the",
"given",
"group",
"and",
"artifact",
"id",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/application/ArtifactReference.java#L27-L33
|
150,714
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/info/FileSourceList.java
|
FileSourceList.getSourceAsFileSourceList
|
public List<File> getSourceAsFileSourceList(){
List<File> ret = new ArrayList<>();
for(FileSource fs : this.getSource()){
ret.add(fs.asFile());
}
return ret;
}
|
java
|
public List<File> getSourceAsFileSourceList(){
List<File> ret = new ArrayList<>();
for(FileSource fs : this.getSource()){
ret.add(fs.asFile());
}
return ret;
}
|
[
"public",
"List",
"<",
"File",
">",
"getSourceAsFileSourceList",
"(",
")",
"{",
"List",
"<",
"File",
">",
"ret",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"FileSource",
"fs",
":",
"this",
".",
"getSource",
"(",
")",
")",
"{",
"ret",
".",
"add",
"(",
"fs",
".",
"asFile",
"(",
")",
")",
";",
"}",
"return",
"ret",
";",
"}"
] |
Returns file list as a list of File objects.
@return a list of FileSource objects
|
[
"Returns",
"file",
"list",
"as",
"a",
"list",
"of",
"File",
"objects",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/info/FileSourceList.java#L73-L79
|
150,715
|
mazerty/torii
|
src/main/java/fr/mazerty/torii/cdi/LanguageProxy.java
|
LanguageProxy.set
|
public void set(Language language) {
this.language = language;
Cookie cookie = new Cookie(COOKIE_NAME, language.name());
cookie.setPath("/");
cookie.setMaxAge(Integer.MAX_VALUE);
VaadinService.getCurrentResponse().addCookie(cookie);
}
|
java
|
public void set(Language language) {
this.language = language;
Cookie cookie = new Cookie(COOKIE_NAME, language.name());
cookie.setPath("/");
cookie.setMaxAge(Integer.MAX_VALUE);
VaadinService.getCurrentResponse().addCookie(cookie);
}
|
[
"public",
"void",
"set",
"(",
"Language",
"language",
")",
"{",
"this",
".",
"language",
"=",
"language",
";",
"Cookie",
"cookie",
"=",
"new",
"Cookie",
"(",
"COOKIE_NAME",
",",
"language",
".",
"name",
"(",
")",
")",
";",
"cookie",
".",
"setPath",
"(",
"\"/\"",
")",
";",
"cookie",
".",
"setMaxAge",
"(",
"Integer",
".",
"MAX_VALUE",
")",
";",
"VaadinService",
".",
"getCurrentResponse",
"(",
")",
".",
"addCookie",
"(",
"cookie",
")",
";",
"}"
] |
Saves the new selected language in this session bean and in a cookie for future use
@param language the new selected language
|
[
"Saves",
"the",
"new",
"selected",
"language",
"in",
"this",
"session",
"bean",
"and",
"in",
"a",
"cookie",
"for",
"future",
"use"
] |
d162dff0a50b9c2b0a6415f6d359562461bf0cf1
|
https://github.com/mazerty/torii/blob/d162dff0a50b9c2b0a6415f6d359562461bf0cf1/src/main/java/fr/mazerty/torii/cdi/LanguageProxy.java#L50-L57
|
150,716
|
skuzzle/TinyPlugz
|
tiny-plugz/src/main/java/de/skuzzle/tinyplugz/util/Closeables.java
|
Closeables.close
|
public static void close(Iterable<? extends Closeable> closeables)
throws IOException {
IOException first = null;
for (final Closeable c : closeables) {
if (c == null) {
LOG.debug("trying to call .close() on null reference");
continue;
}
try {
c.close();
} catch (final IOException e) {
if (first == null) {
first = e;
} else {
first.addSuppressed(e);
}
}
}
if (first != null) {
throw first;
}
}
|
java
|
public static void close(Iterable<? extends Closeable> closeables)
throws IOException {
IOException first = null;
for (final Closeable c : closeables) {
if (c == null) {
LOG.debug("trying to call .close() on null reference");
continue;
}
try {
c.close();
} catch (final IOException e) {
if (first == null) {
first = e;
} else {
first.addSuppressed(e);
}
}
}
if (first != null) {
throw first;
}
}
|
[
"public",
"static",
"void",
"close",
"(",
"Iterable",
"<",
"?",
"extends",
"Closeable",
">",
"closeables",
")",
"throws",
"IOException",
"{",
"IOException",
"first",
"=",
"null",
";",
"for",
"(",
"final",
"Closeable",
"c",
":",
"closeables",
")",
"{",
"if",
"(",
"c",
"==",
"null",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"trying to call .close() on null reference\"",
")",
";",
"continue",
";",
"}",
"try",
"{",
"c",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"IOException",
"e",
")",
"{",
"if",
"(",
"first",
"==",
"null",
")",
"{",
"first",
"=",
"e",
";",
"}",
"else",
"{",
"first",
".",
"addSuppressed",
"(",
"e",
")",
";",
"}",
"}",
"}",
"if",
"(",
"first",
"!=",
"null",
")",
"{",
"throw",
"first",
";",
"}",
"}"
] |
Closes the given Closeables and collects all occurring exceptions as
suppressed exception to the exception that occurred first.
@param closeables The Closeables to close.
@throws IOException If any of them throws an IOException.
|
[
"Closes",
"the",
"given",
"Closeables",
"and",
"collects",
"all",
"occurring",
"exceptions",
"as",
"suppressed",
"exception",
"to",
"the",
"exception",
"that",
"occurred",
"first",
"."
] |
739858ed0ba5a0c75b6ccf18df9a4d5612374a4b
|
https://github.com/skuzzle/TinyPlugz/blob/739858ed0ba5a0c75b6ccf18df9a4d5612374a4b/tiny-plugz/src/main/java/de/skuzzle/tinyplugz/util/Closeables.java#L44-L65
|
150,717
|
simlife/simlife
|
simlife-framework/src/main/java/io/github/simlife/config/apidoc/SwaggerAutoConfiguration.java
|
SwaggerAutoConfiguration.swaggerSpringfoxApiDocket
|
@Bean
@ConditionalOnMissingBean(name = "swaggerSpringfoxApiDocket")
public Docket swaggerSpringfoxApiDocket(List<SwaggerCustomizer> swaggerCustomizers,
ObjectProvider<AlternateTypeRule[]> alternateTypeRules) {
log.debug(STARTING_MESSAGE);
StopWatch watch = new StopWatch();
watch.start();
Docket docket = createDocket();
// Apply all SwaggerCustomizers orderly.
swaggerCustomizers.forEach(customizer -> customizer.customize(docket));
// Add all AlternateTypeRules if available in spring bean factory.
// Also you can add your rules in a customizer bean above.
Optional.ofNullable(alternateTypeRules.getIfAvailable()).ifPresent(docket::alternateTypeRules);
watch.stop();
log.debug(STARTED_MESSAGE, watch.getTotalTimeMillis());
return docket;
}
|
java
|
@Bean
@ConditionalOnMissingBean(name = "swaggerSpringfoxApiDocket")
public Docket swaggerSpringfoxApiDocket(List<SwaggerCustomizer> swaggerCustomizers,
ObjectProvider<AlternateTypeRule[]> alternateTypeRules) {
log.debug(STARTING_MESSAGE);
StopWatch watch = new StopWatch();
watch.start();
Docket docket = createDocket();
// Apply all SwaggerCustomizers orderly.
swaggerCustomizers.forEach(customizer -> customizer.customize(docket));
// Add all AlternateTypeRules if available in spring bean factory.
// Also you can add your rules in a customizer bean above.
Optional.ofNullable(alternateTypeRules.getIfAvailable()).ifPresent(docket::alternateTypeRules);
watch.stop();
log.debug(STARTED_MESSAGE, watch.getTotalTimeMillis());
return docket;
}
|
[
"@",
"Bean",
"@",
"ConditionalOnMissingBean",
"(",
"name",
"=",
"\"swaggerSpringfoxApiDocket\"",
")",
"public",
"Docket",
"swaggerSpringfoxApiDocket",
"(",
"List",
"<",
"SwaggerCustomizer",
">",
"swaggerCustomizers",
",",
"ObjectProvider",
"<",
"AlternateTypeRule",
"[",
"]",
">",
"alternateTypeRules",
")",
"{",
"log",
".",
"debug",
"(",
"STARTING_MESSAGE",
")",
";",
"StopWatch",
"watch",
"=",
"new",
"StopWatch",
"(",
")",
";",
"watch",
".",
"start",
"(",
")",
";",
"Docket",
"docket",
"=",
"createDocket",
"(",
")",
";",
"// Apply all SwaggerCustomizers orderly.",
"swaggerCustomizers",
".",
"forEach",
"(",
"customizer",
"->",
"customizer",
".",
"customize",
"(",
"docket",
")",
")",
";",
"// Add all AlternateTypeRules if available in spring bean factory.",
"// Also you can add your rules in a customizer bean above.",
"Optional",
".",
"ofNullable",
"(",
"alternateTypeRules",
".",
"getIfAvailable",
"(",
")",
")",
".",
"ifPresent",
"(",
"docket",
"::",
"alternateTypeRules",
")",
";",
"watch",
".",
"stop",
"(",
")",
";",
"log",
".",
"debug",
"(",
"STARTED_MESSAGE",
",",
"watch",
".",
"getTotalTimeMillis",
"(",
")",
")",
";",
"return",
"docket",
";",
"}"
] |
Springfox configuration for the API Swagger docs.
@param swaggerCustomizers Swagger customizers
@param alternateTypeRules alternate type rules
@return the Swagger Springfox configuration
|
[
"Springfox",
"configuration",
"for",
"the",
"API",
"Swagger",
"docs",
"."
] |
357bb8f3fb39e085239b89bc7f9a19248ff3d0bb
|
https://github.com/simlife/simlife/blob/357bb8f3fb39e085239b89bc7f9a19248ff3d0bb/simlife-framework/src/main/java/io/github/simlife/config/apidoc/SwaggerAutoConfiguration.java#L92-L112
|
150,718
|
livetribe/livetribe-slp
|
core/src/main/java/org/livetribe/slp/spi/msg/AttributeListExtension.java
|
AttributeListExtension.findFirst
|
public static AttributeListExtension findFirst(Collection<? extends Extension> extensions)
{
for (Extension extension : extensions)
{
if (ATTRIBUTE_LIST_EXTENSION_ID == extension.getId())
return (AttributeListExtension)extension;
}
return null;
}
|
java
|
public static AttributeListExtension findFirst(Collection<? extends Extension> extensions)
{
for (Extension extension : extensions)
{
if (ATTRIBUTE_LIST_EXTENSION_ID == extension.getId())
return (AttributeListExtension)extension;
}
return null;
}
|
[
"public",
"static",
"AttributeListExtension",
"findFirst",
"(",
"Collection",
"<",
"?",
"extends",
"Extension",
">",
"extensions",
")",
"{",
"for",
"(",
"Extension",
"extension",
":",
"extensions",
")",
"{",
"if",
"(",
"ATTRIBUTE_LIST_EXTENSION_ID",
"==",
"extension",
".",
"getId",
"(",
")",
")",
"return",
"(",
"AttributeListExtension",
")",
"extension",
";",
"}",
"return",
"null",
";",
"}"
] |
Returns the first AttributeListExtension found in the given collection of extensions,
or null if the extension collection does not contain an AttributeListExtension.
|
[
"Returns",
"the",
"first",
"AttributeListExtension",
"found",
"in",
"the",
"given",
"collection",
"of",
"extensions",
"or",
"null",
"if",
"the",
"extension",
"collection",
"does",
"not",
"contain",
"an",
"AttributeListExtension",
"."
] |
6cc13dbe81feab133fe3dd291ca081cbc6e1f591
|
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/spi/msg/AttributeListExtension.java#L167-L175
|
150,719
|
livetribe/livetribe-slp
|
core/src/main/java/org/livetribe/slp/spi/msg/AttributeListExtension.java
|
AttributeListExtension.findAll
|
public static List<AttributeListExtension> findAll(Collection<? extends Extension> extensions)
{
List<AttributeListExtension> result = new ArrayList<AttributeListExtension>();
for (Extension extension : extensions)
{
if (ATTRIBUTE_LIST_EXTENSION_ID == extension.getId())
result.add((AttributeListExtension)extension);
}
return result;
}
|
java
|
public static List<AttributeListExtension> findAll(Collection<? extends Extension> extensions)
{
List<AttributeListExtension> result = new ArrayList<AttributeListExtension>();
for (Extension extension : extensions)
{
if (ATTRIBUTE_LIST_EXTENSION_ID == extension.getId())
result.add((AttributeListExtension)extension);
}
return result;
}
|
[
"public",
"static",
"List",
"<",
"AttributeListExtension",
">",
"findAll",
"(",
"Collection",
"<",
"?",
"extends",
"Extension",
">",
"extensions",
")",
"{",
"List",
"<",
"AttributeListExtension",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"AttributeListExtension",
">",
"(",
")",
";",
"for",
"(",
"Extension",
"extension",
":",
"extensions",
")",
"{",
"if",
"(",
"ATTRIBUTE_LIST_EXTENSION_ID",
"==",
"extension",
".",
"getId",
"(",
")",
")",
"result",
".",
"add",
"(",
"(",
"AttributeListExtension",
")",
"extension",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Returns all AttributeListExtensions found in the given collection of extensions,
or an empty list if the extension collection does not contain AttributeListExtensions.
|
[
"Returns",
"all",
"AttributeListExtensions",
"found",
"in",
"the",
"given",
"collection",
"of",
"extensions",
"or",
"an",
"empty",
"list",
"if",
"the",
"extension",
"collection",
"does",
"not",
"contain",
"AttributeListExtensions",
"."
] |
6cc13dbe81feab133fe3dd291ca081cbc6e1f591
|
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/spi/msg/AttributeListExtension.java#L181-L190
|
150,720
|
devnull-tools/kodo
|
src/main/java/tools/devnull/kodo/Expectation.java
|
Expectation.beNull
|
public <T> Predicate<T> beNull(Class<T> type) {
return create(Objects::isNull);
}
|
java
|
public <T> Predicate<T> beNull(Class<T> type) {
return create(Objects::isNull);
}
|
[
"public",
"<",
"T",
">",
"Predicate",
"<",
"T",
">",
"beNull",
"(",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"create",
"(",
"Objects",
"::",
"isNull",
")",
";",
"}"
] |
A predicate that tests if the object is null.
@return a predicate that tests if the object is null.
@since 3.4
|
[
"A",
"predicate",
"that",
"tests",
"if",
"the",
"object",
"is",
"null",
"."
] |
02448b8fe8308a78116de650bc077e196b100999
|
https://github.com/devnull-tools/kodo/blob/02448b8fe8308a78116de650bc077e196b100999/src/main/java/tools/devnull/kodo/Expectation.java#L77-L79
|
150,721
|
devnull-tools/kodo
|
src/main/java/tools/devnull/kodo/Expectation.java
|
Expectation.raise
|
public Predicate<Exception> raise(Class<? extends Exception> exception) {
return create(error -> error != null && exception.isAssignableFrom(error.getClass()));
}
|
java
|
public Predicate<Exception> raise(Class<? extends Exception> exception) {
return create(error -> error != null && exception.isAssignableFrom(error.getClass()));
}
|
[
"public",
"Predicate",
"<",
"Exception",
">",
"raise",
"(",
"Class",
"<",
"?",
"extends",
"Exception",
">",
"exception",
")",
"{",
"return",
"create",
"(",
"error",
"->",
"error",
"!=",
"null",
"&&",
"exception",
".",
"isAssignableFrom",
"(",
"error",
".",
"getClass",
"(",
")",
")",
")",
";",
"}"
] |
Indicates that the operation should throw the given exception.
|
[
"Indicates",
"that",
"the",
"operation",
"should",
"throw",
"the",
"given",
"exception",
"."
] |
02448b8fe8308a78116de650bc077e196b100999
|
https://github.com/devnull-tools/kodo/blob/02448b8fe8308a78116de650bc077e196b100999/src/main/java/tools/devnull/kodo/Expectation.java#L117-L119
|
150,722
|
mgledi/DRUMS
|
src/main/java/com/unister/semweb/drums/bucket/BucketSplitter.java
|
BucketSplitter.moveElements
|
protected void moveElements(HeaderIndexFile<Data> source, RangeHashFunction targetHashfunction, String workingDir)
throws IOException, FileLockException {
ByteBuffer elem = ByteBuffer.allocate(source.getElementSize());
HeaderIndexFile<Data> tmp = null;
newBucketIds = new IntArrayList();
long offset = 0;
byte[] key = new byte[gp.getKeySize()];
int oldBucket = -1, newBucket;
while (offset < source.getFilledUpFromContentStart()) {
source.read(offset, elem);
elem.rewind();
elem.get(key);
newBucket = targetHashfunction.getBucketId(key);
if (newBucket != oldBucket) {
this.newBucketIds.add(newBucket);
if (tmp != null) {
tmp.close();
}
String fileName = workingDir + "/" + targetHashfunction.getFilename(newBucket);
tmp = new HeaderIndexFile<Data>(fileName, AccessMode.READ_WRITE, 100, gp);
oldBucket = newBucket;
}
tmp.append(elem);
offset += elem.limit();
}
if (tmp != null)
tmp.close();
}
|
java
|
protected void moveElements(HeaderIndexFile<Data> source, RangeHashFunction targetHashfunction, String workingDir)
throws IOException, FileLockException {
ByteBuffer elem = ByteBuffer.allocate(source.getElementSize());
HeaderIndexFile<Data> tmp = null;
newBucketIds = new IntArrayList();
long offset = 0;
byte[] key = new byte[gp.getKeySize()];
int oldBucket = -1, newBucket;
while (offset < source.getFilledUpFromContentStart()) {
source.read(offset, elem);
elem.rewind();
elem.get(key);
newBucket = targetHashfunction.getBucketId(key);
if (newBucket != oldBucket) {
this.newBucketIds.add(newBucket);
if (tmp != null) {
tmp.close();
}
String fileName = workingDir + "/" + targetHashfunction.getFilename(newBucket);
tmp = new HeaderIndexFile<Data>(fileName, AccessMode.READ_WRITE, 100, gp);
oldBucket = newBucket;
}
tmp.append(elem);
offset += elem.limit();
}
if (tmp != null)
tmp.close();
}
|
[
"protected",
"void",
"moveElements",
"(",
"HeaderIndexFile",
"<",
"Data",
">",
"source",
",",
"RangeHashFunction",
"targetHashfunction",
",",
"String",
"workingDir",
")",
"throws",
"IOException",
",",
"FileLockException",
"{",
"ByteBuffer",
"elem",
"=",
"ByteBuffer",
".",
"allocate",
"(",
"source",
".",
"getElementSize",
"(",
")",
")",
";",
"HeaderIndexFile",
"<",
"Data",
">",
"tmp",
"=",
"null",
";",
"newBucketIds",
"=",
"new",
"IntArrayList",
"(",
")",
";",
"long",
"offset",
"=",
"0",
";",
"byte",
"[",
"]",
"key",
"=",
"new",
"byte",
"[",
"gp",
".",
"getKeySize",
"(",
")",
"]",
";",
"int",
"oldBucket",
"=",
"-",
"1",
",",
"newBucket",
";",
"while",
"(",
"offset",
"<",
"source",
".",
"getFilledUpFromContentStart",
"(",
")",
")",
"{",
"source",
".",
"read",
"(",
"offset",
",",
"elem",
")",
";",
"elem",
".",
"rewind",
"(",
")",
";",
"elem",
".",
"get",
"(",
"key",
")",
";",
"newBucket",
"=",
"targetHashfunction",
".",
"getBucketId",
"(",
"key",
")",
";",
"if",
"(",
"newBucket",
"!=",
"oldBucket",
")",
"{",
"this",
".",
"newBucketIds",
".",
"add",
"(",
"newBucket",
")",
";",
"if",
"(",
"tmp",
"!=",
"null",
")",
"{",
"tmp",
".",
"close",
"(",
")",
";",
"}",
"String",
"fileName",
"=",
"workingDir",
"+",
"\"/\"",
"+",
"targetHashfunction",
".",
"getFilename",
"(",
"newBucket",
")",
";",
"tmp",
"=",
"new",
"HeaderIndexFile",
"<",
"Data",
">",
"(",
"fileName",
",",
"AccessMode",
".",
"READ_WRITE",
",",
"100",
",",
"gp",
")",
";",
"oldBucket",
"=",
"newBucket",
";",
"}",
"tmp",
".",
"append",
"(",
"elem",
")",
";",
"offset",
"+=",
"elem",
".",
"limit",
"(",
")",
";",
"}",
"if",
"(",
"tmp",
"!=",
"null",
")",
"tmp",
".",
"close",
"(",
")",
";",
"}"
] |
moves elements from the source file to new smaller files. The filenames are generated automatically
@param source
@param targetHashfunction
@param workingDir
@throws IOException
@throws FileLockException
|
[
"moves",
"elements",
"from",
"the",
"source",
"file",
"to",
"new",
"smaller",
"files",
".",
"The",
"filenames",
"are",
"generated",
"automatically"
] |
a670f17a2186c9a15725f26617d77ce8e444e072
|
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/bucket/BucketSplitter.java#L110-L139
|
150,723
|
mgledi/DRUMS
|
src/main/java/com/unister/semweb/drums/bucket/BucketSplitter.java
|
BucketSplitter.determineElementsPerPart
|
protected int determineElementsPerPart(int numberOfPartitions) {
double numberOfElementsWithinFile = sourceFile.getFilledUpFromContentStart() / sourceFile.getElementSize();
double elementsPerPart = numberOfElementsWithinFile / numberOfPartitions;
int roundNumber = (int) Math.ceil(elementsPerPart);
return roundNumber;
}
|
java
|
protected int determineElementsPerPart(int numberOfPartitions) {
double numberOfElementsWithinFile = sourceFile.getFilledUpFromContentStart() / sourceFile.getElementSize();
double elementsPerPart = numberOfElementsWithinFile / numberOfPartitions;
int roundNumber = (int) Math.ceil(elementsPerPart);
return roundNumber;
}
|
[
"protected",
"int",
"determineElementsPerPart",
"(",
"int",
"numberOfPartitions",
")",
"{",
"double",
"numberOfElementsWithinFile",
"=",
"sourceFile",
".",
"getFilledUpFromContentStart",
"(",
")",
"/",
"sourceFile",
".",
"getElementSize",
"(",
")",
";",
"double",
"elementsPerPart",
"=",
"numberOfElementsWithinFile",
"/",
"numberOfPartitions",
";",
"int",
"roundNumber",
"=",
"(",
"int",
")",
"Math",
".",
"ceil",
"(",
"elementsPerPart",
")",
";",
"return",
"roundNumber",
";",
"}"
] |
Determines the number of elements when the partitions must have equal sizes
@param numberOfPartitions
@return int
|
[
"Determines",
"the",
"number",
"of",
"elements",
"when",
"the",
"partitions",
"must",
"have",
"equal",
"sizes"
] |
a670f17a2186c9a15725f26617d77ce8e444e072
|
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/bucket/BucketSplitter.java#L147-L152
|
150,724
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mod/loader/tracker/ScreamTrackerOldMod.java
|
ScreamTrackerOldMod.getModType
|
private String getModType(String kennung) throws IOException
{
if (!kennung.equals("!Scream!"))
throw new IOException("Mod id: " + kennung + ": this is not a screamtracker mod");
setNSamples(31);
setNChannels(4);
return "ScreamTracker";
}
|
java
|
private String getModType(String kennung) throws IOException
{
if (!kennung.equals("!Scream!"))
throw new IOException("Mod id: " + kennung + ": this is not a screamtracker mod");
setNSamples(31);
setNChannels(4);
return "ScreamTracker";
}
|
[
"private",
"String",
"getModType",
"(",
"String",
"kennung",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"kennung",
".",
"equals",
"(",
"\"!Scream!\"",
")",
")",
"throw",
"new",
"IOException",
"(",
"\"Mod id: \"",
"+",
"kennung",
"+",
"\": this is not a screamtracker mod\"",
")",
";",
"setNSamples",
"(",
"31",
")",
";",
"setNChannels",
"(",
"4",
")",
";",
"return",
"\"ScreamTracker\"",
";",
"}"
] |
Get the current modtype
@param kennung
@return
|
[
"Get",
"the",
"current",
"modtype"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/loader/tracker/ScreamTrackerOldMod.java#L147-L155
|
150,725
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mod/loader/tracker/ScreamTrackerOldMod.java
|
ScreamTrackerOldMod.createNewPatternElement
|
private PatternElement createNewPatternElement(int pattNum, int row, int channel, int note)
{
PatternElement pe = new PatternElement(pattNum, row, channel);
pe.setInstrument((note&0xF80000)>>19);
int oktave = (note&0xF0000000)>>28;
if (oktave!=-1)
{
int ton = (note&0x0F000000)>>24;
int index = (oktave+3)*12+ton; // fit to it octaves
pe.setPeriod((index<Helpers.noteValues.length) ? Helpers.noteValues[index] : 0);
pe.setNoteIndex(index+1);
}
else
{
pe.setPeriod(0);
pe.setNoteIndex(0);
}
pe.setEffekt((note&0xF00)>>8);
pe.setEffektOp(note&0xFF);
if (pe.getEffekt()==0x01) // set Tempo needs correction. Do not ask why!
{
int effektOp = pe.getEffektOp();
pe.setEffektOp(((effektOp&0x0F)<<4) | ((effektOp&0xF0)>>4));
}
int volume =((note&0x70000)>>16) | ((note&0xF000)>>9);
if (volume<=64)
{
pe.setVolumeEffekt(1);
pe.setVolumeEffektOp(volume);
}
return pe;
}
|
java
|
private PatternElement createNewPatternElement(int pattNum, int row, int channel, int note)
{
PatternElement pe = new PatternElement(pattNum, row, channel);
pe.setInstrument((note&0xF80000)>>19);
int oktave = (note&0xF0000000)>>28;
if (oktave!=-1)
{
int ton = (note&0x0F000000)>>24;
int index = (oktave+3)*12+ton; // fit to it octaves
pe.setPeriod((index<Helpers.noteValues.length) ? Helpers.noteValues[index] : 0);
pe.setNoteIndex(index+1);
}
else
{
pe.setPeriod(0);
pe.setNoteIndex(0);
}
pe.setEffekt((note&0xF00)>>8);
pe.setEffektOp(note&0xFF);
if (pe.getEffekt()==0x01) // set Tempo needs correction. Do not ask why!
{
int effektOp = pe.getEffektOp();
pe.setEffektOp(((effektOp&0x0F)<<4) | ((effektOp&0xF0)>>4));
}
int volume =((note&0x70000)>>16) | ((note&0xF000)>>9);
if (volume<=64)
{
pe.setVolumeEffekt(1);
pe.setVolumeEffektOp(volume);
}
return pe;
}
|
[
"private",
"PatternElement",
"createNewPatternElement",
"(",
"int",
"pattNum",
",",
"int",
"row",
",",
"int",
"channel",
",",
"int",
"note",
")",
"{",
"PatternElement",
"pe",
"=",
"new",
"PatternElement",
"(",
"pattNum",
",",
"row",
",",
"channel",
")",
";",
"pe",
".",
"setInstrument",
"(",
"(",
"note",
"&",
"0xF80000",
")",
">>",
"19",
")",
";",
"int",
"oktave",
"=",
"(",
"note",
"&",
"0xF0000000",
")",
">>",
"28",
";",
"if",
"(",
"oktave",
"!=",
"-",
"1",
")",
"{",
"int",
"ton",
"=",
"(",
"note",
"&",
"0x0F000000",
")",
">>",
"24",
";",
"int",
"index",
"=",
"(",
"oktave",
"+",
"3",
")",
"*",
"12",
"+",
"ton",
";",
"// fit to it octaves",
"pe",
".",
"setPeriod",
"(",
"(",
"index",
"<",
"Helpers",
".",
"noteValues",
".",
"length",
")",
"?",
"Helpers",
".",
"noteValues",
"[",
"index",
"]",
":",
"0",
")",
";",
"pe",
".",
"setNoteIndex",
"(",
"index",
"+",
"1",
")",
";",
"}",
"else",
"{",
"pe",
".",
"setPeriod",
"(",
"0",
")",
";",
"pe",
".",
"setNoteIndex",
"(",
"0",
")",
";",
"}",
"pe",
".",
"setEffekt",
"(",
"(",
"note",
"&",
"0xF00",
")",
">>",
"8",
")",
";",
"pe",
".",
"setEffektOp",
"(",
"note",
"&",
"0xFF",
")",
";",
"if",
"(",
"pe",
".",
"getEffekt",
"(",
")",
"==",
"0x01",
")",
"// set Tempo needs correction. Do not ask why!",
"{",
"int",
"effektOp",
"=",
"pe",
".",
"getEffektOp",
"(",
")",
";",
"pe",
".",
"setEffektOp",
"(",
"(",
"(",
"effektOp",
"&",
"0x0F",
")",
"<<",
"4",
")",
"|",
"(",
"(",
"effektOp",
"&",
"0xF0",
")",
">>",
"4",
")",
")",
";",
"}",
"int",
"volume",
"=",
"(",
"(",
"note",
"&",
"0x70000",
")",
">>",
"16",
")",
"|",
"(",
"(",
"note",
"&",
"0xF000",
")",
">>",
"9",
")",
";",
"if",
"(",
"volume",
"<=",
"64",
")",
"{",
"pe",
".",
"setVolumeEffekt",
"(",
"1",
")",
";",
"pe",
".",
"setVolumeEffektOp",
"(",
"volume",
")",
";",
"}",
"return",
"pe",
";",
"}"
] |
Read the STM pattern data
@param pattNum
@param row
@param channel
@param note
@return
|
[
"Read",
"the",
"STM",
"pattern",
"data"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/loader/tracker/ScreamTrackerOldMod.java#L164-L200
|
150,726
|
rwl/CSparseJ
|
src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_post.java
|
DZcs_post.cs_post
|
public static int[] cs_post(int[] parent, int n)
{
int j, k = 0, post[], w[], head[], next[], stack[] ;
if (parent == null) return (null) ; /* check inputs */
post = new int [n] ; /* allocate result */
w = new int [3*n] ; /* get workspace */
if (w == null || post == null) return (cs_idone (post, null, w, false)) ;
head = w ; next = w ;
int next_offset = n ;
stack = w ;
int stack_offset = 2*n ;
for (j = 0 ; j < n ; j++) head [j] = -1 ; /* empty linked lists */
for (j = n-1 ; j >= 0 ; j--) /* traverse nodes in reverse order*/
{
if (parent [j] == -1) continue; /* j is a root */
next [next_offset + j] = head [parent [j]] ; /* add j to list of its parent */
head [parent [j]] = j ;
}
for (j = 0 ; j < n ; j++)
{
if (parent [j] != -1) continue ; /* skip j if it is not a root */
k = cs_tdfs(j, k, head, 0, next, next_offset, post, 0, stack, stack_offset) ;
}
return (post) ;
}
|
java
|
public static int[] cs_post(int[] parent, int n)
{
int j, k = 0, post[], w[], head[], next[], stack[] ;
if (parent == null) return (null) ; /* check inputs */
post = new int [n] ; /* allocate result */
w = new int [3*n] ; /* get workspace */
if (w == null || post == null) return (cs_idone (post, null, w, false)) ;
head = w ; next = w ;
int next_offset = n ;
stack = w ;
int stack_offset = 2*n ;
for (j = 0 ; j < n ; j++) head [j] = -1 ; /* empty linked lists */
for (j = n-1 ; j >= 0 ; j--) /* traverse nodes in reverse order*/
{
if (parent [j] == -1) continue; /* j is a root */
next [next_offset + j] = head [parent [j]] ; /* add j to list of its parent */
head [parent [j]] = j ;
}
for (j = 0 ; j < n ; j++)
{
if (parent [j] != -1) continue ; /* skip j if it is not a root */
k = cs_tdfs(j, k, head, 0, next, next_offset, post, 0, stack, stack_offset) ;
}
return (post) ;
}
|
[
"public",
"static",
"int",
"[",
"]",
"cs_post",
"(",
"int",
"[",
"]",
"parent",
",",
"int",
"n",
")",
"{",
"int",
"j",
",",
"k",
"=",
"0",
",",
"post",
"[",
"]",
",",
"w",
"[",
"]",
",",
"head",
"[",
"]",
",",
"next",
"[",
"]",
",",
"stack",
"[",
"]",
";",
"if",
"(",
"parent",
"==",
"null",
")",
"return",
"(",
"null",
")",
";",
"/* check inputs */",
"post",
"=",
"new",
"int",
"[",
"n",
"]",
";",
"/* allocate result */",
"w",
"=",
"new",
"int",
"[",
"3",
"*",
"n",
"]",
";",
"/* get workspace */",
"if",
"(",
"w",
"==",
"null",
"||",
"post",
"==",
"null",
")",
"return",
"(",
"cs_idone",
"(",
"post",
",",
"null",
",",
"w",
",",
"false",
")",
")",
";",
"head",
"=",
"w",
";",
"next",
"=",
"w",
";",
"int",
"next_offset",
"=",
"n",
";",
"stack",
"=",
"w",
";",
"int",
"stack_offset",
"=",
"2",
"*",
"n",
";",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"n",
";",
"j",
"++",
")",
"head",
"[",
"j",
"]",
"=",
"-",
"1",
";",
"/* empty linked lists */",
"for",
"(",
"j",
"=",
"n",
"-",
"1",
";",
"j",
">=",
"0",
";",
"j",
"--",
")",
"/* traverse nodes in reverse order*/",
"{",
"if",
"(",
"parent",
"[",
"j",
"]",
"==",
"-",
"1",
")",
"continue",
";",
"/* j is a root */",
"next",
"[",
"next_offset",
"+",
"j",
"]",
"=",
"head",
"[",
"parent",
"[",
"j",
"]",
"]",
";",
"/* add j to list of its parent */",
"head",
"[",
"parent",
"[",
"j",
"]",
"]",
"=",
"j",
";",
"}",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"n",
";",
"j",
"++",
")",
"{",
"if",
"(",
"parent",
"[",
"j",
"]",
"!=",
"-",
"1",
")",
"continue",
";",
"/* skip j if it is not a root */",
"k",
"=",
"cs_tdfs",
"(",
"j",
",",
"k",
",",
"head",
",",
"0",
",",
"next",
",",
"next_offset",
",",
"post",
",",
"0",
",",
"stack",
",",
"stack_offset",
")",
";",
"}",
"return",
"(",
"post",
")",
";",
"}"
] |
Postorders a tree of forest.
@param parent
defines a tree of n nodes
@param n
length of parent
@return post[k]=i, null on error
|
[
"Postorders",
"a",
"tree",
"of",
"forest",
"."
] |
6a6f66bccce1558156a961494358952603b0ac84
|
https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_post.java#L48-L72
|
150,727
|
skuzzle/TinyPlugz
|
tiny-plugz/src/main/java/de/skuzzle/tinyplugz/internal/DelegateClassLoader.java
|
DelegateClassLoader.forPlugins
|
public static DelegateClassLoader forPlugins(Stream<URL> urls,
ClassLoader appClassLoader) {
Require.nonNull(urls, "urls");
Require.nonNull(appClassLoader, "parent");
final Collection<DependencyResolver> plugins = new ArrayList<>();
final Collection<PluginInformation> information = new ArrayList<>();
final DependencyResolver delegator = new DelegateDependencyResolver(plugins);
final Iterator<URL> it = urls.iterator();
while (it.hasNext()) {
final URL pluginURL = it.next();
// Plugin classloaders must be created with the application
// classloader as parent. This is mandatory for establishing a sound
// locking strategy during class lookup.
final PluginClassLoader pluginCl = PluginClassLoader.create(pluginURL,
appClassLoader, delegator);
plugins.add(pluginCl);
information.add(pluginCl.getPluginInformation());
}
return AccessController.doPrivileged(new PrivilegedAction<DelegateClassLoader>() {
@Override
public DelegateClassLoader run() {
return new DelegateClassLoader(appClassLoader, delegator, information);
}
});
}
|
java
|
public static DelegateClassLoader forPlugins(Stream<URL> urls,
ClassLoader appClassLoader) {
Require.nonNull(urls, "urls");
Require.nonNull(appClassLoader, "parent");
final Collection<DependencyResolver> plugins = new ArrayList<>();
final Collection<PluginInformation> information = new ArrayList<>();
final DependencyResolver delegator = new DelegateDependencyResolver(plugins);
final Iterator<URL> it = urls.iterator();
while (it.hasNext()) {
final URL pluginURL = it.next();
// Plugin classloaders must be created with the application
// classloader as parent. This is mandatory for establishing a sound
// locking strategy during class lookup.
final PluginClassLoader pluginCl = PluginClassLoader.create(pluginURL,
appClassLoader, delegator);
plugins.add(pluginCl);
information.add(pluginCl.getPluginInformation());
}
return AccessController.doPrivileged(new PrivilegedAction<DelegateClassLoader>() {
@Override
public DelegateClassLoader run() {
return new DelegateClassLoader(appClassLoader, delegator, information);
}
});
}
|
[
"public",
"static",
"DelegateClassLoader",
"forPlugins",
"(",
"Stream",
"<",
"URL",
">",
"urls",
",",
"ClassLoader",
"appClassLoader",
")",
"{",
"Require",
".",
"nonNull",
"(",
"urls",
",",
"\"urls\"",
")",
";",
"Require",
".",
"nonNull",
"(",
"appClassLoader",
",",
"\"parent\"",
")",
";",
"final",
"Collection",
"<",
"DependencyResolver",
">",
"plugins",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"final",
"Collection",
"<",
"PluginInformation",
">",
"information",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"final",
"DependencyResolver",
"delegator",
"=",
"new",
"DelegateDependencyResolver",
"(",
"plugins",
")",
";",
"final",
"Iterator",
"<",
"URL",
">",
"it",
"=",
"urls",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"final",
"URL",
"pluginURL",
"=",
"it",
".",
"next",
"(",
")",
";",
"// Plugin classloaders must be created with the application",
"// classloader as parent. This is mandatory for establishing a sound",
"// locking strategy during class lookup.",
"final",
"PluginClassLoader",
"pluginCl",
"=",
"PluginClassLoader",
".",
"create",
"(",
"pluginURL",
",",
"appClassLoader",
",",
"delegator",
")",
";",
"plugins",
".",
"add",
"(",
"pluginCl",
")",
";",
"information",
".",
"add",
"(",
"pluginCl",
".",
"getPluginInformation",
"(",
")",
")",
";",
"}",
"return",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"DelegateClassLoader",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"DelegateClassLoader",
"run",
"(",
")",
"{",
"return",
"new",
"DelegateClassLoader",
"(",
"appClassLoader",
",",
"delegator",
",",
"information",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Creates a new ClassLoader which provides access to all plugins given by
the collection of URLs.
@param urls The URLs, each pointing to a plugin to be loaded.
@param appClassLoader The ClassLoader to use as parent.
@return The created ClassLoader.
|
[
"Creates",
"a",
"new",
"ClassLoader",
"which",
"provides",
"access",
"to",
"all",
"plugins",
"given",
"by",
"the",
"collection",
"of",
"URLs",
"."
] |
739858ed0ba5a0c75b6ccf18df9a4d5612374a4b
|
https://github.com/skuzzle/TinyPlugz/blob/739858ed0ba5a0c75b6ccf18df9a4d5612374a4b/tiny-plugz/src/main/java/de/skuzzle/tinyplugz/internal/DelegateClassLoader.java#L63-L89
|
150,728
|
skuzzle/TinyPlugz
|
tiny-plugz/src/main/java/de/skuzzle/tinyplugz/internal/DelegateClassLoader.java
|
DelegateClassLoader.getInformation
|
public final Optional<PluginInformation> getInformation(String pluginName) {
Require.nonNull(pluginName, "pluginName");
return Optional.ofNullable(this.information.get(pluginName));
}
|
java
|
public final Optional<PluginInformation> getInformation(String pluginName) {
Require.nonNull(pluginName, "pluginName");
return Optional.ofNullable(this.information.get(pluginName));
}
|
[
"public",
"final",
"Optional",
"<",
"PluginInformation",
">",
"getInformation",
"(",
"String",
"pluginName",
")",
"{",
"Require",
".",
"nonNull",
"(",
"pluginName",
",",
"\"pluginName\"",
")",
";",
"return",
"Optional",
".",
"ofNullable",
"(",
"this",
".",
"information",
".",
"get",
"(",
"pluginName",
")",
")",
";",
"}"
] |
Information about loaded plugin with given name.
@param pluginName The plugin name.
@return Information about that plugin.
|
[
"Information",
"about",
"loaded",
"plugin",
"with",
"given",
"name",
"."
] |
739858ed0ba5a0c75b6ccf18df9a4d5612374a4b
|
https://github.com/skuzzle/TinyPlugz/blob/739858ed0ba5a0c75b6ccf18df9a4d5612374a4b/tiny-plugz/src/main/java/de/skuzzle/tinyplugz/internal/DelegateClassLoader.java#L106-L109
|
150,729
|
hawkular/hawkular-inventory
|
hawkular-inventory-api/src/main/java/org/hawkular/inventory/base/Fetcher.java
|
Fetcher.loadEntities
|
protected <T> Page<T> loadEntities(Pager pager, EntityConvertor<BE, E, T> conversionFunction) {
return inCommittableTx(tx -> {
Function<BE, Pair<BE, E>> conversion =
(e) -> new Pair<>(e, tx.convert(e, context.entityClass));
Function<Pair<BE, E>, Boolean> filter = context.configuration.getResultFilter() == null ? null :
(p) -> context.configuration.getResultFilter().isApplicable(p.second);
Page<Pair<BE, E>> intermediate =
tx.<Pair<BE, E>>query(context.select().get(), pager, conversion, filter);
return new TransformingPage<Pair<BE, E>, T>(intermediate,
(p) -> conversionFunction.convert(p.first, p.second, tx)) {
@Override public void close() {
try {
tx.commit();
} catch (CommitFailureException e) {
throw new IllegalStateException("Failed to commit the read operation.", e);
}
super.close();
}
};
});
}
|
java
|
protected <T> Page<T> loadEntities(Pager pager, EntityConvertor<BE, E, T> conversionFunction) {
return inCommittableTx(tx -> {
Function<BE, Pair<BE, E>> conversion =
(e) -> new Pair<>(e, tx.convert(e, context.entityClass));
Function<Pair<BE, E>, Boolean> filter = context.configuration.getResultFilter() == null ? null :
(p) -> context.configuration.getResultFilter().isApplicable(p.second);
Page<Pair<BE, E>> intermediate =
tx.<Pair<BE, E>>query(context.select().get(), pager, conversion, filter);
return new TransformingPage<Pair<BE, E>, T>(intermediate,
(p) -> conversionFunction.convert(p.first, p.second, tx)) {
@Override public void close() {
try {
tx.commit();
} catch (CommitFailureException e) {
throw new IllegalStateException("Failed to commit the read operation.", e);
}
super.close();
}
};
});
}
|
[
"protected",
"<",
"T",
">",
"Page",
"<",
"T",
">",
"loadEntities",
"(",
"Pager",
"pager",
",",
"EntityConvertor",
"<",
"BE",
",",
"E",
",",
"T",
">",
"conversionFunction",
")",
"{",
"return",
"inCommittableTx",
"(",
"tx",
"->",
"{",
"Function",
"<",
"BE",
",",
"Pair",
"<",
"BE",
",",
"E",
">",
">",
"conversion",
"=",
"(",
"e",
")",
"-",
">",
"new",
"Pair",
"<>",
"(",
"e",
",",
"tx",
".",
"convert",
"(",
"e",
",",
"context",
".",
"entityClass",
")",
")",
";",
"Function",
"<",
"Pair",
"<",
"BE",
",",
"E",
">",
",",
"Boolean",
">",
"filter",
"=",
"context",
".",
"configuration",
".",
"getResultFilter",
"(",
")",
"==",
"null",
"?",
"null",
":",
"(",
"p",
")",
"-",
">",
"context",
".",
"configuration",
".",
"getResultFilter",
"(",
")",
".",
"isApplicable",
"(",
"p",
".",
"second",
")",
";",
"Page",
"<",
"Pair",
"<",
"BE",
",",
"E",
">",
">",
"intermediate",
"=",
"tx",
".",
"<",
"Pair",
"<",
"BE",
",",
"E",
">",
">",
"query",
"(",
"context",
".",
"select",
"(",
")",
".",
"get",
"(",
")",
",",
"pager",
",",
"conversion",
",",
"filter",
")",
";",
"return",
"new",
"TransformingPage",
"<",
"Pair",
"<",
"BE",
",",
"E",
">",
",",
"T",
">",
"(",
"intermediate",
",",
"(",
"p",
")",
"-",
">",
"conversionFunction",
".",
"convert",
"(",
"p",
".",
"first",
",",
"p",
".",
"second",
",",
"tx",
")",
")",
"{",
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"{",
"try",
"{",
"tx",
".",
"commit",
"(",
")",
";",
"}",
"catch",
"(",
"CommitFailureException",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Failed to commit the read operation.\"",
",",
"e",
")",
";",
"}",
"super",
".",
"close",
"(",
")",
";",
"}",
"}",
";",
"}",
")",
";",
"}"
] |
Loads the entities given the pager and converts them using the provided conversion function to the desired type.
<p>Note that the conversion function accepts both the backend entity and the converted entity because both
of them are required anyway during the loading and thus the function can choose which one to use without any
additional conversion cost.
@param pager the pager specifying the page of the data to load
@param conversionFunction the conversion function to convert to the desired target type
@param <T> the desired target type of the elements of the returned page
@return the page of the results as specified by the pager
|
[
"Loads",
"the",
"entities",
"given",
"the",
"pager",
"and",
"converts",
"them",
"using",
"the",
"provided",
"conversion",
"function",
"to",
"the",
"desired",
"type",
"."
] |
f56dc10323dca21777feb5b609a9e9cc70ffaf62
|
https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-api/src/main/java/org/hawkular/inventory/base/Fetcher.java#L170-L193
|
150,730
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/io/serialization/SerializationClass.java
|
SerializationClass.getAttributeByName
|
public Attribute getAttributeByName(String name) {
for (Attribute a : attributes)
if (name.equals(a.getName()))
return a;
return null;
}
|
java
|
public Attribute getAttributeByName(String name) {
for (Attribute a : attributes)
if (name.equals(a.getName()))
return a;
return null;
}
|
[
"public",
"Attribute",
"getAttributeByName",
"(",
"String",
"name",
")",
"{",
"for",
"(",
"Attribute",
"a",
":",
"attributes",
")",
"if",
"(",
"name",
".",
"equals",
"(",
"a",
".",
"getName",
"(",
")",
")",
")",
"return",
"a",
";",
"return",
"null",
";",
"}"
] |
Get an attribute by its name.
|
[
"Get",
"an",
"attribute",
"by",
"its",
"name",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/io/serialization/SerializationClass.java#L45-L50
|
150,731
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/io/serialization/SerializationClass.java
|
SerializationClass.getAttributeByOriginalName
|
public Attribute getAttributeByOriginalName(String name) {
for (Attribute a : attributes)
if (name.equals(a.getOriginalName()))
return a;
return null;
}
|
java
|
public Attribute getAttributeByOriginalName(String name) {
for (Attribute a : attributes)
if (name.equals(a.getOriginalName()))
return a;
return null;
}
|
[
"public",
"Attribute",
"getAttributeByOriginalName",
"(",
"String",
"name",
")",
"{",
"for",
"(",
"Attribute",
"a",
":",
"attributes",
")",
"if",
"(",
"name",
".",
"equals",
"(",
"a",
".",
"getOriginalName",
"(",
")",
")",
")",
"return",
"a",
";",
"return",
"null",
";",
"}"
] |
Get an attribute by its original name.
|
[
"Get",
"an",
"attribute",
"by",
"its",
"original",
"name",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/io/serialization/SerializationClass.java#L53-L58
|
150,732
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/io/serialization/SerializationClass.java
|
SerializationClass.replaceAttribute
|
public void replaceAttribute(Attribute original, Attribute newAttribute) {
for (ListIterator<Attribute> it = attributes.listIterator(); it.hasNext(); )
if (it.next().equals(original)) {
it.set(newAttribute);
break;
}
}
|
java
|
public void replaceAttribute(Attribute original, Attribute newAttribute) {
for (ListIterator<Attribute> it = attributes.listIterator(); it.hasNext(); )
if (it.next().equals(original)) {
it.set(newAttribute);
break;
}
}
|
[
"public",
"void",
"replaceAttribute",
"(",
"Attribute",
"original",
",",
"Attribute",
"newAttribute",
")",
"{",
"for",
"(",
"ListIterator",
"<",
"Attribute",
">",
"it",
"=",
"attributes",
".",
"listIterator",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
")",
"if",
"(",
"it",
".",
"next",
"(",
")",
".",
"equals",
"(",
"original",
")",
")",
"{",
"it",
".",
"set",
"(",
"newAttribute",
")",
";",
"break",
";",
"}",
"}"
] |
Replace an attribute.
|
[
"Replace",
"an",
"attribute",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/io/serialization/SerializationClass.java#L61-L67
|
150,733
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/io/serialization/SerializationClass.java
|
SerializationClass.apply
|
public void apply(List<SerializationRule> rules, SerializationContext context, boolean serializing) throws Exception {
for (SerializationRule rule : rules)
if (rule.apply(this, context, rules, serializing))
break;
}
|
java
|
public void apply(List<SerializationRule> rules, SerializationContext context, boolean serializing) throws Exception {
for (SerializationRule rule : rules)
if (rule.apply(this, context, rules, serializing))
break;
}
|
[
"public",
"void",
"apply",
"(",
"List",
"<",
"SerializationRule",
">",
"rules",
",",
"SerializationContext",
"context",
",",
"boolean",
"serializing",
")",
"throws",
"Exception",
"{",
"for",
"(",
"SerializationRule",
"rule",
":",
"rules",
")",
"if",
"(",
"rule",
".",
"apply",
"(",
"this",
",",
"context",
",",
"rules",
",",
"serializing",
")",
")",
"break",
";",
"}"
] |
Apply rules.
|
[
"Apply",
"rules",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/io/serialization/SerializationClass.java#L70-L74
|
150,734
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/io/serialization/SerializationClass.java
|
SerializationClass.searchAttributeType
|
public static TypeDefinition searchAttributeType(TypeDefinition containerType, String attributeName) {
try {
Field f = containerType.getBase().getField(attributeName);
if ((f.getModifiers() & (Modifier.STATIC | Modifier.FINAL)) != 0)
return new TypeDefinition(containerType, f.getGenericType());
} catch (Throwable t) { /* ignore */ }
try {
Method m = containerType.getBase()
.getMethod("get" + Character.toUpperCase(attributeName.charAt(0)) + attributeName.substring(1));
Class<?> returnType = m.getReturnType();
if (returnType != null && !Void.class.equals(returnType) && !void.class.equals(returnType))
return new TypeDefinition(containerType, m.getGenericReturnType());
} catch (Throwable t) { /* ignore */ }
try {
Method m = containerType.getBase()
.getMethod("is" + Character.toUpperCase(attributeName.charAt(0)) + attributeName.substring(1));
Class<?> returnType = m.getReturnType();
if (boolean.class.equals(returnType) || Boolean.class.equals(returnType))
return new TypeDefinition(containerType, m.getGenericReturnType());
} catch (Throwable t) { /* ignore */ }
return null;
}
|
java
|
public static TypeDefinition searchAttributeType(TypeDefinition containerType, String attributeName) {
try {
Field f = containerType.getBase().getField(attributeName);
if ((f.getModifiers() & (Modifier.STATIC | Modifier.FINAL)) != 0)
return new TypeDefinition(containerType, f.getGenericType());
} catch (Throwable t) { /* ignore */ }
try {
Method m = containerType.getBase()
.getMethod("get" + Character.toUpperCase(attributeName.charAt(0)) + attributeName.substring(1));
Class<?> returnType = m.getReturnType();
if (returnType != null && !Void.class.equals(returnType) && !void.class.equals(returnType))
return new TypeDefinition(containerType, m.getGenericReturnType());
} catch (Throwable t) { /* ignore */ }
try {
Method m = containerType.getBase()
.getMethod("is" + Character.toUpperCase(attributeName.charAt(0)) + attributeName.substring(1));
Class<?> returnType = m.getReturnType();
if (boolean.class.equals(returnType) || Boolean.class.equals(returnType))
return new TypeDefinition(containerType, m.getGenericReturnType());
} catch (Throwable t) { /* ignore */ }
return null;
}
|
[
"public",
"static",
"TypeDefinition",
"searchAttributeType",
"(",
"TypeDefinition",
"containerType",
",",
"String",
"attributeName",
")",
"{",
"try",
"{",
"Field",
"f",
"=",
"containerType",
".",
"getBase",
"(",
")",
".",
"getField",
"(",
"attributeName",
")",
";",
"if",
"(",
"(",
"f",
".",
"getModifiers",
"(",
")",
"&",
"(",
"Modifier",
".",
"STATIC",
"|",
"Modifier",
".",
"FINAL",
")",
")",
"!=",
"0",
")",
"return",
"new",
"TypeDefinition",
"(",
"containerType",
",",
"f",
".",
"getGenericType",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"/* ignore */",
"}",
"try",
"{",
"Method",
"m",
"=",
"containerType",
".",
"getBase",
"(",
")",
".",
"getMethod",
"(",
"\"get\"",
"+",
"Character",
".",
"toUpperCase",
"(",
"attributeName",
".",
"charAt",
"(",
"0",
")",
")",
"+",
"attributeName",
".",
"substring",
"(",
"1",
")",
")",
";",
"Class",
"<",
"?",
">",
"returnType",
"=",
"m",
".",
"getReturnType",
"(",
")",
";",
"if",
"(",
"returnType",
"!=",
"null",
"&&",
"!",
"Void",
".",
"class",
".",
"equals",
"(",
"returnType",
")",
"&&",
"!",
"void",
".",
"class",
".",
"equals",
"(",
"returnType",
")",
")",
"return",
"new",
"TypeDefinition",
"(",
"containerType",
",",
"m",
".",
"getGenericReturnType",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"/* ignore */",
"}",
"try",
"{",
"Method",
"m",
"=",
"containerType",
".",
"getBase",
"(",
")",
".",
"getMethod",
"(",
"\"is\"",
"+",
"Character",
".",
"toUpperCase",
"(",
"attributeName",
".",
"charAt",
"(",
"0",
")",
")",
"+",
"attributeName",
".",
"substring",
"(",
"1",
")",
")",
";",
"Class",
"<",
"?",
">",
"returnType",
"=",
"m",
".",
"getReturnType",
"(",
")",
";",
"if",
"(",
"boolean",
".",
"class",
".",
"equals",
"(",
"returnType",
")",
"||",
"Boolean",
".",
"class",
".",
"equals",
"(",
"returnType",
")",
")",
"return",
"new",
"TypeDefinition",
"(",
"containerType",
",",
"m",
".",
"getGenericReturnType",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"/* ignore */",
"}",
"return",
"null",
";",
"}"
] |
Search an attribute in the given type.
|
[
"Search",
"an",
"attribute",
"in",
"the",
"given",
"type",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/io/serialization/SerializationClass.java#L346-L367
|
150,735
|
rwl/CSparseJ
|
src/main/java/edu/emory/mathcs/csparsej/tdouble/Dcs_ltsolve.java
|
Dcs_ltsolve.cs_ltsolve
|
public static boolean cs_ltsolve(Dcs L, double[] x) {
int p, j, n, Lp[], Li[];
double Lx[];
if (!Dcs_util.CS_CSC(L) || x == null)
return (false); /* check inputs */
n = L.n;
Lp = L.p;
Li = L.i;
Lx = L.x;
for (j = n - 1; j >= 0; j--) {
for (p = Lp[j] + 1; p < Lp[j + 1]; p++) {
x[j] -= Lx[p] * x[Li[p]];
}
x[j] /= Lx[Lp[j]];
}
return (true);
}
|
java
|
public static boolean cs_ltsolve(Dcs L, double[] x) {
int p, j, n, Lp[], Li[];
double Lx[];
if (!Dcs_util.CS_CSC(L) || x == null)
return (false); /* check inputs */
n = L.n;
Lp = L.p;
Li = L.i;
Lx = L.x;
for (j = n - 1; j >= 0; j--) {
for (p = Lp[j] + 1; p < Lp[j + 1]; p++) {
x[j] -= Lx[p] * x[Li[p]];
}
x[j] /= Lx[Lp[j]];
}
return (true);
}
|
[
"public",
"static",
"boolean",
"cs_ltsolve",
"(",
"Dcs",
"L",
",",
"double",
"[",
"]",
"x",
")",
"{",
"int",
"p",
",",
"j",
",",
"n",
",",
"Lp",
"[",
"]",
",",
"Li",
"[",
"]",
";",
"double",
"Lx",
"[",
"]",
";",
"if",
"(",
"!",
"Dcs_util",
".",
"CS_CSC",
"(",
"L",
")",
"||",
"x",
"==",
"null",
")",
"return",
"(",
"false",
")",
";",
"/* check inputs */",
"n",
"=",
"L",
".",
"n",
";",
"Lp",
"=",
"L",
".",
"p",
";",
"Li",
"=",
"L",
".",
"i",
";",
"Lx",
"=",
"L",
".",
"x",
";",
"for",
"(",
"j",
"=",
"n",
"-",
"1",
";",
"j",
">=",
"0",
";",
"j",
"--",
")",
"{",
"for",
"(",
"p",
"=",
"Lp",
"[",
"j",
"]",
"+",
"1",
";",
"p",
"<",
"Lp",
"[",
"j",
"+",
"1",
"]",
";",
"p",
"++",
")",
"{",
"x",
"[",
"j",
"]",
"-=",
"Lx",
"[",
"p",
"]",
"*",
"x",
"[",
"Li",
"[",
"p",
"]",
"]",
";",
"}",
"x",
"[",
"j",
"]",
"/=",
"Lx",
"[",
"Lp",
"[",
"j",
"]",
"]",
";",
"}",
"return",
"(",
"true",
")",
";",
"}"
] |
Solves an upper triangular system L'x=b where x and b are dense. x=b on
input, solution on output.
@param L
column-compressed, lower triangular matrix
@param x
size n, right hand side on input, solution on output
@return true if successful, false on error
|
[
"Solves",
"an",
"upper",
"triangular",
"system",
"L",
"x",
"=",
"b",
"where",
"x",
"and",
"b",
"are",
"dense",
".",
"x",
"=",
"b",
"on",
"input",
"solution",
"on",
"output",
"."
] |
6a6f66bccce1558156a961494358952603b0ac84
|
https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tdouble/Dcs_ltsolve.java#L46-L62
|
150,736
|
jtrfp/javamod
|
src/main/java/de/quippy/jflac/io/RandomFileInputStream.java
|
RandomFileInputStream.skip
|
public long skip(long bytes) throws IOException {
long pos = randomFile.getFilePointer();
randomFile.seek(pos + bytes);
return randomFile.getFilePointer() - pos;
}
|
java
|
public long skip(long bytes) throws IOException {
long pos = randomFile.getFilePointer();
randomFile.seek(pos + bytes);
return randomFile.getFilePointer() - pos;
}
|
[
"public",
"long",
"skip",
"(",
"long",
"bytes",
")",
"throws",
"IOException",
"{",
"long",
"pos",
"=",
"randomFile",
".",
"getFilePointer",
"(",
")",
";",
"randomFile",
".",
"seek",
"(",
"pos",
"+",
"bytes",
")",
";",
"return",
"randomFile",
".",
"getFilePointer",
"(",
")",
"-",
"pos",
";",
"}"
] |
Skip bytes in the input file.
@param bytes The number of bytes to skip
@return the number of bytes skiped
@throws IOException on IO error
@see java.io.InputStream#skip(long)
|
[
"Skip",
"bytes",
"in",
"the",
"input",
"file",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/io/RandomFileInputStream.java#L103-L107
|
150,737
|
jtrfp/javamod
|
src/main/java/de/quippy/jflac/io/RandomFileInputStream.java
|
RandomFileInputStream.read
|
public int read(byte[] buffer, int pos, int bytes) throws IOException {
return randomFile.read(buffer, pos, bytes);
}
|
java
|
public int read(byte[] buffer, int pos, int bytes) throws IOException {
return randomFile.read(buffer, pos, bytes);
}
|
[
"public",
"int",
"read",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"pos",
",",
"int",
"bytes",
")",
"throws",
"IOException",
"{",
"return",
"randomFile",
".",
"read",
"(",
"buffer",
",",
"pos",
",",
"bytes",
")",
";",
"}"
] |
Read bytes into an array.
@param buffer The buffer to read bytes into
@param pos The start position in the buffer
@param bytes The number of bytes to read
@return bytes read
@throws IOException on IO error
@see java.io.InputStream#read(byte[], int, int)
|
[
"Read",
"bytes",
"into",
"an",
"array",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/io/RandomFileInputStream.java#L129-L131
|
150,738
|
jtrfp/javamod
|
src/main/java/de/quippy/jflac/metadata/CueSheet.java
|
CueSheet.isLegal
|
void isLegal(boolean checkCdDaSubset) throws Violation {
if (checkCdDaSubset) {
if (leadIn < 2 * 44100) {
throw new Violation("CD-DA cue sheet must have a lead-in length of at least 2 seconds");
}
if (leadIn % 588 != 0) {
throw new Violation("CD-DA cue sheet lead-in length must be evenly divisible by 588 samples");
}
}
if (numTracks == 0) {
throw new Violation("cue sheet must have at least one track (the lead-out)");
}
if (checkCdDaSubset && tracks[numTracks - 1].number != 170) {
throw new Violation("CD-DA cue sheet must have a lead-out track number 170 (0xAA)");
}
for (int i = 0; i < numTracks; i++) {
if (tracks[i].number == 0) {
throw new Violation("cue sheet may not have a track number 0");
}
if (checkCdDaSubset) {
if (!((tracks[i].number >= 1 && tracks[i].number <= 99) || tracks[i].number == 170)) {
throw new Violation("CD-DA cue sheet track number must be 1-99 or 170");
}
}
if (checkCdDaSubset && tracks[i].offset % 588 != 0) {
throw new Violation("CD-DA cue sheet track offset must be evenly divisible by 588 samples");
}
if (i < numTracks - 1) {
if (tracks[i].numIndices == 0) {
throw new Violation("cue sheet track must have at least one index point");
}
if (tracks[i].indices[0].number > 1) {
throw new Violation("cue sheet track's first index number must be 0 or 1");
}
}
for (int j = 0; j < tracks[i].numIndices; j++) {
if (checkCdDaSubset && tracks[i].indices[j].offset % 588 != 0) {
throw new Violation("CD-DA cue sheet track index offset must be evenly divisible by 588 samples");
}
if (j > 0) {
if (tracks[i].indices[j].number != tracks[i].indices[j - 1].number + 1) {
throw new Violation("cue sheet track index numbers must increase by 1");
}
}
}
}
}
|
java
|
void isLegal(boolean checkCdDaSubset) throws Violation {
if (checkCdDaSubset) {
if (leadIn < 2 * 44100) {
throw new Violation("CD-DA cue sheet must have a lead-in length of at least 2 seconds");
}
if (leadIn % 588 != 0) {
throw new Violation("CD-DA cue sheet lead-in length must be evenly divisible by 588 samples");
}
}
if (numTracks == 0) {
throw new Violation("cue sheet must have at least one track (the lead-out)");
}
if (checkCdDaSubset && tracks[numTracks - 1].number != 170) {
throw new Violation("CD-DA cue sheet must have a lead-out track number 170 (0xAA)");
}
for (int i = 0; i < numTracks; i++) {
if (tracks[i].number == 0) {
throw new Violation("cue sheet may not have a track number 0");
}
if (checkCdDaSubset) {
if (!((tracks[i].number >= 1 && tracks[i].number <= 99) || tracks[i].number == 170)) {
throw new Violation("CD-DA cue sheet track number must be 1-99 or 170");
}
}
if (checkCdDaSubset && tracks[i].offset % 588 != 0) {
throw new Violation("CD-DA cue sheet track offset must be evenly divisible by 588 samples");
}
if (i < numTracks - 1) {
if (tracks[i].numIndices == 0) {
throw new Violation("cue sheet track must have at least one index point");
}
if (tracks[i].indices[0].number > 1) {
throw new Violation("cue sheet track's first index number must be 0 or 1");
}
}
for (int j = 0; j < tracks[i].numIndices; j++) {
if (checkCdDaSubset && tracks[i].indices[j].offset % 588 != 0) {
throw new Violation("CD-DA cue sheet track index offset must be evenly divisible by 588 samples");
}
if (j > 0) {
if (tracks[i].indices[j].number != tracks[i].indices[j - 1].number + 1) {
throw new Violation("cue sheet track index numbers must increase by 1");
}
}
}
}
}
|
[
"void",
"isLegal",
"(",
"boolean",
"checkCdDaSubset",
")",
"throws",
"Violation",
"{",
"if",
"(",
"checkCdDaSubset",
")",
"{",
"if",
"(",
"leadIn",
"<",
"2",
"*",
"44100",
")",
"{",
"throw",
"new",
"Violation",
"(",
"\"CD-DA cue sheet must have a lead-in length of at least 2 seconds\"",
")",
";",
"}",
"if",
"(",
"leadIn",
"%",
"588",
"!=",
"0",
")",
"{",
"throw",
"new",
"Violation",
"(",
"\"CD-DA cue sheet lead-in length must be evenly divisible by 588 samples\"",
")",
";",
"}",
"}",
"if",
"(",
"numTracks",
"==",
"0",
")",
"{",
"throw",
"new",
"Violation",
"(",
"\"cue sheet must have at least one track (the lead-out)\"",
")",
";",
"}",
"if",
"(",
"checkCdDaSubset",
"&&",
"tracks",
"[",
"numTracks",
"-",
"1",
"]",
".",
"number",
"!=",
"170",
")",
"{",
"throw",
"new",
"Violation",
"(",
"\"CD-DA cue sheet must have a lead-out track number 170 (0xAA)\"",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numTracks",
";",
"i",
"++",
")",
"{",
"if",
"(",
"tracks",
"[",
"i",
"]",
".",
"number",
"==",
"0",
")",
"{",
"throw",
"new",
"Violation",
"(",
"\"cue sheet may not have a track number 0\"",
")",
";",
"}",
"if",
"(",
"checkCdDaSubset",
")",
"{",
"if",
"(",
"!",
"(",
"(",
"tracks",
"[",
"i",
"]",
".",
"number",
">=",
"1",
"&&",
"tracks",
"[",
"i",
"]",
".",
"number",
"<=",
"99",
")",
"||",
"tracks",
"[",
"i",
"]",
".",
"number",
"==",
"170",
")",
")",
"{",
"throw",
"new",
"Violation",
"(",
"\"CD-DA cue sheet track number must be 1-99 or 170\"",
")",
";",
"}",
"}",
"if",
"(",
"checkCdDaSubset",
"&&",
"tracks",
"[",
"i",
"]",
".",
"offset",
"%",
"588",
"!=",
"0",
")",
"{",
"throw",
"new",
"Violation",
"(",
"\"CD-DA cue sheet track offset must be evenly divisible by 588 samples\"",
")",
";",
"}",
"if",
"(",
"i",
"<",
"numTracks",
"-",
"1",
")",
"{",
"if",
"(",
"tracks",
"[",
"i",
"]",
".",
"numIndices",
"==",
"0",
")",
"{",
"throw",
"new",
"Violation",
"(",
"\"cue sheet track must have at least one index point\"",
")",
";",
"}",
"if",
"(",
"tracks",
"[",
"i",
"]",
".",
"indices",
"[",
"0",
"]",
".",
"number",
">",
"1",
")",
"{",
"throw",
"new",
"Violation",
"(",
"\"cue sheet track's first index number must be 0 or 1\"",
")",
";",
"}",
"}",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"tracks",
"[",
"i",
"]",
".",
"numIndices",
";",
"j",
"++",
")",
"{",
"if",
"(",
"checkCdDaSubset",
"&&",
"tracks",
"[",
"i",
"]",
".",
"indices",
"[",
"j",
"]",
".",
"offset",
"%",
"588",
"!=",
"0",
")",
"{",
"throw",
"new",
"Violation",
"(",
"\"CD-DA cue sheet track index offset must be evenly divisible by 588 samples\"",
")",
";",
"}",
"if",
"(",
"j",
">",
"0",
")",
"{",
"if",
"(",
"tracks",
"[",
"i",
"]",
".",
"indices",
"[",
"j",
"]",
".",
"number",
"!=",
"tracks",
"[",
"i",
"]",
".",
"indices",
"[",
"j",
"-",
"1",
"]",
".",
"number",
"+",
"1",
")",
"{",
"throw",
"new",
"Violation",
"(",
"\"cue sheet track index numbers must increase by 1\"",
")",
";",
"}",
"}",
"}",
"}",
"}"
] |
Verifys the Cue Sheet.
@param checkCdDaSubset True for check CD subset
@throws Violation Thrown if invalid Cue Sheet
|
[
"Verifys",
"the",
"Cue",
"Sheet",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/metadata/CueSheet.java#L80-L136
|
150,739
|
akarnokd/akarnokd-xml
|
src/main/java/hu/akarnokd/xml/XNSerializables.java
|
XNSerializables.createRequest
|
public static XNElement createRequest(String function, Object... nameValue) {
XNElement result = new XNElement(function);
for (int i = 0; i < nameValue.length; i += 2) {
result.set((String)nameValue[i], nameValue[i + 1]);
}
return result;
}
|
java
|
public static XNElement createRequest(String function, Object... nameValue) {
XNElement result = new XNElement(function);
for (int i = 0; i < nameValue.length; i += 2) {
result.set((String)nameValue[i], nameValue[i + 1]);
}
return result;
}
|
[
"public",
"static",
"XNElement",
"createRequest",
"(",
"String",
"function",
",",
"Object",
"...",
"nameValue",
")",
"{",
"XNElement",
"result",
"=",
"new",
"XNElement",
"(",
"function",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nameValue",
".",
"length",
";",
"i",
"+=",
"2",
")",
"{",
"result",
".",
"set",
"(",
"(",
"String",
")",
"nameValue",
"[",
"i",
"]",
",",
"nameValue",
"[",
"i",
"+",
"1",
"]",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Create a request with the given function and name-value pairs.
@param function the remote function name
@param nameValue the array of String name and Object attributes.
@return the request XML
|
[
"Create",
"a",
"request",
"with",
"the",
"given",
"function",
"and",
"name",
"-",
"value",
"pairs",
"."
] |
57466a5a9cb455a13d7121557c165287b31ee870
|
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNSerializables.java#L35-L41
|
150,740
|
akarnokd/akarnokd-xml
|
src/main/java/hu/akarnokd/xml/XNSerializables.java
|
XNSerializables.parseList
|
public static <T extends XNSerializable> List<T> parseList(XNElement container,
String itemName, Supplier<T> creator) {
List<T> result = new ArrayList<>();
for (XNElement e : container.childrenWithName(itemName)) {
T obj = creator.get();
obj.load(e);
result.add(obj);
}
return result;
}
|
java
|
public static <T extends XNSerializable> List<T> parseList(XNElement container,
String itemName, Supplier<T> creator) {
List<T> result = new ArrayList<>();
for (XNElement e : container.childrenWithName(itemName)) {
T obj = creator.get();
obj.load(e);
result.add(obj);
}
return result;
}
|
[
"public",
"static",
"<",
"T",
"extends",
"XNSerializable",
">",
"List",
"<",
"T",
">",
"parseList",
"(",
"XNElement",
"container",
",",
"String",
"itemName",
",",
"Supplier",
"<",
"T",
">",
"creator",
")",
"{",
"List",
"<",
"T",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"XNElement",
"e",
":",
"container",
".",
"childrenWithName",
"(",
"itemName",
")",
")",
"{",
"T",
"obj",
"=",
"creator",
".",
"get",
"(",
")",
";",
"obj",
".",
"load",
"(",
"e",
")",
";",
"result",
".",
"add",
"(",
"obj",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Parses an container for the given itemName elements and loads them into the
given Java XNSerializable object.
@param <T> the element object type
@param container the container XNElement
@param itemName the item name
@param creator the function to create Ts
@return the list of elements
|
[
"Parses",
"an",
"container",
"for",
"the",
"given",
"itemName",
"elements",
"and",
"loads",
"them",
"into",
"the",
"given",
"Java",
"XNSerializable",
"object",
"."
] |
57466a5a9cb455a13d7121557c165287b31ee870
|
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNSerializables.java#L62-L71
|
150,741
|
akarnokd/akarnokd-xml
|
src/main/java/hu/akarnokd/xml/XNSerializables.java
|
XNSerializables.storeList
|
public static XNElement storeList(String container, String item, Iterable<? extends XNSerializable> source) {
XNElement result = new XNElement(container);
for (XNSerializable e : source) {
e.save(result.add(item));
}
return result;
}
|
java
|
public static XNElement storeList(String container, String item, Iterable<? extends XNSerializable> source) {
XNElement result = new XNElement(container);
for (XNSerializable e : source) {
e.save(result.add(item));
}
return result;
}
|
[
"public",
"static",
"XNElement",
"storeList",
"(",
"String",
"container",
",",
"String",
"item",
",",
"Iterable",
"<",
"?",
"extends",
"XNSerializable",
">",
"source",
")",
"{",
"XNElement",
"result",
"=",
"new",
"XNElement",
"(",
"container",
")",
";",
"for",
"(",
"XNSerializable",
"e",
":",
"source",
")",
"{",
"e",
".",
"save",
"(",
"result",
".",
"add",
"(",
"item",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Create an XNElement with the given name and items stored from the source sequence.
@param container the container name
@param item the item name
@param source the source of items
@return the list in XNElement
|
[
"Create",
"an",
"XNElement",
"with",
"the",
"given",
"name",
"and",
"items",
"stored",
"from",
"the",
"source",
"sequence",
"."
] |
57466a5a9cb455a13d7121557c165287b31ee870
|
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNSerializables.java#L92-L98
|
150,742
|
mgledi/DRUMS
|
src/main/java/com/unister/semweb/drums/util/KeyUtils.java
|
KeyUtils.toByteArray
|
public static byte[][] toByteArray(long[] l) {
byte[][] b = new byte[l.length][];
for (int i = 0; i < b.length; i++) {
b[i] = Bytes.toBytes(l[i]);
}
return b;
}
|
java
|
public static byte[][] toByteArray(long[] l) {
byte[][] b = new byte[l.length][];
for (int i = 0; i < b.length; i++) {
b[i] = Bytes.toBytes(l[i]);
}
return b;
}
|
[
"public",
"static",
"byte",
"[",
"]",
"[",
"]",
"toByteArray",
"(",
"long",
"[",
"]",
"l",
")",
"{",
"byte",
"[",
"]",
"[",
"]",
"b",
"=",
"new",
"byte",
"[",
"l",
".",
"length",
"]",
"[",
"",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"b",
".",
"length",
";",
"i",
"++",
")",
"{",
"b",
"[",
"i",
"]",
"=",
"Bytes",
".",
"toBytes",
"(",
"l",
"[",
"i",
"]",
")",
";",
"}",
"return",
"b",
";",
"}"
] |
transforms the given array of longs to an array of byte-arrays
@param l
the longs to transform
@return the to l corresponding array of byte-arrays
|
[
"transforms",
"the",
"given",
"array",
"of",
"longs",
"to",
"an",
"array",
"of",
"byte",
"-",
"arrays"
] |
a670f17a2186c9a15725f26617d77ce8e444e072
|
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/util/KeyUtils.java#L35-L41
|
150,743
|
mgledi/DRUMS
|
src/main/java/com/unister/semweb/drums/util/KeyUtils.java
|
KeyUtils.isNull
|
public static boolean isNull(byte[] key, int length) {
if (key == null) {
return true;
}
for (int i = 0; i < Math.min(key.length, length); i++) {
if (key[i] != 0) {
return false;
}
}
return true;
}
|
java
|
public static boolean isNull(byte[] key, int length) {
if (key == null) {
return true;
}
for (int i = 0; i < Math.min(key.length, length); i++) {
if (key[i] != 0) {
return false;
}
}
return true;
}
|
[
"public",
"static",
"boolean",
"isNull",
"(",
"byte",
"[",
"]",
"key",
",",
"int",
"length",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"Math",
".",
"min",
"(",
"key",
".",
"length",
",",
"length",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"key",
"[",
"i",
"]",
"!=",
"0",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Checks if the elements of the given key up the given length are 0, or the whole array is null.
@param key
@param length
@return true, if the key is null or all elements in the array are 0.
|
[
"Checks",
"if",
"the",
"elements",
"of",
"the",
"given",
"key",
"up",
"the",
"given",
"length",
"are",
"0",
"or",
"the",
"whole",
"array",
"is",
"null",
"."
] |
a670f17a2186c9a15725f26617d77ce8e444e072
|
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/util/KeyUtils.java#L50-L60
|
150,744
|
mgledi/DRUMS
|
src/main/java/com/unister/semweb/drums/util/KeyUtils.java
|
KeyUtils.compareKey
|
public static int compareKey(byte[] key1, byte[] key2) {
return compareKey(key1, key2, Math.min(key1.length, key2.length));
}
|
java
|
public static int compareKey(byte[] key1, byte[] key2) {
return compareKey(key1, key2, Math.min(key1.length, key2.length));
}
|
[
"public",
"static",
"int",
"compareKey",
"(",
"byte",
"[",
"]",
"key1",
",",
"byte",
"[",
"]",
"key2",
")",
"{",
"return",
"compareKey",
"(",
"key1",
",",
"key2",
",",
"Math",
".",
"min",
"(",
"key1",
".",
"length",
",",
"key2",
".",
"length",
")",
")",
";",
"}"
] |
Compares the two byte-arrays on the basis of unsigned bytes. The array will be compared by each element up to the
length of the smaller array. If all elements are equal and the array are not equal sized, the larger array is
seen as larger.
@param key1
@param key2
@return <0 if key1 < key2<br>
0 if key1 == key2<br>
>0 if key1 > key2
|
[
"Compares",
"the",
"two",
"byte",
"-",
"arrays",
"on",
"the",
"basis",
"of",
"unsigned",
"bytes",
".",
"The",
"array",
"will",
"be",
"compared",
"by",
"each",
"element",
"up",
"to",
"the",
"length",
"of",
"the",
"smaller",
"array",
".",
"If",
"all",
"elements",
"are",
"equal",
"and",
"the",
"array",
"are",
"not",
"equal",
"sized",
"the",
"larger",
"array",
"is",
"seen",
"as",
"larger",
"."
] |
a670f17a2186c9a15725f26617d77ce8e444e072
|
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/util/KeyUtils.java#L88-L90
|
150,745
|
mgledi/DRUMS
|
src/main/java/com/unister/semweb/drums/util/KeyUtils.java
|
KeyUtils.toStringUnsignedInt
|
public static String toStringUnsignedInt(byte[] key) {
StringBuilder result = new StringBuilder();
for (int i = 0; i < key.length; i++) {
result.append(key[i] & 0xFF);
result.append(' ');
}
return result.toString();
}
|
java
|
public static String toStringUnsignedInt(byte[] key) {
StringBuilder result = new StringBuilder();
for (int i = 0; i < key.length; i++) {
result.append(key[i] & 0xFF);
result.append(' ');
}
return result.toString();
}
|
[
"public",
"static",
"String",
"toStringUnsignedInt",
"(",
"byte",
"[",
"]",
"key",
")",
"{",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"key",
".",
"length",
";",
"i",
"++",
")",
"{",
"result",
".",
"append",
"(",
"key",
"[",
"i",
"]",
"&",
"0xFF",
")",
";",
"result",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"return",
"result",
".",
"toString",
"(",
")",
";",
"}"
] |
Generates a string representation of the given key
@param key
@return the String representation of the given key
|
[
"Generates",
"a",
"string",
"representation",
"of",
"the",
"given",
"key"
] |
a670f17a2186c9a15725f26617d77ce8e444e072
|
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/util/KeyUtils.java#L196-L203
|
150,746
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/security/core/PMSecurityUser.java
|
PMSecurityUser.belongsTo
|
public boolean belongsTo(String groupname) {
if (groupname == null) {
return false;
}
for (PMSecurityUserGroup g : getGroups()) {
if (groupname.equalsIgnoreCase(g.getName())) {
return true;
}
}
return false;
}
|
java
|
public boolean belongsTo(String groupname) {
if (groupname == null) {
return false;
}
for (PMSecurityUserGroup g : getGroups()) {
if (groupname.equalsIgnoreCase(g.getName())) {
return true;
}
}
return false;
}
|
[
"public",
"boolean",
"belongsTo",
"(",
"String",
"groupname",
")",
"{",
"if",
"(",
"groupname",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"PMSecurityUserGroup",
"g",
":",
"getGroups",
"(",
")",
")",
"{",
"if",
"(",
"groupname",
".",
"equalsIgnoreCase",
"(",
"g",
".",
"getName",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Determine if the user belongs to the group
|
[
"Determine",
"if",
"the",
"user",
"belongs",
"to",
"the",
"group"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/security/core/PMSecurityUser.java#L162-L172
|
150,747
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/security/core/PMSecurityUser.java
|
PMSecurityUser.getGravatar
|
public String getGravatar() {
if (getEmail() == null) {
return "http://www.gravatar.com/avatar/00000000000000000000000000000000";
} else {
final MD5 md5 = new MD5();
final String hash = md5.calcMD5(getEmail());
return "http://www.gravatar.com/avatar/" + hash;
}
}
|
java
|
public String getGravatar() {
if (getEmail() == null) {
return "http://www.gravatar.com/avatar/00000000000000000000000000000000";
} else {
final MD5 md5 = new MD5();
final String hash = md5.calcMD5(getEmail());
return "http://www.gravatar.com/avatar/" + hash;
}
}
|
[
"public",
"String",
"getGravatar",
"(",
")",
"{",
"if",
"(",
"getEmail",
"(",
")",
"==",
"null",
")",
"{",
"return",
"\"http://www.gravatar.com/avatar/00000000000000000000000000000000\"",
";",
"}",
"else",
"{",
"final",
"MD5",
"md5",
"=",
"new",
"MD5",
"(",
")",
";",
"final",
"String",
"hash",
"=",
"md5",
".",
"calcMD5",
"(",
"getEmail",
"(",
")",
")",
";",
"return",
"\"http://www.gravatar.com/avatar/\"",
"+",
"hash",
";",
"}",
"}"
] |
Get a gravatar image
|
[
"Get",
"a",
"gravatar",
"image"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/security/core/PMSecurityUser.java#L211-L219
|
150,748
|
jtrfp/javamod
|
src/main/java/de/quippy/jflac/PCMProcessors.java
|
PCMProcessors.processStreamInfo
|
public void processStreamInfo(StreamInfo info) {
synchronized (pcmProcessors) {
Iterator<PCMProcessor> it = pcmProcessors.iterator();
while (it.hasNext()) {
PCMProcessor processor = (PCMProcessor)it.next();
processor.processStreamInfo(info);
}
}
}
|
java
|
public void processStreamInfo(StreamInfo info) {
synchronized (pcmProcessors) {
Iterator<PCMProcessor> it = pcmProcessors.iterator();
while (it.hasNext()) {
PCMProcessor processor = (PCMProcessor)it.next();
processor.processStreamInfo(info);
}
}
}
|
[
"public",
"void",
"processStreamInfo",
"(",
"StreamInfo",
"info",
")",
"{",
"synchronized",
"(",
"pcmProcessors",
")",
"{",
"Iterator",
"<",
"PCMProcessor",
">",
"it",
"=",
"pcmProcessors",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"PCMProcessor",
"processor",
"=",
"(",
"PCMProcessor",
")",
"it",
".",
"next",
"(",
")",
";",
"processor",
".",
"processStreamInfo",
"(",
"info",
")",
";",
"}",
"}",
"}"
] |
Process the StreamInfo block.
@param info the StreamInfo block
@see de.quippy.jflac.PCMProcessor#processStreamInfo(de.quippy.jflac.metadata.StreamInfo)
|
[
"Process",
"the",
"StreamInfo",
"block",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/PCMProcessors.java#L48-L56
|
150,749
|
jtrfp/javamod
|
src/main/java/de/quippy/jflac/PCMProcessors.java
|
PCMProcessors.processPCM
|
public void processPCM(ByteData pcm) {
synchronized (pcmProcessors) {
Iterator<PCMProcessor> it = pcmProcessors.iterator();
while (it.hasNext()) {
PCMProcessor processor = (PCMProcessor)it.next();
processor.processPCM(pcm);
}
}
}
|
java
|
public void processPCM(ByteData pcm) {
synchronized (pcmProcessors) {
Iterator<PCMProcessor> it = pcmProcessors.iterator();
while (it.hasNext()) {
PCMProcessor processor = (PCMProcessor)it.next();
processor.processPCM(pcm);
}
}
}
|
[
"public",
"void",
"processPCM",
"(",
"ByteData",
"pcm",
")",
"{",
"synchronized",
"(",
"pcmProcessors",
")",
"{",
"Iterator",
"<",
"PCMProcessor",
">",
"it",
"=",
"pcmProcessors",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"PCMProcessor",
"processor",
"=",
"(",
"PCMProcessor",
")",
"it",
".",
"next",
"(",
")",
";",
"processor",
".",
"processPCM",
"(",
"pcm",
")",
";",
"}",
"}",
"}"
] |
Process the decoded PCM bytes.
@param pcm The decoded PCM data
@see de.quippy.jflac.PCMProcessor#processPCM(de.quippy.jflac.util.ByteSpace)
|
[
"Process",
"the",
"decoded",
"PCM",
"bytes",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/PCMProcessors.java#L63-L71
|
150,750
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/util/DebugUtil.java
|
DebugUtil.createStackTrace
|
public static StringBuilder createStackTrace(StringBuilder s, Throwable t, boolean includeCause) {
s.append(t.getClass().getName());
s.append(": ");
s.append(t.getMessage());
createStackTrace(s, t.getStackTrace());
if (includeCause) {
Throwable cause = t.getCause();
if (cause != null && cause != t) {
s.append("\nCaused by: ");
createStackTrace(s, cause, true);
}
}
return s;
}
|
java
|
public static StringBuilder createStackTrace(StringBuilder s, Throwable t, boolean includeCause) {
s.append(t.getClass().getName());
s.append(": ");
s.append(t.getMessage());
createStackTrace(s, t.getStackTrace());
if (includeCause) {
Throwable cause = t.getCause();
if (cause != null && cause != t) {
s.append("\nCaused by: ");
createStackTrace(s, cause, true);
}
}
return s;
}
|
[
"public",
"static",
"StringBuilder",
"createStackTrace",
"(",
"StringBuilder",
"s",
",",
"Throwable",
"t",
",",
"boolean",
"includeCause",
")",
"{",
"s",
".",
"append",
"(",
"t",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"s",
".",
"append",
"(",
"\": \"",
")",
";",
"s",
".",
"append",
"(",
"t",
".",
"getMessage",
"(",
")",
")",
";",
"createStackTrace",
"(",
"s",
",",
"t",
".",
"getStackTrace",
"(",
")",
")",
";",
"if",
"(",
"includeCause",
")",
"{",
"Throwable",
"cause",
"=",
"t",
".",
"getCause",
"(",
")",
";",
"if",
"(",
"cause",
"!=",
"null",
"&&",
"cause",
"!=",
"t",
")",
"{",
"s",
".",
"append",
"(",
"\"\\nCaused by: \"",
")",
";",
"createStackTrace",
"(",
"s",
",",
"cause",
",",
"true",
")",
";",
"}",
"}",
"return",
"s",
";",
"}"
] |
Append a stack trace of the given Throwable to the StringBuilder.
|
[
"Append",
"a",
"stack",
"trace",
"of",
"the",
"given",
"Throwable",
"to",
"the",
"StringBuilder",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/util/DebugUtil.java#L20-L33
|
150,751
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/util/DebugUtil.java
|
DebugUtil.createStackTrace
|
public static StringBuilder createStackTrace(StringBuilder s, StackTraceElement[] stack) {
if (stack != null)
for (StackTraceElement e : stack) {
s.append("\n\tat ");
s.append(e.getClassName());
if (e.getMethodName() != null) {
s.append('.');
s.append(e.getMethodName());
}
if (e.getFileName() != null) {
s.append('(');
s.append(e.getFileName());
s.append(':');
s.append(e.getLineNumber());
s.append(')');
}
}
return s;
}
|
java
|
public static StringBuilder createStackTrace(StringBuilder s, StackTraceElement[] stack) {
if (stack != null)
for (StackTraceElement e : stack) {
s.append("\n\tat ");
s.append(e.getClassName());
if (e.getMethodName() != null) {
s.append('.');
s.append(e.getMethodName());
}
if (e.getFileName() != null) {
s.append('(');
s.append(e.getFileName());
s.append(':');
s.append(e.getLineNumber());
s.append(')');
}
}
return s;
}
|
[
"public",
"static",
"StringBuilder",
"createStackTrace",
"(",
"StringBuilder",
"s",
",",
"StackTraceElement",
"[",
"]",
"stack",
")",
"{",
"if",
"(",
"stack",
"!=",
"null",
")",
"for",
"(",
"StackTraceElement",
"e",
":",
"stack",
")",
"{",
"s",
".",
"append",
"(",
"\"\\n\\tat \"",
")",
";",
"s",
".",
"append",
"(",
"e",
".",
"getClassName",
"(",
")",
")",
";",
"if",
"(",
"e",
".",
"getMethodName",
"(",
")",
"!=",
"null",
")",
"{",
"s",
".",
"append",
"(",
"'",
"'",
")",
";",
"s",
".",
"append",
"(",
"e",
".",
"getMethodName",
"(",
")",
")",
";",
"}",
"if",
"(",
"e",
".",
"getFileName",
"(",
")",
"!=",
"null",
")",
"{",
"s",
".",
"append",
"(",
"'",
"'",
")",
";",
"s",
".",
"append",
"(",
"e",
".",
"getFileName",
"(",
")",
")",
";",
"s",
".",
"append",
"(",
"'",
"'",
")",
";",
"s",
".",
"append",
"(",
"e",
".",
"getLineNumber",
"(",
")",
")",
";",
"s",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"}",
"return",
"s",
";",
"}"
] |
Append a stack trace to a StringBuilder.
|
[
"Append",
"a",
"stack",
"trace",
"to",
"a",
"StringBuilder",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/util/DebugUtil.java#L36-L54
|
150,752
|
livetribe/livetribe-slp
|
core/src/main/java/org/livetribe/slp/spi/msg/LanguageExtension.java
|
LanguageExtension.findFirst
|
public static LanguageExtension findFirst(Collection<? extends Extension> extensions)
{
for (Extension extension : extensions)
{
if (LANGUAGE_EXTENSION_ID == extension.getId())
return (LanguageExtension)extension;
}
return null;
}
|
java
|
public static LanguageExtension findFirst(Collection<? extends Extension> extensions)
{
for (Extension extension : extensions)
{
if (LANGUAGE_EXTENSION_ID == extension.getId())
return (LanguageExtension)extension;
}
return null;
}
|
[
"public",
"static",
"LanguageExtension",
"findFirst",
"(",
"Collection",
"<",
"?",
"extends",
"Extension",
">",
"extensions",
")",
"{",
"for",
"(",
"Extension",
"extension",
":",
"extensions",
")",
"{",
"if",
"(",
"LANGUAGE_EXTENSION_ID",
"==",
"extension",
".",
"getId",
"(",
")",
")",
"return",
"(",
"LanguageExtension",
")",
"extension",
";",
"}",
"return",
"null",
";",
"}"
] |
Returns the first LanguageExtension found in the given collection of extensions,
or null if the extension collection does not contain a LanguageExtension.
|
[
"Returns",
"the",
"first",
"LanguageExtension",
"found",
"in",
"the",
"given",
"collection",
"of",
"extensions",
"or",
"null",
"if",
"the",
"extension",
"collection",
"does",
"not",
"contain",
"a",
"LanguageExtension",
"."
] |
6cc13dbe81feab133fe3dd291ca081cbc6e1f591
|
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/spi/msg/LanguageExtension.java#L166-L174
|
150,753
|
livetribe/livetribe-slp
|
core/src/main/java/org/livetribe/slp/spi/msg/LanguageExtension.java
|
LanguageExtension.findAll
|
public static List<LanguageExtension> findAll(Collection<? extends Extension> extensions)
{
List<LanguageExtension> result = new ArrayList<LanguageExtension>();
for (Extension extension : extensions)
{
if (LANGUAGE_EXTENSION_ID == extension.getId())
result.add((LanguageExtension)extension);
}
return result;
}
|
java
|
public static List<LanguageExtension> findAll(Collection<? extends Extension> extensions)
{
List<LanguageExtension> result = new ArrayList<LanguageExtension>();
for (Extension extension : extensions)
{
if (LANGUAGE_EXTENSION_ID == extension.getId())
result.add((LanguageExtension)extension);
}
return result;
}
|
[
"public",
"static",
"List",
"<",
"LanguageExtension",
">",
"findAll",
"(",
"Collection",
"<",
"?",
"extends",
"Extension",
">",
"extensions",
")",
"{",
"List",
"<",
"LanguageExtension",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"LanguageExtension",
">",
"(",
")",
";",
"for",
"(",
"Extension",
"extension",
":",
"extensions",
")",
"{",
"if",
"(",
"LANGUAGE_EXTENSION_ID",
"==",
"extension",
".",
"getId",
"(",
")",
")",
"result",
".",
"add",
"(",
"(",
"LanguageExtension",
")",
"extension",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Returns all LanguageExtension found in the given collection of extensions,
or an empty list if the extension collection does not contain LanguageExtensions.
|
[
"Returns",
"all",
"LanguageExtension",
"found",
"in",
"the",
"given",
"collection",
"of",
"extensions",
"or",
"an",
"empty",
"list",
"if",
"the",
"extension",
"collection",
"does",
"not",
"contain",
"LanguageExtensions",
"."
] |
6cc13dbe81feab133fe3dd291ca081cbc6e1f591
|
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/spi/msg/LanguageExtension.java#L180-L189
|
150,754
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/io/util/Buffers.java
|
Buffers.getBuffer
|
public ByteBuffer getBuffer() {
ByteBuffer buf = buffers.pollFirst();
if (buf != null) {
buf.clear();
return buf;
}
return ByteBuffer.wrap(new byte[bufferSize]);
}
|
java
|
public ByteBuffer getBuffer() {
ByteBuffer buf = buffers.pollFirst();
if (buf != null) {
buf.clear();
return buf;
}
return ByteBuffer.wrap(new byte[bufferSize]);
}
|
[
"public",
"ByteBuffer",
"getBuffer",
"(",
")",
"{",
"ByteBuffer",
"buf",
"=",
"buffers",
".",
"pollFirst",
"(",
")",
";",
"if",
"(",
"buf",
"!=",
"null",
")",
"{",
"buf",
".",
"clear",
"(",
")",
";",
"return",
"buf",
";",
"}",
"return",
"ByteBuffer",
".",
"wrap",
"(",
"new",
"byte",
"[",
"bufferSize",
"]",
")",
";",
"}"
] |
Get a buffer.
|
[
"Get",
"a",
"buffer",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/io/util/Buffers.java#L23-L30
|
150,755
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Frame.java
|
ID3v2Frame.checkDefaultFileAlterDiscard
|
private boolean checkDefaultFileAlterDiscard()
{
return id.equals(ID3v2Frames.AUDIO_SEEK_POINT_INDEX) ||
id.equals(ID3v2Frames.AUDIO_ENCRYPTION) ||
id.equals(ID3v2Frames.EVENT_TIMING_CODES) ||
id.equals(ID3v2Frames.EQUALISATION) ||
id.equals(ID3v2Frames.MPEG_LOCATION_LOOKUP_TABLE) ||
id.equals(ID3v2Frames.POSITION_SYNCHRONISATION_FRAME) ||
id.equals(ID3v2Frames.SEEK_FRAME) ||
id.equals(ID3v2Frames.SYNCHRONISED_LYRIC) ||
id.equals(ID3v2Frames.SYNCHRONISED_TEMPO_CODES) ||
id.equals(ID3v2Frames.RELATIVE_VOLUME_ADJUSTMENT) ||
id.equals(ID3v2Frames.ENCODED_BY) ||
id.equals(ID3v2Frames.LENGTH);
}
|
java
|
private boolean checkDefaultFileAlterDiscard()
{
return id.equals(ID3v2Frames.AUDIO_SEEK_POINT_INDEX) ||
id.equals(ID3v2Frames.AUDIO_ENCRYPTION) ||
id.equals(ID3v2Frames.EVENT_TIMING_CODES) ||
id.equals(ID3v2Frames.EQUALISATION) ||
id.equals(ID3v2Frames.MPEG_LOCATION_LOOKUP_TABLE) ||
id.equals(ID3v2Frames.POSITION_SYNCHRONISATION_FRAME) ||
id.equals(ID3v2Frames.SEEK_FRAME) ||
id.equals(ID3v2Frames.SYNCHRONISED_LYRIC) ||
id.equals(ID3v2Frames.SYNCHRONISED_TEMPO_CODES) ||
id.equals(ID3v2Frames.RELATIVE_VOLUME_ADJUSTMENT) ||
id.equals(ID3v2Frames.ENCODED_BY) ||
id.equals(ID3v2Frames.LENGTH);
}
|
[
"private",
"boolean",
"checkDefaultFileAlterDiscard",
"(",
")",
"{",
"return",
"id",
".",
"equals",
"(",
"ID3v2Frames",
".",
"AUDIO_SEEK_POINT_INDEX",
")",
"||",
"id",
".",
"equals",
"(",
"ID3v2Frames",
".",
"AUDIO_ENCRYPTION",
")",
"||",
"id",
".",
"equals",
"(",
"ID3v2Frames",
".",
"EVENT_TIMING_CODES",
")",
"||",
"id",
".",
"equals",
"(",
"ID3v2Frames",
".",
"EQUALISATION",
")",
"||",
"id",
".",
"equals",
"(",
"ID3v2Frames",
".",
"MPEG_LOCATION_LOOKUP_TABLE",
")",
"||",
"id",
".",
"equals",
"(",
"ID3v2Frames",
".",
"POSITION_SYNCHRONISATION_FRAME",
")",
"||",
"id",
".",
"equals",
"(",
"ID3v2Frames",
".",
"SEEK_FRAME",
")",
"||",
"id",
".",
"equals",
"(",
"ID3v2Frames",
".",
"SYNCHRONISED_LYRIC",
")",
"||",
"id",
".",
"equals",
"(",
"ID3v2Frames",
".",
"SYNCHRONISED_TEMPO_CODES",
")",
"||",
"id",
".",
"equals",
"(",
"ID3v2Frames",
".",
"RELATIVE_VOLUME_ADJUSTMENT",
")",
"||",
"id",
".",
"equals",
"(",
"ID3v2Frames",
".",
"ENCODED_BY",
")",
"||",
"id",
".",
"equals",
"(",
"ID3v2Frames",
".",
"LENGTH",
")",
";",
"}"
] |
Returns true if this frame should have the file alter
preservation bit set by default.
@return true if the file alter preservation should be set by default
|
[
"Returns",
"true",
"if",
"this",
"frame",
"should",
"have",
"the",
"file",
"alter",
"preservation",
"bit",
"set",
"by",
"default",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Frame.java#L136-L150
|
150,756
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Frame.java
|
ID3v2Frame.parseFlags
|
private void parseFlags(byte[] flags) throws ID3v2FormatException
{
if (flags.length != FRAME_FLAGS_SIZE)
{
throw new ID3v2FormatException("Error parsing flags of frame: " + id + ". Expected 2 bytes.");
}
else
{
tagAlterDiscard = (flags[0]&0x40)!=0;
fileAlterDiscard = (flags[0]&0x20)!=0;
readOnly = (flags[0]&0x10)!=0;
grouped = (flags[1]&0x40)!=0;
compressed = (flags[1]&0x08)!=0;
encrypted = (flags[1]&0x04)!=0;
unsynchronised = (flags[1]&0x02)!=0;
lengthIndicator = (flags[1]&0x01)!=0;
if (compressed && !lengthIndicator)
{
throw new ID3v2FormatException("Error parsing flags of frame: " + id + ". Compressed bit set without data length bit set.");
}
}
}
|
java
|
private void parseFlags(byte[] flags) throws ID3v2FormatException
{
if (flags.length != FRAME_FLAGS_SIZE)
{
throw new ID3v2FormatException("Error parsing flags of frame: " + id + ". Expected 2 bytes.");
}
else
{
tagAlterDiscard = (flags[0]&0x40)!=0;
fileAlterDiscard = (flags[0]&0x20)!=0;
readOnly = (flags[0]&0x10)!=0;
grouped = (flags[1]&0x40)!=0;
compressed = (flags[1]&0x08)!=0;
encrypted = (flags[1]&0x04)!=0;
unsynchronised = (flags[1]&0x02)!=0;
lengthIndicator = (flags[1]&0x01)!=0;
if (compressed && !lengthIndicator)
{
throw new ID3v2FormatException("Error parsing flags of frame: " + id + ". Compressed bit set without data length bit set.");
}
}
}
|
[
"private",
"void",
"parseFlags",
"(",
"byte",
"[",
"]",
"flags",
")",
"throws",
"ID3v2FormatException",
"{",
"if",
"(",
"flags",
".",
"length",
"!=",
"FRAME_FLAGS_SIZE",
")",
"{",
"throw",
"new",
"ID3v2FormatException",
"(",
"\"Error parsing flags of frame: \"",
"+",
"id",
"+",
"\". Expected 2 bytes.\"",
")",
";",
"}",
"else",
"{",
"tagAlterDiscard",
"=",
"(",
"flags",
"[",
"0",
"]",
"&",
"0x40",
")",
"!=",
"0",
";",
"fileAlterDiscard",
"=",
"(",
"flags",
"[",
"0",
"]",
"&",
"0x20",
")",
"!=",
"0",
";",
"readOnly",
"=",
"(",
"flags",
"[",
"0",
"]",
"&",
"0x10",
")",
"!=",
"0",
";",
"grouped",
"=",
"(",
"flags",
"[",
"1",
"]",
"&",
"0x40",
")",
"!=",
"0",
";",
"compressed",
"=",
"(",
"flags",
"[",
"1",
"]",
"&",
"0x08",
")",
"!=",
"0",
";",
"encrypted",
"=",
"(",
"flags",
"[",
"1",
"]",
"&",
"0x04",
")",
"!=",
"0",
";",
"unsynchronised",
"=",
"(",
"flags",
"[",
"1",
"]",
"&",
"0x02",
")",
"!=",
"0",
";",
"lengthIndicator",
"=",
"(",
"flags",
"[",
"1",
"]",
"&",
"0x01",
")",
"!=",
"0",
";",
"if",
"(",
"compressed",
"&&",
"!",
"lengthIndicator",
")",
"{",
"throw",
"new",
"ID3v2FormatException",
"(",
"\"Error parsing flags of frame: \"",
"+",
"id",
"+",
"\". Compressed bit set without data length bit set.\"",
")",
";",
"}",
"}",
"}"
] |
Read the information from the flags array.
@param flags the flags found in the frame header
@exception ID3v2FormatException if an error occurs
|
[
"Read",
"the",
"information",
"from",
"the",
"flags",
"array",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Frame.java#L158-L180
|
150,757
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Frame.java
|
ID3v2Frame.getFlagBytes
|
private byte[] getFlagBytes()
{
byte flags[] = new byte[2];
if (tagAlterDiscard) flags[0] |= 0x40;
if (fileAlterDiscard) flags[0] |= 0x20;
if (readOnly) flags[0] |= 0x10;
if (grouped) flags[1] |= 0x40;
if (compressed) flags[1] |= 0x08;
if (encrypted) flags[1] |= 0x04;
if (unsynchronised) flags[1] |= 0x02;
if (lengthIndicator) flags[1] |= 0x01;
return flags;
}
|
java
|
private byte[] getFlagBytes()
{
byte flags[] = new byte[2];
if (tagAlterDiscard) flags[0] |= 0x40;
if (fileAlterDiscard) flags[0] |= 0x20;
if (readOnly) flags[0] |= 0x10;
if (grouped) flags[1] |= 0x40;
if (compressed) flags[1] |= 0x08;
if (encrypted) flags[1] |= 0x04;
if (unsynchronised) flags[1] |= 0x02;
if (lengthIndicator) flags[1] |= 0x01;
return flags;
}
|
[
"private",
"byte",
"[",
"]",
"getFlagBytes",
"(",
")",
"{",
"byte",
"flags",
"[",
"]",
"=",
"new",
"byte",
"[",
"2",
"]",
";",
"if",
"(",
"tagAlterDiscard",
")",
"flags",
"[",
"0",
"]",
"|=",
"0x40",
";",
"if",
"(",
"fileAlterDiscard",
")",
"flags",
"[",
"0",
"]",
"|=",
"0x20",
";",
"if",
"(",
"readOnly",
")",
"flags",
"[",
"0",
"]",
"|=",
"0x10",
";",
"if",
"(",
"grouped",
")",
"flags",
"[",
"1",
"]",
"|=",
"0x40",
";",
"if",
"(",
"compressed",
")",
"flags",
"[",
"1",
"]",
"|=",
"0x08",
";",
"if",
"(",
"encrypted",
")",
"flags",
"[",
"1",
"]",
"|=",
"0x04",
";",
"if",
"(",
"unsynchronised",
")",
"flags",
"[",
"1",
"]",
"|=",
"0x02",
";",
"if",
"(",
"lengthIndicator",
")",
"flags",
"[",
"1",
"]",
"|=",
"0x01",
";",
"return",
"flags",
";",
"}"
] |
A helper function for the getFrameBytes method that processes the info
in the frame and returns the 2 byte array of flags to be added to the
header.
@return a value of type 'byte[]'
|
[
"A",
"helper",
"function",
"for",
"the",
"getFrameBytes",
"method",
"that",
"processes",
"the",
"info",
"in",
"the",
"frame",
"and",
"returns",
"the",
"2",
"byte",
"array",
"of",
"flags",
"to",
"be",
"added",
"to",
"the",
"header",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Frame.java#L189-L203
|
150,758
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Frame.java
|
ID3v2Frame.parseData
|
private void parseData(byte[] data)
{
int bytesRead = 0;
if (grouped)
{
group = data[bytesRead];
bytesRead ++;
}
if (encrypted)
{
encrType = data[bytesRead];
bytesRead ++;
}
if (lengthIndicator)
{
dataLength = Helpers.convertDWordToInt(data, bytesRead);
bytesRead += 4;
}
frameData = new byte[data.length - bytesRead];
System.arraycopy(data, bytesRead, frameData, 0, frameData.length);
}
|
java
|
private void parseData(byte[] data)
{
int bytesRead = 0;
if (grouped)
{
group = data[bytesRead];
bytesRead ++;
}
if (encrypted)
{
encrType = data[bytesRead];
bytesRead ++;
}
if (lengthIndicator)
{
dataLength = Helpers.convertDWordToInt(data, bytesRead);
bytesRead += 4;
}
frameData = new byte[data.length - bytesRead];
System.arraycopy(data, bytesRead, frameData, 0, frameData.length);
}
|
[
"private",
"void",
"parseData",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"int",
"bytesRead",
"=",
"0",
";",
"if",
"(",
"grouped",
")",
"{",
"group",
"=",
"data",
"[",
"bytesRead",
"]",
";",
"bytesRead",
"++",
";",
"}",
"if",
"(",
"encrypted",
")",
"{",
"encrType",
"=",
"data",
"[",
"bytesRead",
"]",
";",
"bytesRead",
"++",
";",
"}",
"if",
"(",
"lengthIndicator",
")",
"{",
"dataLength",
"=",
"Helpers",
".",
"convertDWordToInt",
"(",
"data",
",",
"bytesRead",
")",
";",
"bytesRead",
"+=",
"4",
";",
"}",
"frameData",
"=",
"new",
"byte",
"[",
"data",
".",
"length",
"-",
"bytesRead",
"]",
";",
"System",
".",
"arraycopy",
"(",
"data",
",",
"bytesRead",
",",
"frameData",
",",
"0",
",",
"frameData",
".",
"length",
")",
";",
"}"
] |
Pulls out extra information inserted in the frame data depending
on what flags are set.
@param data the frame data
|
[
"Pulls",
"out",
"extra",
"information",
"inserted",
"in",
"the",
"frame",
"data",
"depending",
"on",
"what",
"flags",
"are",
"set",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Frame.java#L211-L233
|
150,759
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Frame.java
|
ID3v2Frame.getFrameLength
|
public int getFrameLength()
{
int length = frameData.length + FRAME_HEAD_SIZE;
if (grouped)
{
length++;
}
if (encrypted)
{
length++;
}
if (lengthIndicator)
{
length += 4;
}
return length;
}
|
java
|
public int getFrameLength()
{
int length = frameData.length + FRAME_HEAD_SIZE;
if (grouped)
{
length++;
}
if (encrypted)
{
length++;
}
if (lengthIndicator)
{
length += 4;
}
return length;
}
|
[
"public",
"int",
"getFrameLength",
"(",
")",
"{",
"int",
"length",
"=",
"frameData",
".",
"length",
"+",
"FRAME_HEAD_SIZE",
";",
"if",
"(",
"grouped",
")",
"{",
"length",
"++",
";",
"}",
"if",
"(",
"encrypted",
")",
"{",
"length",
"++",
";",
"}",
"if",
"(",
"lengthIndicator",
")",
"{",
"length",
"+=",
"4",
";",
"}",
"return",
"length",
";",
"}"
] |
Return the length of this frame in bytes, including the header.
@return the length of this frame
|
[
"Return",
"the",
"length",
"of",
"this",
"frame",
"in",
"bytes",
"including",
"the",
"header",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Frame.java#L264-L282
|
150,760
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Frame.java
|
ID3v2Frame.getFrameBytes
|
public byte[] getFrameBytes()
{
int length = getFrameLength();
int bytesWritten = 0;
byte[] flags = getFlagBytes();
byte[] extra = getExtraDataBytes();
byte[] b;
b = new byte[length];
System.arraycopy(id.getBytes(), 0, b, 0, id.length());
bytesWritten += id.length();
System.arraycopy(Helpers.convertIntToDWord(length), 0, b, bytesWritten, 4);
bytesWritten += 4;
System.arraycopy(flags, 0, b, bytesWritten, flags.length);
bytesWritten += flags.length;
System.arraycopy(extra, 0, b, bytesWritten, extra.length);
bytesWritten += extra.length;
System.arraycopy(frameData, 0, b, bytesWritten, frameData.length);
bytesWritten += frameData.length;
return b;
}
|
java
|
public byte[] getFrameBytes()
{
int length = getFrameLength();
int bytesWritten = 0;
byte[] flags = getFlagBytes();
byte[] extra = getExtraDataBytes();
byte[] b;
b = new byte[length];
System.arraycopy(id.getBytes(), 0, b, 0, id.length());
bytesWritten += id.length();
System.arraycopy(Helpers.convertIntToDWord(length), 0, b, bytesWritten, 4);
bytesWritten += 4;
System.arraycopy(flags, 0, b, bytesWritten, flags.length);
bytesWritten += flags.length;
System.arraycopy(extra, 0, b, bytesWritten, extra.length);
bytesWritten += extra.length;
System.arraycopy(frameData, 0, b, bytesWritten, frameData.length);
bytesWritten += frameData.length;
return b;
}
|
[
"public",
"byte",
"[",
"]",
"getFrameBytes",
"(",
")",
"{",
"int",
"length",
"=",
"getFrameLength",
"(",
")",
";",
"int",
"bytesWritten",
"=",
"0",
";",
"byte",
"[",
"]",
"flags",
"=",
"getFlagBytes",
"(",
")",
";",
"byte",
"[",
"]",
"extra",
"=",
"getExtraDataBytes",
"(",
")",
";",
"byte",
"[",
"]",
"b",
";",
"b",
"=",
"new",
"byte",
"[",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"id",
".",
"getBytes",
"(",
")",
",",
"0",
",",
"b",
",",
"0",
",",
"id",
".",
"length",
"(",
")",
")",
";",
"bytesWritten",
"+=",
"id",
".",
"length",
"(",
")",
";",
"System",
".",
"arraycopy",
"(",
"Helpers",
".",
"convertIntToDWord",
"(",
"length",
")",
",",
"0",
",",
"b",
",",
"bytesWritten",
",",
"4",
")",
";",
"bytesWritten",
"+=",
"4",
";",
"System",
".",
"arraycopy",
"(",
"flags",
",",
"0",
",",
"b",
",",
"bytesWritten",
",",
"flags",
".",
"length",
")",
";",
"bytesWritten",
"+=",
"flags",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"extra",
",",
"0",
",",
"b",
",",
"bytesWritten",
",",
"extra",
".",
"length",
")",
";",
"bytesWritten",
"+=",
"extra",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"frameData",
",",
"0",
",",
"b",
",",
"bytesWritten",
",",
"frameData",
".",
"length",
")",
";",
"bytesWritten",
"+=",
"frameData",
".",
"length",
";",
"return",
"b",
";",
"}"
] |
Returns a byte array representation of this frame that can be written
to a file. Includes the header and data.
@return a binary representation of this frame to be written to a file
|
[
"Returns",
"a",
"byte",
"array",
"representation",
"of",
"this",
"frame",
"that",
"can",
"be",
"written",
"to",
"a",
"file",
".",
"Includes",
"the",
"header",
"and",
"data",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Frame.java#L290-L312
|
150,761
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Frame.java
|
ID3v2Frame.getExtraDataBytes
|
private byte[] getExtraDataBytes()
{
byte[] buf = new byte[MAX_EXTRA_DATA];
byte[] ret;
int bytesCopied = 0;
if (grouped)
{
buf[bytesCopied] = group;
bytesCopied++;
}
if (encrypted)
{
buf[bytesCopied] = encrType;
bytesCopied++;
}
if (lengthIndicator)
{
System.arraycopy(Helpers.convertIntToDWord(dataLength), 0, buf, bytesCopied, 4);
bytesCopied += 4;
}
ret = new byte[bytesCopied];
System.arraycopy(buf, 0, ret, 0, bytesCopied);
return ret;
}
|
java
|
private byte[] getExtraDataBytes()
{
byte[] buf = new byte[MAX_EXTRA_DATA];
byte[] ret;
int bytesCopied = 0;
if (grouped)
{
buf[bytesCopied] = group;
bytesCopied++;
}
if (encrypted)
{
buf[bytesCopied] = encrType;
bytesCopied++;
}
if (lengthIndicator)
{
System.arraycopy(Helpers.convertIntToDWord(dataLength), 0, buf, bytesCopied, 4);
bytesCopied += 4;
}
ret = new byte[bytesCopied];
System.arraycopy(buf, 0, ret, 0, bytesCopied);
return ret;
}
|
[
"private",
"byte",
"[",
"]",
"getExtraDataBytes",
"(",
")",
"{",
"byte",
"[",
"]",
"buf",
"=",
"new",
"byte",
"[",
"MAX_EXTRA_DATA",
"]",
";",
"byte",
"[",
"]",
"ret",
";",
"int",
"bytesCopied",
"=",
"0",
";",
"if",
"(",
"grouped",
")",
"{",
"buf",
"[",
"bytesCopied",
"]",
"=",
"group",
";",
"bytesCopied",
"++",
";",
"}",
"if",
"(",
"encrypted",
")",
"{",
"buf",
"[",
"bytesCopied",
"]",
"=",
"encrType",
";",
"bytesCopied",
"++",
";",
"}",
"if",
"(",
"lengthIndicator",
")",
"{",
"System",
".",
"arraycopy",
"(",
"Helpers",
".",
"convertIntToDWord",
"(",
"dataLength",
")",
",",
"0",
",",
"buf",
",",
"bytesCopied",
",",
"4",
")",
";",
"bytesCopied",
"+=",
"4",
";",
"}",
"ret",
"=",
"new",
"byte",
"[",
"bytesCopied",
"]",
";",
"System",
".",
"arraycopy",
"(",
"buf",
",",
"0",
",",
"ret",
",",
"0",
",",
"bytesCopied",
")",
";",
"return",
"ret",
";",
"}"
] |
A helper function for the getFrameBytes function that returns an array
of all the data contained in any extra fields that may be present in
this frame. This includes the group, the encryption type, and the
length indicator. The length of the array returned is variable length.
@return an array of bytes containing the extra data fields in the frame
|
[
"A",
"helper",
"function",
"for",
"the",
"getFrameBytes",
"function",
"that",
"returns",
"an",
"array",
"of",
"all",
"the",
"data",
"contained",
"in",
"any",
"extra",
"fields",
"that",
"may",
"be",
"present",
"in",
"this",
"frame",
".",
"This",
"includes",
"the",
"group",
"the",
"encryption",
"type",
"and",
"the",
"length",
"indicator",
".",
"The",
"length",
"of",
"the",
"array",
"returned",
"is",
"variable",
"length",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Frame.java#L322-L348
|
150,762
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Frame.java
|
ID3v2Frame.getDataString
|
public String getDataString() throws ID3v2FormatException
{
String str = null;
if (frameData.length > 1)
{
final String enc_type = (frameData[0] < ENC_TYPES.length)?ENC_TYPES[frameData[0]]:null;
try
{
if ((id.charAt(0) == 'T') || id.equals(ID3v2Frames.OWNERSHIP_FRAME))
{
str = Helpers.retrieveAsString(frameData, 1, frameData.length-1, enc_type);
}
else
if (id.charAt(0) == 'W')
{
str = new String(frameData);
}
else
if (id.equals(ID3v2Frames.USER_DEFINED_URL))
{
str = Helpers.retrieveAsString(frameData, 1, frameData.length-1, enc_type);
if (str.length()<frameData.length-1)
{
str += '\n';
str += Helpers.retrieveAsString(frameData, str.length()+2, frameData.length-2-str.length(), enc_type);
}
}
else
if (id.equals(ID3v2Frames.UNSYNCHRONISED_LYRIC_TRANSCRIPTION) || id.equals(ID3v2Frames.COMMENTS) || id.equals(ID3v2Frames.TERMS_OF_USE))
{
str = Helpers.retrieveAsString(frameData, 4, frameData.length-4, enc_type);
}
}
catch (Throwable e)
{
throw new ID3v2FormatException("Frame " + id + " had errors!", e);
}
}
return str;
}
|
java
|
public String getDataString() throws ID3v2FormatException
{
String str = null;
if (frameData.length > 1)
{
final String enc_type = (frameData[0] < ENC_TYPES.length)?ENC_TYPES[frameData[0]]:null;
try
{
if ((id.charAt(0) == 'T') || id.equals(ID3v2Frames.OWNERSHIP_FRAME))
{
str = Helpers.retrieveAsString(frameData, 1, frameData.length-1, enc_type);
}
else
if (id.charAt(0) == 'W')
{
str = new String(frameData);
}
else
if (id.equals(ID3v2Frames.USER_DEFINED_URL))
{
str = Helpers.retrieveAsString(frameData, 1, frameData.length-1, enc_type);
if (str.length()<frameData.length-1)
{
str += '\n';
str += Helpers.retrieveAsString(frameData, str.length()+2, frameData.length-2-str.length(), enc_type);
}
}
else
if (id.equals(ID3v2Frames.UNSYNCHRONISED_LYRIC_TRANSCRIPTION) || id.equals(ID3v2Frames.COMMENTS) || id.equals(ID3v2Frames.TERMS_OF_USE))
{
str = Helpers.retrieveAsString(frameData, 4, frameData.length-4, enc_type);
}
}
catch (Throwable e)
{
throw new ID3v2FormatException("Frame " + id + " had errors!", e);
}
}
return str;
}
|
[
"public",
"String",
"getDataString",
"(",
")",
"throws",
"ID3v2FormatException",
"{",
"String",
"str",
"=",
"null",
";",
"if",
"(",
"frameData",
".",
"length",
">",
"1",
")",
"{",
"final",
"String",
"enc_type",
"=",
"(",
"frameData",
"[",
"0",
"]",
"<",
"ENC_TYPES",
".",
"length",
")",
"?",
"ENC_TYPES",
"[",
"frameData",
"[",
"0",
"]",
"]",
":",
"null",
";",
"try",
"{",
"if",
"(",
"(",
"id",
".",
"charAt",
"(",
"0",
")",
"==",
"'",
"'",
")",
"||",
"id",
".",
"equals",
"(",
"ID3v2Frames",
".",
"OWNERSHIP_FRAME",
")",
")",
"{",
"str",
"=",
"Helpers",
".",
"retrieveAsString",
"(",
"frameData",
",",
"1",
",",
"frameData",
".",
"length",
"-",
"1",
",",
"enc_type",
")",
";",
"}",
"else",
"if",
"(",
"id",
".",
"charAt",
"(",
"0",
")",
"==",
"'",
"'",
")",
"{",
"str",
"=",
"new",
"String",
"(",
"frameData",
")",
";",
"}",
"else",
"if",
"(",
"id",
".",
"equals",
"(",
"ID3v2Frames",
".",
"USER_DEFINED_URL",
")",
")",
"{",
"str",
"=",
"Helpers",
".",
"retrieveAsString",
"(",
"frameData",
",",
"1",
",",
"frameData",
".",
"length",
"-",
"1",
",",
"enc_type",
")",
";",
"if",
"(",
"str",
".",
"length",
"(",
")",
"<",
"frameData",
".",
"length",
"-",
"1",
")",
"{",
"str",
"+=",
"'",
"'",
";",
"str",
"+=",
"Helpers",
".",
"retrieveAsString",
"(",
"frameData",
",",
"str",
".",
"length",
"(",
")",
"+",
"2",
",",
"frameData",
".",
"length",
"-",
"2",
"-",
"str",
".",
"length",
"(",
")",
",",
"enc_type",
")",
";",
"}",
"}",
"else",
"if",
"(",
"id",
".",
"equals",
"(",
"ID3v2Frames",
".",
"UNSYNCHRONISED_LYRIC_TRANSCRIPTION",
")",
"||",
"id",
".",
"equals",
"(",
"ID3v2Frames",
".",
"COMMENTS",
")",
"||",
"id",
".",
"equals",
"(",
"ID3v2Frames",
".",
"TERMS_OF_USE",
")",
")",
"{",
"str",
"=",
"Helpers",
".",
"retrieveAsString",
"(",
"frameData",
",",
"4",
",",
"frameData",
".",
"length",
"-",
"4",
",",
"enc_type",
")",
";",
"}",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"throw",
"new",
"ID3v2FormatException",
"(",
"\"Frame \"",
"+",
"id",
"+",
"\" had errors!\"",
",",
"e",
")",
";",
"}",
"}",
"return",
"str",
";",
"}"
] |
If possible, this method attempts to convert textual part of the data
into a string. If this frame does not contain textual information,
an empty string is returned.
@return the textual portion of the data in this frame
@exception ID3v2FormatException if an error occurs
|
[
"If",
"possible",
"this",
"method",
"attempts",
"to",
"convert",
"textual",
"part",
"of",
"the",
"data",
"into",
"a",
"string",
".",
"If",
"this",
"frame",
"does",
"not",
"contain",
"textual",
"information",
"an",
"empty",
"string",
"is",
"returned",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Frame.java#L475-L516
|
150,763
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/menu/MenuSupport.java
|
MenuSupport.getMenu
|
public static Menu getMenu(List<String> permissions) throws PMException {
try {
MenuBuilder mb = new MenuBuilder(PresentationManager.getPm().getMenu());
Menu menu = cleanWithoutPerms(mb.getMenu(), permissions);
return menu;
} catch (Exception e) {
throw new PMException("pm_core.cant.load.menu");
}
}
|
java
|
public static Menu getMenu(List<String> permissions) throws PMException {
try {
MenuBuilder mb = new MenuBuilder(PresentationManager.getPm().getMenu());
Menu menu = cleanWithoutPerms(mb.getMenu(), permissions);
return menu;
} catch (Exception e) {
throw new PMException("pm_core.cant.load.menu");
}
}
|
[
"public",
"static",
"Menu",
"getMenu",
"(",
"List",
"<",
"String",
">",
"permissions",
")",
"throws",
"PMException",
"{",
"try",
"{",
"MenuBuilder",
"mb",
"=",
"new",
"MenuBuilder",
"(",
"PresentationManager",
".",
"getPm",
"(",
")",
".",
"getMenu",
"(",
")",
")",
";",
"Menu",
"menu",
"=",
"cleanWithoutPerms",
"(",
"mb",
".",
"getMenu",
"(",
")",
",",
"permissions",
")",
";",
"return",
"menu",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"PMException",
"(",
"\"pm_core.cant.load.menu\"",
")",
";",
"}",
"}"
] |
Builds the menu for the user.
@param permissions List of permissions
@return The filtered menu associated to the permissions of the user.
@throws PMException
|
[
"Builds",
"the",
"menu",
"for",
"the",
"user",
"."
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/menu/MenuSupport.java#L20-L28
|
150,764
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/util/Utils.java
|
Utils.padleft
|
public static String padleft(String s, int len, char c) {
s = s.trim();
if (s.length() > len) {
return s;
}
final StringBuilder sb = new StringBuilder(len);
int fill = len - s.length();
while (fill-- > 0) {
sb.append(c);
}
sb.append(s);
return sb.toString();
}
|
java
|
public static String padleft(String s, int len, char c) {
s = s.trim();
if (s.length() > len) {
return s;
}
final StringBuilder sb = new StringBuilder(len);
int fill = len - s.length();
while (fill-- > 0) {
sb.append(c);
}
sb.append(s);
return sb.toString();
}
|
[
"public",
"static",
"String",
"padleft",
"(",
"String",
"s",
",",
"int",
"len",
",",
"char",
"c",
")",
"{",
"s",
"=",
"s",
".",
"trim",
"(",
")",
";",
"if",
"(",
"s",
".",
"length",
"(",
")",
">",
"len",
")",
"{",
"return",
"s",
";",
"}",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"len",
")",
";",
"int",
"fill",
"=",
"len",
"-",
"s",
".",
"length",
"(",
")",
";",
"while",
"(",
"fill",
"--",
">",
"0",
")",
"{",
"sb",
".",
"append",
"(",
"c",
")",
";",
"}",
"sb",
".",
"append",
"(",
"s",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
Pad to the left
@param s string
@param len desired len
@param c padding char
@return padded string
|
[
"Pad",
"to",
"the",
"left"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/util/Utils.java#L17-L29
|
150,765
|
mytechia/mytechia_commons
|
mytechia_commons_library/src/main/java/com/mytechia/commons/util/configuration/UserConfiguration.java
|
UserConfiguration.storeConfiguration
|
public synchronized void storeConfiguration() throws IOException
{
OutputStream out = new FileOutputStream(configFilePath);
configuration.store(out, configFilePath);
}
|
java
|
public synchronized void storeConfiguration() throws IOException
{
OutputStream out = new FileOutputStream(configFilePath);
configuration.store(out, configFilePath);
}
|
[
"public",
"synchronized",
"void",
"storeConfiguration",
"(",
")",
"throws",
"IOException",
"{",
"OutputStream",
"out",
"=",
"new",
"FileOutputStream",
"(",
"configFilePath",
")",
";",
"configuration",
".",
"store",
"(",
"out",
",",
"configFilePath",
")",
";",
"}"
] |
Saves the configuration
@throws java.io.IOException If there was a problem while writting the config file
|
[
"Saves",
"the",
"configuration"
] |
02251879085f271a1fb51663a1c8eddc8be78ae7
|
https://github.com/mytechia/mytechia_commons/blob/02251879085f271a1fb51663a1c8eddc8be78ae7/mytechia_commons_library/src/main/java/com/mytechia/commons/util/configuration/UserConfiguration.java#L94-L98
|
150,766
|
jtrfp/javamod
|
src/main/java/de/quippy/mp3/decoder/Decoder.java
|
Decoder.decodeFrame
|
public Obuffer decodeFrame(Header header, Bitstream stream)
throws DecoderException
{
try
{
if (!initialized)
{
initialize(header);
}
int layer = header.layer();
output.clear_buffer();
FrameDecoder decoder = retrieveDecoder(header, stream, layer);
decoder.decodeFrame();
output.write_buffer(1);
}
catch (RuntimeException ex)
{
// UUPS - this frame seems to be corrupt - let's continue to the next one
}
return output;
}
|
java
|
public Obuffer decodeFrame(Header header, Bitstream stream)
throws DecoderException
{
try
{
if (!initialized)
{
initialize(header);
}
int layer = header.layer();
output.clear_buffer();
FrameDecoder decoder = retrieveDecoder(header, stream, layer);
decoder.decodeFrame();
output.write_buffer(1);
}
catch (RuntimeException ex)
{
// UUPS - this frame seems to be corrupt - let's continue to the next one
}
return output;
}
|
[
"public",
"Obuffer",
"decodeFrame",
"(",
"Header",
"header",
",",
"Bitstream",
"stream",
")",
"throws",
"DecoderException",
"{",
"try",
"{",
"if",
"(",
"!",
"initialized",
")",
"{",
"initialize",
"(",
"header",
")",
";",
"}",
"int",
"layer",
"=",
"header",
".",
"layer",
"(",
")",
";",
"output",
".",
"clear_buffer",
"(",
")",
";",
"FrameDecoder",
"decoder",
"=",
"retrieveDecoder",
"(",
"header",
",",
"stream",
",",
"layer",
")",
";",
"decoder",
".",
"decodeFrame",
"(",
")",
";",
"output",
".",
"write_buffer",
"(",
"1",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"ex",
")",
"{",
"// UUPS - this frame seems to be corrupt - let's continue to the next one",
"}",
"return",
"output",
";",
"}"
] |
Decodes one frame from an MPEG audio bitstream.
@param header The header describing the frame to decode.
@param bitstream The bistream that provides the bits for the body of the frame.
@return A SampleBuffer containing the decoded samples.
|
[
"Decodes",
"one",
"frame",
"from",
"an",
"MPEG",
"audio",
"bitstream",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/mp3/decoder/Decoder.java#L133-L159
|
150,767
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/memory/CachedObject.java
|
CachedObject.use
|
public synchronized void use(Object user) {
usage++;
lastUsage = System.currentTimeMillis();
if (users != null)
users.add(user);
}
|
java
|
public synchronized void use(Object user) {
usage++;
lastUsage = System.currentTimeMillis();
if (users != null)
users.add(user);
}
|
[
"public",
"synchronized",
"void",
"use",
"(",
"Object",
"user",
")",
"{",
"usage",
"++",
";",
"lastUsage",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"if",
"(",
"users",
"!=",
"null",
")",
"users",
".",
"add",
"(",
"user",
")",
";",
"}"
] |
Add the given object as user of this cached data.
|
[
"Add",
"the",
"given",
"object",
"as",
"user",
"of",
"this",
"cached",
"data",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/memory/CachedObject.java#L29-L34
|
150,768
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/memory/CachedObject.java
|
CachedObject.release
|
public synchronized void release(Object user) {
usage--;
if (users != null) {
if (!users.remove(user))
LCCore.getApplication().getDefaultLogger()
.error("CachedObject released by " + user + " but not in users list", new Exception());
}
}
|
java
|
public synchronized void release(Object user) {
usage--;
if (users != null) {
if (!users.remove(user))
LCCore.getApplication().getDefaultLogger()
.error("CachedObject released by " + user + " but not in users list", new Exception());
}
}
|
[
"public",
"synchronized",
"void",
"release",
"(",
"Object",
"user",
")",
"{",
"usage",
"--",
";",
"if",
"(",
"users",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"users",
".",
"remove",
"(",
"user",
")",
")",
"LCCore",
".",
"getApplication",
"(",
")",
".",
"getDefaultLogger",
"(",
")",
".",
"error",
"(",
"\"CachedObject released by \"",
"+",
"user",
"+",
"\" but not in users list\"",
",",
"new",
"Exception",
"(",
")",
")",
";",
"}",
"}"
] |
Remove the given object as user of this cached data.
|
[
"Remove",
"the",
"given",
"object",
"as",
"user",
"of",
"this",
"cached",
"data",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/memory/CachedObject.java#L37-L44
|
150,769
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/io/serialization/AbstractSerializer.java
|
AbstractSerializer.serializeValue
|
public ISynchronizationPoint<? extends Exception> serializeValue(
SerializationContext context, Object value, TypeDefinition typeDef, String path, List<SerializationRule> rules
) {
if (value == null)
return serializeNullValue();
for (SerializationRule rule : rules)
value = rule.convertSerializationValue(value, typeDef, context);
Class<?> type = value.getClass();
if (type.isArray()) {
if (value instanceof byte[])
return serializeByteArrayValue(context, (byte[])value, path, rules);
Class<?> elementType = type.getComponentType();
CollectionContext ctx = new CollectionContext(context, value, typeDef, new TypeDefinition(elementType));
return serializeCollectionValue(ctx, path, rules);
}
if (boolean.class.equals(type) || Boolean.class.equals(type))
return serializeBooleanValue(((Boolean)value).booleanValue());
if (byte.class.equals(type) ||
short.class.equals(type) ||
int.class.equals(type) ||
long.class.equals(type) ||
float.class.equals(type) ||
double.class.equals(type) ||
Number.class.isAssignableFrom(type))
return serializeNumericValue((Number)value);
if (char.class.equals(type) || Character.class.equals(type))
return serializeCharacterValue(((Character)value).charValue());
if (CharSequence.class.isAssignableFrom(type))
return serializeStringValue((CharSequence)value);
if (type.isEnum())
return serializeStringValue(((Enum<?>)value).name());
if (Collection.class.isAssignableFrom(type)) {
TypeDefinition elementType;
if (typeDef.getParameters().isEmpty())
elementType = null;
else
elementType = typeDef.getParameters().get(0);
CollectionContext ctx = new CollectionContext(context, value, typeDef, elementType);
return serializeCollectionValue(ctx, path, rules);
}
if (Map.class.isAssignableFrom(type))
return serializeMapValue(context, (Map<?,?>)value, typeDef, path, rules);
if (InputStream.class.isAssignableFrom(type))
return serializeInputStreamValue(context, (InputStream)value, path, rules);
if (IO.Readable.class.isAssignableFrom(type))
return serializeIOReadableValue(context, (IO.Readable)value, path, rules);
return serializeObjectValue(context, value, typeDef, path, rules);
}
|
java
|
public ISynchronizationPoint<? extends Exception> serializeValue(
SerializationContext context, Object value, TypeDefinition typeDef, String path, List<SerializationRule> rules
) {
if (value == null)
return serializeNullValue();
for (SerializationRule rule : rules)
value = rule.convertSerializationValue(value, typeDef, context);
Class<?> type = value.getClass();
if (type.isArray()) {
if (value instanceof byte[])
return serializeByteArrayValue(context, (byte[])value, path, rules);
Class<?> elementType = type.getComponentType();
CollectionContext ctx = new CollectionContext(context, value, typeDef, new TypeDefinition(elementType));
return serializeCollectionValue(ctx, path, rules);
}
if (boolean.class.equals(type) || Boolean.class.equals(type))
return serializeBooleanValue(((Boolean)value).booleanValue());
if (byte.class.equals(type) ||
short.class.equals(type) ||
int.class.equals(type) ||
long.class.equals(type) ||
float.class.equals(type) ||
double.class.equals(type) ||
Number.class.isAssignableFrom(type))
return serializeNumericValue((Number)value);
if (char.class.equals(type) || Character.class.equals(type))
return serializeCharacterValue(((Character)value).charValue());
if (CharSequence.class.isAssignableFrom(type))
return serializeStringValue((CharSequence)value);
if (type.isEnum())
return serializeStringValue(((Enum<?>)value).name());
if (Collection.class.isAssignableFrom(type)) {
TypeDefinition elementType;
if (typeDef.getParameters().isEmpty())
elementType = null;
else
elementType = typeDef.getParameters().get(0);
CollectionContext ctx = new CollectionContext(context, value, typeDef, elementType);
return serializeCollectionValue(ctx, path, rules);
}
if (Map.class.isAssignableFrom(type))
return serializeMapValue(context, (Map<?,?>)value, typeDef, path, rules);
if (InputStream.class.isAssignableFrom(type))
return serializeInputStreamValue(context, (InputStream)value, path, rules);
if (IO.Readable.class.isAssignableFrom(type))
return serializeIOReadableValue(context, (IO.Readable)value, path, rules);
return serializeObjectValue(context, value, typeDef, path, rules);
}
|
[
"public",
"ISynchronizationPoint",
"<",
"?",
"extends",
"Exception",
">",
"serializeValue",
"(",
"SerializationContext",
"context",
",",
"Object",
"value",
",",
"TypeDefinition",
"typeDef",
",",
"String",
"path",
",",
"List",
"<",
"SerializationRule",
">",
"rules",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"return",
"serializeNullValue",
"(",
")",
";",
"for",
"(",
"SerializationRule",
"rule",
":",
"rules",
")",
"value",
"=",
"rule",
".",
"convertSerializationValue",
"(",
"value",
",",
"typeDef",
",",
"context",
")",
";",
"Class",
"<",
"?",
">",
"type",
"=",
"value",
".",
"getClass",
"(",
")",
";",
"if",
"(",
"type",
".",
"isArray",
"(",
")",
")",
"{",
"if",
"(",
"value",
"instanceof",
"byte",
"[",
"]",
")",
"return",
"serializeByteArrayValue",
"(",
"context",
",",
"(",
"byte",
"[",
"]",
")",
"value",
",",
"path",
",",
"rules",
")",
";",
"Class",
"<",
"?",
">",
"elementType",
"=",
"type",
".",
"getComponentType",
"(",
")",
";",
"CollectionContext",
"ctx",
"=",
"new",
"CollectionContext",
"(",
"context",
",",
"value",
",",
"typeDef",
",",
"new",
"TypeDefinition",
"(",
"elementType",
")",
")",
";",
"return",
"serializeCollectionValue",
"(",
"ctx",
",",
"path",
",",
"rules",
")",
";",
"}",
"if",
"(",
"boolean",
".",
"class",
".",
"equals",
"(",
"type",
")",
"||",
"Boolean",
".",
"class",
".",
"equals",
"(",
"type",
")",
")",
"return",
"serializeBooleanValue",
"(",
"(",
"(",
"Boolean",
")",
"value",
")",
".",
"booleanValue",
"(",
")",
")",
";",
"if",
"(",
"byte",
".",
"class",
".",
"equals",
"(",
"type",
")",
"||",
"short",
".",
"class",
".",
"equals",
"(",
"type",
")",
"||",
"int",
".",
"class",
".",
"equals",
"(",
"type",
")",
"||",
"long",
".",
"class",
".",
"equals",
"(",
"type",
")",
"||",
"float",
".",
"class",
".",
"equals",
"(",
"type",
")",
"||",
"double",
".",
"class",
".",
"equals",
"(",
"type",
")",
"||",
"Number",
".",
"class",
".",
"isAssignableFrom",
"(",
"type",
")",
")",
"return",
"serializeNumericValue",
"(",
"(",
"Number",
")",
"value",
")",
";",
"if",
"(",
"char",
".",
"class",
".",
"equals",
"(",
"type",
")",
"||",
"Character",
".",
"class",
".",
"equals",
"(",
"type",
")",
")",
"return",
"serializeCharacterValue",
"(",
"(",
"(",
"Character",
")",
"value",
")",
".",
"charValue",
"(",
")",
")",
";",
"if",
"(",
"CharSequence",
".",
"class",
".",
"isAssignableFrom",
"(",
"type",
")",
")",
"return",
"serializeStringValue",
"(",
"(",
"CharSequence",
")",
"value",
")",
";",
"if",
"(",
"type",
".",
"isEnum",
"(",
")",
")",
"return",
"serializeStringValue",
"(",
"(",
"(",
"Enum",
"<",
"?",
">",
")",
"value",
")",
".",
"name",
"(",
")",
")",
";",
"if",
"(",
"Collection",
".",
"class",
".",
"isAssignableFrom",
"(",
"type",
")",
")",
"{",
"TypeDefinition",
"elementType",
";",
"if",
"(",
"typeDef",
".",
"getParameters",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"elementType",
"=",
"null",
";",
"else",
"elementType",
"=",
"typeDef",
".",
"getParameters",
"(",
")",
".",
"get",
"(",
"0",
")",
";",
"CollectionContext",
"ctx",
"=",
"new",
"CollectionContext",
"(",
"context",
",",
"value",
",",
"typeDef",
",",
"elementType",
")",
";",
"return",
"serializeCollectionValue",
"(",
"ctx",
",",
"path",
",",
"rules",
")",
";",
"}",
"if",
"(",
"Map",
".",
"class",
".",
"isAssignableFrom",
"(",
"type",
")",
")",
"return",
"serializeMapValue",
"(",
"context",
",",
"(",
"Map",
"<",
"?",
",",
"?",
">",
")",
"value",
",",
"typeDef",
",",
"path",
",",
"rules",
")",
";",
"if",
"(",
"InputStream",
".",
"class",
".",
"isAssignableFrom",
"(",
"type",
")",
")",
"return",
"serializeInputStreamValue",
"(",
"context",
",",
"(",
"InputStream",
")",
"value",
",",
"path",
",",
"rules",
")",
";",
"if",
"(",
"IO",
".",
"Readable",
".",
"class",
".",
"isAssignableFrom",
"(",
"type",
")",
")",
"return",
"serializeIOReadableValue",
"(",
"context",
",",
"(",
"IO",
".",
"Readable",
")",
"value",
",",
"path",
",",
"rules",
")",
";",
"return",
"serializeObjectValue",
"(",
"context",
",",
"value",
",",
"typeDef",
",",
"path",
",",
"rules",
")",
";",
"}"
] |
Serialize a value.
|
[
"Serialize",
"a",
"value",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/io/serialization/AbstractSerializer.java#L84-L144
|
150,770
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mod/loader/tracker/ScreamTrackerMod.java
|
ScreamTrackerMod.setPattern
|
private void setPattern(int pattNum, ModfileInputStream inputStream) throws IOException
{
int row=0;
PatternRow currentRow = getPatternContainer().getPatternRow(pattNum, row);
int count = inputStream.readIntelWord()-2; // this read byte also counts
while (count>=0)
{
int packByte = inputStream.readByteAsInt(); count--;
if (packByte==0)
{
row++;
if (row>=64)
break; // Maximum. But do we have to break?! Donnow...
else
currentRow = getPatternContainer().getPatternRow(pattNum, row);
}
else
{
int channel = packByte&31; // there is the channel
channel = channelMap[channel];
int period = 0;
int noteIndex = 0;
int instrument = 0;
int volume = -1;
int effekt = 0;
int effektOp = 0;
if ((packByte&32)!=0) // Note and Sample follow
{
int ton = inputStream.readByteAsInt(); count--;
if (ton==254)
{
noteIndex = period = Helpers.NOTE_CUT; // This is our NoteCutValue!
}
else
{
// calculate the new note
noteIndex = ((ton>>4)+1)*12+(ton&0xF); // fit to it octacves
if (noteIndex>=Helpers.noteValues.length)
{
period = 0;
noteIndex = 0;
}
else
{
period = Helpers.noteValues[noteIndex];
noteIndex++;
}
}
instrument = inputStream.readByteAsInt(); count--;
}
if ((packByte&64)!=0) // volume following
{
volume = inputStream.readByteAsInt(); count--;
}
if ((packByte&128)!=0) // Effekts!
{
effekt = inputStream.readByteAsInt(); count--;
effektOp = inputStream.readByteAsInt(); count--;
}
if (channel!=-1)
{
PatternElement currentElement = currentRow.getPatternElement(channel);
currentElement.setNoteIndex(noteIndex);
currentElement.setPeriod(period);
currentElement.setInstrument(instrument);
if (volume!=-1)
{
currentElement.setVolumeEffekt(1);
currentElement.setVolumeEffektOp(volume);
}
currentElement.setEffekt(effekt);
currentElement.setEffektOp(effektOp);
}
}
}
}
|
java
|
private void setPattern(int pattNum, ModfileInputStream inputStream) throws IOException
{
int row=0;
PatternRow currentRow = getPatternContainer().getPatternRow(pattNum, row);
int count = inputStream.readIntelWord()-2; // this read byte also counts
while (count>=0)
{
int packByte = inputStream.readByteAsInt(); count--;
if (packByte==0)
{
row++;
if (row>=64)
break; // Maximum. But do we have to break?! Donnow...
else
currentRow = getPatternContainer().getPatternRow(pattNum, row);
}
else
{
int channel = packByte&31; // there is the channel
channel = channelMap[channel];
int period = 0;
int noteIndex = 0;
int instrument = 0;
int volume = -1;
int effekt = 0;
int effektOp = 0;
if ((packByte&32)!=0) // Note and Sample follow
{
int ton = inputStream.readByteAsInt(); count--;
if (ton==254)
{
noteIndex = period = Helpers.NOTE_CUT; // This is our NoteCutValue!
}
else
{
// calculate the new note
noteIndex = ((ton>>4)+1)*12+(ton&0xF); // fit to it octacves
if (noteIndex>=Helpers.noteValues.length)
{
period = 0;
noteIndex = 0;
}
else
{
period = Helpers.noteValues[noteIndex];
noteIndex++;
}
}
instrument = inputStream.readByteAsInt(); count--;
}
if ((packByte&64)!=0) // volume following
{
volume = inputStream.readByteAsInt(); count--;
}
if ((packByte&128)!=0) // Effekts!
{
effekt = inputStream.readByteAsInt(); count--;
effektOp = inputStream.readByteAsInt(); count--;
}
if (channel!=-1)
{
PatternElement currentElement = currentRow.getPatternElement(channel);
currentElement.setNoteIndex(noteIndex);
currentElement.setPeriod(period);
currentElement.setInstrument(instrument);
if (volume!=-1)
{
currentElement.setVolumeEffekt(1);
currentElement.setVolumeEffektOp(volume);
}
currentElement.setEffekt(effekt);
currentElement.setEffektOp(effektOp);
}
}
}
}
|
[
"private",
"void",
"setPattern",
"(",
"int",
"pattNum",
",",
"ModfileInputStream",
"inputStream",
")",
"throws",
"IOException",
"{",
"int",
"row",
"=",
"0",
";",
"PatternRow",
"currentRow",
"=",
"getPatternContainer",
"(",
")",
".",
"getPatternRow",
"(",
"pattNum",
",",
"row",
")",
";",
"int",
"count",
"=",
"inputStream",
".",
"readIntelWord",
"(",
")",
"-",
"2",
";",
"// this read byte also counts",
"while",
"(",
"count",
">=",
"0",
")",
"{",
"int",
"packByte",
"=",
"inputStream",
".",
"readByteAsInt",
"(",
")",
";",
"count",
"--",
";",
"if",
"(",
"packByte",
"==",
"0",
")",
"{",
"row",
"++",
";",
"if",
"(",
"row",
">=",
"64",
")",
"break",
";",
"// Maximum. But do we have to break?! Donnow...",
"else",
"currentRow",
"=",
"getPatternContainer",
"(",
")",
".",
"getPatternRow",
"(",
"pattNum",
",",
"row",
")",
";",
"}",
"else",
"{",
"int",
"channel",
"=",
"packByte",
"&",
"31",
";",
"// there is the channel",
"channel",
"=",
"channelMap",
"[",
"channel",
"]",
";",
"int",
"period",
"=",
"0",
";",
"int",
"noteIndex",
"=",
"0",
";",
"int",
"instrument",
"=",
"0",
";",
"int",
"volume",
"=",
"-",
"1",
";",
"int",
"effekt",
"=",
"0",
";",
"int",
"effektOp",
"=",
"0",
";",
"if",
"(",
"(",
"packByte",
"&",
"32",
")",
"!=",
"0",
")",
"// Note and Sample follow",
"{",
"int",
"ton",
"=",
"inputStream",
".",
"readByteAsInt",
"(",
")",
";",
"count",
"--",
";",
"if",
"(",
"ton",
"==",
"254",
")",
"{",
"noteIndex",
"=",
"period",
"=",
"Helpers",
".",
"NOTE_CUT",
";",
"// This is our NoteCutValue!",
"}",
"else",
"{",
"// calculate the new note",
"noteIndex",
"=",
"(",
"(",
"ton",
">>",
"4",
")",
"+",
"1",
")",
"*",
"12",
"+",
"(",
"ton",
"&",
"0xF",
")",
";",
"// fit to it octacves",
"if",
"(",
"noteIndex",
">=",
"Helpers",
".",
"noteValues",
".",
"length",
")",
"{",
"period",
"=",
"0",
";",
"noteIndex",
"=",
"0",
";",
"}",
"else",
"{",
"period",
"=",
"Helpers",
".",
"noteValues",
"[",
"noteIndex",
"]",
";",
"noteIndex",
"++",
";",
"}",
"}",
"instrument",
"=",
"inputStream",
".",
"readByteAsInt",
"(",
")",
";",
"count",
"--",
";",
"}",
"if",
"(",
"(",
"packByte",
"&",
"64",
")",
"!=",
"0",
")",
"// volume following",
"{",
"volume",
"=",
"inputStream",
".",
"readByteAsInt",
"(",
")",
";",
"count",
"--",
";",
"}",
"if",
"(",
"(",
"packByte",
"&",
"128",
")",
"!=",
"0",
")",
"// Effekts!",
"{",
"effekt",
"=",
"inputStream",
".",
"readByteAsInt",
"(",
")",
";",
"count",
"--",
";",
"effektOp",
"=",
"inputStream",
".",
"readByteAsInt",
"(",
")",
";",
"count",
"--",
";",
"}",
"if",
"(",
"channel",
"!=",
"-",
"1",
")",
"{",
"PatternElement",
"currentElement",
"=",
"currentRow",
".",
"getPatternElement",
"(",
"channel",
")",
";",
"currentElement",
".",
"setNoteIndex",
"(",
"noteIndex",
")",
";",
"currentElement",
".",
"setPeriod",
"(",
"period",
")",
";",
"currentElement",
".",
"setInstrument",
"(",
"instrument",
")",
";",
"if",
"(",
"volume",
"!=",
"-",
"1",
")",
"{",
"currentElement",
".",
"setVolumeEffekt",
"(",
"1",
")",
";",
"currentElement",
".",
"setVolumeEffektOp",
"(",
"volume",
")",
";",
"}",
"currentElement",
".",
"setEffekt",
"(",
"effekt",
")",
";",
"currentElement",
".",
"setEffektOp",
"(",
"effektOp",
")",
";",
"}",
"}",
"}",
"}"
] |
Set a Pattern by interpreting
@param input
@param offset
@param pattNum
|
[
"Set",
"a",
"Pattern",
"by",
"interpreting"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/loader/tracker/ScreamTrackerMod.java#L145-L227
|
150,771
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/application/VersionRange.java
|
VersionRange.includes
|
public boolean includes(int[] v) {
if (min != null && Version.compare(v, min) < 0) return false;
if (max == null) return true;
int c = Version.compare(v, max);
if (c > 0) return false;
if (c < 0) return true;
return maxIncluded;
}
|
java
|
public boolean includes(int[] v) {
if (min != null && Version.compare(v, min) < 0) return false;
if (max == null) return true;
int c = Version.compare(v, max);
if (c > 0) return false;
if (c < 0) return true;
return maxIncluded;
}
|
[
"public",
"boolean",
"includes",
"(",
"int",
"[",
"]",
"v",
")",
"{",
"if",
"(",
"min",
"!=",
"null",
"&&",
"Version",
".",
"compare",
"(",
"v",
",",
"min",
")",
"<",
"0",
")",
"return",
"false",
";",
"if",
"(",
"max",
"==",
"null",
")",
"return",
"true",
";",
"int",
"c",
"=",
"Version",
".",
"compare",
"(",
"v",
",",
"max",
")",
";",
"if",
"(",
"c",
">",
"0",
")",
"return",
"false",
";",
"if",
"(",
"c",
"<",
"0",
")",
"return",
"true",
";",
"return",
"maxIncluded",
";",
"}"
] |
Return true if this VersionRange includes the given version.
|
[
"Return",
"true",
"if",
"this",
"VersionRange",
"includes",
"the",
"given",
"version",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/application/VersionRange.java#L35-L42
|
150,772
|
mwanji/sql-writer
|
src/main/java/co/mewf/sqlwriter/builders/SelectBuilder.java
|
SelectBuilder.from
|
public SelectBuilder from(Class<?> entityClass) {
if (rootTable == null) {
rootTable = new TableInfo(entityClass, dialect);
currentTable = rootTable;
} else {
join(entityClass);
}
tables.add(currentTable);
return this;
}
|
java
|
public SelectBuilder from(Class<?> entityClass) {
if (rootTable == null) {
rootTable = new TableInfo(entityClass, dialect);
currentTable = rootTable;
} else {
join(entityClass);
}
tables.add(currentTable);
return this;
}
|
[
"public",
"SelectBuilder",
"from",
"(",
"Class",
"<",
"?",
">",
"entityClass",
")",
"{",
"if",
"(",
"rootTable",
"==",
"null",
")",
"{",
"rootTable",
"=",
"new",
"TableInfo",
"(",
"entityClass",
",",
"dialect",
")",
";",
"currentTable",
"=",
"rootTable",
";",
"}",
"else",
"{",
"join",
"(",
"entityClass",
")",
";",
"}",
"tables",
".",
"add",
"(",
"currentTable",
")",
";",
"return",
"this",
";",
"}"
] |
Retrieves the columns from the given entity and inner joins it to the previous entity given to the builder.
entityClass becomes the current entity.
|
[
"Retrieves",
"the",
"columns",
"from",
"the",
"given",
"entity",
"and",
"inner",
"joins",
"it",
"to",
"the",
"previous",
"entity",
"given",
"to",
"the",
"builder",
"."
] |
319efa92211845d53fb6271650cd42d1b644f463
|
https://github.com/mwanji/sql-writer/blob/319efa92211845d53fb6271650cd42d1b644f463/src/main/java/co/mewf/sqlwriter/builders/SelectBuilder.java#L34-L44
|
150,773
|
mwanji/sql-writer
|
src/main/java/co/mewf/sqlwriter/builders/SelectBuilder.java
|
SelectBuilder.join
|
public SelectBuilder join(Class<?> from, Class<?> to) {
currentTable = rootTable.join(from, to);
return this;
}
|
java
|
public SelectBuilder join(Class<?> from, Class<?> to) {
currentTable = rootTable.join(from, to);
return this;
}
|
[
"public",
"SelectBuilder",
"join",
"(",
"Class",
"<",
"?",
">",
"from",
",",
"Class",
"<",
"?",
">",
"to",
")",
"{",
"currentTable",
"=",
"rootTable",
".",
"join",
"(",
"from",
",",
"to",
")",
";",
"return",
"this",
";",
"}"
] |
Joins from and to. from becomes the current entity.
|
[
"Joins",
"from",
"and",
"to",
".",
"from",
"becomes",
"the",
"current",
"entity",
"."
] |
319efa92211845d53fb6271650cd42d1b644f463
|
https://github.com/mwanji/sql-writer/blob/319efa92211845d53fb6271650cd42d1b644f463/src/main/java/co/mewf/sqlwriter/builders/SelectBuilder.java#L58-L62
|
150,774
|
mwanji/sql-writer
|
src/main/java/co/mewf/sqlwriter/builders/SelectBuilder.java
|
SelectBuilder.leftJoin
|
public SelectBuilder leftJoin(Class<?> entityClass) {
currentTable = rootTable.leftJoin(entityClass, currentTable.entityClass);
return this;
}
|
java
|
public SelectBuilder leftJoin(Class<?> entityClass) {
currentTable = rootTable.leftJoin(entityClass, currentTable.entityClass);
return this;
}
|
[
"public",
"SelectBuilder",
"leftJoin",
"(",
"Class",
"<",
"?",
">",
"entityClass",
")",
"{",
"currentTable",
"=",
"rootTable",
".",
"leftJoin",
"(",
"entityClass",
",",
"currentTable",
".",
"entityClass",
")",
";",
"return",
"this",
";",
"}"
] |
Left joins this entity to the previous entity given to the builder.
entityClass becomes the current entity.
|
[
"Left",
"joins",
"this",
"entity",
"to",
"the",
"previous",
"entity",
"given",
"to",
"the",
"builder",
"."
] |
319efa92211845d53fb6271650cd42d1b644f463
|
https://github.com/mwanji/sql-writer/blob/319efa92211845d53fb6271650cd42d1b644f463/src/main/java/co/mewf/sqlwriter/builders/SelectBuilder.java#L70-L73
|
150,775
|
mwanji/sql-writer
|
src/main/java/co/mewf/sqlwriter/builders/SelectBuilder.java
|
SelectBuilder.rightJoin
|
public SelectBuilder rightJoin(Class<?> entityClass) {
currentTable = rootTable.rightJoin(entityClass, currentTable.entityClass);
return this;
}
|
java
|
public SelectBuilder rightJoin(Class<?> entityClass) {
currentTable = rootTable.rightJoin(entityClass, currentTable.entityClass);
return this;
}
|
[
"public",
"SelectBuilder",
"rightJoin",
"(",
"Class",
"<",
"?",
">",
"entityClass",
")",
"{",
"currentTable",
"=",
"rootTable",
".",
"rightJoin",
"(",
"entityClass",
",",
"currentTable",
".",
"entityClass",
")",
";",
"return",
"this",
";",
"}"
] |
Right joins this entity to the previous entity given to the builder.
entityClass becomes the current entity.
|
[
"Right",
"joins",
"this",
"entity",
"to",
"the",
"previous",
"entity",
"given",
"to",
"the",
"builder",
"."
] |
319efa92211845d53fb6271650cd42d1b644f463
|
https://github.com/mwanji/sql-writer/blob/319efa92211845d53fb6271650cd42d1b644f463/src/main/java/co/mewf/sqlwriter/builders/SelectBuilder.java#L81-L84
|
150,776
|
mwanji/sql-writer
|
src/main/java/co/mewf/sqlwriter/builders/SelectBuilder.java
|
SelectBuilder.columns
|
public SelectBuilder columns(String... columns) {
for (String column : columns) {
column(column, null);
}
return this;
}
|
java
|
public SelectBuilder columns(String... columns) {
for (String column : columns) {
column(column, null);
}
return this;
}
|
[
"public",
"SelectBuilder",
"columns",
"(",
"String",
"...",
"columns",
")",
"{",
"for",
"(",
"String",
"column",
":",
"columns",
")",
"{",
"column",
"(",
"column",
",",
"null",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Adds the columns of the current entity to the select clause
|
[
"Adds",
"the",
"columns",
"of",
"the",
"current",
"entity",
"to",
"the",
"select",
"clause"
] |
319efa92211845d53fb6271650cd42d1b644f463
|
https://github.com/mwanji/sql-writer/blob/319efa92211845d53fb6271650cd42d1b644f463/src/main/java/co/mewf/sqlwriter/builders/SelectBuilder.java#L89-L95
|
150,777
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mod/mixer/ScreamTrackerMixer.java
|
ScreamTrackerMixer.doTremorEffekt
|
protected void doTremorEffekt(ChannelMemory aktMemo)
{
if (aktMemo.tremorCount<aktMemo.tremorOntime)
aktMemo.currentVolume = aktMemo.currentSetVolume;
else
aktMemo.currentVolume = 0;
aktMemo.tremorCount++;
if (aktMemo.tremorCount>(aktMemo.tremorOntime + aktMemo.tremorOfftime)) aktMemo.tremorCount=0;
}
|
java
|
protected void doTremorEffekt(ChannelMemory aktMemo)
{
if (aktMemo.tremorCount<aktMemo.tremorOntime)
aktMemo.currentVolume = aktMemo.currentSetVolume;
else
aktMemo.currentVolume = 0;
aktMemo.tremorCount++;
if (aktMemo.tremorCount>(aktMemo.tremorOntime + aktMemo.tremorOfftime)) aktMemo.tremorCount=0;
}
|
[
"protected",
"void",
"doTremorEffekt",
"(",
"ChannelMemory",
"aktMemo",
")",
"{",
"if",
"(",
"aktMemo",
".",
"tremorCount",
"<",
"aktMemo",
".",
"tremorOntime",
")",
"aktMemo",
".",
"currentVolume",
"=",
"aktMemo",
".",
"currentSetVolume",
";",
"else",
"aktMemo",
".",
"currentVolume",
"=",
"0",
";",
"aktMemo",
".",
"tremorCount",
"++",
";",
"if",
"(",
"aktMemo",
".",
"tremorCount",
">",
"(",
"aktMemo",
".",
"tremorOntime",
"+",
"aktMemo",
".",
"tremorOfftime",
")",
")",
"aktMemo",
".",
"tremorCount",
"=",
"0",
";",
"}"
] |
The tremor effekt
@param aktMemo
|
[
"The",
"tremor",
"effekt"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/mixer/ScreamTrackerMixer.java#L478-L487
|
150,778
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mod/mixer/ScreamTrackerMixer.java
|
ScreamTrackerMixer.doVolumeSlideEffekt
|
protected void doVolumeSlideEffekt(ChannelMemory aktMemo)
{
int x = aktMemo.volumSlideValue>>4;
int y = aktMemo.volumSlideValue&0xF;
if (x!=0)
{
if (x==0xF && y!=0)
aktMemo.currentSetVolume = aktMemo.currentVolume -= y;
else
aktMemo.currentSetVolume = aktMemo.currentVolume += x;
}
else
if (y!=0)
{
if (x!=0 && y==0xF)
aktMemo.currentSetVolume = aktMemo.currentVolume += x;
else
aktMemo.currentSetVolume = aktMemo.currentVolume -= y;
}
}
|
java
|
protected void doVolumeSlideEffekt(ChannelMemory aktMemo)
{
int x = aktMemo.volumSlideValue>>4;
int y = aktMemo.volumSlideValue&0xF;
if (x!=0)
{
if (x==0xF && y!=0)
aktMemo.currentSetVolume = aktMemo.currentVolume -= y;
else
aktMemo.currentSetVolume = aktMemo.currentVolume += x;
}
else
if (y!=0)
{
if (x!=0 && y==0xF)
aktMemo.currentSetVolume = aktMemo.currentVolume += x;
else
aktMemo.currentSetVolume = aktMemo.currentVolume -= y;
}
}
|
[
"protected",
"void",
"doVolumeSlideEffekt",
"(",
"ChannelMemory",
"aktMemo",
")",
"{",
"int",
"x",
"=",
"aktMemo",
".",
"volumSlideValue",
">>",
"4",
";",
"int",
"y",
"=",
"aktMemo",
".",
"volumSlideValue",
"&",
"0xF",
";",
"if",
"(",
"x",
"!=",
"0",
")",
"{",
"if",
"(",
"x",
"==",
"0xF",
"&&",
"y",
"!=",
"0",
")",
"aktMemo",
".",
"currentSetVolume",
"=",
"aktMemo",
".",
"currentVolume",
"-=",
"y",
";",
"else",
"aktMemo",
".",
"currentSetVolume",
"=",
"aktMemo",
".",
"currentVolume",
"+=",
"x",
";",
"}",
"else",
"if",
"(",
"y",
"!=",
"0",
")",
"{",
"if",
"(",
"x",
"!=",
"0",
"&&",
"y",
"==",
"0xF",
")",
"aktMemo",
".",
"currentSetVolume",
"=",
"aktMemo",
".",
"currentVolume",
"+=",
"x",
";",
"else",
"aktMemo",
".",
"currentSetVolume",
"=",
"aktMemo",
".",
"currentVolume",
"-=",
"y",
";",
"}",
"}"
] |
Convenient Method for the VolumeSlide Effekt
@param aktMemo
|
[
"Convenient",
"Method",
"for",
"the",
"VolumeSlide",
"Effekt"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/mixer/ScreamTrackerMixer.java#L492-L511
|
150,779
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mod/mixer/ScreamTrackerMixer.java
|
ScreamTrackerMixer.doChannelVolumeSlideEffekt
|
protected void doChannelVolumeSlideEffekt(ChannelMemory aktMemo)
{
int x = aktMemo.channelVolumSlideValue>>4;
int y = aktMemo.channelVolumSlideValue&0xF;
if (x!=0)
{
if (x==0xF && y!=0)
aktMemo.channelVolume -= y;
else
aktMemo.channelVolume += x;
}
else
if (y!=0)
{
if (x!=0 && y==0xF)
aktMemo.channelVolume += x;
else
aktMemo.channelVolume -= y;
}
if (aktMemo.channelVolume>64) aktMemo.channelVolume = 64;
else
if (aktMemo.channelVolume<0) aktMemo.channelVolume = 0;
}
|
java
|
protected void doChannelVolumeSlideEffekt(ChannelMemory aktMemo)
{
int x = aktMemo.channelVolumSlideValue>>4;
int y = aktMemo.channelVolumSlideValue&0xF;
if (x!=0)
{
if (x==0xF && y!=0)
aktMemo.channelVolume -= y;
else
aktMemo.channelVolume += x;
}
else
if (y!=0)
{
if (x!=0 && y==0xF)
aktMemo.channelVolume += x;
else
aktMemo.channelVolume -= y;
}
if (aktMemo.channelVolume>64) aktMemo.channelVolume = 64;
else
if (aktMemo.channelVolume<0) aktMemo.channelVolume = 0;
}
|
[
"protected",
"void",
"doChannelVolumeSlideEffekt",
"(",
"ChannelMemory",
"aktMemo",
")",
"{",
"int",
"x",
"=",
"aktMemo",
".",
"channelVolumSlideValue",
">>",
"4",
";",
"int",
"y",
"=",
"aktMemo",
".",
"channelVolumSlideValue",
"&",
"0xF",
";",
"if",
"(",
"x",
"!=",
"0",
")",
"{",
"if",
"(",
"x",
"==",
"0xF",
"&&",
"y",
"!=",
"0",
")",
"aktMemo",
".",
"channelVolume",
"-=",
"y",
";",
"else",
"aktMemo",
".",
"channelVolume",
"+=",
"x",
";",
"}",
"else",
"if",
"(",
"y",
"!=",
"0",
")",
"{",
"if",
"(",
"x",
"!=",
"0",
"&&",
"y",
"==",
"0xF",
")",
"aktMemo",
".",
"channelVolume",
"+=",
"x",
";",
"else",
"aktMemo",
".",
"channelVolume",
"-=",
"y",
";",
"}",
"if",
"(",
"aktMemo",
".",
"channelVolume",
">",
"64",
")",
"aktMemo",
".",
"channelVolume",
"=",
"64",
";",
"else",
"if",
"(",
"aktMemo",
".",
"channelVolume",
"<",
"0",
")",
"aktMemo",
".",
"channelVolume",
"=",
"0",
";",
"}"
] |
Same as the volumeSlide, but affects the channel volume
@since 21.06.2006
@param aktMemo
|
[
"Same",
"as",
"the",
"volumeSlide",
"but",
"affects",
"the",
"channel",
"volume"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/mixer/ScreamTrackerMixer.java#L517-L540
|
150,780
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mod/mixer/ScreamTrackerMixer.java
|
ScreamTrackerMixer.doPanningSlideEffekt
|
protected void doPanningSlideEffekt(ChannelMemory aktMemo)
{
aktMemo.doSurround = false;
aktMemo.panning += aktMemo.panningSlideValue;
}
|
java
|
protected void doPanningSlideEffekt(ChannelMemory aktMemo)
{
aktMemo.doSurround = false;
aktMemo.panning += aktMemo.panningSlideValue;
}
|
[
"protected",
"void",
"doPanningSlideEffekt",
"(",
"ChannelMemory",
"aktMemo",
")",
"{",
"aktMemo",
".",
"doSurround",
"=",
"false",
";",
"aktMemo",
".",
"panning",
"+=",
"aktMemo",
".",
"panningSlideValue",
";",
"}"
] |
Convenient Method for the panning slide Effekt
@param aktMemo
|
[
"Convenient",
"Method",
"for",
"the",
"panning",
"slide",
"Effekt"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/mixer/ScreamTrackerMixer.java#L557-L561
|
150,781
|
lkwg82/enforcer-rules
|
src/main/java/org/apache/maven/plugins/enforcer/AbstractVersionEnforcer.java
|
AbstractVersionEnforcer.enforceVersion
|
public void enforceVersion( Log log, String variableName, String requiredVersionRange, ArtifactVersion actualVersion )
throws EnforcerRuleException
{
if ( StringUtils.isEmpty( requiredVersionRange ) )
{
throw new EnforcerRuleException( variableName + " version can't be empty." );
}
else
{
VersionRange vr;
String msg = "Detected " + variableName + " Version: " + actualVersion;
// short circuit check if the strings are exactly equal
if ( actualVersion.toString().equals( requiredVersionRange ) )
{
log.debug( msg + " is allowed in the range " + requiredVersionRange + "." );
}
else
{
try
{
vr = VersionRange.createFromVersionSpec( requiredVersionRange );
if ( containsVersion( vr, actualVersion ) )
{
log.debug( msg + " is allowed in the range " + requiredVersionRange + "." );
}
else
{
String message = getMessage();
if ( StringUtils.isEmpty( message ) )
{
message = msg + " is not in the allowed range " + vr + ".";
}
throw new EnforcerRuleException( message );
}
}
catch ( InvalidVersionSpecificationException e )
{
throw new EnforcerRuleException( "The requested " + variableName + " version "
+ requiredVersionRange + " is invalid.", e );
}
}
}
}
|
java
|
public void enforceVersion( Log log, String variableName, String requiredVersionRange, ArtifactVersion actualVersion )
throws EnforcerRuleException
{
if ( StringUtils.isEmpty( requiredVersionRange ) )
{
throw new EnforcerRuleException( variableName + " version can't be empty." );
}
else
{
VersionRange vr;
String msg = "Detected " + variableName + " Version: " + actualVersion;
// short circuit check if the strings are exactly equal
if ( actualVersion.toString().equals( requiredVersionRange ) )
{
log.debug( msg + " is allowed in the range " + requiredVersionRange + "." );
}
else
{
try
{
vr = VersionRange.createFromVersionSpec( requiredVersionRange );
if ( containsVersion( vr, actualVersion ) )
{
log.debug( msg + " is allowed in the range " + requiredVersionRange + "." );
}
else
{
String message = getMessage();
if ( StringUtils.isEmpty( message ) )
{
message = msg + " is not in the allowed range " + vr + ".";
}
throw new EnforcerRuleException( message );
}
}
catch ( InvalidVersionSpecificationException e )
{
throw new EnforcerRuleException( "The requested " + variableName + " version "
+ requiredVersionRange + " is invalid.", e );
}
}
}
}
|
[
"public",
"void",
"enforceVersion",
"(",
"Log",
"log",
",",
"String",
"variableName",
",",
"String",
"requiredVersionRange",
",",
"ArtifactVersion",
"actualVersion",
")",
"throws",
"EnforcerRuleException",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"requiredVersionRange",
")",
")",
"{",
"throw",
"new",
"EnforcerRuleException",
"(",
"variableName",
"+",
"\" version can't be empty.\"",
")",
";",
"}",
"else",
"{",
"VersionRange",
"vr",
";",
"String",
"msg",
"=",
"\"Detected \"",
"+",
"variableName",
"+",
"\" Version: \"",
"+",
"actualVersion",
";",
"// short circuit check if the strings are exactly equal",
"if",
"(",
"actualVersion",
".",
"toString",
"(",
")",
".",
"equals",
"(",
"requiredVersionRange",
")",
")",
"{",
"log",
".",
"debug",
"(",
"msg",
"+",
"\" is allowed in the range \"",
"+",
"requiredVersionRange",
"+",
"\".\"",
")",
";",
"}",
"else",
"{",
"try",
"{",
"vr",
"=",
"VersionRange",
".",
"createFromVersionSpec",
"(",
"requiredVersionRange",
")",
";",
"if",
"(",
"containsVersion",
"(",
"vr",
",",
"actualVersion",
")",
")",
"{",
"log",
".",
"debug",
"(",
"msg",
"+",
"\" is allowed in the range \"",
"+",
"requiredVersionRange",
"+",
"\".\"",
")",
";",
"}",
"else",
"{",
"String",
"message",
"=",
"getMessage",
"(",
")",
";",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"message",
")",
")",
"{",
"message",
"=",
"msg",
"+",
"\" is not in the allowed range \"",
"+",
"vr",
"+",
"\".\"",
";",
"}",
"throw",
"new",
"EnforcerRuleException",
"(",
"message",
")",
";",
"}",
"}",
"catch",
"(",
"InvalidVersionSpecificationException",
"e",
")",
"{",
"throw",
"new",
"EnforcerRuleException",
"(",
"\"The requested \"",
"+",
"variableName",
"+",
"\" version \"",
"+",
"requiredVersionRange",
"+",
"\" is invalid.\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"}"
] |
Compares the specified version to see if it is allowed by the defined version range.
@param log the log
@param variableName name of variable to use in messages (Example: "Maven" or "Java" etc).
@param requiredVersionRange range of allowed versions.
@param actualVersion the version to be checked.
@throws EnforcerRuleException the enforcer rule exception
|
[
"Compares",
"the",
"specified",
"version",
"to",
"see",
"if",
"it",
"is",
"allowed",
"by",
"the",
"defined",
"version",
"range",
"."
] |
fa2d309af7907b17fc8eaf386f8056d77b654749
|
https://github.com/lkwg82/enforcer-rules/blob/fa2d309af7907b17fc8eaf386f8056d77b654749/src/main/java/org/apache/maven/plugins/enforcer/AbstractVersionEnforcer.java#L69-L116
|
150,782
|
lkwg82/enforcer-rules
|
src/main/java/org/apache/maven/plugins/enforcer/AbstractVersionEnforcer.java
|
AbstractVersionEnforcer.containsVersion
|
public static boolean containsVersion( VersionRange allowedRange, ArtifactVersion theVersion )
{
boolean matched = false;
ArtifactVersion recommendedVersion = allowedRange.getRecommendedVersion();
if ( recommendedVersion == null )
{
@SuppressWarnings( "unchecked" )
List<Restriction> restrictions = allowedRange.getRestrictions();
for ( Restriction restriction : restrictions )
{
if ( restriction.containsVersion( theVersion ) )
{
matched = true;
break;
}
}
}
else
{
// only singular versions ever have a recommendedVersion
@SuppressWarnings( "unchecked" )
int compareTo = recommendedVersion.compareTo( theVersion );
matched = ( compareTo <= 0 );
}
return matched;
}
|
java
|
public static boolean containsVersion( VersionRange allowedRange, ArtifactVersion theVersion )
{
boolean matched = false;
ArtifactVersion recommendedVersion = allowedRange.getRecommendedVersion();
if ( recommendedVersion == null )
{
@SuppressWarnings( "unchecked" )
List<Restriction> restrictions = allowedRange.getRestrictions();
for ( Restriction restriction : restrictions )
{
if ( restriction.containsVersion( theVersion ) )
{
matched = true;
break;
}
}
}
else
{
// only singular versions ever have a recommendedVersion
@SuppressWarnings( "unchecked" )
int compareTo = recommendedVersion.compareTo( theVersion );
matched = ( compareTo <= 0 );
}
return matched;
}
|
[
"public",
"static",
"boolean",
"containsVersion",
"(",
"VersionRange",
"allowedRange",
",",
"ArtifactVersion",
"theVersion",
")",
"{",
"boolean",
"matched",
"=",
"false",
";",
"ArtifactVersion",
"recommendedVersion",
"=",
"allowedRange",
".",
"getRecommendedVersion",
"(",
")",
";",
"if",
"(",
"recommendedVersion",
"==",
"null",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"List",
"<",
"Restriction",
">",
"restrictions",
"=",
"allowedRange",
".",
"getRestrictions",
"(",
")",
";",
"for",
"(",
"Restriction",
"restriction",
":",
"restrictions",
")",
"{",
"if",
"(",
"restriction",
".",
"containsVersion",
"(",
"theVersion",
")",
")",
"{",
"matched",
"=",
"true",
";",
"break",
";",
"}",
"}",
"}",
"else",
"{",
"// only singular versions ever have a recommendedVersion",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"int",
"compareTo",
"=",
"recommendedVersion",
".",
"compareTo",
"(",
"theVersion",
")",
";",
"matched",
"=",
"(",
"compareTo",
"<=",
"0",
")",
";",
"}",
"return",
"matched",
";",
"}"
] |
Copied from Artifact.VersionRange. This is tweaked to handle singular ranges properly. Currently the default
containsVersion method assumes a singular version means allow everything. This method assumes that "2.0.4" ==
"[2.0.4,)"
@param allowedRange range of allowed versions.
@param theVersion the version to be checked.
@return true if the version is contained by the range.
|
[
"Copied",
"from",
"Artifact",
".",
"VersionRange",
".",
"This",
"is",
"tweaked",
"to",
"handle",
"singular",
"ranges",
"properly",
".",
"Currently",
"the",
"default",
"containsVersion",
"method",
"assumes",
"a",
"singular",
"version",
"means",
"allow",
"everything",
".",
"This",
"method",
"assumes",
"that",
"2",
".",
"0",
".",
"4",
"==",
"[",
"2",
".",
"0",
".",
"4",
")"
] |
fa2d309af7907b17fc8eaf386f8056d77b654749
|
https://github.com/lkwg82/enforcer-rules/blob/fa2d309af7907b17fc8eaf386f8056d77b654749/src/main/java/org/apache/maven/plugins/enforcer/AbstractVersionEnforcer.java#L127-L152
|
150,783
|
hawkular/hawkular-inventory
|
hawkular-inventory-api/src/main/java/org/hawkular/inventory/api/FilterFragment.java
|
FilterFragment.from
|
public static FilterFragment[] from(Filter... filters) {
FilterFragment[] ret = new FilterFragment[filters.length];
Arrays.setAll(ret, (i) -> new FilterFragment(filters[i]));
return ret;
}
|
java
|
public static FilterFragment[] from(Filter... filters) {
FilterFragment[] ret = new FilterFragment[filters.length];
Arrays.setAll(ret, (i) -> new FilterFragment(filters[i]));
return ret;
}
|
[
"public",
"static",
"FilterFragment",
"[",
"]",
"from",
"(",
"Filter",
"...",
"filters",
")",
"{",
"FilterFragment",
"[",
"]",
"ret",
"=",
"new",
"FilterFragment",
"[",
"filters",
".",
"length",
"]",
";",
"Arrays",
".",
"setAll",
"(",
"ret",
",",
"(",
"i",
")",
"-",
">",
"new",
"FilterFragment",
"(",
"filters",
"[",
"i",
"]",
")",
")",
";",
"return",
"ret",
";",
"}"
] |
A new array of filter fragments each constructed using the corresponding filters in the provided array.
@param filters the filters to create the fragments from
@return the array of filter fragments
|
[
"A",
"new",
"array",
"of",
"filter",
"fragments",
"each",
"constructed",
"using",
"the",
"corresponding",
"filters",
"in",
"the",
"provided",
"array",
"."
] |
f56dc10323dca21777feb5b609a9e9cc70ffaf62
|
https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-api/src/main/java/org/hawkular/inventory/api/FilterFragment.java#L38-L42
|
150,784
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PMContext.java
|
PMContext.getPersistenceManager
|
public PersistenceManager getPersistenceManager() {
if (persistenceManager == null) {
try {
persistenceManager = getPresentationManager().newPersistenceManager();
} catch (Exception ex) {
getPresentationManager().error(ex);
throw new ConnectionNotFoundException();
}
}
return persistenceManager;
}
|
java
|
public PersistenceManager getPersistenceManager() {
if (persistenceManager == null) {
try {
persistenceManager = getPresentationManager().newPersistenceManager();
} catch (Exception ex) {
getPresentationManager().error(ex);
throw new ConnectionNotFoundException();
}
}
return persistenceManager;
}
|
[
"public",
"PersistenceManager",
"getPersistenceManager",
"(",
")",
"{",
"if",
"(",
"persistenceManager",
"==",
"null",
")",
"{",
"try",
"{",
"persistenceManager",
"=",
"getPresentationManager",
"(",
")",
".",
"newPersistenceManager",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"getPresentationManager",
"(",
")",
".",
"error",
"(",
"ex",
")",
";",
"throw",
"new",
"ConnectionNotFoundException",
"(",
")",
";",
"}",
"}",
"return",
"persistenceManager",
";",
"}"
] |
Return the persistence manager
@return PersistenceManager
|
[
"Return",
"the",
"persistence",
"manager"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PMContext.java#L57-L67
|
150,785
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PMContext.java
|
PMContext.getEntityContainer
|
public EntityContainer getEntityContainer(String id) {
EntityContainer ec = (EntityContainer) getPmsession().getContainer(id);
if (ec == null) {
ec = getPresentationManager().newEntityContainer(id);
getPmsession().setContainer(id, ec);
}
return ec;
}
|
java
|
public EntityContainer getEntityContainer(String id) {
EntityContainer ec = (EntityContainer) getPmsession().getContainer(id);
if (ec == null) {
ec = getPresentationManager().newEntityContainer(id);
getPmsession().setContainer(id, ec);
}
return ec;
}
|
[
"public",
"EntityContainer",
"getEntityContainer",
"(",
"String",
"id",
")",
"{",
"EntityContainer",
"ec",
"=",
"(",
"EntityContainer",
")",
"getPmsession",
"(",
")",
".",
"getContainer",
"(",
"id",
")",
";",
"if",
"(",
"ec",
"==",
"null",
")",
"{",
"ec",
"=",
"getPresentationManager",
"(",
")",
".",
"newEntityContainer",
"(",
"id",
")",
";",
"getPmsession",
"(",
")",
".",
"setContainer",
"(",
"id",
",",
"ec",
")",
";",
"}",
"return",
"ec",
";",
"}"
] |
Retrieve the container with the given id from session. If not defined, a
new one is created.
@param id The entity id
@return The container
|
[
"Retrieve",
"the",
"container",
"with",
"the",
"given",
"id",
"from",
"session",
".",
"If",
"not",
"defined",
"a",
"new",
"one",
"is",
"created",
"."
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PMContext.java#L94-L101
|
150,786
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PMContext.java
|
PMContext.getEntityContainer
|
public EntityContainer getEntityContainer(boolean ignorenull) throws PMException {
if (ignorenull) {
return entityContainer;
}
if (entityContainer == null) {
throw new PMException("pm_core.entity.not.found");
}
return entityContainer;
}
|
java
|
public EntityContainer getEntityContainer(boolean ignorenull) throws PMException {
if (ignorenull) {
return entityContainer;
}
if (entityContainer == null) {
throw new PMException("pm_core.entity.not.found");
}
return entityContainer;
}
|
[
"public",
"EntityContainer",
"getEntityContainer",
"(",
"boolean",
"ignorenull",
")",
"throws",
"PMException",
"{",
"if",
"(",
"ignorenull",
")",
"{",
"return",
"entityContainer",
";",
"}",
"if",
"(",
"entityContainer",
"==",
"null",
")",
"{",
"throw",
"new",
"PMException",
"(",
"\"pm_core.entity.not.found\"",
")",
";",
"}",
"return",
"entityContainer",
";",
"}"
] |
Returns the entity container
@param ignorenull If true, does not throws an exception on missing
container
@return The container
@throws PMException
|
[
"Returns",
"the",
"entity",
"container"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PMContext.java#L111-L119
|
150,787
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PMContext.java
|
PMContext.getSelected
|
public EntityInstanceWrapper getSelected() throws PMException {
final EntityContainer container = getEntityContainer(true);
if (container == null) {
return null;
}
return container.getSelected();
}
|
java
|
public EntityInstanceWrapper getSelected() throws PMException {
final EntityContainer container = getEntityContainer(true);
if (container == null) {
return null;
}
return container.getSelected();
}
|
[
"public",
"EntityInstanceWrapper",
"getSelected",
"(",
")",
"throws",
"PMException",
"{",
"final",
"EntityContainer",
"container",
"=",
"getEntityContainer",
"(",
"true",
")",
";",
"if",
"(",
"container",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"container",
".",
"getSelected",
"(",
")",
";",
"}"
] |
Return the selected item of the container
@return The EntityInstanceWrapper
@throws PMException
|
[
"Return",
"the",
"selected",
"item",
"of",
"the",
"container"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PMContext.java#L195-L201
|
150,788
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PMContext.java
|
PMContext.getParameter
|
public Object getParameter(String paramid) {
final Object v = get(PARAM_PREFIX + paramid);
if (v == null) {
return null;
} else {
if (v instanceof String[]) {
String[] s = (String[]) v;
if (s.length == 1) {
return s[0];
} else {
return s;
}
}
return v;
}
}
|
java
|
public Object getParameter(String paramid) {
final Object v = get(PARAM_PREFIX + paramid);
if (v == null) {
return null;
} else {
if (v instanceof String[]) {
String[] s = (String[]) v;
if (s.length == 1) {
return s[0];
} else {
return s;
}
}
return v;
}
}
|
[
"public",
"Object",
"getParameter",
"(",
"String",
"paramid",
")",
"{",
"final",
"Object",
"v",
"=",
"get",
"(",
"PARAM_PREFIX",
"+",
"paramid",
")",
";",
"if",
"(",
"v",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"if",
"(",
"v",
"instanceof",
"String",
"[",
"]",
")",
"{",
"String",
"[",
"]",
"s",
"=",
"(",
"String",
"[",
"]",
")",
"v",
";",
"if",
"(",
"s",
".",
"length",
"==",
"1",
")",
"{",
"return",
"s",
"[",
"0",
"]",
";",
"}",
"else",
"{",
"return",
"s",
";",
"}",
"}",
"return",
"v",
";",
"}",
"}"
] |
Look for a parameter in the context with the given name.
@param paramid parameter id
@return parameter value
|
[
"Look",
"for",
"a",
"parameter",
"in",
"the",
"context",
"with",
"the",
"given",
"name",
"."
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PMContext.java#L251-L266
|
150,789
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PMContext.java
|
PMContext.getParameter
|
public Object getParameter(String paramid, Object def) {
final Object v = getParameter(paramid);
if (v == null) {
return def;
} else {
return v;
}
}
|
java
|
public Object getParameter(String paramid, Object def) {
final Object v = getParameter(paramid);
if (v == null) {
return def;
} else {
return v;
}
}
|
[
"public",
"Object",
"getParameter",
"(",
"String",
"paramid",
",",
"Object",
"def",
")",
"{",
"final",
"Object",
"v",
"=",
"getParameter",
"(",
"paramid",
")",
";",
"if",
"(",
"v",
"==",
"null",
")",
"{",
"return",
"def",
";",
"}",
"else",
"{",
"return",
"v",
";",
"}",
"}"
] |
Look for a parameter in the context with the given name. If parmeter is
null, return def
@param paramid parameter id
@param def default value
@return parameter value or def if null
|
[
"Look",
"for",
"a",
"parameter",
"in",
"the",
"context",
"with",
"the",
"given",
"name",
".",
"If",
"parmeter",
"is",
"null",
"return",
"def"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PMContext.java#L276-L283
|
150,790
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PMContext.java
|
PMContext.getParameters
|
public Object[] getParameters(String paramid) {
final Object parameter = getParameter(paramid);
if (parameter == null) {
return null;
}
if (parameter instanceof Object[]) {
return (Object[]) parameter;
} else {
final Object[] result = {parameter};
return result;
}
}
|
java
|
public Object[] getParameters(String paramid) {
final Object parameter = getParameter(paramid);
if (parameter == null) {
return null;
}
if (parameter instanceof Object[]) {
return (Object[]) parameter;
} else {
final Object[] result = {parameter};
return result;
}
}
|
[
"public",
"Object",
"[",
"]",
"getParameters",
"(",
"String",
"paramid",
")",
"{",
"final",
"Object",
"parameter",
"=",
"getParameter",
"(",
"paramid",
")",
";",
"if",
"(",
"parameter",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"parameter",
"instanceof",
"Object",
"[",
"]",
")",
"{",
"return",
"(",
"Object",
"[",
"]",
")",
"parameter",
";",
"}",
"else",
"{",
"final",
"Object",
"[",
"]",
"result",
"=",
"{",
"parameter",
"}",
";",
"return",
"result",
";",
"}",
"}"
] |
Obtain parameters based on paramid as an array.
@param paramid Parameter id
@return Array list
|
[
"Obtain",
"parameters",
"based",
"on",
"paramid",
"as",
"an",
"array",
"."
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PMContext.java#L295-L306
|
150,791
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PMContext.java
|
PMContext.getBoolean
|
public boolean getBoolean(String key, boolean def) {
try {
if (!contains(key)) {
return def;
}
return (Boolean) get(key);
} catch (Exception e) {
return def;
}
}
|
java
|
public boolean getBoolean(String key, boolean def) {
try {
if (!contains(key)) {
return def;
}
return (Boolean) get(key);
} catch (Exception e) {
return def;
}
}
|
[
"public",
"boolean",
"getBoolean",
"(",
"String",
"key",
",",
"boolean",
"def",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"contains",
"(",
"key",
")",
")",
"{",
"return",
"def",
";",
"}",
"return",
"(",
"Boolean",
")",
"get",
"(",
"key",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"def",
";",
"}",
"}"
] |
Getter for a boolean value.
@param key The key
@param def Default value if there is no item at key
@return A boolean
|
[
"Getter",
"for",
"a",
"boolean",
"value",
"."
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PMContext.java#L315-L324
|
150,792
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PMContext.java
|
PMContext.getPair
|
public ContextPair getPair(String key) {
if (!this.contains(key)) {
return null;
}
return new ContextPair(key, get(key));
}
|
java
|
public ContextPair getPair(String key) {
if (!this.contains(key)) {
return null;
}
return new ContextPair(key, get(key));
}
|
[
"public",
"ContextPair",
"getPair",
"(",
"String",
"key",
")",
"{",
"if",
"(",
"!",
"this",
".",
"contains",
"(",
"key",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"ContextPair",
"(",
"key",
",",
"get",
"(",
"key",
")",
")",
";",
"}"
] |
Obtains a pair based on the given key. In there is no key, this method
returns null
@param key The key
@return the ContextPair for the given key.
|
[
"Obtains",
"a",
"pair",
"based",
"on",
"the",
"given",
"key",
".",
"In",
"there",
"is",
"no",
"key",
"this",
"method",
"returns",
"null"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PMContext.java#L333-L338
|
150,793
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PMContext.java
|
PMContext.buildInstanceWrapper
|
public EntityInstanceWrapper buildInstanceWrapper(final Object instance) throws PMException {
final EntityInstanceWrapper wrapper = new EntityInstanceWrapper(instance);
if (hasEntity() && !getEntityContainer().isSelectedNew()) {
wrapper.setInstanceId(getDataAccess().getInstanceId(this, wrapper));
}
return wrapper;
}
|
java
|
public EntityInstanceWrapper buildInstanceWrapper(final Object instance) throws PMException {
final EntityInstanceWrapper wrapper = new EntityInstanceWrapper(instance);
if (hasEntity() && !getEntityContainer().isSelectedNew()) {
wrapper.setInstanceId(getDataAccess().getInstanceId(this, wrapper));
}
return wrapper;
}
|
[
"public",
"EntityInstanceWrapper",
"buildInstanceWrapper",
"(",
"final",
"Object",
"instance",
")",
"throws",
"PMException",
"{",
"final",
"EntityInstanceWrapper",
"wrapper",
"=",
"new",
"EntityInstanceWrapper",
"(",
"instance",
")",
";",
"if",
"(",
"hasEntity",
"(",
")",
"&&",
"!",
"getEntityContainer",
"(",
")",
".",
"isSelectedNew",
"(",
")",
")",
"{",
"wrapper",
".",
"setInstanceId",
"(",
"getDataAccess",
"(",
")",
".",
"getInstanceId",
"(",
"this",
",",
"wrapper",
")",
")",
";",
"}",
"return",
"wrapper",
";",
"}"
] |
Creates a new instance wrapper with the instance and the instanceId.
|
[
"Creates",
"a",
"new",
"instance",
"wrapper",
"with",
"the",
"instance",
"and",
"the",
"instanceId",
"."
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PMContext.java#L479-L485
|
150,794
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java
|
SkbShellFactory.newShell
|
public static SkbShell newShell(MessageRenderer renderer, boolean useConsole){
return SkbShellFactory.newShell(null, renderer, useConsole);
}
|
java
|
public static SkbShell newShell(MessageRenderer renderer, boolean useConsole){
return SkbShellFactory.newShell(null, renderer, useConsole);
}
|
[
"public",
"static",
"SkbShell",
"newShell",
"(",
"MessageRenderer",
"renderer",
",",
"boolean",
"useConsole",
")",
"{",
"return",
"SkbShellFactory",
".",
"newShell",
"(",
"null",
",",
"renderer",
",",
"useConsole",
")",
";",
"}"
] |
Returns a new shell with given STG and console flag.
@param renderer a renderer for help messages
@param useConsole flag to use (true) or not to use (false) console, of false then no output will happen (except for errors on runShell() and some help commands)
@return new shell
|
[
"Returns",
"a",
"new",
"shell",
"with",
"given",
"STG",
"and",
"console",
"flag",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java#L55-L57
|
150,795
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java
|
SkbShellFactory.newShell
|
public static SkbShell newShell(String id, boolean useConsole){
return SkbShellFactory.newShell(id, null, useConsole);
}
|
java
|
public static SkbShell newShell(String id, boolean useConsole){
return SkbShellFactory.newShell(id, null, useConsole);
}
|
[
"public",
"static",
"SkbShell",
"newShell",
"(",
"String",
"id",
",",
"boolean",
"useConsole",
")",
"{",
"return",
"SkbShellFactory",
".",
"newShell",
"(",
"id",
",",
"null",
",",
"useConsole",
")",
";",
"}"
] |
Returns a new shell with given identifier and console flag with standard STGroup.
@param id new shell with identifier, uses default if given STG is not valid
@param useConsole flag to use (true) or not to use (false) console, of false then no output will happen
@return new shell
|
[
"Returns",
"a",
"new",
"shell",
"with",
"given",
"identifier",
"and",
"console",
"flag",
"with",
"standard",
"STGroup",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java#L75-L77
|
150,796
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java
|
SkbShellFactory.newShell
|
public static SkbShell newShell(String id, MessageRenderer renderer){
return SkbShellFactory.newShell(id, renderer, true);
}
|
java
|
public static SkbShell newShell(String id, MessageRenderer renderer){
return SkbShellFactory.newShell(id, renderer, true);
}
|
[
"public",
"static",
"SkbShell",
"newShell",
"(",
"String",
"id",
",",
"MessageRenderer",
"renderer",
")",
"{",
"return",
"SkbShellFactory",
".",
"newShell",
"(",
"id",
",",
"renderer",
",",
"true",
")",
";",
"}"
] |
Returns a new shell with a given identifier and STGroup plus console activated.
@param id new shell with identifier
@param renderer a renderer for help messages
@return new shell
|
[
"Returns",
"a",
"new",
"shell",
"with",
"a",
"given",
"identifier",
"and",
"STGroup",
"plus",
"console",
"activated",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java#L85-L87
|
150,797
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java
|
SkbShellFactory.newShell
|
public static SkbShell newShell(String id, MessageRenderer renderer, boolean useConsole){
return new AbstractShell(id, renderer, useConsole);
}
|
java
|
public static SkbShell newShell(String id, MessageRenderer renderer, boolean useConsole){
return new AbstractShell(id, renderer, useConsole);
}
|
[
"public",
"static",
"SkbShell",
"newShell",
"(",
"String",
"id",
",",
"MessageRenderer",
"renderer",
",",
"boolean",
"useConsole",
")",
"{",
"return",
"new",
"AbstractShell",
"(",
"id",
",",
"renderer",
",",
"useConsole",
")",
";",
"}"
] |
Returns a new shell with given identifier and console flag.
@param id new shell with identifier
@param renderer a renderer for help messages
@param useConsole flag to use (true) or not to use (false) console, of false then no output will happen
@return new shell
|
[
"Returns",
"a",
"new",
"shell",
"with",
"given",
"identifier",
"and",
"console",
"flag",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java#L96-L98
|
150,798
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java
|
SkbShellFactory.newCommand
|
public static SkbShellCommand newCommand(String command, SkbShellCommandCategory category, String description, String addedHelp){
return new AbstractShellCommand(command, null, category, description, addedHelp);
}
|
java
|
public static SkbShellCommand newCommand(String command, SkbShellCommandCategory category, String description, String addedHelp){
return new AbstractShellCommand(command, null, category, description, addedHelp);
}
|
[
"public",
"static",
"SkbShellCommand",
"newCommand",
"(",
"String",
"command",
",",
"SkbShellCommandCategory",
"category",
",",
"String",
"description",
",",
"String",
"addedHelp",
")",
"{",
"return",
"new",
"AbstractShellCommand",
"(",
"command",
",",
"null",
",",
"category",
",",
"description",
",",
"addedHelp",
")",
";",
"}"
] |
Returns a new shell command without formal arguments, use the factory to create one.
@param command the actual command
@param category the command's category, can be null
@param description the command's description
@param addedHelp additional help, can be null
@return new shell command
@throws IllegalArgumentException if command or description was null
|
[
"Returns",
"a",
"new",
"shell",
"command",
"without",
"formal",
"arguments",
"use",
"the",
"factory",
"to",
"create",
"one",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java#L140-L142
|
150,799
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java
|
SkbShellFactory.newArgument
|
public static SkbShellArgument newArgument(String argument, boolean isOptional, SkbShellArgumentType type, Object[] valueSet, String description, String addedHelp){
return new AbstractShellArgument(argument, isOptional, type, valueSet, description, addedHelp);
}
|
java
|
public static SkbShellArgument newArgument(String argument, boolean isOptional, SkbShellArgumentType type, Object[] valueSet, String description, String addedHelp){
return new AbstractShellArgument(argument, isOptional, type, valueSet, description, addedHelp);
}
|
[
"public",
"static",
"SkbShellArgument",
"newArgument",
"(",
"String",
"argument",
",",
"boolean",
"isOptional",
",",
"SkbShellArgumentType",
"type",
",",
"Object",
"[",
"]",
"valueSet",
",",
"String",
"description",
",",
"String",
"addedHelp",
")",
"{",
"return",
"new",
"AbstractShellArgument",
"(",
"argument",
",",
"isOptional",
",",
"type",
",",
"valueSet",
",",
"description",
",",
"addedHelp",
")",
";",
"}"
] |
Returns a new shell argument, use the factory to create one.
@param argument the actual argument, cannot be blank
@param isOptional flag for optional (true if optional, false if not)
@param type the argument's type, cannot be null
@param valueSet the argument's value set if specified, can be null
@param description the command's description, cannot be null
@param addedHelp a string additional to the description for help
@return new shell argument
@throws IllegalArgumentException if argument, type, or description was null
|
[
"Returns",
"a",
"new",
"shell",
"argument",
"use",
"the",
"factory",
"to",
"create",
"one",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java#L155-L157
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.